code_text
stringlengths 604
999k
| repo_name
stringlengths 4
100
| file_path
stringlengths 4
873
| language
stringclasses 23
values | license
stringclasses 15
values | size
int32 1.02k
999k
|
---|---|---|---|---|---|
require "helper"
class TestConvertXPath < Nokogiri::TestCase
def setup
super
@N = Nokogiri(File.read(HTML_FILE))
end
def assert_syntactical_equivalence(hpath, xpath, match, &blk)
blk ||= lambda {|j| j.first}
assert_equal match, blk.call(@N.search(xpath)), "xpath result did not match"
end
def test_child_tag
assert_syntactical_equivalence("h1[a]", ".//h1[child::a]", "Tender Lovemaking") do |j|
j.inner_text
end
end
def test_child_tag_equals
assert_syntactical_equivalence("h1[a='Tender Lovemaking']", ".//h1[child::a = 'Tender Lovemaking']", "Tender Lovemaking") do |j|
j.inner_text
end
end
def test_filter_contains
assert_syntactical_equivalence("title:contains('Tender')", ".//title[contains(., 'Tender')]",
"Tender Lovemaking ") do |j|
j.inner_text
end
end
def test_filter_comment
assert_syntactical_equivalence("div comment()[2]", ".//div//comment()[position() = 2]", "<!-- end of header -->") do |j|
j.first.to_s
end
end
def test_filter_text
assert_syntactical_equivalence("a[text()]", ".//a[normalize-space(child::text())]", "<a href=\"http://tenderlovemaking.com\">Tender Lovemaking</a>") do |j|
j.first.to_s
end
assert_syntactical_equivalence("a[text()='Tender Lovemaking']", ".//a[normalize-space(child::text()) = 'Tender Lovemaking']", "<a href=\"http://tenderlovemaking.com\">Tender Lovemaking</a>") do |j|
j.first.to_s
end
assert_syntactical_equivalence("a/text()", ".//a/child::text()", "Tender Lovemaking") do |j|
j.first.to_s
end
assert_syntactical_equivalence("h2//a[text()!='Back Home!']", ".//h2//a[normalize-space(child::text()) != 'Back Home!']", "Meow meow meow meow meow") do |j|
j.first.inner_text
end
end
def test_filter_by_attr
assert_syntactical_equivalence("a[@href='http://blog.geminigeek.com/wordpress-theme']",
".//a[@href = 'http://blog.geminigeek.com/wordpress-theme']",
"http://blog.geminigeek.com/wordpress-theme") do |j|
j.first["href"]
end
end
def test_css_id
assert_syntactical_equivalence("#linkcat-7", ".//*[@id = 'linkcat-7']", "linkcat-7") do |j|
j.first["id"]
end
assert_syntactical_equivalence("li#linkcat-7", ".//li[@id = 'linkcat-7']", "linkcat-7") do |j|
j.first["id"]
end
end
def test_css_class
assert_syntactical_equivalence(".cat-item-15", ".//*[contains(concat(' ', @class, ' '), ' cat-item-15 ')]",
"cat-item cat-item-15") do |j|
j.first["class"]
end
assert_syntactical_equivalence("li.cat-item-15", ".//li[contains(concat(' ', @class, ' '), ' cat-item-15 ')]",
"cat-item cat-item-15") do |j|
j.first["class"]
end
end
def test_css_tags
assert_syntactical_equivalence("div li a", ".//div//li//a", "http://brobinius.org/") do |j|
j.first.inner_text
end
assert_syntactical_equivalence("div li > a", ".//div//li/a", "http://brobinius.org/") do |j|
j.first.inner_text
end
assert_syntactical_equivalence("h1 ~ small", ".//small[preceding-sibling::h1]", "The act of making love, tenderly.") do |j|
j.first.inner_text
end
assert_syntactical_equivalence("h1 ~ small", ".//small[preceding-sibling::h1]", "The act of making love, tenderly.") do |j|
j.first.inner_text
end
end
def test_positional
assert_syntactical_equivalence("div/div:first()", ".//div/div[position() = 1]", "\r\nTender Lovemaking\r\nThe act of making love, tenderly.\r\n".gsub(/[\r\n]/, '')) do |j|
j.first.inner_text.gsub(/[\r\n]/, '')
end
assert_syntactical_equivalence("div/div:first", ".//div/div[position() = 1]", "\r\nTender Lovemaking\r\nThe act of making love, tenderly.\r\n".gsub(/[\r\n]/, '')) do |j|
j.first.inner_text.gsub(/[\r\n]/, '')
end
assert_syntactical_equivalence("div//a:last()", ".//div//a[position() = last()]", "Wordpress") do |j|
j.last.inner_text
end
assert_syntactical_equivalence("div//a:last", ".//div//a[position() = last()]", "Wordpress") do |j|
j.last.inner_text
end
end
def test_multiple_filters
assert_syntactical_equivalence("a[@rel='bookmark'][1]", ".//a[@rel = 'bookmark' and position() = 1]", "Back Home!") do |j|
j.first.inner_text
end
end
# TODO:
# doc/'title ~ link' -> links that are siblings of title
# doc/'p[@class~="final"]' -> class includes string (whitespacy)
# doc/'p[text()*="final"]' -> class includes string (index) (broken: always returns true?)
# doc/'p[text()$="final"]' -> /final$/
# doc/'p[text()|="final"]' -> /^final$/
# doc/'p[text()^="final"]' -> string starts with 'final
# nth_first
# nth_last
# even
# odd
# first-child, nth-child, last-child, nth-last-child, nth-last-of-type
# only-of-type, only-child
# parent
# empty
# root
end
| tyg03485/tyg03485.github.io | _vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.8.1/test/test_convert_xpath.rb | Ruby | mit | 5,064 |
(function(global) {
var define = global.define;
var require = global.require;
var Ember = global.Ember;
if (typeof Ember === 'undefined' && typeof require !== 'undefined') {
Ember = require('ember');
}
Ember.libraries.register('Ember Simple Auth Devise', '0.7.2');
define("simple-auth-devise/authenticators/devise",
["simple-auth/authenticators/base","./../configuration","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var Base = __dependency1__["default"];
var Configuration = __dependency2__["default"];
/**
Authenticator that works with the Ruby gem
[Devise](https://github.com/plataformatec/devise).
__As token authentication is not actually part of devise anymore, the server
needs to implement some customizations__ to work with this authenticator -
see the README and
[discussion here](https://gist.github.com/josevalim/fb706b1e933ef01e4fb6).
_The factory for this authenticator is registered as
`'simple-auth-authenticator:devise'` in Ember's container._
@class Devise
@namespace SimpleAuth.Authenticators
@module simple-auth-devise/authenticators/devise
@extends Base
*/
__exports__["default"] = Base.extend({
/**
The endpoint on the server the authenticator acquires the auth token
and email from.
This value can be configured via
[`SimpleAuth.Configuration.Devise#serverTokenEndpoint`](#SimpleAuth-Configuration-Devise-serverTokenEndpoint).
@property serverTokenEndpoint
@type String
@default '/users/sign_in'
*/
serverTokenEndpoint: '/users/sign_in',
/**
The devise resource name
This value can be configured via
[`SimpleAuth.Configuration.Devise#resourceName`](#SimpleAuth-Configuration-Devise-resourceName).
@property resourceName
@type String
@default 'user'
*/
resourceName: 'user',
/**
The token attribute name.
This value can be configured via
[`SimpleAuth.Configuration.Devise#tokenAttributeName`](#SimpleAuth-Configuration-Devise-tokenAttributeName).
@property tokenAttributeName
@type String
@default 'user_token'
*/
tokenAttributeName: 'user_token',
/**
The identification attribute name.
This value can be configured via
[`SimpleAuth.Configuration.Devise#identificationAttributeName`](#SimpleAuth-Configuration-Devise-identificationAttributeName).
@property identificationAttributeName
@type String
@default 'user_email'
*/
identificationAttributeName: 'user_email',
/**
@method init
@private
*/
init: function() {
this.serverTokenEndpoint = Configuration.serverTokenEndpoint;
this.resourceName = Configuration.resourceName;
this.tokenAttributeName = Configuration.tokenAttributeName;
this.identificationAttributeName = Configuration.identificationAttributeName;
},
/**
Restores the session from a set of session properties; __will return a
resolving promise when there's a non-empty `user_token` and a non-empty
`user_email` in the `properties`__ and a rejecting promise otherwise.
@method restore
@param {Object} properties The properties to restore the session from
@return {Ember.RSVP.Promise} A promise that when it resolves results in the session being authenticated
*/
restore: function(properties) {
var _this = this;
var propertiesObject = Ember.Object.create(properties);
return new Ember.RSVP.Promise(function(resolve, reject) {
if (!Ember.isEmpty(propertiesObject.get(_this.tokenAttributeName)) && !Ember.isEmpty(propertiesObject.get(_this.identificationAttributeName))) {
resolve(properties);
} else {
reject();
}
});
},
/**
Authenticates the session with the specified `credentials`; the credentials
are `POST`ed to the
[`Authenticators.Devise#serverTokenEndpoint`](#SimpleAuth-Authenticators-Devise-serverTokenEndpoint)
and if they are valid the server returns an auth token and email in
response. __If the credentials are valid and authentication succeeds, a
promise that resolves with the server's response is returned__, otherwise a
promise that rejects with the server error is returned.
@method authenticate
@param {Object} options The credentials to authenticate the session with
@return {Ember.RSVP.Promise} A promise that resolves when an auth token and email is successfully acquired from the server and rejects otherwise
*/
authenticate: function(credentials) {
var _this = this;
return new Ember.RSVP.Promise(function(resolve, reject) {
var data = {};
data[_this.resourceName] = {
email: credentials.identification,
password: credentials.password
};
_this.makeRequest(data).then(function(response) {
Ember.run(function() {
resolve(response);
});
}, function(xhr, status, error) {
Ember.run(function() {
reject(xhr.responseJSON || xhr.responseText);
});
});
});
},
/**
Does nothing
@method invalidate
@return {Ember.RSVP.Promise} A resolving promise
*/
invalidate: function() {
return Ember.RSVP.resolve();
},
/**
@method makeRequest
@private
*/
makeRequest: function(data, resolve, reject) {
return Ember.$.ajax({
url: this.serverTokenEndpoint,
type: 'POST',
data: data,
dataType: 'json',
beforeSend: function(xhr, settings) {
xhr.setRequestHeader('Accept', settings.accepts.json);
}
});
}
});
});
define("simple-auth-devise/authorizers/devise",
["simple-auth/authorizers/base","./../configuration","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var Base = __dependency1__["default"];
var Configuration = __dependency2__["default"];
/**
Authenticator that works with the Ruby gem
[Devise](https://github.com/plataformatec/devise) by sending the `user_token`
and `user_email` properties from the session in the `Authorization` header.
__As token authentication is not actually part of devise anymore, the server
needs to implement some customizations__ to work with this authenticator -
see the README for more information.
_The factory for this authorizer is registered as
`'simple-auth-authorizer:devise'` in Ember's container._
@class Devise
@namespace SimpleAuth.Authorizers
@module simple-auth-devise/authorizers/devise
@extends Base
*/
__exports__["default"] = Base.extend({
/**
The token attribute name.
This value can be configured via
[`SimpleAuth.Configuration.Devise#tokenAttributeName`](#SimpleAuth-Configuration-Devise-tokenAttributeName).
@property tokenAttributeName
@type String
@default 'user_token'
*/
tokenAttributeName: 'user_token',
/**
The identification attribute name.
This value can be configured via
[`SimpleAuth.Configuration.Devise#identificationAttributeName`](#SimpleAuth-Configuration-Devise-identificationAttributeName).
@property identificationAttributeName
@type String
@default 'user_email'
*/
identificationAttributeName: 'user_email',
/**
Authorizes an XHR request by sending the `user_token` and `user_email`
properties from the session in the `Authorization` header:
```
Authorization: Token <tokenAttributeName>="<token>", <identificationAttributeName>="<user identification>"
```
@method authorize
@param {jqXHR} jqXHR The XHR request to authorize (see http://api.jquery.com/jQuery.ajax/#jqXHR)
@param {Object} requestOptions The options as provided to the `$.ajax` method (see http://api.jquery.com/jQuery.ajaxPrefilter/)
*/
/**
@method init
@private
*/
init: function() {
this.tokenAttributeName = Configuration.tokenAttributeName;
this.identificationAttributeName = Configuration.identificationAttributeName;
},
authorize: function(jqXHR, requestOptions) {
var userToken = this.get('session').get(this.tokenAttributeName);
var userIdentification = this.get('session').get(this.identificationAttributeName);
if (this.get('session.isAuthenticated') && !Ember.isEmpty(userToken) && !Ember.isEmpty(userIdentification)) {
var authData = this.tokenAttributeName + '="' + userToken + '", ' + this.identificationAttributeName + '="' + userIdentification + '"';
jqXHR.setRequestHeader('Authorization', 'Token ' + authData);
}
}
});
});
define("simple-auth-devise/configuration",
["simple-auth/utils/load-config","exports"],
function(__dependency1__, __exports__) {
"use strict";
var loadConfig = __dependency1__["default"];
var defaults = {
serverTokenEndpoint: '/users/sign_in',
resourceName: 'user',
tokenAttributeName: 'user_token',
identificationAttributeName: 'user_email'
};
/**
Ember Simple Auth Device's configuration object.
To change any of these values, set them on the application's environment
object:
```js
ENV['simple-auth-devise'] = {
serverTokenEndpoint: '/some/other/endpoint'
}
```
@class Devise
@namespace SimpleAuth.Configuration
@module simple-auth/configuration
*/
__exports__["default"] = {
/**
The endpoint on the server the authenticator acquires the auth token
and email from.
@property serverTokenEndpoint
@readOnly
@static
@type String
@default '/users/sign_in'
*/
serverTokenEndpoint: defaults.serverTokenEndpoint,
/**
The devise resource name.
@property resourceName
@readOnly
@static
@type String
@default 'user'
*/
resourceName: defaults.resourceName,
/**
The token attribute name.
@property tokenAttributeName
@readOnly
@static
@type String
@default 'user_token'
*/
tokenAttributeName: defaults.tokenAttributeName,
/**
The email attribute name.
@property identificationAttributeName
@readOnly
@static
@type String
@default 'user_email'
*/
identificationAttributeName: defaults.identificationAttributeName,
/**
@method load
@private
*/
load: loadConfig(defaults)
};
});
define("simple-auth-devise/ember",
["./initializer"],
function(__dependency1__) {
"use strict";
var initializer = __dependency1__["default"];
Ember.onLoad('Ember.Application', function(Application) {
Application.initializer(initializer);
});
});
define("simple-auth-devise/initializer",
["./configuration","simple-auth/utils/get-global-config","simple-auth-devise/authenticators/devise","simple-auth-devise/authorizers/devise","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
"use strict";
var Configuration = __dependency1__["default"];
var getGlobalConfig = __dependency2__["default"];
var Authenticator = __dependency3__["default"];
var Authorizer = __dependency4__["default"];
__exports__["default"] = {
name: 'simple-auth-devise',
before: 'simple-auth',
initialize: function(container, application) {
var config = getGlobalConfig('simple-auth-devise');
Configuration.load(container, config);
container.register('simple-auth-authorizer:devise', Authorizer);
container.register('simple-auth-authenticator:devise', Authenticator);
}
};
});
})(this);
| yinghunglai/cdnjs | ajax/libs/ember-simple-auth/0.7.2/simple-auth-devise.amd.js | JavaScript | mit | 12,555 |
jQuery.webshims.register("details",function(b,f,k,l,m,h){var i=function(a){var c=b(a).parent("details");if(c[0]&&c.children(":first").get(0)===a)return c},j=function(a,c){var a=b(a),c=b(c),d=b.data(c[0],"summaryElement");b.data(a[0],"detailsElement",c);if(!d||a[0]!==d[0])d&&(d.hasClass("fallback-summary")?d.remove():d.unbind(".summaryPolyfill").removeData("detailsElement").removeAttr("role").removeAttr("tabindex").removeAttr("aria-expanded").removeClass("summary-button").find("span.details-open-indicator").remove()),
b.data(c[0],"summaryElement",a),c.prop("open",c.prop("open"))};f.createElement("summary",function(){var a=i(this);if(a&&!b.data(this,"detailsElement")){var c,d,e=b.attr(this,"tabIndex")||"0";j(this,a);b(this).bind("focus.summaryPolyfill",function(){b(this).addClass("summary-has-focus")}).bind("blur.summaryPolyfill",function(){b(this).removeClass("summary-has-focus")}).bind("mouseenter.summaryPolyfill",function(){b(this).addClass("summary-has-hover")}).bind("mouseleave.summaryPolyfill",function(){b(this).removeClass("summary-has-hover")}).bind("click.summaryPolyfill",
function(a){var e=i(this);if(e){if(!d&&a.originalEvent)return d=!0,a.stopImmediatePropagation(),a.preventDefault(),b(this).trigger("click"),d=!1;clearTimeout(c);c=setTimeout(function(){a.isDefaultPrevented()||e.prop("open",!e.prop("open"))},0)}}).bind("keydown.summaryPolyfill",function(a){if((13==a.keyCode||32==a.keyCode)&&!a.isDefaultPrevented())d=!0,a.preventDefault(),b(this).trigger("click"),d=!1}).attr({tabindex:e,role:"button"}).prepend('<span class="details-open-indicator" />');f.moveToFirstEvent(this,
"click")}});var g;f.defineNodeNamesBooleanProperty("details","open",function(a){var c=b(b.data(this,"summaryElement"));if(c){var d=a?"removeClass":"addClass",e=b(this);if(!g&&h.animate){e.stop().css({width:"",height:""});var f={width:e.width(),height:e.height()}}c.attr("aria-expanded",""+a);e[d]("closed-details-summary").children().not(c[0])[d]("closed-details-child");!g&&h.animate&&(a={width:e.width(),height:e.height()},e.css(f).animate(a,{complete:function(){b(this).css({width:"",height:""})}}))}});
f.createElement("details",function(){g=!0;var a=b.data(this,"summaryElement");a||(a=b("> summary:first-child",this),a[0]?j(a,this):(b(this).prependPolyfill('<summary class="fallback-summary">'+h.text+"</summary>"),b.data(this,"summaryElement")));b.prop(this,"open",b.prop(this,"open"));g=!1})});
| perosb/jsdelivr | files/webshim/1.8.12/shims/details.js | JavaScript | mit | 2,419 |
var assert = require('assert'),
path = require('path'),
rimraf = require('rimraf'),
vows = require('vows'),
readDirFiles = require('read-dir-files'),
ncp = require('../').ncp;
var fixtures = path.join(__dirname, 'fixtures'),
src = path.join(fixtures, 'src'),
out = path.join(fixtures, 'out');
vows.describe('ncp').addBatch({
'When copying a directory of files': {
topic: function () {
var cb = this.callback;
rimraf(out, function () {
ncp(src, out, cb);
});
},
'files should be copied': {
topic: function () {
var cb = this.callback;
readDirFiles(src, 'utf8', function (srcErr, srcFiles) {
readDirFiles(out, 'utf8', function (outErr, outFiles) {
cb(outErr, srcFiles, outFiles);
});
});
},
'and the destination should match the source': function (err, srcFiles, outFiles) {
assert.isNull(err);
assert.deepEqual(srcFiles, outFiles);
}
}
}
}).addBatch({
'When copying files using filter': {
topic: function() {
var cb = this.callback;
var filter = function(name) {
return name.substr(name.length - 1) != 'a'
}
rimraf(out, function () {
ncp(src, out, {filter: filter}, cb);
});
},
'it should copy files': {
topic: function () {
var cb = this.callback;
readDirFiles(src, 'utf8', function (srcErr, srcFiles) {
function filter(files) {
for (var fileName in files) {
var curFile = files[fileName];
if (curFile instanceof Object)
return filter(curFile);
if (fileName.substr(fileName.length - 1) == 'a')
delete files[fileName];
}
}
filter(srcFiles);
readDirFiles(out, 'utf8', function (outErr, outFiles) {
cb(outErr, srcFiles, outFiles);
});
});
},
'and destination files should match source files that pass filter': function (err, srcFiles, outFiles) {
assert.isNull(err);
assert.deepEqual(srcFiles, outFiles);
}
}
}
}).export(module);
| Shipow/brackets | src/extensibility/node/node_modules/fs-extra/node_modules/ncp/test/ncp-test.js | JavaScript | mit | 2,192 |
.yui3-scrollview-scrollbar {
opacity: 1;
position: absolute;
width: 6px;
height: 10px;
}
.yui3-scrollview-scrollbar {
top: 0;
right: 1px;
}
.yui3-scrollview-scrollbar-horiz {
top:auto;
height: 8px;
width: 20px;
bottom: 1px;
left: 0;
}
.yui3-scrollview-scrollbar .yui3-scrollview-child {
position: absolute;
right: 0px;
display: block;
width: 100%;
height: 4px;
}
.yui3-scrollview-scrollbar .yui3-scrollview-first {
top: 0;
}
.yui3-scrollview-scrollbar .yui3-scrollview-last {
top: 0;
}
.yui3-scrollview-scrollbar .yui3-scrollview-middle {
position: absolute;
top: 4px;
height: 1px;
}
.yui3-scrollview-scrollbar-horiz .yui3-scrollview-child {
display:-moz-inline-stack;
display:inline-block;
zoom:1;
*display:inline;
top: 0;
left: 0;
bottom: auto;
right: auto;
}
.yui3-scrollview-scrollbar-horiz .yui3-scrollview-first,
.yui3-scrollview-scrollbar-horiz .yui3-scrollview-last {
width: 4px;
height: 6px;
}
.yui3-scrollview-scrollbar-horiz .yui3-scrollview-middle {
top: 0;
left: 4px;
width: 1px;
height: 6px;
}
.yui3-scrollview-scrollbar-vert-basic {
height:auto;
}
.yui3-scrollview-scrollbar-vert-basic .yui3-scrollview-child {
position:static;
_overflow:hidden;
_line-height:4px;
}
.yui3-scrollview-scrollbar-horiz-basic {
width:auto;
white-space:nowrap;
line-height:6px;
_overflow:hidden;
}
.yui3-scrollview-scrollbar-horiz-basic .yui3-scrollview-child {
position:static;
padding:0;
margin:0;
top:auto;
left:auto;
right:auto;
bottom:auto;
}
| wmkcc/cdnjs | ajax/libs/yui/3.18.0/scrollview-scrollbars/assets/scrollview-scrollbars-core.css | CSS | mit | 1,657 |
var es = require('../')
, it = require('it-is').style('colour')
, d = require('ubelt')
function makeExamplePipe() {
return es.connect(
es.map(function (data, callback) {
callback(null, data * 2)
}),
es.map(function (data, callback) {
d.delay(callback)(null, data)
}),
es.map(function (data, callback) {
callback(null, data + 2)
}))
}
exports['simple pipe'] = function (test) {
var pipe = makeExamplePipe()
pipe.on('data', function (data) {
it(data).equal(18)
test.done()
})
pipe.write(8)
}
exports['read array then map'] = function (test) {
var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
, first = es.readArray(readThis)
, read = []
, pipe =
es.connect(
first,
es.map(function (data, callback) {
callback(null, {data: data})
}),
es.map(function (data, callback) {
callback(null, {data: data})
}),
es.writeArray(function (err, array) {
it(array).deepEqual(d.map(readThis, function (data) {
return {data: {data: data}}
}))
test.done()
})
)
}
exports ['connect returns a stream'] = function (test) {
var rw =
es.connect(
es.map(function (data, callback) {
callback(null, data * 2)
}),
es.map(function (data, callback) {
callback(null, data * 5)
})
)
it(rw).has({readable: true, writable: true})
var array = [190, 24, 6, 7, 40, 57, 4, 6]
, _array = []
, c =
es.connect(
es.readArray(array),
rw,
es.log('after rw:'),
es.writeArray(function (err, _array) {
it(_array).deepEqual(array.map(function (e) { return e * 10 }))
test.done()
})
)
}
require('./helper')(module)
| slav/reactJsNetExamples | MvcReact/MvcReact/node_modules/gulp-tap/node_modules/event-stream/test/connect.asynct.js | JavaScript | mit | 1,780 |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface;
/**
* EventDataCollector.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class EventDataCollector extends DataCollector implements LateDataCollectorInterface
{
protected $dispatcher;
public function __construct(EventDispatcherInterface $dispatcher = null)
{
$this->dispatcher = $dispatcher;
}
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->data = array(
'called_listeners' => array(),
'not_called_listeners' => array(),
);
}
public function lateCollect()
{
if ($this->dispatcher instanceof TraceableEventDispatcherInterface) {
$this->setCalledListeners($this->dispatcher->getCalledListeners());
$this->setNotCalledListeners($this->dispatcher->getNotCalledListeners());
}
}
/**
* Sets the called listeners.
*
* @param array $listeners An array of called listeners
*
* @see TraceableEventDispatcherInterface
*/
public function setCalledListeners(array $listeners)
{
$this->data['called_listeners'] = $listeners;
}
/**
* Gets the called listeners.
*
* @return array An array of called listeners
*
* @see TraceableEventDispatcherInterface
*/
public function getCalledListeners()
{
return $this->data['called_listeners'];
}
/**
* Sets the not called listeners.
*
* @param array $listeners An array of not called listeners
*
* @see TraceableEventDispatcherInterface
*/
public function setNotCalledListeners(array $listeners)
{
$this->data['not_called_listeners'] = $listeners;
}
/**
* Gets the not called listeners.
*
* @return array An array of not called listeners
*
* @see TraceableEventDispatcherInterface
*/
public function getNotCalledListeners()
{
return $this->data['not_called_listeners'];
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'events';
}
}
| jwaver/hhoCebu | vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php | PHP | mit | 2,684 |
var BaseCommand = require('./base_command').BaseCommand,
inherits = require('util').inherits;
/**
Insert Document Command
**/
var InsertCommand = exports.InsertCommand = function(db, collectionName, checkKeys, options) {
BaseCommand.call(this);
this.collectionName = collectionName;
this.documents = [];
this.checkKeys = checkKeys == null ? true : checkKeys;
this.db = db;
this.flags = 0;
this.serializeFunctions = false;
// Ensure valid options hash
options = options == null ? {} : options;
// Check if we have keepGoing set -> set flag if it's the case
if(options['keepGoing'] != null && options['keepGoing']) {
// This will finish inserting all non-index violating documents even if it returns an error
this.flags = 1;
}
// Check if we have keepGoing set -> set flag if it's the case
if(options['continueOnError'] != null && options['continueOnError']) {
// This will finish inserting all non-index violating documents even if it returns an error
this.flags = 1;
}
// Let us defined on a command basis if we want functions to be serialized or not
if(options['serializeFunctions'] != null && options['serializeFunctions']) {
this.serializeFunctions = true;
}
};
inherits(InsertCommand, BaseCommand);
// OpCodes
InsertCommand.OP_INSERT = 2002;
InsertCommand.prototype.add = function(document) {
if(Buffer.isBuffer(document)) {
var object_size = document[0] | document[1] << 8 | document[2] << 16 | document[3] << 24;
if(object_size != document.length) {
var error = new Error("insert raw message size does not match message header size [" + document.length + "] != [" + object_size + "]");
error.name = 'MongoError';
throw error;
}
}
this.documents.push(document);
return this;
};
/*
struct {
MsgHeader header; // standard message header
int32 ZERO; // 0 - reserved for future use
cstring fullCollectionName; // "dbname.collectionname"
BSON[] documents; // one or more documents to insert into the collection
}
*/
InsertCommand.prototype.toBinary = function(bsonSettings) {
// Validate that we are not passing 0x00 in the colletion name
if(!!~this.collectionName.indexOf("\x00")) {
throw new Error("namespace cannot contain a null character");
}
// Calculate total length of the document
var totalLengthOfCommand = 4 + Buffer.byteLength(this.collectionName) + 1 + (4 * 4);
// var docLength = 0
for(var i = 0; i < this.documents.length; i++) {
if(Buffer.isBuffer(this.documents[i])) {
totalLengthOfCommand += this.documents[i].length;
} else {
// Calculate size of document
totalLengthOfCommand += this.db.bson.calculateObjectSize(this.documents[i], this.serializeFunctions, true);
}
}
// Enforce maximum bson size
if(!bsonSettings.disableDriverBSONSizeCheck
&& totalLengthOfCommand > bsonSettings.maxBsonSize)
throw new Error("Document exceeds maximum allowed bson size of " + bsonSettings.maxBsonSize + " bytes");
if(bsonSettings.disableDriverBSONSizeCheck
&& totalLengthOfCommand > bsonSettings.maxMessageSizeBytes)
throw new Error("Command exceeds maximum message size of " + bsonSettings.maxMessageSizeBytes + " bytes");
// Let's build the single pass buffer command
var _index = 0;
var _command = new Buffer(totalLengthOfCommand);
// Write the header information to the buffer
_command[_index + 3] = (totalLengthOfCommand >> 24) & 0xff;
_command[_index + 2] = (totalLengthOfCommand >> 16) & 0xff;
_command[_index + 1] = (totalLengthOfCommand >> 8) & 0xff;
_command[_index] = totalLengthOfCommand & 0xff;
// Adjust index
_index = _index + 4;
// Write the request ID
_command[_index + 3] = (this.requestId >> 24) & 0xff;
_command[_index + 2] = (this.requestId >> 16) & 0xff;
_command[_index + 1] = (this.requestId >> 8) & 0xff;
_command[_index] = this.requestId & 0xff;
// Adjust index
_index = _index + 4;
// Write zero
_command[_index++] = 0;
_command[_index++] = 0;
_command[_index++] = 0;
_command[_index++] = 0;
// Write the op_code for the command
_command[_index + 3] = (InsertCommand.OP_INSERT >> 24) & 0xff;
_command[_index + 2] = (InsertCommand.OP_INSERT >> 16) & 0xff;
_command[_index + 1] = (InsertCommand.OP_INSERT >> 8) & 0xff;
_command[_index] = InsertCommand.OP_INSERT & 0xff;
// Adjust index
_index = _index + 4;
// Write flags if any
_command[_index + 3] = (this.flags >> 24) & 0xff;
_command[_index + 2] = (this.flags >> 16) & 0xff;
_command[_index + 1] = (this.flags >> 8) & 0xff;
_command[_index] = this.flags & 0xff;
// Adjust index
_index = _index + 4;
// Write the collection name to the command
_index = _index + _command.write(this.collectionName, _index, 'utf8') + 1;
_command[_index - 1] = 0;
// Write all the bson documents to the buffer at the index offset
for(var i = 0; i < this.documents.length; i++) {
// Document binary length
var documentLength = 0
var object = this.documents[i];
// Serialize the selector
// If we are passing a raw buffer, do minimal validation
if(Buffer.isBuffer(object)) {
documentLength = object.length;
// Copy the data into the current buffer
object.copy(_command, _index);
} else {
// Serialize the document straight to the buffer
documentLength = this.db.bson.serializeWithBufferAndIndex(object, this.checkKeys, _command, _index, this.serializeFunctions) - _index + 1;
}
// Write the length to the document
_command[_index + 3] = (documentLength >> 24) & 0xff;
_command[_index + 2] = (documentLength >> 16) & 0xff;
_command[_index + 1] = (documentLength >> 8) & 0xff;
_command[_index] = documentLength & 0xff;
// Update index in buffer
_index = _index + documentLength;
// Add terminating 0 for the object
_command[_index - 1] = 0;
}
return _command;
};
| andavis27/andyndavis | node_modules/mongoose/node_modules/mongodb/lib/mongodb/commands/insert_command.js | JavaScript | mit | 5,959 |
/* ========================================================================
* Bootstrap: popover.js v3.3.6
* http://getbootstrap.com/javascript/#popovers
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// POPOVER PUBLIC CLASS DEFINITION
// ===============================
var Popover = function (element, options) {
this.init('popover', element, options)
}
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION = '3.3.6'
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
})
// NOTE: POPOVER EXTENDS tooltip.js
// ================================
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor = Popover
Popover.prototype.getDefaults = function () {
return Popover.DEFAULTS
}
Popover.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
var content = this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
$tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
](content)
$tip.removeClass('fade top bottom left right in')
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// this manually by checking the contents.
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
}
Popover.prototype.hasContent = function () {
return this.getTitle() || this.getContent()
}
Popover.prototype.getContent = function () {
var $e = this.$element
var o = this.options
return $e.attr('data-content')
|| (typeof o.content == 'function' ?
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
}
// POPOVER PLUGIN DEFINITION
// =========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.popover')
var options = typeof option == 'object' && option
if (!data && /destroy|hide/.test(option)) return
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.popover
$.fn.popover = Plugin
$.fn.popover.Constructor = Popover
// POPOVER NO CONFLICT
// ===================
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(jQuery);
| pcuervo/real-michoacana | js/popover.js | JavaScript | mit | 3,163 |
var baseTimes = require('./_baseTimes'),
castFunction = require('./_castFunction'),
toInteger = require('./toInteger');
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;
/**
* Invokes the iteratee `n` times, returning an array of the results of
* each invocation. The iteratee is invoked with one argument; (index).
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the array of results.
* @example
*
* _.times(3, String);
* // => ['0', '1', '2']
*
* _.times(4, _.constant(0));
* // => [0, 0, 0, 0]
*/
function times(n, iteratee) {
n = toInteger(n);
if (n < 1 || n > MAX_SAFE_INTEGER) {
return [];
}
var index = MAX_ARRAY_LENGTH,
length = nativeMin(n, MAX_ARRAY_LENGTH);
iteratee = castFunction(iteratee);
n -= MAX_ARRAY_LENGTH;
var result = baseTimes(length, iteratee);
while (++index < n) {
iteratee(index);
}
return result;
}
module.exports = times;
| cheneus/SinglePgApp-Restaurant | node_modules/combine-lists/node_modules/lodash/times.js | JavaScript | mit | 1,367 |
/* js-yaml 3.5.0 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
var loader = require('./js-yaml/loader');
var dumper = require('./js-yaml/dumper');
function deprecated(name) {
return function () {
throw new Error('Function ' + name + ' is deprecated and cannot be used.');
};
}
module.exports.Type = require('./js-yaml/type');
module.exports.Schema = require('./js-yaml/schema');
module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe');
module.exports.JSON_SCHEMA = require('./js-yaml/schema/json');
module.exports.CORE_SCHEMA = require('./js-yaml/schema/core');
module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');
module.exports.load = loader.load;
module.exports.loadAll = loader.loadAll;
module.exports.safeLoad = loader.safeLoad;
module.exports.safeLoadAll = loader.safeLoadAll;
module.exports.dump = dumper.dump;
module.exports.safeDump = dumper.safeDump;
module.exports.YAMLException = require('./js-yaml/exception');
// Deprecated schema names from JS-YAML 2.0.x
module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
// Deprecated functions from JS-YAML 1.x.x
module.exports.scan = deprecated('scan');
module.exports.parse = deprecated('parse');
module.exports.compose = deprecated('compose');
module.exports.addConstructor = deprecated('addConstructor');
},{"./js-yaml/dumper":3,"./js-yaml/exception":4,"./js-yaml/loader":5,"./js-yaml/schema":7,"./js-yaml/schema/core":8,"./js-yaml/schema/default_full":9,"./js-yaml/schema/default_safe":10,"./js-yaml/schema/failsafe":11,"./js-yaml/schema/json":12,"./js-yaml/type":13}],2:[function(require,module,exports){
'use strict';
function isNothing(subject) {
return (typeof subject === 'undefined') || (null === subject);
}
function isObject(subject) {
return (typeof subject === 'object') && (null !== subject);
}
function toArray(sequence) {
if (Array.isArray(sequence)) {
return sequence;
} else if (isNothing(sequence)) {
return [];
}
return [ sequence ];
}
function extend(target, source) {
var index, length, key, sourceKeys;
if (source) {
sourceKeys = Object.keys(source);
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
key = sourceKeys[index];
target[key] = source[key];
}
}
return target;
}
function repeat(string, count) {
var result = '', cycle;
for (cycle = 0; cycle < count; cycle += 1) {
result += string;
}
return result;
}
function isNegativeZero(number) {
return (0 === number) && (Number.NEGATIVE_INFINITY === 1 / number);
}
module.exports.isNothing = isNothing;
module.exports.isObject = isObject;
module.exports.toArray = toArray;
module.exports.repeat = repeat;
module.exports.isNegativeZero = isNegativeZero;
module.exports.extend = extend;
},{}],3:[function(require,module,exports){
'use strict';
/*eslint-disable no-use-before-define*/
var common = require('./common');
var YAMLException = require('./exception');
var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
var _toString = Object.prototype.toString;
var _hasOwnProperty = Object.prototype.hasOwnProperty;
var CHAR_TAB = 0x09; /* Tab */
var CHAR_LINE_FEED = 0x0A; /* LF */
var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
var CHAR_SPACE = 0x20; /* Space */
var CHAR_EXCLAMATION = 0x21; /* ! */
var CHAR_DOUBLE_QUOTE = 0x22; /* " */
var CHAR_SHARP = 0x23; /* # */
var CHAR_PERCENT = 0x25; /* % */
var CHAR_AMPERSAND = 0x26; /* & */
var CHAR_SINGLE_QUOTE = 0x27; /* ' */
var CHAR_ASTERISK = 0x2A; /* * */
var CHAR_COMMA = 0x2C; /* , */
var CHAR_MINUS = 0x2D; /* - */
var CHAR_COLON = 0x3A; /* : */
var CHAR_GREATER_THAN = 0x3E; /* > */
var CHAR_QUESTION = 0x3F; /* ? */
var CHAR_COMMERCIAL_AT = 0x40; /* @ */
var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
var CHAR_GRAVE_ACCENT = 0x60; /* ` */
var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
var CHAR_VERTICAL_LINE = 0x7C; /* | */
var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
var ESCAPE_SEQUENCES = {};
ESCAPE_SEQUENCES[0x00] = '\\0';
ESCAPE_SEQUENCES[0x07] = '\\a';
ESCAPE_SEQUENCES[0x08] = '\\b';
ESCAPE_SEQUENCES[0x09] = '\\t';
ESCAPE_SEQUENCES[0x0A] = '\\n';
ESCAPE_SEQUENCES[0x0B] = '\\v';
ESCAPE_SEQUENCES[0x0C] = '\\f';
ESCAPE_SEQUENCES[0x0D] = '\\r';
ESCAPE_SEQUENCES[0x1B] = '\\e';
ESCAPE_SEQUENCES[0x22] = '\\"';
ESCAPE_SEQUENCES[0x5C] = '\\\\';
ESCAPE_SEQUENCES[0x85] = '\\N';
ESCAPE_SEQUENCES[0xA0] = '\\_';
ESCAPE_SEQUENCES[0x2028] = '\\L';
ESCAPE_SEQUENCES[0x2029] = '\\P';
var DEPRECATED_BOOLEANS_SYNTAX = [
'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
];
function compileStyleMap(schema, map) {
var result, keys, index, length, tag, style, type;
if (null === map) {
return {};
}
result = {};
keys = Object.keys(map);
for (index = 0, length = keys.length; index < length; index += 1) {
tag = keys[index];
style = String(map[tag]);
if ('!!' === tag.slice(0, 2)) {
tag = 'tag:yaml.org,2002:' + tag.slice(2);
}
type = schema.compiledTypeMap[tag];
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
style = type.styleAliases[style];
}
result[tag] = style;
}
return result;
}
function encodeHex(character) {
var string, handle, length;
string = character.toString(16).toUpperCase();
if (character <= 0xFF) {
handle = 'x';
length = 2;
} else if (character <= 0xFFFF) {
handle = 'u';
length = 4;
} else if (character <= 0xFFFFFFFF) {
handle = 'U';
length = 8;
} else {
throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
}
return '\\' + handle + common.repeat('0', length - string.length) + string;
}
function State(options) {
this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
this.indent = Math.max(1, (options['indent'] || 2));
this.skipInvalid = options['skipInvalid'] || false;
this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
this.sortKeys = options['sortKeys'] || false;
this.lineWidth = options['lineWidth'] || 80;
this.noRefs = options['noRefs'] || false;
this.implicitTypes = this.schema.compiledImplicit;
this.explicitTypes = this.schema.compiledExplicit;
this.tag = null;
this.result = '';
this.duplicates = [];
this.usedDuplicates = null;
}
function indentString(string, spaces) {
var ind = common.repeat(' ', spaces),
position = 0,
next = -1,
result = '',
line,
length = string.length;
while (position < length) {
next = string.indexOf('\n', position);
if (next === -1) {
line = string.slice(position);
position = length;
} else {
line = string.slice(position, next + 1);
position = next + 1;
}
if (line.length && line !== '\n') {
result += ind;
}
result += line;
}
return result;
}
function generateNextLine(state, level) {
return '\n' + common.repeat(' ', state.indent * level);
}
function testImplicitResolving(state, str) {
var index, length, type;
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
type = state.implicitTypes[index];
if (type.resolve(str)) {
return true;
}
}
return false;
}
function StringBuilder(source) {
this.source = source;
this.result = '';
this.checkpoint = 0;
}
StringBuilder.prototype.takeUpTo = function (position) {
var er;
if (position < this.checkpoint) {
er = new Error('position should be > checkpoint');
er.position = position;
er.checkpoint = this.checkpoint;
throw er;
}
this.result += this.source.slice(this.checkpoint, position);
this.checkpoint = position;
return this;
};
StringBuilder.prototype.escapeChar = function () {
var character, esc;
character = this.source.charCodeAt(this.checkpoint);
esc = ESCAPE_SEQUENCES[character] || encodeHex(character);
this.result += esc;
this.checkpoint += 1;
return this;
};
StringBuilder.prototype.finish = function () {
if (this.source.length > this.checkpoint) {
this.takeUpTo(this.source.length);
}
};
function writeScalar(state, object, level, iskey) {
var simple, first, spaceWrap, folded, literal, single, double,
sawLineFeed, linePosition, longestLine, indent, max, character,
position, escapeSeq, hexEsc, previous, lineLength, modifier,
trailingLineBreaks, result;
if (0 === object.length) {
state.dump = "''";
return;
}
if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) {
state.dump = "'" + object + "'";
return;
}
simple = true;
first = object.length ? object.charCodeAt(0) : 0;
spaceWrap = (CHAR_SPACE === first ||
CHAR_SPACE === object.charCodeAt(object.length - 1));
// Simplified check for restricted first characters
// http://www.yaml.org/spec/1.2/spec.html#ns-plain-first%28c%29
if (CHAR_MINUS === first ||
CHAR_QUESTION === first ||
CHAR_COMMERCIAL_AT === first ||
CHAR_GRAVE_ACCENT === first) {
simple = false;
}
// Can only use > and | if not wrapped in spaces or is not a key.
// Also, don't use if in flow mode.
if (spaceWrap || (state.flowLevel > -1 && state.flowLevel <= level)) {
if (spaceWrap) {
simple = false;
}
folded = false;
literal = false;
} else {
folded = !iskey;
literal = !iskey;
}
single = true;
double = new StringBuilder(object);
sawLineFeed = false;
linePosition = 0;
longestLine = 0;
indent = state.indent * level;
max = state.lineWidth;
if (max === -1) {
// Replace -1 with biggest ingeger number according to
// http://ecma262-5.com/ELS5_HTML.htm#Section_8.5
max = 9007199254740991;
}
if (indent < 40) {
max -= indent;
} else {
max = 40;
}
for (position = 0; position < object.length; position++) {
character = object.charCodeAt(position);
if (simple) {
// Characters that can never appear in the simple scalar
if (!simpleChar(character)) {
simple = false;
} else {
// Still simple. If we make it all the way through like
// this, then we can just dump the string as-is.
continue;
}
}
if (single && character === CHAR_SINGLE_QUOTE) {
single = false;
}
escapeSeq = ESCAPE_SEQUENCES[character];
hexEsc = needsHexEscape(character);
if (!escapeSeq && !hexEsc) {
continue;
}
if (character !== CHAR_LINE_FEED &&
character !== CHAR_DOUBLE_QUOTE &&
character !== CHAR_SINGLE_QUOTE) {
folded = false;
literal = false;
} else if (character === CHAR_LINE_FEED) {
sawLineFeed = true;
single = false;
if (position > 0) {
previous = object.charCodeAt(position - 1);
if (previous === CHAR_SPACE) {
literal = false;
folded = false;
}
}
if (folded) {
lineLength = position - linePosition;
linePosition = position;
if (lineLength > longestLine) {
longestLine = lineLength;
}
}
}
if (character !== CHAR_DOUBLE_QUOTE) {
single = false;
}
double.takeUpTo(position);
double.escapeChar();
}
if (simple && testImplicitResolving(state, object)) {
simple = false;
}
modifier = '';
if (folded || literal) {
trailingLineBreaks = 0;
if (object.charCodeAt(object.length - 1) === CHAR_LINE_FEED) {
trailingLineBreaks += 1;
if (object.charCodeAt(object.length - 2) === CHAR_LINE_FEED) {
trailingLineBreaks += 1;
}
}
if (trailingLineBreaks === 0) {
modifier = '-';
} else if (trailingLineBreaks === 2) {
modifier = '+';
}
}
if (literal && longestLine < max || state.tag !== null) {
folded = false;
}
// If it's literally one line, then don't bother with the literal.
// We may still want to do a fold, though, if it's a super long line.
if (!sawLineFeed) {
literal = false;
}
if (simple) {
state.dump = object;
} else if (single) {
state.dump = '\'' + object + '\'';
} else if (folded) {
result = fold(object, max);
state.dump = '>' + modifier + '\n' + indentString(result, indent);
} else if (literal) {
if (!modifier) {
object = object.replace(/\n$/, '');
}
state.dump = '|' + modifier + '\n' + indentString(object, indent);
} else if (double) {
double.finish();
state.dump = '"' + double.result + '"';
} else {
throw new Error('Failed to dump scalar value');
}
return;
}
// The `trailing` var is a regexp match of any trailing `\n` characters.
//
// There are three cases we care about:
//
// 1. One trailing `\n` on the string. Just use `|` or `>`.
// This is the assumed default. (trailing = null)
// 2. No trailing `\n` on the string. Use `|-` or `>-` to "chomp" the end.
// 3. More than one trailing `\n` on the string. Use `|+` or `>+`.
//
// In the case of `>+`, these line breaks are *not* doubled (like the line
// breaks within the string), so it's important to only end with the exact
// same number as we started.
function fold(object, max) {
var result = '',
position = 0,
length = object.length,
trailing = /\n+$/.exec(object),
newLine;
if (trailing) {
length = trailing.index + 1;
}
while (position < length) {
newLine = object.indexOf('\n', position);
if (newLine > length || newLine === -1) {
if (result) {
result += '\n\n';
}
result += foldLine(object.slice(position, length), max);
position = length;
} else {
if (result) {
result += '\n\n';
}
result += foldLine(object.slice(position, newLine), max);
position = newLine + 1;
}
}
if (trailing && trailing[0] !== '\n') {
result += trailing[0];
}
return result;
}
function foldLine(line, max) {
if (line === '') {
return line;
}
var foldRe = /[^\s] [^\s]/g,
result = '',
prevMatch = 0,
foldStart = 0,
match = foldRe.exec(line),
index,
foldEnd,
folded;
while (match) {
index = match.index;
// when we cross the max len, if the previous match would've
// been ok, use that one, and carry on. If there was no previous
// match on this fold section, then just have a long line.
if (index - foldStart > max) {
if (prevMatch !== foldStart) {
foldEnd = prevMatch;
} else {
foldEnd = index;
}
if (result) {
result += '\n';
}
folded = line.slice(foldStart, foldEnd);
result += folded;
foldStart = foldEnd + 1;
}
prevMatch = index + 1;
match = foldRe.exec(line);
}
if (result) {
result += '\n';
}
// if we end up with one last word at the end, then the last bit might
// be slightly bigger than we wanted, because we exited out of the loop.
if (foldStart !== prevMatch && line.length - foldStart > max) {
result += line.slice(foldStart, prevMatch) + '\n' +
line.slice(prevMatch + 1);
} else {
result += line.slice(foldStart);
}
return result;
}
// Returns true if character can be found in a simple scalar
function simpleChar(character) {
return CHAR_TAB !== character &&
CHAR_LINE_FEED !== character &&
CHAR_CARRIAGE_RETURN !== character &&
CHAR_COMMA !== character &&
CHAR_LEFT_SQUARE_BRACKET !== character &&
CHAR_RIGHT_SQUARE_BRACKET !== character &&
CHAR_LEFT_CURLY_BRACKET !== character &&
CHAR_RIGHT_CURLY_BRACKET !== character &&
CHAR_SHARP !== character &&
CHAR_AMPERSAND !== character &&
CHAR_ASTERISK !== character &&
CHAR_EXCLAMATION !== character &&
CHAR_VERTICAL_LINE !== character &&
CHAR_GREATER_THAN !== character &&
CHAR_SINGLE_QUOTE !== character &&
CHAR_DOUBLE_QUOTE !== character &&
CHAR_PERCENT !== character &&
CHAR_COLON !== character &&
!ESCAPE_SEQUENCES[character] &&
!needsHexEscape(character);
}
// Returns true if the character code needs to be escaped.
function needsHexEscape(character) {
return !((0x00020 <= character && character <= 0x00007E) ||
(0x00085 === character) ||
(0x000A0 <= character && character <= 0x00D7FF) ||
(0x0E000 <= character && character <= 0x00FFFD) ||
(0x10000 <= character && character <= 0x10FFFF));
}
function writeFlowSequence(state, level, object) {
var _result = '',
_tag = state.tag,
index,
length;
for (index = 0, length = object.length; index < length; index += 1) {
// Write only valid elements.
if (writeNode(state, level, object[index], false, false)) {
if (0 !== index) {
_result += ', ';
}
_result += state.dump;
}
}
state.tag = _tag;
state.dump = '[' + _result + ']';
}
function writeBlockSequence(state, level, object, compact) {
var _result = '',
_tag = state.tag,
index,
length;
for (index = 0, length = object.length; index < length; index += 1) {
// Write only valid elements.
if (writeNode(state, level + 1, object[index], true, true)) {
if (!compact || 0 !== index) {
_result += generateNextLine(state, level);
}
_result += '- ' + state.dump;
}
}
state.tag = _tag;
state.dump = _result || '[]'; // Empty sequence if no valid values.
}
function writeFlowMapping(state, level, object) {
var _result = '',
_tag = state.tag,
objectKeyList = Object.keys(object),
index,
length,
objectKey,
objectValue,
pairBuffer;
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
pairBuffer = '';
if (0 !== index) {
pairBuffer += ', ';
}
objectKey = objectKeyList[index];
objectValue = object[objectKey];
if (!writeNode(state, level, objectKey, false, false)) {
continue; // Skip this pair because of invalid key;
}
if (state.dump.length > 1024) {
pairBuffer += '? ';
}
pairBuffer += state.dump + ': ';
if (!writeNode(state, level, objectValue, false, false)) {
continue; // Skip this pair because of invalid value.
}
pairBuffer += state.dump;
// Both key and value are valid.
_result += pairBuffer;
}
state.tag = _tag;
state.dump = '{' + _result + '}';
}
function writeBlockMapping(state, level, object, compact) {
var _result = '',
_tag = state.tag,
objectKeyList = Object.keys(object),
index,
length,
objectKey,
objectValue,
explicitPair,
pairBuffer;
// Allow sorting keys so that the output file is deterministic
if (state.sortKeys === true) {
// Default sorting
objectKeyList.sort();
} else if (typeof state.sortKeys === 'function') {
// Custom sort function
objectKeyList.sort(state.sortKeys);
} else if (state.sortKeys) {
// Something is wrong
throw new YAMLException('sortKeys must be a boolean or a function');
}
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
pairBuffer = '';
if (!compact || 0 !== index) {
pairBuffer += generateNextLine(state, level);
}
objectKey = objectKeyList[index];
objectValue = object[objectKey];
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
continue; // Skip this pair because of invalid key.
}
explicitPair = (null !== state.tag && '?' !== state.tag) ||
(state.dump && state.dump.length > 1024);
if (explicitPair) {
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
pairBuffer += '?';
} else {
pairBuffer += '? ';
}
}
pairBuffer += state.dump;
if (explicitPair) {
pairBuffer += generateNextLine(state, level);
}
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
continue; // Skip this pair because of invalid value.
}
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
pairBuffer += ':';
} else {
pairBuffer += ': ';
}
pairBuffer += state.dump;
// Both key and value are valid.
_result += pairBuffer;
}
state.tag = _tag;
state.dump = _result || '{}'; // Empty mapping if no valid pairs.
}
function detectType(state, object, explicit) {
var _result, typeList, index, length, type, style;
typeList = explicit ? state.explicitTypes : state.implicitTypes;
for (index = 0, length = typeList.length; index < length; index += 1) {
type = typeList[index];
if ((type.instanceOf || type.predicate) &&
(!type.instanceOf || (('object' === typeof object) && (object instanceof type.instanceOf))) &&
(!type.predicate || type.predicate(object))) {
state.tag = explicit ? type.tag : '?';
if (type.represent) {
style = state.styleMap[type.tag] || type.defaultStyle;
if ('[object Function]' === _toString.call(type.represent)) {
_result = type.represent(object, style);
} else if (_hasOwnProperty.call(type.represent, style)) {
_result = type.represent[style](object, style);
} else {
throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
}
state.dump = _result;
}
return true;
}
}
return false;
}
// Serializes `object` and writes it to global `result`.
// Returns true on success, or false on invalid object.
//
function writeNode(state, level, object, block, compact, iskey) {
state.tag = null;
state.dump = object;
if (!detectType(state, object, false)) {
detectType(state, object, true);
}
var type = _toString.call(state.dump);
if (block) {
block = (0 > state.flowLevel || state.flowLevel > level);
}
var objectOrArray = '[object Object]' === type || '[object Array]' === type,
duplicateIndex,
duplicate;
if (objectOrArray) {
duplicateIndex = state.duplicates.indexOf(object);
duplicate = duplicateIndex !== -1;
}
if ((null !== state.tag && '?' !== state.tag) || duplicate || (2 !== state.indent && level > 0)) {
compact = false;
}
if (duplicate && state.usedDuplicates[duplicateIndex]) {
state.dump = '*ref_' + duplicateIndex;
} else {
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
state.usedDuplicates[duplicateIndex] = true;
}
if ('[object Object]' === type) {
if (block && (0 !== Object.keys(state.dump).length)) {
writeBlockMapping(state, level, state.dump, compact);
if (duplicate) {
state.dump = '&ref_' + duplicateIndex + state.dump;
}
} else {
writeFlowMapping(state, level, state.dump);
if (duplicate) {
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
}
}
} else if ('[object Array]' === type) {
if (block && (0 !== state.dump.length)) {
writeBlockSequence(state, level, state.dump, compact);
if (duplicate) {
state.dump = '&ref_' + duplicateIndex + state.dump;
}
} else {
writeFlowSequence(state, level, state.dump);
if (duplicate) {
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
}
}
} else if ('[object String]' === type) {
if ('?' !== state.tag) {
writeScalar(state, state.dump, level, iskey);
}
} else {
if (state.skipInvalid) {
return false;
}
throw new YAMLException('unacceptable kind of an object to dump ' + type);
}
if (null !== state.tag && '?' !== state.tag) {
state.dump = '!<' + state.tag + '> ' + state.dump;
}
}
return true;
}
function getDuplicateReferences(object, state) {
var objects = [],
duplicatesIndexes = [],
index,
length;
inspectNode(object, objects, duplicatesIndexes);
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
state.duplicates.push(objects[duplicatesIndexes[index]]);
}
state.usedDuplicates = new Array(length);
}
function inspectNode(object, objects, duplicatesIndexes) {
var objectKeyList,
index,
length;
if (null !== object && 'object' === typeof object) {
index = objects.indexOf(object);
if (-1 !== index) {
if (-1 === duplicatesIndexes.indexOf(index)) {
duplicatesIndexes.push(index);
}
} else {
objects.push(object);
if (Array.isArray(object)) {
for (index = 0, length = object.length; index < length; index += 1) {
inspectNode(object[index], objects, duplicatesIndexes);
}
} else {
objectKeyList = Object.keys(object);
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
}
}
}
}
}
function dump(input, options) {
options = options || {};
var state = new State(options);
if (!state.noRefs) {
getDuplicateReferences(input, state);
}
if (writeNode(state, 0, input, true, true)) {
return state.dump + '\n';
}
return '';
}
function safeDump(input, options) {
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
}
module.exports.dump = dump;
module.exports.safeDump = safeDump;
},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(require,module,exports){
// YAML error class. http://stackoverflow.com/questions/8458984
//
'use strict';
var inherits = require('inherit');
function YAMLException(reason, mark) {
// Super constructor
Error.call(this);
// Include stack trace in error object
if (Error.captureStackTrace) {
// Chrome and NodeJS
Error.captureStackTrace(this, this.constructor);
} else {
// FF, IE 10+ and Safari 6+. Fallback for others
this.stack = (new Error()).stack || '';
}
this.name = 'YAMLException';
this.reason = reason;
this.mark = mark;
this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
}
// Inherit from Error
inherits(YAMLException, Error);
YAMLException.prototype.toString = function toString(compact) {
var result = this.name + ': ';
result += this.reason || '(unknown reason)';
if (!compact && this.mark) {
result += ' ' + this.mark.toString();
}
return result;
};
module.exports = YAMLException;
},{"inherit":31}],5:[function(require,module,exports){
'use strict';
/*eslint-disable max-len,no-use-before-define*/
var common = require('./common');
var YAMLException = require('./exception');
var Mark = require('./mark');
var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
var _hasOwnProperty = Object.prototype.hasOwnProperty;
var CONTEXT_FLOW_IN = 1;
var CONTEXT_FLOW_OUT = 2;
var CONTEXT_BLOCK_IN = 3;
var CONTEXT_BLOCK_OUT = 4;
var CHOMPING_CLIP = 1;
var CHOMPING_STRIP = 2;
var CHOMPING_KEEP = 3;
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
function is_EOL(c) {
return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
}
function is_WHITE_SPACE(c) {
return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
}
function is_WS_OR_EOL(c) {
return (c === 0x09/* Tab */) ||
(c === 0x20/* Space */) ||
(c === 0x0A/* LF */) ||
(c === 0x0D/* CR */);
}
function is_FLOW_INDICATOR(c) {
return 0x2C/* , */ === c ||
0x5B/* [ */ === c ||
0x5D/* ] */ === c ||
0x7B/* { */ === c ||
0x7D/* } */ === c;
}
function fromHexCode(c) {
var lc;
if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
return c - 0x30;
}
/*eslint-disable no-bitwise*/
lc = c | 0x20;
if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
return lc - 0x61 + 10;
}
return -1;
}
function escapedHexLen(c) {
if (c === 0x78/* x */) { return 2; }
if (c === 0x75/* u */) { return 4; }
if (c === 0x55/* U */) { return 8; }
return 0;
}
function fromDecimalCode(c) {
if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
return c - 0x30;
}
return -1;
}
function simpleEscapeSequence(c) {
return (c === 0x30/* 0 */) ? '\x00' :
(c === 0x61/* a */) ? '\x07' :
(c === 0x62/* b */) ? '\x08' :
(c === 0x74/* t */) ? '\x09' :
(c === 0x09/* Tab */) ? '\x09' :
(c === 0x6E/* n */) ? '\x0A' :
(c === 0x76/* v */) ? '\x0B' :
(c === 0x66/* f */) ? '\x0C' :
(c === 0x72/* r */) ? '\x0D' :
(c === 0x65/* e */) ? '\x1B' :
(c === 0x20/* Space */) ? ' ' :
(c === 0x22/* " */) ? '\x22' :
(c === 0x2F/* / */) ? '/' :
(c === 0x5C/* \ */) ? '\x5C' :
(c === 0x4E/* N */) ? '\x85' :
(c === 0x5F/* _ */) ? '\xA0' :
(c === 0x4C/* L */) ? '\u2028' :
(c === 0x50/* P */) ? '\u2029' : '';
}
function charFromCodepoint(c) {
if (c <= 0xFFFF) {
return String.fromCharCode(c);
}
// Encode UTF-16 surrogate pair
// https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800,
((c - 0x010000) & 0x03FF) + 0xDC00);
}
var simpleEscapeCheck = new Array(256); // integer, for fast access
var simpleEscapeMap = new Array(256);
for (var i = 0; i < 256; i++) {
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
simpleEscapeMap[i] = simpleEscapeSequence(i);
}
function State(input, options) {
this.input = input;
this.filename = options['filename'] || null;
this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
this.onWarning = options['onWarning'] || null;
this.legacy = options['legacy'] || false;
this.json = options['json'] || false;
this.implicitTypes = this.schema.compiledImplicit;
this.typeMap = this.schema.compiledTypeMap;
this.length = input.length;
this.position = 0;
this.line = 0;
this.lineStart = 0;
this.lineIndent = 0;
this.documents = [];
/*
this.version;
this.checkLineBreaks;
this.tagMap;
this.anchorMap;
this.tag;
this.anchor;
this.kind;
this.result;*/
}
function generateError(state, message) {
return new YAMLException(
message,
new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
}
function throwError(state, message) {
throw generateError(state, message);
}
function throwWarning(state, message) {
if (state.onWarning) {
state.onWarning.call(null, generateError(state, message));
}
}
var directiveHandlers = {
YAML: function handleYamlDirective(state, name, args) {
var match, major, minor;
if (null !== state.version) {
throwError(state, 'duplication of %YAML directive');
}
if (1 !== args.length) {
throwError(state, 'YAML directive accepts exactly one argument');
}
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
if (null === match) {
throwError(state, 'ill-formed argument of the YAML directive');
}
major = parseInt(match[1], 10);
minor = parseInt(match[2], 10);
if (1 !== major) {
throwError(state, 'unacceptable YAML version of the document');
}
state.version = args[0];
state.checkLineBreaks = (minor < 2);
if (1 !== minor && 2 !== minor) {
throwWarning(state, 'unsupported YAML version of the document');
}
},
TAG: function handleTagDirective(state, name, args) {
var handle, prefix;
if (2 !== args.length) {
throwError(state, 'TAG directive accepts exactly two arguments');
}
handle = args[0];
prefix = args[1];
if (!PATTERN_TAG_HANDLE.test(handle)) {
throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
}
if (_hasOwnProperty.call(state.tagMap, handle)) {
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
}
if (!PATTERN_TAG_URI.test(prefix)) {
throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
}
state.tagMap[handle] = prefix;
}
};
function captureSegment(state, start, end, checkJson) {
var _position, _length, _character, _result;
if (start < end) {
_result = state.input.slice(start, end);
if (checkJson) {
for (_position = 0, _length = _result.length;
_position < _length;
_position += 1) {
_character = _result.charCodeAt(_position);
if (!(0x09 === _character ||
0x20 <= _character && _character <= 0x10FFFF)) {
throwError(state, 'expected valid JSON character');
}
}
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
throwError(state, 'the stream contains non-printable characters');
}
state.result += _result;
}
}
function mergeMappings(state, destination, source, overridableKeys) {
var sourceKeys, key, index, quantity;
if (!common.isObject(source)) {
throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
}
sourceKeys = Object.keys(source);
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
key = sourceKeys[index];
if (!_hasOwnProperty.call(destination, key)) {
destination[key] = source[key];
overridableKeys[key] = true;
}
}
}
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode) {
var index, quantity;
keyNode = String(keyNode);
if (null === _result) {
_result = {};
}
if ('tag:yaml.org,2002:merge' === keyTag) {
if (Array.isArray(valueNode)) {
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
mergeMappings(state, _result, valueNode[index], overridableKeys);
}
} else {
mergeMappings(state, _result, valueNode, overridableKeys);
}
} else {
if (!state.json &&
!_hasOwnProperty.call(overridableKeys, keyNode) &&
_hasOwnProperty.call(_result, keyNode)) {
throwError(state, 'duplicated mapping key');
}
_result[keyNode] = valueNode;
delete overridableKeys[keyNode];
}
return _result;
}
function readLineBreak(state) {
var ch;
ch = state.input.charCodeAt(state.position);
if (0x0A/* LF */ === ch) {
state.position++;
} else if (0x0D/* CR */ === ch) {
state.position++;
if (0x0A/* LF */ === state.input.charCodeAt(state.position)) {
state.position++;
}
} else {
throwError(state, 'a line break is expected');
}
state.line += 1;
state.lineStart = state.position;
}
function skipSeparationSpace(state, allowComments, checkIndent) {
var lineBreaks = 0,
ch = state.input.charCodeAt(state.position);
while (0 !== ch) {
while (is_WHITE_SPACE(ch)) {
ch = state.input.charCodeAt(++state.position);
}
if (allowComments && 0x23/* # */ === ch) {
do {
ch = state.input.charCodeAt(++state.position);
} while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && 0 !== ch);
}
if (is_EOL(ch)) {
readLineBreak(state);
ch = state.input.charCodeAt(state.position);
lineBreaks++;
state.lineIndent = 0;
while (0x20/* Space */ === ch) {
state.lineIndent++;
ch = state.input.charCodeAt(++state.position);
}
} else {
break;
}
}
if (-1 !== checkIndent && 0 !== lineBreaks && state.lineIndent < checkIndent) {
throwWarning(state, 'deficient indentation');
}
return lineBreaks;
}
function testDocumentSeparator(state) {
var _position = state.position,
ch;
ch = state.input.charCodeAt(_position);
// Condition state.position === state.lineStart is tested
// in parent on each call, for efficiency. No needs to test here again.
if ((0x2D/* - */ === ch || 0x2E/* . */ === ch) &&
state.input.charCodeAt(_position + 1) === ch &&
state.input.charCodeAt(_position + 2) === ch) {
_position += 3;
ch = state.input.charCodeAt(_position);
if (ch === 0 || is_WS_OR_EOL(ch)) {
return true;
}
}
return false;
}
function writeFoldedLines(state, count) {
if (1 === count) {
state.result += ' ';
} else if (count > 1) {
state.result += common.repeat('\n', count - 1);
}
}
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
var preceding,
following,
captureStart,
captureEnd,
hasPendingContent,
_line,
_lineStart,
_lineIndent,
_kind = state.kind,
_result = state.result,
ch;
ch = state.input.charCodeAt(state.position);
if (is_WS_OR_EOL(ch) ||
is_FLOW_INDICATOR(ch) ||
0x23/* # */ === ch ||
0x26/* & */ === ch ||
0x2A/* * */ === ch ||
0x21/* ! */ === ch ||
0x7C/* | */ === ch ||
0x3E/* > */ === ch ||
0x27/* ' */ === ch ||
0x22/* " */ === ch ||
0x25/* % */ === ch ||
0x40/* @ */ === ch ||
0x60/* ` */ === ch) {
return false;
}
if (0x3F/* ? */ === ch || 0x2D/* - */ === ch) {
following = state.input.charCodeAt(state.position + 1);
if (is_WS_OR_EOL(following) ||
withinFlowCollection && is_FLOW_INDICATOR(following)) {
return false;
}
}
state.kind = 'scalar';
state.result = '';
captureStart = captureEnd = state.position;
hasPendingContent = false;
while (0 !== ch) {
if (0x3A/* : */ === ch) {
following = state.input.charCodeAt(state.position + 1);
if (is_WS_OR_EOL(following) ||
withinFlowCollection && is_FLOW_INDICATOR(following)) {
break;
}
} else if (0x23/* # */ === ch) {
preceding = state.input.charCodeAt(state.position - 1);
if (is_WS_OR_EOL(preceding)) {
break;
}
} else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
withinFlowCollection && is_FLOW_INDICATOR(ch)) {
break;
} else if (is_EOL(ch)) {
_line = state.line;
_lineStart = state.lineStart;
_lineIndent = state.lineIndent;
skipSeparationSpace(state, false, -1);
if (state.lineIndent >= nodeIndent) {
hasPendingContent = true;
ch = state.input.charCodeAt(state.position);
continue;
} else {
state.position = captureEnd;
state.line = _line;
state.lineStart = _lineStart;
state.lineIndent = _lineIndent;
break;
}
}
if (hasPendingContent) {
captureSegment(state, captureStart, captureEnd, false);
writeFoldedLines(state, state.line - _line);
captureStart = captureEnd = state.position;
hasPendingContent = false;
}
if (!is_WHITE_SPACE(ch)) {
captureEnd = state.position + 1;
}
ch = state.input.charCodeAt(++state.position);
}
captureSegment(state, captureStart, captureEnd, false);
if (state.result) {
return true;
}
state.kind = _kind;
state.result = _result;
return false;
}
function readSingleQuotedScalar(state, nodeIndent) {
var ch,
captureStart, captureEnd;
ch = state.input.charCodeAt(state.position);
if (0x27/* ' */ !== ch) {
return false;
}
state.kind = 'scalar';
state.result = '';
state.position++;
captureStart = captureEnd = state.position;
while (0 !== (ch = state.input.charCodeAt(state.position))) {
if (0x27/* ' */ === ch) {
captureSegment(state, captureStart, state.position, true);
ch = state.input.charCodeAt(++state.position);
if (0x27/* ' */ === ch) {
captureStart = captureEnd = state.position;
state.position++;
} else {
return true;
}
} else if (is_EOL(ch)) {
captureSegment(state, captureStart, captureEnd, true);
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
captureStart = captureEnd = state.position;
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
throwError(state, 'unexpected end of the document within a single quoted scalar');
} else {
state.position++;
captureEnd = state.position;
}
}
throwError(state, 'unexpected end of the stream within a single quoted scalar');
}
function readDoubleQuotedScalar(state, nodeIndent) {
var captureStart,
captureEnd,
hexLength,
hexResult,
tmp,
ch;
ch = state.input.charCodeAt(state.position);
if (0x22/* " */ !== ch) {
return false;
}
state.kind = 'scalar';
state.result = '';
state.position++;
captureStart = captureEnd = state.position;
while (0 !== (ch = state.input.charCodeAt(state.position))) {
if (0x22/* " */ === ch) {
captureSegment(state, captureStart, state.position, true);
state.position++;
return true;
} else if (0x5C/* \ */ === ch) {
captureSegment(state, captureStart, state.position, true);
ch = state.input.charCodeAt(++state.position);
if (is_EOL(ch)) {
skipSeparationSpace(state, false, nodeIndent);
// TODO: rework to inline fn with no type cast?
} else if (ch < 256 && simpleEscapeCheck[ch]) {
state.result += simpleEscapeMap[ch];
state.position++;
} else if ((tmp = escapedHexLen(ch)) > 0) {
hexLength = tmp;
hexResult = 0;
for (; hexLength > 0; hexLength--) {
ch = state.input.charCodeAt(++state.position);
if ((tmp = fromHexCode(ch)) >= 0) {
hexResult = (hexResult << 4) + tmp;
} else {
throwError(state, 'expected hexadecimal character');
}
}
state.result += charFromCodepoint(hexResult);
state.position++;
} else {
throwError(state, 'unknown escape sequence');
}
captureStart = captureEnd = state.position;
} else if (is_EOL(ch)) {
captureSegment(state, captureStart, captureEnd, true);
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
captureStart = captureEnd = state.position;
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
throwError(state, 'unexpected end of the document within a double quoted scalar');
} else {
state.position++;
captureEnd = state.position;
}
}
throwError(state, 'unexpected end of the stream within a double quoted scalar');
}
function readFlowCollection(state, nodeIndent) {
var readNext = true,
_line,
_tag = state.tag,
_result,
_anchor = state.anchor,
following,
terminator,
isPair,
isExplicitPair,
isMapping,
overridableKeys = {},
keyNode,
keyTag,
valueNode,
ch;
ch = state.input.charCodeAt(state.position);
if (ch === 0x5B/* [ */) {
terminator = 0x5D;/* ] */
isMapping = false;
_result = [];
} else if (ch === 0x7B/* { */) {
terminator = 0x7D;/* } */
isMapping = true;
_result = {};
} else {
return false;
}
if (null !== state.anchor) {
state.anchorMap[state.anchor] = _result;
}
ch = state.input.charCodeAt(++state.position);
while (0 !== ch) {
skipSeparationSpace(state, true, nodeIndent);
ch = state.input.charCodeAt(state.position);
if (ch === terminator) {
state.position++;
state.tag = _tag;
state.anchor = _anchor;
state.kind = isMapping ? 'mapping' : 'sequence';
state.result = _result;
return true;
} else if (!readNext) {
throwError(state, 'missed comma between flow collection entries');
}
keyTag = keyNode = valueNode = null;
isPair = isExplicitPair = false;
if (0x3F/* ? */ === ch) {
following = state.input.charCodeAt(state.position + 1);
if (is_WS_OR_EOL(following)) {
isPair = isExplicitPair = true;
state.position++;
skipSeparationSpace(state, true, nodeIndent);
}
}
_line = state.line;
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
keyTag = state.tag;
keyNode = state.result;
skipSeparationSpace(state, true, nodeIndent);
ch = state.input.charCodeAt(state.position);
if ((isExplicitPair || state.line === _line) && 0x3A/* : */ === ch) {
isPair = true;
ch = state.input.charCodeAt(++state.position);
skipSeparationSpace(state, true, nodeIndent);
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
valueNode = state.result;
}
if (isMapping) {
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
} else if (isPair) {
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
} else {
_result.push(keyNode);
}
skipSeparationSpace(state, true, nodeIndent);
ch = state.input.charCodeAt(state.position);
if (0x2C/* , */ === ch) {
readNext = true;
ch = state.input.charCodeAt(++state.position);
} else {
readNext = false;
}
}
throwError(state, 'unexpected end of the stream within a flow collection');
}
function readBlockScalar(state, nodeIndent) {
var captureStart,
folding,
chomping = CHOMPING_CLIP,
detectedIndent = false,
textIndent = nodeIndent,
emptyLines = 0,
atMoreIndented = false,
tmp,
ch;
ch = state.input.charCodeAt(state.position);
if (ch === 0x7C/* | */) {
folding = false;
} else if (ch === 0x3E/* > */) {
folding = true;
} else {
return false;
}
state.kind = 'scalar';
state.result = '';
while (0 !== ch) {
ch = state.input.charCodeAt(++state.position);
if (0x2B/* + */ === ch || 0x2D/* - */ === ch) {
if (CHOMPING_CLIP === chomping) {
chomping = (0x2B/* + */ === ch) ? CHOMPING_KEEP : CHOMPING_STRIP;
} else {
throwError(state, 'repeat of a chomping mode identifier');
}
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
if (tmp === 0) {
throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
} else if (!detectedIndent) {
textIndent = nodeIndent + tmp - 1;
detectedIndent = true;
} else {
throwError(state, 'repeat of an indentation width identifier');
}
} else {
break;
}
}
if (is_WHITE_SPACE(ch)) {
do { ch = state.input.charCodeAt(++state.position); }
while (is_WHITE_SPACE(ch));
if (0x23/* # */ === ch) {
do { ch = state.input.charCodeAt(++state.position); }
while (!is_EOL(ch) && (0 !== ch));
}
}
while (0 !== ch) {
readLineBreak(state);
state.lineIndent = 0;
ch = state.input.charCodeAt(state.position);
while ((!detectedIndent || state.lineIndent < textIndent) &&
(0x20/* Space */ === ch)) {
state.lineIndent++;
ch = state.input.charCodeAt(++state.position);
}
if (!detectedIndent && state.lineIndent > textIndent) {
textIndent = state.lineIndent;
}
if (is_EOL(ch)) {
emptyLines++;
continue;
}
// End of the scalar.
if (state.lineIndent < textIndent) {
// Perform the chomping.
if (chomping === CHOMPING_KEEP) {
state.result += common.repeat('\n', emptyLines);
} else if (chomping === CHOMPING_CLIP) {
if (detectedIndent) { // i.e. only if the scalar is not empty.
state.result += '\n';
}
}
// Break this `while` cycle and go to the funciton's epilogue.
break;
}
// Folded style: use fancy rules to handle line breaks.
if (folding) {
// Lines starting with white space characters (more-indented lines) are not folded.
if (is_WHITE_SPACE(ch)) {
atMoreIndented = true;
state.result += common.repeat('\n', emptyLines + 1);
// End of more-indented block.
} else if (atMoreIndented) {
atMoreIndented = false;
state.result += common.repeat('\n', emptyLines + 1);
// Just one line break - perceive as the same line.
} else if (0 === emptyLines) {
if (detectedIndent) { // i.e. only if we have already read some scalar content.
state.result += ' ';
}
// Several line breaks - perceive as different lines.
} else {
state.result += common.repeat('\n', emptyLines);
}
// Literal style: just add exact number of line breaks between content lines.
} else if (detectedIndent) {
// If current line isn't the first one - count line break from the last content line.
state.result += common.repeat('\n', emptyLines + 1);
} else {
// In case of the first content line - count only empty lines.
state.result += common.repeat('\n', emptyLines);
}
detectedIndent = true;
emptyLines = 0;
captureStart = state.position;
while (!is_EOL(ch) && (0 !== ch)) {
ch = state.input.charCodeAt(++state.position);
}
captureSegment(state, captureStart, state.position, false);
}
return true;
}
function readBlockSequence(state, nodeIndent) {
var _line,
_tag = state.tag,
_anchor = state.anchor,
_result = [],
following,
detected = false,
ch;
if (null !== state.anchor) {
state.anchorMap[state.anchor] = _result;
}
ch = state.input.charCodeAt(state.position);
while (0 !== ch) {
if (0x2D/* - */ !== ch) {
break;
}
following = state.input.charCodeAt(state.position + 1);
if (!is_WS_OR_EOL(following)) {
break;
}
detected = true;
state.position++;
if (skipSeparationSpace(state, true, -1)) {
if (state.lineIndent <= nodeIndent) {
_result.push(null);
ch = state.input.charCodeAt(state.position);
continue;
}
}
_line = state.line;
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
_result.push(state.result);
skipSeparationSpace(state, true, -1);
ch = state.input.charCodeAt(state.position);
if ((state.line === _line || state.lineIndent > nodeIndent) && (0 !== ch)) {
throwError(state, 'bad indentation of a sequence entry');
} else if (state.lineIndent < nodeIndent) {
break;
}
}
if (detected) {
state.tag = _tag;
state.anchor = _anchor;
state.kind = 'sequence';
state.result = _result;
return true;
}
return false;
}
function readBlockMapping(state, nodeIndent, flowIndent) {
var following,
allowCompact,
_line,
_tag = state.tag,
_anchor = state.anchor,
_result = {},
overridableKeys = {},
keyTag = null,
keyNode = null,
valueNode = null,
atExplicitKey = false,
detected = false,
ch;
if (null !== state.anchor) {
state.anchorMap[state.anchor] = _result;
}
ch = state.input.charCodeAt(state.position);
while (0 !== ch) {
following = state.input.charCodeAt(state.position + 1);
_line = state.line; // Save the current line.
//
// Explicit notation case. There are two separate blocks:
// first for the key (denoted by "?") and second for the value (denoted by ":")
//
if ((0x3F/* ? */ === ch || 0x3A/* : */ === ch) && is_WS_OR_EOL(following)) {
if (0x3F/* ? */ === ch) {
if (atExplicitKey) {
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
keyTag = keyNode = valueNode = null;
}
detected = true;
atExplicitKey = true;
allowCompact = true;
} else if (atExplicitKey) {
// i.e. 0x3A/* : */ === character after the explicit key.
atExplicitKey = false;
allowCompact = true;
} else {
throwError(state, 'incomplete explicit mapping pair; a key node is missed');
}
state.position += 1;
ch = following;
//
// Implicit notation case. Flow-style node as the key first, then ":", and the value.
//
} else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
if (state.line === _line) {
ch = state.input.charCodeAt(state.position);
while (is_WHITE_SPACE(ch)) {
ch = state.input.charCodeAt(++state.position);
}
if (0x3A/* : */ === ch) {
ch = state.input.charCodeAt(++state.position);
if (!is_WS_OR_EOL(ch)) {
throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
}
if (atExplicitKey) {
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
keyTag = keyNode = valueNode = null;
}
detected = true;
atExplicitKey = false;
allowCompact = false;
keyTag = state.tag;
keyNode = state.result;
} else if (detected) {
throwError(state, 'can not read an implicit mapping pair; a colon is missed');
} else {
state.tag = _tag;
state.anchor = _anchor;
return true; // Keep the result of `composeNode`.
}
} else if (detected) {
throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
} else {
state.tag = _tag;
state.anchor = _anchor;
return true; // Keep the result of `composeNode`.
}
} else {
break; // Reading is done. Go to the epilogue.
}
//
// Common reading code for both explicit and implicit notations.
//
if (state.line === _line || state.lineIndent > nodeIndent) {
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
if (atExplicitKey) {
keyNode = state.result;
} else {
valueNode = state.result;
}
}
if (!atExplicitKey) {
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
keyTag = keyNode = valueNode = null;
}
skipSeparationSpace(state, true, -1);
ch = state.input.charCodeAt(state.position);
}
if (state.lineIndent > nodeIndent && (0 !== ch)) {
throwError(state, 'bad indentation of a mapping entry');
} else if (state.lineIndent < nodeIndent) {
break;
}
}
//
// Epilogue.
//
// Special case: last mapping's node contains only the key in explicit notation.
if (atExplicitKey) {
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
}
// Expose the resulting mapping.
if (detected) {
state.tag = _tag;
state.anchor = _anchor;
state.kind = 'mapping';
state.result = _result;
}
return detected;
}
function readTagProperty(state) {
var _position,
isVerbatim = false,
isNamed = false,
tagHandle,
tagName,
ch;
ch = state.input.charCodeAt(state.position);
if (0x21/* ! */ !== ch) {
return false;
}
if (null !== state.tag) {
throwError(state, 'duplication of a tag property');
}
ch = state.input.charCodeAt(++state.position);
if (0x3C/* < */ === ch) {
isVerbatim = true;
ch = state.input.charCodeAt(++state.position);
} else if (0x21/* ! */ === ch) {
isNamed = true;
tagHandle = '!!';
ch = state.input.charCodeAt(++state.position);
} else {
tagHandle = '!';
}
_position = state.position;
if (isVerbatim) {
do { ch = state.input.charCodeAt(++state.position); }
while (0 !== ch && 0x3E/* > */ !== ch);
if (state.position < state.length) {
tagName = state.input.slice(_position, state.position);
ch = state.input.charCodeAt(++state.position);
} else {
throwError(state, 'unexpected end of the stream within a verbatim tag');
}
} else {
while (0 !== ch && !is_WS_OR_EOL(ch)) {
if (0x21/* ! */ === ch) {
if (!isNamed) {
tagHandle = state.input.slice(_position - 1, state.position + 1);
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
throwError(state, 'named tag handle cannot contain such characters');
}
isNamed = true;
_position = state.position + 1;
} else {
throwError(state, 'tag suffix cannot contain exclamation marks');
}
}
ch = state.input.charCodeAt(++state.position);
}
tagName = state.input.slice(_position, state.position);
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
throwError(state, 'tag suffix cannot contain flow indicator characters');
}
}
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
throwError(state, 'tag name cannot contain such characters: ' + tagName);
}
if (isVerbatim) {
state.tag = tagName;
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
state.tag = state.tagMap[tagHandle] + tagName;
} else if ('!' === tagHandle) {
state.tag = '!' + tagName;
} else if ('!!' === tagHandle) {
state.tag = 'tag:yaml.org,2002:' + tagName;
} else {
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
}
return true;
}
function readAnchorProperty(state) {
var _position,
ch;
ch = state.input.charCodeAt(state.position);
if (0x26/* & */ !== ch) {
return false;
}
if (null !== state.anchor) {
throwError(state, 'duplication of an anchor property');
}
ch = state.input.charCodeAt(++state.position);
_position = state.position;
while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
ch = state.input.charCodeAt(++state.position);
}
if (state.position === _position) {
throwError(state, 'name of an anchor node must contain at least one character');
}
state.anchor = state.input.slice(_position, state.position);
return true;
}
function readAlias(state) {
var _position, alias,
ch;
ch = state.input.charCodeAt(state.position);
if (0x2A/* * */ !== ch) {
return false;
}
ch = state.input.charCodeAt(++state.position);
_position = state.position;
while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
ch = state.input.charCodeAt(++state.position);
}
if (state.position === _position) {
throwError(state, 'name of an alias node must contain at least one character');
}
alias = state.input.slice(_position, state.position);
if (!state.anchorMap.hasOwnProperty(alias)) {
throwError(state, 'unidentified alias "' + alias + '"');
}
state.result = state.anchorMap[alias];
skipSeparationSpace(state, true, -1);
return true;
}
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
var allowBlockStyles,
allowBlockScalars,
allowBlockCollections,
indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
atNewLine = false,
hasContent = false,
typeIndex,
typeQuantity,
type,
flowIndent,
blockIndent;
state.tag = null;
state.anchor = null;
state.kind = null;
state.result = null;
allowBlockStyles = allowBlockScalars = allowBlockCollections =
CONTEXT_BLOCK_OUT === nodeContext ||
CONTEXT_BLOCK_IN === nodeContext;
if (allowToSeek) {
if (skipSeparationSpace(state, true, -1)) {
atNewLine = true;
if (state.lineIndent > parentIndent) {
indentStatus = 1;
} else if (state.lineIndent === parentIndent) {
indentStatus = 0;
} else if (state.lineIndent < parentIndent) {
indentStatus = -1;
}
}
}
if (1 === indentStatus) {
while (readTagProperty(state) || readAnchorProperty(state)) {
if (skipSeparationSpace(state, true, -1)) {
atNewLine = true;
allowBlockCollections = allowBlockStyles;
if (state.lineIndent > parentIndent) {
indentStatus = 1;
} else if (state.lineIndent === parentIndent) {
indentStatus = 0;
} else if (state.lineIndent < parentIndent) {
indentStatus = -1;
}
} else {
allowBlockCollections = false;
}
}
}
if (allowBlockCollections) {
allowBlockCollections = atNewLine || allowCompact;
}
if (1 === indentStatus || CONTEXT_BLOCK_OUT === nodeContext) {
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
flowIndent = parentIndent;
} else {
flowIndent = parentIndent + 1;
}
blockIndent = state.position - state.lineStart;
if (1 === indentStatus) {
if (allowBlockCollections &&
(readBlockSequence(state, blockIndent) ||
readBlockMapping(state, blockIndent, flowIndent)) ||
readFlowCollection(state, flowIndent)) {
hasContent = true;
} else {
if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
readSingleQuotedScalar(state, flowIndent) ||
readDoubleQuotedScalar(state, flowIndent)) {
hasContent = true;
} else if (readAlias(state)) {
hasContent = true;
if (null !== state.tag || null !== state.anchor) {
throwError(state, 'alias node should not have any properties');
}
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
hasContent = true;
if (null === state.tag) {
state.tag = '?';
}
}
if (null !== state.anchor) {
state.anchorMap[state.anchor] = state.result;
}
}
} else if (0 === indentStatus) {
// Special case: block sequences are allowed to have same indentation level as the parent.
// http://www.yaml.org/spec/1.2/spec.html#id2799784
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
}
}
if (null !== state.tag && '!' !== state.tag) {
if ('?' === state.tag) {
for (typeIndex = 0, typeQuantity = state.implicitTypes.length;
typeIndex < typeQuantity;
typeIndex += 1) {
type = state.implicitTypes[typeIndex];
// Implicit resolving is not allowed for non-scalar types, and '?'
// non-specific tag is only assigned to plain scalars. So, it isn't
// needed to check for 'kind' conformity.
if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
state.result = type.construct(state.result);
state.tag = type.tag;
if (null !== state.anchor) {
state.anchorMap[state.anchor] = state.result;
}
break;
}
}
} else if (_hasOwnProperty.call(state.typeMap, state.tag)) {
type = state.typeMap[state.tag];
if (null !== state.result && type.kind !== state.kind) {
throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
}
if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
} else {
state.result = type.construct(state.result);
if (null !== state.anchor) {
state.anchorMap[state.anchor] = state.result;
}
}
} else {
throwError(state, 'unknown tag !<' + state.tag + '>');
}
}
return null !== state.tag || null !== state.anchor || hasContent;
}
function readDocument(state) {
var documentStart = state.position,
_position,
directiveName,
directiveArgs,
hasDirectives = false,
ch;
state.version = null;
state.checkLineBreaks = state.legacy;
state.tagMap = {};
state.anchorMap = {};
while (0 !== (ch = state.input.charCodeAt(state.position))) {
skipSeparationSpace(state, true, -1);
ch = state.input.charCodeAt(state.position);
if (state.lineIndent > 0 || 0x25/* % */ !== ch) {
break;
}
hasDirectives = true;
ch = state.input.charCodeAt(++state.position);
_position = state.position;
while (0 !== ch && !is_WS_OR_EOL(ch)) {
ch = state.input.charCodeAt(++state.position);
}
directiveName = state.input.slice(_position, state.position);
directiveArgs = [];
if (directiveName.length < 1) {
throwError(state, 'directive name must not be less than one character in length');
}
while (0 !== ch) {
while (is_WHITE_SPACE(ch)) {
ch = state.input.charCodeAt(++state.position);
}
if (0x23/* # */ === ch) {
do { ch = state.input.charCodeAt(++state.position); }
while (0 !== ch && !is_EOL(ch));
break;
}
if (is_EOL(ch)) {
break;
}
_position = state.position;
while (0 !== ch && !is_WS_OR_EOL(ch)) {
ch = state.input.charCodeAt(++state.position);
}
directiveArgs.push(state.input.slice(_position, state.position));
}
if (0 !== ch) {
readLineBreak(state);
}
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
directiveHandlers[directiveName](state, directiveName, directiveArgs);
} else {
throwWarning(state, 'unknown document directive "' + directiveName + '"');
}
}
skipSeparationSpace(state, true, -1);
if (0 === state.lineIndent &&
0x2D/* - */ === state.input.charCodeAt(state.position) &&
0x2D/* - */ === state.input.charCodeAt(state.position + 1) &&
0x2D/* - */ === state.input.charCodeAt(state.position + 2)) {
state.position += 3;
skipSeparationSpace(state, true, -1);
} else if (hasDirectives) {
throwError(state, 'directives end mark is expected');
}
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
skipSeparationSpace(state, true, -1);
if (state.checkLineBreaks &&
PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
throwWarning(state, 'non-ASCII line breaks are interpreted as content');
}
state.documents.push(state.result);
if (state.position === state.lineStart && testDocumentSeparator(state)) {
if (0x2E/* . */ === state.input.charCodeAt(state.position)) {
state.position += 3;
skipSeparationSpace(state, true, -1);
}
return;
}
if (state.position < (state.length - 1)) {
throwError(state, 'end of the stream or a document separator is expected');
} else {
return;
}
}
function loadDocuments(input, options) {
input = String(input);
options = options || {};
if (input.length !== 0) {
// Add tailing `\n` if not exists
if (0x0A/* LF */ !== input.charCodeAt(input.length - 1) &&
0x0D/* CR */ !== input.charCodeAt(input.length - 1)) {
input += '\n';
}
// Strip BOM
if (input.charCodeAt(0) === 0xFEFF) {
input = input.slice(1);
}
}
var state = new State(input, options);
// Use 0 as string terminator. That significantly simplifies bounds check.
state.input += '\0';
while (0x20/* Space */ === state.input.charCodeAt(state.position)) {
state.lineIndent += 1;
state.position += 1;
}
while (state.position < (state.length - 1)) {
readDocument(state);
}
return state.documents;
}
function loadAll(input, iterator, options) {
var documents = loadDocuments(input, options), index, length;
for (index = 0, length = documents.length; index < length; index += 1) {
iterator(documents[index]);
}
}
function load(input, options) {
var documents = loadDocuments(input, options);
if (0 === documents.length) {
/*eslint-disable no-undefined*/
return undefined;
} else if (1 === documents.length) {
return documents[0];
}
throw new YAMLException('expected a single document in the stream, but found more');
}
function safeLoadAll(input, output, options) {
loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
}
function safeLoad(input, options) {
return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
}
module.exports.loadAll = loadAll;
module.exports.load = load;
module.exports.safeLoadAll = safeLoadAll;
module.exports.safeLoad = safeLoad;
},{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(require,module,exports){
'use strict';
var common = require('./common');
function Mark(name, buffer, position, line, column) {
this.name = name;
this.buffer = buffer;
this.position = position;
this.line = line;
this.column = column;
}
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
var head, start, tail, end, snippet;
if (!this.buffer) {
return null;
}
indent = indent || 4;
maxLength = maxLength || 75;
head = '';
start = this.position;
while (start > 0 && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1))) {
start -= 1;
if (this.position - start > (maxLength / 2 - 1)) {
head = ' ... ';
start += 5;
break;
}
}
tail = '';
end = this.position;
while (end < this.buffer.length && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end))) {
end += 1;
if (end - this.position > (maxLength / 2 - 1)) {
tail = ' ... ';
end -= 5;
break;
}
}
snippet = this.buffer.slice(start, end);
return common.repeat(' ', indent) + head + snippet + tail + '\n' +
common.repeat(' ', indent + this.position - start + head.length) + '^';
};
Mark.prototype.toString = function toString(compact) {
var snippet, where = '';
if (this.name) {
where += 'in "' + this.name + '" ';
}
where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
if (!compact) {
snippet = this.getSnippet();
if (snippet) {
where += ':\n' + snippet;
}
}
return where;
};
module.exports = Mark;
},{"./common":2}],7:[function(require,module,exports){
'use strict';
/*eslint-disable max-len*/
var common = require('./common');
var YAMLException = require('./exception');
var Type = require('./type');
function compileList(schema, name, result) {
var exclude = [];
schema.include.forEach(function (includedSchema) {
result = compileList(includedSchema, name, result);
});
schema[name].forEach(function (currentType) {
result.forEach(function (previousType, previousIndex) {
if (previousType.tag === currentType.tag) {
exclude.push(previousIndex);
}
});
result.push(currentType);
});
return result.filter(function (type, index) {
return -1 === exclude.indexOf(index);
});
}
function compileMap(/* lists... */) {
var result = {}, index, length;
function collectType(type) {
result[type.tag] = type;
}
for (index = 0, length = arguments.length; index < length; index += 1) {
arguments[index].forEach(collectType);
}
return result;
}
function Schema(definition) {
this.include = definition.include || [];
this.implicit = definition.implicit || [];
this.explicit = definition.explicit || [];
this.implicit.forEach(function (type) {
if (type.loadKind && 'scalar' !== type.loadKind) {
throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
}
});
this.compiledImplicit = compileList(this, 'implicit', []);
this.compiledExplicit = compileList(this, 'explicit', []);
this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
}
Schema.DEFAULT = null;
Schema.create = function createSchema() {
var schemas, types;
switch (arguments.length) {
case 1:
schemas = Schema.DEFAULT;
types = arguments[0];
break;
case 2:
schemas = arguments[0];
types = arguments[1];
break;
default:
throw new YAMLException('Wrong number of arguments for Schema.create function');
}
schemas = common.toArray(schemas);
types = common.toArray(types);
if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
}
if (!types.every(function (type) { return type instanceof Type; })) {
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
}
return new Schema({
include: schemas,
explicit: types
});
};
module.exports = Schema;
},{"./common":2,"./exception":4,"./type":13}],8:[function(require,module,exports){
// Standard YAML's Core schema.
// http://www.yaml.org/spec/1.2/spec.html#id2804923
//
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
// So, Core schema has no distinctions from JSON schema is JS-YAML.
'use strict';
var Schema = require('../schema');
module.exports = new Schema({
include: [
require('./json')
]
});
},{"../schema":7,"./json":12}],9:[function(require,module,exports){
// JS-YAML's default schema for `load` function.
// It is not described in the YAML specification.
//
// This schema is based on JS-YAML's default safe schema and includes
// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
//
// Also this schema is used as default base schema at `Schema.create` function.
'use strict';
var Schema = require('../schema');
module.exports = Schema.DEFAULT = new Schema({
include: [
require('./default_safe')
],
explicit: [
require('../type/js/undefined'),
require('../type/js/regexp'),
require('../type/js/function')
]
});
},{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(require,module,exports){
// JS-YAML's default schema for `safeLoad` function.
// It is not described in the YAML specification.
//
// This schema is based on standard YAML's Core schema and includes most of
// extra types described at YAML tag repository. (http://yaml.org/type/)
'use strict';
var Schema = require('../schema');
module.exports = new Schema({
include: [
require('./core')
],
implicit: [
require('../type/timestamp'),
require('../type/merge')
],
explicit: [
require('../type/binary'),
require('../type/omap'),
require('../type/pairs'),
require('../type/set')
]
});
},{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(require,module,exports){
// Standard YAML's Failsafe schema.
// http://www.yaml.org/spec/1.2/spec.html#id2802346
'use strict';
var Schema = require('../schema');
module.exports = new Schema({
explicit: [
require('../type/str'),
require('../type/seq'),
require('../type/map')
]
});
},{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(require,module,exports){
// Standard YAML's JSON schema.
// http://www.yaml.org/spec/1.2/spec.html#id2803231
//
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
// So, this schema is not such strict as defined in the YAML specification.
// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
'use strict';
var Schema = require('../schema');
module.exports = new Schema({
include: [
require('./failsafe')
],
implicit: [
require('../type/null'),
require('../type/bool'),
require('../type/int'),
require('../type/float')
]
});
},{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(require,module,exports){
'use strict';
var YAMLException = require('./exception');
var TYPE_CONSTRUCTOR_OPTIONS = [
'kind',
'resolve',
'construct',
'instanceOf',
'predicate',
'represent',
'defaultStyle',
'styleAliases'
];
var YAML_NODE_KINDS = [
'scalar',
'sequence',
'mapping'
];
function compileStyleAliases(map) {
var result = {};
if (null !== map) {
Object.keys(map).forEach(function (style) {
map[style].forEach(function (alias) {
result[String(alias)] = style;
});
});
}
return result;
}
function Type(tag, options) {
options = options || {};
Object.keys(options).forEach(function (name) {
if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) {
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
}
});
// TODO: Add tag format check.
this.tag = tag;
this.kind = options['kind'] || null;
this.resolve = options['resolve'] || function () { return true; };
this.construct = options['construct'] || function (data) { return data; };
this.instanceOf = options['instanceOf'] || null;
this.predicate = options['predicate'] || null;
this.represent = options['represent'] || null;
this.defaultStyle = options['defaultStyle'] || null;
this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) {
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
}
}
module.exports = Type;
},{"./exception":4}],14:[function(require,module,exports){
'use strict';
/*eslint-disable no-bitwise*/
// A trick for browserified version.
// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined
var NodeBuffer = require('buffer').Buffer;
var Type = require('../type');
// [ 64, 65, 66 ] -> [ padding, CR, LF ]
var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
function resolveYamlBinary(data) {
if (null === data) {
return false;
}
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
// Convert one by one.
for (idx = 0; idx < max; idx++) {
code = map.indexOf(data.charAt(idx));
// Skip CR/LF
if (code > 64) { continue; }
// Fail on illegal characters
if (code < 0) { return false; }
bitlen += 6;
}
// If there are any bits left, source was corrupted
return (bitlen % 8) === 0;
}
function constructYamlBinary(data) {
var idx, tailbits,
input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
max = input.length,
map = BASE64_MAP,
bits = 0,
result = [];
// Collect by 6*4 bits (3 bytes)
for (idx = 0; idx < max; idx++) {
if ((idx % 4 === 0) && idx) {
result.push((bits >> 16) & 0xFF);
result.push((bits >> 8) & 0xFF);
result.push(bits & 0xFF);
}
bits = (bits << 6) | map.indexOf(input.charAt(idx));
}
// Dump tail
tailbits = (max % 4) * 6;
if (tailbits === 0) {
result.push((bits >> 16) & 0xFF);
result.push((bits >> 8) & 0xFF);
result.push(bits & 0xFF);
} else if (tailbits === 18) {
result.push((bits >> 10) & 0xFF);
result.push((bits >> 2) & 0xFF);
} else if (tailbits === 12) {
result.push((bits >> 4) & 0xFF);
}
// Wrap into Buffer for NodeJS and leave Array for browser
if (NodeBuffer) {
return new NodeBuffer(result);
}
return result;
}
function representYamlBinary(object /*, style*/) {
var result = '', bits = 0, idx, tail,
max = object.length,
map = BASE64_MAP;
// Convert every three bytes to 4 ASCII characters.
for (idx = 0; idx < max; idx++) {
if ((idx % 3 === 0) && idx) {
result += map[(bits >> 18) & 0x3F];
result += map[(bits >> 12) & 0x3F];
result += map[(bits >> 6) & 0x3F];
result += map[bits & 0x3F];
}
bits = (bits << 8) + object[idx];
}
// Dump tail
tail = max % 3;
if (tail === 0) {
result += map[(bits >> 18) & 0x3F];
result += map[(bits >> 12) & 0x3F];
result += map[(bits >> 6) & 0x3F];
result += map[bits & 0x3F];
} else if (tail === 2) {
result += map[(bits >> 10) & 0x3F];
result += map[(bits >> 4) & 0x3F];
result += map[(bits << 2) & 0x3F];
result += map[64];
} else if (tail === 1) {
result += map[(bits >> 2) & 0x3F];
result += map[(bits << 4) & 0x3F];
result += map[64];
result += map[64];
}
return result;
}
function isBinary(object) {
return NodeBuffer && NodeBuffer.isBuffer(object);
}
module.exports = new Type('tag:yaml.org,2002:binary', {
kind: 'scalar',
resolve: resolveYamlBinary,
construct: constructYamlBinary,
predicate: isBinary,
represent: representYamlBinary
});
},{"../type":13,"buffer":30}],15:[function(require,module,exports){
'use strict';
var Type = require('../type');
function resolveYamlBoolean(data) {
if (null === data) {
return false;
}
var max = data.length;
return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
(max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
}
function constructYamlBoolean(data) {
return data === 'true' ||
data === 'True' ||
data === 'TRUE';
}
function isBoolean(object) {
return '[object Boolean]' === Object.prototype.toString.call(object);
}
module.exports = new Type('tag:yaml.org,2002:bool', {
kind: 'scalar',
resolve: resolveYamlBoolean,
construct: constructYamlBoolean,
predicate: isBoolean,
represent: {
lowercase: function (object) { return object ? 'true' : 'false'; },
uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
camelcase: function (object) { return object ? 'True' : 'False'; }
},
defaultStyle: 'lowercase'
});
},{"../type":13}],16:[function(require,module,exports){
'use strict';
var common = require('../common');
var Type = require('../type');
var YAML_FLOAT_PATTERN = new RegExp(
'^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' +
'|\\.[0-9_]+(?:[eE][-+][0-9]+)?' +
'|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
'|[-+]?\\.(?:inf|Inf|INF)' +
'|\\.(?:nan|NaN|NAN))$');
function resolveYamlFloat(data) {
if (null === data) {
return false;
}
if (!YAML_FLOAT_PATTERN.test(data)) {
return false;
}
return true;
}
function constructYamlFloat(data) {
var value, sign, base, digits;
value = data.replace(/_/g, '').toLowerCase();
sign = '-' === value[0] ? -1 : 1;
digits = [];
if (0 <= '+-'.indexOf(value[0])) {
value = value.slice(1);
}
if ('.inf' === value) {
return (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
} else if ('.nan' === value) {
return NaN;
} else if (0 <= value.indexOf(':')) {
value.split(':').forEach(function (v) {
digits.unshift(parseFloat(v, 10));
});
value = 0.0;
base = 1;
digits.forEach(function (d) {
value += d * base;
base *= 60;
});
return sign * value;
}
return sign * parseFloat(value, 10);
}
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
function representYamlFloat(object, style) {
var res;
if (isNaN(object)) {
switch (style) {
case 'lowercase':
return '.nan';
case 'uppercase':
return '.NAN';
case 'camelcase':
return '.NaN';
}
} else if (Number.POSITIVE_INFINITY === object) {
switch (style) {
case 'lowercase':
return '.inf';
case 'uppercase':
return '.INF';
case 'camelcase':
return '.Inf';
}
} else if (Number.NEGATIVE_INFINITY === object) {
switch (style) {
case 'lowercase':
return '-.inf';
case 'uppercase':
return '-.INF';
case 'camelcase':
return '-.Inf';
}
} else if (common.isNegativeZero(object)) {
return '-0.0';
}
res = object.toString(10);
// JS stringifier can build scientific format without dots: 5e-100,
// while YAML requres dot: 5.e-100. Fix it with simple hack
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
}
function isFloat(object) {
return ('[object Number]' === Object.prototype.toString.call(object)) &&
(0 !== object % 1 || common.isNegativeZero(object));
}
module.exports = new Type('tag:yaml.org,2002:float', {
kind: 'scalar',
resolve: resolveYamlFloat,
construct: constructYamlFloat,
predicate: isFloat,
represent: representYamlFloat,
defaultStyle: 'lowercase'
});
},{"../common":2,"../type":13}],17:[function(require,module,exports){
'use strict';
var common = require('../common');
var Type = require('../type');
function isHexCode(c) {
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
((0x61/* a */ <= c) && (c <= 0x66/* f */));
}
function isOctCode(c) {
return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
}
function isDecCode(c) {
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
}
function resolveYamlInteger(data) {
if (null === data) {
return false;
}
var max = data.length,
index = 0,
hasDigits = false,
ch;
if (!max) { return false; }
ch = data[index];
// sign
if (ch === '-' || ch === '+') {
ch = data[++index];
}
if (ch === '0') {
// 0
if (index + 1 === max) { return true; }
ch = data[++index];
// base 2, base 8, base 16
if (ch === 'b') {
// base 2
index++;
for (; index < max; index++) {
ch = data[index];
if (ch === '_') { continue; }
if (ch !== '0' && ch !== '1') {
return false;
}
hasDigits = true;
}
return hasDigits;
}
if (ch === 'x') {
// base 16
index++;
for (; index < max; index++) {
ch = data[index];
if (ch === '_') { continue; }
if (!isHexCode(data.charCodeAt(index))) {
return false;
}
hasDigits = true;
}
return hasDigits;
}
// base 8
for (; index < max; index++) {
ch = data[index];
if (ch === '_') { continue; }
if (!isOctCode(data.charCodeAt(index))) {
return false;
}
hasDigits = true;
}
return hasDigits;
}
// base 10 (except 0) or base 60
for (; index < max; index++) {
ch = data[index];
if (ch === '_') { continue; }
if (ch === ':') { break; }
if (!isDecCode(data.charCodeAt(index))) {
return false;
}
hasDigits = true;
}
if (!hasDigits) { return false; }
// if !base60 - done;
if (ch !== ':') { return true; }
// base60 almost not used, no needs to optimize
return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
}
function constructYamlInteger(data) {
var value = data, sign = 1, ch, base, digits = [];
if (value.indexOf('_') !== -1) {
value = value.replace(/_/g, '');
}
ch = value[0];
if (ch === '-' || ch === '+') {
if (ch === '-') { sign = -1; }
value = value.slice(1);
ch = value[0];
}
if ('0' === value) {
return 0;
}
if (ch === '0') {
if (value[1] === 'b') {
return sign * parseInt(value.slice(2), 2);
}
if (value[1] === 'x') {
return sign * parseInt(value, 16);
}
return sign * parseInt(value, 8);
}
if (value.indexOf(':') !== -1) {
value.split(':').forEach(function (v) {
digits.unshift(parseInt(v, 10));
});
value = 0;
base = 1;
digits.forEach(function (d) {
value += (d * base);
base *= 60;
});
return sign * value;
}
return sign * parseInt(value, 10);
}
function isInteger(object) {
return ('[object Number]' === Object.prototype.toString.call(object)) &&
(0 === object % 1 && !common.isNegativeZero(object));
}
module.exports = new Type('tag:yaml.org,2002:int', {
kind: 'scalar',
resolve: resolveYamlInteger,
construct: constructYamlInteger,
predicate: isInteger,
represent: {
binary: function (object) { return '0b' + object.toString(2); },
octal: function (object) { return '0' + object.toString(8); },
decimal: function (object) { return object.toString(10); },
hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }
},
defaultStyle: 'decimal',
styleAliases: {
binary: [ 2, 'bin' ],
octal: [ 8, 'oct' ],
decimal: [ 10, 'dec' ],
hexadecimal: [ 16, 'hex' ]
}
});
},{"../common":2,"../type":13}],18:[function(require,module,exports){
'use strict';
var esprima;
// Browserified version does not have esprima
//
// 1. For node.js just require module as deps
// 2. For browser try to require mudule via external AMD system.
// If not found - try to fallback to window.esprima. If not
// found too - then fail to parse.
//
try {
esprima = require('esprima');
} catch (_) {
/*global window */
if (typeof window !== 'undefined') { esprima = window.esprima; }
}
var Type = require('../../type');
function resolveJavascriptFunction(data) {
if (null === data) {
return false;
}
try {
var source = '(' + data + ')',
ast = esprima.parse(source, { range: true });
if ('Program' !== ast.type ||
1 !== ast.body.length ||
'ExpressionStatement' !== ast.body[0].type ||
'FunctionExpression' !== ast.body[0].expression.type) {
return false;
}
return true;
} catch (err) {
return false;
}
}
function constructJavascriptFunction(data) {
/*jslint evil:true*/
var source = '(' + data + ')',
ast = esprima.parse(source, { range: true }),
params = [],
body;
if ('Program' !== ast.type ||
1 !== ast.body.length ||
'ExpressionStatement' !== ast.body[0].type ||
'FunctionExpression' !== ast.body[0].expression.type) {
throw new Error('Failed to resolve function');
}
ast.body[0].expression.params.forEach(function (param) {
params.push(param.name);
});
body = ast.body[0].expression.body.range;
// Esprima's ranges include the first '{' and the last '}' characters on
// function expressions. So cut them out.
/*eslint-disable no-new-func*/
return new Function(params, source.slice(body[0] + 1, body[1] - 1));
}
function representJavascriptFunction(object /*, style*/) {
return object.toString();
}
function isFunction(object) {
return '[object Function]' === Object.prototype.toString.call(object);
}
module.exports = new Type('tag:yaml.org,2002:js/function', {
kind: 'scalar',
resolve: resolveJavascriptFunction,
construct: constructJavascriptFunction,
predicate: isFunction,
represent: representJavascriptFunction
});
},{"../../type":13,"esprima":30}],19:[function(require,module,exports){
'use strict';
var Type = require('../../type');
function resolveJavascriptRegExp(data) {
if (null === data) {
return false;
}
if (0 === data.length) {
return false;
}
var regexp = data,
tail = /\/([gim]*)$/.exec(data),
modifiers = '';
// if regexp starts with '/' it can have modifiers and must be properly closed
// `/foo/gim` - modifiers tail can be maximum 3 chars
if ('/' === regexp[0]) {
if (tail) {
modifiers = tail[1];
}
if (modifiers.length > 3) { return false; }
// if expression starts with /, is should be properly terminated
if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; }
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
}
try {
return true;
} catch (error) {
return false;
}
}
function constructJavascriptRegExp(data) {
var regexp = data,
tail = /\/([gim]*)$/.exec(data),
modifiers = '';
// `/foo/gim` - tail can be maximum 4 chars
if ('/' === regexp[0]) {
if (tail) {
modifiers = tail[1];
}
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
}
return new RegExp(regexp, modifiers);
}
function representJavascriptRegExp(object /*, style*/) {
var result = '/' + object.source + '/';
if (object.global) {
result += 'g';
}
if (object.multiline) {
result += 'm';
}
if (object.ignoreCase) {
result += 'i';
}
return result;
}
function isRegExp(object) {
return '[object RegExp]' === Object.prototype.toString.call(object);
}
module.exports = new Type('tag:yaml.org,2002:js/regexp', {
kind: 'scalar',
resolve: resolveJavascriptRegExp,
construct: constructJavascriptRegExp,
predicate: isRegExp,
represent: representJavascriptRegExp
});
},{"../../type":13}],20:[function(require,module,exports){
'use strict';
var Type = require('../../type');
function resolveJavascriptUndefined() {
return true;
}
function constructJavascriptUndefined() {
/*eslint-disable no-undefined*/
return undefined;
}
function representJavascriptUndefined() {
return '';
}
function isUndefined(object) {
return 'undefined' === typeof object;
}
module.exports = new Type('tag:yaml.org,2002:js/undefined', {
kind: 'scalar',
resolve: resolveJavascriptUndefined,
construct: constructJavascriptUndefined,
predicate: isUndefined,
represent: representJavascriptUndefined
});
},{"../../type":13}],21:[function(require,module,exports){
'use strict';
var Type = require('../type');
module.exports = new Type('tag:yaml.org,2002:map', {
kind: 'mapping',
construct: function (data) { return null !== data ? data : {}; }
});
},{"../type":13}],22:[function(require,module,exports){
'use strict';
var Type = require('../type');
function resolveYamlMerge(data) {
return '<<' === data || null === data;
}
module.exports = new Type('tag:yaml.org,2002:merge', {
kind: 'scalar',
resolve: resolveYamlMerge
});
},{"../type":13}],23:[function(require,module,exports){
'use strict';
var Type = require('../type');
function resolveYamlNull(data) {
if (null === data) {
return true;
}
var max = data.length;
return (max === 1 && data === '~') ||
(max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
}
function constructYamlNull() {
return null;
}
function isNull(object) {
return null === object;
}
module.exports = new Type('tag:yaml.org,2002:null', {
kind: 'scalar',
resolve: resolveYamlNull,
construct: constructYamlNull,
predicate: isNull,
represent: {
canonical: function () { return '~'; },
lowercase: function () { return 'null'; },
uppercase: function () { return 'NULL'; },
camelcase: function () { return 'Null'; }
},
defaultStyle: 'lowercase'
});
},{"../type":13}],24:[function(require,module,exports){
'use strict';
var Type = require('../type');
var _hasOwnProperty = Object.prototype.hasOwnProperty;
var _toString = Object.prototype.toString;
function resolveYamlOmap(data) {
if (null === data) {
return true;
}
var objectKeys = [], index, length, pair, pairKey, pairHasKey,
object = data;
for (index = 0, length = object.length; index < length; index += 1) {
pair = object[index];
pairHasKey = false;
if ('[object Object]' !== _toString.call(pair)) {
return false;
}
for (pairKey in pair) {
if (_hasOwnProperty.call(pair, pairKey)) {
if (!pairHasKey) {
pairHasKey = true;
} else {
return false;
}
}
}
if (!pairHasKey) {
return false;
}
if (-1 === objectKeys.indexOf(pairKey)) {
objectKeys.push(pairKey);
} else {
return false;
}
}
return true;
}
function constructYamlOmap(data) {
return null !== data ? data : [];
}
module.exports = new Type('tag:yaml.org,2002:omap', {
kind: 'sequence',
resolve: resolveYamlOmap,
construct: constructYamlOmap
});
},{"../type":13}],25:[function(require,module,exports){
'use strict';
var Type = require('../type');
var _toString = Object.prototype.toString;
function resolveYamlPairs(data) {
if (null === data) {
return true;
}
var index, length, pair, keys, result,
object = data;
result = new Array(object.length);
for (index = 0, length = object.length; index < length; index += 1) {
pair = object[index];
if ('[object Object]' !== _toString.call(pair)) {
return false;
}
keys = Object.keys(pair);
if (1 !== keys.length) {
return false;
}
result[index] = [ keys[0], pair[keys[0]] ];
}
return true;
}
function constructYamlPairs(data) {
if (null === data) {
return [];
}
var index, length, pair, keys, result,
object = data;
result = new Array(object.length);
for (index = 0, length = object.length; index < length; index += 1) {
pair = object[index];
keys = Object.keys(pair);
result[index] = [ keys[0], pair[keys[0]] ];
}
return result;
}
module.exports = new Type('tag:yaml.org,2002:pairs', {
kind: 'sequence',
resolve: resolveYamlPairs,
construct: constructYamlPairs
});
},{"../type":13}],26:[function(require,module,exports){
'use strict';
var Type = require('../type');
module.exports = new Type('tag:yaml.org,2002:seq', {
kind: 'sequence',
construct: function (data) { return null !== data ? data : []; }
});
},{"../type":13}],27:[function(require,module,exports){
'use strict';
var Type = require('../type');
var _hasOwnProperty = Object.prototype.hasOwnProperty;
function resolveYamlSet(data) {
if (null === data) {
return true;
}
var key, object = data;
for (key in object) {
if (_hasOwnProperty.call(object, key)) {
if (null !== object[key]) {
return false;
}
}
}
return true;
}
function constructYamlSet(data) {
return null !== data ? data : {};
}
module.exports = new Type('tag:yaml.org,2002:set', {
kind: 'mapping',
resolve: resolveYamlSet,
construct: constructYamlSet
});
},{"../type":13}],28:[function(require,module,exports){
'use strict';
var Type = require('../type');
module.exports = new Type('tag:yaml.org,2002:str', {
kind: 'scalar',
construct: function (data) { return null !== data ? data : ''; }
});
},{"../type":13}],29:[function(require,module,exports){
'use strict';
var Type = require('../type');
var YAML_TIMESTAMP_REGEXP = new RegExp(
'^([0-9][0-9][0-9][0-9])' + // [1] year
'-([0-9][0-9]?)' + // [2] month
'-([0-9][0-9]?)' + // [3] day
'(?:(?:[Tt]|[ \\t]+)' + // ...
'([0-9][0-9]?)' + // [4] hour
':([0-9][0-9])' + // [5] minute
':([0-9][0-9])' + // [6] second
'(?:\\.([0-9]*))?' + // [7] fraction
'(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
'(?::([0-9][0-9]))?))?)?$'); // [11] tz_minute
function resolveYamlTimestamp(data) {
if (null === data) {
return false;
}
if (YAML_TIMESTAMP_REGEXP.exec(data) === null) {
return false;
}
return true;
}
function constructYamlTimestamp(data) {
var match, year, month, day, hour, minute, second, fraction = 0,
delta = null, tz_hour, tz_minute, date;
match = YAML_TIMESTAMP_REGEXP.exec(data);
if (null === match) {
throw new Error('Date resolve error');
}
// match: [1] year [2] month [3] day
year = +(match[1]);
month = +(match[2]) - 1; // JS month starts with 0
day = +(match[3]);
if (!match[4]) { // no hour
return new Date(Date.UTC(year, month, day));
}
// match: [4] hour [5] minute [6] second [7] fraction
hour = +(match[4]);
minute = +(match[5]);
second = +(match[6]);
if (match[7]) {
fraction = match[7].slice(0, 3);
while (fraction.length < 3) { // milli-seconds
fraction += '0';
}
fraction = +fraction;
}
// match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
if (match[9]) {
tz_hour = +(match[10]);
tz_minute = +(match[11] || 0);
delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
if ('-' === match[9]) {
delta = -delta;
}
}
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
if (delta) {
date.setTime(date.getTime() - delta);
}
return date;
}
function representYamlTimestamp(object /*, style*/) {
return object.toISOString();
}
module.exports = new Type('tag:yaml.org,2002:timestamp', {
kind: 'scalar',
resolve: resolveYamlTimestamp,
construct: constructYamlTimestamp,
instanceOf: Date,
represent: representYamlTimestamp
});
},{"../type":13}],30:[function(require,module,exports){
},{}],31:[function(require,module,exports){
/*!
* node-inherit
* Copyright(c) 2011 Dmitry Filatov <dfilatov@yandex-team.ru>
* MIT Licensed
*/
module.exports = require('./lib/inherit');
},{"./lib/inherit":32}],32:[function(require,module,exports){
/**
* @module inherit
* @version 2.2.2
* @author Filatov Dmitry <dfilatov@yandex-team.ru>
* @description This module provides some syntax sugar for "class" declarations, constructors, mixins, "super" calls and static members.
*/
(function(global) {
var hasIntrospection = (function(){'_';}).toString().indexOf('_') > -1,
emptyBase = function() {},
hasOwnProperty = Object.prototype.hasOwnProperty,
objCreate = Object.create || function(ptp) {
var inheritance = function() {};
inheritance.prototype = ptp;
return new inheritance();
},
objKeys = Object.keys || function(obj) {
var res = [];
for(var i in obj) {
hasOwnProperty.call(obj, i) && res.push(i);
}
return res;
},
extend = function(o1, o2) {
for(var i in o2) {
hasOwnProperty.call(o2, i) && (o1[i] = o2[i]);
}
return o1;
},
toStr = Object.prototype.toString,
isArray = Array.isArray || function(obj) {
return toStr.call(obj) === '[object Array]';
},
isFunction = function(obj) {
return toStr.call(obj) === '[object Function]';
},
noOp = function() {},
needCheckProps = true,
testPropObj = { toString : '' };
for(var i in testPropObj) { // fucking ie hasn't toString, valueOf in for
testPropObj.hasOwnProperty(i) && (needCheckProps = false);
}
var specProps = needCheckProps? ['toString', 'valueOf'] : null;
function getPropList(obj) {
var res = objKeys(obj);
if(needCheckProps) {
var specProp, i = 0;
while(specProp = specProps[i++]) {
obj.hasOwnProperty(specProp) && res.push(specProp);
}
}
return res;
}
function override(base, res, add) {
var addList = getPropList(add),
j = 0, len = addList.length,
name, prop;
while(j < len) {
if((name = addList[j++]) === '__self') {
continue;
}
prop = add[name];
if(isFunction(prop) &&
(!hasIntrospection || prop.toString().indexOf('.__base') > -1)) {
res[name] = (function(name, prop) {
var baseMethod = base[name]?
base[name] :
name === '__constructor'? // case of inheritance from plane function
res.__self.__parent :
noOp;
return function() {
var baseSaved = this.__base;
this.__base = baseMethod;
var res = prop.apply(this, arguments);
this.__base = baseSaved;
return res;
};
})(name, prop);
} else {
res[name] = prop;
}
}
}
function applyMixins(mixins, res) {
var i = 1, mixin;
while(mixin = mixins[i++]) {
res?
isFunction(mixin)?
inherit.self(res, mixin.prototype, mixin) :
inherit.self(res, mixin) :
res = isFunction(mixin)?
inherit(mixins[0], mixin.prototype, mixin) :
inherit(mixins[0], mixin);
}
return res || mixins[0];
}
/**
* Creates class
* @exports
* @param {Function|Array} [baseClass|baseClassAndMixins] class (or class and mixins) to inherit from
* @param {Object} prototypeFields
* @param {Object} [staticFields]
* @returns {Function} class
*/
function inherit() {
var args = arguments,
withMixins = isArray(args[0]),
hasBase = withMixins || isFunction(args[0]),
base = hasBase? withMixins? applyMixins(args[0]) : args[0] : emptyBase,
props = args[hasBase? 1 : 0] || {},
staticProps = args[hasBase? 2 : 1],
res = props.__constructor || (hasBase && base.prototype.__constructor)?
function() {
return this.__constructor.apply(this, arguments);
} :
hasBase?
function() {
return base.apply(this, arguments);
} :
function() {};
if(!hasBase) {
res.prototype = props;
res.prototype.__self = res.prototype.constructor = res;
return extend(res, staticProps);
}
extend(res, base);
res.__parent = base;
var basePtp = base.prototype,
resPtp = res.prototype = objCreate(basePtp);
resPtp.__self = resPtp.constructor = res;
props && override(basePtp, resPtp, props);
staticProps && override(base, res, staticProps);
return res;
}
inherit.self = function() {
var args = arguments,
withMixins = isArray(args[0]),
base = withMixins? applyMixins(args[0], args[0][0]) : args[0],
props = args[1],
staticProps = args[2],
basePtp = base.prototype;
props && override(basePtp, basePtp, props);
staticProps && override(base, base, staticProps);
return base;
};
var defineAsGlobal = true;
if(typeof exports === 'object') {
module.exports = inherit;
defineAsGlobal = false;
}
if(typeof modules === 'object') {
modules.define('inherit', function(provide) {
provide(inherit);
});
defineAsGlobal = false;
}
if(typeof define === 'function') {
define(function(require, exports, module) {
module.exports = inherit;
});
defineAsGlobal = false;
}
defineAsGlobal && (global.inherit = inherit);
})(this);
},{}],"/":[function(require,module,exports){
'use strict';
var yaml = require('./lib/js-yaml.js');
module.exports = yaml;
},{"./lib/js-yaml.js":1}]},{},[])("/")
}); | tonytomov/cdnjs | ajax/libs/js-yaml/3.5.0/js-yaml.js | JavaScript | mit | 108,801 |
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*global exports:true*/
var Syntax = require('esprima-fb').Syntax;
var utils = require('../src/utils');
var reserverdWordsHelper = require('./reserved-words-helper');
/**
* Code adapted from https://github.com/spicyj/es3ify
* The MIT License (MIT)
* Copyright (c) 2014 Ben Alpert
*/
function visitProperty(traverse, node, path, state) {
utils.catchup(node.key.range[0], state);
utils.append('"', state);
utils.catchup(node.key.range[1], state);
utils.append('"', state);
utils.catchup(node.value.range[0], state);
traverse(node.value, path, state);
return false;
}
visitProperty.test = function(node) {
return node.type === Syntax.Property &&
node.key.type === Syntax.Identifier &&
!node.method &&
!node.shorthand &&
!node.computed &&
reserverdWordsHelper.isReservedWord(node.key.name);
};
function visitMemberExpression(traverse, node, path, state) {
traverse(node.object, path, state);
utils.catchup(node.property.range[0] - 1, state);
utils.append('[', state);
utils.catchupWhiteSpace(node.property.range[0], state);
utils.append('"', state);
utils.catchup(node.property.range[1], state);
utils.append('"]', state);
return false;
}
visitMemberExpression.test = function(node) {
return node.type === Syntax.MemberExpression &&
node.property.type === Syntax.Identifier &&
reserverdWordsHelper.isReservedWord(node.property.name);
};
exports.visitorList = [
visitProperty,
visitMemberExpression
];
| cgiganti/chartmaster | node_modules/react-tools/node_modules/jstransform/visitors/reserved-words-visitors.js | JavaScript | mit | 2,072 |
/**
* ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v3.3.3
* @link http://www.ag-grid.com/
* @license MIT
*/
var csvCreator_1 = require("./csvCreator");
var constants_1 = require("./constants");
var GridApi = (function () {
function GridApi(grid, rowRenderer, headerRenderer, filterManager, columnController, inMemoryRowController, selectionController, gridOptionsWrapper, gridPanel, valueService, masterSlaveService, eventService, floatingRowModel) {
this.grid = grid;
this.rowRenderer = rowRenderer;
this.headerRenderer = headerRenderer;
this.filterManager = filterManager;
this.columnController = columnController;
this.inMemoryRowController = inMemoryRowController;
this.selectionController = selectionController;
this.gridOptionsWrapper = gridOptionsWrapper;
this.gridPanel = gridPanel;
this.valueService = valueService;
this.masterSlaveService = masterSlaveService;
this.eventService = eventService;
this.floatingRowModel = floatingRowModel;
this.csvCreator = new csvCreator_1.default(this.inMemoryRowController, this.columnController, this.grid, this.valueService);
}
/** Used internally by grid. Not intended to be used by the client. Interface may change between releases. */
GridApi.prototype.__getMasterSlaveService = function () {
return this.masterSlaveService;
};
GridApi.prototype.getDataAsCsv = function (params) {
return this.csvCreator.getDataAsCsv(params);
};
GridApi.prototype.exportDataAsCsv = function (params) {
this.csvCreator.exportDataAsCsv(params);
};
GridApi.prototype.setDatasource = function (datasource) {
this.grid.setDatasource(datasource);
};
GridApi.prototype.onNewDatasource = function () {
console.log('ag-Grid: onNewDatasource deprecated, please use setDatasource()');
this.grid.setDatasource();
};
GridApi.prototype.setRowData = function (rowData) {
this.grid.setRowData(rowData);
};
GridApi.prototype.setRows = function (rows) {
console.log('ag-Grid: setRows deprecated, please use setRowData()');
this.grid.setRowData(rows);
};
GridApi.prototype.onNewRows = function () {
console.log('ag-Grid: onNewRows deprecated, please use setRowData()');
this.grid.setRowData();
};
GridApi.prototype.setFloatingTopRowData = function (rows) {
this.floatingRowModel.setFloatingTopRowData(rows);
this.gridPanel.onBodyHeightChange();
this.refreshView();
};
GridApi.prototype.setFloatingBottomRowData = function (rows) {
this.floatingRowModel.setFloatingBottomRowData(rows);
this.gridPanel.onBodyHeightChange();
this.refreshView();
};
GridApi.prototype.onNewCols = function () {
console.error("ag-Grid: deprecated, please call setColumnDefs instead providing a list of the defs");
this.grid.setColumnDefs();
};
GridApi.prototype.setColumnDefs = function (colDefs) {
this.grid.setColumnDefs(colDefs);
};
GridApi.prototype.unselectAll = function () {
console.error("unselectAll deprecated, call deselectAll instead");
this.deselectAll();
};
GridApi.prototype.refreshRows = function (rowNodes) {
this.rowRenderer.refreshRows(rowNodes);
};
GridApi.prototype.refreshCells = function (rowNodes, colIds) {
this.rowRenderer.refreshCells(rowNodes, colIds);
};
GridApi.prototype.rowDataChanged = function (rows) {
this.rowRenderer.rowDataChanged(rows);
};
GridApi.prototype.refreshView = function () {
this.rowRenderer.refreshView();
};
GridApi.prototype.softRefreshView = function () {
this.rowRenderer.softRefreshView();
};
GridApi.prototype.refreshGroupRows = function () {
this.rowRenderer.refreshGroupRows();
};
GridApi.prototype.refreshHeader = function () {
// need to review this - the refreshHeader should also refresh all icons in the header
this.headerRenderer.refreshHeader();
this.headerRenderer.updateFilterIcons();
};
GridApi.prototype.isAnyFilterPresent = function () {
return this.filterManager.isAnyFilterPresent();
};
GridApi.prototype.isAdvancedFilterPresent = function () {
return this.filterManager.isAdvancedFilterPresent();
};
GridApi.prototype.isQuickFilterPresent = function () {
return this.filterManager.isQuickFilterPresent();
};
GridApi.prototype.getModel = function () {
return this.grid.getRowModel();
};
GridApi.prototype.onGroupExpandedOrCollapsed = function (refreshFromIndex) {
this.grid.updateModelAndRefresh(constants_1.default.STEP_MAP, refreshFromIndex);
};
GridApi.prototype.expandAll = function () {
this.inMemoryRowController.expandOrCollapseAll(true, null);
this.grid.updateModelAndRefresh(constants_1.default.STEP_MAP);
};
GridApi.prototype.collapseAll = function () {
this.inMemoryRowController.expandOrCollapseAll(false, null);
this.grid.updateModelAndRefresh(constants_1.default.STEP_MAP);
};
GridApi.prototype.addVirtualRowListener = function (eventName, rowIndex, callback) {
if (typeof eventName !== 'string') {
console.log('ag-Grid: addVirtualRowListener has changed, the first parameter should be the event name, pleae check the documentation.');
}
this.grid.addVirtualRowListener(eventName, rowIndex, callback);
};
GridApi.prototype.setQuickFilter = function (newFilter) {
this.grid.onQuickFilterChanged(newFilter);
};
GridApi.prototype.selectIndex = function (index, tryMulti, suppressEvents) {
this.selectionController.selectIndex(index, tryMulti, suppressEvents);
};
GridApi.prototype.deselectIndex = function (index, suppressEvents) {
if (suppressEvents === void 0) { suppressEvents = false; }
this.selectionController.deselectIndex(index, suppressEvents);
};
GridApi.prototype.selectNode = function (node, tryMulti, suppressEvents) {
if (tryMulti === void 0) { tryMulti = false; }
if (suppressEvents === void 0) { suppressEvents = false; }
this.selectionController.selectNode(node, tryMulti, suppressEvents);
};
GridApi.prototype.deselectNode = function (node, suppressEvents) {
if (suppressEvents === void 0) { suppressEvents = false; }
this.selectionController.deselectNode(node, suppressEvents);
};
GridApi.prototype.selectAll = function () {
this.selectionController.selectAll();
this.rowRenderer.refreshView();
};
GridApi.prototype.deselectAll = function () {
this.selectionController.deselectAll();
this.rowRenderer.refreshView();
};
GridApi.prototype.recomputeAggregates = function () {
this.inMemoryRowController.doAggregate();
this.rowRenderer.refreshGroupRows();
};
GridApi.prototype.sizeColumnsToFit = function () {
if (this.gridOptionsWrapper.isForPrint()) {
console.warn('ag-grid: sizeColumnsToFit does not work when forPrint=true');
return;
}
this.gridPanel.sizeColumnsToFit();
};
GridApi.prototype.showLoadingOverlay = function () {
this.grid.showLoadingOverlay();
};
GridApi.prototype.showNoRowsOverlay = function () {
this.grid.showNoRowsOverlay();
};
GridApi.prototype.hideOverlay = function () {
this.grid.hideOverlay();
};
GridApi.prototype.showLoading = function (show) {
console.warn('ag-Grid: showLoading is deprecated, please use api.showLoadingOverlay() and api.hideOverlay() instead');
if (show) {
this.grid.showLoadingOverlay();
}
else {
this.grid.hideOverlay();
}
};
GridApi.prototype.isNodeSelected = function (node) {
return this.selectionController.isNodeSelected(node);
};
GridApi.prototype.getSelectedNodesById = function () {
return this.selectionController.getSelectedNodesById();
};
GridApi.prototype.getSelectedNodes = function () {
return this.selectionController.getSelectedNodes();
};
GridApi.prototype.getSelectedRows = function () {
return this.selectionController.getSelectedRows();
};
GridApi.prototype.getBestCostNodeSelection = function () {
return this.selectionController.getBestCostNodeSelection();
};
GridApi.prototype.getRenderedNodes = function () {
return this.rowRenderer.getRenderedNodes();
};
GridApi.prototype.ensureColIndexVisible = function (index) {
console.warn('ag-Grid: ensureColIndexVisible(index) no longer supported, use ensureColumnVisible(colKey) instead.');
};
GridApi.prototype.ensureColumnVisible = function (key) {
this.gridPanel.ensureColumnVisible(key);
};
GridApi.prototype.ensureIndexVisible = function (index) {
this.gridPanel.ensureIndexVisible(index);
};
GridApi.prototype.ensureNodeVisible = function (comparator) {
this.grid.ensureNodeVisible(comparator);
};
GridApi.prototype.forEachInMemory = function (callback) {
console.warn('ag-Grid: please use forEachNode instead of forEachInMemory, method is same, I just renamed it, forEachInMemory is deprecated');
this.forEachNode(callback);
};
GridApi.prototype.forEachNode = function (callback) {
this.grid.getRowModel().forEachNode(callback);
};
GridApi.prototype.forEachNodeAfterFilter = function (callback) {
this.grid.getRowModel().forEachNodeAfterFilter(callback);
};
GridApi.prototype.forEachNodeAfterFilterAndSort = function (callback) {
this.grid.getRowModel().forEachNodeAfterFilterAndSort(callback);
};
GridApi.prototype.getFilterApiForColDef = function (colDef) {
console.warn('ag-grid API method getFilterApiForColDef deprecated, use getFilterApi instead');
return this.getFilterApi(colDef);
};
GridApi.prototype.getFilterApi = function (key) {
var column = this.columnController.getColumn(key);
return this.filterManager.getFilterApi(column);
};
GridApi.prototype.getColumnDef = function (key) {
var column = this.columnController.getColumn(key);
if (column) {
return column.getColDef();
}
else {
return null;
}
};
GridApi.prototype.onFilterChanged = function () {
this.grid.onFilterChanged();
};
GridApi.prototype.setSortModel = function (sortModel) {
this.grid.setSortModel(sortModel);
};
GridApi.prototype.getSortModel = function () {
return this.grid.getSortModel();
};
GridApi.prototype.setFilterModel = function (model) {
this.filterManager.setFilterModel(model);
};
GridApi.prototype.getFilterModel = function () {
return this.grid.getFilterModel();
};
GridApi.prototype.getFocusedCell = function () {
return this.rowRenderer.getFocusedCell();
};
GridApi.prototype.setFocusedCell = function (rowIndex, colId) {
this.grid.setFocusedCell(rowIndex, colId);
};
GridApi.prototype.setHeaderHeight = function (headerHeight) {
this.gridOptionsWrapper.setHeaderHeight(headerHeight);
this.gridPanel.onBodyHeightChange();
};
GridApi.prototype.showToolPanel = function (show) {
this.grid.showToolPanel(show);
};
GridApi.prototype.isToolPanelShowing = function () {
return this.grid.isToolPanelShowing();
};
GridApi.prototype.doLayout = function () {
this.grid.doLayout();
};
GridApi.prototype.getValue = function (colDef, data, node) {
return this.valueService.getValue(colDef, data, node);
};
GridApi.prototype.addEventListener = function (eventType, listener) {
this.eventService.addEventListener(eventType, listener);
};
GridApi.prototype.addGlobalListener = function (listener) {
this.eventService.addGlobalListener(listener);
};
GridApi.prototype.removeEventListener = function (eventType, listener) {
this.eventService.removeEventListener(eventType, listener);
};
GridApi.prototype.removeGlobalListener = function (listener) {
this.eventService.removeGlobalListener(listener);
};
GridApi.prototype.dispatchEvent = function (eventType, event) {
this.eventService.dispatchEvent(eventType, event);
};
GridApi.prototype.refreshRowGroup = function () {
this.grid.refreshRowGroup();
};
GridApi.prototype.destroy = function () {
this.grid.destroy();
};
return GridApi;
})();
exports.GridApi = GridApi;
| pvnr0082t/cdnjs | ajax/libs/ag-grid/3.3.3/lib/gridApi.js | JavaScript | mit | 12,913 |
/*!
* jQuery UI Spinner @VERSION
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Spinner#theming
*/
.ui-spinner {
position: relative;
display: inline-block;
overflow: hidden;
padding: 0;
vertical-align: middle;
}
.ui-spinner-input {
border: none;
background: none;
color: inherit;
padding: 0;
margin: .2em 0;
vertical-align: middle;
margin-left: .4em;
margin-right: 22px;
}
.ui-spinner-button {
width: 16px;
height: 50%;
font-size: .5em;
padding: 0;
margin: 0;
text-align: center;
position: absolute;
cursor: default;
display: block;
overflow: hidden;
right: 0;
}
/* more specificity required here to overide default borders */
.ui-spinner a.ui-spinner-button {
border-top: none;
border-bottom: none;
border-right: none;
}
/* vertical centre icon */
.ui-spinner .ui-icon {
position: absolute;
margin-top: -8px;
top: 50%;
left: 0;
}
.ui-spinner-up {
top: 0;
}
.ui-spinner-down {
bottom: 0;
}
/* TR overrides */
.ui-spinner .ui-icon-triangle-1-s {
/* need to fix icons sprite */
background-position: -65px -16px;
}
| ruo91/cdnjs | ajax/libs/jquery/1.10.1/themes/base/jquery.ui.spinner.css | CSS | mit | 1,184 |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Adds tagged translation.extractor services to translation extractor
*/
class TranslationExtractorPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('translation.extractor')) {
return;
}
$definition = $container->getDefinition('translation.extractor');
foreach ($container->findTaggedServiceIds('translation.extractor') as $id => $attributes) {
if (!isset($attributes[0]['alias'])) {
throw new \RuntimeException(sprintf('The alias for the tag "translation.extractor" of service "%s" must be set.', $id));
}
$definition->addMethodCall('addExtractor', array($attributes[0]['alias'], new Reference($id)));
}
}
}
| CalyphoZz/HopitalAQPv2 | vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationExtractorPass.php | PHP | mit | 1,308 |
/*
* LESS - Leaner CSS v1.4.1
* http://lesscss.org
*
* Copyright (c) 2009-2013, Alexis Sellier
* Licensed under the Apache 2.0 License.
*
* @licence
*/(function(e,t){function n(t){return e.less[t.split("/")[1]]}function f(){r.env==="development"?(r.optimization=0,r.watchTimer=setInterval(function(){r.watchMode&&g(function(e,t,n,i,s){e?k(e,i.href):t&&S(t.toCSS(r),i,s.lastModified)})},r.poll)):r.optimization=3}function m(){var e=document.getElementsByTagName("style");for(var t=0;t<e.length;t++)if(e[t].type.match(p)){var n=new r.tree.parseEnv(r);n.filename=document.location.href.replace(/#.*$/,""),(new r.Parser(n)).parse(e[t].innerHTML||"",function(n,i){if(n)return k(n,"inline");var s=i.toCSS(r),o=e[t];o.type="text/css",o.styleSheet?o.styleSheet.cssText=s:o.innerHTML=s})}}function g(e,t){for(var n=0;n<r.sheets.length;n++)w(r.sheets[n],e,t,r.sheets.length-(n+1))}function y(e,t){var n=b(e),r=b(t),i,s,o,u,a="";if(n.hostPart!==r.hostPart)return"";s=Math.max(r.directories.length,n.directories.length);for(i=0;i<s;i++)if(r.directories[i]!==n.directories[i])break;u=r.directories.slice(i),o=n.directories.slice(i);for(i=0;i<u.length-1;i++)a+="../";for(i=0;i<o.length-1;i++)a+=o[i]+"/";return a}function b(e,t){var n=/^((?:[a-z-]+:)?\/+?(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/,r=e.match(n),i={},s=[],o,u;if(!r)throw new Error("Could not parse sheet href - '"+e+"'");if(!r[1]||r[2]){u=t.match(n);if(!u)throw new Error("Could not parse page url - '"+t+"'");r[1]=r[1]||u[1]||"",r[2]||(r[3]=u[3]+r[3])}if(r[3]){s=r[3].replace("\\","/").split("/");for(o=0;o<s.length;o++)s[o]==="."&&(s.splice(o,1),o-=1);for(o=0;o<s.length;o++)s[o]===".."&&o>0&&(s.splice(o-1,2),o-=2)}return i.hostPart=r[1],i.directories=s,i.path=r[1]+s.join("/"),i.fileUrl=i.path+(r[4]||""),i.url=i.fileUrl+(r[5]||""),i}function w(t,n,i,s){var o=b(t.href,e.location.href),u=o.url,a=l&&l.getItem(u),f=l&&l.getItem(u+":timestamp"),c={css:a,timestamp:f},h,p={relativeUrls:r.relativeUrls,currentDirectory:o.path,filename:u};t instanceof r.tree.parseEnv?(h=new r.tree.parseEnv(t),p.entryPath=h.currentFileInfo.entryPath,p.rootpath=h.currentFileInfo.rootpath,p.rootFilename=h.currentFileInfo.rootFilename):(h=new r.tree.parseEnv(r),h.mime=t.type,p.entryPath=o.path,p.rootpath=r.rootpath||o.path,p.rootFilename=u),h.relativeUrls&&(r.rootpath?p.rootpath=b(r.rootpath+y(o.path,p.entryPath)).path:p.rootpath=o.path),x(u,t.type,function(e,a){v+=e.replace(/@import .+?;/ig,"");if(!i&&c&&a&&(new Date(a)).valueOf()===(new Date(c.timestamp)).valueOf())S(c.css,t),n(null,null,e,t,{local:!0,remaining:s},u);else try{h.contents[u]=e,h.paths=[o.path],h.currentFileInfo=p,(new r.Parser(h)).parse(e,function(r,i){if(r)return n(r,null,null,t);try{n(r,i,e,t,{local:!1,lastModified:a,remaining:s},u),h.currentFileInfo.rootFilename===u&&N(document.getElementById("less-error-message:"+E(u)))}catch(r){n(r,null,null,t)}})}catch(f){n(f,null,null,t)}},function(e,r){n({type:"File",message:"'"+r+"' wasn't found ("+e+")"},null,null,t)})}function E(e){return e.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function S(e,t,n){var r=t.href||"",i="less:"+(t.title||E(r)),s=document.getElementById(i),o=!1,u=document.createElement("style");u.setAttribute("type","text/css"),t.media&&u.setAttribute("media",t.media),u.id=i;if(u.styleSheet)try{u.styleSheet.cssText=e}catch(a){throw new Error("Couldn't reassign styleSheet.cssText.")}else u.appendChild(document.createTextNode(e)),o=s!==null&&s.childNodes.length>0&&u.childNodes.length>0&&s.firstChild.nodeValue===u.firstChild.nodeValue;var f=document.getElementsByTagName("head")[0];if(s==null||o===!1){var c=t&&t.nextSibling||null;(c||document.getElementsByTagName("head")[0]).parentNode.insertBefore(u,c)}s&&o===!1&&f.removeChild(s);if(n&&l){C("saving "+r+" to cache.");try{l.setItem(r,e),l.setItem(r+":timestamp",n)}catch(a){C("failed to save")}}}function x(e,t,n,i){function a(t,n,r){t.status>=200&&t.status<300?n(t.responseText,t.getResponseHeader("Last-Modified")):typeof r=="function"&&r(t.status,e)}var s=T(),u=o?r.fileAsync:r.async;typeof s.overrideMimeType=="function"&&s.overrideMimeType("text/css"),s.open("GET",e,u),s.setRequestHeader("Accept",t||"text/x-less, text/css; q=0.9, */*; q=0.5"),s.send(null),o&&!r.fileAsync?s.status===0||s.status>=200&&s.status<300?n(s.responseText):i(s.status,e):u?s.onreadystatechange=function(){s.readyState==4&&a(s,n,i)}:a(s,n,i)}function T(){if(e.XMLHttpRequest)return new XMLHttpRequest;try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(t){return C("browser doesn't support AJAX."),null}}function N(e){return e&&e.parentNode.removeChild(e)}function C(e){r.env=="development"&&typeof console!="undefined"&&console.log("less: "+e)}function k(e,n){var i="less-error-message:"+E(n||""),s='<li><label>{line}</label><pre class="{class}">{content}</pre></li>',o=document.createElement("div"),u,a,f=[],l=e.filename||n,c=l.match(/([^\/]+(\?.*)?)$/)[1];o.id=i,o.className="less-error-message",a="<h3>"+(e.type||"Syntax")+"Error: "+(e.message||"There is an error in your .less file")+"</h3>"+'<p>in <a href="'+l+'">'+c+"</a> ";var h=function(e,n,r){e.extract[n]!=t&&f.push(s.replace(/\{line\}/,(parseInt(e.line)||0)+(n-1)).replace(/\{class\}/,r).replace(/\{content\}/,e.extract[n]))};e.extract?(h(e,0,""),h(e,1,"line"),h(e,2,""),a+="on line "+e.line+", column "+(e.column+1)+":</p>"+"<ul>"+f.join("")+"</ul>"):e.stack&&(a+="<br/>"+e.stack.split("\n").slice(1).join("<br/>")),o.innerHTML=a,S([".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),o.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),r.env=="development"&&(u=setInterval(function(){document.body&&(document.getElementById(i)?document.body.replaceChild(o,document.getElementById(i)):document.body.insertBefore(o,document.body.firstChild),clearInterval(u))},10))}var r,i,s;typeof environment=="object"&&{}.toString.call(environment)==="[object Environment]"?(typeof e=="undefined"?r={}:r=e.less={},i=r.tree={},r.mode="rhino"):typeof e=="undefined"?(r=exports,i=n("./tree"),r.mode="node"):(typeof e.less=="undefined"&&(e.less={}),r=e.less,i=e.less.tree={},r.mode="browser"),r.Parser=function(t){function m(){a=c[u],f=o,h=o}function g(){c[u]=a,o=f,h=o}function y(){o>h&&(c[u]=c[u].slice(o-h),h=o)}function b(e){var t=e.charCodeAt(0);return t===32||t===10||t===9}function w(e){var t,n,r,i,a;if(e instanceof Function)return e.call(p.parsers);if(typeof e=="string")t=s.charAt(o)===e?e:null,r=1,y();else{y();if(!(t=e.exec(c[u])))return null;r=t[0].length}if(t)return E(r),typeof t=="string"?t:t.length===1?t[0]:t}function E(e){var t=o,n=u,r=o+c[u].length,i=o+=e;while(o<r){if(!b(s.charAt(o)))break;o++}return c[u]=c[u].slice(e+(o-i)),h=o,c[u].length===0&&u<c.length-1&&u++,t!==o||n!==u}function S(e,t){var n=w(e);if(!!n)return n;x(t||(typeof e=="string"?"expected '"+e+"' got '"+s.charAt(o)+"'":"unexpected token"))}function x(e,t){var n=new Error(e);throw n.index=o,n.type=t||"Syntax",n}function T(e){return typeof e=="string"?s.charAt(o)===e:e.test(c[u])?!0:!1}function N(e,t){return e.filename&&t.currentFileInfo.filename&&e.filename!==t.currentFileInfo.filename?p.imports.contents[e.filename]:s}function C(e,t){for(var n=e,r=-1;n>=0&&t.charAt(n)!=="\n";n--)r++;return{line:typeof e=="number"?(t.slice(0,e).match(/\n/g)||"").length:null,column:r}}function k(e,t,i){var s=i.currentFileInfo.filename;return r.mode!=="browser"&&r.mode!=="rhino"&&(s=n("path").resolve(s)),{lineNumber:C(e,t).line+1,fileName:s}}function L(e,t){var n=N(e,t),r=C(e.index,n),i=r.line,s=r.column,o=n.split("\n");this.type=e.type||"Syntax",this.message=e.message,this.filename=e.filename||t.currentFileInfo.filename,this.index=e.index,this.line=typeof i=="number"?i+1:null,this.callLine=e.call&&C(e.call,n).line+1,this.callExtract=o[C(e.call,n).line],this.stack=e.stack,this.column=s,this.extract=[o[i-1],o[i],o[i+1]]}var s,o,u,a,f,l,c,h,p,d=this;t instanceof i.parseEnv||(t=new i.parseEnv(t));var v=this.imports={paths:t.paths||[],queue:[],files:t.files,contents:t.contents,mime:t.mime,error:null,push:function(e,n,i){var s=this;this.queue.push(e),r.Parser.importer(e,n,function(t,n,r){s.queue.splice(s.queue.indexOf(e),1);var o=r in s.files;s.files[r]=n,t&&!s.error&&(s.error=t),i(t,n,o)},t)}};return L.prototype=new Error,L.prototype.constructor=L,this.env=t=t||{},this.optimization="optimization"in this.env?this.env.optimization:1,p={imports:v,parse:function(e,a){var f,d,v,m,g,y,b=[],E,S=null;o=u=h=l=0,s=e.replace(/\r\n/g,"\n"),s=s.replace(/^\uFEFF/,""),c=function(e){var n=0,r=/(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,i=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,o=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,u=0,a,f=e[0],l;for(var c=0,h,p;c<s.length;){r.lastIndex=c,(a=r.exec(s))&&a.index===c&&(c+=a[0].length,f.push(a[0])),h=s.charAt(c),i.lastIndex=o.lastIndex=c;if(a=o.exec(s))if(a.index===c){c+=a[0].length,f.push(a[0]);continue}if(!l&&h==="/"){p=s.charAt(c+1);if(p==="/"||p==="*")if(a=i.exec(s))if(a.index===c){c+=a[0].length,f.push(a[0]);continue}}switch(h){case"{":if(!l){u++,f.push(h);break};case"}":if(!l){u--,f.push(h),e[++n]=f=[];break};case"(":if(!l){l=!0,f.push(h);break};case")":if(l){l=!1,f.push(h);break};default:f.push(h)}c++}return u!=0&&(S=new L({index:c-1,type:"Parse",message:u>0?"missing closing `}`":"missing opening `{`",filename:t.currentFileInfo.filename},t)),e.map(function(e){return e.join("")})}([[]]);if(S)return a(new L(S,t));try{f=new i.Ruleset([],w(this.parsers.primary)),f.root=!0,f.firstRoot=!0}catch(x){return a(new L(x,t))}f.toCSS=function(e){var s,o,u;return function(s,o){s=s||{};var u,a=new i.evalEnv(s);typeof o=="object"&&!Array.isArray(o)&&(o=Object.keys(o).map(function(e){var t=o[e];return t instanceof i.Value||(t instanceof i.Expression||(t=new i.Expression([t])),t=new i.Value([t])),new i.Rule("@"+e,t,!1,0)}),a.frames=[new i.Ruleset(null,o)]);try{var f=e.call(this,a);(new i.joinSelectorVisitor).run(f),(new i.processExtendsVisitor).run(f);var l=f.toCSS({compress:Boolean(s.compress),dumpLineNumbers:t.dumpLineNumbers,strictUnits:Boolean(s.strictUnits)})}catch(c){throw new L(c,t)}return s.yuicompress&&r.mode==="node"?n("ycssmin").cssmin(l,s.maxLineLen):s.compress?l.replace(/(\s)+/g,"$1"):l}}(f.eval);if(o<s.length-1){o=l,y=s.split("\n"),g=(s.slice(0,o).match(/\n/g)||"").length+1;for(var T=o,N=-1;T>=0&&s.charAt(T)!=="\n";T--)N++;S={type:"Parse",message:"Unrecognised input",index:o,filename:t.currentFileInfo.filename,line:g,column:N,extract:[y[g-2],y[g-1],y[g]]}}var C=function(e){e=S||e||p.imports.error,e?(e instanceof L||(e=new L(e,t)),a(e)):a(null,f)};t.processImports!==!1?(new i.importVisitor(this.imports,C)).run(f):C()},parsers:{primary:function(){var e,t=[];while((e=w(this.extendRule)||w(this.mixin.definition)||w(this.rule)||w(this.ruleset)||w(this.mixin.call)||w(this.comment)||w(this.directive))||w(/^[\s\n]+/)||w(/^;+/))e&&t.push(e);return t},comment:function(){var e;if(s.charAt(o)!=="/")return;if(s.charAt(o+1)==="/")return new i.Comment(w(/^\/\/.*/),!0);if(e=w(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/))return new i.Comment(e)},entities:{quoted:function(){var e,n=o,r,u=o;s.charAt(n)==="~"&&(n++,r=!0);if(s.charAt(n)!=='"'&&s.charAt(n)!=="'")return;r&&w("~");if(e=w(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/))return new i.Quoted(e[0],e[1]||e[2],r,u,t.currentFileInfo)},keyword:function(){var e;if(e=w(/^[_A-Za-z-][_A-Za-z0-9-]*/))return i.colors.hasOwnProperty(e)?new i.Color(i.colors[e].slice(1)):new i.Keyword(e)},call:function(){var e,n,r,s,a=o;if(!(e=/^([\w-]+|%|progid:[\w\.]+)\(/.exec(c[u])))return;e=e[1],n=e.toLowerCase();if(n==="url")return null;o+=e.length;if(n==="alpha"){s=w(this.alpha);if(typeof s!="undefined")return s}w("("),r=w(this.entities.arguments);if(!w(")"))return;if(e)return new i.Call(e,r,a,t.currentFileInfo)},arguments:function(){var e=[],t;while(t=w(this.entities.assignment)||w(this.expression)){e.push(t);if(!w(","))break}return e},literal:function(){return w(this.entities.dimension)||w(this.entities.color)||w(this.entities.quoted)||w(this.entities.unicodeDescriptor)},assignment:function(){var e,t;if((e=w(/^\w+(?=\s?=)/i))&&w("=")&&(t=w(this.entity)))return new i.Assignment(e,t)},url:function(){var e;if(s.charAt(o)!=="u"||!w(/^url\(/))return;return e=w(this.entities.quoted)||w(this.entities.variable)||w(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",S(")"),new i.URL(e.value!=null||e instanceof i.Variable?e:new i.Anonymous(e),t.currentFileInfo)},variable:function(){var e,n=o;if(s.charAt(o)==="@"&&(e=w(/^@@?[\w-]+/)))return new i.Variable(e,n,t.currentFileInfo)},variableCurly:function(){var e,n,r=o;if(s.charAt(o)==="@"&&(n=w(/^@\{([\w-]+)\}/)))return new i.Variable("@"+n[1],r,t.currentFileInfo)},color:function(){var e;if(s.charAt(o)==="#"&&(e=w(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/)))return new i.Color(e[1])},dimension:function(){var e,t=s.charCodeAt(o);if(t>57||t<43||t===47||t==44)return;if(e=w(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/))return new i.Dimension(e[1],e[2])},unicodeDescriptor:function(){var e;if(e=w(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new i.UnicodeDescriptor(e[0])},javascript:function(){var e,t=o,n;s.charAt(t)==="~"&&(t++,n=!0);if(s.charAt(t)!=="`")return;n&&w("~");if(e=w(/^`([^`]*)`/))return new i.JavaScript(e[1],o,n)}},variable:function(){var e;if(s.charAt(o)==="@"&&(e=w(/^(@[\w-]+)\s*:/)))return e[1]},extend:function(e){var t,n,r=o,s,u=[];if(!w(e?/^&:extend\(/:/^:extend\(/))return;do{s=null,t=[];for(;;){s=w(/^(all)(?=\s*(\)|,))/);if(s)break;n=w(this.element);if(!n)break;t.push(n)}s=s&&s[1],u.push(new i.Extend(new i.Selector(t),s,r))}while(w(","));return S(/^\)/),e&&S(/^;/),u},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var e=[],n,r,u,a,f,l=o,c=s.charAt(o),h=!1;if(c!=="."&&c!=="#")return;m();while(n=w(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/))e.push(new i.Element(r,n,o)),r=w(">");w("(")&&(u=this.mixin.args.call(this,!0).args,S(")")),u=u||[],w(this.important)&&(h=!0);if(e.length>0&&(w(";")||T("}")))return new i.mixin.Call(e,u,l,t.currentFileInfo,h);g()},args:function(e){var t=[],n=[],r,u=[],a,f,l,c,h,p={args:null,variadic:!1};for(;;){if(e)h=w(this.expression);else{w(this.comment);if(s.charAt(o)==="."&&w(/^\.{3}/)){p.variadic=!0,w(";")&&!r&&(r=!0),(r?n:u).push({variadic:!0});break}h=w(this.entities.variable)||w(this.entities.literal)||w(this.entities.keyword)}if(!h)break;l=null,h.throwAwayComments&&h.throwAwayComments(),c=h;var d=null;if(e){if(h.value.length==1)var d=h.value[0]}else d=h;if(d&&d instanceof i.Variable)if(w(":"))t.length>0&&(r&&x("Cannot mix ; and , as delimiter types"),a=!0),c=S(this.expression),l=f=d.name;else{if(!e&&w(/^\.{3}/)){p.variadic=!0,w(";")&&!r&&(r=!0),(r?n:u).push({name:h.name,variadic:!0});break}e||(f=l=d.name,c=null)}c&&t.push(c),u.push({name:l,value:c});if(w(","))continue;if(w(";")||r)a&&x("Cannot mix ; and , as delimiter types"),r=!0,t.length>1&&(c=new i.Value(t)),n.push({name:f,value:c}),f=null,t=[],a=!1}return p.args=r?n:u,p},definition:function(){var e,t=[],n,r,u,a,f,c=!1;if(s.charAt(o)!=="."&&s.charAt(o)!=="#"||T(/^[^{]*\}/))return;m();if(n=w(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){e=n[1];var h=this.mixin.args.call(this,!1);t=h.args,c=h.variadic,w(")")||(l=o,g()),w(this.comment),w(/^when/)&&(f=S(this.conditions,"expected condition")),r=w(this.block);if(r)return new i.mixin.Definition(e,t,r,f,c);g()}}},entity:function(){return w(this.entities.literal)||w(this.entities.variable)||w(this.entities.url)||w(this.entities.call)||w(this.entities.keyword)||w(this.entities.javascript)||w(this.comment)},end:function(){return w(";")||T("}")},alpha:function(){var e;if(!w(/^\(opacity=/i))return;if(e=w(/^\d+/)||w(this.entities.variable))return S(")"),new i.Alpha(e)},element:function(){var e,t,n,r;n=w(this.combinator),e=w(/^(?:\d+\.\d+|\d+)%/)||w(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||w("*")||w("&")||w(this.attribute)||w(/^\([^()@]+\)/)||w(/^[\.#](?=@)/)||w(this.entities.variableCurly),e||w("(")&&(r=w(this.selector))&&w(")")&&(e=new i.Paren(r));if(e)return new i.Element(n,e,o)},combinator:function(){var e=s.charAt(o);if(e===">"||e==="+"||e==="~"||e==="|"){o++;while(s.charAt(o).match(/\s/))o++;return new i.Combinator(e)}return s.charAt(o-1).match(/\s/)?new i.Combinator(" "):new i.Combinator(null)},selector:function(){var e,t,n=[],r,u,a=[];while((u=w(this.extend))||(t=w(this.element))){u?a.push.apply(a,u):(a.length&&x("Extend can only be used at the end of selector"),r=s.charAt(o),n.push(t),t=null);if(r==="{"||r==="}"||r===";"||r===","||r===")")break}if(n.length>0)return new i.Selector(n,a);a.length&&x("Extend must be used to extend a selector, it cannot be used on its own")},attribute:function(){var e="",t,n,r;if(!w("["))return;(t=w(this.entities.variableCurly))||(t=S(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/));if(r=w(/^[|~*$^]?=/))n=w(this.entities.quoted)||w(/^[\w-]+/)||w(this.entities.variableCurly);return S("]"),new i.Attribute(t,r,n)},block:function(){var e;if(w("{")&&(e=w(this.primary))&&w("}"))return e},ruleset:function(){var e=[],n,r,u;m(),t.dumpLineNumbers&&(u=k(o,s,t));while(n=w(this.selector)){e.push(n),w(this.comment);if(!w(","))break;w(this.comment)}if(e.length>0&&(r=w(this.block))){var a=new i.Ruleset(e,r,t.strictImports);return t.dumpLineNumbers&&(a.debugInfo=u),a}l=o,g()},rule:function(e){var n,r,u=s.charAt(o),a;m();if(u==="."||u==="#"||u==="&")return;if(n=w(this.variable)||w(this.property)){r=!e&&(t.compress||n.charAt(0)==="@")?w(this.value)||w(this.anonymousValue):w(this.anonymousValue)||w(this.value),a=w(this.important);if(r&&w(this.end))return new i.Rule(n,r,a,f,t.currentFileInfo);l=o,g();if(r&&!e)return this.rule(!0)}},anonymousValue:function(){var e;if(e=/^([^@+\/'"*`(;{}-]*);/.exec(c[u]))return o+=e[0].length-1,new i.Anonymous(e[1])},"import":function(){var e,n,r=o;m();var s=w(/^@import?\s+/),u=(s?w(this.importOptions):null)||{};if(s&&(e=w(this.entities.quoted)||w(this.entities.url))){n=w(this.mediaFeatures);if(w(";"))return n=n&&new i.Value(n),new i.Import(e,n,u,r,t.currentFileInfo)}g()},importOptions:function(){var e,t={},n,r;if(!w("("))return null;do if(e=w(this.importOption)){n=e,r=!0;switch(n){case"css":n="less",r=!1;break;case"once":n="multiple",r=!1}t[n]=r;if(!w(","))break}while(e);return S(")"),t},importOption:function(){var e=w(/^(less|css|multiple|once)/);if(e)return e[1]},mediaFeature:function(){var e,n,r=[];do if(e=w(this.entities.keyword))r.push(e);else if(w("(")){n=w(this.property),e=w(this.value);if(!w(")"))return null;if(n&&e)r.push(new i.Paren(new i.Rule(n,e,null,o,t.currentFileInfo,!0)));else{if(!e)return null;r.push(new i.Paren(e))}}while(e);if(r.length>0)return new i.Expression(r)},mediaFeatures:function(){var e,t=[];do if(e=w(this.mediaFeature)){t.push(e);if(!w(","))break}else if(e=w(this.entities.variable)){t.push(e);if(!w(","))break}while(e);return t.length>0?t:null},media:function(){var e,n,r,u;t.dumpLineNumbers&&(u=k(o,s,t));if(w(/^@media/)){e=w(this.mediaFeatures);if(n=w(this.block))return r=new i.Media(n,e),t.dumpLineNumbers&&(r.debugInfo=u),r}},directive:function(){var e,n,r,u,a,f,l,c,h,p;if(s.charAt(o)!=="@")return;if(n=w(this["import"])||w(this.media))return n;m(),e=w(/^@[a-z-]+/);if(!e)return;l=e,e.charAt(1)=="-"&&e.indexOf("-",2)>0&&(l="@"+e.slice(e.indexOf("-",2)+1));switch(l){case"@font-face":c=!0;break;case"@viewport":case"@top-left":case"@top-left-corner":case"@top-center":case"@top-right":case"@top-right-corner":case"@bottom-left":case"@bottom-left-corner":case"@bottom-center":case"@bottom-right":case"@bottom-right-corner":case"@left-top":case"@left-middle":case"@left-bottom":case"@right-top":case"@right-middle":case"@right-bottom":c=!0;break;case"@page":case"@document":case"@supports":case"@keyframes":c=!0,h=!0;break;case"@namespace":p=!0}h&&(e+=" "+(w(/^[^{]+/)||"").trim());if(c){if(r=w(this.block))return new i.Directive(e,r)}else if((n=p?w(this.expression):w(this.entity))&&w(";")){var d=new i.Directive(e,n);return t.dumpLineNumbers&&(d.debugInfo=k(o,s,t)),d}g()},value:function(){var e,t=[],n;while(e=w(this.expression)){t.push(e);if(!w(","))break}if(t.length>0)return new i.Value(t)},important:function(){if(s.charAt(o)==="!")return w(/^! *important/)},sub:function(){var e,t;if(w("("))if(e=w(this.addition))return t=new i.Expression([e]),S(")"),t.parens=!0,t},multiplication:function(){var e,t,n,r,u,a=[];if(e=w(this.operand)){u=b(s.charAt(o-1));while(!T(/^\/[*\/]/)&&(n=w("/")||w("*"))){if(!(t=w(this.operand)))break;e.parensInOp=!0,t.parensInOp=!0,r=new i.Operation(n,[r||e,t],u),u=b(s.charAt(o-1))}return r||e}},addition:function(){var e,t,n,r,u;if(e=w(this.multiplication)){u=b(s.charAt(o-1));while((n=w(/^[-+]\s+/)||!u&&(w("+")||w("-")))&&(t=w(this.multiplication)))e.parensInOp=!0,t.parensInOp=!0,r=new i.Operation(n,[r||e,t],u),u=b(s.charAt(o-1));return r||e}},conditions:function(){var e,t,n=o,r;if(e=w(this.condition)){while(w(",")&&(t=w(this.condition)))r=new i.Condition("or",r||e,t,n);return r||e}},condition:function(){var e,t,n,r,s=o,u=!1;w(/^not/)&&(u=!0),S("(");if(e=w(this.addition)||w(this.entities.keyword)||w(this.entities.quoted))return(r=w(/^(?:>=|=<|[<=>])/))?(t=w(this.addition)||w(this.entities.keyword)||w(this.entities.quoted))?n=new i.Condition(r,e,t,s,u):x("expected expression"):n=new i.Condition("=",e,new i.Keyword("true"),s,u),S(")"),w(/^and/)?new i.Condition("and",n,w(this.condition)):n},operand:function(){var e,t=s.charAt(o+1);s.charAt(o)==="-"&&(t==="@"||t==="(")&&(e=w("-"));var n=w(this.sub)||w(this.entities.dimension)||w(this.entities.color)||w(this.entities.variable)||w(this.entities.call);return e&&(n.parensInOp=!0,n=new i.Negative(n)),n},expression:function(){var e,t,n=[],r;while(e=w(this.addition)||w(this.entity))n.push(e),!T(/^\/[\/*]/)&&(t=w("/"))&&n.push(new i.Anonymous(t));if(n.length>0)return new i.Expression(n)},property:function(){var e;if(e=w(/^(\*?-?[_a-z0-9-]+)\s*:/))return e[1]}}}};if(r.mode==="browser"||r.mode==="rhino")r.Parser.importer=function(e,t,n,r){!/^([a-z-]+:)?\//.test(e)&&t.currentDirectory&&(e=t.currentDirectory+e);var i=r.toSheet(e);i.processImports=!1,i.currentFileInfo=t,w(i,function(e,t,r,i,s,o){n.call(null,e,t,o)},!0)};(function(r){function u(e){return r.functions.hsla(e.h,e.s,e.l,e.a)}function a(e,t){return e instanceof r.Dimension&&e.unit.is("%")?parseFloat(e.value*t/100):f(e)}function f(e){if(e instanceof r.Dimension)return parseFloat(e.unit.is("%")?e.value/100:e.value);if(typeof e=="number")return e;throw{error:"RuntimeError",message:"color functions take numbers as parameters"}}function l(e){return Math.min(1,Math.max(0,e))}r.functions={rgb:function(e,t,n){return this.rgba(e,t,n,1)},rgba:function(e,t,n,i){var s=[e,t,n].map(function(e){return a(e,256)});return i=f(i),new r.Color(s,i)},hsl:function(e,t,n){return this.hsla(e,t,n,1)},hsla:function(e,t,n,r){function o(e){return e=e<0?e+1:e>1?e-1:e,e*6<1?s+(i-s)*e*6:e*2<1?i:e*3<2?s+(i-s)*(2/3-e)*6:s}e=f(e)%360/360,t=l(f(t)),n=l(f(n)),r=l(f(r));var i=n<=.5?n*(t+1):n+t-n*t,s=n*2-i;return this.rgba(o(e+1/3)*255,o(e)*255,o(e-1/3)*255,r)},hsv:function(e,t,n){return this.hsva(e,t,n,1)},hsva:function(e,t,n,r){e=f(e)%360/360*360,t=f(t),n=f(n),r=f(r);var i,s;i=Math.floor(e/60%6),s=e/60-i;var o=[n,n*(1-t),n*(1-s*t),n*(1-(1-s)*t)],u=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return this.rgba(o[u[i][0]]*255,o[u[i][1]]*255,o[u[i][2]]*255,r)},hue:function(e){return new r.Dimension(Math.round(e.toHSL().h))},saturation:function(e){return new r.Dimension(Math.round(e.toHSL().s*100),"%")},lightness:function(e){return new r.Dimension(Math.round(e.toHSL().l*100),"%")},hsvhue:function(e){return new r.Dimension(Math.round(e.toHSV().h))},hsvsaturation:function(e){return new r.Dimension(Math.round(e.toHSV().s*100),"%")},hsvvalue:function(e){return new r.Dimension(Math.round(e.toHSV().v*100),"%")},red:function(e){return new r.Dimension(e.rgb[0])},green:function(e){return new r.Dimension(e.rgb[1])},blue:function(e){return new r.Dimension(e.rgb[2])},alpha:function(e){return new r.Dimension(e.toHSL().a)},luma:function(e){return new r.Dimension(Math.round(e.luma()*e.alpha*100),"%")},saturate:function(e,t){var n=e.toHSL();return n.s+=t.value/100,n.s=l(n.s),u(n)},desaturate:function(e,t){var n=e.toHSL();return n.s-=t.value/100,n.s=l(n.s),u(n)},lighten:function(e,t){var n=e.toHSL();return n.l+=t.value/100,n.l=l(n.l),u(n)},darken:function(e,t){var n=e.toHSL();return n.l-=t.value/100,n.l=l(n.l),u(n)},fadein:function(e,t){var n=e.toHSL();return n.a+=t.value/100,n.a=l(n.a),u(n)},fadeout:function(e,t){var n=e.toHSL();return n.a-=t.value/100,n.a=l(n.a),u(n)},fade:function(e,t){var n=e.toHSL();return n.a=t.value/100,n.a=l(n.a),u(n)},spin:function(e,t){var n=e.toHSL(),r=(n.h+t.value)%360;return n.h=r<0?360+r:r,u(n)},mix:function(e,t,n){n||(n=new r.Dimension(50));var i=n.value/100,s=i*2-1,o=e.toHSL().a-t.toHSL().a,u=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,a=1-u,f=[e.rgb[0]*u+t.rgb[0]*a,e.rgb[1]*u+t.rgb[1]*a,e.rgb[2]*u+t.rgb[2]*a],l=e.alpha*i+t.alpha*(1-i);return new r.Color(f,l)},greyscale:function(e){return this.desaturate(e,new r.Dimension(100))},contrast:function(e,t,n,r){if(!e.rgb)return null;typeof n=="undefined"&&(n=this.rgba(255,255,255,1)),typeof t=="undefined"&&(t=this.rgba(0,0,0,1));if(t.luma()>n.luma()){var i=n;n=t,t=i}return typeof r=="undefined"?r=.43:r=f(r),e.luma()*e.alpha<r?n:t},e:function(e){return new r.Anonymous(e instanceof r.JavaScript?e.evaluated:e)},escape:function(e){return new r.Anonymous(encodeURI(e.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},"%":function(e){var t=Array.prototype.slice.call(arguments,1),n=e.value;for(var i=0;i<t.length;i++)n=n.replace(/%[sda]/i,function(e){var n=e.match(/s/i)?t[i].value:t[i].toCSS();return e.match(/[A-Z]$/)?encodeURIComponent(n):n});return n=n.replace(/%%/g,"%"),new r.Quoted('"'+n+'"',n)},unit:function(e,t){return new r.Dimension(e.value,t?t.toCSS():"")},convert:function(e,t){return e.convertTo(t.value)},round:function(e,t){var n=typeof t=="undefined"?0:t.value;return this._math(function(e){return e.toFixed(n)},null,e)},pi:function(){return new r.Dimension(Math.PI)},mod:function(e,t){return new r.Dimension(e.value%t.value,e.unit)},pow:function(e,t){if(typeof e=="number"&&typeof t=="number")e=new r.Dimension(e),t=new r.Dimension(t);else if(!(e instanceof r.Dimension)||!(t instanceof r.Dimension))throw{type:"Argument",message:"arguments must be numbers"};return new r.Dimension(Math.pow(e.value,t.value),e.unit)},_math:function(e,t,n){if(n instanceof r.Dimension)return new r.Dimension(e(parseFloat(n.value)),t==null?n.unit:t);if(typeof n=="number")return e(n);throw{type:"Argument",message:"argument must be a number"}},argb:function(e){return new r.Anonymous(e.toARGB())},percentage:function(e){return new r.Dimension(e.value*100,"%")},color:function(e){if(e instanceof r.Quoted)return new r.Color(e.value.slice(1));throw{type:"Argument",message:"argument must be a string"}},iscolor:function(e){return this._isa(e,r.Color)},isnumber:function(e){return this._isa(e,r.Dimension)},isstring:function(e){return this._isa(e,r.Quoted)},iskeyword:function(e){return this._isa(e,r.Keyword)},isurl:function(e){return this._isa(e,r.URL)},ispixel:function(e){return this.isunit(e,"px")},ispercentage:function(e){return this.isunit(e,"%")},isem:function(e){return this.isunit(e,"em")},isunit:function(e,t){return e instanceof r.Dimension&&e.unit.is(t.value||t)?r.True:r.False},_isa:function(e,t){return e instanceof t?r.True:r.False},multiply:function(e,t){var n=e.rgb[0]*t.rgb[0]/255,r=e.rgb[1]*t.rgb[1]/255,i=e.rgb[2]*t.rgb[2]/255;return this.rgb(n,r,i)},screen:function(e,t){var n=255-(255-e.rgb[0])*(255-t.rgb[0])/255,r=255-(255-e.rgb[1])*(255-t.rgb[1])/255,i=255-(255-e.rgb[2])*(255-t.rgb[2])/255;return this.rgb(n,r,i)},overlay:function(e,t){var n=e.rgb[0]<128?2*e.rgb[0]*t.rgb[0]/255:255-2*(255-e.rgb[0])*(255-t.rgb[0])/255,r=e.rgb[1]<128?2*e.rgb[1]*t.rgb[1]/255:255-2*(255-e.rgb[1])*(255-t.rgb[1])/255,i=e.rgb[2]<128?2*e.rgb[2]*t.rgb[2]/255:255-2*(255-e.rgb[2])*(255-t.rgb[2])/255;return this.rgb(n,r,i)},softlight:function(e,t){var n=t.rgb[0]*e.rgb[0]/255,r=n+e.rgb[0]*(255-(255-e.rgb[0])*(255-t.rgb[0])/255-n)/255;n=t.rgb[1]*e.rgb[1]/255;var i=n+e.rgb[1]*(255-(255-e.rgb[1])*(255-t.rgb[1])/255-n)/255;n=t.rgb[2]*e.rgb[2]/255;var s=n+e.rgb[2]*(255-(255-e.rgb[2])*(255-t.rgb[2])/255-n)/255;return this.rgb(r,i,s)},hardlight:function(e,t){var n=t.rgb[0]<128?2*t.rgb[0]*e.rgb[0]/255:255-2*(255-t.rgb[0])*(255-e.rgb[0])/255,r=t.rgb[1]<128?2*t.rgb[1]*e.rgb[1]/255:255-2*(255-t.rgb[1])*(255-e.rgb[1])/255,i=t.rgb[2]<128?2*t.rgb[2]*e.rgb[2]/255:255-2*(255-t.rgb[2])*(255-e.rgb[2])/255;return this.rgb(n,r,i)},difference:function(e,t){var n=Math.abs(e.rgb[0]-t.rgb[0]),r=Math.abs(e.rgb[1]-t.rgb[1]),i=Math.abs(e.rgb[2]-t.rgb[2]);return this.rgb(n,r,i)},exclusion:function(e,t){var n=e.rgb[0]+t.rgb[0]*(255-e.rgb[0]-e.rgb[0])/255,r=e.rgb[1]+t.rgb[1]*(255-e.rgb[1]-e.rgb[1])/255,i=e.rgb[2]+t.rgb[2]*(255-e.rgb[2]-e.rgb[2])/255;return this.rgb(n,r,i)},average:function(e,t){var n=(e.rgb[0]+t.rgb[0])/2,r=(e.rgb[1]+t.rgb[1])/2,i=(e.rgb[2]+t.rgb[2])/2;return this.rgb(n,r,i)},negation:function(e,t){var n=255-Math.abs(255-t.rgb[0]-e.rgb[0]),r=255-Math.abs(255-t.rgb[1]-e.rgb[1]),i=255-Math.abs(255-t.rgb[2]-e.rgb[2]);return this.rgb(n,r,i)},tint:function(e,t){return this.mix(this.rgb(255,255,255),e,t)},shade:function(e,t){return this.mix(this.rgb(0,0,0),e,t)},extract:function(e,t){return t=t.value-1,e.value[t]},"data-uri":function(t,i){if(typeof e!="undefined")return(new r.URL(i||t,this.currentFileInfo)).eval(this.env);var s=t.value,o=i&&i.value,u=n("fs"),a=n("path"),f=!1;arguments.length<2&&(o=s),this.env.isPathRelative(o)&&(this.currentFileInfo.relativeUrls?o=a.join(this.currentFileInfo.currentDirectory,o):o=a.join(this.currentFileInfo.entryPath,o));if(arguments.length<2){var l;try{l=n("mime")}catch(c){l=r._mime}s=l.lookup(o);var h=l.charsets.lookup(s);f=["US-ASCII","UTF-8"].indexOf(h)<0,f&&(s+=";base64")}else f=/;base64$/.test(s);var p=u.readFileSync(o),d=32,v=parseInt(p.length/1024,10);if(v>=d){if(this.env.ieCompat!==!1)return this.env.silent||console.warn("Skipped data-uri embedding of %s because its size (%dKB) exceeds IE8-safe %dKB!",o,v,d),(new r.URL(i||t,this.currentFileInfo)).eval(this.env);this.env.silent||console.warn("WARNING: Embedding %s (%dKB) exceeds IE8's data-uri size limit of %dKB!",o,v,d)}p=f?p.toString("base64"):encodeURIComponent(p);var m="'data:"+s+","+p+"'";return new r.URL(new r.Anonymous(m))}},r._mime={_types:{".htm":"text/html",".html":"text/html",".gif":"image/gif",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png"},lookup:function(e){var i=n("path").extname(e),s=r._mime._types[i];if(s===t)throw new Error('Optional dependency "mime" is required for '+i);return s},charsets:{lookup:function(e){return e&&/^text\//.test(e)?"UTF-8":""}}};var i=[{name:"ceil"},{name:"floor"},{name:"sqrt"},{name:"abs"},{name:"tan",unit:""},{name:"sin",unit:""},{name:"cos",unit:""},{name:"atan",unit:"rad"},{name:"asin",unit:"rad"},{name:"acos",unit:"rad"}],s=function(e,t){return function(n){return t!=null&&(n=n.unify()),this._math(Math[e],t,n)}};for(var o=0;o<i.length;o++)r.functions[i[o].name]=s(i[o].name,i[o].unit);r.functionCall=function(e,t){this.env=e,this.currentFileInfo=t},r.functionCall.prototype=r.functions})(n("./tree")),function(e){e.colors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta
:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}}(n("./tree")),function(e){e.Alpha=function(e){this.value=e},e.Alpha.prototype={type:"Alpha",accept:function(e){this.value=e.visit(this.value)},eval:function(e){return this.value.eval&&(this.value=this.value.eval(e)),this},toCSS:function(){return"alpha(opacity="+(this.value.toCSS?this.value.toCSS():this.value)+")"}}}(n("../tree")),function(e){e.Anonymous=function(e){this.value=e.value||e},e.Anonymous.prototype={type:"Anonymous",toCSS:function(){return this.value},eval:function(){return this},compare:function(e){if(!e.toCSS)return-1;var t=this.toCSS(),n=e.toCSS();return t===n?0:t<n?-1:1}}}(n("../tree")),function(e){e.Assignment=function(e,t){this.key=e,this.value=t},e.Assignment.prototype={type:"Assignment",accept:function(e){this.value=e.visit(this.value)},toCSS:function(){return this.key+"="+(this.value.toCSS?this.value.toCSS():this.value)},eval:function(t){return this.value.eval?new e.Assignment(this.key,this.value.eval(t)):this}}}(n("../tree")),function(e){e.Call=function(e,t,n,r){this.name=e,this.args=t,this.index=n,this.currentFileInfo=r},e.Call.prototype={type:"Call",accept:function(e){this.args=e.visit(this.args)},eval:function(t){var n=this.args.map(function(e){return e.eval(t)}),r=this.name.toLowerCase(),i,s;if(r in e.functions)try{s=new e.functionCall(t,this.currentFileInfo),i=s[r].apply(s,n);if(i!=null)return i}catch(o){throw{type:o.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(o.message?": "+o.message:""),index:this.index,filename:this.currentFileInfo.filename}}return new e.Anonymous(this.name+"("+n.map(function(e){return e.toCSS(t)}).join(", ")+")")},toCSS:function(e){return this.eval(e).toCSS()}}}(n("../tree")),function(e){e.Color=function(e,t){Array.isArray(e)?this.rgb=e:e.length==6?this.rgb=e.match(/.{2}/g).map(function(e){return parseInt(e,16)}):this.rgb=e.split("").map(function(e){return parseInt(e+e,16)}),this.alpha=typeof t=="number"?t:1},e.Color.prototype={type:"Color",eval:function(){return this},luma:function(){return.2126*this.rgb[0]/255+.7152*this.rgb[1]/255+.0722*this.rgb[2]/255},toCSS:function(e,t){var n=e&&e.compress&&!t;if(this.alpha<1)return"rgba("+this.rgb.map(function(e){return Math.round(e)}).concat(this.alpha).join(","+(n?"":" "))+")";var r=this.rgb.map(function(e){return e=Math.round(e),e=(e>255?255:e<0?0:e).toString(16),e.length===1?"0"+e:e}).join("");return n&&(r=r.split(""),r[0]==r[1]&&r[2]==r[3]&&r[4]==r[5]?r=r[0]+r[2]+r[4]:r=r.join("")),"#"+r},operate:function(t,n,r){var i=[];r instanceof e.Color||(r=r.toColor());for(var s=0;s<3;s++)i[s]=e.operate(t,n,this.rgb[s],r.rgb[s]);return new e.Color(i,this.alpha+r.alpha)},toHSL:function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,n=this.rgb[2]/255,r=this.alpha,i=Math.max(e,t,n),s=Math.min(e,t,n),o,u,a=(i+s)/2,f=i-s;if(i===s)o=u=0;else{u=a>.5?f/(2-i-s):f/(i+s);switch(i){case e:o=(t-n)/f+(t<n?6:0);break;case t:o=(n-e)/f+2;break;case n:o=(e-t)/f+4}o/=6}return{h:o*360,s:u,l:a,a:r}},toHSV:function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,n=this.rgb[2]/255,r=this.alpha,i=Math.max(e,t,n),s=Math.min(e,t,n),o,u,a=i,f=i-s;i===0?u=0:u=f/i;if(i===s)o=0;else{switch(i){case e:o=(t-n)/f+(t<n?6:0);break;case t:o=(n-e)/f+2;break;case n:o=(e-t)/f+4}o/=6}return{h:o*360,s:u,v:a,a:r}},toARGB:function(){var e=[Math.round(this.alpha*255)].concat(this.rgb);return"#"+e.map(function(e){return e=Math.round(e),e=(e>255?255:e<0?0:e).toString(16),e.length===1?"0"+e:e}).join("")},compare:function(e){return e.rgb?e.rgb[0]===this.rgb[0]&&e.rgb[1]===this.rgb[1]&&e.rgb[2]===this.rgb[2]&&e.alpha===this.alpha?0:-1:-1}}}(n("../tree")),function(e){e.Comment=function(e,t){this.value=e,this.silent=!!t},e.Comment.prototype={type:"Comment",toCSS:function(e){return e.compress?"":this.value},eval:function(){return this}}}(n("../tree")),function(e){e.Condition=function(e,t,n,r,i){this.op=e.trim(),this.lvalue=t,this.rvalue=n,this.index=r,this.negate=i},e.Condition.prototype={type:"Condition",accept:function(e){this.lvalue=e.visit(this.lvalue),this.rvalue=e.visit(this.rvalue)},eval:function(e){var t=this.lvalue.eval(e),n=this.rvalue.eval(e),r=this.index,i,i=function(e){switch(e){case"and":return t&&n;case"or":return t||n;default:if(t.compare)i=t.compare(n);else{if(!n.compare)throw{type:"Type",message:"Unable to perform comparison",index:r};i=n.compare(t)}switch(i){case-1:return e==="<"||e==="=<";case 0:return e==="="||e===">="||e==="=<";case 1:return e===">"||e===">="}}}(this.op);return this.negate?!i:i}}}(n("../tree")),function(e){e.Dimension=function(n,r){this.value=parseFloat(n),this.unit=r&&r instanceof e.Unit?r:new e.Unit(r?[r]:t)},e.Dimension.prototype={type:"Dimension",accept:function(e){this.unit=e.visit(this.unit)},eval:function(e){return this},toColor:function(){return new e.Color([this.value,this.value,this.value])},toCSS:function(e){if(e&&e.strictUnits&&!this.unit.isSingular())throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());var t=this.value,n=String(t);t!==0&&t<1e-6&&t>-0.000001&&(n=t.toFixed(20).replace(/0+$/,""));if(e&&e.compress){if(t===0&&!this.unit.isAngle())return n;t>0&&t<1&&(n=n.substr(1))}return n+this.unit.toCSS(e)},operate:function(t,n,r){var i=e.operate(t,n,this.value,r.value),s=this.unit.clone();if(n==="+"||n==="-"){if(s.numerator.length===0&&s.denominator.length===0)s.numerator=r.unit.numerator.slice(0),s.denominator=r.unit.denominator.slice(0);else if(r.unit.numerator.length!=0||s.denominator.length!=0){r=r.convertTo(this.unit.usedUnits());if(t.strictUnits&&r.unit.toString()!==s.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+s.toString()+"' and '"+r.unit.toString()+"'.");i=e.operate(t,n,this.value,r.value)}}else n==="*"?(s.numerator=s.numerator.concat(r.unit.numerator).sort(),s.denominator=s.denominator.concat(r.unit.denominator).sort(),s.cancel()):n==="/"&&(s.numerator=s.numerator.concat(r.unit.denominator).sort(),s.denominator=s.denominator.concat(r.unit.numerator).sort(),s.cancel());return new e.Dimension(i,s)},compare:function(t){if(t instanceof e.Dimension){var n=this.unify(),r=t.unify(),i=n.value,s=r.value;return s>i?-1:s<i?1:!r.unit.isEmpty()&&n.unit.compare(r.unit)!==0?-1:0}return-1},unify:function(){return this.convertTo({length:"m",duration:"s",angle:"rad"})},convertTo:function(t){var n=this.value,r=this.unit.clone(),i,s,o,u,a,f={};if(typeof t=="string"){for(i in e.UnitConversions)e.UnitConversions[i].hasOwnProperty(t)&&(f={},f[i]=t);t=f}for(s in t)t.hasOwnProperty(s)&&(a=t[s],o=e.UnitConversions[s],r.map(function(e,t){return o.hasOwnProperty(e)?(t?n/=o[e]/o[a]:n*=o[e]/o[a],a):e}));return r.cancel(),new e.Dimension(n,r)}},e.UnitConversions={length:{m:1,cm:.01,mm:.001,"in":.0254,pt:.0254/72,pc:.0254/72*12},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:.0025,turn:1}},e.Unit=function(e,t,n){this.numerator=e?e.slice(0).sort():[],this.denominator=t?t.slice(0).sort():[],this.backupUnit=n},e.Unit.prototype={type:"Unit",clone:function(){return new e.Unit(this.numerator.slice(0),this.denominator.slice(0),this.backupUnit)},toCSS:function(e){return this.numerator.length>=1?this.numerator[0]:this.denominator.length>=1?this.denominator[0]:(!e||!e.strictUnits)&&this.backupUnit?this.backupUnit:""},toString:function(){var e,t=this.numerator.join("*");for(e=0;e<this.denominator.length;e++)t+="/"+this.denominator[e];return t},compare:function(e){return this.is(e.toString())?0:-1},is:function(e){return this.toString()===e},isAngle:function(){return e.UnitConversions.angle.hasOwnProperty(this.toCSS())},isEmpty:function(){return this.numerator.length==0&&this.denominator.length==0},isSingular:function(){return this.numerator.length<=1&&this.denominator.length==0},map:function(e){var t;for(t=0;t<this.numerator.length;t++)this.numerator[t]=e(this.numerator[t],!1);for(t=0;t<this.denominator.length;t++)this.denominator[t]=e(this.denominator[t],!0)},usedUnits:function(){var t,n,r={};for(n in e.UnitConversions)e.UnitConversions.hasOwnProperty(n)&&(t=e.UnitConversions[n],this.map(function(e){return t.hasOwnProperty(e)&&!r[n]&&(r[n]=e),e}));return r},cancel:function(){var e={},t,n,r;for(n=0;n<this.numerator.length;n++)t=this.numerator[n],r||(r=t),e[t]=(e[t]||0)+1;for(n=0;n<this.denominator.length;n++)t=this.denominator[n],r||(r=t),e[t]=(e[t]||0)-1;this.numerator=[],this.denominator=[];for(t in e)if(e.hasOwnProperty(t)){var i=e[t];if(i>0)for(n=0;n<i;n++)this.numerator.push(t);else if(i<0)for(n=0;n<-i;n++)this.denominator.push(t)}this.numerator.length===0&&this.denominator.length===0&&r&&(this.backupUnit=r),this.numerator.sort(),this.denominator.sort()}}}(n("../tree")),function(e){e.Directive=function(t,n){this.name=t,Array.isArray(n)?(this.ruleset=new e.Ruleset([],n),this.ruleset.allowImports=!0):this.value=n},e.Directive.prototype={type:"Directive",accept:function(e){this.ruleset=e.visit(this.ruleset),this.value=e.visit(this.value)},toCSS:function(e){return this.ruleset?(this.ruleset.root=!0,this.name+(e.compress?"{":" {\n ")+this.ruleset.toCSS(e).trim().replace(/\n/g,"\n ")+(e.compress?"}":"\n}\n")):this.name+" "+this.value.toCSS()+";\n"},eval:function(t){var n=this;return this.ruleset&&(t.frames.unshift(this),n=new e.Directive(this.name),n.ruleset=this.ruleset.eval(t),t.frames.shift()),n},variable:function(t){return e.Ruleset.prototype.variable.call(this.ruleset,t)},find:function(){return e.Ruleset.prototype.find.apply(this.ruleset,arguments)},rulesets:function(){return e.Ruleset.prototype.rulesets.apply(this.ruleset)}}}(n("../tree")),function(e){e.Element=function(t,n,r){this.combinator=t instanceof e.Combinator?t:new e.Combinator(t),typeof n=="string"?this.value=n.trim():n?this.value=n:this.value="",this.index=r},e.Element.prototype={type:"Element",accept:function(e){this.combinator=e.visit(this.combinator),this.value=e.visit(this.value)},eval:function(t){return new e.Element(this.combinator,this.value.eval?this.value.eval(t):this.value,this.index)},toCSS:function(e){var t=this.value.toCSS?this.value.toCSS(e):this.value;return t==""&&this.combinator.value.charAt(0)=="&"?"":this.combinator.toCSS(e||{})+t}},e.Attribute=function(e,t,n){this.key=e,this.op=t,this.value=n},e.Attribute.prototype={type:"Attribute",accept:function(e){this.value=e.visit(this.value)},eval:function(t){return new e.Attribute(this.key.eval?this.key.eval(t):this.key,this.op,this.value&&this.value.eval?this.value.eval(t):this.value)},toCSS:function(e){var t=this.key.toCSS?this.key.toCSS(e):this.key;return this.op&&(t+=this.op,t+=this.value.toCSS?this.value.toCSS(e):this.value),"["+t+"]"}},e.Combinator=function(e){e===" "?this.value=" ":this.value=e?e.trim():""},e.Combinator.prototype={type:"Combinator",toCSS:function(e){return{"":""," ":" ",":":" :","+":e.compress?"+":" + ","~":e.compress?"~":" ~ ",">":e.compress?">":" > ","|":e.compress?"|":" | "}[this.value]}}}(n("../tree")),function(e){e.Expression=function(e){this.value=e},e.Expression.prototype={type:"Expression",accept:function(e){this.value=e.visit(this.value)},eval:function(t){var n,r=this.parens&&!this.parensInOp,i=!1;return r&&t.inParenthesis(),this.value.length>1?n=new e.Expression(this.value.map(function(e){return e.eval(t)})):this.value.length===1?(this.value[0].parens&&!this.value[0].parensInOp&&(i=!0),n=this.value[0].eval(t)):n=this,r&&t.outOfParenthesis(),this.parens&&this.parensInOp&&!t.isMathOn()&&!i&&(n=new e.Paren(n)),n},toCSS:function(e){return this.value.map(function(t){return t.toCSS?t.toCSS(e):""}).join(" ")},throwAwayComments:function(){this.value=this.value.filter(function(t){return!(t instanceof e.Comment)})}}}(n("../tree")),function(e){e.Extend=function(t,n,r){this.selector=t,this.option=n,this.index=r;switch(n){case"all":this.allowBefore=!0,this.allowAfter=!0;break;default:this.allowBefore=!1,this.allowAfter=!1}},e.Extend.prototype={type:"Extend",accept:function(e){this.selector=e.visit(this.selector)},eval:function(t){return new e.Extend(this.selector.eval(t),this.option,this.index)},clone:function(t){return new e.Extend(this.selector,this.option,this.index)},findSelfSelectors:function(e){var t=[],n;for(n=0;n<e.length;n++)t=t.concat(e[n].elements);this.selfSelectors=[{elements:t}]}}}(n("../tree")),function(e){e.Import=function(e,n,r,i,s){var o=this;this.options=r,this.index=i,this.path=e,this.features=n,this.currentFileInfo=s;if(this.options.less!==t)this.css=!this.options.less;else{var u=this.getPath();u&&/css([\?;].*)?$/.test(u)&&(this.css=!0)}},e.Import.prototype={type:"Import",accept:function(e){this.features=e.visit(this.features),this.path=e.visit(this.path),this.root=e.visit(this.root)},toCSS:function(e){var t=this.features?" "+this.features.toCSS(e):"";return this.css?"@import "+this.path.toCSS()+t+";\n":""},getPath:function(){if(this.path instanceof e.Quoted){var n=this.path.value;return this.css!==t||/(\.[a-z]*$)|([\?;].*)$/.test(n)?n:n+".less"}return this.path instanceof e.URL?this.path.value.value:null},evalForImport:function(t){return new e.Import(this.path.eval(t),this.features,this.options,this.index,this.currentFileInfo)},evalPath:function(t){var n=this.path.eval(t),r=this.currentFileInfo&&this.currentFileInfo.rootpath;if(r&&!(n instanceof e.URL)){var i=n.value;i&&t.isPathRelative(i)&&(n.value=r+i)}return n},eval:function(t){var n,r=this.features&&this.features.eval(t);if(this.skip)return[];if(this.css){var i=new e.Import(this.evalPath(t),r,this.options,this.index);if(!i.css&&this.error)throw this.error;return i}return n=new e.Ruleset([],this.root.rules.slice(0)),n.evalImports(t),this.features?new e.Media(n.rules,this.features.value):n.rules}}}(n("../tree")),function(e){e.JavaScript=function(e,t,n){this.escaped=n,this.expression=e,this.index=t},e.JavaScript.prototype={type:"JavaScript",eval:function(t){var n,r=this,i={},s=this.expression.replace(/@\{([\w-]+)\}/g,function(n,i){return e.jsify((new e.Variable("@"+i,r.index)).eval(t))});try{s=new Function("return ("+s+")")}catch(o){throw{message:"JavaScript evaluation error: `"+s+"`",index:this.index}}for(var u in t.frames[0].variables())i[u.slice(1)]={value:t.frames[0].variables()[u].value,toJS:function(){return this.value.eval(t).toCSS()}};try{n=s.call(i)}catch(o){throw{message:"JavaScript evaluation error: '"+o.name+": "+o.message+"'",index:this.index}}return typeof n=="string"?new e.Quoted('"'+n+'"',n,this.escaped,this.index):Array.isArray(n)?new e.Anonymous(n.join(", ")):new e.Anonymous(n)}}}(n("../tree")),function(e){e.Keyword=function(e){this.value=e},e.Keyword.prototype={type:"Keyword",eval:function(){return this},toCSS:function(){return this.value},compare:function(t){return t instanceof e.Keyword?t.value===this.value?0:1:-1}},e.True=new e.Keyword("true"),e.False=new e.Keyword("false")}(n("../tree")),function(e){e.Media=function(t,n){var r=this.emptySelectors();this.features=new e.Value(n),this.ruleset=new e.Ruleset(r,t),this.ruleset.allowImports=!0},e.Media.prototype={type:"Media",accept:function(e){this.features=e.visit(this.features),this.ruleset=e.visit(this.ruleset)},toCSS:function(e){var t=this.features.toCSS(e);return"@media "+t+(e.compress?"{":" {\n ")+this.ruleset.toCSS(e).trim().replace(/\n/g,"\n ")+(e.compress?"}":"\n}\n")},eval:function(t){t.mediaBlocks||(t.mediaBlocks=[],t.mediaPath=[]);var n=new e.Media([],[]);this.debugInfo&&(this.ruleset.debugInfo=this.debugInfo,n.debugInfo=this.debugInfo);var r=!1;t.strictMath||(r=!0,t.strictMath=!0);try{n.features=this.features.eval(t)}finally{r&&(t.strictMath=!1)}return t.mediaPath.push(n),t.mediaBlocks.push(n),t.frames.unshift(this.ruleset),n.ruleset=this.ruleset.eval(t),t.frames.shift(),t.mediaPath.pop(),t.mediaPath.length===0?n.evalTop(t):n.evalNested(t)},variable:function(t){return e.Ruleset.prototype.variable.call(this.ruleset,t)},find:function(){return e.Ruleset.prototype.find.apply(this.ruleset,arguments)},rulesets:function(){return e.Ruleset.prototype.rulesets.apply(this.ruleset)},emptySelectors:function(){var t=new e.Element("","&",0);return[new e.Selector([t])]},evalTop:function(t){var n=this;if(t.mediaBlocks.length>1){var r=this.emptySelectors();n=new e.Ruleset(r,t.mediaBlocks),n.multiMedia=!0}return delete t.mediaBlocks,delete t.mediaPath,n},evalNested:function(t){var n,r,i=t.mediaPath.concat([this]);for(n=0;n<i.length;n++)r=i[n].features instanceof e.Value?i[n].features.value:i[n].features,i[n]=Array.isArray(r)?r:[r];return this.features=new e.Value(this.permute(i).map(function(t){t=t.map(function(t){return t.toCSS?t:new e.Anonymous(t)});for(n=t.length-1;n>0;n--)t.splice(n,0,new e.Anonymous("and"));return new e.Expression(t)})),new e.Ruleset([],[])},permute:function(e){if(e.length===0)return[];if(e.length===1)return e[0];var t=[],n=this.permute(e.slice(1));for(var r=0;r<n.length;r++)for(var i=0;i<e[0].length;i++)t.push([e[0][i]].concat(n[r]));return t},bubbleSelectors:function(t){this.ruleset=new e.Ruleset(t.slice(0),[this.ruleset])}}}(n("../tree")),function(e){e.mixin={},e.mixin.Call=function(t,n,r,i,s){this.selector=new e.Selector(t),this.arguments=n,this.index=r,this.currentFileInfo=i,this.important=s},e.mixin.Call.prototype={type:"MixinCall",accept:function(e){this.selector=e.visit(this.selector),this.arguments=e.visit(this.arguments)},eval:function(t){var n,r,i,s=[],o=!1,u,a,f,l,c;i=this.arguments&&this.arguments.map(function(e){return{name:e.name,value:e.value.eval(t)}});for(u=0;u<t.frames.length;u++)if((n=t.frames[u].find(this.selector)).length>0){c=!0;for(a=0;a<n.length;a++){r=n[a],l=!1;for(f=0;f<t.frames.length;f++)if(!(r instanceof e.mixin.Definition)&&r===(t.frames[f].originalRuleset||t.frames[f])){l=!0;break}if(l)continue;if(r.matchArgs(i,t)){if(!r.matchCondition||r.matchCondition(i,t))try{Array.prototype.push.apply(s,r.eval(t,i,this.important).rules)}catch(h){throw{message:h.message,index:this.index,filename:this.currentFileInfo.filename,stack:h.stack}}o=!0}}if(o)return s}throw c?{type:"Runtime",message:"No matching definition was found for `"+this.selector.toCSS().trim()+"("+(i?i.map(function(e){var t="";return e.name&&(t+=e.name+":"),e.value.toCSS?t+=e.value.toCSS():t+="???",t}).join(", "):"")+")`",index:this.index,filename:this.currentFileInfo.filename}:{type:"Name",message:this.selector.toCSS().trim()+" is undefined",index:this.index,filename:this.currentFileInfo.filename}}},e.mixin.Definition=function(t,n,r,i,s){this.name=t,this.selectors=[new e.Selector([new e.Element(null,t)])],this.params=n,this.condition=i,this.variadic=s,this.arity=n.length,this.rules=r,this._lookups={},this.required=n.reduce(function(e,t){return!t.name||t.name&&!t.value?e+1:e},0),this.parent=e.Ruleset.prototype,this.frames=[]},e.mixin.Definition.prototype={type:"MixinDefinition",accept:function(e){this.params=e.visit(this.params),this.rules=e.visit(this.rules),this.condition=e.visit(this.condition)},toCSS:function(){return""},variable:function(e){return this.parent.variable.call(this,e)},variables:function(){return this.parent.variables.call(this)},find:function(){return this.parent.find.apply(this,arguments)},rulesets:function(){return this.parent.rulesets.apply(this)},evalParams:function(t,n,r,i){var s=new e.Ruleset(null,[]),o,u,a=this.params.slice(0),f,l,c,h,p,d;n=new e.evalEnv(n,[s].concat(n.frames));if(r){r=r.slice(0);for(f=0;f<r.length;f++){u=r[f];if(h=u&&u.name){p=!1;for(l=0;l<a.length;l++)if(!i[l]&&h===a[l].name){i[l]=u.value.eval(t),s.rules.unshift(new e.Rule(h,u.value.eval(t))),p=!0;break}if(p){r.splice(f,1),f--;continue}throw{type:"Runtime",message:"Named argument for "+this.name+" "+r[f].name+" not found"}}}}d=0;for(f=0;f<a.length;f++){if(i[f])continue;u=r&&r[d];if(h=a[f].name)if(a[f].variadic&&r){o=[];for(l=d;l<r.length;l++)o.push(r[l].value.eval(t));s.rules.unshift(new e.Rule(h,(new e.Expression(o)).eval(t)))}else{c=u&&u.value;if(c)c=c.eval(t);else{if(!a[f].value)throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+r.length+" for "+this.arity+")"};c=a[f].value.eval(n),s.resetCache()}s.rules.unshift(new e.Rule(h,c)),i[f]=c}if(a[f].variadic&&r)for(l=d;l<r.length;l++)i[l]=r[l].value.eval(t);d++}return s},eval:function(t,n,r){var i=[],s=this.frames.concat(t.frames),o=this.evalParams(t,new e.evalEnv(t,s),n,i),u,a,f,l;return o.rules.unshift(new e.Rule("@arguments",(new e.Expression(i)).eval(t))),a=r?this.parent.makeImportant.apply(this).rules:this.rules.slice(0),l=(new e.Ruleset(null,a)).eval(new e.evalEnv(t,[this,o].concat(s))),l.originalRuleset=this,l},matchCondition:function(t,n){return this.condition&&!this.condition.eval(new e.evalEnv(n,[this.evalParams(n,new e.evalEnv(n,this.frames.concat(n.frames)),t,[])].concat(n.frames)))?!1:!0},matchArgs:function(e,t){var n=e&&e.length||0,r,i;if(!this.variadic){if(n<this.required)return!1;if(n>this.params.length)return!1;if(this.required>0&&n>this.params.length)return!1}r=Math.min(n,this.arity);for(var s=0;s<r;s++)if(!this.params[s].name&&!this.params[s].variadic&&e[s].value.eval(t).toCSS()!=this.params[s].value.eval(t).toCSS())return!1;return!0}}}(n("../tree")),function(e){e.Negative=function(e){this.value=e},e.Negative.prototype={type:"Negative",accept:function(e){this.value=e.visit(this.value)},toCSS:function(e){return"-"+this.value.toCSS(e)},eval:function(t){return t.isMathOn()?(new e.Operation("*",[new e.Dimension(-1),this.value])).eval(t):new e.Negative(this.value.eval(t))}}}(n("../tree")),function(e){e.Operation=function(e,t,n){this.op=e.trim(),this.operands=t,this.isSpaced=n},e.Operation.prototype={type:"Operation",accept:function(e){this.operands=e.visit(this.operands)},eval:function(t){var n=this.operands[0].eval(t),r=this.operands[1].eval(t),i;if(t.isMathOn()){if(n instanceof e.Dimension&&r instanceof e.Color){if(this.op!=="*"&&this.op!=="+")throw{type:"Operation",message:"Can't substract or divide a color from a number"};i=r,r=n,n=i}if(!n.operate)throw{type:"Operation",message:"Operation on an invalid type"};return n.operate(t,this.op,r)}return new e.Operation(this.op,[n,r],this.isSpaced)},toCSS:function(e){var t=this.isSpaced?" ":"";return this.operands[0].toCSS()+t+this.op+t+this.operands[1].toCSS()}},e.operate=function(e,t,n,r){switch(t){case"+":return n+r;case"-":return n-r;case"*":return n*r;case"/":return n/r}}}(n("../tree")),function(e){e.Paren=function(e){this.value=e},e.Paren.prototype={type:"Paren",accept:function(e){this.value=e.visit(this.value)},toCSS:function(e){return"("+this.value.toCSS(e).trim()+")"},eval:function(t){return new e.Paren(this.value.eval(t))}}}(n("../tree")),function(e){e.Quoted=function(e,t,n,r,i){this.escaped=n,this.value=t||"",this.quote=e.charAt(0),this.index=r,this.currentFileInfo=i},e.Quoted.prototype={type:"Quoted",toCSS:function(){return this.escaped?this.value:this.quote+this.value+this.quote},eval:function(t){var n=this,r=this.value.replace(/`([^`]+)`/g,function(r,i){return(new e.JavaScript(i,n.index,!0)).eval(t).value}).replace(/@\{([\w-]+)\}/g,function(r,i){var s=(new e.Variable("@"+i,n.index,n.currentFileInfo)).eval(t,!0);return s instanceof e.Quoted?s.value:s.toCSS()});return new e.Quoted(this.quote+r+this.quote,r,this.escaped,this.index)},compare:function(e){if(!e.toCSS)return-1;var t=this.toCSS(),n=e.toCSS();return t===n?0:t<n?-1:1}}}(n("../tree")),function(e){e.Rule=function(t,n,r,i,s,o){this.name=t,this.value=n instanceof e.Value?n:new e.Value([n]),this.important=r?" "+r.trim():"",this.index=i,this.currentFileInfo=s,this.inline=o||!1,t.charAt(0)==="@"?this.variable=!0:this.variable=!1},e.Rule.prototype={type:"Rule",accept:function(e){this.value=e.visit(this.value)},toCSS:function(e){if(this.variable)return"";try{return this.name+(e.compress?":":": ")+this.value.toCSS(e)+this.important+(this.inline?"":";")}catch(t){throw t.index=this.index,t.filename=this.currentFileInfo.filename,t}},eval:function(t){var n=!1;this.name==="font"&&t.strictMath===!1&&(n=!0,t.strictMath=!0);try{return new e.Rule(this.name,this.value.eval(t),this.important,this.index,this.currentFileInfo,this.inline)}finally{n&&(t.strictMath=!1)}},makeImportant:function(){return new e.Rule(this.name,this.value,"!important",this.index,this.currentFileInfo,this.inline)}}}(n("../tree")),function(e){e.Ruleset=function(e,t,n){this.selectors=e,this.rules=t,this._lookups={},this.strictImports=n},e.Ruleset.prototype={type:"Ruleset",accept:function(e){this.selectors=e.visit(this.selectors),this.rules=e.visit(this.rules)},eval:function(t){var n=this.selectors&&this.selectors.map(function(e){return e.eval(t)}),r=new e.Ruleset(n,this.rules.slice(0),this.strictImports),i;r.originalRuleset=this,r.root=this.root,r.firstRoot=this.firstRoot,r.allowImports=this.allowImports,this.debugInfo&&(r.debugInfo=this.debugInfo),t.frames.unshift(r),t.selectors||(t.selectors=[]),t.selectors.unshift(this.selectors),(r.root||r.allowImports||!r.strictImports)&&r.evalImports(t);for(var s=0;s<r.rules.length;s++)r.rules[s]instanceof e.mixin.Definition&&(r.rules[s].frames=t.frames.slice(0));var o=t.mediaBlocks&&t.mediaBlocks.length||0;for(var s=0;s<r.rules.length;s++)r.rules[s]instanceof e.mixin.Call&&(i=r.rules[s].eval(t).filter(function(t){return t instanceof e.Rule&&t.variable?!r.variable(t.name):!0}),r.rules.splice.apply(r.rules,[s,1].concat(i)),s+=i.length-1,r.resetCache());for(var s=0,u;s<r.rules.length;s++)u=r.rules[s],u instanceof e.mixin.Definition||(r.rules[s]=u.eval?u.eval(t):u);t.frames.shift(),t.selectors.shift();if(t.mediaBlocks)for(var s=o;s<t.mediaBlocks.length;s++)t.mediaBlocks[s].bubbleSelectors(n);return r},evalImports:function(t){var n,r;for(n=0;n<this.rules.length;n++)this.rules[n]instanceof e.Import&&(r=this.rules[n].eval(t),typeof r.length=="number"?(this.rules.splice.apply(this.rules,[n,1].concat(r)),n+=r.length-1):this.rules.splice(n,1,r),this.resetCache())},makeImportant:function(){return new e.Ruleset(this.selectors,this.rules.map(function(e){return e.makeImportant?e.makeImportant():e}),this.strictImports)},matchArgs:function(e){return!e||e.length===0},resetCache:function(){this._rulesets=null,this._variables=null,this._lookups={}},variables:function(){return this._variables?this._variables:this._variables=this.rules.reduce(function(t,n){return n instanceof e.Rule&&n.variable===!0&&(t[n.name]=n),t},{})},variable:function(e){return this.variables()[e]},rulesets:function(){return this.rules.filter(function(t){return t instanceof e.Ruleset||t instanceof e.mixin.Definition})},find:function(t,n){n=n||this;var r=[],i,s,o=t.toCSS();return o in this._lookups?this._lookups[o]:(this.rulesets().forEach(function(i){if(i!==n)for(var o=0;o<i.selectors.length;o++)if(s=t.match(i.selectors[o])){t.elements.length>i.selectors[o].elements.length?Array.prototype.push.apply(r,i.find(new e.Selector(t.elements.slice(1)),n)):r.push(i);break}}),this._lookups[o]=r)},toCSS:function(t){var n=[],r=[],i=[],s=[],o,u,a;for(var f=0;f<this.rules.length;f++){a=this.rules[f];if(a.rules||a instanceof e.Media)s.push(a.toCSS(t));else if(a instanceof e.Directive){var l=a.toCSS(t);if(a.name==="@charset"){if(t.charset){a.debugInfo&&(s.push(e.debugInfo(t,a)),s.push((new e.Comment("/* "+l.replace(/\n/g,"")+" */\n")).toCSS(t)));continue}t.charset=!0}s.push(l)}else if(a instanceof e.Comment)a.silent||(this.root?s.push(a.toCSS(t)):r.push(a.toCSS(t)));else if(a.toCSS&&!a.variable){if(this.firstRoot&&a instanceof e.Rule)throw{message:"properties must be inside selector blocks, they cannot be in the root.",index:a.index,filename:a.currentFileInfo?a.currentFileInfo.filename:null};r.push(a.toCSS(t))}else a.value&&!a.variable&&r.push(a.value.toString())}t.compress&&r.length&&(a=r[r.length-1],a.charAt(a.length-1)===";"&&(r[r.length-1]=a.substring(0,a.length-1))),s=s.join("");if(this.root)n.push(r.join(t.compress?"":"\n"));else if(r.length>0){u=e.debugInfo(t,this),o=this.paths.map(function(e){return e.map(function(e){return e.toCSS(t)}).join("").trim()}).join(t.compress?",":",\n");for(var f=r.length-1;f>=0;f--)(r[f].slice(0,2)==="/*"||i.indexOf(r[f])===-1)&&i.unshift(r[f]);r=i,n.push(u+o+(t.compress?"{":" {\n ")+r.join(t.compress?"":"\n ")+(t.compress?"}":"\n}\n"))}return n.push(s),n.join("")+(t.compress?"\n":"")},joinSelectors:function(e,t,n){for(var r=0;r<n.length;r++)this.joinSelector(e,t,n[r])},joinSelector:function(t,n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g,y;for(i=0;i<r.elements.length;i++)f=r.elements[i],f.value==="&"&&(u=!0);if(!u){if(n.length>0)for(i=0;i<n.length;i++)t.push(n[i].concat(r));else t.push([r]);return}g=[],a=[[]];for(i=0;i<r.elements.length;i++){f=r.elements[i];if(f.value!=="&")g.push(f);else{y=[],g.length>0&&this.mergeElementsOnToSelectors(g,a);for(s=0;s<a.length;s++){l=a[s];if(n.length==0)l.length>0&&(l[0].elements=l[0].elements.slice(0),l[0].elements.push(new e.Element(f.combinator,"",0))),y.push(l);else for(o=0;o<n.length;o++)c=n[o],h=[],p=[],v=!0,l.length>0?(h=l.slice(0),m=h.pop(),d=new e.Selector(m.elements.slice(0),r.extendList),v=!1):d=new e.Selector([],r.extendList),c.length>1&&(p=p.concat(c.slice(1))),c.length>0&&(v=!1,d.elements.push(new e.Element(f.combinator,c[0].elements[0].value,0)),d.elements=d.elements.concat(c[0].elements.slice(1))),v||h.push(d),h=h.concat(p),y.push(h)}a=y,g=[]}}g.length>0&&this.mergeElementsOnToSelectors(g,a);for(i=0;i<a.length;i++)a[i].length>0&&t.push(a[i])},mergeElementsOnToSelectors:function(t,n){var r,i,s;if(n.length==0){n.push([new e.Selector(t)]);return}for(r=0;r<n.length;r++)i=n[r],i.length>0?i[i.length-1]=new e.Selector(i[i.length-1].elements.concat(t),i[i.length-1].extendList):i.push(new e.Selector(t))}}}(n("../tree")),function(e){e.Selector=function(e,t){this.elements=e,this.extendList=t||[]},e.Selector.prototype={type:"Selector",accept:function(e){this.elements=e.visit(this.elements),this.extendList=e.visit(this.extendList)},match:function(e){var t=this.elements,n=t.length,r,i,s,o;r=e.elements.slice(e.elements.length&&e.elements[0].value==="&"?1:0),i=r.length,s=Math.min(n,i);if(i===0||n<i)return!1;for(o=0;o<s;o++)if(t[o].value!==r[o].value)return!1;return!0},eval:function(t){return new e.Selector(this.elements.map(function(e){return e.eval(t)}),this.extendList.map(function(e){return e.eval(t)}))},toCSS:function(e){return this._css?this._css:(this.elements[0].combinator.value===""?this._css=" ":this._css="",this._css+=this.elements.map(function(t){return typeof t=="string"?" "+t.trim():t.toCSS(e)}).join(""),this._css)}}}(n("../tree")),function(e){e.UnicodeDescriptor=function(e){this.value=e},e.UnicodeDescriptor.prototype={type:"UnicodeDescriptor",toCSS:function(e){return this.value},eval:function(){return this}
}}(n("../tree")),function(e){e.URL=function(e,t){this.value=e,this.currentFileInfo=t},e.URL.prototype={type:"Url",accept:function(e){this.value=e.visit(this.value)},toCSS:function(){return"url("+this.value.toCSS()+")"},eval:function(t){var n=this.value.eval(t),r;return r=this.currentFileInfo&&this.currentFileInfo.rootpath,r&&typeof n.value=="string"&&t.isPathRelative(n.value)&&(n.quote||(r=r.replace(/[\(\)'"\s]/g,function(e){return"\\"+e})),n.value=r+n.value),new e.URL(n,null)}}}(n("../tree")),function(e){e.Value=function(e){this.value=e},e.Value.prototype={type:"Value",accept:function(e){this.value=e.visit(this.value)},eval:function(t){return this.value.length===1?this.value[0].eval(t):new e.Value(this.value.map(function(e){return e.eval(t)}))},toCSS:function(e){return this.value.map(function(t){return t.toCSS(e)}).join(e.compress?",":", ")}}}(n("../tree")),function(e){e.Variable=function(e,t,n){this.name=e,this.index=t,this.currentFileInfo=n},e.Variable.prototype={type:"Variable",eval:function(t){var n,r,i=this.name;i.indexOf("@@")==0&&(i="@"+(new e.Variable(i.slice(1))).eval(t).value);if(this.evaluating)throw{type:"Name",message:"Recursive variable definition for "+i,filename:this.currentFileInfo.file,index:this.index};this.evaluating=!0;if(n=e.find(t.frames,function(e){if(r=e.variable(i))return r.value.eval(t)}))return this.evaluating=!1,n;throw{type:"Name",message:"variable "+i+" is undefined",filename:this.currentFileInfo.filename,index:this.index}}}}(n("../tree")),function(e){e.debugInfo=function(t,n){var r="";if(t.dumpLineNumbers&&!t.compress)switch(t.dumpLineNumbers){case"comments":r=e.debugInfo.asComment(n);break;case"mediaquery":r=e.debugInfo.asMediaQuery(n);break;case"all":r=e.debugInfo.asComment(n)+e.debugInfo.asMediaQuery(n)}return r},e.debugInfo.asComment=function(e){return"/* line "+e.debugInfo.lineNumber+", "+e.debugInfo.fileName+" */\n"},e.debugInfo.asMediaQuery=function(e){return"@media -sass-debug-info{filename{font-family:"+("file://"+e.debugInfo.fileName).replace(/([.:/\\])/g,function(e){return e=="\\"&&(e="/"),"\\"+e})+"}line{font-family:\\00003"+e.debugInfo.lineNumber+"}}\n"},e.find=function(e,t){for(var n=0,r;n<e.length;n++)if(r=t.call(e,e[n]))return r;return null},e.jsify=function(e){return Array.isArray(e.value)&&e.value.length>1?"["+e.value.map(function(e){return e.toCSS(!1)}).join(", ")+"]":e.toCSS(!1)}}(n("./tree")),function(e){var t=["paths","optimization","files","contents","relativeUrls","strictImports","dumpLineNumbers","compress","processImports","syncImport","mime","currentFileInfo"];e.parseEnv=function(e){r(e,this,t),this.contents||(this.contents={}),this.files||(this.files={});if(!this.currentFileInfo){var n=e&&e.filename||"input",i=n.replace(/[^\/\\]*$/,"");e&&(e.filename=null),this.currentFileInfo={filename:n,relativeUrls:this.relativeUrls,rootpath:e&&e.rootpath||"",currentDirectory:i,entryPath:i,rootFilename:n}}},e.parseEnv.prototype.toSheet=function(t){var n=new e.parseEnv(this);return n.href=t,n.type=this.mime,n};var n=["silent","verbose","compress","yuicompress","ieCompat","strictMath","strictUnits"];e.evalEnv=function(e,t){r(e,this,n),this.frames=t||[]},e.evalEnv.prototype.inParenthesis=function(){this.parensStack||(this.parensStack=[]),this.parensStack.push(!0)},e.evalEnv.prototype.outOfParenthesis=function(){this.parensStack.pop()},e.evalEnv.prototype.isMathOn=function(){return this.strictMath?this.parensStack&&this.parensStack.length:!0},e.evalEnv.prototype.isPathRelative=function(e){return!/^(?:[a-z-]+:|\/)/.test(e)};var r=function(e,t,n){if(!e)return;for(var r=0;r<n.length;r++)e.hasOwnProperty(n[r])&&(t[n[r]]=e[n[r]])}}(n("./tree")),function(e){e.visitor=function(e){this._implementation=e},e.visitor.prototype={visit:function(e){if(e instanceof Array)return this.visitArray(e);if(!e||!e.type)return e;var t="visit"+e.type,n=this._implementation[t],r,i;return n&&(r={visitDeeper:!0},i=n.call(this._implementation,e,r),this._implementation.isReplacing&&(e=i)),(!r||r.visitDeeper)&&e&&e.accept&&e.accept(this),t+="Out",this._implementation[t]&&this._implementation[t](e),e},visitArray:function(e){var t,n=[];for(t=0;t<e.length;t++){var r=this.visit(e[t]);r instanceof Array?n=n.concat(r):n.push(r)}return this._implementation.isReplacing?n:e}}}(n("./tree")),function(e){e.importVisitor=function(t,n,r){this._visitor=new e.visitor(this),this._importer=t,this._finish=n,this.env=r||new e.evalEnv,this.importCount=0},e.importVisitor.prototype={isReplacing:!0,run:function(e){var t;try{this._visitor.visit(e)}catch(n){t=n}this.isFinished=!0,this.importCount===0&&this._finish(t)},visitImport:function(t,n){var r=this,i;if(!t.css){try{i=t.evalForImport(this.env)}catch(s){s.filename||(s.index=t.index,s.filename=t.currentFileInfo.filename),t.css=!0,t.error=s}if(i&&!i.css){t=i,this.importCount++;var o=new e.evalEnv(this.env,this.env.frames.slice(0));this._importer.push(t.getPath(),t.currentFileInfo,function(n,i,s){n&&!n.filename&&(n.index=t.index,n.filename=t.currentFileInfo.filename),s&&!t.options.multiple&&(t.skip=s);var u=function(e){r.importCount--,r.importCount===0&&r.isFinished&&r._finish(e)};i?(t.root=i,(new e.importVisitor(r._importer,u,o)).run(i)):u()})}}return n.visitDeeper=!1,t},visitRule:function(e,t){return t.visitDeeper=!1,e},visitDirective:function(e,t){return this.env.frames.unshift(e),e},visitDirectiveOut:function(e){this.env.frames.shift()},visitMixinDefinition:function(e,t){return this.env.frames.unshift(e),e},visitMixinDefinitionOut:function(e){this.env.frames.shift()},visitRuleset:function(e,t){return this.env.frames.unshift(e),e},visitRulesetOut:function(e){this.env.frames.shift()},visitMedia:function(e,t){return this.env.frames.unshift(e.ruleset),e},visitMediaOut:function(e){this.env.frames.shift()}}}(n("./tree")),function(e){e.joinSelectorVisitor=function(){this.contexts=[[]],this._visitor=new e.visitor(this)},e.joinSelectorVisitor.prototype={run:function(e){return this._visitor.visit(e)},visitRule:function(e,t){t.visitDeeper=!1},visitMixinDefinition:function(e,t){t.visitDeeper=!1},visitRuleset:function(e,t){var n=this.contexts[this.contexts.length-1],r=[];this.contexts.push(r),e.root||(e.joinSelectors(r,n,e.selectors),e.paths=r)},visitRulesetOut:function(e){this.contexts.length=this.contexts.length-1},visitMedia:function(e,t){var n=this.contexts[this.contexts.length-1];e.ruleset.root=n.length===0||n[0].multiMedia}}}(n("./tree")),function(e){e.extendFinderVisitor=function(){this._visitor=new e.visitor(this),this.contexts=[],this.allExtendsStack=[[]]},e.extendFinderVisitor.prototype={run:function(e){return e=this._visitor.visit(e),e.allExtends=this.allExtendsStack[0],e},visitRule:function(e,t){t.visitDeeper=!1},visitMixinDefinition:function(e,t){t.visitDeeper=!1},visitRuleset:function(t,n){if(t.root)return;var r,i,s,o=[],u;for(r=0;r<t.rules.length;r++)t.rules[r]instanceof e.Extend&&o.push(t.rules[r]);for(r=0;r<t.paths.length;r++){var a=t.paths[r],f=a[a.length-1];u=f.extendList.slice(0).concat(o).map(function(e){return e.clone()});for(i=0;i<u.length;i++)this.foundExtends=!0,s=u[i],s.findSelfSelectors(a),s.ruleset=t,i===0&&(s.firstExtendOnThisSelectorPath=!0),this.allExtendsStack[this.allExtendsStack.length-1].push(s)}this.contexts.push(t.selectors)},visitRulesetOut:function(e){e.root||(this.contexts.length=this.contexts.length-1)},visitMedia:function(e,t){e.allExtends=[],this.allExtendsStack.push(e.allExtends)},visitMediaOut:function(e){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(e,t){e.allExtends=[],this.allExtendsStack.push(e.allExtends)},visitDirectiveOut:function(e){this.allExtendsStack.length=this.allExtendsStack.length-1}},e.processExtendsVisitor=function(){this._visitor=new e.visitor(this)},e.processExtendsVisitor.prototype={run:function(t){var n=new e.extendFinderVisitor;return n.run(t),n.foundExtends?(t.allExtends=t.allExtends.concat(this.doExtendChaining(t.allExtends,t.allExtends)),this.allExtendsStack=[t.allExtends],this._visitor.visit(t)):t},doExtendChaining:function(t,n,r){var i,s,o,u=[],a,f=this,l,c,h,p;r=r||0;for(i=0;i<t.length;i++)for(s=0;s<n.length;s++){c=t[i],h=n[s];if(this.inInheritanceChain(h,c))continue;l=[h.selfSelectors[0]],o=f.findMatch(c,l),o.length&&c.selfSelectors.forEach(function(t){a=f.extendSelector(o,l,t),p=new e.Extend(h.selector,h.option,0),p.selfSelectors=a,a[a.length-1].extendList=[p],u.push(p),p.ruleset=h.ruleset,p.parents=[h,c],h.firstExtendOnThisSelectorPath&&(p.firstExtendOnThisSelectorPath=!0,h.ruleset.paths.push(a))})}if(u.length){this.extendChainCount++;if(r>100){var d="{unable to calculate}",v="{unable to calculate}";try{d=u[0].selfSelectors[0].toCSS(),v=u[0].selector.toCSS()}catch(m){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+d+":extend("+v+")"}}return u.concat(f.doExtendChaining(u,n,r+1))}return u},inInheritanceChain:function(e,t){if(e===t)return!0;if(t.parents){if(this.inInheritanceChain(e,t.parents[0]))return!0;if(this.inInheritanceChain(e,t.parents[1]))return!0}return!1},visitRule:function(e,t){t.visitDeeper=!1},visitMixinDefinition:function(e,t){t.visitDeeper=!1},visitSelector:function(e,t){t.visitDeeper=!1},visitRuleset:function(e,t){if(e.root)return;var n,r,i,s=this.allExtendsStack[this.allExtendsStack.length-1],o=[],u=this,a;for(i=0;i<s.length;i++)for(r=0;r<e.paths.length;r++){a=e.paths[r];if(a[a.length-1].extendList.length)continue;n=this.findMatch(s[i],a),n.length&&s[i].selfSelectors.forEach(function(e){o.push(u.extendSelector(n,a,e))})}e.paths=e.paths.concat(o)},findMatch:function(e,t){var n,r,i,s,o,u,a=this,f=e.selector.elements,l=[],c,h=[];for(n=0;n<t.length;n++){r=t[n];for(i=0;i<r.elements.length;i++){s=r.elements[i],(e.allowBefore||n==0&&i==0)&&l.push({pathIndex:n,index:i,matched:0,initialCombinator:s.combinator});for(u=0;u<l.length;u++)c=l[u],o=s.combinator.value,o==""&&i===0&&(o=" "),!a.isElementValuesEqual(f[c.matched].value,s.value)||c.matched>0&&f[c.matched].combinator.value!==o?c=null:c.matched++,c&&(c.finished=c.matched===f.length,c.finished&&!e.allowAfter&&(i+1<r.elements.length||n+1<t.length)&&(c=null)),c?c.finished&&(c.length=f.length,c.endPathIndex=n,c.endPathElementIndex=i+1,l.length=0,h.push(c)):(l.splice(u,1),u--)}}return h},isElementValuesEqual:function(t,n){if(typeof t=="string"||typeof n=="string")return t===n;if(t instanceof e.Attribute)return t.op!==n.op||t.key!==n.key?!1:!t.value||!n.value?t.value||n.value?!1:!0:(t=t.value.value||t.value,n=n.value.value||n.value,t===n);return!1},extendSelector:function(t,n,r){var i=0,s=0,o=[],u,a,f,l;for(u=0;u<t.length;u++)l=t[u],a=n[l.pathIndex],f=new e.Element(l.initialCombinator,r.elements[0].value,r.elements[0].index),l.pathIndex>i&&s>0&&(o[o.length-1].elements=o[o.length-1].elements.concat(n[i].elements.slice(s)),s=0,i++),o=o.concat(n.slice(i,l.pathIndex)),o.push(new e.Selector(a.elements.slice(s,l.index).concat([f]).concat(r.elements.slice(1)))),i=l.endPathIndex,s=l.endPathElementIndex,s>=a.elements.length&&(s=0,i++);return i<n.length&&s>0&&(o[o.length-1].elements=o[o.length-1].elements.concat(n[i].elements.slice(s)),s=0,i++),o=o.concat(n.slice(i,n.length)),o},visitRulesetOut:function(e){},visitMedia:function(e,t){var n=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);n=n.concat(this.doExtendChaining(n,e.allExtends)),this.allExtendsStack.push(n)},visitMediaOut:function(e){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(e,t){var n=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);n=n.concat(this.doExtendChaining(n,e.allExtends)),this.allExtendsStack.push(n)},visitDirectiveOut:function(e){this.allExtendsStack.length=this.allExtendsStack.length-1}}}(n("./tree"));var o=/^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);r.env=r.env||(location.hostname=="127.0.0.1"||location.hostname=="0.0.0.0"||location.hostname=="localhost"||location.port.length>0||o?"development":"production"),r.async=r.async||!1,r.fileAsync=r.fileAsync||!1,r.poll=r.poll||(o?1e3:1500);if(r.functions)for(var u in r.functions)r.tree.functions[u]=r.functions[u];var a=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(location.hash);a&&(r.dumpLineNumbers=a[1]),r.watch=function(){return r.watchMode||(r.env="development",f()),this.watchMode=!0},r.unwatch=function(){return clearInterval(r.watchTimer),this.watchMode=!1},/!watch/.test(location.hash)&&r.watch();var l=null;if(r.env!="development")try{l=typeof e.localStorage=="undefined"?null:e.localStorage}catch(c){}var h=document.getElementsByTagName("link"),p=/^text\/(x-)?less$/;r.sheets=[];for(var d=0;d<h.length;d++)(h[d].rel==="stylesheet/less"||h[d].rel.match(/stylesheet/)&&h[d].type.match(p))&&r.sheets.push(h[d]);var v="";r.modifyVars=function(e){var t=v;for(var n in e)t+=(n.slice(0,1)==="@"?"":"@")+n+": "+(e[n].slice(-1)===";"?e[n]:e[n]+";");(new r.Parser(new r.tree.parseEnv(r))).parse(t,function(e,t){e?k(e,"session_cache"):S(t.toCSS(r),r.sheets[r.sheets.length-1])})},r.refresh=function(e){var t,n;t=n=new Date,g(function(e,i,s,o,u){if(e)return k(e,o.href);u.local?C("loading "+o.href+" from cache."):(C("parsed "+o.href+" successfully."),S(i.toCSS(r),o,u.lastModified)),C("css for "+o.href+" generated in "+(new Date-n)+"ms"),u.remaining===0&&C("css generated in "+(new Date-t)+"ms"),n=new Date},e),m()},r.refreshStyles=m,r.refresh(r.env==="development"),typeof define=="function"&&define.amd&&define(function(){return r})})(window); | gswalden/cdnjs | ajax/libs/less.js/1.4.1/less.min.js | JavaScript | mit | 78,982 |
<!doctype html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.2/raphael-min.js"></script>
<script src="../morris.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.js"></script>
<script src="lib/example.js"></script>
<link rel="stylesheet" href="lib/example.css">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.css">
<link rel="stylesheet" href="../morris.css">
</head>
<body>
<h1>Bar charts</h1>
<div id="graph"></div>
<pre id="code" class="prettyprint linenums">
// Use Morris.Bar
Morris.Bar({
element: 'graph',
data: [
{x: '2011 Q1', y: 3, z: 2, a: 3},
{x: '2011 Q2', y: 2, z: null, a: 1},
{x: '2011 Q3', y: 0, z: 2, a: 4},
{x: '2011 Q4', y: 2, z: 4, a: 3}
],
xkey: 'x',
ykeys: ['y', 'z', 'a'],
labels: ['Y', 'Z', 'A']
}).on('click', function(i, row){
console.log(i, row);
});
</pre>
</body>
| elvincasem/eform2 | elabel/bower_components/morrisjs/examples/bar.html | HTML | mit | 1,042 |
'use strict';
module.exports = function (t, a) {
var fn = function (raz, dwa) { return raz + dwa; };
a(t('undefined'), undefined, "Undefined");
a(t('null'), null, "Null");
a(t('"raz"'), 'raz', "String");
a(t('"raz\\"ddwa\\ntrzy"'), 'raz"ddwa\ntrzy', "String with escape");
a(t('false'), false, "Booelean");
a(String(t(String(fn))), String(fn), "Function");
a.deep(t('/raz-dwa/g'), /raz-dwa/g, "RegExp");
a.deep(t('new Date(1234567)'), new Date(1234567), "Date");
a.deep(t('[]'), [], "Empty array");
a.deep(t('[undefined,false,null,"raz\\"ddwa\\ntrzy",/raz/g,new Date(1234567),["foo"]]'),
[undefined, false, null, 'raz"ddwa\ntrzy', /raz/g, new Date(1234567), ['foo']], "Rich Array");
a.deep(t('{}'), {}, "Empty object");
a.deep(t('{"raz":undefined,"dwa":false,"trzy":null,"cztery":"raz\\"ddwa\\ntrzy",' +
'"szesc":/raz/g,"siedem":new Date(1234567),"osiem":["foo",32],' +
'"dziewiec":{"foo":"bar","dwa":343}}'),
{ raz: undefined, dwa: false, trzy: null, cztery: 'raz"ddwa\ntrzy', szesc: /raz/g,
siedem: new Date(1234567), osiem: ['foo', 32], dziewiec: { foo: 'bar', dwa: 343 } },
"Rich object");
};
| sycurfriend00/ghost | node_modules/bower/node_modules/inquirer/node_modules/cli-color/node_modules/es5-ext/test/object/unserialize.js | JavaScript | mit | 1,125 |
/*!
* inferno-create-class v1.0.0-beta15
* (c) 2016 Dominic Gannaway
* Released under the MIT License.
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./inferno-component')) :
typeof define === 'function' && define.amd ? define(['inferno-component'], factory) :
(global.Inferno = global.Inferno || {}, global.Inferno.createClass = factory(global.Inferno.Component));
}(this, (function (Component) { 'use strict';
Component = 'default' in Component ? Component['default'] : Component;
var ERROR_MSG = 'a runtime error occured! Use Inferno in development environment to find the error.';
// this is MUCH faster than .constructor === Array and instanceof Array
// in Node 7 and the later versions of V8, slower in older versions though
function isNullOrUndef(obj) {
return isUndefined(obj) || isNull(obj);
}
function isNull(obj) {
return obj === null;
}
function isUndefined(obj) {
return obj === undefined;
}
// don't autobind these methods since they already have guaranteed context.
var AUTOBIND_BLACKLIST = {
constructor: 1,
render: 1,
shouldComponentUpdate: 1,
componentWillRecieveProps: 1,
componentWillUpdate: 1,
componentDidUpdate: 1,
componentWillMount: 1,
componentDidMount: 1,
componentWillUnmount: 1,
componentDidUnmount: 1
};
function extend(base, props, all) {
for (var key in props) {
if (all === true || !isNullOrUndef(props[key])) {
base[key] = props[key];
}
}
return base;
}
function bindAll(ctx) {
for (var i in ctx) {
var v = ctx[i];
if (typeof v === 'function' && !v.__bound && !AUTOBIND_BLACKLIST[i]) {
(ctx[i] = v.bind(ctx)).__bound = true;
}
}
}
function createClass$1(obj) {
return (Cl_1 = (function (Component$$1) {
function Cl(props) {
Component$$1.call(this, props);
extend(this, obj);
bindAll(this);
if (obj.getInitialState) {
this.state = obj.getInitialState.call(this);
}
}
if ( Component$$1 ) Cl.__proto__ = Component$$1;
Cl.prototype = Object.create( Component$$1 && Component$$1.prototype );
Cl.prototype.constructor = Cl;
return Cl;
}(Component)),
Cl_1.displayName = obj.displayName || 'Component',
Cl_1.propTypes = obj.propTypes,
Cl_1.defaultProps = obj.getDefaultProps ? obj.getDefaultProps() : undefined,
Cl_1);
var Cl_1;
}
return createClass$1;
})));
| sashberd/cdnjs | ajax/libs/inferno/1.0.0-beta15/inferno-create-class.js | JavaScript | mit | 2,635 |
// flowchart.js, v1.6.2
// Copyright (c)yyyy Adriano Raiano (adrai).
// Distributed under MIT license
// http://adrai.github.io/flowchart.js
!function(t,i){if("object"==typeof exports&&"object"==typeof module)module.exports=i(require("Raphael"));else if("function"==typeof define&&define.amd)define(["Raphael"],i);else{var e=i("object"==typeof exports?require("Raphael"):t.Raphael);for(var r in e)("object"==typeof exports?exports:t)[r]=e[r]}}(this,function(t){return function(t){function i(r){if(e[r])return e[r].exports;var s=e[r]={exports:{},id:r,loaded:!1};return t[r].call(s.exports,s,s.exports,i),s.loaded=!0,s.exports}var e={};return i.m=t,i.c=e,i.p="",i(0)}([function(t,i,e){e(8);var r=e(4);e(14);var s={parse:r};"undefined"!=typeof window&&(window.flowchart=s),t.exports=s},function(t,i){function e(t,i){if(!t||"function"==typeof t)return i;var r={};for(var s in i)r[s]=i[s];for(s in t)t[s]&&("object"==typeof r[s]?r[s]=e(r[s],t[s]):r[s]=t[s]);return r}function r(t,i){if("function"==typeof Object.create)t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});else{t.super_=i;var e=function(){};e.prototype=i.prototype,t.prototype=new e,t.prototype.constructor=t}}t.exports={defaults:e,inherits:r}},function(t,i,e){function r(t,i,e){this.chart=t,this.group=this.chart.paper.set(),this.symbol=e,this.connectedTo=[],this.symbolType=i.symbolType,this.flowstate=i.flowstate||"future",this.next_direction=i.next&&i.direction_next?i.direction_next:void 0,this.text=this.chart.paper.text(0,0,i.text),i.key&&(this.text.node.id=i.key+"t"),this.text.node.setAttribute("class",this.getAttr("class")+"t"),this.text.attr({"text-anchor":"start",x:this.getAttr("text-margin"),fill:this.getAttr("font-color"),"font-size":this.getAttr("font-size")});var r=this.getAttr("font"),s=this.getAttr("font-family"),o=this.getAttr("font-weight");r&&this.text.attr({font:r}),s&&this.text.attr({"font-family":s}),o&&this.text.attr({"font-weight":o}),i.link&&this.text.attr("href",i.link),i.target&&this.text.attr("target",i.target);var n=this.getAttr("maxWidth");if(n){for(var h=i.text.split(" "),a="",x=0,y=h.length;y>x;x++){var l=h[x];this.text.attr("text",a+" "+l),a+=this.text.getBBox().width>n?"\n"+l:" "+l}this.text.attr("text",a.substring(1))}if(this.group.push(this.text),e){var g=this.getAttr("text-margin");e.attr({fill:this.getAttr("fill"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*g,height:this.text.getBBox().height+2*g}),e.node.setAttribute("class",this.getAttr("class")),i.link&&e.attr("href",i.link),i.target&&e.attr("target",i.target),i.key&&(e.node.id=i.key),this.group.push(e),e.insertBefore(this.text),this.text.attr({y:e.getBBox().height/2}),this.initialize()}}var s=e(3),o=s.drawLine,n=s.checkLineIntersection;r.prototype.getAttr=function(t){if(this.chart){var i,e=this.chart.options?this.chart.options[t]:void 0,r=this.chart.options.symbols?this.chart.options.symbols[this.symbolType][t]:void 0;return this.chart.options.flowstate&&this.chart.options.flowstate[this.flowstate]&&(i=this.chart.options.flowstate[this.flowstate][t]),i||r||e}},r.prototype.initialize=function(){this.group.transform("t"+this.getAttr("line-width")+","+this.getAttr("line-width")),this.width=this.group.getBBox().width,this.height=this.group.getBBox().height},r.prototype.getCenter=function(){return{x:this.getX()+this.width/2,y:this.getY()+this.height/2}},r.prototype.getX=function(){return this.group.getBBox().x},r.prototype.getY=function(){return this.group.getBBox().y},r.prototype.shiftX=function(t){this.group.transform("t"+(this.getX()+t)+","+this.getY())},r.prototype.setX=function(t){this.group.transform("t"+t+","+this.getY())},r.prototype.shiftY=function(t){this.group.transform("t"+this.getX()+","+(this.getY()+t))},r.prototype.setY=function(t){this.group.transform("t"+this.getX()+","+t)},r.prototype.getTop=function(){var t=this.getY(),i=this.getX()+this.width/2;return{x:i,y:t}},r.prototype.getBottom=function(){var t=this.getY()+this.height,i=this.getX()+this.width/2;return{x:i,y:t}},r.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX();return{x:i,y:t}},r.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.group.getBBox().width;return{x:i,y:t}},r.prototype.render=function(){if(this.next){var t=this.getAttr("line-length");if("right"===this.next_direction){var i=this.getRight();if(!this.next.isPositioned){this.next.setY(i.y-this.next.height/2),this.next.shiftX(this.group.getBBox().x+this.width+t);var e=this;!function s(){for(var i,r=!1,o=0,n=e.chart.symbols.length;n>o;o++){i=e.chart.symbols[o];var h=Math.abs(i.getCenter().x-e.next.getCenter().x);if(i.getCenter().y>e.next.getCenter().y&&h<=e.next.width/2){r=!0;break}}r&&(e.next.setX(i.getX()+i.width+t),s())}(),this.next.isPositioned=!0,this.next.render()}}else{var r=this.getBottom();this.next.isPositioned||(this.next.shiftY(this.getY()+this.height+t),this.next.setX(r.x-this.next.width/2),this.next.isPositioned=!0,this.next.render())}}},r.prototype.renderLines=function(){this.next&&(this.next_direction?this.drawLineTo(this.next,"",this.next_direction):this.drawLineTo(this.next))},r.prototype.drawLineTo=function(t,i,e){this.connectedTo.indexOf(t)<0&&this.connectedTo.push(t);var r,s=this.getCenter().x,h=this.getCenter().y,a=this.getRight(),x=this.getBottom(),y=this.getLeft(),l=t.getCenter().x,g=t.getCenter().y,f=t.getTop(),p=t.getRight(),c=t.getLeft(),u=s===l,d=h===g,m=g>h,b=h>g,v=s>l,w=l>s,k=0,_=this.getAttr("line-length"),B=this.getAttr("line-width");if(e&&"bottom"!==e||!u||!m)if(e&&"right"!==e||!d||!w)if(e&&"left"!==e||!d||!v)if(e&&"right"!==e||!u||!b)if(e&&"right"!==e||!u||!m)if(e&&"bottom"!==e||!v)if(e&&"bottom"!==e||!w)if(e&&"right"===e&&v)r=o(this.chart,a,[{x:a.x+_/2,y:a.y},{x:a.x+_/2,y:f.y-_/2},{x:f.x,y:f.y-_/2},{x:f.x,y:f.y}],i),this.rightStart=!0,t.topEnd=!0,k=a.x+_/2;else if(e&&"right"===e&&w)r=o(this.chart,a,[{x:f.x,y:a.y},{x:f.x,y:f.y}],i),this.rightStart=!0,t.topEnd=!0,k=a.x+_/2;else if(e&&"bottom"===e&&u&&b)r=o(this.chart,x,[{x:x.x,y:x.y+_/2},{x:a.x+_/2,y:x.y+_/2},{x:a.x+_/2,y:f.y-_/2},{x:f.x,y:f.y-_/2},{x:f.x,y:f.y}],i),this.bottomStart=!0,t.topEnd=!0,k=x.x+_/2;else if("left"===e&&u&&b){var A=y.x-_/2;c.x<y.x&&(A=c.x-_/2),r=o(this.chart,y,[{x:A,y:y.y},{x:A,y:f.y-_/2},{x:f.x,y:f.y-_/2},{x:f.x,y:f.y}],i),this.leftStart=!0,t.topEnd=!0,k=y.x}else"left"===e&&(r=o(this.chart,y,[{x:f.x+(y.x-f.x)/2,y:y.y},{x:f.x+(y.x-f.x)/2,y:f.y-_/2},{x:f.x,y:f.y-_/2},{x:f.x,y:f.y}],i),this.leftStart=!0,t.topEnd=!0,k=y.x);else r=o(this.chart,x,[{x:x.x,y:x.y+_/2},{x:x.x+(x.x-f.x)/2,y:x.y+_/2},{x:x.x+(x.x-f.x)/2,y:f.y-_/2},{x:f.x,y:f.y-_/2},{x:f.x,y:f.y}],i),this.bottomStart=!0,t.topEnd=!0,k=x.x+(x.x-f.x)/2;else r=this.leftEnd&&b?o(this.chart,x,[{x:x.x,y:x.y+_/2},{x:x.x+(x.x-f.x)/2,y:x.y+_/2},{x:x.x+(x.x-f.x)/2,y:f.y-_/2},{x:f.x,y:f.y-_/2},{x:f.x,y:f.y}],i):o(this.chart,x,[{x:x.x,y:f.y-_/2},{x:f.x,y:f.y-_/2},{x:f.x,y:f.y}],i),this.bottomStart=!0,t.topEnd=!0,k=x.x+(x.x-f.x)/2;else r=o(this.chart,a,[{x:a.x+_/2,y:a.y},{x:a.x+_/2,y:f.y-_/2},{x:f.x,y:f.y-_/2},{x:f.x,y:f.y}],i),this.rightStart=!0,t.topEnd=!0,k=a.x+_/2;else r=o(this.chart,a,[{x:a.x+_/2,y:a.y},{x:a.x+_/2,y:f.y-_/2},{x:f.x,y:f.y-_/2},{x:f.x,y:f.y}],i),this.rightStart=!0,t.topEnd=!0,k=a.x+_/2;else r=o(this.chart,y,p,i),this.leftStart=!0,t.rightEnd=!0,k=p.x;else r=o(this.chart,a,c,i),this.rightStart=!0,t.leftEnd=!0,k=c.x;else r=o(this.chart,x,f,i),this.bottomStart=!0,t.topEnd=!0,k=x.x;if(r){for(var L=0,M=this.chart.lines.length;M>L;L++)for(var O,X=this.chart.lines[L],T=X.attr("path"),Y=r.attr("path"),C=0,S=T.length-1;S>C;C++){var j=[];j.push(["M",T[C][1],T[C][2]]),j.push(["L",T[C+1][1],T[C+1][2]]);for(var E=j[0][1],z=j[0][2],P=j[1][1],R=j[1][2],F=0,I=Y.length-1;I>F;F++){var W=[];W.push(["M",Y[F][1],Y[F][2]]),W.push(["L",Y[F+1][1],Y[F+1][2]]);var N=W[0][1],V=W[0][2],q=W[1][1],G=W[1][2],Q=n(E,z,P,R,N,V,q,G);if(Q.onLine1&&Q.onLine2){var $;V===G?N>q?($=["L",Q.x+2*B,V],Y.splice(F+1,0,$),$=["C",Q.x+2*B,V,Q.x,V-4*B,Q.x-2*B,V],Y.splice(F+2,0,$),r.attr("path",Y)):($=["L",Q.x-2*B,V],Y.splice(F+1,0,$),$=["C",Q.x-2*B,V,Q.x,V-4*B,Q.x+2*B,V],Y.splice(F+2,0,$),r.attr("path",Y)):V>G?($=["L",N,Q.y+2*B],Y.splice(F+1,0,$),$=["C",N,Q.y+2*B,N+4*B,Q.y,N,Q.y-2*B],Y.splice(F+2,0,$),r.attr("path",Y)):($=["L",N,Q.y-2*B],Y.splice(F+1,0,$),$=["C",N,Q.y-2*B,N+4*B,Q.y,N,Q.y+2*B],Y.splice(F+2,0,$),r.attr("path",Y)),F+=2,O+=2}}}this.chart.lines.push(r)}(!this.chart.maxXFromLine||this.chart.maxXFromLine&&k>this.chart.maxXFromLine)&&(this.chart.maxXFromLine=k)},t.exports=r},function(t,i){function e(t,i,e){var r,s,o="M{0},{1}";for(r=2,s=2*e.length+2;s>r;r+=2)o+=" L{"+r+"},{"+(r+1)+"}";var n=[i.x,i.y];for(r=0,s=e.length;s>r;r++)n.push(e[r].x),n.push(e[r].y);var h=t.paper.path(o,n);h.attr("stroke",t.options["element-color"]),h.attr("stroke-width",t.options["line-width"]);var a=t.options.font,x=t.options["font-family"],y=t.options["font-weight"];return a&&h.attr({font:a}),x&&h.attr({"font-family":x}),y&&h.attr({"font-weight":y}),h}function r(t,i,e,r){var s,o;"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]);var n="M{0},{1}";for(s=2,o=2*e.length+2;o>s;s+=2)n+=" L{"+s+"},{"+(s+1)+"}";var h=[i.x,i.y];for(s=0,o=e.length;o>s;s++)h.push(e[s].x),h.push(e[s].y);var a=t.paper.path(n,h);a.attr({stroke:t.options["line-color"],"stroke-width":t.options["line-width"],"arrow-end":t.options["arrow-end"]});var x=t.options.font,y=t.options["font-family"],l=t.options["font-weight"];if(x&&a.attr({font:x}),y&&a.attr({"font-family":y}),l&&a.attr({"font-weight":l}),r){var g=!1,f=t.paper.text(0,0,r),p=!1,c=e[0];i.y===c.y&&(p=!0);var u=0,d=0;g?(u=i.x>c.x?i.x-(i.x-c.x)/2:c.x-(c.x-i.x)/2,d=i.y>c.y?i.y-(i.y-c.y)/2:c.y-(c.y-i.y)/2,p?(u-=f.getBBox().width/2,d-=t.options["text-margin"]):(u+=t.options["text-margin"],d-=f.getBBox().height/2)):(u=i.x,d=i.y,p?(u+=t.options["text-margin"]/2,d-=t.options["text-margin"]):(u+=t.options["text-margin"]/2,d+=t.options["text-margin"])),f.attr({"text-anchor":"start","font-size":t.options["font-size"],fill:t.options["font-color"],x:u,y:d}),x&&f.attr({font:x}),y&&f.attr({"font-family":y}),l&&f.attr({"font-weight":l})}return a}function s(t,i,e,r,s,o,n,h){var a,x,y,l,g,f={x:null,y:null,onLine1:!1,onLine2:!1};return a=(h-o)*(e-t)-(n-s)*(r-i),0===a?f:(x=i-o,y=t-s,l=(n-s)*x-(h-o)*y,g=(e-t)*x-(r-i)*y,x=l/a,y=g/a,f.x=t+x*(e-t),f.y=i+x*(r-i),x>0&&1>x&&(f.onLine1=!0),y>0&&1>y&&(f.onLine2=!0),f)}t.exports={drawPath:e,drawLine:r,checkLineIntersection:s}},function(t,i,e){function r(t){function i(t){var i=t.indexOf("(")+1,e=t.indexOf(")");return i>=0&&e>=0?r.symbols[t.substring(0,i-1)]:r.symbols[t]}function e(t){var i="next",e=t.indexOf("(")+1,r=t.indexOf(")");return e>=0&&r>=0&&(i=X.substring(e,r),i.indexOf(",")<0&&"yes"!==i&&"no"!==i&&(i="next, "+i)),i}t=t||"",t=t.trim();for(var r={symbols:{},start:null,drawSVG:function(t,i){function e(t){if(g[t.key])return g[t.key];switch(t.symbolType){case"start":g[t.key]=new o(l,t);break;case"end":g[t.key]=new n(l,t);break;case"operation":g[t.key]=new h(l,t);break;case"inputoutput":g[t.key]=new a(l,t);break;case"subroutine":g[t.key]=new x(l,t);break;case"condition":g[t.key]=new y(l,t);break;default:return new Error("Wrong symbol type!")}return g[t.key]}var r=this;this.diagram&&this.diagram.clean();var l=new s(t,i);this.diagram=l;var g={};!function f(t,i,s){var o=e(t);return r.start===t?l.startWith(o):i&&s&&!i.pathOk&&(i instanceof y?(s.yes===t&&i.yes(o),s.no===t&&i.no(o)):i.then(o)),o.pathOk?o:(o instanceof y?(t.yes&&f(t.yes,o,t),t.no&&f(t.no,o,t)):t.next&&f(t.next,o,t),o)}(this.start),l.render()},clean:function(){this.diagram.clean()}},l=[],g=0,f=1,p=t.length;p>f;f++)if("\n"===t[f]&&"\\"!==t[f-1]){var c=t.substring(g,f);g=f+1,l.push(c.replace(/\\\n/g,"\n"))}g<t.length&&l.push(t.substr(g));for(var u=1,d=l.length;d>u;){var m=l[u];m.indexOf("->")<0&&m.indexOf("=>")<0?(l[u-1]+="\n"+m,l.splice(u,1),d--):u++}for(;l.length>0;){var b=l.splice(0,1)[0];if(b.indexOf("=>")>=0){var v,w=b.split("=>"),k={key:w[0],symbolType:w[1],text:null,link:null,target:null,flowstate:null};if(k.symbolType.indexOf(": ")>=0&&(v=k.symbolType.split(": "),k.symbolType=v.shift(),k.text=v.join(": ")),k.text&&k.text.indexOf(":>")>=0?(v=k.text.split(":>"),k.text=v.shift(),k.link=v.join(":>")):k.symbolType.indexOf(":>")>=0&&(v=k.symbolType.split(":>"),k.symbolType=v.shift(),k.link=v.join(":>")),k.symbolType.indexOf("\n")>=0&&(k.symbolType=k.symbolType.split("\n")[0]),k.link){var _=k.link.indexOf("[")+1,B=k.link.indexOf("]");_>=0&&B>=0&&(k.target=k.link.substring(_,B),k.link=k.link.substring(0,_-1))}if(k.text&&k.text.indexOf("|")>=0){var A=k.text.split("|");k.flowstate=A.pop().trim(),k.text=A.join("|")}r.symbols[k.key]=k}else if(b.indexOf("->")>=0)for(var L=b.split("->"),M=0,O=L.length;O>M;M++){var X=L[M],T=i(X),Y=e(X),C=null;if(Y.indexOf(",")>=0){var S=Y.split(",");Y=S[0],C=S[1].trim()}if(r.start||(r.start=T),O>M+1){var j=L[M+1];T[Y]=i(j),T["direction_"+Y]=C,C=null}}}return r}var s=e(6),o=e(12),n=e(9),h=e(11),a=e(10),x=e(13),y=e(5);t.exports=r},function(t,i,e){function r(t,i){i=i||{},s.call(this,t,i),this.textMargin=this.getAttr("text-margin"),this.yes_direction="bottom",this.no_direction="right",i.yes&&i.direction_yes&&i.no&&!i.direction_no?"right"===i.direction_yes?(this.no_direction="bottom",this.yes_direction="right"):(this.no_direction="right",this.yes_direction="bottom"):i.yes&&!i.direction_yes&&i.no&&i.direction_no?"right"===i.direction_no?(this.yes_direction="bottom",this.no_direction="right"):(this.yes_direction="right",this.no_direction="bottom"):(this.yes_direction="bottom",this.no_direction="right"),this.yes_direction=this.yes_direction||"bottom",this.no_direction=this.no_direction||"right",this.text.attr({x:2*this.textMargin});var e=this.text.getBBox().width+3*this.textMargin;e+=e/2;var r=this.text.getBBox().height+2*this.textMargin;r+=r/2,r=Math.max(.5*e,r);var o=e/4,n=r/4;this.text.attr({x:o+this.textMargin/2});var a={x:o,y:n},x=[{x:o-e/4,y:n+r/4},{x:o-e/4+e/2,y:n+r/4+r/2},{x:o-e/4+e,y:n+r/4},{x:o-e/4+e/2,y:n+r/4-r/2},{x:o-e/4,y:n+r/4}],y=h(t,a,x);y.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),i.link&&y.attr("href",i.link),i.target&&y.attr("target",i.target),i.key&&(y.node.id=i.key),y.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:y.getBBox().height/2}),this.group.push(y),y.insertBefore(this.text),this.initialize()}var s=e(2),o=e(1).inherits,n=e(3),h=n.drawPath;o(r,s),r.prototype.render=function(){this.yes_direction&&(this[this.yes_direction+"_symbol"]=this.yes_symbol),this.no_direction&&(this[this.no_direction+"_symbol"]=this.no_symbol);var t=this.getAttr("line-length");if(this.bottom_symbol){var i=this.getBottom();this.bottom_symbol.isPositioned||(this.bottom_symbol.shiftY(this.getY()+this.height+t),this.bottom_symbol.setX(i.x-this.bottom_symbol.width/2),this.bottom_symbol.isPositioned=!0,this.bottom_symbol.render())}if(this.right_symbol){var e=this.getRight();if(!this.right_symbol.isPositioned){this.right_symbol.setY(e.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+t);var r=this;!function s(){for(var i,e=!1,o=0,n=r.chart.symbols.length;n>o;o++){i=r.chart.symbols[o];var h=Math.abs(i.getCenter().x-r.right_symbol.getCenter().x);if(i.getCenter().y>r.right_symbol.getCenter().y&&h<=r.right_symbol.width/2){e=!0;break}}e&&(r.right_symbol.setX(i.getX()+i.width+t),s())}(),this.right_symbol.isPositioned=!0,this.right_symbol.render()}}},r.prototype.renderLines=function(){this.yes_symbol&&this.drawLineTo(this.yes_symbol,this.getAttr("yes-text"),this.yes_direction),this.no_symbol&&this.drawLineTo(this.no_symbol,this.getAttr("no-text"),this.no_direction)},t.exports=r},function(t,i,e){function r(t,i){i=i||{},this.paper=new s(t),this.options=o(i,n),this.symbols=[],this.lines=[],this.start=null}var s=e(15),o=e(1).defaults,n=e(7),h=e(5);r.prototype.handle=function(t){this.symbols.indexOf(t)<=-1&&this.symbols.push(t);var i=this;return t instanceof h?(t.yes=function(e){return t.yes_symbol=e,t.no_symbol&&(t.pathOk=!0),i.handle(e)},t.no=function(e){return t.no_symbol=e,t.yes_symbol&&(t.pathOk=!0),i.handle(e)}):t.then=function(e){return t.next=e,t.pathOk=!0,i.handle(e)},t},r.prototype.startWith=function(t){return this.start=t,this.handle(t)},r.prototype.render=function(){var t,i,e=0,r=0,s=0,o=0,n=0,h=0,a=0,x=0;for(s=0,o=this.symbols.length;o>s;s++)t=this.symbols[s],t.width>e&&(e=t.width),t.height>r&&(r=t.height);for(s=0,o=this.symbols.length;o>s;s++)t=this.symbols[s],t.shiftX(this.options.x+(e-t.width)/2+this.options["line-width"]),t.shiftY(this.options.y+(r-t.height)/2+this.options["line-width"]);for(this.start.render(),s=0,o=this.symbols.length;o>s;s++)t=this.symbols[s],t.renderLines();for(n=this.maxXFromLine,s=0,o=this.symbols.length;o>s;s++){t=this.symbols[s];var y=t.getX()+t.width,l=t.getY()+t.height;y>n&&(n=y),l>h&&(h=l)}for(s=0,o=this.lines.length;o>s;s++){i=this.lines[s].getBBox();var y=i.x,l=i.y,g=i.x2,f=i.y2;a>y&&(a=y),x>l&&(x=l),g>n&&(n=g),f>h&&(h=f)}var p=this.options.scale,c=this.options["line-width"];0>a&&(a-=c),0>x&&(x-=c);var u=n+c-a,d=h+c-x;this.paper.setSize(u*p,d*p),this.paper.setViewBox(a,x,u,d,!0)},r.prototype.clean=function(){if(this.paper){var t=this.paper.canvas;t.parentNode.removeChild(t)}},t.exports=r},function(t,i){t.exports={x:0,y:0,"line-width":3,"line-length":50,"text-margin":10,"font-size":14,"font-color":"black","line-color":"black","element-color":"black",fill:"white","yes-text":"yes","no-text":"no","arrow-end":"block","class":"flowchart",scale:1,symbols:{start:{},end:{},condition:{},inputoutput:{},operation:{},subroutine:{}}}},function(t,i){Array.prototype.indexOf||(Array.prototype.indexOf=function(t){"use strict";if(null===this)throw new TypeError;var i=Object(this),e=i.length>>>0;if(0===e)return-1;var r=0;if(arguments.length>0&&(r=Number(arguments[1]),r!=r?r=0:0!==r&&r!=1/0&&r!=-(1/0)&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=e)return-1;for(var s=r>=0?r:Math.max(e-Math.abs(r),0);e>s;s++)if(s in i&&i[s]===t)return s;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(t){"use strict";if(null===this)throw new TypeError;var i=Object(this),e=i.length>>>0;if(0===e)return-1;var r=e;arguments.length>1&&(r=Number(arguments[1]),r!=r?r=0:0!==r&&r!=1/0&&r!=-(1/0)&&(r=(r>0||-1)*Math.floor(Math.abs(r))));for(var s=r>=0?Math.min(r,e-1):e-Math.abs(r);s>=0;s--)if(s in i&&i[s]===t)return s;return-1}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")})},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0,20);i=i||{},i.text=i.text||"End",s.call(this,t,i,e)}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){function r(t,i){i=i||{},s.call(this,t,i),this.textMargin=this.getAttr("text-margin"),this.text.attr({x:3*this.textMargin});var e=this.text.getBBox().width+4*this.textMargin,r=this.text.getBBox().height+2*this.textMargin,o=this.textMargin,n=r/2,a={x:o,y:n},x=[{x:o-this.textMargin,y:r},{x:o-this.textMargin+e,y:r},{x:o-this.textMargin+e+2*this.textMargin,y:0},{x:o-this.textMargin+2*this.textMargin,y:0},{x:o,y:n}],y=h(t,a,x);y.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),i.link&&y.attr("href",i.link),i.target&&y.attr("target",i.target),i.key&&(y.node.id=i.key),y.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:y.getBBox().height/2}),this.group.push(y),y.insertBefore(this.text),this.initialize()}var s=e(2),o=e(1).inherits,n=e(3),h=n.drawPath;o(r,s),r.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.textMargin;return{x:i,y:t}},r.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2,i=this.getX()+this.group.getBBox().width-this.textMargin;return{x:i,y:t}},t.exports=r},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0);i=i||{},s.call(this,t,i,e)}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0,20);i=i||{},i.text=i.text||"Start",s.call(this,t,i,e)}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){function r(t,i){var e=t.paper.rect(0,0,0,0);i=i||{},s.call(this,t,i,e),e.attr({width:this.text.getBBox().width+4*this.getAttr("text-margin")}),this.text.attr({x:2*this.getAttr("text-margin")});var r=t.paper.rect(0,0,0,0);r.attr({x:this.getAttr("text-margin"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*this.getAttr("text-margin"),height:this.text.getBBox().height+2*this.getAttr("text-margin"),fill:this.getAttr("fill")}),i.key&&(r.node.id=i.key+"i");var o=this.getAttr("font"),n=this.getAttr("font-family"),h=this.getAttr("font-weight");o&&r.attr({font:o}),n&&r.attr({"font-family":n}),h&&r.attr({"font-weight":h}),i.link&&r.attr("href",i.link),i.target&&r.attr("target",i.target),this.group.push(r),r.insertBefore(this.text),this.initialize()}var s=e(2),o=e(1).inherits;o(r,s),t.exports=r},function(t,i,e){if("undefined"!=typeof jQuery){var r=e(4);!function(t){t.fn.flowChart=function(i){return this.each(function(){var e=t(this),s=r(e.text());e.html(""),s.drawSVG(this,i)})}}(jQuery)}},function(i,e){i.exports=t}])});
//# sourceMappingURL=flowchart.min.js.map | nolsherry/cdnjs | ajax/libs/flowchart/1.6.2/flowchart.min.js | JavaScript | mit | 21,366 |
'use strict';
module.exports = function(Chart) {
var helpers = Chart.helpers;
var noop = helpers.noop;
Chart.defaults.global.legend = {
display: true,
position: 'top',
fullWidth: true, // marks that this box should take the full width of the canvas (pushing down other boxes)
reverse: false,
// a callback that will handle
onClick: function(e, legendItem) {
var index = legendItem.datasetIndex;
var ci = this.chart;
var meta = ci.getDatasetMeta(index);
// See controller.isDatasetVisible comment
meta.hidden = meta.hidden === null? !ci.data.datasets[index].hidden : null;
// We hid a dataset ... rerender the chart
ci.update();
},
onHover: null,
labels: {
boxWidth: 40,
padding: 10,
// Generates labels shown in the legend
// Valid properties to return:
// text : text to display
// fillStyle : fill of coloured box
// strokeStyle: stroke of coloured box
// hidden : if this legend item refers to a hidden item
// lineCap : cap style for line
// lineDash
// lineDashOffset :
// lineJoin :
// lineWidth :
generateLabels: function(chart) {
var data = chart.data;
return helpers.isArray(data.datasets) ? data.datasets.map(function(dataset, i) {
return {
text: dataset.label,
fillStyle: (!helpers.isArray(dataset.backgroundColor) ? dataset.backgroundColor : dataset.backgroundColor[0]),
hidden: !chart.isDatasetVisible(i),
lineCap: dataset.borderCapStyle,
lineDash: dataset.borderDash,
lineDashOffset: dataset.borderDashOffset,
lineJoin: dataset.borderJoinStyle,
lineWidth: dataset.borderWidth,
strokeStyle: dataset.borderColor,
pointStyle: dataset.pointStyle,
// Below is extra data used for toggling the datasets
datasetIndex: i
};
}, this) : [];
}
}
};
Chart.Legend = Chart.Element.extend({
initialize: function(config) {
helpers.extend(this, config);
// Contains hit boxes for each dataset (in dataset order)
this.legendHitBoxes = [];
// Are we in doughnut mode which has a different data type
this.doughnutMode = false;
},
// These methods are ordered by lifecyle. Utilities then follow.
// Any function defined here is inherited by all legend types.
// Any function can be extended by the legend type
beforeUpdate: noop,
update: function(maxWidth, maxHeight, margins) {
var me = this;
// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
me.beforeUpdate();
// Absorb the master measurements
me.maxWidth = maxWidth;
me.maxHeight = maxHeight;
me.margins = margins;
// Dimensions
me.beforeSetDimensions();
me.setDimensions();
me.afterSetDimensions();
// Labels
me.beforeBuildLabels();
me.buildLabels();
me.afterBuildLabels();
// Fit
me.beforeFit();
me.fit();
me.afterFit();
//
me.afterUpdate();
return me.minSize;
},
afterUpdate: noop,
//
beforeSetDimensions: noop,
setDimensions: function() {
var me = this;
// Set the unconstrained dimension before label rotation
if (me.isHorizontal()) {
// Reset position before calculating rotation
me.width = me.maxWidth;
me.left = 0;
me.right = me.width;
} else {
me.height = me.maxHeight;
// Reset position before calculating rotation
me.top = 0;
me.bottom = me.height;
}
// Reset padding
me.paddingLeft = 0;
me.paddingTop = 0;
me.paddingRight = 0;
me.paddingBottom = 0;
// Reset minSize
me.minSize = {
width: 0,
height: 0
};
},
afterSetDimensions: noop,
//
beforeBuildLabels: noop,
buildLabels: function() {
var me = this;
me.legendItems = me.options.labels.generateLabels.call(me, me.chart);
if (me.options.reverse) {
me.legendItems.reverse();
}
},
afterBuildLabels: noop,
//
beforeFit: noop,
fit: function() {
var me = this;
var opts = me.options;
var labelOpts = opts.labels;
var display = opts.display;
var ctx = me.ctx;
var globalDefault = Chart.defaults.global,
itemOrDefault = helpers.getValueOrDefault,
fontSize = itemOrDefault(labelOpts.fontSize, globalDefault.defaultFontSize),
fontStyle = itemOrDefault(labelOpts.fontStyle, globalDefault.defaultFontStyle),
fontFamily = itemOrDefault(labelOpts.fontFamily, globalDefault.defaultFontFamily),
labelFont = helpers.fontString(fontSize, fontStyle, fontFamily);
// Reset hit boxes
var hitboxes = me.legendHitBoxes = [];
var minSize = me.minSize;
var isHorizontal = me.isHorizontal();
if (isHorizontal) {
minSize.width = me.maxWidth; // fill all the width
minSize.height = display ? 10 : 0;
} else {
minSize.width = display ? 10 : 0;
minSize.height = me.maxHeight; // fill all the height
}
// Increase sizes here
if (display) {
ctx.font = labelFont;
if (isHorizontal) {
// Labels
// Width of each line of legend boxes. Labels wrap onto multiple lines when there are too many to fit on one
var lineWidths = me.lineWidths = [0];
var totalHeight = me.legendItems.length ? fontSize + (labelOpts.padding) : 0;
ctx.textAlign = 'left';
ctx.textBaseline = 'top';
helpers.each(me.legendItems, function(legendItem, i) {
var boxWidth = labelOpts.usePointStyle ?
fontSize * Math.sqrt(2) :
labelOpts.boxWidth;
var width = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;
if (lineWidths[lineWidths.length - 1] + width + labelOpts.padding >= me.width) {
totalHeight += fontSize + (labelOpts.padding);
lineWidths[lineWidths.length] = me.left;
}
// Store the hitbox width and height here. Final position will be updated in `draw`
hitboxes[i] = {
left: 0,
top: 0,
width: width,
height: fontSize
};
lineWidths[lineWidths.length - 1] += width + labelOpts.padding;
});
minSize.height += totalHeight;
} else {
var vPadding = labelOpts.padding;
var columnWidths = me.columnWidths = [];
var totalWidth = labelOpts.padding;
var currentColWidth = 0;
var currentColHeight = 0;
var itemHeight = fontSize + vPadding;
helpers.each(me.legendItems, function(legendItem, i) {
// If usePointStyle is set, multiple boxWidth by 2 since it represents
// the radius and not truly the width
var boxWidth = labelOpts.usePointStyle ? 2 * labelOpts.boxWidth : labelOpts.boxWidth;
var itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;
// If too tall, go to new column
if (currentColHeight + itemHeight > minSize.height) {
totalWidth += currentColWidth + labelOpts.padding;
columnWidths.push(currentColWidth); // previous column width
currentColWidth = 0;
currentColHeight = 0;
}
// Get max width
currentColWidth = Math.max(currentColWidth, itemWidth);
currentColHeight += itemHeight;
// Store the hitbox width and height here. Final position will be updated in `draw`
hitboxes[i] = {
left: 0,
top: 0,
width: itemWidth,
height: fontSize
};
});
totalWidth += currentColWidth;
columnWidths.push(currentColWidth);
minSize.width += totalWidth;
}
}
me.width = minSize.width;
me.height = minSize.height;
},
afterFit: noop,
// Shared Methods
isHorizontal: function() {
return this.options.position === 'top' || this.options.position === 'bottom';
},
// Actualy draw the legend on the canvas
draw: function() {
var me = this;
var opts = me.options;
var labelOpts = opts.labels;
var globalDefault = Chart.defaults.global,
lineDefault = globalDefault.elements.line,
legendWidth = me.width,
lineWidths = me.lineWidths;
if (opts.display) {
var ctx = me.ctx,
cursor,
itemOrDefault = helpers.getValueOrDefault,
fontColor = itemOrDefault(labelOpts.fontColor, globalDefault.defaultFontColor),
fontSize = itemOrDefault(labelOpts.fontSize, globalDefault.defaultFontSize),
fontStyle = itemOrDefault(labelOpts.fontStyle, globalDefault.defaultFontStyle),
fontFamily = itemOrDefault(labelOpts.fontFamily, globalDefault.defaultFontFamily),
labelFont = helpers.fontString(fontSize, fontStyle, fontFamily);
// Canvas setup
ctx.textAlign = 'left';
ctx.textBaseline = 'top';
ctx.lineWidth = 0.5;
ctx.strokeStyle = fontColor; // for strikethrough effect
ctx.fillStyle = fontColor; // render in correct colour
ctx.font = labelFont;
var boxWidth = labelOpts.boxWidth,
hitboxes = me.legendHitBoxes;
// current position
var drawLegendBox = function(x, y, legendItem) {
if (isNaN(boxWidth) || boxWidth <= 0) {
return;
}
// Set the ctx for the box
ctx.save();
ctx.fillStyle = itemOrDefault(legendItem.fillStyle, globalDefault.defaultColor);
ctx.lineCap = itemOrDefault(legendItem.lineCap, lineDefault.borderCapStyle);
ctx.lineDashOffset = itemOrDefault(legendItem.lineDashOffset, lineDefault.borderDashOffset);
ctx.lineJoin = itemOrDefault(legendItem.lineJoin, lineDefault.borderJoinStyle);
ctx.lineWidth = itemOrDefault(legendItem.lineWidth, lineDefault.borderWidth);
ctx.strokeStyle = itemOrDefault(legendItem.strokeStyle, globalDefault.defaultColor);
var isLineWidthZero = (itemOrDefault(legendItem.lineWidth, lineDefault.borderWidth) === 0);
if (ctx.setLineDash) {
// IE 9 and 10 do not support line dash
ctx.setLineDash(itemOrDefault(legendItem.lineDash, lineDefault.borderDash));
}
if (opts.labels && opts.labels.usePointStyle) {
// Recalulate x and y for drawPoint() because its expecting
// x and y to be center of figure (instead of top left)
var radius = fontSize * Math.SQRT2 / 2;
var offSet = radius / Math.SQRT2;
var centerX = x + offSet;
var centerY = y + offSet;
// Draw pointStyle as legend symbol
Chart.canvasHelpers.drawPoint(ctx, legendItem.pointStyle, radius, centerX, centerY);
} else {
// Draw box as legend symbol
if (!isLineWidthZero) {
ctx.strokeRect(x, y, boxWidth, fontSize);
}
ctx.fillRect(x, y, boxWidth, fontSize);
}
ctx.restore();
};
var fillText = function(x, y, legendItem, textWidth) {
ctx.fillText(legendItem.text, boxWidth + (fontSize / 2) + x, y);
if (legendItem.hidden) {
// Strikethrough the text if hidden
ctx.beginPath();
ctx.lineWidth = 2;
ctx.moveTo(boxWidth + (fontSize / 2) + x, y + (fontSize / 2));
ctx.lineTo(boxWidth + (fontSize / 2) + x + textWidth, y + (fontSize / 2));
ctx.stroke();
}
};
// Horizontal
var isHorizontal = me.isHorizontal();
if (isHorizontal) {
cursor = {
x: me.left + ((legendWidth - lineWidths[0]) / 2),
y: me.top + labelOpts.padding,
line: 0
};
} else {
cursor = {
x: me.left + labelOpts.padding,
y: me.top + labelOpts.padding,
line: 0
};
}
var itemHeight = fontSize + labelOpts.padding;
helpers.each(me.legendItems, function(legendItem, i) {
var textWidth = ctx.measureText(legendItem.text).width,
width = labelOpts.usePointStyle ?
fontSize + (fontSize / 2) + textWidth :
boxWidth + (fontSize / 2) + textWidth,
x = cursor.x,
y = cursor.y;
if (isHorizontal) {
if (x + width >= legendWidth) {
y = cursor.y += itemHeight;
cursor.line++;
x = cursor.x = me.left + ((legendWidth - lineWidths[cursor.line]) / 2);
}
} else if (y + itemHeight > me.bottom) {
x = cursor.x = x + me.columnWidths[cursor.line] + labelOpts.padding;
y = cursor.y = me.top;
cursor.line++;
}
drawLegendBox(x, y, legendItem);
hitboxes[i].left = x;
hitboxes[i].top = y;
// Fill the actual label
fillText(x, y, legendItem, textWidth);
if (isHorizontal) {
cursor.x += width + (labelOpts.padding);
} else {
cursor.y += itemHeight;
}
});
}
},
// Handle an event
handleEvent: function(e) {
var me = this;
var opts = me.options;
var type = e.type === 'mouseup' ? 'click' : e.type;
if (type === 'mousemove') {
if (!opts.onHover) {
return;
}
} else if (type === 'click') {
if (!opts.onClick) {
return;
}
} else {
return;
}
var position = helpers.getRelativePosition(e, me.chart.chart),
x = position.x,
y = position.y;
if (x >= me.left && x <= me.right && y >= me.top && y <= me.bottom) {
// See if we are touching one of the dataset boxes
var lh = me.legendHitBoxes;
for (var i = 0; i < lh.length; ++i) {
var hitBox = lh[i];
if (x >= hitBox.left && x <= hitBox.left + hitBox.width && y >= hitBox.top && y <= hitBox.top + hitBox.height) {
// Touching an element
if (type === 'click') {
opts.onClick.call(me, e, me.legendItems[i]);
break;
} else if (type === 'mousemove') {
opts.onHover.call(me, e, me.legendItems[i]);
break;
}
}
}
}
}
});
// Register the legend plugin
Chart.plugins.register({
beforeInit: function(chartInstance) {
var opts = chartInstance.options;
var legendOpts = opts.legend;
if (legendOpts) {
chartInstance.legend = new Chart.Legend({
ctx: chartInstance.chart.ctx,
options: legendOpts,
chart: chartInstance
});
Chart.layoutService.addBox(chartInstance, chartInstance.legend);
}
}
});
};
| Yagouus/ProDiGen_IO | node_modules/angular-chart.js/node_modules/chart.js/src/core/core.legend.js | JavaScript | mit | 13,688 |
/*!
* smooth-scroll v9.1.1: Animate scrolling to anchor links
* (c) 2016 Chris Ferdinandi
* MIT License
* http://github.com/cferdinandi/smooth-scroll
*/
(function (root, factory) {
if ( typeof define === 'function' && define.amd ) {
define([], factory(root));
} else if ( typeof exports === 'object' ) {
module.exports = factory(root);
} else {
root.smoothScroll = factory(root);
}
})(typeof global !== 'undefined' ? global : this.window || this.global, function (root) {
'use strict';
//
// Variables
//
var smoothScroll = {}; // Object for public APIs
var supports = 'querySelector' in document && 'addEventListener' in root; // Feature test
var settings, eventTimeout, fixedHeader, headerHeight, animationInterval;
// Default settings
var defaults = {
selector: '[data-scroll]',
selectorHeader: '[data-scroll-header]',
speed: 500,
easing: 'easeInOutCubic',
offset: 0,
updateURL: true,
callback: function () {}
};
//
// Methods
//
/**
* Merge two or more objects. Returns a new object.
* @private
* @param {Boolean} deep If true, do a deep (or recursive) merge [optional]
* @param {Object} objects The objects to merge together
* @returns {Object} Merged values of defaults and options
*/
var extend = function () {
// Variables
var extended = {};
var deep = false;
var i = 0;
var length = arguments.length;
// Check if a deep merge
if ( Object.prototype.toString.call( arguments[0] ) === '[object Boolean]' ) {
deep = arguments[0];
i++;
}
// Merge the object into the extended object
var merge = function (obj) {
for ( var prop in obj ) {
if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) {
// If deep merge and property is an object, merge properties
if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) {
extended[prop] = extend( true, extended[prop], obj[prop] );
} else {
extended[prop] = obj[prop];
}
}
}
};
// Loop through each object and conduct a merge
for ( ; i < length; i++ ) {
var obj = arguments[i];
merge(obj);
}
return extended;
};
/**
* Get the height of an element.
* @private
* @param {Node} elem The element to get the height of
* @return {Number} The element's height in pixels
*/
var getHeight = function ( elem ) {
return Math.max( elem.scrollHeight, elem.offsetHeight, elem.clientHeight );
};
/**
* Get the closest matching element up the DOM tree.
* @private
* @param {Element} elem Starting element
* @param {String} selector Selector to match against (class, ID, data attribute, or tag)
* @return {Boolean|Element} Returns null if not match found
*/
var getClosest = function ( elem, selector ) {
// Variables
var firstChar = selector.charAt(0);
var supports = 'classList' in document.documentElement;
var attribute, value;
// If selector is a data attribute, split attribute from value
if ( firstChar === '[' ) {
selector = selector.substr(1, selector.length - 2);
attribute = selector.split( '=' );
if ( attribute.length > 1 ) {
value = true;
attribute[1] = attribute[1].replace( /"/g, '' ).replace( /'/g, '' );
}
}
// Get closest match
for ( ; elem && elem !== document; elem = elem.parentNode ) {
// If selector is a class
if ( firstChar === '.' ) {
if ( supports ) {
if ( elem.classList.contains( selector.substr(1) ) ) {
return elem;
}
} else {
if ( new RegExp('(^|\\s)' + selector.substr(1) + '(\\s|$)').test( elem.className ) ) {
return elem;
}
}
}
// If selector is an ID
if ( firstChar === '#' ) {
if ( elem.id === selector.substr(1) ) {
return elem;
}
}
// If selector is a data attribute
if ( firstChar === '[' ) {
if ( elem.hasAttribute( attribute[0] ) ) {
if ( value ) {
if ( elem.getAttribute( attribute[0] ) === attribute[1] ) {
return elem;
}
} else {
return elem;
}
}
}
// If selector is a tag
if ( elem.tagName.toLowerCase() === selector ) {
return elem;
}
}
return null;
};
/**
* Escape special characters for use with querySelector
* @public
* @param {String} id The anchor ID to escape
* @author Mathias Bynens
* @link https://github.com/mathiasbynens/CSS.escape
*/
smoothScroll.escapeCharacters = function ( id ) {
// Remove leading hash
if ( id.charAt(0) === '#' ) {
id = id.substr(1);
}
var string = String(id);
var length = string.length;
var index = -1;
var codeUnit;
var result = '';
var firstCodeUnit = string.charCodeAt(0);
while (++index < length) {
codeUnit = string.charCodeAt(index);
// Note: there’s no need to special-case astral symbols, surrogate
// pairs, or lone surrogates.
// If the character is NULL (U+0000), then throw an
// `InvalidCharacterError` exception and terminate these steps.
if (codeUnit === 0x0000) {
throw new InvalidCharacterError(
'Invalid character: the input contains U+0000.'
);
}
if (
// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
// U+007F, […]
(codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
// If the character is the first character and is in the range [0-9]
// (U+0030 to U+0039), […]
(index === 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
// If the character is the second character and is in the range [0-9]
// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
(
index === 1 &&
codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
firstCodeUnit === 0x002D
)
) {
// http://dev.w3.org/csswg/cssom/#escape-a-character-as-code-point
result += '\\' + codeUnit.toString(16) + ' ';
continue;
}
// If the character is not handled by one of the above rules and is
// greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
// is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
// U+005A), or [a-z] (U+0061 to U+007A), […]
if (
codeUnit >= 0x0080 ||
codeUnit === 0x002D ||
codeUnit === 0x005F ||
codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
codeUnit >= 0x0041 && codeUnit <= 0x005A ||
codeUnit >= 0x0061 && codeUnit <= 0x007A
) {
// the character itself
result += string.charAt(index);
continue;
}
// Otherwise, the escaped character.
// http://dev.w3.org/csswg/cssom/#escape-a-character
result += '\\' + string.charAt(index);
}
return '#' + result;
};
/**
* Calculate the easing pattern
* @private
* @link https://gist.github.com/gre/1650294
* @param {String} type Easing pattern
* @param {Number} time Time animation should take to complete
* @returns {Number}
*/
var easingPattern = function ( type, time ) {
var pattern;
if ( type === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity
if ( type === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity
if ( type === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration
if ( type === 'easeInCubic' ) pattern = time * time * time; // accelerating from zero velocity
if ( type === 'easeOutCubic' ) pattern = (--time) * time * time + 1; // decelerating to zero velocity
if ( type === 'easeInOutCubic' ) pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration
if ( type === 'easeInQuart' ) pattern = time * time * time * time; // accelerating from zero velocity
if ( type === 'easeOutQuart' ) pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity
if ( type === 'easeInOutQuart' ) pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration
if ( type === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity
if ( type === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity
if ( type === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration
return pattern || time; // no easing, no acceleration
};
/**
* Calculate how far to scroll
* @private
* @param {Element} anchor The anchor element to scroll to
* @param {Number} headerHeight Height of a fixed header, if any
* @param {Number} offset Number of pixels by which to offset scroll
* @returns {Number}
*/
var getEndLocation = function ( anchor, headerHeight, offset ) {
var location = 0;
if (anchor.offsetParent) {
do {
location += anchor.offsetTop;
anchor = anchor.offsetParent;
} while (anchor);
}
location = location - headerHeight - offset;
return location >= 0 ? location : 0;
};
/**
* Determine the document's height
* @private
* @returns {Number}
*/
var getDocumentHeight = function () {
return Math.max(
root.document.body.scrollHeight, root.document.documentElement.scrollHeight,
root.document.body.offsetHeight, root.document.documentElement.offsetHeight,
root.document.body.clientHeight, root.document.documentElement.clientHeight
);
};
/**
* Convert data-options attribute into an object of key/value pairs
* @private
* @param {String} options Link-specific options as a data attribute string
* @returns {Object}
*/
var getDataOptions = function ( options ) {
return !options || !(typeof JSON === 'object' && typeof JSON.parse === 'function') ? {} : JSON.parse( options );
};
/**
* Update the URL
* @private
* @param {Element} anchor The element to scroll to
* @param {Boolean} url Whether or not to update the URL history
*/
var updateUrl = function ( anchor, url ) {
if ( root.history.pushState && (url || url === 'true') && root.location.protocol !== 'file:' ) {
root.history.pushState( null, null, [root.location.protocol, '//', root.location.host, root.location.pathname, root.location.search, anchor].join('') );
}
};
var getHeaderHeight = function ( header ) {
return header === null ? 0 : ( getHeight( header ) + header.offsetTop );
};
/**
* Start/stop the scrolling animation
* @public
* @param {Element} anchor The element to scroll to
* @param {Element} toggle The element that toggled the scroll event
* @param {Object} options
*/
smoothScroll.animateScroll = function ( anchor, toggle, options ) {
// Options and overrides
var overrides = getDataOptions( toggle ? toggle.getAttribute('data-options') : null );
var animateSettings = extend( settings || defaults, options || {}, overrides ); // Merge user options with defaults
// Selectors and variables
var isNum = Object.prototype.toString.call( anchor ) === '[object Number]' ? true : false;
var anchorElem = isNum ? null : ( anchor === '#' ? root.document.documentElement : root.document.querySelector(anchor) );
if ( !isNum && !anchorElem ) return;
var startLocation = root.pageYOffset; // Current location on the page
if ( !fixedHeader ) { fixedHeader = root.document.querySelector( animateSettings.selectorHeader ); } // Get the fixed header if not already set
if ( !headerHeight ) { headerHeight = getHeaderHeight( fixedHeader ); } // Get the height of a fixed header if one exists and not already set
var endLocation = isNum ? anchor : getEndLocation( anchorElem, headerHeight, parseInt(animateSettings.offset, 10) ); // Location to scroll to
var distance = endLocation - startLocation; // distance to travel
var documentHeight = getDocumentHeight();
var timeLapsed = 0;
var percentage, position;
// Update URL
if ( !isNum ) {
updateUrl(anchor, animateSettings.updateURL);
}
/**
* Stop the scroll animation when it reaches its target (or the bottom/top of page)
* @private
* @param {Number} position Current position on the page
* @param {Number} endLocation Scroll to location
* @param {Number} animationInterval How much to scroll on this loop
*/
var stopAnimateScroll = function (position, endLocation, animationInterval) {
var currentLocation = root.pageYOffset;
if ( position == endLocation || currentLocation == endLocation || ( (root.innerHeight + currentLocation) >= documentHeight ) ) {
clearInterval(animationInterval);
if ( !isNum ) {
anchorElem.focus();
}
animateSettings.callback( anchor, toggle ); // Run callbacks after animation complete
}
};
/**
* Loop scrolling animation
* @private
*/
var loopAnimateScroll = function () {
timeLapsed += 16;
percentage = ( timeLapsed / parseInt(animateSettings.speed, 10) );
percentage = ( percentage > 1 ) ? 1 : percentage;
position = startLocation + ( distance * easingPattern(animateSettings.easing, percentage) );
root.scrollTo( 0, Math.floor(position) );
stopAnimateScroll(position, endLocation, animationInterval);
};
/**
* Set interval timer
* @private
*/
var startAnimateScroll = function () {
clearInterval(animationInterval);
animationInterval = setInterval(loopAnimateScroll, 16);
};
/**
* Reset position to fix weird iOS bug
* @link https://github.com/cferdinandi/smooth-scroll/issues/45
*/
if ( root.pageYOffset === 0 ) {
root.scrollTo( 0, 0 );
}
// Start scrolling animation
startAnimateScroll();
};
/**
* If smooth scroll element clicked, animate scroll
* @private
*/
var eventHandler = function (event) {
// Don't run if right-click or command/control + click
if ( event.button !== 0 || event.metaKey || event.ctrlKey ) return;
// If a smooth scroll link, animate it
var toggle = getClosest( event.target, settings.selector );
if ( toggle && toggle.tagName.toLowerCase() === 'a' ) {
event.preventDefault(); // Prevent default click event
var hash = smoothScroll.escapeCharacters( toggle.hash ); // Escape hash characters
smoothScroll.animateScroll( hash, toggle, settings); // Animate scroll
}
};
/**
* On window scroll and resize, only run events at a rate of 15fps for better performance
* @private
* @param {Function} eventTimeout Timeout function
* @param {Object} settings
*/
var eventThrottler = function (event) {
if ( !eventTimeout ) {
eventTimeout = setTimeout(function() {
eventTimeout = null; // Reset timeout
headerHeight = getHeaderHeight( fixedHeader ); // Get the height of a fixed header if one exists
}, 66);
}
};
/**
* Destroy the current initialization.
* @public
*/
smoothScroll.destroy = function () {
// If plugin isn't already initialized, stop
if ( !settings ) return;
// Remove event listeners
root.document.removeEventListener( 'click', eventHandler, false );
root.removeEventListener( 'resize', eventThrottler, false );
// Reset varaibles
settings = null;
eventTimeout = null;
fixedHeader = null;
headerHeight = null;
animationInterval = null;
};
/**
* Initialize Smooth Scroll
* @public
* @param {Object} options User settings
*/
smoothScroll.init = function ( options ) {
// feature test
if ( !supports ) return;
// Destroy any existing initializations
smoothScroll.destroy();
// Selectors and variables
settings = extend( defaults, options || {} ); // Merge user options with defaults
fixedHeader = root.document.querySelector( settings.selectorHeader ); // Get the fixed header
headerHeight = getHeaderHeight( fixedHeader );
// When a toggle is clicked, run the click handler
root.document.addEventListener('click', eventHandler, false );
if ( fixedHeader ) { root.addEventListener( 'resize', eventThrottler, false ); }
};
//
// Public APIs
//
return smoothScroll;
}); | sebastiaandekker/trafficexperts | js/smooth-scroll.js | JavaScript | mit | 15,959 |
/*! jsforce - v1.5.1 - 2016-01-14 */
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b=b.jsforce||(b.jsforce={}),b=b.modules||(b.modules={}),b=b.api||(b.api={}),b.Metadata=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){(function(c,d){"use strict";function e(a){var b=k.clone(a);return b.success="true"===b.success,b}function f(a){var b=e(a);return b.created="true"===b.created,b}function g(a){var b=k.clone(a);return delete b.$,b}var h=jsforce.require("inherits"),i=jsforce.require("events"),j=jsforce.require("readable-stream"),k=jsforce.require("underscore"),l=jsforce.require("./promise"),m=a("../soap"),n=b.exports=function(a){this._conn=a};n.prototype.pollInterval=1e3,n.prototype.pollTimeout=1e4,n.prototype._invoke=function(a,b,c){var d=new m(this._conn,{xmlns:"http://soap.sforce.com/2006/04/metadata",endpointUrl:this._conn.instanceUrl+"/services/Soap/m/"+this._conn.version});return d.invoke(a,b).then(function(a){return a.result}).thenCall(c)},n.prototype.createAsync=function(a,b,c){if(Number(this._conn.version)>30)throw new Error("Async metadata CRUD calls are not supported on ver 31.0 or later.");var d=function(b){return b["@xsi:type"]=a,b},e=k.isArray(b);b=e?k.map(b,d):d(b);var f=this._invoke("create",{metadata:b});return new o(this,f,e).thenCall(c)},n.prototype.createSync=n.prototype.create=function(a,b,c){var d=function(b){return b["@xsi:type"]=a,b},f=k.isArray(b);return b=f?k.map(b,d):d(b),this._invoke("createMetadata",{metadata:b}).then(function(a){return k.isArray(a)?k.map(a,e):e(a)}).thenCall(c)},n.prototype.readSync=n.prototype.read=function(a,b,c){return this._invoke("readMetadata",{type:a,fullNames:b}).then(function(a){return k.isArray(a.records)?k.map(a.records,g):g(a.records)}).thenCall(c)},n.prototype.updateAsync=function(a,b,c){if(Number(this._conn.version)>30)throw new Error("Async metadata CRUD calls are not supported on ver 31.0 or later.");var d=function(b){return b.metadata["@xsi:type"]=a,b},e=k.isArray(b);b=e?k.map(b,d):d(b);var f=this._invoke("update",{updateMetadata:b});return new o(this,f,e).thenCall(c)},n.prototype.updateSync=n.prototype.update=function(a,b,c){var d=function(b){return b["@xsi:type"]=a,b},f=k.isArray(b);return b=f?k.map(b,d):d(b),this._invoke("updateMetadata",{metadata:b}).then(function(a){return k.isArray(a)?k.map(a,e):e(a)}).thenCall(c)},n.prototype.upsertSync=n.prototype.upsert=function(a,b,c){var d=function(b){return b["@xsi:type"]=a,b},e=k.isArray(b);return b=e?k.map(b,d):d(b),this._invoke("upsertMetadata",{metadata:b}).then(function(a){return k.isArray(a)?k.map(a,f):f(a)}).thenCall(c)},n.prototype.deleteAsync=function(a,b,c){if(Number(this._conn.version)>30)throw new Error("Async metadata CRUD calls are not supported on ver 31.0 or later.");var d=function(b){return k.isString(b)&&(b={fullName:b}),b["@xsi:type"]=a,b},e=k.isArray(b);b=e?k.map(b,d):d(b);var f=this._invoke("delete",{metadata:b});return new o(this,f,e).thenCall(c)},n.prototype.del=n.prototype.deleteSync=n.prototype["delete"]=function(a,b,c){return this._invoke("deleteMetadata",{type:a,fullNames:b}).then(function(a){return k.isArray(a)?k.map(a,e):e(a)}).thenCall(c)},n.prototype.rename=function(a,b,c,d){return this._invoke("renameMetadata",{type:a,oldFullName:b,newFullName:c}).then(function(a){return e(a)}).thenCall(d)},n.prototype.checkStatus=function(a,b){var c=k.isArray(a),d=this._invoke("checkStatus",{asyncProcessId:a});return new o(this,d,c).thenCall(b)},n.prototype.describe=function(a,b){return k.isString(a)||(b=a,a=this._conn.version),this._invoke("describeMetadata",{asOfVersion:a}).then(function(a){return a.metadataObjects=k.isArray(a.metadataObjects)?a.metadataObjects:[a.metadataObjects],a.metadataObjects=k.map(a.metadataObjects,function(a){return a.childXmlNames&&(a.childXmlNames=k.isArray(a.childXmlNames)?a.childXmlNames:[a.childXmlNames]),a.inFolder="true"===a.inFolder,a.metaFile="true"===a.metaFile,a}),a.partialSaveAllowed="true"===a.partialSaveAllowed,a.testRequired="true"===a.testRequired,a}).thenCall(b)},n.prototype.list=function(a,b,c){return k.isString(b)||(c=b,b=this._conn.version),k.isArray(a)||(a=[a]),this._invoke("listMetadata",{queries:a,asOfVersion:b},c)},n.prototype.retrieve=function(a,b){var c=this._invoke("retrieve",{request:a});return new p(this,c).thenCall(b)},n.prototype.checkRetrieveStatus=function(a,b){return this._invoke("checkRetrieveStatus",{asyncProcessId:a},b)},n.prototype.deploy=function(a,b,c){(!b||k.isFunction(b))&&(c=b,b={});var e=l.defer();if(k.isObject(a)&&k.isFunction(a.pipe)){var f=[];a.on("data",function(a){f.push(a)}),a.on("end",function(){e.resolve(d.concat(f).toString("base64"))})}else if(a instanceof d)e.resolve(a.toString("base64"));else{if(!(a instanceof String||"string"==typeof a))throw"Unexpected zipInput type";e.resolve(a)}var g=this,h=e.promise.then(function(a){return g._invoke("deploy",{ZipFile:a,DeployOptions:b},c)});return new q(this,h).thenCall(c)},n.prototype.checkDeployStatus=function(a,b,c){return k.isObject(b)||k.isBoolean(b)?b=!!b:(c=b,b=!1),this._invoke("checkDeployStatus",{asyncProcessId:a,includeDetails:b}).then(function(a){return a.done="true"===a.done,a.success="true"===a.success,a.checkOnly="true"===a.checkOnly,a.ignoreWarnings&&(a.ignoreWarnings="true"===a.ignoreWarnings),a.rollbackOnError&&(a.rollbackOnError="true"===a.rollbackOnError),a.numberComponentErrors=Number(a.numberComponentErrors),a.numberComponentsDeployed=Number(a.numberComponentsDeployed),a.numberComponentsTotal=Number(a.numberComponentsTotal),a.numberTestErrors=Number(a.numberTestErrors),a.numberTestsCompleted=Number(a.numberTestsCompleted),a.numberTestsTotal=Number(a.numberTestsTotal),a}).thenCall(c)};var o=function(a,b,c){this._meta=a,this._results=b,this._isArray=c};h(o,i.EventEmitter),o.prototype.then=function(a,b){var c=this;return this._results.then(function(b){var d=function(a){return a.$&&"true"===a.$["xsi:nil"]?null:(a.done="true"===a.done,a)};return b=k.isArray(b)?k.map(b,d):d(b),c._isArray&&!k.isArray(b)&&(b=[b]),a(b)},b)},o.prototype.thenCall=function(a){return k.isFunction(a)?this.then(function(b){c.nextTick(function(){a(null,b)})},function(b){c.nextTick(function(){a(b)})}):this},o.prototype.check=function(a){var b=this,c=this._meta;return this.then(function(a){var d=k.isArray(a)?k.map(a,function(a){return a.id}):a.id;return b._ids=d,c.checkStatus(d)}).thenCall(a)},o.prototype.poll=function(a,b){var c=this,d=(new Date).getTime(),e=function(){var f=(new Date).getTime();if(f>d+b){var g="Polling time out.";return c._ids&&(g+=" Process Id = "+c._ids),void c.emit("error",new Error(g))}c.check().then(function(b){for(var d=!0,f=k.isArray(b)?b:[b],g=0,h=f.length;h>g;g++){var i=f[g];i&&!i.done&&(c.emit("progress",i),d=!1)}d?c.emit("complete",b):setTimeout(e,a)},function(a){c.emit("error",a)})};setTimeout(e,a)},o.prototype.complete=function(a){var b=l.defer();this.on("complete",function(a){b.resolve(a)}),this.on("error",function(a){b.reject(a)});var c=this._meta;return this.poll(c.pollInterval,c.pollTimeout),b.promise.thenCall(a)};var p=function(a,b){p.super_.call(this,a,b)};h(p,o),p.prototype.complete=function(a){var b=this._meta;return p.super_.prototype.complete.call(this).then(function(a){return b.checkRetrieveStatus(a.id)}).thenCall(a)},p.prototype.stream=function(){var a=this,b=new j.Readable,c=!1;return b._read=function(){c||(c=!0,a.complete(function(a,c){a?b.emit("error",a):(b.push(new d(c.zipFile,"base64")),b.push(null))}))},b};var q=function(a,b){q.super_.call(this,a,b)};h(q,o),q.prototype.complete=function(a,b){k.isFunction(a)&&(b=a,a=!1);var c=this._meta;return q.super_.prototype.complete.call(this).then(function(b){return c.checkDeployStatus(b.id,a)}).thenCall(b)}}).call(this,a("_process"),a("buffer").Buffer)},{"../soap":2,_process:9,buffer:4}],2:[function(a,b,c){"use strict";function d(a,b){if(h.isArray(a))return a.map(function(a){return d(a,b&&b[0])});if(h.isObject(a)){if(a.$&&"true"===a.$["xsi:nil"])return null;if(h.isArray(b))return[d(a,b[0])];var c={};for(var e in a)c[e]=d(a[e],b&&b[e]);return c}if(h.isArray(b))return[d(a,b[0])];if(h.isObject(b))return{};switch(b){case"string":return String(a);case"number":return Number(a);case"boolean":return"true"===a;default:return a}}function e(a,b){var c=b.shift();if(c){for(var d in a)if(c.test(d))return e(a[d],b);return null}return a}function f(a,b){if(h.isObject(a)&&(b=a,a=null),h.isArray(b))return h.map(b,function(b){return f(a,b)}).join("");var c=[],d=[];if(h.isObject(b)){for(var e in b){var g=b[e];"@"===e[0]?(e=e.substring(1),c.push(e+'="'+g+'"')):d.push(f(e,g))}b=d.join("")}else b=String(b).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");var i=a?"<"+a+(c.length>0?" "+c.join(" "):"")+">":"",j=a?"</"+a+">":"";return i+b+j}var g=jsforce.require("inherits"),h=jsforce.require("underscore"),i=(a("xml2js"),jsforce.require("./http-api")),j=b.exports=function(a,b){j.super_.apply(this,arguments),this._endpointUrl=b.endpointUrl,this._xmlns=b.xmlns||"urn:partner.soap.sforce.com"};g(j,i),j.prototype.invoke=function(a,b,c,e){"function"==typeof c&&(e=c,c=null);var f={};return f[a]=b,this.request({method:"POST",url:this._endpointUrl,headers:{"Content-Type":"text/xml",SOAPAction:'""'},message:f}).then(function(a){return c?d(a,c):a}).thenCall(e)},j.prototype.beforeSend=function(a){a.body=this._createEnvelope(a.message)},j.prototype.isSessionExpired=function(a){return 500===a.statusCode&&/<faultcode>[a-zA-Z]+:INVALID_SESSION_ID<\/faultcode>/.test(a.body)},j.prototype.parseError=function(a){var b=e(a,[/:Envelope$/,/:Body$/,/:Fault$/]);return{errorCode:b.faultcode,message:b.faultstring}},j.prototype.getResponseBody=function(a){var b=j.super_.prototype.getResponseBody.call(this,a);return e(b,[/:Envelope$/,/:Body$/,/.+/])},j.prototype._createEnvelope=function(a){var b={},c=this._conn;return c.accessToken&&(b.SessionHeader={sessionId:this._conn.accessToken}),c.callOptions&&(b.CallOptions=c.callOptions),['<?xml version="1.0" encoding="UTF-8"?>','<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"',' xmlns:xsd="http://www.w3.org/2001/XMLSchema"',' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">','<soapenv:Header xmlns="'+this._xmlns+'">',f(b),"</soapenv:Header>",'<soapenv:Body xmlns="'+this._xmlns+'">',f(a),"</soapenv:Body>","</soapenv:Envelope>"].join("")}},{xml2js:30}],3:[function(a,b,c){},{}],4:[function(a,b,c){function d(){return e.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function e(a){return this instanceof e?(this.length=0,this.parent=void 0,"number"==typeof a?f(this,a):"string"==typeof a?g(this,a,arguments.length>1?arguments[1]:"utf8"):h(this,a)):arguments.length>1?new e(a,arguments[1]):new e(a)}function f(a,b){if(a=o(a,0>b?0:0|p(b)),!e.TYPED_ARRAY_SUPPORT)for(var c=0;b>c;c++)a[c]=0;return a}function g(a,b,c){("string"!=typeof c||""===c)&&(c="utf8");var d=0|r(b,c);return a=o(a,d),a.write(b,c),a}function h(a,b){if(e.isBuffer(b))return i(a,b);if(X(b))return j(a,b);if(null==b)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(b.buffer instanceof ArrayBuffer)return k(a,b);if(b instanceof ArrayBuffer)return l(a,b)}return b.length?m(a,b):n(a,b)}function i(a,b){var c=0|p(b.length);return a=o(a,c),b.copy(a,0,0,c),a}function j(a,b){var c=0|p(b.length);a=o(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function k(a,b){var c=0|p(b.length);a=o(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function l(a,b){return e.TYPED_ARRAY_SUPPORT?(b.byteLength,a=e._augment(new Uint8Array(b))):a=k(a,new Uint8Array(b)),a}function m(a,b){var c=0|p(b.length);a=o(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function n(a,b){var c,d=0;"Buffer"===b.type&&X(b.data)&&(c=b.data,d=0|p(c.length)),a=o(a,d);for(var e=0;d>e;e+=1)a[e]=255&c[e];return a}function o(a,b){e.TYPED_ARRAY_SUPPORT?a=e._augment(new Uint8Array(b)):(a.length=b,a._isBuffer=!0);var c=0!==b&&b<=e.poolSize>>>1;return c&&(a.parent=Y),a}function p(a){if(a>=d())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d().toString(16)+" bytes");return 0|a}function q(a,b){if(!(this instanceof q))return new q(a,b);var c=new e(a,b);return delete c.parent,c}function r(a,b){"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"binary":case"raw":case"raws":return c;case"utf8":case"utf-8":return P(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return S(a).length;default:if(d)return P(a).length;b=(""+b).toLowerCase(),d=!0}}function s(a,b,c){var d=!1;if(b=0|b,c=void 0===c||c===1/0?this.length:0|c,a||(a="utf8"),0>b&&(b=0),c>this.length&&(c=this.length),b>=c)return"";for(;;)switch(a){case"hex":return D(this,b,c);case"utf8":case"utf-8":return A(this,b,c);case"ascii":return B(this,b,c);case"binary":return C(this,b,c);case"base64":return z(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function t(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new Error("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");a[c+g]=h}return g}function u(a,b,c,d){return T(P(b,a.length-c),a,c,d)}function v(a,b,c,d){return T(Q(b),a,c,d)}function w(a,b,c,d){return v(a,b,c,d)}function x(a,b,c,d){return T(S(b),a,c,d)}function y(a,b,c,d){return T(R(b,a.length-c),a,c,d)}function z(a,b,c){return 0===b&&c===a.length?V.fromByteArray(a):V.fromByteArray(a.slice(b,c))}function A(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=U(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+U(e)}function B(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(127&a[e]);return d}function C(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function D(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=O(a[f]);return e}function E(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function F(a,b,c){if(a%1!==0||0>a)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length")}function G(a,b,c,d,f,g){if(!e.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>f||g>b)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range")}function H(a,b,c,d){0>b&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);f>e;e++)a[c+e]=(b&255<<8*(d?e:1-e))>>>8*(d?e:1-e)}function I(a,b,c,d){0>b&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);f>e;e++)a[c+e]=b>>>8*(d?e:3-e)&255}function J(a,b,c,d,e,f){if(b>e||f>b)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range");if(0>c)throw new RangeError("index out of range")}function K(a,b,c,d,e){return e||J(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(a,b,c,d,23,4),c+4}function L(a,b,c,d,e){return e||J(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(a,b,c,d,52,8),c+8}function M(a){if(a=N(a).replace($,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function N(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function O(a){return 16>a?"0"+a.toString(16):a.toString(16)}function P(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;d>g;g++){if(c=a.charCodeAt(g),c>55295&&57344>c){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(56320>c){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=e-55296<<10|c-56320|65536,e=null}else e&&((b-=3)>-1&&f.push(239,191,189),e=null);if(128>c){if((b-=1)<0)break;f.push(c)}else if(2048>c){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(65536>c){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(2097152>c))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function Q(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function R(a,b){for(var c,d,e,f=[],g=0;g<a.length&&!((b-=2)<0);g++)c=a.charCodeAt(g),d=c>>8,e=c%256,f.push(e),f.push(d);return f}function S(a){return V.toByteArray(M(a))}function T(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function U(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}var V=a("base64-js"),W=a("ieee754"),X=a("is-array");c.Buffer=e,c.SlowBuffer=q,c.INSPECT_MAX_BYTES=50,e.poolSize=8192;var Y={};e.TYPED_ARRAY_SUPPORT=function(){function a(){}try{var b=new Uint8Array(1);return b.foo=function(){return 42},b.constructor=a,42===b.foo()&&b.constructor===a&&"function"==typeof b.subarray&&0===b.subarray(1,1).byteLength}catch(c){return!1}}(),e.isBuffer=function(a){return!(null==a||!a._isBuffer)},e.compare=function(a,b){if(!e.isBuffer(a)||!e.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,f=0,g=Math.min(c,d);g>f&&a[f]===b[f];)++f;return f!==g&&(c=a[f],d=b[f]),d>c?-1:c>d?1:0},e.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},e.concat=function(a,b){if(!X(a))throw new TypeError("list argument must be an Array of Buffers.");if(0===a.length)return new e(0);var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var d=new e(b),f=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(d,f),f+=g.length}return d},e.byteLength=r,e.prototype.length=void 0,e.prototype.parent=void 0,e.prototype.toString=function(){var a=0|this.length;return 0===a?"":0===arguments.length?A(this,0,a):s.apply(this,arguments)},e.prototype.equals=function(a){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:0===e.compare(this,a)},e.prototype.inspect=function(){var a="",b=c.INSPECT_MAX_BYTES;return this.length>0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),"<Buffer "+a+">"},e.prototype.compare=function(a){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?0:e.compare(this,a)},e.prototype.indexOf=function(a,b){function c(a,b,c){for(var d=-1,e=0;c+e<a.length;e++)if(a[c+e]===b[-1===d?0:e-d]){if(-1===d&&(d=e),e-d+1===b.length)return c+d}else d=-1;return-1}if(b>2147483647?b=2147483647:-2147483648>b&&(b=-2147483648),b>>=0,0===this.length)return-1;if(b>=this.length)return-1;if(0>b&&(b=Math.max(this.length+b,0)),"string"==typeof a)return 0===a.length?-1:String.prototype.indexOf.call(this,a,b);if(e.isBuffer(a))return c(this,a,b);if("number"==typeof a)return e.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,a,b):c(this,[a],b);throw new TypeError("val must be string, number or Buffer")},e.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},e.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},e.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else if(isFinite(b))b=0|b,isFinite(c)?(c=0|c,void 0===d&&(d="utf8")):(d=c,c=void 0);else{var e=d;d=b,b=0|c,c=e}var f=this.length-b;if((void 0===c||c>f)&&(c=f),a.length>0&&(0>c||0>b)||b>this.length)throw new RangeError("attempt to write outside buffer bounds");d||(d="utf8");for(var g=!1;;)switch(d){case"hex":return t(this,a,b,c);case"utf8":case"utf-8":return u(this,a,b,c);case"ascii":return v(this,a,b,c);case"binary":return w(this,a,b,c);case"base64":return x(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,a,b,c);default:if(g)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),g=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},e.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a);var d;if(e.TYPED_ARRAY_SUPPORT)d=e._augment(this.subarray(a,b));else{var f=b-a;d=new e(f,void 0);for(var g=0;f>g;g++)d[g]=this[g+a]}return d.length&&(d.parent=this.parent||this),d},e.prototype.readUIntLE=function(a,b,c){a=0|a,b=0|b,c||F(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return d},e.prototype.readUIntBE=function(a,b,c){a=0|a,b=0|b,c||F(a,b,this.length);for(var d=this[a+--b],e=1;b>0&&(e*=256);)d+=this[a+--b]*e;return d},e.prototype.readUInt8=function(a,b){return b||F(a,1,this.length),this[a]},e.prototype.readUInt16LE=function(a,b){return b||F(a,2,this.length),this[a]|this[a+1]<<8},e.prototype.readUInt16BE=function(a,b){return b||F(a,2,this.length),this[a]<<8|this[a+1]},e.prototype.readUInt32LE=function(a,b){return b||F(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},e.prototype.readUInt32BE=function(a,b){return b||F(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},e.prototype.readIntLE=function(a,b,c){a=0|a,b=0|b,c||F(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return e*=128,d>=e&&(d-=Math.pow(2,8*b)),d},e.prototype.readIntBE=function(a,b,c){a=0|a,b=0|b,c||F(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},e.prototype.readInt8=function(a,b){return b||F(a,1,this.length),128&this[a]?-1*(255-this[a]+1):this[a]},e.prototype.readInt16LE=function(a,b){b||F(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},e.prototype.readInt16BE=function(a,b){b||F(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},e.prototype.readInt32LE=function(a,b){return b||F(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},e.prototype.readInt32BE=function(a,b){return b||F(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},e.prototype.readFloatLE=function(a,b){return b||F(a,4,this.length),W.read(this,a,!0,23,4)},e.prototype.readFloatBE=function(a,b){return b||F(a,4,this.length),W.read(this,a,!1,23,4)},e.prototype.readDoubleLE=function(a,b){return b||F(a,8,this.length),W.read(this,a,!0,52,8)},e.prototype.readDoubleBE=function(a,b){return b||F(a,8,this.length),W.read(this,a,!1,52,8)},e.prototype.writeUIntLE=function(a,b,c,d){a=+a,b=0|b,c=0|c,d||G(this,a,b,c,Math.pow(2,8*c),0);var e=1,f=0;for(this[b]=255&a;++f<c&&(e*=256);)this[b+f]=a/e&255;return b+c},e.prototype.writeUIntBE=function(a,b,c,d){a=+a,b=0|b,c=0|c,d||G(this,a,b,c,Math.pow(2,8*c),0);var e=c-1,f=1;for(this[b+e]=255&a;--e>=0&&(f*=256);)this[b+e]=a/f&255;return b+c},e.prototype.writeUInt8=function(a,b,c){return a=+a,b=0|b,c||G(this,a,b,1,255,0),e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=a,b+1},e.prototype.writeUInt16LE=function(a,b,c){return a=+a,b=0|b,c||G(this,a,b,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):H(this,a,b,!0),b+2},e.prototype.writeUInt16BE=function(a,b,c){return a=+a,b=0|b,c||G(this,a,b,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):H(this,a,b,!1),b+2},e.prototype.writeUInt32LE=function(a,b,c){return a=+a,b=0|b,c||G(this,a,b,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=a):I(this,a,b,!0),b+4},e.prototype.writeUInt32BE=function(a,b,c){return a=+a,b=0|b,c||G(this,a,b,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a):I(this,a,b,!1),b+4},e.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);G(this,a,b,c,e-1,-e)}var f=0,g=1,h=0>a?1:0;for(this[b]=255&a;++f<c&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},e.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);G(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0>a?1:0;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},e.prototype.writeInt8=function(a,b,c){return a=+a,b=0|b,c||G(this,a,b,1,127,-128),e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),0>a&&(a=255+a+1),this[b]=a,b+1},e.prototype.writeInt16LE=function(a,b,c){return a=+a,b=0|b,c||G(this,a,b,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):H(this,a,b,!0),b+2},e.prototype.writeInt16BE=function(a,b,c){return a=+a,b=0|b,c||G(this,a,b,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):H(this,a,b,!1),b+2},e.prototype.writeInt32LE=function(a,b,c){return a=+a,b=0|b,c||G(this,a,b,4,2147483647,-2147483648),e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):I(this,a,b,!0),b+4},e.prototype.writeInt32BE=function(a,b,c){return a=+a,b=0|b,c||G(this,a,b,4,2147483647,-2147483648),0>a&&(a=4294967295+a+1),e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a):I(this,a,b,!1),b+4},e.prototype.writeFloatLE=function(a,b,c){return K(this,a,b,!0,c)},e.prototype.writeFloatBE=function(a,b,c){return K(this,a,b,!1,c)},e.prototype.writeDoubleLE=function(a,b,c){return L(this,a,b,!0,c)},e.prototype.writeDoubleBE=function(a,b,c){return L(this,a,b,!1,c)},e.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&c>d&&(d=c),d===c)return 0;if(0===a.length||0===this.length)return 0;if(0>b)throw new RangeError("targetStart out of bounds");if(0>c||c>=this.length)throw new RangeError("sourceStart out of bounds");if(0>d)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var f,g=d-c;if(this===a&&b>c&&d>b)for(f=g-1;f>=0;f--)a[f+b]=this[f+c];else if(1e3>g||!e.TYPED_ARRAY_SUPPORT)for(f=0;g>f;f++)a[f+b]=this[f+c];else a._set(this.subarray(c,c+g),b);return g},e.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),b>c)throw new RangeError("end < start");if(c!==b&&0!==this.length){if(0>b||b>=this.length)throw new RangeError("start out of bounds");if(0>c||c>this.length)throw new RangeError("end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=P(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},e.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(e.TYPED_ARRAY_SUPPORT)return new e(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var Z=e.prototype;e._augment=function(a){return a.constructor=e,a._isBuffer=!0,a._set=a.set,a.get=Z.get,a.set=Z.set,a.write=Z.write,a.toString=Z.toString,a.toLocaleString=Z.toString,a.toJSON=Z.toJSON,a.equals=Z.equals,a.compare=Z.compare,a.indexOf=Z.indexOf,a.copy=Z.copy,a.slice=Z.slice,a.readUIntLE=Z.readUIntLE,a.readUIntBE=Z.readUIntBE,a.readUInt8=Z.readUInt8,a.readUInt16LE=Z.readUInt16LE,a.readUInt16BE=Z.readUInt16BE,a.readUInt32LE=Z.readUInt32LE,a.readUInt32BE=Z.readUInt32BE,a.readIntLE=Z.readIntLE,a.readIntBE=Z.readIntBE,a.readInt8=Z.readInt8,a.readInt16LE=Z.readInt16LE,a.readInt16BE=Z.readInt16BE,a.readInt32LE=Z.readInt32LE,a.readInt32BE=Z.readInt32BE,a.readFloatLE=Z.readFloatLE,a.readFloatBE=Z.readFloatBE,a.readDoubleLE=Z.readDoubleLE,a.readDoubleBE=Z.readDoubleBE,a.writeUInt8=Z.writeUInt8,a.writeUIntLE=Z.writeUIntLE,a.writeUIntBE=Z.writeUIntBE,a.writeUInt16LE=Z.writeUInt16LE,a.writeUInt16BE=Z.writeUInt16BE,a.writeUInt32LE=Z.writeUInt32LE,a.writeUInt32BE=Z.writeUInt32BE,a.writeIntLE=Z.writeIntLE,a.writeIntBE=Z.writeIntBE,a.writeInt8=Z.writeInt8,a.writeInt16LE=Z.writeInt16LE,a.writeInt16BE=Z.writeInt16BE,a.writeInt32LE=Z.writeInt32LE,a.writeInt32BE=Z.writeInt32BE,a.writeFloatLE=Z.writeFloatLE,a.writeFloatBE=Z.writeFloatBE,a.writeDoubleLE=Z.writeDoubleLE,a.writeDoubleBE=Z.writeDoubleBE,a.fill=Z.fill,a.inspect=Z.inspect,a.toArrayBuffer=Z.toArrayBuffer,a};var $=/[^+\/0-9A-Za-z-_]/g},{"base64-js":5,ieee754:6,"is-array":7}],5:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g||b===l?62:b===h||b===m?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0),l="-".charCodeAt(0),m="_".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],6:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],7:[function(a,b,c){var d=Array.isArray,e=Object.prototype.toString;b.exports=d||function(a){return!!a&&"[object Array]"==e.call(a)}},{}],8:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;
throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];c.apply(this,f)}else if(g(c)){for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];for(j=c.slice(),d=j.length,i=0;d>i;i++)j[i].apply(this,f)}return!0},d.prototype.addListener=function(a,b){var c;if(!e(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,e(b.listener)?b.listener:b),this._events[a]?g(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,g(this._events[a])&&!this._events[a].warned){var c;c=h(this._maxListeners)?d.defaultMaxListeners:this._maxListeners,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-->0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(0>d)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?e(a._events[b])?1:a._events[b].length:0}},{}],9:[function(a,b,c){function d(){k=!1,h.length?j=h.concat(j):l=-1,j.length&&e()}function e(){if(!k){var a=setTimeout(d);k=!0;for(var b=j.length;b;){for(h=j,j=[];++l<b;)h[l].run();l=-1,b=j.length}h=null,k=!1,clearTimeout(a)}}function f(a,b){this.fun=a,this.array=b}function g(){}var h,i=b.exports={},j=[],k=!1,l=-1;i.nextTick=function(a){var b=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];j.push(new f(a,b)),1!==j.length||k||setTimeout(e,0)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.binding=function(a){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(a){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],10:[function(a,b,c){function d(){e.call(this)}b.exports=d;var e=a("events").EventEmitter,f=a("inherits");f(d,e),d.Readable=a("readable-stream/readable.js"),d.Writable=a("readable-stream/writable.js"),d.Duplex=a("readable-stream/duplex.js"),d.Transform=a("readable-stream/transform.js"),d.PassThrough=a("readable-stream/passthrough.js"),d.Stream=d,d.prototype.pipe=function(a,b){function c(b){a.writable&&!1===a.write(b)&&j.pause&&j.pause()}function d(){j.readable&&j.resume&&j.resume()}function f(){k||(k=!0,a.end())}function g(){k||(k=!0,"function"==typeof a.destroy&&a.destroy())}function h(a){if(i(),0===e.listenerCount(this,"error"))throw a}function i(){j.removeListener("data",c),a.removeListener("drain",d),j.removeListener("end",f),j.removeListener("close",g),j.removeListener("error",h),a.removeListener("error",h),j.removeListener("end",i),j.removeListener("close",i),a.removeListener("close",i)}var j=this;j.on("data",c),a.on("drain",d),a._isStdio||b&&b.end===!1||(j.on("end",f),j.on("close",g));var k=!1;return j.on("error",h),a.on("error",h),j.on("end",i),j.on("close",i),a.on("close",i),a.emit("pipe",j),a}},{events:8,inherits:12,"readable-stream/duplex.js":13,"readable-stream/passthrough.js":24,"readable-stream/readable.js":25,"readable-stream/transform.js":26,"readable-stream/writable.js":27}],11:[function(a,b,c){function d(a){if(a&&!i(a))throw new Error("Unknown encoding: "+a)}function e(a){return a.toString(this.encoding)}function f(a){this.charReceived=a.length%2,this.charLength=this.charReceived?2:0}function g(a){this.charReceived=a.length%3,this.charLength=this.charReceived?3:0}var h=a("buffer").Buffer,i=h.isEncoding||function(a){switch(a&&a.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},j=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),d(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:return void(this.write=e)}this.charBuffer=new h(6),this.charReceived=0,this.charLength=0};j.prototype.write=function(a){for(var b="";this.charLength;){var c=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived<this.charLength)return"";a=a.slice(c,a.length),b=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var d=b.charCodeAt(b.length-1);if(!(d>=55296&&56319>=d)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&56319>=d){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},j.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(2>=b&&c>>4==14){this.charLength=3;break}if(3>=b&&c>>3==30){this.charLength=4;break}}this.charReceived=b},j.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:4}],12:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],13:[function(a,b,c){b.exports=a("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":14}],14:[function(a,b,c){"use strict";function d(a){return this instanceof d?(j.call(this,a),k.call(this,a),a&&a.readable===!1&&(this.readable=!1),a&&a.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,a&&a.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",e)):new d(a)}function e(){this.allowHalfOpen||this._writableState.ended||h(f,this)}function f(a){a.end()}var g=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b};b.exports=d;var h=a("process-nextick-args"),i=a("core-util-is");i.inherits=a("inherits");var j=a("./_stream_readable"),k=a("./_stream_writable");i.inherits(d,j);for(var l=g(k.prototype),m=0;m<l.length;m++){var n=l[m];d.prototype[n]||(d.prototype[n]=k.prototype[n])}},{"./_stream_readable":16,"./_stream_writable":18,"core-util-is":19,inherits:12,"process-nextick-args":21}],15:[function(a,b,c){"use strict";function d(a){return this instanceof d?void e.call(this,a):new d(a)}b.exports=d;var e=a("./_stream_transform"),f=a("core-util-is");f.inherits=a("inherits"),f.inherits(d,e),d.prototype._transform=function(a,b,c){c(null,a)}},{"./_stream_transform":17,"core-util-is":19,inherits:12}],16:[function(a,b,c){(function(c){"use strict";function d(b,c){var d=a("./_stream_duplex");b=b||{},this.objectMode=!!b.objectMode,c instanceof d&&(this.objectMode=this.objectMode||!!b.readableObjectMode);var e=b.highWaterMark,f=this.objectMode?16:16384;this.highWaterMark=e||0===e?e:f,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(G||(G=a("string_decoder/").StringDecoder),this.decoder=new G(b.encoding),this.encoding=b.encoding)}function e(b){a("./_stream_duplex");return this instanceof e?(this._readableState=new d(b,this),this.readable=!0,b&&"function"==typeof b.read&&(this._read=b.read),void D.call(this)):new e(b)}function f(a,b,c,d,e){var f=j(b,c);if(f)a.emit("error",f);else if(null===c)b.reading=!1,k(a,b);else if(b.objectMode||c&&c.length>0)if(b.ended&&!e){var h=new Error("stream.push() after EOF");a.emit("error",h)}else if(b.endEmitted&&e){var h=new Error("stream.unshift() after end event");a.emit("error",h)}else!b.decoder||e||d||(c=b.decoder.write(c)),e||(b.reading=!1),b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&l(a)),n(a,b);else e||(b.reading=!1);return g(b)}function g(a){return!a.ended&&(a.needReadable||a.length<a.highWaterMark||0===a.length)}function h(a){if(a>=H)a=H;else{a--;for(var b=1;32>b;b<<=1)a|=a>>b;a++}return a}function i(a,b){return 0===b.length&&b.ended?0:b.objectMode?0===a?0:1:null===a||isNaN(a)?b.flowing&&b.buffer.length?b.buffer[0].length:b.length:0>=a?0:(a>b.highWaterMark&&(b.highWaterMark=h(a)),a>b.length?b.ended?b.length:(b.needReadable=!0,0):a)}function j(a,b){var c=null;return B.isBuffer(b)||"string"==typeof b||null===b||void 0===b||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function k(a,b){if(!b.ended){if(b.decoder){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,l(a)}}function l(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(F("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?z(m,a):m(a))}function m(a){F("emit readable"),a.emit("readable"),t(a)}function n(a,b){b.readingMore||(b.readingMore=!0,z(o,a,b))}function o(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length<b.highWaterMark&&(F("maybeReadMore read 0"),a.read(0),c!==b.length);)c=b.length;b.readingMore=!1}function p(a){return function(){var b=a._readableState;F("pipeOnDrain",b.awaitDrain),b.awaitDrain&&b.awaitDrain--,0===b.awaitDrain&&C.listenerCount(a,"data")&&(b.flowing=!0,t(a))}}function q(a){F("readable nexttick read 0"),a.read(0)}function r(a,b){b.resumeScheduled||(b.resumeScheduled=!0,z(s,a,b))}function s(a,b){b.reading||(F("resume read 0"),a.read(0)),b.resumeScheduled=!1,a.emit("resume"),t(a),b.flowing&&!b.reading&&a.read(0)}function t(a){var b=a._readableState;if(F("flow",b.flowing),b.flowing)do var c=a.read();while(null!==c&&b.flowing)}function u(a,b){var c,d=b.buffer,e=b.length,f=!!b.decoder,g=!!b.objectMode;if(0===d.length)return null;if(0===e)c=null;else if(g)c=d.shift();else if(!a||a>=e)c=f?d.join(""):B.concat(d,e),d.length=0;else if(a<d[0].length){var h=d[0];c=h.slice(0,a),d[0]=h.slice(a)}else if(a===d[0].length)c=d.shift();else{c=f?"":new B(a);for(var i=0,j=0,k=d.length;k>j&&a>i;j++){var h=d[0],l=Math.min(a-i,h.length);f?c+=h.slice(0,l):h.copy(c,i,0,l),l<h.length?d[0]=h.slice(l):d.shift(),i+=l}}return c}function v(a){var b=a._readableState;if(b.length>0)throw new Error("endReadable called on non-empty stream");b.endEmitted||(b.ended=!0,z(w,b,a))}function w(a,b){a.endEmitted||0!==a.length||(a.endEmitted=!0,b.readable=!1,b.emit("end"))}function x(a,b){for(var c=0,d=a.length;d>c;c++)b(a[c],c)}function y(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}b.exports=e;var z=a("process-nextick-args"),A=a("isarray"),B=a("buffer").Buffer;e.ReadableState=d;var C=a("events").EventEmitter;C.listenerCount||(C.listenerCount=function(a,b){return a.listeners(b).length});var D;!function(){try{D=a("stream")}catch(b){}finally{D||(D=a("events").EventEmitter)}}();var B=a("buffer").Buffer,E=a("core-util-is");E.inherits=a("inherits");var F=a("util");F=F&&F.debuglog?F.debuglog("stream"):function(){};var G;E.inherits(e,D),e.prototype.push=function(a,b){var c=this._readableState;return c.objectMode||"string"!=typeof a||(b=b||c.defaultEncoding,b!==c.encoding&&(a=new B(a,b),b="")),f(this,c,a,b,!1)},e.prototype.unshift=function(a){var b=this._readableState;return f(this,b,a,"",!0)},e.prototype.isPaused=function(){return this._readableState.flowing===!1},e.prototype.setEncoding=function(b){return G||(G=a("string_decoder/").StringDecoder),this._readableState.decoder=new G(b),this._readableState.encoding=b,this};var H=8388608;e.prototype.read=function(a){F("read",a);var b=this._readableState,c=a;if(("number"!=typeof a||a>0)&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return F("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?v(this):l(this),null;if(a=i(a,b),0===a&&b.ended)return 0===b.length&&v(this),null;var d=b.needReadable;F("need readable",d),(0===b.length||b.length-a<b.highWaterMark)&&(d=!0,F("length less than watermark",d)),(b.ended||b.reading)&&(d=!1,F("reading or ended",d)),d&&(F("do read"),b.reading=!0,b.sync=!0,0===b.length&&(b.needReadable=!0),this._read(b.highWaterMark),b.sync=!1),d&&!b.reading&&(a=i(c,b));var e;return e=a>0?u(a,b):null,null===e&&(b.needReadable=!0,a=0),b.length-=a,0!==b.length||b.ended||(b.needReadable=!0),c!==a&&b.ended&&0===b.length&&v(this),null!==e&&this.emit("data",e),e},e.prototype._read=function(a){this.emit("error",new Error("not implemented"))},e.prototype.pipe=function(a,b){function d(a){F("onunpipe"),a===l&&f()}function e(){F("onend"),a.end()}function f(){F("cleanup"),a.removeListener("close",i),a.removeListener("finish",j),a.removeListener("drain",q),a.removeListener("error",h),a.removeListener("unpipe",d),l.removeListener("end",e),l.removeListener("end",f),l.removeListener("data",g),!m.awaitDrain||a._writableState&&!a._writableState.needDrain||q()}function g(b){F("ondata");var c=a.write(b);!1===c&&(F("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++,l.pause())}function h(b){F("onerror",b),k(),a.removeListener("error",h),0===C.listenerCount(a,"error")&&a.emit("error",b)}function i(){a.removeListener("finish",j),k()}function j(){F("onfinish"),a.removeListener("close",i),k()}function k(){F("unpipe"),l.unpipe(a)}var l=this,m=this._readableState;switch(m.pipesCount){case 0:m.pipes=a;break;case 1:m.pipes=[m.pipes,a];break;default:m.pipes.push(a)}m.pipesCount+=1,F("pipe count=%d opts=%j",m.pipesCount,b);var n=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,o=n?e:f;m.endEmitted?z(o):l.once("end",o),a.on("unpipe",d);var q=p(l);return a.on("drain",q),l.on("data",g),a._events&&a._events.error?A(a._events.error)?a._events.error.unshift(h):a._events.error=[h,a._events.error]:a.on("error",h),a.once("close",i),a.once("finish",j),a.emit("pipe",l),m.flowing||(F("pipe resume"),l.resume()),a},e.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var e=0;d>e;e++)c[e].emit("unpipe",this);return this}var e=y(b.pipes,a);return-1===e?this:(b.pipes.splice(e,1),b.pipesCount-=1,1===b.pipesCount&&(b.pipes=b.pipes[0]),a.emit("unpipe",this),this)},e.prototype.on=function(a,b){var c=D.prototype.on.call(this,a,b);if("data"===a&&!1!==this._readableState.flowing&&this.resume(),"readable"===a&&this.readable){var d=this._readableState;d.readableListening||(d.readableListening=!0,d.emittedReadable=!1,d.needReadable=!0,d.reading?d.length&&l(this,d):z(q,this))}return c},e.prototype.addListener=e.prototype.on,e.prototype.resume=function(){var a=this._readableState;return a.flowing||(F("resume"),a.flowing=!0,r(this,a)),this},e.prototype.pause=function(){return F("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(F("pause"),this._readableState.flowing=!1,this.emit("pause")),this},e.prototype.wrap=function(a){var b=this._readableState,c=!1,d=this;a.on("end",function(){if(F("wrapped end"),b.decoder&&!b.ended){var a=b.decoder.end();a&&a.length&&d.push(a)}d.push(null)}),a.on("data",function(e){if(F("wrapped data"),b.decoder&&(e=b.decoder.write(e)),(!b.objectMode||null!==e&&void 0!==e)&&(b.objectMode||e&&e.length)){var f=d.push(e);f||(c=!0,a.pause())}});for(var e in a)void 0===this[e]&&"function"==typeof a[e]&&(this[e]=function(b){return function(){return a[b].apply(a,arguments)}}(e));var f=["error","close","destroy","pause","resume"];return x(f,function(b){a.on(b,d.emit.bind(d,b))}),d._read=function(b){F("wrapped _read",b),c&&(c=!1,a.resume())},d},e._fromList=u}).call(this,a("_process"))},{"./_stream_duplex":14,_process:9,buffer:4,"core-util-is":19,events:8,inherits:12,isarray:20,"process-nextick-args":21,"string_decoder/":22,util:3}],17:[function(a,b,c){"use strict";function d(a){this.afterTransform=function(b,c){return e(a,b,c)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function e(a,b,c){var d=a._transformState;d.transforming=!1;var e=d.writecb;if(!e)return a.emit("error",new Error("no writecb in Transform class"));d.writechunk=null,d.writecb=null,null!==c&&void 0!==c&&a.push(c),e&&e(b);var f=a._readableState;f.reading=!1,(f.needReadable||f.length<f.highWaterMark)&&a._read(f.highWaterMark)}function f(a){if(!(this instanceof f))return new f(a);h.call(this,a),this._transformState=new d(this);var b=this;this._readableState.needReadable=!0,this._readableState.sync=!1,a&&("function"==typeof a.transform&&(this._transform=a.transform),"function"==typeof a.flush&&(this._flush=a.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(a){g(b,a)}):g(b)})}function g(a,b){if(b)return a.emit("error",b);var c=a._writableState,d=a._transformState;if(c.length)throw new Error("calling transform done when ws.length != 0");if(d.transforming)throw new Error("calling transform done when still transforming");return a.push(null)}b.exports=f;var h=a("./_stream_duplex"),i=a("core-util-is");i.inherits=a("inherits"),i.inherits(f,h),f.prototype.push=function(a,b){return this._transformState.needTransform=!1,h.prototype.push.call(this,a,b)},f.prototype._transform=function(a,b,c){throw new Error("not implemented")},f.prototype._write=function(a,b,c){var d=this._transformState;if(d.writecb=c,d.writechunk=a,d.writeencoding=b,!d.transforming){var e=this._readableState;(d.needTransform||e.needReadable||e.length<e.highWaterMark)&&this._read(e.highWaterMark)}},f.prototype._read=function(a){var b=this._transformState;null!==b.writechunk&&b.writecb&&!b.transforming?(b.transforming=!0,this._transform(b.writechunk,b.writeencoding,b.afterTransform)):b.needTransform=!0}},{"./_stream_duplex":14,"core-util-is":19,inherits:12}],18:[function(a,b,c){"use strict";function d(){}function e(a,b,c){this.chunk=a,this.encoding=b,this.callback=c,this.next=null}function f(b,c){var d=a("./_stream_duplex");b=b||{},this.objectMode=!!b.objectMode,c instanceof d&&(this.objectMode=this.objectMode||!!b.writableObjectMode);var e=b.highWaterMark,f=this.objectMode?16:16384;this.highWaterMark=e||0===e?e:f,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var g=b.decodeStrings===!1;this.decodeStrings=!g,this.defaultEncoding=b.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){o(c,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1}function g(b){var c=a("./_stream_duplex");return this instanceof g||this instanceof c?(this._writableState=new f(b,this),this.writable=!0,b&&("function"==typeof b.write&&(this._write=b.write),"function"==typeof b.writev&&(this._writev=b.writev)),void z.call(this)):new g(b)}function h(a,b){var c=new Error("write after end");a.emit("error",c),w(b,c)}function i(a,b,c,d){var e=!0;if(!x.isBuffer(c)&&"string"!=typeof c&&null!==c&&void 0!==c&&!b.objectMode){var f=new TypeError("Invalid non-string/buffer chunk");a.emit("error",f),w(d,f),e=!1}return e}function j(a,b,c){return a.objectMode||a.decodeStrings===!1||"string"!=typeof b||(b=new x(b,c)),b}function k(a,b,c,d,f){c=j(b,c,d),x.isBuffer(c)&&(d="buffer");var g=b.objectMode?1:c.length;b.length+=g;var h=b.length<b.highWaterMark;if(h||(b.needDrain=!0),b.writing||b.corked){var i=b.lastBufferedRequest;b.lastBufferedRequest=new e(c,d,f),i?i.next=b.lastBufferedRequest:b.bufferedRequest=b.lastBufferedRequest}else l(a,b,!1,g,c,d,f);return h}function l(a,b,c,d,e,f,g){b.writelen=d,b.writecb=g,b.writing=!0,b.sync=!0,c?a._writev(e,b.onwrite):a._write(e,f,b.onwrite),b.sync=!1}function m(a,b,c,d,e){--b.pendingcb,c?w(e,d):e(d),a._writableState.errorEmitted=!0,a.emit("error",d)}function n(a){a.writing=!1,a.writecb=null,a.length-=a.writelen,a.writelen=0}function o(a,b){var c=a._writableState,d=c.sync,e=c.writecb;if(n(c),b)m(a,c,d,b,e);else{var f=s(c);f||c.corked||c.bufferProcessing||!c.bufferedRequest||r(a,c),d?w(p,a,c,f,e):p(a,c,f,e)}}function p(a,b,c,d){c||q(a,b),b.pendingcb--,d(),u(a,b)}function q(a,b){0===b.length&&b.needDrain&&(b.needDrain=!1,a.emit("drain"))}function r(a,b){b.bufferProcessing=!0;var c=b.bufferedRequest;if(a._writev&&c&&c.next){for(var d=[],e=[];c;)e.push(c.callback),d.push(c),c=c.next;b.pendingcb++,b.lastBufferedRequest=null,l(a,b,!0,b.length,d,"",function(a){for(var c=0;c<e.length;c++)b.pendingcb--,e[c](a)})}else{for(;c;){var f=c.chunk,g=c.encoding,h=c.callback,i=b.objectMode?1:f.length;if(l(a,b,!1,i,f,g,h),c=c.next,b.writing)break}null===c&&(b.lastBufferedRequest=null)}b.bufferedRequest=c,b.bufferProcessing=!1}function s(a){return a.ending&&0===a.length&&null===a.bufferedRequest&&!a.finished&&!a.writing}function t(a,b){b.prefinished||(b.prefinished=!0,a.emit("prefinish"))}function u(a,b){var c=s(b);return c&&(0===b.pendingcb?(t(a,b),b.finished=!0,a.emit("finish")):t(a,b)),c}function v(a,b,c){b.ending=!0,u(a,b),c&&(b.finished?w(c):a.once("finish",c)),b.ended=!0}b.exports=g;var w=a("process-nextick-args"),x=a("buffer").Buffer;g.WritableState=f;var y=a("core-util-is");y.inherits=a("inherits");var z;!function(){try{z=a("stream")}catch(b){}finally{z||(z=a("events").EventEmitter)}}();var x=a("buffer").Buffer;y.inherits(g,z),f.prototype.getBuffer=function(){for(var a=this.bufferedRequest,b=[];a;)b.push(a),a=a.next;return b},function(){try{Object.defineProperty(f.prototype,"buffer",{get:a("util-deprecate")(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer() instead.")})}catch(b){}}(),g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},g.prototype.write=function(a,b,c){var e=this._writableState,f=!1;return"function"==typeof b&&(c=b,b=null),x.isBuffer(a)?b="buffer":b||(b=e.defaultEncoding),"function"!=typeof c&&(c=d),e.ended?h(this,c):i(this,e,a,c)&&(e.pendingcb++,f=k(this,e,a,b,c)),f},g.prototype.cork=function(){var a=this._writableState;a.corked++},g.prototype.uncork=function(){var a=this._writableState;a.corked&&(a.corked--,a.writing||a.corked||a.finished||a.bufferProcessing||!a.bufferedRequest||r(this,a))},g.prototype.setDefaultEncoding=function(a){if("string"==typeof a&&(a=a.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((a+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+a);this._writableState.defaultEncoding=a},g.prototype._write=function(a,b,c){c(new Error("not implemented"))},g.prototype._writev=null,g.prototype.end=function(a,b,c){var d=this._writableState;"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null),null!==a&&void 0!==a&&this.write(a,b),d.corked&&(d.corked=1,this.uncork()),d.ending||d.finished||v(this,d,c)}},{"./_stream_duplex":14,buffer:4,"core-util-is":19,events:8,inherits:12,"process-nextick-args":21,"util-deprecate":23}],19:[function(a,b,c){(function(a){function b(a){return Array.isArray(a)}function d(a){return"boolean"==typeof a}function e(a){return null===a}function f(a){return null==a}function g(a){return"number"==typeof a}function h(a){return"string"==typeof a}function i(a){return"symbol"==typeof a}function j(a){return void 0===a}function k(a){return l(a)&&"[object RegExp]"===r(a)}function l(a){return"object"==typeof a&&null!==a}function m(a){return l(a)&&"[object Date]"===r(a)}function n(a){return l(a)&&("[object Error]"===r(a)||a instanceof Error)}function o(a){return"function"==typeof a}function p(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function q(b){return a.isBuffer(b)}function r(a){return Object.prototype.toString.call(a)}c.isArray=b,c.isBoolean=d,c.isNull=e,c.isNullOrUndefined=f,c.isNumber=g,c.isString=h,c.isSymbol=i,c.isUndefined=j,c.isRegExp=k,c.isObject=l,c.isDate=m,c.isError=n,c.isFunction=o,c.isPrimitive=p,c.isBuffer=q}).call(this,a("buffer").Buffer)},{buffer:4}],20:[function(a,b,c){b.exports=Array.isArray||function(a){return"[object Array]"==Object.prototype.toString.call(a)}},{}],21:[function(a,b,c){(function(a){"use strict";function c(b){for(var c=new Array(arguments.length-1),d=0;d<arguments.length;)c[d++]=arguments[d];a.nextTick(function(){b.apply(null,c)})}b.exports=c}).call(this,a("_process"))},{_process:9}],22:[function(a,b,c){arguments[4][11][0].apply(c,arguments)},{buffer:4,dup:11}],23:[function(a,b,c){(function(a){function c(a,b){function c(){if(!e){if(d("throwDeprecation"))throw new Error(b);d("traceDeprecation")?console.trace(b):console.warn(b),e=!0}return a.apply(this,arguments)}if(d("noDeprecation"))return a;var e=!1;return c}function d(b){if(!a.localStorage)return!1;var c=a.localStorage[b];return null==c?!1:"true"===String(c).toLowerCase()}b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],24:[function(a,b,c){b.exports=a("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":15}],25:[function(a,b,c){var d=function(){try{return a("stream")}catch(b){}}();c=b.exports=a("./lib/_stream_readable.js"),c.Stream=d||c,c.Readable=c,c.Writable=a("./lib/_stream_writable.js"),c.Duplex=a("./lib/_stream_duplex.js"),c.Transform=a("./lib/_stream_transform.js"),c.PassThrough=a("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":14,"./lib/_stream_passthrough.js":15,"./lib/_stream_readable.js":16,"./lib/_stream_transform.js":17,"./lib/_stream_writable.js":18}],26:[function(a,b,c){b.exports=a("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":17}],27:[function(a,b,c){b.exports=a("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":18}],28:[function(a,b,c){(function(){"use strict";var b;b=a("../lib/xml2js"),c.stripBOM=function(a){return"\ufeff"===a[0]?a.substring(1):a}}).call(this)},{"../lib/xml2js":30}],29:[function(a,b,c){(function(){"use strict";var a;a=new RegExp(/(?!xmlns)^.*:/),c.normalize=function(a){return a.toLowerCase()},c.firstCharLowerCase=function(a){return a.charAt(0).toLowerCase()+a.slice(1)},c.stripPrefix=function(b){return b.replace(a,"")},c.parseNumbers=function(a){return isNaN(a)||(a=a%1===0?parseInt(a,10):parseFloat(a)),a},c.parseBooleans=function(a){return/^(?:true|false)$/i.test(a)&&(a="true"===a.toLowerCase()),a}}).call(this)},{}],30:[function(a,b,c){(function(){"use strict";var b,d,e,f,g,h,i,j,k,l,m=function(a,b){function c(){this.constructor=a}for(var d in b)n.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},n={}.hasOwnProperty,o=function(a,b){return function(){return a.apply(b,arguments)}};k=a("sax"),f=a("events"),d=a("xmlbuilder"),b=a("./bom"),i=a("./processors"),g=function(a){return"object"==typeof a&&null!=a&&0===Object.keys(a).length},h=function(a,b){var c,d,e;for(c=0,d=a.length;d>c;c++)e=a[c],b=e(b);return b},j=function(a){return a.indexOf("&")>=0||a.indexOf(">")>=0||a.indexOf("<")>=0},l=function(a){return"<![CDATA["+e(a)+"]]>"},e=function(a){return a.replace("]]>","]]]]><![CDATA[>")},c.processors=i,c.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,async:!1,strict:!0,attrNameProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,async:!1,strict:!0,attrNameProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}},c.ValidationError=function(a){function b(a){this.message=a}return m(b,a),b}(Error),c.Builder=function(){function a(a){var b,d,e;this.options={},d=c.defaults[.2];for(b in d)n.call(d,b)&&(e=d[b],this.options[b]=e);for(b in a)n.call(a,b)&&(e=a[b],this.options[b]=e)}return a.prototype.buildObject=function(a){var b,e,f,g,h;return b=this.options.attrkey,e=this.options.charkey,1===Object.keys(a).length&&this.options.rootName===c.defaults[.2].rootName?(h=Object.keys(a)[0],a=a[h]):h=this.options.rootName,f=function(a){return function(c,d){var g,h,i,k,m,o;if("object"!=typeof d)a.options.cdata&&j(d)?c.raw(l(d)):c.txt(d);else for(m in d)if(n.call(d,m))if(h=d[m],m===b){if("object"==typeof h)for(g in h)o=h[g],c=c.att(g,o)}else if(m===e)c=a.options.cdata&&j(h)?c.raw(l(h)):c.txt(h);else if(Array.isArray(h))for(k in h)n.call(h,k)&&(i=h[k],c="string"==typeof i?a.options.cdata&&j(i)?c.ele(m).raw(l(i)).up():c.ele(m,i).up():f(c.ele(m),i).up());else c="object"==typeof h?f(c.ele(m),h).up():"string"==typeof h&&a.options.cdata&&j(h)?c.ele(m).raw(l(h)).up():c.ele(m,h.toString()).up();return c}}(this),g=d.create(h,this.options.xmldec,this.options.doctype,{headless:this.options.headless}),f(g,a).end(this.options.renderOpts)},a}(),c.Parser=function(a){function d(a){this.parseString=o(this.parseString,this),this.reset=o(this.reset,this),this.assignOrPush=o(this.assignOrPush,this),this.processAsync=o(this.processAsync,this);var b,d,e;if(!(this instanceof c.Parser))return new c.Parser(a);this.options={},d=c.defaults[.2];for(b in d)n.call(d,b)&&(e=d[b],
this.options[b]=e);for(b in a)n.call(a,b)&&(e=a[b],this.options[b]=e);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(i.normalize)),this.reset()}return m(d,a),d.prototype.processAsync=function(){var a;return this.remaining.length<=this.options.chunkSize?(a=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(a),this.saxParser.close()):(a=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(a),setImmediate(this.processAsync))},d.prototype.assignOrPush=function(a,b,c){return b in a?(a[b]instanceof Array||(a[b]=[a[b]]),a[b].push(c)):this.options.explicitArray?a[b]=[c]:a[b]=c},d.prototype.reset=function(){var a,b,c,d;return this.removeAllListeners(),this.saxParser=k.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(a){return function(b){return a.saxParser.resume(),a.saxParser.errThrown?void 0:(a.saxParser.errThrown=!0,a.emit("error",b))}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,d=[],a=this.options.attrkey,b=this.options.charkey,this.saxParser.onopentag=function(c){return function(e){var f,g,i,j,k;if(i={},i[b]="",!c.options.ignoreAttrs){k=e.attributes;for(f in k)n.call(k,f)&&(a in i||c.options.mergeAttrs||(i[a]={}),g=e.attributes[f],j=c.options.attrNameProcessors?h(c.options.attrNameProcessors,f):f,c.options.mergeAttrs?c.assignOrPush(i,j,g):i[a][j]=g)}return i["#name"]=c.options.tagNameProcessors?h(c.options.tagNameProcessors,e.name):e.name,c.options.xmlns&&(i[c.options.xmlnskey]={uri:e.uri,local:e.local}),d.push(i)}}(this),this.saxParser.onclosetag=function(a){return function(){var c,e,f,i,j,k,l,m,o,p,q;if(l=d.pop(),k=l["#name"],a.options.explicitChildren&&a.options.preserveChildrenOrder||delete l["#name"],l.cdata===!0&&(c=l.cdata,delete l.cdata),p=d[d.length-1],l[b].match(/^\s*$/)&&!c?(e=l[b],delete l[b]):(a.options.trim&&(l[b]=l[b].trim()),a.options.normalize&&(l[b]=l[b].replace(/\s{2,}/g," ").trim()),l[b]=a.options.valueProcessors?h(a.options.valueProcessors,l[b]):l[b],1===Object.keys(l).length&&b in l&&!a.EXPLICIT_CHARKEY&&(l=l[b])),g(l)&&(l=""!==a.options.emptyTag?a.options.emptyTag:e),null!=a.options.validator){q="/"+function(){var a,b,c;for(c=[],a=0,b=d.length;b>a;a++)j=d[a],c.push(j["#name"]);return c}().concat(k).join("/");try{l=a.options.validator(q,p&&p[k],l)}catch(r){f=r,a.emit("error",f)}}if(a.options.explicitChildren&&!a.options.mergeAttrs&&"object"==typeof l)if(a.options.preserveChildrenOrder){if(p){p[a.options.childkey]=p[a.options.childkey]||[],m={};for(i in l)n.call(l,i)&&(m[i]=l[i]);p[a.options.childkey].push(m),delete l["#name"],1===Object.keys(l).length&&b in l&&!a.EXPLICIT_CHARKEY&&(l=l[b])}}else j={},a.options.attrkey in l&&(j[a.options.attrkey]=l[a.options.attrkey],delete l[a.options.attrkey]),!a.options.charsAsChildren&&a.options.charkey in l&&(j[a.options.charkey]=l[a.options.charkey],delete l[a.options.charkey]),Object.getOwnPropertyNames(l).length>0&&(j[a.options.childkey]=l),l=j;return d.length>0?a.assignOrPush(p,k,l):(a.options.explicitRoot&&(o=l,l={},l[k]=o),a.resultObject=l,a.saxParser.ended=!0,a.emit("end",a.resultObject))}}(this),c=function(a){return function(c){var e,f;return f=d[d.length-1],f?(f[b]+=c,a.options.explicitChildren&&a.options.preserveChildrenOrder&&a.options.charsAsChildren&&""!==c.replace(/\\n/g,"").trim()&&(f[a.options.childkey]=f[a.options.childkey]||[],e={"#name":"__text__"},e[b]=c,f[a.options.childkey].push(e)),f):void 0}}(this),this.saxParser.ontext=c,this.saxParser.oncdata=function(a){return function(a){var b;return b=c(a),b?b.cdata=!0:void 0}}(this)},d.prototype.parseString=function(a,c){var d;if(null!=c&&"function"==typeof c&&(this.on("end",function(a){return this.reset(),c(null,a)}),this.on("error",function(a){return this.reset(),c(a)})),a=a.toString(),""===a.trim())return this.emit("end",null),!0;try{return a=b.stripBOM(a),this.options.async&&(this.remaining=a,setImmediate(this.processAsync),this.saxParser),this.saxParser.write(a).close()}catch(e){if(d=e,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",d),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw d}},d}(f.EventEmitter),c.parseString=function(a,b,d){var e,f,g;return null!=d?("function"==typeof d&&(e=d),"object"==typeof b&&(f=b)):("function"==typeof b&&(e=b),f={}),g=new c.Parser(f),g.parseString(a,e)}}).call(this)},{"./bom":28,"./processors":29,events:8,sax:31,xmlbuilder:48}],31:[function(a,b,c){(function(b){!function(c){function d(a,b){if(!(this instanceof d))return new d(a,b);var e=this;f(e),e.q=e.c="",e.bufferCheckPosition=c.MAX_BUFFER_LENGTH,e.opt=b||{},e.opt.lowercase=e.opt.lowercase||e.opt.lowercasetags,e.looseCase=e.opt.lowercase?"toLowerCase":"toUpperCase",e.tags=[],e.closed=e.closedRoot=e.sawRoot=!1,e.tag=e.error=null,e.strict=!!a,e.noscript=!(!a&&!e.opt.noscript),e.state=S.BEGIN,e.strictEntities=e.opt.strictEntities,e.ENTITIES=e.strictEntities?Object.create(c.XML_ENTITIES):Object.create(c.ENTITIES),e.attribList=[],e.opt.xmlns&&(e.ns=Object.create(P)),e.trackPosition=e.opt.position!==!1,e.trackPosition&&(e.position=e.line=e.column=0),n(e,"onready")}function e(a){for(var b=Math.max(c.MAX_BUFFER_LENGTH,10),d=0,e=0,f=B.length;f>e;e++){var g=a[B[e]].length;if(g>b)switch(B[e]){case"textNode":p(a);break;case"cdata":o(a,"oncdata",a.cdata),a.cdata="";break;case"script":o(a,"onscript",a.script),a.script="";break;default:r(a,"Max buffer length exceeded: "+B[e])}d=Math.max(d,g)}a.bufferCheckPosition=c.MAX_BUFFER_LENGTH-d+a.position}function f(a){for(var b=0,c=B.length;c>b;b++)a[B[b]]=""}function g(a){p(a),""!==a.cdata&&(o(a,"oncdata",a.cdata),a.cdata=""),""!==a.script&&(o(a,"onscript",a.script),a.script="")}function h(a,b){return new i(a,b)}function i(a,b){if(!(this instanceof i))return new i(a,b);C.apply(this),this._parser=new d(a,b),this.writable=!0,this.readable=!0;var c=this;this._parser.onend=function(){c.emit("end")},this._parser.onerror=function(a){c.emit("error",a),c._parser.error=null},this._decoder=null,E.forEach(function(a){Object.defineProperty(c,"on"+a,{get:function(){return c._parser["on"+a]},set:function(b){return b?void c.on(a,b):(c.removeAllListeners(a),c._parser["on"+a]=b)},enumerable:!0,configurable:!1})})}function j(a){return a.split("").reduce(function(a,b){return a[b]=!0,a},{})}function k(a){return"[object RegExp]"===Object.prototype.toString.call(a)}function l(a,b){return k(a)?!!b.match(a):a[b]}function m(a,b){return!l(a,b)}function n(a,b,c){a[b]&&a[b](c)}function o(a,b,c){a.textNode&&p(a),n(a,b,c)}function p(a){a.textNode=q(a.opt,a.textNode),a.textNode&&n(a,"ontext",a.textNode),a.textNode=""}function q(a,b){return a.trim&&(b=b.trim()),a.normalize&&(b=b.replace(/\s+/g," ")),b}function r(a,b){return p(a),a.trackPosition&&(b+="\nLine: "+a.line+"\nColumn: "+a.column+"\nChar: "+a.c),b=new Error(b),a.error=b,n(a,"onerror",b),a}function s(a){return a.sawRoot&&!a.closedRoot&&t(a,"Unclosed root tag"),a.state!==S.BEGIN&&a.state!==S.BEGIN_WHITESPACE&&a.state!==S.TEXT&&r(a,"Unexpected end"),p(a),a.c="",a.closed=!0,n(a,"onend"),d.call(a,a.strict,a.opt),a}function t(a,b){if("object"!=typeof a||!(a instanceof d))throw new Error("bad call to strictFail");a.strict&&r(a,b)}function u(a){a.strict||(a.tagName=a.tagName[a.looseCase]());var b=a.tags[a.tags.length-1]||a,c=a.tag={name:a.tagName,attributes:{}};a.opt.xmlns&&(c.ns=b.ns),a.attribList.length=0}function v(a,b){var c=a.indexOf(":"),d=0>c?["",a]:a.split(":"),e=d[0],f=d[1];return b&&"xmlns"===a&&(e="xmlns",f=""),{prefix:e,local:f}}function w(a){if(a.strict||(a.attribName=a.attribName[a.looseCase]()),-1!==a.attribList.indexOf(a.attribName)||a.tag.attributes.hasOwnProperty(a.attribName))return a.attribName=a.attribValue="";if(a.opt.xmlns){var b=v(a.attribName,!0),c=b.prefix,d=b.local;if("xmlns"===c)if("xml"===d&&a.attribValue!==N)t(a,"xml: prefix must be bound to "+N+"\nActual: "+a.attribValue);else if("xmlns"===d&&a.attribValue!==O)t(a,"xmlns: prefix must be bound to "+O+"\nActual: "+a.attribValue);else{var e=a.tag,f=a.tags[a.tags.length-1]||a;e.ns===f.ns&&(e.ns=Object.create(f.ns)),e.ns[d]=a.attribValue}a.attribList.push([a.attribName,a.attribValue])}else a.tag.attributes[a.attribName]=a.attribValue,o(a,"onattribute",{name:a.attribName,value:a.attribValue});a.attribName=a.attribValue=""}function x(a,b){if(a.opt.xmlns){var c=a.tag,d=v(a.tagName);c.prefix=d.prefix,c.local=d.local,c.uri=c.ns[d.prefix]||"",c.prefix&&!c.uri&&(t(a,"Unbound namespace prefix: "+JSON.stringify(a.tagName)),c.uri=d.prefix);var e=a.tags[a.tags.length-1]||a;c.ns&&e.ns!==c.ns&&Object.keys(c.ns).forEach(function(b){o(a,"onopennamespace",{prefix:b,uri:c.ns[b]})});for(var f=0,g=a.attribList.length;g>f;f++){var h=a.attribList[f],i=h[0],j=h[1],k=v(i,!0),l=k.prefix,m=k.local,n=""==l?"":c.ns[l]||"",p={name:i,value:j,prefix:l,local:m,uri:n};l&&"xmlns"!=l&&!n&&(t(a,"Unbound namespace prefix: "+JSON.stringify(l)),p.uri=l),a.tag.attributes[i]=p,o(a,"onattribute",p)}a.attribList.length=0}a.tag.isSelfClosing=!!b,a.sawRoot=!0,a.tags.push(a.tag),o(a,"onopentag",a.tag),b||(a.noscript||"script"!==a.tagName.toLowerCase()?a.state=S.TEXT:a.state=S.SCRIPT,a.tag=null,a.tagName=""),a.attribName=a.attribValue="",a.attribList.length=0}function y(a){if(!a.tagName)return t(a,"Weird empty close tag."),a.textNode+="</>",void(a.state=S.TEXT);if(a.script){if("script"!==a.tagName)return a.script+="</"+a.tagName+">",a.tagName="",void(a.state=S.SCRIPT);o(a,"onscript",a.script),a.script=""}var b=a.tags.length,c=a.tagName;a.strict||(c=c[a.looseCase]());for(var d=c;b--;){var e=a.tags[b];if(e.name===d)break;t(a,"Unexpected close tag")}if(0>b)return t(a,"Unmatched closing tag: "+a.tagName),a.textNode+="</"+a.tagName+">",void(a.state=S.TEXT);a.tagName=c;for(var f=a.tags.length;f-->b;){var g=a.tag=a.tags.pop();a.tagName=a.tag.name,o(a,"onclosetag",a.tagName);var h={};for(var i in g.ns)h[i]=g.ns[i];var j=a.tags[a.tags.length-1]||a;a.opt.xmlns&&g.ns!==j.ns&&Object.keys(g.ns).forEach(function(b){var c=g.ns[b];o(a,"onclosenamespace",{prefix:b,uri:c})})}0===b&&(a.closedRoot=!0),a.tagName=a.attribValue=a.attribName="",a.attribList.length=0,a.state=S.TEXT}function z(a){var b,c=a.entity,d=c.toLowerCase(),e="";return a.ENTITIES[c]?a.ENTITIES[c]:a.ENTITIES[d]?a.ENTITIES[d]:(c=d,"#"===c.charAt(0)&&("x"===c.charAt(1)?(c=c.slice(2),b=parseInt(c,16),e=b.toString(16)):(c=c.slice(1),b=parseInt(c,10),e=b.toString(10))),c=c.replace(/^0+/,""),e.toLowerCase()!==c?(t(a,"Invalid character entity"),"&"+a.entity+";"):String.fromCodePoint(b))}function A(a){var b=this;if(this.error)throw this.error;if(b.closed)return r(b,"Cannot write after close. Assign an onready handler.");if(null===a)return s(b);for(var c=0,d="";b.c=d=a.charAt(c++);)switch(b.trackPosition&&(b.position++,"\n"===d?(b.line++,b.column=0):b.column++),b.state){case S.BEGIN:if(b.state=S.BEGIN_WHITESPACE,"\ufeff"===d)continue;case S.BEGIN_WHITESPACE:"<"===d?(b.state=S.OPEN_WAKA,b.startTagPosition=b.position):m(F,d)&&(t(b,"Non-whitespace before first tag."),b.textNode=d,b.state=S.TEXT);continue;case S.TEXT:if(b.sawRoot&&!b.closedRoot){for(var f=c-1;d&&"<"!==d&&"&"!==d;)d=a.charAt(c++),d&&b.trackPosition&&(b.position++,"\n"===d?(b.line++,b.column=0):b.column++);b.textNode+=a.substring(f,c-1)}"<"!==d||b.sawRoot&&b.closedRoot&&!b.strict?(!m(F,d)||b.sawRoot&&!b.closedRoot||t(b,"Text data outside of root node."),"&"===d?b.state=S.TEXT_ENTITY:b.textNode+=d):(b.state=S.OPEN_WAKA,b.startTagPosition=b.position);continue;case S.SCRIPT:"<"===d?b.state=S.SCRIPT_ENDING:b.script+=d;continue;case S.SCRIPT_ENDING:"/"===d?b.state=S.CLOSE_TAG:(b.script+="<"+d,b.state=S.SCRIPT);continue;case S.OPEN_WAKA:if("!"===d)b.state=S.SGML_DECL,b.sgmlDecl="";else if(l(F,d));else if(l(Q,d))b.state=S.OPEN_TAG,b.tagName=d;else if("/"===d)b.state=S.CLOSE_TAG,b.tagName="";else if("?"===d)b.state=S.PROC_INST,b.procInstName=b.procInstBody="";else{if(t(b,"Unencoded <"),b.startTagPosition+1<b.position){var g=b.position-b.startTagPosition;d=new Array(g).join(" ")+d}b.textNode+="<"+d,b.state=S.TEXT}continue;case S.SGML_DECL:(b.sgmlDecl+d).toUpperCase()===L?(o(b,"onopencdata"),b.state=S.CDATA,b.sgmlDecl="",b.cdata=""):b.sgmlDecl+d==="--"?(b.state=S.COMMENT,b.comment="",b.sgmlDecl=""):(b.sgmlDecl+d).toUpperCase()===M?(b.state=S.DOCTYPE,(b.doctype||b.sawRoot)&&t(b,"Inappropriately located doctype declaration"),b.doctype="",b.sgmlDecl=""):">"===d?(o(b,"onsgmldeclaration",b.sgmlDecl),b.sgmlDecl="",b.state=S.TEXT):l(I,d)?(b.state=S.SGML_DECL_QUOTED,b.sgmlDecl+=d):b.sgmlDecl+=d;continue;case S.SGML_DECL_QUOTED:d===b.q&&(b.state=S.SGML_DECL,b.q=""),b.sgmlDecl+=d;continue;case S.DOCTYPE:">"===d?(b.state=S.TEXT,o(b,"ondoctype",b.doctype),b.doctype=!0):(b.doctype+=d,"["===d?b.state=S.DOCTYPE_DTD:l(I,d)&&(b.state=S.DOCTYPE_QUOTED,b.q=d));continue;case S.DOCTYPE_QUOTED:b.doctype+=d,d===b.q&&(b.q="",b.state=S.DOCTYPE);continue;case S.DOCTYPE_DTD:b.doctype+=d,"]"===d?b.state=S.DOCTYPE:l(I,d)&&(b.state=S.DOCTYPE_DTD_QUOTED,b.q=d);continue;case S.DOCTYPE_DTD_QUOTED:b.doctype+=d,d===b.q&&(b.state=S.DOCTYPE_DTD,b.q="");continue;case S.COMMENT:"-"===d?b.state=S.COMMENT_ENDING:b.comment+=d;continue;case S.COMMENT_ENDING:"-"===d?(b.state=S.COMMENT_ENDED,b.comment=q(b.opt,b.comment),b.comment&&o(b,"oncomment",b.comment),b.comment=""):(b.comment+="-"+d,b.state=S.COMMENT);continue;case S.COMMENT_ENDED:">"!==d?(t(b,"Malformed comment"),b.comment+="--"+d,b.state=S.COMMENT):b.state=S.TEXT;continue;case S.CDATA:"]"===d?b.state=S.CDATA_ENDING:b.cdata+=d;continue;case S.CDATA_ENDING:"]"===d?b.state=S.CDATA_ENDING_2:(b.cdata+="]"+d,b.state=S.CDATA);continue;case S.CDATA_ENDING_2:">"===d?(b.cdata&&o(b,"oncdata",b.cdata),o(b,"onclosecdata"),b.cdata="",b.state=S.TEXT):"]"===d?b.cdata+="]":(b.cdata+="]]"+d,b.state=S.CDATA);continue;case S.PROC_INST:"?"===d?b.state=S.PROC_INST_ENDING:l(F,d)?b.state=S.PROC_INST_BODY:b.procInstName+=d;continue;case S.PROC_INST_BODY:if(!b.procInstBody&&l(F,d))continue;"?"===d?b.state=S.PROC_INST_ENDING:b.procInstBody+=d;continue;case S.PROC_INST_ENDING:">"===d?(o(b,"onprocessinginstruction",{name:b.procInstName,body:b.procInstBody}),b.procInstName=b.procInstBody="",b.state=S.TEXT):(b.procInstBody+="?"+d,b.state=S.PROC_INST_BODY);continue;case S.OPEN_TAG:l(R,d)?b.tagName+=d:(u(b),">"===d?x(b):"/"===d?b.state=S.OPEN_TAG_SLASH:(m(F,d)&&t(b,"Invalid character in tag name"),b.state=S.ATTRIB));continue;case S.OPEN_TAG_SLASH:">"===d?(x(b,!0),y(b)):(t(b,"Forward-slash in opening tag not followed by >"),b.state=S.ATTRIB);continue;case S.ATTRIB:if(l(F,d))continue;">"===d?x(b):"/"===d?b.state=S.OPEN_TAG_SLASH:l(Q,d)?(b.attribName=d,b.attribValue="",b.state=S.ATTRIB_NAME):t(b,"Invalid attribute name");continue;case S.ATTRIB_NAME:"="===d?b.state=S.ATTRIB_VALUE:">"===d?(t(b,"Attribute without value"),b.attribValue=b.attribName,w(b),x(b)):l(F,d)?b.state=S.ATTRIB_NAME_SAW_WHITE:l(R,d)?b.attribName+=d:t(b,"Invalid attribute name");continue;case S.ATTRIB_NAME_SAW_WHITE:if("="===d)b.state=S.ATTRIB_VALUE;else{if(l(F,d))continue;t(b,"Attribute without value"),b.tag.attributes[b.attribName]="",b.attribValue="",o(b,"onattribute",{name:b.attribName,value:""}),b.attribName="",">"===d?x(b):l(Q,d)?(b.attribName=d,b.state=S.ATTRIB_NAME):(t(b,"Invalid attribute name"),b.state=S.ATTRIB)}continue;case S.ATTRIB_VALUE:if(l(F,d))continue;l(I,d)?(b.q=d,b.state=S.ATTRIB_VALUE_QUOTED):(t(b,"Unquoted attribute value"),b.state=S.ATTRIB_VALUE_UNQUOTED,b.attribValue=d);continue;case S.ATTRIB_VALUE_QUOTED:if(d!==b.q){"&"===d?b.state=S.ATTRIB_VALUE_ENTITY_Q:b.attribValue+=d;continue}w(b),b.q="",b.state=S.ATTRIB_VALUE_CLOSED;continue;case S.ATTRIB_VALUE_CLOSED:l(F,d)?b.state=S.ATTRIB:">"===d?x(b):"/"===d?b.state=S.OPEN_TAG_SLASH:l(Q,d)?(t(b,"No whitespace between attributes"),b.attribName=d,b.attribValue="",b.state=S.ATTRIB_NAME):t(b,"Invalid attribute name");continue;case S.ATTRIB_VALUE_UNQUOTED:if(m(K,d)){"&"===d?b.state=S.ATTRIB_VALUE_ENTITY_U:b.attribValue+=d;continue}w(b),">"===d?x(b):b.state=S.ATTRIB;continue;case S.CLOSE_TAG:if(b.tagName)">"===d?y(b):l(R,d)?b.tagName+=d:b.script?(b.script+="</"+b.tagName,b.tagName="",b.state=S.SCRIPT):(m(F,d)&&t(b,"Invalid tagname in closing tag"),b.state=S.CLOSE_TAG_SAW_WHITE);else{if(l(F,d))continue;m(Q,d)?b.script?(b.script+="</"+d,b.state=S.SCRIPT):t(b,"Invalid tagname in closing tag."):b.tagName=d}continue;case S.CLOSE_TAG_SAW_WHITE:if(l(F,d))continue;">"===d?y(b):t(b,"Invalid characters in closing tag");continue;case S.TEXT_ENTITY:case S.ATTRIB_VALUE_ENTITY_Q:case S.ATTRIB_VALUE_ENTITY_U:switch(b.state){case S.TEXT_ENTITY:var h=S.TEXT,i="textNode";break;case S.ATTRIB_VALUE_ENTITY_Q:var h=S.ATTRIB_VALUE_QUOTED,i="attribValue";break;case S.ATTRIB_VALUE_ENTITY_U:var h=S.ATTRIB_VALUE_UNQUOTED,i="attribValue"}";"===d?(b[i]+=z(b),b.entity="",b.state=h):l(J,d)?b.entity+=d:(t(b,"Invalid character entity"),b[i]+="&"+b.entity+d,b.entity="",b.state=h);continue;default:throw new Error(b,"Unknown state: "+b.state)}return b.position>=b.bufferCheckPosition&&e(b),b}c.parser=function(a,b){return new d(a,b)},c.SAXParser=d,c.SAXStream=i,c.createStream=h,c.MAX_BUFFER_LENGTH=65536;var B=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];c.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(a){function b(){this.__proto__=a}return b.prototype=a,new b}),Object.getPrototypeOf||(Object.getPrototypeOf=function(a){return a.__proto__}),Object.keys||(Object.keys=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}),d.prototype={end:function(){s(this)},write:A,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){g(this)}};try{var C=a("stream").Stream}catch(D){var C=function(){}}var E=c.EVENTS.filter(function(a){return"error"!==a&&"end"!==a});i.prototype=Object.create(C.prototype,{constructor:{value:i}}),i.prototype.write=function(c){if("function"==typeof b&&"function"==typeof b.isBuffer&&b.isBuffer(c)){if(!this._decoder){var d=a("string_decoder").StringDecoder;this._decoder=new d("utf8")}c=this._decoder.write(c)}return this._parser.write(c.toString()),this.emit("data",c),!0},i.prototype.end=function(a){return a&&a.length&&this.write(a),this._parser.end(),!0},i.prototype.on=function(a,b){var c=this;return c._parser["on"+a]||-1===E.indexOf(a)||(c._parser["on"+a]=function(){var b=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);b.splice(0,0,a),c.emit.apply(c,b)}),C.prototype.on.call(c,a,b)};var F="\r\n ",G="0124356789",H="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",I="'\"",J=G+H+"#",K=F+">",L="[CDATA[",M="DOCTYPE",N="http://www.w3.org/XML/1998/namespace",O="http://www.w3.org/2000/xmlns/",P={xml:N,xmlns:O};F=j(F),G=j(G),H=j(H);var Q=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,R=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;I=j(I),J=j(J),K=j(K);var S=0;c.STATE={BEGIN:S++,BEGIN_WHITESPACE:S++,TEXT:S++,TEXT_ENTITY:S++,OPEN_WAKA:S++,SGML_DECL:S++,SGML_DECL_QUOTED:S++,DOCTYPE:S++,DOCTYPE_QUOTED:S++,DOCTYPE_DTD:S++,DOCTYPE_DTD_QUOTED:S++,COMMENT_STARTING:S++,COMMENT:S++,COMMENT_ENDING:S++,COMMENT_ENDED:S++,CDATA:S++,CDATA_ENDING:S++,CDATA_ENDING_2:S++,PROC_INST:S++,PROC_INST_BODY:S++,PROC_INST_ENDING:S++,OPEN_TAG:S++,OPEN_TAG_SLASH:S++,ATTRIB:S++,ATTRIB_NAME:S++,ATTRIB_NAME_SAW_WHITE:S++,ATTRIB_VALUE:S++,ATTRIB_VALUE_QUOTED:S++,ATTRIB_VALUE_CLOSED:S++,ATTRIB_VALUE_UNQUOTED:S++,ATTRIB_VALUE_ENTITY_Q:S++,ATTRIB_VALUE_ENTITY_U:S++,CLOSE_TAG:S++,CLOSE_TAG_SAW_WHITE:S++,SCRIPT:S++,SCRIPT_ENDING:S++},c.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},c.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(c.ENTITIES).forEach(function(a){var b=c.ENTITIES[a],d="number"==typeof b?String.fromCharCode(b):b;c.ENTITIES[a]=d});for(var S in c.STATE)c.STATE[c.STATE[S]]=S;S=c.STATE,String.fromCodePoint||!function(){var a=String.fromCharCode,b=Math.floor,c=function(){var c,d,e=16384,f=[],g=-1,h=arguments.length;if(!h)return"";for(var i="";++g<h;){var j=Number(arguments[g]);if(!isFinite(j)||0>j||j>1114111||b(j)!=j)throw RangeError("Invalid code point: "+j);65535>=j?f.push(j):(j-=65536,c=(j>>10)+55296,d=j%1024+56320,f.push(c,d)),(g+1==h||f.length>e)&&(i+=a.apply(null,f),f.length=0)}return i};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:c,configurable:!0,writable:!0}):String.fromCodePoint=c}()}("undefined"==typeof c?sax={}:c)}).call(this,a("buffer").Buffer)},{buffer:4,stream:10,string_decoder:11}],32:[function(a,b,c){(function(){var c,d;d=a("lodash/object/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing attribute name of element "+a.name);if(null==c)throw new Error("Missing attribute value for attribute "+b+" of element "+a.name);this.name=this.stringify.attName(b),this.value=this.stringify.attValue(c)}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){return" "+this.name+'="'+this.value+'"'},a}()}).call(this)},{"lodash/object/create":102}],33:[function(a,b,c){(function(){var c,d,e,f,g;g=a("./XMLStringifier"),d=a("./XMLDeclaration"),e=a("./XMLDocType"),f=a("./XMLElement"),b.exports=c=function(){function a(a,b){var c,d;if(null==a)throw new Error("Root element needs a name");null==b&&(b={}),this.options=b,this.stringify=new g(b),d=new f(this,"doc"),c=d.element(a),c.isRoot=!0,c.documentObject=this,this.rootObject=c,b.headless||(c.declaration(b),(null!=b.pubID||null!=b.sysID)&&c.doctype(b))}return a.prototype.root=function(){return this.rootObject},a.prototype.end=function(a){return this.toString(a)},a.prototype.toString=function(a){var b,c,d,e,f,g,h,i;return e=(null!=a?a.pretty:void 0)||!1,b=null!=(g=null!=a?a.indent:void 0)?g:" ",d=null!=(h=null!=a?a.offset:void 0)?h:0,c=null!=(i=null!=a?a.newline:void 0)?i:"\n",f="",null!=this.xmldec&&(f+=this.xmldec.toString(a)),null!=this.doctype&&(f+=this.doctype.toString(a)),f+=this.rootObject.toString(a),e&&f.slice(-c.length)===c&&(f=f.slice(0,-c.length)),f},a}()}).call(this)},{"./XMLDeclaration":40,"./XMLDocType":41,"./XMLElement":42,"./XMLStringifier":46}],34:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/object/create"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing CDATA text");this.text=this.stringify.cdata(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<![CDATA["+this.text+"]]>",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":43,"lodash/object/create":102}],35:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/object/create"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing comment text");this.text=this.stringify.comment(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<!-- "+this.text+" -->",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":43,"lodash/object/create":102}],36:[function(a,b,c){(function(){var c,d;d=a("lodash/object/create"),b.exports=c=function(){function a(a,b,c,d,e,f){if(this.stringify=a.stringify,null==b)throw new Error("Missing DTD element name");if(null==c)throw new Error("Missing DTD attribute name");if(!d)throw new Error("Missing DTD attribute type");if(!e)throw new Error("Missing DTD attribute default");if(0!==e.indexOf("#")&&(e="#"+e),!e.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");if(f&&!e.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT");this.elementName=this.stringify.eleName(b),this.attributeName=this.stringify.attName(c),this.attributeType=this.stringify.dtdAttType(d),this.defaultValue=this.stringify.dtdAttDefault(f),this.defaultValueType=e}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<!ATTLIST "+this.elementName+" "+this.attributeName+" "+this.attributeType,"#DEFAULT"!==this.defaultValueType&&(g+=" "+this.defaultValueType),this.defaultValue&&(g+=' "'+this.defaultValue+'"'),g+=">",f&&(g+=d),g},a}()}).call(this)},{"lodash/object/create":102}],37:[function(a,b,c){(function(){var c,d,e;d=a("lodash/object/create"),e=a("lodash/lang/isArray"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing DTD element name");c||(c="(#PCDATA)"),e(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.eleName(b),this.value=this.stringify.dtdElementValue(c)}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<!ELEMENT "+this.name+" "+this.value+">",f&&(g+=d),g},a}()}).call(this)},{"lodash/lang/isArray":94,"lodash/object/create":102}],38:[function(a,b,c){(function(){var c,d,e;d=a("lodash/object/create"),e=a("lodash/lang/isObject"),b.exports=c=function(){function a(a,b,c,d){if(this.stringify=a.stringify,null==c)throw new Error("Missing entity name");if(null==d)throw new Error("Missing entity value");if(this.pe=!!b,this.name=this.stringify.eleName(c),e(d)){if(!d.pubID&&!d.sysID)throw new Error("Public and/or system identifiers are required for an external entity");if(d.pubID&&!d.sysID)throw new Error("System identifier is required for a public external entity");if(null!=d.pubID&&(this.pubID=this.stringify.dtdPubID(d.pubID)),null!=d.sysID&&(this.sysID=this.stringify.dtdSysID(d.sysID)),null!=d.nData&&(this.nData=this.stringify.dtdNData(d.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity")}else this.value=this.stringify.dtdEntityValue(d)}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<!ENTITY",this.pe&&(g+=" %"),g+=" "+this.name,this.value?g+=' "'+this.value+'"':(this.pubID&&this.sysID?g+=' PUBLIC "'+this.pubID+'" "'+this.sysID+'"':this.sysID&&(g+=' SYSTEM "'+this.sysID+'"'),this.nData&&(g+=" NDATA "+this.nData)),g+=">",f&&(g+=d),g},a}()}).call(this)},{"lodash/lang/isObject":98,"lodash/object/create":102}],39:[function(a,b,c){(function(){var c,d;d=a("lodash/object/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing notation name");if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity");this.name=this.stringify.eleName(b),null!=c.pubID&&(this.pubID=this.stringify.dtdPubID(c.pubID)),null!=c.sysID&&(this.sysID=this.stringify.dtdSysID(c.sysID))}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<!NOTATION "+this.name,this.pubID&&this.sysID?g+=' PUBLIC "'+this.pubID+'" "'+this.sysID+'"':this.pubID?g+=' PUBLIC "'+this.pubID+'"':this.sysID&&(g+=' SYSTEM "'+this.sysID+'"'),g+=">",f&&(g+=d),g},a}()}).call(this)},{"lodash/object/create":102}],40:[function(a,b,c){(function(){var c,d,e,f,g=function(a,b){function c(){
this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("lodash/object/create"),f=a("lodash/lang/isObject"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c,d,e){var g;b.__super__.constructor.call(this,a),f(c)&&(g=c,c=g.version,d=g.encoding,e=g.standalone),c||(c="1.0"),null!=c&&(this.version=this.stringify.xmlVersion(c)),null!=d&&(this.encoding=this.stringify.xmlEncoding(d)),null!=e&&(this.standalone=this.stringify.xmlStandalone(e))}return g(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<?xml",null!=this.version&&(g+=' version="'+this.version+'"'),null!=this.encoding&&(g+=' encoding="'+this.encoding+'"'),null!=this.standalone&&(g+=' standalone="'+this.standalone+'"'),g+="?>",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":43,"lodash/lang/isObject":98,"lodash/object/create":102}],41:[function(a,b,c){(function(){var c,d,e,f,g,h,i,j,k,l;k=a("lodash/object/create"),l=a("lodash/lang/isObject"),c=a("./XMLCData"),d=a("./XMLComment"),e=a("./XMLDTDAttList"),g=a("./XMLDTDEntity"),f=a("./XMLDTDElement"),h=a("./XMLDTDNotation"),j=a("./XMLProcessingInstruction"),b.exports=i=function(){function a(a,b,c){var d,e;this.documentObject=a,this.stringify=this.documentObject.stringify,this.children=[],l(b)&&(d=b,b=d.pubID,c=d.sysID),null==c&&(e=[b,c],c=e[0],b=e[1]),null!=b&&(this.pubID=this.stringify.dtdPubID(b)),null!=c&&(this.sysID=this.stringify.dtdSysID(c))}return a.prototype.clone=function(){return k(a.prototype,this)},a.prototype.element=function(a,b){var c;return c=new f(this,a,b),this.children.push(c),this},a.prototype.attList=function(a,b,c,d,f){var g;return g=new e(this,a,b,c,d,f),this.children.push(g),this},a.prototype.entity=function(a,b){var c;return c=new g(this,!1,a,b),this.children.push(c),this},a.prototype.pEntity=function(a,b){var c;return c=new g(this,!0,a,b),this.children.push(c),this},a.prototype.notation=function(a,b){var c;return c=new h(this,a,b),this.children.push(c),this},a.prototype.cdata=function(a){var b;return b=new c(this,a),this.children.push(b),this},a.prototype.comment=function(a){var b;return b=new d(this,a),this.children.push(b),this},a.prototype.instruction=function(a,b){var c;return c=new j(this,a,b),this.children.push(c),this},a.prototype.root=function(){return this.documentObject.root()},a.prototype.document=function(){return this.documentObject},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;if(i=(null!=a?a.pretty:void 0)||!1,e=null!=(k=null!=a?a.indent:void 0)?k:" ",h=null!=(l=null!=a?a.offset:void 0)?l:0,g=null!=(m=null!=a?a.newline:void 0)?m:"\n",b||(b=0),o=new Array(b+h+1).join(e),j="",i&&(j+=o),j+="<!DOCTYPE "+this.root().name,this.pubID&&this.sysID?j+=' PUBLIC "'+this.pubID+'" "'+this.sysID+'"':this.sysID&&(j+=' SYSTEM "'+this.sysID+'"'),this.children.length>0){for(j+=" [",i&&(j+=g),n=this.children,d=0,f=n.length;f>d;d++)c=n[d],j+=c.toString(a,b+1);j+="]"}return j+=">",i&&(j+=g),j},a.prototype.ele=function(a,b){return this.element(a,b)},a.prototype.att=function(a,b,c,d,e){return this.attList(a,b,c,d,e)},a.prototype.ent=function(a,b){return this.entity(a,b)},a.prototype.pent=function(a,b){return this.pEntity(a,b)},a.prototype.not=function(a,b){return this.notation(a,b)},a.prototype.dat=function(a){return this.cdata(a)},a.prototype.com=function(a){return this.comment(a)},a.prototype.ins=function(a,b){return this.instruction(a,b)},a.prototype.up=function(){return this.root()},a.prototype.doc=function(){return this.document()},a}()}).call(this)},{"./XMLCData":34,"./XMLComment":35,"./XMLDTDAttList":36,"./XMLDTDElement":37,"./XMLDTDEntity":38,"./XMLDTDNotation":39,"./XMLProcessingInstruction":44,"lodash/lang/isObject":98,"lodash/object/create":102}],42:[function(a,b,c){(function(){var c,d,e,f,g,h,i,j,k,l=function(a,b){function c(){this.constructor=a}for(var d in b)m.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},m={}.hasOwnProperty;g=a("lodash/object/create"),k=a("lodash/lang/isObject"),i=a("lodash/lang/isArray"),j=a("lodash/lang/isFunction"),h=a("lodash/collection/every"),e=a("./XMLNode"),c=a("./XMLAttribute"),f=a("./XMLProcessingInstruction"),b.exports=d=function(a){function b(a,c,d){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing element name");this.name=this.stringify.eleName(c),this.children=[],this.instructions=[],this.attributes={},null!=d&&this.attribute(d)}return l(b,a),b.prototype.clone=function(){var a,c,d,e,f,h,i,j;d=g(b.prototype,this),d.isRoot&&(d.documentObject=null),d.attributes={},i=this.attributes;for(c in i)m.call(i,c)&&(a=i[c],d.attributes[c]=a.clone());for(d.instructions=[],j=this.instructions,e=0,f=j.length;f>e;e++)h=j[e],d.instructions.push(h.clone());return d.children=[],this.children.forEach(function(a){var b;return b=a.clone(),b.parent=d,d.children.push(b)}),d},b.prototype.attribute=function(a,b){var d,e;if(null!=a&&(a=a.valueOf()),k(a))for(d in a)m.call(a,d)&&(e=a[d],this.attribute(d,e));else j(b)&&(b=b.apply()),this.options.skipNullAttributes&&null==b||(this.attributes[a]=new c(this,a,b));return this},b.prototype.removeAttribute=function(a){var b,c,d;if(null==a)throw new Error("Missing attribute name");if(a=a.valueOf(),i(a))for(c=0,d=a.length;d>c;c++)b=a[c],delete this.attributes[b];else delete this.attributes[a];return this},b.prototype.instruction=function(a,b){var c,d,e,g,h;if(null!=a&&(a=a.valueOf()),null!=b&&(b=b.valueOf()),i(a))for(c=0,h=a.length;h>c;c++)d=a[c],this.instruction(d);else if(k(a))for(d in a)m.call(a,d)&&(e=a[d],this.instruction(d,e));else j(b)&&(b=b.apply()),g=new f(this,a,b),this.instructions.push(g);return this},b.prototype.toString=function(a,b){var c,d,e,f,g,i,j,k,l,n,o,p,q,r,s,t,u,v,w,x;for(p=(null!=a?a.pretty:void 0)||!1,f=null!=(r=null!=a?a.indent:void 0)?r:" ",o=null!=(s=null!=a?a.offset:void 0)?s:0,n=null!=(t=null!=a?a.newline:void 0)?t:"\n",b||(b=0),x=new Array(b+o+1).join(f),q="",u=this.instructions,e=0,j=u.length;j>e;e++)g=u[e],q+=g.toString(a,b+1);p&&(q+=x),q+="<"+this.name,v=this.attributes;for(l in v)m.call(v,l)&&(c=v[l],q+=c.toString(a));if(0===this.children.length||h(this.children,function(a){return""===a.value}))q+="/>",p&&(q+=n);else if(p&&1===this.children.length&&null!=this.children[0].value)q+=">",q+=this.children[0].value,q+="</"+this.name+">",q+=n;else{for(q+=">",p&&(q+=n),w=this.children,i=0,k=w.length;k>i;i++)d=w[i],q+=d.toString(a,b+1);p&&(q+=x),q+="</"+this.name+">",p&&(q+=n)}return q},b.prototype.att=function(a,b){return this.attribute(a,b)},b.prototype.ins=function(a,b){return this.instruction(a,b)},b.prototype.a=function(a,b){return this.attribute(a,b)},b.prototype.i=function(a,b){return this.instruction(a,b)},b}(e)}).call(this)},{"./XMLAttribute":32,"./XMLNode":43,"./XMLProcessingInstruction":44,"lodash/collection/every":50,"lodash/lang/isArray":94,"lodash/lang/isFunction":96,"lodash/lang/isObject":98,"lodash/object/create":102}],43:[function(a,b,c){(function(){var c,d,e,f,g,h,i,j,k,l,m,n,o={}.hasOwnProperty;n=a("lodash/lang/isObject"),k=a("lodash/lang/isArray"),m=a("lodash/lang/isFunction"),l=a("lodash/lang/isEmpty"),g=null,c=null,d=null,e=null,f=null,i=null,j=null,b.exports=h=function(){function b(b){this.parent=b,this.options=this.parent.options,this.stringify=this.parent.stringify,null===g&&(g=a("./XMLElement"),c=a("./XMLCData"),d=a("./XMLComment"),e=a("./XMLDeclaration"),f=a("./XMLDocType"),i=a("./XMLRaw"),j=a("./XMLText"))}return b.prototype.clone=function(){throw new Error("Cannot clone generic XMLNode")},b.prototype.element=function(a,b,c){var d,e,f,g,h,i,j;if(g=null,null==b&&(b={}),b=b.valueOf(),n(b)||(i=[b,c],c=i[0],b=i[1]),null!=a&&(a=a.valueOf()),k(a))for(e=0,h=a.length;h>e;e++)d=a[e],g=this.element(d);else if(m(a))g=this.element(a.apply());else if(n(a))for(f in a)o.call(a,f)&&(j=a[f],m(j)&&(j=j.apply()),n(j)&&l(j)&&(j=null),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&0===f.indexOf(this.stringify.convertAttKey)?g=this.attribute(f.substr(this.stringify.convertAttKey.length),j):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&0===f.indexOf(this.stringify.convertPIKey)?g=this.instruction(f.substr(this.stringify.convertPIKey.length),j):n(j)?!this.options.ignoreDecorators&&this.stringify.convertListKey&&0===f.indexOf(this.stringify.convertListKey)&&k(j)?g=this.element(j):(g=this.element(f),g.element(j)):g=this.element(f,j));else g=!this.options.ignoreDecorators&&this.stringify.convertTextKey&&0===a.indexOf(this.stringify.convertTextKey)?this.text(c):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&0===a.indexOf(this.stringify.convertCDataKey)?this.cdata(c):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&0===a.indexOf(this.stringify.convertCommentKey)?this.comment(c):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&0===a.indexOf(this.stringify.convertRawKey)?this.raw(c):this.node(a,b,c);if(null==g)throw new Error("Could not create any elements with: "+a);return g},b.prototype.insertBefore=function(a,b,c){var d,e,f;if(this.isRoot)throw new Error("Cannot insert elements at root level");return e=this.parent.children.indexOf(this),f=this.parent.children.splice(e),d=this.parent.element(a,b,c),Array.prototype.push.apply(this.parent.children,f),d},b.prototype.insertAfter=function(a,b,c){var d,e,f;if(this.isRoot)throw new Error("Cannot insert elements at root level");return e=this.parent.children.indexOf(this),f=this.parent.children.splice(e+1),d=this.parent.element(a,b,c),Array.prototype.push.apply(this.parent.children,f),d},b.prototype.remove=function(){var a,b;if(this.isRoot)throw new Error("Cannot remove the root element");return a=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[a,a-a+1].concat(b=[])),b,this.parent},b.prototype.node=function(a,b,c){var d,e;return null!=a&&(a=a.valueOf()),null==b&&(b={}),b=b.valueOf(),n(b)||(e=[b,c],c=e[0],b=e[1]),d=new g(this,a,b),null!=c&&d.text(c),this.children.push(d),d},b.prototype.text=function(a){var b;return b=new j(this,a),this.children.push(b),this},b.prototype.cdata=function(a){var b;return b=new c(this,a),this.children.push(b),this},b.prototype.comment=function(a){var b;return b=new d(this,a),this.children.push(b),this},b.prototype.raw=function(a){var b;return b=new i(this,a),this.children.push(b),this},b.prototype.declaration=function(a,b,c){var d,f;return d=this.document(),f=new e(d,a,b,c),d.xmldec=f,d.root()},b.prototype.doctype=function(a,b){var c,d;return c=this.document(),d=new f(c,a,b),c.doctype=d,d},b.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},b.prototype.root=function(){var a;if(this.isRoot)return this;for(a=this.parent;!a.isRoot;)a=a.parent;return a},b.prototype.document=function(){return this.root().documentObject},b.prototype.end=function(a){return this.document().toString(a)},b.prototype.prev=function(){var a;if(this.isRoot)throw new Error("Root node has no siblings");if(a=this.parent.children.indexOf(this),1>a)throw new Error("Already at the first node");return this.parent.children[a-1]},b.prototype.next=function(){var a;if(this.isRoot)throw new Error("Root node has no siblings");if(a=this.parent.children.indexOf(this),-1===a||a===this.parent.children.length-1)throw new Error("Already at the last node");return this.parent.children[a+1]},b.prototype.importXMLBuilder=function(a){var b;return b=a.root().clone(),b.parent=this,b.isRoot=!1,this.children.push(b),this},b.prototype.ele=function(a,b,c){return this.element(a,b,c)},b.prototype.nod=function(a,b,c){return this.node(a,b,c)},b.prototype.txt=function(a){return this.text(a)},b.prototype.dat=function(a){return this.cdata(a)},b.prototype.com=function(a){return this.comment(a)},b.prototype.doc=function(){return this.document()},b.prototype.dec=function(a,b,c){return this.declaration(a,b,c)},b.prototype.dtd=function(a,b){return this.doctype(a,b)},b.prototype.e=function(a,b,c){return this.element(a,b,c)},b.prototype.n=function(a,b,c){return this.node(a,b,c)},b.prototype.t=function(a){return this.text(a)},b.prototype.d=function(a){return this.cdata(a)},b.prototype.c=function(a){return this.comment(a)},b.prototype.r=function(a){return this.raw(a)},b.prototype.u=function(){return this.up()},b}()}).call(this)},{"./XMLCData":34,"./XMLComment":35,"./XMLDeclaration":40,"./XMLDocType":41,"./XMLElement":42,"./XMLRaw":45,"./XMLText":47,"lodash/lang/isArray":94,"lodash/lang/isEmpty":95,"lodash/lang/isFunction":96,"lodash/lang/isObject":98}],44:[function(a,b,c){(function(){var c,d;d=a("lodash/object/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing instruction target");this.target=this.stringify.insTarget(b),c&&(this.value=this.stringify.insValue(c))}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<?",g+=this.target,this.value&&(g+=" "+this.value),g+="?>",f&&(g+=d),g},a}()}).call(this)},{"lodash/object/create":102}],45:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/object/create"),c=a("./XMLNode"),b.exports=d=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing raw text");this.value=this.stringify.raw(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+=this.value,f&&(g+=d),g},b}(c)}).call(this)},{"./XMLNode":43,"lodash/object/create":102}],46:[function(a,b,c){(function(){var a,c=function(a,b){return function(){return a.apply(b,arguments)}},d={}.hasOwnProperty;b.exports=a=function(){function a(a){this.assertLegalChar=c(this.assertLegalChar,this);var b,e,f;this.allowSurrogateChars=null!=a?a.allowSurrogateChars:void 0,e=(null!=a?a.stringify:void 0)||{};for(b in e)d.call(e,b)&&(f=e[b],this[b]=f)}return a.prototype.eleName=function(a){return a=""+a||"",this.assertLegalChar(a)},a.prototype.eleText=function(a){return a=""+a||"",this.assertLegalChar(this.elEscape(a))},a.prototype.cdata=function(a){if(a=""+a||"",a.match(/]]>/))throw new Error("Invalid CDATA text: "+a);return this.assertLegalChar(a)},a.prototype.comment=function(a){if(a=""+a||"",a.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+a);return this.assertLegalChar(a)},a.prototype.raw=function(a){return""+a||""},a.prototype.attName=function(a){return""+a||""},a.prototype.attValue=function(a){return a=""+a||"",this.attEscape(a)},a.prototype.insTarget=function(a){return""+a||""},a.prototype.insValue=function(a){if(a=""+a||"",a.match(/\?>/))throw new Error("Invalid processing instruction value: "+a);return a},a.prototype.xmlVersion=function(a){if(a=""+a||"",!a.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+a);return a},a.prototype.xmlEncoding=function(a){if(a=""+a||"",!a.match(/[A-Za-z](?:[A-Za-z0-9._-]|-)*/))throw new Error("Invalid encoding: "+a);return a},a.prototype.xmlStandalone=function(a){return a?"yes":"no"},a.prototype.dtdPubID=function(a){return""+a||""},a.prototype.dtdSysID=function(a){return""+a||""},a.prototype.dtdElementValue=function(a){return""+a||""},a.prototype.dtdAttType=function(a){return""+a||""},a.prototype.dtdAttDefault=function(a){return null!=a?""+a||"":a},a.prototype.dtdEntityValue=function(a){return""+a||""},a.prototype.dtdNData=function(a){return""+a||""},a.prototype.convertAttKey="@",a.prototype.convertPIKey="?",a.prototype.convertTextKey="#text",a.prototype.convertCDataKey="#cdata",a.prototype.convertCommentKey="#comment",a.prototype.convertRawKey="#raw",a.prototype.convertListKey="#list",a.prototype.assertLegalChar=function(a){var b,c;if(b=this.allowSurrogateChars?/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]/:/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/,c=a.match(b))throw new Error("Invalid character ("+c+") in string: "+a+" at index "+c.index);return a},a.prototype.elEscape=function(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
")},a.prototype.attEscape=function(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
")},a}()}).call(this)},{}],47:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/object/create"),c=a("./XMLNode"),b.exports=d=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing element text");this.value=this.stringify.eleText(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+=this.value,f&&(g+=d),g},b}(c)}).call(this)},{"./XMLNode":43,"lodash/object/create":102}],48:[function(a,b,c){(function(){var c,d;d=a("lodash/object/assign"),c=a("./XMLBuilder"),b.exports.create=function(a,b,e,f){return f=d({},b,e,f),new c(a,f).root()}}).call(this)},{"./XMLBuilder":33,"lodash/object/assign":101}],49:[function(a,b,c){function d(a){var b=a?a.length:0;return b?a[b-1]:void 0}b.exports=d},{}],50:[function(a,b,c){function d(a,b,c){var d=h(a)?e:g;return c&&i(a,b,c)&&(b=void 0),("function"!=typeof b||void 0!==c)&&(b=f(b,c,3)),d(a,b)}var e=a("../internal/arrayEvery"),f=a("../internal/baseCallback"),g=a("../internal/baseEvery"),h=a("../lang/isArray"),i=a("../internal/isIterateeCall");b.exports=d},{"../internal/arrayEvery":52,"../internal/baseCallback":56,"../internal/baseEvery":60,"../internal/isIterateeCall":85,"../lang/isArray":94}],51:[function(a,b,c){function d(a,b){if("function"!=typeof a)throw new TypeError(e);return b=f(void 0===b?a.length-1:+b||0,0),function(){for(var c=arguments,d=-1,e=f(c.length-b,0),g=Array(e);++d<e;)g[d]=c[b+d];switch(b){case 0:return a.call(this,g);case 1:return a.call(this,c[0],g);case 2:return a.call(this,c[0],c[1],g)}var h=Array(b+1);for(d=-1;++d<b;)h[d]=c[d];return h[b]=g,a.apply(this,h)}}var e="Expected a function",f=Math.max;b.exports=d},{}],52:[function(a,b,c){function d(a,b){for(var c=-1,d=a.length;++c<d;)if(!b(a[c],c,a))return!1;return!0}b.exports=d},{}],53:[function(a,b,c){function d(a,b){for(var c=-1,d=a.length;++c<d;)if(b(a[c],c,a))return!0;return!1}b.exports=d},{}],54:[function(a,b,c){function d(a,b,c){for(var d=-1,f=e(b),g=f.length;++d<g;){var h=f[d],i=a[h],j=c(i,b[h],h,a,b);(j===j?j===i:i!==i)&&(void 0!==i||h in a)||(a[h]=j)}return a}var e=a("../object/keys");b.exports=d},{"../object/keys":103}],55:[function(a,b,c){function d(a,b){return null==b?a:e(b,f(b),a)}var e=a("./baseCopy"),f=a("../object/keys");b.exports=d},{"../object/keys":103,"./baseCopy":57}],56:[function(a,b,c){function d(a,b,c){var d=typeof a;return"function"==d?void 0===b?a:g(a,b,c):null==a?h:"object"==d?e(a):void 0===b?i(a):f(a,b)}var e=a("./baseMatches"),f=a("./baseMatchesProperty"),g=a("./bindCallback"),h=a("../utility/identity"),i=a("../utility/property");b.exports=d},{"../utility/identity":106,"../utility/property":107,"./baseMatches":67,"./baseMatchesProperty":68,"./bindCallback":73}],57:[function(a,b,c){function d(a,b,c){c||(c={});for(var d=-1,e=b.length;++d<e;){var f=b[d];c[f]=a[f]}return c}b.exports=d},{}],58:[function(a,b,c){var d=a("../lang/isObject"),e=function(){function a(){}return function(b){if(d(b)){a.prototype=b;var c=new a;a.prototype=void 0}return c||{}}}();b.exports=e},{"../lang/isObject":98}],59:[function(a,b,c){var d=a("./baseForOwn"),e=a("./createBaseEach"),f=e(d);b.exports=f},{"./baseForOwn":62,"./createBaseEach":75}],60:[function(a,b,c){function d(a,b){var c=!0;return e(a,function(a,d,e){return c=!!b(a,d,e)}),c}var e=a("./baseEach");b.exports=d},{"./baseEach":59}],61:[function(a,b,c){var d=a("./createBaseFor"),e=d();b.exports=e},{"./createBaseFor":76}],62:[function(a,b,c){function d(a,b){return e(a,b,f)}var e=a("./baseFor"),f=a("../object/keys");b.exports=d},{"../object/keys":103,"./baseFor":61}],63:[function(a,b,c){function d(a,b,c){if(null!=a){void 0!==c&&c in e(a)&&(b=[c]);for(var d=0,f=b.length;null!=a&&f>d;)a=a[b[d++]];return d&&d==f?a:void 0}}var e=a("./toObject");b.exports=d},{"./toObject":91}],64:[function(a,b,c){function d(a,b,c,h,i,j){return a===b?!0:null==a||null==b||!f(a)&&!g(b)?a!==a&&b!==b:e(a,b,d,c,h,i,j)}var e=a("./baseIsEqualDeep"),f=a("../lang/isObject"),g=a("./isObjectLike");b.exports=d},{"../lang/isObject":98,"./baseIsEqualDeep":65,"./isObjectLike":88}],65:[function(a,b,c){function d(a,b,c,d,m,p,q){var r=h(a),s=h(b),t=k,u=k;r||(t=o.call(a),t==j?t=l:t!=l&&(r=i(a))),s||(u=o.call(b),u==j?u=l:u!=l&&(s=i(b)));var v=t==l,w=u==l,x=t==u;if(x&&!r&&!v)return f(a,b,t);if(!m){var y=v&&n.call(a,"__wrapped__"),z=w&&n.call(b,"__wrapped__");if(y||z)return c(y?a.value():a,z?b.value():b,d,m,p,q)}if(!x)return!1;p||(p=[]),q||(q=[]);for(var A=p.length;A--;)if(p[A]==a)return q[A]==b;p.push(a),q.push(b);var B=(r?e:g)(a,b,c,d,m,p,q);return p.pop(),q.pop(),B}var e=a("./equalArrays"),f=a("./equalByTag"),g=a("./equalObjects"),h=a("../lang/isArray"),i=a("../lang/isTypedArray"),j="[object Arguments]",k="[object Array]",l="[object Object]",m=Object.prototype,n=m.hasOwnProperty,o=m.toString;b.exports=d},{"../lang/isArray":94,"../lang/isTypedArray":100,"./equalArrays":77,"./equalByTag":78,"./equalObjects":79}],66:[function(a,b,c){function d(a,b,c){var d=b.length,g=d,h=!c;if(null==a)return!g;for(a=f(a);d--;){var i=b[d];if(h&&i[2]?i[1]!==a[i[0]]:!(i[0]in a))return!1}for(;++d<g;){i=b[d];var j=i[0],k=a[j],l=i[1];if(h&&i[2]){if(void 0===k&&!(j in a))return!1}else{var m=c?c(k,l,j):void 0;if(!(void 0===m?e(l,k,c,!0):m))return!1}}return!0}var e=a("./baseIsEqual"),f=a("./toObject");b.exports=d},{"./baseIsEqual":64,"./toObject":91}],67:[function(a,b,c){function d(a){var b=f(a);if(1==b.length&&b[0][2]){var c=b[0][0],d=b[0][1];return function(a){return null==a?!1:a[c]===d&&(void 0!==d||c in g(a))}}return function(a){return e(a,b)}}var e=a("./baseIsMatch"),f=a("./getMatchData"),g=a("./toObject");b.exports=d},{"./baseIsMatch":66,"./getMatchData":81,"./toObject":91}],68:[function(a,b,c){function d(a,b){var c=h(a),d=i(a)&&j(b),n=a+"";return a=m(a),function(h){if(null==h)return!1;var i=n;if(h=l(h),(c||!d)&&!(i in h)){if(h=1==a.length?h:e(h,g(a,0,-1)),null==h)return!1;i=k(a),h=l(h)}return h[i]===b?void 0!==b||i in h:f(b,h[i],void 0,!0)}}var e=a("./baseGet"),f=a("./baseIsEqual"),g=a("./baseSlice"),h=a("../lang/isArray"),i=a("./isKey"),j=a("./isStrictComparable"),k=a("../array/last"),l=a("./toObject"),m=a("./toPath");b.exports=d},{"../array/last":49,"../lang/isArray":94,"./baseGet":63,"./baseIsEqual":64,"./baseSlice":71,"./isKey":86,"./isStrictComparable":89,"./toObject":91,"./toPath":92}],69:[function(a,b,c){function d(a){return function(b){return null==b?void 0:b[a]}}b.exports=d},{}],70:[function(a,b,c){function d(a){var b=a+"";return a=f(a),function(c){return e(c,a,b)}}var e=a("./baseGet"),f=a("./toPath");b.exports=d},{"./baseGet":63,"./toPath":92}],71:[function(a,b,c){function d(a,b,c){var d=-1,e=a.length;b=null==b?0:+b||0,0>b&&(b=-b>e?0:e+b),c=void 0===c||c>e?e:+c||0,0>c&&(c+=e),e=b>c?0:c-b>>>0,b>>>=0;for(var f=Array(e);++d<e;)f[d]=a[d+b];return f}b.exports=d},{}],72:[function(a,b,c){function d(a){return null==a?"":a+""}b.exports=d},{}],73:[function(a,b,c){function d(a,b,c){if("function"!=typeof a)return e;if(void 0===b)return a;switch(c){case 1:return function(c){return a.call(b,c)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)};case 5:return function(c,d,e,f,g){return a.call(b,c,d,e,f,g)}}return function(){return a.apply(b,arguments)}}var e=a("../utility/identity");b.exports=d},{"../utility/identity":106}],74:[function(a,b,c){function d(a){return g(function(b,c){var d=-1,g=null==b?0:c.length,h=g>2?c[g-2]:void 0,i=g>2?c[2]:void 0,j=g>1?c[g-1]:void 0;for("function"==typeof h?(h=e(h,j,5),g-=2):(h="function"==typeof j?j:void 0,g-=h?1:0),i&&f(c[0],c[1],i)&&(h=3>g?void 0:h,g=1);++d<g;){var k=c[d];k&&a(b,k,h)}return b})}var e=a("./bindCallback"),f=a("./isIterateeCall"),g=a("../function/restParam");b.exports=d},{"../function/restParam":51,"./bindCallback":73,"./isIterateeCall":85}],75:[function(a,b,c){function d(a,b){return function(c,d){var h=c?e(c):0;if(!f(h))return a(c,d);for(var i=b?h:-1,j=g(c);(b?i--:++i<h)&&d(j[i],i,j)!==!1;);return c}}var e=a("./getLength"),f=a("./isLength"),g=a("./toObject");b.exports=d},{"./getLength":80,"./isLength":87,"./toObject":91}],76:[function(a,b,c){function d(a){return function(b,c,d){for(var f=e(b),g=d(b),h=g.length,i=a?h:-1;a?i--:++i<h;){var j=g[i];if(c(f[j],j,f)===!1)break}return b}}var e=a("./toObject");b.exports=d},{"./toObject":91}],77:[function(a,b,c){function d(a,b,c,d,f,g,h){var i=-1,j=a.length,k=b.length;if(j!=k&&!(f&&k>j))return!1;for(;++i<j;){var l=a[i],m=b[i],n=d?d(f?m:l,f?l:m,i):void 0;if(void 0!==n){if(n)continue;return!1}if(f){if(!e(b,function(a){return l===a||c(l,a,d,f,g,h)}))return!1}else if(l!==m&&!c(l,m,d,f,g,h))return!1}return!0}var e=a("./arraySome");b.exports=d},{"./arraySome":53}],78:[function(a,b,c){function d(a,b,c){switch(c){case e:case f:return+a==+b;case g:return a.name==b.name&&a.message==b.message;case h:return a!=+a?b!=+b:a==+b;case i:case j:return a==b+""}return!1}var e="[object Boolean]",f="[object Date]",g="[object Error]",h="[object Number]",i="[object RegExp]",j="[object String]";b.exports=d},{}],79:[function(a,b,c){function d(a,b,c,d,f,h,i){var j=e(a),k=j.length,l=e(b),m=l.length;if(k!=m&&!f)return!1;for(var n=k;n--;){var o=j[n];if(!(f?o in b:g.call(b,o)))return!1}for(var p=f;++n<k;){o=j[n];var q=a[o],r=b[o],s=d?d(f?r:q,f?q:r,o):void 0;if(!(void 0===s?c(q,r,d,f,h,i):s))return!1;p||(p="constructor"==o)}if(!p){var t=a.constructor,u=b.constructor;if(t!=u&&"constructor"in a&&"constructor"in b&&!("function"==typeof t&&t instanceof t&&"function"==typeof u&&u instanceof u))return!1}return!0}var e=a("../object/keys"),f=Object.prototype,g=f.hasOwnProperty;b.exports=d},{"../object/keys":103}],80:[function(a,b,c){var d=a("./baseProperty"),e=d("length");b.exports=e},{"./baseProperty":69}],81:[function(a,b,c){function d(a){for(var b=f(a),c=b.length;c--;)b[c][2]=e(b[c][1]);return b}var e=a("./isStrictComparable"),f=a("../object/pairs");b.exports=d},{"../object/pairs":105,"./isStrictComparable":89}],82:[function(a,b,c){function d(a,b){var c=null==a?void 0:a[b];return e(c)?c:void 0}var e=a("../lang/isNative");b.exports=d},{"../lang/isNative":97}],83:[function(a,b,c){function d(a){return null!=a&&f(e(a))}var e=a("./getLength"),f=a("./isLength");b.exports=d},{"./getLength":80,"./isLength":87}],84:[function(a,b,c){function d(a,b){return a="number"==typeof a||e.test(a)?+a:-1,b=null==b?f:b,a>-1&&a%1==0&&b>a}var e=/^\d+$/,f=9007199254740991;b.exports=d},{}],85:[function(a,b,c){function d(a,b,c){if(!g(c))return!1;var d=typeof b;if("number"==d?e(c)&&f(b,c.length):"string"==d&&b in c){var h=c[b];return a===a?a===h:h!==h}return!1}var e=a("./isArrayLike"),f=a("./isIndex"),g=a("../lang/isObject");b.exports=d},{"../lang/isObject":98,"./isArrayLike":83,"./isIndex":84}],86:[function(a,b,c){function d(a,b){var c=typeof a;if("string"==c&&h.test(a)||"number"==c)return!0;if(e(a))return!1;var d=!g.test(a);return d||null!=b&&a in f(b)}var e=a("../lang/isArray"),f=a("./toObject"),g=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,h=/^\w*$/;b.exports=d},{"../lang/isArray":94,"./toObject":91}],87:[function(a,b,c){function d(a){return"number"==typeof a&&a>-1&&a%1==0&&e>=a}var e=9007199254740991;b.exports=d},{}],88:[function(a,b,c){function d(a){return!!a&&"object"==typeof a}b.exports=d},{}],89:[function(a,b,c){function d(a){return a===a&&!e(a)}var e=a("../lang/isObject");b.exports=d},{"../lang/isObject":98}],90:[function(a,b,c){function d(a){for(var b=i(a),c=b.length,d=c&&a.length,j=!!d&&h(d)&&(f(a)||e(a)),l=-1,m=[];++l<c;){var n=b[l];(j&&g(n,d)||k.call(a,n))&&m.push(n)}return m}var e=a("../lang/isArguments"),f=a("../lang/isArray"),g=a("./isIndex"),h=a("./isLength"),i=a("../object/keysIn"),j=Object.prototype,k=j.hasOwnProperty;b.exports=d},{"../lang/isArguments":93,"../lang/isArray":94,"../object/keysIn":104,"./isIndex":84,"./isLength":87}],91:[function(a,b,c){function d(a){return e(a)?a:Object(a)}var e=a("../lang/isObject");b.exports=d},{"../lang/isObject":98}],92:[function(a,b,c){function d(a){if(f(a))return a;var b=[];return e(a).replace(g,function(a,c,d,e){b.push(d?e.replace(h,"$1"):c||a)}),b}var e=a("./baseToString"),f=a("../lang/isArray"),g=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,h=/\\(\\)?/g;b.exports=d},{"../lang/isArray":94,"./baseToString":72}],93:[function(a,b,c){function d(a){return f(a)&&e(a)&&h.call(a,"callee")&&!i.call(a,"callee")}var e=a("../internal/isArrayLike"),f=a("../internal/isObjectLike"),g=Object.prototype,h=g.hasOwnProperty,i=g.propertyIsEnumerable;b.exports=d},{"../internal/isArrayLike":83,"../internal/isObjectLike":88}],94:[function(a,b,c){var d=a("../internal/getNative"),e=a("../internal/isLength"),f=a("../internal/isObjectLike"),g="[object Array]",h=Object.prototype,i=h.toString,j=d(Array,"isArray"),k=j||function(a){return f(a)&&e(a.length)&&i.call(a)==g};b.exports=k},{"../internal/getNative":82,"../internal/isLength":87,"../internal/isObjectLike":88}],95:[function(a,b,c){function d(a){return null==a?!0:g(a)&&(f(a)||j(a)||e(a)||i(a)&&h(a.splice))?!a.length:!k(a).length}var e=a("./isArguments"),f=a("./isArray"),g=a("../internal/isArrayLike"),h=a("./isFunction"),i=a("../internal/isObjectLike"),j=a("./isString"),k=a("../object/keys");b.exports=d},{"../internal/isArrayLike":83,"../internal/isObjectLike":88,"../object/keys":103,"./isArguments":93,"./isArray":94,"./isFunction":96,"./isString":99}],96:[function(a,b,c){function d(a){return e(a)&&h.call(a)==f}var e=a("./isObject"),f="[object Function]",g=Object.prototype,h=g.toString;b.exports=d},{"./isObject":98}],97:[function(a,b,c){function d(a){return null==a?!1:e(a)?k.test(i.call(a)):f(a)&&g.test(a)}var e=a("./isFunction"),f=a("../internal/isObjectLike"),g=/^\[object .+?Constructor\]$/,h=Object.prototype,i=Function.prototype.toString,j=h.hasOwnProperty,k=RegExp("^"+i.call(j).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");b.exports=d},{"../internal/isObjectLike":88,"./isFunction":96}],98:[function(a,b,c){function d(a){var b=typeof a;return!!a&&("object"==b||"function"==b)}b.exports=d},{}],99:[function(a,b,c){function d(a){return"string"==typeof a||e(a)&&h.call(a)==f}var e=a("../internal/isObjectLike"),f="[object String]",g=Object.prototype,h=g.toString;b.exports=d},{"../internal/isObjectLike":88}],100:[function(a,b,c){function d(a){return f(a)&&e(a.length)&&!!D[F.call(a)]}var e=a("../internal/isLength"),f=a("../internal/isObjectLike"),g="[object Arguments]",h="[object Array]",i="[object Boolean]",j="[object Date]",k="[object Error]",l="[object Function]",m="[object Map]",n="[object Number]",o="[object Object]",p="[object RegExp]",q="[object Set]",r="[object String]",s="[object WeakMap]",t="[object ArrayBuffer]",u="[object Float32Array]",v="[object Float64Array]",w="[object Int8Array]",x="[object Int16Array]",y="[object Int32Array]",z="[object Uint8Array]",A="[object Uint8ClampedArray]",B="[object Uint16Array]",C="[object Uint32Array]",D={};
D[u]=D[v]=D[w]=D[x]=D[y]=D[z]=D[A]=D[B]=D[C]=!0,D[g]=D[h]=D[t]=D[i]=D[j]=D[k]=D[l]=D[m]=D[n]=D[o]=D[p]=D[q]=D[r]=D[s]=!1;var E=Object.prototype,F=E.toString;b.exports=d},{"../internal/isLength":87,"../internal/isObjectLike":88}],101:[function(a,b,c){var d=a("../internal/assignWith"),e=a("../internal/baseAssign"),f=a("../internal/createAssigner"),g=f(function(a,b,c){return c?d(a,b,c):e(a,b)});b.exports=g},{"../internal/assignWith":54,"../internal/baseAssign":55,"../internal/createAssigner":74}],102:[function(a,b,c){function d(a,b,c){var d=f(a);return c&&g(a,b,c)&&(b=void 0),b?e(d,b):d}var e=a("../internal/baseAssign"),f=a("../internal/baseCreate"),g=a("../internal/isIterateeCall");b.exports=d},{"../internal/baseAssign":55,"../internal/baseCreate":58,"../internal/isIterateeCall":85}],103:[function(a,b,c){var d=a("../internal/getNative"),e=a("../internal/isArrayLike"),f=a("../lang/isObject"),g=a("../internal/shimKeys"),h=d(Object,"keys"),i=h?function(a){var b=null==a?void 0:a.constructor;return"function"==typeof b&&b.prototype===a||"function"!=typeof a&&e(a)?g(a):f(a)?h(a):[]}:g;b.exports=i},{"../internal/getNative":82,"../internal/isArrayLike":83,"../internal/shimKeys":90,"../lang/isObject":98}],104:[function(a,b,c){function d(a){if(null==a)return[];i(a)||(a=Object(a));var b=a.length;b=b&&h(b)&&(f(a)||e(a))&&b||0;for(var c=a.constructor,d=-1,j="function"==typeof c&&c.prototype===a,l=Array(b),m=b>0;++d<b;)l[d]=d+"";for(var n in a)m&&g(n,b)||"constructor"==n&&(j||!k.call(a,n))||l.push(n);return l}var e=a("../lang/isArguments"),f=a("../lang/isArray"),g=a("../internal/isIndex"),h=a("../internal/isLength"),i=a("../lang/isObject"),j=Object.prototype,k=j.hasOwnProperty;b.exports=d},{"../internal/isIndex":84,"../internal/isLength":87,"../lang/isArguments":93,"../lang/isArray":94,"../lang/isObject":98}],105:[function(a,b,c){function d(a){a=f(a);for(var b=-1,c=e(a),d=c.length,g=Array(d);++b<d;){var h=c[b];g[b]=[h,a[h]]}return g}var e=a("./keys"),f=a("../internal/toObject");b.exports=d},{"../internal/toObject":91,"./keys":103}],106:[function(a,b,c){function d(a){return a}b.exports=d},{}],107:[function(a,b,c){function d(a){return g(a)?e(a):f(a)}var e=a("../internal/baseProperty"),f=a("../internal/basePropertyDeep"),g=a("../internal/isKey");b.exports=d},{"../internal/baseProperty":69,"../internal/basePropertyDeep":70,"../internal/isKey":86}]},{},[1])(1)});
//# sourceMappingURL=jsforce-api-metadata.min.js.map | rlugojr/cdnjs | ajax/libs/jsforce/1.5.1/jsforce-api-metadata.min.js | JavaScript | mit | 131,049 |
var server = require('./server')
, assert = require('assert')
, request = require('../main.js')
var s = server.createServer()
var ss = server.createSSLServer()
var sUrl = 'http://localhost:' + s.port
var ssUrl = 'https://localhost:' + ss.port
s.listen(s.port, bouncy(s, ssUrl))
ss.listen(ss.port, bouncy(ss, sUrl))
var hits = {}
var expect = {}
var pending = 0
function bouncy (s, server) { return function () {
var redirs = { a: 'b'
, b: 'c'
, c: 'd'
, d: 'e'
, e: 'f'
, f: 'g'
, g: 'h'
, h: 'end' }
var perm = true
Object.keys(redirs).forEach(function (p) {
var t = redirs[p]
// switch type each time
var type = perm ? 301 : 302
perm = !perm
s.on('/' + p, function (req, res) {
res.writeHead(type, { location: server + '/' + t })
res.end()
})
})
s.on('/end', function (req, res) {
var h = req.headers['x-test-key']
hits[h] = true
pending --
if (pending === 0) done()
})
}}
for (var i = 0; i < 5; i ++) {
pending ++
var val = 'test_' + i
expect[val] = true
request({ url: (i % 2 ? sUrl : ssUrl) + '/a'
, headers: { 'x-test-key': val } })
}
function done () {
assert.deepEqual(hits, expect)
process.exit(0)
}
| KamillaKhabibrakhmanova/fish | node_modules/ripple-emulator/node_modules/request/tests/test-protocol-changing-redirect.js | JavaScript | mit | 1,314 |
/*!
CamanJS - Pure HTML5 Javascript (Ca)nvas (Man)ipulation
http://camanjs.com/
Copyright 2011, Ryan LeFevre
Licensed under the new BSD License.
See LICENSE for more info.
Project Contributors:
Ryan LeFevre - Lead Developer and Project Maintainer
Twitter: @meltingice
GitHUb: http://github.com/meltingice
Rick Waldron - Plugin Architect and Developer
Twitter: @rwaldron
GitHub: http://github.com/rwldrn
Cezar Sa Espinola - Developer
Twitter: @cezarsa
GitHub: http://github.com/cezarsa
*/(function(){var forEach=Array.prototype.forEach,hasOwn=Object.prototype.hasOwnProperty,slice=Array.prototype.slice,$=function(id){if(id[0]=='#'){id=id.substr(1);}
return document.getElementById(id);},Caman=function(){if(arguments.length==1){if(Caman.store[arguments[0]]){return Caman.store[arguments[0]];}else{return new Caman.manip.loadImage(arguments[0]);}}else if(arguments.length==2){if(Caman.store[arguments[0]]){return arguments[1].call(Caman.store[arguments[0]],Caman.store[arguments[0]]);}else{if(typeof arguments[1]==='function'){return new Caman.manip.loadImage(arguments[0],arguments[1]);}else if(typeof arguments[1]==='string'){return new Caman.manip.loadCanvas(arguments[0],arguments[1]);}}}else if(arguments.length==3){if(Caman.store[arguments[0]]){return arguments[2].call(Caman.store[arguments[1]],Caman.store[arguments[1]]);}else{return new Caman.manip.loadCanvas(arguments[0],arguments[1],arguments[2]);}}};if(!('console'in window)){window.console={log:function(){},info:function(){},error:function(){}};}
Caman.ready=false;Caman.store={};Caman.renderBlocks=4;Caman.remoteProxy="";Caman.useProxy=function(lang){var langToExt={ruby:'rb',python:'py',perl:'pl'};lang=langToExt[lang.toLowerCase()]||lang.toLowerCase();return"proxies/caman_proxy."+lang;};Caman.uniqid=(function(){var id=0;return{get:function(){return id++;},reset:function(){id=0;}};}());var remoteCheck=function(src){if(Caman.isRemote(src)){if(!Caman.remoteProxy.length){console.info("Attempting to load remote image without a configured proxy, URL: "+src);return;}else{if(Caman.isRemote(Caman.remoteProxy)){console.info("Cannot use a remote proxy for loading remote images due to same-origin policy");return;}
return Caman.remoteProxy+"?url="+encodeURIComponent(src);}}};var finishInit=function(image,canvas,callback){var self=this;this.pixelStack=[];this.layerStack=[];canvas.width=image.width;canvas.height=image.height;this.canvas=canvas;this.context=canvas.getContext("2d");this.context.drawImage(image,0,0);this.image_data=this.context.getImageData(0,0,image.width,image.height);this.pixel_data=this.image_data.data;this.dimensions={width:image.width,height:image.height};this.renderQueue=[];Caman.store[this.canvas_id]=this;callback.call(this,this);return this;};Caman.manip=Caman.prototype={loadImage:function(image_id,callback){var domLoaded,self=this,startFn=function(){var canvas=document.createElement('canvas'),image=$(image_id),proxyURL=remoteCheck(image.src);if($(image_id)===null||$(image_id).nodeName.toLowerCase()!=='img'){throw"Given element ID isn't an image: "+image_id;}
canvas.id=image.id;image.parentNode.replaceChild(canvas,image);if(proxyURL){image.src=proxyURL;}
this.canvas_id=image_id;this.options={canvas:image_id,image:image.src};image.onload=function(){finishInit.call(self,image,canvas,callback);};return this;};callback=callback||function(){};if(typeof image_id==="object"&&image_id.nodeName.toLowerCase()=="img"){var element=image_id;if(image_id.id){image_id=element.id;}else{image_id="caman-"+Caman.uniqid.get();element.id=image_id;}}
domLoaded=($(image_id)!==null);if(domLoaded){startFn.call(this);}else{document.addEventListener("DOMContentLoaded",function(){startFn.call(self);},false);}
return this;},loadCanvas:function(url,canvas_id,callback){var domLoaded,self=this,startFn=function(){var canvas=$(canvas_id),image=document.createElement('img'),proxyURL=remoteCheck(url);if($(canvas_id)===null||$(canvas_id).nodeName.toLowerCase()!=='canvas'){throw"Given element ID isn't a canvas: "+canvas_id;}
if(proxyURL){image.src=proxyURL;}else{image.src=url;}
this.canvas_id=canvas_id;this.options={canvas:canvas_id,image:image.src};image.onload=function(){finishInit.call(self,image,canvas,callback);};};callback=callback||function(){};if(typeof canvas_id==="object"&&canvas_id.nodeName.toLowerCase()=="canvas"){var element=canvas_id;if(canvas_id.id){canvas_id=element.id;}else{canvas_id="caman-"+Caman.uniqid.get();element.id=canvas_id;}}
domLoaded=($(canvas_id)!==null);if(domLoaded){startFn.call(this);}else{document.addEventListener("DOMContentLoaded",function(){startFn.call(self);},false);}
return this;},save:function(type){if(type){type=type.toLowerCase();}
if(!type||(type!=='png'&&type!=='jpg')){type='png';}
document.location.href=this.toBase64(type).replace("image/"+type,"image/octet-stream");},toImage:function(type){var img;img=document.createElement('img');img.src=this.toBase64(type);return img;},toBase64:function(type){if(type){type=type.toLowerCase();}
if(!type||(type!=='png'&&type!=='jpg')){type='png';}
return this.canvas.toDataURL("image/"+type);},revert:function(ready){this.loadCanvas(this.options.image,this.options.canvas,ready);},render:function(callback){this.processNext(function(){this.context.putImageData(this.image_data,0,0);if(typeof callback==='function'){callback.call(this);}});}};Caman.manip.loadImage.prototype=Caman.manip;Caman.manip.loadCanvas.prototype=Caman.manip;Caman.forEach=function(obj,fn,context){if(!obj||!fn){return{};}
context=context||this;if(forEach&&obj.forEach===forEach){return obj.forEach(fn,context);}
for(var key in obj){if(hasOwn.call(obj,key)){fn.call(context,obj[key],key,obj);}}
return obj;};Caman.extend=function(obj){var dest=obj,src=slice.call(arguments,1);Caman.forEach(src,function(copy){for(var prop in copy){dest[prop]=copy[prop];}});return dest;};Caman.events={types:["processStart","processComplete","renderFinished"],fn:{trigger:function(target,type,data){var _target=target,_type=type,_data=data;if(Caman.events.types.indexOf(target)!==-1){_target=this;_type=target;_data=type;}
if(Caman.events.fn[_type]&&Caman.sizeOf(Caman.events.fn[_type])){Caman.forEach(Caman.events.fn[_type],function(obj,key){obj.call(_target,_data);});}},listen:function(target,type,fn){var _target=target,_type=type,_fn=fn;if(Caman.events.types.indexOf(target)!==-1){_target=this;_type=target;_fn=type;}
if(!Caman.events.fn[_type]){Caman.events.fn[_type]=[];}
Caman.events.fn[_type].push(_fn);return true;}},cache:{}};(function(Caman){Caman.forEach(["trigger","listen"],function(key){Caman[key]=Caman.events.fn[key];});})(Caman);var ProcessType={SINGLE:1,KERNEL:2,LAYER_DEQUEUE:3,LAYER_FINISHED:4,LOAD_OVERLAY:5};Caman.manip.pixelInfo=function(loc,self){this.loc=loc;this.manip=self;};Caman.manip.pixelInfo.prototype.locationXY=function(){var x,y;y=this.manip.dimensions.height-Math.floor(this.loc/(this.manip.dimensions.width*4));x=((this.loc%(this.manip.dimensions.width*4))/4)-1;return{x:x,y:y};};Caman.manip.pixelInfo.prototype.getPixelRelative=function(horiz_offset,vert_offset){var newLoc=this.loc+(this.manip.dimensions.width*4*(vert_offset*-1))+(4*horiz_offset);if(newLoc>this.manip.pixel_data.length||newLoc<0){return{r:0,g:0,b:0,a:0};}
return{r:this.manip.pixel_data[newLoc],g:this.manip.pixel_data[newLoc+1],b:this.manip.pixel_data[newLoc+2],a:this.manip.pixel_data[newLoc+3]};};Caman.manip.pixelInfo.prototype.putPixelRelative=function(horiz_offset,vert_offset,rgba){var newLoc=this.loc+(this.manip.dimensions.width*4*(vert_offset*-1))+(4*horiz_offset);if(newLoc>this.manip.pixel_data.length||newLoc<0){return false;}
this.manip.pixel_data[newLoc]=rgba.r;this.manip.pixel_data[newLoc+1]=rgba.g;this.manip.pixel_data[newLoc+2]=rgba.b;this.manip.pixel_data[newLoc+3]=rgba.a;};Caman.manip.pixelInfo.prototype.getPixel=function(x,y){var newLoc=(y*this.manip.dimensions.width+x)*4;return{r:this.manip.pixel_data[newLoc],g:this.manip.pixel_data[newLoc+1],b:this.manip.pixel_data[newLoc+2],a:this.manip.pixel_data[newLoc+3]};};Caman.manip.pixelInfo.prototype.putPixel=function(x,y,rgba){var newLoc=(y*this.manip.dimensions.width+x)*4;this.manip.pixel_data[newLoc]=rgba.r;this.manip.pixel_data[newLoc+1]=rgba.g;this.manip.pixel_data[newLoc+2]=rgba.b;this.manip.pixel_data[newLoc+3]=rgba.a;};Caman.manip.canvasQueue=[];Caman.manip.newLayer=function(callback){var layer=new Caman.manip.canvasLayer(this);this.canvasQueue.push(layer);this.renderQueue.push({type:ProcessType.LAYER_DEQUEUE});callback.call(layer);this.renderQueue.push({type:ProcessType.LAYER_FINISHED});return this;};Caman.manip.canvasLayer=function(manip){this.options={blendingMode:'normal',opacity:1.0};this.layerID=Caman.uniqid.get();this.canvas=document.createElement('canvas');this.canvas.width=manip.dimensions.width;this.canvas.height=manip.dimensions.height;this.canvas.style.display='none';this.context=this.canvas.getContext("2d");this.context.createImageData(this.canvas.width,this.canvas.height);this.image_data=this.context.getImageData(0,0,this.canvas.width,this.canvas.height);this.pixel_data=this.image_data.data;this.__defineGetter__("filter",function(){return manip;});return this;};Caman.manip.canvasLayer.prototype.newLayer=function(callback){return this.filter.newLayer.call(this.filter,callback);};Caman.manip.canvasLayer.prototype.setBlendingMode=function(mode){this.options.blendingMode=mode;return this;};Caman.manip.canvasLayer.prototype.opacity=function(opacity){this.options.opacity=(opacity/100);return this;};Caman.manip.canvasLayer.prototype.copyParent=function(){var parentData=this.filter.pixel_data;for(var i=0;i<this.pixel_data.length;i+=4){this.pixel_data[i]=parentData[i];this.pixel_data[i+1]=parentData[i+1];this.pixel_data[i+2]=parentData[i+2];this.pixel_data[i+3]=parentData[i+3];}
return this;};Caman.manip.canvasLayer.prototype.fillColor=function(){this.filter.fillColor.apply(this.filter,arguments);return this;};Caman.manip.canvasLayer.prototype.overlayImage=function(image){if(image[0]=='#'){image=$(image).src;}else if(typeof image==="object"){image=image.src;}
if(!image)return;this.filter.renderQueue.push({type:ProcessType.LOAD_OVERLAY,src:image,layer:this});return this;};Caman.manip.canvasLayer.prototype.render=function(){};Caman.manip.canvasLayer.prototype.applyToParent=function(){var parentData=this.filter.pixelStack[this.filter.pixelStack.length-1],layerData=this.filter.pixel_data,rgbaParent={},rgbaLayer={},result={};for(var i=0;i<layerData.length;i+=4){rgbaParent={r:parentData[i],g:parentData[i+1],b:parentData[i+2],a:parentData[i+3]};rgbaLayer={r:layerData[i],g:layerData[i+1],b:layerData[i+2],a:layerData[i+3]};result=this.blenders[this.options.blendingMode](rgbaLayer,rgbaParent);parentData[i]=rgbaParent.r-((rgbaParent.r-result.r)*(this.options.opacity*(result.a/255)));parentData[i+1]=rgbaParent.g-((rgbaParent.g-result.g)*(this.options.opacity*(result.a/255)));parentData[i+2]=rgbaParent.b-((rgbaParent.b-result.b)*(this.options.opacity*(result.a/255)));parentData[i+3]=255;}};Caman.manip.canvasLayer.prototype.blenders={normal:function(rgbaLayer,rgbaParent){return{r:rgbaLayer.r,g:rgbaLayer.g,b:rgbaLayer.b,a:255};},multiply:function(rgbaLayer,rgbaParent){return{r:(rgbaLayer.r*rgbaParent.r)/255,g:(rgbaLayer.g*rgbaParent.g)/255,b:(rgbaLayer.b*rgbaParent.b)/255,a:255};},screen:function(rgbaLayer,rgbaParent){return{r:255-(((255-rgbaLayer.r)*(255-rgbaParent.r))/255),g:255-(((255-rgbaLayer.g)*(255-rgbaParent.g))/255),b:255-(((255-rgbaLayer.b)*(255-rgbaParent.b))/255),a:255};},overlay:function(rgbaLayer,rgbaParent){var result={};result.r=(rgbaParent.r>128)?255-2*(255-rgbaLayer.r)*(255-rgbaParent.r)/255:(rgbaParent.r*rgbaLayer.r*2)/255;result.g=(rgbaParent.g>128)?255-2*(255-rgbaLayer.g)*(255-rgbaParent.g)/255:(rgbaParent.g*rgbaLayer.g*2)/255;result.b=(rgbaParent.b>128)?255-2*(255-rgbaLayer.b)*(255-rgbaParent.b)/255:(rgbaParent.b*rgbaLayer.b*2)/255;result.a=255;return result;},difference:function(rgbaLayer,rgbaParent){return{r:rgbaLayer.r-rgbaParent.r,g:rgbaLayer.g-rgbaParent.g,b:rgbaLayer.b-rgbaParent.b,a:255};},addition:function(rgbaLayer,rgbaParent){return{r:rgbaParent.r+rgbaLayer.r,g:rgbaParent.g+rgbaLayer.g,b:rgbaParent.b+rgbaLayer.b,a:255};},exclusion:function(rgbaLayer,rgbaParent){return{r:128-2*(rgbaParent.r-128)*(rgbaLayer.r-128)/255,g:128-2*(rgbaParent.g-128)*(rgbaLayer.g-128)/255,b:128-2*(rgbaParent.b-128)*(rgbaLayer.b-128)/255,a:255};},softLight:function(rgbaLayer,rgbaParent){var result={};result.r=(rgbaParent.r>128)?255-((255-rgbaParent.r)*(255-(rgbaLayer.r-128)))/255:(rgbaParent.r*(rgbaLayer.r+128))/255;result.g=(rgbaParent.g>128)?255-((255-rgbaParent.g)*(255-(rgbaLayer.g-128)))/255:(rgbaParent.g*(rgbaLayer.g+128))/255;result.b=(rgbaParent.b>128)?255-((255-rgbaParent.b)*(255-(rgbaLayer.b-128)))/255:(rgbaParent.b*(rgbaLayer.b+128))/255;result.a=255;return result;}};Caman.manip.blenders=Caman.manip.canvasLayer.prototype.blenders;Caman.extend(Caman,{processKernel:function(adjust,kernel,divisor,bias){var val={r:0,g:0,b:0};for(var i=0;i<adjust.length;i++){for(var j=0;j<adjust[i].length;j++){val.r+=(adjust[i][j]*kernel[i][j].r);val.g+=(adjust[i][j]*kernel[i][j].g);val.b+=(adjust[i][j]*kernel[i][j].b);}}
val.r=(val.r/divisor)+bias;val.g=(val.g/divisor)+bias;val.b=(val.b/divisor)+bias;if(val.r>255){val.r=255;}else if(val.r<0){val.r=0;}
if(val.g>255){val.g=255;}else if(val.g<0){val.g=0;}
if(val.b>255){val.b=255;}else if(val.b<0){val.b=0;}
return val;}});Caman.manip.executeFilter=function(adjust,processFn,type){var n=this.pixel_data.length,res=null,blockPixelLength=Math.floor((n/4)/Caman.renderBlocks),blockN=blockPixelLength*4,lastBlockN=blockN+((n/4)%Caman.renderBlocks)*4,self=this,blocks_done=0,block_finished=function(bnum){if(bnum>=0){console.log("Block #"+bnum+" finished! Filter: "+processFn.name);}
blocks_done++;if(blocks_done==Caman.renderBlocks||bnum==-1){if(bnum>=0){console.log("Filter "+processFn.name+" finished!");}else{console.log("Kernel filter finished!");}
Caman.trigger("processComplete",{id:self.canvas_id,completed:processFn.name});self.processNext();}},render_block=function(bnum,start,end){console.log("BLOCK #"+bnum+" - Filter: "+processFn.name+", Start: "+start+", End: "+end);setTimeout(function(){for(var i=start;i<end;i+=4){res=processFn.call(new self.pixelInfo(i,self),adjust,{r:self.pixel_data[i],g:self.pixel_data[i+1],b:self.pixel_data[i+2],a:self.pixel_data[i+3]});self.pixel_data[i]=res.r;self.pixel_data[i+1]=res.g;self.pixel_data[i+2]=res.b;self.pixel_data[i+3]=res.a;}
block_finished(bnum);},0);},render_kernel=function(){setTimeout(function(){var kernel=[],pixelInfo,start,end,mod_pixel_data=[],name=adjust.name,bias=adjust.bias,divisor=adjust.divisor,builder_start,builder_end,i,j,k;adjust=adjust.adjust;builder_start=(adjust.length-1)/2;builder_end=builder_start*-1;console.log("Rendering kernel - Filter: "+name);start=self.dimensions.width*4*((adjust.length-1)/2);end=n-(self.dimensions.width*4*((adjust.length-1)/2));for(i=0;i<adjust.length;i++){kernel[i]=[];}
for(i=start;i<end;i+=4){pixelInfo=new self.pixelInfo(i,self);for(j=builder_start;j>=builder_end;j--){for(k=builder_end;k<=builder_start;k++){kernel[k+((adjust.length-1)/2)][((adjust.length-1)/2)-j]=pixelInfo.getPixelRelative(k,j);}}
res=processFn.call(pixelInfo,adjust,kernel,divisor,bias);mod_pixel_data[i]=res.r;mod_pixel_data[i+1]=res.g;mod_pixel_data[i+2]=res.b;mod_pixel_data[i+3]=255;}
for(i=start;i<end;i++){self.pixel_data[i]=mod_pixel_data[i];}
block_finished(-1);},0);};if(type===ProcessType.SINGLE){for(var j=0;j<Caman.renderBlocks;j++){var start=j*blockN,end=start+((j==Caman.renderBlocks-1)?lastBlockN:blockN);render_block(j,start,end);}}else{render_kernel();}};Caman.manip.executeLayer=function(layer){this.pushContext(layer);this.processNext();};Caman.manip.pushContext=function(layer){console.log("PUSH LAYER!");this.layerStack.push(this.currentLayer);this.pixelStack.push(this.pixel_data);this.currentLayer=layer;this.pixel_data=layer.pixel_data;};Caman.manip.popContext=function(){console.log("POP LAYER!");this.pixel_data=this.pixelStack.pop();this.currentLayer=this.layerStack.pop();};Caman.manip.applyCurrentLayer=function(){this.currentLayer.applyToParent();};Caman.manip.loadOverlay=function(layer,src){var proxyUrl=remoteCheck(src),self=this;if(proxyUrl){src=proxyUrl;}
var img=document.createElement('img');img.onload=function(){layer.context.drawImage(img,0,0,self.dimensions.width,self.dimensions.height);layer.image_data=layer.context.getImageData(0,0,self.dimensions.width,self.dimensions.height);layer.pixel_data=layer.image_data.data;self.pixel_data=layer.pixel_data;self.processNext();};img.src=src;};Caman.manip.process=function(adjust,processFn){this.renderQueue.push({adjust:adjust,processFn:processFn,type:ProcessType.SINGLE});return this;};Caman.manip.processKernel=function(name,adjust,divisor,bias){if(!divisor){divisor=0;for(var i=0;i<adjust.length;i++){for(var j=0;j<adjust[i].length;j++){divisor+=adjust[i][j];}}}
var data={name:name,adjust:adjust,divisor:divisor,bias:bias||0};this.renderQueue.push({adjust:data,processFn:Caman.processKernel,type:ProcessType.KERNEL});return this;};Caman.manip.processNext=function(finishedFn){if(typeof finishedFn==="function"){this.finishedFn=finishedFn;}
if(this.renderQueue.length===0){Caman.trigger("renderFinished",{id:this.canvas_id});if(typeof this.finishedFn==="function"){this.finishedFn.call(this);}
return;}
var next=this.renderQueue.shift();if(next.type==ProcessType.LAYER_DEQUEUE){var layer=this.canvasQueue.shift();this.executeLayer(layer);}else if(next.type==ProcessType.LAYER_FINISHED){this.applyCurrentLayer();this.popContext();this.processNext();}else if(next.type==ProcessType.LOAD_OVERLAY){this.loadOverlay(next.layer,next.src);}else{this.executeFilter(next.adjust,next.processFn,next.type);}};window.Caman=Caman;}());/*!
These are all of the utility functions used in CamanJS
*/(function(Caman){Caman.extend(Caman,{sizeOf:function(obj){var size=0,prop;for(prop in obj){size++;}
return size;},sameAs:function(base,test){if(base.length!==test.length){return false;}
for(var i=base.length;i>=0;i--){if(base[i]!==test[i]){return false;}}
return true;},isRemote:function(url){var domain_regex=/(?:(?:http|https):\/\/)((?:\w+)\.(?:(?:\w|\.)+))/,test_domain;if(!url||!url.length){return;}
var matches=url.match(domain_regex);if(matches){test_domain=matches[1];return test_domain!=document.domain;}else{return false;}},remove:function(arr,item){var ret=[];for(var i=0,len=arr.length;i<len;i++){if(arr[i]!==item){ret.push(arr[i]);}}
arr=ret;return ret;},randomRange:function(min,max,float){var rand=min+(Math.random()*(max-min));return typeof float=='undefined'?Math.round(rand):rand.toFixed(float);},rgb_to_hsl:function(r,g,b){r/=255;g/=255;b/=255;var max=Math.max(r,g,b),min=Math.min(r,g,b),h,s,l=(max+min)/2;if(max==min){h=s=0;}else{var d=max-min;s=l>0.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;case b:h=(r-g)/d+4;break;}
h/=6;}
return{h:h,s:s,l:l};},hue_to_rgb:function(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p;},hsl_to_rgb:function(h,s,l){var r,g,b;if(s===0){r=g=b=l;}else{var q=l<0.5?l*(1+s):l+s-l*s;var p=2*l-q;r=this.hue_to_rgb(p,q,h+1/3);g=this.hue_to_rgb(p,q,h);b=this.hue_to_rgb(p,q,h-1/3);}
return{r:r*255,g:g*255,b:b*255};},rgb_to_hsv:function(r,g,b){r=r/255;g=g/255;b=b/255;var max=Math.max(r,g,b),min=Math.min(r,g,b),h,s,v=max,d=max-min;s=max===0?0:d/max;if(max==min){h=0;}else{switch(max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;case b:h=(r-g)/d+4;break;}
h/=6;}
return{h:h,s:s,v:v};},hsv_to_rgb:function(h,s,v){var r,g,b,i=Math.floor(h*6),f=h*6-i,p=v*(1-s),q=v*(1-f*s),t=v*(1-(1-f)*s);switch(i%6){case 0:r=v;g=t;b=p;break;case 1:r=q;g=v;b=p;break;case 2:r=p;g=v;b=t;break;case 3:r=p;g=q;b=v;break;case 4:r=t;g=p;b=v;break;case 5:r=v;g=p;b=q;break;}
return{r:r*255,g:g*255,b:b*255};},rgb_to_xyz:function(r,g,b){r=r/255;g=g/255;b=b/255;if(r>0.04045){r=Math.pow((r+0.055)/1.055,2.4);}else{r=r/12.92;}
if(g>0.04045){g=Math.pow((g+0.055)/1.055,2.4);}else{g=g/12.92;}
if(b>0.04045){b=Math.pow((b+0.055)/1.055,2.4);}else{b=b/12.92;}
var x=r*0.4124+g*0.3576+b*0.1805;var y=r*0.2126+g*0.7152+b*0.0722;var z=r*0.0193+g*0.1192+b*0.9505;return{x:x*100,y:y*100,z:z*100};},xyz_to_rgb:function(x,y,z){x=x/100;y=y/100;z=z/100;var r,g,b;r=(3.2406*x)+(-1.5372*y)+(-0.4986*z);g=(-0.9689*x)+(1.8758*y)+(0.0415*z);b=(0.0557*x)+(-0.2040*y)+(1.0570*z);if(r>0.0031308){r=(1.055*Math.pow(r,0.4166666667))-0.055;}else{r=12.92*r;}
if(g>0.0031308){g=(1.055*Math.pow(g,0.4166666667))-0.055;}else{g=12.92*g;}
if(b>0.0031308){b=(1.055*Math.pow(b,0.4166666667))-0.055;}else{b=12.92*b;}
return{r:r*255,g:g*255,b:b*255};},xyz_to_lab:function(x,y,z){var whiteX=95.047,whiteY=100.0,whiteZ=108.883;x=x/whiteX;y=y/whiteY;z=z/whiteZ;if(x>0.008856451679){x=Math.pow(x,0.3333333333);}else{x=(7.787037037*x)+0.1379310345;}
if(y>0.008856451679){y=Math.pow(y,0.3333333333);}else{y=(7.787037037*y)+0.1379310345;}
if(z>0.008856451679){z=Math.pow(z,0.3333333333);}else{z=(7.787037037*z)+0.1379310345;}
var l=116*y-16;var a=500*(x-y);var b=200*(y-z);return{l:l,a:a,b:b};},lab_to_xyz:function(l,a,b){var y=(l+16)/116;var x=y+(a/500);var z=y-(b/200);if(x>0.2068965517){x=x*x*x;}else{x=0.1284185493*(x-0.1379310345);}
if(y>0.2068965517){y=y*y*y;}else{y=0.1284185493*(y-0.1379310345);}
if(z>0.2068965517){z=z*z*z;}else{z=0.1284185493*(z-0.1379310345);}
return{x:x*95.047,y:y*100.0,z:z*108.883};},hex_to_rgb:function(hex){var r,g,b;if(hex.charAt(0)==="#"){hex=hex.substr(1);}
r=parseInt(hex.substr(0,2),16);g=parseInt(hex.substr(2,2),16);b=parseInt(hex.substr(4,2),16);return{r:r,g:g,b:b};},bezier:function(start,ctrl1,ctrl2,end,lowBound,highBound){var Ax,Bx,Cx,Ay,By,Cy,x0=start[0],y0=start[1],x1=ctrl1[0],y1=ctrl1[1],x2=ctrl2[0],y2=ctrl2[1],x3=end[0],y3=end[1],t,curveX,curveY,bezier={};Cx=3*(x1-x0);Bx=3*(x2-x1)-Cx;Ax=x3-x0-Cx-Bx;Cy=3*(y1-y0);By=3*(y2-y1)-Cy;Ay=y3-y0-Cy-By;for(var i=0;i<1000;i++){t=i/1000;curveX=Math.round((Ax*Math.pow(t,3))+(Bx*Math.pow(t,2))+(Cx*t)+x0);curveY=Math.round((Ay*Math.pow(t,3))+(By*Math.pow(t,2))+(Cy*t)+y0);if(lowBound&&curveY<lowBound){curveY=lowBound;}else if(highBound&&curveY>highBound){curveY=highBound;}
bezier[curveX]=curveY;}
var leftCoord,rightCoord,j,slope,bint;if(bezier.length<end[0]+1){for(i=0;i<=end[0];i++){if(typeof bezier[i]==="undefined"){leftCoord=[i-1,bezier[i-1]];for(j=i;j<=end[0];j++){if(typeof bezier[j]!=="undefined"){rightCoord=[j,bezier[j]];break;}}
bezier[i]=leftCoord[1]+((rightCoord[1]-leftCoord[1])/(rightCoord[0]-leftCoord[0]))*(i-leftCoord[0]);}}}
if(typeof bezier[end[0]]==="undefined"){bezier[end[0]]=bezier[254];}
return bezier;}});}(Caman));/*!
Below are all of the built-in filters that are a part
of the CamanJS core library.
*/(function(Caman){Caman.manip.fillColor=function(){var color;if(arguments.length==1){color=Caman.hex_to_rgb(arguments[0]);}else{color={r:arguments[0],g:arguments[1],b:arguments[2]};}
return this.process(color,function fillColor(color,rgba){rgba.r=color.r;rgba.g=color.g;rgba.b=color.b;rgba.a=255;return rgba;});};Caman.manip.brightness=function(adjust){adjust=Math.floor(255*(adjust/100));return this.process(adjust,function brightness(adjust,rgba){rgba.r+=adjust;rgba.g+=adjust;rgba.b+=adjust;return rgba;});};Caman.manip.saturation=function(adjust){var max,diff;adjust*=-1;return this.process(adjust,function saturation(adjust,rgba){var chan;max=Math.max(rgba.r,rgba.g,rgba.b);for(chan in rgba){if(rgba.hasOwnProperty(chan)){if(rgba[chan]===max||chan==="a"){continue;}
diff=max-rgba[chan];rgba[chan]+=Math.ceil(diff*(adjust/100));}}
return rgba;});};Caman.manip.vibrance=function(adjust){var max,avg,amt,diff;adjust*=-1;return this.process(adjust,function vibrance(adjust,rgba){var chan;max=Math.max(rgba.r,rgba.g,rgba.b);avg=(rgba.r+rgba.g+rgba.b)/3;amt=((Math.abs(max-avg)*2/255)*adjust)/100;for(chan in rgba){if(rgba.hasOwnProperty(chan)){if(rgba[chan]===max||chan=="a"){continue;}
diff=max-rgba[chan];rgba[chan]+=Math.ceil(diff*amt);}}
return rgba;});};Caman.manip.greyscale=function(){return this.process({},function greyscale(adjust,rgba){var avg=0.3*rgba.r+0.59*rgba.g+0.11*rgba.b;rgba.r=avg;rgba.g=avg;rgba.b=avg;return rgba;});};Caman.manip.contrast=function(adjust){adjust=(adjust+100)/100;adjust=Math.pow(adjust,2);return this.process(adjust,function contrast(adjust,rgba){rgba.r/=255;rgba.r-=0.5;rgba.r*=adjust;rgba.r+=0.5;rgba.r*=255;rgba.g/=255;rgba.g-=0.5;rgba.g*=adjust;rgba.g+=0.5;rgba.g*=255;rgba.b/=255;rgba.b-=0.5;rgba.b*=adjust;rgba.b+=0.5;rgba.b*=255;if(rgba.r>255){rgba.r=255;}else if(rgba.r<0){rgba.r=0;}
if(rgba.g>255){rgba.g=255;}else if(rgba.g<0){rgba.g=0;}
if(rgba.b>255){rgba.b=255;}else if(rgba.b<0){rgba.b=0;}
return rgba;});};Caman.manip.hue=function(adjust){var hsv,h;return this.process(adjust,function hue(adjust,rgba){var rgb;hsv=Caman.rgb_to_hsv(rgba.r,rgba.g,rgba.b);h=hsv.h*100;h+=Math.abs(adjust);h=h%100;h/=100;hsv.h=h;rgb=Caman.hsv_to_rgb(hsv.h,hsv.s,hsv.v);return{r:rgb.r,g:rgb.g,b:rgb.b,a:rgba.a};});};Caman.manip.colorize=function(){var diff,rgb,level;if(arguments.length===2){rgb=Caman.hex_to_rgb(arguments[0]);level=arguments[1];}else if(arguments.length===4){rgb={r:arguments[0],g:arguments[1],b:arguments[2]};level=arguments[3];}
return this.process([level,rgb],function colorize(adjust,rgba){rgba.r-=(rgba.r-adjust[1].r)*(adjust[0]/100);rgba.g-=(rgba.g-adjust[1].g)*(adjust[0]/100);rgba.b-=(rgba.b-adjust[1].b)*(adjust[0]/100);return rgba;});};Caman.manip.invert=function(){return this.process({},function invert(adjust,rgba){rgba.r=255-rgba.r;rgba.g=255-rgba.g;rgba.b=255-rgba.b;return rgba;});};Caman.manip.sepia=function(adjust){if(adjust===undefined){adjust=100;}
adjust=(adjust/100);return this.process(adjust,function sepia(adjust,rgba){rgba.r=Math.min(255,(rgba.r*(1-(0.607*adjust)))+(rgba.g*(0.769*adjust))+(rgba.b*(0.189*adjust)));rgba.g=Math.min(255,(rgba.r*(0.349*adjust))+(rgba.g*(1-(0.314*adjust)))+(rgba.b*(0.168*adjust)));rgba.b=Math.min(255,(rgba.r*(0.272*adjust))+(rgba.g*(0.534*adjust))+(rgba.b*(1-(0.869*adjust))));return rgba;});};Caman.manip.gamma=function(adjust){return this.process(adjust,function gamma(adjust,rgba){rgba.r=Math.pow(rgba.r/255,adjust)*255;rgba.g=Math.pow(rgba.g/255,adjust)*255;rgba.b=Math.pow(rgba.b/255,adjust)*255;return rgba;});};Caman.manip.noise=function(adjust){adjust=Math.abs(adjust)*2.55;return this.process(adjust,function noise(adjust,rgba){var rand=Caman.randomRange(adjust*-1,adjust);rgba.r+=rand;rgba.g+=rand;rgba.b+=rand;return rgba;});};Caman.manip.clip=function(adjust){adjust=Math.abs(adjust)*2.55;return this.process(adjust,function clip(adjust,rgba){if(rgba.r>255-adjust){rgba.r=255;}else if(rgba.r<adjust){rgba.r=0;}
if(rgba.g>255-adjust){rgba.g=255;}else if(rgba.g<adjust){rgba.g=0;}
if(rgba.b>255-adjust){rgba.b=255;}else if(rgba.b<adjust){rgba.b=0;}
return rgba;});};Caman.manip.channels=function(options){if(typeof(options)!=='object'){return;}
for(var chan in options){if(options.hasOwnProperty(chan)){if(options[chan]===0){delete options[chan];continue;}
options[chan]=options[chan]/100;}}
if(options.length===0){return;}
return this.process(options,function channels(options,rgba){if(options.red){if(options.red>0){rgba.r=rgba.r+((255-rgba.r)*options.red);}else{rgba.r=rgba.r-(rgba.r*Math.abs(options.red));}}
if(options.green){if(options.green>0){rgba.g=rgba.g+((255-rgba.g)*options.green);}else{rgba.g=rgba.g-(rgba.g*Math.abs(options.green));}}
if(options.blue){if(options.blue>0){rgba.b=rgba.b+((255-rgba.b)*options.blue);}else{rgba.b=rgba.b-(rgba.b*Math.abs(options.blue));}}
return rgba;});};Caman.manip.curves=function(chan,start,ctrl1,ctrl2,end){var bezier,i;if(typeof chan==='string'){if(chan=='rgb'){chan=['r','g','b'];}else{chan=[chan];}}
bezier=Caman.bezier(start,ctrl1,ctrl2,end,0,255);if(start[0]>0){for(i=0;i<start[0];i++){bezier[i]=start[1];}}
if(end[0]<255){for(i=end[0];i<=255;i++){bezier[i]=end[1];}}
return this.process({bezier:bezier,chans:chan},function curves(opts,rgba){for(var i=0;i<opts.chans.length;i++){rgba[opts.chans[i]]=opts.bezier[rgba[opts.chans[i]]];}
return rgba;});};Caman.manip.exposure=function(adjust){var p,ctrl1,ctrl2;p=Math.abs(adjust)/100;ctrl1=[0,(255*p)];ctrl2=[(255-(255*p)),255];if(adjust<0){ctrl1=ctrl1.reverse();ctrl2=ctrl2.reverse();}
return this.curves('rgb',[0,0],ctrl1,ctrl2,[255,255]);};}(Caman));if(!Caman&&typeof exports=="object"){var Caman={manip:{}};exports.plugins=Caman.manip;}
(function(Caman){Caman.manip.boxBlur=function(){return this.processKernel('Box Blur',[[1,1,1],[1,1,1],[1,1,1]]);};Caman.manip.radialBlur=function(){return this.processKernel('Radial Blur',[[0,1,0],[1,1,1],[0,1,0]],5);};Caman.manip.heavyRadialBlur=function(){return this.processKernel('Heavy Radial Blur',[[0,0,1,0,0],[0,1,1,1,0],[1,1,1,1,1],[0,1,1,1,0],[0,0,1,0,0]],13);};Caman.manip.gaussianBlur=function(){return this.processKernel('Gaussian Blur',[[1,4,6,4,1],[4,16,24,16,4],[6,24,36,24,6],[4,16,24,16,4],[1,4,6,4,1]],256);};Caman.manip.motionBlur=function(degrees){var kernel;if(degrees===0||degrees==180){kernel=[[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0]];}else if((degrees>0&°rees<90)||(degrees>180&°rees<270)){kernel=[[0,0,0,0,1],[0,0,0,1,0],[0,0,1,0,0],[0,1,0,0,0],[1,0,0,0,0]];}else if(degrees==90||degrees==270){kernel=[[0,0,0,0,0],[0,0,0,0,0],[1,1,1,1,1],[0,0,0,0,0],[0,0,0,0,0]];}else{kernel=[[1,0,0,0,0],[0,1,0,0,0],[0,0,1,0,0],[0,0,0,1,0],[0,0,0,0,1]];}
return this.processKernel('Motion Blur',kernel,5);};Caman.manip.sharpen=function(amt){if(!amt){amt=1;}else{amt/=100;}
return this.processKernel('Sharpen',[[0,-amt,0],[-amt,4*amt+1,-amt],[0,-amt,0]]);};}(Caman));if(!Caman&&typeof exports=="object"){var Caman={manip:{}};exports.plugins=Caman.manip;}
(function(Caman){Caman.manip.vignette=function(size,strength){var center,start,end,loc,dist,div,bezier;if(!strength){strength=0.6;}else{strength/=100;}
center=[(this.dimensions.width/2),(this.dimensions.height/2)];start=Math.sqrt(Math.pow(center[0],2)+Math.pow(center[1],2));end=start-size;bezier=Caman.bezier([0,1],[30,30],[70,60],[100,80]);return this.process({center:center,start:start,end:end,size:size,strength:strength,bezier:bezier},function vignette(data,rgba){loc=this.locationXY();dist=Math.sqrt(Math.pow(loc.x-data.center[0],2)+Math.pow(loc.y-data.center[1],2));if(dist>data.end){div=Math.max(1,((data.bezier[Math.round(((dist-data.end)/data.size)*100)]/10)*strength));rgba.r=Math.pow(rgba.r/255,div)*255;rgba.g=Math.pow(rgba.g/255,div)*255;rgba.b=Math.pow(rgba.b/255,div)*255;}
return rgba;});};}(Caman));if(!Caman&&typeof exports=="object"){var Caman={manip:{}};exports.plugins=Caman.manip;}
(function(Caman){Caman.manip.edgeEnhance=function(){return this.processKernel('Edge Enhance',[[0,0,0],[-1,1,0],[0,0,0]]);};Caman.manip.edgeDetect=function(){return this.processKernel('Edge Detect',[[-1,-1,-1],[-1,8,-1],[-1,-1,-1]]);};Caman.manip.emboss=function(){return this.processKernel('Emboss',[[-2,-1,0],[-1,1,1],[0,1,2]]);};}(Caman));if(!Caman&&typeof exports=="object"){var Caman={manip:{}};exports.plugins=Caman.manip;}
(function(Caman){Caman.manip.vintage=function(vignette){this.greyscale().contrast(5);if(vignette||typeof vignette==='undefined'){this.vignette(250,25);}
return this.noise(3).sepia(100).channels({red:8,blue:2,green:4}).gamma(0.87);};Caman.manip.lomo=function(){return this.brightness(15).exposure(15).curves('rgb',[0,0],[200,0],[155,255],[255,255]).saturation(-20).gamma(1.8).vignette(300,60).brightness(5);};Caman.manip.clarity=function(grey){var manip=this.vibrance(20).curves('rgb',[5,0],[130,150],[190,220],[250,255]).sharpen(15).vignette(250,20);if(grey){this.greyscale().contrast(4);}
return manip;};Caman.manip.sinCity=function(){return this.contrast(100).brightness(15).exposure(10).curves('rgb',[0,0],[100,0],[155,255],[255,255]).clip(30).greyscale();};Caman.manip.sunrise=function(){return this.exposure(3.5).saturation(-5).vibrance(50).sepia(60).colorize('#e87b22',10).channels({red:8,blue:8}).contrast(5).gamma(1.2).vignette(250,25);};Caman.manip.crossProcess=function(){return this.exposure(5).colorize('#e87b22',4).sepia(20).channels({blue:8,red:3}).curves('b',[0,0],[100,150],[180,180],[255,255]).contrast(15).vibrance(75).gamma(1.6);};Caman.manip.orangePeel=function(){return this.curves('rgb',[0,0],[100,50],[140,200],[255,255]).vibrance(-30).saturation(-30).colorize('#ff9000',30).contrast(-5).gamma(1.4);};Caman.manip.love=function(){return this.brightness(5).exposure(8).colorize('#c42007',30).vibrance(50).gamma(1.3);};Caman.manip.grungy=function(){return this.gamma(1.5).clip(25).saturation(-60).contrast(5).noise(5).vignette(200,30);};Caman.manip.jarques=function(){return this.saturation(-35).curves('b',[20,0],[90,120],[186,144],[255,230]).curves('r',[0,0],[144,90],[138,120],[255,255]).curves('g',[10,0],[115,105],[148,100],[255,248]).curves('rgb',[0,0],[120,100],[128,140],[255,255]).sharpen(20);};Caman.manip.pinhole=function(){return this.greyscale().sepia(10).exposure(10).contrast(15).vignette(250,35);};Caman.manip.oldBoot=function(){return this.saturation(-20).vibrance(-50).gamma(1.1).sepia(30).channels({red:-10,blue:5}).curves('rgb',[0,0],[80,50],[128,230],[255,255]).vignette(250,30);};Caman.manip.glowingSun=function(){this.brightness(10);this.newLayer(function(){this.setBlendingMode('multiply');this.opacity(80);this.copyParent();this.filter.gamma(0.8);this.filter.contrast(50);this.filter.exposure(10);});this.newLayer(function(){this.setBlendingMode('softLight');this.opacity(20);this.fillColor('#f49600');});this.exposure(20);this.gamma(0.8);return this.vignette(250,20);};}(Caman)); | gaearon/cdnjs | ajax/libs/camanjs/2.1.1/caman.full.min.js | JavaScript | mit | 33,629 |
/**
* @license AngularJS v1.2.4
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {'use strict';
/* jshint maxlen: false */
/**
* @ngdoc overview
* @name ngAnimate
* @description
*
* # ngAnimate
*
* The `ngAnimate` module provides support for JavaScript, CSS3 transition and CSS3 keyframe animation hooks within existing core and custom directives.
*
* {@installModule animate}
*
* <div doc-module-components="ngAnimate"></div>
*
* # Usage
*
* To see animations in action, all that is required is to define the appropriate CSS classes
* or to register a JavaScript animation via the myModule.animation() function. The directives that support animation automatically are:
* `ngRepeat`, `ngInclude`, `ngIf`, `ngSwitch`, `ngShow`, `ngHide`, `ngView` and `ngClass`. Custom directives can take advantage of animation
* by using the `$animate` service.
*
* Below is a more detailed breakdown of the supported animation events provided by pre-existing ng directives:
*
* | Directive | Supported Animations |
* |---------------------------------------------------------- |----------------------------------------------------|
* | {@link ng.directive:ngRepeat#usage_animations ngRepeat} | enter, leave and move |
* | {@link ngRoute.directive:ngView#usage_animations ngView} | enter and leave |
* | {@link ng.directive:ngInclude#usage_animations ngInclude} | enter and leave |
* | {@link ng.directive:ngSwitch#usage_animations ngSwitch} | enter and leave |
* | {@link ng.directive:ngIf#usage_animations ngIf} | enter and leave |
* | {@link ng.directive:ngClass#usage_animations ngClass} | add and remove |
* | {@link ng.directive:ngShow#usage_animations ngShow & ngHide} | add and remove (the ng-hide class value) |
*
* You can find out more information about animations upon visiting each directive page.
*
* Below is an example of how to apply animations to a directive that supports animation hooks:
*
* <pre>
* <style type="text/css">
* .slide.ng-enter, .slide.ng-leave {
* -webkit-transition:0.5s linear all;
* transition:0.5s linear all;
* }
*
* .slide.ng-enter { } /* starting animations for enter */
* .slide.ng-enter-active { } /* terminal animations for enter */
* .slide.ng-leave { } /* starting animations for leave */
* .slide.ng-leave-active { } /* terminal animations for leave */
* </style>
*
* <!--
* the animate service will automatically add .ng-enter and .ng-leave to the element
* to trigger the CSS transition/animations
* -->
* <ANY class="slide" ng-include="..."></ANY>
* </pre>
*
* Keep in mind that if an animation is running, any child elements cannot be animated until the parent element's
* animation has completed.
*
* <h2>CSS-defined Animations</h2>
* The animate service will automatically apply two CSS classes to the animated element and these two CSS classes
* are designed to contain the start and end CSS styling. Both CSS transitions and keyframe animations are supported
* and can be used to play along with this naming structure.
*
* The following code below demonstrates how to perform animations using **CSS transitions** with Angular:
*
* <pre>
* <style type="text/css">
* /*
* The animate class is apart of the element and the ng-enter class
* is attached to the element once the enter animation event is triggered
* */
* .reveal-animation.ng-enter {
* -webkit-transition: 1s linear all; /* Safari/Chrome */
* transition: 1s linear all; /* All other modern browsers and IE10+ */
*
* /* The animation preparation code */
* opacity: 0;
* }
*
* /*
* Keep in mind that you want to combine both CSS
* classes together to avoid any CSS-specificity
* conflicts
* */
* .reveal-animation.ng-enter.ng-enter-active {
* /* The animation code itself */
* opacity: 1;
* }
* </style>
*
* <div class="view-container">
* <div ng-view class="reveal-animation"></div>
* </div>
* </pre>
*
* The following code below demonstrates how to perform animations using **CSS animations** with Angular:
*
* <pre>
* <style type="text/css">
* .reveal-animation.ng-enter {
* -webkit-animation: enter_sequence 1s linear; /* Safari/Chrome */
* animation: enter_sequence 1s linear; /* IE10+ and Future Browsers */
* }
* @-webkit-keyframes enter_sequence {
* from { opacity:0; }
* to { opacity:1; }
* }
* @keyframes enter_sequence {
* from { opacity:0; }
* to { opacity:1; }
* }
* </style>
*
* <div class="view-container">
* <div ng-view class="reveal-animation"></div>
* </div>
* </pre>
*
* Both CSS3 animations and transitions can be used together and the animate service will figure out the correct duration and delay timing.
*
* Upon DOM mutation, the event class is added first (something like `ng-enter`), then the browser prepares itself to add
* the active class (in this case `ng-enter-active`) which then triggers the animation. The animation module will automatically
* detect the CSS code to determine when the animation ends. Once the animation is over then both CSS classes will be
* removed from the DOM. If a browser does not support CSS transitions or CSS animations then the animation will start and end
* immediately resulting in a DOM element that is at its final state. This final state is when the DOM element
* has no CSS transition/animation classes applied to it.
*
* <h3>CSS Staggering Animations</h3>
* A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a
* curtain-like effect. The ngAnimate module, as of 1.2.0, supports staggering animations and the stagger effect can be
* performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for
* the animation. The style property expected within the stagger class can either be a **transition-delay** or an
* **animation-delay** property (or both if your animation contains both transitions and keyframe animations).
*
* <pre>
* .my-animation.ng-enter {
* /* standard transition code */
* -webkit-transition: 1s linear all;
* transition: 1s linear all;
* opacity:0;
* }
* .my-animation.ng-enter-stagger {
* /* this will have a 100ms delay between each successive leave animation */
* -webkit-transition-delay: 0.1s;
* transition-delay: 0.1s;
*
* /* in case the stagger doesn't work then these two values
* must be set to 0 to avoid an accidental CSS inheritance */
* -webkit-transition-duration: 0s;
* transition-duration: 0s;
* }
* .my-animation.ng-enter.ng-enter-active {
* /* standard transition styles */
* opacity:1;
* }
* </pre>
*
* Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations
* on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this
* are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation
* will also be reset if more than 10ms has passed after the last animation has been fired.
*
* The following code will issue the **ng-leave-stagger** event on the element provided:
*
* <pre>
* var kids = parent.children();
*
* $animate.leave(kids[0]); //stagger index=0
* $animate.leave(kids[1]); //stagger index=1
* $animate.leave(kids[2]); //stagger index=2
* $animate.leave(kids[3]); //stagger index=3
* $animate.leave(kids[4]); //stagger index=4
*
* $timeout(function() {
* //stagger has reset itself
* $animate.leave(kids[5]); //stagger index=0
* $animate.leave(kids[6]); //stagger index=1
* }, 100, false);
* </pre>
*
* Stagger animations are currently only supported within CSS-defined animations.
*
* <h2>JavaScript-defined Animations</h2>
* In the event that you do not want to use CSS3 transitions or CSS3 animations or if you wish to offer animations on browsers that do not
* yet support CSS transitions/animations, then you can make use of JavaScript animations defined inside of your AngularJS module.
*
* <pre>
* //!annotate="YourApp" Your AngularJS Module|Replace this or ngModule with the module that you used to define your application.
* var ngModule = angular.module('YourApp', ['ngAnimate']);
* ngModule.animation('.my-crazy-animation', function() {
* return {
* enter: function(element, done) {
* //run the animation here and call done when the animation is complete
* return function(cancelled) {
* //this (optional) function will be called when the animation
* //completes or when the animation is cancelled (the cancelled
* //flag will be set to true if cancelled).
* };
* },
* leave: function(element, done) { },
* move: function(element, done) { },
*
* //animation that can be triggered before the class is added
* beforeAddClass: function(element, className, done) { },
*
* //animation that can be triggered after the class is added
* addClass: function(element, className, done) { },
*
* //animation that can be triggered before the class is removed
* beforeRemoveClass: function(element, className, done) { },
*
* //animation that can be triggered after the class is removed
* removeClass: function(element, className, done) { }
* };
* });
* </pre>
*
* JavaScript-defined animations are created with a CSS-like class selector and a collection of events which are set to run
* a javascript callback function. When an animation is triggered, $animate will look for a matching animation which fits
* the element's CSS class attribute value and then run the matching animation event function (if found).
* In other words, if the CSS classes present on the animated element match any of the JavaScript animations then the callback function will
* be executed. It should be also noted that only simple, single class selectors are allowed (compound class selectors are not supported).
*
* Within a JavaScript animation, an object containing various event callback animation functions is expected to be returned.
* As explained above, these callbacks are triggered based on the animation event. Therefore if an enter animation is run,
* and the JavaScript animation is found, then the enter callback will handle that animation (in addition to the CSS keyframe animation
* or transition code that is defined via a stylesheet).
*
*/
angular.module('ngAnimate', ['ng'])
/**
* @ngdoc object
* @name ngAnimate.$animateProvider
* @description
*
* The `$animateProvider` allows developers to register JavaScript animation event handlers directly inside of a module.
* When an animation is triggered, the $animate service will query the $animate service to find any animations that match
* the provided name value.
*
* Requires the {@link ngAnimate `ngAnimate`} module to be installed.
*
* Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application.
*
*/
.config(['$provide', '$animateProvider', function($provide, $animateProvider) {
var noop = angular.noop;
var forEach = angular.forEach;
var selectors = $animateProvider.$$selectors;
var ELEMENT_NODE = 1;
var NG_ANIMATE_STATE = '$$ngAnimateState';
var NG_ANIMATE_CLASS_NAME = 'ng-animate';
var rootAnimateState = {running: true};
function extractElementNode(element) {
for(var i = 0; i < element.length; i++) {
var elm = element[i];
if(elm.nodeType == ELEMENT_NODE) {
return elm;
}
}
}
function isMatchingElement(elm1, elm2) {
return extractElementNode(elm1) == extractElementNode(elm2);
}
$provide.decorator('$animate', ['$delegate', '$injector', '$sniffer', '$rootElement', '$timeout', '$rootScope', '$document',
function($delegate, $injector, $sniffer, $rootElement, $timeout, $rootScope, $document) {
$rootElement.data(NG_ANIMATE_STATE, rootAnimateState);
// disable animations during bootstrap, but once we bootstrapped, wait again
// for another digest until enabling animations. The reason why we digest twice
// is because all structural animations (enter, leave and move) all perform a
// post digest operation before animating. If we only wait for a single digest
// to pass then the structural animation would render its animation on page load.
// (which is what we're trying to avoid when the application first boots up.)
$rootScope.$$postDigest(function() {
$rootScope.$$postDigest(function() {
rootAnimateState.running = false;
});
});
function lookup(name) {
if (name) {
var matches = [],
flagMap = {},
classes = name.substr(1).split('.');
//the empty string value is the default animation
//operation which performs CSS transition and keyframe
//animations sniffing. This is always included for each
//element animation procedure if the browser supports
//transitions and/or keyframe animations
if ($sniffer.transitions || $sniffer.animations) {
classes.push('');
}
for(var i=0; i < classes.length; i++) {
var klass = classes[i],
selectorFactoryName = selectors[klass];
if(selectorFactoryName && !flagMap[klass]) {
matches.push($injector.get(selectorFactoryName));
flagMap[klass] = true;
}
}
return matches;
}
}
/**
* @ngdoc object
* @name ngAnimate.$animate
* @function
*
* @description
* The `$animate` service provides animation detection support while performing DOM operations (enter, leave and move) as well as during addClass and removeClass operations.
* When any of these operations are run, the $animate service
* will examine any JavaScript-defined animations (which are defined by using the $animateProvider provider object)
* as well as any CSS-defined animations against the CSS classes present on the element once the DOM operation is run.
*
* The `$animate` service is used behind the scenes with pre-existing directives and animation with these directives
* will work out of the box without any extra configuration.
*
* Requires the {@link ngAnimate `ngAnimate`} module to be installed.
*
* Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application.
*
*/
return {
/**
* @ngdoc function
* @name ngAnimate.$animate#enter
* @methodOf ngAnimate.$animate
* @function
*
* @description
* Appends the element to the parentElement element that resides in the document and then runs the enter animation. Once
* the animation is started, the following CSS classes will be present on the element for the duration of the animation:
*
* Below is a breakdown of each step that occurs during enter animation:
*
* | Animation Step | What the element class attribute looks like |
* |----------------------------------------------------------------------------------------------|---------------------------------------------|
* | 1. $animate.enter(...) is called | class="my-animation" |
* | 2. element is inserted into the parentElement element or beside the afterElement element | class="my-animation" |
* | 3. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" |
* | 4. the .ng-enter class is added to the element | class="my-animation ng-animate ng-enter" |
* | 5. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-enter" |
* | 6. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-enter" |
* | 7. the .ng-enter-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-enter ng-enter-active" |
* | 8. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-enter ng-enter-active" |
* | 9. The animation ends and all generated CSS classes are removed from the element | class="my-animation" |
* | 10. The doneCallback() callback is fired (if provided) | class="my-animation" |
*
* @param {jQuery/jqLite element} element the element that will be the focus of the enter animation
* @param {jQuery/jqLite element} parentElement the parent element of the element that will be the focus of the enter animation
* @param {jQuery/jqLite element} afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation
* @param {function()=} doneCallback the callback function that will be called once the animation is complete
*/
enter : function(element, parentElement, afterElement, doneCallback) {
this.enabled(false, element);
$delegate.enter(element, parentElement, afterElement);
$rootScope.$$postDigest(function() {
performAnimation('enter', 'ng-enter', element, parentElement, afterElement, noop, doneCallback);
});
},
/**
* @ngdoc function
* @name ngAnimate.$animate#leave
* @methodOf ngAnimate.$animate
* @function
*
* @description
* Runs the leave animation operation and, upon completion, removes the element from the DOM. Once
* the animation is started, the following CSS classes will be added for the duration of the animation:
*
* Below is a breakdown of each step that occurs during leave animation:
*
* | Animation Step | What the element class attribute looks like |
* |----------------------------------------------------------------------------------------------|---------------------------------------------|
* | 1. $animate.leave(...) is called | class="my-animation" |
* | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" |
* | 3. the .ng-leave class is added to the element | class="my-animation ng-animate ng-leave" |
* | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-leave" |
* | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-leave" |
* | 6. the .ng-leave-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-leave ng-leave-active" |
* | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-leave ng-leave-active" |
* | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation" |
* | 9. The element is removed from the DOM | ... |
* | 10. The doneCallback() callback is fired (if provided) | ... |
*
* @param {jQuery/jqLite element} element the element that will be the focus of the leave animation
* @param {function()=} doneCallback the callback function that will be called once the animation is complete
*/
leave : function(element, doneCallback) {
cancelChildAnimations(element);
this.enabled(false, element);
$rootScope.$$postDigest(function() {
performAnimation('leave', 'ng-leave', element, null, null, function() {
$delegate.leave(element);
}, doneCallback);
});
},
/**
* @ngdoc function
* @name ngAnimate.$animate#move
* @methodOf ngAnimate.$animate
* @function
*
* @description
* Fires the move DOM operation. Just before the animation starts, the animate service will either append it into the parentElement container or
* add the element directly after the afterElement element if present. Then the move animation will be run. Once
* the animation is started, the following CSS classes will be added for the duration of the animation:
*
* Below is a breakdown of each step that occurs during move animation:
*
* | Animation Step | What the element class attribute looks like |
* |----------------------------------------------------------------------------------------------|---------------------------------------------|
* | 1. $animate.move(...) is called | class="my-animation" |
* | 2. element is moved into the parentElement element or beside the afterElement element | class="my-animation" |
* | 3. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" |
* | 4. the .ng-move class is added to the element | class="my-animation ng-animate ng-move" |
* | 5. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-move" |
* | 6. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-move" |
* | 7. the .ng-move-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-move ng-move-active" |
* | 8. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-move ng-move-active" |
* | 9. The animation ends and all generated CSS classes are removed from the element | class="my-animation" |
* | 10. The doneCallback() callback is fired (if provided) | class="my-animation" |
*
* @param {jQuery/jqLite element} element the element that will be the focus of the move animation
* @param {jQuery/jqLite element} parentElement the parentElement element of the element that will be the focus of the move animation
* @param {jQuery/jqLite element} afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation
* @param {function()=} doneCallback the callback function that will be called once the animation is complete
*/
move : function(element, parentElement, afterElement, doneCallback) {
cancelChildAnimations(element);
this.enabled(false, element);
$delegate.move(element, parentElement, afterElement);
$rootScope.$$postDigest(function() {
performAnimation('move', 'ng-move', element, parentElement, afterElement, noop, doneCallback);
});
},
/**
* @ngdoc function
* @name ngAnimate.$animate#addClass
* @methodOf ngAnimate.$animate
*
* @description
* Triggers a custom animation event based off the className variable and then attaches the className value to the element as a CSS class.
* Unlike the other animation methods, the animate service will suffix the className value with {@type -add} in order to provide
* the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if no CSS transitions
* or keyframes are defined on the -add or base CSS class).
*
* Below is a breakdown of each step that occurs during addClass animation:
*
* | Animation Step | What the element class attribute looks like |
* |------------------------------------------------------------------------------------------------|---------------------------------------------|
* | 1. $animate.addClass(element, 'super') is called | class="my-animation" |
* | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" |
* | 3. the .super-add class are added to the element | class="my-animation ng-animate super-add" |
* | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate super-add" |
* | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate super-add" |
* | 6. the .super, .super-add-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active super super-add super-add-active" |
* | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation super-add super-add-active" |
* | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation super" |
* | 9. The super class is kept on the element | class="my-animation super" |
* | 10. The doneCallback() callback is fired (if provided) | class="my-animation super" |
*
* @param {jQuery/jqLite element} element the element that will be animated
* @param {string} className the CSS class that will be added to the element and then animated
* @param {function()=} doneCallback the callback function that will be called once the animation is complete
*/
addClass : function(element, className, doneCallback) {
performAnimation('addClass', className, element, null, null, function() {
$delegate.addClass(element, className);
}, doneCallback);
},
/**
* @ngdoc function
* @name ngAnimate.$animate#removeClass
* @methodOf ngAnimate.$animate
*
* @description
* Triggers a custom animation event based off the className variable and then removes the CSS class provided by the className value
* from the element. Unlike the other animation methods, the animate service will suffix the className value with {@type -remove} in
* order to provide the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if
* no CSS transitions or keyframes are defined on the -remove or base CSS classes).
*
* Below is a breakdown of each step that occurs during removeClass animation:
*
* | Animation Step | What the element class attribute looks like |
* |-----------------------------------------------------------------------------------------------|---------------------------------------------|
* | 1. $animate.removeClass(element, 'super') is called | class="my-animation super" |
* | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation super ng-animate" |
* | 3. the .super-remove class are added to the element | class="my-animation super ng-animate super-remove"|
* | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation super ng-animate super-remove" |
* | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation super ng-animate super-remove" |
* | 6. the .super-remove-active and .ng-animate-active classes are added and .super is removed (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active super-remove super-remove-active" |
* | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active super-remove super-remove-active" |
* | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation" |
* | 9. The doneCallback() callback is fired (if provided) | class="my-animation" |
*
*
* @param {jQuery/jqLite element} element the element that will be animated
* @param {string} className the CSS class that will be animated and then removed from the element
* @param {function()=} doneCallback the callback function that will be called once the animation is complete
*/
removeClass : function(element, className, doneCallback) {
performAnimation('removeClass', className, element, null, null, function() {
$delegate.removeClass(element, className);
}, doneCallback);
},
/**
* @ngdoc function
* @name ngAnimate.$animate#enabled
* @methodOf ngAnimate.$animate
* @function
*
* @param {boolean=} value If provided then set the animation on or off.
* @param {jQuery/jqLite element=} element If provided then the element will be used to represent the enable/disable operation
* @return {boolean} Current animation state.
*
* @description
* Globally enables/disables animations.
*
*/
enabled : function(value, element) {
switch(arguments.length) {
case 2:
if(value) {
cleanup(element);
} else {
var data = element.data(NG_ANIMATE_STATE) || {};
data.disabled = true;
element.data(NG_ANIMATE_STATE, data);
}
break;
case 1:
rootAnimateState.disabled = !value;
break;
default:
value = !rootAnimateState.disabled;
break;
}
return !!value;
}
};
/*
all animations call this shared animation triggering function internally.
The animationEvent variable refers to the JavaScript animation event that will be triggered
and the className value is the name of the animation that will be applied within the
CSS code. Element, parentElement and afterElement are provided DOM elements for the animation
and the onComplete callback will be fired once the animation is fully complete.
*/
function performAnimation(animationEvent, className, element, parentElement, afterElement, domOperation, doneCallback) {
var node = extractElementNode(element);
//transcluded directives may sometimes fire an animation using only comment nodes
//best to catch this early on to prevent any animation operations from occurring
if(!node) {
fireDOMOperation();
closeAnimation();
return;
}
var currentClassName = node.className;
var classes = currentClassName + ' ' + className;
var animationLookup = (' ' + classes).replace(/\s+/g,'.');
if (!parentElement) {
parentElement = afterElement ? afterElement.parent() : element.parent();
}
var matches = lookup(animationLookup);
var isClassBased = animationEvent == 'addClass' || animationEvent == 'removeClass';
var ngAnimateState = element.data(NG_ANIMATE_STATE) || {};
//skip the animation if animations are disabled, a parent is already being animated,
//the element is not currently attached to the document body or then completely close
//the animation if any matching animations are not found at all.
//NOTE: IE8 + IE9 should close properly (run closeAnimation()) in case a NO animation is not found.
if (animationsDisabled(element, parentElement) || matches.length === 0) {
fireDOMOperation();
closeAnimation();
return;
}
var animations = [];
//only add animations if the currently running animation is not structural
//or if there is no animation running at all
if(!ngAnimateState.running || !(isClassBased && ngAnimateState.structural)) {
forEach(matches, function(animation) {
//add the animation to the queue to if it is allowed to be cancelled
if(!animation.allowCancel || animation.allowCancel(element, animationEvent, className)) {
var beforeFn, afterFn = animation[animationEvent];
//Special case for a leave animation since there is no point in performing an
//animation on a element node that has already been removed from the DOM
if(animationEvent == 'leave') {
beforeFn = afterFn;
afterFn = null; //this must be falsy so that the animation is skipped for leave
} else {
beforeFn = animation['before' + animationEvent.charAt(0).toUpperCase() + animationEvent.substr(1)];
}
animations.push({
before : beforeFn,
after : afterFn
});
}
});
}
//this would mean that an animation was not allowed so let the existing
//animation do it's thing and close this one early
if(animations.length === 0) {
fireDOMOperation();
fireDoneCallbackAsync();
return;
}
//this value will be searched for class-based CSS className lookup. Therefore,
//we prefix and suffix the current className value with spaces to avoid substring
//lookups of className tokens
var futureClassName = ' ' + currentClassName + ' ';
if(ngAnimateState.running) {
//if an animation is currently running on the element then lets take the steps
//to cancel that animation and fire any required callbacks
$timeout.cancel(ngAnimateState.closeAnimationTimeout);
cleanup(element);
cancelAnimations(ngAnimateState.animations);
//if the class is removed during the reflow then it will revert the styles temporarily
//back to the base class CSS styling causing a jump-like effect to occur. This check
//here ensures that the domOperation is only performed after the reflow has commenced
if(ngAnimateState.beforeComplete) {
(ngAnimateState.done || noop)(true);
} else if(isClassBased && !ngAnimateState.structural) {
//class-based animations will compare element className values after cancelling the
//previous animation to see if the element properties already contain the final CSS
//class and if so then the animation will be skipped. Since the domOperation will
//be performed only after the reflow is complete then our element's className value
//will be invalid. Therefore the same string manipulation that would occur within the
//DOM operation will be performed below so that the class comparison is valid...
futureClassName = ngAnimateState.event == 'removeClass' ?
futureClassName.replace(ngAnimateState.className, '') :
futureClassName + ngAnimateState.className + ' ';
}
}
//There is no point in perform a class-based animation if the element already contains
//(on addClass) or doesn't contain (on removeClass) the className being animated.
//The reason why this is being called after the previous animations are cancelled
//is so that the CSS classes present on the element can be properly examined.
var classNameToken = ' ' + className + ' ';
if((animationEvent == 'addClass' && futureClassName.indexOf(classNameToken) >= 0) ||
(animationEvent == 'removeClass' && futureClassName.indexOf(classNameToken) == -1)) {
fireDOMOperation();
fireDoneCallbackAsync();
return;
}
//the ng-animate class does nothing, but it's here to allow for
//parent animations to find and cancel child animations when needed
element.addClass(NG_ANIMATE_CLASS_NAME);
element.data(NG_ANIMATE_STATE, {
running:true,
event:animationEvent,
className:className,
structural:!isClassBased,
animations:animations,
done:onBeforeAnimationsComplete
});
//first we run the before animations and when all of those are complete
//then we perform the DOM operation and run the next set of animations
invokeRegisteredAnimationFns(animations, 'before', onBeforeAnimationsComplete);
function onBeforeAnimationsComplete(cancelled) {
fireDOMOperation();
if(cancelled === true) {
closeAnimation();
return;
}
//set the done function to the final done function
//so that the DOM event won't be executed twice by accident
//if the after animation is cancelled as well
var data = element.data(NG_ANIMATE_STATE);
if(data) {
data.done = closeAnimation;
element.data(NG_ANIMATE_STATE, data);
}
invokeRegisteredAnimationFns(animations, 'after', closeAnimation);
}
function invokeRegisteredAnimationFns(animations, phase, allAnimationFnsComplete) {
var endFnName = phase + 'End';
forEach(animations, function(animation, index) {
var animationPhaseCompleted = function() {
progress(index, phase);
};
//there are no before functions for enter + move since the DOM
//operations happen before the performAnimation method fires
if(phase == 'before' && (animationEvent == 'enter' || animationEvent == 'move')) {
animationPhaseCompleted();
return;
}
if(animation[phase]) {
animation[endFnName] = isClassBased ?
animation[phase](element, className, animationPhaseCompleted) :
animation[phase](element, animationPhaseCompleted);
} else {
animationPhaseCompleted();
}
});
function progress(index, phase) {
var phaseCompletionFlag = phase + 'Complete';
var currentAnimation = animations[index];
currentAnimation[phaseCompletionFlag] = true;
(currentAnimation[endFnName] || noop)();
for(var i=0;i<animations.length;i++) {
if(!animations[i][phaseCompletionFlag]) return;
}
allAnimationFnsComplete();
}
}
function fireDoneCallbackAsync() {
doneCallback && $timeout(doneCallback, 0, false);
}
//it is less complicated to use a flag than managing and cancelling
//timeouts containing multiple callbacks.
function fireDOMOperation() {
if(!fireDOMOperation.hasBeenRun) {
fireDOMOperation.hasBeenRun = true;
domOperation();
}
}
function closeAnimation() {
if(!closeAnimation.hasBeenRun) {
closeAnimation.hasBeenRun = true;
var data = element.data(NG_ANIMATE_STATE);
if(data) {
/* only structural animations wait for reflow before removing an
animation, but class-based animations don't. An example of this
failing would be when a parent HTML tag has a ng-class attribute
causing ALL directives below to skip animations during the digest */
if(isClassBased) {
cleanup(element);
} else {
data.closeAnimationTimeout = $timeout(function() {
cleanup(element);
}, 0, false);
element.data(NG_ANIMATE_STATE, data);
}
}
fireDoneCallbackAsync();
}
}
}
function cancelChildAnimations(element) {
var node = extractElementNode(element);
forEach(node.querySelectorAll('.' + NG_ANIMATE_CLASS_NAME), function(element) {
element = angular.element(element);
var data = element.data(NG_ANIMATE_STATE);
if(data) {
cancelAnimations(data.animations);
cleanup(element);
}
});
}
function cancelAnimations(animations) {
var isCancelledFlag = true;
forEach(animations, function(animation) {
if(!animations.beforeComplete) {
(animation.beforeEnd || noop)(isCancelledFlag);
}
if(!animations.afterComplete) {
(animation.afterEnd || noop)(isCancelledFlag);
}
});
}
function cleanup(element) {
if(isMatchingElement(element, $rootElement)) {
if(!rootAnimateState.disabled) {
rootAnimateState.running = false;
rootAnimateState.structural = false;
}
} else {
element.removeClass(NG_ANIMATE_CLASS_NAME);
element.removeData(NG_ANIMATE_STATE);
}
}
function animationsDisabled(element, parentElement) {
if (rootAnimateState.disabled) return true;
if(isMatchingElement(element, $rootElement)) {
return rootAnimateState.disabled || rootAnimateState.running;
}
do {
//the element did not reach the root element which means that it
//is not apart of the DOM. Therefore there is no reason to do
//any animations on it
if(parentElement.length === 0) break;
var isRoot = isMatchingElement(parentElement, $rootElement);
var state = isRoot ? rootAnimateState : parentElement.data(NG_ANIMATE_STATE);
var result = state && (!!state.disabled || !!state.running);
if(isRoot || result) {
return result;
}
if(isRoot) return true;
}
while(parentElement = parentElement.parent());
return true;
}
}]);
$animateProvider.register('', ['$window', '$sniffer', '$timeout', function($window, $sniffer, $timeout) {
// Detect proper transitionend/animationend event names.
var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT;
// If unprefixed events are not supported but webkit-prefixed are, use the latter.
// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
// Register both events in case `window.onanimationend` is not supported because of that,
// do the same for `transitionend` as Safari is likely to exhibit similar behavior.
// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
// therefore there is no reason to test anymore for other vendor prefixes: http://caniuse.com/#search=transition
if (window.ontransitionend === undefined && window.onwebkittransitionend !== undefined) {
CSS_PREFIX = '-webkit-';
TRANSITION_PROP = 'WebkitTransition';
TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';
} else {
TRANSITION_PROP = 'transition';
TRANSITIONEND_EVENT = 'transitionend';
}
if (window.onanimationend === undefined && window.onwebkitanimationend !== undefined) {
CSS_PREFIX = '-webkit-';
ANIMATION_PROP = 'WebkitAnimation';
ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';
} else {
ANIMATION_PROP = 'animation';
ANIMATIONEND_EVENT = 'animationend';
}
var DURATION_KEY = 'Duration';
var PROPERTY_KEY = 'Property';
var DELAY_KEY = 'Delay';
var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount';
var NG_ANIMATE_PARENT_KEY = '$$ngAnimateKey';
var NG_ANIMATE_CSS_DATA_KEY = '$$ngAnimateCSS3Data';
var NG_ANIMATE_FALLBACK_CLASS_NAME = 'ng-animate-start';
var NG_ANIMATE_FALLBACK_ACTIVE_CLASS_NAME = 'ng-animate-active';
var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;
var lookupCache = {};
var parentCounter = 0;
var animationReflowQueue = [], animationTimer, timeOut = false;
function afterReflow(callback) {
animationReflowQueue.push(callback);
$timeout.cancel(animationTimer);
animationTimer = $timeout(function() {
forEach(animationReflowQueue, function(fn) {
fn();
});
animationReflowQueue = [];
animationTimer = null;
lookupCache = {};
}, 10, false);
}
function getElementAnimationDetails(element, cacheKey) {
var data = cacheKey ? lookupCache[cacheKey] : null;
if(!data) {
var transitionDuration = 0;
var transitionDelay = 0;
var animationDuration = 0;
var animationDelay = 0;
var transitionDelayStyle;
var animationDelayStyle;
var transitionDurationStyle;
var transitionPropertyStyle;
//we want all the styles defined before and after
forEach(element, function(element) {
if (element.nodeType == ELEMENT_NODE) {
var elementStyles = $window.getComputedStyle(element) || {};
transitionDurationStyle = elementStyles[TRANSITION_PROP + DURATION_KEY];
transitionDuration = Math.max(parseMaxTime(transitionDurationStyle), transitionDuration);
transitionPropertyStyle = elementStyles[TRANSITION_PROP + PROPERTY_KEY];
transitionDelayStyle = elementStyles[TRANSITION_PROP + DELAY_KEY];
transitionDelay = Math.max(parseMaxTime(transitionDelayStyle), transitionDelay);
animationDelayStyle = elementStyles[ANIMATION_PROP + DELAY_KEY];
animationDelay = Math.max(parseMaxTime(animationDelayStyle), animationDelay);
var aDuration = parseMaxTime(elementStyles[ANIMATION_PROP + DURATION_KEY]);
if(aDuration > 0) {
aDuration *= parseInt(elementStyles[ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY], 10) || 1;
}
animationDuration = Math.max(aDuration, animationDuration);
}
});
data = {
total : 0,
transitionPropertyStyle: transitionPropertyStyle,
transitionDurationStyle: transitionDurationStyle,
transitionDelayStyle: transitionDelayStyle,
transitionDelay: transitionDelay,
transitionDuration: transitionDuration,
animationDelayStyle: animationDelayStyle,
animationDelay: animationDelay,
animationDuration: animationDuration
};
if(cacheKey) {
lookupCache[cacheKey] = data;
}
}
return data;
}
function parseMaxTime(str) {
var maxValue = 0;
var values = angular.isString(str) ?
str.split(/\s*,\s*/) :
[];
forEach(values, function(value) {
maxValue = Math.max(parseFloat(value) || 0, maxValue);
});
return maxValue;
}
function getCacheKey(element) {
var parentElement = element.parent();
var parentID = parentElement.data(NG_ANIMATE_PARENT_KEY);
if(!parentID) {
parentElement.data(NG_ANIMATE_PARENT_KEY, ++parentCounter);
parentID = parentCounter;
}
return parentID + '-' + extractElementNode(element).className;
}
function animateSetup(element, className) {
var cacheKey = getCacheKey(element);
var eventCacheKey = cacheKey + ' ' + className;
var stagger = {};
var ii = lookupCache[eventCacheKey] ? ++lookupCache[eventCacheKey].total : 0;
if(ii > 0) {
var staggerClassName = className + '-stagger';
var staggerCacheKey = cacheKey + ' ' + staggerClassName;
var applyClasses = !lookupCache[staggerCacheKey];
applyClasses && element.addClass(staggerClassName);
stagger = getElementAnimationDetails(element, staggerCacheKey);
applyClasses && element.removeClass(staggerClassName);
}
element.addClass(className);
var timings = getElementAnimationDetails(element, eventCacheKey);
/* there is no point in performing a reflow if the animation
timeout is empty (this would cause a flicker bug normally
in the page. There is also no point in performing an animation
that only has a delay and no duration */
var maxDuration = Math.max(timings.transitionDuration, timings.animationDuration);
if(maxDuration === 0) {
element.removeClass(className);
return false;
}
//temporarily disable the transition so that the enter styles
//don't animate twice (this is here to avoid a bug in Chrome/FF).
var activeClassName = '';
if(timings.transitionDuration > 0) {
element.addClass(NG_ANIMATE_FALLBACK_CLASS_NAME);
activeClassName += NG_ANIMATE_FALLBACK_ACTIVE_CLASS_NAME + ' ';
blockTransitions(element);
} else {
blockKeyframeAnimations(element);
}
forEach(className.split(' '), function(klass, i) {
activeClassName += (i > 0 ? ' ' : '') + klass + '-active';
});
element.data(NG_ANIMATE_CSS_DATA_KEY, {
className : className,
activeClassName : activeClassName,
maxDuration : maxDuration,
classes : className + ' ' + activeClassName,
timings : timings,
stagger : stagger,
ii : ii
});
return true;
}
function blockTransitions(element) {
extractElementNode(element).style[TRANSITION_PROP + PROPERTY_KEY] = 'none';
}
function blockKeyframeAnimations(element) {
extractElementNode(element).style[ANIMATION_PROP] = 'none 0s';
}
function unblockTransitions(element) {
var prop = TRANSITION_PROP + PROPERTY_KEY;
var node = extractElementNode(element);
if(node.style[prop] && node.style[prop].length > 0) {
node.style[prop] = '';
}
}
function unblockKeyframeAnimations(element) {
var prop = ANIMATION_PROP;
var node = extractElementNode(element);
if(node.style[prop] && node.style[prop].length > 0) {
node.style[prop] = '';
}
}
function animateRun(element, className, activeAnimationComplete) {
var data = element.data(NG_ANIMATE_CSS_DATA_KEY);
var node = extractElementNode(element);
if(node.className.indexOf(className) == -1 || !data) {
activeAnimationComplete();
return;
}
var timings = data.timings;
var stagger = data.stagger;
var maxDuration = data.maxDuration;
var activeClassName = data.activeClassName;
var maxDelayTime = Math.max(timings.transitionDelay, timings.animationDelay) * 1000;
var startTime = Date.now();
var css3AnimationEvents = ANIMATIONEND_EVENT + ' ' + TRANSITIONEND_EVENT;
var ii = data.ii;
var applyFallbackStyle, style = '', appliedStyles = [];
if(timings.transitionDuration > 0) {
var propertyStyle = timings.transitionPropertyStyle;
if(propertyStyle.indexOf('all') == -1) {
applyFallbackStyle = true;
var fallbackProperty = $sniffer.msie ? '-ms-zoom' : 'border-spacing';
style += CSS_PREFIX + 'transition-property: ' + propertyStyle + ', ' + fallbackProperty + '; ';
style += CSS_PREFIX + 'transition-duration: ' + timings.transitionDurationStyle + ', ' + timings.transitionDuration + 's; ';
appliedStyles.push(CSS_PREFIX + 'transition-property');
appliedStyles.push(CSS_PREFIX + 'transition-duration');
}
}
if(ii > 0) {
if(stagger.transitionDelay > 0 && stagger.transitionDuration === 0) {
var delayStyle = timings.transitionDelayStyle;
if(applyFallbackStyle) {
delayStyle += ', ' + timings.transitionDelay + 's';
}
style += CSS_PREFIX + 'transition-delay: ' +
prepareStaggerDelay(delayStyle, stagger.transitionDelay, ii) + '; ';
appliedStyles.push(CSS_PREFIX + 'transition-delay');
}
if(stagger.animationDelay > 0 && stagger.animationDuration === 0) {
style += CSS_PREFIX + 'animation-delay: ' +
prepareStaggerDelay(timings.animationDelayStyle, stagger.animationDelay, ii) + '; ';
appliedStyles.push(CSS_PREFIX + 'animation-delay');
}
}
if(appliedStyles.length > 0) {
//the element being animated may sometimes contain comment nodes in
//the jqLite object, so we're safe to use a single variable to house
//the styles since there is always only one element being animated
var oldStyle = node.getAttribute('style') || '';
node.setAttribute('style', oldStyle + ' ' + style);
}
element.on(css3AnimationEvents, onAnimationProgress);
element.addClass(activeClassName);
// This will automatically be called by $animate so
// there is no need to attach this internally to the
// timeout done method.
return function onEnd(cancelled) {
element.off(css3AnimationEvents, onAnimationProgress);
element.removeClass(activeClassName);
animateClose(element, className);
var node = extractElementNode(element);
for (var i in appliedStyles) {
node.style.removeProperty(appliedStyles[i]);
}
};
function onAnimationProgress(event) {
event.stopPropagation();
var ev = event.originalEvent || event;
var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now();
/* Firefox (or possibly just Gecko) likes to not round values up
* when a ms measurement is used for the animation */
var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));
/* $manualTimeStamp is a mocked timeStamp value which is set
* within browserTrigger(). This is only here so that tests can
* mock animations properly. Real events fallback to event.timeStamp,
* or, if they don't, then a timeStamp is automatically created for them.
* We're checking to see if the timeStamp surpasses the expected delay,
* but we're using elapsedTime instead of the timeStamp on the 2nd
* pre-condition since animations sometimes close off early */
if(Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {
activeAnimationComplete();
}
}
}
function prepareStaggerDelay(delayStyle, staggerDelay, index) {
var style = '';
forEach(delayStyle.split(','), function(val, i) {
style += (i > 0 ? ',' : '') +
(index * staggerDelay + parseInt(val, 10)) + 's';
});
return style;
}
function animateBefore(element, className) {
if(animateSetup(element, className)) {
return function(cancelled) {
cancelled && animateClose(element, className);
};
}
}
function animateAfter(element, className, afterAnimationComplete) {
if(element.data(NG_ANIMATE_CSS_DATA_KEY)) {
return animateRun(element, className, afterAnimationComplete);
} else {
animateClose(element, className);
afterAnimationComplete();
}
}
function animate(element, className, animationComplete) {
//If the animateSetup function doesn't bother returning a
//cancellation function then it means that there is no animation
//to perform at all
var preReflowCancellation = animateBefore(element, className);
if(!preReflowCancellation) {
animationComplete();
return;
}
//There are two cancellation functions: one is before the first
//reflow animation and the second is during the active state
//animation. The first function will take care of removing the
//data from the element which will not make the 2nd animation
//happen in the first place
var cancel = preReflowCancellation;
afterReflow(function() {
unblockTransitions(element);
unblockKeyframeAnimations(element);
//once the reflow is complete then we point cancel to
//the new cancellation function which will remove all of the
//animation properties from the active animation
cancel = animateAfter(element, className, animationComplete);
});
return function(cancelled) {
(cancel || noop)(cancelled);
};
}
function animateClose(element, className) {
element.removeClass(className);
element.removeClass(NG_ANIMATE_FALLBACK_CLASS_NAME);
element.removeData(NG_ANIMATE_CSS_DATA_KEY);
}
return {
allowCancel : function(element, animationEvent, className) {
//always cancel the current animation if it is a
//structural animation
var oldClasses = (element.data(NG_ANIMATE_CSS_DATA_KEY) || {}).classes;
if(!oldClasses || ['enter','leave','move'].indexOf(animationEvent) >= 0) {
return true;
}
var parentElement = element.parent();
var clone = angular.element(extractElementNode(element).cloneNode());
//make the element super hidden and override any CSS style values
clone.attr('style','position:absolute; top:-9999px; left:-9999px');
clone.removeAttr('id');
clone.html('');
forEach(oldClasses.split(' '), function(klass) {
clone.removeClass(klass);
});
var suffix = animationEvent == 'addClass' ? '-add' : '-remove';
clone.addClass(suffixClasses(className, suffix));
parentElement.append(clone);
var timings = getElementAnimationDetails(clone);
clone.remove();
return Math.max(timings.transitionDuration, timings.animationDuration) > 0;
},
enter : function(element, animationCompleted) {
return animate(element, 'ng-enter', animationCompleted);
},
leave : function(element, animationCompleted) {
return animate(element, 'ng-leave', animationCompleted);
},
move : function(element, animationCompleted) {
return animate(element, 'ng-move', animationCompleted);
},
beforeAddClass : function(element, className, animationCompleted) {
var cancellationMethod = animateBefore(element, suffixClasses(className, '-add'));
if(cancellationMethod) {
afterReflow(function() {
unblockTransitions(element);
unblockKeyframeAnimations(element);
animationCompleted();
});
return cancellationMethod;
}
animationCompleted();
},
addClass : function(element, className, animationCompleted) {
return animateAfter(element, suffixClasses(className, '-add'), animationCompleted);
},
beforeRemoveClass : function(element, className, animationCompleted) {
var cancellationMethod = animateBefore(element, suffixClasses(className, '-remove'));
if(cancellationMethod) {
afterReflow(function() {
unblockTransitions(element);
unblockKeyframeAnimations(element);
animationCompleted();
});
return cancellationMethod;
}
animationCompleted();
},
removeClass : function(element, className, animationCompleted) {
return animateAfter(element, suffixClasses(className, '-remove'), animationCompleted);
}
};
function suffixClasses(classes, suffix) {
var className = '';
classes = angular.isArray(classes) ? classes : classes.split(/\s+/);
forEach(classes, function(klass, i) {
if(klass && klass.length > 0) {
className += (i > 0 ? ' ' : '') + klass + suffix;
}
});
return className;
}
}]);
}]);
})(window, window.angular);
| suy/cdnjs | ajax/libs/angular.js/1.2.4/angular-animate.js | JavaScript | mit | 64,011 |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
/**
* Wraps another SessionHandlerInterface to only write the session when it has been modified.
*
* @author Adrien Brault <adrien.brault@gmail.com>
*/
class WriteCheckSessionHandler implements \SessionHandlerInterface
{
/**
* @var \SessionHandlerInterface
*/
private $wrappedSessionHandler;
/**
* @var array sessionId => session
*/
private $readSessions;
public function __construct(\SessionHandlerInterface $wrappedSessionHandler)
{
$this->wrappedSessionHandler = $wrappedSessionHandler;
}
/**
* {@inheritdoc}
*/
public function close()
{
return $this->wrappedSessionHandler->close();
}
/**
* {@inheritdoc}
*/
public function destroy($sessionId)
{
return $this->wrappedSessionHandler->destroy($sessionId);
}
/**
* {@inheritdoc}
*/
public function gc($maxlifetime)
{
return $this->wrappedSessionHandler->gc($maxlifetime);
}
/**
* {@inheritdoc}
*/
public function open($savePath, $sessionName)
{
return $this->wrappedSessionHandler->open($savePath, $sessionName);
}
/**
* {@inheritdoc}
*/
public function read($sessionId)
{
$session = $this->wrappedSessionHandler->read($sessionId);
$this->readSessions[$sessionId] = $session;
return $session;
}
/**
* {@inheritdoc}
*/
public function write($sessionId, $data)
{
if (isset($this->readSessions[$sessionId]) && $data === $this->readSessions[$sessionId]) {
return true;
}
return $this->wrappedSessionHandler->write($sessionId, $data);
}
}
| dineshbh/Neveshtar | vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/WriteCheckSessionHandler.php | PHP | mit | 2,011 |
var MapCache = require('./_MapCache');
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result) || cache;
return result;
};
memoized.cache = new (memoize.Cache || MapCache);
return memoized;
}
// Expose `MapCache`.
memoize.Cache = MapCache;
module.exports = memoize;
| HeberGB/Project-Manager | node_modules/babel-types/node_modules/lodash/memoize.js | JavaScript | mit | 2,224 |
var baseAssign = require('./_baseAssign'),
baseCreate = require('./_baseCreate');
/**
* Creates an object that inherits from the `prototype` object. If a
* `properties` object is given, its own enumerable string keyed properties
* are assigned to the created object.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Object
* @param {Object} prototype The object to inherit from.
* @param {Object} [properties] The properties to assign to the object.
* @returns {Object} Returns the new object.
* @example
*
* function Shape() {
* this.x = 0;
* this.y = 0;
* }
*
* function Circle() {
* Shape.call(this);
* }
*
* Circle.prototype = _.create(Shape.prototype, {
* 'constructor': Circle
* });
*
* var circle = new Circle;
* circle instanceof Circle;
* // => true
*
* circle instanceof Shape;
* // => true
*/
function create(prototype, properties) {
var result = baseCreate(prototype);
return properties == null ? result : baseAssign(result, properties);
}
module.exports = create;
| CallumRocks/ReduxSimpleStarter | node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-es2015-modules-systemjs/node_modules/babel-template/node_modules/lodash/create.js | JavaScript | mit | 1,032 |
/*
* Copyright (C) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#if ENABLE(WEB_AUDIO)
#include "LowPass2FilterNode.h"
namespace WebCore {
LowPass2FilterNode::LowPass2FilterNode(AudioContext* context, double sampleRate)
: AudioBasicProcessorNode(context, sampleRate)
{
m_processor = adoptPtr(new BiquadProcessor(BiquadProcessor::LowPass2, sampleRate, 1, false));
setType(NodeTypeLowPass2Filter);
}
} // namespace WebCore
#endif // ENABLE(WEB_AUDIO)
| stephaneAG/PengPod700 | QtEsrc/backup_qt/qt-everywhere-opensource-src-4.8.5/src/3rdparty/webkit/Source/WebCore/webaudio/LowPass2FilterNode.cpp | C++ | mit | 1,779 |
loadIonicon('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M32 96v320h448V96H32zm398 159.8c0 20.9-1.1 37.2-2.8 61.9l-.5 7.8c-1.9 27.8-16.4 42.6-44.5 45.2-32.2 3-76.9 3.3-112.3 3.3h-27.8c-35.4 0-80.2-.4-112.3-3.3-28-2.6-42.6-17.4-44.5-45.2l-.5-7.7c-1.7-24.7-2.8-41-2.8-62 0-23.5.1-38.3 3.3-69.4 2.9-28.1 17-42.5 44.6-45.3 31.2-3.2 86.1-3.2 126.1-3.2 40.1 0 95 0 126.2 3.2 27.5 2.8 41.7 17.2 44.6 45.3 3.1 31.1 3.3 45.9 3.2 69.4z"/><path d="M337.7 162.4c-10.9 0-20.9 1.4-30 4.3-9.1 2.9-17 7.9-23.6 15.1-6.6 7.2-11.7 16.8-15.4 28.9-3.6 12.1-5.5 27.3-5.5 45.7 0 18 1.5 33 4.4 45.1 3 12.1 7.3 21.7 13.1 28.9 5.8 7.2 13.1 12.2 21.8 15 8.8 2.8 19.1 4.2 30.9 4.2 25 0 43-6.4 53.8-18.7 10.8-12.3 16.2-30.3 16.2-53.9h-46.1v4.1c0 16.3-10.1 25.9-23.6 25.9-13.5 0-22.6-10.8-23.9-25.9 0 0-1.2-7.9-1.2-23.9s1.4-26 1.4-26c2.4-17 10.7-25.9 24.2-25.9 13.4 0 24.1 11.6 24.1 29.2v.5h45.1c0-21.9-5.5-41.6-16.6-54-10.8-12.4-27.2-18.6-49.1-18.6zM182.8 162.4c-10.9 0-20.9 1.4-30 4.3-9.1 2.9-17 7.9-23.6 15.1-6.6 7.2-11.7 16.8-15.4 28.9-3.6 12.1-5.5 27.3-5.5 45.7 0 18 1.5 33 4.4 45.1 3 12.1 7.3 21.7 13.1 28.9 5.8 7.2 13.1 12.2 21.8 15 8.8 2.8 19.1 4.2 30.9 4.2 25 0 43-6.4 53.8-18.7 10.8-12.3 16.2-30.3 16.2-53.9h-46.1v4.1c0 16.3-10.1 25.9-23.6 25.9-13.5 0-22.6-10.8-23.9-25.9 0 0-1.2-7.9-1.2-23.9s1.4-26 1.4-26c2.4-17 10.7-25.9 24.2-25.9 13.4 0 24.1 11.6 24.1 29.2v.5h45.1c0-21.9-5.5-41.6-16.6-54-10.8-12.4-27.2-18.6-49.1-18.6z"/></svg>','ios-closed-captioning'); | cdnjs/cdnjs | ajax/libs/ionicons/4.0.0-5/ionicons/svg/ios-closed-captioning.js | JavaScript | mit | 1,466 |
/*
AngularJS v1.4.12
(c) 2010-2015 Google, Inc. http://angularjs.org
License: MIT
*/
(function(){'use strict';function d(b){return function(){var a=arguments[0],e;e="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.4.12/"+(b?b+"/":"")+a;for(a=1;a<arguments.length;a++){e=e+(1==a?"?":"&")+"p"+(a-1)+"=";var d=encodeURIComponent,c;c=arguments[a];c="function"==typeof c?c.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof c?"undefined":"string"!=typeof c?JSON.stringify(c):c;e+=d(c)}return Error(e)}}(function(b){function a(c,a,b){return c[a]||(c[a]=b())}var e=d("$injector"),n=d("ng");
b=a(b,"angular",Object);b.$$minErr=b.$$minErr||d;return a(b,"module",function(){var c={};return function(b,d,h){if("hasOwnProperty"===b)throw n("badname","module");d&&c.hasOwnProperty(b)&&(c[b]=null);return a(c,b,function(){function c(a,b,d,e){e||(e=f);return function(){e[d||"push"]([a,b,arguments]);return g}}function a(c,e){return function(a,d){d&&"function"===typeof d&&(d.$$moduleName=b);f.push([c,e,arguments]);return g}}if(!d)throw e("nomod",b);var f=[],k=[],l=[],m=c("$injector","invoke","push",
k),g={_invokeQueue:f,_configBlocks:k,_runBlocks:l,requires:d,name:b,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide","service"),value:c("$provide","value"),constant:c("$provide","constant","unshift"),decorator:a("$provide","decorator"),animation:a("$animateProvider","register"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:m,run:function(a){l.push(a);return this}};h&&m(h);
return g})}})})(window)})(window);
//# sourceMappingURL=angular-loader.min.js.map
| dc-js/cdnjs | ajax/libs/angular.js/1.4.12/angular-loader.min.js | JavaScript | mit | 1,687 |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sw=4 et tw=80:
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* JS execution context.
*/
#include "jsstddef.h"
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "jstypes.h"
#include "jsarena.h" /* Added by JSIFY */
#include "jsutil.h" /* Added by JSIFY */
#include "jsclist.h"
#include "jsprf.h"
#include "jsatom.h"
#include "jscntxt.h"
#include "jsconfig.h"
#include "jsdbgapi.h"
#include "jsexn.h"
#include "jsgc.h"
#include "jslock.h"
#include "jsnum.h"
#include "jsobj.h"
#include "jsopcode.h"
#include "jsscan.h"
#include "jsscope.h"
#include "jsscript.h"
#include "jsstr.h"
#ifdef JS_THREADSAFE
/*
* Callback function to delete a JSThread info when the thread that owns it
* is destroyed.
*/
void JS_DLL_CALLBACK
js_ThreadDestructorCB(void *ptr)
{
JSThread *thread = (JSThread *)ptr;
if (!thread)
return;
while (!JS_CLIST_IS_EMPTY(&thread->contextList)) {
/* NB: use a temporary, as the macro evaluates its args many times. */
JSCList *link = thread->contextList.next;
JS_REMOVE_AND_INIT_LINK(link);
}
GSN_CACHE_CLEAR(&thread->gsnCache);
free(thread);
}
/*
* Get current thread-local JSThread info, creating one if it doesn't exist.
* Each thread has a unique JSThread pointer.
*
* Since we are dealing with thread-local data, no lock is needed.
*
* Return a pointer to the thread local info, NULL if the system runs out
* of memory, or it failed to set thread private data (neither case is very
* likely; both are probably due to out-of-memory). It is up to the caller
* to report an error, if possible.
*/
JSThread *
js_GetCurrentThread(JSRuntime *rt)
{
JSThread *thread;
thread = (JSThread *)PR_GetThreadPrivate(rt->threadTPIndex);
if (!thread) {
thread = (JSThread *) calloc(1, sizeof(JSThread));
if (!thread)
return NULL;
if (PR_FAILURE == PR_SetThreadPrivate(rt->threadTPIndex, thread)) {
free(thread);
return NULL;
}
JS_INIT_CLIST(&thread->contextList);
thread->id = js_CurrentThreadId();
/* js_SetContextThread initialize gcFreeLists as necessary. */
#ifdef DEBUG
memset(thread->gcFreeLists, JS_FREE_PATTERN,
sizeof(thread->gcFreeLists));
#endif
}
return thread;
}
/*
* Sets current thread as owning thread of a context by assigning the
* thread-private info to the context. If the current thread doesn't have
* private JSThread info, create one.
*/
JSBool
js_SetContextThread(JSContext *cx)
{
JSThread *thread = js_GetCurrentThread(cx->runtime);
if (!thread) {
JS_ReportOutOfMemory(cx);
return JS_FALSE;
}
/*
* Clear gcFreeLists on each transition from 0 to 1 context active on the
* current thread. See bug 351602.
*/
if (JS_CLIST_IS_EMPTY(&thread->contextList))
memset(thread->gcFreeLists, 0, sizeof(thread->gcFreeLists));
cx->thread = thread;
JS_REMOVE_LINK(&cx->threadLinks);
JS_APPEND_LINK(&cx->threadLinks, &thread->contextList);
return JS_TRUE;
}
/* Remove the owning thread info of a context. */
void
js_ClearContextThread(JSContext *cx)
{
JS_REMOVE_AND_INIT_LINK(&cx->threadLinks);
#ifdef DEBUG
if (JS_CLIST_IS_EMPTY(&cx->thread->contextList)) {
memset(cx->thread->gcFreeLists, JS_FREE_PATTERN,
sizeof(cx->thread->gcFreeLists));
}
#endif
cx->thread = NULL;
}
#endif /* JS_THREADSAFE */
void
js_OnVersionChange(JSContext *cx)
{
#ifdef DEBUG
JSVersion version = JSVERSION_NUMBER(cx);
JS_ASSERT(version == JSVERSION_DEFAULT || version >= JSVERSION_ECMA_3);
#endif
}
void
js_SetVersion(JSContext *cx, JSVersion version)
{
cx->version = version;
js_OnVersionChange(cx);
}
JSContext *
js_NewContext(JSRuntime *rt, size_t stackChunkSize)
{
JSContext *cx;
JSBool ok, first;
JSContextCallback cxCallback;
cx = (JSContext *) malloc(sizeof *cx);
if (!cx)
return NULL;
memset(cx, 0, sizeof *cx);
cx->runtime = rt;
#if JS_STACK_GROWTH_DIRECTION > 0
cx->stackLimit = (jsuword)-1;
#endif
#ifdef JS_THREADSAFE
JS_INIT_CLIST(&cx->threadLinks);
js_SetContextThread(cx);
#endif
JS_LOCK_GC(rt);
for (;;) {
first = (rt->contextList.next == &rt->contextList);
if (rt->state == JSRTS_UP) {
JS_ASSERT(!first);
break;
}
if (rt->state == JSRTS_DOWN) {
JS_ASSERT(first);
rt->state = JSRTS_LAUNCHING;
break;
}
JS_WAIT_CONDVAR(rt->stateChange, JS_NO_TIMEOUT);
}
JS_APPEND_LINK(&cx->links, &rt->contextList);
JS_UNLOCK_GC(rt);
/*
* First we do the infallible, every-time per-context initializations.
* Should a later, fallible initialization (js_InitRegExpStatics, e.g.,
* or the stuff under 'if (first)' below) fail, at least the version
* and arena-pools will be valid and safe to use (say, from the last GC
* done by js_DestroyContext).
*/
cx->version = JSVERSION_DEFAULT;
cx->jsop_eq = JSOP_EQ;
cx->jsop_ne = JSOP_NE;
JS_InitArenaPool(&cx->stackPool, "stack", stackChunkSize, sizeof(jsval));
JS_InitArenaPool(&cx->tempPool, "temp", 1024, sizeof(jsdouble));
if (!js_InitRegExpStatics(cx, &cx->regExpStatics)) {
js_DestroyContext(cx, JSDCM_NEW_FAILED);
return NULL;
}
/*
* If cx is the first context on this runtime, initialize well-known atoms,
* keywords, numbers, and strings. If one of these steps should fail, the
* runtime will be left in a partially initialized state, with zeroes and
* nulls stored in the default-initialized remainder of the struct. We'll
* clean the runtime up under js_DestroyContext, because cx will be "last"
* as well as "first".
*/
if (first) {
#ifdef JS_THREADSAFE
JS_BeginRequest(cx);
#endif
/*
* Both atomState and the scriptFilenameTable may be left over from a
* previous episode of non-zero contexts alive in rt, so don't re-init
* either table if it's not necessary. Just repopulate atomState with
* well-known internal atoms, and with the reserved identifiers added
* by the scanner.
*/
ok = (rt->atomState.liveAtoms == 0)
? js_InitAtomState(cx, &rt->atomState)
: js_InitPinnedAtoms(cx, &rt->atomState);
if (ok && !rt->scriptFilenameTable)
ok = js_InitRuntimeScriptState(rt);
if (ok)
ok = js_InitRuntimeNumberState(cx);
if (ok)
ok = js_InitRuntimeStringState(cx);
#ifdef JS_THREADSAFE
JS_EndRequest(cx);
#endif
if (!ok) {
js_DestroyContext(cx, JSDCM_NEW_FAILED);
return NULL;
}
JS_LOCK_GC(rt);
rt->state = JSRTS_UP;
JS_NOTIFY_ALL_CONDVAR(rt->stateChange);
JS_UNLOCK_GC(rt);
}
cxCallback = rt->cxCallback;
if (cxCallback && !cxCallback(cx, JSCONTEXT_NEW)) {
js_DestroyContext(cx, JSDCM_NEW_FAILED);
return NULL;
}
return cx;
}
void
js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
{
JSRuntime *rt;
JSContextCallback cxCallback;
JSBool last;
JSArgumentFormatMap *map;
JSLocalRootStack *lrs;
JSLocalRootChunk *lrc;
rt = cx->runtime;
if (mode != JSDCM_NEW_FAILED) {
cxCallback = rt->cxCallback;
if (cxCallback) {
/*
* JSCONTEXT_DESTROY callback is not allowed to fail and must
* return true.
*/
#ifdef DEBUG
JSBool callbackStatus =
#endif
cxCallback(cx, JSCONTEXT_DESTROY);
JS_ASSERT(callbackStatus);
}
}
/* Remove cx from context list first. */
JS_LOCK_GC(rt);
JS_ASSERT(rt->state == JSRTS_UP || rt->state == JSRTS_LAUNCHING);
JS_REMOVE_LINK(&cx->links);
last = (rt->contextList.next == &rt->contextList);
if (last)
rt->state = JSRTS_LANDING;
JS_UNLOCK_GC(rt);
if (last) {
#ifdef JS_THREADSAFE
/*
* If cx is not in a request already, begin one now so that we wait
* for any racing GC started on a not-last context to finish, before
* we plow ahead and unpin atoms. Note that even though we begin a
* request here if necessary, we end all requests on cx below before
* forcing a final GC. This lets any not-last context destruction
* racing in another thread try to force or maybe run the GC, but by
* that point, rt->state will not be JSRTS_UP, and that GC attempt
* will return early.
*/
if (cx->requestDepth == 0)
JS_BeginRequest(cx);
#endif
/* Unpin all pinned atoms before final GC. */
js_UnpinPinnedAtoms(&rt->atomState);
/* Unlock and clear GC things held by runtime pointers. */
js_FinishRuntimeNumberState(cx);
js_FinishRuntimeStringState(cx);
/* Clear debugging state to remove GC roots. */
JS_ClearAllTraps(cx);
JS_ClearAllWatchPoints(cx);
}
/*
* Remove more GC roots in regExpStatics, then collect garbage.
* XXX anti-modularity alert: we rely on the call to js_RemoveRoot within
* XXX this function call to wait for any racing GC to complete, in the
* XXX case where JS_DestroyContext is called outside of a request on cx
*/
js_FreeRegExpStatics(cx, &cx->regExpStatics);
#ifdef JS_THREADSAFE
/*
* Destroying a context implicitly calls JS_EndRequest(). Also, we must
* end our request here in case we are "last" -- in that event, another
* js_DestroyContext that was not last might be waiting in the GC for our
* request to end. We'll let it run below, just before we do the truly
* final GC and then free atom state.
*
* At this point, cx must be inaccessible to other threads. It's off the
* rt->contextList, and it should not be reachable via any object private
* data structure.
*/
while (cx->requestDepth != 0)
JS_EndRequest(cx);
#endif
if (last) {
js_GC(cx, GC_LAST_CONTEXT);
/* Try to free atom state, now that no unrooted scripts survive. */
if (rt->atomState.liveAtoms == 0)
js_FreeAtomState(cx, &rt->atomState);
/* Also free the script filename table if it exists and is empty. */
if (rt->scriptFilenameTable && rt->scriptFilenameTable->nentries == 0)
js_FinishRuntimeScriptState(rt);
/*
* Free the deflated string cache, but only after the last GC has
* collected all unleaked strings.
*/
js_FinishDeflatedStringCache(rt);
/* Take the runtime down, now that it has no contexts or atoms. */
JS_LOCK_GC(rt);
rt->state = JSRTS_DOWN;
JS_NOTIFY_ALL_CONDVAR(rt->stateChange);
JS_UNLOCK_GC(rt);
} else {
if (mode == JSDCM_FORCE_GC)
js_GC(cx, GC_NORMAL);
else if (mode == JSDCM_MAYBE_GC)
JS_MaybeGC(cx);
}
/* Free the stuff hanging off of cx. */
JS_FinishArenaPool(&cx->stackPool);
JS_FinishArenaPool(&cx->tempPool);
if (cx->lastMessage)
free(cx->lastMessage);
/* Remove any argument formatters. */
map = cx->argumentFormatMap;
while (map) {
JSArgumentFormatMap *temp = map;
map = map->next;
JS_free(cx, temp);
}
/* Destroy the resolve recursion damper. */
if (cx->resolvingTable) {
JS_DHashTableDestroy(cx->resolvingTable);
cx->resolvingTable = NULL;
}
lrs = cx->localRootStack;
if (lrs) {
while ((lrc = lrs->topChunk) != &lrs->firstChunk) {
lrs->topChunk = lrc->down;
JS_free(cx, lrc);
}
JS_free(cx, lrs);
}
#ifdef JS_THREADSAFE
js_ClearContextThread(cx);
#endif
/* Finally, free cx itself. */
free(cx);
}
JSBool
js_ValidContextPointer(JSRuntime *rt, JSContext *cx)
{
JSCList *cl;
for (cl = rt->contextList.next; cl != &rt->contextList; cl = cl->next) {
if (cl == &cx->links)
return JS_TRUE;
}
JS_RUNTIME_METER(rt, deadContexts);
return JS_FALSE;
}
JSContext *
js_ContextIterator(JSRuntime *rt, JSBool unlocked, JSContext **iterp)
{
JSContext *cx = *iterp;
if (unlocked)
JS_LOCK_GC(rt);
if (!cx)
cx = (JSContext *)&rt->contextList;
cx = (JSContext *)cx->links.next;
if (&cx->links == &rt->contextList)
cx = NULL;
*iterp = cx;
if (unlocked)
JS_UNLOCK_GC(rt);
return cx;
}
JS_STATIC_DLL_CALLBACK(const void *)
resolving_GetKey(JSDHashTable *table, JSDHashEntryHdr *hdr)
{
JSResolvingEntry *entry = (JSResolvingEntry *)hdr;
return &entry->key;
}
JS_STATIC_DLL_CALLBACK(JSDHashNumber)
resolving_HashKey(JSDHashTable *table, const void *ptr)
{
const JSResolvingKey *key = (const JSResolvingKey *)ptr;
return ((JSDHashNumber)JS_PTR_TO_UINT32(key->obj) >> JSVAL_TAGBITS) ^ key->id;
}
JS_PUBLIC_API(JSBool)
resolving_MatchEntry(JSDHashTable *table,
const JSDHashEntryHdr *hdr,
const void *ptr)
{
const JSResolvingEntry *entry = (const JSResolvingEntry *)hdr;
const JSResolvingKey *key = (const JSResolvingKey *)ptr;
return entry->key.obj == key->obj && entry->key.id == key->id;
}
static const JSDHashTableOps resolving_dhash_ops = {
JS_DHashAllocTable,
JS_DHashFreeTable,
resolving_GetKey,
resolving_HashKey,
resolving_MatchEntry,
JS_DHashMoveEntryStub,
JS_DHashClearEntryStub,
JS_DHashFinalizeStub,
NULL
};
JSBool
js_StartResolving(JSContext *cx, JSResolvingKey *key, uint32 flag,
JSResolvingEntry **entryp)
{
JSDHashTable *table;
JSResolvingEntry *entry;
table = cx->resolvingTable;
if (!table) {
table = JS_NewDHashTable(&resolving_dhash_ops, NULL,
sizeof(JSResolvingEntry),
JS_DHASH_MIN_SIZE);
if (!table)
goto outofmem;
cx->resolvingTable = table;
}
entry = (JSResolvingEntry *)
JS_DHashTableOperate(table, key, JS_DHASH_ADD);
if (!entry)
goto outofmem;
if (entry->flags & flag) {
/* An entry for (key, flag) exists already -- dampen recursion. */
entry = NULL;
} else {
/* Fill in key if we were the first to add entry, then set flag. */
if (!entry->key.obj)
entry->key = *key;
entry->flags |= flag;
}
*entryp = entry;
return JS_TRUE;
outofmem:
JS_ReportOutOfMemory(cx);
return JS_FALSE;
}
void
js_StopResolving(JSContext *cx, JSResolvingKey *key, uint32 flag,
JSResolvingEntry *entry, uint32 generation)
{
JSDHashTable *table;
/*
* Clear flag from entry->flags and return early if other flags remain.
* We must take care to re-lookup entry if the table has changed since
* it was found by js_StartResolving.
*/
table = cx->resolvingTable;
if (!entry || table->generation != generation) {
entry = (JSResolvingEntry *)
JS_DHashTableOperate(table, key, JS_DHASH_LOOKUP);
}
JS_ASSERT(JS_DHASH_ENTRY_IS_BUSY(&entry->hdr));
entry->flags &= ~flag;
if (entry->flags)
return;
/*
* Do a raw remove only if fewer entries were removed than would cause
* alpha to be less than .5 (alpha is at most .75). Otherwise, we just
* call JS_DHashTableOperate to re-lookup the key and remove its entry,
* compressing or shrinking the table as needed.
*/
if (table->removedCount < JS_DHASH_TABLE_SIZE(table) >> 2)
JS_DHashTableRawRemove(table, &entry->hdr);
else
JS_DHashTableOperate(table, key, JS_DHASH_REMOVE);
}
JSBool
js_EnterLocalRootScope(JSContext *cx)
{
JSLocalRootStack *lrs;
int mark;
lrs = cx->localRootStack;
if (!lrs) {
lrs = (JSLocalRootStack *) JS_malloc(cx, sizeof *lrs);
if (!lrs)
return JS_FALSE;
lrs->scopeMark = JSLRS_NULL_MARK;
lrs->rootCount = 0;
lrs->topChunk = &lrs->firstChunk;
lrs->firstChunk.down = NULL;
cx->localRootStack = lrs;
}
/* Push lrs->scopeMark to save it for restore when leaving. */
mark = js_PushLocalRoot(cx, lrs, INT_TO_JSVAL(lrs->scopeMark));
if (mark < 0)
return JS_FALSE;
lrs->scopeMark = (uint32) mark;
return JS_TRUE;
}
void
js_LeaveLocalRootScopeWithResult(JSContext *cx, jsval rval)
{
JSLocalRootStack *lrs;
uint32 mark, m, n;
JSLocalRootChunk *lrc;
/* Defend against buggy native callers. */
lrs = cx->localRootStack;
JS_ASSERT(lrs && lrs->rootCount != 0);
if (!lrs || lrs->rootCount == 0)
return;
mark = lrs->scopeMark;
JS_ASSERT(mark != JSLRS_NULL_MARK);
if (mark == JSLRS_NULL_MARK)
return;
/* Free any chunks being popped by this leave operation. */
m = mark >> JSLRS_CHUNK_SHIFT;
n = (lrs->rootCount - 1) >> JSLRS_CHUNK_SHIFT;
while (n > m) {
lrc = lrs->topChunk;
JS_ASSERT(lrc != &lrs->firstChunk);
lrs->topChunk = lrc->down;
JS_free(cx, lrc);
--n;
}
/*
* Pop the scope, restoring lrs->scopeMark. If rval is a GC-thing, push
* it on the caller's scope, or store it in lastInternalResult if we are
* leaving the outermost scope. We don't need to allocate a new lrc
* because we can overwrite the old mark's slot with rval.
*/
lrc = lrs->topChunk;
m = mark & JSLRS_CHUNK_MASK;
lrs->scopeMark = (uint32) JSVAL_TO_INT(lrc->roots[m]);
if (JSVAL_IS_GCTHING(rval) && !JSVAL_IS_NULL(rval)) {
if (mark == 0) {
cx->weakRoots.lastInternalResult = rval;
} else {
/*
* Increment m to avoid the "else if (m == 0)" case below. If
* rval is not a GC-thing, that case would take care of freeing
* any chunk that contained only the old mark. Since rval *is*
* a GC-thing here, we want to reuse that old mark's slot.
*/
lrc->roots[m++] = rval;
++mark;
}
}
lrs->rootCount = (uint32) mark;
/*
* Free the stack eagerly, risking malloc churn. The alternative would
* require an lrs->entryCount member, maintained by Enter and Leave, and
* tested by the GC in addition to the cx->localRootStack non-null test.
*
* That approach would risk hoarding 264 bytes (net) per context. Right
* now it seems better to give fresh (dirty in CPU write-back cache, and
* the data is no longer needed) memory back to the malloc heap.
*/
if (mark == 0) {
cx->localRootStack = NULL;
JS_free(cx, lrs);
} else if (m == 0) {
lrs->topChunk = lrc->down;
JS_free(cx, lrc);
}
}
void
js_ForgetLocalRoot(JSContext *cx, jsval v)
{
JSLocalRootStack *lrs;
uint32 i, j, m, n, mark;
JSLocalRootChunk *lrc, *lrc2;
jsval top;
lrs = cx->localRootStack;
JS_ASSERT(lrs && lrs->rootCount);
if (!lrs || lrs->rootCount == 0)
return;
/* Prepare to pop the top-most value from the stack. */
n = lrs->rootCount - 1;
m = n & JSLRS_CHUNK_MASK;
lrc = lrs->topChunk;
top = lrc->roots[m];
/* Be paranoid about calls on an empty scope. */
mark = lrs->scopeMark;
JS_ASSERT(mark < n);
if (mark >= n)
return;
/* If v was not the last root pushed in the top scope, find it. */
if (top != v) {
/* Search downward in case v was recently pushed. */
i = n;
j = m;
lrc2 = lrc;
while (--i > mark) {
if (j == 0)
lrc2 = lrc2->down;
j = i & JSLRS_CHUNK_MASK;
if (lrc2->roots[j] == v)
break;
}
/* If we didn't find v in this scope, assert and bail out. */
JS_ASSERT(i != mark);
if (i == mark)
return;
/* Swap top and v so common tail code can pop v. */
lrc2->roots[j] = top;
}
/* Pop the last value from the stack. */
lrc->roots[m] = JSVAL_NULL;
lrs->rootCount = n;
if (m == 0) {
JS_ASSERT(n != 0);
JS_ASSERT(lrc != &lrs->firstChunk);
lrs->topChunk = lrc->down;
JS_free(cx, lrc);
}
}
int
js_PushLocalRoot(JSContext *cx, JSLocalRootStack *lrs, jsval v)
{
uint32 n, m;
JSLocalRootChunk *lrc;
n = lrs->rootCount;
m = n & JSLRS_CHUNK_MASK;
if (n == 0 || m != 0) {
/*
* At start of first chunk, or not at start of a non-first top chunk.
* Check for lrs->rootCount overflow.
*/
if ((uint32)(n + 1) == 0) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_TOO_MANY_LOCAL_ROOTS);
return -1;
}
lrc = lrs->topChunk;
JS_ASSERT(n != 0 || lrc == &lrs->firstChunk);
} else {
/*
* After lrs->firstChunk, trying to index at a power-of-two chunk
* boundary: need a new chunk.
*/
lrc = (JSLocalRootChunk *) JS_malloc(cx, sizeof *lrc);
if (!lrc)
return -1;
lrc->down = lrs->topChunk;
lrs->topChunk = lrc;
}
lrs->rootCount = n + 1;
lrc->roots[m] = v;
return (int) n;
}
void
js_MarkLocalRoots(JSContext *cx, JSLocalRootStack *lrs)
{
uint32 n, m, mark;
JSLocalRootChunk *lrc;
n = lrs->rootCount;
if (n == 0)
return;
mark = lrs->scopeMark;
lrc = lrs->topChunk;
do {
while (--n > mark) {
#ifdef GC_MARK_DEBUG
char name[22];
JS_snprintf(name, sizeof name, "<local root %u>", n);
#endif
m = n & JSLRS_CHUNK_MASK;
JS_ASSERT(JSVAL_IS_GCTHING(lrc->roots[m]));
GC_MARK(cx, JSVAL_TO_GCTHING(lrc->roots[m]), name);
if (m == 0)
lrc = lrc->down;
}
m = n & JSLRS_CHUNK_MASK;
mark = JSVAL_TO_INT(lrc->roots[m]);
if (m == 0)
lrc = lrc->down;
} while (n != 0);
JS_ASSERT(!lrc);
}
static void
ReportError(JSContext *cx, const char *message, JSErrorReport *reportp)
{
/*
* Check the error report, and set a JavaScript-catchable exception
* if the error is defined to have an associated exception. If an
* exception is thrown, then the JSREPORT_EXCEPTION flag will be set
* on the error report, and exception-aware hosts should ignore it.
*/
JS_ASSERT(reportp);
if (reportp->errorNumber == JSMSG_UNCAUGHT_EXCEPTION)
reportp->flags |= JSREPORT_EXCEPTION;
/*
* Call the error reporter only if an exception wasn't raised.
*
* If an exception was raised, then we call the debugErrorHook
* (if present) to give it a chance to see the error before it
* propagates out of scope. This is needed for compatability
* with the old scheme.
*/
if (!js_ErrorToException(cx, message, reportp)) {
js_ReportErrorAgain(cx, message, reportp);
} else if (cx->runtime->debugErrorHook && cx->errorReporter) {
JSDebugErrorHook hook = cx->runtime->debugErrorHook;
/* test local in case debugErrorHook changed on another thread */
if (hook)
hook(cx, message, reportp, cx->runtime->debugErrorHookData);
}
}
/*
* We don't post an exception in this case, since doing so runs into
* complications of pre-allocating an exception object which required
* running the Exception class initializer early etc.
* Instead we just invoke the errorReporter with an "Out Of Memory"
* type message, and then hope the process ends swiftly.
*/
void
js_ReportOutOfMemory(JSContext *cx)
{
JSStackFrame *fp;
JSErrorReport report;
JSErrorReporter onError = cx->errorReporter;
/* Get the message for this error, but we won't expand any arguments. */
const JSErrorFormatString *efs =
js_GetLocalizedErrorMessage(cx, NULL, NULL, JSMSG_OUT_OF_MEMORY);
const char *msg = efs ? efs->format : "Out of memory";
/* Fill out the report, but don't do anything that requires allocation. */
memset(&report, 0, sizeof (struct JSErrorReport));
report.flags = JSREPORT_ERROR;
report.errorNumber = JSMSG_OUT_OF_MEMORY;
/*
* Walk stack until we find a frame that is associated with some script
* rather than a native frame.
*/
for (fp = cx->fp; fp; fp = fp->down) {
if (fp->script && fp->pc) {
report.filename = fp->script->filename;
report.lineno = js_PCToLineNumber(cx, fp->script, fp->pc);
break;
}
}
/*
* If debugErrorHook is present then we give it a chance to veto
* sending the error on to the regular ErrorReporter.
*/
if (onError) {
JSDebugErrorHook hook = cx->runtime->debugErrorHook;
if (hook &&
!hook(cx, msg, &report, cx->runtime->debugErrorHookData)) {
onError = NULL;
}
}
if (onError)
onError(cx, msg, &report);
}
JSBool
js_ReportErrorVA(JSContext *cx, uintN flags, const char *format, va_list ap)
{
char *message;
jschar *ucmessage;
size_t messagelen;
JSStackFrame *fp;
JSErrorReport report;
JSBool warning;
if ((flags & JSREPORT_STRICT) && !JS_HAS_STRICT_OPTION(cx))
return JS_TRUE;
message = JS_vsmprintf(format, ap);
if (!message)
return JS_FALSE;
messagelen = strlen(message);
memset(&report, 0, sizeof (struct JSErrorReport));
report.flags = flags;
report.errorNumber = JSMSG_USER_DEFINED_ERROR;
report.ucmessage = ucmessage = js_InflateString(cx, message, &messagelen);
/* Find the top-most active script frame, for best line number blame. */
for (fp = cx->fp; fp; fp = fp->down) {
if (fp->script && fp->pc) {
report.filename = fp->script->filename;
report.lineno = js_PCToLineNumber(cx, fp->script, fp->pc);
break;
}
}
warning = JSREPORT_IS_WARNING(report.flags);
if (warning && JS_HAS_WERROR_OPTION(cx)) {
report.flags &= ~JSREPORT_WARNING;
warning = JS_FALSE;
}
ReportError(cx, message, &report);
free(message);
JS_free(cx, ucmessage);
return warning;
}
/*
* The arguments from ap need to be packaged up into an array and stored
* into the report struct.
*
* The format string addressed by the error number may contain operands
* identified by the format {N}, where N is a decimal digit. Each of these
* is to be replaced by the Nth argument from the va_list. The complete
* message is placed into reportp->ucmessage converted to a JSString.
*
* Returns true if the expansion succeeds (can fail if out of memory).
*/
JSBool
js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
void *userRef, const uintN errorNumber,
char **messagep, JSErrorReport *reportp,
JSBool *warningp, JSBool charArgs, va_list ap)
{
const JSErrorFormatString *efs;
int i;
int argCount;
*warningp = JSREPORT_IS_WARNING(reportp->flags);
if (*warningp && JS_HAS_WERROR_OPTION(cx)) {
reportp->flags &= ~JSREPORT_WARNING;
*warningp = JS_FALSE;
}
*messagep = NULL;
/* Most calls supply js_GetErrorMessage; if this is so, assume NULL. */
if (!callback || callback == js_GetErrorMessage)
efs = js_GetLocalizedErrorMessage(cx, userRef, NULL, errorNumber);
else
efs = callback(userRef, NULL, errorNumber);
if (efs) {
size_t totalArgsLength = 0;
size_t argLengths[10]; /* only {0} thru {9} supported */
argCount = efs->argCount;
JS_ASSERT(argCount <= 10);
if (argCount > 0) {
/*
* Gather the arguments into an array, and accumulate
* their sizes. We allocate 1 more than necessary and
* null it out to act as the caboose when we free the
* pointers later.
*/
reportp->messageArgs = (const jschar **)
JS_malloc(cx, sizeof(jschar *) * (argCount + 1));
if (!reportp->messageArgs)
return JS_FALSE;
reportp->messageArgs[argCount] = NULL;
for (i = 0; i < argCount; i++) {
if (charArgs) {
char *charArg = va_arg(ap, char *);
size_t charArgLength = strlen(charArg);
reportp->messageArgs[i]
= js_InflateString(cx, charArg, &charArgLength);
if (!reportp->messageArgs[i])
goto error;
} else {
reportp->messageArgs[i] = va_arg(ap, jschar *);
}
argLengths[i] = js_strlen(reportp->messageArgs[i]);
totalArgsLength += argLengths[i];
}
/* NULL-terminate for easy copying. */
reportp->messageArgs[i] = NULL;
}
/*
* Parse the error format, substituting the argument X
* for {X} in the format.
*/
if (argCount > 0) {
if (efs->format) {
jschar *buffer, *fmt, *out;
int expandedArgs = 0;
size_t expandedLength;
size_t len = strlen(efs->format);
buffer = fmt = js_InflateString (cx, efs->format, &len);
if (!buffer)
goto error;
expandedLength = len
- (3 * argCount) /* exclude the {n} */
+ totalArgsLength;
/*
* Note - the above calculation assumes that each argument
* is used once and only once in the expansion !!!
*/
reportp->ucmessage = out = (jschar *)
JS_malloc(cx, (expandedLength + 1) * sizeof(jschar));
if (!out) {
JS_free (cx, buffer);
goto error;
}
while (*fmt) {
if (*fmt == '{') {
if (isdigit(fmt[1])) {
int d = JS7_UNDEC(fmt[1]);
JS_ASSERT(d < argCount);
js_strncpy(out, reportp->messageArgs[d],
argLengths[d]);
out += argLengths[d];
fmt += 3;
expandedArgs++;
continue;
}
}
*out++ = *fmt++;
}
JS_ASSERT(expandedArgs == argCount);
*out = 0;
JS_free (cx, buffer);
*messagep =
js_DeflateString(cx, reportp->ucmessage,
(size_t)(out - reportp->ucmessage));
if (!*messagep)
goto error;
}
} else {
/*
* Zero arguments: the format string (if it exists) is the
* entire message.
*/
if (efs->format) {
size_t len;
*messagep = JS_strdup(cx, efs->format);
if (!*messagep)
goto error;
len = strlen(*messagep);
reportp->ucmessage = js_InflateString(cx, *messagep, &len);
if (!reportp->ucmessage)
goto error;
}
}
}
if (*messagep == NULL) {
/* where's the right place for this ??? */
const char *defaultErrorMessage
= "No error message available for error number %d";
size_t nbytes = strlen(defaultErrorMessage) + 16;
*messagep = (char *)JS_malloc(cx, nbytes);
if (!*messagep)
goto error;
JS_snprintf(*messagep, nbytes, defaultErrorMessage, errorNumber);
}
return JS_TRUE;
error:
if (reportp->messageArgs) {
/* free the arguments only if we allocated them */
if (charArgs) {
i = 0;
while (reportp->messageArgs[i])
JS_free(cx, (void *)reportp->messageArgs[i++]);
}
JS_free(cx, (void *)reportp->messageArgs);
reportp->messageArgs = NULL;
}
if (reportp->ucmessage) {
JS_free(cx, (void *)reportp->ucmessage);
reportp->ucmessage = NULL;
}
if (*messagep) {
JS_free(cx, (void *)*messagep);
*messagep = NULL;
}
return JS_FALSE;
}
JSBool
js_ReportErrorNumberVA(JSContext *cx, uintN flags, JSErrorCallback callback,
void *userRef, const uintN errorNumber,
JSBool charArgs, va_list ap)
{
JSStackFrame *fp;
JSErrorReport report;
char *message;
JSBool warning;
if ((flags & JSREPORT_STRICT) && !JS_HAS_STRICT_OPTION(cx))
return JS_TRUE;
memset(&report, 0, sizeof (struct JSErrorReport));
report.flags = flags;
report.errorNumber = errorNumber;
/*
* If we can't find out where the error was based on the current frame,
* see if the next frame has a script/pc combo we can use.
*/
for (fp = cx->fp; fp; fp = fp->down) {
if (fp->script && fp->pc) {
report.filename = fp->script->filename;
report.lineno = js_PCToLineNumber(cx, fp->script, fp->pc);
break;
}
}
if (!js_ExpandErrorArguments(cx, callback, userRef, errorNumber,
&message, &report, &warning, charArgs, ap)) {
return JS_FALSE;
}
ReportError(cx, message, &report);
if (message)
JS_free(cx, message);
if (report.messageArgs) {
/*
* js_ExpandErrorArguments owns its messageArgs only if it had to
* inflate the arguments (from regular |char *|s).
*/
if (charArgs) {
int i = 0;
while (report.messageArgs[i])
JS_free(cx, (void *)report.messageArgs[i++]);
}
JS_free(cx, (void *)report.messageArgs);
}
if (report.ucmessage)
JS_free(cx, (void *)report.ucmessage);
return warning;
}
JS_FRIEND_API(void)
js_ReportErrorAgain(JSContext *cx, const char *message, JSErrorReport *reportp)
{
JSErrorReporter onError;
if (!message)
return;
if (cx->lastMessage)
free(cx->lastMessage);
cx->lastMessage = JS_strdup(cx, message);
if (!cx->lastMessage)
return;
onError = cx->errorReporter;
/*
* If debugErrorHook is present then we give it a chance to veto
* sending the error on to the regular ErrorReporter.
*/
if (onError) {
JSDebugErrorHook hook = cx->runtime->debugErrorHook;
if (hook &&
!hook(cx, cx->lastMessage, reportp,
cx->runtime->debugErrorHookData)) {
onError = NULL;
}
}
if (onError)
onError(cx, cx->lastMessage, reportp);
}
void
js_ReportIsNotDefined(JSContext *cx, const char *name)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NOT_DEFINED, name);
}
#if defined DEBUG && defined XP_UNIX
/* For gdb usage. */
void js_traceon(JSContext *cx) { cx->tracefp = stderr; }
void js_traceoff(JSContext *cx) { cx->tracefp = NULL; }
#endif
JSErrorFormatString js_ErrorFormatString[JSErr_Limit] = {
#define MSG_DEF(name, number, count, exception, format) \
{ format, count, exception } ,
#include "js.msg"
#undef MSG_DEF
};
const JSErrorFormatString *
js_GetErrorMessage(void *userRef, const char *locale, const uintN errorNumber)
{
if ((errorNumber > 0) && (errorNumber < JSErr_Limit))
return &js_ErrorFormatString[errorNumber];
return NULL;
}
| go-lab/smart-device | templates/bbb/node_modules/binaryjs/node_modules/binarypack/node_modules/buffercursor/node_modules/verror/node_modules/extsprintf/deps/javascriptlint/spidermonkey/src/jscntxt.c | C | mit | 37,865 |
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { scheduleMicroTask } from '../facade/lang';
/**
* \@experimental Animation support is experimental.
* @abstract
*/
export var AnimationPlayer = (function () {
function AnimationPlayer() {
}
/**
* @abstract
* @param {?} fn
* @return {?}
*/
AnimationPlayer.prototype.onDone = function (fn) { };
/**
* @abstract
* @param {?} fn
* @return {?}
*/
AnimationPlayer.prototype.onStart = function (fn) { };
/**
* @abstract
* @return {?}
*/
AnimationPlayer.prototype.init = function () { };
/**
* @abstract
* @return {?}
*/
AnimationPlayer.prototype.hasStarted = function () { };
/**
* @abstract
* @return {?}
*/
AnimationPlayer.prototype.play = function () { };
/**
* @abstract
* @return {?}
*/
AnimationPlayer.prototype.pause = function () { };
/**
* @abstract
* @return {?}
*/
AnimationPlayer.prototype.restart = function () { };
/**
* @abstract
* @return {?}
*/
AnimationPlayer.prototype.finish = function () { };
/**
* @abstract
* @return {?}
*/
AnimationPlayer.prototype.destroy = function () { };
/**
* @abstract
* @return {?}
*/
AnimationPlayer.prototype.reset = function () { };
/**
* @abstract
* @param {?} p
* @return {?}
*/
AnimationPlayer.prototype.setPosition = function (p) { };
/**
* @abstract
* @return {?}
*/
AnimationPlayer.prototype.getPosition = function () { };
Object.defineProperty(AnimationPlayer.prototype, "parentPlayer", {
/**
* @return {?}
*/
get: function () { throw new Error('NOT IMPLEMENTED: Base Class'); },
/**
* @param {?} player
* @return {?}
*/
set: function (player) { throw new Error('NOT IMPLEMENTED: Base Class'); },
enumerable: true,
configurable: true
});
return AnimationPlayer;
}());
export var NoOpAnimationPlayer = (function () {
function NoOpAnimationPlayer() {
var _this = this;
this._onDoneFns = [];
this._onStartFns = [];
this._started = false;
this.parentPlayer = null;
scheduleMicroTask(function () { return _this._onFinish(); });
}
/**
* \@internal
* @return {?}
*/
NoOpAnimationPlayer.prototype._onFinish = function () {
this._onDoneFns.forEach(function (fn) { return fn(); });
this._onDoneFns = [];
};
/**
* @param {?} fn
* @return {?}
*/
NoOpAnimationPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); };
/**
* @param {?} fn
* @return {?}
*/
NoOpAnimationPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); };
/**
* @return {?}
*/
NoOpAnimationPlayer.prototype.hasStarted = function () { return this._started; };
/**
* @return {?}
*/
NoOpAnimationPlayer.prototype.init = function () { };
/**
* @return {?}
*/
NoOpAnimationPlayer.prototype.play = function () {
if (!this.hasStarted()) {
this._onStartFns.forEach(function (fn) { return fn(); });
this._onStartFns = [];
}
this._started = true;
};
/**
* @return {?}
*/
NoOpAnimationPlayer.prototype.pause = function () { };
/**
* @return {?}
*/
NoOpAnimationPlayer.prototype.restart = function () { };
/**
* @return {?}
*/
NoOpAnimationPlayer.prototype.finish = function () { this._onFinish(); };
/**
* @return {?}
*/
NoOpAnimationPlayer.prototype.destroy = function () { };
/**
* @return {?}
*/
NoOpAnimationPlayer.prototype.reset = function () { };
/**
* @param {?} p
* @return {?}
*/
NoOpAnimationPlayer.prototype.setPosition = function (p) { };
/**
* @return {?}
*/
NoOpAnimationPlayer.prototype.getPosition = function () { return 0; };
return NoOpAnimationPlayer;
}());
function NoOpAnimationPlayer_tsickle_Closure_declarations() {
/** @type {?} */
NoOpAnimationPlayer.prototype._onDoneFns;
/** @type {?} */
NoOpAnimationPlayer.prototype._onStartFns;
/** @type {?} */
NoOpAnimationPlayer.prototype._started;
/** @type {?} */
NoOpAnimationPlayer.prototype.parentPlayer;
}
//# sourceMappingURL=animation_player.js.map | EgemenErol/angular2 | node_modules/@angular/core/src/animation/animation_player.js | JavaScript | mit | 4,684 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build 386,darwin
package unix
import "syscall"
func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
}
func setTimeval(sec, usec int64) Timeval {
return Timeval{Sec: int32(sec), Usec: int32(usec)}
}
func SetKevent(k *Kevent_t, fd, mode, flags int) {
k.Ident = uint32(fd)
k.Filter = int16(mode)
k.Flags = uint16(flags)
}
func (iov *Iovec) SetLen(length int) {
iov.Len = uint32(length)
}
func (msghdr *Msghdr) SetControllen(length int) {
msghdr.Controllen = uint32(length)
}
func (msghdr *Msghdr) SetIovlen(length int) {
msghdr.Iovlen = int32(length)
}
func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
| oragono/oragono | vendor/golang.org/x/sys/unix/syscall_darwin_386.go | GO | mit | 1,531 |
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){var o=e.state.selectionPointer;(null==t.buttons?t.which:t.buttons)?o.mouseX=o.mouseY=null:(o.mouseX=t.clientX,o.mouseY=t.clientY),i(e)}function o(e,t){if(!e.getWrapperElement().contains(t.relatedTarget)){var o=e.state.selectionPointer;o.mouseX=o.mouseY=null,i(e)}}function n(e){e.state.selectionPointer.rects=null,i(e)}function i(e){e.state.selectionPointer.willUpdate||(e.state.selectionPointer.willUpdate=!0,setTimeout(function(){s(e),e.state.selectionPointer.willUpdate=!1},50))}function s(e){var t=e.state.selectionPointer;if(t){if(null==t.rects&&null!=t.mouseX&&(t.rects=[],e.somethingSelected()))for(var o=e.display.selectionDiv.firstChild;o;o=o.nextSibling)t.rects.push(o.getBoundingClientRect());var n=!1;if(null!=t.mouseX)for(var i=0;i<t.rects.length;i++){var s=t.rects[i];s.left<=t.mouseX&&s.right>=t.mouseX&&s.top<=t.mouseY&&s.bottom>=t.mouseY&&(n=!0)}var l=n?t.value:"";e.display.lineDiv.style.cursor!=l&&(e.display.lineDiv.style.cursor=l)}}e.defineOption("selectionPointer",!1,function(i,s){var l=i.state.selectionPointer;l&&(e.off(i.getWrapperElement(),"mousemove",l.mousemove),e.off(i.getWrapperElement(),"mouseout",l.mouseout),i.off("cursorActivity",n),i.off("scroll",n),i.state.selectionPointer=null,i.display.lineDiv.style.cursor=""),s&&(l=i.state.selectionPointer={value:"string"==typeof s?s:"default",mousemove:function(e){t(i,e)},mouseout:function(e){o(i,e)},rects:null,mouseX:null,mouseY:null,willUpdate:!1},e.on(i.getWrapperElement(),"mousemove",l.mousemove),e.on(i.getWrapperElement(),"mouseout",l.mouseout),i.on("cursorActivity",n),i.on("scroll",n))})}); | aeharding/cdnjs | ajax/libs/codemirror/4.12.0/addon/selection/selection-pointer.min.js | JavaScript | mit | 1,806 |
/*
* /MathJax/config/TeX-AMS_HTML-full.js
*
* Copyright (c) 2010-2015 The MathJax Consortium
*
* Part of the MathJax library.
* See http://www.mathjax.org for details.
*
* Licensed under the Apache License, Version 2.0;
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
MathJax.Ajax.Preloading(
"[MathJax]/jax/input/TeX/config.js",
"[MathJax]/jax/output/HTML-CSS/config.js",
"[MathJax]/jax/output/CommonHTML/config.js",
"[MathJax]/extensions/tex2jax.js",
"[MathJax]/extensions/MathEvents.js",
"[MathJax]/extensions/MathZoom.js",
"[MathJax]/extensions/MathMenu.js",
"[MathJax]/jax/element/mml/jax.js",
"[MathJax]/extensions/toMathML.js",
"[MathJax]/extensions/TeX/noErrors.js",
"[MathJax]/extensions/TeX/noUndefined.js",
"[MathJax]/jax/input/TeX/jax.js",
"[MathJax]/extensions/TeX/AMSmath.js",
"[MathJax]/extensions/TeX/AMSsymbols.js",
"[MathJax]/jax/output/HTML-CSS/jax.js",
"[MathJax]/jax/output/HTML-CSS/autoload/mtable.js",
"[MathJax]/jax/output/CommonHTML/jax.js",
"[MathJax]/extensions/CHTML-preview.js"
);
MathJax.Hub.Config({"v1.0-compatible":false});
MathJax.InputJax.TeX=MathJax.InputJax({id:"TeX",version:"2.5.0",directory:MathJax.InputJax.directory+"/TeX",extensionDir:MathJax.InputJax.extensionDir+"/TeX",config:{TagSide:"right",TagIndent:"0.8em",MultLineWidth:"85%",equationNumbers:{autoNumber:"none",formatNumber:function(a){return a},formatTag:function(a){return"("+a+")"},formatID:function(a){return"mjx-eqn-"+String(a).replace(/[:"'<>&]/g,"")},formatURL:function(a){return"#"+escape(a)},useLabelIds:true}}});MathJax.InputJax.TeX.Register("math/tex");MathJax.InputJax.TeX.loadComplete("config.js");
MathJax.OutputJax["HTML-CSS"]=MathJax.OutputJax({id:"HTML-CSS",version:"2.5.0",directory:MathJax.OutputJax.directory+"/HTML-CSS",extensionDir:MathJax.OutputJax.extensionDir+"/HTML-CSS",autoloadDir:MathJax.OutputJax.directory+"/HTML-CSS/autoload",fontDir:MathJax.OutputJax.directory+"/HTML-CSS/fonts",webfontDir:MathJax.OutputJax.fontDir+"/HTML-CSS",config:{noReflows:true,matchFontHeight:true,scale:100,minScaleAdjust:50,availableFonts:["STIX","TeX"],preferredFont:"TeX",webFont:"TeX",imageFont:"TeX",undefinedFamily:"STIXGeneral,'Arial Unicode MS',serif",mtextFontInherit:false,EqnChunk:(MathJax.Hub.Browser.isMobile?10:50),EqnChunkFactor:1.5,EqnChunkDelay:100,linebreaks:{automatic:false,width:"container"},styles:{".MathJax_Display":{"text-align":"center",margin:"1em 0em"},".MathJax .merror":{"background-color":"#FFFF88",color:"#CC0000",border:"1px solid #CC0000",padding:"1px 3px","font-style":"normal","font-size":"90%"},".MathJax .MJX-monospace":{"font-family":"monospace"},".MathJax .MJX-sans-serif":{"font-family":"sans-serif"},"#MathJax_Tooltip":{"background-color":"InfoBackground",color:"InfoText",border:"1px solid black","box-shadow":"2px 2px 5px #AAAAAA","-webkit-box-shadow":"2px 2px 5px #AAAAAA","-moz-box-shadow":"2px 2px 5px #AAAAAA","-khtml-box-shadow":"2px 2px 5px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')",padding:"3px 4px","z-index":401}}}});if(MathJax.Hub.Browser.isMSIE&&document.documentMode>=9){delete MathJax.OutputJax["HTML-CSS"].config.styles["#MathJax_Tooltip"].filter}if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax["HTML-CSS"].Register("jax/mml")}MathJax.Hub.Register.StartupHook("End Config",[function(b,c){var a=b.Insert({minBrowserVersion:{Firefox:3,Opera:9.52,MSIE:6,Chrome:0.3,Safari:2,Konqueror:4},inlineMathDelimiters:["$","$"],displayMathDelimiters:["$$","$$"],multilineDisplay:true,minBrowserTranslate:function(f){var e=b.getJaxFor(f),k=["[Math]"],j;var h=document.createElement("span",{className:"MathJax_Preview"});if(e.inputJax==="TeX"){if(e.root.Get("displaystyle")){j=a.displayMathDelimiters;k=[j[0]+e.originalText+j[1]];if(a.multilineDisplay){k=k[0].split(/\n/)}}else{j=a.inlineMathDelimiters;k=[j[0]+e.originalText.replace(/^\s+/,"").replace(/\s+$/,"")+j[1]]}}for(var g=0,d=k.length;g<d;g++){h.appendChild(document.createTextNode(k[g]));if(g<d-1){h.appendChild(document.createElement("br"))}}f.parentNode.insertBefore(h,f)}},(b.config["HTML-CSS"]||{}));if(b.Browser.version!=="0.0"&&!b.Browser.versionAtLeast(a.minBrowserVersion[b.Browser]||0)){c.Translate=a.minBrowserTranslate;b.Config({showProcessingMessages:false});MathJax.Message.Set(["MathJaxNotSupported","Your browser does not support MathJax"],null,4000);b.Startup.signal.Post("MathJax not supported")}},MathJax.Hub,MathJax.OutputJax["HTML-CSS"]]);MathJax.OutputJax["HTML-CSS"].loadComplete("config.js");
MathJax.OutputJax.CommonHTML=MathJax.OutputJax({id:"CommonHTML",version:"2.5.0",directory:MathJax.OutputJax.directory+"/CommonHTML",extensionDir:MathJax.OutputJax.extensionDir+"/CommonHTML",config:{scale:100,minScaleAdjust:50,mtextFontInherit:false,linebreaks:{automatic:false,width:"container"}}});if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax.CommonHTML.Register("jax/mml")}MathJax.OutputJax.CommonHTML.loadComplete("config.js");
MathJax.Extension.tex2jax={version:"2.5.0",config:{inlineMath:[["\\(","\\)"]],displayMath:[["$$","$$"],["\\[","\\]"]],balanceBraces:true,skipTags:["script","noscript","style","textarea","pre","code","annotation","annotation-xml"],ignoreClass:"tex2jax_ignore",processClass:"tex2jax_process",processEscapes:false,processEnvironments:true,processRefs:true,preview:"TeX"},PreProcess:function(a){if(!this.configured){this.config=MathJax.Hub.CombineConfig("tex2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}if(typeof(this.config.previewTeX)!=="undefined"&&!this.config.previewTeX){this.config.preview="none"}this.configured=true}if(typeof(a)==="string"){a=document.getElementById(a)}if(!a){a=document.body}if(this.createPatterns()){this.scanElement(a,a.nextSibling)}},createPatterns:function(){var d=[],e=[],c,a,b=this.config;this.match={};for(c=0,a=b.inlineMath.length;c<a;c++){d.push(this.patternQuote(b.inlineMath[c][0]));this.match[b.inlineMath[c][0]]={mode:"",end:b.inlineMath[c][1],pattern:this.endPattern(b.inlineMath[c][1])}}for(c=0,a=b.displayMath.length;c<a;c++){d.push(this.patternQuote(b.displayMath[c][0]));this.match[b.displayMath[c][0]]={mode:"; mode=display",end:b.displayMath[c][1],pattern:this.endPattern(b.displayMath[c][1])}}if(d.length){e.push(d.sort(this.sortLength).join("|"))}if(b.processEnvironments){e.push("\\\\begin\\{([^}]*)\\}")}if(b.processEscapes){e.push("\\\\*\\\\\\$")}if(b.processRefs){e.push("\\\\(eq)?ref\\{[^}]*\\}")}this.start=new RegExp(e.join("|"),"g");this.skipTags=new RegExp("^("+b.skipTags.join("|")+")$","i");var f=[];if(MathJax.Hub.config.preRemoveClass){f.push(MathJax.Hub.config.preRemoveClass)}if(b.ignoreClass){f.push(b.ignoreClass)}this.ignoreClass=(f.length?new RegExp("(^| )("+f.join("|")+")( |$)"):/^$/);this.processClass=new RegExp("(^| )("+b.processClass+")( |$)");return(e.length>0)},patternQuote:function(a){return a.replace(/([\^$(){}+*?\-|\[\]\:\\])/g,"\\$1")},endPattern:function(a){return new RegExp(this.patternQuote(a)+"|\\\\.|[{}]","g")},sortLength:function(d,c){if(d.length!==c.length){return c.length-d.length}return(d==c?0:(d<c?-1:1))},scanElement:function(c,b,g){var a,e,d,f;while(c&&c!=b){if(c.nodeName.toLowerCase()==="#text"){if(!g){c=this.scanText(c)}}else{a=(typeof(c.className)==="undefined"?"":c.className);e=(typeof(c.tagName)==="undefined"?"":c.tagName);if(typeof(a)!=="string"){a=String(a)}f=this.processClass.exec(a);if(c.firstChild&&!a.match(/(^| )MathJax/)&&(f||!this.skipTags.exec(e))){d=(g||this.ignoreClass.exec(a))&&!f;this.scanElement(c.firstChild,b,d)}}if(c){c=c.nextSibling}}},scanText:function(b){if(b.nodeValue.replace(/\s+/,"")==""){return b}var a,c;this.search={start:true};this.pattern=this.start;while(b){this.pattern.lastIndex=0;while(b&&b.nodeName.toLowerCase()==="#text"&&(a=this.pattern.exec(b.nodeValue))){if(this.search.start){b=this.startMatch(a,b)}else{b=this.endMatch(a,b)}}if(this.search.matched){b=this.encloseMath(b)}if(b){do{c=b;b=b.nextSibling}while(b&&(b.nodeName.toLowerCase()==="br"||b.nodeName.toLowerCase()==="#comment"));if(!b||b.nodeName!=="#text"){return(this.search.close?this.prevEndMatch():c)}}}return b},startMatch:function(a,b){var f=this.match[a[0]];if(f!=null){this.search={end:f.end,mode:f.mode,pcount:0,open:b,olen:a[0].length,opos:this.pattern.lastIndex-a[0].length};this.switchPattern(f.pattern)}else{if(a[0].substr(0,6)==="\\begin"){this.search={end:"\\end{"+a[1]+"}",mode:"; mode=display",pcount:0,open:b,olen:0,opos:this.pattern.lastIndex-a[0].length,isBeginEnd:true};this.switchPattern(this.endPattern(this.search.end))}else{if(a[0].substr(0,4)==="\\ref"||a[0].substr(0,6)==="\\eqref"){this.search={mode:"",end:"",open:b,pcount:0,olen:0,opos:this.pattern.lastIndex-a[0].length};return this.endMatch([""],b)}else{var d=a[0].substr(0,a[0].length-1),g,c;if(d.length%2===0){c=[d.replace(/\\\\/g,"\\")];g=1}else{c=[d.substr(1).replace(/\\\\/g,"\\"),"$"];g=0}c=MathJax.HTML.Element("span",null,c);var e=MathJax.HTML.TextNode(b.nodeValue.substr(0,a.index));b.nodeValue=b.nodeValue.substr(a.index+a[0].length-g);b.parentNode.insertBefore(c,b);b.parentNode.insertBefore(e,c);this.pattern.lastIndex=g}}}return b},endMatch:function(a,c){var b=this.search;if(a[0]==b.end){if(!b.close||b.pcount===0){b.close=c;b.cpos=this.pattern.lastIndex;b.clen=(b.isBeginEnd?0:a[0].length)}if(b.pcount===0){b.matched=true;c=this.encloseMath(c);this.switchPattern(this.start)}}else{if(a[0]==="{"){b.pcount++}else{if(a[0]==="}"&&b.pcount){b.pcount--}}}return c},prevEndMatch:function(){this.search.matched=true;var a=this.encloseMath(this.search.close);this.switchPattern(this.start);return a},switchPattern:function(a){a.lastIndex=this.pattern.lastIndex;this.pattern=a;this.search.start=(a===this.start)},encloseMath:function(b){var a=this.search,f=a.close,e,c;if(a.cpos===f.length){f=f.nextSibling}else{f=f.splitText(a.cpos)}if(!f){e=f=MathJax.HTML.addText(a.close.parentNode,"")}a.close=f;c=(a.opos?a.open.splitText(a.opos):a.open);while(c.nextSibling&&c.nextSibling!==f){if(c.nextSibling.nodeValue!==null){if(c.nextSibling.nodeName==="#comment"){c.nodeValue+=c.nextSibling.nodeValue.replace(/^\[CDATA\[((.|\n|\r)*)\]\]$/,"$1")}else{c.nodeValue+=c.nextSibling.nodeValue}}else{if(this.msieNewlineBug){c.nodeValue+=(c.nextSibling.nodeName.toLowerCase()==="br"?"\n":" ")}else{c.nodeValue+=" "}}c.parentNode.removeChild(c.nextSibling)}var d=c.nodeValue.substr(a.olen,c.nodeValue.length-a.olen-a.clen);c.parentNode.removeChild(c);if(this.config.preview!=="none"){this.createPreview(a.mode,d)}c=this.createMathTag(a.mode,d);this.search={};this.pattern.lastIndex=0;if(e){e.parentNode.removeChild(e)}return c},insertNode:function(b){var a=this.search;a.close.parentNode.insertBefore(b,a.close)},createPreview:function(c,a){var b=this.config.preview;if(b==="none"){return}if(b==="TeX"){b=[this.filterPreview(a)]}if(b){b=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},b);this.insertNode(b)}},createMathTag:function(c,b){var a=document.createElement("script");a.type="math/tex"+c;MathJax.HTML.setScript(a,b);this.insertNode(a);return a},filterPreview:function(a){return a},msieNewlineBug:(MathJax.Hub.Browser.isMSIE&&document.documentMode<9)};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.tex2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/tex2jax.js");
(function(d,h,l,g,m,b,j){var q="2.5.0";var i=MathJax.Extension;var c=i.MathEvents={version:q};var k=d.config.menuSettings;var p={hover:500,frame:{x:3.5,y:5,bwidth:1,bcolor:"#A6D",hwidth:"15px",hcolor:"#83A"},button:{x:-4,y:-3,wx:-2,src:l.urlRev(b.imageDir+"/MenuArrow-15.png")},fadeinInc:0.2,fadeoutInc:0.05,fadeDelay:50,fadeoutStart:400,fadeoutDelay:15*1000,styles:{".MathJax_Hover_Frame":{"border-radius":".25em","-webkit-border-radius":".25em","-moz-border-radius":".25em","-khtml-border-radius":".25em","box-shadow":"0px 0px 15px #83A","-webkit-box-shadow":"0px 0px 15px #83A","-moz-box-shadow":"0px 0px 15px #83A","-khtml-box-shadow":"0px 0px 15px #83A",border:"1px solid #A6D ! important",display:"inline-block",position:"absolute"},".MathJax_Hover_Arrow":{position:"absolute",width:"15px",height:"11px",cursor:"pointer"}}};var n=c.Event={LEFTBUTTON:0,RIGHTBUTTON:2,MENUKEY:"altKey",Mousedown:function(r){return n.Handler(r,"Mousedown",this)},Mouseup:function(r){return n.Handler(r,"Mouseup",this)},Mousemove:function(r){return n.Handler(r,"Mousemove",this)},Mouseover:function(r){return n.Handler(r,"Mouseover",this)},Mouseout:function(r){return n.Handler(r,"Mouseout",this)},Click:function(r){return n.Handler(r,"Click",this)},DblClick:function(r){return n.Handler(r,"DblClick",this)},Menu:function(r){return n.Handler(r,"ContextMenu",this)},Handler:function(u,s,t){if(l.loadingMathMenu){return n.False(u)}var r=b[t.jaxID];if(!u){u=window.event}u.isContextMenu=(s==="ContextMenu");if(r[s]){return r[s](u,t)}if(i.MathZoom){return i.MathZoom.HandleEvent(u,s,t)}},False:function(r){if(!r){r=window.event}if(r){if(r.preventDefault){r.preventDefault()}else{r.returnValue=false}if(r.stopPropagation){r.stopPropagation()}r.cancelBubble=true}return false},ContextMenu:function(u,F,x){var C=b[F.jaxID],w=C.getJaxFromMath(F);var G=(C.config.showMathMenu!=null?C:d).config.showMathMenu;if(!G||(k.context!=="MathJax"&&!x)){return}if(c.msieEventBug){u=window.event||u}n.ClearSelection();f.ClearHoverTimer();if(w.hover){if(w.hover.remove){clearTimeout(w.hover.remove);delete w.hover.remove}w.hover.nofade=true}var v=MathJax.Menu;var H,E;if(v){if(v.loadingDomain){return n.False(u)}H=m.loadDomain("MathMenu");if(!H){v.jax=w;var s=v.menu.Find("Show Math As").menu;s.items[0].name=w.sourceMenuTitle;s.items[0].format=(w.sourceMenuFormat||"MathML");s.items[1].name=j[w.inputJax].sourceMenuTitle;s.items[5].disabled=!j[w.inputJax].annotationEncoding;var B=s.items[2];B.disabled=true;var r=B.menu.items;annotationList=MathJax.Hub.Config.semanticsAnnotations;for(var A=0,z=r.length;A<z;A++){var t=r[A].name[1];if(w.root&&w.root.getAnnotation(t)!==null){B.disabled=false;r[A].hidden=false}else{r[A].hidden=true}}var y=v.menu.Find("Math Settings","MathPlayer");y.hidden=!(w.outputJax==="NativeMML"&&d.Browser.hasMathPlayer);return v.menu.Post(u)}v.loadingDomain=true;E=function(){delete v.loadingDomain}}else{if(l.loadingMathMenu){return n.False(u)}l.loadingMathMenu=true;H=l.Require("[MathJax]/extensions/MathMenu.js");E=function(){delete l.loadingMathMenu;if(!MathJax.Menu){MathJax.Menu={}}}}var D={pageX:u.pageX,pageY:u.pageY,clientX:u.clientX,clientY:u.clientY};g.Queue(H,E,["ContextMenu",n,D,F,x]);return n.False(u)},AltContextMenu:function(t,s){var u=b[s.jaxID];var r=(u.config.showMathMenu!=null?u:d).config.showMathMenu;if(r){r=(u.config.showMathMenuMSIE!=null?u:d).config.showMathMenuMSIE;if(k.context==="MathJax"&&!k.mpContext&&r){if(!c.noContextMenuBug||t.button!==n.RIGHTBUTTON){return}}else{if(!t[n.MENUKEY]||t.button!==n.LEFTBUTTON){return}}return u.ContextMenu(t,s,true)}},ClearSelection:function(){if(c.safariContextMenuBug){setTimeout("window.getSelection().empty()",0)}if(document.selection){setTimeout("document.selection.empty()",0)}},getBBox:function(t){t.appendChild(c.topImg);var s=c.topImg.offsetTop,u=t.offsetHeight-s,r=t.offsetWidth;t.removeChild(c.topImg);return{w:r,h:s,d:u}}};var f=c.Hover={Mouseover:function(t,s){if(k.discoverable||k.zoom==="Hover"){var v=t.fromElement||t.relatedTarget,u=t.toElement||t.target;if(v&&u&&(v.isMathJax!=u.isMathJax||d.getJaxFor(v)!==d.getJaxFor(u))){var r=this.getJaxFromMath(s);if(r.hover){f.ReHover(r)}else{f.HoverTimer(r,s)}return n.False(t)}}},Mouseout:function(t,s){if(k.discoverable||k.zoom==="Hover"){var v=t.fromElement||t.relatedTarget,u=t.toElement||t.target;if(v&&u&&(v.isMathJax!=u.isMathJax||d.getJaxFor(v)!==d.getJaxFor(u))){var r=this.getJaxFromMath(s);if(r.hover){f.UnHover(r)}else{f.ClearHoverTimer()}return n.False(t)}}},Mousemove:function(t,s){if(k.discoverable||k.zoom==="Hover"){var r=this.getJaxFromMath(s);if(r.hover){return}if(f.lastX==t.clientX&&f.lastY==t.clientY){return}f.lastX=t.clientX;f.lastY=t.clientY;f.HoverTimer(r,s);return n.False(t)}},HoverTimer:function(r,s){this.ClearHoverTimer();this.hoverTimer=setTimeout(g(["Hover",this,r,s]),p.hover)},ClearHoverTimer:function(){if(this.hoverTimer){clearTimeout(this.hoverTimer);delete this.hoverTimer}},Hover:function(r,v){if(i.MathZoom&&i.MathZoom.Hover({},v)){return}var u=b[r.outputJax],w=u.getHoverSpan(r,v),z=u.getHoverBBox(r,w,v),x=(u.config.showMathMenu!=null?u:d).config.showMathMenu;var B=p.frame.x,A=p.frame.y,y=p.frame.bwidth;if(c.msieBorderWidthBug){y=0}r.hover={opacity:0,id:r.inputID+"-Hover"};var s=h.Element("span",{id:r.hover.id,isMathJax:true,style:{display:"inline-block",width:0,height:0,position:"relative"}},[["span",{className:"MathJax_Hover_Frame",isMathJax:true,style:{display:"inline-block",position:"absolute",top:this.Px(-z.h-A-y-(z.y||0)),left:this.Px(-B-y+(z.x||0)),width:this.Px(z.w+2*B),height:this.Px(z.h+z.d+2*A),opacity:0,filter:"alpha(opacity=0)"}}]]);var t=h.Element("span",{isMathJax:true,id:r.hover.id+"Menu",style:{display:"inline-block","z-index":1,width:0,height:0,position:"relative"}},[["img",{className:"MathJax_Hover_Arrow",isMathJax:true,math:v,src:p.button.src,onclick:this.HoverMenu,jax:u.id,style:{left:this.Px(z.w+B+y+(z.x||0)+p.button.x),top:this.Px(-z.h-A-y-(z.y||0)-p.button.y),opacity:0,filter:"alpha(opacity=0)"}}]]);if(z.width){s.style.width=t.style.width=z.width;s.style.marginRight=t.style.marginRight="-"+z.width;s.firstChild.style.width=z.width;t.firstChild.style.left="";t.firstChild.style.right=this.Px(p.button.wx)}w.parentNode.insertBefore(s,w);if(x){w.parentNode.insertBefore(t,w)}if(w.style){w.style.position="relative"}this.ReHover(r)},ReHover:function(r){if(r.hover.remove){clearTimeout(r.hover.remove)}r.hover.remove=setTimeout(g(["UnHover",this,r]),p.fadeoutDelay);this.HoverFadeTimer(r,p.fadeinInc)},UnHover:function(r){if(!r.hover.nofade){this.HoverFadeTimer(r,-p.fadeoutInc,p.fadeoutStart)}},HoverFade:function(r){delete r.hover.timer;r.hover.opacity=Math.max(0,Math.min(1,r.hover.opacity+r.hover.inc));r.hover.opacity=Math.floor(1000*r.hover.opacity)/1000;var t=document.getElementById(r.hover.id),s=document.getElementById(r.hover.id+"Menu");t.firstChild.style.opacity=r.hover.opacity;t.firstChild.style.filter="alpha(opacity="+Math.floor(100*r.hover.opacity)+")";if(s){s.firstChild.style.opacity=r.hover.opacity;s.firstChild.style.filter=t.style.filter}if(r.hover.opacity===1){return}if(r.hover.opacity>0){this.HoverFadeTimer(r,r.hover.inc);return}t.parentNode.removeChild(t);if(s){s.parentNode.removeChild(s)}if(r.hover.remove){clearTimeout(r.hover.remove)}delete r.hover},HoverFadeTimer:function(r,t,s){r.hover.inc=t;if(!r.hover.timer){r.hover.timer=setTimeout(g(["HoverFade",this,r]),(s||p.fadeDelay))}},HoverMenu:function(r){if(!r){r=window.event}return b[this.jax].ContextMenu(r,this.math,true)},ClearHover:function(r){if(r.hover.remove){clearTimeout(r.hover.remove)}if(r.hover.timer){clearTimeout(r.hover.timer)}f.ClearHoverTimer();delete r.hover},Px:function(r){if(Math.abs(r)<0.006){return"0px"}return r.toFixed(2).replace(/\.?0+$/,"")+"px"},getImages:function(){if(k.discoverable){var r=new Image();r.src=p.button.src}}};var a=c.Touch={last:0,delay:500,start:function(s){var r=new Date().getTime();var t=(r-a.last<a.delay&&a.up);a.last=r;a.up=false;if(t){a.timeout=setTimeout(a.menu,a.delay,s,this);s.preventDefault()}},end:function(s){var r=new Date().getTime();a.up=(r-a.last<a.delay);if(a.timeout){clearTimeout(a.timeout);delete a.timeout;a.last=0;a.up=false;s.preventDefault();return n.Handler((s.touches[0]||s.touch),"DblClick",this)}},menu:function(s,r){delete a.timeout;a.last=0;a.up=false;return n.Handler((s.touches[0]||s.touch),"ContextMenu",r)}};if(d.Browser.isMobile){var o=p.styles[".MathJax_Hover_Arrow"];o.width="25px";o.height="18px";p.button.x=-6}d.Browser.Select({MSIE:function(r){var t=(document.documentMode||0);var s=r.versionAtLeast("8.0");c.msieBorderWidthBug=(document.compatMode==="BackCompat");c.msieEventBug=r.isIE9;c.msieAlignBug=(!s||t<8);if(t<9){n.LEFTBUTTON=1}},Safari:function(r){c.safariContextMenuBug=true},Opera:function(r){c.operaPositionBug=true},Konqueror:function(r){c.noContextMenuBug=true}});c.topImg=(c.msieAlignBug?h.Element("img",{style:{width:0,height:0,position:"relative"},src:"about:blank"}):h.Element("span",{style:{width:0,height:0,display:"inline-block"}}));if(c.operaPositionBug){c.topImg.style.border="1px solid"}c.config=p=d.CombineConfig("MathEvents",p);var e=function(){var r=p.styles[".MathJax_Hover_Frame"];r.border=p.frame.bwidth+"px solid "+p.frame.bcolor+" ! important";r["box-shadow"]=r["-webkit-box-shadow"]=r["-moz-box-shadow"]=r["-khtml-box-shadow"]="0px 0px "+p.frame.hwidth+" "+p.frame.hcolor};g.Queue(d.Register.StartupHook("End Config",{}),[e],["getImages",f],["Styles",l,p.styles],["Post",d.Startup.signal,"MathEvents Ready"],["loadComplete",l,"[MathJax]/extensions/MathEvents.js"])})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.Callback,MathJax.Localization,MathJax.OutputJax,MathJax.InputJax);
(function(a,d,f,c,j){var k="2.5.0";var i=a.CombineConfig("MathZoom",{styles:{"#MathJax_Zoom":{position:"absolute","background-color":"#F0F0F0",overflow:"auto",display:"block","z-index":301,padding:".5em",border:"1px solid black",margin:0,"font-weight":"normal","font-style":"normal","text-align":"left","text-indent":0,"text-transform":"none","line-height":"normal","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none","box-shadow":"5px 5px 15px #AAAAAA","-webkit-box-shadow":"5px 5px 15px #AAAAAA","-moz-box-shadow":"5px 5px 15px #AAAAAA","-khtml-box-shadow":"5px 5px 15px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')"},"#MathJax_ZoomOverlay":{position:"absolute",left:0,top:0,"z-index":300,display:"inline-block",width:"100%",height:"100%",border:0,padding:0,margin:0,"background-color":"white",opacity:0,filter:"alpha(opacity=0)"},"#MathJax_ZoomFrame":{position:"relative",display:"inline-block",height:0,width:0},"#MathJax_ZoomEventTrap":{position:"absolute",left:0,top:0,"z-index":302,display:"inline-block",border:0,padding:0,margin:0,"background-color":"white",opacity:0,filter:"alpha(opacity=0)"}}});var e,b,g;MathJax.Hub.Register.StartupHook("MathEvents Ready",function(){g=MathJax.Extension.MathEvents.Event;e=MathJax.Extension.MathEvents.Event.False;b=MathJax.Extension.MathEvents.Hover});var h=MathJax.Extension.MathZoom={version:k,settings:a.config.menuSettings,scrollSize:18,HandleEvent:function(n,l,m){if(h.settings.CTRL&&!n.ctrlKey){return true}if(h.settings.ALT&&!n.altKey){return true}if(h.settings.CMD&&!n.metaKey){return true}if(h.settings.Shift&&!n.shiftKey){return true}if(!h[l]){return true}return h[l](n,m)},Click:function(m,l){if(this.settings.zoom==="Click"){return this.Zoom(m,l)}},DblClick:function(m,l){if(this.settings.zoom==="Double-Click"||this.settings.zoom==="DoubleClick"){return this.Zoom(m,l)}},Hover:function(m,l){if(this.settings.zoom==="Hover"){this.Zoom(m,l);return true}return false},Zoom:function(o,u){this.Remove();b.ClearHoverTimer();g.ClearSelection();var s=MathJax.OutputJax[u.jaxID];var p=s.getJaxFromMath(u);if(p.hover){b.UnHover(p)}var q=this.findContainer(u);var l=Math.floor(0.85*q.clientWidth),t=Math.max(document.body.clientHeight,document.documentElement.clientHeight);if(this.getOverflow(q)!=="visible"){t=Math.min(q.clientHeight,t)}t=Math.floor(0.85*t);var n=d.Element("span",{id:"MathJax_ZoomFrame"},[["span",{id:"MathJax_ZoomOverlay",onmousedown:this.Remove}],["span",{id:"MathJax_Zoom",onclick:this.Remove,style:{visibility:"hidden",fontSize:this.settings.zscale}},[["span",{style:{display:"inline-block","white-space":"nowrap"}}]]]]);var z=n.lastChild,w=z.firstChild,r=n.firstChild;u.parentNode.insertBefore(n,u);u.parentNode.insertBefore(u,n);if(w.addEventListener){w.addEventListener("mousedown",this.Remove,true)}var m=z.offsetWidth||z.clientWidth;l-=m;t-=m;z.style.maxWidth=l+"px";z.style.maxHeight=t+"px";if(this.msieTrapEventBug){var y=d.Element("span",{id:"MathJax_ZoomEventTrap",onmousedown:this.Remove});n.insertBefore(y,z)}if(this.msieZIndexBug){var v=d.addElement(document.body,"img",{src:"about:blank",id:"MathJax_ZoomTracker",width:0,height:0,style:{width:0,height:0,position:"relative"}});n.style.position="relative";n.style.zIndex=i.styles["#MathJax_ZoomOverlay"]["z-index"];n=v}var x=s.Zoom(p,w,u,l,t);if(this.msiePositionBug){if(this.msieSizeBug){z.style.height=x.zH+"px";z.style.width=x.zW+"px"}if(z.offsetHeight>t){z.style.height=t+"px";z.style.width=(x.zW+this.scrollSize)+"px"}if(z.offsetWidth>l){z.style.width=l+"px";z.style.height=(x.zH+this.scrollSize)+"px"}}if(this.operaPositionBug){z.style.width=Math.min(l,x.zW)+"px"}if(z.offsetWidth>m&&z.offsetWidth-m<l&&z.offsetHeight-m<t){z.style.overflow="visible"}this.Position(z,x);if(this.msieTrapEventBug){y.style.height=z.clientHeight+"px";y.style.width=z.clientWidth+"px";y.style.left=(parseFloat(z.style.left)+z.clientLeft)+"px";y.style.top=(parseFloat(z.style.top)+z.clientTop)+"px"}z.style.visibility="";if(this.settings.zoom==="Hover"){r.onmouseover=this.Remove}if(window.addEventListener){addEventListener("resize",this.Resize,false)}else{if(window.attachEvent){attachEvent("onresize",this.Resize)}else{this.onresize=window.onresize;window.onresize=this.Resize}}a.signal.Post(["math zoomed",p]);return e(o)},Position:function(p,r){p.style.display="none";var q=this.Resize(),m=q.x,s=q.y,l=r.mW;p.style.display="";var o=-l-Math.floor((p.offsetWidth-l)/2),n=r.Y;p.style.left=Math.max(o,10-m)+"px";p.style.top=Math.max(n,10-s)+"px";if(!h.msiePositionBug){h.SetWH()}},Resize:function(m){if(h.onresize){h.onresize(m)}var q=document.getElementById("MathJax_ZoomFrame"),l=document.getElementById("MathJax_ZoomOverlay");var o=h.getXY(q),n=h.findContainer(q);if(h.getOverflow(n)!=="visible"){l.scroll_parent=n;var p=h.getXY(n);o.x-=p.x;o.y-=p.y;p=h.getBorder(n);o.x-=p.x;o.y-=p.y}l.style.left=(-o.x)+"px";l.style.top=(-o.y)+"px";if(h.msiePositionBug){setTimeout(h.SetWH,0)}else{h.SetWH()}return o},SetWH:function(){var l=document.getElementById("MathJax_ZoomOverlay");if(!l){return}l.style.display="none";var m=l.scroll_parent||document.documentElement||document.body;l.style.width=m.scrollWidth+"px";l.style.height=Math.max(m.clientHeight,m.scrollHeight)+"px";l.style.display=""},findContainer:function(l){l=l.parentNode;while(l.parentNode&&l!==document.body&&h.getOverflow(l)==="visible"){l=l.parentNode}return l},getOverflow:(window.getComputedStyle?function(l){return getComputedStyle(l).overflow}:function(l){return(l.currentStyle||{overflow:"visible"}).overflow}),getBorder:function(o){var m={thin:1,medium:2,thick:3};var n=(window.getComputedStyle?getComputedStyle(o):(o.currentStyle||{borderLeftWidth:0,borderTopWidth:0}));var l=n.borderLeftWidth,p=n.borderTopWidth;if(m[l]){l=m[l]}else{l=parseInt(l)}if(m[p]){p=m[p]}else{p=parseInt(p)}return{x:l,y:p}},getXY:function(o){var l=0,n=0,m;m=o;while(m.offsetParent){l+=m.offsetLeft;m=m.offsetParent}if(h.operaPositionBug){o.style.border="1px solid"}m=o;while(m.offsetParent){n+=m.offsetTop;m=m.offsetParent}if(h.operaPositionBug){o.style.border=""}return{x:l,y:n}},Remove:function(n){var p=document.getElementById("MathJax_ZoomFrame");if(p){var o=MathJax.OutputJax[p.previousSibling.jaxID];var l=o.getJaxFromMath(p.previousSibling);a.signal.Post(["math unzoomed",l]);p.parentNode.removeChild(p);p=document.getElementById("MathJax_ZoomTracker");if(p){p.parentNode.removeChild(p)}if(h.operaRefreshBug){var m=d.addElement(document.body,"div",{style:{position:"fixed",left:0,top:0,width:"100%",height:"100%",backgroundColor:"white",opacity:0},id:"MathJax_OperaDiv"});document.body.removeChild(m)}if(window.removeEventListener){removeEventListener("resize",h.Resize,false)}else{if(window.detachEvent){detachEvent("onresize",h.Resize)}else{window.onresize=h.onresize;delete h.onresize}}}return e(n)}};a.Browser.Select({MSIE:function(l){var n=(document.documentMode||0);var m=(n>=9);h.msiePositionBug=!m;h.msieSizeBug=l.versionAtLeast("7.0")&&(!document.documentMode||n===7||n===8);h.msieZIndexBug=(n<=7);h.msieInlineBlockAlignBug=(n<=7);h.msieTrapEventBug=!window.addEventListener;if(document.compatMode==="BackCompat"){h.scrollSize=52}if(m){delete i.styles["#MathJax_Zoom"].filter}},Opera:function(l){h.operaPositionBug=true;h.operaRefreshBug=true}});h.topImg=(h.msieInlineBlockAlignBug?d.Element("img",{style:{width:0,height:0,position:"relative"},src:"about:blank"}):d.Element("span",{style:{width:0,height:0,display:"inline-block"}}));if(h.operaPositionBug||h.msieTopBug){h.topImg.style.border="1px solid"}MathJax.Callback.Queue(["StartupHook",MathJax.Hub.Register,"Begin Styles",{}],["Styles",f,i.styles],["Post",a.Startup.signal,"MathZoom Ready"],["loadComplete",f,"[MathJax]/extensions/MathZoom.js"])})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.OutputJax["HTML-CSS"],MathJax.OutputJax.NativeMML);
(function(c,g,k,f,b){var q="2.5.0";var j=MathJax.Callback.Signal("menu");MathJax.Extension.MathMenu={version:q,signal:j};var o=function(r){return MathJax.Localization._.apply(MathJax.Localization,[["MathMenu",r]].concat([].slice.call(arguments,1)))};var n=c.Browser.isPC,l=c.Browser.isMSIE,e=((document.documentMode||0)>8);var i=(n?null:"5px");var p=c.CombineConfig("MathMenu",{delay:150,closeImg:k.urlRev(b.imageDir+"/CloseX-31.png"),showRenderer:true,showMathPlayer:true,showFontMenu:false,showContext:false,showDiscoverable:false,showLocale:true,showLocaleURL:false,semanticsAnnotations:{TeX:["TeX","LaTeX","application/x-tex"],StarMath:["StarMath 5.0"],Maple:["Maple"],ContentMathML:["MathML-Content","application/mathml-content+xml"],OpenMath:["OpenMath"]},windowSettings:{status:"no",toolbar:"no",locationbar:"no",menubar:"no",directories:"no",personalbar:"no",resizable:"yes",scrollbars:"yes",width:400,height:300,left:Math.round((screen.width-400)/2),top:Math.round((screen.height-300)/3)},styles:{"#MathJax_About":{position:"fixed",left:"50%",width:"auto","text-align":"center",border:"3px outset",padding:"1em 2em","background-color":"#DDDDDD",color:"black",cursor:"default","font-family":"message-box","font-size":"120%","font-style":"normal","text-indent":0,"text-transform":"none","line-height":"normal","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none","z-index":201,"border-radius":"15px","-webkit-border-radius":"15px","-moz-border-radius":"15px","-khtml-border-radius":"15px","box-shadow":"0px 10px 20px #808080","-webkit-box-shadow":"0px 10px 20px #808080","-moz-box-shadow":"0px 10px 20px #808080","-khtml-box-shadow":"0px 10px 20px #808080",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')"},".MathJax_Menu":{position:"absolute","background-color":"white",color:"black",width:"auto",padding:(n?"2px":"5px 0px"),border:"1px solid #CCCCCC",margin:0,cursor:"default",font:"menu","text-align":"left","text-indent":0,"text-transform":"none","line-height":"normal","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none","z-index":201,"border-radius":i,"-webkit-border-radius":i,"-moz-border-radius":i,"-khtml-border-radius":i,"box-shadow":"0px 10px 20px #808080","-webkit-box-shadow":"0px 10px 20px #808080","-moz-box-shadow":"0px 10px 20px #808080","-khtml-box-shadow":"0px 10px 20px #808080",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')"},".MathJax_MenuItem":{padding:(n?"2px 2em":"1px 2em"),background:"transparent"},".MathJax_MenuArrow":{position:"absolute",right:".5em",color:"#666666","font-family":(l?"'Arial unicode MS'":null)},".MathJax_MenuActive .MathJax_MenuArrow":{color:"white"},".MathJax_MenuArrow.RTL":{left:".5em",right:"auto"},".MathJax_MenuCheck":{position:"absolute",left:".7em","font-family":(l?"'Arial unicode MS'":null)},".MathJax_MenuCheck.RTL":{right:".7em",left:"auto"},".MathJax_MenuRadioCheck":{position:"absolute",left:(n?"1em":".7em")},".MathJax_MenuRadioCheck.RTL":{right:(n?"1em":".7em"),left:"auto"},".MathJax_MenuLabel":{padding:(n?"2px 2em 4px 1.33em":"1px 2em 3px 1.33em"),"font-style":"italic"},".MathJax_MenuRule":{"border-top":(n?"1px solid #CCCCCC":"1px solid #DDDDDD"),margin:(n?"4px 1px 0px":"4px 3px")},".MathJax_MenuDisabled":{color:"GrayText"},".MathJax_MenuActive":{"background-color":(n?"Highlight":"#606872"),color:(n?"HighlightText":"white")},".MathJax_Menu_Close":{position:"absolute",width:"31px",height:"31px",top:"-15px",left:"-15px"}}});var h,d;c.Register.StartupHook("MathEvents Ready",function(){h=MathJax.Extension.MathEvents.Event.False;d=MathJax.Extension.MathEvents.Hover});var a=MathJax.Menu=MathJax.Object.Subclass({version:q,items:[],posted:false,title:null,margin:5,Init:function(r){this.items=[].slice.call(arguments,0)},With:function(r){if(r){c.Insert(this,r)}return this},Post:function(s,C,A){if(!s){s=window.event}var r=document.getElementById("MathJax_MenuFrame");if(!r){r=a.Background(this);delete m.lastItem;delete m.lastMenu;delete a.skipUp;j.Post(["post",a.jax]);a.isRTL=(MathJax.Localization.fontDirection()==="rtl")}var t=g.Element("div",{onmouseup:a.Mouseup,ondblclick:h,ondragstart:h,onselectstart:h,oncontextmenu:h,menuItem:this,className:"MathJax_Menu"});if(!A){MathJax.Localization.setCSS(t)}for(var v=0,u=this.items.length;v<u;v++){this.items[v].Create(t)}if(a.isMobile){g.addElement(t,"span",{className:"MathJax_Menu_Close",menu:C,ontouchstart:a.Close,ontouchend:h,onmousedown:a.Close,onmouseup:h},[["img",{src:p.closeImg,style:{width:"100%",height:"100%"}}]])}r.appendChild(t);this.posted=true;t.style.width=(t.offsetWidth+2)+"px";var B=s.pageX,z=s.pageY;if(!B&&!z){B=s.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;z=s.clientY+document.body.scrollTop+document.documentElement.scrollTop}if(!C){if(B+t.offsetWidth>document.body.offsetWidth-this.margin){B=document.body.offsetWidth-t.offsetWidth-this.margin}if(a.isMobile){B=Math.max(5,B-Math.floor(t.offsetWidth/2));z-=20}a.skipUp=s.isContextMenu}else{var w="left",D=C.offsetWidth;B=(a.isMobile?30:D-2);z=0;while(C&&C!==r){B+=C.offsetLeft;z+=C.offsetTop;C=C.parentNode}if(!a.isMobile){if((a.isRTL&&B-D-t.offsetWidth>this.margin)||(!a.isRTL&&B+t.offsetWidth>document.body.offsetWidth-this.margin)){w="right";B=Math.max(this.margin,B-D-t.offsetWidth+6)}}if(!n){t.style["borderRadiusTop"+w]=0;t.style["WebkitBorderRadiusTop"+w]=0;t.style["MozBorderRadiusTop"+w]=0;t.style["KhtmlBorderRadiusTop"+w]=0}}t.style.left=B+"px";t.style.top=z+"px";if(document.selection&&document.selection.empty){document.selection.empty()}return h(s)},Remove:function(r,s){j.Post(["unpost",a.jax]);var t=document.getElementById("MathJax_MenuFrame");if(t){t.parentNode.removeChild(t);if(this.msieFixedPositionBug){detachEvent("onresize",a.Resize)}}if(a.jax.hover){delete a.jax.hover.nofade;d.UnHover(a.jax)}return h(r)},Find:function(r){return this.FindN(1,r,[].slice.call(arguments,1))},FindId:function(r){return this.FindN(0,r,[].slice.call(arguments,1))},FindN:function(v,s,u){for(var t=0,r=this.items.length;t<r;t++){if(this.items[t].name[v]===s){if(u.length){if(!this.items[t].menu){return null}return this.items[t].menu.FindN(v,u[0],u.slice(1))}return this.items[t]}}return null},IndexOf:function(r){return this.IndexOfN(1,r)},IndexOfId:function(r){return this.IndexOfN(0,r)},IndexOfN:function(u,s){for(var t=0,r=this.items.length;t<r;t++){if(this.items[t].name[u]===s){return t}}return null}},{config:p,div:null,Close:function(r){return a.Event(r,this.menu||this.parentNode,(this.menu?"Touchend":"Remove"))},Remove:function(r){return a.Event(r,this,"Remove")},Mouseover:function(r){return a.Event(r,this,"Mouseover")},Mouseout:function(r){return a.Event(r,this,"Mouseout")},Mousedown:function(r){return a.Event(r,this,"Mousedown")},Mouseup:function(r){return a.Event(r,this,"Mouseup")},Touchstart:function(r){return a.Event(r,this,"Touchstart")},Touchend:function(r){return a.Event(r,this,"Touchend")},Event:function(t,v,r,u){if(a.skipMouseover&&r==="Mouseover"&&!u){return h(t)}if(a.skipUp){if(r.match(/Mouseup|Touchend/)){delete a.skipUp;return h(t)}if(r==="Touchstart"||(r==="Mousedown"&&!a.skipMousedown)){delete a.skipUp}}if(!t){t=window.event}var s=v.menuItem;if(s&&s[r]){return s[r](t,v)}return null},BGSTYLE:{position:"absolute",left:0,top:0,"z-index":200,width:"100%",height:"100%",border:0,padding:0,margin:0},Background:function(s){var t=g.addElement(document.body,"div",{style:this.BGSTYLE,id:"MathJax_MenuFrame"},[["div",{style:this.BGSTYLE,menuItem:s,onmousedown:this.Remove}]]);var r=t.firstChild;if(a.msieBackgroundBug){r.style.backgroundColor="white";r.style.filter="alpha(opacity=0)"}if(a.msieFixedPositionBug){t.width=t.height=0;this.Resize();attachEvent("onresize",this.Resize)}else{r.style.position="fixed"}return t},Resize:function(){setTimeout(a.SetWH,0)},SetWH:function(){var r=document.getElementById("MathJax_MenuFrame");if(r){r=r.firstChild;r.style.width=r.style.height="1px";r.style.width=document.body.scrollWidth+"px";r.style.height=document.body.scrollHeight+"px"}},saveCookie:function(){g.Cookie.Set("menu",this.cookie)},getCookie:function(){this.cookie=g.Cookie.Get("menu")},getImages:function(){if(a.isMobile){var r=new Image();r.src=p.closeImg}}});var m=a.ITEM=MathJax.Object.Subclass({name:"",Create:function(s){if(!this.hidden){var r={onmouseover:a.Mouseover,onmouseout:a.Mouseout,onmouseup:a.Mouseup,onmousedown:a.Mousedown,ondragstart:h,onselectstart:h,onselectend:h,ontouchstart:a.Touchstart,ontouchend:a.Touchend,className:"MathJax_MenuItem",menuItem:this};if(this.disabled){r.className+=" MathJax_MenuDisabled"}g.addElement(s,"div",r,this.Label(r,s))}},Name:function(){return o(this.name[0],this.name[1])},Mouseover:function(v,x){if(!this.disabled){this.Activate(x)}if(!this.menu||!this.menu.posted){var w=document.getElementById("MathJax_MenuFrame").childNodes,s=x.parentNode.childNodes;for(var t=0,r=s.length;t<r;t++){var u=s[t].menuItem;if(u&&u.menu&&u.menu.posted){u.Deactivate(s[t])}}r=w.length-1;while(r>=0&&x.parentNode.menuItem!==w[r].menuItem){w[r].menuItem.posted=false;w[r].parentNode.removeChild(w[r]);r--}if(this.Timer&&!a.isMobile){this.Timer(v,x)}}},Mouseout:function(r,s){if(!this.menu||!this.menu.posted){this.Deactivate(s)}if(this.timer){clearTimeout(this.timer);delete this.timer}},Mouseup:function(r,s){return this.Remove(r,s)},Touchstart:function(r,s){return this.TouchEvent(r,s,"Mousedown")},Touchend:function(r,s){return this.TouchEvent(r,s,"Mouseup")},TouchEvent:function(s,t,r){if(this!==m.lastItem){if(m.lastMenu){a.Event(s,m.lastMenu,"Mouseout")}a.Event(s,t,"Mouseover",true);m.lastItem=this;m.lastMenu=t}if(this.nativeTouch){return null}a.Event(s,t,r);return false},Remove:function(r,s){s=s.parentNode.menuItem;return s.Remove(r,s)},Activate:function(r){this.Deactivate(r);r.className+=" MathJax_MenuActive"},Deactivate:function(r){r.className=r.className.replace(/ MathJax_MenuActive/,"")},With:function(r){if(r){c.Insert(this,r)}return this},isRTL:function(){return a.isRTL},rtlClass:function(){return(this.isRTL()?" RTL":"")}});a.ITEM.COMMAND=a.ITEM.Subclass({action:function(){},Init:function(r,t,s){if(!(r instanceof Array)){r=[r,r]}this.name=r;this.action=t;this.With(s)},Label:function(r,s){return[this.Name()]},Mouseup:function(r,s){if(!this.disabled){this.Remove(r,s);j.Post(["command",this]);this.action.call(this,r)}return h(r)}});a.ITEM.SUBMENU=a.ITEM.Subclass({menu:null,marker:(n&&!c.Browser.isSafari?"\u25B6":"\u25B8"),markerRTL:(n&&!c.Browser.isSafari?"\u25B0":"\u25C2"),Init:function(r,t){if(!(r instanceof Array)){r=[r,r]}this.name=r;var s=1;if(!(t instanceof a.ITEM)){this.With(t),s++}this.menu=a.apply(a,[].slice.call(arguments,s))},Label:function(r,s){this.menu.posted=false;return[this.Name()+" ",["span",{className:"MathJax_MenuArrow"+this.rtlClass()},[this.isRTL()?this.markerRTL:this.marker]]]},Timer:function(r,s){if(this.timer){clearTimeout(this.timer)}r={clientX:r.clientX,clientY:r.clientY};this.timer=setTimeout(f(["Mouseup",this,r,s]),p.delay)},Touchend:function(s,u){var t=this.menu.posted;var r=this.SUPER(arguments).Touchend.apply(this,arguments);if(t){this.Deactivate(u);delete m.lastItem;delete m.lastMenu}return r},Mouseup:function(s,u){if(!this.disabled){if(!this.menu.posted){if(this.timer){clearTimeout(this.timer);delete this.timer}this.menu.Post(s,u,this.ltr)}else{var t=document.getElementById("MathJax_MenuFrame").childNodes,r=t.length-1;while(r>=0){var v=t[r];v.menuItem.posted=false;v.parentNode.removeChild(v);if(v.menuItem===this.menu){break}r--}}}return h(s)}});a.ITEM.RADIO=a.ITEM.Subclass({variable:null,marker:(n?"\u25CF":"\u2713"),Init:function(s,r,t){if(!(s instanceof Array)){s=[s,s]}this.name=s;this.variable=r;this.With(t);if(this.value==null){this.value=this.name[0]}},Label:function(s,t){var r={className:"MathJax_MenuRadioCheck"+this.rtlClass()};if(p.settings[this.variable]!==this.value){r={style:{display:"none"}}}return[["span",r,[this.marker]]," "+this.Name()]},Mouseup:function(u,v){if(!this.disabled){var w=v.parentNode.childNodes;for(var s=0,r=w.length;s<r;s++){var t=w[s].menuItem;if(t&&t.variable===this.variable){w[s].firstChild.style.display="none"}}v.firstChild.display="";p.settings[this.variable]=this.value;a.cookie[this.variable]=p.settings[this.variable];a.saveCookie();j.Post(["radio button",this])}this.Remove(u,v);if(this.action&&!this.disabled){this.action.call(a,this)}return h(u)}});a.ITEM.CHECKBOX=a.ITEM.Subclass({variable:null,marker:"\u2713",Init:function(s,r,t){if(!(s instanceof Array)){s=[s,s]}this.name=s;this.variable=r;this.With(t)},Label:function(s,t){var r={className:"MathJax_MenuCheck"+this.rtlClass()};if(!p.settings[this.variable]){r={style:{display:"none"}}}return[["span",r,[this.marker]]," "+this.Name()]},Mouseup:function(r,s){if(!this.disabled){s.firstChild.display=(p.settings[this.variable]?"none":"");p.settings[this.variable]=!p.settings[this.variable];a.cookie[this.variable]=p.settings[this.variable];a.saveCookie();j.Post(["checkbox",this])}this.Remove(r,s);if(this.action&&!this.disabled){this.action.call(a,this)}return h(r)}});a.ITEM.LABEL=a.ITEM.Subclass({Init:function(r,s){if(!(r instanceof Array)){r=[r,r]}this.name=r;this.With(s)},Label:function(r,s){delete r.onmouseover,delete r.onmouseout;delete r.onmousedown;r.className+=" MathJax_MenuLabel";return[this.Name()]}});a.ITEM.RULE=a.ITEM.Subclass({Label:function(r,s){delete r.onmouseover,delete r.onmouseout;delete r.onmousedown;r.className+=" MathJax_MenuRule";return null}});a.About=function(){var t=b["HTML-CSS"]||{};var s=(t.imgFonts?"image":(t.fontInUse?(t.webFonts?"web":"local")+" "+t.fontInUse:(b.SVG?"web SVG":"generic")))+" fonts";var x=(!t.webFonts||t.imgFonts?null:t.allowWebFonts.replace(/otf/,"woff or otf")+" fonts");var r=["MathJax.js v"+MathJax.fileversion,["br"]];r.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);a.About.GetJax(r,MathJax.InputJax,["InputJax","%1 Input Jax v%2"]);a.About.GetJax(r,MathJax.OutputJax,["OutputJax","%1 Output Jax v%2"]);a.About.GetJax(r,MathJax.ElementJax,["ElementJax","%1 Element Jax v%2"]);r.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);a.About.GetJax(r,MathJax.Extension,["Extension","%1 Extension v%2"],true);r.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}],["center",{},[c.Browser+" v"+c.Browser.version+(x?" \u2014 "+o(x.replace(/ /g,""),x):"")]]);a.About.div=a.Background(a.About);var v=g.addElement(a.About.div,"div",{id:"MathJax_About"},[["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"],o(s.replace(/ /g,""),"using "+s),["br"],["br"],["span",{style:{display:"inline-block","text-align":"left","font-size":"80%","max-height":"20em",overflow:"auto","background-color":"#E4E4E4",padding:".4em .6em",border:"1px inset"}},r],["br"],["br"],["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],["img",{src:p.closeImg,style:{width:"21px",height:"21px",position:"absolute",top:".2em",right:".2em"},onclick:a.About.Remove}]]);MathJax.Localization.setCSS(v);var w=(document.documentElement||{});var u=window.innerHeight||w.clientHeight||w.scrollHeight||0;if(a.prototype.msieAboutBug){v.style.width="20em";v.style.position="absolute";v.style.left=Math.floor((document.documentElement.scrollWidth-v.offsetWidth)/2)+"px";v.style.top=(Math.floor((u-v.offsetHeight)/3)+document.body.scrollTop)+"px"}else{v.style.marginLeft=Math.floor(-v.offsetWidth/2)+"px";v.style.top=Math.floor((u-v.offsetHeight)/3)+"px"}};a.About.Remove=function(r){if(a.About.div){document.body.removeChild(a.About.div);delete a.About.div}};a.About.GetJax=function(s,x,v,u){var w=[];for(var y in x){if(x.hasOwnProperty(y)&&x[y]){if((u&&x[y].version)||(x[y].isa&&x[y].isa(x))){w.push(o(v[0],v[1],(x[y].id||y),x[y].version))}}}w.sort();for(var t=0,r=w.length;t<r;t++){s.push(w[t],["br"])}return s};a.Help=function(){k.Require("[MathJax]/extensions/HelpDialog.js",function(){MathJax.Extension.Help.Dialog()})};a.ShowSource=function(v){if(!v){v=window.event}var u={screenX:v.screenX,screenY:v.screenY};if(!a.jax){return}if(this.format==="MathML"){var s=MathJax.ElementJax.mml;if(s&&typeof(s.mbase.prototype.toMathML)!=="undefined"){try{a.ShowSource.Text(a.jax.root.toMathML("",a.jax),v)}catch(t){if(!t.restart){throw t}f.After([this,a.ShowSource,u],t.restart)}}else{if(!k.loadingToMathML){k.loadingToMathML=true;a.ShowSource.Window(v);f.Queue(k.Require("[MathJax]/extensions/toMathML.js"),function(){delete k.loadingToMathML;if(!s.mbase.prototype.toMathML){s.mbase.prototype.toMathML=function(){}}},[this,a.ShowSource,u]);return}}}else{if(this.format==="Error"){a.ShowSource.Text(a.jax.errorText,v)}else{if(p.semanticsAnnotations[this.format]){var r=a.jax.root.getAnnotation(this.format);if(r.data[0]){a.ShowSource.Text(r.data[0].toString())}}else{if(a.jax.originalText==null){alert(o("NoOriginalForm","No original form available"));return}a.ShowSource.Text(a.jax.originalText,v)}}}};a.ShowSource.Window=function(s){if(!a.ShowSource.w){var t=[],r=p.windowSettings;for(var u in r){if(r.hasOwnProperty(u)){t.push(u+"="+r[u])}}a.ShowSource.w=window.open("","_blank",t.join(","))}return a.ShowSource.w};a.ShowSource.Text=function(v,t){var r=a.ShowSource.Window(t);delete a.ShowSource.w;v=v.replace(/^\s*/,"").replace(/\s*$/,"");v=v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");var u=o("EqSource","MathJax Equation Source");if(a.isMobile){r.document.open();r.document.write("<html><head><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>"+u+"</title></head><body style='font-size:85%'>");r.document.write("<pre>"+v+"</pre>");r.document.write("<hr><input type='button' value='"+o("Close","Close")+"' onclick='window.close()' />");r.document.write("</body></html>");r.document.close()}else{r.document.open();r.document.write("<html><head><title>"+u+"</title></head><body style='font-size:85%'>");r.document.write("<table><tr><td><pre>"+v+"</pre></td></tr></table>");r.document.write("</body></html>");r.document.close();var s=r.document.body.firstChild;setTimeout(function(){var A=(r.outerHeight-r.innerHeight)||30,z=(r.outerWidth-r.innerWidth)||30,w,D;z=Math.max(100,Math.min(Math.floor(0.5*screen.width),s.offsetWidth+z+25));A=Math.max(40,Math.min(Math.floor(0.5*screen.height),s.offsetHeight+A+25));if(a.prototype.msieHeightBug){A+=35}r.resizeTo(z,A);var C;try{C=t.screenX}catch(B){}if(t&&C!=null){w=Math.max(0,Math.min(t.screenX-Math.floor(z/2),screen.width-z-20));D=Math.max(0,Math.min(t.screenY-Math.floor(A/2),screen.height-A-20));r.moveTo(w,D)}},50)}};a.Scale=function(){var s=b["HTML-CSS"],r=b.NativeMML,v=b.SVG;var u=(s||r||v||{config:{scale:100}}).config.scale;var t=prompt(o("ScaleMath","Scale all mathematics (compared to surrounding text) by"),u+"%");if(t){if(t.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)){t=parseFloat(t);if(t){if(t!==u){if(s){s.config.scale=t}if(r){r.config.scale=t}if(v){v.config.scale=t}a.cookie.scale=t;a.saveCookie();c.Rerender()}}else{alert(o("NonZeroScale","The scale should not be zero"))}}else{alert(o("PercentScale","The scale should be a percentage (e.g., 120%%)"))}}};a.Zoom=function(){if(!MathJax.Extension.MathZoom){k.Require("[MathJax]/extensions/MathZoom.js")}};a.Renderer=function(){var s=c.outputJax["jax/mml"];if(s[0]!==p.settings.renderer){var v=c.Browser,u,r=a.Renderer.Messages,t;switch(p.settings.renderer){case"NativeMML":if(!p.settings.warnedMML){if(v.isChrome&&v.version.substr(0,3)!=="24."){u=r.MML.WebKit}else{if(v.isSafari&&!v.versionAtLeast("5.0")){u=r.MML.WebKit}else{if(v.isMSIE){if(!v.hasMathPlayer){u=r.MML.MSIE}}else{u=r.MML[v]}}}t="warnedMML"}break;case"SVG":if(!p.settings.warnedSVG){if(v.isMSIE&&!e){u=r.SVG.MSIE}}break}if(u){u=o(u[0],u[1]);u+="\n\n";u+=o("SwitchAnyway","Switch the renderer anyway?\n\n(Press OK to switch, CANCEL to continue with the current renderer)");a.cookie.renderer=s[0].id;a.saveCookie();if(!confirm(u)){a.cookie.renderer=p.settings.renderer=g.Cookie.Get("menu").renderer;a.saveCookie();return}if(t){a.cookie.warned=p.settings.warned=true}a.cookie.renderer=p.settings.renderer;a.saveCookie()}c.Queue(["setRenderer",c,p.settings.renderer,"jax/mml"],["Rerender",c])}};a.Renderer.Messages={MML:{WebKit:["WebkitNativeMMLWarning","Your browser doesn't seem to support MathML natively, so switching to MathML output may cause the mathematics on the page to become unreadable."],MSIE:["MSIENativeMMLWarning","Internet Explorer requires the MathPlayer plugin in order to process MathML output."],Opera:["OperaNativeMMLWarning","Opera's support for MathML is limited, so switching to MathML output may cause some expressions to render poorly."],Safari:["SafariNativeMMLWarning","Your browser's native MathML does not implement all the features used by MathJax, so some expressions may not render properly."],Firefox:["FirefoxNativeMMLWarning","Your browser's native MathML does not implement all the features used by MathJax, so some expressions may not render properly."]},SVG:{MSIE:["MSIESVGWarning","SVG is not implemented in Internet Explorer prior to IE9 or when it is emulating IE8 or below. Switching to SVG output will cause the mathematics to not display properly."]}};a.Font=function(){var r=b["HTML-CSS"];if(!r){return}document.location.reload()};a.Locale=function(){MathJax.Localization.setLocale(p.settings.locale);MathJax.Hub.Queue(["Reprocess",MathJax.Hub])};a.LoadLocale=function(){var r=prompt(o("LoadURL","Load translation data from this URL:"));if(r){if(!r.match(/\.js$/)){alert(o("BadURL","The URL should be for a javascript file that defines MathJax translation data. Javascript file names should end with '.js'"))}k.Require(r,function(s){if(s!=k.STATUS.OK){alert(o("BadData","Failed to load translation data from %1",r))}})}};a.MPEvents=function(t){var s=p.settings.discoverable,r=a.MPEvents.Messages;if(!e){if(p.settings.mpMouse&&!confirm(o.apply(o,r.IE8warning))){delete a.cookie.mpContext;delete p.settings.mpContext;delete a.cookie.mpMouse;delete p.settings.mpMouse;a.saveCookie();return}p.settings.mpContext=p.settings.mpMouse;a.cookie.mpContext=a.cookie.mpMouse=p.settings.mpMouse;a.saveCookie();MathJax.Hub.Queue(["Rerender",MathJax.Hub])}else{if(!s&&t.name[1]==="Menu Events"&&p.settings.mpContext){alert(o.apply(o,r.IE9warning))}}};a.MPEvents.Messages={IE8warning:["IE8warning","This will disable the MathJax menu and zoom features, but you can Alt-Click on an expression to obtain the MathJax menu instead.\n\nReally change the MathPlayer settings?"],IE9warning:["IE9warning","The MathJax contextual menu will be disabled, but you can Alt-Click on an expression to obtain the MathJax menu instead."]};c.Browser.Select({MSIE:function(r){var s=(document.compatMode==="BackCompat");var t=r.versionAtLeast("8.0")&&document.documentMode>7;a.Augment({margin:20,msieBackgroundBug:((document.documentMode||0)<9),msieFixedPositionBug:(s||!t),msieAboutBug:s,msieHeightBug:((document.documentMode||0)<9)});if(e){delete p.styles["#MathJax_About"].filter;delete p.styles[".MathJax_Menu"].filter}},Firefox:function(r){a.skipMouseover=r.isMobile&&r.versionAtLeast("6.0");a.skipMousedown=r.isMobile}});a.isMobile=c.Browser.isMobile;a.noContextMenu=c.Browser.noContextMenu;a.CreateLocaleMenu=function(){if(!a.menu){return}var w=a.menu.Find("Language").menu,t=w.items;var s=[],y=MathJax.Localization.strings;for(var x in y){if(y.hasOwnProperty(x)){s.push(x)}}s=s.sort();w.items=[];for(var u=0,r=s.length;u<r;u++){var v=y[s[u]].menuTitle;if(v){v+=" ("+s[u]+")"}else{v=s[u]}w.items.push(m.RADIO([s[u],v],"locale",{action:a.Locale}))}w.items.push(t[t.length-2],t[t.length-1])};a.CreateAnnotationMenu=function(){if(!a.menu){return}var t=a.menu.Find("Show Math As","Annotation").menu;var s=p.semanticsAnnotations;for(var r in s){if(s.hasOwnProperty(r)){t.items.push(m.COMMAND([r,r],a.ShowSource,{hidden:true,nativeTouch:true,format:r}))}}};c.Register.StartupHook("End Config",function(){p.settings=c.config.menuSettings;if(typeof(p.settings.showRenderer)!=="undefined"){p.showRenderer=p.settings.showRenderer}if(typeof(p.settings.showFontMenu)!=="undefined"){p.showFontMenu=p.settings.showFontMenu}if(typeof(p.settings.showContext)!=="undefined"){p.showContext=p.settings.showContext}a.getCookie();a.menu=a(m.SUBMENU(["Show","Show Math As"],m.COMMAND(["MathMLcode","MathML Code"],a.ShowSource,{nativeTouch:true,format:"MathML"}),m.COMMAND(["Original","Original Form"],a.ShowSource,{nativeTouch:true}),m.SUBMENU(["Annotation","Annotation"],{disabled:true}),m.RULE(),m.CHECKBOX(["texHints","Show TeX hints in MathML"],"texHints"),m.CHECKBOX(["semantics","Add original form as annotation"],"semantics")),m.RULE(),m.SUBMENU(["Settings","Math Settings"],m.SUBMENU(["ZoomTrigger","Zoom Trigger"],m.RADIO(["Hover","Hover"],"zoom",{action:a.Zoom}),m.RADIO(["Click","Click"],"zoom",{action:a.Zoom}),m.RADIO(["DoubleClick","Double-Click"],"zoom",{action:a.Zoom}),m.RADIO(["NoZoom","No Zoom"],"zoom",{value:"None"}),m.RULE(),m.LABEL(["TriggerRequires","Trigger Requires:"]),m.CHECKBOX((c.Browser.isMac?["Option","Option"]:["Alt","Alt"]),"ALT"),m.CHECKBOX(["Command","Command"],"CMD",{hidden:!c.Browser.isMac}),m.CHECKBOX(["Control","Control"],"CTRL",{hidden:c.Browser.isMac}),m.CHECKBOX(["Shift","Shift"],"Shift")),m.SUBMENU(["ZoomFactor","Zoom Factor"],m.RADIO("125%","zscale"),m.RADIO("133%","zscale"),m.RADIO("150%","zscale"),m.RADIO("175%","zscale"),m.RADIO("200%","zscale"),m.RADIO("250%","zscale"),m.RADIO("300%","zscale"),m.RADIO("400%","zscale")),m.RULE(),m.SUBMENU(["Renderer","Math Renderer"],{hidden:!p.showRenderer},m.RADIO("HTML-CSS","renderer",{action:a.Renderer}),m.RADIO("Fast HTML","renderer",{action:a.Renderer,value:"CommonHTML"}),m.RADIO("MathML","renderer",{action:a.Renderer,value:"NativeMML"}),m.RADIO("SVG","renderer",{action:a.Renderer}),m.RULE(),m.CHECKBOX("Fast Preview","CHTMLpreview")),m.SUBMENU("MathPlayer",{hidden:!c.Browser.isMSIE||!p.showMathPlayer,disabled:!c.Browser.hasMathPlayer},m.LABEL(["MPHandles","Let MathPlayer Handle:"]),m.CHECKBOX(["MenuEvents","Menu Events"],"mpContext",{action:a.MPEvents,hidden:!e}),m.CHECKBOX(["MouseEvents","Mouse Events"],"mpMouse",{action:a.MPEvents,hidden:!e}),m.CHECKBOX(["MenuAndMouse","Mouse and Menu Events"],"mpMouse",{action:a.MPEvents,hidden:e})),m.SUBMENU(["FontPrefs","Font Preference"],{hidden:!p.showFontMenu},m.LABEL(["ForHTMLCSS","For HTML-CSS:"]),m.RADIO(["Auto","Auto"],"font",{action:a.Font}),m.RULE(),m.RADIO(["TeXLocal","TeX (local)"],"font",{action:a.Font}),m.RADIO(["TeXWeb","TeX (web)"],"font",{action:a.Font}),m.RADIO(["TeXImage","TeX (image)"],"font",{action:a.Font}),m.RULE(),m.RADIO(["STIXLocal","STIX (local)"],"font",{action:a.Font}),m.RADIO(["STIXWeb","STIX (web)"],"font",{action:a.Font}),m.RULE(),m.RADIO(["AsanaMathWeb","Asana Math (web)"],"font",{action:a.Font}),m.RADIO(["GyrePagellaWeb","Gyre Pagella (web)"],"font",{action:a.Font}),m.RADIO(["GyreTermesWeb","Gyre Termes (web)"],"font",{action:a.Font}),m.RADIO(["LatinModernWeb","Latin Modern (web)"],"font",{action:a.Font}),m.RADIO(["NeoEulerWeb","Neo Euler (web)"],"font",{action:a.Font})),m.SUBMENU(["ContextMenu","Contextual Menu"],{hidden:!p.showContext},m.RADIO("MathJax","context"),m.RADIO(["Browser","Browser"],"context")),m.COMMAND(["Scale","Scale All Math ..."],a.Scale),m.RULE().With({hidden:!p.showDiscoverable,name:["","discover_rule"]}),m.CHECKBOX(["Discoverable","Highlight on Hover"],"discoverable",{hidden:!p.showDiscoverable})),m.SUBMENU(["Locale","Language"],{hidden:!p.showLocale,ltr:true},m.RADIO("en","locale",{action:a.Locale}),m.RULE().With({hidden:!p.showLocaleURL,name:["","localURL_rule"]}),m.COMMAND(["LoadLocale","Load from URL ..."],a.LoadLocale,{hidden:!p.showLocaleURL})),m.RULE(),m.COMMAND(["About","About MathJax"],a.About),m.COMMAND(["Help","MathJax Help"],a.Help));if(a.isMobile){(function(){var s=p.settings;var r=a.menu.Find("Math Settings","Zoom Trigger").menu;r.items[0].disabled=r.items[1].disabled=true;if(s.zoom==="Hover"||s.zoom=="Click"){s.zoom="None"}r.items=r.items.slice(0,4);if(navigator.appVersion.match(/[ (]Android[) ]/)){a.ITEM.SUBMENU.Augment({marker:"\u00BB"})}})()}a.CreateLocaleMenu();a.CreateAnnotationMenu()});a.showRenderer=function(r){a.cookie.showRenderer=p.showRenderer=r;a.saveCookie();a.menu.Find("Math Settings","Math Renderer").hidden=!r};a.showMathPlayer=function(r){a.cookie.showMathPlayer=p.showMathPlayer=r;a.saveCookie();a.menu.Find("Math Settings","MathPlayer").hidden=!r};a.showFontMenu=function(r){a.cookie.showFontMenu=p.showFontMenu=r;a.saveCookie();a.menu.Find("Math Settings","Font Preference").hidden=!r};a.showContext=function(r){a.cookie.showContext=p.showContext=r;a.saveCookie();a.menu.Find("Math Settings","Contextual Menu").hidden=!r};a.showDiscoverable=function(r){a.cookie.showDiscoverable=p.showDiscoverable=r;a.saveCookie();a.menu.Find("Math Settings","Highlight on Hover").hidden=!r;a.menu.Find("Math Settings","discover_rule").hidden=!r};a.showLocale=function(r){a.cookie.showLocale=p.showLocale=r;a.saveCookie();a.menu.Find("Language").hidden=!r};MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){if(!MathJax.OutputJax["HTML-CSS"].config.imageFont){a.menu.Find("Math Settings","Font Preference","TeX (image)").disabled=true}});f.Queue(c.Register.StartupHook("End Config",{}),["getImages",a],["Styles",k,p.styles],["Post",c.Startup.signal,"MathMenu Ready"],["loadComplete",k,"[MathJax]/extensions/MathMenu.js"])})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.CallBack,MathJax.OutputJax);
MathJax.ElementJax.mml=MathJax.ElementJax({mimeType:"jax/mml"},{id:"mml",version:"2.5.0",directory:MathJax.ElementJax.directory+"/mml",extensionDir:MathJax.ElementJax.extensionDir+"/mml",optableDir:MathJax.ElementJax.directory+"/mml/optable"});MathJax.ElementJax.mml.Augment({Init:function(){if(arguments.length===1&&arguments[0].type==="math"){this.root=arguments[0]}else{this.root=MathJax.ElementJax.mml.math.apply(this,arguments)}if(this.root.attr&&this.root.attr.mode){if(!this.root.display&&this.root.attr.mode==="display"){this.root.display="block";this.root.attrNames.push("display")}delete this.root.attr.mode;for(var b=0,a=this.root.attrNames.length;b<a;b++){if(this.root.attrNames[b]==="mode"){this.root.attrNames.splice(b,1);break}}}}},{INHERIT:"_inherit_",AUTO:"_auto_",SIZE:{INFINITY:"infinity",SMALL:"small",NORMAL:"normal",BIG:"big"},COLOR:{TRANSPARENT:"transparent"},VARIANT:{NORMAL:"normal",BOLD:"bold",ITALIC:"italic",BOLDITALIC:"bold-italic",DOUBLESTRUCK:"double-struck",FRAKTUR:"fraktur",BOLDFRAKTUR:"bold-fraktur",SCRIPT:"script",BOLDSCRIPT:"bold-script",SANSSERIF:"sans-serif",BOLDSANSSERIF:"bold-sans-serif",SANSSERIFITALIC:"sans-serif-italic",SANSSERIFBOLDITALIC:"sans-serif-bold-italic",MONOSPACE:"monospace",INITIAL:"inital",TAILED:"tailed",LOOPED:"looped",STRETCHED:"stretched",CALIGRAPHIC:"-tex-caligraphic",OLDSTYLE:"-tex-oldstyle"},FORM:{PREFIX:"prefix",INFIX:"infix",POSTFIX:"postfix"},LINEBREAK:{AUTO:"auto",NEWLINE:"newline",NOBREAK:"nobreak",GOODBREAK:"goodbreak",BADBREAK:"badbreak"},LINEBREAKSTYLE:{BEFORE:"before",AFTER:"after",DUPLICATE:"duplicate",INFIXLINBREAKSTYLE:"infixlinebreakstyle"},INDENTALIGN:{LEFT:"left",CENTER:"center",RIGHT:"right",AUTO:"auto",ID:"id",INDENTALIGN:"indentalign"},INDENTSHIFT:{INDENTSHIFT:"indentshift"},LINETHICKNESS:{THIN:"thin",MEDIUM:"medium",THICK:"thick"},NOTATION:{LONGDIV:"longdiv",ACTUARIAL:"actuarial",RADICAL:"radical",BOX:"box",ROUNDEDBOX:"roundedbox",CIRCLE:"circle",LEFT:"left",RIGHT:"right",TOP:"top",BOTTOM:"bottom",UPDIAGONALSTRIKE:"updiagonalstrike",DOWNDIAGONALSTRIKE:"downdiagonalstrike",UPDIAGONALARROW:"updiagonalarrow",VERTICALSTRIKE:"verticalstrike",HORIZONTALSTRIKE:"horizontalstrike",PHASORANGLE:"phasorangle",MADRUWB:"madruwb"},ALIGN:{TOP:"top",BOTTOM:"bottom",CENTER:"center",BASELINE:"baseline",AXIS:"axis",LEFT:"left",RIGHT:"right"},LINES:{NONE:"none",SOLID:"solid",DASHED:"dashed"},SIDE:{LEFT:"left",RIGHT:"right",LEFTOVERLAP:"leftoverlap",RIGHTOVERLAP:"rightoverlap"},WIDTH:{AUTO:"auto",FIT:"fit"},ACTIONTYPE:{TOGGLE:"toggle",STATUSLINE:"statusline",TOOLTIP:"tooltip",INPUT:"input"},LENGTH:{VERYVERYTHINMATHSPACE:"veryverythinmathspace",VERYTHINMATHSPACE:"verythinmathspace",THINMATHSPACE:"thinmathspace",MEDIUMMATHSPACE:"mediummathspace",THICKMATHSPACE:"thickmathspace",VERYTHICKMATHSPACE:"verythickmathspace",VERYVERYTHICKMATHSPACE:"veryverythickmathspace",NEGATIVEVERYVERYTHINMATHSPACE:"negativeveryverythinmathspace",NEGATIVEVERYTHINMATHSPACE:"negativeverythinmathspace",NEGATIVETHINMATHSPACE:"negativethinmathspace",NEGATIVEMEDIUMMATHSPACE:"negativemediummathspace",NEGATIVETHICKMATHSPACE:"negativethickmathspace",NEGATIVEVERYTHICKMATHSPACE:"negativeverythickmathspace",NEGATIVEVERYVERYTHICKMATHSPACE:"negativeveryverythickmathspace"},OVERFLOW:{LINBREAK:"linebreak",SCROLL:"scroll",ELIDE:"elide",TRUNCATE:"truncate",SCALE:"scale"},UNIT:{EM:"em",EX:"ex",PX:"px",IN:"in",CM:"cm",MM:"mm",PT:"pt",PC:"pc"},TEXCLASS:{ORD:0,OP:1,BIN:2,REL:3,OPEN:4,CLOSE:5,PUNCT:6,INNER:7,VCENTER:8,NONE:-1},TEXCLASSNAMES:["ORD","OP","BIN","REL","OPEN","CLOSE","PUNCT","INNER","VCENTER"],skipAttributes:{texClass:true,useHeight:true,texprimestyle:true},copyAttributes:{displaystyle:1,scriptlevel:1,open:1,close:1,form:1,actiontype:1,fontfamily:true,fontsize:true,fontweight:true,fontstyle:true,color:true,background:true,id:true,"class":1,href:true,style:true},copyAttributeNames:["displaystyle","scriptlevel","open","close","form","actiontype","fontfamily","fontsize","fontweight","fontstyle","color","background","id","class","href","style"],nocopyAttributes:{fontfamily:true,fontsize:true,fontweight:true,fontstyle:true,color:true,background:true,id:true,"class":true,href:true,style:true,xmlns:true},Error:function(d,e){var c=this.merror(d),b=MathJax.Localization.fontDirection(),a=MathJax.Localization.fontFamily();if(e){c=c.With(e)}if(b||a){c=this.mstyle(c);if(b){c.dir=b}if(a){c.style.fontFamily="font-family: "+a}}return c}});(function(a){a.mbase=MathJax.Object.Subclass({type:"base",isToken:false,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,dir:a.INHERIT},noInherit:{},noInheritAttribute:{texClass:true},linebreakContainer:false,Init:function(){this.data=[];if(this.inferRow&&!(arguments.length===1&&arguments[0].inferred)){this.Append(a.mrow().With({inferred:true,notParent:true}))}this.Append.apply(this,arguments)},With:function(e){for(var f in e){if(e.hasOwnProperty(f)){this[f]=e[f]}}return this},Append:function(){if(this.inferRow&&this.data.length){this.data[0].Append.apply(this.data[0],arguments)}else{for(var f=0,e=arguments.length;f<e;f++){this.SetData(this.data.length,arguments[f])}}},SetData:function(e,f){if(f!=null){if(!(f instanceof a.mbase)){f=(this.isToken||this.isChars?a.chars(f):a.mtext(f))}f.parent=this;f.setInherit(this.inheritFromMe?this:this.inherit)}this.data[e]=f},Parent:function(){var e=this.parent;while(e&&e.notParent){e=e.parent}return e},Get:function(f,k,l){if(!l){if(this[f]!=null){return this[f]}if(this.attr&&this.attr[f]!=null){return this.attr[f]}}var g=this.Parent();if(g&&g["adjustChild_"+f]!=null){return(g["adjustChild_"+f])(this.childPosition(),k)}var j=this.inherit;var e=j;while(j){var i=j[f];if(i==null&&j.attr){i=j.attr[f]}if(i!=null&&j.noInheritAttribute&&!j.noInheritAttribute[f]){var h=j.noInherit[this.type];if(!(h&&h[f])){return i}}e=j;j=j.inherit}if(!k){if(this.defaults[f]===a.AUTO){return this.autoDefault(f)}if(this.defaults[f]!==a.INHERIT&&this.defaults[f]!=null){return this.defaults[f]}if(e){return e.defaults[f]}}return null},hasValue:function(e){return(this.Get(e,true)!=null)},getValues:function(){var f={};for(var g=0,e=arguments.length;g<e;g++){f[arguments[g]]=this.Get(arguments[g])}return f},adjustChild_scriptlevel:function(f,e){return this.Get("scriptlevel",e)},adjustChild_displaystyle:function(f,e){return this.Get("displaystyle",e)},adjustChild_texprimestyle:function(f,e){return this.Get("texprimestyle",e)},childPosition:function(){var h=this,g=h.parent;while(g.notParent){h=g;g=h.parent}for(var f=0,e=g.data.length;f<e;f++){if(g.data[f]===h){return f}}return null},setInherit:function(g){if(g!==this.inherit&&this.inherit==null){this.inherit=g;for(var f=0,e=this.data.length;f<e;f++){if(this.data[f]&&this.data[f].setInherit){this.data[f].setInherit(g)}}}},setTeXclass:function(e){this.getPrevClass(e);return(typeof(this.texClass)!=="undefined"?this:e)},getPrevClass:function(e){if(e){this.prevClass=e.Get("texClass");this.prevLevel=e.Get("scriptlevel")}},updateTeXclass:function(e){if(e){this.prevClass=e.prevClass;delete e.prevClass;this.prevLevel=e.prevLevel;delete e.prevLevel;this.texClass=e.Get("texClass")}},texSpacing:function(){var f=(this.prevClass!=null?this.prevClass:a.TEXCLASS.NONE);var e=(this.Get("texClass")||a.TEXCLASS.ORD);if(f===a.TEXCLASS.NONE||e===a.TEXCLASS.NONE){return""}if(f===a.TEXCLASS.VCENTER){f=a.TEXCLASS.ORD}if(e===a.TEXCLASS.VCENTER){e=a.TEXCLASS.ORD}var g=this.TEXSPACE[f][e];if(this.prevLevel>0&&this.Get("scriptlevel")>0&&g>=0){return""}return this.TEXSPACELENGTH[Math.abs(g)]},TEXSPACELENGTH:["",a.LENGTH.THINMATHSPACE,a.LENGTH.MEDIUMMATHSPACE,a.LENGTH.THICKMATHSPACE],TEXSPACE:[[0,-1,2,3,0,0,0,1],[-1,-1,0,3,0,0,0,1],[2,2,0,0,2,0,0,2],[3,3,0,0,3,0,0,3],[0,0,0,0,0,0,0,0],[0,-1,2,3,0,0,0,1],[1,1,0,1,1,1,1,1],[1,-1,2,3,1,0,1,1]],autoDefault:function(e){return""},isSpacelike:function(){return false},isEmbellished:function(){return false},Core:function(){return this},CoreMO:function(){return this},hasNewline:function(){if(this.isEmbellished()){return this.CoreMO().hasNewline()}if(this.isToken||this.linebreakContainer){return false}for(var f=0,e=this.data.length;f<e;f++){if(this.data[f]&&this.data[f].hasNewline()){return true}}return false},array:function(){if(this.inferred){return this.data}else{return[this]}},toString:function(){return this.type+"("+this.data.join(",")+")"},getAnnotation:function(){return null}},{childrenSpacelike:function(){for(var f=0,e=this.data.length;f<e;f++){if(!this.data[f].isSpacelike()){return false}}return true},childEmbellished:function(){return(this.data[0]&&this.data[0].isEmbellished())},childCore:function(){return this.data[0]},childCoreMO:function(){return(this.data[0]?this.data[0].CoreMO():null)},setChildTeXclass:function(e){if(this.data[0]){e=this.data[0].setTeXclass(e);this.updateTeXclass(this.data[0])}return e},setBaseTeXclasses:function(g){this.getPrevClass(g);this.texClass=null;if(this.data[0]){if(this.isEmbellished()||this.data[0].isa(a.mi)){g=this.data[0].setTeXclass(g);this.updateTeXclass(this.Core())}else{this.data[0].setTeXclass();g=this}}else{g=this}for(var f=1,e=this.data.length;f<e;f++){if(this.data[f]){this.data[f].setTeXclass()}}return g},setSeparateTeXclasses:function(g){this.getPrevClass(g);for(var f=0,e=this.data.length;f<e;f++){if(this.data[f]){this.data[f].setTeXclass()}}if(this.isEmbellished()){this.updateTeXclass(this.Core())}return this}});a.mi=a.mbase.Subclass({type:"mi",isToken:true,texClass:a.TEXCLASS.ORD,defaults:{mathvariant:a.AUTO,mathsize:a.INHERIT,mathbackground:a.INHERIT,mathcolor:a.INHERIT,dir:a.INHERIT},autoDefault:function(f){if(f==="mathvariant"){var e=(this.data[0]||"").toString();return(e.length===1||(e.length===2&&e.charCodeAt(0)>=55296&&e.charCodeAt(0)<56320)?a.VARIANT.ITALIC:a.VARIANT.NORMAL)}return""},setTeXclass:function(f){this.getPrevClass(f);var e=this.data.join("");if(e.length>1&&e.match(/^[a-z][a-z0-9]*$/i)&&this.texClass===a.TEXCLASS.ORD){this.texClass=a.TEXCLASS.OP;this.autoOP=true}return this}});a.mn=a.mbase.Subclass({type:"mn",isToken:true,texClass:a.TEXCLASS.ORD,defaults:{mathvariant:a.INHERIT,mathsize:a.INHERIT,mathbackground:a.INHERIT,mathcolor:a.INHERIT,dir:a.INHERIT}});a.mo=a.mbase.Subclass({type:"mo",isToken:true,defaults:{mathvariant:a.INHERIT,mathsize:a.INHERIT,mathbackground:a.INHERIT,mathcolor:a.INHERIT,dir:a.INHERIT,form:a.AUTO,fence:a.AUTO,separator:a.AUTO,lspace:a.AUTO,rspace:a.AUTO,stretchy:a.AUTO,symmetric:a.AUTO,maxsize:a.AUTO,minsize:a.AUTO,largeop:a.AUTO,movablelimits:a.AUTO,accent:a.AUTO,linebreak:a.LINEBREAK.AUTO,lineleading:a.INHERIT,linebreakstyle:a.AUTO,linebreakmultchar:a.INHERIT,indentalign:a.INHERIT,indentshift:a.INHERIT,indenttarget:a.INHERIT,indentalignfirst:a.INHERIT,indentshiftfirst:a.INHERIT,indentalignlast:a.INHERIT,indentshiftlast:a.INHERIT,texClass:a.AUTO},defaultDef:{form:a.FORM.INFIX,fence:false,separator:false,lspace:a.LENGTH.THICKMATHSPACE,rspace:a.LENGTH.THICKMATHSPACE,stretchy:false,symmetric:false,maxsize:a.SIZE.INFINITY,minsize:"0em",largeop:false,movablelimits:false,accent:false,linebreak:a.LINEBREAK.AUTO,lineleading:"1ex",linebreakstyle:"before",indentalign:a.INDENTALIGN.AUTO,indentshift:"0",indenttarget:"",indentalignfirst:a.INDENTALIGN.INDENTALIGN,indentshiftfirst:a.INDENTSHIFT.INDENTSHIFT,indentalignlast:a.INDENTALIGN.INDENTALIGN,indentshiftlast:a.INDENTSHIFT.INDENTSHIFT,texClass:a.TEXCLASS.REL},SPACE_ATTR:{lspace:1,rspace:2,form:4},useMMLspacing:7,autoDefault:function(g,n){var l=this.def;if(!l){if(g==="form"){this.useMMLspacing&=~this.SPACE_ATTR.form;return this.getForm()}var k=this.data.join("");var f=[this.Get("form"),a.FORM.INFIX,a.FORM.POSTFIX,a.FORM.PREFIX];for(var h=0,e=f.length;h<e;h++){var j=this.OPTABLE[f[h]][k];if(j){l=this.makeDef(j);break}}if(!l){l=this.CheckRange(k)}if(!l&&n){l={}}else{if(!l){l=MathJax.Hub.Insert({},this.defaultDef)}if(this.parent){this.def=l}else{l=MathJax.Hub.Insert({},l)}l.form=f[0]}}this.useMMLspacing&=~(this.SPACE_ATTR[g]||0);if(l[g]!=null){return l[g]}else{if(!n){return this.defaultDef[g]}}return""},CheckRange:function(j){var k=j.charCodeAt(0);if(k>=55296&&k<56320){k=(((k-55296)<<10)+(j.charCodeAt(1)-56320))+65536}for(var g=0,e=this.RANGES.length;g<e&&this.RANGES[g][0]<=k;g++){if(k<=this.RANGES[g][1]){if(this.RANGES[g][3]){var f=a.optableDir+"/"+this.RANGES[g][3]+".js";this.RANGES[g][3]=null;MathJax.Hub.RestartAfter(MathJax.Ajax.Require(f))}var h=a.TEXCLASSNAMES[this.RANGES[g][2]];h=this.OPTABLE.infix[j]=a.mo.OPTYPES[h==="BIN"?"BIN3":h];return this.makeDef(h)}}return null},makeDef:function(f){if(f[2]==null){f[2]=this.defaultDef.texClass}if(!f[3]){f[3]={}}var e=MathJax.Hub.Insert({},f[3]);e.lspace=this.SPACE[f[0]];e.rspace=this.SPACE[f[1]];e.texClass=f[2];if(e.texClass===a.TEXCLASS.REL&&(this.movablelimits||this.data.join("").match(/^[a-z]+$/i))){e.texClass=a.TEXCLASS.OP}return e},getForm:function(){var e=this,g=this.parent,f=this.Parent();while(f&&f.isEmbellished()){e=g;g=f.parent;f=f.Parent()}if(g&&g.type==="mrow"&&g.NonSpaceLength()!==1){if(g.FirstNonSpace()===e){return a.FORM.PREFIX}if(g.LastNonSpace()===e){return a.FORM.POSTFIX}}return a.FORM.INFIX},isEmbellished:function(){return true},hasNewline:function(){return(this.Get("linebreak")===a.LINEBREAK.NEWLINE)},CoreParent:function(){var e=this;while(e&&e.isEmbellished()&&e.CoreMO()===this&&!e.isa(a.math)){e=e.Parent()}return e},CoreText:function(e){if(!e){return""}if(e.isEmbellished()){return e.CoreMO().data.join("")}while((((e.isa(a.mrow)||e.isa(a.TeXAtom)||e.isa(a.mstyle)||e.isa(a.mphantom))&&e.data.length===1)||e.isa(a.munderover))&&e.data[0]){e=e.data[0]}if(!e.isToken){return""}else{return e.data.join("")}},remapChars:{"*":"\u2217",'"':"\u2033","\u00B0":"\u2218","\u00B2":"2","\u00B3":"3","\u00B4":"\u2032","\u00B9":"1"},remap:function(f,e){f=f.replace(/-/g,"\u2212");if(e){f=f.replace(/'/g,"\u2032").replace(/`/g,"\u2035");if(f.length===1){f=e[f]||f}}return f},setTeXclass:function(f){var e=this.getValues("form","lspace","rspace","fence");if(this.useMMLspacing){this.texClass=a.TEXCLASS.NONE;return this}if(e.fence&&!this.texClass){if(e.form===a.FORM.PREFIX){this.texClass=a.TEXCLASS.OPEN}if(e.form===a.FORM.POSTFIX){this.texClass=a.TEXCLASS.CLOSE}}this.texClass=this.Get("texClass");if(this.data.join("")==="\u2061"){if(f){f.texClass=a.TEXCLASS.OP;f.fnOP=true}this.texClass=this.prevClass=a.TEXCLASS.NONE;return f}return this.adjustTeXclass(f)},adjustTeXclass:function(e){if(this.texClass===a.TEXCLASS.NONE){return e}if(e){if(e.autoOP&&(this.texClass===a.TEXCLASS.BIN||this.texClass===a.TEXCLASS.REL)){e.texClass=a.TEXCLASS.ORD}this.prevClass=e.texClass||a.TEXCLASS.ORD;this.prevLevel=e.Get("scriptlevel")}else{this.prevClass=a.TEXCLASS.NONE}if(this.texClass===a.TEXCLASS.BIN&&(this.prevClass===a.TEXCLASS.NONE||this.prevClass===a.TEXCLASS.BIN||this.prevClass===a.TEXCLASS.OP||this.prevClass===a.TEXCLASS.REL||this.prevClass===a.TEXCLASS.OPEN||this.prevClass===a.TEXCLASS.PUNCT)){this.texClass=a.TEXCLASS.ORD}else{if(this.prevClass===a.TEXCLASS.BIN&&(this.texClass===a.TEXCLASS.REL||this.texClass===a.TEXCLASS.CLOSE||this.texClass===a.TEXCLASS.PUNCT)){e.texClass=this.prevClass=a.TEXCLASS.ORD}}return this}});a.mtext=a.mbase.Subclass({type:"mtext",isToken:true,isSpacelike:function(){return true},texClass:a.TEXCLASS.ORD,defaults:{mathvariant:a.INHERIT,mathsize:a.INHERIT,mathbackground:a.INHERIT,mathcolor:a.INHERIT,dir:a.INHERIT}});a.mspace=a.mbase.Subclass({type:"mspace",isToken:true,isSpacelike:function(){return true},defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,width:"0em",height:"0ex",depth:"0ex",linebreak:a.LINEBREAK.AUTO},hasDimAttr:function(){return(this.hasValue("width")||this.hasValue("height")||this.hasValue("depth"))},hasNewline:function(){return(!this.hasDimAttr()&&this.Get("linebreak")===a.LINEBREAK.NEWLINE)}});a.ms=a.mbase.Subclass({type:"ms",isToken:true,texClass:a.TEXCLASS.ORD,defaults:{mathvariant:a.INHERIT,mathsize:a.INHERIT,mathbackground:a.INHERIT,mathcolor:a.INHERIT,dir:a.INHERIT,lquote:'"',rquote:'"'}});a.mglyph=a.mbase.Subclass({type:"mglyph",isToken:true,texClass:a.TEXCLASS.ORD,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,alt:"",src:"",width:a.AUTO,height:a.AUTO,valign:"0em"}});a.mrow=a.mbase.Subclass({type:"mrow",isSpacelike:a.mbase.childrenSpacelike,inferred:false,notParent:false,isEmbellished:function(){var f=false;for(var g=0,e=this.data.length;g<e;g++){if(this.data[g]==null){continue}if(this.data[g].isEmbellished()){if(f){return false}f=true;this.core=g}else{if(!this.data[g].isSpacelike()){return false}}}return f},NonSpaceLength:function(){var g=0;for(var f=0,e=this.data.length;f<e;f++){if(this.data[f]&&!this.data[f].isSpacelike()){g++}}return g},FirstNonSpace:function(){for(var f=0,e=this.data.length;f<e;f++){if(this.data[f]&&!this.data[f].isSpacelike()){return this.data[f]}}return null},LastNonSpace:function(){for(var e=this.data.length-1;e>=0;e--){if(this.data[0]&&!this.data[e].isSpacelike()){return this.data[e]}}return null},Core:function(){if(!(this.isEmbellished())||typeof(this.core)==="undefined"){return this}return this.data[this.core]},CoreMO:function(){if(!(this.isEmbellished())||typeof(this.core)==="undefined"){return this}return this.data[this.core].CoreMO()},toString:function(){if(this.inferred){return"["+this.data.join(",")+"]"}return this.SUPER(arguments).toString.call(this)},setTeXclass:function(g){var f,e=this.data.length;if((this.open||this.close)&&(!g||!g.fnOP)){this.getPrevClass(g);g=null;for(f=0;f<e;f++){if(this.data[f]){g=this.data[f].setTeXclass(g)}}if(!this.hasOwnProperty("texClass")){this.texClass=a.TEXCLASS.INNER}return this}else{for(f=0;f<e;f++){if(this.data[f]){g=this.data[f].setTeXclass(g)}}if(this.data[0]){this.updateTeXclass(this.data[0])}return g}},getAnnotation:function(e){if(this.data.length!=1){return null}return this.data[0].getAnnotation(e)}});a.mfrac=a.mbase.Subclass({type:"mfrac",num:0,den:1,linebreakContainer:true,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,linethickness:a.LINETHICKNESS.MEDIUM,numalign:a.ALIGN.CENTER,denomalign:a.ALIGN.CENTER,bevelled:false},adjustChild_displaystyle:function(e){return false},adjustChild_scriptlevel:function(f){var e=this.Get("scriptlevel");if(!this.Get("displaystyle")||e>0){e++}return e},adjustChild_texprimestyle:function(e){if(e==this.den){return true}return this.Get("texprimestyle")},setTeXclass:a.mbase.setSeparateTeXclasses});a.msqrt=a.mbase.Subclass({type:"msqrt",inferRow:true,linebreakContainer:true,texClass:a.TEXCLASS.ORD,setTeXclass:a.mbase.setSeparateTeXclasses,adjustChild_texprimestyle:function(e){return true}});a.mroot=a.mbase.Subclass({type:"mroot",linebreakContainer:true,texClass:a.TEXCLASS.ORD,adjustChild_displaystyle:function(e){if(e===1){return false}return this.Get("displaystyle")},adjustChild_scriptlevel:function(f){var e=this.Get("scriptlevel");if(f===1){e+=2}return e},adjustChild_texprimestyle:function(e){if(e===0){return true}return this.Get("texprimestyle")},setTeXclass:a.mbase.setSeparateTeXclasses});a.mstyle=a.mbase.Subclass({type:"mstyle",isSpacelike:a.mbase.childrenSpacelike,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,inferRow:true,defaults:{scriptlevel:a.INHERIT,displaystyle:a.INHERIT,scriptsizemultiplier:Math.sqrt(1/2),scriptminsize:"8pt",mathbackground:a.INHERIT,mathcolor:a.INHERIT,dir:a.INHERIT,infixlinebreakstyle:a.LINEBREAKSTYLE.BEFORE,decimalseparator:"."},adjustChild_scriptlevel:function(g){var f=this.scriptlevel;if(f==null){f=this.Get("scriptlevel")}else{if(String(f).match(/^ *[-+]/)){delete this.scriptlevel;var e=this.Get("scriptlevel");this.scriptlevel=f;f=e+parseInt(f)}}return f},inheritFromMe:true,noInherit:{mpadded:{width:true,height:true,depth:true,lspace:true,voffset:true},mtable:{width:true,height:true,depth:true,align:true}},setTeXclass:a.mbase.setChildTeXclass});a.merror=a.mbase.Subclass({type:"merror",inferRow:true,linebreakContainer:true,texClass:a.TEXCLASS.ORD});a.mpadded=a.mbase.Subclass({type:"mpadded",inferRow:true,isSpacelike:a.mbase.childrenSpacelike,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,width:"",height:"",depth:"",lspace:0,voffset:0},setTeXclass:a.mbase.setChildTeXclass});a.mphantom=a.mbase.Subclass({type:"mphantom",texClass:a.TEXCLASS.ORD,inferRow:true,isSpacelike:a.mbase.childrenSpacelike,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,setTeXclass:a.mbase.setChildTeXclass});a.mfenced=a.mbase.Subclass({type:"mfenced",defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,open:"(",close:")",separators:","},addFakeNodes:function(){var f=this.getValues("open","close","separators");f.open=f.open.replace(/[ \t\n\r]/g,"");f.close=f.close.replace(/[ \t\n\r]/g,"");f.separators=f.separators.replace(/[ \t\n\r]/g,"");if(f.open!==""){this.SetData("open",a.mo(f.open).With({fence:true,form:a.FORM.PREFIX,texClass:a.TEXCLASS.OPEN}));this.data.open.useMMLspacing&=~this.data.open.SPACE_ATTR.form}if(f.separators!==""){while(f.separators.length<this.data.length){f.separators+=f.separators.charAt(f.separators.length-1)}for(var g=1,e=this.data.length;g<e;g++){if(this.data[g]){this.SetData("sep"+g,a.mo(f.separators.charAt(g-1)).With({separator:true}))}}}if(f.close!==""){this.SetData("close",a.mo(f.close).With({fence:true,form:a.FORM.POSTFIX,texClass:a.TEXCLASS.CLOSE}));this.data.close.useMMLspacing&=~this.data.close.SPACE_ATTR.form}},texClass:a.TEXCLASS.OPEN,setTeXclass:function(g){this.addFakeNodes();this.getPrevClass(g);if(this.data.open){g=this.data.open.setTeXclass(g)}if(this.data[0]){g=this.data[0].setTeXclass(g)}for(var f=1,e=this.data.length;f<e;f++){if(this.data["sep"+f]){g=this.data["sep"+f].setTeXclass(g)}if(this.data[f]){g=this.data[f].setTeXclass(g)}}if(this.data.close){g=this.data.close.setTeXclass(g)}this.updateTeXclass(this.data.open);this.texClass=a.TEXCLASS.INNER;return g}});a.menclose=a.mbase.Subclass({type:"menclose",inferRow:true,linebreakContainer:true,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,notation:a.NOTATION.LONGDIV,texClass:a.TEXCLASS.ORD},setTeXclass:a.mbase.setSeparateTeXclasses});a.msubsup=a.mbase.Subclass({type:"msubsup",base:0,sub:1,sup:2,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,subscriptshift:"",superscriptshift:"",texClass:a.AUTO},autoDefault:function(e){if(e==="texClass"){return(this.isEmbellished()?this.CoreMO().Get(e):a.TEXCLASS.ORD)}return 0},adjustChild_displaystyle:function(e){if(e>0){return false}return this.Get("displaystyle")},adjustChild_scriptlevel:function(f){var e=this.Get("scriptlevel");if(f>0){e++}return e},adjustChild_texprimestyle:function(e){if(e===this.sub){return true}return this.Get("texprimestyle")},setTeXclass:a.mbase.setBaseTeXclasses});a.msub=a.msubsup.Subclass({type:"msub"});a.msup=a.msubsup.Subclass({type:"msup",sub:2,sup:1});a.mmultiscripts=a.msubsup.Subclass({type:"mmultiscripts",adjustChild_texprimestyle:function(e){if(e%2===1){return true}return this.Get("texprimestyle")}});a.mprescripts=a.mbase.Subclass({type:"mprescripts"});a.none=a.mbase.Subclass({type:"none"});a.munderover=a.mbase.Subclass({type:"munderover",base:0,under:1,over:2,sub:1,sup:2,ACCENTS:["","accentunder","accent"],linebreakContainer:true,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,accent:a.AUTO,accentunder:a.AUTO,align:a.ALIGN.CENTER,texClass:a.AUTO,subscriptshift:"",superscriptshift:""},autoDefault:function(e){if(e==="texClass"){return(this.isEmbellished()?this.CoreMO().Get(e):a.TEXCLASS.ORD)}if(e==="accent"&&this.data[this.over]){return this.data[this.over].CoreMO().Get("accent")}if(e==="accentunder"&&this.data[this.under]){return this.data[this.under].CoreMO().Get("accent")}return false},adjustChild_displaystyle:function(e){if(e>0){return false}return this.Get("displaystyle")},adjustChild_scriptlevel:function(g){var f=this.Get("scriptlevel");var e=(this.data[this.base]&&!this.Get("displaystyle")&&this.data[this.base].CoreMO().Get("movablelimits"));if(g==this.under&&(e||!this.Get("accentunder"))){f++}if(g==this.over&&(e||!this.Get("accent"))){f++}return f},adjustChild_texprimestyle:function(e){if(e===this.base&&this.data[this.over]){return true}return this.Get("texprimestyle")},setTeXclass:a.mbase.setBaseTeXclasses});a.munder=a.munderover.Subclass({type:"munder"});a.mover=a.munderover.Subclass({type:"mover",over:1,under:2,sup:1,sub:2,ACCENTS:["","accent","accentunder"]});a.mtable=a.mbase.Subclass({type:"mtable",defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,align:a.ALIGN.AXIS,rowalign:a.ALIGN.BASELINE,columnalign:a.ALIGN.CENTER,groupalign:"{left}",alignmentscope:true,columnwidth:a.WIDTH.AUTO,width:a.WIDTH.AUTO,rowspacing:"1ex",columnspacing:".8em",rowlines:a.LINES.NONE,columnlines:a.LINES.NONE,frame:a.LINES.NONE,framespacing:"0.4em 0.5ex",equalrows:false,equalcolumns:false,displaystyle:false,side:a.SIDE.RIGHT,minlabelspacing:"0.8em",texClass:a.TEXCLASS.ORD,useHeight:1},adjustChild_displaystyle:function(){return(this.displaystyle!=null?this.displaystyle:this.defaults.displaystyle)},inheritFromMe:true,noInherit:{mover:{align:true},munder:{align:true},munderover:{align:true},mtable:{align:true,rowalign:true,columnalign:true,groupalign:true,alignmentscope:true,columnwidth:true,width:true,rowspacing:true,columnspacing:true,rowlines:true,columnlines:true,frame:true,framespacing:true,equalrows:true,equalcolumns:true,displaystyle:true,side:true,minlabelspacing:true,texClass:true,useHeight:1}},linebreakContainer:true,Append:function(){for(var f=0,e=arguments.length;f<e;f++){if(!((arguments[f] instanceof a.mtr)||(arguments[f] instanceof a.mlabeledtr))){arguments[f]=a.mtd(arguments[f])}}this.SUPER(arguments).Append.apply(this,arguments)},setTeXclass:a.mbase.setSeparateTeXclasses});a.mtr=a.mbase.Subclass({type:"mtr",defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,rowalign:a.INHERIT,columnalign:a.INHERIT,groupalign:a.INHERIT},inheritFromMe:true,noInherit:{mrow:{rowalign:true,columnalign:true,groupalign:true},mtable:{rowalign:true,columnalign:true,groupalign:true}},linebreakContainer:true,Append:function(){for(var f=0,e=arguments.length;f<e;f++){if(!(arguments[f] instanceof a.mtd)){arguments[f]=a.mtd(arguments[f])}}this.SUPER(arguments).Append.apply(this,arguments)},setTeXclass:a.mbase.setSeparateTeXclasses});a.mtd=a.mbase.Subclass({type:"mtd",inferRow:true,linebreakContainer:true,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,rowspan:1,columnspan:1,rowalign:a.INHERIT,columnalign:a.INHERIT,groupalign:a.INHERIT},setTeXclass:a.mbase.setSeparateTeXclasses});a.maligngroup=a.mbase.Subclass({type:"malign",isSpacelike:function(){return true},defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,groupalign:a.INHERIT},inheritFromMe:true,noInherit:{mrow:{groupalign:true},mtable:{groupalign:true}}});a.malignmark=a.mbase.Subclass({type:"malignmark",defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,edge:a.SIDE.LEFT},isSpacelike:function(){return true}});a.mlabeledtr=a.mtr.Subclass({type:"mlabeledtr"});a.maction=a.mbase.Subclass({type:"maction",defaults:{mathbackground:a.INHERIT,mathcolor:a.INHERIT,actiontype:a.ACTIONTYPE.TOGGLE,selection:1},selected:function(){return this.data[this.Get("selection")-1]||a.NULL},isEmbellished:function(){return this.selected().isEmbellished()},isSpacelike:function(){return this.selected().isSpacelike()},Core:function(){return this.selected().Core()},CoreMO:function(){return this.selected().CoreMO()},setTeXclass:function(e){if(this.Get("actiontype")===a.ACTIONTYPE.TOOLTIP&&this.data[1]){this.data[1].setTeXclass()}return this.selected().setTeXclass(e)}});a.semantics=a.mbase.Subclass({type:"semantics",notParent:true,isEmbellished:a.mbase.childEmbellished,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,defaults:{definitionURL:null,encoding:null},setTeXclass:a.mbase.setChildTeXclass,getAnnotation:function(g){var l=MathJax.Hub.config.MathMenu.semanticsAnnotations[g];if(l){for(var h=0,e=this.data.length;h<e;h++){var k=this.data[h].Get("encoding");if(k){for(var f=0,o=l.length;f<o;f++){if(l[f]===k){return this.data[h]}}}}}return null}});a.annotation=a.mbase.Subclass({type:"annotation",isChars:true,linebreakContainer:true,defaults:{definitionURL:null,encoding:null,cd:"mathmlkeys",name:"",src:null}});a["annotation-xml"]=a.mbase.Subclass({type:"annotation-xml",linebreakContainer:true,defaults:{definitionURL:null,encoding:null,cd:"mathmlkeys",name:"",src:null}});a.math=a.mstyle.Subclass({type:"math",defaults:{mathvariant:a.VARIANT.NORMAL,mathsize:a.SIZE.NORMAL,mathcolor:"",mathbackground:a.COLOR.TRANSPARENT,dir:"ltr",scriptlevel:0,displaystyle:a.AUTO,display:"inline",maxwidth:"",overflow:a.OVERFLOW.LINEBREAK,altimg:"","altimg-width":"","altimg-height":"","altimg-valign":"",alttext:"",cdgroup:"",scriptsizemultiplier:Math.sqrt(1/2),scriptminsize:"8px",infixlinebreakstyle:a.LINEBREAKSTYLE.BEFORE,lineleading:"1ex",indentshift:"auto",indentalign:a.INDENTALIGN.AUTO,indentalignfirst:a.INDENTALIGN.INDENTALIGN,indentshiftfirst:a.INDENTSHIFT.INDENTSHIFT,indentalignlast:a.INDENTALIGN.INDENTALIGN,indentshiftlast:a.INDENTSHIFT.INDENTSHIFT,decimalseparator:".",texprimestyle:false},autoDefault:function(e){if(e==="displaystyle"){return this.Get("display")==="block"}return""},linebreakContainer:true,setTeXclass:a.mbase.setChildTeXclass,getAnnotation:function(e){if(this.data.length!=1){return null}return this.data[0].getAnnotation(e)}});a.chars=a.mbase.Subclass({type:"chars",Append:function(){this.data.push.apply(this.data,arguments)},value:function(){return this.data.join("")},toString:function(){return this.data.join("")}});a.entity=a.mbase.Subclass({type:"entity",Append:function(){this.data.push.apply(this.data,arguments)},value:function(){if(this.data[0].substr(0,2)==="#x"){return parseInt(this.data[0].substr(2),16)}else{if(this.data[0].substr(0,1)==="#"){return parseInt(this.data[0].substr(1))}else{return 0}}},toString:function(){var e=this.value();if(e<=65535){return String.fromCharCode(e)}e-=65536;return String.fromCharCode((e>>10)+55296)+String.fromCharCode((e&1023)+56320)}});a.xml=a.mbase.Subclass({type:"xml",Init:function(){this.div=document.createElement("div");return this.SUPER(arguments).Init.apply(this,arguments)},Append:function(){for(var f=0,e=arguments.length;f<e;f++){var g=this.Import(arguments[f]);this.data.push(g);this.div.appendChild(g)}},Import:function(j){if(document.importNode){return document.importNode(j,true)}var f,g,e;if(j.nodeType===1){f=document.createElement(j.nodeName);for(g=0,e=j.attributes.length;g<e;g++){var h=j.attributes[g];if(h.specified&&h.nodeValue!=null&&h.nodeValue!=""){f.setAttribute(h.nodeName,h.nodeValue)}if(h.nodeName==="style"){f.style.cssText=h.nodeValue}}if(j.className){f.className=j.className}}else{if(j.nodeType===3||j.nodeType===4){f=document.createTextNode(j.nodeValue)}else{if(j.nodeType===8){f=document.createComment(j.nodeValue)}else{return document.createTextNode("")}}}for(g=0,e=j.childNodes.length;g<e;g++){f.appendChild(this.Import(j.childNodes[g]))}return f},value:function(){return this.div},toString:function(){return this.div.innerHTML}});a.TeXAtom=a.mbase.Subclass({type:"texatom",inferRow:true,notParent:true,texClass:a.TEXCLASS.ORD,Core:a.mbase.childCore,CoreMO:a.mbase.childCoreMO,isEmbellished:a.mbase.childEmbellished,setTeXclass:function(e){this.data[0].setTeXclass();return this.adjustTeXclass(e)},adjustTeXclass:a.mo.prototype.adjustTeXclass});a.NULL=a.mbase().With({type:"null"});var b=a.TEXCLASS;var d={ORD:[0,0,b.ORD],ORD11:[1,1,b.ORD],ORD21:[2,1,b.ORD],ORD02:[0,2,b.ORD],ORD55:[5,5,b.ORD],OP:[1,2,b.OP,{largeop:true,movablelimits:true,symmetric:true}],OPFIXED:[1,2,b.OP,{largeop:true,movablelimits:true}],INTEGRAL:[0,1,b.OP,{largeop:true,symmetric:true}],INTEGRAL2:[1,2,b.OP,{largeop:true,symmetric:true}],BIN3:[3,3,b.BIN],BIN4:[4,4,b.BIN],BIN01:[0,1,b.BIN],BIN5:[5,5,b.BIN],TALLBIN:[4,4,b.BIN,{stretchy:true}],BINOP:[4,4,b.BIN,{largeop:true,movablelimits:true}],REL:[5,5,b.REL],REL1:[1,1,b.REL,{stretchy:true}],REL4:[4,4,b.REL],RELSTRETCH:[5,5,b.REL,{stretchy:true}],RELACCENT:[5,5,b.REL,{accent:true}],WIDEREL:[5,5,b.REL,{accent:true,stretchy:true}],OPEN:[0,0,b.OPEN,{fence:true,stretchy:true,symmetric:true}],CLOSE:[0,0,b.CLOSE,{fence:true,stretchy:true,symmetric:true}],INNER:[0,0,b.INNER],PUNCT:[0,3,b.PUNCT],ACCENT:[0,0,b.ORD,{accent:true}],WIDEACCENT:[0,0,b.ORD,{accent:true,stretchy:true}]};a.mo.Augment({SPACE:["0em","0.1111em","0.1667em","0.2222em","0.2667em","0.3333em"],RANGES:[[32,127,b.REL,"BasicLatin"],[160,255,b.ORD,"Latin1Supplement"],[256,383,b.ORD],[384,591,b.ORD],[688,767,b.ORD,"SpacingModLetters"],[768,879,b.ORD,"CombDiacritMarks"],[880,1023,b.ORD,"GreekAndCoptic"],[7680,7935,b.ORD],[8192,8303,b.PUNCT,"GeneralPunctuation"],[8304,8351,b.ORD],[8352,8399,b.ORD],[8400,8447,b.ORD,"CombDiactForSymbols"],[8448,8527,b.ORD,"LetterlikeSymbols"],[8528,8591,b.ORD],[8592,8703,b.REL,"Arrows"],[8704,8959,b.BIN,"MathOperators"],[8960,9215,b.ORD,"MiscTechnical"],[9312,9471,b.ORD],[9472,9631,b.ORD],[9632,9727,b.ORD,"GeometricShapes"],[9984,10175,b.ORD,"Dingbats"],[10176,10223,b.ORD,"MiscMathSymbolsA"],[10224,10239,b.REL,"SupplementalArrowsA"],[10496,10623,b.REL,"SupplementalArrowsB"],[10624,10751,b.ORD,"MiscMathSymbolsB"],[10752,11007,b.BIN,"SuppMathOperators"],[11008,11263,b.ORD,"MiscSymbolsAndArrows"],[119808,120831,b.ORD]],OPTABLE:{prefix:{"\u2200":d.ORD21,"\u2202":d.ORD21,"\u2203":d.ORD21,"\u2207":d.ORD21,"\u220F":d.OP,"\u2210":d.OP,"\u2211":d.OP,"\u2212":d.BIN01,"\u2213":d.BIN01,"\u221A":[1,1,b.ORD,{stretchy:true}],"\u2220":d.ORD,"\u222B":d.INTEGRAL,"\u222E":d.INTEGRAL,"\u22C0":d.OP,"\u22C1":d.OP,"\u22C2":d.OP,"\u22C3":d.OP,"\u2308":d.OPEN,"\u230A":d.OPEN,"\u27E8":d.OPEN,"\u27EE":d.OPEN,"\u2A00":d.OP,"\u2A01":d.OP,"\u2A02":d.OP,"\u2A04":d.OP,"\u2A06":d.OP,"\u00AC":d.ORD21,"\u00B1":d.BIN01,"(":d.OPEN,"+":d.BIN01,"-":d.BIN01,"[":d.OPEN,"{":d.OPEN,"|":d.OPEN},postfix:{"!":[1,0,b.CLOSE],"&":d.ORD,"\u2032":d.ORD02,"\u203E":d.WIDEACCENT,"\u2309":d.CLOSE,"\u230B":d.CLOSE,"\u23DE":d.WIDEACCENT,"\u23DF":d.WIDEACCENT,"\u266D":d.ORD02,"\u266E":d.ORD02,"\u266F":d.ORD02,"\u27E9":d.CLOSE,"\u27EF":d.CLOSE,"\u02C6":d.WIDEACCENT,"\u02C7":d.WIDEACCENT,"\u02C9":d.WIDEACCENT,"\u02CA":d.ACCENT,"\u02CB":d.ACCENT,"\u02D8":d.ACCENT,"\u02D9":d.ACCENT,"\u02DC":d.WIDEACCENT,"\u0302":d.WIDEACCENT,"\u00A8":d.ACCENT,"\u00AF":d.WIDEACCENT,")":d.CLOSE,"]":d.CLOSE,"^":d.WIDEACCENT,_:d.WIDEACCENT,"`":d.ACCENT,"|":d.CLOSE,"}":d.CLOSE,"~":d.WIDEACCENT},infix:{"":d.ORD,"%":[3,3,b.ORD],"\u2022":d.BIN4,"\u2026":d.INNER,"\u2044":d.TALLBIN,"\u2061":d.ORD,"\u2062":d.ORD,"\u2063":[0,0,b.ORD,{linebreakstyle:"after",separator:true}],"\u2064":d.ORD,"\u2190":d.WIDEREL,"\u2191":d.RELSTRETCH,"\u2192":d.WIDEREL,"\u2193":d.RELSTRETCH,"\u2194":d.WIDEREL,"\u2195":d.RELSTRETCH,"\u2196":d.RELSTRETCH,"\u2197":d.RELSTRETCH,"\u2198":d.RELSTRETCH,"\u2199":d.RELSTRETCH,"\u21A6":d.WIDEREL,"\u21A9":d.WIDEREL,"\u21AA":d.WIDEREL,"\u21BC":d.WIDEREL,"\u21BD":d.WIDEREL,"\u21C0":d.WIDEREL,"\u21C1":d.WIDEREL,"\u21CC":d.WIDEREL,"\u21D0":d.WIDEREL,"\u21D1":d.RELSTRETCH,"\u21D2":d.WIDEREL,"\u21D3":d.RELSTRETCH,"\u21D4":d.WIDEREL,"\u21D5":d.RELSTRETCH,"\u2208":d.REL,"\u2209":d.REL,"\u220B":d.REL,"\u2212":d.BIN4,"\u2213":d.BIN4,"\u2215":d.TALLBIN,"\u2216":d.BIN4,"\u2217":d.BIN4,"\u2218":d.BIN4,"\u2219":d.BIN4,"\u221D":d.REL,"\u2223":d.REL,"\u2225":d.REL,"\u2227":d.BIN4,"\u2228":d.BIN4,"\u2229":d.BIN4,"\u222A":d.BIN4,"\u223C":d.REL,"\u2240":d.BIN4,"\u2243":d.REL,"\u2245":d.REL,"\u2248":d.REL,"\u224D":d.REL,"\u2250":d.REL,"\u2260":d.REL,"\u2261":d.REL,"\u2264":d.REL,"\u2265":d.REL,"\u226A":d.REL,"\u226B":d.REL,"\u227A":d.REL,"\u227B":d.REL,"\u2282":d.REL,"\u2283":d.REL,"\u2286":d.REL,"\u2287":d.REL,"\u228E":d.BIN4,"\u2291":d.REL,"\u2292":d.REL,"\u2293":d.BIN4,"\u2294":d.BIN4,"\u2295":d.BIN4,"\u2296":d.BIN4,"\u2297":d.BIN4,"\u2298":d.BIN4,"\u2299":d.BIN4,"\u22A2":d.REL,"\u22A3":d.REL,"\u22A4":d.ORD55,"\u22A5":d.REL,"\u22A8":d.REL,"\u22C4":d.BIN4,"\u22C5":d.BIN4,"\u22C6":d.BIN4,"\u22C8":d.REL,"\u22EE":d.ORD55,"\u22EF":d.INNER,"\u22F1":[5,5,b.INNER],"\u25B3":d.BIN4,"\u25B5":d.BIN4,"\u25B9":d.BIN4,"\u25BD":d.BIN4,"\u25BF":d.BIN4,"\u25C3":d.BIN4,"\u2758":d.REL,"\u27F5":d.WIDEREL,"\u27F6":d.WIDEREL,"\u27F7":d.WIDEREL,"\u27F8":d.WIDEREL,"\u27F9":d.WIDEREL,"\u27FA":d.WIDEREL,"\u27FC":d.WIDEREL,"\u2A2F":d.BIN4,"\u2A3F":d.BIN4,"\u2AAF":d.REL,"\u2AB0":d.REL,"\u00B1":d.BIN4,"\u00B7":d.BIN4,"\u00D7":d.BIN4,"\u00F7":d.BIN4,"*":d.BIN3,"+":d.BIN4,",":[0,3,b.PUNCT,{linebreakstyle:"after",separator:true}],"-":d.BIN4,".":[3,3,b.ORD],"/":d.ORD11,":":[1,2,b.REL],";":[0,3,b.PUNCT,{linebreakstyle:"after",separator:true}],"<":d.REL,"=":d.REL,">":d.REL,"?":[1,1,b.CLOSE],"\\":d.ORD,"^":d.ORD11,_:d.ORD11,"|":[2,2,b.ORD,{fence:true,stretchy:true,symmetric:true}],"#":d.ORD,"$":d.ORD,"\u002E":[0,3,b.PUNCT,{separator:true}],"\u02B9":d.ORD,"\u0300":d.ACCENT,"\u0301":d.ACCENT,"\u0303":d.WIDEACCENT,"\u0304":d.ACCENT,"\u0306":d.ACCENT,"\u0307":d.ACCENT,"\u0308":d.ACCENT,"\u030C":d.ACCENT,"\u0332":d.WIDEACCENT,"\u0338":d.REL4,"\u2015":[0,0,b.ORD,{stretchy:true}],"\u2017":[0,0,b.ORD,{stretchy:true}],"\u2020":d.BIN3,"\u2021":d.BIN3,"\u20D7":d.ACCENT,"\u2111":d.ORD,"\u2113":d.ORD,"\u2118":d.ORD,"\u211C":d.ORD,"\u2205":d.ORD,"\u221E":d.ORD,"\u2305":d.BIN3,"\u2306":d.BIN3,"\u2322":d.REL4,"\u2323":d.REL4,"\u2329":d.OPEN,"\u232A":d.CLOSE,"\u23AA":d.ORD,"\u23AF":[0,0,b.ORD,{stretchy:true}],"\u23B0":d.OPEN,"\u23B1":d.CLOSE,"\u2500":d.ORD,"\u25EF":d.BIN3,"\u2660":d.ORD,"\u2661":d.ORD,"\u2662":d.ORD,"\u2663":d.ORD,"\u3008":d.OPEN,"\u3009":d.CLOSE,"\uFE37":d.WIDEACCENT,"\uFE38":d.WIDEACCENT}}},{OPTYPES:d});var c=a.mo.prototype.OPTABLE;c.infix["^"]=d.WIDEREL;c.infix._=d.WIDEREL;c.prefix["\u2223"]=d.OPEN;c.prefix["\u2225"]=d.OPEN;c.postfix["\u2223"]=d.CLOSE;c.postfix["\u2225"]=d.CLOSE})(MathJax.ElementJax.mml);MathJax.ElementJax.mml.loadComplete("jax.js");
MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function(){var b="2.5.0";var a=MathJax.ElementJax.mml;SETTINGS=MathJax.Hub.config.menuSettings;a.mbase.Augment({toMathML:function(k){var g=(this.inferred&&this.parent.inferRow);if(k==null){k=""}var e=this.type,d=this.toMathMLattributes();if(e==="mspace"){return k+"<"+e+d+" />"}var j=[],h=(this.isToken?"":k+(g?"":" "));for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){j.push(this.data[f].toMathML(h))}else{if(!this.isToken&&!this.isChars){j.push(h+"<mrow />")}}}if(this.isToken||this.isChars){return k+"<"+e+d+">"+j.join("")+"</"+e+">"}if(g){return j.join("\n")}if(j.length===0||(j.length===1&&j[0]==="")){return k+"<"+e+d+" />"}return k+"<"+e+d+">\n"+j.join("\n")+"\n"+k+"</"+e+">"},toMathMLattributes:function(){var h=(this.type==="mstyle"?a.math.prototype.defaults:this.defaults);var g=(this.attrNames||a.copyAttributeNames),f=a.skipAttributes,k=a.copyAttributes;var d=[];if(this.type==="math"&&(!this.attr||!this.attr.xmlns)){d.push('xmlns="http://www.w3.org/1998/Math/MathML"')}if(!this.attrNames){for(var j in h){if(!f[j]&&!k[j]&&h.hasOwnProperty(j)){if(this[j]!=null&&this[j]!==h[j]){if(this.Get(j,null,1)!==this[j]){d.push(j+'="'+this.toMathMLattribute(this[j])+'"')}}}}}for(var e=0,c=g.length;e<c;e++){if(k[g[e]]===1&&!h.hasOwnProperty(g[e])){continue}value=(this.attr||{})[g[e]];if(value==null){value=this[g[e]]}if(value!=null){d.push(g[e]+'="'+this.toMathMLquote(value)+'"')}}this.toMathMLclass(d);if(d.length){return" "+d.join(" ")}else{return""}},toMathMLclass:function(c){var e=[];if(this["class"]){e.push(this["class"])}if(this.isa(a.TeXAtom)&&SETTINGS.texHints){var d=["ORD","OP","BIN","REL","OPEN","CLOSE","PUNCT","INNER","VCENTER"][this.texClass];if(d){e.push("MJX-TeXAtom-"+d)}}if(this.mathvariant&&this.toMathMLvariants[this.mathvariant]){e.push("MJX"+this.mathvariant)}if(this.variantForm){e.push("MJX-variant")}if(e.length){c.unshift('class="'+e.join(" ")+'"')}},toMathMLattribute:function(c){if(typeof(c)==="string"&&c.replace(/ /g,"").match(/^(([-+])?(\d+(\.\d*)?|\.\d+))mu$/)){return(RegExp.$2||"")+((1/18)*RegExp.$3).toFixed(3).replace(/\.?0+$/,"")+"em"}else{if(this.toMathMLvariants[c]){return this.toMathMLvariants[c]}}return this.toMathMLquote(c)},toMathMLvariants:{"-tex-caligraphic":a.VARIANT.SCRIPT,"-tex-caligraphic-bold":a.VARIANT.BOLDSCRIPT,"-tex-oldstyle":a.VARIANT.NORMAL,"-tex-oldstyle-bold":a.VARIANT.BOLD,"-tex-mathit":a.VARIANT.ITALIC},toMathMLquote:function(f){f=String(f).split("");for(var g=0,d=f.length;g<d;g++){var k=f[g].charCodeAt(0);if(k<=55295||57344<=k){if(k>126||(k<32&&k!==10&&k!==13&&k!==9)){f[g]="&#x"+k.toString(16).toUpperCase()+";"}else{var j={"&":"&","<":"<",">":">",'"':"""}[f[g]];if(j){f[g]=j}}}else{if(g+1<d){var h=f[g+1].charCodeAt(0);var e=(((k-55296)<<10)+(h-56320)+65536);f[g]="&#x"+e.toString(16).toUpperCase()+";";f[g+1]="";g++}else{f[g]=""}}}return f.join("")}});a.math.Augment({toMathML:function(c,d){var f;if(c==null){c=""}if(d&&d.originalText&&SETTINGS.semantics){f=MathJax.InputJax[d.inputJax].annotationEncoding}var l=(this.data[0]&&this.data[0].data.length>1);var o=this.type,j=this.toMathMLattributes();var h=[],n=c+(f?" "+(l?" ":""):"")+" ";for(var g=0,e=this.data.length;g<e;g++){if(this.data[g]){h.push(this.data[g].toMathML(n))}else{h.push(n+"<mrow />")}}if(h.length===0||(h.length===1&&h[0]==="")){if(!f){return"<"+o+j+" />"}h.push(n+"<mrow />")}if(f){if(l){h.unshift(c+" <mrow>");h.push(c+" </mrow>")}h.unshift(c+" <semantics>");var k=d.originalText.replace(/[&<>]/g,function(i){return{">":">","<":"<","&":"&"}[i]});h.push(c+' <annotation encoding="'+f+'">'+k+"</annotation>");h.push(c+" </semantics>")}return c+"<"+o+j+">\n"+h.join("\n")+"\n"+c+"</"+o+">"}});a.msubsup.Augment({toMathML:function(h){var e=this.type;if(this.data[this.sup]==null){e="msub"}if(this.data[this.sub]==null){e="msup"}var d=this.toMathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.munderover.Augment({toMathML:function(h){var e=this.type;if(this.data[this.under]==null){e="mover"}if(this.data[this.over]==null){e="munder"}var d=this.toMathMLattributes();delete this.data[0].inferred;var g=[];for(var f=0,c=this.data.length;f<c;f++){if(this.data[f]){g.push(this.data[f].toMathML(h+" "))}}return h+"<"+e+d+">\n"+g.join("\n")+"\n"+h+"</"+e+">"}});a.TeXAtom.Augment({toMathML:function(d){var c=this.toMathMLattributes();if(!c&&this.data[0].data.length===1){return d.substr(2)+this.data[0].toMathML(d)}return d+"<mrow"+c+">\n"+this.data[0].toMathML(d+" ")+"\n"+d+"</mrow>"}});a.chars.Augment({toMathML:function(c){return(c||"")+this.toMathMLquote(this.toString())}});a.entity.Augment({toMathML:function(c){return(c||"")+"&"+this.data[0]+";<!-- "+this.toString()+" -->"}});a.xml.Augment({toMathML:function(c){return(c||"")+this.toString()}});MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function(){a.TeXmathchoice.Augment({toMathML:function(c){return this.Core().toMathML(c)}})});MathJax.Hub.Startup.signal.Post("toMathML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/toMathML.js");
(function(b,e){var d="2.5.0";var a=b.CombineConfig("TeX.noErrors",{disabled:false,multiLine:true,inlineDelimiters:["",""],style:{"font-size":"90%","text-align":"left",color:"black",padding:"1px 3px",border:"1px solid"}});var c="\u00A0";MathJax.Extension["TeX/noErrors"]={version:d,config:a};b.Register.StartupHook("TeX Jax Ready",function(){var f=MathJax.InputJax.TeX.formatError;MathJax.InputJax.TeX.Augment({formatError:function(j,i,k,g){if(a.disabled){return f.apply(this,arguments)}var h=j.message.replace(/\n.*/,"");b.signal.Post(["TeX Jax - parse error",h,i,k,g]);var m=a.inlineDelimiters;var l=(k||a.multiLine);if(!k){i=m[0]+i+m[1]}if(l){i=i.replace(/ /g,c)}else{i=i.replace(/\n/g," ")}return MathJax.ElementJax.mml.merror(i).With({isError:true,multiLine:l})}})});b.Register.StartupHook("HTML-CSS Jax Config",function(){b.Config({"HTML-CSS":{styles:{".MathJax .noError":b.Insert({"vertical-align":(b.Browser.isMSIE&&a.multiLine?"-2px":"")},a.style)}}})});b.Register.StartupHook("HTML-CSS Jax Ready",function(){var g=MathJax.ElementJax.mml;var h=MathJax.OutputJax["HTML-CSS"];var f=g.math.prototype.toHTML,i=g.merror.prototype.toHTML;g.math.Augment({toHTML:function(j,k){var l=this.data[0];if(l&&l.data[0]&&l.data[0].isError){j.style.fontSize="";j=this.HTMLcreateSpan(j);j.bbox=l.data[0].toHTML(j).bbox}else{j=f.call(this,j,k)}return j}});g.merror.Augment({toHTML:function(p){if(!this.isError){return i.call(this,p)}p=this.HTMLcreateSpan(p);p.className="noError";if(this.multiLine){p.style.display="inline-block"}var r=this.data[0].data[0].data.join("").split(/\n/);for(var o=0,l=r.length;o<l;o++){h.addText(p,r[o]);if(o!==l-1){h.addElement(p,"br",{isMathJax:true})}}var q=h.getHD(p.parentNode),k=h.getW(p.parentNode);if(l>1){var n=(q.h+q.d)/2,j=h.TeX.x_height/2;p.parentNode.style.verticalAlign=h.Em(q.d+(j-n));q.h=j+n;q.d=n-j}p.bbox={h:q.h,d:q.d,w:k,lw:0,rw:k};return p}})});b.Register.StartupHook("SVG Jax Config",function(){b.Config({SVG:{styles:{".MathJax_SVG .noError":b.Insert({"vertical-align":(b.Browser.isMSIE&&a.multiLine?"-2px":"")},a.style)}}})});b.Register.StartupHook("SVG Jax Ready",function(){var g=MathJax.ElementJax.mml;var f=g.math.prototype.toSVG,h=g.merror.prototype.toSVG;g.math.Augment({toSVG:function(i,j){var k=this.data[0];if(k&&k.data[0]&&k.data[0].isError){i=k.data[0].toSVG(i)}else{i=f.call(this,i,j)}return i}});g.merror.Augment({toSVG:function(n){if(!this.isError||this.Parent().type!=="math"){return h.call(this,n)}n=e.addElement(n,"span",{className:"noError",isMathJax:true});if(this.multiLine){n.style.display="inline-block"}var o=this.data[0].data[0].data.join("").split(/\n/);for(var l=0,j=o.length;l<j;l++){e.addText(n,o[l]);if(l!==j-1){e.addElement(n,"br",{isMathJax:true})}}if(j>1){var k=n.offsetHeight/2;n.style.verticalAlign=(-k+(k/j))+"px"}return n}})});b.Register.StartupHook("NativeMML Jax Ready",function(){var h=MathJax.ElementJax.mml;var g=MathJax.Extension["TeX/noErrors"].config;var f=h.math.prototype.toNativeMML,i=h.merror.prototype.toNativeMML;h.math.Augment({toNativeMML:function(j){var k=this.data[0];if(k&&k.data[0]&&k.data[0].isError){j=k.data[0].toNativeMML(j)}else{j=f.call(this,j)}return j}});h.merror.Augment({toNativeMML:function(n){if(!this.isError){return i.call(this,n)}n=n.appendChild(document.createElement("span"));var o=this.data[0].data[0].data.join("").split(/\n/);for(var l=0,k=o.length;l<k;l++){n.appendChild(document.createTextNode(o[l]));if(l!==k-1){n.appendChild(document.createElement("br"))}}if(this.multiLine){n.style.display="inline-block";if(k>1){n.style.verticalAlign="middle"}}for(var p in g.style){if(g.style.hasOwnProperty(p)){var j=p.replace(/-./g,function(m){return m.charAt(1).toUpperCase()});n.style[j]=g.style[p]}}return n}})});b.Register.StartupHook("CommonHTML Jax Config",function(){b.Config({CommonHTML:{styles:{".MathJax_CHTML .noError":b.Insert({"vertical-align":(b.Browser.isMSIE&&a.multiLine?"-2px":"")},a.style)}}})});b.Register.StartupHook("CommonHTML Jax Ready",function(){var f=MathJax.ElementJax.mml;var h=MathJax.HTML;var g=f.merror.prototype.toCommonHTML;f.merror.Augment({toCommonHTML:function(l){if(!this.isError){return g.call(this,l)}l=this.CHTMLcreateSpan(l);l.className="noError";if(this.multiLine){l.style.display="inline-block"}var n=this.data[0].data[0].data.join("").split(/\n/);for(var k=0,j=n.length;k<j;k++){h.addText(l,n[k]);if(k!==j-1){h.addElement(l,"br",{isMathJax:true})}}return l}})});b.Startup.signal.Post("TeX noErrors Ready")})(MathJax.Hub,MathJax.HTML);MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noErrors.js");
MathJax.Extension["TeX/noUndefined"]={version:"2.5.0",config:MathJax.Hub.CombineConfig("TeX.noUndefined",{disabled:false,attributes:{mathcolor:"red"}})};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b=MathJax.Extension["TeX/noUndefined"].config;var a=MathJax.ElementJax.mml;var c=MathJax.InputJax.TeX.Parse.prototype.csUndefined;MathJax.InputJax.TeX.Parse.Augment({csUndefined:function(d){if(b.disabled){return c.apply(this,arguments)}MathJax.Hub.signal.Post(["TeX Jax - undefined control sequence",d]);this.Push(a.mtext(d).With(b.attributes))}});MathJax.Hub.Startup.signal.Post("TeX noUndefined Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noUndefined.js");
(function(d,c,i){var h,g="\u00A0";var j=function(l){return MathJax.Localization._.apply(MathJax.Localization,[["TeX",l]].concat([].slice.call(arguments,1)))};var e=MathJax.Object.Subclass({Init:function(m,l){this.global={isInner:l};this.data=[b.start(this.global)];if(m){this.data[0].env=m}this.env=this.data[0].env},Push:function(){var n,l,o,p;for(n=0,l=arguments.length;n<l;n++){o=arguments[n];if(!o){continue}if(o instanceof h.mbase){o=b.mml(o)}o.global=this.global;p=(this.data.length?this.Top().checkItem(o):true);if(p instanceof Array){this.Pop();this.Push.apply(this,p)}else{if(p instanceof b){this.Pop();this.Push(p)}else{if(p){this.data.push(o);if(o.env){for(var q in this.env){if(this.env.hasOwnProperty(q)){o.env[q]=this.env[q]}}this.env=o.env}else{o.env=this.env}}}}}},Pop:function(){var l=this.data.pop();if(!l.isOpen){delete l.env}this.env=(this.data.length?this.Top().env:{});return l},Top:function(l){if(l==null){l=1}if(this.data.length<l){return null}return this.data[this.data.length-l]},Prev:function(l){var m=this.Top();if(l){return m.data[m.data.length-1]}else{return m.Pop()}},toString:function(){return"stack[\n "+this.data.join("\n ")+"\n]"}});var b=e.Item=MathJax.Object.Subclass({type:"base",endError:["ExtraOpenMissingClose","Extra open brace or missing close brace"],closeError:["ExtraCloseMissingOpen","Extra close brace or missing open brace"],rightError:["MissingLeftExtraRight","Missing \\left or extra \\right"],Init:function(){if(this.isOpen){this.env={}}this.data=[];this.Push.apply(this,arguments)},Push:function(){this.data.push.apply(this.data,arguments)},Pop:function(){return this.data.pop()},mmlData:function(l,m){if(l==null){l=true}if(this.data.length===1&&!m){return this.data[0]}return h.mrow.apply(h,this.data).With((l?{inferred:true}:{}))},checkItem:function(l){if(l.type==="over"&&this.isOpen){l.num=this.mmlData(false);this.data=[]}if(l.type==="cell"&&this.isOpen){if(l.linebreak){return false}d.Error(["Misplaced","Misplaced %1",l.name])}if(l.isClose&&this[l.type+"Error"]){d.Error(this[l.type+"Error"])}if(!l.isNotStack){return true}this.Push(l.data[0]);return false},With:function(l){for(var m in l){if(l.hasOwnProperty(m)){this[m]=l[m]}}return this},toString:function(){return this.type+"["+this.data.join("; ")+"]"}});b.start=b.Subclass({type:"start",isOpen:true,Init:function(l){this.SUPER(arguments).Init.call(this);this.global=l},checkItem:function(l){if(l.type==="stop"){return b.mml(this.mmlData())}return this.SUPER(arguments).checkItem.call(this,l)}});b.stop=b.Subclass({type:"stop",isClose:true});b.open=b.Subclass({type:"open",isOpen:true,stopError:["ExtraOpenMissingClose","Extra open brace or missing close brace"],checkItem:function(m){if(m.type==="close"){var l=this.mmlData();return b.mml(h.TeXAtom(l))}return this.SUPER(arguments).checkItem.call(this,m)}});b.close=b.Subclass({type:"close",isClose:true});b.prime=b.Subclass({type:"prime",checkItem:function(l){if(this.data[0].type!=="msubsup"){return[h.msup(this.data[0],this.data[1]),l]}this.data[0].SetData(this.data[0].sup,this.data[1]);return[this.data[0],l]}});b.subsup=b.Subclass({type:"subsup",stopError:["MissingScript","Missing superscript or subscript argument"],supError:["MissingOpenForSup","Missing open brace for superscript"],subError:["MissingOpenForSub","Missing open brace for subscript"],checkItem:function(l){if(l.type==="open"||l.type==="left"){return true}if(l.type==="mml"){if(this.primes){if(this.position!==2){this.data[0].SetData(2,this.primes)}else{l.data[0]=h.mrow(this.primes.With({variantForm:true}),l.data[0])}}this.data[0].SetData(this.position,l.data[0]);if(this.movesupsub!=null){this.data[0].movesupsub=this.movesupsub}return b.mml(this.data[0])}if(this.SUPER(arguments).checkItem.call(this,l)){d.Error(this[["","subError","supError"][this.position]])}},Pop:function(){}});b.over=b.Subclass({type:"over",isClose:true,name:"\\over",checkItem:function(n,l){if(n.type==="over"){d.Error(["AmbiguousUseOf","Ambiguous use of %1",n.name])}if(n.isClose){var m=h.mfrac(this.num,this.mmlData(false));if(this.thickness!=null){m.linethickness=this.thickness}if(this.open||this.close){m.texWithDelims=true;m=d.fixedFence(this.open,m,this.close)}return[b.mml(m),n]}return this.SUPER(arguments).checkItem.call(this,n)},toString:function(){return"over["+this.num+" / "+this.data.join("; ")+"]"}});b.left=b.Subclass({type:"left",isOpen:true,delim:"(",stopError:["ExtraLeftMissingRight","Extra \\left or missing \\right"],checkItem:function(l){if(l.type==="right"){return b.mml(d.fenced(this.delim,this.mmlData(),l.delim))}return this.SUPER(arguments).checkItem.call(this,l)}});b.right=b.Subclass({type:"right",isClose:true,delim:")"});b.begin=b.Subclass({type:"begin",isOpen:true,checkItem:function(l){if(l.type==="end"){if(l.name!==this.name){d.Error(["EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.name,l.name])}if(!this.end){return b.mml(this.mmlData())}return this.parse[this.end].call(this.parse,this,this.data)}if(l.type==="stop"){d.Error(["EnvMissingEnd","Missing \\end{%1}",this.name])}return this.SUPER(arguments).checkItem.call(this,l)}});b.end=b.Subclass({type:"end",isClose:true});b.style=b.Subclass({type:"style",checkItem:function(m){if(!m.isClose){return this.SUPER(arguments).checkItem.call(this,m)}var l=h.mstyle.apply(h,this.data).With(this.styles);return[b.mml(l),m]}});b.position=b.Subclass({type:"position",checkItem:function(m){if(m.isClose){d.Error(["MissingBoxFor","Missing box for %1",this.name])}if(m.isNotStack){var l=m.mmlData();switch(this.move){case"vertical":l=h.mpadded(l).With({height:this.dh,depth:this.dd,voffset:this.dh});return[b.mml(l)];case"horizontal":return[b.mml(this.left),m,b.mml(this.right)]}}return this.SUPER(arguments).checkItem.call(this,m)}});b.array=b.Subclass({type:"array",isOpen:true,arraydef:{},Init:function(){this.table=[];this.row=[];this.env={};this.frame=[];this.hfill=[];this.SUPER(arguments).Init.apply(this,arguments)},checkItem:function(m){if(m.isClose&&m.type!=="over"){if(m.isEntry){this.EndEntry();this.clearEnv();return false}if(m.isCR){this.EndEntry();this.EndRow();this.clearEnv();return false}this.EndTable();this.clearEnv();var l=h.mtable.apply(h,this.table).With(this.arraydef);if(this.frame.length===4){l.frame=(this.frame.dashed?"dashed":"solid")}else{if(this.frame.length){l.hasFrame=true;if(this.arraydef.rowlines){this.arraydef.rowlines=this.arraydef.rowlines.replace(/none( none)+$/,"none")}l=h.menclose(l).With({notation:this.frame.join(" "),isFrame:true});if((this.arraydef.columnlines||"none")!="none"||(this.arraydef.rowlines||"none")!="none"){l.padding=0}}}if(this.open||this.close){l=d.fenced(this.open,l,this.close)}l=b.mml(l);if(this.requireClose){if(m.type==="close"){return l}d.Error(["MissingCloseBrace","Missing close brace"])}return[l,m]}return this.SUPER(arguments).checkItem.call(this,m)},EndEntry:function(){var l=h.mtd.apply(h,this.data);if(this.hfill.length){if(this.hfill[0]===0){l.columnalign="right"}if(this.hfill[this.hfill.length-1]===this.data.length){l.columnalign=(l.columnalign?"center":"left")}}this.row.push(l);this.data=[];this.hfill=[]},EndRow:function(){var l=h.mtr;if(this.isNumbered&&this.row.length===3){this.row.unshift(this.row.pop());l=h.mlabeledtr}this.table.push(l.apply(h,this.row));this.row=[]},EndTable:function(){if(this.data.length||this.row.length){this.EndEntry();this.EndRow()}this.checkLines()},checkLines:function(){if(this.arraydef.rowlines){var l=this.arraydef.rowlines.split(/ /);if(l.length===this.table.length){this.frame.push("bottom");l.pop();this.arraydef.rowlines=l.join(" ")}else{if(l.length<this.table.length-1){this.arraydef.rowlines+=" none"}}}if(this.rowspacing){var m=this.arraydef.rowspacing.split(/ /);while(m.length<this.table.length){m.push(this.rowspacing+"em")}this.arraydef.rowspacing=m.join(" ")}},clearEnv:function(){for(var l in this.env){if(this.env.hasOwnProperty(l)){delete this.env[l]}}}});b.cell=b.Subclass({type:"cell",isClose:true});b.mml=b.Subclass({type:"mml",isNotStack:true,Add:function(){this.data.push.apply(this.data,arguments);return this}});b.fn=b.Subclass({type:"fn",checkItem:function(m){if(this.data[0]){if(m.type!=="mml"||!m.data[0]){return[this.data[0],m]}if(m.data[0].isa(h.mspace)){return[this.data[0],m]}var l=m.data[0];if(l.isEmbellished()){l=l.CoreMO()}if([0,0,1,1,0,1,1,0,0,0][l.Get("texClass")]){return[this.data[0],m]}return[this.data[0],h.mo(h.entity("#x2061")).With({texClass:h.TEXCLASS.NONE}),m]}return this.SUPER(arguments).checkItem.apply(this,arguments)}});b.not=b.Subclass({type:"not",checkItem:function(m){var l,n;if(m.type==="open"||m.type==="left"){return true}if(m.type==="mml"&&m.data[0].type.match(/^(mo|mi|mtext)$/)){l=m.data[0],n=l.data.join("");if(n.length===1&&!l.movesupsub){n=b.not.remap[n.charCodeAt(0)];if(n){l.SetData(0,h.chars(String.fromCharCode(n)))}else{l.Append(h.chars("\u0338"))}return m}}l=h.mpadded(h.mtext("\u29F8")).With({width:0});l=h.TeXAtom(l).With({texClass:h.TEXCLASS.REL});return[l,m]}});b.not.remap={8592:8602,8594:8603,8596:8622,8656:8653,8658:8655,8660:8654,8712:8713,8715:8716,8739:8740,8741:8742,8764:8769,126:8769,8771:8772,8773:8775,8776:8777,8781:8813,61:8800,8801:8802,60:8814,62:8815,8804:8816,8805:8817,8818:8820,8819:8821,8822:8824,8823:8825,8826:8832,8827:8833,8834:8836,8835:8837,8838:8840,8839:8841,8866:8876,8872:8877,8873:8878,8875:8879,8828:8928,8829:8929,8849:8930,8850:8931,8882:8938,8883:8939,8884:8940,8885:8941,8707:8708};b.dots=b.Subclass({type:"dots",checkItem:function(m){if(m.type==="open"||m.type==="left"){return true}var n=this.ldots;if(m.type==="mml"&&m.data[0].isEmbellished()){var l=m.data[0].CoreMO().Get("texClass");if(l===h.TEXCLASS.BIN||l===h.TEXCLASS.REL){n=this.cdots}}return[n,m]}});var f={Add:function(l,o,n){if(!o){o=this}for(var m in l){if(l.hasOwnProperty(m)){if(typeof l[m]==="object"&&!(l[m] instanceof Array)&&(typeof o[m]==="object"||typeof o[m]==="function")){this.Add(l[m],o[m],l[m],n)}else{if(!o[m]||!o[m].isUser||!n){o[m]=l[m]}}}}return o}};var k=function(){h=MathJax.ElementJax.mml;c.Insert(f,{letter:/[a-z]/i,digit:/[0-9.]/,number:/^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)*|\.[0-9]+)/,special:{"\\":"ControlSequence","{":"Open","}":"Close","~":"Tilde","^":"Superscript",_:"Subscript"," ":"Space","\t":"Space","\r":"Space","\n":"Space","'":"Prime","%":"Comment","&":"Entry","#":"Hash","\u00A0":"Space","\u2019":"Prime"},remap:{"-":"2212","*":"2217","`":"2018"},mathchar0mi:{alpha:"03B1",beta:"03B2",gamma:"03B3",delta:"03B4",epsilon:"03F5",zeta:"03B6",eta:"03B7",theta:"03B8",iota:"03B9",kappa:"03BA",lambda:"03BB",mu:"03BC",nu:"03BD",xi:"03BE",omicron:"03BF",pi:"03C0",rho:"03C1",sigma:"03C3",tau:"03C4",upsilon:"03C5",phi:"03D5",chi:"03C7",psi:"03C8",omega:"03C9",varepsilon:"03B5",vartheta:"03D1",varpi:"03D6",varrho:"03F1",varsigma:"03C2",varphi:"03C6",S:["00A7",{mathvariant:h.VARIANT.NORMAL}],aleph:["2135",{mathvariant:h.VARIANT.NORMAL}],hbar:["210F",{variantForm:true}],imath:"0131",jmath:"0237",ell:"2113",wp:["2118",{mathvariant:h.VARIANT.NORMAL}],Re:["211C",{mathvariant:h.VARIANT.NORMAL}],Im:["2111",{mathvariant:h.VARIANT.NORMAL}],partial:["2202",{mathvariant:h.VARIANT.NORMAL}],infty:["221E",{mathvariant:h.VARIANT.NORMAL}],prime:["2032",{mathvariant:h.VARIANT.NORMAL,variantForm:true}],emptyset:["2205",{mathvariant:h.VARIANT.NORMAL}],nabla:["2207",{mathvariant:h.VARIANT.NORMAL}],top:["22A4",{mathvariant:h.VARIANT.NORMAL}],bot:["22A5",{mathvariant:h.VARIANT.NORMAL}],angle:["2220",{mathvariant:h.VARIANT.NORMAL}],triangle:["25B3",{mathvariant:h.VARIANT.NORMAL}],backslash:["2216",{mathvariant:h.VARIANT.NORMAL,variantForm:true}],forall:["2200",{mathvariant:h.VARIANT.NORMAL}],exists:["2203",{mathvariant:h.VARIANT.NORMAL}],neg:["00AC",{mathvariant:h.VARIANT.NORMAL}],lnot:["00AC",{mathvariant:h.VARIANT.NORMAL}],flat:["266D",{mathvariant:h.VARIANT.NORMAL}],natural:["266E",{mathvariant:h.VARIANT.NORMAL}],sharp:["266F",{mathvariant:h.VARIANT.NORMAL}],clubsuit:["2663",{mathvariant:h.VARIANT.NORMAL}],diamondsuit:["2662",{mathvariant:h.VARIANT.NORMAL}],heartsuit:["2661",{mathvariant:h.VARIANT.NORMAL}],spadesuit:["2660",{mathvariant:h.VARIANT.NORMAL}]},mathchar0mo:{surd:"221A",coprod:["2210",{texClass:h.TEXCLASS.OP,movesupsub:true}],bigvee:["22C1",{texClass:h.TEXCLASS.OP,movesupsub:true}],bigwedge:["22C0",{texClass:h.TEXCLASS.OP,movesupsub:true}],biguplus:["2A04",{texClass:h.TEXCLASS.OP,movesupsub:true}],bigcap:["22C2",{texClass:h.TEXCLASS.OP,movesupsub:true}],bigcup:["22C3",{texClass:h.TEXCLASS.OP,movesupsub:true}],"int":["222B",{texClass:h.TEXCLASS.OP}],intop:["222B",{texClass:h.TEXCLASS.OP,movesupsub:true,movablelimits:true}],iint:["222C",{texClass:h.TEXCLASS.OP}],iiint:["222D",{texClass:h.TEXCLASS.OP}],prod:["220F",{texClass:h.TEXCLASS.OP,movesupsub:true}],sum:["2211",{texClass:h.TEXCLASS.OP,movesupsub:true}],bigotimes:["2A02",{texClass:h.TEXCLASS.OP,movesupsub:true}],bigoplus:["2A01",{texClass:h.TEXCLASS.OP,movesupsub:true}],bigodot:["2A00",{texClass:h.TEXCLASS.OP,movesupsub:true}],oint:["222E",{texClass:h.TEXCLASS.OP}],bigsqcup:["2A06",{texClass:h.TEXCLASS.OP,movesupsub:true}],smallint:["222B",{largeop:false}],triangleleft:"25C3",triangleright:"25B9",bigtriangleup:"25B3",bigtriangledown:"25BD",wedge:"2227",land:"2227",vee:"2228",lor:"2228",cap:"2229",cup:"222A",ddagger:"2021",dagger:"2020",sqcap:"2293",sqcup:"2294",uplus:"228E",amalg:"2A3F",diamond:"22C4",bullet:"2219",wr:"2240",div:"00F7",odot:["2299",{largeop:false}],oslash:["2298",{largeop:false}],otimes:["2297",{largeop:false}],ominus:["2296",{largeop:false}],oplus:["2295",{largeop:false}],mp:"2213",pm:"00B1",circ:"2218",bigcirc:"25EF",setminus:["2216",{variantForm:true}],cdot:"22C5",ast:"2217",times:"00D7",star:"22C6",propto:"221D",sqsubseteq:"2291",sqsupseteq:"2292",parallel:"2225",mid:"2223",dashv:"22A3",vdash:"22A2",leq:"2264",le:"2264",geq:"2265",ge:"2265",lt:"003C",gt:"003E",succ:"227B",prec:"227A",approx:"2248",succeq:"2AB0",preceq:"2AAF",supset:"2283",subset:"2282",supseteq:"2287",subseteq:"2286","in":"2208",ni:"220B",notin:"2209",owns:"220B",gg:"226B",ll:"226A",sim:"223C",simeq:"2243",perp:"22A5",equiv:"2261",asymp:"224D",smile:"2323",frown:"2322",ne:"2260",neq:"2260",cong:"2245",doteq:"2250",bowtie:"22C8",models:"22A8",notChar:"29F8",Leftrightarrow:"21D4",Leftarrow:"21D0",Rightarrow:"21D2",leftrightarrow:"2194",leftarrow:"2190",gets:"2190",rightarrow:"2192",to:"2192",mapsto:"21A6",leftharpoonup:"21BC",leftharpoondown:"21BD",rightharpoonup:"21C0",rightharpoondown:"21C1",nearrow:"2197",searrow:"2198",nwarrow:"2196",swarrow:"2199",rightleftharpoons:"21CC",hookrightarrow:"21AA",hookleftarrow:"21A9",longleftarrow:"27F5",Longleftarrow:"27F8",longrightarrow:"27F6",Longrightarrow:"27F9",Longleftrightarrow:"27FA",longleftrightarrow:"27F7",longmapsto:"27FC",ldots:"2026",cdots:"22EF",vdots:"22EE",ddots:"22F1",dotsc:"2026",dotsb:"22EF",dotsm:"22EF",dotsi:"22EF",dotso:"2026",ldotp:["002E",{texClass:h.TEXCLASS.PUNCT}],cdotp:["22C5",{texClass:h.TEXCLASS.PUNCT}],colon:["003A",{texClass:h.TEXCLASS.PUNCT}]},mathchar7:{Gamma:"0393",Delta:"0394",Theta:"0398",Lambda:"039B",Xi:"039E",Pi:"03A0",Sigma:"03A3",Upsilon:"03A5",Phi:"03A6",Psi:"03A8",Omega:"03A9",_:"005F","#":"0023","$":"0024","%":"0025","&":"0026",And:"0026"},delimiter:{"(":"(",")":")","[":"[","]":"]","<":"27E8",">":"27E9","\\lt":"27E8","\\gt":"27E9","/":"/","|":["|",{texClass:h.TEXCLASS.ORD}],".":"","\\\\":"\\","\\lmoustache":"23B0","\\rmoustache":"23B1","\\lgroup":"27EE","\\rgroup":"27EF","\\arrowvert":"23D0","\\Arrowvert":"2016","\\bracevert":"23AA","\\Vert":["2225",{texClass:h.TEXCLASS.ORD}],"\\|":["2225",{texClass:h.TEXCLASS.ORD}],"\\vert":["|",{texClass:h.TEXCLASS.ORD}],"\\uparrow":"2191","\\downarrow":"2193","\\updownarrow":"2195","\\Uparrow":"21D1","\\Downarrow":"21D3","\\Updownarrow":"21D5","\\backslash":"\\","\\rangle":"27E9","\\langle":"27E8","\\rbrace":"}","\\lbrace":"{","\\}":"}","\\{":"{","\\rceil":"2309","\\lceil":"2308","\\rfloor":"230B","\\lfloor":"230A","\\lbrack":"[","\\rbrack":"]"},macros:{displaystyle:["SetStyle","D",true,0],textstyle:["SetStyle","T",false,0],scriptstyle:["SetStyle","S",false,1],scriptscriptstyle:["SetStyle","SS",false,2],rm:["SetFont",h.VARIANT.NORMAL],mit:["SetFont",h.VARIANT.ITALIC],oldstyle:["SetFont",h.VARIANT.OLDSTYLE],cal:["SetFont",h.VARIANT.CALIGRAPHIC],it:["SetFont","-tex-mathit"],bf:["SetFont",h.VARIANT.BOLD],bbFont:["SetFont",h.VARIANT.DOUBLESTRUCK],scr:["SetFont",h.VARIANT.SCRIPT],frak:["SetFont",h.VARIANT.FRAKTUR],sf:["SetFont",h.VARIANT.SANSSERIF],tt:["SetFont",h.VARIANT.MONOSPACE],tiny:["SetSize",0.5],Tiny:["SetSize",0.6],scriptsize:["SetSize",0.7],small:["SetSize",0.85],normalsize:["SetSize",1],large:["SetSize",1.2],Large:["SetSize",1.44],LARGE:["SetSize",1.73],huge:["SetSize",2.07],Huge:["SetSize",2.49],arcsin:["NamedFn"],arccos:["NamedFn"],arctan:["NamedFn"],arg:["NamedFn"],cos:["NamedFn"],cosh:["NamedFn"],cot:["NamedFn"],coth:["NamedFn"],csc:["NamedFn"],deg:["NamedFn"],det:"NamedOp",dim:["NamedFn"],exp:["NamedFn"],gcd:"NamedOp",hom:["NamedFn"],inf:"NamedOp",ker:["NamedFn"],lg:["NamedFn"],lim:"NamedOp",liminf:["NamedOp","lim inf"],limsup:["NamedOp","lim sup"],ln:["NamedFn"],log:["NamedFn"],max:"NamedOp",min:"NamedOp",Pr:"NamedOp",sec:["NamedFn"],sin:["NamedFn"],sinh:["NamedFn"],sup:"NamedOp",tan:["NamedFn"],tanh:["NamedFn"],limits:["Limits",1],nolimits:["Limits",0],overline:["UnderOver","00AF"],underline:["UnderOver","005F"],overbrace:["UnderOver","23DE",1],underbrace:["UnderOver","23DF",1],overrightarrow:["UnderOver","2192"],underrightarrow:["UnderOver","2192"],overleftarrow:["UnderOver","2190"],underleftarrow:["UnderOver","2190"],overleftrightarrow:["UnderOver","2194"],underleftrightarrow:["UnderOver","2194"],overset:"Overset",underset:"Underset",stackrel:["Macro","\\mathrel{\\mathop{#2}\\limits^{#1}}",2],over:"Over",overwithdelims:"Over",atop:"Over",atopwithdelims:"Over",above:"Over",abovewithdelims:"Over",brace:["Over","{","}"],brack:["Over","[","]"],choose:["Over","(",")"],frac:"Frac",sqrt:"Sqrt",root:"Root",uproot:["MoveRoot","upRoot"],leftroot:["MoveRoot","leftRoot"],left:"LeftRight",right:"LeftRight",middle:"Middle",llap:"Lap",rlap:"Lap",raise:"RaiseLower",lower:"RaiseLower",moveleft:"MoveLeftRight",moveright:"MoveLeftRight",",":["Spacer",h.LENGTH.THINMATHSPACE],":":["Spacer",h.LENGTH.MEDIUMMATHSPACE],">":["Spacer",h.LENGTH.MEDIUMMATHSPACE],";":["Spacer",h.LENGTH.THICKMATHSPACE],"!":["Spacer",h.LENGTH.NEGATIVETHINMATHSPACE],enspace:["Spacer",".5em"],quad:["Spacer","1em"],qquad:["Spacer","2em"],thinspace:["Spacer",h.LENGTH.THINMATHSPACE],negthinspace:["Spacer",h.LENGTH.NEGATIVETHINMATHSPACE],hskip:"Hskip",hspace:"Hskip",kern:"Hskip",mskip:"Hskip",mspace:"Hskip",mkern:"Hskip",Rule:["Rule"],Space:["Rule","blank"],big:["MakeBig",h.TEXCLASS.ORD,0.85],Big:["MakeBig",h.TEXCLASS.ORD,1.15],bigg:["MakeBig",h.TEXCLASS.ORD,1.45],Bigg:["MakeBig",h.TEXCLASS.ORD,1.75],bigl:["MakeBig",h.TEXCLASS.OPEN,0.85],Bigl:["MakeBig",h.TEXCLASS.OPEN,1.15],biggl:["MakeBig",h.TEXCLASS.OPEN,1.45],Biggl:["MakeBig",h.TEXCLASS.OPEN,1.75],bigr:["MakeBig",h.TEXCLASS.CLOSE,0.85],Bigr:["MakeBig",h.TEXCLASS.CLOSE,1.15],biggr:["MakeBig",h.TEXCLASS.CLOSE,1.45],Biggr:["MakeBig",h.TEXCLASS.CLOSE,1.75],bigm:["MakeBig",h.TEXCLASS.REL,0.85],Bigm:["MakeBig",h.TEXCLASS.REL,1.15],biggm:["MakeBig",h.TEXCLASS.REL,1.45],Biggm:["MakeBig",h.TEXCLASS.REL,1.75],mathord:["TeXAtom",h.TEXCLASS.ORD],mathop:["TeXAtom",h.TEXCLASS.OP],mathopen:["TeXAtom",h.TEXCLASS.OPEN],mathclose:["TeXAtom",h.TEXCLASS.CLOSE],mathbin:["TeXAtom",h.TEXCLASS.BIN],mathrel:["TeXAtom",h.TEXCLASS.REL],mathpunct:["TeXAtom",h.TEXCLASS.PUNCT],mathinner:["TeXAtom",h.TEXCLASS.INNER],vcenter:["TeXAtom",h.TEXCLASS.VCENTER],mathchoice:["Extension","mathchoice"],buildrel:"BuildRel",hbox:["HBox",0],text:"HBox",mbox:["HBox",0],fbox:"FBox",strut:"Strut",mathstrut:["Macro","\\vphantom{(}"],phantom:"Phantom",vphantom:["Phantom",1,0],hphantom:["Phantom",0,1],smash:"Smash",acute:["Accent","00B4"],grave:["Accent","0060"],ddot:["Accent","00A8"],tilde:["Accent","007E"],bar:["Accent","00AF"],breve:["Accent","02D8"],check:["Accent","02C7"],hat:["Accent","005E"],vec:["Accent","2192"],dot:["Accent","02D9"],widetilde:["Accent","007E",1],widehat:["Accent","005E",1],matrix:"Matrix",array:"Matrix",pmatrix:["Matrix","(",")"],cases:["Matrix","{","","left left",null,".1em",null,true],eqalign:["Matrix",null,null,"right left",h.LENGTH.THICKMATHSPACE,".5em","D"],displaylines:["Matrix",null,null,"center",null,".5em","D"],cr:"Cr","\\":"CrLaTeX",newline:"Cr",hline:["HLine","solid"],hdashline:["HLine","dashed"],eqalignno:["Matrix",null,null,"right left",h.LENGTH.THICKMATHSPACE,".5em","D",null,"right"],leqalignno:["Matrix",null,null,"right left",h.LENGTH.THICKMATHSPACE,".5em","D",null,"left"],hfill:"HFill",hfil:"HFill",hfilll:"HFill",bmod:["Macro",'\\mmlToken{mo}[lspace="thickmathspace" rspace="thickmathspace"]{mod}'],pmod:["Macro","\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}",1],mod:["Macro","\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1",1],pod:["Macro","\\mathchoice{\\kern18mu}{\\kern8mu}{\\kern8mu}{\\kern8mu}(#1)",1],iff:["Macro","\\;\\Longleftrightarrow\\;"],skew:["Macro","{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}",3],mathcal:["Macro","{\\cal #1}",1],mathscr:["Macro","{\\scr #1}",1],mathrm:["Macro","{\\rm #1}",1],mathbf:["Macro","{\\bf #1}",1],mathbb:["Macro","{\\bbFont #1}",1],Bbb:["Macro","{\\bbFont #1}",1],mathit:["Macro","{\\it #1}",1],mathfrak:["Macro","{\\frak #1}",1],mathsf:["Macro","{\\sf #1}",1],mathtt:["Macro","{\\tt #1}",1],textrm:["Macro","\\mathord{\\rm\\text{#1}}",1],textit:["Macro","\\mathord{\\it\\text{#1}}",1],textbf:["Macro","\\mathord{\\bf\\text{#1}}",1],textsf:["Macro","\\mathord{\\sf\\text{#1}}",1],texttt:["Macro","\\mathord{\\tt\\text{#1}}",1],pmb:["Macro","\\rlap{#1}\\kern1px{#1}",1],TeX:["Macro","T\\kern-.14em\\lower.5ex{E}\\kern-.115em X"],LaTeX:["Macro","L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX"]," ":["Macro","\\text{ }"],not:"Not",dots:"Dots",space:"Tilde","\u00A0":"Tilde",begin:"BeginEnd",end:"BeginEnd",newcommand:["Extension","newcommand"],renewcommand:["Extension","newcommand"],newenvironment:["Extension","newcommand"],renewenvironment:["Extension","newcommand"],def:["Extension","newcommand"],let:["Extension","newcommand"],verb:["Extension","verb"],boldsymbol:["Extension","boldsymbol"],tag:["Extension","AMSmath"],notag:["Extension","AMSmath"],label:["Extension","AMSmath"],ref:["Extension","AMSmath"],eqref:["Extension","AMSmath"],nonumber:["Macro","\\notag"],unicode:["Extension","unicode"],color:"Color",href:["Extension","HTML"],"class":["Extension","HTML"],style:["Extension","HTML"],cssId:["Extension","HTML"],bbox:["Extension","bbox"],mmlToken:"MmlToken",require:"Require"},environment:{array:["AlignedArray"],matrix:["Array",null,null,null,"c"],pmatrix:["Array",null,"(",")","c"],bmatrix:["Array",null,"[","]","c"],Bmatrix:["Array",null,"\\{","\\}","c"],vmatrix:["Array",null,"\\vert","\\vert","c"],Vmatrix:["Array",null,"\\Vert","\\Vert","c"],cases:["Array",null,"\\{",".","ll",null,".2em","T"],equation:[null,"Equation"],"equation*":[null,"Equation"],eqnarray:["ExtensionEnv",null,"AMSmath"],"eqnarray*":["ExtensionEnv",null,"AMSmath"],align:["ExtensionEnv",null,"AMSmath"],"align*":["ExtensionEnv",null,"AMSmath"],aligned:["ExtensionEnv",null,"AMSmath"],multline:["ExtensionEnv",null,"AMSmath"],"multline*":["ExtensionEnv",null,"AMSmath"],split:["ExtensionEnv",null,"AMSmath"],gather:["ExtensionEnv",null,"AMSmath"],"gather*":["ExtensionEnv",null,"AMSmath"],gathered:["ExtensionEnv",null,"AMSmath"],alignat:["ExtensionEnv",null,"AMSmath"],"alignat*":["ExtensionEnv",null,"AMSmath"],alignedat:["ExtensionEnv",null,"AMSmath"]},p_height:1.2/0.85});if(this.config.Macros){var l=this.config.Macros;for(var m in l){if(l.hasOwnProperty(m)){if(typeof(l[m])==="string"){f.macros[m]=["Macro",l[m]]}else{f.macros[m]=["Macro"].concat(l[m])}f.macros[m].isUser=true}}}};var a=MathJax.Object.Subclass({Init:function(m,n){this.string=m;this.i=0;this.macroCount=0;var l;if(n){l={};for(var o in n){if(n.hasOwnProperty(o)){l[o]=n[o]}}}this.stack=d.Stack(l,!!n);this.Parse();this.Push(b.stop())},Parse:function(){var m,l;while(this.i<this.string.length){m=this.string.charAt(this.i++);l=m.charCodeAt(0);if(l>=55296&&l<56320){m+=this.string.charAt(this.i++)}if(f.special[m]){this[f.special[m]](m)}else{if(f.letter.test(m)){this.Variable(m)}else{if(f.digit.test(m)){this.Number(m)}else{this.Other(m)}}}}},Push:function(){this.stack.Push.apply(this.stack,arguments)},mml:function(){if(this.stack.Top().type!=="mml"){return null}return this.stack.Top().data[0]},mmlToken:function(l){return l},ControlSequence:function(o){var l=this.GetCS(),n=this.csFindMacro(l);if(n){if(!(n instanceof Array)){n=[n]}var m=n[0];if(!(m instanceof Function)){m=this[m]}m.apply(this,[o+l].concat(n.slice(1)))}else{if(f.mathchar0mi[l]){this.csMathchar0mi(l,f.mathchar0mi[l])}else{if(f.mathchar0mo[l]){this.csMathchar0mo(l,f.mathchar0mo[l])}else{if(f.mathchar7[l]){this.csMathchar7(l,f.mathchar7[l])}else{if(f.delimiter["\\"+l]!=null){this.csDelimiter(l,f.delimiter["\\"+l])}else{this.csUndefined(o+l)}}}}}},csFindMacro:function(l){return f.macros[l]},csMathchar0mi:function(l,n){var m={mathvariant:h.VARIANT.ITALIC};if(n instanceof Array){m=n[1];n=n[0]}this.Push(this.mmlToken(h.mi(h.entity("#x"+n)).With(m)))},csMathchar0mo:function(l,n){var m={stretchy:false};if(n instanceof Array){m=n[1];m.stretchy=false;n=n[0]}this.Push(this.mmlToken(h.mo(h.entity("#x"+n)).With(m)))},csMathchar7:function(l,n){var m={mathvariant:h.VARIANT.NORMAL};if(n instanceof Array){m=n[1];n=n[0]}if(this.stack.env.font){m.mathvariant=this.stack.env.font}this.Push(this.mmlToken(h.mi(h.entity("#x"+n)).With(m)))},csDelimiter:function(l,n){var m={};if(n instanceof Array){m=n[1];n=n[0]}if(n.length===4){n=h.entity("#x"+n)}else{n=h.chars(n)}this.Push(this.mmlToken(h.mo(n).With({fence:false,stretchy:false}).With(m)))},csUndefined:function(l){d.Error(["UndefinedControlSequence","Undefined control sequence %1",l])},Variable:function(m){var l={};if(this.stack.env.font){l.mathvariant=this.stack.env.font}this.Push(this.mmlToken(h.mi(h.chars(m)).With(l)))},Number:function(o){var l,m=this.string.slice(this.i-1).match(f.number);if(m){l=h.mn(m[0].replace(/[{}]/g,""));this.i+=m[0].length-1}else{l=h.mo(h.chars(o))}if(this.stack.env.font){l.mathvariant=this.stack.env.font}this.Push(this.mmlToken(l))},Open:function(l){this.Push(b.open())},Close:function(l){this.Push(b.close())},Tilde:function(l){this.Push(h.mtext(h.chars(g)))},Space:function(l){},Superscript:function(q){if(this.GetNext().match(/\d/)){this.string=this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1)}var p,n,o=this.stack.Top();if(o.type==="prime"){n=o.data[0];p=o.data[1];this.stack.Pop()}else{n=this.stack.Prev();if(!n){n=h.mi("")}}if(n.isEmbellishedWrapper){n=n.data[0].data[0]}var m=n.movesupsub,l=n.sup;if((n.type==="msubsup"&&n.data[n.sup])||(n.type==="munderover"&&n.data[n.over]&&!n.subsupOK)){d.Error(["DoubleExponent","Double exponent: use braces to clarify"])}if(n.type!=="msubsup"){if(m){if(n.type!=="munderover"||n.data[n.over]){if(n.movablelimits&&n.isa(h.mi)){n=this.mi2mo(n)}n=h.munderover(n,null,null).With({movesupsub:true})}l=n.over}else{n=h.msubsup(n,null,null);l=n.sup}}this.Push(b.subsup(n).With({position:l,primes:p,movesupsub:m}))},Subscript:function(q){if(this.GetNext().match(/\d/)){this.string=this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1)}var p,n,o=this.stack.Top();if(o.type==="prime"){n=o.data[0];p=o.data[1];this.stack.Pop()}else{n=this.stack.Prev();if(!n){n=h.mi("")}}if(n.isEmbellishedWrapper){n=n.data[0].data[0]}var m=n.movesupsub,l=n.sub;if((n.type==="msubsup"&&n.data[n.sub])||(n.type==="munderover"&&n.data[n.under]&&!n.subsupOK)){d.Error(["DoubleSubscripts","Double subscripts: use braces to clarify"])}if(n.type!=="msubsup"){if(m){if(n.type!=="munderover"||n.data[n.under]){if(n.movablelimits&&n.isa(h.mi)){n=this.mi2mo(n)}n=h.munderover(n,null,null).With({movesupsub:true})}l=n.under}else{n=h.msubsup(n,null,null);l=n.sub}}this.Push(b.subsup(n).With({position:l,primes:p,movesupsub:m}))},PRIME:"\u2032",SMARTQUOTE:"\u2019",Prime:function(n){var m=this.stack.Prev();if(!m){m=h.mi()}if(m.type==="msubsup"&&m.data[m.sup]){d.Error(["DoubleExponentPrime","Prime causes double exponent: use braces to clarify"])}var l="";this.i--;do{l+=this.PRIME;this.i++,n=this.GetNext()}while(n==="'"||n===this.SMARTQUOTE);l=["","\u2032","\u2033","\u2034","\u2057"][l.length]||l;this.Push(b.prime(m,this.mmlToken(h.mo(l))))},mi2mo:function(l){var m=h.mo();m.Append.apply(m,l.data);var n;for(n in m.defaults){if(m.defaults.hasOwnProperty(n)&&l[n]!=null){m[n]=l[n]}}for(n in h.copyAttributes){if(h.copyAttributes.hasOwnProperty(n)&&l[n]!=null){m[n]=l[n]}}return m},Comment:function(l){while(this.i<this.string.length&&this.string.charAt(this.i)!="\n"){this.i++}},Hash:function(l){d.Error(["CantUseHash1","You can't use 'macro parameter character #' in math mode"])},Other:function(n){var m,l;if(this.stack.env.font){m={mathvariant:this.stack.env.font}}if(f.remap[n]){n=f.remap[n];if(n instanceof Array){m=n[1];n=n[0]}l=h.mo(h.entity("#x"+n)).With(m)}else{l=h.mo(n).With(m)}if(l.autoDefault("stretchy",true)){l.stretchy=false}if(l.autoDefault("texClass",true)==""){l=h.TeXAtom(l)}this.Push(this.mmlToken(l))},SetFont:function(m,l){this.stack.env.font=l},SetStyle:function(m,l,n,o){this.stack.env.style=l;this.stack.env.level=o;this.Push(b.style().With({styles:{displaystyle:n,scriptlevel:o}}))},SetSize:function(l,m){this.stack.env.size=m;this.Push(b.style().With({styles:{mathsize:m+"em"}}))},Color:function(n){var m=this.GetArgument(n);var l=this.stack.env.color;this.stack.env.color=m;var o=this.ParseArg(n);if(l){this.stack.env.color}else{delete this.stack.env.color}this.Push(h.mstyle(o).With({mathcolor:m}))},Spacer:function(l,m){this.Push(h.mspace().With({width:m,mathsize:h.SIZE.NORMAL,scriptlevel:0}))},LeftRight:function(l){this.Push(b[l.substr(1)]().With({delim:this.GetDelimiter(l)}))},Middle:function(l){var m=this.GetDelimiter(l);if(this.stack.Top().type!=="left"){d.Error(["MisplacedMiddle","%1 must be within \\left and \\right",l])}this.Push(h.mo(m).With({stretchy:true}))},NamedFn:function(m,n){if(!n){n=m.substr(1)}var l=h.mi(n).With({texClass:h.TEXCLASS.OP});this.Push(b.fn(this.mmlToken(l)))},NamedOp:function(m,n){if(!n){n=m.substr(1)}n=n.replace(/ /,"\u2006");var l=h.mo(n).With({movablelimits:true,movesupsub:true,form:h.FORM.PREFIX,texClass:h.TEXCLASS.OP});l.useMMLspacing&=~l.SPACE_ATTR.form;this.Push(this.mmlToken(l))},Limits:function(m,l){var o=this.stack.Prev("nopop");if(!o||(o.Get("texClass")!==h.TEXCLASS.OP&&o.movesupsub==null)){d.Error(["MisplacedLimits","%1 is allowed only on operators",m])}var n=this.stack.Top();if(o.type==="munderover"&&!l){o=n.data[n.data.length-1]=h.msubsup.apply(h.subsup,o.data)}else{if(o.type==="msubsup"&&l){o=n.data[n.data.length-1]=h.munderover.apply(h.underover,o.data)}}o.movesupsub=(l?true:false);o.Core().movablelimits=false},Over:function(n,m,o){var l=b.over().With({name:n});if(m||o){l.open=m;l.close=o}else{if(n.match(/withdelims$/)){l.open=this.GetDelimiter(n);l.close=this.GetDelimiter(n)}}if(n.match(/^\\above/)){l.thickness=this.GetDimen(n)}else{if(n.match(/^\\atop/)||m||o){l.thickness=0}}this.Push(l)},Frac:function(m){var l=this.ParseArg(m);var n=this.ParseArg(m);this.Push(h.mfrac(l,n))},Sqrt:function(o){var p=this.GetBrackets(o),l=this.GetArgument(o);if(l==="\\frac"){l+="{"+this.GetArgument(l)+"}{"+this.GetArgument(l)+"}"}var m=d.Parse(l,this.stack.env).mml();if(!p){m=h.msqrt.apply(h,m.array())}else{m=h.mroot(m,this.parseRoot(p))}this.Push(m)},Root:function(m){var o=this.GetUpTo(m,"\\of");var l=this.ParseArg(m);this.Push(h.mroot(l,this.parseRoot(o)))},parseRoot:function(q){var m=this.stack.env,l=m.inRoot;m.inRoot=true;var p=d.Parse(q,m);q=p.mml();var o=p.stack.global;if(o.leftRoot||o.upRoot){q=h.mpadded(q);if(o.leftRoot){q.width=o.leftRoot}if(o.upRoot){q.voffset=o.upRoot;q.height=o.upRoot}}m.inRoot=l;return q},MoveRoot:function(l,o){if(!this.stack.env.inRoot){d.Error(["MisplacedMoveRoot","%1 can appear only within a root",l])}if(this.stack.global[o]){d.Error(["MultipleMoveRoot","Multiple use of %1",l])}var m=this.GetArgument(l);if(!m.match(/-?[0-9]+/)){d.Error(["IntegerArg","The argument to %1 must be an integer",l])}m=(m/15)+"em";if(m.substr(0,1)!=="-"){m="+"+m}this.stack.global[o]=m},Accent:function(n,l,q){var p=this.ParseArg(n);var o={accent:true};if(this.stack.env.font){o.mathvariant=this.stack.env.font}var m=this.mmlToken(h.mo(h.entity("#x"+l)).With(o));m.stretchy=(q?true:false);this.Push(h.TeXAtom(h.munderover(p,null,m).With({accent:true})))},UnderOver:function(n,q,l){var p={o:"over",u:"under"}[n.charAt(1)];var o=this.ParseArg(n);if(o.Get("movablelimits")){o.movablelimits=false}if(o.isa(h.munderover)&&o.isEmbellished()){o.Core().With({lspace:0,rspace:0});o=h.mrow(h.mo().With({rspace:0}),o)}var m=h.munderover(o,null,null);m.SetData(m[p],this.mmlToken(h.mo(h.entity("#x"+q)).With({stretchy:true,accent:(p==="under")})));if(l){m=h.TeXAtom(m).With({texClass:h.TEXCLASS.OP,movesupsub:true})}this.Push(m.With({subsupOK:true}))},Overset:function(l){var n=this.ParseArg(l),m=this.ParseArg(l);this.Push(h.mover(m,n))},Underset:function(l){var n=this.ParseArg(l),m=this.ParseArg(l);this.Push(h.munder(m,n))},TeXAtom:function(o,q){var p={texClass:q},n;if(q==h.TEXCLASS.OP){p.movesupsub=p.movablelimits=true;var l=this.GetArgument(o);var m=l.match(/^\s*\\rm\s+([a-zA-Z0-9 ]+)$/);if(m){p.mathvariant=h.VARIANT.NORMAL;n=b.fn(this.mmlToken(h.mi(m[1]).With(p)))}else{n=b.fn(h.TeXAtom(d.Parse(l,this.stack.env).mml()).With(p))}}else{n=h.TeXAtom(this.ParseArg(o)).With(p)}this.Push(n)},MmlToken:function(n){var o=this.GetArgument(n),l=this.GetBrackets(n,"").replace(/^\s+/,""),r=this.GetArgument(n),q={attrNames:[]},m;if(!h[o]||!h[o].prototype.isToken){d.Error(["NotMathMLToken","%1 is not a token element",o])}while(l!==""){m=l.match(/^([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^ ,]*)\s*,?\s*/i);if(!m){d.Error(["InvalidMathMLAttr","Invalid MathML attribute: %1",l])}if(h[o].prototype.defaults[m[1]]==null&&!this.MmlTokenAllow[m[1]]){d.Error(["UnknownAttrForElement","%1 is not a recognized attribute for %2",m[1],o])}var p=this.MmlFilterAttribute(m[1],m[2].replace(/^(['"])(.*)\1$/,"$2"));if(p){if(p.toLowerCase()==="true"){p=true}else{if(p.toLowerCase()==="false"){p=false}}q[m[1]]=p;q.attrNames.push(m[1])}l=l.substr(m[0].length)}this.Push(this.mmlToken(h[o](r).With(q)))},MmlFilterAttribute:function(l,m){return m},MmlTokenAllow:{fontfamily:1,fontsize:1,fontweight:1,fontstyle:1,color:1,background:1,id:1,"class":1,href:1,style:1},Strut:function(l){this.Push(h.mpadded(h.mrow()).With({height:"8.6pt",depth:"3pt",width:0}))},Phantom:function(m,l,n){var o=h.mphantom(this.ParseArg(m));if(l||n){o=h.mpadded(o);if(n){o.height=o.depth=0}if(l){o.width=0}}this.Push(h.TeXAtom(o))},Smash:function(n){var m=this.trimSpaces(this.GetBrackets(n,""));var l=h.mpadded(this.ParseArg(n));switch(m){case"b":l.depth=0;break;case"t":l.height=0;break;default:l.height=l.depth=0}this.Push(h.TeXAtom(l))},Lap:function(m){var l=h.mpadded(this.ParseArg(m)).With({width:0});if(m==="\\llap"){l.lspace="-1width"}this.Push(h.TeXAtom(l))},RaiseLower:function(l){var m=this.GetDimen(l);var n=b.position().With({name:l,move:"vertical"});if(m.charAt(0)==="-"){m=m.slice(1);l={raise:"\\lower",lower:"\\raise"}[l.substr(1)]}if(l==="\\lower"){n.dh="-"+m;n.dd="+"+m}else{n.dh="+"+m;n.dd="-"+m}this.Push(n)},MoveLeftRight:function(l){var o=this.GetDimen(l);var n=(o.charAt(0)==="-"?o.slice(1):"-"+o);if(l==="\\moveleft"){var m=o;o=n;n=m}this.Push(b.position().With({name:l,move:"horizontal",left:h.mspace().With({width:o,mathsize:h.SIZE.NORMAL}),right:h.mspace().With({width:n,mathsize:h.SIZE.NORMAL})}))},Hskip:function(l){this.Push(h.mspace().With({width:this.GetDimen(l),mathsize:h.SIZE.NORMAL}))},Rule:function(n,p){var l=this.GetDimen(n),o=this.GetDimen(n),r=this.GetDimen(n);var m,q={width:l,height:o,depth:r};if(p!=="blank"){if(parseFloat(l)&&parseFloat(o)+parseFloat(r)){q.mathbackground=(this.stack.env.color||"black")}m=h.mpadded(h.mrow()).With(q)}else{m=h.mspace().With(q)}this.Push(m)},MakeBig:function(l,o,m){m*=f.p_height;m=String(m).replace(/(\.\d\d\d).+/,"$1")+"em";var n=this.GetDelimiter(l,true);this.Push(h.TeXAtom(h.mo(n).With({minsize:m,maxsize:m,fence:true,stretchy:true,symmetric:true})).With({texClass:o}))},BuildRel:function(l){var m=this.ParseUpTo(l,"\\over");var n=this.ParseArg(l);this.Push(h.TeXAtom(h.munderover(n,null,m)).With({texClass:h.TEXCLASS.REL}))},HBox:function(l,m){this.Push.apply(this,this.InternalMath(this.GetArgument(l),m))},FBox:function(l){this.Push(h.menclose.apply(h,this.InternalMath(this.GetArgument(l))).With({notation:"box"}))},Not:function(l){this.Push(b.not())},Dots:function(l){this.Push(b.dots().With({ldots:this.mmlToken(h.mo(h.entity("#x2026")).With({stretchy:false})),cdots:this.mmlToken(h.mo(h.entity("#x22EF")).With({stretchy:false}))}))},Require:function(l){var m=this.GetArgument(l).replace(/.*\//,"").replace(/[^a-z0-9_.-]/ig,"");this.Extension(null,m)},Extension:function(l,m,n){if(l&&!typeof(l)==="string"){l=l.name}m=d.extensionDir+"/"+m;if(!m.match(/\.js$/)){m+=".js"}if(!i.loaded[i.fileURL(m)]){if(l!=null){delete f[n||"macros"][l.replace(/^\\/,"")]}c.RestartAfter(i.Require(m))}},Macro:function(n,q,p,r){if(p){var m=[];if(r!=null){var l=this.GetBrackets(n);m.push(l==null?r:l)}for(var o=m.length;o<p;o++){m.push(this.GetArgument(n))}q=this.SubstituteArgs(m,q)}this.string=this.AddArgs(q,this.string.slice(this.i));this.i=0;if(++this.macroCount>d.config.MAXMACROS){d.Error(["MaxMacroSub1","MathJax maximum macro substitution count exceeded; is there a recursive macro call?"])}},Matrix:function(m,o,u,q,t,n,l,v,s){var r=this.GetNext();if(r===""){d.Error(["MissingArgFor","Missing argument for %1",m])}if(r==="{"){this.i++}else{this.string=r+"}"+this.string.slice(this.i+1);this.i=0}var p=b.array().With({requireClose:true,arraydef:{rowspacing:(n||"4pt"),columnspacing:(t||"1em")}});if(v){p.isCases=true}if(s){p.isNumbered=true;p.arraydef.side=s}if(o||u){p.open=o;p.close=u}if(l==="D"){p.arraydef.displaystyle=true}if(q!=null){p.arraydef.columnalign=q}this.Push(p)},Entry:function(o){this.Push(b.cell().With({isEntry:true,name:o}));if(this.stack.Top().isCases){var n=this.string;var r=0,p=this.i,l=n.length;while(p<l){var s=n.charAt(p);if(s==="{"){r++;p++}else{if(s==="}"){if(r===0){l=0}else{r--;p++}}else{if(s==="&"&&r===0){d.Error(["ExtraAlignTab","Extra alignment tab in \\cases text"])}else{if(s==="\\"){if(n.substr(p).match(/^((\\cr)[^a-zA-Z]|\\\\)/)){l=0}else{p+=2}}else{p++}}}}}var q=n.substr(this.i,p-this.i);if(!q.match(/^\s*\\text[^a-zA-Z]/)){this.Push.apply(this,this.InternalMath(q));this.i=p}}},Cr:function(l){this.Push(b.cell().With({isCR:true,name:l}))},CrLaTeX:function(l){var p;if(this.string.charAt(this.i)==="["){p=this.GetBrackets(l,"").replace(/ /g,"").replace(/,/,".");if(p&&!this.matchDimen(p)){d.Error(["BracketMustBeDimension","Bracket argument to %1 must be a dimension",l])}}this.Push(b.cell().With({isCR:true,name:l,linebreak:true}));var o=this.stack.Top();if(o.isa(b.array)){if(p&&o.arraydef.rowspacing){var m=o.arraydef.rowspacing.split(/ /);if(!o.rowspacing){o.rowspacing=this.dimen2em(m[0])}while(m.length<o.table.length){m.push(this.Em(o.rowspacing))}m[o.table.length-1]=this.Em(Math.max(0,o.rowspacing+this.dimen2em(p)));o.arraydef.rowspacing=m.join(" ")}}else{if(p){this.Push(h.mspace().With({depth:p}))}this.Push(h.mspace().With({linebreak:h.LINEBREAK.NEWLINE}))}},emPerInch:7.2,pxPerInch:72,matchDimen:function(l){return l.match(/^(-?(?:\.\d+|\d+(?:\.\d*)?))(px|pt|em|ex|mu|pc|in|mm|cm)$/)},dimen2em:function(p){var n=this.matchDimen(p);var l=parseFloat(n[1]||"1"),o=n[2];if(o==="em"){return l}if(o==="ex"){return l*0.43}if(o==="pt"){return l/10}if(o==="pc"){return l*1.2}if(o==="px"){return l*this.emPerInch/this.pxPerInch}if(o==="in"){return l*this.emPerInch}if(o==="cm"){return l*this.emPerInch/2.54}if(o==="mm"){return l*this.emPerInch/25.4}if(o==="mu"){return l/18}return 0},Em:function(l){if(Math.abs(l)<0.0006){return"0em"}return l.toFixed(3).replace(/\.?0+$/,"")+"em"},HLine:function(m,n){if(n==null){n="solid"}var o=this.stack.Top();if(!o.isa(b.array)||o.data.length){d.Error(["Misplaced","Misplaced %1",m])}if(o.table.length==0){o.frame.push("top")}else{var l=(o.arraydef.rowlines?o.arraydef.rowlines.split(/ /):[]);while(l.length<o.table.length){l.push("none")}l[o.table.length-1]=n;o.arraydef.rowlines=l.join(" ")}},HFill:function(l){var m=this.stack.Top();if(m.isa(b.array)){m.hfill.push(m.data.length)}else{d.Error(["UnsupportedHFill","Unsupported use of %1",l])}},BeginEnd:function(n){var o=this.GetArgument(n),q=false;if(o.match(/^\\end\\/)){q=true;o=o.substr(5)}if(o.match(/\\/i)){d.Error(["InvalidEnv","Invalid environment name '%1'",o])}var p=this.envFindName(o);if(!p){d.Error(["UnknownEnv","Unknown environment '%1'",o])}if(!(p instanceof Array)){p=[p]}var l=(p[1] instanceof Array?p[1][0]:p[1]);var m=b.begin().With({name:o,end:l,parse:this});if(n==="\\end"){if(!q&&p[1] instanceof Array&&this[p[1][1]]){m=this[p[1][1]].apply(this,[m].concat(p.slice(2)))}else{m=b.end().With({name:o})}}else{if(++this.macroCount>d.config.MAXMACROS){d.Error(["MaxMacroSub2","MathJax maximum substitution count exceeded; is there a recursive latex environment?"])}if(p[0]&&this[p[0]]){m=this[p[0]].apply(this,[m].concat(p.slice(2)))}}this.Push(m)},envFindName:function(l){return f.environment[l]},Equation:function(l,m){return m},ExtensionEnv:function(m,l){this.Extension(m.name,l,"environment")},Array:function(m,o,t,r,s,n,l,p){if(!r){r=this.GetArgument("\\begin{"+m.name+"}")}var u=("c"+r).replace(/[^clr|:]/g,"").replace(/[^|:]([|:])+/g,"$1");r=r.replace(/[^clr]/g,"").split("").join(" ");r=r.replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center");var q=b.array().With({arraydef:{columnalign:r,columnspacing:(s||"1em"),rowspacing:(n||"4pt")}});if(u.match(/[|:]/)){if(u.charAt(0).match(/[|:]/)){q.frame.push("left");q.frame.dashed=u.charAt(0)===":"}if(u.charAt(u.length-1).match(/[|:]/)){q.frame.push("right")}u=u.substr(1,u.length-2);q.arraydef.columnlines=u.split("").join(" ").replace(/[^|: ]/g,"none").replace(/\|/g,"solid").replace(/:/g,"dashed")}if(o){q.open=this.convertDelimiter(o)}if(t){q.close=this.convertDelimiter(t)}if(l==="D"){q.arraydef.displaystyle=true}else{if(l){q.arraydef.displaystyle=false}}if(l==="S"){q.arraydef.scriptlevel=1}if(p){q.arraydef.useHeight=false}this.Push(m);return q},AlignedArray:function(l){var m=this.GetBrackets("\\begin{"+l.name+"}");return this.setArrayAlign(this.Array.apply(this,arguments),m)},setArrayAlign:function(m,l){l=this.trimSpaces(l||"");if(l==="t"){m.arraydef.align="baseline 1"}else{if(l==="b"){m.arraydef.align="baseline -1"}else{if(l==="c"){m.arraydef.align="center"}else{if(l){m.arraydef.align=l}}}}return m},convertDelimiter:function(l){if(l){l=f.delimiter[l]}if(l==null){return null}if(l instanceof Array){l=l[0]}if(l.length===4){l=String.fromCharCode(parseInt(l,16))}return l},trimSpaces:function(l){if(typeof(l)!="string"){return l}return l.replace(/^\s+|\s+$/g,"")},nextIsSpace:function(){return this.string.charAt(this.i).match(/\s/)},GetNext:function(){while(this.nextIsSpace()){this.i++}return this.string.charAt(this.i)},GetCS:function(){var l=this.string.slice(this.i).match(/^([a-z]+|.) ?/i);if(l){this.i+=l[1].length;return l[1]}else{this.i++;return" "}},GetArgument:function(m,n){switch(this.GetNext()){case"":if(!n){d.Error(["MissingArgFor","Missing argument for %1",m])}return null;case"}":if(!n){d.Error(["ExtraCloseMissingOpen","Extra close brace or missing open brace"])}return null;case"\\":this.i++;return"\\"+this.GetCS();case"{":var l=++this.i,o=1;while(this.i<this.string.length){switch(this.string.charAt(this.i++)){case"\\":this.i++;break;case"{":o++;break;case"}":if(--o==0){return this.string.slice(l,this.i-1)}break}}d.Error(["MissingCloseBrace","Missing close brace"]);break}return this.string.charAt(this.i++)},GetBrackets:function(m,o){if(this.GetNext()!="["){return o}var l=++this.i,n=0;while(this.i<this.string.length){switch(this.string.charAt(this.i++)){case"{":n++;break;case"\\":this.i++;break;case"}":if(n--<=0){d.Error(["ExtraCloseLooking","Extra close brace while looking for %1","']'"])}break;case"]":if(n==0){return this.string.slice(l,this.i-1)}break}}d.Error(["MissingCloseBracket","Couldn't find closing ']' for argument to %1",m])},GetDelimiter:function(l,m){while(this.nextIsSpace()){this.i++}var n=this.string.charAt(this.i);this.i++;if(this.i<=this.string.length){if(n=="\\"){n+=this.GetCS(l)}else{if(n==="{"&&m){this.i--;n=this.GetArgument(l)}}if(f.delimiter[n]!=null){return this.convertDelimiter(n)}}d.Error(["MissingOrUnrecognizedDelim","Missing or unrecognized delimiter for %1",l])},GetDimen:function(m){var n;if(this.nextIsSpace()){this.i++}if(this.string.charAt(this.i)=="{"){n=this.GetArgument(m);if(n.match(/^\s*([-+]?([.,]\d+|\d+([.,]\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)\s*$/)){return n.replace(/ /g,"").replace(/,/,".")}}else{n=this.string.slice(this.i);var l=n.match(/^\s*(([-+]?([.,]\d+|\d+([.,]\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)) ?/);if(l){this.i+=l[0].length;return l[1].replace(/ /g,"").replace(/,/,".")}}d.Error(["MissingDimOrUnits","Missing dimension or its units for %1",m])},GetUpTo:function(n,o){while(this.nextIsSpace()){this.i++}var m=this.i,l,q,p=0;while(this.i<this.string.length){l=this.i;q=this.string.charAt(this.i++);switch(q){case"\\":q+=this.GetCS();break;case"{":p++;break;case"}":if(p==0){d.Error(["ExtraCloseLooking","Extra close brace while looking for %1",o])}p--;break}if(p==0&&q==o){return this.string.slice(m,l)}}d.Error(["TokenNotFoundForCommand","Couldn't find %1 for %2",o,n])},ParseArg:function(l){return d.Parse(this.GetArgument(l),this.stack.env).mml()},ParseUpTo:function(l,m){return d.Parse(this.GetUpTo(l,m),this.stack.env).mml()},InternalMath:function(q,s){var p={displaystyle:false};if(s!=null){p.scriptlevel=s}if(this.stack.env.font){p.mathvariant=this.stack.env.font}if(!q.match(/\\?[${}\\]|\\\(|\\(eq)?ref\s*\{/)){return[this.InternalText(q,p)]}var o=0,l=0,r,n="";var m=[];while(o<q.length){r=q.charAt(o++);if(r==="$"){if(n==="$"){m.push(h.TeXAtom(d.Parse(q.slice(l,o-1),{}).mml().With(p)));n="";l=o}else{if(n===""){if(l<o-1){m.push(this.InternalText(q.slice(l,o-1),p))}n="$";l=o}}}else{if(r==="}"&&n==="}"){m.push(h.TeXAtom(d.Parse(q.slice(l,o),{}).mml().With(p)));n="";l=o}else{if(r==="\\"){if(n===""&&q.substr(o).match(/^(eq)?ref\s*\{/)){if(l<o-1){m.push(this.InternalText(q.slice(l,o-1),p))}n="}";l=o-1}else{r=q.charAt(o++);if(r==="("&&n===""){if(l<o-2){m.push(this.InternalText(q.slice(l,o-2),p))}n=")";l=o}else{if(r===")"&&n===")"){m.push(h.TeXAtom(d.Parse(q.slice(l,o-2),{}).mml().With(p)));n="";l=o}else{if(r.match(/[${}\\]/)&&n===""){o--;q=q.substr(0,o-1)+q.substr(o)}}}}}}}}if(n!==""){d.Error(["MathNotTerminated","Math not terminated in text box"])}if(l<q.length){m.push(this.InternalText(q.slice(l),p))}return m},InternalText:function(m,l){m=m.replace(/^\s+/,g).replace(/\s+$/,g);return h.mtext(h.chars(m)).With(l)},SubstituteArgs:function(m,l){var p="";var o="";var q;var n=0;while(n<l.length){q=l.charAt(n++);if(q==="\\"){p+=q+l.charAt(n++)}else{if(q==="#"){q=l.charAt(n++);if(q==="#"){p+=q}else{if(!q.match(/[1-9]/)||q>m.length){d.Error(["IllegalMacroParam","Illegal macro parameter reference"])}o=this.AddArgs(this.AddArgs(o,p),m[q-1]);p=""}}else{p+=q}}}return this.AddArgs(o,p)},AddArgs:function(m,l){if(l.match(/^[a-z]/i)&&m.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)){m+=" "}if(m.length+l.length>d.config.MAXBUFFER){d.Error(["MaxBufferSize","MathJax internal buffer size exceeded; is there a recursive macro call?"])}return m+l}});d.Augment({Stack:e,Parse:a,Definitions:f,Startup:k,config:{MAXMACROS:10000,MAXBUFFER:5*1024},sourceMenuTitle:["TeXCommands","TeX Commands"],annotationEncoding:"application/x-tex",prefilterHooks:MathJax.Callback.Hooks(true),postfilterHooks:MathJax.Callback.Hooks(true),Config:function(){this.SUPER(arguments).Config.apply(this,arguments);if(this.config.equationNumbers.autoNumber!=="none"){if(!this.config.extensions){this.config.extensions=[]}this.config.extensions.push("AMSmath.js")}},Translate:function(l){var m,n=false,p=MathJax.HTML.getScript(l);var r=(l.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/)!=null);var q={math:p,display:r,script:l};var s=this.prefilterHooks.Execute(q);if(s){return s}p=q.math;try{m=d.Parse(p).mml()}catch(o){if(!o.texError){throw o}m=this.formatError(o,p,r,l);n=true}if(m.isa(h.mtable)&&m.displaystyle==="inherit"){m.displaystyle=r}if(m.inferred){m=h.apply(MathJax.ElementJax,m.data)}else{m=h(m)}if(r){m.root.display="block"}if(n){m.texError=true}q.math=m;return this.postfilterHooks.Execute(q)||q.math},prefilterMath:function(m,n,l){return m},postfilterMath:function(m,n,l){this.combineRelations(m.root);return m},formatError:function(o,n,p,l){var m=o.message.replace(/\n.*/,"");c.signal.Post(["TeX Jax - parse error",m,n,p,l]);return h.Error(m)},Error:function(l){if(l instanceof Array){l=j.apply(j,l)}throw c.Insert(Error(l),{texError:true})},Macro:function(l,m,n){f.macros[l]=["Macro"].concat([].slice.call(arguments,1));f.macros[l].isUser=true},fenced:function(n,m,o){var l=h.mrow().With({open:n,close:o,texClass:h.TEXCLASS.INNER});l.Append(h.mo(n).With({fence:true,stretchy:true,texClass:h.TEXCLASS.OPEN}));if(m.type==="mrow"){l.Append.apply(l,m.data)}else{l.Append(m)}l.Append(h.mo(o).With({fence:true,stretchy:true,texClass:h.TEXCLASS.CLOSE}));return l},fixedFence:function(n,m,o){var l=h.mrow().With({open:n,close:o,texClass:h.TEXCLASS.ORD});if(n){l.Append(this.mathPalette(n,"l"))}if(m.type==="mrow"){l.Append.apply(l,m.data)}else{l.Append(m)}if(o){l.Append(this.mathPalette(o,"r"))}return l},mathPalette:function(o,m){if(o==="{"||o==="}"){o="\\"+o}var n="{\\bigg"+m+" "+o+"}",l="{\\big"+m+" "+o+"}";return d.Parse("\\mathchoice"+n+l+l+l).mml()},combineRelations:function(p){var q,l,o,n;for(q=0,l=p.data.length;q<l;q++){if(p.data[q]){if(p.isa(h.mrow)){while(q+1<l&&(o=p.data[q])&&(n=p.data[q+1])&&o.isa(h.mo)&&n.isa(h.mo)&&o.Get("texClass")===h.TEXCLASS.REL&&n.Get("texClass")===h.TEXCLASS.REL){if(o.variantForm==n.variantForm&&o.Get("mathvariant")==n.Get("mathvariant")&&o.style==n.style&&o["class"]==n["class"]&&!o.id&&!n.id){o.Append.apply(o,n.data);p.data.splice(q+1,1);l--}else{o.rspace=n.lspace="0pt";q++}}}if(!p.data[q].isToken){this.combineRelations(p.data[q])}}}}});d.prefilterHooks.Add(function(l){l.math=d.prefilterMath(l.math,l.display,l.script)});d.postfilterHooks.Add(function(l){l.math=d.postfilterMath(l.math,l.display,l.script)});d.loadComplete("jax.js")})(MathJax.InputJax.TeX,MathJax.Hub,MathJax.Ajax);
MathJax.Extension["TeX/AMSmath"]={version:"2.5.0",number:0,startNumber:0,IDs:{},eqIDs:{},labels:{},eqlabels:{},refs:[]};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b=MathJax.ElementJax.mml,g=MathJax.InputJax.TeX,f=MathJax.Extension["TeX/AMSmath"];var d=g.Definitions,e=g.Stack.Item,a=g.config.equationNumbers;var c=function(j){var l=[];for(var k=0,h=j.length;k<h;k++){l[k]=g.Parse.prototype.Em(j[k])}return l.join(" ")};d.Add({mathchar0mo:{iiiint:["2A0C",{texClass:b.TEXCLASS.OP}]},macros:{mathring:["Accent","2DA"],nobreakspace:"Tilde",negmedspace:["Spacer",b.LENGTH.NEGATIVEMEDIUMMATHSPACE],negthickspace:["Spacer",b.LENGTH.NEGATIVETHICKMATHSPACE],idotsint:["MultiIntegral","\\int\\cdots\\int"],dddot:["Accent","20DB"],ddddot:["Accent","20DC"],sideset:["Macro","\\mathop{\\mathop{\\rlap{\\phantom{#3}}}\\nolimits#1\\!\\mathop{#3}\\nolimits#2}",3],boxed:["Macro","\\fbox{$\\displaystyle{#1}$}",1],tag:"HandleTag",notag:"HandleNoTag",label:"HandleLabel",ref:"HandleRef",eqref:["HandleRef",true],substack:["Macro","\\begin{subarray}{c}#1\\end{subarray}",1],injlim:["NamedOp","inj lim"],projlim:["NamedOp","proj lim"],varliminf:["Macro","\\mathop{\\underline{\\mmlToken{mi}{lim}}}"],varlimsup:["Macro","\\mathop{\\overline{\\mmlToken{mi}{lim}}}"],varinjlim:["Macro","\\mathop{\\underrightarrow{\\mmlToken{mi}{lim}\\Rule{-1pt}{0pt}{1pt}}\\Rule{0pt}{0pt}{.45em}}"],varprojlim:["Macro","\\mathop{\\underleftarrow{\\mmlToken{mi}{lim}\\Rule{-1pt}{0pt}{1pt}}\\Rule{0pt}{0pt}{.45em}}"],DeclareMathOperator:"HandleDeclareOp",operatorname:"HandleOperatorName",genfrac:"Genfrac",frac:["Genfrac","","","",""],tfrac:["Genfrac","","","",1],dfrac:["Genfrac","","","",0],binom:["Genfrac","(",")","0",""],tbinom:["Genfrac","(",")","0",1],dbinom:["Genfrac","(",")","0",0],cfrac:"CFrac",shoveleft:["HandleShove",b.ALIGN.LEFT],shoveright:["HandleShove",b.ALIGN.RIGHT],xrightarrow:["xArrow",8594,5,6],xleftarrow:["xArrow",8592,7,3]},environment:{align:["AMSarray",null,true,true,"rlrlrlrlrlrl",c([0,2,0,2,0,2,0,2,0,2,0])],"align*":["AMSarray",null,false,true,"rlrlrlrlrlrl",c([0,2,0,2,0,2,0,2,0,2,0])],multline:["Multline",null,true],"multline*":["Multline",null,false],split:["AMSarray",null,false,false,"rl",c([0])],gather:["AMSarray",null,true,true,"c"],"gather*":["AMSarray",null,false,true,"c"],alignat:["AlignAt",null,true,true],"alignat*":["AlignAt",null,false,true],alignedat:["AlignAt",null,false,false],aligned:["AlignedAMSArray",null,null,null,"rlrlrlrlrlrl",c([0,2,0,2,0,2,0,2,0,2,0]),".5em","D"],gathered:["AlignedAMSArray",null,null,null,"c",null,".5em","D"],subarray:["Array",null,null,null,null,c([0,0,0,0]),"0.1em","S",1],smallmatrix:["Array",null,null,null,"c",c([1/3]),".2em","S",1],equation:["EquationBegin","Equation",true],"equation*":["EquationBegin","EquationStar",false],eqnarray:["AMSarray",null,true,true,"rcl",b.LENGTH.THICKMATHSPACE,".5em"],"eqnarray*":["AMSarray",null,false,true,"rcl",b.LENGTH.THICKMATHSPACE,".5em"]},delimiter:{"\\lvert":["2223",{texClass:b.TEXCLASS.OPEN}],"\\rvert":["2223",{texClass:b.TEXCLASS.CLOSE}],"\\lVert":["2225",{texClass:b.TEXCLASS.OPEN}],"\\rVert":["2225",{texClass:b.TEXCLASS.CLOSE}]}},null,true);g.Parse.Augment({HandleTag:function(j){var l=this.GetStar();var i=this.trimSpaces(this.GetArgument(j)),h=i;if(!l){i=a.formatTag(i)}var k=this.stack.global;k.tagID=h;if(k.notags){g.Error(["CommandNotAllowedInEnv","%1 not allowed in %2 environment",j,k.notags])}if(k.tag){g.Error(["MultipleCommand","Multiple %1",j])}k.tag=b.mtd.apply(b,this.InternalMath(i)).With({id:a.formatID(h)})},HandleNoTag:function(h){if(this.stack.global.tag){delete this.stack.global.tag}this.stack.global.notag=true},HandleLabel:function(i){var j=this.stack.global,h=this.GetArgument(i);if(h===""){return}if(!f.refUpdate){if(j.label){g.Error(["MultipleCommand","Multiple %1",i])}j.label=h;if(f.labels[h]||f.eqlabels[h]){g.Error(["MultipleLabel","Label '%1' multiply defined",h])}f.eqlabels[h]={tag:"???",id:""}}},HandleRef:function(j,l){var i=this.GetArgument(j);var k=f.labels[i]||f.eqlabels[i];if(!k){k={tag:"???",id:""};f.badref=!f.refUpdate}var h=k.tag;if(l){h=a.formatTag(h)}this.Push(b.mrow.apply(b,this.InternalMath(h)).With({href:a.formatURL(k.id),"class":"MathJax_ref"}))},HandleDeclareOp:function(i){var h=(this.GetStar()?"":"\\nolimits");var j=this.trimSpaces(this.GetArgument(i));if(j.charAt(0)=="\\"){j=j.substr(1)}var k=this.GetArgument(i);k=k.replace(/\*/g,"\\text{*}").replace(/-/g,"\\text{-}");g.Definitions.macros[j]=["Macro","\\mathop{\\rm "+k+"}"+h]},HandleOperatorName:function(i){var h=(this.GetStar()?"":"\\nolimits");var j=this.trimSpaces(this.GetArgument(i));j=j.replace(/\*/g,"\\text{*}").replace(/-/g,"\\text{-}");this.string="\\mathop{\\rm "+j+"}"+h+" "+this.string.slice(this.i);this.i=0},HandleShove:function(i,h){var j=this.stack.Top();if(j.type!=="multline"||j.data.length){g.Error(["CommandAtTheBeginingOfLine","%1 must come at the beginning of the line",i])}j.data.shove=h},CFrac:function(k){var h=this.trimSpaces(this.GetBrackets(k,"")),j=this.GetArgument(k),l=this.GetArgument(k);var i=b.mfrac(g.Parse("\\strut\\textstyle{"+j+"}",this.stack.env).mml(),g.Parse("\\strut\\textstyle{"+l+"}",this.stack.env).mml());h=({l:b.ALIGN.LEFT,r:b.ALIGN.RIGHT,"":""})[h];if(h==null){g.Error(["IllegalAlign","Illegal alignment specified in %1",k])}if(h){i.numalign=i.denomalign=h}this.Push(i)},Genfrac:function(i,k,p,m,h){if(k==null){k=this.GetDelimiterArg(i)}else{k=this.convertDelimiter(k)}if(p==null){p=this.GetDelimiterArg(i)}else{p=this.convertDelimiter(p)}if(m==null){m=this.GetArgument(i)}if(h==null){h=this.trimSpaces(this.GetArgument(i))}var l=this.ParseArg(i);var o=this.ParseArg(i);var j=b.mfrac(l,o);if(m!==""){j.linethickness=m}if(k||p){j=g.fixedFence(k,j.With({texWithDelims:true}),p)}if(h!==""){var n=(["D","T","S","SS"])[h];if(n==null){g.Error(["BadMathStyleFor","Bad math style for %1",i])}j=b.mstyle(j);if(n==="D"){j.displaystyle=true;j.scriptlevel=0}else{j.displaystyle=false;j.scriptlevel=h-1}}this.Push(j)},Multline:function(i,h){this.Push(i);this.checkEqnEnv();return e.multline(h,this.stack).With({arraydef:{displaystyle:true,rowspacing:".5em",width:g.config.MultLineWidth,columnwidth:"100%",side:g.config.TagSide,minlabelspacing:g.config.TagIndent}})},AMSarray:function(j,i,h,l,k){this.Push(j);if(h){this.checkEqnEnv()}l=l.replace(/[^clr]/g,"").split("").join(" ");l=l.replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center");return e.AMSarray(j.name,i,h,this.stack).With({arraydef:{displaystyle:true,rowspacing:".5em",columnalign:l,columnspacing:(k||"1em"),rowspacing:"3pt",side:g.config.TagSide,minlabelspacing:g.config.TagIndent}})},AlignedAMSArray:function(h){var i=this.GetBrackets("\\begin{"+h.name+"}");return this.setArrayAlign(this.AMSarray.apply(this,arguments),i)},AlignAt:function(k,i,h){var p,j,o="",m=[];if(!h){j=this.GetBrackets("\\begin{"+k.name+"}")}p=this.GetArgument("\\begin{"+k.name+"}");if(p.match(/[^0-9]/)){g.Error(["PositiveIntegerArg","Argument to %1 must me a positive integer","\\begin{"+k.name+"}"])}while(p>0){o+="rl";m.push("0em 0em");p--}m=m.join(" ");if(h){return this.AMSarray(k,i,h,o,m)}var l=this.Array.call(this,k,null,null,o,m,".5em","D");return this.setArrayAlign(l,j)},EquationBegin:function(h,i){this.checkEqnEnv();this.stack.global.forcetag=(i&&a.autoNumber!=="none");return h},EquationStar:function(h,i){this.stack.global.tagged=true;return i},checkEqnEnv:function(){if(this.stack.global.eqnenv){g.Error(["ErroneousNestingEq","Erroneous nesting of equation structures"])}this.stack.global.eqnenv=true},MultiIntegral:function(h,l){var k=this.GetNext();if(k==="\\"){var j=this.i;k=this.GetArgument(h);this.i=j;if(k==="\\limits"){if(h==="\\idotsint"){l="\\!\\!\\mathop{\\,\\,"+l+"}"}else{l="\\!\\!\\!\\mathop{\\,\\,\\,"+l+"}"}}}this.string=l+" "+this.string.slice(this.i);this.i=0},xArrow:function(j,n,m,h){var k={width:"+"+(m+h)+"mu",lspace:m+"mu"};var o=this.GetBrackets(j),p=this.ParseArg(j);var q=b.mo(b.chars(String.fromCharCode(n))).With({stretchy:true,texClass:b.TEXCLASS.REL});var i=b.munderover(q);i.SetData(i.over,b.mpadded(p).With(k).With({voffset:".15em"}));if(o){o=g.Parse(o,this.stack.env).mml();i.SetData(i.under,b.mpadded(o).With(k).With({voffset:"-.24em"}))}this.Push(i.With({subsupOK:true}))},GetDelimiterArg:function(h){var i=this.trimSpaces(this.GetArgument(h));if(i==""){return null}if(d.delimiter[i]==null){g.Error(["MissingOrUnrecognizedDelim","Missing or unrecognized delimiter for %1",h])}return this.convertDelimiter(i)},GetStar:function(){var h=(this.GetNext()==="*");if(h){this.i++}return h}});e.Augment({autoTag:function(){var i=this.global;if(!i.notag){f.number++;i.tagID=a.formatNumber(f.number.toString());var h=g.Parse("\\text{"+a.formatTag(i.tagID)+"}",{}).mml();i.tag=b.mtd(h).With({id:a.formatID(i.tagID)})}},getTag:function(){var l=this.global,j=l.tag;l.tagged=true;if(l.label){if(a.useLabelIds){j.id=a.formatID(l.label)}f.eqlabels[l.label]={tag:l.tagID,id:j.id}}if(document.getElementById(j.id)||f.IDs[j.id]||f.eqIDs[j.id]){var k=0,h;do{k++;h=j.id+"_"+k}while(document.getElementById(h)||f.IDs[h]||f.eqIDs[h]);j.id=h;if(l.label){f.eqlabels[l.label].id=h}}f.eqIDs[j.id]=1;this.clearTag();return j},clearTag:function(){var h=this.global;delete h.tag;delete h.tagID;delete h.label},fixInitialMO:function(k){for(var j=0,h=k.length;j<h;j++){if(k[j]&&(k[j].type!=="mspace"&&(k[j].type!=="texatom"||(k[j].data[0]&&k[j].data[0].data.length)))){if(k[j].isEmbellished()){k.unshift(b.mi())}break}}}});e.multline=e.array.Subclass({type:"multline",Init:function(i,h){this.SUPER(arguments).Init.apply(this);this.numbered=(i&&a.autoNumber!=="none");this.save={notag:h.global.notag};h.global.tagged=!i&&!h.global.forcetag},EndEntry:function(){if(this.table.length){this.fixInitialMO(this.data)}var h=b.mtd.apply(b,this.data);if(this.data.shove){h.columnalign=this.data.shove}this.row.push(h);this.data=[]},EndRow:function(){if(this.row.length!=1){g.Error(["MultlineRowsOneCol","The rows within the %1 environment must have exactly one column","multline"])}this.table.push(this.row);this.row=[]},EndTable:function(){this.SUPER(arguments).EndTable.call(this);if(this.table.length){var j=this.table.length-1,l,k=-1;if(!this.table[0][0].columnalign){this.table[0][0].columnalign=b.ALIGN.LEFT}if(!this.table[j][0].columnalign){this.table[j][0].columnalign=b.ALIGN.RIGHT}if(!this.global.tag&&this.numbered){this.autoTag()}if(this.global.tag&&!this.global.notags){k=(this.arraydef.side==="left"?0:this.table.length-1);this.table[k]=[this.getTag()].concat(this.table[k])}for(l=0,j=this.table.length;l<j;l++){var h=(l===k?b.mlabeledtr:b.mtr);this.table[l]=h.apply(b,this.table[l])}}this.global.notag=this.save.notag}});e.AMSarray=e.array.Subclass({type:"AMSarray",Init:function(k,j,i,h){this.SUPER(arguments).Init.apply(this);this.numbered=(j&&a.autoNumber!=="none");this.save={notags:h.global.notags,notag:h.global.notag};h.global.notags=(i?null:k);h.global.tagged=!j&&!h.global.forcetag},EndEntry:function(){if(this.row.length){this.fixInitialMO(this.data)}this.row.push(b.mtd.apply(b,this.data));this.data=[]},EndRow:function(){var h=b.mtr;if(!this.global.tag&&this.numbered){this.autoTag()}if(this.global.tag&&!this.global.notags){this.row=[this.getTag()].concat(this.row);h=b.mlabeledtr}else{this.clearTag()}if(this.numbered){delete this.global.notag}this.table.push(h.apply(b,this.row));this.row=[]},EndTable:function(){this.SUPER(arguments).EndTable.call(this);this.global.notags=this.save.notags;this.global.notag=this.save.notag}});e.start.Augment({oldCheckItem:e.start.prototype.checkItem,checkItem:function(j){if(j.type==="stop"){var h=this.mmlData(),i=this.global;if(f.display&&!i.tag&&!i.tagged&&!i.isInner&&(a.autoNumber==="all"||i.forcetag)){this.autoTag()}if(i.tag){var l=[this.getTag(),b.mtd(h)];var k={side:g.config.TagSide,minlabelspacing:g.config.TagIndent,columnalign:h.displayAlign,displaystyle:"inherit"};if(h.displayAlign===b.INDENTALIGN.LEFT){k.width="100%";if(h.displayIndent!=="0"){k.columnwidth=h.displayIndent+" fit";k.columnspacing="0";l=[l[0],b.mtd(),l[1]]}}else{if(h.displayAlign===b.INDENTALIGN.RIGHT){k.width="100%";if(h.displayIndent!=="0"){k.columnwidth="fit "+h.displayIndent;k.columnspacing="0";l[2]=b.mtd()}}}h=b.mtable(b.mlabeledtr.apply(b,l)).With(k)}return e.mml(h)}return this.oldCheckItem.call(this,j)}});g.prefilterHooks.Add(function(h){f.display=h.display;f.number=f.startNumber;f.eqlabels=f.eqIDs={};f.badref=false;if(f.refUpdate){f.number=h.script.MathJax.startNumber}});g.postfilterHooks.Add(function(h){h.script.MathJax.startNumber=f.startNumber;f.startNumber=f.number;MathJax.Hub.Insert(f.IDs,f.eqIDs);MathJax.Hub.Insert(f.labels,f.eqlabels);if(f.badref&&!h.math.texError){f.refs.push(h.script)}},100);MathJax.Hub.Register.MessageHook("Begin Math Input",function(){f.refs=[];f.refUpdate=false});MathJax.Hub.Register.MessageHook("End Math Input",function(k){if(f.refs.length){f.refUpdate=true;for(var j=0,h=f.refs.length;j<h;j++){f.refs[j].MathJax.state=MathJax.ElementJax.STATE.UPDATE}return MathJax.Hub.processInput({scripts:f.refs,start:new Date().getTime(),i:0,j:0,jax:{},jaxIDs:[]})}return null});g.resetEquationNumbers=function(i,h){f.startNumber=(i||0);if(!h){f.labels=f.IDs={}}};MathJax.Hub.Startup.signal.Post("TeX AMSmath Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/AMSmath.js");
MathJax.Extension["TeX/AMSsymbols"]={version:"2.5.0"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var a=MathJax.ElementJax.mml,b=MathJax.InputJax.TeX.Definitions;b.Add({mathchar0mi:{digamma:"03DD",varkappa:"03F0",varGamma:["0393",{mathvariant:a.VARIANT.ITALIC}],varDelta:["0394",{mathvariant:a.VARIANT.ITALIC}],varTheta:["0398",{mathvariant:a.VARIANT.ITALIC}],varLambda:["039B",{mathvariant:a.VARIANT.ITALIC}],varXi:["039E",{mathvariant:a.VARIANT.ITALIC}],varPi:["03A0",{mathvariant:a.VARIANT.ITALIC}],varSigma:["03A3",{mathvariant:a.VARIANT.ITALIC}],varUpsilon:["03A5",{mathvariant:a.VARIANT.ITALIC}],varPhi:["03A6",{mathvariant:a.VARIANT.ITALIC}],varPsi:["03A8",{mathvariant:a.VARIANT.ITALIC}],varOmega:["03A9",{mathvariant:a.VARIANT.ITALIC}],beth:"2136",gimel:"2137",daleth:"2138",backprime:["2035",{variantForm:true}],hslash:"210F",varnothing:["2205",{variantForm:true}],blacktriangle:"25B4",triangledown:["25BD",{variantForm:true}],blacktriangledown:"25BE",square:"25FB",Box:"25FB",blacksquare:"25FC",lozenge:"25CA",Diamond:"25CA",blacklozenge:"29EB",circledS:["24C8",{mathvariant:a.VARIANT.NORMAL}],bigstar:"2605",sphericalangle:"2222",measuredangle:"2221",nexists:"2204",complement:"2201",mho:"2127",eth:["00F0",{mathvariant:a.VARIANT.NORMAL}],Finv:"2132",diagup:"2571",Game:"2141",diagdown:"2572",Bbbk:["006B",{mathvariant:a.VARIANT.DOUBLESTRUCK}],yen:"00A5",circledR:"00AE",checkmark:"2713",maltese:"2720"},mathchar0mo:{dotplus:"2214",ltimes:"22C9",smallsetminus:"2216",rtimes:"22CA",Cap:"22D2",doublecap:"22D2",leftthreetimes:"22CB",Cup:"22D3",doublecup:"22D3",rightthreetimes:"22CC",barwedge:"22BC",curlywedge:"22CF",veebar:"22BB",curlyvee:"22CE",doublebarwedge:"2A5E",boxminus:"229F",circleddash:"229D",boxtimes:"22A0",circledast:"229B",boxdot:"22A1",circledcirc:"229A",boxplus:"229E",centerdot:"22C5",divideontimes:"22C7",intercal:"22BA",leqq:"2266",geqq:"2267",leqslant:"2A7D",geqslant:"2A7E",eqslantless:"2A95",eqslantgtr:"2A96",lesssim:"2272",gtrsim:"2273",lessapprox:"2A85",gtrapprox:"2A86",approxeq:"224A",lessdot:"22D6",gtrdot:"22D7",lll:"22D8",llless:"22D8",ggg:"22D9",gggtr:"22D9",lessgtr:"2276",gtrless:"2277",lesseqgtr:"22DA",gtreqless:"22DB",lesseqqgtr:"2A8B",gtreqqless:"2A8C",doteqdot:"2251",Doteq:"2251",eqcirc:"2256",risingdotseq:"2253",circeq:"2257",fallingdotseq:"2252",triangleq:"225C",backsim:"223D",thicksim:["223C",{variantForm:true}],backsimeq:"22CD",thickapprox:["2248",{variantForm:true}],subseteqq:"2AC5",supseteqq:"2AC6",Subset:"22D0",Supset:"22D1",sqsubset:"228F",sqsupset:"2290",preccurlyeq:"227C",succcurlyeq:"227D",curlyeqprec:"22DE",curlyeqsucc:"22DF",precsim:"227E",succsim:"227F",precapprox:"2AB7",succapprox:"2AB8",vartriangleleft:"22B2",lhd:"22B2",vartriangleright:"22B3",rhd:"22B3",trianglelefteq:"22B4",unlhd:"22B4",trianglerighteq:"22B5",unrhd:"22B5",vDash:"22A8",Vdash:"22A9",Vvdash:"22AA",smallsmile:["2323",{variantForm:true}],shortmid:["2223",{variantForm:true}],smallfrown:["2322",{variantForm:true}],shortparallel:["2225",{variantForm:true}],bumpeq:"224F",between:"226C",Bumpeq:"224E",pitchfork:"22D4",varpropto:"221D",backepsilon:"220D",blacktriangleleft:"25C2",blacktriangleright:"25B8",therefore:"2234",because:"2235",eqsim:"2242",vartriangle:["25B3",{variantForm:true}],Join:"22C8",nless:"226E",ngtr:"226F",nleq:"2270",ngeq:"2271",nleqslant:["2A87",{variantForm:true}],ngeqslant:["2A88",{variantForm:true}],nleqq:["2270",{variantForm:true}],ngeqq:["2271",{variantForm:true}],lneq:"2A87",gneq:"2A88",lneqq:"2268",gneqq:"2269",lvertneqq:["2268",{variantForm:true}],gvertneqq:["2269",{variantForm:true}],lnsim:"22E6",gnsim:"22E7",lnapprox:"2A89",gnapprox:"2A8A",nprec:"2280",nsucc:"2281",npreceq:["22E0",{variantForm:true}],nsucceq:["22E1",{variantForm:true}],precneqq:"2AB5",succneqq:"2AB6",precnsim:"22E8",succnsim:"22E9",precnapprox:"2AB9",succnapprox:"2ABA",nsim:"2241",ncong:"2246",nshortmid:["2224",{variantForm:true}],nshortparallel:["2226",{variantForm:true}],nmid:"2224",nparallel:"2226",nvdash:"22AC",nvDash:"22AD",nVdash:"22AE",nVDash:"22AF",ntriangleleft:"22EA",ntriangleright:"22EB",ntrianglelefteq:"22EC",ntrianglerighteq:"22ED",nsubseteq:"2288",nsupseteq:"2289",nsubseteqq:["2288",{variantForm:true}],nsupseteqq:["2289",{variantForm:true}],subsetneq:"228A",supsetneq:"228B",varsubsetneq:["228A",{variantForm:true}],varsupsetneq:["228B",{variantForm:true}],subsetneqq:"2ACB",supsetneqq:"2ACC",varsubsetneqq:["2ACB",{variantForm:true}],varsupsetneqq:["2ACC",{variantForm:true}],leftleftarrows:"21C7",rightrightarrows:"21C9",leftrightarrows:"21C6",rightleftarrows:"21C4",Lleftarrow:"21DA",Rrightarrow:"21DB",twoheadleftarrow:"219E",twoheadrightarrow:"21A0",leftarrowtail:"21A2",rightarrowtail:"21A3",looparrowleft:"21AB",looparrowright:"21AC",leftrightharpoons:"21CB",rightleftharpoons:["21CC",{variantForm:true}],curvearrowleft:"21B6",curvearrowright:"21B7",circlearrowleft:"21BA",circlearrowright:"21BB",Lsh:"21B0",Rsh:"21B1",upuparrows:"21C8",downdownarrows:"21CA",upharpoonleft:"21BF",upharpoonright:"21BE",downharpoonleft:"21C3",restriction:"21BE",multimap:"22B8",downharpoonright:"21C2",leftrightsquigarrow:"21AD",rightsquigarrow:"21DD",leadsto:"21DD",dashrightarrow:"21E2",dashleftarrow:"21E0",nleftarrow:"219A",nrightarrow:"219B",nLeftarrow:"21CD",nRightarrow:"21CF",nleftrightarrow:"21AE",nLeftrightarrow:"21CE"},delimiter:{"\\ulcorner":"231C","\\urcorner":"231D","\\llcorner":"231E","\\lrcorner":"231F"},macros:{implies:["Macro","\\;\\Longrightarrow\\;"],impliedby:["Macro","\\;\\Longleftarrow\\;"]}},null,true);var c=a.mo.OPTYPES.REL;MathJax.Hub.Insert(a.mo.prototype,{OPTABLE:{infix:{"\u2322":c,"\u2323":c,"\u25B3":c,"\uE006":c,"\uE007":c,"\uE00C":c,"\uE00D":c,"\uE00E":c,"\uE00F":c,"\uE010":c,"\uE011":c,"\uE016":c,"\uE017":c,"\uE018":c,"\uE019":c,"\uE01A":c,"\uE01B":c,"\uE04B":c,"\uE04F":c}}});MathJax.Hub.Startup.signal.Post("TeX AMSsymbols Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/AMSsymbols.js");
(function(h,b,d){var g,i=b.Browser.isMobile;var e=function(){var k=[].slice.call(arguments,0);k[0][0]=["HTML-CSS",k[0][0]];return MathJax.Message.Set.apply(MathJax.Message,k)};var f=MathJax.Object.Subclass({timeout:(i?15:8)*1000,comparisonFont:["sans-serif","monospace","script","Times","Courier","Arial","Helvetica"],testSize:["40px","50px","60px","30px","20px"],FedoraSTIXcheck:{family:"STIXSizeOneSym",testString:"abcABC",noStyleChar:true},Init:function(){this.div=MathJax.HTML.addElement(document.body,"div",{style:{position:"absolute",width:0,height:0,overflow:"hidden",padding:0,border:0,margin:0}},[["div",{id:"MathJax_Font_Test",style:{position:"absolute",visibility:"hidden",top:0,left:0,width:"auto",padding:0,border:0,margin:0,whiteSpace:"nowrap",textAlign:"left",textIndent:0,textTransform:"none",lineHeight:"normal",letterSpacing:"normal",wordSpacing:"normal",fontSize:this.testSize[0],fontWeight:"normal",fontStyle:"normal",fontSizeAdjust:"none"}},[""]]]).firstChild;this.text=this.div.firstChild},findFont:function(p,l){var o=null;if(l&&this.testCollection(l)){o=l}else{for(var n=0,k=p.length;n<k;n++){if(p[n]===l){continue}if(this.testCollection(p[n])){o=p[n];break}}}if(o==="STIX"&&this.testFont(this.FedoraSTIXcheck)){o=null}return o},testCollection:function(l){var k={testString:"() {} []"};k.family={TeX:"MathJax_Size1",STIX:"STIXSizeOneSym"}[l]||l.replace(/-(Math)?/,"")+"MathJax_Size1";if(l==="STIX"){k.noStyleChar=true}return this.testFont(k)},testFont:function(n){if(n.isWebFont&&d.FontFaceBug){this.div.style.fontWeight=this.div.style.fontStyle="normal"}else{this.div.style.fontWeight=(n.weight||"normal");this.div.style.fontStyle=(n.style||"normal")}var p=n.familyFixed||n.family;if(!p.match(/^(STIX|MathJax)|'/)){p=p.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/ Jax/,"Jax")+"','"+p+"','"+p+"-";if(n.weight){p+="Bold"}if(n.style){p+="Italic"}if(!n.weight&&!n.style){p+="Regular"}n.familyFixed=p="'"+p+"'"}var l=this.getComparisonWidths(n.testString,n.noStyleChar);var q=null;if(l){this.div.style.fontFamily=p+","+this.comparisonFont[0];if(this.div.offsetWidth==l[0]){this.div.style.fontFamily=p+","+this.comparisonFont[l[2]];if(this.div.offsetWidth==l[1]){q=false}}if(q===null&&(this.div.offsetWidth!=l[3]||this.div.offsetHeight!=l[4])){if(!n.noStyleChar&&d.FONTDATA&&d.FONTDATA.hasStyleChar){for(var o=0,k=this.testSize.length;o<k;o++){if(this.testStyleChar(n,this.testSize[o])){q=true;k=0}}}else{q=true}}}if(d.safariTextNodeBug){this.div.innerHTML=""}else{this.text.nodeValue=""}return q},styleChar:"\uEFFD",versionChar:"\uEFFE",compChar:"\uEFFF",testStyleChar:function(m,p){var s=3+(m.weight?2:0)+(m.style?4:0);var l="",o=0;var r=this.div.style.fontSize;this.div.style.fontSize=p;if(d.msieItalicWidthBug&&m.style==="italic"){this.text.nodeValue=l=this.compChar;o=this.div.offsetWidth}if(d.safariTextNodeBug){this.div.innerHTML=this.compChar+l}else{this.text.nodeValue=this.compChar+l}var k=this.div.offsetWidth-o;if(d.safariTextNodeBug){this.div.innerHTML=this.styleChar+l}else{this.text.nodeValue=this.styleChar+l}var q=Math.floor((this.div.offsetWidth-o)/k+0.5);if(q===s){if(d.safariTextNodeBug){this.div.innerHTML=this.versionChar+l}else{this.text.nodeValue=this.versionChar+l}m.version=Math.floor((this.div.offsetWidth-o)/k+1.5)/2}this.div.style.fontSize=r;return(q===s)},getComparisonWidths:function(p,n){if(d.FONTDATA&&d.FONTDATA.hasStyleChar&&!n){p+=this.styleChar+" "+this.compChar}if(d.safariTextNodeBug){this.div.innerHTML=p}else{this.text.nodeValue=p}this.div.style.fontFamily=this.comparisonFont[0];var l=this.div.offsetWidth;this.div.style.fontFamily=d.webFontDefault;var r=this.div.offsetWidth,o=this.div.offsetHeight;for(var q=1,k=this.comparisonFont.length;q<k;q++){this.div.style.fontFamily=this.comparisonFont[q];if(this.div.offsetWidth!=l){return[l,this.div.offsetWidth,q,r,o]}}return null},loadWebFont:function(l){b.Startup.signal.Post("HTML-CSS Jax - Web-Font "+d.fontInUse+"/"+l.directory);var o=e(["LoadWebFont","Loading web-font %1",d.fontInUse+"/"+l.directory]);if(d.noReflows){return}var k=MathJax.Callback({});var m=MathJax.Callback(["loadComplete",this,l,o,k]);h.timer.start(h,[this.checkWebFont,l,m],0,this.timeout);return k},loadComplete:function(m,p,l,k){MathJax.Message.Clear(p);if(k===h.STATUS.OK){this.webFontLoaded=true;l();return}this.loadError(m);if(b.Browser.isFirefox&&d.allowWebFonts){var o=document.location.protocol+"//"+document.location.hostname;if(document.location.port!=""){o+=":"+document.location.port}o+="/";if(h.fileURL(d.webfontDir).substr(0,o.length)!==o){this.firefoxFontError(m)}}if(!this.webFontLoaded){d.loadWebFontError(m,l)}else{l()}},loadError:function(k){e(["CantLoadWebFont","Can't load web font %1",d.fontInUse+"/"+k.directory],null,2000);b.Startup.signal.Post(["HTML-CSS Jax - web font error",d.fontInUse+"/"+k.directory,k])},firefoxFontError:function(k){e(["FirefoxCantLoadWebFont","Firefox can't load web fonts from a remote host"],null,3000);b.Startup.signal.Post("HTML-CSS Jax - Firefox web fonts on remote host error")},checkWebFont:function(k,l,m){if(k.time(m)){return}if(d.Font.testFont(l)){m(k.STATUS.OK)}else{setTimeout(k,k.delay)}},fontFace:function(o){var p=d.allowWebFonts;var r=d.FONTDATA.FONTS[o];if(d.msieFontCSSBug&&!r.family.match(/-Web$/)){r.family+="-Web"}var k=d.webfontDir+"/"+p;var n=h.fileURL(k);var m=o.replace(/-b/,"-B").replace(/-i/,"-I").replace(/-Bold-/,"-Bold");if(!m.match(/-/)){m+="-Regular"}if(p==="svg"){m+=".svg#"+m}else{m+="."+p}var l=h.fileRev(k+"/"+m.replace(/#.*/,""));var q={"font-family":r.family,src:"url('"+n+"/"+m+l+"')"};if(p==="otf"){m=m.replace(/otf$/,"woff");l=h.fileRev(k+"/"+m);q.src+=" format('opentype')";n=h.fileURL(d.webfontDir+"/woff");q.src="url('"+n+"/"+m+l+"') format('woff'), "+q.src}else{if(p!=="eot"){q.src+=" format('"+p+"')"}}if(!(d.FontFaceBug&&r.isWebFont)){if(o.match(/-bold/)){q["font-weight"]="bold"}if(o.match(/-italic/)){q["font-style"]="italic"}}return q}});var j,a,c;d.Augment({config:{styles:{".MathJax":{display:"inline","font-style":"normal","font-weight":"normal","line-height":"normal","font-size":"100%","font-size-adjust":"none","text-indent":0,"text-align":"left","text-transform":"none","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none",direction:"ltr","max-width":"none","max-height":"none","min-width":0,"min-height":0,border:0,padding:0,margin:0},".MathJax_Display":{position:"relative",display:"block!important","text-indent":0,"max-width":"none","max-height":"none","min-width":0,"min-height":0,width:"100%"},".MathJax img, .MathJax nobr, .MathJax a":{border:0,padding:0,margin:0,"max-width":"none","max-height":"none","min-width":0,"min-height":0,"vertical-align":0,"line-height":"normal","text-decoration":"none"},"img.MathJax_strut":{border:"0!important",padding:"0!important",margin:"0!important","vertical-align":"0!important"},".MathJax span":{display:"inline",position:"static",border:0,padding:0,margin:0,"vertical-align":0,"line-height":"normal","text-decoration":"none"},".MathJax nobr":{"white-space":"nowrap!important"},".MathJax img":{display:"inline!important","float":"none!important"},".MathJax *":{transition:"none","-webkit-transition":"none","-moz-transition":"none","-ms-transition":"none","-o-transition":"none"},".MathJax_Processing":{visibility:"hidden",position:"fixed",width:0,height:0,overflow:"hidden"},".MathJax_Processed":{display:"none!important"},".MathJax_ExBox":{display:"block!important",overflow:"hidden",width:"1px",height:"60ex","min-height":0,"max-height":"none"},".MathJax .MathJax_EmBox":{display:"block!important",overflow:"hidden",width:"1px",height:"60em","min-height":0,"max-height":"none"},".MathJax .MathJax_HitBox":{cursor:"text",background:"white",opacity:0,filter:"alpha(opacity=0)"},".MathJax .MathJax_HitBox *":{filter:"none",opacity:1,background:"transparent"},"#MathJax_Tooltip":{position:"absolute",left:0,top:0,width:"auto",height:"auto",display:"none"},"#MathJax_Tooltip *":{filter:"none",opacity:1,background:"transparent"},"@font-face":{"font-family":"MathJax_Blank",src:"url('about:blank')"}}},settings:b.config.menuSettings,hideProcessedMath:true,Font:null,webFontDefault:"MathJax_Blank",allowWebFonts:"otf",maxStretchyParts:1000,fontName:{TeXLocal:"TeX",TeXWeb:["","TeX"],TeXImage:["",""],STIXLocal:["STIX","STIX-Web"],STIXWeb:"STIX-Web",AsanaMathWeb:"Asana-Math",GyrePagellaWeb:"Gyre-Pagella",GyreTermesWeb:"Gyre-Termes",LatinModernWeb:"Latin-Modern",NeoEulerWeb:"Neo-Euler"},fontInUse:"generic",FONTDATA:{TeX_factor:1,baselineskip:1.2,lineH:0.8,lineD:0.2,ffLineH:0.8,FONTS:{},VARIANT:{normal:{fonts:[]},"-generic-variant":{},"-largeOp":{},"-smallOp":{}},RANGES:[],DELIMITERS:{},RULECHAR:45,REMAP:{}},Config:function(){if(!this.require){this.require=[]}this.Font=f();this.SUPER(arguments).Config.call(this);var m=this.settings,l=this.config,k=m.font;if(this.adjustAvailableFonts){this.adjustAvailableFonts(l.availableFonts)}if(m.scale){l.scale=m.scale}if(k&&k!=="Auto"&&this.fontName[k]){l.availableFonts=[];delete l.fonts;if(this.fontName[k] instanceof Array){l.preferredFont=this.fontName[k][0];l.webFont=this.fontName[k][1]}else{l.preferredFont=l.webFont=this.fontName[k]}if(l.preferredFont){l.availableFonts[0]=l.preferredFont}}if(l.fonts){l.availableFonts=l.fonts;l.preferredFont=l.webFont=l.fonts[0];if(l.webFont==="STIX"){l.webFont+="-Web"}}k=this.Font.findFont(l.availableFonts,l.preferredFont);if(!k&&this.allowWebFonts){k=l.webFont;if(k){this.webFonts=true}}if(!k&&this.config.imageFont){k=l.imageFont;this.imgFonts=true}if(k){this.fontInUse=k;this.fontDir+="/"+k;this.webfontDir+="/"+k;this.require.push(this.fontDir+"/fontdata.js");if(this.imgFonts){this.require.push(this.directory+"/imageFonts.js");b.Startup.signal.Post("HTML-CSS Jax - using image fonts")}}else{e(["CantFindFontUsing","Can't find a valid font using %1","["+this.config.availableFonts.join(", ")+"]"],null,3000);b.Startup.signal.Post("HTML-CSS Jax - no valid font")}this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js")},Startup:function(){j=MathJax.Extension.MathEvents.Event;a=MathJax.Extension.MathEvents.Touch;c=MathJax.Extension.MathEvents.Hover;this.ContextMenu=j.ContextMenu;this.Mousedown=j.AltContextMenu;this.Mouseover=c.Mouseover;this.Mouseout=c.Mouseout;this.Mousemove=c.Mousemove;this.hiddenDiv=this.Element("div",{style:{visibility:"hidden",overflow:"hidden",position:"absolute",top:0,height:"1px",width:"auto",padding:0,border:0,margin:0,textAlign:"left",textIndent:0,textTransform:"none",lineHeight:"normal",letterSpacing:"normal",wordSpacing:"normal"}});if(!document.body.firstChild){document.body.appendChild(this.hiddenDiv)}else{document.body.insertBefore(this.hiddenDiv,document.body.firstChild)}this.hiddenDiv=this.addElement(this.hiddenDiv,"div",{id:"MathJax_Hidden"});var l=this.addElement(this.hiddenDiv,"div",{style:{width:"5in"}});this.pxPerInch=l.offsetWidth/5;this.hiddenDiv.removeChild(l);this.startMarker=this.createStrut(this.Element("span"),10,true);this.endMarker=this.addText(this.Element("span"),"x").parentNode;this.HDspan=this.Element("span");if(this.operaHeightBug){this.createStrut(this.HDspan,0)}if(this.msieInlineBlockAlignBug){this.HDimg=this.addElement(this.HDspan,"img",{style:{height:"0px",width:"1px"}});try{this.HDimg.src="about:blank"}catch(k){}}else{this.HDimg=this.createStrut(this.HDspan,0)}this.EmExSpan=this.Element("span",{style:{position:"absolute","font-size-adjust":"none"}},[["span",{className:"MathJax_ExBox"}],["span",{className:"MathJax"},[["span",{className:"MathJax_EmBox"}]]]]);this.linebreakSpan=this.Element("span",null,[["hr",{style:{width:"100%",size:1,padding:0,border:0,margin:0}}]]);return h.Styles(this.config.styles,["InitializeHTML",this])},removeSTIXfonts:function(n){for(var l=0,k=n.length;l<k;l++){if(n[l]==="STIX"){n.splice(l,1);k--;l--}}if(this.config.preferredFont==="STIX"){this.config.preferredFont=n[0]}},PreloadWebFonts:function(){if(!d.allowWebFonts||!d.config.preloadWebFonts){return}for(var l=0,k=d.config.preloadWebFonts.length;l<k;l++){var n=d.FONTDATA.FONTS[d.config.preloadWebFonts[l]];if(!n.available){d.Font.testFont(n)}}},InitializeHTML:function(){this.PreloadWebFonts();this.getDefaultExEm();if(this.defaultEm){return}var k=MathJax.Callback();h.timer.start(h,function(l){if(l.time(k)){b.signal.Post(["HTML-CSS Jax - no default em size"]);return}d.getDefaultExEm();if(d.defaultEm){k()}else{setTimeout(l,l.delay)}},this.defaultEmDelay,this.defaultEmTimeout);return k},defaultEmDelay:100,defaultEmTimeout:1000,getDefaultExEm:function(){document.body.appendChild(this.EmExSpan);document.body.appendChild(this.linebreakSpan);this.defaultEx=this.EmExSpan.firstChild.offsetHeight/60;this.defaultEm=this.EmExSpan.lastChild.firstChild.offsetHeight/60;this.defaultWidth=this.linebreakSpan.firstChild.offsetWidth;document.body.removeChild(this.linebreakSpan);document.body.removeChild(this.EmExSpan)},preTranslate:function(p){var o=p.jax[this.id],y,v=o.length,B,t,x,r,z,l,A,k,C,s,q=false,w,n=this.config.linebreaks.automatic,u=this.config.linebreaks.width;if(n){q=(u.match(/^\s*(\d+(\.\d*)?%\s*)?container\s*$/)!=null);if(q){u=u.replace(/\s*container\s*/,"")}else{s=this.defaultWidth}if(u===""){u="100%"}}else{s=100000}for(y=0;y<v;y++){B=o[y];if(!B.parentNode){continue}t=B.previousSibling;if(t&&String(t.className).match(/^MathJax(_Display)?( MathJax_Processing)?$/)){t.parentNode.removeChild(t)}l=B.MathJax.elementJax;if(!l){continue}l.HTMLCSS={display:(l.root.Get("display")==="block")};x=r=this.Element("span",{className:"MathJax",id:l.inputID+"-Frame",isMathJax:true,jaxID:this.id,oncontextmenu:j.Menu,onmousedown:j.Mousedown,onmouseover:j.Mouseover,onmouseout:j.Mouseout,onmousemove:j.Mousemove,onclick:j.Click,ondblclick:j.DblClick});if(b.Browser.noContextMenu){x.ontouchstart=a.start;x.ontouchend=a.end}if(l.HTMLCSS.display){r=this.Element("div",{className:"MathJax_Display"});r.appendChild(x)}else{if(this.msieDisappearingBug){x.style.display="inline-block"}}r.className+=" MathJax_Processing";B.parentNode.insertBefore(r,B);B.parentNode.insertBefore(this.EmExSpan.cloneNode(true),B);r.parentNode.insertBefore(this.linebreakSpan.cloneNode(true),r)}for(y=0;y<v;y++){B=o[y];if(!B.parentNode){continue}z=B.previousSibling;r=z.previousSibling;l=B.MathJax.elementJax;if(!l){continue}A=z.firstChild.offsetHeight/60;k=z.lastChild.firstChild.offsetHeight/60;w=r.previousSibling.firstChild.offsetWidth;if(q){s=w}if(A===0||A==="NaN"){this.hiddenDiv.appendChild(r);l.HTMLCSS.isHidden=true;A=this.defaultEx;k=this.defaultEm;w=this.defaultWidth;if(q){s=w}}C=(this.config.matchFontHeight?A/this.TeX.x_height/k:1);C=Math.floor(Math.max(this.config.minScaleAdjust/100,C)*this.config.scale);l.HTMLCSS.scale=C/100;l.HTMLCSS.fontSize=C+"%";l.HTMLCSS.em=l.HTMLCSS.outerEm=k;this.em=k*C/100;l.HTMLCSS.ex=A;l.HTMLCSS.cwidth=w/this.em;l.HTMLCSS.lineWidth=(n?this.length2em(u,1,s/this.em):1000000)}for(y=0;y<v;y++){B=o[y];if(!B.parentNode){continue}z=o[y].previousSibling;l=o[y].MathJax.elementJax;if(!l){continue}x=z.previousSibling;if(!l.HTMLCSS.isHidden){x=x.previousSibling}x.parentNode.removeChild(x);z.parentNode.removeChild(z)}p.HTMLCSSeqn=p.HTMLCSSlast=0;p.HTMLCSSi=-1;p.HTMLCSSchunk=this.config.EqnChunk;p.HTMLCSSdelay=false},Translate:function(l,p){if(!l.parentNode){return}if(p.HTMLCSSdelay){p.HTMLCSSdelay=false;b.RestartAfter(MathJax.Callback.Delay(this.config.EqnChunkDelay))}var k=l.MathJax.elementJax,o=k.root,m=document.getElementById(k.inputID+"-Frame"),q=(k.HTMLCSS.display?(m||{}).parentNode:m);if(!q){return}this.em=g.mbase.prototype.em=k.HTMLCSS.em*k.HTMLCSS.scale;this.outerEm=k.HTMLCSS.em;this.scale=k.HTMLCSS.scale;this.cwidth=k.HTMLCSS.cwidth;this.linebreakWidth=k.HTMLCSS.lineWidth;if(this.scale!==1){m.style.fontSize=k.HTMLCSS.fontSize}this.initImg(m);this.initHTML(o,m);this.savePreview(l);try{o.setTeXclass();o.toHTML(m,q)}catch(n){if(n.restart){while(m.firstChild){m.removeChild(m.firstChild)}}this.restorePreview(l);throw n}this.restorePreview(l);if(k.HTMLCSS.isHidden){l.parentNode.insertBefore(q,l)}q.className=q.className.split(/ /)[0];if(this.hideProcessedMath){q.className+=" MathJax_Processed";if(l.MathJax.preview){k.HTMLCSS.preview=l.MathJax.preview;delete l.MathJax.preview}p.HTMLCSSeqn+=(p.i-p.HTMLCSSi);p.HTMLCSSi=p.i;if(p.HTMLCSSeqn>=p.HTMLCSSlast+p.HTMLCSSchunk){this.postTranslate(p,true);p.HTMLCSSchunk=Math.floor(p.HTMLCSSchunk*this.config.EqnChunkFactor);p.HTMLCSSdelay=true}}},savePreview:function(k){var l=k.MathJax.preview;if(l){k.MathJax.tmpPreview=document.createElement("span");l.parentNode.replaceChild(k.MathJax.tmpPreview,l)}},restorePreview:function(k){var l=k.MathJax.tmpPreview;if(l){l.parentNode.replaceChild(k.MathJax.preview,l);delete k.MathJax.tmpPreview}},postTranslate:function(s,o){var l=s.jax[this.id];if(!this.hideProcessedMath){return}for(var q=s.HTMLCSSlast,k=s.HTMLCSSeqn;q<k;q++){var n=l[q];if(n&&n.MathJax.elementJax){n.previousSibling.className=n.previousSibling.className.split(/ /)[0];var r=n.MathJax.elementJax.HTMLCSS;if(r.preview){r.preview.innerHTML="";n.MathJax.preview=r.preview;delete r.preview}}}if(this.forceReflow){var p=(document.styleSheets||[])[0]||{};p.disabled=true;p.disabled=false}s.HTMLCSSlast=s.HTMLCSSeqn},getJaxFromMath:function(k){if(k.parentNode.className==="MathJax_Display"){k=k.parentNode}do{k=k.nextSibling}while(k&&k.nodeName.toLowerCase()!=="script");return b.getJaxFor(k)},getHoverSpan:function(k,l){return k.root.HTMLspanElement()},getHoverBBox:function(k,n,o){var p=n.bbox,m=k.HTMLCSS.outerEm;var l={w:p.w*m,h:p.h*m,d:p.d*m};if(p.width){l.width=p.width}return l},Zoom:function(l,w,v,k,t){w.className="MathJax";w.style.fontSize=l.HTMLCSS.fontSize;var z=w.appendChild(this.EmExSpan.cloneNode(true));var o=z.lastChild.firstChild.offsetHeight/60;this.em=g.mbase.prototype.em=o;this.outerEm=o/l.HTMLCSS.scale;z.parentNode.removeChild(z);this.scale=l.HTMLCSS.scale;this.linebreakWidth=l.HTMLCSS.lineWidth;this.cwidth=l.HTMLCSS.cwidth;this.zoomScale=parseInt(b.config.menuSettings.zscale)/100;this.idPostfix="-zoom";l.root.toHTML(w,w);this.idPostfix="";this.zoomScale=1;var x=l.root.HTMLspanElement().bbox,n=x.width;if(n){if(x.tw){k=x.tw*o}if(x.w*o<k){k=x.w*o}w.style.width=Math.floor(k-1.5*d.em)+"px";w.style.display="inline-block";var m=(l.root.id||"MathJax-Span-"+l.root.spanID)+"-zoom";var p=document.getElementById(m).firstChild;while(p&&p.style.width!==n){p=p.nextSibling}if(p){var s=p.offsetWidth;p.style.width="100%";if(s>k){w.style.width=(s+100)+"px"}}}p=w.firstChild.firstChild.style;if(x.H!=null&&x.H>x.h){p.marginTop=d.Em(x.H-Math.max(x.h,d.FONTDATA.lineH))}if(x.D!=null&&x.D>x.d){p.marginBottom=d.Em(x.D-Math.max(x.d,d.FONTDATA.lineD))}if(x.lw<0){p.paddingLeft=d.Em(-x.lw)}if(x.rw>x.w){p.marginRight=d.Em(x.rw-x.w)}w.style.position="absolute";if(!n){v.style.position="absolute"}var u=w.offsetWidth,r=w.offsetHeight,y=v.offsetHeight,q=v.offsetWidth;w.style.position=v.style.position="";return{Y:-j.getBBox(w).h,mW:q,mH:y,zW:u,zH:r}},initImg:function(k){},initHTML:function(l,k){},initFont:function(k){var m=d.FONTDATA.FONTS,l=d.config.availableFonts;if(l&&l.length&&d.Font.testFont(m[k])){m[k].available=true;if(m[k].familyFixed){m[k].family=m[k].familyFixed;delete m[k].familyFixed}return null}if(!this.allowWebFonts){return null}m[k].isWebFont=true;if(d.FontFaceBug){m[k].family=k;if(d.msieFontCSSBug){m[k].family+="-Web"}}return h.Styles({"@font-face":this.Font.fontFace(k)})},Remove:function(k){var l=document.getElementById(k.inputID+"-Frame");if(l){if(k.HTMLCSS.display){l=l.parentNode}l.parentNode.removeChild(l)}delete k.HTMLCSS},getHD:function(l){if(l.bbox&&this.config.noReflows){return{h:l.bbox.h,d:l.bbox.d}}var k=l.style.position;l.style.position="absolute";this.HDimg.style.height="0px";l.appendChild(this.HDspan);var m={h:l.offsetHeight};this.HDimg.style.height=m.h+"px";m.d=l.offsetHeight-m.h;m.h-=m.d;m.h/=this.em;m.d/=this.em;l.removeChild(this.HDspan);l.style.position=k;return m},getW:function(o){if(o.bbox&&this.config.noReflows&&o.bbox.exactW!==false){return o.bbox.w}var l,n,m=(o.bbox||{}).w,p=o;if(o.bbox&&o.bbox.exactW){return m}if((o.bbox&&m>=0&&!this.initialSkipBug&&!this.msieItalicWidthBug)||this.negativeBBoxes||!o.firstChild){l=o.offsetWidth;n=o.parentNode.offsetHeight}else{if(o.bbox&&m<0&&this.msieNegativeBBoxBug){l=-o.offsetWidth,n=o.parentNode.offsetHeight}else{var k=o.style.position;o.style.position="absolute";p=this.startMarker;o.insertBefore(p,o.firstChild);o.appendChild(this.endMarker);l=this.endMarker.offsetLeft-p.offsetLeft;o.removeChild(this.endMarker);o.removeChild(p);o.style.position=k}}if(n!=null){o.parentNode.HH=n/this.em}return l/this.em},Measured:function(m,l){var n=m.bbox;if(n.width==null&&n.w&&!n.isMultiline){var k=this.getW(m);n.rw+=k-n.w;n.w=k;n.exactW=true}if(!l){l=m.parentNode}if(!l.bbox){l.bbox=n}return m},Remeasured:function(l,k){k.bbox=this.Measured(l,k).bbox},MeasureSpans:function(o){var r=[],t,q,n,u,k,p,l,s;for(q=0,n=o.length;q<n;q++){t=o[q];if(!t){continue}u=t.bbox;s=this.parentNode(t);if(u.exactW||u.width||u.w===0||u.isMultiline||this.config.noReflows){if(!s.bbox){s.bbox=u}continue}if(this.negativeBBoxes||!t.firstChild||(u.w>=0&&!this.initialSkipBug)||(u.w<0&&this.msieNegativeBBoxBug)){r.push([t])}else{if(this.initialSkipBug){k=this.startMarker.cloneNode(true);p=this.endMarker.cloneNode(true);t.insertBefore(k,t.firstChild);t.appendChild(p);r.push([t,k,p,t.style.position]);t.style.position="absolute"}else{p=this.endMarker.cloneNode(true);t.appendChild(p);r.push([t,null,p])}}}for(q=0,n=r.length;q<n;q++){t=r[q][0];u=t.bbox;s=this.parentNode(t);if((u.w>=0&&!this.initialSkipBug)||this.negativeBBoxes||!t.firstChild){l=t.offsetWidth;s.HH=s.offsetHeight/this.em}else{if(u.w<0&&this.msieNegativeBBoxBug){l=-t.offsetWidth,s.HH=s.offsetHeight/this.em}else{l=r[q][2].offsetLeft-((r[q][1]||{}).offsetLeft||0)}}l/=this.em;u.rw+=l-u.w;u.w=l;u.exactW=true;if(!s.bbox){s.bbox=u}}for(q=0,n=r.length;q<n;q++){t=r[q];if(t[1]){t[1].parentNode.removeChild(t[1]),t[0].style.position=t[3]}if(t[2]){t[2].parentNode.removeChild(t[2])}}},Em:function(k){if(Math.abs(k)<0.0006){return"0em"}return k.toFixed(3).replace(/\.?0+$/,"")+"em"},EmRounded:function(k){k=(Math.round(k*d.em)+0.05)/d.em;if(Math.abs(k)<0.0006){return"0em"}return k.toFixed(3).replace(/\.?0+$/,"")+"em"},unEm:function(k){return parseFloat(k)},Px:function(k){k*=this.em;var l=(k<0?"-":"");return l+Math.abs(k).toFixed(1).replace(/\.?0+$/,"")+"px"},unPx:function(k){return parseFloat(k)/this.em},Percent:function(k){return(100*k).toFixed(1).replace(/\.?0+$/,"")+"%"},length2em:function(r,l,p){if(typeof(r)!=="string"){r=r.toString()}if(r===""){return""}if(r===g.SIZE.NORMAL){return 1}if(r===g.SIZE.BIG){return 2}if(r===g.SIZE.SMALL){return 0.71}if(r==="infinity"){return d.BIGDIMEN}var o=this.FONTDATA.TeX_factor,s=(d.zoomScale||1)/d.em;if(r.match(/mathspace$/)){return d.MATHSPACE[r]*o}var n=r.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/);var k=parseFloat(n[1]||"1"),q=n[2];if(p==null){p=1}if(l==null){l=1}if(q==="em"){return k*o}if(q==="ex"){return k*d.TeX.x_height*o}if(q==="%"){return k/100*p}if(q==="px"){return k*s}if(q==="pt"){return k/10*o}if(q==="pc"){return k*1.2*o}if(q==="in"){return k*this.pxPerInch*s}if(q==="cm"){return k*this.pxPerInch*s/2.54}if(q==="mm"){return k*this.pxPerInch*s/25.4}if(q==="mu"){return k/18*o*l}return k*p},thickness2em:function(l,k){var m=d.TeX.rule_thickness;if(l===g.LINETHICKNESS.MEDIUM){return m}if(l===g.LINETHICKNESS.THIN){return 0.67*m}if(l===g.LINETHICKNESS.THICK){return 1.67*m}return this.length2em(l,k,m)},getPadding:function(l){var n={top:0,right:0,bottom:0,left:0},k=false;for(var o in n){if(n.hasOwnProperty(o)){var m=l.style["padding"+o.charAt(0).toUpperCase()+o.substr(1)];if(m){n[o]=this.length2em(m);k=true}}}return(k?n:false)},getBorders:function(p){var m={top:0,right:0,bottom:0,left:0},n={},l=false;for(var q in m){if(m.hasOwnProperty(q)){var k="border"+q.charAt(0).toUpperCase()+q.substr(1);var o=p.style[k+"Style"];if(o){l=true;m[q]=this.length2em(p.style[k+"Width"]);n[k]=[p.style[k+"Width"],p.style[k+"Style"],p.style[k+"Color"]].join(" ")}}}m.css=n;return(l?m:false)},setBorders:function(k,l){if(l){for(var m in l.css){if(l.css.hasOwnProperty(m)){k.style[m]=l.css[m]}}}},createStrut:function(m,l,n){var k=this.Element("span",{isMathJax:true,style:{display:"inline-block",overflow:"hidden",height:l+"px",width:"1px",marginRight:"-1px"}});if(n){m.insertBefore(k,m.firstChild)}else{m.appendChild(k)}return k},createBlank:function(l,k,m){var n=this.Element("span",{isMathJax:true,style:{display:"inline-block",overflow:"hidden",height:"1px",width:this.Em(k)}});if(k<0){n.style.marginRight=n.style.width;n.style.width=0}if(m){l.insertBefore(n,l.firstChild)}else{l.appendChild(n)}return n},createShift:function(l,k,n){var m=this.Element("span",{style:{marginLeft:this.Em(k)},isMathJax:true});if(n){l.insertBefore(m,l.firstChild)}else{l.appendChild(m)}return m},createSpace:function(p,n,o,q,m,s){if(n<-o){o=-n}var r=this.Em(n+o),k=this.Em(-o);if(this.msieInlineBlockAlignBug){k=this.Em(d.getHD(p.parentNode).d-o)}if(p.isBox||s){var l=(p.scale==null?1:p.scale);p.bbox={exactW:true,h:n*l,d:o*l,w:q*l,rw:q*l,lw:0};p.style.height=r;p.style.verticalAlign=k;p.HH=(n+o)*l}else{p=this.addElement(p,"span",{style:{height:r,verticalAlign:k},isMathJax:true})}if(q>=0){p.style.width=this.Em(q);p.style.display="inline-block";p.style.overflow="hidden"}else{if(this.msieNegativeSpaceBug){p.style.height=""}p.style.marginLeft=this.Em(q);if(d.safariNegativeSpaceBug&&p.parentNode.firstChild==p){this.createBlank(p,0,true)}}if(m&&m!==g.COLOR.TRANSPARENT){p.style.backgroundColor=m;p.style.position="relative"}return p},createRule:function(r,n,p,s,l){if(n<-p){p=-n}var m=d.TeX.min_rule_thickness,o=1;if(s>0&&s*this.em<m){s=m/this.em}if(n+p>0&&(n+p)*this.em<m){o=1/(n+p)*(m/this.em);n*=o;p*=o}if(!l){l="solid"}else{l="solid "+l}l=this.Em(s)+" "+l;var t=(o===1?this.Em(n+p):m+"px"),k=this.Em(-p);var q=this.addElement(r,"span",{style:{borderLeft:l,display:"inline-block",overflow:"hidden",width:0,height:t,verticalAlign:k},bbox:{h:n,d:p,w:s,rw:s,lw:0,exactW:true},noAdjust:true,HH:n+p,isMathJax:true});if(s>0&&!this.noReflows&&q.offsetWidth==0){q.style.width=this.Em(s)}if(r.isBox||r.className=="mspace"){r.bbox=q.bbox,r.HH=n+p}return q},createFrame:function(s,q,r,u,x,l){if(q<-r){r=-q}var p=2*x;if(this.msieFrameSizeBug){if(u<p){u=p}if(q+r<p){q=p-r}}if(this.msieBorderWidthBug){p=0}var v=this.Em(q+r-p),k=this.Em(-r-x),o=this.Em(u-p);var m=this.Em(x)+" "+l;var n=this.addElement(s,"span",{style:{border:m,display:"inline-block",overflow:"hidden",width:o,height:v},bbox:{h:q,d:r,w:u,rw:u,lw:0,exactW:true},noAdjust:true,HH:q+r,isMathJax:true});if(k){n.style.verticalAlign=k}return n},parentNode:function(l){var k=l.parentNode;if(k.nodeName.toLowerCase()==="a"){k=k.parentNode}return k},createStack:function(m,o,l){if(this.msiePaddingWidthBug){this.createStrut(m,0)}var n=String(l).match(/%$/);var k=(!n&&l!=null?l:0);m=this.addElement(m,"span",{noAdjust:true,HH:0,isMathJax:true,style:{display:"inline-block",position:"relative",width:(n?"100%":this.Em(k)),height:0}});if(!o){m.parentNode.bbox=m.bbox={exactW:true,h:-this.BIGDIMEN,d:-this.BIGDIMEN,w:k,lw:this.BIGDIMEN,rw:(!n&&l!=null?l:-this.BIGDIMEN)};if(n){m.bbox.width=l}}return m},createBox:function(l,k){var m=this.addElement(l,"span",{style:{position:"absolute"},isBox:true,isMathJax:true});if(k!=null){m.style.width=k}return m},addBox:function(k,l){l.style.position="absolute";l.isBox=l.isMathJax=true;return k.appendChild(l)},placeBox:function(u,s,q,o){u.isMathJax=true;var v=d.parentNode(u),C=u.bbox,z=v.bbox;if(this.msiePlaceBoxBug){this.addText(u,this.NBSP)}if(this.imgSpaceBug){this.addText(u,this.imgSpace)}var w,F=0;if(u.HH!=null){w=u.HH}else{if(C){w=Math.max(3,C.h+C.d)}else{w=u.offsetHeight/this.em}}if(!u.noAdjust){w+=1;w=Math.round(w*this.em)/this.em;if(this.msieInlineBlockAlignBug){this.addElement(u,"img",{className:"MathJax_strut",border:0,src:"about:blank",isMathJax:true,style:{width:0,height:this.Em(w)}})}else{this.addElement(u,"span",{isMathJax:true,style:{display:"inline-block",width:0,height:this.Em(w)}});if(d.chromeHeightBug){w-=(u.lastChild.offsetHeight-Math.round(w*this.em))/this.em}}}if(C){if(this.initialSkipBug){if(C.lw<0){F=C.lw;d.createBlank(u,-F,true)}if(C.rw>C.w){d.createBlank(u,C.rw-C.w+0.1)}}if(!this.msieClipRectBug&&!C.noclip&&!o){var B=3/this.em;var A=(C.H==null?C.h:C.H),m=(C.D==null?C.d:C.D);var E=w-A-B,p=w+m+B,n=-1000,k=1000;u.style.clip="rect("+this.Em(E)+" "+this.Em(k)+" "+this.Em(p)+" "+this.Em(n)+")"}}u.style.top=this.Em(-q-w);u.style.left=this.Em(s+F);if(C&&z){if(C.H!=null&&(z.H==null||C.H+q>z.H)){z.H=C.H+q}if(C.D!=null&&(z.D==null||C.D-q>z.D)){z.D=C.D-q}if(C.h+q>z.h){z.h=C.h+q}if(C.d-q>z.d){z.d=C.d-q}if(z.H!=null&&z.H<=z.h){delete z.H}if(z.D!=null&&z.D<=z.d){delete z.D}if(C.w+s>z.w){z.w=C.w+s;if(z.width==null){v.style.width=this.Em(z.w)}}if(C.rw+s>z.rw){z.rw=C.rw+s}if(C.lw+s<z.lw){z.lw=C.lw+s}if(C.width!=null&&!C.isFixed){if(z.width==null){v.style.width=z.width="100%";if(C.minWidth){v.style.minWidth=z.minWidth=C.minWidth}}u.style.width=C.width}if(C.tw){z.tw=C.tw}}},alignBox:function(s,o,q,v){if(v==null){v=0}this.placeBox(s,v,q);if(this.msiePlaceBoxBug){var m=s.lastChild;while(m&&m.nodeName!=="#text"){m=m.previousSibling}if(m){s.removeChild(m)}}var u=s.bbox;if(u.isMultiline){return}var t=u.width!=null&&!u.isFixed;var k=0,p=v-u.w/2,n="50%";if(this.initialSkipBug){k=u.w-u.rw-0.1;p+=u.lw}if(this.msieMarginScaleBug){p=(p*this.em)+"px"}else{p=this.Em(p)}if(t){p=(v===0?"":this.Em(v));n=(50-parseFloat(u.width)/2)+"%"}b.Insert(s.style,({right:{left:"",right:this.Em(k-v)},center:{left:n,marginLeft:p}})[o])},setStackWidth:function(l,k){if(typeof(k)==="number"){l.style.width=this.Em(Math.max(0,k));var m=l.bbox;if(m){m.w=k;m.exactW=true}m=l.parentNode.bbox;if(m){m.w=k;m.exactW=true}}else{l.style.width=l.parentNode.style.width="100%";if(l.bbox){l.bbox.width=k}if(l.parentNode.bbox){l.parentNode.bbox.width=k}}},createDelimiter:function(u,k,n,q,o){if(!k){u.bbox={h:0,d:0,w:this.TeX.nulldelimiterspace,lw:0};u.bbox.rw=u.bbox.w;this.createSpace(u,u.bbox.h,u.bbox.d,u.bbox.w);return}if(!q){q=1}if(!(n instanceof Array)){n=[n,n]}var t=n[1];n=n[0];var l={alias:k};while(l.alias){k=l.alias;l=this.FONTDATA.DELIMITERS[k];if(!l){l={HW:[0,this.FONTDATA.VARIANT[g.VARIANT.NORMAL]]}}}if(l.load){b.RestartAfter(h.Require(this.fontDir+"/fontdata-"+l.load+".js"))}for(var s=0,p=l.HW.length;s<p;s++){if(l.HW[s][0]*q>=n-0.01||(s==p-1&&!l.stretch)){if(l.HW[s][2]){q*=l.HW[s][2]}if(l.HW[s][3]){k=l.HW[s][3]}var r=this.addElement(u,"span");this.createChar(r,[k,l.HW[s][1]],q,o);u.bbox=r.bbox;u.offset=0.65*u.bbox.w;u.scale=q;return}}if(l.stretch){this["extendDelimiter"+l.dir](u,t,l.stretch,q,o)}},extendDelimiterV:function(A,t,E,F,w){var o=this.createStack(A,true);var v=this.createBox(o),u=this.createBox(o);this.createChar(v,(E.top||E.ext),F,w);this.createChar(u,(E.bot||E.ext),F,w);var m={bbox:{w:0,lw:0,rw:0}},D=m,p;var B=v.bbox.h+v.bbox.d+u.bbox.h+u.bbox.d;var r=-v.bbox.h;this.placeBox(v,0,r,true);r-=v.bbox.d;if(E.mid){D=this.createBox(o);this.createChar(D,E.mid,F,w);B+=D.bbox.h+D.bbox.d}if(E.min&&t<B*E.min){t=B*E.min}if(t>B){m=this.Element("span");this.createChar(m,E.ext,F,w);var C=m.bbox.h+m.bbox.d,l=C-0.05,x,q,z=(E.mid?2:1);q=x=Math.min(Math.ceil((t-B)/(z*l)),this.maxStretchyParts);if(!E.fullExtenders){l=(t-B)/(z*x)}var s=(x/(x+1))*(C-l);l=C-s;r+=s+l-m.bbox.h;while(z-->0){while(x-->0){if(!this.msieCloneNodeBug){p=m.cloneNode(true)}else{p=this.Element("span");this.createChar(p,E.ext,F,w)}p.bbox=m.bbox;r-=l;this.placeBox(this.addBox(o,p),0,r,true)}r+=s-m.bbox.d;if(E.mid&&z){this.placeBox(D,0,r-D.bbox.h,true);x=q;r+=-(D.bbox.h+D.bbox.d)+s+l-m.bbox.h}}}else{r+=(B-t)/2;if(E.mid){this.placeBox(D,0,r-D.bbox.h,true);r+=-(D.bbox.h+D.bbox.d)}r+=(B-t)/2}this.placeBox(u,0,r-u.bbox.h,true);r-=u.bbox.h+u.bbox.d;A.bbox={w:Math.max(v.bbox.w,m.bbox.w,u.bbox.w,D.bbox.w),lw:Math.min(v.bbox.lw,m.bbox.lw,u.bbox.lw,D.bbox.lw),rw:Math.max(v.bbox.rw,m.bbox.rw,u.bbox.rw,D.bbox.rw),h:0,d:-r,exactW:true};A.scale=F;A.offset=0.55*A.bbox.w;A.isMultiChar=true;this.setStackWidth(o,A.bbox.w)},extendDelimiterH:function(B,o,E,G,y){var r=this.createStack(B,true);var p=this.createBox(r),C=this.createBox(r);this.createChar(p,(E.left||E.rep),G,y);this.createChar(C,(E.right||E.rep),G,y);var l=this.Element("span");this.createChar(l,E.rep,G,y);var D={bbox:{h:-this.BIGDIMEN,d:-this.BIGDIMEN}},m;this.placeBox(p,-p.bbox.lw,0,true);var u=(p.bbox.rw-p.bbox.lw)+(C.bbox.rw-C.bbox.lw)-0.05,t=p.bbox.rw-p.bbox.lw-0.025,v;if(E.mid){D=this.createBox(r);this.createChar(D,E.mid,G,y);u+=D.bbox.w}if(E.min&&o<u*E.min){o=u*E.min}if(o>u){var F=l.bbox.rw-l.bbox.lw,q=F-0.05,z,s,A=(E.mid?2:1);s=z=Math.min(Math.ceil((o-u)/(A*q)),this.maxStretchyParts);if(!E.fillExtenders){q=(o-u)/(A*z)}v=(z/(z+1))*(F-q);q=F-v;t-=l.bbox.lw+v;while(A-->0){while(z-->0){if(!this.cloneNodeBug){m=l.cloneNode(true)}else{m=this.Element("span");this.createChar(m,E.rep,G,y)}m.bbox=l.bbox;this.placeBox(this.addBox(r,m),t,0,true);t+=q}if(E.mid&&A){this.placeBox(D,t,0,true);t+=D.bbox.w-v;z=s}}}else{t-=(u-o)/2;if(E.mid){this.placeBox(D,t,0,true);t+=D.bbox.w}t-=(u-o)/2}this.placeBox(C,t,0,true);B.bbox={w:t+C.bbox.rw,lw:0,rw:t+C.bbox.rw,H:Math.max(p.bbox.h,l.bbox.h,C.bbox.h,D.bbox.h),D:Math.max(p.bbox.d,l.bbox.d,C.bbox.d,D.bbox.d),h:l.bbox.h,d:l.bbox.d,exactW:true};B.scale=G;B.isMultiChar=true;this.setStackWidth(r,B.bbox.w)},createChar:function(s,p,n,k){s.isMathJax=true;var r=s,t="",o={fonts:[p[1]],noRemap:true};if(k&&k===g.VARIANT.BOLD){o.fonts=[p[1]+"-bold",p[1]]}if(typeof(p[1])!=="string"){o=p[1]}if(p[0] instanceof Array){for(var q=0,l=p[0].length;q<l;q++){t+=String.fromCharCode(p[0][q])}}else{t=String.fromCharCode(p[0])}if(p[4]){n*=p[4]}if(n!==1||p[3]){r=this.addElement(s,"span",{style:{fontSize:this.Percent(n)},scale:n,isMathJax:true});this.handleVariant(r,o,t);s.bbox=r.bbox}else{this.handleVariant(s,o,t)}if(p[2]){s.style.marginLeft=this.Em(p[2])}if(p[3]){s.firstChild.style.verticalAlign=this.Em(p[3]);s.bbox.h+=p[3];if(s.bbox.h<0){s.bbox.h=0}}if(p[5]){s.bbox.h+=p[5]}if(p[6]){s.bbox.d+=p[6]}if(this.AccentBug&&s.bbox.w===0){r.firstChild.nodeValue+=this.NBSP}},positionDelimiter:function(l,k){k-=l.bbox.h;l.bbox.d-=k;l.bbox.h+=k;if(k){if(this.safariVerticalAlignBug||this.konquerorVerticalAlignBug||(this.operaVerticalAlignBug&&l.isMultiChar)){if(l.firstChild.style.display===""&&l.style.top!==""){l=l.firstChild;k-=d.unEm(l.style.top)}l.style.position="relative";l.style.top=this.Em(-k)}else{l.style.verticalAlign=this.Em(k);if(d.ffVerticalAlignBug){d.createRule(l.parentNode,l.bbox.h,0,0);delete l.parentNode.bbox}}}},handleVariant:function(z,o,r){var y="",w,B,s,C,k=z,l=!!z.style.fontFamily;if(r.length===0){return}if(!z.bbox){z.bbox={w:0,h:-this.BIGDIMEN,d:-this.BIGDIMEN,rw:-this.BIGDIMEN,lw:this.BIGDIMEN}}if(!o){o=this.FONTDATA.VARIANT[g.VARIANT.NORMAL]}C=o;for(var A=0,x=r.length;A<x;A++){o=C;w=r.charCodeAt(A);B=r.charAt(A);if(w>=55296&&w<56319){A++;w=(((w-55296)<<10)+(r.charCodeAt(A)-56320))+65536;if(this.FONTDATA.RemapPlane1){var D=this.FONTDATA.RemapPlane1(w,o);w=D.n;o=D.variant}}else{var t,q,u=this.FONTDATA.RANGES;for(t=0,q=u.length;t<q;t++){if(u[t].name==="alpha"&&o.noLowerCase){continue}var p=o["offset"+u[t].offset];if(p&&w>=u[t].low&&w<=u[t].high){if(u[t].remap&&u[t].remap[w]){w=p+u[t].remap[w]}else{w=w-u[t].low+p;if(u[t].add){w+=u[t].add}}if(o["variant"+u[t].offset]){o=this.FONTDATA.VARIANT[o["variant"+u[t].offset]]}break}}}if(o.remap&&o.remap[w]){w=o.remap[w];if(o.remap.variant){o=this.FONTDATA.VARIANT[o.remap.variant]}}else{if(this.FONTDATA.REMAP[w]&&!o.noRemap){w=this.FONTDATA.REMAP[w]}}if(w instanceof Array){o=this.FONTDATA.VARIANT[w[1]];w=w[0]}if(typeof(w)==="string"){r=w+r.substr(A+1);x=r.length;A=-1;continue}s=this.lookupChar(o,w);B=s[w];if(l||(!this.checkFont(s,k.style)&&!B[5].img)){if(y.length){this.addText(k,y);y=""}var v=!!k.style.fontFamily||!!z.style.fontStyle||!!z.style.fontWeight||!s.directory||l;l=false;if(k!==z){v=!this.checkFont(s,z.style);k=z}if(v){k=this.addElement(z,"span",{isMathJax:true,subSpan:true})}this.handleFont(k,s,k!==z)}y=this.handleChar(k,s,B,w,y);if(!(B[5]||{}).space){if(B[0]/1000>z.bbox.h){z.bbox.h=B[0]/1000}if(B[1]/1000>z.bbox.d){z.bbox.d=B[1]/1000}}if(z.bbox.w+B[3]/1000<z.bbox.lw){z.bbox.lw=z.bbox.w+B[3]/1000}if(z.bbox.w+B[4]/1000>z.bbox.rw){z.bbox.rw=z.bbox.w+B[4]/1000}z.bbox.w+=B[2]/1000}if(y.length){this.addText(k,y)}if(z.scale&&z.scale!==1){z.bbox.h*=z.scale;z.bbox.d*=z.scale;z.bbox.w*=z.scale;z.bbox.lw*=z.scale;z.bbox.rw*=z.scale}if(r.length==1&&s.skew&&s.skew[w]){z.bbox.skew=s.skew[w]}},checkFont:function(k,l){var m=(l.fontWeight||"normal");if(m.match(/^\d+$/)){m=(parseInt(m)>=600?"bold":"normal")}return(k.family.replace(/'/g,"")===l.fontFamily.replace(/'/g,"")&&(k.style||"normal")===(l.fontStyle||"normal")&&(k.weight||"normal")===m)},handleFont:function(m,k,o){m.style.fontFamily=k.family;if(!k.directory){m.style.fontSize=Math.floor(d.config.scale/d.scale+0.5)+"%"}if(!(d.FontFaceBug&&k.isWebFont)){var l=k.style||"normal",n=k.weight||"normal";if(l!=="normal"||o){m.style.fontStyle=l}if(n!=="normal"||o){m.style.fontWeight=n}}},handleChar:function(l,k,s,r,q){var p=s[5];if(p.space){if(q.length){this.addText(l,q)}d.createShift(l,s[2]/1000);return""}if(p.img){return this.handleImg(l,k,s,r,q)}if(p.isUnknown&&this.FONTDATA.DELIMITERS[r]){if(q.length){this.addText(l,q)}var o=l.scale;d.createDelimiter(l,r,0,1,k);if(this.FONTDATA.DELIMITERS[r].dir==="V"){l.style.verticalAlign=this.Em(l.bbox.d);l.bbox.h+=l.bbox.d;l.bbox.d=0}l.scale=o;s[0]=l.bbox.h*1000;s[1]=l.bbox.d*1000;s[2]=l.bbox.w*1000;s[3]=l.bbox.lw*1000;s[4]=l.bbox.rw*1000;return""}if(p.c==null){if(r<=65535){p.c=String.fromCharCode(r)}else{var m=r-65536;p.c=String.fromCharCode((m>>10)+55296)+String.fromCharCode((m&1023)+56320)}}if(p.rfix){this.addText(l,q+p.c);d.createShift(l,p.rfix/1000);return""}if(s[2]||!this.msieAccentBug||q.length){return q+p.c}d.createShift(l,s[3]/1000);d.createShift(l,(s[4]-s[3])/1000);this.addText(l,p.c);d.createShift(l,-s[4]/1000);return""},handleImg:function(l,k,p,o,m){return m},lookupChar:function(p,s){var o,k;if(!p.FONTS){var r=this.FONTDATA.FONTS;var q=(p.fonts||this.FONTDATA.VARIANT.normal.fonts);if(!(q instanceof Array)){q=[q]}if(p.fonts!=q){p.fonts=q}p.FONTS=[];for(o=0,k=q.length;o<k;o++){if(r[q[o]]){p.FONTS.push(r[q[o]]);r[q[o]].name=q[o]}}}for(o=0,k=p.FONTS.length;o<k;o++){var l=p.FONTS[o];if(typeof(l)==="string"){delete p.FONTS;this.loadFont(l)}if(l[s]){if(l[s].length===5){l[s][5]={}}if(d.allowWebFonts&&!l.available){this.loadWebFont(l)}else{return l}}else{this.findBlock(l,s)}}return this.unknownChar(p,s)},unknownChar:function(k,m){var l=(k.defaultFont||{family:d.config.undefinedFamily});if(k.bold){l.weight="bold"}if(k.italic){l.style="italic"}if(!l[m]){l[m]=[800,200,500,0,500,{isUnknown:true}]}b.signal.Post(["HTML-CSS Jax - unknown char",m,k]);return l},findBlock:function(l,q){if(l.Ranges){for(var p=0,k=l.Ranges.length;p<k;p++){if(q<l.Ranges[p][0]){return}if(q<=l.Ranges[p][1]){var o=l.Ranges[p][2];for(var n=l.Ranges.length-1;n>=0;n--){if(l.Ranges[n][2]==o){l.Ranges.splice(n,1)}}this.loadFont(l.directory+"/"+o+".js")}}}},loadFont:function(l){var k=MathJax.Callback.Queue();k.Push(["Require",h,this.fontDir+"/"+l]);if(this.imgFonts){if(!MathJax.isPacked){l=l.replace(/\/([^\/]*)$/,d.imgPacked+"/$1")}k.Push(["Require",h,this.webfontDir+"/png/"+l])}b.RestartAfter(k.Push({}))},loadWebFont:function(k){k.available=k.isWebFont=true;if(d.FontFaceBug){k.family=k.name;if(d.msieFontCSSBug){k.family+="-Web"}}b.RestartAfter(this.Font.loadWebFont(k))},loadWebFontError:function(l,k){b.Startup.signal.Post("HTML-CSS Jax - disable web fonts");l.isWebFont=false;if(this.config.imageFont&&this.config.imageFont===this.fontInUse){this.imgFonts=true;b.Startup.signal.Post("HTML-CSS Jax - switch to image fonts");b.Startup.signal.Post("HTML-CSS Jax - using image fonts");e(["WebFontNotAvailable","Web-Fonts not available -- using image fonts instead"],null,3000);h.Require(this.directory+"/imageFonts.js",k)}else{this.allowWebFonts=false;k()}},Element:MathJax.HTML.Element,addElement:MathJax.HTML.addElement,TextNode:MathJax.HTML.TextNode,addText:MathJax.HTML.addText,ucMatch:MathJax.HTML.ucMatch,BIGDIMEN:10000000,ID:0,idPostfix:"",GetID:function(){this.ID++;return this.ID},MATHSPACE:{veryverythinmathspace:1/18,verythinmathspace:2/18,thinmathspace:3/18,mediummathspace:4/18,thickmathspace:5/18,verythickmathspace:6/18,veryverythickmathspace:7/18,negativeveryverythinmathspace:-1/18,negativeverythinmathspace:-2/18,negativethinmathspace:-3/18,negativemediummathspace:-4/18,negativethickmathspace:-5/18,negativeverythickmathspace:-6/18,negativeveryverythickmathspace:-7/18},TeX:{x_height:0.430554,quad:1,num1:0.676508,num2:0.393732,num3:0.44373,denom1:0.685951,denom2:0.344841,sup1:0.412892,sup2:0.362892,sup3:0.288888,sub1:0.15,sub2:0.247217,sup_drop:0.386108,sub_drop:0.05,delim1:2.39,delim2:1,axis_height:0.25,rule_thickness:0.06,big_op_spacing1:0.111111,big_op_spacing2:0.166666,big_op_spacing3:0.2,big_op_spacing4:0.6,big_op_spacing5:0.1,scriptspace:0.1,nulldelimiterspace:0.12,delimiterfactor:901,delimitershortfall:0.3,min_rule_thickness:1.25},NBSP:"\u00A0",rfuzz:0});MathJax.Hub.Register.StartupHook("mml Jax Ready",function(){g=MathJax.ElementJax.mml;g.mbase.Augment({toHTML:function(o){o=this.HTMLcreateSpan(o);if(this.type!="mrow"){o=this.HTMLhandleSize(o)}for(var l=0,k=this.data.length;l<k;l++){if(this.data[l]){this.data[l].toHTML(o)}}var s=this.HTMLcomputeBBox(o);var n=o.bbox.h,r=o.bbox.d,p=false,q;for(l=0,k=s.length;l<k;l++){q=s[l].HTMLspanElement().bbox;if(s[l].forceStretch||q.h!==n||q.d!==r){s[l].HTMLstretchV(o,n,r);p=true}}if(p){this.HTMLcomputeBBox(o,true)}if(this.HTMLlineBreaks(o)){o=this.HTMLmultiline(o)}this.HTMLhandleSpace(o);this.HTMLhandleColor(o);if(this.data.length===1&&this.data[0]){q=this.data[0].HTMLspanElement().bbox;if(q.skew){o.bbox.skew=q.skew}}return o},HTMLlineBreaks:function(){return false},HTMLmultiline:function(){g.mbase.HTMLautoloadFile("multiline")},HTMLcomputeBBox:function(q,p,o,k){if(o==null){o=0}if(k==null){k=this.data.length}var n=q.bbox={exactW:true},r=[];while(o<k){var l=this.data[o];if(!l){continue}if(!p&&l.HTMLcanStretch("Vertical")){r.push(l);l=(l.CoreMO()||l)}this.HTMLcombineBBoxes(l,n);o++}this.HTMLcleanBBox(n);return r},HTMLcombineBBoxes:function(k,l){if(l.w==null){this.HTMLemptyBBox(l)}var n=(k.bbox?k:k.HTMLspanElement());if(!n||!n.bbox){return}var m=n.bbox;if(m.d>l.d){l.d=m.d}if(m.h>l.h){l.h=m.h}if(m.D!=null&&m.D>l.D){l.D=m.D}if(m.H!=null&&m.H>l.H){l.H=m.H}if(n.style.paddingLeft){l.w+=d.unEm(n.style.paddingLeft)*(n.scale||1)}if(l.w+m.lw<l.lw){l.lw=l.w+m.lw}if(l.w+m.rw>l.rw){l.rw=l.w+m.rw}l.w+=m.w;if(n.style.paddingRight){l.w+=d.unEm(n.style.paddingRight)*(n.scale||1)}if(m.width){l.width=m.width;l.minWidth=m.minWidth}if(m.tw){l.tw=m.tw}if(m.ic){l.ic=m.ic}else{delete l.ic}if(l.exactW&&!m.exactW){delete l.exactW}},HTMLemptyBBox:function(k){k.h=k.d=k.H=k.D=k.rw=-d.BIGDIMEN;k.w=0;k.lw=d.BIGDIMEN;return k},HTMLcleanBBox:function(k){if(k.h===this.BIGDIMEN){k.h=k.d=k.H=k.D=k.w=k.rw=k.lw=0}if(k.D<=k.d){delete k.D}if(k.H<=k.h){delete k.H}},HTMLzeroBBox:function(){return{h:0,d:0,w:0,lw:0,rw:0}},HTMLcanStretch:function(l){if(this.isEmbellished()){var k=this.Core();if(k&&k!==this){return k.HTMLcanStretch(l)}}return false},HTMLstretchH:function(l,k){return this.HTMLspanElement()},HTMLstretchV:function(l,k,m){return this.HTMLspanElement()},HTMLnotEmpty:function(k){while(k){if((k.type!=="mrow"&&k.type!=="texatom")||k.data.length>1){return true}k=k.data[0]}return false},HTMLmeasureChild:function(l,k){if(this.data[l]){d.Measured(this.data[l].toHTML(k),k)}else{k.bbox=this.HTMLzeroBBox()}},HTMLboxChild:function(l,k){if(!this.data[l]){this.SetData(l,g.mrow())}return this.data[l].toHTML(k)},HTMLcreateSpan:function(k){if(this.spanID){var l=this.HTMLspanElement();if(l&&(l.parentNode===k||(l.parentNode||{}).parentNode===k)){while(l.firstChild){l.removeChild(l.firstChild)}l.bbox=this.HTMLzeroBBox();l.scale=1;l.isMultChar=l.HH=null;l.style.cssText="";return l}}if(this.href){k=d.addElement(k,"a",{href:this.href,isMathJax:true})}k=d.addElement(k,"span",{className:this.type,isMathJax:true});if(d.imgHeightBug){k.style.display="inline-block"}if(this["class"]){k.className+=" "+this["class"]}if(!this.spanID){this.spanID=d.GetID()}k.id=(this.id||"MathJax-Span-"+this.spanID)+d.idPostfix;k.bbox=this.HTMLzeroBBox();this.styles={};if(this.style){k.style.cssText=this.style;if(k.style.fontSize){this.mathsize=k.style.fontSize;k.style.fontSize=""}this.styles={border:d.getBorders(k),padding:d.getPadding(k)};if(this.styles.border){k.style.border=""}if(this.styles.padding){k.style.padding=""}}if(this.href){k.parentNode.bbox=k.bbox}this.HTMLaddAttributes(k);return k},HTMLaddAttributes:function(n){if(this.attrNames){var s=this.attrNames,o=g.nocopyAttributes,r=b.config.ignoreMMLattributes;var p=(this.type==="mstyle"?g.math.prototype.defaults:this.defaults);for(var l=0,k=s.length;l<k;l++){var q=s[l];if(r[q]==false||(!o[q]&&!r[q]&&p[q]==null&&typeof(n[q])==="undefined")){n.setAttribute(q,this.attr[q])}}}},HTMLspanElement:function(){if(!this.spanID){return null}return document.getElementById((this.id||"MathJax-Span-"+this.spanID)+d.idPostfix)},HTMLhandleVariant:function(l,k,m){d.handleVariant(l,k,m)},HTMLhandleSize:function(k){if(!k.scale){k.scale=this.HTMLgetScale();if(k.scale!==1){k.style.fontSize=d.Percent(k.scale)}}return k},HTMLhandleDir:function(l){var k=this.Get("dir",true);if(k){l.dir=k}return l},HTMLhandleColor:function(w){var y=this.getValues("mathcolor","color");if(this.mathbackground){y.mathbackground=this.mathbackground}if(this.background){y.background=this.background}if(this.style&&w.style.backgroundColor){y.mathbackground=w.style.backgroundColor;w.style.backgroundColor="transparent"}var t=(this.styles||{}).border,v=(this.styles||{}).padding;if(y.color&&!this.mathcolor){y.mathcolor=y.color}if(y.background&&!this.mathbackground){y.mathbackground=y.background}if(y.mathcolor){w.style.color=y.mathcolor}if((y.mathbackground&&y.mathbackground!==g.COLOR.TRANSPARENT)||t||v){var A=w.bbox,z=(A.exact?0:1/d.em),u=0,s=0,m=w.style.paddingLeft,q=w.style.paddingRight;if(this.isToken){u=A.lw;s=A.rw-A.w}if(m!==""){u+=d.unEm(m)*(w.scale||1)}if(q!==""){s-=d.unEm(q)*(w.scale||1)}var l=(d.PaddingWidthBug||A.keepPadding||A.exactW?0:s-u);var o=Math.max(0,d.getW(w)+l);var x=A.h+A.d,k=-A.d,r=0,p=0;if(o>0){o+=2*z;u-=z}if(x>0){x+=2*z;k-=z}s=-o-u;if(t){s-=t.right;k-=t.bottom;r+=t.left;p+=t.right;A.h+=t.top;A.d+=t.bottom;A.w+=t.left+t.right;A.lw-=t.left;A.rw+=t.right}if(v){x+=v.top+v.bottom;o+=v.left+v.right;s-=v.right;k-=v.bottom;r+=v.left;p+=v.right;A.h+=v.top;A.d+=v.bottom;A.w+=v.left+v.right;A.lw-=v.left;A.rw+=v.right}if(p){w.style.paddingRight=d.Em(p)}var n=d.Element("span",{id:"MathJax-Color-"+this.spanID+d.idPostfix,isMathJax:true,style:{display:"inline-block",backgroundColor:y.mathbackground,width:d.Em(o),height:d.Em(x),verticalAlign:d.Em(k),marginLeft:d.Em(u),marginRight:d.Em(s)}});d.setBorders(n,t);if(A.width){n.style.width=A.width;n.style.marginRight="-"+A.width}if(d.msieInlineBlockAlignBug){n.style.position="relative";n.style.width=n.style.height=0;n.style.verticalAlign=n.style.marginLeft=n.style.marginRight="";n.style.border=n.style.padding="";if(t&&d.msieBorderWidthBug){x+=t.top+t.bottom;o+=t.left+t.right}n.style.width=d.Em(r+z);d.placeBox(d.addElement(n,"span",{noAdjust:true,isMathJax:true,style:{display:"inline-block",position:"absolute",overflow:"hidden",background:(y.mathbackground||"transparent"),width:d.Em(o),height:d.Em(x)}}),u,A.h+z);d.setBorders(n.firstChild,t)}w.parentNode.insertBefore(n,w);if(d.msieColorPositionBug){w.style.position="relative"}return n}return null},HTMLremoveColor:function(){var k=document.getElementById("MathJax-Color-"+this.spanID+d.idPostfix);if(k){k.parentNode.removeChild(k)}},HTMLhandleSpace:function(o){if(this.useMMLspacing){if(this.type!=="mo"){return}var m=this.getValues("scriptlevel","lspace","rspace");if(m.scriptlevel<=0||this.hasValue("lspace")||this.hasValue("rspace")){var l=this.HTMLgetMu(o);m.lspace=Math.max(0,d.length2em(m.lspace,l));m.rspace=Math.max(0,d.length2em(m.rspace,l));var k=this,n=this.Parent();while(n&&n.isEmbellished()&&n.Core()===k){k=n;n=n.Parent();o=k.HTMLspanElement()}if(m.lspace){o.style.paddingLeft=d.Em(m.lspace)}if(m.rspace){o.style.paddingRight=d.Em(m.rspace)}}}else{var p=this.texSpacing();if(p!==""){this.HTMLgetScale();p=d.length2em(p,this.scale)/(o.scale||1)*this.mscale;if(o.style.paddingLeft){p+=d.unEm(o.style.paddingLeft)}o.style.paddingLeft=d.Em(p)}}},HTMLgetScale:function(){if(this.scale){return this.scale*this.mscale}var m=1,k=this.getValues("scriptlevel","fontsize");k.mathsize=(this.isToken?this:this.Parent()).Get("mathsize");if(this.style){var l=this.HTMLspanElement();if(l.style.fontSize!=""){k.fontsize=l.style.fontSize}}if(k.fontsize&&!this.mathsize){k.mathsize=k.fontsize}if(k.scriptlevel!==0){if(k.scriptlevel>2){k.scriptlevel=2}m=Math.pow(this.Get("scriptsizemultiplier"),k.scriptlevel);k.scriptminsize=d.length2em(this.Get("scriptminsize"));if(m<k.scriptminsize){m=k.scriptminsize}}this.scale=m;this.mscale=d.length2em(k.mathsize);return m*this.mscale},HTMLgetMu:function(m){var k=1,l=this.getValues("scriptlevel","scriptsizemultiplier");if(m.scale&&m.scale!==1){k=1/m.scale}if(l.scriptlevel!==0){if(l.scriptlevel>2){l.scriptlevel=2}k=Math.sqrt(Math.pow(l.scriptsizemultiplier,l.scriptlevel))}return k},HTMLgetVariant:function(){var k=this.getValues("mathvariant","fontfamily","fontweight","fontstyle");k.hasVariant=this.Get("mathvariant",true);if(!k.hasVariant){k.family=k.fontfamily;k.weight=k.fontweight;k.style=k.fontstyle}if(this.style){var m=this.HTMLspanElement();if(!k.family&&m.style.fontFamily){k.family=m.style.fontFamily}if(!k.weight&&m.style.fontWeight){k.weight=m.style.fontWeight}if(!k.style&&m.style.fontStyle){k.style=m.style.fontStyle}}if(k.weight&&k.weight.match(/^\d+$/)){k.weight=(parseInt(k.weight)>600?"bold":"normal")}var l=k.mathvariant;if(this.variantForm){l="-"+d.fontInUse+"-variant"}if(k.family&&!k.hasVariant){if(!k.weight&&k.mathvariant.match(/bold/)){k.weight="bold"}if(!k.style&&k.mathvariant.match(/italic/)){k.style="italic"}return{FONTS:[],fonts:[],noRemap:true,defaultFont:{family:k.family,style:k.style,weight:k.weight}}}if(k.weight==="bold"){l={normal:g.VARIANT.BOLD,italic:g.VARIANT.BOLDITALIC,fraktur:g.VARIANT.BOLDFRAKTUR,script:g.VARIANT.BOLDSCRIPT,"sans-serif":g.VARIANT.BOLDSANSSERIF,"sans-serif-italic":g.VARIANT.SANSSERIFBOLDITALIC}[l]||l}else{if(k.weight==="normal"){l={bold:g.VARIANT.normal,"bold-italic":g.VARIANT.ITALIC,"bold-fraktur":g.VARIANT.FRAKTUR,"bold-script":g.VARIANT.SCRIPT,"bold-sans-serif":g.VARIANT.SANSSERIF,"sans-serif-bold-italic":g.VARIANT.SANSSERIFITALIC}[l]||l}}if(k.style==="italic"){l={normal:g.VARIANT.ITALIC,bold:g.VARIANT.BOLDITALIC,"sans-serif":g.VARIANT.SANSSERIFITALIC,"bold-sans-serif":g.VARIANT.SANSSERIFBOLDITALIC}[l]||l}else{if(k.style==="normal"){l={italic:g.VARIANT.NORMAL,"bold-italic":g.VARIANT.BOLD,"sans-serif-italic":g.VARIANT.SANSSERIF,"sans-serif-bold-italic":g.VARIANT.BOLDSANSSERIF}[l]||l}}if(!(l in d.FONTDATA.VARIANT)){l="normal"}return d.FONTDATA.VARIANT[l]}},{HTMLautoload:function(){var k=d.autoloadDir+"/"+this.type+".js";b.RestartAfter(h.Require(k))},HTMLautoloadFile:function(k){var l=d.autoloadDir+"/"+k+".js";b.RestartAfter(h.Require(l))},HTMLstretchH:function(l,k){this.HTMLremoveColor();return this.toHTML(l,k)},HTMLstretchV:function(l,k,m){this.HTMLremoveColor();return this.toHTML(l,k,m)}});g.chars.Augment({toHTML:function(n,m,l,o){var r=this.data.join("").replace(/[\u2061-\u2064]/g,"");if(l){r=l(r,o)}if(m.fontInherit){var q=Math.floor(d.config.scale/d.scale+0.5)+"%";d.addElement(n,"span",{style:{"font-size":q}},[r]);if(m.bold){n.lastChild.style.fontWeight="bold"}if(m.italic){n.lastChild.style.fontStyle="italic"}n.bbox=null;var p=d.getHD(n),k=d.getW(n);n.bbox={h:p.h,d:p.d,w:k,lw:0,rw:k,exactW:true}}else{this.HTMLhandleVariant(n,m,r)}}});g.entity.Augment({toHTML:function(n,m,l,o){var r=this.toString().replace(/[\u2061-\u2064]/g,"");if(l){r=l(r,o)}if(m.fontInherit){var q=Math.floor(d.config.scale/d.scale+0.5)+"%";d.addElement(n,"span",{style:{"font-size":q}},[r]);if(m.bold){n.lastChild.style.fontWeight="bold"}if(m.italic){n.lastChild.style.fontStyle="italic"}delete n.bbox;var p=d.getHD(n),k=d.getW(n);n.bbox={h:p.h,d:p.d,w:k,lw:0,rw:k,exactW:true}}else{this.HTMLhandleVariant(n,m,r)}}});g.mi.Augment({toHTML:function(o){o=this.HTMLhandleSize(this.HTMLcreateSpan(o));o.bbox=null;var n=this.HTMLgetVariant();for(var l=0,k=this.data.length;l<k;l++){if(this.data[l]){this.data[l].toHTML(o,n)}}if(!o.bbox){o.bbox=this.HTMLzeroBBox()}var q=this.data.join(""),p=o.bbox;if(p.skew&&q.length!==1){delete p.skew}if(p.rw>p.w&&q.length===1&&!n.noIC){p.ic=p.rw-p.w;d.createBlank(o,p.ic/this.mscale);p.w=p.rw}this.HTMLhandleSpace(o);this.HTMLhandleColor(o);this.HTMLhandleDir(o);return o}});g.mn.Augment({toHTML:function(o){o=this.HTMLhandleSize(this.HTMLcreateSpan(o));o.bbox=null;var n=this.HTMLgetVariant();for(var l=0,k=this.data.length;l<k;l++){if(this.data[l]){this.data[l].toHTML(o,n)}}if(!o.bbox){o.bbox=this.HTMLzeroBBox()}if(this.data.join("").length!==1){delete o.bbox.skew}this.HTMLhandleSpace(o);this.HTMLhandleColor(o);this.HTMLhandleDir(o);return o}});g.mo.Augment({toHTML:function(v){v=this.HTMLhandleSize(this.HTMLcreateSpan(v));if(this.data.length==0){return v}else{v.bbox=null}var y=this.data.join("");var q=this.HTMLgetVariant();var x=this.getValues("largeop","displaystyle");if(x.largeop){q=d.FONTDATA.VARIANT[x.displaystyle?"-largeOp":"-smallOp"]}var w=this.CoreParent(),o=(w&&w.isa(g.msubsup)&&this!==w.data[w.base]),l=(o?this.remapChars:null);if(y.length===1&&w&&w.isa(g.munderover)&&this.CoreText(w.data[w.base]).length===1){var s=w.data[w.over],u=w.data[w.under];if(s&&this===s.CoreMO()&&w.Get("accent")){l=d.FONTDATA.REMAPACCENT}else{if(u&&this===u.CoreMO()&&w.Get("accentunder")){l=d.FONTDATA.REMAPACCENTUNDER}}}if(o&&y.match(/['`"\u00B4\u2032-\u2037\u2057]/)){q=d.FONTDATA.VARIANT["-"+d.fontInUse+"-variant"]}for(var r=0,n=this.data.length;r<n;r++){if(this.data[r]){this.data[r].toHTML(v,q,this.remap,l)}}if(!v.bbox){v.bbox=this.HTMLzeroBBox()}if(y.length!==1){delete v.bbox.skew}if(d.AccentBug&&v.bbox.w===0&&y.length===1&&v.firstChild){v.firstChild.nodeValue+=d.NBSP;d.createSpace(v,0,0,-v.offsetWidth/d.em)}if(x.largeop){var t=d.TeX.axis_height*this.scale*this.mscale;var k=(v.bbox.h-v.bbox.d)/2-t;if(d.safariVerticalAlignBug&&v.lastChild.nodeName==="IMG"){v.lastChild.style.verticalAlign=d.Em(d.unEm(v.lastChild.style.verticalAlign||0)/d.em-k/v.scale)}else{if(d.konquerorVerticalAlignBug&&v.lastChild.nodeName==="IMG"){v.style.position="relative";v.lastChild.style.position="relative";v.lastChild.style.top=d.Em(k/v.scale)}else{v.style.verticalAlign=d.Em(-k/v.scale)}}v.bbox.h-=k;v.bbox.d+=k;if(v.bbox.rw>v.bbox.w){v.bbox.ic=v.bbox.rw-v.bbox.w;d.createBlank(v,v.bbox.ic/this.mscale);v.bbox.w=v.bbox.rw}}this.HTMLhandleSpace(v);this.HTMLhandleColor(v);this.HTMLhandleDir(v);return v},HTMLcanStretch:function(o){if(!this.Get("stretchy")){return false}var p=this.data.join("");if(p.length>1){return false}var m=this.CoreParent();if(m&&m.isa(g.munderover)&&this.CoreText(m.data[m.base]).length===1){var n=m.data[m.over],l=m.data[m.under];if(n&&this===n.CoreMO()&&m.Get("accent")){p=d.FONTDATA.REMAPACCENT[p]||p}else{if(l&&this===l.CoreMO()&&m.Get("accentunder")){p=d.FONTDATA.REMAPACCENTUNDER[p]||p}}}p=d.FONTDATA.DELIMITERS[p.charCodeAt(0)];var k=(p&&p.dir===o.substr(0,1));this.forceStretch=(k&&(this.Get("minsize",true)||this.Get("maxsize",true)));return k},HTMLstretchV:function(m,n,o){this.HTMLremoveColor();var r=this.getValues("symmetric","maxsize","minsize");var p=this.HTMLspanElement(),s=this.HTMLgetMu(p),q;var l=this.HTMLgetScale(),k=d.TeX.axis_height*l;if(r.symmetric){q=2*Math.max(n-k,o+k)}else{q=n+o}r.maxsize=d.length2em(r.maxsize,s,p.bbox.h+p.bbox.d);r.minsize=d.length2em(r.minsize,s,p.bbox.h+p.bbox.d);q=Math.max(r.minsize,Math.min(r.maxsize,q));if(q!=r.minsize){q=[Math.max(q*d.TeX.delimiterfactor/1000,q-d.TeX.delimitershortfall),q]}p=this.HTMLcreateSpan(m);d.createDelimiter(p,this.data.join("").charCodeAt(0),q,l);if(r.symmetric){q=(p.bbox.h+p.bbox.d)/2+k}else{q=(p.bbox.h+p.bbox.d)*n/(n+o)}d.positionDelimiter(p,q);this.HTMLhandleSpace(p);this.HTMLhandleColor(p);return p},HTMLstretchH:function(o,k){this.HTMLremoveColor();var m=this.getValues("maxsize","minsize","mathvariant","fontweight");if((m.fontweight==="bold"||parseInt(m.fontweight)>=600)&&!this.Get("mathvariant",true)){m.mathvariant=g.VARIANT.BOLD}var n=this.HTMLspanElement(),l=this.HTMLgetMu(n),p=n.scale;m.maxsize=d.length2em(m.maxsize,l,n.bbox.w);m.minsize=d.length2em(m.minsize,l,n.bbox.w);k=Math.max(m.minsize,Math.min(m.maxsize,k));n=this.HTMLcreateSpan(o);d.createDelimiter(n,this.data.join("").charCodeAt(0),k,p,m.mathvariant);this.HTMLhandleSpace(n);this.HTMLhandleColor(n);return n}});g.mtext.Augment({toHTML:function(o){o=this.HTMLhandleSize(this.HTMLcreateSpan(o));var n=this.HTMLgetVariant();if(d.config.mtextFontInherit||this.Parent().type==="merror"){var p=this.Get("mathvariant");if(p==="monospace"){o.className+=" MJX-monospace"}else{if(p.match(/sans-serif/)){o.className+=" MJX-sans-serif"}}n={bold:n.bold,italic:n.italic,fontInherit:true}}for(var l=0,k=this.data.length;l<k;l++){if(this.data[l]){this.data[l].toHTML(o,n)}}if(!o.bbox){o.bbox=this.HTMLzeroBBox()}if(this.data.join("").length!==1){delete o.bbox.skew}this.HTMLhandleSpace(o);this.HTMLhandleColor(o);this.HTMLhandleDir(o);return o}});g.merror.Augment({toHTML:function(l){var n=MathJax.HTML.addElement(l,"span",{style:{display:"inline-block"}});l=this.SUPER(arguments).toHTML.call(this,n);var m=d.getHD(n),k=d.getW(n);n.bbox={h:m.h,d:m.d,w:k,lw:0,rw:k,exactW:true};n.id=l.id;l.id=null;return n}});g.ms.Augment({toHTML:g.mbase.HTMLautoload});g.mglyph.Augment({toHTML:g.mbase.HTMLautoload});g.mspace.Augment({toHTML:function(o){o=this.HTMLcreateSpan(o);var m=this.getValues("height","depth","width");var l=this.HTMLgetMu(o);this.HTMLgetScale();m.mathbackground=this.mathbackground;if(this.background&&!this.mathbackground){m.mathbackground=this.background}var n=d.length2em(m.height,l)*this.mscale,p=d.length2em(m.depth,l)*this.mscale,k=d.length2em(m.width,l)*this.mscale;d.createSpace(o,n,p,k,m.mathbackground,true);return o}});g.mphantom.Augment({toHTML:function(o,l,q){o=this.HTMLcreateSpan(o);if(this.data[0]!=null){var p=this.data[0].toHTML(o);if(q!=null){d.Remeasured(this.data[0].HTMLstretchV(o,l,q),o)}else{if(l!=null){d.Remeasured(this.data[0].HTMLstretchH(o,l),o)}else{p=d.Measured(p,o)}}o.bbox={w:p.bbox.w,h:p.bbox.h,d:p.bbox.d,lw:0,rw:0,exactW:true};for(var n=0,k=o.childNodes.length;n<k;n++){o.childNodes[n].style.visibility="hidden"}}this.HTMLhandleSpace(o);this.HTMLhandleColor(o);return o},HTMLstretchH:g.mbase.HTMLstretchH,HTMLstretchV:g.mbase.HTMLstretchV});g.mpadded.Augment({toHTML:function(s,m,k){s=this.HTMLcreateSpan(s);if(this.data[0]!=null){var q=d.createStack(s,true);var n=d.createBox(q);var l=this.data[0].toHTML(n);if(k!=null){d.Remeasured(this.data[0].HTMLstretchV(n,m,k),n)}else{if(m!=null){d.Remeasured(this.data[0].HTMLstretchH(n,m),n)}else{d.Measured(l,n)}}var t=this.getValues("height","depth","width","lspace","voffset"),r=0,p=0,u=this.HTMLgetMu(s);this.HTMLgetScale();if(t.lspace){r=this.HTMLlength2em(n,t.lspace,u)}if(t.voffset){p=this.HTMLlength2em(n,t.voffset,u)}d.placeBox(n,r,p);r/=this.mscale;p/=this.mscale;s.bbox={h:n.bbox.h,d:n.bbox.d,w:n.bbox.w,exactW:true,lw:n.bbox.lw+r,rw:n.bbox.rw+r,H:Math.max((n.bbox.H==null?-d.BIGDIMEN:n.bbox.H+p),n.bbox.h+p),D:Math.max((n.bbox.D==null?-d.BIGDIMEN:n.bbox.D-p),n.bbox.d-p)};if(t.height!==""){s.bbox.h=this.HTMLlength2em(n,t.height,u,"h",0)}if(t.depth!==""){s.bbox.d=this.HTMLlength2em(n,t.depth,u,"d",0)}if(t.width!==""){s.bbox.w=this.HTMLlength2em(n,t.width,u,"w",0)}if(s.bbox.H<=s.bbox.h){delete s.bbox.H}if(s.bbox.D<=s.bbox.d){delete s.bbox.D}var o=/^\s*(\d+(\.\d*)?|\.\d+)\s*(pt|em|ex|mu|px|pc|in|mm|cm)\s*$/;s.bbox.exact=!!((this.data[0]&&this.data[0].data.length==0)||o.exec(t.height)||o.exec(t.width)||o.exec(t.depth));d.setStackWidth(q,s.bbox.w)}this.HTMLhandleSpace(s);this.HTMLhandleColor(s);return s},HTMLlength2em:function(q,r,l,s,k){if(k==null){k=-d.BIGDIMEN}var o=String(r).match(/width|height|depth/);var p=(o?q.bbox[o[0].charAt(0)]:(s?q.bbox[s]:0));var n=d.length2em(r,l,p/this.mscale)*this.mscale;if(s&&String(r).match(/^\s*[-+]/)){return Math.max(k,q.bbox[s]+n)}else{return n}},HTMLstretchH:g.mbase.HTMLstretchH,HTMLstretchV:g.mbase.HTMLstretchV});g.mrow.Augment({HTMLlineBreaks:function(k){if(!this.parent.linebreakContainer){return false}return(d.config.linebreaks.automatic&&k.bbox.w>d.linebreakWidth)||this.hasNewline()},HTMLstretchH:function(m,k){this.HTMLremoveColor();var l=this.HTMLspanElement();this.data[this.core].HTMLstretchH(l,k);this.HTMLcomputeBBox(l,true);this.HTMLhandleColor(l);return l},HTMLstretchV:function(m,l,n){this.HTMLremoveColor();var k=this.HTMLspanElement();this.data[this.core].HTMLstretchV(k,l,n);this.HTMLcomputeBBox(k,true);this.HTMLhandleColor(k);return k}});g.mstyle.Augment({toHTML:function(l,k,m){l=this.HTMLcreateSpan(l);if(this.data[0]!=null){var n=this.data[0].toHTML(l);if(m!=null){this.data[0].HTMLstretchV(l,k,m)}else{if(k!=null){this.data[0].HTMLstretchH(l,k)}}l.bbox=n.bbox}this.HTMLhandleSpace(l);this.HTMLhandleColor(l);return l},HTMLstretchH:g.mbase.HTMLstretchH,HTMLstretchV:g.mbase.HTMLstretchV});g.mfrac.Augment({toHTML:function(D){D=this.HTMLcreateSpan(D);var m=d.createStack(D);var r=d.createBox(m),o=d.createBox(m);d.MeasureSpans([this.HTMLboxChild(0,r),this.HTMLboxChild(1,o)]);var k=this.getValues("displaystyle","linethickness","numalign","denomalign","bevelled");var I=this.HTMLgetScale(),C=k.displaystyle;var G=d.TeX.axis_height*I;if(k.bevelled){var F=(C?0.4:0.15);var s=Math.max(r.bbox.h+r.bbox.d,o.bbox.h+o.bbox.d)+2*F;var E=d.createBox(m);d.createDelimiter(E,47,s);d.placeBox(r,0,(r.bbox.d-r.bbox.h)/2+G+F);d.placeBox(E,r.bbox.w-F/2,(E.bbox.d-E.bbox.h)/2+G);d.placeBox(o,r.bbox.w+E.bbox.w-F,(o.bbox.d-o.bbox.h)/2+G-F)}else{var l=Math.max(r.bbox.w,o.bbox.w);var y=d.thickness2em(k.linethickness,this.scale)*this.mscale,A,z,x,w;var B=d.TeX.min_rule_thickness/this.em;if(C){x=d.TeX.num1;w=d.TeX.denom1}else{x=(y===0?d.TeX.num3:d.TeX.num2);w=d.TeX.denom2}x*=I;w*=I;if(y===0){A=Math.max((C?7:3)*d.TeX.rule_thickness,2*B);z=(x-r.bbox.d)-(o.bbox.h-w);if(z<A){x+=(A-z)/2;w+=(A-z)/2}}else{A=Math.max((C?2:0)*B+y,y/2+1.5*B);z=(x-r.bbox.d)-(G+y/2);if(z<A){x+=A-z}z=(G-y/2)-(o.bbox.h-w);if(z<A){w+=A-z}var n=d.createBox(m);d.createRule(n,y,0,l+2*y);d.placeBox(n,0,G-y/2)}d.alignBox(r,k.numalign,x);d.alignBox(o,k.denomalign,-w)}this.HTMLhandleSpace(D);this.HTMLhandleColor(D);return D},HTMLcanStretch:function(k){return false},HTMLhandleSpace:function(l){if(!this.texWithDelims&&!this.useMMLspacing){var m=d.TeX.nulldelimiterspace*this.mscale;var k=l.childNodes[d.msiePaddingWidthBug?1:0].style;k.marginLeft=k.marginRight=d.Em(m);l.bbox.w+=2*m;l.bbox.r+=2*m}this.SUPER(arguments).HTMLhandleSpace.call(this,l)}});g.msqrt.Augment({toHTML:function(w){w=this.HTMLcreateSpan(w);var z=d.createStack(w);var n=d.createBox(z),u=d.createBox(z),s=d.createBox(z);var r=this.HTMLgetScale();var A=d.TeX.rule_thickness*r,m,l,y,o;if(this.Get("displaystyle")){m=d.TeX.x_height*r}else{m=A}l=Math.max(A+m/4,1.5*d.TeX.min_rule_thickness/this.em);var k=this.HTMLboxChild(0,n);y=k.bbox.h+k.bbox.d+l+A;d.createDelimiter(s,8730,y,r);d.MeasureSpans([k,s]);o=k.bbox.w;var v=0;if(s.isMultiChar||(d.AdjustSurd&&d.imgFonts)){s.bbox.w*=0.95}if(s.bbox.h+s.bbox.d>y){l=((s.bbox.h+s.bbox.d)-(y-A))/2}var B=d.FONTDATA.DELIMITERS[d.FONTDATA.RULECHAR];if(!B||o<B.HW[0][0]*r||r<0.75){d.createRule(u,0,A,o)}else{d.createDelimiter(u,d.FONTDATA.RULECHAR,o,r)}y=k.bbox.h+l+A;l=y*d.rfuzz;if(s.isMultiChar){l=d.rfuzz}v=this.HTMLaddRoot(z,s,v,s.bbox.h+s.bbox.d-y,r);d.placeBox(s,v,y-s.bbox.h);d.placeBox(u,v+s.bbox.w,y-u.bbox.h+l);d.placeBox(n,v+s.bbox.w,0);this.HTMLhandleSpace(w);this.HTMLhandleColor(w);return w},HTMLaddRoot:function(m,l,k,o,n){return k}});g.mroot.Augment({toHTML:g.msqrt.prototype.toHTML,HTMLaddRoot:function(s,l,q,o,k){var m=d.createBox(s);if(this.data[1]){var p=this.data[1].toHTML(m);p.style.paddingRight=p.style.paddingLeft="";d.Measured(p,m)}else{m.bbox=this.HTMLzeroBBox()}var n=this.HTMLrootHeight(l.bbox.h+l.bbox.d,k,m)-o;var r=Math.min(m.bbox.w,m.bbox.rw);q=Math.max(r,l.offset);d.placeBox(m,q-r,n);return q-l.offset},HTMLrootHeight:function(m,l,k){return 0.45*(m-0.9*l)+0.6*l+Math.max(0,k.bbox.d-0.075)}});g.mfenced.Augment({toHTML:function(o){o=this.HTMLcreateSpan(o);if(this.data.open){this.data.open.toHTML(o)}if(this.data[0]!=null){this.data[0].toHTML(o)}for(var l=1,k=this.data.length;l<k;l++){if(this.data[l]){if(this.data["sep"+l]){this.data["sep"+l].toHTML(o)}this.data[l].toHTML(o)}}if(this.data.close){this.data.close.toHTML(o)}var q=this.HTMLcomputeBBox(o);var n=o.bbox.h,p=o.bbox.d;for(l=0,k=q.length;l<k;l++){q[l].HTMLstretchV(o,n,p)}if(q.length){this.HTMLcomputeBBox(o,true)}this.HTMLhandleSpace(o);this.HTMLhandleColor(o);return o},HTMLcomputeBBox:function(p,o){var l=p.bbox={},q=[];this.HTMLcheckStretchy(this.data.open,l,q,o);this.HTMLcheckStretchy(this.data[0],l,q,o);for(var n=1,k=this.data.length;n<k;n++){if(this.data[n]){this.HTMLcheckStretchy(this.data["sep"+n],l,q,o);this.HTMLcheckStretchy(this.data[n],l,q,o)}}this.HTMLcheckStretchy(this.data.close,l,q,o);this.HTMLcleanBBox(l);return q},HTMLcheckStretchy:function(k,l,n,m){if(k){if(!m&&k.HTMLcanStretch("Vertical")){n.push(k);k=(k.CoreMO()||k)}this.HTMLcombineBBoxes(k,l)}}});g.menclose.Augment({toHTML:g.mbase.HTMLautoload});g.maction.Augment({toHTML:g.mbase.HTMLautoload});g.semantics.Augment({toHTML:function(l,k,m){l=this.HTMLcreateSpan(l);if(this.data[0]!=null){var n=this.data[0].toHTML(l);if(m!=null){this.data[0].HTMLstretchV(l,k,m)}else{if(k!=null){this.data[0].HTMLstretchH(l,k)}}l.bbox=n.bbox}this.HTMLhandleSpace(l);return l},HTMLstretchH:g.mbase.HTMLstretchH,HTMLstretchV:g.mbase.HTMLstretchV});g.munderover.Augment({toHTML:function(L,H,F){var l=this.getValues("displaystyle","accent","accentunder","align");if(!l.displaystyle&&this.data[this.base]!=null&&this.data[this.base].CoreMO().Get("movablelimits")){return g.msubsup.prototype.toHTML.call(this,L)}L=this.HTMLcreateSpan(L);var P=this.HTMLgetScale();var q=d.createStack(L);var r=[],o=[],N=[],w,M,I;for(M=0,I=this.data.length;M<I;M++){if(this.data[M]!=null){w=r[M]=d.createBox(q);o[M]=this.data[M].toHTML(w);if(M==this.base){if(F!=null){this.data[this.base].HTMLstretchV(w,H,F)}else{if(H!=null){this.data[this.base].HTMLstretchH(w,H)}}N[M]=(F==null&&H!=null?false:this.data[M].HTMLcanStretch("Horizontal"))}else{N[M]=this.data[M].HTMLcanStretch("Horizontal");o[M].style.paddingLeft=o[M].style.paddingRight=""}}}d.MeasureSpans(o);var n=-d.BIGDIMEN,K=n;for(M=0,I=this.data.length;M<I;M++){if(this.data[M]){if(r[M].bbox.w>K){K=r[M].bbox.w}if(!N[M]&&K>n){n=K}}}if(F==null&&H!=null){n=H}else{if(n==-d.BIGDIMEN){n=K}}for(M=K=0,I=this.data.length;M<I;M++){if(this.data[M]){w=r[M];if(N[M]){w.bbox=this.data[M].HTMLstretchH(w,n).bbox;if(M!==this.base){o[M].style.paddingLeft=o[M].style.paddingRight=""}}if(w.bbox.w>K){K=w.bbox.w}}}var E=d.TeX.rule_thickness*this.mscale,G=d.FONTDATA.TeX_factor;var p=r[this.base]||{bbox:this.HTMLzeroBBox()};var v,s,A,z,u,C,J,O=0;if(p.bbox.ic){O=1.3*p.bbox.ic+0.05}for(M=0,I=this.data.length;M<I;M++){if(this.data[M]!=null){w=r[M];u=d.TeX.big_op_spacing5*P;var B=(M!=this.base&&l[this.ACCENTS[M]]);if(B&&w.bbox.w<=1/d.em+0.0001){w.bbox.w=w.bbox.rw-w.bbox.lw;w.bbox.noclip=true;if(w.bbox.lw){w.insertBefore(d.createSpace(w.parentNode,0,0,-w.bbox.lw),w.firstChild)}d.createBlank(w,0,0,w.bbox.rw+0.1)}C={left:0,center:(K-w.bbox.w)/2,right:K-w.bbox.w}[l.align];v=C;s=0;if(M==this.over){if(B){J=Math.max(E*P*G,2.5/this.em);u=0;if(p.bbox.skew){v+=p.bbox.skew;L.bbox.skew=p.bbox.skew;if(v+w.bbox.w>K){L.bbox.skew+=(K-w.bbox.w-v)/2}}}else{A=d.TeX.big_op_spacing1*P*G;z=d.TeX.big_op_spacing3*P*G;J=Math.max(A,z-Math.max(0,w.bbox.d))}J=Math.max(J,1.5/this.em);v+=O/2;s=p.bbox.h+w.bbox.d+J;w.bbox.h+=u}else{if(M==this.under){if(B){J=3*E*P*G;u=0}else{A=d.TeX.big_op_spacing2*P*G;z=d.TeX.big_op_spacing4*P*G;J=Math.max(A,z-w.bbox.h)}J=Math.max(J,1.5/this.em);v-=O/2;s=-(p.bbox.d+w.bbox.h+J);w.bbox.d+=u}}d.placeBox(w,v,s)}}this.HTMLhandleSpace(L);this.HTMLhandleColor(L);return L},HTMLstretchH:g.mbase.HTMLstretchH,HTMLstretchV:g.mbase.HTMLstretchV});g.msubsup.Augment({toHTML:function(K,I,C){K=this.HTMLcreateSpan(K);var N=this.HTMLgetScale(),H=this.HTMLgetMu(K);var w=d.createStack(K),l,n=[];var o=d.createBox(w);if(this.data[this.base]){n.push(this.data[this.base].toHTML(o));if(C!=null){this.data[this.base].HTMLstretchV(o,I,C)}else{if(I!=null){this.data[this.base].HTMLstretchH(o,I)}}}else{o.bbox=this.HTMLzeroBBox()}var L=d.TeX.x_height*N,B=d.TeX.scriptspace*N*0.75;var k,x;if(this.HTMLnotEmpty(this.data[this.sup])){k=d.createBox(w);n.push(this.data[this.sup].toHTML(k))}if(this.HTMLnotEmpty(this.data[this.sub])){x=d.createBox(w);n.push(this.data[this.sub].toHTML(x))}d.MeasureSpans(n);if(k){k.bbox.w+=B;k.bbox.rw=Math.max(k.bbox.w,k.bbox.rw)}if(x){x.bbox.w+=B;x.bbox.rw=Math.max(x.bbox.w,x.bbox.rw)}d.placeBox(o,0,0);var m=N;if(k){m=this.data[this.sup].HTMLgetScale()}else{if(x){m=this.data[this.sub].HTMLgetScale()}}var F=d.TeX.sup_drop*m,E=d.TeX.sub_drop*m;var z=o.bbox.h-F,y=o.bbox.d+E,M=0,G;if(o.bbox.ic){o.bbox.w-=o.bbox.ic;M=1.3*o.bbox.ic+0.05}if(this.data[this.base]&&I==null&&C==null&&(this.data[this.base].type==="mi"||this.data[this.base].type==="mo")){if(this.data[this.base].data.join("").length===1&&n[0].scale===1&&!this.data[this.base].Get("largeop")){z=y=0}}var J=this.getValues("subscriptshift","superscriptshift");J.subscriptshift=(J.subscriptshift===""?0:d.length2em(J.subscriptshift,H));J.superscriptshift=(J.superscriptshift===""?0:d.length2em(J.superscriptshift,H));if(!k){if(x){y=Math.max(y,d.TeX.sub1*N,x.bbox.h-(4/5)*L,J.subscriptshift);d.placeBox(x,o.bbox.w,-y,x.bbox)}}else{if(!x){l=this.getValues("displaystyle","texprimestyle");G=d.TeX[(l.displaystyle?"sup1":(l.texprimestyle?"sup3":"sup2"))];z=Math.max(z,G*N,k.bbox.d+(1/4)*L,J.superscriptshift);d.placeBox(k,o.bbox.w+M,z,k.bbox)}else{y=Math.max(y,d.TeX.sub2*N);var A=d.TeX.rule_thickness*N;if((z-k.bbox.d)-(x.bbox.h-y)<3*A){y=3*A-z+k.bbox.d+x.bbox.h;F=(4/5)*L-(z-k.bbox.d);if(F>0){z+=F;y-=F}}d.placeBox(k,o.bbox.w+M,Math.max(z,J.superscriptshift));d.placeBox(x,o.bbox.w,-Math.max(y,J.subscriptshift))}}this.HTMLhandleSpace(K);this.HTMLhandleColor(K);return K},HTMLstretchH:g.mbase.HTMLstretchH,HTMLstretchV:g.mbase.HTMLstretchV});g.mmultiscripts.Augment({toHTML:g.mbase.HTMLautoload});g.mtable.Augment({toHTML:g.mbase.HTMLautoload});g["annotation-xml"].Augment({toHTML:g.mbase.HTMLautoload});g.annotation.Augment({toHTML:function(k){return this.HTMLcreateSpan(k)}});g.math.Augment({toHTML:function(x,n){var q=d.addElement(x,"nobr",{isMathJax:true});x=this.HTMLcreateSpan(q);var u=this.Get("alttext");if(u&&!x.getAttribute("aria-label")){x.setAttribute("aria-label",u)}if(!x.getAttribute("role")){x.setAttribute("role","math")}var v=d.createStack(x),r=d.createBox(v),w;v.style.fontSize=q.parentNode.style.fontSize;q.parentNode.style.fontSize="";if(this.data[0]!=null){if(d.msieColorBug){if(this.background){this.data[0].background=this.background;delete this.background}if(this.mathbackground){this.data[0].mathbackground=this.mathbackground;delete this.mathbackground}}g.mbase.prototype.displayAlign=b.config.displayAlign;g.mbase.prototype.displayIndent=b.config.displayIndent;if(String(b.config.displayIndent).match(/^0($|[a-z%])/i)){g.mbase.prototype.displayIndent="0"}var s=this.data[0].toHTML(r);s.bbox.exactW=false;w=d.Measured(s,r)}d.placeBox(r,0,0);x.style.width=d.Em(Math.max(0,Math.round(w.bbox.w*this.em)+0.25)/d.outerEm);x.style.display="inline-block";var k=1/d.em,t=d.em/d.outerEm;d.em/=t;x.bbox.h*=t;x.bbox.d*=t;x.bbox.w*=t;x.bbox.lw*=t;x.bbox.rw*=t;if(x.bbox.H){x.bbox.H*=t}if(x.bbox.D){x.bbox.D*=t}if(w&&w.bbox.width!=null){x.style.minWidth=(w.bbox.minWidth||x.style.width);x.style.width=w.bbox.width;r.style.width=v.style.width="100%"}var o=this.HTMLhandleColor(x);if(w){d.createRule(x,(w.bbox.h+k)*t,(w.bbox.d+k)*t,0)}if(!this.isMultiline&&this.Get("display")==="block"&&x.bbox.width==null){var y=this.getValues("indentalignfirst","indentshiftfirst","indentalign","indentshift");if(y.indentalignfirst!==g.INDENTALIGN.INDENTALIGN){y.indentalign=y.indentalignfirst}if(y.indentalign===g.INDENTALIGN.AUTO){y.indentalign=this.displayAlign}if(y.indentshiftfirst!==g.INDENTSHIFT.INDENTSHIFT){y.indentshift=y.indentshiftfirst}if(y.indentshift==="auto"){y.indentshift="0"}var l=d.length2em(y.indentshift,1,d.scale*d.cwidth);if(this.displayIndent!=="0"){var m=d.length2em(this.displayIndent,1,d.scale*d.cwidth);l+=(y.indentalign===g.INDENTALIGN.RIGHT?-m:m)}n.style.textAlign=y.indentalign;if(l){l*=d.em/d.outerEm;b.Insert(x.style,({left:{marginLeft:d.Em(l)},right:{marginLeft:d.Em(Math.max(0,x.bbox.w+l)),marginRight:d.Em(-l)},center:{marginLeft:d.Em(l),marginRight:d.Em(-l)}})[y.indentalign]);if(o){o.style.marginLeft=d.Em(parseFloat(o.style.marginLeft)+l);o.style.marginRight=d.Em(parseFloat(o.style.marginRight)-l+(y.indentalign==="right"?Math.min(0,x.bbox.w+l)-x.bbox.w:0))}}}return x},HTMLspanElement:g.mbase.prototype.HTMLspanElement});g.TeXAtom.Augment({toHTML:function(o,m,q){o=this.HTMLcreateSpan(o);if(this.data[0]!=null){if(this.texClass===g.TEXCLASS.VCENTER){var k=d.createStack(o);var p=d.createBox(k);var r=this.data[0].toHTML(p);if(q!=null){d.Remeasured(this.data[0].HTMLstretchV(p,m,q),p)}else{if(m!=null){d.Remeasured(this.data[0].HTMLstretchH(p,m),p)}else{d.Measured(r,p)}}var l=d.TeX.axis_height*this.HTMLgetScale();d.placeBox(p,0,l-(p.bbox.h+p.bbox.d)/2+p.bbox.d)}else{var n=this.data[0].toHTML(o,m,q);if(q!=null){n=this.data[0].HTMLstretchV(p,m,q)}else{if(m!=null){n=this.data[0].HTMLstretchH(p,m)}}o.bbox=n.bbox}}this.HTMLhandleSpace(o);this.HTMLhandleColor(o);return o},HTMLstretchH:g.mbase.HTMLstretchH,HTMLstretchV:g.mbase.HTMLstretchV});b.Register.StartupHook("onLoad",function(){setTimeout(MathJax.Callback(["loadComplete",d,"jax.js"]),0)})});b.Register.StartupHook("End Config",function(){b.Browser.Select({MSIE:function(k){var o=(document.documentMode||0);var n=k.versionAtLeast("7.0");var m=k.versionAtLeast("8.0")&&o>7;var l=(document.compatMode==="BackCompat");if(o<9){d.config.styles[".MathJax .MathJax_HitBox"]["background-color"]="white";d.config.styles[".MathJax .MathJax_HitBox"].opacity=0;d.config.styles[".MathJax .MathJax_HitBox"].filter="alpha(opacity=0)"}d.Augment({PaddingWidthBug:true,msieAccentBug:true,msieColorBug:true,msieColorPositionBug:true,msieRelativeWidthBug:l,msieDisappearingBug:(o>=8),msieMarginScaleBug:(o<8),msiePaddingWidthBug:true,msieBorderWidthBug:l,msieFrameSizeBug:(o<=8),msieInlineBlockAlignBug:(!m||l),msiePlaceBoxBug:(m&&!l),msieClipRectBug:!m,msieNegativeSpaceBug:l,cloneNodeBug:(m&&k.version==="8.0"),msieItalicWidthBug:true,initialSkipBug:(o<8),msieNegativeBBoxBug:(o>=8),msieIE6:!n,msieItalicWidthBug:true,FontFaceBug:(o<9),msieFontCSSBug:k.isIE9,allowWebFonts:(o>=9?"woff":"eot")})},Firefox:function(l){var m=false;if(l.versionAtLeast("3.5")){var k=String(document.location).replace(/[^\/]*$/,"");if(document.location.protocol!=="file:"||b.config.root.match(/^https?:\/\//)||(b.config.root+"/").substr(0,k.length)===k){m="otf"}}d.Augment({ffVerticalAlignBug:!l.versionAtLeast("20.0"),AccentBug:true,allowWebFonts:m})},Safari:function(p){var n=p.versionAtLeast("3.0");var m=p.versionAtLeast("3.1");var k=navigator.appVersion.match(/ Safari\/\d/)&&navigator.appVersion.match(/ Version\/\d/)&&navigator.vendor.match(/Apple/);var l=(navigator.appVersion.match(/ Android (\d+)\.(\d+)/));var q=(m&&p.isMobile&&((navigator.platform.match(/iPad|iPod|iPhone/)&&!p.versionAtLeast("5.0"))||(l!=null&&(l[1]<2||(l[1]==2&&l[2]<2)))));d.Augment({config:{styles:{".MathJax img, .MathJax nobr, .MathJax a":{"max-width":"5000em","max-height":"5000em"}}},Em:((p.webkit||0)>=538?d.EmRounded:d.Em),rfuzz:0.011,AccentBug:true,AdjustSurd:true,negativeBBoxes:true,safariNegativeSpaceBug:true,safariVerticalAlignBug:!m,safariTextNodeBug:!n,forceReflow:true,FontFaceBug:true,allowWebFonts:(m&&!q?"otf":false)});if(k){d.Augment({webFontDefault:(p.isMobile?"sans-serif":"serif")})}if(p.isPC){d.Augment({adjustAvailableFonts:d.removeSTIXfonts,checkWebFontsTwice:true})}if(q){var o=b.config["HTML-CSS"];if(o){o.availableFonts=[];o.preferredFont=null}else{b.config["HTML-CSS"]={availableFonts:[],preferredFont:null}}}},Chrome:function(k){d.Augment({Em:d.EmRounded,cloneNodeBug:true,rfuzz:-0.02,AccentBug:true,AdjustSurd:true,FontFaceBug:k.versionAtLeast("32.0"),negativeBBoxes:true,safariNegativeSpaceBug:true,safariWebFontSerif:[""],forceReflow:true,allowWebFonts:(k.versionAtLeast("4.0")?"otf":"svg")})},Opera:function(k){k.isMini=(navigator.appVersion.match("Opera Mini")!=null);d.config.styles[".MathJax .merror"]["vertical-align"]=null;d.config.styles[".MathJax span"]["z-index"]=0;d.Augment({operaHeightBug:true,operaVerticalAlignBug:true,operaFontSizeBug:k.versionAtLeast("10.61"),initialSkipBug:true,FontFaceBug:true,PaddingWidthBug:true,allowWebFonts:(k.versionAtLeast("10.0")&&!k.isMini?"otf":false),adjustAvailableFonts:d.removeSTIXfonts})},Konqueror:function(k){d.Augment({konquerorVerticalAlignBug:true})}})});MathJax.Hub.Register.StartupHook("End Cookie",function(){if(b.config.menuSettings.zoom!=="None"){h.Require("[MathJax]/extensions/MathZoom.js")}})})(MathJax.Ajax,MathJax.Hub,MathJax.OutputJax["HTML-CSS"]);
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var c="2.5.0";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax["HTML-CSS"];a.mtable.Augment({toHTML:function(r){r=this.HTMLcreateSpan(r);if(this.data.length===0){return r}var I=this.getValues("columnalign","rowalign","columnspacing","rowspacing","columnwidth","equalcolumns","equalrows","columnlines","rowlines","frame","framespacing","align","useHeight","width","side","minlabelspacing");var aK=I.width.match(/%$/);var ax=b.createStack(r);var aH=this.HTMLgetScale(),aA=this.HTMLgetMu(r),aB=-1;var ap=[],at=[],aj=[],av=[],au=[],ae,ad,ao=-1,ac,an,X,aF,Q,aC,aP=[],aU;var G=b.FONTDATA.lineH*aH*I.useHeight,N=b.FONTDATA.lineD*aH*I.useHeight;for(ae=0,ac=this.data.length;ae<ac;ae++){aF=this.data[ae];X=(aF.type==="mlabeledtr"?aB:0);av[ae]=[];ap[ae]=G;at[ae]=N;for(ad=X,an=aF.data.length+X;ad<an;ad++){if(aj[ad]==null){if(ad>ao){ao=ad}au[ad]=b.createStack(b.createBox(ax));aj[ad]=-b.BIGDIMEN}av[ae][ad]=b.createBox(au[ad]);aP.push(aF.data[ad-X].toHTML(av[ae][ad]))}}b.MeasureSpans(aP);for(ae=0,ac=this.data.length;ae<ac;ae++){aF=this.data[ae];X=(aF.type==="mlabeledtr"?aB:0);for(ad=X,an=aF.data.length+X;ad<an;ad++){Q=aF.data[ad-X];if(Q.isMultiline){av[ae][ad].style.width="100%"}if(Q.isEmbellished()){aC=Q.CoreMO();var aT=aC.Get("minsize",true);if(aT){var aM=aC.HTMLspanElement().bbox;if(aC.HTMLcanStretch("Vertical")){aU=aM.h+aM.d;if(aU){aT=b.length2em(aT,aA,aU);if(aT*aM.h/aU>ap[ae]){ap[ae]=aT*aM.h/aU}if(aT*aM.d/aU>at[ae]){at[ae]=aT*aM.d/aU}}}else{if(aC.HTMLcanStretch("Horizontal")){aT=b.length2em(aT,aA,aM.w);if(aT>aj[ad]){aj[ad]=aT}}}}}if(av[ae][ad].bbox.h>ap[ae]){ap[ae]=av[ae][ad].bbox.h}if(av[ae][ad].bbox.d>at[ae]){at[ae]=av[ae][ad].bbox.d}if(av[ae][ad].bbox.w>aj[ad]){aj[ad]=av[ae][ad].bbox.w}}}var aE=MathJax.Hub.SplitList;var az=aE(I.columnspacing),aR=aE(I.rowspacing),e=aE(I.columnalign),B=aE(I.rowalign),d=aE(I.columnlines),w=aE(I.rowlines),aN=aE(I.columnwidth),U=[];for(ae=0,ac=az.length;ae<ac;ae++){az[ae]=b.length2em(az[ae],aA)}for(ae=0,ac=aR.length;ae<ac;ae++){aR[ae]=b.length2em(aR[ae],aA)}while(az.length<ao){az.push(az[az.length-1])}while(e.length<=ao){e.push(e[e.length-1])}while(d.length<ao){d.push(d[d.length-1])}while(aN.length<=ao){aN.push(aN[aN.length-1])}while(aR.length<av.length){aR.push(aR[aR.length-1])}while(B.length<=av.length){B.push(B[B.length-1])}while(w.length<av.length){w.push(w[w.length-1])}if(au[aB]){e[aB]=(I.side.substr(0,1)==="l"?"left":"right");az[aB]=-aj[aB]}for(ae=0,ac=av.length;ae<ac;ae++){aF=this.data[ae];U[ae]=[];if(aF.rowalign){B[ae]=aF.rowalign}if(aF.columnalign){U[ae]=aE(aF.columnalign);while(U[ae].length<=ao){U[ae].push(U[ae][U[ae].length-1])}}}if(I.equalrows){var aD=Math.max.apply(Math,ap),V=Math.max.apply(Math,at);for(ae=0,ac=av.length;ae<ac;ae++){X=((aD+V)-(ap[ae]+at[ae]))/2;ap[ae]+=X;at[ae]+=X}}aU=ap[0]+at[av.length-1];for(ae=0,ac=av.length-1;ae<ac;ae++){aU+=Math.max(0,at[ae]+ap[ae+1]+aR[ae])}var aJ=0,aI=0,aW,g=aU;if(I.frame!=="none"||(I.columnlines+I.rowlines).match(/solid|dashed/)){var v=aE(I.framespacing);if(v.length!=2){v=aE(this.defaults.framespacing)}aJ=b.length2em(v[0],aA);aI=b.length2em(v[1],aA);g=aU+2*aI}var ai,aV,aa="";if(typeof(I.align)!=="string"){I.align=String(I.align)}if(I.align.match(/(top|bottom|center|baseline|axis)( +(-?\d+))?/)){aa=RegExp.$3||"";I.align=RegExp.$1}else{I.align=this.defaults.align}if(aa!==""){aa=parseInt(aa);if(aa<0){aa=av.length+1+aa}if(aa<1){aa=1}else{if(aa>av.length){aa=av.length}}ai=0;aV=-(aU+aI)+ap[0];for(ae=0,ac=aa-1;ae<ac;ae++){var L=Math.max(0,at[ae]+ap[ae+1]+aR[ae]);ai+=L;aV+=L}}else{ai=({top:-(ap[0]+aI),bottom:aU+aI-ap[0],center:aU/2-ap[0],baseline:aU/2-ap[0],axis:aU/2+b.TeX.axis_height*aH-ap[0]})[I.align];aV=({top:-(aU+2*aI),bottom:0,center:-(aU/2+aI),baseline:-(aU/2+aI),axis:b.TeX.axis_height*aH-aU/2-aI})[I.align]}var ab,af=0,z=0,K=0,Z=0,ag=0,al=[],ar=[],R=1;if(I.equalcolumns&&I.width!=="auto"){if(aK){ab=(100/(ao+1)).toFixed(2).replace(/\.?0+$/,"")+"%";for(ae=0,ac=Math.min(ao+1,aN.length);ae<ac;ae++){aN[ae]=ab}ab=0;af=1;ag=ao+1;for(ae=0,ac=Math.min(ao+1,az.length);ae<ac;ae++){ab+=az[ae]}}else{ab=b.length2em(I.width,aA);for(ae=0,ac=Math.min(ao+1,az.length);ae<ac;ae++){ab-=az[ae]}ab/=ao+1;for(ae=0,ac=Math.min(ao+1,aN.length);ae<ac;ae++){aj[ae]=ab}}}else{for(ae=0,ac=Math.min(ao+1,aN.length);ae<ac;ae++){if(aN[ae]==="auto"){z+=aj[ae]}else{if(aN[ae]==="fit"){ar[ag]=ae;ag++;z+=aj[ae]}else{if(aN[ae].match(/%$/)){al[Z]=ae;Z++;K+=aj[ae];af+=b.length2em(aN[ae],aA,1)}else{aj[ae]=b.length2em(aN[ae],aA);z+=aj[ae]}}}}if(aK){ab=0;for(ae=0,ac=Math.min(ao,az.length);ae<ac;ae++){ab+=az[ae]}if(af>0.98){R=0.98/af;af=0.98}}else{if(I.width==="auto"){if(af>0.98){R=K/(z+K);ab=z+K}else{ab=z/(1-af)}}else{ab=b.length2em(I.width,aA);for(ae=0,ac=Math.min(ao+1,az.length);ae<ac;ae++){ab-=az[ae]}}for(ae=0,ac=al.length;ae<ac;ae++){aj[al[ae]]=b.length2em(aN[al[ae]],aA,ab*R);z+=aj[al[ae]]}if(Math.abs(ab-z)>0.01){if(ag&&ab>z){ab=(ab-z)/ag;for(ae=0,ac=ar.length;ae<ac;ae++){aj[ar[ae]]+=ab}}else{ab=ab/z;for(ad=0;ad<=ao;ad++){aj[ad]*=ab}}}if(I.equalcolumns){var O=Math.max.apply(Math,aj);for(ad=0;ad<=ao;ad++){aj[ad]=O}}}}var S=ai,o,q,aS;X=(au[aB]?aB:0);for(ad=X;ad<=ao;ad++){for(ae=0,ac=av.length;ae<ac;ae++){if(av[ae][ad]){X=(this.data[ae].type==="mlabeledtr"?aB:0);Q=this.data[ae].data[ad-X];if(Q.HTMLcanStretch("Horizontal")){av[ae][ad].bbox=Q.HTMLstretchH(au[ad],aj[ad]).bbox}else{if(Q.HTMLcanStretch("Vertical")){aC=Q.CoreMO();var aL=aC.symmetric;aC.symmetric=false;av[ae][ad].bbox=Q.HTMLstretchV(au[ad],ap[ae],at[ae]).bbox;av[ae][ad].HH=null;if(av[ae][ad].bbox.h>ap[ae]){av[ae][ad].bbox.H=av[ae][ad].bbox.h;av[ae][ad].bbox.h=ap[ae]}if(av[ae][ad].bbox.d>at[ae]){av[ae][ad].bbox.D=av[ae][ad].bbox.d;av[ae][ad].bbox.d=at[ae]}aC.symmetric=aL}}aS=Q.rowalign||this.data[ae].rowalign||B[ae];o=({top:ap[ae]-av[ae][ad].bbox.h,bottom:av[ae][ad].bbox.d-at[ae],center:((ap[ae]-at[ae])-(av[ae][ad].bbox.h-av[ae][ad].bbox.d))/2,baseline:0,axis:0})[aS]||0;aS=(Q.columnalign||U[ae][ad]||e[ad]);b.alignBox(av[ae][ad],aS,S+o)}if(ae<av.length-1){S-=Math.max(0,at[ae]+ap[ae+1]+aR[ae])}}S=ai}if(aK){var E=b.createBox(ax);E.style.left=E.style.top=0;E.style.right=b.Em(ab+2*aJ);E.style.display="inline-block";E.style.height="0px";if(b.msieRelativeWidthBug){E=b.createBox(E);E.style.position="relative";E.style.height="1em";E.style.width="100%";E.bbox=ax.bbox}var aQ=0,aX=aJ,k,l;if(ag){k=100*(1-af)/ag,l=z/ag}else{k=100*(1-af)/(ao+1);l=z/(ao+1)}for(ad=0;ad<=ao;ad++){b.placeBox(au[ad].parentNode,0,0);au[ad].style.position="relative";au[ad].style.left=b.Em(aX);au[ad].style.width="100%";au[ad].parentNode.parentNode.removeChild(au[ad].parentNode);var ak=b.createBox(E);b.addBox(ak,au[ad]);au[ad]=ak;var h=ak.style;h.display="inline-block";h.left=aQ+"%";if(aN[ad].match(/%$/)){var t=parseFloat(aN[ad])*R;if(ag===0){h.width=(k+t)+"%";aQ+=k+t;ak=b.createBox(ak);b.addBox(ak,au[ad].firstChild);ak.style.left=0;ak.style.right=b.Em(l);aX-=l}else{h.width=t+"%";aQ+=t}}else{if(aN[ad]==="fit"||ag===0){h.width=k+"%";ak=b.createBox(ak);b.addBox(ak,au[ad].firstChild);ak.style.left=0;ak.style.right=b.Em(l-aj[ad]);aX+=aj[ad]-l;aQ+=k}else{h.width=b.Em(aj[ad]);aX+=aj[ad]}}if(b.msieRelativeWidthBug){b.addText(ak.firstChild,b.NBSP);ak.firstChild.style.position="relative"}aX+=az[ad];if(d[ad]!=="none"&&ad<ao&&ad!==aB){q=b.createBox(E);q.style.left=aQ+"%";q=b.createRule(q,g,0,1.25/b.em);q.style.position="absolute";q.bbox={h:g,d:0,w:0,rw:1.25/b.em,lw:0};q.parentNode.bbox=ax.bbox;b.placeBox(q,aX-az[ad]/2,aV,true);q.style.borderStyle=d[ad]}}}else{var T=aJ;for(ad=0;ad<=ao;ad++){if(!au[ad].bbox.width){b.setStackWidth(au[ad],aj[ad])}if(aN[ad]!=="auto"&&aN[ad]!=="fit"){au[ad].bbox.width=aj[ad];au[ad].bbox.isFixed=true}b.placeBox(au[ad].parentNode,T,0);T+=aj[ad]+az[ad];if(d[ad]!=="none"&&ad<ao&&ad!==aB){q=b.createRule(ax,g,0,1.25/b.em);b.addBox(ax,q);q.bbox={h:g,d:0,w:0,rw:1.25/b.em,lw:0};b.placeBox(q,T-az[ad]/2,aV,true);q.style.borderStyle=d[ad]}}}ax.bbox.d=-aV;ax.bbox.h=g+aV;b.setStackWidth(ax,ax.bbox.w+aJ);aW=ax.bbox.w;var ah;if(I.frame!=="none"){ah=b.createFrame(ax,g,0,aW,1.25/b.em,I.frame);b.addBox(ax,ah);b.placeBox(ah,0,aV,true);if(aK){ah.style.width="100%"}}S=ai;for(ae=0,ac=av.length-1;ae<ac;ae++){o=Math.max(0,at[ae]+ap[ae+1]+aR[ae]);if(w[ae]!=="none"){q=b.createRule(ax,1.25/b.em,0,aW);b.addBox(ax,q);q.bbox={h:1.25/b.em,d:0,w:aW,rw:aW,lw:0};b.placeBox(q,0,S-at[ae]-(o-at[ae]-ap[ae+1])/2,true);if(w[ae]==="dashed"||aK){q.style.borderTop=q.style.height+" "+w[ae];q.style.height=0;q.style.width=q.style.borderLeftWidth;q.style.borderLeft="";if(aK){q.style.width="100%"}}}S-=o}if(aK){r.bbox.width=I.width;ax.style.width="100%"}if(au[aB]){var aw=ax.bbox.w;var aq=this.getValues("indentalignfirst","indentshiftfirst","indentalign","indentshift");if(aq.indentalignfirst!==a.INDENTALIGN.INDENTALIGN){aq.indentalign=aq.indentalignfirst}if(aq.indentalign===a.INDENTALIGN.AUTO){aq.indentalign=this.displayAlign}if(aq.indentshiftfirst!==a.INDENTSHIFT.INDENTSHIFT){aq.indentshift=aq.indentshiftfirst}if(aq.indentshift==="auto"){aq.indentshift="0"}var am=b.length2em(aq.indentshift,aA,b.cwidth);var ay=b.length2em(I.minlabelspacing,aA,b.cwidth);if(this.displayIndent!=="0"){var aG=b.length2em(this.displayIndent,aA,b.cwidth);am+=(aq.indentAlign===a.INDENTALIGN.RIGHT?-aG:aG)}var aO=b.createStack(r,false,"100%");b.addBox(aO,ax);b.alignBox(ax,aq.indentalign,0,am);au[aB].parentNode.parentNode.removeChild(au[aB].parentNode);b.addBox(aO,au[aB]);b.alignBox(au[aB],e[aB],0);if(b.msieRelativeWidthBug){ax.style.top=au[aB].style.top=""}if(aK){ax.style.width=I.width;r.bbox.width="100%"}au[aB].style.marginRight=au[aB].style.marginLeft=b.Em(ay);if(aq.indentalign===a.INDENTALIGN.CENTER){aw+=4*ay+2*au[aB].bbox.w}else{if(aq.indentalign!==e[aB]){aw+=2*ay+au[aB].bbox.w}}aw=Math.max(0,aw+am);r.bbox.tw=aw+2*ay;r.style.minWidth=r.bbox.minWidth=b.Em(aw);aO.style.minWidth=aO.bbox.minWidth=b.Em(aw/b.scale)}if(!aK){this.HTMLhandleSpace(r)}var u=this.HTMLhandleColor(r);if(u&&aK){if(!ah){ah=b.createFrame(ax,g,0,aW,0,"none");b.addBox(ax,ah);b.placeBox(ah,0,aV,true);ah.style.width="100%"}ah.style.backgroundColor=u.style.backgroundColor;ah.parentNode.insertBefore(ah,ah.parentNode.firstChild);u.parentNode.removeChild(u)}return r},HTMLhandleSpace:function(d){d.bbox.keepPadding=true;d.bbox.exact=true;if(!this.hasFrame&&d.bbox.width==null){d.style.paddingLeft=d.style.paddingRight=b.Em(1/6)}this.SUPER(arguments).HTMLhandleSpace.call(this,d)}});a.mtd.Augment({toHTML:function(e,d,g){e=this.HTMLcreateSpan(e);if(this.data[0]){var f=this.data[0].toHTML(e);if(g!=null){f=this.data[0].HTMLstretchV(e,d,g)}else{if(d!=null){f=this.data[0].HTMLstretchH(e,d)}}e.bbox=f.bbox}this.HTMLhandleSpace(e);this.HTMLhandleColor(e);return e},HTMLstretchH:a.mbase.HTMLstretchH,HTMLstretchV:a.mbase.HTMLstretchV});MathJax.Hub.Startup.signal.Post("HTML-CSS mtable Ready");MathJax.Ajax.loadComplete(b.autoloadDir+"/mtable.js")});
(function(i,b,e,g){var h;var j,a,d;var f="'Times New Roman',Times,STIXGeneral,serif";var m={".MJXc-script":{"font-size":".8em"},".MJXc-right":{"-webkit-transform-origin":"right","-moz-transform-origin":"right","-ms-transform-origin":"right","-o-transform-origin":"right","transform-origin":"right"},".MJXc-bold":{"font-weight":"bold"},".MJXc-italic":{"font-style":"italic"},".MJXc-scr":{"font-family":"MathJax_Script,"+f},".MJXc-frak":{"font-family":"MathJax_Fraktur,"+f},".MJXc-sf":{"font-family":"MathJax_SansSerif,"+f},".MJXc-cal":{"font-family":"MathJax_Caligraphic,"+f},".MJXc-mono":{"font-family":"MathJax_Typewriter,"+f},".MJXc-largeop":{"font-size":"150%"},".MJXc-largeop.MJXc-int":{"vertical-align":"-.2em"},".MJXc-math":{display:"inline-block","line-height":"1.2","text-indent":"0","font-family":f,"white-space":"nowrap","border-collapse":"collapse"},".MJXc-display":{display:"block","text-align":"center",margin:"1em 0"},".MJXc-math span":{display:"inline-block"},".MJXc-box":{display:"block!important","text-align":"center"},".MJXc-box:after":{content:'" "'},".MJXc-rule":{display:"block!important","margin-top":".1em"},".MJXc-char":{display:"block!important"},".MJXc-mo":{margin:"0 .15em"},".MJXc-mfrac":{margin:"0 .125em","vertical-align":".25em"},".MJXc-denom":{display:"inline-table!important",width:"100%"},".MJXc-denom > *":{display:"table-row!important"},".MJXc-surd":{"vertical-align":"top"},".MJXc-surd > *":{display:"block!important"},".MJXc-script-box > * ":{display:"table!important",height:"50%"},".MJXc-script-box > * > *":{display:"table-cell!important","vertical-align":"top"},".MJXc-script-box > *:last-child > *":{"vertical-align":"bottom"},".MJXc-script-box > * > * > *":{display:"block!important"},".MJXc-mphantom":{visibility:"hidden"},".MJXc-munderover":{display:"inline-table!important"},".MJXc-over":{display:"inline-block!important","text-align":"center"},".MJXc-over > *":{display:"block!important"},".MJXc-munderover > *":{display:"table-row!important"},".MJXc-mtable":{"vertical-align":".25em",margin:"0 .125em"},".MJXc-mtable > *":{display:"inline-table!important","vertical-align":"middle"},".MJXc-mtr":{display:"table-row!important"},".MJXc-mtd":{display:"table-cell!important","text-align":"center",padding:".5em 0 0 .5em"},".MJXc-mtr > .MJXc-mtd:first-child":{"padding-left":0},".MJXc-mtr:first-child > .MJXc-mtd":{"padding-top":0},".MJXc-mlabeledtr":{display:"table-row!important"},".MJXc-mlabeledtr > .MJXc-mtd:first-child":{"padding-left":0},".MJXc-mlabeledtr:first-child > .MJXc-mtd":{"padding-top":0},".MJXc-merror":{"background-color":"#FFFF88",color:"#CC0000",border:"1px solid #CC0000",padding:"1px 3px","font-style":"normal","font-size":"90%"}};(function(){for(var n=0;n<10;n++){var o="scaleX(."+n+")";m[".MJXc-scale"+n]={"-webkit-transform":o,"-moz-transform":o,"-ms-transform":o,"-o-transform":o,transform:o}}})();var k=1000000;var c="V",l="H";g.Augment({settings:b.config.menuSettings,config:{styles:m},hideProcessedMath:false,maxStretchyParts:1000,Config:function(){if(!this.require){this.require=[]}this.SUPER(arguments).Config.call(this);var n=this.settings;if(n.scale){this.config.scale=n.scale}this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js")},Startup:function(){j=MathJax.Extension.MathEvents.Event;a=MathJax.Extension.MathEvents.Touch;d=MathJax.Extension.MathEvents.Hover;this.ContextMenu=j.ContextMenu;this.Mousedown=j.AltContextMenu;this.Mouseover=d.Mouseover;this.Mouseout=d.Mouseout;this.Mousemove=d.Mousemove;var n=e.addElement(document.body,"div",{style:{width:"5in"}});this.pxPerInch=n.offsetWidth/5;n.parentNode.removeChild(n);return i.Styles(this.config.styles,["InitializeCHTML",this])},InitializeCHTML:function(){},preTranslate:function(p){var s=p.jax[this.id],t,q=s.length,u,r,v,o,n;for(t=0;t<q;t++){u=s[t];if(!u.parentNode){continue}r=u.previousSibling;if(r&&String(r.className).match(/^MathJax_CHTML(_Display)?( MathJax_Processing)?$/)){r.parentNode.removeChild(r)}n=u.MathJax.elementJax;if(!n){continue}n.CHTML={display:(n.root.Get("display")==="block")};v=o=e.Element("span",{className:"MathJax_CHTML",id:n.inputID+"-Frame",isMathJax:true,jaxID:this.id,oncontextmenu:j.Menu,onmousedown:j.Mousedown,onmouseover:j.Mouseover,onmouseout:j.Mouseout,onmousemove:j.Mousemove,onclick:j.Click,ondblclick:j.DblClick});if(b.Browser.noContextMenu){v.ontouchstart=a.start;v.ontouchend=a.end}if(n.CHTML.display){o=e.Element("div",{className:"MathJax_CHTML_Display"});o.appendChild(v)}o.className+=" MathJax_Processing";u.parentNode.insertBefore(o,u)}},Translate:function(o,s){if(!o.parentNode){return}var n=o.MathJax.elementJax,r=n.root,p=document.getElementById(n.inputID+"-Frame"),t=(n.CHTML.display?p.parentNode:p);this.initCHTML(r,p);try{r.toCommonHTML(p)}catch(q){if(q.restart){while(p.firstChild){p.removeChild(p.firstChild)}}throw q}t.className=t.className.split(/ /)[0];if(this.hideProcessedMath){t.className+=" MathJax_Processed";if(o.MathJax.preview){n.CHTML.preview=o.MathJax.preview;delete o.MathJax.preview}}},postTranslate:function(s){var o=s.jax[this.id];if(!this.hideProcessedMath){return}for(var q=0,n=o.length;q<n;q++){var p=o[q];if(p&&p.MathJax.elementJax){p.previousSibling.className=p.previousSibling.className.split(/ /)[0];var r=p.MathJax.elementJax.CHTML;if(r.preview){r.preview.innerHTML="";p.MathJax.preview=r.preview;delete r.preview}}}},getJaxFromMath:function(n){if(n.parentNode.className==="MathJax_CHTML_Display"){n=n.parentNode}do{n=n.nextSibling}while(n&&n.nodeName.toLowerCase()!=="script");return b.getJaxFor(n)},getHoverSpan:function(n,o){return n.root.CHTMLspanElement()},getHoverBBox:function(n,o,p){return BBOX},Zoom:function(o,u,s,n,r){u.className="MathJax";this.idPostfix="-zoom";o.root.toCHTML(u,u);this.idPostfix="";u.style.position="absolute";if(!width){s.style.position="absolute"}var t=u.offsetWidth,q=u.offsetHeight,v=s.offsetHeight,p=s.offsetWidth;if(p===0){p=s.parentNode.offsetWidth}u.style.position=s.style.position="";return{Y:-j.getBBox(u).h,mW:p,mH:v,zW:t,zH:q}},initCHTML:function(o,n){},Remove:function(n){var o=document.getElementById(n.inputID+"-Frame");if(o){if(n.CHTML.display){o=o.parentNode}o.parentNode.removeChild(o)}delete n.CHTML},ID:0,idPostfix:"",GetID:function(){this.ID++;return this.ID},VARIANT:{bold:"MJXc-bold",italic:"MJXc-italic","bold-italic":"MJXc-bold MJXc-italic",script:"MJXc-scr","bold-script":"MJXc-scr MJXc-bold",fraktur:"MJXc-frak","bold-fraktur":"MJXc-frak MJXc-bold",monospace:"MJXc-mono","sans-serif":"MJXc-sf","-tex-caligraphic":"MJXc-cal"},MATHSPACE:{veryverythinmathspace:1/18,verythinmathspace:2/18,thinmathspace:3/18,mediummathspace:4/18,thickmathspace:5/18,verythickmathspace:6/18,veryverythickmathspace:7/18,negativeveryverythinmathspace:-1/18,negativeverythinmathspace:-2/18,negativethinmathspace:-3/18,negativemediummathspace:-4/18,negativethickmathspace:-5/18,negativeverythickmathspace:-6/18,negativeveryverythickmathspace:-7/18,thin:0.08,medium:0.1,thick:0.15,infinity:k},TeX:{x_height:0.430554},pxPerInch:72,em:16,DELIMITERS:{"(":{dir:c},"{":{dir:c,w:0.58},"[":{dir:c},"|":{dir:c,w:0.275},")":{dir:c},"}":{dir:c,w:0.58},"]":{dir:c},"/":{dir:c},"\\":{dir:c},"\u2223":{dir:c,w:0.275},"\u2225":{dir:c,w:0.55},"\u230A":{dir:c,w:0.5},"\u230B":{dir:c,w:0.5},"\u2308":{dir:c,w:0.5},"\u2309":{dir:c,w:0.5},"\u27E8":{dir:c,w:0.5},"\u27E9":{dir:c,w:0.5},"\u2191":{dir:c,w:0.65},"\u2193":{dir:c,w:0.65},"\u21D1":{dir:c,w:0.75},"\u21D3":{dir:c,w:0.75},"\u2195":{dir:c,w:0.65},"\u21D5":{dir:c,w:0.75},"\u27EE":{dir:c,w:0.275},"\u27EF":{dir:c,w:0.275},"\u23B0":{dir:c,w:0.6},"\u23B1":{dir:c,w:0.6}},REMAPACCENT:{"\u20D7":"\u2192","'":"\u02CB","`":"\u02CA",".":"\u02D9","^":"\u02C6","-":"\u02C9","~":"\u02DC","\u00AF":"\u02C9","\u00B0":"\u02DA","\u00B4":"\u02CA","\u0300":"\u02CB","\u0301":"\u02CA","\u0302":"\u02C6","\u0303":"\u02DC","\u0304":"\u02C9","\u0305":"\u02C9","\u0306":"\u02D8","\u0307":"\u02D9","\u0308":"\u00A8","\u030C":"\u02C7"},REMAPACCENTUNDER:{},length2em:function(r,p){if(typeof(r)!=="string"){r=r.toString()}if(r===""){return""}if(r===h.SIZE.NORMAL){return 1}if(r===h.SIZE.BIG){return 2}if(r===h.SIZE.SMALL){return 0.71}if(this.MATHSPACE[r]){return this.MATHSPACE[r]}var o=r.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/);var n=parseFloat(o[1]||"1"),q=o[2];if(p==null){p=1}if(q==="em"){return n}if(q==="ex"){return n*this.TeX.x_height}if(q==="%"){return n/100*p}if(q==="px"){return n/this.em}if(q==="pt"){return n/10}if(q==="pc"){return n*1.2}if(q==="in"){return n*this.pxPerInch/this.em}if(q==="cm"){return n*this.pxPerInch/this.em/2.54}if(q==="mm"){return n*this.pxPerInch/this.em/25.4}if(q==="mu"){return n/18}return n*p},Em:function(n){if(Math.abs(n)<0.001){return"0em"}return(n.toFixed(3).replace(/\.?0+$/,""))+"em"},arrayEntry:function(n,o){return n[Math.max(0,Math.min(o,n.length-1))]}});MathJax.Hub.Register.StartupHook("mml Jax Ready",function(){h=MathJax.ElementJax.mml;h.mbase.Augment({toCommonHTML:function(o,n){return this.CHTMLdefaultSpan(o,n)},CHTMLdefaultSpan:function(q,o){if(!o){o={}}q=this.CHTMLcreateSpan(q);this.CHTMLhandleStyle(q);this.CHTMLhandleColor(q);if(this.isToken){this.CHTMLhandleToken(q)}for(var p=0,n=this.data.length;p<n;p++){this.CHTMLaddChild(q,p,o)}return q},CHTMLaddChild:function(p,o,n){var q=this.data[o];if(q){if(n.childSpans){p=e.addElement(p,"span",{className:n.className})}q.toCommonHTML(p);if(!n.noBBox){this.CHTML.w+=q.CHTML.w+q.CHTML.l+q.CHTML.r;if(q.CHTML.h>this.CHTML.h){this.CHTML.h=q.CHTML.h}if(q.CHTML.d>this.CHTML.d){this.CHTML.d=q.CHTML.d}if(q.CHTML.t>this.CHTML.t){this.CHTML.t=q.CHTML.t}if(q.CHTML.b>this.CHTML.b){this.CHTML.b=q.CHTML.b}}}else{if(n.forceChild){e.addElement(p,"span")}}},CHTMLstretchChild:function(q,p,s){var r=this.data[q];if(r&&r.CHTMLcanStretch("Vertical",p,s)){var t=this.CHTML,o=r.CHTML,n=o.w;r.CHTMLstretchV(p,s);t.w+=o.w-n;if(o.h>t.h){t.h=o.h}if(o.d>t.d){t.d=o.d}}},CHTMLcreateSpan:function(n){if(!this.CHTML){this.CHTML={}}this.CHTML={w:0,h:0,d:0,l:0,r:0,t:0,b:0};if(this.inferred){return n}if(this.type==="mo"&&this.data.join("")==="\u222B"){g.lastIsInt=true}else{if(this.type!=="mspace"||this.width!=="negativethinmathspace"){g.lastIsInt=false}}if(!this.CHTMLspanID){this.CHTMLspanID=g.GetID()}var o=(this.id||"MJXc-Span-"+this.CHTMLspanID);return e.addElement(n,"span",{className:"MJXc-"+this.type,id:o})},CHTMLspanElement:function(){if(!this.CHTMLspanID){return null}return document.getElementById(this.id||"MJXc-Span-"+this.CHTMLspanID)},CHTMLhandleToken:function(o){var n=this.getValues("mathvariant");if(n.mathvariant!==h.VARIANT.NORMAL){o.className+=" "+g.VARIANT[n.mathvariant]}},CHTMLhandleStyle:function(n){if(this.style){n.style.cssText=this.style}},CHTMLhandleColor:function(n){if(this.mathcolor){n.style.color=this.mathcolor}if(this.mathbackground){n.style.backgroundColor=this.mathbackground}},CHTMLhandleScriptlevel:function(n){var o=this.Get("scriptlevel");if(o){n.className+=" MJXc-script"}},CHTMLhandleText:function(y,A){var v,p;var z=0,o=0,q=0;for(var s=0,r=A.length;s<r;s++){p=A.charCodeAt(s);v=A.charAt(s);if(p>=55296&&p<56319){s++;p=(((p-55296)<<10)+(A.charCodeAt(s)-56320))+65536}var t=0.7,u=0.22,x=0.5;if(p<127){if(v.match(/[A-Za-ehik-or-xz0-9]/)){u=0}if(v.match(/[A-HK-Z]/)){x=0.67}else{if(v.match(/[IJ]/)){x=0.36}}if(v.match(/[acegm-su-z]/)){t=0.45}else{if(v.match(/[ij]/)){t=0.75}}if(v.match(/[ijlt]/)){x=0.28}}if(g.DELIMITERS[v]){x=g.DELIMITERS[v].w||0.4}if(t>z){z=t}if(u>o){o=u}q+=x}if(!this.CHML){this.CHTML={}}this.CHTML={h:0.9,d:0.3,w:q,l:0,r:0,t:z,b:o};e.addText(y,A)},CHTMLbboxFor:function(o){if(this.data[o]&&this.data[o].CHTML){return this.data[o].CHTML}return{w:0,h:0,d:0,l:0,r:0,t:0,b:0}},CHTMLcanStretch:function(q,o,p){if(this.isEmbellished()){var n=this.Core();if(n&&n!==this){return n.CHTMLcanStretch(q,o,p)}}return false},CHTMLstretchV:function(n,o){},CHTMLstretchH:function(n){},CoreParent:function(){var n=this;while(n&&n.isEmbellished()&&n.CoreMO()===this&&!n.isa(h.math)){n=n.Parent()}return n},CoreText:function(n){if(!n){return""}if(n.isEmbellished()){return n.CoreMO().data.join("")}while((n.isa(h.mrow)||n.isa(h.TeXAtom)||n.isa(h.mstyle)||n.isa(h.mphantom))&&n.data.length===1&&n.data[0]){n=n.data[0]}if(!n.isToken){return""}else{return n.data.join("")}}});h.chars.Augment({toCommonHTML:function(n){var o=this.toString().replace(/[\u2061-\u2064]/g,"");this.CHTMLhandleText(n,o)}});h.entity.Augment({toCommonHTML:function(n){var o=this.toString().replace(/[\u2061-\u2064]/g,"");this.CHTMLhandleText(n,o)}});h.math.Augment({toCommonHTML:function(n){n=this.CHTMLdefaultSpan(n);if(this.Get("display")==="block"){n.className+=" MJXc-display"}return n}});h.mo.Augment({toCommonHTML:function(o){o=this.CHTMLdefaultSpan(o);this.CHTMLadjustAccent(o);var n=this.getValues("lspace","rspace","scriptlevel","displaystyle","largeop");if(n.scriptlevel===0){this.CHTML.l=g.length2em(n.lspace);this.CHTML.r=g.length2em(n.rspace);o.style.marginLeft=g.Em(this.CHTML.l);o.style.marginRight=g.Em(this.CHTML.r)}else{this.CHTML.l=0.15;this.CHTML.r=0.1}if(n.displaystyle&&n.largeop){var p=e.Element("span",{className:"MJXc-largeop"});p.appendChild(o.firstChild);o.appendChild(p);this.CHTML.h*=1.2;this.CHTML.d*=1.2;if(this.data.join("")==="\u222B"){p.className+=" MJXc-int"}}return o},CHTMLadjustAccent:function(p){var o=this.CoreParent();if(o&&o.isa(h.munderover)&&this.CoreText(o.data[o.base]).length===1){var q=o.data[o.over],n=o.data[o.under];var s=this.data.join(""),r;if(q&&this===q.CoreMO()&&o.Get("accent")){r=g.REMAPACCENT[s]}else{if(n&&this===n.CoreMO()&&o.Get("accentunder")){r=g.REMAPACCENTUNDER[s]}}if(r){s=p.innerHTML=r}if(s.match(/[\u02C6-\u02DC\u00A8]/)){this.CHTML.acc=-0.52}else{if(s==="\u2192"){this.CHTML.acc=-0.15;this.CHTML.vec=true}}}},CHTMLcanStretch:function(q,o,p){if(!this.Get("stretchy")){return false}var r=this.data.join("");if(r.length>1){return false}r=g.DELIMITERS[r];var n=(r&&r.dir===q.substr(0,1));if(n){n=(this.CHTML.h!==o||this.CHTML.d!==p||(this.Get("minsize",true)||this.Get("maxsize",true)))}return n},CHTMLstretchV:function(p,u){var o=this.CHTMLspanElement(),t=this.CHTML;var n=this.getValues("symmetric","maxsize","minsize");if(n.symmetric){l=2*Math.max(p-0.25,u+0.25)}else{l=p+u}n.maxsize=g.length2em(n.maxsize,t.h+t.d);n.minsize=g.length2em(n.minsize,t.h+t.d);l=Math.max(n.minsize,Math.min(n.maxsize,l));var s=l/(t.h+t.d-0.3);var q=e.Element("span",{style:{"font-size":g.Em(s)}});if(s>1.25){var r=Math.ceil(1.25/s*10);q.className="MJXc-right MJXc-scale"+r;q.style.marginLeft=g.Em(t.w*(r/10-1)+0.07);t.w*=s*r/10}q.appendChild(o.firstChild);o.appendChild(q);if(n.symmetric){o.style.verticalAlign=g.Em(0.25*(1-s))}}});h.mspace.Augment({toCommonHTML:function(q){q=this.CHTMLdefaultSpan(q);var o=this.getValues("height","depth","width");var n=g.length2em(o.width),p=g.length2em(o.height),s=g.length2em(o.depth);var r=this.CHTML;r.w=n;r.h=p;r.d=s;if(n<0){if(!g.lastIsInt){q.style.marginLeft=g.Em(n)}n=0}q.style.width=g.Em(n);q.style.height=g.Em(p+s);if(s){q.style.verticalAlign=g.Em(-s)}return q}});h.mpadded.Augment({toCommonHTML:function(u){u=this.CHTMLdefaultSpan(u,{childSpans:true,className:"MJXc-box",forceChild:true});var o=u.firstChild;var v=this.getValues("width","height","depth","lspace","voffset");var s=this.CHTMLdimen(v.lspace);var q=0,n=0,t=s.len,r=-s.len,p=0;if(v.width!==""){s=this.CHTMLdimen(v.width,"w",0);if(s.pm){r+=s.len}else{u.style.width=g.Em(s.len)}}if(v.height!==""){s=this.CHTMLdimen(v.height,"h",0);if(!s.pm){q+=-this.CHTMLbboxFor(0).h}q+=s.len}if(v.depth!==""){s=this.CHTMLdimen(v.depth,"d",0);if(!s.pm){n+=-this.CHTMLbboxFor(0).d;p+=-s.len}n+=s.len}if(v.voffset!==""){s=this.CHTMLdimen(v.voffset);q-=s.len;n+=s.len;p+=s.len}if(q){o.style.marginTop=g.Em(q)}if(n){o.style.marginBottom=g.Em(n)}if(t){o.style.marginLeft=g.Em(t)}if(r){o.style.marginRight=g.Em(r)}if(p){u.style.verticalAlign=g.Em(p)}return u},CHTMLdimen:function(q,r,n){if(n==null){n=-k}q=String(q);var o=q.match(/width|height|depth/);var p=(o?this.CHTML[o[0].charAt(0)]:(r?this.CHTML[r]:0));return{len:g.length2em(q,p)||0,pm:!!q.match(/^[-+]/)}}});h.munderover.Augment({toCommonHTML:function(q){var n=this.getValues("displaystyle","accent","accentunder","align");if(!n.displaystyle&&this.data[this.base]!=null&&this.data[this.base].CoreMO().Get("movablelimits")){q=h.msubsup.prototype.toCommonHTML.call(this,q);q.className=q.className.replace(/munderover/,"msubsup");return q}q=this.CHTMLdefaultSpan(q,{childSpans:true,className:"",noBBox:true});var p=this.CHTMLbboxFor(this.over),s=this.CHTMLbboxFor(this.under),u=this.CHTMLbboxFor(this.base),o=this.CHTML,r=p.acc;if(this.data[this.over]){q.lastChild.firstChild.style.marginLeft=p.l=q.lastChild.firstChild.style.marginRight=p.r=0;var t=e.Element("span",{},[["span",{className:"MJXc-over"}]]);t.firstChild.appendChild(q.lastChild);if(q.childNodes.length>(this.data[this.under]?1:0)){t.firstChild.appendChild(q.firstChild)}this.data[this.over].CHTMLhandleScriptlevel(t.firstChild.firstChild);if(r!=null){if(p.vec){t.firstChild.firstChild.firstChild.style.fontSize="60%";p.h*=0.6;p.d*=0.6;p.w*=0.6}r=r-p.d+0.1;if(u.t!=null){r+=u.t-u.h}t.firstChild.firstChild.style.marginBottom=g.Em(r)}if(q.firstChild){q.insertBefore(t,q.firstChild)}else{q.appendChild(t)}}if(this.data[this.under]){q.lastChild.firstChild.style.marginLeft=s.l=q.lastChild.firstChild.marginRight=s.r=0;this.data[this.under].CHTMLhandleScriptlevel(q.lastChild)}o.w=Math.max(0.8*p.w,0.8*s.w,u.w);o.h=0.8*(p.h+p.d+(r||0))+u.h;o.d=u.d+0.8*(s.h+s.d);return q}});h.msubsup.Augment({toCommonHTML:function(q){q=this.CHTMLdefaultSpan(q,{noBBox:true});if(!this.data[this.base]){if(q.firstChild){q.insertBefore(e.Element("span"),q.firstChild)}else{q.appendChild(e.Element("span"))}}var s=this.data[this.base],p=this.data[this.sub],n=this.data[this.sup];if(!s){s={bbox:{h:0.8,d:0.2}}}q.firstChild.style.marginRight=".05em";var o=Math.max(0.4,s.CHTML.h-0.4),u=Math.max(0.2,s.CHTML.d+0.1);var t=this.CHTML;if(n&&p){var r=e.Element("span",{className:"MJXc-script-box",style:{height:g.Em(o+n.CHTML.h*0.8+u+p.CHTML.d*0.8),"vertical-align":g.Em(-u-p.CHTML.d*0.8)}},[["span",{},[["span",{},[["span",{style:{"margin-bottom":g.Em(-(n.CHTML.d-0.05))}}]]]]],["span",{},[["span",{},[["span",{style:{"margin-top":g.Em(-(n.CHTML.h-0.05))}}]]]]]]);p.CHTMLhandleScriptlevel(r.firstChild);n.CHTMLhandleScriptlevel(r.lastChild);r.firstChild.firstChild.firstChild.appendChild(q.lastChild);r.lastChild.firstChild.firstChild.appendChild(q.lastChild);q.appendChild(r);t.h=Math.max(s.CHTML.h,n.CHTML.h*0.8+o);t.d=Math.max(s.CHTML.d,p.CHTML.d*0.8+u);t.w=s.CHTML.w+Math.max(n.CHTML.w,p.CHTML.w)+0.07}else{if(n){q.lastChild.style.verticalAlign=g.Em(o);n.CHTMLhandleScriptlevel(q.lastChild);t.h=Math.max(s.CHTML.h,n.CHTML.h*0.8+o);t.d=Math.max(s.CHTML.d,n.CHTML.d*0.8-o);t.w=s.CHTML.w+n.CHTML.w+0.07}else{if(p){q.lastChild.style.verticalAlign=g.Em(-u);p.CHTMLhandleScriptlevel(q.lastChild);t.h=Math.max(s.CHTML.h,p.CHTML.h*0.8-u);t.d=Math.max(s.CHTML.d,p.CHTML.d*0.8+u);t.w=s.CHTML.w+p.CHTML.w+0.07}}}return q}});h.mfrac.Augment({toCommonHTML:function(r){r=this.CHTMLdefaultSpan(r,{childSpans:true,className:"MJXc-box",forceChild:true,noBBox:true});var o=this.getValues("linethickness","displaystyle");if(!o.displaystyle){if(this.data[0]){this.data[0].CHTMLhandleScriptlevel(r.firstChild)}if(this.data[1]){this.data[1].CHTMLhandleScriptlevel(r.lastChild)}}var n=e.Element("span",{className:"MJXc-box",style:{"margin-top":"-.8em"}},[["span",{className:"MJXc-denom"},[["span",{},[["span",{className:"MJXc-rule"}]]],["span"]]]]);n.firstChild.lastChild.appendChild(r.lastChild);r.appendChild(n);var s=this.CHTMLbboxFor(0),p=this.CHTMLbboxFor(1),v=this.CHTML;v.w=Math.max(s.w,p.w)*0.8;v.h=s.h+s.d+0.1+0.25;v.d=p.h+p.d-0.25;v.l=v.r=0.125;o.linethickness=Math.max(0,g.length2em(o.linethickness||"0",0));if(o.linethickness){var u=n.firstChild.firstChild.firstChild;var q=g.Em(o.linethickness);u.style.borderTop=(o.linethickness<0.15?"1px":q)+" solid";u.style.margin=q+" 0";q=o.linethickness;n.style.marginTop=g.Em(3*q-0.9);r.style.verticalAlign=g.Em(1.5*q+0.1);v.h+=1.5*q-0.1;v.d+=1.5*q}return r}});h.msqrt.Augment({toCommonHTML:function(n){n=this.CHTMLdefaultSpan(n,{childSpans:true,className:"MJXc-box",forceChild:true,noBBox:true});this.CHTMLlayoutRoot(n,n.firstChild);return n},CHTMLlayoutRoot:function(u,n){var v=this.CHTMLbboxFor(0);var q=Math.ceil((v.h+v.d+0.14)*100),w=g.Em(14/q);var r=e.Element("span",{className:"MJXc-surd"},[["span",{style:{"font-size":q+"%","margin-top":w}},["\u221A"]]]);var s=e.Element("span",{className:"MJXc-root"},[["span",{className:"MJXc-rule",style:{"border-top":".08em solid"}}]]);var p=(1.2/2.2)*q/100;if(q>150){var o=Math.ceil(150/q*10);r.firstChild.className="MJXc-right MJXc-scale"+o;r.firstChild.style.marginLeft=g.Em(p*(o/10-1)/q*100);p=p*o/10;s.firstChild.style.borderTopWidth=g.Em(0.08/Math.sqrt(o/10))}s.appendChild(n);u.appendChild(r);u.appendChild(s);this.CHTML.h=v.h+0.18;this.CHTML.d=v.d;this.CHTML.w=v.w+p;return u}});h.mroot.Augment({toCommonHTML:function(q){q=this.CHTMLdefaultSpan(q,{childSpans:true,className:"MJXc-box",forceChild:true,noBBox:true});var p=this.CHTMLbboxFor(1),n=q.removeChild(q.lastChild);var t=this.CHTMLlayoutRoot(e.Element("span"),q.firstChild);n.className="MJXc-script";var u=parseInt(t.firstChild.firstChild.style.fontSize);var o=0.55*(u/120)+p.d*0.8,s=-0.6*(u/120);if(u>150){s*=0.95*Math.ceil(150/u*10)/10}n.style.marginRight=g.Em(s);n.style.verticalAlign=g.Em(o);if(-s>p.w*0.8){n.style.marginLeft=g.Em(-s-p.w*0.8)}q.appendChild(n);q.appendChild(t);this.CHTML.w+=Math.max(0,p.w*0.8+s);this.CHTML.h=Math.max(this.CHTML.h,p.h*0.8+o);return q},CHTMLlayoutRoot:h.msqrt.prototype.CHTMLlayoutRoot});h.mfenced.Augment({toCommonHTML:function(q){q=this.CHTMLcreateSpan(q);this.CHTMLhandleStyle(q);this.CHTMLhandleColor(q);this.addFakeNodes();this.CHTMLaddChild(q,"open",{});for(var p=0,n=this.data.length;p<n;p++){this.CHTMLaddChild(q,"sep"+p,{});this.CHTMLaddChild(q,p,{})}this.CHTMLaddChild(q,"close",{});var o=this.CHTML.h,r=this.CHTML.d;this.CHTMLstretchChild("open",o,r);for(p=0,n=this.data.length;p<n;p++){this.CHTMLstretchChild("sep"+p,o,r);this.CHTMLstretchChild(p,o,r)}this.CHTMLstretchChild("close",o,r);return q}});h.mrow.Augment({toCommonHTML:function(q){q=this.CHTMLdefaultSpan(q);var p=this.CHTML.h,r=this.CHTML.d;for(var o=0,n=this.data.length;o<n;o++){this.CHTMLstretchChild(o,p,r)}return q}});h.mstyle.Augment({toCommonHTML:function(n){n=this.CHTMLdefaultSpan(n);this.CHTMLhandleScriptlevel(n);return n}});h.TeXAtom.Augment({toCommonHTML:function(n){n=this.CHTMLdefaultSpan(n);n.className="MJXc-mrow";return n}});h.mtable.Augment({toCommonHTML:function(E){E=this.CHTMLdefaultSpan(E,{noBBox:true});var r=this.getValues("columnalign","rowalign","columnspacing","rowspacing","columnwidth","equalcolumns","equalrows","columnlines","rowlines","frame","framespacing","align","width");var u=MathJax.Hub.SplitList,F,A,D,z;var N=u(r.columnspacing),w=u(r.rowspacing),L=u(r.columnalign),t=u(r.rowalign);for(F=0,A=N.length;F<A;F++){N[F]=g.length2em(N[F])}for(F=0,A=w.length;F<A;F++){w[F]=g.length2em(w[F])}var K=e.Element("span");while(E.firstChild){K.appendChild(E.firstChild)}E.appendChild(K);var y=0,s=0;for(F=0,A=this.data.length;F<A;F++){var v=this.data[F];if(v){var J=g.arrayEntry(w,F-1),C=g.arrayEntry(t,F);var x=v.CHTML,q=v.CHTMLspanElement();q.style.verticalAlign=C;var B=(v.type==="mlabeledtr"?1:0);for(D=0,z=v.data.length;D<z-B;D++){var p=v.data[D+B];if(p){var M=g.arrayEntry(N,D-1),G=g.arrayEntry(L,D);var I=p.CHTMLspanElement();if(D){x.w+=M;I.style.paddingLeft=g.Em(M)}if(F){I.style.paddingTop=g.Em(J)}I.style.textAlign=G}}y+=x.h+x.d;if(F){y+=J}if(x.w>s){s=x.w}}}var o=this.CHTML;o.w=s;o.h=y/2+0.25;o.d=y/2-0.25;o.l=o.r=0.125;return E}});h.mlabeledtr.Augment({CHTMLdefaultSpan:function(q,o){if(!o){o={}}q=this.CHTMLcreateSpan(q);this.CHTMLhandleStyle(q);this.CHTMLhandleColor(q);if(this.isToken){this.CHTMLhandleToken(q)}for(var p=1,n=this.data.length;p<n;p++){this.CHTMLaddChild(q,p,o)}return q}});h.semantics.Augment({toCommonHTML:function(n){n=this.CHTMLcreateSpan(n);if(this.data[0]){this.data[0].toCommonHTML(n);MathJax.Hub.Insert(this.data[0].CHTML||{},this.CHTML)}return n}});h.annotation.Augment({toCommonHTML:function(n){}});h["annotation-xml"].Augment({toCommonHTML:function(n){}});MathJax.Hub.Register.StartupHook("onLoad",function(){setTimeout(MathJax.Callback(["loadComplete",g,"jax.js"]),0)})});MathJax.Hub.Register.StartupHook("End Cookie",function(){if(b.config.menuSettings.zoom!=="None"){i.Require("[MathJax]/extensions/MathZoom.js")}})})(MathJax.Ajax,MathJax.Hub,MathJax.HTML,MathJax.OutputJax.CommonHTML);
(function(a,d){var b=a.config.menuSettings;var c=MathJax.Extension["CHTML-preview"]={version:"2.5.0",config:a.CombineConfig("CHTML-preview",{Chunks:{EqnChunk:10000,EqnChunkFactor:1,EqnChunkDelay:0},color:"inherit!important",updateTime:30,updateDelay:6,messageStyle:"none",disabled:false}),Config:function(){a.Config({"HTML-CSS":this.config.Chunks,SVG:this.config.Chunks});MathJax.Ajax.Styles({".MathJax_Preview .MJXc-math":{color:this.config.color}});var j,g,h,e,i;var f=this.config;if(!f.disabled&&b.CHTMLpreview==null){a.Config({menuSettings:{CHTMLpreview:true}})}a.Register.MessageHook("Begin Math Output",function(){if(!e&&b.CHTMLpreview&&b.renderer!=="CommonHTML"){j=a.processUpdateTime;g=a.processUpdateDelay;h=a.config.messageStyle;a.processUpdateTime=f.updateTime;a.processUpdateDelay=f.updateDelay;a.Config({messageStyle:f.messageStyle});MathJax.Message.Clear(0,0);i=true}});a.Register.MessageHook("End Math Output",function(){if(!e&&i){a.processUpdateTime=j;a.processUpdateDelay=g;a.Config({messageStyle:h});e=true}})},Preview:function(e){if(!b.CHTMLpreview||b.renderer==="CommonHTML"){return}var f=e.script.MathJax.preview||e.script.previousSibling;if(!f||f.className!==MathJax.Hub.config.preRemoveClass){f=d.Element("span",{className:MathJax.Hub.config.preRemoveClass});e.script.parentNode.insertBefore(f,e.script);e.script.MathJax.preview=f}f.innerHTML="";f.style.color="inherit";return this.postFilter(f,e)},postFilter:function(g,f){if(!f.math.root.toCommonHTML){var e=MathJax.Callback.Queue();e.Push(["Require",MathJax.Ajax,"[MathJax]/jax/output/CommonHTML/config.js"],["Require",MathJax.Ajax,"[MathJax]/jax/output/CommonHTML/jax.js"]);a.RestartAfter(e.Push({}))}f.math.root.toCommonHTML(g)},Register:function(e){a.Register.StartupHook(e+" Jax Require",function(){var f=MathJax.InputJax[e];f.postfilterHooks.Add(["Preview",MathJax.Extension["CHTML-preview"]],50)})}};c.Register("TeX");c.Register("MathML");c.Register("AsciiMath");a.Register.StartupHook("End Config",["Config",c]);a.Startup.signal.Post("CHTML-preview Ready")})(MathJax.Hub,MathJax.HTML);MathJax.Ajax.loadComplete("[MathJax]/extensions/CHTML-preview.js");
MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS_HTML-full.js");
| drewfreyling/cdnjs | ajax/libs/mathjax/2.5.0/config/TeX-AMS_HTML-full.js | JavaScript | mit | 292,038 |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config;
/**
* FileLocator uses an array of pre-defined paths to find files.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class FileLocator implements FileLocatorInterface
{
protected $paths;
/**
* Constructor.
*
* @param string|array $paths A path or an array of paths where to look for resources
*/
public function __construct($paths = array())
{
$this->paths = (array) $paths;
}
/**
* Returns a full path for a given file name.
*
* @param mixed $name The file name to locate
* @param string $currentPath The current path
* @param Boolean $first Whether to return the first occurrence or an array of filenames
*
* @return string|array The full path to the file|An array of file paths
*
* @throws \InvalidArgumentException When file is not found
*/
public function locate($name, $currentPath = null, $first = true)
{
if ($this->isAbsolutePath($name)) {
if (!file_exists($name)) {
throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $name));
}
return $name;
}
$filepaths = array();
if (null !== $currentPath && file_exists($file = $currentPath.DIRECTORY_SEPARATOR.$name)) {
if (true === $first) {
return $file;
}
$filepaths[] = $file;
}
foreach ($this->paths as $path) {
if (file_exists($file = $path.DIRECTORY_SEPARATOR.$name)) {
if (true === $first) {
return $file;
}
$filepaths[] = $file;
}
}
if (!$filepaths) {
throw new \InvalidArgumentException(sprintf('The file "%s" does not exist (in: %s%s).', $name, null !== $currentPath ? $currentPath.', ' : '', implode(', ', $this->paths)));
}
return array_values(array_unique($filepaths));
}
/**
* Returns whether the file path is an absolute path.
*
* @param string $file A file path
*
* @return Boolean
*/
private function isAbsolutePath($file)
{
if ($file[0] == '/' || $file[0] == '\\'
|| (strlen($file) > 3 && ctype_alpha($file[0])
&& $file[1] == ':'
&& ($file[2] == '\\' || $file[2] == '/')
)
) {
return true;
}
return false;
}
}
| bobrovan/sym2jobeet | vendor/symfony/src/Symfony/Component/Config/FileLocator.php | PHP | mit | 2,759 |
YUI.add("lang/datatype-date-format_hi",function(a){a.Intl.add("datatype-date-format","hi",{"a":["रवि","सोम","मंगल","बुध","गुरु","शुक्र","शनि"],"A":["रविवार","सोमवार","मंगलवार","बुधवार","गुरुवार","शुक्रवार","शनिवार"],"b":["जनवरी","फरवरी","मार्च","अप्रैल","मई","जून","जुलाई","अगस्त","सितम्बर","अक्तूबर","नवम्बर","दिसम्बर"],"B":["जनवरी","फरवरी","मार्च","अप्रैल","मई","जून","जुलाई","अगस्त","सितम्बर","अक्तूबर","नवम्बर","दिसम्बर"],"c":"%a, %d %b %Y %l:%M:%S %p %Z","p":["AM","PM"],"P":["am","pm"],"x":"%d-%m-%y","X":"%l:%M:%S %p"});},"@VERSION@");YUI.add("lang/datatype-date_hi",function(a){},"@VERSION@",{use:["lang/datatype-date-format_hi"]}); | gaearon/cdnjs | ajax/libs/yui/3.3.0/datatype/lang/datatype-date_hi.js | JavaScript | mit | 1,034 |
YUI.add("array-extras",function(d){var b=d.Lang,c=Array.prototype,a=d.Array;a.lastIndexOf=c.lastIndexOf?function(e,g,f){return f||f===0?e.lastIndexOf(g,f):e.lastIndexOf(g);}:function(f,j,h){var e=f.length,g=e-1;if(h||h===0){g=Math.min(h<0?e+h:h,e);}if(g>-1&&e>0){for(;g>-1;--g){if(f[g]===j){return g;}}}return -1;};a.unique=function(f,l){var k=0,e=f.length,h=[],m,g;for(;k<e;++k){m=f[k];for(g=h.length;g>-1;--g){if(m===h[g]){break;}}if(g===-1){h.push(m);}}if(l){if(b.isNumber(h[0])){h.sort(a.numericSort);}else{h.sort();}}return h;};a.filter=c.filter?function(e,g,h){return e.filter(g,h);}:function(g,l,m){var j=0,e=g.length,h=[],k;for(;j<e;++j){k=g[j];if(l.call(m,k,j,g)){h.push(k);}}return h;};a.reject=function(e,g,h){return a.filter(e,function(k,j,f){return !g.call(h,k,j,f);});};a.every=c.every?function(e,g,h){return e.every(g,h);}:function(g,j,k){for(var h=0,e=g.length;h<e;++h){if(!j.call(k,g[h],h,g)){return false;}}return true;};a.map=c.map?function(e,g,h){return e.map(g,h);}:function(g,k,l){var j=0,e=g.length,h=g.concat();for(;j<e;++j){h[j]=k.call(l,g[j],j,g);}return h;};a.reduce=c.reduce?function(e,i,g,h){return e.reduce(function(l,k,j,f){return g.call(h,l,k,j,f);},i);}:function(h,m,k,l){var j=0,g=h.length,e=m;for(;j<g;++j){e=k.call(l,e,h[j],j,h);}return e;};a.find=function(g,j,k){for(var h=0,e=g.length;h<e;h++){if(j.call(k,g[h],h,g)){return g[h];}}return null;};a.grep=function(e,f){return a.filter(e,function(h,g){return f.test(h);});};a.partition=function(e,h,i){var g={matches:[],rejects:[]};a.each(e,function(j,f){var k=h.call(i,j,f,e)?g.matches:g.rejects;k.push(j);});return g;};a.zip=function(f,e){var g=[];a.each(f,function(i,h){g.push([i,e[h]]);});return g;};a.forEach=a.each;},"@VERSION@"); | humbletim/cdnjs | ajax/libs/yui/3.3.0/collection/array-extras-min.js | JavaScript | mit | 1,720 |
YUI.add("dd-ddm-base",function(B){var A=function(){A.superclass.constructor.apply(this,arguments);};A.NAME="ddm";A.ATTRS={dragCursor:{value:"move"},clickPixelThresh:{value:3},clickTimeThresh:{value:1000},throttleTime:{value:-1},dragMode:{value:"point",setter:function(C){this._setDragMode(C);return C;}}};B.extend(A,B.Base,{_createPG:function(){},_active:null,_setDragMode:function(C){if(C===null){C=B.DD.DDM.get("dragMode");}switch(C){case 1:case"intersect":return 1;case 2:case"strict":return 2;case 0:case"point":return 0;}return 0;},CSS_PREFIX:B.ClassNameManager.getClassName("dd"),_activateTargets:function(){},_drags:[],activeDrag:false,_regDrag:function(C){if(this.getDrag(C.get("node"))){return false;}if(!this._active){this._setupListeners();}this._drags.push(C);return true;},_unregDrag:function(D){var C=[];B.each(this._drags,function(F,E){if(F!==D){C[C.length]=F;}});this._drags=C;},_setupListeners:function(){this._createPG();this._active=true;var C=B.one(B.config.doc);C.on("mousemove",B.throttle(B.bind(this._move,this),this.get("throttleTime")));C.on("mouseup",B.bind(this._end,this));},_start:function(){this.fire("ddm:start");this._startDrag();},_startDrag:function(){},_endDrag:function(){},_dropMove:function(){},_end:function(){if(this.activeDrag){this._endDrag();this.fire("ddm:end");this.activeDrag.end.call(this.activeDrag);this.activeDrag=null;}},stopDrag:function(){if(this.activeDrag){this._end();}return this;},_move:function(C){if(this.activeDrag){this.activeDrag._move.call(this.activeDrag,C);this._dropMove();}},cssSizestoObject:function(D){var C=D.split(" ");switch(C.length){case 1:C[1]=C[2]=C[3]=C[0];break;case 2:C[2]=C[0];C[3]=C[1];break;case 3:C[3]=C[1];break;}return{top:parseInt(C[0],10),right:parseInt(C[1],10),bottom:parseInt(C[2],10),left:parseInt(C[3],10)};},getDrag:function(D){var C=false,E=B.one(D);if(E instanceof B.Node){B.each(this._drags,function(G,F){if(E.compareTo(G.get("node"))){C=G;}});}return C;},swapPosition:function(D,C){D=B.DD.DDM.getNode(D);C=B.DD.DDM.getNode(C);var F=D.getXY(),E=C.getXY();D.setXY(E);C.setXY(F);return D;},getNode:function(C){if(C&&C.get){if(B.Widget&&(C instanceof B.Widget)){C=C.get("boundingBox");}else{C=C.get("node");}}else{C=B.one(C);}return C;},swapNode:function(E,C){E=B.DD.DDM.getNode(E);C=B.DD.DDM.getNode(C);var F=C.get("parentNode"),D=C.get("nextSibling");if(D==E){F.insertBefore(E,C);}else{if(C==E.get("nextSibling")){F.insertBefore(C,E);}else{E.get("parentNode").replaceChild(C,E);F.insertBefore(E,D);}}return E;}});B.namespace("DD");B.DD.DDM=new A();},"@VERSION@",{requires:["node","base","yui-throttle","classnamemanager"],skinnable:false}); | SaravananRajaraman/cdnjs | ajax/libs/yui/3.3.0/dd/dd-ddm-base-min.js | JavaScript | mit | 2,636 |
if (global.GENTLY) require = GENTLY.hijack(require);
var util = require('util'),
WriteStream = require('fs').WriteStream,
EventEmitter = require('events').EventEmitter,
crypto = require('crypto');
function File(properties) {
EventEmitter.call(this);
this.size = 0;
this.path = null;
this.name = null;
this.type = null;
this.hash = null;
this.lastModifiedDate = null;
this._writeStream = null;
for (var key in properties) {
this[key] = properties[key];
}
if(typeof this.hash === 'string') {
this.hash = crypto.createHash(properties.hash);
} else {
this.hash = null;
}
}
module.exports = File;
util.inherits(File, EventEmitter);
File.prototype.open = function() {
this._writeStream = new WriteStream(this.path);
};
File.prototype.toJSON = function() {
return {
size: this.size,
path: this.path,
name: this.name,
type: this.type,
mtime: this.lastModifiedDate,
length: this.length,
filename: this.filename,
mime: this.mime
};
};
File.prototype.write = function(buffer, cb) {
var self = this;
if (self.hash) {
self.hash.update(buffer);
}
this._writeStream.write(buffer, function() {
self.lastModifiedDate = new Date();
self.size += buffer.length;
self.emit('progress', self.size);
cb();
});
};
File.prototype.end = function(cb) {
var self = this;
if (self.hash) {
self.hash = self.hash.digest('hex');
}
this._writeStream.end(function() {
self.emit('end');
cb();
});
};
| joeylin/creativeclub | node_modules/loader/example/node_modules/connect/node_modules/formidable/lib/file.js | JavaScript | mit | 1,516 |
YUI.add("datatable-sort-deprecated",function(g){var f=g.ClassNameManager.getClassName,h="datatable",b="column",d="asc",c="desc",a='<a class="{link_class}" title="{link_title}" href="{link_href}">{value}</a>';function e(){e.superclass.constructor.apply(this,arguments);}g.mix(e,{NS:"sort",NAME:"dataTableSort",ATTRS:{trigger:{value:{event:"click",selector:"th"},writeOnce:"initOnly"},lastSortedBy:{setter:"_setLastSortedBy",lazyAdd:false},template:{value:a},strings:{valueFn:function(){return g.Intl.get("datatable-sort-deprecated");}}}});g.extend(e,g.Plugin.Base,{initializer:function(j){var k=this.get("host"),i=this.get("trigger");k.get("recordset").plug(g.Plugin.RecordsetSort,{dt:k});k.get("recordset").sort.addTarget(k);this.doBefore("_createTheadThNode",this._beforeCreateTheadThNode);this.doBefore("_attachTheadThNode",this._beforeAttachTheadThNode);this.doBefore("_attachTbodyTdNode",this._beforeAttachTbodyTdNode);k.delegate(i.event,g.bind(this._onEventSortColumn,this),i.selector);k.after("recordsetSort:sort",function(){this._uiSetRecordset(this.get("recordset"));});this.on("lastSortedByChange",function(l){this._uiSetLastSortedBy(l.prevVal,l.newVal,k);});if(k.get("rendered")){k._uiSetColumnset(k.get("columnset"));this._uiSetLastSortedBy(null,this.get("lastSortedBy"),k);}},_setLastSortedBy:function(i){if(g.Lang.isString(i)){i={key:i,dir:"desc"};}if(i){return(i.dir==="desc")?{key:i.key,dir:"desc",notdir:"asc"}:{key:i.key,dir:"asc",notdir:"desc"};}else{return null;}},_uiSetLastSortedBy:function(n,m,l){var w=this.get("strings"),k=l.get("columnset"),x=n&&n.key,u=m&&m.key,i=n&&l.getClassName(n.dir),p=m&&l.getClassName(m.dir),r=k.keyHash[x],o=k.keyHash[u],q=l._tbodyNode,v=g.Lang.sub,j,t,s;if(r&&i){j=r.thNode;t=j.one("a");if(t){t.set("title",v(w.sortBy,{column:r.get("label")}));}j.removeClass(i);q.all("."+f(b,r.get("id"))).removeClass(i);}if(o&&p){j=o.thNode;t=j.one("a");if(t){s=(m.dir===d)?"reverseSortBy":"sortBy";t.set("title",v(w[s],{column:o.get("label")}));}j.addClass(p);q.all("."+f(b,o.get("id"))).addClass(p);}},_beforeCreateTheadThNode:function(k){var i,j;if(k.column.get("sortable")){i=this.get("lastSortedBy");j=(i&&i.dir===d&&i.key===k.column.get("key"))?"reverseSortBy":"sortBy";k.value=g.Lang.sub(this.get("template"),{link_class:k.link_class||"",link_title:g.Lang.sub(this.get("strings."+j),{column:k.column.get("label")}),link_href:"#",value:k.value});}},_beforeAttachTheadThNode:function(m){var l=this.get("lastSortedBy"),k=l&&l.key,i=l&&l.dir,j=l&&l.notdir;if(m.column.get("sortable")){m.th.addClass(f(h,"sortable"));}if(k&&(k===m.column.get("key"))){m.th.replaceClass(f(h,j),f(h,i));}},_beforeAttachTbodyTdNode:function(m){var l=this.get("lastSortedBy"),k=l&&l.key,i=l&&l.dir,j=l&&l.notdir;if(m.column.get("sortable")){m.td.addClass(f(h,"sortable"));}if(k&&(k===m.column.get("key"))){m.td.replaceClass(f(h,j),f(h,i));}},_onEventSortColumn:function(n){n.halt();var l=this.get("host"),k=l.get("columnset").idHash[n.currentTarget.get("id")],j,m,i,o,p;if(k.get("sortable")){j=k.get("key");m=k.get("field");i=this.get("lastSortedBy")||{};o=(i.key===j&&i.dir===d);p=k.get("sortFn");l.get("recordset").sort.sort(m,o,p);this.set("lastSortedBy",{key:j,dir:(o)?c:d});}}});g.namespace("Plugin").DataTableSort=e;},"@VERSION@",{requires:["datatable-base-deprecated","plugin","recordset-sort"],lang:["en"]}); | RubaXa/cdnjs | ajax/libs/yui/3.10.2/datatable-sort-deprecated/datatable-sort-deprecated-min.js | JavaScript | mit | 3,334 |
//
// NVActivityIndicatorAnimationBallPulseRise.swift
// NVActivityIndicatorViewDemo
//
// Created by Nguyen Vinh on 7/24/15.
// Copyright (c) 2015 Nguyen Vinh. All rights reserved.
//
import UIKit
class NVActivityIndicatorAnimationBallPulseRise: NVActivityIndicatorAnimationDelegate {
func setUpAnimationInLayer(layer: CALayer, size: CGSize, color: UIColor) {
let circleSpacing: CGFloat = 2
let circleSize = (size.width - 4 * circleSpacing) / 5
let x = (layer.bounds.size.width - size.width) / 2
let y = (layer.bounds.size.height - circleSize) / 2
let deltaY = size.height / 2
let duration: CFTimeInterval = 1
let timingFunction = CAMediaTimingFunction(controlPoints: 0.15, 0.46, 0.9, 0.6)
let oddAnimation = self.oddAnimation(duration: duration, deltaY: deltaY, timingFunction: timingFunction)
let evenAnimation = self.evenAnimation(duration: duration, deltaY: deltaY, timingFunction: timingFunction)
// Draw circles
for var i = 0; i < 5; i++ {
let circle = NVActivityIndicatorShape.Circle.createLayerWith(size: CGSize(width: circleSize, height: circleSize), color: color)
let frame = CGRect(x: x + circleSize * CGFloat(i) + circleSpacing * CGFloat(i),
y: y,
width: circleSize,
height: circleSize)
circle.frame = frame
if i % 2 == 0 {
circle.addAnimation(evenAnimation, forKey: "animation")
} else {
circle.addAnimation(oddAnimation, forKey: "animation")
}
layer.addSublayer(circle)
}
}
func oddAnimation(# duration: CFTimeInterval, deltaY: CGFloat, timingFunction: CAMediaTimingFunction) -> CAAnimation {
// Scale animation
let scaleAnimation = CAKeyframeAnimation(keyPath: "transform.scale")
scaleAnimation.keyTimes = [0, 0.5, 1]
scaleAnimation.timingFunctions = [timingFunction, timingFunction]
scaleAnimation.values = [0.4, 1.1, 0.75]
scaleAnimation.duration = duration
// Translate animation
let translateAnimation = CAKeyframeAnimation(keyPath: "transform.translation.y")
translateAnimation.keyTimes = [0, 0.25, 0.75, 1]
translateAnimation.timingFunctions = [timingFunction, timingFunction, timingFunction]
translateAnimation.values = [0, deltaY, -deltaY, 0]
translateAnimation.duration = duration
let animation = CAAnimationGroup()
animation.animations = [scaleAnimation, translateAnimation]
animation.duration = duration
animation.repeatCount = HUGE
animation.removedOnCompletion = false
return animation
}
func evenAnimation(# duration: CFTimeInterval, deltaY: CGFloat, timingFunction: CAMediaTimingFunction) -> CAAnimation {
// Scale animation
let scaleAnimation = CAKeyframeAnimation(keyPath: "transform.scale")
scaleAnimation.keyTimes = [0, 0.5, 1]
scaleAnimation.timingFunctions = [timingFunction, timingFunction]
scaleAnimation.values = [1.1, 0.4, 1]
scaleAnimation.duration = duration
// Translate animation
let translateAnimation = CAKeyframeAnimation(keyPath: "transform.translation.y")
translateAnimation.keyTimes = [0, 0.25, 0.75, 1]
translateAnimation.timingFunctions = [timingFunction, timingFunction, timingFunction]
translateAnimation.values = [0, -deltaY, deltaY, 0]
translateAnimation.duration = duration
let animation = CAAnimationGroup()
animation.animations = [scaleAnimation, translateAnimation]
animation.duration = duration
animation.repeatCount = HUGE
animation.removedOnCompletion = false
return animation
}
}
| zgtios/NVActivityIndicatorView | NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulseRise.swift | Swift | mit | 3,968 |
// Copyright 2015 go-dockerclient authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package testing provides a fake implementation of the Docker API, useful for
// testing purpose.
package testing
import (
"archive/tar"
"crypto/rand"
"encoding/json"
"errors"
"fmt"
mathrand "math/rand"
"net"
"net/http"
"regexp"
"strconv"
"strings"
"sync"
"time"
"github.com/fsouza/go-dockerclient"
"github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/stdcopy"
"github.com/fsouza/go-dockerclient/external/github.com/gorilla/mux"
)
var nameRegexp = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_.-]+$`)
// DockerServer represents a programmable, concurrent (not much), HTTP server
// implementing a fake version of the Docker remote API.
//
// It can used in standalone mode, listening for connections or as an arbitrary
// HTTP handler.
//
// For more details on the remote API, check http://goo.gl/G3plxW.
type DockerServer struct {
containers []*docker.Container
execs []*docker.ExecInspect
execMut sync.RWMutex
cMut sync.RWMutex
images []docker.Image
iMut sync.RWMutex
imgIDs map[string]string
listener net.Listener
mux *mux.Router
hook func(*http.Request)
failures map[string]string
multiFailures []map[string]string
execCallbacks map[string]func()
statsCallbacks map[string]func(string) docker.Stats
customHandlers map[string]http.Handler
handlerMutex sync.RWMutex
cChan chan<- *docker.Container
}
// NewServer returns a new instance of the fake server, in standalone mode. Use
// the method URL to get the URL of the server.
//
// It receives the bind address (use 127.0.0.1:0 for getting an available port
// on the host), a channel of containers and a hook function, that will be
// called on every request.
//
// The fake server will send containers in the channel whenever the container
// changes its state, via the HTTP API (i.e.: create, start and stop). This
// channel may be nil, which means that the server won't notify on state
// changes.
func NewServer(bind string, containerChan chan<- *docker.Container, hook func(*http.Request)) (*DockerServer, error) {
listener, err := net.Listen("tcp", bind)
if err != nil {
return nil, err
}
server := DockerServer{
listener: listener,
imgIDs: make(map[string]string),
hook: hook,
failures: make(map[string]string),
execCallbacks: make(map[string]func()),
statsCallbacks: make(map[string]func(string) docker.Stats),
customHandlers: make(map[string]http.Handler),
cChan: containerChan,
}
server.buildMuxer()
go http.Serve(listener, &server)
return &server, nil
}
func (s *DockerServer) notify(container *docker.Container) {
if s.cChan != nil {
s.cChan <- container
}
}
func (s *DockerServer) buildMuxer() {
s.mux = mux.NewRouter()
s.mux.Path("/commit").Methods("POST").HandlerFunc(s.handlerWrapper(s.commitContainer))
s.mux.Path("/containers/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.listContainers))
s.mux.Path("/containers/create").Methods("POST").HandlerFunc(s.handlerWrapper(s.createContainer))
s.mux.Path("/containers/{id:.*}/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.inspectContainer))
s.mux.Path("/containers/{id:.*}/rename").Methods("POST").HandlerFunc(s.handlerWrapper(s.renameContainer))
s.mux.Path("/containers/{id:.*}/top").Methods("GET").HandlerFunc(s.handlerWrapper(s.topContainer))
s.mux.Path("/containers/{id:.*}/start").Methods("POST").HandlerFunc(s.handlerWrapper(s.startContainer))
s.mux.Path("/containers/{id:.*}/kill").Methods("POST").HandlerFunc(s.handlerWrapper(s.stopContainer))
s.mux.Path("/containers/{id:.*}/stop").Methods("POST").HandlerFunc(s.handlerWrapper(s.stopContainer))
s.mux.Path("/containers/{id:.*}/pause").Methods("POST").HandlerFunc(s.handlerWrapper(s.pauseContainer))
s.mux.Path("/containers/{id:.*}/unpause").Methods("POST").HandlerFunc(s.handlerWrapper(s.unpauseContainer))
s.mux.Path("/containers/{id:.*}/wait").Methods("POST").HandlerFunc(s.handlerWrapper(s.waitContainer))
s.mux.Path("/containers/{id:.*}/attach").Methods("POST").HandlerFunc(s.handlerWrapper(s.attachContainer))
s.mux.Path("/containers/{id:.*}").Methods("DELETE").HandlerFunc(s.handlerWrapper(s.removeContainer))
s.mux.Path("/containers/{id:.*}/exec").Methods("POST").HandlerFunc(s.handlerWrapper(s.createExecContainer))
s.mux.Path("/containers/{id:.*}/stats").Methods("GET").HandlerFunc(s.handlerWrapper(s.statsContainer))
s.mux.Path("/exec/{id:.*}/resize").Methods("POST").HandlerFunc(s.handlerWrapper(s.resizeExecContainer))
s.mux.Path("/exec/{id:.*}/start").Methods("POST").HandlerFunc(s.handlerWrapper(s.startExecContainer))
s.mux.Path("/exec/{id:.*}/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.inspectExecContainer))
s.mux.Path("/images/create").Methods("POST").HandlerFunc(s.handlerWrapper(s.pullImage))
s.mux.Path("/build").Methods("POST").HandlerFunc(s.handlerWrapper(s.buildImage))
s.mux.Path("/images/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.listImages))
s.mux.Path("/images/{id:.*}").Methods("DELETE").HandlerFunc(s.handlerWrapper(s.removeImage))
s.mux.Path("/images/{name:.*}/json").Methods("GET").HandlerFunc(s.handlerWrapper(s.inspectImage))
s.mux.Path("/images/{name:.*}/push").Methods("POST").HandlerFunc(s.handlerWrapper(s.pushImage))
s.mux.Path("/images/{name:.*}/tag").Methods("POST").HandlerFunc(s.handlerWrapper(s.tagImage))
s.mux.Path("/events").Methods("GET").HandlerFunc(s.listEvents)
s.mux.Path("/_ping").Methods("GET").HandlerFunc(s.handlerWrapper(s.pingDocker))
s.mux.Path("/images/load").Methods("POST").HandlerFunc(s.handlerWrapper(s.loadImage))
s.mux.Path("/images/{id:.*}/get").Methods("GET").HandlerFunc(s.handlerWrapper(s.getImage))
}
// SetHook changes the hook function used by the server.
//
// The hook function is a function called on every request.
func (s *DockerServer) SetHook(hook func(*http.Request)) {
s.hook = hook
}
// PrepareExec adds a callback to a container exec in the fake server.
//
// This function will be called whenever the given exec id is started, and the
// given exec id will remain in the "Running" start while the function is
// running, so it's useful for emulating an exec that runs for two seconds, for
// example:
//
// opts := docker.CreateExecOptions{
// AttachStdin: true,
// AttachStdout: true,
// AttachStderr: true,
// Tty: true,
// Cmd: []string{"/bin/bash", "-l"},
// }
// // Client points to a fake server.
// exec, err := client.CreateExec(opts)
// // handle error
// server.PrepareExec(exec.ID, func() {time.Sleep(2 * time.Second)})
// err = client.StartExec(exec.ID, docker.StartExecOptions{Tty: true}) // will block for 2 seconds
// // handle error
func (s *DockerServer) PrepareExec(id string, callback func()) {
s.execCallbacks[id] = callback
}
// PrepareStats adds a callback that will be called for each container stats
// call.
//
// This callback function will be called multiple times if stream is set to
// true when stats is called.
func (s *DockerServer) PrepareStats(id string, callback func(string) docker.Stats) {
s.statsCallbacks[id] = callback
}
// PrepareFailure adds a new expected failure based on a URL regexp it receives
// an id for the failure.
func (s *DockerServer) PrepareFailure(id string, urlRegexp string) {
s.failures[id] = urlRegexp
}
// PrepareMultiFailures enqueues a new expected failure based on a URL regexp
// it receives an id for the failure.
func (s *DockerServer) PrepareMultiFailures(id string, urlRegexp string) {
s.multiFailures = append(s.multiFailures, map[string]string{"error": id, "url": urlRegexp})
}
// ResetFailure removes an expected failure identified by the given id.
func (s *DockerServer) ResetFailure(id string) {
delete(s.failures, id)
}
// ResetMultiFailures removes all enqueued failures.
func (s *DockerServer) ResetMultiFailures() {
s.multiFailures = []map[string]string{}
}
// CustomHandler registers a custom handler for a specific path.
//
// For example:
//
// server.CustomHandler("/containers/json", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// http.Error(w, "Something wrong is not right", http.StatusInternalServerError)
// }))
func (s *DockerServer) CustomHandler(path string, handler http.Handler) {
s.handlerMutex.Lock()
s.customHandlers[path] = handler
s.handlerMutex.Unlock()
}
// MutateContainer changes the state of a container, returning an error if the
// given id does not match to any container "running" in the server.
func (s *DockerServer) MutateContainer(id string, state docker.State) error {
for _, container := range s.containers {
if container.ID == id {
container.State = state
return nil
}
}
return errors.New("container not found")
}
// Stop stops the server.
func (s *DockerServer) Stop() {
if s.listener != nil {
s.listener.Close()
}
}
// URL returns the HTTP URL of the server.
func (s *DockerServer) URL() string {
if s.listener == nil {
return ""
}
return "http://" + s.listener.Addr().String() + "/"
}
// ServeHTTP handles HTTP requests sent to the server.
func (s *DockerServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.handlerMutex.RLock()
defer s.handlerMutex.RUnlock()
for re, handler := range s.customHandlers {
if m, _ := regexp.MatchString(re, r.URL.Path); m {
handler.ServeHTTP(w, r)
return
}
}
s.mux.ServeHTTP(w, r)
if s.hook != nil {
s.hook(r)
}
}
// DefaultHandler returns default http.Handler mux, it allows customHandlers to
// call the default behavior if wanted.
func (s *DockerServer) DefaultHandler() http.Handler {
return s.mux
}
func (s *DockerServer) handlerWrapper(f func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
for errorID, urlRegexp := range s.failures {
matched, err := regexp.MatchString(urlRegexp, r.URL.Path)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
if !matched {
continue
}
http.Error(w, errorID, http.StatusBadRequest)
return
}
for i, failure := range s.multiFailures {
matched, err := regexp.MatchString(failure["url"], r.URL.Path)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
if !matched {
continue
}
http.Error(w, failure["error"], http.StatusBadRequest)
s.multiFailures = append(s.multiFailures[:i], s.multiFailures[i+1:]...)
return
}
f(w, r)
}
}
func (s *DockerServer) listContainers(w http.ResponseWriter, r *http.Request) {
all := r.URL.Query().Get("all")
s.cMut.RLock()
result := make([]docker.APIContainers, 0, len(s.containers))
for _, container := range s.containers {
if all == "1" || container.State.Running {
result = append(result, docker.APIContainers{
ID: container.ID,
Image: container.Image,
Command: fmt.Sprintf("%s %s", container.Path, strings.Join(container.Args, " ")),
Created: container.Created.Unix(),
Status: container.State.String(),
Ports: container.NetworkSettings.PortMappingAPI(),
Names: []string{fmt.Sprintf("/%s", container.Name)},
})
}
}
s.cMut.RUnlock()
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
json.NewEncoder(w).Encode(result)
}
func (s *DockerServer) listImages(w http.ResponseWriter, r *http.Request) {
s.cMut.RLock()
result := make([]docker.APIImages, len(s.images))
for i, image := range s.images {
result[i] = docker.APIImages{
ID: image.ID,
Created: image.Created.Unix(),
}
for tag, id := range s.imgIDs {
if id == image.ID {
result[i].RepoTags = append(result[i].RepoTags, tag)
}
}
}
s.cMut.RUnlock()
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
json.NewEncoder(w).Encode(result)
}
func (s *DockerServer) findImage(id string) (string, error) {
s.iMut.RLock()
defer s.iMut.RUnlock()
image, ok := s.imgIDs[id]
if ok {
return image, nil
}
image, _, err := s.findImageByID(id)
return image, err
}
func (s *DockerServer) findImageByID(id string) (string, int, error) {
s.iMut.RLock()
defer s.iMut.RUnlock()
for i, image := range s.images {
if image.ID == id {
return image.ID, i, nil
}
}
return "", -1, errors.New("No such image")
}
func (s *DockerServer) createContainer(w http.ResponseWriter, r *http.Request) {
var config struct {
*docker.Config
HostConfig *docker.HostConfig
}
defer r.Body.Close()
err := json.NewDecoder(r.Body).Decode(&config)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
name := r.URL.Query().Get("name")
if name != "" && !nameRegexp.MatchString(name) {
http.Error(w, "Invalid container name", http.StatusInternalServerError)
return
}
if _, err := s.findImage(config.Image); err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
ports := map[docker.Port][]docker.PortBinding{}
for port := range config.ExposedPorts {
ports[port] = []docker.PortBinding{{
HostIP: "0.0.0.0",
HostPort: strconv.Itoa(mathrand.Int() % 65536),
}}
}
//the container may not have cmd when using a Dockerfile
var path string
var args []string
if len(config.Cmd) == 1 {
path = config.Cmd[0]
} else if len(config.Cmd) > 1 {
path = config.Cmd[0]
args = config.Cmd[1:]
}
generatedID := s.generateID()
config.Config.Hostname = generatedID[:12]
container := docker.Container{
Name: name,
ID: generatedID,
Created: time.Now(),
Path: path,
Args: args,
Config: config.Config,
HostConfig: config.HostConfig,
State: docker.State{
Running: false,
Pid: mathrand.Int() % 50000,
ExitCode: 0,
StartedAt: time.Now(),
},
Image: config.Image,
NetworkSettings: &docker.NetworkSettings{
IPAddress: fmt.Sprintf("172.16.42.%d", mathrand.Int()%250+2),
IPPrefixLen: 24,
Gateway: "172.16.42.1",
Bridge: "docker0",
Ports: ports,
},
}
s.cMut.Lock()
if container.Name != "" {
for _, c := range s.containers {
if c.Name == container.Name {
defer s.cMut.Unlock()
http.Error(w, "there's already a container with this name", http.StatusConflict)
return
}
}
}
s.containers = append(s.containers, &container)
s.cMut.Unlock()
w.WriteHeader(http.StatusCreated)
s.notify(&container)
var c = struct{ ID string }{ID: container.ID}
json.NewEncoder(w).Encode(c)
}
func (s *DockerServer) generateID() string {
var buf [16]byte
rand.Read(buf[:])
return fmt.Sprintf("%x", buf)
}
func (s *DockerServer) renameContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
container, index, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
copy := *container
copy.Name = r.URL.Query().Get("name")
s.cMut.Lock()
defer s.cMut.Unlock()
if s.containers[index].ID == copy.ID {
s.containers[index] = ©
}
w.WriteHeader(http.StatusNoContent)
}
func (s *DockerServer) inspectContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
container, _, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
json.NewEncoder(w).Encode(container)
}
func (s *DockerServer) statsContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
_, _, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
stream, _ := strconv.ParseBool(r.URL.Query().Get("stream"))
callback := s.statsCallbacks[id]
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
encoder := json.NewEncoder(w)
for {
var stats docker.Stats
if callback != nil {
stats = callback(id)
}
encoder.Encode(stats)
if !stream {
break
}
}
}
func (s *DockerServer) topContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
container, _, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
if !container.State.Running {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "Container %s is not running", id)
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
result := docker.TopResult{
Titles: []string{"UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"},
Processes: [][]string{
{"root", "7535", "7516", "0", "03:20", "?", "00:00:00", container.Path + " " + strings.Join(container.Args, " ")},
},
}
json.NewEncoder(w).Encode(result)
}
func (s *DockerServer) startContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
container, _, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
s.cMut.Lock()
defer s.cMut.Unlock()
defer r.Body.Close()
var hostConfig docker.HostConfig
err = json.NewDecoder(r.Body).Decode(&hostConfig)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
container.HostConfig = &hostConfig
if container.State.Running {
http.Error(w, "Container already running", http.StatusBadRequest)
return
}
container.State.Running = true
s.notify(container)
}
func (s *DockerServer) stopContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
container, _, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
s.cMut.Lock()
defer s.cMut.Unlock()
if !container.State.Running {
http.Error(w, "Container not running", http.StatusBadRequest)
return
}
w.WriteHeader(http.StatusNoContent)
container.State.Running = false
s.notify(container)
}
func (s *DockerServer) pauseContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
container, _, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
s.cMut.Lock()
defer s.cMut.Unlock()
if container.State.Paused {
http.Error(w, "Container already paused", http.StatusBadRequest)
return
}
w.WriteHeader(http.StatusNoContent)
container.State.Paused = true
}
func (s *DockerServer) unpauseContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
container, _, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
s.cMut.Lock()
defer s.cMut.Unlock()
if !container.State.Paused {
http.Error(w, "Container not paused", http.StatusBadRequest)
return
}
w.WriteHeader(http.StatusNoContent)
container.State.Paused = false
}
func (s *DockerServer) attachContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
container, _, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
hijacker, ok := w.(http.Hijacker)
if !ok {
http.Error(w, "cannot hijack connection", http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/vnd.docker.raw-stream")
w.WriteHeader(http.StatusOK)
conn, _, err := hijacker.Hijack()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
outStream := stdcopy.NewStdWriter(conn, stdcopy.Stdout)
if container.State.Running {
fmt.Fprintf(outStream, "Container %q is running\n", container.ID)
} else {
fmt.Fprintf(outStream, "Container %q is not running\n", container.ID)
}
fmt.Fprintln(outStream, "What happened?")
fmt.Fprintln(outStream, "Something happened")
conn.Close()
}
func (s *DockerServer) waitContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
container, _, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
for {
time.Sleep(1e6)
s.cMut.RLock()
if !container.State.Running {
s.cMut.RUnlock()
break
}
s.cMut.RUnlock()
}
result := map[string]int{"StatusCode": container.State.ExitCode}
json.NewEncoder(w).Encode(result)
}
func (s *DockerServer) removeContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
force := r.URL.Query().Get("force")
_, index, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
if s.containers[index].State.Running && force != "1" {
msg := "Error: API error (406): Impossible to remove a running container, please stop it first"
http.Error(w, msg, http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusNoContent)
s.cMut.Lock()
defer s.cMut.Unlock()
s.containers[index] = s.containers[len(s.containers)-1]
s.containers = s.containers[:len(s.containers)-1]
}
func (s *DockerServer) commitContainer(w http.ResponseWriter, r *http.Request) {
id := r.URL.Query().Get("container")
container, _, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
var config *docker.Config
runConfig := r.URL.Query().Get("run")
if runConfig != "" {
config = new(docker.Config)
err = json.Unmarshal([]byte(runConfig), config)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
}
w.WriteHeader(http.StatusOK)
image := docker.Image{
ID: "img-" + container.ID,
Parent: container.Image,
Container: container.ID,
Comment: r.URL.Query().Get("m"),
Author: r.URL.Query().Get("author"),
Config: config,
}
repository := r.URL.Query().Get("repo")
tag := r.URL.Query().Get("tag")
s.iMut.Lock()
s.images = append(s.images, image)
if repository != "" {
if tag != "" {
repository += ":" + tag
}
s.imgIDs[repository] = image.ID
}
s.iMut.Unlock()
fmt.Fprintf(w, `{"ID":%q}`, image.ID)
}
func (s *DockerServer) findContainer(idOrName string) (*docker.Container, int, error) {
s.cMut.RLock()
defer s.cMut.RUnlock()
for i, container := range s.containers {
if container.ID == idOrName || container.Name == idOrName {
return container, i, nil
}
}
return nil, -1, errors.New("No such container")
}
func (s *DockerServer) buildImage(w http.ResponseWriter, r *http.Request) {
if ct := r.Header.Get("Content-Type"); ct == "application/tar" {
gotDockerFile := false
tr := tar.NewReader(r.Body)
for {
header, err := tr.Next()
if err != nil {
break
}
if header.Name == "Dockerfile" {
gotDockerFile = true
}
}
if !gotDockerFile {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte("miss Dockerfile"))
return
}
}
//we did not use that Dockerfile to build image cause we are a fake Docker daemon
image := docker.Image{
ID: s.generateID(),
Created: time.Now(),
}
query := r.URL.Query()
repository := image.ID
if t := query.Get("t"); t != "" {
repository = t
}
s.iMut.Lock()
s.images = append(s.images, image)
s.imgIDs[repository] = image.ID
s.iMut.Unlock()
w.Write([]byte(fmt.Sprintf("Successfully built %s", image.ID)))
}
func (s *DockerServer) pullImage(w http.ResponseWriter, r *http.Request) {
fromImageName := r.URL.Query().Get("fromImage")
tag := r.URL.Query().Get("tag")
image := docker.Image{
ID: s.generateID(),
}
s.iMut.Lock()
s.images = append(s.images, image)
if fromImageName != "" {
if tag != "" {
fromImageName = fmt.Sprintf("%s:%s", fromImageName, tag)
}
s.imgIDs[fromImageName] = image.ID
}
s.iMut.Unlock()
}
func (s *DockerServer) pushImage(w http.ResponseWriter, r *http.Request) {
name := mux.Vars(r)["name"]
tag := r.URL.Query().Get("tag")
if tag != "" {
name += ":" + tag
}
s.iMut.RLock()
if _, ok := s.imgIDs[name]; !ok {
s.iMut.RUnlock()
http.Error(w, "No such image", http.StatusNotFound)
return
}
s.iMut.RUnlock()
fmt.Fprintln(w, "Pushing...")
fmt.Fprintln(w, "Pushed")
}
func (s *DockerServer) tagImage(w http.ResponseWriter, r *http.Request) {
name := mux.Vars(r)["name"]
s.iMut.RLock()
if _, ok := s.imgIDs[name]; !ok {
s.iMut.RUnlock()
http.Error(w, "No such image", http.StatusNotFound)
return
}
s.iMut.RUnlock()
s.iMut.Lock()
defer s.iMut.Unlock()
newRepo := r.URL.Query().Get("repo")
newTag := r.URL.Query().Get("tag")
if newTag != "" {
newRepo += ":" + newTag
}
s.imgIDs[newRepo] = s.imgIDs[name]
w.WriteHeader(http.StatusCreated)
}
func (s *DockerServer) removeImage(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
s.iMut.RLock()
var tag string
if img, ok := s.imgIDs[id]; ok {
id, tag = img, id
}
var tags []string
for tag, taggedID := range s.imgIDs {
if taggedID == id {
tags = append(tags, tag)
}
}
s.iMut.RUnlock()
_, index, err := s.findImageByID(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
w.WriteHeader(http.StatusNoContent)
s.iMut.Lock()
defer s.iMut.Unlock()
if len(tags) < 2 {
s.images[index] = s.images[len(s.images)-1]
s.images = s.images[:len(s.images)-1]
}
if tag != "" {
delete(s.imgIDs, tag)
}
}
func (s *DockerServer) inspectImage(w http.ResponseWriter, r *http.Request) {
name := mux.Vars(r)["name"]
s.iMut.RLock()
defer s.iMut.RUnlock()
if id, ok := s.imgIDs[name]; ok {
for _, img := range s.images {
if img.ID == id {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
json.NewEncoder(w).Encode(img)
return
}
}
}
http.Error(w, "not found", http.StatusNotFound)
}
func (s *DockerServer) listEvents(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
var events [][]byte
count := mathrand.Intn(20)
for i := 0; i < count; i++ {
data, err := json.Marshal(s.generateEvent())
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
events = append(events, data)
}
w.WriteHeader(http.StatusOK)
for _, d := range events {
fmt.Fprintln(w, d)
time.Sleep(time.Duration(mathrand.Intn(200)) * time.Millisecond)
}
}
func (s *DockerServer) pingDocker(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
func (s *DockerServer) generateEvent() *docker.APIEvents {
var eventType string
switch mathrand.Intn(4) {
case 0:
eventType = "create"
case 1:
eventType = "start"
case 2:
eventType = "stop"
case 3:
eventType = "destroy"
}
return &docker.APIEvents{
ID: s.generateID(),
Status: eventType,
From: "mybase:latest",
Time: time.Now().Unix(),
}
}
func (s *DockerServer) loadImage(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
func (s *DockerServer) getImage(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/tar")
}
func (s *DockerServer) createExecContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
container, _, err := s.findContainer(id)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
}
exec := docker.ExecInspect{
ID: s.generateID(),
Container: *container,
}
var params docker.CreateExecOptions
err = json.NewDecoder(r.Body).Decode(¶ms)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if len(params.Cmd) > 0 {
exec.ProcessConfig.EntryPoint = params.Cmd[0]
if len(params.Cmd) > 1 {
exec.ProcessConfig.Arguments = params.Cmd[1:]
}
}
s.execMut.Lock()
s.execs = append(s.execs, &exec)
s.execMut.Unlock()
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{"Id": exec.ID})
}
func (s *DockerServer) startExecContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
if exec, err := s.getExec(id); err == nil {
s.execMut.Lock()
exec.Running = true
s.execMut.Unlock()
if callback, ok := s.execCallbacks[id]; ok {
callback()
delete(s.execCallbacks, id)
} else if callback, ok := s.execCallbacks["*"]; ok {
callback()
delete(s.execCallbacks, "*")
}
s.execMut.Lock()
exec.Running = false
s.execMut.Unlock()
w.WriteHeader(http.StatusOK)
return
}
w.WriteHeader(http.StatusNotFound)
}
func (s *DockerServer) resizeExecContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
if _, err := s.getExec(id); err == nil {
w.WriteHeader(http.StatusOK)
return
}
w.WriteHeader(http.StatusNotFound)
}
func (s *DockerServer) inspectExecContainer(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"]
if exec, err := s.getExec(id); err == nil {
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(exec)
return
}
w.WriteHeader(http.StatusNotFound)
}
func (s *DockerServer) getExec(id string) (*docker.ExecInspect, error) {
s.execMut.RLock()
defer s.execMut.RUnlock()
for _, exec := range s.execs {
if exec.ID == id {
return exec, nil
}
}
return nil, errors.New("exec not found")
}
| wantedly/risu | Godeps/_workspace/src/github.com/fsouza/go-dockerclient/testing/server.go | GO | mit | 29,130 |
<?php
/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_FirebaseRulesAPI_Ruleset extends Google_Model
{
public $createTime;
public $name;
protected $sourceType = 'Google_Service_FirebaseRulesAPI_Source';
protected $sourceDataType = '';
public function setCreateTime($createTime)
{
$this->createTime = $createTime;
}
public function getCreateTime()
{
return $this->createTime;
}
public function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
public function setSource(Google_Service_FirebaseRulesAPI_Source $source)
{
$this->source = $source;
}
public function getSource()
{
return $this->source;
}
}
| vickz84259/coursework | scripts/google-api-php-client-2.1.3/vendor/google/apiclient-services/src/Google/Service/FirebaseRulesAPI/Ruleset.php | PHP | mit | 1,275 |
using System;
using System.Collections.Generic;
using Umbraco.Core.Models;
using umbraco.BusinessLogic;
using Umbraco.Core;
namespace umbraco.cms.businesslogic.media
{
[Obsolete("This interface is no longer used and will be removed from the codebase in future versions")]
public class UmbracoImageMediaFactory : UmbracoMediaFactory
{
public override string MediaTypeAlias
{
get { return Constants.Conventions.MediaTypes.Image; }
}
public override List<string> Extensions
{
get { return new List<string> { "jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif" }; }
}
public override void DoHandleMedia(Media media, PostedMediaFile postedFile, User user)
{
// Set media property to upload the file as well as set all related properties
media.MediaItem.SetValue(Constants.Conventions.Media.File, postedFile.FileName, postedFile.InputStream);
// Copy back the values from the internal IMedia to ensure that the values are persisted when saved
foreach (var property in media.MediaItem.Properties)
{
media.getProperty(property.Alias).Value = property.Value;
}
// Save media (using legacy media object to ensure the usage of the legacy events).
media.Save();
}
}
}
| marcemarc/Umbraco-CMS | src/umbraco.cms/businesslogic/media/UmbracoImageMediaFactory.cs | C# | mit | 1,423 |
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Twig_Tests_Node_MacroTest extends Twig_Test_NodeTestCase
{
public function testConstructor()
{
$body = new Twig_Node_Text('foo', 1);
$arguments = new Twig_Node(array(new Twig_Node_Expression_Name('foo', 1)), array(), 1);
$node = new Twig_Node_Macro('foo', $body, $arguments, 1);
$this->assertEquals($body, $node->getNode('body'));
$this->assertEquals($arguments, $node->getNode('arguments'));
$this->assertEquals('foo', $node->getAttribute('name'));
}
public function getTests()
{
$body = new Twig_Node_Text('foo', 1);
$arguments = new Twig_Node(array(
'foo' => new Twig_Node_Expression_Constant(null, 1),
'bar' => new Twig_Node_Expression_Constant('Foo', 1),
), array(), 1);
$node = new Twig_Node_Macro('foo', $body, $arguments, 1);
return array(
array($node, <<<EOF
// line 1
public function macro_foo(\$__foo__ = null, \$__bar__ = "Foo", ...\$__varargs__)
{
\$context = \$this->env->mergeGlobals(array(
"foo" => \$__foo__,
"bar" => \$__bar__,
"varargs" => \$__varargs__,
));
\$blocks = array();
ob_start();
try {
echo "foo";
return ('' === \$tmp = ob_get_contents()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset());
} finally {
ob_end_clean();
}
}
EOF
),
);
}
}
| agusbussi03/elecciones | vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php | PHP | mit | 1,632 |
<?php
/**
* BaconQrCode
*
* @link http://github.com/Bacon/BaconQrCode For the canonical source repository
* @copyright 2013 Ben 'DASPRiD' Scholzen
* @license http://opensource.org/licenses/BSD-2-Clause Simplified BSD License
*/
namespace BaconQrCode\Common;
use BaconQrCode\Exception;
use SplFixedArray;
/**
* Reed-Solomon codec for 8-bit characters.
*
* Based on libfec by Phil Karn, KA9Q.
*/
class ReedSolomonCodec
{
/**
* Symbol size in bits.
*
* @var integer
*/
protected $symbolSize;
/**
* Block size in symbols.
*
* @var integer
*/
protected $blockSize;
/**
* First root of RS code generator polynomial, index form.
*
* @var integer
*/
protected $firstRoot;
/**
* Primitive element to generate polynomial roots, index form.
*
* @var integer
*/
protected $primitive;
/**
* Prim-th root of 1, index form.
*
* @var integer
*/
protected $iPrimitive;
/**
* RS code generator polynomial degree (number of roots).
*
* @var integer
*/
protected $numRoots;
/**
* Padding bytes at front of shortened block.
*
* @var integer
*/
protected $padding;
/**
* Log lookup table.
*
* @var SplFixedArray
*/
protected $alphaTo;
/**
* Anti-Log lookup table.
*
* @var SplFixedArray
*/
protected $indexOf;
/**
* Generator polynomial.
*
* @var SplFixedArray
*/
protected $generatorPoly;
/**
* Creates a new reed solomon instance.
*
* @param integer $symbolSize
* @param integer $gfPoly
* @param integer $firstRoot
* @param integer $primitive
* @param integer $numRoots
* @param integer $padding
* @throws Exception\InvalidArgumentException
* @throws Exception\RuntimeException
*/
public function __construct($symbolSize, $gfPoly, $firstRoot, $primitive, $numRoots, $padding)
{
if ($symbolSize < 0 || $symbolSize > 8) {
throw new Exception\InvalidArgumentException('Symbol size must be between 0 and 8');
}
if ($firstRoot < 0 || $firstRoot >= (1 << $symbolSize)) {
throw new Exception\InvalidArgumentException('First root must be between 0 and ' . (1 << $symbolSize));
}
if ($numRoots < 0 || $numRoots >= (1 << $symbolSize)) {
throw new Exception\InvalidArgumentException('Num roots must be between 0 and ' . (1 << $symbolSize));
}
if ($padding < 0 || $padding >= ((1 << $symbolSize) - 1 - $numRoots)) {
throw new Exception\InvalidArgumentException('Padding must be between 0 and ' . ((1 << $symbolSize) - 1 - $numRoots));
}
$this->symbolSize = $symbolSize;
$this->blockSize = (1 << $symbolSize) - 1;
$this->padding = $padding;
$this->alphaTo = SplFixedArray::fromArray(array_fill(0, $this->blockSize + 1, 0), false);
$this->indexOf = SplFixedArray::fromArray(array_fill(0, $this->blockSize + 1, 0), false);
// Generate galous field lookup table
$this->indexOf[0] = $this->blockSize;
$this->alphaTo[$this->blockSize] = 0;
$sr = 1;
for ($i = 0; $i < $this->blockSize; $i++) {
$this->indexOf[$sr] = $i;
$this->alphaTo[$i] = $sr;
$sr <<= 1;
if ($sr & (1 << $symbolSize)) {
$sr ^= $gfPoly;
}
$sr &= $this->blockSize;
}
if ($sr !== 1) {
throw new Exception\RuntimeException('Field generator polynomial is not primitive');
}
// Form RS code generator polynomial from its roots
$this->generatorPoly = SplFixedArray::fromArray(array_fill(0, $numRoots + 1, 0), false);
$this->firstRoot = $firstRoot;
$this->primitive = $primitive;
$this->numRoots = $numRoots;
// Find prim-th root of 1, used in decoding
for ($iPrimitive = 1; ($iPrimitive % $primitive) !== 0; $iPrimitive += $this->blockSize);
$this->iPrimitive = intval($iPrimitive / $primitive);
$this->generatorPoly[0] = 1;
for ($i = 0, $root = $firstRoot * $primitive; $i < $numRoots; $i++, $root += $primitive) {
$this->generatorPoly[$i + 1] = 1;
for ($j = $i; $j > 0; $j--) {
if ($this->generatorPoly[$j] !== 0) {
$this->generatorPoly[$j] = $this->generatorPoly[$j - 1] ^ $this->alphaTo[$this->modNn($this->indexOf[$this->generatorPoly[$j]] + $root)];
} else {
$this->generatorPoly[$j] = $this->generatorPoly[$j - 1];
}
}
$this->generatorPoly[$j] = $this->alphaTo[$this->modNn($this->indexOf[$this->generatorPoly[0]] + $root)];
}
// Convert generator poly to index form for quicker encoding
for ($i = 0; $i <= $numRoots; $i++) {
$this->generatorPoly[$i] = $this->indexOf[$this->generatorPoly[$i]];
}
}
/**
* Encodes data and writes result back into parity array.
*
* @param SplFixedArray $data
* @param SplFixedArray $parity
* @return void
*/
public function encode(SplFixedArray $data, SplFixedArray $parity)
{
for ($i = 0; $i < $this->numRoots; $i++) {
$parity[$i] = 0;
}
$iterations = $this->blockSize - $this->numRoots - $this->padding;
for ($i = 0; $i < $iterations; $i++) {
$feedback = $this->indexOf[$data[$i] ^ $parity[0]];
if ($feedback !== $this->blockSize) {
// Feedback term is non-zero
$feedback = $this->modNn($this->blockSize - $this->generatorPoly[$this->numRoots] + $feedback);
for ($j = 1; $j < $this->numRoots; $j++) {
$parity[$j] = $parity[$j] ^ $this->alphaTo[$this->modNn($feedback + $this->generatorPoly[$this->numRoots - $j])];
}
}
for ($j = 0; $j < $this->numRoots - 1; $j++) {
$parity[$j] = $parity[$j + 1];
}
if ($feedback !== $this->blockSize) {
$parity[$this->numRoots - 1] = $this->alphaTo[$this->modNn($feedback + $this->generatorPoly[0])];
} else {
$parity[$this->numRoots - 1] = 0;
}
}
}
/**
* Decodes received data.
*
* @param SplFixedArray $data
* @param SplFixedArray|null $erasures
* @return null|integer
*/
public function decode(SplFixedArray $data, SplFixedArray $erasures = null)
{
// This speeds up the initialization a bit.
$numRootsPlusOne = SplFixedArray::fromArray(array_fill(0, $this->numRoots + 1, 0), false);
$numRoots = SplFixedArray::fromArray(array_fill(0, $this->numRoots, 0), false);
$lambda = clone $numRootsPlusOne;
$b = clone $numRootsPlusOne;
$t = clone $numRootsPlusOne;
$omega = clone $numRootsPlusOne;
$root = clone $numRoots;
$loc = clone $numRoots;
$numErasures = ($erasures !== null ? count($erasures) : 0);
// Form the Syndromes; i.e., evaluate data(x) at roots of g(x)
$syndromes = SplFixedArray::fromArray(array_fill(0, $this->numRoots, $data[0]), false);
for ($i = 1; $i < $this->blockSize - $this->padding; $i++) {
for ($j = 0; $j < $this->numRoots; $j++) {
if ($syndromes[$j] === 0) {
$syndromes[$j] = $data[$i];
} else {
$syndromes[$j] = $data[$i] ^ $this->alphaTo[
$this->modNn($this->indexOf[$syndromes[$j]] + ($this->firstRoot + $j) * $this->primitive)
];
}
}
}
// Convert syndromes to index form, checking for nonzero conditions
$syndromeError = 0;
for ($i = 0; $i < $this->numRoots; $i++) {
$syndromeError |= $syndromes[$i];
$syndromes[$i] = $this->indexOf[$syndromes[$i]];
}
if (!$syndromeError) {
// If syndrome is zero, data[] is a codeword and there are no errors
// to correct, so return data[] unmodified.
return 0;
}
$lambda[0] = 1;
if ($numErasures > 0) {
// Init lambda to be the erasure locator polynomial
$lambda[1] = $this->alphaTo[$this->modNn($this->primitive * ($this->blockSize - 1 - $erasures[0]))];
for ($i = 1; $i < $numErasures; $i++) {
$u = $this->modNn($this->primitive * ($this->blockSize - 1 - $erasures[$i]));
for ($j = $i + 1; $j > 0; $j--) {
$tmp = $this->indexOf[$lambda[$j - 1]];
if ($tmp !== $this->blockSize) {
$lambda[$j] = $lambda[$j] ^ $this->alphaTo[$this->modNn($u + $tmp)];
}
}
}
}
for ($i = 0; $i <= $this->numRoots; $i++) {
$b[$i] = $this->indexOf[$lambda[$i]];
}
// Begin Berlekamp-Massey algorithm to determine error+erasure locator
// polynomial
$r = $numErasures;
$el = $numErasures;
while (++$r <= $this->numRoots) {
// Compute discrepancy at the r-th step in poly form
$discrepancyR = 0;
for ($i = 0; $i < $r; $i++) {
if ($lambda[$i] !== 0 && $syndromes[$r - $i - 1] !== $this->blockSize) {
$discrepancyR ^= $this->alphaTo[$this->modNn($this->indexOf[$lambda[$i]] + $syndromes[$r - $i - 1])];
}
}
$discrepancyR = $this->indexOf[$discrepancyR];
if ($discrepancyR === $this->blockSize) {
$tmp = $b->toArray();
array_unshift($tmp, $this->blockSize);
array_pop($tmp);
$b = SplFixedArray::fromArray($tmp, false);
} else {
$t[0] = $lambda[0];
for ($i = 0; $i < $this->numRoots; $i++) {
if ($b[$i] !== $this->blockSize) {
$t[$i + 1] = $lambda[$i + 1] ^ $this->alphaTo[$this->modNn($discrepancyR + $b[$i])];
} else {
$t[$i + 1] = $lambda[$i + 1];
}
}
if (2 * $el <= $r + $numErasures - 1) {
$el = $r + $numErasures - $el;
for ($i = 0; $i <= $this->numRoots; $i++) {
$b[$i] = (
$lambda[$i] === 0
? $this->blockSize
: $this->modNn($this->indexOf[$lambda[$i]] - $discrepancyR + $this->blockSize)
);
}
} else {
$tmp = $b->toArray();
array_unshift($tmp, $this->blockSize);
array_pop($tmp);
$b = SplFixedArray::fromArray($tmp, false);
}
$lambda = clone $t;
}
}
// Convert lambda to index form and compute deg(lambda(x))
$degLambda = 0;
for ($i = 0; $i <= $this->numRoots; $i++) {
$lambda[$i] = $this->indexOf[$lambda[$i]];
if ($lambda[$i] !== $this->blockSize) {
$degLambda = $i;
}
}
// Find roots of the error+erasure locator polynomial by Chien search.
$reg = clone $lambda;
$reg[0] = 0;
$count = 0;
for ($i = 1, $k = $this->iPrimitive - 1; $i <= $this->blockSize; $i++, $k = $this->modNn($k + $this->iPrimitive)) {
$q = 1;
for ($j = $degLambda; $j > 0; $j--) {
if ($reg[$j] !== $this->blockSize) {
$reg[$j] = $this->modNn($reg[$j] + $j);
$q ^= $this->alphaTo[$reg[$j]];
}
}
if ($q !== 0) {
// Not a root
continue;
}
// Store root (index-form) and error location number
$root[$count] = $i;
$loc[$count] = $k;
if (++$count === $degLambda) {
break;
}
}
if ($degLambda !== $count) {
// deg(lambda) unequal to number of roots: uncorreactable error
// detected
return null;
}
// Compute err+eras evaluate poly omega(x) = s(x)*lambda(x) (modulo
// x**numRoots). In index form. Also find deg(omega).
$degOmega = $degLambda - 1;
for ($i = 0; $i <= $degOmega; $i++) {
$tmp = 0;
for ($j = $i; $j >= 0; $j--) {
if ($syndromes[$i - $j] !== $this->blockSize && $lambda[$j] !== $this->blockSize) {
$tmp ^= $this->alphaTo[$this->modNn($syndromes[$i - $j] + $lambda[$j])];
}
}
$omega[$i] = $this->indexOf[$tmp];
}
// Compute error values in poly-form. num1 = omega(inv(X(l))), num2 =
// inv(X(l))**(firstRoot-1) and den = lambda_pr(inv(X(l))) all in poly
// form.
for ($j = $count - 1; $j >= 0; $j--) {
$num1 = 0;
for ($i = $degOmega; $i >= 0; $i--) {
if ($omega[$i] !== $this->blockSize) {
$num1 ^= $this->alphaTo[$this->modNn($omega[$i] + $i * $root[$j])];
}
}
$num2 = $this->alphaTo[$this->modNn($root[$j] * ($this->firstRoot - 1) + $this->blockSize)];
$den = 0;
// lambda[i+1] for i even is the formal derivativelambda_pr of
// lambda[i]
for ($i = min($degLambda, $this->numRoots - 1) & ~1; $i >= 0; $i -= 2) {
if ($lambda[$i + 1] !== $this->blockSize) {
$den ^= $this->alphaTo[$this->modNn($lambda[$i + 1] + $i * $root[$j])];
}
}
// Apply error to data
if ($num1 !== 0 && $loc[$j] >= $this->padding) {
$data[$loc[$j] - $this->padding] = $data[$loc[$j] - $this->padding] ^ (
$this->alphaTo[
$this->modNn(
$this->indexOf[$num1] + $this->indexOf[$num2] + $this->blockSize - $this->indexOf[$den]
)
]
);
}
}
if ($erasures !== null) {
if (count($erasures) < $count) {
$erasures->setSize($count);
}
for ($i = 0; $i < $count; $i++) {
$erasures[$i] = $loc[$i];
}
}
return $count;
}
/**
* Computes $x % GF_SIZE, where GF_SIZE is 2**GF_BITS - 1, without a slow
* divide.
*
* @param itneger $x
* @return integer
*/
protected function modNn($x)
{
while ($x >= $this->blockSize) {
$x -= $this->blockSize;
$x = ($x >> $this->symbolSize) + ($x & $this->blockSize);
}
return $x;
}
}
| elixirlabsinc/next-gen | user/plugins/admin/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/ReedSolomonCodec.php | PHP | mit | 15,362 |
/*
===========================================================================
Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
Doom 3 Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "../../idlib/precompiled.h"
#pragma hdrstop
#include "qe3.h"
#include "Radiant.h"
#include "PropertyList.h"
#include "../comafx/DialogColorPicker.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPropertyList
CPropertyList::CPropertyList() {
measureItem = NULL;
updateInspectors = false;
}
CPropertyList::~CPropertyList() {
}
BEGIN_MESSAGE_MAP(CPropertyList, CListBox)
//{{AFX_MSG_MAP(CPropertyList)
ON_WM_CREATE()
ON_CONTROL_REFLECT(LBN_SELCHANGE, OnSelchange)
ON_WM_LBUTTONUP()
ON_WM_KILLFOCUS()
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
ON_CBN_CLOSEUP(IDC_PROPCMBBOX, OnKillfocusCmbBox)
ON_CBN_SELCHANGE(IDC_PROPCMBBOX, OnSelchangeCmbBox)
ON_EN_KILLFOCUS(IDC_PROPEDITBOX, OnKillfocusEditBox)
ON_EN_CHANGE(IDC_PROPEDITBOX, OnChangeEditBox)
ON_BN_CLICKED(IDC_PROPBTNCTRL, OnButton)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPropertyList message handlers
BOOL CPropertyList::PreCreateWindow(CREATESTRUCT& cs) {
if (!CListBox::PreCreateWindow(cs)) {
return FALSE;
}
cs.style &= ~(LBS_OWNERDRAWVARIABLE | LBS_SORT);
cs.style |= LBS_OWNERDRAWFIXED;
m_bTracking = FALSE;
m_nDivider = 0;
m_bDivIsSet = FALSE;
return TRUE;
}
void CPropertyList::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) {
if (measureItem && !measureItem->m_curValue.IsEmpty()) {
CRect rect;
GetClientRect(rect);
if (m_nDivider==0) {
m_nDivider = rect.Width() / 2;
}
rect.left = m_nDivider;
CDC * dc = GetDC();
dc->DrawText(measureItem->m_curValue, rect, DT_CALCRECT | DT_LEFT | DT_WORDBREAK);
ReleaseDC(dc);
lpMeasureItemStruct->itemHeight = (rect.Height() >= 20) ? rect.Height() : 20; //pixels
} else {
lpMeasureItemStruct->itemHeight = 20; //pixels
}
}
void CPropertyList::DrawItem(LPDRAWITEMSTRUCT lpDIS) {
CDC dc;
dc.Attach(lpDIS->hDC);
CRect rectFull = lpDIS->rcItem;
CRect rect = rectFull;
if (m_nDivider==0) {
m_nDivider = rect.Width() / 2;
}
rect.left = m_nDivider;
CRect rect2 = rectFull;
rect2.right = rect.left - 1;
UINT nIndex = lpDIS->itemID;
if (nIndex != (UINT) -1) {
//get the CPropertyItem for the current row
CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(nIndex);
//draw two rectangles, one for each row column
if (pItem->m_nItemType == PIT_VAR) {
dc.FillSolidRect(rect2,RGB(220,220,220));
} else {
dc.FillSolidRect(rect2,RGB(192,192,192));
}
dc.DrawEdge(rect2,EDGE_SUNKEN,BF_BOTTOMRIGHT);
dc.DrawEdge(rect,EDGE_SUNKEN,BF_BOTTOM);
if (lpDIS->itemState == ODS_SELECTED) {
dc.DrawFocusRect(rect2);
}
//write the property name in the first rectangle
dc.SetBkMode(TRANSPARENT);
dc.DrawText(pItem->m_propName,CRect(rect2.left+3,rect2.top+3,
rect2.right-3,rect2.bottom+3),
DT_LEFT | DT_SINGLELINE);
//write the initial property value in the second rectangle
dc.DrawText(pItem->m_curValue,CRect(rect.left+3,rect.top+3, rect.right+3,rect.bottom+3), DT_LEFT | (pItem->m_nItemType == PIT_VAR) ? DT_WORDBREAK : DT_SINGLELINE);
}
dc.Detach();
}
int CPropertyList::AddItem(CString txt) {
measureItem = NULL;
int nIndex = AddString(txt);
return nIndex;
}
int CPropertyList::AddPropItem(CPropertyItem* pItem) {
if (pItem->m_nItemType == PIT_VAR) {
measureItem = pItem;
} else {
measureItem = NULL;
}
int nIndex = AddString(_T(""));
measureItem = NULL;
SetItemDataPtr(nIndex,pItem);
return nIndex;
}
int CPropertyList::OnCreate(LPCREATESTRUCT lpCreateStruct) {
if (CListBox::OnCreate(lpCreateStruct) == -1) {
return -1;
}
m_bDivIsSet = FALSE;
m_nDivider = 0;
m_bTracking = FALSE;
m_hCursorSize = AfxGetApp()->LoadStandardCursor(IDC_SIZEWE);
m_hCursorArrow = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
m_SSerif8Font.CreatePointFont(80,_T("MS Sans Serif"));
return 0;
}
void CPropertyList::OnSelchange() {
CRect rect;
CString lBoxSelText;
static int recurse = 0;
//m_curSel = GetCurSel();
GetItemRect(m_curSel,rect);
rect.left = m_nDivider;
CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
if (updateInspectors) {
g_Inspectors->entityDlg.SetKeyVal(pItem->m_propName, pItem->m_curValue);
}
if (m_btnCtrl) {
m_btnCtrl.ShowWindow(SW_HIDE);
}
if (pItem->m_nItemType==PIT_COMBO) {
//display the combo box. If the combo box has already been
//created then simply move it to the new location, else create it
m_nLastBox = 0;
if (m_cmbBox) {
m_cmbBox.MoveWindow(rect);
} else {
rect.bottom += 300;
m_cmbBox.Create(CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_CHILD | WS_BORDER,rect,this,IDC_PROPCMBBOX);
m_cmbBox.SetFont(&m_SSerif8Font);
}
//add the choices for this particular property
CString cmbItems = pItem->m_cmbItems;
lBoxSelText = pItem->m_curValue;
m_cmbBox.ResetContent();
m_cmbBox.AddString("");
int i,i2;
i=0;
while ((i2=cmbItems.Find('|',i)) != -1) {
m_cmbBox.AddString(cmbItems.Mid(i,i2-i));
i=i2+1;
}
m_cmbBox.ShowWindow(SW_SHOW);
//m_cmbBox.SetFocus();
//jump to the property's current value in the combo box
int j = m_cmbBox.FindStringExact(0,lBoxSelText);
if (j != CB_ERR) {
m_cmbBox.SetCurSel(j);
} else {
m_cmbBox.SetCurSel(0);
}
//m_cmbBox.ShowDropDown();
}
else if (pItem->m_nItemType==PIT_EDIT) {
//display edit box
m_nLastBox = 1;
m_prevSel = m_curSel;
rect.bottom -= 3;
if (m_editBox) {
m_editBox.MoveWindow(rect);
} else {
m_editBox.Create(ES_LEFT | ES_AUTOHSCROLL | WS_VISIBLE | WS_CHILD | WS_BORDER,rect,this,IDC_PROPEDITBOX);
m_editBox.SetFont(&m_SSerif8Font);
}
lBoxSelText = pItem->m_curValue;
m_editBox.ShowWindow(SW_SHOW);
m_editBox.SetFocus();
//set the text in the edit box to the property's current value
bool b = updateInspectors;
updateInspectors = false;
m_editBox.SetWindowText(lBoxSelText);
updateInspectors = b;
} else if (pItem->m_nItemType != PIT_VAR) {
DisplayButton(rect);
}
}
void CPropertyList::DisplayButton(CRect region) {
//displays a button if the property is a file/color/font chooser
m_nLastBox = 2;
m_prevSel = m_curSel;
if (region.Width() > 25) {
region.left = region.right - 25;
}
region.bottom -= 3;
if (m_btnCtrl) {
m_btnCtrl.MoveWindow(region);
} else {
m_btnCtrl.Create("...",BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD,region,this,IDC_PROPBTNCTRL);
m_btnCtrl.SetFont(&m_SSerif8Font);
}
m_btnCtrl.ShowWindow(SW_SHOW);
m_btnCtrl.SetFocus();
}
void CPropertyList::ResetContent() {
if (m_btnCtrl.GetSafeHwnd()) {
m_btnCtrl.ShowWindow(SW_HIDE);
}
int c = this->GetCount();
for (int i = 0; i < c; i++) {
CPropertyItem *pi = reinterpret_cast<CPropertyItem*>(GetItemDataPtr(i));
if (pi) {
delete pi;
}
}
CListBox::ResetContent();
}
void CPropertyList::OnKillFocus(CWnd* pNewWnd) {
//m_btnCtrl.ShowWindow(SW_HIDE);
CListBox::OnKillFocus(pNewWnd);
}
void CPropertyList::OnKillfocusCmbBox() {
m_cmbBox.ShowWindow(SW_HIDE);
Invalidate();
}
void CPropertyList::OnKillfocusEditBox() {
CString newStr;
m_editBox.ShowWindow(SW_HIDE);
Invalidate();
}
void CPropertyList::OnSelchangeCmbBox() {
CString selStr;
if (m_cmbBox) {
m_cmbBox.GetLBText(m_cmbBox.GetCurSel(),selStr);
CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
pItem->m_curValue = selStr;
if (updateInspectors) {
g_Inspectors->entityDlg.UpdateFromListBox();
}
}
}
void CPropertyList::OnChangeEditBox() {
CString newStr;
m_editBox.GetWindowText(newStr);
CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
pItem->m_curValue = newStr;
}
void CPropertyList::OnButton() {
CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
//display the appropriate common dialog depending on what type
//of chooser is associated with the property
if (pItem->m_nItemType == PIT_COLOR) {
idVec3 color;
sscanf(pItem->m_curValue, "%f %f %f", &color.x, &color.y, &color.z);
COLORREF cr = (int)(color.x * 255) + (((int)(color.y * 255))<<8) + (((int)(color.z * 255))<<16);
CDialogColorPicker dlg(cr);
dlg.UpdateParent = UpdateRadiantColor;
if (dlg.DoModal() == IDOK) {
color.x = (dlg.GetColor() & 255)/255.0;
color.y = ((dlg.GetColor() >> 8)&255)/255.0;
color.z = ((dlg.GetColor() >> 16)&255)/255.0;
pItem->m_curValue = color.ToString(4);
}
if (updateInspectors) {
g_Inspectors->entityDlg.UpdateFromListBox();
}
m_btnCtrl.ShowWindow(SW_HIDE);
Invalidate();
} else if (pItem->m_nItemType == PIT_FILE) {
CString SelectedFile;
CString Filter("Gif Files (*.gif)|*.gif||");
CFileDialog FileDlg(TRUE, NULL, NULL, NULL, Filter);
CString currPath = pItem->m_curValue;
FileDlg.m_ofn.lpstrTitle = "Select file";
if (currPath.GetLength() > 0) {
FileDlg.m_ofn.lpstrInitialDir = currPath.Left(currPath.GetLength() - currPath.ReverseFind('\\'));
}
if(IDOK == FileDlg.DoModal()) {
SelectedFile = FileDlg.GetPathName();
m_btnCtrl.ShowWindow(SW_HIDE);
pItem->m_curValue = SelectedFile;
Invalidate();
}
} else if (pItem->m_nItemType == PIT_FONT) {
CFontDialog FontDlg(NULL,CF_EFFECTS | CF_SCREENFONTS,NULL,this);
if(IDOK == FontDlg.DoModal()) {
CString faceName = FontDlg.GetFaceName();
m_btnCtrl.ShowWindow(SW_HIDE);
pItem->m_curValue = faceName;
Invalidate();
}
} else if (pItem->m_nItemType == PIT_MODEL) {
CPreviewDlg *dlg = CEntityDlg::ShowModelChooser();
if (dlg->returnCode == IDOK) {
pItem->m_curValue = dlg->mediaName;
m_btnCtrl.ShowWindow(SW_HIDE);
if (updateInspectors) {
g_Inspectors->entityDlg.UpdateFromListBox();
}
Invalidate();
}
} else if (pItem->m_nItemType == PIT_GUI) {
CPreviewDlg *dlg = CEntityDlg::ShowGuiChooser();
if (dlg->returnCode == IDOK) {
pItem->m_curValue = dlg->mediaName;
m_btnCtrl.ShowWindow(SW_HIDE);
if (updateInspectors) {
g_Inspectors->entityDlg.UpdateFromListBox();
}
Invalidate();
}
} else if (pItem->m_nItemType == PIT_MATERIAL) {
CPreviewDlg *dlg = CEntityDlg::ShowMaterialChooser();
if (dlg->returnCode == IDOK) {
pItem->m_curValue = dlg->mediaName;
m_btnCtrl.ShowWindow(SW_HIDE);
if (updateInspectors) {
g_Inspectors->entityDlg.UpdateFromListBox();
}
Invalidate();
}
}
}
void CPropertyList::OnLButtonUp(UINT nFlags, CPoint point) {
if (m_bTracking) {
//if columns were being resized then this indicates
//that mouse is up so resizing is done. Need to redraw
//columns to reflect their new widths.
m_bTracking = FALSE;
//if mouse was captured then release it
if (GetCapture()==this) {
::ReleaseCapture();
}
::ClipCursor(NULL);
CClientDC dc(this);
InvertLine(&dc,CPoint(point.x,m_nDivTop),CPoint(point.x,m_nDivBtm));
//set the divider position to the new value
m_nDivider = point.x;
//redraw
Invalidate();
} else {
BOOL loc;
int i = ItemFromPoint(point,loc);
m_curSel = i;
CListBox::OnLButtonUp(nFlags, point);
}
}
void CPropertyList::OnLButtonDown(UINT nFlags, CPoint point) {
if ((point.x>=m_nDivider-5) && (point.x<=m_nDivider+5)) {
//if mouse clicked on divider line, then start resizing
::SetCursor(m_hCursorSize);
CRect windowRect;
GetWindowRect(windowRect);
windowRect.left += 10; windowRect.right -= 10;
//do not let mouse leave the list box boundary
::ClipCursor(windowRect);
if (m_cmbBox) {
m_cmbBox.ShowWindow(SW_HIDE);
}
if (m_editBox) {
m_editBox.ShowWindow(SW_HIDE);
}
CRect clientRect;
GetClientRect(clientRect);
m_bTracking = TRUE;
m_nDivTop = clientRect.top;
m_nDivBtm = clientRect.bottom;
m_nOldDivX = point.x;
CClientDC dc(this);
InvertLine(&dc,CPoint(m_nOldDivX,m_nDivTop),CPoint(m_nOldDivX,m_nDivBtm));
//capture the mouse
SetCapture();
} else {
m_bTracking = FALSE;
CListBox::OnLButtonDown(nFlags, point);
}
}
void CPropertyList::OnMouseMove(UINT nFlags, CPoint point) {
if (m_bTracking) {
//move divider line to the mouse pos. if columns are
//currently being resized
CClientDC dc(this);
//remove old divider line
InvertLine(&dc,CPoint(m_nOldDivX,m_nDivTop),CPoint(m_nOldDivX,m_nDivBtm));
//draw new divider line
InvertLine(&dc,CPoint(point.x,m_nDivTop),CPoint(point.x,m_nDivBtm));
m_nOldDivX = point.x;
} else if ((point.x >= m_nDivider-5) && (point.x <= m_nDivider+5)) {
//set the cursor to a sizing cursor if the cursor is over the row divider
::SetCursor(m_hCursorSize);
} else {
CListBox::OnMouseMove(nFlags, point);
}
}
void CPropertyList::InvertLine(CDC* pDC,CPoint ptFrom,CPoint ptTo) {
int nOldMode = pDC->SetROP2(R2_NOT);
pDC->MoveTo(ptFrom);
pDC->LineTo(ptTo);
pDC->SetROP2(nOldMode);
}
void CPropertyList::PreSubclassWindow() {
m_bDivIsSet = FALSE;
m_nDivider = 0;
m_bTracking = FALSE;
m_curSel = 1;
m_hCursorSize = AfxGetApp()->LoadStandardCursor(IDC_SIZEWE);
m_hCursorArrow = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
m_SSerif8Font.CreatePointFont(80,_T("MS Sans Serif"));
}
void CPropertyList::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) {
if (m_cmbBox) {
m_cmbBox.ShowWindow(SW_HIDE);
}
if (m_editBox) {
m_editBox.ShowWindow(SW_HIDE);
}
if (m_btnCtrl) {
m_btnCtrl.ShowWindow(SW_HIDE);
}
Invalidate();
CListBox::OnVScroll(nSBCode, nPos, pScrollBar);
}
| Grimace1975/bclcontrib-scriptsharp | ref.neo/tools/radiant/PropertyList.cpp | C++ | mit | 14,825 |
/**!
* AngularJS file upload/drop directive and service with progress and abort
* FileAPI Flash shim for old browsers not supporting FormData
* @author Danial <danial.farid@gmail.com>
* @version 2.2.2
*/
(function() {
var hasFlash = function() {
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if (fo) return true;
} catch(e) {
if (navigator.mimeTypes['application/x-shockwave-flash'] != undefined) return true;
}
return false;
}
function patchXHR(fnName, newFn) {
window.XMLHttpRequest.prototype[fnName] = newFn(window.XMLHttpRequest.prototype[fnName]);
};
if ((window.XMLHttpRequest && !window.FormData) || (window.FileAPI && FileAPI.forceLoad)) {
var initializeUploadListener = function(xhr) {
if (!xhr.__listeners) {
if (!xhr.upload) xhr.upload = {};
xhr.__listeners = [];
var origAddEventListener = xhr.upload.addEventListener;
xhr.upload.addEventListener = function(t, fn, b) {
xhr.__listeners[t] = fn;
origAddEventListener && origAddEventListener.apply(this, arguments);
};
}
}
patchXHR('open', function(orig) {
return function(m, url, b) {
initializeUploadListener(this);
this.__url = url;
try {
orig.apply(this, [m, url, b]);
} catch (e) {
if (e.message.indexOf('Access is denied') > -1) {
orig.apply(this, [m, '_fix_for_ie_crossdomain__', b]);
}
}
}
});
patchXHR('getResponseHeader', function(orig) {
return function(h) {
return this.__fileApiXHR && this.__fileApiXHR.getResponseHeader ? this.__fileApiXHR.getResponseHeader(h) : (orig == null ? null : orig.apply(this, [h]));
};
});
patchXHR('getAllResponseHeaders', function(orig) {
return function() {
return this.__fileApiXHR && this.__fileApiXHR.getAllResponseHeaders ? this.__fileApiXHR.getAllResponseHeaders() : (orig == null ? null : orig.apply(this));
}
});
patchXHR('abort', function(orig) {
return function() {
return this.__fileApiXHR && this.__fileApiXHR.abort ? this.__fileApiXHR.abort() : (orig == null ? null : orig.apply(this));
}
});
patchXHR('setRequestHeader', function(orig) {
return function(header, value) {
if (header === '__setXHR_') {
initializeUploadListener(this);
var val = value(this);
// fix for angular < 1.2.0
if (val instanceof Function) {
val(this);
}
} else {
this.__requestHeaders = this.__requestHeaders || {};
this.__requestHeaders[header] = value;
orig.apply(this, arguments);
}
}
});
function redefineProp(xhr, prop, fn) {
try {
Object.defineProperty(xhr, prop, {get: fn});
} catch (e) {/*ignore*/}
}
patchXHR('send', function(orig) {
return function() {
var xhr = this;
if (arguments[0] && arguments[0].__isFileAPIShim) {
var formData = arguments[0];
var config = {
url: xhr.__url,
jsonp: false, //removes the callback form param
cache: true, //removes the ?fileapiXXX in the url
complete: function(err, fileApiXHR) {
xhr.__completed = true;
if (!err && xhr.__listeners['load'])
xhr.__listeners['load']({type: 'load', loaded: xhr.__loaded, total: xhr.__total, target: xhr, lengthComputable: true});
if (!err && xhr.__listeners['loadend'])
xhr.__listeners['loadend']({type: 'loadend', loaded: xhr.__loaded, total: xhr.__total, target: xhr, lengthComputable: true});
if (err === 'abort' && xhr.__listeners['abort'])
xhr.__listeners['abort']({type: 'abort', loaded: xhr.__loaded, total: xhr.__total, target: xhr, lengthComputable: true});
if (fileApiXHR.status !== undefined) redefineProp(xhr, 'status', function() {return (fileApiXHR.status == 0 && err && err !== 'abort') ? 500 : fileApiXHR.status});
if (fileApiXHR.statusText !== undefined) redefineProp(xhr, 'statusText', function() {return fileApiXHR.statusText});
redefineProp(xhr, 'readyState', function() {return 4});
if (fileApiXHR.response !== undefined) redefineProp(xhr, 'response', function() {return fileApiXHR.response});
var resp = fileApiXHR.responseText || (err && fileApiXHR.status == 0 && err !== 'abort' ? err : undefined);
redefineProp(xhr, 'responseText', function() {return resp});
redefineProp(xhr, 'response', function() {return resp});
if (err) redefineProp(xhr, 'err', function() {return err});
xhr.__fileApiXHR = fileApiXHR;
if (xhr.onreadystatechange) xhr.onreadystatechange();
if (xhr.onload) xhr.onload();
},
fileprogress: function(e) {
e.target = xhr;
xhr.__listeners['progress'] && xhr.__listeners['progress'](e);
xhr.__total = e.total;
xhr.__loaded = e.loaded;
if (e.total === e.loaded) {
// fix flash issue that doesn't call complete if there is no response text from the server
var _this = this
setTimeout(function() {
if (!xhr.__completed) {
xhr.getAllResponseHeaders = function(){};
_this.complete(null, {status: 204, statusText: 'No Content'});
}
}, 10000);
}
},
headers: xhr.__requestHeaders
}
config.data = {};
config.files = {}
for (var i = 0; i < formData.data.length; i++) {
var item = formData.data[i];
if (item.val != null && item.val.name != null && item.val.size != null && item.val.type != null) {
config.files[item.key] = item.val;
} else {
config.data[item.key] = item.val;
}
}
setTimeout(function() {
if (!hasFlash()) {
throw 'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';
}
xhr.__fileApiXHR = FileAPI.upload(config);
}, 1);
} else {
orig.apply(xhr, arguments);
}
}
});
window.XMLHttpRequest.__isFileAPIShim = true;
var addFlash = function(elem) {
if (!hasFlash()) {
throw 'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';
}
var el = angular.element(elem);
if (!el.attr('disabled')) {
if (!el.hasClass('js-fileapi-wrapper') && (el.attr('ng-file-select') != null || el.attr('data-ng-file-select') != null ||
el.attr('ng-file-generated-elem--') != null)) {
el.addClass('js-fileapi-wrapper');
if (el.attr('ng-file-generated-elem--') != null) {
var ref = angular.element(document.getElementById('e' + el.attr('id')));
ref.bind('mouseover', function() {
if (el.parent().css('position') === '' || el.parent().css('position') === 'static') {
el.parent().css('position', 'relative');
}
el.css('position', 'absolute').css('top', ref[0].offsetTop + 'px').css('left', ref[0].offsetLeft + 'px')
.css('width', ref[0].offsetWidth + 'px').css('height', ref[0].offsetHeight + 'px')
.css('padding', ref.css('padding')).css('margin', ref.css('margin')).css('filter', 'alpha(opacity=0)');
ref.attr('onclick', '');
el.css('z-index', '1000');
});
}
}
}
};
var changeFnWrapper = function(fn) {
return function(evt) {
var files = FileAPI.getFiles(evt);
//just a double check for #233
for (var i = 0; i < files.length; i++) {
if (files[i].size === undefined) files[i].size = 0;
if (files[i].name === undefined) files[i].name = 'file';
if (files[i].type === undefined) files[i].type = 'undefined';
}
if (!evt.target) {
evt.target = {};
}
evt.target.files = files;
// if evt.target.files is not writable use helper field
if (evt.target.files != files) {
evt.__files_ = files;
}
(evt.__files_ || evt.target.files).item = function(i) {
return (evt.__files_ || evt.target.files)[i] || null;
}
if (fn) fn.apply(this, [evt]);
};
};
var isFileChange = function(elem, e) {
return (e.toLowerCase() === 'change' || e.toLowerCase() === 'onchange') && elem.getAttribute('type') == 'file';
}
if (HTMLInputElement.prototype.addEventListener) {
HTMLInputElement.prototype.addEventListener = (function(origAddEventListener) {
return function(e, fn, b, d) {
if (isFileChange(this, e)) {
addFlash(this);
origAddEventListener.apply(this, [e, changeFnWrapper(fn), b, d]);
} else {
origAddEventListener.apply(this, [e, fn, b, d]);
}
}
})(HTMLInputElement.prototype.addEventListener);
}
if (HTMLInputElement.prototype.attachEvent) {
HTMLInputElement.prototype.attachEvent = (function(origAttachEvent) {
return function(e, fn) {
if (isFileChange(this, e)) {
addFlash(this);
if (window.jQuery) {
// fix for #281 jQuery on IE8
angular.element(this).bind('change', changeFnWrapper(null));
} else {
origAttachEvent.apply(this, [e, changeFnWrapper(fn)]);
}
} else {
origAttachEvent.apply(this, [e, fn]);
}
}
})(HTMLInputElement.prototype.attachEvent);
}
window.FormData = FormData = function() {
return {
append: function(key, val, name) {
if (val.__isFileAPIBlobShim) {
val = val.data[0];
}
this.data.push({
key: key,
val: val,
name: name
});
},
data: [],
__isFileAPIShim: true
};
};
window.Blob = Blob = function(b) {
return {
data: b,
__isFileAPIBlobShim: true
};
};
(function () {
//load FileAPI
if (!window.FileAPI) {
window.FileAPI = {};
}
if (FileAPI.forceLoad) {
FileAPI.html5 = false;
}
if (!FileAPI.upload) {
var jsUrl, basePath, script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
if (window.FileAPI.jsUrl) {
jsUrl = window.FileAPI.jsUrl;
} else if (window.FileAPI.jsPath) {
basePath = window.FileAPI.jsPath;
} else {
for (i = 0; i < allScripts.length; i++) {
src = allScripts[i].src;
index = src.search(/\/angular\-file\-upload[\-a-zA-z0-9\.]*\.js/)
if (index > -1) {
basePath = src.substring(0, index + 1);
break;
}
}
}
if (FileAPI.staticPath == null) FileAPI.staticPath = basePath;
script.setAttribute('src', jsUrl || basePath + 'FileAPI.min.js');
document.getElementsByTagName('head')[0].appendChild(script);
FileAPI.hasFlash = hasFlash();
}
})();
FileAPI.disableFileInput = function(elem, disable) {
if (disable) {
elem.removeClass('js-fileapi-wrapper')
} else {
elem.addClass('js-fileapi-wrapper');
}
}
}
if (!window.FileReader) {
window.FileReader = function() {
var _this = this, loadStarted = false;
this.listeners = {};
this.addEventListener = function(type, fn) {
_this.listeners[type] = _this.listeners[type] || [];
_this.listeners[type].push(fn);
};
this.removeEventListener = function(type, fn) {
_this.listeners[type] && _this.listeners[type].splice(_this.listeners[type].indexOf(fn), 1);
};
this.dispatchEvent = function(evt) {
var list = _this.listeners[evt.type];
if (list) {
for (var i = 0; i < list.length; i++) {
list[i].call(_this, evt);
}
}
};
this.onabort = this.onerror = this.onload = this.onloadstart = this.onloadend = this.onprogress = null;
var constructEvent = function(type, evt) {
var e = {type: type, target: _this, loaded: evt.loaded, total: evt.total, error: evt.error};
if (evt.result != null) e.target.result = evt.result;
return e;
};
var listener = function(evt) {
if (!loadStarted) {
loadStarted = true;
_this.onloadstart && this.onloadstart(constructEvent('loadstart', evt));
}
if (evt.type === 'load') {
_this.onloadend && _this.onloadend(constructEvent('loadend', evt));
var e = constructEvent('load', evt);
_this.onload && _this.onload(e);
_this.dispatchEvent(e);
} else if (evt.type === 'progress') {
var e = constructEvent('progress', evt);
_this.onprogress && _this.onprogress(e);
_this.dispatchEvent(e);
} else {
var e = constructEvent('error', evt);
_this.onerror && _this.onerror(e);
_this.dispatchEvent(e);
}
};
this.readAsArrayBuffer = function(file) {
FileAPI.readAsBinaryString(file, listener);
}
this.readAsBinaryString = function(file) {
FileAPI.readAsBinaryString(file, listener);
}
this.readAsDataURL = function(file) {
FileAPI.readAsDataURL(file, listener);
}
this.readAsText = function(file) {
FileAPI.readAsText(file, listener);
}
}
}
})();
| gogoleva/cdnjs | ajax/libs/danialfarid-angular-file-upload/2.2.2/angular-file-upload-shim.js | JavaScript | mit | 12,203 |
/*
* Copyright (c) 2013 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package spew
import (
"bytes"
"fmt"
"io"
"os"
)
// ConfigState houses the configuration options used by spew to format and
// display values. There is a global instance, Config, that is used to control
// all top-level Formatter and Dump functionality. Each ConfigState instance
// provides methods equivalent to the top-level functions.
//
// The zero value for ConfigState provides no indentation. You would typically
// want to set it to a space or a tab.
//
// Alternatively, you can use NewDefaultConfig to get a ConfigState instance
// with default settings. See the documentation of NewDefaultConfig for default
// values.
type ConfigState struct {
// Indent specifies the string to use for each indentation level. The
// global config instance that all top-level functions use set this to a
// single space by default. If you would like more indentation, you might
// set this to a tab with "\t" or perhaps two spaces with " ".
Indent string
// MaxDepth controls the maximum number of levels to descend into nested
// data structures. The default, 0, means there is no limit.
//
// NOTE: Circular data structures are properly detected, so it is not
// necessary to set this value unless you specifically want to limit deeply
// nested data structures.
MaxDepth int
// DisableMethods specifies whether or not error and Stringer interfaces are
// invoked for types that implement them.
DisableMethods bool
// DisablePointerMethods specifies whether or not to check for and invoke
// error and Stringer interfaces on types which only accept a pointer
// receiver when the current type is not a pointer.
//
// NOTE: This might be an unsafe action since calling one of these methods
// with a pointer receiver could technically mutate the value, however,
// in practice, types which choose to satisify an error or Stringer
// interface with a pointer receiver should not be mutating their state
// inside these interface methods. As a result, this option relies on
// access to the unsafe package, so it will not have any effect when
// running in environments without access to the unsafe package such as
// Google App Engine or with the "safe" build tag specified.
DisablePointerMethods bool
// ContinueOnMethod specifies whether or not recursion should continue once
// a custom error or Stringer interface is invoked. The default, false,
// means it will print the results of invoking the custom error or Stringer
// interface and return immediately instead of continuing to recurse into
// the internals of the data type.
//
// NOTE: This flag does not have any effect if method invocation is disabled
// via the DisableMethods or DisablePointerMethods options.
ContinueOnMethod bool
// SortKeys specifies map keys should be sorted before being printed. Use
// this to have a more deterministic, diffable output. Note that only
// native types (bool, int, uint, floats, uintptr and string) and types
// that support the error or Stringer interfaces (if methods are
// enabled) are supported, with other types sorted according to the
// reflect.Value.String() output which guarantees display stability.
SortKeys bool
// SpewKeys specifies that, as a last resort attempt, map keys should
// be spewed to strings and sorted by those strings. This is only
// considered if SortKeys is true.
SpewKeys bool
}
// Config is the active configuration of the top-level functions.
// The configuration can be changed by modifying the contents of spew.Config.
var Config = ConfigState{Indent: " "}
// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the formatted string as a value that satisfies error. See NewFormatter
// for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) {
return fmt.Errorf(format, c.convertArgs(a)...)
}
// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) {
return fmt.Fprint(w, c.convertArgs(a)...)
}
// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
return fmt.Fprintf(w, format, c.convertArgs(a)...)
}
// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it
// passed with a Formatter interface returned by c.NewFormatter. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
return fmt.Fprintln(w, c.convertArgs(a)...)
}
// Print is a wrapper for fmt.Print that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Print(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Print(a ...interface{}) (n int, err error) {
return fmt.Print(c.convertArgs(a)...)
}
// Printf is a wrapper for fmt.Printf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) {
return fmt.Printf(format, c.convertArgs(a)...)
}
// Println is a wrapper for fmt.Println that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the number of bytes written and any write error encountered. See
// NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Println(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Println(a ...interface{}) (n int, err error) {
return fmt.Println(c.convertArgs(a)...)
}
// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Sprint(a ...interface{}) string {
return fmt.Sprint(c.convertArgs(a)...)
}
// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were
// passed with a Formatter interface returned by c.NewFormatter. It returns
// the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Sprintf(format string, a ...interface{}) string {
return fmt.Sprintf(format, c.convertArgs(a)...)
}
// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it
// were passed with a Formatter interface returned by c.NewFormatter. It
// returns the resulting string. See NewFormatter for formatting details.
//
// This function is shorthand for the following syntax:
//
// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b))
func (c *ConfigState) Sprintln(a ...interface{}) string {
return fmt.Sprintln(c.convertArgs(a)...)
}
/*
NewFormatter returns a custom formatter that satisfies the fmt.Formatter
interface. As a result, it integrates cleanly with standard fmt package
printing functions. The formatter is useful for inline printing of smaller data
types similar to the standard %v format specifier.
The custom formatter only responds to the %v (most compact), %+v (adds pointer
addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb
combinations. Any other verbs such as %x and %q will be sent to the the
standard fmt package for formatting. In addition, the custom formatter ignores
the width and precision arguments (however they will still work on the format
specifiers not handled by the custom formatter).
Typically this function shouldn't be called directly. It is much easier to make
use of the custom formatter by calling one of the convenience functions such as
c.Printf, c.Println, or c.Printf.
*/
func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter {
return newFormatter(c, v)
}
// Fdump formats and displays the passed arguments to io.Writer w. It formats
// exactly the same as Dump.
func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) {
fdump(c, w, a...)
}
/*
Dump displays the passed parameters to standard out with newlines, customizable
indentation, and additional debug information such as complete types and all
pointer addresses used to indirect to the final value. It provides the
following features over the built-in printing facilities provided by the fmt
package:
* Pointers are dereferenced and followed
* Circular data structures are detected and handled properly
* Custom Stringer/error interfaces are optionally invoked, including
on unexported types
* Custom types which only implement the Stringer/error interfaces via
a pointer receiver are optionally invoked when passing non-pointer
variables
* Byte arrays and slices are dumped like the hexdump -C command which
includes offsets, byte values in hex, and ASCII output
The configuration options are controlled by modifying the public members
of c. See ConfigState for options documentation.
See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
get the formatted result as a string.
*/
func (c *ConfigState) Dump(a ...interface{}) {
fdump(c, os.Stdout, a...)
}
// Sdump returns a string with the passed arguments formatted exactly the same
// as Dump.
func (c *ConfigState) Sdump(a ...interface{}) string {
var buf bytes.Buffer
fdump(c, &buf, a...)
return buf.String()
}
// convertArgs accepts a slice of arguments and returns a slice of the same
// length with each argument converted to a spew Formatter interface using
// the ConfigState associated with s.
func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) {
formatters = make([]interface{}, len(args))
for index, arg := range args {
formatters[index] = newFormatter(c, arg)
}
return formatters
}
// NewDefaultConfig returns a ConfigState with the following default settings.
//
// Indent: " "
// MaxDepth: 0
// DisableMethods: false
// DisablePointerMethods: false
// ContinueOnMethod: false
// SortKeys: false
func NewDefaultConfig() *ConfigState {
return &ConfigState{Indent: " "}
}
| unicok/unigo | game/vendor/github.com/davecgh/go-spew/spew/config.go | GO | mit | 12,452 |
/*!
* # Semantic UI 1.11.7 - Item
* http://github.com/semantic-org/semantic-ui/
*
*
* Copyright 2014 Contributorss
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/.ui.items>.item{table-layout:fixed;display:table;margin:1em 0;width:100%;min-height:0;background:0 0;padding:0;border:none;border-radius:0;box-shadow:none;-webkit-transition:box-shadow .2s ease;transition:box-shadow .2s ease;z-index:''}.ui.items>.item a{cursor:pointer}.ui.items{margin:1.5em 0}.ui.items:first-child{margin-top:0!important}.ui.items:last-child{margin-bottom:0!important}.ui.items>.item:after{display:block;content:' ';height:0;clear:both;overflow:hidden;visibility:hidden}.ui.items>.item:first-child{margin-top:0}.ui.items>.item:last-child{margin-bottom:0}.ui.items>.item>.image{position:relative;display:table-cell;float:none;margin:0;padding:0;max-height:'';vertical-align:top}.ui.items>.item>.image>img{display:block;width:100%;height:auto;border-radius:.125rem;border:none}.ui.items>.item>.image:only-child>img{border-radius:0}.ui.items>.item>.content{display:block;background:0 0;margin:0;padding:0;box-shadow:none;font-size:1em;border:none;border-radius:0}.ui.items>.item>.content:after{display:block;content:' ';height:0;clear:both;overflow:hidden;visibility:hidden}.ui.items>.item>.image+.content{width:100%;display:table-cell;margin-left:0;vertical-align:top;padding-left:1.5em}.ui.items>.item>.content>.header{display:block;margin:-.165em 0 0;font-family:Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;font-weight:700;color:rgba(0,0,0,.85)}.ui.items>.item>.content>.header:not(.ui){font-size:1.2em}.ui.items>.item [class*="left floated"]{float:left}.ui.items>.item [class*="right floated"]{float:right}.ui.items>.item .content img{vertical-align:middle;width:''}.ui.items>.item .avatar img,.ui.items>.item img.avatar{width:'';height:'';border-radius:500rem}.ui.items>.item>.content>.description{margin-top:.6em;max-width:550px;font-size:1em;line-height:1.33;color:rgba(0,0,0,.8)}.ui.items>.item>.content p{margin:0 0 .5em}.ui.items>.item>.content p:last-child{margin-bottom:0}.ui.items>.item .meta{font-size:1em;line-height:1em;color:rgba(0,0,0,.6)}.ui.items>.item .meta *{margin-right:.3em}.ui.items>.item .meta :last-child{margin-right:0}.ui.items>.item .meta [class*="right floated"]{margin-right:0;margin-left:.3em}.ui.items>.item>.content a:not(.ui){color:'';-webkit-transition:color .2s ease;transition:color .2s ease}.ui.items>.item>.content a:not(.ui):hover{color:''}.ui.items>.item>.content>a.header{color:rgba(0,0,0,.85)}.ui.items>.item>.content>a.header:hover{color:#00b2f3}.ui.items>.item .meta>a:not(.ui){color:rgba(0,0,0,.4)}.ui.items>.item .meta>a:not(.ui):hover{color:rgba(0,0,0,.8)}.ui.items>.item>.content .favorite.icon{cursor:pointer;opacity:.75;-webkit-transition:color .2s ease;transition:color .2s ease}.ui.items>.item>.content .favorite.icon:hover{opacity:1;color:#ffb70a}.ui.items>.item>.content .active.favorite.icon{color:#ffe623}.ui.items>.item>.content .like.icon{cursor:pointer;opacity:.75;-webkit-transition:color .2s ease;transition:color .2s ease}.ui.items>.item>.content .like.icon:hover{opacity:1;color:#ff2733}.ui.items>.item>.content .active.like.icon{color:#ff2733}.ui.items>.item .extra{display:block;position:relative;background:0 0;margin:.5rem 0 0;width:100%;padding:0;top:0;left:0;color:rgba(0,0,0,.4);box-shadow:none;-webkit-transition:color .2s ease;transition:color .2s ease;border-top:none}.ui.items>.item .extra>*{margin:.25rem .5rem .25rem 0}.ui.items>.item .extra>[class*="right floated"]{margin:.25rem 0 .25rem .5rem}.ui.items>.item .extra:after{display:block;content:' ';height:0;clear:both;overflow:hidden;visibility:hidden}.ui.items>.item>.image:not(.ui){width:175px}@media only screen and (min-width:768px)and (max-width:991px){.ui.items>.item{margin:1em 0}.ui.items>.item>.image:not(.ui){width:150px}.ui.items>.item>.image+.content{display:block;padding:0 0 0 1em}}@media only screen and (max-width:767px){.ui.items>.item{margin:2em 0}.ui.items>.item>.image{display:block;margin-left:auto;margin-right:auto}.ui.items>.item>.image,.ui.items>.item>.image>img{max-width:100%!important;width:auto!important;max-height:250px!important}.ui.items>.item>.image+.content{display:block;padding:1.5em 0 0}}.ui.items>.item>.image+[class*="top aligned"].content{vertical-align:top}.ui.items>.item>.image+[class*="middle aligned"].content{vertical-align:middle}.ui.items>.item>.image+[class*="bottom aligned"].content{vertical-align:bottom}.ui.relaxed.items>.item{margin:1.5em 0}.ui[class*="very relaxed"].items>.item{margin:2em 0}.ui.divided.items>.item{border-top:1px solid rgba(39,41,43,.15);margin:0;padding:1em 0}.ui.divided.items>.item:first-child{border-top:none;margin-top:0!important;padding-top:0!important}.ui.divided.items>.item:last-child{margin-bottom:0!important;padding-bottom:0!important}.ui.relaxed.divided.items>.item{margin:0;padding:1.5em 0}.ui[class*="very relaxed"].divided.items>.item{margin:0;padding:2em 0}.ui.items a.item:hover,.ui.link.items>.item:hover{cursor:pointer}.ui.items a.item:hover .content .header,.ui.link.items>.item:hover .content .header{color:#00b2f3}.ui.items>.item{min-width:100%;font-size:1em} | vetruvet/cdnjs | ajax/libs/semantic-ui/1.11.7/components/item.min.css | CSS | mit | 5,208 |
(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,i=e[typeof module]&&module&&!module.nodeType&&module,o=(i&&i.exports===r&&r,e[typeof global]&&global);!o||o.global!==o&&o.window!==o||(n=o),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n){function r(){if(this.isDisposed)throw Error(m)}var i=n.Observable,o=i.prototype,s=n.AnonymousObservable,u=n.Subject,c=n.AsyncSubject,a=n.Observer,h=n.internals.ScheduledObserver,l=n.Disposable.create,f=n.Disposable.empty,p=n.CompositeDisposable,d=n.Scheduler.currentThread,v=n.internals.inherits,b=n.internals.addProperties,m="Object has been disposed";o.multicast=function(t,e){var n=this;return"function"==typeof t?new s(function(r){var i=n.multicast(t());return new p(e(i).subscribe(r),i.connect())}):new E(n,t)},o.publish=function(t){return t?this.multicast(function(){return new u},t):this.multicast(new u)},o.share=function(){return this.publish(null).refCount()},o.publishLast=function(t){return t?this.multicast(function(){return new c},t):this.multicast(new c)},o.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new w(e)},t):this.multicast(new w(t))},o.shareValue=function(t){return this.publishValue(t).refCount()},o.replay=function(t,e,n,r){return t?this.multicast(function(){return new g(e,n,r)},t):this.multicast(new g(e,n,r))},o.replayWhileObserved=function(t,e,n){return this.replay(null,t,e,n).refCount()};var y=function(t,e){this.subject=t,this.observer=e};y.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var w=n.BehaviorSubject=function(t){function e(t){if(r.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new y(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),f}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return v(n,t),b(n.prototype,a,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(r.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(r.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,i=e.length;i>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(r.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,i=e.length;i>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(i),g=n.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new h(this.scheduler,t),i=new e(this,n);r.call(this),this._trim(this.scheduler.now()),this.observers.push(n);for(var o=this.q.length,s=0,u=this.q.length;u>s;s++)n.onNext(this.q[s].value);return this.hasError?(o++,n.onError(this.error)):this.isStopped&&(o++,n.onCompleted()),n.ensureActive(o),i}function i(e,r,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==r?Number.MAX_VALUE:r,this.scheduler=i||d,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,n)}return e.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},v(i,t),b(i.prototype,a,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var e;if(r.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)e=i[o],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(r.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)e=i[o],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(r.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),i=0,o=n.length;o>i;i++)t=n[i],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),i}(i),E=n.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new p(i.source.subscribe(i.subject),l(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return v(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new s(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),l(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(i);return n}); | r3x/cdnjs | ajax/libs/rxjs/2.2.27/rx.binding.min.js | JavaScript | mit | 5,468 |
<?php
namespace PhpParser\Node\Stmt;
use PhpParser\Node\Stmt;
class Use_ extends Stmt
{
/**
* Unknown type. Both Stmt\Use_ / Stmt\GroupUse and Stmt\UseUse have a $type property, one of them will always be
* TYPE_UNKNOWN while the other has one of the three other possible types. For normal use statements the type on the
* Stmt\UseUse is unknown. It's only the other way around for mixed group use declarations.
*/
const TYPE_UNKNOWN = 0;
/** Class or namespace import */
const TYPE_NORMAL = 1;
/** Function import */
const TYPE_FUNCTION = 2;
/** Constant import */
const TYPE_CONSTANT = 3;
/** @var int Type of alias */
public $type;
/** @var UseUse[] Aliases */
public $uses;
/**
* Constructs an alias (use) list node.
*
* @param UseUse[] $uses Aliases
* @param int $type Type of alias
* @param array $attributes Additional attributes
*/
public function __construct(array $uses, $type = self::TYPE_NORMAL, array $attributes = array()) {
parent::__construct($attributes);
$this->type = $type;
$this->uses = $uses;
}
public function getSubNodeNames() {
return array('type', 'uses');
}
}
| lweb20/codeigniter-restserver | application/tests/_ci_phpunit_test/patcher/third_party/PHP-Parser/lib/PhpParser/Node/Stmt/Use_.php | PHP | mit | 1,263 |
.ui-pnotify{top:25px;right:25px;position:absolute;height:auto;z-index:9999}html>body>.ui-pnotify{position:fixed}.ui-pnotify .ui-pnotify-shadow{-webkit-box-shadow:0 2px 10px rgba(50,50,50,0.5);-moz-box-shadow:0 2px 10px rgba(50,50,50,0.5);box-shadow:0 2px 10px rgba(50,50,50,0.5)}.ui-pnotify-container{background-position:0 0;padding:.8em;height:100%;margin:0}.ui-pnotify-sharp{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.ui-pnotify-closer,.ui-pnotify-sticker{float:right;margin-left:.2em}.ui-pnotify-title{display:block;margin-bottom:.4em;margin-top:0}.ui-pnotify-text{display:block}.ui-pnotify-icon,.ui-pnotify-icon span{display:block;float:left;margin-right:.2em}.ui-pnotify-history-container{position:absolute;top:0;right:18px;width:70px;border-top:0;padding:0;-webkit-border-top-left-radius:0;-moz-border-top-left-radius:0;border-top-left-radius:0;-webkit-border-top-right-radius:0;-moz-border-top-right-radius:0;border-top-right-radius:0;z-index:10000}.ui-pnotify-history-container .ui-pnotify-history-header{padding:2px;text-align:center}.ui-pnotify-history-container button{cursor:pointer;display:block;width:100%}.ui-pnotify-history-container .ui-pnotify-history-pulldown{display:block;margin:0 auto}.ui-pnotify.stack-topleft,.ui-pnotify.stack-bottomleft{left:25px;right:auto}.ui-pnotify.stack-bottomright,.ui-pnotify.stack-bottomleft{bottom:25px;top:auto} | redmunds/cdnjs | ajax/libs/pnotify/1.3.1/jquery.pnotify.default.min.css | CSS | mit | 1,382 |
(function(t){function e(){if(this.isDisposed)throw Error(le)}function n(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function r(t){var e=[];if(!n(t))return e;qe.nonEnumArgs&&t.length&&u(t)&&(t=Te.call(t));var r=qe.enumPrototypes&&"function"==typeof t,i=qe.enumErrorProps&&(t===Ne||t instanceof Error);for(var o in t)r&&"prototype"==o||i&&("message"==o||"name"==o)||e.push(o);if(qe.nonEnumShadows&&t!==Oe){var s=t.constructor,c=-1,a=je.length;if(t===(s&&s.prototype))var h=t===stringProto?De:t===Ne?we:Se.call(t),l=ke[h];for(;a>++c;)o=je[c],l&&l[o]||!_e.call(t,o)||e.push(o)}return e}function i(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function o(t,e){return i(t,e,r)}function s(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function u(t){return t&&"object"==typeof t?Se.call(t)==ve:!1}function c(t){return"function"==typeof t||!1}function a(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var h=typeof e,l=typeof n;if(e===e&&(null==e||null==n||"function"!=h&&"object"!=h&&"function"!=l&&"object"!=l))return!1;var f=Se.call(e),p=Se.call(n);if(f==ve&&(f=xe),p==ve&&(p=xe),f!=p)return!1;switch(f){case me:case ye:return+e==+n;case Ee:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case Ce:case De:return e==n+""}var d=f==be;if(!d){if(f!=xe||!qe.nodeClass&&(s(e)||s(n)))return!1;var v=!qe.argsObject&&u(e)?Object:e.constructor,b=!qe.argsObject&&u(n)?Object:n.constructor;if(!(v==b||_e.call(e,"constructor")&&_e.call(n,"constructor")||c(v)&&v instanceof v&&c(b)&&b instanceof b||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),d){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=a(e[y],w,r,i)))break}}else o(n,function(n,o,s){return _e.call(s,o)?(y++,result=_e.call(e,o)&&a(e[o],n,r,i)):t}),result&&o(e,function(e,n,r){return _e.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function h(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:Te.call(t)}function l(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function f(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function p(e,n){return new ur(function(r){var i=new Je,o=new Xe;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}ce(s)&&(s=_n(s)),i=new Je,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function d(e,n){var r=this;return new ur(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function v(t){return this.map(function(e,n){var r=t(e,n);return ce(r)?_n(r):r}).concatAll()}function b(t){return this.select(function(e,n){var r=t(e,n);return ce(r)?_n(r):r}).mergeObservable()}function m(e,n,r){return new ur(function(i){var o=!1,s=null,u=[];return e.subscribe(function(e){var c,a;try{a=n(e)}catch(h){return i.onError(h),t}if(c=0,o)try{c=r(a,s)}catch(l){return i.onError(l),t}else o=!0,s=a;c>0&&(s=a,u=[]),c>=0&&u.push(e)},i.onError.bind(i),function(){i.onNext(u),i.onCompleted()})})}function y(t){if(0===t.length)throw Error(ae);return t[0]}function w(e,n,r){return new ur(function(i){var o=0,s=n.length;return e.subscribe(function(e){var u=!1;try{s>o&&(u=r(e,n[o++]))}catch(c){return i.onError(c),t}u||(i.onNext(!1),i.onCompleted())},i.onError.bind(i),function(){i.onNext(o===s),i.onCompleted()})})}function g(t,e,n,r){if(0>e)throw Error(he);return new ur(function(i){var o=e;return t.subscribe(function(t){0===o&&(i.onNext(t),i.onCompleted()),o--},i.onError.bind(i),function(){n?(i.onNext(r),i.onCompleted()):i.onError(Error(he))})})}function E(t,e,n){return new ur(function(r){var i=n,o=!1;return t.subscribe(function(t){o?r.onError(Error("Sequence contains more than one element")):(i=t,o=!0)},r.onError.bind(r),function(){o||e?(r.onNext(i),r.onCompleted()):r.onError(Error(ae))})})}function x(t,e,n){return new ur(function(r){return t.subscribe(function(t){r.onNext(t),r.onCompleted()},r.onError.bind(r),function(){e?(r.onNext(n),r.onCompleted()):r.onError(Error(ae))})})}function C(t,e,n){return new ur(function(r){var i=n,o=!1;return t.subscribe(function(t){i=t,o=!0},r.onError.bind(r),function(){o||e?(r.onNext(i),r.onCompleted()):r.onError(Error(ae))})})}function D(e,n,r,i){return new ur(function(o){var s=0;return e.subscribe(function(u){var c;try{c=n.call(r,u,s,e)}catch(a){return o.onError(a),t}c?(o.onNext(i?s:u),o.onCompleted()):s++},o.onError.bind(o),function(){o.onNext(i?-1:t),o.onCompleted()})})}function S(t,e,n){if(t.addListener)return t.addListener(e,n),Qe(function(){t.removeListener(e,n)});if(t.addEventListener)return t.addEventListener(e,n,!1),Qe(function(){t.removeEventListener(e,n,!1)});throw Error("No listener found")}function _(t,e,n){var r=new Be;if("function"==typeof t.item&&"number"==typeof t.length)for(var i=0,o=t.length;o>i;i++)r.add(_(t.item(i),e,n));else t&&r.add(S(t,e,n));return r}function A(e,n,r){return new ur(function(i){function o(e,n){h[n]=e;var o;if(u[n]=!0,c||(c=u.every(ne))){try{o=r.apply(null,h)}catch(s){return i.onError(s),t}i.onNext(o)}else a&&i.onCompleted()}var s=2,u=[!1,!1],c=!1,a=!1,h=Array(s);return new Be(e.subscribe(function(t){o(t,0)},i.onError.bind(i),function(){a=!0,i.onCompleted()}),n.subscribe(function(t){o(t,1)},i.onError.bind(i)))})}function N(t){if(false&t)return 2===t;for(var e=Math.sqrt(t),n=3;e>=n;){if(0===t%n)return!1;n+=2}return!0}function O(t){var e,n,r;for(e=0;Xn.length>e;++e)if(n=Xn[e],n>=t)return n;for(r=1|t;Xn[Xn.length-1]>r;){if(N(r))return r;r+=2}return t}function R(t){var e=757602046;if(!t.length)return e;for(var n=0,r=t.length;r>n;n++){var i=t.charCodeAt(n);e=(e<<5)-e+i,e&=e}return e}function W(t){var e=668265261;return t=61^t^t>>>16,t+=t<<3,t^=t>>>4,t*=e,t^=t>>>15}function j(){return{key:null,value:null,next:0,hashCode:0}}function k(t,e){return t.groupJoin(this,e,function(){return Nn()},function(t,e){return e})}function q(t){var e=this;return new ur(function(n){var r=new hr,i=new Be,o=new Ze(i);return n.onNext(Le(r,o)),i.add(e.subscribe(function(t){r.onNext(t)},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),i.add(t.subscribe(function(){r.onCompleted(),r=new hr,n.onNext(Le(r,o))},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),o})}function P(e){var n=this;return new ur(function(r){var i,o=new Xe,s=new Be(o),u=new Ze(s),c=new hr;return r.onNext(Le(c,u)),s.add(n.subscribe(function(t){c.onNext(t)},function(t){c.onError(t),r.onError(t)},function(){c.onCompleted(),r.onCompleted()})),i=function(){var n,s;try{s=e()}catch(a){return r.onError(a),t}n=new Je,o.setDisposable(n),n.setDisposable(s.take(1).subscribe(ee,function(t){c.onError(t),r.onError(t)},function(){c.onCompleted(),c=new hr,r.onNext(Le(c,u)),i()}))},i(),u})}function T(e,n){return new dn(function(){return new pn(function(){return e()?{done:!1,value:n}:{done:!0,value:t}})})}function V(t){this.patterns=t}function z(t,e){this.expression=t,this.selector=e}function L(t,e,n){var r=t.get(e);if(!r){var i=new ir(e,n);return t.set(e,i),i}return r}function M(t,e,n){var r,i;for(this.joinObserverArray=t,this.onNext=e,this.onCompleted=n,this.joinObservers=new rr,r=0;this.joinObserverArray.length>r;r++)i=this.joinObserverArray[r],this.joinObservers.set(i,i)}function I(t,e){return new ur(function(n){return e.scheduleWithAbsolute(t,function(){n.onNext(0),n.onCompleted()})})}function F(t,e,n){var r=en(e);return new ur(function(e){var i=0,o=t;return n.scheduleRecursiveWithAbsolute(o,function(t){var s;r>0&&(s=n.now(),o+=r,s>=o&&(o=s+r)),e.onNext(i++),t(o)})})}function B(t,e){var n=en(t);return new ur(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function H(t,e,n){return t===e?new ur(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):An(function(){return F(n.now()+t,e,n)})}function U(t,e){var n=this;return new ur(function(r){var i,o=!1,s=new Xe,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,h;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,h=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),h=!o,o=!0),h&&(null!==u?r.onError(u):(i=new Je,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,h;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);h=!1,i=0,c.length>0?(h=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):h&&t(i)}}))))}),new Be(i,s)})}function Q(t,e){var n=this;return An(function(){var r=t-e.now();return U.call(n,r,e)})}function $(t,e){return new ur(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new Be(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}var K={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},J=K[typeof window]&&window||this,X=K[typeof exports]&&exports&&!exports.nodeType&&exports,Z=K[typeof module]&&module&&!module.nodeType&&module,G=Z&&Z.exports===X&&X,Y=K[typeof global]&&global;!Y||Y.global!==Y&&Y.window!==Y||(J=Y);var te={internals:{},config:{Promise:J.Promise},helpers:{}},ee=te.helpers.noop=function(){},ne=te.helpers.identity=function(t){return t},re=(te.helpers.pluck=function(t){return function(e){return e[t]}},te.helpers.just=function(t){return function(){return t}},te.helpers.defaultNow=Date.now),ie=te.helpers.defaultComparer=function(t,e){return Pe(t,e)},oe=te.helpers.defaultSubComparer=function(t,e){return t>e?1:e>t?-1:0},se=te.helpers.defaultKeySerializer=function(t){return""+t},ue=te.helpers.defaultError=function(t){throw t},ce=te.helpers.isPromise=function(t){return!!t&&"function"==typeof t.then&&t.then!==te.Observable.prototype.then};te.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},te.helpers.not=function(t){return!t};var ae="Sequence contains no elements.",he="Argument out of range",le="Object has been disposed",fe="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";J.Set&&"function"==typeof(new J.Set)["@@iterator"]&&(fe="@@iterator");var pe,de={done:!0,value:t},ve="[object Arguments]",be="[object Array]",me="[object Boolean]",ye="[object Date]",we="[object Error]",ge="[object Function]",Ee="[object Number]",xe="[object Object]",Ce="[object RegExp]",De="[object String]",Se=Object.prototype.toString,_e=Object.prototype.hasOwnProperty,Ae=Se.call(arguments)==ve,Ne=Error.prototype,Oe=Object.prototype,Re=Oe.propertyIsEnumerable;try{pe=!(Se.call(document)==xe&&!({toString:0}+""))}catch(We){pe=!0}var je=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ke={};ke[be]=ke[ye]=ke[Ee]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},ke[me]=ke[De]={constructor:!0,toString:!0,valueOf:!0},ke[we]=ke[ge]=ke[Ce]={constructor:!0,toString:!0},ke[xe]={constructor:!0};var qe={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);qe.enumErrorProps=Re.call(Ne,"message")||Re.call(Ne,"name"),qe.enumPrototypes=Re.call(t,"prototype"),qe.nonEnumArgs=0!=n,qe.nonEnumShadows=!/valueOf/.test(e)})(1),Ae||(u=function(t){return t&&"object"==typeof t?_e.call(t,"callee"):!1}),c(/x/)&&(c=function(t){return"function"==typeof t&&Se.call(t)==ge});var Pe=te.internals.isEqual=function(t,e){return a(t,e,[],[])},Te=Array.prototype.slice;({}).hasOwnProperty;var Ve=this.inherits=te.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},ze=te.internals.addProperties=function(t){for(var e=Te.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},Le=te.internals.addRef=function(t,e){return new ur(function(n){return new Be(e.getDisposable(),t.subscribe(n))})},Me=function(t,e){this.id=t,this.value=e};Me.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var Ie=te.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},Fe=Ie.prototype;Fe.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},Fe.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},Fe.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},Fe.peek=function(){return this.items[0].value},Fe.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},Fe.dequeue=function(){var t=this.peek();return this.removeAt(0),t},Fe.enqueue=function(t){var e=this.length++;this.items[e]=new Me(Ie.count++,t),this.percolate(e)},Fe.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},Ie.count=0;var Be=te.CompositeDisposable=function(){this.disposables=h(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},He=Be.prototype;He.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},He.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},He.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},He.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},He.contains=function(t){return-1!==this.disposables.indexOf(t)},He.toArray=function(){return this.disposables.slice(0)};var Ue=te.Disposable=function(t){this.isDisposed=!1,this.action=t||ee};Ue.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Qe=Ue.create=function(t){return new Ue(t)},$e=Ue.empty={dispose:ee},Ke=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),Je=te.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return Ve(e,t),e}(Ke),Xe=te.SerialDisposable=function(t){function e(){t.call(this,!1)}return Ve(e,t),e}(Ke),Ze=te.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?$e:new t(this)},e}();f.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})};var Ge=te.internals.ScheduledItem=function(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||oe,this.disposable=new Je};Ge.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ge.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},Ge.prototype.isCancelled=function(){return this.disposable.isDisposed},Ge.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ye,tn=te.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new Be,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),$e});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new Be,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),$e});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),$e}var i=t.prototype;return i.catchException=i["catch"]=function(t){return new cn(this,t)},i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return Qe(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=re,t.normalize=function(t){return 0>t&&(t=0),t},t}(),en=tn.normalize,nn=te.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new Je;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}(),rn=tn.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=en(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new tn(re,t,e,n)}(),on=tn.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-tn.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+tn.normalize(n),s=new Ge(this,e,r,o);if(i)i.enqueue(s);else{i=new Ie(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new tn(re,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}(),sn=ee;(function(){function t(){if(!J.postMessage||J.importScripts)return!1;var t=!1,e=J.onmessage;return J.onmessage=function(){t=!0},J.postMessage("","*"),J.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(Se+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=Y&&G&&Y.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=Y&&G&&Y.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Ye=process.nextTick;else if("function"==typeof r)Ye=r,sn=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;J.addEventListener?J.addEventListener("message",e,!1):J.attachEvent("onmessage",e,!1),Ye=function(t){var e=u++;s[e]=t,J.postMessage(o+e,"*")}}else if(J.MessageChannel){var c=new J.MessageChannel,a={},h=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},Ye=function(t){var e=h++;a[e]=t,c.port2.postMessage(e)}}else"document"in J&&"onreadystatechange"in J.document.createElement("script")?Ye=function(t){var e=J.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},J.document.documentElement.appendChild(e)}:(Ye=function(t){return setTimeout(t,0)},sn=clearTimeout)})();var un=tn.timeout=function(){function t(t,e){var n=this,r=new Je,i=Ye(function(){r.isDisposed||r.setDisposable(e(n,t))});return new Be(r,Qe(function(){sn(i)}))}function e(t,e,n){var r=this,i=tn.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new Je,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new Be(o,Qe(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new tn(re,t,e,n)}(),cn=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return Ve(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return $e}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new Je;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(tn),an=te.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=rn),new ur(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),hn=an.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new an("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),ln=an.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new an("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),fn=an.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new an("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),pn=te.internals.Enumerator=function(t){this._next=t};pn.prototype.next=function(){return this._next()},pn.prototype[fe]=function(){return this};var dn=te.internals.Enumerable=function(t){this._iterator=t};dn.prototype[fe]=function(){return this._iterator()},dn.prototype.concat=function(){var e=this;return new ur(function(n){var r;try{r=e[fe]()}catch(i){return n.onError(),t}var o,s=new Xe,u=rn.scheduleRecursive(function(e){var i;if(!o){try{i=r.next()}catch(u){return n.onError(u),t}if(i.done)return n.onCompleted(),t;var c=i.value;ce(c)&&(c=_n(c));var a=new Je;s.setDisposable(a),a.setDisposable(c.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new Be(s,u,Qe(function(){o=!0}))})},dn.prototype.catchException=function(){var e=this;return new ur(function(n){var r;try{r=e[fe]()}catch(i){return n.onError(),t}var o,s,u=new Xe,c=rn.scheduleRecursive(function(e){if(!o){var i;try{i=r.next()}catch(c){return n.onError(c),t}if(i.done)return s?n.onError(s):n.onCompleted(),t;var a=i.value;ce(a)&&(a=_n(a));var h=new Je;u.setDisposable(h),h.setDisposable(a.subscribe(n.onNext.bind(n),function(t){s=t,e()},n.onCompleted.bind(n)))}});return new Be(u,c,Qe(function(){o=!0}))})};var vn=dn.repeat=function(t,e){return null==e&&(e=-1),new dn(function(){var n=e;return new pn(function(){return 0===n?de:(n>0&&n--,{done:!1,value:t})})})},bn=dn.forEach=function(t,e,n){return e||(e=ne),new dn(function(){var r=-1;return new pn(function(){return++r<t.length?{done:!1,value:e.call(n,t[r],r,t)}:de})})},mn=te.Observer=function(){};mn.prototype.toNotifier=function(){var t=this;return function(e){return e.accept(t)}},mn.prototype.asObserver=function(){return new En(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},mn.prototype.checked=function(){return new xn(this)};var yn=mn.create=function(t,e,n){return t||(t=ee),e||(e=ue),n||(n=ee),new En(t,e,n)};mn.fromNotifier=function(t){return new En(function(e){return t(hn(e))},function(e){return t(ln(e))},function(){return t(fn())})},mn.notifyOn=function(t){return new Dn(t,this)};var wn,gn=te.internals.AbstractObserver=function(t){function e(){this.isStopped=!1,t.call(this)}return Ve(e,t),e.prototype.onNext=function(t){this.isStopped||this.next(t)},e.prototype.onError=function(t){this.isStopped||(this.isStopped=!0,this.error(t))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(t){return this.isStopped?!1:(this.isStopped=!0,this.error(t),!0)},e}(mn),En=te.AnonymousObserver=function(t){function e(e,n,r){t.call(this),this._onNext=e,this._onError=n,this._onCompleted=r}return Ve(e,t),e.prototype.next=function(t){this._onNext(t)},e.prototype.error=function(t){this._onError(t)},e.prototype.completed=function(){this._onCompleted()},e}(gn),xn=function(t){function e(e){t.call(this),this._observer=e,this._state=0}Ve(e,t);var n=e.prototype;return n.onNext=function(t){this.checkAccess();try{this._observer.onNext(t)}catch(e){throw e}finally{this._state=0}},n.onError=function(t){this.checkAccess();try{this._observer.onError(t)}catch(e){throw e}finally{this._state=2}},n.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(t){throw t}finally{this._state=2}},n.checkAccess=function(){if(1===this._state)throw Error("Re-entrancy detected");if(2===this._state)throw Error("Observer completed");0===this._state&&(this._state=1)},e}(mn),Cn=te.internals.ScheduledObserver=function(e){function n(t,n){e.call(this),this.scheduler=t,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Xe}return Ve(n,e),n.prototype.next=function(t){var e=this;this.queue.push(function(){e.observer.onNext(t)})},n.prototype.error=function(t){var e=this;this.queue.push(function(){e.observer.onError(t)})},n.prototype.completed=function(){var t=this;this.queue.push(function(){t.observer.onCompleted()})},n.prototype.ensureActive=function(){var e=!1,n=this;!this.hasFaulted&&this.queue.length>0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(gn),Dn=function(t){function e(){t.apply(this,arguments)}return Ve(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Cn),Sn=te.Observable=function(){function t(t){this._subscribe=t}return wn=t.prototype,wn.subscribe=wn.forEach=function(t,e,n){var r="object"==typeof t?t:yn(t,e,n);return this._subscribe(r)},t}();wn.observeOn=function(t){var e=this;return new ur(function(n){return e.subscribe(new Dn(t,n))})},wn.subscribeOn=function(t){var e=this;return new ur(function(n){var r=new Je,i=new Xe;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new f(t,e.subscribe(n)))})),i})};var _n=Sn.fromPromise=function(t){return new ur(function(e){return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),function(){t&&t.abort&&t.abort()}})};wn.toPromise=function(t){if(t||(t=te.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},wn.toArray=function(){var t=this;return new ur(function(e){var n=[];return t.subscribe(n.push.bind(n),e.onError.bind(e),function(){e.onNext(n),e.onCompleted()})})},Sn.create=Sn.createWithDisposable=function(t){return new ur(t)};var An=Sn.defer=function(t){return new ur(function(e){var n;try{n=t()}catch(r){return jn(r).subscribe(e)}return ce(n)&&(n=_n(n)),n.subscribe(e)})},Nn=Sn.empty=function(t){return t||(t=rn),new ur(function(e){return t.schedule(function(){e.onCompleted()})})},On=Sn.fromArray=function(t,e){return e||(e=on),new ur(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Sn.fromIterable=function(e,n){return n||(n=on),new ur(function(r){var i;try{i=e[fe]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},Sn.generate=function(e,n,r,i,o){return o||(o=on),new ur(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Rn=Sn.never=function(){return new ur(function(){return $e})};Sn.range=function(t,e,n){return n||(n=on),new ur(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Sn.repeat=function(t,e,n){return n||(n=on),null==e&&(e=-1),Wn(t,n).repeat(e)};var Wn=Sn["return"]=Sn.returnValue=function(t,e){return e||(e=rn),new ur(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},jn=Sn["throw"]=Sn.throwException=function(t,e){return e||(e=rn),new ur(function(n){return e.schedule(function(){n.onError(t)})})};Sn.using=function(t,e){return new ur(function(n){var r,i,o=$e;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new Be(jn(s).subscribe(n),o)}return new Be(i.subscribe(n),o)})},wn.amb=function(t){var e=this;return new ur(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new Je,a=new Je;return ce(t)&&(t=_n(t)),c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)
},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new Be(c,a)})},Sn.amb=function(){function t(t,e){return t.amb(e)}for(var e=Rn(),n=h(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},wn["catch"]=wn.catchException=function(t){return"function"==typeof t?p(this,t):kn([this,t])};var kn=Sn.catchException=Sn["catch"]=function(){var t=h(arguments,0);return bn(t).catchException()};wn.combineLatest=function(){var t=Te.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),qn.apply(this,t)};var qn=Sn.combineLatest=function(){var e=Te.call(arguments),n=e.pop();return Array.isArray(e[0])&&(e=e[0]),new ur(function(r){function i(e){var i;if(c[e]=!0,a||(a=c.every(ne))){try{i=n.apply(null,f)}catch(o){return r.onError(o),t}r.onNext(i)}else h.filter(function(t,n){return n!==e}).every(ne)&&r.onCompleted()}function o(t){h[t]=!0,h.every(ne)&&r.onCompleted()}for(var s=function(){return!1},u=e.length,c=l(u,s),a=!1,h=l(u,s),f=Array(u),p=Array(u),d=0;u>d;d++)(function(t){var n=e[t],s=new Je;ce(n)&&(n=_n(n)),s.setDisposable(n.subscribe(function(e){f[t]=e,i(t)},r.onError.bind(r),function(){o(t)})),p[t]=s})(d);return new Be(p)})};wn.concat=function(){var t=Te.call(arguments,0);return t.unshift(this),Pn.apply(this,t)};var Pn=Sn.concat=function(){var t=h(arguments,0);return bn(t).concat()};wn.concatObservable=wn.concatAll=function(){return this.merge(1)},wn.merge=function(t){if("number"!=typeof t)return Tn(this,t);var e=this;return new ur(function(n){var r=0,i=new Be,o=!1,s=[],u=function(t){var e=new Je;i.add(e),ce(t)&&(t=_n(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var Tn=Sn.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=Te.call(arguments,1)):(t=rn,e=Te.call(arguments,0)):(t=rn,e=Te.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),On(e,t).mergeObservable()};wn.mergeObservable=wn.mergeAll=function(){var t=this;return new ur(function(e){var n=new Be,r=!1,i=new Je;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new Je;n.add(i),ce(t)&&(t=_n(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},wn.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return Vn([this,t])};var Vn=Sn.onErrorResumeNext=function(){var t=h(arguments,0);return new ur(function(e){var n=0,r=new Xe,i=rn.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],ce(o)&&(o=_n(o)),s=new Je,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new Be(r,i)})};wn.skipUntil=function(t){var e=this;return new ur(function(n){var r=!1,i=new Be(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()}));ce(t)&&(t=_n(t));var o=new Je;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},wn["switch"]=wn.switchLatest=function(){var t=this;return new ur(function(e){var n=!1,r=new Xe,i=!1,o=0,s=t.subscribe(function(t){var s=new Je,u=++o;n=!0,r.setDisposable(s),ce(t)&&(t=_n(t)),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new Be(s,r)})},wn.takeUntil=function(t){var e=this;return new ur(function(n){return ce(t)&&(t=_n(t)),new Be(e.subscribe(n),t.subscribe(n.onCompleted.bind(n),n.onError.bind(n),ee))})},wn.zip=function(){if(Array.isArray(arguments[0]))return d.apply(this,arguments);var e=this,n=Te.call(arguments),r=n.pop();return n.unshift(e),new ur(function(i){function o(n){var o,s;if(c.every(function(t){return t.length>0})){try{s=c.map(function(t){return t.shift()}),o=r.apply(e,s)}catch(u){return i.onError(u),t}i.onNext(o)}else a.filter(function(t,e){return e!==n}).every(ne)&&i.onCompleted()}function s(t){a[t]=!0,a.every(function(t){return t})&&i.onCompleted()}for(var u=n.length,c=l(u,function(){return[]}),a=l(u,function(){return!1}),h=Array(u),f=0;u>f;f++)(function(t){var e=n[t],r=new Je;ce(e)&&(e=_n(e)),r.setDisposable(e.subscribe(function(e){c[t].push(e),o(t)},i.onError.bind(i),function(){s(t)})),h[t]=r})(f);return new Be(h)})},Sn.zip=function(){var t=Te.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Sn.zipArray=function(){var e=h(arguments,0);return new ur(function(n){function r(e){if(s.every(function(t){return t.length>0})){var r=s.map(function(t){return t.shift()});n.onNext(r)}else if(u.filter(function(t,n){return n!==e}).every(ne))return n.onCompleted(),t}function i(e){return u[e]=!0,u.every(ne)?(n.onCompleted(),t):t}for(var o=e.length,s=l(o,function(){return[]}),u=l(o,function(){return!1}),c=Array(o),a=0;o>a;a++)(function(t){c[t]=new Je,c[t].setDisposable(e[t].subscribe(function(e){s[t].push(e),r(t)},n.onError.bind(n),function(){i(t)}))})(a);var h=new Be(c);return h.add(Qe(function(){for(var t=0,e=s.length;e>t;t++)s[t]=[]})),h})},wn.asObservable=function(){var t=this;return new ur(function(e){return t.subscribe(e)})},wn.bufferWithCount=function(t,e){return"number"!=typeof e&&(e=t),this.windowWithCount(t,e).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},wn.dematerialize=function(){var t=this;return new ur(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},wn.distinctUntilChanged=function(e,n){var r=this;return e||(e=ne),n||(n=ie),new ur(function(i){var o,s=!1;return r.subscribe(function(r){var u,c=!1;try{u=e(r)}catch(a){return i.onError(a),t}if(s)try{c=n(o,u)}catch(a){return i.onError(a),t}s&&c||(s=!0,o=u,i.onNext(r))},i.onError.bind(i),i.onCompleted.bind(i))})},wn["do"]=wn.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new ur(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},wn["finally"]=wn.finallyAction=function(t){var e=this;return new ur(function(n){var r;try{r=e.subscribe(n)}catch(i){throw t(),i}return Qe(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},wn.ignoreElements=function(){var t=this;return new ur(function(e){return t.subscribe(ee,e.onError.bind(e),e.onCompleted.bind(e))})},wn.materialize=function(){var t=this;return new ur(function(e){return t.subscribe(function(t){e.onNext(hn(t))},function(t){e.onNext(ln(t)),e.onCompleted()},function(){e.onNext(fn()),e.onCompleted()})})},wn.repeat=function(t){return vn(this,t).concat()},wn.retry=function(t){return vn(this,t).catchException()},wn.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new ur(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},wn.skipLast=function(t){var e=this;return new ur(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},wn.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=rn,t=Te.call(arguments,n),bn([On(t,e),this]).concat()},wn.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return On(t,e)})},wn.takeLastBuffer=function(t){var e=this;return new ur(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},wn.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(he);if(1===arguments.length&&(e=t),0>=e)throw Error(he);return new ur(function(r){var i=new Je,o=new Ze(i),s=0,u=[],c=function(){var t=new hr;u.push(t),r.onNext(Le(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},wn.selectConcat=wn.concatMap=function(t,e){return e?this.concatMap(function(n,r){var i=t(n,r),o=ce(i)?_n(i):i;return o.map(function(t){return e(n,t,r)})}):"function"==typeof t?v.call(this,t):v.call(this,function(){return t})},wn.defaultIfEmpty=function(e){var n=this;return e===t&&(e=null),new ur(function(t){var r=!1;return n.subscribe(function(e){r=!0,t.onNext(e)},t.onError.bind(t),function(){r||t.onNext(e),t.onCompleted()})})},wn.distinct=function(e,n){var r=this;return e||(e=ne),n||(n=se),new ur(function(i){var o={};return r.subscribe(function(r){var s,u,c,a=!1;try{s=e(r),u=n(s)}catch(h){return i.onError(h),t}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,i.onNext(r))},i.onError.bind(i),i.onCompleted.bind(i))})},wn.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Rn()},n)},wn.groupByUntil=function(e,n,r,i){var o=this;return n||(n=ne),i||(i=se),new ur(function(s){var u={},c=new Be,a=new Ze(c);return c.add(o.subscribe(function(o){var h,l,f,p,d,v,b,m,y,w;try{v=e(o),b=i(v)}catch(g){for(w in u)u[w].onError(g);return s.onError(g),t}p=!1;try{y=u[b],y||(y=new hr,u[b]=y,p=!0)}catch(g){for(w in u)u[w].onError(g);return s.onError(g),t}if(p){d=new ar(v,y,a),l=new ar(v,y);try{h=r(l)}catch(g){for(w in u)u[w].onError(g);return s.onError(g),t}s.onNext(d),m=new Je,c.add(m);var E=function(){b in u&&(delete u[b],y.onCompleted()),c.remove(m)};m.setDisposable(h.take(1).subscribe(ee,function(t){for(w in u)u[w].onError(t);s.onError(t)},function(){E()}))}try{f=n(o)}catch(g){for(w in u)u[w].onError(g);return s.onError(g),t}y.onNext(f)},function(t){for(var e in u)u[e].onError(t);s.onError(t)},function(){for(var t in u)u[t].onCompleted();s.onCompleted()})),a})},wn.select=wn.map=function(e,n){var r=this;return new ur(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},wn.pluck=function(t){return this.select(function(e){return e[t]})},wn.selectMany=wn.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=ce(i)?_n(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?b.call(this,t):b.call(this,function(){return t})},wn.selectSwitch=wn.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},wn.skip=function(t){if(0>t)throw Error(he);var e=this;return new ur(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},wn.skipWhile=function(e,n){var r=this;return new ur(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},wn.take=function(t,e){if(0>t)throw Error(he);if(0===t)return Nn(e);var n=this;return new ur(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},wn.takeWhile=function(e,n){var r=this;return new ur(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},wn.where=wn.filter=function(e,n){var r=this;return new ur(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},wn.finalValue=function(){var t=this;return new ur(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(ae))})})},wn.aggregate=function(){var t,e,n;return 2===arguments.length?(t=arguments[0],e=!0,n=arguments[1]):n=arguments[0],e?this.scan(t,n).startWith(t).finalValue():this.scan(n).finalValue()},wn.reduce=function(t){var e,n;return 2===arguments.length&&(n=!0,e=arguments[1]),n?this.scan(e,t).startWith(e).finalValue():this.scan(t).finalValue()},wn.some=wn.any=function(t,e){var n=this;return t?n.where(t,e).any():new ur(function(t){return n.subscribe(function(){t.onNext(!0),t.onCompleted()},t.onError.bind(t),function(){t.onNext(!1),t.onCompleted()})})},wn.isEmpty=function(){return this.any().select(function(t){return!t})},wn.every=wn.all=function(t,e){return this.where(function(e){return!t(e)},e).any().select(function(t){return!t})},wn.contains=function(t,e){return e||(e=ie),this.where(function(n){return e(n,t)}).any()},wn.count=function(t,e){return t?this.where(t,e).count():this.aggregate(0,function(t){return t+1})},wn.sum=function(t,e){return t?this.select(t,e).sum():this.aggregate(0,function(t,e){return t+e})},wn.minBy=function(t,e){return e||(e=oe),m(this,t,function(t,n){return-1*e(t,n)})},wn.min=function(t){return this.minBy(ne,t).select(function(t){return y(t)})},wn.maxBy=function(t,e){return e||(e=oe),m(this,t,e)},wn.max=function(t){return this.maxBy(ne,t).select(function(t){return y(t)})},wn.average=function(t,e){return t?this.select(t,e).average():this.scan({sum:0,count:0},function(t,e){return{sum:t.sum+e,count:t.count+1}}).finalValue().select(function(t){if(0===t.count)throw Error("The input sequence was empty");return t.sum/t.count})},wn.sequenceEqual=function(e,n){var r=this;return n||(n=ie),Array.isArray(e)?w(r,e,n):new ur(function(i){var o=!1,s=!1,u=[],c=[],a=r.subscribe(function(e){var r,o;if(c.length>0){o=c.shift();try{r=n(o,e)}catch(a){return i.onError(a),t}r||(i.onNext(!1),i.onCompleted())}else s?(i.onNext(!1),i.onCompleted()):u.push(e)},i.onError.bind(i),function(){o=!0,0===u.length&&(c.length>0?(i.onNext(!1),i.onCompleted()):s&&(i.onNext(!0),i.onCompleted()))});ce(e)&&(e=_n(e));var h=e.subscribe(function(e){var r,s;if(u.length>0){s=u.shift();try{r=n(s,e)}catch(a){return i.onError(a),t}r||(i.onNext(!1),i.onCompleted())}else o?(i.onNext(!1),i.onCompleted()):c.push(e)},i.onError.bind(i),function(){s=!0,0===c.length&&(u.length>0?(i.onNext(!1),i.onCompleted()):o&&(i.onNext(!0),i.onCompleted()))});return new Be(a,h)})},wn.elementAt=function(t){return g(this,t,!1)},wn.elementAtOrDefault=function(t,e){return g(this,t,!0,e)},wn.single=function(t,e){return t?this.where(t,e).single():E(this,!1)},wn.singleOrDefault=function(t,e,n){return t?this.where(t,n).singleOrDefault(null,e):E(this,!0,e)},wn.first=function(t,e){return t?this.where(t,e).first():x(this,!1)},wn.firstOrDefault=function(t,e){return t?this.where(t).firstOrDefault(null,e):x(this,!0,e)},wn.last=function(t,e){return t?this.where(t,e).last():C(this,!1)},wn.lastOrDefault=function(t,e,n){return t?this.where(t,n).lastOrDefault(null,e):C(this,!0,e)},wn.find=function(t,e){return D(this,t,e,!1)},wn.findIndex=function(t,e){return D(this,t,e,!0)},Sn.start=function(t,e,n){return zn(t,e,n)()};var zn=Sn.toAsync=function(e,n,r){return n||(n=un),function(){var i=arguments,o=new lr;return n.schedule(function(){var n;try{n=e.apply(r,i)}catch(s){return o.onError(s),t}o.onNext(n),o.onCompleted()}),o.asObservable()}};Sn.fromCallback=function(e,n,r,i){return n||(n=rn),function(){var o=Te.call(arguments,0);return new ur(function(s){return n.schedule(function(){function n(e){var n=e;if(i)try{n=i(arguments)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},Sn.fromNodeCallback=function(e,n,r,i){return n||(n=rn),function(){var o=Te.call(arguments,0);return new ur(function(s){return n.schedule(function(){function n(e){if(e)return s.onError(e),t;var n=Te.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}};var Ln=J.angular&&angular.element?angular.element:J.jQuery?J.jQuery:J.Zepto?J.Zepto:null,Mn=!!J.Ember&&"function"==typeof J.Ember.addListener;Sn.fromEvent=function(e,n,r){if(Mn)return In(function(t){Ember.addListener(e,n,t)},function(t){Ember.removeListener(e,n,t)},r);if(Ln){var i=Ln(e);return In(function(t){i.on(n,t)},function(t){i.off(n,t)},r)}return new ur(function(i){return _(e,n,function(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)})}).publish().refCount()};var In=Sn.fromEventPattern=function(e,n,r){return new ur(function(i){function o(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)}var s=e(o);return Qe(function(){n&&n(o,s)})}).publish().refCount()};Sn.startAsync=function(t){var e;try{e=t()}catch(n){return jn(n)}return _n(e)};var Fn=function(t){function e(t){var e=this.source.publish(),n=e.subscribe(t),r=$e,i=this.subject.distinctUntilChanged().subscribe(function(t){t?r=e.connect():(r.dispose(),r=$e)});return new Be(n,r,i)}function n(n,r){this.source=n,this.subject=r||new hr,this.isPaused=!0,t.call(this,e)}return Ve(n,t),n.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},n.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},n}(Sn);wn.pausable=function(t){return new Fn(this,t)};var Bn=function(t){function e(t){var e=[],n=!0,r=A(this.source,this.subject.distinctUntilChanged(),function(t,e){return{data:t,shouldFire:e}}).subscribe(function(r){if(r.shouldFire&&n&&t.onNext(r.data),r.shouldFire&&!n){for(;e.length>0;)t.onNext(e.shift());n=!0}else r.shouldFire||n?!r.shouldFire&&n&&(n=!1):e.push(r.data)},function(n){for(;e.length>0;)t.onNext(e.shift());t.onError(n)},function(){for(;e.length>0;)t.onNext(e.shift());t.onCompleted()});return this.subject.onNext(!1),r}function n(n,r){this.source=n,this.subject=r||new hr,this.isPaused=!0,t.call(this,e)}return Ve(n,t),n.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},n.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},n}(Sn);wn.pausableBuffered=function(t){return new Bn(this,t)},wn.controlled=function(t){return null==t&&(t=!0),new Hn(this,t)};var Hn=function(t){function e(t){return this.source.subscribe(t)}function n(n,r){t.call(this,e),this.subject=new Un(r),this.source=n.multicast(this.subject).refCount()}return Ve(n,t),n.prototype.request=function(t){return null==t&&(t=-1),this.subject.request(t)},n}(Sn),Un=te.ControlledSubject=function(t){function n(t){return this.subject.subscribe(t)}function r(e){null==e&&(e=!0),t.call(this,n),this.subject=new hr,this.enableQueue=e,this.queue=e?[]:null,this.requestedCount=0,this.requestedDisposable=$e,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=$e}return Ve(r,t),ze(r.prototype,mn,{onCompleted:function(){e.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(t){e.call(this),this.hasFailed=!0,this.error=t,this.enableQueue&&0!==this.queue.length||this.subject.onError(t)},onNext:function(t){e.call(this);var n=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(t):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),n=!0),n&&this.subject.onNext(t)},_processRequest:function(t){if(this.enableQueue){for(;this.queue.length>=t&&t>0;)this.subject.onNext(this.queue.shift()),t--;return 0!==this.queue.length?{numberOfItems:t,returnValue:!0}:{numberOfItems:t,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=$e):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=$e),{numberOfItems:t,returnValue:!1}},request:function(t){e.call(this),this.disposeCurrentRequest();var n=this,r=this._processRequest(t);return t=r.numberOfItems,r.returnValue?$e:(this.requestedCount=t,this.requestedDisposable=Qe(function(){n.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=$e},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),r}(Sn);wn.multicast=function(t,e){var n=this;return"function"==typeof t?new ur(function(r){var i=n.multicast(t());return new Be(e(i).subscribe(r),i.connect())}):new Jn(n,t)},wn.publish=function(t){return t?this.multicast(function(){return new hr},t):this.multicast(new hr)},wn.share=function(){return this.publish(null).refCount()},wn.publishLast=function(t){return t?this.multicast(function(){return new lr},t):this.multicast(new lr)},wn.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new $n(e)},t):this.multicast(new $n(t))},wn.shareValue=function(t){return this.publishValue(t).refCount()},wn.replay=function(t,e,n,r){return t?this.multicast(function(){return new Kn(e,n,r)},t):this.multicast(new Kn(e,n,r))},wn.replayWhileObserved=function(t,e,n){return this.replay(null,t,e,n).refCount()};var Qn=function(t,e){this.subject=t,this.observer=e};Qn.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var $n=te.BehaviorSubject=function(t){function n(t){if(e.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new Qn(this,t);var n=this.exception;return n?t.onError(n):t.onCompleted(),$e}function r(e){t.call(this,n),this.value=e,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return Ve(r,t),ze(r.prototype,mn,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(e.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var n=0,r=t.length;r>n;n++)t[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){if(e.call(this),!this.isStopped){this.value=t;for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)n[r].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),r}(Sn),Kn=te.ReplaySubject=function(t){function n(t,e){this.subject=t,this.observer=e}function r(t){var r=new Cn(this.scheduler,t),i=new n(this,r);e.call(this),this._trim(this.scheduler.now()),this.observers.push(r);for(var o=this.q.length,s=0,u=this.q.length;u>s;s++)r.onNext(this.q[s].value);return this.hasError?(o++,r.onError(this.error)):this.isStopped&&(o++,r.onCompleted()),r.ensureActive(o),i}function i(e,n,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==n?Number.MAX_VALUE:n,this.scheduler=i||on,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,r)}return n.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},Ve(i,t),ze(i.prototype,mn,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var n;if(e.call(this),!this.isStopped){var r=this.scheduler.now();this.q.push({interval:r,value:t}),this._trim(r);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)n=i[o],n.onNext(t),n.ensureActive()}},onError:function(t){var n;if(e.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var r=this.scheduler.now();this._trim(r);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)n=i[o],n.onError(t),n.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(e.call(this),!this.isStopped){this.isStopped=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)t=r[i],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),i}(Sn),Jn=te.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new Be(i.source.subscribe(i.subject),Qe(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return Ve(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new ur(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),Qe(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(Sn),Xn=[1,3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143,4194301,8388593,16777213,33554393,67108859,134217689,268435399,536870909,1073741789,2147483647],Zn="no such key",Gn="duplicate key",Yn=function(){var t=0;return function(e){if(null==e)throw Error(Zn);if("string"==typeof e)return R(e);if("number"==typeof e)return W(e);if("boolean"==typeof e)return e===!0?1:0;if(e instanceof Date)return e.getTime();if(e.getHashCode)return e.getHashCode();var n=17*t++;return e.getHashCode=function(){return n},n}}(),tr=function(t,e){if(0>t)throw Error("out of range");t>0&&this._initialize(t),this.comparer=e||ie,this.freeCount=0,this.size=0,this.freeList=-1};tr.prototype._initialize=function(t){var e,n=O(t);for(this.buckets=Array(n),this.entries=Array(n),e=0;n>e;e++)this.buckets[e]=-1,this.entries[e]=j();this.freeList=-1},tr.prototype.count=function(){return this.size},tr.prototype.add=function(t,e){return this._insert(t,e,!0)},tr.prototype._insert=function(e,n,r){this.buckets||this._initialize(0);for(var i,o=2147483647&Yn(e),s=o%this.buckets.length,u=this.buckets[s];u>=0;u=this.entries[u].next)if(this.entries[u].hashCode===o&&this.comparer(this.entries[u].key,e)){if(r)throw Error(Gn);return this.entries[u].value=n,t}this.freeCount>0?(i=this.freeList,this.freeList=this.entries[i].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),s=o%this.buckets.length),i=this.size,++this.size),this.entries[i].hashCode=o,this.entries[i].next=this.buckets[s],this.entries[i].key=e,this.entries[i].value=n,this.buckets[s]=i},tr.prototype._resize=function(){var t=O(2*this.size),e=Array(t);for(r=0;e.length>r;++r)e[r]=-1;var n=Array(t);for(r=0;this.size>r;++r)n[r]=this.entries[r];for(var r=this.size;t>r;++r)n[r]=j();for(var i=0;this.size>i;++i){var o=n[i].hashCode%t;n[i].next=e[o],e[o]=i}this.buckets=e,this.entries=n},tr.prototype.remove=function(t){if(this.buckets)for(var e=2147483647&Yn(t),n=e%this.buckets.length,r=-1,i=this.buckets[n];i>=0;i=this.entries[i].next){if(this.entries[i].hashCode===e&&this.comparer(this.entries[i].key,t))return 0>r?this.buckets[n]=this.entries[i].next:this.entries[r].next=this.entries[i].next,this.entries[i].hashCode=-1,this.entries[i].next=this.freeList,this.entries[i].key=null,this.entries[i].value=null,this.freeList=i,++this.freeCount,!0;r=i}return!1},tr.prototype.clear=function(){var t,e;if(!(0>=this.size)){for(t=0,e=this.buckets.length;e>t;++t)this.buckets[t]=-1;for(t=0;this.size>t;++t)this.entries[t]=j();this.freeList=-1,this.size=0}},tr.prototype._findEntry=function(t){if(this.buckets)for(var e=2147483647&Yn(t),n=this.buckets[e%this.buckets.length];n>=0;n=this.entries[n].next)if(this.entries[n].hashCode===e&&this.comparer(this.entries[n].key,t))return n;return-1},tr.prototype.count=function(){return this.size-this.freeCount},tr.prototype.tryGetValue=function(e){var n=this._findEntry(e);return n>=0?this.entries[n].value:t},tr.prototype.getValues=function(){var t=0,e=[];if(this.entries)for(var n=0;this.size>n;n++)this.entries[n].hashCode>=0&&(e[t++]=this.entries[n].value);return e},tr.prototype.get=function(t){var e=this._findEntry(t);if(e>=0)return this.entries[e].value;throw Error(Zn)},tr.prototype.set=function(t,e){this._insert(t,e,!1)},tr.prototype.containskey=function(t){return this._findEntry(t)>=0},wn.join=function(e,n,r,i){var o=this;return new ur(function(s){var u=new Be,c=!1,a=0,h=new tr,l=!1,f=0,p=new tr;return u.add(o.subscribe(function(e){var r,o,l,f,d=a++,v=new Je;h.add(d,e),u.add(v),o=function(){return h.remove(d)&&0===h.count()&&c&&s.onCompleted(),u.remove(v)};try{r=n(e)}catch(b){return s.onError(b),t}v.setDisposable(r.take(1).subscribe(ee,s.onError.bind(s),function(){o()})),f=p.getValues();for(var m=0;f.length>m;m++){try{l=i(e,f[m])}catch(y){return s.onError(y),t}s.onNext(l)}},s.onError.bind(s),function(){c=!0,(l||0===h.count())&&s.onCompleted()})),u.add(e.subscribe(function(e){var n,o,c,a,d=f++,v=new Je;p.add(d,e),u.add(v),o=function(){return p.remove(d)&&0===p.count()&&l&&s.onCompleted(),u.remove(v)};try{n=r(e)}catch(b){return s.onError(b),t}v.setDisposable(n.take(1).subscribe(ee,s.onError.bind(s),function(){o()})),a=h.getValues();for(var m=0;a.length>m;m++){try{c=i(a[m],e)}catch(b){return s.onError(b),t}s.onNext(c)}},s.onError.bind(s),function(){l=!0,(c||0===p.count())&&s.onCompleted()})),u})},wn.groupJoin=function(e,n,r,i){var o=this;return new ur(function(s){var u=function(){},c=new Be,a=new Ze(c),h=new tr,l=new tr,f=0,p=0;return c.add(o.subscribe(function(e){var r=new hr,o=f++;h.add(o,r);var p,d,v,b,m;try{m=i(e,Le(r,a))}catch(y){for(v=h.getValues(),p=0,d=v.length;d>p;p++)v[p].onError(y);return s.onError(y),t}for(s.onNext(m),b=l.getValues(),p=0,d=b.length;d>p;p++)r.onNext(b[p]);var w=new Je;c.add(w);var g,E=function(){h.remove(o)&&r.onCompleted(),c.remove(w)};try{g=n(e)}catch(y){for(v=h.getValues(),p=0,d=h.length;d>p;p++)v[p].onError(y);return s.onError(y),t}w.setDisposable(g.take(1).subscribe(u,function(t){for(v=h.getValues(),p=0,d=v.length;d>p;p++)v[p].onError(t);s.onError(t)},E))},function(t){for(var e=h.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)},s.onCompleted.bind(s))),c.add(e.subscribe(function(e){var n,i,o,a=p++;l.add(a,e);var f=new Je;c.add(f);var d,v=function(){l.remove(a),c.remove(f)};try{d=r(e)}catch(b){for(n=h.getValues(),i=0,o=h.length;o>i;i++)n[i].onError(b);return s.onError(b),t}for(f.setDisposable(d.take(1).subscribe(u,function(t){for(n=h.getValues(),i=0,o=h.length;o>i;i++)n[i].onError(t);s.onError(t)},v)),n=h.getValues(),i=0,o=n.length;o>i;i++)n[i].onNext(e)},function(t){for(var e=h.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)})),a})},wn.buffer=function(){return this.window.apply(this,arguments).selectMany(function(t){return t.toArray()})},wn.window=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?q.call(this,t):"function"==typeof t?P.call(this,t):k.call(this,t,e)},wn.pairwise=function(){var t=this;return new ur(function(e){var n,r=!1;return t.subscribe(function(t){r?e.onNext([n,t]):r=!0,n=t},e.onError.bind(e),e.onCompleted.bind(e))})},wn.partition=function(t,e){var n=this.publish().refCount();return[n.filter(t,e),n.filter(function(n,r,i){return!t.call(e,n,r,i)})]},wn.letBind=wn.let=function(t){return t(this)},Sn["if"]=Sn.ifThen=function(t,e,n){return An(function(){return n||(n=Nn()),ce(e)&&(e=_n(e)),ce(n)&&(n=_n(n)),"function"==typeof n.now&&(n=Nn(n)),t()?e:n})},Sn["for"]=Sn.forIn=function(t,e){return bn(t,e).concat()};var er=Sn["while"]=Sn.whileDo=function(t,e){return ce(e)&&(e=_n(e)),T(t,e).concat()};wn.doWhile=function(t){return Pn([this,er(t,this)])},Sn["case"]=Sn.switchCase=function(t,e,n){return An(function(){n||(n=Nn()),"function"==typeof n.now&&(n=Nn(n));var r=e[t()];return ce(r)&&(r=_n(r)),r||n})},wn.expand=function(e,n){n||(n=rn);var r=this;return new ur(function(i){var o=[],s=new Xe,u=new Be(s),c=0,a=!1,h=function(){var r=!1;
o.length>0&&(r=!a,a=!0),r&&s.setDisposable(n.scheduleRecursive(function(n){var r;if(!(o.length>0))return a=!1,t;r=o.shift();var s=new Je;u.add(s),s.setDisposable(r.subscribe(function(t){i.onNext(t);var n=null;try{n=e(t)}catch(r){i.onError(r)}o.push(n),c++,h()},i.onError.bind(i),function(){u.remove(s),c--,0===c&&i.onCompleted()})),n()}))};return o.push(r),c++,h(),u})},Sn.forkJoin=function(){var e=h(arguments,0);return new ur(function(n){var r=e.length;if(0===r)return n.onCompleted(),$e;for(var i=new Be,o=!1,s=Array(r),u=Array(r),c=Array(r),a=0;r>a;a++)(function(a){var h=e[a];ce(h)&&(h=_n(h)),i.add(h.subscribe(function(t){o||(s[a]=!0,c[a]=t)},function(t){o=!0,n.onError(t),i.dispose()},function(){if(!o){if(!s[a])return n.onCompleted(),t;u[a]=!0;for(var e=0;r>e;e++)if(!u[e])return;o=!0,n.onNext(c),n.onCompleted()}}))})(a);return i})},wn.forkJoin=function(e,n){var r=this;return new ur(function(i){var o,s,u=!1,c=!1,a=!1,h=!1,l=new Je,f=new Je;return ce(e)&&(e=_n(e)),l.setDisposable(r.subscribe(function(t){a=!0,o=t},function(t){f.dispose(),i.onError(t)},function(){if(u=!0,c)if(a)if(h){var e;try{e=n(o,s)}catch(r){return i.onError(r),t}i.onNext(e),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),f.setDisposable(e.subscribe(function(t){h=!0,s=t},function(t){l.dispose(),i.onError(t)},function(){if(c=!0,u)if(a)if(h){var e;try{e=n(o,s)}catch(r){return i.onError(r),t}i.onNext(e),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),new Be(l,f)})},wn.manySelect=function(t,e){e||(e=rn);var n=this;return An(function(){var r;return n.select(function(t){var e=new nr(t);return r&&r.onNext(t),r=e,e}).doAction(ee,function(t){r&&r.onError(t)},function(){r&&r.onCompleted()}).observeOn(e).select(function(e,n,r){return t(e,n,r)})})};var nr=function(t){function e(t){var e=this,n=new Be;return n.add(on.schedule(function(){t.onNext(e.head),n.add(e.tail.mergeObservable().subscribe(t))})),n}function n(n){t.call(this,e),this.head=n,this.tail=new lr}return Ve(n,t),ze(n.prototype,mn,{onCompleted:function(){this.onNext(Sn.empty())},onError:function(t){this.onNext(Sn.throwException(t))},onNext:function(t){this.tail.onNext(t),this.tail.onCompleted()}}),n}(Sn),rr=function(){function t(){this.keys=[],this.values=[]}return t.prototype["delete"]=function(t){var e=this.keys.indexOf(t);return-1!==e&&(this.keys.splice(e,1),this.values.splice(e,1)),-1!==e},t.prototype.get=function(t,e){var n=this.keys.indexOf(t);return-1!==n?this.values[n]:e},t.prototype.set=function(t,e){var n=this.keys.indexOf(t);-1!==n&&(this.values[n]=e),this.values[this.keys.push(t)-1]=e},t.prototype.size=function(){return this.keys.length},t.prototype.has=function(t){return-1!==this.keys.indexOf(t)},t.prototype.getKeys=function(){return this.keys.slice(0)},t.prototype.getValues=function(){return this.values.slice(0)},t}();V.prototype.and=function(t){var e=this.patterns.slice(0);return e.push(t),new V(e)},V.prototype.then=function(t){return new z(this,t)},z.prototype.activate=function(e,n,r){for(var i=this,o=[],s=0,u=this.expression.patterns.length;u>s;s++)o.push(L(e,this.expression.patterns[s],n.onError.bind(n)));var c=new M(o,function(){var e;try{e=i.selector.apply(i,arguments)}catch(r){return n.onError(r),t}n.onNext(e)},function(){for(var t=0,e=o.length;e>t;t++)o[t].removeActivePlan(c);r(c)});for(s=0,u=o.length;u>s;s++)o[s].addActivePlan(c);return c},M.prototype.dequeue=function(){for(var t=this.joinObservers.getValues(),e=0,n=t.length;n>e;e++)t[e].queue.shift()},M.prototype.match=function(){var t,e,n,r,i,o=!0;for(e=0,n=this.joinObserverArray.length;n>e;e++)if(0===this.joinObserverArray[e].queue.length){o=!1;break}if(o){for(t=[],r=!1,e=0,n=this.joinObserverArray.length;n>e;e++)t.push(this.joinObserverArray[e].queue[0]),"C"===this.joinObserverArray[e].queue[0].kind&&(r=!0);if(r)this.onCompleted();else{for(this.dequeue(),i=[],e=0;t.length>e;e++)i.push(t[e].value);this.onNext.apply(this,i)}}};var ir=function(e){function n(t,n){e.call(this),this.source=t,this.onError=n,this.queue=[],this.activePlans=[],this.subscription=new Je,this.isDisposed=!1}Ve(n,e);var r=n.prototype;return r.next=function(e){if(!this.isDisposed){if("E"===e.kind)return this.onError(e.exception),t;this.queue.push(e);for(var n=this.activePlans.slice(0),r=0,i=n.length;i>r;r++)n[r].match()}},r.error=ee,r.completed=ee,r.addActivePlan=function(t){this.activePlans.push(t)},r.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},r.removeActivePlan=function(t){var e=this.activePlans.indexOf(t);this.activePlans.splice(e,1),0===this.activePlans.length&&this.dispose()},r.dispose=function(){e.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},n}(gn);wn.and=function(t){return new V([this,t])},wn.then=function(t){return new V([this]).then(t)},Sn.when=function(){var t=h(arguments,0);return new ur(function(e){var n,r,i,o,s,u,c=[],a=new rr;u=yn(e.onNext.bind(e),function(t){for(var n=a.getValues(),r=0,i=n.length;i>r;r++)n[r].onError(t);e.onError(t)},e.onCompleted.bind(e));try{for(r=0,i=t.length;i>r;r++)c.push(t[r].activate(a,u,function(t){var e=c.indexOf(t);c.splice(e,1),0===c.length&&u.onCompleted()}))}catch(h){jn(h).subscribe(e)}for(n=new Be,s=a.getValues(),r=0,i=s.length;i>r;r++)o=s[r],o.subscribe(),n.add(o);return n})};var or=Sn.interval=function(t,e){return e||(e=un),H(t,t,e)},sr=Sn.timer=function(e,n,r){var i;return r||(r=un),n!==t&&"number"==typeof n?i=n:n!==t&&"object"==typeof n&&(r=n),e instanceof Date&&i===t?I(e.getTime(),r):e instanceof Date&&i!==t?(i=n,F(e.getTime(),i,r)):i===t?B(e,r):H(e,i,r)};wn.delay=function(t,e){return e||(e=un),t instanceof Date?Q.call(this,t.getTime(),e):U.call(this,t,e)},wn.throttle=function(t,e){return e||(e=un),this.throttleWithSelector(function(){return sr(t,e)})},wn.windowWithTime=function(e,n,r){var i,o=this;return n===t&&(i=e),r===t&&(r=un),"number"==typeof n?i=n:"object"==typeof n&&(i=e,r=n),new ur(function(t){function n(){var e=new Je,o=!1,s=!1;l.setDisposable(e),a===c?(o=!0,s=!0):c>a?o=!0:s=!0;var p=o?a:c,d=p-f;f=p,o&&(a+=i),s&&(c+=i),e.setDisposable(r.scheduleWithRelative(d,function(){var e;s&&(e=new hr,h.push(e),t.onNext(Le(e,u))),o&&(e=h.shift(),e.onCompleted()),n()}))}var s,u,c=i,a=e,h=[],l=new Xe,f=0;return s=new Be(l),u=new Ze(s),h.push(new hr),t.onNext(Le(h[0],u)),n(),s.add(o.subscribe(function(t){var e,n;for(e=0;h.length>e;e++)n=h[e],n.onNext(t)},function(e){var n,r;for(n=0;h.length>n;n++)r=h[n],r.onError(e);t.onError(e)},function(){var e,n;for(e=0;h.length>e;e++)n=h[e],n.onCompleted();t.onCompleted()})),u})},wn.windowWithTimeOrCount=function(t,e,n){var r=this;return n||(n=un),new ur(function(i){var o,s,u,c,a=0,h=new Xe,l=0;return s=new Be(h),u=new Ze(s),o=function(e){var r=new Je;h.setDisposable(r),r.setDisposable(n.scheduleWithRelative(t,function(){var t;e===l&&(a=0,t=++l,c.onCompleted(),c=new hr,i.onNext(Le(c,u)),o(t))}))},c=new hr,i.onNext(Le(c,u)),o(0),s.add(r.subscribe(function(t){var n=0,r=!1;c.onNext(t),a++,a===e&&(r=!0,a=0,n=++l,c.onCompleted(),c=new hr,i.onNext(Le(c,u))),r&&o(n)},function(t){c.onError(t),i.onError(t)},function(){c.onCompleted(),i.onCompleted()})),u})},wn.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(t){return t.toArray()})},wn.bufferWithTimeOrCount=function(t,e,n){return this.windowWithTimeOrCount(t,e,n).selectMany(function(t){return t.toArray()})},wn.timeInterval=function(t){var e=this;return t||(t=un),An(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},wn.timestamp=function(t){return t||(t=un),this.select(function(e){return{value:e,timestamp:t.now()}})},wn.sample=function(t,e){return e||(e=un),"number"==typeof t?$(this,or(t,e)):$(this,t)},wn.timeout=function(t,e,n){e||(e=jn(Error("Timeout"))),n||(n=un);var r=this,i=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new ur(function(o){var s=0,u=new Je,c=new Xe,a=!1,h=new Xe;c.setDisposable(u);var l=function(){var r=s;h.setDisposable(n[i](t,function(){s===r&&(ce(e)&&(e=_n(e)),c.setDisposable(e.subscribe(o)))}))};return l(),u.setDisposable(r.subscribe(function(t){a||(s++,o.onNext(t),l())},function(t){a||(s++,o.onError(t))},function(){a||(s++,o.onCompleted())})),new Be(c,h)})},Sn.generateWithAbsoluteTime=function(e,n,r,i,o,s){return s||(s=un),new ur(function(u){var c,a,h=!0,l=!1,f=e;return s.scheduleRecursiveWithAbsolute(s.now(),function(e){l&&u.onNext(c);try{h?h=!1:f=r(f),l=n(f),l&&(c=i(f),a=o(f))}catch(s){return u.onError(s),t}l?e(a):u.onCompleted()})})},Sn.generateWithRelativeTime=function(e,n,r,i,o,s){return s||(s=un),new ur(function(u){var c,a,h=!0,l=!1,f=e;return s.scheduleRecursiveWithRelative(0,function(e){l&&u.onNext(c);try{h?h=!1:f=r(f),l=n(f),l&&(c=i(f),a=o(f))}catch(s){return u.onError(s),t}l?e(a):u.onCompleted()})})},wn.delaySubscription=function(t,e){return e||(e=un),this.delayWithSelector(sr(t,e),function(){return Nn()})},wn.delayWithSelector=function(e,n){var r,i,o=this;return"function"==typeof e?i=e:(r=e,i=n),new ur(function(e){var n=new Be,s=!1,u=function(){s&&0===n.length&&e.onCompleted()},c=new Xe,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return e.onError(s),t}var c=new Je;n.add(c),c.setDisposable(o.subscribe(function(){e.onNext(r),n.remove(c),u()},e.onError.bind(e),function(){e.onNext(r),n.remove(c),u()}))},e.onError.bind(e),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},e.onError.bind(e),function(){a()})):a(),new Be(c,n)})},wn.timeoutWithSelector=function(e,n,r){if(1===arguments.length){n=e;var e=Rn()}r||(r=jn(Error("Timeout")));var i=this;return new ur(function(o){var s=new Xe,u=new Xe,c=new Je;s.setDisposable(c);var a=0,h=!1,l=function(t){var e=a,n=function(){return a===e},i=new Je;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};l(e);var f=function(){var t=!h;return t&&a++,t};return c.setDisposable(i.subscribe(function(e){if(f()){o.onNext(e);var r;try{r=n(e)}catch(i){return o.onError(i),t}l(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new Be(s,u)})},wn.throttleWithSelector=function(e){var n=this;return new ur(function(r){var i,o=!1,s=new Xe,u=0,c=n.subscribe(function(n){var c;try{c=e(n)}catch(a){return r.onError(a),t}o=!0,i=n,u++;var h=u,l=new Je;s.setDisposable(l),l.setDisposable(c.subscribe(function(){o&&u===h&&r.onNext(i),o=!1,l.dispose()},r.onError.bind(r),function(){o&&u===h&&r.onNext(i),o=!1,l.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new Be(c,s)})},wn.skipLastWithTime=function(t,e){e||(e=un);var n=this;return new ur(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},wn.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return On(t,n)})},wn.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=un),new ur(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},wn.takeWithTime=function(t,e){var n=this;return e||(e=un),new ur(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new Be(i,n.subscribe(r))})},wn.skipWithTime=function(t,e){var n=this;return e||(e=un),new ur(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new Be(o,s)})},wn.skipUntilWithTime=function(t,e){e||(e=un);var n=this,r=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new ur(function(i){var o=!1;return new Be(e[r](t,function(){o=!0}),n.subscribe(function(t){o&&i.onNext(t)},i.onError.bind(i),i.onCompleted.bind(i)))})},wn.takeUntilWithTime=function(t,e){e||(e=un);var n=this,r=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new ur(function(i){return new Be(e[r](t,function(){i.onCompleted()}),n.subscribe(i))})},te.VirtualTimeScheduler=function(t){function e(){throw Error("Not implemented")}function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function s(t,e){return e(),$e}function u(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new Ie(1024),t.call(this,n,r,i,o)}Ve(u,t);var c=u.prototype;return c.add=e,c.toDateTimeOffset=e,c.toRelative=e,c.schedulePeriodicWithState=function(t,e,n){var r=new nn(this,t,e,n);return r.start()},c.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},c.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,s)},c.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},c.stop=function(){this.isEnabled=!1},c.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(he);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},c.advanceBy=function(t){var e=this.add(this.clock,t),n=this.comparer(this.clock,e);if(n>0)throw Error(he);0!==n&&this.advanceTo(e)},c.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(he);this.clock=e},c.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},c.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,s)},c.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new Ge(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},u}(tn),te.HistoricalScheduler=function(t){function e(e,n){var r=null==e?0:e,i=n||oe;t.call(this,r,i)}Ve(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(te.VirtualTimeScheduler);var ur=te.AnonymousObservable=function(e){function n(e){return e===t?e=$e:"function"==typeof e&&(e=Qe(e)),e}function r(i){function o(t){var e=new cr(t);if(on.scheduleRequired())on.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(e.call(this,o),t):new r(i)}return Ve(r,e),r}(Sn),cr=function(t){function e(e){t.call(this),this.observer=e,this.m=new Je}Ve(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(gn),ar=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new ur(function(t){return new Be(i.getDisposable(),r.subscribe(t))}):r}return Ve(n,t),n}(Sn),hr=te.Subject=function(t){function n(t){return e.call(this),this.isStopped?this.exception?(t.onError(this.exception),$e):(t.onCompleted(),$e):(this.observers.push(t),new Qn(this,t))}function r(){t.call(this,n),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return Ve(r,t),ze(r.prototype,mn,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(e.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var n=0,r=t.length;r>n;n++)t[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){if(e.call(this),!this.isStopped)for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)n[r].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(t,e){return new fr(t,e)},r}(Sn),lr=te.AsyncSubject=function(t){function n(t){if(e.call(this),!this.isStopped)return this.observers.push(t),new Qn(this,t);var n=this.exception,r=this.hasValue,i=this.value;return n?t.onError(n):r?(t.onNext(i),t.onCompleted()):t.onCompleted(),$e}function r(){t.call(this,n),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return Ve(r,t),ze(r.prototype,mn,{hasObservers:function(){return e.call(this),this.observers.length>0},onCompleted:function(){var t,n,r;if(e.call(this),!this.isStopped){this.isStopped=!0;var i=this.observers.slice(0),o=this.value,s=this.hasValue;if(s)for(n=0,r=i.length;r>n;n++)t=i[n],t.onNext(o),t.onCompleted();else for(n=0,r=i.length;r>n;n++)i[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){e.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(Sn),fr=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return Ve(n,t),ze(n.prototype,mn,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Sn);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(J.Rx=te,define(function(){return te})):X&&Z?G?(Z.exports=te).Rx=te:X.Rx=te:J.Rx=te}).call(this); | hhbyyh/cdnjs | ajax/libs/rxjs/2.2.27/rx.all.min.js | JavaScript | mit | 82,847 |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
/**
* Validator for Callback constraint
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @api
*/
class CallbackValidator extends ConstraintValidator
{
/**
* {@inheritDoc}
*/
public function validate($object, Constraint $constraint)
{
if (null === $object) {
return;
}
// has to be an array so that we can differentiate between callables
// and method names
if (!is_array($constraint->methods)) {
throw new UnexpectedTypeException($constraint->methods, 'array');
}
$methods = $constraint->methods;
foreach ($methods as $method) {
if (is_array($method) || $method instanceof \Closure) {
if (!is_callable($method)) {
throw new ConstraintDefinitionException(sprintf('"%s::%s" targeted by Callback constraint is not a valid callable', $method[0], $method[1]));
}
call_user_func($method, $object, $this->context);
} else {
if (!method_exists($object, $method)) {
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist', $method));
}
$object->$method($this->context);
}
}
}
}
| SoukainaEZZAMANE/SymfonyProject | vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CallbackValidator.php | PHP | mit | 1,862 |
/*
* blueimp Gallery YouTube Video Factory JS 1.1.1
* https://github.com/blueimp/Gallery
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
/* global define, window, document, YT */
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define([
'./blueimp-helper',
'./blueimp-gallery-video'
], factory);
} else {
// Browser globals:
factory(
window.blueimp.helper || window.jQuery,
window.blueimp.Gallery
);
}
}(function ($, Gallery) {
'use strict';
if (!window.postMessage) {
return Gallery;
}
$.extend(Gallery.prototype.options, {
// The list object property (or data attribute) with the YouTube video id:
youTubeVideoIdProperty: 'youtube',
// Optional object with parameters passed to the YouTube video player:
// https://developers.google.com/youtube/player_parameters
youTubePlayerVars: undefined,
// Require a click on the native YouTube player for the initial playback:
youTubeClickToPlay: true
});
var textFactory = Gallery.prototype.textFactory || Gallery.prototype.imageFactory,
YouTubePlayer = function (videoId, playerVars, clickToPlay) {
this.videoId = videoId;
this.playerVars = playerVars;
this.clickToPlay = clickToPlay;
this.element = document.createElement('div');
this.listeners = {};
};
$.extend(YouTubePlayer.prototype, {
canPlayType: function () {
return true;
},
on: function (type, func) {
this.listeners[type] = func;
return this;
},
loadAPI: function () {
var that = this,
onYouTubeIframeAPIReady = window.onYouTubeIframeAPIReady,
apiUrl = '//www.youtube.com/iframe_api',
scriptTags = document.getElementsByTagName('script'),
i = scriptTags.length,
scriptTag;
window.onYouTubeIframeAPIReady = function () {
if (onYouTubeIframeAPIReady) {
onYouTubeIframeAPIReady.apply(this);
}
if (that.playOnReady) {
that.play();
}
};
while (i) {
i -= 1;
if (scriptTags[i].src === apiUrl) {
return;
}
}
scriptTag = document.createElement('script');
scriptTag.src = apiUrl;
scriptTags[0].parentNode.insertBefore(scriptTag, scriptTags[0]);
},
onReady: function () {
this.ready = true;
if (this.playOnReady) {
this.play();
}
},
onPlaying: function () {
if (this.playStatus < 2) {
this.listeners.playing();
this.playStatus = 2;
}
},
onPause: function () {
Gallery.prototype.setTimeout.call(
this,
this.checkSeek,
null,
2000
);
},
checkSeek: function () {
if (this.stateChange === YT.PlayerState.PAUSED ||
this.stateChange === YT.PlayerState.ENDED) {
// check if current state change is actually paused
this.listeners.pause();
delete this.playStatus;
}
},
onStateChange: function (event) {
switch (event.data) {
case YT.PlayerState.PLAYING:
this.hasPlayed = true;
this.onPlaying();
break;
case YT.PlayerState.PAUSED:
case YT.PlayerState.ENDED:
this.onPause();
break;
}
// Save most recent state change to this.stateChange
this.stateChange = event.data;
},
onError: function (event) {
this.listeners.error(event);
},
play: function () {
var that = this;
if (!this.playStatus) {
this.listeners.play();
this.playStatus = 1;
}
if (this.ready) {
if (!this.hasPlayed && (this.clickToPlay || (window.navigator &&
/iP(hone|od|ad)/.test(window.navigator.platform)))) {
// Manually trigger the playing callback if clickToPlay
// is enabled and to workaround a limitation in iOS,
// which requires synchronous user interaction to start
// the video playback:
this.onPlaying();
} else {
this.player.playVideo();
}
} else {
this.playOnReady = true;
if (!(window.YT && YT.Player)) {
this.loadAPI();
} else if (!this.player) {
this.player = new YT.Player(this.element, {
videoId: this.videoId,
playerVars: this.playerVars,
events: {
onReady: function () {
that.onReady();
},
onStateChange: function (event) {
that.onStateChange(event);
},
onError: function (event) {
that.onError(event);
}
}
});
}
}
},
pause: function () {
if (this.ready) {
this.player.pauseVideo();
} else if (this.playStatus) {
delete this.playOnReady;
this.listeners.pause();
delete this.playStatus;
}
}
});
$.extend(Gallery.prototype, {
YouTubePlayer: YouTubePlayer,
textFactory: function (obj, callback) {
var videoId = this.getItemProperty(obj, this.options.youTubeVideoIdProperty);
if (videoId) {
return this.videoFactory(
obj,
callback,
new YouTubePlayer(
videoId,
this.options.youTubePlayerVars,
this.options.youTubeClickToPlay
)
);
}
return textFactory.call(this, obj, callback);
}
});
return Gallery;
}));
| bryantrobbins/cdnjs | ajax/libs/blueimp-gallery/2.12.2/js/blueimp-gallery-youtube.js | JavaScript | mit | 6,923 |
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Common\Proxy\Exception;
use Doctrine\Common\Persistence\Proxy;
use OutOfBoundsException as BaseOutOfBoundsException;
/**
* Proxy Invalid Argument Exception.
*
* @link www.doctrine-project.org
* @author Fredrik Wendel <fredrik_w@users.sourceforge.net>
*/
class OutOfBoundsException extends BaseOutOfBoundsException implements ProxyException
{
/**
* @param string $className
* @param string $idField
*
* @return self
*/
public static function missingPrimaryKeyValue($className, $idField)
{
return new self(sprintf("Missing value for primary key %s on %s", $idField, $className));
}
}
| chrisVdd/Time2web | vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/OutOfBoundsException.php | PHP | mit | 1,648 |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
/**
* Adds configured formats to each request
*
* @author Gildas Quemener <gildas.quemener@gmail.com>
*/
class AddRequestFormatsListener implements EventSubscriberInterface
{
/**
* @var array
*/
protected $formats;
/**
* @param array $formats
*/
public function __construct(array $formats)
{
$this->formats = $formats;
}
/**
* Adds request formats
*
* @param GetResponseEvent $event
*/
public function onKernelRequest(GetResponseEvent $event)
{
foreach ($this->formats as $format => $mimeTypes) {
$event->getRequest()->setFormat($format, $mimeTypes);
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
return array(KernelEvents::REQUEST => 'onKernelRequest');
}
}
| MariamAdid/todo-exam | vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php | PHP | mit | 1,306 |
var BaseCommand = require('./base_command').BaseCommand,
inherits = require('util').inherits,
binaryutils = require('../utils');
/**
Get More Document Command
**/
var GetMoreCommand = exports.GetMoreCommand = function(db, collectionName, numberToReturn, cursorId) {
BaseCommand.call(this);
this.collectionName = collectionName;
this.numberToReturn = numberToReturn;
this.cursorId = cursorId;
this.db = db;
};
inherits(GetMoreCommand, BaseCommand);
GetMoreCommand.OP_GET_MORE = 2005;
GetMoreCommand.prototype.toBinary = function() {
// Validate that we are not passing 0x00 in the colletion name
if(!!~this.collectionName.indexOf("\x00")) {
throw new Error("namespace cannot contain a null character");
}
// Calculate total length of the document
var totalLengthOfCommand = 4 + Buffer.byteLength(this.collectionName) + 1 + 4 + 8 + (4 * 4);
// Let's build the single pass buffer command
var _index = 0;
var _command = new Buffer(totalLengthOfCommand);
// Write the header information to the buffer
_command[_index++] = totalLengthOfCommand & 0xff;
_command[_index++] = (totalLengthOfCommand >> 8) & 0xff;
_command[_index++] = (totalLengthOfCommand >> 16) & 0xff;
_command[_index++] = (totalLengthOfCommand >> 24) & 0xff;
// Write the request ID
_command[_index++] = this.requestId & 0xff;
_command[_index++] = (this.requestId >> 8) & 0xff;
_command[_index++] = (this.requestId >> 16) & 0xff;
_command[_index++] = (this.requestId >> 24) & 0xff;
// Write zero
_command[_index++] = 0;
_command[_index++] = 0;
_command[_index++] = 0;
_command[_index++] = 0;
// Write the op_code for the command
_command[_index++] = GetMoreCommand.OP_GET_MORE & 0xff;
_command[_index++] = (GetMoreCommand.OP_GET_MORE >> 8) & 0xff;
_command[_index++] = (GetMoreCommand.OP_GET_MORE >> 16) & 0xff;
_command[_index++] = (GetMoreCommand.OP_GET_MORE >> 24) & 0xff;
// Write zero
_command[_index++] = 0;
_command[_index++] = 0;
_command[_index++] = 0;
_command[_index++] = 0;
// Write the collection name to the command
_index = _index + _command.write(this.collectionName, _index, 'utf8') + 1;
_command[_index - 1] = 0;
// Number of documents to return
_command[_index++] = this.numberToReturn & 0xff;
_command[_index++] = (this.numberToReturn >> 8) & 0xff;
_command[_index++] = (this.numberToReturn >> 16) & 0xff;
_command[_index++] = (this.numberToReturn >> 24) & 0xff;
// Encode the cursor id
var low_bits = this.cursorId.getLowBits();
// Encode low bits
_command[_index++] = low_bits & 0xff;
_command[_index++] = (low_bits >> 8) & 0xff;
_command[_index++] = (low_bits >> 16) & 0xff;
_command[_index++] = (low_bits >> 24) & 0xff;
var high_bits = this.cursorId.getHighBits();
// Encode high bits
_command[_index++] = high_bits & 0xff;
_command[_index++] = (high_bits >> 8) & 0xff;
_command[_index++] = (high_bits >> 16) & 0xff;
_command[_index++] = (high_bits >> 24) & 0xff;
// Return command
return _command;
}; | kiriost/flapperNews | node_modules/mongoose/node_modules/mongodb/lib/mongodb/commands/get_more_command.js | JavaScript | mit | 3,069 |
var BaseCommand = require('./base_command').BaseCommand,
inherits = require('util').inherits,
binaryutils = require('../utils');
/**
Get More Document Command
**/
var GetMoreCommand = exports.GetMoreCommand = function(db, collectionName, numberToReturn, cursorId) {
BaseCommand.call(this);
this.collectionName = collectionName;
this.numberToReturn = numberToReturn;
this.cursorId = cursorId;
this.db = db;
};
inherits(GetMoreCommand, BaseCommand);
GetMoreCommand.OP_GET_MORE = 2005;
GetMoreCommand.prototype.toBinary = function() {
// Validate that we are not passing 0x00 in the colletion name
if(!!~this.collectionName.indexOf("\x00")) {
throw new Error("namespace cannot contain a null character");
}
// Calculate total length of the document
var totalLengthOfCommand = 4 + Buffer.byteLength(this.collectionName) + 1 + 4 + 8 + (4 * 4);
// Let's build the single pass buffer command
var _index = 0;
var _command = new Buffer(totalLengthOfCommand);
// Write the header information to the buffer
_command[_index++] = totalLengthOfCommand & 0xff;
_command[_index++] = (totalLengthOfCommand >> 8) & 0xff;
_command[_index++] = (totalLengthOfCommand >> 16) & 0xff;
_command[_index++] = (totalLengthOfCommand >> 24) & 0xff;
// Write the request ID
_command[_index++] = this.requestId & 0xff;
_command[_index++] = (this.requestId >> 8) & 0xff;
_command[_index++] = (this.requestId >> 16) & 0xff;
_command[_index++] = (this.requestId >> 24) & 0xff;
// Write zero
_command[_index++] = 0;
_command[_index++] = 0;
_command[_index++] = 0;
_command[_index++] = 0;
// Write the op_code for the command
_command[_index++] = GetMoreCommand.OP_GET_MORE & 0xff;
_command[_index++] = (GetMoreCommand.OP_GET_MORE >> 8) & 0xff;
_command[_index++] = (GetMoreCommand.OP_GET_MORE >> 16) & 0xff;
_command[_index++] = (GetMoreCommand.OP_GET_MORE >> 24) & 0xff;
// Write zero
_command[_index++] = 0;
_command[_index++] = 0;
_command[_index++] = 0;
_command[_index++] = 0;
// Write the collection name to the command
_index = _index + _command.write(this.collectionName, _index, 'utf8') + 1;
_command[_index - 1] = 0;
// Number of documents to return
_command[_index++] = this.numberToReturn & 0xff;
_command[_index++] = (this.numberToReturn >> 8) & 0xff;
_command[_index++] = (this.numberToReturn >> 16) & 0xff;
_command[_index++] = (this.numberToReturn >> 24) & 0xff;
// Encode the cursor id
var low_bits = this.cursorId.getLowBits();
// Encode low bits
_command[_index++] = low_bits & 0xff;
_command[_index++] = (low_bits >> 8) & 0xff;
_command[_index++] = (low_bits >> 16) & 0xff;
_command[_index++] = (low_bits >> 24) & 0xff;
var high_bits = this.cursorId.getHighBits();
// Encode high bits
_command[_index++] = high_bits & 0xff;
_command[_index++] = (high_bits >> 8) & 0xff;
_command[_index++] = (high_bits >> 16) & 0xff;
_command[_index++] = (high_bits >> 24) & 0xff;
// Return command
return _command;
}; | briangallagher/testDrivenDevelopment | node_modules/fh-mbaas-api/node_modules/fh-db/node_modules/mongodb/lib/mongodb/commands/get_more_command.js | JavaScript | mit | 3,069 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"ulloqeqqata-tungaa",
"ulloqeqqata-kingorna"
],
"DAY": [
"sabaat",
"ataasinngorneq",
"marlunngorneq",
"pingasunngorneq",
"sisamanngorneq",
"tallimanngorneq",
"arfininngorneq"
],
"MONTH": [
"januari",
"februari",
"martsi",
"aprili",
"maji",
"juni",
"juli",
"augustusi",
"septemberi",
"oktoberi",
"novemberi",
"decemberi"
],
"SHORTDAY": [
"sab",
"ata",
"mar",
"pin",
"sis",
"tal",
"arf"
],
"SHORTMONTH": [
"jan",
"feb",
"mar",
"apr",
"maj",
"jun",
"jul",
"aug",
"sep",
"okt",
"nov",
"dec"
],
"fullDate": "EEEE dd MMMM y",
"longDate": "dd MMMM y",
"medium": "MMM dd, y h:mm:ss a",
"mediumDate": "MMM dd, y",
"mediumTime": "h:mm:ss a",
"short": "y-MM-dd h:mm a",
"shortDate": "y-MM-dd",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "kr",
"DECIMAL_SEP": ",",
"GROUP_SEP": ".",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4-",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "kl",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | shelsonjava/cdnjs | ajax/libs/angular.js/1.2.26/i18n/angular-locale_kl.js | JavaScript | mit | 2,367 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"Kiroko",
"Hwa\u0129-in\u0129"
],
"DAY": [
"Kiumia",
"Njumatat\u0169",
"Njumaine",
"Njumatana",
"Aramithi",
"Njumaa",
"Njumamothi"
],
"MONTH": [
"Njenuar\u0129",
"Mwere wa ker\u0129",
"Mwere wa gatat\u0169",
"Mwere wa kana",
"Mwere wa gatano",
"Mwere wa gatandat\u0169",
"Mwere wa m\u0169gwanja",
"Mwere wa kanana",
"Mwere wa kenda",
"Mwere wa ik\u0169mi",
"Mwere wa ik\u0169mi na \u0169mwe",
"Ndithemba"
],
"SHORTDAY": [
"KMA",
"NTT",
"NMN",
"NMT",
"ART",
"NMA",
"NMM"
],
"SHORTMONTH": [
"JEN",
"WKR",
"WGT",
"WKN",
"WTN",
"WTD",
"WMJ",
"WNN",
"WKD",
"WIK",
"WMW",
"DIT"
],
"fullDate": "EEEE, d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y h:mm:ss a",
"mediumDate": "d MMM y",
"mediumTime": "h:mm:ss a",
"short": "dd/MM/y h:mm a",
"shortDate": "dd/MM/y",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "Ksh",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4-",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "ki-ke",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | aaqibrasheed/cdnjs | ajax/libs/angular.js/1.3.0/i18n/angular-locale_ki-ke.js | JavaScript | mit | 2,451 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"subaka",
"kikii\u0257e"
],
"DAY": [
"dewo",
"aa\u0253nde",
"mawbaare",
"njeslaare",
"naasaande",
"mawnde",
"hoore-biir"
],
"MONTH": [
"siilo",
"colte",
"mbooy",
"see\u0257to",
"duujal",
"korse",
"morso",
"juko",
"siilto",
"yarkomaa",
"jolal",
"bowte"
],
"SHORTDAY": [
"dew",
"aa\u0253",
"maw",
"nje",
"naa",
"mwd",
"hbi"
],
"SHORTMONTH": [
"sii",
"col",
"mbo",
"see",
"duu",
"kor",
"mor",
"juk",
"slt",
"yar",
"jol",
"bow"
],
"fullDate": "EEEE d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM, y HH:mm:ss",
"mediumDate": "d MMM, y",
"mediumTime": "HH:mm:ss",
"short": "d/M/y HH:mm",
"shortDate": "d/M/y",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "MRO",
"DECIMAL_SEP": ",",
"GROUP_SEP": "\u00a0",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-",
"negSuf": "\u00a0\u00a4",
"posPre": "",
"posSuf": "\u00a0\u00a4"
}
]
},
"id": "ff-mr",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | extend1994/cdnjs | ajax/libs/angular-i18n/1.3.0/angular-locale_ff-mr.js | JavaScript | mit | 2,313 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"AM",
"PM"
],
"DAY": [
"Aneg 1",
"Aneg 2",
"Aneg 3",
"Aneg 4",
"Aneg 5",
"Aneg 6",
"Aneg 7"
],
"MONTH": [
"im\u0259g mbegtug",
"imeg \u00e0b\u00f9b\u00ec",
"imeg mb\u0259\u014bchubi",
"im\u0259g ngw\u0259\u0300t",
"im\u0259g fog",
"im\u0259g ichiib\u0254d",
"im\u0259g \u00e0d\u00f9mb\u0259\u0300\u014b",
"im\u0259g ichika",
"im\u0259g kud",
"im\u0259g t\u00e8si\u02bce",
"im\u0259g z\u00f2",
"im\u0259g krizmed"
],
"SHORTDAY": [
"Aneg 1",
"Aneg 2",
"Aneg 3",
"Aneg 4",
"Aneg 5",
"Aneg 6",
"Aneg 7"
],
"SHORTMONTH": [
"mbegtug",
"imeg \u00e0b\u00f9b\u00ec",
"imeg mb\u0259\u014bchubi",
"im\u0259g ngw\u0259\u0300t",
"im\u0259g fog",
"im\u0259g ichiib\u0254d",
"im\u0259g \u00e0d\u00f9mb\u0259\u0300\u014b",
"im\u0259g ichika",
"im\u0259g kud",
"im\u0259g t\u00e8si\u02bce",
"im\u0259g z\u00f2",
"im\u0259g krizmed"
],
"fullDate": "EEEE, y MMMM dd",
"longDate": "y MMMM d",
"medium": "y MMM d HH:mm:ss",
"mediumDate": "y MMM d",
"mediumTime": "HH:mm:ss",
"short": "y-MM-dd HH:mm",
"shortDate": "y-MM-dd",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "FCFA",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4\u00a0-",
"negSuf": "",
"posPre": "\u00a4\u00a0",
"posSuf": ""
}
]
},
"id": "mgo-cm",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | brix/cdnjs | ajax/libs/angular.js/1.2.27/i18n/angular-locale_mgo-cm.js | JavaScript | mit | 2,705 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"man\u00e1",
"kug\u00fa"
],
"DAY": [
"s\u0254\u0301nd\u0254",
"m\u0254\u0301nd\u0254",
"s\u0254\u0301nd\u0254 maf\u00fa m\u00e1ba",
"s\u0254\u0301nd\u0254 maf\u00fa m\u00e1lal",
"s\u0254\u0301nd\u0254 maf\u00fa m\u00e1na",
"mab\u00e1g\u00e1 m\u00e1 sukul",
"s\u00e1sadi"
],
"MONTH": [
"ngw\u025bn mat\u00e1hra",
"ngw\u025bn \u0144mba",
"ngw\u025bn \u0144lal",
"ngw\u025bn \u0144na",
"ngw\u025bn \u0144tan",
"ngw\u025bn \u0144tu\u00f3",
"ngw\u025bn h\u025bmbu\u025br\u00ed",
"ngw\u025bn l\u0254mbi",
"ngw\u025bn r\u025bbvu\u00e2",
"ngw\u025bn wum",
"ngw\u025bn wum nav\u01d4r",
"kr\u00edsimin"
],
"SHORTDAY": [
"s\u0254\u0301n",
"m\u0254\u0301n",
"smb",
"sml",
"smn",
"mbs",
"sas"
],
"SHORTMONTH": [
"ng1",
"ng2",
"ng3",
"ng4",
"ng5",
"ng6",
"ng7",
"ng8",
"ng9",
"ng10",
"ng11",
"kris"
],
"fullDate": "EEEE d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y HH:mm:ss",
"mediumDate": "d MMM y",
"mediumTime": "HH:mm:ss",
"short": "d/M/y HH:mm",
"shortDate": "d/M/y",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "FCFA",
"DECIMAL_SEP": ",",
"GROUP_SEP": "\u00a0",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-",
"negSuf": "\u00a0\u00a4",
"posPre": "",
"posSuf": "\u00a0\u00a4"
}
]
},
"id": "nmg",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | tmorin/cdnjs | ajax/libs/angular.js/1.2.27/i18n/angular-locale_nmg.js | JavaScript | mit | 2,671 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"WD",
"WB"
],
"DAY": [
"Dilbata",
"Wiixata",
"Qibxata",
"Roobii",
"Kamiisa",
"Jimaata",
"Sanbata"
],
"MONTH": [
"Amajjii",
"Guraandhala",
"Bitooteessa",
"Elba",
"Caamsa",
"Waxabajjii",
"Adooleessa",
"Hagayya",
"Fuulbana",
"Onkololeessa",
"Sadaasa",
"Muddee"
],
"SHORTDAY": [
"Dil",
"Wix",
"Qib",
"Rob",
"Kam",
"Jim",
"San"
],
"SHORTMONTH": [
"Ama",
"Gur",
"Bit",
"Elb",
"Cam",
"Wax",
"Ado",
"Hag",
"Ful",
"Onk",
"Sad",
"Mud"
],
"fullDate": "EEEE, MMMM d, y",
"longDate": "dd MMMM y",
"medium": "dd-MMM-y h:mm:ss a",
"mediumDate": "dd-MMM-y",
"mediumTime": "h:mm:ss a",
"short": "dd/MM/yy h:mm a",
"shortDate": "dd/MM/yy",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "Ksh",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4-",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "om-ke",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | luanlmd/cdnjs | ajax/libs/angular.js/1.2.26/i18n/angular-locale_om-ke.js | JavaScript | mit | 2,310 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"posz.",
"b\u00fcz."
],
"DAY": [
"sudel",
"mudel",
"tudel",
"vedel",
"d\u00f6del",
"fridel",
"z\u00e4del"
],
"MONTH": [
"janul",
"febul",
"m\u00e4zil",
"prilul",
"mayul",
"yunul",
"yulul",
"gustul",
"setul",
"tobul",
"novul",
"dekul"
],
"SHORTDAY": [
"su.",
"mu.",
"tu.",
"ve.",
"d\u00f6.",
"fr.",
"z\u00e4."
],
"SHORTMONTH": [
"jan",
"feb",
"m\u00e4z",
"prl",
"may",
"yun",
"yul",
"gst",
"set",
"ton",
"nov",
"dek"
],
"fullDate": "y MMMMa 'd'. d'id'",
"longDate": "y MMMM d",
"medium": "y MMM. d HH:mm:ss",
"mediumDate": "y MMM. d",
"mediumTime": "HH:mm:ss",
"short": "y-MM-dd HH:mm",
"shortDate": "y-MM-dd",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "$",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4\u00a0-",
"negSuf": "",
"posPre": "\u00a4\u00a0",
"posSuf": ""
}
]
},
"id": "vo-001",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | ddeveloperr/cdnjs | ajax/libs/angular.js/1.2.26/i18n/angular-locale_vo-001.js | JavaScript | mit | 2,308 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"Lwamilawu",
"Pashamihe"
],
"DAY": [
"Mulungu",
"Jumatatu",
"Jumanne",
"Jumatano",
"Alahamisi",
"Ijumaa",
"Jumamosi"
],
"MONTH": [
"Mupalangulwa",
"Mwitope",
"Mushende",
"Munyi",
"Mushende Magali",
"Mujimbi",
"Mushipepo",
"Mupuguto",
"Munyense",
"Mokhu",
"Musongandembwe",
"Muhaano"
],
"SHORTDAY": [
"Mul",
"Jtt",
"Jnn",
"Jtn",
"Alh",
"Iju",
"Jmo"
],
"SHORTMONTH": [
"Mup",
"Mwi",
"Msh",
"Mun",
"Mag",
"Muj",
"Msp",
"Mpg",
"Mye",
"Mok",
"Mus",
"Muh"
],
"fullDate": "EEEE, d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y h:mm:ss a",
"mediumDate": "d MMM y",
"mediumTime": "h:mm:ss a",
"short": "dd/MM/y h:mm a",
"shortDate": "dd/MM/y",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "TSh",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-",
"negSuf": "\u00a4",
"posPre": "",
"posSuf": "\u00a4"
}
]
},
"id": "sbp-tz",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | jonobr1/cdnjs | ajax/libs/angular-i18n/1.3.0-rc.2/angular-locale_sbp-tz.js | JavaScript | mit | 2,330 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"\u2d5c\u2d49\u2d3c\u2d30\u2d61\u2d5c",
"\u2d5c\u2d30\u2d37\u2d33\u2d33\u2d6f\u2d30\u2d5c"
],
"DAY": [
"\u2d30\u2d59\u2d30\u2d4e\u2d30\u2d59",
"\u2d30\u2d62\u2d4f\u2d30\u2d59",
"\u2d30\u2d59\u2d49\u2d4f\u2d30\u2d59",
"\u2d30\u2d3d\u2d55\u2d30\u2d59",
"\u2d30\u2d3d\u2d61\u2d30\u2d59",
"\u2d30\u2d59\u2d49\u2d4e\u2d61\u2d30\u2d59",
"\u2d30\u2d59\u2d49\u2d39\u2d62\u2d30\u2d59"
],
"MONTH": [
"\u2d49\u2d4f\u2d4f\u2d30\u2d62\u2d54",
"\u2d31\u2d55\u2d30\u2d62\u2d55",
"\u2d4e\u2d30\u2d55\u2d5a",
"\u2d49\u2d31\u2d54\u2d49\u2d54",
"\u2d4e\u2d30\u2d62\u2d62\u2d53",
"\u2d62\u2d53\u2d4f\u2d62\u2d53",
"\u2d62\u2d53\u2d4d\u2d62\u2d53\u2d63",
"\u2d56\u2d53\u2d5b\u2d5c",
"\u2d5b\u2d53\u2d5c\u2d30\u2d4f\u2d31\u2d49\u2d54",
"\u2d3d\u2d5c\u2d53\u2d31\u2d54",
"\u2d4f\u2d53\u2d61\u2d30\u2d4f\u2d31\u2d49\u2d54",
"\u2d37\u2d53\u2d4a\u2d30\u2d4f\u2d31\u2d49\u2d54"
],
"SHORTDAY": [
"\u2d30\u2d59\u2d30",
"\u2d30\u2d62\u2d4f",
"\u2d30\u2d59\u2d49",
"\u2d30\u2d3d\u2d55",
"\u2d30\u2d3d\u2d61",
"\u2d30\u2d59\u2d49\u2d4e",
"\u2d30\u2d59\u2d49\u2d39"
],
"SHORTMONTH": [
"\u2d49\u2d4f\u2d4f",
"\u2d31\u2d55\u2d30",
"\u2d4e\u2d30\u2d55",
"\u2d49\u2d31\u2d54",
"\u2d4e\u2d30\u2d62",
"\u2d62\u2d53\u2d4f",
"\u2d62\u2d53\u2d4d",
"\u2d56\u2d53\u2d5b",
"\u2d5b\u2d53\u2d5c",
"\u2d3d\u2d5c\u2d53",
"\u2d4f\u2d53\u2d61",
"\u2d37\u2d53\u2d4a"
],
"fullDate": "EEEE d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM, y HH:mm:ss",
"mediumDate": "d MMM, y",
"mediumTime": "HH:mm:ss",
"short": "d/M/y HH:mm",
"shortDate": "d/M/y",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "dh",
"DECIMAL_SEP": ",",
"GROUP_SEP": "\u00a0",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-",
"negSuf": "\u00a4",
"posPre": "",
"posSuf": "\u00a4"
}
]
},
"id": "zgh-ma",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | maruilian11/cdnjs | ajax/libs/angular-i18n/1.3.0-rc.4/angular-locale_zgh-ma.js | JavaScript | mit | 3,192 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"\u4e0a\u5348",
"\u4e0b\u5348"
],
"DAY": [
"\u661f\u671f\u65e5",
"\u661f\u671f\u4e00",
"\u661f\u671f\u4e8c",
"\u661f\u671f\u4e09",
"\u661f\u671f\u56db",
"\u661f\u671f\u4e94",
"\u661f\u671f\u516d"
],
"MONTH": [
"\u4e00\u6708",
"\u4e8c\u6708",
"\u4e09\u6708",
"\u56db\u6708",
"\u4e94\u6708",
"\u516d\u6708",
"\u4e03\u6708",
"\u516b\u6708",
"\u4e5d\u6708",
"\u5341\u6708",
"\u5341\u4e00\u6708",
"\u5341\u4e8c\u6708"
],
"SHORTDAY": [
"\u5468\u65e5",
"\u5468\u4e00",
"\u5468\u4e8c",
"\u5468\u4e09",
"\u5468\u56db",
"\u5468\u4e94",
"\u5468\u516d"
],
"SHORTMONTH": [
"1\u6708",
"2\u6708",
"3\u6708",
"4\u6708",
"5\u6708",
"6\u6708",
"7\u6708",
"8\u6708",
"9\u6708",
"10\u6708",
"11\u6708",
"12\u6708"
],
"fullDate": "y\u5e74M\u6708d\u65e5EEEE",
"longDate": "y\u5e74M\u6708d\u65e5",
"medium": "y\u5e74M\u6708d\u65e5 ah:mm:ss",
"mediumDate": "y\u5e74M\u6708d\u65e5",
"mediumTime": "ah:mm:ss",
"short": "d/M/yy ah:mm",
"shortDate": "d/M/yy",
"shortTime": "ah:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "MOP",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4-",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "zh-hans-mo",
"pluralCat": function (n, opt_precision) { return PLURAL_CATEGORY.OTHER;}
});
}]); | sreym/cdnjs | ajax/libs/angular-i18n/1.2.27/angular-locale_zh-hans-mo.js | JavaScript | mit | 2,180 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"\u092e.\u092a\u0942.",
"\u092e.\u0928\u0902."
],
"DAY": [
"\u0906\u0926\u093f\u0924\u094d\u092f\u0935\u093e\u0930",
"\u0938\u094b\u092e\u0935\u093e\u0930",
"\u092e\u0902\u0917\u0933\u093e\u0930",
"\u092c\u0941\u0927\u0935\u093e\u0930",
"\u0917\u0941\u0930\u0941\u0935\u093e\u0930",
"\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930",
"\u0936\u0928\u093f\u0935\u093e\u0930"
],
"MONTH": [
"\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940",
"\u092b\u0947\u092c\u094d\u0930\u0941\u0935\u093e\u0930\u0940",
"\u092e\u093e\u0930\u094d\u091a",
"\u090f\u092a\u094d\u0930\u093f\u0932",
"\u092e\u0947",
"\u091c\u0942\u0928",
"\u091c\u0941\u0932\u0948",
"\u0913\u0917\u0938\u094d\u091f",
"\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930",
"\u0913\u0915\u094d\u091f\u094b\u092c\u0930",
"\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930",
"\u0921\u093f\u0938\u0947\u0902\u092c\u0930"
],
"SHORTDAY": [
"\u0930\u0935\u093f",
"\u0938\u094b\u092e",
"\u092e\u0902\u0917\u0933",
"\u092c\u0941\u0927",
"\u0917\u0941\u0930\u0941",
"\u0936\u0941\u0915\u094d\u0930",
"\u0936\u0928\u093f"
],
"SHORTMONTH": [
"\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940",
"\u092b\u0947\u092c\u094d\u0930\u0941\u0935\u093e\u0930\u0940",
"\u092e\u093e\u0930\u094d\u091a",
"\u090f\u092a\u094d\u0930\u093f\u0932",
"\u092e\u0947",
"\u091c\u0942\u0928",
"\u091c\u0941\u0932\u0948",
"\u0913\u0917\u0938\u094d\u091f",
"\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930",
"\u0913\u0915\u094d\u091f\u094b\u092c\u0930",
"\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930",
"\u0921\u093f\u0938\u0947\u0902\u092c\u0930"
],
"fullDate": "EEEE d MMMM y",
"longDate": "d MMMM y",
"medium": "dd-MM-y h:mm:ss a",
"mediumDate": "dd-MM-y",
"mediumTime": "h:mm:ss a",
"short": "d-M-yy h:mm a",
"shortDate": "d-M-yy",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u20b9",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 2,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 2,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4\u00a0-",
"negSuf": "",
"posPre": "\u00a4\u00a0",
"posSuf": ""
}
]
},
"id": "kok-in",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | quba/cdnjs | ajax/libs/angular.js/1.3.0/i18n/angular-locale_kok-in.js | JavaScript | mit | 3,487 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"AM",
"PM"
],
"DAY": [
"dimans",
"lindi",
"mardi",
"merkredi",
"zedi",
"vandredi",
"samdi"
],
"MONTH": [
"zanvie",
"fevriye",
"mars",
"avril",
"me",
"zin",
"zilye",
"out",
"septam",
"oktob",
"novam",
"desam"
],
"SHORTDAY": [
"dim",
"lin",
"mar",
"mer",
"ze",
"van",
"sam"
],
"SHORTMONTH": [
"zan",
"fev",
"mar",
"avr",
"me",
"zin",
"zil",
"out",
"sep",
"okt",
"nov",
"des"
],
"fullDate": "EEEE d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM, y HH:mm:ss",
"mediumDate": "d MMM, y",
"mediumTime": "HH:mm:ss",
"short": "d/M/y HH:mm",
"shortDate": "d/M/y",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "MURs",
"DECIMAL_SEP": ".",
"GROUP_SEP": "\u00a0",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4\u00a0-",
"negSuf": "",
"posPre": "\u00a4\u00a0",
"posSuf": ""
}
]
},
"id": "mfe-mu",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | sympmarc/cdnjs | ajax/libs/angular-i18n/1.3.0-rc.3/angular-locale_mfe-mu.js | JavaScript | mit | 2,264 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"AM",
"PM"
],
"DAY": [
"lahadi",
"t\u025b\u025bn\u025b\u025b",
"talata",
"alaba",
"aimisa",
"aijima",
"si\u0253iti"
],
"MONTH": [
"luukao kem\u00e3",
"\u0253anda\u0253u",
"v\u0254\u0254",
"fulu",
"goo",
"6",
"7",
"k\u0254nde",
"saah",
"galo",
"kenpkato \u0253olol\u0254",
"luukao l\u0254ma"
],
"SHORTDAY": [
"lahadi",
"t\u025b\u025bn\u025b\u025b",
"talata",
"alaba",
"aimisa",
"aijima",
"si\u0253iti"
],
"SHORTMONTH": [
"luukao kem\u00e3",
"\u0253anda\u0253u",
"v\u0254\u0254",
"fulu",
"goo",
"6",
"7",
"k\u0254nde",
"saah",
"galo",
"kenpkato \u0253olol\u0254",
"luukao l\u0254ma"
],
"fullDate": "EEEE, d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y h:mm:ss a",
"mediumDate": "d MMM y",
"mediumTime": "h:mm:ss a",
"short": "dd/MM/y h:mm a",
"shortDate": "dd/MM/y",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "$",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4-",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "vai-latn-lr",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | thejsj/cdnjs | ajax/libs/angular.js/1.2.26/i18n/angular-locale_vai-latn-lr.js | JavaScript | mit | 2,464 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"\u0128yakwakya",
"\u0128yaw\u0129oo"
],
"DAY": [
"Wa kyumwa",
"Wa kwamb\u0129l\u0129lya",
"Wa kel\u0129",
"Wa katat\u0169",
"Wa kana",
"Wa katano",
"Wa thanthat\u0169"
],
"MONTH": [
"Mwai wa mbee",
"Mwai wa kel\u0129",
"Mwai wa katat\u0169",
"Mwai wa kana",
"Mwai wa katano",
"Mwai wa thanthat\u0169",
"Mwai wa muonza",
"Mwai wa nyaanya",
"Mwai wa kenda",
"Mwai wa \u0129kumi",
"Mwai wa \u0129kumi na \u0129mwe",
"Mwai wa \u0129kumi na il\u0129"
],
"SHORTDAY": [
"Wky",
"Wkw",
"Wkl",
"Wt\u0169",
"Wkn",
"Wtn",
"Wth"
],
"SHORTMONTH": [
"Mbe",
"Kel",
"Kt\u0169",
"Kan",
"Ktn",
"Tha",
"Moo",
"Nya",
"Knd",
"\u0128ku",
"\u0128km",
"\u0128kl"
],
"fullDate": "EEEE, d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y h:mm:ss a",
"mediumDate": "d MMM y",
"mediumTime": "h:mm:ss a",
"short": "dd/MM/y h:mm a",
"shortDate": "dd/MM/y",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "Ksh",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4-",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "kam",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | him2him2/cdnjs | ajax/libs/angular-i18n/1.3.0-rc.4/angular-locale_kam.js | JavaScript | mit | 2,516 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"pre podne",
"popodne"
],
"DAY": [
"nedelja",
"ponedeljak",
"utorak",
"sreda",
"\u010detvrtak",
"petak",
"subota"
],
"MONTH": [
"januar",
"februar",
"mart",
"april",
"maj",
"jun",
"jul",
"avgust",
"septembar",
"oktobar",
"novembar",
"decembar"
],
"SHORTDAY": [
"ned",
"pon",
"uto",
"sre",
"\u010det",
"pet",
"sub"
],
"SHORTMONTH": [
"jan",
"feb",
"mar",
"apr",
"maj",
"jun",
"jul",
"avg",
"sep",
"okt",
"nov",
"dec"
],
"fullDate": "EEEE, dd. MMMM y.",
"longDate": "dd. MMMM y.",
"medium": "dd.MM.y. HH.mm.ss",
"mediumDate": "dd.MM.y.",
"mediumTime": "HH.mm.ss",
"short": "d.M.yy. HH.mm",
"shortDate": "d.M.yy.",
"shortTime": "HH.mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "KM",
"DECIMAL_SEP": ",",
"GROUP_SEP": ".",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-",
"negSuf": "\u00a0\u00a4",
"posPre": "",
"posSuf": "\u00a0\u00a4"
}
]
},
"id": "sr-latn-ba",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (vf.v == 0 && i % 10 == 1 && i % 100 != 11 || vf.f % 10 == 1 && vf.f % 100 != 11) { return PLURAL_CATEGORY.ONE; } if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14) || vf.f % 10 >= 2 && vf.f % 10 <= 4 && (vf.f % 100 < 12 || vf.f % 100 > 14)) { return PLURAL_CATEGORY.FEW; } return PLURAL_CATEGORY.OTHER;}
});
}]); | Mrkebubun/cdnjs | ajax/libs/angular.js/1.2.25/i18n/angular-locale_sr-latn-ba.js | JavaScript | mit | 2,567 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"AM",
"PM"
],
"DAY": [
"S\u0101pate",
"M\u014dnite",
"T\u016bsite",
"Pulelulu",
"Tu\u02bbapulelulu",
"Falaite",
"Tokonaki"
],
"MONTH": [
"S\u0101nuali",
"F\u0113pueli",
"Ma\u02bbasi",
"\u02bbEpeleli",
"M\u0113",
"Sune",
"Siulai",
"\u02bbAokosi",
"Sepitema",
"\u02bbOkatopa",
"N\u014dvema",
"T\u012bsema"
],
"SHORTDAY": [
"S\u0101p",
"M\u014dn",
"T\u016bs",
"Pul",
"Tu\u02bba",
"Fal",
"Tok"
],
"SHORTMONTH": [
"S\u0101n",
"F\u0113p",
"Ma\u02bba",
"\u02bbEpe",
"M\u0113",
"Sun",
"Siu",
"\u02bbAok",
"Sep",
"\u02bbOka",
"N\u014dv",
"T\u012bs"
],
"fullDate": "EEEE d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y h:mm:ss a",
"mediumDate": "d MMM y",
"mediumTime": "h:mm:ss a",
"short": "d/M/yy h:mm a",
"shortDate": "d/M/yy",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "T$",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4\u00a0-",
"negSuf": "",
"posPre": "\u00a4\u00a0",
"posSuf": ""
}
]
},
"id": "to-to",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | BobbieBel/cdnjs | ajax/libs/angular-i18n/1.2.26/angular-locale_to-to.js | JavaScript | mit | 2,427 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"Dinda",
"Dilolo"
],
"DAY": [
"Lumingu",
"Nkodya",
"Nd\u00e0ay\u00e0",
"Ndang\u00f9",
"Nj\u00f2wa",
"Ng\u00f2vya",
"Lubingu"
],
"MONTH": [
"Ciongo",
"L\u00f9ishi",
"Lus\u00f2lo",
"M\u00f9uy\u00e0",
"Lum\u00f9ng\u00f9l\u00f9",
"Lufuimi",
"Kab\u00e0l\u00e0sh\u00ecp\u00f9",
"L\u00f9sh\u00eck\u00e0",
"Lutongolo",
"Lung\u00f9di",
"Kasw\u00e8k\u00e8s\u00e8",
"Cisw\u00e0"
],
"SHORTDAY": [
"Lum",
"Nko",
"Ndy",
"Ndg",
"Njw",
"Ngv",
"Lub"
],
"SHORTMONTH": [
"Cio",
"Lui",
"Lus",
"Muu",
"Lum",
"Luf",
"Kab",
"Lush",
"Lut",
"Lun",
"Kas",
"Cis"
],
"fullDate": "EEEE d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y HH:mm:ss",
"mediumDate": "d MMM y",
"mediumTime": "HH:mm:ss",
"short": "d/M/y HH:mm",
"shortDate": "d/M/y",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "FrCD",
"DECIMAL_SEP": ",",
"GROUP_SEP": ".",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-",
"negSuf": "\u00a4",
"posPre": "",
"posSuf": "\u00a4"
}
]
},
"id": "lu-cd",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | viskin/cdnjs | ajax/libs/angular-i18n/1.3.0/angular-locale_lu-cd.js | JavaScript | mit | 2,407 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"Ekuseni",
"Ntambama"
],
"DAY": [
"Sonto",
"Msombuluko",
"Lwesibili",
"Lwesithathu",
"Lwesine",
"Lwesihlanu",
"Mgqibelo"
],
"MONTH": [
"Januwari",
"Februwari",
"Mashi",
"Apreli",
"Meyi",
"Juni",
"Julayi",
"Agasti",
"Septhemba",
"Okthoba",
"Novemba",
"Disemba"
],
"SHORTDAY": [
"Son",
"Mso",
"Bil",
"Tha",
"Sin",
"Hla",
"Mgq"
],
"SHORTMONTH": [
"Jan",
"Feb",
"Mas",
"Apr",
"Mey",
"Jun",
"Jul",
"Aga",
"Sep",
"Okt",
"Nov",
"Dis"
],
"fullDate": "EEEE dd MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y h:mm:ss a",
"mediumDate": "d MMM y",
"mediumTime": "h:mm:ss a",
"short": "y-MM-dd h:mm a",
"shortDate": "y-MM-dd",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "R",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4-",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "zu",
"pluralCat": function (n, opt_precision) { var i = n | 0; if (i == 0 || n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | mscharl/cdnjs | ajax/libs/angular-i18n/1.3.0-rc.2/angular-locale_zu.js | JavaScript | mit | 1,932 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"a.",
"p."
],
"DAY": [
"domenie",
"lunis",
"martars",
"miercus",
"joibe",
"vinars",
"sabide"
],
"MONTH": [
"Zen\u00e2r",
"Fevr\u00e2r",
"Mar\u00e7",
"Avr\u00eel",
"Mai",
"Jugn",
"Lui",
"Avost",
"Setembar",
"Otubar",
"Novembar",
"Dicembar"
],
"SHORTDAY": [
"dom",
"lun",
"mar",
"mie",
"joi",
"vin",
"sab"
],
"SHORTMONTH": [
"Zen",
"Fev",
"Mar",
"Avr",
"Mai",
"Jug",
"Lui",
"Avo",
"Set",
"Otu",
"Nov",
"Dic"
],
"fullDate": "EEEE d 'di' MMMM 'dal' y",
"longDate": "d 'di' MMMM 'dal' y",
"medium": "dd/MM/y HH:mm:ss",
"mediumDate": "dd/MM/y",
"mediumTime": "HH:mm:ss",
"short": "dd/MM/yy HH:mm",
"shortDate": "dd/MM/yy",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u20ac",
"DECIMAL_SEP": ",",
"GROUP_SEP": ".",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4\u00a0-",
"negSuf": "",
"posPre": "\u00a4\u00a0",
"posSuf": ""
}
]
},
"id": "fur-it",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | boneskull/cdnjs | ajax/libs/angular.js/1.2.29/i18n/angular-locale_fur-it.js | JavaScript | mit | 2,320 |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"\u134b\u12f1\u1235 \u1303\u1265",
"\u134b\u12f1\u1235 \u12f0\u121d\u1262"
],
"DAY": [
"\u1230\u1295\u1260\u122d \u1245\u12f3\u12c5",
"\u1230\u1291",
"\u1230\u120a\u131d",
"\u1208\u1313 \u12c8\u122a \u1208\u1265\u12cb",
"\u12a3\u121d\u12f5",
"\u12a3\u122d\u1265",
"\u1230\u1295\u1260\u122d \u123d\u1313\u12c5"
],
"MONTH": [
"\u120d\u12f0\u1275\u122a",
"\u12ab\u1265\u12bd\u1265\u1272",
"\u12ad\u1265\u120b",
"\u134b\u1305\u12ba\u122a",
"\u12ad\u1262\u1245\u122a",
"\u121d\u12aa\u12a4\u120d \u1275\u131f\u1292\u122a",
"\u12b0\u122d\u12a9",
"\u121b\u122d\u12eb\u121d \u1275\u122a",
"\u12eb\u12b8\u1292 \u1218\u1233\u1245\u1208\u122a",
"\u1218\u1270\u1209",
"\u121d\u12aa\u12a4\u120d \u1218\u123d\u12c8\u122a",
"\u1270\u1215\u1233\u1235\u122a"
],
"SHORTDAY": [
"\u1230/\u1245",
"\u1230\u1291",
"\u1230\u120a\u131d",
"\u1208\u1313",
"\u12a3\u121d\u12f5",
"\u12a3\u122d\u1265",
"\u1230/\u123d"
],
"SHORTMONTH": [
"\u120d\u12f0\u1275",
"\u12ab\u1265\u12bd",
"\u12ad\u1265\u120b",
"\u134b\u1305\u12ba",
"\u12ad\u1262\u1245",
"\u121d/\u1275",
"\u12b0\u122d",
"\u121b\u122d\u12eb",
"\u12eb\u12b8\u1292",
"\u1218\u1270\u1209",
"\u121d/\u121d",
"\u1270\u1215\u1233"
],
"fullDate": "EEEE\u1361 dd MMMM \u130d\u122d\u130b y G",
"longDate": "dd MMMM y",
"medium": "dd-MMM-y h:mm:ss a",
"mediumDate": "dd-MMM-y",
"mediumTime": "h:mm:ss a",
"short": "dd/MM/yy h:mm a",
"shortDate": "dd/MM/yy",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "Nfk",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4-",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "byn",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | j0hnma/szangularjs | src/ngLocale/angular-locale_byn.js | JavaScript | mit | 3,064 |
var baseFindIndex = require('./_baseFindIndex'),
baseIteratee = require('./_baseIteratee'),
toInteger = require('./toInteger');
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* This method is like `_.find` except that it returns the index of the first
* element `predicate` returns truthy for instead of the element itself.
*
* @static
* @memberOf _
* @since 1.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.findIndex(users, function(o) { return o.user == 'barney'; });
* // => 0
*
* // The `_.matches` iteratee shorthand.
* _.findIndex(users, { 'user': 'fred', 'active': false });
* // => 1
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findIndex(users, ['active', false]);
* // => 0
*
* // The `_.property` iteratee shorthand.
* _.findIndex(users, 'active');
* // => 2
*/
function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseFindIndex(array, baseIteratee(predicate, 3), index);
}
module.exports = findIndex;
| TranscribeToTEI/webapp | node_modules/lodash/findIndex.js | JavaScript | mit | 1,654 |
exports.alphasort = alphasort
exports.alphasorti = alphasorti
exports.isAbsolute = process.platform === "win32" ? absWin : absUnix
exports.setopts = setopts
exports.ownProp = ownProp
exports.makeAbs = makeAbs
exports.finish = finish
exports.mark = mark
exports.isIgnored = isIgnored
exports.childrenIgnored = childrenIgnored
function ownProp (obj, field) {
return Object.prototype.hasOwnProperty.call(obj, field)
}
var path = require("path")
var minimatch = require("minimatch")
var Minimatch = minimatch.Minimatch
function absWin (p) {
if (absUnix(p)) return true
// pull off the device/UNC bit from a windows path.
// from node's lib/path.js
var splitDeviceRe =
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/
var result = splitDeviceRe.exec(p)
var device = result[1] || ''
var isUnc = device && device.charAt(1) !== ':'
var isAbsolute = !!result[2] || isUnc // UNC paths are always absolute
return isAbsolute
}
function absUnix (p) {
return p.charAt(0) === "/" || p === ""
}
function alphasorti (a, b) {
return a.toLowerCase().localeCompare(b.toLowerCase())
}
function alphasort (a, b) {
return a.localeCompare(b)
}
function setupIgnores (self, options) {
self.ignore = options.ignore || []
if (!Array.isArray(self.ignore))
self.ignore = [self.ignore]
if (self.ignore.length) {
self.ignore = self.ignore.map(ignoreMap)
}
}
function ignoreMap (pattern) {
var gmatcher = null
if (pattern.slice(-3) === '/**') {
var gpattern = pattern.replace(/(\/\*\*)+$/, '')
gmatcher = new Minimatch(gpattern, { nonegate: true })
}
return {
matcher: new Minimatch(pattern, { nonegate: true }),
gmatcher: gmatcher
}
}
function setopts (self, pattern, options) {
if (!options)
options = {}
// base-matching: just use globstar for that.
if (options.matchBase && -1 === pattern.indexOf("/")) {
if (options.noglobstar) {
throw new Error("base matching requires globstar")
}
pattern = "**/" + pattern
}
self.pattern = pattern
self.strict = options.strict !== false
self.realpath = !!options.realpath
self.realpathCache = options.realpathCache || Object.create(null)
self.follow = !!options.follow
self.dot = !!options.dot
self.mark = !!options.mark
self.nodir = !!options.nodir
if (self.nodir)
self.mark = true
self.sync = !!options.sync
self.nounique = !!options.nounique
self.nonull = !!options.nonull
self.nosort = !!options.nosort
self.nocase = !!options.nocase
self.stat = !!options.stat
self.noprocess = !!options.noprocess
self.maxLength = options.maxLength || Infinity
self.cache = options.cache || Object.create(null)
self.statCache = options.statCache || Object.create(null)
self.symlinks = options.symlinks || Object.create(null)
setupIgnores(self, options)
self.changedCwd = false
var cwd = process.cwd()
if (!ownProp(options, "cwd"))
self.cwd = cwd
else {
self.cwd = options.cwd
self.changedCwd = path.resolve(options.cwd) !== cwd
}
self.root = options.root || path.resolve(self.cwd, "/")
self.root = path.resolve(self.root)
if (process.platform === "win32")
self.root = self.root.replace(/\\/g, "/")
self.nomount = !!options.nomount
self.minimatch = new Minimatch(pattern, options)
self.options = self.minimatch.options
}
function finish (self) {
var nou = self.nounique
var all = nou ? [] : Object.create(null)
for (var i = 0, l = self.matches.length; i < l; i ++) {
var matches = self.matches[i]
if (!matches || Object.keys(matches).length === 0) {
if (self.nonull) {
// do like the shell, and spit out the literal glob
var literal = self.minimatch.globSet[i]
if (nou)
all.push(literal)
else
all[literal] = true
}
} else {
// had matches
var m = Object.keys(matches)
if (nou)
all.push.apply(all, m)
else
m.forEach(function (m) {
all[m] = true
})
}
}
if (!nou)
all = Object.keys(all)
if (!self.nosort)
all = all.sort(self.nocase ? alphasorti : alphasort)
// at *some* point we statted all of these
if (self.mark) {
for (var i = 0; i < all.length; i++) {
all[i] = self._mark(all[i])
}
if (self.nodir) {
all = all.filter(function (e) {
return !(/\/$/.test(e))
})
}
}
if (self.ignore.length)
all = all.filter(function(m) {
return !isIgnored(self, m)
})
self.found = all
}
function mark (self, p) {
var abs = makeAbs(self, p)
var c = self.cache[abs]
var m = p
if (c) {
var isDir = c === 'DIR' || Array.isArray(c)
var slash = p.slice(-1) === '/'
if (isDir && !slash)
m += '/'
else if (!isDir && slash)
m = m.slice(0, -1)
if (m !== p) {
var mabs = makeAbs(self, m)
self.statCache[mabs] = self.statCache[abs]
self.cache[mabs] = self.cache[abs]
}
}
return m
}
// lotta situps...
function makeAbs (self, f) {
var abs = f
if (f.charAt(0) === '/') {
abs = path.join(self.root, f)
} else if (exports.isAbsolute(f)) {
abs = f
} else if (self.changedCwd) {
abs = path.resolve(self.cwd, f)
} else if (self.realpath) {
abs = path.resolve(f)
}
return abs
}
// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
function isIgnored (self, path) {
if (!self.ignore.length)
return false
return self.ignore.some(function(item) {
return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
})
}
function childrenIgnored (self, path) {
if (!self.ignore.length)
return false
return self.ignore.some(function(item) {
return !!(item.gmatcher && item.gmatcher.match(path))
})
}
| hassanabidpk/portfolio | node_modules/bower/node_modules/glob/common.js | JavaScript | mit | 5,901 |
<a href="https://www.instagram.com/{{ site.social_username }}" title="Follow me on Instagram" class="link-social block">
<svg height="32" class="header-social" version="1.1" width="32" viewBox="0 0 16 16" aria-hidden="true">
<g>
<path d="M11.9,5.1c-0.1-0.2-0.2-0.4-0.4-0.6s-0.3-0.3-0.6-0.4C10.8,4,10.5,4,10,3.9c-0.5,0-0.7,0-2,0s-1.5,0-2,0
C5.5,4,5.2,4,5.1,4.1C4.8,4.2,4.7,4.3,4.5,4.5S4.2,4.8,4.1,5.1C4,5.2,4,5.5,3.9,6c0,0.5,0,0.7,0,2s0,1.5,0,2c0,0.5,0.1,0.8,0.2,0.9
c0.1,0.2,0.2,0.4,0.4,0.6c0.2,0.2,0.3,0.3,0.6,0.4C5.2,12,5.5,12,6,12.1c0.5,0,0.7,0,2,0c1.3,0,1.5,0,2,0c0.5,0,0.8-0.1,0.9-0.2
c0.2-0.1,0.4-0.2,0.6-0.4s0.3-0.3,0.4-0.6c0.1-0.2,0.2-0.4,0.2-0.9c0-0.5,0-0.7,0-2s0-1.5,0-2C12,5.5,12,5.2,11.9,5.1z M8,10.6
c-1.4,0-2.6-1.1-2.6-2.6c0-1.4,1.1-2.6,2.6-2.6c1.4,0,2.6,1.1,2.6,2.6C10.6,9.4,9.4,10.6,8,10.6z M10.7,5.9c-0.3,0-0.6-0.3-0.6-0.6
s0.3-0.6,0.6-0.6s0.6,0.3,0.6,0.6S11,5.9,10.7,5.9z"/>
<path d="M8,0C3.6,0,0,3.6,0,8s3.6,8,8,8s8-3.6,8-8S12.4,0,8,0z M13,10.1c0,0.5-0.1,0.9-0.2,1.2c-0.1,0.3-0.3,0.6-0.6,0.9
c-0.3,0.3-0.6,0.4-0.9,0.6c-0.3,0.1-0.7,0.2-1.2,0.2c-0.5,0-0.7,0-2.1,0s-1.5,0-2.1,0c-0.5,0-0.9-0.1-1.2-0.2
c-0.3-0.1-0.6-0.3-0.9-0.6c-0.3-0.3-0.4-0.6-0.6-0.9C3.1,11,3.1,10.6,3,10.1C3,9.5,3,9.4,3,8s0-1.5,0-2.1c0-0.5,0.1-0.9,0.2-1.2
c0.1-0.3,0.3-0.6,0.6-0.9c0.3-0.3,0.6-0.4,0.9-0.6C5,3.1,5.4,3.1,5.9,3C6.5,3,6.6,3,8,3s1.5,0,2.1,0c0.5,0,0.9,0.1,1.2,0.2
c0.3,0.1,0.6,0.3,0.9,0.6c0.3,0.3,0.4,0.6,0.6,0.9C12.9,5,12.9,5.4,13,5.9c0,0.5,0,0.7,0,2.1S13,9.5,13,10.1z"/>
<circle cx="8" cy="8" r="1.7"/>
</g>
</svg>
</a>
| zchen24/zchen24.github.io | _includes/instagram.html | HTML | mit | 1,555 |
// Type definitions for Kii Cloud SDK v2.4.6
// Project: http://en.kii.com/
// Definitions by: Kii Consortium <http://jp.kii.com/consortium/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace KiiCloud {
enum KiiACLAction {
KiiACLBucketActionCreateObjects,
KiiACLBucketActionQueryObjects,
KiiACLBucketActionDropBucket,
KiiACLObjectActionRead,
KiiACLObjectActionWrite,
}
export enum KiiSite {
US,
JP,
CN,
SG,
CN3,
EU
}
export enum KiiAnalyticsSite {
US,
JP,
CN,
SG,
CN3,
EU
}
enum KiiSocialNetworkName {
FACEBOOK = 1,
TWITTER = 2,
QQ = 3,
GOOGLEPLUS = 4,
RENREN = 5
}
type KiiSocialConnectOptions = {
access_token: string,
openID?: string
} | {
oauth_token: string,
oauth_token_secret: string
}
interface KiiSocialAccountInfo {
createdAt: number;
provider: KiiSocialNetworkName;
socialAccountId: string;
}
interface KiiThingFields {
/**
* thing identifier given by thing vendor.
*/
_vendorThingID: string;
/**
* thing password given by thing vendor.
*/
_password: string;
/**
* thing type given by thing vendor.
*/
_thingType?: string;
/**
* vendor identifier given by thing vendor.
*/
_vendor?: string;
/**
* firmware version given by thing vendor.
*/
_firmwareVersion?: string;
/**
* lot identifier given by thing vendor.
*/
_lot?: string;
/**
* product name given by thing vendor.
*/
_productName?: string;
/**
* arbitrary string field.
*/
_stringField1?: string;
/**
* arbitrary string field.
*/
_stringField2?: string;
/**
* arbitrary string field.
*/
_stringField3?: string;
/**
* arbitrary string field.
*/
_stringField4?: string;
/**
* arbitrary string field.
*/
_stringField5?: string;
/**
* arbitrary number field.
*/
_numberField1?: number;
/**
* arbitrary number field.
*/
_numberField2?: number;
/**
* arbitrary number field.
*/
_numberField3?: number;
/**
* arbitrary number field.
*/
_numberField4?: number;
/**
* arbitrary number field.
*/
_numberField5?: number;
/**
* custom fields.
*/
[name: string]: any;
}
type KiiACLSubject =
KiiGroup |
KiiUser |
KiiAnyAuthenticatedUser |
KiiAnonymousUser |
KiiThing;
interface APNSAlert {
title: string;
body: string;
"title-loc-key": string;
"title-loc-args": string[];
"action-loc-key": string;
"loc-key": string;
"loc-args": string[];
"launch-image": string;
}
interface identityData {
emailAddress?: string;
phoneNumber?: string;
username?: string;
}
interface KiiAccessTokenObject {
access_token: string;
expires_at: Date;
}
interface KiiGcmInstallationResponse {
installationID: string;
}
interface KiiMqttInstallationResponse {
installationID: string;
installationRegistrationID: string;
}
interface KiiMqttEndpoint {
installationID: string;
username: string;
password: string;
mqttTopic: string;
host: string;
"X-MQTT-TTL": number;
portTCP: number;
portSSL: number;
portWS: number;
portWSS: number;
}
/**
* The main SDK class
*/
export class Kii {
/**
* Kii SDK Build Number
*
* @return current build number of the SDK
*/
static getBuildNumber(): string;
/**
* Kii SDK Version Number
*
* @return current version number of the SDK
*/
static getSDKVersion(): string;
/**
* Retrieve the current app ID
*
* @return The current app ID
*/
static getAppID(): string;
/**
* Retrieve the current app key
*
* @return The current app key
*/
static getAppKey(): string;
/**
* Set the access token lifetime in seconds.
*
* If you don't call this method or call it with 0, token won't be expired.
* Call this method if you like the access token to be expired
* after a certain period. Once called, token retrieved
* by each future authentication will have the specified lifetime.
* Note that, it will not update the lifetime of token received prior
* calling this method. Once expired, you have to login again to renew the token.
*
* @param expiresIn The life time of access token in seconds.
*
* @throws If specified expiresIn is negative.
* @throws If Kii has not been initialized
*
* @example
* Kii.setAccessTokenExpiration(3600);
*/
static setAccessTokenExpiration(expiresIn: number): void;
/**
* Returns access token lifetime in seconds.
*
* If access token lifetime has not set explicitly by {@link Kii.setAccessTokenExpiration(expiresIn)}, returns 0.
*
* @return access token lifetime in seconds.
*
* @throws If Kii has not been initialized
*/
static getAccessTokenExpiration(): number;
/**
* Initialize the Kii SDK with a specific URL
*
* Should be the first Kii SDK action your application makes.
*
* @param appID The application ID found in your Kii developer console
* @param appKey The application key found in your Kii developer console
* @param site Can be one of the constants KiiSite.US, KiiSite.JP, KiiSite.CN or KiiSite.SG depending on your location.
* @param analyticsOption An object used for initializing KiiAnalytics, If not provided or invalid object provided, KiiAnalytics won't be initialized. If provided, it can be empty object or with analyticsOption.deviceId.<br> If provided, but deviceId is not provided, SDK generates a new deviceId and use it when upload events. It can be retrieved by {@link KiiAnalytics.getDeviceId()}. It is recommended to retrieve the deviceId and store it to identify the device properly.
*
* @example
* // Disable KiiAnalytics
* Kii.initializeWithSite("my-app-id", "my-app-key", KiiSite.JP);
*
* // Enable KiiAnalytics with deviceId
* var analyticsOption = { deviceId: "my-device-id" };
* Kii.initializeWithSite("my-app-id", "my-app-key", KiiSite.JP, analyticsOption);
*
* // Enable KiiAnalytics without deviceId
* Kii.initializeWithSite("my-app-id", "my-app-key", KiiSite.JP, {});
*/
static initializeWithSite(appID: string, appKey: string, site: KiiSite, analyticsOption?: any): void;
/**
* Initialize the Kii SDK
*
* Should be the first Kii SDK action your application makes.
* Meanwhile, Kii Analytics is initialized.
*
* @param appID The application ID found in your Kii developer console
* @param appKey The application key found in your Kii developer console
* @param analyticsOption An object used for initializing KiiAnalytics, If not provided or invalid object provided, KiiAnalytics won't be initialized. If provided, it can be empty object or with analyticsOption.deviceId. <br> If provided, but deviceId is not provided, SDK generates a new deviceId and use it when upload events. It can be retrieved by {@link KiiAnalytics.getDeviceId()}. It is recommended to retrieve the deviceId and store it to identify the device properly.
*
* @example
* // Disable KiiAnalytics
* Kii.initialize("my-app-id", "my-app-key");
*
* // Enable KiiAnalytics with deviceId
* var analyticsOption = { deviceId: "my-device-id" };
* Kii.initialize("my-app-id", "my-app-key", analyticsOption);
*
* // Enable KiiAnalytics without deviceId
* Kii.initialize("my-app-id", "my-app-key", {});
*/
static initialize(appID: string, appKey: string, analyticsOption?: any): void;
/**
* Creates a reference to a bucket for this app
*
* <br><br>The bucket will be created/accessed within this app's scope
*
* @param bucketName The name of the bucket the app should create/access
*
* @return A working KiiBucket object
*
* @example
* var bucket = Kii.bucketWithName("myBucket");
*/
static bucketWithName(bucketName: string): KiiBucket;
/**
* Creates a reference to a encrypted bucket for this app
*
* <br><br>The bucket will be created/accessed within this app's scope
*
* @param bucketName The name of the bucket the app should create/access
*
* @return A working KiiEncryptedBucket object
*
* @example
* var bucket = Kii.encryptedBucketWithName("myBucket");
*/
static encryptedBucketWithName(bucketName: string): KiiBucket;
/**
* Creates a reference to a group with the given name
*
* @param groupName An application-specific group name
*
* @return A new KiiGroup reference
*
* @example
* var group = new Kii.groupWithName("myGroup");
*/
static groupWithName(groupName: string): KiiGroup;
/**
* Creates a reference to a group with the given name and a list of default members
*
* @param groupName An application-specific group name
* @param members An array of KiiUser objects to add to the group
*
* @return A new KiiGroup reference
*
* @example
* var group = new KiiGroup.groupWithName("myGroup", members);
*/
static groupWithNameAndMembers(groupName: string, members: KiiUser[]): KiiGroup;
/**
* Authenticate as app admin.
* <br><br>
* <b>This api call must not placed on code which can be accessed by browser.
* This api is intended to be used by server side code like Node.js.
* If you use this api in code accessible by browser, your application id and application secret could be stolen.
* Attacker will be act as appadmin and all the data in your application will be suffered.
* </b>
*
* @param clientId assigned to your application.
* @param clientSecret assigned to your application.
* @param callbacks The callback methods called when authentication succeeded/failed.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(adminContext). adminContext is a KiiAppAdminContext instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* Kii.authenticateAsAppAdmin("your client id", "your client secret", {
* success: function(adminContext) {
* // adminContext : KiiAppAdminContext instance
* // Operate entities with adminContext.
* },
* failure: function(error, statusCode) {
* // Authentication failed.
* }
* );
*
* // example to use Promise
* Kii.authenticateAsAppAdmin("your client id", "your client secret").then(
* function(adminContext) { // fulfill callback function
* // adminContext : KiiAppAdminContext instance
* // Operate entities with adminContext.
*
* },
* function(error) { // reject callback function
* // Authentication failed.
* var errorString = error.message;
* }
* );
*/
static authenticateAsAppAdmin(clientId: string, clientSecret: string, callbacks?: { success(adminContext: KiiAppAdminContext): any; failure(error: string, statusCode: number): any; }): Promise<KiiAppAdminContext>;
/**
* Instantiate KiiServerCodeEntry with specified entry name.
*
* @param entryName Name of the entry.
*
* @return KiiServerCodeEntry instance.
*
* @throws Thrown when entryName is invalid in the following cases:
* <li>not type of string </li>
* <li>empty string </li>
* <li>invalid string. Valid entryName pattern is "[a-zA-Z][_a-zA-Z0-9]*$".</li>
*
* @example
* var entry = Kii.serverCodeEntry("main");
*/
static serverCodeEntry(entryName: string): KiiServerCodeEntry;
/**
* Instantiate serverCodeEntryWithVersion with specified entry name and version.
*
* @param entryName Name of the entry.
* @param version Version of the entry.
*
* @return KiiServerCodeEntry instance.
*
* @throws Thrown in the following cases: <br>
* <li>entryName or version is not type of string </li>
* <li>entryName or version is empty string </li>
* <li>entryName is invalid string. Valid entryName pattern is "[a-zA-Z][_a-zA-Z0-9]*$".</li>
*
* @example
* var entry = Kii.serverCodeEntryWithVersion("main", "gulsdf6ful8jvf8uq6fe7vjy6");
*/
static serverCodeEntryWithVersion(entryName: string, version: string): KiiServerCodeEntry;
/**
* Instantiate topic belongs to application.
*
* @param topicName name of the topic. Must be a not empty string.
*
* @return topic instance.
*/
static topicWithName(topicName: string): KiiTopic;
/**
* Gets a list of topics in app scope
*
* @param callbacks An object with callback methods defined
* @param paginationKey You can specify the pagination key with the nextPaginationKey passed by callbacks.success or fullfill callback of promise. If empty string or no string object is provided, this API regards no paginationKey specified.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is array of KiiTopic instances.</li>
* <li>params[1] is string of nextPaginationKey.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* Kii.listTopics({
* success: function(topicList, nextPaginationKey) {
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* Kii.listTopics({
* success: function(topicList, nextPaginationKey) {...},
* failure: function(anErrorString) {...}
* }, nextPaginationKey);
* }
* },
* failure: function(anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use promise
* Kii.listTopics().then(
* function(params) {
* var topicList = params[0];
* var nextPaginationKey = params[1];
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* Kii.listTopics(null, nextPaginationKey).then(
* function(params) {...},
* function(error) {...}
* );
* }
* },
* function(error) {
* // do something with the error response
* }
* );
*/
static listTopics(callbacks?: { success(topicList: KiiTopic[], nextPaginationKey: string): any; failure(anErrorString: string): any; }, paginationKey?: string): Promise<[KiiTopic[], string]>;
/**
* Authenticate as Thing.
* <br><br>
* <b>This api is intended to be used in a Thing device, where the user
* credentials or app admin context is not configured. This Thing must be
* already registered in Kii Cloud.
* </b>
*
* @param vendorThingID vendorThingID of a registered Thing.
* @param password password for the registered Thing.
* @param callbacks The callback methods called when authentication succeeded/failed.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thingAuthContext). thingAuthContext is a KiiThingContext instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* Kii.authenticateAsThing("vendor thing id", "password of this thing", {
* success: function(thingAuthContext) {
* // thingAuthContext : KiiThingContext instance
* // Operate entities with thingAuthContext.
* },
* failure: function(error) {
* // Authentication failed.
* }
* );
*
* // example to use Promise
* Kii.authenticateAsThing("vendor thing id", "password of this thing").then(
* function(thingAuthContext) { // fulfill callback function
* // thingAuthContext : KiiThingContext instance
* // Operate entities with thingAuthContext.
*
* },
* function(error) { // reject callback function
* // Authentication failed.
* var errorString = error.message;
* }
* );
*/
static authenticateAsThing(vendorThingID: string, password: string, callbacks?: { success(thingAuthContext: KiiThingContext): any; failure(error: Error): any; }): Promise<KiiThingContext>;
/**
* Create a KiiThingContext reference
* <br><br>
* <b>This api is intended to be used in a Thing device, where the user
* credentials or app admin context is not configured. This Thing must be
* already registered in Kii Cloud.
* </b>
*
* @param thingID thingID of a registered Thing.
* @param token token for the registered Thing.
* @param callbacks The callback methods called when creation succeeded/failed.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thingContext). thingContext is a KiiThingContext instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* Kii.authenticateAsThingWithToken("thing_id", "thing_token", {
* success: function(thingContext) {
* // thingContext : KiiThingContext instance
* // Operate entities with thingContext.
* },
* failure: function(error) {
* // Creation failed.
* }
* );
*
* // example to use Promise
* Kii.authenticateAsThingWithToken("thing_id", "thing_token").then(
* function(thingContext) { // fulfill callback function
* // thingContext : KiiThingContext instance
* // Operate entities with thingContext.
*
* },
* function(error) { // reject callback function
* // Creation failed.
* var errorString = error.message;
* }
* );
*/
static authenticateAsThingWithToken(thingID: string, token: string, callbacks?: { success(thingContext: KiiThingContext): any; failure(error: Error): any; }): Promise<KiiThingContext>;
}
/**
* Represents a KiiACL object
*/
export class KiiACL {
/**
* Get the list of active ACLs associated with this object from the server
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is the KiiACL instance which this method was called on.</li>
* <li>params[1] is array of KiiACLEntry instances.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiACL instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var acl = . . .; // a KiiACL object
* acl.listACLEntries({
* success: function(theACL, theEntries) {
* // do something
* },
*
* failure: function(theACL, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var acl = . . .; // a KiiACL object
* acl.listACLEntries().then(
* function(params) { // fulfill callback function
* var theACL = params[0];
* var theEntries = params[1];
* // do something
* },
* function(error) { // reject callback function
* var theACL = error.target;
* var anErrorString = error.message;
* // do something with the error response
* });
*/
listACLEntries(callbacks?: { success(theACL: KiiACL, theEntries: KiiACLEntry[]): any; failure(theACL: KiiACL, anErrorString: string): any; }): Promise<[KiiACL, KiiACLEntry[]]>;
/**
* Add a KiiACLEntry to the local object, if not already present. This does not explicitly grant any permissions, which should be done through the KiiACLEntry itself. This method simply adds the entry to the local ACL object so it can be saved to the server.
*
* @param entry The KiiACLEntry to add
*
* @throws If specified entry is not an instance of KiiACLEntry.
*
* @example
* var aclEntry = . . .; // a KiiACLEntry object
* var acl = . . .; // a KiiACL object
* acl.putACLEntry(aclEntry);
*/
putACLEntry(entry: KiiACLEntry): void;
/**
* Remove a KiiACLEntry to the local object. This does not explicitly revoke any permissions, which should be done through the KiiACLEntry itself. This method simply removes the entry from the local ACL object and will not be saved to the server.
*
* @param entry The KiiACLEntry to remove
*
* @throws If specified entry is not an instance of KiiACLEntry.
*
* @example
* var aclEntry = . . .; // a KiiACLEntry object
* var acl = . . .; // a KiiACL object
* acl.removeACLEntry(aclEntry);
*/
removeACLEntry(entry: KiiACLEntry): void;
/**
* Save the list of ACLEntry objects associated with this ACL object to the server
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedACL). theSavedACL is KiiACL instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiACL instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var acl = . . .; // a KiiACL object
* acl.save({
* success: function(theSavedACL) {
* // do something with the saved acl
* },
*
* failure: function(theACL, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var acl = . . .; // a KiiACL object
* acl.save().then(
* function(theSavedACL) { // fulfill callback function
* // do something with the saved acl
* },
* function(error) { // reject callback function
* var theACL = error.target;
* var anErrorString = error.message;
* // do something with the error response
* });
*/
save(callbacks?: { success(theSavedACL: KiiACL): any; failure(theACL: KiiACL, anErrorString: string): any; }): Promise<KiiACL>;
}
/**
* Represents a KiiACLEntry object
*/
export class KiiACLEntry {
/**
* The action that is being permitted/restricted. Possible values:
* <br><br>
* KiiACLAction.KiiACLBucketActionCreateObjects,<br>
* KiiACLAction.KiiACLBucketActionQueryObjects, <br>
* KiiACLAction.KiiACLBucketActionDropBucket,<br>
* KiiACLAction.KiiACLBucketActionReadObjects,<br>
* KiiACLAction.KiiACLObjectActionRead,<br>
* KiiACLAction.KiiACLObjectActionWrite,<br>
* KiiACLAction.KiiACLSubscribeToTopic,<br>
* KiiACLAction.KiiACLSendMessageToTopic
*
* @param value The action being permitted/restricted
*
* @throws If the value is not one of the permitted values
*/
setAction(value: KiiACLAction): void;
/**
* Get the action that is being permitted/restricted in this entry
*
* @return
*/
getAction(): KiiACLAction;
/**
* Set the subject to which the action/grant is being applied
*
* @param subject instance.
*
* @throws If the value is not one of the permitted values
*/
setSubject(subject: KiiACLSubject): void;
/**
* Get the subject that is being permitted/restricted in this entry
*
* @return
*/
getSubject<T extends KiiACLSubject>(): T;
/**
* Set whether or not the action is being permitted to the subject
*
* @param value true if the action is permitted, false otherwise
*
* @throws If the value is not a boolean type
*/
setGrant(value: boolean): void;
/**
* Get whether or not the action is being permitted to the subject
*
* @return
*/
getGrant(): boolean;
/**
* Create a KiiACLEntry object with a subject and action
*
* The entry will not be applied on the server until the KiiACL object is
* explicitly saved. This method simply returns a working KiiACLEntry with
* a specified subject and action.
*
* @param Subject to which the action/grant is being applied
* @param action One of the specified KiiACLAction values the
* permissions is being applied to
*
* @return A KiiACLEntry object with the specified attributes
*
* @throws If specified subject is invalid.
* @throws If the specified action is invalid.
*/
static entryWithSubject(Subject: KiiACLSubject, action: KiiACLAction): KiiACLEntry;
}
/**
* The main SDK class
*/
export class KiiAnalytics {
/**
* Retrieve the current app ID
*
* @return The current app ID
*/
static getAppID(): string;
/**
* Retrieve the current app key
*
* @return The current app key
*/
static getAppKey(): string;
/**
* Get the deviceId. If deviceId has not specified while initialization, it returns SDK generated deviceId.It is recommended to retrieve the deviceId and store it to identify the device properly.
*
* @return deviceId.
*/
static getDeviceId(): string;
/**
* Is the SDK printing logs to the console?
*
* @return True if printing logs, false otherwise
*/
static isLogging(): boolean;
/**
* Set the logging status of the SDK
*
* Helpful for development - we strongly advice you turn off logging for any production code.
*
* @param True if logs should be printed, false otherwise
*
* @example
* KiiAnalytics.setLogging(true);
*/
static setLogging(True: boolean): void;
/**
*
*
* @deprecated Use {@link Kii.initializeWithSite} instead. Initialize the Kii SDK with a specific URL
*
* Should be the first Kii SDK action your application makes
*
* @param appID The application ID found in your Kii developer console
* @param appKey The application key found in your Kii developer console
* @param site Can be one of the constants KiiAnalyticsSite.US, KiiAnalyticsSite.JP, KiiAnalyticsSite.CN, KiiAnalyticsSite.CN3 or KiiAnalyticsSite.SG depending on your location.
* @param deviceid If deviceId is not provided, SDK generates a new deviceId and use it when upload events.deviceId can be retrieved by {@link KiiAnalytics.getDeviceId()}.It is recommended to retrieve the deviceId and store it to identify the device properly.
*
* @example
* // initialize without deviceId
* Kii.initializeWithSite("my-app-id", "my-app-key", KiiAnalyticsSite.JP);
* // initialize with deviceId
* Kii.initializeWithSite("my-app-id", "my-app-key", KiiAnalyticsSite.JP, "my-device-id");
*/
static initializeWithSite(appID: string, appKey: string, site: KiiAnalyticsSite, deviceid: string): void;
/**
*
*
* @deprecated Use {@link Kii.initialize} instead. Initialize the KiiAnalytics SDK
*
* Should be the first KiiAnalytics SDK action your application makes
*
* @param appID The application ID found in your Kii developer console
* @param appKey The application key found in your Kii developer console
* @param deviceid If deviceId is not provided, SDK generates a new deviceId and use it when upload events. deviceId can be retrieved by {@link KiiAnalytics.getDeviceId()}.It is recommended to retrieve the deviceId and store it to identify the device properly.
*
* @example
* // initialize without deviceId
* Kii.initializeWithSite("my-app-id", "my-app-key", KiiAnalyticsSite.JP);
* // initialize with deviceId
* Kii.initializeWithSite("my-app-id", "my-app-key", KiiAnalyticsSite.JP, "my-device-id");
*/
static initialize(appID: string, appKey: string, deviceid: string): void;
/**
* Utilize the KiiAnalytics logger to track SDK-specific actions
*
* Helpful for development - we strongly advice you turn off logging for any production code.
*
* @param message The message to print to console.log in your browser
*
* @example
* KiiAnalytics.logger("My message");
*/
static logger(message: string): void;
/**
* Log a single event to be uploaded to KiiAnalytics
*
* Use this method if you'd like to track an event by name only. If you'd like to track other attributes/dimensions, please use KiiAnalytics.trackEventWithExtras(eventName, parameters)
*
* @param eventName A string representing the event name for later tracking
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(). No parameters. </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*/
static trackEvent(eventName: string): Promise<void>;
/**
* Log a single event to be uploaded to KiiAnalytics
*
* Use this method if you'd like to track an event by name and add extra information to the event.
*
* @param eventName A string representing the event name for later tracking
* @param extras A dictionary of JSON-encodable key/value pairs to be attached to the event.
* Key must follow the pattern "^[a-zA-Z][a-zA-Z0-9_]{0,63}$".Supported value type is string, number, boolean and array.
* Empty string or empty array will be considered as invalid.Type of array elements must be string, number or boolean.
* If any key/value pair is invalid, it will be ignored and not sent to the KiiCloud.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(). No parameters. </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*/
static trackEventWithExtras(eventName: string, extras: any): Promise<void>;
/**
* Log a single event to be uploaded to KiiAnalytics
*
* Use this method if you'd like to track an event asynchronously by name and add extra information to the event.
*
* @param eventName A string representing the event name for later tracking
* @param extras A dictionary of JSON-encodable key/value pairs to be attached to the event.
* Key must follow the pattern "^[a-zA-Z][a-zA-Z0-9_]{0,63}$".Supported value type is string, number, boolean and array.
* Empty string or empty array will be considered as invalid.Type of array elements must be string, number or boolean.
* If any key/value pair is invalid, it will be ignored and not sent to the KiiCloud.
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(). No parameters. </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*/
static trackEventWithExtrasAndCallbacks(eventName: string, extras: any, callbacks?: { success(): any; failure(error: Error): any; }): Promise<void>;
/**
*
*
* @deprecated Set a custom API endpoint URL
*
* @param url A string containing the desired endpoint
*/
static setBaseURL(url: string): void;
/**
*
*
* @deprecated Use {@link Kii.getSDKVersion} instead. Kii Analytics SDK Version Number
*
* @return current version number of the SDK
*/
static getSDKVersion(): string;
}
/**
* Represent an anonymous user for setting the ACL of an object. This will include anyone using the application but have not signed up or authenticated as registered user.
*
* When retrieving ACL from an object, test for this class to determine the subject type.
*/
export class KiiAnonymousUser {
/**
* Returns the ID of Anonymous user.
*/
getID(): string;
}
/**
* Represent any authenticated user for setting the ACL of an object. This will include anyone using the application who has registered and authenticated in the current session.
*
* When retrieving ACL from an object, test for this class to determine the subject type. Example:
*/
export class KiiAnyAuthenticatedUser {
/**
* Returns the ID of AuthenticatedUser user.
*/
getID(): string;
}
/**
* represents the app admin context
* <br><br>
* <B>This class must not referred from code accessible from browser.
* This class is intended to be used by server side code like Node.js.
* If you use this class in code accessible by browser, your application client id and client secret could be stolen.
* Attacker will be act as application admin and all the data in your application will be suffered.
* </B>
* Application administrator context. Entities obtained from this class will be manipulated by application admin.
*/
export class KiiAppAdminContext {
/**
* Creates a reference to a bucket operated by app admin.
* <br><br>The bucket will be created/accessed within this app's scope
*
* @param bucketName The name of the bucket the app should create/access
*
* @return A working KiiBucket object
*
* @example
* Kii.authenticateAsAppAdmin("client-id", "client-secret", {
* success: function(adminContext) {
* var bucket = adminContext.bucketWithName("myBucket");
* // KiiBucket operation by app admin is available now.
* },
* failure: function(errorString, errorCode) {
* // auth failed.
* }
* });
*/
bucketWithName(bucketName: string): KiiBucket;
/**
* Creates a reference to a encrypted bucket operated by app admin.
* <br><br>The bucket will be created/accessed within this app's scope
*
* @param bucketName The name of the bucket the app should create/access
*
* @return A working KiiBucket object
*
* @example
* Kii.authenticateAsAppAdmin("client-id", "client-secret", {
* success: function(adminContext) {
* var bucket = adminContext.encryptedBucketWithName("myBucket");
* // KiiBucket operation by app admin is available now.
* },
* failure: function(errorString, errorCode) {
* // auth failed.
* }
* });
*/
encryptedBucketWithName(bucketName: string): KiiBucket;
/**
* Creates a reference to a group operated by app admin.
* <br><br>
* <b>Note:</b>
* Returned instance from this API can not operate existing KiiGroup.<br>
* If you want to operate existing KiiGroup, please use {@link KiiAppAdminContext#groupWithURI} or {@link KiiAppAdminContext#groupWithID}.
*
* @param group name.
*
* @return A working KiiGroup object
*
* @example
* Kii.authenticateAsAppAdmin("client-id", "client-secret", {
* success: function(adminContext) {
* var group = adminContext.groupWithName("newGroup");
* // KiiGroup operation by app admin is available now.
* },
* failure: function(errorString, errorCode) {
* // auth failed.
* }
* });
*/
groupWithName(group: string): KiiGroup;
/**
* Creates a reference to a user operated by app admin.
*
* @param user id.
*
* @return A working KiiUser object
*
* @example
* Kii.authenticateAsAppAdmin("client-id", "client-secret", {
* success: function(adminContext) {
* var user = adminContext.userWithID("userid");
* // KiiUser operation by app admin is available now.
* },
* failure: function(errorString, errorCode) {
* // auth failed.
* }
* });
*/
userWithID(user: string): KiiUser;
/**
* Creates a reference to an object operated by app admin using object`s URI.
*
* @param object URI.
*
* @return A working KiiObject instance
*
* @throws If the URI is null, empty or does not have correct format.
*/
objectWithURI(object: string): KiiObject;
/**
* Creates a reference to a group operated by app admin using group's ID.
* <br><br>
* <b>Note:</b>
* Returned instance from this API can operate existing KiiGroup.<br>
* If you want to create a new KiiGroup, please use {@link KiiAppAdminContext#groupWithName}.
*
* @param group ID.
*
* @return A working KiiGroup object
*
* @throws Thrown if passed groupID is null or empty.
*
* @example
* Kii.authenticateAsAppAdmin("client-id", "client-secret", {
* success: function(adminContext) {
* var groupID = "0123456789abcdefghijklmno";
* var group = adminContext.groupWithID(groupID);
* // KiiGroup operation by app admin is available now.
* },
* failure: function(errorString, errorCode) {
* // auth failed.
* }
* });
*/
groupWithID(group: string): KiiGroup;
/**
* Register new group own by specified user on Kii Cloud with specified ID.
* This method can be used only by app admin.
*
* <br><br>If the group that has specified id already exists, registration will be failed.
*
* @param groupID ID of the KiiGroup
* @param groupName Name of the KiiGroup
* @param user id of owner
* @param members An array of KiiUser objects to add to the group
* @param callbacks
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* <li>error.addMembersArray is array of KiiUser to be added as memebers of this group.</li>
* <li>error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* Kii.authenticateAsAppAdmin("client-id", "client-secret", {
* success: function(adminContext) {
* var members = [];
* members.push(KiiUser.userWithID("Member User Id"));
* adminContext.registerGroupWithOwnerAndID("Group ID", "Group Name", "Owner User ID", members, {
* success: function(theSavedGroup) {
* // do something with the saved group
* },
* failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) {
* // do something with the error response
* }
* });
* },
* failure: function(errorString, errorCode) {
* // auth failed.
* }
* });
* // example to use Promise
* Kii.authenticateAsAppAdmin("client-id", "client-secret").then(
* function(adminContext) {
* var members = [];
* members.push(KiiUser.userWithID("Member User Id"));
* return adminContext.registerGroupWithOwnerAndID("Group ID", "Group Name", "Owner User ID", members);
* }
* ).then(
* function(group) {
* // do something with the saved group
* }
* );
*/
registerGroupWithOwnerAndID(groupID: string, groupName: string, user: string, members: KiiUser[], callbacks?: { success(adminContext: KiiAppAdminContext): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise<KiiAppAdminContext>;
/**
* Creates a reference to a group operated by app admin using group's URI.
* <br><br>
* <b>Note:</b>
* Returned instance from this API can operate existing KiiGroup.<br>
* If you want to create a new KiiGroup, please use {@link KiiAppAdminContext#groupWithName}.
*
* @param group URI.
*
* @return A working KiiGroup object
*
* @throws Thrown if the URI is null, empty or does not have correct format.
*
* @example
* Kii.authenticateAsAppAdmin("client-id", "client-secret", {
* success: function(adminContext) {
* var groupUri = ...; // KiiGroup's URI
* var group = adminContext.groupWithURI(groupUri);
* // KiiGroup operation by app admin is available now.
* },
* failure: function(errorString, errorCode) {
* // auth failed.
* }
* });
*/
groupWithURI(group: string): KiiGroup;
/**
* Find registered KiiUser with the email.<br>
* If there are no user registers with the specified email or if there are but not verified email yet,
* callbacks.failure or reject callback of promise will be called.<br>
* If the email is null or empty, callbacks.failure or reject callback of promise will be callded.
* <br><br>
* <b>Note:</b>
* <ul>
* <li>If "Expose Full User Data To Others" is enabled in the application console, the response will contain full of the user data.</li>
* <li>Otherwise, the response will only contain "userID", "loginName" and "displayName" field values if exist.</li>
* </ul>
*
* @param email The email to find KiiUser who owns it.<br>
* Don't add prefix of "EMAIL:" described in REST API documentation. SDK will take care of it.
* @param callbacks An object with callback methods defined.
* This argument is mandatory and can't be omitted.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is a KiiAppAdminContext instance which this method was called on.</li>
* <li>params[1] is a found KiiUser instance.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiAppAdminContext instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* Kii.authenticateAsAppAdmin("client-id", "client-secret", {
* success: function(adminContext) {
* adminContext.findUserByEmail("user_to_find@example.com", {
* success: function(adminContext, theMatchedUser) {
* // Do something with the found user
* },
* failure: function(adminContext, anErrorString) {
* // Do something with the error response
* }
* });
* },
* failure: function(errorString, errorCode) {
* // Auth failed.
* }
* });
*
* // example to use Promise
* Kii.authenticateAsAppAdmin("client-id", "client-secret").then(
* function(adminContext) {
* adminContext.findUserByEmail("user_to_find@example.com").then(
* function(params) { // fullfill callback function
* var adminContext = params[0];
* var theMatchedUser = params[1];
* // Do something with the found user
* },
* function(error) { // reject callback function
* var adminContext = error.target;
* var anErrorString = error.message;
* // Do something with the error response
* }
* );
* },
* function(error) {
* // Auth failed.
* }
* );
*/
findUserByEmail(email: string, callbacks?: { success(adminContext: KiiAppAdminContext, theMatchedUser: KiiUser): any; failure(adminContext: KiiAppAdminContext, anErrorString: string): any; }): Promise<[KiiAppAdminContext, KiiUser]>;
/**
* Find registered KiiUser with the phone.<br>
* If there are no user registers with the specified phone or if there are but not verified phone yet,
* callbacks.failure or reject callback of promise will be called.<br>
* If the phone is null or empty, callbacks.failure or reject callback of promise will be called.
* <br><br>
* <b>Note:</b>
* <ul>
* <li>If "Expose Full User Data To Others" is enabled in the application console, the response will contain full of the user data.</li>
* <li>Otherwise, the response will only contain "userID", "loginName" and "displayName" field values if exist.</li>
* </ul>
*
* @param phone The phone number to find KiiUser who owns it.<br>
* Don't add prefix of "PHONE:" described in REST API documentation. SDK will take care of it.
* @param callbacks An object with callback methods defined.
* This argument is mandatory and can't be omitted.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is a KiiAppAdminContext instance which this method was called on.</li>
* <li>params[1] is a found KiiUser instance.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiAppAdminContext instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* Kii.authenticateAsAppAdmin("client-id", "client-secret", {
* success: function(adminContext) {
* adminContext.findUserByPhone("phone_number_to_find", {
* success: function(adminContext, theMatchedUser) {
* // Do something with the found user
* },
* failure: function(adminContext, anErrorString) {
* // Do something with the error response
* }
* });
* },
* failure: function(errorString, errorCode) {
* // Auth failed.
* }
* });
*
* // example to use Promise
* Kii.authenticateAsAppAdmin("client-id", "client-secret").then(
* function(adminContext) {
* adminContext.findUserByPhone("phone_number_to_find").then(
* function(params) { // fullfill callback function
* var adminContext = params[0];
* var theMatchedUser = params[1];
* // Do something with the found user
* },
* function(error) { // reject callback function
* var adminContext = error.target;
* var anErrorString = error.message;
* // Do something with the error response
* }
* );
* },
* function(error) {
* // Auth failed.
* }
* );
*/
findUserByPhone(phone: string, callbacks?: { success(adminContext: KiiAppAdminContext, theMatchedUser: KiiUser): any; failure(adminContext: KiiAppAdminContext, anErrorString: string): any; }): Promise<[KiiAppAdminContext, KiiUser]>;
/**
* Find registered KiiUser with the user name.<br>
* If there are no user registers with the specified user name, callbacks.failure or reject callback of promise will be called.<br>
* If the user name is null or empty, callbacks.failure or reject callback of promise will be called.
* <br><br>
* <b>Note:</b>
* <ul>
* <li>If "Expose Full User Data To Others" is enabled in the application console, the response will contain full of the user data.</li>
* <li>Otherwise, the response will only contain "userID", "loginName" and "displayName" field values if exist.</li>
* </ul>
*
* @param username The user name to find KiiUser who owns it.<br>
* Don't add prefix of "LOGIN_NAME:" described in REST API documentation. SDK will take care of it.
* @param callbacks An object with callback methods defined.
* This argument is mandatory and can't be omitted.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is a KiiAppAdminContext instance which this method was called on.</li>
* <li>params[1] is a found KiiUser instance.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiAppAdminContext instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* Kii.authenticateAsAppAdmin("client-id", "client-secret", {
* success: function(adminContext) {
* adminContext.findUserByUsername("user_name_to_find", {
* success: function(adminContext, theMatchedUser) {
* // Do something with the found user
* },
* failure: function(adminContext, anErrorString) {
* // Do something with the error response
* }
* });
* },
* failure: function(errorString, errorCode) {
* // Auth failed.
* }
* });
* // example to use Promise
* Kii.authenticateAsAppAdmin("client-id", "client-secret").then(
* function(adminContext) {
* adminContext.findUserByUsername("user_name_to_find").then(
* function(params) { // fullfill callback function
* var adminContext = params[0];
* var theMatchedUser = params[1];
* // Do something with the found user
* },
* function(error) { // reject callback function
* var adminContext = error.target;
* var anErrorString = error.message;
* // Do something with the error response
* }
* );
* },
* function(error) {
* // Auth failed.
* }
* );
*/
findUserByUsername(username: string, callbacks?: { success(adminContext: KiiAppAdminContext, theMatchedUser: KiiUser): any; failure(adminContext: KiiAppAdminContext, anErrorString: string): any; }): Promise<[KiiAppAdminContext, KiiUser]>;
/**
* Register thing by app admin.
* Method interface is same as {@link KiiThing#register()}.
* Please refer to KiiThing document for details.
*
* @param fields of the thing to be registered. Please refer to {@link KiiThing#register()} for the details of fields.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thing). thing is KiiThing instance with adminToken.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // Assume you already have adminContext instance.
* adminContext.registerThing(
* {
* _vendorThingID: "thing-XXXX-YYYY-ZZZZZ",
* _password: "thing-password",
* _thingType: "thermometer",
* yourCustomObj: // Arbitrary key can be used.
* { // Object, Array, Number, String can be used. Should be compatible with JSON.
* yourCustomKey1: "value",
* yourCustomKey2: 100
* }
* },
* {
* success: function(thing) {
* // Register Thing succeeded.
* // Operation using thing instance in the parameter
* // is authored by app admin.
* },
* failure: function(error) {
* // Handle error.
* }
* }
* );
*
* // example to use Promise
* // Assume you already have adminContext instance.
* adminContext.registerThing(
* {
* _vendorThingID: "thing-XXXX-YYYY-ZZZZZ",
* _password: "thing-password",
* _thingType: "thermometer",
* yourCustomObj: // Arbitrary key can be used.
* { // Object, Array, Number, String can be used. Should be compatible with JSON.
* yourCustomKey1: "value",
* yourCustomKey2: 100
* }
* }
* ).then(
* function(thing) {
* // Register Thing succeeded.
* // Operation using thing instance in the parameter
* // is authored by app admin.
* },
* function(error) {
* // Handle error.
* }
* );
*/
registerThing(fields: KiiThingFields, callbacks?: { success(thing: KiiThing): any; failure(error: Error): any; }): Promise<KiiThing>;
/**
* Creates a reference to a thing operated by app admin.
*
* @param thing id.
*
* @return A working KiiThing object
*
* @example
* // Assume you already have adminContext instance.
* adminContext.thingWithID(thingID);
*/
thingWithID(thing: string): KiiThing;
/**
* Register user/group as owner of specified thing by app admin.
*
* @param thingID The ID of thing
* @param owner instnce of KiiUser/KiiGroup to be registered as owner.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is an Array instance.
* <ul>
* <li>params[0] is a KiiUser/KiiGroup instance.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* // example to use Promise
* // Assume you already have adminContext instance.
* adminContext.registerOwnerWithThingID("th.xxxx-yyyy-zzzz", group, {
* success: function(group) {
* // Register owner succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* // example to use Promise
* // Assume you already have adminContext instance.
* adminContext.registerOwnerWithThingID("th.xxxx-yyyy-zzzz", group).then(
* function(params) {
* // Register owner succeeded.
* var group = params[0];
* },
* function(error) {
* // Handle error.
* }
* );
*/
registerOwnerWithThingID<T extends KiiUser | KiiGroup>(thingID: string, owner: T, callbacks?: { success(group: T): any; failure(error: Error): any; }): Promise<T>;
/**
* Register user/group as owner of specified thing by app admin.
*
* @param vendorThingID The vendor thing ID of thing
* @param owner instance of KiiUser/KiiGroupd to be registered as owner.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is an Array instance.
* <ul>
* <li>params[0] is a KiiUser/KiiGroup instance.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* // example to use Promise
* // Assume you already have adminContext instance.
* adminContext.registerOwnerWithVendorThingID("xxxx-yyyy-zzzz", group, {
* success: function(group) {
* // Register owner succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* // example to use Promise
* // Assume you already have adminContext instance.
* adminContext.registerOwnerWithVendorThingID("xxxx-yyyy-zzzz", group).then(
* function(group) {
* // Register owner succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
registerOwnerWithVendorThingID<T extends KiiUser | KiiGroup>(vendorThingID: string, owner: T, callbacks?: { success(group: T): any; failure(error: Error): any; }): Promise<T>;
/**
* Load thing with vendor thing ID by app admin.
* Method interface is same as {@link KiiThing#loadWithVendorThingID()}.
* Please refer to KiiThing document for details.
*
* @param vendorThingID registered vendor thing id.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thing). thing is KiiThing instance with adminToken.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // Assume you already have adminContext instance.
* adminContext.loadThingWithVendorThingID("thing-xxxx-yyyy",{
* success: function(thing) {
* // Load succeeded.
* // Operation using thing instance in the parameter
* // is authored by app admin.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // Assume you already have adminContext instance.
* adminContext.loadThingWithVendorThingID("thing-xxxx-yyyy").then(
* function(thing) {
* // Load succeeded.
* // Operation using thing instance in the parameter
* // is authored by app admin.
* },
* function(error) {
* // Handle error.
* }
* );
*/
loadThingWithVendorThingID(vendorThingID: string, callbacks?: { success(thing: KiiThing): any; failure(error: Error): any; }): Promise<KiiThing>;
/**
* Load thing with thing ID by app admin.
* Method interface is same as {@link KiiThing#loadWithThingID()}.
* Please refer to KiiThing document for details.
*
* @param thingID registered thing id.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thing). thing is KiiThing instance with adminToken.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // Assume you already have adminContext instance.
* adminContext.loadThingWithThingID("thing-xxxx-yyyy",{
* success: function(thing) {
* // Load succeeded.
* // Operation using thing instance in the parameter
* // is authored by app admin.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // Assume you already have adminContext instance.
* adminContext.loadThingWithThingID("thing-xxxx-yyyy").then(
* function(thing) {
* // Load succeeded.
* // Operation using thing instance in the parameter
* // is authored by app admin.
* },
* function(error) {
* // Handle error.
* }
* );
*/
loadThingWithThingID(thingID: string, callbacks?: { success(thing: KiiThing): any; failure(error: Error): any; }): Promise<KiiThing>;
/**
* Creates a reference to a topic operated by app admin
*
* @param topicName name of the topic. Must be a not empty string.
*
* @return topic instance.
*/
topicWithName(topicName: string): KiiTopic;
/**
* Gets a list of topics in app scope
*
* @param callbacks An object with callback methods defined
* @param paginationKey You can specify the pagination key with the nextPaginationKey passed by callbacks.success. If empty string or no string object is provided, this API regards no paginationKey specified.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is array of KiiTopic instances.</li>
* <li>params[1] is string of nextPaginationKey.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiAppAdminContext instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // Assume you already have adminContext instance.
* adminContext.listTopics({
* success: function(topicList, nextPaginationKey) {
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* Kii.listTopics({
* success: function(topicList, nextPaginationKey) {...},
* failure: function(anErrorString) {...}
* }, nextPaginationKey);
* }
* },
* failure: function(anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* // Assume you already have adminContext instance.
* adminContext.listTopics().then(
* function(params) {
* var topicList = params[0];
* var nextPaginationKey = params[1];
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* adminContext.listTopics(null, nextPaginationKey).then(
* function(params) {...},
* function(error) {...}
* );
* }
* },
* function(error) {
* // do something with the error response
* }
* );
*/
listTopics(callbacks?: { success(topicList: KiiTopic[], nextPaginationKey: string): any; failure(anErrorString: string): any; }, paginationKey?: string): Promise<[KiiTopic[], string]>;
}
/**
* Represents a KiiBucket object
*/
export class KiiBucket {
/**
* The name of this bucket
*
* @return
*/
getBucketName(): string;
/**
* Create a KiiObject within the current bucket
*
* <br><br>The object will not be created on the server until the KiiObject is explicitly saved. This method simply returns an empty working KiiObject.
*
* @return An empty KiiObject with no specific type
*
* @example
* var bucket = . . .; // a KiiBucket
* var object = bucket.createObject();
*/
createObject(): KiiObject;
/**
* Create a KiiObject within the current bucket, with type
*
* <br><br>The object will not be created on the server until the KiiObject is explicitly saved. This method simply returns an empty working KiiObject with a specified type. The type allows for better indexing and improved query results. It is recommended to use this method - but for lazy creation, the createObject method is also available.
*
* @param type A string representing the desired object type
*
* @return An empty KiiObject with specified type
*
* @example
* var bucket = . . .; // a KiiBucket
* var object = bucket.createObjectWithType("scores");
*/
createObjectWithType(type: string): KiiObject;
/**
* Create a KiiObject within the current bucket, specifying its ID.
*
* <br><br> If the object has not exist on KiiCloud, {@link KiiObject#saveAllFields(callback)}
* will create new Object which has ID specified in the argument.
* If the object exist in KiiCloud, references the existing object which has
* specified ID. use {@link KiiObject#refresh(callback)} to retrieve the contents of
* KiiObject.
*
* @param objectID ID of the obeject you want to instantiate.
*
* @return KiiObject instance.
*
* @throws objectID is not acceptable.
* Refer to {@link KiiObject.isValidObjectID(string)} for details of acceptable string.
*
* @example
* var bucket = . . .; // KiiBucket
* var object = bucket.createObjectWithID('__OBJECT_ID_');
*/
createObjectWithID(objectID: string): KiiObject;
/**
* Get the ACL handle for this bucket
*
* <br><br>Any KiiACLEntry objects added or revoked from this ACL object will be appended to/removed from the server on ACL save.
*
* @return A KiiACL object associated with this KiiObject
*
* @example
* var bucket = . . .; // a KiiBucket
* var acl = bucket.acl();
*/
acl(): KiiACL;
/**
* Perform a query on the given bucket
*
* <br><br>The query will be executed against the server, returning a result set.
*
* @param query An object with callback methods defined
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is a performed KiiQuery instance.</li>
* <li>params[1] is resultSet Array instance. Could be KiiObject, KiiGroup, KiiUser, etc.</li>
* <li>params[2] is a KiiQuery instance for next query. If there are no more results to be retrieved, it will be null.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiBucket instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var bucket = . . .; // a KiiBucket
* var queryObject = . . .; // a KiiQuery
*
* // define the callbacks (stored in a variable for reusability)
* var queryCallbacks = {
* success: function(queryPerformed, resultSet, nextQuery) {
* // do something with the results
* for(var i=0; i<resultSet.length; i++) {
* // do something with the object
* // resultSet[i]; // could be KiiObject, KiiGroup, KiiUser, etc
* }
*
* // if there are more results to be retrieved
* if(nextQuery != null) {
*
* // get them and repeat recursively until no results remain
* bucket.executeQuery(nextQuery, queryCallbacks);
* }
* },
*
* failure: function(bucket, anErrorString) {
* // do something with the error response
* }
* };
* bucket.executeQuery(queryObject, queryCallbacks);
*
* // example to use Promise
* var bucket = . . .; // a KiiBucket
* var queryObject = . . .; // a KiiQuery
* bucket.executeQuery(queryObject).then(
* function(params) {
* var queryPerformed = params[0];
* var resultSet = params[1];
* var nextQuery = params[2];
* // do something with the results
* for(var i=0; i<resultSet.length; i++) {
* // do something with the object
* // resultSet[i]; // could be KiiObject, KiiGroup, KiiUser, etc
* }
*
* // if there are more results to be retrieved
* if(nextQuery != null) {
*
* // get them and repeat recursively until no results remain
* bucket.executeQuery(nextQuery).then(
* function(params) {
* // next query success
* },
* function(error) {
* // next query failed, please handle the error
* }
* );
* }
*
* },
* function(error) {
* // do something with the error response
* }
* );
*/
executeQuery<T>(query: KiiQuery, callbacks?: { success(queryPerformed: KiiQuery, resultSet: T[], nextQuery: KiiQuery): any; failure(bucket: KiiBucket, anErrorString: string): any; }): Promise<[KiiQuery, T[], KiiQuery]>;
/**
* Execute count aggregation of specified query on current bucket.
* Query that passed as nextQuery in success callback of {@link #executeQuery}, is not
* supported, callbacks.failure will be fired in this case.
*
* @param query to be executed. If null, the operation will be same as {@link #count}.
* @param callbacks An object with callback methods defined.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is a KiiBucket instance which this method was called on.</li>
* <li>params[1] is a KiiQuery instance.</li>
* <li>params[2] is an integer count result. </li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiBucket instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var bucket = . . .; // a KiiBucket
* var queryObject = . . .; // a KiiQuery
*
* // define the callbacks
* var callbacks = {
* success: function(bucket, query, count) {
* // do something with the results
* },
*
* failure: function(bucket, errorString) {
* // error happened.
* }
* };
*
* bucket.countWithQuery(queryObject, callbacks);
*
* // example to use Promise
* var bucket = . . .; // a KiiBucket
* var queryObject = . . .; // a KiiQuery
*
* bucket.countWithQuery(queryObject, callbacks).then(
* function(params) {
* var bucket = params[0];
* var query = params[1];
* var count = params[2];
* // do something with the results
* },
* function(error) {
* var bucket = error.target;
* var errorString = error.message;
* // error happened.
* }
* );
*/
countWithQuery(query: KiiQuery, callbacks?: { success(bucket: KiiBucket, query: KiiQuery, count: number): any; failure(bucket: KiiBucket, errorString: string): any; }): Promise<[KiiBucket, KiiQuery, number]>;
/**
* Execute count aggregation of all clause query on current bucket.
*
* @param callbacks An object with callback methods defined.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is a KiiBucket instance which this method was called on.</li>
* <li>params[1] is a KiiQuery instance.</li>
* <li>params[2] is an integer count result. </li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiBucket instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var bucket = . . .; // a KiiBucket
* // define the callbacks
* var callbacks = {
* success: function(bucket, query, count) {
* // do something with the results
* },
*
* failure: function(bucket, errorString) {
* // error happened.
* }
* };
*
* bucket.count(callbacks);
*
* // example to use Promise
* var bucket = . . .; // a KiiBucket
* var queryObject = . . .; // a KiiQuery
*
* bucket.count().then(
* function(params) {
* var bucket = params[0];
* var count = params[2];
* // do something with the results
* },
* function(error) {
* var bucket = error.target;
* var errorString = error.message;
* // error happened.
* }
* );
*/
count(callbacks?: { success(bucket: KiiBucket, query: KiiQuery, count: number): any; failure(bucket: KiiBucket, errorString: string): any; }): Promise<[KiiBucket, KiiQuery, number]>;
/**
* Delete the given bucket from the server
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(deletedBucket). deletedBucket is KiiBucket instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiBucket instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var bucket = . . .; // a KiiBucket
* bucket.delete({
* success: function(deletedBucket) {
* // do something with the result
* },
*
* failure: function(bucketToDelete, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var bucket = . . .; // a KiiBucket
* bucket.delete({
* success: function(deletedBucket) {
* // do something with the result
* },
*
* failure: function(bucketToDelete, anErrorString) {
* // do something with the error response
* }
* }).then(
* function(deletedBucket) {
* // do something with the result
* },
* function(error) {
* // do something with the error response
* }
* );
*/
delete(callbacks?: { success(deletedBucket: KiiBucket): any; failure(bucketToDelete: KiiBucket, anErrorString: string): any; }): Promise<KiiBucket>;
}
/**
* Represents a KiiClause expression object
*/
export class KiiClause {
/**
* Create a KiiClause with the AND operator concatenating multiple KiiClause objects
*
* @param A variable-length list of KiiClause objects to concatenate
*
* @example
* KiiClause clause = KiiClause.and(clause1, clause2, clause3, . . .)
*/
static and(...A: KiiClause[]): KiiClause;
/**
* Create a KiiClause with the OR operator concatenating multiple KiiClause objects
*
* @param A variable-length list of KiiClause objects to concatenate
*
* @example
* KiiClause clause = KiiClause.or(clause1, clause2, clause3, . . .)
*/
static or(...A: KiiClause[]): KiiClause;
/**
* Create an expression of the form (key == value)
*
* @param key The key to compare
* @param value the value to compare
*/
static equals(key: string, value: any): KiiClause;
/**
* Create an expression of the form (key != value)
*
* @param key The key to compare
* @param value the value to compare
*/
static notEquals(key: string, value: any): KiiClause;
/**
* Create an expression of the form (key > value)
*
* @param key The key to compare
* @param value the value to compare
*/
static greaterThan(key: string, value: any): KiiClause;
/**
* Create an expression of the form (key >= value)
*
* @param key The key to compare
* @param value the value to compare
*/
static greaterThanOrEqual(key: string, value: any): KiiClause;
/**
* Create an expression of the form (key < value)
*
* @param key The key to compare
* @param value the value to compare
*/
static lessThan(key: string, value: any): KiiClause;
/**
* Create an expression of the form (key <= value)
*
* @param key The key to compare
* @param value the value to compare
*/
static lessThanOrEqual(key: string, value: any): KiiClause;
/**
* Create an expression of the form (key in values)
*
* @param key The key to compare
* @param values to compare
*/
static inClause(key: string, values: any[]): KiiClause;
/**
* Create an expression of the form (key STARTS WITH value)
*
* @param key The key to compare
* @param value the value to compare
*/
static startsWith(key: string, value: any): KiiClause;
/**
* Create a clause of geo distance. This clause inquires objects in the specified circle.
*
* @param key Name of the key to inquire, which holds geo point.
* @param center Geo point which specify center of the circle.
* @param radius Radius of the circle. unit is meter. value should be in range of ]0, 20000000]
* @param putDistanceInto Used for retrieve distance from the center from the query result.Must match the pattern "^[a-zA-Z_][a-zA-Z0-9_]*$".
* If the specified value is null, query result will not contain the distance.
* <b>Note:</b> You can get the results in ascending order of distances from center. To do so, build the orderBy field by
* "_calculated.{specified value of putDistanceInto}" and pass it in {@link KiiQuery#sortByAsc}. Note that, descending order
* of distances is not supported. The unit of distance is meter.
*
* @return KiiClaluse reference.
*
* @throws <li> Specified key is not a string or an empty string.</li>
* <li>center is not an object of KiiGeoPoint.</li>
* <li>putDistanceInto is not a string or an empty string.</li>
*
* @example
* var putDistanceInto = "distanceFromCurrentLoc";
* var currentLoc = ..; // current location
* var clause = KiiClause.geoDistance("location", currentLoc, 4000, putDistanceInto);
* var query = KiiQuery.queryWithClause(clause);
* // Sort by distances by ascending order.(Optional, use only if you intend to retrieve the distances in a ascending order).
* var orderByKey = "_calculated." + putDistanceInto;
* query.sortByAsc(orderByKey);
* // Define the callbacks
* var bucket = Kii.bucketWithName("MyBucket");
* var queryCallback = {
* success: function(queryPerformed, resultSet, nextQuery) {
* // check the first object from resultSet.
* var object = resultSet[0];
* var point = object.get("location");
* var distanceToMyLocation = object.get("_calculated")[putDistanceInto];
* },
* failure: function(queryPerformed, anErrorString) {
* // do something with the error response
* }
* };
* bucket.executeQuery(query, queryCallback);
*/
static geoDistance(key: string, center: KiiGeoPoint, radius: number, putDistanceInto: string): KiiClause;
/**
* Create a clause of geo box. This clause inquires objects in the specified rectangle.
* Rectangle would be placed parallel to the equator with specified coordinates of the corner.
*
* @param key Key to inquire which holds geo point.
* @param northEast North-Eest corner of the rectangle.
* @param southWest South-Wast corner of the rectangle.
*
* @return KiiClause reference.
*
* @throws <li> Specified key is not a string or is an empty string.</li>
* <li>northEast or southWest is not a reference of KiiGeoPoint.</li>
*/
static geoBox(key: string, northEast: KiiGeoPoint, southWest: KiiGeoPoint): KiiClause;
}
/**
* Represents Geo Point.
*/
export class KiiGeoPoint {
/**
* Return the latitide of this point.
*/
getLatitude(): number;
/**
* Return the longitude of this point.
*/
getLongitude(): number;
/**
* Create a geo point with the given latitude and longitude.
*
* @param latitude Latitude of the point in degrees. Valid if the value is greater than -90 degrees and less than +90 degrees.
* @param longitude Longitude of the point in degrees. Valid if the value is greater than -180 degrees and less than +180 degrees.
*
* @return A new reference of KiiGeoPoint.
*
* @throws Specified latitude or longitude is invalid.
*
* @example
* var point = KiiGeoPoint.geoPoint(35.07, 139.02);
*/
static geoPoint(latitude: number, longitude: number): KiiGeoPoint;
}
/**
* Represents a KiiGroup object
*/
export class KiiGroup {
/**
*
*
* @deprecated Use {@link KiiGroup.getId} instead.
* Get the UUID of the given group, assigned by the server
*
* @return
*/
getUUID(): string;
/**
* Get the ID of the current KiiGroup instance.
*
* @return Id of the group or null if the group has not saved to cloud.
*/
getID(): string;
/**
* The name of this group
*
* @return
*/
getName(): string;
/**
* Returns the owner of this group if this group holds the information of owner.
*
* Group will holds the information of owner when "saving group on cloud" or "retrieving group info/owner from cloud".
* The cache will not be shared among the different instances of KiiGroup.
* <UL>
* <LI>This API will not access to server.
* To update the group owner information on cloud, please call {@link KiiGroup#refresh} or {@link KiiGroup#getOwner}.
* </LI>
* <LI>This API does not return all the properties of the owner.
* To get all owner properties, {@link KiiUser#refresh} is necessary.</LI>
* </UL>
*
* @return KiiUser who owns this group, undefined if this group doesn't hold the information of owner yet.
*
* @see KiiGroup#getOwner
*/
getCachedOwner(): KiiUser;
/**
* Get a specifically formatted string referencing the group
*
* <br><br>The group must exist in the cloud (have a valid UUID).
*
* @return A URI string based on the current group. null if a URI couldn't be generated.
*
* @example
* var group = . . .; // a KiiGroup
* var uri = group.objectURI();
*/
objectURI(): string;
/**
* Register new group own by current user on Kii Cloud with specified ID.
*
* <br><br>If the group that has specified id already exists, registration will be failed.
*
* @param groupID ID of the KiiGroup
* @param groupName Name of the KiiGroup
* @param members An array of KiiUser objects to add to the group
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* <li>error.addMembersArray is array of KiiUser to be added as memebers of this group.</li>
* <li>error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var members = [];
* members.push(KiiUser.userWithID("Member User Id"));
* KiiGroup.registerGroupWithID("Group ID", "Group Name", members, {
* success: function(theSavedGroup) {
* // do something with the saved group
* },
* failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var members = [];
* members.push(KiiUser.userWithID("Member User Id"));
* KiiGroup.registerGroupWithID("Group ID", "Group Name", members).then(
* function(theSavedGroup) {
* // do something with the saved group
* },
* function(error) {
* var theGroup = error.target;
* var anErrorString = error.message;
* var addMembersArray = error.addMembersArray;
* // do something with the error response
* });
*/
static registerGroupWithID(groupID: string, groupName: string, members: KiiUser[], callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise<KiiGroup>;
/**
* Creates a reference to a bucket for this group
*
* <br><br>The bucket will be created/accessed within this group's scope
*
* @param bucketName The name of the bucket the user should create/access
*
* @return A working KiiBucket object
*
* @example
* var group = . . .; // a KiiGroup
* var bucket = group.bucketWithName("myBucket");
*/
bucketWithName(bucketName: string): KiiBucket;
/**
* Creates a reference to a encrypted bucket for this group
*
* <br><br>The bucket will be created/accessed within this group's scope
*
* @param bucketName The name of the bucket the user should create/access
*
* @return A working KiiEncryptedBucket object
*
* @example
* var group = . . .; // a KiiGroup
* var bucket = group.encryptedBucketWithName("myBucket");
*/
encryptedBucketWithName(bucketName: string): KiiBucket;
/**
* Adds a user to the given group
*
* <br><br>This method will NOT access the server immediately. You must call save to add the user on the server. This allows multiple users to be added/removed before calling save.
*
* @param member The user to be added to the group
*
* @example
* var user = . . .; // a KiiUser
* var group = . . .; // a KiiGroup
* group.addUser(user);
* group.save(callbacks);
*/
addUser(member: KiiUser): void;
/**
* Removes a user from the given group
*
* <br><br>This method will NOT access the server immediately. You must call save to remove the user on the server. This allows multiple users to be added/removed before calling save.
*
* @param member The user to be added to the group
*
* @example
* var user = . . .; // a KiiUser
* var group = . . .; // a KiiGroup
* group.removeUser(user);
* group.save(callbacks);
*/
removeUser(member: KiiUser): void;
/**
* Gets a list of all current members of a group
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is a KiiGroup instance which this method was called on.</li>
* <li>params[1] is array of memeber KiiUser instances.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var group = . . .; // a KiiGroup
* group.getMemberList({
* success: function(theGroup, memberList) {
* // do something with the result
* for(var i=0; i<memberList.length; i++){
* var u = memberList[i]; // a KiiUser within the group
* }
* },
*
* failure: function(theGroup, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var group = . . .; // a KiiGroup
* group.getMemberList().then(
* function(params) {
* var theGroup = params[0];
* var memberlist = params[1];
* // do something with the result
* for(var i=0; i<memberList.length; i++){
* var u = memberList[i]; // a KiiUser within the group
* }
* },
* function(error) {
* // do something with the error response
* }
* );
*/
getMemberList(callbacks?: { success(theGroup: KiiGroup, memberList: KiiUser[]): any; failure(theGroup: KiiGroup, anErrorString: string): any; }): Promise<[KiiGroup, KiiUser[]]>;
/**
* Updates the group name on the server
*
* @param newName A String of the desired group name
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theRenamedGroup). theRenamedGroup is KiiGroup instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var group = . . .; // a KiiGroup
* group.changeGroupName("myNewName", {
* success: function(theRenamedGroup) {
* // do something with the group
* },
*
* failure: function(theGroup, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var group = . . .; // a KiiGroup
* group.changeGroupName("myNewName").then(
* function(theRenamedGroup) {
* // do something with the group
* },
* function(error) {
* // do something with the error response
* }
* );
*/
changeGroupName(newName: string, callbacks?: { success(theRenamedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string): any; }): Promise<KiiGroup>;
/**
* Saves the latest group values to the server
*
* <br><br>If the group does not yet exist, it will be created. If the group already exists, the members that have changed will be updated accordingly. If the group already exists and there is no updates of members, it will allways succeed but does not execute update. To change the name of group, use {@link #changeGroupName}.
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* <li>error.addMembersArray is array of KiiUser to be added as memebers of this group.</li>
* <li>error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var group = . . .; // a KiiGroup
* group.save({
* success: function(theSavedGroup) {
* // do something with the saved group
* },
*
* failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var group = . . .; // a KiiGroup
* group.save().then(
* function(theSavedGroup) {
* // do something with the saved group
* },
* function(error) {
* var theGroup = error.target;
* var anErrorString = error.message;
* var addMembersArray = error.addMembersArray;
* var removeMembersArray = error.removeMembersArray;
* // do something with the error response
* });
*/
save(callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise<KiiGroup>;
/**
* Saves the latest group values to the server with specified owner.
* This method can be used only by the group owner or app admin.
*
* <br><br>If the group does not yet exist, it will be created. If the group already exists, the members and owner that have changed will be updated accordingly. If the group already exists and there is no updates of members and owner, it will allways succeed but does not execute update. To change the name of group, use {@link #changeGroupName}.
*
* @param user id of owner
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* <li>error.addMembersArray is array of KiiUser to be added as memebers of this group.</li>
* <li>error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var group = . . .; // a KiiGroup
* group.saveWithOwner("UserID of owner", {
* success: function(theSavedGroup) {
* // do something with the saved group
* },
*
* failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var group = . . .; // a KiiGroup
* group.saveWithOwner("UserID of owner").then(
* function(theSavedGroup) {
* // do something with the saved group
* },
* function(error) {
* var theGroup = error.target;
* var anErrorString = error.message;
* var addMembersArray = error.addMembersArray;
* var removeMembersArray = error.removeMembersArray;
* // do something with the error response
* });
*/
saveWithOwner(user: string, callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise<KiiGroup>;
/**
* Updates the local group's data with the group data on the server
*
* <br><br>The group must exist on the server. Local data will be overwritten.
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theRefreshedGroup). theRefreshedGroup is KiiGroup instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var group = . . .; // a KiiGroup
* group.refresh({
* success: function(theRefreshedGroup) {
* // do something with the refreshed group
* },
*
* failure: function(theGroup, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var group = . . .; // a KiiGroup
* group.refresh().then(
* function(theRefreshedGroup) {
* // do something with the refreshed group
* },
* function(error) {
* // do something with the error response
* }
* );
*/
refresh(callbacks?: { success(theRefreshedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string): any; }): Promise<KiiGroup>;
/**
* Delete the group from the server
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theDeletedGroup). theDeletedGroup is KiiGroup instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var group = . . .; // a KiiGroup
* group.delete({
* success: function(theDeletedGroup) {
* // do something
* },
*
* failure: function(theGroup, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var group = . . .; // a KiiGroup
* group.delete({
* success: function(theDeletedGroup) {
* },
*
* failure: function(theGroup, anErrorString) {
* }
* }).then(
* function(theDeletedGroup) {
* // do something
* },
* function(error) {
* // do something with the error response
* }
* );
*/
delete(callbacks?: { success(theDeletedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string): any; }): Promise<KiiGroup>;
/**
* Gets the owner of the associated group
*
* This API does not return all the properties of the owner.
* To get all owner properties, {@link KiiUser#refresh} is necessary.
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is the KiiGroup instance which this method was called on.</li>
* <li>params[1] is an group owner KiiUser instances.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var group = . . .; // a KiiGroup
* group.getOwner({
* success: function(theGroup, theOwner) {
* // do something
* },
* failure: function(theGroup, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var group = . . .; // a KiiGroup
* group.getOwner().then(
* function(params) {
* // do something
* },
* function(error) {
* // do something with the error response
* }
* );
*/
getOwner(callbacks?: { success(theGroup: KiiGroup, theOwner: KiiUser): any; failure(theGroup: KiiGroup, anErrorString: string): any; }): Promise<[KiiGroup, KiiUser]>;
/**
* Creates a reference to a group with the given name
* <br><br>
* <b>Note:</b>
* Returned instance from this API can not operate existing KiiGroup.<br>
* If you want to operate existing KiiGroup, please use {@link KiiGroup.groupWithURI}.
*
* @param groupName An application-specific group name
*
* @return A new KiiGroup reference
*
* @example
* var group = new KiiGroup.groupWithName("myGroup");
*/
static groupWithName(groupName: string): KiiGroup;
/**
* Creates a reference to a group with the given name and a list of default members
* <br><br>
* <b>Note:</b>
* Returned instance from this API can not operate existing KiiGroup.<br>
* If you want to operate existing KiiGroup, please use {@link KiiGroup.groupWithURI}.
*
* @param groupName An application-specific group name
* @param members An array of KiiUser objects to add to the group
*
* @return A new KiiGroup reference
*
* @example
* var group = new KiiGroup.groupWithName("myGroup", members);
*/
static groupWithNameAndMembers(groupName: string, members: KiiUser[]): KiiGroup;
/**
* Instantiate KiiGroup that refers to existing group which has specified ID.
* You have to specify the ID of existing KiiGroup. Unlike KiiObject,
* you can not assign ID in the client side.<br>
* <b>NOTE</b>: This API does not access to the server.
* After instantiation, call {@link KiiGroup#refresh} to fetch the properties.
*
* @param groupId ID of the KiiGroup to instantiate.
*
* @return instance of KiiGroup.
*
* @throws when passed groupID is empty or null.
*
* @example
* var group = new KiiUser.groupWithID("__GROUP_ID__");
*/
static groupWithID(groupId: string): KiiGroup;
/**
* Generate a new KiiGroup based on a given URI
* <br><br>
* <b>Note:</b>
* Returned instance from this API can operate existing KiiGroup.<br>
* If you want to create a new KiiGroup, please use {@link KiiGroup.groupWithName}.
*
* @param uri The URI of the group to be represented
*
* @return A new KiiGroup with its parameters filled in from the URI
*
* @throws If the URI given is invalid
*
* @example
* var group = new KiiGroup.groupWithURI("kiicloud://myuri");
*/
static groupWithURI(uri: string): KiiGroup;
/**
* Instantiate topic belongs to this group.
*
* @param topicName name of the topic. Must be a not empty string.
*
* @return topic instance.
*/
topicWithName(topicName: string): KiiTopic;
/**
* Gets a list of topics in this group scope
*
* @param callbacks An object with callback methods defined
* @param paginationKey You can specify the pagination key with the nextPaginationKey passed by callbacks.success. If empty string or no string object is provided, this API regards no paginationKey specified.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is array of KiiTopic instances.</li>
* <li>params[1] is string of nextPaginationKey.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on. </li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var group = . . .; // a KiiGroup
* group.listTopics({
* success: function(topicList, nextPaginationKey) {
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* group.listTopics({
* success: function(topicList, nextPaginationKey) {...},
* failure: function(anErrorString) {...}
* }, nextPaginationKey);
* }
* },
* failure: function(anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use promise
* var group = . . .; // a KiiGroup
* group.listTopics().then(
* function(params) {
* var topicList = params[0];
* var nextPaginationKey = params[1];
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* group.listTopics(null, nextPaginationKey).then(
* function(params) {...},
* function(error) {...}
* );
* }
* },
* function(error) {
* // do something with the error response
* }
* );
*/
listTopics(callbacks?: { success(topicList: KiiTopic[], nextPaginationKey: string): any; failure(anErrorString: string): any; }, paginationKey?: string): Promise<[KiiTopic[], string]>;
}
/**
* Represents a KiiObject object
*/
export class KiiObject {
/**
* Get the UUID of the given object, assigned by the server
*
* @return
*/
getUUID(): string;
/**
* Get Id of the object or null if the object ID hasn't been assigned.
*
* @return
*/
getID(): string;
/**
* Get the server's creation date of this object
*
* @return
*/
getCreated(): number;
/**
* Get the modified date of the given object, assigned by the server
*
* @return
*/
getModified(): string;
/**
* Get the application-defined type name of the object
*
* @return type of this object. null or undefined if none exists
*/
getObjectType(): string;
/**
* Get the body content-type.
* It will be updated after the success of {@link KiiObject#uploadBody} and {@link KiiObject#downloadBody}
* returns null or undefined when this object doesn't have body content-type information.
*
* @return content-type of object body
*/
getBodyContentType(): string;
/**
* Sets a key/value pair to a KiiObject
*
* <br><br>If the key already exists, its value will be written over.
* <br><b>NOTE: Before involving floating point value, please consider using integer instead. For example, use percentage, permil, ppm, etc.</br></b>
* The reason is:
* <li>Will dramatically improve the performance of bucket query.</li>
* <li>Bucket query does not support the mixed result of integer and floating point.
* ex.) If you use same key for integer and floating point and inquire object with the integer value, objects which has floating point value with the key would not be evaluated in the query. (and vice versa)</li>
*
* @param key The key to set.
* if null, empty string or string prefixed with '_' is specified, silently ignored and have no effect.
* We don't check if actual type is String or not. If non-string type is specified, it will be encoded as key by JSON.stringify()
* @param value The value to be set. Object must be JSON-encodable type (dictionary, array, string, number, boolean)
* We don't check actual type of the value. It will be encoded as value by JSON.stringify()
*
* @example
* var obj = . . .; // a KiiObject
* obj.set("score", 4298);
*/
set(key: string, value: any): void;
/**
* Gets the value associated with the given key
*
* @param key The key to retrieve
*
* @return The object associated with the key. null or undefined if none exists
*
* @example
* var obj = . . .; // a KiiObject
* var score = obj.get("score");
*/
get<T>(key: string): T;
/**
* Set Geo point to this object with the specified key.
*
* @param key The key to set.
* @param KiiGeoPoint to be tied to the specified key.
*
* @throws Specified kiiGeoPint is not an instance of KiiGeoPoint.
*/
setGeoPoint(key: string, KiiGeoPoint: KiiGeoPoint): void;
/**
* Gets the geo point associated with the given key.
*
* @param key The key of the geo point to retrieve.
*
* @return KiiGeoPoint tied to the key. null if null exists.
*/
getGeoPoint(key: string): KiiGeoPoint;
/**
* Get the ACL handle for this file
*
* <br><br>Any KiiACLEntry objects added or revoked from this ACL object will be appended to/removed from the server on ACL save.
*
* @return A KiiACL object associated with this KiiObject
*
* @example
* var obj = . . .; // a KiiObject
* var acl = obj.objectACL();
*/
objectACL(): KiiACL;
/**
* Get a specifically formatted string referencing the object
*
* <br><br>The object must exist in the cloud (have a valid UUID).
*
* @return A URI string based on the current object. null if a URI couldn't be generated.
*
* @example
* var obj = . . .; // a KiiObject
* var uri = obj.objectURI();
*/
objectURI(): string;
/**
* Create or update the KiiObject on KiiCloud.
* <br><br>When call this method for the object that has not saved on cloud, will send all fields.
* Call this method for the object that has saved on cloud, Update all field of this object.
*
* @param callbacks An object with callback methods defined
* sucess: function called when save succeeded.<br>
* failure: function called when save failed.
* @param overwrite optional, true by default.
* <ul>
* <li><b>If overwrite is true:</b>
* <ul>
* <li>If a KiiObject with the same ID exists in cloud, the local copy will overwrite the remote copy, even if the remote copy is newer. </li>
* </ul>
* <li><b>Otherwise:</b>
* <ul>
* <li>If a KiiObject with the same ID exists in cloud and the remote copy is newer, save will fail.</li>
* </ul>
* </ul>
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedObject). theSavedObject is KiiObject instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiObject instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var obj = . . .; // a KiiObject
* obj.saveAllFields({
* success: function(theSavedObject) {
* // do something with the saved object
* },
*
* failure: function(theObject, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var obj = . . .; // a KiiObject
* obj.saveAllFields().then(
* function(theSavedObject) {
* // do something with the saved object
* },
* function(error) {
* // do something with the error response
* }
* );
*/
saveAllFields(callbacks?: { success(theSavedObject: KiiObject): any; failure(theObject: KiiObject, anErrorString: string): any; }, overwrite?: boolean): Promise<KiiObject>;
/**
* Create or update the KiiObject on KiiCloud.
* <br><br>When call this method for the object that has not saved on cloud, will send all fields.
* Call this method for the object that has saved on cloud, Update only updated fields.
* Do not send fields that has not updated locally. To send all fields regardless of updates, call {@link KiiObject#saveAllFields}.
*
* @param callbacks An object with callback methods defined
* sucess: function called when save succeeded.<br>
* failure: function called when save failed.
* @param overwrite optional, true by default.
* <ul>
* <li><b>If overwrite is true:</b>
* <ul>
* <li>If a KiiObject with the same ID exists in cloud, the local copy will overwrite the remote copy, even if the remote copy is newer. </li>
* </ul>
* <li><b>Otherwise:</b>
* <ul>
* <li>If a KiiObject with the same ID exists in cloud and the remote copy is newer, save will fail.</li>
* </ul>
* </ul>
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedObject). theSavedObject is KiiObject instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiObject instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var obj = . . .; // a KiiObject
* obj.save({
* success: function(theSavedObject) {
* // do something with the saved object
* },
*
* failure: function(theObject, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var obj = . . .; // a KiiObject
* obj.save().then(
* function(theSavedObject) {
* // do something with the saved object
* },
* function(error) {
* // do something with the error response
* }
* );
*/
save(callbacks?: { success(theSavedObject: KiiObject): any; failure(theObject: KiiObject, anErrorString: string): any; }, overwrite?: boolean): Promise<KiiObject>;
/**
* Updates the local object's data with the user data on the server
*
* <br><br>The object must exist on the server. Local data will be overwritten.
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theRefreshedObject). theRefreshedObject is KiiObject instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiObject instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var obj = . . .; // a KiiObject
* obj.refresh({
* success: function(theRefreshedObject) {
* // do something with the refreshed object
* },
*
* failure: function(theObject, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var obj = . . .; // a KiiObject
* obj.refresh().then(
* function(theRefreshedObject) {
* // do something with the refreshed object
* },
* function(error) {
* // do something with the error response
* }
* );
*/
refresh(callbacks?: { success(theRefreshedObject: KiiObject): any; failure(theObject: KiiObject, anErrorString: string): any; }): Promise<KiiObject>;
/**
* Delete the object from the server
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theDeletedObject). theDeletedObject is KiiObject instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiObject instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var obj = . . .; // a KiiObject
* obj.delete({
* success: function(theDeletedObject) {
* // do something
* },
*
* failure: function(theObject, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var obj = . . .; // a KiiObject
* obj.delete().then(
* function(theDeletedObject) {
* // do something
* },
* function(error) {
* // do something with the error response
* }
* );
*/
delete(callbacks?: { success(theDeletedObject: KiiObject): any; failure(theObject: KiiObject, anErrorString: string): any; }): Promise<KiiObject>;
/**
* Generate a new KiiObject based on a given URI
*
* @param uri The URI of the object to be represented
*
* @return A new KiiObject with its parameters filled in from the URI
*
* @throws If the URI is not in the proper format
*
* @example
* var group = new KiiObject.objectWithURI("kiicloud://myuri");
*/
static objectWithURI(uri: string): KiiObject;
/**
* Move KiiObject body from an object to another object.
* <br>
* This moving can be allowed under same application, across different scopes
* and source/target KiiObject have a read and write permission (READ_EXISTING_OBJECT and WRITE_EXISTING_OBJECT).
* <br><br>If target KiiObject has a body, it will be overwritten.
*
* @param targetObjectUri A KiiObject URI which KiiObject body is moved to.
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is the source KiiObject instance which this method was called on.</li>
* <li>params[1] is the target targetObjectUri String.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the source KiiObject instance which this method was called on.</li>
* <li>error.targetObjectUri is the targetObjectUri String.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var sourceObject = ...; // Source KiiObject
* var targetObject = ...; // Target KiiObject
* var targetObjectUri = targetObject.objectURI();
* sourceObject.moveBody(targetObjectUri, {
* success: function(theSrcObject, theTgtObjectUri) {
* // Do something with the objects
* },
*
* failure: function(theSrcObject, theTgtObjectUri, anErrorString) {
* // Do something with the error response
* }
* });
*
* // example to use Promise
* var sourceObject = ...; // Source KiiObject
* var targetObject = ...; // Target KiiObject
* var targetObjectUri = targetObject.objectURI();
* sourceObject.moveBody(targetObjectUri).then(
* function(params) {
* var theSrcObject = params[0];
* var theTgtObjectUri = params[1];
* // Do something with the objects
* },
* function(error) {
* // Do something with the error response
* }
* );
*/
moveBody(targetObjectUri: string, callbacks?: { success(theSrcObject: KiiObject, theTgtObjectUri: string): any; failure(theSrcObject: KiiObject, theTgtObjectUri: string, anErrorString: string): any; }): Promise<[KiiObject, string]>;
/**
* Upload body data of this object.<br>
* If the KiiObject has not saved on the cloud or deleted,
* request will be failed.
* <br>NOTE: this requires XMLHttpRequest Level 2, FileReader and Blob supports. Do not use it in server code.<br>
*
* @param srcDataBlob data to be uploaded.
* type is used to determin content-type managed in Kii Cloud.
* If type was not specified in the Blob,
* 'application/octet-stream' will be used.
* @param callbacks progress: function called on XMLHttpRequest 'progress' event listener.<br>
* sucess: function called when upload succeeded.<br>
* failure: function called when upload failed.
*
* @return return promise object.
* <br>NOTE: Promise will not handle progress event. Please pass callbacks with progress function to handle progress.
* <ul>
* <li>fulfill callback function: function(theObject). theObject is a KiiObject instance which this method was called on.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiObject instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var myObject = Kii.bucketWithName('myBucket').createObject();
* myObject.save({
* success: function(obj) {
* var srcData = new Blob(['Hello Blob'], {type: 'text/plain'});
* obj.uploadBody(srcData, {
* progress: function (oEvent) {
* if (oEvent.lengthComputable) {
* var percentComplete = oEvent.loaded / oEvent.total;
* //getting upload progress. You can update progress bar on this function.
* }
* },
* success: function(obj) {
* // Upload succeeded.
* },
* failure: function(obj, anErrorString) {
* // Handle error.
* }
* });
* },
* failure: function(obj, error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* var myObject = Kii.bucketWithName('myBucket').createObject();
* myObject.save().then(
* function(obj) {
* var srcData = new Blob(['Hello Blob'], {type: 'text/plain'});
* obj.uploadBody(srcData, {
* progress: function (oEvent) {
* if (oEvent.lengthComputable) {
* var percentComplete = oEvent.loaded / oEvent.total;
* //getting upload progress. You can update progress bar on this function.
* }
* }
* }).then(
* function(obj) { // fullfill callback function
* // Upload succeeded.
* },
* function(error) { // reject callback function
* // Handle error.
* }
* );
* },
* function(error) {
* // Handle error.
* }
* );
*/
uploadBody(srcDataBlob: Blob, callbacks?: { success(obj: KiiObject): any; failure(obj: KiiObject, anErrorString: string): any; }): Promise<KiiObject>;
/**
* Download body data of this object.<br>
* If the KiiObject has not saved on the cloud or deleted
* or exist but does not have body object, request will be failed.
* <br>NOTE: this requires XMLHttpRequest Level 2, FileReader and Blob supports. Do not use it in server code.<br>
*
* @param callbacks progress: function called on XMLHttpRequest 'progress' event listener.<br>
* sucess: function called when download succeeded.<br>
* failure: function called when download failed.
*
* @return return promise object.
* <br>NOTE: Promise will not handle progress event. Please pass callbacks with progress function to handle progress.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is a KiiObject instance which this method was called on.</li>
* <li>params[1] is the returned body blob object.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.</li>
* <ul>
* <li>error.target is the KiiObject instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var myObject = KiiObject.objectWithURI('put existing object uri here');
* myObject.downloadBody({
* progress: function (oEvent) {
* if (oEvent.lengthComputable) {
* var percentComplete = oEvent.loaded / oEvent.total;
* //getting download progress. You can update progress bar on this function.
*
* }
* },
* success: function(obj, bodyBlob) {
* // Obtaind body contents as bodyBlob.
* // content-type managed in Kii Cloud can be obtained from type attr.
* // It is same as obj.getBodyContentType();
* var contentType = bodyBlob.type;
* },
* failure: function(obj, anErrorString) {
* // Handle error.
* }
* });
*
* // example to use Promise
* var myObject = KiiObject.objectWithURI('put existing object uri here');
* myObject.downloadBody({
* progress: function (oEvent) {
* if (oEvent.lengthComputable) {
* var percentComplete = oEvent.loaded / oEvent.total;
* //getting download progress. You can update progress bar on this function.
*
* }
* }
* ).then(
* function(params) {
* // Obtaind body contents as bodyBlob.
* // content-type managed in Kii Cloud can be obtained from type attr.
* // It is same as obj.getBodyContentType();
* var obj = params[0];
* var bodyBlob = params[1];
* var contentType = bodyBlob.type;
* },
* function(error) {
* // Handle error.
* }
* );
*/
downloadBody(callbacks?: { success(obj: KiiObject, bodyBlob: Blob): any; failure(obj: KiiObject, anErrorString: string): any; }): Promise<[KiiObject, Blob]>;
/**
* Publish object body.<br>
* Publish object body and obtain public URL links to the body.<br>
* It doesn't expires.<br>
* If the KiiObject has not saved on the cloud or deleted
* or exist but does not have body object, request will be failed.
*
* @param callbacks sucess: function called when publish succeeded.<br>
* failure: function called when publish failed.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is the KiiObject instance which this method was called on.</li>
* <li>params[1] is the published url string.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiObject instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var myObject = KiiObject.objectWithURI('put existing object uri here');
* myObject.publishBody({
* success: function(obj, publishedUrl) {
* // ex.) You can show publishedUrl in the view.
* },
* failure: function(obj, anErrorString) {
* // Handle error.
* }
* });
*
* // example to use Promise
* var myObject = KiiObject.objectWithURI('put existing object uri here');
* myObject.publishBody().then(
* function(params) {
* // ex.) You can show publishedUrl in the view.
* var obj = params[0];
* var publishedUrl = params[1];
* },
* function(error) {
* // Handle error.
* }
* );
*/
publishBody(callbacks?: { success(obj: KiiObject, publishedUrl: string): any; failure(obj: KiiObject, anErrorString: string): any; }): Promise<[KiiObject, string]>;
/**
* Publish object body with expiration date.<br>
* Publish object body and obtain public URL links to the body.<br>
* Expires at specified date <br>
* If the KiiObject has not saved on the cloud or deleted
* or exist but does not have body object, request will be failed.
*
* @param expiresAt expiration date. should specify future date.
* @param callbacks sucess: function called when publish succeeded.<br>
* failure: function called when publish failed.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is the KiiObject instance which this method was called on.</li>
* <li>params[1] is the published url string.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiObject instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var myObject = KiiObject.objectWithURI('put existing object uri here');
* var expiresAt = new Date(2014, 11, 24);
* myObject.publishBodyExpiresAt(expiresAt, {
* success: function(obj, publishedUrl) {
* // ex.) You can show publishedUrl in the view.
* },
* failure: function(obj, anErrorString) {
* // Handle error.
* }
* });
*
* // example to use Promise
* var myObject = KiiObject.objectWithURI('put existing object uri here');
* var expiresAt = new Date(2014, 11, 24);
* myObject.publishBodyExpiresAt(expiresAt).then(
* function(params) {
* // ex.) You can show publishedUrl in the view.
* var obj = params[0];
* var publishedUrl = params[1];
* },
* function(error) {
* // Handle error.
* }
* );
*/
publishBodyExpiresAt(expiresAt: Date, callbacks?: { success(obj: KiiObject, publishedUrl: string): any; failure(obj: KiiObject, anErrorString: string): any; }): Promise<[KiiObject, string]>;
/**
* Publish object body with expiration duration.<br>
* Publish object body and obtain public URL links to the body.<br>
* Expires in specified duration<br>
* If the KiiObject has not saved on the cloud or deleted
* or exist but does not have body object, request will be failed.
*
* @param expiresIn duration in seconds. greater than 0.
* @param callbacks sucess: function called when publish succeeded.<br>
* failure: function called when publish failed.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is the KiiObject instance which this method was called on.</li>
* <li>params[1] is the published url string.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiObject instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var myObject = KiiObject.objectWithURI('put existing object uri here');
* var expiresIn = 60 * 60; // Expires in 1 hour.
* myObject.publishBodyExpiresIn(expiresIn, {
* success: function(obj, publishedUrl) {
* // ex.) You can show publishedUrl in the view.
* },
* failure: function(obj, anErrorString) {
* // Handle error.
* }
* });
*
* // example to use Promise
* var myObject = KiiObject.objectWithURI('put existing object uri here');
* var expiresIn = 60 * 60; // Expires in 1 hour.
* myObject.publishBodyExpiresIn(expiresIn).then(
* function(params) {
* // ex.) You can show publishedUrl in the view.
* var obj = params[0];
* var publishedUrl = params[1];
* },
* function(error) {
* // Handle error.
* }
* );
*/
publishBodyExpiresIn(expiresIn: number, callbacks?: { success(obj: KiiObject, publishedUrl: string): any; failure(obj: KiiObject, anErrorString: string): any; }): Promise<[KiiObject, string]>;
/**
* Delete the object body from the server.<br>
* If the KiiObject has not saved on the cloud or deleted
* or exist but does not have body object, request will be failed.<br>
* If succeeded, The object body content type will be nullified.
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theDeletedObject). theDeletedObject is the KiiObject instance which this method was called on.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiObject instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var obj = . . .; // a KiiObject
* obj.deleteBody({
* success: function(theDeletedObject) {
* // do something
* },
*
* failure: function(obj, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var obj = . . .; // a KiiObject
* obj.deleteBody().then(
* function(theDeletedObject) {
* // do something
* },
* function(error) {
* // do something with the error response
* }
* );
*/
deleteBody(callbacks?: { success(theDeletedObject: KiiObject): any; failure(obj: KiiObject, anErrorString: string): any; }): Promise<KiiObject>;
/**
* Check if given ID is valid for object ID.
* Valid pattern: ^[a-zA-Z0-9-_\\.]{2,100}$
*
* @param objectID to be checked.
*
* @return true if given ID is valid, false otherwise.
*/
static isValidObjectID(objectID: string): boolean;
}
/**
* Represents a KiiPushInstallation object
*/
export class KiiPushInstallation {
/**
* Register the id issued by GCM to the Kii cloud for current logged in user.
*
* @param installationRegistrationID The ID of registration that identifies the installation externally.
* @param development Indicates if the installation is for development or production environment.
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(response).
* <ul>
* <li>response.installationID is ID of the installation in the platform.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
*
*/
installGcm(installationRegistrationID: string, development: boolean, callbacks?: { success(response: KiiGcmInstallationResponse): any; failure(error: Error): any; }): Promise<KiiGcmInstallationResponse>;
/**
* Register a MQTT installation to the Kii cloud for current logged in user.
*
* @param development Indicates if the installation is for development or production environment.
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(response).
* <ul>
* <li>response.installationID is ID of the installation in the platform.</li>
* <li>response.installationRegistrationID is ID of registration that identifies the installation externally.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
*
*/
installMqtt(development: boolean, callbacks?: { success(response: KiiMqttInstallationResponse): any; failure(error: Error): any; }): Promise<KiiMqttInstallationResponse>;
/**
* Get MQTT endpoint.
* If the MQTT endpoint is not ready, this method retries request up to three times.
* <br><br>
* Note that only MQTT over tls is supported currently.<br>
* Don't use portSSL, portWS or portWSS until we support it.
*
* @param installationID The ID of the installation in the platform.
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(response).
* <ul>
* <li>response.installationID is ID of the installation in the platform.</li>
* <li>response.username is username to use for connecting to the MQTT broker.</li>
* <li>response.password is assword to use for connecting to the MQTT broker.</li>
* <li>response.mqttTopic is topic to subscribe in the MQTT broker.</li>
* <li>response.host is hostname of the MQTT broker.</li>
* <li>response.X-MQTT-TTL is the amount of time in seconds that specifies how long the mqttTopic will be valid, after that the client needs to request new MQTT endpoint info.</li>
* <li>response.portTCP is port to connect using plain TCP.</li>
* <li>response.portSSL is port to connect using SSL/TLS.</li>
* <li>response.portWS is port to connect using plain Websocket.</li>
* <li>response.portWSS is port to connect using SSL/TLS Websocket.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
*
*/
getMqttEndpoint(installationID: string, callbacks?: { success(response: KiiMqttEndpoint): any; failure(error: Error): any; }): Promise<KiiMqttEndpoint>;
/**
* Unregister the push settings by the id(issued by push provider) that is used for installation.
*
* @param installationRegistrationID The ID of registration that identifies the installation externally.
* @param deviceType The type of the installation, current implementation only supports "ANDROID" and "MQTT".
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function().</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
*
*/
uninstall(installationRegistrationID: string, deviceType: string, callbacks?: { success(): any; failure(error: Error): any; }): Promise<void>;
/**
* Unregister the push settings by the id(issued by KiiCloud) that is used for installation.
*
* @param installationID The ID of the installation issued by KiiCloud.
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function().</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
*
*/
uninstallByInstallationID(installationID: string, callbacks?: { success(): any; failure(error: Error): any; }): Promise<void>;
}
/**
* Builder of push message
*/
export class KiiPushMessageBuilder {
/**
* instantiate builder with push message data.
* By default all push channels (gcm, apns, jpush, mqtt) is enabled.
* All other properties configured by method of this class won't be set and default
* value would be applied.<br>
* Details of properties of message and its default value, please refer to
* http://documentation.kii.com/rest/#notification_management-leverage__push_to_users__notification-group_scope-send_messages-send_a_push_message_to_the_current_topic
*
* @param data sent to all push channels (gcm, apns, jpush, mqtt).
*/
constructor(data: any);
/**
* build push message.
*
* @return push message object. Can be used in {@link KiiTopic#sendMessage()}
*/
build(): any;
/**
* Indicate whether send this message to development environment.
* If this method is not called, true will be applied as default.
*
* @param flag indicate whether send this message to development env.
*
* @return builder instance.
*/
setSendToDevelopment(flag: boolean): KiiPushMessageBuilder;
/**
* Indicate whether send this message to production environment.
* If this method is not called, true will be applied as default.
*
* @param flag indicate whether send this message to production env.
*
* @return builder instance.
*/
setSendToProduction(flag: boolean): KiiPushMessageBuilder;
/**
* Enable/ Disable message distribution via GCM.
* If this method is not called, true will be applied as default.
*
* @param enable flag indicate whether distribute this message to GCM subscribers.
*
* @return builder instance.
*/
enableGcm(enable: boolean): KiiPushMessageBuilder;
/**
* Enable/ Disable message distribution via APNS.
* If this method is not called, true will be applied as default.
*
* @param enable flag indicate whether distribute this message to APNS subscribers.
*
* @return builder instance.
*/
enableApns(enable: boolean): KiiPushMessageBuilder;
/**
* Enable/ Disable message distribution via JPush.
* If this method is not called, true will be applied as default.
*
* @param enable flag indicate whether distribute this message to JPush subscribers.
*
* @return builder instance.
*/
enableJpush(enable: boolean): KiiPushMessageBuilder;
/**
* Enable/ Disable message distribution via MQTT.
* If this method is not called, true will be applied as default.
*
* @param enable flag indicate whether distribute this message to MQTT subscribers.
*
* @return builder instance.
*/
enableMqtt(enable: boolean): KiiPushMessageBuilder;
/**
* Set specific data for GCM subscribers.
* If this method is not called, no specific data is not applied
* and data passed to the constructor would be sent to subscribers.
*
* @param data specific data applied to only GCM subscribers.
* Contents should be JSON Object with only one-level of nesting,
* and only strings in values
*
* @return builder instance.
*/
gcmData(data: { [key: string]: string }): KiiPushMessageBuilder;
/**
* Set collapse_key for GCM subscribers.
* If this method is not called, no collapse_key is applied.
* For details please refer to GCM document of collapse_key.
*
* @param collapseKey
*
* @return builder instance.
*/
gcmCollapseKey(collapseKey: string): KiiPushMessageBuilder;
/**
* Set delay_while_idle for GCM subscribers.
* If this method is not called, no delay_while_idle is applied.
* For details please refer to GCM document of delay_while_idle.
*
* @param delayWhileIdle
*
* @return builder instance.
*/
gcmDelayWhileIdle(delayWhileIdle: boolean): KiiPushMessageBuilder;
/**
* Set time_to_live for GCM subscribers.
* If this method is not called, no time_to_live is applied.
* For details please refer to GCM document of time_to_live.
*
* @param timeToLive
*
* @return builder instance.
*/
gcmTimeToLive(timeToLive: number): KiiPushMessageBuilder;
/**
* Set restricted_package_name for GCM subscribers.
* If this method is not called, no restricted_package_name is applied.
* For details please refer to GCM document of restricted_package_name.
*
* @param restrictedPackageName
*
* @return builder instance.
*/
gcmRestrictedPackageName(restrictedPackageName: string): KiiPushMessageBuilder;
/**
* Set specific data for APNS subscribers.
* If this method is not called, no specific data is not applied
* and data passed to the constructor would be sent to subscribers.
*
* @param data specific data applied to only APNS subscribers.
* Contents should be JSON Object with only one-level of nesting,
* and only strings, integers, booleans or doubles in the values.
*
* @return builder instance.
*/
apnsData(data: { [key: string]: string | number | boolean }): KiiPushMessageBuilder;
/**
* Set alert for APNS subscribers.
* If this method is not called, no alert is applied.
* For details please refer to APNS document of alert.
*
* @param alert alert object
*
* @return builder instance.
*/
apnsAlert(alert: string | APNSAlert): KiiPushMessageBuilder;
/**
* Set sound for APNS subscribers.
* If this method is not called, no sound is applied.
* For details please refer to APNS document of sound.
*
* @param sound
*
* @return builder instance.
*/
apnsSound(sound: string): KiiPushMessageBuilder;
/**
* Set badge for APNS subscribers.
* If this method is not called, no badge is applied.
* For details please refer to APNS document of badge.
*
* @param badge
*
* @return builder instance.
*/
apnsBadge(badge: number): KiiPushMessageBuilder;
/**
* Set content-available for APNS subscribers.
* If this method is not called, no content-available is applied.
*
* @param contentAvailable If 0 or this method is not invoked,
* content-available payload is not delivered.
* Otherwise, content-available=1 payload is delivered.
*
* @return builder instance.
*/
apnsContentAvailable(contentAvailable: number): KiiPushMessageBuilder;
/**
* Set category for APNS subscribers.
* If this method is not called, no category is applied.
* For details please refer to APNS document of category.
*
* @param category
*
* @return builder instance.
*/
apnsCategory(category: string): KiiPushMessageBuilder;
/**
* Set specific data for JPush subscribers.
* If this method is not called, no specific data is not applied
* and data passed to the constructor would be sent to subscribers.
*
* @param data specific data applied to only JPush subscribers.
* Contents should be JSON Object with only one-level of nesting,
* and only strings, integers, booleans or doubles in the values.
*
* @return builder instance.
*/
jpushData(data: { [name: string]: string | number | boolean }): KiiPushMessageBuilder;
/**
* Set specific data for MQTT subscribers.
* If this method is not called, no specific data is not applied
* and data passed to the constructor would be sent to subscribers.
*
* @param data specific data applied to only MQTT subscribers.
* Contents should be JSON Object with only one-level of nesting,
* and only strings in the values.
*
* @return builder instance.
*/
mqttData(data: { [key: string]: string }): KiiPushMessageBuilder;
}
/**
* Represents a KiiPushSubscription.
*/
export class KiiPushSubscription {
/**
* Subscribe to bucket or topic.
*
* @param target to be subscribed. KiiBucket or KiiTopic instance.
* @param callbacks object contains callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is an Array instance.
* <ul>
* <li>params[0] is a KiiPushSubscription instance.</li>
* <li>params[1] is the KiiTopic instance to subscribe.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiPushSubscription instance.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var topic = Kii.topicWithName("myAppTopic");
* var user = KiiUser.getCurrentUser();
* user.pushSubscription().subscribe(topic, {
* success: function(subscription, topic) {
* // Succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* var topic = Kii.topicWithName("myAppTopic");
* var user = KiiUser.getCurrentUser();
* user.pushSubscription().subscribe(topic).then(
* function(params) {
* var subscription = params[0];
* var topic = params[1];
* // Succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
subscribe<T extends KiiBucket | KiiTopic>(target: T, callbacks?: { success(subscription: KiiPushSubscription, topic: T): any; failure(error: Error): any; }): Promise<[KiiPushSubscription, T]>;
/**
* Unsubscribe to bucket or topic.
*
* @param target to be unsubscribed. KiiBucket or KiiTopic instance.
* @param callbacks object contains callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is an Array instance.
* <ul>
* <li>params[0] is a KiiPushSubscription instance.</li>
* <li>params[1] is the KiiTopic instance to unsubscribe.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiPushSubscription instance.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var topic = Kii.topicWithName("myAppTopic");
* var user = KiiUser.getCurrentUser();
* user.pushSubscription().unsubscribe(topic, {
* success: function(subscription, topic) {
* // Succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* var topic = Kii.topicWithName("myAppTopic");
* var user = KiiUser.getCurrentUser();
* user.pushSubscription().unsubscribe(topic).then(
* function(params) {
* var subscription = params[0];
* var topic = params[1];
* // Succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
unsubscribe<T extends KiiBucket | KiiTopic>(target: T, callbacks?: { success(subscription: KiiPushSubscription, topic: T): any; failure(error: Error): any; }): Promise<[KiiPushSubscription, T]>;
/**
* Check subscription of bucket, topic.
*
* @param target to check subscription. KiiBucket or KiiTopic instance.
* @param callbacks object contains callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is an Array instance.
* <ul>
* <li>params[0] is a KiiPushSubscription instance.</li>
* <li>params[1] is the KiiTopic instance to subscribe.</li>
* <li>params[2] is Boolean value. true if subscirbed, otherwise false.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiPushSubscription instance.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var topic = Kii.topicWithName("myAppTopic");
* var user = KiiUser.getCurrentUser();
* user.pushSubscription().isSubscribed(topic, {
* success: function(subscription, topic, isSubscribed) {
* // Succeeded.
* if (isSubscribed) {
* // The topic is subscribed by current user.
* } else {
* // The topic is not subscribed by current user.
* }
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* var topic = Kii.topicWithName("myAppTopic");
* var user = KiiUser.getCurrentUser();
* user.pushSubscription().isSubscribed(topic).then(
* function(params) {
* // Succeeded.
* var subscription = params[0];
* var topic = params[1];
* var isSubscribed = params[2];
* if (isSubscribed) {
* // The topic is subscribed by current user.
* } else {
* // The topic is not subscribed by current user.
* }
* },
* function(error) {
* // Handle error.
* }
* );
*/
isSubscribed<T extends KiiBucket | KiiTopic>(target: T, callbacks?: { success(subscription: KiiPushSubscription, topic: T, isSubscribed: boolean): any; failure(error: Error): any; }): Promise<[KiiPushSubscription, T, boolean]>;
}
/**
* Represents a KiiQuery object
*/
export class KiiQuery {
/**
* Get the limit of the current query
*
* @return
*/
getLimit(): number;
/**
* Set the limit of the given query
*
* @param value The desired limit. Must be an integer > 0
*
* @throws InvalidLimitException
*/
setLimit(value: number): void;
/**
* Create a KiiQuery object based on a KiiClause
* <br><br>
* By passing null as the ‘clause’ parameter, all objects can be retrieved.
*
* @param clause The KiiClause to be executed with the query
*/
static queryWithClause(clause: KiiClause): KiiQuery;
/**
* Set the query to sort by a field in descending order
*
* If a sort has already been set, it will be overwritten.
*
* @param field The key that should be used to sort
*/
sortByDesc(field: string): void;
/**
* Set the query to sort by a field in ascending order
*
* If a sort has already been set, it will be overwritten.
*
* @param field The key that should be used to sort
*/
sortByAsc(field: string): void;
}
/**
* Represents a server side code entry in KiiCloud.
*/
export class KiiServerCodeEntry {
/**
* Execute this server code entry.<br>
* If argument is an empty object or not type of Object, callbacks.failure or reject callback of promise will be called.<br>
*
* @param argument pass to the entry of script in the cloud.
* If null is specified, no argument pass to the script.
* @param callbacks called on completion of execution.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is the KiiServerCodeEntry instance which this method was called on.</li>
* <li>params[1] is the passed argument object.</li>
* <li>params[2] is a KiiServerCodeExecResult instance.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiServerCodeEntry instance which this method was called on.</li>
* <li>error.message</li>
* <li>error.argument is passed argument object. </li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // Instantiate with the endpoint.
* var entry = Kii.serverCodeEntry("main");
*
* // Set the custom parameters.
* var arg = {"username":"name_of_my_friend", "password":"password_for_my_friend"};
*
* // Example of executing the Server Code
* entry.execute(arg, {
*
* success: function(entry, argument, execResult) {
* // do something now that the user is logged in
* },
*
* failure: function(entry, argument, execResult, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* // Instantiate with the endpoint.
* var entry = Kii.serverCodeEntry("main");
*
* // Set the custom parameters.
* var arg = {"username":"name_of_my_friend", "password":"password_for_my_friend"};
*
* // Example of executing the Server Code
* entry.execute(arg).then(
* function(params) {
* var entry = params[0];
* var argument = params[1];
* var execResult = params[2];
* // do something
* },
* function(error) {
* // do something with the error response
* }
* );
*/
execute<T>(argument: T, callbacks?: { success(entry: KiiServerCodeEntry, argument: T, execResult: KiiServerCodeExecResult): any; failure(entry: KiiServerCodeEntry, argument: T, execResult: KiiServerCodeExecResult, anErrorString: string): any; }): Promise<[KiiServerCodeEntry, T, KiiServerCodeExecResult]>;
/**
* Get the entryName of this server code entry.
*
* @return entryName.
*/
getEntryName(): string;
}
/**
* Represents a server side code execution result in KiiCloud.
*/
export class KiiServerCodeExecResult {
/**
* Get calculated number of executed steps.
*
* @return calculated number of executed steps
*/
getExecutedSteps(): number;
/**
* Get Object returned by server code entry.
*
* @return returned by server code entry.
*/
getReturnedValue(): any;
}
/**
* Represents a KiiSocialConnect object
*/
export class KiiSocialConnect {
/**
*
*
* @deprecated You don't have to call this method.
* Set up a reference to one of the supported KiiSocialNetworks.
*
* Set up the network. Need to be called before accessing other methods.
* <br><b> Facebook </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Argument</th>
* <th>Value Type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>networkName</td>
* <td>Number</td>
* <td>KiiSocialNetworkName.FACEBOOK</td>
* <td>Specify Facebook</td>
* </tr>
* <tr>
* <td>apiKey</td>
* <td>String</td>
* <td>null</td>
* <td>Facebook does not requires this argument.</td>
* </tr>
* <tr>
* <td>apiSecret</td>
* <td>String</td>
* <td>null</td>
* <td>Facebook does not requires this argument.</td>
* </tr>
* <tr>
* <td>extras</td>
* <td>Object</td>
* <td>null</td>
* <td>Facebook does not requires this argument.</td>
* </tr>
* </tbody>
* </table>
*
* <br><b> Twitter </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Argument</th>
* <th>Value Type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>networkName</td>
* <td>Number</td>
* <td>KiiSocialNetworkName.TWITTER</td>
* <td>Specify Twitter</td>
* </tr>
* <tr>
* <td>apiKey</td>
* <td>String</td>
* <td>null</td>
* <td>Twitter does not requires this argument.</td>
* </tr>
* <tr>
* <td>apiSecret</td>
* <td>String</td>
* <td>null</td>
* <td>Twitter does not requires this argument.</td>
* </tr>
* <tr>
* <td>extras</td>
* <td>Object</td>
* <td>null</td>
* <td>Twitter does not requires this argument.</td>
* </tr>
* </tbody>
* </table>
* <br><b> QQ </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Argument</th>
* <th>Value Type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>networkName</td>
* <td>Number</td>
* <td>KiiSocialNetworkName.QQ</td>
* <td>Specify QQ</td>
* </tr>
* <tr>
* <td>apiKey</td>
* <td>String</td>
* <td>null</td>
* <td>QQ does not requires this argument.</td>
* </tr>
* <tr>
* <td>apiSecret</td>
* <td>String</td>
* <td>null</td>
* <td>QQ does not requires this argument.</td>
* </tr>
* <tr>
* <td>extras</td>
* <td>Object</td>
* <td>null</td>
* <td>QQ does not requires this argument.</td>
* </tr>
* </tbody>
* </table>
*
* @param networkName One of the supported KiiSocialNetworkName values
* @param apiKey The SDK key assigned by the social network provider. For details refer to the table above.
* @param apiSecret The SDK secret assigned by the social network provider. For details refer to the table above.
* @param extras Extra options that should be passed to the SNS. For details refer to the table above.
*
* @throws For details refer to the table above
*/
static setupNetwork(networkName: KiiSocialNetworkName, apiKey: string, apiSecret: string, extras: any): void;
/**
* Log a user into the social network provided
*
* This will initiate the login process for the given network. If user has already linked with the specified social network,
* sign-in with the social network. Otherwise, this will sign-up and create new user authenticated by the specified social network.
* If sign-up successful, the user is cached inside SDK as current user,and accessible via {@link KiiUser.getCurrentUser()}.
* User token and token expiration is also cached and can be get by {@link KiiUser#getAccessTokenObject()}.
* Access token won't be expired unless you set it explicitly by {@link Kii.setAccessTokenExpiration()}.
* The network must already be set up via setupNetwork<br>
* If the opitons is invalid, callbacks.failure or reject callback of promise will be called. <br>
*
* @param networkName One of the supported KiiSocialNetworkName values
* @param options A dictionary of key/values to pass to KiiSocialConnect
*
* <br><b> Facebook </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Key</th>
* <th>Value type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>access_token</td>
* <td>String</td>
* <td>Access token of Facebook.</td>
* <td>This is mandatory.</td>
* </tr>
* </tbody>
* </table>
*
* <br><b> Twitter </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Key</th>
* <th>Value type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>oauth_token</td>
* <td>String</td>
* <td>OAuth access token of twitter.</td>
* <td>This is mandatory. </td>
* </tr>
* <tr>
* <td>oauth_token_secret</td>
* <td>String</td>
* <td>OAuth access token secret of twitter.</td>
* <td>This is mandatory.</td>
* </tr>
* </tbody>
* </table>
*
* <br><b> Google </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Key</th>
* <th>Value type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>access_token</td>
* <td>String</td>
* <td>Access token of Google.</td>
* <td>This is mandatory.</td>
* </tr>
* </tbody>
* </table>
*
* <br><b> Renren </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Key</th>
* <th>Value type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>access_token</td>
* <td>String</td>
* <td>Access token of Renren.</td>
* <td>This is mandatory.</td>
* </tr>
* </tbody>
* </table>
*
* <br><b> QQ </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Key</th>
* <th>Value type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>access_token</td>
* <td>String</td>
* <td>Access token of QQ.</td>
* <td>This is mandatory. </td>
* </tr>
* <tr>
* <td>openID</td>
* <td>String</td>
* <td>OpenID of QQ.</td>
* <td>This is mandatory.</td>
* </tr>
* </tbody>
* </table>
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is a logged in KiiUser instance.</li>
* <li>params[1] is the KiiSocialNetworkName used to login.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* <li>error.network is the KiiSocialNetworkName used to login.</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // Example of using no option
* KiiSocialConnect.logIn(KiiSocialNetworkName.FACEBOOK, null, {
*
* success: function(user, network) {
* // do something now that the user is logged in
* },
*
* failure: function(user, network, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* KiiSocialConnect.logIn(KiiSocialNetworkName.FACEBOOK, null).then(
* function(params) {
* // do something now that the user is logged in
* },
* function(error) {
* // do something with the error response
* }
* );
*/
static logIn(networkName: KiiSocialNetworkName, options: KiiSocialConnectOptions, callbacks?: { success(user: KiiUser, network: KiiSocialNetworkName): any; failure(user: KiiUser, network: KiiSocialNetworkName, anErrorString: string): any; }): Promise<[KiiUser, KiiSocialNetworkName]>;
/**
* Link the currently logged in user with a social network
*
* This will initiate the login process for the given network, which for SSO-enabled services like Facebook, will send the user to the Facebook site for authentication. There must be a currently authenticated KiiUser. Otherwise, you can use the logIn: method to create and log in a KiiUser using a network. The network must already be set up via setupNetwork<br>
* If there is not logged-in user to link with, callbacks.failure or reject callback of promise will be called. <br>
* If the opitons is invalid, callbacks.failure or reject callback of promise will be called. <br>
*
* @param networkName One of the supported KiiSocialNetworkName values
* @param options A dictionary of key/values to pass to KiiSocialConnect
* <br><b> Facebook </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Key</th>
* <th>Value type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>access_token</td>
* <td>String</td>
* <td>Access token of Facebook.</td>
* <td>This is mandatory.</td>
* </tr>
* </tbody>
* </table>
*
* <br><b> Twitter </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Key</th>
* <th>Value type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>oauth_token</td>
* <td>String</td>
* <td>OAuth access token of twitter.</td>
* <td>This is mandatory.</td>
* </tr>
* <tr>
* <td>oauth_token_secret</td>
* <td>String</td>
* <td>OAuth access token secret of twitter.</td>
* <td>This is mandatory.</td>
* </tr>
* </tbody>
* </table>
*
* <br><b> Google </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Key</th>
* <th>Value type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>access_token</td>
* <td>String</td>
* <td>Access token of Google.</td>
* <td>This is mandatory.</td>
* </tr>
* </tbody>
* </table>
*
* <br><b> Renren </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Key</th>
* <th>Value type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>access_token</td>
* <td>String</td>
* <td>Access token of Renren.</td>
* <td>This is mandatory.</td>
* </tr>
* </tbody>
* </table>
*
* <br><b> QQ </b>
* <table border="1" cellspacing="0">
* <thead>
* <tr bgcolor="#CCCCFF">
* <th>Key</th>
* <th>Value type</th>
* <th>Value</th>
* <th>Note</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>access_token</td>
* <td>String</td>
* <td>Access token of QQ.</td>
* <td>This is mandatory. </td>
* </tr>
* <tr>
* <td>openID</td>
* <td>String</td>
* <td>OpenID of QQ.</td>
* <td>This is mandatory.</td>
* </tr>
* </tbody>
* </table>
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is a linked KiiUser instance.</li>
* <li>params[1] is the KiiSocialNetworkName used to link.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is current logged-in KiiUser instance. If there is not logged-in user, it will be null.</li>
* <li>error.message</li>
* <li>error.network is the KiiSocialNetworkName used to link.</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // Example of using no option
* KiiSocialConnect.linkCurrentUserWithNetwork(KiiSocialNetworkName.FACEBOOK, null, {
*
* success: function(user, network) {
* // do something now that the user is linked
* },
*
* failure: function(user, network, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* // Example of using no option
* KiiSocialConnect.linkCurrentUserWithNetwork(KiiSocialNetworkName.FACEBOOK, null).then(
* function(params) {
* // do something now that the user is linked
* },
* function(error) {
* // do something with the error response
* }
* );
*/
static linkCurrentUserWithNetwork(networkName: KiiSocialNetworkName, options: KiiSocialConnectOptions, callbacks?: { success(user: KiiUser, network: KiiSocialNetworkName): any; failure(user: KiiUser, network: KiiSocialNetworkName, anErrorString: string): any; }): Promise<[KiiUser, KiiSocialNetworkName]>;
/**
* Unlink the currently logged in user with a social network
*
* The network must already be set up via setupNetwork
*
* @param networkName One of the supported KiiSocialNetworkName values
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is a unlinked KiiUser instance.</li>
* <li>params[1] is the KiiSocialNetworkName used to unlink.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is current logged-in KiiUser instance. If there is not logged-in user, it will be null.</li>
* <li>error.message</li>
* <li>error.network is the KiiSocialNetworkName used to unlink.</li>
* </ul>
* </li>
* </ul>
*
* @example
*
* // example to use callbacks directly
* KiiSocialConnect.unLinkCurrentUserFromNetwork(KiiSocialNetworkName.FACEBOOK, {
*
* success: function(user, network) {
* // do something now that the user is unlinked
* },
*
* failure: function(user, network, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* KiiSocialConnect.unLinkCurrentUserFromNetwork(KiiSocialNetworkName.FACEBOOK).then(
* function(params) {
* // do something now that the user is unlinked
* },
* function(error) {
* // do something with the error response
* }
* );
*/
static unLinkCurrentUserFromNetwork(networkName: KiiSocialNetworkName, callbacks?: { success(user: KiiUser, network: KiiSocialNetworkName): any; failure(user: KiiUser, network: KiiSocialNetworkName, anErrorString: string): any; }): Promise<[KiiUser, KiiSocialNetworkName]>;
/**
* Retrieve the current user's access token from a social network
* The network must be set up and linked to the current user. It is recommended you save this to preferences for multi-session use.
*
* @deprecated Use {@link KiiSocialConnect.getAccessTokenObjectForNetwork} instead.
*
* @param networkName One of the supported KiiSocialNetworkName values
*
* @return The current access token, null if unavailable
*/
static getAccessTokenForNetwork(networkName: KiiSocialNetworkName): string;
/**
* Retrieve the current user's access token expiration date from a social network
*
* The network must be set up and linked to the current user. It is recommended you save this to preferences for multi-session use.
*
* @deprecated Use {@link KiiSocialConnect.getAccessTokenObjectForNetwork} instead.
*
* @param networkName One of the supported KiiSocialNetworkName values
*
* @return The current access token expiration date, null if unavailable
*/
static getAccessTokenExpirationForNetwork(networkName: KiiSocialNetworkName): string;
/**
* Retrieve the current user's access token object from a social network
*
* The network must be set up and linked to the current user.
* It is recommended you save this to preferences for multi-session use.<br><br>
* Following parameters can be assigned to object.<br><br>
* <b>Facebook</b>
* <li>access_token</li>
* <li>expires_in</li>
* <li>kii_new_user</li>
* <br>
* <b>Twitter</b>
* <li>oauth_token</li>
* <li>oauth_token_secret</li>
* <li>kii_new_user</li>
* <br>
* <b>Google</b>
* <li>access_token</li>
* <li>kii_new_user</li>
* <br>
* <b>RenRen</b>
* <li>access_token</li>
* <li>kii_new_user</li>
* <br>
* <b>QQ</b>
* <li>access_token</li>
* <li>openID</li>
* <li>kii_new_user</li>
*
* @param networkName One of the supported KiiSocialNetworkName values
*
* @return tokenObject The current access token object, null if unavailable.
*/
static getAccessTokenObjectForNetwork(networkName: KiiSocialNetworkName): any;
}
/**
* Represents a Thing object
*/
export class KiiThing {
/**
* of this thing.
* For details refer to {@link KiiThing.register}
*/
fields: KiiThingFields;
/**
* Get thing ID.
*
* @return thing id
*/
getThingID(): string;
/**
* Get vendor thing ID.
*
* @return vendor thing id
*/
getVendorThingID(): string;
/**
* Get access token of this thing.
*
* @return access token of this thing.
*/
getAccessToken(): string;
/**
* Get created time of this thing.
*
* @return created time of this thing.
*/
getCreated(): Date;
/**
* Get disabled status of this thing.
*
* @return true if thing is disabled, false otherwise.
*/
getDisabled(): boolean;
/**
* Get online status of the thing.
*
* @return true if the thing is online, false otherwise. The return value will be null initially until the thing is connected for the first time.
*/
isOnline(): boolean;
/**
* Get online status modified date of the thing.
*
* @return online status modified time of this thing. The date will be null initially until the thing is connected for the first time.
*/
getOnlineStatusModifiedAt(): Date;
/**
* Register thing in KiiCloud.<br>
* This API doesnt require users login Anonymous user can register thing.
* <br>
* Propertis started with '_' in the fields is reserved by Kii Cloud.<br>
* Those properties are indexed in Kii Cloud storage.<br>
* Properties not started with '_' is custom properties defined by developer.<br>
* Custom properties are not indexed in KiiCloud storage.<br>
* Following properties are readonly and ignored on creation/{@link #update} of thing.<br>
* '_thingID', '_created', '_accessToken' <br>
* Following properties are readonly after creation and will be ignored on {@link #update} of thing.<br>
* '_vendorThingID', '_password'<br>
* As Property prefixed with '_' is reserved by Kii Cloud,
* properties other than ones described in the parameter secion
* and '_layoutPosition' are ignored on creation/{@link #update} of thing.<br>
* Those ignored properties won't be removed from fields object passed as argument.
* However it won't be reflected to fields object property of created/updated Thing.
*
* @param fields of the thing to be registered.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thing). thing is a KiiThing instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiThing instance.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* KiiThing.register(
* {
* _vendorThingID: "thing-XXXX-YYYY-ZZZZZ",
* _password: "thing-password",
* _thingType: "thermometer",
* yourCustomObj: // Arbitrary key can be used.
* { // Object, Array, Number, String can be used. Should be compatible with JSON.
* yourCustomKey1: "value",
* yourCustomKey2: 100
* }
* },
* {
* success: function(thing) {
* // Register Thing succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* }
* );
*
* // example to use Promise
* KiiThing.register(
* {
* _vendorThingID: "thing-XXXX-YYYY-ZZZZZ",
* _password: "thing-password",
* _thingType: "thermometer",
* yourCustomObj: // Arbitrary key can be used.
* { // Object, Array, Number, String can be used. Should be compatible with JSON.
* yourCustomKey1: "value",
* yourCustomKey2: 100
* }
* }
* ).then(
* function(thing) {
* // Register Thing succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
static register(fields: KiiThingFields, callbacks?: { success(thing: KiiThing): any; failure(error: Error): any; }): Promise<KiiThing>;
/**
* Retrieve the latest thing information from KiiCloud.
* <br>This API is authorized by owner of thing.
* <br>Need user login who owns this thing before execute this API.
* <br>To let users to own thing, please call {@link KiiThing#registerOwner}
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thing). thing is KiiThing instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiThing instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume thing is already registered.
* thing.refresh({
* success: function(thing) {
* // Refresh succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing is already registered.
* thing.refresh().then(
* function(thing) {
* // Refresh succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
refresh(callbacks?: { success(thing: KiiThing): any; failure(error: Error): any; }): Promise<KiiThing>;
/**
* Update registered thing information in Kii Cloud
* <br>This API is authorized by owner of thing.
* <br>Need user login who owns this thing before execute this API.
* <br>To let users to own thing, please call {@link KiiThing#registerOwner}
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thing). thing is a KiiThing instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiThing instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @see KiiThing.register
*
* @example
* // example to use callbacks directly
* // assume thing is already registered.
* thing.fields._stringField1 = "new string value";
* thing.fields.customObject = {
* "customField1" : "abcd",
* "customField2" : 123
* };
* thing.update({
* success: function(thing) {
* // Update succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing is already registered.
* thing.fields._stringField1 = "new string value";
* thing.fields.customObject = {
* "customField1" : "abcd",
* "customField2" : 123
* };
* thing.update().then(
* function(thing) {
* // Update succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
update(callbacks?: { success(thing: KiiThing): any; failure(error: Error): any; }): Promise<KiiThing>;
/**
* Delete registered thing in Kii Cloud.
* <br>This API is authorized by owner of thing.
* <br>Need user login who owns this thing before execute this API.
* <br>To let users to own thing, please call {@link KiiThing#registerOwner}
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* It will delete bucket, topic which belongs to this thing,
* entity belongs to the bucket/topic and all ownership information of thing.
* This operation can not be reverted. Please carefully use this.
*
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thing). thing is a KiiThing instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiThing instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume thing is already registered.
* thing.deleteThing({
* success: function(thing) {
* // Delete succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing is already registered.
* thing.deleteThing().then(
* function(thing) {
* // Delete succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
deleteThing(callbacks?: { success(thing: KiiThing): any; failure(error: Error): any; }): Promise<KiiThing>;
/**
* Check if user/ group is owner of the thing.
* <br>This API is authorized by owner of thing.
* <br>Need user login before execute this API.
* <br>To let users to own Thing, please call {@link KiiThing#registerOwner}
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* @param owner whether the instance is owner of thing or not.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is an Array instance.
* <ul>
* <li>params[0] is the KiiThing instance which this method was called on.</li>
* <li>params[1] is a KiiUser/KiiGroup instance.</li>
* <li>params[2] is Boolean value, true is the user/group is owner of the thing, otherwise false.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiThing instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume thing/user is already registered.
* var user = KiiUser.userWithURI("kiicloud://users/xxxyyyy");
* thing.isOwner(user, {
* success: function(thing, user, isOwner) {
* if (isOwner) {
* // user is owner of the thing.
* } else {
* // user is not owner of the thing.
* }
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing/user is already registered.
* var user = KiiUser.userWithURI("kiicloud://users/xxxyyyy");
* thing.isOwner(user).then(
* function(params) {
* var thing = params[0];
* var user = params[1];
* var isOwner = params[2];
* if (isOwner) {
* // user is owner of the thing.
* } else {
* // user is not owner of the thing.
* }
* },
* function(error) {
* // Handle error.
* }
* );
*/
isOwner<T extends KiiUser | KiiGroup>(owner: T, callbacks?: { success(thing: KiiThing, user: T, isOwner: boolean): any; failure(error: Error): any; }): Promise<[KiiThing, T, boolean]>;
/**
* Register user/group as owner of this thing.
* <br>Need user login before execute this API.
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* @param owner to be registered as owner.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is an Array instance.
* <ul>
* <li>params[0] is the KiiThing instance which this method was called on.</li>
* <li>params[1] is a KiiUser/KiiGroup instance.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiThing instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* thing.registerOwner(group, {
* success: function(thing, group) {
* // Register owner succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* thing.registerOwner(group).then(
* function(params) {
* // Register owner succeeded.
* var thing = params[0];
* var group = params[1];
* },
* function(error) {
* // Handle error.
* }
* );
*/
registerOwner<T extends KiiUser | KiiGroup>(owner: T, callbacks?: { success(thing: KiiThing, group: T): any; failure(error: Error): any; }): Promise<[KiiThing, T]>;
/**
* Register user/group as owner of specified thing.
* <br>Need user login before execute this API.
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* @param thingID The ID of thing
* @param owner instance of KiiUser/KiiGroup to be registered as owner.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is an Array instance.
* <ul>
* <li>params[0] is a KiiUser/KiiGroup instance.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* KiiThing.registerOwnerWithThingID("th.xxxx-yyyy-zzzz", group, {
* success: function(group) {
* // Register owner succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* KiiThing.registerOwnerWithThingID("th.xxxx-yyyy-zzzz", group).then(
* function(params) {
* // Register owner succeeded.
* var group = params[0];
* },
* function(error) {
* // Handle error.
* }
* );
*/
static registerOwnerWithThingID<T extends KiiUser | KiiGroup>(thingID: string, owner: T, callbacks?: { success(group: T): any; failure(error: Error): any; }): Promise<T>;
/**
* Register user/group as owner of specified thing.
* <br>Need user login before execute this API.
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* @param vendorThingID The vendor thing ID of thing
* @param owner instance of KiiUser/KiiGroup to be registered as owner.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is an Array instance.
* <ul>
* <li>params[0] is a KiiUser/KiiGroup instance.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* KiiThing.registerOwnerWithVendorThingID("xxxx-yyyy-zzzz", group, {
* success: function(group) {
* // Register owner succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* KiiThing.registerOwnerWithVendorThingID("xxxx-yyyy-zzzz", group).then(
* function(group) {
* // Register owner succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
static registerOwnerWithVendorThingID<T extends KiiUser | KiiGroup>(vendorThingID: string, owner: T, callbacks?: { success(group: T): any; failure(error: Error): any; }): Promise<T>;
/**
* Remove ownership of thing from specified user/group.
* <br>This API is authorized by owner of thing.
* <br>Need user login who owns this thing before execute this API.
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* @param owner to be unregistered.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is an Array instance.
* <ul>
* <li>params[0] is the KiiThing instance which this method was called on.</li>
* <li>params[1] is a KiiUser/KiiGroup instance which had ownership of the thing removed.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiThing instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* thing.unregisterOwner(group, {
* success: function(thing, group) {
* // Unregister owner succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing/group is already registered.
* var group = KiiGroup.groupWithURI("kiicloud://groups/xxxyyyy");
* thing.unregisterOwner(group).then(
* function(params) {
* // Unregister owner succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
unregisterOwner<T extends KiiUser | KiiGroup>(owner: T, callbacks?: { success(thing: KiiThing, group: T): any; failure(error: Error): any; }): Promise<[KiiThing, T]>;
/**
* Disable the thing.
* <br>This API is authorized by owner of thing.
* <br>Need user login who owns this thing before execute this API.
* <br>To let users to own Thing, please call {@link KiiThing#registerOwner}
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* After succeeded, access token published for thing is disabled.
* In a result, only the app administrator and owners of thing can access the thing.
* Used when user lost the thing and avoid using by unknown users.
* It doesn't throw error when the thing is already disabled.
*
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thing). thing is a KiiThing instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiThing instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume thing is already registered.
* thing.disable({
* success: function(thing) {
* // Disable succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing is already registered.
* thing.disable().then(
* function(thing) {
* // Disable succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
disable(callbacks?: { success(thing: KiiThing): any; failure(error: Error): any; }): Promise<KiiThing>;
/**
* Enable the thing.
* <br>This API is authorized by owner of thing.
* <br>Need user login who owns this thing before execute this API.
* <br>To let users to own Thing, please call {@link KiiThing#registerOwner}
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* After succeeded, If thing is registered with "persistentToken" option,
* token should be recovered (Access token which is used before disabling can be available).
* Otherwise, it does not recovered.
* It doesn't throw error when the thing is already enabled.
*
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thing). thing is a KiiThing instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiThing instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume thing is already registered.
* thing.enable({
* success: function(thing) {
* // Enable succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume thing is already registered.
* thing.enable().then(
* function(thing) {
* // Disable succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
enable(callbacks?: { success(thing: KiiThing): any; failure(error: Error): any; }): Promise<KiiThing>;
/**
* Load thing with given vendor thing id.
* <br>This API is authorized by owner of thing.
* <br>Need user login who owns this thing before execute this API.
* <br>To let users to own Thing, please call {@link KiiThing#registerOwner}
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* @param vendorThingID registered vendor thing id.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thing). thing is a KiiThing instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* KiiThing.loadWithVendorThingID("thing-xxxx-yyyy",{
* success: function(thing) {
* // Load succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* KiiThing.loadWithVendorThingID("thing-xxxx-yyyy").then(
* function(thing) {
* // Load succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
static loadWithVendorThingID(vendorThingID: string, callbacks?: { success(thing: KiiThing): any; failure(error: Error): any; }): Promise<KiiThing>;
/**
* Load thing with thing id given by Kii Cloud.
* <br>This API is authorized by owner of thing.
* <br>Need user login who owns this thing before execute this API.
* <br>To let users to own Thing, please call {@link KiiThing#registerOwner}
* <br>Note: if you obtain thing instance from {@link KiiAppAdminContext},
* API is authorized by app admin.<br>
*
* thing id can be obtained by {@link thingID}
*
* @param thingID registered thing id.
* @param callbacks object holds callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(thing). thing is a KiiThing instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* KiiThing.loadWithThingID("thing-xxxx-yyyy",{
* success: function(thing) {
* // Load succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* KiiThing.loadWithVendorThingID("thing-xxxx-yyyy").then(
* function(thing) {
* // Load succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
static loadWithThingID(thingID: string, callbacks?: { success(thing: KiiThing): any; failure(error: Error): any; }): Promise<KiiThing>;
/**
* Instantiate bucket belongs to this thing.
*
* @param bucketName name of the bucket.
*
* @return bucket instance.
*/
bucketWithName(bucketName: string): KiiBucket;
/**
* Creates a reference to a encrypted bucket for this thing
*
* <br><br>The bucket will be created/accessed within this thing's scope
*
* @param bucketName The name of the bucket the user should create/access
*
* @return A working KiiEncryptedBucket object
*
* @example
* var thing = . . .; // a KiiThing
* var bucket = thing.encryptedBucketWithName("myBucket");
*/
encryptedBucketWithName(bucketName: string): KiiBucket;
/**
* Instantiate topic belongs to this thing.
*
* @param topicName name of the topic. Must be a not empty string.
*
* @return topic instance.
*/
topicWithName(topicName: string): KiiTopic;
/**
* Gets a list of topics in this thing scope
*
* @param callbacks An object with callback methods defined
* @param paginationKey You can specify the pagination key with the nextPaginationKey passed by callbacks.success. If empty string or no string object is provided, this API regards no paginationKey specified.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is array of KiiTopic instances.</li>
* <li>params[1] is string of nextPaginationKey.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiThing instance which this method was called on. </li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var thing = . . .; // a KiiThing
* thing.listTopics({
* success: function(topicList, nextPaginationKey) {
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* thing.listTopics({
* success: function(topicList, nextPaginationKey) {...},
* failure: function(anErrorString) {...}
* }, nextPaginationKey);
* }
* },
* failure: function(anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use promise
* var thing = . . .; // a KiiThing
* thing.listTopics().then(
* function(params) {
* var topicList = params[0];
* var nextPaginationKey = params[1];
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* thing.listTopics(null, nextPaginationKey).then(
* function(params) {...},
* function(error) {...}
* );
* }
* },
* function(error) {
* // do something with the error response
* }
* );
*/
listTopics(callbacks?: { success(topicList: KiiTopic[], nextPaginationKey: string): any; failure(anErrorString: string): any; }, paginationKey?: string): Promise<[KiiTopic[], string]>;
/**
* Instantiate push subscription for this thing.
*
* @return push subscription object.
*/
pushSubscription(): KiiPushSubscription;
}
/**
* represents a KiiThingContext object
*/
export class KiiThingContext {
/**
* Creates a reference to a bucket in App scope operated by thing.
*
* @param bucketName The name of the bucket the app should create/access
*
* @return A working KiiBucket object
*
* @example
* Kii.authenticateAsThing("vendorThingID", "password", {
* success: function(thingAuthContext) {
* var bucket = thingAuthContext.bucketWithName("myAppBucket");
* },
* failure: function(errorString, errorCode) {
* // auth failed.
* }
* });
*/
bucketWithName(bucketName: string): KiiBucket;
/**
* Creates a reference to a encrypted bucket in App scope operated by thing.
* <br><br>The bucket will be created/accessed within this app's scope
*
* @param bucketName The name of the bucket the app should create/access
*
* @return A working KiiBucket object
*
* @example
* Kii.authenticateAsThing("vendorThingID", "password", {
* success: function(thingAuthContext) {
* var bucket = thingAuthContext.encryptedBucketWithName("myAppBucket");
* },
* failure: function(errorString, errorCode) {
* // auth failed.
* }
* });
*/
encryptedBucketWithName(bucketName: string): KiiBucket;
/**
* Creates a reference to an object operated by thing using object`s URI.
*
* @param object URI.
*
* @return A working KiiObject instance
*
* @throws If the URI is null, empty or does not have correct format.
*/
objectWithURI(object: string): KiiObject;
/**
* Creates a reference to a topic in App scope operated by thing.
* <br><br>The Topic will be created/accessed within this app's scope
*
* @param topicName name of the topic. Must be a not empty string.
*
* @return topic instance.
*/
topicWithName(topicName: string): KiiTopic;
/**
* Gets a list of topics in app scope
*
* @param callbacks An object with callback methods defined
* @param paginationKey You can specify the pagination key with the nextPaginationKey passed by callbacks.success. If empty string or no string object is provided, this API regards no paginationKey specified.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is array of KiiTopic instances.</li>
* <li>params[1] is string of nextPaginationKey.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiAppAdminContext instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // Assume you already have thingAuthContext instance.
* thingAuthContext.listTopics({
* success: function(topicList, nextPaginationKey) {
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* thingAuthContext.listTopics({
* success: function(topicList, nextPaginationKey) {...},
* failure: function(anErrorString) {...}
* }, nextPaginationKey);
* }
* },
* failure: function(anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* // Assume you already have thingAuthContext instance.
* thingAuthContext.listTopics().then(
* function(params) {
* var topicList = params[0];
* var nextPaginationKey = params[1];
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* thingAuthContext.listTopics(null, nextPaginationKey).then(
* function(params) {...},
* function(error) {...}
* );
* }
* },
* function(error) {
* // do something with the error response
* }
* );
*/
listTopics(callbacks?: { success(topicList: KiiTopic[], nextPaginationKey: string): any; failure(anErrorString: string): any; }, paginationKey?: string): Promise<[KiiTopic[], string]>;
/**
* Gets authenticated KiiThing instance.
* <br>Returned thing instance only have thingID, vendorThingID and accessToken.
* (vendorThingID is not included when you used
* {@link Kii.authenticateAsThingWithToken()} to obtain KiiThingContext.)
* <br>Please execute {@link KiiThing#refresh()} to obtain other properties.
*
* @return return authenticated KiiThing instance.
*/
getAuthenticatedThing(): KiiThing;
/**
* Instantiate push installation for this thing.
*
* @return push installation object.
*/
pushInstallation(): KiiPushInstallation;
}
/**
* Represents a Topic object.
*/
export class KiiTopic {
/**
* get name of this topic
*
* @return name of this topic.
*/
getName(): string;
/**
* Checks whether the topic already exists or not.
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(existed). true if the topic exists.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiTopic instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume topic is already instantiated.
* topic.exists({
* success: function(existed) {
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume topic is already instantiated.
* topic.exists().then(
* function(existed){
* },
* function(error){
* // Handle error.
* });
*/
exists(callbacks?: { success(existed: boolean): any; failure(error: Error): any; }): Promise<boolean>;
/**
* Save this topic on Kii Cloud.
* Note that only app admin can save application scope topic.
*
* @param callbacks callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedTopic). theSavedTopic is a KiiTopic instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiTopic instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume topic is already instantiated.
* topic.save({
* success: function(topic) {
* // Save topic succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume topic is already instantiated.
* topic.save().then(
* function(topic) {
* // Save topic succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
save(callbacks?: { success(topic: KiiTopic): any; failure(error: Error): any; }): Promise<KiiTopic>;
/**
* Send message to the topic.
*
* @param message to be sent.
* @param callbacks callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is an Array instance.
* <ul>
* <li>params[0] is the KiiTopic instance which this method was called on.</li>
* <li>params[1] is the message object to send.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiTopic instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume topic is already instantiated.
* var contents = {
* message : "hello push!"
* };
* var message = new KiiPushMessageBuilder(contents).build();
* topic.sendMessage(message, {
* success: function(topic, message) {
* // Send message succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume topic is already instantiated.
* var contents = {
* message : "hello push!"
* };
* var message = new KiiPushMessageBuilder(contents).build();
* topic.sendMessage(message).then(
* function(params) {
* // Send message succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
sendMessage<T>(message: T, callbacks?: { success(topic: KiiTopic, message: T): any; failure(error: Error): any; }): Promise<[KiiTopic, T]>;
/**
* Delete the topic.
*
* @param callbacks callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theDeletedTopic). theDeletedTopic is a KiiTopic instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiTopic instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // assume topic is already instantiated.
* topic.deleteTopic({
* success: function(topic) {
* // Delete topic succeeded.
* },
* failure: function(error) {
* // Handle error.
* }
* });
*
* // example to use Promise
* // assume topic is already instantiated.
* topic.deleteTopic().then(
* function(topic) {
* // Delete topic succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
deleteTopic(callbacks?: { success(topic: KiiTopic): any; failure(error: Error): any; }): Promise<KiiTopic>;
/**
* Get ACL object of this topic.
* Access to topic can be configured by adding/removing KiiACLEntry
* to/from obtained acl object.
*
* @return acl object of this topic.
*/
acl(): KiiACL;
}
/**
* Represents a KiiUser object
*/
export class KiiUser {
/**
*
*
* @deprecated Use {@link KiiUser.getId} instead.
* Get the UUID of the given user, assigned by the server
*
* @return
*/
getUUID(): string;
/**
* Get the ID of the current KiiUser instance.
*
* @return Id of the user or null if the user has not saved to cloud.
*/
getID(): string;
/**
* Get the username of the given user
*
* @return
*/
getUsername(): string;
/**
* Return true if the user is disabled, false when enabled and undefined
* when user is not refreshed.
* Call {@link KiiUser#refresh()} prior calling this method to get
* correct status.
*/
disabled(): void;
/**
* Get the display name associated with this user
*
* @return
*/
getDisplayName(): string;
/**
* Set the display name associated with this user. Cannot be used for logging a user in; is non-unique
*
* @param value Must be between 1-50 alphanumeric characters.
*
* @throws If the displayName is not a valid format
*/
setDisplayName(value: string): void;
/**
* Get whether or not the user is pseudo user.
* If this method is not called for current login user, calling
* {@link KiiUser#refresh()} method is necessary to get a correct value.
*
* @return whether this user is pseudo user or not.
*/
isPseudoUser(): boolean;
/**
* Get the email address associated with this user
*
* @return
*/
getEmailAddress(): string;
/**
* Get the email of this user that has not been verified.
* When the user's email has been changed and email verification is required in you app configuration,
* New email is stored as pending email.
* After the new email has been verified, the address can be obtained by {@link KiiUser.getEmailAddress}
*
* @return User's new email address has not been verified.
* null if no pending email field is included in refresh
* response or undefined when no refresh operation has been done before.
*/
getPendingEmailAddress(): string;
/**
* Get the phone number associated with this user
*
* @return
*/
getPhoneNumber(): string;
/**
* Get the phone of this user that has not been verified.
* When the user's phone has been changed and phone verification is required in you app configuration,
* New phone is stored as pending phone.
* After the new phone has been verified, the address can be obtained by {@link KiiUser.getPhoneNumber}
*
* @return User's new phone number has not been verified.
* null if no pending phone field is included in refresh
* response or undefined when no refresh operation has been done before.
*/
getPendingPhoneNumber(): string;
/**
* Get the country code associated with this user
*
* @return
*/
getCountry(): string;
/**
* Set the country code associated with this user
*
* @param value The country code to set. Must be 2 alphabetic characters. Ex: US, JP, CN
*
* @throws If the country code is not a valid format
*/
setCountry(value: string): void;
/**
* Get the locale associated with this user
*
* @return
*/
getLocale(): string;
/**
* Set the locale associated with this user
* The locale argument must be BCP 47 language tag.
* Examples:
* "en": English
* "de-AT": German as used in Austria.
* "zh-Hans-CN": Chinese written in simplified characters as used in China.
*
* @param value The locale to set.
*/
setLocale(value: string): void;
/**
* Get the server's creation date of this user
*
* @return
*/
getCreated(): string;
/**
*
*
* @deprecated Get the modified date of the given user, assigned by the server
*
* @return
*/
getModified(): string;
/**
* Get the status of the user's email verification. This field is assigned by the server
*
* @return true if the user's email address has been verified by the user, false otherwise.
* Could be undefined if haven't obtained value from server or not allowed to see the value.
* Should be used by current login user to check the email verification status.
*/
getEmailVerified(): boolean;
/**
* Get the status of the user's phone number verification. This field is assigned by the server
*
* @return true if the user's email address has been verified by the user, false otherwise
* Could be undefined if haven't obtained value from server or not allowed to see the value.
* Should be used by current login user to check the phone verification status.
*/
getPhoneVerified(): boolean;
/**
* Get the social accounts that is linked to this user.
* Refresh the user by {@link KiiUser#refresh()} prior call the method.
* Otherwise, it returns empty object.
*
* @return Social network name as key and account info as value.
*/
getLinkedSocialAccounts(): { [name: string]: KiiSocialAccountInfo };
/**
* Get the access token for the user - only available if the user is currently logged in
*
* @return
*/
getAccessToken(): string;
/**
* Return the access token and token expire time in a object.
* <table border=4 width=250>
* <tr>
* <th>Key</th>
* <th>Type</th>
* <th>Value</th>
* </tr>
* <tr>
* <td>"access_token"</td>
* <td>String</td>
* <td>required for accessing KiiCloud</td>
* </tr>
* <tr>
* <td>"expires_at"</td>
* <td>Date</td>
* <td>Access token expiration time, null if the user is not login user.</td>
* </tr>
* </table>
*
* @return Access token and token expires in a object.
*/
getAccessTokenObject(): KiiAccessTokenObject;
/**
* Get a specifically formatted string referencing the user
*
* <br><br>The user must exist in the cloud (have a valid UUID).
*
* @return A URI string based on the given user. null if a URI couldn't be generated.
*
* @example
* var user = . . .; // a KiiUser
* var uri = user.objectURI();
*/
objectURI(): string;
/**
* Sets a key/value pair to a KiiUser
*
* <br><br>If the key already exists, its value will be written over. If key is empty or starting with '_', it will do nothing. Accepted types are any JSON-encodable objects.
*
* @param key The key to set. The key must not be a system key (created, metadata, modified, type, uuid) or begin with an underscore (_)
* @param value The value to be set. Object must be of a JSON-encodable type (Ex: dictionary, array, string, number, etc)
*
* @example
* var user = . . .; // a KiiUser
* user.set("score", 4298);
*/
set(key: string, value: any): void;
/**
* Gets the value associated with the given key
*
* @param key The key to retrieve
*
* @return The object associated with the key. null or undefined if none exists
*
* @example
* var user = . . .; // a KiiUser
* var score = user.get("score");
*/
get<T>(key: string): T;
/**
* The currently authenticated user
*
* @return
*
* @example
* var user = KiiUser.getCurrentUser();
*/
static getCurrentUser(): KiiUser;
/**
* Create a user object to prepare for registration with credentials pre-filled
*
* <br><br>Creates an pre-filled user object for manipulation. This user will not be authenticated until one of the authentication methods are called on it. It can be treated as any other KiiObject before it is authenticated.
*
* @param username The user's desired username. Must be between 3 and 64 characters, which can include alphanumeric characters as well as underscores '_', dashes '-' and periods '.'
* @param password The user's password. Must be between 4-50 characters, made up of ascii characters excludes control characters.
*
* @return a working KiiUser object
*
* @throws If the username is not in the proper format
* @throws If the password is not in the proper format
*
* @example
* var user = KiiUser.userWithUsername("myusername", "mypassword");
*/
static userWithUsername(username: string, password: string): KiiUser;
/**
* Create a user object to prepare for registration with credentials pre-filled
*
* <br><br>Creates an pre-filled user object for registration. This user will not be authenticated until the registration method is called on it. It can be treated as any other KiiUser before it is registered.
*
* @param phoneNumber The user's phone number
* @param password The user's password. Must be at least 4 characters, made up of alphanumeric and/or: @,#,$,%,^,&
*
* @return a working KiiUser object
*
* @throws If the password is not in the proper format
* @throws If the phone number is not in the proper format
*
* @example
* var user = KiiUser.userWithPhoneNumber("+874012345678", "mypassword");
*/
static userWithPhoneNumber(phoneNumber: string, password: string): KiiUser;
/**
* Create a user object to prepare for registration with credentials pre-filled
*
* <br><br>Creates an pre-filled user object for registration. This user will not be authenticated until the registration method is called on it. It can be treated as any other KiiUser before it is registered.
*
* @param phoneNumber The user's phone number
* @param username The user's desired username. Must be between 3 and 64 characters, which can include alphanumeric characters as well as underscores '_', dashes '-' and periods '.'
* @param password The user's password. Must be at least 4 characters, made up of alphanumeric and/or: @,#,$,%,^,&
*
* @return a working KiiUser object
*
* @throws If the username is not in the proper format
* @throws If the password is not in the proper format
* @throws If the phone number is not in the proper format
*
* @example
* var user = KiiUser.userWithPhoneNumberAndUsername("+874012345678", "johndoe", "mypassword");
*/
static userWithPhoneNumberAndUsername(phoneNumber: string, username: string, password: string): KiiUser;
/**
* Create a user object to prepare for registration with credentials pre-filled
*
* <br><br>Creates an pre-filled user object for registration. This user will not be authenticated until the registration method is called on it. It can be treated as any other KiiUser before it is registered.
*
* @param emailAddress The user's email address
* @param password The user's password. Must be at least 4 characters, made up of alphanumeric and/or: @,#,$,%,^,&
*
* @return a working KiiUser object
*
* @throws If the password is not in the proper format
* @throws If the email address is not in the proper format
*
* @example
* var user = KiiUser.userWithEmailAddress("johndoe@example.com", "mypassword");
*/
static userWithEmailAddress(emailAddress: string, password: string): KiiUser;
/**
* Create a user object to prepare for registration with credentials pre-filled
*
* <br><br>Creates an pre-filled user object for registration. This user will not be authenticated until the registration method is called on it. It can be treated as any other KiiUser before it is registered.
*
* @param emailAddress The user's email address
* @param username The user's desired username. Must be between 3 and 64 characters, which can include alphanumeric characters as well as underscores '_', dashes '-' and periods '.'
* @param password The user's password. Must be at least 4 characters, made up of alphanumeric and/or: @,#,$,%,^,&
*
* @return a working KiiUser object
*
* @throws If the username is not in the proper format
* @throws If the password is not in the proper format
* @throws If the phone number is not in the proper format
*
* @example
* var user = KiiUser.userWithEmailAddressAndUsername("johndoe@example.com", "johndoe", "mypassword");
*/
static userWithEmailAddressAndUsername(emailAddress: string, username: string, password: string): KiiUser;
/**
* Create a user object to prepare for registration with credentials pre-filled
*
* <br><br>Creates an pre-filled user object for registration. This user will not be authenticated until the registration method is called on it. It can be treated as any other KiiUser before it is registered.
*
* @param emailAddress The user's email address
* @param phoneNumber The user's phone number
* @param password The user's password. Must be at least 4 characters, made up of alphanumeric and/or: @,#,$,%,^,&
*
* @return a working KiiUser object
*
* @throws If the phone number is not in the proper format
* @throws If the password is not in the proper format
* @throws If the phone number is not in the proper format
*
* @example
* var user = KiiUser.userWithEmailAddressAndPhoneNumber("johndoe@example.com", "+874012345678", "mypassword");
*/
static userWithEmailAddressAndPhoneNumber(emailAddress: string, phoneNumber: string, password: string): KiiUser;
/**
* Create a user object to prepare for registration with credentials pre-filled
*
* <br><br>Creates an pre-filled user object for registration. This user will not be authenticated until the registration method is called on it. It can be treated as any other KiiUser before it is registered.
*
* @param emailAddress The user's email address
* @param phoneNumber The user's phone number
* @param username The user's desired username. Must be between 3 and 64 characters, which can include alphanumeric characters as well as underscores '_', dashes '-' and periods '.'
* @param password The user's password. Must be at least 4 characters, made up of alphanumeric and/or: @,#,$,%,^,&
*
* @return a working KiiUser object
*
* @throws If the phone number is not in the proper format
* @throws If the phone number is not in the proper format
* @throws If the username is not in the proper format
* @throws If the password is not in the proper format
*
* @example
* var user = KiiUser.userWithCredentials("johndoe@example.com", "+874012345678", "johndoe", "mypassword");
*/
static userWithCredentials(emailAddress: string, phoneNumber: string, username: string, password: string): KiiUser;
/**
* Instantiate KiiUser that refers to existing user which has specified ID.
* You have to specify the ID of existing KiiUser. Unlike KiiObject,
* you can not assign ID in the client side.<br>
* <b>NOTE</b>: This API does not access to the server.
* After instantiation, call {@link KiiUser#refresh} to fetch the properties.
*
* @param userID ID of the KiiUser to instantiate.
*
* @return instance of KiiUser.
*
* @throws when passed userID is empty or null.
*
* @example
* var user = new KiiUser.userWithID("__USER_ID__");
*/
static userWithID(userID: string): KiiUser;
/**
* Generate a new KiiUser based on a given URI
*
* @param uri The URI of the object to be represented
*
* @return A new KiiUser with its parameters filled in from the URI
*
* @throws If the URI is not in the proper format
*
* @example
* var user = new KiiUser.userWithURI("kiicloud://myuri");
*/
static userWithURI(uri: string): KiiUser;
/**
* Creates a reference to a bucket for this user
*
* <br><br>The bucket will be created/accessed within this user's scope
*
* @param bucketName The name of the bucket the user should create/access
*
* @return A working KiiBucket object
*
* @example
* var user = . . .; // a KiiUser
* var bucket = user.bucketWithName("myBucket");
*/
bucketWithName(bucketName: string): KiiBucket;
/**
* Creates a reference to a encrypted bucket for this user
*
* <br><br>The bucket will be created/accessed within this user's scope
*
* @param bucketName The name of the bucket the user should create/access
*
* @return A working KiiEncryptedBucket object
*
* @example
* var user = . . .; // a KiiUser
* var bucket = user.encryptedBucketWithName("myBucket");
*/
encryptedBucketWithName(bucketName: string): KiiBucket;
/**
* Authenticates a user with the server.
* If authentication successful, the user is cached inside SDK as current user,and accessible via
* {@link KiiUser.getCurrentUser()}.
* User token and token expiration is also cached and can be get by {@link KiiUser#getAccessTokenObject()}.
* Access token won't be expired unless you set it explicitly by {@link Kii.setAccessTokenExpiration()}.<br>
* If password or userIdentifier is invalid, callbacks.failure or reject callback of promise will be called. <br>
*
* @param userIdentifier The username, validated email address, or validated phone number of the user to authenticate
* @param password The password of the user to authenticate
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theAuthenticatedUser). theAuthenticatedUser is KiiUser instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiUser instance.If given password or userIdentifier is invalid, it will be null.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* KiiUser.authenticate("myusername", "mypassword", {
* success: function(theAuthenticatedUser) {
* // do something with the authenticated user
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* KiiUser.authenticate("myusername", "mypassword").then(
* function(theAuthenticatedUser) {
* // do something with the authenticated user
* },
* function(error) {
* // do something with the error response
* }
* );
*/
static authenticate(userIdentifier: string, password: string, callbacks?: { success(theAuthenticatedUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<KiiUser>;
/**
* Asynchronously authenticates a user with the server using specified access token.
* This method is non-blocking.<br><br>
* Specified expiresAt won't be used by SDK. IF login successful,
* we set this property so that you can get it later along with token
* by {@link KiiUser#getAccessTokenObject()}.<br>
* Also, if successful, the user is cached inside SDK as current user
* and accessible via {@link KiiUser.getCurrentUser()}.<br>
*
* Note that, if not specified, token expiration time is not cached
* and set to value equivalant to 275760 years.<br>
*
* If the specified token is expired, authenticataiton will be failed.
* Authenticate the user again to renew the token.<br>
*
* If expiresAt is invalid, callbacks.failure or reject callback of promise will be called. <br>
*
* @param accessToken A valid access token associated with the desired user
* @param callbacks An object with callback methods defined
* @param expiresAt Access token expire time that has received by {@link KiiUser#getAccessTokenObject()}. This param is optional and can be omitted.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theAuthenticatedUser). theAuthenticatedUser is KiiUser instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiUser instance.If expiresAt is invalid, it will be null.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* // Assume you stored the object get from KiiUser#getAccessTokenObject()
* // and now accessing by 'tokenObject' var.
* var token = tokenObject["access_token"];
* var expiresAt = tokenObject["expires_at"];
* expireDate.setHours(expireDate.getHours() + 24);
* KiiUser.authenticateWithToken(token, {
* success: function(theAuthenticatedUser) {
* // do something with the authenticated user
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* }, expiresAt);
*
* // example to use Promise
* // Assume you stored the object get from KiiUser#getAccessTokenObject()
* // and now accessing by 'tokenObject' var.
* var token = tokenObject["access_token"];
* var expiresAt = tokenObject["expires_at"];
* expireDate.setHours(expireDate.getHours() + 24);
* KiiUser.authenticateWithToken(token, null, expiresAt).then(
* function(theAuthenticatedUser) {
* // do something with the authenticated user
* },
* function(error) {
* // do something with the error response
* }
* );
*/
static authenticateWithToken(accessToken: string, callbacks?: { success(theAuthenticatedUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }, expiresAt?: Date): Promise<KiiUser>;
/**
* Registers a user with the server
*
* <br><br>The user object must have an associated email/password combination.
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theAuthenticatedUser). theAuthenticatedUser is KiiUser instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiUser instance.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = KiiUser.userWithUsername("myusername", "mypassword");
* user.register({
* success: function(theAuthenticatedUser) {
* // do something with the authenticated user
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = KiiUser.userWithUsername("myusername", "mypassword");
* user.register().then(
* function(params) {
* // do something with the authenticated user
* },
* function(error) {
* // do something with the error response
* }
* );
*/
register(callbacks?: { success(theAuthenticatedUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<KiiUser>;
/**
* Registers a user as pseudo user with the server
*
* @param callbacks An object with callback methods defined.
* This argument is mandatory and can't be ommited.
* @param userFields Custom Fields to add to the user. This is optional and can be omitted.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theAuthenticatedUser). theAuthenticatedUser is KiiUser instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var userFields = {"displayName":"yourName", "country":"JP", "age":30};
* KiiUser.registerAsPseudoUser({
* success: function(theAuthenticatedUser) {
* // do something with the authenticated user
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* }, userFields);
*
* // example to use Promise
* var userFields = {"displayName":"yourName", "country":"JP", "age":30};
* KiiUser.registerAsPseudoUser(null, userFields).then(
* function(theAuthenticatedUser) {
* // do something with the authenticated user
* },
* function(error) {
* // do something with the error response
* }
* );
*/
static registerAsPseudoUser(callbacks?: { success(theAuthenticatedUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }, userFields?: any): Promise<KiiUser>;
/**
* Sets credentials data and custom fields to pseudo user.
*
* <br><br>This method is exclusive to pseudo user.
* <br>password is mandatory and needs to provide at least one of login name, email address or phone number.
*
* @param identityData
* @param password The user's password. Valid pattern is ^[\x20-\x7E]{4,50}$.
* @param callbacks An object with callback methods defined.
* This argument is mandatory and can't be ommited.
* @param userFields Custom Fields to add to the user. This is optional and can be omitted.
* @param removeFields An array of field names to remove from the user custom fields. Default fields are not removed from server.
* This is optional and can be omitted.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(user). user is KiiUser instance which this method was called on.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var identityData = { "username": "__USER_NAME_" };
* var userFields = { "displayName":"__DISPLAY_NAME","score":12344300 };
* var removeFields = ["age"];
* user.putIdentity(
* identityData,
* "__PASSWORD__",
* {
* success: function(user) {
* // do something with the updated user.
* },
* failure: function(user, errorString) {
* // check error response.
* }
* },
* userFields,
* removeFields
* );
*
* // example to use Promise
* var identityData = { "username": "__USER_NAME_" };
* var userFields = { "displayName":"__DISPLAY_NAME","score":12344300 };
* var removeFields = ["age"];
* user.putIdentity(
* identityData,
* "__PASSWORD__",
* null,
* userFields,
* removeFields
* ).then(
* function(user) {
* // do something with the updated user.
* },
* function(error) {
* // check error response.
* }
* );
*/
putIdentity(identityData: identityData, password: string, callbacks?: { success(user: KiiUser): any; failure(user: KiiUser, errorString: string): any; }, userFields?: any, removeFields?: string[]): Promise<KiiUser>;
/**
* Update user attributes.
*
*
* <br><br>If you want to update identity data of pseudo user, you must use KiiUser.putIdentity instead.
*
* @param identityData
* @param callbacks An object with callback methods defined.
* This argument is mandatory and can't be ommited.
* @param userFields Custom Fields to add to the user.
* @param removeFields An array of field names to remove from the user custom fields. Default fields are not removed from server.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(user). user is KiiUser instance which this method was called on.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is a KiiUser instance.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var identityData = { "username": "__USER_NAME_" };
* var userFields = { "displayName":"__DISPLAY_NAME","score":12344300 };
* var removeFields = ["age"];
* user.update(
* identityData,
* {
* success: function(user) {
* // do something with the updated user.
* },
* failure: function(user, errorString) {
* // check error response.
* }
* },
* userFields,
* removeFields
* );
*
* // example to use Promise
* var identityData = { "username": "__USER_NAME_" };
* var userFields = { "displayName":"__DISPLAY_NAME","score":12344300 };
* var removeFields = ["age"];
* user.update(
* identityData,
* null,
* userFields,
* removeFields
* ).then(
* function(user) {
* // do something with the updated user.
* },
* function(error) {
* // check error response.
* }
* );
*/
update(identityData: identityData, callbacks?: { success(user: KiiUser): any; failure(user: KiiUser, errorString: string): any; }, userFields?: any, removeFields?: string[]): Promise<KiiUser>;
/**
* Update a user's password on the server
*
* <br><br>Update a user's password with the server. The fromPassword must be equal to the current password associated with the account in order to succeed.
*
* @param fromPassword The user's current password
* @param toPassword The user's desired password. Must be at least 4 characters, made up of alphanumeric and/or: @,#,$,%,^,&
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theUser). theUser is KiiUser instance which this method was called on.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = Kii.currentUser();
* user.updatePassword("oldpassword", "newpassword", {
* success: function(theUser) {
* // do something
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = Kii.currentUser();
* user.updatePassword("oldpassword", "newpassword").then(
* function(theUser) {
* // do something
* },
* function(error) {
* // do something with the error response
* }
* );
*/
updatePassword(fromPassword: string, toPassword: string, callbacks?: { success(theUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<KiiUser>;
/**
* Reset a user's password on the server
*
* <br><br>Reset a user's password on the server. The user is determined by the specified userIdentifier - which is an email address that has already been associated with an account. Reset instructions will be sent to that identifier.
* <br><br><b>Please Note:</b> This will reset the user's access token, so if they are currently logged in - their session will no longer be valid.
*
* @param userIdentifier The user's email address
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(). No parameter used.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* KiiUser.resetPassword("johndoe@example.com", {
* success: function() {
* // do something
* },
*
* failure: function(anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* KiiUser.resetPassword("johndoe@example.com").then(
* function() {
* // do something
* },
* function(error) {
* // do something with the error response
* }
* );
*/
static resetPassword(userIdentifier: string, callbacks?: { success(): any; failure(anErrorString: string): any; }): Promise<void>;
/**
* Reset the password of user <br>
* Reset the password of user specified by given identifier. <br>
* This api does not execute login after reset password.
*
* @param userIdentifier should be valid email address,
* global phone number or user identifier obtained by {@link #getID}.
* @param notificationMethod specify the destination of message include link
* of resetting password. must be "EMAIL" or "SMS".
* different type of identifier and destination can be used
* as long as user have verified email, phone.
* (ex. User registers both email and phone. Identifier is email and
* notificationMethod is SMS.)
* @param callbacks object includes callback functions.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(). No parameter used.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* KiiUser.resetPasswordWithNotificationMethod("+819001234567", "SMS", {
* success: function() {
* // Operation succeeded.
* },
* failure: function(errString) {
* // Handle error.
* }
* });
*
* // example to use Promise
* KiiUser.resetPasswordWithNotificationMethod("+819001234567", "SMS").then(
* function() {
* // Operation succeeded.
* },
* function(error) {
* // Handle error.
* }
* );
*/
static resetPasswordWithNotificationMethod(userIdentifier: string, notificationMethod: string, callbacks?: { success(): any; failure(errString: string): any; }): Promise<void>;
/**
* Verify the current user's phone number
* <br><br>This method is used to verify the phone number of user currently
* logged in.<br>
* Verification code is sent from Kii Cloud when new user is registered with
* phone number or user requested to change their phone number in the
* application which requires phone verification.<br>
* (You can enable/disable phone verification through the console in
* developer.kii.com)<br>
* After the verification succeeded, new phone number becomes users phone
* number and user is able to login with the phone number.<br>
* To get the new phone number, please call {@link #refresh()} and call
* {@link #getPhoneNumber()}<br>
* Before completion of {@link #refresh()}, {@link #getPhoneNumber()} returns
* cached phone number. It could be old phone number or undefined.
*
* @param verificationCode The code which verifies the currently logged in user
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theUser). theUser is KiiUser instance which this method was called on.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = Kii.currentUser();
* user.verifyPhoneNumber("012345", {
* success: function(theUser) {
* // do something
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = Kii.currentUser();
* user.verifyPhoneNumber("012345").then(
* function(theUser) {
* // do something
* },
* function(error) {
* // do something with the error response
* }
* );
*/
verifyPhoneNumber(verificationCode: string, callbacks?: { success(theUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<KiiUser>;
/**
* Resend the email verification code to the user
*
* <br><br>This method will re-send the email verification to the currently logged in user
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theUser). theUser is KiiUser instance which this method was called on.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = Kii.currentUser();
* user.resendEmailVerification({
* success: function(theUser) {
* // do something
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = Kii.currentUser();
* user.resendEmailVerification().then(
* function(theUser) {
* // do something
* },
* function(error) {
* // do something with the error response
* }
* );
*/
resendEmailVerification(callbacks?: { success(theUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<KiiUser>;
/**
* Resend the SMS verification code to the user
*
* <br><br>This method will re-send the SMS verification to the currently logged in user
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theUser). theUser is KiiUser instance which this method was called on.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = Kii.currentUser();
* user.resendPhoneNumberVerification({
* success: function(theUser) {
* // do something
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = Kii.currentUser();
* user.resendPhoneNumberVerification().then(
* function(theUser) {
* // do something
* },
* function(error) {
* // do something with the error response
* }
* );
*/
resendPhoneNumberVerification(callbacks?: { success(theUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<KiiUser>;
/**
* Retrieve a list of groups which the user is a member of
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is the KiiUser instance which this method was called on.</li>
* <li>params[1] is array of KiiGroup instances.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = Kii.currentUser();
* user.memberOfGroups({
* success: function(theUser, groupList) {
* // do something with the results
* for(var i=0; i<groupList.length; i++) {
* var g = groupList[i]; // a KiiGroup object
* }
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = Kii.currentUser();
* user.memberOfGroups().then(
* function(params) {
* // do something with the results
* var theUser = params[0];
* var groupList = params[1];
* for(var i=0; i<groupList.length; i++) {
* var g = groupList[i]; // a KiiGroup object
* }
* },
* function(error) {
* // do something with the error response
* }
* );
*/
memberOfGroups(callbacks?: { success(theUser: KiiUser, groupList: KiiGroup[]): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<[KiiUser, KiiGroup[]]>;
/**
* Retrieve the groups owned by this user. Group in the groupList
* does not contain all the property of group. To get all the
* property from cloud, a {@link KiiGroup#refresh(callback)} is necessary.
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is the KiiUser instance which this method was called on.</li>
* <li>params[1] is array of KiiGroup instances.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = Kii.currentUser();
* user.ownerOfGroups({
* success: function(theUser, groupList) {
* // do something with the results
* for(var i=0; i<groupList.length; i++) {
* var g = groupList[i]; // a KiiGroup object
* }
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = Kii.currentUser();
* user.ownerOfGroups().then(
* function(params) {
* // do something with the results
* var theUser = params[0];
* var groupList = params[1];
* for(var i=0; i<groupList.length; i++) {
* var g = groupList[i]; // a KiiGroup object
* }
* },
* function(error) {
* // do something with the error response
* }
* );
*/
ownerOfGroups(callbacks?: { success(theUser: KiiUser, groupList: KiiGroup[]): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<[KiiUser, KiiGroup[]]>;
/**
* Change phone number of logged in user.
* If the phone number verification is required by your app configuration,
* User's phone number would not changed to new one until the new phone number verification has been done.
* In this case, new phone can be obtained by {@link KiiUser#getPendingPhoneNumber()}.
* This API does not refresh the KiiUser automatically.
* Please execute {@link KiiUser#refresh()} before checking the value of {@link KiiUser#getPhoneNumber()} or {@link KiiUser#getPendingPhoneNumber()}.
*
* @param newPhoneNumber The new phone number to change to
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theUser). theUser is KiiUser instance which this method was called on.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = Kii.currentUser();
* user.changePhone('+19415551234', {
* success: function(theUser) {
* // do something on success
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = Kii.currentUser();
* user.changePhone('+19415551234').then(
* function(theUser) {
* // do something on success
* },
* function(error) {
* // do something with the error response
* }
* );
*/
changePhone(newPhoneNumber: string, callbacks?: { success(theUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<KiiUser>;
/**
* Change email of logged in user.
* If the email address verification is required by your app configuration,
* User's email would not changed to new one until the new email verification has been done.
* In this case, new mail address can be obtained by {@link KiiUser#getPendingEmailAddress()}.
* This API does not refresh the KiiUser automatically.
* Please execute {@link KiiUser#refresh()} before checking the value of {@link KiiUser#getEmailAddress()} or {@link KiiUser#getPendingEmailAddress()}
*
* @param newEmail The new email address to change to
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theUser). theUser is KiiUser instance which this method was called on.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = Kii.currentUser();
* user.changeEmail('mynewemail@kii.com', {
* success: function(theUser) {
* // do something on success
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = Kii.currentUser();
* user.changeEmail('mynewemail@kii.com').then(
* function(theUser) {
* // do something on success
* },
* function(error) {
* // do something with the error response
* }
* );
*/
changeEmail(newEmail: string, callbacks?: { success(theUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<KiiUser>;
/**
* Saves the latest user values to the server
*
* <br><br>If the user does not yet exist, it will NOT be created. Otherwise, the fields that have changed will be updated accordingly.
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedUser). theSavedUser is KiiUser instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = Kii.getCurrentUser(); // a KiiUser
* user.save({
* success: function(theSavedUser) {
* // do something with the saved user
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = Kii.getCurrentUser(); // a KiiUser
* user.save().then(
* function(theSavedUser) {
* // do something with the saved user
* },
* function(error) {
* // do something with the error response
* }
* );
*/
save(callbacks?: { success(theSavedUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<KiiUser>;
/**
* Updates the local user's data with the user data on the server
*
* <br><br>The user must exist on the server. Local data will be overwritten.
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theRefreshedUser). theRefreshedUser is KiiUser instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = Kii.getCurrentUser(); // a KiiUser
* user.refresh({
* success: function(theRefreshedUser) {
* // do something with the refreshed user
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = Kii.getCurrentUser(); // a KiiUser
* user.refresh().then(
* function(theRefreshedUser) {
* // do something with the refreshed user
* },
* function(error) {
* // do something with the error response
* }
* );
*/
refresh(callbacks?: { success(theRefreshedUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<KiiUser>;
/**
* Delete the user from the server
*
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theDeletedUser). theDeletedUser is KiiUser instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on.</li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = Kii.getCurrentUser(); // a KiiUser
* user.delete({
* success: function(theDeletedUser) {
* // do something
* },
*
* failure: function(theUser, anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var user = Kii.getCurrentUser(); // a KiiUser
* user.delete().then(
* function(theDeletedUser) {
* // do something
* },
* function(error) {
* // do something with the error response
* }
* );
*/
delete(callbacks?: { success(theDeletedUser: KiiUser): any; failure(theUser: KiiUser, anErrorString: string): any; }): Promise<KiiUser>;
/**
* Logs the currently logged-in user out of the KiiSDK
*
* @example
* KiiUser.logOut();
*/
static logOut(): void;
/**
* Checks to see if there is a user authenticated with the SDK
*
* @example
* if(KiiUser.loggedIn()) {
* // do something
* }
*/
static loggedIn(): boolean;
/**
* Find registered KiiUser with the email.<br>
* If there are no user registers with the specified email or if there are but not verified email yet,
* callbacks.failure or reject callback of promise will be called.<br>
* <br><br>
* <b>Note:</b>
* <ul>
* <li>If "Expose Full User Data To Others" is enabled in the application console, the response will contain full of the user data.</li>
* <li>Otherwise, the response will only contain "userID", "loginName" and "displayName" field values if exist.</li>
* </ul>
*
* @param email The email to find KiiUser who owns it.<br>
* Don't add prefix of "EMAIL:" described in REST API documentation. SDK will take care of it.
* @param callbacks An object with callback methods defined.
* This argument is mandatory and can't be ommited.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theMatchedUser). theMatchedUser is KiiUser instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* KiiUser.findUserByEmail("user_to_find@example.com", {
* success: function(theMatchedUser) {
* // Do something with the found user
* },
* failure: function(anErrorString) {
* // Do something with the error response
* }
* });
*
* // example to use Promise
* KiiUser.findUserByEmail("user_to_find@example.com").then(
* function(theMatchedUser) {
* // Do something with the matched user
* },
* function(error) {
* // Do something with the error response
* }
* );
*/
static findUserByEmail(email: string, callbacks?: { success(theMatchedUser: KiiUser): any; failure(anErrorString: string): any; }): Promise<KiiUser>;
/**
* Find registered KiiUser with the phone.<br>
* If there are no user registers with the specified phone or if there are but not verified phone yet,
* callbacks.failure or reject callback of promise will be called.
* <br><br>
* <b>Note:</b>
* <ul>
* <li>If "Expose Full User Data To Others" is enabled in the application console, the response will contain full of the user data.</li>
* <li>Otherwise, the response will only contain "userID", "loginName" and "displayName" field values if exist.</li>
* </ul>
*
* @param phone The phone number to find KiiUser who owns it.<br>
* Don't add prefix of "PHONE:" described in REST API documentation. SDK will take care of it.
* @param callbacks An object with callback methods defined.
* This argument is mandatory and can't be ommited.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theMatchedUser). theMatchedUser is KiiUser instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* KiiUser.findUserByPhone("phone_number_to_find", {
* success: function(theMatchedUser) {
* // Do something with the found user
* },
* failure: function(anErrorString) {
* // Do something with the error response
* }
* });
*
* // example to use Promise
* KiiUser.findUserByPhone("phone_number_to_find").then(
* function(theMatchedUser) {
* // Do something with the matched user
* },
* function(error) {
* // Do something with the error response
* }
* );
*/
static findUserByPhone(phone: string, callbacks?: { success(theMatchedUser: KiiUser): any; failure(anErrorString: string): any; }): Promise<KiiUser>;
/**
* Find registered KiiUser with the user name.<br>
* If there are no user registers with the specified user name, callbacks.failure or reject callback of promise will be called.
* <br><br>
* <b>Note:</b>
* <ul>
* <li>If "Expose Full User Data To Others" is enabled in the application console, the response will contain full of the user data.</li>
* <li>Otherwise, the response will only contain "userID", "loginName" and "displayName" field values if exist.</li>
* </ul>
*
* @param username The user name to find KiiUser who owns it.<br>
* Don't add prefix of "LOGIN_NAME:" described in REST API documentation. SDK will take care of it.
* @param callbacks An object with callback methods defined.
* This argument is mandatory and can't be ommited.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theMatchedUser). theMatchedUser is KiiUser instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* KiiUser.findUserByUsername("user_name_to_find", {
* success: function(theMatchedUser) {
* // Do something with the found user
* },
* failure: function(anErrorString) {
* // Do something with the error response
* }
* });
*
* // example to use Promise
* KiiUser.findUserByUsername("user_name_to_find").then(
* function(theMatchedUser) {
* // Do something with the matched user
* },
* function(error) {
* // Do something with the error response
* }
* );
*/
static findUserByUsername(username: string, callbacks?: { success(theMatchedUser: KiiUser): any; failure(anErrorString: string): any; }): Promise<KiiUser>;
/**
* Instantiate topic belongs to this user.
*
* @param topicName name of the topic. Must be a not empty string.
*
* @return topic instance.
*/
topicWithName(topicName: string): KiiTopic;
/**
* Gets a list of topics in this user scope
*
* @param callbacks An object with callback methods defined
* @param paginationKey You can specify the pagination key with the nextPaginationKey passed by callbacks.success. If empty string or no string object is provided, this API regards no paginationKey specified.
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(params). params is Array instance.
* <ul>
* <li>params[0] is array of KiiTopic instances.</li>
* <li>params[1] is string of nextPaginationKey.</li>
* </ul>
* </li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiUser instance which this method was called on. </li>
* <li>error.message</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var user = . . .; // a KiiUser
* user.listTopics({
* success: function(topicList, nextPaginationKey) {
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* user.listTopics({
* success: function(topicList, nextPaginationKey) {...},
* failure: function(anErrorString) {...}
* }, nextPaginationKey);
* }
* },
* failure: function(anErrorString) {
* // do something with the error response
* }
* });
*
* // example to use callbacks directly
* var user = . . .; // a KiiUser
* user.listTopics().then(
* function(params) {
* var topicList = params[0];
* var nextPaginationKey = params[1];
* // do something with the result
* for(var i=0; i<topicList.length; i++){
* var topic = topicList[i];
* }
* if (nextPaginationKey != null) {
* user.listTopics(null, nextPaginationKey).then(
* function(params) {...},
* function(error) {...}
* );
* }
* },
* function(error) {
* // do something with the error response
* }
* );
*/
listTopics(callbacks?: { success(topicList: KiiTopic[], nextPaginationKey: string): any; failure(anErrorString: string): any; }, paginationKey?: string): Promise<[KiiTopic[], string]>;
/**
* Instantiate push subscription for this user.
*
* @return push subscription object.
*/
pushSubscription(): KiiPushSubscription;
/**
* Instantiate push installation for this user.
*
* @return push installation object.
*/
pushInstallation(): KiiPushInstallation;
}
/**
* Represents a KiiUser builder
*/
export class KiiUserBuilder {
/**
* Create a KiiUser builder with identifier.
*
* <br><br>Create a KiiUser builder. This constructor is received
* identifier. The identifier is one of user name, email address or
* phone number. This constructor automatically identity What is
* identifier and build proper KiiUser object on build method.
*
* <br><br> Some strings can be accepted as both user name and phone
* number. If such string is passed to this constructor as
* identifier, then phone number is prior to user name. String of
* email address is in different class against user name and phone
* number. So Email address is always identified correctly.
*
* @param identifier The user's user name, email address or phone
* number. Must be string. Must not be null or undefined.
* @param password for the user. Must be string. Must not be null or
* undefined.
*
* @return KiiUser object builder.
*
* @throws If Identifier is not user name,
* email address or phone number.
* @throws If the password is not in the
* proper format
*/
static builderWithIdentifier(identifier: string, password: string): KiiUserBuilder;
/**
* Create KiiUser builder with email address
*
* <br><br>Create a KiiUser builder with email address.
*
* @param emailAddress email address.
* @param password for the user. Must be string. Must not be null or
* undefined.
*
* @return KiiUser object builder.
*
* @throws If the email address is not in the proper format
* @throws If the password is not in the
* proper format
*/
static builderWithEmailAddress(emailAddress: string, password: string): KiiUserBuilder;
/**
* Create KiiUser builder with global phone number
*
* <br><br>Create a KiiUser builder with global phone number.
*
* @param phoneNumber global phone number.
* @param password
*
* @return KiiUser object builder.
*
* @throws If the phone number is not in the proper format
*/
static builderWithGlobalPhoneNumber(phoneNumber: string, password: string): KiiUserBuilder;
/**
* Create KiiUser builder with local phone number
*
* <br><br>Create a KiiUser builder with local phone number.
*
* @param phoneNumber local phone number.
* @param country country code
* @param password for the user. Must be string. Must not be null or
* undefined.
*
* @return KiiUser object builder.
*
* @throws If the phone number is not in the proper format
* @throws If the country code is not a valid format
* @throws If the password is not in the
* proper format
*/
static builderWithLocalPhoneNumber(phoneNumber: string, country: string, password: string): KiiUserBuilder;
/**
* Create KiiUser builder with user name
*
* <br><br>Create a KiiUser builder with user name.
*
* @param username user name.
* @param password for the user. Must be string. Must not be null or
* undefined.
*
* @return KiiUser object builder.
*
* @throws If the username is not in the proper format
* @throws If the password is not in the
* proper format
*/
static builderWithUsername(username: string, password: string): KiiUserBuilder;
/**
* Set user name.
*
* <br><br>Set user name. If null or undefined is passed. It is
* ignored. Previous user name is remained.
*
* @param username user name.
*
* @return this builder object.
*
* @throws If the username is not in the
* proper format
*/
setUsername(username: string): KiiUserBuilder;
/**
* Set email address.
*
* <br><br>Set email address. If null or undefined is passed. It is
* ignored. Previous email address is remained.
*
* @param emailAddress email address.
*
* @return this builder object.
*
* @throws If the email address is not in the
* proper format
*/
setEmailAddress(emailAddress: string): KiiUserBuilder;
/**
* Set global phone number.
*
* <br><br>Set global phone number. If null or undefined is
* passed. It is ignored. Previous phone number is remained.
*
* @param phoneNumber global phone number.
*
* @return this builder object.
*
* @throws If the phone number is not
* in the proper format
*/
setGlobalPhoneNumber(phoneNumber: string): KiiUserBuilder;
/**
* Set local phone number.
*
* <br><br>Set local phone number. If null or undefined is
* passed. It is ignored. Previous phone number is remained.
*
* @param phoneNumber local phone number.
* @param country country code
*
* @return this builder object.
*
* @throws If the phone number is not
* in the proper format
* @throws If the country code is not a valid format
*/
setLocalPhoneNumber(phoneNumber: string, country: string): KiiUserBuilder;
/**
* Build KiiUser object.
*
* <br><br> Build KiiUser object. This method verify set values.
*
* @return a working KiiUser object.
*/
build(): KiiUser;
}
}
import KiiACLAction = KiiCloud.KiiACLAction;
import KiiSite = KiiCloud.KiiSite;
import KiiAnalyticsSite = KiiCloud.KiiAnalyticsSite;
import KiiSocialNetworkName = KiiCloud.KiiSocialNetworkName;
import Kii = KiiCloud.Kii;
import KiiACL = KiiCloud.KiiACL;
import KiiACLEntry = KiiCloud.KiiACLEntry;
import KiiAnalytics = KiiCloud.KiiAnalytics;
import KiiAnonymousUser = KiiCloud.KiiAnonymousUser;
import KiiAnyAuthenticatedUser = KiiCloud.KiiAnyAuthenticatedUser;
import KiiAppAdminContext = KiiCloud.KiiAppAdminContext;
import KiiBucket = KiiCloud.KiiBucket;
import KiiClause = KiiCloud.KiiClause;
import KiiGeoPoint = KiiCloud.KiiGeoPoint;
import KiiGroup = KiiCloud.KiiGroup;
import KiiObject = KiiCloud.KiiObject;
import KiiPushInstallation = KiiCloud.KiiPushInstallation;
import KiiPushMessageBuilder = KiiCloud.KiiPushMessageBuilder;
import KiiPushSubscription = KiiCloud.KiiPushSubscription;
import KiiQuery = KiiCloud.KiiQuery;
import KiiServerCodeEntry = KiiCloud.KiiServerCodeEntry;
import KiiServerCodeExecResult = KiiCloud.KiiServerCodeExecResult;
import KiiSocialConnect = KiiCloud.KiiSocialConnect;
import KiiThing = KiiCloud.KiiThing;
import KiiThingContext = KiiCloud.KiiThingContext;
import KiiTopic = KiiCloud.KiiTopic;
import KiiUser = KiiCloud.KiiUser;
import KiiUserBuilder = KiiCloud.KiiUserBuilder;
| florentpoujol/DefinitelyTyped | kii-cloud-sdk/kii-cloud-sdk.d.ts | TypeScript | mit | 340,305 |
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the COPYING file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS. All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.
// -----------------------------------------------------------------------------
//
// Coding of token probabilities, intra modes and segments.
//
// Author: Skal (pascal.massimino@gmail.com)
#include "./vp8i_enc.h"
//------------------------------------------------------------------------------
// Default probabilities
// Paragraph 13.5
const uint8_t
VP8CoeffsProba0[NUM_TYPES][NUM_BANDS][NUM_CTX][NUM_PROBAS] = {
{ { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }
},
{ { 253, 136, 254, 255, 228, 219, 128, 128, 128, 128, 128 },
{ 189, 129, 242, 255, 227, 213, 255, 219, 128, 128, 128 },
{ 106, 126, 227, 252, 214, 209, 255, 255, 128, 128, 128 }
},
{ { 1, 98, 248, 255, 236, 226, 255, 255, 128, 128, 128 },
{ 181, 133, 238, 254, 221, 234, 255, 154, 128, 128, 128 },
{ 78, 134, 202, 247, 198, 180, 255, 219, 128, 128, 128 },
},
{ { 1, 185, 249, 255, 243, 255, 128, 128, 128, 128, 128 },
{ 184, 150, 247, 255, 236, 224, 128, 128, 128, 128, 128 },
{ 77, 110, 216, 255, 236, 230, 128, 128, 128, 128, 128 },
},
{ { 1, 101, 251, 255, 241, 255, 128, 128, 128, 128, 128 },
{ 170, 139, 241, 252, 236, 209, 255, 255, 128, 128, 128 },
{ 37, 116, 196, 243, 228, 255, 255, 255, 128, 128, 128 }
},
{ { 1, 204, 254, 255, 245, 255, 128, 128, 128, 128, 128 },
{ 207, 160, 250, 255, 238, 128, 128, 128, 128, 128, 128 },
{ 102, 103, 231, 255, 211, 171, 128, 128, 128, 128, 128 }
},
{ { 1, 152, 252, 255, 240, 255, 128, 128, 128, 128, 128 },
{ 177, 135, 243, 255, 234, 225, 128, 128, 128, 128, 128 },
{ 80, 129, 211, 255, 194, 224, 128, 128, 128, 128, 128 }
},
{ { 1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 246, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 255, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }
}
},
{ { { 198, 35, 237, 223, 193, 187, 162, 160, 145, 155, 62 },
{ 131, 45, 198, 221, 172, 176, 220, 157, 252, 221, 1 },
{ 68, 47, 146, 208, 149, 167, 221, 162, 255, 223, 128 }
},
{ { 1, 149, 241, 255, 221, 224, 255, 255, 128, 128, 128 },
{ 184, 141, 234, 253, 222, 220, 255, 199, 128, 128, 128 },
{ 81, 99, 181, 242, 176, 190, 249, 202, 255, 255, 128 }
},
{ { 1, 129, 232, 253, 214, 197, 242, 196, 255, 255, 128 },
{ 99, 121, 210, 250, 201, 198, 255, 202, 128, 128, 128 },
{ 23, 91, 163, 242, 170, 187, 247, 210, 255, 255, 128 }
},
{ { 1, 200, 246, 255, 234, 255, 128, 128, 128, 128, 128 },
{ 109, 178, 241, 255, 231, 245, 255, 255, 128, 128, 128 },
{ 44, 130, 201, 253, 205, 192, 255, 255, 128, 128, 128 }
},
{ { 1, 132, 239, 251, 219, 209, 255, 165, 128, 128, 128 },
{ 94, 136, 225, 251, 218, 190, 255, 255, 128, 128, 128 },
{ 22, 100, 174, 245, 186, 161, 255, 199, 128, 128, 128 }
},
{ { 1, 182, 249, 255, 232, 235, 128, 128, 128, 128, 128 },
{ 124, 143, 241, 255, 227, 234, 128, 128, 128, 128, 128 },
{ 35, 77, 181, 251, 193, 211, 255, 205, 128, 128, 128 }
},
{ { 1, 157, 247, 255, 236, 231, 255, 255, 128, 128, 128 },
{ 121, 141, 235, 255, 225, 227, 255, 255, 128, 128, 128 },
{ 45, 99, 188, 251, 195, 217, 255, 224, 128, 128, 128 }
},
{ { 1, 1, 251, 255, 213, 255, 128, 128, 128, 128, 128 },
{ 203, 1, 248, 255, 255, 128, 128, 128, 128, 128, 128 },
{ 137, 1, 177, 255, 224, 255, 128, 128, 128, 128, 128 }
}
},
{ { { 253, 9, 248, 251, 207, 208, 255, 192, 128, 128, 128 },
{ 175, 13, 224, 243, 193, 185, 249, 198, 255, 255, 128 },
{ 73, 17, 171, 221, 161, 179, 236, 167, 255, 234, 128 }
},
{ { 1, 95, 247, 253, 212, 183, 255, 255, 128, 128, 128 },
{ 239, 90, 244, 250, 211, 209, 255, 255, 128, 128, 128 },
{ 155, 77, 195, 248, 188, 195, 255, 255, 128, 128, 128 }
},
{ { 1, 24, 239, 251, 218, 219, 255, 205, 128, 128, 128 },
{ 201, 51, 219, 255, 196, 186, 128, 128, 128, 128, 128 },
{ 69, 46, 190, 239, 201, 218, 255, 228, 128, 128, 128 }
},
{ { 1, 191, 251, 255, 255, 128, 128, 128, 128, 128, 128 },
{ 223, 165, 249, 255, 213, 255, 128, 128, 128, 128, 128 },
{ 141, 124, 248, 255, 255, 128, 128, 128, 128, 128, 128 }
},
{ { 1, 16, 248, 255, 255, 128, 128, 128, 128, 128, 128 },
{ 190, 36, 230, 255, 236, 255, 128, 128, 128, 128, 128 },
{ 149, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 }
},
{ { 1, 226, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 247, 192, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 240, 128, 255, 128, 128, 128, 128, 128, 128, 128, 128 }
},
{ { 1, 134, 252, 255, 255, 128, 128, 128, 128, 128, 128 },
{ 213, 62, 250, 255, 255, 128, 128, 128, 128, 128, 128 },
{ 55, 93, 255, 128, 128, 128, 128, 128, 128, 128, 128 }
},
{ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }
}
},
{ { { 202, 24, 213, 235, 186, 191, 220, 160, 240, 175, 255 },
{ 126, 38, 182, 232, 169, 184, 228, 174, 255, 187, 128 },
{ 61, 46, 138, 219, 151, 178, 240, 170, 255, 216, 128 }
},
{ { 1, 112, 230, 250, 199, 191, 247, 159, 255, 255, 128 },
{ 166, 109, 228, 252, 211, 215, 255, 174, 128, 128, 128 },
{ 39, 77, 162, 232, 172, 180, 245, 178, 255, 255, 128 }
},
{ { 1, 52, 220, 246, 198, 199, 249, 220, 255, 255, 128 },
{ 124, 74, 191, 243, 183, 193, 250, 221, 255, 255, 128 },
{ 24, 71, 130, 219, 154, 170, 243, 182, 255, 255, 128 }
},
{ { 1, 182, 225, 249, 219, 240, 255, 224, 128, 128, 128 },
{ 149, 150, 226, 252, 216, 205, 255, 171, 128, 128, 128 },
{ 28, 108, 170, 242, 183, 194, 254, 223, 255, 255, 128 }
},
{ { 1, 81, 230, 252, 204, 203, 255, 192, 128, 128, 128 },
{ 123, 102, 209, 247, 188, 196, 255, 233, 128, 128, 128 },
{ 20, 95, 153, 243, 164, 173, 255, 203, 128, 128, 128 }
},
{ { 1, 222, 248, 255, 216, 213, 128, 128, 128, 128, 128 },
{ 168, 175, 246, 252, 235, 205, 255, 255, 128, 128, 128 },
{ 47, 116, 215, 255, 211, 212, 255, 255, 128, 128, 128 }
},
{ { 1, 121, 236, 253, 212, 214, 255, 255, 128, 128, 128 },
{ 141, 84, 213, 252, 201, 202, 255, 219, 128, 128, 128 },
{ 42, 80, 160, 240, 162, 185, 255, 205, 128, 128, 128 }
},
{ { 1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 244, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 238, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 }
}
}
};
void VP8DefaultProbas(VP8Encoder* const enc) {
VP8EncProba* const probas = &enc->proba_;
probas->use_skip_proba_ = 0;
memset(probas->segments_, 255u, sizeof(probas->segments_));
memcpy(probas->coeffs_, VP8CoeffsProba0, sizeof(VP8CoeffsProba0));
// Note: we could hard-code the level_costs_ corresponding to VP8CoeffsProba0,
// but that's ~11k of static data. Better call VP8CalculateLevelCosts() later.
probas->dirty_ = 1;
}
// Paragraph 11.5. 900bytes.
static const uint8_t kBModesProba[NUM_BMODES][NUM_BMODES][NUM_BMODES - 1] = {
{ { 231, 120, 48, 89, 115, 113, 120, 152, 112 },
{ 152, 179, 64, 126, 170, 118, 46, 70, 95 },
{ 175, 69, 143, 80, 85, 82, 72, 155, 103 },
{ 56, 58, 10, 171, 218, 189, 17, 13, 152 },
{ 114, 26, 17, 163, 44, 195, 21, 10, 173 },
{ 121, 24, 80, 195, 26, 62, 44, 64, 85 },
{ 144, 71, 10, 38, 171, 213, 144, 34, 26 },
{ 170, 46, 55, 19, 136, 160, 33, 206, 71 },
{ 63, 20, 8, 114, 114, 208, 12, 9, 226 },
{ 81, 40, 11, 96, 182, 84, 29, 16, 36 } },
{ { 134, 183, 89, 137, 98, 101, 106, 165, 148 },
{ 72, 187, 100, 130, 157, 111, 32, 75, 80 },
{ 66, 102, 167, 99, 74, 62, 40, 234, 128 },
{ 41, 53, 9, 178, 241, 141, 26, 8, 107 },
{ 74, 43, 26, 146, 73, 166, 49, 23, 157 },
{ 65, 38, 105, 160, 51, 52, 31, 115, 128 },
{ 104, 79, 12, 27, 217, 255, 87, 17, 7 },
{ 87, 68, 71, 44, 114, 51, 15, 186, 23 },
{ 47, 41, 14, 110, 182, 183, 21, 17, 194 },
{ 66, 45, 25, 102, 197, 189, 23, 18, 22 } },
{ { 88, 88, 147, 150, 42, 46, 45, 196, 205 },
{ 43, 97, 183, 117, 85, 38, 35, 179, 61 },
{ 39, 53, 200, 87, 26, 21, 43, 232, 171 },
{ 56, 34, 51, 104, 114, 102, 29, 93, 77 },
{ 39, 28, 85, 171, 58, 165, 90, 98, 64 },
{ 34, 22, 116, 206, 23, 34, 43, 166, 73 },
{ 107, 54, 32, 26, 51, 1, 81, 43, 31 },
{ 68, 25, 106, 22, 64, 171, 36, 225, 114 },
{ 34, 19, 21, 102, 132, 188, 16, 76, 124 },
{ 62, 18, 78, 95, 85, 57, 50, 48, 51 } },
{ { 193, 101, 35, 159, 215, 111, 89, 46, 111 },
{ 60, 148, 31, 172, 219, 228, 21, 18, 111 },
{ 112, 113, 77, 85, 179, 255, 38, 120, 114 },
{ 40, 42, 1, 196, 245, 209, 10, 25, 109 },
{ 88, 43, 29, 140, 166, 213, 37, 43, 154 },
{ 61, 63, 30, 155, 67, 45, 68, 1, 209 },
{ 100, 80, 8, 43, 154, 1, 51, 26, 71 },
{ 142, 78, 78, 16, 255, 128, 34, 197, 171 },
{ 41, 40, 5, 102, 211, 183, 4, 1, 221 },
{ 51, 50, 17, 168, 209, 192, 23, 25, 82 } },
{ { 138, 31, 36, 171, 27, 166, 38, 44, 229 },
{ 67, 87, 58, 169, 82, 115, 26, 59, 179 },
{ 63, 59, 90, 180, 59, 166, 93, 73, 154 },
{ 40, 40, 21, 116, 143, 209, 34, 39, 175 },
{ 47, 15, 16, 183, 34, 223, 49, 45, 183 },
{ 46, 17, 33, 183, 6, 98, 15, 32, 183 },
{ 57, 46, 22, 24, 128, 1, 54, 17, 37 },
{ 65, 32, 73, 115, 28, 128, 23, 128, 205 },
{ 40, 3, 9, 115, 51, 192, 18, 6, 223 },
{ 87, 37, 9, 115, 59, 77, 64, 21, 47 } },
{ { 104, 55, 44, 218, 9, 54, 53, 130, 226 },
{ 64, 90, 70, 205, 40, 41, 23, 26, 57 },
{ 54, 57, 112, 184, 5, 41, 38, 166, 213 },
{ 30, 34, 26, 133, 152, 116, 10, 32, 134 },
{ 39, 19, 53, 221, 26, 114, 32, 73, 255 },
{ 31, 9, 65, 234, 2, 15, 1, 118, 73 },
{ 75, 32, 12, 51, 192, 255, 160, 43, 51 },
{ 88, 31, 35, 67, 102, 85, 55, 186, 85 },
{ 56, 21, 23, 111, 59, 205, 45, 37, 192 },
{ 55, 38, 70, 124, 73, 102, 1, 34, 98 } },
{ { 125, 98, 42, 88, 104, 85, 117, 175, 82 },
{ 95, 84, 53, 89, 128, 100, 113, 101, 45 },
{ 75, 79, 123, 47, 51, 128, 81, 171, 1 },
{ 57, 17, 5, 71, 102, 57, 53, 41, 49 },
{ 38, 33, 13, 121, 57, 73, 26, 1, 85 },
{ 41, 10, 67, 138, 77, 110, 90, 47, 114 },
{ 115, 21, 2, 10, 102, 255, 166, 23, 6 },
{ 101, 29, 16, 10, 85, 128, 101, 196, 26 },
{ 57, 18, 10, 102, 102, 213, 34, 20, 43 },
{ 117, 20, 15, 36, 163, 128, 68, 1, 26 } },
{ { 102, 61, 71, 37, 34, 53, 31, 243, 192 },
{ 69, 60, 71, 38, 73, 119, 28, 222, 37 },
{ 68, 45, 128, 34, 1, 47, 11, 245, 171 },
{ 62, 17, 19, 70, 146, 85, 55, 62, 70 },
{ 37, 43, 37, 154, 100, 163, 85, 160, 1 },
{ 63, 9, 92, 136, 28, 64, 32, 201, 85 },
{ 75, 15, 9, 9, 64, 255, 184, 119, 16 },
{ 86, 6, 28, 5, 64, 255, 25, 248, 1 },
{ 56, 8, 17, 132, 137, 255, 55, 116, 128 },
{ 58, 15, 20, 82, 135, 57, 26, 121, 40 } },
{ { 164, 50, 31, 137, 154, 133, 25, 35, 218 },
{ 51, 103, 44, 131, 131, 123, 31, 6, 158 },
{ 86, 40, 64, 135, 148, 224, 45, 183, 128 },
{ 22, 26, 17, 131, 240, 154, 14, 1, 209 },
{ 45, 16, 21, 91, 64, 222, 7, 1, 197 },
{ 56, 21, 39, 155, 60, 138, 23, 102, 213 },
{ 83, 12, 13, 54, 192, 255, 68, 47, 28 },
{ 85, 26, 85, 85, 128, 128, 32, 146, 171 },
{ 18, 11, 7, 63, 144, 171, 4, 4, 246 },
{ 35, 27, 10, 146, 174, 171, 12, 26, 128 } },
{ { 190, 80, 35, 99, 180, 80, 126, 54, 45 },
{ 85, 126, 47, 87, 176, 51, 41, 20, 32 },
{ 101, 75, 128, 139, 118, 146, 116, 128, 85 },
{ 56, 41, 15, 176, 236, 85, 37, 9, 62 },
{ 71, 30, 17, 119, 118, 255, 17, 18, 138 },
{ 101, 38, 60, 138, 55, 70, 43, 26, 142 },
{ 146, 36, 19, 30, 171, 255, 97, 27, 20 },
{ 138, 45, 61, 62, 219, 1, 81, 188, 64 },
{ 32, 41, 20, 117, 151, 142, 20, 21, 163 },
{ 112, 19, 12, 61, 195, 128, 48, 4, 24 } }
};
static int PutI4Mode(VP8BitWriter* const bw, int mode,
const uint8_t* const prob) {
if (VP8PutBit(bw, mode != B_DC_PRED, prob[0])) {
if (VP8PutBit(bw, mode != B_TM_PRED, prob[1])) {
if (VP8PutBit(bw, mode != B_VE_PRED, prob[2])) {
if (!VP8PutBit(bw, mode >= B_LD_PRED, prob[3])) {
if (VP8PutBit(bw, mode != B_HE_PRED, prob[4])) {
VP8PutBit(bw, mode != B_RD_PRED, prob[5]);
}
} else {
if (VP8PutBit(bw, mode != B_LD_PRED, prob[6])) {
if (VP8PutBit(bw, mode != B_VL_PRED, prob[7])) {
VP8PutBit(bw, mode != B_HD_PRED, prob[8]);
}
}
}
}
}
}
return mode;
}
static void PutI16Mode(VP8BitWriter* const bw, int mode) {
if (VP8PutBit(bw, (mode == TM_PRED || mode == H_PRED), 156)) {
VP8PutBit(bw, mode == TM_PRED, 128); // TM or HE
} else {
VP8PutBit(bw, mode == V_PRED, 163); // VE or DC
}
}
static void PutUVMode(VP8BitWriter* const bw, int uv_mode) {
if (VP8PutBit(bw, uv_mode != DC_PRED, 142)) {
if (VP8PutBit(bw, uv_mode != V_PRED, 114)) {
VP8PutBit(bw, uv_mode != H_PRED, 183); // else: TM_PRED
}
}
}
static void PutSegment(VP8BitWriter* const bw, int s, const uint8_t* p) {
if (VP8PutBit(bw, s >= 2, p[0])) p += 1;
VP8PutBit(bw, s & 1, p[1]);
}
void VP8CodeIntraModes(VP8Encoder* const enc) {
VP8BitWriter* const bw = &enc->bw_;
VP8EncIterator it;
VP8IteratorInit(enc, &it);
do {
const VP8MBInfo* const mb = it.mb_;
const uint8_t* preds = it.preds_;
if (enc->segment_hdr_.update_map_) {
PutSegment(bw, mb->segment_, enc->proba_.segments_);
}
if (enc->proba_.use_skip_proba_) {
VP8PutBit(bw, mb->skip_, enc->proba_.skip_proba_);
}
if (VP8PutBit(bw, (mb->type_ != 0), 145)) { // i16x16
PutI16Mode(bw, preds[0]);
} else {
const int preds_w = enc->preds_w_;
const uint8_t* top_pred = preds - preds_w;
int x, y;
for (y = 0; y < 4; ++y) {
int left = preds[-1];
for (x = 0; x < 4; ++x) {
const uint8_t* const probas = kBModesProba[top_pred[x]][left];
left = PutI4Mode(bw, preds[x], probas);
}
top_pred = preds;
preds += preds_w;
}
}
PutUVMode(bw, mb->uv_mode_);
} while (VP8IteratorNext(&it));
}
//------------------------------------------------------------------------------
// Paragraph 13
const uint8_t
VP8CoeffsUpdateProba[NUM_TYPES][NUM_BANDS][NUM_CTX][NUM_PROBAS] = {
{ { { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255 },
{ 250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255 },
{ 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
}
},
{ { { 217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255 },
{ 234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255 }
},
{ { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
}
},
{ { { 186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255 },
{ 251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255 }
},
{ { 255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
}
},
{ { { 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255 },
{ 248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
},
{ { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
{ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }
}
}
};
void VP8WriteProbas(VP8BitWriter* const bw, const VP8EncProba* const probas) {
int t, b, c, p;
for (t = 0; t < NUM_TYPES; ++t) {
for (b = 0; b < NUM_BANDS; ++b) {
for (c = 0; c < NUM_CTX; ++c) {
for (p = 0; p < NUM_PROBAS; ++p) {
const uint8_t p0 = probas->coeffs_[t][b][c][p];
const int update = (p0 != VP8CoeffsProba0[t][b][c][p]);
if (VP8PutBit(bw, update, VP8CoeffsUpdateProba[t][b][c][p])) {
VP8PutBits(bw, p0, 8);
}
}
}
}
}
if (VP8PutBitUniform(bw, probas->use_skip_proba_)) {
VP8PutBits(bw, probas->skip_proba_, 8);
}
}
| FateAce/godot | thirdparty/libwebp/enc/tree_enc.c | C | mit | 22,000 |
<?php
/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_Storage_BucketLogging extends Google_Model
{
public $logBucket;
public $logObjectPrefix;
public function setLogBucket($logBucket)
{
$this->logBucket = $logBucket;
}
public function getLogBucket()
{
return $this->logBucket;
}
public function setLogObjectPrefix($logObjectPrefix)
{
$this->logObjectPrefix = $logObjectPrefix;
}
public function getLogObjectPrefix()
{
return $this->logObjectPrefix;
}
}
| SkyPressATX/bmo-google-oauth2 | vendor/google-api-php-client/vendor/google/apiclient-services/src/Google/Service/Storage/BucketLogging.php | PHP | mit | 1,063 |
/*
* knockout-kendo 0.9.6
* Copyright © 2015 Ryan Niemeyer & Telerik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
;(function(factory) {
// CommonJS
if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
factory(require('knockout'), require('jquery'), require('kendo'));
// AMD
} else if (typeof define === 'function' && define.amd) {
define(['knockout', 'jquery', 'kendo'], factory);
// Normal script tag
} else {
factory(window.ko, window.jQuery, window.kendo);
}
}(function(ko, $, kendo, undefined) {
//handle require.js scenarios where kendo is not actually returned
kendo = kendo || window.kendo;
ko.kendo = ko.kendo || {};
var unwrap = ko.utils.unwrapObservable; //support older 2.x KO where ko.unwrap was not defined
ko.kendo.BindingFactory = function() {
var self = this;
this.createBinding = function(widgetConfig) {
//only support widgets that are available when this script runs
if (!$()[widgetConfig.parent || widgetConfig.name]) {
return;
}
var binding = {};
//the binding handler's init function
binding.init = function(element, valueAccessor, all, vm, context) {
//step 1: build appropriate options for the widget from values passed in and global options
var options = self.buildOptions(widgetConfig, valueAccessor);
//apply async, so inner templates can finish content needed during widget initialization
if (options.async === true || (widgetConfig.async === true && options.async !== false)) {
setTimeout(function() {
binding.setup(element, options, context);
}, 0);
return;
}
binding.setup(element, options, context);
if (options && options.useKOTemplates) {
return { controlsDescendantBindings: true };
}
};
//build the core logic for the init function
binding.setup = function(element, options, context) {
var widget, $element = $(element);
//step 2: setup templates
self.setupTemplates(widgetConfig.templates, options, element, context);
//step 3: initialize widget
widget = self.getWidget(widgetConfig, options, $element);
//step 4: add handlers for events that we need to react to for updating the model
self.handleEvents(options, widgetConfig, element, widget, context);
//step 5: set up computed observables to update the widget when observable model values change
self.watchValues(widget, options, widgetConfig, element);
//step 6: handle disposal, if there is a destroy method on the widget
if (widget.destroy) {
ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
if (widget.element) {
if (typeof kendo.destroy === "function") {
kendo.destroy(widget.element);
} else {
widget.destroy();
}
}
});
}
};
binding.options = {}; //global options
binding.widgetConfig = widgetConfig; //expose the options to use in generating tests
ko.bindingHandlers[widgetConfig.bindingName || widgetConfig.name] = binding;
};
//combine options passed in binding with global options
this.buildOptions = function(widgetConfig, valueAccessor) {
var defaultOption = widgetConfig.defaultOption,
options = ko.utils.extend({}, ko.bindingHandlers[widgetConfig.name].options),
valueOrOptions = unwrap(valueAccessor());
if (valueOrOptions instanceof kendo.data.DataSource || typeof valueOrOptions !== "object" || valueOrOptions === null || (defaultOption && !(defaultOption in valueOrOptions))) {
options[defaultOption] = valueAccessor();
} else {
ko.utils.extend(options, valueOrOptions);
}
return options;
};
var templateRenderer = function(id, context) {
return function(data) {
return ko.renderTemplate(id, context.createChildContext((data._raw && data._raw()) || data));
};
};
//prepare templates, if the widget uses them
this.setupTemplates = function(templateConfig, options, element, context) {
var i, j, option, existingHandler;
if (templateConfig && options && options.useKOTemplates) {
//create a function to render each configured template
for (i = 0, j = templateConfig.length; i < j; i++) {
option = templateConfig[i];
if (options[option]) {
options[option] = templateRenderer(options[option], context);
}
}
//initialize bindings in dataBound event
existingHandler = options.dataBound;
options.dataBound = function() {
ko.memoization.unmemoizeDomNodeAndDescendants(element);
if (existingHandler) {
existingHandler.apply(this, arguments);
}
};
}
};
//unless the object is a kendo datasource, get a clean object with one level unwrapped
this.unwrapOneLevel = function(object) {
var prop,
result = {};
if (object) {
if (object instanceof kendo.data.DataSource) {
result = object;
}
else if (typeof object === "object") {
for (prop in object) {
//include things on prototype
result[prop] = unwrap(object[prop]);
}
}
}
return result;
};
//return the actual widget
this.getWidget = function(widgetConfig, options, $element) {
var widget;
if (widgetConfig.parent) {
//locate the actual widget
var parent = $element.closest("[data-bind*='" + widgetConfig.parent + ":']");
widget = parent.length ? parent.data(widgetConfig.parent) : null;
} else {
widget = $element[widgetConfig.name](this.unwrapOneLevel(options)).data(widgetConfig.name);
}
//if the widget option was specified, then fill it with our widget
if (ko.isObservable(options.widget)) {
options.widget(widget);
}
return widget;
};
//respond to changes in the view model
this.watchValues = function(widget, options, widgetConfig, element) {
var watchProp, watchValues = widgetConfig.watch;
if (watchValues) {
for (watchProp in watchValues) {
if (watchValues.hasOwnProperty(watchProp)) {
self.watchOneValue(watchProp, widget, options, widgetConfig, element);
}
}
}
};
this.watchOneValue = function(prop, widget, options, widgetConfig, element) {
var computed = ko.computed({
read: function() {
var existing, custom,
action = widgetConfig.watch[prop],
value = unwrap(options[prop]),
params = widgetConfig.parent ? [element] : []; //child bindings pass element first to APIs
//support passing multiple events like ["open", "close"]
if ($.isArray(action)) {
action = widget[value ? action[0] : action[1]];
} else if (typeof action === "string") {
action = widget[action];
} else {
custom = true; //running a custom function
}
if (action && options[prop] !== undefined) {
if (!custom) {
existing = action.apply(widget, params);
params.push(value);
} else {
params.push(value, options);
}
//try to avoid unnecessary updates when the new value matches the current value
if (custom || existing !== value) {
action.apply(widget, params);
}
}
},
disposeWhenNodeIsRemoved: element
}).extend({ throttle: (options.throttle || options.throttle === 0) ? options.throttle : 1 });
//if option is not observable, then dispose up front after executing the logic once
if (!ko.isObservable(options[prop])) {
computed.dispose();
}
};
//write changes to the widgets back to the model
this.handleEvents = function(options, widgetConfig, element, widget, context) {
var prop, eventConfig, events = widgetConfig.events;
if (events) {
for (prop in events) {
if (events.hasOwnProperty(prop)) {
eventConfig = events[prop];
if (typeof eventConfig === "string") {
eventConfig = { value: eventConfig, writeTo: eventConfig };
}
self.handleOneEvent(prop, eventConfig, options, element, widget, widgetConfig.childProp, context);
}
}
}
};
//bind to a single event
this.handleOneEvent = function(eventName, eventConfig, options, element, widget, childProp, context) {
var handler = typeof eventConfig === "function" ? eventConfig : options[eventConfig.call];
//call a function defined directly in the binding definition, supply options that were passed to the binding
if (typeof eventConfig === "function") {
handler = handler.bind(context.$data, options);
}
//use function passed in binding options as handler with normal KO args
else if (eventConfig.call && typeof options[eventConfig.call] === "function") {
handler = options[eventConfig.call].bind(context.$data, context.$data);
}
//option is observable, determine what to write to it
else if (eventConfig.writeTo && ko.isWriteableObservable(options[eventConfig.writeTo])) {
handler = function(e) {
var propOrValue, value;
if (!childProp || !e[childProp] || e[childProp] === element) {
propOrValue = eventConfig.value;
value = (typeof propOrValue === "string" && this[propOrValue]) ? this[propOrValue](childProp && element) : propOrValue;
options[eventConfig.writeTo](value);
}
};
}
if (handler) {
widget.bind(eventName, handler);
}
};
};
ko.kendo.bindingFactory = new ko.kendo.BindingFactory();
//utility to set the dataSource with a clean copy of data. Could be overridden at run-time.
ko.kendo.setDataSource = function(widget, data, options) {
var isMapped, cleanData;
if (data instanceof kendo.data.DataSource) {
widget.setDataSource(data);
return;
}
if (!options || !options.useKOTemplates) {
isMapped = ko.mapping && data && data.__ko_mapping__;
cleanData = data && isMapped ? ko.mapping.toJS(data) : ko.toJS(data);
}
widget.dataSource.data(cleanData || data);
};
//attach the raw data after Kendo wraps our items
(function() {
var existing = kendo.data.ObservableArray.fn.wrap;
kendo.data.ObservableArray.fn.wrap = function(object) {
var result = existing.apply(this, arguments);
result._raw = function() {
return object;
};
return result;
};
})();
//private utility function generator for gauges
var extendAndRedraw = function(prop) {
return function(value) {
if (value) {
ko.utils.extend(this.options[prop], value);
this.redraw();
this.value(0.001 + this.value());
}
};
};
var openIfVisible = function(value, options) {
if (!value) {
//causes issues with event triggering, if closing programmatically, when unnecessary
if (this.element.parent().is(":visible")) {
this.close();
}
} else {
this.open(typeof options.target === "string" ? $(unwrap(options.target)) : options.target);
}
};
//library is in a closure, use this private variable to reduce size of minified file
var createBinding = ko.kendo.bindingFactory.createBinding.bind(ko.kendo.bindingFactory);
//use constants to ensure consistency and to help reduce minified file size
var CLICK = "click",
CENTER = "center",
CHECK = "check",
CHECKED = "checked",
CLICKED = "clicked",
CLOSE = "close",
COLLAPSE = "collapse",
CONTENT = "content",
DATA = "data",
DATE = "date",
DISABLE = "disable",
ENABLE = "enable",
EXPAND = "expand",
ENABLED = "enabled",
EXPANDED = "expanded",
ERROR = "error",
FILTER = "filter",
HIDE = "hide",
INFO = "info",
ISOPEN = "isOpen",
ITEMS = "items",
MAX = "max",
MIN = "min",
OPEN = "open",
PALETTE = "palette",
READONLY = "readonly",
RESIZE = "resize",
SCROLLTO = "scrollTo",
SEARCH = "search",
SELECT = "select",
SELECTED = "selected",
SELECTEDINDEX = "selectedIndex",
SHOW = "show",
SIZE = "size",
SUCCESS = "success",
TARGET = "target",
TITLE = "title",
VALUE = "value",
VALUES = "values",
WARNING = "warning",
ZOOM = "zoom";
createBinding({
name: "kendoAutoComplete",
events: {
change: VALUE,
open: {
writeTo: ISOPEN,
value: true
},
close: {
writeTo: ISOPEN,
value: false
}
},
watch: {
enabled: ENABLE,
search: [SEARCH, CLOSE],
data: function(value) {
ko.kendo.setDataSource(this, value);
},
value: VALUE
}
});
createBinding({
name: "kendoButton",
defaultOption: CLICKED,
events: {
click: {
call: CLICKED
}
},
watch: {
enabled: ENABLE
}
});
createBinding({
name: "kendoCalendar",
defaultOption: VALUE,
events: {
change: VALUE
},
watch: {
max: MAX,
min: MIN,
value: VALUE
}
});
createBinding({
name: "kendoColorPicker",
events: {
change: VALUE,
open: {
writeTo: ISOPEN,
value: true
},
close: {
writeTo: ISOPEN,
value: false
}
},
watch: {
enabled: ENABLE,
value: VALUE,
color: VALUE,
palette: PALETTE
}
});
createBinding({
name: "kendoComboBox",
events: {
change: VALUE,
open: {
writeTo: ISOPEN,
value: true
},
close: {
writeTo: ISOPEN,
value: false
}
},
watch: {
enabled: ENABLE,
isOpen: [OPEN, CLOSE],
data: function(value) {
ko.kendo.setDataSource(this, value);
},
value: VALUE
}
});
createBinding({
name: "kendoDatePicker",
defaultOption: VALUE,
events: {
change: VALUE,
open:
{
writeTo: ISOPEN,
value: true
},
close: {
writeTo: ISOPEN,
value: false
}
},
watch: {
enabled: ENABLE,
max: MAX,
min: MIN,
value: VALUE,
isOpen: [OPEN, CLOSE]
}
});
createBinding({
name: "kendoDateTimePicker",
defaultOption: VALUE,
events: {
change: VALUE,
open:
{
writeTo: ISOPEN,
value: true
},
close: {
writeTo: ISOPEN,
value: false
}
},
watch: {
enabled: ENABLE,
max: MAX,
min: MIN,
value: VALUE,
isOpen: [OPEN, CLOSE]
}
});
createBinding({
name: "kendoDropDownList",
events: {
change: VALUE,
open: {
writeTo: ISOPEN,
value: true
},
close: {
writeTo: ISOPEN,
value: false
}
},
watch: {
enabled: ENABLE,
isOpen: [OPEN, CLOSE],
data: function(value) {
ko.kendo.setDataSource(this, value);
//if nothing is selected and there is an optionLabel, select it
if (value.length && this.options.optionLabel && this.select() < 0) {
this.select(0);
}
},
value: VALUE
}
});
createBinding({
name: "kendoEditor",
defaultOption: VALUE,
events: {
change: VALUE
},
watch: {
enabled: ENABLE,
value: VALUE
}
});
createBinding({
name: "kendoGantt",
defaultOption: DATA,
watch: {
data: function(value) {
ko.kendo.setDataSource(this, value);
}
}
});
createBinding({
name: "kendoGrid",
defaultOption: DATA,
watch: {
data: function(value, options) {
ko.kendo.setDataSource(this, value, options);
}
},
templates: ["rowTemplate", "altRowTemplate"]
});
createBinding({
name: "kendoListView",
defaultOption: DATA,
watch: {
data: function(value, options) {
ko.kendo.setDataSource(this, value, options);
}
},
templates: ["template"]
});
createBinding({
name: "kendoPager",
defaultOption: DATA,
watch: {
data: function (value, options) {
ko.kendo.setDataSource(this, value, options);
},
page: "page"
},
templates: ["selectTemplate", "linkTemplate"]
});
createBinding({
name: "kendoMaskedTextBox",
defaultOption: VALUE,
events: {
change: VALUE
},
watch: {
enabled: ENABLE,
isReadOnly: READONLY,
value: VALUE
}
});
createBinding({
name: "kendoMap",
events: {
zoomEnd: function (options, event) {
if (ko.isWriteableObservable(options.zoom)) {
options.zoom(event.sender.zoom());
}
},
panEnd: function (options, event) {
var coordinates;
if (ko.isWriteableObservable(options.center)) {
coordinates = event.sender.center();
options.center([coordinates.lat, coordinates.lng]);
}
}
},
watch: {
center: CENTER,
zoom: ZOOM
}
});
createBinding({
name: "kendoMenu",
async: true
});
createBinding({
name: "kendoMenuItem",
parent: "kendoMenu",
watch: {
enabled: ENABLE,
isOpen: [OPEN, CLOSE]
},
async: true
});
createBinding({
name: "kendoMobileActionSheet",
events: {
open: {
writeTo: ISOPEN,
value: true
},
close: {
writeTo: ISOPEN,
value: false
}
},
watch: {
isOpen: openIfVisible
},
async: true
});
createBinding({
name: "kendoMobileButton",
defaultOption: CLICKED,
events: {
click: {
call: CLICKED
}
},
watch: {
enabled: ENABLE
}
});
createBinding({
name: "kendoMobileButtonGroup",
events: {
select: function(options, event) {
if (ko.isWriteableObservable(options.selectedIndex)) {
options.selectedIndex(event.sender.current().index());
}
}
},
watch: {
enabled: ENABLE,
selectedIndex: SELECT
}
});
createBinding({
name: "kendoMobileDrawer",
events: {
show: {
writeTo: ISOPEN,
value: true
},
hide: {
writeTo: ISOPEN,
value: false
}
},
watch: {
isOpen: function(value) {
this[value ? "show" : "hide"]();
}
},
async: true
});
createBinding({
name: "kendoMobileListView",
defaultOption: DATA,
events: {
click: {
call: CLICKED
}
},
watch: {
data: function(value, options) {
ko.kendo.setDataSource(this, value, options);
}
},
templates: ["template"]
});
createBinding({
name: "kendoMobileModalView",
events: {
open: {
writeTo: ISOPEN,
value: true
},
close: {
writeTo: ISOPEN,
value: false
}
},
watch: {
isOpen: openIfVisible
},
async: true
});
createBinding({
name: "kendoMobileNavBar",
watch: {
title: TITLE
}
});
createBinding({
name: "kendoMobilePopOver",
events: {
open: {
writeTo: ISOPEN,
value: true
},
close: {
writeTo: ISOPEN,
value: false
}
},
watch: {
isOpen: openIfVisible
},
async: true
});
createBinding({
name: "kendoMobileScroller",
events: {
pull: function(options, event) {
var doneCallback = event.sender.pullHandled.bind(event.sender);
if (typeof options.pulled === "function") {
options.pulled.call(this, this, event, doneCallback);
}
}
},
watch: {
enabled: [ENABLE, DISABLE]
}
});
createBinding({
name: "kendoMobileScrollView",
events: {
change: function(options, event) {
if ((event.page || event.page === 0) && ko.isWriteableObservable(options.currentIndex)) {
options.currentIndex(event.page);
}
}
},
watch: {
currentIndex: SCROLLTO,
data: function(value) {
ko.kendo.setDataSource(this, value);
}
}
});
createBinding({
name: "kendoMobileSwitch",
events: {
change: function(options, event) {
if (ko.isWriteableObservable(options.checked)) {
options.checked(event.checked);
}
}
},
watch: {
enabled: ENABLE,
checked: CHECK
}
});
createBinding({
name: "kendoMobileTabStrip",
events: {
select: function(options, event) {
if (ko.isWriteableObservable(options.selectedIndex)) {
options.selectedIndex(event.item.index());
}
}
},
watch: {
selectedIndex: function(value) {
if (value || value === 0) {
this.switchTo(value);
}
}
}
});
createBinding({
name: "kendoMultiSelect",
events: {
change: VALUE,
open: {
writeTo: ISOPEN,
value: true
},
close: {
writeTo: ISOPEN,
value: false
}
},
watch: {
enabled: ENABLE,
search: [SEARCH, CLOSE],
data: function(value) {
ko.kendo.setDataSource(this, value);
},
value: function(value) {
this.dataSource.filter({});
this.value(value);
}
}
});
var notificationHandler = function(type, value) {
if (value || value === 0) {
this.show(value, type);
}
else {
this.hide();
}
};
createBinding({
name: "kendoNotification",
watch: {
error: function(value) {
notificationHandler.call(this, ERROR, value);
},
info: function(value) {
notificationHandler.call(this, INFO, value);
},
success: function(value) {
notificationHandler.call(this, SUCCESS, value);
},
warning: function(value) {
notificationHandler.call(this, WARNING, value);
}
}
});
createBinding({
name: "kendoNumericTextBox",
defaultOption: VALUE,
events: {
change: VALUE
},
watch: {
enabled: ENABLE,
value: VALUE,
max: function(newMax) {
this.options.max = newMax;
//make sure current value is still valid
var value = this.value();
if ((value || value === 0) && value > newMax) {
this.value(newMax);
}
},
min: function(newMin) {
this.options.min = newMin;
//make sure that current value is still valid
var value = this.value();
if ((value || value === 0) && value < newMin ) {
this.value(newMin);
}
}
}
});
createBinding({
name: "kendoPanelBar",
async: true
});
createBinding({
name: "kendoPanelItem",
parent: "kendoPanelBar",
watch: {
enabled: ENABLE,
expanded: [EXPAND, COLLAPSE],
selected: [SELECT]
},
childProp: "item",
events: {
expand: {
writeTo: EXPANDED,
value: true
},
collapse: {
writeTo: EXPANDED,
value: false
},
select: {
writeTo: SELECTED,
value: VALUE
}
},
async: true
});
createBinding({
name: "kendoPivotGrid",
watch: {
data: function(value) {
ko.kendo.setDataSource(this, value);
}
}
});
createBinding({
name: "kendoProgressBar",
defaultOption: VALUE,
events: {
change: VALUE
},
watch: {
enabled: ENABLE,
value: VALUE
}
});
createBinding({
name: "kendoRangeSlider",
defaultOption: VALUES,
events: {
change: VALUES
},
watch: {
values: VALUES,
enabled: ENABLE
}
});
var schedulerUpdateModel = function(func) {
return function(options, e) {
var allModels = unwrap(options.data),
idField = unwrap(options.idField) || "id",
model = ko.utils.arrayFirst(allModels, function(item) {
return unwrap(item[idField]) === e.event[idField];
}),
write = function(data) {
for (var prop in model) {
if (data.hasOwnProperty(prop) && model.hasOwnProperty(prop)) {
var value = data[prop],
writeTo = model[prop];
if (ko.isWriteableObservable(writeTo)) {
writeTo(value);
}
}
}
};
if (model) {
func(options, e, model, write);
}
};
};
createBinding({
name: "kendoScheduler",
events: {
moveEnd: schedulerUpdateModel(function(options, e, model, write) {
write(e);
write(e.resources);
}),
save: schedulerUpdateModel(function(options, e, model, write) {
write(e.event);
}),
remove: schedulerUpdateModel(function(options, e, model, write) {
options.data.remove(model);
})
},
watch: {
data: function(value, options) {
ko.kendo.setDataSource(this, value, options);
},
date: DATE
},
async: true
});
createBinding({
name: "kendoSlider",
defaultOption: VALUE,
events: {
change: VALUE
},
watch: {
value: VALUE,
enabled: ENABLE
}
});
createBinding({
name: "kendoSortable",
defaultOption: DATA,
events: {
end: function(options, e) {
var dataKey = "__ko_kendo_sortable_data__",
data = e.action !== "receive" ? ko.dataFor(e.item[0]) : e.draggableEvent[dataKey],
items = options.data,
underlyingArray = options.data;
//remove item from its original position
if (e.action === "sort" || e.action === "remove") {
underlyingArray.splice(e.oldIndex, 1);
//keep track of the item between remove and receive
if (e.action === "remove") {
e.draggableEvent[dataKey] = data;
}
}
//add the item to its new position
if (e.action === "sort" || e.action === "receive") {
underlyingArray.splice(e.newIndex, 0, data);
//clear the data we passed
delete e.draggableEvent[dataKey];
//we are moving the item ourselves via the observableArray, cancel the draggable and hide the animation
e.sender._cancel();
}
//signal that the observableArray has changed now that we are done changing the array
items.valueHasMutated();
}
}
});
createBinding({
name: "kendoSplitter",
async: true
});
createBinding({
name: "kendoSplitterPane",
parent: "kendoSplitter",
watch: {
max: MAX,
min: MIN,
size: SIZE,
expanded: [EXPAND, COLLAPSE]
},
childProp: "pane",
events: {
collapse: {
writeTo: EXPANDED,
value: false
},
expand: {
writeTo: EXPANDED,
value: true
},
resize: SIZE
},
async: true
});
createBinding({
name: "kendoTabStrip",
async: true
});
createBinding({
name: "kendoTab",
parent: "kendoTabStrip",
watch: {
enabled: ENABLE
},
childProp: "item",
async: true
});
createBinding({
name: "kendoToolBar"
});
createBinding({
name: "kendoTooltip",
events: {},
watch: {
content: function(content) {
this.options.content = content;
this.refresh();
},
filter: FILTER
}
});
createBinding({
name: "kendoTimePicker",
defaultOption: VALUE,
events: {
change: VALUE
},
watch: {
max: MAX,
min: MIN,
value: VALUE,
enabled: ENABLE,
isOpen: [OPEN, CLOSE]
}
});
createBinding({
name: "kendoTreeMap",
watch: {
data: function(value) {
ko.kendo.setDataSource(this, value);
}
}
});
createBinding({
name: "kendoTreeView",
watch: {
data: function(value, options) {
ko.kendo.setDataSource(this, value, options);
}
},
events: {
change: function(options, e) {
if (ko.isWriteableObservable(options.value)) {
var tree = e.sender;
options.value(tree.dataItem(tree.select()));
}
}
},
async: true
});
createBinding({
name: "kendoTreeItem",
parent: "kendoTreeView",
watch: {
enabled: ENABLE,
expanded: [EXPAND, COLLAPSE],
selected: function(element, value) {
if (value) {
this.select(element);
} else if (this.select()[0] == element) {
this.select(null);
}
}
},
childProp: "node",
events: {
collapse: {
writeTo: EXPANDED,
value: false
},
expand: {
writeTo: EXPANDED,
value: true
},
select: {
writeTo: SELECTED,
value: true
}
},
async: true
});
createBinding({
name: "kendoUpload",
watch: {
enabled: ENABLE
}
});
createBinding({
name: "kendoWindow",
events: {
open: {
writeTo: ISOPEN,
value: true
},
close: {
writeTo: ISOPEN,
value: false
}
},
watch: {
content: CONTENT,
title: TITLE,
isOpen: [OPEN, CLOSE]
},
async: true
});
createBinding({
name: "kendoBarcode",
watch: {
value: VALUE
}
});
createBinding({
name: "kendoChart",
watch: {
data: function(value) {
ko.kendo.setDataSource(this, value);
}
}
});
createBinding({
name: "kendoLinearGauge",
defaultOption: VALUE,
watch: {
value: VALUE,
gaugeArea: extendAndRedraw("gaugeArea"),
pointer: extendAndRedraw("pointer"),
scale: extendAndRedraw("scale")
}
});
createBinding({
name: "kendoQRCode",
watch: {
value: VALUE
}
});
createBinding({
name: "kendoRadialGauge",
defaultOption: VALUE,
watch: {
value: VALUE,
gaugeArea: extendAndRedraw("gaugeArea"),
pointer: extendAndRedraw("pointer"),
scale: extendAndRedraw("scale")
}
});
createBinding({
name: "kendoSparkline",
watch: {
data: function (value) {
ko.kendo.setDataSource(this, value);
}
}
});
createBinding({
name: "kendoStockChart",
watch: {
data: function(value) {
ko.kendo.setDataSource(this, value);
}
}
});
}));
| humbletim/cdnjs | ajax/libs/knockout-kendo/0.9.6/knockout-kendo.js | JavaScript | mit | 33,426 |
// https://d3js.org/d3-queue/ Version 3.0.3. Copyright 2016 Mike Bostock.
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.d3 = global.d3 || {})));
}(this, (function (exports) { 'use strict';
var slice = [].slice;
var noabort = {};
function Queue(size) {
if (!(size >= 1)) throw new Error;
this._size = size;
this._call =
this._error = null;
this._tasks = [];
this._data = [];
this._waiting =
this._active =
this._ended =
this._start = 0; // inside a synchronous task callback?
}
Queue.prototype = queue.prototype = {
constructor: Queue,
defer: function(callback) {
if (typeof callback !== "function" || this._call) throw new Error;
if (this._error != null) return this;
var t = slice.call(arguments, 1);
t.push(callback);
++this._waiting, this._tasks.push(t);
poke(this);
return this;
},
abort: function() {
if (this._error == null) abort(this, new Error("abort"));
return this;
},
await: function(callback) {
if (typeof callback !== "function" || this._call) throw new Error;
this._call = function(error, results) { callback.apply(null, [error].concat(results)); };
maybeNotify(this);
return this;
},
awaitAll: function(callback) {
if (typeof callback !== "function" || this._call) throw new Error;
this._call = callback;
maybeNotify(this);
return this;
}
};
function poke(q) {
if (!q._start) {
try { start(q); } // let the current task complete
catch (e) {
if (q._tasks[q._ended + q._active - 1]) abort(q, e); // task errored synchronously
else if (!q._data) throw e; // await callback errored synchronously
}
}
}
function start(q) {
while (q._start = q._waiting && q._active < q._size) {
var i = q._ended + q._active,
t = q._tasks[i],
j = t.length - 1,
c = t[j];
t[j] = end(q, i);
--q._waiting, ++q._active;
t = c.apply(null, t);
if (!q._tasks[i]) continue; // task finished synchronously
q._tasks[i] = t || noabort;
}
}
function end(q, i) {
return function(e, r) {
if (!q._tasks[i]) return; // ignore multiple callbacks
--q._active, ++q._ended;
q._tasks[i] = null;
if (q._error != null) return; // ignore secondary errors
if (e != null) {
abort(q, e);
} else {
q._data[i] = r;
if (q._waiting) poke(q);
else maybeNotify(q);
}
};
}
function abort(q, e) {
var i = q._tasks.length, t;
q._error = e; // ignore active callbacks
q._data = undefined; // allow gc
q._waiting = NaN; // prevent starting
while (--i >= 0) {
if (t = q._tasks[i]) {
q._tasks[i] = null;
if (t.abort) {
try { t.abort(); }
catch (e) { /* ignore */ }
}
}
}
q._active = NaN; // allow notification
maybeNotify(q);
}
function maybeNotify(q) {
if (!q._active && q._call) {
var d = q._data;
q._data = undefined; // allow gc
q._call(q._error, d);
}
}
function queue(concurrency) {
return new Queue(arguments.length ? +concurrency : Infinity);
}
exports.queue = queue;
Object.defineProperty(exports, '__esModule', { value: true });
}))); | maruilian11/cdnjs | ajax/libs/d3-queue/3.0.3/d3-queue.js | JavaScript | mit | 3,295 |
!function(r){"use strict";function e(r,a){var o=a.shift(),l=a;if(null!==r){if(0===l.length)return r[o];if("object"==typeof r)return e(r[o],l)}return r}function a(){if(!r.trumbowyg.addedXhrProgressEvent){var e=r.ajaxSettings.xhr;r.ajaxSetup({xhr:function(){var r=e(),a=this;return r&&"object"==typeof r.upload&&void 0!==a.progressUpload&&r.upload.addEventListener("progress",function(r){a.progressUpload(r)},!1),r}}),r.trumbowyg.addedXhrProgressEvent=!0}}var o={serverPath:"",fileFieldName:"fileToUpload",data:[],headers:{},xhrFields:{},urlPropertyName:"file",statusPropertyName:"success",success:void 0,error:void 0,imageWidthModalEdit:!1};a(),r.extend(!0,r.trumbowyg,{langs:{en:{upload:"Upload",file:"File",uploadError:"Error"},sk:{upload:"Nahrať",file:"Súbor",uploadError:"Chyba"},fr:{upload:"Envoi",file:"Fichier",uploadError:"Erreur"},cs:{upload:"Nahrát obrázek",file:"Soubor",uploadError:"Chyba"},zh_cn:{upload:"上传",file:"文件",uploadError:"错误"},zh_tw:{upload:"上傳",file:"文件",uploadError:"錯誤"},ru:{upload:"Загрузка",file:"Файл",uploadError:"Ошибка"},ja:{upload:"アップロード",file:"ファイル",uploadError:"エラー"},pt_br:{upload:"Enviar do local",file:"Arquivo",uploadError:"Erro"}},plugins:{upload:{init:function(a){a.o.plugins.upload=r.extend(!0,{},o,a.o.plugins.upload||{});var l={fn:function(){a.saveRange();var o,l=a.o.prefix,t={file:{type:"file",required:!0,attributes:{accept:"image/*"}},alt:{label:"description",value:a.getRangeText()}};a.o.plugins.upload.imageWidthModalEdit&&(t.width={value:""});var i=a.openModalInsert(a.lang.upload,t,function(t){var d=new FormData;d.append(a.o.plugins.upload.fileFieldName,o),a.o.plugins.upload.data.map(function(r){d.append(r.name,r.value)}),r.map(t,function(r,e){"file"!==e&&d.append(e,r)}),0===r("."+l+"progress",i).length&&r("."+l+"modal-title",i).after(r("<div/>",{"class":l+"progress"}).append(r("<div/>",{"class":l+"progress-bar"}))),r.ajax({url:a.o.plugins.upload.serverPath,headers:a.o.plugins.upload.headers,xhrFields:a.o.plugins.upload.xhrFields,type:"POST",data:d,cache:!1,dataType:"json",processData:!1,contentType:!1,progressUpload:function(e){r("."+l+"progress-bar").css("width",Math.round(100*e.loaded/e.total)+"%")},success:function(o){if(a.o.plugins.upload.success)a.o.plugins.upload.success(o,a,i,t);else if(e(o,a.o.plugins.upload.statusPropertyName.split("."))){var l=e(o,a.o.plugins.upload.urlPropertyName.split("."));a.execCmd("insertImage",l);var d=r('img[src="'+l+'"]:not([alt])',a.$box);d.attr("alt",t.alt),a.o.imageWidthModalEdit&&parseInt(t.width)>0&&d.attr({width:t.width}),setTimeout(function(){a.closeModal()},250),a.$c.trigger("tbwuploadsuccess",[a,o,l])}else a.addErrorOnModalField(r("input[type=file]",i),a.lang[o.message]),a.$c.trigger("tbwuploaderror",[a,o])},error:a.o.plugins.upload.error||function(){a.addErrorOnModalField(r("input[type=file]",i),a.lang.uploadError),a.$c.trigger("tbwuploaderror",[a])}})});r("input[type=file]").on("change",function(r){try{o=r.target.files[0]}catch(e){o=r.target.value}})}};a.addBtnDef("upload",l)}}}})}(jQuery); | holtkamp/cdnjs | ajax/libs/Trumbowyg/2.9.2/plugins/upload/trumbowyg.upload.min.js | JavaScript | mit | 3,090 |
/**
* angular-ui-handsontable 0.3.13
*
* Date: Mon Jul 29 2013 09:04:18 GMT+0200 (Central European Daylight Time)
*/
.handsontable{position:relative;font-family:Arial,Helvetica,sans-serif;line-height:1.3em;font-size:13px}.handsontable.hidden{display:none;left:0;position:absolute;top:0}.handsontable *{box-sizing:content-box;-webkit-box-sizing:content-box;-moz-box-sizing:content-box}.handsontable table{border-collapse:separate;position:relative;border-spacing:0;margin:0;border-width:0;table-layout:fixed;width:0;outline-width:0;max-width:none;max-height:none}.handsontable col{width:50px}.handsontable col.rowHeader{width:50px}.handsontable th,.handsontable td{border-right:1px solid #CCC;border-bottom:1px solid #CCC;height:22px;empty-cells:show;line-height:21px;padding:0 4px;background-color:#FFF;font-size:12px;vertical-align:top;overflow:hidden;outline-width:0;white-space:pre-line}.handsontable td.htInvalid{-webkit-transition:background .75s ease;-moz-transition:background .75s ease;-ms-transition:background .75s ease;-o-transition:background .75s ease;transition:background .75s ease;background-color:#ff4c42}.handsontable th:last-child{border-right:1px solid #CCC;border-bottom:1px solid #CCC}.handsontable tr:first-child th.htNoFrame,.handsontable th:first-child.htNoFrame,.handsontable th.htNoFrame{border-left-width:0;background-color:#fff;border-color:#FFF}.handsontable th:first-child,.handsontable td:first-child,.handsontable .htNoFrame+th,.handsontable .htNoFrame+td{border-left:1px solid #CCC}.handsontable tr:first-child th,.handsontable tr:first-child td{border-top:1px solid #CCC}.handsontable thead tr:last-child th{border-bottom-width:0}.handsontable thead tr.lastChild th{border-bottom-width:0}.handsontable th{background-color:#EEE;color:#222;text-align:center;font-weight:400;white-space:nowrap}.handsontable th .small{font-size:12px}.handsontable thead th{padding:0}.handsontable th.active{background-color:#CCC}.handsontable thead th .relative{position:relative;padding:2px 4px}.handsontable .manualColumnMover{position:absolute;left:0;top:0;background-color:transparent;width:5px;height:25px;z-index:999;cursor:move}.handsontable th .manualColumnMover:hover,.handsontable th .manualColumnMover.active{background-color:#88F}.handsontable .manualColumnResizer{position:absolute;top:0;cursor:col-resize}.handsontable .manualColumnResizerHandle{background-color:transparent;width:5px;height:25px}.handsontable .manualColumnResizer:hover .manualColumnResizerHandle,.handsontable .manualColumnResizer.active .manualColumnResizerHandle{background-color:#AAB}.handsontable .manualColumnResizerLine{position:absolute;right:0;top:0;background-color:#AAB;display:none;width:0;border-right:1px dashed #777}.handsontable .manualColumnResizer.active .manualColumnResizerLine{display:block}.handsontable .columnSorting:hover{text-decoration:underline;cursor:pointer}.handsontable .wtBorder{position:absolute;font-size:0}.handsontable td.area{background-color:#EEF4FF}.handsontable .wtBorder.corner{font-size:0;cursor:crosshair}.handsontable .htBorder.htFillBorder{background:red;width:1px;height:1px}textarea.handsontableInput{border:2px solid #5292F7;outline-width:0;margin:0;padding:1px 4px 0 2px;font-family:Arial,Helvetica,sans-serif;line-height:1.3em;font-size:13px;box-shadow:1px 2px 5px rgba(0,0,0,.4);resize:none;display:inline-block;font-size:13px;color:#000;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.handsontableInputHolder{position:absolute;top:0;left:0;width:1px;height:1px}.handsontable .htDimmed{font-style:italic;color:#777}.handsontable .htAutocomplete{position:relative;padding-right:20px}.handsontable .htAutocompleteArrow{position:absolute;top:0;right:0;font-size:10px;color:#EEE;cursor:default;width:16px;text-align:center}.handsontable td .htAutocompleteArrow:hover{color:#777}.handsontable .htCheckboxRendererInput.noValue{opacity:.5}.handsontable .htNumeric{text-align:right}.handsontable .typeahead{position:absolute;font-family:Arial,Helvetica,sans-serif;line-height:1.3em;font-size:13px;z-index:10;top:100%;left:0;float:left;display:none;min-width:160px;padding:4px 0;margin:2px 0 0;list-style:none;background-color:#fff;border-color:#CCC;border-color:rgba(0,0,0,.2);border-style:solid;border-width:1px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.handsontable .typeahead li{line-height:18px;min-height:18px;display:list-item;margin:0}.handsontable .typeahead a{display:block;padding:3px 15px;clear:both;font-weight:400;line-height:18px;min-height:18px;color:#333;white-space:nowrap}.handsontable .typeahead li>a:hover,.handsontable .typeahead .active>a,.handsontable .typeahead .active>a:hover{color:#fff;text-decoration:none;background-color:#08C}.handsontable .typeahead a{color:#08C;text-decoration:none}ul.context-menu-list{color:#000}ul.context-menu-list li{margin-bottom:0}.handsontable .dragdealer{position:relative;width:9px;height:9px;background:#F8F8F8;border:1px solid #DDD}.handsontable .dragdealer .handle{position:absolute;width:9px;height:9px;background:#C5C5C5}.handsontable .dragdealer .disabled{background:#898989}/*!
* jQuery contextMenu - Plugin for simple contextMenu handling
*
* Version: 1.6.5
*
* Authors: Rodney Rehm, Addy Osmani (patches for FF)
* Web: http://medialize.github.com/jQuery-contextMenu/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
* GPL v3 http://opensource.org/licenses/GPL-3.0
*
*/.context-menu-list{margin:0;padding:0;min-width:120px;max-width:250px;display:inline-block;position:absolute;list-style-type:none;border:1px solid #DDD;background:#EEE;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.5);-moz-box-shadow:0 2px 5px rgba(0,0,0,.5);-ms-box-shadow:0 2px 5px rgba(0,0,0,.5);-o-box-shadow:0 2px 5px rgba(0,0,0,.5);box-shadow:0 2px 5px rgba(0,0,0,.5);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.context-menu-item{padding:2px 2px 2px 24px;background-color:#EEE;position:relative;-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none}.context-menu-separator{padding-bottom:0;border-bottom:1px solid #DDD}.context-menu-item>label>input,.context-menu-item>label>textarea{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.context-menu-item.hover{cursor:pointer;background-color:#39F}.context-menu-item.disabled{color:#666}.context-menu-input.hover,.context-menu-item.disabled.hover{cursor:default;background-color:#EEE}.context-menu-submenu:after{content:">";color:#666;position:absolute;top:0;right:3px;z-index:1}.context-menu-item.icon{min-height:18px;background-repeat:no-repeat;background-position:4px 2px}.context-menu-item.icon-edit{background-image:url(images/page_white_edit.png)}.context-menu-item.icon-cut{background-image:url(images/cut.png)}.context-menu-item.icon-copy{background-image:url(images/page_white_copy.png)}.context-menu-item.icon-paste{background-image:url(images/page_white_paste.png)}.context-menu-item.icon-delete{background-image:url(images/page_white_delete.png)}.context-menu-item.icon-add{background-image:url(images/page_white_add.png)}.context-menu-item.icon-quit{background-image:url(images/door.png)}.context-menu-input>label>*{vertical-align:top}.context-menu-input>label>input[type=checkbox],.context-menu-input>label>input[type=radio]{margin-left:-17px}.context-menu-input>label>span{margin-left:5px}.context-menu-input>label,.context-menu-input>label>input[type=text],.context-menu-input>label>textarea,.context-menu-input>label>select{display:block;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box}.context-menu-input>label>textarea{height:100px}.context-menu-item>.context-menu-list{display:none;right:-5px;top:5px}.context-menu-item.hover>.context-menu-list{display:block}.context-menu-accesskey{text-decoration:underline} | wout/cdnjs | ajax/libs/ngHandsontable/0.3.13/angular-ui-handsontable.full.min.css | CSS | mit | 8,118 |
/*! ValJS v1.0 (2015-01-18) | (c) 2015 | www.valjs.io */
/*global window, jQuery, console, setTimeout */
/*jslint bitwise: true, regexp: true */
/*Compiled via http://closure-compiler.appspot.com/home*/
/**
* [description]
* @param {[type]} window [description]
* @param {{inArray : function()}} $ [description]
* @return {[type]} [description]
*/
window.ValJS = (function (window, $) {
'use strict';
/*$.extend( $.expr[':'],
{
'valjs-field' : function (a) {
return $(a).data(dataNameValjsBinding);
},
'valjs-valid' : function (a) {
return $(a).data(dataNameValjsBinding);
},
'valjs-invalid' : function (a) {
var b = $(a).data(dataNameValjsBinding);
if (b) {
return ! b.isValid();
}
}
}
);*/
function ValjSWorker() {
var workerCount = 0,
callback = null;
this.add = function () {
workerCount += 1;
};
this.stopWaiting = function () {
callback = null;
};
this.remove = function () {
workerCount -= 1;
if (workerCount < 0) {
workerCount = 0;
}
};
this.commitRemove = function () {
if (workerCount === 0) {
if (callback) {
callback();
// Just wait once...
callback = null;
}
}
};
this.wait = function (callbackFunction) {
callback = callbackFunction;
};
}
function valjsWaitForIt(fn) {
this.vars.wfi = fn;
}
/** @global $ */
var nullValue = null,
dataNameValJsInstance = 'vjs-i',
ValJS = function (elm, options) {
this.valjsv = '1.0';
this.context = elm;
this.jqContext = $(elm);
this.jqContext.data(dataNameValJsInstance, this);
this.options = options;
this.metadata = this.jqContext.data('valjs');
this.$form = nullValue;
this.workers = new ValjSWorker();
this.elementUpdated = valjsElementUpdated;
this.waitForIt = valjsWaitForIt;
this.vars = {
off: 'valjs__off', // data()-variable set on fields with validation disabled
clean: {} // will contain combinations of elements and modifiers so we can quickly clear them all
};
this.e = []; // Will contain bound elements, not all found elements
this.s = []; // Will contain submit button(s)
},
superglobals = (window.ValJS && window.ValJS.global) ? window.ValJS.global : {},
dElmType = 'valjs-ty',
wj = ValJS,
trueValue = true,
falseValue = false,
submitQuery = 'input[type="submit"],button[type="submit"],button:not([type]),input[type="image"]',
selectTypeName = 'select',
// Stored in Binding object from 0.7.6
dataNameValJsValueCache = 'c',
dataNameValJsHash = 'h',
dataNameValJsIsValid = 'v',
dataNameValjsValidationStatus = 's',
dataNameValJsFormContext = 'vjsf',
dataNameValJsBound = 'vjs-b',
dataNameValjsBinding = 'vjs-bn',
keyNameDefault = "error",
eventNamespace = '.valjs',
ruleNameWeek = 'week',
ruleNameDate = 'date',
ruleNameDateTime = 'datetime',
rulenameNumber = 'number',
ruleNameListMax = 'listmax',
ruleNameListMin = 'listmin',
ruleNameFileMin = 'filemin',
ruleNameFileMax = 'filemax',
rulesUsingMinMax = [ruleNameWeek, ruleNameDate, ruleNameDateTime, rulenameNumber, ruleNameListMax, ruleNameListMin, ruleNameFileMin, ruleNameFileMax],
clickEvent = 'click',
changeEvent = 'change',
keyupEvent = 'keyup',
keydownEvent = 'keydown';
function valjsElementUpdated(binding) {
var i,
validFields = 0,
busyFields = 0,
failedFields = 0,
waitingFields = 0,
s;
for (i = 0; i < this.e.length; i += 1) {
binding = $(this.e[i]).data(dataNameValjsBinding);
s = binding.getResults();
if (!valjsIsUndefined(s)) {
if (s.fail.length === 0 && s.busy.length === 0) {
if (!binding.waitingRules()) {
validFields += 1;
} else {
waitingFields += 1;
}
} else if (s.fail.length > 0) {
failedFields += 1;
} else if (s.busy.length > 0) {
busyFields += 1;
}
}
}
/*if (waitingFields) {
console.warn("FORM: rules waiting");
} else if (failedFields) {
console.warn("FORM: failed");
} else if (busyFields) {
console.warn("FORM: busy...");
} else {
console.warn("FORM: valid!");
}*/
if (this.vars.wfi) {
if (!failedFields && !waitingFields && !busyFields) {
this.vars.wfi();
delete this.vars.wfi;
} else if (failedFields) {
delete this.vars.wfi;
}
}
}
function valjsData(jqElement) {
var args = Array.prototype.slice.call(arguments, 1);
return $.prototype.data.apply(jqElement, args);
}
/**
* Help function to check for undefined variables
* @param {object} object The variable to check
* @return {boolean} True if the object is undefined
*/
function valjsIsUndefined(object) {
return object === undefined;
}
/**
* Help function to check if a variable is of type string
* @param {object} object The value to check
* @return {boolean True of the value is a string
*/
function valjsIsString(object) {
return typeof object === "string";
}
/**
* Wrapper function for jQuerys removeClass function
* @param {object} $elm jQuery element(s)
* @param {string} className Classes to add
*/
function valjsRemoveClass($elm, className) {
$elm.removeClass(className);
}
/**
* Wrapper function for jQuerys removeData function
* @param {object} $elm jQuery element(s)
* @param {string} dataName Name of data property
*/
function valjsRemoveData($elm, dataName) {
$elm.removeData(dataName);
}
/**
* Utility method to clear all modifiers on an element
* @param {object} $elm jQuery element(s)
* @param {string} elementType Name of element type
* @param {object} valjs ValJS instance
*/
function valjsClearModifiers($elm, elementType, valjs) {
/** @type {{removeClass:function(string, boolean) : *}} */
var d = valjsRemoveClass($elm, valjs.vars[elementType]);
return d;
}
/**
* Utility method to get the length of an object or 0 if undefined
* @param @type {{length:number}} o [description] [varname] [description]
* @return {number} [description]
*/
function valjsLength(o) {
/** */
if (!valjsIsUndefined(o) && o !== nullValue && !valjsIsUndefined(o.length)) {
return o.length;
}
return 0;
}
/**
* Wrapper function find elements below an element
* @param {string} selector jQuery selector
* @param {object} element Element to find children for
* @return {array} List of elements
*/
function valjsSelectElements(selector, element) {
return $(element).find(selector);
}
/**
* Check if an object is a function
* @param {*} object [description]
* @return {boolean} [description]
*/
function valjsIsFunction(object) {
/** @type {{isFunction:function(*) : boolean}} $ */
var jQuery = $;
return jQuery.isFunction(object);
}
/**
* [valjsInArray description]
* @param {*} value [description]
* @param {Array} array [description]
* @return {number} [description]
*/
function valjsInArray(value, array) {
/** @type {{inArray:function(*, Array) : number}} $ */
var jQuery = $;
return jQuery.inArray(value, array);
}
/**
* Evaluate a msg setting and normalize it
* @param {object} msgObject string, object or function to evaluate
* @param {object} existingObject Existing object to concider
* @return {object} The normalized object
*/
function valjsGetMsgConfig(msgObject, existingObject) {
//console.error(msgObject, existingObject);
var tmpMsgObject = { 'error' : msgObject };
if (valjsIsString(existingObject)) {
existingObject = {
'error' : existingObject
};
}
if (valjsIsFunction(msgObject)) {
msgObject = tmpMsgObject;
}
if (valjsIsString(msgObject)) {
if (valjsIsUndefined(existingObject)) {
msgObject = tmpMsgObject;
} else {
msgObject = $.extend(trueValue, tmpMsgObject, existingObject);
}
} else if (valjsIsUndefined(msgObject)) {
msgObject = existingObject;
} else if (typeof msgObject === "object") {
msgObject = $.extend(trueValue, {}, msgObject, existingObject);
}
return msgObject;
}
function ValJSRule(name, ruleConfig) {
var options = ruleConfig.options,
jqDeferred;
if (!valjsIsUndefined(options)) {
if (!valjsIsUndefined(options.msg)) {
options.msg = valjsGetMsgConfig(options.msg);
}
}
if (valjsIsUndefined(ruleConfig.value)) {
ruleConfig.value = trueValue;
}
ruleConfig = $.extend(trueValue, {}, ValJS.ruleDefaults, {name: name}, ruleConfig);
this.name = name;
this.options = ruleConfig.options;
this.bind = ruleConfig.bind;
this.testElement = ruleConfig.testElement;
this.run = ruleConfig.run;
this.async = ruleConfig.async;
this.prio = ruleConfig.prio;
this.events = ruleConfig.events;
this.checkEvent = ruleConfig.checkEvent;
// If this rule is async we need a deferred object
if (ruleConfig.async) {
this.makePromise = function() {
jqDeferred = $.Deferred();
return jqDeferred.promise();
};
this.reject = function() {
jqDeferred.reject.apply(jqDeferred, Array.prototype.slice.call(arguments));
}
this.resolve = function() {
jqDeferred.resolve.apply(jqDeferred, Array.prototype.slice.call(arguments));
}
this.abort = ruleConfig.abort;
}
}
/**
* Internal method for adding a rule (available for public as well)
* @param {string} name The rule name
* @param {object} ruleConfig The rule definition
*/
function valjsAddRule(name, ruleConfig) {
if (!/^[a-z][a-z0-9]*$/.test(name)) {
$.error('Bad rule name');
return;
}
wj.rules.k.push(name);
wj.rules[name] = new ValJSRule(name, ruleConfig);
}
/**
* Get classes for an element type based on valjs configuration and element type
* @param {object} valjs The ValJS instance
* @param {string} elementType The element type
* @param {...string} modifiers List of modifiers to set
* @return {string} The complete class name
*/
function valjsGetClass(valjs, elementType, modifiers) {
var cn = valjs.config.elements,
mcf = valjs.config.modifiers || {},
ret = cn && cn[elementType] ? [cn[elementType]] : [],
modifier_index,
prefix = '';
// No modifiers? Just exit then
if (!modifiers) {
return ret[0];
}
if (valjs.config.modifierSeparator && cn[elementType]) {
prefix = cn[elementType] + valjs.config.modifierSeparator;
}
// If it's a string we just add it
if (valjsIsString(modifiers)) {
ret.push(!valjsIsUndefined(prefix + (mcf[modifiers])) ? mcf[modifiers] : '');
} else if (valjsLength(modifiers)) {
for (modifier_index = 0; modifier_index < valjsLength(modifiers); modifier_index += 1) {
ret.push(!valjsIsUndefined(prefix + (mcf[modifiers[modifier_index]])) ? mcf[modifiers[modifier_index]] : '');
}
}
return ret.join(' ');
}
/**
* Method to invoke the findMsg-method for an element
* @param {object} options Object containing the element property
* @return {object} The msg element
*/
function invokeElementFindMsgFunction(options) {
var $elm = options.element, cfg;
if (!$elm) {
return nullValue;
}
cfg = valjsData($elm, dataNameValjsBinding).getCfg();
return cfg.iFindMsgFn(options);
}
/**
* Wrapper function for jQuerys addClass
* @param {object} $elm jQuery element(s)
* @param {string} className The class to add
* @return {object} The element
*/
function valjsJsAddClass($elm, className) {
return $elm.addClass(className);
}
/**
* Utility function set the class on an element
* @param {{addClass:function(string)}} $elm [description]
* @param {*} valjs [description]
* @param {string} elementType [description]
* @param {...string|string} modifiers [description]
* @return {*} [description]
*/
function valjsSetClass($elm, valjs, elementType, modifiers) {
if (!$elm) {
return;
}
valjsClearModifiers($elm, elementType, valjs);
valjsJsAddClass($elm, valjsGetClass(valjs, elementType, modifiers));
return $elm;
}
/**
* [valjsGetAttr description]
* @param { { attr : function(string) : string } | * } $elm [description]
* @param {string} attrName [description]
* @return {string} [description]
*/
function valjsGetAttr($elm, attrName) {
return $elm.attr(attrName);
}
/**
* Utility method to get the element type
* @param {{prop:function(string)}|*} $elm [description]
* @return {*} [description]
*/
function valjsGetElementType($elm) {
var elmType = valjsData($elm, dElmType),
type,
result,
allowedTypes;
// We cache this check
if (!valjsIsUndefined(elmType)) {
return valjsData($elm, dElmType);
}
type = $elm.prop('tagName').toLowerCase();
result = {
type: nullValue
};
// allowedTypes can be returned as "type"
allowedTypes = ['text', 'checkbox', 'file', 'radio', 'submit'];
if (type === 'input') {
type = $elm.prop('type').toLowerCase();
if (!valjsIsUndefined(type)) {
if (valjsInArray(type, allowedTypes) === -1) {
result[type] = trueValue;
result.type = 'text';
} else {
result.type = type;
}
} else {
type = 'text'; // fallback on text
}
} else {
if (type === selectTypeName) {
result.type = type;
result.isMultiple = valjsIsUndefined(valjsGetAttr($elm, 'multiple')) ? falseValue : trueValue;
} else if (type === 'textarea') {
result.type = type;
}
}
valjsData($elm, dElmType, result);
return result;
}
/**
* Helper function to extract the value for an element
* @param {object} $elm jQuery element
* @param {[type]} event Event triggering that we want a value
* @return {object} Object contining properties with the element value
*/
function valjsGetElementValue($elm) {
var elementType = valjsGetElementType($elm).type,
binding = valjsData($elm, dataNameValjsBinding),
originalValue = binding ? binding.g(dataNameValJsValueCache) : nullValue,
value = nullValue,
ret = {
value: nullValue,
upd: trueValue // true if the value has changed since last time
};
if (elementType === 'submit') {
return ret;
}
switch (elementType) {
case 'checkbox':
case 'radio':
value = $elm.prop('checked');
break;
case selectTypeName:
ret.value = $.map($elm.find('option'), function (n) {
/** @type {{ is : function(string) : boolean, val : function() : string, text : function() : string}} */
var $n = $(n);
if ($n.is(':selected')) {
return !valjsIsUndefined($n.val()) ? $n.val() : $n.text();
}
});
value = ret.value.join(',');
if (value === "" && valjsLength(ret.value) > 0) {
value = " ";
}
break;
default:
value = $elm.val();
}
originalValue = valjsIsUndefined(originalValue) ? '' : originalValue;
if (originalValue === value) {
ret.upd = falseValue;
} else {
binding.resetRuleStatus();
// if (!valjsIsUndefined(event) && event.type === 'click') {
// ret.upd = falseValue;
// }
}
// Reset the rule statuses if the value has changed
if (ret.value === nullValue) {
ret.value = value;
}
if (binding) {
binding.s(dataNameValJsValueCache, value);
}
return ret;
}
/**
* Get the functions used to find message and label elements
* @param {object} $elm jQuery element
* @param {object} cfgContext Configuration
* @return {object} Object containing findMsg and findLabel functions
*/
function valjsGetElementFindFunctions($elm, cfgContext) {
var resolvedConfiguration = { },
fieldNameSelector = valjsGetAttr($elm, 'name');
//fieldIdSelector = valjsGetAttr($elm, 'id');
if (fieldNameSelector) {
if (!valjsIsUndefined(cfgContext[fieldNameSelector])) {
if (!valjsIsUndefined(cfgContext[fieldNameSelector].findMsg)) {
resolvedConfiguration.findMsg = cfgContext[fieldNameSelector].findMsg;
}
if (!valjsIsUndefined(cfgContext[fieldNameSelector].findLabel)) {
resolvedConfiguration.findLabel = cfgContext[fieldNameSelector].findLabel;
}
}
}
return resolvedConfiguration;
}
function valjsGetElementConfig($elm, ruleName, cfgContext, bindRule) {
var resolvedConfiguration = { },
fieldNameSelector = valjsGetAttr($elm, 'name'),
//fieldIdSelector = valjsGetAttr($elm, 'id'),
cfgFields = $.extend(trueValue, {}, cfgContext.fields),
cfgRules = cfgContext.rules;
if (!valjsIsUndefined(cfgRules)) {
if (!valjsIsUndefined(cfgRules[ruleName])) {
resolvedConfiguration = $.extend(resolvedConfiguration, cfgRules[ruleName]);
if (bindRule !== falseValue) {
resolvedConfiguration.elmRules = {};
resolvedConfiguration.elmRules[ruleName] = 1;
}
if (!valjsIsUndefined(cfgRules[ruleName].msg)) {
resolvedConfiguration.msg = valjsGetMsgConfig(cfgRules[ruleName].msg);
}
}
}
if (cfgFields) {
//if (fieldIdSelector) {
// }
if (fieldNameSelector) {
if (!valjsIsUndefined(cfgFields[fieldNameSelector])) {
if (!valjsIsUndefined(cfgFields[fieldNameSelector].msg)) {
resolvedConfiguration.msg = valjsGetMsgConfig(cfgFields[fieldNameSelector].msg, resolvedConfiguration.msg);
}
if (!valjsIsUndefined(cfgFields[fieldNameSelector][ruleName])) {
resolvedConfiguration.elmRules = {};
resolvedConfiguration.elmRules[ruleName] = 'instance.name';
if (!valjsIsUndefined(cfgFields[fieldNameSelector][ruleName].msg)) {
resolvedConfiguration.msg = valjsGetMsgConfig(resolvedConfiguration.msg, cfgFields[fieldNameSelector][ruleName].msg);
delete cfgFields[fieldNameSelector][ruleName].msg;
}
resolvedConfiguration = $.extend(trueValue, resolvedConfiguration, cfgFields[fieldNameSelector][ruleName]);
}
}
}
}
return resolvedConfiguration;
}
function valjsAttributeNameToOptionName(value) {
var myRegexp = /-([a-z0-9])/g,
match = myRegexp.exec(value),
newValue = String(value);
while (match !== nullValue) {
newValue = newValue.replace(match[0], String(match[1].toUpperCase()));
match = myRegexp.exec(value);
}
return newValue;
}
function valjsRuleCustomBind(valjs, rule, $elm) {
var ret = { binding : nullValue, elmRules : undefined},
customBindResult,
ruleName = rule.name;
if (valjs.config.allowRuleInitialization === trueValue) {
customBindResult = rule.testElement({ form : valjs.$form, context : valjs.jqContext, rule: rule, element: $elm, valjs: valjs });
if (typeof customBindResult === 'object') {
if (!valjsIsUndefined(customBindResult[ruleName])) {
ret.binding = { data: {} };
ret.elmRules = {};
ret.elmRules[ruleName] = trueValue;
} else {
ret.binding = { data : customBindResult };
}
} else {
if (typeof customBindResult === 'boolean' && customBindResult === trueValue) {
ret.binding = { data: {} };
ret.elmRules = {};
ret.elmRules[ruleName] = trueValue;
}
}
}
return ret;
}
function valjsParseEmptyRuleAttr(rule, optionName) {
var ret = {};
if (!valjsIsUndefined(rule.options)) {
if (!valjsIsUndefined(rule.options[optionName])) {
if (typeof rule.options[optionName] === "boolean") {
return trueValue;
}
}
}
return ret;
}
function valjsGetUniqueId() {
ValJS.idCounter += 1;
return ValJS.idCounter;
}
function valjsParseRuleAttrValue(rule, attrName, attrValue) {
if (!valjsIsUndefined(rule.options)) {
if (!valjsIsUndefined(rule.options[attrName])) {
if (typeof rule.options[attrName] === "boolean") {
if (attrValue.toLowerCase() === "true") {
attrValue = trueValue;
} else if (attrValue.toLowerCase() === "false") {
attrValue = falseValue;
}
}
}
}
return attrValue;
}
function valjsRuleParseElementAttributeAsMessage(attribute_name, local_string, attrValue, attrData) {
if (attribute_name.indexOf(local_string) === 0) {
if (attribute_name === local_string) {
attrData.msg = attrData.msg || {};
attrData.msg[keyNameDefault] = attrValue;
} else if (attribute_name.indexOf(local_string + '-') !== -1) {
attrData.msg = attrData.msg || {};
attrData.msg[valjsAttributeNameToOptionName(attribute_name.substr((local_string + '-').length))] = attrValue;
}
} else {
return attrValue;
}
return attrData;
}
function valjsRuleParseElementAttributes(attrName, $elm, rule) {
var attrs = $elm[0].attributes,
attr_index,
attrData = {},
attribute_name,
tmp,
attrValue;
for (attr_index = 0; attr_index < valjsLength(attrs); attr_index += 1) {
attribute_name = attrs[attr_index].name;
if (attribute_name.indexOf(attrName + '-') === 0 && attribute_name.length > attrName.length) {
tmp = valjsAttributeNameToOptionName(attribute_name.substr(valjsLength(attrName) + 1));
if (!attrs[attr_index].value) {
attrData[tmp] = valjsParseEmptyRuleAttr(rule, tmp);
} else {
attrValue = valjsParseRuleAttrValue(rule, tmp, attrs[attr_index].value);
attrData = valjsRuleParseElementAttributeAsMessage(attribute_name, attrName + '-msg', attrValue, attrData);
if (attrData === attrValue) {
attrData = {};
attrData[tmp] = attrValue;
}
}
}
}
return attrData;
}
function valjsGetElementConfigFromAttributes(valjs, $elm, rule, jsConfig) {
var resolvedConfiguration = { },
ruleName = rule.name,
attrName = "data-" + valjs.config.attrPrefix + ruleName,
attrValue = valjsGetAttr($elm, attrName),
binding = nullValue,
tmp,
attrData,
already_bound = !valjsIsUndefined(jsConfig.elmRules) && !valjsIsUndefined(jsConfig.elmRules[rule.name]);
// If there is no data- attribute, try the customBind call:
if (!already_bound) {
if (valjsIsUndefined(attrValue)) {
tmp = valjsRuleCustomBind(valjs, rule, $elm);
binding = tmp.binding;
resolvedConfiguration.elmRules = tmp.elmRules;
} else {
resolvedConfiguration.elmRules = {};
resolvedConfiguration.elmRules[rule.name] = 'attribute';
}
} else {
binding = {data : {}};
}
if (!valjsIsUndefined(attrValue)) {
binding = { data: {} };
// If the value is empty we'll use the default value from the rule, if available
if (attrValue === "") {
if (!valjsIsUndefined(rule.options) && !valjsIsUndefined(rule.options.value)) {
attrValue = rule.options.value;
}
}
binding.data.value = attrValue;
}
if (binding || already_bound) {
resolvedConfiguration.elmRules = {};
resolvedConfiguration.elmRules[rule.name] = 1;
attrData = {};
if (binding !== nullValue) {
attrData = valjsRuleParseElementAttributes(attrName, $elm, rule);
}
resolvedConfiguration = $.extend(trueValue, {}, resolvedConfiguration, binding.data, attrData);
if (!valjsIsUndefined(resolvedConfiguration.msg)) {
resolvedConfiguration.msg = valjsGetMsgConfig(resolvedConfiguration.msg);
}
}
return resolvedConfiguration;
}
function valjsGetFilteredJ5Object(valjs) {
return {
config: valjs.config,
context: valjs.jqContext,
form: valjs.$form
};
}
function valjsFindLabelElement($elm, valjs) {
var id = $elm.attr('id'),
labelElement = (id ? valjsSelectElements("label[for='" + $elm.attr('id') + "']", valjs.jqContext) : nullValue);
if (!id || valjsLength(labelElement) === 0) {
if ($elm.parent().get(0).nodeName === 'LABEL') {
labelElement = $elm.parent();
}
}
return labelElement;
}
/**
* [valjsInvokeEvent description]
* @param {{trigger : function(*)}} target [description]
* @param {string} name [description]
* @param {*} options [description]
* @return {*} [description]
*/
function valjsInvokeEvent(target, name, options) {
var newEvent = jQuery.Event(name + eventNamespace, options);
target.trigger(newEvent);
return newEvent;
}
/**
* [valjsRefreshField description]
* @param {*} valjs [description]
* @param {*} $elm [description]
* @param {*} refresh [description]
* @return {*} [description]
*/
function valjsRefreshField(valjs, $elm, refresh) {
/** @type { {hide : function()} | * } */
var $msg,
status = refresh.status,
elmConfig = valjsData($elm, dataNameValjsBinding).getCfg(),
state = refresh.state,
message = refresh.message,
modifers = nullValue,
hasMsg = message !== "",
createMsg = hasMsg && status !== 'valid',
$lbl,
hideMsg = falseValue;
$lbl = valjsFindLabelElement($elm, valjs);
if (status === 'valid') {
modifers = 'valid';
hideMsg = trueValue;
} else {
if (status === 'unknown') {
modifers = 'unknown';
hideMsg = trueValue;
} else {
modifers = [status, state];
if (status === "busy") {
hideMsg = falseValue;
}
}
}
refresh.ruleConfig = elmConfig[refresh.rule];
$msg = invokeElementFindMsgFunction({
element : $elm,
valjs : valjs,
create : createMsg,
validation : refresh
});
if (valjsLength($msg) === 1) {
if (hideMsg) {
$msg.html('').hide();
} else {
$msg.html(message);
}
valjsSetClass($msg, valjs, 'msg', modifers);
}
valjsSetClass($elm, valjs, 'field', modifers);
if (valjsLength($lbl) === 1) {
valjsSetClass($lbl, valjs, 'label', modifers);
}
return $elm;
}
function valjsResetElementStatus($elm, valjs) {
var binding = valjsData($elm, dataNameValjsBinding),
refreshData,
e;
binding.r(dataNameValjsValidationStatus);
refreshData = { status: 'unknown' };
e = valjsInvokeEvent($elm, 'refreshfield', {
valjs: $.extend(refreshData, { binding : binding, context : valjs.jqContext, form : valjs.$form, element : $elm})
});
if (!e.isDefaultPrevented()) {
valjsRefreshField(valjs, $elm, refreshData);
}
}
function valjsCleanupElement($elm, valjs) {
var $msg = invokeElementFindMsgFunction($elm, valjs, falseValue),
$label = valjsFindLabelElement($elm, valjs);
if ($msg) {
$msg.hide();
}
valjsRemoveClass($elm, valjsGetClass(valjs, 'field'));
valjsRemoveClass($elm, valjs.vars.field);
if ($label) {
valjsRemoveClass($label, valjsGetClass(valjs, 'label'));
valjsRemoveClass($label, valjs.vars.label);
}
valjsRemoveData($elm, dataNameValjsBinding);
valjsRemoveData($elm, dElmType);
valjsRemoveData($elm, dataNameValJsInstance);
valjsRemoveData($elm, dataNameValJsValueCache);
}
function valjsTestIsElementReadyForValidation($elm) {
return $elm.is(':visible') && !$elm.is(':disabled');
}
function valjsGetElementBoundRules($elm) {
var rules = valjsData($elm, dataNameValjsBinding).getCfg();
return rules;
}
function valjsGetNamedMessageFromRuleResult(result) {
var namedMessage;
if (typeof result === "boolean") {
namedMessage = keyNameDefault;
} else if (typeof result === "object") {
namedMessage = result.msg;
} else if (valjsIsString(result)) {
namedMessage = result;
}
return namedMessage;
}
function valjsGetValidationMessage(execParameters, config, originalValue) {
var message = originalValue,
namedMessage = execParameters.msgName;
//console.warn("config", config);
if (valjsIsFunction(config.msg)) {
message = config.msg(execParameters);
} else if (!valjsIsUndefined(config.msg) && !valjsIsUndefined(config.msg[namedMessage])) {
if (valjsIsFunction(config.msg[namedMessage])) {
message = config.msg[namedMessage](execParameters);
} else if (valjsIsString(namedMessage)) {
message = config.msg[namedMessage];
}
} else {
message = execParameters.msgName;
}
return message;
}
function valjsParseRuleResult(result, execParameters) {
var resultObject,
returnValue = { ok : trueValue, result : nullValue },
rule = execParameters.rule,
message = "";
if (result !== trueValue && (typeof result !== "object" || result.msg)) {
execParameters.msgName = valjsGetNamedMessageFromRuleResult(result);
resultObject = result;
if (typeof result === "object") {
// console.warn("message name", execParameters.msgName);
resultObject = $.extend(trueValue, {}, result);
//delete resultObject.msg;
execParameters.result = resultObject;
//console.warn(resultObject);
}
// it should be used if it's been specified otherwhere
if (rule.options && rule.options.msg && rule.options.msg[keyNameDefault] === nullValue) {
if (execParameters.config.msg[keyNameDefault] !== nullValue) {
execParameters.msgName = keyNameDefault;
}
}
//console.warn(rule.name, execParameters.msgName);
message = valjsGetValidationMessage(execParameters, execParameters.config, result);
if (result !== false) {
if (typeof result === "object") {
result = $.extend(true, {}, result, {msg : message});
} else {
result = {
msg : message
};
}
} else {
result = {
msg : message
};
}
returnValue.ok = falseValue;
returnValue.result = result;
//console.warn("result", returnValue.result.msg)
} else {
returnValue.result = result;
}
return returnValue;
}
function valjsTriggerElementValidationEvent(valjs, $elm, elementValidationResult, submit) {
var refreshData, label, e, isValid = -1,
binding = valjsData($elm, dataNameValjsBinding),
isUndefined = valjsIsUndefined(valjs);
if (!isUndefined && valjsLength(elementValidationResult.fail) > 0) {
binding.setRuleContext(elementValidationResult.fail[0].rule);
refreshData = {
status: 'invalid',
state: submit ? 'error' : 'warning',
message: elementValidationResult.fail[0].msg,
rule: elementValidationResult.fail[0].rule
};
label = valjsFindLabelElement($elm, valjs);
if (label) {
refreshData.label = label.text();
}
} else {
refreshData = { status: 'valid' };
isValid = 1;
}
// Anything busy?
if (!isUndefined && isValid === 1 && valjsLength(elementValidationResult.busy) > 0) {
refreshData.status = "busy";
refreshData.message = elementValidationResult.busy[0].msg;
isValid = 0;
}
binding.s(dataNameValJsIsValid, isValid);
binding.s(dataNameValjsValidationStatus, refreshData);
e = valjsInvokeEvent($elm, 'refreshfield', {
currentTarget : $elm.get(0),
valjs: $.extend(refreshData, {
binding : binding,
context : valjs.jqContext,
form : valjs.$form,
element : $elm
})
});
if (!e.isDefaultPrevented()) {
valjsRefreshField(valjs, $elm, refreshData);
}
binding.setRuleContext(nullValue);
return isValid === 1 ? isValid : refreshData;
}
function valjsRuleRun(valjs, $elm, elementValue, event, rule, config) {
var execParameters = {
'binding' : valjsData($elm, dataNameValjsBinding),
'event': event,
'config': config,
'valjs': valjs,
'element' : $elm,
'field': $.extend({ value: elementValue.value }, valjsGetElementType($elm))
},
result;
execParameters.binding.setRuleContext(rule.name);
result = rule.run(execParameters, $elm);
execParameters.binding.setRuleContext(nullValue);
if (rule.async) {
// This must be a $.Deferred object
return result;
}
return valjsParseRuleResult(result, {
valjs: valjs,
config : config,
rule : rule,
element : $elm,
msgName : nullValue
});
}
function valjsStringChecksum(str) {
var hash = 5381, i, c;
for (i = 0; i < valjsLength(str); i += 1) {
c = str.charCodeAt(i);
hash = ((hash << 5) + hash) + c;
}
return hash;
}
function valjsRunRulesForElement(valjs, ruleNames, $elm, elementValue, submit, event) {
var rule_index,
rules = valjsGetElementBoundRules($elm),
binding = $elm.data(dataNameValjsBinding),
currentRule,
busy,
config,
asyncFailed,
ret = {
hash : [],
fail : [],
busy : [],
success : [],
unresolved : []
},
asyncId,
result,
ruleStatus,
isAsync,
shouldRun = false;
for (rule_index = 0; rule_index < valjsLength(ruleNames); rule_index += 1) {
currentRule = wj.rules[ruleNames[rule_index]];
config = rules[ruleNames[rule_index]];
isAsync = currentRule.async;
ruleStatus = binding.getRuleStatus(currentRule.name);
result = null;
if (ruleStatus.status === true) {
result = ruleStatus.result;
if (result.ok === falseValue) {
ret.hash.push(currentRule.name + result.result);
ret.fail.push(result.result);
} else {
ret.success.push($.extend(trueValue, {}, result, { rule : currentRule.name}));
}
} else {
busy = binding.g(ruleNames[rule_index] + '_busy');
if (busy) {
valjs.workers.remove(busy.asyncId);
if (currentRule.abort) {
currentRule.abort();
}
}
// if deferred, only run if there are no failed rules
if (isAsync && ret.fail.length !== 0) {
binding.setRuleStatus(currentRule.name, false);
ret.hash.push(currentRule.name);
} else {
busy = binding.g(ruleNames[rule_index] + '_resolved');
asyncFailed = binding.g(ruleNames[rule_index] + '_asyncfail');
if (!valjsIsUndefined(busy)) {
result = busy;
binding.r(ruleNames[rule_index] + '_resolved');
valjs.workers.remove(result.asyncId);
binding.setRuleStatus(currentRule.name, true, result);
} else if (!valjsIsUndefined(asyncFailed)) {
result = asyncFailed;
valjs.workers.remove(result.asyncId);
binding.r(ruleNames[rule_index] + '_asyncfail');
if (config.allowFailed === true) {
binding.setRuleStatus(currentRule.name, true, true);
result = { ok : true, result : true};
}
} else {
shouldRun = true;
if (!submit && currentRule.checkEvent) {
// Test if the rule should run
// But for submit it should always run
shouldRun = currentRule.checkEvent(event);
binding.setRuleStatus(currentRule.name, false);
}
if (shouldRun) {
result = valjsRuleRun(valjs, $elm, elementValue, event, currentRule, config);
ret.hash.push(currentRule.name + "_hash");
if (isAsync) {
asyncId = currentRule.name + ((new Date().getTime() / 1000));
valjs.workers.add(asyncId);
busy = $.extend(trueValue, {}, { rule : currentRule.name, asyncId : asyncId});
busy.msg = valjsGetValidationMessage({
valjs: valjs,
config : config,
rule : currentRule,
element : $elm,
msgName : 'busy'
}, config );
ret.busy.push(busy);
binding.s(ruleNames[rule_index] + '_busy', busy);
result
.fail(function (result) {
result = valjsParseRuleResult(result, {
valjs: valjs,
config : config,
rule : currentRule,
element : $elm,
msgName : nullValue,
asyncId : asyncId
});
result.asyncId = asyncId;
binding.s(currentRule.name + '_asyncfail', result);
binding.r(currentRule.name + '_busy');
$elm.valjs('validateField', {
force : true,
submit : submit
});
})
.done(function (result) {
result = valjsParseRuleResult(result, {
valjs: valjs,
config : config,
rule : currentRule,
element : $elm,
msgName : nullValue
});
result.asyncId = asyncId;
binding.s(currentRule.name + '_resolved', result);
binding.r(currentRule.name + '_busy');
$elm.valjs('validateField', {
force : true,
submit : submit
});
});
} else {
binding.setRuleStatus(currentRule.name, true, result);
}
}
}
}
if (result) {
if (result.ok === falseValue) {
ret.hash.push(currentRule.name + result.result.msg);
ret.fail.push($.extend(trueValue, {}, result.result, { rule : currentRule.name}));
} else {
ret.success.push($.extend(trueValue, {}, "success", { rule : currentRule.name}));
}
}
}
}
valjs.workers.commitRemove();
ret.hash = valjsStringChecksum((submit ? '1' : '0') + ret.hash.join('|'));
//elementValidationResult.hash = (new Date());
return ret;
}
function valjsInvokeElementValidation($elm, valjs, event, elementValue, submit, force) { // , valjs, event
var binding = valjsData($elm, dataNameValjsBinding),
rules = valjsGetElementBoundRules($elm),
ruleNames = rules ? rules.ruleNames : nullValue,
isValid,
previousHash = binding.g(dataNameValJsHash),
elementValidationResult;
if (valjs.config.liveValidation === falseValue && !submit && !force) {
return;
}
if (!valjsTestIsElementReadyForValidation($elm)) {
if (binding.g(dataNameValJsHash)) {
valjsResetElementStatus($elm, valjs);
}
return;
}
if (valjsIsUndefined(submit)) {
submit = falseValue;
}
if (valjsIsUndefined(elementValue)) {
elementValue = valjsGetElementValue($elm, event);
}
// Get validation results and make sure hash is updatd
elementValidationResult = valjsRunRulesForElement(valjs, ruleNames, $elm, elementValue, submit, event);
binding.updateResults(elementValidationResult);
// console.warn(elementValidationResult);
//console.warn( previousHash, elementValidationResult );
if (previousHash === elementValidationResult.hash && valjs.config.alwaysTriggerFieldEvents === falseValue) {
return binding.g(dataNameValjsValidationStatus);
}
binding.s(dataNameValJsHash, elementValidationResult.hash);
isValid = valjsTriggerElementValidationEvent(valjs, $elm, elementValidationResult, submit);
return isValid;
}
function ValJSBindingBase() { return; }
ValJSBindingBase.prototype.hasRule = $.noop;
ValJSBindingBase.prototype.getFieldType = $.noop;
ValJSBindingBase.prototype.getRules = $.noop;
ValJSBindingBase.prototype.resetField = $.noop;
ValJSBindingBase.prototype.validateField = $.noop;
ValJSBindingBase.prototype.getContext = $.noop;
ValJSBindingBase.prototype.getForm = $.noop;
ValJSBindingBase.prototype.isValid = $.noop;
ValJSBindingBase.prototype.getRule = $.noop;
ValJSBindingBase.prototype.getFieldValue = $.noop;
ValJSBindingBase.prototype.getFieldStatus = $.noop;
/**
* Class responsible for identifying and extracting rules and configuration for a field
* @param {[type]} valjs [description]
* @param {[type]} jqElement [description]
*/
function ValjsElementBinding(valjsInstance, jqElement) {
var rules = wj.rules,
fieldRules = nullValue,
self = this,
ruleContext = nullValue,
data = {},
ruleStatus = {};
this.s = function (key, val) {
data[key] = val;
};
this.g = function (key) {
return data[key];
};
this.r = function (key) {
delete data[key];
};
this.updateResults = function(validationresult) {
var g = this.getResults();
if (g) {
if(validationresult.hash === g.hash) {
return;
}
}
self.s('elementStatus', validationresult);
self.s('elementStatusT', (new Date()));
valjsInstance.elementUpdated(self);
};
this.getResults = function() {
return self.g('elementStatus');
};
this.setRuleStatus = function (name, status, result) {
ruleStatus[name] = { status : status, result : result };
};
this.getRuleStatus = function (name) {
return ruleStatus[name] || { status : falseValue};
};
this.resetRuleStatus = function () {
ruleStatus = {};
};
this.waitingRules = function () {
var name, i;
for (i = 0; i < fieldRules.ruleNames.length; i += 1) {
name = fieldRules.ruleNames[i];
if (self.getRuleStatus(name).status === false) {
return true;
}
}
return false;
};
function extractFieldRules(cfgFieldGlobal, cfgInstanceGlobal) {
var elmConfig,
rule_index = 0,
ruleOptions,
cfgFieldAttr,
cfgInstanceFieldRule,
extractedRules = { ruleNames : []};
for (rule_index = 0; rule_index < valjsLength(rules.k); rule_index += 1) {
elmConfig = {};
ruleOptions = !valjsIsUndefined(rules[rules.k[rule_index]].options) ? rules[rules.k[rule_index]].options : {};
cfgInstanceFieldRule = valjsGetElementConfig(jqElement, rules.k[rule_index], valjsInstance.config, falseValue);
elmConfig = $.extend(trueValue, {}, ruleOptions, cfgInstanceGlobal, cfgInstanceFieldRule, cfgFieldGlobal);
cfgFieldAttr = valjsGetElementConfigFromAttributes(valjsInstance, jqElement, rules[rules.k[rule_index]], elmConfig);
elmConfig = $.extend(trueValue, elmConfig, cfgFieldAttr);
elmConfig.msg = elmConfig.msg || {};
if (!valjsIsUndefined(elmConfig.elmRules)) {
delete elmConfig.elmRules;
extractedRules.ruleNames.push(rules.k[rule_index]);
extractedRules[rules.k[rule_index]] = elmConfig;
}
}
return extractedRules;
}
this.isValid = function () {
return self.g(dataNameValJsIsValid) === 1;
};
/*function getValjs() {
return valjsInstance;
}*/
function getInstanceGlobalMessage() {
return valjsIsUndefined(valjsInstance.config.msg) ? {} : { msg : valjsGetMsgConfig(valjsInstance.config.msg) };
}
function getFieldGlobalMessage() {
var msgAttribute = valjsGetAttr(jqElement, "data-" + valjsInstance.config.attrPrefix + 'msg');
if (msgAttribute) {
return {
msg : valjsGetMsgConfig(msgAttribute)
};
}
return {};
}
function getInstanceFindFunctions() {
return $.extend({
findMsg : valjsInstance.config.findMsg,
findLabel : valjsInstance.config.findLabel
}, valjsGetElementFindFunctions(jqElement, valjsInstance.config));
}
function triggerSetupFieldCallback() {
var e = {
valjs: valjsInstance,
elm : jqElement,
config: fieldRules
};
if (valjsInstance.config.setupField !== $.noop) {
valjsInstance.config.setupField(e);
}
fieldRules = e.config;
}
function sortFieldRules() {
// Sort field rules by rule priority
fieldRules.ruleNames.sort(function (a, b) {
a = rules[a].prio;
b = rules[b].prio;
return a < b ? -1 : (a > b ? 1 : 0);
});
}
function finalizeElementBinding() {
if (fieldRules.ruleNames.length === 0) {
return;
}
var state;
fieldRules.fieldType = valjsGetElementType(jqElement);
fieldRules.uid = valjsGetUniqueId();
state = valjsData(jqElement, dataNameValjsBinding) ? '' : 'unknown';
valjsJsAddClass(jqElement, valjsGetClass(valjsInstance, 'field', state))
.data(valjsInstance.vars.off, 0); // Validation not disabled
valjsSetClass(valjsFindLabelElement(jqElement, valjsInstance), valjsInstance, 'label', state);
}
function bind() {
var ruleNames = fieldRules.ruleNames.slice(0),
i_index,
currentRule,
bindResult;
if (fieldRules.ruleNames.length === 0) {
valjsCleanupElement(jqElement, valjsInstance);
return;
}
fieldRules.ruleNames = [];
if (valjsLength(ruleNames) === 0) {
return;
}
for (i_index = 0; i_index < valjsLength(ruleNames); i_index += 1) {
currentRule = rules[ruleNames[i_index]];
if (currentRule.bind === nullValue || valjsIsUndefined(currentRule.bind) || currentRule.bind === $.noop) {
bindResult = trueValue;
} else {
self.setRuleContext(currentRule.name);
bindResult = currentRule.bind($.extend(valjsGetFilteredJ5Object(valjsInstance),
{
binding : self,
valjs : valjsInstance,
element: jqElement,
field : valjsGetElementType(jqElement),
config : fieldRules[currentRule.name],
rule : currentRule
}));
self.setRuleContext(nullValue);
}
if (bindResult !== falseValue) {
if (typeof bindResult === "object") {
fieldRules[currentRule.name] = $.extend(trueValue, {}, fieldRules[currentRule.name], bindResult);
}
fieldRules.ruleNames.push(ruleNames[i_index]);
if (currentRule.async) {
self.s('hasAsync', true);
}
} else {
delete fieldRules[ruleNames[i_index]];
}
}
finalizeElementBinding();
return this;
}
this.setRuleContext = function (name) {
ruleContext = name;
};
/**
* Here follows the public methods that can be
* called for e
*/
this.getCfg = function () {
return fieldRules;
};
this.getContext = function () {
return valjsInstance.jqContext;
};
this.getElement = function () {
return jqElement;
};
this.getFieldStatus = function () {
var status = self.g(dataNameValJsIsValid);
if (valjsIsUndefined(status)) {
return 0;
}
return status;
};
this.getForm = function () {
return valjsInstance.$form;
};
this.getRules = function () {
return fieldRules.ruleNames;
};
this.getRule = function (options) {
if (valjsIsUndefined(options)) {
if (ruleContext) {
options = ruleContext;
}
}
if (valjsIsString(options)) {
if (this.hasRule(options)) {
return fieldRules[options];
}
}
return nullValue;
};
this.hasRule = function (name) {
var i = 0;
if (Object.prototype.toString.call(name) === '[object Array]') {
for (i = 0; i < name.length; i += 1) {
if (fieldRules.hasOwnProperty(name[i])) {
return trueValue;
}
}
return falseValue;
}
return fieldRules.hasOwnProperty(name);
};
this.getFieldType = function () {
return valjsGetElementType(jqElement);
};
this.resetField = function () {
valjsResetElementStatus(jqElement, valjsInstance);
return jqElement;
};
this.getFieldValue = function () {
return valjsGetElementValue(jqElement);
};
this.validateField = function (options) {
var value = valjsGetElementValue(jqElement),
submit = options ? options.submit : false;
// $elm, valjs, event, elementValue, submit, force
return valjsInvokeElementValidation(jqElement, valjsInstance, undefined, value, submit, true);
};
function init() {
var instanceGlobal = getInstanceGlobalMessage(),
cfgGlobalFindFunctions = getInstanceFindFunctions(),
cfgFieldGlobal = getFieldGlobalMessage();
// Bind this object to the element
// it will be removed later if no rules were bound
valjsData(jqElement, dataNameValjsBinding, self);
fieldRules = extractFieldRules(cfgFieldGlobal, instanceGlobal);
fieldRules.iFindMsgFn = cfgGlobalFindFunctions.findMsg;
fieldRules.iFindLabelFn = cfgGlobalFindFunctions.findLabel;
sortFieldRules();
triggerSetupFieldCallback();
return this;
}
this.isBound = function () {
return fieldRules.ruleNames.length > 0;
};
init();
bind();
}
ValjsElementBinding.prototype = new ValJSBindingBase();
function startRuleBindingCycle(valjs, element) {
// New from 0.7.5
return (new ValjsElementBinding(valjs, $(element)))
// Exit with the status
.isBound();
}
/**
* [valjsFindMsgElementd escription]
* @param { { nextAll : function(string) : {insertAfter : function(*)} } | * } $elm [description]
* @param {*} valjs [description]
* @param {boolean} create [description]
* @return {*} [description]
*/
function valjsFindMsgElement(options) {
var $elm = options.element,
valjs = options.valjs,
create = options.create,
$after = nullValue,
$msg = valjs.jqContext.find("[data-msg-for='" + $elm.attr('id') + "']");
if (valjs.config.elements && valjs.config.elements.msg && valjsLength($msg) === 0) {
$after = $elm.parent().prop('tagName') === 'LABEL' ? $elm.parent() : $elm;
$msg = $after.next('.' + valjs.config.elements.msg);
}
if (valjsLength($msg) === 0 && create) {
if (valjs.config.createMsg) {
$msg = $('<span>');
$msg = $msg.insertAfter($after);
}
}
if (create) {
$msg.show();
}
return $msg;
}
function valjsTestElementChange(e) {
var binding = valjsData($(this), dataNameValjsBinding),
force = false,
valueInfo;
/*jshint validthis:true */
if (!binding) {
return;
}
// has the value been updated since last time?
/*jshint validthis:true */
valueInfo = valjsGetElementValue($(this), e);
if (e.data.valjs.config.liveValidation === false) {
if (e.type === "focusout") {
valueInfo.upd = trueValue;
force = true;
}
}
if (e.type && e.type === "change" && valueInfo.upd === false && binding.waitingRules(e)) {
valueInfo.upd = trueValue;
}
if (valueInfo.upd === trueValue) { //|| e.type === 'focusout'
/*jshint validthis:true */
valjsInvokeElementValidation($(this), e.data.valjs, e, valueInfo, false, force);
}
}
/**
* This will reference the current valjs context
* in the form-element before it is submitted via
* hitting the Enter key in a field, or clicking the
* submit button for the context in question
* @return {[type]} [description]
*/
function valjsSetFormContext(e) {
var valjs = e.data.valjs,
form = valjs.$form;
if ($(e.target).prop('tagName') === 'TEXTAREA') {
return;
}
form.data(dataNameValJsFormContext, valjs);
if (e.type === 'keydown') {
if (e.keyCode === 13) {
valjsData(form, dataNameValJsFormContext, valjs);
if (valjsLength(valjs.s) > 0) {
e.preventDefault();
e.stopPropagation();
$(valjs.s).first().trigger('click');
} else {
if (valjsLength(form.find(submitQuery)) === 0) {
e.preventDefault();
form.trigger('submit');
return;
}
}
}
}
}
function valjsValidateForm(valjs, e, submit) {
var i, valueInfo, field, validationResult, ret = { invalid: [], busy : [] },
len = valjsLength(valjs.e);
for (i = 0; i < len; i += 1) {
field = $(valjs.e[i]);
valueInfo = valjsGetElementValue(field, e);
validationResult = valjsInvokeElementValidation(field, valjs, e, valueInfo, submit === trueValue ? trueValue : falseValue);
if (!valjsIsUndefined(validationResult) && validationResult !== trueValue) {
if (validationResult.status === 'invalid') {
ret.invalid.push(validationResult);
} else if (validationResult.status === 'busy') {
ret.busy.push(validationResult);
}
}
}
return ret;
}
/**
* Serialize a form or part of a form into a key-value object
* @param object $elm The jQuery element
* @return object The final object
*/
function valjsFormSerialize($elm) {
var serializedArray = $elm.find('input,select,textarea,button').serializeArray(),
returnObject = {},
tmp,
i;
for (i = 0; i < valjsLength(serializedArray); i += 1) {
if (returnObject[serializedArray[i].name]) {
if (valjsIsString(returnObject[serializedArray[i].name])) {
tmp = String(returnObject[serializedArray[i].name]);
returnObject[serializedArray[i].name] = [tmp];
}
returnObject[serializedArray[i].name].push(serializedArray[i].value);
} else {
returnObject[serializedArray[i].name] = serializedArray[i].value;
}
}
return returnObject;
}
function valjsFormSubmit(e, options) {
if (options && options.valjsDone === trueValue) {
// If ValJS's work is done, then we'll let the event go through
return trueValue;
}
/*jshint validthis:true */
var valjs = valjsData($(this), dataNameValJsFormContext),
result = nullValue,
self = $(this),
submitEvent,
eventContext;
//console.warn("[ValJS]" + e.isDefaultPrevented());
if (!valjs) {
// console.warn("no context");
// No current context, then do nothing by triggering an event that says that ValJS is done
//e.preventDefault();
/*jshint validthis:true */
//$(this).trigger('submit', $.extend(true, { valjsDone: trueValue }, e));
return trueValue;
}
valjs.workers.stopWaiting();
eventContext = valjs.jqContext;
/*jshint validthis:true */
$(this).removeData(dataNameValJsFormContext);
// We have a ValJS context. Let's validate it!
result = valjsValidateForm(valjs, e, trueValue);
// Any invalid results?
if (valjsLength(result.invalid) === 0) {
// Any busy async validations?
if (valjsLength(result.busy) === 0) {
// Validation succeeded. Trigger the submitform event
submitEvent = valjsInvokeEvent(eventContext, 'submitform',
{
currentTarget : valjs.context,
target: valjs.$form[0],
valjs: $.extend({}, { form : valjs.$form[0], context : valjs.context, formData : valjsFormSerialize(valjs.jqContext)})
});
if (submitEvent.isDefaultPrevented()) {
// If the submit is stopped from the ValJS Event
e.preventDefault();
} else {
// otherwise submit the form
$(this).trigger('submit', { valjsDone: trueValue });
}
return;
}
valjs.waitForIt(function() {
self.submit();
});
/*valjs.workers.wait(function () {
valjsData(self, dataNameValJsFormContext, valjs);
var val = valjsValidateForm(valjs, null, false);
console.warn("wait is over. submit again", val);
// self.submit();//trigger('submit');
// valjs.workers.stopWaiting();
});*/
}
valjsInvokeEvent(eventContext, 'invalidform',
{
target: valjs.context,
valjs: $.extend({}, result, { form : valjs.$form[0], context : valjs.context })
});
$(this).removeData(dataNameValJsFormContext);
e.preventDefault();
return false;
}
function valjsGetEventNames(names) {
var ret = [], i;
for (i = 0; i < valjsLength(names); i += 1) {
ret.push(names[i] + eventNamespace);
}
return ret.join(' ');
}
function valjsBindElementEvents(valjs) {
//var t = valjsGetElementType($elm);
var textElements = 'textarea, ' +
'input:not([type=checkbox], [type=radio], [type=submit], [type=button])',
listElements = selectTypeName,
cbxElements = 'input[type=checkbox], input[type=radio]';
if (!valjsData(valjs.$form, dataNameValJsBound)) {
valjsData(valjs.$form, dataNameValJsBound, 1);
valjs.$form.on(valjsGetEventNames(['submit']), { valjs: valjs }, valjsFormSubmit);
}
valjs.jqContext
//.off( eventNamespace)
.on(valjsGetEventNames([keydownEvent, keyupEvent]), { valjs: valjs }, valjsSetFormContext)
.on(valjsGetEventNames([clickEvent, changeEvent, keyupEvent]), textElements, { valjs: valjs }, valjsTestElementChange)
.on(valjsGetEventNames([clickEvent, changeEvent]), listElements, { valjs: valjs }, valjsTestElementChange)
.on(valjsGetEventNames([clickEvent, changeEvent]), cbxElements, { valjs: valjs }, valjsTestElementChange);
$(valjs.s)
//.off(eventNamespace)
.on(valjsGetEventNames([clickEvent]), { valjsSubmit: trueValue, valjs: valjs }, valjsSetFormContext);
}
function valjsIndexOf(haystack, needle) {
if (valjsIsUndefined(haystack)) {
return -1;
}
return haystack.indexOf(needle);
}
function valjsInitializeModifierShortcuts(config) {
var elementTypes = config.elements,
suffixes = config.modifiers || {},
modifiers = [],
clean,
type_index,
suffix_index,
i_index,
result = {};
for (suffix_index in suffixes) {
if (suffixes.hasOwnProperty(suffix_index)) {
modifiers.push(suffix_index);
}
}
for (type_index in elementTypes) {
if (elementTypes.hasOwnProperty(type_index)) {
clean = [];
for (i_index = 0; i_index < valjsLength(modifiers); i_index += 1) {
clean.push((config.modifierSeparator ? elementTypes[type_index] + config.modifierSeparator : '') + suffixes[modifiers[i_index]]);
}
result[type_index] = clean.join(' ');
}
}
return result;
}
function valjsFindInputByNameOrSelector($target, name) {
var elm = nullValue;
if (valjsIndexOf(name, '#') === 0) {
return $(name);
}
elm = $target.find('[name="' + name + '"]');
if (valjsLength(elm) === 0) {
elm = $target.find(name).first();
}
return elm;
}
function valjsRefreshElementBindings(valjs) {
var cssSelectors = valjs.config.selector,
elms,
element_index;
valjs.e = [];
//
// Identify and bind validation rules for the elements
//
elms = valjsSelectElements(cssSelectors.elements, valjs.context);
for (element_index = 0; element_index < valjsLength(elms); element_index += 1) {
if (startRuleBindingCycle(valjs, elms[element_index])) {
valjs.e.push(elms[element_index]);
}
}
//
// Attach event listeners for any elements with rules
//
valjsBindElementEvents(valjs);
}
function valjsParseIntBase10(val) {
return parseInt(val, 10);
}
/**
* Get the file length in a human readable format
* @param {[type]} bytes [description]
* @return {[type]} [description]
*
* Slightly modified version of
* https://forrst.com/posts/vaScript_nice_file_size_bytes_to_human_read-tQ3
*/
function valjsFormatBytes(bytes) {
if (bytes === 0) {
return 'n/a';
}
var sizes = ' KMGTPEZY',
i = valjsParseIntBase10(Math.floor(Math.log(bytes) / Math.log(1024)));
return Math.round(bytes / Math.pow(1024, i), 2) + (i > 0 ? ' ' : '') + (i > 0 ? sizes[i] + 'iB' : ' bytes');
}
ValJS.prototype = {
// Default settings
defaults: {
'elements': {
'submit': 'valjs__submit',
'field': 'valjs__field', // Base class for fields
'form': 'valjs__form', // Base class for forms
'label': 'valjs__label', // Base class for labels
'msg': 'valjs__msg', // base class for messages
'context': 'valjs__context' // Base class for context
}, // /modifierClassSuffix
//
// Set to true to check for new input elements even
// if valjs was already active for the specified context
//
alwaysTriggerFieldEvents: falseValue,
liveValidation : trueValue,
createMsg : trueValue, // Set to false to never create new message elements
modifierSeparator : nullValue,
attrPrefix : '',
findMsg : valjsFindMsgElement,
findLabel : valjsFindLabelElement,
allowRuleInitialization : trueValue,
setupField : $.noop,
/**
* Modifiers
* These are always used in combination with elementClassNames.
*
* Example:
* A field will get the class: 'valjs__field valjs__field--unknown' when it's created
* When it's validated will have 'valjs__field valjs__field--valid'
* When not validated it will have 'valjs__field valjs__field--invalid' - plus a valjs__field--error OR valjs__field--warning
*/
'modifiers': {
'valid': 'valjs-valid',
'invalid': 'valjs-invalid',
'unknown': 'valjs-unknown',
'error': 'valjs-error',
'warning': 'valjs-warning',
// For async rules
'busy' : 'valjs-busy',
'failed' : 'valjs-failed'
}, // /modifierClassSuffix
'selector': {
'elements': 'input:not([type=submit], [type=button]),select,textarea',
'submit': submitQuery
},
'submitform' : $.noop
}, // /defaults
ruleDefaults: {
/**
* If the rule is not found by ValJS for an element then testElement is called to
* let the rule itself have an extra look to decide weather or not to bind it
* It can also return default settings that can be configurable via attributes
*
* @type {[type]}
*/
testElement: $.noop,
/**
* The bind function binds the rule to the element. Return false if
* the binding should not be bound
* @type {[type]}
*/
bind: $.noop,
/**
* The rules will be sorted by priority before executed
* @type {Number}
*/
prio : 100,
/**
* Run the rule in the validation process
* @type {[type]}
*/
run: $.noop,
options : { value : trueValue },
findMsg : $.noop
},
validateForm: function () {
var valjs = valjsData($(this), dataNameValJsInstance);
return valjsValidateForm(valjs, jQuery.Event('validateForm'), false);
},
/* getFieldType : function () {
return valjsGetElementType($(this));
},*/
updateBindings : function () {
valjsRefreshElementBindings(valjsData($(this), dataNameValJsInstance));
},
getRuleMessages : function () {
valjsRefreshElementBindings(valjsData($(this), dataNameValJsInstance));
},
init: function () {
this.config = $.extend(trueValue, {}, this.defaults, superglobals, ValJS.global, this.options);
var self = this, // so we can initialize valjs asyncronosly
cssSelectors = this.config.selector;
// Cache classnames to easily clear an element from statuses
this.vars = valjsInitializeModifierShortcuts(this.config);
if (this.jqContext.prop('tagName') === 'FORM') {
this.$form = this.jqContext;
} else {
this.$form = this.jqContext.closest('form');
if (valjsData(this.$form, dataNameValJsInstance)) {
// window.console && window.console.warn(this.jqContext);
throw "valjs: form/context conflict";
}
}
valjsJsAddClass(this.jqContext, valjsGetClass(this, 'context'));
valjsJsAddClass(this.$form.attr('novalidate', ''), valjsGetClass(this, 'form'));
// Find all submit buttons
this.s = $(valjsSelectElements(cssSelectors.submit, this.jqContext));
valjsJsAddClass(this.s, valjsGetClass(this, 'submit'));
if (this.config.submitform) {
if (this.config.submitform !== $.noop) {
this.jqContext.on('submitform.valjs', this.config.submitform);
}
}
// Run initialization async if init is a function
if (valjsIsFunction(this.config.init)) {
setTimeout(function () {
valjsRefreshElementBindings(self);
self.config.init(self);
}, 1);
} else {
valjsRefreshElementBindings(self);
}
return this;
},
/**
* Make sure potentially new elements are also
* included.
* @return {[type]} [description]
*/
refresh: function () {
valjsRefreshElementBindings(this);
},
isElementBound : function () {
return valjsData($(this), dataNameValjsBinding) ? trueValue : falseValue;
},
/**
* To disable validation for elements matching the selector
* @param {[type]} selector
* @return {[type]}
*/
disable: function (selector) {
if (this.valjsv) {
// find was faster than filter...
var elements = this.$elm.find(selector);
valjsData(elements, this.vars.off, 1);
}
}
};
/*function _callByChildElement(method, obj, args, index) {
console.warn(method);
console.warn(obj);
console.warn(args);
$(obj).addClass('valjs__field--off')
return this;
}*/
ValJS.idCounter = 0;
ValJS.ruleDefaults = ValJS.prototype.ruleDefaults;
ValJS.global = {};
ValJS.addRule = valjsAddRule;
ValJS.rules = { k: [] };
function valjsCallByChildElement(o, i, args) {
if (ValJS.prototype[o]) {
return ValJS.prototype[o].apply($(i), args);
}
var binding = valjsData($(i), dataNameValjsBinding);
if (binding) {
return binding[o].apply(binding, args);
}
return {};
}
/**
* Hook it up as a jQuery Plugin
*/
$.fn.valjs = function (options) {
if (ValJS.prototype[options]) {
return ValJS.prototype[options]
.apply($(this), Array.prototype.slice.call(arguments, 1));
}
if (ValjsElementBinding.prototype[options] && valjsData($(this), dataNameValjsBinding)) {
// Call element-level function
var args = Array.prototype.slice.call(arguments, 1),
ret = this.map(function (i) {
return valjsCallByChildElement(options, this, args, i);
});
if (ret.length === 1) {
return ret[0];
}
return ret;
}
if (typeof options === 'object' || !options) {
return this.each(function () {
if (valjsData($(this), dataNameValJsInstance)) {
$(this).valjs('updateBindings');
return this;
}
new ValJS(this, options || {}).init();
});
}
$.error('No ValJS method ' + options);
};
/*
* Here are the built in rules
*
*
*/
// http://stackoverflow.com/questions/16590500/javascript-calculate-date-from-week-number#answer-16591175
/**
* Calculate date from a given week and year
* @param {Number} w [description]
* @param {Number} y [description]
* @return {Date} [description]
*/
function getDateOfISOWeek(y, w) {
var simple = new Date(y, 0, 1 + (w - 1) * 7),
dow = simple.getDay(),
ISOweekStart = simple;
if (dow <= 4) {
ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1);
} else {
ISOweekStart.setDate(simple.getDate() + 8 - simple.getDay());
}
return ISOweekStart;
}
function valjsGetWeekYear(date) {
date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
return date.getFullYear();
}
/* function valjsDateWeek(date) {
date.setHours(0, 0, 0, 0);
// Thursday in current week decides the year.
date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
// January 4 is always in week 1.
var week1 = new Date(date.getFullYear(), 0, 4);
// Adjust to Thursday in week 1 and count number of weeks from date to week1.
return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);
}*/
function valjsGetDatePattern(format, macros) {
var i, indexes = {}, n = 0, find, replace,
ret = {
isDate : falseValue,
isWeek : falseValue,
isDateRelated : falseValue,
pattern : '',
macroPositions : []
};
for (i = 0; i < valjsLength(macros); i += 1) {
ret.macroPositions.push([macros[i], valjsIndexOf(format, '%' + macros[i])]);
if (macros[i] === 'm') {
ret.isDate = trueValue;
} else if (macros[i] === 'H') {
// One macro is hour, so it's a datetime
ret.isDateTime = trueValue;
} else if (macros[i] === 'w') {
ret.isWeek = trueValue;
}
}
ret.isDateRelated = ret.isDate || ret.isDateTime;
ret.isDate = !ret.isWeek && !ret.isDateTime;
ret.macroPositions.sort(function (a, b) {
a = a[1];
b = b[1];
return a < b ? -1 : (a > b ? 1 : 0);
});
for (i = 0; i < ret.macroPositions.length; i += 1) {
if (ret.macroPositions[i][1] !== -1) {
indexes[ret.macroPositions[i][0]] = n;
n += 1;
}
}
ret.pattern = format.replace('.', '\\.').replace('(', '\\(').replace(')', '\\)').replace(/\\/g, '\\\\');
for (i = 0; i < valjsLength(macros); i += 1) {
find = '%' + macros[i];
switch (macros[i]) {
case 'y':
replace = "(\\d{4})";
break;
default:
replace = "(\\d{1,2})";
break;
}
ret.pattern = ret.pattern.replace(find, replace);
}
return ret;
}
function valjsMapDateRelatedDateParts(data, find) {
var d, ret;
find.m -= 1;
if (data.isDate) {
d = new Date(find.y, find.m, find.d);
} else {
d = new Date(find.y, find.m, find.d, find.H, find.M);
}
if (d.getFullYear() === find.y) {
if (d.getMonth() === find.m) {
if (d.getDate() === find.d) {
if (data.isDateTime) {
if (d.getHours() === find.H && d.getMinutes() === find.M) {
ret = $.extend(trueValue, {}, find, {'date' : d});
}
} else {
ret = $.extend(trueValue, {}, find, {'date' : d});
}
}
}
}
return ret;
}
function valjsMapWeekDateParts(find) {
var d, ret;
d = getDateOfISOWeek(find.y, find.w);
if (find.w === 1) {
if (valjsGetWeekYear(d) === find.y - 1) {
ret = $.extend(trueValue, {}, find, {'date' : d});
}
}
if (d.getFullYear() === valjsGetWeekYear(d) && d.getFullYear() === find.y) {
ret = $.extend(trueValue, {}, find, {'date' : d});
}
return ret;
}
function valjsExtractDateParts(dateString, format, macros) {
if (dateString === 'now') {
return {date: new Date()};
}
var i,
data,
find,
matches,
ret = nullValue,
re;
data = valjsGetDatePattern(format, macros);
re = new RegExp("^" + data.pattern + "$");
if (re) {
matches = re.exec(dateString);
if (matches) {
find = {};
for (i = 1; i < matches.length; i += 1) {
find[data.macroPositions[i - 1][0]] = valjsParseIntBase10(matches[i]);
}
if (data.isDateRelated) {
ret = valjsMapDateRelatedDateParts(data, find);
} else {
ret = valjsMapWeekDateParts(find);
}
}
}
return ret;
}
function valjsDateMinMax(valjsArgs, date, format, macros) {
var max = valjsExtractDateParts(valjsArgs.config.max, format, macros),
min = valjsExtractDateParts(valjsArgs.config.min, format, macros);
if (min && date < min.date) {
return 'min';
}
if (max && date > max.date) {
return 'max';
}
return trueValue;
}
function valjsWeekMinMax(valjsArgs, data, format, macros) {
var max = valjsExtractDateParts(valjsArgs.config.max, format, macros),
min = valjsExtractDateParts(valjsArgs.config.min, format, macros);
if (min && data.date < min.date) {
return 'min';
}
if (max && data.date > max.date) {
return 'max';
}
return trueValue;
}
function valjsTryParseDate(valjsArgs, type) {
var datestring = valjsArgs.field.value,
format = valjsArgs.config.format,
parsed;
if (type === "d") {
parsed = valjsExtractDateParts(datestring, format, ['y', 'm', 'd']);
if (parsed) {
return valjsDateMinMax(valjsArgs, parsed.date, '%y-%m-%d', ['y', 'm', 'd']);
}
} else if (type === "dt") {
parsed = valjsExtractDateParts(datestring, format, ['y', 'm', 'd', 'H', 'M']);
if (parsed) {
return valjsDateMinMax(valjsArgs, parsed.date, '%y-%m-%d %H:%M', ['y', 'm', 'd', 'H', 'M']);
}
} else if (type === "w") {
parsed = valjsExtractDateParts(datestring, format, ['y', 'w']);
if (parsed) {
return valjsWeekMinMax(valjsArgs, parsed, '%y-W%w', ['y', 'w']);
}
}
return falseValue;
}
function valjsGetMinMaxIfMultiselect(element, getAttr) {
var elm = element.valjs('getFieldType'),
val = valjsGetAttr(element, getAttr);
if (elm.type === 'select' && elm.isMultiple === trueValue) {
return !valjsIsUndefined(val) ? { value : val } : falseValue;
}
return falseValue;
}
/**
* Require a minimum number of items to be selected in a
* multiple select list
*
* data-listmin-min="2" or min="2"
*/
valjsAddRule('listmin', {
options : {
msg : 'Select more items'
},
testElement: function (valjsArgs) {
return valjsGetMinMaxIfMultiselect(valjsArgs.element, 'min');
},
run: function (valjsArgs) {
var value = valjsArgs.config.value,
selectedElements = valjsLength(valjsSelectElements('option:selected', valjsArgs.element));
return selectedElements >= value;
},
bind: function (valjsArgs) {
return {
value: valjsParseIntBase10(valjsArgs.config.value)
};
}
});
valjsAddRule('listmax', {
options : {
msg : 'Too many items selected'
},
testElement: function (valjsArgs) {
return valjsGetMinMaxIfMultiselect(valjsArgs.element, 'max');
},
run: function (valjsArgs) {
var value = valjsArgs.config.value,
selectedElements = valjsLength(valjsSelectElements('option:selected', valjsArgs.element));
return selectedElements <= value;
},
bind: function (valjsArgs) {
return {
value : valjsParseIntBase10(valjsArgs.config.value)
};
}
});
/**
* Require a field to contain a date in a specific pattern
*
* type="date" or data-date
*/
valjsAddRule(ruleNameDate, {
options : {
msg : {
'error' : 'Invalid date',
'max' : 'Enter an earlier date',
'min' : 'Enter a later date'
},
format : '%y-%m-%d'
},
testElement: function (valjsArgs) {
return valjsArgs.element.attr('type') === valjsArgs.rule.name;
},
bind: function (valjsArgs) {
var element = valjsArgs.element,
attrValue,
ret = {};
attrValue = valjsGetAttr(element, 'min');
if (attrValue) {
ret.min = attrValue;
}
attrValue = valjsGetAttr(element, 'max');
if (attrValue) {
ret.max = attrValue;
}
return ret;
},
run: function (valjsArgs) {
var d;
if (valjsLength(valjsArgs.field.value) === 0) {
return trueValue;
}
d = valjsTryParseDate(valjsArgs, 'd');
return d;
}
});
valjsAddRule('datetime', {
options : {
msg : {
'error' : 'Invalid date',
'max' : 'Enter an earlier date',
'min' : 'Enter a later date'
},
format : '%y-%m-%d %H:%M'
},
testElement: function (valjsArgs) {
return valjsArgs.element.attr('type') === valjsArgs.rule.name;
},
bind: function (valjsArgs) {
var element = valjsArgs.element,
attrValue,
ret = {};
attrValue = valjsGetAttr(element, 'min');
if (attrValue) {
ret.min = attrValue;
}
attrValue = valjsGetAttr(element, 'max');
if (attrValue) {
ret.max = attrValue;
}
return ret;
},
run: function (valjsArgs) {
if (valjsLength(valjsArgs.field.value) === 0) {
return trueValue;
}
return valjsTryParseDate(valjsArgs, 'dt');
}
});
valjsAddRule(ruleNameWeek, {
options : {
msg : {
'error' : 'Invalid week',
'max' : 'Enter an earlier week',
'min' : 'Enter a later week'
},
format : '%y-W%w'
},
testElement: function (valjsArgs) {
return valjsArgs.element.attr('type') === valjsArgs.rule.name;
},
bind: function (valjsArgs) {
var element = valjsArgs.element,
attrValue,
ret = {};
attrValue = valjsGetAttr(element, 'min');
if (attrValue) {
ret.min = attrValue;
}
attrValue = valjsGetAttr(element, 'max');
if (attrValue) {
ret.max = attrValue;
}
return ret;
},
run: function (valjsArgs) {
if (valjsLength(valjsArgs.field.value) === 0) {
return trueValue;
}
return valjsTryParseDate(valjsArgs, 'w');
}
});
valjsAddRule('required', {
options : {
msg : 'Required',
trim : falseValue, // True if text fields should be
emptyIndex : undefined, // (Lists) the value that should count as "not selected"
emptyValue : undefined // (Lists) the index that should count as "not selected"
},
// We want the required rule to execute first
prio : 10,
testElement: function (valjsArgs) {
return !valjsIsUndefined(valjsArgs.element.attr(valjsArgs.rule.name));
},
run: function (valjsArgs) {
var $elm = valjsArgs.element,
type = valjsArgs.field.type,
val = valjsArgs.field.value,
idx = 0;
if (type === 'text' || type === 'textarea' || type === "file") {
val = valjsArgs.config.trim === trueValue ? $.trim(valjsArgs.field.value) : val;
if (valjsLength(val) === 0) {
return keyNameDefault;
}
} else {
if (type === selectTypeName) {
if (valjsIsUndefined($elm.attr('multiple'))) {
if (!valjsIsUndefined(valjsArgs.config.emptyIndex)) {
idx = valjsParseIntBase10(valjsArgs.config.emptyIndex);
val = valjsSelectElements('option:selected', $elm).index();
if (val === idx) {
return keyNameDefault;
}
return trueValue;
}
if (!valjsIsUndefined(valjsArgs.config.emptyValue)) {
if (val[0] === valjsArgs.config.emptyValue) {
return keyNameDefault;
}
return trueValue;
}
if (valjsLength(val[0]) === 0) {
return keyNameDefault;
}
} else {
if (valjsLength(val) === 0) {
return keyNameDefault;
}
}
} else {
if (type === 'checkbox' || type === "radio") {
if (val === falseValue) {
return keyNameDefault;
}
}
}
}
return trueValue;
}
});
function valjsParseNumber(val, separator, decimal) {
var parsed;
if (!val) {
return NaN;
}
if (separator !== '.') {
val = val.replace('.', '=-=!');
}
val = val.replace(separator, '.');
val = val.replace(/^0+(\d)/, "$1");
if (decimal) {
val = val.replace(/\.0+$/, "");
if (val.indexOf('.') !== -1) {
val = val.replace(/\.([0-9]+?)(0+)$/, ".$1");
}
}
parsed = decimal ? parseFloat(val) : valjsParseIntBase10(val);
if (String(parsed) === String(val)) {
return parsed;
}
return NaN;
}
valjsAddRule(rulenameNumber, {
options : {
msg : {
'error' : 'Not a number',
'max' : 'Value too high',
'min' : 'Value too low'
},
separator : '.',
step : nullValue
},
testElement: function (valjsArgs) {
return valjsArgs.element.attr("type") === "number";
},
run: function (valjsArgs) {
var val = valjsArgs.field.value,
decimal = valjsArgs.config.step === 'any',
max = valjsParseNumber(valjsArgs.config.max, '.', decimal),
min = valjsParseNumber(valjsArgs.config.min, '.', decimal),
parsed = val;
if (valjsLength(val) !== 0) {
parsed = valjsParseNumber(val, valjsArgs.config.separator, decimal);
if (isNaN(parsed)) {
return falseValue;
}
if (!isNaN(min)) {
if (parsed < min) {
return 'min';
}
}
if (!isNaN(max)) {
if (parsed > max) {
return 'max';
}
}
return trueValue;
}
return trueValue;
},
bind: function (valjsArgs) {
return {
step : valjsGetAttr(valjsArgs.element, 'step'),
min : valjsGetAttr(valjsArgs.element, 'min'),
max : valjsGetAttr(valjsArgs.element, 'max')
};
}
});
function valjsTestBindTextLength(fieldType) {
if (fieldType.type === "text" || fieldType.type === "textarea") {
if (!fieldType.date && !fieldType.number && !fieldType.week && !fieldType.datetime) {
return trueValue;
}
}
}
function ruleHelperGetFieldValue(valjsArgs) {
return valjsArgs.binding.getFieldValue().value;
}
function ruleHelperGetRuleConfig(valjsArgs) {
return valjsArgs.binding.getRule();
}
function ruleHelperGetElement(valjsArgs) {
return valjsArgs.binding.getElement();
}
function ruleHelperGetFieldType(valjsArgs) {
return valjsArgs.binding.getFieldType();
}
function ruleHelperHasRules(valjsArgs, name) {
return valjsArgs.binding.hasRule(name);
}
valjsAddRule('textmax', {
options : {
msg : {
'error' : 'Text too long'
}
},
prio : 150,
testElement: function (valjsArgs) {
var fieldType = valjsArgs.element.valjs('getFieldType'),
val = valjsGetAttr(valjsArgs.element, 'max');
if (val) {
if (valjsTestBindTextLength(fieldType)) {
return {
value : val
};
}
}
},
bind : function (valjsArgs) {
var config = ruleHelperGetRuleConfig(valjsArgs);
// We do not want to bind if the other rules that use min or max
// are bound to this element
if (ruleHelperHasRules(valjsArgs, rulesUsingMinMax)) {
return falseValue;
}
// Make sure the value is an integer when we bind the rule
return $.extend(trueValue, config, {
value : valjsParseIntBase10(config.value)
});
},
run: function (valjsArgs) {
var value = ruleHelperGetFieldValue(valjsArgs),
config = ruleHelperGetRuleConfig(valjsArgs);
if (value) {
if (valjsLength(value) > config.value) {
return falseValue;
}
}
return trueValue;
}
});
valjsAddRule('textmin', {
options : {
msg : {
'error' : 'Text too short'
}
},
prio : 150,
testElement: function (valjsArgs) {
var fieldType = valjsArgs.element.valjs('getFieldType'),
val = valjsGetAttr(valjsArgs.element, 'min');
if (val) {
if (valjsTestBindTextLength(fieldType)) {
return {
value : val
};
}
}
},
bind: function (valjsArgs) {
var config = ruleHelperGetRuleConfig(valjsArgs);
// We do not want to bind if the other rules that use min or max
// are bound to this element
if (ruleHelperHasRules(valjsArgs, rulesUsingMinMax)) {
return falseValue;
}
// Make sure the value is an integer when we bind the rule
return $.extend(trueValue, config, {
value : valjsParseIntBase10(config.value)
});
},
run: function (valjsArgs) {
var value = ruleHelperGetFieldValue(valjsArgs);
if (value) {
if (valjsLength(value) < ruleHelperGetRuleConfig(valjsArgs).value) {
return falseValue;
}
}
return trueValue;
}
});
valjsAddRule(ruleNameFileMax, {
options : {
msg : {
'error' : nullValue,
'one' : 'File too large',
'all' : 'Total size too large'
}
},
testElement: function (valjsArgs) {
var fieldType = valjsArgs.element.valjs('getFieldType'),
val = valjsGetAttr(valjsArgs.element, 'max');
if (fieldType.type === "file" && val) {
return {
value : val
};
}
},
bind: function (valjsArgs) {
var config = ruleHelperGetRuleConfig(valjsArgs);
// Make sure the value is an integer when we bind the rule
return $.extend(trueValue, config, {
value : valjsParseIntBase10(config.value)
});
},
run: function (valjsArgs) {
var max = ruleHelperGetRuleConfig(valjsArgs).value,
element = ruleHelperGetElement(valjsArgs),
singleFileSize,
f = element[0].files,
flen = valjsLength(f),
file_index,
file_size = 0;
if (flen > 0) {
for (file_index = 0; file_index < flen; file_index += 1) {
singleFileSize = f[file_index].size;
file_size += singleFileSize;
if (singleFileSize > max) {
return {
msg : 'one',
maxKiB : max,
maxsize: valjsFormatBytes(max),
filename : f[file_index].name,
fileKiB : singleFileSize,
filesize : valjsFormatBytes(singleFileSize)
};
}
}
if (file_size > max) {
return {
msg : 'all',
totalKiB : file_size,
totalsize : valjsFormatBytes(file_size),
maxsize : valjsFormatBytes(max),
maxKiB : max
};
}
}
return trueValue;
}
});
valjsAddRule(ruleNameFileMin, {
options : {
msg : {
'error' : nullValue,
'one' : 'File too small',
'all' : 'Total size too small'
}
},
testElement: function (valjsArgs) {
var fieldType = valjsArgs.element.valjs('getFieldType'),
val = valjsGetAttr(valjsArgs.element, 'min');
if (fieldType.type === "file" && val) {
return {
value : val
};
}
},
bind: function (valjsArgs) {
var config = ruleHelperGetRuleConfig(valjsArgs);
// Make sure the value is an integer when we bind the rule
return $.extend(trueValue, config, {
value : valjsParseIntBase10(config.value)
});
},
run : function (valjsArgs) {
var min = ruleHelperGetRuleConfig(valjsArgs).value,
element = ruleHelperGetElement(valjsArgs),
singleFileSize,
f = element[0].files,
flen = valjsLength(f),
file_index,
file_size = 0;
if (flen > 0) {
for (file_index = 0; file_index < flen; file_index += 1) {
singleFileSize = f[file_index].size;
file_size += singleFileSize;
if (singleFileSize < min) {
return {
msg : 'one',
minbytes : min,
minsize: valjsFormatBytes(min),
filename : f[file_index].name,
filebytes : singleFileSize,
filesize : valjsFormatBytes(singleFileSize)
};
}
}
if (file_size < min) {
return {
msg : 'all',
totalbytes : file_size,
totalsize : valjsFormatBytes(file_size),
minsize : valjsFormatBytes(min),
minbytes : min
};
}
}
return trueValue;
}
});
function valjsValidateDomain(domain, domainLen, local, localLen) {
if (localLen < 1 || localLen > 64) {
// local part length exceeded
return false;
}
if (domainLen < 1 || domainLen > 255) {
// domain part length exceeded
return false;
}
if (local[0] === '.' || local[localLen - 1] === '.') {
// local part starts or ends with '.'
return false;
}
if (/\.\./.test(local)) {
// local part has two consecutive dots
return false;
}
if (!/^[åäöA-Za-z0-9\\-\\.]+$/.test(domain)) {
// character not valid in domain part
return false;
}
if (!/^[åäöA-Za-z0-9\\-\\.]+$/.test(domain)) {
// character not valid in domain part
return false;
}
if (/\.\./.test(domain)) {
// domain part has two consecutive dots
return false;
}
if (!/^(\.|[A-Za-z0-9!#%&`_=\/$\'*+?\^{}|~.\-])+$/.test(local.replace("\\\\", ""))) {
// character not valid in local part unless
// local part is quoted
if (!/^"(\\\\"|[^"])+"$/.test(local.replace("\\\\", ""))) {
return false;
}
}
return trueValue;
}
valjsAddRule('email', {
options : {
msg : {
'error' : 'Invalid e-mail'
},
domain : trueValue
},
testElement: function (valjsTestArgs) {
return valjsTestArgs.element.attr('type') === valjsTestArgs.rule.name;
},
run: function (valjsRunArgs) {
var v = ruleHelperGetFieldValue(valjsRunArgs),
atIndex,
isValid = trueValue,
domain,
local,
localLen,
domainLen;
if (valjsLength(v) > 0) {
if (!valjsIsString(v)) {
v = v[0];
}
atIndex = v.indexOf('@');
if (atIndex === -1) {
isValid = falseValue;
} else {
domain = v.substr(atIndex + 1);
local = v.substr(0, atIndex);
localLen = local.length;
domainLen = domain.length;
isValid = valjsValidateDomain(domain, domainLen, local, localLen);
if (valjsRunArgs.config.domain) {
if (!/\.[a-z]{2,4}$/.test(v)) {
isValid = falseValue;
}
}
}
// return false to show the default msg
return isValid ? trueValue : falseValue;
}
return trueValue;
},
bind: function (valjsBindArgs) {
var type = ruleHelperGetFieldType(valjsBindArgs).type,
element = ruleHelperGetElement(valjsBindArgs);
if (type === 'select' && !valjsIsUndefined(element.attr('multiple'))) {
return falseValue;
}
return trueValue;
}
});
valjsAddRule('confirm', {
options : {
msg : {
'error' : "Fields don't match",
'invalidSource' : 'Source field invalid'
}
},
run: function (valjsArgs) {
var element = ruleHelperGetElement(valjsArgs),
otherElement = ruleHelperGetRuleConfig(valjsArgs).celm;
if (otherElement.valjs('isElementBound')) {
if (!valjsTestIsElementReadyForValidation(otherElement)) {
return trueValue;
}
if (otherElement.valjs('getFieldStatus') === 0) {
otherElement.valjs('validateField');
}
if (otherElement.valjs('getFieldStatus') === -1) {
return 'invalidSource';
}
}
return otherElement.val() === element.val() ? trueValue : falseValue;
},
bind: function (valjsBindRuleArgs) {
var e = valjsFindInputByNameOrSelector(valjsBindRuleArgs.context, valjsBindRuleArgs.config.value);
if (!valjsIsUndefined(e)) {
if (valjsBindRuleArgs.valjs.config.liveValidation) {
e.on('keydown keyup change blur', function () {
valjsBindRuleArgs.element.valjs('validateField');
})
.on('validfield.valjs', function () {
valjsBindRuleArgs.element.valjs('validateField');
});
}
return {
celm: e
};
}
}
});
valjsAddRule('pattern', {
options : {
ignoreCase : falseValue,
invert : falseValue,
msg : {
'error' : "Incorrect format"
}
},
testElement: function (valjsArgs) {
var val = valjsGetAttr(valjsArgs.element, 'pattern');
if (val) {
return {
value : val
};
}
},
run: function (valjsArgs) {
var config = ruleHelperGetRuleConfig(valjsArgs),
options = (config.ignoreCase ? 'i' : ''),
invert = config.invert,
re = new RegExp(config.value, options),
isMatch,
val = ruleHelperGetFieldValue(valjsArgs);
if (val) {
if (re) {
isMatch = re.test(val);
if (isMatch) {
if (invert) {
return falseValue;
}
return trueValue;
}
if (invert) {
return trueValue;
}
}
return falseValue;
}
return trueValue;
}
});
valjsAddRule('url', {
options : {
value : '',
msg : {
'error' : "Invalid URL"
}
},
testElement: function (valjsArgs) {
return valjsGetAttr(valjsArgs.element, 'type') === 'url';
},
run: function (valjsArgs) {
var fieldValue = ruleHelperGetFieldValue(valjsArgs);
if (fieldValue) {
return (/^(https?|s?ftp|wss?):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i).test(fieldValue);
}
return trueValue;
}
});
valjsAddRule('security', {
options : {
value : 'luns',
match: 2,
msg : {
'error' : "Requirements not met"
}
},
bind: function (valjsArgs) {
return {
match : valjsParseIntBase10(valjsArgs.config.match)
};
},
run: function (valjsArgs) {
var cfg = ruleHelperGetRuleConfig(valjsArgs),
specials = '!@#$%^&*()_+|~-=‘{}[]:";’<>?,./',
value = ruleHelperGetFieldValue(valjsArgs),
rules = cfg.value,
match = cfg.match,
count = 0,
re;
if (match > rules.length) {
match = rules.length;
}
if (valjsIndexOf(rules, 'l') !== -1) {
count += (value.match(/[a-z]/) ? 1 : 0);
}
if (valjsIndexOf(rules, 'u') !== -1) {
count += (value.match(/[A-Z]/) ? 1 : 0);
}
if (valjsIndexOf(rules, 'n') !== -1) {
count += (value.match(/\d/) ? 1 : 0);
}
if (valjsIndexOf(rules, 's') !== -1) {
re = new RegExp("[" + specials.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "]");
if (value.match(re)) {
count += 1;
}
}
return count >= match ? trueValue : falseValue;
}
});
valjsAddRule('remote', {
async : 1000,
prio : 1500, // Should be the last thing to run
// Only run this event on change
checkEvent : function(e) {
return e && e.type === "change";
},
options : {
allowFailed : false,
prepare : function(valjsArgs) {
return {
field : valjsArgs.element.attr('name'),
value : valjsArgs.field.value
};
},
msg : {
'error' : "Invalid entry",
'fail' : 'Unable to validate',
'busy' : 'Validating...'
},
ajax : {
method : 'post',
dataType : 'json',
success : function(jSend) {
if (valjsIsString(jSend)) {
return this.reject('fail');
}
if (jSend.status && jSend.status === "success") {
this.resolve(true);
} else {
this.resolve(jSend.data);
}
},
error : function(a,b,c) {
if (b !== "abort") {
this.reject("fail");
}
}
}
},
abort : function() {
if (this._timer) {
clearTimeout(this._timer);
}
if (this._ajax) {
this._ajax.abort();
this._ajax = null;
}
},
run : function(valjsArgs) {
var data = {},
self = this,
cfg = valjsArgs.binding.getRule(),
data = cfg.prepare(valjsArgs);
if (this._timer) {
clearTimeout(this._timer);
}
this._timer = setTimeout(function() {
self._ajax = $.ajax($.extend(true, {
url : cfg.value,
data : data
}, cfg.ajax, {
context : self
}));
}, 300);
return this.makePromise();
}
});
return ValJS;
}(window, jQuery));
| itvsai/cdnjs | ajax/libs/valjs/1.0/jquery.valjs.js | JavaScript | mit | 116,762 |
!function(){"use strict";CodeMirror.defineMode("haml",function(e){function t(e){return function(t,i){var o=t.peek();return o==e&&1==i.rubyState.tokenize.length?(t.next(),i.tokenize=r,"closeAttributeTag"):n(t,i)}}function n(e,t){return e.match("-#")?(e.skipToEnd(),"comment"):o.token(e,t.rubyState)}function r(e,r){var o=e.peek();if("comment"==r.previousToken.style&&r.indented>r.previousToken.indented)return e.skipToEnd(),"commentLine";if(r.startOfLine){if("!"==o&&e.match("!!"))return e.skipToEnd(),"tag";if(e.match(/^%[\w:#\.]+=/))return r.tokenize=n,"hamlTag";if(e.match(/^%[\w:]+/))return"hamlTag";if("/"==o)return e.skipToEnd(),"comment"}if((r.startOfLine||"hamlTag"==r.previousToken.style)&&("#"==o||"."==o))return e.match(/[\w-#\.]*/),"hamlAttribute";if(r.startOfLine&&!e.match("-->",!1)&&("="==o||"-"==o))return r.tokenize=n,null;if("hamlTag"==r.previousToken.style||"closeAttributeTag"==r.previousToken.style||"hamlAttribute"==r.previousToken.style){if("("==o)return r.tokenize=t(")"),null;if("{"==o)return r.tokenize=t("}"),null}return i.token(e,r.htmlState)}var i=CodeMirror.getMode(e,{name:"htmlmixed"}),o=CodeMirror.getMode(e,"ruby");return{startState:function(){var e=i.startState(),t=o.startState();return{htmlState:e,rubyState:t,indented:0,previousToken:{style:null,indented:0},tokenize:r}},copyState:function(e){return{htmlState:CodeMirror.copyState(i,e.htmlState),rubyState:CodeMirror.copyState(o,e.rubyState),indented:e.indented,previousToken:e.previousToken,tokenize:e.tokenize}},token:function(e,t){if(e.sol()&&(t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;var i=t.tokenize(e,t);if(t.startOfLine=!1,i&&"commentLine"!=i&&(t.previousToken={style:i,indented:t.indented}),e.eol()&&t.tokenize==n){e.backUp(1);var o=e.peek();e.next(),o&&","!=o&&(t.tokenize=r)}return"hamlTag"==i?i="tag":"commentLine"==i?i="comment":"hamlAttribute"==i?i="attribute":"closeAttributeTag"==i&&(i=null),i}}},"htmlmixed","ruby"),CodeMirror.defineMIME("text/x-haml","haml")}(); | joeyparrish/cdnjs | ajax/libs/codemirror/3.22.0/mode/haml/haml.min.js | JavaScript | mit | 1,995 |
/*
* DateJS Culture String File
* Country Code: es-DO
* Name: Spanish (Dominican Republic)
* Format: "key" : "value"
* Key is the en-US term, Value is the Key in the current language.
*/
Date.CultureStrings = Date.CultureStrings || {};
Date.CultureStrings["es-DO"] = {
"name": "es-DO",
"englishName": "Spanish (Dominican Republic)",
"nativeName": "Español (República Dominicana)",
"Sunday": "domingo",
"Monday": "lunes",
"Tuesday": "martes",
"Wednesday": "miércoles",
"Thursday": "jueves",
"Friday": "viernes",
"Saturday": "sábado",
"Sun": "dom",
"Mon": "lun",
"Tue": "mar",
"Wed": "mié",
"Thu": "jue",
"Fri": "vie",
"Sat": "sáb",
"Su": "do",
"Mo": "lu",
"Tu": "ma",
"We": "mi",
"Th": "ju",
"Fr": "vi",
"Sa": "sá",
"S_Sun_Initial": "d",
"M_Mon_Initial": "l",
"T_Tue_Initial": "m",
"W_Wed_Initial": "m",
"T_Thu_Initial": "j",
"F_Fri_Initial": "v",
"S_Sat_Initial": "s",
"January": "enero",
"February": "febrero",
"March": "marzo",
"April": "abril",
"May": "mayo",
"June": "junio",
"July": "julio",
"August": "agosto",
"September": "septiembre",
"October": "octubre",
"November": "noviembre",
"December": "diciembre",
"Jan_Abbr": "ene",
"Feb_Abbr": "feb",
"Mar_Abbr": "mar",
"Apr_Abbr": "abr",
"May_Abbr": "may",
"Jun_Abbr": "jun",
"Jul_Abbr": "jul",
"Aug_Abbr": "ago",
"Sep_Abbr": "sep",
"Oct_Abbr": "oct",
"Nov_Abbr": "nov",
"Dec_Abbr": "dic",
"AM": "a.m.",
"PM": "p.m.",
"firstDayOfWeek": 0,
"twoDigitYearMax": 2029,
"mdy": "dmy",
"M/d/yyyy": "dd/MM/yyyy",
"dddd, MMMM dd, yyyy": "dddd, dd' de 'MMMM' de 'yyyy",
"h:mm tt": "hh:mm tt",
"h:mm:ss tt": "hh:mm:ss tt",
"dddd, MMMM dd, yyyy h:mm:ss tt": "dddd, dd' de 'MMMM' de 'yyyy hh:mm:ss tt",
"yyyy-MM-ddTHH:mm:ss": "yyyy-MM-ddTHH:mm:ss",
"yyyy-MM-dd HH:mm:ssZ": "yyyy-MM-dd HH:mm:ssZ",
"ddd, dd MMM yyyy HH:mm:ss": "ddd, dd MMM yyyy HH:mm:ss",
"MMMM dd": "dd MMMM",
"MMMM, yyyy": "MMMM' de 'yyyy",
"/jan(uary)?/": "ene(ro)?",
"/feb(ruary)?/": "feb(rero)?",
"/mar(ch)?/": "mar(zo)?",
"/apr(il)?/": "abr(il)?",
"/may/": "may(o)?",
"/jun(e)?/": "jun(io)?",
"/jul(y)?/": "jul(io)?",
"/aug(ust)?/": "ago(sto)?",
"/sep(t(ember)?)?/": "sep(tiembre)?",
"/oct(ober)?/": "oct(ubre)?",
"/nov(ember)?/": "nov(iembre)?",
"/dec(ember)?/": "dic(iembre)?",
"/^su(n(day)?)?/": "^do(m(ingo)?)?",
"/^mo(n(day)?)?/": "^lu(n(es)?)?",
"/^tu(e(s(day)?)?)?/": "^ma(r(tes)?)?",
"/^we(d(nesday)?)?/": "^mi(é(rcoles)?)?",
"/^th(u(r(s(day)?)?)?)?/": "^ju(e(ves)?)?",
"/^fr(i(day)?)?/": "^vi(e(rnes)?)?",
"/^sa(t(urday)?)?/": "^sá(b(ado)?)?",
"/^next/": "^next",
"/^last|past|prev(ious)?/": "^last|past|prev(ious)?",
"/^(\\+|aft(er)?|from|hence)/": "^(\\+|aft(er)?|from|hence)",
"/^(\\-|bef(ore)?|ago)/": "^(\\-|bef(ore)?|ago)",
"/^yes(terday)?/": "^yes(terday)?",
"/^t(od(ay)?)?/": "^t(od(ay)?)?",
"/^tom(orrow)?/": "^tom(orrow)?",
"/^n(ow)?/": "^n(ow)?",
"/^ms|milli(second)?s?/": "^ms|milli(second)?s?",
"/^sec(ond)?s?/": "^sec(ond)?s?",
"/^mn|min(ute)?s?/": "^mn|min(ute)?s?",
"/^h(our)?s?/": "^h(our)?s?",
"/^w(eek)?s?/": "^w(eek)?s?",
"/^m(onth)?s?/": "^m(onth)?s?",
"/^d(ay)?s?/": "^d(ay)?s?",
"/^y(ear)?s?/": "^y(ear)?s?",
"/^(a|p)/": "^(a|p)",
"/^(a\\.?m?\\.?|p\\.?m?\\.?)/": "^(a\\.?m?\\.?|p\\.?m?\\.?)",
"/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)/": "^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)",
"/^\\s*(st|nd|rd|th)/": "^\\s*(st|nd|rd|th)",
"/^\\s*(\\:|a(?!u|p)|p)/": "^\\s*(\\:|a(?!u|p)|p)",
"LINT": "LINT",
"TOT": "TOT",
"CHAST": "CHAST",
"NZST": "NZST",
"NFT": "NFT",
"SBT": "SBT",
"AEST": "AEST",
"ACST": "ACST",
"JST": "JST",
"CWST": "CWST",
"CT": "CT",
"ICT": "ICT",
"MMT": "MMT",
"BIOT": "BST",
"NPT": "NPT",
"IST": "IST",
"PKT": "PKT",
"AFT": "AFT",
"MSK": "MSK",
"IRST": "IRST",
"FET": "FET",
"EET": "EET",
"CET": "CET",
"UTC": "UTC",
"GMT": "GMT",
"CVT": "CVT",
"GST": "GST",
"BRT": "BRT",
"NST": "NST",
"AST": "AST",
"EST": "EST",
"CST": "CST",
"MST": "MST",
"PST": "PST",
"AKST": "AKST",
"MIT": "MIT",
"HST": "HST",
"SST": "SST",
"BIT": "BIT",
"CHADT": "CHADT",
"NZDT": "NZDT",
"AEDT": "AEDT",
"ACDT": "ACDT",
"AZST": "AZST",
"IRDT": "IRDT",
"EEST": "EEST",
"CEST": "CEST",
"BST": "BST",
"PMDT": "PMDT",
"ADT": "ADT",
"NDT": "NDT",
"EDT": "EDT",
"CDT": "CDT",
"MDT": "MDT",
"PDT": "PDT",
"AKDT": "AKDT",
"HADT": "HADT"
};
Date.CultureStrings.lang = "es-DO";
| arvinnizar/keuanganv2 | assets/vendors/DateJS/build/production/i18n/es-DO.js | JavaScript | mit | 5,640 |
CodeMirror.defineMode("smalltalk",function(e){var t=/[+\-\/\\*~<>=@%|&?!.,:;^]/,n=/true|false|nil|self|super|thisContext/,a=function(e,t){this.next=e,this.parent=t},i=function(e,t,n){this.name=e,this.context=t,this.eos=n},r=function(){this.context=new a(o,null),this.expectVariable=!0,this.indentation=0,this.userIndentationDelta=0};r.prototype.userIndent=function(t){this.userIndentationDelta=t>0?t/e.indentUnit-this.indentation:0};var o=function(e,r,o){var x=new i(null,r,!1),d=e.next();return'"'===d?x=s(e,new a(s,r)):"'"===d?x=l(e,new a(l,r)):"#"===d?"'"===e.peek()?(e.next(),x=u(e,new a(u,r))):x.name=e.eatWhile(/[^ .{}\[\]()]/)?"string-2":"meta":"$"===d?("<"===e.next()&&(e.eatWhile(/[^ >]/),e.next()),x.name="string-2"):"|"===d&&o.expectVariable?x.context=new a(c,r):/[\[\]{}()]/.test(d)?(x.name="bracket",x.eos=/[\[{(]/.test(d),"["===d?o.indentation++:"]"===d&&(o.indentation=Math.max(0,o.indentation-1))):t.test(d)?(e.eatWhile(t),x.name="operator",x.eos=";"!==d):/\d/.test(d)?(e.eatWhile(/[\w\d]/),x.name="number"):/[\w_]/.test(d)?(e.eatWhile(/[\w\d_]/),x.name=o.expectVariable?n.test(e.current())?"keyword":"variable":null):x.eos=o.expectVariable,x},s=function(e,t){return e.eatWhile(/[^"]/),new i("comment",e.eat('"')?t.parent:t,!0)},l=function(e,t){return e.eatWhile(/[^']/),new i("string",e.eat("'")?t.parent:t,!1)},u=function(e,t){return e.eatWhile(/[^']/),new i("string-2",e.eat("'")?t.parent:t,!1)},c=function(e,t){var n=new i(null,t,!1),a=e.next();return"|"===a?(n.context=t.parent,n.eos=!0):(e.eatWhile(/[^|]/),n.name="variable"),n};return{startState:function(){return new r},token:function(e,t){if(t.userIndent(e.indentation()),e.eatSpace())return null;var n=t.context.next(e,t.context,t);return t.context=n.context,t.expectVariable=n.eos,n.name},blankLine:function(e){e.userIndent(0)},indent:function(t,n){var a=t.context.next===o&&n&&"]"===n.charAt(0)?-1:t.userIndentationDelta;return(t.indentation+a)*e.indentUnit},electricChars:"]"}}),CodeMirror.defineMIME("text/x-stsrc",{name:"smalltalk"}); | manorius/cdnjs | ajax/libs/codemirror/3.22.0/mode/smalltalk/smalltalk.min.js | JavaScript | mit | 2,015 |
CodeMirror.defineMode("smalltalk",function(e){var t=/[+\-\/\\*~<>=@%|&?!.,:;^]/,n=/true|false|nil|self|super|thisContext/,a=function(e,t){this.next=e,this.parent=t},i=function(e,t,n){this.name=e,this.context=t,this.eos=n},r=function(){this.context=new a(o,null),this.expectVariable=!0,this.indentation=0,this.userIndentationDelta=0};r.prototype.userIndent=function(t){this.userIndentationDelta=t>0?t/e.indentUnit-this.indentation:0};var o=function(e,r,o){var x=new i(null,r,!1),d=e.next();return'"'===d?x=s(e,new a(s,r)):"'"===d?x=l(e,new a(l,r)):"#"===d?"'"===e.peek()?(e.next(),x=u(e,new a(u,r))):x.name=e.eatWhile(/[^ .{}\[\]()]/)?"string-2":"meta":"$"===d?("<"===e.next()&&(e.eatWhile(/[^ >]/),e.next()),x.name="string-2"):"|"===d&&o.expectVariable?x.context=new a(c,r):/[\[\]{}()]/.test(d)?(x.name="bracket",x.eos=/[\[{(]/.test(d),"["===d?o.indentation++:"]"===d&&(o.indentation=Math.max(0,o.indentation-1))):t.test(d)?(e.eatWhile(t),x.name="operator",x.eos=";"!==d):/\d/.test(d)?(e.eatWhile(/[\w\d]/),x.name="number"):/[\w_]/.test(d)?(e.eatWhile(/[\w\d_]/),x.name=o.expectVariable?n.test(e.current())?"keyword":"variable":null):x.eos=o.expectVariable,x},s=function(e,t){return e.eatWhile(/[^"]/),new i("comment",e.eat('"')?t.parent:t,!0)},l=function(e,t){return e.eatWhile(/[^']/),new i("string",e.eat("'")?t.parent:t,!1)},u=function(e,t){return e.eatWhile(/[^']/),new i("string-2",e.eat("'")?t.parent:t,!1)},c=function(e,t){var n=new i(null,t,!1),a=e.next();return"|"===a?(n.context=t.parent,n.eos=!0):(e.eatWhile(/[^|]/),n.name="variable"),n};return{startState:function(){return new r},token:function(e,t){if(t.userIndent(e.indentation()),e.eatSpace())return null;var n=t.context.next(e,t.context,t);return t.context=n.context,t.expectVariable=n.eos,n.name},blankLine:function(e){e.userIndent(0)},indent:function(t,n){var a=t.context.next===o&&n&&"]"===n.charAt(0)?-1:t.userIndentationDelta;return(t.indentation+a)*e.indentUnit},electricChars:"]"}}),CodeMirror.defineMIME("text/x-stsrc",{name:"smalltalk"}); | amoyeh/cdnjs | ajax/libs/codemirror/3.22.0/mode/smalltalk/smalltalk.min.js | JavaScript | mit | 2,015 |
webshims.register("form-validators",function(a,b,c,d,e,f){"use strict";var g="."+f.iVal.errorClass+", ."+f.iVal.successClass;!function(){b.refreshCustomValidityRules&&b.error("form-validators already included. please remove custom-validity.js");var c,e,f={},g=!1,h="input, select, textarea, fieldset[data-dependent-validation]",i=function(a){b.refreshCustomValidityRules(a.target)},j=function(){return!j.types[this.type]};j.types={hidden:1,image:1,button:1,reset:1,submit:1},b.customErrorMessages={},b.addCustomValidityRule=function(){var c,e=function(){a(d.querySelectorAll(h)).filter(j).each(function(){k(this)})};return function(a,d,h){f[a]=d,b.customErrorMessages[a]||(b.customErrorMessages[a]=[],b.customErrorMessages[a][""]=h||a),g&&(clearTimeout(c),c=setTimeout(e))}}(),b.refreshCustomValidityRules=function(d){if(e){var g,h,i=a(d).data(),j="",k=i&&i.customMismatchedRule,l=i&&a.prop(d,"validity")||{valid:1};return i&&(k||l.valid)&&(h=function(e,f){c=!0,e?(i.customMismatchedRule=f,"string"!=typeof e&&(e=b.getContentValidationMessage(d,!1,f),e&&"object"==typeof e&&(e=e[f]),e&&"string"==typeof e||(e=b.customErrorMessages[f][b.activeLang()]||b.customErrorMessages[f][""]||e.customError||e.defaultMessage||""))):(e="",i.customMismatchedRule=""),a(d).setCustomValidity(e),c=!1},g=a(d).val(),a.each(f,function(a,b){return j=b(d,g,i,h)||"",k=a,j?!1:void 0}),i&&i.dependentValidation&&!i.dependentValidation._init&&!i.dependentValidation.masterElement&&f.dependent(d,g,i,a.noop),"async"==j||!j&&l.valid||h(j,k)),j}};var k=b.refreshCustomValidityRules;"unknown"!=typeof d.activeElement&&a("body").on("click",function(b){if("submit"==b.target.type){var c=d.activeElement;c!=b.target&&a.data(c,"webshimsswitchvalidityclass")&&a(c).trigger("updatevalidation.webshims")}}),b.ready("forms form-validation",function(){a.propHooks.setCustomValidity={get:function(b){return c||a.data(b,"customMismatchedRule",""),null}},setTimeout(function(){b.addReady(function(b,c){e=!0,a(b.querySelectorAll(h)).add(c.filter(h)).filter(j).each(function(){k(this)}),g=!0}),a(d).on("refreshCustomValidityRules",i)},29)})}(),function(){var e=b.cfg.forms,h=b.addCustomValidityRule,i=function(a){return d.getElementById(a)||d.getElementsByName(a)};h("partialPattern",function(a,b,c){return c=c.partialPattern,b&&c?!new RegExp("("+c+")","i").test(b):void 0},"This format is not allowed here."),h("tooShort",function(c,d,e){return d&&e.minlength?(a.nodeName(c,"input")&&b.warn('depreacated data-minlength usage: Use pattern=".{'+e.minlength+',}" instead.'),e.minlength>d.length):void 0},"Entered value is too short."),h("grouprequired",function(c,e,f){var g,h=c.name;return h&&"checkbox"===c.type&&"grouprequired"in f?(f.grouprequired&&f.grouprequired.checkboxes||(f.grouprequired.checkboxes=a((g=a.prop(c,"form"))&&g[h]||d.getElementsByName(h)).filter('[type="checkbox"]'),f.grouprequired.checkboxes.off("click.groupRequired").on("click.groupRequired",function(){b.refreshCustomValidityRules(c)}),f.grouprequired.checkboxes.not(c).removeData("grouprequired")),!f.grouprequired.checkboxes.filter(":checked:enabled")[0]):void 0},"Please check one of these checkboxes."),h("luhn",function(a,c,d){if(c&&d&&("creditcard"in d||"luhn"in d)){if("creditcard"in d&&b.error("data-creditcard was renamed to data-luhn!!!"),c=c.replace(/\-/g,""),c!=1*c)return!0;for(var e,f=c.length,g=0,h=1;f--;)e=parseInt(c.charAt(f),10)*h,g+=e-9*(e>9),h^=3;return!(g%10===0&&g>0)}},"Please enter a valid credit card number");var j={prop:"value","from-prop":"value",toggle:!1},k=function(b){return a(b.form[b.name]).filter('[type="radio"]')};b.ready("form-validation",function(){b.modules&&(k=b.modules["form-core"].getGroupElements||k)}),h("dependent",function(c,e,f){if(f=f.dependentValidation){var h,i=function(b){var d=a.prop(f.masterElement,f["from-prop"]);h&&(d=-1!==a.inArray(d,h)),f.toggle&&(d=!d),a.prop(c,f.prop,d),b&&a(c).getShadowElement().filter(g).trigger("updatevalidation.webshims")};if(!f._init||!f.masterElement){if("string"==typeof f&&(f={from:f}),f.masterElement=d.getElementById(f.from)||d.getElementsByName(f.from||[])[0],f._init=!0,!f.masterElement||!f.masterElement.form)return;/radio|checkbox/i.test(f.masterElement.type)?(f["from-prop"]||(f["from-prop"]="checked"),f.prop||"checked"!=f["from-prop"]||(f.prop="disabled")):f["from-prop"]||(f["from-prop"]="value"),0===f["from-prop"].indexOf("value:")&&(h=f["from-prop"].replace("value:","").split("||"),f["from-prop"]="value"),f=a.data(c,"dependentValidation",a.extend({_init:!0},j,f)),"value"!==f.prop||h?a("radio"===f.masterElement.type&&k(f.masterElement)||f.masterElement).on("change",i):a(f.masterElement).on("change",function(){b.refreshCustomValidityRules(c),a(c).getShadowElement().filter(g).trigger("updatevalidation.webshims")})}return"value"!=f.prop||h?(i(),""):a.prop(f.masterElement,"value")!=e}},"The value of this field does not repeat the value of the other field"),h("valuevalidation",function(b,c,d){return c&&"valuevalidation"in d?a(b).triggerHandler("valuevalidation",[{value:c,valueAsDate:a.prop(b,"valueAsDate"),isPartial:!1}])||"":void 0},"This value is not allowed here"),c.JSON&&h("ajaxvalidate",function(c,d,g){if(d&&g.ajaxvalidate){var h;if(!g.remoteValidate){b.loader.loadList(["jajax"]),"string"==typeof g.ajaxvalidate?g.ajaxvalidate={url:g.ajaxvalidate,depends:a([])}:g.ajaxvalidate.depends=g.ajaxvalidate.depends?a("string"==typeof g.ajaxvalidate.depends&&g.ajaxvalidate.depends.split(" ")||g.ajaxvalidate.depends).map(i):a([]),g.ajaxvalidate.depends.on("refreshCustomValidityRules",function(){b.refreshCustomValidityRules(c)}),h=g.ajaxvalidate;var j={ajaxLoading:!1,restartAjax:!1,message:"async",cache:{},update:function(b){this.ajaxLoading?this.restartAjax=b:(this.restartAjax=!1,this.ajaxLoading=!0,a.ajax(a.extend({dataType:"json"},h,{url:h.url,depData:b,data:e.fullRemoteForm||h.fullForm?a(c).jProp("form").serializeArray():b,success:this.getResponse,complete:this._complete,timeout:3e3})))},_complete:function(){j.ajaxLoading=!1,j.restartAjax&&this.update(j.restartAjax),j.restartAjax=!1},getResponse:function(b){if(f.transformAjaxValidate&&(b=f.transformAjaxValidate(b)),b){if("string"==typeof b)try{b=JSON.parse(b)}catch(d){}}else b={message:"",valid:!0};j.message="message"in b?b.message:!b.valid,j.lastMessage=j.message,j.blockUpdate=!0,a(c).triggerHandler("updatevalidation.webshims"),j.message="async",j.blockUpdate=!1},getData:function(){var b;return b={},b[a.prop(c,"name")||a.prop(c,"id")]=a(c).val(),h.depends.each(function(){return a(this).is(":invalid")?(b=!1,!1):void(b[a.prop(this,"name")||a.prop(this,"id")]=a(this).val())}),b},getTempMessage:function(){var a,b,c="async";if(g.remoteValidate.blockUpdate)c=j.message;else if(a=this.getData()){try{b=JSON.stringify(a)}catch(d){}b===this.lastString?c=this.ajaxLoading?"async":this.lastMessage:(this.lastString=b,this.lastMessage="async",clearTimeout(g.remoteValidate.timer),g.remoteValidate.timer=setTimeout(function(){g.remoteValidate.update(a)},9))}else c="";return c}};g.remoteValidate=j}return g.remoteValidate.getTempMessage()}},"remote error")}()}); | pm5/cdnjs | ajax/libs/webshim/1.13.0/minified/shims/form-validators.js | JavaScript | mit | 7,074 |
webshims.register("form-validation",function(a,b,c,d,e,f){"use strict";var g="webkitURL"in c,h=Modernizr.formvalidation&&!b.bugs.bustedValidity,i=g&&h,j=i&&parseFloat((navigator.userAgent.match(/Safari\/([\d\.]+)/)||["","999999"])[1],10),k=f.iVal;k.fieldWrapper||(k.fieldWrapper=":not(span):not(label):not(em):not(strong):not(p)");var l=k.errorClass||(k.errorClass="user-error"),m=k.successClass||(k.successClass="user-success"),n=k.errorWrapperClass||(k.errorWrapperClass="ws-invalid"),o=k.successWrapperClass||(k.successWrapperClass="ws-success"),p=k.errorBoxClass||(k.errorBoxClass="ws-errorbox"),q=k.errorMessageClass||(k.errorMessageClass="ws-errormessage"),r={checkbox:1,radio:1},s=b.loader,t=s.addModule,u=a([]),v=function(){return!a.prop(this,"form")},w=function(b){b=a(b);var c,e,f=u;return"radio"==b[0].type&&(e=b.prop("form"),c=b[0].name,f=c?e?a(e).jProp(c):a(d.getElementsByName(c)).filter(v):b,f=f.filter('[type="radio"]')),f},x=function(b,c){var d;return a.each(b,function(b,e){return e?(d=b+a.prop(c,"validationMessage"),!1):void 0}),d},y=function(a){var b;try{b=d.activeElement.name===a}catch(c){}return b},z={radio:1,checkbox:1,"select-one":1,"select-multiple":1,file:1,date:1,month:1,week:1,text:1},A={time:1,date:1,month:1,datetime:1,week:1,"datetime-local":1},B={refreshvalidityui:1,updatevalidation:1},C="."+k.errorClass+", ."+k.successClass,D=function(c){if(k.sel){var d,e,f,g;if(c.target&&(d=a(c.target).getNativeElement()[0],f=a(d).getShadowElement(),"submit"!=d.type&&a.prop(d,"willValidate")&&("change"!=c.type||!(g=f.prop("type"))||z[g]))){e=a.data(d,"webshimsswitchvalidityclass");var h=function(){if(g||(g=f.prop("type")),!(i&&("change"==c.type||537.36>j)&&A[g]&&a(c.target).is(":focus")||"focusout"==c.type&&"radio"==d.type&&y(d.name))){if(b.refreshCustomValidityRules&&"async"==b.refreshCustomValidityRules(d))return void a(d).one("updatevalidation.webshims",D);var e,h,k,n,o,p=a.prop(d,"validity");p.valid?f.hasClass(m)||(e=m,h=l,n="changedvaliditystate",k="changedvalid",r[d.type]&&d.checked&&w(d).not(d).removeClass(h).addClass(e).removeAttr("aria-invalid"),f.removeAttr("aria-invalid"),a.removeData(d,"webshimsinvalidcause")):(o=x(p,d),a.data(d,"webshimsinvalidcause")!=o&&(a.data(d,"webshimsinvalidcause",o),n="changedvaliditystate"),f.hasClass(l)||(e=l,h=m,r[d.type]&&!d.checked&&w(d).not(d).removeClass(h).addClass(e).attr("aria-invalid","true"),f.attr("aria-invalid","true"),k="changedinvalid")),e&&(f.addClass(e).removeClass(h),setTimeout(function(){a(d).trigger(k)})),n&&setTimeout(function(){a(d).trigger(n)}),a.removeData(d,"webshimsswitchvalidityclass")}};f.triggerHandler("wsallowinstantvalidation",[c])!==!1&&(e&&clearTimeout(e),B[c.type]?("refreshvalidityui"==c.type&&b.warn("refreshvalidityui was renamed to updatevalidation"),h()):a.data(d,"webshimsswitchvalidityclass",setTimeout(h)))}}},E=function(){b.errorbox.reset(this)};"validityUIEvents"in f&&(b.warn("validityUIEvents was renamed to iVal.events"),k.events=f.validityUIEvents),k.events="events"in k?k.events||"":"focusout change",k.events&&(k.events+=" "),a(d.body||"html").on(k.events+"refreshvalidityui updatevalidation.webshims invalid",D).on("reset resetvalidation.webshims resetvalui",function(c){var d,e=a(c.target);"resetvalui"==c.type&&b.warn("resetvalui was renamed to resetvalidation"),e.is("form, fieldset")&&("form"==e[0].nodeName.toLowerCase()&&(d=!e.is(k.sel)),e=e.jProp("elements")),e=e.filter(C).removeAttr("aria-invalid").removeClass(k.errorClass+" "+k.successClass).getNativeElement().each(function(){a.removeData(this,"webshimsinvalidcause")}),d||(d===!1?e.each(E):e.trigger("resetvalidityui.webshims"))});var F=function(){b.scrollRoot=a(g||"BackCompat"==d.compatMode?d.body:d.documentElement)},G=Modernizr.boxSizing||Modernizr["display-table"]||a.support.getSetAttribute||a.support.boxSizing?"minWidth":"width",H="transitionDelay"in d.documentElement.style,I={display:"inline-block",left:0,top:0,marginTop:0,marginLeft:0,marginRight:0,marginBottom:0};F(),b.ready("DOM",F);var J=/right|left/g,K=function(a){return"left"==a?"right":"left"};b.getRelOffset=function(b,c,d){var e,f;return b=a(b),a.swap(b[0],I,function(){var g;a.position&&d&&a.position.getScrollInfo?(d.of||(d.of=c),g="rtl"==a(d.of).css("direction"),d.isRtl||(d.isRtl=!1),d.isRtl!=g&&(d.my=(d.my||"center").replace(J,K),d.at=(d.at||"center").replace(J,K),d.isRtl=g),b[d.isRtl?"addClass":"removeClass"]("ws-is-rtl"),d.using=function(a,c){b.attr({"data-horizontal":c.horizontal,"data-vertical":c.vertical}),e=a},b.attr({"data-horizontal":"","data-vertical":"","data-my":d.my,"data-at":d.at}),b.position(d)):(e=a(c).offset(),f=b.offset(),e.top-=f.top,e.left-=f.left,e.top+=c.outerHeight())}),e},a.extend(b.wsPopover,{isInElement:function(b,c){a.isArray(b)||(b=[b]);var d,e,f,g=!1;for(d=0,e=b.length;e>d;d++)if(f=b[d],f&&f.jquery&&(f=f[0]),f&&(f==c||a.contains(f,c))){g=!0;break}return g},show:function(b){if(!this.isVisible){var e=a.Event("wspopoverbeforeshow");if(this.element.trigger(e),!e.isDefaultPrevented()){this.isVisible=!0,b=a(b||this.options.prepareFor).getNativeElement();var f=this,g=function(a){!f.options.hideOnBlur||f.stopBlur||f.isInElement([f.lastElement[0],b[0],f.element[0]],a.target)||f.hide()},h=a(b).getShadowElement(),i=function(a){clearTimeout(f.timers.repos),f.timers.repos=setTimeout(function(){f.position(h)},a&&"pospopover"==a.type?4:200)};this.clear(),this.element.removeClass("ws-po-visible").css("display","none"),this.prepareFor(b,h),this.position(h),f.timers.show=setTimeout(function(){f.element.css("display",""),f.timers.show=setTimeout(function(){f.element.addClass("ws-po-visible").trigger("wspopovershow")},14)},4),a(d.body).on("focusin"+this.eventns+" mousedown"+this.eventns,g).children(":not(script), :not(iframe), :not(noscript)").on("mousedown"+this.eventns,g),this.element.off("pospopover").on("pospopover",i),a(c).on("resize"+this.eventns+" pospopover"+this.eventns,i)}}},_getAutoAppendElement:function(){var b=/^(?:span|i|label|b|p|tr|thead|tbody|table|strong|em|ul|ol|dl|html)$/i;return function(c){for(var e,f=c[0],g=d.body;(f=f[e?"offsetParent":"parentNode"])&&1==f.nodeType&&f!=g;)e||b.test(f.nodeName)||(e=f),e&&"hidden"==a.css(f,"overflow")&&"static"!=a.css(f,"position")&&(e=!1);return a(e||g)}}(),prepareFor:function(b,c){var d,e,f=this,g={},h=a.extend(!0,{},this.options,b.jProp("form").data("wspopover")||{},b.data("wspopover"));this.lastOpts=h,this.lastElement=a(b).getShadowFocusElement(),this.prepared&&this.options.prepareFor||(e="element"==h.appendTo?b.parent():"auto"==h.appendTo?this._getAutoAppendElement(b):a(h.appendTo),this.prepared&&e[0]==this.element[0].parentNode||this.element.appendTo(e)),this.element.attr({"data-class":b.prop("className"),"data-id":b.prop("id")}),g[G]=h.constrainWidth?c.outerWidth():"",this.element.css(g),h.hideOnBlur&&(d=function(a){f.stopBlur?a.stopImmediatePropagation():f.hide()},f.timers.bindBlur=setTimeout(function(){f.lastElement.off(f.eventns).on("focusout"+f.eventns+" blur"+f.eventns,d),f.lastElement.getNativeElement().off(f.eventns)},10)),this.prepared=!0},clear:function(){a(c).off(this.eventns),a(d).off(this.eventns),a(d.body).off(this.eventns).children(":not(script), :not(iframe), :not(noscript)").off(this.eventns),this.element.off("transitionend"+this.eventns),this.stopBlur=!1,this.lastOpts=!1,a.each(this.timers,function(a,b){clearTimeout(b)})},hide:function(){var b=a.Event("wspopoverbeforehide");if(this.element.trigger(b),!b.isDefaultPrevented()&&this.isVisible){this.isVisible=!1;var d=this,e=function(b){b&&"transitionend"==b.type&&(b=b.originalEvent)&&b.target==d.element[0]&&"hidden"==d.element.css("visibility")||(d.element.off("transitionend"+d.eventns).css("display","none").attr({"data-id":"","data-class":"",hidden:"hidden"}),clearTimeout(d.timers.forcehide),a(c).off("resize"+d.eventns))};this.clear(),this.element.removeClass("ws-po-visible").trigger("wspopoverhide"),a(c).on("resize"+this.eventns,e),H&&this.element.off("transitionend"+this.eventns).on("transitionend"+this.eventns,e),d.timers.forcehide=setTimeout(e,H?600:40)}},position:function(a){var c=b.getRelOffset(this.element.removeAttr("hidden"),a,(this.lastOpts||this.options).position);this.element.css(c)}}),b.validityAlert=function(){f.messagePopover.position=a.extend({},{at:"left bottom",my:"left top",collision:"none"},f.messagePopover.position||{});var c=b.objectCreate(b.wsPopover,e,f.messagePopover),d=c.hide.bind(c);return c.element.addClass("validity-alert").attr({role:"alert"}),a.extend(c,{hideDelay:5e3,showFor:function(b,c,e,f){b=a(b).getNativeElement(),this.clear(),this.hide(),f||(this.getMessage(b,c),this.show(b),this.hideDelay&&(this.timers.delayedHide=setTimeout(d,this.hideDelay))),e||this.setFocus(b)},setFocus:function(d){var e=a(d).getShadowFocusElement(),g=b.scrollRoot.scrollTop()+(f.viewportOffset||0),h=e.offset().top-(f.scrollOffset||30),i=function(){try{e[0].focus()}catch(a){}e[0].offsetWidth||e[0].offsetHeight||b.warn("invalid element seems to be hidden. Make element either visible or use disabled/readonly to bar elements from validation. With fieldset[disabled] a group of elements can be ignored."),c.element.triggerHandler("pospopover")};g>h?b.scrollRoot.animate({scrollTop:h-5-(f.viewportOffset||0)},{queue:!1,duration:Math.max(Math.min(600,1.5*(g-h)),80),complete:i}):i()},getMessage:function(a,b){b||(b=a.getErrorMessage()),b?c.contentElement.html(b):this.hide()}}),c}();var L={slide:{show:"slideDown",hide:"slideUp"},fade:{show:"fadeIn",hide:"fadeOut"},no:{show:"show",hide:"hide"}};k.fx&&L[k.fx]||(k.fx="slide"),a.fn[L[k.fx].show]||(k.fx="no");var M=0;b.errorbox={create:function(b,c){c||(c=this.getFieldWrapper(b));var d=a("div."+p,c);return d.length||(d=a('<div class="'+p+'" hidden="hidden" style="display: none;">'),c.append(d)),d.prop("id")||(M++,d.prop("id","errorbox-"+M)),c.data("errorbox",d),d},getFieldWrapper:function(c){var d;return d="function"==typeof k.fieldWrapper?k.fieldWrapper.apply(this,arguments):a(c).parent().closest(k.fieldWrapper),d.length||b.error("could not find fieldwrapper: "+k.fieldWrapper),d},_createContentMessage:function(){var c=function(){return!c.types[this.type]};c.types={hidden:1,image:1,button:1,reset:1,submit:1};var d={},e=function(a){return"-"+a.toLowerCase()},f=function(b){var c=a(b).data("errortype");return c||a.each(d,function(d,e){return a(b).is(e)?(c=d,!1):void 0}),c||"defaultMessage"};return a.each(["customError","badInput","typeMismatch","rangeUnderflow","rangeOverflow","stepMismatch","tooLong","tooShort","patternMismatch","valueMissing"],function(a,b){var c=b.replace(/[A-Z]/,e);d[b]="."+c+", ."+b+", ."+b.toLowerCase()+', [data-errortype="'+b+'"]'}),function(d,e,g){var h=!1,i={};a(e).children().each(function(){var b=f(this);i[b]=a(this).html()}),a("input, select, textarea",g).filter(c).each(function(c,d){var e=a(d).data("errormessage")||{};"string"==typeof e&&(e={defaultMessage:e}),a.each(i,function(a,b){e[a]||(h=!0,e[a]=b)}),h&&a(d).data("errormessage",e),b.getOptions&&b.getOptions(d,"errormessage",!1,!0)})}}(),initIvalContentMessage:function(b){a(b).jProp("form").is(k.sel)&&this.get(b)},get:function(b,c){c||(c=this.getFieldWrapper(b));var d,e=c.data("errorbox");return"object"!=(d=typeof e)&&(e?"string"==d&&(e=a("#"+e),c.data("errorbox",e,c)):e=this.create(b,c),this._createContentMessage(b,e,c)),e},addSuccess:function(b,c){var d=a.prop(b,"type"),e=function(){var e=r[d]?a.prop(b,"checked"):a(b).val();c[e?"addClass":"removeClass"](o)},f=z[d]?"change":"blur";a(b).off(".recheckvalid").on(f+".recheckinvalid",e),e()},hideError:function(b,c){var d,e,f,g=this.getFieldWrapper(b);return g.hasClass(n)&&(a(b).filter("input").off(".recheckinvalid"),!c&&(d=a("input:invalid, select:invalid, textarea:invalid",g)[0])?a(d).trigger("updatevalidation.webshims"):(e=this.get(b,g),g.removeClass(n),e.message="",f=function(){this.id==b.getAttribute("aria-describedby")&&b.removeAttribute("aria-describedby"),a(this).attr({hidden:"hidden"})},"no"!=k.fx?e[L[k.fx].hide](f):e[L[k.fx].hide]().each(f))),c||d||this.addSuccess(b,g),g},recheckInvalidInput:function(b){if(k.recheckDelay&&k.recheckDelay>90){var c,d=function(){D({type:"input",target:b})};a(b).filter('input:not([type="checkbox"]):not([type="radio"])').off(".recheckinvalid").on("input.recheckinvalid",function(){clearTimeout(c),c=setTimeout(d,k.recheckDelay)}).on("focusout.recheckinvalid",function(){clearTimeout(c)})}},showError:function(b){var c=this.getFieldWrapper(b),d=this.get(b,c),e=a(b).getErrorMessage();return d.message!=e&&(d.stop&&d.stop(!0,!0),d.html('<p class="'+q+'">'+e+"</p>"),d.message=e,c.addClass(n).removeClass(o),this.recheckInvalidInput(b),(d.is("[hidden]")||"none"==d.css("display"))&&(b.getAttribute("aria-describedby")||b.setAttribute("aria-describedby",d.prop("id")),d.css({display:"none"}).removeAttr("hidden")[L[k.fx].show]())),c.removeClass(o),a(b).off(".recheckvalid"),c},reset:function(a){this.hideError(a,!0).removeClass(o)},toggle:function(b){a(b).is(":invalid")?this.showError(b):this.hideError(b)}},a(d.body).on({changedvaliditystate:function(c){if(k.sel){var d=a(c.target).jProp("form");d.is(k.sel)&&b.errorbox.toggle(c.target)}},"resetvalidityui.webshims":function(c){if(k.sel){var d=a(c.target).jProp("form");d.is(k.sel)&&b.errorbox.reset(c.target)}},firstinvalid:function(c){if(k.sel&&k.handleBubble){var d=a(c.target).jProp("form");d.is(k.sel)&&(c.preventDefault(),"none"!=k.handleBubble&&b.validityAlert.showFor(c.target,!1,!1,"hide"==k.handleBubble))}},submit:function(b){return k.sel&&k.submitCheck&&a(b.target).is(k.sel)&&a.prop(b.target,"noValidate")&&!a(b.target).checkValidity()?(b.stopImmediatePropagation(),!1):void 0}}),b.modules["form-core"].getGroupElements=w,/[\s\:\>\~\+]/.test(k.sel||"")&&b.error("please use a simple selector for iVal.sel: for example .validate"),f.replaceValidationUI&&a(d).on("firstinvalid",function(a){a.isDefaultPrevented()||(a.preventDefault(),setTimeout(function(){b.validityAlert.showFor(a.target)},4))}),function(){var b,c,e,f=[];a(d).on("invalid",function(d){if(!d.wrongWebkitInvalid&&!e){var g=a(d.target);b||(b=a.Event("firstinvalid"),g.trigger(b)),b&&b.isDefaultPrevented()&&d.preventDefault(),f.push(d.target),d.extraData="fix",clearTimeout(c),c=setTimeout(function(){var c={type:"lastinvalid",cancelable:!1,invalidlist:a(f)};b=!1,f=[],e=!0,a(d.target).trigger(c,[c]),e=!1},9),g=null}})}(),t("form-fixrangechange",{test:!(!a.event.special.change&&!a.event.special.input&&Modernizr.inputtypes&&Modernizr.inputtypes.range&&f.fixRangeChange)}),t("form-combat",{d:["dom-support"],test:!(a.mobile&&(a.mobile.selectmenu||a.mobile.checkboxradio)||a.fn.select2||a.fn.chosen||a.fn.selectpicker||a.fn.selectBoxIt)}),t("position",{src:"plugins/jquery.ui.position.js",test:!(!a.position||!a.position.getScrollInfo)}),s.loadList(["form-combat","position","form-fixrangechange"])}); | kiwi89/cdnjs | ajax/libs/webshim/1.13.0/minified/shims/form-validation.js | JavaScript | mit | 14,792 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.