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
|
---|---|---|---|---|---|
<?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\Tests\Constraints;
use Symfony\Component\Validator\Constraints\Ip;
use Symfony\Component\Validator\Constraints\IpValidator;
use Symfony\Component\Validator\Validation;
class IpValidatorTest extends AbstractConstraintValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5;
}
protected function createValidator()
{
return new IpValidator();
}
public function testNullIsValid()
{
$this->validator->validate(null, new Ip());
$this->assertNoViolation();
}
public function testEmptyStringIsValid()
{
$this->validator->validate('', new Ip());
$this->assertNoViolation();
}
/**
* @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
*/
public function testExpectsStringCompatibleType()
{
$this->validator->validate(new \stdClass(), new Ip());
}
/**
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
*/
public function testInvalidValidatorVersion()
{
new Ip(array(
'version' => 666,
));
}
/**
* @dataProvider getValidIpsV4
*/
public function testValidIpsV4($ip)
{
$this->validator->validate($ip, new Ip(array(
'version' => Ip::V4,
)));
$this->assertNoViolation();
}
public function getValidIpsV4()
{
return array(
array('0.0.0.0'),
array('10.0.0.0'),
array('123.45.67.178'),
array('172.16.0.0'),
array('192.168.1.0'),
array('224.0.0.1'),
array('255.255.255.255'),
array('127.0.0.0'),
);
}
/**
* @dataProvider getValidIpsV6
*/
public function testValidIpsV6($ip)
{
$this->validator->validate($ip, new Ip(array(
'version' => Ip::V6,
)));
$this->assertNoViolation();
}
public function getValidIpsV6()
{
return array(
array('2001:0db8:85a3:0000:0000:8a2e:0370:7334'),
array('2001:0DB8:85A3:0000:0000:8A2E:0370:7334'),
array('2001:0Db8:85a3:0000:0000:8A2e:0370:7334'),
array('fdfe:dcba:9876:ffff:fdc6:c46b:bb8f:7d4c'),
array('fdc6:c46b:bb8f:7d4c:fdc6:c46b:bb8f:7d4c'),
array('fdc6:c46b:bb8f:7d4c:0000:8a2e:0370:7334'),
array('fe80:0000:0000:0000:0202:b3ff:fe1e:8329'),
array('fe80:0:0:0:202:b3ff:fe1e:8329'),
array('fe80::202:b3ff:fe1e:8329'),
array('0:0:0:0:0:0:0:0'),
array('::'),
array('0::'),
array('::0'),
array('0::0'),
// IPv4 mapped to IPv6
array('2001:0db8:85a3:0000:0000:8a2e:0.0.0.0'),
array('::0.0.0.0'),
array('::255.255.255.255'),
array('::123.45.67.178'),
);
}
/**
* @dataProvider getValidIpsAll
*/
public function testValidIpsAll($ip)
{
$this->validator->validate($ip, new Ip(array(
'version' => Ip::ALL,
)));
$this->assertNoViolation();
}
public function getValidIpsAll()
{
return array_merge($this->getValidIpsV4(), $this->getValidIpsV6());
}
/**
* @dataProvider getInvalidIpsV4
*/
public function testInvalidIpsV4($ip)
{
$constraint = new Ip(array(
'version' => Ip::V4,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidIpsV4()
{
return array(
array('0'),
array('0.0'),
array('0.0.0'),
array('256.0.0.0'),
array('0.256.0.0'),
array('0.0.256.0'),
array('0.0.0.256'),
array('-1.0.0.0'),
array('foobar'),
);
}
/**
* @dataProvider getInvalidPrivateIpsV4
*/
public function testInvalidPrivateIpsV4($ip)
{
$constraint = new Ip(array(
'version' => Ip::V4_NO_PRIV,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidPrivateIpsV4()
{
return array(
array('10.0.0.0'),
array('172.16.0.0'),
array('192.168.1.0'),
);
}
/**
* @dataProvider getInvalidReservedIpsV4
*/
public function testInvalidReservedIpsV4($ip)
{
$constraint = new Ip(array(
'version' => Ip::V4_NO_RES,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidReservedIpsV4()
{
return array(
array('0.0.0.0'),
array('224.0.0.1'),
array('255.255.255.255'),
);
}
/**
* @dataProvider getInvalidPublicIpsV4
*/
public function testInvalidPublicIpsV4($ip)
{
$constraint = new Ip(array(
'version' => Ip::V4_ONLY_PUBLIC,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidPublicIpsV4()
{
return array_merge($this->getInvalidPrivateIpsV4(), $this->getInvalidReservedIpsV4());
}
/**
* @dataProvider getInvalidIpsV6
*/
public function testInvalidIpsV6($ip)
{
$constraint = new Ip(array(
'version' => Ip::V6,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidIpsV6()
{
return array(
array('z001:0db8:85a3:0000:0000:8a2e:0370:7334'),
array('fe80'),
array('fe80:8329'),
array('fe80:::202:b3ff:fe1e:8329'),
array('fe80::202:b3ff::fe1e:8329'),
// IPv4 mapped to IPv6
array('2001:0db8:85a3:0000:0000:8a2e:0370:0.0.0.0'),
array('::0.0'),
array('::0.0.0'),
array('::256.0.0.0'),
array('::0.256.0.0'),
array('::0.0.256.0'),
array('::0.0.0.256'),
);
}
/**
* @dataProvider getInvalidPrivateIpsV6
*/
public function testInvalidPrivateIpsV6($ip)
{
$constraint = new Ip(array(
'version' => Ip::V6_NO_PRIV,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidPrivateIpsV6()
{
return array(
array('fdfe:dcba:9876:ffff:fdc6:c46b:bb8f:7d4c'),
array('fdc6:c46b:bb8f:7d4c:fdc6:c46b:bb8f:7d4c'),
array('fdc6:c46b:bb8f:7d4c:0000:8a2e:0370:7334'),
);
}
/**
* @dataProvider getInvalidReservedIpsV6
*/
public function testInvalidReservedIpsV6($ip)
{
$constraint = new Ip(array(
'version' => Ip::V6_NO_RES,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidReservedIpsV6()
{
// Quoting after official filter documentation:
// "FILTER_FLAG_NO_RES_RANGE = This flag does not apply to IPv6 addresses."
// Full description: http://php.net/manual/en/filter.filters.flags.php
return $this->getInvalidIpsV6();
}
/**
* @dataProvider getInvalidPublicIpsV6
*/
public function testInvalidPublicIpsV6($ip)
{
$constraint = new Ip(array(
'version' => Ip::V6_ONLY_PUBLIC,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidPublicIpsV6()
{
return array_merge($this->getInvalidPrivateIpsV6(), $this->getInvalidReservedIpsV6());
}
/**
* @dataProvider getInvalidIpsAll
*/
public function testInvalidIpsAll($ip)
{
$constraint = new Ip(array(
'version' => Ip::ALL,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidIpsAll()
{
return array_merge($this->getInvalidIpsV4(), $this->getInvalidIpsV6());
}
/**
* @dataProvider getInvalidPrivateIpsAll
*/
public function testInvalidPrivateIpsAll($ip)
{
$constraint = new Ip(array(
'version' => Ip::ALL_NO_PRIV,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidPrivateIpsAll()
{
return array_merge($this->getInvalidPrivateIpsV4(), $this->getInvalidPrivateIpsV6());
}
/**
* @dataProvider getInvalidReservedIpsAll
*/
public function testInvalidReservedIpsAll($ip)
{
$constraint = new Ip(array(
'version' => Ip::ALL_NO_RES,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidReservedIpsAll()
{
return array_merge($this->getInvalidReservedIpsV4(), $this->getInvalidReservedIpsV6());
}
/**
* @dataProvider getInvalidPublicIpsAll
*/
public function testInvalidPublicIpsAll($ip)
{
$constraint = new Ip(array(
'version' => Ip::ALL_ONLY_PUBLIC,
'message' => 'myMessage',
));
$this->validator->validate($ip, $constraint);
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$ip.'"')
->setCode(Ip::INVALID_IP_ERROR)
->assertRaised();
}
public function getInvalidPublicIpsAll()
{
return array_merge($this->getInvalidPublicIpsV4(), $this->getInvalidPublicIpsV6());
}
}
| kovarthanan3222/ums-repo | vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php | PHP | mit | 12,111 |
"format register";System.register("angular2/src/http/interfaces",[],!0,function(e,t,r){var n=System.global,s=n.define;n.define=void 0;var a=function(){function e(){}return e}();t.ConnectionBackend=a;var o=function(){function e(){}return e}();return t.Connection=o,n.define=s,r.exports}),System.register("angular2/src/http/headers",["angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/facade/collection"],!0,function(e,t,r){var n=System.global,s=n.define;n.define=void 0;var a=e("angular2/src/facade/lang"),o=e("angular2/src/facade/exceptions"),i=e("angular2/src/facade/collection"),c=function(){function e(t){var r=this;return t instanceof e?void(this._headersMap=t._headersMap):(this._headersMap=new i.Map,void(a.isBlank(t)||i.StringMapWrapper.forEach(t,function(e,t){r._headersMap.set(t,i.isListLikeIterable(e)?e:[e])})))}return e.fromResponseHeaderString=function(t){return t.trim().split("\n").map(function(e){return e.split(":")}).map(function(e){var t=e[0],r=e.slice(1);return[t.trim(),r.join(":").trim()]}).reduce(function(e,t){var r=t[0],n=t[1];return!e.set(r,n)&&e},new e)},e.prototype.append=function(e,t){var r=this._headersMap.get(e),n=i.isListLikeIterable(r)?r:[];n.push(t),this._headersMap.set(e,n)},e.prototype["delete"]=function(e){this._headersMap["delete"](e)},e.prototype.forEach=function(e){this._headersMap.forEach(e)},e.prototype.get=function(e){return i.ListWrapper.first(this._headersMap.get(e))},e.prototype.has=function(e){return this._headersMap.has(e)},e.prototype.keys=function(){return i.MapWrapper.keys(this._headersMap)},e.prototype.set=function(e,t){var r=[];if(i.isListLikeIterable(t)){var n=t.join(",");r.push(n)}else r.push(t);this._headersMap.set(e,r)},e.prototype.values=function(){return i.MapWrapper.values(this._headersMap)},e.prototype.toJSON=function(){return a.Json.stringify(this.values())},e.prototype.getAll=function(e){var t=this._headersMap.get(e);return i.isListLikeIterable(t)?t:[]},e.prototype.entries=function(){throw new o.BaseException('"entries" method is not implemented on Headers class')},e}();return t.Headers=c,n.define=s,r.exports}),System.register("angular2/src/http/enums",[],!0,function(e,t,r){var n=System.global,s=n.define;return n.define=void 0,function(e){e[e.Get=0]="Get",e[e.Post=1]="Post",e[e.Put=2]="Put",e[e.Delete=3]="Delete",e[e.Options=4]="Options",e[e.Head=5]="Head",e[e.Patch=6]="Patch"}(t.RequestMethod||(t.RequestMethod={})),t.RequestMethod,!function(e){e[e.Unsent=0]="Unsent",e[e.Open=1]="Open",e[e.HeadersReceived=2]="HeadersReceived",e[e.Loading=3]="Loading",e[e.Done=4]="Done",e[e.Cancelled=5]="Cancelled"}(t.ReadyState||(t.ReadyState={})),t.ReadyState,!function(e){e[e.Basic=0]="Basic",e[e.Cors=1]="Cors",e[e.Default=2]="Default",e[e.Error=3]="Error",e[e.Opaque=4]="Opaque"}(t.ResponseType||(t.ResponseType={})),t.ResponseType,n.define=s,r.exports}),System.register("angular2/src/http/url_search_params",["angular2/src/facade/lang","angular2/src/facade/collection"],!0,function(e,t,r){function n(e){void 0===e&&(e="");var t=new i.Map;if(e.length>0){var r=e.split("&");r.forEach(function(e){var r=e.split("="),n=r[0],s=r[1],a=o.isPresent(t.get(n))?t.get(n):[];a.push(s),t.set(n,a)})}return t}var s=System.global,a=s.define;s.define=void 0;var o=e("angular2/src/facade/lang"),i=e("angular2/src/facade/collection"),c=function(){function e(e){void 0===e&&(e=""),this.rawParams=e,this.paramsMap=n(e)}return e.prototype.clone=function(){var t=new e;return t.appendAll(this),t},e.prototype.has=function(e){return this.paramsMap.has(e)},e.prototype.get=function(e){var t=this.paramsMap.get(e);return i.isListLikeIterable(t)?i.ListWrapper.first(t):null},e.prototype.getAll=function(e){var t=this.paramsMap.get(e);return o.isPresent(t)?t:[]},e.prototype.set=function(e,t){var r=this.paramsMap.get(e),n=o.isPresent(r)?r:[];i.ListWrapper.clear(n),n.push(t),this.paramsMap.set(e,n)},e.prototype.setAll=function(e){var t=this;e.paramsMap.forEach(function(e,r){var n=t.paramsMap.get(r),s=o.isPresent(n)?n:[];i.ListWrapper.clear(s),s.push(e[0]),t.paramsMap.set(r,s)})},e.prototype.append=function(e,t){var r=this.paramsMap.get(e),n=o.isPresent(r)?r:[];n.push(t),this.paramsMap.set(e,n)},e.prototype.appendAll=function(e){var t=this;e.paramsMap.forEach(function(e,r){for(var n=t.paramsMap.get(r),s=o.isPresent(n)?n:[],a=0;a<e.length;++a)s.push(e[a]);t.paramsMap.set(r,s)})},e.prototype.replaceAll=function(e){var t=this;e.paramsMap.forEach(function(e,r){var n=t.paramsMap.get(r),s=o.isPresent(n)?n:[];i.ListWrapper.clear(s);for(var a=0;a<e.length;++a)s.push(e[a]);t.paramsMap.set(r,s)})},e.prototype.toString=function(){var e=[];return this.paramsMap.forEach(function(t,r){t.forEach(function(t){return e.push(r+"="+t)})}),e.join("&")},e.prototype["delete"]=function(e){this.paramsMap["delete"](e)},e}();return t.URLSearchParams=c,s.define=a,r.exports}),System.register("angular2/src/http/static_response",["angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/http/http_utils"],!0,function(e,t,r){var n=System.global,s=n.define;n.define=void 0;var a=e("angular2/src/facade/lang"),o=e("angular2/src/facade/exceptions"),i=e("angular2/src/http/http_utils"),c=function(){function e(e){this._body=e.body,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers,this.type=e.type,this.url=e.url}return e.prototype.blob=function(){throw new o.BaseException('"blob()" method not implemented on Response superclass')},e.prototype.json=function(){var e;return i.isJsObject(this._body)?e=this._body:a.isString(this._body)&&(e=a.Json.parse(this._body)),e},e.prototype.text=function(){return this._body.toString()},e.prototype.arrayBuffer=function(){throw new o.BaseException('"arrayBuffer()" method not implemented on Response superclass')},e}();return t.Response=c,n.define=s,r.exports}),System.register("angular2/src/http/base_response_options",["angular2/core","angular2/src/facade/lang","angular2/src/http/headers","angular2/src/http/enums"],!0,function(e,t,r){var n=System.global,s=n.define;n.define=void 0;var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},o=this&&this.__decorate||function(e,t,r,n){var s,a=arguments.length,o=3>a?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(s=e[i])&&(o=(3>a?s(o):a>3?s(t,r,o):s(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/core"),u=e("angular2/src/facade/lang"),p=e("angular2/src/http/headers"),l=e("angular2/src/http/enums"),d=function(){function e(e){var t=void 0===e?{}:e,r=t.body,n=t.status,s=t.headers,a=t.statusText,o=t.type,i=t.url;this.body=u.isPresent(r)?r:null,this.status=u.isPresent(n)?n:null,this.headers=u.isPresent(s)?s:null,this.statusText=u.isPresent(a)?a:null,this.type=u.isPresent(o)?o:null,this.url=u.isPresent(i)?i:null}return e.prototype.merge=function(t){return new e({body:u.isPresent(t)&&u.isPresent(t.body)?t.body:this.body,status:u.isPresent(t)&&u.isPresent(t.status)?t.status:this.status,headers:u.isPresent(t)&&u.isPresent(t.headers)?t.headers:this.headers,statusText:u.isPresent(t)&&u.isPresent(t.statusText)?t.statusText:this.statusText,type:u.isPresent(t)&&u.isPresent(t.type)?t.type:this.type,url:u.isPresent(t)&&u.isPresent(t.url)?t.url:this.url})},e}();t.ResponseOptions=d;var h=function(e){function t(){e.call(this,{status:200,statusText:"Ok",type:l.ResponseType.Default,headers:new p.Headers})}return a(t,e),t=o([c.Injectable(),i("design:paramtypes",[])],t)}(d);return t.BaseResponseOptions=h,n.define=s,r.exports}),System.register("angular2/src/http/backends/browser_xhr",["angular2/core"],!0,function(e,t,r){var n=System.global,s=n.define;n.define=void 0;var a=this&&this.__decorate||function(e,t,r,n){var s,a=arguments.length,o=3>a?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(s=e[i])&&(o=(3>a?s(o):a>3?s(t,r,o):s(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},o=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},i=e("angular2/core"),c=function(){function e(){}return e.prototype.build=function(){return new XMLHttpRequest},e=a([i.Injectable(),o("design:paramtypes",[])],e)}();return t.BrowserXhr=c,n.define=s,r.exports}),System.register("angular2/src/http/backends/browser_jsonp",["angular2/core","angular2/src/facade/lang"],!0,function(e,t,r){function n(){return null===l&&(l=u.global[t.JSONP_HOME]={}),l}var s=System.global,a=s.define;s.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){var s,a=arguments.length,o=3>a?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(s=e[i])&&(o=(3>a?s(o):a>3?s(t,r,o):s(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/core"),u=e("angular2/src/facade/lang"),p=0;t.JSONP_HOME="__ng_jsonp__";var l=null,d=function(){function e(){}return e.prototype.build=function(e){var t=document.createElement("script");return t.src=e,t},e.prototype.nextRequestID=function(){return"__req"+p++},e.prototype.requestCallback=function(e){return t.JSONP_HOME+"."+e+".finished"},e.prototype.exposeConnection=function(e,t){var r=n();r[e]=t},e.prototype.removeConnection=function(e){var t=n();t[e]=null},e.prototype.send=function(e){document.body.appendChild(e)},e.prototype.cleanup=function(e){e.parentNode&&e.parentNode.removeChild(e)},e=o([c.Injectable(),i("design:paramtypes",[])],e)}();return t.BrowserJsonp=d,s.define=a,r.exports}),System.register("angular2/src/http/http_utils",["angular2/src/facade/lang","angular2/src/http/enums","angular2/src/facade/exceptions","angular2/src/facade/lang"],!0,function(e,t,r){function n(e){if(i.isString(e)){var t=e;if(e=e.replace(/(\w)(\w*)/g,function(e,t,r){return t.toUpperCase()+r.toLowerCase()}),e=c.RequestMethod[e],"number"!=typeof e)throw u.makeTypeError('Invalid request method. The method "'+t+'" is not supported.')}return e}function s(e){return"responseURL"in e?e.responseURL:/^X-Request-URL:/m.test(e.getAllResponseHeaders())?e.getResponseHeader("X-Request-URL"):void 0}var a=System.global,o=a.define;a.define=void 0;var i=e("angular2/src/facade/lang"),c=e("angular2/src/http/enums"),u=e("angular2/src/facade/exceptions");t.normalizeMethodName=n,t.isSuccess=function(e){return e>=200&&300>e},t.getResponseURL=s;var p=e("angular2/src/facade/lang");return t.isJsObject=p.isJsObject,a.define=o,r.exports}),System.register("angular2/src/http/base_request_options",["angular2/src/facade/lang","angular2/src/http/headers","angular2/src/http/enums","angular2/core","angular2/src/http/url_search_params","angular2/src/http/http_utils"],!0,function(e,t,r){var n=System.global,s=n.define;n.define=void 0;var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},o=this&&this.__decorate||function(e,t,r,n){var s,a=arguments.length,o=3>a?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(s=e[i])&&(o=(3>a?s(o):a>3?s(t,r,o):s(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/facade/lang"),u=e("angular2/src/http/headers"),p=e("angular2/src/http/enums"),l=e("angular2/core"),d=e("angular2/src/http/url_search_params"),h=e("angular2/src/http/http_utils"),f=function(){function e(e){var t=void 0===e?{}:e,r=t.method,n=t.headers,s=t.body,a=t.url,o=t.search;this.method=c.isPresent(r)?h.normalizeMethodName(r):null,this.headers=c.isPresent(n)?n:null,this.body=c.isPresent(s)?s:null,this.url=c.isPresent(a)?a:null,this.search=c.isPresent(o)?c.isString(o)?new d.URLSearchParams(o):o:null}return e.prototype.merge=function(t){return new e({method:c.isPresent(t)&&c.isPresent(t.method)?t.method:this.method,headers:c.isPresent(t)&&c.isPresent(t.headers)?t.headers:this.headers,body:c.isPresent(t)&&c.isPresent(t.body)?t.body:this.body,url:c.isPresent(t)&&c.isPresent(t.url)?t.url:this.url,search:c.isPresent(t)&&c.isPresent(t.search)?c.isString(t.search)?new d.URLSearchParams(t.search):t.search.clone():this.search})},e}();t.RequestOptions=f;var g=function(e){function t(){e.call(this,{method:p.RequestMethod.Get,headers:new u.Headers})}return a(t,e),t=o([l.Injectable(),i("design:paramtypes",[])],t)}(f);return t.BaseRequestOptions=g,n.define=s,r.exports}),System.register("angular2/src/http/backends/xhr_backend",["angular2/src/http/enums","angular2/src/http/static_response","angular2/src/http/headers","angular2/src/http/base_response_options","angular2/core","angular2/src/http/backends/browser_xhr","angular2/src/facade/lang","rxjs/Observable","angular2/src/http/http_utils"],!0,function(e,t,r){var n=System.global,s=n.define;n.define=void 0;var a=this&&this.__decorate||function(e,t,r,n){var s,a=arguments.length,o=3>a?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(s=e[i])&&(o=(3>a?s(o):a>3?s(t,r,o):s(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},o=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},i=e("angular2/src/http/enums"),c=e("angular2/src/http/static_response"),u=e("angular2/src/http/headers"),p=e("angular2/src/http/base_response_options"),l=e("angular2/core"),d=e("angular2/src/http/backends/browser_xhr"),h=e("angular2/src/facade/lang"),f=e("rxjs/Observable"),g=e("angular2/src/http/http_utils"),y=function(){function e(e,t,r){var n=this;this.request=e,this.response=new f.Observable(function(s){var a=t.build();a.open(i.RequestMethod[e.method].toUpperCase(),e.url);var o=function(){var e=h.isPresent(a.response)?a.response:a.responseText,t=u.Headers.fromResponseHeaderString(a.getAllResponseHeaders()),n=g.getResponseURL(a),o=1223===a.status?204:a.status;0===o&&(o=e?200:0);var i=new p.ResponseOptions({body:e,status:o,headers:t,url:n});h.isPresent(r)&&(i=r.merge(i));var l=new c.Response(i);return g.isSuccess(o)?(s.next(l),void s.complete()):void s.error(l)},l=function(e){var t=new p.ResponseOptions({body:e,type:i.ResponseType.Error});h.isPresent(r)&&(t=r.merge(t)),s.error(new c.Response(t))};return h.isPresent(e.headers)&&e.headers.forEach(function(e,t){return a.setRequestHeader(t,e.join(","))}),a.addEventListener("load",o),a.addEventListener("error",l),a.send(n.request.text()),function(){a.removeEventListener("load",o),a.removeEventListener("error",l),a.abort()}})}return e}();t.XHRConnection=y;var b=function(){function e(e,t){this._browserXHR=e,this._baseResponseOptions=t}return e.prototype.createConnection=function(e){return new y(e,this._browserXHR,this._baseResponseOptions)},e=a([l.Injectable(),o("design:paramtypes",[d.BrowserXhr,p.ResponseOptions])],e)}();return t.XHRBackend=b,n.define=s,r.exports}),System.register("angular2/src/http/backends/jsonp_backend",["angular2/src/http/interfaces","angular2/src/http/enums","angular2/src/http/static_response","angular2/src/http/base_response_options","angular2/core","angular2/src/http/backends/browser_jsonp","angular2/src/facade/exceptions","angular2/src/facade/lang","rxjs/Observable"],!0,function(e,t,r){var n=System.global,s=n.define;n.define=void 0;var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},o=this&&this.__decorate||function(e,t,r,n){var s,a=arguments.length,o=3>a?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(s=e[i])&&(o=(3>a?s(o):a>3?s(t,r,o):s(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/http/interfaces"),u=e("angular2/src/http/enums"),p=e("angular2/src/http/static_response"),l=e("angular2/src/http/base_response_options"),d=e("angular2/core"),h=e("angular2/src/http/backends/browser_jsonp"),f=e("angular2/src/facade/exceptions"),g=e("angular2/src/facade/lang"),y=e("rxjs/Observable"),b="JSONP injected script did not invoke callback.",_="JSONP requests must use GET request method.",m=function(){function e(){}return e}();t.JSONPConnection=m;var R=function(e){function t(t,r,n){var s=this;if(e.call(this),this._dom=r,this.baseResponseOptions=n,this._finished=!1,t.method!==u.RequestMethod.Get)throw f.makeTypeError(_);this.request=t,this.response=new y.Observable(function(e){s.readyState=u.ReadyState.Loading;var a=s._id=r.nextRequestID();r.exposeConnection(a,s);var o=r.requestCallback(s._id),i=t.url;i.indexOf("=JSONP_CALLBACK&")>-1?i=g.StringWrapper.replace(i,"=JSONP_CALLBACK&","="+o+"&"):i.lastIndexOf("=JSONP_CALLBACK")===i.length-"=JSONP_CALLBACK".length&&(i=i.substring(0,i.length-"=JSONP_CALLBACK".length)+("="+o));var c=s._script=r.build(i),d=function(t){if(s.readyState!==u.ReadyState.Cancelled){if(s.readyState=u.ReadyState.Done,r.cleanup(c),!s._finished){var a=new l.ResponseOptions({body:b,type:u.ResponseType.Error,url:i});return g.isPresent(n)&&(a=n.merge(a)),void e.error(new p.Response(a))}var o=new l.ResponseOptions({body:s._responseData,url:i});g.isPresent(s.baseResponseOptions)&&(o=s.baseResponseOptions.merge(o)),e.next(new p.Response(o)),e.complete()}},h=function(t){if(s.readyState!==u.ReadyState.Cancelled){s.readyState=u.ReadyState.Done,r.cleanup(c);var a=new l.ResponseOptions({body:t.message,type:u.ResponseType.Error});g.isPresent(n)&&(a=n.merge(a)),e.error(new p.Response(a))}};return c.addEventListener("load",d),c.addEventListener("error",h),r.send(c),function(){s.readyState=u.ReadyState.Cancelled,c.removeEventListener("load",d),c.removeEventListener("error",h),g.isPresent(c)&&s._dom.cleanup(c)}})}return a(t,e),t.prototype.finished=function(e){this._finished=!0,this._dom.removeConnection(this._id),this.readyState!==u.ReadyState.Cancelled&&(this._responseData=e)},t}(m);t.JSONPConnection_=R;var v=function(e){function t(){e.apply(this,arguments)}return a(t,e),t}(c.ConnectionBackend);t.JSONPBackend=v;var O=function(e){function t(t,r){e.call(this),this._browserJSONP=t,this._baseResponseOptions=r}return a(t,e),t.prototype.createConnection=function(e){return new R(e,this._browserJSONP,this._baseResponseOptions)},t=o([d.Injectable(),i("design:paramtypes",[h.BrowserJsonp,l.ResponseOptions])],t)}(v);return t.JSONPBackend_=O,n.define=s,r.exports}),System.register("angular2/src/http/static_request",["angular2/src/http/headers","angular2/src/http/http_utils","angular2/src/facade/lang"],!0,function(e,t,r){var n=System.global,s=n.define;n.define=void 0;var a=e("angular2/src/http/headers"),o=e("angular2/src/http/http_utils"),i=e("angular2/src/facade/lang"),c=function(){function e(e){var t=e.url;if(this.url=e.url,i.isPresent(e.search)){var r=e.search.toString();if(r.length>0){var n="?";i.StringWrapper.contains(this.url,"?")&&(n="&"==this.url[this.url.length-1]?"":"&"),this.url=t+n+r}}this._body=e.body,this.method=o.normalizeMethodName(e.method),this.headers=new a.Headers(e.headers)}return e.prototype.text=function(){return i.isPresent(this._body)?this._body.toString():""},e}();return t.Request=c,n.define=s,r.exports}),System.register("angular2/src/http/http",["angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/core","angular2/src/http/interfaces","angular2/src/http/static_request","angular2/src/http/base_request_options","angular2/src/http/enums"],!0,function(e,t,r){function n(e,t){return e.createConnection(t).response}function s(e,t,r,n){var s=e;return p.isPresent(t)?s.merge(new g.RequestOptions({method:t.method||r,url:t.url||n,search:t.search,headers:t.headers,body:t.body})):p.isPresent(r)?s.merge(new g.RequestOptions({method:r,url:n})):s.merge(new g.RequestOptions({url:n}))}var a=System.global,o=a.define;a.define=void 0;var i=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},c=this&&this.__decorate||function(e,t,r,n){var s,a=arguments.length,o=3>a?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(s=e[i])&&(o=(3>a?s(o):a>3?s(t,r,o):s(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},u=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},p=e("angular2/src/facade/lang"),l=e("angular2/src/facade/exceptions"),d=e("angular2/core"),h=e("angular2/src/http/interfaces"),f=e("angular2/src/http/static_request"),g=e("angular2/src/http/base_request_options"),y=e("angular2/src/http/enums"),b=function(){function e(e,t){this._backend=e,this._defaultOptions=t}return e.prototype.request=function(e,t){var r;if(p.isString(e))r=n(this._backend,new f.Request(s(this._defaultOptions,t,y.RequestMethod.Get,e)));else{if(!(e instanceof f.Request))throw l.makeTypeError("First argument must be a url string or Request instance.");r=n(this._backend,e)}return r},e.prototype.get=function(e,t){return n(this._backend,new f.Request(s(this._defaultOptions,t,y.RequestMethod.Get,e)))},e.prototype.post=function(e,t,r){return n(this._backend,new f.Request(s(this._defaultOptions.merge(new g.RequestOptions({body:t})),r,y.RequestMethod.Post,e)))},e.prototype.put=function(e,t,r){return n(this._backend,new f.Request(s(this._defaultOptions.merge(new g.RequestOptions({body:t})),r,y.RequestMethod.Put,e)))},e.prototype["delete"]=function(e,t){return n(this._backend,new f.Request(s(this._defaultOptions,t,y.RequestMethod.Delete,e)))},e.prototype.patch=function(e,t,r){return n(this._backend,new f.Request(s(this._defaultOptions.merge(new g.RequestOptions({body:t})),r,y.RequestMethod.Patch,e)))},e.prototype.head=function(e,t){return n(this._backend,new f.Request(s(this._defaultOptions,t,y.RequestMethod.Head,e)))},e=c([d.Injectable(),u("design:paramtypes",[h.ConnectionBackend,g.RequestOptions])],e)}();t.Http=b;var _=function(e){function t(t,r){e.call(this,t,r)}return i(t,e),t.prototype.request=function(e,t){var r;if(p.isString(e)&&(e=new f.Request(s(this._defaultOptions,t,y.RequestMethod.Get,e))),!(e instanceof f.Request))throw l.makeTypeError("First argument must be a url string or Request instance.");return e.method!==y.RequestMethod.Get&&l.makeTypeError("JSONP requests must use GET request method."),r=n(this._backend,e)},t=c([d.Injectable(),u("design:paramtypes",[h.ConnectionBackend,g.RequestOptions])],t)}(b);return t.Jsonp=_,a.define=o,r.exports}),System.register("angular2/http",["angular2/core","angular2/src/http/http","angular2/src/http/backends/xhr_backend","angular2/src/http/backends/jsonp_backend","angular2/src/http/backends/browser_xhr","angular2/src/http/backends/browser_jsonp","angular2/src/http/base_request_options","angular2/src/http/base_response_options","angular2/src/http/static_request","angular2/src/http/static_response","angular2/src/http/interfaces","angular2/src/http/backends/browser_xhr","angular2/src/http/base_request_options","angular2/src/http/base_response_options","angular2/src/http/backends/xhr_backend","angular2/src/http/backends/jsonp_backend","angular2/src/http/http","angular2/src/http/headers","angular2/src/http/enums","angular2/src/http/url_search_params"],!0,function(e,t,r){var n=System.global,s=n.define;n.define=void 0;var a=e("angular2/core"),o=e("angular2/src/http/http"),i=e("angular2/src/http/backends/xhr_backend"),c=e("angular2/src/http/backends/jsonp_backend"),u=e("angular2/src/http/backends/browser_xhr"),p=e("angular2/src/http/backends/browser_jsonp"),l=e("angular2/src/http/base_request_options"),d=e("angular2/src/http/base_response_options"),h=e("angular2/src/http/static_request");t.Request=h.Request;var f=e("angular2/src/http/static_response");t.Response=f.Response;var g=e("angular2/src/http/interfaces");t.Connection=g.Connection,t.ConnectionBackend=g.ConnectionBackend;var y=e("angular2/src/http/backends/browser_xhr");t.BrowserXhr=y.BrowserXhr;var b=e("angular2/src/http/base_request_options");t.BaseRequestOptions=b.BaseRequestOptions,t.RequestOptions=b.RequestOptions;var _=e("angular2/src/http/base_response_options");t.BaseResponseOptions=_.BaseResponseOptions,t.ResponseOptions=_.ResponseOptions;var m=e("angular2/src/http/backends/xhr_backend");t.XHRBackend=m.XHRBackend,t.XHRConnection=m.XHRConnection;var R=e("angular2/src/http/backends/jsonp_backend");t.JSONPBackend=R.JSONPBackend,t.JSONPConnection=R.JSONPConnection;var v=e("angular2/src/http/http");t.Http=v.Http,t.Jsonp=v.Jsonp;var O=e("angular2/src/http/headers");t.Headers=O.Headers;var P=e("angular2/src/http/enums");t.ResponseType=P.ResponseType,t.ReadyState=P.ReadyState,t.RequestMethod=P.RequestMethod;var S=e("angular2/src/http/url_search_params");return t.URLSearchParams=S.URLSearchParams,t.HTTP_PROVIDERS=[a.provide(o.Http,{useFactory:function(e,t){return new o.Http(e,t)},deps:[i.XHRBackend,l.RequestOptions]}),u.BrowserXhr,a.provide(l.RequestOptions,{useClass:l.BaseRequestOptions}),a.provide(d.ResponseOptions,{useClass:d.BaseResponseOptions}),i.XHRBackend],t.HTTP_BINDINGS=t.HTTP_PROVIDERS,t.JSONP_PROVIDERS=[a.provide(o.Jsonp,{useFactory:function(e,t){return new o.Jsonp(e,t)},deps:[c.JSONPBackend,l.RequestOptions]}),p.BrowserJsonp,a.provide(l.RequestOptions,{useClass:l.BaseRequestOptions}),a.provide(d.ResponseOptions,{useClass:d.BaseResponseOptions}),a.provide(c.JSONPBackend,{useClass:c.JSONPBackend_})],t.JSON_BINDINGS=t.JSONP_PROVIDERS,n.define=s,r.exports}); | Piicksarn/cdnjs | ajax/libs/angular.js/2.0.0-beta.2/http.min.js | JavaScript | mit | 26,579 |
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>접근 불가</title>
<style type="text/css">
/*<![CDATA[*/
body {font-family:"Verdana";font-weight:normal;color:black;background-color:white;}
h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}
p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top: -5px}
.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
/*]]>*/
</style>
</head>
<body>
<h1>접근 불가</h1>
<p>
현재 시스템 점검 중입니다. 조만간 다시 찾아뵙겠습니다.
</p>
<p>
고맙습니다.
</p>
<div class="version">
<?php echo date('Y-m-d H:i:s',$data['time']) .' '. $data['version']; ?>
</div>
</body>
</html>
| hisuley/Durian | releases/v1.0/framework/views/ko/error503.php | PHP | mit | 1,067 |
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.lang['el']={"dir":"ltr","editor":"Επεξεργαστής Πλούσιου Κειμένου","common":{"editorHelp":"Πατήστε το ALT 0 για βοήθεια","browseServer":"Εξερεύνηση διακομιστή","url":"URL","protocol":"Πρωτόκολλο","upload":"Ανέβασμα","uploadSubmit":"Αποστολή στον Διακομιστή","image":"Εικόνα","flash":"Εισαγωγή Flash","form":"Φόρμα","checkbox":"Κουτί επιλογής","radio":"Κουμπί επιλογής","textField":"Πεδίο κειμένου","textarea":"Περιοχή κειμένου","hiddenField":"Κρυφό πεδίο","button":"Κουμπί","select":"Πεδίο επιλογής","imageButton":"Κουμπί εικόνας","notSet":"<δεν έχει ρυθμιστεί>","id":"Id","name":"Όνομα","langDir":"Κατεύθυνση κειμένου","langDirLtr":"Αριστερά προς Δεξιά (LTR)","langDirRtl":"Δεξιά προς Αριστερά (RTL)","langCode":"Κωδικός Γλώσσας","longDescr":"Αναλυτική περιγραφή URL","cssClass":"Stylesheet Classes","advisoryTitle":"Ενδεικτικός τίτλος","cssStyle":"Μορφή κειμένου","ok":"OK","cancel":"Ακύρωση","close":"Κλείσιμο","preview":"Προεπισκόπηση","resize":"Σύρσιμο για αλλαγή μεγέθους","generalTab":"Γενικά","advancedTab":"Για προχωρημένους","validateNumberFailed":"Αυτή η τιμή δεν είναι αριθμός.","confirmNewPage":"Οι όποιες αλλαγές στο περιεχόμενο θα χαθούν. Είσαστε σίγουροι ότι θέλετε να φορτώσετε μια νέα σελίδα;","confirmCancel":"Μερικές επιλογές έχουν αλλάξει. Είσαστε σίγουροι ότι θέλετε να κλείσετε το παράθυρο διαλόγου;","options":"Επιλογές","target":"Προορισμός","targetNew":"Νέο Παράθυρο (_blank)","targetTop":"Αρχική Περιοχή (_top)","targetSelf":"Ίδια Περιοχή (_self)","targetParent":"Γονεϊκό Παράθυρο (_parent)","langDirLTR":"Αριστερά προς Δεξιά (LTR)","langDirRTL":"Δεξιά προς Αριστερά (RTL)","styles":"Μορφή","cssClasses":"Stylesheet Classes","width":"Πλάτος","height":"Ύψος","align":"Στοίχιση","alignLeft":"Αριστερά","alignRight":"Δεξιά","alignCenter":"Κέντρο","alignTop":"Πάνω","alignMiddle":"Μέση","alignBottom":"Κάτω","invalidValue":"Μη έγκυρη τιμή.","invalidHeight":"Το ύψος πρέπει να είναι ένας αριθμός.","invalidWidth":"Το πλάτος πρέπει να είναι ένας αριθμός.","invalidCssLength":"Η τιμή που ορίζεται για το πεδίο \"%1\" πρέπει να είναι ένας θετικός αριθμός με ή χωρίς μια έγκυρη μονάδα μέτρησης CSS (px, %, in, cm, mm, em, ex, pt, ή pc).","invalidHtmlLength":"Η τιμή που ορίζεται για το πεδίο \"%1\" πρέπει να είναι ένας θετικός αριθμός με ή χωρίς μια έγκυρη μονάδα μέτρησης HTML (px ή %).","invalidInlineStyle":"Η τιμή για το εν σειρά στυλ πρέπει να περιέχει ένα ή περισσότερα ζεύγη με την μορφή \"όνομα: τιμή\" διαχωρισμένα με Ελληνικό ερωτηματικό.","cssLengthTooltip":"Εισάγεται μια τιμή σε pixel ή έναν αριθμό μαζί με μια έγκυρη μονάδα μέτρησης CSS (px, %, in, cm, mm, em, ex, pt, ή pc).","unavailable":"%1<span class=\"cke_accessibility\">, δεν είναι διαθέσιμο</span>"},"about":{"copy":"Πνευματικά δικαιώματα © $1 Με επιφύλαξη παντός δικαιώματος.","dlgTitle":"Περί του CKEditor","help":"Ελέγξτε το $1 για βοήθεια.","moreInfo":"Για πληροφορίες αδειών παρακαλούμε επισκεφθείτε την ιστοσελίδα μας:","title":"Περί του CKEditor","userGuide":"CKEditor User's Guide"},"basicstyles":{"bold":"Έντονα","italic":"Πλάγια","strike":"Διαγράμμιση","subscript":"Δείκτης","superscript":"Εκθέτης","underline":"Υπογράμμιση"},"bidi":{"ltr":"Διεύθυνση κειμένου από αριστερά στα δεξιά","rtl":"Διεύθυνση κειμένου από δεξιά στα αριστερά"},"blockquote":{"toolbar":"Περιοχή Παράθεσης"},"clipboard":{"copy":"Αντιγραφή","copyError":"Οι ρυθμίσεις ασφαλείας του φυλλομετρητή σας δεν επιτρέπουν την επιλεγμένη εργασία αντιγραφής. Χρησιμοποιείστε το πληκτρολόγιο (Ctrl/Cmd+C).","cut":"Αποκοπή","cutError":"Οι ρυθμίσεις ασφαλείας του φυλλομετρητή σας δεν επιτρέπουν την επιλεγμένη εργασία αποκοπής. Χρησιμοποιείστε το πληκτρολόγιο (Ctrl/Cmd+X).","paste":"Επικόλληση","pasteArea":"Περιοχή Επικόλλησης","pasteMsg":"Παρακαλώ επικολήστε στο ακόλουθο κουτί χρησιμοποιόντας το πληκτρολόγιο (<strong>Ctrl/Cmd+V</strong>) και πατήστε OK.","securityMsg":"Λόγων των ρυθμίσεων ασφάλειας του περιηγητή σας, ο επεξεργαστής δεν μπορεί να έχει πρόσβαση στην μνήμη επικόλλησης. Χρειάζεται να επικολλήσετε ξανά σε αυτό το παράθυρο.","title":"Επικόλληση"},"colorbutton":{"auto":"Αυτόματα","bgColorTitle":"Χρώμα Φόντου","colors":{"000":"Μαύρο","800000":"Maroon","8B4513":"Saddle Brown","2F4F4F":"Dark Slate Gray","008080":"Teal","000080":"Navy","4B0082":"Indigo","696969":"Dark Gray","B22222":"Fire Brick","A52A2A":"Brown","DAA520":"Golden Rod","006400":"Dark Green","40E0D0":"Turquoise","0000CD":"Medium Blue","800080":"Μώβ","808080":"Γκρί","F00":"Red","FF8C00":"Dark Orange","FFD700":"Gold","008000":"Green","0FF":"Cyan","00F":"Blue","EE82EE":"Violet","A9A9A9":"Dim Gray","FFA07A":"Light Salmon","FFA500":"Orange","FFFF00":"Yellow","00FF00":"Lime","AFEEEE":"Pale Turquoise","ADD8E6":"Light Blue","DDA0DD":"Plum","D3D3D3":"Light Grey","FFF0F5":"Lavender Blush","FAEBD7":"Antique White","FFFFE0":"Light Yellow","F0FFF0":"Honeydew","F0FFFF":"Azure","F0F8FF":"Alice Blue","E6E6FA":"Lavender","FFF":"White"},"more":"Περισσότερα χρώματα...","panelTitle":"Χρώματα","textColorTitle":"Χρώμα Κειμένου"},"colordialog":{"clear":"Καθαρισμός","highlight":"Σήμανση","options":"Επιλογές Χρωμάτων","selected":"Επιλεγμένο Χρώμα","title":"Επιλογή Χρώματος"},"templates":{"button":"Πρότυπα","emptyListMsg":"(Δεν έχουν καθοριστεί πρότυπα)","insertOption":"Αντικατάσταση υπάρχοντων περιεχομένων","options":"Επιλογές Προτύπου","selectPromptMsg":"Παρακαλώ επιλέξτε πρότυπο για εισαγωγή στο πρόγραμμα","title":"Πρότυπα Περιεχομένου"},"contextmenu":{"options":"Επιλογές Αναδυόμενου Μενού"},"div":{"IdInputLabel":"Id","advisoryTitleInputLabel":"Ενδεικτικός Τίτλος","cssClassInputLabel":"Stylesheet Classes","edit":"Επεξεργασία Div","inlineStyleInputLabel":"Στυλ Εν Σειρά","langDirLTRLabel":"Αριστερά προς Δεξιά (LTR)","langDirLabel":"Κατεύθυνση Κειμένου","langDirRTLLabel":"Δεξιά προς Αριστερά (RTL)","languageCodeInputLabel":"Κωδικός Γλώσσας","remove":"Διαγραφή Div","styleSelectLabel":"Μορφή","title":"Δημιουργεία Div","toolbar":"Δημιουργεία Div"},"toolbar":{"toolbarCollapse":"Σύμπτηξη Εργαλειοθήκης","toolbarExpand":"Ανάπτυξη Εργαλειοθήκης","toolbarGroups":{"document":"Έγγραφο","clipboard":"Clipboard/Undo","editing":"Σε επεξεργασία","forms":"Φόρμες","basicstyles":"Βασικά στυλ","paragraph":"Παράγραφος","links":"Συνδέσμοι","insert":"Εισαγωγή","styles":"Στυλ","colors":"Χρώματα","tools":"Εργαλεία"},"toolbars":"Εργαλειοθήκες Επεξεργαστή"},"elementspath":{"eleLabel":"Διαδρομή στοιχείων","eleTitle":"%1 στοιχείο"},"find":{"find":"Αναζήτηση","findOptions":"Find Options","findWhat":"Αναζήτηση για:","matchCase":"Έλεγχος πεζών/κεφαλαίων","matchCyclic":"Match cyclic","matchWord":"Εύρεση πλήρους λέξης","notFoundMsg":"Το κείμενο δεν βρέθηκε.","replace":"Αντικατάσταση","replaceAll":"Αντικατάσταση Όλων","replaceSuccessMsg":"%1 occurrence(s) replaced.","replaceWith":"Αντικατάσταση με:","title":"Αναζήτηση και Αντικατάσταση"},"fakeobjects":{"anchor":"Εισαγωγή/επεξεργασία Άγκυρας","flash":"Ταινία Flash","hiddenfield":"Κρυφό πεδίο","iframe":"IFrame","unknown":"Άγνωστο Αντικείμενο"},"flash":{"access":"Πρόσβαση Script","accessAlways":"Πάντα","accessNever":"Ποτέ","accessSameDomain":"Ίδιο όνομα τομέα","alignAbsBottom":"Απόλυτα Κάτω","alignAbsMiddle":"Απόλυτα στη Μέση","alignBaseline":"Γραμμή Βάσης","alignTextTop":"Κορυφή Κειμένου","bgcolor":"Χρώμα Υποβάθρου","chkFull":"Να Επιτρέπεται η Προβολή σε Πλήρη Οθόνη","chkLoop":"Επανάληψη","chkMenu":"Ενεργοποίηση Flash Menu","chkPlay":"Αυτόματη Εκτέλεση","flashvars":"Μεταβλητές για Flash","hSpace":"Οριζόντιο Διάστημα","properties":"Ιδιότητες Flash","propertiesTab":"Ιδιότητες","quality":"Ποιότητα","qualityAutoHigh":"Αυτόματη Υψηλή","qualityAutoLow":"Αυτόματη Χαμηλή","qualityBest":"Καλύτερη","qualityHigh":"Υψηλή","qualityLow":"Χαμηλή","qualityMedium":"Μεσαία","scale":"Μεγέθυνση","scaleAll":"Εμφάνιση όλων","scaleFit":"Ακριβές Μέγεθος","scaleNoBorder":"Χωρίς Περίγραμμα","title":"Ιδιότητες Flash","vSpace":"Κάθετο Διάστημα","validateHSpace":"Το HSpace πρέπει να είναι αριθμός.","validateSrc":"Εισάγετε την τοποθεσία (URL) του υπερσυνδέσμου (Link)","validateVSpace":"Το VSpace πρέπει να είναι αριθμός.","windowMode":"Τρόπος λειτουργίας παραθύρου.","windowModeOpaque":"Συμπαγές","windowModeTransparent":"Διάφανο","windowModeWindow":"Παράθυρο"},"font":{"fontSize":{"label":"Μέγεθος","voiceLabel":"Μέγεθος γραμματοσειράς","panelTitle":"Μέγεθος Γραμματοσειράς"},"label":"Γραμματοσειρά","panelTitle":"Όνομα Γραμματοσειράς","voiceLabel":"Γραμματοσειρά"},"forms":{"button":{"title":"Ιδιότητες Κουμπιού","text":"Κείμενο (Τιμή)","type":"Τύπος","typeBtn":"Κουμπί","typeSbm":"Υποβολή","typeRst":"Επαναφορά"},"checkboxAndRadio":{"checkboxTitle":"Ιδιότητες Κουτιού Επιλογής","radioTitle":"Ιδιότητες Κουμπιού Επιλογής","value":"Τιμή","selected":"Επιλεγμένο"},"form":{"title":"Ιδιότητες Φόρμας","menu":"Ιδιότητες Φόρμας","action":"Δράση","method":"Μέθοδος","encoding":"Κωδικοποίηση"},"hidden":{"title":"Ιδιότητες Κρυφού Πεδίου","name":"Όνομα","value":"Τιμή"},"select":{"title":"Ιδιότητες Πεδίου Επιλογής","selectInfo":"Πληροφορίες Πεδίου Επιλογής","opAvail":"Διαθέσιμες Επιλογές","value":"Τιμή","size":"Μέγεθος","lines":"γραμμές","chkMulti":"Να επιτρέπονται οι πολλαπλές επιλογές","opText":"Κείμενο","opValue":"Τιμή","btnAdd":"Προσθήκη","btnModify":"Τροποποίηση","btnUp":"Πάνω","btnDown":"Κάτω","btnSetValue":"Προεπιλογή","btnDelete":"Διαγραφή"},"textarea":{"title":"Ιδιότητες Περιοχής Κειμένου","cols":"Στήλες","rows":"Σειρές"},"textfield":{"title":"Ιδιότητες Πεδίου Κειμένου","name":"Όνομα","value":"Τιμή","charWidth":"Πλάτος Χαρακτήρων","maxChars":"Μέγιστοι χαρακτήρες","type":"Τύπος","typeText":"Κείμενο","typePass":"Κωδικός","typeEmail":"Email","typeSearch":"Αναζήτηση","typeTel":"Τηλέφωνο ","typeUrl":"URL"}},"format":{"label":"Μορφοποίηση","panelTitle":"Μορφοποίηση Παραγράφου","tag_address":"Διεύθυνση","tag_div":"Κανονικό (DIV)","tag_h1":"Επικεφαλίδα 1","tag_h2":"Επικεφαλίδα 2","tag_h3":"Επικεφαλίδα 3","tag_h4":"Επικεφαλίδα 4","tag_h5":"Επικεφαλίδα 5","tag_h6":"Επικεφαλίδα 6","tag_p":"Κανονικό","tag_pre":"Μορφοποιημένο"},"horizontalrule":{"toolbar":"Εισαγωγή Οριζόντιας Γραμμής"},"iframe":{"border":"Προβολή περιγράμματος πλαισίου","noUrl":"Παρακαλούμε εισάγεται το URL του iframe","scrolling":"Ενεργοποίηση μπαρών κύλισης","title":"IFrame Properties","toolbar":"IFrame"},"image":{"alertUrl":"Εισάγετε την τοποθεσία (URL) της εικόνας","alt":"Εναλλακτικό Κείμενο","border":"Περίγραμμα","btnUpload":"Αποστολή στον Διακομιστή","button2Img":"Θέλετε να μετατρέψετε το επιλεγμένο κουμπί εικόνας σε απλή εικόνα;","hSpace":"Οριζόντιο Διάστημα","img2Button":"Θέλετε να μεταμορφώσετε την επιλεγμένη εικόνα που είναι πάνω σε ένα κουμπί;","infoTab":"Πληροφορίες Εικόνας","linkTab":"Σύνδεσμος","lockRatio":"Κλείδωμα Αναλογίας","menu":"Ιδιότητες Εικόνας","resetSize":"Επαναφορά Αρχικού Μεγέθους","title":"Ιδιότητες Εικόνας","titleButton":"Ιδιότητες Κουμπιού Εικόνας","upload":"Ανέβασμα","urlMissing":"Το URL πηγής για την εικόνα λείπει.","vSpace":"Κάθετο Διάστημα","validateBorder":"Το περίγραμμα πρέπει να είναι ένας ακέραιος αριθμός.","validateHSpace":"Το HSpace πρέπει να είναι ένας ακέραιος αριθμός.","validateVSpace":"Το VSpace πρέπει να είναι ένας ακέραιος αριθμός."},"indent":{"indent":"Αύξηση Εσοχής","outdent":"Μείωση Εσοχής"},"smiley":{"options":"Επιλογές Smiley","title":"Επιλέξτε ένα Smiley","toolbar":"Smiley"},"justify":{"block":"Πλήρης Στοίχιση","center":"Στοίχιση στο Κέντρο","left":"Στοίχιση Αριστερά","right":"Στοίχιση Δεξιά"},"link":{"acccessKey":"Συντόμευση","advanced":"Για προχωρημένους","advisoryContentType":"Ενδεικτικός Τύπος Περιεχομένου","advisoryTitle":"Ενδεικτικός Τίτλος","anchor":{"toolbar":"Εισαγωγή/επεξεργασία Άγκυρας","menu":"Ιδιότητες άγκυρας","title":"Ιδιότητες άγκυρας","name":"Όνομα άγκυρας","errorName":"Παρακαλούμε εισάγετε όνομα άγκυρας","remove":"Αφαίρεση Άγκυρας"},"anchorId":"Βάσει του Element Id","anchorName":"Βάσει του Ονόματος της άγκυρας","charset":"Κωδικοποίηση Χαρακτήρων Προσαρτημένης Πηγής","cssClasses":"Stylesheet Classes","emailAddress":"Διεύθυνση e-mail","emailBody":"Κείμενο Μηνύματος","emailSubject":"Θέμα Μηνύματος","id":"Id","info":"Πληροφορίες Συνδέσμου","langCode":"Κατεύθυνση Κειμένου","langDir":"Κατεύθυνση Κειμένου","langDirLTR":"Αριστερά προς Δεξιά (LTR)","langDirRTL":"Δεξιά προς Αριστερά (RTL)","menu":"Επεξεργασία Συνδέσμου","name":"Όνομα","noAnchors":"(Δεν υπάρχουν άγκυρες στο κείμενο)","noEmail":"Εισάγετε την διεύθυνση ηλεκτρονικού ταχυδρομείου","noUrl":"Εισάγετε την τοποθεσία (URL) του υπερσυνδέσμου (Link)","other":"<άλλο>","popupDependent":"Εξαρτημένο (Netscape)","popupFeatures":"Επιλογές Αναδυόμενου Παραθύρου","popupFullScreen":"Πλήρης Οθόνη (IE)","popupLeft":"Θέση Αριστερά","popupLocationBar":"Γραμμή Τοποθεσίας","popupMenuBar":"Γραμμή Επιλογών","popupResizable":"Προσαρμοζόμενο Μέγεθος","popupScrollBars":"Μπάρες Κύλισης","popupStatusBar":"Γραμμή Κατάστασης","popupToolbar":"Εργαλειοθήκη","popupTop":"Θέση Πάνω","rel":"Σχέση","selectAnchor":"Επιλέξτε μια άγκυρα","styles":"Μορφή","tabIndex":"Σειρά Μεταπήδησης","target":"Παράθυρο Προορισμού","targetFrame":"<πλαίσιο>","targetFrameName":"Όνομα Παραθύρου Προορισμού","targetPopup":"<αναδυόμενο παράθυρο>","targetPopupName":"Όνομα Αναδυόμενου Παραθύρου","title":"Σύνδεσμος","toAnchor":"Άγκυρα σε αυτή τη σελίδα","toEmail":"E-Mail","toUrl":"URL","toolbar":"Σύνδεσμος","type":"Τύπος Συνδέσμου","unlink":"Αφαίρεση Συνδέσμου (Link)","upload":"Ανέβασμα"},"list":{"bulletedlist":"Εισαγωγή/Απομάκρυνση Λίστας Κουκκίδων","numberedlist":"Εισαγωγή/Απομάκρυνση Αριθμημένης Λίστας"},"liststyle":{"armenian":"Armenian numbering","bulletedTitle":"Ιδιότητες Λίστας Σημείων","circle":"Κύκλος","decimal":"Δεκαδικός (1, 2, 3, κτλ)","decimalLeadingZero":"Decimal leading zero (01, 02, 03, etc.)","disc":"Δίσκος","georgian":"Georgian numbering (an, ban, gan, etc.)","lowerAlpha":"Lower Alpha (a, b, c, d, e, etc.)","lowerGreek":"Lower Greek (alpha, beta, gamma, etc.)","lowerRoman":"Lower Roman (i, ii, iii, iv, v, etc.)","none":"Τίποτα","notset":"<δεν έχει οριστεί>","numberedTitle":"Ιδιότητες Αριθμημένης Λίστας ","square":"Τετράγωνο","start":"Εκκίνηση","type":"Τύπος","upperAlpha":"Upper Alpha (A, B, C, D, E, etc.)","upperRoman":"Upper Roman (I, II, III, IV, V, etc.)","validateStartNumber":"Ο αριθμός εκκίνησης της αρίθμησης πρέπει να είναι ακέραιος αριθμός."},"magicline":{"title":"Εισάγετε παράγραφο εδώ "},"maximize":{"maximize":"Μεγιστοποίηση","minimize":"Ελαχιστοποίηση"},"newpage":{"toolbar":"Νέα Σελίδα"},"pagebreak":{"alt":"Αλλαγή Σελίδας","toolbar":"Εισαγωγή τέλους σελίδας"},"pastetext":{"button":"Επικόλληση ως Απλό Κείμενο","title":"Επικόλληση ως Απλό Κείμενο"},"pastefromword":{"confirmCleanup":"Το κείμενο που επικολλάται φαίνεται να είναι αντιγραμμένο από το Word. Μήπως θα θέλατε να καθαριστεί προτού επικολληθεί;","error":"Δεν ήταν δυνατό να καθαριστούν τα δεδομένα λόγω ενός εσωτερικού σφάλματος","title":"Επικόλληση από το Word","toolbar":"Επικόλληση από το Word"},"preview":{"preview":"Προεπισκόπιση"},"print":{"toolbar":"Εκτύπωση"},"removeformat":{"toolbar":"Αφαίρεση Μορφοποίησης"},"save":{"toolbar":"Αποθήκευση"},"selectall":{"toolbar":"Επιλογή όλων"},"showblocks":{"toolbar":"Προβολή Περιοχών"},"sourcearea":{"toolbar":"HTML κώδικας"},"specialchar":{"options":"Επιλογές Ειδικών Χαρακτήρων","title":"Επιλέξτε έναν Ειδικό Χαρακτήρα","toolbar":"Εισαγωγή Ειδικού Χαρακτήρα"},"scayt":{"about":"About SCAYT","aboutTab":"Περί","addWord":"Προσθήκη στο λεξικό","allCaps":"Να αγνοούνται όλες οι λέξεις σε κεφαλαία","dic_create":"Δημιουργία","dic_delete":"Διαγραφή","dic_field_name":"Όνομα λεξικού","dic_info":"Initially the User Dictionary is stored in a Cookie. However, Cookies are limited in size. When the User Dictionary grows to a point where it cannot be stored in a Cookie, then the dictionary may be stored on our server. To store your personal dictionary on our server you should specify a name for your dictionary. If you already have a stored dictionary, please type its name and click the Restore button.","dic_rename":"Μετονομασία","dic_restore":"Ανάκτηση","dictionariesTab":"Λεξικά","disable":"Disable SCAYT","emptyDic":"Το όνομα του λεξικού δεν πρέπει να είναι κενό.","enable":"Enable SCAYT","ignore":"Αγνόησε το","ignoreAll":"Να αγνοηθούν όλα","ignoreDomainNames":"Ignore Domain Names","langs":"Γλώσσες","languagesTab":"Γλώσσες","mixedCase":"Ignore Words with Mixed Case","mixedWithDigits":"Ignore Words with Numbers","moreSuggestions":"Περισσότερες προτάσεις","opera_title":"Not supported by Opera","options":"Επιλογές","optionsTab":"Επιλογές","title":"Spell Check As You Type","toggle":"Toggle SCAYT","noSuggestions":"No suggestion"},"stylescombo":{"label":"Μορφές","panelTitle":"Στυλ Μορφοποίησης","panelTitle1":"Στυλ Κομματιών","panelTitle2":"Στυλ Εν Σειρά","panelTitle3":"Στυλ Αντικειμένων"},"table":{"border":"Πάχος Περιγράμματος","caption":"Λεζάντα","cell":{"menu":"Κελί","insertBefore":"Εισαγωγή Κελιού Πριν","insertAfter":"Εισαγωγή Κελιού Μετά","deleteCell":"Διαγραφή Κελιών","merge":"Ενοποίηση Κελιών","mergeRight":"Συγχώνευση Με Δεξιά","mergeDown":"Συγχώνευση Με Κάτω","splitHorizontal":"Οριζόντιο Μοίρασμα Κελιού","splitVertical":"Κατακόρυφο Μοίρασμα Κελιού","title":"Ιδιότητες Κελιού","cellType":"Τύπος Κελιού","rowSpan":"Εύρος Σειρών","colSpan":"Εύρος Στηλών","wordWrap":"Word Wrap","hAlign":"Οριζόντια Στοίχιση","vAlign":"Κάθετη Στοίχιση","alignBaseline":"Baseline","bgColor":"Χρώμα Φόντου","borderColor":"Χρώμα Περιγράμματος","data":"Δεδομένα","header":"Κεφαλίδα","yes":"Ναι","no":"Όχι","invalidWidth":"Το πλάτος του κελιού πρέπει να είναι ένας αριθμός.","invalidHeight":"Το ύψος του κελιού πρέπει να είναι ένας αριθμός.","invalidRowSpan":"Rows span must be a whole number.","invalidColSpan":"Columns span must be a whole number.","chooseColor":"Επιλέξτε"},"cellPad":"Γέμισμα κελιών","cellSpace":"Διάστημα κελιών","column":{"menu":"Στήλη","insertBefore":"Εισαγωγή Στήλης Πριν","insertAfter":"Εισαγωγή Σειράς Μετά","deleteColumn":"Διαγραφή Κολωνών"},"columns":"Κολώνες","deleteTable":"Διαγραφή πίνακα","headers":"Κεφαλίδες","headersBoth":"Και τα δύο","headersColumn":"Πρώτη Στήλη","headersNone":"Κανένα","headersRow":"Πρώτη Σειρά","invalidBorder":"Το πάχος του περιγράμματος πρέπει να είναι ένας αριθμός.","invalidCellPadding":"Το γέμισμα μέσα στα κελιά πρέπει να είναι ένας θετικός αριθμός.","invalidCellSpacing":"Η απόσταση μεταξύ των κελιών πρέπει να είναι ένας θετικός αριθμός.","invalidCols":"Ο αριθμός των στηλών πρέπει να είναι μεγαλύτερος από 0.","invalidHeight":"Το ύψος του πίνακα πρέπει να είναι ένας αριθμός.","invalidRows":"Ο αριθμός των σειρών πρέπει να είναι μεγαλύτερος από 0.","invalidWidth":"Το πλάτος του πίνακα πρέπει να είναι ένας αριθμός.","menu":"Ιδιότητες Πίνακα","row":{"menu":"Σειρά","insertBefore":"Εισαγωγή Σειράς Από Πάνω","insertAfter":"Εισαγωγή Σειράς Από Κάτω","deleteRow":"Διαγραφή Γραμμών"},"rows":"Γραμμές","summary":"Περίληψη","title":"Ιδιότητες Πίνακα","toolbar":"Πίνακας","widthPc":"τοις εκατό","widthPx":"pixels","widthUnit":"μονάδα πλάτους"},"undo":{"redo":"Επαναφορά","undo":"Αναίρεση"},"wsc":{"btnIgnore":"Αγνόηση","btnIgnoreAll":"Αγνόηση όλων","btnReplace":"Αντικατάσταση","btnReplaceAll":"Αντικατάσταση όλων","btnUndo":"Αναίρεση","changeTo":"Αλλαγή σε","errorLoading":"Error loading application service host: %s.","ieSpellDownload":"Δεν υπάρχει εγκατεστημένος ορθογράφος. Θέλετε να τον κατεβάσετε τώρα;","manyChanges":"Ο ορθογραφικός έλεγχος ολοκληρώθηκε: Άλλαξαν %1 λέξεις","noChanges":"Ο ορθογραφικός έλεγχος ολοκληρώθηκε: Δεν άλλαξαν λέξεις","noMispell":"Ο ορθογραφικός έλεγχος ολοκληρώθηκε: Δεν βρέθηκαν λάθη","noSuggestions":"- Δεν υπάρχουν προτάσεις -","notAvailable":"Η υπηρεσία δεν είναι διαθέσιμη αυτήν την στιγμή.","notInDic":"Δεν υπάρχει στο λεξικό","oneChange":"Ο ορθογραφικός έλεγχος ολοκληρώθηκε: Άλλαξε μια λέξη","progress":"Γίνεται ορθογραφικός έλεγχος...","title":"Ορθογραφικός Έλεγχος","toolbar":"Ορθογραφικός Έλεγχος"}}; | narikei/cdnjs | ajax/libs/ckeditor/4.2/lang/el.js | JavaScript | mit | 27,986 |
var createObjectMapper = require('../internal/createObjectMapper');
/**
* Creates an object with the same keys as `object` and values generated by
* running each own enumerable property of `object` through `iteratee`. The
* iteratee function is bound to `thisArg` and invoked with three arguments:
* (value, key, object).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Object} Returns the new mapped object.
* @example
*
* _.mapValues({ 'a': 1, 'b': 2 }, function(n) {
* return n * 3;
* });
* // => { 'a': 3, 'b': 6 }
*
* var users = {
* 'fred': { 'user': 'fred', 'age': 40 },
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
* };
*
* // using the `_.property` callback shorthand
* _.mapValues(users, 'age');
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
*/
var mapValues = createObjectMapper();
module.exports = mapValues;
| katgironpe/ruby-on-rails-intro | node_modules/grunt-contrib-uglify/node_modules/lodash/object/mapValues.js | JavaScript | mit | 1,608 |
/*!
* Bootstrap v3.3.6 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/.btn-danger,.btn-default,.btn-info,.btn-primary,.btn-success,.btn-warning{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-danger.active,.btn-danger:active,.btn-default.active,.btn-default:active,.btn-info.active,.btn-info:active,.btn-primary.active,.btn-primary:active,.btn-success.active,.btn-success:active,.btn-warning.active,.btn-warning:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-danger.disabled,.btn-danger[disabled],.btn-default.disabled,.btn-default[disabled],.btn-info.disabled,.btn-info[disabled],.btn-primary.disabled,.btn-primary[disabled],.btn-success.disabled,.btn-success[disabled],.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-danger,fieldset[disabled] .btn-default,fieldset[disabled] .btn-info,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-success,fieldset[disabled] .btn-warning{-webkit-box-shadow:none;box-shadow:none}.btn-danger .badge,.btn-default .badge,.btn-info .badge,.btn-primary .badge,.btn-success .badge,.btn-warning .badge{text-shadow:none}.btn.active,.btn:active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:focus,.btn-default:hover{background-color:#e0e0e0;background-position:0 -15px}.btn-default.active,.btn-default:active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled.focus,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled].focus,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-o-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#265a88));background-image:linear-gradient(to bottom,#337ab7 0,#265a88 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#245580}.btn-primary:focus,.btn-primary:hover{background-color:#265a88;background-position:0 -15px}.btn-primary.active,.btn-primary:active{background-color:#265a88;border-color:#245580}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#265a88;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:focus,.btn-success:hover{background-color:#419641;background-position:0 -15px}.btn-success.active,.btn-success:active{background-color:#419641;border-color:#3e8f3e}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled.focus,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled].focus,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:focus,.btn-info:hover{background-color:#2aabd2;background-position:0 -15px}.btn-info.active,.btn-info:active{background-color:#2aabd2;border-color:#28a4c9}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled.focus,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled].focus,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:focus,.btn-warning:hover{background-color:#eb9316;background-position:0 -15px}.btn-warning.active,.btn-warning:active{background-color:#eb9316;border-color:#e38d13}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled.focus,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled].focus,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:focus,.btn-danger:hover{background-color:#c12e2a;background-position:0 -15px}.btn-danger.active,.btn-danger:active{background-color:#c12e2a;border-color:#b92c28}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled.focus,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled].focus,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#c12e2a;background-image:none}.img-thumbnail,.thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{background-color:#2e6da4;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}@media (max-width:767px){.navbar .navbar-nav .open .dropdown-menu>.active>a,.navbar .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-o-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#286090));background-image:linear-gradient(to bottom,#337ab7 0,#286090 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{text-shadow:0 -1px 0 #286090;background-image:-webkit-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2b669a));background-image:linear-gradient(to bottom,#337ab7 0,#2b669a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);background-repeat:repeat-x;border-color:#2b669a}.list-group-item.active .badge,.list-group-item.active:focus .badge,.list-group-item.active:hover .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)}
/*# sourceMappingURL=bootstrap-theme.min.css.map */ | AirlanggaAcademicIS/MonitoringSkripsi | assets/bower_components/bootstrap/dist/css/bootstrap-theme.min.css | CSS | mit | 23,409 |
var http = require('http'),
https = require('https'),
web_o = require('./web-outgoing'),
common = require('../common'),
passes = exports;
web_o = Object.keys(web_o).map(function(pass) {
return web_o[pass];
});
/*!
* Array of passes.
*
* A `pass` is just a function that is executed on `req, res, options`
* so that you can easily add new checks while still keeping the base
* flexible.
*/
[ // <--
/**
* Sets `content-length` to '0' if request is of DELETE type.
*
* @param {ClientRequest} Req Request object
* @param {IncomingMessage} Res Response object
* @param {Object} Options Config object passed to the proxy
*
* @api private
*/
function deleteLength(req, res, options) {
if((req.method === 'DELETE' || req.method === 'OPTIONS')
&& !req.headers['content-length']) {
req.headers['content-length'] = '0';
delete req.headers['transfer-encoding'];
}
},
/**
* Sets timeout in request socket if it was specified in options.
*
* @param {ClientRequest} Req Request object
* @param {IncomingMessage} Res Response object
* @param {Object} Options Config object passed to the proxy
*
* @api private
*/
function timeout(req, res, options) {
if(options.timeout) {
req.socket.setTimeout(options.timeout);
}
},
/**
* Sets `x-forwarded-*` headers if specified in config.
*
* @param {ClientRequest} Req Request object
* @param {IncomingMessage} Res Response object
* @param {Object} Options Config object passed to the proxy
*
* @api private
*/
function XHeaders(req, res, options) {
if(!options.xfwd) return;
var encrypted = req.isSpdy || common.hasEncryptedConnection(req);
var values = {
for : req.connection.remoteAddress || req.socket.remoteAddress,
port : common.getPort(req),
proto: encrypted ? 'https' : 'http'
};
['for', 'port', 'proto'].forEach(function(header) {
req.headers['x-forwarded-' + header] =
(req.headers['x-forwarded-' + header] || '') +
(req.headers['x-forwarded-' + header] ? ',' : '') +
values[header];
});
req.headers['x-forwarded-host'] = req.headers['host'];
},
/**
* Does the actual proxying. If `forward` is enabled fires up
* a ForwardStream, same happens for ProxyStream. The request
* just dies otherwise.
*
* @param {ClientRequest} Req Request object
* @param {IncomingMessage} Res Response object
* @param {Object} Options Config object passed to the proxy
*
* @api private
*/
function stream(req, res, options, _, server, clb) {
// And we begin!
server.emit('start', req, res, options.target)
if(options.forward) {
// If forward enable, so just pipe the request
var forwardReq = (options.forward.protocol === 'https:' ? https : http).request(
common.setupOutgoing(options.ssl || {}, options, req, 'forward')
);
(options.buffer || req).pipe(forwardReq);
if(!options.target) { return res.end(); }
}
// Request initalization
var proxyReq = (options.target.protocol === 'https:' ? https : http).request(
common.setupOutgoing(options.ssl || {}, options, req)
);
// Enable developers to modify the proxyReq before headers are sent
proxyReq.on('socket', function(socket) {
if(server) { server.emit('proxyReq', proxyReq, req, res, options); }
});
// allow outgoing socket to timeout so that we could
// show an error page at the initial request
if(options.proxyTimeout) {
proxyReq.setTimeout(options.proxyTimeout, function() {
proxyReq.abort();
});
}
// Ensure we abort proxy if request is aborted
req.on('aborted', function () {
proxyReq.abort();
});
// Handle errors on incoming request as well as it makes sense to
req.on('error', proxyError);
// Error Handler
proxyReq.on('error', proxyError);
function proxyError (err){
if (req.socket.destroyed && err.code === 'ECONNRESET') {
server.emit('econnreset', err, req, res, options.target);
return proxyReq.abort();
}
if (clb) {
clb(err, req, res, options.target);
} else {
server.emit('error', err, req, res, options.target);
}
}
(options.buffer || req).pipe(proxyReq);
proxyReq.on('response', function(proxyRes) {
if(server) { server.emit('proxyRes', proxyRes, req, res); }
for(var i=0; i < web_o.length; i++) {
if(web_o[i](req, res, proxyRes, options)) { break; }
}
// Allow us to listen when the proxy has completed
proxyRes.on('end', function () {
server.emit('end', req, res, proxyRes);
});
proxyRes.pipe(res);
});
//proxyReq.end();
}
] // <--
.forEach(function(func) {
passes[func.name] = func;
});
| dlcarter/BasicOAuth2 | public/node_modules/http-server/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js | JavaScript | mit | 4,895 |
!function(t){var e,i=this,n=i.document,a=t(n),o=t(i),r=!0,s=navigator.userAgent.toLowerCase(),c=i.location.hash.replace(/#\//,""),h=function(){var t=3,i=n.createElement("div"),a=i.getElementsByTagName("i");do i.innerHTML="<!--[if gt IE "+ ++t+"]><i></i><![endif]-->";while(a[0]);return t>4?t:e}(),u=function(){return{html:n.documentElement,body:n.body,head:n.getElementsByTagName("head")[0],title:n.title}},l="data ready thumbnail loadstart loadfinish image play pause progress fullscreen_enter fullscreen_exit idle_enter idle_exit rescale lightbox_open lightbox_close lightbox_image",d=function(){var e=[];return t.each(l.split(" "),function(t,i){e.push(i),/_/.test(i)&&e.push(i.replace(/_/g,""))}),e}(),p=function(e){var i;return"object"!=typeof e?e:(t.each(e,function(n,a){/^[a-z]+_/.test(n)&&(i="",t.each(n.split("_"),function(t,e){i+=t>0?e.substr(0,1).toUpperCase()+e.substr(1):e}),e[i]=a,delete e[n])}),e)},g=function(e){return t.inArray(e,d)>-1?w[e.toUpperCase()]:e},f={trunk:{},add:function(t,e,n,a){if(a=a||!1,this.clear(t),a){var o=e;e=function(){o(),f.add(t,e,n)}}this.trunk[t]=i.setTimeout(e,n)},clear:function(t){var e,n=function(t){i.clearTimeout(this.trunk[t]),delete this.trunk[t]};if(t&&t in this.trunk)n.call(f,t);else if("undefined"==typeof t)for(e in this.trunk)this.trunk.hasOwnProperty(e)&&n.call(f,e)}},m=[],y=[],v=!1,_=!1,b=function(){return{array:function(t){return Array.prototype.slice.call(t)},create:function(t,e){e=e||"div";var i=n.createElement(e);return i.className=t,i},animate:function(){var e,n,a,o,r,s,c,h=function(t){var e,i="transition WebkitTransition MozTransition OTransition".split(" ");for(e=0;i[e];e++)if("undefined"!=typeof t[i[e]])return i[e];return!1}((document.body||document.documentElement).style),u={MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",transition:"transitionend"}[h],l={_default:[.25,.1,.25,1],galleria:[.645,.045,.355,1],galleriaIn:[.55,.085,.68,.53],galleriaOut:[.25,.46,.45,.94],ease:[.25,0,.25,1],linear:[.25,.25,.75,.75],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]},d=function(e,i,n){var a={};n=n||"transition",t.each("webkit moz ms o".split(" "),function(){a["-"+this+"-"+n]=i}),e.css(a)},p=function(t){d(t,"none","transition"),w.WEBKIT&&(d(t,"translate3d(0,0,0)","transform"),t.data("revert")&&(t.css(t.data("revert")),t.data("revert",null)))};return function(g,f,m){return m=t.extend({duration:400,complete:function(){},stop:!1},m),g=t(g),m.duration?h?(m.stop&&(g.unbind(u),p(g)),e=!1,t.each(f,function(t,i){c=g.css(t),b.parseValue(c)!=b.parseValue(i)&&(e=!0),g.css(t,c)}),e?(n=[],a=m.easing in l?l[m.easing]:l._default,o=" "+m.duration+"ms cubic-bezier("+a.join(",")+")",void i.setTimeout(function(){g.one(u,function(t){return function(){p(t),m.complete.call(t[0])}}(g)),w.WEBKIT&&w.TOUCH&&(r={},s=[0,0,0],t.each(["left","top"],function(t,e){e in f&&(s[t]=b.parseValue(f[e])-b.parseValue(g.css(e))+"px",r[e]=f[e],delete f[e])}),(s[0]||s[1])&&(g.data("revert",r),n.push("-webkit-transform"+o),d(g,"translate3d("+s.join(",")+")","transform"))),t.each(f,function(t){n.push(t+o)}),d(g,n.join(",")),g.css(f)},1)):void i.setTimeout(function(){m.complete.call(g[0])},m.duration)):void g.animate(f,m):(g.css(f),void m.complete.call(g[0]))}}(),forceStyles:function(e,i){e=t(e),e.attr("style")&&e.data("styles",e.attr("style")).removeAttr("style"),e.css(i)},revertStyles:function(){t.each(b.array(arguments),function(e,i){i=t(i),i.removeAttr("style"),i.attr("style",""),i.data("styles")&&i.attr("style",i.data("styles")).data("styles",null)})},moveOut:function(t){b.forceStyles(t,{position:"absolute",left:-1e4})},moveIn:function(){b.revertStyles.apply(b,b.array(arguments))},hide:function(e,i,n){e=t(e),e.data("opacity")||e.data("opacity",e.css("opacity"));var a={opacity:0};i?b.animate(e,a,{duration:i,complete:n,stop:!0}):e.css(a)},show:function(e,i,n){e=t(e);var a=parseFloat(e.data("opacity"))||1,o={opacity:a};i?b.animate(e,o,{duration:i,complete:n,stop:!0}):e.css(o)},optimizeTouch:function(){var e,i,n,a,o={},r=function(e){e.preventDefault(),o=t.extend({},e,!0)},s=function(){this.evt=o},c=function(){this.handler.call(e,this.evt)};return function(o){t(o).bind("touchstart",function(o){for(e=o.target,a=!0;e.parentNode&&e!=o.currentTarget&&a;)i=t(e).data("events"),n=t(e).data("fakes"),i&&"click"in i?(a=!1,o.preventDefault(),t(e).click(r).click(),i.click.pop(),t.each(i.click,s),t(e).data("fakes",i.click),delete i.click):n&&(a=!1,o.preventDefault(),t.each(n,c)),e=e.parentNode})}}(),addTimer:function(){return f.add.apply(f,b.array(arguments)),this},clearTimer:function(){return f.clear.apply(f,b.array(arguments)),this},wait:function(e){e=t.extend({until:function(){return!1},success:function(){},error:function(){w.raise("Could not complete wait function.")},timeout:3e3},e);var n,a,o=b.timestamp(),r=function(){return a=b.timestamp(),n=a-o,e.until(n)?(e.success(),!1):a>=o+e.timeout?(e.error(),!1):void i.setTimeout(r,2)};i.setTimeout(r,2)},toggleQuality:function(t,e){7!==h&&8!==h||!t||("undefined"==typeof e&&(e="nearest-neighbor"===t.style.msInterpolationMode),t.style.msInterpolationMode=e?"bicubic":"nearest-neighbor")},insertStyleTag:function(t){var e=n.createElement("style");if(u().head.appendChild(e),e.styleSheet)e.styleSheet.cssText=t;else{var i=n.createTextNode(t);e.appendChild(i)}},loadScript:function(e,i){var n=!1,a=t("<script>").attr({src:e,async:!0}).get(0);a.onload=a.onreadystatechange=function(){n||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(n=!0,a.onload=a.onreadystatechange=null,"function"==typeof i&&i.call(this,this))},u().head.appendChild(a)},parseValue:function(t){if("number"==typeof t)return t;if("string"==typeof t){var e=t.match(/\-?\d|\./g);return e&&e.constructor===Array?1*e.join(""):0}return 0},timestamp:function(){return(new Date).getTime()},loadCSS:function(a,o,s){var c,l,d=!1;return t("link[rel=stylesheet]").each(function(){return new RegExp(a).test(this.href)?(c=this,!1):void 0}),"function"==typeof o&&(s=o,o=e),s=s||function(){},c?(s.call(c,c),c):(l=n.styleSheets.length,r&&(a+="?"+b.timestamp()),t("#"+o).length?(t("#"+o).attr("href",a),l--,d=!0):(c=t("<link>").attr({rel:"stylesheet",href:a,id:o}).get(0),i.setTimeout(function(){var e=t('link[rel="stylesheet"], style');if(e.length?e.get(0).parentNode.insertBefore(c,e[0]):u().head.appendChild(c),h){if(l>=31)return void w.raise("You have reached the browser stylesheet limit (31)",!0);c.onreadystatechange=function(){d||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(d=!0)}}else new RegExp("file://","i").test(a)?d=!0:t.ajax({url:a,success:function(){d=!0},error:function(t){t.isRejected()&&w.WEBKIT&&(d=!0)}})},10)),"function"==typeof s&&b.wait({until:function(){return d&&n.styleSheets.length>l},success:function(){i.setTimeout(function(){s.call(c,c)},100)},error:function(){w.raise("Theme CSS could not load",!0)},timeout:1e4}),c)}}}(),x=function(){var e=function(e,i,n,a){var o=this.getOptions("easing"),r=this.getStageWidth(),s={left:r*(e.rewind?-1:1)},c={left:0};n&&(s.opacity=0,c.opacity=1),t(e.next).css(s),b.animate(e.next,c,{duration:e.speed,complete:function(t){return function(){i(),t.css({left:0})}}(t(e.next).add(e.prev)),queue:!1,easing:o}),a&&(e.rewind=!e.rewind),e.prev&&(s={left:0},c={left:r*(e.rewind?1:-1)},n&&(s.opacity=1,c.opacity=0),t(e.prev).css(s),b.animate(e.prev,c,{duration:e.speed,queue:!1,easing:o,complete:function(){t(this).css("opacity",0)}}))};return{fade:function(e,i){t(e.next).css("opacity",0).show(),b.animate(e.next,{opacity:1},{duration:e.speed,complete:i}),e.prev&&(t(e.prev).css("opacity",1).show(),b.animate(e.prev,{opacity:0},{duration:e.speed}))},flash:function(e,i){t(e.next).css("opacity",0),e.prev?b.animate(e.prev,{opacity:0},{duration:e.speed/2,complete:function(){b.animate(e.next,{opacity:1},{duration:e.speed,complete:i})}}):b.animate(e.next,{opacity:1},{duration:e.speed,complete:i})},pulse:function(e,i){e.prev&&t(e.prev).hide(),t(e.next).css("opacity",0).show(),b.animate(e.next,{opacity:1},{duration:e.speed,complete:i})},slide:function(){e.apply(this,b.array(arguments))},fadeslide:function(){e.apply(this,b.array(arguments).concat([!0]))},doorslide:function(){e.apply(this,b.array(arguments).concat([!1,!0]))}}}(),w=function(){var n=this;this._theme=e,this._options={},this._playing=!1,this._playtime=5e3,this._active=null,this._queue={length:0},this._data=[],this._dom={},this._thumbnails=[],this._initialized=!1,this._firstrun=!1,this._stageWidth=0,this._stageHeight=0,this._target=e,this._id=Math.random();var r="container stage images image-nav image-nav-left image-nav-right info info-text info-title info-description thumbnails thumbnails-list thumbnails-container thumb-nav-left thumb-nav-right loader counter tooltip",s="current total";t.each(r.split(" "),function(t,e){n._dom[e]=b.create("galleria-"+e)}),t.each(s.split(" "),function(t,e){n._dom[e]=b.create("galleria-"+e,"span")});var c=this._keyboard={keys:{UP:38,DOWN:40,LEFT:37,RIGHT:39,RETURN:13,ESCAPE:27,BACKSPACE:8,SPACE:32},map:{},bound:!1,press:function(t){var e=t.keyCode||t.which;e in c.map&&"function"==typeof c.map[e]&&c.map[e].call(n,t)},attach:function(t){var e,i;for(e in t)t.hasOwnProperty(e)&&(i=e.toUpperCase(),i in c.keys?c.map[c.keys[i]]=t[e]:c.map[i]=t[e]);c.bound||(c.bound=!0,a.bind("keydown",c.press))},detach:function(){c.bound=!1,c.map={},a.unbind("keydown",c.press)}},l=this._controls={0:e,1:e,active:0,swap:function(){l.active=l.active?0:1},getActive:function(){return l[l.active]},getNext:function(){return l[1-l.active]}},d=this._carousel={next:n.$("thumb-nav-right"),prev:n.$("thumb-nav-left"),width:0,current:0,max:0,hooks:[],update:function(){var e=0,i=0,a=[0];t.each(n._thumbnails,function(n,o){o.ready&&(e+=o.outerWidth||t(o.container).outerWidth(!0),a[n+1]=e,i=Math.max(i,o.outerHeight||t(o.container).outerHeight(!0)))}),n.$("thumbnails").css({width:e,height:i}),d.max=e,d.hooks=a,d.width=n.$("thumbnails-list").width(),d.setClasses(),n.$("thumbnails-container").toggleClass("galleria-carousel",e>d.width),d.width=n.$("thumbnails-list").width()},bindControls:function(){var t;d.next.bind("click",function(e){if(e.preventDefault(),"auto"===n._options.carouselSteps){for(t=d.current;t<d.hooks.length;t++)if(d.hooks[t]-d.hooks[d.current]>d.width){d.set(t-2);break}}else d.set(d.current+n._options.carouselSteps)}),d.prev.bind("click",function(e){if(e.preventDefault(),"auto"===n._options.carouselSteps)for(t=d.current;t>=0;t--){if(d.hooks[d.current]-d.hooks[t]>d.width){d.set(t+2);break}if(0===t){d.set(0);break}}else d.set(d.current-n._options.carouselSteps)})},set:function(t){for(t=Math.max(t,0);d.hooks[t-1]+d.width>=d.max&&t>=0;)t--;d.current=t,d.animate()},getLast:function(t){return(t||d.current)-1},follow:function(t){if(0===t||t===d.hooks.length-2)return void d.set(t);for(var e=d.current;d.hooks[e]-d.hooks[d.current]<d.width&&e<=d.hooks.length;)e++;t-1<d.current?d.set(t-1):t+2>e&&d.set(t-e+d.current+2)},setClasses:function(){d.prev.toggleClass("disabled",!d.current),d.next.toggleClass("disabled",d.hooks[d.current]+d.width>=d.max)},animate:function(){d.setClasses();var t=-1*d.hooks[d.current];isNaN(t)||b.animate(n.get("thumbnails"),{left:t},{duration:n._options.carouselSpeed,easing:n._options.easing,queue:!1})}},p=this._tooltip={initialized:!1,open:!1,init:function(){p.initialized=!0;var t=".galleria-tooltip{padding:3px 8px;max-width:50%;background:#ffe;color:#000;z-index:3;position:absolute;font-size:11px;line-height:1.3opacity:0;box-shadow:0 0 2px rgba(0,0,0,.4);-moz-box-shadow:0 0 2px rgba(0,0,0,.4);-webkit-box-shadow:0 0 2px rgba(0,0,0,.4);}";b.insertStyleTag(t),n.$("tooltip").css("opacity",.8),b.hide(n.get("tooltip"))},move:function(t){var e=n.getMousePosition(t).x,i=n.getMousePosition(t).y,a=n.$("tooltip"),o=e,r=i,s=a.outerHeight(!0)+1,c=a.outerWidth(!0),h=s+15,u=n.$("container").width()-c-2,l=n.$("container").height()-s-2;isNaN(o)||isNaN(r)||(o+=10,r-=30,o=Math.max(0,Math.min(u,o)),r=Math.max(0,Math.min(l,r)),h>i&&(r=h),a.css({left:o,top:r}))},bind:function(e,i){if(!w.TOUCH){p.initialized||p.init();var a=function(e,i){p.define(e,i),t(e).hover(function(){b.clearTimer("switch_tooltip"),n.$("container").unbind("mousemove",p.move).bind("mousemove",p.move).trigger("mousemove"),p.show(e),w.utils.addTimer("tooltip",function(){n.$("tooltip").stop().show().animate({opacity:1}),p.open=!0},p.open?0:500)},function(){n.$("container").unbind("mousemove",p.move),b.clearTimer("tooltip"),n.$("tooltip").stop().animate({opacity:0},200,function(){n.$("tooltip").hide(),b.addTimer("switch_tooltip",function(){p.open=!1},1e3)})})};"string"==typeof i?a(e in n._dom?n.get(e):e,i):t.each(e,function(t,e){a(n.get(t),e)})}},show:function(e){e=t(e in n._dom?n.get(e):e);var a=e.data("tt"),o=function(t){i.setTimeout(function(t){return function(){p.move(t)}}(t),10),e.unbind("mouseup",o)};a="function"==typeof a?a():a,a&&(n.$("tooltip").html(a.replace(/\s/," ")),e.bind("mouseup",o))},define:function(e,i){if("function"!=typeof i){var a=i;i=function(){return a}}e=t(e in n._dom?n.get(e):e).data("tt",i),p.show(e)}},g=this._fullscreen={scrolled:0,active:!1,keymap:n._keyboard.map,enter:function(e){g.active=!0,b.hide(n.getActiveImage()),n.$("container").addClass("fullscreen"),g.scrolled=o.scrollTop(),b.forceStyles(n.get("container"),{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:1e4});var i={height:"100%",overflow:"hidden",margin:0,padding:0},a=n.getData();if(b.forceStyles(u().html,i),b.forceStyles(u().body,i),g.keymap=t.extend({},n._keyboard.map),n.attachKeyboard({escape:n.exitFullscreen,right:n.next,left:n.prev}),a&&a.big&&a.image!==a.big){var r=new w.Picture,s=r.isCached(a.big),c=n.getIndex(),h=n._thumbnails[c];n.trigger({type:w.LOADSTART,cached:s,index:c,imageTarget:n.getActiveImage(),thumbTarget:h}),r.load(a.big,function(e){n._scaleImage(e,{complete:function(e){n.trigger({type:w.LOADFINISH,cached:s,index:c,imageTarget:e.image,thumbTarget:h});var i=n._controls.getActive().image;i&&t(i).width(e.image.width).height(e.image.height).attr("style",t(e.image).attr("style")).attr("src",e.image.src)}})})}n.rescale(function(){b.addTimer("fullscreen_enter",function(){b.show(n.getActiveImage()),"function"==typeof e&&e.call(n)},100),n.trigger(w.FULLSCREEN_ENTER)}),o.resize(function(){g.scale()})},scale:function(){n.rescale()},exit:function(t){g.active=!1,b.hide(n.getActiveImage()),n.$("container").removeClass("fullscreen"),b.revertStyles(n.get("container"),u().html,u().body),i.scrollTo(0,g.scrolled),n.detachKeyboard(),n.attachKeyboard(g.keymap),n.rescale(function(){b.addTimer("fullscreen_exit",function(){b.show(n.getActiveImage()),"function"==typeof t&&t.call(n)},50),n.trigger(w.FULLSCREEN_EXIT)}),o.unbind("resize",g.scale)}},f=this._idle={trunk:[],bound:!1,add:function(e,i){if(e){f.bound||f.addEvent(),e=t(e);var n,a={};for(n in i)i.hasOwnProperty(n)&&(a[n]=e.css(n));e.data("idle",{from:a,to:i,complete:!0,busy:!1}),f.addTimer(),f.trunk.push(e)}},remove:function(e){e=jQuery(e),t.each(f.trunk,function(t,i){i.length&&!i.not(e).length&&(n._idle.show(e),n._idle.trunk.splice(t,1))}),f.trunk.length||(f.removeEvent(),b.clearTimer("idle"))},addEvent:function(){f.bound=!0,n.$("container").bind("mousemove click",f.showAll)},removeEvent:function(){f.bound=!1,n.$("container").unbind("mousemove click",f.showAll)},addTimer:function(){b.addTimer("idle",function(){n._idle.hide()},n._options.idleTime)},hide:function(){n._options.idleMode&&(n.trigger(w.IDLE_ENTER),t.each(f.trunk,function(t,e){var i=e.data("idle");i&&(e.data("idle").complete=!1,b.animate(e,i.to,{duration:n._options.idleSpeed}))}))},showAll:function(){b.clearTimer("idle"),t.each(n._idle.trunk,function(t,e){n._idle.show(e)})},show:function(e){var i=e.data("idle");i.busy||i.complete||(i.busy=!0,n.trigger(w.IDLE_EXIT),b.clearTimer("idle"),b.animate(e,i.from,{duration:n._options.idleSpeed/2,complete:function(){t(this).data("idle").busy=!1,t(this).data("idle").complete=!0}})),f.addTimer()}},m=this._lightbox={width:0,height:0,initialized:!1,active:null,image:null,elems:{},keymap:!1,init:function(){if(n.trigger(w.LIGHTBOX_OPEN),!m.initialized){m.initialized=!0;var e="overlay box content shadow title info close prevholder prev nextholder next counter image",i={},a=n._options,o="",r="position:absolute;",s="lightbox-",c={overlay:"position:fixed;display:none;opacity:"+a.overlayOpacity+";filter:alpha(opacity="+100*a.overlayOpacity+");top:0;left:0;width:100%;height:100%;background:"+a.overlayBackground+";z-index:99990",box:"position:fixed;display:none;width:400px;height:400px;top:50%;left:50%;margin-top:-200px;margin-left:-200px;z-index:99991",shadow:r+"background:#000;width:100%;height:100%;",content:r+"background-color:#fff;top:10px;left:10px;right:10px;bottom:10px;overflow:hidden",info:r+"bottom:10px;left:10px;right:10px;color:#444;font:11px/13px arial,sans-serif;height:13px",close:r+"top:10px;right:10px;height:20px;width:20px;background:#fff;text-align:center;cursor:pointer;color:#444;font:16px/22px arial,sans-serif;z-index:99999",image:r+"top:10px;left:10px;right:10px;bottom:30px;overflow:hidden;display:block;",prevholder:r+"width:50%;top:0;bottom:40px;cursor:pointer;",nextholder:r+"width:50%;top:0;bottom:40px;right:-1px;cursor:pointer;",prev:r+"top:50%;margin-top:-20px;height:40px;width:30px;background:#fff;left:20px;display:none;text-align:center;color:#000;font:bold 16px/36px arial,sans-serif",next:r+"top:50%;margin-top:-20px;height:40px;width:30px;background:#fff;right:20px;left:auto;display:none;font:bold 16px/36px arial,sans-serif;text-align:center;color:#000",title:"float:left",counter:"float:right;margin-left:8px;"},l=function(e){return e.hover(function(){t(this).css("color","#bbb")},function(){t(this).css("color","#444")})},d={};8===h&&(c.nextholder+="background:#000;filter:alpha(opacity=0);",c.prevholder+="background:#000;filter:alpha(opacity=0);"),t.each(c,function(t,e){o+=".galleria-"+s+t+"{"+e+"}"}),b.insertStyleTag(o),t.each(e.split(" "),function(t,e){n.addElement("lightbox-"+e),i[e]=m.elems[e]=n.get("lightbox-"+e)}),m.image=new w.Picture,t.each({box:"shadow content close prevholder nextholder",info:"title counter",content:"info image",prevholder:"prev",nextholder:"next"},function(e,i){var n=[];t.each(i.split(" "),function(t,e){n.push(s+e)}),d[s+e]=n}),n.append(d),t(i.image).append(m.image.container),t(u().body).append(i.overlay,i.box),b.optimizeTouch(i.box),l(t(i.close).bind("click",m.hide).html("×")),t.each(["Prev","Next"],function(e,n){var a=t(i[n.toLowerCase()]).html(/v/.test(n)?"‹ ":" ›"),o=t(i[n.toLowerCase()+"holder"]);return o.bind("click",function(){m["show"+n]()}),8>h||w.TOUCH?void a.show():void o.hover(function(){a.show()},function(){a.stop().fadeOut(200)})}),t(i.overlay).bind("click",m.hide),w.IPAD&&(n._options.lightboxTransitionSpeed=0)}},rescale:function(e){var i=Math.min(o.width()-40,m.width),a=Math.min(o.height()-60,m.height),r=Math.min(i/m.width,a/m.height),s=Math.round(m.width*r)+40,c=Math.round(m.height*r)+60,h={width:s,height:c,"margin-top":-1*Math.ceil(c/2),"margin-left":-1*Math.ceil(s/2)};e?t(m.elems.box).css(h):t(m.elems.box).animate(h,{duration:n._options.lightboxTransitionSpeed,easing:n._options.easing,complete:function(){var e=m.image,i=n._options.lightboxFadeSpeed;n.trigger({type:w.LIGHTBOX_IMAGE,imageTarget:e.image}),t(e.container).show(),b.show(e.image,i),b.show(m.elems.info,i)}})},hide:function(){m.image.image=null,o.unbind("resize",m.rescale),t(m.elems.box).hide(),b.hide(m.elems.info),n.detachKeyboard(),n.attachKeyboard(m.keymap),m.keymap=!1,b.hide(m.elems.overlay,200,function(){t(this).hide().css("opacity",n._options.overlayOpacity),n.trigger(w.LIGHTBOX_CLOSE)})},showNext:function(){m.show(n.getNext(m.active))},showPrev:function(){m.show(n.getPrev(m.active))},show:function(e){m.active=e="number"==typeof e?e:n.getIndex(),m.initialized||m.init(),m.keymap||(m.keymap=t.extend({},n._keyboard.map),n.attachKeyboard({escape:m.hide,right:m.showNext,left:m.showPrev})),o.unbind("resize",m.rescale);var i=n.getData(e),a=n.getDataLength();b.hide(m.elems.info),m.image.load(i.big||i.image,function(n){m.width=n.original.width,m.height=n.original.height,t(n.image).css({width:"100.5%",height:"100.5%",top:0,zIndex:99998}),b.hide(n.image),m.elems.title.innerHTML=i.title||"",m.elems.counter.innerHTML=e+1+" / "+a,o.resize(m.rescale),m.rescale()}),t(m.elems.overlay).show(),t(m.elems.box).show()}};return this};w.prototype={constructor:w,init:function(i,n){var a=this;return n=p(n),this._original={target:i,options:n,data:null},this._target=this._dom.target=i.nodeName?i:t(i).get(0),y.push(this),this._target?(this._options={autoplay:!1,carousel:!0,carouselFollow:!0,carouselSpeed:400,carouselSteps:"auto",clicknext:!1,dataConfig:function(){return{}},dataSelector:"img",dataSource:this._target,debug:e,easing:"galleria",extend:function(){},fullscreenDoubleTap:!0,height:"auto",idleMode:!0,idleTime:3e3,idleSpeed:200,imageCrop:!1,imageMargin:0,imagePan:!1,imagePanSmoothness:12,imagePosition:"50%",initialTransition:e,keepSource:!1,lightbox:!1,lightboxFadeSpeed:200,lightboxTransitionSpeed:200,linkSourceTmages:!0,maxScaleRatio:e,minScaleRatio:e,overlayOpacity:.85,overlayBackground:"#0b0b0b",pauseOnInteraction:!0,popupLinks:!1,preload:2,protect:!1,queue:!0,show:0,showInfo:!0,showCounter:!0,showImagenav:!0,swipe:!0,thumbCrop:!0,thumbEventType:"click",thumbFit:!0,thumbMargin:0,thumbQuality:"auto",thumbnails:!0,transition:"fade",transitionInitial:e,transitionSpeed:400,useCanvas:!1,width:"auto"},this._options.initialTransition=this._options.initialTransition||this._options.transitionInitial,n&&n.debug===!1&&(r=!1),t(this._target).children().hide(),void("object"==typeof w.theme?this._init():b.wait({until:function(){return"object"==typeof w.theme},success:function(){a._init.call(a)},error:function(){w.raise("No theme found.",!0)},timeout:5e3}))):void w.raise("Target not found.",!0)},_init:function(){var e=this;return this._initialized?(w.raise("Init failed: Gallery instance already initialized."),this):(this._initialized=!0,w.theme?(t.extend(!0,this._options,w.theme.defaults,this._original.options),function(t){return"getContext"in t?void(_=_||{elem:t,context:t.getContext("2d"),cache:{},length:0}):void(t=null)}(n.createElement("canvas")),this.bind(w.DATA,function(){this._original.data=this._data,this.get("total").innerHTML=this.getDataLength();var n=this.$("container"),a={width:0,height:0},o=function(){return e.$("stage").height()};b.wait({until:function(){return t.each(["width","height"],function(t,i){a[i]=e._options[i]&&"number"==typeof e._options[i]?e._options[i]:Math.max(b.parseValue(n.css(i)),b.parseValue(e.$("target").css(i)),n[i](),e.$("target")[i]()),n[i](a[i])}),o()&&a.width&&a.height>10},success:function(){w.WEBKIT?i.setTimeout(function(){e._run()},1):e._run()},error:function(){o()?w.raise("Could not extract sufficient width/height of the gallery container. Traced measures: width:"+a.width+"px, height: "+a.height+"px.",!0):w.raise("Could not extract a stage height from the CSS. Traced height: "+o()+"px.",!0)},timeout:2e3})}),this.append({"info-text":["info-title","info-description"],info:["info-text"],"image-nav":["image-nav-right","image-nav-left"],stage:["images","loader","counter","image-nav"],"thumbnails-list":["thumbnails"],"thumbnails-container":["thumb-nav-left","thumbnails-list","thumb-nav-right"],container:["stage","thumbnails-container","info","tooltip"]}),b.hide(this.$("counter").append(this.get("current")," / ",this.get("total"))),this.setCounter("–"),b.hide(e.get("tooltip")),this.$("container").addClass(w.TOUCH?"touch":"notouch"),t.each(new Array(2),function(i){var n=new w.Picture;t(n.container).css({position:"absolute",top:0,left:0}),e.$("images").append(n.container),e._controls[i]=n}),this.$("images").css({position:"relative",top:0,left:0,width:"100%",height:"100%"}),this.$("thumbnails, thumbnails-list").css({overflow:"hidden",position:"relative"}),this.$("image-nav-right, image-nav-left").bind("click",function(t){e._options.clicknext&&t.stopPropagation(),e._options.pauseOnInteraction&&e.pause();var i=/right/.test(this.className)?"next":"prev";e[i]()}),t.each(["info","counter","image-nav"],function(t,i){e._options["show"+i.substr(0,1).toUpperCase()+i.substr(1).replace(/-/,"")]===!1&&b.moveOut(e.get(i.toLowerCase()))}),this.load(),this._options.keep_source||h||(this._target.innerHTML=""),this.get("errors")&&this.appendChild("target","errors"),this.appendChild("target","container"),this._options.carousel&&this.bind(w.THUMBNAIL,function(){this.updateCarousel()}),this._options.swipe&&(!function(t){var i,n=[0,0],a=[0,0],o=30,r=100,s=!1,c=0,h={start:"touchstart",move:"touchmove",stop:"touchend"},u=function(t){return t.originalEvent.touches?t.originalEvent.touches[0]:t},l=function(t){t.originalEvent.touches&&t.originalEvent.touches.length>1||(i=u(t),a=[i.pageX,i.pageY],n[0]||(n=a),Math.abs(n[0]-a[0])>10&&t.preventDefault())},d=function(i){return t.unbind(h.move,l),i.originalEvent.touches&&i.originalEvent.touches.length||s?void(s=!s):(b.timestamp()-c<1e3&&Math.abs(n[0]-a[0])>o&&Math.abs(n[1]-a[1])<r&&(i.preventDefault(),e[n[0]>a[0]?"next":"prev"]()),void(n=a=[0,0]))};t.bind(h.start,function(e){e.originalEvent.touches&&e.originalEvent.touches.length>1||(i=u(e),c=b.timestamp(),n=a=[i.pageX,i.pageY],t.bind(h.move,l).one(h.stop,d))})}(e.$("images")),this._options.fullscreenDoubleTap&&this.$("stage").bind("touchstart",function(){var t,i,n,a,o,r,s=function(t){return t.originalEvent.touches?t.originalEvent.touches[0]:t};return function(c){return r=w.utils.timestamp(),i=s(c).pageX,n=s(c).pageY,500>r-t&&20>i-a&&20>n-o?(e.toggleFullscreen(),c.preventDefault(),void e.$("stage").unbind("touchend",arguments.callee)):(t=r,a=i,void(o=n))}}())),b.optimizeTouch(this.get("container")),this):(w.raise("Init failed: No theme found."),this))},_createThumbnails:function(){this.get("total").innerHTML=this.getDataLength();var e,a,o,r,s,c=this,h=this._options,u=function(){var t=c.$("thumbnails").find(".active");return t.length?t.find("img").attr("src"):!1}(),l="string"==typeof h.thumbnails?h.thumbnails.toLowerCase():null,d=function(t){return n.defaultView&&n.defaultView.getComputedStyle?n.defaultView.getComputedStyle(o.container,null)[t]:s.css(t)},p=function(e,i,n){return function(){t(n).append(e),c.trigger({type:w.THUMBNAIL,thumbTarget:e,index:i})}},g=function(e){h.pauseOnInteraction&&c.pause();var i=t(e.currentTarget).data("index");c.getIndex()!==i&&c.show(i),e.preventDefault()},f=function(e){e.scale({width:e.data.width,height:e.data.height,crop:h.thumbCrop,margin:h.thumbMargin,canvas:h.useCanvas,complete:function(e){var i,n,a=["left","top"],o=["Width","Height"];t.each(o,function(o,r){i=r.toLowerCase(),h.thumbCrop===!0&&h.thumbCrop!==i||!h.thumbFit||(n={},n[i]=e[i],t(e.container).css(n),n={},n[a[o]]=0,t(e.image).css(n)),e["outer"+r]=t(e.container)["outer"+r](!0)}),b.toggleQuality(e.image,h.thumbQuality===!0||"auto"===h.thumbQuality&&e.original.width<3*e.width),c.trigger({type:w.THUMBNAIL,thumbTarget:e.image,index:e.data.order})}})};for(this._thumbnails=[],this.$("thumbnails").empty(),e=0;this._data[e];e++)r=this._data[e],h.thumbnails===!0?(o=new w.Picture(e),a=r.thumb||r.image,this.$("thumbnails").append(o.container),s=t(o.container),o.data={width:b.parseValue(d("width")),height:b.parseValue(d("height")),order:e},s.css(h.thumbFit&&h.thumbCrop!==!0?{width:0,height:0}:{width:o.data.width,height:o.data.height}),o.load(a,f),"all"===h.preload&&o.add(r.image)):"empty"===l||"numbers"===l?(o={container:b.create("galleria-image"),image:b.create("img","span"),ready:!0},"numbers"===l&&t(o.image).text(e+1),this.$("thumbnails").append(o.container),i.setTimeout(p(o.image,e,o.container),50+20*e)):o={container:null,image:null},t(o.container).add(h.keepSource&&h.linkSourceImages?r.original:null).data("index",e).bind(h.thumbEventType,g),u===a&&t(o.container).addClass("active"),this._thumbnails.push(o)},_run:function(){var n=this;n._createThumbnails(),b.wait({until:function(){return w.OPERA&&n.$("stage").css("display","inline-block"),n._stageWidth=n.$("stage").width(),n._stageHeight=n.$("stage").height(),n._stageWidth&&n._stageHeight>50},success:function(){return m.push(n),b.show(n.get("counter")),n._options.carousel&&n._carousel.bindControls(),n._options.autoplay&&(n.pause(),"number"==typeof n._options.autoplay&&(n._playtime=n._options.autoplay),n.trigger(w.PLAY),n._playing=!0),n._firstrun?void("number"==typeof n._options.show&&n.show(n._options.show)):(n._firstrun=!0,n._options.clicknext&&!w.TOUCH&&(t.each(n._data,function(t,e){delete e.link}),n.$("stage").css({cursor:"pointer"}).bind("click",function(){n._options.pauseOnInteraction&&n.pause(),n.next()})),w.History&&w.History.change(function(t){var a=parseInt(t.value.replace(/\//,""),10);isNaN(a)?i.history.go(-1):n.show(a,e,!0)}),t.each(w.ready.callbacks,function(){this.call(n,n._options)}),n.trigger(w.READY),w.theme.init.call(n,n._options),n._options.extend.call(n,n._options),void(/^[0-9]{1,4}$/.test(c)&&w.History?n.show(c,e,!0):n._data[n._options.show]&&n.show(n._options.show)))},error:function(){w.raise("Stage width or height is too small to show the gallery. Traced measures: width:"+n._stageWidth+"px, height: "+n._stageHeight+"px.",!0)}})},load:function(e,i,n){var a=this;return this._data=[],this._thumbnails=[],this.$("thumbnails").empty(),"function"==typeof i&&(n=i,i=null),e=e||this._options.dataSource,i=i||this._options.dataSelector,n=n||this._options.dataConfig,/^function Object/.test(e.constructor)&&(e=[e]),e.constructor===Array?(this.validate(e)?(this._data=e,this._parseData().trigger(w.DATA)):w.raise("Load failed: JSON Array not valid."),this):(t(e).find(i).each(function(e,i){i=t(i);var o={},r=i.parent(),s=r.attr("href"),c=r.attr("rel"),h=/\.(png|gif|jpg|jpeg)(\?.*)?$/i;h.test(s)?(o.image=s,o.big=h.test(c)?c:s):s&&(o.link=s),a._data.push(t.extend({title:i.attr("title")||"",thumb:i.attr("src"),image:i.attr("src"),big:i.attr("src"),description:i.attr("alt")||"",link:i.attr("longdesc"),original:i.get(0)},o,n(i)))}),this.getDataLength()?this.trigger(w.DATA):w.raise("Load failed: no data found."),this)},_parseData:function(){var e=this;return t.each(this._data,function(t,i){"thumb"in i==!1&&(e._data[t].thumb=i.image),!1 in i&&(e._data[t].big=i.image)}),this},splice:function(){return Array.prototype.splice.apply(this._data,b.array(arguments)),this._parseData()._createThumbnails()},push:function(){return Array.prototype.push.apply(this._data,b.array(arguments)),this._parseData()._createThumbnails()},_getActive:function(){return this._controls.getActive()},validate:function(){return!0},bind:function(t,e){return t=g(t),this.$("container").bind(t,this.proxy(e)),this},unbind:function(t){return t=g(t),this.$("container").unbind(t),this},trigger:function(e){return e="object"==typeof e?t.extend(e,{scope:this}):{type:g(e),scope:this},this.$("container").trigger(e),this},addIdleState:function(){return this._idle.add.apply(this._idle,b.array(arguments)),this},removeIdleState:function(){return this._idle.remove.apply(this._idle,b.array(arguments)),this},enterIdleMode:function(){return this._idle.hide(),this},exitIdleMode:function(){return this._idle.showAll(),this},enterFullscreen:function(){return this._fullscreen.enter.apply(this,b.array(arguments)),this},exitFullscreen:function(){return this._fullscreen.exit.apply(this,b.array(arguments)),this},toggleFullscreen:function(){return this._fullscreen[this.isFullscreen()?"exit":"enter"].apply(this,b.array(arguments)),this},bindTooltip:function(){return this._tooltip.bind.apply(this._tooltip,b.array(arguments)),this},defineTooltip:function(){return this._tooltip.define.apply(this._tooltip,b.array(arguments)),this},refreshTooltip:function(){return this._tooltip.show.apply(this._tooltip,b.array(arguments)),this},openLightbox:function(){return this._lightbox.show.apply(this._lightbox,b.array(arguments)),this},closeLightbox:function(){return this._lightbox.hide.apply(this._lightbox,b.array(arguments)),this
},getActiveImage:function(){return this._getActive().image||e},getActiveThumb:function(){return this._thumbnails[this._active].image||e},getMousePosition:function(t){return{x:t.pageX-this.$("container").offset().left,y:t.pageY-this.$("container").offset().top}},addPan:function(e){if(this._options.imageCrop!==!1){e=t(e||this.getActiveImage());var i=this,n=e.width()/2,a=e.height()/2,o=parseInt(e.css("left"),10),r=parseInt(e.css("top"),10),s=o||0,c=r||0,u=0,l=0,d=!1,p=b.timestamp(),g=0,f=0,m=function(t,i,n){if(t>0&&(f=Math.round(Math.max(-1*t,Math.min(0,i))),g!==f))if(g=f,8===h)e.parent()["scroll"+n](-1*f);else{var a={};a[n.toLowerCase()]=f,e.css(a)}},y=function(t){b.timestamp()-p<50||(d=!0,n=i.getMousePosition(t).x,a=i.getMousePosition(t).y)},v=function(){d&&(u=e.width()-i._stageWidth,l=e.height()-i._stageHeight,o=n/i._stageWidth*u*-1,r=a/i._stageHeight*l*-1,s+=(o-s)/i._options.imagePanSmoothness,c+=(r-c)/i._options.imagePanSmoothness,m(l,c,"Top"),m(u,s,"Left"))};return 8===h&&(e.parent().scrollTop(-1*c).scrollLeft(-1*s),e.css({top:0,left:0})),this.$("stage").unbind("mousemove",y).bind("mousemove",y),b.addTimer("pan",v,50,!0),this}},proxy:function(t,e){return"function"!=typeof t?function(){}:(e=e||this,function(){return t.apply(e,b.array(arguments))})},removePan:function(){return this.$("stage").unbind("mousemove"),b.clearTimer("pan"),this},addElement:function(){var e=this._dom;return t.each(b.array(arguments),function(t,i){e[i]=b.create("galleria-"+i)}),this},attachKeyboard:function(){return this._keyboard.attach.apply(this._keyboard,b.array(arguments)),this},detachKeyboard:function(){return this._keyboard.detach.apply(this._keyboard,b.array(arguments)),this},appendChild:function(t,e){return this.$(t).append(this.get(e)||e),this},prependChild:function(t,e){return this.$(t).prepend(this.get(e)||e),this},remove:function(){return this.$(b.array(arguments).join(",")).remove(),this},append:function(t){var e,i;for(e in t)if(t.hasOwnProperty(e))if(t[e].constructor===Array)for(i=0;t[e][i];i++)this.appendChild(e,t[e][i]);else this.appendChild(e,t[e]);return this},_scaleImage:function(e,i){return i=t.extend({width:this._stageWidth,height:this._stageHeight,crop:this._options.imageCrop,max:this._options.maxScaleRatio,min:this._options.minScaleRatio,margin:this._options.imageMargin,position:this._options.imagePosition},i),(e||this._controls.getActive()).scale(i),this},updateCarousel:function(){return this._carousel.update(),this},rescale:function(t,i,n){var a=this;"function"==typeof t&&(n=t,t=e);var o=function(){a._stageWidth=t||a.$("stage").width(),a._stageHeight=i||a.$("stage").height(),a._scaleImage(),a._options.carousel&&a.updateCarousel(),a.trigger(w.RESCALE),"function"==typeof n&&n.call(a)};return!w.WEBKIT||t||i?o.call(a):b.addTimer("scale",o,10),this},refreshImage:function(){return this._scaleImage(),this._options.imagePan&&this.addPan(),this},show:function(t,e,i){return t===!1||!this._options.queue&&this._queue.stalled?void 0:(t=Math.max(0,Math.min(parseInt(t,10),this.getDataLength()-1)),e="undefined"!=typeof e?!!e:t<this.getIndex(),i=i||!1,!i&&w.History?void w.History.value(t.toString()):(this._active=t,Array.prototype.push.call(this._queue,{index:t,rewind:e}),this._queue.stalled||this._show(),this))},_show:function(){var n=this,a=this._queue[0],o=this.getData(a.index);if(o){var r=this.isFullscreen()&&"big"in o?o.big:o.image,s=this._controls.getActive(),c=this._controls.getNext(),h=c.isCached(r),u=this._thumbnails[a.index],l=function(e,a,o,r,s){return function(){var c;n._queue.stalled=!1,b.toggleQuality(a.image,n._options.imageQuality),t(o.container).css({zIndex:0,opacity:0}).show(),t(a.container).css({zIndex:1,opacity:1}).show(),n._controls.swap(),n._options.imagePan&&n.addPan(a.image),(e.link||n._options.lightbox)&&t(a.image).css({cursor:"pointer"}).bind("mouseup",function(){return e.link?void(n._options.popupLinks?c=i.open(e.link,"_blank"):i.location.href=e.link):void n.openLightbox()}),Array.prototype.shift.call(n._queue),n._queue.length&&n._show(),n._playCheck(),n.trigger({type:w.IMAGE,index:r.index,imageTarget:a.image,thumbTarget:s.image})}}(o,c,s,a,u);if(this._options.carousel&&this._options.carouselFollow&&this._carousel.follow(a.index),this._options.preload){var d,p,g,f=this.getNext();try{for(p=this._options.preload;p>0;p--)d=new w.Picture,g=n.getData(f),d.add(this.isFullscreen()&&"big"in g?g.big:g.image),f=n.getNext(f)}catch(m){}}b.show(c.container),t(n._thumbnails[a.index].container).addClass("active").siblings(".active").removeClass("active"),n.trigger({type:w.LOADSTART,cached:h,index:a.index,imageTarget:c.image,thumbTarget:u.image}),c.load(r,function(t){n._scaleImage(t,{complete:function(t){"image"in s&&b.toggleQuality(s.image,!1),b.toggleQuality(t.image,!1),n._queue.stalled=!0,n.removePan(),n.setInfo(a.index),n.setCounter(a.index),n.trigger({type:w.LOADFINISH,cached:h,index:a.index,imageTarget:t.image,thumbTarget:n._thumbnails[a.index].image});var i=null===s.image&&n._options.initialTransition!==e?n._options.initialTransition:n._options.transition;if(i in x==!1)l();else{var o={prev:s.container,next:t.container,rewind:a.rewind,speed:n._options.transitionSpeed||400};x[i].call(n,o,l)}}})})}},getNext:function(t){return t="number"==typeof t?t:this.getIndex(),t===this.getDataLength()-1?0:t+1},getPrev:function(t){return t="number"==typeof t?t:this.getIndex(),0===t?this.getDataLength()-1:t-1},next:function(){return this.getDataLength()>1&&this.show(this.getNext(),!1),this},prev:function(){return this.getDataLength()>1&&this.show(this.getPrev(),!0),this},get:function(t){return t in this._dom?this._dom[t]:null},getData:function(t){return t in this._data?this._data[t]:this._data[this._active]},getDataLength:function(){return this._data.length},getIndex:function(){return"number"==typeof this._active?this._active:!1},getStageHeight:function(){return this._stageHeight},getStageWidth:function(){return this._stageWidth},getOptions:function(t){return"undefined"==typeof t?this._options:this._options[t]},setOptions:function(e,i){return"object"==typeof e?t.extend(this._options,e):this._options[e]=i,this},play:function(t){return this._playing=!0,this._playtime=t||this._playtime,this._playCheck(),this.trigger(w.PLAY),this},pause:function(){return this._playing=!1,this.trigger(w.PAUSE),this},playToggle:function(t){return this._playing?this.pause():this.play(t)},isPlaying:function(){return this._playing},isFullscreen:function(){return this._fullscreen.active},_playCheck:function(){var t=this,e=0,i=20,n=b.timestamp(),a="play"+this._id;if(this._playing){b.clearTimer(a);var o=function(){return e=b.timestamp()-n,e>=t._playtime&&t._playing?(b.clearTimer(a),void t.next()):void(t._playing&&(t.trigger({type:w.PROGRESS,percent:Math.ceil(e/t._playtime*100),seconds:Math.floor(e/1e3),milliseconds:e}),b.addTimer(a,o,i)))};b.addTimer(a,o,i)}},setIndex:function(t){return this._active=t,this},setCounter:function(t){if("number"==typeof t?t++:"undefined"==typeof t&&(t=this.getIndex()+1),this.get("current").innerHTML=t,h){var e=this.$("counter"),i=e.css("opacity"),n=e.attr("style");n&&1===parseInt(i,10)?e.attr("style",n.replace(/filter[^\;]+\;/i,"")):this.$("counter").css("opacity",i)}return this},setInfo:function(e){var i=this,n=this.getData(e);return t.each(["title","description"],function(t,e){var a=i.$("info-"+e);n[e]?a[n[e].length?"show":"hide"]().html(n[e]):a.empty().hide()}),this},hasInfo:function(t){var e,i="title description".split(" ");for(e=0;i[e];e++)if(this.getData(t)[i[e]])return!0;return!1},jQuery:function(e){var i=this,n=[];t.each(e.split(","),function(e,a){a=t.trim(a),i.get(a)&&n.push(a)});var a=t(i.get(n.shift()));return t.each(n,function(t,e){a=a.add(i.get(e))}),a},$:function(){return this.jQuery.apply(this,b.array(arguments))}},t.each(d,function(t,e){var i=/_/.test(e)?e.replace(/_/g,""):e;w[e.toUpperCase()]="galleria."+i}),t.extend(w,{IE9:9===h,IE8:8===h,IE7:7===h,IE6:6===h,IE:!!h,WEBKIT:/webkit/.test(s),SAFARI:/safari/.test(s),CHROME:/chrome/.test(s),QUIRK:h&&n.compatMode&&"BackCompat"===n.compatMode,MAC:/mac/.test(navigator.platform.toLowerCase()),OPERA:!!i.opera,IPHONE:/iphone/.test(s),IPAD:/ipad/.test(s),ANDROID:/android/.test(s),TOUCH:"ontouchstart"in document}),w.addTheme=function(e){e.name||w.raise("No theme name specified"),e.defaults="object"!=typeof e.defaults?{}:p(e.defaults);var i,n=!1;return"string"==typeof e.css?(t("link").each(function(t,a){return i=new RegExp(e.css),i.test(a.href)?(n=!0,w.theme=e,!1):void 0}),n||t("script").each(function(t,a){i=new RegExp("galleria\\."+e.name.toLowerCase()+"\\."),i.test(a.src)&&(n=a.src.replace(/[^\/]*$/,"")+e.css,b.addTimer("css",function(){b.loadCSS(n,"galleria-theme",function(){w.theme=e})},1))}),n||w.raise("No theme CSS loaded")):w.theme=e,e},w.loadTheme=function(i,n){var a=!1,o=m.length;w.theme=e,b.loadScript(i,function(){a=!0}),b.wait({until:function(){return a},error:function(){w.raise("Theme at "+i+" could not load, check theme path.",!0)},success:function(){if(o){var e=[];t.each(w.get(),function(i,a){var o=t.extend(a._original.options,{data_source:a._data},n);a.$("container").remove();var r=new w;r._id=a._id,r.init(a._original.target,o),e.push(r)}),m=e}},timeout:2e3})},w.get=function(t){return y[t]?y[t]:"number"!=typeof t?y:void w.raise("Gallery index "+t+" not found")},w.addTransition=function(t,e){x[t]=e},w.utils=b,w.log=function(){try{i.console.log.apply(i.console,b.array(arguments))}catch(t){try{i.opera.postError.apply(i.opera,arguments)}catch(e){i.alert(b.array(arguments).split(", "))}}},w.ready=function(t){w.ready.callbacks.push(t)},w.ready.callbacks=[],w.raise=function(e,i){var n=i?"Fatal error":"Error",a=function(e){var a='<div style="padding:4px;margin:0 0 2px;background:#'+(i?"811":"222")+'";>'+(i?"<strong>"+n+": </strong>":"")+e+"</div>";t.each(y,function(){var t=this.$("errors"),e=this.$("target");t.length||(e.css("position","relative"),t=this.addElement("errors").appendChild("target","errors").$("errors").css({color:"#fff",position:"absolute",top:0,left:0,zIndex:1e5})),t.append(a)})};if(r){if(a(e),i)throw new Error(n+": "+e)}else if(i){if(v)return;v=!0,i=!1,a("Image gallery could not load.")}},w.Picture=function(e){this.id=e||null,this.image=null,this.container=b.create("galleria-image"),t(this.container).css({overflow:"hidden",position:"relative"}),this.original={width:0,height:0},this.ready=!1,this.loaded=!1},w.Picture.prototype={cache:{},add:function(e){var i=0,n=this,a=new Image,o=function(){this.width&&this.height||!(1e3>i)||(i++,t(a).load(o).attr("src",e+"?"+(new Date).getTime())),n.original={height:this.height,width:this.width},n.cache[e]=e,n.loaded=!0};return t(a).css("display","block"),n.cache[e]?(a.src=e,o.call(a),a):(t(a).load(o).error(function(){w.raise("image could not load: "+e)}).attr("src",e),a)},show:function(){b.show(this.image)},hide:function(){b.moveOut(this.image)},clear:function(){this.image=null},isCached:function(t){return!!this.cache[t]},load:function(e,n){var a=this;return t(this.container).empty(!0),this.image=this.add(e),b.hide(this.image),t(this.container).append(this.image),b.wait({until:function(){return a.loaded&&a.image.complete&&a.original.width&&a.image.width},success:function(){i.setTimeout(function(){n.call(a,a)},1)},error:function(){i.setTimeout(function(){n.call(a,a)},1),w.raise("image not loaded in 30 seconds: "+e)},timeout:3e4}),this.container},scale:function(i){if(i=t.extend({width:0,height:0,min:e,max:e,margin:0,complete:function(){},position:"center",crop:!1,canvas:!1},i),!this.image)return this.container;var n,a,o,r=this,s=t(r.container);return b.wait({until:function(){return n=i.width||s.width()||b.parseValue(s.css("width")),a=i.height||s.height()||b.parseValue(s.css("height")),n&&a},success:function(){var e=(n-2*i.margin)/r.original.width,s=(a-2*i.margin)/r.original.height,c={"true":Math.max(e,s),width:e,height:s,"false":Math.min(e,s)},h=c[i.crop.toString()],u="";i.max&&(h=Math.min(i.max,h)),i.min&&(h=Math.max(i.min,h)),t.each(["width","height"],function(e,i){t(r.image)[i](r[i]=r.image[i]=Math.round(r.original[i]*h))}),t(r.container).width(n).height(a),i.canvas&&_&&(_.elem.width=r.width,_.elem.height=r.height,u=r.image.src+":"+r.width+"x"+r.height,r.image.src=_.cache[u]||function(t){_.context.drawImage(r.image,0,0,r.original.width*h,r.original.height*h);try{return o=_.elem.toDataURL(),_.length+=o.length,_.cache[t]=o,o}catch(e){return r.image.src}}(u));var l={},d={},p=function(e,i,n){var a=0;if(/\%/.test(e)){var o=parseInt(e,10)/100,s=r.image[i]||t(r.image)[i]();a=Math.ceil(-1*s*o+n*o)}else a=b.parseValue(e);return a},g={top:{top:0},left:{left:0},right:{left:"100%"},bottom:{top:"100%"}};t.each(i.position.toLowerCase().split(" "),function(t,e){"center"===e&&(e="50%"),l[t?"top":"left"]=e}),t.each(l,function(e,i){g.hasOwnProperty(i)&&t.extend(d,g[i])}),l=l.top?t.extend(l,d):d,l=t.extend({top:"50%",left:"50%"},l),t(r.image).css({position:"relative",top:p(l.top,"height",a),left:p(l.left,"width",n)}),r.show(),r.ready=!0,i.complete.call(r,r)},error:function(){w.raise("Could not scale image: "+r.image.src)},timeout:1e3}),this}},t.extend(t.easing,{galleria:function(t,e,i,n,a){return(e/=a/2)<1?n/2*e*e*e+i:n/2*((e-=2)*e*e+2)+i},galleriaIn:function(t,e,i,n,a){return n*(e/=a)*e+i},galleriaOut:function(t,e,i,n,a){return-n*(e/=a)*(e-2)+i}}),t.fn.galleria=function(t){return this.each(function(){var e=new w;e.init(this,t)})},i.Galleria=w}(jQuery); | mohitbhatia1994/cdnjs | ajax/libs/galleria/1.2.4/galleria.min.js | JavaScript | mit | 45,395 |
<?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\Routing\Tests\Matcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;
class TraceableUrlMatcherTest extends \PHPUnit_Framework_TestCase
{
public function test()
{
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('POST')));
$coll->add('bar', new Route('/bar/{id}', array(), array('id' => '\d+')));
$coll->add('bar1', new Route('/bar/{name}', array(), array('id' => '\w+'), array(), '', array(), array('POST')));
$coll->add('bar2', new Route('/foo', array(), array(), array(), 'baz'));
$coll->add('bar3', new Route('/foo1', array(), array(), array(), 'baz'));
$coll->add('bar4', new Route('/foo2', array(), array(), array(), 'baz', array(), array(), 'context.getMethod() == "GET"'));
$context = new RequestContext();
$context->setHost('baz');
$matcher = new TraceableUrlMatcher($coll, $context);
$traces = $matcher->getTraces('/babar');
$this->assertSame(array(0, 0, 0, 0, 0, 0), $this->getLevels($traces));
$traces = $matcher->getTraces('/foo');
$this->assertSame(array(1, 0, 0, 2), $this->getLevels($traces));
$traces = $matcher->getTraces('/bar/12');
$this->assertSame(array(0, 2), $this->getLevels($traces));
$traces = $matcher->getTraces('/bar/dd');
$this->assertSame(array(0, 1, 1, 0, 0, 0), $this->getLevels($traces));
$traces = $matcher->getTraces('/foo1');
$this->assertSame(array(0, 0, 0, 0, 2), $this->getLevels($traces));
$context->setMethod('POST');
$traces = $matcher->getTraces('/foo');
$this->assertSame(array(2), $this->getLevels($traces));
$traces = $matcher->getTraces('/bar/dd');
$this->assertSame(array(0, 1, 2), $this->getLevels($traces));
$traces = $matcher->getTraces('/foo2');
$this->assertSame(array(0, 0, 0, 0, 0, 1), $this->getLevels($traces));
}
public function testMatchRouteOnMultipleHosts()
{
$routes = new RouteCollection();
$routes->add('first', new Route(
'/mypath/',
array('_controller' => 'MainBundle:Info:first'),
array(),
array(),
'some.example.com'
));
$routes->add('second', new Route(
'/mypath/',
array('_controller' => 'MainBundle:Info:second'),
array(),
array(),
'another.example.com'
));
$context = new RequestContext();
$context->setHost('baz');
$matcher = new TraceableUrlMatcher($routes, $context);
$traces = $matcher->getTraces('/mypath/');
$this->assertSame(
array(TraceableUrlMatcher::ROUTE_ALMOST_MATCHES, TraceableUrlMatcher::ROUTE_ALMOST_MATCHES),
$this->getLevels($traces)
);
}
public function getLevels($traces)
{
$levels = array();
foreach ($traces as $trace) {
$levels[] = $trace['level'];
}
return $levels;
}
public function testRoutesWithConditions()
{
$routes = new RouteCollection();
$routes->add('foo', new Route('/foo', array(), array(), array(), 'baz', array(), array(), "request.headers.get('User-Agent') matches '/firefox/i'"));
$context = new RequestContext();
$context->setHost('baz');
$matcher = new TraceableUrlMatcher($routes, $context);
$notMatchingRequest = Request::create('/foo', 'GET');
$traces = $matcher->getTracesForRequest($notMatchingRequest);
$this->assertEquals("Condition \"request.headers.get('User-Agent') matches '/firefox/i'\" does not evaluate to \"true\"", $traces[0]['log']);
$matchingRequest = Request::create('/foo', 'GET', array(), array(), array(), array('HTTP_USER_AGENT' => 'Firefox'));
$traces = $matcher->getTracesForRequest($matchingRequest);
$this->assertEquals('Route matches!', $traces[0]['log']);
}
}
| iamonuwa/cloud-learning | vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php | PHP | mit | 4,473 |
(function() {
var extend,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
extend = function(object) {
var i, key, replacement, result;
result = object || {};
i = 1;
while (i < arguments.length) {
replacement = arguments[i] || {};
for (key in replacement) {
if (typeof result[key] === "object") {
result[key] = extend(result[key], replacement[key]);
} else {
result[key] = result[key] || replacement[key];
}
}
i++;
}
return result;
};
this.WOW = (function() {
WOW.prototype.defaults = {
boxClass: 'wow',
animateClass: 'animated',
offset: 0,
duration: '1s',
delay: '0s',
iteration: '1'
};
function WOW(options) {
if (options == null) {
options = {};
}
this.scrollCallback = __bind(this.scrollCallback, this);
this.scrollHandler = __bind(this.scrollHandler, this);
this.config = extend(options, this.defaults);
this.visibleCount = 0;
this.element = window.document.documentElement;
this.boxes = Array.prototype.slice.call(this.element.getElementsByClassName(this.config.boxClass));
this.scrolled = true;
}
WOW.prototype.init = function() {
if (this.boxes.length) {
this.applyStyle(this.boxes);
window.addEventListener('scroll', this.scrollHandler, false);
window.addEventListener('resize', this.scrollHandler, false);
return this.interval = setInterval(this.scrollCallback, 50);
}
};
WOW.prototype.stop = function() {
window.removeEventListener('scroll', this.scrollHandler, false);
window.removeEventListener('resize', this.scrollHandler, false);
if (this.interval != null) {
return clearInterval(this.interval);
}
};
WOW.prototype.show = function(box) {
box.style.visibility = 'visible';
return box.className = "" + box.className + " " + this.config.animateClass;
};
WOW.prototype.applyStyle = function() {
var box, delay, duration, iteration, _i, _len, _ref, _results;
_ref = this.boxes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
box = _ref[_i];
duration = box.getAttribute('data-wow-duration') || this.config.duration;
delay = box.getAttribute('data-wow-delay') || this.config.delay;
iteration = box.getAttribute('data-wow-iteration') || this.config.iteration;
_results.push(box.setAttribute('style', this.customStyle(duration, delay, iteration)));
}
return _results;
};
WOW.prototype.customStyle = function(duration, delay, iteration) {
var visibility;
visibility = "visibility: hidden; ";
duration = ("-webkit-animation-duration: " + duration + "; ") + ("-moz-animation-duration: " + duration + ";") + ("animation-duration: " + duration + "; ");
delay = ("-moz-animation-delay: " + delay + "; ") + ("-webkit-animation-delay: " + delay + "; ") + ("animation-delay: " + delay + "; ");
iteration = ("-moz-animation-iteration-count: " + iteration + "; ") + ("-webkit-animation-iteration-count: " + iteration + "; ") + ("animation-iteration-count: " + iteration + "; ");
return visibility + duration + delay + iteration;
};
WOW.prototype.scrollHandler = function() {
return this.scrolled = true;
};
WOW.prototype.scrollCallback = function() {
var box, i, _i, _len, _ref, _results;
if (this.scrolled) {
this.scrolled = false;
_ref = this.boxes;
_results = [];
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
box = _ref[i];
if ((box != null) && this.isVisible(box)) {
this.show(box);
this.boxes[i] = null;
this.visibleCount++;
if (this.boxes.length === this.visibleCount) {
_results.push(this.stop());
} else {
_results.push(void 0);
}
} else {
_results.push(void 0);
}
}
return _results;
}
};
WOW.prototype.offsetTop = function(element) {
var top;
top = element.offsetTop;
while (element = element.offsetParent) {
top += element.offsetTop;
}
return top;
};
WOW.prototype.isVisible = function(box) {
var bottom, offset, top, viewBottom, viewTop;
offset = box.getAttribute('data-wow-offset') || this.config.offset;
viewTop = window.pageYOffset;
viewBottom = viewTop + this.element.clientHeight - offset;
top = this.offsetTop(box);
bottom = top + box.clientHeight;
return top <= viewBottom && bottom >= viewTop;
};
return WOW;
})();
}).call(this);
| ruiaraujo/cdnjs | ajax/libs/wow/0.0.9/wow.js | JavaScript | mit | 4,830 |
/*
* Copyright (C) 2011 The Android Open Source Project
*
* 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.
*/
package com.squareup.okhttp.internal.http;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
/**
* Best-effort parser for HTTP dates.
*/
final class HttpDate {
/**
* Most websites serve cookies in the blessed format. Eagerly create the parser to ensure such
* cookies are on the fast path.
*/
private static final ThreadLocal<DateFormat> STANDARD_DATE_FORMAT =
new ThreadLocal<DateFormat>() {
@Override protected DateFormat initialValue() {
DateFormat rfc1123 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
rfc1123.setTimeZone(TimeZone.getTimeZone("GMT"));
return rfc1123;
}
};
/** If we fail to parse a date in a non-standard format, try each of these formats in sequence. */
private static final String[] BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS = new String[] {
"EEEE, dd-MMM-yy HH:mm:ss zzz", // RFC 1036
"EEE MMM d HH:mm:ss yyyy", // ANSI C asctime()
"EEE, dd-MMM-yyyy HH:mm:ss z", "EEE, dd-MMM-yyyy HH-mm-ss z", "EEE, dd MMM yy HH:mm:ss z",
"EEE dd-MMM-yyyy HH:mm:ss z", "EEE dd MMM yyyy HH:mm:ss z", "EEE dd-MMM-yyyy HH-mm-ss z",
"EEE dd-MMM-yy HH:mm:ss z", "EEE dd MMM yy HH:mm:ss z", "EEE,dd-MMM-yy HH:mm:ss z",
"EEE,dd-MMM-yyyy HH:mm:ss z", "EEE, dd-MM-yyyy HH:mm:ss z",
/* RI bug 6641315 claims a cookie of this format was once served by www.yahoo.com */
"EEE MMM d yyyy HH:mm:ss z", };
private static final DateFormat[] BROWSER_COMPATIBLE_DATE_FORMATS =
new DateFormat[BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS.length];
/** Returns the date for {@code value}. Returns null if the value couldn't be parsed. */
public static Date parse(String value) {
try {
return STANDARD_DATE_FORMAT.get().parse(value);
} catch (ParseException ignored) {
}
synchronized (BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS) {
for (int i = 0, count = BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS.length; i < count; i++) {
DateFormat format = BROWSER_COMPATIBLE_DATE_FORMATS[i];
if (format == null) {
format = new SimpleDateFormat(BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS[i], Locale.US);
BROWSER_COMPATIBLE_DATE_FORMATS[i] = format;
}
try {
return format.parse(value);
} catch (ParseException ignored) {
}
}
}
return null;
}
/** Returns the string for {@code value}. */
public static String format(Date value) {
return STANDARD_DATE_FORMAT.get().format(value);
}
private HttpDate() {
}
}
| rek/gunday | platforms/android/CordovaLib/src/com/squareup/okhttp/internal/http/HttpDate.java | Java | mit | 3,308 |
<?php
/**
* Media Library administration panel.
*
* @package WordPress
* @subpackage Administration
*/
/** WordPress Administration Bootstrap */
require_once( dirname( __FILE__ ) . '/admin.php' );
if ( !current_user_can('upload_files') )
wp_die( __( 'You do not have permission to upload files.' ) );
$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
$modes = array( 'grid', 'list' );
if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes ) ) {
$mode = $_GET['mode'];
update_user_option( get_current_user_id(), 'media_library_mode', $mode );
}
if ( 'grid' === $mode ) {
wp_enqueue_media();
wp_enqueue_script( 'media-grid' );
wp_enqueue_script( 'media' );
remove_action( 'admin_head', 'wp_admin_canonical_url' );
$q = $_GET;
// let JS handle this
unset( $q['s'] );
$vars = wp_edit_attachments_query_vars( $q );
$ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' );
foreach ( $vars as $key => $value ) {
if ( ! $value || in_array( $key, $ignore ) ) {
unset( $vars[ $key ] );
}
}
wp_localize_script( 'media-grid', '_wpMediaGridSettings', array(
'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ),
'queryVars' => (object) $vars
) );
get_current_screen()->add_help_tab( array(
'id' => 'overview',
'title' => __( 'Overview' ),
'content' =>
'<p>' . __( 'All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first.' ) . '</p>' .
'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>' .
'<p>' . __( 'To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.' ) . '</p>'
) );
get_current_screen()->add_help_tab( array(
'id' => 'attachment-details',
'title' => __( 'Attachment Details' ),
'content' =>
'<p>' . __( 'Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.' ) . '</p>' .
'<p>' . __( 'Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.' ) . '</p>' .
'<p>' . __( 'You can also delete individual items and access the extended edit screen from the details dialog.' ) . '</p>'
) );
get_current_screen()->set_help_sidebar(
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
'<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
);
$title = __('Media Library');
$parent_file = 'upload.php';
require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>
<div class="wrap" id="wp-media-grid" data-search="<?php _admin_search_query() ?>">
<h1>
<?php
echo esc_html( $title );
if ( current_user_can( 'upload_files' ) ) { ?>
<a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php
}
?>
</h1>
<div class="error hide-if-js">
<p><?php printf(
/* translators: %s: list view URL */
__( 'The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.' ),
'upload.php?mode=list'
); ?></p>
</div>
</div>
<?php
include( ABSPATH . 'wp-admin/admin-footer.php' );
exit;
}
$wp_list_table = _get_list_table('WP_Media_List_Table');
$pagenum = $wp_list_table->get_pagenum();
// Handle bulk actions
$doaction = $wp_list_table->current_action();
if ( $doaction ) {
check_admin_referer('bulk-media');
if ( 'delete_all' == $doaction ) {
$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
$doaction = 'delete';
} elseif ( isset( $_REQUEST['media'] ) ) {
$post_ids = $_REQUEST['media'];
} elseif ( isset( $_REQUEST['ids'] ) ) {
$post_ids = explode( ',', $_REQUEST['ids'] );
}
$location = 'upload.php';
if ( $referer = wp_get_referer() ) {
if ( false !== strpos( $referer, 'upload.php' ) )
$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
}
switch ( $doaction ) {
case 'detach':
wp_media_attach_action( $_REQUEST['parent_post_id'], 'detach' );
break;
case 'attach':
wp_media_attach_action( $_REQUEST['found_post_id'] );
break;
case 'trash':
if ( !isset( $post_ids ) )
break;
foreach ( (array) $post_ids as $post_id ) {
if ( !current_user_can( 'delete_post', $post_id ) )
wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
if ( !wp_trash_post( $post_id ) )
wp_die( __( 'Error in moving to Trash.' ) );
}
$location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location );
break;
case 'untrash':
if ( !isset( $post_ids ) )
break;
foreach ( (array) $post_ids as $post_id ) {
if ( !current_user_can( 'delete_post', $post_id ) )
wp_die( __( 'You are not allowed to move this item out of the Trash.' ) );
if ( !wp_untrash_post( $post_id ) )
wp_die( __( 'Error in restoring from Trash.' ) );
}
$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
break;
case 'delete':
if ( !isset( $post_ids ) )
break;
foreach ( (array) $post_ids as $post_id_del ) {
if ( !current_user_can( 'delete_post', $post_id_del ) )
wp_die( __( 'You are not allowed to delete this item.' ) );
if ( !wp_delete_attachment( $post_id_del ) )
wp_die( __( 'Error in deleting.' ) );
}
$location = add_query_arg( 'deleted', count( $post_ids ), $location );
break;
}
wp_redirect( $location );
exit;
} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
exit;
}
$wp_list_table->prepare_items();
$title = __('Media Library');
$parent_file = 'upload.php';
wp_enqueue_script( 'media' );
add_screen_option( 'per_page' );
get_current_screen()->add_help_tab( array(
'id' => 'overview',
'title' => __('Overview'),
'content' =>
'<p>' . __( 'All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.' ) . '</p>' .
'<p>' . __( 'You can narrow the list by file type/status or by date using the dropdown menus above the media table.' ) . '</p>' .
'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>'
) );
get_current_screen()->add_help_tab( array(
'id' => 'actions-links',
'title' => __('Available Actions'),
'content' =>
'<p>' . __( 'Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file’s name displays a simple screen to edit that individual file’s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.' ) . '</p>'
) );
get_current_screen()->add_help_tab( array(
'id' => 'attaching-files',
'title' => __('Attaching Files'),
'content' =>
'<p>' . __( 'If a media file has not been attached to any content, you will see that in the Uploaded To column, and can click on Attach to launch a small popup that will allow you to search for existing content and attach the file.' ) . '</p>'
) );
get_current_screen()->set_help_sidebar(
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
'<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
);
get_current_screen()->set_screen_reader_content( array(
'heading_views' => __( 'Filter media items list' ),
'heading_pagination' => __( 'Media items list navigation' ),
'heading_list' => __( 'Media items list' ),
) );
require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>
<div class="wrap">
<h1>
<?php
echo esc_html( $title );
if ( current_user_can( 'upload_files' ) ) { ?>
<a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
}
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
/* translators: %s: search keywords */
printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', get_search_query() );
}
?>
</h1>
<?php
$message = '';
if ( ! empty( $_GET['posted'] ) ) {
$message = __( 'Media file updated.' );
$_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
}
if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
if ( 1 == $attached ) {
$message = __( 'Media file attached.' );
} else {
/* translators: %s: number of media files */
$message = _n( '%s media file attached.', '%s media files attached.', $attached );
}
$message = sprintf( $message, number_format_i18n( $attached ) );
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
}
if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
if ( 1 == $detached ) {
$message = __( 'Media file detached.' );
} else {
/* translators: %s: number of media files */
$message = _n( '%s media file detached.', '%s media files detached.', $detached );
}
$message = sprintf( $message, number_format_i18n( $detached ) );
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
}
if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
if ( 1 == $deleted ) {
$message = __( 'Media file permanently deleted.' );
} else {
/* translators: %s: number of media files */
$message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted );
}
$message = sprintf( $message, number_format_i18n( $deleted ) );
$_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
}
if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
if ( 1 == $trashed ) {
$message = __( 'Media file moved to the trash.' );
} else {
/* translators: %s: number of media files */
$message = _n( '%s media file moved to the trash.', '%s media files moved to the trash.', $trashed );
}
$message = sprintf( $message, number_format_i18n( $trashed ) );
$message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
$_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
}
if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) {
if ( 1 == $untrashed ) {
$message = __( 'Media file restored from the trash.' );
} else {
/* translators: %s: number of media files */
$message = _n( '%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed );
}
$message = sprintf( $message, number_format_i18n( $untrashed ) );
$_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
}
$messages[1] = __( 'Media file updated.' );
$messages[2] = __( 'Media file permanently deleted.' );
$messages[3] = __( 'Error saving media file.' );
$messages[4] = __( 'Media file moved to the trash.' ) . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __( 'Undo' ) . '</a>';
$messages[5] = __( 'Media file restored from the trash.' );
if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) {
$message = $messages[ $_GET['message'] ];
$_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
}
if ( !empty($message) ) { ?>
<div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div>
<?php } ?>
<form id="posts-filter" method="get">
<?php $wp_list_table->views(); ?>
<?php $wp_list_table->display(); ?>
<div id="ajax-response"></div>
<?php find_posts_div(); ?>
</form>
</div>
<?php
include( ABSPATH . 'wp-admin/admin-footer.php' );
| duyngha/duywp | wp-admin/upload.php | PHP | mit | 12,930 |
<?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 DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
use PharException;
/**
* Test asset that extends an internal PHP class
* This class should be serializable without problems
* and without getting the "Erroneous data format for unserializing"
* error
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class PharExceptionAsset extends PharException
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
| smajohusic/simple-app-with-vue | vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/PharExceptionAsset.php | PHP | mit | 1,594 |
<?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\Form\Tests\Extension\Core\DataTransformer;
use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
use Symfony\Component\Form\Extension\Core\DataTransformer\ChoiceToValueTransformer;
class ChoiceToValueTransformerTest extends \PHPUnit_Framework_TestCase
{
protected $transformer;
protected function setUp()
{
$list = new SimpleChoiceList(array('' => 'A', 0 => 'B', 1 => 'C'));
$this->transformer = new ChoiceToValueTransformer($list);
}
protected function tearDown()
{
$this->transformer = null;
}
public function transformProvider()
{
return array(
// more extensive test set can be found in FormUtilTest
array(0, '0'),
array(false, '0'),
array('', ''),
);
}
/**
* @dataProvider transformProvider
*/
public function testTransform($in, $out)
{
$this->assertSame($out, $this->transformer->transform($in));
}
public function reverseTransformProvider()
{
return array(
// values are expected to be valid choice keys already and stay
// the same
array('0', 0),
array('', null),
array(null, null),
);
}
/**
* @dataProvider reverseTransformProvider
*/
public function testReverseTransform($in, $out)
{
$this->assertSame($out, $this->transformer->reverseTransform($in));
}
/**
* @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
*/
public function testReverseTransformExpectsScalar()
{
$this->transformer->reverseTransform(array());
}
}
| seekmas/makoto.local | vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php | PHP | mit | 1,971 |
<?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.
*/
abstract class Twig_Test_NodeTestCase extends PHPUnit_Framework_TestCase
{
abstract public function getTests();
/**
* @dataProvider getTests
*/
public function testCompile($node, $source, $environment = null)
{
$this->assertNodeCompilation($source, $node, $environment);
}
public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null)
{
$compiler = $this->getCompiler($environment);
$compiler->compile($node);
$this->assertEquals($source, trim($compiler->getSource()));
}
protected function getCompiler(Twig_Environment $environment = null)
{
return new Twig_Compiler(null === $environment ? $this->getEnvironment() : $environment);
}
protected function getEnvironment()
{
return new Twig_Environment();
}
protected function getVariableGetter($name)
{
if (version_compare(phpversion(), '5.4.0RC1', '>=')) {
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
}
return sprintf('$this->getContext($context, "%s")', $name);
}
protected function getAttributeGetter()
{
if (function_exists('twig_template_get_attributes')) {
return 'twig_template_get_attributes($this, ';
}
return '$this->getAttribute(';
}
}
| carlx/Pizza | vendor/twig/twig/lib/Twig/Test/NodeTestCase.php | PHP | mit | 1,593 |
function FastClick(a){"use strict";function b(a,b){return function(){return a.apply(b,arguments)}}var c;this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=10,this.layer=a,FastClick.notNeeded(a)||(deviceIsAndroid&&(a.addEventListener("mouseover",b(this.onMouse,this),!0),a.addEventListener("mousedown",b(this.onMouse,this),!0),a.addEventListener("mouseup",b(this.onMouse,this),!0)),a.addEventListener("click",b(this.onClick,this),!0),a.addEventListener("touchstart",b(this.onTouchStart,this),!1),a.addEventListener("touchmove",b(this.onTouchMove,this),!1),a.addEventListener("touchend",b(this.onTouchEnd,this),!1),a.addEventListener("touchcancel",b(this.onTouchCancel,this),!1),Event.prototype.stopImmediatePropagation||(a.removeEventListener=function(b,c,d){var e=Node.prototype.removeEventListener;"click"===b?e.call(a,b,c.hijacked||c,d):e.call(a,b,c,d)},a.addEventListener=function(b,c,d){var e=Node.prototype.addEventListener;"click"===b?e.call(a,b,c.hijacked||(c.hijacked=function(a){a.propagationStopped||c(a)}),d):e.call(a,b,c,d)}),"function"==typeof a.onclick&&(c=a.onclick,a.addEventListener("click",function(a){c(a)},!1),a.onclick=null))}var deviceIsAndroid=navigator.userAgent.indexOf("Android")>0,deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent),deviceIsIOS4=deviceIsIOS&&/OS 4_\d(_\d)?/.test(navigator.userAgent),deviceIsIOSWithBadTarget=deviceIsIOS&&/OS ([6-9]|\d{2})_\d/.test(navigator.userAgent);FastClick.prototype.needsClick=function(a){"use strict";switch(a.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(a.disabled)return!0;break;case"input":if(deviceIsIOS&&"file"===a.type||a.disabled)return!0;break;case"label":case"video":return!0}return/\bneedsclick\b/.test(a.className)},FastClick.prototype.needsFocus=function(a){"use strict";switch(a.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!deviceIsAndroid;case"input":switch(a.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!a.disabled&&!a.readOnly;default:return/\bneedsfocus\b/.test(a.className)}},FastClick.prototype.sendClick=function(a,b){"use strict";var c,d;document.activeElement&&document.activeElement!==a&&document.activeElement.blur(),d=b.changedTouches[0],c=document.createEvent("MouseEvents"),c.initMouseEvent(this.determineEventType(a),!0,!0,window,1,d.screenX,d.screenY,d.clientX,d.clientY,!1,!1,!1,!1,0,null),c.forwardedTouchEvent=!0,a.dispatchEvent(c)},FastClick.prototype.determineEventType=function(a){"use strict";return deviceIsAndroid&&"select"===a.tagName.toLowerCase()?"mousedown":"click"},FastClick.prototype.focus=function(a){"use strict";var b;deviceIsIOS&&a.setSelectionRange&&0!==a.type.indexOf("date")&&"time"!==a.type?(b=a.value.length,a.setSelectionRange(b,b)):a.focus()},FastClick.prototype.updateScrollParent=function(a){"use strict";var b,c;if(b=a.fastClickScrollParent,!b||!b.contains(a)){c=a;do{if(c.scrollHeight>c.offsetHeight){b=c,a.fastClickScrollParent=c;break}c=c.parentElement}while(c)}b&&(b.fastClickLastScrollTop=b.scrollTop)},FastClick.prototype.getTargetElementFromEventTarget=function(a){"use strict";return a.nodeType===Node.TEXT_NODE?a.parentNode:a},FastClick.prototype.onTouchStart=function(a){"use strict";var b,c,d;if(a.targetTouches.length>1)return!0;if(b=this.getTargetElementFromEventTarget(a.target),c=a.targetTouches[0],deviceIsIOS){if(d=window.getSelection(),d.rangeCount&&!d.isCollapsed)return!0;if(!deviceIsIOS4){if(c.identifier===this.lastTouchIdentifier)return a.preventDefault(),!1;this.lastTouchIdentifier=c.identifier,this.updateScrollParent(b)}}return this.trackingClick=!0,this.trackingClickStart=a.timeStamp,this.targetElement=b,this.touchStartX=c.pageX,this.touchStartY=c.pageY,a.timeStamp-this.lastClickTime<200&&a.preventDefault(),!0},FastClick.prototype.touchHasMoved=function(a){"use strict";var b=a.changedTouches[0],c=this.touchBoundary;return Math.abs(b.pageX-this.touchStartX)>c||Math.abs(b.pageY-this.touchStartY)>c?!0:!1},FastClick.prototype.onTouchMove=function(a){"use strict";return this.trackingClick?((this.targetElement!==this.getTargetElementFromEventTarget(a.target)||this.touchHasMoved(a))&&(this.trackingClick=!1,this.targetElement=null),!0):!0},FastClick.prototype.findControl=function(a){"use strict";return void 0!==a.control?a.control:a.htmlFor?document.getElementById(a.htmlFor):a.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},FastClick.prototype.onTouchEnd=function(a){"use strict";var b,c,d,e,f,g=this.targetElement;if(!this.trackingClick)return!0;if(a.timeStamp-this.lastClickTime<200)return this.cancelNextClick=!0,!0;if(this.cancelNextClick=!1,this.lastClickTime=a.timeStamp,c=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,deviceIsIOSWithBadTarget&&(f=a.changedTouches[0],g=document.elementFromPoint(f.pageX-window.pageXOffset,f.pageY-window.pageYOffset)||g,g.fastClickScrollParent=this.targetElement.fastClickScrollParent),d=g.tagName.toLowerCase(),"label"===d){if(b=this.findControl(g)){if(this.focus(g),deviceIsAndroid)return!1;g=b}}else if(this.needsFocus(g))return a.timeStamp-c>100||deviceIsIOS&&window.top!==window&&"input"===d?(this.targetElement=null,!1):(this.focus(g),this.sendClick(g,a),deviceIsIOS4&&"select"===d||(this.targetElement=null,a.preventDefault()),!1);return deviceIsIOS&&!deviceIsIOS4&&(e=g.fastClickScrollParent,e&&e.fastClickLastScrollTop!==e.scrollTop)?!0:(this.needsClick(g)||(a.preventDefault(),this.sendClick(g,a)),!1)},FastClick.prototype.onTouchCancel=function(){"use strict";this.trackingClick=!1,this.targetElement=null},FastClick.prototype.onMouse=function(a){"use strict";return this.targetElement?a.forwardedTouchEvent?!0:a.cancelable?!this.needsClick(this.targetElement)||this.cancelNextClick?(a.stopImmediatePropagation?a.stopImmediatePropagation():a.propagationStopped=!0,a.stopPropagation(),a.preventDefault(),!1):!0:!0:!0},FastClick.prototype.onClick=function(a){"use strict";var b;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===a.target.type&&0===a.detail?!0:(b=this.onMouse(a),b||(this.targetElement=null),b)},FastClick.prototype.destroy=function(){"use strict";var a=this.layer;deviceIsAndroid&&(a.removeEventListener("mouseover",this.onMouse,!0),a.removeEventListener("mousedown",this.onMouse,!0),a.removeEventListener("mouseup",this.onMouse,!0)),a.removeEventListener("click",this.onClick,!0),a.removeEventListener("touchstart",this.onTouchStart,!1),a.removeEventListener("touchmove",this.onTouchMove,!1),a.removeEventListener("touchend",this.onTouchEnd,!1),a.removeEventListener("touchcancel",this.onTouchCancel,!1)},FastClick.notNeeded=function(a){"use strict";var b,c;if("undefined"==typeof window.ontouchstart)return!0;if(c=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!deviceIsAndroid)return!0;if(b=document.querySelector("meta[name=viewport]")){if(-1!==b.content.indexOf("user-scalable=no"))return!0;if(c>31&&window.innerWidth<=window.screen.width)return!0}}return"none"===a.style.msTouchAction?!0:!1},FastClick.attach=function(a){"use strict";return new FastClick(a)},"undefined"!=typeof define&&define.amd?define(function(){"use strict";return FastClick}):"undefined"!=typeof module&&module.exports?(module.exports=FastClick.attach,module.exports.FastClick=FastClick):window.FastClick=FastClick,angular.module("mobile-angular-ui.touch",[]).run(["$window","$document",function(a,b){return a.addEventListener("load",function(){return FastClick.attach(b[0].body)},!1)}]).directive("select",function(){return{replace:!1,restrict:"E",link:function(a,b){b.addClass("needsclick")}}}).directive("input",function(){return{replace:!1,restrict:"E",link:function(a,b){b.addClass("needsclick")}}}).directive("textarea",function(){return{replace:!1,restrict:"E",link:function(a,b){b.addClass("needsclick")}}}).factory("$swipe",[function(){var a,b;return b=function(a){var b,c;return c=a.touches&&a.touches.length?a.touches:[a],b=a.changedTouches&&a.changedTouches[0]||a.originalEvent&&a.originalEvent.changedTouches&&a.originalEvent.changedTouches[0]||c[0].originalEvent||c[0],{x:b.clientX,y:b.clientY}},a=10,{bind:function(c,d){var e,f,g,h,i;h=void 0,i=void 0,g=void 0,f=void 0,e=!1,c.on("touchstart mousedown",function(a){g=b(a),e=!0,h=0,i=0,f=g,d.start&&d.start(g,a)}),c.on("touchcancel",function(a){e=!1,d.cancel&&d.cancel(a)}),c.on("touchmove mousemove",function(c){var j;if(e&&g&&(j=b(c),h+=Math.abs(j.x-f.x),i+=Math.abs(j.y-f.y),f=j,!(a>h&&a>i)))return i>h?(e=!1,d.cancel&&d.cancel(c),void 0):(c.preventDefault(),d.move&&d.move(j,c),void 0)}),c.on("touchend mouseup",function(a){e&&(e=!1,d.end&&d.end(b(a),a))})}}}]),angular.forEach([{directiveName:"ngSwipeLeft",direction:-1,eventName:"swipeleft"},{directiveName:"ngSwipeRight",direction:1,eventName:"swiperight"}],function(a){var b,c,d;c=a.directiveName,b=a.direction,d=a.eventName,angular.module("mobile-angular-ui.touch").directive(c,["$parse","$swipe",function(a,e){var f,g,h;return f=75,g=.3,h=30,function(i,j,k){var l,m,n,o;o=function(a){var c,d;return l?(d=Math.abs(a.y-l.y),c=(a.x-l.x)*b,n&&f>d&&c>0&&c>h&&g>d/c):!1},m=a(k[c]),l=void 0,n=void 0,e.bind(j,{start:function(a){l=a,n=!0},cancel:function(){n=!1},end:function(a,b){return o(a)?(i.$apply(function(){j.triggerHandler(d),m(i,{$event:b})}),b.stopPropagation(),!1):void 0}})}}])}); | him2him2/cdnjs | ajax/libs/mobile-angular-ui/1.1.0-beta.6/js/mobile-angular-ui-touch-fastclick.min.js | JavaScript | mit | 9,454 |
<!DOCTYPE html>
<html>
<head>
<title>Carousel</title>
<link rel="stylesheet" type="text/css" href="../../../dist/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="page-header">
<h1>Carousel <small>Bootstrap Visual Test</small></h1>
</div>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1" class=""></li>
<li data-target="#carousel-example-generic" data-slide-to="2" class=""></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img alt="First slide" src="http://37.media.tumblr.com/tumblr_m8tay0JcfG1qa42jro1_1280.jpg">
</div>
<div class="item">
<img alt="Second slide" src="http://37.media.tumblr.com/tumblr_m8tazfiVYJ1qa42jro1_1280.jpg">
</div>
<div class="item">
<img alt="Third slide" src="http://38.media.tumblr.com/tumblr_m8tb2rVsD31qa42jro1_1280.jpg">
</div>
</div>
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div>
<!-- JavaScript Includes -->
<script src="../vendor/jquery.min.js"></script>
<script src="../../transition.js"></script>
<script src="../../carousel.js"></script>
</body>
</html>
| llinmeng/learn-fe | src/ex/projects/taobao-pages/js/Bootstrap/tests/visual/carousel.html | HTML | mit | 1,650 |
// Copyright 2015 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 ignore
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"strings"
"golang.org/x/text/internal/gen"
)
type group struct {
Encodings []struct {
Labels []string
Name string
}
}
func main() {
gen.Init()
r := gen.Open("https://encoding.spec.whatwg.org", "whatwg", "encodings.json")
var groups []group
if err := json.NewDecoder(r).Decode(&groups); err != nil {
log.Fatalf("Error reading encodings.json: %v", err)
}
w := &bytes.Buffer{}
fmt.Fprintln(w, "type htmlEncoding byte")
fmt.Fprintln(w, "const (")
for i, g := range groups {
for _, e := range g.Encodings {
key := strings.ToLower(e.Name)
name := consts[key]
if name == "" {
log.Fatalf("No const defined for %s.", key)
}
if i == 0 {
fmt.Fprintf(w, "%s htmlEncoding = iota\n", name)
} else {
fmt.Fprintf(w, "%s\n", name)
}
}
}
fmt.Fprintln(w, "numEncodings")
fmt.Fprint(w, ")\n\n")
fmt.Fprintln(w, "var canonical = [numEncodings]string{")
for _, g := range groups {
for _, e := range g.Encodings {
fmt.Fprintf(w, "%q,\n", strings.ToLower(e.Name))
}
}
fmt.Fprint(w, "}\n\n")
fmt.Fprintln(w, "var nameMap = map[string]htmlEncoding{")
for _, g := range groups {
for _, e := range g.Encodings {
for _, l := range e.Labels {
key := strings.ToLower(e.Name)
name := consts[key]
fmt.Fprintf(w, "%q: %s,\n", l, name)
}
}
}
fmt.Fprint(w, "}\n\n")
var tags []string
fmt.Fprintln(w, "var localeMap = []htmlEncoding{")
for _, loc := range locales {
tags = append(tags, loc.tag)
fmt.Fprintf(w, "%s, // %s \n", consts[loc.name], loc.tag)
}
fmt.Fprint(w, "}\n\n")
fmt.Fprintf(w, "const locales = %q\n", strings.Join(tags, " "))
gen.WriteGoFile("tables.go", "htmlindex", w.Bytes())
}
// consts maps canonical encoding name to internal constant.
var consts = map[string]string{
"utf-8": "utf8",
"ibm866": "ibm866",
"iso-8859-2": "iso8859_2",
"iso-8859-3": "iso8859_3",
"iso-8859-4": "iso8859_4",
"iso-8859-5": "iso8859_5",
"iso-8859-6": "iso8859_6",
"iso-8859-7": "iso8859_7",
"iso-8859-8": "iso8859_8",
"iso-8859-8-i": "iso8859_8I",
"iso-8859-10": "iso8859_10",
"iso-8859-13": "iso8859_13",
"iso-8859-14": "iso8859_14",
"iso-8859-15": "iso8859_15",
"iso-8859-16": "iso8859_16",
"koi8-r": "koi8r",
"koi8-u": "koi8u",
"macintosh": "macintosh",
"windows-874": "windows874",
"windows-1250": "windows1250",
"windows-1251": "windows1251",
"windows-1252": "windows1252",
"windows-1253": "windows1253",
"windows-1254": "windows1254",
"windows-1255": "windows1255",
"windows-1256": "windows1256",
"windows-1257": "windows1257",
"windows-1258": "windows1258",
"x-mac-cyrillic": "macintoshCyrillic",
"gbk": "gbk",
"gb18030": "gb18030",
// "hz-gb-2312": "hzgb2312", // Was removed from WhatWG
"big5": "big5",
"euc-jp": "eucjp",
"iso-2022-jp": "iso2022jp",
"shift_jis": "shiftJIS",
"euc-kr": "euckr",
"replacement": "replacement",
"utf-16be": "utf16be",
"utf-16le": "utf16le",
"x-user-defined": "xUserDefined",
}
// locales is taken from
// https://html.spec.whatwg.org/multipage/syntax.html#encoding-sniffing-algorithm.
var locales = []struct{ tag, name string }{
// The default value. Explicitly state latin to benefit from the exact
// script option, while still making 1252 the default encoding for languages
// written in Latin script.
{"und_Latn", "windows-1252"},
{"ar", "windows-1256"},
{"ba", "windows-1251"},
{"be", "windows-1251"},
{"bg", "windows-1251"},
{"cs", "windows-1250"},
{"el", "iso-8859-7"},
{"et", "windows-1257"},
{"fa", "windows-1256"},
{"he", "windows-1255"},
{"hr", "windows-1250"},
{"hu", "iso-8859-2"},
{"ja", "shift_jis"},
{"kk", "windows-1251"},
{"ko", "euc-kr"},
{"ku", "windows-1254"},
{"ky", "windows-1251"},
{"lt", "windows-1257"},
{"lv", "windows-1257"},
{"mk", "windows-1251"},
{"pl", "iso-8859-2"},
{"ru", "windows-1251"},
{"sah", "windows-1251"},
{"sk", "windows-1250"},
{"sl", "iso-8859-2"},
{"sr", "windows-1251"},
{"tg", "windows-1251"},
{"th", "windows-874"},
{"tr", "windows-1254"},
{"tt", "windows-1251"},
{"uk", "windows-1251"},
{"vi", "windows-1258"},
{"zh-hans", "gb18030"},
{"zh-hant", "big5"},
}
| yfermin/cchs | vendor/golang.org/x/text/encoding/htmlindex/gen.go | GO | mit | 4,523 |
.yui3-datatable-scrollable-x{_overflow-x:hidden;_position:relative}.yui3-datatable-scrollable-y,.yui3-datatable-scrollable-y .yui3-datatable-x-scroller{_overflow-y:hidden;_position:relative}.yui3-datatable-y-scroller-container{overflow-x:hidden;position:relative}.yui3-datatable-scrollable-y .yui3-datatable-content{position:relative}.yui3-datatable-scrollable-y .yui3-datatable-table .yui3-datatable-columns{visibility:hidden}.yui3-datatable-scroll-columns{position:absolute;width:100%;z-index:2}.yui3-datatable-y-scroller,.yui3-datatable-scrollable-x .yui3-datatable-caption-table{width:100%}.yui3-datatable-x-scroller{position:relative;overflow-x:scroll;overflow-y:hidden}.yui3-datatable-scrollable-y .yui3-datatable-y-scroller{position:relative;overflow-x:hidden;overflow-y:scroll;z-index:1;-webkit-overflow-scrolling:touch}.yui3-datatable-scrollbar{position:absolute;overflow-x:hidden;overflow-y:scroll;z-index:2}.yui3-datatable-scrollbar div{position:absolute;width:1px;visibility:hidden}.yui3-skin-sam .yui3-datatable-scroll-columns{border-collapse:separate;border-spacing:0;font-family:arial,sans-serif;margin:0;padding:0;top:0;left:0}.yui3-skin-sam .yui3-datatable-scroll-columns .yui3-datatable-header{padding:0}.yui3-skin-sam .yui3-datatable-x-scroller,.yui3-skin-sam .yui3-datatable-y-scroller-container{border:1px solid #cbcbcb}.yui3-skin-sam .yui3-datatable-scrollable-x .yui3-datatable-y-scroller-container,.yui3-skin-sam .yui3-datatable-x-scroller .yui3-datatable-table,.yui3-skin-sam .yui3-datatable-y-scroller .yui3-datatable-table{border:0 none}#yui3-css-stamp.skin-sam-datatable-scroll{display:none}
| jasonpang/cdnjs | ajax/libs/yui/3.5.1/datatable-scroll/assets/skins/sam/datatable-scroll.css | CSS | mit | 1,620 |
/*! File Type parser
* When a file type extension is found, the equivalent name is
* prefixed into the parsed data, so sorting occurs in groups
*/
/*global jQuery: false */
;(function($){
"use strict";
// basic list from http://en.wikipedia.org/wiki/List_of_file_formats
// To add a custom equivalent, define:
// $.tablesorter.fileTypes.equivalents['xx'] = "A|B|C";
$.tablesorter.fileTypes = {
// divides filetype extensions in the equivalent list below
separator : '|',
equivalents : {
"3D Image" : "3dm|3ds|dwg|max|obj",
"Audio" : "aif|aac|ape|flac|la|m4a|mid|midi|mp2|mp3|ogg|ra|raw|rm|wav|wma",
"Compressed" : "7z|bin|cab|cbr|gz|gzip|iso|lha|lz|rar|tar|tgz|zip|zipx|zoo",
"Database" : "csv|dat|db|dbf|json|ldb|mdb|myd|pdb|sql|tsv|wdb|wmdb|xlr|xls|xlsx|xml",
"Development" : "asm|c|class|cls|cpp|cc|cs|cxx|cbp|cs|dba|fla|h|java|lua|pl|py|pyc|pyo|sh|sln|r|rb|vb",
"Document" : "doc|docx|odt|ott|pages|pdf|rtf|tex|wpd|wps|wrd|wri",
"Executable" : "apk|app|com|exe|gadget|lnk|msi",
"Fonts" : "eot|fnt|fon|otf|ttf|woff",
"Icons" : "ani|cur|icns|ico",
"Images" : "bmp|gif|jpg|jpeg|jpe|jp2|pic|png|psd|tga|tif|tiff|wmf|webp",
"Presentation" : "pps|ppt",
"Published" : "chp|epub|lit|pub|ppp|fm|mobi",
"Script" : "as|bat|cgi|cmd|jar|js|lua|scpt|scptd|sh|vbs|vb|wsf",
"Styles" : "css|less|sass",
"Text" : "info|log|md|markdown|nfo|tex|text|txt",
"Vectors" : "awg|ai|eps|cdr|ps|svg",
"Video" : "asf|avi|flv|m4v|mkv|mov|mp4|mpe|mpeg|mpg|ogg|rm|rv|swf|vob|wmv",
"Web" : "asp|aspx|cer|cfm|htm|html|php|url|xhtml"
}
};
$.tablesorter.addParser({
id: 'filetype',
is: function() {
return false;
},
format: function(s, table) {
var t,
c = table.config,
wo = c.widgetOptions,
i = s.lastIndexOf('.'),
sep = $.tablesorter.fileTypes.separator,
m = $.tablesorter.fileTypes.matching,
types = $.tablesorter.fileTypes.equivalents;
if (!m) {
// make a string to "quick" match the existing equivalents
var t = [];
$.each(types, function(i,v){
t.push(v);
});
m = $.tablesorter.fileTypes.matching = sep + t.join(sep) + sep;
}
if (i >= 0) {
t = sep + s.substring(i + 1, s.length) + sep;
if (m.indexOf(t) >= 0) {
for (i in types) {
if ((sep + types[i] + sep).indexOf(t) >= 0) {
return i + (wo.group_separator ? wo.group_separator : '-') + s;
}
}
}
}
return s;
},
type: 'text'
});
})(jQuery);
| peteygao/cdnjs | ajax/libs/jquery.tablesorter/2.18.3/js/parsers/parser-file-type.js | JavaScript | mit | 2,552 |
/*! File Type parser
* When a file type extension is found, the equivalent name is
* prefixed into the parsed data, so sorting occurs in groups
*/
/*global jQuery: false */
;(function($){
"use strict";
// basic list from http://en.wikipedia.org/wiki/List_of_file_formats
// To add a custom equivalent, define:
// $.tablesorter.fileTypes.equivalents['xx'] = "A|B|C";
$.tablesorter.fileTypes = {
// divides filetype extensions in the equivalent list below
separator : '|',
equivalents : {
"3D Image" : "3dm|3ds|dwg|max|obj",
"Audio" : "aif|aac|ape|flac|la|m4a|mid|midi|mp2|mp3|ogg|ra|raw|rm|wav|wma",
"Compressed" : "7z|bin|cab|cbr|gz|gzip|iso|lha|lz|rar|tar|tgz|zip|zipx|zoo",
"Database" : "csv|dat|db|dbf|json|ldb|mdb|myd|pdb|sql|tsv|wdb|wmdb|xlr|xls|xlsx|xml",
"Development" : "asm|c|class|cls|cpp|cc|cs|cxx|cbp|cs|dba|fla|h|java|lua|pl|py|pyc|pyo|sh|sln|r|rb|vb",
"Document" : "doc|docx|odt|ott|pages|pdf|rtf|tex|wpd|wps|wrd|wri",
"Executable" : "apk|app|com|exe|gadget|lnk|msi",
"Fonts" : "eot|fnt|fon|otf|ttf|woff",
"Icons" : "ani|cur|icns|ico",
"Images" : "bmp|gif|jpg|jpeg|jpe|jp2|pic|png|psd|tga|tif|tiff|wmf|webp",
"Presentation" : "pps|ppt",
"Published" : "chp|epub|lit|pub|ppp|fm|mobi",
"Script" : "as|bat|cgi|cmd|jar|js|lua|scpt|scptd|sh|vbs|vb|wsf",
"Styles" : "css|less|sass",
"Text" : "info|log|md|markdown|nfo|tex|text|txt",
"Vectors" : "awg|ai|eps|cdr|ps|svg",
"Video" : "asf|avi|flv|m4v|mkv|mov|mp4|mpe|mpeg|mpg|ogg|rm|rv|swf|vob|wmv",
"Web" : "asp|aspx|cer|cfm|htm|html|php|url|xhtml"
}
};
$.tablesorter.addParser({
id: 'filetype',
is: function() {
return false;
},
format: function(s, table) {
var t,
c = table.config,
wo = c.widgetOptions,
i = s.lastIndexOf('.'),
sep = $.tablesorter.fileTypes.separator,
m = $.tablesorter.fileTypes.matching,
types = $.tablesorter.fileTypes.equivalents;
if (!m) {
// make a string to "quick" match the existing equivalents
var t = [];
$.each(types, function(i,v){
t.push(v);
});
m = $.tablesorter.fileTypes.matching = sep + t.join(sep) + sep;
}
if (i >= 0) {
t = sep + s.substring(i + 1, s.length) + sep;
if (m.indexOf(t) >= 0) {
for (i in types) {
if ((sep + types[i] + sep).indexOf(t) >= 0) {
return i + (wo.group_separator ? wo.group_separator : '-') + s;
}
}
}
}
return s;
},
type: 'text'
});
})(jQuery);
| sparkgeo/cdnjs | ajax/libs/jquery.tablesorter/2.14.2/js/parsers/parser-file-type.js | JavaScript | mit | 2,552 |
/*
Highcharts JS v5.0.4 (2016-11-22)
(c) 2009-2016 Torstein Honsi
License: www.highcharts.com/license
*/
(function(u){"object"===typeof module&&module.exports?module.exports=u:u(Highcharts)})(function(u){(function(q){function u(f,b,a,m,c,e){f=(e-b)*(a-f)-(m-b)*(c-f);return 0<f?!0:0>f?!1:!0}function v(f,b,a,m,c,e,d,l){return u(f,b,c,e,d,l)!==u(a,m,c,e,d,l)&&u(f,b,a,m,c,e)!==u(f,b,a,m,d,l)}function z(f,b,a,m,c,e,d,l){return v(f,b,f+a,b,c,e,d,l)||v(f+a,b,f+a,b+m,c,e,d,l)||v(f,b+m,f+a,b+m,c,e,d,l)||v(f,b,f,b+m,c,e,d,l)}function A(f){var b=this,a=Math.max(q.animObject(b.renderer.globalAnimation).duration,
250),m=!b.hasRendered;f.apply(b,[].slice.call(arguments,1));b.labelSeries=[];clearTimeout(b.seriesLabelTimer);w(b.series,function(c){var e=c.labelBySeries,d=e&&e.closest;c.options.label.enabled&&c.visible&&(c.graph||c.area)&&(b.labelSeries.push(c),m&&(a=Math.max(a,q.animObject(c.options.animation).duration)),d&&(void 0!==d[0].plotX?e.animate({x:d[0].plotX+d[1],y:d[0].plotY+d[2]}):e.attr({opacity:0})))});b.seriesLabelTimer=setTimeout(function(){b.drawSeriesLabels()},a)}var B=q.wrap,w=q.each,D=q.extend,
x=q.isNumber,C=q.Series,E=q.SVGRenderer,y=q.Chart;q.setOptions({plotOptions:{series:{label:{enabled:!0,connectorAllowed:!0,connectorNeighbourDistance:24,styles:{fontWeight:"bold"}}}}});E.prototype.symbols.connector=function(f,b,a,m,c){var e=c&&c.anchorX;c=c&&c.anchorY;var d,l,h=a/2;x(e)&&x(c)&&(d=["M",e,c],l=b-c,0>l&&(l=-m-l),l<a&&(h=e<f+a/2?l:a-l),c>b+m?d.push("L",f+h,b+m):c<b?d.push("L",f+h,b):e<f?d.push("L",f,b+m/2):e>f+a&&d.push("L",f+a,b+m/2));return d||[]};C.prototype.getPointsOnGraph=function(){var f=
this.points,b,a,m=[],c,e,d,l;e=this.graph||this.area;d=e.element;var h=(b=this.chart.inverted)?this.yAxis.pos:this.xAxis.pos,n=b?this.xAxis.pos:this.yAxis.pos;if(this.getPointSpline&&d.getPointAtLength){e.toD&&(a=e.attr("d"),e.attr({d:e.toD}));l=d.getTotalLength();for(c=0;c<l;c+=16)b=d.getPointAtLength(c),m.push({chartX:h+b.x,chartY:n+b.y,plotX:b.x,plotY:b.y});a&&e.attr({d:a});b=f[f.length-1];b.chartX=h+b.plotX;b.chartY=n+b.plotY;m.push(b)}else for(l=f.length,c=0;c<l;c+=1){b=f[c];a=f[c-1];b.chartX=
h+b.plotX;b.chartY=n+b.plotY;if(0<c&&(e=Math.abs(b.chartX-a.chartX),d=Math.abs(b.chartY-a.chartY),e=Math.max(e,d),16<e))for(e=Math.ceil(e/16),d=1;d<e;d+=1)m.push({chartX:a.chartX+d/e*(b.chartX-a.chartX),chartY:a.chartY+d/e*(b.chartY-a.chartY),plotX:a.plotX+d/e*(b.plotX-a.plotX),plotY:a.plotY+d/e*(b.plotY-a.plotY)});x(b.plotY)&&m.push(b)}return m};C.prototype.checkClearPoint=function(f,b,a,m){var c=Number.MAX_VALUE,e=Number.MAX_VALUE,d,l,h=this.options.label.connectorAllowed,n=this.chart,p,g,r,k;for(r=
0;r<n.boxesToAvoid.length;r+=1){g=n.boxesToAvoid[r];k=f+a.width;p=b;var q=b+a.height;if(!(f>g.right||k<g.left||p>g.bottom||q<g.top))return!1}for(r=0;r<n.series.length;r+=1)if(p=n.series[r],g=p.interpolatedPoints,p.visible&&g){for(k=1;k<g.length;k+=1){if(z(f,b,a.width,a.height,g[k-1].chartX,g[k-1].chartY,g[k].chartX,g[k].chartY))return!1;this===p&&!d&&m&&(d=z(f-16,b-16,a.width+32,a.height+32,g[k-1].chartX,g[k-1].chartY,g[k].chartX,g[k].chartY));this!==p&&(c=Math.min(c,Math.pow(f+a.width/2-g[k].chartX,
2)+Math.pow(b+a.height/2-g[k].chartY,2),Math.pow(f-g[k].chartX,2)+Math.pow(b-g[k].chartY,2),Math.pow(f+a.width-g[k].chartX,2)+Math.pow(b-g[k].chartY,2),Math.pow(f+a.width-g[k].chartX,2)+Math.pow(b+a.height-g[k].chartY,2),Math.pow(f-g[k].chartX,2)+Math.pow(b+a.height-g[k].chartY,2)))}if(h&&this===p&&(m&&!d||c<Math.pow(this.options.label.connectorNeighbourDistance,2))){for(k=1;k<g.length;k+=1)d=Math.min(Math.pow(f+a.width/2-g[k].chartX,2)+Math.pow(b+a.height/2-g[k].chartY,2),Math.pow(f-g[k].chartX,
2)+Math.pow(b-g[k].chartY,2),Math.pow(f+a.width-g[k].chartX,2)+Math.pow(b-g[k].chartY,2),Math.pow(f+a.width-g[k].chartX,2)+Math.pow(b+a.height-g[k].chartY,2),Math.pow(f-g[k].chartX,2)+Math.pow(b+a.height-g[k].chartY,2)),d<e&&(e=d,l=g[k]);d=!0}}return!m||d?{x:f,y:b,weight:c-(l?e:0),connectorPoint:l}:!1};y.prototype.drawSeriesLabels=function(){var f=this,b=this.labelSeries;f.boxesToAvoid=[];w(b,function(a){a.interpolatedPoints=a.getPointsOnGraph();w(a.options.label.boxesToAvoid||[],function(a){f.boxesToAvoid.push(a)})});
w(f.series,function(a){function b(a,b,c){return a>g&&a<=g+k-c.width&&b>=r&&b<=r+q-c.height}var c,e,d,l=[],h,n,p=f.inverted,g=p?a.yAxis.pos:a.xAxis.pos,r=p?a.xAxis.pos:a.yAxis.pos,k=f.inverted?a.yAxis.len:a.xAxis.len,q=f.inverted?a.xAxis.len:a.yAxis.len,t=a.interpolatedPoints,p=a.labelBySeries;if(a.visible&&t){p||(a.labelBySeries=p=f.renderer.label(a.name,0,-9999,"connector").css(D({color:a.color},a.options.label.styles)).attr({padding:0,opacity:0,stroke:a.color,"stroke-width":1}).add(a.group).animate({opacity:1},
{duration:200}));c=p.getBBox();c.width=Math.round(c.width);for(n=t.length-1;0<n;--n)e=t[n].chartX+3,d=t[n].chartY-c.height-3,b(e,d,c)&&(h=a.checkClearPoint(e,d,c)),h&&l.push(h),e=t[n].chartX+3,d=t[n].chartY+3,b(e,d,c)&&(h=a.checkClearPoint(e,d,c)),h&&l.push(h),e=t[n].chartX-c.width-3,d=t[n].chartY+3,b(e,d,c)&&(h=a.checkClearPoint(e,d,c)),h&&l.push(h),e=t[n].chartX-c.width-3,d=t[n].chartY-c.height-3,b(e,d,c)&&(h=a.checkClearPoint(e,d,c)),h&&l.push(h);if(!l.length)for(e=g+k-c.width;e>=g;e-=16)for(d=
r;d<r+q-c.height;d+=16)(h=a.checkClearPoint(e,d,c,!0))&&l.push(h);if(l.length){if(l.sort(function(a,b){return b.weight-a.weight}),h=l[0],f.boxesToAvoid.push({left:h.x,right:h.x+c.width,top:h.y,bottom:h.y+c.height}),Math.round(h.x)!==Math.round(p.x)||Math.round(h.y)!==Math.round(p.y))a.labelBySeries.attr({opacity:0,x:h.x-g,y:h.y-r,anchorX:h.connectorPoint&&h.connectorPoint.plotX,anchorY:h.connectorPoint&&h.connectorPoint.plotY}).animate({opacity:1}),a.options.kdNow=!0,a.buildKDTree(),a=a.searchPoint({chartX:h.x,
chartY:h.y},!0),p.closest=[a,h.x-g-a.plotX,h.y-r-a.plotY]}else p&&(a.labelBySeries=p.destroy())}})};B(y.prototype,"render",A);B(y.prototype,"redraw",A)})(u)});
| kennynaoh/cdnjs | ajax/libs/highstock/5.0.4/js/modules/series-label.js | JavaScript | mit | 5,877 |
/*! tableSorter 2.3 widgets - updated 5/11/2012
*
* jQuery UI Theme
* Column Styles
* Column Filters
* Sticky Header
* Column Resizing
* Save Sort
*
*/
;(function($){
// *** Store data in local storage, with a cookie fallback ***
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
if you need it, then include https://github.com/douglascrockford/JSON-js
$.parseJSON is not available is jQuery versions older than 1.4.1, using older
versions will only allow storing information for one page at a time
// *** Save data (JSON format only) ***
// val must be valid JSON... use http://jsonlint.com/ to ensure it is valid
var val = { "mywidget" : "data1" }; // valid JSON uses double quotes
// $.tablesorter.storage(table, key, val);
$.tablesorter.storage(table, 'tablesorter-mywidget', val);
// *** Get data: $.tablesorter.storage(table, key); ***
v = $.tablesorter.storage(table, 'tablesorter-mywidget');
// val may be empty, so also check for your data
val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
alert(val); // "data1" if saved, or "" if not
*/
$.tablesorter.storage = function(table, key, val){
var d, k, ls = false, v = {},
id = table.id || $('.tablesorter').index( $(table) ),
url = window.location.pathname;
try { ls = !!(localStorage.getItem); } catch(e) {}
// *** get val ***
if ($.parseJSON) {
if (ls) {
v = $.parseJSON(localStorage[key]) || {};
} else {
k = document.cookie.split(/[;\s|=]/); // cookie
d = $.inArray(key, k) + 1; // add one to get from the key to the value
v = (d !== 0) ? $.parseJSON(k[d]) || {} : {};
}
}
if (val && JSON && JSON.hasOwnProperty('stringify')) {
// add unique identifiers = url pathname > table ID/index on page > data
if (v[url] && v[url][id]) {
v[url][id] = val;
} else {
if (v[url]) {
v[url][id] = val;
} else {
v[url] = {};
v[url][id] = val;
}
}
// *** set val ***
if (ls) {
localStorage[key] = JSON.stringify(v);
} else {
d = new Date();
d.setTime(d.getTime()+(31536e+6)); // 365 days
document.cookie = key + '=' + (JSON.stringify(v)).replace(/\"/g,'\"') + '; expires=' + d.toGMTString() + '; path=/';
}
} else {
return ( v && v.hasOwnProperty(url) && v[url].hasOwnProperty(id) ) ? v[url][id] : {};
}
};
// Widget: jQuery UI theme
// "uitheme" option in "widgetOptions"
// **************************
$.tablesorter.addWidget({
id: "uitheme",
format: function(table) {
var time, klass, rmv, $t, t, $table = $(table),
c = table.config, wo = c.widgetOptions,
// ["up/down arrow (cssHeaders, unsorted)", "down arrow (cssDesc, descending)", "up arrow (cssAsc, ascending)" ]
icons = ["ui-icon-arrowthick-2-n-s", "ui-icon-arrowthick-1-s", "ui-icon-arrowthick-1-n"];
// keep backwards compatibility, for now
icons = (c.widgetUitheme && c.widgetUitheme.hasOwnProperty('css')) ? c.widgetUitheme.css || icons :
(wo && wo.hasOwnProperty('uitheme')) ? wo.uitheme : icons;
rmv = icons.join(' ');
if (c.debug) {
time = new Date();
}
if (!$table.hasClass('ui-theme')) {
$table.addClass('ui-widget ui-widget-content ui-corner-all ui-theme');
$.each(c.headerList, function(){
$(this)
// using "ui-theme" class in case the user adds their own ui-icon using onRenderHeader
.addClass('ui-widget-header ui-corner-all ui-state-default')
.append('<span class="ui-icon"/>')
.wrapInner('<div class="tablesorter-inner"/>')
.hover(function(){
$(this).addClass('ui-state-hover');
}, function(){
$(this).removeClass('ui-state-hover');
});
});
}
$.each(c.headerList, function(i){
$t = $(this);
if (this.sortDisabled) {
// no sort arrows for disabled columns!
$t.find('span.ui-icon').removeClass(rmv + ' ui-icon');
} else {
klass = ($t.hasClass(c.cssAsc)) ? icons[1] : ($t.hasClass(c.cssDesc)) ? icons[2] : $t.hasClass(c.cssHeader) ? icons[0] : '';
t = ($table.hasClass('hasStickyHeaders')) ? $table.find('tr.' + (wo.stickyHeaders || 'tablesorter-stickyHeader')).find('th').eq(i).add($t) : $t;
t[klass === icons[0] ? 'removeClass' : 'addClass']('ui-state-active')
.find('span.ui-icon').removeClass(rmv).addClass(klass);
}
});
if (c.debug) {
$.tablesorter.benchmark("Applying uitheme widget", time);
}
}
});
// Widget: Column styles
// "columns" option in "widgetOptions"
// **************************
$.tablesorter.addWidget({
id: "columns",
format: function(table) {
var $tr, $td, time, last, rmv, k,
c = table.config,
b = $(table).children('tbody:not(.' + c.cssInfoBlock + ')'),
list = c.sortList,
len = list.length,
css = [ "primary", "secondary", "tertiary" ]; // default options
// keep backwards compatibility, for now
css = (c.widgetColumns && c.widgetColumns.hasOwnProperty('css')) ? c.widgetColumns.css || css :
(c.widgetOptions && c.widgetOptions.hasOwnProperty('columns')) ? c.widgetOptions.columns || css : css;
last = css.length-1;
rmv = css.join(' ');
if (c.debug) {
time = new Date();
}
// check if there is a sort (on initialization there may not be one)
if (list && list[0]) {
for (k = 0; k < b.length; k++ ) {
// loop through the visible rows
$tr = $(b[k]).children('tr:visible');
$tr.each(function(i) {
$td = $(this).children().removeClass(rmv);
// primary sort column class
$td.eq(list[0][0]).addClass(css[0]);
if (len > 1) {
for (i=1; i<len; i++){
// secondary, tertiary, etc sort column classes
$td.eq(list[i][0]).addClass( css[i] || css[last] );
}
}
});
}
} else {
// remove all column classes if sort is cleared (sortReset)
$(table).find('td').removeClass(rmv);
}
if (c.debug) {
$.tablesorter.benchmark("Applying Columns widget", time);
}
}
});
// Widget: Filter
// "filter_startsWith" & "filter_childRows" options in "widgetOptions"
// **************************
$.tablesorter.addWidget({
id: "filter",
format: function(table) {
if (!$(table).hasClass('hasFilters')) {
var i, v, r, t, x, cr, $td, c = table.config,
wo = c.widgetOptions,
css = wo.filter_cssFilter || 'tablesorter-filter',
$t = $(table).addClass('hasFilters'),
cols = c.parsers.length,
fr = '<tr class="' + css + '">',
time;
if (c.debug) {
time = new Date();
}
for (i=0; i < cols; i++){
fr += '<td><input type="search" data-col="' + i + '" class="' + css;
// use header option - headers: { 1: { filter: false } } OR add class="filter-false"
fr += $.tablesorter.getData(c.headerList[i], c.headers[i], 'filter') === 'false' ? ' disabled" disabled' : '"';
fr += '></td>';
}
$t
.find('thead').eq(0).append(fr += '</tr>')
.find('input.' + css).bind('keyup search', function(e){
v = $t.find('thead').eq(0).children('tr').find('input.' + css).map(function(){ return ($(this).val() || '').toLowerCase(); }).get();
if (v.join('') === '') {
$t.find('tr').show();
} else {
$t.children('tbody:not(.' + c.cssInfoBlock + ')').children('tr:not(.' + c.cssChildRow + ')').each(function(){
r = true;
cr = $(this).nextUntil('tr:not(.' + c.cssChildRow + ')');
// so, if "table.config.widgetOptions.filter_childRows" is true and there is
// a match anywhere in the child row, then it will make the row visible
// checked here so the option can be changed dynamically
t = (cr.length && (wo && wo.hasOwnProperty('filter_childRows') &&
typeof wo.filter_childRows !== 'undefined' ? wo.filter_childRows : true)) ? cr.text() : '';
$td = $(this).children('td');
for (i=0; i < cols; i++){
x = $.trim(($td.eq(i).text() + t)).toLowerCase().indexOf(v[i]);
if (v[i] !== '' && ( (!wo.filter_startsWith && x >= 0) || (wo.filter_startsWith && x === 0) ) ) {
r = (r) ? true : false;
} else if (v[i] !== '') {
r = false;
}
}
$(this)[r ? 'show' : 'hide']();
if (cr.length) { cr[r ? 'show' : 'hide'](); }
});
}
$t.trigger('applyWidgets'); // make sure zebra widget is applied
});
if (c.debug) {
$.tablesorter.benchmark("Applying Filter widget", time);
}
}
}
});
// Widget: Sticky headers
// based on this awesome article:
// http://css-tricks.com/13465-persistent-headers/
// **************************
$.tablesorter.addWidget({
id: "stickyHeaders",
format: function(table) {
if ($(table).hasClass('hasStickyHeaders')) { return; }
var $table = $(table).addClass('hasStickyHeaders'),
wo = table.config.widgetOptions,
win = $(window),
header = $(table).children('thead'),
hdrCells = header.children('tr:not(.sticky-false)').children(),
css = wo.stickyHeaders || 'tablesorter-stickyHeader',
innr = '.tablesorter-header-inner',
firstCell = hdrCells.eq(0),
tfoot = $table.find('tfoot'),
sticky = header.find('tr.tablesorter-header:not(.sticky-false)').clone()
.removeClass('tablesorter-header')
.addClass(css)
.css({
width : header.outerWidth(true),
position : 'fixed',
left : firstCell.offset().left,
margin : 0,
top : 0,
visibility : 'hidden',
zIndex : 10
}),
stkyCells = sticky.children(),
laststate = '';
// update sticky header class names to match real header after sorting
$table.bind('sortEnd', function(e,t){
var th = $(t).find('thead tr'),
sh = th.filter('.' + css).children();
th.filter(':not(.' + css + ')').children().each(function(i){
sh.eq(i).attr('class', $(this).attr('class'));
});
}).bind('pagerComplete', function(){
win.resize(); // trigger window resize to make sure column widths & position are correct
});
// set sticky header cell width and link clicks to real header
hdrCells.each(function(i){
var t = $(this),
s = stkyCells.eq(i)
// clicking on sticky will trigger sort
.bind('click', function(e){
t.trigger(e);
})
// prevent sticky header text selection
.bind('mousedown', function(){
this.onselectstart = function(){ return false; };
return false;
})
// set cell widths
.find(innr).width( t.find(innr).width() );
});
header.prepend( sticky );
// make it sticky!
win
.scroll(function(){
var offset = firstCell.offset(),
sTop = win.scrollTop(),
tableHt = $table.height() - (firstCell.height() + (tfoot.height() || 0)),
vis = (sTop > offset.top) && (sTop < offset.top + tableHt) ? 'visible' : 'hidden';
sticky.css({
left : offset.left - win.scrollLeft(),
visibility : vis
});
if (vis !== laststate) {
// trigger resize to make sure the column widths match
win.resize();
laststate = vis;
}
})
.resize(function(){
var ht = 0;
sticky.css({
left : firstCell.offset().left - win.scrollLeft(),
width: header.outerWidth()
}).each(function(i){
$(this).css('top', ht);
ht += header.find('tr').eq(i).outerHeight();
});
stkyCells.find(innr).each(function(i){
$(this).width( hdrCells.eq(i).find(innr).width() );
});
});
}
});
// Add Column resizing widget
// this widget saves the column widths if
// $.tablesorter.storage function is included
// **************************
$.tablesorter.addWidget({
id: "resizable",
format: function(table) {
if ($(table).hasClass('hasResizable')) { return; }
$(table).addClass('hasResizable');
var i, j, w, s, c = table.config,
$cols = $(c.headerList).filter(':gt(0)'),
position = 0,
$target = null,
$prev = null,
len = $cols.length,
stopResize = function(){
position = 0;
$target = $prev = null;
$(window).trigger('resize'); // will update stickyHeaders, just in case
};
s = ($.tablesorter.storage) ? $.tablesorter.storage(table, 'tablesorter-resizable') : '';
// process only if table ID or url match
if (s) {
for (j in s) {
if (!isNaN(j) && j < c.headerList.length) {
$(c.headerList[j]).width(s[j]); // set saved resizable widths
}
}
}
$cols
.each(function(){
$(this)
.append('<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;height:100%;width:20px;left:-20px;top:0;z-index:1;"></div>')
.wrapInner('<div style="position:relative;height:100%;width:100%"></div>');
})
.bind('mousemove', function(e){
// ignore mousemove if no mousedown
if (position === 0 || !$target) { return; }
var w = e.pageX - position,
n = $prev;
// make sure
if ( $target.width() < -w || ( $prev && $prev.width() <= w )) { return; }
// resize current column
$prev.width( $prev.width() + w );
position = e.pageX;
})
.bind('mouseup', function(){
if (s && $.tablesorter.storage && $target) {
s[$prev.index()] = $prev.width();
$.tablesorter.storage(table, 'tablesorter-resizable', s);
}
stopResize();
return false;
})
.find('.tablesorter-resizer')
.bind('mousedown', function(e){
// save header cell and mouse position
$target = $(e.target).closest('th');
$prev = $target.prev();
position = e.pageX;
});
$(table).find('thead').bind('mouseup mouseleave', function(){
stopResize();
});
}
});
// Save table sort widget
// this widget saves the last sort only if the
// $.tablesorter.storage function is included
// **************************
$.tablesorter.addWidget({
id: 'saveSort',
init: function(table, allWidgets, thisWidget){
// run widget format before all other widgets are applied to the table
thisWidget.format(table, true);
},
format: function(table, init) {
var n, d, k, sl, time, c = table.config, sortList = { "sortList" : c.sortList };
if (c.debug) {
time = new Date();
}
if ($(table).hasClass('hasSaveSort')) {
if (table.hasInitialized && $.tablesorter.storage) {
$.tablesorter.storage( table, 'tablesorter-savesort', sortList );
if (c.debug) {
$.tablesorter.benchmark('saveSort widget: Saving last sort: ' + c.sortList, time);
}
}
} else {
// set table sort on initial run of the widget
$(table).addClass('hasSaveSort');
sortList = '';
// get data
if ($.tablesorter.storage) {
sl = $.tablesorter.storage( table, 'tablesorter-savesort' );
sortList = (sl && sl.hasOwnProperty('sortList') && $.isArray(sl.sortList)) ? sl.sortList : '';
if (c.debug) {
$.tablesorter.benchmark('saveSort: Last sort loaded: ' + sortList, time);
}
}
// init is true when widget init is run, this will run this widget before all other widgets have initialized
// this method allows using this widget in the original tablesorter plugin; but then it will run all widgets twice.
if (init && sortList && sortList.length > 0) {
c.sortList = sortList;
} else if (table.hasInitialized && sortList && sortList.length > 0) {
// update sort change
$(table).trigger('sorton', [sortList]);
}
}
}
});
})(jQuery); | mathiasrw/cdnjs | ajax/libs/jquery.tablesorter/2.3.2/js/jquery.tablesorter.widgets.js | JavaScript | mit | 14,933 |
/*!
* tablesorter pager plugin
* updated 12/19/2012
*/
/*jshint browser:true, jquery:true, unused:false */
;(function($) {
"use strict";
/*jshint supernew:true */
$.extend({ tablesorterPager: new function() {
this.defaults = {
// target the pager markup
container: null,
// use this format: "http://mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}"
// where {page} is replaced by the page number, {size} is replaced by the number of records to show,
// {sortList:col} adds the sortList to the url into a "col" array, and {filterList:fcol} adds
// the filterList to the url into an "fcol" array.
// So a sortList = [[2,0],[3,0]] becomes "&col[2]=0&col[3]=0" in the url
// and a filterList = [[2,Blue],[3,13]] becomes "&fcol[2]=Blue&fcol[3]=13" in the url
ajaxUrl: null,
// process ajax so that the following information is returned:
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
// example:
// [
// 100, // total rows
// [
// [ "row1cell1", "row1cell2", ... "row1cellN" ],
// [ "row2cell1", "row2cell2", ... "row2cellN" ],
// ...
// [ "rowNcell1", "rowNcell2", ... "rowNcellN" ]
// ],
// [ "header1", "header2", ... "headerN" ] // optional
// ]
ajaxProcessing: function(ajax){ return [ 0, [], null ]; },
// output default: '{page}/{totalPages}'
// possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
output: '{startRow} to {endRow} of {totalRows} rows', // '{page}/{totalPages}'
// apply disabled classname to the pager arrows when the rows at either extreme is visible
updateArrows: true,
// starting page of the pager (zero based index)
page: 0,
// Number of visible rows
size: 10,
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
// table row set to a height to compensate; default is false
fixedHeight: false,
// remove rows from the table to speed up the sort of large tables.
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
removeRows: false, // removing rows in larger tables speeds up the sort
// css class names of pager arrows
cssFirst: '.first', // go to first page arrow
cssPrev: '.prev', // previous page arrow
cssNext: '.next', // next page arrow
cssLast: '.last', // go to last page arrow
cssGoto: '.gotoPage', // go to page selector - select dropdown that sets the current page
cssPageDisplay: '.pagedisplay', // location of where the "output" is displayed
cssPageSize: '.pagesize', // page size selector - select dropdown that sets the "size" option
cssErrorRow: 'tablesorter-errorRow', // error information row
// class added to arrows when at the extremes (i.e. prev/first arrows are "disabled" when on the first page)
cssDisabled: 'disabled', // Note there is no period "." in front of this class name
// stuff not set by the user
totalRows: 0,
totalPages: 0,
filteredRows: 0,
filteredPages: 0
};
var $this = this,
// hide arrows at extremes
pagerArrows = function(c, disable) {
var a = 'addClass',
r = 'removeClass',
d = c.cssDisabled,
dis = !!disable,
tp = Math.min( c.totalPages, c.filteredPages );
if ( c.updateArrows ) {
$(c.cssFirst + ',' + c.cssPrev, c.container)[ ( dis || c.page === 0 ) ? a : r ](d);
$(c.cssNext + ',' + c.cssLast, c.container)[ ( dis || c.page === tp - 1 ) ? a : r ](d);
}
},
updatePageDisplay = function(table, c) {
var i, p, s, t, out, f = $(table).hasClass('hasFilters') && !c.ajaxUrl;
c.filteredRows = (f) ? $(table).find('tbody tr:not(.filtered)').length : c.totalRows;
c.filteredPages = (f) ? Math.ceil( c.filteredRows / c.size ) : c.totalPages;
if ( Math.min( c.totalPages, c.filteredPages ) > 0 ) {
t = (c.size * c.page > c.filteredRows);
c.startRow = (t) ? 1 : ( c.size * c.page ) + 1;
c.page = (t) ? 0 : c.page;
c.endRow = Math.min( c.filteredRows, c.totalRows, c.size * ( c.page + 1 ) );
out = $(c.cssPageDisplay, c.container);
// form the output string
s = c.output.replace(/\{(page|filteredRows|filteredPages|totalPages|startRow|endRow|totalRows)\}/gi, function(m){
return {
'{page}' : c.page + 1,
'{filteredRows}' : c.filteredRows,
'{filteredPages}' : c.filteredPages,
'{totalPages}' : c.totalPages,
'{startRow}' : c.startRow,
'{endRow}' : c.endRow,
'{totalRows}' : c.totalRows
}[m];
});
if (out[0]) {
out[ (out[0].tagName === 'INPUT') ? 'val' : 'html' ](s);
if ( $(c.cssGoto, c.container).length ) {
t = '';
p = Math.min( c.totalPages, c.filteredPages );
for ( i = 1; i <= p; i++ ) {
t += '<option>' + i + '</option>';
}
$(c.cssGoto, c.container).html(t).val(c.page + 1);
}
}
}
pagerArrows(c);
if (c.initialized) { $(table).trigger('pagerComplete', c); }
},
fixHeight = function(table, c) {
var d, h, $b = $(table.tBodies[0]);
if (c.fixedHeight) {
$b.find('tr.pagerSavedHeightSpacer').remove();
h = $.data(table, 'pagerSavedHeight');
if (h) {
d = h - $b.height();
if ( d > 5 && $.data(table, 'pagerLastSize') === c.size && $b.children('tr:visible').length < c.size ) {
$b.append('<tr class="pagerSavedHeightSpacer remove-me" style="height:' + d + 'px;"></tr>');
}
}
}
},
changeHeight = function(table, c) {
var $b = $(table.tBodies[0]);
$b.find('tr.pagerSavedHeightSpacer').remove();
$.data(table, 'pagerSavedHeight', $b.height());
fixHeight(table, c);
$.data(table, 'pagerLastSize', c.size);
},
hideRows = function(table, c){
if (!c.ajaxUrl) {
var i,
rows = $(table.tBodies).children('tr:not(.' + table.config.cssChildRow + ')'),
l = rows.length,
s = ( c.page * c.size ),
e = s + c.size,
j = 0; // size counter
for ( i = 0; i < l; i++ ){
if (!/filtered/.test(rows[i].className)) {
rows[i].style.display = ( j >= s && j < e ) ? '' : 'none';
j++;
}
}
}
},
hideRowsSetup = function(table, c){
c.size = parseInt( $(c.cssPageSize, c.container).find('option[selected]').val(), 10 ) || c.size;
$.data(table, 'pagerLastSize', c.size);
pagerArrows(c);
if ( !c.removeRows ) {
hideRows(table, c);
$(table).bind('sortEnd.pager filterEnd.pager', function(){
hideRows(table, c);
});
}
},
renderAjax = function(data, table, c, exception){
// process data
if ( typeof(c.ajaxProcessing) === "function" ) {
// ajaxProcessing result: [ total, rows, headers ]
var i, j, hsh, $f, $sh,
$t = $(table),
tc = table.config,
$b = $(table.tBodies).filter(':not(.' + tc.cssInfoBlock + ')'),
hl = $t.find('thead th').length, tds = '',
err = '<tr class="' + c.cssErrorRow + ' ' + tc.selectorRemove + '"><td style="text-align: center;" colspan="' + hl + '">' +
(exception ? exception.message + ' (' + exception.name + ')' : 'No rows found') + '</td></tr>',
result = c.ajaxProcessing(data) || [ 0, [] ],
d = result[1] || [],
l = d.length,
th = result[2];
if ( l > 0 ) {
for ( i = 0; i < l; i++ ) {
tds += '<tr>';
for ( j = 0; j < d[i].length; j++ ) {
// build tbody cells
tds += '<td>' + d[i][j] + '</td>';
}
tds += '</tr>';
}
}
// only add new header text if the length matches
if ( th && th.length === hl ) {
hsh = $t.hasClass('hasStickyHeaders');
$sh = $t.find('.' + ((tc.widgetOptions && tc.widgetOptions.stickyHeaders) || 'tablesorter-stickyheader'));
$f = $t.find('tfoot tr:first').children();
$t.find('th.' + tc.cssHeader).each(function(j){
var $t = $(this), icn;
// add new test within the first span it finds, or just in the header
if ( $t.find('.' + tc.cssIcon).length ) {
icn = $t.find('.' + tc.cssIcon).clone(true);
$t.find('.tablesorter-header-inner').html( th[j] ).append(icn);
if ( hsh && $sh.length ) {
icn = $sh.find('th').eq(j).find('.' + tc.cssIcon).clone(true);
$sh.find('th').eq(j).find('.tablesorter-header-inner').html( th[j] ).append(icn);
}
} else {
$t.find('.tablesorter-header-inner').html( th[j] );
$sh.find('th').eq(j).find('.tablesorter-header-inner').html( th[j] );
}
$f.eq(j).html( th[j] );
});
}
$t.find('thead tr.' + c.cssErrorRow).remove(); // Clean up any previous error.
if ( exception ) {
// add error row to thead instead of tbody, or clicking on the header will result in a parser error
$t.find('thead').append(err);
} else {
$b.html( tds ); // add tbody
}
if (tc.showProcessing) {
$.tablesorter.isProcessing(table); // remove loading icon
}
$t.trigger('update');
c.totalRows = result[0] || 0;
c.totalPages = Math.ceil( c.totalRows / c.size );
updatePageDisplay(table, c);
fixHeight(table, c);
if (c.initialized) { $t.trigger('pagerChange', c); }
}
if (!c.initialized) {
c.initialized = true;
$(table).trigger('pagerInitialized', c);
}
},
getAjax = function(table, c){
var url = getAjaxUrl(table, c),
tc = table.config;
if ( url !== '' ) {
if (tc.showProcessing) {
$.tablesorter.isProcessing(table, true); // show loading icon
}
$(document).bind('ajaxError.pager', function(e, xhr, settings, exception) {
if (settings.url === url) {
renderAjax(null, table, c, exception);
$(document).unbind('ajaxError.pager');
}
});
$.getJSON(url, function(data) {
renderAjax(data, table, c);
$(document).unbind('ajaxError.pager');
});
}
},
getAjaxUrl = function(table, c) {
var url = (c.ajaxUrl) ? c.ajaxUrl.replace(/\{page\}/g, c.page).replace(/\{size\}/g, c.size) : '',
sl = table.config.sortList,
fl = c.currentFilters || [],
sortCol = url.match(/\{sortList[\s+]?:[\s+]?([^}]*)\}/),
filterCol = url.match(/\{filterList[\s+]?:[\s+]?([^}]*)\}/),
arry = [];
if (sortCol) {
sortCol = sortCol[1];
$.each(sl, function(i,v){
arry.push(sortCol + '[' + v[0] + ']=' + v[1]);
});
// if the arry is empty, just add the col parameter... "&{sortList:col}" becomes "&col"
url = url.replace(/\{sortList[\s+]?:[\s+]?([^\}]*)\}/g, arry.length ? arry.join('&') : sortCol );
}
if (filterCol) {
filterCol = filterCol[1];
$.each(fl, function(i,v){
if (v) {
arry.push(filterCol + '[' + i + ']=' + encodeURIComponent(v));
}
});
// if the arry is empty, just add the fcol parameter... "&{filterList:fcol}" becomes "&fcol"
url = url.replace(/\{filterList[\s+]?:[\s+]?([^\}]*)\}/g, arry.length ? arry.join('&') : filterCol );
}
return url;
},
renderTable = function(table, rows, c) {
var i, j, o,
f = document.createDocumentFragment(),
l = rows.length,
s = ( c.page * c.size ),
e = ( s + c.size );
if ( l < 1 ) { return; } // empty table, abort!
if (c.initialized) { $(table).trigger('pagerChange', c); }
if ( !c.removeRows ) {
hideRows(table, c);
} else {
if ( e > rows.length ) {
e = rows.length;
}
$(table.tBodies[0]).addClass('tablesorter-hidden');
$.tablesorter.clearTableBody(table);
for ( i = s; i < e; i++ ) {
o = rows[i];
l = o.length;
for ( j = 0; j < l; j++ ) {
f.appendChild(o[j]);
}
}
table.tBodies[0].appendChild(f);
$(table.tBodies[0]).removeClass('tablesorter-hidden');
}
if ( c.page >= c.totalPages ) {
moveToLastPage(table, c);
}
updatePageDisplay(table, c);
if ( !c.isDisabled ) { fixHeight(table, c); }
$(table).trigger('applyWidgets');
},
showAllRows = function(table, c){
if ( c.ajax ) {
pagerArrows(c, true);
} else {
c.isDisabled = true;
$.data(table, 'pagerLastPage', c.page);
$.data(table, 'pagerLastSize', c.size);
c.page = 0;
c.size = c.totalRows;
c.totalPages = 1;
$('tr.pagerSavedHeightSpacer', table.tBodies[0]).remove();
renderTable(table, table.config.rowsCopy, c);
}
// disable size selector
$(c.container).find(c.cssPageSize + ',' + c.cssGoto).each(function(){
$(this).addClass(c.cssDisabled)[0].disabled = true;
});
},
moveToPage = function(table, c) {
if ( c.isDisabled ) { return; }
var p = Math.min( c.totalPages, c.filteredPages );
if ( c.page < 0 || c.page > ( p - 1 ) ) {
c.page = 0;
}
if (c.ajax) {
getAjax(table, c);
} else if (!c.ajax) {
renderTable(table, table.config.rowsCopy, c);
}
$.data(table, 'pagerLastPage', c.page);
$.data(table, 'pagerUpdateTriggered', true);
if (c.initialized) { $(table).trigger('pageMoved', c); }
},
setPageSize = function(table, size, c) {
c.size = size;
$.data(table, 'pagerLastPage', c.page);
$.data(table, 'pagerLastSize', c.size);
c.totalPages = Math.ceil( c.totalRows / c.size );
moveToPage(table, c);
},
moveToFirstPage = function(table, c) {
c.page = 0;
moveToPage(table, c);
},
moveToLastPage = function(table, c) {
c.page = ( Math.min( c.totalPages, c.filteredPages ) - 1 );
moveToPage(table, c);
},
moveToNextPage = function(table, c) {
c.page++;
if ( c.page >= ( Math.min( c.totalPages, c.filteredPages ) - 1 ) ) {
c.page = ( Math.min( c.totalPages, c.filteredPages ) - 1 );
}
moveToPage(table, c);
},
moveToPrevPage = function(table, c) {
c.page--;
if ( c.page <= 0 ) {
c.page = 0;
}
moveToPage(table, c);
},
destroyPager = function(table, c){
showAllRows(table, c);
$(c.container).hide(); // hide pager
table.config.appender = null; // remove pager appender function
$(table).unbind('destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager');
},
enablePager = function(table, c, triggered){
var p = $(c.cssPageSize, c.container).removeClass(c.cssDisabled).removeAttr('disabled');
$(c.container).find(c.cssGoto).removeClass(c.cssDisabled).removeAttr('disabled');
c.isDisabled = false;
c.page = $.data(table, 'pagerLastPage') || c.page || 0;
c.size = $.data(table, 'pagerLastSize') || parseInt(p.find('option[selected]').val(), 10) || c.size;
p.val(c.size); // set page size
c.totalPages = Math.ceil( Math.min( c.totalPages, c.filteredPages ) / c.size);
if ( triggered ) {
$(table).trigger('update');
setPageSize(table, c.size, c);
hideRowsSetup(table, c);
fixHeight(table, c);
}
};
$this.appender = function(table, rows) {
var c = table.config.pager;
if ( !c.ajax ) {
table.config.rowsCopy = rows;
c.totalRows = rows.length;
c.size = $.data(table, 'pagerLastSize') || c.size;
c.totalPages = Math.ceil(c.totalRows / c.size);
renderTable(table, rows, c);
}
};
$this.construct = function(settings) {
return this.each(function() {
// check if tablesorter has initialized
if (!(this.config && this.hasInitialized)) { return; }
var t, ctrls, fxn,
config = this.config,
c = config.pager = $.extend( {}, $.tablesorterPager.defaults, settings ),
table = this,
tc = table.config,
$t = $(table),
pager = $(c.container).addClass('tablesorter-pager').show(); // added in case the pager is reinitialized after being destroyed.
config.appender = $this.appender;
$t
.unbind('filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager')
.bind('filterStart.pager', function(e, filters) {
c.currentFilters = filters;
})
// update pager after filter widget completes
.bind('filterEnd.pager sortEnd.pager', function() {
//Prevent infinite event loops from occuring by setting this in all moveToPage calls and catching it here.
if ($.data(table, 'pagerUpdateTriggered')) {
$.data(table, 'pagerUpdateTriggered', false);
return;
}
c.page = 0;
updatePageDisplay(table, c);
moveToPage(table, c);
changeHeight(table, c);
})
.bind('disable.pager', function(){
showAllRows(table, c);
})
.bind('enable.pager', function(){
enablePager(table, c, true);
})
.bind('destroy.pager', function(){
destroyPager(table, c);
})
.bind('update.pager', function(){
hideRows(table, c);
});
// clicked controls
ctrls = [c.cssFirst, c.cssPrev, c.cssNext, c.cssLast];
fxn = [ moveToFirstPage, moveToPrevPage, moveToNextPage, moveToLastPage ];
pager.find(ctrls.join(','))
.unbind('click.pager')
.bind('click.pager', function(e){
var i, $this = $(this), l = ctrls.length;
if ( !$this.hasClass(c.cssDisabled) ) {
for (i = 0; i < l; i++) {
if ($this.is(ctrls[i])) {
fxn[i](table, c);
break;
}
}
}
return false;
});
// goto selector
if ( pager.find(c.cssGoto).length ) {
pager.find(c.cssGoto)
.unbind('change')
.bind('change', function(){
c.page = $(this).val() - 1;
moveToPage(table, c);
});
updatePageDisplay(table, c);
}
// page size selector
t = pager.find(c.cssPageSize);
if ( t.length ) {
t.unbind('change.pager').bind('change.pager', function() {
t.val( $(this).val() ); // in case there are more than one pagers
if ( !$(this).hasClass(c.cssDisabled) ) {
setPageSize(table, parseInt( $(this).val(), 10 ), c);
changeHeight(table, c);
}
return false;
});
}
// clear initialized flag
c.initialized = false;
// before initialization event
$t.trigger('pagerBeforeInitialized', c);
enablePager(table, c, false);
if ( typeof(c.ajaxUrl) === 'string' ) {
// ajax pager; interact with database
c.ajax = true;
//When filtering with ajax, allow only custom filtering function, disable default filtering since it will be done server side.
tc.widgetOptions.filter_serversideFiltering = true;
tc.serverSideSorting = true;
getAjax(table, c);
} else {
c.ajax = false;
// Regular pager; all rows stored in memory
$(this).trigger("appendCache", true);
hideRowsSetup(table, c);
}
// pager initialized
if (!c.ajax) {
c.initialized = true;
$(table).trigger('pagerInitialized', c);
}
});
};
}()
});
// extend plugin scope
$.fn.extend({
tablesorterPager: $.tablesorterPager.construct
});
})(jQuery); | ruslanas/cdnjs | ajax/libs/jquery.tablesorter/2.6.1/addons/pager/jquery.tablesorter.pager.js | JavaScript | mit | 18,708 |
/*!
* TableSorter 2.8.0 min - Client-side table sorting with ease!
* Copyright (c) 2007 Christian Bach
*/
!function(g){g.extend({tablesorter:new function(){function d(c){"undefined"!==typeof console&&"undefined"!==typeof console.log?console.log(c):alert(c)}function w(c,b){d(c+" ("+((new Date).getTime()-b.getTime())+"ms)")}function r(c,b,a){if(!b)return"";var e=c.config,d=e.textExtraction,j="",j="simple"===d?e.supportsTextContent?b.textContent:g(b).text():"function"===typeof d?d(b,c,a):"object"===typeof d&&d.hasOwnProperty(a)?d[a](b,c,a):e.supportsTextContent?b.textContent:g(b).text();return g.trim(j)} function l(c){var b=c.config,a=b.$tbodies=b.$table.children("tbody:not(."+b.cssInfoBlock+")"),e,t,j,h,k,p,m="";if(0===a.length)return b.debug?d("*Empty table!* Not building a parser cache"):"";a=a[0].rows;if(a[0]){e=[];t=a[0].cells.length;for(j=0;j<t;j++){h=b.$headers.filter(":not([colspan])");h=h.add(b.$headers.filter('[colspan="1"]')).filter('[data-column="'+j+'"]:last');k=b.headers[j];p=f.getParserById(f.getData(h,k,"sorter"));b.empties[j]=f.getData(h,k,"empty")||b.emptyTo||(b.emptyToBottom?"bottom": "top");b.strings[j]=f.getData(h,k,"string")||b.stringTo||"max";if(!p)a:{h=c;k=a;p=-1;for(var g=j,n=void 0,w=f.parsers.length,F=!1,C="",n=!0;""===C&&n;)p++,k[p]?(F=k[p].cells[g],C=r(h,F,g),h.config.debug&&d("Checking if value was empty on row "+p+", column: "+g+': "'+C+'"')):n=!1;for(;0<=--w;)if((n=f.parsers[w])&&"text"!==n.id&&n.is&&n.is(C,h,F)){p=n;break a}p=f.getParserById("text")}b.debug&&(m+="column:"+j+"; parser:"+p.id+"; string:"+b.strings[j]+"; empty: "+b.empties[j]+"\n");e.push(p)}}b.debug&& d(m);b.parsers=e}function s(c){var b=c.tBodies,a=c.config,e,t,j=a.parsers,h,k,p,m,q,n,G,l=[];a.cache={};if(!j)return a.debug?d("*Empty table!* Not building a cache"):"";a.debug&&(G=new Date);a.showProcessing&&f.isProcessing(c,!0);for(m=0;m<b.length;m++)if(a.cache[m]={row:[],normalized:[]},!g(b[m]).hasClass(a.cssInfoBlock)){e=b[m]&&b[m].rows.length||0;t=b[m].rows[0]&&b[m].rows[0].cells.length||0;for(k=0;k<e;++k)if(q=g(b[m].rows[k]),n=[],q.hasClass(a.cssChildRow))a.cache[m].row[a.cache[m].row.length- 1]=a.cache[m].row[a.cache[m].row.length-1].add(q);else{a.cache[m].row.push(q);for(p=0;p<t;++p)if(h=r(c,q[0].cells[p],p),h=j[p].format(h,c,q[0].cells[p],p),n.push(h),"numeric"===(j[p].type||"").toLowerCase())l[p]=Math.max(Math.abs(h),l[p]||0);n.push(a.cache[m].normalized.length);a.cache[m].normalized.push(n)}a.cache[m].colMax=l}a.showProcessing&&f.isProcessing(c);a.debug&&w("Building cache for "+e+" rows",G)}function v(c,b){var a=c.config,e=c.tBodies,d=[],j=a.cache,h,k,p,m,q,n,l,r,C,s,v;if(j[0]){a.debug&& (v=new Date);for(r=0;r<e.length;r++)if(h=g(e[r]),h.length&&!h.hasClass(a.cssInfoBlock)){q=f.processTbody(c,h,!0);h=j[r].row;k=j[r].normalized;m=(p=k.length)?k[0].length-1:0;for(n=0;n<p;n++)if(s=k[n][m],d.push(h[s]),!a.appender||!a.removeRows){C=h[s].length;for(l=0;l<C;l++)q.append(h[s][l])}f.processTbody(c,q,!1)}a.appender&&a.appender(c,d);a.debug&&w("Rebuilt table",v);b||f.applyWidget(c);g(c).trigger("sortEnd",c)}}function z(c){var b=[],a={},e=0,t=g(c).find("thead:eq(0), tfoot").children("tr"),j, h,k,p,m,q,n,l,r,s;for(j=0;j<t.length;j++){m=t[j].cells;for(h=0;h<m.length;h++){p=m[h];q=p.parentNode.rowIndex;n=q+"-"+p.cellIndex;l=p.rowSpan||1;r=p.colSpan||1;"undefined"===typeof b[q]&&(b[q]=[]);for(k=0;k<b[q].length+1;k++)if("undefined"===typeof b[q][k]){s=k;break}a[n]=s;e=Math.max(s,e);g(p).attr({"data-column":s});for(k=q;k<q+l;k++){"undefined"===typeof b[k]&&(b[k]=[]);n=b[k];for(p=s;p<s+r;p++)n[p]="x"}}}c.config.columns=e;var v,u,z,B,A,y,D,x=c.config;x.headerList=[];x.headerContent=[];x.debug&& (D=new Date);B=x.cssIcon?'<i class="'+x.cssIcon+'"></i>':"";x.$headers=g(c).find(x.selectorHeaders).each(function(c){u=g(this);v=x.headers[c];x.headerContent[c]=this.innerHTML;A=x.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,B);x.onRenderTemplate&&(z=x.onRenderTemplate.apply(u,[c,A]))&&"string"===typeof z&&(A=z);this.innerHTML='<div class="tablesorter-header-inner">'+A+"</div>";x.onRenderHeader&&x.onRenderHeader.apply(u,[c]);this.column=a[this.parentNode.rowIndex+"-"+ this.cellIndex];var b=f.getData(u,v,"sortInitialOrder")||x.sortInitialOrder;this.order=/^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder=!1;y=f.getData(u,v,"lockedOrder")||!1;"undefined"!==typeof y&&!1!==y&&(this.order=this.lockedOrder=/^d/i.test(y)||1===y?[1,1,1]:[0,0,0]);u.addClass(x.cssHeader);x.headerList[c]=this;u.parent().addClass(x.cssHeaderRow)});E(c);x.debug&&(w("Built headers:",D),d(x.$headers))}function A(c,b,a){var e=g(c);e.find(c.config.selectorRemove).remove();l(c); s(c);D(e,b,a)}function E(c){var b,a=c.config;a.$headers.each(function(c,d){b="false"===f.getData(d,a.headers[c],"sorter");d.sortDisabled=b;g(d)[b?"addClass":"removeClass"]("sorter-false")})}function y(c){var b,a,e,d=c.config,j=d.sortList,h=[d.cssAsc,d.cssDesc],k=g(c).find("tfoot tr").children().removeClass(h.join(" "));d.$headers.removeClass(h.join(" "));e=j.length;for(b=0;b<e;b++)if(2!==j[b][1]&&(c=d.$headers.not(".sorter-false").filter('[data-column="'+j[b][0]+'"]'+(1===e?":last":"")),c.length))for(a= 0;a<c.length;a++)c[a].sortDisabled||(c.eq(a).addClass(h[j[b][1]]),k.length&&k.filter('[data-column="'+j[b][0]+'"]').eq(a).addClass(h[j[b][1]]))}function B(c){var b=0,a=c.config,e=a.sortList,d=e.length,j=c.tBodies.length,h,k,f,m,q,n,l,r,s;if(!a.serverSideSorting&&a.cache[0]){a.debug&&(h=new Date);for(f=0;f<j;f++)q=a.cache[f].colMax,s=(n=a.cache[f].normalized)&&n[0]?n[0].length-1:0,n.sort(function(j,h){for(k=0;k<d;k++){m=e[k][0];r=e[k][1];l=/n/i.test(a.parsers&&a.parsers[m]?a.parsers[m].type||"":"")? "Numeric":"Text";l+=0===r?"":"Desc";/Numeric/.test(l)&&a.strings[m]&&(b="boolean"===typeof a.string[a.strings[m]]?(0===r?1:-1)*(a.string[a.strings[m]]?-1:1):a.strings[m]?a.string[a.strings[m]]||0:0);var f=g.tablesorter["sort"+l](c,j[m],h[m],m,q[m],b);if(f)return f}return j[s]-h[s]});a.debug&&w("Sorting on "+e.toString()+" and dir "+r+" time",h)}}function H(c,b){c.trigger("updateComplete");"function"===typeof b&&b(c[0])}function D(c,b,a){!1!==b&&!c[0].isProcessing?c.trigger("sorton",[c[0].config.sortList, function(){H(c,a)}]):H(c,a)}function I(c){var b=c.config,a=g(c),e,d;b.$headers.find("*")[g.fn.addBack?"addBack":"andSelf"]().filter(b.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter",function(a,e){var k=(this.tagName.match("TH|TD")?g(this):g(this).parents("th, td").filter(":last"))[0];if(1!==(a.which||a.button))return!1;if("mousedown"===a.type)return d=(new Date).getTime(),"INPUT"===a.target.tagName?"":!b.cancelSelection;if(!0!==e&& 250<(new Date).getTime()-d)return!1;b.delayInit&&!b.cache&&s(c);if(!k.sortDisabled){var p,m,q,n=c.config,l=!a[n.sortMultiSortKey],r=g(c);r.trigger("sortStart",c);k.count=a[n.sortResetKey]?2:(k.count+1)%(n.sortReset?3:2);n.sortRestart&&(m=k,n.$headers.each(function(){if(this!==m&&(l||!g(this).is("."+n.cssDesc+",."+n.cssAsc)))this.count=-1}));m=k.column;if(l){n.sortList=[];if(null!==n.sortForce){p=n.sortForce;for(q=0;q<p.length;q++)p[q][0]!==m&&n.sortList.push(p[q])}p=k.order[k.count];if(2>p&&(n.sortList.push([m, p]),1<k.colSpan))for(q=1;q<k.colSpan;q++)n.sortList.push([m+q,p])}else if(n.sortAppend&&1<n.sortList.length&&f.isValueInArray(n.sortAppend[0][0],n.sortList)&&n.sortList.pop(),f.isValueInArray(m,n.sortList))for(q=0;q<n.sortList.length;q++)k=n.sortList[q],p=n.headerList[k[0]],k[0]===m&&(k[1]=p.order[p.count],2===k[1]&&(n.sortList.splice(q,1),p.count=-1));else if(p=k.order[k.count],2>p&&(n.sortList.push([m,p]),1<k.colSpan))for(q=1;q<k.colSpan;q++)n.sortList.push([m+q,p]);if(null!==n.sortAppend){p=n.sortAppend; for(q=0;q<p.length;q++)p[q][0]!==m&&n.sortList.push(p[q])}r.trigger("sortBegin",c);setTimeout(function(){y(c);B(c);v(c)},1)}});b.cancelSelection&&b.$headers.each(function(){this.onselectstart=function(){return!1}});a.unbind("sortReset update updateRows updateCell updateAll addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ".split(" ").join(".tablesorter ")).bind("sortReset.tablesorter",function(a){a.stopPropagation();b.sortList=[];y(c);B(c);v(c)}).bind("updateAll.tablesorter", function(a,b,e){a.stopPropagation();f.restoreHeaders(c);z(c);I(c);A(c,b,e)}).bind("update.tablesorter updateRows.tablesorter",function(a,b,e){a.stopPropagation();E(c);A(c,b,e)}).bind("updateCell.tablesorter",function(e,d,f,p){e.stopPropagation();a.find(b.selectorRemove).remove();var m,q,n;m=a.find("tbody");e=m.index(g(d).parents("tbody").filter(":last"));var t=g(d).parents("tr").filter(":last");d=g(d)[0];m.length&&0<=e&&(q=m.eq(e).find("tr").index(t),n=d.cellIndex,m=b.cache[e].normalized[q].length- 1,b.cache[e].row[c.config.cache[e].normalized[q][m]]=t,b.cache[e].normalized[q][n]=b.parsers[n].format(r(c,d,n),c,d,n),D(a,f,p))}).bind("addRows.tablesorter",function(d,h,f,g){d.stopPropagation();var m=h.filter("tr").length,t=[],n=h[0].cells.length,w=a.find("tbody").index(h.closest("tbody"));b.parsers||l(c);for(d=0;d<m;d++){for(e=0;e<n;e++)t[e]=b.parsers[e].format(r(c,h[d].cells[e],e),c,h[d].cells[e],e);t.push(b.cache[w].row.length);b.cache[w].row.push([h[d]]);b.cache[w].normalized.push(t);t=[]}D(a, f,g)}).bind("sorton.tablesorter",function(b,e,d,f){b.stopPropagation();a.trigger("sortStart",this);var m,t,n,l=c.config;b=e||l.sortList;l.sortList=[];g.each(b,function(a,c){m=[parseInt(c[0],10),parseInt(c[1],10)];if(n=l.headerList[m[0]])l.sortList.push(m),t=g.inArray(m[1],n.order),n.count=0<=t?t:m[1]%(l.sortReset?3:2)});y(c);B(c);v(c,f);"function"===typeof d&&d(c)}).bind("appendCache.tablesorter",function(a,b,e){a.stopPropagation();v(c,e);"function"===typeof b&&b(c)}).bind("applyWidgetId.tablesorter", function(a,e){a.stopPropagation();f.getWidgetById(e).format(c,b,b.widgetOptions)}).bind("applyWidgets.tablesorter",function(a,b){a.stopPropagation();f.applyWidget(c,b)}).bind("refreshWidgets.tablesorter",function(a,b,e){a.stopPropagation();f.refreshWidgets(c,b,e)}).bind("destroy.tablesorter",function(a,b,e){a.stopPropagation();f.destroy(c,b,e)})}var f=this;f.version="2.8.0";f.parsers=[];f.widgets=[];f.defaults={theme:"default",widthFixed:!1,showProcessing:!1,headerTemplate:"{content}",onRenderTemplate:null, onRenderHeader:null,cancelSelection:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,headers:{},ignoreCase:!0,sortForce:null,sortList:[],sortAppend:null,sortInitialOrder:"asc",sortLocaleCompare:!1,sortReset:!1,sortRestart:!1,emptyTo:"bottom",stringTo:"max",textExtraction:"simple",textSorter:null,widgets:[],widgetOptions:{zebra:["even","odd"]},initWidgets:!0,initialized:null,tableClass:"tablesorter",cssAsc:"tablesorter-headerAsc", cssChildRow:"tablesorter-childRow",cssDesc:"tablesorter-headerDesc",cssHeader:"tablesorter-header",cssHeaderRow:"tablesorter-headerRow",cssIcon:"tablesorter-icon",cssInfoBlock:"tablesorter-infoOnly",cssProcessing:"tablesorter-processing",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};f.benchmark=w;f.construct=function(c){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config&& this.config.debug?d("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var b=g(this),a=this,e,t="",j=g.metadata;a.hasInitialized=!1;a.isProcessing=!0;a.config={};e=g.extend(!0,a.config,f.defaults,c);g.data(a,"tablesorter",e);e.debug&&g.data(a,"startoveralltimer",new Date);e.supportsTextContent="x"===g("<span>x</span>")[0].textContent;e.supportsDataObject=1.4<=parseFloat(g.fn.jquery);e.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1}; /tablesorter\-/.test(b.attr("class"))||(t=""!==e.theme?" tablesorter-"+e.theme:"");e.$table=b.addClass(e.tableClass+t);e.$tbodies=b.children("tbody:not(."+e.cssInfoBlock+")");z(a);if(a.config.widthFixed&&0===g(a).find("colgroup").length){var h=g("<colgroup>"),k=g(a).width();g(a.tBodies[0]).find("tr:first").children("td").each(function(){h.append(g("<col>").css("width",parseInt(1E3*(g(this).width()/k),10)/10+"%"))});g(a).prepend(h)}l(a);e.delayInit||s(a);I(a);e.supportsDataObject&&"undefined"!==typeof b.data().sortlist? e.sortList=b.data().sortlist:j&&(b.metadata()&&b.metadata().sortlist)&&(e.sortList=b.metadata().sortlist);f.applyWidget(a,!0);0<e.sortList.length?b.trigger("sorton",[e.sortList,{},!e.initWidgets]):e.initWidgets&&f.applyWidget(a);e.showProcessing&&b.unbind("sortBegin.tablesorter sortEnd.tablesorter").bind("sortBegin.tablesorter sortEnd.tablesorter",function(b){f.isProcessing(a,"sortBegin"===b.type)});a.hasInitialized=!0;a.isProcessing=!1;e.debug&&f.benchmark("Overall initialization time",g.data(a, "startoveralltimer"));b.trigger("tablesorter-initialized",a);"function"===typeof e.initialized&&e.initialized(a)})};f.isProcessing=function(c,b,a){c=g(c);var e=c[0].config;c=a||c.find("."+e.cssHeader);b?(0<e.sortList.length&&(c=c.filter(function(){return this.sortDisabled?!1:f.isValueInArray(parseFloat(g(this).attr("data-column")),e.sortList)})),c.addClass(e.cssProcessing)):c.removeClass(e.cssProcessing)};f.processTbody=function(c,b,a){if(a)return c.isProcessing=!0,b.before('<span class="tablesorter-savemyplace"/>'), a=g.fn.detach?b.detach():b.remove();a=g(c).find("span.tablesorter-savemyplace");b.insertAfter(a);a.remove();c.isProcessing=!1};f.clearTableBody=function(c){g(c)[0].config.$tbodies.empty()};f.restoreHeaders=function(c){var b=c.config;b.$headers.each(function(a){g(this).find(".tablesorter-header-inner").length&&g(this).html(b.headerContent[a])})};f.destroy=function(c,b,a){c=g(c)[0];if(c.hasInitialized){f.refreshWidgets(c,!0,!0);var e=g(c),d=c.config,j=e.find("thead:first"),h=j.find("tr."+d.cssHeaderRow).removeClass(d.cssHeaderRow), k=e.find("tfoot:first > tr").children("th, td");j.find("tr").not(h).remove();e.removeData("tablesorter").unbind("sortReset update updateAll updateRows updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave sortBegin sortEnd ".split(" ").join(".tablesorter "));d.$headers.add(k).removeClass(d.cssHeader+" "+d.cssAsc+" "+d.cssDesc).removeAttr("data-column");h.find(d.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter");f.restoreHeaders(c); !1!==b&&e.removeClass(d.tableClass+" tablesorter-"+d.theme);c.hasInitialized=!1;"function"===typeof a&&a(c)}};f.regex=[/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,/^0x[0-9a-f]+$/i];f.sortText=function(c,b,a,e){if(b===a)return 0;var d=c.config,j=d.string[d.empties[e]||d.emptyTo],h=f.regex;if(""===b&&0!==j)return"boolean"===typeof j?j?-1:1:-j||-1;if(""=== a&&0!==j)return"boolean"===typeof j?j?1:-1:j||1;if("function"===typeof d.textSorter)return d.textSorter(b,a,c,e);c=b.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");e=a.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=parseInt(b.match(h[2]),16)||1!==c.length&&b.match(h[1])&&Date.parse(b);if(a=parseInt(a.match(h[2]),16)||b&&a.match(h[1])&&Date.parse(a)||null){if(b<a)return-1;if(b>a)return 1}d=Math.max(c.length,e.length);for(b=0;b<d;b++){a=isNaN(c[b])? c[b]||0:parseFloat(c[b])||0;h=isNaN(e[b])?e[b]||0:parseFloat(e[b])||0;if(isNaN(a)!==isNaN(h))return isNaN(a)?1:-1;typeof a!==typeof h&&(a+="",h+="");if(a<h)return-1;if(a>h)return 1}return 0};f.sortTextDesc=function(c,b,a,e){if(b===a)return 0;var d=c.config,j=d.string[d.empties[e]||d.emptyTo];return""===b&&0!==j?"boolean"===typeof j?j?-1:1:j||1:""===a&&0!==j?"boolean"===typeof j?j?1:-1:-j||-1:"function"===typeof d.textSorter?d.textSorter(a,b,c,e):f.sortText(c,a,b)};f.getTextValue=function(c,b,a){if(b){var e= c?c.length:0,d=b+a;for(b=0;b<e;b++)d+=c.charCodeAt(b);return a*d}return 0};f.sortNumeric=function(c,b,a,e,d,j){if(b===a)return 0;c=c.config;e=c.string[c.empties[e]||c.emptyTo];if(""===b&&0!==e)return"boolean"===typeof e?e?-1:1:-e||-1;if(""===a&&0!==e)return"boolean"===typeof e?e?1:-1:e||1;isNaN(b)&&(b=f.getTextValue(b,d,j));isNaN(a)&&(a=f.getTextValue(a,d,j));return b-a};f.sortNumericDesc=function(c,b,a,d,g,j){if(b===a)return 0;c=c.config;d=c.string[c.empties[d]||c.emptyTo];if(""===b&&0!==d)return"boolean"=== typeof d?d?-1:1:d||1;if(""===a&&0!==d)return"boolean"===typeof d?d?1:-1:-d||-1;isNaN(b)&&(b=f.getTextValue(b,g,j));isNaN(a)&&(a=f.getTextValue(a,g,j));return a-b};f.characterEquivalents={a:"\u00e1\u00e0\u00e2\u00e3\u00e4\u0105\u00e5",A:"\u00c1\u00c0\u00c2\u00c3\u00c4\u0104\u00c5",c:"\u00e7\u0107\u010d",C:"\u00c7\u0106\u010c",e:"\u00e9\u00e8\u00ea\u00eb\u011b\u0119",E:"\u00c9\u00c8\u00ca\u00cb\u011a\u0118",i:"\u00ed\u00ec\u0130\u00ee\u00ef\u0131",I:"\u00cd\u00cc\u0130\u00ce\u00cf",o:"\u00f3\u00f2\u00f4\u00f5\u00f6", O:"\u00d3\u00d2\u00d4\u00d5\u00d6",ss:"\u00df",SS:"\u1e9e",u:"\u00fa\u00f9\u00fb\u00fc\u016f",U:"\u00da\u00d9\u00db\u00dc\u016e"};f.replaceAccents=function(c){var b,a="[",d=f.characterEquivalents;if(!f.characterRegex){f.characterRegexArray={};for(b in d)"string"===typeof b&&(a+=d[b],f.characterRegexArray[b]=RegExp("["+d[b]+"]","g"));f.characterRegex=RegExp(a+"]")}if(f.characterRegex.test(c))for(b in d)"string"===typeof b&&(c=c.replace(f.characterRegexArray[b],b));return c};f.isValueInArray=function(c, b){var a,d=b.length;for(a=0;a<d;a++)if(b[a][0]===c)return!0;return!1};f.addParser=function(c){var b,a=f.parsers.length,d=!0;for(b=0;b<a;b++)f.parsers[b].id.toLowerCase()===c.id.toLowerCase()&&(d=!1);d&&f.parsers.push(c)};f.getParserById=function(c){var b,a=f.parsers.length;for(b=0;b<a;b++)if(f.parsers[b].id.toLowerCase()===c.toString().toLowerCase())return f.parsers[b];return!1};f.addWidget=function(c){f.widgets.push(c)};f.getWidgetById=function(c){var b,a,d=f.widgets.length;for(b=0;b<d;b++)if((a= f.widgets[b])&&a.hasOwnProperty("id")&&a.id.toLowerCase()===c.toLowerCase())return a};f.applyWidget=function(c,b){c=g(c)[0];var a=c.config,d=a.widgetOptions,l=a.widgets.sort().reverse(),j,h,k,p=l.length;h=g.inArray("zebra",a.widgets);0<=h&&(a.widgets.splice(h,1),a.widgets.push("zebra"));a.debug&&(j=new Date);for(h=0;h<p;h++)if(k=f.getWidgetById(l[h]))b?(k.hasOwnProperty("options")&&g.extend(!0,k.options,d),k.hasOwnProperty("init")&&k.init(c,k,a,d)):!b&&k.hasOwnProperty("format")&&k.format(c,a,d,!1); a.debug&&w("Completed "+(!0===b?"initializing":"applying")+" widgets",j)};f.refreshWidgets=function(c,b,a){c=g(c)[0];var e,l=c.config,j=l.widgets,h=f.widgets,k=h.length;for(e=0;e<k;e++)if(h[e]&&h[e].id&&(b||0>g.inArray(h[e].id,j)))l.debug&&d("Refeshing widgets: Removing "+h[e].id),h[e].hasOwnProperty("remove")&&h[e].remove(c,l,l.widgetOptions);!0!==a&&f.applyWidget(c,b)};f.getData=function(c,b,a){var d="";c=g(c);var f,j;if(!c.length)return"";f=g.metadata?c.metadata():!1;j=" "+(c.attr("class")||""); "undefined"!==typeof c.data(a)||"undefined"!==typeof c.data(a.toLowerCase())?d+=c.data(a)||c.data(a.toLowerCase()):f&&"undefined"!==typeof f[a]?d+=f[a]:b&&"undefined"!==typeof b[a]?d+=b[a]:" "!==j&&j.match(" "+a+"-")&&(d=j.match(RegExp("\\s"+a+"-([\\w-]+)"))[1]||"");return g.trim(d)};f.formatFloat=function(c,b){if("string"!==typeof c||""===c)return c;var a;c=(b&&b.config?!1!==b.config.usNumberFormat:"undefined"!==typeof b?b:1)?c.replace(/,/g,""):c.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(c)&& (c=c.replace(/^\s*\(/,"-").replace(/\)/,""));a=parseFloat(c);return isNaN(a)?g.trim(c):a};f.isDigit=function(c){return isNaN(c)?/^[\-+(]?\d+[)]?$/.test(c.toString().replace(/[,.'"\s]/g,"")):!0}}});var l=g.tablesorter;g.fn.extend({tablesorter:l.construct});l.addParser({id:"text",is:function(){return!0},format:function(d,w){var r=w.config;d&&(d=g.trim(r.ignoreCase?d.toLocaleLowerCase():d),d=r.sortLocaleCompare?l.replaceAccents(d):d);return d},type:"text"});l.addParser({id:"digit",is:function(d){return l.isDigit(d)}, format:function(d,g){return d?l.formatFloat(d.replace(/[^\w,. \-()]/g,""),g):d},type:"numeric"});l.addParser({id:"currency",is:function(d){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test((d||"").replace(/[,. ]/g,""))},format:function(d,g){return d?l.formatFloat(d.replace(/[^\w,. \-()]/g,""),g):d},type:"numeric"});l.addParser({id:"ipAddress",is:function(d){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(d)},format:function(d,g){var r,u=d?d.split("."): "",s="",v=u.length;for(r=0;r<v;r++)s+=("00"+u[r]).slice(-3);return d?l.formatFloat(s,g):d},type:"numeric"});l.addParser({id:"url",is:function(d){return/^(https?|ftp|file):\/\//.test(d)},format:function(d){return d?g.trim(d.replace(/(https?|ftp|file):\/\//,"")):d},type:"text"});l.addParser({id:"isoDate",is:function(d){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/.test(d)},format:function(d,g){return d?l.formatFloat(""!==d?(new Date(d.replace(/-/g,"/"))).getTime()||"":"",g):d},type:"numeric"});l.addParser({id:"percent", is:function(d){return/(\d\s?%|%\s?\d)/.test(d)},format:function(d,g){return d?l.formatFloat(d.replace(/%/g,""),g):d},type:"numeric"});l.addParser({id:"usLongDate",is:function(d){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(d)||/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i.test(d)},format:function(d,g){return d?l.formatFloat((new Date(d.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",g):d},type:"numeric"});l.addParser({id:"shortDate",is:function(d){return/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/.test((d|| "").replace(/\s+/g," ").replace(/[\-.,]/g,"/"))},format:function(d,g,r,u){if(d){r=g.config;var s=r.headerList[u],v=s.shortDateFormat;"undefined"===typeof v&&(v=s.shortDateFormat=l.getData(s,r.headers[u],"dateFormat")||r.dateFormat);d=d.replace(/\s+/g," ").replace(/[\-.,]/g,"/");"mmddyyyy"===v?d=d.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2"):"ddmmyyyy"===v?d=d.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1"):"yyyymmdd"===v&&(d=d.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/, "$1/$2/$3"))}return d?l.formatFloat((new Date(d)).getTime()||"",g):d},type:"numeric"});l.addParser({id:"time",is:function(d){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(d)},format:function(d,g){return d?l.formatFloat((new Date("2000/01/01 "+d.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",g):d},type:"numeric"});l.addParser({id:"metadata",is:function(){return!1},format:function(d,l,r){d=l.config;d=!d.parserMetadataName?"sortValue":d.parserMetadataName;return g(r).metadata()[d]}, type:"numeric"});l.addWidget({id:"zebra",format:function(d,w,r){var u,s,v,z,A,E,y=RegExp(w.cssChildRow,"i"),B=w.$tbodies;w.debug&&(A=new Date);for(d=0;d<B.length;d++)u=B.eq(d),E=u.children("tr").length,1<E&&(v=0,u=u.children("tr:visible"),u.each(function(){s=g(this);y.test(this.className)||v++;z=0===v%2;s.removeClass(r.zebra[z?1:0]).addClass(r.zebra[z?0:1])}));w.debug&&l.benchmark("Applying Zebra widget",A)},remove:function(d,l,r){var u;l=l.$tbodies;var s=(r.zebra||["even","odd"]).join(" ");for(r= 0;r<l.length;r++)u=g.tablesorter.processTbody(d,l.eq(r),!0),u.children().removeClass(s),g.tablesorter.processTbody(d,u,!1)}})}(jQuery);
| perdona/cdnjs | ajax/libs/jquery.tablesorter/2.8.0/js/jquery.tablesorter.min.js | JavaScript | mit | 23,300 |
/*
**********************************************************************
* Copyright (C) 2003-2013, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
#include "layout/LETypes.h"
//#include "letest.h"
#include "FontTableCache.h"
#define TABLE_CACHE_INIT 5
#define TABLE_CACHE_GROW 5
struct FontTableCacheEntry
{
LETag tag;
const void *table;
size_t length;
};
FontTableCache::FontTableCache()
: fTableCacheCurr(0), fTableCacheSize(TABLE_CACHE_INIT)
{
fTableCache = LE_NEW_ARRAY(FontTableCacheEntry, fTableCacheSize);
if (fTableCache == NULL) {
fTableCacheSize = 0;
return;
}
for (int i = 0; i < fTableCacheSize; i += 1) {
fTableCache[i].tag = 0;
fTableCache[i].table = NULL;
fTableCache[i].length = 0;
}
}
FontTableCache::~FontTableCache()
{
for (int i = fTableCacheCurr - 1; i >= 0; i -= 1) {
LE_DELETE_ARRAY(fTableCache[i].table);
fTableCache[i].tag = 0;
fTableCache[i].table = NULL;
fTableCache[i].length = 0;
}
fTableCacheCurr = 0;
LE_DELETE_ARRAY(fTableCache);
}
void FontTableCache::freeFontTable(const void *table) const
{
LE_DELETE_ARRAY(table);
}
const void *FontTableCache::find(LETag tableTag, size_t &length) const
{
for (int i = 0; i < fTableCacheCurr; i += 1) {
if (fTableCache[i].tag == tableTag) {
length = fTableCache[i].length;
return fTableCache[i].table;
}
}
const void *table = readFontTable(tableTag, length);
((FontTableCache *) this)->add(tableTag, table, length);
return table;
}
void FontTableCache::add(LETag tableTag, const void *table, size_t length)
{
if (fTableCacheCurr >= fTableCacheSize) {
le_int32 newSize = fTableCacheSize + TABLE_CACHE_GROW;
fTableCache = (FontTableCacheEntry *) LE_GROW_ARRAY(fTableCache, newSize);
for (le_int32 i = fTableCacheSize; i < newSize; i += 1) {
fTableCache[i].tag = 0;
fTableCache[i].table = NULL;
fTableCache[i].length = 0;
}
fTableCacheSize = newSize;
}
fTableCache[fTableCacheCurr].tag = tableTag;
fTableCache[fTableCacheCurr].table = table;
fTableCache[fTableCacheCurr].length = length;
fTableCacheCurr += 1;
}
| thebergamo/WinObjC | deps/3rdparty/icu/icu/source/test/letest/FontTableCache.cpp | C++ | mit | 2,399 |
<?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\Console\Tests\Output;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Output\StreamOutput;
class StreamOutputTest extends TestCase
{
protected $stream;
protected function setUp()
{
$this->stream = fopen('php://memory', 'a', false);
}
protected function tearDown()
{
$this->stream = null;
}
public function testConstructor()
{
$output = new StreamOutput($this->stream, Output::VERBOSITY_QUIET, true);
$this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '__construct() takes the verbosity as its first argument');
$this->assertTrue($output->isDecorated(), '__construct() takes the decorated flag as its second argument');
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage The StreamOutput class needs a stream as its first argument.
*/
public function testStreamIsRequired()
{
new StreamOutput('foo');
}
public function testGetStream()
{
$output = new StreamOutput($this->stream);
$this->assertEquals($this->stream, $output->getStream(), '->getStream() returns the current stream');
}
public function testDoWrite()
{
$output = new StreamOutput($this->stream);
$output->writeln('foo');
rewind($output->getStream());
$this->assertEquals('foo'.PHP_EOL, stream_get_contents($output->getStream()), '->doWrite() writes to the stream');
}
}
| josephdpurcell/symfony | src/Symfony/Component/Console/Tests/Output/StreamOutputTest.php | PHP | mit | 1,812 |
/*!
* TableSorter 2.16.0-beta min - Client-side table sorting with ease!
* Copyright (c) 2007 Christian Bach
*/
!function(g){g.extend({tablesorter:new function(){function d(){var a=arguments[0],b=1<arguments.length?Array.prototype.slice.call(arguments):a;if("undefined"!==typeof console&&"undefined"!==typeof console.log)console[/error/i.test(a)?"error":/warn/i.test(a)?"warn":"log"](b);else alert(b)}function u(a,b){d(a+" ("+((new Date).getTime()-b.getTime())+"ms)")}function m(a){for(var b in a)return!1;return!0}function p(a,b,c){if(!b)return"";var h=a.config,e=h.textExtraction||"",n="",n="basic"===e?g(b).attr(h.textAttribute)|| b.textContent||b.innerText||g(b).text()||"":"function"===typeof e?e(b,a,c):"object"===typeof e&&e.hasOwnProperty(c)?e[c](b,a,c):b.textContent||b.innerText||g(b).text()||"";return g.trim(n)}function r(a){var b=a.config,c=b.$tbodies=b.$table.children("tbody:not(."+b.cssInfoBlock+")"),h,e,n,k,s,l,g,m="";if(0===c.length)return b.debug?d("Warning: *Empty table!* Not building a parser cache"):"";b.debug&&(g=new Date,d("Detecting parsers for each column"));c=c[0].rows;if(c[0])for(h=[],e=c[0].cells.length, n=0;n<e;n++){k=b.$headers.filter(":not([colspan])");k=k.add(b.$headers.filter('[colspan="1"]')).filter('[data-column="'+n+'"]:last');s=b.headers[n];l=f.getParserById(f.getData(k,s,"sorter"));b.empties[n]=f.getData(k,s,"empty")||b.emptyTo||(b.emptyToBottom?"bottom":"top");b.strings[n]=f.getData(k,s,"string")||b.stringTo||"max";if(!l)a:{k=a;s=c;l=-1;for(var x=n,q=void 0,t=f.parsers.length,r=!1,v="",q=!0;""===v&&q;)l++,s[l]?(r=s[l].cells[x],v=p(k,r,x),k.config.debug&&d("Checking if value was empty on row "+ l+", column: "+x+': "'+v+'"')):q=!1;for(;0<=--t;)if((q=f.parsers[t])&&"text"!==q.id&&q.is&&q.is(v,k,r)){l=q;break a}l=f.getParserById("text")}b.debug&&(m+="column:"+n+"; parser:"+l.id+"; string:"+b.strings[n]+"; empty: "+b.empties[n]+"\n");h.push(l)}b.debug&&(d(m),u("Completed detecting parsers",g));b.parsers=h}function v(a){var b,c,h,e,n,k,s,l,y,m,x,q=a.config,t=q.$table.children("tbody"),r=q.parsers;q.cache={};if(!r)return q.debug?d("Warning: *Empty table!* Not building a cache"):"";q.debug&&(l= new Date);q.showProcessing&&f.isProcessing(a,!0);for(n=0;n<t.length;n++)if(x=[],b=q.cache[n]={normalized:[]},!t.eq(n).hasClass(q.cssInfoBlock)){y=t[n]&&t[n].rows.length||0;for(h=0;h<y;++h)if(m={child:[]},k=g(t[n].rows[h]),s=[],k.hasClass(q.cssChildRow)&&0!==h)c=b.normalized.length-1,b.normalized[c][q.columns].$row=b.normalized[c][q.columns].$row.add(k),k.prev().hasClass(q.cssChildRow)||k.prev().addClass(f.css.cssHasChild),m.child[c]=g.trim(k[0].textContent||k[0].innerText||k.text()||"");else{m.$row= k;m.order=h;for(e=0;e<q.columns;++e)"undefined"===typeof r[e]?q.debug&&d("No parser found for cell:",k[0].cells[e],"does it have a header?"):(c=p(a,k[0].cells[e],e),c=r[e].format(c,a,k[0].cells[e],e),s.push(c),"numeric"===(r[e].type||"").toLowerCase()&&(x[e]=Math.max(Math.abs(c)||0,x[e]||0)));s.push(m);b.normalized.push(s)}b.colMax=x}q.showProcessing&&f.isProcessing(a);q.debug&&u("Building cache for "+y+" rows",l)}function z(a,b){var c=a.config,h=c.widgetOptions,e=a.tBodies,n=[],k=c.cache,d,l,y,p, x,q;if(m(k))return c.appender?c.appender(a,n):a.isUpdating?c.$table.trigger("updateComplete",a):"";c.debug&&(q=new Date);for(x=0;x<e.length;x++)if(d=g(e[x]),d.length&&!d.hasClass(c.cssInfoBlock)){y=f.processTbody(a,d,!0);d=k[x].normalized;l=d.length;for(p=0;p<l;p++)n.push(d[p][c.columns].$row),c.appender&&(!c.pager||c.pager.removeRows&&h.pager_removeRows||c.pager.ajax)||y.append(d[p][c.columns].$row);f.processTbody(a,y,!1)}c.appender&&c.appender(a,n);c.debug&&u("Rebuilt table",q);b||c.appender||f.applyWidget(a); a.isUpdating&&c.$table.trigger("updateComplete",a)}function B(a){return/^d/i.test(a)||1===a}function C(a){var b,c,h,e,n,k,s,l=a.config;l.headerList=[];l.headerContent=[];l.debug&&(s=new Date);l.columns=f.computeColumnIndex(l.$table.children("thead, tfoot").children("tr"));e=l.cssIcon?'<i class="'+(l.cssIcon===f.css.icon?f.css.icon:l.cssIcon+" "+f.css.icon)+'"></i>':"";l.$headers=g(a).find(l.selectorHeaders).each(function(a){c=g(this);b=l.headers[a];l.headerContent[a]=g(this).html();n=l.headerTemplate.replace(/\{content\}/g, g(this).html()).replace(/\{icon\}/g,e);l.onRenderTemplate&&(h=l.onRenderTemplate.apply(c,[a,n]))&&"string"===typeof h&&(n=h);g(this).html('<div class="'+f.css.headerIn+'">'+n+"</div>");l.onRenderHeader&&l.onRenderHeader.apply(c,[a]);this.column=parseInt(g(this).attr("data-column"),10);this.order=B(f.getData(c,b,"sortInitialOrder")||l.sortInitialOrder)?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder=!1;k=f.getData(c,b,"lockedOrder")||!1;"undefined"!==typeof k&&!1!==k&&(this.order=this.lockedOrder=B(k)? [1,1,1]:[0,0,0]);c.addClass(f.css.header+" "+l.cssHeader);l.headerList[a]=this;c.parent().addClass(f.css.headerRow+" "+l.cssHeaderRow).attr("role","row");l.tabIndex&&c.attr("tabindex",0)}).attr({scope:"col",role:"columnheader"});A(a);l.debug&&(u("Built headers:",s),d(l.$headers))}function D(a,b,c){var h=a.config;h.$table.find(h.selectorRemove).remove();r(a);v(a);F(h.$table,b,c)}function A(a){var b,c,h=a.config;h.$headers.each(function(e,n){c=g(n);b="false"===f.getData(n,h.headers[e],"sorter");n.sortDisabled= b;c[b?"addClass":"removeClass"]("sorter-false").attr("aria-disabled",""+b);a.id&&(b?c.removeAttr("aria-controls"):c.attr("aria-controls",a.id))})}function E(a){var b,c,h,e=a.config,n=e.sortList,d=f.css.sortNone+" "+e.cssNone,s=[f.css.sortAsc+" "+e.cssAsc,f.css.sortDesc+" "+e.cssDesc],l=["ascending","descending"],m=g(a).find("tfoot tr").children().removeClass(s.join(" "));e.$headers.removeClass(s.join(" ")).addClass(d).attr("aria-sort","none");h=n.length;for(b=0;b<h;b++)if(2!==n[b][1]&&(a=e.$headers.not(".sorter-false").filter('[data-column="'+ n[b][0]+'"]'+(1===h?":last":"")),a.length))for(c=0;c<a.length;c++)a[c].sortDisabled||(a.eq(c).removeClass(d).addClass(s[n[b][1]]).attr("aria-sort",l[n[b][1]]),m.length&&m.filter('[data-column="'+n[b][0]+'"]').eq(c).addClass(s[n[b][1]]));e.$headers.not(".sorter-false").each(function(){var a=g(this),b=this.order[(this.count+1)%(e.sortReset?3:2)],b=a.text()+": "+f.language[a.hasClass(f.css.sortAsc)?"sortAsc":a.hasClass(f.css.sortDesc)?"sortDesc":"sortNone"]+f.language[0===b?"nextAsc":1===b?"nextDesc": "nextNone"];a.attr("aria-label",b)})}function J(a){if(a.config.widthFixed&&0===g(a).find("colgroup").length){var b=g("<colgroup>"),c=g(a).width();g(a.tBodies[0]).find("tr:first").children("td:visible").each(function(){b.append(g("<col>").css("width",parseInt(g(this).width()/c*1E3,10)/10+"%"))});g(a).prepend(b)}}function K(a,b){var c,h,e,n=a.config,f=b||n.sortList;n.sortList=[];g.each(f,function(a,b){c=[parseInt(b[0],10),parseInt(b[1],10)];if(e=n.$headers[c[0]])n.sortList.push(c),h=g.inArray(c[1], e.order),e.count=0<=h?h:c[1]%(n.sortReset?3:2)})}function L(a,b){return a&&a[b]?a[b].type||"":""}function M(a,b,c){var h,e,n,d=a.config,s=!c[d.sortMultiSortKey],l=d.$table;l.trigger("sortStart",a);b.count=c[d.sortResetKey]?2:(b.count+1)%(d.sortReset?3:2);d.sortRestart&&(e=b,d.$headers.each(function(){this===e||!s&&g(this).is("."+f.css.sortDesc+",."+f.css.sortAsc)||(this.count=-1)}));e=b.column;if(s){d.sortList=[];if(null!==d.sortForce)for(h=d.sortForce,c=0;c<h.length;c++)h[c][0]!==e&&d.sortList.push(h[c]); h=b.order[b.count];if(2>h&&(d.sortList.push([e,h]),1<b.colSpan))for(c=1;c<b.colSpan;c++)d.sortList.push([e+c,h])}else{if(d.sortAppend&&1<d.sortList.length)for(c=0;c<d.sortAppend.length;c++)n=f.isValueInArray(d.sortAppend[c][0],d.sortList),0<=n&&d.sortList.splice(n,1);if(0<=f.isValueInArray(e,d.sortList))for(c=0;c<d.sortList.length;c++)n=d.sortList[c],h=d.$headers[n[0]],n[0]===e&&(n[1]=h.order[b.count],2===n[1]&&(d.sortList.splice(c,1),h.count=-1));else if(h=b.order[b.count],2>h&&(d.sortList.push([e, h]),1<b.colSpan))for(c=1;c<b.colSpan;c++)d.sortList.push([e+c,h])}if(null!==d.sortAppend)for(h=d.sortAppend,c=0;c<h.length;c++)h[c][0]!==e&&d.sortList.push(h[c]);l.trigger("sortBegin",a);setTimeout(function(){E(a);G(a);z(a);l.trigger("sortEnd",a)},1)}function G(a){var b,c,h,e,d,k,g,l,y,p,r,q=0,t=a.config,w=t.textSorter||"",v=t.sortList,z=v.length,A=a.tBodies.length;if(!t.serverSideSorting&&!m(t.cache)){t.debug&&(d=new Date);for(c=0;c<A;c++)k=t.cache[c].colMax,g=t.cache[c].normalized,g.sort(function(c, d){for(b=0;b<z;b++){e=v[b][0];l=v[b][1];q=0===l;if(t.sortStable&&c[e]===d[e]&&1===z)break;(h=/n/i.test(L(t.parsers,e)))&&t.strings[e]?(h="boolean"===typeof t.string[t.strings[e]]?(q?1:-1)*(t.string[t.strings[e]]?-1:1):t.strings[e]?t.string[t.strings[e]]||0:0,y=t.numberSorter?t.numberSorter(c[e],d[e],q,k[e],a):f["sortNumeric"+(q?"Asc":"Desc")](c[e],d[e],h,k[e],e,a)):(p=q?c:d,r=q?d:c,y="function"===typeof w?w(p[e],r[e],q,e,a):"object"===typeof w&&w.hasOwnProperty(e)?w[e](p[e],r[e],q,e,a):f["sortNatural"+ (q?"Asc":"Desc")](c[e],d[e],e,a,t));if(y)return y}return c[t.columns].order-d[t.columns].order});t.debug&&u("Sorting on "+v.toString()+" and dir "+l+" time",d)}}function H(a,b){a[0].isUpdating&&a.trigger("updateComplete");g.isFunction(b)&&b(a[0])}function F(a,b,c){var h=a[0].config.sortList;!1!==b&&!a[0].isProcessing&&h.length?a.trigger("sorton",[h,function(){H(a,c)},!0]):(H(a,c),f.applyWidget(a[0],!1))}function I(a){var b=a.config,c=b.$table;c.unbind("sortReset update updateRows updateCell updateAll addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ".split(" ").join(b.namespace+ " ")).bind("sortReset"+b.namespace,function(c,e){c.stopPropagation();b.sortList=[];E(a);G(a);z(a);g.isFunction(e)&&e(a)}).bind("updateAll"+b.namespace,function(c,e,d){c.stopPropagation();a.isUpdating=!0;f.refreshWidgets(a,!0,!0);f.restoreHeaders(a);C(a);f.bindEvents(a,b.$headers);I(a);D(a,e,d)}).bind("update"+b.namespace+" updateRows"+b.namespace,function(b,c,d){b.stopPropagation();a.isUpdating=!0;A(a);D(a,c,d)}).bind("updateCell"+b.namespace,function(h,e,d,f){h.stopPropagation();a.isUpdating=!0; c.find(b.selectorRemove).remove();var s,l;s=c.find("tbody");l=g(e);h=s.index(l.parents("tbody").filter(":first"));var m=l.parents("tr").filter(":first");e=l[0];s.length&&0<=h&&(s=s.eq(h).find("tr").index(m),l=l.index(),b.cache[h].normalized[s][b.columns].$row=m,e=b.cache[h].normalized[s][l]=b.parsers[l].format(p(a,e,l),a,e,l),"numeric"===(b.parsers[l].type||"").toLowerCase()&&(b.cache[h].colMax[l]=Math.max(Math.abs(e)||0,b.cache[h].colMax[l]||0)),F(c,d,f))}).bind("addRows"+b.namespace,function(h, e,d,f){h.stopPropagation();a.isUpdating=!0;if(m(b.cache))A(a),D(a,d,f);else{var g,l,u,v,x=e.filter("tr").length,q=c.find("tbody").index(e.parents("tbody").filter(":first"));b.parsers||r(a);for(h=0;h<x;h++){l=e[h].cells.length;v=[];u={child:[],$row:e.eq(h),order:b.cache[q].normalized.length};for(g=0;g<l;g++)v[g]=b.parsers[g].format(p(a,e[h].cells[g],g),a,e[h].cells[g],g),"numeric"===(b.parsers[g].type||"").toLowerCase()&&(b.cache[q].colMax[g]=Math.max(Math.abs(v[g])||0,b.cache[q].colMax[g]||0));v.push(u); b.cache[q].normalized.push(v)}F(c,d,f)}}).bind("updateComplete"+b.namespace,function(){a.isUpdating=!1}).bind("sorton"+b.namespace,function(b,e,d,k){var s=a.config;b.stopPropagation();c.trigger("sortStart",this);K(a,e);E(a);s.delayInit&&m(s.cache)&&v(a);c.trigger("sortBegin",this);G(a);z(a,k);c.trigger("sortEnd",this);f.applyWidget(a);g.isFunction(d)&&d(a)}).bind("appendCache"+b.namespace,function(b,c,d){b.stopPropagation();z(a,d);g.isFunction(c)&&c(a)}).bind("updateCache"+b.namespace,function(c, e){b.parsers||r(a);v(a);g.isFunction(e)&&e(a)}).bind("applyWidgetId"+b.namespace,function(c,e){c.stopPropagation();f.getWidgetById(e).format(a,b,b.widgetOptions)}).bind("applyWidgets"+b.namespace,function(b,c){b.stopPropagation();f.applyWidget(a,c)}).bind("refreshWidgets"+b.namespace,function(b,c,d){b.stopPropagation();f.refreshWidgets(a,c,d)}).bind("destroy"+b.namespace,function(b,c,d){b.stopPropagation();f.destroy(a,c,d)})}var f=this;f.version="2.16.0-beta";f.parsers=[];f.widgets=[];f.defaults= {theme:"default",widthFixed:!1,showProcessing:!1,headerTemplate:"{content}",onRenderTemplate:null,onRenderHeader:null,cancelSelection:!0,tabIndex:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,headers:{},ignoreCase:!0,sortForce:null,sortList:[],sortAppend:null,sortStable:!1,sortInitialOrder:"asc",sortLocaleCompare:!1,sortReset:!1,sortRestart:!1,emptyTo:"bottom",stringTo:"max",textExtraction:"basic",textAttribute:"data-text", textSorter:null,numberSorter:null,widgets:[],widgetOptions:{zebra:["even","odd"]},initWidgets:!0,initialized:null,tableClass:"",cssAsc:"",cssDesc:"",cssNone:"",cssHeader:"",cssHeaderRow:"",cssProcessing:"",cssChildRow:"tablesorter-childRow",cssIcon:"tablesorter-icon",cssInfoBlock:"tablesorter-infoOnly",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};f.css={table:"tablesorter",cssHasChild:"tablesorter-hasChildRow", childRow:"tablesorter-childRow",header:"tablesorter-header",headerRow:"tablesorter-headerRow",headerIn:"tablesorter-header-inner",icon:"tablesorter-icon",info:"tablesorter-infoOnly",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc",sortNone:"tablesorter-headerUnSorted"};f.language={sortAsc:"Ascending sort applied, ",sortDesc:"Descending sort applied, ",sortNone:"No sort applied, ",nextAsc:"activate to apply an ascending sort",nextDesc:"activate to apply a descending sort", nextNone:"activate to remove the sort"};f.log=d;f.benchmark=u;f.construct=function(a){return this.each(function(){var b=g.extend(!0,{},f.defaults,a);!this.hasInitialized&&f.buildTable&&"TABLE"!==this.tagName?f.buildTable(this,b):f.setup(this,b)})};f.setup=function(a,b){if(!a||!a.tHead||0===a.tBodies.length||!0===a.hasInitialized)return b.debug?d("ERROR: stopping initialization! No table, thead, tbody or tablesorter has already been initialized"):"";var c="",h=g(a),e=g.metadata;a.hasInitialized=!1; a.isProcessing=!0;a.config=b;g.data(a,"tablesorter",b);b.debug&&g.data(a,"startoveralltimer",new Date);b.supportsDataObject=function(a){a[0]=parseInt(a[0],10);return 1<a[0]||1===a[0]&&4<=parseInt(a[1],10)}(g.fn.jquery.split("."));b.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1};/tablesorter\-/.test(h.attr("class"))||(c=""!==b.theme?" tablesorter-"+b.theme:"");b.$table=h.addClass(f.css.table+" "+b.tableClass+c).attr({role:"grid"});b.namespace=b.namespace?"."+b.namespace.replace(/\W/g, ""):".tablesorter"+Math.random().toString(16).slice(2);b.$tbodies=h.children("tbody:not(."+b.cssInfoBlock+")").attr({"aria-live":"polite","aria-relevant":"all"});b.$table.find("caption").length&&b.$table.attr("aria-labelledby","theCaption");b.widgetInit={};b.textExtraction=b.$table.attr("data-text-extraction")||b.textExtraction||"basic";C(a);J(a);r(a);b.delayInit||v(a);f.bindEvents(a,b.$headers);I(a);b.supportsDataObject&&"undefined"!==typeof h.data().sortlist?b.sortList=h.data().sortlist:e&&h.metadata()&& h.metadata().sortlist&&(b.sortList=h.metadata().sortlist);f.applyWidget(a,!0);0<b.sortList.length?h.trigger("sorton",[b.sortList,{},!b.initWidgets,!0]):(E(a),b.initWidgets&&f.applyWidget(a,!1));b.showProcessing&&h.unbind("sortBegin"+b.namespace+" sortEnd"+b.namespace).bind("sortBegin"+b.namespace+" sortEnd"+b.namespace,function(b){f.isProcessing(a,"sortBegin"===b.type)});a.hasInitialized=!0;a.isProcessing=!1;b.debug&&f.benchmark("Overall initialization time",g.data(a,"startoveralltimer"));h.trigger("tablesorter-initialized", a);"function"===typeof b.initialized&&b.initialized(a)};f.computeColumnIndex=function(a){var b=[],c=0,d,e,f,k,m,l,u,p,r,q;for(d=0;d<a.length;d++)for(m=a[d].cells,e=0;e<m.length;e++){f=m[e];k=g(f);l=f.parentNode.rowIndex;k.index();u=f.rowSpan||1;p=f.colSpan||1;"undefined"===typeof b[l]&&(b[l]=[]);for(f=0;f<b[l].length+1;f++)if("undefined"===typeof b[l][f]){r=f;break}c=Math.max(r,c);k.attr({"data-column":r});for(f=l;f<l+u;f++)for("undefined"===typeof b[f]&&(b[f]=[]),q=b[f],k=r;k<r+p;k++)q[k]="x"}return c+ 1};f.isProcessing=function(a,b,c){a=g(a);var d=a[0].config;a=c||a.find("."+f.css.header);b?("undefined"!==typeof c&&0<d.sortList.length&&(a=a.filter(function(){return this.sortDisabled?!1:0<=f.isValueInArray(parseFloat(g(this).attr("data-column")),d.sortList)})),a.addClass(f.css.processing+" "+d.cssProcessing)):a.removeClass(f.css.processing+" "+d.cssProcessing)};f.processTbody=function(a,b,c){a=g(a)[0];if(c)return a.isProcessing=!0,b.before('<span class="tablesorter-savemyplace"/>'),c=g.fn.detach? b.detach():b.remove();c=g(a).find("span.tablesorter-savemyplace");b.insertAfter(c);c.remove();a.isProcessing=!1};f.clearTableBody=function(a){g(a)[0].config.$tbodies.empty()};f.bindEvents=function(a,b){a=g(a)[0];var c,d=a.config;b.find(d.selectorSort).add(b.filter(d.selectorSort)).unbind(["mousedown","mouseup","sort","keyup",""].join(d.namespace+" ")).bind(["mousedown","mouseup","sort","keyup",""].join(d.namespace+" "),function(e,f){var k;k=e.type;if(!(1!==(e.which||e.button)&&!/sort|keyup/.test(k)|| "keyup"===k&&13!==e.which||"mouseup"===k&&!0!==f&&250<(new Date).getTime()-c)){if("mousedown"===k)return c=(new Date).getTime(),"INPUT"===e.target.tagName?"":!d.cancelSelection;d.delayInit&&m(d.cache)&&v(a);k=/TH|TD/.test(this.tagName)?this:g(this).parents("th, td")[0];k=d.$headers[b.index(k)];k.sortDisabled||M(a,k,e)}});d.cancelSelection&&b.attr("unselectable","on").bind("selectstart",!1).css({"user-select":"none",MozUserSelect:"none"})};f.restoreHeaders=function(a){var b=g(a)[0].config;b.$table.find(b.selectorHeaders).each(function(a){g(this).find("."+ f.css.headerIn).length&&g(this).html(b.headerContent[a])})};f.destroy=function(a,b,c){a=g(a)[0];if(a.hasInitialized){f.refreshWidgets(a,!0,!0);var d=g(a),e=a.config,n=d.find("thead:first"),k=n.find("tr."+f.css.headerRow).removeClass(f.css.headerRow+" "+e.cssHeaderRow),m=d.find("tfoot:first > tr").children("th, td");!1===b&&0<=g.inArray("uitheme",e.widgets)&&(d.trigger("applyWidgetId",["uitheme"]),d.trigger("applyWidgetId",["zebra"]));n.find("tr").not(k).remove();d.removeData("tablesorter").unbind("sortReset update updateAll updateRows updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd ".split(" ").join(e.namespace+ " "));e.$headers.add(m).removeClass([f.css.header,e.cssHeader,e.cssAsc,e.cssDesc,f.css.sortAsc,f.css.sortDesc,f.css.sortNone].join(" ")).removeAttr("data-column").removeAttr("aria-label").attr("aria-disabled","true");k.find(e.selectorSort).unbind(["mousedown","mouseup","keypress",""].join(e.namespace+" "));f.restoreHeaders(a);d.toggleClass(f.css.table+" "+e.tableClass+" tablesorter-"+e.theme,!1===b);a.hasInitialized=!1;delete a.config.cache;"function"===typeof c&&c(a)}};f.regex={chunk:/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi, chunks:/(^\\0|\\0$)/,hex:/^0x[0-9a-f]+$/i};f.sortNatural=function(a,b){if(a===b)return 0;var c,d,e,g,k,m;d=f.regex;if(d.hex.test(b)){c=parseInt(a.match(d.hex),16);e=parseInt(b.match(d.hex),16);if(c<e)return-1;if(c>e)return 1}c=a.replace(d.chunk,"\\0$1\\0").replace(d.chunks,"").split("\\0");d=b.replace(d.chunk,"\\0$1\\0").replace(d.chunks,"").split("\\0");m=Math.max(c.length,d.length);for(k=0;k<m;k++){e=isNaN(c[k])?c[k]||0:parseFloat(c[k])||0;g=isNaN(d[k])?d[k]||0:parseFloat(d[k])||0;if(isNaN(e)!== isNaN(g))return isNaN(e)?1:-1;typeof e!==typeof g&&(e+="",g+="");if(e<g)return-1;if(e>g)return 1}return 0};f.sortNaturalAsc=function(a,b,c,d,e){if(a===b)return 0;c=e.string[e.empties[c]||e.emptyTo];return""===a&&0!==c?"boolean"===typeof c?c?-1:1:-c||-1:""===b&&0!==c?"boolean"===typeof c?c?1:-1:c||1:f.sortNatural(a,b)};f.sortNaturalDesc=function(a,b,c,d,e){if(a===b)return 0;c=e.string[e.empties[c]||e.emptyTo];return""===a&&0!==c?"boolean"===typeof c?c?-1:1:c||1:""===b&&0!==c?"boolean"===typeof c?c? 1:-1:-c||-1:f.sortNatural(b,a)};f.sortText=function(a,b){return a>b?1:a<b?-1:0};f.getTextValue=function(a,b,c){if(c){var d=a?a.length:0,e=c+b;for(c=0;c<d;c++)e+=a.charCodeAt(c);return b*e}return 0};f.sortNumericAsc=function(a,b,c,d,e,g){if(a===b)return 0;g=g.config;e=g.string[g.empties[e]||g.emptyTo];if(""===a&&0!==e)return"boolean"===typeof e?e?-1:1:-e||-1;if(""===b&&0!==e)return"boolean"===typeof e?e?1:-1:e||1;isNaN(a)&&(a=f.getTextValue(a,c,d));isNaN(b)&&(b=f.getTextValue(b,c,d));return a-b};f.sortNumericDesc= function(a,b,c,d,e,g){if(a===b)return 0;g=g.config;e=g.string[g.empties[e]||g.emptyTo];if(""===a&&0!==e)return"boolean"===typeof e?e?-1:1:e||1;if(""===b&&0!==e)return"boolean"===typeof e?e?1:-1:-e||-1;isNaN(a)&&(a=f.getTextValue(a,c,d));isNaN(b)&&(b=f.getTextValue(b,c,d));return b-a};f.sortNumeric=function(a,b){return a-b};f.characterEquivalents={a:"\u00e1\u00e0\u00e2\u00e3\u00e4\u0105\u00e5",A:"\u00c1\u00c0\u00c2\u00c3\u00c4\u0104\u00c5",c:"\u00e7\u0107\u010d",C:"\u00c7\u0106\u010c",e:"\u00e9\u00e8\u00ea\u00eb\u011b\u0119", E:"\u00c9\u00c8\u00ca\u00cb\u011a\u0118",i:"\u00ed\u00ec\u0130\u00ee\u00ef\u0131",I:"\u00cd\u00cc\u0130\u00ce\u00cf",o:"\u00f3\u00f2\u00f4\u00f5\u00f6",O:"\u00d3\u00d2\u00d4\u00d5\u00d6",ss:"\u00df",SS:"\u1e9e",u:"\u00fa\u00f9\u00fb\u00fc\u016f",U:"\u00da\u00d9\u00db\u00dc\u016e"};f.replaceAccents=function(a){var b,c="[",d=f.characterEquivalents;if(!f.characterRegex){f.characterRegexArray={};for(b in d)"string"===typeof b&&(c+=d[b],f.characterRegexArray[b]=RegExp("["+d[b]+"]","g"));f.characterRegex= RegExp(c+"]")}if(f.characterRegex.test(a))for(b in d)"string"===typeof b&&(a=a.replace(f.characterRegexArray[b],b));return a};f.isValueInArray=function(a,b){var c,d=b.length;for(c=0;c<d;c++)if(b[c][0]===a)return c;return-1};f.addParser=function(a){var b,c=f.parsers.length,d=!0;for(b=0;b<c;b++)f.parsers[b].id.toLowerCase()===a.id.toLowerCase()&&(d=!1);d&&f.parsers.push(a)};f.getParserById=function(a){var b,c=f.parsers.length;for(b=0;b<c;b++)if(f.parsers[b].id.toLowerCase()===a.toString().toLowerCase())return f.parsers[b]; return!1};f.addWidget=function(a){f.widgets.push(a)};f.getWidgetById=function(a){var b,c,d=f.widgets.length;for(b=0;b<d;b++)if((c=f.widgets[b])&&c.hasOwnProperty("id")&&c.id.toLowerCase()===a.toLowerCase())return c};f.applyWidget=function(a,b){a=g(a)[0];var c=a.config,d=c.widgetOptions,e=[],n,k,m;!1!==b&&a.hasInitialized&&(a.isApplyingWidgets||a.isUpdating)||(c.debug&&(n=new Date),c.widgets.length&&(a.isApplyingWidgets=!0,c.widgets=g.grep(c.widgets,function(a,b){return g.inArray(a,c.widgets)===b}), g.each(c.widgets||[],function(a,b){(m=f.getWidgetById(b))&&m.id&&(m.priority||(m.priority=10),e[a]=m)}),e.sort(function(a,b){return a.priority<b.priority?-1:a.priority===b.priority?0:1}),g.each(e,function(e,f){if(f){if(b||!c.widgetInit[f.id])f.hasOwnProperty("options")&&(d=a.config.widgetOptions=g.extend(!0,{},f.options,d)),f.hasOwnProperty("init")&&f.init(a,f,c,d),c.widgetInit[f.id]=!0;!b&&f.hasOwnProperty("format")&&f.format(a,c,d,!1)}})),setTimeout(function(){a.isApplyingWidgets=!1},0),c.debug&& (k=c.widgets.length,u("Completed "+(!0===b?"initializing ":"applying ")+k+" widget"+(1!==k?"s":""),n)))};f.refreshWidgets=function(a,b,c){a=g(a)[0];var h,e=a.config,n=e.widgets,k=f.widgets,m=k.length;for(h=0;h<m;h++)k[h]&&k[h].id&&(b||0>g.inArray(k[h].id,n))&&(e.debug&&d('Refeshing widgets: Removing "'+k[h].id+'"'),k[h].hasOwnProperty("remove")&&e.widgetInit[k[h].id]&&(k[h].remove(a,e,e.widgetOptions),e.widgetInit[k[h].id]=!1));!0!==c&&f.applyWidget(a,b)};f.getData=function(a,b,c){var d="";a=g(a); var e,f;if(!a.length)return"";e=g.metadata?a.metadata():!1;f=" "+(a.attr("class")||"");"undefined"!==typeof a.data(c)||"undefined"!==typeof a.data(c.toLowerCase())?d+=a.data(c)||a.data(c.toLowerCase()):e&&"undefined"!==typeof e[c]?d+=e[c]:b&&"undefined"!==typeof b[c]?d+=b[c]:" "!==f&&f.match(" "+c+"-")&&(d=f.match(RegExp("\\s"+c+"-([\\w-]+)"))[1]||"");return g.trim(d)};f.formatFloat=function(a,b){if("string"!==typeof a||""===a)return a;var c;a=(b&&b.config?!1!==b.config.usNumberFormat:"undefined"!== typeof b?b:1)?a.replace(/,/g,""):a.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(a)&&(a=a.replace(/^\s*\(([.\d]+)\)/,"-$1"));c=parseFloat(a);return isNaN(c)?g.trim(a):c};f.isDigit=function(a){return isNaN(a)?/^[\-+(]?\d+[)]?$/.test(a.toString().replace(/[,.'"\s]/g,"")):!0}}});var p=g.tablesorter;g.fn.extend({tablesorter:p.construct});p.addParser({id:"text",is:function(){return!0},format:function(d,u){var m=u.config;d&&(d=g.trim(m.ignoreCase?d.toLocaleLowerCase():d),d=m.sortLocaleCompare? p.replaceAccents(d):d);return d},type:"text"});p.addParser({id:"digit",is:function(d){return p.isDigit(d)},format:function(d,u){var m=p.formatFloat((d||"").replace(/[^\w,. \-()]/g,""),u);return d&&"number"===typeof m?m:d?g.trim(d&&u.config.ignoreCase?d.toLocaleLowerCase():d):d},type:"numeric"});p.addParser({id:"currency",is:function(d){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test((d||"").replace(/[+\-,. ]/g,""))},format:function(d,u){var m=p.formatFloat((d|| "").replace(/[^\w,. \-()]/g,""),u);return d&&"number"===typeof m?m:d?g.trim(d&&u.config.ignoreCase?d.toLocaleLowerCase():d):d},type:"numeric"});p.addParser({id:"ipAddress",is:function(d){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(d)},format:function(d,g){var m,w=d?d.split("."):"",r="",v=w.length;for(m=0;m<v;m++)r+=("00"+w[m]).slice(-3);return d?p.formatFloat(r,g):d},type:"numeric"});p.addParser({id:"url",is:function(d){return/^(https?|ftp|file):\/\//.test(d)},format:function(d){return d? g.trim(d.replace(/(https?|ftp|file):\/\//,"")):d},type:"text"});p.addParser({id:"isoDate",is:function(d){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/.test(d)},format:function(d,g){return d?p.formatFloat(""!==d?(new Date(d.replace(/-/g,"/"))).getTime()||d:"",g):d},type:"numeric"});p.addParser({id:"percent",is:function(d){return/(\d\s*?%|%\s*?\d)/.test(d)&&15>d.length},format:function(d,g){return d?p.formatFloat(d.replace(/%/g,""),g):d},type:"numeric"});p.addParser({id:"usLongDate",is:function(d){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(d)|| /^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i.test(d)},format:function(d,g){return d?p.formatFloat((new Date(d.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||d,g):d},type:"numeric"});p.addParser({id:"shortDate",is:function(d){return/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/.test((d||"").replace(/\s+/g," ").replace(/[\-.,]/g,"/"))},format:function(d,g,m,w){if(d){m=g.config;var r=m.$headers.filter("[data-column="+w+"]:last");w=r.length&&r[0].dateFormat||p.getData(r,m.headers[w],"dateFormat")|| m.dateFormat;d=d.replace(/\s+/g," ").replace(/[\-.,]/g,"/");"mmddyyyy"===w?d=d.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2"):"ddmmyyyy"===w?d=d.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1"):"yyyymmdd"===w&&(d=d.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"))}return d?p.formatFloat((new Date(d)).getTime()||d,g):d},type:"numeric"});p.addParser({id:"time",is:function(d){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(d)},format:function(d,g){return d? p.formatFloat((new Date("2000/01/01 "+d.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||d,g):d},type:"numeric"});p.addParser({id:"metadata",is:function(){return!1},format:function(d,p,m){d=p.config;d=d.parserMetadataName?d.parserMetadataName:"sortValue";return g(m).metadata()[d]},type:"numeric"});p.addWidget({id:"zebra",priority:90,format:function(d,u,m){var w,r,v,z,B,C,D=RegExp(u.cssChildRow,"i"),A=u.$tbodies;u.debug&&(B=new Date);for(d=0;d<A.length;d++)w=A.eq(d),C=w.children("tr").length,1<C&&(v= 0,w=w.children("tr:visible").not(u.selectorRemove),w.each(function(){r=g(this);D.test(this.className)||v++;z=0===v%2;r.removeClass(m.zebra[z?1:0]).addClass(m.zebra[z?0:1])}));u.debug&&p.benchmark("Applying Zebra widget",B)},remove:function(d,p,m){var w;p=p.$tbodies;var r=(m.zebra||["even","odd"]).join(" ");for(m=0;m<p.length;m++)w=g.tablesorter.processTbody(d,p.eq(m),!0),w.children().removeClass(r),g.tablesorter.processTbody(d,w,!1)}})}(jQuery);
| Sneezry/cdnjs | ajax/libs/jquery.tablesorter/2.16.0-beta/js/jquery.tablesorter.min.js | JavaScript | mit | 28,209 |
/*
* TableSorter 2.0 - Client-side table sorting with ease!
* Version 2.0.16 Minified using Google Closure Compiler (white space only)
* Copyright (c) 2007 Christian Bach
*/
(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[],tbl;this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",onRenderHeader:null,selectorHeaders:"thead th", tableClass:"tablesorter",debug:false};function log(s){if(typeof console!=="undefined"&&typeof console.debug!=="undefined")console.log(s);else alert(s)}function benchmark(s,d){log(s+","+((new Date).getTime()-d.getTime())+"ms")}this.benchmark=benchmark;function getElementText(config,node,cellIndex){var text="",te=config.textExtraction;if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(te==="simple")if(config.supportsTextContent)text=node.textContent; else if(node.childNodes[0]&&node.childNodes[0].hasChildNodes())text=node.childNodes[0].innerHTML;else text=node.innerHTML;else if(typeof te==="function")text=te(node);else if(typeof te==="object"&&te.hasOwnProperty(cellIndex))text=te[cellIndex](node);else text=$(node).text();return text}function getParserById(name){var i,l=parsers.length;for(i=0;i<l;i++)if(parsers[i].id.toLowerCase()===name.toLowerCase())return parsers[i];return false}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex]} function trimAndGetNodeText(config,node,cellIndex){return $.trim(getElementText(config,node,cellIndex))}function detectParserForColumn(table,rows,rowIndex,cellIndex){var i,l=parsers.length,node=false,nodeValue="",keepLooking=true;while(nodeValue===""&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node,cellIndex);if(table.config.debug)log("Checking if value was empty on row:"+rowIndex)}else keepLooking= false}for(i=1;i<l;i++)if(parsers[i].is(nodeValue,table,node))return parsers[i];return parsers[0]}function buildParserCache(table,$headers){if(table.tBodies.length===0)return;var rows=table.tBodies[0].rows,list,cells,l,h,i,p,parsersDebug="";if(rows[0]){list=[];cells=rows[0].cells;l=cells.length;for(i=0;i<l;i++){p=false;h=$($headers[i]);if($.metadata&&h.metadata()&&h.metadata().sorter)p=getParserById(h.metadata().sorter);else if(table.config.headers[i]&&table.config.headers[i].sorter)p=getParserById(table.config.headers[i].sorter); else if(h.attr("class")&&h.attr("class").match("sorter-"))p=getParserById(h.attr("class").match(/sorter-(\w+)/)[1]||"");if(!p)p=detectParserForColumn(table,rows,-1,i);if(table.config.debug)parsersDebug+="column:"+i+" parser:"+p.id+"\n";list.push(p)}}if(table.config.debug)log(parsersDebug);return list}function buildCache(table){var b=table.tBodies[0],totalRows=b&&b.rows.length||0,totalCells=b.rows[0]&&b.rows[0].cells.length||0,parsers=table.config.parsers,cache={row:[],normalized:[]},i,j,c,cols,cacheTime; if(table.config.debug)cacheTime=new Date;for(i=0;i<totalRows;++i){c=$(b.rows[i]);cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue}cache.row.push(c);for(j=0;j<totalCells;++j)cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j],j),table,c[0].cells[j]));cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null}if(table.config.debug)benchmark("Building cache for "+totalRows+" rows:",cacheTime); return cache}function getWidgetById(name){var i,l=widgets.length;for(i=0;i<l;i++)if(widgets[i].id.toLowerCase()===name.toLowerCase())return widgets[i]}function applyWidget(table){var c=table.config.widgets,i,l=c.length;for(i=0;i<l;i++)getWidgetById(c[i]).format(table)}function appendToTable(table,cache){var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=totalRows?n[0].length-1:0,tableBody=$(table.tBodies[0]),rows=[],i,j,l,pos,appendTime;if(table.config.debug)appendTime=new Date;for(i= 0;i<totalRows;i++){pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){l=r[pos].length;for(j=0;j<l;j++)tableBody[0].appendChild(r[pos][j])}}if(table.config.appender)table.config.appender(table,rows);rows=null;if(table.config.debug)benchmark("Rebuilt table:",appendTime);applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd",table)},0)}function computeTableHeaderCellIndexes(t){var matrix=[],lookup={},thead=t.getElementsByTagName("THEAD")[0],trs=thead.getElementsByTagName("TR"), i,j,k,l,c,cells,rowIndex,cellId,rowSpan,colSpan,firstAvailCol,matrixrow;for(i=0;i<trs.length;i++){cells=trs[i].cells;for(j=0;j<cells.length;j++){c=cells[j];rowIndex=c.parentNode.rowIndex;cellId=rowIndex+"-"+c.cellIndex;rowSpan=c.rowSpan||1;colSpan=c.colSpan||1;if(typeof matrix[rowIndex]==="undefined")matrix[rowIndex]=[];for(k=0;k<matrix[rowIndex].length+1;k++)if(typeof matrix[rowIndex][k]==="undefined"){firstAvailCol=k;break}lookup[cellId]=firstAvailCol;for(k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof matrix[k]=== "undefined")matrix[k]=[];matrixrow=matrix[k];for(l=firstAvailCol;l<firstAvailCol+colSpan;l++)matrixrow[l]="x"}}}return lookup}function formatSortingOrder(v){if(typeof v!=="number")return v.toLowerCase().charAt(0)==="d"?1:0;else return v===1?1:0}function checkHeaderMetadata(cell){return $.metadata&&$(cell).metadata().sorter===false}function checkHeaderOptions(table,i){return table.config.headers[i]&&table.config.headers[i].sorter===false}function checkHeaderLocked(table,i){if(table.config.headers[i]&& table.config.headers[i].lockedOrder!==null)return table.config.headers[i].lockedOrder;return false}function checkHeaderOrder(table,i){if(table.config.headers[i]&&table.config.headers[i].sortInitialOrder)return table.config.headers[i].sortInitialOrder;return table.config.sortInitialOrder}function buildHeaders(table){var meta=$.metadata?true:false,header_index=computeTableHeaderCellIndexes(table),$th,lock,time,$tableHeaders;if(table.config.debug)time=new Date;$tableHeaders=$(table.config.selectorHeaders, table).wrapInner("<span/>").each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(table,index));this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index)||$(this).is(".sorter-false"))this.sortDisabled=true;this.lockedOrder=false;lock=checkHeaderLocked(table,index);if(typeof lock!=="undefined"&&lock!==false)this.order=this.lockedOrder=formatSortingOrder(lock);if(!this.sortDisabled){$th=$(this).addClass(table.config.cssHeader); if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th,[index])}table.config.headerList[index]=this});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(table,rows,row){var i,cell,arr=[],r=table.tHead.rows,c=r[row].cells;for(i=0;i<c.length;i++){cell=c[i];if(cell.colSpan>1)arr=arr.concat(checkCellColSpan(table,rows,row++));else if(table.tHead.length===1||cell.rowSpan>1||!r[row+1])arr.push(cell)}return arr}function isValueInArray(v, a){var i,l=a.length;for(i=0;i<l;i++)if(a[i][0]===v)return true;return false}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[],i,l;$headers.each(function(offset){if(!this.sortDisabled)h[this.column]=$(this)});l=list.length;for(i=0;i<l;i++)h[list[i][0]].addClass(css[list[i][1]])}function fixColumnWidth(table,$headers){var c=table.config,colgroup;if(c.widthFixed){colgroup=$("<colgroup>");$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($("<col>").css("width", $(this).width()))});$(table).prepend(colgroup)}}function updateHeaderSortCount(table,sortList){var i,s,o,c=table.config,l=sortList.length;for(i=0;i<l;i++){s=sortList[i];o=c.headerList[s[0]];o.count=s[1];o.count++}}function getCachedSortType(parsers,i){return parsers?parsers[i].type:""}function multisort(table,sortList,cache){var dynamicExp="var sortWrapper = function(a,b) {",col,mx=0,dir=0,tc=table.config,lc=cache.normalized.length,l=sortList.length,sortTime,i,j,c,s,e,order,orgOrderCol;if(tc.debug)sortTime= new Date;for(i=0;i<l;i++){c=sortList[i][0];order=sortList[i][1];s=getCachedSortType(tc.parsers,c)==="text"?order===0?"sortText":"sortTextDesc":order===0?"sortNumeric":"sortNumericDesc";e="e"+i;if(/Numeric/.test(s)&&tc.headers[c]&&tc.headers[c].string){for(j=0;j<lc;j++){col=Math.abs(parseFloat(cache.normalized[j][c]));mx=Math.max(mx,isNaN(col)?0:col)}dir=tc.headers[c]?tc.string[tc.headers[c].string]||0:0}dynamicExp+="var "+e+" = "+s+"(a["+c+"],b["+c+"],"+mx+","+dir+"); ";dynamicExp+="if ("+e+") { return "+ e+"; } ";dynamicExp+="else { "}orgOrderCol=cache.normalized&&cache.normalized[0]?cache.normalized[0].length-1:0;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++)dynamicExp+="}; ";dynamicExp+="return 0; ";dynamicExp+="}; ";eval(dynamicExp);cache.normalized.sort(sortWrapper);if(tc.debug)benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);return cache}function sortText(a,b){if($.data(tbl[0],"tablesorter").sortLocaleCompare)return a.localeCompare(b); if(a===b)return 0;try{var cnt=0,ax,t,x=/^(\.)?\d/,L=Math.min(a.length,b.length)+1;while(cnt<L&&a.charAt(cnt)===b.charAt(cnt)&&x.test(b.substring(cnt))===false&&x.test(a.substring(cnt))===false)cnt++;a=a.substring(cnt);b=b.substring(cnt);if(x.test(a)||x.test(b))if(x.test(a)===false)return a?1:-1;else if(x.test(b)===false)return b?-1:1;else{t=parseFloat(a)-parseFloat(b);if(t!==0)return t;else t=a.search(/[^\.\d]/);if(t===-1)t=b.search(/[^\.\d]/);a=a.substring(t);b=b.substring(t)}return a>b?1:-1}catch(er){return 0}} function sortTextDesc(a,b){if($.data(tbl[0],"tablesorter").sortLocaleCompare)return b.localeCompare(a);return-sortText(a,b)}function getTextValue(a,mx,d){if(a==="")return(d||0)*Number.MAX_VALUE;if(mx){var i,l=a.length,n=mx+d;for(i=0;i<l;i++)n+=a.charCodeAt(i);return d*n}return 0}function sortNumeric(a,b,mx,d){if(a===""||isNaN(a))a=getTextValue(a,mx,d);if(b===""||isNaN(b))b=getTextValue(b,mx,d);return a-b}function sortNumericDesc(a,b,mx,d){if(a===""||isNaN(a))a=getTextValue(a,mx,d);if(b===""||isNaN(b))b= getTextValue(b,mx,d);return b-a}this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder,sortCSS,totalRows,$cell,i,j,a,s,o;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);tbl=$this=$(this).addClass(this.config.tableClass);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);this.config.string={max:1,"max+":1, "max-":-1,none:0};cache=buildCache(this);sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){totalRows=$this[0].tBodies[0]&&$this[0].tBodies[0].rows.length||0;if(!this.sortDisabled){$this.trigger("sortStart",tbl[0]);$cell=$(this);i=this.column;this.order=this.count++%2;if(typeof this.lockedOrder!=="undefined"&&this.lockedOrder!==false)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!==null){a=config.sortForce;for(j= 0;j<a.length;j++)if(a[j][0]!==i)config.sortList.push(a[j])}config.sortList.push([i,this.order])}else if(isValueInArray(i,config.sortList))for(j=0;j<config.sortList.length;j++){s=config.sortList[j];o=config.headerList[s[0]];if(s[0]===i){o.count=s[1];o.count++;s[1]=o.count%2}}else config.sortList.push([i,this.order]);if(config.sortAppend!==null){a=config.sortAppend;for(j=0;j<a.length;j++)if(a[j][0]!==i)config.sortList.push(a[j])}setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList, sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache))},1);return false}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);$this.trigger("sorton",[me.config.sortList])},1)}).bind("updateCell",function(e,cell){var config=this.config,pos=[cell.parentNode.rowIndex-1,cell.cellIndex];cache.normalized[pos[0]][pos[1]]= config.parsers[pos[1]].format(getElementText(config,cell,pos[1]),cell);$this.trigger("sorton",[config.sortList])}).bind("addRows",function(e,row){var i,config=this.config,rows=row.filter("tr").length,dat=[],l=row[0].cells.length;for(i=0;i<rows;i++){for(j=0;j<l;j++)dat[j]=config.parsers[j].format(getElementText(config,row[i].cells[j],j),row[i].cells[j]);dat.push(cache.row.length);cache.row.push([row[i]]);cache.normalized.push(dat);dat=[]}$this.trigger("sorton",[config.sortList])}).bind("sorton",function(e, list){$(this).trigger("sortStart",tbl[0]);config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache))}).bind("appendCache",function(){appendToTable(this,cache)}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this)}).bind("applyWidgets",function(){applyWidget(this)});if($.metadata&&$(this).metadata()&&$(this).metadata().sortlist)config.sortList=$(this).metadata().sortlist; if(config.sortList.length>0)$this.trigger("sorton",[config.sortList]);applyWidget(this)})};this.addParser=function(parser){var i,l=parsers.length,a=true;for(i=0;i<l;i++)if(parsers[i].id.toLowerCase()===parser.id.toLowerCase())a=false;if(a)parsers.push(parser)};this.addWidget=function(widget){widgets.push(widget)};this.formatFloat=function(s){var i=parseFloat(s);return isNaN(i)?$.trim(s):i};this.isDigit=function(s){return/^[\-+]?\d*$/.test($.trim(s.replace(/[,.']/g,"")))};this.clearTableBody=function(table){if($.browser.msie){var empty= function(){while(this.firstChild)this.removeChild(this.firstChild)};empty.apply(table.tBodies[0])}else table.tBodies[0].innerHTML=""}}})();$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true},format:function(s){return $.trim(s.toLocaleLowerCase())},type:"text"});ts.addParser({id:"digit",is:function(s){return $.tablesorter.isDigit(s.replace(/,/g,""))},format:function(s){return $.tablesorter.formatFloat(s.replace(/,/g,""))},type:"numeric"}); ts.addParser({id:"currency",is:function(s){return/^[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/.test(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.\-]/g),""))},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s)},format:function(s){var i,item,a=s.split("."),r="",l=a.length;for(i=0;i<l;i++){item=a[i];if(item.length===2)r+="0"+item;else r+=item}return $.tablesorter.formatFloat(r)},type:"numeric"});ts.addParser({id:"url", is:function(s){return/^(https?|ftp|file):\/\/$/.test(s)},format:function(s){return $.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),""))},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(s)},format:function(s){return $.tablesorter.formatFloat(s!==""?(new Date(s.replace(new RegExp(/-/g),"/"))).getTime():"0")},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s))},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), ""))},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(s){return $.tablesorter.formatFloat((new Date(s)).getTime())},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s)},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat==="us")s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2");else if(c.dateFormat==="uk")s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");else if(c.dateFormat==="dd/mm/yy"||c.dateFormat==="dd-mm-yy")s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");return $.tablesorter.formatFloat((new Date(s)).getTime())},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s)},format:function(s){return $.tablesorter.formatFloat((new Date("2000/01/01 "+s)).getTime())}, type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false},format:function(s,table,cell){var c=table.config,p=!c.parserMetadataName?"sortValue":c.parserMetadataName;return $(cell).metadata()[p]},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){var $tr,row=-1,odd,time;if(table.config.debug)time=new Date;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=row%2===0;$tr.removeClass(table.config.widgetZebra.css[odd? 0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug)$.tablesorter.benchmark("Applying Zebra widget",time)}})})(jQuery);
| ramda/cdnjs | ajax/libs/jquery.tablesorter/2.0.16/js/jquery.tablesorter.min.js | JavaScript | mit | 17,380 |
/**
* jqGrid Chinese Translation
* 咖啡兔 yanhonglei@gmail.com
* http://www.kafeitu.me
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
/*jslint white: true */
/*global jQuery */
(function($){
"use strict";
var locInfo = {
isRTL: false,
defaults : {
recordtext: "{0} - {1}\u3000共 {2} 条", // 共字前是全角空格
emptyrecords: "无数据显示",
loadtext: "读取中...",
pgtext : " {0} 共 {1} 页",
pgfirst : "First Page",
pglast : "Last Page",
pgnext : "Next Page",
pgprev : "Previous Page",
pgrecs : "Records per Page",
showhide: "Toggle Expand Collapse Grid",
savetext: "正在保存..."
},
search : {
caption: "搜索...",
Find: "查找",
Reset: "重置",
odata: [{ oper:'eq', text:'等于\u3000\u3000'},{ oper:'ne', text:'不等\u3000\u3000'},{ oper:'lt', text:'小于\u3000\u3000'},{ oper:'le', text:'小于等于'},{ oper:'gt', text:'大于\u3000\u3000'},{ oper:'ge', text:'大于等于'},{ oper:'bw', text:'开始于'},{ oper:'bn', text:'不开始于'},{ oper:'in', text:'属于\u3000\u3000'},{ oper:'ni', text:'不属于'},{ oper:'ew', text:'结束于'},{ oper:'en', text:'不结束于'},{ oper:'cn', text:'包含\u3000\u3000'},{ oper:'nc', text:'不包含'},{ oper:'nu', text:'不存在'},{ oper:'nn', text:'存在'}],
groupOps: [ { op: "AND", text: "所有" }, { op: "OR", text: "任一" } ],
operandTitle : "Click to select search operation.",
resetTitle : "Reset Search Value"
},
edit : {
addCaption: "添加记录",
editCaption: "编辑记录",
bSubmit: "提交",
bCancel: "取消",
bClose: "关闭",
saveData: "数据已改变,是否保存?",
bYes : "是",
bNo : "否",
bExit : "取消",
msg: {
required:"此字段必需",
number:"请输入有效数字",
minValue:"输值必须大于等于 ",
maxValue:"输值必须小于等于 ",
email: "这不是有效的e-mail地址",
integer: "请输入有效整数",
date: "请输入有效时间",
url: "无效网址。前缀必须为 ('http://' 或 'https://')",
nodefined : " 未定义!",
novalue : " 需要返回值!",
customarray : "自定义函数需要返回数组!",
customfcheck : "必须有自定义函数!"
}
},
view : {
caption: "查看记录",
bClose: "关闭"
},
del : {
caption: "删除",
msg: "删除所选记录?",
bSubmit: "删除",
bCancel: "取消"
},
nav : {
edittext: "",
edittitle: "编辑所选记录",
addtext:"",
addtitle: "添加新记录",
deltext: "",
deltitle: "删除所选记录",
searchtext: "",
searchtitle: "查找",
refreshtext: "",
refreshtitle: "刷新表格",
alertcap: "注意",
alerttext: "请选择记录",
viewtext: "",
viewtitle: "查看所选记录"
},
col : {
caption: "选择列",
bSubmit: "确定",
bCancel: "取消"
},
errors : {
errcap : "错误",
nourl : "没有设置url",
norecords: "没有要处理的记录",
model : "colNames 和 colModel 长度不等!"
},
formatter : {
integer : {thousandsSeparator: ",", defaultValue: '0'},
number : {decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, defaultValue: '0.00'},
currency : {decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
date : {
dayNames: [
"日", "一", "二", "三", "四", "五", "六",
"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"
],
monthNames: [
"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二",
"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
],
AmPm : ["am","pm","上午","下午"],
S: function () {return "";},
srcformat: 'Y-m-d',
newformat: 'Y-m-d',
masks : {
// see http://php.net/manual/en/function.date.php for PHP format used in jqGrid
// and see http://docs.jquery.com/UI/Datepicker/formatDate
// and https://github.com/jquery/globalize#dates for alternative formats used frequently
// one can find on https://github.com/jquery/globalize/tree/master/lib/cultures many
// information about date, time, numbers and currency formats used in different countries
// one should just convert the information in PHP format
// short date:
// n - Numeric representation of a month, without leading zeros
// j - Day of the month without leading zeros
// Y - A full numeric representation of a year, 4 digits
// example: 3/1/2012 which means 1 March 2012
ShortDate: "n/j/Y", // in jQuery UI Datepicker: "M/d/yyyy"
// long date:
// l - A full textual representation of the day of the week
// F - A full textual representation of a month
// d - Day of the month, 2 digits with leading zeros
// Y - A full numeric representation of a year, 4 digits
LongDate: "l, F d, Y", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy"
// long date with long time:
// l - A full textual representation of the day of the week
// F - A full textual representation of a month
// d - Day of the month, 2 digits with leading zeros
// Y - A full numeric representation of a year, 4 digits
// g - 12-hour format of an hour without leading zeros
// i - Minutes with leading zeros
// s - Seconds, with leading zeros
// A - Uppercase Ante meridiem and Post meridiem (AM or PM)
FullDateTime: "l, F d, Y g:i:s A", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy h:mm:ss tt"
// month day:
// F - A full textual representation of a month
// d - Day of the month, 2 digits with leading zeros
MonthDay: "F d", // in jQuery UI Datepicker: "MMMM dd"
// short time (without seconds)
// g - 12-hour format of an hour without leading zeros
// i - Minutes with leading zeros
// A - Uppercase Ante meridiem and Post meridiem (AM or PM)
ShortTime: "g:i A", // in jQuery UI Datepicker: "h:mm tt"
// long time (with seconds)
// g - 12-hour format of an hour without leading zeros
// i - Minutes with leading zeros
// s - Seconds, with leading zeros
// A - Uppercase Ante meridiem and Post meridiem (AM or PM)
LongTime: "g:i:s A", // in jQuery UI Datepicker: "h:mm:ss tt"
// month with year
// Y - A full numeric representation of a year, 4 digits
// F - A full textual representation of a month
YearMonth: "F, Y" // in jQuery UI Datepicker: "MMMM, yyyy"
}
}
}
};
$.jgrid = $.jgrid || {};
$.extend(true, $.jgrid, {
defaults: {
locale: "cn"
},
locales: {
// In general the property name is free, but it's recommended to use the names based on
// http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
// http://rishida.net/utils/subtags/ and RFC 5646. See Appendix A of RFC 5646 for examples.
// One can use the lang attribute to specify language tags in HTML, and the xml:lang attribute for XML
// if it exists. See http://www.w3.org/International/articles/language-tags/#extlang
cn: $.extend({}, locInfo, { name: "中文", nameEnglish: "Chinese" }),
zh: $.extend({}, locInfo, { name: "中文", nameEnglish: "Chinese" }),
"zh-CN": $.extend({}, locInfo, { name: "中文(中华人民共和国)", nameEnglish: "Chinese (Simplified, PRC)" })
}
});
}(jQuery));
| Asaf-S/jsdelivr | files/free-jqgrid/4.9.0-rc1/js/i18n/grid.locale-cn.js | JavaScript | mit | 8,664 |
/*1.5.7*/
(function(){var f=0,k=[],m={},i={},a={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},l=/[<>&\"\']/g,b,c=window.setTimeout,d={},e;function h(){this.returnValue=false}function j(){this.cancelBubble=true}(function(n){var o=n.split(/,/),p,r,q;for(p=0;p<o.length;p+=2){q=o[p+1].split(/ /);for(r=0;r<q.length;r++){i[q[r]]=o[p]}}})("application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,audio/mp4,m4a,image/bmp,bmp,image/gif,gif,image/jpeg,jpeg jpg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe");var g={VERSION:"1.5.7",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,IMAGE_FORMAT_ERROR:-700,IMAGE_MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:i,ua:(function(){var r=navigator,q=r.userAgent,s=r.vendor,o,n,p;o=/WebKit/.test(q);p=o&&s.indexOf("Apple")!==-1;n=window.opera&&window.opera.buildNumber;return{windows:navigator.platform.indexOf("Win")!==-1,android:/Android/.test(q),ie:!o&&!n&&(/MSIE/gi).test(q)&&(/Explorer/gi).test(r.appName),webkit:o,gecko:!o&&/Gecko/.test(q),safari:p,opera:!!n}}()),typeOf:function(n){return({}).toString.call(n).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()},extend:function(n){g.each(arguments,function(o,p){if(p>0){g.each(o,function(r,q){n[q]=r})}});return n},cleanName:function(n){var o,p;p=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(o=0;o<p.length;o+=2){n=n.replace(p[o],p[o+1])}n=n.replace(/\s+/g,"_");n=n.replace(/[^a-z0-9_\-\.]+/gi,"");return n},addRuntime:function(n,o){o.name=n;k[n]=o;k.push(o);return o},guid:function(){var n=new Date().getTime().toString(32),o;for(o=0;o<5;o++){n+=Math.floor(Math.random()*65535).toString(32)}return(g.guidPrefix||"p")+n+(f++).toString(32)},buildUrl:function(o,n){var p="";g.each(n,function(r,q){p+=(p?"&":"")+encodeURIComponent(q)+"="+encodeURIComponent(r)});if(p){o+=(o.indexOf("?")>0?"&":"?")+p}return o},each:function(q,r){var p,o,n;if(q){p=q.length;if(p===b){for(o in q){if(q.hasOwnProperty(o)){if(r(q[o],o)===false){return}}}}else{for(n=0;n<p;n++){if(r(q[n],n)===false){return}}}}},formatSize:function(n){if(n===b||/\D/.test(n)){return g.translate("N/A")}if(n>1073741824){return Math.round(n/1073741824,1)+" GB"}if(n>1048576){return Math.round(n/1048576,1)+" MB"}if(n>1024){return Math.round(n/1024,1)+" KB"}return n+" b"},getPos:function(o,s){var t=0,r=0,v,u=document,p,q;o=o;s=s||u.body;function n(B){var z,A,w=0,C=0;if(B){A=B.getBoundingClientRect();z=u.compatMode==="CSS1Compat"?u.documentElement:u.body;w=A.left+z.scrollLeft;C=A.top+z.scrollTop}return{x:w,y:C}}if(o&&o.getBoundingClientRect&&g.ua.ie&&(!u.documentMode||u.documentMode<8)){p=n(o);q=n(s);return{x:p.x-q.x,y:p.y-q.y}}v=o;while(v&&v!=s&&v.nodeType){t+=v.offsetLeft||0;r+=v.offsetTop||0;v=v.offsetParent}v=o.parentNode;while(v&&v!=s&&v.nodeType){t-=v.scrollLeft||0;r-=v.scrollTop||0;v=v.parentNode}return{x:t,y:r}},getSize:function(n){return{w:n.offsetWidth||n.clientWidth,h:n.offsetHeight||n.clientHeight}},parseSize:function(n){var o;if(typeof(n)=="string"){n=/^([0-9]+)([mgk]?)$/.exec(n.toLowerCase().replace(/[^0-9mkg]/g,""));o=n[2];n=+n[1];if(o=="g"){n*=1073741824}if(o=="m"){n*=1048576}if(o=="k"){n*=1024}}return n},xmlEncode:function(n){return n?(""+n).replace(l,function(o){return a[o]?"&"+a[o]+";":o}):n},toArray:function(p){var o,n=[];for(o=0;o<p.length;o++){n[o]=p[o]}return n},inArray:function(p,q){if(q){if(Array.prototype.indexOf){return Array.prototype.indexOf.call(q,p)}for(var n=0,o=q.length;n<o;n++){if(q[n]===p){return n}}}return -1},addI18n:function(n){return g.extend(m,n)},translate:function(n){return m[n]||n},isEmptyObj:function(n){if(n===b){return true}for(var o in n){return false}return true},hasClass:function(p,o){var n;if(p.className==""){return false}n=new RegExp("(^|\\s+)"+o+"(\\s+|$)");return n.test(p.className)},addClass:function(o,n){if(!g.hasClass(o,n)){o.className=o.className==""?n:o.className.replace(/\s+$/,"")+" "+n}},removeClass:function(p,o){var n=new RegExp("(^|\\s+)"+o+"(\\s+|$)");p.className=p.className.replace(n,function(r,q,s){return q===" "&&s===" "?" ":""})},getStyle:function(o,n){if(o.currentStyle){return o.currentStyle[n]}else{if(window.getComputedStyle){return window.getComputedStyle(o,null)[n]}}},addEvent:function(s,n,t){var r,q,p,o;o=arguments[3];n=n.toLowerCase();if(e===b){e="Plupload_"+g.guid()}if(s.addEventListener){r=t;s.addEventListener(n,r,false)}else{if(s.attachEvent){r=function(){var u=window.event;if(!u.target){u.target=u.srcElement}u.preventDefault=h;u.stopPropagation=j;t(u)};s.attachEvent("on"+n,r)}}if(s[e]===b){s[e]=g.guid()}if(!d.hasOwnProperty(s[e])){d[s[e]]={}}q=d[s[e]];if(!q.hasOwnProperty(n)){q[n]=[]}q[n].push({func:r,orig:t,key:o})},removeEvent:function(s,n){var q,t,p;if(typeof(arguments[2])=="function"){t=arguments[2]}else{p=arguments[2]}n=n.toLowerCase();if(s[e]&&d[s[e]]&&d[s[e]][n]){q=d[s[e]][n]}else{return}for(var o=q.length-1;o>=0;o--){if(q[o].key===p||q[o].orig===t){if(s.removeEventListener){s.removeEventListener(n,q[o].func,false)}else{if(s.detachEvent){s.detachEvent("on"+n,q[o].func)}}q[o].orig=null;q[o].func=null;q.splice(o,1);if(t!==b){break}}}if(!q.length){delete d[s[e]][n]}if(g.isEmptyObj(d[s[e]])){delete d[s[e]];try{delete s[e]}catch(r){s[e]=b}}},removeAllEvents:function(o){var n=arguments[1];if(o[e]===b||!o[e]){return}g.each(d[o[e]],function(q,p){g.removeEvent(o,p,n)})}};g.Uploader=function(r){var o={},u,t=[],q,p=false;u=new g.QueueProgress();r=g.extend({chunk_size:0,multipart:true,multi_selection:true,file_data_name:"file",filters:[]},r);function s(){var w,x=0,v;if(this.state==g.STARTED){for(v=0;v<t.length;v++){if(!w&&t[v].status==g.QUEUED){w=t[v];w.status=g.UPLOADING;if(this.trigger("BeforeUpload",w)){this.trigger("UploadFile",w)}}else{x++}}if(x==t.length){this.stop();this.trigger("UploadComplete",t)}}}function n(){var w,v;u.reset();for(w=0;w<t.length;w++){v=t[w];if(v.size!==b){u.size+=v.size;u.loaded+=v.loaded}else{u.size=b}if(v.status==g.DONE){u.uploaded++}else{if(v.status==g.FAILED){u.failed++}else{u.queued++}}}if(u.size===b){u.percent=t.length>0?Math.ceil(u.uploaded/t.length*100):0}else{u.bytesPerSec=Math.ceil(u.loaded/((+new Date()-q||1)/1000));u.percent=u.size>0?Math.ceil(u.loaded/u.size*100):0}}g.extend(this,{state:g.STOPPED,runtime:"",features:{},files:t,settings:r,total:u,id:g.guid(),init:function(){var A=this,B,x,w,z=0,y;if(typeof(r.preinit)=="function"){r.preinit(A)}else{g.each(r.preinit,function(D,C){A.bind(C,D)})}r.page_url=r.page_url||document.location.pathname.replace(/\/[^\/]+$/g,"/");if(!/^(\w+:\/\/|\/)/.test(r.url)){r.url=r.page_url+r.url}r.chunk_size=g.parseSize(r.chunk_size);r.max_file_size=g.parseSize(r.max_file_size);A.bind("FilesAdded",function(C,F){var E,D,H=0,I,G=r.filters;if(G&&G.length){I=[];g.each(G,function(J){g.each(J.extensions.split(/,/),function(K){if(/^\s*\*\s*$/.test(K)){I.push("\\.*")}else{I.push("\\."+K.replace(new RegExp("["+("/^$.*+?|()[]{}\\".replace(/./g,"\\$&"))+"]","g"),"\\$&"))}})});I=new RegExp(I.join("|")+"$","i")}for(E=0;E<F.length;E++){D=F[E];D.loaded=0;D.percent=0;D.status=g.QUEUED;if(I&&!I.test(D.name)){C.trigger("Error",{code:g.FILE_EXTENSION_ERROR,message:g.translate("File extension error."),file:D});continue}if(D.size!==b&&D.size>r.max_file_size){C.trigger("Error",{code:g.FILE_SIZE_ERROR,message:g.translate("File size error."),file:D});continue}t.push(D);H++}if(H){c(function(){A.trigger("QueueChanged");A.refresh()},1)}else{return false}});if(r.unique_names){A.bind("UploadFile",function(C,D){var F=D.name.match(/\.([^.]+)$/),E="tmp";if(F){E=F[1]}D.target_name=D.id+"."+E})}A.bind("UploadProgress",function(C,D){D.percent=D.size>0?Math.ceil(D.loaded/D.size*100):100;n()});A.bind("StateChanged",function(C){if(C.state==g.STARTED){q=(+new Date())}else{if(C.state==g.STOPPED){for(B=C.files.length-1;B>=0;B--){if(C.files[B].status==g.UPLOADING){C.files[B].status=g.QUEUED;n()}}}}});A.bind("QueueChanged",n);A.bind("Error",function(C,D){if(D.file){D.file.status=g.FAILED;n();if(C.state==g.STARTED){c(function(){s.call(A)},1)}}});A.bind("FileUploaded",function(C,D){D.status=g.DONE;D.loaded=D.size;C.trigger("UploadProgress",D);c(function(){s.call(A)},1)});if(r.runtimes){x=[];y=r.runtimes.split(/\s?,\s?/);for(B=0;B<y.length;B++){if(k[y[B]]){x.push(k[y[B]])}}}else{x=k}function v(){var F=x[z++],E,C,D;if(F){E=F.getFeatures();C=A.settings.required_features;if(C){C=C.split(",");for(D=0;D<C.length;D++){if(!E[C[D]]){v();return}}}F.init(A,function(G){if(G&&G.success){A.features=E;A.runtime=F.name;A.trigger("Init",{runtime:F.name});A.trigger("PostInit");A.refresh()}else{v()}})}else{A.trigger("Error",{code:g.INIT_ERROR,message:g.translate("Init error.")})}}v();if(typeof(r.init)=="function"){r.init(A)}else{g.each(r.init,function(D,C){A.bind(C,D)})}},refresh:function(){this.trigger("Refresh")},start:function(){if(t.length&&this.state!=g.STARTED){this.state=g.STARTED;this.trigger("StateChanged");s.call(this)}},stop:function(){if(this.state!=g.STOPPED){this.state=g.STOPPED;this.trigger("CancelUpload");this.trigger("StateChanged")}},disableBrowse:function(){p=arguments[0]!==b?arguments[0]:true;this.trigger("DisableBrowse",p)},getFile:function(w){var v;for(v=t.length-1;v>=0;v--){if(t[v].id===w){return t[v]}}},removeFile:function(w){var v;for(v=t.length-1;v>=0;v--){if(t[v].id===w.id){return this.splice(v,1)[0]}}},splice:function(x,v){var w;w=t.splice(x===b?0:x,v===b?t.length:v);this.trigger("FilesRemoved",w);this.trigger("QueueChanged");return w},trigger:function(w){var y=o[w.toLowerCase()],x,v;if(y){v=Array.prototype.slice.call(arguments);v[0]=this;for(x=0;x<y.length;x++){if(y[x].func.apply(y[x].scope,v)===false){return false}}}return true},hasEventListener:function(v){return !!o[v.toLowerCase()]},bind:function(v,x,w){var y;v=v.toLowerCase();y=o[v]||[];y.push({func:x,scope:w||this});o[v]=y},unbind:function(v){v=v.toLowerCase();var y=o[v],w,x=arguments[1];if(y){if(x!==b){for(w=y.length-1;w>=0;w--){if(y[w].func===x){y.splice(w,1);break}}}else{y=[]}if(!y.length){delete o[v]}}},unbindAll:function(){var v=this;g.each(o,function(x,w){v.unbind(w)})},destroy:function(){this.stop();this.trigger("Destroy");this.unbindAll()}})};g.File=function(q,o,p){var n=this;n.id=q;n.name=o;n.size=p;n.loaded=0;n.percent=0;n.status=0};g.Runtime=function(){this.getFeatures=function(){};this.init=function(n,o){}};g.QueueProgress=function(){var n=this;n.size=0;n.loaded=0;n.uploaded=0;n.failed=0;n.queued=0;n.percent=0;n.bytesPerSec=0;n.reset=function(){n.size=n.loaded=n.uploaded=n.failed=n.queued=n.percent=n.bytesPerSec=0}};g.runtimes={};window.plupload=g})(); | ramda/jsdelivr | files/wordpress/3.6.1/js/plupload/plupload.js | JavaScript | mit | 11,948 |
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();
| littlstar/axis | public/doc/littlstar-axis/1.22.0/scripts/prettify/prettify.js | JavaScript | mit | 13,632 |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Security.Cryptography
{
/// <summary>
/// Specifies the padding mode to use with RSA signature creation or verification operations.
/// </summary>
public enum RSASignaturePaddingMode
{
/// <summary>
/// PKCS #1 v1.5.
/// </summary>
/// <remarks>
/// This corresponds to the RSASSA-PKCS1-v1.5 signature scheme of the PKCS #1 RSA Encryption Standard.
/// It is supported for compatibility with existing applications.
/// </remarks>
Pkcs1,
/// <summary>
/// Probabilistic Signature Scheme.
/// </summary>
/// <remarks>
/// This corresponds to the RSASSA-PKCS1-v1.5 signature scheme of the PKCS #1 RSA Encryption Standard.
/// It is recommended for new applications.
/// </remarks>
Pss,
}
}
| tstringer/corefx | src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSASignaturePaddingMode.cs | C# | mit | 1,061 |
/*
* JsSIP v0.6.25
* the Javascript SIP library
* Copyright: 2012-2015 José Luis Millán <jmillan@aliax.net> (https://github.com/jmillan)
* Homepage: http://jssip.net
* License: MIT
*/
(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.JsSIP = 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){
var pkg = require('../package.json');
var C = {
USER_AGENT: pkg.title + ' ' + pkg.version,
// SIP scheme
SIP: 'sip',
SIPS: 'sips',
// End and Failure causes
causes: {
// Generic error causes
CONNECTION_ERROR: 'Connection Error',
REQUEST_TIMEOUT: 'Request Timeout',
SIP_FAILURE_CODE: 'SIP Failure Code',
INTERNAL_ERROR: 'Internal Error',
// SIP error causes
BUSY: 'Busy',
REJECTED: 'Rejected',
REDIRECTED: 'Redirected',
UNAVAILABLE: 'Unavailable',
NOT_FOUND: 'Not Found',
ADDRESS_INCOMPLETE: 'Address Incomplete',
INCOMPATIBLE_SDP: 'Incompatible SDP',
MISSING_SDP: 'Missing SDP',
AUTHENTICATION_ERROR: 'Authentication Error',
// Session error causes
BYE: 'Terminated',
WEBRTC_ERROR: 'WebRTC Error',
CANCELED: 'Canceled',
NO_ANSWER: 'No Answer',
EXPIRES: 'Expires',
NO_ACK: 'No ACK',
DIALOG_ERROR: 'Dialog Error',
USER_DENIED_MEDIA_ACCESS: 'User Denied Media Access',
BAD_MEDIA_DESCRIPTION: 'Bad Media Description',
RTP_TIMEOUT: 'RTP Timeout'
},
SIP_ERROR_CAUSES: {
REDIRECTED: [300,301,302,305,380],
BUSY: [486,600],
REJECTED: [403,603],
NOT_FOUND: [404,604],
UNAVAILABLE: [480,410,408,430],
ADDRESS_INCOMPLETE: [484],
INCOMPATIBLE_SDP: [488,606],
AUTHENTICATION_ERROR:[401,407]
},
// SIP Methods
ACK: 'ACK',
BYE: 'BYE',
CANCEL: 'CANCEL',
INFO: 'INFO',
INVITE: 'INVITE',
MESSAGE: 'MESSAGE',
NOTIFY: 'NOTIFY',
OPTIONS: 'OPTIONS',
REGISTER: 'REGISTER',
UPDATE: 'UPDATE',
SUBSCRIBE: 'SUBSCRIBE',
/* SIP Response Reasons
* DOC: http://www.iana.org/assignments/sip-parameters
* Copied from https://github.com/versatica/OverSIP/blob/master/lib/oversip/sip/constants.rb#L7
*/
REASON_PHRASE: {
100: 'Trying',
180: 'Ringing',
181: 'Call Is Being Forwarded',
182: 'Queued',
183: 'Session Progress',
199: 'Early Dialog Terminated', // draft-ietf-sipcore-199
200: 'OK',
202: 'Accepted', // RFC 3265
204: 'No Notification', //RFC 5839
300: 'Multiple Choices',
301: 'Moved Permanently',
302: 'Moved Temporarily',
305: 'Use Proxy',
380: 'Alternative Service',
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
406: 'Not Acceptable',
407: 'Proxy Authentication Required',
408: 'Request Timeout',
410: 'Gone',
412: 'Conditional Request Failed', // RFC 3903
413: 'Request Entity Too Large',
414: 'Request-URI Too Long',
415: 'Unsupported Media Type',
416: 'Unsupported URI Scheme',
417: 'Unknown Resource-Priority', // RFC 4412
420: 'Bad Extension',
421: 'Extension Required',
422: 'Session Interval Too Small', // RFC 4028
423: 'Interval Too Brief',
428: 'Use Identity Header', // RFC 4474
429: 'Provide Referrer Identity', // RFC 3892
430: 'Flow Failed', // RFC 5626
433: 'Anonymity Disallowed', // RFC 5079
436: 'Bad Identity-Info', // RFC 4474
437: 'Unsupported Certificate', // RFC 4744
438: 'Invalid Identity Header', // RFC 4744
439: 'First Hop Lacks Outbound Support', // RFC 5626
440: 'Max-Breadth Exceeded', // RFC 5393
469: 'Bad Info Package', // draft-ietf-sipcore-info-events
470: 'Consent Needed', // RFC 5360
478: 'Unresolvable Destination', // Custom code copied from Kamailio.
480: 'Temporarily Unavailable',
481: 'Call/Transaction Does Not Exist',
482: 'Loop Detected',
483: 'Too Many Hops',
484: 'Address Incomplete',
485: 'Ambiguous',
486: 'Busy Here',
487: 'Request Terminated',
488: 'Not Acceptable Here',
489: 'Bad Event', // RFC 3265
491: 'Request Pending',
493: 'Undecipherable',
494: 'Security Agreement Required', // RFC 3329
500: 'JsSIP Internal Error',
501: 'Not Implemented',
502: 'Bad Gateway',
503: 'Service Unavailable',
504: 'Server Time-out',
505: 'Version Not Supported',
513: 'Message Too Large',
580: 'Precondition Failure', // RFC 3312
600: 'Busy Everywhere',
603: 'Decline',
604: 'Does Not Exist Anywhere',
606: 'Not Acceptable'
},
ALLOWED_METHODS: 'INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS',
ACCEPTED_BODY_TYPES: 'application/sdp, application/dtmf-relay',
MAX_FORWARDS: 69,
SESSION_EXPIRES: 90,
MIN_SESSION_EXPIRES: 60
};
module.exports = C;
},{"../package.json":46}],2:[function(require,module,exports){
module.exports = Dialog;
var C = {
// Dialog states
STATUS_EARLY: 1,
STATUS_CONFIRMED: 2
};
/**
* Expose C object.
*/
Dialog.C = C;
/**
* Dependencies.
*/
var debug = require('debug')('JsSIP:Dialog');
var SIPMessage = require('./SIPMessage');
var JsSIP_C = require('./Constants');
var Transactions = require('./Transactions');
var Dialog_RequestSender = require('./Dialog/RequestSender');
// RFC 3261 12.1
function Dialog(owner, message, type, state) {
var contact;
this.uac_pending_reply = false;
this.uas_pending_reply = false;
if(!message.hasHeader('contact')) {
return {
error: 'unable to create a Dialog without Contact header field'
};
}
if(message instanceof SIPMessage.IncomingResponse) {
state = (message.status_code < 200) ? C.STATUS_EARLY : C.STATUS_CONFIRMED;
} else {
// Create confirmed dialog if state is not defined
state = state || C.STATUS_CONFIRMED;
}
contact = message.parseHeader('contact');
// RFC 3261 12.1.1
if(type === 'UAS') {
this.id = {
call_id: message.call_id,
local_tag: message.to_tag,
remote_tag: message.from_tag,
toString: function() {
return this.call_id + this.local_tag + this.remote_tag;
}
};
this.state = state;
this.remote_seqnum = message.cseq;
this.local_uri = message.parseHeader('to').uri;
this.remote_uri = message.parseHeader('from').uri;
this.remote_target = contact.uri;
this.route_set = message.getHeaders('record-route');
}
// RFC 3261 12.1.2
else if(type === 'UAC') {
this.id = {
call_id: message.call_id,
local_tag: message.from_tag,
remote_tag: message.to_tag,
toString: function() {
return this.call_id + this.local_tag + this.remote_tag;
}
};
this.state = state;
this.local_seqnum = message.cseq;
this.local_uri = message.parseHeader('from').uri;
this.remote_uri = message.parseHeader('to').uri;
this.remote_target = contact.uri;
this.route_set = message.getHeaders('record-route').reverse();
}
this.owner = owner;
owner.ua.dialogs[this.id.toString()] = this;
debug('new ' + type + ' dialog created with status ' + (this.state === C.STATUS_EARLY ? 'EARLY': 'CONFIRMED'));
}
Dialog.prototype = {
update: function(message, type) {
this.state = C.STATUS_CONFIRMED;
debug('dialog '+ this.id.toString() +' changed to CONFIRMED state');
if(type === 'UAC') {
// RFC 3261 13.2.2.4
this.route_set = message.getHeaders('record-route').reverse();
}
},
terminate: function() {
debug('dialog ' + this.id.toString() + ' deleted');
delete this.owner.ua.dialogs[this.id.toString()];
},
// RFC 3261 12.2.1.1
createRequest: function(method, extraHeaders, body) {
var cseq, request;
extraHeaders = extraHeaders && extraHeaders.slice() || [];
if(!this.local_seqnum) { this.local_seqnum = Math.floor(Math.random() * 10000); }
cseq = (method === JsSIP_C.CANCEL || method === JsSIP_C.ACK) ? this.local_seqnum : this.local_seqnum += 1;
request = new SIPMessage.OutgoingRequest(
method,
this.remote_target,
this.owner.ua, {
'cseq': cseq,
'call_id': this.id.call_id,
'from_uri': this.local_uri,
'from_tag': this.id.local_tag,
'to_uri': this.remote_uri,
'to_tag': this.id.remote_tag,
'route_set': this.route_set
}, extraHeaders, body);
request.dialog = this;
return request;
},
// RFC 3261 12.2.2
checkInDialogRequest: function(request) {
var self = this;
if(!this.remote_seqnum) {
this.remote_seqnum = request.cseq;
} else if(request.cseq < this.remote_seqnum) {
//Do not try to reply to an ACK request.
if (request.method !== JsSIP_C.ACK) {
request.reply(500);
}
return false;
} else if(request.cseq > this.remote_seqnum) {
this.remote_seqnum = request.cseq;
}
// RFC3261 14.2 Modifying an Existing Session -UAS BEHAVIOR-
if (request.method === JsSIP_C.INVITE || (request.method === JsSIP_C.UPDATE && request.body)) {
if (this.uac_pending_reply === true) {
request.reply(491);
} else if (this.uas_pending_reply === true) {
var retryAfter = (Math.random() * 10 | 0) + 1;
request.reply(500, null, ['Retry-After:'+ retryAfter]);
return false;
} else {
this.uas_pending_reply = true;
request.server_transaction.on('stateChanged', function stateChanged(){
if (this.state === Transactions.C.STATUS_ACCEPTED ||
this.state === Transactions.C.STATUS_COMPLETED ||
this.state === Transactions.C.STATUS_TERMINATED) {
request.server_transaction.removeListener('stateChanged', stateChanged);
self.uas_pending_reply = false;
}
});
}
// RFC3261 12.2.2 Replace the dialog`s remote target URI if the request is accepted
if(request.hasHeader('contact')) {
request.server_transaction.on('stateChanged', function(){
if (this.state === Transactions.C.STATUS_ACCEPTED) {
self.remote_target = request.parseHeader('contact').uri;
}
});
}
}
else if (request.method === JsSIP_C.NOTIFY) {
// RFC6665 3.2 Replace the dialog`s remote target URI if the request is accepted
if(request.hasHeader('contact')) {
request.server_transaction.on('stateChanged', function(){
if (this.state === Transactions.C.STATUS_COMPLETED) {
self.remote_target = request.parseHeader('contact').uri;
}
});
}
}
return true;
},
sendRequest: function(applicant, method, options) {
options = options || {};
var
extraHeaders = options.extraHeaders && options.extraHeaders.slice() || [],
body = options.body || null,
request = this.createRequest(method, extraHeaders, body),
request_sender = new Dialog_RequestSender(this, applicant, request);
request_sender.send();
},
receiveRequest: function(request) {
//Check in-dialog request
if(!this.checkInDialogRequest(request)) {
return;
}
this.owner.receiveRequest(request);
}
};
},{"./Constants":1,"./Dialog/RequestSender":3,"./SIPMessage":16,"./Transactions":18,"debug":29}],3:[function(require,module,exports){
module.exports = DialogRequestSender;
/**
* Dependencies.
*/
var JsSIP_C = require('../Constants');
var Transactions = require('../Transactions');
var RTCSession = require('../RTCSession');
var RequestSender = require('../RequestSender');
function DialogRequestSender(dialog, applicant, request) {
this.dialog = dialog;
this.applicant = applicant;
this.request = request;
// RFC3261 14.1 Modifying an Existing Session. UAC Behavior.
this.reattempt = false;
this.reattemptTimer = null;
}
DialogRequestSender.prototype = {
send: function() {
var
self = this,
request_sender = new RequestSender(this, this.dialog.owner.ua);
request_sender.send();
// RFC3261 14.2 Modifying an Existing Session -UAC BEHAVIOR-
if ((this.request.method === JsSIP_C.INVITE || (this.request.method === JsSIP_C.UPDATE && this.request.body)) &&
request_sender.clientTransaction.state !== Transactions.C.STATUS_TERMINATED) {
this.dialog.uac_pending_reply = true;
request_sender.clientTransaction.on('stateChanged', function stateChanged(){
if (this.state === Transactions.C.STATUS_ACCEPTED ||
this.state === Transactions.C.STATUS_COMPLETED ||
this.state === Transactions.C.STATUS_TERMINATED) {
request_sender.clientTransaction.removeListener('stateChanged', stateChanged);
self.dialog.uac_pending_reply = false;
}
});
}
},
onRequestTimeout: function() {
this.applicant.onRequestTimeout();
},
onTransportError: function() {
this.applicant.onTransportError();
},
receiveResponse: function(response) {
var self = this;
// RFC3261 12.2.1.2 408 or 481 is received for a request within a dialog.
if (response.status_code === 408 || response.status_code === 481) {
this.applicant.onDialogError(response);
} else if (response.method === JsSIP_C.INVITE && response.status_code === 491) {
if (this.reattempt) {
this.applicant.receiveResponse(response);
} else {
this.request.cseq.value = this.dialog.local_seqnum += 1;
this.reattemptTimer = setTimeout(function() {
if (self.applicant.owner.status !== RTCSession.C.STATUS_TERMINATED) {
self.reattempt = true;
self.request_sender.send();
}
}, 1000);
}
} else {
this.applicant.receiveResponse(response);
}
}
};
},{"../Constants":1,"../RTCSession":11,"../RequestSender":15,"../Transactions":18}],4:[function(require,module,exports){
module.exports = DigestAuthentication;
/**
* Dependencies.
*/
var debug = require('debug')('JsSIP:DigestAuthentication');
var Utils = require('./Utils');
function DigestAuthentication(ua) {
this.username = ua.configuration.authorization_user;
this.password = ua.configuration.password;
this.cnonce = null;
this.nc = 0;
this.ncHex = '00000000';
this.response = null;
}
/**
* Performs Digest authentication given a SIP request and the challenge
* received in a response to that request.
* Returns true if credentials were successfully generated, false otherwise.
*/
DigestAuthentication.prototype.authenticate = function(request, challenge) {
// Inspect and validate the challenge.
this.algorithm = challenge.algorithm;
this.realm = challenge.realm;
this.nonce = challenge.nonce;
this.opaque = challenge.opaque;
this.stale = challenge.stale;
if (this.algorithm) {
if (this.algorithm !== 'MD5') {
debug('challenge with Digest algorithm different than "MD5", authentication aborted');
return false;
}
} else {
this.algorithm = 'MD5';
}
if (! this.realm) {
debug('challenge without Digest realm, authentication aborted');
return false;
}
if (! this.nonce) {
debug('challenge without Digest nonce, authentication aborted');
return false;
}
// 'qop' can contain a list of values (Array). Let's choose just one.
if (challenge.qop) {
if (challenge.qop.indexOf('auth') > -1) {
this.qop = 'auth';
} else if (challenge.qop.indexOf('auth-int') > -1) {
this.qop = 'auth-int';
} else {
// Otherwise 'qop' is present but does not contain 'auth' or 'auth-int', so abort here.
debug('challenge without Digest qop different than "auth" or "auth-int", authentication aborted');
return false;
}
} else {
this.qop = null;
}
// Fill other attributes.
this.method = request.method;
this.uri = request.ruri;
this.cnonce = Utils.createRandomToken(12);
this.nc += 1;
this.updateNcHex();
// nc-value = 8LHEX. Max value = 'FFFFFFFF'.
if (this.nc === 4294967296) {
this.nc = 1;
this.ncHex = '00000001';
}
// Calculate the Digest "response" value.
this.calculateResponse();
return true;
};
/**
* Generate Digest 'response' value.
*/
DigestAuthentication.prototype.calculateResponse = function() {
var ha1, ha2;
// HA1 = MD5(A1) = MD5(username:realm:password)
ha1 = Utils.calculateMD5(this.username + ':' + this.realm + ':' + this.password);
if (this.qop === 'auth') {
// HA2 = MD5(A2) = MD5(method:digestURI)
ha2 = Utils.calculateMD5(this.method + ':' + this.uri);
// response = MD5(HA1:nonce:nonceCount:credentialsNonce:qop:HA2)
this.response = Utils.calculateMD5(ha1 + ':' + this.nonce + ':' + this.ncHex + ':' + this.cnonce + ':auth:' + ha2);
} else if (this.qop === 'auth-int') {
// HA2 = MD5(A2) = MD5(method:digestURI:MD5(entityBody))
ha2 = Utils.calculateMD5(this.method + ':' + this.uri + ':' + Utils.calculateMD5(this.body ? this.body : ''));
// response = MD5(HA1:nonce:nonceCount:credentialsNonce:qop:HA2)
this.response = Utils.calculateMD5(ha1 + ':' + this.nonce + ':' + this.ncHex + ':' + this.cnonce + ':auth-int:' + ha2);
} else if (this.qop === null) {
// HA2 = MD5(A2) = MD5(method:digestURI)
ha2 = Utils.calculateMD5(this.method + ':' + this.uri);
// response = MD5(HA1:nonce:HA2)
this.response = Utils.calculateMD5(ha1 + ':' + this.nonce + ':' + ha2);
}
};
/**
* Return the Proxy-Authorization or WWW-Authorization header value.
*/
DigestAuthentication.prototype.toString = function() {
var auth_params = [];
if (! this.response) {
throw new Error('response field does not exist, cannot generate Authorization header');
}
auth_params.push('algorithm=' + this.algorithm);
auth_params.push('username="' + this.username + '"');
auth_params.push('realm="' + this.realm + '"');
auth_params.push('nonce="' + this.nonce + '"');
auth_params.push('uri="' + this.uri + '"');
auth_params.push('response="' + this.response + '"');
if (this.opaque) {
auth_params.push('opaque="' + this.opaque + '"');
}
if (this.qop) {
auth_params.push('qop=' + this.qop);
auth_params.push('cnonce="' + this.cnonce + '"');
auth_params.push('nc=' + this.ncHex);
}
return 'Digest ' + auth_params.join(', ');
};
/**
* Generate the 'nc' value as required by Digest in this.ncHex by reading this.nc.
*/
DigestAuthentication.prototype.updateNcHex = function() {
var hex = Number(this.nc).toString(16);
this.ncHex = '00000000'.substr(0, 8-hex.length) + hex;
};
},{"./Utils":22,"debug":29}],5:[function(require,module,exports){
/**
* @namespace Exceptions
* @memberOf JsSIP
*/
var Exceptions = {
/**
* Exception thrown when a valid parameter is given to the JsSIP.UA constructor.
* @class ConfigurationError
* @memberOf JsSIP.Exceptions
*/
ConfigurationError: (function(){
var exception = function(parameter, value) {
this.code = 1;
this.name = 'CONFIGURATION_ERROR';
this.parameter = parameter;
this.value = value;
this.message = (!this.value)? 'Missing parameter: '+ this.parameter : 'Invalid value '+ JSON.stringify(this.value) +' for parameter "'+ this.parameter +'"';
};
exception.prototype = new Error();
return exception;
}()),
InvalidStateError: (function(){
var exception = function(status) {
this.code = 2;
this.name = 'INVALID_STATE_ERROR';
this.status = status;
this.message = 'Invalid status: '+ status;
};
exception.prototype = new Error();
return exception;
}()),
NotSupportedError: (function(){
var exception = function(message) {
this.code = 3;
this.name = 'NOT_SUPPORTED_ERROR';
this.message = message;
};
exception.prototype = new Error();
return exception;
}()),
NotReadyError: (function(){
var exception = function(message) {
this.code = 4;
this.name = 'NOT_READY_ERROR';
this.message = message;
};
exception.prototype = new Error();
return exception;
}())
};
module.exports = Exceptions;
},{}],6:[function(require,module,exports){
module.exports = (function(){
/*
* Generated by PEG.js 0.7.0.
*
* http://pegjs.majda.cz/
*/
function quote(s) {
/*
* ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
* string literal except for the closing quote character, backslash,
* carriage return, line separator, paragraph separator, and line feed.
* Any character may appear in the form of an escape sequence.
*
* For portability, we also escape escape all control and non-ASCII
* characters. Note that "\0" and "\v" escape sequences are not used
* because JSHint does not like the first and IE the second.
*/
return '"' + s
.replace(/\\/g, '\\\\') // backslash
.replace(/"/g, '\\"') // closing quote character
.replace(/\x08/g, '\\b') // backspace
.replace(/\t/g, '\\t') // horizontal tab
.replace(/\n/g, '\\n') // line feed
.replace(/\f/g, '\\f') // form feed
.replace(/\r/g, '\\r') // carriage return
.replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
+ '"';
}
var result = {
/*
* Parses the input with a generated parser. If the parsing is successfull,
* returns a value explicitly or implicitly specified by the grammar from
* which the parser was generated (see |PEG.buildParser|). If the parsing is
* unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
*/
parse: function(input, startRule) {
var parseFunctions = {
"CRLF": parse_CRLF,
"DIGIT": parse_DIGIT,
"ALPHA": parse_ALPHA,
"HEXDIG": parse_HEXDIG,
"WSP": parse_WSP,
"OCTET": parse_OCTET,
"DQUOTE": parse_DQUOTE,
"SP": parse_SP,
"HTAB": parse_HTAB,
"alphanum": parse_alphanum,
"reserved": parse_reserved,
"unreserved": parse_unreserved,
"mark": parse_mark,
"escaped": parse_escaped,
"LWS": parse_LWS,
"SWS": parse_SWS,
"HCOLON": parse_HCOLON,
"TEXT_UTF8_TRIM": parse_TEXT_UTF8_TRIM,
"TEXT_UTF8char": parse_TEXT_UTF8char,
"UTF8_NONASCII": parse_UTF8_NONASCII,
"UTF8_CONT": parse_UTF8_CONT,
"LHEX": parse_LHEX,
"token": parse_token,
"token_nodot": parse_token_nodot,
"separators": parse_separators,
"word": parse_word,
"STAR": parse_STAR,
"SLASH": parse_SLASH,
"EQUAL": parse_EQUAL,
"LPAREN": parse_LPAREN,
"RPAREN": parse_RPAREN,
"RAQUOT": parse_RAQUOT,
"LAQUOT": parse_LAQUOT,
"COMMA": parse_COMMA,
"SEMI": parse_SEMI,
"COLON": parse_COLON,
"LDQUOT": parse_LDQUOT,
"RDQUOT": parse_RDQUOT,
"comment": parse_comment,
"ctext": parse_ctext,
"quoted_string": parse_quoted_string,
"quoted_string_clean": parse_quoted_string_clean,
"qdtext": parse_qdtext,
"quoted_pair": parse_quoted_pair,
"SIP_URI_noparams": parse_SIP_URI_noparams,
"SIP_URI": parse_SIP_URI,
"uri_scheme": parse_uri_scheme,
"userinfo": parse_userinfo,
"user": parse_user,
"user_unreserved": parse_user_unreserved,
"password": parse_password,
"hostport": parse_hostport,
"host": parse_host,
"hostname": parse_hostname,
"domainlabel": parse_domainlabel,
"toplabel": parse_toplabel,
"IPv6reference": parse_IPv6reference,
"IPv6address": parse_IPv6address,
"h16": parse_h16,
"ls32": parse_ls32,
"IPv4address": parse_IPv4address,
"dec_octet": parse_dec_octet,
"port": parse_port,
"uri_parameters": parse_uri_parameters,
"uri_parameter": parse_uri_parameter,
"transport_param": parse_transport_param,
"user_param": parse_user_param,
"method_param": parse_method_param,
"ttl_param": parse_ttl_param,
"maddr_param": parse_maddr_param,
"lr_param": parse_lr_param,
"other_param": parse_other_param,
"pname": parse_pname,
"pvalue": parse_pvalue,
"paramchar": parse_paramchar,
"param_unreserved": parse_param_unreserved,
"headers": parse_headers,
"header": parse_header,
"hname": parse_hname,
"hvalue": parse_hvalue,
"hnv_unreserved": parse_hnv_unreserved,
"Request_Response": parse_Request_Response,
"Request_Line": parse_Request_Line,
"Request_URI": parse_Request_URI,
"absoluteURI": parse_absoluteURI,
"hier_part": parse_hier_part,
"net_path": parse_net_path,
"abs_path": parse_abs_path,
"opaque_part": parse_opaque_part,
"uric": parse_uric,
"uric_no_slash": parse_uric_no_slash,
"path_segments": parse_path_segments,
"segment": parse_segment,
"param": parse_param,
"pchar": parse_pchar,
"scheme": parse_scheme,
"authority": parse_authority,
"srvr": parse_srvr,
"reg_name": parse_reg_name,
"query": parse_query,
"SIP_Version": parse_SIP_Version,
"INVITEm": parse_INVITEm,
"ACKm": parse_ACKm,
"OPTIONSm": parse_OPTIONSm,
"BYEm": parse_BYEm,
"CANCELm": parse_CANCELm,
"REGISTERm": parse_REGISTERm,
"SUBSCRIBEm": parse_SUBSCRIBEm,
"NOTIFYm": parse_NOTIFYm,
"Method": parse_Method,
"Status_Line": parse_Status_Line,
"Status_Code": parse_Status_Code,
"extension_code": parse_extension_code,
"Reason_Phrase": parse_Reason_Phrase,
"Allow_Events": parse_Allow_Events,
"Call_ID": parse_Call_ID,
"Contact": parse_Contact,
"contact_param": parse_contact_param,
"name_addr": parse_name_addr,
"display_name": parse_display_name,
"contact_params": parse_contact_params,
"c_p_q": parse_c_p_q,
"c_p_expires": parse_c_p_expires,
"delta_seconds": parse_delta_seconds,
"qvalue": parse_qvalue,
"generic_param": parse_generic_param,
"gen_value": parse_gen_value,
"Content_Disposition": parse_Content_Disposition,
"disp_type": parse_disp_type,
"disp_param": parse_disp_param,
"handling_param": parse_handling_param,
"Content_Encoding": parse_Content_Encoding,
"Content_Length": parse_Content_Length,
"Content_Type": parse_Content_Type,
"media_type": parse_media_type,
"m_type": parse_m_type,
"discrete_type": parse_discrete_type,
"composite_type": parse_composite_type,
"extension_token": parse_extension_token,
"x_token": parse_x_token,
"m_subtype": parse_m_subtype,
"m_parameter": parse_m_parameter,
"m_value": parse_m_value,
"CSeq": parse_CSeq,
"CSeq_value": parse_CSeq_value,
"Expires": parse_Expires,
"Event": parse_Event,
"event_type": parse_event_type,
"From": parse_From,
"from_param": parse_from_param,
"tag_param": parse_tag_param,
"Max_Forwards": parse_Max_Forwards,
"Min_Expires": parse_Min_Expires,
"Name_Addr_Header": parse_Name_Addr_Header,
"Proxy_Authenticate": parse_Proxy_Authenticate,
"challenge": parse_challenge,
"other_challenge": parse_other_challenge,
"auth_param": parse_auth_param,
"digest_cln": parse_digest_cln,
"realm": parse_realm,
"realm_value": parse_realm_value,
"domain": parse_domain,
"URI": parse_URI,
"nonce": parse_nonce,
"nonce_value": parse_nonce_value,
"opaque": parse_opaque,
"stale": parse_stale,
"algorithm": parse_algorithm,
"qop_options": parse_qop_options,
"qop_value": parse_qop_value,
"Proxy_Require": parse_Proxy_Require,
"Record_Route": parse_Record_Route,
"rec_route": parse_rec_route,
"Require": parse_Require,
"Route": parse_Route,
"route_param": parse_route_param,
"Subscription_State": parse_Subscription_State,
"substate_value": parse_substate_value,
"subexp_params": parse_subexp_params,
"event_reason_value": parse_event_reason_value,
"Subject": parse_Subject,
"Supported": parse_Supported,
"To": parse_To,
"to_param": parse_to_param,
"Via": parse_Via,
"via_param": parse_via_param,
"via_params": parse_via_params,
"via_ttl": parse_via_ttl,
"via_maddr": parse_via_maddr,
"via_received": parse_via_received,
"via_branch": parse_via_branch,
"response_port": parse_response_port,
"sent_protocol": parse_sent_protocol,
"protocol_name": parse_protocol_name,
"transport": parse_transport,
"sent_by": parse_sent_by,
"via_host": parse_via_host,
"via_port": parse_via_port,
"ttl": parse_ttl,
"WWW_Authenticate": parse_WWW_Authenticate,
"Session_Expires": parse_Session_Expires,
"s_e_expires": parse_s_e_expires,
"s_e_params": parse_s_e_params,
"s_e_refresher": parse_s_e_refresher,
"extension_header": parse_extension_header,
"header_value": parse_header_value,
"message_body": parse_message_body,
"uuid_URI": parse_uuid_URI,
"uuid": parse_uuid,
"hex4": parse_hex4,
"hex8": parse_hex8,
"hex12": parse_hex12
};
if (startRule !== undefined) {
if (parseFunctions[startRule] === undefined) {
throw new Error("Invalid rule name: " + quote(startRule) + ".");
}
} else {
startRule = "CRLF";
}
var pos = 0;
var reportFailures = 0;
var rightmostFailuresPos = 0;
var rightmostFailuresExpected = [];
function padLeft(input, padding, length) {
var result = input;
var padLength = length - input.length;
for (var i = 0; i < padLength; i++) {
result = padding + result;
}
return result;
}
function escape(ch) {
var charCode = ch.charCodeAt(0);
var escapeChar;
var length;
if (charCode <= 0xFF) {
escapeChar = 'x';
length = 2;
} else {
escapeChar = 'u';
length = 4;
}
return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
}
function matchFailed(failure) {
if (pos < rightmostFailuresPos) {
return;
}
if (pos > rightmostFailuresPos) {
rightmostFailuresPos = pos;
rightmostFailuresExpected = [];
}
rightmostFailuresExpected.push(failure);
}
function parse_CRLF() {
var result0;
if (input.substr(pos, 2) === "\r\n") {
result0 = "\r\n";
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"\\r\\n\"");
}
}
return result0;
}
function parse_DIGIT() {
var result0;
if (/^[0-9]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[0-9]");
}
}
return result0;
}
function parse_ALPHA() {
var result0;
if (/^[a-zA-Z]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z]");
}
}
return result0;
}
function parse_HEXDIG() {
var result0;
if (/^[0-9a-fA-F]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[0-9a-fA-F]");
}
}
return result0;
}
function parse_WSP() {
var result0;
result0 = parse_SP();
if (result0 === null) {
result0 = parse_HTAB();
}
return result0;
}
function parse_OCTET() {
var result0;
if (/^[\0-\xFF]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[\\0-\\xFF]");
}
}
return result0;
}
function parse_DQUOTE() {
var result0;
if (/^["]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[\"]");
}
}
return result0;
}
function parse_SP() {
var result0;
if (input.charCodeAt(pos) === 32) {
result0 = " ";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\" \"");
}
}
return result0;
}
function parse_HTAB() {
var result0;
if (input.charCodeAt(pos) === 9) {
result0 = "\t";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"\\t\"");
}
}
return result0;
}
function parse_alphanum() {
var result0;
if (/^[a-zA-Z0-9]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z0-9]");
}
}
return result0;
}
function parse_reserved() {
var result0;
if (input.charCodeAt(pos) === 59) {
result0 = ";";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 47) {
result0 = "/";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 63) {
result0 = "?";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"?\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 58) {
result0 = ":";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 64) {
result0 = "@";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"@\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 38) {
result0 = "&";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"&\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 61) {
result0 = "=";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 43) {
result0 = "+";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 36) {
result0 = "$";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"$\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 44) {
result0 = ",";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
}
}
}
}
}
}
}
}
}
return result0;
}
function parse_unreserved() {
var result0;
result0 = parse_alphanum();
if (result0 === null) {
result0 = parse_mark();
}
return result0;
}
function parse_mark() {
var result0;
if (input.charCodeAt(pos) === 45) {
result0 = "-";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 95) {
result0 = "_";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"_\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 46) {
result0 = ".";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 33) {
result0 = "!";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"!\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 126) {
result0 = "~";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"~\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 42) {
result0 = "*";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"*\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 39) {
result0 = "'";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"'\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 40) {
result0 = "(";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"(\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 41) {
result0 = ")";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\")\"");
}
}
}
}
}
}
}
}
}
}
return result0;
}
function parse_escaped() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.charCodeAt(pos) === 37) {
result0 = "%";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"%\"");
}
}
if (result0 !== null) {
result1 = parse_HEXDIG();
if (result1 !== null) {
result2 = parse_HEXDIG();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, escaped) {return escaped.join(''); })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_LWS() {
var result0, result1, result2;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
pos2 = pos;
result0 = [];
result1 = parse_WSP();
while (result1 !== null) {
result0.push(result1);
result1 = parse_WSP();
}
if (result0 !== null) {
result1 = parse_CRLF();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos2;
}
} else {
result0 = null;
pos = pos2;
}
result0 = result0 !== null ? result0 : "";
if (result0 !== null) {
result2 = parse_WSP();
if (result2 !== null) {
result1 = [];
while (result2 !== null) {
result1.push(result2);
result2 = parse_WSP();
}
} else {
result1 = null;
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return " "; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_SWS() {
var result0;
result0 = parse_LWS();
result0 = result0 !== null ? result0 : "";
return result0;
}
function parse_HCOLON() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = [];
result1 = parse_SP();
if (result1 === null) {
result1 = parse_HTAB();
}
while (result1 !== null) {
result0.push(result1);
result1 = parse_SP();
if (result1 === null) {
result1 = parse_HTAB();
}
}
if (result0 !== null) {
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_SWS();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return ':'; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_TEXT_UTF8_TRIM() {
var result0, result1, result2, result3;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result1 = parse_TEXT_UTF8char();
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_TEXT_UTF8char();
}
} else {
result0 = null;
}
if (result0 !== null) {
result1 = [];
pos2 = pos;
result2 = [];
result3 = parse_LWS();
while (result3 !== null) {
result2.push(result3);
result3 = parse_LWS();
}
if (result2 !== null) {
result3 = parse_TEXT_UTF8char();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
while (result2 !== null) {
result1.push(result2);
pos2 = pos;
result2 = [];
result3 = parse_LWS();
while (result3 !== null) {
result2.push(result3);
result3 = parse_LWS();
}
if (result2 !== null) {
result3 = parse_TEXT_UTF8char();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
return input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_TEXT_UTF8char() {
var result0;
if (/^[!-~]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[!-~]");
}
}
if (result0 === null) {
result0 = parse_UTF8_NONASCII();
}
return result0;
}
function parse_UTF8_NONASCII() {
var result0;
if (/^[\x80-\uFFFF]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[\\x80-\\uFFFF]");
}
}
return result0;
}
function parse_UTF8_CONT() {
var result0;
if (/^[\x80-\xBF]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[\\x80-\\xBF]");
}
}
return result0;
}
function parse_LHEX() {
var result0;
result0 = parse_DIGIT();
if (result0 === null) {
if (/^[a-f]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[a-f]");
}
}
}
return result0;
}
function parse_token() {
var result0, result1;
var pos0;
pos0 = pos;
result1 = parse_alphanum();
if (result1 === null) {
if (input.charCodeAt(pos) === 45) {
result1 = "-";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 46) {
result1 = ".";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 33) {
result1 = "!";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"!\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 37) {
result1 = "%";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"%\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 42) {
result1 = "*";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"*\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 95) {
result1 = "_";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"_\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 43) {
result1 = "+";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 96) {
result1 = "`";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"`\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 39) {
result1 = "'";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"'\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 126) {
result1 = "~";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"~\"");
}
}
}
}
}
}
}
}
}
}
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_alphanum();
if (result1 === null) {
if (input.charCodeAt(pos) === 45) {
result1 = "-";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 46) {
result1 = ".";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 33) {
result1 = "!";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"!\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 37) {
result1 = "%";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"%\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 42) {
result1 = "*";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"*\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 95) {
result1 = "_";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"_\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 43) {
result1 = "+";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 96) {
result1 = "`";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"`\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 39) {
result1 = "'";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"'\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 126) {
result1 = "~";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"~\"");
}
}
}
}
}
}
}
}
}
}
}
}
}
} else {
result0 = null;
}
if (result0 !== null) {
result0 = (function(offset) {
return input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_token_nodot() {
var result0, result1;
var pos0;
pos0 = pos;
result1 = parse_alphanum();
if (result1 === null) {
if (input.charCodeAt(pos) === 45) {
result1 = "-";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 33) {
result1 = "!";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"!\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 37) {
result1 = "%";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"%\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 42) {
result1 = "*";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"*\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 95) {
result1 = "_";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"_\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 43) {
result1 = "+";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 96) {
result1 = "`";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"`\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 39) {
result1 = "'";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"'\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 126) {
result1 = "~";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"~\"");
}
}
}
}
}
}
}
}
}
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_alphanum();
if (result1 === null) {
if (input.charCodeAt(pos) === 45) {
result1 = "-";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 33) {
result1 = "!";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"!\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 37) {
result1 = "%";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"%\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 42) {
result1 = "*";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"*\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 95) {
result1 = "_";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"_\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 43) {
result1 = "+";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 96) {
result1 = "`";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"`\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 39) {
result1 = "'";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"'\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 126) {
result1 = "~";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"~\"");
}
}
}
}
}
}
}
}
}
}
}
}
} else {
result0 = null;
}
if (result0 !== null) {
result0 = (function(offset) {
return input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_separators() {
var result0;
if (input.charCodeAt(pos) === 40) {
result0 = "(";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"(\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 41) {
result0 = ")";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\")\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 60) {
result0 = "<";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"<\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 62) {
result0 = ">";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\">\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 64) {
result0 = "@";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"@\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 44) {
result0 = ",";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 59) {
result0 = ";";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 58) {
result0 = ":";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 92) {
result0 = "\\";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"\\\\\"");
}
}
if (result0 === null) {
result0 = parse_DQUOTE();
if (result0 === null) {
if (input.charCodeAt(pos) === 47) {
result0 = "/";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 91) {
result0 = "[";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"[\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 93) {
result0 = "]";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"]\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 63) {
result0 = "?";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"?\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 61) {
result0 = "=";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 123) {
result0 = "{";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"{\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 125) {
result0 = "}";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"}\"");
}
}
if (result0 === null) {
result0 = parse_SP();
if (result0 === null) {
result0 = parse_HTAB();
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return result0;
}
function parse_word() {
var result0, result1;
var pos0;
pos0 = pos;
result1 = parse_alphanum();
if (result1 === null) {
if (input.charCodeAt(pos) === 45) {
result1 = "-";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 46) {
result1 = ".";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 33) {
result1 = "!";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"!\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 37) {
result1 = "%";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"%\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 42) {
result1 = "*";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"*\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 95) {
result1 = "_";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"_\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 43) {
result1 = "+";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 96) {
result1 = "`";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"`\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 39) {
result1 = "'";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"'\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 126) {
result1 = "~";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"~\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 40) {
result1 = "(";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"(\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 41) {
result1 = ")";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\")\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 60) {
result1 = "<";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"<\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 62) {
result1 = ">";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\">\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 92) {
result1 = "\\";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"\\\\\"");
}
}
if (result1 === null) {
result1 = parse_DQUOTE();
if (result1 === null) {
if (input.charCodeAt(pos) === 47) {
result1 = "/";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 91) {
result1 = "[";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"[\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 93) {
result1 = "]";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"]\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 63) {
result1 = "?";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"?\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 123) {
result1 = "{";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"{\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 125) {
result1 = "}";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"}\"");
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_alphanum();
if (result1 === null) {
if (input.charCodeAt(pos) === 45) {
result1 = "-";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 46) {
result1 = ".";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 33) {
result1 = "!";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"!\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 37) {
result1 = "%";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"%\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 42) {
result1 = "*";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"*\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 95) {
result1 = "_";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"_\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 43) {
result1 = "+";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 96) {
result1 = "`";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"`\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 39) {
result1 = "'";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"'\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 126) {
result1 = "~";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"~\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 40) {
result1 = "(";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"(\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 41) {
result1 = ")";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\")\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 60) {
result1 = "<";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"<\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 62) {
result1 = ">";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\">\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 92) {
result1 = "\\";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"\\\\\"");
}
}
if (result1 === null) {
result1 = parse_DQUOTE();
if (result1 === null) {
if (input.charCodeAt(pos) === 47) {
result1 = "/";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 91) {
result1 = "[";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"[\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 93) {
result1 = "]";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"]\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 63) {
result1 = "?";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"?\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 123) {
result1 = "{";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"{\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 125) {
result1 = "}";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"}\"");
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
} else {
result0 = null;
}
if (result0 !== null) {
result0 = (function(offset) {
return input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_STAR() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
if (input.charCodeAt(pos) === 42) {
result1 = "*";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"*\"");
}
}
if (result1 !== null) {
result2 = parse_SWS();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return "*"; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_SLASH() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
if (input.charCodeAt(pos) === 47) {
result1 = "/";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
if (result1 !== null) {
result2 = parse_SWS();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return "/"; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_EQUAL() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
if (input.charCodeAt(pos) === 61) {
result1 = "=";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result1 !== null) {
result2 = parse_SWS();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return "="; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_LPAREN() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
if (input.charCodeAt(pos) === 40) {
result1 = "(";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"(\"");
}
}
if (result1 !== null) {
result2 = parse_SWS();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return "("; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_RPAREN() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
if (input.charCodeAt(pos) === 41) {
result1 = ")";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\")\"");
}
}
if (result1 !== null) {
result2 = parse_SWS();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return ")"; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_RAQUOT() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.charCodeAt(pos) === 62) {
result0 = ">";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\">\"");
}
}
if (result0 !== null) {
result1 = parse_SWS();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return ">"; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_LAQUOT() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
if (input.charCodeAt(pos) === 60) {
result1 = "<";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"<\"");
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return "<"; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_COMMA() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
if (input.charCodeAt(pos) === 44) {
result1 = ",";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
if (result1 !== null) {
result2 = parse_SWS();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return ","; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_SEMI() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
if (input.charCodeAt(pos) === 59) {
result1 = ";";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result1 !== null) {
result2 = parse_SWS();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return ";"; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_COLON() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_SWS();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return ":"; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_LDQUOT() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
result1 = parse_DQUOTE();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return "\""; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_RDQUOT() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_DQUOTE();
if (result0 !== null) {
result1 = parse_SWS();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {return "\""; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_comment() {
var result0, result1, result2;
var pos0;
pos0 = pos;
result0 = parse_LPAREN();
if (result0 !== null) {
result1 = [];
result2 = parse_ctext();
if (result2 === null) {
result2 = parse_quoted_pair();
if (result2 === null) {
result2 = parse_comment();
}
}
while (result2 !== null) {
result1.push(result2);
result2 = parse_ctext();
if (result2 === null) {
result2 = parse_quoted_pair();
if (result2 === null) {
result2 = parse_comment();
}
}
}
if (result1 !== null) {
result2 = parse_RPAREN();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_ctext() {
var result0;
if (/^[!-']/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[!-']");
}
}
if (result0 === null) {
if (/^[*-[]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[*-[]");
}
}
if (result0 === null) {
if (/^[\]-~]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[\\]-~]");
}
}
if (result0 === null) {
result0 = parse_UTF8_NONASCII();
if (result0 === null) {
result0 = parse_LWS();
}
}
}
}
return result0;
}
function parse_quoted_string() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
result1 = parse_DQUOTE();
if (result1 !== null) {
result2 = [];
result3 = parse_qdtext();
if (result3 === null) {
result3 = parse_quoted_pair();
}
while (result3 !== null) {
result2.push(result3);
result3 = parse_qdtext();
if (result3 === null) {
result3 = parse_quoted_pair();
}
}
if (result2 !== null) {
result3 = parse_DQUOTE();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
return input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_quoted_string_clean() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_SWS();
if (result0 !== null) {
result1 = parse_DQUOTE();
if (result1 !== null) {
result2 = [];
result3 = parse_qdtext();
if (result3 === null) {
result3 = parse_quoted_pair();
}
while (result3 !== null) {
result2.push(result3);
result3 = parse_qdtext();
if (result3 === null) {
result3 = parse_quoted_pair();
}
}
if (result2 !== null) {
result3 = parse_DQUOTE();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
return input.substring(pos-1, offset+1); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_qdtext() {
var result0;
result0 = parse_LWS();
if (result0 === null) {
if (input.charCodeAt(pos) === 33) {
result0 = "!";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"!\"");
}
}
if (result0 === null) {
if (/^[#-[]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[#-[]");
}
}
if (result0 === null) {
if (/^[\]-~]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[\\]-~]");
}
}
if (result0 === null) {
result0 = parse_UTF8_NONASCII();
}
}
}
}
return result0;
}
function parse_quoted_pair() {
var result0, result1;
var pos0;
pos0 = pos;
if (input.charCodeAt(pos) === 92) {
result0 = "\\";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"\\\\\"");
}
}
if (result0 !== null) {
if (/^[\0-\t]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[\\0-\\t]");
}
}
if (result1 === null) {
if (/^[\x0B-\f]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[\\x0B-\\f]");
}
}
if (result1 === null) {
if (/^[\x0E-]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[\\x0E-]");
}
}
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_SIP_URI_noparams() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_uri_scheme();
if (result0 !== null) {
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_userinfo();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result3 = parse_hostport();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
try {
data.uri = new URI(data.scheme, data.user, data.host, data.port);
delete data.scheme;
delete data.user;
delete data.host;
delete data.host_type;
delete data.port;
} catch(e) {
data = -1;
}})(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_SIP_URI() {
var result0, result1, result2, result3, result4, result5;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_uri_scheme();
if (result0 !== null) {
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_userinfo();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result3 = parse_hostport();
if (result3 !== null) {
result4 = parse_uri_parameters();
if (result4 !== null) {
result5 = parse_headers();
result5 = result5 !== null ? result5 : "";
if (result5 !== null) {
result0 = [result0, result1, result2, result3, result4, result5];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
var header;
try {
data.uri = new URI(data.scheme, data.user, data.host, data.port, data.uri_params, data.uri_headers);
delete data.scheme;
delete data.user;
delete data.host;
delete data.host_type;
delete data.port;
delete data.uri_params;
if (startRule === 'SIP_URI') { data = data.uri;}
} catch(e) {
data = -1;
}})(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_uri_scheme() {
var result0;
var pos0;
if (input.substr(pos, 3).toLowerCase() === "sip") {
result0 = input.substr(pos, 3);
pos += 3;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"sip\"");
}
}
if (result0 === null) {
pos0 = pos;
if (input.substr(pos, 4).toLowerCase() === "sips") {
result0 = input.substr(pos, 4);
pos += 4;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"sips\"");
}
}
if (result0 !== null) {
result0 = (function(offset) {
data.scheme = uri_scheme.toLowerCase(); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
}
return result0;
}
function parse_userinfo() {
var result0, result1, result2;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_user();
if (result0 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_password();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
if (input.charCodeAt(pos) === 64) {
result2 = "@";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"@\"");
}
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
data.user = decodeURIComponent(input.substring(pos-1, offset));})(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_user() {
var result0, result1;
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
if (result1 === null) {
result1 = parse_user_unreserved();
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
if (result1 === null) {
result1 = parse_user_unreserved();
}
}
}
} else {
result0 = null;
}
return result0;
}
function parse_user_unreserved() {
var result0;
if (input.charCodeAt(pos) === 38) {
result0 = "&";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"&\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 61) {
result0 = "=";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 43) {
result0 = "+";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 36) {
result0 = "$";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"$\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 44) {
result0 = ",";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 59) {
result0 = ";";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 63) {
result0 = "?";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"?\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 47) {
result0 = "/";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
}
}
}
}
}
}
}
return result0;
}
function parse_password() {
var result0, result1;
var pos0;
pos0 = pos;
result0 = [];
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
if (result1 === null) {
if (input.charCodeAt(pos) === 38) {
result1 = "&";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"&\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 61) {
result1 = "=";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 43) {
result1 = "+";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 36) {
result1 = "$";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"$\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 44) {
result1 = ",";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
}
}
}
}
}
}
while (result1 !== null) {
result0.push(result1);
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
if (result1 === null) {
if (input.charCodeAt(pos) === 38) {
result1 = "&";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"&\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 61) {
result1 = "=";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 43) {
result1 = "+";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 36) {
result1 = "$";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"$\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 44) {
result1 = ",";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
}
}
}
}
}
}
}
if (result0 !== null) {
result0 = (function(offset) {
data.password = input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_hostport() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
result0 = parse_host();
if (result0 !== null) {
pos1 = pos;
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_port();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos1;
}
} else {
result1 = null;
pos = pos1;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_host() {
var result0;
var pos0;
pos0 = pos;
result0 = parse_IPv4address();
if (result0 === null) {
result0 = parse_IPv6reference();
if (result0 === null) {
result0 = parse_hostname();
}
}
if (result0 !== null) {
result0 = (function(offset) {
data.host = input.substring(pos, offset).toLowerCase();
return data.host; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_hostname() {
var result0, result1, result2;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = [];
pos2 = pos;
result1 = parse_domainlabel();
if (result1 !== null) {
if (input.charCodeAt(pos) === 46) {
result2 = ".";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
while (result1 !== null) {
result0.push(result1);
pos2 = pos;
result1 = parse_domainlabel();
if (result1 !== null) {
if (input.charCodeAt(pos) === 46) {
result2 = ".";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
}
if (result0 !== null) {
result1 = parse_toplabel();
if (result1 !== null) {
if (input.charCodeAt(pos) === 46) {
result2 = ".";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
data.host_type = 'domain';
return input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_domainlabel() {
var result0, result1;
if (/^[a-zA-Z0-9_\-]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z0-9_\\-]");
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
if (/^[a-zA-Z0-9_\-]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z0-9_\\-]");
}
}
}
} else {
result0 = null;
}
return result0;
}
function parse_toplabel() {
var result0, result1;
if (/^[a-zA-Z0-9_\-]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z0-9_\\-]");
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
if (/^[a-zA-Z0-9_\-]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[a-zA-Z0-9_\\-]");
}
}
}
} else {
result0 = null;
}
return result0;
}
function parse_IPv6reference() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.charCodeAt(pos) === 91) {
result0 = "[";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"[\"");
}
}
if (result0 !== null) {
result1 = parse_IPv6address();
if (result1 !== null) {
if (input.charCodeAt(pos) === 93) {
result2 = "]";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"]\"");
}
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
data.host_type = 'IPv6';
return input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_IPv6address() {
var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_h16();
if (result0 !== null) {
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_h16();
if (result2 !== null) {
if (input.charCodeAt(pos) === 58) {
result3 = ":";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result3 !== null) {
result4 = parse_h16();
if (result4 !== null) {
if (input.charCodeAt(pos) === 58) {
result5 = ":";
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result5 !== null) {
result6 = parse_h16();
if (result6 !== null) {
if (input.charCodeAt(pos) === 58) {
result7 = ":";
pos++;
} else {
result7 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result7 !== null) {
result8 = parse_h16();
if (result8 !== null) {
if (input.charCodeAt(pos) === 58) {
result9 = ":";
pos++;
} else {
result9 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result9 !== null) {
result10 = parse_h16();
if (result10 !== null) {
if (input.charCodeAt(pos) === 58) {
result11 = ":";
pos++;
} else {
result11 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result11 !== null) {
result12 = parse_ls32();
if (result12 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
if (input.substr(pos, 2) === "::") {
result0 = "::";
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result0 !== null) {
result1 = parse_h16();
if (result1 !== null) {
if (input.charCodeAt(pos) === 58) {
result2 = ":";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result2 !== null) {
result3 = parse_h16();
if (result3 !== null) {
if (input.charCodeAt(pos) === 58) {
result4 = ":";
pos++;
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result4 !== null) {
result5 = parse_h16();
if (result5 !== null) {
if (input.charCodeAt(pos) === 58) {
result6 = ":";
pos++;
} else {
result6 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result6 !== null) {
result7 = parse_h16();
if (result7 !== null) {
if (input.charCodeAt(pos) === 58) {
result8 = ":";
pos++;
} else {
result8 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result8 !== null) {
result9 = parse_h16();
if (result9 !== null) {
if (input.charCodeAt(pos) === 58) {
result10 = ":";
pos++;
} else {
result10 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result10 !== null) {
result11 = parse_ls32();
if (result11 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
if (input.substr(pos, 2) === "::") {
result0 = "::";
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result0 !== null) {
result1 = parse_h16();
if (result1 !== null) {
if (input.charCodeAt(pos) === 58) {
result2 = ":";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result2 !== null) {
result3 = parse_h16();
if (result3 !== null) {
if (input.charCodeAt(pos) === 58) {
result4 = ":";
pos++;
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result4 !== null) {
result5 = parse_h16();
if (result5 !== null) {
if (input.charCodeAt(pos) === 58) {
result6 = ":";
pos++;
} else {
result6 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result6 !== null) {
result7 = parse_h16();
if (result7 !== null) {
if (input.charCodeAt(pos) === 58) {
result8 = ":";
pos++;
} else {
result8 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result8 !== null) {
result9 = parse_ls32();
if (result9 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
if (input.substr(pos, 2) === "::") {
result0 = "::";
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result0 !== null) {
result1 = parse_h16();
if (result1 !== null) {
if (input.charCodeAt(pos) === 58) {
result2 = ":";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result2 !== null) {
result3 = parse_h16();
if (result3 !== null) {
if (input.charCodeAt(pos) === 58) {
result4 = ":";
pos++;
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result4 !== null) {
result5 = parse_h16();
if (result5 !== null) {
if (input.charCodeAt(pos) === 58) {
result6 = ":";
pos++;
} else {
result6 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result6 !== null) {
result7 = parse_ls32();
if (result7 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
if (input.substr(pos, 2) === "::") {
result0 = "::";
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result0 !== null) {
result1 = parse_h16();
if (result1 !== null) {
if (input.charCodeAt(pos) === 58) {
result2 = ":";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result2 !== null) {
result3 = parse_h16();
if (result3 !== null) {
if (input.charCodeAt(pos) === 58) {
result4 = ":";
pos++;
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result4 !== null) {
result5 = parse_ls32();
if (result5 !== null) {
result0 = [result0, result1, result2, result3, result4, result5];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
if (input.substr(pos, 2) === "::") {
result0 = "::";
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result0 !== null) {
result1 = parse_h16();
if (result1 !== null) {
if (input.charCodeAt(pos) === 58) {
result2 = ":";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result2 !== null) {
result3 = parse_ls32();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
if (input.substr(pos, 2) === "::") {
result0 = "::";
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result0 !== null) {
result1 = parse_ls32();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
if (input.substr(pos, 2) === "::") {
result0 = "::";
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result0 !== null) {
result1 = parse_h16();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
result0 = parse_h16();
if (result0 !== null) {
if (input.substr(pos, 2) === "::") {
result1 = "::";
pos += 2;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result1 !== null) {
result2 = parse_h16();
if (result2 !== null) {
if (input.charCodeAt(pos) === 58) {
result3 = ":";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result3 !== null) {
result4 = parse_h16();
if (result4 !== null) {
if (input.charCodeAt(pos) === 58) {
result5 = ":";
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result5 !== null) {
result6 = parse_h16();
if (result6 !== null) {
if (input.charCodeAt(pos) === 58) {
result7 = ":";
pos++;
} else {
result7 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result7 !== null) {
result8 = parse_h16();
if (result8 !== null) {
if (input.charCodeAt(pos) === 58) {
result9 = ":";
pos++;
} else {
result9 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result9 !== null) {
result10 = parse_ls32();
if (result10 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
result0 = parse_h16();
if (result0 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_h16();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
if (input.substr(pos, 2) === "::") {
result2 = "::";
pos += 2;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result2 !== null) {
result3 = parse_h16();
if (result3 !== null) {
if (input.charCodeAt(pos) === 58) {
result4 = ":";
pos++;
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result4 !== null) {
result5 = parse_h16();
if (result5 !== null) {
if (input.charCodeAt(pos) === 58) {
result6 = ":";
pos++;
} else {
result6 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result6 !== null) {
result7 = parse_h16();
if (result7 !== null) {
if (input.charCodeAt(pos) === 58) {
result8 = ":";
pos++;
} else {
result8 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result8 !== null) {
result9 = parse_ls32();
if (result9 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
result0 = parse_h16();
if (result0 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_h16();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result2 = ":";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result2 !== null) {
result3 = parse_h16();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
if (input.substr(pos, 2) === "::") {
result3 = "::";
pos += 2;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result3 !== null) {
result4 = parse_h16();
if (result4 !== null) {
if (input.charCodeAt(pos) === 58) {
result5 = ":";
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result5 !== null) {
result6 = parse_h16();
if (result6 !== null) {
if (input.charCodeAt(pos) === 58) {
result7 = ":";
pos++;
} else {
result7 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result7 !== null) {
result8 = parse_ls32();
if (result8 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
result0 = parse_h16();
if (result0 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_h16();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result2 = ":";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result2 !== null) {
result3 = parse_h16();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result3 = ":";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result3 !== null) {
result4 = parse_h16();
if (result4 !== null) {
result3 = [result3, result4];
} else {
result3 = null;
pos = pos2;
}
} else {
result3 = null;
pos = pos2;
}
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
if (input.substr(pos, 2) === "::") {
result4 = "::";
pos += 2;
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result4 !== null) {
result5 = parse_h16();
if (result5 !== null) {
if (input.charCodeAt(pos) === 58) {
result6 = ":";
pos++;
} else {
result6 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result6 !== null) {
result7 = parse_ls32();
if (result7 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
result0 = parse_h16();
if (result0 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_h16();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result2 = ":";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result2 !== null) {
result3 = parse_h16();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result3 = ":";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result3 !== null) {
result4 = parse_h16();
if (result4 !== null) {
result3 = [result3, result4];
} else {
result3 = null;
pos = pos2;
}
} else {
result3 = null;
pos = pos2;
}
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result4 = ":";
pos++;
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result4 !== null) {
result5 = parse_h16();
if (result5 !== null) {
result4 = [result4, result5];
} else {
result4 = null;
pos = pos2;
}
} else {
result4 = null;
pos = pos2;
}
result4 = result4 !== null ? result4 : "";
if (result4 !== null) {
if (input.substr(pos, 2) === "::") {
result5 = "::";
pos += 2;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result5 !== null) {
result6 = parse_ls32();
if (result6 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
result0 = parse_h16();
if (result0 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_h16();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result2 = ":";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result2 !== null) {
result3 = parse_h16();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result3 = ":";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result3 !== null) {
result4 = parse_h16();
if (result4 !== null) {
result3 = [result3, result4];
} else {
result3 = null;
pos = pos2;
}
} else {
result3 = null;
pos = pos2;
}
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result4 = ":";
pos++;
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result4 !== null) {
result5 = parse_h16();
if (result5 !== null) {
result4 = [result4, result5];
} else {
result4 = null;
pos = pos2;
}
} else {
result4 = null;
pos = pos2;
}
result4 = result4 !== null ? result4 : "";
if (result4 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result5 = ":";
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result5 !== null) {
result6 = parse_h16();
if (result6 !== null) {
result5 = [result5, result6];
} else {
result5 = null;
pos = pos2;
}
} else {
result5 = null;
pos = pos2;
}
result5 = result5 !== null ? result5 : "";
if (result5 !== null) {
if (input.substr(pos, 2) === "::") {
result6 = "::";
pos += 2;
} else {
result6 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result6 !== null) {
result7 = parse_h16();
if (result7 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
pos1 = pos;
result0 = parse_h16();
if (result0 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_h16();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result2 = ":";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result2 !== null) {
result3 = parse_h16();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result3 = ":";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result3 !== null) {
result4 = parse_h16();
if (result4 !== null) {
result3 = [result3, result4];
} else {
result3 = null;
pos = pos2;
}
} else {
result3 = null;
pos = pos2;
}
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result4 = ":";
pos++;
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result4 !== null) {
result5 = parse_h16();
if (result5 !== null) {
result4 = [result4, result5];
} else {
result4 = null;
pos = pos2;
}
} else {
result4 = null;
pos = pos2;
}
result4 = result4 !== null ? result4 : "";
if (result4 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result5 = ":";
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result5 !== null) {
result6 = parse_h16();
if (result6 !== null) {
result5 = [result5, result6];
} else {
result5 = null;
pos = pos2;
}
} else {
result5 = null;
pos = pos2;
}
result5 = result5 !== null ? result5 : "";
if (result5 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 58) {
result6 = ":";
pos++;
} else {
result6 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result6 !== null) {
result7 = parse_h16();
if (result7 !== null) {
result6 = [result6, result7];
} else {
result6 = null;
pos = pos2;
}
} else {
result6 = null;
pos = pos2;
}
result6 = result6 !== null ? result6 : "";
if (result6 !== null) {
if (input.substr(pos, 2) === "::") {
result7 = "::";
pos += 2;
} else {
result7 = null;
if (reportFailures === 0) {
matchFailed("\"::\"");
}
}
if (result7 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (result0 !== null) {
result0 = (function(offset) {
data.host_type = 'IPv6';
return input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_h16() {
var result0, result1, result2, result3;
var pos0;
pos0 = pos;
result0 = parse_HEXDIG();
if (result0 !== null) {
result1 = parse_HEXDIG();
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result2 = parse_HEXDIG();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result3 = parse_HEXDIG();
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_ls32() {
var result0, result1, result2;
var pos0;
pos0 = pos;
result0 = parse_h16();
if (result0 !== null) {
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_h16();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
if (result0 === null) {
result0 = parse_IPv4address();
}
return result0;
}
function parse_IPv4address() {
var result0, result1, result2, result3, result4, result5, result6;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_dec_octet();
if (result0 !== null) {
if (input.charCodeAt(pos) === 46) {
result1 = ".";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result1 !== null) {
result2 = parse_dec_octet();
if (result2 !== null) {
if (input.charCodeAt(pos) === 46) {
result3 = ".";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result3 !== null) {
result4 = parse_dec_octet();
if (result4 !== null) {
if (input.charCodeAt(pos) === 46) {
result5 = ".";
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result5 !== null) {
result6 = parse_dec_octet();
if (result6 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
data.host_type = 'IPv4';
return input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_dec_octet() {
var result0, result1, result2;
var pos0;
pos0 = pos;
if (input.substr(pos, 2) === "25") {
result0 = "25";
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"25\"");
}
}
if (result0 !== null) {
if (/^[0-5]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[0-5]");
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
if (result0 === null) {
pos0 = pos;
if (input.charCodeAt(pos) === 50) {
result0 = "2";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"2\"");
}
}
if (result0 !== null) {
if (/^[0-4]/.test(input.charAt(pos))) {
result1 = input.charAt(pos);
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[0-4]");
}
}
if (result1 !== null) {
result2 = parse_DIGIT();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
if (result0 === null) {
pos0 = pos;
if (input.charCodeAt(pos) === 49) {
result0 = "1";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"1\"");
}
}
if (result0 !== null) {
result1 = parse_DIGIT();
if (result1 !== null) {
result2 = parse_DIGIT();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
if (result0 === null) {
pos0 = pos;
if (/^[1-9]/.test(input.charAt(pos))) {
result0 = input.charAt(pos);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[1-9]");
}
}
if (result0 !== null) {
result1 = parse_DIGIT();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
if (result0 === null) {
result0 = parse_DIGIT();
}
}
}
}
return result0;
}
function parse_port() {
var result0, result1, result2, result3, result4;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_DIGIT();
result0 = result0 !== null ? result0 : "";
if (result0 !== null) {
result1 = parse_DIGIT();
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result2 = parse_DIGIT();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result3 = parse_DIGIT();
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
result4 = parse_DIGIT();
result4 = result4 !== null ? result4 : "";
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, port) {
port = parseInt(port.join(''));
data.port = port;
return port; })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_uri_parameters() {
var result0, result1, result2;
var pos0;
result0 = [];
pos0 = pos;
if (input.charCodeAt(pos) === 59) {
result1 = ";";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result1 !== null) {
result2 = parse_uri_parameter();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos0;
}
} else {
result1 = null;
pos = pos0;
}
while (result1 !== null) {
result0.push(result1);
pos0 = pos;
if (input.charCodeAt(pos) === 59) {
result1 = ";";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result1 !== null) {
result2 = parse_uri_parameter();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos0;
}
} else {
result1 = null;
pos = pos0;
}
}
return result0;
}
function parse_uri_parameter() {
var result0;
result0 = parse_transport_param();
if (result0 === null) {
result0 = parse_user_param();
if (result0 === null) {
result0 = parse_method_param();
if (result0 === null) {
result0 = parse_ttl_param();
if (result0 === null) {
result0 = parse_maddr_param();
if (result0 === null) {
result0 = parse_lr_param();
if (result0 === null) {
result0 = parse_other_param();
}
}
}
}
}
}
return result0;
}
function parse_transport_param() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 10).toLowerCase() === "transport=") {
result0 = input.substr(pos, 10);
pos += 10;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"transport=\"");
}
}
if (result0 !== null) {
if (input.substr(pos, 3).toLowerCase() === "udp") {
result1 = input.substr(pos, 3);
pos += 3;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"udp\"");
}
}
if (result1 === null) {
if (input.substr(pos, 3).toLowerCase() === "tcp") {
result1 = input.substr(pos, 3);
pos += 3;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"tcp\"");
}
}
if (result1 === null) {
if (input.substr(pos, 4).toLowerCase() === "sctp") {
result1 = input.substr(pos, 4);
pos += 4;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"sctp\"");
}
}
if (result1 === null) {
if (input.substr(pos, 3).toLowerCase() === "tls") {
result1 = input.substr(pos, 3);
pos += 3;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"tls\"");
}
}
if (result1 === null) {
result1 = parse_token();
}
}
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, transport) {
if(!data.uri_params) data.uri_params={};
data.uri_params['transport'] = transport.toLowerCase(); })(pos0, result0[1]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_user_param() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 5).toLowerCase() === "user=") {
result0 = input.substr(pos, 5);
pos += 5;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"user=\"");
}
}
if (result0 !== null) {
if (input.substr(pos, 5).toLowerCase() === "phone") {
result1 = input.substr(pos, 5);
pos += 5;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"phone\"");
}
}
if (result1 === null) {
if (input.substr(pos, 2).toLowerCase() === "ip") {
result1 = input.substr(pos, 2);
pos += 2;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"ip\"");
}
}
if (result1 === null) {
result1 = parse_token();
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, user) {
if(!data.uri_params) data.uri_params={};
data.uri_params['user'] = user.toLowerCase(); })(pos0, result0[1]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_method_param() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 7).toLowerCase() === "method=") {
result0 = input.substr(pos, 7);
pos += 7;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"method=\"");
}
}
if (result0 !== null) {
result1 = parse_Method();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, method) {
if(!data.uri_params) data.uri_params={};
data.uri_params['method'] = method; })(pos0, result0[1]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_ttl_param() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 4).toLowerCase() === "ttl=") {
result0 = input.substr(pos, 4);
pos += 4;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"ttl=\"");
}
}
if (result0 !== null) {
result1 = parse_ttl();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, ttl) {
if(!data.params) data.params={};
data.params['ttl'] = ttl; })(pos0, result0[1]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_maddr_param() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 6).toLowerCase() === "maddr=") {
result0 = input.substr(pos, 6);
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"maddr=\"");
}
}
if (result0 !== null) {
result1 = parse_host();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, maddr) {
if(!data.uri_params) data.uri_params={};
data.uri_params['maddr'] = maddr; })(pos0, result0[1]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_lr_param() {
var result0, result1, result2;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 2).toLowerCase() === "lr") {
result0 = input.substr(pos, 2);
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"lr\"");
}
}
if (result0 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 61) {
result1 = "=";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result1 !== null) {
result2 = parse_token();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
if(!data.uri_params) data.uri_params={};
data.uri_params['lr'] = undefined; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_other_param() {
var result0, result1, result2;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_pname();
if (result0 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 61) {
result1 = "=";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result1 !== null) {
result2 = parse_pvalue();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, param, value) {
if(!data.uri_params) data.uri_params = {};
if (typeof value === 'undefined'){
value = undefined;
}
else {
value = value[1];
}
data.uri_params[param.toLowerCase()] = value && value.toLowerCase();})(pos0, result0[0], result0[1]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_pname() {
var result0, result1;
var pos0;
pos0 = pos;
result1 = parse_paramchar();
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_paramchar();
}
} else {
result0 = null;
}
if (result0 !== null) {
result0 = (function(offset, pname) {return pname.join(''); })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_pvalue() {
var result0, result1;
var pos0;
pos0 = pos;
result1 = parse_paramchar();
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_paramchar();
}
} else {
result0 = null;
}
if (result0 !== null) {
result0 = (function(offset, pvalue) {return pvalue.join(''); })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_paramchar() {
var result0;
result0 = parse_param_unreserved();
if (result0 === null) {
result0 = parse_unreserved();
if (result0 === null) {
result0 = parse_escaped();
}
}
return result0;
}
function parse_param_unreserved() {
var result0;
if (input.charCodeAt(pos) === 91) {
result0 = "[";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"[\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 93) {
result0 = "]";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"]\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 47) {
result0 = "/";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 58) {
result0 = ":";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 38) {
result0 = "&";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"&\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 43) {
result0 = "+";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 36) {
result0 = "$";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"$\"");
}
}
}
}
}
}
}
}
return result0;
}
function parse_headers() {
var result0, result1, result2, result3, result4;
var pos0, pos1;
pos0 = pos;
if (input.charCodeAt(pos) === 63) {
result0 = "?";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"?\"");
}
}
if (result0 !== null) {
result1 = parse_header();
if (result1 !== null) {
result2 = [];
pos1 = pos;
if (input.charCodeAt(pos) === 38) {
result3 = "&";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\"&\"");
}
}
if (result3 !== null) {
result4 = parse_header();
if (result4 !== null) {
result3 = [result3, result4];
} else {
result3 = null;
pos = pos1;
}
} else {
result3 = null;
pos = pos1;
}
while (result3 !== null) {
result2.push(result3);
pos1 = pos;
if (input.charCodeAt(pos) === 38) {
result3 = "&";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\"&\"");
}
}
if (result3 !== null) {
result4 = parse_header();
if (result4 !== null) {
result3 = [result3, result4];
} else {
result3 = null;
pos = pos1;
}
} else {
result3 = null;
pos = pos1;
}
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_header() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_hname();
if (result0 !== null) {
if (input.charCodeAt(pos) === 61) {
result1 = "=";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result1 !== null) {
result2 = parse_hvalue();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, hname, hvalue) {
hname = hname.join('').toLowerCase();
hvalue = hvalue.join('');
if(!data.uri_headers) data.uri_headers = {};
if (!data.uri_headers[hname]) {
data.uri_headers[hname] = [hvalue];
} else {
data.uri_headers[hname].push(hvalue);
}})(pos0, result0[0], result0[2]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_hname() {
var result0, result1;
result1 = parse_hnv_unreserved();
if (result1 === null) {
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_hnv_unreserved();
if (result1 === null) {
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
}
}
}
} else {
result0 = null;
}
return result0;
}
function parse_hvalue() {
var result0, result1;
result0 = [];
result1 = parse_hnv_unreserved();
if (result1 === null) {
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
}
}
while (result1 !== null) {
result0.push(result1);
result1 = parse_hnv_unreserved();
if (result1 === null) {
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
}
}
}
return result0;
}
function parse_hnv_unreserved() {
var result0;
if (input.charCodeAt(pos) === 91) {
result0 = "[";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"[\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 93) {
result0 = "]";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"]\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 47) {
result0 = "/";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 63) {
result0 = "?";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"?\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 58) {
result0 = ":";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 43) {
result0 = "+";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 36) {
result0 = "$";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"$\"");
}
}
}
}
}
}
}
}
return result0;
}
function parse_Request_Response() {
var result0;
result0 = parse_Status_Line();
if (result0 === null) {
result0 = parse_Request_Line();
}
return result0;
}
function parse_Request_Line() {
var result0, result1, result2, result3, result4;
var pos0;
pos0 = pos;
result0 = parse_Method();
if (result0 !== null) {
result1 = parse_SP();
if (result1 !== null) {
result2 = parse_Request_URI();
if (result2 !== null) {
result3 = parse_SP();
if (result3 !== null) {
result4 = parse_SIP_Version();
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_Request_URI() {
var result0;
result0 = parse_SIP_URI();
if (result0 === null) {
result0 = parse_absoluteURI();
}
return result0;
}
function parse_absoluteURI() {
var result0, result1, result2;
var pos0;
pos0 = pos;
result0 = parse_scheme();
if (result0 !== null) {
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 !== null) {
result2 = parse_hier_part();
if (result2 === null) {
result2 = parse_opaque_part();
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_hier_part() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
result0 = parse_net_path();
if (result0 === null) {
result0 = parse_abs_path();
}
if (result0 !== null) {
pos1 = pos;
if (input.charCodeAt(pos) === 63) {
result1 = "?";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"?\"");
}
}
if (result1 !== null) {
result2 = parse_query();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos1;
}
} else {
result1 = null;
pos = pos1;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_net_path() {
var result0, result1, result2;
var pos0;
pos0 = pos;
if (input.substr(pos, 2) === "//") {
result0 = "//";
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"//\"");
}
}
if (result0 !== null) {
result1 = parse_authority();
if (result1 !== null) {
result2 = parse_abs_path();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_abs_path() {
var result0, result1;
var pos0;
pos0 = pos;
if (input.charCodeAt(pos) === 47) {
result0 = "/";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
if (result0 !== null) {
result1 = parse_path_segments();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_opaque_part() {
var result0, result1, result2;
var pos0;
pos0 = pos;
result0 = parse_uric_no_slash();
if (result0 !== null) {
result1 = [];
result2 = parse_uric();
while (result2 !== null) {
result1.push(result2);
result2 = parse_uric();
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_uric() {
var result0;
result0 = parse_reserved();
if (result0 === null) {
result0 = parse_unreserved();
if (result0 === null) {
result0 = parse_escaped();
}
}
return result0;
}
function parse_uric_no_slash() {
var result0;
result0 = parse_unreserved();
if (result0 === null) {
result0 = parse_escaped();
if (result0 === null) {
if (input.charCodeAt(pos) === 59) {
result0 = ";";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 63) {
result0 = "?";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"?\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 58) {
result0 = ":";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 64) {
result0 = "@";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"@\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 38) {
result0 = "&";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"&\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 61) {
result0 = "=";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 43) {
result0 = "+";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 36) {
result0 = "$";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"$\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 44) {
result0 = ",";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
}
}
}
}
}
}
}
}
}
}
return result0;
}
function parse_path_segments() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_segment();
if (result0 !== null) {
result1 = [];
pos1 = pos;
if (input.charCodeAt(pos) === 47) {
result2 = "/";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
if (result2 !== null) {
result3 = parse_segment();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
if (input.charCodeAt(pos) === 47) {
result2 = "/";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
if (result2 !== null) {
result3 = parse_segment();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_segment() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = [];
result1 = parse_pchar();
while (result1 !== null) {
result0.push(result1);
result1 = parse_pchar();
}
if (result0 !== null) {
result1 = [];
pos1 = pos;
if (input.charCodeAt(pos) === 59) {
result2 = ";";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result2 !== null) {
result3 = parse_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
if (input.charCodeAt(pos) === 59) {
result2 = ";";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result2 !== null) {
result3 = parse_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_param() {
var result0, result1;
result0 = [];
result1 = parse_pchar();
while (result1 !== null) {
result0.push(result1);
result1 = parse_pchar();
}
return result0;
}
function parse_pchar() {
var result0;
result0 = parse_unreserved();
if (result0 === null) {
result0 = parse_escaped();
if (result0 === null) {
if (input.charCodeAt(pos) === 58) {
result0 = ":";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 64) {
result0 = "@";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"@\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 38) {
result0 = "&";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"&\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 61) {
result0 = "=";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 43) {
result0 = "+";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 36) {
result0 = "$";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"$\"");
}
}
if (result0 === null) {
if (input.charCodeAt(pos) === 44) {
result0 = ",";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
}
}
}
}
}
}
}
}
return result0;
}
function parse_scheme() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_ALPHA();
if (result0 !== null) {
result1 = [];
result2 = parse_ALPHA();
if (result2 === null) {
result2 = parse_DIGIT();
if (result2 === null) {
if (input.charCodeAt(pos) === 43) {
result2 = "+";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result2 === null) {
if (input.charCodeAt(pos) === 45) {
result2 = "-";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result2 === null) {
if (input.charCodeAt(pos) === 46) {
result2 = ".";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
}
}
}
}
while (result2 !== null) {
result1.push(result2);
result2 = parse_ALPHA();
if (result2 === null) {
result2 = parse_DIGIT();
if (result2 === null) {
if (input.charCodeAt(pos) === 43) {
result2 = "+";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
if (result2 === null) {
if (input.charCodeAt(pos) === 45) {
result2 = "-";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result2 === null) {
if (input.charCodeAt(pos) === 46) {
result2 = ".";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
}
}
}
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
data.scheme= input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_authority() {
var result0;
result0 = parse_srvr();
if (result0 === null) {
result0 = parse_reg_name();
}
return result0;
}
function parse_srvr() {
var result0, result1;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_userinfo();
if (result0 !== null) {
if (input.charCodeAt(pos) === 64) {
result1 = "@";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"@\"");
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
result0 = result0 !== null ? result0 : "";
if (result0 !== null) {
result1 = parse_hostport();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
result0 = result0 !== null ? result0 : "";
return result0;
}
function parse_reg_name() {
var result0, result1;
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
if (result1 === null) {
if (input.charCodeAt(pos) === 36) {
result1 = "$";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"$\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 44) {
result1 = ",";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 59) {
result1 = ";";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 64) {
result1 = "@";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"@\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 38) {
result1 = "&";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"&\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 61) {
result1 = "=";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 43) {
result1 = "+";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
}
}
}
}
}
}
}
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
if (result1 === null) {
if (input.charCodeAt(pos) === 36) {
result1 = "$";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"$\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 44) {
result1 = ",";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 59) {
result1 = ";";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 58) {
result1 = ":";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 64) {
result1 = "@";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"@\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 38) {
result1 = "&";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"&\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 61) {
result1 = "=";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result1 === null) {
if (input.charCodeAt(pos) === 43) {
result1 = "+";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"+\"");
}
}
}
}
}
}
}
}
}
}
}
}
} else {
result0 = null;
}
return result0;
}
function parse_query() {
var result0, result1;
result0 = [];
result1 = parse_uric();
while (result1 !== null) {
result0.push(result1);
result1 = parse_uric();
}
return result0;
}
function parse_SIP_Version() {
var result0, result1, result2, result3, result4, result5;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 3).toLowerCase() === "sip") {
result0 = input.substr(pos, 3);
pos += 3;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"SIP\"");
}
}
if (result0 !== null) {
if (input.charCodeAt(pos) === 47) {
result1 = "/";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"/\"");
}
}
if (result1 !== null) {
result3 = parse_DIGIT();
if (result3 !== null) {
result2 = [];
while (result3 !== null) {
result2.push(result3);
result3 = parse_DIGIT();
}
} else {
result2 = null;
}
if (result2 !== null) {
if (input.charCodeAt(pos) === 46) {
result3 = ".";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result3 !== null) {
result5 = parse_DIGIT();
if (result5 !== null) {
result4 = [];
while (result5 !== null) {
result4.push(result5);
result5 = parse_DIGIT();
}
} else {
result4 = null;
}
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
data.sip_version = input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_INVITEm() {
var result0;
if (input.substr(pos, 6) === "INVITE") {
result0 = "INVITE";
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"INVITE\"");
}
}
return result0;
}
function parse_ACKm() {
var result0;
if (input.substr(pos, 3) === "ACK") {
result0 = "ACK";
pos += 3;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"ACK\"");
}
}
return result0;
}
function parse_OPTIONSm() {
var result0;
if (input.substr(pos, 7) === "OPTIONS") {
result0 = "OPTIONS";
pos += 7;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"OPTIONS\"");
}
}
return result0;
}
function parse_BYEm() {
var result0;
if (input.substr(pos, 3) === "BYE") {
result0 = "BYE";
pos += 3;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"BYE\"");
}
}
return result0;
}
function parse_CANCELm() {
var result0;
if (input.substr(pos, 6) === "CANCEL") {
result0 = "CANCEL";
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"CANCEL\"");
}
}
return result0;
}
function parse_REGISTERm() {
var result0;
if (input.substr(pos, 8) === "REGISTER") {
result0 = "REGISTER";
pos += 8;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"REGISTER\"");
}
}
return result0;
}
function parse_SUBSCRIBEm() {
var result0;
if (input.substr(pos, 9) === "SUBSCRIBE") {
result0 = "SUBSCRIBE";
pos += 9;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"SUBSCRIBE\"");
}
}
return result0;
}
function parse_NOTIFYm() {
var result0;
if (input.substr(pos, 6) === "NOTIFY") {
result0 = "NOTIFY";
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"NOTIFY\"");
}
}
return result0;
}
function parse_Method() {
var result0;
var pos0;
pos0 = pos;
result0 = parse_INVITEm();
if (result0 === null) {
result0 = parse_ACKm();
if (result0 === null) {
result0 = parse_OPTIONSm();
if (result0 === null) {
result0 = parse_BYEm();
if (result0 === null) {
result0 = parse_CANCELm();
if (result0 === null) {
result0 = parse_REGISTERm();
if (result0 === null) {
result0 = parse_SUBSCRIBEm();
if (result0 === null) {
result0 = parse_NOTIFYm();
if (result0 === null) {
result0 = parse_token();
}
}
}
}
}
}
}
}
if (result0 !== null) {
result0 = (function(offset) {
data.method = input.substring(pos, offset);
return data.method; })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Status_Line() {
var result0, result1, result2, result3, result4;
var pos0;
pos0 = pos;
result0 = parse_SIP_Version();
if (result0 !== null) {
result1 = parse_SP();
if (result1 !== null) {
result2 = parse_Status_Code();
if (result2 !== null) {
result3 = parse_SP();
if (result3 !== null) {
result4 = parse_Reason_Phrase();
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_Status_Code() {
var result0;
var pos0;
pos0 = pos;
result0 = parse_extension_code();
if (result0 !== null) {
result0 = (function(offset, status_code) {
data.status_code = parseInt(status_code.join('')); })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_extension_code() {
var result0, result1, result2;
var pos0;
pos0 = pos;
result0 = parse_DIGIT();
if (result0 !== null) {
result1 = parse_DIGIT();
if (result1 !== null) {
result2 = parse_DIGIT();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_Reason_Phrase() {
var result0, result1;
var pos0;
pos0 = pos;
result0 = [];
result1 = parse_reserved();
if (result1 === null) {
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
if (result1 === null) {
result1 = parse_UTF8_NONASCII();
if (result1 === null) {
result1 = parse_UTF8_CONT();
if (result1 === null) {
result1 = parse_SP();
if (result1 === null) {
result1 = parse_HTAB();
}
}
}
}
}
}
while (result1 !== null) {
result0.push(result1);
result1 = parse_reserved();
if (result1 === null) {
result1 = parse_unreserved();
if (result1 === null) {
result1 = parse_escaped();
if (result1 === null) {
result1 = parse_UTF8_NONASCII();
if (result1 === null) {
result1 = parse_UTF8_CONT();
if (result1 === null) {
result1 = parse_SP();
if (result1 === null) {
result1 = parse_HTAB();
}
}
}
}
}
}
}
if (result0 !== null) {
result0 = (function(offset) {
data.reason_phrase = input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Allow_Events() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_event_type();
if (result0 !== null) {
result1 = [];
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_event_type();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_event_type();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_Call_ID() {
var result0, result1, result2;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_word();
if (result0 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 64) {
result1 = "@";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"@\"");
}
}
if (result1 !== null) {
result2 = parse_word();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
data = input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Contact() {
var result0, result1, result2, result3;
var pos0, pos1, pos2;
pos0 = pos;
result0 = parse_STAR();
if (result0 === null) {
pos1 = pos;
result0 = parse_contact_param();
if (result0 !== null) {
result1 = [];
pos2 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_contact_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
while (result2 !== null) {
result1.push(result2);
pos2 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_contact_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
}
if (result0 !== null) {
result0 = (function(offset) {
var idx, length;
length = data.multi_header.length;
for (idx = 0; idx < length; idx++) {
if (data.multi_header[idx].parsed === null) {
data = null;
break;
}
}
if (data !== null) {
data = data.multi_header;
} else {
data = -1;
}})(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_contact_param() {
var result0, result1, result2, result3;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_SIP_URI_noparams();
if (result0 === null) {
result0 = parse_name_addr();
}
if (result0 !== null) {
result1 = [];
pos2 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_contact_params();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
while (result2 !== null) {
result1.push(result2);
pos2 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_contact_params();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
var header;
if(!data.multi_header) data.multi_header = [];
try {
header = new NameAddrHeader(data.uri, data.display_name, data.params);
delete data.uri;
delete data.display_name;
delete data.params;
} catch(e) {
header = null;
}
data.multi_header.push( { 'possition': pos,
'offset': offset,
'parsed': header
});})(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_name_addr() {
var result0, result1, result2, result3;
var pos0;
pos0 = pos;
result0 = parse_display_name();
result0 = result0 !== null ? result0 : "";
if (result0 !== null) {
result1 = parse_LAQUOT();
if (result1 !== null) {
result2 = parse_SIP_URI();
if (result2 !== null) {
result3 = parse_RAQUOT();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_display_name() {
var result0, result1, result2, result3;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_token();
if (result0 !== null) {
result1 = [];
pos2 = pos;
result2 = parse_LWS();
if (result2 !== null) {
result3 = parse_token();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
while (result2 !== null) {
result1.push(result2);
pos2 = pos;
result2 = parse_LWS();
if (result2 !== null) {
result3 = parse_token();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 === null) {
result0 = parse_quoted_string();
}
if (result0 !== null) {
result0 = (function(offset, display_name) {
display_name = input.substring(pos, offset).trim();
if (display_name[0] === '\"') {
display_name = display_name.substring(1, display_name.length-1);
}
data.display_name = display_name; })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_contact_params() {
var result0;
result0 = parse_c_p_q();
if (result0 === null) {
result0 = parse_c_p_expires();
if (result0 === null) {
result0 = parse_generic_param();
}
}
return result0;
}
function parse_c_p_q() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 1).toLowerCase() === "q") {
result0 = input.substr(pos, 1);
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"q\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_qvalue();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, q) {
if(!data.params) data.params = {};
data.params['q'] = q; })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_c_p_expires() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 7).toLowerCase() === "expires") {
result0 = input.substr(pos, 7);
pos += 7;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"expires\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_delta_seconds();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, expires) {
if(!data.params) data.params = {};
data.params['expires'] = expires; })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_delta_seconds() {
var result0, result1;
var pos0;
pos0 = pos;
result1 = parse_DIGIT();
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_DIGIT();
}
} else {
result0 = null;
}
if (result0 !== null) {
result0 = (function(offset, delta_seconds) {
return parseInt(delta_seconds.join('')); })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_qvalue() {
var result0, result1, result2, result3, result4;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
if (input.charCodeAt(pos) === 48) {
result0 = "0";
pos++;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"0\"");
}
}
if (result0 !== null) {
pos2 = pos;
if (input.charCodeAt(pos) === 46) {
result1 = ".";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result1 !== null) {
result2 = parse_DIGIT();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result3 = parse_DIGIT();
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
result4 = parse_DIGIT();
result4 = result4 !== null ? result4 : "";
if (result4 !== null) {
result1 = [result1, result2, result3, result4];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
return parseFloat(input.substring(pos, offset)); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_generic_param() {
var result0, result1, result2;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_token();
if (result0 !== null) {
pos2 = pos;
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_gen_value();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, param, value) {
if(!data.params) data.params = {};
if (typeof value === 'undefined'){
value = undefined;
}
else {
value = value[1];
}
data.params[param.toLowerCase()] = value;})(pos0, result0[0], result0[1]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_gen_value() {
var result0;
result0 = parse_token();
if (result0 === null) {
result0 = parse_host();
if (result0 === null) {
result0 = parse_quoted_string();
}
}
return result0;
}
function parse_Content_Disposition() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_disp_type();
if (result0 !== null) {
result1 = [];
pos1 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_disp_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_disp_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_disp_type() {
var result0;
if (input.substr(pos, 6).toLowerCase() === "render") {
result0 = input.substr(pos, 6);
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"render\"");
}
}
if (result0 === null) {
if (input.substr(pos, 7).toLowerCase() === "session") {
result0 = input.substr(pos, 7);
pos += 7;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"session\"");
}
}
if (result0 === null) {
if (input.substr(pos, 4).toLowerCase() === "icon") {
result0 = input.substr(pos, 4);
pos += 4;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"icon\"");
}
}
if (result0 === null) {
if (input.substr(pos, 5).toLowerCase() === "alert") {
result0 = input.substr(pos, 5);
pos += 5;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"alert\"");
}
}
if (result0 === null) {
result0 = parse_token();
}
}
}
}
return result0;
}
function parse_disp_param() {
var result0;
result0 = parse_handling_param();
if (result0 === null) {
result0 = parse_generic_param();
}
return result0;
}
function parse_handling_param() {
var result0, result1, result2;
var pos0;
pos0 = pos;
if (input.substr(pos, 8).toLowerCase() === "handling") {
result0 = input.substr(pos, 8);
pos += 8;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"handling\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
if (input.substr(pos, 8).toLowerCase() === "optional") {
result2 = input.substr(pos, 8);
pos += 8;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"optional\"");
}
}
if (result2 === null) {
if (input.substr(pos, 8).toLowerCase() === "required") {
result2 = input.substr(pos, 8);
pos += 8;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"required\"");
}
}
if (result2 === null) {
result2 = parse_token();
}
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_Content_Encoding() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_token();
if (result0 !== null) {
result1 = [];
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_token();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_token();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_Content_Length() {
var result0, result1;
var pos0;
pos0 = pos;
result1 = parse_DIGIT();
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_DIGIT();
}
} else {
result0 = null;
}
if (result0 !== null) {
result0 = (function(offset, length) {
data = parseInt(length.join('')); })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Content_Type() {
var result0;
var pos0;
pos0 = pos;
result0 = parse_media_type();
if (result0 !== null) {
result0 = (function(offset) {
data = input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_media_type() {
var result0, result1, result2, result3, result4, result5;
var pos0, pos1;
pos0 = pos;
result0 = parse_m_type();
if (result0 !== null) {
result1 = parse_SLASH();
if (result1 !== null) {
result2 = parse_m_subtype();
if (result2 !== null) {
result3 = [];
pos1 = pos;
result4 = parse_SEMI();
if (result4 !== null) {
result5 = parse_m_parameter();
if (result5 !== null) {
result4 = [result4, result5];
} else {
result4 = null;
pos = pos1;
}
} else {
result4 = null;
pos = pos1;
}
while (result4 !== null) {
result3.push(result4);
pos1 = pos;
result4 = parse_SEMI();
if (result4 !== null) {
result5 = parse_m_parameter();
if (result5 !== null) {
result4 = [result4, result5];
} else {
result4 = null;
pos = pos1;
}
} else {
result4 = null;
pos = pos1;
}
}
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_m_type() {
var result0;
result0 = parse_discrete_type();
if (result0 === null) {
result0 = parse_composite_type();
}
return result0;
}
function parse_discrete_type() {
var result0;
if (input.substr(pos, 4).toLowerCase() === "text") {
result0 = input.substr(pos, 4);
pos += 4;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"text\"");
}
}
if (result0 === null) {
if (input.substr(pos, 5).toLowerCase() === "image") {
result0 = input.substr(pos, 5);
pos += 5;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"image\"");
}
}
if (result0 === null) {
if (input.substr(pos, 5).toLowerCase() === "audio") {
result0 = input.substr(pos, 5);
pos += 5;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"audio\"");
}
}
if (result0 === null) {
if (input.substr(pos, 5).toLowerCase() === "video") {
result0 = input.substr(pos, 5);
pos += 5;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"video\"");
}
}
if (result0 === null) {
if (input.substr(pos, 11).toLowerCase() === "application") {
result0 = input.substr(pos, 11);
pos += 11;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"application\"");
}
}
if (result0 === null) {
result0 = parse_extension_token();
}
}
}
}
}
return result0;
}
function parse_composite_type() {
var result0;
if (input.substr(pos, 7).toLowerCase() === "message") {
result0 = input.substr(pos, 7);
pos += 7;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"message\"");
}
}
if (result0 === null) {
if (input.substr(pos, 9).toLowerCase() === "multipart") {
result0 = input.substr(pos, 9);
pos += 9;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"multipart\"");
}
}
if (result0 === null) {
result0 = parse_extension_token();
}
}
return result0;
}
function parse_extension_token() {
var result0;
result0 = parse_token();
if (result0 === null) {
result0 = parse_x_token();
}
return result0;
}
function parse_x_token() {
var result0, result1;
var pos0;
pos0 = pos;
if (input.substr(pos, 2).toLowerCase() === "x-") {
result0 = input.substr(pos, 2);
pos += 2;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"x-\"");
}
}
if (result0 !== null) {
result1 = parse_token();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_m_subtype() {
var result0;
result0 = parse_extension_token();
if (result0 === null) {
result0 = parse_token();
}
return result0;
}
function parse_m_parameter() {
var result0, result1, result2;
var pos0;
pos0 = pos;
result0 = parse_token();
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_m_value();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_m_value() {
var result0;
result0 = parse_token();
if (result0 === null) {
result0 = parse_quoted_string();
}
return result0;
}
function parse_CSeq() {
var result0, result1, result2;
var pos0;
pos0 = pos;
result0 = parse_CSeq_value();
if (result0 !== null) {
result1 = parse_LWS();
if (result1 !== null) {
result2 = parse_Method();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_CSeq_value() {
var result0, result1;
var pos0;
pos0 = pos;
result1 = parse_DIGIT();
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_DIGIT();
}
} else {
result0 = null;
}
if (result0 !== null) {
result0 = (function(offset, cseq_value) {
data.value=parseInt(cseq_value.join('')); })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Expires() {
var result0;
var pos0;
pos0 = pos;
result0 = parse_delta_seconds();
if (result0 !== null) {
result0 = (function(offset, expires) {data = expires; })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Event() {
var result0, result1, result2, result3;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_event_type();
if (result0 !== null) {
result1 = [];
pos2 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_generic_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
while (result2 !== null) {
result1.push(result2);
pos2 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_generic_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, event_type) {
data.event = event_type.join('').toLowerCase(); })(pos0, result0[0]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_event_type() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_token_nodot();
if (result0 !== null) {
result1 = [];
pos1 = pos;
if (input.charCodeAt(pos) === 46) {
result2 = ".";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result2 !== null) {
result3 = parse_token_nodot();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
if (input.charCodeAt(pos) === 46) {
result2 = ".";
pos++;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result2 !== null) {
result3 = parse_token_nodot();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_From() {
var result0, result1, result2, result3;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_SIP_URI_noparams();
if (result0 === null) {
result0 = parse_name_addr();
}
if (result0 !== null) {
result1 = [];
pos2 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_from_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
while (result2 !== null) {
result1.push(result2);
pos2 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_from_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
var tag = data.tag;
try {
data = new NameAddrHeader(data.uri, data.display_name, data.params);
if (tag) {data.setParam('tag',tag)}
} catch(e) {
data = -1;
}})(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_from_param() {
var result0;
result0 = parse_tag_param();
if (result0 === null) {
result0 = parse_generic_param();
}
return result0;
}
function parse_tag_param() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 3).toLowerCase() === "tag") {
result0 = input.substr(pos, 3);
pos += 3;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"tag\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_token();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, tag) {data.tag = tag; })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Max_Forwards() {
var result0, result1;
var pos0;
pos0 = pos;
result1 = parse_DIGIT();
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
result1 = parse_DIGIT();
}
} else {
result0 = null;
}
if (result0 !== null) {
result0 = (function(offset, forwards) {
data = parseInt(forwards.join('')); })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Min_Expires() {
var result0;
var pos0;
pos0 = pos;
result0 = parse_delta_seconds();
if (result0 !== null) {
result0 = (function(offset, min_expires) {data = min_expires; })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Name_Addr_Header() {
var result0, result1, result2, result3, result4, result5, result6;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = [];
result1 = parse_display_name();
while (result1 !== null) {
result0.push(result1);
result1 = parse_display_name();
}
if (result0 !== null) {
result1 = parse_LAQUOT();
if (result1 !== null) {
result2 = parse_SIP_URI();
if (result2 !== null) {
result3 = parse_RAQUOT();
if (result3 !== null) {
result4 = [];
pos2 = pos;
result5 = parse_SEMI();
if (result5 !== null) {
result6 = parse_generic_param();
if (result6 !== null) {
result5 = [result5, result6];
} else {
result5 = null;
pos = pos2;
}
} else {
result5 = null;
pos = pos2;
}
while (result5 !== null) {
result4.push(result5);
pos2 = pos;
result5 = parse_SEMI();
if (result5 !== null) {
result6 = parse_generic_param();
if (result6 !== null) {
result5 = [result5, result6];
} else {
result5 = null;
pos = pos2;
}
} else {
result5 = null;
pos = pos2;
}
}
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
try {
data = new NameAddrHeader(data.uri, data.display_name, data.params);
} catch(e) {
data = -1;
}})(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Proxy_Authenticate() {
var result0;
result0 = parse_challenge();
return result0;
}
function parse_challenge() {
var result0, result1, result2, result3, result4, result5;
var pos0, pos1;
pos0 = pos;
if (input.substr(pos, 6).toLowerCase() === "digest") {
result0 = input.substr(pos, 6);
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"Digest\"");
}
}
if (result0 !== null) {
result1 = parse_LWS();
if (result1 !== null) {
result2 = parse_digest_cln();
if (result2 !== null) {
result3 = [];
pos1 = pos;
result4 = parse_COMMA();
if (result4 !== null) {
result5 = parse_digest_cln();
if (result5 !== null) {
result4 = [result4, result5];
} else {
result4 = null;
pos = pos1;
}
} else {
result4 = null;
pos = pos1;
}
while (result4 !== null) {
result3.push(result4);
pos1 = pos;
result4 = parse_COMMA();
if (result4 !== null) {
result5 = parse_digest_cln();
if (result5 !== null) {
result4 = [result4, result5];
} else {
result4 = null;
pos = pos1;
}
} else {
result4 = null;
pos = pos1;
}
}
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
if (result0 === null) {
result0 = parse_other_challenge();
}
return result0;
}
function parse_other_challenge() {
var result0, result1, result2, result3, result4, result5;
var pos0, pos1;
pos0 = pos;
result0 = parse_token();
if (result0 !== null) {
result1 = parse_LWS();
if (result1 !== null) {
result2 = parse_auth_param();
if (result2 !== null) {
result3 = [];
pos1 = pos;
result4 = parse_COMMA();
if (result4 !== null) {
result5 = parse_auth_param();
if (result5 !== null) {
result4 = [result4, result5];
} else {
result4 = null;
pos = pos1;
}
} else {
result4 = null;
pos = pos1;
}
while (result4 !== null) {
result3.push(result4);
pos1 = pos;
result4 = parse_COMMA();
if (result4 !== null) {
result5 = parse_auth_param();
if (result5 !== null) {
result4 = [result4, result5];
} else {
result4 = null;
pos = pos1;
}
} else {
result4 = null;
pos = pos1;
}
}
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_auth_param() {
var result0, result1, result2;
var pos0;
pos0 = pos;
result0 = parse_token();
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_token();
if (result2 === null) {
result2 = parse_quoted_string();
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_digest_cln() {
var result0;
result0 = parse_realm();
if (result0 === null) {
result0 = parse_domain();
if (result0 === null) {
result0 = parse_nonce();
if (result0 === null) {
result0 = parse_opaque();
if (result0 === null) {
result0 = parse_stale();
if (result0 === null) {
result0 = parse_algorithm();
if (result0 === null) {
result0 = parse_qop_options();
if (result0 === null) {
result0 = parse_auth_param();
}
}
}
}
}
}
}
return result0;
}
function parse_realm() {
var result0, result1, result2;
var pos0;
pos0 = pos;
if (input.substr(pos, 5).toLowerCase() === "realm") {
result0 = input.substr(pos, 5);
pos += 5;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"realm\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_realm_value();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_realm_value() {
var result0;
var pos0;
pos0 = pos;
result0 = parse_quoted_string_clean();
if (result0 !== null) {
result0 = (function(offset, realm) { data.realm = realm; })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_domain() {
var result0, result1, result2, result3, result4, result5, result6;
var pos0, pos1;
pos0 = pos;
if (input.substr(pos, 6).toLowerCase() === "domain") {
result0 = input.substr(pos, 6);
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"domain\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_LDQUOT();
if (result2 !== null) {
result3 = parse_URI();
if (result3 !== null) {
result4 = [];
pos1 = pos;
result6 = parse_SP();
if (result6 !== null) {
result5 = [];
while (result6 !== null) {
result5.push(result6);
result6 = parse_SP();
}
} else {
result5 = null;
}
if (result5 !== null) {
result6 = parse_URI();
if (result6 !== null) {
result5 = [result5, result6];
} else {
result5 = null;
pos = pos1;
}
} else {
result5 = null;
pos = pos1;
}
while (result5 !== null) {
result4.push(result5);
pos1 = pos;
result6 = parse_SP();
if (result6 !== null) {
result5 = [];
while (result6 !== null) {
result5.push(result6);
result6 = parse_SP();
}
} else {
result5 = null;
}
if (result5 !== null) {
result6 = parse_URI();
if (result6 !== null) {
result5 = [result5, result6];
} else {
result5 = null;
pos = pos1;
}
} else {
result5 = null;
pos = pos1;
}
}
if (result4 !== null) {
result5 = parse_RDQUOT();
if (result5 !== null) {
result0 = [result0, result1, result2, result3, result4, result5];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_URI() {
var result0;
result0 = parse_absoluteURI();
if (result0 === null) {
result0 = parse_abs_path();
}
return result0;
}
function parse_nonce() {
var result0, result1, result2;
var pos0;
pos0 = pos;
if (input.substr(pos, 5).toLowerCase() === "nonce") {
result0 = input.substr(pos, 5);
pos += 5;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"nonce\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_nonce_value();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_nonce_value() {
var result0;
var pos0;
pos0 = pos;
result0 = parse_quoted_string_clean();
if (result0 !== null) {
result0 = (function(offset, nonce) { data.nonce=nonce; })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_opaque() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 6).toLowerCase() === "opaque") {
result0 = input.substr(pos, 6);
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"opaque\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_quoted_string_clean();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, opaque) { data.opaque=opaque; })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_stale() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
if (input.substr(pos, 5).toLowerCase() === "stale") {
result0 = input.substr(pos, 5);
pos += 5;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"stale\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
pos1 = pos;
if (input.substr(pos, 4).toLowerCase() === "true") {
result2 = input.substr(pos, 4);
pos += 4;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"true\"");
}
}
if (result2 !== null) {
result2 = (function(offset) { data.stale=true; })(pos1);
}
if (result2 === null) {
pos = pos1;
}
if (result2 === null) {
pos1 = pos;
if (input.substr(pos, 5).toLowerCase() === "false") {
result2 = input.substr(pos, 5);
pos += 5;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"false\"");
}
}
if (result2 !== null) {
result2 = (function(offset) { data.stale=false; })(pos1);
}
if (result2 === null) {
pos = pos1;
}
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_algorithm() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 9).toLowerCase() === "algorithm") {
result0 = input.substr(pos, 9);
pos += 9;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"algorithm\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
if (input.substr(pos, 3).toLowerCase() === "md5") {
result2 = input.substr(pos, 3);
pos += 3;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"MD5\"");
}
}
if (result2 === null) {
if (input.substr(pos, 8).toLowerCase() === "md5-sess") {
result2 = input.substr(pos, 8);
pos += 8;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"MD5-sess\"");
}
}
if (result2 === null) {
result2 = parse_token();
}
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, algorithm) {
data.algorithm=algorithm.toUpperCase(); })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_qop_options() {
var result0, result1, result2, result3, result4, result5, result6;
var pos0, pos1, pos2;
pos0 = pos;
if (input.substr(pos, 3).toLowerCase() === "qop") {
result0 = input.substr(pos, 3);
pos += 3;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"qop\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_LDQUOT();
if (result2 !== null) {
pos1 = pos;
result3 = parse_qop_value();
if (result3 !== null) {
result4 = [];
pos2 = pos;
if (input.charCodeAt(pos) === 44) {
result5 = ",";
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
if (result5 !== null) {
result6 = parse_qop_value();
if (result6 !== null) {
result5 = [result5, result6];
} else {
result5 = null;
pos = pos2;
}
} else {
result5 = null;
pos = pos2;
}
while (result5 !== null) {
result4.push(result5);
pos2 = pos;
if (input.charCodeAt(pos) === 44) {
result5 = ",";
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
if (result5 !== null) {
result6 = parse_qop_value();
if (result6 !== null) {
result5 = [result5, result6];
} else {
result5 = null;
pos = pos2;
}
} else {
result5 = null;
pos = pos2;
}
}
if (result4 !== null) {
result3 = [result3, result4];
} else {
result3 = null;
pos = pos1;
}
} else {
result3 = null;
pos = pos1;
}
if (result3 !== null) {
result4 = parse_RDQUOT();
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_qop_value() {
var result0;
var pos0;
pos0 = pos;
if (input.substr(pos, 8).toLowerCase() === "auth-int") {
result0 = input.substr(pos, 8);
pos += 8;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"auth-int\"");
}
}
if (result0 === null) {
if (input.substr(pos, 4).toLowerCase() === "auth") {
result0 = input.substr(pos, 4);
pos += 4;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"auth\"");
}
}
if (result0 === null) {
result0 = parse_token();
}
}
if (result0 !== null) {
result0 = (function(offset, qop_value) {
data.qop || (data.qop=[]);
data.qop.push(qop_value.toLowerCase()); })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Proxy_Require() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_token();
if (result0 !== null) {
result1 = [];
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_token();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_token();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_Record_Route() {
var result0, result1, result2, result3;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_rec_route();
if (result0 !== null) {
result1 = [];
pos2 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_rec_route();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
while (result2 !== null) {
result1.push(result2);
pos2 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_rec_route();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
var idx, length;
length = data.multi_header.length;
for (idx = 0; idx < length; idx++) {
if (data.multi_header[idx].parsed === null) {
data = null;
break;
}
}
if (data !== null) {
data = data.multi_header;
} else {
data = -1;
}})(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_rec_route() {
var result0, result1, result2, result3;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_name_addr();
if (result0 !== null) {
result1 = [];
pos2 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_generic_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
while (result2 !== null) {
result1.push(result2);
pos2 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_generic_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
var header;
if(!data.multi_header) data.multi_header = [];
try {
header = new NameAddrHeader(data.uri, data.display_name, data.params);
delete data.uri;
delete data.display_name;
delete data.params;
} catch(e) {
header = null;
}
data.multi_header.push( { 'possition': pos,
'offset': offset,
'parsed': header
});})(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_Require() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_token();
if (result0 !== null) {
result1 = [];
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_token();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_token();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_Route() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_route_param();
if (result0 !== null) {
result1 = [];
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_route_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_route_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_route_param() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_name_addr();
if (result0 !== null) {
result1 = [];
pos1 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_generic_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_generic_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_Subscription_State() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_substate_value();
if (result0 !== null) {
result1 = [];
pos1 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_subexp_params();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_subexp_params();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_substate_value() {
var result0;
var pos0;
pos0 = pos;
if (input.substr(pos, 6).toLowerCase() === "active") {
result0 = input.substr(pos, 6);
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"active\"");
}
}
if (result0 === null) {
if (input.substr(pos, 7).toLowerCase() === "pending") {
result0 = input.substr(pos, 7);
pos += 7;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"pending\"");
}
}
if (result0 === null) {
if (input.substr(pos, 10).toLowerCase() === "terminated") {
result0 = input.substr(pos, 10);
pos += 10;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"terminated\"");
}
}
if (result0 === null) {
result0 = parse_token();
}
}
}
if (result0 !== null) {
result0 = (function(offset) {
data.state = input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_subexp_params() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 6).toLowerCase() === "reason") {
result0 = input.substr(pos, 6);
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"reason\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_event_reason_value();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, reason) {
if (typeof reason !== 'undefined') data.reason = reason; })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
if (result0 === null) {
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 7).toLowerCase() === "expires") {
result0 = input.substr(pos, 7);
pos += 7;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"expires\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_delta_seconds();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, expires) {
if (typeof expires !== 'undefined') data.expires = expires; })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
if (result0 === null) {
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 11).toLowerCase() === "retry_after") {
result0 = input.substr(pos, 11);
pos += 11;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"retry_after\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_delta_seconds();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, retry_after) {
if (typeof retry_after !== 'undefined') data.retry_after = retry_after; })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
if (result0 === null) {
result0 = parse_generic_param();
}
}
}
return result0;
}
function parse_event_reason_value() {
var result0;
if (input.substr(pos, 11).toLowerCase() === "deactivated") {
result0 = input.substr(pos, 11);
pos += 11;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"deactivated\"");
}
}
if (result0 === null) {
if (input.substr(pos, 9).toLowerCase() === "probation") {
result0 = input.substr(pos, 9);
pos += 9;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"probation\"");
}
}
if (result0 === null) {
if (input.substr(pos, 8).toLowerCase() === "rejected") {
result0 = input.substr(pos, 8);
pos += 8;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"rejected\"");
}
}
if (result0 === null) {
if (input.substr(pos, 7).toLowerCase() === "timeout") {
result0 = input.substr(pos, 7);
pos += 7;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"timeout\"");
}
}
if (result0 === null) {
if (input.substr(pos, 6).toLowerCase() === "giveup") {
result0 = input.substr(pos, 6);
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"giveup\"");
}
}
if (result0 === null) {
if (input.substr(pos, 10).toLowerCase() === "noresource") {
result0 = input.substr(pos, 10);
pos += 10;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"noresource\"");
}
}
if (result0 === null) {
if (input.substr(pos, 9).toLowerCase() === "invariant") {
result0 = input.substr(pos, 9);
pos += 9;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"invariant\"");
}
}
if (result0 === null) {
result0 = parse_token();
}
}
}
}
}
}
}
return result0;
}
function parse_Subject() {
var result0;
result0 = parse_TEXT_UTF8_TRIM();
result0 = result0 !== null ? result0 : "";
return result0;
}
function parse_Supported() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_token();
if (result0 !== null) {
result1 = [];
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_token();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_token();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
result0 = result0 !== null ? result0 : "";
return result0;
}
function parse_To() {
var result0, result1, result2, result3;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
result0 = parse_SIP_URI_noparams();
if (result0 === null) {
result0 = parse_name_addr();
}
if (result0 !== null) {
result1 = [];
pos2 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_to_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
while (result2 !== null) {
result1.push(result2);
pos2 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_to_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos2;
}
} else {
result2 = null;
pos = pos2;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
var tag = data.tag;
try {
data = new NameAddrHeader(data.uri, data.display_name, data.params);
if (tag) {data.setParam('tag',tag)}
} catch(e) {
data = -1;
}})(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_to_param() {
var result0;
result0 = parse_tag_param();
if (result0 === null) {
result0 = parse_generic_param();
}
return result0;
}
function parse_Via() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_via_param();
if (result0 !== null) {
result1 = [];
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_via_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
result2 = parse_COMMA();
if (result2 !== null) {
result3 = parse_via_param();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_via_param() {
var result0, result1, result2, result3, result4, result5;
var pos0, pos1;
pos0 = pos;
result0 = parse_sent_protocol();
if (result0 !== null) {
result1 = parse_LWS();
if (result1 !== null) {
result2 = parse_sent_by();
if (result2 !== null) {
result3 = [];
pos1 = pos;
result4 = parse_SEMI();
if (result4 !== null) {
result5 = parse_via_params();
if (result5 !== null) {
result4 = [result4, result5];
} else {
result4 = null;
pos = pos1;
}
} else {
result4 = null;
pos = pos1;
}
while (result4 !== null) {
result3.push(result4);
pos1 = pos;
result4 = parse_SEMI();
if (result4 !== null) {
result5 = parse_via_params();
if (result5 !== null) {
result4 = [result4, result5];
} else {
result4 = null;
pos = pos1;
}
} else {
result4 = null;
pos = pos1;
}
}
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_via_params() {
var result0;
result0 = parse_via_ttl();
if (result0 === null) {
result0 = parse_via_maddr();
if (result0 === null) {
result0 = parse_via_received();
if (result0 === null) {
result0 = parse_via_branch();
if (result0 === null) {
result0 = parse_response_port();
if (result0 === null) {
result0 = parse_generic_param();
}
}
}
}
}
return result0;
}
function parse_via_ttl() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 3).toLowerCase() === "ttl") {
result0 = input.substr(pos, 3);
pos += 3;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"ttl\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_ttl();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, via_ttl_value) {
data.ttl = via_ttl_value; })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_via_maddr() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 5).toLowerCase() === "maddr") {
result0 = input.substr(pos, 5);
pos += 5;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"maddr\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_host();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, via_maddr) {
data.maddr = via_maddr; })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_via_received() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 8).toLowerCase() === "received") {
result0 = input.substr(pos, 8);
pos += 8;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"received\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_IPv4address();
if (result2 === null) {
result2 = parse_IPv6address();
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, via_received) {
data.received = via_received; })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_via_branch() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 6).toLowerCase() === "branch") {
result0 = input.substr(pos, 6);
pos += 6;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"branch\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = parse_token();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, via_branch) {
data.branch = via_branch; })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_response_port() {
var result0, result1, result2, result3;
var pos0, pos1, pos2;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 5).toLowerCase() === "rport") {
result0 = input.substr(pos, 5);
pos += 5;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"rport\"");
}
}
if (result0 !== null) {
pos2 = pos;
result1 = parse_EQUAL();
if (result1 !== null) {
result2 = [];
result3 = parse_DIGIT();
while (result3 !== null) {
result2.push(result3);
result3 = parse_DIGIT();
}
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos2;
}
} else {
result1 = null;
pos = pos2;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset) {
if(typeof response_port !== 'undefined')
data.rport = response_port.join(''); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_sent_protocol() {
var result0, result1, result2, result3, result4;
var pos0;
pos0 = pos;
result0 = parse_protocol_name();
if (result0 !== null) {
result1 = parse_SLASH();
if (result1 !== null) {
result2 = parse_token();
if (result2 !== null) {
result3 = parse_SLASH();
if (result3 !== null) {
result4 = parse_transport();
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_protocol_name() {
var result0;
var pos0;
pos0 = pos;
if (input.substr(pos, 3).toLowerCase() === "sip") {
result0 = input.substr(pos, 3);
pos += 3;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"SIP\"");
}
}
if (result0 === null) {
result0 = parse_token();
}
if (result0 !== null) {
result0 = (function(offset, via_protocol) {
data.protocol = via_protocol; })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_transport() {
var result0;
var pos0;
pos0 = pos;
if (input.substr(pos, 3).toLowerCase() === "udp") {
result0 = input.substr(pos, 3);
pos += 3;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"UDP\"");
}
}
if (result0 === null) {
if (input.substr(pos, 3).toLowerCase() === "tcp") {
result0 = input.substr(pos, 3);
pos += 3;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"TCP\"");
}
}
if (result0 === null) {
if (input.substr(pos, 3).toLowerCase() === "tls") {
result0 = input.substr(pos, 3);
pos += 3;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"TLS\"");
}
}
if (result0 === null) {
if (input.substr(pos, 4).toLowerCase() === "sctp") {
result0 = input.substr(pos, 4);
pos += 4;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"SCTP\"");
}
}
if (result0 === null) {
result0 = parse_token();
}
}
}
}
if (result0 !== null) {
result0 = (function(offset, via_transport) {
data.transport = via_transport; })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_sent_by() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
result0 = parse_via_host();
if (result0 !== null) {
pos1 = pos;
result1 = parse_COLON();
if (result1 !== null) {
result2 = parse_via_port();
if (result2 !== null) {
result1 = [result1, result2];
} else {
result1 = null;
pos = pos1;
}
} else {
result1 = null;
pos = pos1;
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_via_host() {
var result0;
var pos0;
pos0 = pos;
result0 = parse_IPv4address();
if (result0 === null) {
result0 = parse_IPv6reference();
if (result0 === null) {
result0 = parse_hostname();
}
}
if (result0 !== null) {
result0 = (function(offset) {
data.host = input.substring(pos, offset); })(pos0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_via_port() {
var result0, result1, result2, result3, result4;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_DIGIT();
result0 = result0 !== null ? result0 : "";
if (result0 !== null) {
result1 = parse_DIGIT();
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result2 = parse_DIGIT();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result3 = parse_DIGIT();
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
result4 = parse_DIGIT();
result4 = result4 !== null ? result4 : "";
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, via_sent_by_port) {
data.port = parseInt(via_sent_by_port.join('')); })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_ttl() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_DIGIT();
if (result0 !== null) {
result1 = parse_DIGIT();
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result2 = parse_DIGIT();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, ttl) {
return parseInt(ttl.join('')); })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_WWW_Authenticate() {
var result0;
result0 = parse_challenge();
return result0;
}
function parse_Session_Expires() {
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = pos;
result0 = parse_s_e_expires();
if (result0 !== null) {
result1 = [];
pos1 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_s_e_params();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
while (result2 !== null) {
result1.push(result2);
pos1 = pos;
result2 = parse_SEMI();
if (result2 !== null) {
result3 = parse_s_e_params();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = pos1;
}
} else {
result2 = null;
pos = pos1;
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_s_e_expires() {
var result0;
var pos0;
pos0 = pos;
result0 = parse_delta_seconds();
if (result0 !== null) {
result0 = (function(offset, expires) { data.expires = expires; })(pos0, result0);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_s_e_params() {
var result0;
result0 = parse_s_e_refresher();
if (result0 === null) {
result0 = parse_generic_param();
}
return result0;
}
function parse_s_e_refresher() {
var result0, result1, result2;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
if (input.substr(pos, 9).toLowerCase() === "refresher") {
result0 = input.substr(pos, 9);
pos += 9;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"refresher\"");
}
}
if (result0 !== null) {
result1 = parse_EQUAL();
if (result1 !== null) {
if (input.substr(pos, 3).toLowerCase() === "uac") {
result2 = input.substr(pos, 3);
pos += 3;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"uac\"");
}
}
if (result2 === null) {
if (input.substr(pos, 3).toLowerCase() === "uas") {
result2 = input.substr(pos, 3);
pos += 3;
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"uas\"");
}
}
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, s_e_refresher_value) { data.refresher = s_e_refresher_value.toLowerCase(); })(pos0, result0[2]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_extension_header() {
var result0, result1, result2;
var pos0;
pos0 = pos;
result0 = parse_token();
if (result0 !== null) {
result1 = parse_HCOLON();
if (result1 !== null) {
result2 = parse_header_value();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_header_value() {
var result0, result1;
result0 = [];
result1 = parse_TEXT_UTF8char();
if (result1 === null) {
result1 = parse_UTF8_CONT();
if (result1 === null) {
result1 = parse_LWS();
}
}
while (result1 !== null) {
result0.push(result1);
result1 = parse_TEXT_UTF8char();
if (result1 === null) {
result1 = parse_UTF8_CONT();
if (result1 === null) {
result1 = parse_LWS();
}
}
}
return result0;
}
function parse_message_body() {
var result0, result1;
result0 = [];
result1 = parse_OCTET();
while (result1 !== null) {
result0.push(result1);
result1 = parse_OCTET();
}
return result0;
}
function parse_uuid_URI() {
var result0, result1;
var pos0;
pos0 = pos;
if (input.substr(pos, 5) === "uuid:") {
result0 = "uuid:";
pos += 5;
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"uuid:\"");
}
}
if (result0 !== null) {
result1 = parse_uuid();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_uuid() {
var result0, result1, result2, result3, result4, result5, result6, result7, result8;
var pos0, pos1;
pos0 = pos;
pos1 = pos;
result0 = parse_hex8();
if (result0 !== null) {
if (input.charCodeAt(pos) === 45) {
result1 = "-";
pos++;
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result1 !== null) {
result2 = parse_hex4();
if (result2 !== null) {
if (input.charCodeAt(pos) === 45) {
result3 = "-";
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result3 !== null) {
result4 = parse_hex4();
if (result4 !== null) {
if (input.charCodeAt(pos) === 45) {
result5 = "-";
pos++;
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result5 !== null) {
result6 = parse_hex4();
if (result6 !== null) {
if (input.charCodeAt(pos) === 45) {
result7 = "-";
pos++;
} else {
result7 = null;
if (reportFailures === 0) {
matchFailed("\"-\"");
}
}
if (result7 !== null) {
result8 = parse_hex12();
if (result8 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8];
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
} else {
result0 = null;
pos = pos1;
}
if (result0 !== null) {
result0 = (function(offset, uuid) {
data = input.substring(pos+5, offset); })(pos0, result0[0]);
}
if (result0 === null) {
pos = pos0;
}
return result0;
}
function parse_hex4() {
var result0, result1, result2, result3;
var pos0;
pos0 = pos;
result0 = parse_HEXDIG();
if (result0 !== null) {
result1 = parse_HEXDIG();
if (result1 !== null) {
result2 = parse_HEXDIG();
if (result2 !== null) {
result3 = parse_HEXDIG();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_hex8() {
var result0, result1;
var pos0;
pos0 = pos;
result0 = parse_hex4();
if (result0 !== null) {
result1 = parse_hex4();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function parse_hex12() {
var result0, result1, result2;
var pos0;
pos0 = pos;
result0 = parse_hex4();
if (result0 !== null) {
result1 = parse_hex4();
if (result1 !== null) {
result2 = parse_hex4();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
} else {
result0 = null;
pos = pos0;
}
return result0;
}
function cleanupExpected(expected) {
expected.sort();
var lastExpected = null;
var cleanExpected = [];
for (var i = 0; i < expected.length; i++) {
if (expected[i] !== lastExpected) {
cleanExpected.push(expected[i]);
lastExpected = expected[i];
}
}
return cleanExpected;
}
function computeErrorPosition() {
/*
* The first idea was to use |String.split| to break the input up to the
* error position along newlines and derive the line and column from
* there. However IE's |split| implementation is so broken that it was
* enough to prevent it.
*/
var line = 1;
var column = 1;
var seenCR = false;
for (var i = 0; i < Math.max(pos, rightmostFailuresPos); i++) {
var ch = input.charAt(i);
if (ch === "\n") {
if (!seenCR) { line++; }
column = 1;
seenCR = false;
} else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
line++;
column = 1;
seenCR = true;
} else {
column++;
seenCR = false;
}
}
return { line: line, column: column };
}
var URI = require('./URI');
var NameAddrHeader = require('./NameAddrHeader');
var data = {};
var result = parseFunctions[startRule]();
/*
* The parser is now in one of the following three states:
*
* 1. The parser successfully parsed the whole input.
*
* - |result !== null|
* - |pos === input.length|
* - |rightmostFailuresExpected| may or may not contain something
*
* 2. The parser successfully parsed only a part of the input.
*
* - |result !== null|
* - |pos < input.length|
* - |rightmostFailuresExpected| may or may not contain something
*
* 3. The parser did not successfully parse any part of the input.
*
* - |result === null|
* - |pos === 0|
* - |rightmostFailuresExpected| contains at least one failure
*
* All code following this comment (including called functions) must
* handle these states.
*/
if (result === null || pos !== input.length) {
var offset = Math.max(pos, rightmostFailuresPos);
var found = offset < input.length ? input.charAt(offset) : null;
var errorPosition = computeErrorPosition();
new this.SyntaxError(
cleanupExpected(rightmostFailuresExpected),
found,
offset,
errorPosition.line,
errorPosition.column
);
return -1;
}
return data;
},
/* Returns the parser source code. */
toSource: function() { return this._source; }
};
/* Thrown when a parser encounters a syntax error. */
result.SyntaxError = function(expected, found, offset, line, column) {
function buildMessage(expected, found) {
var expectedHumanized, foundHumanized;
switch (expected.length) {
case 0:
expectedHumanized = "end of input";
break;
case 1:
expectedHumanized = expected[0];
break;
default:
expectedHumanized = expected.slice(0, expected.length - 1).join(", ")
+ " or "
+ expected[expected.length - 1];
}
foundHumanized = found ? quote(found) : "end of input";
return "Expected " + expectedHumanized + " but " + foundHumanized + " found.";
}
this.name = "SyntaxError";
this.expected = expected;
this.found = found;
this.message = buildMessage(expected, found);
this.offset = offset;
this.line = line;
this.column = column;
};
result.SyntaxError.prototype = Error.prototype;
return result;
})();
},{"./NameAddrHeader":9,"./URI":21}],7:[function(require,module,exports){
/**
* Dependencies.
*/
var debug = require('debug')('JsSIP');
var pkg = require('../package.json');
debug('version %s', pkg.version);
var rtcninja = require('rtcninja');
var C = require('./Constants');
var Exceptions = require('./Exceptions');
var Utils = require('./Utils');
var UA = require('./UA');
var URI = require('./URI');
var NameAddrHeader = require('./NameAddrHeader');
var Grammar = require('./Grammar');
/**
* Expose the JsSIP module.
*/
var JsSIP = module.exports = {
C: C,
Exceptions: Exceptions,
Utils: Utils,
UA: UA,
URI: URI,
NameAddrHeader: NameAddrHeader,
Grammar: Grammar,
// Expose the debug module.
debug: require('debug'),
// Expose the rtcninja module.
rtcninja: rtcninja
};
Object.defineProperties(JsSIP, {
name: {
get: function() { return pkg.title; }
},
version: {
get: function() { return pkg.version; }
}
});
},{"../package.json":46,"./Constants":1,"./Exceptions":5,"./Grammar":6,"./NameAddrHeader":9,"./UA":20,"./URI":21,"./Utils":22,"debug":29,"rtcninja":34}],8:[function(require,module,exports){
module.exports = Message;
/**
* Dependencies.
*/
var util = require('util');
var events = require('events');
var JsSIP_C = require('./Constants');
var SIPMessage = require('./SIPMessage');
var Utils = require('./Utils');
var RequestSender = require('./RequestSender');
var Transactions = require('./Transactions');
var Exceptions = require('./Exceptions');
function Message(ua) {
this.ua = ua;
// Custom message empty object for high level use
this.data = {};
events.EventEmitter.call(this);
}
util.inherits(Message, events.EventEmitter);
Message.prototype.send = function(target, body, options) {
var request_sender, event, contentType, eventHandlers, extraHeaders,
originalTarget = target;
if (target === undefined || body === undefined) {
throw new TypeError('Not enough arguments');
}
// Check target validity
target = this.ua.normalizeTarget(target);
if (!target) {
throw new TypeError('Invalid target: '+ originalTarget);
}
// Get call options
options = options || {};
extraHeaders = options.extraHeaders && options.extraHeaders.slice() || [];
eventHandlers = options.eventHandlers || {};
contentType = options.contentType || 'text/plain';
this.content_type = contentType;
// Set event handlers
for (event in eventHandlers) {
this.on(event, eventHandlers[event]);
}
this.closed = false;
this.ua.applicants[this] = this;
extraHeaders.push('Content-Type: '+ contentType);
this.request = new SIPMessage.OutgoingRequest(JsSIP_C.MESSAGE, target, this.ua, null, extraHeaders);
if(body) {
this.request.body = body;
this.content = body;
} else {
this.content = null;
}
request_sender = new RequestSender(this, this.ua);
this.newMessage('local', this.request);
request_sender.send();
};
Message.prototype.receiveResponse = function(response) {
var cause;
if(this.closed) {
return;
}
switch(true) {
case /^1[0-9]{2}$/.test(response.status_code):
// Ignore provisional responses.
break;
case /^2[0-9]{2}$/.test(response.status_code):
delete this.ua.applicants[this];
this.emit('succeeded', {
originator: 'remote',
response: response
});
break;
default:
delete this.ua.applicants[this];
cause = Utils.sipErrorCause(response.status_code);
this.emit('failed', {
originator: 'remote',
response: response,
cause: cause
});
break;
}
};
Message.prototype.onRequestTimeout = function() {
if(this.closed) {
return;
}
this.emit('failed', {
originator: 'system',
cause: JsSIP_C.causes.REQUEST_TIMEOUT
});
};
Message.prototype.onTransportError = function() {
if(this.closed) {
return;
}
this.emit('failed', {
originator: 'system',
cause: JsSIP_C.causes.CONNECTION_ERROR
});
};
Message.prototype.close = function() {
this.closed = true;
delete this.ua.applicants[this];
};
Message.prototype.init_incoming = function(request) {
var transaction;
this.request = request;
this.content_type = request.getHeader('Content-Type');
if (request.body) {
this.content = request.body;
} else {
this.content = null;
}
this.newMessage('remote', request);
transaction = this.ua.transactions.nist[request.via_branch];
if (transaction && (transaction.state === Transactions.C.STATUS_TRYING || transaction.state === Transactions.C.STATUS_PROCEEDING)) {
request.reply(200);
}
};
/**
* Accept the incoming Message
* Only valid for incoming Messages
*/
Message.prototype.accept = function(options) {
options = options || {};
var
extraHeaders = options.extraHeaders && options.extraHeaders.slice() || [],
body = options.body;
if (this.direction !== 'incoming') {
throw new Exceptions.NotSupportedError('"accept" not supported for outgoing Message');
}
this.request.reply(200, null, extraHeaders, body);
};
/**
* Reject the incoming Message
* Only valid for incoming Messages
*/
Message.prototype.reject = function(options) {
options = options || {};
var
status_code = options.status_code || 480,
reason_phrase = options.reason_phrase,
extraHeaders = options.extraHeaders && options.extraHeaders.slice() || [],
body = options.body;
if (this.direction !== 'incoming') {
throw new Exceptions.NotSupportedError('"reject" not supported for outgoing Message');
}
if (status_code < 300 || status_code >= 700) {
throw new TypeError('Invalid status_code: '+ status_code);
}
this.request.reply(status_code, reason_phrase, extraHeaders, body);
};
/**
* Internal Callbacks
*/
Message.prototype.newMessage = function(originator, request) {
if (originator === 'remote') {
this.direction = 'incoming';
this.local_identity = request.to;
this.remote_identity = request.from;
} else if (originator === 'local'){
this.direction = 'outgoing';
this.local_identity = request.from;
this.remote_identity = request.to;
}
this.ua.newMessage({
originator: originator,
message: this,
request: request
});
};
},{"./Constants":1,"./Exceptions":5,"./RequestSender":15,"./SIPMessage":16,"./Transactions":18,"./Utils":22,"events":24,"util":28}],9:[function(require,module,exports){
module.exports = NameAddrHeader;
/**
* Dependencies.
*/
var URI = require('./URI');
var Grammar = require('./Grammar');
function NameAddrHeader(uri, display_name, parameters) {
var param;
// Checks
if(!uri || !(uri instanceof URI)) {
throw new TypeError('missing or invalid "uri" parameter');
}
// Initialize parameters
this.uri = uri;
this.parameters = {};
for (param in parameters) {
this.setParam(param, parameters[param]);
}
Object.defineProperties(this, {
display_name: {
get: function() { return display_name; },
set: function(value) {
display_name = (value === 0) ? '0' : value;
}
}
});
}
NameAddrHeader.prototype = {
setParam: function(key, value) {
if (key) {
this.parameters[key.toLowerCase()] = (typeof value === 'undefined' || value === null) ? null : value.toString();
}
},
getParam: function(key) {
if(key) {
return this.parameters[key.toLowerCase()];
}
},
hasParam: function(key) {
if(key) {
return (this.parameters.hasOwnProperty(key.toLowerCase()) && true) || false;
}
},
deleteParam: function(parameter) {
var value;
parameter = parameter.toLowerCase();
if (this.parameters.hasOwnProperty(parameter)) {
value = this.parameters[parameter];
delete this.parameters[parameter];
return value;
}
},
clearParams: function() {
this.parameters = {};
},
clone: function() {
return new NameAddrHeader(
this.uri.clone(),
this.display_name,
JSON.parse(JSON.stringify(this.parameters)));
},
toString: function() {
var body, parameter;
body = (this.display_name || this.display_name === 0) ? '"' + this.display_name + '" ' : '';
body += '<' + this.uri.toString() + '>';
for (parameter in this.parameters) {
body += ';' + parameter;
if (this.parameters[parameter] !== null) {
body += '='+ this.parameters[parameter];
}
}
return body;
}
};
/**
* Parse the given string and returns a NameAddrHeader instance or undefined if
* it is an invalid NameAddrHeader.
*/
NameAddrHeader.parse = function(name_addr_header) {
name_addr_header = Grammar.parse(name_addr_header,'Name_Addr_Header');
if (name_addr_header !== -1) {
return name_addr_header;
} else {
return undefined;
}
};
},{"./Grammar":6,"./URI":21}],10:[function(require,module,exports){
var Parser = {};
module.exports = Parser;
/**
* Dependencies.
*/
var debugerror = require('debug')('JsSIP:ERROR:Parser');
debugerror.log = console.warn.bind(console);
var sdp_transform = require('sdp-transform');
var Grammar = require('./Grammar');
var SIPMessage = require('./SIPMessage');
/**
* Extract and parse every header of a SIP message.
*/
function getHeader(data, headerStart) {
var
// 'start' position of the header.
start = headerStart,
// 'end' position of the header.
end = 0,
// 'partial end' position of the header.
partialEnd = 0;
//End of message.
if (data.substring(start, start + 2).match(/(^\r\n)/)) {
return -2;
}
while(end === 0) {
// Partial End of Header.
partialEnd = data.indexOf('\r\n', start);
// 'indexOf' returns -1 if the value to be found never occurs.
if (partialEnd === -1) {
return partialEnd;
}
if(!data.substring(partialEnd + 2, partialEnd + 4).match(/(^\r\n)/) && data.charAt(partialEnd + 2).match(/(^\s+)/)) {
// Not the end of the message. Continue from the next position.
start = partialEnd + 2;
} else {
end = partialEnd;
}
}
return end;
}
function parseHeader(message, data, headerStart, headerEnd) {
var header, idx, length, parsed,
hcolonIndex = data.indexOf(':', headerStart),
headerName = data.substring(headerStart, hcolonIndex).trim(),
headerValue = data.substring(hcolonIndex + 1, headerEnd).trim();
// If header-field is well-known, parse it.
switch(headerName.toLowerCase()) {
case 'via':
case 'v':
message.addHeader('via', headerValue);
if(message.getHeaders('via').length === 1) {
parsed = message.parseHeader('Via');
if(parsed) {
message.via = parsed;
message.via_branch = parsed.branch;
}
} else {
parsed = 0;
}
break;
case 'from':
case 'f':
message.setHeader('from', headerValue);
parsed = message.parseHeader('from');
if(parsed) {
message.from = parsed;
message.from_tag = parsed.getParam('tag');
}
break;
case 'to':
case 't':
message.setHeader('to', headerValue);
parsed = message.parseHeader('to');
if(parsed) {
message.to = parsed;
message.to_tag = parsed.getParam('tag');
}
break;
case 'record-route':
parsed = Grammar.parse(headerValue, 'Record_Route');
if (parsed === -1) {
parsed = undefined;
}
length = parsed.length;
for (idx = 0; idx < length; idx++) {
header = parsed[idx];
message.addHeader('record-route', headerValue.substring(header.possition, header.offset));
message.headers['Record-Route'][message.getHeaders('record-route').length - 1].parsed = header.parsed;
}
break;
case 'call-id':
case 'i':
message.setHeader('call-id', headerValue);
parsed = message.parseHeader('call-id');
if(parsed) {
message.call_id = headerValue;
}
break;
case 'contact':
case 'm':
parsed = Grammar.parse(headerValue, 'Contact');
if (parsed === -1) {
parsed = undefined;
}
length = parsed.length;
for (idx = 0; idx < length; idx++) {
header = parsed[idx];
message.addHeader('contact', headerValue.substring(header.possition, header.offset));
message.headers.Contact[message.getHeaders('contact').length - 1].parsed = header.parsed;
}
break;
case 'content-length':
case 'l':
message.setHeader('content-length', headerValue);
parsed = message.parseHeader('content-length');
break;
case 'content-type':
case 'c':
message.setHeader('content-type', headerValue);
parsed = message.parseHeader('content-type');
break;
case 'cseq':
message.setHeader('cseq', headerValue);
parsed = message.parseHeader('cseq');
if(parsed) {
message.cseq = parsed.value;
}
if(message instanceof SIPMessage.IncomingResponse) {
message.method = parsed.method;
}
break;
case 'max-forwards':
message.setHeader('max-forwards', headerValue);
parsed = message.parseHeader('max-forwards');
break;
case 'www-authenticate':
message.setHeader('www-authenticate', headerValue);
parsed = message.parseHeader('www-authenticate');
break;
case 'proxy-authenticate':
message.setHeader('proxy-authenticate', headerValue);
parsed = message.parseHeader('proxy-authenticate');
break;
case 'session-expires':
case 'x':
message.setHeader('session-expires', headerValue);
parsed = message.parseHeader('session-expires');
if (parsed) {
message.session_expires = parsed.expires;
message.session_expires_refresher = parsed.refresher;
}
break;
default:
// Do not parse this header.
message.setHeader(headerName, headerValue);
parsed = 0;
}
if (parsed === undefined) {
return {
error: 'error parsing header "'+ headerName +'"'
};
} else {
return true;
}
}
/**
* Parse SIP Message
*/
Parser.parseMessage = function(data, ua) {
var message, firstLine, contentLength, bodyStart, parsed,
headerStart = 0,
headerEnd = data.indexOf('\r\n');
if(headerEnd === -1) {
debugerror('parseMessage() | no CRLF found, not a SIP message');
return;
}
// Parse first line. Check if it is a Request or a Reply.
firstLine = data.substring(0, headerEnd);
parsed = Grammar.parse(firstLine, 'Request_Response');
if(parsed === -1) {
debugerror('parseMessage() | error parsing first line of SIP message: "' + firstLine + '"');
return;
} else if(!parsed.status_code) {
message = new SIPMessage.IncomingRequest(ua);
message.method = parsed.method;
message.ruri = parsed.uri;
} else {
message = new SIPMessage.IncomingResponse();
message.status_code = parsed.status_code;
message.reason_phrase = parsed.reason_phrase;
}
message.data = data;
headerStart = headerEnd + 2;
/* Loop over every line in data. Detect the end of each header and parse
* it or simply add to the headers collection.
*/
while(true) {
headerEnd = getHeader(data, headerStart);
// The SIP message has normally finished.
if(headerEnd === -2) {
bodyStart = headerStart + 2;
break;
}
// data.indexOf returned -1 due to a malformed message.
else if(headerEnd === -1) {
parsed.error('parseMessage() | malformed message');
return;
}
parsed = parseHeader(message, data, headerStart, headerEnd);
if(parsed !== true) {
debugerror('parseMessage() |', parsed.error);
return;
}
headerStart = headerEnd + 2;
}
/* RFC3261 18.3.
* If there are additional bytes in the transport packet
* beyond the end of the body, they MUST be discarded.
*/
if(message.hasHeader('content-length')) {
contentLength = message.getHeader('content-length');
message.body = data.substr(bodyStart, contentLength);
} else {
message.body = data.substring(bodyStart);
}
return message;
};
/**
* sdp-transform features.
*/
Parser.parseSDP = sdp_transform.parse;
Parser.writeSDP = sdp_transform.write;
Parser.parseFmtpConfig = sdp_transform.parseFmtpConfig;
Parser.parsePayloads = sdp_transform.parsePayloads;
Parser.parseRemoteCandidates = sdp_transform.parseRemoteCandidates;
},{"./Grammar":6,"./SIPMessage":16,"debug":29,"sdp-transform":40}],11:[function(require,module,exports){
module.exports = RTCSession;
var C = {
// RTCSession states
STATUS_NULL: 0,
STATUS_INVITE_SENT: 1,
STATUS_1XX_RECEIVED: 2,
STATUS_INVITE_RECEIVED: 3,
STATUS_WAITING_FOR_ANSWER: 4,
STATUS_ANSWERED: 5,
STATUS_WAITING_FOR_ACK: 6,
STATUS_CANCELED: 7,
STATUS_TERMINATED: 8,
STATUS_CONFIRMED: 9
};
/**
* Expose C object.
*/
RTCSession.C = C;
/**
* Dependencies.
*/
var util = require('util');
var events = require('events');
var debug = require('debug')('JsSIP:RTCSession');
var debugerror = require('debug')('JsSIP:ERROR:RTCSession');
debugerror.log = console.warn.bind(console);
var rtcninja = require('rtcninja');
var JsSIP_C = require('./Constants');
var Exceptions = require('./Exceptions');
var Transactions = require('./Transactions');
var Parser = require('./Parser');
var Utils = require('./Utils');
var Timers = require('./Timers');
var SIPMessage = require('./SIPMessage');
var Dialog = require('./Dialog');
var RequestSender = require('./RequestSender');
var RTCSession_Request = require('./RTCSession/Request');
var RTCSession_DTMF = require('./RTCSession/DTMF');
function RTCSession(ua) {
debug('new');
this.ua = ua;
this.status = C.STATUS_NULL;
this.dialog = null;
this.earlyDialogs = {};
this.connection = null; // The rtcninja.RTCPeerConnection instance (public attribute).
// RTCSession confirmation flag
this.is_confirmed = false;
// is late SDP being negotiated
this.late_sdp = false;
// Default rtcOfferConstraints and rtcAnswerConstrainsts (passed in connect() or answer()).
this.rtcOfferConstraints = null;
this.rtcAnswerConstraints = null;
// Local MediaStream.
this.localMediaStream = null;
this.localMediaStreamLocallyGenerated = false;
// Flag to indicate PeerConnection ready for new actions.
this.rtcReady = true;
// SIP Timers
this.timers = {
ackTimer: null,
expiresTimer: null,
invite2xxTimer: null,
userNoAnswerTimer: null
};
// Session info
this.direction = null;
this.local_identity = null;
this.remote_identity = null;
this.start_time = null;
this.end_time = null;
this.tones = null;
// Mute/Hold state
this.audioMuted = false;
this.videoMuted = false;
this.localHold = false;
this.remoteHold = false;
// Session Timers (RFC 4028)
this.sessionTimers = {
enabled: this.ua.configuration.session_timers,
defaultExpires: JsSIP_C.SESSION_EXPIRES,
currentExpires: null,
running: false,
refresher: false,
timer: null // A setTimeout.
};
// Custom session empty object for high level use
this.data = {};
events.EventEmitter.call(this);
}
util.inherits(RTCSession, events.EventEmitter);
/**
* User API
*/
RTCSession.prototype.isInProgress = function() {
switch(this.status) {
case C.STATUS_NULL:
case C.STATUS_INVITE_SENT:
case C.STATUS_1XX_RECEIVED:
case C.STATUS_INVITE_RECEIVED:
case C.STATUS_WAITING_FOR_ANSWER:
return true;
default:
return false;
}
};
RTCSession.prototype.isEstablished = function() {
switch(this.status) {
case C.STATUS_ANSWERED:
case C.STATUS_WAITING_FOR_ACK:
case C.STATUS_CONFIRMED:
return true;
default:
return false;
}
};
RTCSession.prototype.isEnded = function() {
switch(this.status) {
case C.STATUS_CANCELED:
case C.STATUS_TERMINATED:
return true;
default:
return false;
}
};
RTCSession.prototype.isMuted = function() {
return {
audio: this.audioMuted,
video: this.videoMuted
};
};
RTCSession.prototype.isOnHold = function() {
return {
local: this.localHold,
remote: this.remoteHold
};
};
/**
* Check if RTCSession is ready for an outgoing re-INVITE or UPDATE with SDP.
*/
RTCSession.prototype.isReadyToReOffer = function() {
if (! this.rtcReady) {
debug('isReadyToReOffer() | internal WebRTC status not ready');
return false;
}
// No established yet.
if (! this.dialog) {
debug('isReadyToReOffer() | session not established yet');
return false;
}
// Another INVITE transaction is in progress
if (this.dialog.uac_pending_reply === true || this.dialog.uas_pending_reply === true) {
debug('isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress');
return false;
}
return true;
};
RTCSession.prototype.connect = function(target, options) {
debug('connect()');
options = options || {};
var event, requestParams,
originalTarget = target,
eventHandlers = options.eventHandlers || {},
extraHeaders = options.extraHeaders && options.extraHeaders.slice() || [],
mediaConstraints = options.mediaConstraints || {audio: true, video: true},
mediaStream = options.mediaStream || null,
pcConfig = options.pcConfig || {iceServers:[]},
rtcConstraints = options.rtcConstraints || null,
rtcOfferConstraints = options.rtcOfferConstraints || null;
this.rtcOfferConstraints = rtcOfferConstraints;
this.rtcAnswerConstraints = options.rtcAnswerConstraints || null;
// Session Timers.
if (this.sessionTimers.enabled) {
if (Utils.isDecimal(options.sessionTimersExpires)) {
if (options.sessionTimersExpires >= JsSIP_C.MIN_SESSION_EXPIRES) {
this.sessionTimers.defaultExpires = options.sessionTimersExpires;
}
else {
this.sessionTimers.defaultExpires = JsSIP_C.SESSION_EXPIRES;
}
}
}
this.data = options.data || this.data;
if (target === undefined) {
throw new TypeError('Not enough arguments');
}
// Check WebRTC support.
if (! rtcninja.hasWebRTC()) {
throw new Exceptions.NotSupportedError('WebRTC not supported');
}
// Check target validity
target = this.ua.normalizeTarget(target);
if (!target) {
throw new TypeError('Invalid target: '+ originalTarget);
}
// Check Session Status
if (this.status !== C.STATUS_NULL) {
throw new Exceptions.InvalidStateError(this.status);
}
// Set event handlers
for (event in eventHandlers) {
this.on(event, eventHandlers[event]);
}
// Session parameter initialization
this.from_tag = Utils.newTag();
// Set anonymous property
this.anonymous = options.anonymous || false;
// OutgoingSession specific parameters
this.isCanceled = false;
requestParams = {from_tag: this.from_tag};
this.contact = this.ua.contact.toString({
anonymous: this.anonymous,
outbound: true
});
if (this.anonymous) {
requestParams.from_display_name = 'Anonymous';
requestParams.from_uri = 'sip:anonymous@anonymous.invalid';
extraHeaders.push('P-Preferred-Identity: '+ this.ua.configuration.uri.toString());
extraHeaders.push('Privacy: id');
}
extraHeaders.push('Contact: '+ this.contact);
extraHeaders.push('Content-Type: application/sdp');
if (this.sessionTimers.enabled) {
extraHeaders.push('Session-Expires: ' + this.sessionTimers.defaultExpires);
}
this.request = new SIPMessage.OutgoingRequest(JsSIP_C.INVITE, target, this.ua, requestParams, extraHeaders);
this.id = this.request.call_id + this.from_tag;
// Create a new rtcninja.RTCPeerConnection instance.
createRTCConnection.call(this, pcConfig, rtcConstraints);
// Save the session into the ua sessions collection.
this.ua.sessions[this.id] = this;
newRTCSession.call(this, 'local', this.request);
sendInitialRequest.call(this, mediaConstraints, rtcOfferConstraints, mediaStream);
};
RTCSession.prototype.init_incoming = function(request) {
debug('init_incoming()');
var expires,
self = this,
contentType = request.getHeader('Content-Type');
// Check body and content type
if (request.body && (contentType !== 'application/sdp')) {
request.reply(415);
return;
}
// Session parameter initialization
this.status = C.STATUS_INVITE_RECEIVED;
this.from_tag = request.from_tag;
this.id = request.call_id + this.from_tag;
this.request = request;
this.contact = this.ua.contact.toString();
// Save the session into the ua sessions collection.
this.ua.sessions[this.id] = this;
// Get the Expires header value if exists
if (request.hasHeader('expires')) {
expires = request.getHeader('expires') * 1000;
}
/* Set the to_tag before
* replying a response code that will create a dialog.
*/
request.to_tag = Utils.newTag();
// An error on dialog creation will fire 'failed' event
if (! createDialog.call(this, request, 'UAS', true)) {
request.reply(500, 'Missing Contact header field');
return;
}
if (request.body) {
this.late_sdp = false;
}
else {
this.late_sdp = true;
}
this.status = C.STATUS_WAITING_FOR_ANSWER;
// Set userNoAnswerTimer
this.timers.userNoAnswerTimer = setTimeout(function() {
request.reply(408);
failed.call(self, 'local',null, JsSIP_C.causes.NO_ANSWER);
}, this.ua.configuration.no_answer_timeout
);
/* Set expiresTimer
* RFC3261 13.3.1
*/
if (expires) {
this.timers.expiresTimer = setTimeout(function() {
if(self.status === C.STATUS_WAITING_FOR_ANSWER) {
request.reply(487);
failed.call(self, 'system', null, JsSIP_C.causes.EXPIRES);
}
}, expires
);
}
// Fire 'newRTCSession' event.
newRTCSession.call(this, 'remote', request);
// The user may have rejected the call in the 'newRTCSession' event.
if (this.status === C.STATUS_TERMINATED) {
return;
}
// Reply 180.
request.reply(180, null, ['Contact: ' + self.contact]);
// Fire 'progress' event.
// TODO: Document that 'response' field in 'progress' event is null for
// incoming calls.
progress.call(self, 'local', null);
};
/**
* Answer the call.
*/
RTCSession.prototype.answer = function(options) {
debug('answer()');
options = options || {};
var idx, length, sdp, tracks,
peerHasAudioLine = false,
peerHasVideoLine = false,
peerOffersFullAudio = false,
peerOffersFullVideo = false,
self = this,
request = this.request,
extraHeaders = options.extraHeaders && options.extraHeaders.slice() || [],
mediaConstraints = options.mediaConstraints || {},
mediaStream = options.mediaStream || null,
pcConfig = options.pcConfig || {iceServers:[]},
rtcConstraints = options.rtcConstraints || null,
rtcAnswerConstraints = options.rtcAnswerConstraints || null;
this.rtcAnswerConstraints = rtcAnswerConstraints;
this.rtcOfferConstraints = options.rtcOfferConstraints || null;
// Session Timers.
if (this.sessionTimers.enabled) {
if (Utils.isDecimal(options.sessionTimersExpires)) {
if (options.sessionTimersExpires >= JsSIP_C.MIN_SESSION_EXPIRES) {
this.sessionTimers.defaultExpires = options.sessionTimersExpires;
}
else {
this.sessionTimers.defaultExpires = JsSIP_C.SESSION_EXPIRES;
}
}
}
this.data = options.data || this.data;
// Check Session Direction and Status
if (this.direction !== 'incoming') {
throw new Exceptions.NotSupportedError('"answer" not supported for outgoing RTCSession');
} else if (this.status !== C.STATUS_WAITING_FOR_ANSWER) {
throw new Exceptions.InvalidStateError(this.status);
}
this.status = C.STATUS_ANSWERED;
// An error on dialog creation will fire 'failed' event
if (! createDialog.call(this, request, 'UAS')) {
request.reply(500, 'Error creating dialog');
return;
}
clearTimeout(this.timers.userNoAnswerTimer);
extraHeaders.unshift('Contact: ' + self.contact);
// Determine incoming media from incoming SDP offer (if any).
sdp = Parser.parseSDP(request.body || '');
// Make sure sdp.media is an array, not the case if there is only one media
if (! Array.isArray(sdp.media)) {
sdp.media = [sdp.media];
}
// Go through all medias in SDP to find offered capabilities to answer with
idx = sdp.media.length;
while(idx--) {
var m = sdp.media[idx];
if (m.type === 'audio') {
peerHasAudioLine = true;
if (!m.direction || m.direction === 'sendrecv') {
peerOffersFullAudio = true;
}
}
if (m.type === 'video') {
peerHasVideoLine = true;
if (!m.direction || m.direction === 'sendrecv') {
peerOffersFullVideo = true;
}
}
}
// Remove audio from mediaStream if suggested by mediaConstraints
if (mediaStream && mediaConstraints.audio === false) {
tracks = mediaStream.getAudioTracks();
length = tracks.length;
for (idx=0; idx<length; idx++) {
mediaStream.removeTrack(tracks[idx]);
}
}
// Remove video from mediaStream if suggested by mediaConstraints
if (mediaStream && mediaConstraints.video === false) {
tracks = mediaStream.getVideoTracks();
length = tracks.length;
for (idx=0; idx<length; idx++) {
mediaStream.removeTrack(tracks[idx]);
}
}
// Set audio constraints based on incoming stream if not supplied
if (!mediaStream && mediaConstraints.audio === undefined) {
mediaConstraints.audio = peerOffersFullAudio;
}
// Set video constraints based on incoming stream if not supplied
if (!mediaStream && mediaConstraints.video === undefined) {
mediaConstraints.video = peerOffersFullVideo;
}
// Don't ask for audio if the incoming offer has no audio section
if (!mediaStream && !peerHasAudioLine) {
mediaConstraints.audio = false;
}
// Don't ask for video if the incoming offer has no video section
if (!mediaStream && !peerHasVideoLine) {
mediaConstraints.video = false;
}
// Create a new rtcninja.RTCPeerConnection instance.
// TODO: This may throw an error, should react.
createRTCConnection.call(this, pcConfig, rtcConstraints);
if (mediaStream) {
userMediaSucceeded(mediaStream);
} else {
self.localMediaStreamLocallyGenerated = true;
rtcninja.getUserMedia(
mediaConstraints,
userMediaSucceeded,
userMediaFailed
);
}
// User media succeeded
function userMediaSucceeded(stream) {
if (self.status === C.STATUS_TERMINATED) { return; }
self.localMediaStream = stream;
self.connection.addStream(stream);
if (! self.late_sdp) {
self.connection.setRemoteDescription(
new rtcninja.RTCSessionDescription({type:'offer', sdp:request.body}),
// success
remoteDescriptionSucceededOrNotNeeded,
// failure
function() {
request.reply(488);
failed.call(self, 'system', null, JsSIP_C.causes.WEBRTC_ERROR);
}
);
}
else {
remoteDescriptionSucceededOrNotNeeded();
}
}
// User media failed
function userMediaFailed() {
if (self.status === C.STATUS_TERMINATED) { return; }
request.reply(480);
failed.call(self, 'local', null, JsSIP_C.causes.USER_DENIED_MEDIA_ACCESS);
}
function remoteDescriptionSucceededOrNotNeeded() {
connecting.call(self, request);
if (! self.late_sdp) {
createLocalDescription.call(self, 'answer', rtcSucceeded, rtcFailed, rtcAnswerConstraints);
} else {
createLocalDescription.call(self, 'offer', rtcSucceeded, rtcFailed, self.rtcOfferConstraints);
}
}
function rtcSucceeded(sdp) {
if (self.status === C.STATUS_TERMINATED) { return; }
// run for reply success callback
function replySucceeded() {
self.status = C.STATUS_WAITING_FOR_ACK;
setInvite2xxTimer.call(self, request, sdp);
setACKTimer.call(self);
accepted.call(self, 'local');
}
// run for reply failure callback
function replyFailed() {
failed.call(self, 'system', null, JsSIP_C.causes.CONNECTION_ERROR);
}
handleSessionTimersInIncomingRequest.call(self, request, extraHeaders);
request.reply(200, null, extraHeaders,
sdp,
replySucceeded,
replyFailed
);
}
function rtcFailed() {
if (self.status === C.STATUS_TERMINATED) { return; }
request.reply(500);
failed.call(self, 'system', null, JsSIP_C.causes.WEBRTC_ERROR);
}
};
/**
* Terminate the call.
*/
RTCSession.prototype.terminate = function(options) {
debug('terminate()');
options = options || {};
var cancel_reason, dialog,
cause = options.cause || JsSIP_C.causes.BYE,
status_code = options.status_code,
reason_phrase = options.reason_phrase,
extraHeaders = options.extraHeaders && options.extraHeaders.slice() || [],
body = options.body,
self = this;
// Check Session Status
if (this.status === C.STATUS_TERMINATED) {
throw new Exceptions.InvalidStateError(this.status);
}
switch(this.status) {
// - UAC -
case C.STATUS_NULL:
case C.STATUS_INVITE_SENT:
case C.STATUS_1XX_RECEIVED:
debug('canceling sesssion');
if (status_code && (status_code < 200 || status_code >= 700)) {
throw new TypeError('Invalid status_code: '+ status_code);
} else if (status_code) {
reason_phrase = reason_phrase || JsSIP_C.REASON_PHRASE[status_code] || '';
cancel_reason = 'SIP ;cause=' + status_code + ' ;text="' + reason_phrase + '"';
}
// Check Session Status
if (this.status === C.STATUS_NULL) {
this.isCanceled = true;
this.cancelReason = cancel_reason;
} else if (this.status === C.STATUS_INVITE_SENT) {
this.isCanceled = true;
this.cancelReason = cancel_reason;
} else if(this.status === C.STATUS_1XX_RECEIVED) {
this.request.cancel(cancel_reason);
}
this.status = C.STATUS_CANCELED;
failed.call(this, 'local', null, JsSIP_C.causes.CANCELED);
break;
// - UAS -
case C.STATUS_WAITING_FOR_ANSWER:
case C.STATUS_ANSWERED:
debug('rejecting session');
status_code = status_code || 480;
if (status_code < 300 || status_code >= 700) {
throw new TypeError('Invalid status_code: '+ status_code);
}
this.request.reply(status_code, reason_phrase, extraHeaders, body);
failed.call(this, 'local', null, JsSIP_C.causes.REJECTED);
break;
case C.STATUS_WAITING_FOR_ACK:
case C.STATUS_CONFIRMED:
debug('terminating session');
reason_phrase = options.reason_phrase || JsSIP_C.REASON_PHRASE[status_code] || '';
if (status_code && (status_code < 200 || status_code >= 700)) {
throw new TypeError('Invalid status_code: '+ status_code);
} else if (status_code) {
extraHeaders.push('Reason: SIP ;cause=' + status_code + '; text="' + reason_phrase + '"');
}
/* RFC 3261 section 15 (Terminating a session):
*
* "...the callee's UA MUST NOT send a BYE on a confirmed dialog
* until it has received an ACK for its 2xx response or until the server
* transaction times out."
*/
if (this.status === C.STATUS_WAITING_FOR_ACK &&
this.direction === 'incoming' &&
this.request.server_transaction.state !== Transactions.C.STATUS_TERMINATED) {
// Save the dialog for later restoration
dialog = this.dialog;
// Send the BYE as soon as the ACK is received...
this.receiveRequest = function(request) {
if(request.method === JsSIP_C.ACK) {
sendRequest.call(this, JsSIP_C.BYE, {
extraHeaders: extraHeaders,
body: body
});
dialog.terminate();
}
};
// .., or when the INVITE transaction times out
this.request.server_transaction.on('stateChanged', function(){
if (this.state === Transactions.C.STATUS_TERMINATED) {
sendRequest.call(self, JsSIP_C.BYE, {
extraHeaders: extraHeaders,
body: body
});
dialog.terminate();
}
});
ended.call(this, 'local', null, cause);
// Restore the dialog into 'this' in order to be able to send the in-dialog BYE :-)
this.dialog = dialog;
// Restore the dialog into 'ua' so the ACK can reach 'this' session
this.ua.dialogs[dialog.id.toString()] = dialog;
} else {
sendRequest.call(this, JsSIP_C.BYE, {
extraHeaders: extraHeaders,
body: body
});
ended.call(this, 'local', null, cause);
}
}
};
RTCSession.prototype.close = function() {
debug('close()');
var idx;
if (this.status === C.STATUS_TERMINATED) {
return;
}
// Terminate RTC.
if (this.connection) {
try {
this.connection.close();
}
catch(error) {
debugerror('close() | error closing the RTCPeerConnection: %o', error);
}
}
// Close local MediaStream if it was not given by the user.
if (this.localMediaStream && this.localMediaStreamLocallyGenerated) {
debug('close() | closing local MediaStream');
rtcninja.closeMediaStream(this.localMediaStream);
}
// Terminate signaling.
// Clear SIP timers
for(idx in this.timers) {
clearTimeout(this.timers[idx]);
}
// Clear Session Timers.
clearTimeout(this.sessionTimers.timer);
// Terminate confirmed dialog
if (this.dialog) {
this.dialog.terminate();
delete this.dialog;
}
// Terminate early dialogs
for(idx in this.earlyDialogs) {
this.earlyDialogs[idx].terminate();
delete this.earlyDialogs[idx];
}
this.status = C.STATUS_TERMINATED;
delete this.ua.sessions[this.id];
};
RTCSession.prototype.sendDTMF = function(tones, options) {
debug('sendDTMF() | tones: %s', tones);
var duration, interToneGap,
position = 0,
self = this;
options = options || {};
duration = options.duration || null;
interToneGap = options.interToneGap || null;
if (tones === undefined) {
throw new TypeError('Not enough arguments');
}
// Check Session Status
if (this.status !== C.STATUS_CONFIRMED && this.status !== C.STATUS_WAITING_FOR_ACK) {
throw new Exceptions.InvalidStateError(this.status);
}
// Convert to string
if(typeof tones === 'number') {
tones = tones.toString();
}
// Check tones
if (!tones || typeof tones !== 'string' || !tones.match(/^[0-9A-D#*,]+$/i)) {
throw new TypeError('Invalid tones: '+ tones);
}
// Check duration
if (duration && !Utils.isDecimal(duration)) {
throw new TypeError('Invalid tone duration: '+ duration);
} else if (!duration) {
duration = RTCSession_DTMF.C.DEFAULT_DURATION;
} else if (duration < RTCSession_DTMF.C.MIN_DURATION) {
debug('"duration" value is lower than the minimum allowed, setting it to '+ RTCSession_DTMF.C.MIN_DURATION+ ' milliseconds');
duration = RTCSession_DTMF.C.MIN_DURATION;
} else if (duration > RTCSession_DTMF.C.MAX_DURATION) {
debug('"duration" value is greater than the maximum allowed, setting it to '+ RTCSession_DTMF.C.MAX_DURATION +' milliseconds');
duration = RTCSession_DTMF.C.MAX_DURATION;
} else {
duration = Math.abs(duration);
}
options.duration = duration;
// Check interToneGap
if (interToneGap && !Utils.isDecimal(interToneGap)) {
throw new TypeError('Invalid interToneGap: '+ interToneGap);
} else if (!interToneGap) {
interToneGap = RTCSession_DTMF.C.DEFAULT_INTER_TONE_GAP;
} else if (interToneGap < RTCSession_DTMF.C.MIN_INTER_TONE_GAP) {
debug('"interToneGap" value is lower than the minimum allowed, setting it to '+ RTCSession_DTMF.C.MIN_INTER_TONE_GAP +' milliseconds');
interToneGap = RTCSession_DTMF.C.MIN_INTER_TONE_GAP;
} else {
interToneGap = Math.abs(interToneGap);
}
if (this.tones) {
// Tones are already queued, just add to the queue
this.tones += tones;
return;
}
this.tones = tones;
// Send the first tone
_sendDTMF();
function _sendDTMF() {
var tone, timeout;
if (self.status === C.STATUS_TERMINATED || !self.tones || position >= self.tones.length) {
// Stop sending DTMF
self.tones = null;
return;
}
tone = self.tones[position];
position += 1;
if (tone === ',') {
timeout = 2000;
} else {
var dtmf = new RTCSession_DTMF(self);
options.eventHandlers = {
failed: function() { self.tones = null; }
};
dtmf.send(tone, options);
timeout = duration + interToneGap;
}
// Set timeout for the next tone
setTimeout(_sendDTMF, timeout);
}
};
/**
* Mute
*/
RTCSession.prototype.mute = function(options) {
debug('mute()');
options = options || {audio:true, video:false};
var
audioMuted = false,
videoMuted = false;
if (this.audioMuted === false && options.audio) {
audioMuted = true;
this.audioMuted = true;
toogleMuteAudio.call(this, true);
}
if (this.videoMuted === false && options.video) {
videoMuted = true;
this.videoMuted = true;
toogleMuteVideo.call(this, true);
}
if (audioMuted === true || videoMuted === true) {
onmute.call(this, {
audio: audioMuted,
video: videoMuted
});
}
};
/**
* Unmute
*/
RTCSession.prototype.unmute = function(options) {
debug('unmute()');
options = options || {audio:true, video:true};
var
audioUnMuted = false,
videoUnMuted = false;
if (this.audioMuted === true && options.audio) {
audioUnMuted = true;
this.audioMuted = false;
if (this.localHold === false) {
toogleMuteAudio.call(this, false);
}
}
if (this.videoMuted === true && options.video) {
videoUnMuted = true;
this.videoMuted = false;
if (this.localHold === false) {
toogleMuteVideo.call(this, false);
}
}
if (audioUnMuted === true || videoUnMuted === true) {
onunmute.call(this, {
audio: audioUnMuted,
video: videoUnMuted
});
}
};
/**
* Hold
*/
RTCSession.prototype.hold = function(options, done) {
debug('hold()');
options = options || {};
var self = this,
eventHandlers;
if (this.status !== C.STATUS_WAITING_FOR_ACK && this.status !== C.STATUS_CONFIRMED) {
return false;
}
if (this.localHold === true) {
return false;
}
if (! this.isReadyToReOffer()) {
return false;
}
this.localHold = true;
onhold.call(this, 'local');
eventHandlers = {
succeeded: function() {
if (done) { done(); }
},
failed: function() {
self.terminate({
cause: JsSIP_C.causes.WEBRTC_ERROR,
status_code: 500,
reason_phrase: 'Hold Failed'
});
}
};
if (options.useUpdate) {
sendUpdate.call(this, {
sdpOffer: true,
eventHandlers: eventHandlers,
extraHeaders: options.extraHeaders
});
} else {
sendReinvite.call(this, {
eventHandlers: eventHandlers,
extraHeaders: options.extraHeaders
});
}
return true;
};
RTCSession.prototype.unhold = function(options, done) {
debug('unhold()');
options = options || {};
var self = this,
eventHandlers;
if (this.status !== C.STATUS_WAITING_FOR_ACK && this.status !== C.STATUS_CONFIRMED) {
return false;
}
if (this.localHold === false) {
return false;
}
if (! this.isReadyToReOffer()) {
return false;
}
this.localHold = false;
onunhold.call(this, 'local');
eventHandlers = {
succeeded: function() {
if (done) { done(); }
},
failed: function() {
self.terminate({
cause: JsSIP_C.causes.WEBRTC_ERROR,
status_code: 500,
reason_phrase: 'Unhold Failed'
});
}
};
if (options.useUpdate) {
sendUpdate.call(this, {
sdpOffer: true,
eventHandlers: eventHandlers,
extraHeaders: options.extraHeaders
});
} else {
sendReinvite.call(this, {
eventHandlers: eventHandlers,
extraHeaders: options.extraHeaders
});
}
return true;
};
RTCSession.prototype.renegotiate = function(options, done) {
debug('renegotiate()');
options = options || {};
var self = this,
eventHandlers,
rtcOfferConstraints = options.rtcOfferConstraints || null;
if (this.status !== C.STATUS_WAITING_FOR_ACK && this.status !== C.STATUS_CONFIRMED) {
return false;
}
if (! this.isReadyToReOffer()) {
return false;
}
eventHandlers = {
succeeded: function() {
if (done) { done(); }
},
failed: function() {
self.terminate({
cause: JsSIP_C.causes.WEBRTC_ERROR,
status_code: 500,
reason_phrase: 'Media Renegotiation Failed'
});
}
};
setLocalMediaStatus.call(this);
if (options.useUpdate) {
sendUpdate.call(this, {
sdpOffer: true,
eventHandlers: eventHandlers,
rtcOfferConstraints: rtcOfferConstraints,
extraHeaders: options.extraHeaders
});
} else {
sendReinvite.call(this, {
eventHandlers: eventHandlers,
rtcOfferConstraints: rtcOfferConstraints,
extraHeaders: options.extraHeaders
});
}
return true;
};
/**
* In dialog Request Reception
*/
RTCSession.prototype.receiveRequest = function(request) {
debug('receiveRequest()');
var contentType,
self = this;
if(request.method === JsSIP_C.CANCEL) {
/* RFC3261 15 States that a UAS may have accepted an invitation while a CANCEL
* was in progress and that the UAC MAY continue with the session established by
* any 2xx response, or MAY terminate with BYE. JsSIP does continue with the
* established session. So the CANCEL is processed only if the session is not yet
* established.
*/
/*
* Terminate the whole session in case the user didn't accept (or yet send the answer)
* nor reject the request opening the session.
*/
if(this.status === C.STATUS_WAITING_FOR_ANSWER || this.status === C.STATUS_ANSWERED) {
this.status = C.STATUS_CANCELED;
this.request.reply(487);
failed.call(this, 'remote', request, JsSIP_C.causes.CANCELED);
}
} else {
// Requests arriving here are in-dialog requests.
switch(request.method) {
case JsSIP_C.ACK:
if(this.status === C.STATUS_WAITING_FOR_ACK) {
clearTimeout(this.timers.ackTimer);
clearTimeout(this.timers.invite2xxTimer);
if (this.late_sdp) {
if (!request.body) {
ended.call(this, 'remote', request, JsSIP_C.causes.MISSING_SDP);
break;
}
this.connection.setRemoteDescription(
new rtcninja.RTCSessionDescription({type:'answer', sdp:request.body}),
// success
function() {
self.status = C.STATUS_CONFIRMED;
},
// failure
function() {
ended.call(self, 'remote', request, JsSIP_C.causes.BAD_MEDIA_DESCRIPTION);
}
);
}
else {
this.status = C.STATUS_CONFIRMED;
}
if (this.status === C.STATUS_CONFIRMED && !this.is_confirmed) {
confirmed.call(this, 'remote', request);
}
}
break;
case JsSIP_C.BYE:
if(this.status === C.STATUS_CONFIRMED) {
request.reply(200);
ended.call(this, 'remote', request, JsSIP_C.causes.BYE);
}
else if (this.status === C.STATUS_INVITE_RECEIVED) {
request.reply(200);
this.request.reply(487, 'BYE Received');
ended.call(this, 'remote', request, JsSIP_C.causes.BYE);
}
else {
request.reply(403, 'Wrong Status');
}
break;
case JsSIP_C.INVITE:
if(this.status === C.STATUS_CONFIRMED) {
receiveReinvite.call(this, request);
}
else {
request.reply(403, 'Wrong Status');
}
break;
case JsSIP_C.INFO:
if(this.status === C.STATUS_CONFIRMED || this.status === C.STATUS_WAITING_FOR_ACK || this.status === C.STATUS_INVITE_RECEIVED) {
contentType = request.getHeader('content-type');
if (contentType && (contentType.match(/^application\/dtmf-relay/i))) {
new RTCSession_DTMF(this).init_incoming(request);
}
else {
request.reply(415);
}
}
else {
request.reply(403, 'Wrong Status');
}
break;
case JsSIP_C.UPDATE:
if(this.status === C.STATUS_CONFIRMED) {
receiveUpdate.call(this, request);
}
else {
request.reply(403, 'Wrong Status');
}
break;
default:
request.reply(501);
}
}
};
/**
* Session Callbacks
*/
RTCSession.prototype.onTransportError = function() {
debugerror('onTransportError()');
if(this.status !== C.STATUS_TERMINATED) {
this.terminate({
status_code: 500,
reason_phrase: JsSIP_C.causes.CONNECTION_ERROR,
cause: JsSIP_C.causes.CONNECTION_ERROR
});
}
};
RTCSession.prototype.onRequestTimeout = function() {
debug('onRequestTimeout');
if(this.status !== C.STATUS_TERMINATED) {
this.terminate({
status_code: 408,
reason_phrase: JsSIP_C.causes.REQUEST_TIMEOUT,
cause: JsSIP_C.causes.REQUEST_TIMEOUT
});
}
};
RTCSession.prototype.onDialogError = function() {
debugerror('onDialogError()');
if(this.status !== C.STATUS_TERMINATED) {
this.terminate({
status_code: 500,
reason_phrase: JsSIP_C.causes.DIALOG_ERROR,
cause: JsSIP_C.causes.DIALOG_ERROR
});
}
};
// Called from DTMF handler.
RTCSession.prototype.newDTMF = function(data) {
debug('newDTMF()');
this.emit('newDTMF', data);
};
/**
* Private API.
*/
/**
* RFC3261 13.3.1.4
* Response retransmissions cannot be accomplished by transaction layer
* since it is destroyed when receiving the first 2xx answer
*/
function setInvite2xxTimer(request, body) {
var
self = this,
timeout = Timers.T1;
this.timers.invite2xxTimer = setTimeout(function invite2xxRetransmission() {
if (self.status !== C.STATUS_WAITING_FOR_ACK) {
return;
}
request.reply(200, null, ['Contact: '+ self.contact], body);
if (timeout < Timers.T2) {
timeout = timeout * 2;
if (timeout > Timers.T2) {
timeout = Timers.T2;
}
}
self.timers.invite2xxTimer = setTimeout(
invite2xxRetransmission, timeout
);
}, timeout);
}
/**
* RFC3261 14.2
* If a UAS generates a 2xx response and never receives an ACK,
* it SHOULD generate a BYE to terminate the dialog.
*/
function setACKTimer() {
var self = this;
this.timers.ackTimer = setTimeout(function() {
if(self.status === C.STATUS_WAITING_FOR_ACK) {
debug('no ACK received, terminating the session');
clearTimeout(self.timers.invite2xxTimer);
sendRequest.call(self, JsSIP_C.BYE);
ended.call(self, 'remote', null, JsSIP_C.causes.NO_ACK);
}
}, Timers.TIMER_H);
}
function createRTCConnection(pcConfig, rtcConstraints) {
var self = this;
this.connection = new rtcninja.RTCPeerConnection(pcConfig, rtcConstraints);
this.connection.onaddstream = function(event, stream) {
self.emit('addstream', {stream: stream});
};
this.connection.onremovestream = function(event, stream) {
self.emit('removestream', {stream: stream});
};
this.connection.oniceconnectionstatechange = function(event, state) {
self.emit('iceconnetionstatechange', {state: state});
// TODO: Do more with different states.
if (state === 'failed') {
self.terminate({
cause: JsSIP_C.causes.RTP_TIMEOUT,
status_code: 200,
reason_phrase: JsSIP_C.causes.RTP_TIMEOUT
});
}
};
}
function createLocalDescription(type, onSuccess, onFailure, constraints) {
debug('createLocalDescription()');
var self = this;
var connection = this.connection;
this.rtcReady = false;
if (type === 'offer') {
connection.createOffer(
// success
createSucceeded,
// failure
function(error) {
self.rtcReady = true;
if (onFailure) { onFailure(error); }
},
// constraints
constraints
);
}
else if (type === 'answer') {
connection.createAnswer(
// success
createSucceeded,
// failure
function(error) {
self.rtcReady = true;
if (onFailure) { onFailure(error); }
},
// constraints
constraints
);
}
else {
throw new Error('createLocalDescription() | type must be "offer" or "answer", but "' +type+ '" was given');
}
// createAnswer or createOffer succeeded
function createSucceeded(desc) {
connection.onicecandidate = function(event, candidate) {
if (! candidate) {
connection.onicecandidate = null;
self.rtcReady = true;
if (onSuccess) { onSuccess(connection.localDescription.sdp); }
onSuccess = null;
}
};
connection.setLocalDescription(desc,
// success
function() {
if (connection.iceGatheringState === 'complete') {
self.rtcReady = true;
if (onSuccess) { onSuccess(connection.localDescription.sdp); }
onSuccess = null;
}
},
// failure
function(error) {
self.rtcReady = true;
if (onFailure) { onFailure(error); }
}
);
}
}
/**
* Dialog Management
*/
function createDialog(message, type, early) {
var dialog, early_dialog,
local_tag = (type === 'UAS') ? message.to_tag : message.from_tag,
remote_tag = (type === 'UAS') ? message.from_tag : message.to_tag,
id = message.call_id + local_tag + remote_tag;
early_dialog = this.earlyDialogs[id];
// Early Dialog
if (early) {
if (early_dialog) {
return true;
} else {
early_dialog = new Dialog(this, message, type, Dialog.C.STATUS_EARLY);
// Dialog has been successfully created.
if(early_dialog.error) {
debug(early_dialog.error);
failed.call(this, 'remote', message, JsSIP_C.causes.INTERNAL_ERROR);
return false;
} else {
this.earlyDialogs[id] = early_dialog;
return true;
}
}
}
// Confirmed Dialog
else {
// In case the dialog is in _early_ state, update it
if (early_dialog) {
early_dialog.update(message, type);
this.dialog = early_dialog;
delete this.earlyDialogs[id];
return true;
}
// Otherwise, create a _confirmed_ dialog
dialog = new Dialog(this, message, type);
if(dialog.error) {
debug(dialog.error);
failed.call(this, 'remote', message, JsSIP_C.causes.INTERNAL_ERROR);
return false;
} else {
this.dialog = dialog;
return true;
}
}
}
/**
* In dialog INVITE Reception
*/
function receiveReinvite(request) {
debug('receiveReinvite()');
var
sdp, idx, direction,
self = this,
contentType = request.getHeader('Content-Type'),
hold = false;
// Emit 'reinvite'.
this.emit('reinvite', {request: request});
if (request.body) {
this.late_sdp = false;
if (contentType !== 'application/sdp') {
debug('invalid Content-Type');
request.reply(415);
return;
}
sdp = Parser.parseSDP(request.body);
for (idx=0; idx < sdp.media.length; idx++) {
direction = sdp.media[idx].direction || sdp.direction || 'sendrecv';
if (direction === 'sendonly' || direction === 'inactive') {
hold = true;
}
// If at least one of the streams is active don't emit 'hold'.
else {
hold = false;
break;
}
}
this.connection.setRemoteDescription(
new rtcninja.RTCSessionDescription({type:'offer', sdp:request.body}),
// success
answer,
// failure
function() {
request.reply(488);
}
);
}
else {
this.late_sdp = true;
answer();
}
function answer() {
createSdp(
// onSuccess
function(sdp) {
var extraHeaders = ['Contact: ' + self.contact];
handleSessionTimersInIncomingRequest.call(self, request, extraHeaders);
if (self.late_sdp) {
sdp = mangleOffer.call(self, sdp);
}
request.reply(200, null, extraHeaders, sdp,
function() {
self.status = C.STATUS_WAITING_FOR_ACK;
setInvite2xxTimer.call(self, request, sdp);
setACKTimer.call(self);
}
);
},
// onFailure
function() {
request.reply(500);
}
);
}
function createSdp(onSuccess, onFailure) {
if (! self.late_sdp) {
if (self.remoteHold === true && hold === false) {
self.remoteHold = false;
onunhold.call(self, 'remote');
} else if (self.remoteHold === false && hold === true) {
self.remoteHold = true;
onhold.call(self, 'remote');
}
createLocalDescription.call(self, 'answer', onSuccess, onFailure, self.rtcAnswerConstraints);
} else {
createLocalDescription.call(self, 'offer', onSuccess, onFailure, self.rtcOfferConstraints);
}
}
}
/**
* In dialog UPDATE Reception
*/
function receiveUpdate(request) {
debug('receiveUpdate()');
var
sdp, idx, direction,
self = this,
contentType = request.getHeader('Content-Type'),
hold = false;
// Emit 'update'.
this.emit('update', {request: request});
if (! request.body) {
var extraHeaders = [];
handleSessionTimersInIncomingRequest.call(this, request, extraHeaders);
request.reply(200, null, extraHeaders);
return;
}
if (contentType !== 'application/sdp') {
debug('invalid Content-Type');
request.reply(415);
return;
}
sdp = Parser.parseSDP(request.body);
for (idx=0; idx < sdp.media.length; idx++) {
direction = sdp.media[idx].direction || sdp.direction || 'sendrecv';
if (direction === 'sendonly' || direction === 'inactive') {
hold = true;
}
// If at least one of the streams is active don't emit 'hold'.
else {
hold = false;
break;
}
}
this.connection.setRemoteDescription(
new rtcninja.RTCSessionDescription({type:'offer', sdp:request.body}),
// success
function() {
if (self.remoteHold === true && hold === false) {
self.remoteHold = false;
onunhold.call(self, 'remote');
} else if (self.remoteHold === false && hold === true) {
self.remoteHold = true;
onhold.call(self, 'remote');
}
createLocalDescription.call(self, 'answer',
// success
function(sdp) {
var extraHeaders = ['Contact: ' + self.contact];
handleSessionTimersInIncomingRequest.call(self, request, extraHeaders);
request.reply(200, null, extraHeaders, sdp);
},
// failure
function() {
request.reply(500);
}
);
},
// failure
function() {
request.reply(488);
},
// Constraints.
this.rtcAnswerConstraints
);
}
/**
* Initial Request Sender
*/
function sendInitialRequest(mediaConstraints, rtcOfferConstraints, mediaStream) {
var self = this;
var request_sender = new RequestSender(self, this.ua);
this.receiveResponse = function(response) {
receiveInviteResponse.call(self, response);
};
// If a local MediaStream is given use it.
if (mediaStream) {
userMediaSucceeded(mediaStream);
// If at least audio or video is requested prompt getUserMedia.
} else if (mediaConstraints.audio || mediaConstraints.video) {
this.localMediaStreamLocallyGenerated = true;
rtcninja.getUserMedia(
mediaConstraints,
userMediaSucceeded,
userMediaFailed
);
}
// Otherwise don't prompt getUserMedia.
else {
userMediaSucceeded(null);
}
// User media succeeded
function userMediaSucceeded(stream) {
if (self.status === C.STATUS_TERMINATED) { return; }
self.localMediaStream = stream;
if (stream) {
self.connection.addStream(stream);
}
connecting.call(self, self.request);
createLocalDescription.call(self, 'offer', rtcSucceeded, rtcFailed, rtcOfferConstraints);
}
// User media failed
function userMediaFailed() {
if (self.status === C.STATUS_TERMINATED) { return; }
failed.call(self, 'local', null, JsSIP_C.causes.USER_DENIED_MEDIA_ACCESS);
}
function rtcSucceeded(sdp) {
if (self.isCanceled || self.status === C.STATUS_TERMINATED) { return; }
self.request.body = sdp;
self.status = C.STATUS_INVITE_SENT;
request_sender.send();
}
function rtcFailed() {
if (self.status === C.STATUS_TERMINATED) { return; }
failed.call(self, 'system', null, JsSIP_C.causes.WEBRTC_ERROR);
}
}
/**
* Reception of Response for Initial INVITE
*/
function receiveInviteResponse(response) {
debug('receiveInviteResponse()');
var cause, dialog,
self = this;
// Handle 2XX retransmissions and responses from forked requests
if (this.dialog && (response.status_code >=200 && response.status_code <=299)) {
/*
* If it is a retransmission from the endpoint that established
* the dialog, send an ACK
*/
if (this.dialog.id.call_id === response.call_id &&
this.dialog.id.local_tag === response.from_tag &&
this.dialog.id.remote_tag === response.to_tag) {
sendRequest.call(this, JsSIP_C.ACK);
return;
}
// If not, send an ACK and terminate
else {
dialog = new Dialog(this, response, 'UAC');
if (dialog.error !== undefined) {
debug(dialog.error);
return;
}
dialog.sendRequest({
owner: {status: C.STATUS_TERMINATED},
onRequestTimeout: function(){},
onTransportError: function(){},
onDialogError: function(){},
receiveResponse: function(){}
}, JsSIP_C.ACK);
dialog.sendRequest({
owner: {status: C.STATUS_TERMINATED},
onRequestTimeout: function(){},
onTransportError: function(){},
onDialogError: function(){},
receiveResponse: function(){}
}, JsSIP_C.BYE);
return;
}
}
// Proceed to cancellation if the user requested.
if(this.isCanceled) {
// Remove the flag. We are done.
this.isCanceled = false;
if(response.status_code >= 100 && response.status_code < 200) {
this.request.cancel(this.cancelReason);
} else if(response.status_code >= 200 && response.status_code < 299) {
acceptAndTerminate.call(this, response);
}
return;
}
if(this.status !== C.STATUS_INVITE_SENT && this.status !== C.STATUS_1XX_RECEIVED) {
return;
}
switch(true) {
case /^100$/.test(response.status_code):
this.status = C.STATUS_1XX_RECEIVED;
break;
case /^1[0-9]{2}$/.test(response.status_code):
// Do nothing with 1xx responses without To tag.
if (!response.to_tag) {
debug('1xx response received without to tag');
break;
}
// Create Early Dialog if 1XX comes with contact
if (response.hasHeader('contact')) {
// An error on dialog creation will fire 'failed' event
if(! createDialog.call(this, response, 'UAC', true)) {
break;
}
}
this.status = C.STATUS_1XX_RECEIVED;
progress.call(this, 'remote', response);
if (!response.body) {
break;
}
this.connection.setRemoteDescription(
new rtcninja.RTCSessionDescription({type:'pranswer', sdp:response.body}),
// success
null,
// failure
function() {
self.earlyDialogs[response.call_id + response.from_tag + response.to_tag].terminate();
}
);
break;
case /^2[0-9]{2}$/.test(response.status_code):
this.status = C.STATUS_CONFIRMED;
if(!response.body) {
acceptAndTerminate.call(this, response, 400, JsSIP_C.causes.MISSING_SDP);
failed.call(this, 'remote', response, JsSIP_C.causes.BAD_MEDIA_DESCRIPTION);
break;
}
// An error on dialog creation will fire 'failed' event
if (! createDialog.call(this, response, 'UAC')) {
break;
}
this.connection.setRemoteDescription(
new rtcninja.RTCSessionDescription({type:'answer', sdp:response.body}),
// success
function() {
// Handle Session Timers.
handleSessionTimersInIncomingResponse.call(self, response);
accepted.call(self, 'remote', response);
sendRequest.call(self, JsSIP_C.ACK);
confirmed.call(self, 'local', null);
},
// failure
function() {
acceptAndTerminate.call(self, response, 488, 'Not Acceptable Here');
failed.call(self, 'remote', response, JsSIP_C.causes.BAD_MEDIA_DESCRIPTION);
}
);
break;
default:
cause = Utils.sipErrorCause(response.status_code);
failed.call(this, 'remote', response, cause);
}
}
/**
* Send Re-INVITE
*/
function sendReinvite(options) {
debug('sendReinvite()');
options = options || {};
var
self = this,
extraHeaders = options.extraHeaders || [],
eventHandlers = options.eventHandlers || {},
rtcOfferConstraints = options.rtcOfferConstraints || this.rtcOfferConstraints || null,
succeeded = false;
extraHeaders.push('Contact: ' + this.contact);
extraHeaders.push('Content-Type: application/sdp');
// Session Timers.
if (this.sessionTimers.running) {
extraHeaders.push('Session-Expires: ' + this.sessionTimers.currentExpires + ';refresher=' + (this.sessionTimers.refresher ? 'uac' : 'uas'));
}
createLocalDescription.call(this, 'offer',
// success
function(sdp) {
sdp = mangleOffer.call(self, sdp);
var request = new RTCSession_Request(self, JsSIP_C.INVITE);
request.send({
extraHeaders: extraHeaders,
body: sdp,
eventHandlers: {
onSuccessResponse: function(response) {
onSucceeded(response);
succeeded = true;
},
onErrorResponse: function(response) {
onFailed(response);
},
onTransportError: function() {
self.onTransportError(); // Do nothing because session ends.
},
onRequestTimeout: function() {
self.onRequestTimeout(); // Do nothing because session ends.
},
onDialogError: function() {
self.onDialogError(); // Do nothing because session ends.
}
}
});
},
// failure
function() {
onFailed();
},
// RTC constraints.
rtcOfferConstraints
);
function onSucceeded(response) {
if (self.status === C.STATUS_TERMINATED) {
return;
}
sendRequest.call(self, JsSIP_C.ACK);
// If it is a 2XX retransmission exit now.
if (succeeded) { return; }
// Handle Session Timers.
handleSessionTimersInIncomingResponse.call(self, response);
// Must have SDP answer.
if(! response.body) {
onFailed();
return;
} else if (response.getHeader('Content-Type') !== 'application/sdp') {
onFailed();
return;
}
self.connection.setRemoteDescription(
new rtcninja.RTCSessionDescription({type:'answer', sdp:response.body}),
// success
function() {
if (eventHandlers.succeeded) { eventHandlers.succeeded(response); }
},
// failure
function() {
onFailed();
}
);
}
function onFailed(response) {
if (eventHandlers.failed) { eventHandlers.failed(response); }
}
}
/**
* Send UPDATE
*/
function sendUpdate(options) {
debug('sendUpdate()');
options = options || {};
var
self = this,
extraHeaders = options.extraHeaders || [],
eventHandlers = options.eventHandlers || {},
rtcOfferConstraints = options.rtcOfferConstraints || this.rtcOfferConstraints || null,
sdpOffer = options.sdpOffer || false,
succeeded = false;
extraHeaders.push('Contact: ' + this.contact);
// Session Timers.
if (this.sessionTimers.running) {
extraHeaders.push('Session-Expires: ' + this.sessionTimers.currentExpires + ';refresher=' + (this.sessionTimers.refresher ? 'uac' : 'uas'));
}
if (sdpOffer) {
extraHeaders.push('Content-Type: application/sdp');
createLocalDescription.call(this, 'offer',
// success
function(sdp) {
sdp = mangleOffer.call(self, sdp);
var request = new RTCSession_Request(self, JsSIP_C.UPDATE);
request.send({
extraHeaders: extraHeaders,
body: sdp,
eventHandlers: {
onSuccessResponse: function(response) {
onSucceeded(response);
succeeded = true;
},
onErrorResponse: function(response) {
onFailed(response);
},
onTransportError: function() {
self.onTransportError(); // Do nothing because session ends.
},
onRequestTimeout: function() {
self.onRequestTimeout(); // Do nothing because session ends.
},
onDialogError: function() {
self.onDialogError(); // Do nothing because session ends.
}
}
});
},
// failure
function() {
onFailed();
},
// RTC constraints.
rtcOfferConstraints
);
}
// No SDP.
else {
var request = new RTCSession_Request(self, JsSIP_C.UPDATE);
request.send({
extraHeaders: extraHeaders,
eventHandlers: {
onSuccessResponse: function(response) {
onSucceeded(response);
},
onErrorResponse: function(response) {
onFailed(response);
},
onTransportError: function() {
self.onTransportError(); // Do nothing because session ends.
},
onRequestTimeout: function() {
self.onRequestTimeout(); // Do nothing because session ends.
},
onDialogError: function() {
self.onDialogError(); // Do nothing because session ends.
}
}
});
}
function onSucceeded(response) {
if (self.status === C.STATUS_TERMINATED) {
return;
}
// If it is a 2XX retransmission exit now.
if (succeeded) { return; }
// Handle Session Timers.
handleSessionTimersInIncomingResponse.call(self, response);
// Must have SDP answer.
if (sdpOffer) {
if(! response.body) {
onFailed();
return;
} else if (response.getHeader('Content-Type') !== 'application/sdp') {
onFailed();
return;
}
self.connection.setRemoteDescription(
new rtcninja.RTCSessionDescription({type:'answer', sdp:response.body}),
// success
function() {
if (eventHandlers.succeeded) { eventHandlers.succeeded(response); }
},
// failure
function() {
onFailed();
}
);
}
// No SDP answer.
else {
if (eventHandlers.succeeded) { eventHandlers.succeeded(response); }
}
}
function onFailed(response) {
if (eventHandlers.failed) { eventHandlers.failed(response); }
}
}
function acceptAndTerminate(response, status_code, reason_phrase) {
debug('acceptAndTerminate()');
var extraHeaders = [];
if (status_code) {
reason_phrase = reason_phrase || JsSIP_C.REASON_PHRASE[status_code] || '';
extraHeaders.push('Reason: SIP ;cause=' + status_code + '; text="' + reason_phrase + '"');
}
// An error on dialog creation will fire 'failed' event
if (this.dialog || createDialog.call(this, response, 'UAC')) {
sendRequest.call(this, JsSIP_C.ACK);
sendRequest.call(this, JsSIP_C.BYE, {
extraHeaders: extraHeaders
});
}
// Update session status.
this.status = C.STATUS_TERMINATED;
}
/**
* Send a generic in-dialog Request
*/
function sendRequest(method, options) {
debug('sendRequest()');
var request = new RTCSession_Request(this, method);
request.send(options);
}
/**
* Correctly set the SDP direction attributes if the call is on local hold
*/
function mangleOffer(sdp) {
var idx, length, m;
if (! this.localHold && ! this.remoteHold) {
return sdp;
}
sdp = Parser.parseSDP(sdp);
// Local hold.
if (this.localHold && ! this.remoteHold) {
debug('mangleOffer() | me on hold, mangling offer');
length = sdp.media.length;
for (idx=0; idx<length; idx++) {
m = sdp.media[idx];
if (!m.direction) {
m.direction = 'sendonly';
} else if (m.direction === 'sendrecv') {
m.direction = 'sendonly';
} else if (m.direction === 'recvonly') {
m.direction = 'inactive';
}
}
}
// Local and remote hold.
else if (this.localHold && this.remoteHold) {
debug('mangleOffer() | both on hold, mangling offer');
length = sdp.media.length;
for (idx=0; idx<length; idx++) {
m = sdp.media[idx];
m.direction = 'inactive';
}
}
// Remote hold.
else if (this.remoteHold) {
debug('mangleOffer() | remote on hold, mangling offer');
length = sdp.media.length;
for (idx=0; idx<length; idx++) {
m = sdp.media[idx];
if (!m.direction) {
m.direction = 'recvonly';
} else if (m.direction === 'sendrecv') {
m.direction = 'recvonly';
} else if (m.direction === 'recvonly') {
m.direction = 'inactive';
}
}
}
return Parser.writeSDP(sdp);
}
function setLocalMediaStatus() {
if (this.localHold) {
debug('setLocalMediaStatus() | me on hold, mutting my media');
toogleMuteAudio.call(this, true);
toogleMuteVideo.call(this, true);
return;
}
else if (this.remoteHold) {
debug('setLocalMediaStatus() | remote on hold, mutting my media');
toogleMuteAudio.call(this, true);
toogleMuteVideo.call(this, true);
return;
}
if (this.audioMuted) {
toogleMuteAudio.call(this, true);
} else {
toogleMuteAudio.call(this, false);
}
if (this.videoMuted) {
toogleMuteVideo.call(this, true);
} else {
toogleMuteVideo.call(this, false);
}
}
/**
* Handle SessionTimers for an incoming INVITE or UPDATE.
* @param {IncomingRequest} request
* @param {Array} responseExtraHeaders Extra headers for the 200 response.
*/
function handleSessionTimersInIncomingRequest(request, responseExtraHeaders) {
if (! this.sessionTimers.enabled) { return; }
var session_expires_refresher;
if (request.session_expires && request.session_expires >= JsSIP_C.MIN_SESSION_EXPIRES) {
this.sessionTimers.currentExpires = request.session_expires;
session_expires_refresher = request.session_expires_refresher || 'uas';
}
else {
this.sessionTimers.currentExpires = this.sessionTimers.defaultExpires;
session_expires_refresher = 'uas';
}
responseExtraHeaders.push('Session-Expires: ' + this.sessionTimers.currentExpires + ';refresher=' + session_expires_refresher);
this.sessionTimers.refresher = (session_expires_refresher === 'uas');
runSessionTimer.call(this);
}
/**
* Handle SessionTimers for an incoming response to INVITE or UPDATE.
* @param {IncomingResponse} response
*/
function handleSessionTimersInIncomingResponse(response) {
if (! this.sessionTimers.enabled) { return; }
var session_expires_refresher;
if (response.session_expires && response.session_expires >= JsSIP_C.MIN_SESSION_EXPIRES) {
this.sessionTimers.currentExpires = response.session_expires;
session_expires_refresher = response.session_expires_refresher || 'uac';
}
else {
this.sessionTimers.currentExpires = this.sessionTimers.defaultExpires;
session_expires_refresher = 'uac';
}
this.sessionTimers.refresher = (session_expires_refresher === 'uac');
runSessionTimer.call(this);
}
function runSessionTimer() {
var self = this;
var expires = this.sessionTimers.currentExpires;
this.sessionTimers.running = true;
clearTimeout(this.sessionTimers.timer);
// I'm the refresher.
if (this.sessionTimers.refresher) {
this.sessionTimers.timer = setTimeout(function() {
if (self.status === C.STATUS_TERMINATED) { return; }
debug('runSessionTimer() | sending session refresh request');
sendUpdate.call(self, {
eventHandlers: {
succeeded: function(response) {
handleSessionTimersInIncomingResponse.call(self, response);
}
}
});
}, expires * 500); // Half the given interval (as the RFC states).
}
// I'm not the refresher.
else {
this.sessionTimers.timer = setTimeout(function() {
if (self.status === C.STATUS_TERMINATED) { return; }
debugerror('runSessionTimer() | timer expired, terminating the session');
self.terminate({
cause: JsSIP_C.causes.REQUEST_TIMEOUT,
status_code: 408,
reason_phrase: 'Session Timer Expired'
});
}, expires * 1100);
}
}
function toogleMuteAudio(mute) {
var streamIdx, trackIdx, streamsLength, tracksLength, tracks,
localStreams = this.connection.getLocalStreams();
streamsLength = localStreams.length;
for (streamIdx = 0; streamIdx < streamsLength; streamIdx++) {
tracks = localStreams[streamIdx].getAudioTracks();
tracksLength = tracks.length;
for (trackIdx = 0; trackIdx < tracksLength; trackIdx++) {
tracks[trackIdx].enabled = !mute;
}
}
}
function toogleMuteVideo(mute) {
var streamIdx, trackIdx, streamsLength, tracksLength, tracks,
localStreams = this.connection.getLocalStreams();
streamsLength = localStreams.length;
for (streamIdx = 0; streamIdx < streamsLength; streamIdx++) {
tracks = localStreams[streamIdx].getVideoTracks();
tracksLength = tracks.length;
for (trackIdx = 0; trackIdx < tracksLength; trackIdx++) {
tracks[trackIdx].enabled = !mute;
}
}
}
function newRTCSession(originator, request) {
debug('newRTCSession');
if (originator === 'remote') {
this.direction = 'incoming';
this.local_identity = request.to;
this.remote_identity = request.from;
} else if (originator === 'local'){
this.direction = 'outgoing';
this.local_identity = request.from;
this.remote_identity = request.to;
}
this.ua.newRTCSession({
originator: originator,
session: this,
request: request
});
}
function connecting(request) {
debug('session connecting');
this.emit('connecting', {
request: request
});
}
function progress(originator, response) {
debug('session progress');
this.emit('progress', {
originator: originator,
response: response || null
});
}
function accepted(originator, message) {
debug('session accepted');
this.start_time = new Date();
this.emit('accepted', {
originator: originator,
response: message || null
});
}
function confirmed(originator, ack) {
debug('session confirmed');
this.is_confirmed = true;
this.emit('confirmed', {
originator: originator,
ack: ack || null
});
}
function ended(originator, message, cause) {
debug('session ended');
this.end_time = new Date();
this.close();
this.emit('ended', {
originator: originator,
message: message || null,
cause: cause
});
}
function failed(originator, message, cause) {
debug('session failed');
this.close();
this.emit('failed', {
originator: originator,
message: message || null,
cause: cause
});
}
function onhold(originator) {
debug('session onhold');
setLocalMediaStatus.call(this);
this.emit('hold', {
originator: originator
});
}
function onunhold(originator) {
debug('session onunhold');
setLocalMediaStatus.call(this);
this.emit('unhold', {
originator: originator
});
}
function onmute(options) {
debug('session onmute');
setLocalMediaStatus.call(this);
this.emit('muted', {
audio: options.audio,
video: options.video
});
}
function onunmute(options) {
debug('session onunmute');
setLocalMediaStatus.call(this);
this.emit('unmuted', {
audio: options.audio,
video: options.video
});
}
},{"./Constants":1,"./Dialog":2,"./Exceptions":5,"./Parser":10,"./RTCSession/DTMF":12,"./RTCSession/Request":13,"./RequestSender":15,"./SIPMessage":16,"./Timers":17,"./Transactions":18,"./Utils":22,"debug":29,"events":24,"rtcninja":34,"util":28}],12:[function(require,module,exports){
module.exports = DTMF;
var C = {
MIN_DURATION: 70,
MAX_DURATION: 6000,
DEFAULT_DURATION: 100,
MIN_INTER_TONE_GAP: 50,
DEFAULT_INTER_TONE_GAP: 500
};
/**
* Expose C object.
*/
DTMF.C = C;
/**
* Dependencies.
*/
var debug = require('debug')('JsSIP:RTCSession:DTMF');
var debugerror = require('debug')('JsSIP:ERROR:RTCSession:DTMF');
debugerror.log = console.warn.bind(console);
var JsSIP_C = require('../Constants');
var Exceptions = require('../Exceptions');
var RTCSession = require('../RTCSession');
function DTMF(session) {
this.owner = session;
this.direction = null;
this.tone = null;
this.duration = null;
}
DTMF.prototype.send = function(tone, options) {
var extraHeaders, body;
if (tone === undefined) {
throw new TypeError('Not enough arguments');
}
this.direction = 'outgoing';
// Check RTCSession Status
if (this.owner.status !== RTCSession.C.STATUS_CONFIRMED &&
this.owner.status !== RTCSession.C.STATUS_WAITING_FOR_ACK) {
throw new Exceptions.InvalidStateError(this.owner.status);
}
// Get DTMF options
options = options || {};
extraHeaders = options.extraHeaders ? options.extraHeaders.slice() : [];
this.eventHandlers = options.eventHandlers || {};
// Check tone type
if (typeof tone === 'string' ) {
tone = tone.toUpperCase();
} else if (typeof tone === 'number') {
tone = tone.toString();
} else {
throw new TypeError('Invalid tone: '+ tone);
}
// Check tone value
if (!tone.match(/^[0-9A-D#*]$/)) {
throw new TypeError('Invalid tone: '+ tone);
} else {
this.tone = tone;
}
// Duration is checked/corrected in RTCSession
this.duration = options.duration;
extraHeaders.push('Content-Type: application/dtmf-relay');
body = 'Signal=' + this.tone + '\r\n';
body += 'Duration=' + this.duration;
this.owner.newDTMF({
originator: 'local',
dtmf: this,
request: this.request
});
this.owner.dialog.sendRequest(this, JsSIP_C.INFO, {
extraHeaders: extraHeaders,
body: body
});
};
DTMF.prototype.receiveResponse = function(response) {
switch(true) {
case /^1[0-9]{2}$/.test(response.status_code):
// Ignore provisional responses.
break;
case /^2[0-9]{2}$/.test(response.status_code):
debug('onSuccessResponse');
if (this.eventHandlers.onSuccessResponse) { this.eventHandlers.onSuccessResponse(response); }
break;
default:
if (this.eventHandlers.onErrorResponse) { this.eventHandlers.onErrorResponse(response); }
break;
}
};
DTMF.prototype.onRequestTimeout = function() {
debugerror('onRequestTimeout');
if (this.eventHandlers.onRequestTimeout) { this.eventHandlers.onRequestTimeout(); }
};
DTMF.prototype.onTransportError = function() {
debugerror('onTransportError');
if (this.eventHandlers.onTransportError) { this.eventHandlers.onTransportError(); }
};
DTMF.prototype.onDialogError = function() {
debugerror('onDialogError');
if (this.eventHandlers.onDialogError) { this.eventHandlers.onDialogError(); }
};
DTMF.prototype.init_incoming = function(request) {
var body,
reg_tone = /^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,
reg_duration = /^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;
this.direction = 'incoming';
this.request = request;
request.reply(200);
if (request.body) {
body = request.body.split('\n');
if (body.length >= 1) {
if (reg_tone.test(body[0])) {
this.tone = body[0].replace(reg_tone,'$2');
}
}
if (body.length >=2) {
if (reg_duration.test(body[1])) {
this.duration = parseInt(body[1].replace(reg_duration,'$2'), 10);
}
}
}
if (!this.duration) {
this.duration = C.DEFAULT_DURATION;
}
if (!this.tone) {
debug('invalid INFO DTMF received, discarded');
} else {
this.owner.newDTMF({
originator: 'remote',
dtmf: this,
request: request
});
}
};
},{"../Constants":1,"../Exceptions":5,"../RTCSession":11,"debug":29}],13:[function(require,module,exports){
module.exports = Request;
/**
* Dependencies.
*/
var debug = require('debug')('JsSIP:RTCSession:Request');
var debugerror = require('debug')('JsSIP:ERROR:RTCSession:Request');
debugerror.log = console.warn.bind(console);
var JsSIP_C = require('../Constants');
var Exceptions = require('../Exceptions');
var RTCSession = require('../RTCSession');
function Request(session, method) {
debug('new | %s', method);
this.session = session;
this.method = method;
// Check RTCSession Status
if (this.session.status !== RTCSession.C.STATUS_1XX_RECEIVED &&
this.session.status !== RTCSession.C.STATUS_WAITING_FOR_ANSWER &&
this.session.status !== RTCSession.C.STATUS_WAITING_FOR_ACK &&
this.session.status !== RTCSession.C.STATUS_CONFIRMED &&
this.session.status !== RTCSession.C.STATUS_TERMINATED) {
throw new Exceptions.InvalidStateError(this.session.status);
}
/*
* Allow sending BYE in TERMINATED status since the RTCSession
* could had been terminated before the ACK had arrived.
* RFC3261 Section 15, Paragraph 2
*/
else if (this.session.status === RTCSession.C.STATUS_TERMINATED && method !== JsSIP_C.BYE) {
throw new Exceptions.InvalidStateError(this.session.status);
}
}
Request.prototype.send = function(options) {
options = options || {};
var
extraHeaders = options.extraHeaders && options.extraHeaders.slice() || [],
body = options.body || null;
this.eventHandlers = options.eventHandlers || {};
this.session.dialog.sendRequest(this, this.method, {
extraHeaders: extraHeaders,
body: body
});
};
Request.prototype.receiveResponse = function(response) {
switch(true) {
case /^1[0-9]{2}$/.test(response.status_code):
debug('onProgressResponse');
if (this.eventHandlers.onProgressResponse) { this.eventHandlers.onProgressResponse(response); }
break;
case /^2[0-9]{2}$/.test(response.status_code):
debug('onSuccessResponse');
if (this.eventHandlers.onSuccessResponse) { this.eventHandlers.onSuccessResponse(response); }
break;
default:
debug('onErrorResponse');
if (this.eventHandlers.onErrorResponse) { this.eventHandlers.onErrorResponse(response); }
break;
}
};
Request.prototype.onRequestTimeout = function() {
debugerror('onRequestTimeout');
if (this.eventHandlers.onRequestTimeout) { this.eventHandlers.onRequestTimeout(); }
};
Request.prototype.onTransportError = function() {
debugerror('onTransportError');
if (this.eventHandlers.onTransportError) { this.eventHandlers.onTransportError(); }
};
Request.prototype.onDialogError = function() {
debugerror('onDialogError');
if (this.eventHandlers.onDialogError) { this.eventHandlers.onDialogError(); }
};
},{"../Constants":1,"../Exceptions":5,"../RTCSession":11,"debug":29}],14:[function(require,module,exports){
module.exports = Registrator;
/**
* Dependecies
*/
var debug = require('debug')('JsSIP:Registrator');
var Utils = require('./Utils');
var JsSIP_C = require('./Constants');
var SIPMessage = require('./SIPMessage');
var RequestSender = require('./RequestSender');
function Registrator(ua, transport) {
var reg_id=1; //Force reg_id to 1.
this.ua = ua;
this.transport = transport;
this.registrar = ua.configuration.registrar_server;
this.expires = ua.configuration.register_expires;
// Call-ID and CSeq values RFC3261 10.2
this.call_id = Utils.createRandomToken(22);
this.cseq = 0;
// this.to_uri
this.to_uri = ua.configuration.uri;
this.registrationTimer = null;
// Set status
this.registered = false;
// Contact header
this.contact = this.ua.contact.toString();
// sip.ice media feature tag (RFC 5768)
this.contact += ';+sip.ice';
// Custom headers for REGISTER and un-REGISTER.
this.extraHeaders = [];
// Custom Contact header params for REGISTER and un-REGISTER.
this.extraContactParams = '';
if(reg_id) {
this.contact += ';reg-id='+ reg_id;
this.contact += ';+sip.instance="<urn:uuid:'+ this.ua.configuration.instance_id+'>"';
}
}
Registrator.prototype = {
setExtraHeaders: function(extraHeaders) {
if (! Array.isArray(extraHeaders)) {
extraHeaders = [];
}
this.extraHeaders = extraHeaders.slice();
},
setExtraContactParams: function(extraContactParams) {
if (! (extraContactParams instanceof Object)) {
extraContactParams = {};
}
// Reset it.
this.extraContactParams = '';
for(var param_key in extraContactParams) {
var param_value = extraContactParams[param_key];
this.extraContactParams += (';' + param_key);
if (param_value) {
this.extraContactParams += ('=' + param_value);
}
}
},
register: function() {
var request_sender, cause, extraHeaders,
self = this;
extraHeaders = this.extraHeaders.slice();
extraHeaders.push('Contact: ' + this.contact + ';expires=' + this.expires + this.extraContactParams);
extraHeaders.push('Expires: '+ this.expires);
this.request = new SIPMessage.OutgoingRequest(JsSIP_C.REGISTER, this.registrar, this.ua, {
'to_uri': this.to_uri,
'call_id': this.call_id,
'cseq': (this.cseq += 1)
}, extraHeaders);
request_sender = new RequestSender(this, this.ua);
this.receiveResponse = function(response) {
var contact, expires,
contacts = response.getHeaders('contact').length;
// Discard responses to older REGISTER/un-REGISTER requests.
if(response.cseq !== this.cseq) {
return;
}
// Clear registration timer
if (this.registrationTimer !== null) {
clearTimeout(this.registrationTimer);
this.registrationTimer = null;
}
switch(true) {
case /^1[0-9]{2}$/.test(response.status_code):
// Ignore provisional responses.
break;
case /^2[0-9]{2}$/.test(response.status_code):
if(response.hasHeader('expires')) {
expires = response.getHeader('expires');
}
// Search the Contact pointing to us and update the expires value accordingly.
if (!contacts) {
debug('no Contact header in response to REGISTER, response ignored');
break;
}
while(contacts--) {
contact = response.parseHeader('contact', contacts);
if(contact.uri.user === this.ua.contact.uri.user) {
expires = contact.getParam('expires');
break;
} else {
contact = null;
}
}
if (!contact) {
debug('no Contact header pointing to us, response ignored');
break;
}
if(!expires) {
expires = this.expires;
}
// Re-Register before the expiration interval has elapsed.
// For that, decrease the expires value. ie: 3 seconds
this.registrationTimer = setTimeout(function() {
self.registrationTimer = null;
self.register();
}, (expires * 1000) - 3000);
//Save gruu values
if (contact.hasParam('temp-gruu')) {
this.ua.contact.temp_gruu = contact.getParam('temp-gruu').replace(/"/g,'');
}
if (contact.hasParam('pub-gruu')) {
this.ua.contact.pub_gruu = contact.getParam('pub-gruu').replace(/"/g,'');
}
if (! this.registered) {
this.registered = true;
this.ua.registered({
response: response
});
}
break;
// Interval too brief RFC3261 10.2.8
case /^423$/.test(response.status_code):
if(response.hasHeader('min-expires')) {
// Increase our registration interval to the suggested minimum
this.expires = response.getHeader('min-expires');
// Attempt the registration again immediately
this.register();
} else { //This response MUST contain a Min-Expires header field
debug('423 response received for REGISTER without Min-Expires');
this.registrationFailure(response, JsSIP_C.causes.SIP_FAILURE_CODE);
}
break;
default:
cause = Utils.sipErrorCause(response.status_code);
this.registrationFailure(response, cause);
}
};
this.onRequestTimeout = function() {
this.registrationFailure(null, JsSIP_C.causes.REQUEST_TIMEOUT);
};
this.onTransportError = function() {
this.registrationFailure(null, JsSIP_C.causes.CONNECTION_ERROR);
};
request_sender.send();
},
unregister: function(options) {
var extraHeaders;
if(!this.registered) {
debug('already unregistered');
return;
}
options = options || {};
this.registered = false;
// Clear the registration timer.
if (this.registrationTimer !== null) {
clearTimeout(this.registrationTimer);
this.registrationTimer = null;
}
extraHeaders = this.extraHeaders.slice();
if(options.all) {
extraHeaders.push('Contact: *' + this.extraContactParams);
extraHeaders.push('Expires: 0');
this.request = new SIPMessage.OutgoingRequest(JsSIP_C.REGISTER, this.registrar, this.ua, {
'to_uri': this.to_uri,
'call_id': this.call_id,
'cseq': (this.cseq += 1)
}, extraHeaders);
} else {
extraHeaders.push('Contact: '+ this.contact + ';expires=0' + this.extraContactParams);
extraHeaders.push('Expires: 0');
this.request = new SIPMessage.OutgoingRequest(JsSIP_C.REGISTER, this.registrar, this.ua, {
'to_uri': this.to_uri,
'call_id': this.call_id,
'cseq': (this.cseq += 1)
}, extraHeaders);
}
var request_sender = new RequestSender(this, this.ua);
this.receiveResponse = function(response) {
var cause;
switch(true) {
case /^1[0-9]{2}$/.test(response.status_code):
// Ignore provisional responses.
break;
case /^2[0-9]{2}$/.test(response.status_code):
this.unregistered(response);
break;
default:
cause = Utils.sipErrorCause(response.status_code);
this.unregistered(response, cause);
}
};
this.onRequestTimeout = function() {
this.unregistered(null, JsSIP_C.causes.REQUEST_TIMEOUT);
};
this.onTransportError = function() {
this.unregistered(null, JsSIP_C.causes.CONNECTION_ERROR);
};
request_sender.send();
},
registrationFailure: function(response, cause) {
this.ua.registrationFailed({
response: response || null,
cause: cause
});
if (this.registered) {
this.registered = false;
this.ua.unregistered({
response: response || null,
cause: cause
});
}
},
unregistered: function(response, cause) {
this.registered = false;
this.ua.unregistered({
response: response || null,
cause: cause || null
});
},
onTransportClosed: function() {
if (this.registrationTimer !== null) {
clearTimeout(this.registrationTimer);
this.registrationTimer = null;
}
if(this.registered) {
this.registered = false;
this.ua.unregistered({});
}
},
close: function() {
if (this.registered) {
this.unregister();
}
}
};
},{"./Constants":1,"./RequestSender":15,"./SIPMessage":16,"./Utils":22,"debug":29}],15:[function(require,module,exports){
module.exports = RequestSender;
/**
* Dependencies.
*/
var debug = require('debug')('JsSIP:RequestSender');
var JsSIP_C = require('./Constants');
var UA = require('./UA');
var DigestAuthentication = require('./DigestAuthentication');
var Transactions = require('./Transactions');
function RequestSender(applicant, ua) {
this.ua = ua;
this.applicant = applicant;
this.method = applicant.request.method;
this.request = applicant.request;
this.credentials = null;
this.challenged = false;
this.staled = false;
// If ua is in closing process or even closed just allow sending Bye and ACK
if (ua.status === UA.C.STATUS_USER_CLOSED && (this.method !== JsSIP_C.BYE || this.method !== JsSIP_C.ACK)) {
this.onTransportError();
}
}
/**
* Create the client transaction and send the message.
*/
RequestSender.prototype = {
send: function() {
switch(this.method) {
case 'INVITE':
this.clientTransaction = new Transactions.InviteClientTransaction(this, this.request, this.ua.transport);
break;
case 'ACK':
this.clientTransaction = new Transactions.AckClientTransaction(this, this.request, this.ua.transport);
break;
default:
this.clientTransaction = new Transactions.NonInviteClientTransaction(this, this.request, this.ua.transport);
}
this.clientTransaction.send();
},
/**
* Callback fired when receiving a request timeout error from the client transaction.
* To be re-defined by the applicant.
*/
onRequestTimeout: function() {
this.applicant.onRequestTimeout();
},
/**
* Callback fired when receiving a transport error from the client transaction.
* To be re-defined by the applicant.
*/
onTransportError: function() {
this.applicant.onTransportError();
},
/**
* Called from client transaction when receiving a correct response to the request.
* Authenticate request if needed or pass the response back to the applicant.
*/
receiveResponse: function(response) {
var cseq, challenge, authorization_header_name,
status_code = response.status_code;
/*
* Authentication
* Authenticate once. _challenged_ flag used to avoid infinite authentications.
*/
if ((status_code === 401 || status_code === 407) && this.ua.configuration.password !== null) {
// Get and parse the appropriate WWW-Authenticate or Proxy-Authenticate header.
if (response.status_code === 401) {
challenge = response.parseHeader('www-authenticate');
authorization_header_name = 'authorization';
} else {
challenge = response.parseHeader('proxy-authenticate');
authorization_header_name = 'proxy-authorization';
}
// Verify it seems a valid challenge.
if (! challenge) {
debug(response.status_code + ' with wrong or missing challenge, cannot authenticate');
this.applicant.receiveResponse(response);
return;
}
if (!this.challenged || (!this.staled && challenge.stale === true)) {
if (!this.credentials) {
this.credentials = new DigestAuthentication(this.ua);
}
// Verify that the challenge is really valid.
if (!this.credentials.authenticate(this.request, challenge)) {
this.applicant.receiveResponse(response);
return;
}
this.challenged = true;
if (challenge.stale) {
this.staled = true;
}
if (response.method === JsSIP_C.REGISTER) {
cseq = this.applicant.cseq += 1;
} else if (this.request.dialog){
cseq = this.request.dialog.local_seqnum += 1;
} else {
cseq = this.request.cseq + 1;
this.request.cseq = cseq;
}
this.request.setHeader('cseq', cseq +' '+ this.method);
this.request.setHeader(authorization_header_name, this.credentials.toString());
this.send();
} else {
this.applicant.receiveResponse(response);
}
} else {
this.applicant.receiveResponse(response);
}
}
};
},{"./Constants":1,"./DigestAuthentication":4,"./Transactions":18,"./UA":20,"debug":29}],16:[function(require,module,exports){
module.exports = {
OutgoingRequest: OutgoingRequest,
IncomingRequest: IncomingRequest,
IncomingResponse: IncomingResponse
};
/**
* Dependencies.
*/
var debug = require('debug')('JsSIP:SIPMessage');
var JsSIP_C = require('./Constants');
var Utils = require('./Utils');
var NameAddrHeader = require('./NameAddrHeader');
var Grammar = require('./Grammar');
/**
* -param {String} method request method
* -param {String} ruri request uri
* -param {UA} ua
* -param {Object} params parameters that will have priority over ua.configuration parameters:
* <br>
* - cseq, call_id, from_tag, from_uri, from_display_name, to_uri, to_tag, route_set
* -param {Object} [headers] extra headers
* -param {String} [body]
*/
function OutgoingRequest(method, ruri, ua, params, extraHeaders, body) {
var
to,
from,
call_id,
cseq;
params = params || {};
// Mandatory parameters check
if(!method || !ruri || !ua) {
return null;
}
this.ua = ua;
this.headers = {};
this.method = method;
this.ruri = ruri;
this.body = body;
this.extraHeaders = extraHeaders && extraHeaders.slice() || [];
// Fill the Common SIP Request Headers
// Route
if (params.route_set) {
this.setHeader('route', params.route_set);
} else if (ua.configuration.use_preloaded_route){
this.setHeader('route', ua.transport.server.sip_uri);
}
// Via
// Empty Via header. Will be filled by the client transaction.
this.setHeader('via', '');
// Max-Forwards
this.setHeader('max-forwards', JsSIP_C.MAX_FORWARDS);
// To
to = (params.to_display_name || params.to_display_name === 0) ? '"' + params.to_display_name + '" ' : '';
to += '<' + (params.to_uri || ruri) + '>';
to += params.to_tag ? ';tag=' + params.to_tag : '';
this.to = new NameAddrHeader.parse(to);
this.setHeader('to', to);
// From
if (params.from_display_name || params.from_display_name === 0) {
from = '"' + params.from_display_name + '" ';
} else if (ua.configuration.display_name) {
from = '"' + ua.configuration.display_name + '" ';
} else {
from = '';
}
from += '<' + (params.from_uri || ua.configuration.uri) + '>;tag=';
from += params.from_tag || Utils.newTag();
this.from = new NameAddrHeader.parse(from);
this.setHeader('from', from);
// Call-ID
call_id = params.call_id || (ua.configuration.jssip_id + Utils.createRandomToken(15));
this.call_id = call_id;
this.setHeader('call-id', call_id);
// CSeq
cseq = params.cseq || Math.floor(Math.random() * 10000);
this.cseq = cseq;
this.setHeader('cseq', cseq + ' ' + method);
}
OutgoingRequest.prototype = {
/**
* Replace the the given header by the given value.
* -param {String} name header name
* -param {String | Array} value header value
*/
setHeader: function(name, value) {
this.headers[Utils.headerize(name)] = (Array.isArray(value)) ? value : [value];
},
/**
* Get the value of the given header name at the given position.
* -param {String} name header name
* -returns {String|undefined} Returns the specified header, null if header doesn't exist.
*/
getHeader: function(name) {
var regexp, idx,
length = this.extraHeaders.length,
header = this.headers[Utils.headerize(name)];
if(header) {
if(header[0]) {
return header[0];
}
} else {
regexp = new RegExp('^\\s*'+ name +'\\s*:','i');
for (idx=0; idx<length; idx++) {
header = this.extraHeaders[idx];
if (regexp.test(header)) {
return header.substring(header.indexOf(':')+1).trim();
}
}
}
return;
},
/**
* Get the header/s of the given name.
* -param {String} name header name
* -returns {Array} Array with all the headers of the specified name.
*/
getHeaders: function(name) {
var idx, length, regexp,
header = this.headers[Utils.headerize(name)],
result = [];
if (header) {
length = header.length;
for (idx = 0; idx < length; idx++) {
result.push(header[idx]);
}
return result;
} else {
length = this.extraHeaders.length;
regexp = new RegExp('^\\s*'+ name +'\\s*:','i');
for (idx=0; idx<length; idx++) {
header = this.extraHeaders[idx];
if (regexp.test(header)) {
result.push(header.substring(header.indexOf(':')+1).trim());
}
}
return result;
}
},
/**
* Verify the existence of the given header.
* -param {String} name header name
* -returns {boolean} true if header with given name exists, false otherwise
*/
hasHeader: function(name) {
var regexp, idx,
length = this.extraHeaders.length;
if (this.headers[Utils.headerize(name)]) {
return true;
} else {
regexp = new RegExp('^\\s*'+ name +'\\s*:','i');
for (idx=0; idx<length; idx++) {
if (regexp.test(this.extraHeaders[idx])) {
return true;
}
}
}
return false;
},
toString: function() {
var msg = '', header, length, idx,
supported = [];
msg += this.method + ' ' + this.ruri + ' SIP/2.0\r\n';
for (header in this.headers) {
length = this.headers[header].length;
for (idx = 0; idx < length; idx++) {
msg += header + ': ' + this.headers[header][idx] + '\r\n';
}
}
length = this.extraHeaders.length;
for (idx = 0; idx < length; idx++) {
msg += this.extraHeaders[idx].trim() +'\r\n';
}
// Supported
switch (this.method) {
case JsSIP_C.REGISTER:
supported.push('path', 'gruu');
break;
case JsSIP_C.INVITE:
if (this.ua.configuration.session_timers) {
supported.push('timer');
}
if (this.ua.contact.pub_gruu || this.ua.contact.temp_gruu) {
supported.push('gruu');
}
supported.push('ice');
break;
case JsSIP_C.UPDATE:
if (this.ua.configuration.session_timers) {
supported.push('timer');
}
supported.push('ice');
break;
}
supported.push('outbound');
// Allow
msg += 'Allow: '+ JsSIP_C.ALLOWED_METHODS +'\r\n';
msg += 'Supported: ' + supported +'\r\n';
msg += 'User-Agent: ' + JsSIP_C.USER_AGENT +'\r\n';
if (this.body) {
length = Utils.str_utf8_length(this.body);
msg += 'Content-Length: ' + length + '\r\n\r\n';
msg += this.body;
} else {
msg += 'Content-Length: 0\r\n\r\n';
}
return msg;
}
};
function IncomingMessage(){
this.data = null;
this.headers = null;
this.method = null;
this.via = null;
this.via_branch = null;
this.call_id = null;
this.cseq = null;
this.from = null;
this.from_tag = null;
this.to = null;
this.to_tag = null;
this.body = null;
}
IncomingMessage.prototype = {
/**
* Insert a header of the given name and value into the last position of the
* header array.
*/
addHeader: function(name, value) {
var header = { raw: value };
name = Utils.headerize(name);
if(this.headers[name]) {
this.headers[name].push(header);
} else {
this.headers[name] = [header];
}
},
/**
* Get the value of the given header name at the given position.
*/
getHeader: function(name) {
var header = this.headers[Utils.headerize(name)];
if(header) {
if(header[0]) {
return header[0].raw;
}
} else {
return;
}
},
/**
* Get the header/s of the given name.
*/
getHeaders: function(name) {
var idx, length,
header = this.headers[Utils.headerize(name)],
result = [];
if(!header) {
return [];
}
length = header.length;
for (idx = 0; idx < length; idx++) {
result.push(header[idx].raw);
}
return result;
},
/**
* Verify the existence of the given header.
*/
hasHeader: function(name) {
return(this.headers[Utils.headerize(name)]) ? true : false;
},
/**
* Parse the given header on the given index.
* -param {String} name header name
* -param {Number} [idx=0] header index
* -returns {Object|undefined} Parsed header object, undefined if the header is not present or in case of a parsing error.
*/
parseHeader: function(name, idx) {
var header, value, parsed;
name = Utils.headerize(name);
idx = idx || 0;
if(!this.headers[name]) {
debug('header "' + name + '" not present');
return;
} else if(idx >= this.headers[name].length) {
debug('not so many "' + name + '" headers present');
return;
}
header = this.headers[name][idx];
value = header.raw;
if(header.parsed) {
return header.parsed;
}
//substitute '-' by '_' for grammar rule matching.
parsed = Grammar.parse(value, name.replace(/-/g, '_'));
if(parsed === -1) {
this.headers[name].splice(idx, 1); //delete from headers
debug('error parsing "' + name + '" header field with value "' + value + '"');
return;
} else {
header.parsed = parsed;
return parsed;
}
},
/**
* Message Header attribute selector. Alias of parseHeader.
* -param {String} name header name
* -param {Number} [idx=0] header index
* -returns {Object|undefined} Parsed header object, undefined if the header is not present or in case of a parsing error.
*
* -example
* message.s('via',3).port
*/
s: function(name, idx) {
return this.parseHeader(name, idx);
},
/**
* Replace the value of the given header by the value.
* -param {String} name header name
* -param {String} value header value
*/
setHeader: function(name, value) {
var header = { raw: value };
this.headers[Utils.headerize(name)] = [header];
},
toString: function() {
return this.data;
}
};
function IncomingRequest(ua) {
this.ua = ua;
this.headers = {};
this.ruri = null;
this.transport = null;
this.server_transaction = null;
}
IncomingRequest.prototype = new IncomingMessage();
/**
* Stateful reply.
* -param {Number} code status code
* -param {String} reason reason phrase
* -param {Object} headers extra headers
* -param {String} body body
* -param {Function} [onSuccess] onSuccess callback
* -param {Function} [onFailure] onFailure callback
*/
IncomingRequest.prototype.reply = function(code, reason, extraHeaders, body, onSuccess, onFailure) {
var rr, vias, length, idx, response,
supported = [],
to = this.getHeader('To'),
r = 0,
v = 0;
code = code || null;
reason = reason || null;
// Validate code and reason values
if (!code || (code < 100 || code > 699)) {
throw new TypeError('Invalid status_code: '+ code);
} else if (reason && typeof reason !== 'string' && !(reason instanceof String)) {
throw new TypeError('Invalid reason_phrase: '+ reason);
}
reason = reason || JsSIP_C.REASON_PHRASE[code] || '';
extraHeaders = extraHeaders && extraHeaders.slice() || [];
response = 'SIP/2.0 ' + code + ' ' + reason + '\r\n';
if(this.method === JsSIP_C.INVITE && code > 100 && code <= 200) {
rr = this.getHeaders('record-route');
length = rr.length;
for(r; r < length; r++) {
response += 'Record-Route: ' + rr[r] + '\r\n';
}
}
vias = this.getHeaders('via');
length = vias.length;
for(v; v < length; v++) {
response += 'Via: ' + vias[v] + '\r\n';
}
if(!this.to_tag && code > 100) {
to += ';tag=' + Utils.newTag();
} else if(this.to_tag && !this.s('to').hasParam('tag')) {
to += ';tag=' + this.to_tag;
}
response += 'To: ' + to + '\r\n';
response += 'From: ' + this.getHeader('From') + '\r\n';
response += 'Call-ID: ' + this.call_id + '\r\n';
response += 'CSeq: ' + this.cseq + ' ' + this.method + '\r\n';
length = extraHeaders.length;
for (idx = 0; idx < length; idx++) {
response += extraHeaders[idx].trim() +'\r\n';
}
// Supported
switch (this.method) {
case JsSIP_C.INVITE:
if (this.ua.configuration.session_timers) {
supported.push('timer');
}
if (this.ua.contact.pub_gruu || this.ua.contact.temp_gruu) {
supported.push('gruu');
}
supported.push('ice');
break;
case JsSIP_C.UPDATE:
if (this.ua.configuration.session_timers) {
supported.push('timer');
}
if (body) {
supported.push('ice');
}
}
supported.push('outbound');
// Allow and Accept
if (this.method === JsSIP_C.OPTIONS) {
response += 'Allow: '+ JsSIP_C.ALLOWED_METHODS +'\r\n';
response += 'Accept: '+ JsSIP_C.ACCEPTED_BODY_TYPES +'\r\n';
} else if (code === 405) {
response += 'Allow: '+ JsSIP_C.ALLOWED_METHODS +'\r\n';
} else if (code === 415 ) {
response += 'Accept: '+ JsSIP_C.ACCEPTED_BODY_TYPES +'\r\n';
}
response += 'Supported: ' + supported +'\r\n';
if(body) {
length = Utils.str_utf8_length(body);
response += 'Content-Type: application/sdp\r\n';
response += 'Content-Length: ' + length + '\r\n\r\n';
response += body;
} else {
response += 'Content-Length: ' + 0 + '\r\n\r\n';
}
this.server_transaction.receiveResponse(code, response, onSuccess, onFailure);
};
/**
* Stateless reply.
* -param {Number} code status code
* -param {String} reason reason phrase
*/
IncomingRequest.prototype.reply_sl = function(code, reason) {
var to, response,
v = 0,
vias = this.getHeaders('via'),
length = vias.length;
code = code || null;
reason = reason || null;
// Validate code and reason values
if (!code || (code < 100 || code > 699)) {
throw new TypeError('Invalid status_code: '+ code);
} else if (reason && typeof reason !== 'string' && !(reason instanceof String)) {
throw new TypeError('Invalid reason_phrase: '+ reason);
}
reason = reason || JsSIP_C.REASON_PHRASE[code] || '';
response = 'SIP/2.0 ' + code + ' ' + reason + '\r\n';
for(v; v < length; v++) {
response += 'Via: ' + vias[v] + '\r\n';
}
to = this.getHeader('To');
if(!this.to_tag && code > 100) {
to += ';tag=' + Utils.newTag();
} else if(this.to_tag && !this.s('to').hasParam('tag')) {
to += ';tag=' + this.to_tag;
}
response += 'To: ' + to + '\r\n';
response += 'From: ' + this.getHeader('From') + '\r\n';
response += 'Call-ID: ' + this.call_id + '\r\n';
response += 'CSeq: ' + this.cseq + ' ' + this.method + '\r\n';
response += 'Content-Length: ' + 0 + '\r\n\r\n';
this.transport.send(response);
};
function IncomingResponse() {
this.headers = {};
this.status_code = null;
this.reason_phrase = null;
}
IncomingResponse.prototype = new IncomingMessage();
},{"./Constants":1,"./Grammar":6,"./NameAddrHeader":9,"./Utils":22,"debug":29}],17:[function(require,module,exports){
var T1 = 500,
T2 = 4000,
T4 = 5000;
var Timers = {
T1: T1,
T2: T2,
T4: T4,
TIMER_B: 64 * T1,
TIMER_D: 0 * T1,
TIMER_F: 64 * T1,
TIMER_H: 64 * T1,
TIMER_I: 0 * T1,
TIMER_J: 0 * T1,
TIMER_K: 0 * T4,
TIMER_L: 64 * T1,
TIMER_M: 64 * T1,
PROVISIONAL_RESPONSE_INTERVAL: 60000 // See RFC 3261 Section 13.3.1.1
};
module.exports = Timers;
},{}],18:[function(require,module,exports){
module.exports = {
C: null,
NonInviteClientTransaction: NonInviteClientTransaction,
InviteClientTransaction: InviteClientTransaction,
AckClientTransaction: AckClientTransaction,
NonInviteServerTransaction: NonInviteServerTransaction,
InviteServerTransaction: InviteServerTransaction,
checkTransaction: checkTransaction
};
var C = {
// Transaction states
STATUS_TRYING: 1,
STATUS_PROCEEDING: 2,
STATUS_CALLING: 3,
STATUS_ACCEPTED: 4,
STATUS_COMPLETED: 5,
STATUS_TERMINATED: 6,
STATUS_CONFIRMED: 7,
// Transaction types
NON_INVITE_CLIENT: 'nict',
NON_INVITE_SERVER: 'nist',
INVITE_CLIENT: 'ict',
INVITE_SERVER: 'ist'
};
/**
* Expose C object.
*/
module.exports.C = C;
/**
* Dependencies.
*/
var util = require('util');
var events = require('events');
var debugnict = require('debug')('JsSIP:NonInviteClientTransaction');
var debugict = require('debug')('JsSIP:InviteClientTransaction');
var debugact = require('debug')('JsSIP:AckClientTransaction');
var debugnist = require('debug')('JsSIP:NonInviteServerTransaction');
var debugist = require('debug')('JsSIP:InviteServerTransaction');
var JsSIP_C = require('./Constants');
var Timers = require('./Timers');
function NonInviteClientTransaction(request_sender, request, transport) {
var via,
via_transport;
this.type = C.NON_INVITE_CLIENT;
this.transport = transport;
this.id = 'z9hG4bK' + Math.floor(Math.random() * 10000000);
this.request_sender = request_sender;
this.request = request;
if (request_sender.ua.configuration.hack_via_tcp) {
via_transport = 'TCP';
}
else if (request_sender.ua.configuration.hack_via_ws) {
via_transport = 'WS';
}
else {
via_transport = transport.server.scheme;
}
via = 'SIP/2.0/' + via_transport;
via += ' ' + request_sender.ua.configuration.via_host + ';branch=' + this.id;
this.request.setHeader('via', via);
this.request_sender.ua.newTransaction(this);
events.EventEmitter.call(this);
}
util.inherits(NonInviteClientTransaction, events.EventEmitter);
NonInviteClientTransaction.prototype.stateChanged = function(state) {
this.state = state;
this.emit('stateChanged');
};
NonInviteClientTransaction.prototype.send = function() {
var tr = this;
this.stateChanged(C.STATUS_TRYING);
this.F = setTimeout(function() {tr.timer_F();}, Timers.TIMER_F);
if(!this.transport.send(this.request)) {
this.onTransportError();
}
};
NonInviteClientTransaction.prototype.onTransportError = function() {
debugnict('transport error occurred, deleting transaction ' + this.id);
clearTimeout(this.F);
clearTimeout(this.K);
this.stateChanged(C.STATUS_TERMINATED);
this.request_sender.ua.destroyTransaction(this);
this.request_sender.onTransportError();
};
NonInviteClientTransaction.prototype.timer_F = function() {
debugnict('Timer F expired for transaction ' + this.id);
this.stateChanged(C.STATUS_TERMINATED);
this.request_sender.ua.destroyTransaction(this);
this.request_sender.onRequestTimeout();
};
NonInviteClientTransaction.prototype.timer_K = function() {
this.stateChanged(C.STATUS_TERMINATED);
this.request_sender.ua.destroyTransaction(this);
};
NonInviteClientTransaction.prototype.receiveResponse = function(response) {
var
tr = this,
status_code = response.status_code;
if(status_code < 200) {
switch(this.state) {
case C.STATUS_TRYING:
case C.STATUS_PROCEEDING:
this.stateChanged(C.STATUS_PROCEEDING);
this.request_sender.receiveResponse(response);
break;
}
} else {
switch(this.state) {
case C.STATUS_TRYING:
case C.STATUS_PROCEEDING:
this.stateChanged(C.STATUS_COMPLETED);
clearTimeout(this.F);
if(status_code === 408) {
this.request_sender.onRequestTimeout();
} else {
this.request_sender.receiveResponse(response);
}
this.K = setTimeout(function() {tr.timer_K();}, Timers.TIMER_K);
break;
case C.STATUS_COMPLETED:
break;
}
}
};
function InviteClientTransaction(request_sender, request, transport) {
var via,
tr = this,
via_transport;
this.type = C.INVITE_CLIENT;
this.transport = transport;
this.id = 'z9hG4bK' + Math.floor(Math.random() * 10000000);
this.request_sender = request_sender;
this.request = request;
if (request_sender.ua.configuration.hack_via_tcp) {
via_transport = 'TCP';
}
else if (request_sender.ua.configuration.hack_via_ws) {
via_transport = 'WS';
}
else {
via_transport = transport.server.scheme;
}
via = 'SIP/2.0/' + via_transport;
via += ' ' + request_sender.ua.configuration.via_host + ';branch=' + this.id;
this.request.setHeader('via', via);
this.request_sender.ua.newTransaction(this);
// TODO: Adding here the cancel() method is a hack that must be fixed.
// Add the cancel property to the request.
//Will be called from the request instance, not the transaction itself.
this.request.cancel = function(reason) {
tr.cancel_request(tr, reason);
};
events.EventEmitter.call(this);
}
util.inherits(InviteClientTransaction, events.EventEmitter);
InviteClientTransaction.prototype.stateChanged = function(state) {
this.state = state;
this.emit('stateChanged');
};
InviteClientTransaction.prototype.send = function() {
var tr = this;
this.stateChanged(C.STATUS_CALLING);
this.B = setTimeout(function() {
tr.timer_B();
}, Timers.TIMER_B);
if(!this.transport.send(this.request)) {
this.onTransportError();
}
};
InviteClientTransaction.prototype.onTransportError = function() {
clearTimeout(this.B);
clearTimeout(this.D);
clearTimeout(this.M);
if (this.state !== C.STATUS_ACCEPTED) {
debugict('transport error occurred, deleting transaction ' + this.id);
this.request_sender.onTransportError();
}
this.stateChanged(C.STATUS_TERMINATED);
this.request_sender.ua.destroyTransaction(this);
};
// RFC 6026 7.2
InviteClientTransaction.prototype.timer_M = function() {
debugict('Timer M expired for transaction ' + this.id);
if(this.state === C.STATUS_ACCEPTED) {
clearTimeout(this.B);
this.stateChanged(C.STATUS_TERMINATED);
this.request_sender.ua.destroyTransaction(this);
}
};
// RFC 3261 17.1.1
InviteClientTransaction.prototype.timer_B = function() {
debugict('Timer B expired for transaction ' + this.id);
if(this.state === C.STATUS_CALLING) {
this.stateChanged(C.STATUS_TERMINATED);
this.request_sender.ua.destroyTransaction(this);
this.request_sender.onRequestTimeout();
}
};
InviteClientTransaction.prototype.timer_D = function() {
debugict('Timer D expired for transaction ' + this.id);
clearTimeout(this.B);
this.stateChanged(C.STATUS_TERMINATED);
this.request_sender.ua.destroyTransaction(this);
};
InviteClientTransaction.prototype.sendACK = function(response) {
var tr = this;
this.ack = 'ACK ' + this.request.ruri + ' SIP/2.0\r\n';
this.ack += 'Via: ' + this.request.headers.Via.toString() + '\r\n';
if(this.request.headers.Route) {
this.ack += 'Route: ' + this.request.headers.Route.toString() + '\r\n';
}
this.ack += 'To: ' + response.getHeader('to') + '\r\n';
this.ack += 'From: ' + this.request.headers.From.toString() + '\r\n';
this.ack += 'Call-ID: ' + this.request.headers['Call-ID'].toString() + '\r\n';
this.ack += 'CSeq: ' + this.request.headers.CSeq.toString().split(' ')[0];
this.ack += ' ACK\r\n';
this.ack += 'Content-Length: 0\r\n\r\n';
this.D = setTimeout(function() {tr.timer_D();}, Timers.TIMER_D);
this.transport.send(this.ack);
};
InviteClientTransaction.prototype.cancel_request = function(tr, reason) {
var request = tr.request;
this.cancel = JsSIP_C.CANCEL + ' ' + request.ruri + ' SIP/2.0\r\n';
this.cancel += 'Via: ' + request.headers.Via.toString() + '\r\n';
if(this.request.headers.Route) {
this.cancel += 'Route: ' + request.headers.Route.toString() + '\r\n';
}
this.cancel += 'To: ' + request.headers.To.toString() + '\r\n';
this.cancel += 'From: ' + request.headers.From.toString() + '\r\n';
this.cancel += 'Call-ID: ' + request.headers['Call-ID'].toString() + '\r\n';
this.cancel += 'CSeq: ' + request.headers.CSeq.toString().split(' ')[0] +
' CANCEL\r\n';
if(reason) {
this.cancel += 'Reason: ' + reason + '\r\n';
}
this.cancel += 'Content-Length: 0\r\n\r\n';
// Send only if a provisional response (>100) has been received.
if(this.state === C.STATUS_PROCEEDING) {
this.transport.send(this.cancel);
}
};
InviteClientTransaction.prototype.receiveResponse = function(response) {
var
tr = this,
status_code = response.status_code;
if(status_code >= 100 && status_code <= 199) {
switch(this.state) {
case C.STATUS_CALLING:
this.stateChanged(C.STATUS_PROCEEDING);
this.request_sender.receiveResponse(response);
break;
case C.STATUS_PROCEEDING:
this.request_sender.receiveResponse(response);
break;
}
} else if(status_code >= 200 && status_code <= 299) {
switch(this.state) {
case C.STATUS_CALLING:
case C.STATUS_PROCEEDING:
this.stateChanged(C.STATUS_ACCEPTED);
this.M = setTimeout(function() {
tr.timer_M();
}, Timers.TIMER_M);
this.request_sender.receiveResponse(response);
break;
case C.STATUS_ACCEPTED:
this.request_sender.receiveResponse(response);
break;
}
} else if(status_code >= 300 && status_code <= 699) {
switch(this.state) {
case C.STATUS_CALLING:
case C.STATUS_PROCEEDING:
this.stateChanged(C.STATUS_COMPLETED);
this.sendACK(response);
this.request_sender.receiveResponse(response);
break;
case C.STATUS_COMPLETED:
this.sendACK(response);
break;
}
}
};
function AckClientTransaction(request_sender, request, transport) {
var via,
via_transport;
this.transport = transport;
this.id = 'z9hG4bK' + Math.floor(Math.random() * 10000000);
this.request_sender = request_sender;
this.request = request;
if (request_sender.ua.configuration.hack_via_tcp) {
via_transport = 'TCP';
}
else if (request_sender.ua.configuration.hack_via_ws) {
via_transport = 'WS';
}
else {
via_transport = transport.server.scheme;
}
via = 'SIP/2.0/' + via_transport;
via += ' ' + request_sender.ua.configuration.via_host + ';branch=' + this.id;
this.request.setHeader('via', via);
events.EventEmitter.call(this);
}
util.inherits(AckClientTransaction, events.EventEmitter);
AckClientTransaction.prototype.send = function() {
if(!this.transport.send(this.request)) {
this.onTransportError();
}
};
AckClientTransaction.prototype.onTransportError = function() {
debugact('transport error occurred for transaction ' + this.id);
this.request_sender.onTransportError();
};
function NonInviteServerTransaction(request, ua) {
this.type = C.NON_INVITE_SERVER;
this.id = request.via_branch;
this.request = request;
this.transport = request.transport;
this.ua = ua;
this.last_response = '';
request.server_transaction = this;
this.state = C.STATUS_TRYING;
ua.newTransaction(this);
events.EventEmitter.call(this);
}
util.inherits(NonInviteServerTransaction, events.EventEmitter);
NonInviteServerTransaction.prototype.stateChanged = function(state) {
this.state = state;
this.emit('stateChanged');
};
NonInviteServerTransaction.prototype.timer_J = function() {
debugnist('Timer J expired for transaction ' + this.id);
this.stateChanged(C.STATUS_TERMINATED);
this.ua.destroyTransaction(this);
};
NonInviteServerTransaction.prototype.onTransportError = function() {
if (!this.transportError) {
this.transportError = true;
debugnist('transport error occurred, deleting transaction ' + this.id);
clearTimeout(this.J);
this.stateChanged(C.STATUS_TERMINATED);
this.ua.destroyTransaction(this);
}
};
NonInviteServerTransaction.prototype.receiveResponse = function(status_code, response, onSuccess, onFailure) {
var tr = this;
if(status_code === 100) {
/* RFC 4320 4.1
* 'A SIP element MUST NOT
* send any provisional response with a
* Status-Code other than 100 to a non-INVITE request.'
*/
switch(this.state) {
case C.STATUS_TRYING:
this.stateChanged(C.STATUS_PROCEEDING);
if(!this.transport.send(response)) {
this.onTransportError();
}
break;
case C.STATUS_PROCEEDING:
this.last_response = response;
if(!this.transport.send(response)) {
this.onTransportError();
if (onFailure) {
onFailure();
}
} else if (onSuccess) {
onSuccess();
}
break;
}
} else if(status_code >= 200 && status_code <= 699) {
switch(this.state) {
case C.STATUS_TRYING:
case C.STATUS_PROCEEDING:
this.stateChanged(C.STATUS_COMPLETED);
this.last_response = response;
this.J = setTimeout(function() {
tr.timer_J();
}, Timers.TIMER_J);
if(!this.transport.send(response)) {
this.onTransportError();
if (onFailure) {
onFailure();
}
} else if (onSuccess) {
onSuccess();
}
break;
case C.STATUS_COMPLETED:
break;
}
}
};
function InviteServerTransaction(request, ua) {
this.type = C.INVITE_SERVER;
this.id = request.via_branch;
this.request = request;
this.transport = request.transport;
this.ua = ua;
this.last_response = '';
request.server_transaction = this;
this.state = C.STATUS_PROCEEDING;
ua.newTransaction(this);
this.resendProvisionalTimer = null;
request.reply(100);
events.EventEmitter.call(this);
}
util.inherits(InviteServerTransaction, events.EventEmitter);
InviteServerTransaction.prototype.stateChanged = function(state) {
this.state = state;
this.emit('stateChanged');
};
InviteServerTransaction.prototype.timer_H = function() {
debugist('Timer H expired for transaction ' + this.id);
if(this.state === C.STATUS_COMPLETED) {
debugist('ACK not received, dialog will be terminated');
}
this.stateChanged(C.STATUS_TERMINATED);
this.ua.destroyTransaction(this);
};
InviteServerTransaction.prototype.timer_I = function() {
this.stateChanged(C.STATUS_TERMINATED);
};
// RFC 6026 7.1
InviteServerTransaction.prototype.timer_L = function() {
debugist('Timer L expired for transaction ' + this.id);
if(this.state === C.STATUS_ACCEPTED) {
this.stateChanged(C.STATUS_TERMINATED);
this.ua.destroyTransaction(this);
}
};
InviteServerTransaction.prototype.onTransportError = function() {
if (!this.transportError) {
this.transportError = true;
debugist('transport error occurred, deleting transaction ' + this.id);
if (this.resendProvisionalTimer !== null) {
clearInterval(this.resendProvisionalTimer);
this.resendProvisionalTimer = null;
}
clearTimeout(this.L);
clearTimeout(this.H);
clearTimeout(this.I);
this.stateChanged(C.STATUS_TERMINATED);
this.ua.destroyTransaction(this);
}
};
InviteServerTransaction.prototype.resend_provisional = function() {
if(!this.transport.send(this.last_response)) {
this.onTransportError();
}
};
// INVITE Server Transaction RFC 3261 17.2.1
InviteServerTransaction.prototype.receiveResponse = function(status_code, response, onSuccess, onFailure) {
var tr = this;
if(status_code >= 100 && status_code <= 199) {
switch(this.state) {
case C.STATUS_PROCEEDING:
if(!this.transport.send(response)) {
this.onTransportError();
}
this.last_response = response;
break;
}
}
if(status_code > 100 && status_code <= 199 && this.state === C.STATUS_PROCEEDING) {
// Trigger the resendProvisionalTimer only for the first non 100 provisional response.
if(this.resendProvisionalTimer === null) {
this.resendProvisionalTimer = setInterval(function() {
tr.resend_provisional();}, Timers.PROVISIONAL_RESPONSE_INTERVAL);
}
} else if(status_code >= 200 && status_code <= 299) {
switch(this.state) {
case C.STATUS_PROCEEDING:
this.stateChanged(C.STATUS_ACCEPTED);
this.last_response = response;
this.L = setTimeout(function() {
tr.timer_L();
}, Timers.TIMER_L);
if (this.resendProvisionalTimer !== null) {
clearInterval(this.resendProvisionalTimer);
this.resendProvisionalTimer = null;
}
/* falls through */
case C.STATUS_ACCEPTED:
// Note that this point will be reached for proceeding tr.state also.
if(!this.transport.send(response)) {
this.onTransportError();
if (onFailure) {
onFailure();
}
} else if (onSuccess) {
onSuccess();
}
break;
}
} else if(status_code >= 300 && status_code <= 699) {
switch(this.state) {
case C.STATUS_PROCEEDING:
if (this.resendProvisionalTimer !== null) {
clearInterval(this.resendProvisionalTimer);
this.resendProvisionalTimer = null;
}
if(!this.transport.send(response)) {
this.onTransportError();
if (onFailure) {
onFailure();
}
} else {
this.stateChanged(C.STATUS_COMPLETED);
this.H = setTimeout(function() {
tr.timer_H();
}, Timers.TIMER_H);
if (onSuccess) {
onSuccess();
}
}
break;
}
}
};
/**
* INVITE:
* _true_ if retransmission
* _false_ new request
*
* ACK:
* _true_ ACK to non2xx response
* _false_ ACK must be passed to TU (accepted state)
* ACK to 2xx response
*
* CANCEL:
* _true_ no matching invite transaction
* _false_ matching invite transaction and no final response sent
*
* OTHER:
* _true_ retransmission
* _false_ new request
*/
function checkTransaction(ua, request) {
var tr;
switch(request.method) {
case JsSIP_C.INVITE:
tr = ua.transactions.ist[request.via_branch];
if(tr) {
switch(tr.state) {
case C.STATUS_PROCEEDING:
tr.transport.send(tr.last_response);
break;
// RFC 6026 7.1 Invite retransmission
//received while in C.STATUS_ACCEPTED state. Absorb it.
case C.STATUS_ACCEPTED:
break;
}
return true;
}
break;
case JsSIP_C.ACK:
tr = ua.transactions.ist[request.via_branch];
// RFC 6026 7.1
if(tr) {
if(tr.state === C.STATUS_ACCEPTED) {
return false;
} else if(tr.state === C.STATUS_COMPLETED) {
tr.state = C.STATUS_CONFIRMED;
tr.I = setTimeout(function() {tr.timer_I();}, Timers.TIMER_I);
return true;
}
}
// ACK to 2XX Response.
else {
return false;
}
break;
case JsSIP_C.CANCEL:
tr = ua.transactions.ist[request.via_branch];
if(tr) {
request.reply_sl(200);
if(tr.state === C.STATUS_PROCEEDING) {
return false;
} else {
return true;
}
} else {
request.reply_sl(481);
return true;
}
break;
default:
// Non-INVITE Server Transaction RFC 3261 17.2.2
tr = ua.transactions.nist[request.via_branch];
if(tr) {
switch(tr.state) {
case C.STATUS_TRYING:
break;
case C.STATUS_PROCEEDING:
case C.STATUS_COMPLETED:
tr.transport.send(tr.last_response);
break;
}
return true;
}
break;
}
}
},{"./Constants":1,"./Timers":17,"debug":29,"events":24,"util":28}],19:[function(require,module,exports){
module.exports = Transport;
var C = {
// Transport status codes
STATUS_READY: 0,
STATUS_DISCONNECTED: 1,
STATUS_ERROR: 2
};
/**
* Expose C object.
*/
Transport.C = C;
/**
* Dependencies.
*/
var debug = require('debug')('JsSIP:Transport');
var JsSIP_C = require('./Constants');
var Parser = require('./Parser');
var UA = require('./UA');
var SIPMessage = require('./SIPMessage');
var sanityCheck = require('./sanityCheck');
// 'websocket' module uses the native WebSocket interface when bundled to run in a browser.
var W3CWebSocket = require('websocket').w3cwebsocket;
function Transport(ua, server) {
this.ua = ua;
this.ws = null;
this.server = server;
this.reconnection_attempts = 0;
this.closed = false;
this.connected = false;
this.reconnectTimer = null;
this.lastTransportError = {};
/**
* Options for the Node "websocket" library.
*/
this.node_websocket_options = this.ua.configuration.node_websocket_options || {};
// Add our User-Agent header.
this.node_websocket_options.headers = this.node_websocket_options.headers || {};
this.node_websocket_options.headers['User-Agent'] = JsSIP_C.USER_AGENT;
}
Transport.prototype = {
/**
* Connect socket.
*/
connect: function() {
var transport = this;
if(this.ws && (this.ws.readyState === this.ws.OPEN || this.ws.readyState === this.ws.CONNECTING)) {
debug('WebSocket ' + this.server.ws_uri + ' is already connected');
return false;
}
if(this.ws) {
this.ws.close();
}
debug('connecting to WebSocket ' + this.server.ws_uri);
this.ua.onTransportConnecting(this,
(this.reconnection_attempts === 0)?1:this.reconnection_attempts);
try {
this.ws = new W3CWebSocket(this.server.ws_uri, 'sip', this.node_websocket_options.origin, this.node_websocket_options.headers, this.node_websocket_options.requestOptions, this.node_websocket_options.clientConfig);
this.ws.binaryType = 'arraybuffer';
this.ws.onopen = function() {
transport.onOpen();
};
this.ws.onclose = function(e) {
transport.onClose(e);
};
this.ws.onmessage = function(e) {
transport.onMessage(e);
};
this.ws.onerror = function(e) {
transport.onError(e);
};
} catch(e) {
debug('error connecting to WebSocket ' + this.server.ws_uri + ': ' + e);
this.lastTransportError.code = null;
this.lastTransportError.reason = e.message;
this.ua.onTransportError(this);
}
},
/**
* Disconnect socket.
*/
disconnect: function() {
if(this.ws) {
// Clear reconnectTimer
clearTimeout(this.reconnectTimer);
// TODO: should make this.reconnectTimer = null here?
this.closed = true;
debug('closing WebSocket ' + this.server.ws_uri);
this.ws.close();
}
// TODO: Why this??
if (this.reconnectTimer !== null) {
clearTimeout(this.reconnectTimer);
this.reconnectTimer = null;
this.ua.onTransportDisconnected({
transport: this,
code: this.lastTransportError.code,
reason: this.lastTransportError.reason
});
}
},
/**
* Send a message.
*/
send: function(msg) {
var message = msg.toString();
if(this.ws && this.ws.readyState === this.ws.OPEN) {
debug('sending WebSocket message:\n\n' + message + '\n');
this.ws.send(message);
return true;
} else {
debug('unable to send message, WebSocket is not open');
return false;
}
},
// Transport Event Handlers
onOpen: function() {
this.connected = true;
debug('WebSocket ' + this.server.ws_uri + ' connected');
// Clear reconnectTimer since we are not disconnected
if (this.reconnectTimer !== null) {
clearTimeout(this.reconnectTimer);
this.reconnectTimer = null;
}
// Reset reconnection_attempts
this.reconnection_attempts = 0;
// Disable closed
this.closed = false;
// Trigger onTransportConnected callback
this.ua.onTransportConnected(this);
},
onClose: function(e) {
var connected_before = this.connected;
this.connected = false;
this.lastTransportError.code = e.code;
this.lastTransportError.reason = e.reason;
debug('WebSocket disconnected (code: ' + e.code + (e.reason? '| reason: ' + e.reason : '') +')');
if(e.wasClean === false) {
debug('WebSocket abrupt disconnection');
}
// Transport was connected
if (connected_before === true) {
this.ua.onTransportClosed(this);
// Check whether the user requested to close.
if(!this.closed) {
this.reConnect();
}
} else {
// This is the first connection attempt
// May be a network error (or may be UA.stop() was called)
this.ua.onTransportError(this);
}
},
onMessage: function(e) {
var message, transaction,
data = e.data;
// CRLF Keep Alive response from server. Ignore it.
if(data === '\r\n') {
debug('received WebSocket message with CRLF Keep Alive response');
return;
}
// WebSocket binary message.
else if (typeof data !== 'string') {
try {
data = String.fromCharCode.apply(null, new Uint8Array(data));
} catch(evt) {
debug('received WebSocket binary message failed to be converted into string, message discarded');
return;
}
debug('received WebSocket binary message:\n\n' + data + '\n');
}
// WebSocket text message.
else {
debug('received WebSocket text message:\n\n' + data + '\n');
}
message = Parser.parseMessage(data, this.ua);
if (! message) {
return;
}
if(this.ua.status === UA.C.STATUS_USER_CLOSED && message instanceof SIPMessage.IncomingRequest) {
return;
}
// Do some sanity check
if(! sanityCheck(message, this.ua, this)) {
return;
}
if(message instanceof SIPMessage.IncomingRequest) {
message.transport = this;
this.ua.receiveRequest(message);
} else if(message instanceof SIPMessage.IncomingResponse) {
/* Unike stated in 18.1.2, if a response does not match
* any transaction, it is discarded here and no passed to the core
* in order to be discarded there.
*/
switch(message.method) {
case JsSIP_C.INVITE:
transaction = this.ua.transactions.ict[message.via_branch];
if(transaction) {
transaction.receiveResponse(message);
}
break;
case JsSIP_C.ACK:
// Just in case ;-)
break;
default:
transaction = this.ua.transactions.nict[message.via_branch];
if(transaction) {
transaction.receiveResponse(message);
}
break;
}
}
},
onError: function(e) {
debug('WebSocket connection error: %o', e);
},
/**
* Reconnection attempt logic.
*/
reConnect: function() {
var transport = this;
this.reconnection_attempts += 1;
if(this.reconnection_attempts > this.ua.configuration.ws_server_max_reconnection) {
debug('maximum reconnection attempts for WebSocket ' + this.server.ws_uri);
this.ua.onTransportError(this);
} else {
debug('trying to reconnect to WebSocket ' + this.server.ws_uri + ' (reconnection attempt ' + this.reconnection_attempts + ')');
this.reconnectTimer = setTimeout(function() {
transport.connect();
transport.reconnectTimer = null;
}, this.ua.configuration.ws_server_reconnection_timeout * 1000);
}
}
};
},{"./Constants":1,"./Parser":10,"./SIPMessage":16,"./UA":20,"./sanityCheck":23,"debug":29,"websocket":43}],20:[function(require,module,exports){
module.exports = UA;
var C = {
// UA status codes
STATUS_INIT : 0,
STATUS_READY: 1,
STATUS_USER_CLOSED: 2,
STATUS_NOT_READY: 3,
// UA error codes
CONFIGURATION_ERROR: 1,
NETWORK_ERROR: 2
};
/**
* Expose C object.
*/
UA.C = C;
/**
* Dependencies.
*/
var util = require('util');
var events = require('events');
var debug = require('debug')('JsSIP:UA');
var rtcninja = require('rtcninja');
var JsSIP_C = require('./Constants');
var Registrator = require('./Registrator');
var RTCSession = require('./RTCSession');
var Message = require('./Message');
var Transport = require('./Transport');
var Transactions = require('./Transactions');
var Transactions = require('./Transactions');
var Utils = require('./Utils');
var Exceptions = require('./Exceptions');
var URI = require('./URI');
var Grammar = require('./Grammar');
/**
* The User-Agent class.
* @class JsSIP.UA
* @param {Object} configuration Configuration parameters.
* @throws {JsSIP.Exceptions.ConfigurationError} If a configuration parameter is invalid.
* @throws {TypeError} If no configuration is given.
*/
function UA(configuration) {
this.cache = {
credentials: {}
};
this.configuration = {};
this.dynConfiguration = {};
this.dialogs = {};
//User actions outside any session/dialog (MESSAGE)
this.applicants = {};
this.sessions = {};
this.transport = null;
this.contact = null;
this.status = C.STATUS_INIT;
this.error = null;
this.transactions = {
nist: {},
nict: {},
ist: {},
ict: {}
};
// Custom UA empty object for high level use
this.data = {};
this.transportRecoverAttempts = 0;
this.transportRecoveryTimer = null;
Object.defineProperties(this, {
transactionsCount: {
get: function() {
var type,
transactions = ['nist','nict','ist','ict'],
count = 0;
for (type in transactions) {
count += Object.keys(this.transactions[transactions[type]]).length;
}
return count;
}
},
nictTransactionsCount: {
get: function() {
return Object.keys(this.transactions.nict).length;
}
},
nistTransactionsCount: {
get: function() {
return Object.keys(this.transactions.nist).length;
}
},
ictTransactionsCount: {
get: function() {
return Object.keys(this.transactions.ict).length;
}
},
istTransactionsCount: {
get: function() {
return Object.keys(this.transactions.ist).length;
}
}
});
/**
* Load configuration
*/
if(configuration === undefined) {
throw new TypeError('Not enough arguments');
}
try {
this.loadConfig(configuration);
} catch(e) {
this.status = C.STATUS_NOT_READY;
this.error = C.CONFIGURATION_ERROR;
throw e;
}
// Initialize registrator
this._registrator = new Registrator(this);
events.EventEmitter.call(this);
// Initialize rtcninja if not yet done.
if (! rtcninja.called) {
rtcninja();
}
}
util.inherits(UA, events.EventEmitter);
//=================
// High Level API
//=================
/**
* Connect to the WS server if status = STATUS_INIT.
* Resume UA after being closed.
*/
UA.prototype.start = function() {
debug('start()');
var server;
if (this.status === C.STATUS_INIT) {
server = this.getNextWsServer();
this.transport = new Transport(this, server);
this.transport.connect();
} else if(this.status === C.STATUS_USER_CLOSED) {
debug('restarting UA');
this.status = C.STATUS_READY;
this.transport.connect();
} else if (this.status === C.STATUS_READY) {
debug('UA is in READY status, not restarted');
} else {
debug('ERROR: connection is down, Auto-Recovery system is trying to reconnect');
}
// Set dynamic configuration.
this.dynConfiguration.register = this.configuration.register;
};
/**
* Register.
*/
UA.prototype.register = function() {
debug('register()');
this.dynConfiguration.register = true;
this._registrator.register();
};
/**
* Unregister.
*/
UA.prototype.unregister = function(options) {
debug('unregister()');
this.dynConfiguration.register = false;
this._registrator.unregister(options);
};
/**
* Get the Registrator instance.
*/
UA.prototype.registrator = function() {
return this._registrator;
};
/**
* Registration state.
*/
UA.prototype.isRegistered = function() {
if(this._registrator.registered) {
return true;
} else {
return false;
}
};
/**
* Connection state.
*/
UA.prototype.isConnected = function() {
if(this.transport) {
return this.transport.connected;
} else {
return false;
}
};
/**
* Make an outgoing call.
*
* -param {String} target
* -param {Object} views
* -param {Object} [options]
*
* -throws {TypeError}
*
*/
UA.prototype.call = function(target, options) {
debug('call()');
var session;
session = new RTCSession(this);
session.connect(target, options);
return session;
};
/**
* Send a message.
*
* -param {String} target
* -param {String} body
* -param {Object} [options]
*
* -throws {TypeError}
*
*/
UA.prototype.sendMessage = function(target, body, options) {
debug('sendMessage()');
var message;
message = new Message(this);
message.send(target, body, options);
return message;
};
/**
* Terminate ongoing sessions.
*/
UA.prototype.terminateSessions = function(options) {
debug('terminateSessions()');
for(var idx in this.sessions) {
if (!this.sessions[idx].isEnded()) {
this.sessions[idx].terminate(options);
}
}
};
/**
* Gracefully close.
*
*/
UA.prototype.stop = function() {
debug('stop()');
var session;
var applicant;
var num_sessions;
var ua = this;
// Remove dynamic settings.
this.dynConfiguration = {};
if(this.status === C.STATUS_USER_CLOSED) {
debug('UA already closed');
return;
}
// Clear transportRecoveryTimer
clearTimeout(this.transportRecoveryTimer);
// Close registrator
this._registrator.close();
// If there are session wait a bit so CANCEL/BYE can be sent and their responses received.
num_sessions = Object.keys(this.sessions).length;
// Run _terminate_ on every Session
for(session in this.sessions) {
debug('closing session ' + session);
try { this.sessions[session].terminate(); } catch(error) {}
}
// Run _close_ on every applicant
for(applicant in this.applicants) {
try { this.applicants[applicant].close(); } catch(error) {}
}
this.status = C.STATUS_USER_CLOSED;
// If there are no pending non-INVITE client or server transactions and no
// sessions, then disconnect now. Otherwise wait for 2 seconds.
// TODO: This fails if sotp() is called once an outgoing is cancelled (no time
// to send ACK for 487), so leave 2 seconds until properly re-designed.
// if (this.nistTransactionsCount === 0 && this.nictTransactionsCount === 0 && num_sessions === 0) {
// ua.transport.disconnect();
// }
// else {
setTimeout(function() {
ua.transport.disconnect();
}, 2000);
// }
};
/**
* Normalice a string into a valid SIP request URI
* -param {String} target
* -returns {JsSIP.URI|undefined}
*/
UA.prototype.normalizeTarget = function(target) {
return Utils.normalizeTarget(target, this.configuration.hostport_params);
};
//===============================
// Private (For internal use)
//===============================
UA.prototype.saveCredentials = function(credentials) {
this.cache.credentials[credentials.realm] = this.cache.credentials[credentials.realm] || {};
this.cache.credentials[credentials.realm][credentials.uri] = credentials;
};
UA.prototype.getCredentials = function(request) {
var realm, credentials;
realm = request.ruri.host;
if (this.cache.credentials[realm] && this.cache.credentials[realm][request.ruri]) {
credentials = this.cache.credentials[realm][request.ruri];
credentials.method = request.method;
}
return credentials;
};
//==========================
// Event Handlers
//==========================
/**
* Transport Close event.
*/
UA.prototype.onTransportClosed = function(transport) {
// Run _onTransportError_ callback on every client transaction using _transport_
var type, idx, length,
client_transactions = ['nict', 'ict', 'nist', 'ist'];
transport.server.status = Transport.C.STATUS_DISCONNECTED;
length = client_transactions.length;
for (type = 0; type < length; type++) {
for(idx in this.transactions[client_transactions[type]]) {
this.transactions[client_transactions[type]][idx].onTransportError();
}
}
this.emit('disconnected', {
transport: transport,
code: transport.lastTransportError.code,
reason: transport.lastTransportError.reason
});
};
/**
* Unrecoverable transport event.
* Connection reattempt logic has been done and didn't success.
*/
UA.prototype.onTransportError = function(transport) {
var server;
debug('transport ' + transport.server.ws_uri + ' failed | connection state set to '+ Transport.C.STATUS_ERROR);
// Close sessions.
// Mark this transport as 'down' and try the next one
transport.server.status = Transport.C.STATUS_ERROR;
this.emit('disconnected', {
transport: transport,
code: transport.lastTransportError.code,
reason: transport.lastTransportError.reason
});
// Don't attempt to recover the connection if the user closes the UA.
if (this.status === C.STATUS_USER_CLOSED) {
return;
}
server = this.getNextWsServer();
if(server) {
this.transport = new Transport(this, server);
this.transport.connect();
} else {
this.closeSessionsOnTransportError();
if (!this.error || this.error !== C.NETWORK_ERROR) {
this.status = C.STATUS_NOT_READY;
this.error = C.NETWORK_ERROR;
}
// Transport Recovery process
this.recoverTransport();
}
};
/**
* Transport connection event.
*/
UA.prototype.onTransportConnected = function(transport) {
this.transport = transport;
// Reset transport recovery counter
this.transportRecoverAttempts = 0;
transport.server.status = Transport.C.STATUS_READY;
if(this.status === C.STATUS_USER_CLOSED) {
return;
}
this.status = C.STATUS_READY;
this.error = null;
this.emit('connected', {
transport: transport
});
if(this.dynConfiguration.register) {
this._registrator.register();
}
};
/**
* Transport connecting event
*/
UA.prototype.onTransportConnecting = function(transport, attempts) {
this.emit('connecting', {
transport: transport,
attempts: attempts
});
};
/**
* Transport connected event
*/
UA.prototype.onTransportDisconnected = function(data) {
this.emit('disconnected', data);
};
/**
* new Transaction
*/
UA.prototype.newTransaction = function(transaction) {
this.transactions[transaction.type][transaction.id] = transaction;
this.emit('newTransaction', {
transaction: transaction
});
};
/**
* Transaction destroyed.
*/
UA.prototype.destroyTransaction = function(transaction) {
delete this.transactions[transaction.type][transaction.id];
this.emit('transactionDestroyed', {
transaction: transaction
});
};
/**
* new Message
*/
UA.prototype.newMessage = function(data) {
this.emit('newMessage', data);
};
/**
* new RTCSession
*/
UA.prototype.newRTCSession = function(data) {
this.emit('newRTCSession', data);
};
/**
* Registered
*/
UA.prototype.registered = function(data) {
this.emit('registered', data);
};
/**
* Unregistered
*/
UA.prototype.unregistered = function(data) {
this.emit('unregistered', data);
};
/**
* Registration Failed
*/
UA.prototype.registrationFailed = function(data) {
this.emit('registrationFailed', data);
};
//=========================
// receiveRequest
//=========================
/**
* Request reception
*/
UA.prototype.receiveRequest = function(request) {
var dialog, session, message,
method = request.method;
// Check that request URI points to us
if(request.ruri.user !== this.configuration.uri.user && request.ruri.user !== this.contact.uri.user) {
debug('Request-URI does not point to us');
if (request.method !== JsSIP_C.ACK) {
request.reply_sl(404);
}
return;
}
// Check request URI scheme
if(request.ruri.scheme === JsSIP_C.SIPS) {
request.reply_sl(416);
return;
}
// Check transaction
if(Transactions.checkTransaction(this, request)) {
return;
}
// Create the server transaction
if(method === JsSIP_C.INVITE) {
new Transactions.InviteServerTransaction(request, this);
} else if(method !== JsSIP_C.ACK && method !== JsSIP_C.CANCEL) {
new Transactions.NonInviteServerTransaction(request, this);
}
/* RFC3261 12.2.2
* Requests that do not change in any way the state of a dialog may be
* received within a dialog (for example, an OPTIONS request).
* They are processed as if they had been received outside the dialog.
*/
if(method === JsSIP_C.OPTIONS) {
request.reply(200);
} else if (method === JsSIP_C.MESSAGE) {
if (this.listeners('newMessage').length === 0) {
request.reply(405);
return;
}
message = new Message(this);
message.init_incoming(request);
} else if (method === JsSIP_C.INVITE) {
// Initial INVITE
if(!request.to_tag && this.listeners('newRTCSession').length === 0) {
request.reply(405);
return;
}
}
// Initial Request
if(!request.to_tag) {
switch(method) {
case JsSIP_C.INVITE:
if (rtcninja.hasWebRTC()) {
session = new RTCSession(this);
session.init_incoming(request);
} else {
debug('INVITE received but WebRTC is not supported');
request.reply(488);
}
break;
case JsSIP_C.BYE:
// Out of dialog BYE received
request.reply(481);
break;
case JsSIP_C.CANCEL:
session = this.findSession(request);
if (session) {
session.receiveRequest(request);
} else {
debug('received CANCEL request for a non existent session');
}
break;
case JsSIP_C.ACK:
/* Absorb it.
* ACK request without a corresponding Invite Transaction
* and without To tag.
*/
break;
default:
request.reply(405);
break;
}
}
// In-dialog request
else {
dialog = this.findDialog(request);
if(dialog) {
dialog.receiveRequest(request);
} else if (method === JsSIP_C.NOTIFY) {
session = this.findSession(request);
if(session) {
session.receiveRequest(request);
} else {
debug('received NOTIFY request for a non existent subscription');
request.reply(481, 'Subscription does not exist');
}
}
/* RFC3261 12.2.2
* Request with to tag, but no matching dialog found.
* Exception: ACK for an Invite request for which a dialog has not
* been created.
*/
else {
if(method !== JsSIP_C.ACK) {
request.reply(481);
}
}
}
};
//=================
// Utils
//=================
/**
* Get the session to which the request belongs to, if any.
*/
UA.prototype.findSession = function(request) {
var
sessionIDa = request.call_id + request.from_tag,
sessionA = this.sessions[sessionIDa],
sessionIDb = request.call_id + request.to_tag,
sessionB = this.sessions[sessionIDb];
if(sessionA) {
return sessionA;
} else if(sessionB) {
return sessionB;
} else {
return null;
}
};
/**
* Get the dialog to which the request belongs to, if any.
*/
UA.prototype.findDialog = function(request) {
var
id = request.call_id + request.from_tag + request.to_tag,
dialog = this.dialogs[id];
if(dialog) {
return dialog;
} else {
id = request.call_id + request.to_tag + request.from_tag;
dialog = this.dialogs[id];
if(dialog) {
return dialog;
} else {
return null;
}
}
};
/**
* Retrieve the next server to which connect.
*/
UA.prototype.getNextWsServer = function() {
// Order servers by weight
var idx, length, ws_server,
candidates = [];
length = this.configuration.ws_servers.length;
for (idx = 0; idx < length; idx++) {
ws_server = this.configuration.ws_servers[idx];
if (ws_server.status === Transport.C.STATUS_ERROR) {
continue;
} else if (candidates.length === 0) {
candidates.push(ws_server);
} else if (ws_server.weight > candidates[0].weight) {
candidates = [ws_server];
} else if (ws_server.weight === candidates[0].weight) {
candidates.push(ws_server);
}
}
idx = Math.floor((Math.random()* candidates.length));
return candidates[idx];
};
/**
* Close all sessions on transport error.
*/
UA.prototype.closeSessionsOnTransportError = function() {
var idx;
// Run _transportError_ for every Session
for(idx in this.sessions) {
this.sessions[idx].onTransportError();
}
// Call registrator _onTransportClosed_
this._registrator.onTransportClosed();
};
UA.prototype.recoverTransport = function(ua) {
var idx, length, k, nextRetry, count, server;
ua = ua || this;
count = ua.transportRecoverAttempts;
length = ua.configuration.ws_servers.length;
for (idx = 0; idx < length; idx++) {
ua.configuration.ws_servers[idx].status = 0;
}
server = ua.getNextWsServer();
k = Math.floor((Math.random() * Math.pow(2,count)) +1);
nextRetry = k * ua.configuration.connection_recovery_min_interval;
if (nextRetry > ua.configuration.connection_recovery_max_interval) {
debug('time for next connection attempt exceeds connection_recovery_max_interval, resetting counter');
nextRetry = ua.configuration.connection_recovery_min_interval;
count = 0;
}
debug('next connection attempt in '+ nextRetry +' seconds');
this.transportRecoveryTimer = setTimeout(function() {
ua.transportRecoverAttempts = count + 1;
ua.transport = new Transport(ua, server);
ua.transport.connect();
}, nextRetry * 1000);
};
UA.prototype.loadConfig = function(configuration) {
// Settings and default values
var parameter, value, checked_value, hostport_params, registrar_server,
settings = {
/* Host address
* Value to be set in Via sent_by and host part of Contact FQDN
*/
via_host: Utils.createRandomToken(12) + '.invalid',
// Password
password: null,
// Registration parameters
register_expires: 600,
register: true,
registrar_server: null,
// Transport related parameters
ws_server_max_reconnection: 3,
ws_server_reconnection_timeout: 4,
connection_recovery_min_interval: 2,
connection_recovery_max_interval: 30,
use_preloaded_route: false,
// Session parameters
no_answer_timeout: 60,
session_timers: true,
// Hacks
hack_via_tcp: false,
hack_via_ws: false,
hack_ip_in_contact: false,
// Options for Node.
node_websocket_options: {}
};
// Pre-Configuration
// Check Mandatory parameters
for(parameter in UA.configuration_check.mandatory) {
if(!configuration.hasOwnProperty(parameter)) {
throw new Exceptions.ConfigurationError(parameter);
} else {
value = configuration[parameter];
checked_value = UA.configuration_check.mandatory[parameter].call(this, value);
if (checked_value !== undefined) {
settings[parameter] = checked_value;
} else {
throw new Exceptions.ConfigurationError(parameter, value);
}
}
}
// Check Optional parameters
for(parameter in UA.configuration_check.optional) {
if(configuration.hasOwnProperty(parameter)) {
value = configuration[parameter];
/* If the parameter value is null, empty string, undefined, empty array
* or it's a number with NaN value, then apply its default value.
*/
if (Utils.isEmpty(value)) {
continue;
}
checked_value = UA.configuration_check.optional[parameter].call(this, value);
if (checked_value !== undefined) {
settings[parameter] = checked_value;
} else {
throw new Exceptions.ConfigurationError(parameter, value);
}
}
}
// Sanity Checks
// Connection recovery intervals.
if(settings.connection_recovery_max_interval < settings.connection_recovery_min_interval) {
throw new Exceptions.ConfigurationError('connection_recovery_max_interval', settings.connection_recovery_max_interval);
}
// Post Configuration Process
// Allow passing 0 number as display_name.
if (settings.display_name === 0) {
settings.display_name = '0';
}
// Instance-id for GRUU.
if (!settings.instance_id) {
settings.instance_id = Utils.newUUID();
}
// jssip_id instance parameter. Static random tag of length 5.
settings.jssip_id = Utils.createRandomToken(5);
// String containing settings.uri without scheme and user.
hostport_params = settings.uri.clone();
hostport_params.user = null;
settings.hostport_params = hostport_params.toString().replace(/^sip:/i, '');
// Check whether authorization_user is explicitly defined.
// Take 'settings.uri.user' value if not.
if (!settings.authorization_user) {
settings.authorization_user = settings.uri.user;
}
// If no 'registrar_server' is set use the 'uri' value without user portion.
if (!settings.registrar_server) {
registrar_server = settings.uri.clone();
registrar_server.user = null;
settings.registrar_server = registrar_server;
}
// User no_answer_timeout.
settings.no_answer_timeout = settings.no_answer_timeout * 1000;
// Via Host
if (settings.hack_ip_in_contact) {
settings.via_host = Utils.getRandomTestNetIP();
}
this.contact = {
pub_gruu: null,
temp_gruu: null,
uri: new URI('sip', Utils.createRandomToken(8), settings.via_host, null, {transport: 'ws'}),
toString: function(options) {
options = options || {};
var
anonymous = options.anonymous || null,
outbound = options.outbound || null,
contact = '<';
if (anonymous) {
contact += this.temp_gruu || 'sip:anonymous@anonymous.invalid;transport=ws';
} else {
contact += this.pub_gruu || this.uri.toString();
}
if (outbound && (anonymous ? !this.temp_gruu : !this.pub_gruu)) {
contact += ';ob';
}
contact += '>';
return contact;
}
};
// Fill the value of the configuration_skeleton
for(parameter in settings) {
UA.configuration_skeleton[parameter].value = settings[parameter];
}
Object.defineProperties(this.configuration, UA.configuration_skeleton);
// Clean UA.configuration_skeleton
for(parameter in settings) {
UA.configuration_skeleton[parameter].value = '';
}
debug('configuration parameters after validation:');
for(parameter in settings) {
switch(parameter) {
case 'uri':
case 'registrar_server':
debug('- ' + parameter + ': ' + settings[parameter]);
break;
case 'password':
debug('- ' + parameter + ': ' + 'NOT SHOWN');
break;
default:
debug('- ' + parameter + ': ' + JSON.stringify(settings[parameter]));
}
}
return;
};
/**
* Configuration Object skeleton.
*/
UA.configuration_skeleton = (function() {
var idx, parameter,
skeleton = {},
parameters = [
// Internal parameters
'jssip_id',
'ws_server_max_reconnection',
'ws_server_reconnection_timeout',
'hostport_params',
// Mandatory user configurable parameters
'uri',
'ws_servers',
// Optional user configurable parameters
'authorization_user',
'connection_recovery_max_interval',
'connection_recovery_min_interval',
'display_name',
'hack_via_tcp', // false
'hack_via_ws', // false
'hack_ip_in_contact', //false
'instance_id',
'no_answer_timeout', // 30 seconds
'session_timers', // true
'node_websocket_options',
'password',
'register_expires', // 600 seconds
'registrar_server',
'use_preloaded_route',
// Post-configuration generated parameters
'via_core_value',
'via_host'
];
for(idx in parameters) {
parameter = parameters[idx];
skeleton[parameter] = {
value: '',
writable: false,
configurable: false
};
}
skeleton.register = {
value: '',
writable: true,
configurable: false
};
return skeleton;
}());
/**
* Configuration checker.
*/
UA.configuration_check = {
mandatory: {
uri: function(uri) {
var parsed;
if (!/^sip:/i.test(uri)) {
uri = JsSIP_C.SIP + ':' + uri;
}
parsed = URI.parse(uri);
if(!parsed) {
return;
} else if(!parsed.user) {
return;
} else {
return parsed;
}
},
ws_servers: function(ws_servers) {
var idx, length, url;
/* Allow defining ws_servers parameter as:
* String: "host"
* Array of Strings: ["host1", "host2"]
* Array of Objects: [{ws_uri:"host1", weight:1}, {ws_uri:"host2", weight:0}]
* Array of Objects and Strings: [{ws_uri:"host1"}, "host2"]
*/
if (typeof ws_servers === 'string') {
ws_servers = [{ws_uri: ws_servers}];
} else if (Array.isArray(ws_servers)) {
length = ws_servers.length;
for (idx = 0; idx < length; idx++) {
if (typeof ws_servers[idx] === 'string') {
ws_servers[idx] = {ws_uri: ws_servers[idx]};
}
}
} else {
return;
}
if (ws_servers.length === 0) {
return false;
}
length = ws_servers.length;
for (idx = 0; idx < length; idx++) {
if (!ws_servers[idx].ws_uri) {
debug('ERROR: missing "ws_uri" attribute in ws_servers parameter');
return;
}
if (ws_servers[idx].weight && !Number(ws_servers[idx].weight)) {
debug('ERROR: "weight" attribute in ws_servers parameter must be a Number');
return;
}
url = Grammar.parse(ws_servers[idx].ws_uri, 'absoluteURI');
if(url === -1) {
debug('ERROR: invalid "ws_uri" attribute in ws_servers parameter: ' + ws_servers[idx].ws_uri);
return;
} else if(url.scheme !== 'wss' && url.scheme !== 'ws') {
debug('ERROR: invalid URI scheme in ws_servers parameter: ' + url.scheme);
return;
} else {
ws_servers[idx].sip_uri = '<sip:' + url.host + (url.port ? ':' + url.port : '') + ';transport=ws;lr>';
if (!ws_servers[idx].weight) {
ws_servers[idx].weight = 0;
}
ws_servers[idx].status = 0;
ws_servers[idx].scheme = url.scheme.toUpperCase();
}
}
return ws_servers;
}
},
optional: {
authorization_user: function(authorization_user) {
if(Grammar.parse('"'+ authorization_user +'"', 'quoted_string') === -1) {
return;
} else {
return authorization_user;
}
},
connection_recovery_max_interval: function(connection_recovery_max_interval) {
var value;
if(Utils.isDecimal(connection_recovery_max_interval)) {
value = Number(connection_recovery_max_interval);
if(value > 0) {
return value;
}
}
},
connection_recovery_min_interval: function(connection_recovery_min_interval) {
var value;
if(Utils.isDecimal(connection_recovery_min_interval)) {
value = Number(connection_recovery_min_interval);
if(value > 0) {
return value;
}
}
},
display_name: function(display_name) {
if(Grammar.parse('"' + display_name + '"', 'display_name') === -1) {
return;
} else {
return display_name;
}
},
hack_via_tcp: function(hack_via_tcp) {
if (typeof hack_via_tcp === 'boolean') {
return hack_via_tcp;
}
},
hack_via_ws: function(hack_via_ws) {
if (typeof hack_via_ws === 'boolean') {
return hack_via_ws;
}
},
hack_ip_in_contact: function(hack_ip_in_contact) {
if (typeof hack_ip_in_contact === 'boolean') {
return hack_ip_in_contact;
}
},
instance_id: function(instance_id) {
if ((/^uuid:/i.test(instance_id))) {
instance_id = instance_id.substr(5);
}
if(Grammar.parse(instance_id, 'uuid') === -1) {
return;
} else {
return instance_id;
}
},
no_answer_timeout: function(no_answer_timeout) {
var value;
if (Utils.isDecimal(no_answer_timeout)) {
value = Number(no_answer_timeout);
if (value > 0) {
return value;
}
}
},
session_timers: function(session_timers) {
if (typeof session_timers === 'boolean') {
return session_timers;
}
},
node_websocket_options: function(node_websocket_options) {
return (typeof node_websocket_options === 'object') ? node_websocket_options : {};
},
password: function(password) {
return String(password);
},
register: function(register) {
if (typeof register === 'boolean') {
return register;
}
},
register_expires: function(register_expires) {
var value;
if (Utils.isDecimal(register_expires)) {
value = Number(register_expires);
if (value > 0) {
return value;
}
}
},
registrar_server: function(registrar_server) {
var parsed;
if (!/^sip:/i.test(registrar_server)) {
registrar_server = JsSIP_C.SIP + ':' + registrar_server;
}
parsed = URI.parse(registrar_server);
if(!parsed) {
return;
} else if(parsed.user) {
return;
} else {
return parsed;
}
},
use_preloaded_route: function(use_preloaded_route) {
if (typeof use_preloaded_route === 'boolean') {
return use_preloaded_route;
}
}
}
};
},{"./Constants":1,"./Exceptions":5,"./Grammar":6,"./Message":8,"./RTCSession":11,"./Registrator":14,"./Transactions":18,"./Transport":19,"./URI":21,"./Utils":22,"debug":29,"events":24,"rtcninja":34,"util":28}],21:[function(require,module,exports){
module.exports = URI;
/**
* Dependencies.
*/
var JsSIP_C = require('./Constants');
var Utils = require('./Utils');
var Grammar = require('./Grammar');
/**
* -param {String} [scheme]
* -param {String} [user]
* -param {String} host
* -param {String} [port]
* -param {Object} [parameters]
* -param {Object} [headers]
*
*/
function URI(scheme, user, host, port, parameters, headers) {
var param, header;
// Checks
if(!host) {
throw new TypeError('missing or invalid "host" parameter');
}
// Initialize parameters
scheme = scheme || JsSIP_C.SIP;
this.parameters = {};
this.headers = {};
for (param in parameters) {
this.setParam(param, parameters[param]);
}
for (header in headers) {
this.setHeader(header, headers[header]);
}
Object.defineProperties(this, {
scheme: {
get: function(){ return scheme; },
set: function(value){
scheme = value.toLowerCase();
}
},
user: {
get: function(){ return user; },
set: function(value){
user = value;
}
},
host: {
get: function(){ return host; },
set: function(value){
host = value.toLowerCase();
}
},
port: {
get: function(){ return port; },
set: function(value){
port = value === 0 ? value : (parseInt(value,10) || null);
}
}
});
}
URI.prototype = {
setParam: function(key, value) {
if(key) {
this.parameters[key.toLowerCase()] = (typeof value === 'undefined' || value === null) ? null : value.toString().toLowerCase();
}
},
getParam: function(key) {
if(key) {
return this.parameters[key.toLowerCase()];
}
},
hasParam: function(key) {
if(key) {
return (this.parameters.hasOwnProperty(key.toLowerCase()) && true) || false;
}
},
deleteParam: function(parameter) {
var value;
parameter = parameter.toLowerCase();
if (this.parameters.hasOwnProperty(parameter)) {
value = this.parameters[parameter];
delete this.parameters[parameter];
return value;
}
},
clearParams: function() {
this.parameters = {};
},
setHeader: function(name, value) {
this.headers[Utils.headerize(name)] = (Array.isArray(value)) ? value : [value];
},
getHeader: function(name) {
if(name) {
return this.headers[Utils.headerize(name)];
}
},
hasHeader: function(name) {
if(name) {
return (this.headers.hasOwnProperty(Utils.headerize(name)) && true) || false;
}
},
deleteHeader: function(header) {
var value;
header = Utils.headerize(header);
if(this.headers.hasOwnProperty(header)) {
value = this.headers[header];
delete this.headers[header];
return value;
}
},
clearHeaders: function() {
this.headers = {};
},
clone: function() {
return new URI(
this.scheme,
this.user,
this.host,
this.port,
JSON.parse(JSON.stringify(this.parameters)),
JSON.parse(JSON.stringify(this.headers)));
},
toString: function(){
var header, parameter, idx, uri,
headers = [];
uri = this.scheme + ':';
if (this.user) {
uri += Utils.escapeUser(this.user) + '@';
}
uri += this.host;
if (this.port || this.port === 0) {
uri += ':' + this.port;
}
for (parameter in this.parameters) {
uri += ';' + parameter;
if (this.parameters[parameter] !== null) {
uri += '='+ this.parameters[parameter];
}
}
for(header in this.headers) {
for(idx in this.headers[header]) {
headers.push(header + '=' + this.headers[header][idx]);
}
}
if (headers.length > 0) {
uri += '?' + headers.join('&');
}
return uri;
},
toAor: function(show_port){
var aor;
aor = this.scheme + ':';
if (this.user) {
aor += Utils.escapeUser(this.user) + '@';
}
aor += this.host;
if (show_port && (this.port || this.port === 0)) {
aor += ':' + this.port;
}
return aor;
}
};
/**
* Parse the given string and returns a JsSIP.URI instance or undefined if
* it is an invalid URI.
*/
URI.parse = function(uri) {
uri = Grammar.parse(uri,'SIP_URI');
if (uri !== -1) {
return uri;
} else {
return undefined;
}
};
},{"./Constants":1,"./Grammar":6,"./Utils":22}],22:[function(require,module,exports){
var Utils = {};
module.exports = Utils;
/**
* Dependencies.
*/
var JsSIP_C = require('./Constants');
var URI = require('./URI');
var Grammar = require('./Grammar');
Utils.str_utf8_length = function(string) {
return unescape(encodeURIComponent(string)).length;
};
Utils.isFunction = function(fn) {
if (fn !== undefined) {
return (Object.prototype.toString.call(fn) === '[object Function]')? true : false;
} else {
return false;
}
};
Utils.isDecimal = function(num) {
return !isNaN(num) && (parseFloat(num) === parseInt(num,10));
};
Utils.isEmpty = function(value) {
if (value === null || value === '' || value === undefined || (Array.isArray(value) && value.length === 0) || (typeof(value) === 'number' && isNaN(value))) {
return true;
}
};
Utils.createRandomToken = function(size, base) {
var i, r,
token = '';
base = base || 32;
for( i=0; i < size; i++ ) {
r = Math.random() * base|0;
token += r.toString(base);
}
return token;
};
Utils.newTag = function() {
return Utils.createRandomToken(10);
};
// http://stackoverflow.com/users/109538/broofa
Utils.newUUID = function() {
var UUID = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
return UUID;
};
Utils.hostType = function(host) {
if (!host) {
return;
} else {
host = Grammar.parse(host,'host');
if (host !== -1) {
return host.host_type;
}
}
};
/**
* Normalize SIP URI.
* NOTE: It does not allow a SIP URI without username.
* Accepts 'sip', 'sips' and 'tel' URIs and convert them into 'sip'.
* Detects the domain part (if given) and properly hex-escapes the user portion.
* If the user portion has only 'tel' number symbols the user portion is clean of 'tel' visual separators.
*/
Utils.normalizeTarget = function(target, domain) {
var uri, target_array, target_user, target_domain;
// If no target is given then raise an error.
if (!target) {
return;
// If a URI instance is given then return it.
} else if (target instanceof URI) {
return target;
// If a string is given split it by '@':
// - Last fragment is the desired domain.
// - Otherwise append the given domain argument.
} else if (typeof target === 'string') {
target_array = target.split('@');
switch(target_array.length) {
case 1:
if (!domain) {
return;
}
target_user = target;
target_domain = domain;
break;
case 2:
target_user = target_array[0];
target_domain = target_array[1];
break;
default:
target_user = target_array.slice(0, target_array.length-1).join('@');
target_domain = target_array[target_array.length-1];
}
// Remove the URI scheme (if present).
target_user = target_user.replace(/^(sips?|tel):/i, '');
// Remove 'tel' visual separators if the user portion just contains 'tel' number symbols.
if (/^[\-\.\(\)]*\+?[0-9\-\.\(\)]+$/.test(target_user)) {
target_user = target_user.replace(/[\-\.\(\)]/g, '');
}
// Build the complete SIP URI.
target = JsSIP_C.SIP + ':' + Utils.escapeUser(target_user) + '@' + target_domain;
// Finally parse the resulting URI.
if ((uri = URI.parse(target))) {
return uri;
} else {
return;
}
} else {
return;
}
};
/**
* Hex-escape a SIP URI user.
*/
Utils.escapeUser = function(user) {
// Don't hex-escape ':' (%3A), '+' (%2B), '?' (%3F"), '/' (%2F).
return encodeURIComponent(decodeURIComponent(user)).replace(/%3A/ig, ':').replace(/%2B/ig, '+').replace(/%3F/ig, '?').replace(/%2F/ig, '/');
};
Utils.headerize = function(string) {
var exceptions = {
'Call-Id': 'Call-ID',
'Cseq': 'CSeq',
'Www-Authenticate': 'WWW-Authenticate'
},
name = string.toLowerCase().replace(/_/g,'-').split('-'),
hname = '',
parts = name.length, part;
for (part = 0; part < parts; part++) {
if (part !== 0) {
hname +='-';
}
hname += name[part].charAt(0).toUpperCase()+name[part].substring(1);
}
if (exceptions[hname]) {
hname = exceptions[hname];
}
return hname;
};
Utils.sipErrorCause = function(status_code) {
var cause;
for (cause in JsSIP_C.SIP_ERROR_CAUSES) {
if (JsSIP_C.SIP_ERROR_CAUSES[cause].indexOf(status_code) !== -1) {
return JsSIP_C.causes[cause];
}
}
return JsSIP_C.causes.SIP_FAILURE_CODE;
};
/**
* Generate a random Test-Net IP (http://tools.ietf.org/html/rfc5735)
*/
Utils.getRandomTestNetIP = function() {
function getOctet(from,to) {
return Math.floor(Math.random()*(to-from+1)+from);
}
return '192.0.2.' + getOctet(1, 254);
};
// MD5 (Message-Digest Algorithm) http://www.webtoolkit.info
Utils.calculateMD5 = function(string) {
function rotateLeft(lValue, iShiftBits) {
return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
}
function addUnsigned(lX,lY) {
var lX4,lY4,lX8,lY8,lResult;
lX8 = (lX & 0x80000000);
lY8 = (lY & 0x80000000);
lX4 = (lX & 0x40000000);
lY4 = (lY & 0x40000000);
lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF);
if (lX4 & lY4) {
return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
}
if (lX4 | lY4) {
if (lResult & 0x40000000) {
return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
} else {
return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
}
} else {
return (lResult ^ lX8 ^ lY8);
}
}
function doF(x,y,z) {
return (x & y) | ((~x) & z);
}
function doG(x,y,z) {
return (x & z) | (y & (~z));
}
function doH(x,y,z) {
return (x ^ y ^ z);
}
function doI(x,y,z) {
return (y ^ (x | (~z)));
}
function doFF(a,b,c,d,x,s,ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(doF(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
}
function doGG(a,b,c,d,x,s,ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(doG(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
}
function doHH(a,b,c,d,x,s,ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(doH(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
}
function doII(a,b,c,d,x,s,ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(doI(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
}
function convertToWordArray(string) {
var lWordCount;
var lMessageLength = string.length;
var lNumberOfWords_temp1=lMessageLength + 8;
var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64;
var lNumberOfWords = (lNumberOfWords_temp2+1)*16;
var lWordArray = new Array(lNumberOfWords-1);
var lBytePosition = 0;
var lByteCount = 0;
while ( lByteCount < lMessageLength ) {
lWordCount = (lByteCount-(lByteCount % 4))/4;
lBytePosition = (lByteCount % 4)*8;
lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition));
lByteCount++;
}
lWordCount = (lByteCount-(lByteCount % 4))/4;
lBytePosition = (lByteCount % 4)*8;
lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition);
lWordArray[lNumberOfWords-2] = lMessageLength<<3;
lWordArray[lNumberOfWords-1] = lMessageLength>>>29;
return lWordArray;
}
function wordToHex(lValue) {
var wordToHexValue='',wordToHexValue_temp='',lByte,lCount;
for (lCount = 0;lCount<=3;lCount++) {
lByte = (lValue>>>(lCount*8)) & 255;
wordToHexValue_temp = '0' + lByte.toString(16);
wordToHexValue = wordToHexValue + wordToHexValue_temp.substr(wordToHexValue_temp.length-2,2);
}
return wordToHexValue;
}
function utf8Encode(string) {
string = string.replace(/\r\n/g, '\n');
var utftext = '';
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
}
var x=[];
var k,AA,BB,CC,DD,a,b,c,d;
var S11=7, S12=12, S13=17, S14=22;
var S21=5, S22=9 , S23=14, S24=20;
var S31=4, S32=11, S33=16, S34=23;
var S41=6, S42=10, S43=15, S44=21;
string = utf8Encode(string);
x = convertToWordArray(string);
a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
for (k=0;k<x.length;k+=16) {
AA=a; BB=b; CC=c; DD=d;
a=doFF(a,b,c,d,x[k+0], S11,0xD76AA478);
d=doFF(d,a,b,c,x[k+1], S12,0xE8C7B756);
c=doFF(c,d,a,b,x[k+2], S13,0x242070DB);
b=doFF(b,c,d,a,x[k+3], S14,0xC1BDCEEE);
a=doFF(a,b,c,d,x[k+4], S11,0xF57C0FAF);
d=doFF(d,a,b,c,x[k+5], S12,0x4787C62A);
c=doFF(c,d,a,b,x[k+6], S13,0xA8304613);
b=doFF(b,c,d,a,x[k+7], S14,0xFD469501);
a=doFF(a,b,c,d,x[k+8], S11,0x698098D8);
d=doFF(d,a,b,c,x[k+9], S12,0x8B44F7AF);
c=doFF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);
b=doFF(b,c,d,a,x[k+11],S14,0x895CD7BE);
a=doFF(a,b,c,d,x[k+12],S11,0x6B901122);
d=doFF(d,a,b,c,x[k+13],S12,0xFD987193);
c=doFF(c,d,a,b,x[k+14],S13,0xA679438E);
b=doFF(b,c,d,a,x[k+15],S14,0x49B40821);
a=doGG(a,b,c,d,x[k+1], S21,0xF61E2562);
d=doGG(d,a,b,c,x[k+6], S22,0xC040B340);
c=doGG(c,d,a,b,x[k+11],S23,0x265E5A51);
b=doGG(b,c,d,a,x[k+0], S24,0xE9B6C7AA);
a=doGG(a,b,c,d,x[k+5], S21,0xD62F105D);
d=doGG(d,a,b,c,x[k+10],S22,0x2441453);
c=doGG(c,d,a,b,x[k+15],S23,0xD8A1E681);
b=doGG(b,c,d,a,x[k+4], S24,0xE7D3FBC8);
a=doGG(a,b,c,d,x[k+9], S21,0x21E1CDE6);
d=doGG(d,a,b,c,x[k+14],S22,0xC33707D6);
c=doGG(c,d,a,b,x[k+3], S23,0xF4D50D87);
b=doGG(b,c,d,a,x[k+8], S24,0x455A14ED);
a=doGG(a,b,c,d,x[k+13],S21,0xA9E3E905);
d=doGG(d,a,b,c,x[k+2], S22,0xFCEFA3F8);
c=doGG(c,d,a,b,x[k+7], S23,0x676F02D9);
b=doGG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);
a=doHH(a,b,c,d,x[k+5], S31,0xFFFA3942);
d=doHH(d,a,b,c,x[k+8], S32,0x8771F681);
c=doHH(c,d,a,b,x[k+11],S33,0x6D9D6122);
b=doHH(b,c,d,a,x[k+14],S34,0xFDE5380C);
a=doHH(a,b,c,d,x[k+1], S31,0xA4BEEA44);
d=doHH(d,a,b,c,x[k+4], S32,0x4BDECFA9);
c=doHH(c,d,a,b,x[k+7], S33,0xF6BB4B60);
b=doHH(b,c,d,a,x[k+10],S34,0xBEBFBC70);
a=doHH(a,b,c,d,x[k+13],S31,0x289B7EC6);
d=doHH(d,a,b,c,x[k+0], S32,0xEAA127FA);
c=doHH(c,d,a,b,x[k+3], S33,0xD4EF3085);
b=doHH(b,c,d,a,x[k+6], S34,0x4881D05);
a=doHH(a,b,c,d,x[k+9], S31,0xD9D4D039);
d=doHH(d,a,b,c,x[k+12],S32,0xE6DB99E5);
c=doHH(c,d,a,b,x[k+15],S33,0x1FA27CF8);
b=doHH(b,c,d,a,x[k+2], S34,0xC4AC5665);
a=doII(a,b,c,d,x[k+0], S41,0xF4292244);
d=doII(d,a,b,c,x[k+7], S42,0x432AFF97);
c=doII(c,d,a,b,x[k+14],S43,0xAB9423A7);
b=doII(b,c,d,a,x[k+5], S44,0xFC93A039);
a=doII(a,b,c,d,x[k+12],S41,0x655B59C3);
d=doII(d,a,b,c,x[k+3], S42,0x8F0CCC92);
c=doII(c,d,a,b,x[k+10],S43,0xFFEFF47D);
b=doII(b,c,d,a,x[k+1], S44,0x85845DD1);
a=doII(a,b,c,d,x[k+8], S41,0x6FA87E4F);
d=doII(d,a,b,c,x[k+15],S42,0xFE2CE6E0);
c=doII(c,d,a,b,x[k+6], S43,0xA3014314);
b=doII(b,c,d,a,x[k+13],S44,0x4E0811A1);
a=doII(a,b,c,d,x[k+4], S41,0xF7537E82);
d=doII(d,a,b,c,x[k+11],S42,0xBD3AF235);
c=doII(c,d,a,b,x[k+2], S43,0x2AD7D2BB);
b=doII(b,c,d,a,x[k+9], S44,0xEB86D391);
a=addUnsigned(a,AA);
b=addUnsigned(b,BB);
c=addUnsigned(c,CC);
d=addUnsigned(d,DD);
}
var temp = wordToHex(a)+wordToHex(b)+wordToHex(c)+wordToHex(d);
return temp.toLowerCase();
};
},{"./Constants":1,"./Grammar":6,"./URI":21}],23:[function(require,module,exports){
module.exports = sanityCheck;
/**
* Dependencies.
*/
var debug = require('debug')('JsSIP:sanityCheck');
var JsSIP_C = require('./Constants');
var SIPMessage = require('./SIPMessage');
var Utils = require('./Utils');
var message, ua, transport,
requests = [],
responses = [],
all = [];
requests.push(rfc3261_8_2_2_1);
requests.push(rfc3261_16_3_4);
requests.push(rfc3261_18_3_request);
requests.push(rfc3261_8_2_2_2);
responses.push(rfc3261_8_1_3_3);
responses.push(rfc3261_18_3_response);
all.push(minimumHeaders);
function sanityCheck(m, u, t) {
var len, pass;
message = m;
ua = u;
transport = t;
len = all.length;
while(len--) {
pass = all[len](message);
if(pass === false) {
return false;
}
}
if(message instanceof SIPMessage.IncomingRequest) {
len = requests.length;
while(len--) {
pass = requests[len](message);
if(pass === false) {
return false;
}
}
}
else if(message instanceof SIPMessage.IncomingResponse) {
len = responses.length;
while(len--) {
pass = responses[len](message);
if(pass === false) {
return false;
}
}
}
//Everything is OK
return true;
}
/*
* Sanity Check for incoming Messages
*
* Requests:
* - _rfc3261_8_2_2_1_ Receive a Request with a non supported URI scheme
* - _rfc3261_16_3_4_ Receive a Request already sent by us
* Does not look at via sent-by but at jssip_id, which is inserted as
* a prefix in all initial requests generated by the ua
* - _rfc3261_18_3_request_ Body Content-Length
* - _rfc3261_8_2_2_2_ Merged Requests
*
* Responses:
* - _rfc3261_8_1_3_3_ Multiple Via headers
* - _rfc3261_18_3_response_ Body Content-Length
*
* All:
* - Minimum headers in a SIP message
*/
// Sanity Check functions for requests
function rfc3261_8_2_2_1() {
if(message.s('to').uri.scheme !== 'sip') {
reply(416);
return false;
}
}
function rfc3261_16_3_4() {
if(!message.to_tag) {
if(message.call_id.substr(0, 5) === ua.configuration.jssip_id) {
reply(482);
return false;
}
}
}
function rfc3261_18_3_request() {
var len = Utils.str_utf8_length(message.body),
contentLength = message.getHeader('content-length');
if(len < contentLength) {
reply(400);
return false;
}
}
function rfc3261_8_2_2_2() {
var tr, idx,
fromTag = message.from_tag,
call_id = message.call_id,
cseq = message.cseq;
// Accept any in-dialog request.
if(message.to_tag) {
return;
}
// INVITE request.
if (message.method === JsSIP_C.INVITE) {
// If the branch matches the key of any IST then assume it is a retransmission
// and ignore the INVITE.
// TODO: we should reply the last response.
if (ua.transactions.ist[message.via_branch]) {
return false;
}
// Otherwise check whether it is a merged request.
else {
for(idx in ua.transactions.ist) {
tr = ua.transactions.ist[idx];
if(tr.request.from_tag === fromTag && tr.request.call_id === call_id && tr.request.cseq === cseq) {
reply(482);
return false;
}
}
}
}
// Non INVITE request.
else {
// If the branch matches the key of any NIST then assume it is a retransmission
// and ignore the request.
// TODO: we should reply the last response.
if (ua.transactions.nist[message.via_branch]) {
return false;
}
// Otherwise check whether it is a merged request.
else {
for(idx in ua.transactions.nist) {
tr = ua.transactions.nist[idx];
if(tr.request.from_tag === fromTag && tr.request.call_id === call_id && tr.request.cseq === cseq) {
reply(482);
return false;
}
}
}
}
}
// Sanity Check functions for responses
function rfc3261_8_1_3_3() {
if(message.getHeaders('via').length > 1) {
debug('more than one Via header field present in the response, dropping the response');
return false;
}
}
function rfc3261_18_3_response() {
var
len = Utils.str_utf8_length(message.body),
contentLength = message.getHeader('content-length');
if(len < contentLength) {
debug('message body length is lower than the value in Content-Length header field, dropping the response');
return false;
}
}
// Sanity Check functions for requests and responses
function minimumHeaders() {
var
mandatoryHeaders = ['from', 'to', 'call_id', 'cseq', 'via'],
idx = mandatoryHeaders.length;
while(idx--) {
if(!message.hasHeader(mandatoryHeaders[idx])) {
debug('missing mandatory header field : ' + mandatoryHeaders[idx] + ', dropping the response');
return false;
}
}
}
// Reply
function reply(status_code) {
var to,
response = 'SIP/2.0 ' + status_code + ' ' + JsSIP_C.REASON_PHRASE[status_code] + '\r\n',
vias = message.getHeaders('via'),
length = vias.length,
idx = 0;
for(idx; idx < length; idx++) {
response += 'Via: ' + vias[idx] + '\r\n';
}
to = message.getHeader('To');
if(!message.to_tag) {
to += ';tag=' + Utils.newTag();
}
response += 'To: ' + to + '\r\n';
response += 'From: ' + message.getHeader('From') + '\r\n';
response += 'Call-ID: ' + message.call_id + '\r\n';
response += 'CSeq: ' + message.cseq + ' ' + message.method + '\r\n';
response += '\r\n';
transport.send(response);
}
},{"./Constants":1,"./SIPMessage":16,"./Utils":22,"debug":29}],24:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
function EventEmitter() {
this._events = this._events || {};
this._maxListeners = this._maxListeners || undefined;
}
module.exports = EventEmitter;
// Backwards-compat with node 0.10.x
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._maxListeners = undefined;
// By default EventEmitters will print a warning if more than 10 listeners are
// added to it. This is a useful default which helps finding memory leaks.
EventEmitter.defaultMaxListeners = 10;
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
EventEmitter.prototype.setMaxListeners = function(n) {
if (!isNumber(n) || n < 0 || isNaN(n))
throw TypeError('n must be a positive number');
this._maxListeners = n;
return this;
};
EventEmitter.prototype.emit = function(type) {
var er, handler, len, args, i, listeners;
if (!this._events)
this._events = {};
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._events.error ||
(isObject(this._events.error) && !this._events.error.length)) {
er = arguments[1];
if (er instanceof Error) {
throw er; // Unhandled 'error' event
}
throw TypeError('Uncaught, unspecified "error" event.');
}
}
handler = this._events[type];
if (isUndefined(handler))
return false;
if (isFunction(handler)) {
switch (arguments.length) {
// fast cases
case 1:
handler.call(this);
break;
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
// slower
default:
len = arguments.length;
args = new Array(len - 1);
for (i = 1; i < len; i++)
args[i - 1] = arguments[i];
handler.apply(this, args);
}
} else if (isObject(handler)) {
len = arguments.length;
args = new Array(len - 1);
for (i = 1; i < len; i++)
args[i - 1] = arguments[i];
listeners = handler.slice();
len = listeners.length;
for (i = 0; i < len; i++)
listeners[i].apply(this, args);
}
return true;
};
EventEmitter.prototype.addListener = function(type, listener) {
var m;
if (!isFunction(listener))
throw TypeError('listener must be a function');
if (!this._events)
this._events = {};
// To avoid recursion in the case that type === "newListener"! Before
// adding it to the listeners, first emit "newListener".
if (this._events.newListener)
this.emit('newListener', type,
isFunction(listener.listener) ?
listener.listener : listener);
if (!this._events[type])
// Optimize the case of one listener. Don't need the extra array object.
this._events[type] = listener;
else if (isObject(this._events[type]))
// If we've already got an array, just append.
this._events[type].push(listener);
else
// Adding the second element, need to change to array.
this._events[type] = [this._events[type], listener];
// Check for listener leak
if (isObject(this._events[type]) && !this._events[type].warned) {
var m;
if (!isUndefined(this._maxListeners)) {
m = this._maxListeners;
} else {
m = EventEmitter.defaultMaxListeners;
}
if (m && m > 0 && this._events[type].length > m) {
this._events[type].warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
this._events[type].length);
if (typeof console.trace === 'function') {
// not supported in IE 10
console.trace();
}
}
}
return this;
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.once = function(type, listener) {
if (!isFunction(listener))
throw TypeError('listener must be a function');
var fired = false;
function g() {
this.removeListener(type, g);
if (!fired) {
fired = true;
listener.apply(this, arguments);
}
}
g.listener = listener;
this.on(type, g);
return this;
};
// emits a 'removeListener' event iff the listener was removed
EventEmitter.prototype.removeListener = function(type, listener) {
var list, position, length, i;
if (!isFunction(listener))
throw TypeError('listener must be a function');
if (!this._events || !this._events[type])
return this;
list = this._events[type];
length = list.length;
position = -1;
if (list === listener ||
(isFunction(list.listener) && list.listener === listener)) {
delete this._events[type];
if (this._events.removeListener)
this.emit('removeListener', type, listener);
} else if (isObject(list)) {
for (i = length; i-- > 0;) {
if (list[i] === listener ||
(list[i].listener && list[i].listener === listener)) {
position = i;
break;
}
}
if (position < 0)
return this;
if (list.length === 1) {
list.length = 0;
delete this._events[type];
} else {
list.splice(position, 1);
}
if (this._events.removeListener)
this.emit('removeListener', type, listener);
}
return this;
};
EventEmitter.prototype.removeAllListeners = function(type) {
var key, listeners;
if (!this._events)
return this;
// not listening for removeListener, no need to emit
if (!this._events.removeListener) {
if (arguments.length === 0)
this._events = {};
else if (this._events[type])
delete this._events[type];
return this;
}
// emit removeListener for all listeners on all events
if (arguments.length === 0) {
for (key in this._events) {
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = {};
return this;
}
listeners = this._events[type];
if (isFunction(listeners)) {
this.removeListener(type, listeners);
} else {
// LIFO order
while (listeners.length)
this.removeListener(type, listeners[listeners.length - 1]);
}
delete this._events[type];
return this;
};
EventEmitter.prototype.listeners = function(type) {
var ret;
if (!this._events || !this._events[type])
ret = [];
else if (isFunction(this._events[type]))
ret = [this._events[type]];
else
ret = this._events[type].slice();
return ret;
};
EventEmitter.listenerCount = function(emitter, type) {
var ret;
if (!emitter._events || !emitter._events[type])
ret = 0;
else if (isFunction(emitter._events[type]))
ret = 1;
else
ret = emitter._events[type].length;
return ret;
};
function isFunction(arg) {
return typeof arg === 'function';
}
function isNumber(arg) {
return typeof arg === 'number';
}
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
function isUndefined(arg) {
return arg === void 0;
}
},{}],25:[function(require,module,exports){
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}
},{}],26:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
function drainQueue() {
if (draining) {
return;
}
draining = true;
var currentQueue;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
var i = -1;
while (++i < len) {
currentQueue[i]();
}
len = queue.length;
}
draining = false;
}
process.nextTick = function (fun) {
queue.push(fun);
if (!draining) {
setTimeout(drainQueue, 0);
}
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],27:[function(require,module,exports){
module.exports = function isBuffer(arg) {
return arg && typeof arg === 'object'
&& typeof arg.copy === 'function'
&& typeof arg.fill === 'function'
&& typeof arg.readUInt8 === 'function';
}
},{}],28:[function(require,module,exports){
(function (process,global){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var formatRegExp = /%[sdj%]/g;
exports.format = function(f) {
if (!isString(f)) {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(inspect(arguments[i]));
}
return objects.join(' ');
}
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function(x) {
if (x === '%%') return '%';
if (i >= len) return x;
switch (x) {
case '%s': return String(args[i++]);
case '%d': return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
} catch (_) {
return '[Circular]';
}
default:
return x;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject(x)) {
str += ' ' + x;
} else {
str += ' ' + inspect(x);
}
}
return str;
};
// Mark that a method should not be used.
// Returns a modified function which warns once by default.
// If --no-deprecation is set, then it is a no-op.
exports.deprecate = function(fn, msg) {
// Allow for deprecating things in the process of starting up.
if (isUndefined(global.process)) {
return function() {
return exports.deprecate(fn, msg).apply(this, arguments);
};
}
if (process.noDeprecation === true) {
return fn;
}
var warned = false;
function deprecated() {
if (!warned) {
if (process.throwDeprecation) {
throw new Error(msg);
} else if (process.traceDeprecation) {
console.trace(msg);
} else {
console.error(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
};
var debugs = {};
var debugEnviron;
exports.debuglog = function(set) {
if (isUndefined(debugEnviron))
debugEnviron = process.env.NODE_DEBUG || '';
set = set.toUpperCase();
if (!debugs[set]) {
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
var pid = process.pid;
debugs[set] = function() {
var msg = exports.format.apply(exports, arguments);
console.error('%s %d: %s', set, pid, msg);
};
} else {
debugs[set] = function() {};
}
}
return debugs[set];
};
/**
* Echos the value of a value. Trys to print the value out
* in the best way possible given the different types.
*
* @param {Object} obj The object to print out.
* @param {Object} opts Optional options object that alters the output.
*/
/* legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
// legacy...
ctx.showHidden = opts;
} else if (opts) {
// got an "options" object
exports._extend(ctx, opts);
}
// set default options
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
if (isUndefined(ctx.depth)) ctx.depth = 2;
if (isUndefined(ctx.colors)) ctx.colors = false;
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
if (ctx.colors) ctx.stylize = stylizeWithColor;
return formatValue(ctx, obj, ctx.depth);
}
exports.inspect = inspect;
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
inspect.colors = {
'bold' : [1, 22],
'italic' : [3, 23],
'underline' : [4, 24],
'inverse' : [7, 27],
'white' : [37, 39],
'grey' : [90, 39],
'black' : [30, 39],
'blue' : [34, 39],
'cyan' : [36, 39],
'green' : [32, 39],
'magenta' : [35, 39],
'red' : [31, 39],
'yellow' : [33, 39]
};
// Don't use 'blue' not visible on cmd.exe
inspect.styles = {
'special': 'cyan',
'number': 'yellow',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
'string': 'green',
'date': 'magenta',
// "name": intentionally not styling
'regexp': 'red'
};
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
'\u001b[' + inspect.colors[style][1] + 'm';
} else {
return str;
}
}
function stylizeNoColor(str, styleType) {
return str;
}
function arrayToHash(array) {
var hash = {};
array.forEach(function(val, idx) {
hash[val] = true;
});
return hash;
}
function formatValue(ctx, value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (ctx.customInspect &&
value &&
isFunction(value.inspect) &&
// Filter out the util module, it's inspect function is special
value.inspect !== exports.inspect &&
// Also filter out any prototype objects using the circular check.
!(value.constructor && value.constructor.prototype === value)) {
var ret = value.inspect(recurseTimes, ctx);
if (!isString(ret)) {
ret = formatValue(ctx, ret, recurseTimes);
}
return ret;
}
// Primitive types cannot have properties
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
}
// Look up the keys of the object.
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
// IE doesn't make error fields non-enumerable
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
if (isError(value)
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
return formatError(value);
}
// Some type of object without properties can be shortcutted.
if (keys.length === 0) {
if (isFunction(value)) {
var name = value.name ? ': ' + value.name : '';
return ctx.stylize('[Function' + name + ']', 'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
}
if (isDate(value)) {
return ctx.stylize(Date.prototype.toString.call(value), 'date');
}
if (isError(value)) {
return formatError(value);
}
}
var base = '', array = false, braces = ['{', '}'];
// Make Array say that they are Array
if (isArray(value)) {
array = true;
braces = ['[', ']'];
}
// Make functions say that they are functions
if (isFunction(value)) {
var n = value.name ? ': ' + value.name : '';
base = ' [Function' + n + ']';
}
// Make RegExps say that they are RegExps
if (isRegExp(value)) {
base = ' ' + RegExp.prototype.toString.call(value);
}
// Make dates with properties first say the date
if (isDate(value)) {
base = ' ' + Date.prototype.toUTCString.call(value);
}
// Make error with message first say the error
if (isError(value)) {
base = ' ' + formatError(value);
}
if (keys.length === 0 && (!array || value.length == 0)) {
return braces[0] + base + braces[1];
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
} else {
return ctx.stylize('[Object]', 'special');
}
}
ctx.seen.push(value);
var output;
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function(key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
}
ctx.seen.pop();
return reduceToSingleString(output, base, braces);
}
function formatPrimitive(ctx, value) {
if (isUndefined(value))
return ctx.stylize('undefined', 'undefined');
if (isString(value)) {
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
.replace(/'/g, "\\'")
.replace(/\\"/g, '"') + '\'';
return ctx.stylize(simple, 'string');
}
if (isNumber(value))
return ctx.stylize('' + value, 'number');
if (isBoolean(value))
return ctx.stylize('' + value, 'boolean');
// For some reason typeof null is "object", so special case here.
if (isNull(value))
return ctx.stylize('null', 'null');
}
function formatError(value) {
return '[' + Error.prototype.toString.call(value) + ']';
}
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
String(i), true));
} else {
output.push('');
}
}
keys.forEach(function(key) {
if (!key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, true));
}
});
return output;
}
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
if (desc.get) {
if (desc.set) {
str = ctx.stylize('[Getter/Setter]', 'special');
} else {
str = ctx.stylize('[Getter]', 'special');
}
} else {
if (desc.set) {
str = ctx.stylize('[Setter]', 'special');
}
}
if (!hasOwnProperty(visibleKeys, key)) {
name = '[' + key + ']';
}
if (!str) {
if (ctx.seen.indexOf(desc.value) < 0) {
if (isNull(recurseTimes)) {
str = formatValue(ctx, desc.value, null);
} else {
str = formatValue(ctx, desc.value, recurseTimes - 1);
}
if (str.indexOf('\n') > -1) {
if (array) {
str = str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n').substr(2);
} else {
str = '\n' + str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n');
}
}
} else {
str = ctx.stylize('[Circular]', 'special');
}
}
if (isUndefined(name)) {
if (array && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify('' + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.substr(1, name.length - 2);
name = ctx.stylize(name, 'name');
} else {
name = name.replace(/'/g, "\\'")
.replace(/\\"/g, '"')
.replace(/(^"|"$)/g, "'");
name = ctx.stylize(name, 'string');
}
}
return name + ': ' + str;
}
function reduceToSingleString(output, base, braces) {
var numLinesEst = 0;
var length = output.reduce(function(prev, cur) {
numLinesEst++;
if (cur.indexOf('\n') >= 0) numLinesEst++;
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
}, 0);
if (length > 60) {
return braces[0] +
(base === '' ? '' : base + '\n ') +
' ' +
output.join(',\n ') +
' ' +
braces[1];
}
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
}
// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
function isArray(ar) {
return Array.isArray(ar);
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string';
}
exports.isString = isString;
function isSymbol(arg) {
return typeof arg === 'symbol';
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return isObject(re) && objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return isObject(d) && objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
function isError(e) {
return isObject(e) &&
(objectToString(e) === '[object Error]' || e instanceof Error);
}
exports.isError = isError;
function isFunction(arg) {
return typeof arg === 'function';
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null ||
typeof arg === 'boolean' ||
typeof arg === 'number' ||
typeof arg === 'string' ||
typeof arg === 'symbol' || // ES6 symbol
typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = require('./support/isBuffer');
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
'Oct', 'Nov', 'Dec'];
// 26 Feb 16:19:34
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())].join(':');
return [d.getDate(), months[d.getMonth()], time].join(' ');
}
// log is just a thin wrapper to console.log that prepends a timestamp
exports.log = function() {
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};
/**
* Inherit the prototype methods from one constructor into another.
*
* The Function.prototype.inherits from lang.js rewritten as a standalone
* function (not on Function.prototype). NOTE: If this file is to be loaded
* during bootstrapping this function needs to be rewritten using some native
* functions as prototype setup using normal JavaScript does not work as
* expected during bootstrapping (see mirror.js in r114903).
*
* @param {function} ctor Constructor function which needs to inherit the
* prototype.
* @param {function} superCtor Constructor function to inherit prototype from.
*/
exports.inherits = require('inherits');
exports._extend = function(origin, add) {
// Don't do anything if add isn't an object
if (!add || !isObject(add)) return origin;
var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin;
};
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./support/isBuffer":27,"_process":26,"inherits":25}],29:[function(require,module,exports){
/**
* This is the web browser implementation of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = require('./debug');
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
/**
* Use chrome.storage.local if we are in an app
*/
var storage;
if (typeof chrome !== 'undefined' && typeof chrome.storage !== 'undefined')
storage = chrome.storage.local;
else
storage = localstorage();
/**
* Colors.
*/
exports.colors = [
'lightseagreen',
'forestgreen',
'goldenrod',
'dodgerblue',
'darkorchid',
'crimson'
];
/**
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
* and the Firebug extension (any Firefox version) are known
* to support "%c" CSS customizations.
*
* TODO: add a `localStorage` variable to explicitly enable/disable colors
*/
function useColors() {
// is webkit? http://stackoverflow.com/a/16459606/376773
return ('WebkitAppearance' in document.documentElement.style) ||
// is firebug? http://stackoverflow.com/a/398120/376773
(window.console && (console.firebug || (console.exception && console.table))) ||
// is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
}
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
exports.formatters.j = function(v) {
return JSON.stringify(v);
};
/**
* Colorize log arguments if enabled.
*
* @api public
*/
function formatArgs() {
var args = arguments;
var useColors = this.useColors;
args[0] = (useColors ? '%c' : '')
+ this.namespace
+ (useColors ? ' %c' : ' ')
+ args[0]
+ (useColors ? '%c ' : ' ')
+ '+' + exports.humanize(this.diff);
if (!useColors) return args;
var c = 'color: ' + this.color;
args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
// the final "%c" is somewhat tricky, because there could be other
// arguments passed either before or after the %c, so we need to
// figure out the correct index to insert the CSS into
var index = 0;
var lastC = 0;
args[0].replace(/%[a-z%]/g, function(match) {
if ('%%' === match) return;
index++;
if ('%c' === match) {
// we only are interested in the *last* %c
// (the user may have provided their own)
lastC = index;
}
});
args.splice(lastC, 0, c);
return args;
}
/**
* Invokes `console.log()` when available.
* No-op when `console.log` is not a "function".
*
* @api public
*/
function log() {
// this hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply'
return 'object' === typeof console
&& console.log
&& Function.prototype.apply.call(console.log, console, arguments);
}
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
try {
if (null == namespaces) {
storage.removeItem('debug');
} else {
storage.debug = namespaces;
}
} catch(e) {}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
var r;
try {
r = storage.debug;
} catch(e) {}
return r;
}
/**
* Enable namespaces listed in `localStorage.debug` initially.
*/
exports.enable(load());
/**
* Localstorage attempts to return the localstorage.
*
* This is necessary because safari throws
* when a user disables cookies/localstorage
* and you attempt to access it.
*
* @return {LocalStorage}
* @api private
*/
function localstorage(){
try {
return window.localStorage;
} catch (e) {}
}
},{"./debug":30}],30:[function(require,module,exports){
/**
* This is the common logic for both the Node.js and web browser
* implementations of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = debug;
exports.coerce = coerce;
exports.disable = disable;
exports.enable = enable;
exports.enabled = enabled;
exports.humanize = require('ms');
/**
* The currently active debug mode names, and names to skip.
*/
exports.names = [];
exports.skips = [];
/**
* Map of special "%n" handling functions, for the debug "format" argument.
*
* Valid key names are a single, lowercased letter, i.e. "n".
*/
exports.formatters = {};
/**
* Previously assigned color.
*/
var prevColor = 0;
/**
* Previous log timestamp.
*/
var prevTime;
/**
* Select a color.
*
* @return {Number}
* @api private
*/
function selectColor() {
return exports.colors[prevColor++ % exports.colors.length];
}
/**
* Create a debugger with the given `namespace`.
*
* @param {String} namespace
* @return {Function}
* @api public
*/
function debug(namespace) {
// define the `disabled` version
function disabled() {
}
disabled.enabled = false;
// define the `enabled` version
function enabled() {
var self = enabled;
// set `diff` timestamp
var curr = +new Date();
var ms = curr - (prevTime || curr);
self.diff = ms;
self.prev = prevTime;
self.curr = curr;
prevTime = curr;
// add the `color` if not set
if (null == self.useColors) self.useColors = exports.useColors();
if (null == self.color && self.useColors) self.color = selectColor();
var args = Array.prototype.slice.call(arguments);
args[0] = exports.coerce(args[0]);
if ('string' !== typeof args[0]) {
// anything else let's inspect with %o
args = ['%o'].concat(args);
}
// apply any `formatters` transformations
var index = 0;
args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
// if we encounter an escaped % then don't increase the array index
if (match === '%%') return match;
index++;
var formatter = exports.formatters[format];
if ('function' === typeof formatter) {
var val = args[index];
match = formatter.call(self, val);
// now we need to remove `args[index]` since it's inlined in the `format`
args.splice(index, 1);
index--;
}
return match;
});
if ('function' === typeof exports.formatArgs) {
args = exports.formatArgs.apply(self, args);
}
var logFn = enabled.log || exports.log || console.log.bind(console);
logFn.apply(self, args);
}
enabled.enabled = true;
var fn = exports.enabled(namespace) ? enabled : disabled;
fn.namespace = namespace;
return fn;
}
/**
* Enables a debug mode by namespaces. This can include modes
* separated by a colon and wildcards.
*
* @param {String} namespaces
* @api public
*/
function enable(namespaces) {
exports.save(namespaces);
var split = (namespaces || '').split(/[\s,]+/);
var len = split.length;
for (var i = 0; i < len; i++) {
if (!split[i]) continue; // ignore empty strings
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
} else {
exports.names.push(new RegExp('^' + namespaces + '$'));
}
}
}
/**
* Disable debug output.
*
* @api public
*/
function disable() {
exports.enable('');
}
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
function enabled(name) {
var i, len;
for (i = 0, len = exports.skips.length; i < len; i++) {
if (exports.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = exports.names.length; i < len; i++) {
if (exports.names[i].test(name)) {
return true;
}
}
return false;
}
/**
* Coerce `val`.
*
* @param {Mixed} val
* @return {Mixed}
* @api private
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
},{"ms":31}],31:[function(require,module,exports){
/**
* Helpers.
*/
var s = 1000;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var y = d * 365.25;
/**
* Parse or format the given `val`.
*
* Options:
*
* - `long` verbose formatting [false]
*
* @param {String|Number} val
* @param {Object} options
* @return {String|Number}
* @api public
*/
module.exports = function(val, options){
options = options || {};
if ('string' == typeof val) return parse(val);
return options.long
? long(val)
: short(val);
};
/**
* Parse the given `str` and return milliseconds.
*
* @param {String} str
* @return {Number}
* @api private
*/
function parse(str) {
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
if (!match) return;
var n = parseFloat(match[1]);
var type = (match[2] || 'ms').toLowerCase();
switch (type) {
case 'years':
case 'year':
case 'yrs':
case 'yr':
case 'y':
return n * y;
case 'days':
case 'day':
case 'd':
return n * d;
case 'hours':
case 'hour':
case 'hrs':
case 'hr':
case 'h':
return n * h;
case 'minutes':
case 'minute':
case 'mins':
case 'min':
case 'm':
return n * m;
case 'seconds':
case 'second':
case 'secs':
case 'sec':
case 's':
return n * s;
case 'milliseconds':
case 'millisecond':
case 'msecs':
case 'msec':
case 'ms':
return n;
}
}
/**
* Short format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function short(ms) {
if (ms >= d) return Math.round(ms / d) + 'd';
if (ms >= h) return Math.round(ms / h) + 'h';
if (ms >= m) return Math.round(ms / m) + 'm';
if (ms >= s) return Math.round(ms / s) + 's';
return ms + 'ms';
}
/**
* Long format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function long(ms) {
return plural(ms, d, 'day')
|| plural(ms, h, 'hour')
|| plural(ms, m, 'minute')
|| plural(ms, s, 'second')
|| ms + ' ms';
}
/**
* Pluralization helper.
*/
function plural(ms, n, name) {
if (ms < n) return;
if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
return Math.ceil(ms / n) + ' ' + name + 's';
}
},{}],32:[function(require,module,exports){
(function (global){
/**
* Expose the Adapter function/object.
*/
module.exports = Adapter;
/**
* Dependencies.
*/
var browser = require('bowser').browser;
var debug = require('debug')('rtcninja:Adapter');
var debugerror = require('debug')('rtcninja:ERROR:Adapter');
debugerror.log = console.warn.bind(console);
/**
* Local variables.
*/
var getUserMedia = null;
var RTCPeerConnection = null;
var RTCSessionDescription = null;
var RTCIceCandidate = null;
var MediaStreamTrack = null;
var getMediaDevices = null;
var attachMediaStream = null;
var canRenegotiate = false;
var oldSpecRTCOfferOptions = false;
var browserVersion = Number(browser.version) || 0;
var isDesktop = !!(! browser.mobile || ! browser.tablet);
var hasWebRTC = false;
var _navigator = global.navigator || {}; // Don't fail in Node.
function Adapter(options) {
// Chrome desktop, Chrome Android, Opera desktop, Opera Android, Android native browser
// or generic Webkit browser.
if (
(isDesktop && browser.chrome && browserVersion >= 32) ||
(browser.android && browser.chrome && browserVersion >= 39) ||
(isDesktop && browser.opera && browserVersion >= 27) ||
(browser.android && browser.opera && browserVersion >= 24) ||
(browser.android && browser.webkit && ! browser.chrome && browserVersion >= 37) ||
(_navigator.webkitGetUserMedia && global.webkitRTCPeerConnection)
) {
hasWebRTC = true;
getUserMedia = _navigator.webkitGetUserMedia.bind(_navigator);
RTCPeerConnection = global.webkitRTCPeerConnection;
RTCSessionDescription = global.RTCSessionDescription;
RTCIceCandidate = global.RTCIceCandidate;
MediaStreamTrack = global.MediaStreamTrack;
if (MediaStreamTrack && MediaStreamTrack.getSources) {
getMediaDevices = MediaStreamTrack.getSources.bind(MediaStreamTrack);
} else if (_navigator.getMediaDevices) {
getMediaDevices = _navigator.getMediaDevices.bind(_navigator);
}
attachMediaStream = function(element, stream) {
element.src = URL.createObjectURL(stream);
return element;
};
canRenegotiate = true;
oldSpecRTCOfferOptions = false;
}
// Firefox desktop, Firefox Android.
else if (
(isDesktop && browser.firefox && browserVersion >= 22) ||
(browser.android && browser.firefox && browserVersion >= 33) ||
(_navigator.mozGetUserMedia && global.mozRTCPeerConnection)
) {
hasWebRTC = true;
getUserMedia = _navigator.mozGetUserMedia.bind(_navigator);
RTCPeerConnection = global.mozRTCPeerConnection;
RTCSessionDescription = global.mozRTCSessionDescription;
RTCIceCandidate = global.mozRTCIceCandidate;
MediaStreamTrack = global.MediaStreamTrack;
attachMediaStream = function(element, stream) {
element.src = URL.createObjectURL(stream);
return element;
};
canRenegotiate = false;
oldSpecRTCOfferOptions = false;
}
// WebRTC plugin required. For example IE or Safari with the Temasys plugin.
else if (
options.plugin &&
typeof options.plugin.isRequired === 'function' &&
options.plugin.isRequired() &&
typeof options.plugin.isInstalled === 'function' &&
options.plugin.isInstalled()
) {
var pluginInterface = options.plugin.interface;
hasWebRTC = true;
getUserMedia = pluginInterface.getUserMedia;
RTCPeerConnection = pluginInterface.RTCPeerConnection;
RTCSessionDescription = pluginInterface.RTCSessionDescription;
RTCIceCandidate = pluginInterface.RTCIceCandidate;
MediaStreamTrack = pluginInterface.MediaStreamTrack;
if (MediaStreamTrack && MediaStreamTrack.getSources) {
getMediaDevices = MediaStreamTrack.getSources.bind(MediaStreamTrack);
} else if (_navigator.getMediaDevices) {
getMediaDevices = _navigator.getMediaDevices.bind(_navigator);
}
attachMediaStream = pluginInterface.attachMediaStream;
canRenegotiate = pluginInterface.canRenegotiate;
oldSpecRTCOfferOptions = true; // TODO: Update when fixed in the plugin.
}
// Best effort (may be adater.js is loaded).
else if (_navigator.getUserMedia && global.RTCPeerConnection) {
hasWebRTC = true;
getUserMedia = _navigator.getUserMedia.bind(_navigator);
RTCPeerConnection = global.RTCPeerConnection;
RTCSessionDescription = global.RTCSessionDescription;
RTCIceCandidate = global.RTCIceCandidate;
MediaStreamTrack = global.MediaStreamTrack;
if (MediaStreamTrack && MediaStreamTrack.getSources) {
getMediaDevices = MediaStreamTrack.getSources.bind(MediaStreamTrack);
} else if (_navigator.getMediaDevices) {
getMediaDevices = _navigator.getMediaDevices.bind(_navigator);
}
attachMediaStream = global.attachMediaStream || function(element, stream) {
element.src = URL.createObjectURL(stream);
return element;
};
canRenegotiate = false;
oldSpecRTCOfferOptions = false;
}
function throwNonSupported(item) {
return function() {
throw new Error('rtcninja: WebRTC not supported, missing ' +item+ ' [browser: ' +browser.name+ ' ' +browser.version + ']');
};
}
// Expose a WebRTC checker.
Adapter.hasWebRTC = function() {
return hasWebRTC;
};
// Expose getUserMedia.
if (getUserMedia) {
Adapter.getUserMedia = function(constraints, successCallback, errorCallback) {
debug('getUserMedia() | constraints:', constraints);
try {
getUserMedia(constraints,
function(stream) {
debug('getUserMedia() | success');
if (successCallback) { successCallback(stream); }
},
function(error) {
debug('getUserMedia() | error:', error);
if (errorCallback) { errorCallback(error); }
}
);
}
catch(error) {
debugerror('getUserMedia() | error:', error);
if (errorCallback) { errorCallback(error); }
}
};
}
else {
Adapter.getUserMedia = function(constraints, successCallback, errorCallback) {
debugerror('getUserMedia() | WebRTC not supported');
if (errorCallback) {
errorCallback(new Error('rtcninja: WebRTC not supported, missing getUserMedia [browser: ' +browser.name+ ' ' +browser.version + ']'));
}
else {
throwNonSupported('getUserMedia');
}
};
}
// Expose RTCPeerConnection.
Adapter.RTCPeerConnection = RTCPeerConnection || throwNonSupported('RTCPeerConnection');
// Expose RTCSessionDescription.
Adapter.RTCSessionDescription = RTCSessionDescription || throwNonSupported('RTCSessionDescription');
// Expose RTCIceCandidate.
Adapter.RTCIceCandidate = RTCIceCandidate || throwNonSupported('RTCIceCandidate');
// Expose MediaStreamTrack.
Adapter.MediaStreamTrack = MediaStreamTrack || throwNonSupported('MediaStreamTrack');
// Expose getMediaDevices.
Adapter.getMediaDevices = getMediaDevices;
// Expose MediaStreamTrack.
Adapter.attachMediaStream = attachMediaStream || throwNonSupported('attachMediaStream');
// Expose canRenegotiate attribute.
Adapter.canRenegotiate = canRenegotiate;
// Expose closeMediaStream.
Adapter.closeMediaStream = function(stream) {
if (! stream) { return; }
// Latest spec states that MediaStream has no stop() method and instead must
// call stop() on every MediaStreamTrack.
if (MediaStreamTrack && MediaStreamTrack.prototype && MediaStreamTrack.prototype.stop) {
debug('closeMediaStream() | calling stop() on all the MediaStreamTrack');
var tracks, i, len;
if (stream.getTracks) {
tracks = stream.getTracks();
for (i=0, len=tracks.length; i<len; i++) {
tracks[i].stop();
}
}
else {
tracks = stream.getAudioTracks();
for (i=0, len=tracks.length; i<len; i++) {
tracks[i].stop();
}
tracks = stream.getVideoTracks();
for (i=0, len=tracks.length; i<len; i++) {
tracks[i].stop();
}
}
}
// Deprecated by the spec, but still in use.
else if (typeof stream.stop === 'function') {
debug('closeMediaStream() | calling stop() on the MediaStream');
stream.stop();
}
};
// Expose fixPeerConnectionConfig.
Adapter.fixPeerConnectionConfig = function(pcConfig) {
if (! Array.isArray(pcConfig.iceServers)) {
pcConfig.iceServers = [];
}
for (var i=0, len=pcConfig.iceServers.length; i < len; i++) {
var iceServer = pcConfig.iceServers[i];
var hasUrls = iceServer.hasOwnProperty('urls');
var hasUrl = iceServer.hasOwnProperty('url');
if (typeof iceServer !== 'object') { continue; }
// Has .urls but not .url, so add .url with a single string value.
if (hasUrls && ! hasUrl) {
iceServer.url = (Array.isArray(iceServer.urls) ? iceServer.urls[0] : iceServer.urls);
}
// Has .url but not .urls, so add .urls with same value.
else if (! hasUrls && hasUrl) {
iceServer.urls = (Array.isArray(iceServer.url) ? iceServer.url.slice() : iceServer.url);
}
// Ensure .url is a single string.
if (hasUrl && Array.isArray(iceServer.url)) {
iceServer.url = iceServer.url[0];
}
}
};
// Expose fixRTCOfferOptions.
Adapter.fixRTCOfferOptions = function(options) {
options = options || {};
// New spec.
if (! oldSpecRTCOfferOptions) {
if (options.mandatory && options.mandatory.OfferToReceiveAudio) {
options.offerToReceiveAudio = 1;
}
if (options.mandatory && options.mandatory.OfferToReceiveVideo) {
options.offerToReceiveVideo = 1;
}
delete options.mandatory;
}
// Old spec.
else {
if (options.offerToReceiveAudio) {
options.mandatory = options.mandatory || {};
options.mandatory.OfferToReceiveAudio = true;
}
if (options.offerToReceiveVideo) {
options.mandatory = options.mandatory || {};
options.mandatory.OfferToReceiveVideo = true;
}
}
};
return Adapter;
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"bowser":36,"debug":29}],33:[function(require,module,exports){
/**
* Expose the RTCPeerConnection class.
*/
module.exports = RTCPeerConnection;
/**
* Dependencies.
*/
var merge = require('merge');
var debug = require('debug')('rtcninja:RTCPeerConnection');
var debugerror = require('debug')('rtcninja:ERROR:RTCPeerConnection');
debugerror.log = console.warn.bind(console);
var Adapter = require('./Adapter');
/**
* Internal constants.
*/
var C = {
REGEXP_NORMALIZED_CANDIDATE: new RegExp(/^candidate:/i),
REGEXP_FIX_CANDIDATE: new RegExp(/(^a=|\r|\n)/gi),
REGEXP_RELAY_CANDIDATE: new RegExp(/ relay /i),
REGEXP_SDP_CANDIDATES: new RegExp(/^a=candidate:.*\r\n/igm),
REGEXP_SDP_NON_RELAY_CANDIDATES: new RegExp(/^a=candidate:(.(?! relay ))*\r\n/igm)
};
/**
* Internal variables.
*/
var VAR = {
normalizeCandidate: null
};
function RTCPeerConnection(pcConfig, pcConstraints) {
debug('new | pcConfig:', pcConfig);
// Set this.pcConfig and this.options.
setConfigurationAndOptions.call(this, pcConfig);
// NOTE: Deprecated pcConstraints argument.
this.pcConstraints = pcConstraints;
// Own version of the localDescription.
this._localDescription = null;
// Latest values of PC attributes to avoid events with same value.
this._signalingState = null;
this._iceConnectionState = null;
this._iceGatheringState = null;
// Timer for options.gatheringTimeout.
this.timerGatheringTimeout = null;
// Timer for options.gatheringTimeoutAfterRelay.
this.timerGatheringTimeoutAfterRelay = null;
// Flag to ignore new gathered ICE candidates.
this.ignoreIceGathering = false;
// Flag set when closed.
this.closed = false;
// Set RTCPeerConnection.
setPeerConnection.call(this);
// Set properties.
setProperties.call(this);
}
/**
* Public API.
*/
RTCPeerConnection.prototype.createOffer = function(successCallback, failureCallback, options) {
debug('createOffer()');
var self = this;
Adapter.fixRTCOfferOptions(options);
this.pc.createOffer(
function(offer) {
if (isClosed.call(self)) { return; }
debug('createOffer() | success');
if (successCallback) { successCallback(offer); }
},
function(error) {
if (isClosed.call(self)) { return; }
debugerror('createOffer() | error:', error);
if (failureCallback) { failureCallback(error); }
},
options
);
};
RTCPeerConnection.prototype.createAnswer = function(successCallback, failureCallback, options) {
debug('createAnswer()');
var self = this;
this.pc.createAnswer(
function(answer) {
if (isClosed.call(self)) { return; }
debug('createAnswer() | success');
if (successCallback) { successCallback(answer); }
},
function(error) {
if (isClosed.call(self)) { return; }
debugerror('createAnswer() | error:', error);
if (failureCallback) { failureCallback(error); }
},
options
);
};
RTCPeerConnection.prototype.setLocalDescription = function(description, successCallback, failureCallback) {
debug('setLocalDescription()');
var self = this;
this.pc.setLocalDescription(
description,
// success.
function() {
if (isClosed.call(self)) { return; }
debug('setLocalDescription() | success');
// Clear gathering timers.
clearTimeout(self.timerGatheringTimeout);
delete self.timerGatheringTimeout;
clearTimeout(self.timerGatheringTimeoutAfterRelay);
delete self.timerGatheringTimeoutAfterRelay;
runTimerGatheringTimeout();
if (successCallback) { successCallback(); }
},
// failure
function(error) {
if (isClosed.call(self)) { return; }
debugerror('setLocalDescription() | error:', error);
if (failureCallback) { failureCallback(error); }
}
);
// Enable (again) ICE gathering.
this.ignoreIceGathering = false;
// Handle gatheringTimeout.
function runTimerGatheringTimeout() {
if (typeof self.options.gatheringTimeout !== 'number') { return; }
// If setLocalDescription was already called, it may happen that
// ICE gathering is not needed, so don't run this timer.
if (self.pc.iceGatheringState === 'complete') { return; }
debug('setLocalDescription() | ending gathering in %d ms (gatheringTimeout option)', self.options.gatheringTimeout);
self.timerGatheringTimeout = setTimeout(function() {
if (isClosed.call(self)) { return; }
debug('forced end of candidates after gatheringTimeout timeout');
// Clear gathering timers.
delete self.timerGatheringTimeout;
clearTimeout(self.timerGatheringTimeoutAfterRelay);
delete self.timerGatheringTimeoutAfterRelay;
// Ignore new candidates.
self.ignoreIceGathering = true;
if (self.onicecandidate) { self.onicecandidate({candidate: null}, null); }
}, self.options.gatheringTimeout);
}
};
RTCPeerConnection.prototype.setRemoteDescription = function(description, successCallback, failureCallback) {
debug('setRemoteDescription()');
var self = this;
this.pc.setRemoteDescription(
description,
function() {
if (isClosed.call(self)) { return; }
debug('setRemoteDescription() | success');
if (successCallback) { successCallback(); }
},
function(error) {
if (isClosed.call(self)) { return; }
debugerror('setRemoteDescription() | error:', error);
if (failureCallback) { failureCallback(error); }
}
);
};
RTCPeerConnection.prototype.updateIce = function(pcConfig) {
debug('updateIce() | pcConfig:', pcConfig);
// Update this.pcConfig and this.options.
setConfigurationAndOptions.call(this, pcConfig);
this.pc.updateIce(this.pcConfig);
// Enable (again) ICE gathering.
this.ignoreIceGathering = false;
};
RTCPeerConnection.prototype.addIceCandidate = function(candidate, successCallback, failureCallback) {
debug('addIceCandidate() | candidate:', candidate);
var self = this;
this.pc.addIceCandidate(
candidate,
function() {
if (isClosed.call(self)) { return; }
debug('addIceCandidate() | success');
if (successCallback) { successCallback(); }
},
function(error) {
if (isClosed.call(self)) { return; }
debugerror('addIceCandidate() | error:', error);
if (failureCallback) { failureCallback(error); }
}
);
};
RTCPeerConnection.prototype.getConfiguration = function() {
debug('getConfiguration()');
return this.pc.getConfiguration();
};
RTCPeerConnection.prototype.getLocalStreams = function() {
debug('getLocalStreams()');
return this.pc.getLocalStreams();
};
RTCPeerConnection.prototype.getRemoteStreams = function() {
debug('getRemoteStreams()');
return this.pc.getRemoteStreams();
};
RTCPeerConnection.getStreamById = function(streamId) {
debug('getStreamById() | streamId:', streamId);
this.pc.getStreamById(streamId);
};
RTCPeerConnection.prototype.addStream = function(stream) {
debug('addStream() | stream:', stream);
this.pc.addStream(stream);
};
RTCPeerConnection.prototype.removeStream = function(stream) {
debug('removeStream() | stream:', stream);
this.pc.removeStream(stream);
};
RTCPeerConnection.prototype.close = function() {
debug('close()');
this.closed = true;
// Clear gathering timers.
clearTimeout(this.timerGatheringTimeout);
delete this.timerGatheringTimeout;
clearTimeout(this.timerGatheringTimeoutAfterRelay);
delete this.timerGatheringTimeoutAfterRelay;
this.pc.close();
};
RTCPeerConnection.prototype.createDataChannel = function() {
debug('createDataChannel()');
return this.pc.createDataChannel.apply(this.pc, arguments);
};
RTCPeerConnection.prototype.createDTMFSender = function(track) {
debug('createDTMFSender()');
return this.pc.createDTMFSender(track);
};
RTCPeerConnection.prototype.getStats = function() {
debug('getStats()');
return this.pc.getStats.apply(this.pc, arguments);
};
RTCPeerConnection.prototype.setIdentityProvider = function() {
debug('setIdentityProvider()');
return this.pc.setIdentityProvider.apply(this.pc, arguments);
};
RTCPeerConnection.prototype.getIdentityAssertion = function() {
debug('getIdentityAssertion()');
return this.pc.getIdentityAssertion();
};
/**
* Custom public API.
*/
RTCPeerConnection.prototype.reset = function(pcConfig) {
debug('reset() | pcConfig:', pcConfig);
var pc = this.pc;
// Remove events in the old PC.
pc.onnegotiationneeded = null;
pc.onicecandidate = null;
pc.onaddstream = null;
pc.onremovestream = null;
pc.ondatachannel = null;
pc.onsignalingstatechange = null;
pc.oniceconnectionstatechange = null;
pc.onicegatheringstatechange = null;
pc.onidentityresult = null;
pc.onpeeridentity = null;
pc.onidpassertionerror = null;
pc.onidpvalidationerror = null;
// Clear gathering timers.
clearTimeout(this.timerGatheringTimeout);
delete this.timerGatheringTimeout;
clearTimeout(this.timerGatheringTimeoutAfterRelay);
delete this.timerGatheringTimeoutAfterRelay;
// Silently close the old PC.
debug('reset() | closing current peerConnection');
pc.close();
// Set this.pcConfig and this.options.
setConfigurationAndOptions.call(this, pcConfig);
// Create a new PC.
setPeerConnection.call(this);
};
/**
* Private API.
*/
function isClosed() {
return (
(this.closed) ||
(this.pc && this.pc.iceConnectionState === 'closed')
);
}
function setConfigurationAndOptions(pcConfig) {
// Clone pcConfig.
this.pcConfig = merge(true, pcConfig);
// Fix pcConfig.
Adapter.fixPeerConnectionConfig(this.pcConfig);
this.options = {
iceTransportsRelay: (this.pcConfig.iceTransports === 'relay'),
iceTransportsNone: (this.pcConfig.iceTransports === 'none'),
gatheringTimeout: this.pcConfig.gatheringTimeout,
gatheringTimeoutAfterRelay: this.pcConfig.gatheringTimeoutAfterRelay
};
// Remove custom rtcninja.RTCPeerConnection options from pcConfig.
delete this.pcConfig.gatheringTimeout;
delete this.pcConfig.gatheringTimeoutAfterRelay;
debug('setConfigurationAndOptions | processed pcConfig:', this.pcConfig);
}
function setPeerConnection() {
// Create a RTCPeerConnection.
if (! this.pcConstraints) {
this.pc = new Adapter.RTCPeerConnection(this.pcConfig);
}
else {
// NOTE: Deprecated.
this.pc = new Adapter.RTCPeerConnection(this.pcConfig, this.pcConstraints);
}
// Set RTC events.
setEvents.call(this);
}
function setEvents() {
var self = this;
var pc = this.pc;
pc.onnegotiationneeded = function(event) {
if (isClosed.call(self)) { return; }
debug('onnegotiationneeded()');
if (self.onnegotiationneeded) { self.onnegotiationneeded(event); }
};
pc.onicecandidate = function(event) {
if (isClosed.call(self)) { return; }
if (self.ignoreIceGathering) { return; }
// Ignore any candidate (event the null one) if iceTransports:'none' is set.
if (self.options.iceTransportsNone) { return; }
var candidate = event.candidate;
if (candidate) {
var isRelay = C.REGEXP_RELAY_CANDIDATE.test(candidate.candidate);
// Ignore if just relay candidates are requested.
if (self.options.iceTransportsRelay && ! isRelay) {
return;
}
// Handle gatheringTimeoutAfterRelay.
if (isRelay && ! self.timerGatheringTimeoutAfterRelay && (typeof self.options.gatheringTimeoutAfterRelay === 'number')) {
debug('onicecandidate() | first relay candidate found, ending gathering in %d ms', self.options.gatheringTimeoutAfterRelay);
self.timerGatheringTimeoutAfterRelay = setTimeout(function() {
if (isClosed.call(self)) { return; }
debug('forced end of candidates after timeout');
// Clear gathering timers.
delete self.timerGatheringTimeoutAfterRelay;
clearTimeout(self.timerGatheringTimeout);
delete self.timerGatheringTimeout;
// Ignore new candidates.
self.ignoreIceGathering = true;
if (self.onicecandidate) { self.onicecandidate({candidate: null}, null); }
}, self.options.gatheringTimeoutAfterRelay);
}
var newCandidate = new Adapter.RTCIceCandidate({
sdpMid: candidate.sdpMid,
sdpMLineIndex: candidate.sdpMLineIndex,
candidate: candidate.candidate
});
// Force correct candidate syntax (just check it once).
if (VAR.normalizeCandidate === null) {
if (C.REGEXP_NORMALIZED_CANDIDATE.test(candidate.candidate)) {
VAR.normalizeCandidate = false;
}
else {
debug('onicecandidate() | normalizing ICE candidates syntax (remove "a=" and "\\r\\n")');
VAR.normalizeCandidate = true;
}
}
if (VAR.normalizeCandidate) {
newCandidate.candidate = candidate.candidate.replace(C.REGEXP_FIX_CANDIDATE, '');
}
debug('onicecandidate() | m%d(%s) %s', newCandidate.sdpMLineIndex, newCandidate.sdpMid || 'no mid', newCandidate.candidate);
if (self.onicecandidate) { self.onicecandidate(event, newCandidate); }
}
// Null candidate (end of candidates).
else {
debug('onicecandidate() | end of candidates');
// Clear gathering timers.
clearTimeout(self.timerGatheringTimeout);
delete self.timerGatheringTimeout;
clearTimeout(self.timerGatheringTimeoutAfterRelay);
delete self.timerGatheringTimeoutAfterRelay;
if (self.onicecandidate) { self.onicecandidate(event, null); }
}
};
pc.onaddstream = function(event) {
if (isClosed.call(self)) { return; }
debug('onaddstream() | stream:', event.stream);
if (self.onaddstream) { self.onaddstream(event, event.stream); }
};
pc.onremovestream = function(event) {
if (isClosed.call(self)) { return; }
debug('onremovestream() | stream:', event.stream);
if (self.onremovestream) { self.onremovestream(event, event.stream); }
};
pc.ondatachannel = function(event) {
if (isClosed.call(self)) { return; }
debug('ondatachannel()');
if (self.ondatachannel) { self.ondatachannel(event, event.channel); }
};
pc.onsignalingstatechange = function(event) {
if (pc.signalingState === self._signalingState) { return; }
debug('onsignalingstatechange() | signalingState: %s', pc.signalingState);
self._signalingState = pc.signalingState;
if (self.onsignalingstatechange) { self.onsignalingstatechange(event, pc.signalingState); }
};
pc.oniceconnectionstatechange = function(event) {
if (pc.iceConnectionState === self._iceConnectionState) { return; }
debug('oniceconnectionstatechange() | iceConnectionState: %s', pc.iceConnectionState);
self._iceConnectionState = pc.iceConnectionState;
if (self.oniceconnectionstatechange) { self.oniceconnectionstatechange(event, pc.iceConnectionState); }
};
pc.onicegatheringstatechange = function(event) {
if (isClosed.call(self)) { return; }
if (pc.iceGatheringState === self._iceGatheringState) { return; }
debug('onicegatheringstatechange() | iceGatheringState: %s', pc.iceGatheringState);
self._iceGatheringState = pc.iceGatheringState;
if (self.onicegatheringstatechange) { self.onicegatheringstatechange(event, pc.iceGatheringState); }
};
pc.onidentityresult = function(event) {
if (isClosed.call(self)) { return; }
debug('onidentityresult()');
if (self.onidentityresult) { self.onidentityresult(event); }
};
pc.onpeeridentity = function(event) {
if (isClosed.call(self)) { return; }
debug('onpeeridentity()');
if (self.onpeeridentity) { self.onpeeridentity(event); }
};
pc.onidpassertionerror = function(event) {
if (isClosed.call(self)) { return; }
debug('onidpassertionerror()');
if (self.onidpassertionerror) { self.onidpassertionerror(event); }
};
pc.onidpvalidationerror = function(event) {
if (isClosed.call(self)) { return; }
debug('onidpvalidationerror()');
if (self.onidpvalidationerror) { self.onidpvalidationerror(event); }
};
}
function setProperties() {
var self = this;
Object.defineProperties(this, {
peerConnection: {
get: function() { return self.pc; }
},
signalingState: {
get: function() { return self.pc.signalingState; }
},
iceConnectionState: {
get: function() { return self.pc.iceConnectionState; }
},
iceGatheringState: {
get: function() { return self.pc.iceGatheringState; }
},
localDescription: {
get: function() {
return getLocalDescription.call(self);
}
},
remoteDescription: {
get: function() {
return self.pc.remoteDescription;
}
},
peerIdentity: {
get: function() { return self.pc.peerIdentity; }
},
});
}
function getLocalDescription() {
var pc = this.pc;
var options = this.options;
var sdp = null;
if (! pc.localDescription) {
this._localDescription = null;
return null;
}
// Mangle the SDP string.
if (options.iceTransportsRelay) {
sdp = pc.localDescription.sdp.replace(C.REGEXP_SDP_NON_RELAY_CANDIDATES, '');
}
else if (options.iceTransportsNone) {
sdp = pc.localDescription.sdp.replace(C.REGEXP_SDP_CANDIDATES, '');
}
this._localDescription = new Adapter.RTCSessionDescription({
type: pc.localDescription.type,
sdp: sdp || pc.localDescription.sdp
});
return this._localDescription;
}
},{"./Adapter":32,"debug":29,"merge":37}],34:[function(require,module,exports){
/**
* Expose the rtcninja function/object.
*/
module.exports = rtcninja;
/**
* Dependencies.
*/
var browser = require('bowser').browser;
var debug = require('debug')('rtcninja');
var debugerror = require('debug')('rtcninja:ERROR');
debugerror.log = console.warn.bind(console);
var version = require('./version');
var Adapter = require('./Adapter');
var RTCPeerConnection = require('./RTCPeerConnection');
/**
* Local variables.
*/
var called = false;
debug('version %s', version);
debug('detected browser: %s %s [mobile:%s, tablet:%s, android:%s, ios:%s]', browser.name, browser.version, !!browser.mobile, !!browser.tablet, !!browser.android, !!browser.ios);
function rtcninja(options) {
// Load adapter.
var interface = Adapter(options || {}); // jshint ignore:line
called = true;
// Expose RTCPeerConnection class.
rtcninja.RTCPeerConnection = RTCPeerConnection;
// Expose WebRTC API and utils.
rtcninja.getUserMedia = interface.getUserMedia;
rtcninja.RTCSessionDescription = interface.RTCSessionDescription;
rtcninja.RTCIceCandidate = interface.RTCIceCandidate;
rtcninja.MediaStreamTrack = interface.MediaStreamTrack;
rtcninja.getMediaDevices = interface.getMediaDevices;
rtcninja.attachMediaStream = interface.attachMediaStream;
rtcninja.closeMediaStream = interface.closeMediaStream;
rtcninja.canRenegotiate = interface.canRenegotiate;
// Log WebRTC support.
if (interface.hasWebRTC()) {
debug('WebRTC supported');
return true;
}
else {
debugerror('WebRTC not supported');
return false;
}
}
// If called without calling rtcninja(), call it.
rtcninja.hasWebRTC = function() {
if (! called) {
rtcninja();
}
return Adapter.hasWebRTC();
};
// Expose version property.
Object.defineProperty(rtcninja, 'version', {
get: function() {
return version;
}
});
// Expose called property.
Object.defineProperty(rtcninja, 'called', {
get: function() {
return called;
}
});
// Expose debug module.
rtcninja.debug = require('debug');
// Expose browser.
rtcninja.browser = browser;
},{"./Adapter":32,"./RTCPeerConnection":33,"./version":35,"bowser":36,"debug":29}],35:[function(require,module,exports){
/**
* Expose the 'version' field of package.json.
*/
module.exports = require('../package.json').version;
},{"../package.json":38}],36:[function(require,module,exports){
/*!
* Bowser - a browser detector
* https://github.com/ded/bowser
* MIT License | (c) Dustin Diaz 2014
*/
!function (name, definition) {
if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition()
else if (typeof define == 'function' && define.amd) define(definition)
else this[name] = definition()
}('bowser', function () {
/**
* See useragents.js for examples of navigator.userAgent
*/
var t = true
function detect(ua) {
function getFirstMatch(regex) {
var match = ua.match(regex);
return (match && match.length > 1 && match[1]) || '';
}
var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()
, likeAndroid = /like android/i.test(ua)
, android = !likeAndroid && /android/i.test(ua)
, versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i)
, tablet = /tablet/i.test(ua)
, mobile = !tablet && /[^-]mobi/i.test(ua)
, result
if (/opera|opr/i.test(ua)) {
result = {
name: 'Opera'
, opera: t
, version: versionIdentifier || getFirstMatch(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)
}
}
else if (/windows phone/i.test(ua)) {
result = {
name: 'Windows Phone'
, windowsphone: t
, msie: t
, version: getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i)
}
}
else if (/msie|trident/i.test(ua)) {
result = {
name: 'Internet Explorer'
, msie: t
, version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i)
}
}
else if (/chrome|crios|crmo/i.test(ua)) {
result = {
name: 'Chrome'
, chrome: t
, version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
}
}
else if (iosdevice) {
result = {
name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'
}
// WTF: version is not part of user agent in web apps
if (versionIdentifier) {
result.version = versionIdentifier
}
}
else if (/sailfish/i.test(ua)) {
result = {
name: 'Sailfish'
, sailfish: t
, version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
}
}
else if (/seamonkey\//i.test(ua)) {
result = {
name: 'SeaMonkey'
, seamonkey: t
, version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i)
}
}
else if (/firefox|iceweasel/i.test(ua)) {
result = {
name: 'Firefox'
, firefox: t
, version: getFirstMatch(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)
}
if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
result.firefoxos = t
}
}
else if (/silk/i.test(ua)) {
result = {
name: 'Amazon Silk'
, silk: t
, version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i)
}
}
else if (android) {
result = {
name: 'Android'
, version: versionIdentifier
}
}
else if (/phantom/i.test(ua)) {
result = {
name: 'PhantomJS'
, phantom: t
, version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i)
}
}
else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
result = {
name: 'BlackBerry'
, blackberry: t
, version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
}
}
else if (/(web|hpw)os/i.test(ua)) {
result = {
name: 'WebOS'
, webos: t
, version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
};
/touchpad\//i.test(ua) && (result.touchpad = t)
}
else if (/bada/i.test(ua)) {
result = {
name: 'Bada'
, bada: t
, version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
};
}
else if (/tizen/i.test(ua)) {
result = {
name: 'Tizen'
, tizen: t
, version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
};
}
else if (/safari/i.test(ua)) {
result = {
name: 'Safari'
, safari: t
, version: versionIdentifier
}
}
else result = {}
// set webkit or gecko flag for browsers based on these engines
if (/(apple)?webkit/i.test(ua)) {
result.name = result.name || "Webkit"
result.webkit = t
if (!result.version && versionIdentifier) {
result.version = versionIdentifier
}
} else if (!result.opera && /gecko\//i.test(ua)) {
result.name = result.name || "Gecko"
result.gecko = t
result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i)
}
// set OS flags for platforms that have multiple browsers
if (android || result.silk) {
result.android = t
} else if (iosdevice) {
result[iosdevice] = t
result.ios = t
}
// OS version extraction
var osVersion = '';
if (iosdevice) {
osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i);
osVersion = osVersion.replace(/[_\s]/g, '.');
} else if (android) {
osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i);
} else if (result.windowsphone) {
osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i);
} else if (result.webos) {
osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i);
} else if (result.blackberry) {
osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i);
} else if (result.bada) {
osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i);
} else if (result.tizen) {
osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i);
}
if (osVersion) {
result.osversion = osVersion;
}
// device type extraction
var osMajorVersion = osVersion.split('.')[0];
if (tablet || iosdevice == 'ipad' || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || result.silk) {
result.tablet = t
} else if (mobile || iosdevice == 'iphone' || iosdevice == 'ipod' || android || result.blackberry || result.webos || result.bada) {
result.mobile = t
}
// Graded Browser Support
// http://developer.yahoo.com/yui/articles/gbs
if ((result.msie && result.version >= 10) ||
(result.chrome && result.version >= 20) ||
(result.firefox && result.version >= 20.0) ||
(result.safari && result.version >= 6) ||
(result.opera && result.version >= 10.0) ||
(result.ios && result.osversion && result.osversion.split(".")[0] >= 6) ||
(result.blackberry && result.version >= 10.1)
) {
result.a = t;
}
else if ((result.msie && result.version < 10) ||
(result.chrome && result.version < 20) ||
(result.firefox && result.version < 20.0) ||
(result.safari && result.version < 6) ||
(result.opera && result.version < 10.0) ||
(result.ios && result.osversion && result.osversion.split(".")[0] < 6)
) {
result.c = t
} else result.x = t
return result
}
var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent : '')
/*
* Set our detect method to the main bowser object so we can
* reuse it to test other user agents.
* This is needed to implement future tests.
*/
bowser._detect = detect;
return bowser
});
},{}],37:[function(require,module,exports){
/*!
* @name JavaScript/NodeJS Merge v1.2.0
* @author yeikos
* @repository https://github.com/yeikos/js.merge
* Copyright 2014 yeikos - MIT license
* https://raw.github.com/yeikos/js.merge/master/LICENSE
*/
;(function(isNode) {
/**
* Merge one or more objects
* @param bool? clone
* @param mixed,... arguments
* @return object
*/
var Public = function(clone) {
return merge(clone === true, false, arguments);
}, publicName = 'merge';
/**
* Merge two or more objects recursively
* @param bool? clone
* @param mixed,... arguments
* @return object
*/
Public.recursive = function(clone) {
return merge(clone === true, true, arguments);
};
/**
* Clone the input removing any reference
* @param mixed input
* @return mixed
*/
Public.clone = function(input) {
var output = input,
type = typeOf(input),
index, size;
if (type === 'array') {
output = [];
size = input.length;
for (index=0;index<size;++index)
output[index] = Public.clone(input[index]);
} else if (type === 'object') {
output = {};
for (index in input)
output[index] = Public.clone(input[index]);
}
return output;
};
/**
* Merge two objects recursively
* @param mixed input
* @param mixed extend
* @return mixed
*/
function merge_recursive(base, extend) {
if (typeOf(base) !== 'object')
return extend;
for (var key in extend) {
if (typeOf(base[key]) === 'object' && typeOf(extend[key]) === 'object') {
base[key] = merge_recursive(base[key], extend[key]);
} else {
base[key] = extend[key];
}
}
return base;
}
/**
* Merge two or more objects
* @param bool clone
* @param bool recursive
* @param array argv
* @return object
*/
function merge(clone, recursive, argv) {
var result = argv[0],
size = argv.length;
if (clone || typeOf(result) !== 'object')
result = {};
for (var index=0;index<size;++index) {
var item = argv[index],
type = typeOf(item);
if (type !== 'object') continue;
for (var key in item) {
var sitem = clone ? Public.clone(item[key]) : item[key];
if (recursive) {
result[key] = merge_recursive(result[key], sitem);
} else {
result[key] = sitem;
}
}
}
return result;
}
/**
* Get type of variable
* @param mixed input
* @return string
*
* @see http://jsperf.com/typeofvar
*/
function typeOf(input) {
return ({}).toString.call(input).slice(8, -1).toLowerCase();
}
if (isNode) {
module.exports = Public;
} else {
window[publicName] = Public;
}
})(typeof module === 'object' && module && typeof module.exports === 'object' && module.exports);
},{}],38:[function(require,module,exports){
module.exports={
"name": "rtcninja",
"version": "0.5.4",
"description": "WebRTC API wrapper to deal with different browsers",
"author": {
"name": "Iñaki Baz Castillo",
"email": "inaki.baz@eface2face.com",
"url": "http://eface2face.com"
},
"license": "ISC",
"main": "lib/rtcninja.js",
"homepage": "https://github.com/eface2face/rtcninja.js",
"repository": {
"type": "git",
"url": "https://github.com/eface2face/rtcninja.js.git"
},
"keywords": [
"webrtc"
],
"engines": {
"node": ">=0.10.32"
},
"dependencies": {
"bowser": "^0.7.2",
"debug": "^2.1.3",
"merge": "^1.2.0"
},
"devDependencies": {
"browserify": "^9.0.8",
"gulp": "git+https://github.com/gulpjs/gulp.git#4.0",
"gulp-expect-file": "0.0.7",
"gulp-filelog": "^0.4.1",
"gulp-header": "^1.2.2",
"gulp-jshint": "^1.10.0",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.2.0",
"jshint-stylish": "^1.0.1",
"vinyl-source-stream": "^1.1.0"
},
"readme": "# rtcninja.js\n\nWebRTC API wrapper to deal with different browsers.\n\n\n## Installation\n\n* With **npm**:\n\n```bash\n$ npm install rtcninja\n```\n\n* With **bower**:\n\n```bash\n$ bower install rtcninja\n```\n\n## Usage in Node\n\n```javascript\nvar rtcninja = require('rtcninja');\n```\n\n\n## Browserified library\n\nTake a browserified version of the library from the `dist/` folder:\n\n* `dist/rtcninja-X.Y.Z.js`: The uncompressed version.\n* `dist/rtcninja-X.Y.Z.min.js`: The compressed production-ready version.\n* `dist/rtcninja.js`: A copy of the uncompressed version.\n* `dist/rtcninja.min.js`: A copy of the compressed version.\n\nThey expose the global `window.rtcninja` module.\n\n```html\n<script src='rtcninja-X.Y.Z.js'></script>\n```\n\n\n## Usage Example\n\n```javascript\n// Must first call it.\nrtcninja();\n\n// Then check.\nif (rtcninja.hasWebRTC()) {\n // Do something.\n}\nelse {\n // Do something.\n}\n```\n\n\n## Documentation\n\nYou can read the full [API documentation](docs/index.md) in the docs folder.\n\n\n## Debugging\n\nThe library includes the Node [debug](https://github.com/visionmedia/debug) module. In order to enable debugging:\n\nIn Node set the `DEBUG=rtcninja*` environment variable before running the application, or set it at the top of the script:\n\n```javascript\nprocess.env.DEBUG = 'rtcninja*';\n```\n\nIn the browser run `rtcninja.debug.enable('rtcninja*');` and reload the page. Note that the debugging settings are stored into the browser LocalStorage. To disable it run `rtcninja.debug.disable('rtcninja*');`.\n\n\n## Author\n\nIñaki Baz Castillo at [eFace2Face](http://eface2face.com).\n\n\n## License\n\nISC.\n",
"readmeFilename": "README.md",
"gitHead": "e55c21bf513343a2b188e6dab988ca83a297f15e",
"bugs": {
"url": "https://github.com/eface2face/rtcninja.js/issues"
},
"_id": "rtcninja@0.5.4",
"scripts": {},
"_shasum": "4255720bbc9dc4e7760da7b4c03ed28526228db7",
"_from": "rtcninja@>=0.5.4 <0.6.0"
}
},{}],39:[function(require,module,exports){
var grammar = module.exports = {
v: [{
name: 'version',
reg: /^(\d*)$/
}],
o: [{ //o=- 20518 0 IN IP4 203.0.113.1
// NB: sessionId will be a String in most cases because it is huge
name: 'origin',
reg: /^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,
names: ['username', 'sessionId', 'sessionVersion', 'netType', 'ipVer', 'address'],
format: "%s %s %d %s IP%d %s"
}],
// default parsing of these only (though some of these feel outdated)
s: [{ name: 'name' }],
i: [{ name: 'description' }],
u: [{ name: 'uri' }],
e: [{ name: 'email' }],
p: [{ name: 'phone' }],
z: [{ name: 'timezones' }], // TODO: this one can actually be parsed properly..
r: [{ name: 'repeats' }], // TODO: this one can also be parsed properly
//k: [{}], // outdated thing ignored
t: [{ //t=0 0
name: 'timing',
reg: /^(\d*) (\d*)/,
names: ['start', 'stop'],
format: "%d %d"
}],
c: [{ //c=IN IP4 10.47.197.26
name: 'connection',
reg: /^IN IP(\d) (\S*)/,
names: ['version', 'ip'],
format: "IN IP%d %s"
}],
b: [{ //b=AS:4000
push: 'bandwidth',
reg: /^(TIAS|AS|CT|RR|RS):(\d*)/,
names: ['type', 'limit'],
format: "%s:%s"
}],
m: [{ //m=video 51744 RTP/AVP 126 97 98 34 31
// NB: special - pushes to session
// TODO: rtp/fmtp should be filtered by the payloads found here?
reg: /^(\w*) (\d*) ([\w\/]*)(?: (.*))?/,
names: ['type', 'port', 'protocol', 'payloads'],
format: "%s %d %s %s"
}],
a: [
{ //a=rtpmap:110 opus/48000/2
push: 'rtp',
reg: /^rtpmap:(\d*) ([\w\-]*)\/(\d*)(?:\s*\/(\S*))?/,
names: ['payload', 'codec', 'rate', 'encoding'],
format: function (o) {
return (o.encoding) ?
"rtpmap:%d %s/%s/%s":
"rtpmap:%d %s/%s";
}
},
{ //a=fmtp:108 profile-level-id=24;object=23;bitrate=64000
push: 'fmtp',
reg: /^fmtp:(\d*) (\S*)/,
names: ['payload', 'config'],
format: "fmtp:%d %s"
},
{ //a=control:streamid=0
name: 'control',
reg: /^control:(.*)/,
format: "control:%s"
},
{ //a=rtcp:65179 IN IP4 193.84.77.194
name: 'rtcp',
reg: /^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,
names: ['port', 'netType', 'ipVer', 'address'],
format: function (o) {
return (o.address != null) ?
"rtcp:%d %s IP%d %s":
"rtcp:%d";
}
},
{ //a=rtcp-fb:98 trr-int 100
push: 'rtcpFbTrrInt',
reg: /^rtcp-fb:(\*|\d*) trr-int (\d*)/,
names: ['payload', 'value'],
format: "rtcp-fb:%d trr-int %d"
},
{ //a=rtcp-fb:98 nack rpsi
push: 'rtcpFb',
reg: /^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,
names: ['payload', 'type', 'subtype'],
format: function (o) {
return (o.subtype != null) ?
"rtcp-fb:%s %s %s":
"rtcp-fb:%s %s";
}
},
{ //a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
//a=extmap:1/recvonly URI-gps-string
push: 'ext',
reg: /^extmap:([\w_\/]*) (\S*)(?: (\S*))?/,
names: ['value', 'uri', 'config'], // value may include "/direction" suffix
format: function (o) {
return (o.config != null) ?
"extmap:%s %s %s":
"extmap:%s %s";
}
},
{
//a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR|2^20|1:32
push: 'crypto',
reg: /^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,
names: ['id', 'suite', 'config', 'sessionConfig'],
format: function (o) {
return (o.sessionConfig != null) ?
"crypto:%d %s %s %s":
"crypto:%d %s %s";
}
},
{ //a=setup:actpass
name: 'setup',
reg: /^setup:(\w*)/,
format: "setup:%s"
},
{ //a=mid:1
name: 'mid',
reg: /^mid:([^\s]*)/,
format: "mid:%s"
},
{ //a=msid:0c8b064d-d807-43b4-b434-f92a889d8587 98178685-d409-46e0-8e16-7ef0db0db64a
name: 'msid',
reg: /^msid:(.*)/,
format: "msid:%s"
},
{ //a=ptime:20
name: 'ptime',
reg: /^ptime:(\d*)/,
format: "ptime:%d"
},
{ //a=maxptime:60
name: 'maxptime',
reg: /^maxptime:(\d*)/,
format: "maxptime:%d"
},
{ //a=sendrecv
name: 'direction',
reg: /^(sendrecv|recvonly|sendonly|inactive)/
},
{ //a=ice-lite
name: 'icelite',
reg: /^(ice-lite)/
},
{ //a=ice-ufrag:F7gI
name: 'iceUfrag',
reg: /^ice-ufrag:(\S*)/,
format: "ice-ufrag:%s"
},
{ //a=ice-pwd:x9cml/YzichV2+XlhiMu8g
name: 'icePwd',
reg: /^ice-pwd:(\S*)/,
format: "ice-pwd:%s"
},
{ //a=fingerprint:SHA-1 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33
name: 'fingerprint',
reg: /^fingerprint:(\S*) (\S*)/,
names: ['type', 'hash'],
format: "fingerprint:%s %s"
},
{
//a=candidate:0 1 UDP 2113667327 203.0.113.1 54400 typ host
//a=candidate:1162875081 1 udp 2113937151 192.168.34.75 60017 typ host generation 0
//a=candidate:3289912957 2 udp 1845501695 193.84.77.194 60017 typ srflx raddr 192.168.34.75 rport 60017 generation 0
push:'candidates',
reg: /^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: generation (\d*))?/,
names: ['foundation', 'component', 'transport', 'priority', 'ip', 'port', 'type', 'raddr', 'rport', 'generation'],
format: function (o) {
var str = "candidate:%s %d %s %d %s %d typ %s";
// NB: candidate has two optional chunks, so %void middle one if it's missing
str += (o.raddr != null) ? " raddr %s rport %d" : "%v%v";
if (o.generation != null) {
str += " generation %d";
}
return str;
}
},
{ //a=end-of-candidates (keep after the candidates line for readability)
name: 'endOfCandidates',
reg: /^(end-of-candidates)/
},
{ //a=remote-candidates:1 203.0.113.1 54400 2 203.0.113.1 54401 ...
name: 'remoteCandidates',
reg: /^remote-candidates:(.*)/,
format: "remote-candidates:%s"
},
{ //a=ice-options:google-ice
name: 'iceOptions',
reg: /^ice-options:(\S*)/,
format: "ice-options:%s"
},
{ //a=ssrc:2566107569 cname:t9YU8M1UxTF8Y1A1
push: "ssrcs",
reg: /^ssrc:(\d*) ([\w_]*):(.*)/,
names: ['id', 'attribute', 'value'],
format: "ssrc:%d %s:%s"
},
{ //a=ssrc-group:FEC 1 2
push: "ssrcGroups",
reg: /^ssrc-group:(\w*) (.*)/,
names: ['semantics', 'ssrcs'],
format: "ssrc-group:%s %s"
},
{ //a=msid-semantic: WMS Jvlam5X3SX1OP6pn20zWogvaKJz5Hjf9OnlV
name: "msidSemantic",
reg: /^msid-semantic:\s?(\w*) (\S*)/,
names: ['semantic', 'token'],
format: "msid-semantic: %s %s" // space after ":" is not accidental
},
{ //a=group:BUNDLE audio video
push: 'groups',
reg: /^group:(\w*) (.*)/,
names: ['type', 'mids'],
format: "group:%s %s"
},
{ //a=rtcp-mux
name: 'rtcpMux',
reg: /^(rtcp-mux)/
},
{ //a=rtcp-rsize
name: 'rtcpRsize',
reg: /^(rtcp-rsize)/
},
{ // any a= that we don't understand is kepts verbatim on media.invalid
push: 'invalid',
names: ["value"]
}
]
};
// set sensible defaults to avoid polluting the grammar with boring details
Object.keys(grammar).forEach(function (key) {
var objs = grammar[key];
objs.forEach(function (obj) {
if (!obj.reg) {
obj.reg = /(.*)/;
}
if (!obj.format) {
obj.format = "%s";
}
});
});
},{}],40:[function(require,module,exports){
var parser = require('./parser');
var writer = require('./writer');
exports.write = writer;
exports.parse = parser.parse;
exports.parseFmtpConfig = parser.parseFmtpConfig;
exports.parsePayloads = parser.parsePayloads;
exports.parseRemoteCandidates = parser.parseRemoteCandidates;
},{"./parser":41,"./writer":42}],41:[function(require,module,exports){
var toIntIfInt = function (v) {
return String(Number(v)) === v ? Number(v) : v;
};
var attachProperties = function (match, location, names, rawName) {
if (rawName && !names) {
location[rawName] = toIntIfInt(match[1]);
}
else {
for (var i = 0; i < names.length; i += 1) {
if (match[i+1] != null) {
location[names[i]] = toIntIfInt(match[i+1]);
}
}
}
};
var parseReg = function (obj, location, content) {
var needsBlank = obj.name && obj.names;
if (obj.push && !location[obj.push]) {
location[obj.push] = [];
}
else if (needsBlank && !location[obj.name]) {
location[obj.name] = {};
}
var keyLocation = obj.push ?
{} : // blank object that will be pushed
needsBlank ? location[obj.name] : location; // otherwise, named location or root
attachProperties(content.match(obj.reg), keyLocation, obj.names, obj.name);
if (obj.push) {
location[obj.push].push(keyLocation);
}
};
var grammar = require('./grammar');
var validLine = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
exports.parse = function (sdp) {
var session = {}
, media = []
, location = session; // points at where properties go under (one of the above)
// parse lines we understand
sdp.split(/(\r\n|\r|\n)/).filter(validLine).forEach(function (l) {
var type = l[0];
var content = l.slice(2);
if (type === 'm') {
media.push({rtp: [], fmtp: []});
location = media[media.length-1]; // point at latest media line
}
for (var j = 0; j < (grammar[type] || []).length; j += 1) {
var obj = grammar[type][j];
if (obj.reg.test(content)) {
return parseReg(obj, location, content);
}
}
});
session.media = media; // link it up
return session;
};
var fmtpReducer = function (acc, expr) {
var s = expr.split('=');
if (s.length === 2) {
acc[s[0]] = toIntIfInt(s[1]);
}
return acc;
};
exports.parseFmtpConfig = function (str) {
return str.split(';').reduce(fmtpReducer, {});
};
exports.parsePayloads = function (str) {
return str.split(' ').map(Number);
};
exports.parseRemoteCandidates = function (str) {
var candidates = [];
var parts = str.split(' ').map(toIntIfInt);
for (var i = 0; i < parts.length; i += 3) {
candidates.push({
component: parts[i],
ip: parts[i + 1],
port: parts[i + 2]
});
}
return candidates;
};
},{"./grammar":39}],42:[function(require,module,exports){
var grammar = require('./grammar');
// customized util.format - discards excess arguments and can void middle ones
var formatRegExp = /%[sdv%]/g;
var format = function (formatStr) {
var i = 1;
var args = arguments;
var len = args.length;
return formatStr.replace(formatRegExp, function (x) {
if (i >= len) {
return x; // missing argument
}
var arg = args[i];
i += 1;
switch (x) {
case '%%':
return '%';
case '%s':
return String(arg);
case '%d':
return Number(arg);
case '%v':
return '';
}
});
// NB: we discard excess arguments - they are typically undefined from makeLine
};
var makeLine = function (type, obj, location) {
var str = obj.format instanceof Function ?
(obj.format(obj.push ? location : location[obj.name])) :
obj.format;
var args = [type + '=' + str];
if (obj.names) {
for (var i = 0; i < obj.names.length; i += 1) {
var n = obj.names[i];
if (obj.name) {
args.push(location[obj.name][n]);
}
else { // for mLine and push attributes
args.push(location[obj.names[i]]);
}
}
}
else {
args.push(location[obj.name]);
}
return format.apply(null, args);
};
// RFC specified order
// TODO: extend this with all the rest
var defaultOuterOrder = [
'v', 'o', 's', 'i',
'u', 'e', 'p', 'c',
'b', 't', 'r', 'z', 'a'
];
var defaultInnerOrder = ['i', 'c', 'b', 'a'];
module.exports = function (session, opts) {
opts = opts || {};
// ensure certain properties exist
if (session.version == null) {
session.version = 0; // "v=0" must be there (only defined version atm)
}
if (session.name == null) {
session.name = " "; // "s= " must be there if no meaningful name set
}
session.media.forEach(function (mLine) {
if (mLine.payloads == null) {
mLine.payloads = "";
}
});
var outerOrder = opts.outerOrder || defaultOuterOrder;
var innerOrder = opts.innerOrder || defaultInnerOrder;
var sdp = [];
// loop through outerOrder for matching properties on session
outerOrder.forEach(function (type) {
grammar[type].forEach(function (obj) {
if (obj.name in session && session[obj.name] != null) {
sdp.push(makeLine(type, obj, session));
}
else if (obj.push in session && session[obj.push] != null) {
session[obj.push].forEach(function (el) {
sdp.push(makeLine(type, obj, el));
});
}
});
});
// then for each media line, follow the innerOrder
session.media.forEach(function (mLine) {
sdp.push(makeLine('m', grammar.m[0], mLine));
innerOrder.forEach(function (type) {
grammar[type].forEach(function (obj) {
if (obj.name in mLine && mLine[obj.name] != null) {
sdp.push(makeLine(type, obj, mLine));
}
else if (obj.push in mLine && mLine[obj.push] != null) {
mLine[obj.push].forEach(function (el) {
sdp.push(makeLine(type, obj, el));
});
}
});
});
});
return sdp.join('\r\n') + '\r\n';
};
},{"./grammar":39}],43:[function(require,module,exports){
var _global = (function() { return this; })();
var nativeWebSocket = _global.WebSocket || _global.MozWebSocket;
/**
* Expose a W3C WebSocket class with just one or two arguments.
*/
function W3CWebSocket(uri, protocols) {
var native_instance;
if (protocols) {
native_instance = new nativeWebSocket(uri, protocols);
}
else {
native_instance = new nativeWebSocket(uri);
}
/**
* 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket
* class). Since it is an Object it will be returned as it is when creating an
* instance of W3CWebSocket via 'new W3CWebSocket()'.
*
* ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2
*/
return native_instance;
}
/**
* Module exports.
*/
module.exports = {
'w3cwebsocket' : nativeWebSocket ? W3CWebSocket : null,
'version' : require('./version')
};
},{"./version":44}],44:[function(require,module,exports){
module.exports = require('../package.json').version;
},{"../package.json":45}],45:[function(require,module,exports){
module.exports={
"name": "websocket",
"description": "Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",
"keywords": [
"websocket",
"websockets",
"socket",
"networking",
"comet",
"push",
"RFC-6455",
"realtime",
"server",
"client"
],
"author": {
"name": "Brian McKelvey",
"email": "brian@worlize.com",
"url": "https://www.worlize.com/"
},
"version": "1.0.18",
"repository": {
"type": "git",
"url": "https://github.com/theturtle32/WebSocket-Node.git"
},
"homepage": "https://github.com/theturtle32/WebSocket-Node",
"engines": {
"node": ">=0.8.0"
},
"dependencies": {
"debug": "~2.1.0",
"nan": "~1.0.0",
"typedarray-to-buffer": "~3.0.0"
},
"devDependencies": {
"buffer-equal": "0.0.1",
"faucet": "0.0.1",
"gulp": "git+https://github.com/gulpjs/gulp.git#4.0",
"gulp-jshint": "^1.9.0",
"jshint-stylish": "^1.0.0",
"tape": "^3.0.0"
},
"config": {
"verbose": false
},
"scripts": {
"install": "(node-gyp rebuild 2> builderror.log) || (exit 0)",
"test": "faucet test/unit",
"gulp": "gulp"
},
"main": "index",
"directories": {
"lib": "./lib"
},
"browser": "lib/browser.js",
"gitHead": "2888a6d8c6ea0211b429000d43ed5da76124733f",
"bugs": {
"url": "https://github.com/theturtle32/WebSocket-Node/issues"
},
"_id": "websocket@1.0.18",
"_shasum": "140280dcc90ed42caa7a701e182a8c9e2dec75ef",
"_from": "websocket@>=1.0.18 <2.0.0",
"_npmVersion": "2.6.1",
"_nodeVersion": "1.4.3",
"_npmUser": {
"name": "theturtle32",
"email": "brian@worlize.com"
},
"maintainers": [
{
"name": "theturtle32",
"email": "brian@worlize.com"
}
],
"dist": {
"shasum": "140280dcc90ed42caa7a701e182a8c9e2dec75ef",
"tarball": "http://registry.npmjs.org/websocket/-/websocket-1.0.18.tgz"
},
"_resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.18.tgz",
"readme": "ERROR: No README data found!"
}
},{}],46:[function(require,module,exports){
module.exports={
"name": "jssip",
"title": "JsSIP",
"description": "the Javascript SIP library",
"version": "0.6.25",
"homepage": "http://jssip.net",
"author": "José Luis Millán <jmillan@aliax.net> (https://github.com/jmillan)",
"contributors": [
"Iñaki Baz Castillo <ibc@aliax.net> (https://github.com/ibc)",
"Saúl Ibarra Corretgé <saghul@gmail.com> (https://github.com/saghul)"
],
"main": "lib/JsSIP.js",
"keywords": [
"sip",
"websocket",
"webrtc",
"node",
"browser",
"library"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/versatica/JsSIP.git"
},
"bugs": {
"url": "https://github.com/versatica/JsSIP/issues"
},
"dependencies": {
"debug": "^2.1.3",
"rtcninja": "^0.5.4",
"sdp-transform": "~1.4.0",
"websocket": "^1.0.18"
},
"devDependencies": {
"browserify": "^9.0.8",
"gulp": "git+https://github.com/gulpjs/gulp.git#4.0",
"gulp-expect-file": "0.0.7",
"gulp-filelog": "^0.4.1",
"gulp-header": "^1.2.2",
"gulp-jshint": "^1.10.0",
"gulp-nodeunit-runner": "^0.2.2",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.4",
"jshint-stylish": "^1.0.1",
"pegjs": "0.7.0",
"vinyl-source-stream": "^1.1.0"
},
"scripts": {
"test": "gulp test"
}
}
},{}]},{},[7])(7)
}); | the-destro/cdnjs | ajax/libs/jssip/0.6.25/jssip.js | JavaScript | mit | 705,337 |
/*! UIkit 2.7.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(core) {
if (typeof define == "function" && define.amd) { // AMD
define("uikit", function(){
var uikit = core(window, window.jQuery, window.document);
uikit.load = function(res, req, onload, config) {
var resources = res.split(','), load = [], i, base = (config.config && config.config.uikit && config.config.uikit.base ? config.config.uikit.base : "").replace(/\/+$/g, "");
if (!base) {
throw new Error( "Please define base path to uikit in the requirejs config." );
}
for (i = 0; i < resources.length; i += 1) {
var resource = resources[i].replace(/\./g, '/');
load.push(base+'/js/addons/'+resource);
}
req(load, function() {
onload(uikit);
});
};
return uikit;
});
}
if (!window.jQuery) {
throw new Error( "UIkit requires jQuery" );
}
if (window && window.jQuery) {
core(window, window.jQuery, window.document);
}
})(function(global, $, doc) {
"use strict";
var UI = $.UIkit || {}, $html = $("html"), $win = $(window), $doc = $(document);
if (UI.fn) {
return UI;
}
UI.version = '2.7.0';
UI.fn = function(command, options) {
var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2];
if (!UI[component]) {
$.error("UIkit component [" + component + "] does not exist.");
return this;
}
return this.each(function() {
var $this = $(this), data = $this.data(component);
if (!data) $this.data(component, (data = UI[component](this, method ? undefined : options)));
if (method) data[method].apply(data, Array.prototype.slice.call(args, 1));
});
};
UI.support = {};
UI.support.transition = (function() {
var transitionEnd = (function() {
var element = doc.body || doc.documentElement,
transEndEventNames = {
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'oTransitionEnd otransitionend',
transition: 'transitionend'
}, name;
for (name in transEndEventNames) {
if (element.style[name] !== undefined) return transEndEventNames[name];
}
}());
return transitionEnd && { end: transitionEnd };
})();
UI.support.animation = (function() {
var animationEnd = (function() {
var element = doc.body || doc.documentElement,
animEndEventNames = {
WebkitAnimation: 'webkitAnimationEnd',
MozAnimation: 'animationend',
OAnimation: 'oAnimationEnd oanimationend',
animation: 'animationend'
}, name;
for (name in animEndEventNames) {
if (element.style[name] !== undefined) return animEndEventNames[name];
}
}());
return animationEnd && { end: animationEnd };
})();
UI.support.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function(callback){ setTimeout(callback, 1000/60); };
UI.support.touch = (
('ontouchstart' in window && navigator.userAgent.toLowerCase().match(/mobile|tablet/)) ||
(global.DocumentTouch && document instanceof global.DocumentTouch) ||
(global.navigator['msPointerEnabled'] && global.navigator['msMaxTouchPoints'] > 0) || //IE 10
(global.navigator['pointerEnabled'] && global.navigator['maxTouchPoints'] > 0) || //IE >=11
false
);
UI.support.mutationobserver = (global.MutationObserver || global.WebKitMutationObserver || global.MozMutationObserver || null);
UI.Utils = {};
UI.Utils.debounce = function(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
};
UI.Utils.removeCssRules = function(selectorRegEx) {
var idx, idxs, stylesheet, _i, _j, _k, _len, _len1, _len2, _ref;
if(!selectorRegEx) return;
setTimeout(function(){
try {
_ref = document.styleSheets;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
stylesheet = _ref[_i];
idxs = [];
stylesheet.cssRules = stylesheet.cssRules;
for (idx = _j = 0, _len1 = stylesheet.cssRules.length; _j < _len1; idx = ++_j) {
if (stylesheet.cssRules[idx].type === CSSRule.STYLE_RULE && selectorRegEx.test(stylesheet.cssRules[idx].selectorText)) {
idxs.unshift(idx);
}
}
for (_k = 0, _len2 = idxs.length; _k < _len2; _k++) {
stylesheet.deleteRule(idxs[_k]);
}
}
} catch (_error) {}
}, 0);
};
UI.Utils.isInView = function(element, options) {
var $element = $(element);
if (!$element.is(':visible')) {
return false;
}
var window_left = $win.scrollLeft(), window_top = $win.scrollTop(), offset = $element.offset(), left = offset.left, top = offset.top;
options = $.extend({topoffset:0, leftoffset:0}, options);
if (top + $element.height() >= window_top && top - options.topoffset <= window_top + $win.height() &&
left + $element.width() >= window_left && left - options.leftoffset <= window_left + $win.width()) {
return true;
} else {
return false;
}
};
UI.Utils.options = function(string) {
if ($.isPlainObject(string)) return string;
var start = (string ? string.indexOf("{") : -1), options = {};
if (start != -1) {
try {
options = (new Function("", "var json = " + string.substr(start) + "; return JSON.parse(JSON.stringify(json));"))();
} catch (e) {}
}
return options;
};
UI.Utils.template = function(str, data) {
var tokens = str.replace(/\n/g, '\\n').replace(/\{\{\{\s*(.+?)\s*\}\}\}/g, "{{!$1}}").split(/(\{\{\s*(.+?)\s*\}\})/g),
i=0, toc, cmd, prop, val, fn, output = [], openblocks = 0;
while(i < tokens.length) {
toc = tokens[i];
if(toc.match(/\{\{\s*(.+?)\s*\}\}/)) {
i = i + 1;
toc = tokens[i];
cmd = toc[0];
prop = toc.substring(toc.match(/^(\^|\#|\!|\~|\:)/) ? 1:0);
switch(cmd) {
case '~':
output.push("for(var $i=0;$i<"+prop+".length;$i++) { var $item = "+prop+"[$i];");
openblocks++;
break;
case ':':
output.push("for(var $key in "+prop+") { var $val = "+prop+"[$key];");
openblocks++;
break;
case '#':
output.push("if("+prop+") {");
openblocks++;
break;
case '^':
output.push("if(!"+prop+") {");
openblocks++;
break;
case '/':
output.push("}");
openblocks--;
break;
case '!':
output.push("__ret.push("+prop+");");
break;
default:
output.push("__ret.push(escape("+prop+"));");
break;
}
} else {
output.push("__ret.push('"+toc.replace(/\'/g, "\\'")+"');");
}
i = i + 1;
}
fn = [
'var __ret = [];',
'try {',
'with($data){', (!openblocks ? output.join('') : '__ret = ["Not all blocks are closed correctly."]'), '};',
'}catch(e){__ret = [e.message];}',
'return __ret.join("").replace(/\\n\\n/g, "\\n");',
"function escape(html) { return String(html).replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');}"
].join("\n");
var func = new Function('$data', fn);
return data ? func(data) : func;
};
UI.Utils.events = {};
UI.Utils.events.click = UI.support.touch ? 'tap' : 'click';
$.UIkit = UI;
$.fn.uk = UI.fn;
$.UIkit.langdirection = $html.attr("dir") == "rtl" ? "right" : "left";
$(function(){
$doc.trigger("uk-domready");
// custom scroll observer
setInterval((function(){
var memory = {x: window.scrollX, y:window.scrollY};
var fn = function(){
if (memory.x != window.scrollX || memory.y != window.scrollY) {
memory = {x: window.scrollX, y:window.scrollY};
$doc.trigger('uk-scroll', [memory]);
}
};
if ($.UIkit.support.touch) {
$doc.on('touchmove touchend MSPointerMove MSPointerUp', fn);
}
if(memory.x || memory.y) fn();
return fn;
})(), 15);
// Check for dom modifications
if(!UI.support.mutationobserver) return;
try{
var observer = new UI.support.mutationobserver(UI.Utils.debounce(function(mutations) {
$doc.trigger("uk-domready");
}, 150));
// pass in the target node, as well as the observer options
observer.observe(document.body, { childList: true, subtree: true });
} catch(e) {}
// remove css hover rules for touch devices
if (UI.support.touch) {
UI.Utils.removeCssRules(/\.uk-(?!navbar).*:hover/);
}
});
// add touch identifier class
$html.addClass(UI.support.touch ? "uk-touch" : "uk-notouch");
// add uk-hover class on tap to support overlays on touch devices
if (UI.support.touch) {
var hoverset = false, selector = '.uk-overlay, .uk-overlay-toggle, .uk-has-hover', exclude;
$doc.on('touchstart MSPointerDown', selector, function() {
if(hoverset) $('.uk-hover').removeClass('uk-hover');
hoverset = $(this).addClass('uk-hover');
}).on('touchend MSPointerUp', function(e) {
exclude = $(e.target).parents(selector);
if (hoverset) hoverset.not(exclude).removeClass('uk-hover');
});
}
return UI;
});
/**
* Promises/A+ spec. polyfill
* promiscuous - https://github.com/RubenVerborgh/promiscuous
* @license MIT
* Ruben Verborgh
*/
(function(global){
global.Promise = global.Promise || (function (func, obj) {
// Type checking utility function
function is(type, item) { return (typeof item)[0] == type; }
// Creates a promise, calling callback(resolve, reject), ignoring other parameters.
function Promise(callback, handler) {
// The `handler` variable points to the function that will
// 1) handle a .then(resolved, rejected) call
// 2) handle a resolve or reject call (if the first argument === `is`)
// Before 2), `handler` holds a queue of callbacks.
// After 2), `handler` is a finalized .then handler.
handler = function pendingHandler(resolved, rejected, value, queue, then, i) {
queue = pendingHandler.q;
// Case 1) handle a .then(resolved, rejected) call
if (resolved != is) {
return Promise(function (resolve, reject) {
queue.push({ p: this, r: resolve, j: reject, 1: resolved, 0: rejected });
});
}
// Case 2) handle a resolve or reject call
// (`resolved` === `is` acts as a sentinel)
// The actual function signature is
// .re[ject|solve](<is>, success, value)
// Check if the value is a promise and try to obtain its `then` method
if (value && (is(func, value) | is(obj, value))) {
try { then = value.then; }
catch (reason) { rejected = 0; value = reason; }
}
// If the value is a promise, take over its state
if (is(func, then)) {
var valueHandler = function (resolved) {
return function (value) { return then && (then = 0, pendingHandler(is, resolved, value)); };
};
try { then.call(value, valueHandler(1), rejected = valueHandler(0)); }
catch (reason) { rejected(reason); }
}
// The value is not a promise; handle resolve/reject
else {
// Replace this handler with a finalized resolved/rejected handler
handler = function (Resolved, Rejected) {
// If the Resolved or Rejected parameter is not a function,
// return the original promise (now stored in the `callback` variable)
if (!is(func, (Resolved = rejected ? Resolved : Rejected))) return callback;
// Otherwise, return a finalized promise, transforming the value with the function
return Promise(function (resolve, reject) { finalize(this, resolve, reject, value, Resolved); });
};
// Resolve/reject pending callbacks
i = 0;
while (i < queue.length) {
then = queue[i++];
// If no callback, just resolve/reject the promise
if (!is(func, resolved = then[rejected])) {
(rejected ? then.r : then.j)(value);
// Otherwise, resolve/reject the promise with the result of the callback
} else {
finalize(then.p, then.r, then.j, value, resolved);
}
}
}
};
// The queue of pending callbacks; garbage-collected when handler is resolved/rejected
handler.q = [];
// Create and return the promise (reusing the callback variable)
callback.call(callback = {
then: function (resolved, rejected) { return handler(resolved, rejected); },
catch: function (rejected) { return handler(0, rejected); }
},
function (value) { handler(is, 1, value); },
function (reason) { handler(is, 0, reason); }
);
return callback;
}
// Finalizes the promise by resolving/rejecting it with the transformed value
function finalize(promise, resolve, reject, value, transform) {
setTimeout(function () {
try {
// Transform the value through and check whether it's a promise
value = transform(value);
transform = value && (is(obj, value) | is(func, value)) && value.then;
// Return the result if it's not a promise
if (!is(func, transform))
resolve(value);
// If it's a promise, make sure it's not circular
else if (value == promise)
reject(TypeError());
// Take over the promise's state
else
transform.call(value, resolve, reject);
}
catch (error) { reject(error); }
}, 0);
}
// Creates a resolved promise
Promise.resolve = ResolvedPromise;
function ResolvedPromise(value) { return Promise(function (resolve) { resolve(value); }); }
// Creates a rejected promise
Promise.reject = function (reason) { return Promise(function (resolve, reject) { reject(reason); }); };
// Transforms an array of promises into a promise for an array
Promise.all = function (promises) {
return Promise(function (resolve, reject, count, values) {
// Array of collected values
values = [];
// Resolve immediately if there are no promises
count = promises.length || resolve(values);
// Transform all elements (`map` is shorter than `forEach`)
promises.map(function (promise, index) {
ResolvedPromise(promise).then(
// Store the value and resolve if it was the last
function (value) {
values[index] = value;
count = count -1;
if(!count) resolve(values);
},
// Reject if one element fails
reject);
});
});
};
return Promise;
})('f', 'o');
})(this);
(function($, UI) {
"use strict";
UI.components = {};
UI.component = function(name, def) {
var fn = function(element, options) {
var $this = this;
this.element = element ? $(element) : null;
this.options = $.extend(true, {}, this.defaults, options);
this.plugins = {};
if (this.element) {
this.element.data(name, this);
}
this.init();
(this.options.plugins.length ? this.options.plugins : Object.keys(fn.plugins)).forEach(function(plugin) {
if (fn.plugins[plugin].init) {
fn.plugins[plugin].init($this);
$this.plugins[plugin] = true;
}
});
this.trigger('init', [this]);
};
fn.plugins = {};
$.extend(true, fn.prototype, {
defaults : {plugins: []},
init: function(){},
on: function(){
return $(this.element || this).on.apply(this.element || this, arguments);
},
one: function(){
return $(this.element || this).one.apply(this.element || this, arguments);
},
off: function(evt){
return $(this.element || this).off(evt);
},
trigger: function(evt, params) {
return $(this.element || this).trigger(evt, params);
},
find: function(selector) {
return this.element ? this.element.find(selector) : $([]);
},
proxy: function(obj, methods) {
var $this = this;
methods.split(' ').forEach(function(method) {
if (!$this[method]) $this[method] = function() { return obj[method].apply(obj, arguments); };
});
},
mixin: function(obj, methods) {
var $this = this;
methods.split(' ').forEach(function(method) {
if (!$this[method]) $this[method] = obj[method].bind($this);
});
},
}, def);
this.components[name] = fn;
this[name] = function() {
var element, options;
if(arguments.length) {
switch(arguments.length) {
case 1:
if (typeof arguments[0] === "string" || arguments[0].nodeType || arguments[0] instanceof jQuery) {
element = $(arguments[0]);
} else {
options = arguments[0];
}
break;
case 2:
element = $(arguments[0]);
options = arguments[1];
break;
}
}
if (element && element.data(name)) {
return element.data(name);
}
return (new UI.components[name](element, options));
};
return fn;
};
UI.plugin = function(component, name, def) {
this.components[component].plugins[name] = def;
};
})(jQuery, jQuery.UIkit);
(function($, UI) {
"use strict";
var win = $(window), event = 'resize orientationchange', stacks = [];
UI.component('stackMargin', {
defaults: {
'cls': 'uk-margin-small-top'
},
init: function() {
var $this = this;
this.columns = this.element.children();
if (!this.columns.length) return;
win.on(event, (function() {
var fn = function() {
$this.process();
};
$(function() {
fn();
win.on("load", fn);
});
return UI.Utils.debounce(fn, 150);
})());
$(document).on("uk-domready", function(e) {
$this.columns = $this.element.children();
$this.process();
});
stacks.push(this);
},
process: function() {
var $this = this;
this.revert();
var skip = false,
firstvisible = this.columns.filter(":visible:first"),
offset = firstvisible.length ? firstvisible.offset().top : false;
if (offset === false) return;
this.columns.each(function() {
var column = $(this);
if (column.is(":visible")) {
if (skip) {
column.addClass($this.options.cls);
} else {
if (column.offset().top != offset) {
column.addClass($this.options.cls);
skip = true;
}
}
}
});
return this;
},
revert: function() {
this.columns.removeClass(this.options.cls);
return this;
}
});
// init code
$(document).on("uk-domready", function(e) {
$("[data-uk-margin]").each(function() {
var ele = $(this), obj;
if (!ele.data("stackMargin")) {
obj = UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
}
});
});
$(document).on("uk-check-display", function(e) {
stacks.forEach(function(item) {
if(item.element.is(":visible")) item.process();
});
});
})(jQuery, jQuery.UIkit);
// Based on Zeptos touch.js
// https://raw.github.com/madrobby/zepto/master/src/touch.js
// Zepto.js may be freely distributed under the MIT license.
;(function($){
var touch = {},
touchTimeout, tapTimeout, swipeTimeout, longTapTimeout,
longTapDelay = 750,
gesture;
function swipeDirection(x1, x2, y1, y2) {
return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
}
function longTap() {
longTapTimeout = null;
if (touch.last) {
touch.el.trigger('longTap');
touch = {};
}
}
function cancelLongTap() {
if (longTapTimeout) clearTimeout(longTapTimeout);
longTapTimeout = null;
}
function cancelAll() {
if (touchTimeout) clearTimeout(touchTimeout);
if (tapTimeout) clearTimeout(tapTimeout);
if (swipeTimeout) clearTimeout(swipeTimeout);
if (longTapTimeout) clearTimeout(longTapTimeout);
touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
touch = {};
}
function isPrimaryTouch(event){
return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary;
}
$(function(){
var now, delta, deltaX = 0, deltaY = 0, firstTouch;
if ('MSGesture' in window) {
gesture = new MSGesture();
gesture.target = document.body;
}
$(document)
.bind('MSGestureEnd', function(e){
var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null;
if (swipeDirectionFromVelocity) {
touch.el.trigger('swipe');
touch.el.trigger('swipe'+ swipeDirectionFromVelocity);
}
})
.on('touchstart MSPointerDown', function(e){
if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return;
firstTouch = e.type == 'MSPointerDown' ? e : e.originalEvent.touches[0];
now = Date.now();
delta = now - (touch.last || now);
touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode);
if(touchTimeout) clearTimeout(touchTimeout);
touch.x1 = firstTouch.pageX;
touch.y1 = firstTouch.pageY;
if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
touch.last = now;
longTapTimeout = setTimeout(longTap, longTapDelay);
// adds the current touch contact for IE gesture recognition
if (gesture && e.type == 'MSPointerDown') gesture.addPointer(e.originalEvent.pointerId);
})
.on('touchmove MSPointerMove', function(e){
if(e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
firstTouch = e.type == 'MSPointerMove' ? e : e.originalEvent.touches[0];
cancelLongTap();
touch.x2 = firstTouch.pageX;
touch.y2 = firstTouch.pageY;
deltaX += Math.abs(touch.x1 - touch.x2);
deltaY += Math.abs(touch.y1 - touch.y2);
})
.on('touchend MSPointerUp', function(e){
if(e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
cancelLongTap();
// swipe
if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){
swipeTimeout = setTimeout(function() {
touch.el.trigger('swipe');
touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
touch = {};
}, 0);
// normal tap
} else if ('last' in touch) {
// don't fire tap when delta position changed by more than 30 pixels,
// for instance when moving to a point and back to origin
if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) {
// delay by one tick so we can cancel the 'tap' event if 'scroll' fires
// ('tap' fires before 'scroll')
tapTimeout = setTimeout(function() {
// trigger universal 'tap' with the option to cancelTouch()
// (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
var event = $.Event('tap');
event.cancelTouch = cancelAll;
touch.el.trigger(event);
// trigger double tap immediately
if (touch.isDoubleTap) {
touch.el.trigger('doubleTap');
touch = {};
}
// trigger single tap after 250ms of inactivity
else {
touchTimeout = setTimeout(function(){
touchTimeout = null;
touch.el.trigger('singleTap');
touch = {};
}, 250);
}
}, 0);
} else {
touch = {};
}
deltaX = deltaY = 0;
}
})
// when the browser window loses focus,
// for example when a modal dialog is shown,
// cancel all ongoing events
.on('touchcancel MSPointerCancel', cancelAll);
// scrolling the window indicates intention of the user
// to scroll, not tap or swipe, so cancel all ongoing events
$(window).on('scroll', cancelAll);
});
['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
$.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
});
})(jQuery);
(function($, UI) {
"use strict";
UI.component('alert', {
defaults: {
"fade": true,
"duration": 200,
"trigger": ".uk-alert-close"
},
init: function() {
var $this = this;
this.on("click", this.options.trigger, function(e) {
e.preventDefault();
$this.close();
});
},
close: function() {
var element = this.trigger("close");
if (this.options.fade) {
element.css("overflow", "hidden").css("max-height", element.height()).animate({
"height": 0,
"opacity": 0,
"padding-top": 0,
"padding-bottom": 0,
"margin-top": 0,
"margin-bottom": 0
}, this.options.duration, removeElement);
} else {
removeElement();
}
function removeElement() {
element.trigger("closed").remove();
}
}
});
// init code
$(document).on("click.alert.uikit", "[data-uk-alert]", function(e) {
var ele = $(this);
if (!ele.data("alert")) {
var alert = UI.alert(ele, UI.Utils.options(ele.data("uk-alert")));
if ($(e.target).is(ele.data("alert").options.trigger)) {
e.preventDefault();
alert.close();
}
}
});
})(jQuery, jQuery.UIkit);
(function($, UI) {
"use strict";
UI.component('buttonRadio', {
defaults: {
"target": ".uk-button"
},
init: function() {
var $this = this;
this.on("click", this.options.target, function(e) {
if ($(this).is('a[href="#"]')) e.preventDefault();
$this.find($this.options.target).not(this).removeClass("uk-active").blur();
$this.trigger("change", [$(this).addClass("uk-active")]);
});
},
getSelected: function() {
this.find(".uk-active");
}
});
UI.component('buttonCheckbox', {
defaults: {
"target": ".uk-button"
},
init: function() {
var $this = this;
this.on("click", this.options.target, function(e) {
if ($(this).is('a[href="#"]')) e.preventDefault();
$this.trigger("change", [$(this).toggleClass("uk-active").blur()]);
});
},
getSelected: function() {
this.find(".uk-active");
}
});
UI.component('button', {
defaults: {},
init: function() {
var $this = this;
this.on("click", function(e) {
if ($this.element.is('a[href="#"]')) e.preventDefault();
$this.toggle();
$this.trigger("change", [$element.blur().hasClass("uk-active")]);
});
},
toggle: function() {
this.element.toggleClass("uk-active");
}
});
// init code
$(document).on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
var ele = $(this);
if (!ele.data("buttonRadio")) {
var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio")));
if ($(e.target).is(obj.options.target)) {
$(e.target).trigger("click");
}
}
});
$(document).on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
var ele = $(this);
if (!ele.data("buttonCheckbox")) {
var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))), target=$(e.target);
if (target.is(obj.options.target)) {
ele.trigger("change", [target.toggleClass("uk-active").blur()]);
}
}
});
$(document).on("click.button.uikit", "[data-uk-button]", function(e) {
var ele = $(this);
if (!ele.data("button")) {
var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
ele.trigger("click");
}
});
})(jQuery, jQuery.UIkit);
(function($, UI) {
"use strict";
var active = false;
UI.component('dropdown', {
defaults: {
"mode": "hover",
"remaintime": 800,
"justify": false,
"boundary": $(window)
},
remainIdle: false,
init: function() {
var $this = this;
this.dropdown = this.find(".uk-dropdown");
this.centered = this.dropdown.hasClass("uk-dropdown-center");
this.justified = this.options.justify ? $(this.options.justify) : false;
this.boundary = $(this.options.boundary);
this.flipped = this.dropdown.hasClass('uk-dropdown-flip');
if(!this.boundary.length) {
this.boundary = $(window);
}
if (this.options.mode == "click" || UI.support.touch) {
this.on("click", function(e) {
var $target = $(e.target);
if (!$target.parents(".uk-dropdown").length) {
if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
e.preventDefault();
}
$target.blur();
}
if (!$this.element.hasClass("uk-open")) {
$this.show();
} else {
if ($target.is("a:not(.js-uk-prevent)") || $target.is(".uk-dropdown-close") || !$this.dropdown.find(e.target).length) {
$this.element.removeClass("uk-open");
active = false;
}
}
});
} else {
this.on("mouseenter", function(e) {
if ($this.remainIdle) {
clearTimeout($this.remainIdle);
}
$this.show();
}).on("mouseleave", function() {
$this.remainIdle = setTimeout(function() {
$this.element.removeClass("uk-open");
$this.remainIdle = false;
if (active && active[0] == $this.element[0]) active = false;
}, $this.options.remaintime);
}).on("click", function(e){
var $target = $(e.target);
if ($this.remainIdle) {
clearTimeout($this.remainIdle);
}
if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
e.preventDefault();
}
$this.show();
});
}
},
show: function(){
if (active && active[0] != this.element[0]) {
active.removeClass("uk-open");
}
this.checkDimensions();
this.element.addClass("uk-open");
this.trigger('uk.dropdown.show', [this]);
active = this.element;
this.registerOuterClick();
},
registerOuterClick: function(){
var $this = this;
$(document).off("click.outer.dropdown");
setTimeout(function() {
$(document).on("click.outer.dropdown", function(e) {
var $target = $(e.target);
if (active && active[0] == $this.element[0] && ($target.is("a:not(.js-uk-prevent)") || $target.is(".uk-dropdown-close") || !$this.dropdown.find(e.target).length)) {
active.removeClass("uk-open");
$(document).off("click.outer.dropdown");
}
});
}, 10);
},
checkDimensions: function() {
if(!this.dropdown.length) return;
if (this.justified && this.justified.length) {
this.dropdown.css("min-width", "");
}
var $this = this,
dropdown = this.dropdown.css("margin-" + $.UIkit.langdirection, ""),
offset = dropdown.show().offset(),
width = dropdown.outerWidth(),
boundarywidth = this.boundary.width(),
boundaryoffset = this.boundary.offset() ? this.boundary.offset().left:0;
// centered dropdown
if (this.centered) {
dropdown.css("margin-" + $.UIkit.langdirection, (parseFloat(width) / 2 - dropdown.parent().width() / 2) * -1);
offset = dropdown.offset();
// reset dropdown
if ((width + offset.left) > boundarywidth || offset.left < 0) {
dropdown.css("margin-" + $.UIkit.langdirection, "");
offset = dropdown.offset();
}
}
// justify dropdown
if (this.justified && this.justified.length) {
var jwidth = this.justified.outerWidth();
dropdown.css("min-width", jwidth);
if ($.UIkit.langdirection == 'right') {
var right1 = boundarywidth - (this.justified.offset().left + jwidth),
right2 = boundarywidth - (dropdown.offset().left + dropdown.outerWidth());
dropdown.css("margin-right", right1 - right2);
} else {
dropdown.css("margin-left", this.justified.offset().left - offset.left);
}
offset = dropdown.offset();
}
if ((width + (offset.left-boundaryoffset)) > boundarywidth) {
dropdown.addClass("uk-dropdown-flip");
offset = dropdown.offset();
}
if ((offset.left-boundaryoffset) < 0) {
dropdown.addClass("uk-dropdown-stack");
if (dropdown.hasClass("uk-dropdown-flip")) {
if (!this.flipped) {
dropdown.removeClass("uk-dropdown-flip");
offset = dropdown.offset();
dropdown.addClass("uk-dropdown-flip");
}
setTimeout(function(){
if ((dropdown.offset().left-boundaryoffset) < 0 || !$this.flipped && (dropdown.outerWidth() + (offset.left-boundaryoffset)) < boundarywidth) {
dropdown.removeClass("uk-dropdown-flip");
}
}, 0);
}
this.trigger('uk.dropdown.stack', [this]);
}
dropdown.css("display", "");
}
});
var triggerevent = UI.support.touch ? "click" : "mouseenter";
// init code
$(document).on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
var ele = $(this);
if (!ele.data("dropdown")) {
var dropdown = UI.dropdown(ele, UI.Utils.options(ele.data("uk-dropdown")));
if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
dropdown.show();
}
if(dropdown.element.find('.uk-dropdown').length) {
e.preventDefault();
}
}
});
})(jQuery, jQuery.UIkit);
(function($, UI) {
"use strict";
var win = $(window), event = 'resize orientationchange', grids = [];
UI.component('gridMatchHeight', {
defaults: {
"target" : false,
"row" : true
},
init: function() {
var $this = this;
this.columns = this.element.children();
this.elements = this.options.target ? this.find(this.options.target) : this.columns;
if (!this.columns.length) return;
win.on(event, (function() {
var fn = function() {
$this.match();
};
$(function() {
fn();
win.on("load", fn);
});
return UI.Utils.debounce(fn, 150);
})());
$(document).on("uk-domready", function(e) {
$this.columns = $this.element.children();
$this.elements = $this.options.target ? $this.find($this.options.target) : $this.columns;
$this.match();
});
grids.push(this);
},
match: function() {
this.revert();
var firstvisible = this.columns.filter(":visible:first");
if (!firstvisible.length) return;
var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100 ? true : false,
max = 0,
$this = this;
if (stacked) return;
if(this.options.row) {
this.element.width(); // force redraw
setTimeout(function(){
var lastoffset = false, group = [];
$this.elements.each(function(i) {
var ele = $(this), offset = ele.offset().top;
if(offset != lastoffset && group.length) {
$this.matchHeights($(group));
group = [];
offset = ele.offset().top;
}
group.push(ele);
lastoffset = offset;
});
if(group.length) {
$this.matchHeights($(group));
}
}, 0);
} else {
this.matchHeights(this.elements);
}
return this;
},
revert: function() {
this.elements.css('min-height', '');
return this;
},
matchHeights: function(elements){
if(elements.length < 2) return;
var max = 0;
elements.each(function() {
max = Math.max(max, $(this).outerHeight());
}).each(function(i) {
var element = $(this),
height = max - (element.outerHeight() - element.height());
element.css('min-height', height + 'px');
});
}
});
UI.component('gridMargin', {
defaults: {
"cls": "uk-grid-margin"
},
init: function() {
var $this = this;
var stackMargin = UI.stackMargin(this.element, this.options);
}
});
// init code
$(document).on("uk-domready", function(e) {
$("[data-uk-grid-match],[data-uk-grid-margin]").each(function() {
var grid = $(this), obj;
if (grid.is("[data-uk-grid-match]") && !grid.data("gridMatchHeight")) {
obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
}
if (grid.is("[data-uk-grid-margin]") && !grid.data("gridMargin")) {
obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
}
});
});
$(document).on("uk-check-display", function(e) {
grids.forEach(function(item) {
if(item.element.is(":visible")) item.match();
});
});
})(jQuery, jQuery.UIkit);
(function($, UI, $win) {
"use strict";
var active = false, body;
UI.component('modal', {
defaults: {
keyboard: true,
bgclose: true,
minScrollHeight: 150
},
scrollable: false,
transition: false,
init: function() {
if (!body) body = $('body');
var $this = this;
this.transition = UI.support.transition;
this.dialog = this.find(".uk-modal-dialog");
this.on("click", ".uk-modal-close", function(e) {
e.preventDefault();
$this.hide();
}).on("click", function(e) {
var target = $(e.target);
if (target[0] == $this.element[0] && $this.options.bgclose) {
$this.hide();
}
});
},
toggle: function() {
return this[this.isActive() ? "hide" : "show"]();
},
show: function() {
var $this = this;
if (this.isActive()) return;
if (active) active.hide(true);
this.element.removeClass("uk-open").show();
this.resize();
active = this;
body.addClass("uk-modal-page").height(); // force browser engine redraw
this.element.addClass("uk-open").trigger("uk.modal.show");
$(document).trigger("uk-check-display");
return this;
},
hide: function(force) {
if (!this.isActive()) return;
if (!force && UI.support.transition) {
var $this = this;
this.one(UI.support.transition.end, function() {
$this._hide();
}).removeClass("uk-open");
} else {
this._hide();
}
return this;
},
resize: function() {
var paddingdir = "padding-" + (UI.langdirection == 'left' ? "right":"left");
this.scrollbarwidth = window.innerWidth - body.width();
body.css(paddingdir, this.scrollbarwidth);
this.element.css(paddingdir, "");
if (this.dialog.offset().left > this.scrollbarwidth) {
this.element.css(paddingdir, this.scrollbarwidth - (this.element[0].scrollHeight==window.innerHeight ? 0:this.scrollbarwidth ));
}
this.updateScrollable();
},
updateScrollable: function() {
// has scrollable?
var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
if (scrollable) {
scrollable.css("height", 0);
var offset = Math.abs(parseInt(this.dialog.css("margin-top"), 10)),
dh = this.dialog.outerHeight(),
wh = window.innerHeight,
h = wh - 2*(offset < 20 ? 20:offset) - dh;
scrollable.css("height", h < this.options.minScrollHeight ? "":h);
}
},
_hide: function() {
this.element.hide().removeClass("uk-open");
body.removeClass("uk-modal-page").css("padding-" + (UI.langdirection == 'left' ? "right":"left"), "");
if(active===this) active = false;
this.trigger("uk.modal.hide");
},
isActive: function() {
return (active == this);
}
});
UI.component('modalTrigger', {
init: function() {
var $this = this;
this.options = $.extend({
"target": $this.element.is("a") ? $this.element.attr("href") : false
}, this.options);
this.modal = UI.modal(this.options.target, this.options);
this.on("click", function(e) {
e.preventDefault();
$this.show();
});
//methods
this.proxy(this.modal, "show hide isActive");
}
});
UI.modal.dialog = function(content, options) {
var modal = UI.modal($(UI.modal.dialog.template).appendTo("body"), options);
modal.on("uk.modal.hide", function(){
if (modal.persist) {
modal.persist.appendTo(modal.persist.data("modalPersistParent"));
modal.persist = false;
}
modal.element.remove();
});
setContent(content, modal);
return modal;
};
UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog"></div></div>';
UI.modal.alert = function(content, options) {
UI.modal.dialog(([
'<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
'<div class="uk-modal-buttons"><button class="uk-button uk-button-primary uk-modal-close">Ok</button></div>'
]).join(""), $.extend({bgclose:false, keyboard:false}, options)).show();
};
UI.modal.confirm = function(content, onconfirm, options) {
onconfirm = $.isFunction(onconfirm) ? onconfirm : function(){};
var modal = UI.modal.dialog(([
'<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
'<div class="uk-modal-buttons"><button class="uk-button uk-button-primary js-modal-confirm">Ok</button> <button class="uk-button uk-modal-close">Cancel</button></div>'
]).join(""), $.extend({bgclose:false, keyboard:false}, options));
modal.element.find(".js-modal-confirm").on("click", function(){
onconfirm();
modal.hide();
});
modal.show();
};
// init code
$(document).on("click.modal.uikit", "[data-uk-modal]", function(e) {
var ele = $(this);
if(ele.is("a")) {
e.preventDefault();
}
if (!ele.data("modalTrigger")) {
var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
modal.show();
}
});
// close modal on esc button
$(document).on('keydown.modal.uikit', function (e) {
if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
e.preventDefault();
active.hide();
}
});
$win.on("resize orientationchange", UI.Utils.debounce(function(){
if(active) active.resize();
}, 150));
// helper functions
function setContent(content, modal){
if(!modal) return;
if (typeof content === 'object') {
// convert DOM object to a jQuery object
content = content instanceof jQuery ? content : $(content);
if(content.parent().length) {
modal.persist = content;
modal.persist.data("modalPersistParent", content.parent());
}
}else if (typeof content === 'string' || typeof content === 'number') {
// just insert the data as innerHTML
content = $('<div></div>').html(content);
}else {
// unsupported data type!
content = $('<div></div>').html('$.UIkitt.modal Error: Unsupported data type: ' + typeof content);
}
content.appendTo(modal.element.find('.uk-modal-dialog'));
return modal;
}
})(jQuery, jQuery.UIkit, jQuery(window));
(function($, UI) {
"use strict";
var scrollpos = {x: window.scrollX, y: window.scrollY},
$win = $(window),
$doc = $(document),
$html = $('html'),
Offcanvas = {
show: function(element) {
element = $(element);
if (!element.length) return;
var $body = $('body'),
winwidth = $win.width(),
bar = element.find(".uk-offcanvas-bar:first"),
rtl = ($.UIkit.langdirection == "right"),
flip = bar.hasClass("uk-offcanvas-bar-flip") ? -1:1,
dir = flip * (rtl ? -1 : 1);
scrollpos = {x: window.scrollX, y: window.scrollY};
element.addClass("uk-active");
$body.css({"width": window.innerWidth, "height": $win.height()}).addClass("uk-offcanvas-page");
$body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir)).width(); // .width() - force redraw
$html.css('margin-top', scrollpos.y * -1);
bar.addClass("uk-offcanvas-bar-show");
element.off(".ukoffcanvas").on("click.ukoffcanvas swipeRight.ukoffcanvas swipeLeft.ukoffcanvas", function(e) {
var target = $(e.target);
if (!e.type.match(/swipe/)) {
if (!target.hasClass("uk-offcanvas-close")) {
if (target.hasClass("uk-offcanvas-bar")) return;
if (target.parents(".uk-offcanvas-bar:first").length) return;
}
}
e.stopImmediatePropagation();
Offcanvas.hide();
});
$doc.on('keydown.ukoffcanvas', function(e) {
if (e.keyCode === 27) { // ESC
Offcanvas.hide();
}
});
},
hide: function(force) {
var $body = $('body'),
panel = $(".uk-offcanvas.uk-active"),
rtl = ($.UIkit.langdirection == "right"),
bar = panel.find(".uk-offcanvas-bar:first");
if (!panel.length) return;
if ($.UIkit.support.transition && !force) {
$body.one($.UIkit.support.transition.end, function() {
$body.removeClass("uk-offcanvas-page").css({"width": "", "height": ""});
panel.removeClass("uk-active");
$html.css('margin-top', '');
window.scrollTo(scrollpos.x, scrollpos.y);
}).css((rtl ? "margin-right" : "margin-left"), "");
setTimeout(function(){
bar.removeClass("uk-offcanvas-bar-show");
}, 0);
} else {
$body.removeClass("uk-offcanvas-page").css({"width": "", "height": ""});
panel.removeClass("uk-active");
bar.removeClass("uk-offcanvas-bar-show");
$html.css('margin-top', '');
window.scrollTo(scrollpos.x, scrollpos.y);
}
panel.off(".ukoffcanvas");
$doc.off(".ukoffcanvas");
}
};
UI.component('offcanvasTrigger', {
init: function() {
var $this = this;
this.options = $.extend({
"target": $this.element.is("a") ? $this.element.attr("href") : false
}, this.options);
this.on("click", function(e) {
e.preventDefault();
Offcanvas.show($this.options.target);
});
}
});
UI.offcanvas = Offcanvas;
// init code
$doc.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
e.preventDefault();
var ele = $(this);
if (!ele.data("offcanvasTrigger")) {
var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas")));
ele.trigger("click");
}
});
})(jQuery, jQuery.UIkit);
(function($, UI) {
"use strict";
UI.component('nav', {
defaults: {
"toggle": ">li.uk-parent > a[href='#']",
"lists": ">li.uk-parent > ul",
"multiple": false
},
init: function() {
var $this = this;
this.on("click", this.options.toggle, function(e) {
e.preventDefault();
var ele = $(this);
$this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
});
this.find(this.options.lists).each(function() {
var $ele = $(this),
parent = $ele.parent(),
active = parent.hasClass("uk-active");
$ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
parent.data("list-container", $ele.parent());
if (active) $this.open(parent, true);
});
},
open: function(li, noanimation) {
var element = this.element, $li = $(li);
if (!this.options.multiple) {
element.children(".uk-open").not(li).each(function() {
if ($(this).data("list-container")) {
$(this).data("list-container").stop().animate({height: 0}, function() {
$(this).parent().removeClass("uk-open");
});
}
});
}
$li.toggleClass("uk-open");
if ($li.data("list-container")) {
if (noanimation) {
$li.data('list-container').stop().height($li.hasClass("uk-open") ? "auto" : 0);
} else {
$li.data('list-container').stop().animate({
height: ($li.hasClass("uk-open") ? getHeight($li.data('list-container').find('ul:first')) : 0)
});
}
}
}
});
// helper
function getHeight(ele) {
var $ele = $(ele), height = "auto";
if ($ele.is(":visible")) {
height = $ele.outerHeight();
} else {
var tmp = {
position: $ele.css("position"),
visibility: $ele.css("visibility"),
display: $ele.css("display")
};
height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
$ele.css(tmp); // reset element
}
return height;
}
// init code
$(document).on("uk-domready", function(e) {
$("[data-uk-nav]").each(function() {
var nav = $(this);
if (!nav.data("nav")) {
var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
}
});
});
})(jQuery, jQuery.UIkit);
(function($, UI, $win) {
"use strict";
var $tooltip, // tooltip container
tooltipdelay;
UI.component('tooltip', {
defaults: {
"offset": 5,
"pos": "top",
"animation": false,
"delay": 0, // in miliseconds
"src": function() { return this.attr("title"); }
},
tip: "",
init: function() {
var $this = this;
if (!$tooltip) {
$tooltip = $('<div class="uk-tooltip"></div>').appendTo("body");
}
this.on({
"focus" : function(e) { $this.show(); },
"blur" : function(e) { $this.hide(); },
"mouseenter": function(e) { $this.show(); },
"mouseleave": function(e) { $this.hide(); }
});
this.tip = typeof(this.options.src) === "function" ? this.options.src.call(this.element) : this.options.src;
// disable title attribute
this.element.attr("data-cached-title", this.element.attr("title")).attr("title", "");
},
show: function() {
if (tooltipdelay) clearTimeout(tooltipdelay);
if (!this.tip.length) return;
$tooltip.stop().css({"top": -2000, "visibility": "hidden"}).show();
$tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
var $this = this,
bodyoffset = $('body').offset(),
pos = $.extend({}, this.element.offset(), {width: this.element[0].offsetWidth, height: this.element[0].offsetHeight}),
width = $tooltip[0].offsetWidth,
height = $tooltip[0].offsetHeight,
offset = typeof(this.options.offset) === "function" ? this.options.offset.call(this.element) : this.options.offset,
position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
tmppos = position.split("-"),
tcss = {
"display": "none",
"visibility": "visible",
"top": (pos.top + pos.height + height),
"left": pos.left
};
// prevent strange position
// when tooltip is in offcanvas etc.
pos.left -= bodyoffset.left;
pos.top -= bodyoffset.top;
if ((tmppos[0] == "left" || tmppos[0] == "right") && $.UIkit.langdirection == 'right') {
tmppos[0] = tmppos[0] == "left" ? "right" : "left";
}
var variants = {
"bottom" : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
"top" : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
"left" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
"right" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
};
$.extend(tcss, variants[tmppos[0]]);
if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
var boundary = this.checkBoundary(tcss.left, tcss.top, width, height);
if(boundary) {
switch(boundary) {
case "x":
if (tmppos.length == 2) {
position = tmppos[0]+"-"+(tcss.left < 0 ? "left": "right");
} else {
position = tcss.left < 0 ? "right": "left";
}
break;
case "y":
if (tmppos.length == 2) {
position = (tcss.top < 0 ? "bottom": "top")+"-"+tmppos[1];
} else {
position = (tcss.top < 0 ? "bottom": "top");
}
break;
case "xy":
if (tmppos.length == 2) {
position = (tcss.top < 0 ? "bottom": "top")+"-"+(tcss.left < 0 ? "left": "right");
} else {
position = tcss.left < 0 ? "right": "left";
}
break;
}
tmppos = position.split("-");
$.extend(tcss, variants[tmppos[0]]);
if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
}
tcss.left -= $("body").position().left;
tooltipdelay = setTimeout(function(){
$tooltip.css(tcss).attr("class", "uk-tooltip uk-tooltip-" + position);
if ($this.options.animation) {
$tooltip.css({opacity: 0, display: 'block'}).animate({opacity: 1}, parseInt($this.options.animation, 10) || 400);
} else {
$tooltip.show();
}
tooltipdelay = false;
}, parseInt(this.options.delay, 10) || 0);
},
hide: function() {
if(this.element.is("input") && this.element[0]===document.activeElement) return;
if(tooltipdelay) clearTimeout(tooltipdelay);
$tooltip.stop();
if (this.options.animation) {
$tooltip.fadeOut(parseInt(this.options.animation, 10) || 400);
} else {
$tooltip.hide();
}
},
content: function() {
return this.tip;
},
checkBoundary: function(left, top, width, height) {
var axis = "";
if(left < 0 || ((left-$win.scrollLeft())+width) > window.innerWidth) {
axis += "x";
}
if(top < 0 || ((top-$win.scrollTop())+height) > window.innerHeight) {
axis += "y";
}
return axis;
}
});
// init code
$(document).on("mouseenter.tooltip.uikit focus.tooltip.uikit", "[data-uk-tooltip]", function(e) {
var ele = $(this);
if (!ele.data("tooltip")) {
var obj = UI.tooltip(ele, UI.Utils.options(ele.attr("data-uk-tooltip")));
ele.trigger("mouseenter");
}
});
})(jQuery, jQuery.UIkit, jQuery(window));
(function($, UI) {
"use strict";
UI.component('switcher', {
defaults: {
connect : false,
toggle : ">*",
active : 0
},
init: function() {
var $this = this;
this.on("click", this.options.toggle, function(e) {
if ($(this).is('a[href="#"]')) e.preventDefault();
$this.show(this);
});
if (this.options.connect) {
this.connect = $(this.options.connect).find(".uk-active").removeClass(".uk-active").end();
var toggles = this.find(this.options.toggle),
active = toggles.filter(".uk-active");
if (active.length) {
this.show(active);
} else {
active = toggles.eq(this.options.active);
this.show(active.length ? active : toggles.eq(0));
}
}
},
show: function(tab) {
tab = isNaN(tab) ? $(tab) : this.find(this.options.toggle).eq(tab);
var active = tab;
if (active.hasClass("uk-disabled")) return;
this.find(this.options.toggle).filter(".uk-active").removeClass("uk-active");
active.addClass("uk-active");
if (this.options.connect && this.connect.length) {
var index = this.find(this.options.toggle).index(active);
this.connect.children().removeClass("uk-active").eq(index).addClass("uk-active");
}
this.trigger("uk.switcher.show", [active]);
$(document).trigger("uk-check-display");
}
});
// init code
$(document).on("uk-domready", function(e) {
$("[data-uk-switcher]").each(function() {
var switcher = $(this);
if (!switcher.data("switcher")) {
var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher")));
}
});
});
})(jQuery, jQuery.UIkit);
(function($, UI) {
"use strict";
UI.component('tab', {
defaults: {
connect: false,
active: 0
},
init: function() {
var $this = this;
this.on("click", this.options.target, function(e) {
e.preventDefault();
$this.find($this.options.target).not(this).removeClass("uk-active").blur();
$this.trigger("change", [$(this).addClass("uk-active")]);
});
if (this.options.connect) {
this.connect = $(this.options.connect);
}
if (location.hash && location.hash.match(/^#[a-z0-9_-]+$/)) {
var active = this.element.children().filter(window.location.hash);
if (active.length) {
this.element.children().removeClass('uk-active').filter(active).addClass("uk-active");
}
}
var mobiletab = $('<li class="uk-tab-responsive uk-active"><a href="javascript:void(0);"></a></li>'),
caption = mobiletab.find("a:first"),
dropdown = $('<div class="uk-dropdown uk-dropdown-small"><ul class="uk-nav uk-nav-dropdown"></ul><div>'),
ul = dropdown.find("ul");
caption.html(this.find("li.uk-active:first").find("a").text());
if (this.element.hasClass("uk-tab-bottom")) dropdown.addClass("uk-dropdown-up");
if (this.element.hasClass("uk-tab-flip")) dropdown.addClass("uk-dropdown-flip");
this.find("a").each(function(i) {
var tab = $(this).parent(),
item = $('<li><a href="javascript:void(0);">' + tab.text() + '</a></li>').on("click", function(e) {
$this.element.data("switcher").show(i);
});
if (!$(this).parents(".uk-disabled:first").length) ul.append(item);
});
this.element.uk("switcher", {"toggle": ">li:not(.uk-tab-responsive)", "connect": this.options.connect, "active": this.options.active});
mobiletab.append(dropdown).uk("dropdown", {"mode": "click"});
this.element.append(mobiletab).data({
"dropdown": mobiletab.data("dropdown"),
"mobilecaption": caption
}).on("uk.switcher.show", function(e, tab) {
mobiletab.addClass("uk-active");
caption.html(tab.find("a").text());
});
}
});
$(document).on("uk-domready", function(e) {
$("[data-uk-tab]").each(function() {
var tab = $(this);
if (!tab.data("tab")) {
var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab")));
}
});
});
})(jQuery, jQuery.UIkit);
(function($, UI) {
"use strict";
var $win = $(window),
$doc = $(document),
scrollspies = [],
checkScrollSpy = function() {
for(var i=0; i < scrollspies.length; i++) {
UI.support.requestAnimationFrame.apply(window, [scrollspies[i].check]);
}
};
UI.component('scrollspy', {
defaults: {
"cls" : "uk-scrollspy-inview",
"initcls" : "uk-scrollspy-init-inview",
"topoffset" : 0,
"leftoffset" : 0,
"repeat" : false,
"delay" : 0
},
init: function() {
var $this = this, idle, inviewstate, initinview,
fn = function(){
var inview = UI.Utils.isInView($this.element, $this.options);
if(inview && !inviewstate) {
if(idle) clearTimeout(idle);
if(!initinview) {
$this.element.addClass($this.options.initcls);
$this.offset = $this.element.offset();
initinview = true;
$this.trigger("uk.scrollspy.init");
}
idle = setTimeout(function(){
if(inview) {
$this.element.addClass("uk-scrollspy-inview").addClass($this.options.cls).width();
}
}, $this.options.delay);
inviewstate = true;
$this.trigger("uk.scrollspy.inview");
}
if (!inview && inviewstate && $this.options.repeat) {
$this.element.removeClass("uk-scrollspy-inview").removeClass($this.options.cls);
inviewstate = false;
$this.trigger("uk.scrollspy.outview");
}
};
fn();
this.check = fn;
scrollspies.push(this);
}
});
var scrollspynavs = [],
checkScrollSpyNavs = function() {
for(var i=0; i < scrollspynavs.length; i++) {
UI.support.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
}
};
UI.component('scrollspynav', {
defaults: {
"cls" : 'uk-active',
"closest" : false,
"topoffset" : 0,
"leftoffset" : 0,
"smoothscroll" : false
},
init: function() {
var ids = [],
links = this.find("a[href^='#']").each(function(){ ids.push($(this).attr("href")); }),
targets = $(ids.join(","));
var $this = this, inviews, fn = function(){
inviews = [];
for(var i=0 ; i < targets.length ; i++) {
if(UI.Utils.isInView(targets.eq(i), $this.options)) {
inviews.push(targets.eq(i));
}
}
if(inviews.length) {
var scrollTop = $win.scrollTop(),
target = (function(){
for(var i=0; i< inviews.length;i++){
if(inviews[i].offset().top >= scrollTop){
return inviews[i];
}
}
})();
if(!target) return;
if($this.options.closest) {
links.closest($this.options.closest).removeClass($this.options.cls).end().filter("a[href='#"+target.attr("id")+"']").closest($this.options.closest).addClass($this.options.cls);
} else {
links.removeClass($this.options.cls).filter("a[href='#"+target.attr("id")+"']").addClass($this.options.cls);
}
}
};
if(this.options.smoothscroll && UI["smoothScroll"]) {
links.each(function(){
UI.smoothScroll(this, $this.options.smoothscroll);
});
}
fn();
this.element.data("scrollspynav", this);
this.check = fn;
scrollspynavs.push(this);
}
});
var fnCheck = function(){
checkScrollSpy();
checkScrollSpyNavs();
};
// listen to scroll and resize
$doc.on("uk-scroll", fnCheck);
$win.on("resize orientationchange", UI.Utils.debounce(fnCheck, 50));
// init code
$doc.on("uk-domready", function(e) {
$("[data-uk-scrollspy]").each(function() {
var element = $(this);
if (!element.data("scrollspy")) {
var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
}
});
$("[data-uk-scrollspy-nav]").each(function() {
var element = $(this);
if (!element.data("scrollspynav")) {
var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
}
});
});
})(jQuery, jQuery.UIkit);
(function($, UI) {
"use strict";
UI.component('smoothScroll', {
defaults: {
duration: 1000,
transition: 'easeOutExpo',
offset: 0
},
init: function() {
var $this = this;
this.on("click", function(e) {
// get / set parameters
var ele = ($(this.hash).length ? $(this.hash) : $("body")),
target = ele.offset().top - $this.options.offset,
docheight = $(document).height(),
winheight = $(window).height(),
eleheight = ele.outerHeight();
if ((target + winheight) > docheight) {
target = docheight - winheight;
}
// animate to target and set the hash to the window.location after the animation
$("html,body").stop().animate({scrollTop: target}, $this.options.duration, $this.options.transition);
// cancel default click action
return false;
});
}
});
if (!$.easing['easeOutExpo']) {
$.easing['easeOutExpo'] = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
}
// init code
$(document).on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
var ele = $(this);
if (!ele.data("smoothScroll")) {
var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
ele.trigger("click");
}
return false;
});
})(jQuery, jQuery.UIkit);
(function(global, $, UI){
UI.component('toggle', {
defaults: {
target: false,
cls: 'uk-hidden'
},
init: function() {
var $this = this;
this.totoggle = this.options.target ? $(this.options.target):[];
this.on("click", function(e) {
if ($this.element.is('a[href="#"]')) e.preventDefault();
$this.toggle();
});
},
toggle: function() {
if(!this.totoggle.length) return;
this.totoggle.toggleClass(this.options.cls);
if(this.options.cls == 'uk-hidden') {
$(document).trigger("uk-check-display");
}
}
});
$(document).on("uk-domready", function(e) {
$("[data-uk-toggle]").each(function() {
var ele = $(this);
if (!ele.data("toggle")) {
var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
}
});
});
})(this, jQuery, jQuery.UIkit); | linjunpop/cdnjs | ajax/libs/uikit/2.7.0/js/uikit.js | JavaScript | mit | 78,586 |
// Backbone.Marionette v0.8.3
//
// Copyright (C)2012 Derick Bailey, Muted Solutions, LLC
// Distributed Under MIT License
//
// Documentation and Full License Available at:
// http://github.com/derickbailey/backbone.marionette
(function(a,b){if(typeof exports=="object"){var c=require("jquery"),d=require("underscore"),e=require("backbone");module.exports=b(c,d,e)}else typeof define=="function"&&define.amd&&define(["jquery","underscore","backbone"],b)})(this,function(a,b,c){return c.Marionette=function(a,b,c){var d={};d.version="0.8.3",d.View=a.View.extend({getTemplateSelector:function(){var a;return this.options&&this.options.template?a=this.options.template:a=this.template,b.isFunction(a)&&(a=a.call(this)),a},serializeData:function(){var a;return this.model?a=this.model.toJSON():this.collection&&(a={items:this.collection.toJSON()}),a=this.mixinTemplateHelpers(a),a},mixinTemplateHelpers:function(a){a=a||{};var c=this.templateHelpers;return b.isFunction(c)&&(c=c.call(this)),b.extend(a,c)},configureTriggers:function(){if(!this.triggers)return;var a=this.triggers,c=this,d={};return b.isFunction(a)&&(a=a.call(this)),b.each(a,function(a,b){d[b]=function(b){b&&b.preventDefault&&b.preventDefault(),b&&b.stopPropagation&&b.stopPropagation(),c.trigger(a)}}),d},delegateEvents:function(c){c=c||this.events,b.isFunction(c)&&(c=c.call(this));var d={},e=this.configureTriggers();b.extend(d,c,e),a.View.prototype.delegateEvents.call(this,d)},close:function(){this.beforeClose&&this.beforeClose(),this.unbindAll(),this.remove(),this.onClose&&this.onClose(),this.trigger("close"),this.unbind()}}),d.ItemView=d.View.extend({constructor:function(){var a=e.call(arguments);d.View.prototype.constructor.apply(this,a),b.bindAll(this,"render"),this.initialEvents()},initialEvents:function(){this.collection&&this.bindTo(this.collection,"reset",this.render,this)},render:function(){var a=this,b=c.Deferred(),d=function(){a.trigger("before:render",a),a.trigger("item:before:render",a);var b=a.serializeData();c.when(b).then(e)},e=function(b){var d=a.renderHtml(b);c.when(d).then(f)},f=function(b){a.$el.html(b),g(a.onRender,h,a)},h=function(){a.trigger("render",a),a.trigger("item:rendered",a),b.resolve()};return g(this.beforeRender,d,this),b.promise()},renderHtml:function(a){var b=this.getTemplateSelector();return d.Renderer.render(b,a)},close:function(){this.trigger("item:before:close"),d.View.prototype.close.apply(this,arguments),this.trigger("item:closed")}}),d.CollectionView=d.View.extend({constructor:function(){d.View.prototype.constructor.apply(this,arguments),b.bindAll(this,"addItemView","render"),this.initialEvents()},initialEvents:function(){this.collection&&(this.bindTo(this.collection,"add",this.addChildView,this),this.bindTo(this.collection,"remove",this.removeItemView,this),this.bindTo(this.collection,"reset",this.render,this))},addChildView:function(a){var b=this.getItemView();return this.addItemView(a,b)},render:function(){var a=this,b=c.Deferred(),d=[],e=this.getItemView();return this.beforeRender&&this.beforeRender(),this.trigger("collection:before:render",this),this.closeChildren(),this.collection&&this.collection.each(function(b){var c=a.addItemView(b,e);d.push(c)}),b.done(function(){this.onRender&&this.onRender(),this.trigger("collection:rendered",this)}),c.when.apply(this,d).then(function(){b.resolveWith(a)}),b.promise()},getItemView:function(){var a=this.options.itemView||this.itemView;if(!a){var b=new Error("An `itemView` must be specified");throw b.name="NoItemViewError",b}return a},addItemView:function(a,b){var d=this,f=this.buildItemView(a,b);this.bindTo(f,"all",function(){var a=e.call(arguments);a[0]="itemview:"+a[0],a.splice(1,0,f),d.trigger.apply(d,a)}),this.storeChild(f),this.trigger("item:added",f);var g=f.render();return c.when(g).then(function(){d.appendHtml(d,f)}),g},buildItemView:function(a,b){var c=new b({model:a});return c},removeItemView:function(a){var b=this.children[a.cid];b&&(b.close(),delete this.children[a.cid]),this.trigger("item:removed",b)},appendHtml:function(a,b){a.$el.append(b.el)},storeChild:function(a){this.children||(this.children={}),this.children[a.model.cid]=a},close:function(){this.trigger("collection:before:close"),this.closeChildren(),d.View.prototype.close.apply(this,arguments),this.trigger("collection:closed")},closeChildren:function(){this.children&&b.each(this.children,function(a){a.close()})}}),d.CompositeView=d.CollectionView.extend({constructor:function(a){d.CollectionView.apply(this,arguments),this.itemView=this.getItemView()},getItemView:function(){return this.itemView||this.constructor},render:function(){var a=this,b=c.Deferred(),d=this.renderModel();return c.when(d).then(function(d){a.$el.html(d),a.trigger("composite:model:rendered"),a.trigger("render");var e=a.renderCollection();c.when(e).then(function(){b.resolve()})}),b.done(function(){a.trigger("composite:rendered")}),b.promise()},renderCollection:function(){var a=d.CollectionView.prototype.render.apply(this,arguments);return a.done(function(){this.trigger("composite:collection:rendered")}),a.promise()},renderModel:function(){var a={};a=this.serializeData();var b=this.getTemplateSelector();return d.Renderer.render(b,a)}}),d.Region=function(a){this.options=a||{},b.extend(this,a);if(!this.el){var c=new Error("An 'el' must be specified");throw c.name="NoElError",c}this.initialize&&this.initialize.apply(this,arguments)},b.extend(d.Region.prototype,a.Events,{show:function(a,b){this.ensureEl(),this.close(),this.open(a,b),this.currentView=a},ensureEl:function(){if(!this.$el||this.$el.length===0)this.$el=this.getEl(this.el)},getEl:function(a){return c(a)},open:function(a,b){var d=this;b=b||"html",c.when(a.render()).then(function(){d.$el[b](a.el),a.onShow&&a.onShow(),d.onShow&&d.onShow(a),a.trigger("show"),d.trigger("view:show",a)})},close:function(){var a=this.currentView;if(!a)return;a.close&&a.close(),this.trigger("view:closed",a),delete this.currentView},attachView:function(a){this.currentView=a}}),d.Layout=d.ItemView.extend({constructor:function(){this.vent=new a.Marionette.EventAggregator,a.Marionette.ItemView.apply(this,arguments),this.regionManagers={}},render:function(){return this.initializeRegions(),a.Marionette.ItemView.prototype.render.call(this,arguments)},close:function(){this.closeRegions(),a.Marionette.ItemView.prototype.close.call(this,arguments)},initializeRegions:function(){var c=this;b.each(this.regions,function(b,d){var e=new a.Marionette.Region({el:b,getEl:function(a){return c.$(a)}});c.regionManagers[d]=e,c[d]=e})},closeRegions:function(){var a=this;b.each(this.regionManagers,function(b,c){b.close(),delete a[c]}),this.regionManagers={}}}),d.AppRouter=a.Router.extend({constructor:function(b){a.Router.prototype.constructor.call(this,b);if(this.appRoutes){var c=this.controller;b&&b.controller&&(c=b.controller),this.processAppRoutes(c,this.appRoutes)}},processAppRoutes:function(a,c){var d,e,f,g,h,i=[],j=this;for(f in c)c.hasOwnProperty(f)&&i.unshift([f,c[f]]);g=i.length;for(h=0;h<g;h++){f=i[h][0],e=i[h][1],d=a[e];if(!d){var k="Method '"+e+"' was not found on the controller",l=new Error(k);throw l.name="NoMethodError",l}d=b.bind(d,a),j.route(f,e,d)}}}),d.Application=function(a){this.initCallbacks=new d.Callbacks,this.vent=new d.EventAggregator,b.extend(this,a)},b.extend(d.Application.prototype,a.Events,{addInitializer:function(a){this.initCallbacks.add(a)},start:function(a){this.trigger("initialize:before",a),this.initCallbacks.run(this,a),this.trigger("initialize:after",a),this.trigger("start",a)},addRegions:function(a){var b,c,e;for(e in a)a.hasOwnProperty(e)&&(b=a[e],typeof b=="string"?c=new d.Region({el:b}):c=new b,this[e]=c)}}),d.BindTo={bindTo:function(a,b,c,d){d=d||this,a.on(b,c,d),this.bindings||(this.bindings=[]);var e={obj:a,eventName:b,callback:c,context:d};return this.bindings.push(e),e},unbindFrom:function(a){a.obj.off(a.eventName,a.callback),this.bindings=b.reject(this.bindings,function(b){return b===a})},unbindAll:function(){var a=this,c=b.map(this.bindings,b.identity);b.each(c,function(b,c){a.unbindFrom(b)})}},d.Callbacks=function(){this.deferred=c.Deferred(),this.promise=this.deferred.promise()},b.extend(d.Callbacks.prototype,{add:function(a){this.promise.done(function(b,c){a.call(b,c)})},run:function(a,b){this.deferred.resolve(a,b)}}),d.EventAggregator=function(a){b.extend(this,a)},b.extend(d.EventAggregator.prototype,a.Events,d.BindTo,{bindTo:function(a,b,c){return d.BindTo.bindTo.call(this,this,a,b,c)}}),d.TemplateCache={templates:{},loaders:{},get:function(a){var b=this,d=c.Deferred(),e=this.templates[a];if(e)d.resolve(e);else{var f=this.loaders[a];f?d=f:(this.loaders[a]=d,this.loadTemplate(a,function(c){delete b.loaders[a],b.templates[a]=c,d.resolve(c)}))}return d.promise()},loadTemplate:function(a,b){var d=c(a).html();if(!d||d.length===0){var e="Could not find template: '"+a+"'",f=new Error(e);throw f.name="NoTemplateError",f}d=this.compileTemplate(d),b.call(this,d)},compileTemplate:function(a){return b.template(a)},clear:function(){var a,b=arguments.length;if(b>0)for(a=0;a<b;a++)delete this.templates[arguments[a]];else this.templates={}}},d.Renderer={render:function(a,b){var e=this,f=c.Deferred(),g=d.TemplateCache.get(a);return c.when(g).then(function(a){var c=e.renderTemplate(a,b);f.resolve(c)}),f.promise()},renderTemplate:function(a,b){var c=a(b);return c}},d.Modules={module:function(c,e){var f,g,h,i=this,c=c.split("."),j=c.length;for(var k=0;k<j;k++){var l=k===j-1;f=c[k],g=i[f],g||(g=new d.Application),l&&e&&(h=e(g,i,a,d,jQuery,b),h&&(g=h)),i[f]!==g&&(i[f]=g),i=g}return g}};var e=Array.prototype.slice,f=d.View.extend;d.Region.extend=f,d.Application.extend=f,d.Application.prototype.module=d.Modules.module,b.extend(d.View.prototype,d.BindTo),b.extend(d.Application.prototype,d.BindTo),b.extend(d.Region.prototype,d.BindTo);var g=function(a,b,d){var e;a&&(e=a.call(d)),c.when(e).then(b)};return d}(c,b,window.jQuery||window.Zepto||window.ender),c.Marionette}) | sevypannella/cdnjs | ajax/libs/backbone.marionette/0.8.3/amd/backbone.marionette.min.js | JavaScript | mit | 9,960 |
"undefined"==typeof PDFJS&&(("undefined"!=typeof window?window:this).PDFJS={}),function(){"use strict";function t(t){var e=t.indexOf("#"),i=t.indexOf("?"),n=Math.min(e>0?e:t.length,i>0?i:t.length);return t.substring(t.lastIndexOf("/",n)+1,n)}function e(t){var e=window.devicePixelRatio||1,i=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,n=e/i;return{sx:n,sy:n,scaled:1!==n}}function i(t,e){var i=t.offsetParent,n=t.offsetTop+t.clientTop,r=t.offsetLeft+t.clientLeft;if(!i)return void console.error("offsetParent is not set -- cannot scroll");for(;i.clientHeight===i.scrollHeight;)if(i.dataset._scaleY&&(n/=i.dataset._scaleY,r/=i.dataset._scaleX),n+=i.offsetTop,r+=i.offsetLeft,i=i.offsetParent,!i)return;e&&(void 0!==e.top&&(n+=e.top),void 0!==e.left&&(r+=e.left,i.scrollLeft=r)),i.scrollTop=n}function n(t,e){var i=function(i){r||(r=window.requestAnimationFrame(function(){r=null;var i=t.scrollTop,s=n.lastY;i!==s&&(n.down=i>s),n.lastY=i,e(n)}))},n={down:!0,lastY:t.scrollTop,_eventHandler:i},r=null;return t.addEventListener("scroll",i,!0),n}function r(t){for(var e=t.split("&"),i={},n=0,r=e.length;r>n;++n){var s=e[n].split("="),a=s[0].toLowerCase(),o=s.length>1?s[1]:null;i[decodeURIComponent(a)]=decodeURIComponent(o)}return i}function s(t,e){var i=0,n=t.length-1;if(0===t.length||!e(t[n]))return t.length;if(e(t[i]))return i;for(;n>i;){var r=i+n>>1,s=t[r];e(s)?n=r:i=r+1}return i}function a(t,e,i){function n(t){var e=t.div,i=e.offsetTop+e.clientTop+e.clientHeight;return i>f}for(var r,a,o,h,d,u,c,l,f=t.scrollTop,g=f+t.clientHeight,p=t.scrollLeft,v=p+t.clientWidth,m=[],w=0===e.length?0:s(e,n),P=w,y=e.length;y>P&&(r=e[P],a=r.div,o=a.offsetTop+a.clientTop,h=a.clientHeight,!(o>g));P++)c=a.offsetLeft+a.clientLeft,l=a.clientWidth,p>c+l||c>v||(d=Math.max(0,f-o)+Math.max(0,o+h-g),u=100*(h-d)/h|0,m.push({id:r.id,x:c,y:o,view:r,percent:u}));var b=m[0],x=m[m.length-1];return i&&m.sort(function(t,e){var i=t.percent-e.percent;return Math.abs(i)>.001?-i:t.id-e.id}),{first:b,last:x,views:m}}function o(t){return!D.test(t)}function h(){}function d(){}var u=96/72,c="auto",l=1,f=0,g=1.25,p=40,v=5,m=function(){function t(){}var e=["ms","Moz","Webkit","O"],i={};return t.getProp=function(t,n){if(1===arguments.length&&"string"==typeof i[t])return i[t];n=n||document.documentElement;var r,s,a=n.style;if("string"==typeof a[t])return i[t]=t;s=t.charAt(0).toUpperCase()+t.slice(1);for(var o=0,h=e.length;h>o;o++)if(r=e[o]+s,"string"==typeof a[r])return i[t]=r;return i[t]="undefined"},t.setProp=function(t,e,i){var n=this.getProp(t);"undefined"!==n&&(e.style[n]=i)},t}(),w=function(){function t(t,e,i){return Math.min(Math.max(t,e),i)}function e(t,e){this.visible=!0,this.div=document.querySelector(t+" .progress"),this.bar=this.div.parentNode,this.height=e.height||100,this.width=e.width||100,this.units=e.units||"%",this.div.style.height=this.height+this.units,this.percent=0}return e.prototype={updateBar:function(){if(this._indeterminate)return this.div.classList.add("indeterminate"),void(this.div.style.width=this.width+this.units);this.div.classList.remove("indeterminate");var t=this.width*this._percent/100;this.div.style.width=t+this.units},get percent(){return this._percent},set percent(e){this._indeterminate=isNaN(e),this._percent=t(e,0,100),this.updateBar()},setWidth:function(t){if(t){var e=t.parentNode,i=e.offsetWidth-t.offsetWidth;i>0&&this.bar.setAttribute("style","width: calc(100% - "+i+"px);")}},hide:function(){this.visible&&(this.visible=!1,this.bar.classList.add("hidden"),document.body.classList.remove("loadingInProgress"))},show:function(){this.visible||(this.visible=!0,document.body.classList.add("loadingInProgress"),this.bar.classList.remove("hidden"))}},e}(),P=function(){function t(){this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null,this._pagesRefCache=null}return t.prototype={setDocument:function(t,e){this.baseUrl=e,this.pdfDocument=t,this._pagesRefCache=Object.create(null)},setViewer:function(t){this.pdfViewer=t},setHistory:function(t){this.pdfHistory=t},get pagesCount(){return this.pdfDocument.numPages},get page(){return this.pdfViewer.currentPageNumber},set page(t){this.pdfViewer.currentPageNumber=t},navigateTo:function(t){var e,i="",n=this,r=function(e){var s=e instanceof Object?n._pagesRefCache[e.num+" "+e.gen+" R"]:e+1;s?(s>n.pagesCount&&(s=n.pagesCount),n.pdfViewer.scrollPageIntoView(s,t),n.pdfHistory&&n.pdfHistory.push({dest:t,hash:i,page:s})):n.pdfDocument.getPageIndex(e).then(function(t){var i=t+1,s=e.num+" "+e.gen+" R";n._pagesRefCache[s]=i,r(e)})};"string"==typeof t?(i=t,e=this.pdfDocument.getDestination(t)):e=Promise.resolve(t),e.then(function(e){t=e,e instanceof Array&&r(e[0])})},getDestinationHash:function(t){if("string"==typeof t)return this.getAnchorUrl("#"+escape(t));if(t instanceof Array){var e=t[0],i=e instanceof Object?this._pagesRefCache[e.num+" "+e.gen+" R"]:e+1;if(i){var n=this.getAnchorUrl("#page="+i),r=t[1];if("object"==typeof r&&"name"in r&&"XYZ"===r.name){var s=t[4]||this.pdfViewer.currentScaleValue,a=parseFloat(s);a&&(s=100*a),n+="&zoom="+s,(t[2]||t[3])&&(n+=","+(t[2]||0)+","+(t[3]||0))}return n}}return""},getAnchorUrl:function(t){return(this.baseUrl||"")+t},setHash:function(t){if(t.indexOf("=")>=0){var e=r(t);if("nameddest"in e)return this.pdfHistory&&this.pdfHistory.updateNextHashParam(e.nameddest),void this.navigateTo(e.nameddest);var i,n;if("page"in e&&(i=0|e.page||1),"zoom"in e){var s=e.zoom.split(","),a=s[0],o=parseFloat(a);-1===a.indexOf("Fit")?n=[null,{name:"XYZ"},s.length>1?0|s[1]:null,s.length>2?0|s[2]:null,o?o/100:a]:"Fit"===a||"FitB"===a?n=[null,{name:a}]:"FitH"===a||"FitBH"===a||"FitV"===a||"FitBV"===a?n=[null,{name:a},s.length>1?0|s[1]:null]:"FitR"===a?5!==s.length?console.error("PDFLinkService_setHash: Not enough parameters for 'FitR'."):n=[null,{name:a},0|s[1],0|s[2],0|s[3],0|s[4]]:console.error("PDFLinkService_setHash: '"+a+"' is not a valid zoom value.")}n?this.pdfViewer.scrollPageIntoView(i||this.page,n):i&&(this.page=i),"pagemode"in e&&("thumbs"===e.pagemode||"bookmarks"===e.pagemode||"attachments"===e.pagemode?this.switchSidebarView("bookmarks"===e.pagemode?"outline":e.pagemode,!0):"none"===e.pagemode&&this.sidebarOpen&&document.getElementById("sidebarToggle").click())}else/^\d+$/.test(t)?this.page=t:(this.pdfHistory&&this.pdfHistory.updateNextHashParam(unescape(t)),this.navigateTo(unescape(t)))},executeNamedAction:function(t){switch(t){case"GoBack":this.pdfHistory&&this.pdfHistory.back();break;case"GoForward":this.pdfHistory&&this.pdfHistory.forward();break;case"NextPage":this.page++;break;case"PrevPage":this.page--;break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}var e=document.createEvent("CustomEvent");e.initCustomEvent("namedaction",!0,!0,{action:t}),this.pdfViewer.container.dispatchEvent(e)},cachePageRef:function(t,e){var i=e.num+" "+e.gen+" R";this._pagesRefCache[i]=t}},t}(),y={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},b=!1,x=10,_=3e4,k={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},S=function(){function t(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1}return t.prototype={setViewer:function(t){this.pdfViewer=t},setThumbnailViewer:function(t){this.pdfThumbnailViewer=t},isHighestPriority:function(t){return this.highestPriorityPage===t.renderingId},renderHighestPriority:function(t){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.pdfViewer.forceRendering(t)||this.pdfThumbnailViewer&&this.isThumbnailViewEnabled&&this.pdfThumbnailViewer.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),_))},getHighestPriority:function(t,e,i){var n=t.views,r=n.length;if(0===r)return!1;for(var s=0;r>s;++s){var a=n[s].view;if(!this.isViewFinished(a))return a}if(i){var o=t.last.id;if(e[o]&&!this.isViewFinished(e[o]))return e[o]}else{var h=t.first.id-2;if(e[h]&&!this.isViewFinished(e[h]))return e[h]}return null},isViewFinished:function(t){return t.renderingState===k.FINISHED},renderView:function(t){var e=t.renderingState;switch(e){case k.FINISHED:return!1;case k.PAUSED:this.highestPriorityPage=t.renderingId,t.resume();break;case k.RUNNING:this.highestPriorityPage=t.renderingId;break;case k.INITIAL:this.highestPriorityPage=t.renderingId;var i=function(){this.renderHighestPriority()}.bind(this);t.draw().then(i,i)}return!0}},t}(),I=200,C=function(){function t(t){var e=t.container,i=t.id,n=t.scale,r=t.defaultViewport,s=t.renderingQueue,a=t.textLayerFactory,o=t.annotationsLayerFactory;this.id=i,this.renderingId="page"+i,this.rotation=0,this.scale=n||1,this.viewport=r,this.pdfPageRotate=r.rotation,this.hasRestrictedScaling=!1,this.renderingQueue=s,this.textLayerFactory=a,this.annotationsLayerFactory=o,this.renderingState=k.INITIAL,this.resume=null,this.onBeforeDraw=null,this.onAfterDraw=null,this.textLayer=null,this.zoomLayer=null,this.annotationLayer=null;var h=document.createElement("div");h.id="pageContainer"+this.id,h.className="page",h.style.width=Math.floor(this.viewport.width)+"px",h.style.height=Math.floor(this.viewport.height)+"px",h.setAttribute("data-page-number",this.id),this.div=h,e.appendChild(h)}return t.prototype={setPdfPage:function(t){this.pdfPage=t,this.pdfPageRotate=t.rotate;var e=(this.rotation+this.pdfPageRotate)%360;this.viewport=t.getViewport(this.scale*u,e),this.stats=t.stats,this.reset()},destroy:function(){this.zoomLayer=null,this.reset(),this.pdfPage&&this.pdfPage.destroy()},reset:function(t){this.renderTask&&this.renderTask.cancel(),this.resume=null,this.renderingState=k.INITIAL;var e=this.div;e.style.width=Math.floor(this.viewport.width)+"px",e.style.height=Math.floor(this.viewport.height)+"px";for(var i=e.childNodes,n=this.zoomLayer||null,r=t&&this.annotationLayer&&this.annotationLayer.div||null,s=i.length-1;s>=0;s--){var a=i[s];n!==a&&r!==a&&e.removeChild(a)}e.removeAttribute("data-loaded"),t?this.annotationLayer&&this.annotationLayer.hide():this.annotationLayer=null,this.canvas&&(this.canvas.width=0,this.canvas.height=0,delete this.canvas),this.loadingIconDiv=document.createElement("div"),this.loadingIconDiv.className="loadingIcon",e.appendChild(this.loadingIconDiv)},update:function(t,i){this.scale=t||this.scale,"undefined"!=typeof i&&(this.rotation=i);var n=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:this.scale*u,rotation:n});var r=!1;if(this.canvas&&PDFJS.maxCanvasPixels>0){var s=this.canvas.getContext("2d"),a=e(s),o=this.viewport.width*this.viewport.height;Math.sqrt(PDFJS.maxCanvasPixels/o);(Math.floor(this.viewport.width)*a.sx|0)*(Math.floor(this.viewport.height)*a.sy|0)>PDFJS.maxCanvasPixels&&(r=!0)}return this.canvas&&(PDFJS.useOnlyCssZoom||this.hasRestrictedScaling&&r)?void this.cssTransform(this.canvas,!0):(this.canvas&&!this.zoomLayer&&(this.zoomLayer=this.canvas.parentNode,this.zoomLayer.style.position="absolute"),this.zoomLayer&&this.cssTransform(this.zoomLayer.firstChild),void this.reset(!0))},updatePosition:function(){this.textLayer&&this.textLayer.render(I)},cssTransform:function(t,e){var i=this.viewport.width,n=this.viewport.height,r=this.div;t.style.width=t.parentNode.style.width=r.style.width=Math.floor(i)+"px",t.style.height=t.parentNode.style.height=r.style.height=Math.floor(n)+"px";var s=this.viewport.rotation-t._viewport.rotation,a=Math.abs(s),o=1,h=1;90!==a&&270!==a||(o=n/i,h=i/n);var d="rotate("+s+"deg) scale("+o+","+h+")";if(m.setProp("transform",t,d),this.textLayer){var u=this.textLayer.viewport,c=this.viewport.rotation-u.rotation,l=Math.abs(c),f=i/u.width;90!==l&&270!==l||(f=i/u.height);var g,p,v=this.textLayer.textLayerDiv;switch(l){case 0:g=p=0;break;case 90:g=0,p="-"+v.style.height;break;case 180:g="-"+v.style.width,p="-"+v.style.height;break;case 270:g="-"+v.style.width,p=0;break;default:console.error("Bad rotation value.")}m.setProp("transform",v,"rotate("+l+"deg) scale("+f+", "+f+") translate("+g+", "+p+")"),m.setProp("transformOrigin",v,"0% 0%")}e&&this.annotationLayer&&this.annotationLayer.setupAnnotations(this.viewport)},get width(){return this.viewport.width},get height(){return this.viewport.height},getPagePoint:function(t,e){return this.viewport.convertToPdfPoint(t,e)},draw:function(){function t(t){if(b===w.renderTask&&(w.renderTask=null),"cancelled"===t)return void v(t);w.renderingState=k.FINISHED,w.loadingIconDiv&&(r.removeChild(w.loadingIconDiv),delete w.loadingIconDiv),w.zoomLayer&&(r.removeChild(w.zoomLayer),w.zoomLayer=null),w.error=t,w.stats=i.stats,w.onAfterDraw&&w.onAfterDraw();var e=document.createEvent("CustomEvent");e.initCustomEvent("pagerendered",!0,!0,{pageNumber:w.id}),r.dispatchEvent(e),t?v(t):p(void 0)}this.renderingState!==k.INITIAL&&console.error("Must be in new state before drawing"),this.renderingState=k.RUNNING;var i=this.pdfPage,n=this.viewport,r=this.div,s=document.createElement("div");s.style.width=r.style.width,s.style.height=r.style.height,s.classList.add("canvasWrapper");var a=document.createElement("canvas");a.id="page"+this.id,s.appendChild(a),this.annotationLayer?r.insertBefore(s,this.annotationLayer.div):r.appendChild(s),this.canvas=a;var o=a.getContext("2d"),h=e(o);if(PDFJS.useOnlyCssZoom){var d=n.clone({scale:u});h.sx*=d.width/n.width,h.sy*=d.height/n.height,h.scaled=!0}if(PDFJS.maxCanvasPixels>0){var c=n.width*n.height,l=Math.sqrt(PDFJS.maxCanvasPixels/c);h.sx>l||h.sy>l?(h.sx=l,h.sy=l,h.scaled=!0,this.hasRestrictedScaling=!0):this.hasRestrictedScaling=!1}a.width=Math.floor(n.width)*h.sx|0,a.height=Math.floor(n.height)*h.sy|0,a.style.width=Math.floor(n.width)+"px",a.style.height=Math.floor(n.height)+"px",a._viewport=n;var f=null,g=null;this.textLayerFactory&&(f=document.createElement("div"),f.className="textLayer",f.style.width=a.style.width,f.style.height=a.style.height,this.annotationLayer?r.insertBefore(f,this.annotationLayer.div):r.appendChild(f),g=this.textLayerFactory.createTextLayerBuilder(f,this.id-1,this.viewport)),this.textLayer=g,h.scaled&&(o._transformMatrix=[h.sx,0,0,h.sy,0,0],o.scale(h.sx,h.sy));var p,v,m=new Promise(function(t,e){p=t,v=e}),w=this,P=null;this.renderingQueue&&(P=function(t){return w.renderingQueue.isHighestPriority(w)?void t():(w.renderingState=k.PAUSED,void(w.resume=function(){w.renderingState=k.RUNNING,t()}))});var y={canvasContext:o,viewport:this.viewport,continueCallback:P},b=this.renderTask=this.pdfPage.render(y);return this.renderTask.promise.then(function(){t(null),g&&w.pdfPage.getTextContent().then(function(t){g.setTextContent(t),g.render(I)})},function(e){t(e)}),this.annotationsLayerFactory&&(this.annotationLayer||(this.annotationLayer=this.annotationsLayerFactory.createAnnotationsLayerBuilder(r,this.pdfPage)),this.annotationLayer.setupAnnotations(this.viewport)),r.setAttribute("data-loaded",!0),w.onBeforeDraw&&w.onBeforeDraw(),m},beforePrint:function(){var t=this.pdfPage,e=t.getViewport(1),i=2,n=document.createElement("canvas");n.width=Math.floor(e.width)*i,n.height=Math.floor(e.height)*i,n.style.width=100*i+"%",n.style.height=100*i+"%";var r="scale("+1/i+", "+1/i+")";m.setProp("transform",n,r),m.setProp("transformOrigin",n,"0% 0%");var s=document.getElementById("printContainer"),a=document.createElement("div");a.style.width=e.width+"pt",a.style.height=e.height+"pt",a.appendChild(n),s.appendChild(a),n.mozPrintCallback=function(r){var s=r.context;s.save(),s.fillStyle="rgb(255, 255, 255)",s.fillRect(0,0,n.width,n.height),s.restore(),s._transformMatrix=[i,0,0,i,0,0],s.scale(i,i);var a={canvasContext:s,viewport:e,intent:"print"};t.render(a).promise.then(function(){r.done()},function(t){console.error(t),"abort"in r?r.abort():r.done()})}}},t}(),L=1e5,D=/\S/,N=function(){function t(t){this.textLayerDiv=t.textLayerDiv,this.renderingDone=!1,this.divContentDone=!1,this.pageIdx=t.pageIndex,this.pageNumber=this.pageIdx+1,this.matches=[],this.viewport=t.viewport,this.textDivs=[],this.findController=t.findController||null}return t.prototype={_finishRendering:function(){this.renderingDone=!0;var t=document.createEvent("CustomEvent");t.initCustomEvent("textlayerrendered",!0,!0,{pageNumber:this.pageNumber}),this.textLayerDiv.dispatchEvent(t)},renderLayer:function(){var t=document.createDocumentFragment(),e=this.textDivs,i=e.length,n=document.createElement("canvas"),r=n.getContext("2d");if(i>L)return void this._finishRendering();for(var s,a,o=0;i>o;o++){var h=e[o];if(void 0===h.dataset.isWhitespace){var d=h.style.fontSize,u=h.style.fontFamily;d===s&&u===a||(r.font=d+" "+u,s=d,a=u);var c=r.measureText(h.textContent).width;if(c>0){t.appendChild(h);var l;if(void 0!==h.dataset.canvasWidth){var f=h.dataset.canvasWidth/c;l="scaleX("+f+")"}else l="";var g=h.dataset.angle;g&&(l="rotate("+g+"deg) "+l),l&&m.setProp("transform",h,l)}}}this.textLayerDiv.appendChild(t),this._finishRendering(),this.updateMatches()},render:function(t){if(this.divContentDone&&!this.renderingDone)if(this.renderTimer&&(clearTimeout(this.renderTimer),this.renderTimer=null),t){var e=this;this.renderTimer=setTimeout(function(){e.renderLayer(),e.renderTimer=null},t)}else this.renderLayer()},appendText:function(t,e){var i=e[t.fontName],n=document.createElement("div");if(this.textDivs.push(n),o(t.str))return void(n.dataset.isWhitespace=!0);var r=PDFJS.Util.transform(this.viewport.transform,t.transform),s=Math.atan2(r[1],r[0]);i.vertical&&(s+=Math.PI/2);var a=Math.sqrt(r[2]*r[2]+r[3]*r[3]),h=a;i.ascent?h=i.ascent*h:i.descent&&(h=(1+i.descent)*h);var d,u;0===s?(d=r[4],u=r[5]-h):(d=r[4]+h*Math.sin(s),u=r[5]-h*Math.cos(s)),n.style.left=d+"px",n.style.top=u+"px",n.style.fontSize=a+"px",n.style.fontFamily=i.fontFamily,n.textContent=t.str,PDFJS.pdfBug&&(n.dataset.fontName=t.fontName),0!==s&&(n.dataset.angle=s*(180/Math.PI)),t.str.length>1&&(i.vertical?n.dataset.canvasWidth=t.height*this.viewport.scale:n.dataset.canvasWidth=t.width*this.viewport.scale)},setTextContent:function(t){this.textContent=t;for(var e=t.items,i=0,n=e.length;n>i;i++)this.appendText(e[i],t.styles);this.divContentDone=!0},convertMatches:function(t){for(var e=0,i=0,n=this.textContent.items,r=n.length-1,s=null===this.findController?0:this.findController.state.query.length,a=[],o=0,h=t.length;h>o;o++){for(var d=t[o];e!==r&&d>=i+n[e].str.length;)i+=n[e].str.length,e++;e===n.length&&console.error("Could not find a matching mapping");var u={begin:{divIdx:e,offset:d-i}};for(d+=s;e!==r&&d>i+n[e].str.length;)i+=n[e].str.length,e++;u.end={divIdx:e,offset:d-i},a.push(u)}return a},renderMatches:function(t){function e(t,e){var n=t.divIdx;r[n].textContent="",i(n,0,t.offset,e)}function i(t,e,i,s){var a=r[t],o=n[t].str.substring(e,i),h=document.createTextNode(o);if(s){var d=document.createElement("span");return d.className=s,d.appendChild(h),void a.appendChild(d)}a.appendChild(h)}if(0!==t.length){var n=this.textContent.items,r=this.textDivs,s=null,a=this.pageIdx,o=null===this.findController?!1:a===this.findController.selected.pageIdx,h=null===this.findController?-1:this.findController.selected.matchIdx,d=null===this.findController?!1:this.findController.state.highlightAll,u={divIdx:-1,offset:void 0},c=h,l=c+1;if(d)c=0,l=t.length;else if(!o)return;for(var f=c;l>f;f++){var g=t[f],p=g.begin,v=g.end,m=o&&f===h,w=m?" selected":"";if(this.findController&&this.findController.updateMatchPosition(a,f,r,p.divIdx,v.divIdx),s&&p.divIdx===s.divIdx?i(s.divIdx,s.offset,p.offset):(null!==s&&i(s.divIdx,s.offset,u.offset),e(p)),p.divIdx===v.divIdx)i(p.divIdx,p.offset,v.offset,"highlight"+w);else{i(p.divIdx,p.offset,u.offset,"highlight begin"+w);for(var P=p.divIdx+1,y=v.divIdx;y>P;P++)r[P].className="highlight middle"+w;e(v,"highlight end"+w)}s=v}s&&i(s.divIdx,s.offset,u.offset)}},updateMatches:function(){if(this.renderingDone){for(var t=this.matches,e=this.textDivs,i=this.textContent.items,n=-1,r=0,s=t.length;s>r;r++){for(var a=t[r],o=Math.max(n,a.begin.divIdx),h=o,d=a.end.divIdx;d>=h;h++){var u=e[h];u.textContent=i[h].str,u.className=""}n=a.end.divIdx+1}null!==this.findController&&this.findController.active&&(this.matches=this.convertMatches(null===this.findController?[]:this.findController.pageMatches[this.pageIdx]||[]),this.renderMatches(this.matches))}}},t}();h.prototype={createTextLayerBuilder:function(t,e,i){return new N({textLayerDiv:t,pageIndex:e,viewport:i})}};var H=function(){function t(t){this.pageDiv=t.pageDiv,this.pdfPage=t.pdfPage,this.linkService=t.linkService,this.div=null}return t.prototype={setupAnnotations:function(t){function e(t,e){t.href=n.getDestinationHash(e),t.onclick=function(){return e&&n.navigateTo(e),!1},e&&(t.className="internalLink")}function i(t,e){t.href=n.getAnchorUrl(""),t.onclick=function(){return n.executeNamedAction(e),!1},t.className="internalLink"}var n=this.linkService,r=this.pdfPage,s=this;r.getAnnotations().then(function(n){t=t.clone({dontFlip:!0});var a,o,h,d,u=t.transform,c="matrix("+u.join(",")+")";if(s.div){for(h=0,d=n.length;d>h;h++)a=n[h],o=s.div.querySelector('[data-annotation-id="'+a.id+'"]'),o&&m.setProp("transform",o,c);s.div.removeAttribute("hidden")}else for(h=0,d=n.length;d>h;h++)if(a=n[h],a&&a.hasHtml){o=PDFJS.AnnotationUtils.getHtmlElement(a,r.commonObjs),o.setAttribute("data-annotation-id",a.id),"undefined"!=typeof mozL10n&&mozL10n.translate(o);var l=a.rect,f=r.view;l=PDFJS.Util.normalizeRect([l[0],f[3]-l[1]+f[1],l[2],f[3]-l[3]+f[1]]),o.style.left=l[0]+"px",o.style.top=l[1]+"px",o.style.position="absolute",m.setProp("transform",o,c);var g=-l[0]+"px "+-l[1]+"px";if(m.setProp("transformOrigin",o,g),"Link"===a.subtype&&!a.url){var p=o.getElementsByTagName("a")[0];p&&(a.action?i(p,a.action):e(p,"dest"in a?a.dest:null))}if(!s.div){var v=document.createElement("div");v.className="annotationLayer",s.pageDiv.appendChild(v),s.div=v}s.div.appendChild(o)}})},hide:function(){this.div&&this.div.setAttribute("hidden","true")}},t}();d.prototype={createAnnotationsLayerBuilder:function(t,e){return new H({pageDiv:t,pdfPage:e,linkService:new F})}};var T=function(){function t(t){var e=[];this.push=function(i){var n=e.indexOf(i);n>=0&&e.splice(n,1),e.push(i),e.length>t&&e.shift().destroy()},this.resize=function(i){for(t=i;e.length>t;)e.shift().destroy()}}function e(t,e){return e===t?!0:Math.abs(e-t)<1e-15}function r(t){this.container=t.container,this.viewer=t.viewer||t.container.firstElementChild,this.linkService=t.linkService||new F,this.removePageBorders=t.removePageBorders||!1,this.defaultRenderingQueue=!t.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new S,this.renderingQueue.setViewer(this)):this.renderingQueue=t.renderingQueue,this.scroll=n(this.container,this._scrollUpdate.bind(this)),this.updateInProgress=!1,this.presentationModeState=y.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders")}return r.prototype={get pagesCount(){return this._pages.length},getPageView:function(t){return this._pages[t]},get currentPageNumber(){return this._currentPageNumber},set currentPageNumber(t){if(!this.pdfDocument)return void(this._currentPageNumber=t);var e=document.createEvent("UIEvents");return e.initUIEvent("pagechange",!0,!0,window,0),e.updateInProgress=this.updateInProgress,t>0&&t<=this.pagesCount?(e.previousPageNumber=this._currentPageNumber,this._currentPageNumber=t,e.pageNumber=t,this.container.dispatchEvent(e),void(this.updateInProgress||this.scrollPageIntoView(t))):(e.pageNumber=this._currentPageNumber,e.previousPageNumber=t,void this.container.dispatchEvent(e))},get currentScale(){return this._currentScale!==f?this._currentScale:l},set currentScale(t){if(isNaN(t))throw new Error("Invalid numeric scale");return this.pdfDocument?void this._setScale(t,!1):(this._currentScale=t,void(this._currentScaleValue=t!==f?t.toString():null))},get currentScaleValue(){return this._currentScaleValue},set currentScaleValue(t){return this.pdfDocument?void this._setScale(t,!1):(this._currentScale=isNaN(t)?f:t,void(this._currentScaleValue=t))},get pagesRotation(){return this._pagesRotation},set pagesRotation(t){this._pagesRotation=t;for(var e=0,i=this._pages.length;i>e;e++){var n=this._pages[e];n.update(n.scale,t)}this._setScale(this._currentScaleValue,!0),this.defaultRenderingQueue&&this.update()},setDocument:function(t){if(this.pdfDocument&&this._resetView(),this.pdfDocument=t,t){var e,i=t.numPages,n=this,r=new Promise(function(t){e=t});this.pagesPromise=r,r.then(function(){var t=document.createEvent("CustomEvent");t.initCustomEvent("pagesloaded",!0,!0,{pagesCount:i}),n.container.dispatchEvent(t)});var s=!1,a=null,o=new Promise(function(t){a=t});this.onePageRendered=o;var h=function(t){t.onBeforeDraw=function(){n._buffer.push(this)},t.onAfterDraw=function(){s||(s=!0,a())}},d=t.getPage(1);return this.firstPagePromise=d,d.then(function(r){for(var s=this.currentScale,a=r.getViewport(s*u),d=1;i>=d;++d){var c=null;PDFJS.disableTextLayer||(c=this);var l=new C({container:this.viewer,id:d,scale:s,defaultViewport:a.clone(),renderingQueue:this.renderingQueue,textLayerFactory:c,annotationsLayerFactory:this});h(l),this._pages.push(l)}var f=this.linkService;o.then(function(){if(PDFJS.disableAutoFetch)e();else for(var r=i,s=1;i>=s;++s)t.getPage(s).then(function(t,i){var s=n._pages[t-1];s.pdfPage||s.setPdfPage(i),f.cachePageRef(t,i.ref),r--,r||e()}.bind(null,s))});var g=document.createEvent("CustomEvent");g.initCustomEvent("pagesinit",!0,!0,null),n.container.dispatchEvent(g),this.defaultRenderingQueue&&this.update(),this.findController&&this.findController.resolveFirstPage()}.bind(this))}},_resetView:function(){this._pages=[],this._currentPageNumber=1,this._currentScale=f,this._currentScaleValue=null,this._buffer=new t(x),this._location=null,this._pagesRotation=0,this._pagesRequests=[];for(var e=this.viewer;e.hasChildNodes();)e.removeChild(e.lastChild)},_scrollUpdate:function(){if(0!==this.pagesCount){this.update();for(var t=0,e=this._pages.length;e>t;t++)this._pages[t].updatePosition()}},_setScaleDispatchEvent:function(t,e,i){var n=document.createEvent("UIEvents");n.initUIEvent("scalechange",!0,!0,window,0),n.scale=t,i&&(n.presetValue=e),this.container.dispatchEvent(n)},_setScaleUpdatePages:function(t,i,n,r){if(this._currentScaleValue=i,e(this._currentScale,t))return void(r&&this._setScaleDispatchEvent(t,i,!0));for(var s=0,a=this._pages.length;a>s;s++)this._pages[s].update(t);if(this._currentScale=t,!n){var o,h=this._currentPageNumber;!this._location||b||this.isInPresentationMode||this.isChangingPresentationMode||(h=this._location.pageNumber,o=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView(h,o)}this._setScaleDispatchEvent(t,i,r),this.defaultRenderingQueue&&this.update()},_setScale:function(t,e){var i=parseFloat(t);if(i>0)this._setScaleUpdatePages(i,t,e,!1);else{var n=this._pages[this._currentPageNumber-1];if(!n)return;var r=this.isInPresentationMode||this.removePageBorders?0:p,s=this.isInPresentationMode||this.removePageBorders?0:v,a=(this.container.clientWidth-r)/n.width*n.scale,o=(this.container.clientHeight-s)/n.height*n.scale;switch(t){case"page-actual":i=1;break;case"page-width":i=a;break;case"page-height":i=o;break;case"page-fit":i=Math.min(a,o);break;case"auto":var h=n.width>n.height,d=h?Math.min(o,a):a;i=Math.min(g,d);break;default:return void console.error("pdfViewSetScale: '"+t+"' is an unknown zoom value.")}this._setScaleUpdatePages(i,t,e,!0)}},scrollPageIntoView:function(t,e){var n=this._pages[t-1];if(this.isInPresentationMode){if(this._currentPageNumber!==n.id)return void(this.currentPageNumber=n.id);e=null,this._setScale(this._currentScaleValue,!0)}if(!e)return void i(n.div);var r,s,a=0,o=0,h=0,d=0,l=n.rotation%180!==0,g=(l?n.height:n.width)/n.scale/u,m=(l?n.width:n.height)/n.scale/u,w=0;switch(e[1].name){case"XYZ":a=e[2],o=e[3],w=e[4],a=null!==a?a:0,o=null!==o?o:m;break;case"Fit":case"FitB":w="page-fit";break;case"FitH":case"FitBH":o=e[2],w="page-width";break;case"FitV":case"FitBV":a=e[2],h=g,d=m,w="page-height";break;case"FitR":a=e[2],o=e[3],h=e[4]-a,d=e[5]-o;var P=this.removePageBorders?0:p,y=this.removePageBorders?0:v;r=(this.container.clientWidth-P)/h/u,s=(this.container.clientHeight-y)/d/u,w=Math.min(Math.abs(r),Math.abs(s));break;default:return}if(w&&w!==this._currentScale?this.currentScaleValue=w:this._currentScale===f&&(this.currentScaleValue=c),"page-fit"===w&&!e[4])return void i(n.div);var b=[n.viewport.convertToViewportPoint(a,o),n.viewport.convertToViewportPoint(a+h,o+d)],x=Math.min(b[0][0],b[1][0]),_=Math.min(b[0][1],b[1][1]);i(n.div,{left:x,top:_})},_updateLocation:function(t){var e=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===e?Math.round(1e4*e)/100:i,r=t.id,s="#page="+r;s+="&zoom="+n;var a=this._pages[r-1],o=this.container,h=a.getPagePoint(o.scrollLeft-t.x,o.scrollTop-t.y),d=Math.round(h[0]),u=Math.round(h[1]);s+=","+d+","+u,this._location={pageNumber:r,scale:n,top:u,left:d,pdfOpenParams:s}},update:function(){var t=this._getVisiblePages(),e=t.views;if(0!==e.length){this.updateInProgress=!0;var i=Math.max(x,2*e.length+1);this._buffer.resize(i),this.renderingQueue.renderHighestPriority(t);for(var n=this._currentPageNumber,r=t.first,s=0,a=e.length,o=!1;a>s;++s){var h=e[s];if(h.percent<100)break;if(h.id===n){o=!0;break}}o||(n=e[0].id),this.isInPresentationMode||(this.currentPageNumber=n),this._updateLocation(r),this.updateInProgress=!1;var d=document.createEvent("UIEvents");d.initUIEvent("updateviewarea",!0,!0,window,0),d.location=this._location,this.container.dispatchEvent(d)}},containsElement:function(t){return this.container.contains(t)},focus:function(){this.container.focus()},get isInPresentationMode(){return this.presentationModeState===y.FULLSCREEN},get isChangingPresentationMode(){return this.PresentationModeState===y.CHANGING},get isHorizontalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollWidth>this.container.clientWidth},_getVisiblePages:function(){if(this.isInPresentationMode){var t=[],e=this._pages[this._currentPageNumber-1];return t.push({id:e.id,view:e}),{first:e,last:e,views:t}}return a(this.container,this._pages,!0)},cleanup:function(){for(var t=0,e=this._pages.length;e>t;t++)this._pages[t]&&this._pages[t].renderingState!==k.FINISHED&&this._pages[t].reset()},_ensurePdfPageLoaded:function(t){if(t.pdfPage)return Promise.resolve(t.pdfPage);var e=t.id;if(this._pagesRequests[e])return this._pagesRequests[e];var i=this.pdfDocument.getPage(e).then(function(i){return t.setPdfPage(i),this._pagesRequests[e]=null,i}.bind(this));return this._pagesRequests[e]=i,i},forceRendering:function(t){var e=t||this._getVisiblePages(),i=this.renderingQueue.getHighestPriority(e,this._pages,this.scroll.down);return i?(this._ensurePdfPageLoaded(i).then(function(){this.renderingQueue.renderView(i)}.bind(this)),!0):!1},getPageTextContent:function(t){return this.pdfDocument.getPage(t+1).then(function(t){return t.getTextContent()})},createTextLayerBuilder:function(t,e,i){return new N({textLayerDiv:t,pageIndex:e,viewport:i,findController:this.isInPresentationMode?null:this.findController})},createAnnotationsLayerBuilder:function(t,e){return new H({pageDiv:t,pdfPage:e,linkService:this.linkService})},setFindController:function(t){this.findController=t}},r}(),F=function(){function t(){}return t.prototype={get page(){return 0},set page(t){},navigateTo:function(t){},getDestinationHash:function(t){return"#"},getAnchorUrl:function(t){return"#"},setHash:function(t){},executeNamedAction:function(t){},cachePageRef:function(t,e){}},t}(),E=function(){function t(t){this.linkService=t.linkService,this.initialized=!1,this.initialDestination=null,this.initialBookmark=null}return t.prototype={initialize:function(t){function e(){var t=n._getPreviousParams(null,!0);if(t){var i=!n.current.dest&&n.current.hash!==n.previousHash;n._pushToHistory(t,!1,i),n._updatePreviousBookmark()}window.removeEventListener("beforeunload",e,!1)}this.initialized=!0,this.reInitialized=!1,this.allowHashChange=!0,this.historyUnlocked=!0,this.isViewerInPresentationMode=!1,
this.previousHash=window.location.hash.substring(1),this.currentBookmark="",this.currentPage=0,this.updatePreviousBookmark=!1,this.previousBookmark="",this.previousPage=0,this.nextHashParam="",this.fingerprint=t,this.currentUid=this.uid=0,this.current={};var i=window.history.state;this._isStateObjectDefined(i)?(i.target.dest?this.initialDestination=i.target.dest:this.initialBookmark=i.target.hash,this.currentUid=i.uid,this.uid=i.uid+1,this.current=i.target):(i&&i.fingerprint&&this.fingerprint!==i.fingerprint&&(this.reInitialized=!0),this._pushOrReplaceState({fingerprint:this.fingerprint},!0));var n=this;window.addEventListener("popstate",function(t){if(t.preventDefault(),t.stopPropagation(),n.historyUnlocked)if(t.state)n._goTo(t.state);else{if(n.previousHash=window.location.hash.substring(1),0===n.uid){var e=n.previousHash&&n.currentBookmark&&n.previousHash!==n.currentBookmark?{hash:n.currentBookmark,page:n.currentPage}:{page:1};n.historyUnlocked=!1,n.allowHashChange=!1,window.history.back(),n._pushToHistory(e,!1,!0),window.history.forward(),n.historyUnlocked=!0}n._pushToHistory({hash:n.previousHash},!1,!0),n._updatePreviousBookmark()}},!1),window.addEventListener("beforeunload",e,!1),window.addEventListener("pageshow",function(t){window.addEventListener("beforeunload",e,!1)},!1),window.addEventListener("presentationmodechanged",function(t){n.isViewerInPresentationMode=!!t.detail.active})},clearHistoryState:function(){this._pushOrReplaceState(null,!0)},_isStateObjectDefined:function(t){return!!(t&&t.uid>=0&&t.fingerprint&&this.fingerprint===t.fingerprint&&t.target&&t.target.hash)},_pushOrReplaceState:function(t,e){e?window.history.replaceState(t,""):window.history.pushState(t,"")},get isHashChangeUnlocked(){if(!this.initialized)return!0;var t=this.allowHashChange;return this.allowHashChange=!0,t},_updatePreviousBookmark:function(){this.updatePreviousBookmark&&this.currentBookmark&&this.currentPage&&(this.previousBookmark=this.currentBookmark,this.previousPage=this.currentPage,this.updatePreviousBookmark=!1)},updateCurrentBookmark:function(t,e){this.initialized&&(this.currentBookmark=t.substring(1),this.currentPage=0|e,this._updatePreviousBookmark())},updateNextHashParam:function(t){this.initialized&&(this.nextHashParam=t)},push:function(t,e){if(this.initialized&&this.historyUnlocked){if(t.dest&&!t.hash&&(t.hash=this.current.hash&&this.current.dest&&this.current.dest===t.dest?this.current.hash:this.linkService.getDestinationHash(t.dest).split("#")[1]),t.page&&(t.page|=0),e){var i=window.history.state.target;return i||(this._pushToHistory(t,!1),this.previousHash=window.location.hash.substring(1)),this.updatePreviousBookmark=!this.nextHashParam,void(i&&this._updatePreviousBookmark())}if(this.nextHashParam){if(this.nextHashParam===t.hash)return this.nextHashParam=null,void(this.updatePreviousBookmark=!0);this.nextHashParam=null}t.hash?this.current.hash?this.current.hash!==t.hash?this._pushToHistory(t,!0):(!this.current.page&&t.page&&this._pushToHistory(t,!1,!0),this.updatePreviousBookmark=!0):this._pushToHistory(t,!0):this.current.page&&t.page&&this.current.page!==t.page&&this._pushToHistory(t,!0)}},_getPreviousParams:function(t,e){if(!this.currentBookmark||!this.currentPage)return null;if(this.updatePreviousBookmark&&(this.updatePreviousBookmark=!1),this.uid>0&&(!this.previousBookmark||!this.previousPage))return null;if(!this.current.dest&&!t||e){if(this.previousBookmark===this.currentBookmark)return null}else{if(!this.current.page&&!t)return null;if(this.previousPage===this.currentPage)return null}var i={hash:this.currentBookmark,page:this.currentPage};return this.isViewerInPresentationMode&&(i.hash=null),i},_stateObj:function(t){return{fingerprint:this.fingerprint,uid:this.uid,target:t}},_pushToHistory:function(t,e,i){if(this.initialized){if(!t.hash&&t.page&&(t.hash="page="+t.page),e&&!i){var n=this._getPreviousParams();if(n){var r=!this.current.dest&&this.current.hash!==this.previousHash;this._pushToHistory(n,!1,r)}}this._pushOrReplaceState(this._stateObj(t),i||0===this.uid),this.currentUid=this.uid++,this.current=t,this.updatePreviousBookmark=!0}},_goTo:function(t){if(this.initialized&&this.historyUnlocked&&this._isStateObjectDefined(t)){if(!this.reInitialized&&t.uid<this.currentUid){var e=this._getPreviousParams(!0);if(e)return this._pushToHistory(this.current,!1),this._pushToHistory(e,!1),this.currentUid=t.uid,void window.history.back()}this.historyUnlocked=!1,t.target.dest?this.linkService.navigateTo(t.target.dest):this.linkService.setHash(t.target.hash),this.currentUid=t.uid,t.uid>this.uid&&(this.uid=t.uid),this.current=t.target,this.updatePreviousBookmark=!0;var i=window.location.hash.substring(1);this.previousHash!==i&&(this.allowHashChange=!1),this.previousHash=i,this.historyUnlocked=!0}},back:function(){this.go(-1)},forward:function(){this.go(1)},go:function(t){if(this.initialized&&this.historyUnlocked){var e=window.history.state;-1===t&&e&&e.uid>0?window.history.back():1===t&&e&&e.uid<this.uid-1&&window.history.forward()}}},t}();PDFJS.PDFViewer=T,PDFJS.PDFPageView=C,PDFJS.PDFLinkService=P,PDFJS.TextLayerBuilder=N,PDFJS.DefaultTextLayerFactory=h,PDFJS.AnnotationsLayerBuilder=H,PDFJS.DefaultAnnotationsLayerFactory=d,PDFJS.PDFHistory=E,PDFJS.getFileName=t,PDFJS.ProgressBar=w}.call("undefined"==typeof window?this:window);
//# sourceMappingURL=pdf_viewer.min.js.map | iwdmb/cdnjs | ajax/libs/pdf.js/1.1.352/pdf_viewer.min.js | JavaScript | mit | 37,372 |
<?php
//============================================================+
// File name : tcpdf_filters.php
// Version : 1.0.001
// Begin : 2011-05-23
// Last Update : 2014-04-25
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2011-2013 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF 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 Lesser General Public License for more details.
//
// You should have received a copy of the License
// along with TCPDF. If not, see
// <http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : This is a PHP class for decoding common PDF filters (PDF 32000-2008 - 7.4 Filters).
//
//============================================================+
/**
* @file
* This is a PHP class for decoding common PDF filters (PDF 32000-2008 - 7.4 Filters).<br>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.001
*/
/**
* @class TCPDF_FILTERS
* This is a PHP class for decoding common PDF filters (PDF 32000-2008 - 7.4 Filters).<br>
* @package com.tecnick.tcpdf
* @brief This is a PHP class for decoding common PDF filters.
* @version 1.0.001
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF_FILTERS {
/**
* Define a list of available filter decoders.
* @private static
*/
private static $available_filters = array('ASCIIHexDecode', 'ASCII85Decode', 'LZWDecode', 'FlateDecode', 'RunLengthDecode');
// -----------------------------------------------------------------------------
/**
* Get a list of available decoding filters.
* @return (array) Array of available filter decoders.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function getAvailableFilters() {
return self::$available_filters;
}
/**
* Decode data using the specified filter type.
* @param $filter (string) Filter name.
* @param $data (string) Data to decode.
* @return Decoded data string.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilter($filter, $data) {
switch ($filter) {
case 'ASCIIHexDecode': {
return self::decodeFilterASCIIHexDecode($data);
break;
}
case 'ASCII85Decode': {
return self::decodeFilterASCII85Decode($data);
break;
}
case 'LZWDecode': {
return self::decodeFilterLZWDecode($data);
break;
}
case 'FlateDecode': {
return self::decodeFilterFlateDecode($data);
break;
}
case 'RunLengthDecode': {
return self::decodeFilterRunLengthDecode($data);
break;
}
case 'CCITTFaxDecode': {
return self::decodeFilterCCITTFaxDecode($data);
break;
}
case 'JBIG2Decode': {
return self::decodeFilterJBIG2Decode($data);
break;
}
case 'DCTDecode': {
return self::decodeFilterDCTDecode($data);
break;
}
case 'JPXDecode': {
return self::decodeFilterJPXDecode($data);
break;
}
case 'Crypt': {
return self::decodeFilterCrypt($data);
break;
}
default: {
return self::decodeFilterStandard($data);
break;
}
}
}
// --- FILTERS (PDF 32000-2008 - 7.4 Filters) ------------------------------
/**
* Standard
* Default decoding filter (leaves data unchanged).
* @param $data (string) Data to decode.
* @return Decoded data string.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilterStandard($data) {
return $data;
}
/**
* ASCIIHexDecode
* Decodes data encoded in an ASCII hexadecimal representation, reproducing the original binary data.
* @param $data (string) Data to decode.
* @return Decoded data string.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilterASCIIHexDecode($data) {
// initialize string to return
$decoded = '';
// all white-space characters shall be ignored
$data = preg_replace('/[\s]/', '', $data);
// check for EOD character: GREATER-THAN SIGN (3Eh)
$eod = strpos($data, '>');
if ($eod !== false) {
// remove EOD and extra data (if any)
$data = substr($data, 0, $eod);
$eod = true;
}
// get data length
$data_length = strlen($data);
if (($data_length % 2) != 0) {
// odd number of hexadecimal digits
if ($eod) {
// EOD shall behave as if a 0 (zero) followed the last digit
$data = substr($data, 0, -1).'0'.substr($data, -1);
} else {
self::Error('decodeFilterASCIIHexDecode: invalid code');
}
}
// check for invalid characters
if (preg_match('/[^a-fA-F\d]/', $data) > 0) {
self::Error('decodeFilterASCIIHexDecode: invalid code');
}
// get one byte of binary data for each pair of ASCII hexadecimal digits
$decoded = pack('H*', $data);
return $decoded;
}
/**
* ASCII85Decode
* Decodes data encoded in an ASCII base-85 representation, reproducing the original binary data.
* @param $data (string) Data to decode.
* @return Decoded data string.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilterASCII85Decode($data) {
// initialize string to return
$decoded = '';
// all white-space characters shall be ignored
$data = preg_replace('/[\s]/', '', $data);
// remove start sequence 2-character sequence <~ (3Ch)(7Eh)
if (strpos($data, '<~') !== false) {
// remove EOD and extra data (if any)
$data = substr($data, 2);
}
// check for EOD: 2-character sequence ~> (7Eh)(3Eh)
$eod = strpos($data, '~>');
if ($eod !== false) {
// remove EOD and extra data (if any)
$data = substr($data, 0, $eod);
}
// data length
$data_length = strlen($data);
// check for invalid characters
if (preg_match('/[^\x21-\x75,\x74]/', $data) > 0) {
self::Error('decodeFilterASCII85Decode: invalid code');
}
// z sequence
$zseq = chr(0).chr(0).chr(0).chr(0);
// position inside a group of 4 bytes (0-3)
$group_pos = 0;
$tuple = 0;
$pow85 = array((85*85*85*85), (85*85*85), (85*85), 85, 1);
$last_pos = ($data_length - 1);
// for each byte
for ($i = 0; $i < $data_length; ++$i) {
// get char value
$char = ord($data[$i]);
if ($char == 122) { // 'z'
if ($group_pos == 0) {
$decoded .= $zseq;
} else {
self::Error('decodeFilterASCII85Decode: invalid code');
}
} else {
// the value represented by a group of 5 characters should never be greater than 2^32 - 1
$tuple += (($char - 33) * $pow85[$group_pos]);
if ($group_pos == 4) {
$decoded .= chr($tuple >> 24).chr($tuple >> 16).chr($tuple >> 8).chr($tuple);
$tuple = 0;
$group_pos = 0;
} else {
++$group_pos;
}
}
}
if ($group_pos > 1) {
$tuple += $pow85[($group_pos - 1)];
}
// last tuple (if any)
switch ($group_pos) {
case 4: {
$decoded .= chr($tuple >> 24).chr($tuple >> 16).chr($tuple >> 8);
break;
}
case 3: {
$decoded .= chr($tuple >> 24).chr($tuple >> 16);
break;
}
case 2: {
$decoded .= chr($tuple >> 24);
break;
}
case 1: {
self::Error('decodeFilterASCII85Decode: invalid code');
break;
}
}
return $decoded;
}
/**
* LZWDecode
* Decompresses data encoded using the LZW (Lempel-Ziv-Welch) adaptive compression method, reproducing the original text or binary data.
* @param $data (string) Data to decode.
* @return Decoded data string.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilterLZWDecode($data) {
// initialize string to return
$decoded = '';
// data length
$data_length = strlen($data);
// convert string to binary string
$bitstring = '';
for ($i = 0; $i < $data_length; ++$i) {
$bitstring .= sprintf('%08b', ord($data{$i}));
}
// get the number of bits
$data_length = strlen($bitstring);
// initialize code length in bits
$bitlen = 9;
// initialize dictionary index
$dix = 258;
// initialize the dictionary (with the first 256 entries).
$dictionary = array();
for ($i = 0; $i < 256; ++$i) {
$dictionary[$i] = chr($i);
}
// previous val
$prev_index = 0;
// while we encounter EOD marker (257), read code_length bits
while (($data_length > 0) AND (($index = bindec(substr($bitstring, 0, $bitlen))) != 257)) {
// remove read bits from string
$bitstring = substr($bitstring, $bitlen);
// update number of bits
$data_length -= $bitlen;
if ($index == 256) { // clear-table marker
// reset code length in bits
$bitlen = 9;
// reset dictionary index
$dix = 258;
$prev_index = 256;
// reset the dictionary (with the first 256 entries).
$dictionary = array();
for ($i = 0; $i < 256; ++$i) {
$dictionary[$i] = chr($i);
}
} elseif ($prev_index == 256) {
// first entry
$decoded .= $dictionary[$index];
$prev_index = $index;
} else {
// check if index exist in the dictionary
if ($index < $dix) {
// index exist on dictionary
$decoded .= $dictionary[$index];
$dic_val = $dictionary[$prev_index].$dictionary[$index][0];
// store current index
$prev_index = $index;
} else {
// index do not exist on dictionary
$dic_val = $dictionary[$prev_index].$dictionary[$prev_index][0];
$decoded .= $dic_val;
}
// update dictionary
$dictionary[$dix] = $dic_val;
++$dix;
// change bit length by case
if ($dix == 2047) {
$bitlen = 12;
} elseif ($dix == 1023) {
$bitlen = 11;
} elseif ($dix == 511) {
$bitlen = 10;
}
}
}
return $decoded;
}
/**
* FlateDecode
* Decompresses data encoded using the zlib/deflate compression method, reproducing the original text or binary data.
* @param $data (string) Data to decode.
* @return Decoded data string.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilterFlateDecode($data) {
// initialize string to return
$decoded = @gzuncompress($data);
if ($decoded === false) {
self::Error('decodeFilterFlateDecode: invalid code');
}
return $decoded;
}
/**
* RunLengthDecode
* Decompresses data encoded using a byte-oriented run-length encoding algorithm.
* @param $data (string) Data to decode.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilterRunLengthDecode($data) {
// initialize string to return
$decoded = '';
// data length
$data_length = strlen($data);
$i = 0;
while($i < $data_length) {
// get current byte value
$byte = ord($data{$i});
if ($byte == 128) {
// a length value of 128 denote EOD
break;
} elseif ($byte < 128) {
// if the length byte is in the range 0 to 127
// the following length + 1 (1 to 128) bytes shall be copied literally during decompression
$decoded .= substr($data, ($i + 1), ($byte + 1));
// move to next block
$i += ($byte + 2);
} else {
// if length is in the range 129 to 255,
// the following single byte shall be copied 257 - length (2 to 128) times during decompression
$decoded .= str_repeat($data{($i + 1)}, (257 - $byte));
// move to next block
$i += 2;
}
}
return $decoded;
}
/**
* CCITTFaxDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
* Decompresses data encoded using the CCITT facsimile standard, reproducing the original data (typically monochrome image data at 1 bit per pixel).
* @param $data (string) Data to decode.
* @return Decoded data string.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilterCCITTFaxDecode($data) {
self::Error('~decodeFilterCCITTFaxDecode: this method has not been yet implemented');
//return $data;
}
/**
* JBIG2Decode (NOT IMPLEMETED - RETURN AN EXCEPTION)
* Decompresses data encoded using the JBIG2 standard, reproducing the original monochrome (1 bit per pixel) image data (or an approximation of that data).
* @param $data (string) Data to decode.
* @return Decoded data string.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilterJBIG2Decode($data) {
self::Error('~decodeFilterJBIG2Decode: this method has not been yet implemented');
//return $data;
}
/**
* DCTDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
* Decompresses data encoded using a DCT (discrete cosine transform) technique based on the JPEG standard, reproducing image sample data that approximates the original data.
* @param $data (string) Data to decode.
* @return Decoded data string.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilterDCTDecode($data) {
self::Error('~decodeFilterDCTDecode: this method has not been yet implemented');
//return $data;
}
/**
* JPXDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
* Decompresses data encoded using the wavelet-based JPEG2000 standard, reproducing the original image data.
* @param $data (string) Data to decode.
* @return Decoded data string.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilterJPXDecode($data) {
self::Error('~decodeFilterJPXDecode: this method has not been yet implemented');
//return $data;
}
/**
* Crypt (NOT IMPLEMETED - RETURN AN EXCEPTION)
* Decrypts data encrypted by a security handler, reproducing the data as it was before encryption.
* @param $data (string) Data to decode.
* @return Decoded data string.
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function decodeFilterCrypt($data) {
self::Error('~decodeFilterCrypt: this method has not been yet implemented');
//return $data;
}
// --- END FILTERS SECTION -------------------------------------------------
/**
* Throw an exception.
* @param $msg (string) The error message
* @since 1.0.000 (2011-05-23)
* @public static
*/
public static function Error($msg) {
throw new Exception('TCPDF_PARSER ERROR: '.$msg);
}
} // END OF TCPDF_FILTERS CLASS
//============================================================+
// END OF FILE
//============================================================+
| wilperdana/projeksurya | application/libraries/tcpdf/include/tcpdf_filters.php | PHP | mit | 14,682 |
/**
* Backbone Forms v0.12.0
*
* Copyright (c) 2013 Charles Davison, Pow Media Ltd
*
* License and more information at:
* http://github.com/powmedia/backbone-forms
*/
;(function(root) {
//DEPENDENCIES
//CommonJS
if (typeof exports !== 'undefined' && typeof require !== 'undefined') {
var $ = root.jQuery || root.Zepto || root.ender || require('jquery'),
_ = root._ || require('underscore'),
Backbone = root.Backbone || require('backbone');
}
//Browser
else {
var $ = root.jQuery,
_ = root._,
Backbone = root.Backbone;
}
//SOURCE
//==================================================================================================
//FORM
//==================================================================================================
var Form = Backbone.View.extend({
/**
* Constructor
*
* @param {Object} [options.schema]
* @param {Backbone.Model} [options.model]
* @param {Object} [options.data]
* @param {String[]|Object[]} [options.fieldsets]
* @param {String[]} [options.fields]
* @param {String} [options.idPrefix]
* @param {Form.Field} [options.Field]
* @param {Form.Fieldset} [options.Fieldset]
* @param {Function} [options.template]
*/
initialize: function(options) {
var self = this;
options = options || {};
//Find the schema to use
var schema = this.schema = (function() {
//Prefer schema from options
if (options.schema) return _.result(options, 'schema');
//Then schema on model
var model = options.model;
if (model && model.schema) {
return (_.isFunction(model.schema)) ? model.schema() : model.schema;
}
//Then built-in schema
if (self.schema) {
return (_.isFunction(self.schema)) ? self.schema() : self.schema;
}
//Fallback to empty schema
return {};
})();
//Store important data
_.extend(this, _.pick(options, 'model', 'data', 'idPrefix'));
//Override defaults
var constructor = this.constructor;
this.template = options.template || constructor.template;
this.Fieldset = options.Fieldset || constructor.Fieldset;
this.Field = options.Field || constructor.Field;
this.NestedField = options.NestedField || constructor.NestedField;
//Check which fields will be included (defaults to all)
var selectedFields = this.selectedFields = options.fields || _.keys(schema);
//Create fields
var fields = this.fields = {};
_.each(selectedFields, function(key) {
var fieldSchema = schema[key];
fields[key] = this.createField(key, fieldSchema);
}, this);
//Create fieldsets
var fieldsetSchema = options.fieldsets || [selectedFields],
fieldsets = this.fieldsets = [];
_.each(fieldsetSchema, function(itemSchema) {
this.fieldsets.push(this.createFieldset(itemSchema));
}, this);
},
/**
* Creates a Fieldset instance
*
* @param {String[]|Object[]} schema Fieldset schema
*
* @return {Form.Fieldset}
*/
createFieldset: function(schema) {
var options = {
schema: schema,
fields: this.fields
};
return new this.Fieldset(options);
},
/**
* Creates a Field instance
*
* @param {String} key
* @param {Object} schema Field schema
*
* @return {Form.Field}
*/
createField: function(key, schema) {
var options = {
form: this,
key: key,
schema: schema,
idPrefix: this.idPrefix
};
if (this.model) {
options.model = this.model;
} else if (this.data) {
options.value = this.data[key];
} else {
options.value = null;
}
var field = new this.Field(options);
this.listenTo(field.editor, 'all', this.handleEditorEvent);
return field;
},
/**
* Callback for when an editor event is fired.
* Re-triggers events on the form as key:event and triggers additional form-level events
*
* @param {String} event
* @param {Editor} editor
*/
handleEditorEvent: function(event, editor) {
//Re-trigger editor events on the form
var formEvent = editor.key+':'+event;
this.trigger.call(this, formEvent, this, editor);
//Trigger additional events
switch (event) {
case 'change':
this.trigger('change', this);
break;
case 'focus':
if (!this.hasFocus) this.trigger('focus', this);
break;
case 'blur':
if (this.hasFocus) {
//TODO: Is the timeout etc needed?
var self = this;
setTimeout(function() {
var focusedField = _.find(self.fields, function(field) {
return field.editor.hasFocus;
});
if (!focusedField) self.trigger('blur', self);
}, 0);
}
break;
}
},
render: function() {
var self = this,
fields = this.fields;
//Render form
var $form = $($.trim(this.template(_.result(this, 'templateData'))));
//Render standalone editors
$form.find('[data-editors]').add($form).each(function(i, el) {
var $container = $(el),
selection = $container.attr('data-editors');
if (_.isUndefined(selection)) return;
//Work out which fields to include
var keys = (selection == '*')
? self.selectedFields || _.keys(fields)
: selection.split(',');
//Add them
_.each(keys, function(key) {
var field = fields[key];
$container.append(field.editor.render().el);
});
});
//Render standalone fields
$form.find('[data-fields]').add($form).each(function(i, el) {
var $container = $(el),
selection = $container.attr('data-fields');
if (_.isUndefined(selection)) return;
//Work out which fields to include
var keys = (selection == '*')
? self.selectedFields || _.keys(fields)
: selection.split(',');
//Add them
_.each(keys, function(key) {
var field = fields[key];
$container.append(field.render().el);
});
});
//Render fieldsets
$form.find('[data-fieldsets]').add($form).each(function(i, el) {
var $container = $(el),
selection = $container.attr('data-fieldsets');
if (_.isUndefined(selection)) return;
_.each(self.fieldsets, function(fieldset) {
$container.append(fieldset.render().el);
});
});
//Set the main element
this.setElement($form);
return this;
},
/**
* Validate the data
*
* @return {Object} Validation errors
*/
validate: function() {
var self = this,
fields = this.fields,
model = this.model,
errors = {};
//Collect errors from schema validation
_.each(fields, function(field) {
var error = field.validate();
if (error) {
errors[field.key] = error;
}
});
//Get errors from default Backbone model validator
if (model && model.validate) {
var modelErrors = model.validate(this.getValue());
if (modelErrors) {
var isDictionary = _.isObject(modelErrors) && !_.isArray(modelErrors);
//If errors are not in object form then just store on the error object
if (!isDictionary) {
errors._others = errors._others || [];
errors._others.push(modelErrors);
}
//Merge programmatic errors (requires model.validate() to return an object e.g. { fieldKey: 'error' })
if (isDictionary) {
_.each(modelErrors, function(val, key) {
//Set error on field if there isn't one already
if (fields[key] && !errors[key]) {
fields[key].setError(val);
errors[key] = val;
}
else {
//Otherwise add to '_others' key
errors._others = errors._others || [];
var tmpErr = {};
tmpErr[key] = val;
errors._others.push(tmpErr);
}
});
}
}
}
return _.isEmpty(errors) ? null : errors;
},
/**
* Update the model with all latest values.
*
* @param {Object} [options] Options to pass to Model#set (e.g. { silent: true })
*
* @return {Object} Validation errors
*/
commit: function(options) {
//Validate
var errors = this.validate();
if (errors) return errors;
//Commit
var modelError;
var setOptions = _.extend({
error: function(model, e) {
modelError = e;
}
}, options);
this.model.set(this.getValue(), setOptions);
if (modelError) return modelError;
},
/**
* Get all the field values as an object.
* Use this method when passing data instead of objects
*
* @param {String} [key] Specific field value to get
*/
getValue: function(key) {
//Return only given key if specified
if (key) return this.fields[key].getValue();
//Otherwise return entire form
var values = {};
_.each(this.fields, function(field) {
values[field.key] = field.getValue();
});
return values;
},
/**
* Update field values, referenced by key
*
* @param {Object|String} key New values to set, or property to set
* @param val Value to set
*/
setValue: function(prop, val) {
var data = {};
if (typeof prop === 'string') {
data[prop] = val;
} else {
data = prop;
}
var key;
for (key in this.schema) {
if (data[key] !== undefined) {
this.fields[key].setValue(data[key]);
}
}
},
/**
* Returns the editor for a given field key
*
* @param {String} key
*
* @return {Editor}
*/
getEditor: function(key) {
var field = this.fields[key];
if (!field) throw 'Field not found: '+key;
return field.editor;
},
/**
* Gives the first editor in the form focus
*/
focus: function() {
if (this.hasFocus) return;
//Get the first field
var fieldset = this.fieldsets[0],
field = fieldset.getFieldAt(0);
if (!field) return;
//Set focus
field.editor.focus();
},
/**
* Removes focus from the currently focused editor
*/
blur: function() {
if (!this.hasFocus) return;
var focusedField = _.find(this.fields, function(field) {
return field.editor.hasFocus;
});
if (focusedField) focusedField.editor.blur();
},
/**
* Manages the hasFocus property
*
* @param {String} event
*/
trigger: function(event) {
if (event === 'focus') {
this.hasFocus = true;
}
else if (event === 'blur') {
this.hasFocus = false;
}
return Backbone.View.prototype.trigger.apply(this, arguments);
},
/**
* Override default remove function in order to remove embedded views
*
* TODO: If editors are included directly with data-editors="x", they need to be removed
* May be best to use XView to manage adding/removing views
*/
remove: function() {
_.each(this.fieldsets, function(fieldset) {
fieldset.remove();
});
_.each(this.fields, function(field) {
field.remove();
});
Backbone.View.prototype.remove.call(this);
}
}, {
//STATICS
template: _.template('\
<form data-fieldsets></form>\
', null, this.templateSettings),
templateSettings: {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g
},
editors: {}
});
//==================================================================================================
//VALIDATORS
//==================================================================================================
Form.validators = (function() {
var validators = {};
validators.errMessages = {
required: 'Required',
regexp: 'Invalid',
email: 'Invalid email address',
url: 'Invalid URL',
match: _.template('Must match field "<%= field %>"', null, Form.templateSettings)
};
validators.required = function(options) {
options = _.extend({
type: 'required',
message: this.errMessages.required
}, options);
return function required(value) {
options.value = value;
var err = {
type: options.type,
message: _.isFunction(options.message) ? options.message(options) : options.message
};
if (value === null || value === undefined || value === false || value === '') return err;
};
};
validators.regexp = function(options) {
if (!options.regexp) throw new Error('Missing required "regexp" option for "regexp" validator');
options = _.extend({
type: 'regexp',
message: this.errMessages.regexp
}, options);
return function regexp(value) {
options.value = value;
var err = {
type: options.type,
message: _.isFunction(options.message) ? options.message(options) : options.message
};
//Don't check empty values (add a 'required' validator for this)
if (value === null || value === undefined || value === '') return;
if (!options.regexp.test(value)) return err;
};
};
validators.email = function(options) {
options = _.extend({
type: 'email',
message: this.errMessages.email,
regexp: /^[\w\-]{1,}([\w\-\+.]{1,1}[\w\-]{1,}){0,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/
}, options);
return validators.regexp(options);
};
validators.url = function(options) {
options = _.extend({
type: 'url',
message: this.errMessages.url,
regexp: /^(http|https):\/\/(([A-Z0-9][A-Z0-9_\-]*)(\.[A-Z0-9][A-Z0-9_\-]*)+)(:(\d+))?\/?/i
}, options);
return validators.regexp(options);
};
validators.match = function(options) {
if (!options.field) throw new Error('Missing required "field" options for "match" validator');
options = _.extend({
type: 'match',
message: this.errMessages.match
}, options);
return function match(value, attrs) {
options.value = value;
var err = {
type: options.type,
message: _.isFunction(options.message) ? options.message(options) : options.message
};
//Don't check empty values (add a 'required' validator for this)
if (value === null || value === undefined || value === '') return;
if (value !== attrs[options.field]) return err;
};
};
return validators;
})();
//==================================================================================================
//FIELDSET
//==================================================================================================
Form.Fieldset = Backbone.View.extend({
/**
* Constructor
*
* Valid fieldset schemas:
* ['field1', 'field2']
* { legend: 'Some Fieldset', fields: ['field1', 'field2'] }
*
* @param {String[]|Object[]} options.schema Fieldset schema
* @param {Object} options.fields Form fields
*/
initialize: function(options) {
options = options || {};
//Create the full fieldset schema, merging defaults etc.
var schema = this.schema = this.createSchema(options.schema);
//Store the fields for this fieldset
this.fields = _.pick(options.fields, schema.fields);
//Override defaults
this.template = options.template || this.constructor.template;
},
/**
* Creates the full fieldset schema, normalising, merging defaults etc.
*
* @param {String[]|Object[]} schema
*
* @return {Object}
*/
createSchema: function(schema) {
//Normalise to object
if (_.isArray(schema)) {
schema = { fields: schema };
}
//Add null legend to prevent template error
schema.legend = schema.legend || null;
return schema;
},
/**
* Returns the field for a given index
*
* @param {Number} index
*
* @return {Field}
*/
getFieldAt: function(index) {
var key = this.schema.fields[index];
return this.fields[key];
},
/**
* Returns data to pass to template
*
* @return {Object}
*/
templateData: function() {
return this.schema;
},
/**
* Renders the fieldset and fields
*
* @return {Fieldset} this
*/
render: function() {
var schema = this.schema,
fields = this.fields;
//Render fieldset
var $fieldset = $($.trim(this.template(_.result(this, 'templateData'))));
//Render fields
$fieldset.find('[data-fields]').add($fieldset).each(function(i, el) {
var $container = $(el),
selection = $container.attr('data-fields');
if (_.isUndefined(selection)) return;
_.each(fields, function(field) {
$container.append(field.render().el);
});
});
this.setElement($fieldset);
return this;
},
/**
* Remove embedded views then self
*/
remove: function() {
_.each(this.fields, function(field) {
field.remove();
});
Backbone.View.prototype.remove.call(this);
}
}, {
//STATICS
template: _.template('\
<fieldset data-fields>\
<% if (legend) { %>\
<legend><%= legend %></legend>\
<% } %>\
</fieldset>\
', null, Form.templateSettings)
});
//==================================================================================================
//FIELD
//==================================================================================================
Form.Field = Backbone.View.extend({
/**
* Constructor
*
* @param {Object} options.key
* @param {Object} options.form
* @param {Object} [options.schema]
* @param {Backbone.Model} [options.model]
* @param {Object} [options.value]
* @param {String} [options.idPrefix]
* @param {Function} [options.template]
* @param {Function} [options.errorClassName]
*/
initialize: function(options) {
options = options || {};
//Store important data
_.extend(this, _.pick(options, 'form', 'key', 'model', 'value', 'idPrefix'));
//Override defaults
this.template = options.template || this.constructor.template;
this.errorClassName = options.errorClassName || this.constructor.errorClassName;
//Create the full field schema, merging defaults etc.
this.schema = this.createSchema(options.schema);
//Create editor
this.editor = this.createEditor();
},
/**
* Creates the full field schema, merging defaults etc.
*
* @param {Object|String} schema
*
* @return {Object}
*/
createSchema: function(schema) {
if (_.isString(schema)) schema = { type: schema };
//Set defaults
schema = _.extend({
type: 'Text',
title: this.createTitle()
}, schema);
//Get the real constructor function i.e. if type is a string such as 'Text'
schema.type = (_.isString(schema.type)) ? Form.editors[schema.type] : schema.type;
return schema;
},
/**
* Creates the editor specified in the schema; either an editor string name or
* a constructor function
*
* @return {View}
*/
createEditor: function() {
var options = _.extend(
_.pick(this, 'schema', 'form', 'key', 'model', 'value'),
{ id: this.createEditorId() }
);
var constructorFn = this.schema.type;
return new constructorFn(options);
},
/**
* Creates the ID that will be assigned to the editor
*
* @return {String}
*/
createEditorId: function() {
var prefix = this.idPrefix,
id = this.key;
//Replace periods with underscores (e.g. for when using paths)
id = id.replace(/\./g, '_');
//If a specific ID prefix is set, use it
if (_.isString(prefix) || _.isNumber(prefix)) return prefix + id;
if (_.isNull(prefix)) return id;
//Otherwise, if there is a model use it's CID to avoid conflicts when multiple forms are on the page
if (this.model) return this.model.cid + '_' + id;
return id;
},
/**
* Create the default field title (label text) from the key name.
* (Converts 'camelCase' to 'Camel Case')
*
* @return {String}
*/
createTitle: function() {
var str = this.key;
//Add spaces
str = str.replace(/([A-Z])/g, ' $1');
//Uppercase first character
str = str.replace(/^./, function(str) { return str.toUpperCase(); });
return str;
},
/**
* Returns the data to be passed to the template
*
* @return {Object}
*/
templateData: function() {
var schema = this.schema;
return {
help: schema.help || '',
title: schema.title,
fieldAttrs: schema.fieldAttrs,
editorAttrs: schema.editorAttrs,
key: this.key,
editorId: this.editor.id
};
},
/**
* Render the field and editor
*
* @return {Field} self
*/
render: function() {
var schema = this.schema,
editor = this.editor;
//Render field
var $field = $($.trim(this.template(_.result(this, 'templateData'))));
if (schema.fieldClass) $field.addClass(schema.fieldClass);
if (schema.fieldAttrs) $field.attr(schema.fieldAttrs);
//Render editor
$field.find('[data-editor]').add($field).each(function(i, el) {
var $container = $(el),
selection = $container.attr('data-editor');
if (_.isUndefined(selection)) return;
$container.append(editor.render().el);
});
this.setElement($field);
return this;
},
/**
* Check the validity of the field
*
* @return {String}
*/
validate: function() {
var error = this.editor.validate();
if (error) {
this.setError(error.message);
} else {
this.clearError();
}
return error;
},
/**
* Set the field into an error state, adding the error class and setting the error message
*
* @param {String} msg Error message
*/
setError: function(msg) {
//Nested form editors (e.g. Object) set their errors internally
if (this.editor.hasNestedForm) return;
//Add error CSS class
this.$el.addClass(this.errorClassName);
//Set error message
this.$('[data-error]').html(msg);
},
/**
* Clear the error state and reset the help message
*/
clearError: function() {
//Remove error CSS class
this.$el.removeClass(this.errorClassName);
//Clear error message
this.$('[data-error]').empty();
},
/**
* Update the model with the new value from the editor
*
* @return {Mixed}
*/
commit: function() {
return this.editor.commit();
},
/**
* Get the value from the editor
*
* @return {Mixed}
*/
getValue: function() {
return this.editor.getValue();
},
/**
* Set/change the value of the editor
*
* @param {Mixed} value
*/
setValue: function(value) {
this.editor.setValue(value);
},
/**
* Give the editor focus
*/
focus: function() {
this.editor.focus();
},
/**
* Remove focus from the editor
*/
blur: function() {
this.editor.blur();
},
/**
* Remove the field and editor views
*/
remove: function() {
this.editor.remove();
Backbone.View.prototype.remove.call(this);
}
}, {
//STATICS
template: _.template('\
<div>\
<label for="<%= editorId %>"><%= title %></label>\
<div>\
<span data-editor></span>\
<div data-error></div>\
<div><%= help %></div>\
</div>\
</div>\
', null, Form.templateSettings),
/**
* CSS class name added to the field when there is a validation error
*/
errorClassName: 'error'
});
//==================================================================================================
//NESTEDFIELD
//==================================================================================================
Form.NestedField = Form.Field.extend({
template: _.template($.trim('\
<div>\
<span data-editor></span>\
<% if (help) { %>\
<div><%= help %></div>\
<% } %>\
<div data-error></div>\
</div>\
'), null, Form.templateSettings)
});
/**
* Base editor (interface). To be extended, not used directly
*
* @param {Object} options
* @param {String} [options.id] Editor ID
* @param {Model} [options.model] Use instead of value, and use commit()
* @param {String} [options.key] The model attribute key. Required when using 'model'
* @param {Mixed} [options.value] When not using a model. If neither provided, defaultValue will be used
* @param {Object} [options.schema] Field schema; may be required by some editors
* @param {Object} [options.validators] Validators; falls back to those stored on schema
* @param {Object} [options.form] The form
*/
Form.Editor = Form.editors.Base = Backbone.View.extend({
defaultValue: null,
hasFocus: false,
initialize: function(options) {
var options = options || {};
//Set initial value
if (options.model) {
if (!options.key) throw "Missing option: 'key'";
this.model = options.model;
this.value = this.model.get(options.key);
}
else if (options.value) {
this.value = options.value;
}
if (this.value === undefined) this.value = this.defaultValue;
//Store important data
_.extend(this, _.pick(options, 'key', 'form'));
var schema = this.schema = options.schema || {};
this.validators = options.validators || schema.validators;
//Main attributes
this.$el.attr('id', this.id);
this.$el.attr('name', this.getName());
if (schema.editorClass) this.$el.addClass(schema.editorClass);
if (schema.editorAttrs) this.$el.attr(schema.editorAttrs);
},
/**
* Get the value for the form input 'name' attribute
*
* @return {String}
*
* @api private
*/
getName: function() {
var key = this.key || '';
//Replace periods with underscores (e.g. for when using paths)
return key.replace(/\./g, '_');
},
/**
* Get editor value
* Extend and override this method to reflect changes in the DOM
*
* @return {Mixed}
*/
getValue: function() {
return this.value;
},
/**
* Set editor value
* Extend and override this method to reflect changes in the DOM
*
* @param {Mixed} value
*/
setValue: function(value) {
this.value = value;
},
/**
* Give the editor focus
* Extend and override this method
*/
focus: function() {
throw 'Not implemented';
},
/**
* Remove focus from the editor
* Extend and override this method
*/
blur: function() {
throw 'Not implemented';
},
/**
* Update the model with the current value
*
* @param {Object} [options] Options to pass to model.set()
* @param {Boolean} [options.validate] Set to true to trigger built-in model validation
*
* @return {Mixed} error
*/
commit: function(options) {
var error = this.validate();
if (error) return error;
this.listenTo(this.model, 'invalid', function(model, e) {
error = e;
});
this.model.set(this.key, this.getValue(), options);
if (error) return error;
},
/**
* Check validity
*
* @return {Object|Undefined}
*/
validate: function() {
var $el = this.$el,
error = null,
value = this.getValue(),
formValues = this.form ? this.form.getValue() : {},
validators = this.validators,
getValidator = this.getValidator;
if (validators) {
//Run through validators until an error is found
_.every(validators, function(validator) {
error = getValidator(validator)(value, formValues);
return error ? false : true;
});
}
return error;
},
/**
* Set this.hasFocus, or call parent trigger()
*
* @param {String} event
*/
trigger: function(event) {
if (event === 'focus') {
this.hasFocus = true;
}
else if (event === 'blur') {
this.hasFocus = false;
}
return Backbone.View.prototype.trigger.apply(this, arguments);
},
/**
* Returns a validation function based on the type defined in the schema
*
* @param {RegExp|String|Function} validator
* @return {Function}
*/
getValidator: function(validator) {
var validators = Form.validators;
//Convert regular expressions to validators
if (_.isRegExp(validator)) {
return validators.regexp({ regexp: validator });
}
//Use a built-in validator if given a string
if (_.isString(validator)) {
if (!validators[validator]) throw new Error('Validator "'+validator+'" not found');
return validators[validator]();
}
//Functions can be used directly
if (_.isFunction(validator)) return validator;
//Use a customised built-in validator if given an object
if (_.isObject(validator) && validator.type) {
var config = validator;
return validators[config.type](config);
}
//Unkown validator type
throw new Error('Invalid validator: ' + validator);
}
});
/**
* Text
*
* Text input with focus, blur and change events
*/
Form.editors.Text = Form.Editor.extend({
tagName: 'input',
defaultValue: '',
previousValue: '',
events: {
'keyup': 'determineChange',
'keypress': function(event) {
var self = this;
setTimeout(function() {
self.determineChange();
}, 0);
},
'select': function(event) {
this.trigger('select', this);
},
'focus': function(event) {
this.trigger('focus', this);
},
'blur': function(event) {
this.trigger('blur', this);
}
},
initialize: function(options) {
Form.editors.Base.prototype.initialize.call(this, options);
var schema = this.schema;
//Allow customising text type (email, phone etc.) for HTML5 browsers
var type = 'text';
if (schema && schema.editorAttrs && schema.editorAttrs.type) type = schema.editorAttrs.type;
if (schema && schema.dataType) type = schema.dataType;
this.$el.attr('type', type);
},
/**
* Adds the editor to the DOM
*/
render: function() {
this.setValue(this.value);
return this;
},
determineChange: function(event) {
var currentValue = this.$el.val();
var changed = (currentValue !== this.previousValue);
if (changed) {
this.previousValue = currentValue;
this.trigger('change', this);
}
},
/**
* Returns the current editor value
* @return {String}
*/
getValue: function() {
return this.$el.val();
},
/**
* Sets the value of the form element
* @param {String}
*/
setValue: function(value) {
this.$el.val(value);
},
focus: function() {
if (this.hasFocus) return;
this.$el.focus();
},
blur: function() {
if (!this.hasFocus) return;
this.$el.blur();
},
select: function() {
this.$el.select();
}
});
/**
* TextArea editor
*/
Form.editors.TextArea = Form.editors.Text.extend({
tagName: 'textarea'
});
/**
* Password editor
*/
Form.editors.Password = Form.editors.Text.extend({
initialize: function(options) {
Form.editors.Text.prototype.initialize.call(this, options);
this.$el.attr('type', 'password');
}
});
/**
* NUMBER
*
* Normal text input that only allows a number. Letters etc. are not entered.
*/
Form.editors.Number = Form.editors.Text.extend({
defaultValue: 0,
events: _.extend({}, Form.editors.Text.prototype.events, {
'keypress': 'onKeyPress'
}),
initialize: function(options) {
Form.editors.Text.prototype.initialize.call(this, options);
this.$el.attr('type', 'number');
this.$el.attr('step', 'any');
},
/**
* Check value is numeric
*/
onKeyPress: function(event) {
var self = this,
delayedDetermineChange = function() {
setTimeout(function() {
self.determineChange();
}, 0);
};
//Allow backspace
if (event.charCode === 0) {
delayedDetermineChange();
return;
}
//Get the whole new value so that we can prevent things like double decimals points etc.
var newVal = this.$el.val() + String.fromCharCode(event.charCode);
var numeric = /^[0-9]*\.?[0-9]*?$/.test(newVal);
if (numeric) {
delayedDetermineChange();
}
else {
event.preventDefault();
}
},
getValue: function() {
var value = this.$el.val();
return value === "" ? null : parseFloat(value, 10);
},
setValue: function(value) {
value = (function() {
if (_.isNumber(value)) return value;
if (_.isString(value) && value !== '') return parseFloat(value, 10);
return null;
})();
if (_.isNaN(value)) value = null;
Form.editors.Text.prototype.setValue.call(this, value);
}
});
/**
* Hidden editor
*/
Form.editors.Hidden = Form.editors.Base.extend({
defaultValue: '',
initialize: function(options) {
Form.editors.Text.prototype.initialize.call(this, options);
this.$el.attr('type', 'hidden');
},
focus: function() {
},
blur: function() {
}
});
/**
* Checkbox editor
*
* Creates a single checkbox, i.e. boolean value
*/
Form.editors.Checkbox = Form.editors.Base.extend({
defaultValue: false,
tagName: 'input',
events: {
'click': function(event) {
this.trigger('change', this);
},
'focus': function(event) {
this.trigger('focus', this);
},
'blur': function(event) {
this.trigger('blur', this);
}
},
initialize: function(options) {
Form.editors.Base.prototype.initialize.call(this, options);
this.$el.attr('type', 'checkbox');
},
/**
* Adds the editor to the DOM
*/
render: function() {
this.setValue(this.value);
return this;
},
getValue: function() {
return this.$el.prop('checked');
},
setValue: function(value) {
if (value) {
this.$el.prop('checked', true);
}
},
focus: function() {
if (this.hasFocus) return;
this.$el.focus();
},
blur: function() {
if (!this.hasFocus) return;
this.$el.blur();
}
});
/**
* Select editor
*
* Renders a <select> with given options
*
* Requires an 'options' value on the schema.
* Can be an array of options, a function that calls back with the array of options, a string of HTML
* or a Backbone collection. If a collection, the models must implement a toString() method
*/
Form.editors.Select = Form.editors.Base.extend({
tagName: 'select',
events: {
'change': function(event) {
this.trigger('change', this);
},
'focus': function(event) {
this.trigger('focus', this);
},
'blur': function(event) {
this.trigger('blur', this);
}
},
initialize: function(options) {
Form.editors.Base.prototype.initialize.call(this, options);
if (!this.schema || !this.schema.options) throw "Missing required 'schema.options'";
},
render: function() {
this.setOptions(this.schema.options);
return this;
},
/**
* Sets the options that populate the <select>
*
* @param {Mixed} options
*/
setOptions: function(options) {
var self = this;
//If a collection was passed, check if it needs fetching
if (options instanceof Backbone.Collection) {
var collection = options;
//Don't do the fetch if it's already populated
if (collection.length > 0) {
this.renderOptions(options);
} else {
collection.fetch({
success: function(collection) {
self.renderOptions(options);
}
});
}
}
//If a function was passed, run it to get the options
else if (_.isFunction(options)) {
options(function(result) {
self.renderOptions(result);
}, self);
}
//Otherwise, ready to go straight to renderOptions
else {
this.renderOptions(options);
}
},
/**
* Adds the <option> html to the DOM
* @param {Mixed} Options as a simple array e.g. ['option1', 'option2']
* or as an array of objects e.g. [{val: 543, label: 'Title for object 543'}]
* or as a string of <option> HTML to insert into the <select>
*/
renderOptions: function(options) {
var $select = this.$el,
html;
html = this._getOptionsHtml(options);
//Insert options
$select.html(html);
//Select correct option
this.setValue(this.value);
},
_getOptionsHtml: function(options) {
var html;
//Accept string of HTML
if (_.isString(options)) {
html = options;
}
//Or array
else if (_.isArray(options)) {
html = this._arrayToHtml(options);
}
//Or Backbone collection
else if (options instanceof Backbone.Collection) {
html = this._collectionToHtml(options);
}
else if (_.isFunction(options)) {
var newOptions;
options(function(opts) {
newOptions = opts;
}, this);
html = this._getOptionsHtml(newOptions);
}
return html;
},
getValue: function() {
return this.$el.val();
},
setValue: function(value) {
this.$el.val(value);
},
focus: function() {
if (this.hasFocus) return;
this.$el.focus();
},
blur: function() {
if (!this.hasFocus) return;
this.$el.blur();
},
/**
* Transforms a collection into HTML ready to use in the renderOptions method
* @param {Backbone.Collection}
* @return {String}
*/
_collectionToHtml: function(collection) {
//Convert collection to array first
var array = [];
collection.each(function(model) {
array.push({ val: model.id, label: model.toString() });
});
//Now convert to HTML
var html = this._arrayToHtml(array);
return html;
},
/**
* Create the <option> HTML
* @param {Array} Options as a simple array e.g. ['option1', 'option2']
* or as an array of objects e.g. [{val: 543, label: 'Title for object 543'}]
* @return {String} HTML
*/
_arrayToHtml: function(array) {
var html = [];
//Generate HTML
_.each(array, function(option) {
if (_.isObject(option)) {
if (option.group) {
html.push('<optgroup label="'+option.group+'">');
html.push(this._getOptionsHtml(option.options))
html.push('</optgroup>');
} else {
var val = (option.val || option.val === 0) ? option.val : '';
html.push('<option value="'+val+'">'+option.label+'</option>');
}
}
else {
html.push('<option>'+option+'</option>');
}
}, this);
return html.join('');
}
});
/**
* Radio editor
*
* Renders a <ul> with given options represented as <li> objects containing radio buttons
*
* Requires an 'options' value on the schema.
* Can be an array of options, a function that calls back with the array of options, a string of HTML
* or a Backbone collection. If a collection, the models must implement a toString() method
*/
Form.editors.Radio = Form.editors.Select.extend({
tagName: 'ul',
events: {
'change input[type=radio]': function() {
this.trigger('change', this);
},
'focus input[type=radio]': function() {
if (this.hasFocus) return;
this.trigger('focus', this);
},
'blur input[type=radio]': function() {
if (!this.hasFocus) return;
var self = this;
setTimeout(function() {
if (self.$('input[type=radio]:focus')[0]) return;
self.trigger('blur', self);
}, 0);
}
},
getValue: function() {
return this.$('input[type=radio]:checked').val();
},
setValue: function(value) {
this.$('input[type=radio]').val([value]);
},
focus: function() {
if (this.hasFocus) return;
var checked = this.$('input[type=radio]:checked');
if (checked[0]) {
checked.focus();
return;
}
this.$('input[type=radio]').first().focus();
},
blur: function() {
if (!this.hasFocus) return;
this.$('input[type=radio]:focus').blur();
},
/**
* Create the radio list HTML
* @param {Array} Options as a simple array e.g. ['option1', 'option2']
* or as an array of objects e.g. [{val: 543, label: 'Title for object 543'}]
* @return {String} HTML
*/
_arrayToHtml: function (array) {
var html = [];
var self = this;
_.each(array, function(option, index) {
var itemHtml = '<li>';
if (_.isObject(option)) {
var val = (option.val || option.val === 0) ? option.val : '';
itemHtml += ('<input type="radio" name="'+self.id+'" value="'+val+'" id="'+self.id+'-'+index+'" />');
itemHtml += ('<label for="'+self.id+'-'+index+'">'+option.label+'</label>');
}
else {
itemHtml += ('<input type="radio" name="'+self.id+'" value="'+option+'" id="'+self.id+'-'+index+'" />');
itemHtml += ('<label for="'+self.id+'-'+index+'">'+option+'</label>');
}
itemHtml += '</li>';
html.push(itemHtml);
});
return html.join('');
}
});
/**
* Checkboxes editor
*
* Renders a <ul> with given options represented as <li> objects containing checkboxes
*
* Requires an 'options' value on the schema.
* Can be an array of options, a function that calls back with the array of options, a string of HTML
* or a Backbone collection. If a collection, the models must implement a toString() method
*/
Form.editors.Checkboxes = Form.editors.Select.extend({
tagName: 'ul',
events: {
'click input[type=checkbox]': function() {
this.trigger('change', this);
},
'focus input[type=checkbox]': function() {
if (this.hasFocus) return;
this.trigger('focus', this);
},
'blur input[type=checkbox]': function() {
if (!this.hasFocus) return;
var self = this;
setTimeout(function() {
if (self.$('input[type=checkbox]:focus')[0]) return;
self.trigger('blur', self);
}, 0);
}
},
getValue: function() {
var values = [];
this.$('input[type=checkbox]:checked').each(function() {
values.push($(this).val());
});
return values;
},
setValue: function(values) {
if (!_.isArray(values)) values = [values];
this.$('input[type=checkbox]').val(values);
},
focus: function() {
if (this.hasFocus) return;
this.$('input[type=checkbox]').first().focus();
},
blur: function() {
if (!this.hasFocus) return;
this.$('input[type=checkbox]:focus').blur();
},
/**
* Create the checkbox list HTML
* @param {Array} Options as a simple array e.g. ['option1', 'option2']
* or as an array of objects e.g. [{val: 543, label: 'Title for object 543'}]
* @return {String} HTML
*/
_arrayToHtml: function (array) {
var html = [];
var self = this;
_.each(array, function(option, index) {
var itemHtml = '<li>';
if (_.isObject(option)) {
var val = (option.val || option.val === 0) ? option.val : '';
itemHtml += ('<input type="checkbox" name="'+self.id+'" value="'+val+'" id="'+self.id+'-'+index+'" />');
itemHtml += ('<label for="'+self.id+'-'+index+'">'+option.label+'</label>');
}
else {
itemHtml += ('<input type="checkbox" name="'+self.id+'" value="'+option+'" id="'+self.id+'-'+index+'" />');
itemHtml += ('<label for="'+self.id+'-'+index+'">'+option+'</label>');
}
itemHtml += '</li>';
html.push(itemHtml);
});
return html.join('');
}
});
/**
* Object editor
*
* Creates a child form. For editing Javascript objects
*
* @param {Object} options
* @param {Form} options.form The form this editor belongs to; used to determine the constructor for the nested form
* @param {Object} options.schema The schema for the object
* @param {Object} options.schema.subSchema The schema for the nested form
*/
Form.editors.Object = Form.editors.Base.extend({
//Prevent error classes being set on the main control; they are internally on the individual fields
hasNestedForm: true,
initialize: function(options) {
//Set default value for the instance so it's not a shared object
this.value = {};
//Init
Form.editors.Base.prototype.initialize.call(this, options);
//Check required options
if (!this.form) throw 'Missing required option "form"';
if (!this.schema.subSchema) throw new Error("Missing required 'schema.subSchema' option for Object editor");
},
render: function() {
//Get the constructor for creating the nested form; i.e. the same constructor as used by the parent form
var NestedForm = this.form.constructor;
//Create the nested form
this.nestedForm = new NestedForm({
schema: this.schema.subSchema,
data: this.value,
idPrefix: this.id + '_',
Field: NestedForm.NestedField
});
this._observeFormEvents();
this.$el.html(this.nestedForm.render().el);
if (this.hasFocus) this.trigger('blur', this);
return this;
},
getValue: function() {
if (this.nestedForm) return this.nestedForm.getValue();
return this.value;
},
setValue: function(value) {
this.value = value;
this.render();
},
focus: function() {
if (this.hasFocus) return;
this.nestedForm.focus();
},
blur: function() {
if (!this.hasFocus) return;
this.nestedForm.blur();
},
remove: function() {
this.nestedForm.remove();
Backbone.View.prototype.remove.call(this);
},
validate: function() {
return this.nestedForm.validate();
},
_observeFormEvents: function() {
if (!this.nestedForm) return;
this.nestedForm.on('all', function() {
// args = ["key:change", form, fieldEditor]
var args = _.toArray(arguments);
args[1] = this;
// args = ["key:change", this=objectEditor, fieldEditor]
this.trigger.apply(this, args);
}, this);
}
});
/**
* NestedModel editor
*
* Creates a child form. For editing nested Backbone models
*
* Special options:
* schema.model: Embedded model constructor
*/
Form.editors.NestedModel = Form.editors.Object.extend({
initialize: function(options) {
Form.editors.Base.prototype.initialize.call(this, options);
if (!this.form) throw 'Missing required option "form"';
if (!options.schema.model) throw 'Missing required "schema.model" option for NestedModel editor';
},
render: function() {
//Get the constructor for creating the nested form; i.e. the same constructor as used by the parent form
var NestedForm = this.form.constructor;
var data = this.value || {},
key = this.key,
nestedModel = this.schema.model;
//Wrap the data in a model if it isn't already a model instance
var modelInstance = (data.constructor === nestedModel) ? data : new nestedModel(data);
this.nestedForm = new NestedForm({
model: modelInstance,
idPrefix: this.id + '_',
fieldTemplate: 'nestedField'
});
this._observeFormEvents();
//Render form
this.$el.html(this.nestedForm.render().el);
if (this.hasFocus) this.trigger('blur', this);
return this;
},
/**
* Update the embedded model, checking for nested validation errors and pass them up
* Then update the main model if all OK
*
* @return {Error|null} Validation error or null
*/
commit: function() {
var error = this.nestedForm.commit();
if (error) {
this.$el.addClass('error');
return error;
}
return Form.editors.Object.prototype.commit.call(this);
}
});
/**
* Date editor
*
* Schema options
* @param {Number|String} [options.schema.yearStart] First year in list. Default: 100 years ago
* @param {Number|String} [options.schema.yearEnd] Last year in list. Default: current year
*
* Config options (if not set, defaults to options stored on the main Date class)
* @param {Boolean} [options.showMonthNames] Use month names instead of numbers. Default: true
* @param {String[]} [options.monthNames] Month names. Default: Full English names
*/
Form.editors.Date = Form.editors.Base.extend({
events: {
'change select': function() {
this.updateHidden();
this.trigger('change', this);
},
'focus select': function() {
if (this.hasFocus) return;
this.trigger('focus', this);
},
'blur select': function() {
if (!this.hasFocus) return;
var self = this;
setTimeout(function() {
if (self.$('select:focus')[0]) return;
self.trigger('blur', self);
}, 0);
}
},
initialize: function(options) {
options = options || {};
Form.editors.Base.prototype.initialize.call(this, options);
var Self = Form.editors.Date,
today = new Date();
//Option defaults
this.options = _.extend({
monthNames: Self.monthNames,
showMonthNames: Self.showMonthNames
}, options);
//Schema defaults
this.schema = _.extend({
yearStart: today.getFullYear() - 100,
yearEnd: today.getFullYear()
}, options.schema || {});
//Cast to Date
if (this.value && !_.isDate(this.value)) {
this.value = new Date(this.value);
}
//Set default date
if (!this.value) {
var date = new Date();
date.setSeconds(0);
date.setMilliseconds(0);
this.value = date;
}
//Template
this.template = options.template || this.constructor.template;
},
render: function() {
var options = this.options,
schema = this.schema;
var datesOptions = _.map(_.range(1, 32), function(date) {
return '<option value="'+date+'">' + date + '</option>';
});
var monthsOptions = _.map(_.range(0, 12), function(month) {
var value = (options.showMonthNames)
? options.monthNames[month]
: (month + 1);
return '<option value="'+month+'">' + value + '</option>';
});
var yearRange = (schema.yearStart < schema.yearEnd)
? _.range(schema.yearStart, schema.yearEnd + 1)
: _.range(schema.yearStart, schema.yearEnd - 1, -1);
var yearsOptions = _.map(yearRange, function(year) {
return '<option value="'+year+'">' + year + '</option>';
});
//Render the selects
var $el = $($.trim(this.template({
dates: datesOptions.join(''),
months: monthsOptions.join(''),
years: yearsOptions.join('')
})));
//Store references to selects
this.$date = $el.find('[data-type="date"]');
this.$month = $el.find('[data-type="month"]');
this.$year = $el.find('[data-type="year"]');
//Create the hidden field to store values in case POSTed to server
this.$hidden = $('<input type="hidden" name="'+this.key+'" />');
$el.append(this.$hidden);
//Set value on this and hidden field
this.setValue(this.value);
//Remove the wrapper tag
this.setElement($el);
this.$el.attr('id', this.id);
this.$el.attr('name', this.getName());
if (this.hasFocus) this.trigger('blur', this);
return this;
},
/**
* @return {Date} Selected date
*/
getValue: function() {
var year = this.$year.val(),
month = this.$month.val(),
date = this.$date.val();
if (!year || !month || !date) return null;
return new Date(year, month, date);
},
/**
* @param {Date} date
*/
setValue: function(date) {
this.$date.val(date.getDate());
this.$month.val(date.getMonth());
this.$year.val(date.getFullYear());
this.updateHidden();
},
focus: function() {
if (this.hasFocus) return;
this.$('select').first().focus();
},
blur: function() {
if (!this.hasFocus) return;
this.$('select:focus').blur();
},
/**
* Update the hidden input which is maintained for when submitting a form
* via a normal browser POST
*/
updateHidden: function() {
var val = this.getValue();
if (_.isDate(val)) val = val.toISOString();
this.$hidden.val(val);
}
}, {
//STATICS
template: _.template('\
<div>\
<select data-type="date"><%= dates %></select>\
<select data-type="month"><%= months %></select>\
<select data-type="year"><%= years %></select>\
</div>\
', null, Form.templateSettings),
//Whether to show month names instead of numbers
showMonthNames: true,
//Month names to use if showMonthNames is true
//Replace for localisation, e.g. Form.editors.Date.monthNames = ['Janvier', 'Fevrier'...]
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
});
/**
* DateTime editor
*
* @param {Editor} [options.DateEditor] Date editor view to use (not definition)
* @param {Number} [options.schema.minsInterval] Interval between minutes. Default: 15
*/
Form.editors.DateTime = Form.editors.Base.extend({
events: {
'change select': function() {
this.updateHidden();
this.trigger('change', this);
},
'focus select': function() {
if (this.hasFocus) return;
this.trigger('focus', this);
},
'blur select': function() {
if (!this.hasFocus) return;
var self = this;
setTimeout(function() {
if (self.$('select:focus')[0]) return;
self.trigger('blur', self);
}, 0);
}
},
initialize: function(options) {
options = options || {};
Form.editors.Base.prototype.initialize.call(this, options);
//Option defaults
this.options = _.extend({
DateEditor: Form.editors.DateTime.DateEditor
}, options);
//Schema defaults
this.schema = _.extend({
minsInterval: 15
}, options.schema || {});
//Create embedded date editor
this.dateEditor = new this.options.DateEditor(options);
this.value = this.dateEditor.value;
//Template
this.template = options.template || this.constructor.template;
},
render: function() {
function pad(n) {
return n < 10 ? '0' + n : n;
}
var schema = this.schema;
//Create options
var hoursOptions = _.map(_.range(0, 24), function(hour) {
return '<option value="'+hour+'">' + pad(hour) + '</option>';
});
var minsOptions = _.map(_.range(0, 60, schema.minsInterval), function(min) {
return '<option value="'+min+'">' + pad(min) + '</option>';
});
//Render time selects
var $el = $($.trim(this.template({
hours: hoursOptions.join(),
mins: minsOptions.join()
})));
//Include the date editor
$el.find('[data-date]').append(this.dateEditor.render().el);
//Store references to selects
this.$hour = $el.find('select[data-type="hour"]');
this.$min = $el.find('select[data-type="min"]');
//Get the hidden date field to store values in case POSTed to server
this.$hidden = $el.find('input[type="hidden"]');
//Set time
this.setValue(this.value);
this.setElement($el);
this.$el.attr('id', this.id);
this.$el.attr('name', this.getName());
if (this.hasFocus) this.trigger('blur', this);
return this;
},
/**
* @return {Date} Selected datetime
*/
getValue: function() {
var date = this.dateEditor.getValue();
var hour = this.$hour.val(),
min = this.$min.val();
if (!date || !hour || !min) return null;
date.setHours(hour);
date.setMinutes(min);
return date;
},
/**
* @param {Date}
*/
setValue: function(date) {
if (!_.isDate(date)) date = new Date(date);
this.dateEditor.setValue(date);
this.$hour.val(date.getHours());
this.$min.val(date.getMinutes());
this.updateHidden();
},
focus: function() {
if (this.hasFocus) return;
this.$('select').first().focus();
},
blur: function() {
if (!this.hasFocus) return;
this.$('select:focus').blur();
},
/**
* Update the hidden input which is maintained for when submitting a form
* via a normal browser POST
*/
updateHidden: function() {
var val = this.getValue();
if (_.isDate(val)) val = val.toISOString();
this.$hidden.val(val);
},
/**
* Remove the Date editor before removing self
*/
remove: function() {
this.dateEditor.remove();
Form.editors.Base.prototype.remove.call(this);
}
}, {
//STATICS
template: _.template('\
<div class="bbf-datetime">\
<div class="bbf-date-container" data-date></div>\
<select data-type="hour"><%= hours %></select>\
:\
<select data-type="min"><%= mins %></select>\
</div>\
', null, Form.templateSettings),
//The date editor to use (constructor function, not instance)
DateEditor: Form.editors.Date
});
//Metadata
Form.VERSION = '0.12.0';
//Exports
Backbone.Form = Form;
})(this);
| icambron/cdnjs | ajax/libs/backbone-forms/0.12.0/templates/backbone-forms.js | JavaScript | mit | 56,667 |
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
define("dojo/cldr/nls/ja/chinese",{"dateFormatItem-yyyyMMMEd":"U年MMMd日(E)","field-dayperiod":"午前/午後","field-minute":"分","dateFormatItem-MMMEd":"MMMd日(E)","field-day-relative+-1":"昨日","dateFormatItem-hms":"aK:mm:ss","field-day-relative+-2":"一昨日","field-weekday":"曜日","months-standAlone-narrow":["正","二","三","四","五","六","七","八","九","十","十一","十二"],"dateFormatItem-Gy":"U年","field-era":"時代","field-hour":"時","dateFormatItem-y":"U年","dateFormatItem-yyyy":"U年","dateFormatItem-yyyyMMMEEEEd":"U年MMMd日EEEE","dateFormatItem-EEEEd":"d日EEEE","dateFormatItem-Ed":"d日(E)","field-day-relative+0":"今日","field-day-relative+1":"明日","field-day-relative+2":"明後日","dateFormatItem-GyMMMd":"U年MMMd日","dateFormat-long":"U年MMMd日","field-zone":"タイムゾーン","dateFormatItem-Hm":"H:mm","dateFormatItem-MMMEEEEd":"MMMd日EEEE","field-week-relative+-1":"先週","dateFormat-medium":"U年MMMd日","dateFormatItem-Hms":"H:mm:ss","field-year-relative+0":"今年","field-year-relative+1":"翌年","dateFormatItem-yMd":"U年M月d日","field-year-relative+-1":"昨年","dateFormatItem-yyyyQQQQ":"UQQQQ","field-year":"年","dateFormatItem-GyMMMEEEEd":"U年MMMd日EEEE","field-week":"週","dateFormatItem-yyyyMd":"U年M月d日","dateFormatItem-yyyyMMMd":"U年MMMd日","dateFormatItem-yyyyMEd":"U年M月d日(E)","dateFormatItem-yyyyMEEEEd":"U年M月d日EEEE","dateFormatItem-MMMd":"MMMd日","field-week-relative+0":"今週","field-week-relative+1":"翌週","field-month-relative+0":"今月","dateFormatItem-H":"H時","field-month":"月","field-month-relative+1":"翌月","dateFormatItem-M":"MMM","field-second":"秒","dateFormatItem-GyMMMEd":"U年MMMd日(E)","dateFormatItem-GyMMM":"U年MMM","dateFormatItem-MEEEEd":"M/dEEEE","field-day":"日","dateFormatItem-MEd":"M/d(E)","dateFormatItem-yyyyQQQ":"U/QQQ","months-format-narrow":["正","二","三","四","五","六","七","八","九","十","十一","十二"],"dateFormatItem-hm":"aK:mm","dateFormat-short":"U-M-d","dateFormatItem-yyyyM":"U年M月","dateFormat-full":"U年MMMd日EEEE","dateFormatItem-Md":"M/d","months-format-wide":["正月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],"dateFormatItem-yyyyMMM":"U年MMM","dateFormatItem-d":"d日","field-month-relative+-1":"先月","dateFormatItem-h":"aK時"});
| contolini/cdnjs | ajax/libs/dojo/1.9.0/cldr/nls/ja/chinese.js | JavaScript | mit | 2,600 |
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
define("dojo/cldr/nls/coptic",{root:{"days-standAlone-short":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"months-format-narrow":["1","2","3","4","5","6","7","8","9","10","11","12","13"],"quarters-standAlone-narrow":["1","2","3","4"],"field-weekday":"Day of the Week","quarters@localeAlias82":{"bundle":"gregorian","target":"quarters"},"days@localeAlias71":{"bundle":"gregorian","target":"days"},"dayPeriods-format-narrow@localeAlias90":{"bundle":"gregorian","target":"dayPeriods-format-abbr"},"dateFormatItem-GyMMMEd":"G y MMM d, E","dateFormatItem-MMMEd":"MMM d, E","dayPeriods-format-narrow@localeAlias91":{"bundle":"gregorian","target":"dayPeriods-format-wide"},"eraNarrow":["ERA0","ERA1"],"dayPeriods-format-narrow@localeAlias93":{"bundle":"gregorian","target":"dayPeriods-format-abbr"},"dayPeriods-format-narrow@localeAlias94":{"bundle":"gregorian","target":"dayPeriods-format-wide"},"timeFormat@localeAlias98":{"bundle":"gregorian","target":"timeFormat"},"days-standAlone-short@localeAlias78":{"bundle":"gregorian","target":"days-format-short"},"days-format-short":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"days-standAlone-short@localeAlias79":{"bundle":"gregorian","target":"days-format-abbr"},"dateTimeFormats-appendItem-Day-Of-Week":"{0} {1}","dateFormat-long":"G y MMMM d","months-format-wide":["Tout","Baba","Hator","Kiahk","Toba","Amshir","Baramhat","Baramouda","Bashans","Paona","Epep","Mesra","Nasie"],"dateFormatItem-yyyyQQQ":"G y QQQ","dateTimeFormat-medium":"{1} {0}","dayPeriods-format-wide-pm":"PM","dateFormat-full":"G y MMMM d, EEEE","dateFormatItem-yyyyMEd":"GGGGG y-MM-dd, E","dateFormatItem-Md":"MM-dd","dayPeriods-format-abbr-am":"AM","dateTimeFormats-appendItem-Second":"{0} ({2}: {1})","days-format-abbr@localeAlias72":{"bundle":"gregorian","target":"days-format-wide"},"field-era":"Era","months-standAlone-wide":["Tout","Baba","Hator","Kiahk","Toba","Amshir","Baramhat","Baramouda","Bashans","Paona","Epep","Mesra","Nasie"],"timeFormat-short":"HH:mm","days-standAlone-short@localeAlias80":{"bundle":"gregorian","target":"days-format-wide"},"quarters-format-abbr@localeAlias83":{"bundle":"gregorian","target":"quarters-format-wide"},"days-format-short@localeAlias74":{"bundle":"gregorian","target":"days-format-abbr"},"quarters-format-wide":["Q1","Q2","Q3","Q4"],"timeFormat-long":"HH:mm:ss z","days-format-short@localeAlias75":{"bundle":"gregorian","target":"days-format-wide"},"field-year":"Year","dateTimeFormats-appendItem-Era":"{1} {0}","field-hour":"Hour","months-format-abbr":["Tout","Baba","Hator","Kiahk","Toba","Amshir","Baramhat","Baramouda","Bashans","Paona","Epep","Mesra","Nasie"],"timeFormat-full":"HH:mm:ss zzzz","dateTimeFormats-appendItem-Week":"{0} ({2}: {1})","field-day-relative+0":"Today","field-day-relative+1":"Tomorrow","dateFormatItem-GyMMMd":"G y MMM d","months-standAlone-abbr":["Tout","Baba","Hator","Kiahk","Toba","Amshir","Baramhat","Baramouda","Bashans","Paona","Epep","Mesra","Nasie"],"dateFormatItem-H":"HH","quarters-format-abbr":["Q1","Q2","Q3","Q4"],"quarters-standAlone-wide":["Q1","Q2","Q3","Q4"],"quarters-standAlone-abbr@localeAlias85":{"bundle":"gregorian","target":"quarters-format-abbr"},"dateFormatItem-Gy":"G y","quarters-standAlone-abbr@localeAlias86":{"bundle":"gregorian","target":"quarters-format-wide"},"dateFormatItem-yyyyMMMEd":"G y MMM d, E","eraNarrow@localeAlias96":{"bundle":"coptic","target":"eraAbbr"},"dateFormatItem-M":"L","dateFormat@localeAlias97":{"bundle":"generic","target":"dateFormat"},"dayPeriods@localeAlias88":{"bundle":"gregorian","target":"dayPeriods"},"days-standAlone-wide":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"dateFormatItem-yyyyMMM":"G y MMM","dateFormatItem-yyyyMMMd":"G y MMM d","quarters-format-narrow@localeAlias84":{"bundle":"gregorian","target":"quarters-standAlone-narrow"},"timeFormat-medium":"HH:mm:ss","quarters-standAlone-abbr":["Q1","Q2","Q3","Q4"],"dateFormatItem-Hm":"HH:mm","eraAbbr":["ERA0","ERA1"],"field-minute":"Minute","field-dayperiod":"Dayperiod","days-standAlone-abbr":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"dateFormatItem-d":"d","dateFormatItem-ms":"mm:ss","quarters-format-narrow":["1","2","3","4"],"field-day-relative+-1":"Yesterday","dayPeriods-format-narrow-am":"AM","dateTimeFormat-long":"{1} {0}","dateFormatItem-h":"h a","dateFormatItem-MMMd":"MMM d","dateFormatItem-MEd":"MM-dd, E","dateTimeFormat-full":"{1} {0}","dateTime@localeAlias99":{"bundle":"generic","target":"dateTime"},"field-day":"Day","days-format-wide":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"field-zone":"Zone","months-standAlone-narrow":["1","2","3","4","5","6","7","8","9","10","11","12","13"],"dateFormatItem-y":"G y","dateTimeFormats-appendItem-Day":"{0} ({2}: {1})","months-standAlone-wide@localeAlias70":{"bundle":"coptic","target":"months-format-wide"},"months-format-abbr@localeAlias66":{"bundle":"coptic","target":"months-format-wide"},"days-format-narrow@localeAlias73":{"bundle":"gregorian","target":"days-standAlone-narrow"},"dateFormatItem-hm":"h:mm a","dateTimeFormats-appendItem-Year":"{1} {0}","dateTimeFormats-appendItem-Hour":"{0} ({2}: {1})","dayPeriods-format-abbr-pm":"PM","days-format-abbr":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"eraNames":["ERA0","ERA1"],"days-format-narrow":["S","M","T","W","T","F","S"],"dateFormatItem-yyyyMd":"GGGGG y-MM-dd","days-standAlone-narrow":["S","M","T","W","T","F","S"],"dateFormatItem-MMM":"LLL","field-month":"Month","eraNames@localeAlias95":{"bundle":"coptic","target":"eraAbbr"},"dateTimeFormats-appendItem-Quarter":"{0} ({2}: {1})","dayPeriods-format-wide-am":"AM","dateTimeFormats-appendItem-Month":"{0} ({2}: {1})","dateTimeFormats-appendItem-Minute":"{0} ({2}: {1})","days-standAlone-wide@localeAlias81":{"bundle":"gregorian","target":"days-format-wide"},"dateFormat-short":"GGGGG y-MM-dd","months-standAlone-abbr@localeAlias68":{"bundle":"coptic","target":"months-format-abbr"},"months-standAlone-abbr@localeAlias69":{"bundle":"coptic","target":"months-format-wide"},"dayPeriods-format-abbr@localeAlias89":{"bundle":"gregorian","target":"dayPeriods-format-wide"},"field-second":"Second","months-format-narrow@localeAlias67":{"bundle":"coptic","target":"months-standAlone-narrow"},"dateFormatItem-Ed":"d, E","dateTimeFormats-appendItem-Timezone":"{0} {1}","field-week":"Week","dateFormat-medium":"G y MMM d","days-standAlone-abbr@localeAlias76":{"bundle":"gregorian","target":"days-format-abbr"},"days-standAlone-abbr@localeAlias77":{"bundle":"gregorian","target":"days-format-wide"},"dateFormatItem-yyyyM":"GGGGG y-MM","dayPeriods-format-narrow-pm":"PM","dateFormatItem-yyyyQQQQ":"G y QQQQ","dateTimeFormat-short":"{1} {0}","dateFormatItem-Hms":"HH:mm:ss","dateFormatItem-hms":"h:mm:ss a","dateFormatItem-GyMMM":"G y MMM","quarters-standAlone-wide@localeAlias87":{"bundle":"gregorian","target":"quarters-format-wide"},"dayPeriods-format-abbr@localeAlias92":{"bundle":"gregorian","target":"dayPeriods-format-wide"},"dateFormatItem-yyyy":"G y"},"ar":true,"fr":true,"hu":true,"ja":true,"pl":true,"pt":true,"ro":true,"ru":true,"sv":true,"th":true,"tr":true,"zh":true,"zh-hant":true});
| kirbyfan64/cdnjs | ajax/libs/dojo/1.9.3/cldr/nls/coptic.js | JavaScript | mit | 7,279 |
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
define("dojo/cldr/nls/fi/chinese",{"dateFormatItem-yyyyMMMEd":"E d.M.y","field-dayperiod":"vuorokaudenaika","field-minute":"minuutti","dateFormatItem-MMMEd":"E d.M.","field-day-relative+-1":"eilen","dateFormatItem-hms":"h.mm.ss a","field-day-relative+-2":"toissapäivänä","field-weekday":"viikonpäivä","field-era":"aikakausi","field-hour":"tunti","dateFormatItem-y":"y","dateFormatItem-yyyy":"y","field-day-relative+0":"tänään","field-day-relative+1":"huomenna","field-day-relative+2":"ylihuomenna","dateFormat-long":"d.M.y","field-zone":"aikavyöhyke","dateFormatItem-Hm":"H.mm","field-week-relative+-1":"viime viikolla","dateFormat-medium":"d.M.y","dateFormatItem-Hms":"H.mm.ss","field-year-relative+0":"tänä vuonna","field-year-relative+1":"ensi vuonna","field-year-relative+-1":"viime vuonna","dateFormatItem-ms":"mm.ss","field-year":"vuosi","field-week":"viikko","dateFormatItem-yyyyMd":"d.M.y","dateFormatItem-yyyyMMMd":"d.M.y","dateFormatItem-yyyyMEd":"E d.M.y","dateFormatItem-MMMd":"d.M.","field-week-relative+0":"tällä viikolla","field-week-relative+1":"ensi viikolla","field-month-relative+0":"tässä kuussa","field-month":"kuukausi","field-month-relative+1":"ensi kuussa","dateFormatItem-H":"H","field-second":"sekunti","field-day":"päivä","dateFormatItem-MEd":"E d.M.","dateFormatItem-hm":"h.mm a","dateFormat-short":"d.M.y","dateFormat-full":"cccc d.M.y","dateFormatItem-Md":"d.M.","field-month-relative+-1":"viime kuussa"});
| yinghunglai/cdnjs | ajax/libs/dojo/1.9.6/cldr/nls/fi/chinese.js | JavaScript | mit | 1,660 |
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
define("dojo/cldr/nls/th/coptic",{"field-second":"วินาที","field-year-relative+-1":"ปีที่แล้ว","field-week":"สัปดาห์","field-month-relative+-1":"เดือนที่แล้ว","field-day-relative+-1":"เมื่อวาน","months-format-narrow":["1","2","3","4","5","6","7","8","9","10","11","12","13"],"field-day-relative+-2":"เมื่อวานซืน","months-standAlone-narrow":["1","2","3","4","5","6","7","8","9","10","11","12","13"],"months-standAlone-wide":["เทาท์","บาบา","ฮาเทอร์","เคียฟ","โทบา","อัมเชอร์","บารัมฮัท","บาราเมาดา","บาชันส์","พาโอนา","อีเปป","เมสรา","นาซี"],"field-year":"ปี","field-week-relative+0":"สัปดาห์นี้","months-standAlone-abbr":["เทาท์","บาบา","ฮาเทอร์","เคียฟ","โทบา","อัมเชอร์","บารัมฮัท","บาราเมาดา","บาชันส์","พาโอนา","อีเปป","เมสรา","นาซี"],"field-week-relative+1":"สัปดาห์หน้า","field-minute":"นาที","field-week-relative+-1":"สัปดาห์ที่แล้ว","field-day-relative+0":"วันนี้","field-hour":"ชั่วโมง","field-day-relative+1":"พรุ่งนี้","field-day-relative+2":"มะรืนนี้","field-day":"วัน","field-month-relative+0":"เดือนนี้","field-month-relative+1":"เดือนหน้า","field-dayperiod":"ช่วงวัน","field-month":"เดือน","months-format-wide":["เทาท์","บาบา","ฮาเทอร์","เคียฟ","โทบา","อัมเชอร์","บารัมฮัท","บาราเมาดา","บาชันส์","พาโอนา","อีเปป","เมสรา","นาซี"],"field-era":"สมัย","field-year-relative+0":"ปีนี้","field-year-relative+1":"ปีหน้า","months-format-abbr":["เทาท์","บาบา","ฮาเทอร์","เคียฟ","โทบา","อัมเชอร์","บารัมฮัท","บาราเมาดา","บาชันส์","พาโอนา","อีเปป","เมสรา","นาซี"],"field-weekday":"วันในสัปดาห์","field-zone":"เขต"});
| wil93/cdnjs | ajax/libs/dojo/1.9.3/cldr/nls/th/coptic.js | JavaScript | mit | 2,712 |
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
define("dojo/cldr/nls/el/roc",{"dateFormatItem-yM":"M/y G","field-dayperiod":"π.μ./μ.μ.","field-minute":"Λεπτό","dateFormatItem-MMMEd":"E, d MMM","field-day-relative+-1":"Χτες","dateFormatItem-yQQQ":"y G QQQ","field-day-relative+-2":"Προχτές","field-weekday":"Ημέρα εβδομάδας","dateFormatItem-MMM":"LLL","field-era":"Περίοδος","dateFormatItem-Gy":"y G","field-hour":"Ώρα","dateFormatItem-y":"y G","dateFormatItem-Ed":"E d","dateFormatItem-yMMM":"LLL, y G","field-day-relative+0":"Σήμερα","field-day-relative+1":"Αύριο","eraAbbr":["Πριν R.O.C.","R.O.C."],"field-day-relative+2":"Μεθαύριο","dateFormat-long":"d MMMM, y G","field-zone":"Ζώνη","field-week-relative+-1":"Προηγούμενη εβδομάδα","dateFormat-medium":"d MMM, y G","field-year-relative+0":"Φέτος","field-year-relative+1":"Επόμενο έτος","dateFormatItem-yMd":"d/M/y G","field-year-relative+-1":"Προηγούμενο έτος","field-year":"Έτος","field-week":"Εβδομάδα","dateFormatItem-MMMd":"d MMM","field-week-relative+0":"Αυτήν την εβδομάδα","field-week-relative+1":"Επόμενη εβδομάδα","dateFormatItem-yQQQQ":"QQQQ y G","field-month-relative+0":"Τρέχων μήνας","field-month":"Μήνας","field-month-relative+1":"Επόμενος μήνας","dateFormatItem-yMMMd":"d MMM, y G","field-second":"Δευτερόλεπτο","field-day":"Ημέρα","dateFormatItem-MEd":"E, d/M","dateFormat-short":"d/M/y G","dateFormatItem-yMMMEd":"E, d MMM, y G","dateFormat-full":"EEEE, d MMMM, y G","dateFormatItem-Md":"d/M","dateFormatItem-yMEd":"E, d/M/y G","field-month-relative+-1":"Προηγούμενος μήνας"});
| vdurmont/cdnjs | ajax/libs/dojo/1.9.2/cldr/nls/el/roc.js | JavaScript | mit | 1,935 |
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
define("dojo/cldr/nls/en/buddhist",{"field-dayperiod":"AM/PM","dateFormatItem-yyyyMMMEd":"E, MMM d, y G","field-minute":"Minute","dateFormatItem-MMMEd":"E, MMM d","dateTimeFormat-full":"{1} 'at' {0}","field-day-relative+-1":"Yesterday","field-weekday":"Day of the Week","months-standAlone-narrow":["J","F","M","A","M","J","J","A","S","O","N","D"],"dateTimeFormats-appendItem-Year":"{0} {1}","dateTimeFormat-short":"{1}, {0}","field-era":"Era","dateFormatItem-Gy":"y G","field-hour":"Hour","dateTimeFormat-medium":"{1}, {0}","dateFormatItem-y":"y G","timeFormat-full":"h:mm:ss a zzzz","dateFormatItem-yyyy":"y G","dateFormatItem-Ed":"d E","field-day-relative+0":"Today","field-day-relative+1":"Tomorrow","eraAbbr":["BE"],"dateFormatItem-GyMMMd":"MMM d, y G","dateFormat-long":"MMMM d, y G","timeFormat-medium":"h:mm:ss a","field-zone":"Time Zone","field-week-relative+-1":"Last week","dateFormat-medium":"MMM d, y G","dayPeriods-format-narrow-pm":"p","field-year-relative+0":"This year","field-year-relative+1":"Next year","field-year-relative+-1":"Last year","field-year":"Year","dateFormatItem-yyyyQQQQ":"QQQQ y G","dayPeriods-format-narrow-am":"a","dateTimeFormat-long":"{1} 'at' {0}","field-week":"Week","dateFormatItem-yyyyMMMd":"MMM d, y G","dateFormatItem-yyyyMd":"M/d/y GGGGG","dateFormatItem-yyyyMEd":"E, M/d/y GGGGG","field-week-relative+0":"This week","field-week-relative+1":"Next week","timeFormat-long":"h:mm:ss a z","months-format-abbr":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"field-month-relative+0":"This month","field-month":"Month","field-month-relative+1":"Next month","timeFormat-short":"h:mm a","field-second":"Second","dateFormatItem-GyMMMEd":"E, MMM d, y G","dateFormatItem-GyMMM":"MMM y G","field-day":"Day","dateFormatItem-yyyyQQQ":"QQQ y G","dateFormatItem-MEd":"E, M/d","dateFormat-short":"M/d/y GGGGG","dateFormatItem-yyyyM":"M/y GGGGG","dateFormat-full":"EEEE, MMMM d, y G","dateFormatItem-Md":"M/d","months-format-wide":["January","February","March","April","May","June","July","August","September","October","November","December"],"days-format-short":["Su","Mo","Tu","We","Th","Fr","Sa"],"dateFormatItem-yyyyMMM":"MMM y G","dateTimeFormats-appendItem-Era":"{0} {1}","field-month-relative+-1":"Last month","quarters-format-wide":["1st quarter","2nd quarter","3rd quarter","4th quarter"],"days-format-wide":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]});
| ljharb/cdnjs | ajax/libs/dojo/1.9.3/cldr/nls/en/buddhist.js | JavaScript | mit | 2,653 |
.yui3-overlay{position:absolute}.yui3-overlay-hidden{visibility:hidden}.yui3-widget-tmp-forcesize .yui3-overlay-content{overflow:hidden!important}.yui3-skin-night{background-color:#000;font-family:HelveticaNeue,arial,helvetica,clean,sans-serif;color:#fff}.yui3-skin-night .yui3-overlay-content ul,ol,li{margin:0;padding:0;list-style:none;zoom:1}.yui3-skin-night .yui3-overlay-content li{*float:left}.yui3-skin-night .yui3-overlay-content{background-color:#6d6e6e;-moz-box-shadow:0 0 17px rgba(0,0,0,0.58);-webkit-box-shadow:0 0 17px rgba(0,0,0,0.58);box-shadow:0 0 17px rgba(0,0,0,0.58);-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px}.yui3-skin-night .yui3-overlay-content .yui3-widget-hd{background-color:#6d6e6e;-moz-border-radius:7px 7px 0 0;-webkit-border-radius:7px 7px 0 0;border-radius:7px 7px 0 0;color:#fff;margin:0;padding:20px 22px 0;font-size:147%}.yui3-skin-night .yui3-overlay-content .yui3-widget-bd{padding:11px 22px 17px;font-size:92%}.yui3-skin-night .yui3-overlay .yui3-widget-bd li{margin:.04em}.yui3-skin-night .yui3-overlay-content .yui3-widget-ft{background-color:#575858;border-top:solid 1px #494a4a;-moz-border-radius:0 0 7px 7px;-webkit-border-radius:0 0 7px 7px;border-radius:0 0 7px 7px;padding:17px 25px 20px;text-align:center}.yui3-skin-night .yui3-overlay-content .yui3-widget-ft li{margin:3px;display:inline-block}.yui3-skin-night .yui3-overlay-content .yui3-widget-ft li a{border:solid 1px #1b1c1c;border-radius:6px;-moz-box-shadow:0 1px #677478;-webkit-box-shadow:0 1px #677478;box-shadow:0 1px #677478;text-shadow:0 -1px 0 rgba(0,0,0,0.7);font-size:85%;text-align:center;color:#fff;padding:6px 28px;background-color:#2b2d2d;background:-moz-linear-gradient(0% 100% 90deg,#242526 0,#3b3c3d 96%,#2c2d2f 100%);background:-webkit-gradient(linear,left bottom,left top,from(#242526),color-stop(0.96,#3b3c3d),to(#2c2d2f))}.yui3-skin-night .yui3-overlay .yui3-widget-ft li:first-child{margin-left:0}.yui3-skin-night .yui3-overlay .yui3-widget-ft li:last-child{margin-right:0}.yui3-skin-night .yui3-overlay .yui3-widget-ft li:last-child a{border:solid 1px #520e00;-moz-box-shadow:0 1px #7d5d57;-webkit-box-shadow:0 1px #7d5d57;box-shadow:0 1px #7d5d57;background-color:#901704;background:-moz-linear-gradient(100% 0 270deg,#ab1c0b,#7b1400);background:-webkit-gradient(linear,left top,left bottom,from(#ab1c0b),to(#7b1400));margin-right:0}#yui3-widget-mask{background-color:#000;opacity:.5}#yui3-css-stamp.skin-night-overlay{display:none}
| manorius/cdnjs | ajax/libs/yui/3.14.0/overlay/assets/skins/night/overlay.css | CSS | mit | 2,483 |
videojs.addLanguage("nl",{
"Play": "Afspelen",
"Pause": "Pauze",
"Current Time": "Huidige Tijd",
"Duration Time": "Looptijd",
"Remaining Time": "Resterende Tijd",
"Stream Type": "Stream Type",
"LIVE": "LIVE",
"Loaded": "Geladen",
"Progress": "Status",
"Fullscreen": "Volledig scherm",
"Non-Fullscreen": "Geen volledig scherm",
"Mute": "Geluid Uit",
"Unmuted": "Geluid Aan",
"Playback Rate": "Weergave Rate",
"Subtitles": "Ondertiteling",
"subtitles off": "Ondertiteling uit",
"Captions": "Onderschriften",
"captions off": "Onderschriften uit",
"Chapters": "Hoofdstukken",
"You aborted the video playback": "Je hebt de video weergave afgebroken.",
"A network error caused the video download to fail part-way.": "De video download is mislukt door een netwerkfout.",
"The video could not be loaded, either because the server or network failed or because the format is not supported.": "De video kon niet worden geladen, veroorzaakt door een server of netwerkfout of het formaat word niet ondersteund.",
"The video playback was aborted due to a corruption problem or because the video used features your browser did not support.": "De video weergave is afgebroken omdat deze beschadigd is of de video gebruikt functionaliteit die niet door je browser word ondersteund.",
"No compatible source was found for this video.": "Voor deze video is geen ondersteunde bron gevonden."
}); | markcarver/jsdelivr | files/videojs/4.12.9/lang/nl.js | JavaScript | mit | 1,398 |
var testPendingCredential = function (test) {
var http = Npm.require('http');
var twitterfooId = Random.id();
var twitterfooName = 'nickname' + Random.id();
var twitterfooAccessToken = Random.id();
var twitterfooAccessTokenSecret = Random.id();
var twitterOption1 = Random.id();
var credentialToken = Random.id();
var serviceName = Random.id();
var urls = {
requestToken: "https://example.com/oauth/request_token",
authorize: "https://example.com/oauth/authorize",
accessToken: "https://example.com/oauth/access_token",
authenticate: "https://example.com/oauth/authenticate"
};
OAuth1Binding.prototype.prepareRequestToken = function() {};
OAuth1Binding.prototype.prepareAccessToken = function() {
this.accessToken = twitterfooAccessToken;
this.accessTokenSecret = twitterfooAccessTokenSecret;
};
ServiceConfiguration.configurations.insert({service: serviceName});
try {
// register a fake login service
OAuth.registerService(serviceName, 1, urls, function (query) {
return {
serviceData: {
id: twitterfooId,
screenName: twitterfooName,
accessToken: OAuth.sealSecret(twitterfooAccessToken),
accessTokenSecret: OAuth.sealSecret(twitterfooAccessTokenSecret)
},
options: {
option1: twitterOption1
}
};
});
// simulate logging in using twitterfoo
Oauth._storeRequestToken(credentialToken, twitterfooAccessToken);
var req = {
method: "POST",
url: "/_oauth/" + serviceName,
query: {
state: OAuth._generateState('popup', credentialToken),
oauth_token: twitterfooAccessToken,
only_credential_secret_for_test: 1
}
};
var res = new http.ServerResponse(req);
var write = res.write;
var end = res.write;
var respData = "";
res.write = function (data, encoding, callback) {
respData += data;
return write.apply(this, arguments);
};
res.end = function (data) {
respData += data;
return end.apply(this, arguments);
};
OAuthTest.middleware(req, res);
var credentialSecret = respData;
// Test that the result for the token is available
var result = OAuth._retrievePendingCredential(credentialToken,
credentialSecret);
var serviceData = OAuth.openSecrets(result.serviceData);
test.equal(result.serviceName, serviceName);
test.equal(serviceData.id, twitterfooId);
test.equal(serviceData.screenName, twitterfooName);
test.equal(serviceData.accessToken, twitterfooAccessToken);
test.equal(serviceData.accessTokenSecret, twitterfooAccessTokenSecret);
test.equal(result.options.option1, twitterOption1);
// Test that pending credential is removed after being retrieved
result = OAuth._retrievePendingCredential(credentialToken);
test.isUndefined(result);
} finally {
OAuthTest.unregisterService(serviceName);
}
};
Tinytest.add("oauth1 - pendingCredential is stored and can be retrieved (without oauth encryption)", function (test) {
OAuthEncryption.loadKey(null);
testPendingCredential(test);
});
Tinytest.add("oauth1 - pendingCredential is stored and can be retrieved (with oauth encryption)", function (test) {
try {
OAuthEncryption.loadKey(new Buffer([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]).toString("base64"));
testPendingCredential(test);
} finally {
OAuthEncryption.loadKey(null);
}
});
Tinytest.add("oauth1 - duplicate key for request token", function (test) {
var key = Random.id();
var token = Random.id();
var secret = Random.id();
OAuth._storeRequestToken(key, token, secret);
var newToken = Random.id();
var newSecret = Random.id();
OAuth._storeRequestToken(key, newToken, newSecret);
var result = OAuth._retrieveRequestToken(key);
test.equal(result.requestToken, newToken);
test.equal(result.requestTokenSecret, newSecret);
});
Tinytest.add("oauth1 - null, undefined key for request token", function (test) {
var token = Random.id();
var secret = Random.id();
test.throws(function () {
OAuth._storeRequestToken(null, token, secret);
});
test.throws(function () {
OAuth._storeRequestToken(undefined, token, secret);
});
});
| HugoRLopes/meteor | packages/oauth1/oauth1_tests.js | JavaScript | mit | 4,283 |
'use strict';
var global = require('./$.global')
, $ = require('./$')
, $def = require('./$.def')
, fails = require('./$.fails')
, hide = require('./$.hide')
, mix = require('./$.mix')
, forOf = require('./$.for-of')
, strictNew = require('./$.strict-new')
, isObject = require('./$.is-object')
, DESCRIPTORS = require('./$.descriptors')
, setToStringTag = require('./$.set-to-string-tag');
module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
var Base = global[NAME]
, C = Base
, ADDER = IS_MAP ? 'set' : 'add'
, proto = C && C.prototype
, O = {};
if(!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){
new C().entries().next();
}))){
// create collection constructor
C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
mix(C.prototype, methods);
} else {
C = wrapper(function(target, iterable){
strictNew(target, C, NAME);
target._c = new Base;
if(iterable != undefined)forOf(iterable, IS_MAP, target[ADDER], target);
});
$.each.call('add,clear,delete,forEach,get,has,set,keys,values,entries'.split(','),function(KEY){
var IS_ADDER = KEY == 'add' || KEY == 'set';
if(KEY in proto && !(IS_WEAK && KEY == 'clear'))hide(C.prototype, KEY, function(a, b){
if(!IS_ADDER && IS_WEAK && !isObject(a))return KEY == 'get' ? undefined : false;
var result = this._c[KEY](a === 0 ? 0 : a, b);
return IS_ADDER ? this : result;
});
});
if('size' in proto)$.setDesc(C.prototype, 'size', {
get: function(){
return this._c.size;
}
});
}
setToStringTag(C, NAME);
O[NAME] = C;
$def($def.G + $def.W + $def.F, O);
if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);
return C;
}; | Ramshackle-Jamathon/Interactive-Experiments | Jumpstart/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-es2015-computed-properties/node_modules/babel-runtime/node_modules/core-js/library/modules/$.collection.js | JavaScript | mit | 1,893 |
/*!
* This file is part of cytoscape.js 2.2.13.
*
* Cytoscape.js is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Cytoscape.js 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 Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* cytoscape.js. If not, see <http://www.gnu.org/licenses/>.
*/
var cytoscape;!function(e){"use strict";var t=cytoscape=function(){return cytoscape.init.apply(cytoscape,arguments)};t.init=function(e){return void 0===e&&(e={}),t.is.plainObject(e)?new t.Core(e):t.is.string(e)?t.extension.apply(t.extension,arguments):void 0},t.fn={},"undefined"!=typeof exports&&(exports=module.exports=cytoscape),"undefined"!=typeof define&&define("cytoscape",function(){return cytoscape}),e&&(e.cytoscape=cytoscape)}("undefined"==typeof window?null:window),function(e,t){"use strict";e.is={string:function(e){return null!=e&&"string"==typeof e},fn:function(e){return null!=e&&"function"==typeof e},array:function(e){return Array.isArray?Array.isArray(e):null!=e&&e instanceof Array},plainObject:function(t){return null!=t&&typeof t==typeof{}&&!e.is.array(t)&&t.constructor===Object},number:function(e){return null!=e&&"number"==typeof e&&!isNaN(e)},integer:function(t){return e.is.number(t)&&Math.floor(t)===t},color:function(e){return null!=e&&"string"==typeof e&&""!==$.Color(e).toString()},bool:function(e){return null!=e&&typeof e==typeof!0},elementOrCollection:function(t){return e.is.element(t)||e.is.collection(t)},element:function(t){return t instanceof e.Element&&t._private.single},collection:function(t){return t instanceof e.Collection&&!t._private.single},core:function(t){return t instanceof e.Core},style:function(t){return t instanceof e.Style},stylesheet:function(t){return t instanceof e.Stylesheet},event:function(t){return t instanceof e.Event},emptyString:function(t){return t?e.is.string(t)&&(""===t||t.match(/^\s+$/))?!0:!1:!0},nonemptyString:function(t){return t&&e.is.string(t)&&""!==t&&!t.match(/^\s+$/)?!0:!1},domElement:function(e){return"undefined"==typeof HTMLElement?!1:e instanceof HTMLElement},touch:function(){return t&&("ontouchstart"in t||t.DocumentTouch&&document instanceof DocumentTouch)}}}(cytoscape,"undefined"==typeof window?null:window),function(e,t){"use strict";e.util={extend:function(){var t,r,n,i,a,o,s=arguments[0]||{},l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),"object"==typeof s||e.is.fn(s)||(s={}),c===l&&(s=this,--l);c>l;l++)if(null!=(t=arguments[l]))for(r in t)n=s[r],i=t[r],s!==i&&(u&&i&&(e.is.plainObject(i)||(a=e.is.array(i)))?(a?(a=!1,o=n&&e.is.array(n)?n:[]):o=n&&e.is.plainObject(n)?n:{},s[r]=e.util.extend(u,o,i)):void 0!==i&&(s[r]=i));return s},throttle:function(t,r,n){var i=!0,a=!0;return n===!1?i=!1:e.is.plainObject(n)&&(i="leading"in n?n.leading:i,a="trailing"in n?n.trailing:a),n=n||{},n.leading=i,n.maxWait=r,n.trailing=a,e.util.debounce(t,r,n)},now:function(){return+new Date},debounce:function(t,r,n){var i,a,o,s,l,c,u,d=0,p=!1,h=!0;if(e.is.fn(t)){if(r=Math.max(0,r)||0,n===!0){var g=!0;h=!1}else e.is.plainObject(n)&&(g=n.leading,p="maxWait"in n&&(Math.max(r,n.maxWait)||0),h="trailing"in n?n.trailing:h);var v=function(){var n=r-(e.util.now()-s);if(0>=n){a&&clearTimeout(a);var p=u;a=c=u=void 0,p&&(d=e.util.now(),o=t.apply(l,i),c||a||(i=l=null))}else c=setTimeout(v,n)},f=function(){c&&clearTimeout(c),a=c=u=void 0,(h||p!==r)&&(d=e.util.now(),o=t.apply(l,i),c||a||(i=l=null))};return function(){if(i=arguments,s=e.util.now(),l=this,u=h&&(c||!g),p===!1)var n=g&&!c;else{a||g||(d=s);var y=p-(s-d),m=0>=y;m?(a&&(a=clearTimeout(a)),d=s,o=t.apply(l,i)):a||(a=setTimeout(f,y))}return m&&c?c=clearTimeout(c):c||r===p||(c=setTimeout(v,r)),n&&(m=!0,o=t.apply(l,i)),!m||c||a||(i=l=null),o}}},error:function(e){if(!console)throw e;if(console.error)console.error(e);else{if(!console.log)throw e;console.log(e)}},clone:function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t},copy:function(t){return null==t?t:e.is.array(t)?t.slice():e.is.plainObject(t)?e.util.clone(t):t},mapEmpty:function(e){var t=!0;if(null!=e)for(var r in e){t=!1;break}return t},pushMap:function(t){var r=e.util.getMap(t);null==r?e.util.setMap($.extend({},t,{value:[t.value]})):r.push(t.value)},setMap:function(t){for(var r,n=t.map,i=t.keys,a=i.length,o=0;a>o;o++){var r=i[o];e.is.plainObject(r)&&e.util.error("Tried to set map with object key"),o<i.length-1?(null==n[r]&&(n[r]={}),n=n[r]):n[r]=t.value}},getMap:function(t){for(var r=t.map,n=t.keys,i=n.length,a=0;i>a;a++){var o=n[a];if(e.is.plainObject(o)&&e.util.error("Tried to get map with object key"),r=r[o],null==r)return r}return r},deleteMap:function(t){for(var r=t.map,n=t.keys,i=n.length,a=t.keepChildren,o=0;i>o;o++){var s=n[o];e.is.plainObject(s)&&e.util.error("Tried to delete map with object key");var l=o===t.keys.length-1;if(l)if(a)for(var c in r)a[c]||delete r[c];else delete r[s];else r=r[s]}},capitalize:function(t){return e.is.emptyString(t)?t:t.charAt(0).toUpperCase()+t.substring(1)},camel2dash:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],i=n.toLowerCase(),a=n!==i;a?(t.push("-"),t.push(i)):t.push(n)}var o=t.length===e.length;return o?e:t.join("")},dash2camel:function(e){for(var t=[],r=!1,n=0;n<e.length;n++){var i=e[n],a="-"===i;a?r=!0:(t.push(r?i.toUpperCase():i),r=!1)}return t.join("")},trim:function(e){var t,r;for(t=0;t<e.length&&" "===e[t];t++);for(r=e.length-1;r>t&&" "===e[r];r--);return e.substring(t,r+1)},hex2tuple:function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,r,n,i=4===e.length,a=16;return i?(t=parseInt(e[1]+e[1],a),r=parseInt(e[2]+e[2],a),n=parseInt(e[3]+e[3],a)):(t=parseInt(e[1]+e[2],a),r=parseInt(e[3]+e[4],a),n=parseInt(e[5]+e[6],a)),[t,r,n]}},hsl2tuple:function(t){function r(e,t,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?e+6*(t-e)*r:.5>r?t:2/3>r?e+(t-e)*(2/3-r)*6:e}var n,i,a,o,s,l,c,u,d=new RegExp("^"+e.util.regex.hsla+"$").exec(t);if(d){if(i=parseInt(d[1]),0>i?i=(360- -1*i%360)%360:i>360&&(i%=360),i/=360,a=parseFloat(d[2]),0>a||a>100)return;if(a/=100,o=parseFloat(d[3]),0>o||o>100)return;if(o/=100,s=d[4],void 0!==s&&(s=parseFloat(s),0>s||s>1))return;if(0===a)l=c=u=Math.round(255*o);else{var p=.5>o?o*(1+a):o+a-o*a,h=2*o-p;l=Math.round(255*r(h,p,i+1/3)),c=Math.round(255*r(h,p,i)),u=Math.round(255*r(h,p,i-1/3))}n=[l,c,u,s]}return n},rgb2tuple:function(t){var r,n=new RegExp("^"+e.util.regex.rgba+"$").exec(t);if(n){r=[];for(var i=[],a=1;3>=a;a++){var o=n[a];if("%"===o[o.length-1]&&(i[a]=!0),o=parseFloat(o),i[a]&&(o=o/100*255),0>o||o>255)return;r.push(Math.floor(o))}var s=i[1]||i[2]||i[3],l=i[1]&&i[2]&&i[3];if(s&&!l)return;var c=n[4];if(void 0!==c){if(c=parseFloat(c),0>c||c>1)return;r.push(c)}}return r},colorname2tuple:function(t){return e.util.colors[t.toLowerCase()]},color2tuple:function(t){return e.util.colorname2tuple(t)||e.util.hex2tuple(t)||e.util.rgb2tuple(t)||e.util.hsl2tuple(t)},tuple2hex:function(e){function t(e){var t=e.toString(16);return 1===t.length&&(t="0"+t),t}var r=e[0],n=e[1],i=e[2];return"#"+t(r)+t(n)+t(i)},colors:{transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},e.util.regex={},e.util.regex.number="(?:[-]?\\d*\\.\\d+|[-]?\\d+|[-]?\\d*\\.\\d+[eE]\\d+)",e.util.regex.rgba="rgb[a]?\\(("+e.util.regex.number+"[%]?)\\s*,\\s*("+e.util.regex.number+"[%]?)\\s*,\\s*("+e.util.regex.number+"[%]?)(?:\\s*,\\s*("+e.util.regex.number+"))?\\)",e.util.regex.rgbaNoBackRefs="rgb[a]?\\((?:"+e.util.regex.number+"[%]?)\\s*,\\s*(?:"+e.util.regex.number+"[%]?)\\s*,\\s*(?:"+e.util.regex.number+"[%]?)(?:\\s*,\\s*(?:"+e.util.regex.number+"))?\\)",e.util.regex.hsla="hsl[a]?\\(("+e.util.regex.number+")\\s*,\\s*("+e.util.regex.number+"[%])\\s*,\\s*("+e.util.regex.number+"[%])(?:\\s*,\\s*("+e.util.regex.number+"))?\\)",e.util.regex.hslaNoBackRefs="hsl[a]?\\((?:"+e.util.regex.number+")\\s*,\\s*(?:"+e.util.regex.number+"[%])\\s*,\\s*(?:"+e.util.regex.number+"[%])(?:\\s*,\\s*(?:"+e.util.regex.number+"))?\\)",e.util.regex.hex3="\\#[0-9a-fA-F]{3}",e.util.regex.hex6="\\#[0-9a-fA-F]{6}";var r=t?t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame:null;r=r||function(e){e&&setTimeout(e,1e3/60)},e.util.requestAnimationFrame=function(e){r(e)}}(cytoscape,"undefined"==typeof window?null:window),function(e){"use strict";e.math={},e.math.signum=function(e){return e>0?1:0>e?-1:0},e.math.distance=function(e,t){var r=t.x-e.x,n=t.y-e.y;return Math.sqrt(r*r+n*n)},e.math.qbezierAt=function(e,t,r,n){return(1-n)*(1-n)*e+2*(1-n)*n*t+n*n*r},e.math.qbezierPtAt=function(t,r,n,i){return{x:e.math.qbezierAt(t.x,r.x,n.x,i),y:e.math.qbezierAt(t.y,r.y,n.y,i)}},e.math.roundRectangleIntersectLine=function(e,t,r,n,i,a,o){var s,l=this.getRoundRectangleRadius(i,a),c=i/2,u=a/2,d=r-c+l-o,p=n-u-o,h=r+c-l+o,g=p;if(s=this.finiteLinesIntersect(e,t,r,n,d,p,h,g,!1),s.length>0)return s;var v=r+c+o,f=n-u+l-o,y=v,m=n+u-l+o;if(s=this.finiteLinesIntersect(e,t,r,n,v,f,y,m,!1),s.length>0)return s;var b=r-c+l-o,x=n+u+o,w=r+c-l+o,_=x;if(s=this.finiteLinesIntersect(e,t,r,n,b,x,w,_,!1),s.length>0)return s;var E=r-c-o,S=n-u+l-o,P=E,k=n+u-l+o;if(s=this.finiteLinesIntersect(e,t,r,n,E,S,P,k,!1),s.length>0)return s;var C,D=r-c+l,N=n-u+l;if(C=this.intersectLineCircle(e,t,r,n,D,N,l+o),C.length>0&&C[0]<=D&&C[1]<=N)return[C[0],C[1]];var M=r+c-l,T=n-u+l;if(C=this.intersectLineCircle(e,t,r,n,M,T,l+o),C.length>0&&C[0]>=M&&C[1]<=T)return[C[0],C[1]];var z=r+c-l,I=n+u-l;if(C=this.intersectLineCircle(e,t,r,n,z,I,l+o),C.length>0&&C[0]>=z&&C[1]>=I)return[C[0],C[1]];var B=r-c+l,R=n+u-l;return C=this.intersectLineCircle(e,t,r,n,B,R,l+o),C.length>0&&C[0]<=B&&C[1]>=R?[C[0],C[1]]:[]},e.math.roundRectangleIntersectBox=function(e,t,r,n,i,a,o,s,l){var c=this.getRoundRectangleRadius(i,a),u=o-i/2-l,d=s-a/2+c-l,p=o+i/2+l,h=s+a/2-c+l,g=o-i/2+c-l,v=s-a/2-l,f=o+i/2-c+l,y=s+a/2+l,m=Math.min(e,r),b=Math.max(e,r),x=Math.min(t,n),w=Math.max(t,n);return u>b?!1:m>p?!1:v>w?!1:x>y?!1:u>=m&&b>=u&&d>=x&&w>=d?!0:p>=m&&b>=p&&d>=x&&w>=d?!0:p>=m&&b>=p&&h>=x&&w>=h?!0:u>=m&&b>=u&&h>=x&&w>=h?!0:m>=u&&p>=m&&x>=d&&h>=x?!0:b>=u&&p>=b&&x>=d&&h>=x?!0:b>=u&&p>=b&&w>=d&&h>=w?!0:m>=u&&p>=m&&w>=d&&h>=w?!0:g>=m&&b>=g&&v>=x&&w>=v?!0:f>=m&&b>=f&&v>=x&&w>=v?!0:f>=m&&b>=f&&y>=x&&w>=y?!0:g>=m&&b>=g&&y>=x&&w>=y?!0:m>=g&&f>=m&&x>=v&&y>=x?!0:b>=g&&f>=b&&x>=v&&y>=x?!0:b>=g&&f>=b&&w>=v&&y>=w?!0:m>=g&&f>=m&&w>=v&&y>=w?!0:this.boxIntersectEllipse(m,x,b,w,l,2*c,2*c,g+l,d+l)?!0:this.boxIntersectEllipse(m,x,b,w,l,2*c,2*c,f-l,d+l)?!0:this.boxIntersectEllipse(m,x,b,w,l,2*c,2*c,f-l,h-l)?!0:this.boxIntersectEllipse(m,x,b,w,l,2*c,2*c,g+l,h-l)?!0:!1},e.math.checkInBoundingCircle=function(e,t,r,n,i,a,o,s){return e=(e-o)/(i+n),t=(t-s)/(a+n),r>=e*e+t*t},e.math.checkInBoundingBox=function(e,t,r,n,i,a,o,s){for(var l=r[0],c=r[1],u=r[0],d=r[1],p=1;p<r.length/2;p++)r[2*p]<l?l=r[2*p]:r[2*p]>u&&(u=r[2*p]),r[2*p+1]<c?c=r[2*p+1]:r[2*p+1]>d&&(d=r[2*p+1]);return e-=o,t-=s,e/=i,t/=a,l>e?!1:e>u?!1:c>t?!1:t>d?!1:!0},e.math.boxInBezierVicinity=function(e,t,r,n,i,a,o,s,l,c,u){var d=.25*i+.5*o+.25*l,p=.25*a+.5*s+.25*c,h=Math.min(e,r)-u,g=Math.min(t,n)-u,v=Math.max(e,r)+u,f=Math.max(t,n)+u;if(i>=h&&v>=i&&a>=g&&f>=a)return 1;if(l>=h&&v>=l&&c>=g&&f>=c)return 1;if(d>=h&&v>=d&&p>=g&&f>=p)return 1;if(o>=h&&v>=o&&s>=g&&f>=s)return 1;var y=Math.min(i,d,l),m=Math.min(a,p,c),b=Math.max(i,d,l),x=Math.max(a,p,c);return y>v||h>b||m>f||g>x?0:1},e.math.checkBezierInBox=function(t,r,n,i,a,o,s,l,c,u){function d(d){var p=e.math.qbezierAt(a,s,c,d),h=e.math.qbezierAt(o,l,u,d);return p>=t&&n>=p&&h>=r&&i>=h}for(var p=0;1>=p;p+=.25)if(!d(p))return!1;return!0},e.math.checkStraightEdgeInBox=function(e,t,r,n,i,a,o,s){return i>=e&&r>=i&&o>=e&&r>=o&&a>=t&&n>=a&&s>=t&&n>=s},e.math.checkStraightEdgeCrossesBox=function(e,t,r,n,i,a,o,s,l){var c,u,d=Math.min(e,r)-l,p=Math.min(t,n)-l,h=Math.max(e,r)+l,g=Math.max(t,n)+l,v=o-i,f=i,y=s-a,m=a;if(Math.abs(v)<1e-4)return i>=d&&h>=i&&Math.min(a,s)<=p&&Math.max(a,s)>=g;var b=(d-f)/v;if(b>0&&1>=b&&(c=y*b+m,c>=p&&g>=c))return!0;var x=(h-f)/v;if(x>0&&1>=x&&(c=y*x+m,c>=p&&g>=c))return!0;var w=(p-m)/y;if(w>0&&1>=w&&(u=v*w+f,u>=d&&h>=u))return!0;var _=(g-m)/y;return _>0&&1>=_&&(u=v*_+f,u>=d&&h>=u)?!0:!1},e.math.checkBezierCrossesBox=function(e,t,r,n,i,a,o,s,l,c,u){var d=Math.min(e,r)-u,p=Math.min(t,n)-u,h=Math.max(e,r)+u,g=Math.max(t,n)+u;if(i>=d&&h>=i&&a>=p&&g>=a)return!0;if(l>=d&&h>=l&&c>=p&&g>=c)return!0;var v=i-2*o+l,f=-2*i+2*o,y=i,m=[];if(Math.abs(v)<1e-4){var b=(d-i)/f,x=(h-i)/f;m.push(b,x)}else{var w,_,E=f*f-4*v*(y-d);if(E>0){var S=Math.sqrt(E);w=(-f+S)/(2*v),_=(-f-S)/(2*v),m.push(w,_)}var P,k,C=f*f-4*v*(y-h);if(C>0){var S=Math.sqrt(C);P=(-f+S)/(2*v),k=(-f-S)/(2*v),m.push(P,k)}}m.sort(function(e,t){return e-t});var D=a-2*s+c,N=-2*a+2*s,M=a,T=[];if(Math.abs(D)<1e-4){var z=(p-a)/N,I=(g-a)/N;T.push(z,I)}else{var B,R,X=N*N-4*D*(M-p);if(X>0){var S=Math.sqrt(X);B=(-N+S)/(2*D),R=(-N-S)/(2*D),T.push(B,R)}var O,L,Y=N*N-4*D*(M-g);if(Y>0){var S=Math.sqrt(Y);O=(-N+S)/(2*D),L=(-N-S)/(2*D),T.push(O,L)}}T.sort(function(e,t){return e-t});for(var V=0;V<m.length;V+=2)for(var A=1;A<T.length;A+=2)if(m[V]<T[A]&&T[A]>=0&&m[V]<=1&&m[V+1]>T[A-1]&&T[A-1]<=1&&m[V+1]>=0)return!0;return!1},e.math.inLineVicinity=function(e,t,r,n,i,a,o){var s=o,l=Math.min(r,i),c=Math.max(r,i),u=Math.min(n,a),d=Math.max(n,a);return e>=l-s&&c+s>=e&&t>=u-s&&d+s>=t},e.math.inBezierVicinity=function(e,t,r,n,i,a,o,s){var l={x1:Math.min(r,o,i),x2:Math.max(r,o,i),y1:Math.min(n,s,a),y2:Math.max(n,s,a)};return e<l.x1||e>l.x2||t<l.y1||t>l.y2?!1:!0},e.math.solveCubic=function(e,t,r,n,i){t/=e,r/=e,n/=e;var a,o,s,l,c,u,d,p;return o=(3*r-t*t)/9,s=-(27*n)+t*(9*r-2*t*t),s/=54,a=o*o*o+s*s,i[1]=0,d=t/3,a>0?(c=s+Math.sqrt(a),c=0>c?-Math.pow(-c,1/3):Math.pow(c,1/3),u=s-Math.sqrt(a),u=0>u?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-d+c+u,d+=(c+u)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-u+c)/2,i[3]=d,void(i[5]=-d)):(i[5]=i[3]=0,0===a?(p=0>s?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=-d+2*p,void(i[4]=i[2]=-(p+d))):(o=-o,l=o*o*o,l=Math.acos(s/Math.sqrt(l)),p=2*Math.sqrt(o),i[0]=-d+p*Math.cos(l/3),i[2]=-d+p*Math.cos((l+2*Math.PI)/3),void(i[4]=-d+p*Math.cos((l+4*Math.PI)/3))))},e.math.sqDistanceToQuadraticBezier=function(e,t,r,n,i,a,o,s){var l=1*r*r-4*r*i+2*r*o+4*i*i-4*i*o+o*o+n*n-4*n*a+2*n*s+4*a*a-4*a*s+s*s,c=9*r*i-3*r*r-3*r*o-6*i*i+3*i*o+9*n*a-3*n*n-3*n*s-6*a*a+3*a*s,u=3*r*r-6*r*i+r*o-r*e+2*i*i+2*i*e-o*e+3*n*n-6*n*a+n*s-n*t+2*a*a+2*a*t-s*t,d=1*r*i-r*r+r*e-i*e+n*a-n*n+n*t-a*t,p=[];this.solveCubic(l,c,u,d,p);for(var h=1e-7,g=[],v=0;6>v;v+=2)Math.abs(p[v+1])<h&&p[v]>=0&&p[v]<=1&&g.push(p[v]);g.push(1),g.push(0);for(var f,y,m,b,x=-1,w=0;w<g.length;w++)y=Math.pow(1-g[w],2)*r+2*(1-g[w])*g[w]*i+g[w]*g[w]*o,m=Math.pow(1-g[w],2)*n+2*(1-g[w])*g[w]*a+g[w]*g[w]*s,b=Math.pow(y-e,2)+Math.pow(m-t,2),x>=0?x>b&&(x=b,f=g[w]):(x=b,f=g[w]);return x},e.math.sqDistanceToFiniteLine=function(e,t,r,n,i,a){var o=[e-r,t-n],s=[i-r,a-n],l=s[0]*s[0]+s[1]*s[1],c=o[0]*o[0]+o[1]*o[1],u=o[0]*s[0]+o[1]*s[1],d=u*u/l;return 0>u?c:d>l?(e-i)*(e-i)+(t-a)*(t-a):c-d},e.math.pointInsidePolygon=function(e,t,r,n,i,a,o,s,l){var c=new Array(r.length),u=Math.asin(s[1]/Math.sqrt(s[0]*s[0]+s[1]*s[1]));s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2;for(var d=Math.cos(-u),p=Math.sin(-u),h=0;h<c.length/2;h++)c[2*h]=a/2*(r[2*h]*d-r[2*h+1]*p),c[2*h+1]=o/2*(r[2*h+1]*d+r[2*h]*p),c[2*h]+=n,c[2*h+1]+=i;var g;if(l>0){var v=this.expandPolygon(c,-l);g=this.joinLines(v)}else g=c;for(var f,y,m,b,x,w=0,_=0,h=0;h<g.length/2;h++)if(f=g[2*h],y=g[2*h+1],h+1<g.length/2?(m=g[2*(h+1)],b=g[2*(h+1)+1]):(m=g[2*(h+1-g.length/2)],b=g[2*(h+1-g.length/2)+1]),f==e&&m==e);else{if(!(f>=e&&e>=m||e>=f&&m>=e))continue;x=(e-f)/(m-f)*(b-y)+y,x>t&&w++,t>x&&_++}return w%2===0?!1:!0},e.math.joinLines=function(e){for(var t,r,n,i,a,o,s,l,c=new Array(e.length/2),u=0;u<e.length/4;u++){t=e[4*u],r=e[4*u+1],n=e[4*u+2],i=e[4*u+3],u<e.length/4-1?(a=e[4*(u+1)],o=e[4*(u+1)+1],s=e[4*(u+1)+2],l=e[4*(u+1)+3]):(a=e[0],o=e[1],s=e[2],l=e[3]);var d=this.finiteLinesIntersect(t,r,n,i,a,o,s,l,!0);c[2*u]=d[0],c[2*u+1]=d[1]}return c},e.math.expandPolygon=function(e,t){for(var r,n,i,a,o=new Array(2*e.length),s=0;s<e.length/2;s++){r=e[2*s],n=e[2*s+1],s<e.length/2-1?(i=e[2*(s+1)],a=e[2*(s+1)+1]):(i=e[0],a=e[1]);var l=a-n,c=-(i-r),u=Math.sqrt(l*l+c*c),d=l/u,p=c/u;o[4*s]=r+d*t,o[4*s+1]=n+p*t,o[4*s+2]=i+d*t,o[4*s+3]=a+p*t}return o},e.math.intersectLineEllipse=function(e,t,r,n,i,a){var o=r-e,s=n-t;o/=i,s/=a;var l=Math.sqrt(o*o+s*s),c=l-1;if(0>c)return[];var u=c/l;return[(r-e)*u+e,(n-t)*u+t]},e.math.dotProduct=function(e,t){if(2!=e.length||2!=t.length)throw"dot product: arguments are not vectors";return e[0]*t[0]+e[1]*t[1]},e.math.intersectLineCircle=function(e,t,r,n,i,a,o){var s=[r-e,n-t],l=[i,a],c=[e-i,t-a],u=s[0]*s[0]+s[1]*s[1],d=2*(c[0]*s[0]+c[1]*s[1]),l=c[0]*c[0]+c[1]*c[1]-o*o,p=d*d-4*u*l;if(0>p)return[];var h=(-d+Math.sqrt(p))/(2*u),g=(-d-Math.sqrt(p))/(2*u),v=Math.min(h,g),f=Math.max(h,g),y=[];if(v>=0&&1>=v&&y.push(v),f>=0&&1>=f&&y.push(f),0===y.length)return[];var m=y[0]*s[0]+e,b=y[0]*s[1]+t;if(y.length>1){if(y[0]==y[1])return[m,b];var x=y[1]*s[0]+e,w=y[1]*s[1]+t;return[m,b,x,w]}return[m,b]},e.math.findCircleNearPoint=function(e,t,r,n,i){var a=n-e,o=i-t,s=Math.sqrt(a*a+o*o),l=a/s,c=o/s;return[e+l*r,t+c*r]},e.math.findMaxSqDistanceToOrigin=function(e){for(var t,r=1e-6,n=0;n<e.length/2;n++)t=e[2*n]*e[2*n]+e[2*n+1]*e[2*n+1],t>r&&(r=t);return r},e.math.finiteLinesIntersect=function(e,t,r,n,i,a,o,s,l){var c=(o-i)*(t-a)-(s-a)*(e-i),u=(r-e)*(t-a)-(n-t)*(e-i),d=(s-a)*(r-e)-(o-i)*(n-t);if(0!==d){var p=c/d,h=u/d;return p>=0&&1>=p&&h>=0&&1>=h?[e+p*(r-e),t+p*(n-t)]:l?[e+p*(r-e),t+p*(n-t)]:[]}return 0===c||0===u?[e,r,o].sort()[1]===o?[o,s]:[e,r,i].sort()[1]===i?[i,a]:[i,o,r].sort()[1]===r?[r,n]:[]:[]},e.math.boxIntersectEllipse=function(e,t,r,n,i,a,o,s,l){if(e>r){var c=e;e=r,r=c}if(t>n){var u=t;t=n,n=u}var d=[s-a/2-i,l],p=[s+a/2+i,l],h=[s,l-o/2-i],g=[s,l+o/2+i];return r<d[0]?!1:e>p[0]?!1:t>g[1]?!1:n<h[1]?!1:e<=p[0]&&p[0]<=r&&t<=p[1]&&p[1]<=n?!0:e<=d[0]&&d[0]<=r&&t<=d[1]&&d[1]<=n?!0:e<=h[0]&&h[0]<=r&&t<=h[1]&&h[1]<=n?!0:e<=g[0]&&g[0]<=r&&t<=g[1]&&g[1]<=n?!0:(e=(e-s)/(a/2+i),r=(r-s)/(a/2+i),t=(t-l)/(o/2+i),n=(n-l)/(o/2+i),1>=e*e+t*t?!0:1>=r*r+t*t?!0:1>=r*r+n*n?!0:1>=e*e+n*n?!0:!1)},e.math.boxIntersectPolygon=function(t,r,n,i,a,o,s,l,c,u,d){if(t>n){var p=t;t=n,n=p}if(r>i){var h=r;r=i,i=h}var g=new Array(a.length),v=Math.asin(u[1]/Math.sqrt(u[0]*u[0]+u[1]*u[1]));u[0]<0?v+=Math.PI/2:v=-v-Math.PI/2;for(var f=Math.cos(-v),y=Math.sin(-v),m=0;m<g.length/2;m++)g[2*m]=o/2*(a[2*m]*f-a[2*m+1]*y),g[2*m+1]=s/2*(a[2*m+1]*f+a[2*m]*y),g[2*m]+=l,g[2*m+1]+=c;for(var b=g[0],x=g[0],w=g[1],_=g[1],m=1;m<g.length/2;m++)g[2*m]>x&&(x=g[2*m]),g[2*m]<b&&(b=g[2*m]),g[2*m+1]>_&&(_=g[2*m+1]),g[2*m+1]<w&&(w=g[2*m+1]);if(b-d>n)return!1;if(t>x+d)return!1;if(w-d>i)return!1;if(r>_+d)return!1;var E;if(d>0){var S=e.math.expandPolygon(g,-d);E=e.math.joinLines(S)}else E=g;for(var m=0;m<g.length/2;m++)if(t<=g[2*m]&&g[2*m]<=n&&r<=g[2*m+1]&&g[2*m+1]<=i)return!0;for(var m=0;m<E.length/2;m++){var P,k,C=E[2*m],D=E[2*m+1];if(m<E.length/2-1?(P=E[2*(m+1)],k=E[2*(m+1)+1]):(P=E[0],k=E[1]),e.math.finiteLinesIntersect(C,D,P,k,t,r,n,r,!1).length>0)return!0;if(e.math.finiteLinesIntersect(C,D,P,k,t,i,n,i,!1).length>0)return!0;if(e.math.finiteLinesIntersect(C,D,P,k,t,r,t,i,!1).length>0)return!0;if(e.math.finiteLinesIntersect(C,D,P,k,n,r,n,i,!1).length>0)return!0}return!1},e.math.polygonIntersectLine=function(t,r,n,i,a,o,s,l){for(var c,u=[],d=new Array(n.length),p=0;p<d.length/2;p++)d[2*p]=n[2*p]*o+i,d[2*p+1]=n[2*p+1]*s+a;var h;if(l>0){var g=e.math.expandPolygon(d,-l);h=e.math.joinLines(g)}else h=d;for(var v,f,y,m,p=0;p<h.length/2;p++)v=h[2*p],f=h[2*p+1],p<h.length/2-1?(y=h[2*(p+1)],m=h[2*(p+1)+1]):(y=h[0],m=h[1]),c=this.finiteLinesIntersect(t,r,i,a,v,f,y,m),0!==c.length&&u.push(c[0],c[1]);return u},e.math.shortenIntersection=function(e,t,r){var n=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),a=(i-r)/i;return 0>a&&(a=1e-5),[t[0]+a*n[0],t[1]+a*n[1]]},e.math.generateUnitNgonPointsFitToSquare=function(t,r){var n=e.math.generateUnitNgonPoints(t,r);return n=e.math.fitPolygonToSquare(n)},e.math.fitPolygonToSquare=function(e){for(var t,r,n=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;n>l;l++)t=e[2*l],r=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,r),s=Math.max(s,r);for(var c=2/(o-i),u=2/(s-a),l=0;n>l;l++)t=e[2*l]=e[2*l]*c,r=e[2*l+1]=e[2*l+1]*u,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,r),s=Math.max(s,r);if(-1>a)for(var l=0;n>l;l++)r=e[2*l+1]=e[2*l+1]+(-1-a);return e},e.math.generateUnitNgonPoints=function(e,t){var r=1/e*2*Math.PI,n=e%2===0?Math.PI/2+r/2:Math.PI/2;n+=t;for(var i,a,o,s=new Array(2*e),l=0;e>l;l++)i=l*r+n,a=s[2*l]=Math.cos(i),o=s[2*l+1]=Math.sin(-i);return s},e.math.getRoundRectangleRadius=function(e,t){return Math.min(e/4,t/4,8)}}(cytoscape),function(e){"use strict";function t(t,r,n){var i={};switch(i[r]=n,t){case"core":case"collection":e.fn[t](i)}return e.util.setMap({map:a,keys:[t,r],value:n})}function r(t,r){return e.util.getMap({map:a,keys:[t,r]})}function n(t,r,n,i,a){return e.util.setMap({map:o,keys:[t,r,n,i],value:a})}function i(t,r,n,i){return e.util.getMap({map:o,keys:[t,r,n,i]})}var a={};e.extensions=a;var o={};e.modules=o,e.extension=function(){return 2==arguments.length?r.apply(this,arguments):3==arguments.length?t.apply(this,arguments):4==arguments.length?i.apply(this,arguments):5==arguments.length?n.apply(this,arguments):void $.error("Invalid extension access syntax")}}(cytoscape),function(e,t){"use strict";if(e){var r=function(e){var t=e[0]._jqcy=e[0]._jqcy||{};return t};e.fn.cytoscape=function(n){var i=e(this);if("get"===n)return r(i).cy;if(!t.is.fn(n)){if(t.is.plainObject(n))return i.each(function(){var t=e.extend({},n,{container:e(this)[0]});cytoscape(t)});for(var a=[],o=[],s=1;s<arguments.length;s++)o[s-1]=arguments[s];return i.each(function(){var i=e(this),s=r(i).cy,l=n;if(s&&t.is.fn(s[l])){var c=s[l].apply(s,o);a.push(c)}}),1===a.length?a=a[0]:0===a.length&&(a=e(this)),a}var l=n,c=r(i).cy;if(c&&c.ready())c.trigger("ready",[],l);else{var u=r(i),d=u.readies=u.readies||[];d.push(l)}},e.cytoscape=cytoscape,null==e.fn.cy&&null==e.cy&&(e.fn.cy=e.fn.cytoscape,e.cy=e.cytoscape)}}("undefined"!=typeof jQuery?jQuery:null,cytoscape),function(e){"use strict";function t(){return!1}function r(){return!0}e.Event=function(n,i){return this instanceof e.Event?(n&&n.type?(this.originalEvent=n,this.type=n.type,this.isDefaultPrevented=n.defaultPrevented||n.getPreventDefault&&n.getPreventDefault()?r:t):this.type=n,i&&e.util.extend(this,i),void(this.timeStamp=n&&n.timeStamp||+new Date)):new e.Event(n,i)},e.Event.prototype={preventDefault:function(){this.isDefaultPrevented=r;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=r;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=r,this.stopPropagation()},isDefaultPrevented:t,isPropagationStopped:t,isImmediatePropagationStopped:t}}(cytoscape),function(e){"use strict";e.define={data:function(t){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,onSet:function(){},canSet:function(){return!0}};return t=e.util.extend({},r,t),function(r,n){var i=t,a=this,o=void 0!==a.length,s=o?a:[a],l=o?a[0]:a;if(e.is.string(r)){if(i.allowGetting&&void 0===n){var c;return l&&(c=l._private[i.field][r]),c}if(i.allowSetting&&void 0!==n){var u=!i.immutableKeys[r];if(u){for(var d=0,p=s.length;p>d;d++)i.canSet(s[d])&&(s[d]._private[i.field][r]=n);i.updateStyle&&a.updateStyle(),i.onSet(a),i.settingTriggersEvent&&a[i.triggerFnName](i.settingEvent)}}}else if(i.allowSetting&&e.is.plainObject(r)){var h,g,v=r;for(h in v){g=v[h];var u=!i.immutableKeys[h];if(u)for(var d=0,p=s.length;p>d;d++)i.canSet(s[d])&&(s[d]._private[i.field][h]=g)}i.updateStyle&&a.updateStyle(),i.onSet(a),i.settingTriggersEvent&&a[i.triggerFnName](i.settingEvent)}else if(i.allowBinding&&e.is.fn(r)){var f=r;a.bind(i.bindingEvent,f)}else if(i.allowGetting&&void 0===r){var c;return l&&(c=l._private[i.field]),c}return a}},batchData:function(t){var r={field:"data",event:"data",triggerFnName:"trigger",immutableKeys:{},updateStyle:!1},n=e.util.extend({},r,t);return function(t){var r=this,i=void 0!==r.length,a=i?r:r._private.elements;if(0===a.length)return r;for(var o=i?a[0]._private.cy:r,s=0;s<a.length;s++){var l=a[s],c=l._private.data.id,u=t[c];if(void 0!==u&&null!==u){var d,p,h=u;for(d in h){p=h[d];var g=!n.immutableKeys[d];g&&(l._private[n.field][d]=p)}}}var v=new e.Collection(o,a);return n.updateStyle&&v.updateStyle(),v[n.triggerFnName](n.event),r}},removeData:function(t){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return t=e.util.extend({},r,t),function(r){var n=t,i=this,a=void 0!==i.length,o=a?i:[i];if(e.is.string(r)){for(var s=r.split(/\s+/),l=s.length,c=0;l>c;c++){var u=s[c];if(!e.is.emptyString(u)){var d=!n.immutableKeys[u];if(d)for(var p=0,h=o.length;h>p;p++)delete o[p]._private[n.field][u]}}n.triggerEvent&&i[n.triggerFnName](n.event)}else if(void 0===r){for(var p=0,h=o.length;h>p;p++){var g=o[p]._private[n.field];for(var u in g){var v=!n.immutableKeys[u];v&&delete g[u]}}n.triggerEvent&&i[n.triggerFnName](n.event)}return i}},event:{regex:/(\w+)(\.\w+)?/,optionalTypeRegex:/(\w+)?(\.\w+)?/,falseCallback:function(){return!1}},on:function(t){var r={unbindSelfOnTrigger:!1,unbindAllBindersOnTrigger:!1};return t=e.util.extend({},r,t),function(r,n,i,a){var o=this,s=void 0!==o.length,l=s?o:[o],c=e.is.string(r),u=t;if(e.is.plainObject(n)?(a=i,i=n,n=void 0):(e.is.fn(n)||n===!1)&&(a=n,i=void 0,n=void 0),(e.is.fn(i)||i===!1)&&(a=i,i=void 0),!e.is.fn(a)&&a!==!1&&c)return o;if(c){var d={};d[r]=a,r=d}for(var p in r)if(a=r[p],a===!1&&(a=e.define.event.falseCallback),e.is.fn(a)){p=p.split(/\s+/);for(var h=0;h<p.length;h++){var g=p[h];if(!e.is.emptyString(g)){var v=g.match(e.define.event.regex);if(v)for(var f=v[1],y=v[2]?v[2]:void 0,m={callback:a,data:i,delegated:n?!0:!1,selector:n,selObj:new e.Selector(n),type:f,namespace:y,unbindSelfOnTrigger:u.unbindSelfOnTrigger,unbindAllBindersOnTrigger:u.unbindAllBindersOnTrigger,binders:l},b=0;b<l.length;b++)l[b]._private.listeners.push(m)}}}return o}},off:function(t){var r={};return t=e.util.extend({},r,t),function(t,r,n){var i=this,a=void 0!==i.length,o=a?i:[i],s=e.is.string(t);if(0===arguments.length){for(var l=0;l<o.length;l++)o[l]._private.listeners=[];return i}if((e.is.fn(r)||r===!1)&&(n=r,r=void 0),s){var c={};c[t]=n,t=c}for(var u in t){n=t[u],n===!1&&(n=e.define.event.falseCallback),u=u.split(/\s+/);for(var d=0;d<u.length;d++){var p=u[d];if(!e.is.emptyString(p)){var h=p.match(e.define.event.optionalTypeRegex);if(h)for(var g=h[1]?h[1]:void 0,v=h[2]?h[2]:void 0,l=0;l<o.length;l++)for(var f=o[l]._private.listeners,y=0;y<f.length;y++){var m=f[y],b=!v||v===m.namespace,x=!g||m.type===g,w=!n||n===m.callback,_=b&&x&&w;_&&(f.splice(y,1),y--)}}}}return i}},trigger:function(t){var r={};return t=e.util.extend({},r,t),function(t,r,n){var i=this,a=void 0!==i.length,o=a?i:[i],s=e.is.string(t),l=e.is.plainObject(t),c=e.is.event(t),u=this._private.cy||this;if(s){var d=t.split(/\s+/);t=[];for(var p=0;p<d.length;p++){var h=d[p];if(!e.is.emptyString(h)){var g=h.match(e.define.event.regex),v=g[1],f=g[2]?g[2]:void 0;t.push({type:v,namespace:f})}}}else if(l){var y=t;t=[y]}r?e.is.array(r)||(r=[r]):r=[];for(var p=0;p<t.length;p++)for(var m=t[p],b=0;b<o.length;b++){var h,x=o[b],w=x._private.listeners,_=e.is.element(x),E=_;if(c?(h=m,h.cyTarget=h.cyTarget||x,h.cy=h.cy||u,h.namespace=h.namespace||m.namespace):h=new e.Event(m,{cyTarget:x,cy:u,namespace:m.namespace}),h.cyPosition){var S=h.cyPosition,P=u.zoom(),k=u.pan();h.cyRenderedPosition={x:S.x*P+k.x,y:S.y*P+k.y}}n&&(w=[{namespace:h.namespace,type:h.type,callback:n}]);for(var C=0;C<w.length;C++){var D=w[C],N=!D.namespace||D.namespace===h.namespace,M=D.type===h.type,T=D.delegated?x!==h.cyTarget&&e.is.element(h.cyTarget)&&D.selObj.filter(h.cyTarget).length>0:!0,z=N&&M&&T;if(z){var I=[h];if(I=I.concat(r),h.data=D.data?D.data:void 0,(D.unbindSelfOnTrigger||D.unbindAllBindersOnTrigger)&&(w.splice(C,1),C--),D.unbindAllBindersOnTrigger)for(var B=D.binders,R=0;R<B.length;R++){var X=B[R];if(X&&X!==x)for(var O=X._private.listeners,L=0;L<O.length;L++){var Y=O[L];Y===D&&(O.splice(L,1),L--)}}var V=D.delegated?h.cyTarget:x,A=D.callback.apply(V,I);(A===!1||h.isPropagationStopped())&&(E=!1,A===!1&&(h.stopPropagation(),h.preventDefault()))}}if(E){var F=x.parent(),q=0!==F.length;q?(F=F[0],F.trigger(h)):u.trigger(h)}}return i}}}}(cytoscape),function(e){"use strict";e.fn.selector=function(t){for(var r in t){var n=t[r];e.Selector.prototype[r]=n}},e.Selector=function(t,r){if(!(this instanceof e.Selector))return new e.Selector(t,r);void 0===r&&void 0!==t&&(r=t,t=void 0);var n=this;if(n._private={selectorText:null,invalid:!0},!r||e.is.string(r)&&r.match(/^\s*$/))null==t?n.length=0:(n[0]=o(),n[0].group=t,n.length=1);else if(e.is.element(r)){var i=new e.Collection(n.cy(),[r]);n[0]=o(),n[0].collection=i,n.length=1
}else if(e.is.collection(r))n[0]=o(),n[0].collection=r,n.length=1;else if(e.is.fn(r))n[0]=o(),n[0].filter=r,n.length=1;else{if(!e.is.string(r))return void e.util.error("A selector must be created from a string; found "+r);var a=null,o=function(){return{classes:[],colonSelectors:[],data:[],group:null,ids:[],meta:[],collection:null,filter:null,parent:null,ancestor:null,subject:null,child:null,descendant:null}},s={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:'"(?:\\\\"|[^"])+"|'+"'(?:\\\\'|[^'])+'",number:e.util.regex.number,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$"};s.variable="(?:[\\w-]|(?:\\\\"+s.metaChar+"))+",s.value=s.string+"|"+s.number,s.className=s.variable,s.id=s.variable;for(var l=function(e){return e.replace(new RegExp("\\\\("+s.metaChar+")","g"),function(e,t){return t})},c=s.comparatorOp.split("|"),u=0;u<c.length;u++){var d=c[u];s.comparatorOp+="|@"+d}var p={group:{query:!0,regex:"(node|edge|\\*)",populate:function(e){this.group="*"==e?e:e+"s"}},state:{query:!0,regex:"(:selected|:unselected|:locked|:unlocked|:visible|:hidden|:transparent|:grabbed|:free|:removed|:inside|:grabbable|:ungrabbable|:animated|:unanimated|:selectable|:unselectable|:parent|:child|:loop|:simple|:active|:inactive|:touch)",populate:function(e){this.colonSelectors.push(e)}},id:{query:!0,regex:"\\#("+s.id+")",populate:function(e){this.ids.push(l(e))}},className:{query:!0,regex:"\\.("+s.className+")",populate:function(e){this.classes.push(l(e))}},dataExists:{query:!0,regex:"\\[\\s*("+s.variable+")\\s*\\]",populate:function(e){this.data.push({field:l(e)})}},dataCompare:{query:!0,regex:"\\[\\s*("+s.variable+")\\s*("+s.comparatorOp+")\\s*("+s.value+")\\s*\\]",populate:function(e,t,r){var n=null!=new RegExp("^"+s.string+"$").exec(r);r=n?r.substring(1,r.length-1):parseFloat(r),this.data.push({field:l(e),operator:t,value:r})}},dataBool:{query:!0,regex:"\\[\\s*("+s.boolOp+")\\s*("+s.variable+")\\s*\\]",populate:function(e,t){this.data.push({field:l(t),operator:e})}},metaCompare:{query:!0,regex:"\\[\\[\\s*("+s.meta+")\\s*("+s.comparatorOp+")\\s*("+s.number+")\\s*\\]\\]",populate:function(e,t,r){this.meta.push({field:l(e),operator:t,value:parseFloat(r)})}},nextQuery:{separator:!0,regex:s.separator,populate:function(){n[++u]=o(),a=null}},child:{separator:!0,regex:s.child,populate:function(){var e=o();e.parent=this,e.subject=a,n[u]=e}},descendant:{separator:!0,regex:s.descendant,populate:function(){var e=o();e.ancestor=this,e.subject=a,n[u]=e}},subject:{modifier:!0,regex:s.subject,populate:function(){return null!=a&&this.subject!=this?(e.util.error("Redefinition of subject in selector `"+r+"`"),!1):(a=this,void(this.subject=this))}}},h=0;for(var g in p)p[h]=p[g],p[h].name=g,h++;p.length=h,n._private.selectorText=r;var v=r,u=0,f=function(t){for(var r,n,i,a=0;a<p.length;a++){var o=p[a],s=o.name;if(!e.is.fn(t)||t(s,o)){var l=v.match(new RegExp("^"+o.regex));if(null!=l){n=l,r=o,i=s;var c=l[0];v=v.substring(c.length);break}}}return{expr:r,match:n,name:i}},y=function(){var e=v.match(/^\s+/);if(e){var t=e[0];v=v.substring(t.length)}};for(n[0]=o(),y();;){var m=f();if(null==m.expr)return void e.util.error("The selector `"+r+"`is invalid");for(var b=[],h=1;h<m.match.length;h++)b.push(m.match[h]);var x=m.expr.populate.apply(n[u],b);if(x===!1)return;if(v.match(/^\s*$/))break}for(n.length=u+1,h=0;h<n.length;h++){var w=n[h];if(null!=w.subject){for(;w.subject!=w;)if(null!=w.parent){var _=w.parent,E=w;E.parent=null,_.child=E,w=_}else{if(null==w.ancestor){e.util.error("When adjusting references for the selector `"+w+"`, neither parent nor ancestor was found");break}var S=w.ancestor,P=w;P.ancestor=null,S.descendant=P,w=S}n[h]=w.subject}}if(null!=t)for(var h=0;h<n.length;h++){if(null!=n[h].group&&n[h].group!=t)return void e.util.error("Group `"+n[h].group+"` conflicts with implicit group `"+t+"` in selector `"+r+"`");n[h].group=t}}n._private.invalid=!1},e.selfn=e.Selector.prototype,e.selfn.size=function(){return this.length},e.selfn.eq=function(e){return this[e]},e.selfn.find=function(){},e.selfn.filter=function(t){var r=this,n=t.cy();if(r._private.invalid)return new e.Collection(n);var i=function(t,r){if(null!=t.group&&"*"!=t.group&&t.group!=r._private.group)return!1;for(var n=!0,a=0;a<t.colonSelectors.length;a++){var o=t.colonSelectors[a];switch(o){case":selected":n=r.selected();break;case":unselected":n=!r.selected();break;case":selectable":n=r.selectable();break;case":unselectable":n=!r.selectable();break;case":locked":n=r.locked();break;case":unlocked":n=!r.locked();break;case":visible":n=r.visible();break;case":hidden":n=!r.visible();break;case":transparent":n=r.transparent();break;case":grabbed":n=r.grabbed();break;case":free":n=!r.grabbed();break;case":removed":n=r.removed();break;case":inside":n=!r.removed();break;case":grabbable":n=r.grabbable();break;case":ungrabbable":n=!r.grabbable();break;case":animated":n=r.animated();break;case":unanimated":n=!r.animated();break;case":parent":n=r.children().nonempty();break;case":child":n=r.parent().nonempty();break;case":loop":n=r.isEdge()&&r.data("source")===r.data("target");break;case":simple":n=r.isEdge()&&r.data("source")!==r.data("target");break;case":active":n=r.active();break;case":inactive":n=!r.active();break;case":touch":n=window&&document&&("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}if(!n)break}if(!n)return!1;for(var s=!0,a=0;a<t.ids.length;a++){var l=t.ids[a],c=r._private.data.id;if(s=s&&l==c,!s)break}if(!s)return!1;for(var u=!0,a=0;a<t.classes.length;a++){var d=t.classes[a];if(u=u&&r.hasClass(d),!u)break}if(!u)return!1;var p=function(r){for(var n=!0,i=0;i<t[r.name].length;i++){var a,o=t[r.name][i],s=o.operator,l=o.value,c=o.field;if(null!=s&&null!=l){var u=r.fieldValue(c),d=e.is.string(u)||e.is.number(u)?""+u:"",p=""+l,h=!1;switch("@"==s.charAt(0)&&(d=d.toLowerCase(),p=p.toLowerCase(),s=s.substring(1),h=!0),h&&(l=p.toLowerCase(),u=d.toLowerCase()),s){case"*=":a=d.search(p)>=0;break;case"$=":a=null!=new RegExp(p+"$").exec(d);break;case"^=":a=null!=new RegExp("^"+p).exec(d);break;case"=":a=u===l;break;case"!=":a=u!==l;break;case">":a=u>l;break;case">=":a=u>=l;break;case"<":a=l>u;break;case"<=":a=l>=u;break;default:a=!1}}else if(null!=s)switch(s){case"?":a=r.fieldTruthy(c);break;case"!":a=!r.fieldTruthy(c);break;case"^":a=r.fieldUndefined(c)}else a=!r.fieldUndefined(c);if(!a){n=!1;break}}return n},h=p({name:"data",fieldValue:function(e){return r._private.data[e]},fieldRef:function(e){return"element._private.data."+e},fieldUndefined:function(e){return void 0===r._private.data[e]},fieldTruthy:function(e){return r._private.data[e]?!0:!1}});if(!h)return!1;var g=p({name:"meta",fieldValue:function(e){return r[e]()},fieldRef:function(e){return"element."+e+"()"},fieldUndefined:function(e){return null==r[e]()},fieldTruthy:function(e){return r[e]()?!0:!1}});if(!g)return!1;if(null!=t.collection){var v=null!=t.collection._private.ids[r.id()];if(!v)return!1}if(null!=t.filter&&0===r.collection().filter(t.filter).size())return!1;var f=function(e,t){if(null!=e){var r=!1;t=t();for(var n=0;n<t.size();n++)if(i(e,t.eq(n))){r=!0;break}return r}return!0};return f(t.parent,function(){return r.parent()})?f(t.ancestor,function(){return r.parents()})?f(t.child,function(){return r.children()})?f(t.descendant,function(){return r.descendants()})?!0:!1:!1:!1:!1},a=function(e,t){for(var n=0;n<r.length;n++){var a=r[n];if(i(a,t))return!0}return!1};null==r._private.selectorText&&(a=function(){return!0});var o=t.filter(a);return o},e.selfn.toString=e.selfn.selector=function(){for(var t="",r=function(t){return e.is.string(t)?t:""},n=function(e){var t="",a=r(e.group);t+=a.substring(0,a.length-1);for(var o=0;o<e.data.length;o++){var s=e.data[o];t+=s.value?"["+s.field+r(s.operator)+r(s.value)+"]":"["+r(s.operator)+s.field+"]"}for(var o=0;o<e.meta.length;o++){var l=e.meta[o];t+="[["+l.field+r(l.operator)+r(l.value)+"]]"}for(var o=0;o<e.colonSelectors.length;o++){var c=e.colonSelectors[i];t+=c}for(var o=0;o<e.ids.length;o++){var c="#"+e.ids[i];t+=c}for(var o=0;o<e.classes.length;o++){var c="."+e.classes[i];t+=c}return null!=e.parent&&(t=n(e.parent)+" > "+t),null!=e.ancestor&&(t=n(e.ancestor)+" "+t),null!=e.child&&(t+=" > "+n(e.child)),null!=e.descendant&&(t+=" "+n(e.descendant)),t},i=0;i<this.length;i++){var a=this[i];t+=n(a),this.length>1&&i<this.length-1&&(t+=", ")}return t}}(cytoscape),function(e){"use strict";e.Style=function(t){return this instanceof e.Style?e.is.core(t)?(this._private={cy:t,coreStyle:{}},this.length=0,void this.addDefaultStylesheet()):void e.util.error("A style must have a core reference"):new e.Style(t)},e.style=e.Style,e.styfn=e.Style.prototype,e.fn.style=function(t){for(var r in t){var n=t[r];e.Style.prototype=n}},function(){var t=e.util.regex.number,r=e.util.regex.rgbaNoBackRefs,n=e.util.regex.hslaNoBackRefs,i=e.util.regex.hex3,a=e.util.regex.hex6,o=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(e){return"^"+e+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+t+"|\\w+|"+r+"|"+n+"|"+i+"|"+a+")\\s*\\,\\s*("+t+"|\\w+|"+r+"|"+n+"|"+i+"|"+a+")\\)$"};e.style.types={time:{number:!0,min:0,units:"s"},percent:{number:!0,min:0,max:100,units:"%"},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},size:{number:!0,min:0,enums:["auto"]},bgSize:{number:!0,min:0,allowPercent:!0},bgPos:{number:!0,allowPercent:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"]},bgFit:{enums:["none","contain","cover"]},bgClip:{enums:["none","node"]},color:{color:!0},lineStyle:{enums:["solid","dotted","dashed"]},curveStyle:{enums:["bezier","haystack"]},fontFamily:{regex:"^([\\w- ]+(?:\\s*,\\s*[\\w- ]+)*)$"},fontVariant:{enums:["small-caps","normal"]},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","capitalize","uppercase","lowercase"]},nodeShape:{enums:["rectangle","roundrectangle","ellipse","triangle","square","pentagon","hexagon","heptagon","octagon","star"]},arrowShape:{enums:["tee","triangle","square","circle","diamond","none"]},arrowFill:{enums:["filled","hollow"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},cursor:{enums:["auto","crosshair","default","e-resize","n-resize","ne-resize","nw-resize","pointer","progress","s-resize","sw-resize","text","w-resize","wait","grab","grabbing"]},text:{string:!0},data:{mapping:!0,regex:o("data")},layoutData:{mapping:!0,regex:o("layoutData")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},url:{regex:"^url\\s*\\(\\s*([^\\s]+)\\s*\\s*\\)|none|(.+)$"},propList:{propList:!0}};var l=e.style.types;e.style.properties=[{name:"text-valign",type:l.valign},{name:"text-halign",type:l.halign},{name:"color",type:l.color},{name:"content",type:l.text},{name:"text-outline-color",type:l.color},{name:"text-outline-width",type:l.size},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-opacity",type:l.zeroOneNumber},{name:"text-decoration",type:l.textDecoration},{name:"text-transform",type:l.textTransform},{name:"font-family",type:l.fontFamily},{name:"font-style",type:l.fontStyle},{name:"font-variant",type:l.fontVariant},{name:"font-weight",type:l.fontWeight},{name:"font-size",type:l.size},{name:"min-zoomed-font-size",type:l.size},{name:"display",type:l.display},{name:"visibility",type:l.visibility},{name:"opacity",type:l.zeroOneNumber},{name:"z-index",type:l.nonNegativeInt},{name:"overlay-padding",type:l.size},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber},{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-color",type:l.color},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-image",type:l.url},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"pie-size",type:l.bgSize},{name:"pie-1-background-color",type:l.color},{name:"pie-2-background-color",type:l.color},{name:"pie-3-background-color",type:l.color},{name:"pie-4-background-color",type:l.color},{name:"pie-5-background-color",type:l.color},{name:"pie-6-background-color",type:l.color},{name:"pie-7-background-color",type:l.color},{name:"pie-8-background-color",type:l.color},{name:"pie-9-background-color",type:l.color},{name:"pie-10-background-color",type:l.color},{name:"pie-11-background-color",type:l.color},{name:"pie-12-background-color",type:l.color},{name:"pie-13-background-color",type:l.color},{name:"pie-14-background-color",type:l.color},{name:"pie-15-background-color",type:l.color},{name:"pie-16-background-color",type:l.color},{name:"pie-1-background-size",type:l.percent},{name:"pie-2-background-size",type:l.percent},{name:"pie-3-background-size",type:l.percent},{name:"pie-4-background-size",type:l.percent},{name:"pie-5-background-size",type:l.percent},{name:"pie-6-background-size",type:l.percent},{name:"pie-7-background-size",type:l.percent},{name:"pie-8-background-size",type:l.percent},{name:"pie-9-background-size",type:l.percent},{name:"pie-10-background-size",type:l.percent},{name:"pie-11-background-size",type:l.percent},{name:"pie-12-background-size",type:l.percent},{name:"pie-13-background-size",type:l.percent},{name:"pie-14-background-size",type:l.percent},{name:"pie-15-background-size",type:l.percent},{name:"pie-16-background-size",type:l.percent},{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size},{name:"border-style",type:l.lineStyle},{name:"height",type:l.size},{name:"width",type:l.size},{name:"padding-left",type:l.size},{name:"padding-right",type:l.size},{name:"padding-top",type:l.size},{name:"padding-bottom",type:l.size},{name:"shape",type:l.nodeShape},{name:"source-arrow-shape",type:l.arrowShape},{name:"target-arrow-shape",type:l.arrowShape},{name:"source-arrow-color",type:l.color},{name:"target-arrow-color",type:l.color},{name:"source-arrow-fill",type:l.arrowFill},{name:"target-arrow-fill",type:l.arrowFill},{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"control-point-step-size",type:l.size},{name:"control-point-distance",type:l.size},{name:"control-point-weight",type:l.zeroOneNumber},{name:"curve-style",type:l.curveStyle},{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"panning-cursor",type:l.cursor},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}];for(var c=e.style.properties,u=0;u<c.length;u++){var d=c[u];c[d.name]=d}e.style.pieBackgroundN=16}(),e.styfn.addDefaultStylesheet=function(){var t="Helvetica",r="normal",n="normal",i="normal",a="#000",o="none",s=16;this.selector("node, edge").css({"text-valign":"top","text-halign":"center",color:a,"text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":o,"font-family":t,"font-style":r,"font-variant":n,"font-weight":i,"font-size":s,"min-zoomed-font-size":0,visibility:"visible",display:"element",opacity:1,"z-index":0,content:"","overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"transition-property":"none","transition-duration":0,"transition-delay":0,"background-blacken":0,"background-color":"#888","background-opacity":1,"background-image":"none","background-position-x":"50%","background-position-y":"50%","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid",height:30,width:30,"padding-top":0,"padding-bottom":0,"padding-left":0,"padding-right":0,shape:"ellipse","pie-size":"100%","pie-1-background-color":"black","pie-1-background-size":"0%","pie-2-background-color":"black","pie-2-background-size":"0%","pie-3-background-color":"black","pie-3-background-size":"0%","pie-4-background-color":"black","pie-4-background-size":"0%","pie-5-background-color":"black","pie-5-background-size":"0%","pie-6-background-color":"black","pie-6-background-size":"0%","pie-7-background-color":"black","pie-7-background-size":"0%","pie-8-background-color":"black","pie-8-background-size":"0%","pie-9-background-color":"black","pie-9-background-size":"0%","pie-10-background-color":"black","pie-10-background-size":"0%","pie-11-background-color":"black","pie-11-background-size":"0%","pie-12-background-color":"black","pie-12-background-size":"0%","pie-13-background-color":"black","pie-13-background-size":"0%","pie-14-background-color":"black","pie-14-background-size":"0%","pie-15-background-color":"black","pie-15-background-size":"0%","pie-16-background-color":"black","pie-16-background-size":"0%","source-arrow-shape":"none","target-arrow-shape":"none","source-arrow-color":"#bbb","target-arrow-color":"#bbb","source-arrow-fill":"filled","target-arrow-fill":"filled","line-style":"solid","line-color":"#bbb","control-point-step-size":40,"control-point-weight":.5,"curve-style":"bezier"}).selector("$node > node").css({width:"auto",height:"auto",shape:"rectangle","background-opacity":.5,"padding-top":10,"padding-right":10,"padding-left":10,"padding-bottom":10}).selector("edge").css({width:1}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}).selector("core").css({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"panning-cursor":"grabbing","active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":e.is.touch()?40:15,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125})},e.styfn.clear=function(){this._private.newStyle=!0;for(var e=0;e<this.length;e++)delete this[e];return this.length=0,this},e.styfn.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},e.styfn.core=function(){return this._private.coreStyle},e.styfn.parse=function(t,r,n,i){t=e.util.camel2dash(t);var a=e.style.properties[t],o=r;if(!a)return null;if(void 0===r||null===r)return null;var s=e.is.string(r);s&&(r=e.util.trim(r));var l=a.type;if(!l)return null;if(n&&(""===r||null===r))return{name:t,value:r,bypass:!0,deleteBypass:!0};var c,u,d,p;if(!s||i);else{if((c=new RegExp(e.style.types.data.regex).exec(r))||(d=new RegExp(e.style.types.layoutData.regex).exec(r))){var h=void 0!==d;return c=c||d,{name:t,value:c,strValue:""+r,mapped:h?e.style.types.layoutData:e.style.types.data,field:c[1],bypass:n}}if((u=new RegExp(e.style.types.mapData.regex).exec(r))||(p=new RegExp(e.style.types.mapLayoutData.regex).exec(r))){var h=void 0!==p;if(u=u||p,!l.color&&!l.number)return!1;var g=this.parse(t,u[4]);if(!g||g.mapped)return!1;var v=this.parse(t,u[5]);if(!v||v.mapped)return!1;if(g.value===v.value)return!1;if(l.color){var f=g.value,y=v.value,m=!(f[0]!==y[0]||f[1]!==y[1]||f[2]!==y[2]||f[3]!==y[3]&&(null!=f[3]&&1!==f[3]||null!=y[3]&&1!==y[3]));if(m)return!1}return{name:t,value:u,strValue:""+r,mapped:h?e.style.types.mapLayoutData:e.style.types.mapData,field:u[1],fieldMin:parseFloat(u[2]),fieldMax:parseFloat(u[3]),valueMin:g.value,valueMax:v.value,bypass:n}}}if(l.number){var b,x="px";if(l.units&&(b=l.units),!l.unitless)if(s){var w="px|em"+(l.allowPercent?"|\\%":"");b&&(w=b);var _=r.match("^("+e.util.regex.number+")("+w+")?$");_&&(r=_[1],b=_[2]||x)}else b||(b=x);if(r=parseFloat(r),isNaN(r)&&void 0===l.enums)return null;if(isNaN(r)&&void 0!==l.enums){r=o;for(var E=0;E<l.enums.length;E++){var S=l.enums[E];if(S===r)return{name:t,value:r,strValue:""+r,bypass:n}}return null}if(l.integer&&!e.is.integer(r))return null;if(void 0!==l.min&&r<l.min||void 0!==l.max&&r>l.max)return null;var P={name:t,value:r,strValue:""+r+(b?b:""),units:b,bypass:n};return l.unitless||"px"!==b&&"em"!==b||(P.pxValue="px"!==b&&b?this.getEmSizeInPixels()*r:r),P}if(l.propList){var k=[],C=""+r;if("none"===C);else{for(var D=C.split(","),E=0;E<D.length;E++){var N=e.util.trim(D[E]);e.style.properties[N]&&k.push(N)}if(0===k.length)return null}return{name:t,value:k,strValue:0===k.length?"none":k.join(", "),bypass:n}}if(l.color){var M=e.util.color2tuple(r);return M?{name:t,value:M,strValue:""+r,bypass:n}:null}if(l.enums){for(var E=0;E<l.enums.length;E++){var S=l.enums[E];if(S===r)return{name:t,value:r,strValue:""+r,bypass:n}}return null}if(l.regex){var T=new RegExp(l.regex),z=T.exec(r);return z?{name:t,value:z,strValue:""+r,bypass:n}:null}return l.string?{name:t,value:r,strValue:""+r,bypass:n}:null},e.styfn.selector=function(t){var r="core"===t?null:new e.Selector(t),n=this.length++;return this[n]={selector:r,properties:[]},this},e.styfn.css=function(){var t=arguments;switch(t.length){case 1:for(var r=t[0],n=0;n<e.style.properties.length;n++){var i=e.style.properties[n],a=r[i.name];void 0===a&&(a=r[e.util.dash2camel(i.name)]),void 0!==a&&this.cssRule(i.name,a)}break;case 2:this.cssRule(t[0],t[1])}return this},e.styfn.cssRule=function(e,t){var r=this.parse(e,t);if(r){var n=this.length-1;this[n].properties.push(r);var i=!this[n].selector;i&&(this._private.coreStyle[r.name]=r)}return this}}(cytoscape),function(e){"use strict";e.styfn.apply=function(e){for(var t=this,r=0;r<e.length;r++){var n=e[r],i=n._private,a=[],o=[];t._private.newStyle&&(i.styleCxts=[],i.style={});for(var s=0;s<this.length;s++){var l=this[s],c=l.selector&&l.selector.filter(n).length>0,u=l.properties,d=!i.styleCxts[s];if(c){for(var p=0;p<u.length;p++){var h=u[p],g=i.style[h.name],v=g&&g.context===l,f=h.mapped&&v;(d||f)&&this.applyParsedProperty(n,h,l)}n._private.styleCxts[s]=l,t._private.newStyle===!1&&d&&a.push(l)}else i.styleCxts[s]&&(this.rollBackContext(n,l),o.push(l),delete i.styleCxts[s])}(a.length>0||o.length>0)&&this.updateTransitions(n,a,o),t.updateStyleHints(n)}t._private.newStyle=!1},e.styfn.updateStyleHints=function(t){var r=t._private,n=!1;if("nodes"===r.group)for(var i=1;i<=e.style.pieBackgroundN;i++){var a=r.style["pie-"+i+"-background-size"].value;if(a>0){n=!0;break}}r.hasPie=n;var o=r.style["text-transform"].strValue,s=r.style.content.strValue,l=r.style["font-style"].strValue,a=r.style["font-size"].pxValue+"px",c=r.style["font-family"].strValue,u=r.style["font-variant"].strValue,d=r.style["font-weight"].strValue;r.labelKey=l+"$"+a+"$"+c+"$"+u+"$"+d+"$"+s+"$"+o,r.fontKey=l+"$"+d+"$"+a+"$"+c},e.styfn.rollBackContext=function(e,t){for(var r=0;r<t.properties.length;r++){var n=t.properties[r],i=e._private.style[n.name];i.bypassed&&(i=i.bypassed);for(var a,o=!0,s=0;i.prev;){var l=i.prev;i.context===t&&(o?e._private.style[n.name]=l:a&&(a.prev=l)),a=i,i=l,o=!1,s++}}},e.styfn.applyParsedProperty=function(t,r,n){r=e.util.clone(r);var i,a,o=r,s=t._private.style,l=e.style.properties[o.name].type,c=o.bypass,u=s[o.name],d=u&&u.bypass;if(("height"===r.name||"width"===r.name)&&"auto"===r.value&&t.isNode()&&!t.isParent())return!1;if(c&&o.deleteBypass){var p=s[o.name];return p?p.bypass&&p.bypassed?(s[o.name]=p.bypassed,!0):!1:!0}switch(o.mapped){case e.style.types.mapData:case e.style.types.mapLayoutData:for(var h=o.mapped===e.style.types.mapLayoutData,g=o.field.split("."),i=h?t._private.layoutData:t._private.data,v=0;v<g.length&&i;v++){var f=g[v];i=i[f]}var y;if(y=e.is.number(i)?(i-o.fieldMin)/(o.fieldMax-o.fieldMin):0,0>y?y=0:y>1&&(y=1),l.color){var m=o.valueMin[0],b=o.valueMax[0],x=o.valueMin[1],w=o.valueMax[1],_=o.valueMin[2],E=o.valueMax[2],S=null==o.valueMin[3]?1:o.valueMin[3],P=null==o.valueMax[3]?1:o.valueMax[3],k=[Math.round(m+(b-m)*y),Math.round(x+(w-x)*y),Math.round(_+(E-_)*y),Math.round(S+(P-S)*y)];a={bypass:o.bypass,name:o.name,value:k,strValue:"rgb("+k[0]+", "+k[1]+", "+k[2]+")"}}else{if(!l.number)return!1;var C=o.valueMin+(o.valueMax-o.valueMin)*y;a=this.parse(o.name,C,o.bypass,!0)}a||(a=this.parse(o.name,u.strValue,o.bypass,!0)),a.mapping=o,o=a;break;case e.style.types.data:case e.style.types.layoutData:for(var h=o.mapped===e.style.types.layoutData,g=o.field.split("."),i=h?t._private.layoutData:t._private.data,v=0;v<g.length&&i;v++){var f=g[v];i=i[f]}a=this.parse(o.name,i,o.bypass,!0),a||(a=this.parse(o.name,u.strValue,o.bypass,!0)),a.mapping=o,o=a;break;case void 0:break;default:return!1}if(c)o.bypassed=d?u.bypassed:u,s[o.name]=o;else{var D;d?(D=u.bypassed,u.bypassed=o):(D=s[o.name],s[o.name]=o),D&&D.mapping&&o.mapping&&D.context===n&&(D=D.prev),D&&D!==o&&(o.prev=D)}return o.context=n,!0},e.styfn.update=function(){var e=this._private.cy,t=e.elements();t.updateStyle()},e.styfn.updateMappers=function(t){for(var r=0;r<t.length;r++){for(var n=t[r],i=n._private.style,a=0;a<e.style.properties.length;a++){var o=e.style.properties[a],s=i[o.name];if(s&&s.mapping){var l=s.mapping;this.applyParsedProperty(n,l)}}this.updateStyleHints(n)}},e.styfn.updateTransitions=function(t,r,n){var i=this,a=t._private.style,o=a["transition-property"].value,s=1e3*a["transition-duration"].value,l=1e3*a["transition-delay"].value,c={};if(o.length>0&&s>0){for(var u=!1,d=0;d<o.length;d++){for(var p=o[d],h=a[p],g=h.prev,v=a[p],f=!1,y=!1,m=!1,b=0;b<r.length;b++){var x=r[b];if(x===v.context){y=!0;break}}for(var b=n.length-1;b>=0;b--){for(var x=n[b],w=0;w<x.properties.length;w++){var _=x.properties[w];if(_.name===p){m=!0,g=_;break}}if(m)break}(y||m)&&(e.is.number(g.pxValue)&&e.is.number(v.pxValue)?f=g.pxValue!==v.pxValue:e.is.number(g.value)&&e.is.number(v.value)?f=g.value!==v.value:e.is.array(g.value)&&e.is.array(v.value)&&(f=g.value[0]!==v.value[0]||g.value[1]!==v.value[1]||g.value[2]!==v.value[2]),f&&(c[p]=v.strValue,this.applyBypass(t,p,g.strValue),u=!0))}if(!u)return;t._private.transitioning=!0,t.stop(),l>0&&t.delay(l),t.animate({css:c},{duration:s,queue:!1,complete:function(){i.removeAllBypasses(t),t._private.transitioning=!1}})}else t._private.transitioning&&(t.stop(),this.removeAllBypasses(t),t._private.transitioning=!1)}}(cytoscape),function(e){"use strict";e.styfn.applyBypass=function(t,r,n){var i=[];if("*"===r||"**"===r){if(void 0!==n)for(var a=0;a<e.style.properties.length;a++){var o=e.style.properties[a],r=o.name,s=this.parse(r,n,!0);s&&i.push(s)}}else if(e.is.string(r)){var s=this.parse(r,n,!0);s&&i.push(s)}else{if(!e.is.plainObject(r))return!1;for(var l=r,a=0;a<e.style.properties.length;a++){var o=e.style.properties[a],r=o.name,n=l[r];if(void 0===n&&(n=l[e.util.dash2camel(r)]),void 0!==n){var s=this.parse(r,n,!0);s&&i.push(s)}}}if(0===i.length)return!1;for(var c=!1,a=0;a<t.length;a++)for(var u=t[a],d=0;d<i.length;d++){var o=i[d];c=this.applyParsedProperty(u,o)||c}return c},e.styfn.removeAllBypasses=function(t){for(var r=0;r<e.style.properties.length;r++)for(var n=e.style.properties[r],i=n.name,a="",o=this.parse(i,a,!0),s=0;s<t.length;s++){var l=t[s];this.applyParsedProperty(l,o)}}}(cytoscape),function(e,t){"use strict";e.styfn.getEmSizeInPixels=function(){var e=this._private.cy,r=e.container();if(t&&r&&t.getComputedStyle){var n=t.getComputedStyle(r).getPropertyValue("font-size"),i=parseFloat(n);return i}return 1},e.styfn.containerCss=function(e){var r=this._private.cy,n=r.container();return t&&n&&t.getComputedStyle?t.getComputedStyle(n).getPropertyValue(e):void 0},e.styfn.containerProperty=function(e){var t=this.containerCss(e),r=this.parse(e,t);return r},e.styfn.containerPropertyAsString=function(e){var t=this.containerProperty(e);return t?t.strValue:void 0}}(cytoscape,"undefined"==typeof window?null:window),function(e){"use strict";e.styfn.getRenderedStyle=function(t){var t=t[0];if(t){for(var r={},n=t._private.style,i=this._private.cy,a=i.zoom(),o=0;o<e.style.properties.length;o++){var s=e.style.properties[o],l=n[s.name];if(l){var c=l.unitless?l.strValue:l.pxValue*a+"px";r[s.name]=c,r[e.util.dash2camel(s.name)]=c}}return r}},e.styfn.getRawStyle=function(t){var t=t[0];if(t){for(var r={},n=t._private.style,i=0;i<e.style.properties.length;i++){var a=e.style.properties[i],o=n[a.name];o&&(r[a.name]=o.strValue,r[e.util.dash2camel(a.name)]=o.strValue)}return r}},e.styfn.getValueStyle=function(t){var r,n;if(e.is.element(t)?(r={},n=t._private.style):(r={},n=t),n)for(var i=0;i<e.style.properties.length;i++){var a=e.style.properties[i],o=n[a.name]||n[e.util.dash2camel(a.name)];if(void 0===o||e.is.plainObject(o)||(o=this.parse(a.name,o)),o){var s=void 0===o.value?o:o.value;r[a.name]=s,r[e.util.dash2camel(a.name)]=s}}return r}}(cytoscape),function(e){"use strict";e.style.applyFromJson=function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.selector,a=n.css;e.selector(i);for(var o in a){var s=a[o];e.css(o,s)}}return e},e.style.fromJson=function(t,r){var n=new e.Style(t);return e.style.applyFromJson(n,r),n},e.styfn.fromJson=function(t){var r=this;return r.resetToDefault(),e.style.applyFromJson(r,t),r},e.styfn.json=function(){for(var e=[],t=0;t<this.length;t++){for(var r=this[t],n=r.selector,i=r.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:n?n.toString():"core",css:a})}return e}}(cytoscape),function(e){"use strict";e.style.applyFromString=function(t,r){function n(){l=l.length>a.length?l.substr(a.length):""}function i(){o=o.length>s.length?o.substr(s.length):""}var a,o,s,l=""+r;for(l=l.replace(/[/][*](\s|.)+?[*][/]/g,"");;){var c=l.match(/^\s*$/);if(c)break;var u=l.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!u){e.util.error("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+l);break}a=u[0];var d=u[1],p=new e.Selector(d);if(p._private.invalid)e.util.error("Skipping parsing of block: Invalid selector found in string stylesheet: "+d),n();else{var h=u[2],g=!1;o=h;for(var v=[];;){var c=o.match(/^\s*$/);if(c)break;var f=o.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!f){e.util.error("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),g=!0;break}s=f[0];var y=f[1],m=f[2],b=e.style.properties[y];if(b){var x=t.parse(y,m);x?(v.push({name:y,val:m}),i()):(e.util.error("Skipping property: Invalid property definition in: "+s),i())}else e.util.error("Skipping property: Invalid property name in: "+s),i()}if(g){n();break}t.selector(d);for(var w=0;w<v.length;w++){var b=v[w];t.css(b.name,b.val)}n()}}return t},e.style.fromString=function(t,r){var n=new e.Style(t);return e.style.applyFromString(n,r),n},e.styfn.fromString=function(t){var r=this;return r.resetToDefault(),e.style.applyFromString(r,t),r}}(cytoscape),function(e){"use strict";e.stylesheet=e.Stylesheet=function(){return this instanceof e.Stylesheet?void(this.length=0):new e.Stylesheet},e.Stylesheet.prototype.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},e.Stylesheet.prototype.css=function(t,r){var n=this.length-1;if(e.is.string(t))this[n].properties.push({name:t,value:r});else if(e.is.plainObject(t))for(var i=t,a=0;a<e.style.properties.length;a++){var o=e.style.properties[a],s=i[o.name];if(void 0===s&&(s=i[e.util.dash2camel(o.name)]),void 0!==s){var t=o.name,r=s;this[n].properties.push({name:t,value:r})}}return this},e.Stylesheet.prototype.generateStyle=function(t){for(var r=new e.Style(t),n=0;n<this.length;n++){var i=this[n],a=i.selector,o=i.properties;r.selector(a);for(var s=0;s<o.length;s++){var l=o[s];r.css(l.name,l.value)}}return r}}(cytoscape),function(e,t){"use strict";
var r=e.is.touch(),n={hideEdgesOnViewport:!1},i=e.util.copy(n);e.defaults=function(t){n=e.util.extend({},i,t)},e.fn.core=function(t){for(var r in t){var n=t[r];e.Core.prototype[r]=n}},e.Core=function(i){if(!(this instanceof e.Core))return new e.Core(i);var a=this;i=e.util.extend({},n,i);var o=i.container,s=o?o._jqcy:null;s&&s.cy&&(o.innerHTML="",s.cy.notify({type:"destroy"}));var l=s?s.readies||[]:[],c=i;c.layout=e.util.extend({name:t&&o?"grid":"null"},c.layout),c.renderer=e.util.extend({name:t&&o?"canvas":"null"},c.renderer);var u=this._private={ready:!1,initrender:!1,options:c,elements:[],id2index:{},listeners:[],aniEles:[],scratch:{},layout:null,renderer:null,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:void 0===c.zoomingEnabled?!0:c.zoomingEnabled,userZoomingEnabled:void 0===c.userZoomingEnabled?!0:c.userZoomingEnabled,panningEnabled:void 0===c.panningEnabled?!0:c.panningEnabled,userPanningEnabled:void 0===c.userPanningEnabled?!0:c.userPanningEnabled,boxSelectionEnabled:void 0===c.boxSelectionEnabled?!0:c.boxSelectionEnabled,autolockNodes:!1,autoungrabifyNodes:void 0===c.autoungrabifyNodes?!1:c.autoungrabifyNodes,zoom:e.is.number(c.zoom)?c.zoom:1,pan:{x:e.is.plainObject(c.pan)&&e.is.number(c.pan.x)?c.pan.x:0,y:e.is.plainObject(c.pan)&&e.is.number(c.pan.y)?c.pan.y:0},hasCompoundNodes:!1},d=c.selectionType;u.selectionType=void 0===d||"additive"!==d&&"single"!==d?r?"additive":"single":d,e.is.number(c.minZoom)&&e.is.number(c.maxZoom)&&c.minZoom<c.maxZoom?(u.minZoom=c.minZoom,u.maxZoom=c.maxZoom):e.is.number(c.minZoom)&&void 0===c.maxZoom?u.minZoom=c.minZoom:e.is.number(c.maxZoom)&&void 0===c.minZoom&&(u.maxZoom=c.maxZoom),u.style=e.is.stylesheet(c.style)?c.style.generateStyle(this):e.is.array(c.style)?e.style.fromJson(this,c.style):e.is.string(c.style)?e.style.fromString(this,c.style):new e.Style(a),a.initRenderer(e.util.extend({hideEdgesOnViewport:c.hideEdgesOnViewport,hideLabelsOnViewport:c.hideLabelsOnViewport,textureOnViewport:c.textureOnViewport},c.renderer)),c.initrender&&(a.on("initrender",c.initrender),a.on("initrender",function(){a._private.initrender=!0})),a.load(c.elements,function(){a.startAnimationLoop(),a._private.ready=!0,e.is.fn(c.ready)&&a.bind("ready",c.ready);for(var t=0;t<l.length;t++){var r=l[t];a.bind("ready",r)}s&&(s.readies=[]),a.trigger("ready")},c.done)},e.corefn=e.Core.prototype,e.fn.core({ready:function(){return this._private.ready},initrender:function(){return this._private.initrender},destroy:function(){return this.renderer().destroy(),this},getElementById:function(t){var r=this._private.id2index[t];return void 0!==r?this._private.elements[r]:new e.Collection(this)},selectionType:function(){return this._private.selectionType},hasCompoundNodes:function(){return this._private.hasCompoundNodes},addToPool:function(e){for(var t=this._private.elements,r=this._private.id2index,n=0;n<e.length;n++){var i=e[n],a=i._private.data.id,o=r[a],s=void 0!==o;s||(o=t.length,t.push(i),r[a]=o,i._private.index=o)}return this},removeFromPool:function(e){for(var t=this._private.elements,r=this._private.id2index,n=0;n<e.length;n++){var i=e[n],a=i._private.data.id,o=r[a],s=void 0!==o;if(s){delete this._private.id2index[a],t.splice(o,1);for(var l=o;l<t.length;l++){var c=t[l]._private.data.id;r[c]--}}}},container:function(){return this._private.options.container},options:function(){return e.util.copy(this._private.options)},json:function(){var e={},t=this;return e.elements={},t.elements().each(function(t,r){var n=r.group();e.elements[n]||(e.elements[n]=[]),e.elements[n].push(r.json())}),e.style=t.style().json(),e.scratch=t.scratch(),e.zoomingEnabled=t._private.zoomingEnabled,e.userZoomingEnabled=t._private.userZoomingEnabled,e.zoom=t._private.zoom,e.minZoom=t._private.minZoom,e.maxZoom=t._private.maxZoom,e.panningEnabled=t._private.panningEnabled,e.userPanningEnabled=t._private.userPanningEnabled,e.pan=t._private.pan,e.boxSelectionEnabled=t._private.boxSelectionEnabled,e.layout=t._private.options.layout,e.renderer=t._private.options.renderer,e.hideEdgesOnViewport=t._private.options.hideEdgesOnViewport,e.hideLabelsOnViewport=t._private.options.hideLabelsOnViewport,e.textureOnViewport=t._private.options.textureOnViewport,e}})}(cytoscape,"undefined"==typeof window?null:window),function(e,t){"use strict";function r(e){var t=!document||"interactive"!==document.readyState&&"complete"!==document.readyState?r:e;setTimeout(t,9,e)}e.fn.core({add:function(t){var r,n=this;if(e.is.elementOrCollection(t)){var i=t;if(i._private.cy===n)r=i.restore();else{for(var a=[],o=0;o<i.length;o++){var s=i[o];a.push(s.json())}r=new e.Collection(n,a)}}else if(e.is.array(t)){var a=t;r=new e.Collection(n,a)}else if(e.is.plainObject(t)&&(e.is.array(t.nodes)||e.is.array(t.edges))){for(var l=t,a=[],c=["nodes","edges"],o=0,u=c.length;u>o;o++){var d=c[o],p=l[d];if(e.is.array(p))for(var h=0,g=p.length;g>h;h++){var v=p[h],f=e.util.extend({},v,{group:d});a.push(f)}}r=new e.Collection(n,a)}else{var v=t;r=new e.Element(n,v).collection()}return r},remove:function(t){if(e.is.elementOrCollection(t))t=t;else if(e.is.string(t)){var r=t;t=this.$(r)}return t.remove()},load:function(n,i,a){function o(){s.one("layoutready",function(e){s.notifications(!0),s.trigger(e),s.notify({type:"load",collection:s.elements()}),s.one("load",i),s.trigger("load")}).one("layoutstop",function(){s.one("done",a),s.trigger("done")}),s.layout(s._private.options.layout)}var s=this,l=s.elements();return l.length>0&&l.remove(),s.notifications(!1),null!=n&&(e.is.plainObject(n)||e.is.array(n))&&s.add(n),t?r(o):o(),this}})}(cytoscape,"undefined"==typeof window?null:window),function(e,t){"use strict";e.fn.core({addToAnimationPool:function(e){for(var t=this,r=t._private.aniEles,n=[],i=0;i<r.length;i++){var a=r[i]._private.data.id;n[a]=!0}for(var i=0;i<e.length;i++){var o=e[i],a=o._private.data.id;n[a]||r.push(o)}},startAnimationLoop:function(){function r(){function e(){d(function(e){n(e),r()},p)}c?setTimeout(function(){e()},l):e()}function n(t){t=+new Date;for(var r=s._private.aniEles,n=0;n<r.length;n++){var a=r[n],o=a._private.animation.current,l=a._private.animation.queue;if(0===o.length){var c=l,u=c.length>0?c.shift():null;null!=u&&(u.callTime=+new Date,o.push(u))}for(var d=[],p=0;p<o.length;p++){var h=o[p];i(a,h,t),o[p].done&&(d.push(h),o.splice(p,1),p--)}for(var p=0;p<d.length;p++){var h=d[p],g=h.params.complete;e.is.fn(g)&&g.apply(a,[t])}}r.length>0&&s.notify({type:"draw",collection:r});for(var p=0;p<r.length;p++){var a=r[p],l=a._private.animation.queue,o=a._private.animation.current,v=o.length>0||l.length>0;v||(r.splice(p,1),p--)}}function i(t,r,n){var i,l=s._private.style,c=r.properties,u=r.params,d=r.callTime;if(i=0===r.duration?1:Math.min(1,(n-d)/r.duration),0>i?i=0:i>1&&(i=1),null==c.delay){var p=r.startPosition,h=c.position,g=t._private.position;if(h&&(a(p.x,h.x)&&(g.x=o(p.x,h.x,i)),a(p.y,h.y)&&(g.y=o(p.y,h.y,i))),c.css)for(var v=e.style.properties,f=0;f<v.length;f++){var y=v[f].name,m=c.css[y];if(void 0!==m){var b=r.startStyle[y],x=o(b,m,i);l.applyBypass(t,y,x)}}}return e.is.fn(u.step)&&u.step.apply(t,[n]),i>=1&&(r.done=!0),i}function a(t,r){return null==t||null==r?!1:e.is.number(t)&&e.is.number(r)?!0:t&&r?!0:!1}function o(t,r,n){if(0>n?n=0:n>1&&(n=1),e.is.number(t)&&e.is.number(r))return t+(r-t)*n;if(e.is.number(t[0])&&e.is.number(r[0])){var i=t,a=r,o=function(e,t){var r=t-e,i=e;return Math.round(n*r+i)},s=o(i[0],a[0]),l=o(i[1],a[1]),c=o(i[2],a[2]);return"rgb("+s+", "+l+", "+c+")"}return void 0}var s=this,l=1e3/60,c=!1,u=!0;if(t){s._private.aniEles=[];var d=e.util.requestAnimationFrame;null!=d&&u||(d=function(e){t.setTimeout(function(){e(+new Date)},l)});var p=s.container();r()}}})}(cytoscape,"undefined"==typeof window?null:window),function(e){"use strict";e.fn.core({data:e.define.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0}),removeData:e.define.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0}),batchData:e.define.batchData({field:"data",event:"data",triggerFnName:"trigger",immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:e.define.data({field:"scratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeScratch:e.define.removeData({field:"scratch",triggerEvent:!1})})}(cytoscape),function(e){"use strict";e.fn.core({on:e.define.on(),one:e.define.on({unbindSelfOnTrigger:!0}),once:e.define.on({unbindAllBindersOnTrigger:!0}),off:e.define.off(),trigger:e.define.trigger()}),e.corefn.bind=e.corefn.on,e.corefn.unbind=e.corefn.off}(cytoscape),function(e){"use strict";e.fn.core({png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)}})}(cytoscape),function(e){"use strict";e.fn.core({layout:function(e){var t=this;return this._private.layoutRunning?this:(null==e&&(e=this._private.options.layout),this.initLayout(e),t.trigger("layoutstart"),this._private.layoutRunning=!0,this.one("layoutstop",function(){t._private.layoutRunning=!1}),this._private.layout.run(),this)},initLayout:function(t){if(null==t)return void e.util.error("Layout options must be specified to run a layout");if(null==t.name)return void e.util.error("A `name` must be specified to run a layout");var r=t.name,n=e.extension("layout",r);return null==n?void e.util.error("Can not apply layout: No such layout `%s` found; did you include its JS file?",r):(this._private.layout=new n(e.util.extend({},t,{renderer:this._private.renderer,cy:this})),void(this._private.options.layout=t))}})}(cytoscape),function(e){"use strict";e.fn.core({notify:function(t){if(this._private.notificationsEnabled){var r=this.renderer(),n=this;if(e.is.element(t.collection)){var i=t.collection;t.collection=new e.Collection(n,[i])}else if(e.is.array(t.collection)){var a=t.collection;t.collection=new e.Collection(n,a)}r.notify(t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:void(t.notificationsEnabled=e?!0:!1)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)}})}(cytoscape),function(e){"use strict";e.fn.core({renderTo:function(e,t,r,n){var i=this._private.renderer;return i.renderTo(e,t,r,n),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify({type:"draw"}),this},resize:function(){return this.notify({type:"resize"}),this},initRenderer:function(t){var r=this,n=e.extension("renderer",t.name);return null==n?void e.util.error("Can not initialise: No such renderer `%s` found; did you include its JS file?",t.name):void(this._private.renderer=new n(e.util.extend({},t,{cy:r,style:r._private.style})))},recalculateRenderedStyle:function(){var e=this.renderer();e.recalculateRenderedStyle&&e.recalculateRenderedStyle()}})}(cytoscape),function(e){"use strict";e.fn.core({collection:function(t){return e.is.string(t)?this.$(t):e.is.elementOrCollection(t)?t.collection():new e.Collection(this)},nodes:function(e){var t=this.$("node");return e?t.filter(e):t},edges:function(e){var t=this.$("edge");return e?t.filter(e):t},$:function(t){var r=new e.Collection(this,this._private.elements);return t?r.filter(t):r}}),e.corefn.elements=e.corefn.filter=e.corefn.$}(cytoscape),function(e){"use strict";e.fn.core({style:function(){return this._private.style}})}(cytoscape),function(e){"use strict";e.fn.core({autolockNodes:function(e){return void 0===e?this._private.autolockNodes:(this._private.autolockNodes=e?!0:!1,this)},autoungrabifyNodes:function(e){return void 0===e?this._private.autoungrabifyNodes:(this._private.autoungrabifyNodes=e?!0:!1,this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=e?!0:!1,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=e?!0:!1,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=e?!0:!1,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=e?!0:!1,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=e?!0:!1,this)},pan:function(){var t,r,n,i,a,o=arguments,s=this._private.pan;switch(o.length){case 0:return s;case 1:if(!this._private.panningEnabled)return this;if(e.is.string(o[0]))return t=o[0],s[t];e.is.plainObject(o[0])&&(n=o[0],i=n.x,a=n.y,e.is.number(i)&&(s.x=i),e.is.number(a)&&(s.y=a),this.trigger("pan"));break;case 2:if(!this._private.panningEnabled)return this;t=o[0],r=o[1],"x"!==t&&"y"!==t||!e.is.number(r)||(s[t]=r),this.trigger("pan")}return this.notify({type:"viewport"}),this},panBy:function(){var t,r,n,i,a,o=arguments,s=this._private.pan;if(!this._private.panningEnabled)return this;switch(o.length){case 1:e.is.plainObject(o[0])&&(n=o[0],i=n.x,a=n.y,e.is.number(i)&&(s.x+=i),e.is.number(a)&&(s.y+=a),this.trigger("pan"));break;case 2:t=o[0],r=o[1],"x"!==t&&"y"!==t||!e.is.number(r)||(s[t]+=r),this.trigger("pan")}return this.notify({type:"viewport"}),this},fit:function(t,r){if(e.is.number(t)&&void 0===r&&(r=t,t=void 0),!this._private.panningEnabled||!this._private.zoomingEnabled)return this;if(e.is.string(t)){var n=t;t=this.$(n)}else e.is.elementOrCollection(t)||(t=this.elements());var i,a=t.boundingBox(),o=this.style(),s=parseFloat(o.containerCss("width")),l=parseFloat(o.containerCss("height"));return r=e.is.number(r)?r:0,!isNaN(s)&&!isNaN(l)&&t.length>0&&(i=this._private.zoom=Math.min((s-2*r)/a.w,(l-2*r)/a.h),i=i>this._private.maxZoom?this._private.maxZoom:i,i=i<this._private.minZoom?this._private.minZoom:i,this._private.pan={x:(s-i*(a.x1+a.x2))/2,y:(l-i*(a.y1+a.y2))/2},this.trigger("pan zoom"),this.notify({type:"viewport"})),this},minZoom:function(t){return void 0===t?this._private.minZoom:(e.is.number(t)&&(this._private.minZoom=t),this)},maxZoom:function(t){return void 0===t?this._private.maxZoom:(e.is.number(t)&&(this._private.maxZoom=t),this)},zoom:function(t){var r,n;if(void 0===t)return this._private.zoom;if(e.is.number(t))n=t;else if(e.is.plainObject(t)){if(n=t.level,t.position){var i=t.position,a=this._private.pan,o=this._private.zoom;r={x:i.x*o+a.x,y:i.y*o+a.y}}else t.renderedPosition&&(r=t.renderedPosition);if(r&&!this._private.panningEnabled)return this}if(!this._private.zoomingEnabled)return this;if(!e.is.number(n)||r&&(!e.is.number(r.x)||!e.is.number(r.y)))return this;if(n=n>this._private.maxZoom?this._private.maxZoom:n,n=n<this._private.minZoom?this._private.minZoom:n,r){var s=this._private.pan,l=this._private.zoom,c=n,u={x:-c/l*(r.x-s.x)+r.x,y:-c/l*(r.y-s.y)+r.y};this._private.zoom=n,this._private.pan=u;var d=s.x!==u.x||s.y!==u.y;this.trigger("zoom"+(d?" pan":""))}else this._private.zoom=n,this.trigger("zoom");return this.notify({type:"viewport"}),this},viewport:function(t){var r=this._private,n=!0,i=!0,a=[],o=!1,s=!1;if(!t)return this;if(e.is.number(t.zoom)||(n=!1),e.is.plainObject(t.pan)||(i=!1),!n&&!i)return this;if(n){var l=t.zoom;l<r.minZoom||l>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=l,a.push("zoom"))}if(i&&!o&&r.panningEnabled){var c=t.pan;e.is.number(c.x)&&(r.pan.x=c.x,s=!1),e.is.number(c.y)&&(r.pan.y=c.y,s=!1),s||a.push("pan")}return a.length>0&&this.trigger(a.join(" ")),this.notify({type:"viewport"}),this},boundingBox:function(e){var t=this.$(e);return t.boundingBox()},renderedBoundingBox:function(e){var t=this.$(e);return t.renderedBoundingBox()},center:function(t){if(!this._private.panningEnabled||!this._private.zoomingEnabled)return this;if(e.is.string(t)){var r=t;t=this.elements(r)}else e.is.elementOrCollection(t)||(t=this.elements());var n=t.boundingBox(),i=this.style(),a=parseFloat(i.containerCss("width")),o=parseFloat(i.containerCss("height")),s=this._private.zoom;return this.pan({x:(a-s*(n.x1+n.x2))/2,y:(o-s*(n.y1+n.y2))/2}),this.trigger("pan"),this.notify({type:"viewport"}),this},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.pan({x:0,y:0}),this._private.maxZoom>1&&this._private.minZoom<1&&this.zoom(1),this.notify({type:"viewport"}),this):this}})}(cytoscape),function(e){"use strict";e.fn.collection=e.fn.eles=function(t){for(var r in t){var n=t[r];e.Collection.prototype[r]=n}};var t={prefix:{nodes:"n",edges:"e"},id:{nodes:0,edges:0},generate:function(t,r,n){var i=e.is.element(r)?r._private:r,a=i.group,o=null!=n?n:this.prefix[a]+this.id[a];if(t.getElementById(o).empty())this.id[a]++;else for(;!t.getElementById(o).empty();)o=this.prefix[a]+ ++this.id[a];return o}};e.Element=function(t,r,n){if(!(this instanceof e.Element))return new e.Element(t,r,n);var i=this;if(n=void 0===n||n?!0:!1,void 0===t||void 0===r||!e.is.core(t))return void e.util.error("An element must have a core reference and parameters set");if("nodes"!==r.group&&"edges"!==r.group)return void e.util.error("An element must be of type `nodes` or `edges`; you specified `"+r.group+"`");if(this.length=1,this[0]=this,this._private={cy:t,single:!0,data:r.data||{},layoutData:{},position:r.position||{},autoWidth:void 0,autoHeight:void 0,listeners:[],group:r.group,style:{},rstyle:{},styleCxts:[],removed:!0,selected:r.selected?!0:!1,selectable:void 0===r.selectable?!0:r.selectable?!0:!1,locked:r.locked?!0:!1,grabbed:!1,grabbable:void 0===r.grabbable?!0:r.grabbable?!0:!1,active:!1,classes:{},animation:{current:[],queue:[]},rscratch:{},scratch:{},edges:[],children:[]},r.renderedPosition){var a=r.renderedPosition,o=t.pan(),s=t.zoom();this._private.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}if(e.is.string(r.classes))for(var l=r.classes.split(/\s+/),c=0,u=l.length;u>c;c++){var d=l[c];d&&""!==d&&(i._private.classes[d]=!0)}r.css&&t.style().applyBypass(this,r.css),(void 0===n||n)&&this.restore()},e.Collection=function(r,n){if(!(this instanceof e.Collection))return new e.Collection(r,n);if(void 0===r||!e.is.core(r))return void e.util.error("A collection must have a reference to the core");var i={},a=!1;if(n){if(n.length>0&&e.is.plainObject(n[0])&&!e.is.element(n[0])){a=!0;for(var o=[],s={},l=0,c=n.length;c>l;l++){var u=n[l];null==u.data&&(u.data={});var d=u.data;if(null==d.id)d.id=t.generate(r,u);else if(0!==r.getElementById(d.id).length||s[d.id])continue;var p=new e.Element(r,u,!1);o.push(p),s[d.id]=!0}n=o}}else n=[];this.length=0;for(var l=0,c=n.length;c>l;l++){var h=n[l];if(h){var g=h._private.data.id;i[g]||(i[g]=h,this[this.length]=h,this.length++)}}this._private={cy:r,ids:i},a&&this.restore()},e.elefn=e.elesfn=e.Element.prototype=e.Collection.prototype,e.elesfn.cy=function(){return this._private.cy},e.elesfn.element=function(){return this[0]},e.elesfn.collection=function(){return e.is.collection(this)?this:new e.Collection(this._private.cy,[this])},e.elesfn.json=function(){var t=this.element();if(null==t)return void 0;var r=t._private,n=e.util.copy({data:r.data,position:r.position,group:r.group,bypass:r.bypass,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbed:r.grabbed,grabbable:r.grabbable,classes:""}),i=[];for(var a in r.classes)i.push(a);for(var o=0;o<i.length;o++){var a=i[o];n.classes+=a+(o<i.length-1?" ":"")}return n},e.elesfn.jsons=function(){for(var e=[],t=0;t<this.length;t++){var r=this[t],n=r.json();e.push(n)}return e},e.elesfn.restore=function(r){var n=this,i=[],a=n.cy();void 0===r&&(r=!0);for(var o=[],s=[],l=[],c=0,u=0,d=0,p=n.length;p>d;d++){var h=n[d];h.isNode()?(s.push(h),c++):(l.push(h),u++)}o=s.concat(l);for(var d=0,p=o.length;p>d;d++){var h=o[d];if(h.removed()){var g=h._private,v=g.data;if(void 0===v.id)v.id=t.generate(a,h);else{if(e.is.emptyString(v.id)||!e.is.string(v.id)){e.util.error("Can not create element with invalid string ID `"+v.id+"`");continue}if(0!==a.getElementById(v.id).length){e.util.error("Can not create second element with ID `"+v.id+"`");continue}}var f=v.id;if(h.isEdge()){for(var y=h,m=["source","target"],b=m.length,x=!1,w=0;b>w;w++){var _=m[w],E=v[_];null==E||""===E?(e.util.error("Can not create edge `"+f+"` with unspecified "+_),x=!0):a.getElementById(E).empty()&&(e.util.error("Can not create edge `"+f+"` with nonexistant "+_+" `"+E+"`"),x=!0)}if(x)continue;var S=a.getElementById(v.source),P=a.getElementById(v.target);S._private.edges.push(y),P._private.edges.push(y),y._private.source=S,y._private.target=P}g.ids={},g.ids[f]=h,g.removed=!1,a.addToPool(h),i.push(h)}}for(var d=0;c>d;d++){var k=o[d],v=k._private.data,C=k._private.data.parent,D=null!=C;if(D){var N=a.getElementById(C);if(N.empty())delete v.parent;else{for(var M=!1,T=N;!T.empty();){if(k.same(T)){M=!0,delete v.parent;break}T=T.parent()}M||(N[0]._private.children.push(k),a._private.hasCompoundNodes=!0)}}}if(i=new e.Collection(a,i),i.length>0){var z=i.add(i.connectedNodes()).add(i.parent());z.updateStyle(r),r?i.rtrigger("add"):i.trigger("add")}return n},e.elesfn.removed=function(){var e=this[0];return e&&e._private.removed},e.elesfn.inside=function(){var e=this[0];return e&&!e._private.removed},e.elesfn.remove=function(t){function r(e){for(var t=e._private.edges,r=0;r<t.length;r++)i(t[r])}function n(e){for(var t=e._private.children,r=0;r<t.length;r++)i(t[r])}function i(e){var t=u[e.id()];t||(u[e.id()]=!0,e.isNode()?(c.push(e),r(e),n(e)):c.unshift(e))}function a(e,t){for(var r=e._private.edges,n=0;n<r.length;n++){var i=r[n];if(t===i){r.splice(n,1);break}}}function o(e,t){t=t[0],e=e[0];for(var r=e._private.children,n=0;n<r.length;n++)if(r[n][0]===t[0]){r.splice(n,1);break}}var s=this,l=[],c=[],u={},d=s._private.cy;void 0===t&&(t=!0);for(var p=0,h=s.length;h>p;p++){var g=s[p];i(g)}for(var p=0;p<c.length;p++){var g=c[p];if(g._private.removed=!0,d.removeFromPool(g),l.push(g),g.isEdge()){var v=g.source()[0],f=g.target()[0];a(v,g),a(f,g)}else{var y=g.parent();0!==y.length&&o(y,g)}}var m=d._private.elements;d._private.hasCompoundNodes=!1;for(var p=0;p<m.length;p++){var g=m[p];if(g.isParent()){d._private.hasCompoundNodes=!0;break}}var b=new e.Collection(this.cy(),l);b.size()>0&&(t&&this.cy().notify({type:"remove",collection:b}),b.trigger("remove"));for(var x={},p=0;p<c.length;p++){var g=c[p],w="nodes"===g._private.group,_=g._private.data.parent;if(w&&void 0!==_&&!x[_]){x[_]=!0;var y=d.getElementById(_);y&&0!==y.length&&!y._private.removed&&0===y.children().length&&y.updateStyle()}}return this}}(cytoscape),function(e){"use strict";e.fn.eles({breadthFirstSearch:function(t,r,n){n=2!==arguments.length||e.is.fn(r)?n:r,r=e.is.fn(r)?r:function(){};for(var i,a=this._private.cy,o=e.is.string(t)?this.filter(t):t,s=[],l=[],c={},u={},d={},p=0,h=this.nodes(),g=this.edges(),v=0;v<o.length;v++)o[v].isNode()&&(s.unshift(o[v]),d[o[v].id()]=!0,l.push(o[v]),u[o[v].id()]=0);for(;0!==s.length;){var o=s.shift(),f=u[o.id()],y=r.call(o,p++,f);if(y===!0){i=o;break}if(y===!1)break;for(var m=o.connectedEdges(n?function(){return this.data("source")===o.id()}:void 0).intersect(g),v=0;v<m.length;v++){var b=m[v],x=b.connectedNodes(function(){return this.id()!==o.id()}).intersect(h);0===x.length||d[x.id()]||(x=x[0],s.push(x),d[x.id()]=!0,u[x.id()]=u[o.id()]+1,l.push(x),c[x.id()]=b)}}for(var w=[],v=0;v<l.length;v++){var _=l[v],E=c[_.id()];E&&w.push(E),w.push(_)}return{path:new e.Collection(a,w),found:new e.Collection(a,i)}},depthFirstSearch:function(t,r,n){n=2!==arguments.length||e.is.fn(r)?n:r,r=e.is.fn(r)?r:function(){};for(var i,a=this._private.cy,o=e.is.string(t)?this.filter(t):t,s=[],l=[],c={},u={},d={},p=0,h=this.edges(),g=this.nodes(),v=0;v<o.length;v++)o[v].isNode()&&(s.push(o[v]),l.push(o[v]),u[o[v].id()]=0);for(;0!==s.length;){var o=s.pop();if(!d[o.id()]){d[o.id()]=!0;var f=u[o.id()],y=r.call(o,p++,f);if(y===!0){i=o;break}if(y===!1)break;for(var m=o.connectedEdges(n?function(){return this.data("source")===o.id()}:void 0).intersect(h),v=0;v<m.length;v++){var b=m[v],x=b.connectedNodes(function(){return this.id()!==o.id()}).intersect(g);0===x.length||d[x.id()]||(x=x[0],s.push(x),u[x.id()]=u[o.id()]+1,l.push(x),c[x.id()]=b)}}}for(var w=[],v=0;v<l.length;v++){var _=l[v],E=c[_.id()];E&&w.push(E),w.push(_)}return{path:new e.Collection(a,w),found:new e.Collection(a,i)}},kruskal:function(t){function r(e){for(var t=0;t<i.length;t++){var r=i[t];if(r.anySame(e))return{eles:r,index:t}}}t=e.is.fn(t)?t:function(){return 1};for(var n=new e.Collection(this._private.cy,[]),i=[],a=this.nodes(),o=0;o<a.length;o++)i.push(a[o].collection());for(var s=this.edges(),l=s.toArray().sort(function(e,r){var n=t.call(e),i=t.call(r);return n-i}),o=0;o<l.length;o++){var c=l[o],u=c.source()[0],d=c.target()[0],p=r(u),h=r(d);p.index!==h.index&&(n=n.add(c),i[p.index]=p.eles.add(h.eles),i.splice(h.index,1))}return a.add(n)},dijkstra:function(t,r,n){var i=this._private.cy;n=e.is.fn(r)?n:r,r=e.is.fn(r)?r:function(){return 1};for(var a=e.is.string(t)?this.filter(t).eq(0):t.eq(0),o={},s={},l={},c=this.edges().filter(function(){return!this.isLoop()}),u=this.nodes(),d=[],p=0;p<u.length;p++)o[u[p].id()]=u[p].same(a)?0:1/0,d.push(u[p]);var h=function(e){return o[e.id()]};d=new e.Collection(i,d);for(var g=e.Minheap(i,d,h),v=function(e,t){for(var i,a=(n?e.edgesTo(t):e.edgesWith(t)).intersect(c),o=1/0,s=0;s<a.length;s++){var l=a[s],u=r.call(l);(o>u||!i)&&(o=u,i=l)}return{edge:i,dist:o}};g.size()>0;){var f=g.pop(),y=f.value,m=f.id,b=i.getElementById(m);if(l[m]=y,y===Math.Infinite)break;for(var x=b.neighborhood().intersect(u),p=0;p<x.length;p++){var w=x[p],_=w.id(),E=v(b,w),S=y+E.dist;S<g.getValueById(_)&&(g.edit(_,S),s[_]={node:b,edge:E.edge})}}return{distanceTo:function(t){var r=e.is.string(t)?u.filter(t).eq(0):t.eq(0);return l[r.id()]},pathTo:function(t){var r=e.is.string(t)?u.filter(t).eq(0):t.eq(0),n=[],a=r;if(r.length>0)for(n.unshift(r);s[a.id()];){var o=s[a.id()];n.unshift(o.edge),n.unshift(o.node),a=o.node}return new e.Collection(i,n)}}}}),e.elesfn.bfs=e.elesfn.breadthFirstSearch,e.elesfn.dfs=e.elesfn.depthFirstSearch}(cytoscape),function(e){"use strict";e.fn.eles({animated:function(){var e=this[0];return e?e._private.animation.current.length>0:void 0},clearQueue:function(){for(var e=0;e<this.length;e++){var t=this[e];t._private.animation.queue=[]}return this},delay:function(e,t){return this.animate({delay:e},{duration:e,complete:t}),this},animate:function(e,t){var r,n=+new Date,i=this._private.cy,a=i.style();switch(void 0===t&&(t={}),void 0===t.duration&&(t.duration=400),t.duration){case"slow":t.duration=600;break;case"fast":t.duration=200}if(null==e||null==e.position&&null==e.renderedPosition&&null==e.css&&null==e.delay)return this;if(e.css&&(e.css=a.getValueStyle(e.css)),e.renderedPosition){var o=e.renderedPosition,s=i.pan(),l=i.zoom();e.position={x:(o.x-s.x)/l,y:(o.y-s.y)/l}}for(var c=0;c<this.length;c++){var u=this[c],d=u._private.position,p={x:d.x,y:d.y},h=a.getValueStyle(u);r=u.animated()&&(void 0===t.queue||t.queue)?u._private.animation.queue:u._private.animation.current,r.push({properties:e,duration:t.duration,params:t,callTime:n,startPosition:p,startStyle:h})}return i.addToAnimationPool(this),this},stop:function(e,t){for(var r=0;r<this.length;r++){for(var n=this[r],i=n._private.animation.current,a=0;a<i.length;a++){var o=i[a];t&&(o.duration=0)}e&&(n._private.animation.queue=[]),t||(n._private.animation.current=[])}return this.cy().notify({collection:this,type:"draw"}),this}})}(cytoscape),function(e){"use strict";e.fn.eles({addClass:function(t){t=t.split(/\s+/);for(var r=this,n=[],i=0;i<t.length;i++){var a=t[i];if(!e.is.emptyString(a))for(var o=0;o<r.length;o++){var s=r[o],l=s._private.classes[a];s._private.classes[a]=!0,l||n.push(s)}}return n.length>0&&new e.Collection(this._private.cy,n).updateStyle(),r.trigger("class"),r},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes[e]?!0:!1},toggleClass:function(t,r){for(var n=t.split(/\s+/),i=this,a=[],o=0,s=i.length;s>o;o++)for(var l=i[o],c=0;c<n.length;c++){var u=n[c];if(!e.is.emptyString(u)){var d=l._private.classes[u],p=r||void 0===r&&!d;p?(l._private.classes[u]=!0,d||a.push(l)):(l._private.classes[u]=!1,d&&a.push(l))}}return a.length>0&&new e.Collection(this._private.cy,a).updateStyle(),i.trigger("class"),i},removeClass:function(t){t=t.split(/\s+/);for(var r=this,n=[],i=0;i<r.length;i++)for(var a=r[i],o=0;o<t.length;o++){var s=t[o];if(s&&""!==s){var l=a._private.classes[s];delete a._private.classes[s],l&&n.push(a)}}return n.length>0&&new e.Collection(r._private.cy,n).updateStyle(),r.trigger("class"),r}})}(cytoscape),function(e){"use strict";e.fn.eles({allAre:function(e){return this.filter(e).length===this.length},is:function(e){return this.filter(e).length>0},same:function(e){return e=this.cy().collection(e),this.length!==e.length?!1:this.intersect(e).length===this.length},anySame:function(e){return e=this.cy().collection(e),this.intersect(e).length>0},allAreNeighbors:function(e){return e=this.cy().collection(e),this.neighborhood().intersect(e).length===e.length}})}(cytoscape),function(e){"use strict";e.fn.eles({parent:function(t){for(var r=[],n=this._private.cy,i=0;i<this.length;i++){var a=this[i],o=n.getElementById(a._private.data.parent);o.size()>0&&r.push(o)}return new e.Collection(n,r).filter(t)},parents:function(t){for(var r=[],n=this.parent();n.nonempty();){for(var i=0;i<n.length;i++){var a=n[i];r.push(a)}n=n.parent()}return new e.Collection(this.cy(),r).filter(t)},children:function(t){for(var r=[],n=0;n<this.length;n++){var i=this[n];r=r.concat(i._private.children)}return new e.Collection(this.cy(),r).filter(t)},siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];return e?0!==e._private.children.length:void 0},isChild:function(){var e=this[0];return e?void 0!==e._private.data.parent&&0!==e.parent().length:void 0},descendants:function(t){function r(e){for(var t=0;t<e.length;t++){var i=e[t];n.push(i),i.children().nonempty()&&r(i.children())}}var n=[];return r(this.children()),new e.Collection(this.cy(),n).filter(t)}}),e.elesfn.ancestors=e.elesfn.parents}(cytoscape),function(e){"use strict";var t=1,r=0;e.fn.eles({data:e.define.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:e.define.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),batchData:e.define.batchData({field:"data",event:"data",triggerFnName:"trigger",immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:e.define.data({field:"scratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeScratch:e.define.removeData({field:"scratch",triggerEvent:!1}),rscratch:e.define.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:e.define.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];return e?e._private.data.id:void 0},position:e.define.data({field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"rtrigger",allowGetting:!0,validKeys:["x","y"],onSet:function(e){var t=e.updateCompoundBounds();t.rtrigger("position")},canSet:function(e){return!e.locked()}}),silentPosition:e.define.data({field:"position",bindingEvent:"position",allowBinding:!1,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!1,triggerFnName:"trigger",allowGetting:!0,validKeys:["x","y"],onSet:function(e){e.updateCompoundBounds()},canSet:function(e){return!e.locked()}}),positions:function(t,r){if(e.is.plainObject(t))this.position(t);else if(e.is.fn(t)){for(var n=t,i=0;i<this.length;i++){var a=this[i],t=n.apply(a,[i,a]);if(t&&!a.locked()){var o=a._private.position;o.x=t.x,o.y=t.y}}var s=this.updateCompoundBounds(),l=this.add(s);r?l.trigger("position"):l.rtrigger("position")}return this},updateCompoundBounds:function(){function t(e){var t=e.children(),r=e._private.style,i=t.boundingBox({includeLabels:!1,includeEdges:!1}),a={top:r["padding-top"].pxValue,bottom:r["padding-bottom"].pxValue,left:r["padding-left"].pxValue,right:r["padding-right"].pxValue},o=e._private.position,s=!1;
"auto"===r.width.value&&(e._private.autoWidth=i.w+a.left+a.right,o.x=(i.x1+i.x2-a.left+a.right)/2,s=!0),"auto"===r.height.value&&(e._private.autoHeight=i.h+a.top+a.bottom,o.y=(i.y1+i.y2-a.top+a.bottom)/2,s=!0),s&&n.push(e)}var r=this.cy();if(!r.hasCompoundNodes())return r.collection();for(var n=[],i=this.parent();i.nonempty();){for(var a=0;a<i.length;a++){var o=i[a];t(o)}i=i.parent()}return new e.Collection(r,n)},renderedPosition:function(t,r){var n=this[0],i=this.cy(),a=i.zoom(),o=i.pan(),s=e.is.plainObject(t)?t:void 0,l=void 0!==s||void 0!==r&&e.is.string(t);if(n&&n.isNode()){if(!l){var c=n._private.position;return s={x:c.x*a+o.x,y:c.y*a+o.y},void 0===t?s:s[t]}for(var u=0;u<this.length;u++){var n=this[u];void 0!==r?n._private.position[t]=(r-o[t])/a:void 0!==s&&(n._private.position={x:(s.x-o.x)/a,y:(s.y-o.y)/a})}this.rtrigger("position")}else if(!l)return void 0;return this},width:function(){var e=this[0];if(e){var t=e._private.style.width;return"auto"===t.strValue?e._private.autoWidth:t.pxValue}},outerWidth:function(){var e=this[0];if(e){var n=e._private.style,i="auto"===n.width.strValue?e._private.autoWidth:n.width.pxValue,a=n["border-width"]?n["border-width"].pxValue*t+r:0;return i+a}},renderedWidth:function(){var e=this[0];if(e){var t=e.width();return t*this.cy().zoom()}},renderedOuterWidth:function(){var e=this[0];if(e){var t=e.outerWidth();return t*this.cy().zoom()}},height:function(){var e=this[0];if(e&&e.isNode()){var t=e._private.style.height;return"auto"===t.strValue?e._private.autoHeight:t.pxValue}},outerHeight:function(){var e=this[0];if(e){var n=e._private.style,i="auto"===n.height.strValue?e._private.autoHeight:n.height.pxValue,a=n["border-width"]?n["border-width"].pxValue*t+r:0;return i+a}},renderedHeight:function(){var e=this[0];if(e){var t=e.height();return t*this.cy().zoom()}},renderedOuterHeight:function(){var e=this[0];if(e){var t=e.outerHeight();return t*this.cy().zoom()}},renderedBoundingBox:function(e){var t=this.boundingBox(e),r=this.cy(),n=r.zoom(),i=r.pan(),a=t.x1*n+i.x,o=t.x2*n+i.x,s=t.y1*n+i.y,l=t.y2*n+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},boundingBox:function(t){var r=this;t=e.util.extend({includeNodes:!0,includeEdges:!0,includeLabels:!0},t),this.cy().recalculateRenderedStyle();for(var n=1/0,i=-1/0,a=1/0,o=-1/0,s=0;s<r.length;s++){var l,c,u,d,p,h,g=r[s],v=!1;if("none"!==g.css("display")){if(g.isNode()&&t.includeNodes){v=!0;var f=g._private.position;p=f.x,h=f.y;var y=g.outerWidth(),m=y/2,b=g.outerHeight(),x=b/2;l=p-m,c=p+m,u=h-x,d=h+x,n=n>l?l:n,i=c>i?c:i,a=a>u?u:a,o=d>o?d:o}else if(g.isEdge()&&t.includeEdges){v=!0;var w=g.source()[0]._private.position,_=g.target()[0]._private.position,E=g._private.rstyle||{};if(l=w.x,c=_.x,u=w.y,d=_.y,l>c){var S=l;l=c,c=S}if(u>d){var S=u;u=d,d=S}n=n>l?l:n,i=c>i?c:i,a=a>u?u:a,o=d>o?d:o;for(var P=E.bezierPts||[],y=g._private.style.width.pxValue,k=0;k<P.length;k++){var C=P[k];n=C.x-y<n?C.x-y:n,i=C.x+y>i?C.x+y:i,a=C.y-y<a?C.y-y:a,o=C.y+y>o?C.y+y:o}}var D=g._private.style,E=g._private.rstyle,N=D.content.strValue,M=D["font-size"],T=D["text-halign"],z=D["text-valign"],I=E.labelWidth,B=E.labelHeight,R=E.labelX,X=E.labelY;if(v&&t.includeLabels&&N&&M&&null!=B&&null!=I&&null!=R&&null!=X&&T&&z){var O,L,Y,V,A=B,F=I;if(g.isEdge())O=R-F/2,L=R+F/2,Y=X-A/2,V=X+A/2;else{switch(T.value){case"left":O=R-F,L=R;break;case"center":O=R-F/2,L=R+F/2;break;case"right":O=R,L=R+F}switch(z.value){case"top":Y=X-A,V=X;break;case"center":Y=X-A/2,V=X+A/2;break;case"bottom":Y=X,V=X+A}}n=n>O?O:n,i=L>i?L:i,a=a>Y?Y:a,o=V>o?V:o}}}return{x1:n,x2:i,y1:a,y2:o,w:i-n,h:o-a}}})}(cytoscape),function(e){"use strict";function t(e){return function(t){var r=this;if(void 0===t&&(t=!0),0!==r.length&&r.isNode()&&!r.removed()){for(var n=0,i=r[0],a=i._private.edges,o=0;o<a.length;o++){var s=a[o];(t||!s.isLoop())&&(n+=e(i,s))}return n}}}function r(e,t){return function(r){for(var n,i=this.nodes(),a=0;a<i.length;a++){var o=i[a],s=o[e](r);void 0===s||void 0!==n&&!t(s,n)||(n=s)}return n}}e.fn.eles({degree:t(function(e,t){return t.source().same(t.target())?2:1}),indegree:t(function(e,t){return t.target().same(e)?1:0}),outdegree:t(function(e,t){return t.source().same(e)?1:0})}),e.fn.eles({minDegree:r("degree",function(e,t){return t>e}),maxDegree:r("degree",function(e,t){return e>t}),minIndegree:r("indegree",function(e,t){return t>e}),maxIndegree:r("indegree",function(e,t){return e>t}),minOutdegree:r("outdegree",function(e,t){return t>e}),maxOutdegree:r("outdegree",function(e,t){return e>t})}),e.fn.eles({totalDegree:function(e){for(var t=0,r=this.nodes(),n=0;n<r.length;n++)t+=r[n].degree(e);return t}})}(cytoscape),function(e){"use strict";e.fn.eles({on:e.define.on(),one:e.define.on({unbindSelfOnTrigger:!0}),once:e.define.on({unbindAllBindersOnTrigger:!0}),off:e.define.off(),trigger:e.define.trigger(),rtrigger:function(e,t){return 0!==this.length?(this.cy().notify({type:e,collection:this.filter(function(){return!this.removed()})}),this.trigger(e,t),this):void 0}}),e.elesfn.bind=e.elesfn.on,e.elesfn.unbind=e.elesfn.off}(cytoscape),function(e){"use strict";e.fn.eles({nodes:function(e){return this.filter(function(e,t){return t.isNode()}).filter(e)},edges:function(e){return this.filter(function(e,t){return t.isEdge()}).filter(e)},filter:function(t){var r=this._private.cy;if(e.is.fn(t)){for(var n=[],i=0;i<this.length;i++){var a=this[i];t.apply(a,[i,a])&&n.push(a)}return new e.Collection(r,n)}return e.is.string(t)||e.is.elementOrCollection(t)?new e.Selector(t).filter(this):void 0===t?this:new e.Collection(r)},not:function(t){var r=this._private.cy;if(t){e.is.string(t)&&(t=this.filter(t));for(var n=[],i=0;i<this.length;i++){var a=this[i],o=t._private.ids[a.id()];o||n.push(a)}return new e.Collection(r,n)}return this},intersect:function(t){var r=this._private.cy;if(e.is.string(t)){var n=t;return this.filter(n)}var i=[],a=this,o=t,s=this.length<t.length,l=s?a._private.ids:o._private.ids,c=s?o._private.ids:a._private.ids;for(var u in l){var d=c[u];d&&i.push(d)}return new e.Collection(r,i)},add:function(t){var r=this._private.cy;if(!t)return this;if(e.is.string(t)){var n=t;t=r.elements(n)}for(var i=[],a=0;a<this.length;a++)i.push(this[a]);for(var a=0;a<t.length;a++){var o=!this._private.ids[t[a].id()];o&&i.push(t[a])}return new e.Collection(r,i)}})}(cytoscape),function(e){"use strict";e.fn.eles({isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},isLoop:function(){return this.isEdge()&&this.source().id()===this.target().id()},group:function(){var e=this[0];return e?e._private.group:void 0}})}(cytoscape),function(e){"use strict";e.fn.eles({each:function(t){if(e.is.fn(t))for(var r=0;r<this.length;r++){var n=this[r],i=t.apply(n,[r,n]);if(i===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(t,r){var n=[],i=this.length;null==r&&(r=i),null==t&&(t=0),0>t&&(t=i+t),0>r&&(r=i+r);for(var a=t;a>=0&&r>a&&i>a;a++)n.push(this[a]);return new e.Collection(this.cy(),n)},size:function(){return this.length},eq:function(t){return this[t]||new e.Collection(this.cy())},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(t){if(!e.is.fn(t))return this;var r=this.cy(),n=this.toArray().sort(t);return new e.Collection(r,n)},sortByZIndex:function(){return this.sort(e.Collection.zIndexSort)},zDepth:function(){var e=this[0];if(!e)return void 0;var t=e._private,r=t.group;if("nodes"===r)return t.data.parent?e.parents().size():0;var n=t.source,i=t.target,a=n._private.data.parent?n.parents().size():0,o=i._private.data.parent?i.parents().size():0;return Math.max(a-1,o-1,0)+.5}}),e.Collection.zIndexSort=function(e,t){var r=e.cy(),n=e._private,i=t._private,a=n.style["z-index"].value-i.style["z-index"].value,o=0,s=0,l=r.hasCompoundNodes(),c="nodes"===n.group,u="edges"===n.group,d="nodes"===i.group,p="edges"===i.group;l&&(o=e.zDepth(),s=t.zDepth());var h=o-s,g=0===h;return g?c&&p?1:u&&d?-1:0===a?n.index-i.index:a:h}}(cytoscape),function(e){"use strict";e.fn.eles({updateStyle:function(e){var t=this._private.cy,r=t.style();e=e||void 0===e?!0:!1,r.apply(this);var n=this.updateCompoundBounds();return e?this.add(n).rtrigger("style"):this.add(n).trigger("style"),this},updateMappers:function(e){var t=this._private.cy,r=t.style();e=e||void 0===e?!0:!1,r.updateMappers(this);var n=this.updateCompoundBounds();return e?this.add(n).rtrigger("style"):this.add(n).trigger("style"),this},renderedCss:function(e){var t=this[0];if(t){var r=t.cy().style().getRenderedStyle(t);return void 0===e?r:r[e]}},css:function(t,r){var n=this.cy().style();if(e.is.plainObject(t)){var i=t;n.applyBypass(this,i);var a=this.updateCompoundBounds();this.add(a).rtrigger("style")}else if(e.is.string(t)){if(void 0===r){var o=this[0];return o?o._private.style[t].strValue:void 0}n.applyBypass(this,t,r);var a=this.updateCompoundBounds();this.add(a).rtrigger("style")}else if(void 0===t){var o=this[0];return o?n.getRawStyle(o):void 0}return this},removeCss:function(){for(var e=this.cy().style(),t=this,r=0;r<t.length;r++){var n=t[r];e.removeAllBypasses(n)}var i=this.updateCompoundBounds();this.add(i).rtrigger("style")},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},visible:function(){var e=this[0];if(e){var t=e._private.style;if("visible"!==t.visibility.value||"element"!==t.display.value)return!1;if("nodes"===e._private.group){var r=e._private.data.parent?e.parents():null;if(r)for(var n=0;n<r.length;n++){var i=r[n],a=i._private.style,o=a.visibility.value,s=a.display.value;if("visible"!==o||"element"!==s)return!1}return!0}var l=e._private.source,c=e._private.target;return l.visible()&&c.visible()}},hidden:function(){var e=this[0];return e?!e.visible():void 0},effectiveOpacity:function(){var e=this[0];if(e){var t=e._private.style.opacity.value,r=e._private.data.parent?e.parents():null;if(r)for(var n=0;n<r.length;n++){var i=r[n],a=i._private.style.opacity.value;t=a*t}return t}},transparent:function(){var e=this[0];return e?0===e.effectiveOpacity():void 0},isFullAutoParent:function(){var e=this[0];if(e){var t="auto"===e._private.style.width.value,r="auto"===e._private.style.height.value;return e.isParent()&&t&&r}}}),e.elesfn.style=e.elesfn.css,e.elesfn.renderedStyle=e.elesfn.renderedCss,e.elesfn.removeStyle=e.elesfn.removeCss}(cytoscape),function(e){"use strict";function t(e){return function(){var t=arguments;if(2===t.length){var r=t[0],n=t[1];this.bind(e.event,r,n)}else if(1===t.length){var n=t[0];this.bind(e.event,n)}else if(0===t.length){for(var i=0;i<this.length;i++){var a=this[i];(!e.ableField||a._private[e.ableField])&&(a._private[e.field]=e.value)}this.updateStyle(),this.trigger(e.event)}return this}}function r(r){e.elesfn[r.field]=function(){var e=this[0];if(e){if(r.altFieldFn){var t=r.altFieldFn(e);if(void 0!==t)return t}return e._private[r.field]}},e.elesfn[r.on]=t({event:r.on,field:r.field,ableField:r.ableField,value:!0}),e.elesfn[r.off]=t({event:r.off,field:r.field,ableField:r.ableField,value:!1})}r({field:"locked",altFieldFn:function(e){return e.cy().autolockNodes()?!0:void 0},on:"lock",off:"unlock"}),r({field:"grabbable",altFieldFn:function(e){return e.cy().autoungrabifyNodes()?!1:void 0},on:"grabify",off:"ungrabify"}),r({field:"selected",ableField:"selectable",on:"select",off:"unselect"}),r({field:"selectable",on:"selectify",off:"unselectify"}),e.elesfn.grabbed=function(){var e=this[0];return e?e._private.grabbed:void 0},r({field:"active",on:"activate",off:"unactivate"}),e.elesfn.inactive=function(){var e=this[0];return e?!e._private.active:void 0}}(cytoscape),function(e){"use strict";function t(t){return function(r){for(var n=[],i=this._private.cy,a=0;a<this.length;a++){var o=this[a],s=o._private[t.attr];s&&n.push(s)}return new e.Collection(i,n).filter(r)}}function r(t){return function(r){var n=[],i=this._private.cy,a=t||{};e.is.string(r)&&(r=i.$(r));for(var o=r.connectedEdges(),s=this._private.ids,l=0;l<o.length;l++){var c,u=o[l],d=u._private.data;if(a.thisIs){var p=d[a.thisIs];c=s[p]}else c=s[d.source]||s[d.target];c&&n.push(u)}return new e.Collection(i,n)}}function n(t){var r={codirected:!1};return t=e.util.extend({},r,t),function(r){for(var n=this._private.cy,i=[],a=this.edges(),o=t,s=0;s<a.length;s++)for(var l=a[s],c=l.source()[0],u=c.id(),d=l.target()[0],p=d.id(),h=c._private.edges,g=0;g<h.length;g++){var v=h[g],f=v._private.data,y=f.target,m=f.source,b=y===p&&m===u,x=u===y&&p===m;(o.codirected&&b||!o.codirected&&(b||x))&&i.push(v)}return new e.Collection(n,i).filter(r)}}e.fn.eles({roots:function(t){for(var r=this,n=[],i=0;i<r.length;i++){var a=r[i];if(a.isNode()){var o;!function(){o=a.connectedEdges(function(){return this.data("target")===a.id()&&this.data("source")!==a.id()}).length>0}(),o||n.push(a)}}return new e.Collection(this._private.cy,n).filter(t)},forwardNodes:function(t){for(var r=this,n=[],i=0;i<r.length;i++){var a=r[i],o=a.id();if(a.isNode())for(var s=a._private.edges,l=0;l<s.length;l++){var c=s[l],u=c._private.data.source,d=c._private.data.target;u===o&&d!==o&&n.push(c.target()[0])}}return new e.Collection(this._private.cy,n).filter(t)},backwardNodes:function(t){for(var r=this,n=[],i=0;i<r.length;i++){var a=r[i],o=a.id();if(a.isNode())for(var s=a._private.edges,l=0;l<s.length;l++){var c=s[l],u=c._private.data.source,d=c._private.data.target;d===o&&u!==o&&n.push(c.source()[0])}}return new e.Collection(this._private.cy,n).filter(t)}}),e.fn.eles({neighborhood:function(t){for(var r=[],n=this._private.cy,i=this.nodes(),a=0;a<i.length;a++)for(var o=i[a],s=o.connectedEdges(),l=0;l<s.length;l++){var c=s[l],u=c.connectedNodes().not(o);u.length>0&&r.push(u[0]),r.push(c[0])}return new e.Collection(n,r).filter(t)},closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),e.fn.eles({source:function(t){var r,n=this[0];return n&&(r=n._private.source),new e.Collection(this.cy(),r).filter(t)},target:function(t){var r,n=this[0];return n&&(r=n._private.target),new e.Collection(this.cy(),r).filter(t)},sources:t({attr:"source"}),targets:t({attr:"target"})}),e.fn.eles({edgesWith:r(),edgesTo:r({thisIs:"source"})}),e.fn.eles({connectedEdges:function(t){for(var r=[],n=this._private.cy,i=this,a=0;a<i.length;a++){var o=i[a];if(o.isNode())for(var s=o._private.edges,l=0;l<s.length;l++){var c=s[l];r.push(c)}}return new e.Collection(n,r).filter(t)},connectedNodes:function(t){for(var r=[],n=this._private.cy,i=this,a=0;a<i.length;a++){var o=i[a];o.isEdge()&&(r.push(o.source()[0]),r.push(o.target()[0]))}return new e.Collection(n,r).filter(t)},parallelEdges:n(),codirectedEdges:n({codirected:!0})})}(cytoscape),function(e){"use strict";e.Minheap=function(t,r,n){return new e.Heap(t,r,e.Heap.minHeapComparator,n)},e.Maxheap=function(t,r,n){return new e.Heap(t,r,e.Heap.maxHeapComparator,n)},e.Heap=function(t,r,n,i){if("undefined"!=typeof n&&"undefined"!=typeof r){"undefined"==typeof i&&(i=e.Heap.idFn);var a,o,s,l=[],c={},u=[],d=0;for(r=this.getArgumentAsCollection(r,t),s=r.length,d=0;s>d;d+=1){if(l.push(i.call(t,r[d],d,r)),a=r[d].id(),c.hasOwnProperty(a))throw"ERROR: Multiple items with the same id found: "+a;c[a]=d,u.push(a)}for(this._private={cy:t,heap:l,pointers:c,elements:u,comparator:n,extractor:i,length:s},d=Math.floor(s/2);d>=0;d-=1)o=this.heapify(d);return o}},e.Heap.idFn=function(e){return e.id()},e.Heap.minHeapComparator=function(e,t){return e>=t},e.Heap.maxHeapComparator=function(e,t){return t>=e},e.fn.heap=function(t){for(var r in t){var n=t[r];e.Heap.prototype[r]=n}},e.heapfn=e.Heap.prototype,e.heapfn.size=function(){return this._private.length},e.heapfn.getArgumentAsCollection=function(t,r){var n;if("undefined"==typeof r&&(r=this._private.cy),e.is.elementOrCollection(t))n=t;else{for(var i=[],a=[].concat.apply([],[t]),o=0;o<a.length;o++){var s=a[o],l=r.getElementById(s);l.length>0&&i.push(l)}n=new e.Collection(r,i)}return n},e.heapfn.isHeap=function(){var e,t,r,n,i,a=this._private.heap,o=a.length,s=this._private.comparator;for(e=0;o>e;e+=1)if(t=2*e+1,r=t+1,n=o>t?s(a[t],a[e]):!0,i=o>r?s(a[r],a[e]):!0,!n||!i)return!1;return!0},e.heapfn.heapSwap=function(e,t){var r=this._private.heap,n=this._private.pointers,i=this._private.elements,a=r[e],o=i[e],s=i[e],l=i[t];r[e]=r[t],i[e]=i[t],n[s]=t,n[l]=e,r[t]=a,i[t]=o},e.heapfn.heapify=function(e,t){var r,n,i,a,o,s,l,c=0,u=!1;for("undefined"==typeof t&&(t=!0),r=this._private.heap,c=r.length,s=this._private.comparator,n=e;!u;)t?(i=2*n+1,a=i+1,o=n,c>i&&!s(r[i],r[o])&&(o=i),c>a&&!s(r[a],r[o])&&(o=a),u=o===n,u||(this.heapSwap(o,n),n=o)):(l=Math.floor((n-1)/2),o=n,u=0>l||s(r[o],r[l]),u||(this.heapSwap(o,l),n=l))},e.heapfn.insert=function(e){var t,r,n,i,a,o=this.getArgumentAsCollection(e),s=o.length;for(a=0;s>a;a+=1){if(t=o[a],r=this._private.heap.length,n=this._private.extractor(t),i=t.id(),this._private.pointers.hasOwnProperty(i))throw"ERROR: Multiple items with the same id found: "+i;this._private.heap.push(n),this._private.elements.push(i),this._private.pointers[i]=r,this.heapify(r,!1)}this._private.length=this._private.heap.length},e.heapfn.getValueById=function(e){if(this._private.pointers.hasOwnProperty(e)){var t=this._private.pointers[e];return this._private.heap[t]}},e.heapfn.contains=function(e){for(var t=this.getArgumentAsCollection(e),r=0;r<t.length;r+=1){var n=t[r].id();if(!this._private.pointers.hasOwnProperty(n))return!1}return!0},e.heapfn.top=function(){return this._private.length>0?{value:this._private.heap[0],id:this._private.elements[0]}:void 0},e.heapfn.pop=function(){if(this._private.length>0){var e,t,r,n=this.top(),i=this._private.length-1;return this.heapSwap(0,i),e=this._private.elements[i],t=this._private.heap[i],r=e,this._private.heap.pop(),this._private.elements.pop(),this._private.length=this._private.heap.length,delete this._private.pointers[r],this.heapify(0),n}},e.heapfn.findDirectionHeapify=function(e){var t=Math.floor((e-1)/2),r=this._private.heap,n=0>t||this._private.comparator(r[e],r[t]);this.heapify(e,n)},e.heapfn.edit=function(t,r){for(var n=this.getArgumentAsCollection(t),i=0;i<n.length;i+=1){var a=n[i].id(),o=this._private.pointers[a],s=this._private.heap[o];e.is.number(r)?this._private.heap[o]=r:e.is.fn(r)&&(this._private.heap[o]=r.call(this._private.cy,s,o)),this.findDirectionHeapify(o)}},e.heapfn.delete=function(e){for(var t=this.getArgumentAsCollection(e),r=0;r<t.length;r+=1){var n,i,a,o=t[r].id(),s=this._private.pointers[o],l=this._private.length-1;s!==l&&this.heapSwap(s,l),n=this._private.elements[l],i=this._private.heap[l],a=n,this._private.heap.pop(),this._private.elements.pop(),this._private.length=this._private.heap.length,delete this._private.pointers[a],this.findDirectionHeapify(s)}return i}}(cytoscape),function(e){"use strict";function t(e){t.CANVAS_LAYERS=5,t.SELECT_BOX=0,t.DRAG=2,t.NODE=4,t.TEXTURE_BUFFER=0,t.BUFFER_COUNT=2,this.options=e,this.data={select:[void 0,void 0,void 0,void 0,0],renderer:this,cy:e.cy,container:e.cy.container(),canvases:new Array(t.CANVAS_LAYERS),contexts:new Array(t.CANVAS_LAYERS),canvasNeedsRedraw:new Array(t.CANVAS_LAYERS),bufferCanvases:new Array(t.BUFFER_COUNT),bufferContexts:new Array(t.CANVAS_LAYERS)},this.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},this.timeoutData={panTimeout:null},this.dragData={possibleDragElements:[]},this.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},this.zoomData={freeToZoom:!1,lastPointerX:null},this.redraws=0,this.bindings=[],this.data.canvasContainer=document.createElement("div");var r=this.data.canvasContainer.style;r.position="absolute",r.zIndex="0",r.overflow="hidden",this.data.container.appendChild(this.data.canvasContainer);for(var n=0;n<t.CANVAS_LAYERS;n++)this.data.canvases[n]=document.createElement("canvas"),this.data.contexts[n]=this.data.canvases[n].getContext("2d"),this.data.canvases[n].style.position="absolute",this.data.canvases[n].setAttribute("data-id","layer"+n),this.data.canvases[n].style.zIndex=String(t.CANVAS_LAYERS-n),this.data.canvasContainer.appendChild(this.data.canvases[n]),this.data.canvasNeedsRedraw[n]=!1;this.data.topCanvas=this.data.canvases[0],this.data.canvases[t.NODE].setAttribute("data-id","layer"+t.NODE+"-node"),this.data.canvases[t.SELECT_BOX].setAttribute("data-id","layer"+t.SELECT_BOX+"-selectbox"),this.data.canvases[t.DRAG].setAttribute("data-id","layer"+t.DRAG+"-drag");for(var n=0;n<t.BUFFER_COUNT;n++)this.data.bufferCanvases[n]=document.createElement("canvas"),this.data.bufferContexts[n]=this.data.bufferCanvases[n].getContext("2d"),this.data.bufferCanvases[n].style.position="absolute",this.data.bufferCanvases[n].setAttribute("data-id","buffer"+n),this.data.bufferCanvases[n].style.zIndex=String(-n-1),this.data.bufferCanvases[n].style.visibility="hidden",this.data.canvasContainer.appendChild(this.data.bufferCanvases[n]);this.hideEdgesOnViewport=e.hideEdgesOnViewport,this.hideLabelsOnViewport=e.hideLabelsOnViewport,this.textureOnViewport=e.textureOnViewport,this.load()}t.panOrBoxSelectDelay=400,t.isTouch=e.is.touch();var r="undefined"!=typeof Path2D;t.usePaths=function(){return r},t.prototype.notify=function(e){switch(e.type){case"destroy":return void this.destroy();case"add":case"remove":case"load":this.updateNodesCache(),this.updateEdgesCache();break;case"viewport":this.data.canvasNeedsRedraw[t.SELECT_BOX]=!0;break;case"style":this.updateCachedZSortedEles()}("load"===e.type||"resize"===e.type)&&(this.invalidateContainerClientCoordsCache(),this.matchCanvasSize(this.data.container)),this.data.canvasNeedsRedraw[t.NODE]=!0,this.redraw()},t.prototype.destroy=function(){this.destroyed=!0;for(var e=0;e<this.bindings.length;e++){var t=this.bindings[e],r=t;r.target.removeEventListener(r.event,r.handler,r.useCapture)}};for(var n in e.math)t.prototype[n]=e.math[n];e("renderer","canvas",t)}(cytoscape),function(e){"use strict";var t=e("renderer","canvas"),r=t.prototype,n=t.arrowShapes={};t.arrowShapeHeight=.3;var i=function(e,t,r,n,i,a){var o=r-i/2,s=r+i/2,l=n-a/2,c=n+a/2;return e>=o&&s>=e&&t>=l&&c>=t};n.arrow={_points:[-.15,-.3,0,0,.15,-.3],collide:function(t,r,i,a,o,s,l,c){var u=n.arrow._points;return e.math.pointInsidePolygon(t,r,u,i,a,o,s,l,c)},roughCollide:i,draw:function(e){for(var t=n.arrow._points,r=0;r<t.length/2;r++)e.lineTo(t[2*r],t[2*r+1])},spacing:function(){return 0},gap:function(e){return 2*e._private.style.width.pxValue}},n.triangle=n.arrow,n.none={collide:function(){return!1},roughCollide:function(){return!1},draw:function(){},spacing:function(){return 0},gap:function(){return 0}},n.circle={_baseRadius:.15,collide:function(e,t,r,i,a,o,s,l){if(a!=o){var c=(o+l)/(a+l);return t/=c,i/=c,Math.pow(r-e,2)+Math.pow(i-t,2)<=Math.pow((a+l)*n.circle._baseRadius,2)}return Math.pow(r-e,2)+Math.pow(i-t,2)<=Math.pow((a+l)*n.circle._baseRadius,2)},roughCollide:i,draw:function(e){e.arc(0,0,n.circle._baseRadius,0,2*Math.PI,!1)},spacing:function(e){return r.getArrowWidth(e._private.style.width.pxValue)*n.circle._baseRadius},gap:function(e){return 2*e._private.style.width.pxValue}},n.inhibitor={_points:[-.25,0,-.25,-.1,.25,-.1,.25,0],collide:function(t,r,i,a,o,s,l,c){var u=n.inhibitor._points;return e.math.pointInsidePolygon(t,r,u,i,a,o,s,l,c)},roughCollide:i,draw:function(e){for(var t=n.inhibitor._points,r=0;r<t.length/2;r++)e.lineTo(t[2*r],t[2*r+1])},spacing:function(){return 4},gap:function(){return 4}},n.tee=n.inhibitor,n.square={_points:[-.12,0,.12,0,.12,-.24,-.12,-.24],collide:function(t,r,i,a,o,s,l,c){var u=n.square._points;return e.math.pointInsidePolygon(t,r,u,i,a,o,s,l,c)},roughCollide:i,draw:function(e){for(var t=n.square._points,r=0;r<t.length/2;r++)e.lineTo(t[2*r],t[2*r+1])},spacing:function(){return 0},gap:function(e){return 2*e._private.style.width.pxValue}},n.diamond={_points:[-.14,-.14,0,-.28,.14,-.14,0,0],collide:function(t,r,i,a,o,s,l,c){var u=n.diamond._points;return e.math.pointInsidePolygon(t,r,u,i,a,o,s,l,c)},roughCollide:i,draw:function(e){e.lineTo(-.14,-.14),e.lineTo(0,-.28),e.lineTo(.14,-.14),e.lineTo(0,0)},spacing:function(){return 0},gap:function(e){return 2*e._private.style.width.pxValue}}}(cytoscape),function(e){"use strict";var t=e("renderer","canvas");t.prototype.getCachedNodes=function(){var e=this.data,t=this.data.cy;return null==e.cache&&(e.cache={}),null==e.cache.cachedNodes&&(e.cache.cachedNodes=t.nodes()),e.cache.cachedNodes},t.prototype.updateNodesCache=function(){var e=this.data,t=this.data.cy;null==e.cache&&(e.cache={}),e.cache.cachedNodes=t.nodes()},t.prototype.getCachedEdges=function(){var e=this.data,t=this.data.cy;return null==e.cache&&(e.cache={}),null==e.cache.cachedEdges&&(e.cache.cachedEdges=t.edges()),e.cache.cachedEdges},t.prototype.updateEdgesCache=function(){var e=this.data,t=this.data.cy;null==e.cache&&(e.cache={}),e.cache.cachedEdges=t.edges()}}(cytoscape),function(e){"use strict";var t=e("renderer","canvas");t.prototype.projectIntoViewport=function(e,t){var r=this.findContainerClientCoords(),n=r[0],i=r[1],a=e-n,o=t-i;return a-=this.data.cy.pan().x,o-=this.data.cy.pan().y,a/=this.data.cy.zoom(),o/=this.data.cy.zoom(),[a,o]},t.prototype.findContainerClientCoords=function(){var e=this.data.container,t=this.containerBB=this.containerBB||e.getBoundingClientRect();return[t.left,t.top,t.right-t.left,t.bottom-t.top]},t.prototype.invalidateContainerClientCoordsCache=function(){this.containerBB=null},t.prototype.findNearestElement=function(r,n,i){function a(e){var a=t.nodeShapes[s.getNodeShape(e)],o=e._private.style["border-width"].pxValue/2,l=s.getNodeWidth(e),u=s.getNodeHeight(e),d=l/2,p=u/2,h=e._private.position,v=e.visible()&&!e.transparent();(!i||v)&&h.x-d<=r&&r<=h.x+d&&h.y-p<=n&&n<=h.y+p&&a.checkPointRough(r,n,o,l+g,u+g,h.x,h.y)&&a.checkPoint(r,n,o,l+g,u+g,h.x,h.y)&&c.push(e)}function o(o){var l=o._private.rscratch,u=o._private.style,d=u.width.pxValue,g=d*d,v=2*d,f=o.visible()&&!o.transparent(),y=o._private.source,m=o._private.target;if(!i||f){if("self"===l.edgeType)(e.math.inBezierVicinity(r,n,l.startX,l.startY,l.cp2ax,l.cp2ay,l.selfEdgeMidX,l.selfEdgeMidY,g)&&g+h>e.math.sqDistanceToQuadraticBezier(r,n,l.startX,l.startY,l.cp2ax,l.cp2ay,l.selfEdgeMidX,l.selfEdgeMidY)||e.math.inBezierVicinity(r,n,l.selfEdgeMidX,l.selfEdgeMidY,l.cp2cx,l.cp2cy,l.endX,l.endY,g)&&g+h>e.math.sqDistanceToQuadraticBezier(r,n,l.selfEdgeMidX,l.selfEdgeMidY,l.cp2cx,l.cp2cy,l.endX,l.endY))&&c.push(o);else if("haystack"==l.edgeType){var b=m._private.position,x=m.width(),w=m.height(),_=y._private.position,E=y.width(),S=y.height(),P=_.x+l.source.x*E,k=_.y+l.source.y*S,C=b.x+l.target.x*x,D=b.y+l.target.y*w;e.math.inLineVicinity(r,n,P,k,C,D,v)&&g+h>e.math.sqDistanceToFiniteLine(r,n,P,k,C,D)&&c.push(o)}else"straight"===l.edgeType?e.math.inLineVicinity(r,n,l.startX,l.startY,l.endX,l.endY,v)&&g+h>e.math.sqDistanceToFiniteLine(r,n,l.startX,l.startY,l.endX,l.endY)&&c.push(o):"bezier"===l.edgeType&&e.math.inBezierVicinity(r,n,l.startX,l.startY,l.cp2x,l.cp2y,l.endX,l.endY,g)&&g+h>e.math.sqDistanceToQuadraticBezier(r,n,l.startX,l.startY,l.cp2x,l.cp2y,l.endX,l.endY)&&c.push(o);if(0===c.length||c[c.length-1]!==o){var N=t.arrowShapes[u["source-arrow-shape"].value],M=t.arrowShapes[u["target-arrow-shape"].value],y=y||o._private.source,m=m||o._private.target,b=m._private.position,_=y._private.position,T=s.getArrowWidth(u.width.pxValue),z=s.getArrowHeight(u.width.pxValue),I=T,B=z;(N.roughCollide(r,n,l.arrowStartX,l.arrowStartY,T,z,[l.arrowStartX-_.x,l.arrowStartY-_.y],0)&&N.collide(r,n,l.arrowStartX,l.arrowStartY,T,z,[l.arrowStartX-_.x,l.arrowStartY-_.y],0)||M.roughCollide(r,n,l.arrowEndX,l.arrowEndY,I,B,[l.arrowEndX-b.x,l.arrowEndY-b.y],0)&&M.collide(r,n,l.arrowEndX,l.arrowEndY,I,B,[l.arrowEndX-b.x,l.arrowEndY-b.y],0))&&c.push(o)}p&&c.length>0&&c[c.length-1]===o&&(a(y),a(m))}}for(var s=this,l=this.getCachedZSortedEles(),c=[],u=t.isTouch,d=this.data.cy.zoom(),p=this.data.cy.hasCompoundNodes(),h=(u?256:32)/d,g=(u?16:0)/d,v=l.length-1;v>=0;v--){var f=l[v];if(c.length>0)break;"nodes"===f._private.group?a(l[v]):o(l[v])}return c.length>0?c[c.length-1]:null},t.prototype.getAllInBox=function(r,n,i,a){var o=this.getCachedNodes(),s=this.getCachedEdges(),l=[],c=Math.min(r,i),u=Math.max(r,i),d=Math.min(n,a),p=Math.max(n,a);r=c,i=u,n=d,a=p;for(var h,g=0;g<o.length;g++){var v=o[g]._private.position,f=this.getNodeShape(o[g]),y=this.getNodeWidth(o[g]),m=this.getNodeHeight(o[g]),b=o[g]._private.style["border-width"].pxValue/2,x=t.nodeShapes[f];x.intersectBox(r,n,i,a,y,m,v.x,v.y,b)&&l.push(o[g])}for(var g=0;g<s.length;g++){var w=s[g]._private.rscratch;if("self"==s[g]._private.rscratch.edgeType&&((h=e.math.boxInBezierVicinity(r,n,i,a,w.startX,w.startY,w.cp2ax,w.cp2ay,w.endX,w.endY,s[g]._private.style.width.pxValue))&&(2==h||1==h&&e.math.checkBezierInBox(r,n,i,a,w.startX,w.startY,w.cp2ax,w.cp2ay,w.endX,w.endY,s[g]._private.style.width.pxValue))||(h=e.math.boxInBezierVicinity(r,n,i,a,w.startX,w.startY,w.cp2cx,w.cp2cy,w.endX,w.endY,s[g]._private.style.width.pxValue))&&(2==h||1==h&&e.math.checkBezierInBox(r,n,i,a,w.startX,w.startY,w.cp2cx,w.cp2cy,w.endX,w.endY,s[g]._private.style.width.pxValue)))&&l.push(s[g]),"bezier"==w.edgeType&&(h=e.math.boxInBezierVicinity(r,n,i,a,w.startX,w.startY,w.cp2x,w.cp2y,w.endX,w.endY,s[g]._private.style.width.pxValue))&&(2==h||1==h&&e.math.checkBezierInBox(r,n,i,a,w.startX,w.startY,w.cp2x,w.cp2y,w.endX,w.endY,s[g]._private.style.width.pxValue))&&l.push(s[g]),"straight"==w.edgeType&&(h=e.math.boxInBezierVicinity(r,n,i,a,w.startX,w.startY,.5*w.startX+.5*w.endX,.5*w.startY+.5*w.endY,w.endX,w.endY,s[g]._private.style.width.pxValue))&&(2==h||1==h&&e.math.checkStraightEdgeInBox(r,n,i,a,w.startX,w.startY,w.endX,w.endY,s[g]._private.style.width.pxValue))&&l.push(s[g]),"haystack"==w.edgeType){var _=s[g].target()[0],E=_.position(),S=s[g].source()[0],P=S.position(),k=P.x+w.source.x,C=P.y+w.source.y,D=E.x+w.target.x,N=E.y+w.target.y,M=k>=r&&i>=k&&C>=n&&a>=C,T=D>=r&&i>=D&&N>=n&&a>=N;M&&T&&l.push(s[g])}}return l},t.prototype.getNodeWidth=function(e){return e.width()},t.prototype.getNodeHeight=function(e){return e.height()},t.prototype.getNodeShape=function(e){var t=e._private.style.shape.value;return e.isParent()?"rectangle"===t||"roundrectangle"===t?t:"rectangle":t},t.prototype.getNodePadding=function(e){var t=e._private.style["padding-left"].pxValue,r=e._private.style["padding-right"].pxValue,n=e._private.style["padding-top"].pxValue,i=e._private.style["padding-bottom"].pxValue;return isNaN(t)&&(t=0),isNaN(r)&&(r=0),isNaN(n)&&(n=0),isNaN(i)&&(i=0),{left:t,right:r,top:n,bottom:i}},t.prototype.zOrderSort=e.Collection.zIndexSort,t.prototype.updateCachedZSortedEles=function(){this.getCachedZSortedEles(!0)},t.prototype.getCachedZSortedEles=function(e){var t=this.lastZOrderCachedNodes,r=this.lastZOrderCachedEdges,n=this.getCachedNodes(),i=this.getCachedEdges(),a=[];if(!e&&t&&r&&t===n&&r===i)a=this.cachedZSortedEles;else{for(var o=0;o<n.length;o++)a.push(n[o]);for(var o=0;o<i.length;o++)a.push(i[o]);a.sort(this.zOrderSort),this.cachedZSortedEles=a}return this.lastZOrderCachedNodes=n,this.lastZOrderCachedEdges=i,a},t.prototype.projectBezier=function(t){function r(e){a.push({x:n(e[0],e[2],e[4],.05),y:n(e[1],e[3],e[5],.05)}),a.push({x:n(e[0],e[2],e[4],.25),y:n(e[1],e[3],e[5],.25)}),a.push({x:n(e[0],e[2],e[4],.4),y:n(e[1],e[3],e[5],.4)}),a.push({x:n(e[0],e[2],e[4],.5),y:n(e[1],e[3],e[5],.5)}),a.push({x:n(e[0],e[2],e[4],.6),y:n(e[1],e[3],e[5],.6)}),a.push({x:n(e[0],e[2],e[4],.75),y:n(e[1],e[3],e[5],.75)}),a.push({x:n(e[0],e[2],e[4],.95),y:n(e[1],e[3],e[5],.95)})}var n=e.math.qbezierAt,i=t._private.rscratch,a=t._private.rstyle.bezierPts=[];"self"===i.edgeType?(r([i.startX,i.startY,i.cp2ax,i.cp2ay,i.selfEdgeMidX,i.selfEdgeMidY]),r([i.selfEdgeMidX,i.selfEdgeMidY,i.cp2cx,i.cp2cy,i.endX,i.endY])):"bezier"===i.edgeType&&r([i.startX,i.startY,i.cp2x,i.cp2y,i.endX,i.endY])},t.prototype.recalculateNodeLabelProjection=function(e){var t=e._private.style.content.strValue;
if(t&&!t.match(/^\s+$/)){var r,n,i=e.outerWidth(),a=e.outerHeight(),o=e._private.position,s=e._private.style["text-halign"].strValue,l=e._private.style["text-valign"].strValue,c=e._private.rscratch,u=e._private.rstyle;switch(s){case"left":r=o.x-i/2;break;case"right":r=o.x+i/2;break;default:r=o.x}switch(l){case"top":n=o.y-a/2;break;case"bottom":n=o.y+a/2;break;default:n=o.y}c.labelX=r,c.labelY=n,u.labelX=r,u.labelY=n,this.applyLabelDimensions(e)}},t.prototype.recalculateEdgeLabelProjection=function(t){var r=t._private.style.content.strValue;if(r&&!r.match(/^\s+$/)){var n,i,a,o,s=t._private.rscratch,l=t._private.rstyle;if("self"==s.edgeType)a=s.selfEdgeMidX,o=s.selfEdgeMidY;else if("straight"==s.edgeType)a=(s.startX+s.endX)/2,o=(s.startY+s.endY)/2;else if("bezier"==s.edgeType)a=e.math.qbezierAt(s.startX,s.cp2x,s.endX,.5),o=e.math.qbezierAt(s.startY,s.cp2y,s.endY,.5);else if("haystack"==s.edgeType){var c=t.source().position(),u=t.target().position();a=(c.x+s.source.x+u.x+s.target.x)/2,o=(c.y+s.source.y+u.y+s.target.y)/2}n=a,i=o,s.labelX=n,s.labelY=i,l.labelX=n,l.labelY=i,this.applyLabelDimensions(t)}},t.prototype.applyLabelDimensions=function(e){var t=e._private.rscratch,r=e._private.rstyle,n=this.getLabelText(e),i=this.calculateLabelDimensions(e,n);r.labelWidth=i.width,t.labelWidth=i.width,r.labelHeight=i.height,t.labelHeight=i.height},t.prototype.getLabelText=function(e){var t=e._private.style,r=e._private.style.content.strValue,n=t["text-transform"].value;return"none"==n||("uppercase"==n?r=r.toUpperCase():"lowercase"==n&&(r=r.toLowerCase())),r},t.prototype.calculateLabelDimensions=function(e,t){var r=e._private.style,n=r["font-style"].strValue,i=r["font-size"].pxValue+"px",a=r["font-family"].strValue,o=r["font-variant"].strValue,s=r["font-weight"].strValue,l=e._private.rscratch,c=e._private.labelKey,u=l.labelDimCache||(l.labelDimCache={});if(u[c])return u[c];var d=this.labelCalcDiv;d||(d=this.labelCalcDiv=document.createElement("div"),document.body.appendChild(d));var p=d.style;return p.fontFamily=a,p.fontStyle=n,p.fontSize=i,p.fontVariant=o,p.fontWeight=s,p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.padding="0",p.lineHeight="1",d.innerText=t,u[c]={width:d.clientWidth,height:d.clientHeight},u[c]},t.prototype.recalculateRenderedStyle=function(){this.recalculateEdgeProjections(),this.recalculateLabelProjections()},t.prototype.recalculateLabelProjections=function(){for(var e=this.getCachedNodes(),t=0;t<e.length;t++)this.recalculateNodeLabelProjection(e[t]);for(var r=this.getCachedEdges(),t=0;t<r.length;t++)this.recalculateEdgeLabelProjection(r[t])},t.prototype.recalculateEdgeProjections=function(){var e=this.getCachedEdges();this.findEdgeControlPoints(e)},t.prototype.findEdgeControlPoints=function(r){for(var n,i={},a=this.data.cy,o=[],s=[],l=0;l<r.length;l++){var c=r[l],u=c._private.style;if("none"!==u.display.value)if("haystack"!==u["curve-style"].value){var d=c._private.data.source,p=c._private.data.target;n=d>p?p+"-"+d:d+"-"+p,null==i[n]&&(i[n]=[]),i[n].push(c),o.push(n)}else s.push(c)}for(var h,g,v,f,y,m,b,x,w,_,E,S,P,k,C=0;C<o.length;C++){if(n=o[C],h=a.getElementById(i[n][0]._private.data.source),g=a.getElementById(i[n][0]._private.data.target),v=h._private.position,f=g._private.position,y=this.getNodeWidth(h),m=this.getNodeHeight(h),b=this.getNodeWidth(g),x=this.getNodeHeight(g),w=t.nodeShapes[this.getNodeShape(h)],_=t.nodeShapes[this.getNodeShape(g)],E=h._private.style["border-width"].pxValue,S=g._private.style["border-width"].pxValue,k=!1,i[n].length>1&&h!==g){var D=w.intersectLine(v.x,v.y,y,m,f.x,f.y,E/2),N=_.intersectLine(f.x,f.y,b,x,v.x,v.y,S/2),M={x1:D[0],x2:N[0],y1:D[1],y2:N[1]},T=N[1]-D[1],z=N[0]-D[0],I=Math.sqrt(z*z+T*T),B={x:z,y:T},R={x:B.x/I,y:B.y/I};P={x:-R.y,y:R.x},(_.checkPoint(D[0],D[1],S/2,b,x,f.x,f.y)||w.checkPoint(N[0],N[1],E/2,y,m,v.x,v.y))&&(P={},k=!0)}for(var c,X,l=0;l<i[n].length;l++){c=i[n][l],X=c._private.rscratch;var O=X.lastEdgeIndex,L=l,Y=X.lastNumEdges,V=i[n].length,A=X.lastSrcCtlPtX,F=v.x,q=X.lastSrcCtlPtY,j=v.y,H=X.lastSrcCtlPtW,W=h.outerWidth(),Z=X.lastSrcCtlPtH,$=h.outerHeight(),U=X.lastTgtCtlPtX,G=f.x,K=X.lastTgtCtlPtY,J=f.y,Q=X.lastTgtCtlPtW,et=g.outerWidth(),tt=X.lastTgtCtlPtH,rt=g.outerHeight();if(X.badBezier=k?!0:!1,A!==F||q!==j||H!==W||Z!==$||U!==G||K!==J||Q!==et||tt!==rt||O!==L||Y!==V){X.lastSrcCtlPtX=F,X.lastSrcCtlPtY=j,X.lastSrcCtlPtW=W,X.lastSrcCtlPtH=$,X.lastTgtCtlPtX=G,X.lastTgtCtlPtY=J,X.lastTgtCtlPtW=et,X.lastTgtCtlPtH=rt,X.lastEdgeIndex=L,X.lastNumEdges=V;var nt=c._private.style,it=nt["control-point-step-size"].pxValue,at=void 0!==nt["control-point-distance"]?nt["control-point-distance"].pxValue:void 0,ot=nt["control-point-weight"].value;if(h.id()==g.id())X.edgeType="self",X.cp2ax=v.x,X.cp2ay=v.y-(1+Math.pow(m,1.12)/100)*it*(l/3+1),X.cp2cx=h._private.position.x-(1+Math.pow(y,1.12)/100)*it*(l/3+1),X.cp2cy=v.y,X.selfEdgeMidX=(X.cp2ax+X.cp2cx)/2,X.selfEdgeMidY=(X.cp2ay+X.cp2cy)/2;else if(i[n].length%2==1&&l==Math.floor(i[n].length/2))X.edgeType="straight";else{var st=(.5-i[n].length/2+l)*it,lt=void 0!==at?e.math.signum(st)*at:void 0,ct=void 0!==lt?lt:st,ut={x:M.x1*(1-ot)+M.x2*ot,y:M.y1*(1-ot)+M.y2*ot};X.edgeType="bezier",X.cp2x=ut.x+P.x*ct,X.cp2y=ut.y+P.y*ct}this.findEndpoints(c);var dt=!e.is.number(X.startX)||!e.is.number(X.startY),pt=!e.is.number(X.arrowStartX)||!e.is.number(X.arrowStartY),ht=!e.is.number(X.endX)||!e.is.number(X.endY),gt=!e.is.number(X.arrowEndX)||!e.is.number(X.arrowEndY),vt=3,ft=this.getArrowWidth(c._private.style.width.pxValue)*t.arrowShapeHeight,yt=vt*ft,mt=e.math.distance({x:X.cp2x,y:X.cp2y},{x:X.startX,y:X.startY}),bt=yt>mt,xt=e.math.distance({x:X.cp2x,y:X.cp2y},{x:X.endX,y:X.endY}),wt=yt>xt;if("bezier"===X.edgeType){var _t=!1;if(dt||pt||bt){_t=!0;var Et={x:X.cp2x-v.x,y:X.cp2y-v.y},St=Math.sqrt(Et.x*Et.x+Et.y*Et.y),Pt={x:Et.x/St,y:Et.y/St},kt=Math.max(y,m),Ct={x:X.cp2x+2*Pt.x*kt,y:X.cp2y+2*Pt.y*kt},Dt=w.intersectLine(v.x,v.y,y,m,Ct.x,Ct.y,E/2);bt?(X.cp2x=X.cp2x+Pt.x*(yt-mt),X.cp2y=X.cp2y+Pt.y*(yt-mt)):(X.cp2x=Dt[0]+Pt.x*yt,X.cp2y=Dt[1]+Pt.y*yt)}if(ht||gt||wt){_t=!0;var Et={x:X.cp2x-f.x,y:X.cp2y-f.y},St=Math.sqrt(Et.x*Et.x+Et.y*Et.y),Pt={x:Et.x/St,y:Et.y/St},kt=Math.max(y,m),Ct={x:X.cp2x+2*Pt.x*kt,y:X.cp2y+2*Pt.y*kt},Nt=_.intersectLine(f.x,f.y,b,x,Ct.x,Ct.y,S/2);wt?(X.cp2x=X.cp2x+Pt.x*(yt-xt),X.cp2y=X.cp2y+Pt.y*(yt-xt)):(X.cp2x=Nt[0]+Pt.x*yt,X.cp2y=Nt[1]+Pt.y*yt)}_t&&this.findEndpoints(c)}this.projectBezier(c)}}}for(var l=0;l<s.length;l++){var c=s[l],Mt=c._private.rscratch,Tt=.8;if(!Mt.haystack){var zt=.5*Tt,It=2*Math.random()*Math.PI;Mt.source={x:zt*Math.cos(It),y:zt*Math.sin(It)};var Bt=.5*Tt,It=2*Math.random()*Math.PI;Mt.target={x:Bt*Math.cos(It),y:Bt*Math.sin(It)},Mt.edgeType="haystack",Mt.haystack=!0}}return i},t.prototype.findEndpoints=function(r){var n,i=r.source()[0],a=r.target()[0],o=r._private.style["target-arrow-shape"].value,s=r._private.style["source-arrow-shape"].value,l=a._private.style["border-width"].pxValue,c=i._private.style["border-width"].pxValue,u=r._private.rscratch;if("self"==r._private.rscratch.edgeType){var d=[u.cp2cx,u.cp2cy];n=t.nodeShapes[this.getNodeShape(a)].intersectLine(a._private.position.x,a._private.position.y,this.getNodeWidth(a),this.getNodeHeight(a),d[0],d[1],l/2);var p=e.math.shortenIntersection(n,d,t.arrowShapes[o].spacing(r)),h=e.math.shortenIntersection(n,d,t.arrowShapes[o].gap(r));u.endX=h[0],u.endY=h[1],u.arrowEndX=p[0],u.arrowEndY=p[1];var d=[u.cp2ax,u.cp2ay];n=t.nodeShapes[this.getNodeShape(i)].intersectLine(i._private.position.x,i._private.position.y,this.getNodeWidth(i),this.getNodeHeight(i),d[0],d[1],c/2);var g=e.math.shortenIntersection(n,d,t.arrowShapes[s].spacing(r)),v=e.math.shortenIntersection(n,d,t.arrowShapes[s].gap(r));u.startX=v[0],u.startY=v[1],u.arrowStartX=g[0],u.arrowStartY=g[1]}else if("straight"==u.edgeType){n=t.nodeShapes[this.getNodeShape(a)].intersectLine(a._private.position.x,a._private.position.y,this.getNodeWidth(a),this.getNodeHeight(a),i.position().x,i.position().y,l/2),u.noArrowPlacement=0===n.length?!0:!1;var p=e.math.shortenIntersection(n,[i.position().x,i.position().y],t.arrowShapes[o].spacing(r)),h=e.math.shortenIntersection(n,[i.position().x,i.position().y],t.arrowShapes[o].gap(r));u.endX=h[0],u.endY=h[1],u.arrowEndX=p[0],u.arrowEndY=p[1],n=t.nodeShapes[this.getNodeShape(i)].intersectLine(i._private.position.x,i._private.position.y,this.getNodeWidth(i),this.getNodeHeight(i),a.position().x,a.position().y,c/2),u.noArrowPlacement=0===n.length?!0:!1;var g=e.math.shortenIntersection(n,[a.position().x,a.position().y],t.arrowShapes[s].spacing(r)),v=e.math.shortenIntersection(n,[a.position().x,a.position().y],t.arrowShapes[s].gap(r));u.startX=v[0],u.startY=v[1],u.arrowStartX=g[0],u.arrowStartY=g[1]}else if("bezier"==u.edgeType){var d=[u.cp2x,u.cp2y];n=t.nodeShapes[this.getNodeShape(a)].intersectLine(a._private.position.x,a._private.position.y,this.getNodeWidth(a),this.getNodeHeight(a),d[0],d[1],l/2);var p=e.math.shortenIntersection(n,d,t.arrowShapes[o].spacing(r)),h=e.math.shortenIntersection(n,d,t.arrowShapes[o].gap(r));u.endX=h[0],u.endY=h[1],u.arrowEndX=p[0],u.arrowEndY=p[1],n=t.nodeShapes[this.getNodeShape(i)].intersectLine(i._private.position.x,i._private.position.y,this.getNodeWidth(i),this.getNodeHeight(i),d[0],d[1],c/2);var g=e.math.shortenIntersection(n,d,t.arrowShapes[s].spacing(r)),v=e.math.shortenIntersection(n,d,t.arrowShapes[s].gap(r));u.startX=v[0],u.startY=v[1],u.arrowStartX=g[0],u.arrowStartY=g[1]}else if(u.isArcEdge)return},t.prototype.findEdges=function(e){for(var t=this.getCachedEdges(),r={},n=[],i=0;i<e.length;i++)r[e[i]._private.data.id]=e[i];for(var i=0;i<t.length;i++)(r[t[i]._private.data.source]||r[t[i]._private.data.target])&&n.push(t[i]);return n},t.prototype.getArrowWidth=function(e){return Math.max(Math.pow(13.37*e,.9),29)},t.prototype.getArrowHeight=function(e){return Math.max(Math.pow(13.37*e,.9),29)}}(cytoscape),function(e){"use strict";var t=e("renderer","canvas");t.prototype.drawEdge=function(e,t,r){if(t.visible()){var n=t._private.rscratch;if(!n.badBezier){var i=t._private.style;if(!(i.width.pxValue<=0)){var a=i["overlay-padding"].pxValue,o=i["overlay-opacity"].value,s=i["overlay-color"].value;if(r){if(0===o)return;this.strokeStyle(e,s[0],s[1],s[2],o),e.lineCap="round","self"==t._private.rscratch.edgeType&&(e.lineCap="butt")}else{var l=i["line-color"].value;this.strokeStyle(e,l[0],l[1],l[2],i.opacity.value),e.lineCap="butt"}var c,u,d,p;d=c=t._private.source,p=u=t._private.target;var h=p._private.position,g=p.width(),v=p.height(),f=d._private.position,y=d.width(),m=d.height(),b=i.width.pxValue+(r?2*a:0),x=r?"solid":i["line-style"].value;if(e.lineWidth=b,"haystack"!==n.edgeType&&this.findEndpoints(t),"haystack"===n.edgeType)this.drawStyledEdge(t,e,[n.source.x*y+f.x,n.source.y*m+f.y,n.target.x*g+h.x,n.target.y*v+h.y],x,b);else if("self"===n.edgeType){var w=t._private.rscratch;this.drawStyledEdge(t,e,[w.startX,w.startY,w.cp2ax,w.cp2ay,w.selfEdgeMidX,w.selfEdgeMidY],x,b),this.drawStyledEdge(t,e,[w.selfEdgeMidX,w.selfEdgeMidY,w.cp2cx,w.cp2cy,w.endX,w.endY],x,b)}else if("straight"===n.edgeType){var _=u._private.position.x-c._private.position.x,E=u._private.position.y-c._private.position.y,S=n.endX-n.startX,P=n.endY-n.startY;if(0>_*S+E*P)n.straightEdgeTooShort=!0;else{var w=n;this.drawStyledEdge(t,e,[w.startX,w.startY,w.endX,w.endY],x,b),n.straightEdgeTooShort=!1}}else{var w=n;this.drawStyledEdge(t,e,[w.startX,w.startY,w.cp2x,w.cp2y,w.endX,w.endY],x,b)}"haystack"!==n.edgeType&&n.noArrowPlacement!==!0&&void 0!==n.startX&&this.drawArrowheads(e,t,r)}}}};var r=function(e,t){var r=Math.sqrt(Math.pow(e[4]-e[0],2)+Math.pow(e[5]-e[1],2));r+=Math.sqrt(Math.pow((e[4]+e[0])/2-e[2],2)+Math.pow((e[5]+e[1])/2-e[3],2));var n,i=Math.ceil(r/t);if(!(i>0))return null;n=new Array(2*i);for(var a=0;i>a;a++){var o=a/i;n[2*a]=e[0]*(1-o)*(1-o)+2*e[2]*(1-o)*o+e[4]*o*o,n[2*a+1]=e[1]*(1-o)*(1-o)+2*e[3]*(1-o)*o+e[5]*o*o}return n},n=function(e,t){var r,n=Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(e[3]-e[1],2)),i=Math.ceil(n/t);if(!(i>0))return null;r=new Array(2*i);for(var a=[e[2]-e[0],e[3]-e[1]],o=0;i>o;o++){var s=o/i;r[2*o]=a[0]*s+e[0],r[2*o+1]=a[1]*s+e[1]}return r},i=0,a=0,o=0;t.prototype.drawStyledEdge=function(e,s,l,c,u){var d,p=+new Date,h=this.data.cy,g=h.zoom(),v=e._private.rscratch,f=s,y=!1,m=t.usePaths();if("solid"===c){if(m){for(var b=l,x=v.pathCacheKey&&b.length===v.pathCacheKey.length,w=x,_=0;w&&_<b.length;_++)v.pathCacheKey[_]!==b[_]&&(w=!1);w?(d=s=v.pathCache,y=!0):(d=s=new Path2D,v.pathCacheKey=b,v.pathCache=d)}y||(s.beginPath&&s.beginPath(),s.moveTo(l[0],l[1]),6==l.length?s.quadraticCurveTo(l[2],l[3],l[4],l[5]):s.lineTo(l[2],l[3])),s=f,m?s.stroke(d):s.stroke()}else if("dotted"===c){var E;if(E=6==l.length?r(l,16,!0):n(l,16,!0),!E)return;var S=Math.max(1.6*u,3.4)*g,P=2*S,k=2*S;P=Math.max(P,1),k=Math.max(k,1);var C=this.createBuffer(P,k),D=C[1];D.setTransform(1,0,0,1,0,0),D.clearRect(0,0,P,k),D.fillStyle=s.strokeStyle,D.beginPath(),D.arc(P/2,k/2,.5*S,0,2*Math.PI,!1),D.fill(),s.beginPath();for(var _=0;_<E.length/2;_++)s.drawImage(C[0],E[2*_]-P/2/g,E[2*_+1]-k/2/g,P/g,k/g);s.closePath()}else if("dashed"===c){var E;if(E=6==l.length?r(l,14,!0):n(l,14,!0),!E)return;var P=2*u*g,k=7.8*g;P=Math.max(P,1),k=Math.max(k,1);var C=this.createBuffer(P,k),D=C[1];D.setTransform(1,0,0,1,0,0),D.clearRect(0,0,P,k),s.strokeStyle&&(D.strokeStyle=s.strokeStyle),D.lineWidth=u*h.zoom(),D.beginPath(),D.moveTo(P/2,.2*k),D.lineTo(P/2,.8*k),D.stroke();var N,M,T=!1;4==l.length?(N=[l[2]-l[0],l[3]-E[1]],M=Math.acos((0*N[0]+-1*N[1])/Math.sqrt(N[0]*N[0]+N[1]*N[1])),N[0]<0&&(M=-M+2*Math.PI)):6==l.length&&(T=!0);for(var _=0;_<E.length/2;_++){var z=_/Math.max(E.length/2-1,1);T&&(N=[2*(1-z)*(l[2]-l[0])+2*z*(l[4]-l[2]),2*(1-z)*(l[3]-l[1])+2*z*(l[5]-l[3])],M=Math.acos((0*N[0]+-1*N[1])/Math.sqrt(N[0]*N[0]+N[1]*N[1])),N[0]<0&&(M=-M+2*Math.PI)),s.translate(E[2*_],E[2*_+1]),s.rotate(M),s.translate(-P/2/g,-k/2/g),s.drawImage(C[0],0,0,P/g,k/g),s.translate(P/2/g,k/2/g),s.rotate(-M),s.translate(-E[2*_],-E[2*_+1]),s.closePath()}}else this.drawStyledEdge(e,s,l,"solid",u);var I=+new Date;a+=I-p,o=a/++i,window.avg=o},t.prototype.drawArrowheads=function(e,t,r){if(!r){var n,i,a=t._private.rscratch.arrowStartX,o=t._private.rscratch.arrowStartY,s=t._private.style,l=t.source().position();if(n=a-l.x,i=o-l.y,!(isNaN(a)||isNaN(o)||isNaN(n)||isNaN(i))){var c=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",this.fillStyle(e,255,255,255,1),this.drawArrowShape(e,"filled",s["source-arrow-shape"].value,a,o,n,i),e.globalCompositeOperation=c;var u=s["source-arrow-color"].value;this.fillStyle(e,u[0],u[1],u[2],s.opacity.value),this.drawArrowShape(e,s["source-arrow-fill"].value,s["source-arrow-shape"].value,a,o,n,i)}var d=t._private.rscratch.arrowEndX,p=t._private.rscratch.arrowEndY,h=t.target().position();if(n=d-h.x,i=p-h.y,!(isNaN(d)||isNaN(p)||isNaN(n)||isNaN(i))){var c=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",this.fillStyle(e,255,255,255,1),this.drawArrowShape(e,"filled",s["target-arrow-shape"].value,d,p,n,i),e.globalCompositeOperation=c;var u=s["target-arrow-color"].value;this.fillStyle(e,u[0],u[1],u[2],s.opacity.value),this.drawArrowShape(e,s["target-arrow-fill"].value,s["target-arrow-shape"].value,d,p,n,i)}}},t.prototype.drawArrowShape=function(e,r,n,i,a,o,s){var l=Math.asin(s/Math.sqrt(o*o+s*s));0>o?l+=Math.PI/2:l=-(Math.PI/2+l),e.translate(i,a),e.moveTo(0,0),e.rotate(-l);var c=this.getArrowWidth(e.lineWidth);e.scale(c,c),e.beginPath(),t.arrowShapes[n].draw(e),e.closePath(),"hollow"===r?(e.lineWidth=1/c,e.stroke()):e.fill(),e.scale(1/c,1/c),e.rotate(l),e.translate(-i,-a)}}(cytoscape),function(e){"use strict";var t=e("renderer","canvas");t.prototype.getCachedImage=function(e,t){var r=this,n=r.imageCache=r.imageCache||{};if(n[e]&&n[e].image)return n[e].image;var i=n[e]=n[e]||{},a=i.image=new Image;return a.addEventListener("load",t),a.src=e,a},t.prototype.drawInscribedImage=function(e,r,n){var i=this,a=n._private.position.x,o=n._private.position.y,s=n._private.style,l=s["background-fit"].value,c=s["background-position-x"],u=s["background-position-y"],d=s["background-repeat"].value,p=n.width(),h=n.height(),g=n._private.rscratch,v=s["background-clip"].value,f="node"===v,y=r.width,m=r.height;if("contain"===l){var b=Math.min(p/y,h/m);y*=b,m*=b}else if("cover"===l){var b=Math.max(p/y,h/m);y*=b,m*=b}var x=a-p/2;x+="%"===c.units?(p-y)*c.value/100:c.pxValue;var w=o-h/2;if(w+="%"===u.units?(h-m)*u.value/100:u.pxValue,g.pathCache&&(x-=a,w-=o,a=0,o=0),"no-repeat"===d)f&&(e.save(),g.pathCache?e.clip(g.pathCache):(t.nodeShapes[i.getNodeShape(n)].drawPath(e,a,o,p,h),e.clip())),e.drawImage(r,0,0,r.width,r.height,x,w,y,m),f&&e.restore();else{var _=e.createPattern(r,d);e.fillStyle=_,t.nodeShapes[i.getNodeShape(n)].drawPath(e,a,o,p,h),e.translate(x,w),e.fill(),e.translate(-x,-w)}}}(cytoscape),function(e){"use strict";var t=e("renderer","canvas");t.prototype.drawEdgeText=function(e,t){var r=t._private.style.content.strValue;if(t.visible()&&r&&!r.match(/^\s+$/)&&(!this.hideEdgesOnViewport||!(this.dragData.didDrag||this.pinching||this.hoverData.dragging||this.data.wheel||this.swipePanning))){var n=t._private.style["font-size"].pxValue*t.cy().zoom(),i=t._private.style["min-zoomed-font-size"].pxValue;if(!(i>n)){e.textAlign="center",e.textBaseline="middle",this.recalculateEdgeLabelProjection(t);var a=t._private.rscratch;this.drawText(e,t,a.labelX,a.labelY)}}},t.prototype.drawNodeText=function(e,t){var r=t._private.style.content.strValue;if(t.visible()&&r&&!r.match(/^\s+$/)){var n=t._private.style["font-size"].pxValue*t.cy().zoom(),i=t._private.style["min-zoomed-font-size"].pxValue;if(!(i>n)){this.recalculateNodeLabelProjection(t);var a=t._private.style["text-halign"].strValue,o=t._private.style["text-valign"].strValue,s=t._private.rscratch;switch(a){case"left":e.textAlign="right";break;case"right":e.textAlign="left";break;default:e.textAlign="center"}switch(o){case"top":e.textBaseline="bottom";break;case"bottom":e.textBaseline="top";break;default:e.textBaseline="middle"}this.drawText(e,t,s.labelX,s.labelY)}}},t.prototype.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(t=this.fontCaches[r],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},t.prototype.setupTextStyle=function(e,t){var r=t.effectiveOpacity(),n=t._private.style,i=n["font-style"].strValue,a=n["font-size"].pxValue+"px",o=n["font-family"].strValue,s=n["font-weight"].strValue,l=n["text-opacity"].value*n.opacity.value*r,c=n.color.value,u=n["text-outline-color"].value,d=t._private.fontKey,p=this.getFontCache(e);p.key!==d&&(e.font=i+" "+s+" "+a+" "+o,p.key=d);var h=String(n.content.value),g=n["text-transform"].value;return"none"==g||("uppercase"==g?h=h.toUpperCase():"lowercase"==g&&(h=h.toLowerCase())),e.lineJoin="round",this.fillStyle(e,c[0],c[1],c[2],l),this.strokeStyle(e,u[0],u[1],u[2],l),h},t.prototype.drawText=function(e,t,r,n){var i=t._private.style,a=t.effectiveOpacity();if(0!==a){var o=this.setupTextStyle(e,t);if(null!=o&&!isNaN(r)&&!isNaN(n)){var s=2*i["text-outline-width"].value;s>0&&(e.lineWidth=s,e.strokeText(o,r,n)),e.fillText(o,r,n)}}}}(cytoscape),function(e){"use strict";var t=e("renderer","canvas");t.prototype.drawNode=function(e,r,n){var i,a,o=this,s=r._private.style,l=r._private.rscratch;if(r.visible()){var c,u=t.usePaths(),d=e,p=!1,h=s["overlay-padding"].pxValue,g=s["overlay-opacity"].value,v=s["overlay-color"].value;if(!n||0!==g){var f=r.effectiveOpacity();if(0!==f)if(i=this.getNodeWidth(r),a=this.getNodeHeight(r),e.lineWidth=s["border-width"].pxValue,void 0!==n&&n)g>0&&(this.fillStyle(e,v[0],v[1],v[2],g),t.nodeShapes.roundrectangle.drawPath(e,r._private.position.x,r._private.position.y,i+2*h,a+2*h),e.fill());else{var y=s["background-color"].value,m=s["border-color"].value;this.fillStyle(e,y[0],y[1],y[2],s["background-opacity"].value*s.opacity.value*f),this.strokeStyle(e,m[0],m[1],m[2],s["border-opacity"].value*s.opacity.value*f),e.lineJoin="miter";var b=s["background-image"].value[2]||s["background-image"].value[1],x=s.shape.strValue,w=r._private.position;if(u){var _=x+"$"+i+"$"+a;e.translate(w.x,w.y),l.pathCacheKey===_?(c=e=l.pathCache,p=!0):(c=e=new Path2D,l.pathCacheKey=_,l.pathCache=c)}if(!p){var E=w;u&&(E={x:0,y:0}),t.nodeShapes[this.getNodeShape(r)].drawPath(e,E.x,E.y,i,a)}if(e=d,u?e.fill(c):e.fill(),void 0!==b){var S=this.getCachedImage(b,function(){o.data.canvasNeedsRedraw[t.NODE]=!0,o.data.canvasNeedsRedraw[t.DRAG]=!0,o.redraw()});S.complete&&this.drawInscribedImage(e,S,r)}var P=s["background-blacken"].value;this.hasPie(r)&&(this.drawPie(e,r),0!==P&&(u||t.nodeShapes[this.getNodeShape(r)].drawPath(e,w.x,w.y,i,a))),P>0?(this.fillStyle(e,0,0,0,P),u?e.fill(c):e.fill()):0>P&&(this.fillStyle(e,255,255,255,-P),u?e.fill(c):e.fill()),s["border-width"].pxValue>0&&(u?e.stroke(c):e.stroke()),u&&e.translate(-w.x,-w.y)}}}},t.prototype.hasPie=function(e){return e=e[0],e._private.hasPie},t.prototype.drawPie=function(r,n){n=n[0];var i=n._private.style["pie-size"],a=this.getNodeWidth(n),o=this.getNodeHeight(n),s=n._private.position.x,l=n._private.position.y,c=Math.min(a,o)/2,u=0,d=t.usePaths();"%"===i.units?c=c*i.value/100:void 0!==i.pxValue&&(c=i.pxValue/2),d&&(s=0,l=0);for(var p=1;p<=e.style.pieBackgroundN;p++){var h=n._private.style["pie-"+p+"-background-size"].value,g=n._private.style["pie-"+p+"-background-color"].value,v=h/100,f=1.5*Math.PI+2*Math.PI*u,y=2*Math.PI*v,m=f+y;0===h||u>=1||u+v>1||(r.beginPath(),r.moveTo(s,l),r.arc(s,l,c,f,m),r.closePath(),this.fillStyle(r,g[0],g[1],g[2],1),r.fill(),u+=v)}}}(cytoscape),function(e){"use strict";var t=e("renderer","canvas"),r="undefined"!=typeof InstallTrigger;t.prototype.getPixelRatio=function(){var e=this.data.contexts[0],t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return r?1:(window.devicePixelRatio||1)/t},t.prototype.paintCache=function(e){for(var t,r=this.paintCaches=this.paintCaches||[],n=!0,i=0;i<r.length;i++)if(t=r[i],t.context===e){n=!1;break}return n&&(t={context:e},r.push(t)),t},t.prototype.fillStyle=function(e,t,r,n,i){e.fillStyle="rgba("+t+","+r+","+n+","+i+")"},t.prototype.strokeStyle=function(e,t,r,n,i){e.strokeStyle="rgba("+t+","+r+","+n+","+i+")"},t.prototype.matchCanvasSize=function(e){var r,n=this.data,i=e.clientWidth,a=e.clientHeight,o=this.getPixelRatio(),s=i*o,l=a*o;if(s!==this.canvasWidth||l!==this.canvasHeight){this.fontCaches=null;var c=n.canvasContainer;c.style.width=i+"px",c.style.height=a+"px";for(var u=0;u<t.CANVAS_LAYERS;u++)r=n.canvases[u],(r.width!==s||r.height!==l)&&(r.width=s,r.height=l,r.style.width=i+"px",r.style.height=a+"px");for(var u=0;u<t.BUFFER_COUNT;u++)r=n.bufferCanvases[u],(r.width!==s||r.height!==l)&&(r.width=s,r.height=l,r.style.width=i+"px",r.style.height=a+"px");this.textureMult=1,1>=o&&(r=n.bufferCanvases[t.TEXTURE_BUFFER],this.textureMult=2,r.width=s*this.textureMult,r.height=l*this.textureMult),this.canvasWidth=s,this.canvasHeight=l}},t.prototype.renderTo=function(e,t,r,n){this.redraw({forcedContext:e,forcedZoom:t,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})},t.prototype.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},t.minRedrawLimit=1e3/60,t.maxRedrawLimit=1e3,t.prototype.redraw=function(r){function n(){function e(e,t){e.setTransform(1,0,0,1,0,0),i||void 0!==t&&!t||e.clearRect(0,0,c.canvasWidth,c.canvasHeight),a||(e.translate(m.x,m.y),e.scale(f,f)),l&&e.translate(l.x,l.y),s&&e.scale(s,s)}function r(e,t){for(var r=e.eles,n=0;n<r.length;n++){var i=r[n];i.isNode()?(c.drawNode(t,i),T||c.drawNodeText(t,i),c.drawNode(t,i,!0)):M||(c.drawEdge(t,i),T||c.drawEdgeText(t,i),c.drawEdge(t,i,!0))}}x=+new Date;var n=c.getCachedEdges(),g=d.style()._private.coreStyle,v=d.zoom(),f=void 0!==s?s:v,y=d.pan(),m={x:y.x,y:y.y};l&&(m=l),f*=u,m.x*=u,m.y*=u;var b={drag:{nodes:[],edges:[],eles:[]},nondrag:{nodes:[],edges:[],eles:[]}},w=c.textureOnViewport&&!i&&(c.pinching||c.hoverData.dragging||c.swipePanning||c.data.wheelZooming);if(w){var _;if(!c.textureCache){c.textureCache={},_=c.textureCache.bb=d.boundingBox(),c.textureCache.texture=c.data.bufferCanvases[t.TEXTURE_BUFFER];var E=c.data.bufferContexts[t.TEXTURE_BUFFER];E.setTransform(1,0,0,1,0,0),E.clearRect(0,0,c.canvasWidth*c.textureMult,c.canvasHeight*c.textureMult),c.redraw({forcedContext:E,drawOnlyNodeLayer:!0,forcedPxRatio:u*c.textureMult});var S=c.textureCache.viewport={zoom:d.zoom(),pan:d.pan(),width:c.canvasWidth,height:c.canvasHeight};S.mpan={x:(0-S.pan.x)/S.zoom,y:(0-S.pan.y)/S.zoom}}h[t.DRAG]=!1,h[t.NODE]=!1;var P=p.contexts[t.NODE],k=c.textureCache.texture,k=c.textureCache.texture,S=c.textureCache.viewport;_=c.textureCache.bb,P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,S.width,S.height);var C=g["outside-texture-bg-color"].value,D=g["outside-texture-bg-opacity"].value;c.fillStyle(P,C[0],C[1],C[2],D),P.fillRect(0,0,S.width,S.height);var v=d.zoom();e(P,!1),P.clearRect(S.mpan.x,S.mpan.y,S.width/S.zoom/u,S.height/S.zoom/u),P.drawImage(k,S.mpan.x,S.mpan.y,S.width/S.zoom/u,S.height/S.zoom/u)}else c.textureOnViewport&&!i&&(c.textureCache=null);var N=c.pinching||c.hoverData.dragging||c.swipePanning||c.data.wheelZooming||c.hoverData.draggingEles,M=c.hideEdgesOnViewport&&N,T=c.hideLabelsOnViewport&&N;if(h[t.DRAG]||h[t.NODE]||a||o){M||c.findEdgeControlPoints(n);for(var z=c.getCachedZSortedEles(),I=0;I<z.length;I++){var B,R=z[I];B=R._private.rscratch.inDragLayer?b.drag:b.nondrag,B.eles.push(R)}}if(h[t.NODE]||a||o){var P=i||p.contexts[t.NODE];e(P),r(b.nondrag,P),a||(h[t.NODE]=!1)}if(!o&&(h[t.DRAG]||a)){var P=i||p.contexts[t.DRAG];e(P),r(b.drag,P),a||(h[t.DRAG]=!1)}if(!o&&h[t.SELECT_BOX]&&!a){var P=i||p.contexts[t.SELECT_BOX];if(e(P),1==p.select[4]){var v=p.cy.zoom(),X=g["selection-box-border-width"].value/v;P.lineWidth=X,P.fillStyle="rgba("+g["selection-box-color"].value[0]+","+g["selection-box-color"].value[1]+","+g["selection-box-color"].value[2]+","+g["selection-box-opacity"].value+")",P.fillRect(p.select[0],p.select[1],p.select[2]-p.select[0],p.select[3]-p.select[1]),X>0&&(P.strokeStyle="rgba("+g["selection-box-border-color"].value[0]+","+g["selection-box-border-color"].value[1]+","+g["selection-box-border-color"].value[2]+","+g["selection-box-opacity"].value+")",P.strokeRect(p.select[0],p.select[1],p.select[2]-p.select[0],p.select[3]-p.select[1]))}if(p.bgActivePosistion){var v=p.cy.zoom(),O=p.bgActivePosistion;P.fillStyle="rgba("+g["active-bg-color"].value[0]+","+g["active-bg-color"].value[1]+","+g["active-bg-color"].value[2]+","+g["active-bg-opacity"].value+")",P.beginPath(),P.arc(O.x,O.y,g["active-bg-size"].pxValue/v,0,2*Math.PI),P.fill()}a||(h[t.SELECT_BOX]=!1)}var L=+new Date;void 0===c.averageRedrawTime&&(c.averageRedrawTime=L-x),void 0===c.redrawCount&&(c.redrawCount=0),c.redrawCount++,void 0===c.redrawTotalTime&&(c.redrawTotalTime=0),c.redrawTotalTime+=L-x,c.averageRedrawTime=c.averageRedrawTime/2+(L-x)/2,c.currentlyDrawing=!1}r=r||{};var i=r.forcedContext,a=r.drawAllLayers,o=r.drawOnlyNodeLayer,s=r.forcedZoom,l=r.forcedPan,c=this,u=void 0===r.forcedPxRatio?this.getPixelRatio():r.forcedPxRatio,d=c.data.cy,p=c.data,h=p.canvasNeedsRedraw;this.redrawTimeout&&clearTimeout(this.redrawTimeout),this.redrawTimeout=null,void 0===this.averageRedrawTime&&(this.averageRedrawTime=0);var g=t.minRedrawLimit,v=t.maxRedrawLimit,f=this.averageRedrawTime;f=g>f?g:f,f=v>f?f:v,void 0===this.lastDrawTime&&(this.lastDrawTime=0);var y=+new Date,m=y-this.lastDrawTime,b=m>=f;if(!i){if(!b||this.currentlyDrawing)return void(this.redrawTimeout=setTimeout(function(){c.redraw()},f));this.lastDrawTime=y,this.currentlyDrawing=!0}var x;i?n():e.util.requestAnimationFrame(n),i||c.initrender||(c.initrender=!0,d.trigger("initrender"))}}(cytoscape),function(e){"use strict";var t=e("renderer","canvas");t.prototype.drawPolygonPath=function(e,t,r,n,i,a){var o=n/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],r+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],r+s*a[2*l+1]);e.closePath()},t.prototype.drawPolygon=function(e,t,r,n,i,a){this.drawPolygonPath(e,t,r,n,i,a),e.fill()},t.prototype.drawRoundRectanglePath=function(t,r,n,i,a){var o=i/2,s=a/2,l=e.math.getRoundRectangleRadius(i,a);t.beginPath&&t.beginPath(),t.moveTo(r,n-s),t.arcTo(r+o,n-s,r+o,n,l),t.arcTo(r+o,n+s,r,n+s,l),t.arcTo(r-o,n+s,r-o,n,l),t.arcTo(r-o,n-s,r,n-s,l),t.lineTo(r,n-s),t.closePath()},t.prototype.drawRoundRectangle=function(e,t,r,n,i,a){this.drawRoundRectanglePath(e,t,r,n,i,a),e.fill()}}(cytoscape),function(e){"use strict";var t=e("renderer","canvas");t.prototype.createBuffer=function(e,t){var r=document.createElement("canvas");return r.width=e,r.height=t,[r,r.getContext("2d")]},t.prototype.bufferCanvasImage=function(e){var t=this.data,r=t.cy,n=r.boundingBox(),i=e.full?Math.ceil(n.w):this.data.container.clientWidth,a=e.full?Math.ceil(n.h):this.data.container.clientHeight,o=1;e.full&&void 0!==e.scale&&(i*=e.scale,a*=e.scale,o=e.scale);var s=document.createElement("canvas");s.width=i,s.height=a,s.style.width=i+"px",s.style.height=a+"px";var l=s.getContext("2d");return i>0&&a>0&&(l.clearRect(0,0,i,a),e.bg&&(l.fillStyle=e.bg,l.rect(0,0,i,a),l.fill()),l.globalCompositeOperation="source-over",this.redraw(e.full?{forcedContext:l,drawAllLayers:!0,forcedZoom:o,forcedPan:{x:-n.x1,y:-n.y1},forcedPxRatio:1}:{forcedContext:l,drawAllLayers:!0,forcedZoom:r.zoom(),forcedPan:r.pan(),forcedPxRatio:1})),s},t.prototype.png=function(e){return this.bufferCanvasImage(e).toDataURL("image/png")}}(cytoscape),function(e){"use strict";var t=e("renderer","canvas");t.prototype.registerBinding=function(e,t,r,n){this.bindings.push({target:e,event:t,handler:r,useCapture:n}),e.addEventListener(t,r,n)},t.prototype.nodeIsDraggable=function(e){return 0!==e._private.style.opacity.value&&"visible"==e._private.style.visibility.value&&"element"==e._private.style.display.value&&!e.locked()&&e.grabbable()?!0:!1},t.prototype.load=function(){var r=this,n=function(e,t,r){if(!t)for(var n=e.parents(),i=0;i<n.size();i++)if(n[i]._private.selected)return;for(var a=e.descendants(),i=0;i<a.size();i++)if(t||!a[i]._private.selected){a[i]._private.rscratch.inDragLayer=!0,r.push(a[i]);for(var o=0;o<a[i]._private.edges.length;o++)a[i]._private.edges[o]._private.rscratch.inDragLayer=!0}},i=function(e,t){e._private.grabbed=!0,e._private.rscratch.inDragLayer=!0,t.push(e);for(var r=0;r<e._private.edges.length;r++)e._private.edges[r]._private.rscratch.inDragLayer=!0},a=function(e,t){for(var r=e;r.parent().nonempty();)r=r.parent()[0];if(r!=e||!t)for(var n=r.descendants().add(r),i=0;i<n.size();i++){n[i]._private.rscratch.inDragLayer=t;for(var a=0;a<n[i]._private.edges.length;a++)n[i]._private.edges[a]._private.rscratch.inDragLayer=t}};r.registerBinding(r.data.container,"DOMNodeRemoved",function(){r.destroy()}),r.registerBinding(window,"resize",e.util.debounce(function(){r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.data.container),r.data.canvasNeedsRedraw[t.NODE]=!0,r.redraw()},100));for(var o=function(e){r.registerBinding(e,"scroll",function(){r.invalidateContainerClientCoordsCache()})},s=r.data.cy.container();o(s),s.parentNode;)s=s.parentNode;r.registerBinding(r.data.container,"contextmenu",function(e){e.preventDefault()});var l=function(){return 0!==r.data.select[4]};r.registerBinding(r.data.container,"mousedown",function(o){o.preventDefault(),r.hoverData.capture=!0,r.hoverData.which=o.which;var s=r.data.cy,l=r.projectIntoViewport(o.clientX,o.clientY),c=r.data.select,u=r.findNearestElement(l[0],l[1],!0),d=r.dragData.possibleDragElements,p=new e.Event("grab");if(3==o.which){r.hoverData.cxtStarted=!0;var h=new e.Event(o,{type:"cxttapstart",cyPosition:{x:l[0],y:l[1]}});u?(u.activate(),u.trigger(h),r.hoverData.down=u):s.trigger(h),r.hoverData.downTime=(new Date).getTime(),r.hoverData.cxtDragged=!1}else if(1==o.which){if(u&&u.activate(),null!=u){if(r.nodeIsDraggable(u)){if(u.isNode()&&!u.selected())d=r.dragData.possibleDragElements=[],i(u,d),u.trigger(p),("auto"==u._private.style.width.value||"auto"==u._private.style.height.value)&&n(u,!0,d),a(u,!0);
else if(u.isNode()&&u.selected()){d=r.dragData.possibleDragElements=[];for(var g=!1,v=s.$("node:selected"),f=0;f<v.length;f++)r.nodeIsDraggable(v[f])&&(i(v[f],d),g||(u.trigger(p),g=!0),("auto"==v[f]._private.style.width.value||"auto"==v[f]._private.style.height.value)&&n(v[f],!1,d),a(v[f],!0))}r.data.canvasNeedsRedraw[t.NODE]=!0,r.data.canvasNeedsRedraw[t.DRAG]=!0}u.trigger(new e.Event(o,{type:"mousedown",cyPosition:{x:l[0],y:l[1]}})).trigger(new e.Event(o,{type:"tapstart",cyPosition:{x:l[0],y:l[1]}})).trigger(new e.Event(o,{type:"vmousedown",cyPosition:{x:l[0],y:l[1]}}))}else null==u&&s.trigger(new e.Event(o,{type:"mousedown",cyPosition:{x:l[0],y:l[1]}})).trigger(new e.Event(o,{type:"tapstart",cyPosition:{x:l[0],y:l[1]}})).trigger(new e.Event(o,{type:"vmousedown",cyPosition:{x:l[0],y:l[1]}}));if(r.hoverData.down=u,r.hoverData.downTime=(new Date).getTime(),null==u||u.isEdge()){c[4]=1;var y=Math.max(0,t.panOrBoxSelectDelay-(+new Date-r.hoverData.downTime));clearTimeout(r.bgActiveTimeout),r.bgActiveTimeout=setTimeout(function(){u&&u.unactivate(),r.data.bgActivePosistion={x:l[0],y:l[1]},r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0,r.redraw()},y)}}c[0]=c[2]=l[0],c[1]=c[3]=l[1]},!1),r.registerBinding(window,"mousemove",e.util.throttle(function(n){var i=!1,a=r.hoverData.capture;if(!a){var o=r.findContainerClientCoords();if(!(n.clientX>o[0]&&n.clientX<o[0]+r.canvasWidth&&n.clientY>o[1]&&n.clientY<o[1]+r.canvasHeight&&n.target===r.data.topCanvas))return}var s=r.data.cy,l=r.projectIntoViewport(n.clientX,n.clientY),c=r.data.select,u=null;r.hoverData.draggingEles||(u=r.findNearestElement(l[0],l[1],!0));var d=r.hoverData.last,p=r.hoverData.down,h=[l[0]-c[2],l[1]-c[3]],g=r.dragData.possibleDragElements;if(i=!0,null!=u?u.trigger(new e.Event(n,{type:"mousemove",cyPosition:{x:l[0],y:l[1]}})).trigger(new e.Event(n,{type:"vmousemove",cyPosition:{x:l[0],y:l[1]}})).trigger(new e.Event(n,{type:"tapdrag",cyPosition:{x:l[0],y:l[1]}})):null==u&&s.trigger(new e.Event(n,{type:"mousemove",cyPosition:{x:l[0],y:l[1]}})).trigger(new e.Event(n,{type:"vmousemove",cyPosition:{x:l[0],y:l[1]}})).trigger(new e.Event(n,{type:"tapdrag",cyPosition:{x:l[0],y:l[1]}})),3===r.hoverData.which){var v=new e.Event(n,{type:"cxtdrag",cyPosition:{x:l[0],y:l[1]}});p?p.trigger(v):s.trigger(v),r.hoverData.cxtDragged=!0,r.hoverData.cxtOver&&u===r.hoverData.cxtOver||(r.hoverData.cxtOver&&r.hoverData.cxtOver.trigger(new e.Event(n,{type:"cxtdragout",cyPosition:{x:l[0],y:l[1]}})),r.hoverData.cxtOver=u,u&&u.trigger(new e.Event(n,{type:"cxtdragover",cyPosition:{x:l[0],y:l[1]}})))}else if(r.hoverData.dragging){if(i=!0,s.panningEnabled()&&s.userPanningEnabled()){var f={x:h[0]*s.zoom(),y:h[1]*s.zoom()};s.panBy(f)}l=r.projectIntoViewport(n.clientX,n.clientY)}else if(1==c[4]&&(null==p||p.isEdge())&&(!s.boxSelectionEnabled()||+new Date-r.hoverData.downTime>=t.panOrBoxSelectDelay)&&Math.abs(c[3]-c[1])+Math.abs(c[2]-c[0])<4&&s.panningEnabled()&&s.userPanningEnabled())r.hoverData.dragging=!0,c[4]=0;else{if(s.boxSelectionEnabled()&&Math.pow(c[2]-c[0],2)+Math.pow(c[3]-c[1],2)>7&&c[4]&&(clearTimeout(r.bgActiveTimeout),r.data.bgActivePosistion=void 0,r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0,r.redraw()),p&&p.isEdge()&&p.active()&&p.unactivate(),u!=d&&(d&&(d.trigger(new e.Event(n,{type:"mouseout",cyPosition:{x:l[0],y:l[1]}})),d.trigger(new e.Event(n,{type:"tapdragout",cyPosition:{x:l[0],y:l[1]}}))),u&&(u.trigger(new e.Event(n,{type:"mouseover",cyPosition:{x:l[0],y:l[1]}})),u.trigger(new e.Event(n,{type:"tapdragover",cyPosition:{x:l[0],y:l[1]}}))),r.hoverData.last=u),p&&p.isNode()&&r.nodeIsDraggable(p)){r.dragData.didDrag||(r.data.canvasNeedsRedraw[t.NODE]=!0),r.dragData.didDrag=!0,r.hoverData.draggingEles=!0;for(var y=[],m=0;m<g.length;m++){var b=g[m];if(b.isNode()&&r.nodeIsDraggable(b)){var x=b._private.position;y.push(b),e.is.number(h[0])&&e.is.number(h[1])&&(x.x+=h[0],x.y+=h[1])}}var w=new e.Collection(s,y);w.updateCompoundBounds(),w.trigger("position drag"),r.data.canvasNeedsRedraw[t.DRAG]=!0,r.redraw()}i=!0}return c[2]=l[0],c[3]=l[1],i?(n.stopPropagation&&n.stopPropagation(),n.preventDefault&&n.preventDefault(),!1):void 0},1e3/30),!1),r.registerBinding(window,"mouseup",function(n){var i=r.hoverData.capture;if(i){r.hoverData.capture=!1;var o=r.data.cy,s=r.projectIntoViewport(n.clientX,n.clientY),l=r.data.select,c=r.findNearestElement(s[0],s[1],!0),u=r.dragData.possibleDragElements,d=r.hoverData.down,p=n.shiftKey;if(r.data.bgActivePosistion&&(r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0,r.redraw()),r.data.bgActivePosistion=void 0,clearTimeout(r.bgActiveTimeout),r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,d&&d.unactivate(),3===r.hoverData.which){var h=new e.Event(n,{type:"cxttapend",cyPosition:{x:s[0],y:s[1]}});if(d?d.trigger(h):o.trigger(h),!r.hoverData.cxtDragged){var g=new e.Event(n,{type:"cxttap",cyPosition:{x:s[0],y:s[1]}});d?d.trigger(g):o.trigger(g)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else{if(null!=d||r.dragData.didDrag||Math.pow(l[2]-l[0],2)+Math.pow(l[3]-l[1],2)>7&&l[4]||r.hoverData.dragging||(o.$(":selected").unselect(),u.length>0&&(r.data.canvasNeedsRedraw[t.NODE]=!0),r.dragData.possibleDragElements=u=[]),null!=c?c.trigger(new e.Event(n,{type:"mouseup",cyPosition:{x:s[0],y:s[1]}})).trigger(new e.Event(n,{type:"tapend",cyPosition:{x:s[0],y:s[1]}})).trigger(new e.Event(n,{type:"vmouseup",cyPosition:{x:s[0],y:s[1]}})):null==c&&o.trigger(new e.Event(n,{type:"mouseup",cyPosition:{x:s[0],y:s[1]}})).trigger(new e.Event(n,{type:"tapend",cyPosition:{x:s[0],y:s[1]}})).trigger(new e.Event(n,{type:"vmouseup",cyPosition:{x:s[0],y:s[1]}})),Math.pow(l[2]-l[0],2)+Math.pow(l[3]-l[1],2)===0&&(null!=c?c.trigger(new e.Event(n,{type:"click",cyPosition:{x:s[0],y:s[1]}})).trigger(new e.Event(n,{type:"tap",cyPosition:{x:s[0],y:s[1]}})).trigger(new e.Event(n,{type:"vclick",cyPosition:{x:s[0],y:s[1]}})):null==c&&o.trigger(new e.Event(n,{type:"click",cyPosition:{x:s[0],y:s[1]}})).trigger(new e.Event(n,{type:"tap",cyPosition:{x:s[0],y:s[1]}})).trigger(new e.Event(n,{type:"vclick",cyPosition:{x:s[0],y:s[1]}}))),c!=d||r.dragData.didDrag){if(c==d&&null!=c&&c._private.grabbed){for(var v=o.$(":grabbed"),f=0;f<v.length;f++){var y=v[f];y._private.grabbed=!1;for(var m=y._private.edges,b=0;b<m.length;b++)m[b]._private.rscratch.inDragLayer=!1;a(y,!1)}c.trigger("free")}}else null!=c&&c._private.selectable&&("additive"===o.selectionType()||p?c.selected()?c.unselect():c.select():p||(o.$(":selected").not(c).unselect(),c.select()),a(c,!1),r.data.canvasNeedsRedraw[t.NODE]=!0);if(o.boxSelectionEnabled()&&Math.pow(l[2]-l[0],2)+Math.pow(l[3]-l[1],2)>7&&l[4]){var x=[],w=r.getAllInBox(l[0],l[1],l[2],l[3]);r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0,w.length>0&&(r.data.canvasNeedsRedraw[t.NODE]=!0);for(var f=0;f<w.length;f++)w[f]._private.selectable&&x.push(w[f]);var _=new e.Collection(o,x);"additive"===o.selectionType()?_.select():(p||o.$(":selected").not(_).unselect(),_.select()),0===x.length&&r.redraw()}if(r.hoverData.dragging&&(r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0,r.redraw()),r.hoverData.dragging=!1,!l[4]){r.data.canvasNeedsRedraw[t.DRAG]=!0,r.data.canvasNeedsRedraw[t.NODE]=!0;for(var f=0;f<u.length;f++)if("nodes"==u[f]._private.group){u[f]._private.rscratch.inDragLayer=!1,u[f]._private.grabbed=!1;for(var m=u[f]._private.edges,b=0;b<m.length;b++)m[b]._private.rscratch.inDragLayer=!1;a(u[f],!1)}else"edges"==u[f]._private.group&&(u[f]._private.rscratch.inDragLayer=!1);d&&d.trigger("free")}}l[4]=0,r.hoverData.down=null,r.dragData.didDrag=!1}},!1);var c=function(e){var n=r.data.cy,i=r.projectIntoViewport(e.clientX,e.clientY),a=[i[0]*n.zoom()+n.pan().x,i[1]*n.zoom()+n.pan().y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||l())return void e.preventDefault();if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){e.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.data.canvasNeedsRedraw[t.NODE]=!0,r.redraw()},150);var o=e.wheelDeltaY/1e3||e.wheelDelta/1e3||e.detail/-32||-e.deltaY/500;n.zoom({level:n.zoom()*Math.pow(10,o),renderedPosition:{x:a[0],y:a[1]}})}};r.registerBinding(r.data.container,"wheel",c,!0),r.registerBinding(r.data.container,"mousewheel",c,!0),r.registerBinding(r.data.container,"DOMMouseScroll",c,!0),r.registerBinding(r.data.container,"MozMousePixelScroll",function(){},!1),r.registerBinding(r.data.container,"mouseout",function(t){var n=r.projectIntoViewport(t.clientX,t.clientY);r.data.cy.trigger(new e.Event(t,{type:"mouseout",cyPosition:{x:n[0],y:n[1]}}))},!1),r.registerBinding(r.data.container,"mouseover",function(t){var n=r.projectIntoViewport(t.clientX,t.clientY);r.data.cy.trigger(new e.Event(t,{type:"mouseover",cyPosition:{x:n[0],y:n[1]}}))},!1);var u,d,p,h,g,v,f,y,m,b,x,w,_=function(e,t,r,n){return Math.sqrt((r-e)*(r-e)+(n-t)*(n-t))};r.registerBinding(r.data.container,"touchstart",function(o){clearTimeout(this.threeFingerSelectTimeout),o.target!==r.data.link&&o.preventDefault(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var s=r.data.cy,l=r.getCachedNodes(),c=r.getCachedEdges(),E=r.touchData.now,S=r.touchData.earlier;if(o.touches[0]){var P=r.projectIntoViewport(o.touches[0].clientX,o.touches[0].clientY);E[0]=P[0],E[1]=P[1]}if(o.touches[1]){var P=r.projectIntoViewport(o.touches[1].clientX,o.touches[1].clientY);E[2]=P[0],E[3]=P[1]}if(o.touches[2]){var P=r.projectIntoViewport(o.touches[2].clientX,o.touches[2].clientY);E[4]=P[0],E[5]=P[1]}if(o.touches[1]){var k=function(e){for(var t=0;t<e.length;t++)e[t]._private.grabbed=!1,e[t]._private.rscratch.inDragLayer=!1,e[t].active()&&e[t].unactivate()};k(l),k(c);var C=r.findContainerClientCoords();y=C[0],m=C[1],b=C[2],x=C[3],u=o.touches[0].clientX-y,d=o.touches[0].clientY-m,p=o.touches[1].clientX-y,h=o.touches[1].clientY-m,w=u>=0&&b>=u&&p>=0&&b>=p&&d>=0&&x>=d&&h>=0&&x>=h;var D=s.pan(),N=s.zoom();if(g=_(u,d,p,h),v=[(u+p)/2,(d+h)/2],f=[(v[0]-D.x)/N,(v[1]-D.y)/N],200>g&&!o.touches[2]){var M=r.findNearestElement(E[0],E[1],!0),T=r.findNearestElement(E[2],E[3],!0);return M&&M.isNode()?(M.activate().trigger(new e.Event(o,{type:"cxttapstart",cyPosition:{x:E[0],y:E[1]}})),r.touchData.start=M):T&&T.isNode()?(T.activate().trigger(new e.Event(o,{type:"cxttapstart",cyPosition:{x:E[0],y:E[1]}})),r.touchData.start=T):(s.trigger(new e.Event(o,{type:"cxttapstart",cyPosition:{x:E[0],y:E[1]}})),r.touchData.start=null),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!0,r.touchData.cxtDragged=!1,r.data.bgActivePosistion=void 0,void r.redraw()}}if(o.touches[2]);else if(o.touches[1]);else if(o.touches[0]){var z=r.findNearestElement(E[0],E[1],!0);if(null!=z){if(z.activate(),r.touchData.start=z,"nodes"==z._private.group&&r.nodeIsDraggable(z)){var I=r.dragData.touchDragEles=[];if(i(z,I),z.trigger("grab"),r.data.canvasNeedsRedraw[t.NODE]=!0,r.data.canvasNeedsRedraw[t.DRAG]=!0,z.selected()){I=r.dragData.touchDragEles=[];for(var B=s.$("node:selected"),R=0;R<B.length;R++){var X=B[R];if(r.nodeIsDraggable(X)){I.push(X),X._private.rscratch.inDragLayer=!0;for(var O=X._private.edges,L=0;L<O.length;L++)O[L]._private.rscratch.inDragLayer=!0;("auto"==X._private.style.width.value||"auto"==X._private.style.height.value)&&n(X,!1,I),a(X,!0)}}}else("auto"==z._private.style.width.value||"auto"==z._private.style.height.value)&&n(z,!0,I),a(z,!0)}z.trigger(new e.Event(o,{type:"touchstart",cyPosition:{x:E[0],y:E[1]}})).trigger(new e.Event(o,{type:"tapstart",cyPosition:{x:E[0],y:E[1]}})).trigger(new e.Event(o,{type:"vmousdown",cyPosition:{x:E[0],y:E[1]}}))}null==z&&(s.trigger(new e.Event(o,{type:"touchstart",cyPosition:{x:E[0],y:E[1]}})).trigger(new e.Event(o,{type:"tapstart",cyPosition:{x:E[0],y:E[1]}})).trigger(new e.Event(o,{type:"vmousedown",cyPosition:{x:E[0],y:E[1]}})),r.data.bgActivePosistion={x:P[0],y:P[1]},r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0,r.redraw());for(var Y=0;Y<E.length;Y++)S[Y]=E[Y],r.touchData.startPosition[Y]=E[Y];r.touchData.singleTouchMoved=!1,r.touchData.singleTouchStartTime=+new Date,setTimeout(function(){r.touchData.singleTouchMoved===!1&&+new Date-r.touchData.singleTouchStartTime>250&&(r.touchData.start?r.touchData.start.trigger(new e.Event(o,{type:"taphold",cyPosition:{x:E[0],y:E[1]}})):(r.data.cy.trigger(new e.Event(o,{type:"taphold",cyPosition:{x:E[0],y:E[1]}})),s.$(":selected").unselect()))},1e3)}},!1),r.registerBinding(window,"touchmove",e.util.throttle(function(n){var i=r.data.select,a=r.touchData.capture;a&&n.preventDefault();var o=r.data.cy,s=r.touchData.now,l=r.touchData.earlier;if(n.touches[0]){var c=r.projectIntoViewport(n.touches[0].clientX,n.touches[0].clientY);s[0]=c[0],s[1]=c[1]}if(n.touches[1]){var c=r.projectIntoViewport(n.touches[1].clientX,n.touches[1].clientY);s[2]=c[0],s[3]=c[1]}if(n.touches[2]){var c=r.projectIntoViewport(n.touches[2].clientX,n.touches[2].clientY);s[4]=c[0],s[5]=c[1]}for(var v=[],b=0;b<s.length;b++)v[b]=s[b]-l[b];if(a&&r.touchData.cxt){var x=n.touches[0].clientX-y,E=n.touches[0].clientY-m,S=n.touches[1].clientX-y,P=n.touches[1].clientY-m,k=_(x,E,S,P),C=k/g;if(C>=1.5||k>=150){r.touchData.cxt=!1,r.touchData.start&&(r.touchData.start.unactivate(),r.touchData.start=null),r.data.bgActivePosistion=void 0,r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0;var D=new e.Event(n,{type:"cxttapend",cyPosition:{x:s[0],y:s[1]}});r.touchData.start?r.touchData.start.trigger(D):o.trigger(D)}}if(a&&r.touchData.cxt){var D=new e.Event(n,{type:"cxtdrag",cyPosition:{x:s[0],y:s[1]}});r.data.bgActivePosistion=void 0,r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0,r.touchData.start?r.touchData.start.trigger(D):o.trigger(D),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var N=r.findNearestElement(s[0],s[1],!0);r.touchData.cxtOver&&N===r.touchData.cxtOver||(r.touchData.cxtOver&&r.touchData.cxtOver.trigger(new e.Event(n,{type:"cxtdragout",cyPosition:{x:s[0],y:s[1]}})),r.touchData.cxtOver=N,N&&N.trigger(new e.Event(n,{type:"cxtdragover",cyPosition:{x:s[0],y:s[1]}})))}else if(a&&n.touches[2]&&o.boxSelectionEnabled())r.data.bgActivePosistion=void 0,clearTimeout(this.threeFingerSelectTimeout),this.lastThreeTouch=+new Date,r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0,i&&0!==i.length&&void 0!==i[0]?(i[2]=(s[0]+s[2]+s[4])/3,i[3]=(s[1]+s[3]+s[5])/3):(i[0]=(s[0]+s[2]+s[4])/3,i[1]=(s[1]+s[3]+s[5])/3,i[2]=(s[0]+s[2]+s[4])/3+1,i[3]=(s[1]+s[3]+s[5])/3+1),i[4]=1,r.redraw();else if(a&&n.touches[1]&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){r.data.bgActivePosistion=void 0,r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0;var M=r.dragData.touchDragEles;if(M){r.data.canvasNeedsRedraw[t.DRAG]=!0;for(var T=0;T<M.length;T++)M[T]._private.grabbed=!1,M[T]._private.rscratch.inDragLayer=!1}var x=n.touches[0].clientX-y,E=n.touches[0].clientY-m,S=n.touches[1].clientX-y,P=n.touches[1].clientY-m,k=_(x,E,S,P),C=k/g;if(1!=C&&w){var z=x-u,I=E-d,B=S-p,R=P-h,X=(z+B)/2,O=(I+R)/2,L=o.zoom(),Y=L*C,V=o.pan(),A=f[0]*L+V.x,F=f[1]*L+V.y,q={x:-Y/L*(A-V.x-X)+A,y:-Y/L*(F-V.y-O)+F};if(r.touchData.start){var M=r.dragData.touchDragEles;if(M)for(var T=0;T<M.length;T++)M[T]._private.grabbed=!1,M[T]._private.rscratch.inDragLayer=!1;r.touchData.start._private.active=!1,r.touchData.start._private.grabbed=!1,r.touchData.start._private.rscratch.inDragLayer=!1,r.data.canvasNeedsRedraw[t.DRAG]=!0,r.touchData.start.trigger("free").trigger("unactivate")}o.viewport({zoom:Y,pan:q}),g=k,u=x,d=E,p=S,h=P,r.pinching=!0}if(n.touches[0]){var c=r.projectIntoViewport(n.touches[0].clientX,n.touches[0].clientY);s[0]=c[0],s[1]=c[1]}if(n.touches[1]){var c=r.projectIntoViewport(n.touches[1].clientX,n.touches[1].clientY);s[2]=c[0],s[3]=c[1]}if(n.touches[2]){var c=r.projectIntoViewport(n.touches[2].clientX,n.touches[2].clientY);s[4]=c[0],s[5]=c[1]}}else if(n.touches[0]){var j=r.touchData.start,H=r.touchData.last,N=N||r.findNearestElement(s[0],s[1],!0);if(null!=j&&"nodes"==j._private.group&&r.nodeIsDraggable(j)){for(var M=r.dragData.touchDragEles,W=0;W<M.length;W++){var Z=M[W];if(r.nodeIsDraggable(Z)){r.dragData.didDrag=!0;var $=Z._private.position;$.x+=v[0],$.y+=v[1]}}var U=new e.Collection(o,Z);U.updateCompoundBounds(),U.trigger("position drag"),r.hoverData.draggingEles=!0,r.data.canvasNeedsRedraw[t.DRAG]=!0,r.touchData.startPosition[0]==l[0]&&r.touchData.startPosition[1]==l[1]&&(r.data.canvasNeedsRedraw[t.NODE]=!0),r.redraw()}null!=j&&(j.trigger(new e.Event(n,{type:"touchmove",cyPosition:{x:s[0],y:s[1]}})),j.trigger(new e.Event(n,{type:"tapdrag",cyPosition:{x:s[0],y:s[1]}})),j.trigger(new e.Event(n,{type:"vmousemove",cyPosition:{x:s[0],y:s[1]}}))),null==j&&(null!=N&&(N.trigger(new e.Event(n,{type:"touchmove",cyPosition:{x:s[0],y:s[1]}})),N.trigger(new e.Event(n,{type:"tapdrag",cyPosition:{x:s[0],y:s[1]}})),N.trigger(new e.Event(n,{type:"vmousemove",cyPosition:{x:s[0],y:s[1]}}))),null==N&&(o.trigger(new e.Event(n,{type:"touchmove",cyPosition:{x:s[0],y:s[1]}})),o.trigger(new e.Event(n,{type:"tapdrag",cyPosition:{x:s[0],y:s[1]}})),o.trigger(new e.Event(n,{type:"vmousemove",cyPosition:{x:s[0],y:s[1]}})))),N!=H&&(H&&H.trigger(new e.Event(n,{type:"tapdragout",cyPosition:{x:s[0],y:s[1]}})),N&&N.trigger(new e.Event(n,{type:"tapdragover",cyPosition:{x:s[0],y:s[1]}}))),r.touchData.last=N;for(var T=0;T<s.length;T++)s[T]&&r.touchData.startPosition[T]&&Math.abs(s[T]-r.touchData.startPosition[T])>4&&(r.touchData.singleTouchMoved=!0);if(a&&(null==j||j.isEdge())&&o.panningEnabled()&&o.userPanningEnabled()){j&&(j.unactivate(),r.data.bgActivePosistion||(r.data.bgActivePosistion={x:s[0],y:s[1]}),r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0,r.touchData.start=null),o.panBy({x:v[0]*o.zoom(),y:v[1]*o.zoom()}),r.swipePanning=!0;var c=r.projectIntoViewport(n.touches[0].clientX,n.touches[0].clientY);s[0]=c[0],s[1]=c[1]}}for(var b=0;b<s.length;b++)l[b]=s[b]},1e3/30),!1),r.registerBinding(window,"touchcancel",function(){var e=r.touchData.start;r.touchData.capture=!1,e&&e.unactivate()}),r.registerBinding(window,"touchend",function(n){var i=r.touchData.start,o=r.touchData.capture;if(o){r.touchData.capture=!1,n.preventDefault();var s=r.data.select;r.swipePanning=!1,r.hoverData.draggingEles=!1;var l=r.data.cy,c=r.touchData.now,u=r.touchData.earlier;if(n.touches[0]){var d=r.projectIntoViewport(n.touches[0].clientX,n.touches[0].clientY);c[0]=d[0],c[1]=d[1]}if(n.touches[1]){var d=r.projectIntoViewport(n.touches[1].clientX,n.touches[1].clientY);c[2]=d[0],c[3]=d[1]}if(n.touches[2]){var d=r.projectIntoViewport(n.touches[2].clientX,n.touches[2].clientY);c[4]=d[0],c[5]=d[1]}i&&i.unactivate();var p;if(r.touchData.cxt){if(p=new e.Event(n,{type:"cxttapend",cyPosition:{x:c[0],y:c[1]}}),i?i.trigger(p):l.trigger(p),!r.touchData.cxtDragged){var h=new e.Event(n,{type:"cxttap",cyPosition:{x:c[0],y:c[1]}});i?i.trigger(h):l.trigger(h)}return r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,void r.redraw()}if(!n.touches[2]&&l.boxSelectionEnabled()){clearTimeout(this.threeFingerSelectTimeout);var g=[],v=r.getAllInBox(s[0],s[1],s[2],s[3]);s[0]=void 0,s[1]=void 0,s[2]=void 0,s[3]=void 0,s[4]=0,r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0;for(var f=0;f<v.length;f++)v[f]._private.selectable&&g.push(v[f]);var y=new e.Collection(l,g);"single"===l.selectionType()&&l.$(":selected").not(y).unselect(),y.select(),y.length>0?r.data.canvasNeedsRedraw[t.NODE]=!0:r.redraw()}n.touches.length<2&&(r.pinching=!1,r.data.canvasNeedsRedraw[t.NODE]=!0,r.redraw());var m=!1;if(null!=i&&(i._private.active=!1,m=!0,i.unactivate()),n.touches[2])r.data.bgActivePosistion=void 0,r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0;else if(n.touches[1]);else if(n.touches[0]);else if(!n.touches[0]){if(r.data.bgActivePosistion=void 0,r.data.canvasNeedsRedraw[t.SELECT_BOX]=!0,null!=i){i._private.grabbed&&(i._private.grabbed=!1,i.trigger("free"),i._private.rscratch.inDragLayer=!1);for(var b=i._private.edges,x=0;x<b.length;x++)b[x]._private.rscratch.inDragLayer=!1;if(a(i,!1),i.selected())for(var w=l.$("node:selected"),_=0;_<w.length;_++){var E=w[_];E._private.rscratch.inDragLayer=!1,E._private.grabbed=!1;for(var b=E._private.edges,x=0;x<b.length;x++)b[x]._private.rscratch.inDragLayer=!1;a(E,!1)}r.data.canvasNeedsRedraw[t.DRAG]=!0,r.data.canvasNeedsRedraw[t.NODE]=!0,i.trigger(new e.Event(n,{type:"touchend",cyPosition:{x:c[0],y:c[1]}})).trigger(new e.Event(n,{type:"tapend",cyPosition:{x:c[0],y:c[1]}})).trigger(new e.Event(n,{type:"vmouseup",cyPosition:{x:c[0],y:c[1]}})),i.unactivate(),r.touchData.start=null}else{var S=r.findNearestElement(c[0],c[1],!0);null!=S&&S.trigger(new e.Event(n,{type:"touchend",cyPosition:{x:c[0],y:c[1]}})).trigger(new e.Event(n,{type:"tapend",cyPosition:{x:c[0],y:c[1]}})).trigger(new e.Event(n,{type:"vmouseup",cyPosition:{x:c[0],y:c[1]}})),null==S&&l.trigger(new e.Event(n,{type:"touchend",cyPosition:{x:c[0],y:c[1]}})).trigger(new e.Event(n,{type:"tapend",cyPosition:{x:c[0],y:c[1]}})).trigger(new e.Event(n,{type:"vmouseup",cyPosition:{x:c[0],y:c[1]}}))}null!=i&&!r.dragData.didDrag&&i._private.selectable&&Math.sqrt(Math.pow(r.touchData.startPosition[0]-c[0],2)+Math.pow(r.touchData.startPosition[1]-c[1],2))<6&&("single"===l.selectionType()?(l.$(":selected").not(i).unselect(),i.select()):i.selected()?i.unselect():i.select(),m=!0,r.data.canvasNeedsRedraw[t.NODE]=!0),r.touchData.singleTouchMoved===!1&&(i?i.trigger(new e.Event(n,{type:"tap",cyPosition:{x:c[0],y:c[1]}})).trigger(new e.Event(n,{type:"vclick",cyPosition:{x:c[0],y:c[1]}})):l.trigger(new e.Event(n,{type:"tap",cyPosition:{x:c[0],y:c[1]}})).trigger(new e.Event(n,{type:"vclick",cyPosition:{x:c[0],y:c[1]}}))),r.touchData.singleTouchMoved=!0}for(var x=0;x<c.length;x++)u[x]=c[x];r.dragData.didDrag=!1,m&&i&&i.updateStyle(!1)}},!1)}}(cytoscape),function(e){"use strict";for(var t=e("renderer","canvas"),r=t.prototype,n=t.usePaths(),i=t.nodeShapes={},a=Math.sin(0),o=Math.cos(0),s={},l={},c=.1,u=0*Math.PI;u<2*Math.PI;u+=c)s[u]=Math.sin(u),l[u]=Math.cos(u);i.ellipse={draw:function(e,t,r,n,a){i.ellipse.drawPath(e,t,r,n,a),e.fill()},drawPath:function(e,t,r,i,u){if(n){e.beginPath&&e.beginPath();for(var d,p,h=i/2,g=u/2,v=0*Math.PI;v<2*Math.PI;v+=c)d=t-h*s[v]*a+h*l[v]*o,p=r+g*l[v]*a+g*s[v]*o,0===v?e.moveTo(d,p):e.lineTo(d,p);e.closePath()}else e.beginPath&&e.beginPath(),e.translate(t,r),e.scale(i/2,u/2),e.arc(0,0,1,0,2*Math.PI*.999,!1),e.closePath(),e.scale(2/i,2/u),e.translate(-t,-r)},intersectLine:function(t,r,n,i,a,o,s){var l=e.math.intersectLineEllipse(a,o,t,r,n/2+s,i/2+s);return l},intersectBox:function(t,r,n,i,a,o,s,l,c){return e.math.boxIntersectEllipse(t,r,n,i,c,a,o,s,l)},checkPointRough:function(){return!0},checkPoint:function(e,t,r,n,i,a,o){return e-=a,t-=o,e/=n/2+r,t/=i/2+r,Math.pow(e,2)+Math.pow(t,2)<=1}},i.triangle={points:e.math.generateUnitNgonPointsFitToSquare(3,0),draw:function(e,t,n,a,o){r.drawPolygon(e,t,n,a,o,i.triangle.points)},drawPath:function(e,t,n,a,o){r.drawPolygonPath(e,t,n,a,o,i.triangle.points)},intersectLine:function(t,r,n,a,o,s,l){return e.math.polygonIntersectLine(o,s,i.triangle.points,t,r,n/2,a/2,l)},intersectBox:function(t,r,n,a,o,s,l,c,u){var d=i.triangle.points;return e.math.boxIntersectPolygon(t,r,n,a,d,o,s,l,c,[0,-1],u)},checkPointRough:function(t,r,n,a,o,s,l){return e.math.checkInBoundingBox(t,r,i.triangle.points,n,a,o,s,l)},checkPoint:function(t,r,n,a,o,s,l){return e.math.pointInsidePolygon(t,r,i.triangle.points,s,l,a,o,[0,-1],n)}},i.square={points:e.math.generateUnitNgonPointsFitToSquare(4,0),draw:function(e,t,n,a,o){r.drawPolygon(e,t,n,a,o,i.square.points)},drawPath:function(e,t,n,a,o){r.drawPolygonPath(e,t,n,a,o,i.square.points)},intersectLine:function(t,r,n,a,o,s,l){return e.math.polygonIntersectLine(o,s,i.square.points,t,r,n/2,a/2,l)},intersectBox:function(t,r,n,a,o,s,l,c,u){var d=i.square.points;return e.math.boxIntersectPolygon(t,r,n,a,d,o,s,l,c,[0,-1],u)},checkPointRough:function(t,r,n,a,o,s,l){return e.math.checkInBoundingBox(t,r,i.square.points,n,a,o,s,l)},checkPoint:function(t,r,n,a,o,s,l){return e.math.pointInsidePolygon(t,r,i.square.points,s,l,a,o,[0,-1],n)}},i.rectangle=i.square,i.octogon={},i.roundrectangle={points:e.math.generateUnitNgonPointsFitToSquare(4,0),draw:function(e,t,n,i,a){r.drawRoundRectangle(e,t,n,i,a,10)},drawPath:function(e,t,n,i,a){r.drawRoundRectanglePath(e,t,n,i,a,10)},intersectLine:function(t,r,n,i,a,o,s){return e.math.roundRectangleIntersectLine(a,o,t,r,n,i,s)},intersectBox:function(t,r,n,i,a,o,s,l,c){return e.math.roundRectangleIntersectBox(t,r,n,i,a,o,s,l,c)},checkPointRough:function(t,r,n,a,o,s,l){return e.math.checkInBoundingBox(t,r,i.roundrectangle.points,n,a,o,s,l)},checkPoint:function(t,r,n,a,o,s,l){var c=e.math.getRoundRectangleRadius(a,o);if(e.math.pointInsidePolygon(t,r,i.roundrectangle.points,s,l,a,o-2*c,[0,-1],n))return!0;if(e.math.pointInsidePolygon(t,r,i.roundrectangle.points,s,l,a-2*c,o,[0,-1],n))return!0;var u=function(e,t,r,n,i,a,o){return e-=r,t-=n,e/=i/2+o,t/=a/2+o,Math.pow(e,2)+Math.pow(t,2)<=1};return u(t,r,s-a/2+c,l-o/2+c,2*c,2*c,n)?!0:u(t,r,s+a/2-c,l-o/2+c,2*c,2*c,n)?!0:u(t,r,s+a/2-c,l+o/2-c,2*c,2*c,n)?!0:u(t,r,s-a/2+c,l+o/2-c,2*c,2*c,n)?!0:!1}},i.pentagon={points:e.math.generateUnitNgonPointsFitToSquare(5,0),draw:function(e,t,n,a,o){r.drawPolygon(e,t,n,a,o,i.pentagon.points)},drawPath:function(e,t,n,a,o){r.drawPolygonPath(e,t,n,a,o,i.pentagon.points)},intersectLine:function(e,t,n,a,o,s,l){return r.polygonIntersectLine(o,s,i.pentagon.points,e,t,n/2,a/2,l)},intersectBox:function(t,r,n,a,o,s,l,c,u){var d=i.pentagon.points;return e.math.boxIntersectPolygon(t,r,n,a,d,o,s,l,c,[0,-1],u)},checkPointRough:function(t,r,n,a,o,s,l){return e.math.checkInBoundingBox(t,r,i.pentagon.points,n,a,o,s,l)},checkPoint:function(t,r,n,a,o,s,l){return e.math.pointInsidePolygon(t,r,i.pentagon.points,s,l,a,o,[0,-1],n)}},i.hexagon={points:e.math.generateUnitNgonPointsFitToSquare(6,0),draw:function(e,t,n,a,o){r.drawPolygon(e,t,n,a,o,i.hexagon.points)},drawPath:function(e,t,n,a,o){r.drawPolygonPath(e,t,n,a,o,i.hexagon.points)},intersectLine:function(t,r,n,a,o,s,l){return e.math.polygonIntersectLine(o,s,i.hexagon.points,t,r,n/2,a/2,l)},intersectBox:function(t,r,n,a,o,s,l,c,u){var d=i.hexagon.points;return e.math.boxIntersectPolygon(t,r,n,a,d,o,s,l,c,[0,-1],u)},checkPointRough:function(t,r,n,a,o,s,l){return e.math.checkInBoundingBox(t,r,i.hexagon.points,n,a,o,s,l)},checkPoint:function(t,r,n,a,o,s,l){return e.math.pointInsidePolygon(t,r,i.hexagon.points,s,l,a,o,[0,-1],n)}},i.heptagon={points:e.math.generateUnitNgonPointsFitToSquare(7,0),draw:function(e,t,n,a,o){r.drawPolygon(e,t,n,a,o,i.heptagon.points)},drawPath:function(e,t,n,a,o){r.drawPolygonPath(e,t,n,a,o,i.heptagon.points)},intersectLine:function(e,t,n,a,o,s,l){return r.polygonIntersectLine(o,s,i.heptagon.points,e,t,n/2,a/2,l)},intersectBox:function(e,t,n,a,o,s,l,c,u){var d=i.heptagon.points;return r.boxIntersectPolygon(e,t,n,a,d,o,s,l,c,[0,-1],u)},checkPointRough:function(t,r,n,a,o,s,l){return e.math.checkInBoundingBox(t,r,i.heptagon.points,n,a,o,s,l)},checkPoint:function(t,r,n,a,o,s,l){return e.math.pointInsidePolygon(t,r,i.heptagon.points,s,l,a,o,[0,-1],n)}},i.octagon={points:e.math.generateUnitNgonPointsFitToSquare(8,0),draw:function(e,t,n,a,o){r.drawPolygon(e,t,n,a,o,i.octagon.points)},drawPath:function(e,t,n,a,o){r.drawPolygonPath(e,t,n,a,o,i.octagon.points)},intersectLine:function(e,t,n,a,o,s,l){return r.polygonIntersectLine(o,s,i.octagon.points,e,t,n/2,a/2,l)},intersectBox:function(e,t,n,a,o,s,l,c,u){var d=i.octagon.points;return r.boxIntersectPolygon(e,t,n,a,d,o,s,l,c,[0,-1],u)},checkPointRough:function(t,r,n,a,o,s,l){return e.math.checkInBoundingBox(t,r,i.octagon.points,n,a,o,s,l)},checkPoint:function(t,r,n,a,o,s,l){return e.math.pointInsidePolygon(t,r,i.octagon.points,s,l,a,o,[0,-1],n)}};var d=new Array(20),p=e.math.generateUnitNgonPoints(5,0),h=e.math.generateUnitNgonPoints(5,Math.PI/5),g=.5*(3-Math.sqrt(5));g*=1.57;for(var u=0;u<h.length/2;u++)h[2*u]*=g,h[2*u+1]*=g;for(var u=0;5>u;u++)d[4*u]=p[2*u],d[4*u+1]=p[2*u+1],d[4*u+2]=h[2*u],d[4*u+3]=h[2*u+1];d=e.math.fitPolygonToSquare(d),i.star5=i.star={points:d,draw:function(e,t,n,a,o){r.drawPolygon(e,t,n,a,o,i.star5.points)},drawPath:function(e,t,n,a,o){r.drawPolygonPath(e,t,n,a,o,i.star5.points)},intersectLine:function(e,t,n,a,o,s,l){return r.polygonIntersectLine(o,s,i.star5.points,e,t,n/2,a/2,l)},intersectBox:function(e,t,n,a,o,s,l,c,u){var d=i.star5.points;return r.boxIntersectPolygon(e,t,n,a,d,o,s,l,c,[0,-1],u)},checkPointRough:function(t,r,n,a,o,s,l){return e.math.checkInBoundingBox(t,r,i.star5.points,n,a,o,s,l)},checkPoint:function(t,r,n,a,o,s,l){return e.math.pointInsidePolygon(t,r,i.star5.points,s,l,a,o,[0,-1],n)}}}(cytoscape),function(e){"use strict";function t(t){this.options=e.util.extend({},r,t)}var r={liveUpdate:!0,ready:void 0,stop:void 0,maxSimulationTime:4e3,fit:!0,padding:[50,50,50,50],simulationBounds:void 0,ungrabifyWhileSimulating:!0,repulsion:void 0,stiffness:void 0,friction:void 0,gravity:!0,fps:void 0,precision:void 0,nodeMass:void 0,edgeLength:void 0,stepSize:1,stableEnergy:function(e){var t=e;return t.max<=.5||t.mean<=.3}};t.prototype.run=function(){function t(e,t){return null==t?void 0:"function"==typeof t?t.apply(e,[e._private.data,{nodes:o.length,edges:s.length,element:e}]):t}function r(e){var t=e.x,r=e.y,n=c,i=u,a=-2,o=2,s=4;return{x:t/n*s+a,y:r/i*s+o}}function n(e){i.fit&&a.fit(),e()}var i=this.options,a=i.cy,o=a.nodes(),s=a.edges(),l=a.container(),c=l.clientWidth,u=l.clientHeight,d=i.simulationBounds;i.simulationBounds?(c=d[2]-d[0],u=d[3]-d[1]):i.simulationBounds=[0,0,c,u];var p=i.simulationBounds;if(p.x1=p[0],p.y1=p[1],p.x2=p[2],p.y2=p[3],a.nodes().size()<=1)return i.fit&&a.reset(),a.nodes().position({x:Math.round((p.x1+p.x2)/2),y:Math.round((p.y1+p.y2)/2)}),a.one("layoutready",i.ready),a.trigger("layoutready"),a.one("layoutstop",i.stop),void a.trigger("layoutstop");var h=this.system=arbor.ParticleSystem(i.repulsion,i.stiffness,i.friction,i.gravity,i.fps,i.dt,i.precision);this.system=h,i.liveUpdate&&i.fit&&a.reset();var g,v=250,f=!1,y=+new Date,m={init:function(){},redraw:function(){var t=h.energy();if(null!=i.stableEnergy&&null!=t&&t.n>0&&i.stableEnergy(t))return void h.stop();clearTimeout(g),g=setTimeout(w,v);var r=[];h.eachNode(function(e,t){var n=e.data,i=n.element;null!=i&&(i.locked()||i.grabbed()||(i.silentPosition({x:p.x1+t.x,y:p.y1+t.y}),r.push(i)))});var n=+new Date-y>=16;i.liveUpdate&&r.length>0&&n&&(new e.Collection(a,r).rtrigger("position"),y=+new Date),f||(f=!0,a.one("layoutready",i.ready),a.trigger("layoutready"))}};h.renderer=m,h.screenSize(c,u),h.screenPadding(i.padding[0],i.padding[1],i.padding[2],i.padding[3]),h.screenStep(i.stepSize);var b=function(e){var t=h.fromScreen(this.position()),r=arbor.Point(t.x,t.y);switch(this.scratch().arbor.p=r,e.type){case"grab":this.scratch().arbor.fixed=!0;break;case"free":this.scratch().arbor.fixed=!1}};o.bind("grab drag free",b),o.each(function(e,n){if(!this.isFullAutoParent()){var a=this._private.data.id,o=t(this,i.nodeMass),s=this._private.locked;if(!n.isFullAutoParent()){var l=r({x:n.position().x,y:n.position().y});n.locked()||(this.scratch().arbor=h.addNode(a,{element:this,mass:o,fixed:s,x:s?l.x:void 0,y:s?l.y:void 0}))}}}),s.each(function(){var e=this.source().id(),r=this.target().id(),n=t(this,i.edgeLength);this.scratch().arbor=h.addEdge(e,r,{length:n})});var x=o.filter(":grabbable");i.ungrabifyWhileSimulating&&x.ungrabify();var w=function(){function e(){i.liveUpdate||(i.fit&&a.reset(),a.nodes().rtrigger("position")),o.unbind("grab drag free",b),i.ungrabifyWhileSimulating&&x.grabify(),a.one("layoutstop",i.stop),a.trigger("layoutstop")}window.isIE?n(function(){e()}):e()};h.start(),null!=i.maxSimulationTime&&i.maxSimulationTime>0&&1/0!==i.maxSimulationTime&&setTimeout(function(){h.stop()},i.maxSimulationTime)},t.prototype.stop=function(){null!=this.system&&system.stop()},e("layout","arbor",t)}(cytoscape),function(e){"use strict";function t(t){this.options=e.util.extend({},r,t)}var r={fit:!0,ready:void 0,stop:void 0,directed:!1,padding:30,circle:!1,roots:void 0,maximalAdjustments:0};
t.prototype.run=function(){var t,r=this.options,n=r,i=r.cy,a=i.nodes(),o=i.edges(),s=a.add(o),l=i.container(),c=l.clientWidth,u=l.clientHeight;if(e.is.elementOrCollection(n.roots))t=n.roots;else if(e.is.array(n.roots)){for(var d=[],p=0;p<n.roots.length;p++){var h=n.roots[p],g=i.getElementById(h);d.push(g)}t=new e.Collection(i,d)}else if(e.is.string(n.roots))t=i.$(n.roots);else if(n.directed)t=a.roots();else{var v=a.maxDegree(!1);t=a.filter(function(){return this.degree()===v})}var f=[],y={},m={};s.bfs(t,function(e,t){var r=this[0];f[t]||(f[t]=[]),f[t].push(r),y[r.id()]=!0,m[r.id()]=t},n.directed);for(var b=[],p=0;p<a.length;p++){var g=a[p];y[g.id()]||b.push(g)}for(var x=3*b.length,w=0;0!==b.length&&x>w;){for(var _=b.shift(),E=_.neighborhood().nodes(),S=!1,p=0;p<E.length;p++){var P=m[E[p].id()];if(void 0!==P){f[P].push(_),S=!0;break}}S||b.push(_),w++}for(;0!==b.length;){var _=b.shift(),S=!1;S||(0===f.length&&f.push([]),f[0].push(_))}var k=function(){for(var e=0;e<f.length;e++)for(var t=f[e],r=0;r<t.length;r++){var n=t[r];n._private.scratch.BreadthFirstLayout={depth:e,index:r}}};k();for(var C=function(e){for(var t,r=e.connectedEdges(function(){return this.data("target")===e.id()}),n=e._private.scratch.BreadthFirstLayout,i=0,a=0;a<r.length;a++){var o=r[a],s=o.source()[0],l=s._private.scratch.BreadthFirstLayout;n.depth<=l.depth&&i<l.depth&&(i=l.depth,t=s)}return t},D=0;D<n.maximalAdjustments;D++){for(var N=f.length,M=[],p=0;N>p;p++)for(var P=f[p],T=P.length,z=0;T>z;z++){var g=P[z],I=g._private.scratch.BreadthFirstLayout,B=C(g);B&&(I.intEle=B,M.push(g))}for(var p=0;p<M.length;p++){var g=M[p],I=g._private.scratch.BreadthFirstLayout,B=I.intEle,R=B._private.scratch.BreadthFirstLayout;f[I.depth].splice(I.index,1);for(var X=R.depth+1;X>f.length-1;)f.push([]);f[X].push(g),I.depth=X,I.index=f[X].length-1}k()}for(var O=0,p=0;p<a.length;p++){var L=a[p].outerWidth(),Y=a[p].outerHeight();O=Math.max(O,L,Y)}O*=1.75;for(var V={},A=function(e){if(V[e.id()])return V[e.id()];for(var t=e._private.scratch.BreadthFirstLayout.depth,r=e.neighborhood().nodes(),n=0,i=0,a=0;a<r.length;a++){var o=r[a],s=o._private.scratch.BreadthFirstLayout.index,l=o._private.scratch.BreadthFirstLayout.depth,c=f[l].length;(t>l||0===t)&&(n+=s/c,i++)}return i=Math.max(1,i),n/=i,0===i&&(n=void 0),V[e.id()]=n,n},F=function(e,t){var r=A(e),n=A(t);return r-n},q=0;3>q;q++){for(var p=0;p<f.length;p++)f[p]=f[p].sort(F);k()}var j={x:c/2,y:u/2};a.positions(function(){var e=this[0],t=e._private.scratch.BreadthFirstLayout,r=t.depth,i=t.index,a=f[r].length,o=Math.max(c/(a+1),O),s=Math.max(u/(f.length+1),O),l=Math.min(c/2/f.length,u/2/f.length);if(l=Math.max(l,O),n.circle){var d=l*r+l-(f.length>0&&f[0].length<=3?l/2:0),p=2*Math.PI/f[r].length*i;return 0===r&&1===f[0].length&&(d=1),{x:j.x+d*Math.cos(p),y:j.y+d*Math.sin(p)}}return{x:j.x+(i+1-(a+1)/2)*o,y:(r+1)*s}}),r.fit&&i.fit(n.padding),i.one("layoutready",r.ready),i.trigger("layoutready"),i.one("layoutstop",r.stop),i.trigger("layoutstop")},t.prototype.stop=function(){},e("layout","breadthfirst",t)}(cytoscape),function(e){"use strict";function t(t){this.options=e.util.extend({},r,t)}var r={fit:!0,ready:void 0,stop:void 0,rStepSize:10,padding:30,startAngle:1.5*Math.PI,counterclockwise:!1};t.prototype.run=function(){function e(){var e=0,t=u,r={x:l.x+g*Math.cos(e),y:l.y+g*Math.sin(e)},n={x:l.x+g*Math.cos(t),y:l.y+g*Math.sin(t)},i=Math.sqrt((n.x-r.x)*(n.x-r.x)+(n.y-r.y)*(n.y-r.y));return i}for(var t=this.options,r=t,n=t.cy,i=n.nodes().filter(function(){return!this.isFullAutoParent()}),a=n.container(),o=a.clientWidth,s=a.clientHeight,l={x:o/2,y:s/2},c=r.startAngle,u=2*Math.PI/i.length,d=0,p=0;p<i.length;p++){var h=i[p];d=Math.max(h.outerWidth(),h.outerHeight())}for(var g=o/2-d;e()<d&&i.length>=2;)g+=r.rStepSize;var p=0;i.positions(function(){var e=g*Math.cos(c),t=g*Math.sin(c),n={x:l.x+e,y:l.y+t};return p++,c=r.counterclockwise?c-u:c+u,n}),t.fit&&n.fit(r.padding),n.one("layoutready",t.ready),n.trigger("layoutready"),n.one("layoutstop",t.stop),n.trigger("layoutstop")},t.prototype.stop=function(){},e("layout","circle",t)}(cytoscape),function(e){"use strict";function t(t){this.options=e.util.extend({},r,t)}var r={fit:!0,ready:void 0,stop:void 0,padding:30,startAngle:1.5*Math.PI,counterclockwise:!1,minNodeSpacing:10,height:void 0,width:void 0,concentric:function(){return this.degree()},levelWidth:function(e){return e.maxDegree()/4}};t.prototype.run=function(){for(var e=this.options,t=e,r=e.cy,n=r.nodes().filter(function(){return!this.isFullAutoParent()}),i=r.container(),a=void 0!==t.width?t.width:i.clientWidth,o=void 0!==t.height?t.height:i.clientHeight,s={x:a/2,y:o/2},l=[],c=t.startAngle,u=0,d=0;d<n.length;d++){var p,h=n[d];p=t.concentric.call(h),l.push({value:p,node:h}),h._private.layoutData.concentric=p}n.updateStyle();for(var d=0;d<n.length;d++){var h=n[d];u=Math.max(u,h.outerWidth(),h.outerHeight())}l.sort(function(e,t){return t.value-e.value});for(var g=t.levelWidth(n),v=[[]],f=v[0],d=0;d<l.length;d++){var y=l[d];if(f.length>0){var m=Math.abs(f[0].value-y.value);m>=g&&(f=[],v.push(f))}f.push(y)}for(var b={},x=0,w=u+t.minNodeSpacing,d=0;d<v.length;d++){var _=v[d],E=2*Math.PI/_.length;if(_.length>1){var S=Math.cos(E)-Math.cos(0),P=Math.sin(E)-Math.sin(0),k=Math.sqrt(w*w/(S*S+P*P));x=Math.max(k,x)}for(var C=0;C<_.length;C++){var y=_[C],c=t.startAngle+(t.counterclockwise?1:-1)*E*C,D={x:s.x+x*Math.cos(c),y:s.y+x*Math.sin(c)};b[y.node.id()]=D}x+=w}n.positions(function(){var e=this.id();return b[e]}),e.fit&&r.fit(t.padding),r.one("layoutready",e.ready),r.trigger("layoutready"),r.one("layoutstop",e.stop),r.trigger("layoutstop")},t.prototype.stop=function(){},e("layout","concentric",t)}(cytoscape),function(e){"use strict";function t(t){this.options=e.util.extend({},n,t)}var r,n={ready:function(){},stop:function(){},refresh:0,fit:!0,padding:30,randomize:!0,debug:!1,nodeRepulsion:1e4,nodeOverlap:10,idealEdgeLength:10,edgeElasticity:100,nestingFactor:5,gravity:250,numIter:100,initialTemp:200,coolingFactor:.95,minTemp:1};t.prototype.run=function(){var e=this.options,t=e.cy;r=!0===e.debug?!0:!1;var n=new Date,a=i(t,e);r&&s(a),!0===e.randomize&&(l(a,t),0<e.refresh&&c(a,t,e)),m(a,t,e);for(var o=0;o<e.numIter;o++)if(u(a,t,e,o),0<e.refresh&&0===o%e.refresh&&c(a,t,e),a.temperature=a.temperature*e.coolingFactor,w("New temperature: "+a.temperature),a.temperature<e.minTemp){w("Temperature drop below minimum threshold. Stopping computation in step "+o);break}c(a,t,e),!0===e.fit&&t.fit(e.padding);var d=new Date;console.info("Layout took "+(d-n)+" ms"),t.one("layoutstop",e.stop),t.trigger("layoutstop")},t.prototype.stop=function(){var e=this.options;cy.one("layoutstop",e.stop),cy.trigger("layoutstop")};var i=function(e,t){for(var r={layoutNodes:[],idToIndex:{},nodeSize:e.nodes().size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:e.edges().size(),temperature:t.initialTemp,clientWidth:e.container().clientWidth,clientHeight:e.container().clientHeight},n=e.nodes(),i=0;i<r.nodeSize;i++){var o={};o.id=n[i].data("id"),o.parentId=n[i].data("parent"),o.children=[],o.positionX=n[i].position("x"),o.positionY=n[i].position("y"),o.offsetX=0,o.offsetY=0,o.height=n[i].height(),o.width=n[i].width(),o.maxX=o.positionX+o.width/2,o.minX=o.positionX-o.width/2,o.maxY=o.positionY+o.height/2,o.minY=o.positionY-o.height/2,o.padLeft=n[i]._private.style["padding-left"].pxValue,o.padRight=n[i]._private.style["padding-right"].pxValue,o.padTop=n[i]._private.style["padding-top"].pxValue,o.padBottom=n[i]._private.style["padding-bottom"].pxValue,r.layoutNodes.push(o),r.idToIndex[o.id]=i}for(var s=[],l=0,c=-1,u=[],i=0;i<r.nodeSize;i++){var d=r.layoutNodes[i],p=d.parentId;null!=p?r.layoutNodes[r.idToIndex[p]].children.push(d.id):(s[++c]=d.id,u.push(d.id))}for(r.graphSet.push(u);c>=l;){var h=s[l++],g=r.idToIndex[h],v=r.layoutNodes[g],f=v.children;if(f.length>0){r.graphSet.push(f);for(var i=0;i<f.length;i++)s[++c]=f[i]}}for(var i=0;i<r.graphSet.length;i++)for(var y=r.graphSet[i],m=0;m<y.length;m++){var b=r.idToIndex[y[m]];r.indexToGraph[b]=i}for(var x=e.edges(),i=0;i<r.edgeSize;i++){var _=x[i],E={};E.id=_.data("id"),E.sourceId=_.data("source"),E.targetId=_.data("target");var S=t.idealEdgeLength,P=r.idToIndex[E.sourceId],k=r.idToIndex[E.targetId],C=r.indexToGraph[P],D=r.indexToGraph[k];if(C!=D){for(var N=a(E.sourceId,E.targetId,r),M=r.graphSet[N],T=0,o=r.layoutNodes[P];-1===$.inArray(o.id,M);)o=r.layoutNodes[r.idToIndex[o.parentId]],T++;for(o=r.layoutNodes[k];-1===$.inArray(o.id,M);)o=r.layoutNodes[r.idToIndex[o.parentId]],T++;w("LCA of nodes "+E.sourceId+" and "+E.targetId+". Index: "+N+" Contents: "+M.toString()+". Depth: "+T),S*=T*t.nestingFactor}E.idealLength=S,r.layoutEdges.push(E)}return r},a=function(e,t,r){var n=o(e,t,0,r);return 2>n.count?0:n.graph},o=function(e,t,r,n){var i=n.graphSet[r];if(-1<$.inArray(e,i)&&-1<$.inArray(t,i))return{count:2,graph:r};for(var a=0,s=0;s<i.length;s++){var l=i[s],c=n.idToIndex[l],u=n.layoutNodes[c].children;if(0!==u.length){var d=n.indexToGraph[n.idToIndex[u[0]]],p=o(e,t,d,n);if(0!==p.count){if(1!==p.count)return p;if(a++,2===a)break}}}return{count:a,graph:r}},s=function(e){if(r){console.debug("layoutNodes:");for(var t=0;t<e.nodeSize;t++){var n=e.layoutNodes[t],i="\nindex: "+t+"\nId: "+n.id+"\nChildren: "+n.children.toString()+"\nparentId: "+n.parentId+"\npositionX: "+n.positionX+"\npositionY: "+n.positionY+"\nOffsetX: "+n.offsetX+"\nOffsetY: "+n.offsetY+"\npadLeft: "+n.padLeft+"\npadRight: "+n.padRight+"\npadTop: "+n.padTop+"\npadBottom: "+n.padBottom;console.debug(i)}console.debug("idToIndex");for(var t in e.idToIndex)console.debug("Id: "+t+"\nIndex: "+e.idToIndex[t]);console.debug("Graph Set");for(var a=e.graphSet,t=0;t<a.length;t++)console.debug("Set : "+t+": "+a[t].toString());for(var i="IndexToGraph",t=0;t<e.indexToGraph.length;t++)i+="\nIndex : "+t+" Graph: "+e.indexToGraph[t];console.debug(i),i="Layout Edges";for(var t=0;t<e.layoutEdges.length;t++){var o=e.layoutEdges[t];i+="\nEdge Index: "+t+" ID: "+o.id+" SouceID: "+o.sourceId+" TargetId: "+o.targetId+" Ideal Length: "+o.idealLength}console.debug(i),i="nodeSize: "+e.nodeSize,i+="\nedgeSize: "+e.edgeSize,i+="\ntemperature: "+e.temperature,console.debug(i)}},l=function(e){for(var t=e.clientWidth,r=e.clientHeight,n=0;n<e.nodeSize;n++){var i=e.layoutNodes[n];i.positionX=Math.random()*t,i.positionY=Math.random()*r}},c=function(e,t,r){var n="Refreshing positions";w(n),t.nodes().positions(function(t,r){var i=e.layoutNodes[e.idToIndex[r.data("id")]];return n="Node: "+i.id+". Refreshed position: ("+i.positionX+", "+i.positionY+").",w(n),{x:i.positionX,y:i.positionY}}),!0!==e.ready&&(n="Triggering layoutready",w(n),e.ready=!0,t.one("layoutready",r.ready),t.trigger("layoutready"))},u=function(e,t,r,n){var i="\n\n###############################";i+="\nSTEP: "+n,i+="\n###############################\n",w(i),d(e,t,r),v(e,t,r),f(e,t,r),y(e,t,r),m(e,t,r)},d=function(e,t,r){var n="calculateNodeForces";w(n);for(var i=0;i<e.graphSet.length;i++){var a=e.graphSet[i],o=a.length;n="Set: "+a.toString(),w(n);for(var s=0;o>s;s++)for(var l=e.layoutNodes[e.idToIndex[a[s]]],c=s+1;o>c;c++){var u=e.layoutNodes[e.idToIndex[a[c]]];p(l,u,e,t,r)}}},p=function(e,t,r,n,i){var a="Node repulsion. Node1: "+e.id+" Node2: "+t.id,o=t.positionX-e.positionX,s=t.positionY-e.positionY;if(a+="\ndirectionX: "+o+", directionY: "+s,0===o&&0===s)return void(a+="\nNodes have the same position.");var l=g(e,t,o,s);if(l>0){a+="\nNodes DO overlap.",a+="\nOverlap: "+l;var c=i.nodeOverlap*l,u=Math.sqrt(o*o+s*s);a+="\nDistance: "+u;var d=c*o/u,p=c*s/u}else{a+="\nNodes do NOT overlap.";var v=h(e,o,s),f=h(t,-1*o,-1*s),y=f.x-v.x,m=f.y-v.y,b=y*y+m*m,u=Math.sqrt(b);a+="\nDistance: "+u;var c=i.nodeRepulsion/b,d=c*y/u,p=c*m/u}e.offsetX-=d,e.offsetY-=p,t.offsetX+=d,t.offsetY+=p,a+="\nForceX: "+d+" ForceY: "+p,w(a)},h=function(e,t,r){var n=e.positionX,i=e.positionY,a=e.height,o=e.width,s=r/t,l=a/o,c="Computing clipping point of node "+e.id+" . Height: "+a+", Width: "+o+"\nDirection "+t+", "+r,u={};do{if(0===t&&r>0){u.x=n,c+="\nUp direction",u.y=i+a/2;break}if(0===t&&0>r){u.x=n,u.y=i+a/2,c+="\nDown direction";break}if(t>0&&s>=-1*l&&l>=s){u.x=n+o/2,u.y=i+o*r/2/t,c+="\nRightborder";break}if(0>t&&s>=-1*l&&l>=s){u.x=n-o/2,u.y=i-o*r/2/t,c+="\nLeftborder";break}if(r>0&&(-1*l>=s||s>=l)){u.x=n+a*t/2/r,u.y=i+a/2,c+="\nTop border";break}if(0>r&&(-1*l>=s||s>=l)){u.x=n-a*t/2/r,u.y=i-a/2,c+="\nBottom border";break}}while(!1);return c+="\nClipping point found at "+u.x+", "+u.y,w(c),u},g=function(e,t,r,n){if(r>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},v=function(e,t,r){for(var n=0;n<e.edgeSize;n++){var i=e.layoutEdges[n],a=e.idToIndex[i.sourceId],o=e.layoutNodes[a],s=e.idToIndex[i.targetId],l=e.layoutNodes[s],c=l.positionX-o.positionX,u=l.positionY-o.positionY;if(0===c&&0===u)return;var d=h(o,c,u),p=h(l,-1*c,-1*u),g=p.x-d.x,v=p.y-d.y,f=Math.sqrt(g*g+v*v),y=Math.pow(i.idealLength-f,2)/r.edgeElasticity;if(0!==f)var m=y*g/f,b=y*v/f;else var m=0,b=0;o.offsetX+=m,o.offsetY+=b,l.offsetX-=m,l.offsetY-=b;var x="Edge force between nodes "+o.id+" and "+l.id;x+="\nDistance: "+f+" Force: ("+m+", "+b+")",w(x)}},f=function(e,t,r){var n="calculateGravityForces";w(n);for(var i=0;i<e.graphSet.length;i++){var a=e.graphSet[i],o=a.length;if(n="Set: "+a.toString(),w(n),0===i)var s=e.clientHeight/2,l=e.clientWidth/2;else var c=e.layoutNodes[e.idToIndex[a[0]]],u=e.layoutNodes[e.idToIndex[c.parentId]],s=u.positionX,l=u.positionY;n="Center found at: "+s+", "+l,w(n);for(var d=0;o>d;d++){var p=e.layoutNodes[e.idToIndex[a[d]]];n="Node: "+p.id;var h=s-p.positionX,g=l-p.positionY,v=Math.sqrt(h*h+g*g);if(v>1){var f=r.gravity*h/v,y=r.gravity*g/v;p.offsetX+=f,p.offsetY+=y,n+=": Applied force: "+f+", "+y}else n+=": skypped since it's too close to center";w(n)}}},y=function(e){var t=[],r=0,n=-1;for(w("propagateForces"),t.push.apply(t,e.graphSet[0]),n+=e.graphSet[0].length;n>=r;){var i=t[r++],a=e.idToIndex[i],o=e.layoutNodes[a],s=o.children;if(0<s.length){var l=o.offsetX,c=o.offsetY,u="Propagating offset from parent node : "+o.id+". OffsetX: "+l+". OffsetY: "+c;u+="\n Children: "+s.toString(),w(u);for(var d=0;d<s.length;d++){var p=e.layoutNodes[e.idToIndex[s[d]]];p.offsetX+=l,p.offsetY+=c,t[++n]=s[d]}o.offsetX=0,o.offsetY=0}}},m=function(e){var t="Updating positions";w(t);for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];0<n.children.length&&(w("Resetting boundaries of compound node: "+n.id),n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];if(0<n.children.length)w("Skipping position update of node: "+n.id);else{t="Node: "+n.id+" Previous position: ("+n.positionX+", "+n.positionY+").";var i=b(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,t+=" New Position: ("+n.positionX+", "+n.positionY+").",w(t),x(n,e)}}for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];0<n.children.length&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,t="Updating position, size of compound node "+n.id,t+="\nPositionX: "+n.positionX+", PositionY: "+n.positionY,t+="\nWidth: "+n.width+", Height: "+n.height,w(t))}},b=function(e,t,r){var n="Limiting force: ("+e+", "+t+"). Max: "+r,i=Math.sqrt(e*e+t*t);if(i>r)var a={x:r*e/i,y:r*t/i};else var a={x:e,y:t};return n+=".\nResult: ("+a.x+", "+a.y+")",w(n),a},x=function(e,t){var r="Propagating new position/size of node "+e.id,n=e.parentId;if(null==n)return r+=". No parent node.",void w(r);var i=t.layoutNodes[t.idToIndex[n]],a=!1;return(null==i.maxX||e.maxX+i.padRight>i.maxX)&&(i.maxX=e.maxX+i.padRight,a=!0,r+="\nNew maxX for parent node "+i.id+": "+i.maxX),(null==i.minX||e.minX-i.padLeft<i.minX)&&(i.minX=e.minX-i.padLeft,a=!0,r+="\nNew minX for parent node "+i.id+": "+i.minX),(null==i.maxY||e.maxY+i.padBottom>i.maxY)&&(i.maxY=e.maxY+i.padBottom,a=!0,r+="\nNew maxY for parent node "+i.id+": "+i.maxY),(null==i.minY||e.minY-i.padTop<i.minY)&&(i.minY=e.minY-i.padTop,a=!0,r+="\nNew minY for parent node "+i.id+": "+i.minY),a?(w(r),x(i,t)):(r+=". No changes in boundaries/position of parent node "+i.id,void w(r))},w=function(e){r&&console.debug(e)};e("layout","cose",t)}(cytoscape),function(e){"use strict";function t(t){this.options=e.util.extend({},r,t)}var r={fit:!0,padding:30,rows:void 0,columns:void 0,position:function(){},ready:void 0,stop:void 0};t.prototype.run=function(){var e=this.options,t=e,r=e.cy,n=r.nodes(),i=r.container(),a=i.clientWidth,o=i.clientHeight;if(0===o||0===a)n.positions(function(){return{x:0,y:0}});else{var s=n.size(),l=Math.sqrt(s*o/a),c=Math.round(l),u=Math.round(a/o*l),d=function(e){if(null==e)return Math.min(c,u);var t=Math.min(c,u);t==c?c=e:u=e},p=function(e){if(null==e)return Math.max(c,u);var t=Math.max(c,u);t==c?c=e:u=e};if(null!=t.rows&&null!=t.columns)c=t.rows,u=t.columns;else if(null!=t.rows&&null==t.columns)c=t.rows,u=Math.ceil(s/c);else if(null==t.rows&&null!=t.columns)u=t.columns,c=Math.ceil(s/u);else if(u*c>s){var h=d(),g=p();(h-1)*g>=s?d(h-1):(g-1)*h>=s&&p(g-1)}else for(;s>u*c;){var h=d(),g=p();(g+1)*h>=s?p(g+1):d(h+1)}for(var v=a/u,f=o/c,y=0;y<n.length;y++){var m=n[y],b=m.outerWidth(),x=m.outerHeight();v=Math.max(v,b),f=Math.max(f,x)}for(var w={},_=function(e,t){return w["c-"+e+"-"+t]?!0:!1},E=function(e,t){w["c-"+e+"-"+t]=!0},S=0,P=0,k=function(){P++,P>=u&&(P=0,S++)},C={},y=0;y<n.length;y++){var m=n[y],D=t.position(m);if(D&&(void 0!==D.row||void 0!==D.col)){var N={row:D.row,col:D.col};if(void 0===N.col)for(N.col=0;_(N.row,N.col);)N.col++;else if(void 0===N.row)for(N.row=0;_(N.row,N.col);)N.row++;C[m.id()]=N,E(N.row,N.col)}}n.positions(function(e,t){var r,n;if(t.locked()||t.isFullAutoParent())return!1;var i=C[t.id()];if(i)r=i.col*v+v/2,n=i.row*f+f/2;else{for(;_(S,P);)k();r=P*v+v/2,n=S*f+f/2,E(S,P),k()}return{x:r,y:n}})}e.fit&&r.fit(t.padding),r.one("layoutready",e.ready),r.trigger("layoutready"),r.one("layoutstop",e.stop),r.trigger("layoutstop")},t.prototype.stop=function(){},e("layout","grid",t)}(cytoscape),function(e){"use strict";function t(t){this.options=e.util.extend(!0,{},r,t)}var r={ready:function(){},stop:function(){}};t.prototype.run=function(){var e=this.options,t=e.cy;t.nodes().positions(function(){return{x:0,y:0}}),t.one("layoutready",e.ready),t.trigger("layoutready"),t.one("layoutstop",e.stop),t.trigger("layoutstop")},t.prototype.stop=function(){var e=this.options,t=e.cy;t.one("layoutstop",e.stop),t.trigger("layoutstop")},e("layout","null",t)}(cytoscape),function(e){"use strict";function t(t){this.options=e.util.extend(!0,{},r,t)}var r={fit:!0,ready:void 0,stop:void 0,positions:void 0,zoom:void 0,pan:void 0,padding:30};t.prototype.run=function(){function e(e){return null==t.positions?null:null==t.positions[e._private.data.id]?null:t.positions[e._private.data.id]}var t=this.options,r=t.cy,n=r.nodes();n.positions(function(t,r){var n=e(r);return r.locked()||null==n?!1:n}),null!=t.pan&&r.pan(t.pan),null!=t.zoom&&r.zoom(t.zoom),r.one("layoutready",t.ready),r.trigger("layoutready"),t.fit&&r.fit(t.padding),r.one("layoutstop",t.stop),r.trigger("layoutstop")},e("layout","preset",t),e("core","presetLayout",function(){var e=this,t={},r={};return e.nodes().each(function(e,t){r[t.data("id")]=t.position()}),t.positions=r,t.name="preset",t.zoom=e.zoom(),t.pan=e.pan(),t})}(cytoscape),function(e){"use strict";function t(t){this.options=e.util.extend(!0,{},r,t)}var r={ready:void 0,stop:void 0,fit:!0,padding:30};t.prototype.run=function(){var e=this.options,t=e.cy,r=t.nodes(),n=t.container(),i=n.clientWidth,a=n.clientHeight;r.positions(function(e,t){return t.locked()?!1:{x:Math.round(Math.random()*i),y:Math.round(Math.random()*a)}}),t.one("layoutready",e.ready),t.trigger("layoutready"),e.fit&&t.fit(e.padding),t.one("layoutstop",e.stop),t.trigger("layoutstop")},t.prototype.stop=function(){},e("layout","random",t)}(cytoscape),function(e){"use strict";function t(t){this.options=e.util.extend(!0,{},r,t)}var r={maxSimulationTime:1e3,ungrabifyWhileSimulating:!0,fit:!0,random:!1};t.prototype.run=function(){function e(e){var t=e.scratch("springy").model.id,r=b.layout.nodePoints[t].p,n=e.position(),i=null!=n.x&&null!=n.y?v(e.position()):{x:4*Math.random()-2,y:4*Math.random()-2};r.x=i.x,r.y=i.y}function t(){i.ungrabifyWhileSimulating&&x.ungrabify(),b.start()}function r(e){d.filterNodes(function(){return!1}),setTimeout(function(){i.ungrabifyWhileSimulating&&x.grabify(),e()},100)}var n=this,i=this.options,a=i.cy,o=a.nodes(),s=a.edges(),l=a.container(),c=l.clientWidth,u=l.clientHeight,d=new Springy.Graph;o.each(function(e,t){t.scratch("springy",{model:d.newNode({element:t})})}),s.each(function(e,t){var r=t.source().scratch("springy").model,n=t.target().scratch("springy").model;t.scratch("springy",{model:d.newEdge(r,n,{element:t})})});var p=new Springy.Layout.ForceDirected(d,400,400,.5),h=p.getBoundingBox(),g=function(e){var t=h.topright.subtract(h.bottomleft),r=e.subtract(h.bottomleft).divide(t.x).x*c,n=e.subtract(h.bottomleft).divide(t.y).y*u;return new Springy.Vector(r,n)},v=function(e){var t=h.topright.subtract(h.bottomleft),r=e.x/c*t.x+h.bottomleft.x,n=e.y/u*t.y+h.bottomleft.y;return new Springy.Vector(r,n)},f=a.collection(),y=a.nodes().size(),m=1,b=new Springy.Renderer(p,function(){},function(){},function(t,r){var n=g(r),o=t.data.element;window.p=r,window.n=t,o.locked()?e(o):(o._private.position={x:n.x,y:n.y},f=f.add(o)),m==y&&(a.one("layoutready",i.ready),a.trigger("layoutready")),m++});o.each(function(t,r){i.random||e(r)}),setInterval(function(){f.size()>0&&(f.rtrigger("position"),f=a.collection())},50),o.bind("drag",function(){e(this)});var x=o.filter(":grabbable"),w=n.stopSystem=function(){r(function(){i.fit&&a.fit(),a.one("layoutstop",i.stop),a.trigger("layoutstop"),n.stopSystem=null})};t(),setTimeout(function(){w()},i.maxSimulationTime)},t.prototype.stop=function(){null!=this.stopSystem&&this.stopSystem()},e("layout","springy",t)}(cytoscape),function(e){"use strict";function t(e){this.options=e}t.prototype.notify=function(){},e("renderer","null",t)}(cytoscape); | tambien/cdnjs | ajax/libs/cytoscape/2.2.13/cytoscape.min.js | JavaScript | mit | 215,357 |
tinyMCE.addI18n('hi.fullpage_dlg',{title:"Document properties","meta_tab":"General","appearance_tab":"Appearance","advanced_tab":"Advanced","meta_props":"Meta information",langprops:"Language and encoding","meta_title":"Title","meta_keywords":"Keywords","meta_description":"Description","meta_robots":"Robots",doctypes:"Doctype",langcode:"Language code",langdir:"Language direction",ltr:"Left to right",rtl:"Right to left","xml_pi":"XML declaration",encoding:"Character encoding","appearance_bgprops":"Background properties","appearance_marginprops":"Body margins","appearance_linkprops":"Link colors","appearance_textprops":"Text properties",bgcolor:"Background color",bgimage:"Background image","left_margin":"Left margin","right_margin":"Right margin","top_margin":"Top margin","bottom_margin":"Bottom margin","text_color":"Text color","font_size":"Font size","font_face":"Font face","link_color":"Link color","hover_color":"Hover color","visited_color":"Visited color","active_color":"Active color",textcolor:"Color",fontsize:"Font size",fontface:"Font family","meta_index_follow":"Index and follow the links","meta_index_nofollow":"Index and don\'t follow the links","meta_noindex_follow":"Do not index but follow the links","meta_noindex_nofollow":"Do not index and don\\\'t follow the links","appearance_style":"Stylesheet and style properties",stylesheet:"Stylesheet",style:"Style",author:"Author",copyright:"Copyright",add:"Add new element",remove:"Remove selected element",moveup:"Move selected element up",movedown:"Move selected element down","head_elements":"Head elements",info:"Information","add_title":"Title element","add_meta":"Meta element","add_script":"Script element","add_style":"Style element","add_link":"Link element","add_base":"Base element","add_comment":"Comment node","title_element":"Title element","script_element":"Script element","style_element":"Style element","base_element":"Base element","link_element":"Link element","meta_element":"Meta element","comment_element":"Comment",src:"Src",language:"Language",href:"Href",target:"Target",type:"Type",charset:"Charset",defer:"Defer",media:"Media",properties:"Properties",name:"Name",value:"Value",content:"Content",rel:"Rel",rev:"Rev",hreflang:"Href lang","general_props":"General","advanced_props":"Advanced"}); | ducin/cdnjs | ajax/libs/tinymce/3.5.8/plugins/fullpage/langs/hi_dlg.js | JavaScript | mit | 2,296 |
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
define("dojo/cldr/nls/ru/japanese",{"field-second":"Секунда","field-year-relative+-1":"В прошлом году","field-week":"Неделя","field-month-relative+-1":"В прошлом месяце","field-day-relative+-1":"Вчера","field-day-relative+-2":"Позавчера","field-year":"Год","field-week-relative+0":"На этой неделе","field-week-relative+1":"На следующей неделе","field-minute":"Минута","field-week-relative+-1":"На прошлой неделе","field-day-relative+0":"Сегодня","field-hour":"Час","field-day-relative+1":"Завтра","field-day-relative+2":"Послезавтра","field-day":"День","field-month-relative+0":"В этом месяце","field-month-relative+1":"В следующем месяце","field-dayperiod":"ДП/ПП","field-month":"Месяц","field-era":"Эра","field-year-relative+0":"В этом году","field-year-relative+1":"В следующем году","eraAbbr":["Эпоха Тайка (645-650)","Эпоха Хакути (650-671)","Эпоха Хакухо (672-686)","Эпоха Сючё (686-701)","Эпоха Тайхо (701-704)","Эпоха Кёюн (704-708)","Эпоха Вадо (708-715)","Эпоха Рэйки (715-717)","Эпоха Ёро (717-724)","Эпоха Дзинки (724-729)","Эпоха Темпьё (729-749)","Эпоха Темпьё (749-749)","Эпоха Темпьё-Сьохо (749-757)","Эпоха Темпьё-Ходзи (757-765)","Эпоха Темпьё-Ходзи (765-767)","Эпоха Джинго-Кёюн (767-770)","Эпоха Хоки (770-780)","Эпоха Теньё (781-782)","Эпоха Енряку (782-806)","Эпоха Дайдо (806-810)","Эпоха Конин (810-824)","Эпоха Тентьо (824-834)","Эпоха Шова (834-848)","Эпоха Кайо (848-851)","Эпоха Ниндзю (851-854)","Эпоха Сайко (854-857)","Эпоха Теннан (857-859)","Эпоха Йоган (859-877)","Эпоха Генкей (877-885)","Эпоха Нинна (885-889)","Эпоха Кампьё (889-898)","Эпоха Сьотай (898-901)","Эпоха Энги (901-923)","Эпоха Ентьо (923-931)","Эпоха Сьёхэй (931-938)","Эпоха Тенгьо (938-947)","Эпоха Тенрияку (947-957)","Эпоха Тентоку (957-961)","Эпоха Ова (961-964)","Эпоха Кохо (964-968)","Эпоха Анна (968-970)","Эпоха Тенроку (970-973)","Эпоха Теньен (973-976)","Эпоха Дзьоген (976-978)","Эпоха Тенген (978-983)","Эпоха Ейкан (983-985)","Эпоха Канна (985-987)","Эпоха Ейен (987-989)","Эпоха Ейсо (989-990)","Эпоха Сёряку (990-995)","Эпоха Тётоку (995-999)","Эпоха Тёхо (999-1004)","Эпоха Канко (1004-1012)","Эпоха Тёва (1012-1017)","Эпоха Каннин (1017-1021)","Эпоха Дзиан (1021-1024)","Эпоха Мандзю (1024-1028)","Эпоха Тёгэн (1028-1037)","Эпоха Тёряку (1037-1040)","Эпоха Тёкю (1040-1044)","Эпоха Катоку (1044-1046)","Эпоха Эйсо (1046-1053)","Эпоха Тэнги (1053-1058)","Эпоха Кохэй (1058-1065)","Эпоха Дзиряку (1065-1069)","Эпоха Энкю (1069-1074)","Эпоха Сёхо (1074-1077)","Эпоха Сёряку (1077-1081)","Эпоха Эйхо (1081-1084)","Эпоха Отоку (1084-1087)","Эпоха Кандзи (1087-1094)","Эпоха Кахо (1094-1096)","Эпоха Эйтё (1096-1097)","Эпоха Сётоку (1097-1099)","Эпоха Кова (1099-1104)","Эпоха Тёдзи (1104-1106)","Эпоха Касё (1106-1108)","Эпоха Тэннин (1108-1110)","Эпоха Тэнъэй (1110-1113)","Эпоха Эйкю (1113-1118)","Эпоха Гэнъэй (1118-1120)","Эпоха Хоан (1120-1124)","Эпоха Тэндзи (1124-1126)","Эпоха Дайдзи (1126-1131)","Эпоха Тэнсё (1131-1132)","Эпоха Тёсё (1132-1135)","Эпоха Хоэн (1135-1141)","Эпоха Эйдзи (1141-1142)","Эпоха Кодзи (1142-1144)","Эпоха Тэнё (1144-1145)","Эпоха Кюан (1145-1151)","Эпоха Нимпэй (1151-1154)","Эпоха Кюдзю (1154-1156)","Эпоха Хогэн (1156-1159)","Эпоха Хэйдзи (1159-1160)","Эпоха Эйряку (1160-1161)","Эпоха Охо (1161-1163)","Эпоха Тёкан (1163-1165)","Эпоха Эйман (1165-1166)","Эпоха Нинъан (1166-1169)","Эпоха Као (1169-1171)","Эпоха Сёан (1171-1175)","Эпоха Ангэн (1175-1177)","Эпоха Дзисё (1177-1181)","Эпоха Ёва (1181-1182)","Эпоха Дзюэй (1182-1184)","Эпоха Гэнрюку (1184-1185)","Эпоха Бундзи (1185-1190)","Эпоха Кэнкю (1190-1199)","Эпоха Сёдзи (1199-1201)","Эпоха Кэннин (1201-1204)","Эпоха Гэнкю (1204-1206)","Эпоха Кэнъэй (1206-1207)","Эпоха Сёгэн (1207-1211)","Эпоха Кэнряку (1211-1213)","Эпоха Кэмпо (1213-1219)","Эпоха Сёкю (1219-1222)","Эпоха Дзёо (1222-1224)","Эпоха Гэннин (1224-1225)","Эпоха Кароку (1225-1227)","Эпоха Антэй (1227-1229)","Эпоха Канки (1229-1232)","Эпоха Дзёэй (1232-1233)","Эпоха Тэмпуку (1233-1234)","Эпоха Бунряку (1234-1235)","Эпоха Катэй (1235-1238)","Эпоха Рякунин (1238-1239)","Эпоха Энъо (1239-1240)","Эпоха Ниндзи (1240-1243)","Эпоха Кангэн (1243-1247)","Эпоха Ходзи (1247-1249)","Эпоха Кэнтё (1249-1256)","Эпоха Когэн (1256-1257)","Эпоха Сёка (1257-1259)","Эпоха Сёгэн (1259-1260)","Эпоха Бунъо (1260-1261)","Эпоха Котё (1261-1264)","Эпоха Бунъэй (1264-1275)","Эпоха Кэндзи (1275-1278)","Эпоха Коан (1278-1288)","Эпоха Сёо (1288-1293)","Эпоха Эйнин (1293-1299)","Эпоха Сёан (1299-1302)","Эпоха Кэнгэн (1302-1303)","Эпоха Кагэн (1303-1306)","Эпоха Токудзи (1306-1308)","Эпоха Энкэй (1308-1311)","Эпоха Отё (1311-1312)","Эпоха Сёва (1312-1317)","Эпоха Бумпо (1317-1319)","Эпоха Гэно (1319-1321)","Эпоха Гэнкё (1321-1324)","Эпоха Сётю (1324-1326)","Эпоха Карэки (1326-1329)","Эпоха Гэнтоку (1329-1331)","Эпоха Гэнко (1331-1334)","Эпоха Кэмму (1334-1336)","Эпоха Энгэн (1336-1340)","Эпоха Кококу (1340-1346)","Эпоха Сёхэй (1346-1370)","Эпоха Кэнтоку (1370-1372)","Эпоха Бунтю (1372-1375)","Эпоха Иэндзю (1375-1379)","Эпоха Коряку (1379-1381)","Эпоха Кова (1381-1384)","Эпоха Гэнтю (1384-1392)","Эпоха Мэйтоку (1384-1387)","Эпоха Какэй (1387-1389)","Эпоха Коо (1389-1390)","Эпоха Мэйтоку (1390-1394)","Эпоха Оэй (1394-1428)","Эпоха Сётё (1428-1429)","Эпоха Эйкё (1429-1441)","Эпоха Какицу (1441-1444)","Эпоха Банъан (1444-1449)","Эпоха Хотоку (1449-1452)","Эпоха Кётоку (1452-1455)","Эпоха Косё (1455-1457)","Эпоха Тёроку (1457-1460)","Эпоха Кансё (1460-1466)","Эпоха Бунсё (1466-1467)","Эпоха Онин (1467-1469)","Эпоха Буммэй (1469-1487)","Эпоха Тёкё (1487-1489)","Эпоха Энтоку (1489-1492)","Эпоха Мэйо (1492-1501)","Эпоха Бунки (1501-1504)","Эпоха Эйсё (1504-1521)","Эпоха Тайэй (1521-1528)","Эпоха Кёроку (1528-1532)","Эпоха Тэммон (1532-1555)","Эпоха Кодзи (1555-1558)","Эпоха Эйроку (1558-1570)","Эпоха Гэнки (1570-1573)","Эпоха Тэнсё (1573-1592)","Эпоха Бунроку (1592-1596)","Эпоха Кэйтё (1596-1615)","Эпоха Гэнва (1615-1624)","Эпоха Канъэй (1624-1644)","Эпоха Сёхо (1644-1648)","Эпоха Кэйан (1648-1652)","Эпоха Сё (1652-1655)","Эпоха Мэйряку (1655-1658)","Эпоха Мандзи (1658-1661)","Эпоха Камбун (1661-1673)","Эпоха Эмпо (1673-1681)","Эпоха Тэнва (1681-1684)","Эпоха Дзёкё (1684-1688)","Эпоха Гэнроку (1688-1704)","Эпоха Хоэй (1704-1711)","Эпоха Сётоку (1711-1716)","Эпоха Кёхо (1716-1736)","Эпоха Гэмбун (1736-1741)","Эпоха Кампо (1741-1744)","Эпоха Энкё (1744-1748)","Эпоха Канъэн (1748-1751)","Эпоха Хоряку (1751-1764)","Эпоха Мэйва (1764-1772)","Эпоха Анъэй (1772-1781)","Эпоха Тэммэй (1781-1789)","Эпоха Кансэй (1789-1801)","Эпоха Кёва (1801-1804)","Эпоха Бунка (1804-1818)","Эпоха Бунсэй (1818-1830)","Эпоха Тэмпо (1830-1844)","Эпоха Кока (1844-1848)","Эпоха Каэй (1848-1854)","Эпоха Ансэй (1854-1860)","Эпоха Манъэн (1860-1861)","Эпоха Бункю (1861-1864)","Эпоха Гендзи (1864-1865)","Эпоха Кейо (1865-1868)","Эпоха Мэйдзи","Эпоха Тайсьо","Сьова","Эпоха Хэйсэй"],"field-weekday":"День недели","field-zone":"Часовой пояс"});
| viskin/cdnjs | ajax/libs/dojo/1.9.5/cldr/nls/ru/japanese.js | JavaScript | mit | 9,736 |
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
define("dojo/cldr/nls/pt/japanese",{"dateFormat-medium":"dd/MM/y G","field-second":"Segundo","field-year-relative+-1":"Ano passado","field-week":"Semana","field-month-relative+-1":"Mês passado","field-day-relative+-1":"Ontem","field-day-relative+-2":"Anteontem","field-year":"Ano","field-week-relative+0":"Esta semana","field-week-relative+1":"Próxima semana","field-minute":"Minuto","field-week-relative+-1":"Semana passada","field-day-relative+0":"Hoje","field-hour":"Hora","field-day-relative+1":"Amanhã","dateFormat-long":"d 'de' MMMM 'de' y G","field-day-relative+2":"Depois de amanhã","field-day":"Dia","field-month-relative+0":"Este mês","field-month-relative+1":"Próximo mês","field-dayperiod":"Período do dia","field-month":"Mês","dateFormat-short":"dd/MM/yy GGGGG","field-era":"Era","field-year-relative+0":"Este ano","field-year-relative+1":"Próximo ano","dateFormat-full":"EEEE, d 'de' MMMM 'de' y G","field-weekday":"Dia da semana","field-zone":"Fuso"});
| CosmicWebServices/cdnjs | ajax/libs/dojo/1.9.3/cldr/nls/pt/japanese.js | JavaScript | mit | 1,184 |
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Factory\Resource;
use Symfony\Component\Templating\Loader\LoaderInterface;
class DirectoryResourceIterator extends \RecursiveIteratorIterator
{
protected $loader;
protected $bundle;
protected $path;
/**
* Constructor.
*
* @param LoaderInterface $loader The templating loader
* @param string $bundle The current bundle name
* @param string $path The directory
* @param RecursiveIterator $iterator The inner iterator
*/
public function __construct(LoaderInterface $loader, $bundle, $path, \RecursiveIterator $iterator)
{
$this->loader = $loader;
$this->bundle = $bundle;
$this->path = $path;
parent::__construct($iterator);
}
public function current()
{
$file = parent::current();
return new FileResource($this->loader, $this->bundle, $this->path, $file->getPathname());
}
}
| Rafli1/NetbeansINRA | vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Factory/Resource/DirectoryResourceIterator.php | PHP | mit | 1,198 |
"use strict";angular.module("ngLocale",[],["$provide",function(a){var d={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};function c(f){f=f+"";var e=f.indexOf(".");return(e==-1)?0:f.length-e-1}function b(j,e){var g=e;if(undefined===g){g=Math.min(c(j),3)}var i=Math.pow(10,g);var h=((j*i)|0)%i;return{v:g,f:h}}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["\u121b\u1208\u12f6","\u1243\u121b"],DAY:["\u12c8\u130b","\u1233\u12ed\u1296","\u121b\u1246\u1233\u129b","\u12a0\u1229\u12cb","\u1203\u1219\u1233","\u12a0\u122d\u1263","\u1244\u122b"],MONTH:["\u1303\u1295\u12e9\u12c8\u122a","\u134c\u1265\u1229\u12c8\u122a","\u121b\u122d\u127d","\u12a4\u1355\u1228\u120d","\u121c\u12ed","\u1301\u1295","\u1301\u120b\u12ed","\u12a6\u1308\u1235\u1275","\u1234\u1355\u1274\u121d\u1260\u122d","\u12a6\u12ad\u1270\u12cd\u1260\u122d","\u1296\u126c\u121d\u1260\u122d","\u12f2\u1234\u121d\u1260\u122d"],SHORTDAY:["\u12c8\u130b","\u1233\u12ed\u1296","\u121b\u1246\u1233\u129b","\u12a0\u1229\u12cb","\u1203\u1219\u1233","\u12a0\u122d\u1263","\u1244\u122b"],SHORTMONTH:["\u1303\u1295\u12e9","\u134c\u1265\u1229","\u121b\u122d\u127d","\u12a4\u1355\u1228","\u121c\u12ed","\u1301\u1295","\u1301\u120b\u12ed","\u12a6\u1308\u1235","\u1234\u1355\u1274","\u12a6\u12ad\u1270","\u1296\u126c\u121d","\u12f2\u1234\u121d"],fullDate:"EEEE\u1365 dd MMMM \u130b\u120b\u1233 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:"Birr",DECIMAL_SEP:".",GROUP_SEP:"\u2019",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:"wal",pluralCat:function(h,f){var g=h|0;var e=b(h,f);if(g==1&&e.v==0){return d.ONE}return d.OTHER}})}]); | jackdoyle/cdnjs | ajax/libs/angular-i18n/1.2.28/angular-locale_wal.min.js | JavaScript | mit | 1,900 |
"use strict";angular.module("ngLocale",[],["$provide",function(a){var d={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};function c(f){f=f+"";var e=f.indexOf(".");return(e==-1)?0:f.length-e-1}function b(j,e){var g=e;if(undefined===g){g=Math.min(c(j),3)}var i=Math.pow(10,g);var h=((j*i)|0)%i;return{v:g,f:h}}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:["Cawe","Mvulo","Lwesibini","Lwesithathu","Lwesine","Lwesihlanu","Mgqibelo"],MONTH:["Janyuwari","Februwari","Matshi","Epreli","Meyi","Juni","Julayi","Agasti","Septemba","Okthoba","Novemba","Disemba"],SHORTDAY:["Caw","Mvu","Bin","Tha","Sin","Hla","Mgq"],SHORTMONTH:["Jan","Feb","Mat","Epr","Mey","Jun","Jul","Aga","Sep","Okt","Nov","Dis"],fullDate:"y MMMM d, EEEE",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:"R",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-",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"xh-za",pluralCat:function(h,f){var g=h|0;var e=b(h,f);if(g==1&&e.v==0){return d.ONE}return d.OTHER}})}]); | joeyparrish/cdnjs | ajax/libs/angular-i18n/1.4.0/angular-locale_xh-za.min.js | JavaScript | mit | 1,283 |
"use strict";angular.module("ngLocale",[],["$provide",function(a){var d={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};function c(f){f=f+"";var e=f.indexOf(".");return(e==-1)?0:f.length-e-1}function b(j,e){var g=e;if(undefined===g){g=Math.min(c(j),3)}var i=Math.pow(10,g);var h=((j*i)|0)%i;return{v:g,f:h}}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["\u043f\u0435. \u0447\u043e.","\u043f\u0430. \u0447\u043e."],DAY:["\u042f\u043a\u0448\u0430\u043d\u0431\u0435","\u0414\u0443\u0448\u0430\u043d\u0431\u0435","\u0421\u0435\u0448\u0430\u043d\u0431\u0435","\u0427\u043e\u0440\u0448\u0430\u043d\u0431\u0435","\u041f\u0430\u043d\u04b7\u0448\u0430\u043d\u0431\u0435","\u04b6\u0443\u043c\u044a\u0430","\u0428\u0430\u043d\u0431\u0435"],MONTH:["\u042f\u043d\u0432\u0430\u0440","\u0424\u0435\u0432\u0440\u0430\u043b","\u041c\u0430\u0440\u0442","\u0410\u043f\u0440\u0435\u043b","\u041c\u0430\u0439","\u0418\u044e\u043d","\u0418\u044e\u043b","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043d\u0442\u044f\u0431\u0440","\u041e\u043a\u0442\u044f\u0431\u0440","\u041d\u043e\u044f\u0431\u0440","\u0414\u0435\u043a\u0430\u0431\u0440"],SHORTDAY:["\u042f\u0448\u0431","\u0414\u0448\u0431","\u0421\u0448\u0431","\u0427\u0448\u0431","\u041f\u0448\u0431","\u04b6\u043c\u044a","\u0428\u043d\u0431"],SHORTMONTH:["\u042f\u043d\u0432","\u0424\u0435\u0432","\u041c\u0430\u0440","\u0410\u043f\u0440","\u041c\u0430\u0439","\u0418\u044e\u043d","\u0418\u044e\u043b","\u0410\u0432\u0433","\u0421\u0435\u043d","\u041e\u043a\u0442","\u041d\u043e\u044f","\u0414\u0435\u043a"],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":"yy/MM/dd HH:mm",shortDate:"yy/MM/dd",shortTime:"HH:mm"},NUMBER_FORMATS:{CURRENCY_SYM:"Som",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:"tg-cyrl-tj",pluralCat:function(h,f){var g=h|0;var e=b(h,f);if(g==1&&e.v==0){return d.ONE}return d.OTHER}})}]); | sajochiu/cdnjs | ajax/libs/angular-i18n/1.2.27/angular-locale_tg-cyrl-tj.min.js | JavaScript | mit | 2,144 |
/*************
Black Ice Theme (by thezoggy)
*************/
/* overall */
.tablesorter-blackice {
width: 100%;
margin-right: auto;
margin-left: auto;
font: 11px/18px Arial, Sans-serif;
text-align: left;
background-color: #000;
border-collapse: collapse;
border-spacing: 0;
}
/* header */
.tablesorter-blackice th,
.tablesorter-blackice thead td {
padding: 4px;
font: bold 13px/20px Arial, Sans-serif;
color: #e5e5e5;
text-align: left;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
background-color: #111;
border: 1px solid #232323;
}
.tablesorter-blackice .header,
.tablesorter-blackice .tablesorter-header {
padding: 4px 20px 4px 4px;
cursor: pointer;
background-image: url(data:image/gif;base64,R0lGODlhFQAJAIAAAP///////yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==);
background-position: center right;
background-repeat: no-repeat;
}
.tablesorter-blackice .headerSortUp,
.tablesorter-blackice .tablesorter-headerSortUp,
.tablesorter-blackice .tablesorter-headerAsc {
background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAAP///////yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7);
color: #fff;
}
.tablesorter-blackice .headerSortDown,
.tablesorter-blackice .tablesorter-headerSortDown,
.tablesorter-blackice .tablesorter-headerDesc {
color: #fff;
background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAAP///////yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7);
}
.tablesorter-blackice thead .sorter-false {
background-image: none;
cursor: default;
padding: 4px;
}
/* tfoot */
.tablesorter-blackice tfoot .tablesorter-headerSortUp,
.tablesorter-blackice tfoot .tablesorter-headerSortDown,
.tablesorter-blackice tfoot .tablesorter-headerAsc,
.tablesorter-blackice tfoot .tablesorter-headerDesc {
/* remove sort arrows from footer */
background-image: none;
}
/* tbody */
.tablesorter-blackice td {
padding: 4px;
color: #ccc;
vertical-align: top;
background-color: #333;
border: 1px solid #232323;
}
/* hovered row colors */
.tablesorter-blackice tbody > tr:hover > td,
.tablesorter-blackice tbody > tr.even:hover > td,
.tablesorter-blackice tbody > tr.odd:hover > td {
background: #000;
}
/* table processing indicator */
.tablesorter-blackice .tablesorter-processing {
background-position: center center !important;
background-repeat: no-repeat !important;
/* background-image: url(../addons/pager/icons/loading.gif) !important; */
background-image: url('data:image/gif;base64,R0lGODlhFAAUAKEAAO7u7lpaWgAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQBCgACACwAAAAAFAAUAAACQZRvoIDtu1wLQUAlqKTVxqwhXIiBnDg6Y4eyx4lKW5XK7wrLeK3vbq8J2W4T4e1nMhpWrZCTt3xKZ8kgsggdJmUFACH5BAEKAAIALAcAAAALAAcAAAIUVB6ii7jajgCAuUmtovxtXnmdUAAAIfkEAQoAAgAsDQACAAcACwAAAhRUIpmHy/3gUVQAQO9NetuugCFWAAAh+QQBCgACACwNAAcABwALAAACE5QVcZjKbVo6ck2AF95m5/6BSwEAIfkEAQoAAgAsBwANAAsABwAAAhOUH3kr6QaAcSrGWe1VQl+mMUIBACH5BAEKAAIALAIADQALAAcAAAIUlICmh7ncTAgqijkruDiv7n2YUAAAIfkEAQoAAgAsAAAHAAcACwAAAhQUIGmHyedehIoqFXLKfPOAaZdWAAAh+QQFCgACACwAAAIABwALAAACFJQFcJiXb15zLYRl7cla8OtlGGgUADs=') !important;
}
/* Zebra Widget - row alternating colors */
.tablesorter-blackice tr.odd td {
background-color: #333;
}
.tablesorter-blackice tr.even td {
background-color: #393939;
}
/* Column Widget - column sort colors */
.tablesorter-blackice td.primary,
.tablesorter-blackice tr.odd td.primary {
background-color: #2f3a40;
}
.tablesorter-blackice tr.even td.primary {
background-color: #3f4a50;
}
.tablesorter-blackice td.secondary,
.tablesorter-blackice tr.odd td.secondary {
background-color: #3f4a50;
}
.tablesorter-blackice tr.even td.secondary {
background-color: #4f5a60;
}
.tablesorter-blackice td.tertiary,
.tablesorter-blackice tr.odd td.tertiary {
background-color: #4f5a60;
}
.tablesorter-blackice tr.even td.tertiary {
background-color: #5a646b;
}
/* caption */
caption {
background: #fff;
}
/* filter widget */
.tablesorter-blackice .tablesorter-filter-row td {
background: #222;
line-height: normal;
text-align: center; /* center the input */
-webkit-transition: line-height 0.1s ease;
-moz-transition: line-height 0.1s ease;
-o-transition: line-height 0.1s ease;
transition: line-height 0.1s ease;
}
/* optional disabled input styling */
.tablesorter-blackice .tablesorter-filter-row .disabled {
opacity: 0.5;
filter: alpha(opacity=50);
cursor: not-allowed;
}
/* hidden filter row */
.tablesorter-blackice .tablesorter-filter-row.hideme td {
/*** *********************************************** ***/
/*** change this padding to modify the thickness ***/
/*** of the closed filter row (height = padding x 2) ***/
padding: 2px;
/*** *********************************************** ***/
margin: 0;
line-height: 0;
cursor: pointer;
}
.tablesorter-blackice .tablesorter-filter-row.hideme .tablesorter-filter {
height: 1px;
min-height: 0;
border: 0;
padding: 0;
margin: 0;
/* don't use visibility: hidden because it disables tabbing */
opacity: 0;
filter: alpha(opacity=0);
}
/* filters */
.tablesorter-blackice .tablesorter-filter {
width: 98%;
height: auto;
margin: 0;
padding: 4px;
background-color: #fff;
border: 1px solid #bbb;
color: #333;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: height 0.1s ease;
-moz-transition: height 0.1s ease;
-o-transition: height 0.1s ease;
transition: height 0.1s ease;
}
/* rows hidden by filtering (needed for child rows) */
.tablesorter .filtered {
display: none;
}
/* ajax error row */
.tablesorter .tablesorter-errorRow td {
text-align: center;
cursor: pointer;
background-color: #e6bf99;
}
| kentucky-roberts/cdnjs | ajax/libs/jquery.tablesorter/2.16.2/css/theme.black-ice.css | CSS | mit | 5,576 |
var arrayMap = require('../internal/arrayMap'),
baseDifference = require('../internal/baseDifference'),
baseFlatten = require('../internal/baseFlatten'),
bindCallback = require('../internal/bindCallback'),
keysIn = require('./keysIn'),
pickByArray = require('../internal/pickByArray'),
pickByCallback = require('../internal/pickByCallback'),
restParam = require('../function/restParam');
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable properties of `object` that are not omitted.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {Function|...(string|string[])} [predicate] The function invoked per
* iteration or property names to omit, specified as individual property
* names or arrays of property names.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'user': 'fred', 'age': 40 };
*
* _.omit(object, 'age');
* // => { 'user': 'fred' }
*
* _.omit(object, _.isNumber);
* // => { 'user': 'fred' }
*/
var omit = restParam(function(object, props) {
if (object == null) {
return {};
}
if (typeof props[0] != 'function') {
var props = arrayMap(baseFlatten(props), String);
return pickByArray(object, baseDifference(keysIn(object), props));
}
var predicate = bindCallback(props[0], props[1], 3);
return pickByCallback(object, function(value, key, object) {
return !predicate(value, key, object);
});
});
module.exports = omit;
| ugoh2kelechi/shelexCollections | node_modules/lodash/object/omit.js | JavaScript | mit | 1,601 |
/* Dropdowns
/* ---------------------------------------------------------- */
.dropdown {
position: relative;
z-index: 1000;
}
.dropdown-toggle:focus {
outline: 0;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
float: left;
margin: 2px 0 0;
padding: 10px;
min-width: 200px;
border: #dfe1e3 1px solid;
background-color: #fff;
background-clip: padding-box;
border-radius: 4px;
box-shadow: rgba(0, 0, 0, 0.10) 0 2px 6px;
list-style: none;
text-align: left;
text-transform: none;
letter-spacing: 0;
font-size: 1.4rem;
font-weight: normal;
}
.dropdown-menu.pull-right {
right: 0;
left: auto;
}
.dropdown-menu .divider {
overflow: hidden;
margin: 8px 0;
height: 1px;
background: color(#dfe1e3 lightness(+5%));
}
.dropdown-menu > li > a,
.dropdown-menu > li > button {
display: flex;
align-items: center;
clear: both;
padding: 6px 10px;
width: 100%;
border-radius: 3px;
color: color(var(--darkgrey) lightness(+20%));
text-align: left;
white-space: nowrap;
font-size: 1.3rem;
line-height: 1em;
font-weight: normal;
transition: none;
}
.dropdown-menu i {
margin-right: 10px;
font-size: 14px;
line-height: 1em;
}
@media (max-width: 500px) {
.dropdown-menu > li > a,
.dropdown-menu > li > button {
padding: 7px 8px;
font-size: 1.5rem;
}
.dropdown-menu i {
font-size: 16px;
}
}
/* States
/* ---------------------------------------------------------- */
/* Hover/Focus */
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus,
.dropdown-menu > li > button:hover,
.dropdown-menu > li > button:focus {
background: color(var(--blue) alpha(-85%));
color: var(--darkgrey);
text-decoration: none;
}
/* Active */
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus,
.dropdown-menu > .active > button,
.dropdown-menu > .active > button:hover,
.dropdown-menu > .active > button:focus {
outline: 0;
background-color: #428bca;
color: #fff;
text-decoration: none;
}
/* Disabled */
.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus,
.dropdown-menu > .disabled > button,
.dropdown-menu > .disabled > button:hover,
.dropdown-menu > .disabled > button:focus {
color: #777;
}
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus,
.dropdown-menu > .disabled > button:hover,
.dropdown-menu > .disabled > button:focus {
background-color: transparent;
background-image: none;
text-decoration: none;
cursor: not-allowed;
}
/* Open / Close
/* ---------------------------------------------------------- */
.open > .dropdown-menu {
display: block;
}
.open > a {
outline: 0;
}
.closed > .dropdown-menu {
display: none;
}
/* Selectize
/* ---------------------------------------------------------- */
.selectize-dropdown {
z-index: 200;
}
| barbastan/Ghost | core/client/app/styles/components/dropdowns.css | CSS | mit | 3,047 |
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2011, International Business Machines Corporation and
* others. All Rights Reserved.
* Copyright (C) 2010 , Yahoo! Inc.
********************************************************************/
#include <stdio.h>
#include <string.h>
#include <typeinfo> // for 'typeid' to work
#include "uobjtest.h"
#include "cmemory.h" // UAlignedMemory
/**
* Test for UObject, currently only the classID.
*
* Usage
* TESTCLASSID_NONE_DEFAULT(Foo)
* -- Foo is expected to not support "poor man's RTTI".
* Beginning with ICU 4.6, we only use compiler RTTI in new class hierarchies.
*
* TESTCLASSID_NONE_CTOR(Foo, (1, 2, 3, status))
* -- Combines TESTCLASSID_NONE_DEFAULT() and TESTCLASSID_CTOR().
*
* TESTCLASSID_NONE_FACTORY(Foo, (1, 2, 3, status))
* -- Combines TESTCLASSID_NONE_DEFAULT() and TESTCLASSID_FACTORY().
*
* TESTCLASSID_ABSTRACT(Bar)
* -- Bar is expected to be abstract. Only the static ID will be tested.
*
* TESTCLASSID_DEFAULT(Foo)
* -- Foo will be default-constructed.
*
* TESTCLASSID_CTOR(Foo, (1, 2, 3, status))
* -- Second argument is (parenthesized) constructor argument.
* Will be called as: new Foo ( 1, 2, 3, status) [status is tested]
*
* TESTCLASSID_FACTORY(Foo, fooCreateFunction(status) )
* -- call fooCreateFunction. 'status' will be tested & reset
*
* TESTCLASSID_FACTORY_HIDDEN(class, factory)
* -- call factory. Class is not available from a header.
* 'status' will be tested & reset. This only tests uniqueness.
*/
#define TESTCLASSID_NONE_DEFAULT(c) \
delete testClassNoClassID(new c, #c, "new " #c)
#define TESTCLASSID_NONE_CTOR(c, x) { \
delete testClassNoClassID(new c x, #c, "new " #c #x); \
if(U_FAILURE(status)) { \
dataerrln(UnicodeString(#c " - new " #x " - got err status ") + UnicodeString(u_errorName(status))); \
status = U_ZERO_ERROR; \
} \
}
#define TESTCLASSID_NONE_FACTORY(c, f) { \
delete testClassNoClassID(f, #c, #f); \
if(U_FAILURE(status)) { \
dataerrln(UnicodeString(#c " - " #f " - got err status ") + UnicodeString(u_errorName(status))); \
status = U_ZERO_ERROR; \
} \
}
#define TESTCLASSID_FACTORY(c, f) { \
delete testClass(f, #c, #f, c ::getStaticClassID()); \
if(U_FAILURE(status)) { \
dataerrln(UnicodeString(#c " - " #f " - got err status ") + UnicodeString(u_errorName(status))); \
status = U_ZERO_ERROR; \
} \
}
#define TESTCLASSID_TRANSLIT(c, t) { \
delete testClass(Transliterator::createInstance(UnicodeString(t), UTRANS_FORWARD,parseError,status), #c, "Transliterator: " #t, c ::getStaticClassID()); \
if(U_FAILURE(status)) { \
dataerrln(UnicodeString(#c " - Transliterator: " #t " - got err status ") + UnicodeString(u_errorName(status))); \
status = U_ZERO_ERROR; \
} \
}
#define TESTCLASSID_CTOR(c, x) { \
delete testClass(new c x, #c, "new " #c #x, c ::getStaticClassID()); \
if(U_FAILURE(status)) { \
dataerrln(UnicodeString(#c " - new " #x " - got err status ") + UnicodeString(u_errorName(status))); \
status = U_ZERO_ERROR; \
} \
}
#define TESTCLASSID_DEFAULT(c) \
delete testClass(new c, #c, "new " #c , c::getStaticClassID())
#define TESTCLASSID_ABSTRACT(c) \
testClass(NULL, #c, NULL, c::getStaticClassID())
#define TESTCLASSID_FACTORY_HIDDEN(c, f) { \
UObject *objVar = f; \
delete testClass(objVar, #c, #f, objVar!=NULL? objVar->getDynamicClassID(): NULL); \
if(U_FAILURE(status)) { \
dataerrln(UnicodeString(#c " - " #f " - got err status ") + UnicodeString(u_errorName(status))); \
status = U_ZERO_ERROR; \
} \
}
#define MAX_CLASS_ID 200
static UClassID ids[MAX_CLASS_ID];
static const char *ids_factory[MAX_CLASS_ID];
static const char *ids_class[MAX_CLASS_ID];
static uint32_t ids_count = 0;
UObject *UObjectTest::testClass(UObject *obj,
const char *className, const char *factory,
UClassID staticID)
{
uint32_t i;
UnicodeString what = UnicodeString(className) + " * x= " + UnicodeString(factory?factory:" ABSTRACT ") + "; ";
UClassID dynamicID = NULL;
if(ids_count >= MAX_CLASS_ID) {
char count[100];
sprintf(count, " (currently %d) ", MAX_CLASS_ID);
errln("FAIL: Fatal: Ran out of IDs! Increase MAX_CLASS_ID." + UnicodeString(count) + what);
return obj;
}
if(obj) {
dynamicID = obj->getDynamicClassID();
}
{
char tmp[500];
sprintf(tmp, " [static=%p, dynamic=%p] ", staticID, dynamicID);
logln(what + tmp);
}
if(staticID == NULL) {
dataerrln("FAIL: staticID == NULL! " + what);
}
if(factory != NULL) { /* NULL factory means: abstract */
if(!obj) {
dataerrln( "FAIL: ==NULL! " + what);
return obj;
}
if(dynamicID == NULL) {
errln("FAIL: dynamicID == NULL!" + what);
}
if(dynamicID != staticID) {
dataerrln("FAIL: dynamicID != staticID! " + what);
}
}
// Bail out if static ID is null. Error message was already printed.
if(staticID == NULL) {
return obj;
}
for(i=0;i<ids_count;i++) {
if(staticID == ids[i]) {
if(!strcmp(ids_class[i], className)) {
logln("OK: ID found is the same as " + UnicodeString(ids_class[i]) + UnicodeString(" *y= ") + ids_factory[i] + what);
return obj;
} else {
errln("FAIL: ID is the same as " + UnicodeString(ids_class[i]) + UnicodeString(" *y= ") + ids_factory[i] + what);
return obj;
}
}
}
ids[ids_count] = staticID;
ids_factory[ids_count] = factory;
ids_class[ids_count] = className;
ids_count++;
return obj;
}
UObject *UObjectTest::testClassNoClassID(UObject *obj, const char *className, const char *factory)
{
if (!obj) {
return NULL;
}
UnicodeString what = UnicodeString(className) + " * x= " + UnicodeString(factory?factory:" ABSTRACT ") + "; ";
UClassID dynamicID = obj->getDynamicClassID();
{
char tmp[500];
sprintf(tmp, " [dynamic=%p] ", dynamicID);
logln(what + tmp);
}
if(factory != NULL) { /* NULL factory means: abstract */
if(!obj) {
dataerrln( "FAIL: ==NULL! " + what);
return obj;
}
if(dynamicID != NULL) {
errln("FAIL: dynamicID != NULL! for non-poor-man's-RTTI " + what);
}
}
return obj;
}
// begin actual #includes for things to be tested
//
// The following script will generate the #includes needed here:
//
// find common i18n -name '*.h' -print | xargs fgrep ClassID | cut -d: -f1 | cut -d\/ -f2- | sort | uniq | sed -e 's%.*%#include "&"%'
#include "unicode/utypes.h"
// Internal Things (woo)
#include "cpdtrans.h"
#include "rbt.h"
#include "rbt_data.h"
#include "nultrans.h"
#include "anytrans.h"
#include "digitlst.h"
#include "esctrn.h"
#include "funcrepl.h"
#include "servnotf.h"
#include "serv.h"
#include "servloc.h"
#include "name2uni.h"
#include "nfsubs.h"
#include "nortrans.h"
#include "quant.h"
#include "remtrans.h"
#include "strmatch.h"
#include "strrepl.h"
#include "titletrn.h"
#include "tolowtrn.h"
#include "toupptrn.h"
#include "unesctrn.h"
#include "uni2name.h"
#include "uvector.h"
#include "uvectr32.h"
#include "currfmt.h"
#include "buddhcal.h"
#include "islamcal.h"
#include "japancal.h"
#include "hebrwcal.h"
#include "persncal.h"
#include "taiwncal.h"
#include "indiancal.h"
#include "chnsecal.h"
#include "windtfmt.h"
#include "winnmfmt.h"
#include "ustrenum.h"
#include "olsontz.h"
#include "reldtfmt.h"
// External Things
#include "unicode/appendable.h"
#include "unicode/alphaindex.h"
#include "unicode/brkiter.h"
#include "unicode/calendar.h"
#include "unicode/caniter.h"
#include "unicode/chariter.h"
#include "unicode/choicfmt.h"
#include "unicode/coleitr.h"
#include "unicode/coll.h"
#include "unicode/curramt.h"
#include "unicode/datefmt.h"
#include "unicode/dcfmtsym.h"
#include "unicode/decimfmt.h"
#include "unicode/dtfmtsym.h"
#include "unicode/dtptngen.h"
#include "unicode/fieldpos.h"
#include "unicode/fmtable.h"
#include "unicode/format.h"
#include "unicode/gregocal.h"
#include "unicode/idna.h"
#include "unicode/locdspnm.h"
#include "unicode/locid.h"
#include "unicode/msgfmt.h"
#include "unicode/normlzr.h"
#include "unicode/normalizer2.h"
#include "unicode/numfmt.h"
#include "unicode/parsepos.h"
#include "unicode/plurrule.h"
#include "unicode/plurfmt.h"
#include "unicode/selfmt.h"
#include "unicode/rbbi.h"
#include "unicode/rbnf.h"
#include "unicode/regex.h"
#include "unicode/resbund.h"
#include "unicode/schriter.h"
#include "unicode/simpletz.h"
#include "unicode/smpdtfmt.h"
#include "unicode/sortkey.h"
#include "unicode/stsearch.h"
#include "unicode/tblcoll.h"
#include "unicode/timezone.h"
#include "unicode/translit.h"
#include "unicode/uchriter.h"
#include "unicode/uloc.h"
#include "unicode/unifilt.h"
#include "unicode/unifunct.h"
#include "unicode/uniset.h"
#include "unicode/unistr.h"
#include "unicode/uobject.h"
#include "unicode/usetiter.h"
//#include "unicode/bidi.h"
//#include "unicode/convert.h"
// END includes =============================================================
#define UOBJTEST_TEST_INTERNALS 0 /* do NOT test Internal things - their functions aren't exported on Win32 */
#if !UCONFIG_NO_SERVICE
/* The whole purpose of this class is to expose the constructor, and gain access to the superclasses RTTI. */
class TestLocaleKeyFactory : public LocaleKeyFactory {
public:
TestLocaleKeyFactory(int32_t coverage) : LocaleKeyFactory(coverage) {}
};
#endif
// Appendable is abstract; we define a subclass to verify that there is no "poor man's RTTI".
class DummyAppendable : public Appendable {
public:
virtual UBool appendCodeUnit(UChar /*c*/) { return TRUE; }
};
void UObjectTest::testIDs()
{
ids_count = 0;
UErrorCode status = U_ZERO_ERROR;
#if !UCONFIG_NO_TRANSLITERATION || !UCONFIG_NO_FORMATTING
UParseError parseError;
#endif
#if !UCONFIG_NO_NORMALIZATION
UnicodeString emptyString;
TESTCLASSID_CTOR(Normalizer, (emptyString, UNORM_NONE));
const Normalizer2 *noNormalizer2 = NULL;
UnicodeSet emptySet;
TESTCLASSID_NONE_CTOR(FilteredNormalizer2, (*noNormalizer2, emptySet));
TESTCLASSID_FACTORY(CanonicalIterator, new CanonicalIterator(UnicodeString("abc"), status));
#endif
#if !UCONFIG_NO_IDNA
TESTCLASSID_NONE_FACTORY(IDNA, IDNA::createUTS46Instance(0, status));
#endif
//TESTCLASSID_DEFAULT(CollationElementIterator);
#if !UCONFIG_NO_COLLATION
TESTCLASSID_DEFAULT(CollationKey);
TESTCLASSID_FACTORY(UStringEnumeration, Collator::getKeywords(status));
//TESTCLASSID_FACTORY_HIDDEN(CollationLocaleListEnumeration, Collator::getAvailableLocales());
#endif
//TESTCLASSID_FACTORY(CompoundTransliterator, Transliterator::createInstance(UnicodeString("Any-Jex;Hangul-Jamo"), UTRANS_FORWARD, parseError, status));
#if !UCONFIG_NO_FORMATTING
/* TESTCLASSID_FACTORY(NFSubstitution, NFSubstitution::makeSubstitution(8, */
/* TESTCLASSID_DEFAULT(DigitList); UMemory but not UObject*/
TESTCLASSID_ABSTRACT(NumberFormat);
TESTCLASSID_CTOR(RuleBasedNumberFormat, (UnicodeString("%default: -x: minus >>;"), parseError, status));
TESTCLASSID_CTOR(ChoiceFormat, (UNICODE_STRING_SIMPLE("0#are no files|1#is one file|1<are many files"), status));
TESTCLASSID_CTOR(MessageFormat, (UnicodeString(), status));
TESTCLASSID_CTOR(DateFormatSymbols, (status));
TESTCLASSID_CTOR(PluralFormat, (status));
TESTCLASSID_CTOR(PluralRules, (status));
TESTCLASSID_CTOR(SelectFormat, (UnicodeString("feminine {feminineVerbValue} other{otherVerbValue}"), status) );
TESTCLASSID_FACTORY(DateTimePatternGenerator, DateTimePatternGenerator::createInstance(status));
TESTCLASSID_FACTORY(RelativeDateFormat, DateFormat::createDateInstance(DateFormat::kFullRelative, Locale::getUS()));
TESTCLASSID_CTOR(DecimalFormatSymbols, (status));
TESTCLASSID_DEFAULT(FieldPosition);
TESTCLASSID_DEFAULT(Formattable);
static const UChar SMALL_STR[] = {0x51, 0x51, 0x51, 0}; // "QQQ"
TESTCLASSID_CTOR(CurrencyAmount, (1.0, SMALL_STR, status));
TESTCLASSID_CTOR(CurrencyUnit, (SMALL_STR, status));
TESTCLASSID_NONE_FACTORY(LocaleDisplayNames, LocaleDisplayNames::createInstance("de"));
TESTCLASSID_FACTORY_HIDDEN(CurrencyFormat, MeasureFormat::createCurrencyFormat(Locale::getUS(), status));
TESTCLASSID_FACTORY(GregorianCalendar, Calendar::createInstance(Locale("@calendar=gregorian"), status));
TESTCLASSID_FACTORY(BuddhistCalendar, Calendar::createInstance(Locale("@calendar=buddhist"), status));
TESTCLASSID_FACTORY(IslamicCalendar, Calendar::createInstance(Locale("@calendar=islamic"), status));
TESTCLASSID_FACTORY(JapaneseCalendar, Calendar::createInstance(Locale("@calendar=japanese"), status));
TESTCLASSID_FACTORY(HebrewCalendar, Calendar::createInstance(Locale("@calendar=hebrew"), status));
TESTCLASSID_FACTORY(PersianCalendar, Calendar::createInstance(Locale("@calendar=persian"), status));
TESTCLASSID_FACTORY(IndianCalendar, Calendar::createInstance(Locale("@calendar=indian"), status));
TESTCLASSID_FACTORY(ChineseCalendar, Calendar::createInstance(Locale("@calendar=chinese"), status));
TESTCLASSID_FACTORY(TaiwanCalendar, Calendar::createInstance(Locale("@calendar=roc"), status));
#ifdef U_WINDOWS
TESTCLASSID_FACTORY(Win32DateFormat, DateFormat::createDateInstance(DateFormat::kFull, Locale("@compat=host")));
TESTCLASSID_FACTORY(Win32NumberFormat, NumberFormat::createInstance(Locale("@compat=host"), status));
#endif
#endif
#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILE_IO
/* TESTCLASSID_ABSTRACT(BreakIterator); No staticID! */
TESTCLASSID_FACTORY(RuleBasedBreakIterator, BreakIterator::createLineInstance("mt",status));
//TESTCLASSID_FACTORY(DictionaryBasedBreakIterator, BreakIterator::createLineInstance("th",status));
#if !UCONFIG_NO_SERVICE
TESTCLASSID_FACTORY_HIDDEN(ICULocaleService, BreakIterator::getAvailableLocales());
#endif
#endif
//TESTCLASSID_DEFAULT(GregorianCalendar);
#if !UCONFIG_NO_TRANSLITERATION
TESTCLASSID_TRANSLIT(AnyTransliterator, "Any-Latin");
TESTCLASSID_TRANSLIT(CompoundTransliterator, "Latin-Greek");
TESTCLASSID_TRANSLIT(EscapeTransliterator, "Any-Hex");
TESTCLASSID_TRANSLIT(LowercaseTransliterator, "Lower");
TESTCLASSID_TRANSLIT(NameUnicodeTransliterator, "Name-Any");
TESTCLASSID_TRANSLIT(NormalizationTransliterator, "NFD");
TESTCLASSID_TRANSLIT(NullTransliterator, "Null");
TESTCLASSID_TRANSLIT(RemoveTransliterator, "Remove");
TESTCLASSID_FACTORY(RuleBasedTransliterator, Transliterator::createFromRules(UnicodeString("abcd"),UnicodeString("a>b;"),UTRANS_FORWARD,parseError,status));
TESTCLASSID_TRANSLIT(TitlecaseTransliterator, "Title");
TESTCLASSID_TRANSLIT(UnescapeTransliterator, "Hex-Any");
TESTCLASSID_TRANSLIT(UnicodeNameTransliterator, "Any-Name");
TESTCLASSID_TRANSLIT(UppercaseTransliterator, "Upper");
TESTCLASSID_ABSTRACT(CaseMapTransliterator);
TESTCLASSID_ABSTRACT(Transliterator);
TESTCLASSID_FACTORY_HIDDEN(TransliteratorRegistry::Enumeration, Transliterator::getAvailableIDs(status));
#if UOBJTEST_TEST_INTERNALS
TESTCLASSID_CTOR(Quantifier, (NULL, 0, 0));
TESTCLASSID_CTOR(FunctionReplacer, (NULL,NULL));
TESTCLASSID_CTOR(StringMatcher, (UnicodeString("x"), 0,0,0,TransliterationRuleData(status)));
TESTCLASSID_CTOR(StringReplacer,(UnicodeString(),new TransliterationRuleData(status)));
#endif
#endif
TESTCLASSID_FACTORY(Locale, new Locale("123"));
TESTCLASSID_FACTORY_HIDDEN(KeywordEnumeration, Locale("@a=b").createKeywords(status));
//TESTCLASSID_DEFAULT(NumeratorSubstitution);
#if !UCONFIG_NO_TRANSLITERATION
TESTCLASSID_DEFAULT(ParsePosition);
#endif
// NO_REG_EX
//TESTCLASSID_DEFAULT(RegexCompile);
//TESTCLASSID_DEFAULT(RegexMatcher);
//TESTCLASSID_DEFAULT(RegexPattern);
//TESTCLASSID_DEFAULT(ReplaceableGlue);
TESTCLASSID_FACTORY(ResourceBundle, new ResourceBundle(UnicodeString(), status) );
//TESTCLASSID_DEFAULT(RuleBasedTransliterator);
//TESTCLASSID_DEFAULT(SimpleFwdCharIterator);
//TESTCLASSID_DEFAULT(StringReplacer);
//TESTCLASSID_DEFAULT(StringSearch);
//TESTCLASSID_DEFAULT(TestMultipleKeyStringFactory);
//TESTCLASSID_DEFAULT(TestReplaceable);
#if !UCONFIG_NO_FORMATTING
TESTCLASSID_ABSTRACT(TimeZone);
TESTCLASSID_FACTORY(OlsonTimeZone, TimeZone::createTimeZone(UnicodeString("America/Los_Angeles")));
TESTCLASSID_FACTORY_HIDDEN(KeywordEnumeration, TimeZone::createEnumeration());
#endif
TESTCLASSID_NONE_DEFAULT(DummyAppendable);
TESTCLASSID_DEFAULT(UnicodeString);
TESTCLASSID_CTOR(UnicodeSet, (0, 1));
TESTCLASSID_ABSTRACT(UnicodeFilter);
TESTCLASSID_ABSTRACT(UnicodeFunctor);
TESTCLASSID_CTOR(UnicodeSetIterator,(UnicodeSet(0,1)));
TESTCLASSID_CTOR(UStack, (status));
TESTCLASSID_CTOR(UVector, (status));
TESTCLASSID_CTOR(UVector32, (status));
#if !UCONFIG_NO_SERVICE
TESTCLASSID_CTOR(SimpleFactory, (NULL, UnicodeString("foo")));
TESTCLASSID_DEFAULT(EventListener);
TESTCLASSID_DEFAULT(ICUResourceBundleFactory);
//TESTCLASSID_DEFAULT(Key); // does not exist?
UnicodeString baz("baz");
UnicodeString bat("bat");
TESTCLASSID_FACTORY(LocaleKey, LocaleKey::createWithCanonicalFallback(&baz, &bat, LocaleKey::KIND_ANY, status));
TESTCLASSID_CTOR(SimpleLocaleKeyFactory, (NULL, UnicodeString("bar"), 8, 12) );
TESTCLASSID_CTOR(TestLocaleKeyFactory, (42)); // Test replacement for LocaleKeyFactory
//#if UOBJTEST_TEST_INTERNALS
// TESTCLASSID_CTOR(LocaleKeyFactory, (42));
//#endif
#endif
TESTCLASSID_NONE_CTOR(AlphabeticIndex, (Locale::getEnglish(), status));
#if UOBJTEST_DUMP_IDS
int i;
for(i=0;i<ids_count;i++) {
char junk[800];
sprintf(junk, " %4d:\t%p\t%s\t%s\n",
i, ids[i], ids_class[i], ids_factory[i]);
logln(UnicodeString(junk));
}
#endif
}
void UObjectTest::testUMemory() {
// additional tests for code coverage
#if U_OVERRIDE_CXX_ALLOCATION && U_HAVE_PLACEMENT_NEW
union {
UAlignedMemory align_;
char bytes_[sizeof(UnicodeString)];
} stackMemory;
char *bytes = stackMemory.bytes_;
UnicodeString *p;
enum { len=20 };
p=new(bytes) UnicodeString(len, (UChar32)0x20ac, len);
if((void *)p!=(void *)bytes) {
errln("placement new did not place the object at the expected address");
}
if(p->length()!=len || p->charAt(0)!=0x20ac || p->charAt(len-1)!=0x20ac) {
errln("constructor used with placement new did not work right");
}
/*
* It is not possible to simply say
* delete(p, stackMemory);
* which results in a call to the normal, non-placement delete operator.
*
* Via a search on google.com for "c++ placement delete" I found
* http://cpptips.hyperformix.com/cpptips/placement_del3
* which says:
*
* TITLE: using placement delete
*
* (Newsgroups: comp.std.c++, 27 Aug 97)
*
* ISJ: isj@image.dk
*
* > I do not completely understand how placement works on operator delete.
* > ...
* There is no delete-expression which will invoke a placement
* form of operator delete. You can still call the function
* explicitly. Example:
* ...
* // destroy object and delete space manually
* p->~T();
* operator delete(p, 12);
*
* ... so that's what I am doing here.
* markus 20031216
*/
// destroy object and delete space manually
p->~UnicodeString();
// You normally wouldn't call an operator delete for object placed on the
// stack with a placement new().
// This overload of delete is a nop, and is called here for code coverage purposes.
UnicodeString::operator delete(p, bytes);
// Jitterbug 4452, for coverage
UnicodeString *pa = new UnicodeString[2];
if ( !pa[0].isEmpty() || !pa[1].isEmpty()){
errln("constructor used with array new did not work right");
}
delete [] pa;
#endif
// try to call the compiler-generated UMemory::operator=(class UMemory const &)
UMemory m, n;
m=n;
}
void UObjectTest::TestMFCCompatibility() {
#if U_HAVE_DEBUG_LOCATION_NEW
/* Make sure that it compiles with MFC's debuggable new usage. */
UnicodeString *str = new(__FILE__, __LINE__) UnicodeString();
str->append((UChar)0x0040); // Is it usable?
if(str->charAt(0) != 0x0040) {
errln("debug new doesn't work.");
}
UnicodeString::operator delete(str, __FILE__, __LINE__);
#endif
}
void UObjectTest::TestCompilerRTTI() {
#if !UCONFIG_NO_FORMATTING
UErrorCode errorCode = U_ZERO_ERROR;
NumberFormat *nf = NumberFormat::createInstance("de", errorCode);
if (U_FAILURE(errorCode)) {
dataerrln("NumberFormat::createInstance(de) failed - %s", u_errorName(errorCode));
return;
}
if (dynamic_cast<DecimalFormat *>(nf) == NULL || dynamic_cast<ChoiceFormat *>(nf) != NULL) {
errln("dynamic_cast<>(NumberFormat) failed");
}
UnicodeSet emptySet;
if (&typeid(*nf) == NULL || typeid(*nf) == typeid(UObject) || typeid(*nf) == typeid(Format) ||
typeid(*nf) != typeid(DecimalFormat) || typeid(*nf) == typeid(ChoiceFormat) ||
typeid(*nf) == typeid(emptySet)
) {
errln("typeid(NumberFormat) failed");
}
delete nf;
#endif
}
/* --------------- */
void UObjectTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /* par */ )
{
switch (index) {
TESTCASE(0, testIDs);
TESTCASE(1, testUMemory);
TESTCASE(2, TestMFCCompatibility);
TESTCASE(3, TestCompilerRTTI);
default: name = ""; break; //needed to end loop
}
}
| cxcx/WinObjC | deps/3rdparty/iculegacy/source/test/intltest/uobjtest.cpp | C++ | mit | 22,195 |
!function(){var define,requireModule,require,requirejs;!function(){var registry={},seen={};define=function(name,deps,callback){registry[name]={deps:deps,callback:callback}};requirejs=require=requireModule=function(name){requirejs._eak_seen=registry;if(seen[name]){return seen[name]}seen[name]={};if(!registry[name]){throw new Error("Could not find module "+name)}var mod=registry[name],deps=mod.deps,callback=mod.callback,reified=[],exports;for(var i=0,l=deps.length;i<l;i++){if(deps[i]==="exports"){reified.push(exports={})}else{reified.push(requireModule(resolve(deps[i])))}}var value=callback.apply(this,reified);return seen[name]=exports||value;function resolve(child){if(child.charAt(0)!=="."){return child}var parts=child.split("/");var parentBase=name.split("/").slice(0,-1);for(var i=0,l=parts.length;i<l;i++){var part=parts[i];if(part===".."){parentBase.pop()}else if(part==="."){continue}else{parentBase.push(part)}}return parentBase.join("/")}}}();define("promise/all",["./utils","exports"],function(__dependency1__,__exports__){"use strict";var isArray=__dependency1__.isArray;var isFunction=__dependency1__.isFunction;function all(promises){var Promise=this;if(!isArray(promises)){throw new TypeError("You must pass an array to all.")}return new Promise(function(resolve,reject){var results=[],remaining=promises.length,promise;if(remaining===0){resolve([])}function resolver(index){return function(value){resolveAll(index,value)}}function resolveAll(index,value){results[index]=value;if(--remaining===0){resolve(results)}}for(var i=0;i<promises.length;i++){promise=promises[i];if(promise&&isFunction(promise.then)){promise.then(resolver(i),reject)}else{resolveAll(i,promise)}}})}__exports__.all=all});define("promise/asap",["exports"],function(__exports__){"use strict";var browserGlobal=typeof window!=="undefined"?window:{};var BrowserMutationObserver=browserGlobal.MutationObserver||browserGlobal.WebKitMutationObserver;var local=typeof global!=="undefined"?global:this;function useNextTick(){return function(){process.nextTick(flush)}}function useMutationObserver(){var iterations=0;var observer=new BrowserMutationObserver(flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function useSetTimeout(){return function(){local.setTimeout(flush,1)}}var queue=[];function flush(){for(var i=0;i<queue.length;i++){var tuple=queue[i];var callback=tuple[0],arg=tuple[1];callback(arg)}queue=[]}var scheduleFlush;if(typeof process!=="undefined"&&{}.toString.call(process)==="[object process]"){scheduleFlush=useNextTick()}else if(BrowserMutationObserver){scheduleFlush=useMutationObserver()}else{scheduleFlush=useSetTimeout()}function asap(callback,arg){var length=queue.push([callback,arg]);if(length===1){scheduleFlush()}}__exports__.asap=asap});define("promise/cast",["exports"],function(__exports__){"use strict";function cast(object){if(object&&typeof object==="object"&&object.constructor===this){return object}var Promise=this;return new Promise(function(resolve){resolve(object)})}__exports__.cast=cast});define("promise/config",["exports"],function(__exports__){"use strict";var config={instrument:false};function configure(name,value){if(arguments.length===2){config[name]=value}else{return config[name]}}__exports__.config=config;__exports__.configure=configure});define("promise/polyfill",["./promise","./utils","exports"],function(__dependency1__,__dependency2__,__exports__){"use strict";var RSVPPromise=__dependency1__.Promise;var isFunction=__dependency2__.isFunction;function polyfill(){var es6PromiseSupport="Promise"in window&&"cast"in window.Promise&&"resolve"in window.Promise&&"reject"in window.Promise&&"all"in window.Promise&&"race"in window.Promise&&function(){var resolve;new window.Promise(function(r){resolve=r});return isFunction(resolve)}();if(!es6PromiseSupport){window.Promise=RSVPPromise}}__exports__.polyfill=polyfill});define("promise/promise",["./config","./utils","./cast","./all","./race","./resolve","./reject","./asap","exports"],function(__dependency1__,__dependency2__,__dependency3__,__dependency4__,__dependency5__,__dependency6__,__dependency7__,__dependency8__,__exports__){"use strict";var config=__dependency1__.config;var configure=__dependency1__.configure;var objectOrFunction=__dependency2__.objectOrFunction;var isFunction=__dependency2__.isFunction;var now=__dependency2__.now;var cast=__dependency3__.cast;var all=__dependency4__.all;var race=__dependency5__.race;var staticResolve=__dependency6__.resolve;var staticReject=__dependency7__.reject;var asap=__dependency8__.asap;var counter=0;config.async=asap;function Promise(resolver){if(!isFunction(resolver)){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}if(!(this instanceof Promise)){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}this._subscribers=[];invokeResolver(resolver,this)}function invokeResolver(resolver,promise){function resolvePromise(value){resolve(promise,value)}function rejectPromise(reason){reject(promise,reason)}try{resolver(resolvePromise,rejectPromise)}catch(e){rejectPromise(e)}}function invokeCallback(settled,promise,callback,detail){var hasCallback=isFunction(callback),value,error,succeeded,failed;if(hasCallback){try{value=callback(detail);succeeded=true}catch(e){failed=true;error=e}}else{value=detail;succeeded=true}if(handleThenable(promise,value)){return}else if(hasCallback&&succeeded){resolve(promise,value)}else if(failed){reject(promise,error)}else if(settled===FULFILLED){resolve(promise,value)}else if(settled===REJECTED){reject(promise,value)}}var PENDING=void 0;var SEALED=0;var FULFILLED=1;var REJECTED=2;function subscribe(parent,child,onFulfillment,onRejection){var subscribers=parent._subscribers;var length=subscribers.length;subscribers[length]=child;subscribers[length+FULFILLED]=onFulfillment;subscribers[length+REJECTED]=onRejection}function publish(promise,settled){var child,callback,subscribers=promise._subscribers,detail=promise._detail;for(var i=0;i<subscribers.length;i+=3){child=subscribers[i];callback=subscribers[i+settled];invokeCallback(settled,child,callback,detail)}promise._subscribers=null}Promise.prototype={constructor:Promise,_state:undefined,_detail:undefined,_subscribers:undefined,then:function(onFulfillment,onRejection){var promise=this;var thenPromise=new this.constructor(function(){});if(this._state){var callbacks=arguments;config.async(function invokePromiseCallback(){invokeCallback(promise._state,thenPromise,callbacks[promise._state-1],promise._detail)})}else{subscribe(this,thenPromise,onFulfillment,onRejection)}return thenPromise},"catch":function(onRejection){return this.then(null,onRejection)}};Promise.all=all;Promise.cast=cast;Promise.race=race;Promise.resolve=staticResolve;Promise.reject=staticReject;function handleThenable(promise,value){var then=null,resolved;try{if(promise===value){throw new TypeError("A promises callback cannot return that same promise.")}if(objectOrFunction(value)){then=value.then;if(isFunction(then)){then.call(value,function(val){if(resolved){return true}resolved=true;if(value!==val){resolve(promise,val)}else{fulfill(promise,val)}},function(val){if(resolved){return true}resolved=true;reject(promise,val)});return true}}}catch(error){if(resolved){return true}reject(promise,error);return true}return false}function resolve(promise,value){if(promise===value){fulfill(promise,value)}else if(!handleThenable(promise,value)){fulfill(promise,value)}}function fulfill(promise,value){if(promise._state!==PENDING){return}promise._state=SEALED;promise._detail=value;config.async(publishFulfillment,promise)}function reject(promise,reason){if(promise._state!==PENDING){return}promise._state=SEALED;promise._detail=reason;config.async(publishRejection,promise)}function publishFulfillment(promise){publish(promise,promise._state=FULFILLED)}function publishRejection(promise){publish(promise,promise._state=REJECTED)}__exports__.Promise=Promise});define("promise/race",["./utils","exports"],function(__dependency1__,__exports__){"use strict";var isArray=__dependency1__.isArray;function race(promises){var Promise=this;if(!isArray(promises)){throw new TypeError("You must pass an array to race.")}return new Promise(function(resolve,reject){var results=[],promise;for(var i=0;i<promises.length;i++){promise=promises[i];if(promise&&typeof promise.then==="function"){promise.then(resolve,reject)}else{resolve(promise)}}})}__exports__.race=race});define("promise/reject",["exports"],function(__exports__){"use strict";function reject(reason){var Promise=this;return new Promise(function(resolve,reject){reject(reason)})}__exports__.reject=reject});define("promise/resolve",["exports"],function(__exports__){"use strict";function resolve(value){var Promise=this;return new Promise(function(resolve,reject){resolve(value)})}__exports__.resolve=resolve});define("promise/utils",["exports"],function(__exports__){"use strict";function objectOrFunction(x){return isFunction(x)||typeof x==="object"&&x!==null}function isFunction(x){return typeof x==="function"}function isArray(x){return Object.prototype.toString.call(x)==="[object Array]"}var now=Date.now||function(){return(new Date).getTime()};__exports__.objectOrFunction=objectOrFunction;__exports__.isFunction=isFunction;__exports__.isArray=isArray;__exports__.now=now});requireModule("promise/polyfill").polyfill()}();!function(){"use strict";var DBNAME="asyncStorage";var DBVERSION=1;var STORENAME="keyvaluepairs";var Promise=window.Promise;var db=null;var indexedDB=indexedDB||window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB;if(!indexedDB){return}function withStore(type,f){if(db){f(db.transaction(STORENAME,type).objectStore(STORENAME))}else{var openreq=indexedDB.open(DBNAME,DBVERSION);openreq.onerror=function withStoreOnError(){console.error("asyncStorage: can't open database:",openreq.error.name)};openreq.onupgradeneeded=function withStoreOnUpgradeNeeded(){openreq.result.createObjectStore(STORENAME)};openreq.onsuccess=function withStoreOnSuccess(){db=openreq.result;f(db.transaction(STORENAME,type).objectStore(STORENAME))}}}function getItem(key,callback){return new Promise(function(resolve,reject){withStore("readonly",function getItemBody(store){var req=store.get(key);req.onsuccess=function getItemOnSuccess(){var value=req.result;if(value===undefined){value=null}if(callback){callback(value)}resolve(value)};req.onerror=function getItemOnError(){console.error("Error in asyncStorage.getItem(): ",req.error.name)}})})}function setItem(key,value,callback){return new Promise(function(resolve,reject){withStore("readwrite",function setItemBody(store){if(value===undefined){value=null}var req=store.put(value,key);req.onsuccess=function setItemOnSuccess(){if(callback){callback(value)}resolve(value)};req.onerror=function setItemOnError(){console.error("Error in asyncStorage.setItem(): ",req.error.name)}})})}function removeItem(key,callback){return new Promise(function(resolve,reject){withStore("readwrite",function removeItemBody(store){var req=store.delete(key);req.onsuccess=function removeItemOnSuccess(){if(callback){callback()}resolve()};req.onerror=function removeItemOnError(){console.error("Error in asyncStorage.removeItem(): ",req.error.name)}})})}function clear(callback){return new Promise(function(resolve,reject){withStore("readwrite",function clearBody(store){var req=store.clear();req.onsuccess=function clearOnSuccess(){if(callback){callback()}resolve()};req.onerror=function clearOnError(){console.error("Error in asyncStorage.clear(): ",req.error.name)}})})}function length(callback){return new Promise(function(resolve,reject){withStore("readonly",function lengthBody(store){var req=store.count();req.onsuccess=function lengthOnSuccess(){if(callback){callback(req.result)}resolve(req.result)};req.onerror=function lengthOnError(){console.error("Error in asyncStorage.length(): ",req.error.name)}})})}function key(n,callback){return new Promise(function(resolve,reject){if(n<0){if(callback){callback(null)}resolve(null);return}withStore("readonly",function keyBody(store){var advanced=false;var req=store.openCursor();req.onsuccess=function keyOnSuccess(){var cursor=req.result;if(!cursor){if(callback){callback(null)}resolve(null);return}if(n===0){if(callback){callback(cursor.key)}resolve(cursor.key)}else{if(!advanced){advanced=true;cursor.advance(n)}else{if(callback){callback(cursor.key)}resolve(cursor.key)}}};req.onerror=function keyOnError(){console.error("Error in asyncStorage.key(): ",req.error.name)}})})}var asyncStorage={driver:"asyncStorage",getItem:getItem,setItem:setItem,removeItem:removeItem,clear:clear,length:length,key:key};if(typeof define==="function"&&define.amd){define("asyncStorage",function(){return asyncStorage})}else if(typeof module!=="undefined"&&module.exports){module.exports=asyncStorage}else{this.asyncStorage=asyncStorage}}.call(this);!function(){"use strict";var Promise=window.Promise;if(window.chrome&&window.chrome.runtime){return}var localStorage=window.localStorage;function clear(callback){return new Promise(function(resolve,reject){localStorage.clear();if(callback){callback()}resolve()})}function getItem(key,callback){return new Promise(function(resolve,reject){try{var result=localStorage.getItem(key);if(result){result=JSON.parse(result)}if(callback){callback(result)}resolve(result)}catch(e){reject(e)}})}function key(n,callback){return new Promise(function(resolve,reject){var result=localStorage.key(n);if(callback){callback(result)}resolve(result)})}function length(callback){return new Promise(function(resolve,reject){var result=localStorage.length;if(callback){callback(result)}resolve(result)})}function removeItem(key,callback){return new Promise(function(resolve,reject){localStorage.removeItem(key);if(callback){callback()}resolve()})}function setItem(key,value,callback){return new Promise(function(resolve,reject){if(value===undefined){value=null}var originalValue=value;try{value=JSON.stringify(value)}catch(e){console.error("Couldn't convert value into a JSON string: ",value);reject(e)}localStorage.setItem(key,value);if(callback){callback(originalValue)}resolve(originalValue)})}var localStorageWrapper={driver:"localStorageWrapper",getItem:getItem,setItem:setItem,removeItem:removeItem,clear:clear,length:length,key:key};if(typeof define==="function"&&define.amd){define("localStorageWrapper",function(){return localStorageWrapper})}else if(typeof module!=="undefined"&&module.exports){module.exports=localStorageWrapper}else{this.localStorageWrapper=localStorageWrapper}}.call(this);!function(){"use strict";var DB_NAME="localforage";var DB_SIZE=5*1024*1024;var DB_VERSION="1.0";var SERIALIZED_MARKER="__lfsc__:";var SERIALIZED_MARKER_LENGTH=SERIALIZED_MARKER.length;var STORE_NAME="keyvaluepairs";var Promise=window.Promise;if(!window.openDatabase){return}var db=window.openDatabase(DB_NAME,DB_VERSION,STORE_NAME,DB_SIZE);db.transaction(function(t){t.executeSql("CREATE TABLE IF NOT EXISTS localforage (id INTEGER PRIMARY KEY, key unique, value)")});function getItem(key,callback){return new Promise(function(resolve,reject){db.transaction(function(t){t.executeSql("SELECT * FROM localforage WHERE key = ? LIMIT 1",[key],function(t,results){var result=results.rows.length?results.rows.item(0).value:null;if(result&&result.substr(0,SERIALIZED_MARKER_LENGTH)===SERIALIZED_MARKER){try{result=JSON.parse(result.slice(SERIALIZED_MARKER_LENGTH))}catch(e){reject(e)}}if(callback){callback(result)}resolve(result)},null)})})}function setItem(key,value,callback){return new Promise(function(resolve,reject){if(value===undefined){value=null}var valueToSave;if(typeof value==="boolean"||typeof value==="number"||typeof value==="object"){valueToSave=SERIALIZED_MARKER+JSON.stringify(value)}else{valueToSave=value}db.transaction(function(t){t.executeSql("INSERT OR REPLACE INTO localforage (key, value) VALUES (?, ?)",[key,valueToSave],function(){if(callback){callback(value)}resolve(value)},null)})})}function removeItem(key,callback){return new Promise(function(resolve,reject){db.transaction(function(t){t.executeSql("DELETE FROM localforage WHERE key = ? LIMIT 1",[key],function(){if(callback){callback()}resolve()},null)})})}function clear(callback){return new Promise(function(resolve,reject){db.transaction(function(t){t.executeSql("DELETE FROM localforage",[],function(t,results){if(callback){callback()}resolve()},null)})})}function length(callback){return new Promise(function(resolve,reject){db.transaction(function(t){t.executeSql("SELECT COUNT(key) as c FROM localforage",[],function(t,results){var result=results.rows.item(0).c;if(callback){callback(result)}resolve(result)},null)})})}function key(n,callback){return new Promise(function(resolve,reject){db.transaction(function(t){t.executeSql("SELECT key FROM localforage WHERE id = ? LIMIT 1",[n+1],function(t,results){var result=results.rows.length?results.rows.item(0).key:null;if(callback){callback(result)}resolve(result)},null)})})}var webSQLStorage={driver:"webSQLStorage",getItem:getItem,setItem:setItem,removeItem:removeItem,clear:clear,length:length,key:key};if(typeof define==="function"&&define.amd){define("webSQLStorage",function(){return webSQLStorage})}else if(typeof module!=="undefined"&&module.exports){module.exports=webSQLStorage}else{this.webSQLStorage=webSQLStorage}}.call(this);!function(){"use strict";var Promise=window.Promise;var MODULE_TYPE_DEFINE=1;var MODULE_TYPE_EXPORT=2;var MODULE_TYPE_WINDOW=3;var moduleType=MODULE_TYPE_WINDOW;if(typeof define==="function"&&define.amd){moduleType=MODULE_TYPE_DEFINE}else if(typeof module!=="undefined"&&module.exports){moduleType=MODULE_TYPE_EXPORT}var indexedDB=indexedDB||window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB;var _this=this;var localForage={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage",setDriver:function(driverName,callback){return new Promise(function(resolve,reject){if(!indexedDB&&driverName===localForage.INDEXEDDB||!window.openDatabase&&driverName===localForage.WEBSQL){if(callback){callback(localForage)}reject(localForage);return}if(moduleType===MODULE_TYPE_DEFINE){require([driverName],function(lib){localForage._extend(lib);if(callback){callback(localForage)}resolve(localForage)})}else if(moduleType===MODULE_TYPE_EXPORT){localForage._extend(require("./"+driverName));if(callback){callback(localForage)}resolve(localForage)}else{localForage._extend(_this[driverName]);if(callback){callback(localForage)}resolve(localForage)}})},_extend:function(libraryMethodsAndProperties){for(var i in libraryMethodsAndProperties){if(libraryMethodsAndProperties.hasOwnProperty(i)){this[i]=libraryMethodsAndProperties[i]}}}};var storageLibrary;if(indexedDB){storageLibrary=localForage.INDEXEDDB}else if(window.openDatabase){storageLibrary=localForage.WEBSQL}else{storageLibrary=localForage.LOCALSTORAGE}localForage.setDriver(storageLibrary);if(moduleType===MODULE_TYPE_DEFINE){define("localforage",function(){return localForage})}else if(moduleType===MODULE_TYPE_EXPORT){module.exports=localForage}else{this.localforage=localForage}}.call(this); | danielnaranjo/cdnjs | ajax/libs/localforage/0.0.1/localforage.min.js | JavaScript | mit | 19,346 |
// Copyright (c) 2012 Pieter Wuille
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "addrman.h"
#include "hash.h"
using namespace std;
int CAddrInfo::GetTriedBucket(const std::vector<unsigned char> &nKey) const
{
CDataStream ss1(SER_GETHASH, 0);
std::vector<unsigned char> vchKey = GetKey();
ss1 << nKey << vchKey;
uint64 hash1 = Hash(ss1.begin(), ss1.end()).Get64();
CDataStream ss2(SER_GETHASH, 0);
std::vector<unsigned char> vchGroupKey = GetGroup();
ss2 << nKey << vchGroupKey << (hash1 % ADDRMAN_TRIED_BUCKETS_PER_GROUP);
uint64 hash2 = Hash(ss2.begin(), ss2.end()).Get64();
return hash2 % ADDRMAN_TRIED_BUCKET_COUNT;
}
int CAddrInfo::GetNewBucket(const std::vector<unsigned char> &nKey, const CNetAddr& src) const
{
CDataStream ss1(SER_GETHASH, 0);
std::vector<unsigned char> vchGroupKey = GetGroup();
std::vector<unsigned char> vchSourceGroupKey = src.GetGroup();
ss1 << nKey << vchGroupKey << vchSourceGroupKey;
uint64 hash1 = Hash(ss1.begin(), ss1.end()).Get64();
CDataStream ss2(SER_GETHASH, 0);
ss2 << nKey << vchSourceGroupKey << (hash1 % ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP);
uint64 hash2 = Hash(ss2.begin(), ss2.end()).Get64();
return hash2 % ADDRMAN_NEW_BUCKET_COUNT;
}
bool CAddrInfo::IsTerrible(int64 nNow) const
{
if (nLastTry && nLastTry >= nNow-60) // never remove things tried the last minute
return false;
if (nTime > nNow + 10*60) // came in a flying DeLorean
return true;
if (nTime==0 || nNow-nTime > ADDRMAN_HORIZON_DAYS*86400) // not seen in over a month
return true;
if (nLastSuccess==0 && nAttempts>=ADDRMAN_RETRIES) // tried three times and never a success
return true;
if (nNow-nLastSuccess > ADDRMAN_MIN_FAIL_DAYS*86400 && nAttempts>=ADDRMAN_MAX_FAILURES) // 10 successive failures in the last week
return true;
return false;
}
double CAddrInfo::GetChance(int64 nNow) const
{
double fChance = 1.0;
int64 nSinceLastSeen = nNow - nTime;
int64 nSinceLastTry = nNow - nLastTry;
if (nSinceLastSeen < 0) nSinceLastSeen = 0;
if (nSinceLastTry < 0) nSinceLastTry = 0;
fChance *= 600.0 / (600.0 + nSinceLastSeen);
// deprioritize very recent attempts away
if (nSinceLastTry < 60*10)
fChance *= 0.01;
// deprioritize 50% after each failed attempt
for (int n=0; n<nAttempts; n++)
fChance /= 1.5;
return fChance;
}
CAddrInfo* CAddrMan::Find(const CNetAddr& addr, int *pnId)
{
std::map<CNetAddr, int>::iterator it = mapAddr.find(addr);
if (it == mapAddr.end())
return NULL;
if (pnId)
*pnId = (*it).second;
std::map<int, CAddrInfo>::iterator it2 = mapInfo.find((*it).second);
if (it2 != mapInfo.end())
return &(*it2).second;
return NULL;
}
CAddrInfo* CAddrMan::Create(const CAddress &addr, const CNetAddr &addrSource, int *pnId)
{
int nId = nIdCount++;
mapInfo[nId] = CAddrInfo(addr, addrSource);
mapAddr[addr] = nId;
mapInfo[nId].nRandomPos = vRandom.size();
vRandom.push_back(nId);
if (pnId)
*pnId = nId;
return &mapInfo[nId];
}
void CAddrMan::SwapRandom(unsigned int nRndPos1, unsigned int nRndPos2)
{
if (nRndPos1 == nRndPos2)
return;
assert(nRndPos1 < vRandom.size() && nRndPos2 < vRandom.size());
int nId1 = vRandom[nRndPos1];
int nId2 = vRandom[nRndPos2];
assert(mapInfo.count(nId1) == 1);
assert(mapInfo.count(nId2) == 1);
mapInfo[nId1].nRandomPos = nRndPos2;
mapInfo[nId2].nRandomPos = nRndPos1;
vRandom[nRndPos1] = nId2;
vRandom[nRndPos2] = nId1;
}
int CAddrMan::SelectTried(int nKBucket)
{
std::vector<int> &vTried = vvTried[nKBucket];
// random shuffle the first few elements (using the entire list)
// find the least recently tried among them
int64 nOldest = -1;
int nOldestPos = -1;
for (unsigned int i = 0; i < ADDRMAN_TRIED_ENTRIES_INSPECT_ON_EVICT && i < vTried.size(); i++)
{
int nPos = GetRandInt(vTried.size() - i) + i;
int nTemp = vTried[nPos];
vTried[nPos] = vTried[i];
vTried[i] = nTemp;
assert(nOldest == -1 || mapInfo.count(nTemp) == 1);
if (nOldest == -1 || mapInfo[nTemp].nLastSuccess < mapInfo[nOldest].nLastSuccess) {
nOldest = nTemp;
nOldestPos = nPos;
}
}
return nOldestPos;
}
int CAddrMan::ShrinkNew(int nUBucket)
{
assert(nUBucket >= 0 && (unsigned int)nUBucket < vvNew.size());
std::set<int> &vNew = vvNew[nUBucket];
// first look for deletable items
for (std::set<int>::iterator it = vNew.begin(); it != vNew.end(); it++)
{
assert(mapInfo.count(*it));
CAddrInfo &info = mapInfo[*it];
if (info.IsTerrible())
{
if (--info.nRefCount == 0)
{
SwapRandom(info.nRandomPos, vRandom.size()-1);
vRandom.pop_back();
mapAddr.erase(info);
mapInfo.erase(*it);
nNew--;
}
vNew.erase(it);
return 0;
}
}
// otherwise, select four randomly, and pick the oldest of those to replace
int n[4] = {GetRandInt(vNew.size()), GetRandInt(vNew.size()), GetRandInt(vNew.size()), GetRandInt(vNew.size())};
int nI = 0;
int nOldest = -1;
for (std::set<int>::iterator it = vNew.begin(); it != vNew.end(); it++)
{
if (nI == n[0] || nI == n[1] || nI == n[2] || nI == n[3])
{
assert(nOldest == -1 || mapInfo.count(*it) == 1);
if (nOldest == -1 || mapInfo[*it].nTime < mapInfo[nOldest].nTime)
nOldest = *it;
}
nI++;
}
assert(mapInfo.count(nOldest) == 1);
CAddrInfo &info = mapInfo[nOldest];
if (--info.nRefCount == 0)
{
SwapRandom(info.nRandomPos, vRandom.size()-1);
vRandom.pop_back();
mapAddr.erase(info);
mapInfo.erase(nOldest);
nNew--;
}
vNew.erase(nOldest);
return 1;
}
void CAddrMan::MakeTried(CAddrInfo& info, int nId, int nOrigin)
{
assert(vvNew[nOrigin].count(nId) == 1);
// remove the entry from all new buckets
for (std::vector<std::set<int> >::iterator it = vvNew.begin(); it != vvNew.end(); it++)
{
if ((*it).erase(nId))
info.nRefCount--;
}
nNew--;
assert(info.nRefCount == 0);
// what tried bucket to move the entry to
int nKBucket = info.GetTriedBucket(nKey);
std::vector<int> &vTried = vvTried[nKBucket];
// first check whether there is place to just add it
if (vTried.size() < ADDRMAN_TRIED_BUCKET_SIZE)
{
vTried.push_back(nId);
nTried++;
info.fInTried = true;
return;
}
// otherwise, find an item to evict
int nPos = SelectTried(nKBucket);
// find which new bucket it belongs to
assert(mapInfo.count(vTried[nPos]) == 1);
int nUBucket = mapInfo[vTried[nPos]].GetNewBucket(nKey);
std::set<int> &vNew = vvNew[nUBucket];
// remove the to-be-replaced tried entry from the tried set
CAddrInfo& infoOld = mapInfo[vTried[nPos]];
infoOld.fInTried = false;
infoOld.nRefCount = 1;
// do not update nTried, as we are going to move something else there immediately
// check whether there is place in that one,
if (vNew.size() < ADDRMAN_NEW_BUCKET_SIZE)
{
// if so, move it back there
vNew.insert(vTried[nPos]);
} else {
// otherwise, move it to the new bucket nId came from (there is certainly place there)
vvNew[nOrigin].insert(vTried[nPos]);
}
nNew++;
vTried[nPos] = nId;
// we just overwrote an entry in vTried; no need to update nTried
info.fInTried = true;
return;
}
void CAddrMan::Good_(const CService &addr, int64 nTime)
{
// printf("Good: addr=%s\n", addr.ToString().c_str());
int nId;
CAddrInfo *pinfo = Find(addr, &nId);
// if not found, bail out
if (!pinfo)
return;
CAddrInfo &info = *pinfo;
// check whether we are talking about the exact same CService (including same port)
if (info != addr)
return;
// update info
info.nLastSuccess = nTime;
info.nLastTry = nTime;
info.nTime = nTime;
info.nAttempts = 0;
// if it is already in the tried set, don't do anything else
if (info.fInTried)
return;
// find a bucket it is in now
int nRnd = GetRandInt(vvNew.size());
int nUBucket = -1;
for (unsigned int n = 0; n < vvNew.size(); n++)
{
int nB = (n+nRnd) % vvNew.size();
std::set<int> &vNew = vvNew[nB];
if (vNew.count(nId))
{
nUBucket = nB;
break;
}
}
// if no bucket is found, something bad happened;
// TODO: maybe re-add the node, but for now, just bail out
if (nUBucket == -1) return;
printf("Moving %s to tried\n", addr.ToString().c_str());
// move nId to the tried tables
MakeTried(info, nId, nUBucket);
}
bool CAddrMan::Add_(const CAddress &addr, const CNetAddr& source, int64 nTimePenalty)
{
if (!addr.IsRoutable())
return false;
bool fNew = false;
int nId;
CAddrInfo *pinfo = Find(addr, &nId);
if (pinfo)
{
// periodically update nTime
bool fCurrentlyOnline = (GetAdjustedTime() - addr.nTime < 24 * 60 * 60);
int64 nUpdateInterval = (fCurrentlyOnline ? 60 * 60 : 24 * 60 * 60);
if (addr.nTime && (!pinfo->nTime || pinfo->nTime < addr.nTime - nUpdateInterval - nTimePenalty))
pinfo->nTime = max((int64)0, addr.nTime - nTimePenalty);
// add services
pinfo->nServices |= addr.nServices;
// do not update if no new information is present
if (!addr.nTime || (pinfo->nTime && addr.nTime <= pinfo->nTime))
return false;
// do not update if the entry was already in the "tried" table
if (pinfo->fInTried)
return false;
// do not update if the max reference count is reached
if (pinfo->nRefCount == ADDRMAN_NEW_BUCKETS_PER_ADDRESS)
return false;
// stochastic test: previous nRefCount == N: 2^N times harder to increase it
int nFactor = 1;
for (int n=0; n<pinfo->nRefCount; n++)
nFactor *= 2;
if (nFactor > 1 && (GetRandInt(nFactor) != 0))
return false;
} else {
pinfo = Create(addr, source, &nId);
pinfo->nTime = max((int64)0, (int64)pinfo->nTime - nTimePenalty);
// printf("Added %s [nTime=%fhr]\n", pinfo->ToString().c_str(), (GetAdjustedTime() - pinfo->nTime) / 3600.0);
nNew++;
fNew = true;
}
int nUBucket = pinfo->GetNewBucket(nKey, source);
std::set<int> &vNew = vvNew[nUBucket];
if (!vNew.count(nId))
{
pinfo->nRefCount++;
if (vNew.size() == ADDRMAN_NEW_BUCKET_SIZE)
ShrinkNew(nUBucket);
vvNew[nUBucket].insert(nId);
}
return fNew;
}
void CAddrMan::Attempt_(const CService &addr, int64 nTime)
{
CAddrInfo *pinfo = Find(addr);
// if not found, bail out
if (!pinfo)
return;
CAddrInfo &info = *pinfo;
// check whether we are talking about the exact same CService (including same port)
if (info != addr)
return;
// update info
info.nLastTry = nTime;
info.nAttempts++;
}
CAddress CAddrMan::Select_(int nUnkBias)
{
if (size() == 0)
return CAddress();
double nCorTried = sqrt(nTried) * (100.0 - nUnkBias);
double nCorNew = sqrt(nNew) * nUnkBias;
if ((nCorTried + nCorNew)*GetRandInt(1<<30)/(1<<30) < nCorTried)
{
// use a tried node
double fChanceFactor = 1.0;
while(1)
{
int nKBucket = GetRandInt(vvTried.size());
std::vector<int> &vTried = vvTried[nKBucket];
if (vTried.size() == 0) continue;
int nPos = GetRandInt(vTried.size());
assert(mapInfo.count(vTried[nPos]) == 1);
CAddrInfo &info = mapInfo[vTried[nPos]];
if (GetRandInt(1<<30) < fChanceFactor*info.GetChance()*(1<<30))
return info;
fChanceFactor *= 1.2;
}
} else {
// use a new node
double fChanceFactor = 1.0;
while(1)
{
int nUBucket = GetRandInt(vvNew.size());
std::set<int> &vNew = vvNew[nUBucket];
if (vNew.size() == 0) continue;
int nPos = GetRandInt(vNew.size());
std::set<int>::iterator it = vNew.begin();
while (nPos--)
it++;
assert(mapInfo.count(*it) == 1);
CAddrInfo &info = mapInfo[*it];
if (GetRandInt(1<<30) < fChanceFactor*info.GetChance()*(1<<30))
return info;
fChanceFactor *= 1.2;
}
}
}
#ifdef DEBUG_ADDRMAN
int CAddrMan::Check_()
{
std::set<int> setTried;
std::map<int, int> mapNew;
if (vRandom.size() != nTried + nNew) return -7;
for (std::map<int, CAddrInfo>::iterator it = mapInfo.begin(); it != mapInfo.end(); it++)
{
int n = (*it).first;
CAddrInfo &info = (*it).second;
if (info.fInTried)
{
if (!info.nLastSuccess) return -1;
if (info.nRefCount) return -2;
setTried.insert(n);
} else {
if (info.nRefCount < 0 || info.nRefCount > ADDRMAN_NEW_BUCKETS_PER_ADDRESS) return -3;
if (!info.nRefCount) return -4;
mapNew[n] = info.nRefCount;
}
if (mapAddr[info] != n) return -5;
if (info.nRandomPos<0 || info.nRandomPos>=vRandom.size() || vRandom[info.nRandomPos] != n) return -14;
if (info.nLastTry < 0) return -6;
if (info.nLastSuccess < 0) return -8;
}
if (setTried.size() != nTried) return -9;
if (mapNew.size() != nNew) return -10;
for (int n=0; n<vvTried.size(); n++)
{
std::vector<int> &vTried = vvTried[n];
for (std::vector<int>::iterator it = vTried.begin(); it != vTried.end(); it++)
{
if (!setTried.count(*it)) return -11;
setTried.erase(*it);
}
}
for (int n=0; n<vvNew.size(); n++)
{
std::set<int> &vNew = vvNew[n];
for (std::set<int>::iterator it = vNew.begin(); it != vNew.end(); it++)
{
if (!mapNew.count(*it)) return -12;
if (--mapNew[*it] == 0)
mapNew.erase(*it);
}
}
if (setTried.size()) return -13;
if (mapNew.size()) return -15;
return 0;
}
#endif
void CAddrMan::GetAddr_(std::vector<CAddress> &vAddr)
{
int nNodes = ADDRMAN_GETADDR_MAX_PCT*vRandom.size()/100;
if (nNodes > ADDRMAN_GETADDR_MAX)
nNodes = ADDRMAN_GETADDR_MAX;
// perform a random shuffle over the first nNodes elements of vRandom (selecting from all)
for (int n = 0; n<nNodes; n++)
{
int nRndPos = GetRandInt(vRandom.size() - n) + n;
SwapRandom(n, nRndPos);
assert(mapInfo.count(vRandom[n]) == 1);
vAddr.push_back(mapInfo[vRandom[n]]);
}
}
void CAddrMan::Connected_(const CService &addr, int64 nTime)
{
CAddrInfo *pinfo = Find(addr);
// if not found, bail out
if (!pinfo)
return;
CAddrInfo &info = *pinfo;
// check whether we are talking about the exact same CService (including same port)
if (info != addr)
return;
// update info
int64 nUpdateInterval = 20 * 60;
if (nTime - info.nTime > nUpdateInterval)
info.nTime = nTime;
}
| YourDigitalCoin/YourDigitalCoin | src/addrman.cpp | C++ | mit | 15,682 |
<?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\Collections;
use Closure, Countable, IteratorAggregate, ArrayAccess;
/**
* The missing (SPL) Collection/Array/OrderedMap interface.
*
* A Collection resembles the nature of a regular PHP array. That is,
* it is essentially an <b>ordered map</b> that can also be used
* like a list.
*
* A Collection has an internal iterator just like a PHP array. In addition,
* a Collection can be iterated with external iterators, which is preferrable.
* To use an external iterator simply use the foreach language construct to
* iterate over the collection (which calls {@link getIterator()} internally) or
* explicitly retrieve an iterator though {@link getIterator()} which can then be
* used to iterate over the collection.
* You can not rely on the internal iterator of the collection being at a certain
* position unless you explicitly positioned it before. Prefer iteration with
* external iterators.
*
* @since 2.0
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
interface Collection extends Countable, IteratorAggregate, ArrayAccess
{
/**
* Adds an element at the end of the collection.
*
* @param mixed $element The element to add.
*
* @return boolean Always TRUE.
*/
function add($element);
/**
* Clears the collection, removing all elements.
*
* @return void
*/
function clear();
/**
* Checks whether an element is contained in the collection.
* This is an O(n) operation, where n is the size of the collection.
*
* @param mixed $element The element to search for.
*
* @return boolean TRUE if the collection contains the element, FALSE otherwise.
*/
function contains($element);
/**
* Checks whether the collection is empty (contains no elements).
*
* @return boolean TRUE if the collection is empty, FALSE otherwise.
*/
function isEmpty();
/**
* Removes the element at the specified index from the collection.
*
* @param string|integer $key The kex/index of the element to remove.
*
* @return mixed The removed element or NULL, if the collection did not contain the element.
*/
function remove($key);
/**
* Removes the specified element from the collection, if it is found.
*
* @param mixed $element The element to remove.
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
function removeElement($element);
/**
* Checks whether the collection contains an element with the specified key/index.
*
* @param string|integer $key The key/index to check for.
*
* @return boolean TRUE if the collection contains an element with the specified key/index,
* FALSE otherwise.
*/
function containsKey($key);
/**
* Gets the element at the specified key/index.
*
* @param string|integer $key The key/index of the element to retrieve.
*
* @return mixed
*/
function get($key);
/**
* Gets all keys/indices of the collection.
*
* @return array The keys/indices of the collection, in the order of the corresponding
* elements in the collection.
*/
function getKeys();
/**
* Gets all values of the collection.
*
* @return array The values of all elements in the collection, in the order they
* appear in the collection.
*/
function getValues();
/**
* Sets an element in the collection at the specified key/index.
*
* @param string|integer $key The key/index of the element to set.
* @param mixed $value The element to set.
*
* @return void
*/
function set($key, $value);
/**
* Gets a native PHP array representation of the collection.
*
* @return array
*/
function toArray();
/**
* Sets the internal iterator to the first element in the collection and returns this element.
*
* @return mixed
*/
function first();
/**
* Sets the internal iterator to the last element in the collection and returns this element.
*
* @return mixed
*/
function last();
/**
* Gets the key/index of the element at the current iterator position.
*
* @return int|string
*/
function key();
/**
* Gets the element of the collection at the current iterator position.
*
* @return mixed
*/
function current();
/**
* Moves the internal iterator position to the next element and returns this element.
*
* @return mixed
*/
function next();
/**
* Tests for the existence of an element that satisfies the given predicate.
*
* @param Closure $p The predicate.
*
* @return boolean TRUE if the predicate is TRUE for at least one element, FALSE otherwise.
*/
function exists(Closure $p);
/**
* Returns all the elements of this collection that satisfy the predicate p.
* The order of the elements is preserved.
*
* @param Closure $p The predicate used for filtering.
*
* @return Collection A collection with the results of the filter operation.
*/
function filter(Closure $p);
/**
* Tests whether the given predicate p holds for all elements of this collection.
*
* @param Closure $p The predicate.
*
* @return boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
*/
function forAll(Closure $p);
/**
* Applies the given function to each element in the collection and returns
* a new collection with the elements returned by the function.
*
* @param Closure $func
*
* @return Collection
*/
function map(Closure $func);
/**
* Partitions this collection in two collections according to a predicate.
* Keys are preserved in the resulting collections.
*
* @param Closure $p The predicate on which to partition.
*
* @return array An array with two elements. The first element contains the collection
* of elements where the predicate returned TRUE, the second element
* contains the collection of elements where the predicate returned FALSE.
*/
function partition(Closure $p);
/**
* Gets the index/key of a given element. The comparison of two elements is strict,
* that means not only the value but also the type must match.
* For objects this means reference equality.
*
* @param mixed $element The element to search for.
*
* @return int|string|bool The key/index of the element or FALSE if the element was not found.
*/
function indexOf($element);
/**
* Extracts a slice of $length elements starting at position $offset from the Collection.
*
* If $length is null it returns all elements from $offset to the end of the Collection.
* Keys have to be preserved by this method. Calling this method will only return the
* selected slice and NOT change the elements contained in the collection slice is called on.
*
* @param int $offset The offset to start from.
* @param int|null $length The maximum number of elements to return, or null for no limit.
*
* @return array
*/
function slice($offset, $length = null);
}
| miguelaxv/testGit | vendor/doctrine/collections/lib/Doctrine/Common/Collections/Collection.php | PHP | mit | 8,572 |
/*
* /MathJax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/Arrows.js
*
* Copyright (c) 2012 Design Science, Inc.
*
* 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.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS.MathJax_AMS,{8592:[437,-64,500,64,422],8594:[437,-64,500,58,417],8602:[437,-60,1000,56,942],8603:[437,-60,1000,54,942],8606:[417,-83,1000,56,944],8608:[417,-83,1000,55,943],8610:[417,-83,1111,56,1031],8611:[417,-83,1111,79,1054],8619:[575,41,1000,56,964],8620:[575,41,1000,35,943],8621:[417,-83,1389,57,1331],8622:[437,-60,1000,56,942],8624:[722,0,500,56,444],8625:[722,0,500,55,443],8630:[461,1,1000,17,950],8631:[460,1,1000,46,982],8634:[650,83,778,56,722],8635:[650,83,778,56,721],8638:[694,194,417,188,375],8639:[694,194,417,41,228],8642:[694,194,417,188,375],8643:[694,194,417,41,228],8644:[667,0,1000,55,944],8646:[667,0,1000,55,944],8647:[583,83,1000,55,944],8648:[694,193,833,83,749],8649:[583,83,1000,55,944],8650:[694,194,833,83,749],8651:[514,14,1000,55,944],8652:[514,14,1000,55,944],8653:[534,35,1000,54,942],8654:[534,37,1000,32,965],8655:[534,35,1000,55,943],8666:[611,111,1000,76,944],8667:[611,111,1000,55,923],8669:[417,-83,1000,56,943],8672:[437,-64,1334,64,1251],8674:[437,-64,1334,84,1251]});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir+"/AMS/Regular/Arrows.js");
| wil93/cdnjs | ajax/libs/mathjax/2.1.0/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/Arrows.js | JavaScript | mit | 1,550 |
YUI.add('querystring-stringify', function(Y) {
/**
* Provides Y.QueryString.stringify method for converting objects to Query Strings.
*
* @module querystring
* @submodule querystring-stringify
* @for QueryString
* @static
*/
var QueryString = Y.namespace("QueryString"),
stack = [],
L = Y.Lang;
/**
* Provides Y.QueryString.escape method to be able to override default encoding
* method. This is important in cases where non-standard delimiters are used, if
* the delimiters would not normally be handled properly by the builtin
* (en|de)codeURIComponent functions.
* Default: encodeURIComponent
* @module querystring
* @submodule querystring-stringify
* @for QueryString
* @static
**/
QueryString.escape = encodeURIComponent;
/**
* <p>Converts an arbitrary value to a Query String representation.</p>
*
* <p>Objects with cyclical references will trigger an exception.</p>
*
* @method stringify
* @public
* @param obj {Variant} any arbitrary value to convert to query string
* @param cfg {Object} (optional) Configuration object. The three
* supported configurations are:
* <ul><li>sep: When defined, the value will be used as the key-value
* separator. The default value is "&".</li>
* <li>eq: When defined, the value will be used to join the key to
* the value. The default value is "=".</li>
* <li>arrayKey: When set to true, the key of an array will have the
* '[]' notation appended to the key. The default value is false.
* </li></ul>
* @param name {String} (optional) Name of the current key, for handling children recursively.
* @static
*/
QueryString.stringify = function (obj, c, name) {
var begin, end, i, l, n, s,
sep = c && c.sep ? c.sep : "&",
eq = c && c.eq ? c.eq : "=",
aK = c && c.arrayKey ? c.arrayKey : false;
if (L.isNull(obj) || L.isUndefined(obj) || L.isFunction(obj)) {
return name ? QueryString.escape(name) + eq : '';
}
if (L.isBoolean(obj) || Object.prototype.toString.call(obj) === '[object Boolean]') {
obj =+ obj;
}
if (L.isNumber(obj) || L.isString(obj)) {
return QueryString.escape(name) + eq + QueryString.escape(obj);
}
if (L.isArray(obj)) {
s = [];
name = aK ? name + '[]' : name;
l = obj.length;
for (i = 0; i < l; i++) {
s.push( QueryString.stringify(obj[i], c, name) );
}
return s.join(sep);
}
// now we know it's an object.
// Check for cyclical references in nested objects
for (i = stack.length - 1; i >= 0; --i) {
if (stack[i] === obj) {
throw new Error("QueryString.stringify. Cyclical reference");
}
}
stack.push(obj);
s = [];
begin = name ? name + '[' : '';
end = name ? ']' : '';
for (i in obj) {
if (obj.hasOwnProperty(i)) {
n = begin + i + end;
s.push(QueryString.stringify(obj[i], c, n));
}
}
stack.pop();
s = s.join(sep);
if (!s && name) {
return name + "=";
}
return s;
};
}, '@VERSION@' ,{requires:['yui-base'], supersedes:['querystring-stringify-simple']});
| wil93/cdnjs | ajax/libs/yui/3.5.0pr3/querystring-stringify/querystring-stringify.js | JavaScript | mit | 3,155 |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (factory) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
// Because of build optimizers
if (typeof define === 'function' && define.amd) {
define(['rx'], function (Rx, exports) {
return factory(root, exports, Rx);
});
} else if (typeof module === 'object' && module && module.exports === freeExports) {
module.exports = factory(root, module.exports, require('./rx'));
} else {
root.Rx = factory(root, {}, root.Rx);
}
}.call(this, function (root, exp, Rx, undefined) {
// Aliases
var Scheduler = Rx.Scheduler,
PriorityQueue = Rx.internals.PriorityQueue,
ScheduledItem = Rx.internals.ScheduledItem,
SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive,
disposableEmpty = Rx.Disposable.empty,
inherits = Rx.internals.inherits,
defaultSubComparer = Rx.helpers.defaultSubComparer;
/** Provides a set of extension methods for virtual time scheduling. */
Rx.VirtualTimeScheduler = (function (__super__) {
function notImplemented() {
throw new Error('Not implemented');
}
function localNow() {
return this.toDateTimeOffset(this.clock);
}
function scheduleNow(state, action) {
return this.scheduleAbsoluteWithState(state, this.clock, action);
}
function scheduleRelative(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime), action);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime - this.now()), action);
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
inherits(VirtualTimeScheduler, __super__);
/**
* Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
*
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function VirtualTimeScheduler(initialClock, comparer) {
this.clock = initialClock;
this.comparer = comparer;
this.isEnabled = false;
this.queue = new PriorityQueue(1024);
__super__.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
VirtualTimeSchedulerPrototype.add = notImplemented;
/**
* Converts an absolute time to a number
* @param {Any} The absolute time.
* @returns {Number} The absolute time in ms
*/
VirtualTimeSchedulerPrototype.toDateTimeOffset = notImplemented;
/**
* Converts the TimeSpan value to a relative virtual time value.
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
VirtualTimeSchedulerPrototype.toRelative = notImplemented;
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
VirtualTimeSchedulerPrototype.schedulePeriodicWithState = function (state, period, action) {
var s = new SchedulePeriodicRecursive(this, state, period, action);
return s.start();
};
/**
* Schedules an action to be executed after dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelativeWithState = function (state, dueTime, action) {
var runAt = this.add(this.clock, dueTime);
return this.scheduleAbsoluteWithState(state, runAt, action);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelative = function (dueTime, action) {
return this.scheduleRelativeWithState(action, dueTime, invokeAction);
};
/**
* Starts the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.start = function () {
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
}
};
/**
* Stops the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.stop = function () {
this.isEnabled = false;
};
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
* @param {Number} time Absolute time to advance the scheduler's clock to.
*/
VirtualTimeSchedulerPrototype.advanceTo = function (time) {
var dueToClock = this.comparer(this.clock, time);
if (this.comparer(this.clock, time) > 0) {
throw new Error(argumentOutOfRange);
}
if (dueToClock === 0) {
return;
}
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null && this.comparer(next.dueTime, time) <= 0) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
this.clock = time;
}
};
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.advanceBy = function (time) {
var dt = this.add(this.clock, time),
dueToClock = this.comparer(this.clock, dt);
if (dueToClock > 0) { throw new Error(argumentOutOfRange); }
if (dueToClock === 0) { return; }
this.advanceTo(dt);
};
/**
* Advances the scheduler's clock by the specified relative time.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.sleep = function (time) {
var dt = this.add(this.clock, time);
if (this.comparer(this.clock, dt) >= 0) { throw new Error(argumentOutOfRange); }
this.clock = dt;
};
/**
* Gets the next scheduled item to be executed.
* @returns {ScheduledItem} The next scheduled item.
*/
VirtualTimeSchedulerPrototype.getNext = function () {
while (this.queue.length > 0) {
var next = this.queue.peek();
if (next.isCancelled()) {
this.queue.dequeue();
} else {
return next;
}
}
return null;
};
/**
* Schedules an action to be executed at dueTime.
* @param {Scheduler} scheduler Scheduler to execute the action on.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsolute = function (dueTime, action) {
return this.scheduleAbsoluteWithState(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
var self = this;
function run(scheduler, state1) {
self.queue.remove(si);
return action(scheduler, state1);
}
var si = new ScheduledItem(this, state, run, dueTime, this.comparer);
this.queue.enqueue(si);
return si.disposable;
};
return VirtualTimeScheduler;
}(Scheduler));
/** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */
Rx.HistoricalScheduler = (function (__super__) {
inherits(HistoricalScheduler, __super__);
/**
* Creates a new historical scheduler with the specified initial clock value.
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function HistoricalScheduler(initialClock, comparer) {
var clock = initialClock == null ? 0 : initialClock;
var cmp = comparer || defaultSubComparer;
__super__.call(this, clock, cmp);
}
var HistoricalSchedulerProto = HistoricalScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
HistoricalSchedulerProto.add = function (absolute, relative) {
return absolute + relative;
};
HistoricalSchedulerProto.toDateTimeOffset = function (absolute) {
return new Date(absolute).getTime();
};
/**
* Converts the TimeSpan value to a relative virtual time value.
* @memberOf HistoricalScheduler
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
HistoricalSchedulerProto.toRelative = function (timeSpan) {
return timeSpan;
};
return HistoricalScheduler;
}(Rx.VirtualTimeScheduler));
return Rx;
}));
| sajochiu/cdnjs | ajax/libs/rxjs/2.3.14/rx.virtualtime.js | JavaScript | mit | 12,108 |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (factory) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
// Because of build optimizers
if (typeof define === 'function' && define.amd) {
define(['rx'], function (Rx, exports) {
return factory(root, exports, Rx);
});
} else if (typeof module === 'object' && module && module.exports === freeExports) {
module.exports = factory(root, module.exports, require('./rx'));
} else {
root.Rx = factory(root, {}, root.Rx);
}
}.call(this, function (root, exp, Rx, undefined) {
// Aliases
var Observable = Rx.Observable,
observableProto = Observable.prototype,
AnonymousObservable = Rx.AnonymousObservable,
observableThrow = Observable.throwException,
observerCreate = Rx.Observer.create,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
CompositeDisposable = Rx.CompositeDisposable,
AbstractObserver = Rx.internals.AbstractObserver,
noop = Rx.helpers.noop,
defaultComparer = Rx.internals.isEqual,
inherits = Rx.internals.inherits,
Enumerable = Rx.internals.Enumerable,
Enumerator = Rx.internals.Enumerator,
$iterator$ = Rx.iterator,
doneEnumerator = Rx.doneEnumerator,
slice = Array.prototype.slice;
// Utilities
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
/** @private */
var Map = root.Map || (function () {
function Map() {
this._keys = [];
this._values = [];
}
Map.prototype.get = function (key) {
var i = this._keys.indexOf(key);
return i !== -1 ? this._values[i] : undefined;
};
Map.prototype.set = function (key, value) {
var i = this._keys.indexOf(key);
i !== -1 && (this._values[i] = value);
this._values[this._keys.push(key) - 1] = value;
};
Map.prototype.forEach = function (callback, thisArg) {
for (var i = 0, len = this._keys.length; i < len; i++) {
callback.call(thisArg, this._values[i], this._keys[i]);
}
};
return Map;
}());
/**
* @constructor
* Represents a join pattern over observable sequences.
*/
function Pattern(patterns) {
this.patterns = patterns;
}
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
Pattern.prototype.and = function (other) {
return new Pattern(this.patterns.concat(other));
};
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
Pattern.prototype.thenDo = function (selector) {
return new Plan(this, selector);
};
function Plan(expression, selector) {
this.expression = expression;
this.selector = selector;
}
Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) {
var self = this;
var joinObservers = [];
for (var i = 0, len = this.expression.patterns.length; i < len; i++) {
joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], observer.onError.bind(observer)));
}
var activePlan = new ActivePlan(joinObservers, function () {
var result;
try {
result = self.selector.apply(self, arguments);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
}, function () {
for (var j = 0, jlen = joinObservers.length; j < jlen; j++) {
joinObservers[j].removeActivePlan(activePlan);
}
deactivate(activePlan);
});
for (i = 0, len = joinObservers.length; i < len; i++) {
joinObservers[i].addActivePlan(activePlan);
}
return activePlan;
};
function planCreateObserver(externalSubscriptions, observable, onError) {
var entry = externalSubscriptions.get(observable);
if (!entry) {
var observer = new JoinObserver(observable, onError);
externalSubscriptions.set(observable, observer);
return observer;
}
return entry;
}
function ActivePlan(joinObserverArray, onNext, onCompleted) {
this.joinObserverArray = joinObserverArray;
this.onNext = onNext;
this.onCompleted = onCompleted;
this.joinObservers = new Map();
for (var i = 0, len = this.joinObserverArray.length; i < len; i++) {
var joinObserver = this.joinObserverArray[i];
this.joinObservers.set(joinObserver, joinObserver);
}
}
ActivePlan.prototype.dequeue = function () {
this.joinObservers.forEach(function (v) { v.queue.shift(); });
};
ActivePlan.prototype.match = function () {
var i, len, hasValues = true;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
if (this.joinObserverArray[i].queue.length === 0) {
hasValues = false;
break;
}
}
if (hasValues) {
var firstValues = [],
isCompleted = false;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
firstValues.push(this.joinObserverArray[i].queue[0]);
this.joinObserverArray[i].queue[0].kind === 'C' && (isCompleted = true);
}
if (isCompleted) {
this.onCompleted();
} else {
this.dequeue();
var values = [];
for (i = 0, len = firstValues.length; i < firstValues.length; i++) {
values.push(firstValues[i].value);
}
this.onNext.apply(this, values);
}
}
};
var JoinObserver = (function (__super__) {
inherits(JoinObserver, __super__);
function JoinObserver(source, onError) {
__super__.call(this);
this.source = source;
this.onError = onError;
this.queue = [];
this.activePlans = [];
this.subscription = new SingleAssignmentDisposable();
this.isDisposed = false;
}
var JoinObserverPrototype = JoinObserver.prototype;
JoinObserverPrototype.next = function (notification) {
if (!this.isDisposed) {
if (notification.kind === 'E') {
this.onError(notification.exception);
return;
}
this.queue.push(notification);
var activePlans = this.activePlans.slice(0);
for (var i = 0, len = activePlans.length; i < len; i++) {
activePlans[i].match();
}
}
};
JoinObserverPrototype.error = noop;
JoinObserverPrototype.completed = noop;
JoinObserverPrototype.addActivePlan = function (activePlan) {
this.activePlans.push(activePlan);
};
JoinObserverPrototype.subscribe = function () {
this.subscription.setDisposable(this.source.materialize().subscribe(this));
};
JoinObserverPrototype.removeActivePlan = function (activePlan) {
this.activePlans.splice(this.activePlans.indexOf(activePlan), 1);
this.activePlans.length === 0 && this.dispose();
};
JoinObserverPrototype.dispose = function () {
__super__.prototype.dispose.call(this);
if (!this.isDisposed) {
this.isDisposed = true;
this.subscription.dispose();
}
};
return JoinObserver;
} (AbstractObserver));
/**
* Creates a pattern that matches when both observable sequences have an available value.
*
* @param right Observable sequence to match with the current sequence.
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
*/
observableProto.and = function (right) {
return new Pattern([this, right]);
};
/**
* Matches when the observable sequence has an available value and projects the value.
*
* @param selector Selector that will be invoked for values in the source sequence.
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
observableProto.thenDo = function (selector) {
return new Pattern([this]).thenDo(selector);
};
/**
* Joins together the results from several patterns.
*
* @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.
* @returns {Observable} Observable sequence with the results form matching several patterns.
*/
Observable.when = function () {
var plans = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var activePlans = [],
externalSubscriptions = new Map();
var outObserver = observerCreate(
observer.onNext.bind(observer),
function (err) {
externalSubscriptions.forEach(function (v) { v.onError(err); });
observer.onError(err);
},
observer.onCompleted.bind(observer)
);
try {
for (var i = 0, len = plans.length; i < len; i++) {
activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) {
var idx = activePlans.indexOf(activePlan);
activePlans.splice(idx, 1);
activePlans.length === 0 && observer.onCompleted();
}));
}
} catch (e) {
observableThrow(e).subscribe(observer);
}
var group = new CompositeDisposable();
externalSubscriptions.forEach(function (joinObserver) {
joinObserver.subscribe();
group.add(joinObserver);
});
return group;
});
};
return Rx;
}));
| pc035860/cdnjs | ajax/libs/rxjs/2.3.20/rx.joinpatterns.js | JavaScript | mit | 11,059 |
define(
"dojo/nls/hr/colors", ({
// local representation of all CSS3 named colors, companion to dojo.colors. To be used where descriptive information
// is required for each color, such as a palette widget, and not for specifying color programatically.
//Note: due to the SVG 1.0 spec additions, some of these are alternate spellings for the same color (e.g. gray / grey).
//TODO: should we be using unique rgb values as keys instead and avoid these duplicates, or rely on the caller to do the reverse mapping?
aliceblue: "alice plava",
antiquewhite: "antique bijela",
aqua: "aqua",
aquamarine: "akvamarin",
azure: "azurna",
beige: "bež",
bisque: "svjetlo smeđe ružičasta",
black: "crna",
blanchedalmond: "svjetlo bademasta",
blue: "plava",
blueviolet: "plavo ljubičasta",
brown: "smeđa",
burlywood: "tamno smeđa",
cadetblue: "kadet plava",
chartreuse: "chartreuse",
chocolate: "čokoladna",
coral: "koraljna",
cornflowerblue: "različak plava",
cornsilk: "cornsilk",
crimson: "rumena",
cyan: "cijan",
darkblue: "tamno plava",
darkcyan: "tamno cijan",
darkgoldenrod: "tamno zlatno žuta",
darkgray: "tamno siva",
darkgreen: "tamno zelena",
darkgrey: "tamno siva", // same as darkgray
darkkhaki: "tamno sivo smeđa",
darkmagenta: "tamno grimizna",
darkolivegreen: "tamno maslinasto zelena",
darkorange: "tamno narančasta",
darkorchid: "tamno ružičasta",
darkred: "tamno crvena",
darksalmon: "tamno žuto ružičasta",
darkseagreen: "tamno plavo zelena",
darkslateblue: "tamno sivo plava",
darkslategray: "tamno plavo siva",
darkslategrey: "tamno plavo siva", // same as darkslategray
darkturquoise: "tamno tirkizna",
darkviolet: "tamno ljubičasta",
deeppink: "intenzivno ružičasta",
deepskyblue: "intenzivno nebesko plava",
dimgray: "mutno siva",
dimgrey: "mutno siva", // same as dimgray
dodgerblue: "dodger plava",
firebrick: "žarko crvena",
floralwhite: "cvjetno bijela",
forestgreen: "šumsko zelena",
fuchsia: "fuksija",
gainsboro: "gainsboro",
ghostwhite: "sivo bijela",
gold: "zlatna",
goldenrod: "zlatno žuta",
gray: "siva",
green: "zelena",
greenyellow: "zeleno žuta",
grey: "siva", // same as gray
honeydew: "honeydew",
hotpink: "žarko ružičasta",
indianred: "indijski crveno",
indigo: "indigo",
ivory: "slonovača",
khaki: "sivo smeđa",
lavender: "lavanda",
lavenderblush: "rumena lavanda",
lawngreen: "livadno zelena",
lemonchiffon: "nježno žuta",
lightblue: "svjetlo plava",
lightcoral: "svjetlo koraljna",
lightcyan: "svjetlo cijan",
lightgoldenrodyellow: "svjetlo zlatno žuta",
lightgray: "svjetlo siva",
lightgreen: "svjetlo zelena",
lightgrey: "svjetlo siva", // same as lightgray
lightpink: "svjetlo ružičasta",
lightsalmon: "svjetlo žuto ružičasta",
lightseagreen: "svjetlo plavo zelena",
lightskyblue: "svjetlo nebesko plava",
lightslategray: "svjetlo plavo siva",
lightslategrey: "svjetlo plavo siva", // same as lightslategray
lightsteelblue: "svjetlo čelično plava",
lightyellow: "svjetlo žuta",
lime: "limeta",
limegreen: "limeta zelena",
linen: "platno",
magenta: "grimizna",
maroon: "kestenjasta",
mediumaquamarine: "srednje akvamarin",
mediumblue: "srednje plava",
mediumorchid: "srednje ružičasta",
mediumpurple: "srednje purpurna",
mediumseagreen: "srednje plavo zelena",
mediumslateblue: "srednje sivo plava",
mediumspringgreen: "srednje proljetno zelena",
mediumturquoise: "srednje tirkizna",
mediumvioletred: "srednje ljubičasto crvena",
midnightblue: "ponoćno plava",
mintcream: "blijedo zelena",
mistyrose: "mutno ružičasta",
moccasin: "moccasin",
navajowhite: "krem bijela",
navy: "mornarsko plava",
oldlace: "old lace",
olive: "maslinasta",
olivedrab: "maslinasto siva",
orange: "narančasta",
orangered: "narančasto crvena",
orchid: "ružičasta",
palegoldenrod: "blijedo zlatno žuta",
palegreen: "blijedo zelena",
paleturquoise: "blijedo tirkizna",
palevioletred: "blijedo ljubičasto crvena",
papayawhip: "blijedo narančasta",
peachpuff: "breskva",
peru: "peru",
pink: "roza",
plum: "šljiva",
powderblue: "blijedo plava",
purple: "purpurna",
red: "crvena",
rosybrown: "ružičasto smeđa",
royalblue: "kraljevski plava",
saddlebrown: "srednje smeđa",
salmon: "žuto ružičasta",
sandybrown: "pješčano smeđa",
seagreen: "plavo zelena",
seashell: "nježno ružičasta",
sienna: "sjena",
silver: "srebrna",
skyblue: "nebesko plava",
slateblue: "sivo plava",
slategray: "plavo siva",
slategrey: "plavo siva", // same as slategray
snow: "snijeg",
springgreen: "proljetno zeleno",
steelblue: "čelično plava",
tan: "ten",
teal: "teal",
thistle: "čičak",
tomato: "rajčica",
transparent: "prozirno",
turquoise: "tirkizna",
violet: "ljubičasta",
wheat: "pšenica",
white: "bijela",
whitesmoke: "bijeli dim",
yellow: "žuta",
yellowgreen: "žuto zelena"
})
);
| hpneo/cdnjs | ajax/libs/dojo/1.9.1/nls/hr/colors.js.uncompressed.js | JavaScript | mit | 4,888 |
Logic._MiniSat = MiniSat; // Expose for testing and poking around
// import the private testers from types.js
var isInteger = Logic._isInteger;
var isFunction = Logic._isFunction;
var isString = Logic._isString;
var isArrayWhere = Logic._isArrayWhere;
var isFormulaOrTerm = Logic._isFormulaOrTerm;
var isFormulaOrTermOrBits = Logic._isFormulaOrTermOrBits;
Logic._assert = function (value, tester, description) {
if (! tester(value)) {
var displayValue = (typeof value === 'string' ? JSON.stringify(value) :
value);
throw new Error(displayValue + " is not " +
(tester.description || description));
}
};
// Call this as `if (assert) assertNumArgs(...)`
var assertNumArgs = function (actual, expected, funcName) {
if (actual !== expected) {
throw new Error("Expected " + expected + " args in " + funcName +
", got " + actual);
}
};
// Call `assert` as: `if (assert) assert(...)`.
// This local variable temporarily set to `null` inside
// `Logic.disablingAssertions`.
var assert = Logic._assert;
// Like `if (assert) assert(...)` but usable from other files in the package.
Logic._assertIfEnabled = function (value, tester, description) {
if (assert) assert(value, tester, description);
};
// Disabling runtime assertions speeds up clause generation. Assertions
// are disabled when the local variable `assert` is null instead of
// `Logic._assert`.
Logic.disablingAssertions = function (f) {
var oldAssert = assert;
try {
assert = null;
return f();
} finally {
assert = oldAssert;
}
};
// Back-compat.
Logic._disablingTypeChecks = Logic.disablingAssertions;
////////////////////
// Takes a Formula or Term, returns a Formula or Term.
// Unlike other operators, if you give it a Term,
// you will get a Term back (of the same type, NameTerm
// or NumTerm).
Logic.not = function (operand) {
if (assert) assert(operand, isFormulaOrTerm);
if (operand instanceof Logic.Formula) {
return new Logic.NotFormula(operand);
} else {
// Term
if (typeof operand === 'number') {
return -operand;
} else if (operand.charAt(0) === '-') {
return operand.slice(1);
} else {
return '-' + operand;
}
}
};
Logic.NAME_FALSE = "$F";
Logic.NAME_TRUE = "$T";
Logic.NUM_FALSE = 1;
Logic.NUM_TRUE = 2;
Logic.TRUE = Logic.NAME_TRUE;
Logic.FALSE = Logic.NAME_FALSE;
// Abstract base class. Subclasses are created using _defineFormula.
Logic.Formula = function () {};
Logic._defineFormula = function (constructor, typeName, methods) {
if (assert) assert(constructor, isFunction);
if (assert) assert(typeName, isString);
constructor.prototype = new Logic.Formula();
constructor.prototype.type = typeName;
if (methods) {
_.extend(constructor.prototype, methods);
}
};
// Returns a list of Clauses that together require the Formula to be
// true, or false (depending on isTrue; both cases must be
// implemented). A single Clause may also be returned. The
// implementation should call the termifier to convert terms and
// formulas to NumTerms specific to a solver instance, and use them to
// construct a Logic.Clause.
Logic.Formula.prototype.generateClauses = function (isTrue, termifier) {
throw new Error("Cannot generate this Formula; it must be expanded");
};
// All Formulas have a globally-unique id so that Solvers can track them.
// It is assigned lazily.
Logic.Formula._nextGuid = 1;
Logic.Formula.prototype._guid = null;
Logic.Formula.prototype.guid = function () {
if (this._guid === null) {
this._guid = Logic.Formula._nextGuid++;
}
return this._guid;
};
// A "clause" is a disjunction of terms, e.g. "A or B or (not C)",
// which we write "A v B v -C". Logic.Clause is mainly an internal
// Solver data structure, which is the final result of formula
// generation and mapping variable names to numbers, before passing
// the clauses to MiniSat.
Logic.Clause = function (/*formulaOrArray, ...*/) {
var terms = _.flatten(arguments);
if (assert) assert(terms, isArrayWhere(Logic.isNumTerm));
this.terms = terms; // immutable [NumTerm]
};
// Returns a new Clause with the extra term or terms appended
Logic.Clause.prototype.append = function (/*formulaOrArray, ...*/) {
return new Logic.Clause(this.terms.concat(_.flatten(arguments)));
};
var FormulaInfo = function () {
// We generate a variable when a Formula is used.
this.varName = null; // string name of variable
this.varNum = null; // number of variable (always positive)
// A formula variable that is used only in the positive or only
// in the negative doesn't need the full set of clauses that
// establish a bidirectional implication between the formula and the
// variable. For example, in the formula `Logic.or("A", "B")`, with the
// formula variable `$or1`, the full set of clauses is `A v B v
// -$or1; -A v $or1; -B v $or1`. If both `$or1` and `-$or1` appear
// elsewhere in the set of clauses, then all three of these clauses
// are required. However, somewhat surprisingly, if only `$or1` appears,
// then only the first is necessary. If only `-$or1` appears, then only
// the second and third are necessary.
//
// Suppose the formula A v B is represented by the variable $or1,
// and $or1 is only used positively. It's important that A v B being
// false forces $or1 to be false, so that when $or1 is used it has
// the appropriate effect. For example, if we have the clause $or1 v
// C, then A v B being false should force $or1 to be false, which
// forces C to be true. So we generate the clause A v B v
// -$or1. (The implications of this clause are: If A v B is false,
// $or1 must be false. If $or1 is true, A v B must be true.)
//
// However, in the case where A v B is true, we don't actually
// need to insist that the solver set $or1 to true, as long as we
// are ok with relaxing the relationship between A v B and $or1
// and getting a "wrong" value for $or1 in the solution. Suppose
// the solver goes to work and at some point determines A v B to
// be true. It could set $or1 to true, satisfying all the clauses
// where it appears, or it could set $or1 to false, which only
// constrains the solution space and doesn't open up any new
// solutions for other variables. If the solver happens to find a
// solution where A v B is true and $or1 is false, we know there
// is a similar solution that makes all the same assignments
// except it assigns $or1 to true.
//
// If a formula is used only negatively, a similar argument applies
// but with signs flipped, and if it is used both positively and
// negatively, both kinds of clauses must be generated.
//
// See the mention of "polarity" in the MiniSat+ paper
// (http://minisat.se/downloads/MiniSat+.pdf).
//
// These flags are set when generation has been done for the positive
// case or the negative case, so that we only generate each one once.
this.occursPositively = false;
this.occursNegatively = false;
// If a Formula has been directly required or forbidden, we can
// replace it by TRUE or FALSE in subsequent clauses. Track the
// information here.
this.isRequired = false;
this.isForbidden = false;
};
// The "termifier" interface is provided to a Formula's
// generateClauses method, which must use it to generate Clause
// objects.
//
// The reason for this approach is that it gives the Formula control
// over the clauses returned, but it gives the Solver control over
// Formula generation.
Logic.Termifier = function (solver) {
this.solver = solver;
};
// The main entry point, the `clause` method takes a list of
// FormulaOrTerms and converts it to a Clause containing NumTerms, *by
// replacing Formulas with their variables*, creating the variable if
// necessary. For example, if an OrFormula is represented by the
// variable `$or1`, it will be replaced by the numeric version of
// `$or1` to make the Clause. When the Clause is actually used, it
// will trigger generation of the clauses that relate `$or1` to the
// operands of the OrFormula.
Logic.Termifier.prototype.clause = function (/*args*/) {
var self = this;
var formulas = _.flatten(arguments);
if (assert) assert(formulas, isArrayWhere(isFormulaOrTerm));
return new Logic.Clause(_.map(formulas, function (f) {
return self.term(f);
}));
};
// The `term` method performs the mapping from FormulaOrTerm to
// NumTerm. It's called by `clause` and could be called directly
// from a Formula's generateClauses if it was useful for some
// reason.
Logic.Termifier.prototype.term = function (formula) {
return this.solver._formulaToTerm(formula);
};
// The `generate` method generates clauses for a Formula (or
// Term). It should be used carefully, because it works quite
// differently from passing a Formula into `clause`, which is the
// normal way for one Formula to refer to another. When you use a
// Formula in `clause`, it is replaced by the Formula's variable,
// and the Solver handles generating the Formula's clauses once.
// When you use `generate`, this system is bypassed, and the
// Formula's generateClauses method is called pretty much directly,
// returning the array of Clauses.
Logic.Termifier.prototype.generate = function (isTrue, formula) {
return this.solver._generateFormula(isTrue, formula, this);
};
Logic.Solver = function () {
var self = this;
self.clauses = []; // mutable [Clause]
self._num2name = [null]; // no 0th var
self._name2num = {}; // (' '+vname) -> vnum
// true and false
var F = self.getVarNum(Logic.NAME_FALSE, false, true); // 1
var T = self.getVarNum(Logic.NAME_TRUE, false, true); // 2
if (F !== Logic.NUM_FALSE || T !== Logic.NUM_TRUE) {
throw new Error("Assertion failure: $T and $F have wrong numeric value");
}
self._F_used = false;
self._T_used = false;
// It's important that these clauses are elements 0 and 1
// of the clauses array, so that they can optionally be stripped
// off. For example, _clauseData takes advantage of this fact.
self.clauses.push(new Logic.Clause(-Logic.NUM_FALSE));
self.clauses.push(new Logic.Clause(Logic.NUM_TRUE));
self._formulaInfo = {}; // Formula guid -> FormulaInfo
// For generating formula variables like "$or1", "$or2", "$and1", "$and2"
self._nextFormulaNumByType = {}; // Formula type -> next var id
// Map of Formulas whose info has `false` for either
// `occursPositively` or `occursNegatively`
self._ungeneratedFormulas = {}; // varNum -> Formula
self._numClausesAddedToMiniSat = 0;
self._unsat = false; // once true, no solution henceforth
self._minisat = new MiniSat(); // this takes some time
self._termifier = new Logic.Termifier(self);
};
// Get a var number for vname, assigning it a number if it is new.
// Setting "noCreate" to true causes the function to return 0 instead of
// creating a new variable.
// Setting "_createInternals" to true grants the ability to create $ variables.
Logic.Solver.prototype.getVarNum = function (vname, noCreate, _createInternals) {
var key = ' '+vname;
if (_.has(this._name2num, key)) {
return this._name2num[key];
} else if (noCreate) {
return 0;
} else {
if (vname.charAt(0) === "$" && ! _createInternals) {
throw new Error("Only generated variable names can start with $");
}
var vnum = this._num2name.length;
this._name2num[key] = vnum;
this._num2name.push(vname);
return vnum;
}
};
Logic.Solver.prototype.getVarName = function (vnum) {
if (assert) assert(vnum, isInteger);
var num2name = this._num2name;
if (vnum < 1 || vnum >= num2name.length) {
throw new Error("Bad variable num: " + vnum);
} else {
return num2name[vnum];
}
};
// Converts a Term to a NumTerm (if it isn't already). This is done
// when a Formula creates Clauses for a Solver, since Clauses require
// NumTerms. NumTerms stay the same, while a NameTerm like "-foo"
// might become (say) the number -3. If a NameTerm names a variable
// that doesn't exist, it is automatically created, unless noCreate
// is passed, in which case 0 is returned instead.
Logic.Solver.prototype.toNumTerm = function (t, noCreate) {
var self = this;
if (assert) assert(t, Logic.isTerm);
if (typeof t === 'number') {
return t;
} else { // string
var not = false;
while (t.charAt(0) === '-') {
t = t.slice(1);
not = ! not;
}
var n = self.getVarNum(t, noCreate);
if (! n) {
return 0; // must be the noCreate case
} else {
return (not ? -n : n);
}
}
};
// Converts a Term to a NameTerm (if it isn't already).
Logic.Solver.prototype.toNameTerm = function (t) {
var self = this;
if (assert) assert(t, Logic.isTerm);
if (typeof t === 'string') {
// canonicalize, removing leading "--"
while (t.slice(0, 2) === '--') {
t = t.slice(2);
}
return t;
} else { // number
var not = false;
if (t < 0) {
not = true;
t = -t;
}
t = self.getVarName(t);
if (not) {
t = '-' + t;
}
return t;
}
};
Logic.Solver.prototype._addClause = function (cls, _extraTerms,
_useTermOverride) {
var self = this;
if (assert) assert(cls, Logic.isClause);
var extraTerms = null;
if (_extraTerms) {
extraTerms = _extraTerms;
if (assert) assert(extraTerms, isArrayWhere(Logic.isNumTerm));
}
var usedF = false;
var usedT = false;
var numRealTerms = cls.terms.length;
if (extraTerms) {
// extraTerms are added to the clause as is. Formula variables in
// extraTerms do not cause Formula clause generation, which is
// necessary to implement Formula clause generation.
cls = cls.append(extraTerms);
}
for (var i = 0; i < cls.terms.length; i++) {
var t = cls.terms[i];
var v = (t < 0) ? -t : t;
if (v === Logic.NUM_FALSE) {
usedF = true;
} else if (v === Logic.NUM_TRUE) {
usedT = true;
} else if (v < 1 || v >= self._num2name.length) {
throw new Error("Bad variable number: " + v);
} else if (i < numRealTerms) {
if (_useTermOverride) {
_useTermOverride(t);
} else {
self._useFormulaTerm(t);
}
}
}
this._F_used = (this._F_used || usedF);
this._T_used = (this._T_used || usedT);
this.clauses.push(cls);
};
// When we actually use a Formula variable, generate clauses for it,
// based on whether the usage is positive or negative. For example,
// if the Formula `Logic.or("X", "Y")` is represented by `$or1`, which
// is variable number 5, then when you actually use 5 or -5 in a clause,
// the clauses "X v Y v -5" (when you use 5) or "-X v 5; -Y v 5"
// (when you use -5) will be generated. The clause "X v Y v -5"
// is equivalent to "5 => X v Y" (or -(X v Y) => -5), while the clauses
// "-X v 5; -Y v 5" are equivalent to "-5 => -X; -5 => -Y" (or
// "X => 5; Y => 5").
Logic.Solver.prototype._useFormulaTerm = function (t, _addClausesOverride) {
var self = this;
if (assert) assert(t, Logic.isNumTerm);
var v = (t < 0) ? -t : t;
if (! _.has(self._ungeneratedFormulas, v)) {
return;
}
// using a Formula's var; maybe have to generate clauses
// for the Formula
var formula = self._ungeneratedFormulas[v];
var info = self._getFormulaInfo(formula);
var positive = t > 0;
// To avoid overflowing the JS stack, defer calls to addClause.
// The way we get overflows is when Formulas are deeply nested
// (which happens naturally when you call Logic.sum or
// Logic.weightedSum on a long list of terms), which causes
// addClause to call useFormulaTerm to call addClause, and so
// on. Approach: The outermost useFormulaTerm keeps a list
// of clauses to add, and then adds them in a loop using a
// special argument to addClause that passes a special argument
// to useFormulaTerm that causes those clauses to go into the
// list too. Code outside of `_useFormulaTerm` and `_addClause(s)`
// does not have to pass these special arguments to call them.
var deferredAddClauses = null;
var addClauses;
if (! _addClausesOverride) {
deferredAddClauses = [];
addClauses = function (clauses, extraTerms) {
deferredAddClauses.push({clauses: clauses,
extraTerms: extraTerms});
};
} else {
addClauses = _addClausesOverride;
}
if (positive && ! info.occursPositively) {
// generate clauses for the formula.
// Eg, if we use variable `X` which represents the formula
// `A v B`, add the clause `A v B v -X`.
// By using the extraTerms argument to addClauses, we avoid
// treating this as a negative occurrence of X.
info.occursPositively = true;
var clauses = self._generateFormula(true, formula);
addClauses(clauses, [-v]);
} else if ((! positive) && ! info.occursNegatively) {
// Eg, if we have the term `-X` where `X` represents the
// formula `A v B`, add the clauses `-A v X` and `-B v X`.
// By using the extraTerms argument to addClauses, we avoid
// treating this as a positive occurrence of X.
info.occursNegatively = true;
var clauses = self._generateFormula(false, formula);
addClauses(clauses, [v]);
}
if (info.occursPositively && info.occursNegatively) {
delete self._ungeneratedFormulas[v];
}
if (! (deferredAddClauses && deferredAddClauses.length)) {
return;
}
var useTerm = function (t) {
self._useFormulaTerm(t, addClauses);
};
// This is the loop that turns recursion into iteration.
// When addClauses calls useTerm, which calls useFormulaTerm,
// the nested useFormulaTerm will add any clauses to our
// own deferredAddClauses list.
while (deferredAddClauses.length) {
var next = deferredAddClauses.pop();
self._addClauses(next.clauses, next.extraTerms, useTerm);
}
};
Logic.Solver.prototype._addClauses = function (array, _extraTerms,
_useTermOverride) {
if (assert) assert(array, isArrayWhere(Logic.isClause));
var self = this;
_.each(array, function (cls) {
self._addClause(cls, _extraTerms, _useTermOverride);
});
};
Logic.Solver.prototype.require = function (/*formulaOrArray, ...*/) {
this._requireForbidImpl(true, _.flatten(arguments));
};
Logic.Solver.prototype.forbid = function (/*formulaOrArray, ...*/) {
this._requireForbidImpl(false, _.flatten(arguments));
};
Logic.Solver.prototype._requireForbidImpl = function (isRequire, formulas) {
var self = this;
if (assert) assert(formulas, isArrayWhere(isFormulaOrTerm));
_.each(formulas, function (f) {
if (f instanceof Logic.NotFormula) {
self._requireForbidImpl(!isRequire, [f.operand]);
} else if (f instanceof Logic.Formula) {
var info = self._getFormulaInfo(f);
if (info.varNum !== null) {
var sign = isRequire ? 1 : -1;
self._addClause(new Logic.Clause(sign*info.varNum));
} else {
self._addClauses(self._generateFormula(isRequire, f));
}
if (isRequire) {
info.isRequired = true;
} else {
info.isForbidden = true;
}
} else {
self._addClauses(self._generateFormula(isRequire, f));
}
});
};
Logic.Solver.prototype._generateFormula = function (isTrue, formula, _termifier) {
var self = this;
if (assert) assert(formula, isFormulaOrTerm);
if (formula instanceof Logic.NotFormula) {
return self._generateFormula(!isTrue, formula.operand);
} else if (formula instanceof Logic.Formula) {
var info = self._getFormulaInfo(formula);
if ((isTrue && info.isRequired) ||
(!isTrue && info.isForbidden)) {
return [];
} else if ((isTrue && info.isForbidden) ||
(!isTrue && info.isRequired)) {
return [new Logic.Clause()]; // never satisfied clause
} else {
var ret = formula.generateClauses(isTrue,
_termifier || self._termifier);
return _.isArray(ret) ? ret : [ret];
}
} else { // Term
var t = self.toNumTerm(formula);
var sign = isTrue ? 1 : -1;
if (t === sign*Logic.NUM_TRUE || t === -sign*Logic.NUM_FALSE) {
return [];
} else if (t === sign*Logic.NUM_FALSE || t === -sign*Logic.NUM_TRUE) {
return [new Logic.Clause()]; // never satisfied clause
} else {
return [new Logic.Clause(sign*t)];
}
}
};
// Get clause data as an array of arrays of integers,
// for testing and debugging purposes.
Logic.Solver.prototype._clauseData = function () {
var clauses = _.pluck(this.clauses, 'terms');
if (! this._T_used) {
clauses.splice(1, 1);
}
if (! this._F_used) {
clauses.splice(0, 1);
}
return clauses;
};
// Get clause data as an array of human-readable strings,
// for testing and debugging purposes.
// A clause might look like "A v -B" (where "v" represents
// and OR operator).
Logic.Solver.prototype._clauseStrings = function () {
var self = this;
var clauseData = self._clauseData();
return _.map(clauseData, function (clause) {
return _.map(clause, function (nterm) {
var str = self.toNameTerm(nterm);
if (/\s/.test(str)) {
// write name in quotes for readability. we don't bother
// making this string machine-parsable in the general case.
var sign = '';
if (str.charAt(0) === '-') {
// temporarily remove '-'
sign = '-';
str = str.slice(1);
}
str = sign + '"' + str + '"';
}
return str;
}).join(' v ');
});
};
Logic.Solver.prototype._getFormulaInfo = function (formula, _noCreate) {
var self = this;
var guid = formula.guid();
if (! self._formulaInfo[guid]) {
if (_noCreate) {
return null;
}
self._formulaInfo[guid] = new FormulaInfo();
}
return self._formulaInfo[guid];
};
// Takes a Formula or an array of Formulas, returns a NumTerm or
// array of NumTerms.
Logic.Solver.prototype._formulaToTerm = function (formula) {
var self = this;
if (_.isArray(formula)) {
if (assert) assert(formula, isArrayWhere(isFormulaOrTerm));
return _.map(formula, _.bind(self._formulaToTerm, self));
} else {
if (assert) assert(formula, isFormulaOrTerm);
}
if (formula instanceof Logic.NotFormula) {
// shortcut that avoids creating a variable called
// something like "$not1" when you use Logic.not(formula).
return Logic.not(self._formulaToTerm(formula.operand));
} else if (formula instanceof Logic.Formula) {
var info = this._getFormulaInfo(formula);
if (info.isRequired) {
return Logic.NUM_TRUE;
} else if (info.isForbidden) {
return Logic.NUM_FALSE;
} else if (info.varNum === null) {
// generate a Solver-local formula variable like "$or1"
var type = formula.type;
if (! this._nextFormulaNumByType[type]) {
this._nextFormulaNumByType[type] = 1;
}
var numForVarName = this._nextFormulaNumByType[type]++;
info.varName = "$" + formula.type + numForVarName;
info.varNum = this.getVarNum(info.varName, false, true);
this._ungeneratedFormulas[info.varNum] = formula;
}
return info.varNum;
} else {
// formula is a Term
return self.toNumTerm(formula);
}
};
Logic.or = function (/*formulaOrArray, ...*/) {
var args = _.flatten(arguments);
if (args.length === 0) {
return Logic.FALSE;
} else if (args.length === 1) {
if (assert) assert(args[0], isFormulaOrTerm);
return args[0];
} else {
return new Logic.OrFormula(args);
}
};
Logic.OrFormula = function (operands) {
if (assert) assert(operands, isArrayWhere(isFormulaOrTerm));
this.operands = operands;
};
Logic._defineFormula(Logic.OrFormula, 'or', {
generateClauses: function (isTrue, t) {
if (isTrue) {
// eg A v B v C
return t.clause(this.operands);
} else {
// eg -A; -B; -C
var result = [];
_.each(this.operands, function (o) {
result.push.apply(result, t.generate(false, o));
});
return result;
}
}
});
Logic.NotFormula = function (operand) {
if (assert) assert(operand, isFormulaOrTerm);
this.operand = operand;
};
// No generation or simplification for 'not'; it is
// simplified away by the solver itself.
Logic._defineFormula(Logic.NotFormula, 'not');
Logic.and = function (/*formulaOrArray, ...*/) {
var args = _.flatten(arguments);
if (args.length === 0) {
return Logic.TRUE;
} else if (args.length === 1) {
if (assert) assert(args[0], isFormulaOrTerm);
return args[0];
} else {
return new Logic.AndFormula(args);
}
};
Logic.AndFormula = function (operands) {
if (assert) assert(operands, isArrayWhere(isFormulaOrTerm));
this.operands = operands;
};
Logic._defineFormula(Logic.AndFormula, 'and', {
generateClauses: function (isTrue, t) {
if (isTrue) {
// eg A; B; C
var result = [];
_.each(this.operands, function (o) {
result.push.apply(result, t.generate(true, o));
});
return result;
} else {
// eg -A v -B v -C
return t.clause(_.map(this.operands, Logic.not));
}
}
});
// Group `array` into groups of N, where the last group
// may be shorter than N. group([a,b,c,d,e], 3) => [[a,b,c],[d,e]]
var group = function (array, N) {
var ret = [];
for (var i = 0; i < array.length; i += N) {
ret.push(array.slice(i, i+N));
}
return ret;
};
Logic.xor = function (/*formulaOrArray, ...*/) {
var args = _.flatten(arguments);
if (args.length === 0) {
return Logic.FALSE;
} else if (args.length === 1) {
if (assert) assert(args[0], isFormulaOrTerm);
return args[0];
} else {
return new Logic.XorFormula(args);
}
};
Logic.XorFormula = function (operands) {
if (assert) assert(operands, isArrayWhere(isFormulaOrTerm));
this.operands = operands;
};
Logic._defineFormula(Logic.XorFormula, 'xor', {
generateClauses: function (isTrue, t) {
var args = this.operands;
var not = Logic.not;
if (args.length > 3) {
return t.generate(
isTrue,
Logic.xor(
_.map(group(this.operands, 3), function (group) {
return Logic.xor(group);
})));
} else if (isTrue) { // args.length <= 3
if (args.length === 0) {
return t.clause(); // always fail
} else if (args.length === 1) {
return t.clause(args[0]);
} else if (args.length === 2) {
var A = args[0], B = args[1];
return [t.clause(A, B), // A v B
t.clause(not(A), not(B))]; // -A v -B
} else if (args.length === 3) {
var A = args[0], B = args[1], C = args[2];
return [t.clause(A, B, C), // A v B v C
t.clause(A, not(B), not(C)), // A v -B v -C
t.clause(not(A), B, not(C)), // -A v B v -C
t.clause(not(A), not(B), C)]; // -A v -B v C
}
} else { // !isTrue, args.length <= 3
if (args.length === 0) {
return []; // always succeed
} else if (args.length === 1) {
return t.clause(not(args[0]));
} else if (args.length === 2) {
var A = args[0], B = args[1];
return [t.clause(A, not(B)), // A v -B
t.clause(not(A), B)]; // -A v B
} else if (args.length === 3) {
var A = args[0], B = args[1], C = args[2];
return [t.clause(not(A), not(B), not(C)), // -A v -B v -C
t.clause(not(A), B, C), // -A v B v C
t.clause(A, not(B), C), // A v -B v C
t.clause(A, B, not(C))]; // A v B v -C
}
}
}
});
Logic.atMostOne = function (/*formulaOrArray, ...*/) {
var args = _.flatten(arguments);
if (args.length <= 1) {
return Logic.TRUE;
} else {
return new Logic.AtMostOneFormula(args);
}
};
Logic.AtMostOneFormula = function (operands) {
if (assert) assert(operands, isArrayWhere(isFormulaOrTerm));
this.operands = operands;
};
Logic._defineFormula(Logic.AtMostOneFormula, 'atMostOne', {
generateClauses: function (isTrue, t) {
var args = this.operands;
var not = Logic.not;
if (args.length <= 1) {
return []; // always succeed
} else if (args.length === 2) {
return t.generate(isTrue, Logic.not(Logic.and(args)));
} else if (isTrue && args.length === 3) {
// Pick any two args; at least one is false (they aren't
// both true). This strategy would also work for
// N>3, and could provide a speed-up by having more clauses
// (N^2) but fewer propagation steps. No speed-up was
// observed on the Sudoku test from using this strategy
// up to N=10.
var clauses = [];
for (var i = 0; i < args.length; i++) {
for (var j = i+1; j < args.length; j++) {
clauses.push(t.clause(not(args[i]), not(args[j])));
}
}
return clauses;
} else if ((! isTrue) && args.length === 3) {
var A = args[0], B = args[1], C = args[2];
// Pick any two args; at least one is true (they aren't
// both false). This only works for N=3.
return [t.clause(A, B), t.clause(A, C), t.clause(B, C)];
} else {
// See the "commander variables" technique from:
// http://www.cs.cmu.edu/~wklieber/papers/2007_efficient-cnf-encoding-for-selecting-1.pdf
// But in short: At most one group has at least one "true",
// and each group has at most one "true". Formula generation
// automatically generates the right implications.
var groups = group(args, 3);
var ors = _.map(groups, function (g) { return Logic.or(g); });
if (groups[groups.length - 1].length < 2) {
// Remove final group of length 1 so we don't generate
// no-op clauses of one sort or another
groups.pop();
}
var atMostOnes = _.map(groups, function (g) {
return Logic.atMostOne(g);
});
return t.generate(isTrue, Logic.and(Logic.atMostOne(ors), atMostOnes));
}
}
});
Logic.implies = function (A, B) {
if (assert) assertNumArgs(arguments.length, 2, "Logic.implies");
return new Logic.ImpliesFormula(A, B);
};
Logic.ImpliesFormula = function (A, B) {
if (assert) assert(A, isFormulaOrTerm);
if (assert) assert(B, isFormulaOrTerm);
if (assert) assertNumArgs(arguments.length, 2, "Logic.implies");
this.A = A;
this.B = B;
};
Logic._defineFormula(Logic.ImpliesFormula, 'implies', {
generateClauses: function (isTrue, t) {
return t.generate(isTrue, Logic.or(Logic.not(this.A), this.B));
}
});
Logic.equiv = function (A, B) {
if (assert) assertNumArgs(arguments.length, 2, "Logic.equiv");
return new Logic.EquivFormula(A, B);
};
Logic.EquivFormula = function (A, B) {
if (assert) assert(A, isFormulaOrTerm);
if (assert) assert(B, isFormulaOrTerm);
if (assert) assertNumArgs(arguments.length, 2, "Logic.equiv");
this.A = A;
this.B = B;
};
Logic._defineFormula(Logic.EquivFormula, 'equiv', {
generateClauses: function (isTrue, t) {
return t.generate(!isTrue, Logic.xor(this.A, this.B));
}
});
Logic.exactlyOne = function (/*formulaOrArray, ...*/) {
var args = _.flatten(arguments);
if (args.length === 0) {
return Logic.FALSE;
} else if (args.length === 1) {
if (assert) assert(args[0], isFormulaOrTerm);
return args[0];
} else {
return new Logic.ExactlyOneFormula(args);
}
};
Logic.ExactlyOneFormula = function (operands) {
if (assert) assert(operands, isArrayWhere(isFormulaOrTerm));
this.operands = operands;
};
Logic._defineFormula(Logic.ExactlyOneFormula, 'exactlyOne', {
generateClauses: function (isTrue, t) {
var args = this.operands;
if (args.length < 3) {
return t.generate(isTrue, Logic.xor(args));
} else {
return t.generate(isTrue, Logic.and(Logic.atMostOne(args),
Logic.or(args)));
}
}
});
// List of 0 or more formulas or terms, which together represent
// a non-negative integer. Least significant bit is first. That is,
// the kth array element has a place value of 2^k.
Logic.Bits = function (formulaArray) {
if (assert) assert(formulaArray, isArrayWhere(isFormulaOrTerm));
this.bits = formulaArray; // public, immutable
};
Logic.constantBits = function (wholeNumber) {
if (assert) assert(wholeNumber, Logic.isWholeNumber);
var result = [];
while (wholeNumber) {
result.push((wholeNumber & 1) ? Logic.TRUE : Logic.FALSE);
wholeNumber >>>= 1;
}
return new Logic.Bits(result);
};
Logic.variableBits = function (baseName, nbits) {
if (assert) assert(nbits, Logic.isWholeNumber);
var result = [];
for (var i = 0; i < nbits; i++) {
result.push(baseName + '$' + i);
}
return new Logic.Bits(result);
};
// bits1 <= bits2
Logic.lessThanOrEqual = function (bits1, bits2) {
return new Logic.LessThanOrEqualFormula(bits1, bits2);
};
Logic.LessThanOrEqualFormula = function (bits1, bits2) {
if (assert) assert(bits1, Logic.isBits);
if (assert) assert(bits2, Logic.isBits);
if (assert) assertNumArgs(arguments.length, 2, "Bits comparison function");
this.bits1 = bits1;
this.bits2 = bits2;
};
var genLTE = function (bits1, bits2, t, notEqual) {
var ret = [];
// clone so we can mutate them in place
var A = bits1.bits.slice();
var B = bits2.bits.slice();
if (notEqual && ! bits2.bits.length) {
// can't be less than 0
return t.clause();
}
// if A is longer than B, the extra (high) bits
// must be 0.
while (A.length > B.length) {
var hi = A.pop();
ret.push(t.clause(Logic.not(hi)));
}
// now B.length >= A.length
// Let xors[i] be (A[i] xor B[i]), or just
// B[i] if A is too short.
var xors = _.map(B, function (b, i) {
if (i < A.length) {
return Logic.xor(A[i], b);
} else {
return b;
}
});
// Suppose we are comparing 3-bit numbers, requiring
// that ABC <= XYZ. Here is what we require:
//
// * It is false that A=1 and X=0.
// * It is false that A=X, B=1, and Y=0.
// * It is false that A=X, B=Y, C=1, and Y=0.
//
// Translating these into clauses using DeMorgan's law:
//
// * A=0 or X=1
// * (A xor X) or B=0 or Y=1
// * (A xor X) or (B xor Y) or C=0 or Y=1
//
// Since our arguments are LSB first, in the example
// we would be given [C, B, A] and [Z, Y, X] as input.
// We iterate over the first argument starting from
// the right, and build up a clause by iterating over
// the xors from the right.
//
// If we have ABC <= VWXYZ, then we still have three clauses,
// but each one is prefixed with "V or W or", because V and W
// are at the end of the xors array. This is equivalent to
// padding ABC with two zeros.
for (var i = A.length-1; i >= 0; i--) {
ret.push(t.clause(xors.slice(i+1), Logic.not(A[i]), B[i]));
}
if (notEqual) {
ret.push.apply(ret, t.generate(true, Logic.or(xors)));
}
return ret;
};
Logic._defineFormula(Logic.LessThanOrEqualFormula, 'lte', {
generateClauses: function (isTrue, t) {
if (isTrue) {
// bits1 <= bits2
return genLTE(this.bits1, this.bits2, t, false);
} else {
// bits2 < bits1
return genLTE(this.bits2, this.bits1, t, true);
}
}
});
// bits1 < bits2
Logic.lessThan = function (bits1, bits2) {
return new Logic.LessThanFormula(bits1, bits2);
};
Logic.LessThanFormula = function (bits1, bits2) {
if (assert) assert(bits1, Logic.isBits);
if (assert) assert(bits2, Logic.isBits);
if (assert) assertNumArgs(arguments.length, 2, "Bits comparison function");
this.bits1 = bits1;
this.bits2 = bits2;
};
Logic._defineFormula(Logic.LessThanFormula, 'lt', {
generateClauses: function (isTrue, t) {
if (isTrue) {
// bits1 < bits2
return genLTE(this.bits1, this.bits2, t, true);
} else {
// bits2 <= bits1
return genLTE(this.bits2, this.bits1, t, false);
}
}
});
Logic.greaterThan = function (bits1, bits2) {
return Logic.lessThan(bits2, bits1);
};
Logic.greaterThanOrEqual = function (bits1, bits2) {
return Logic.lessThanOrEqual(bits2, bits1);
};
Logic.equalBits = function (bits1, bits2) {
return new Logic.EqualBitsFormula(bits1, bits2);
};
Logic.EqualBitsFormula = function (bits1, bits2) {
if (assert) assert(bits1, Logic.isBits);
if (assert) assert(bits2, Logic.isBits);
if (assert) assertNumArgs(arguments.length, 2, "Logic.equalBits");
this.bits1 = bits1;
this.bits2 = bits2;
};
Logic._defineFormula(Logic.EqualBitsFormula, 'equalBits', {
generateClauses: function (isTrue, t) {
var A = this.bits1.bits;
var B = this.bits2.bits;
var nbits = Math.max(A.length, B.length);
var facts = [];
for (var i = 0; i < nbits; i++) {
if (i >= A.length) {
facts.push(Logic.not(B[i]));
} else if (i >= B.length) {
facts.push(Logic.not(A[i]));
} else {
facts.push(Logic.equiv(A[i], B[i]));
}
}
return t.generate(isTrue, Logic.and(facts));
}
});
// Definition of full-adder and half-adder:
//
// A full-adder is a 3-input, 2-output gate producing the sum of its
// inputs as a 2-bit binary number. The most significant bit is called
// "carry", the least significant "sum". A half-adder does the same
// thing, but has only 2 inputs (and can therefore never output a
// "3").
//
// The half-adder sum bit is really just an XOR, and the carry bit
// is really just an AND. However, they get their own formula types
// here to enhance readability of the generated clauses.
Logic.HalfAdderSum = function (formula1, formula2) {
if (assert) assert(formula1, isFormulaOrTerm);
if (assert) assert(formula2, isFormulaOrTerm);
if (assert) assertNumArgs(arguments.length, 2, "Logic.HalfAdderSum");
this.a = formula1;
this.b = formula2;
};
Logic._defineFormula(Logic.HalfAdderSum, 'hsum', {
generateClauses: function (isTrue, t) {
return t.generate(isTrue, Logic.xor(this.a, this.b));
}
});
Logic.HalfAdderCarry = function (formula1, formula2) {
if (assert) assert(formula1, isFormulaOrTerm);
if (assert) assert(formula2, isFormulaOrTerm);
if (assert) assertNumArgs(arguments.length, 2, "Logic.HalfAdderCarry");
this.a = formula1;
this.b = formula2;
};
Logic._defineFormula(Logic.HalfAdderCarry, 'hcarry', {
generateClauses: function (isTrue, t) {
return t.generate(isTrue, Logic.and(this.a, this.b));
}
});
Logic.FullAdderSum = function (formula1, formula2, formula3) {
if (assert) assert(formula1, isFormulaOrTerm);
if (assert) assert(formula2, isFormulaOrTerm);
if (assert) assert(formula3, isFormulaOrTerm);
if (assert) assertNumArgs(arguments.length, 3, "Logic.FullAdderSum");
this.a = formula1;
this.b = formula2;
this.c = formula3;
};
Logic._defineFormula(Logic.FullAdderSum, 'fsum', {
generateClauses: function (isTrue, t) {
return t.generate(isTrue, Logic.xor(this.a, this.b, this.c));
}
});
Logic.FullAdderCarry = function (formula1, formula2, formula3) {
if (assert) assert(formula1, isFormulaOrTerm);
if (assert) assert(formula2, isFormulaOrTerm);
if (assert) assert(formula3, isFormulaOrTerm);
if (assert) assertNumArgs(arguments.length, 3, "Logic.FullAdderCarry");
this.a = formula1;
this.b = formula2;
this.c = formula3;
};
Logic._defineFormula(Logic.FullAdderCarry, 'fcarry', {
generateClauses: function (isTrue, t) {
return t.generate(! isTrue,
Logic.atMostOne(this.a, this.b, this.c));
}
});
// Implements the Adder strategy from the MiniSat+ paper:
// http://minisat.se/downloads/MiniSat+.pdf
// "Translating Pseudo-boolean Constraints into SAT"
//
// Takes a list of list of Formulas. The first list is bits
// to give weight 1; the second is bits to give weight 2;
// the third is bits to give weight 4; and so on.
//
// Returns an array of Logic.FormulaOrTerm.
var binaryWeightedSum = function (varsByWeight) {
if (assert) assert(varsByWeight,
isArrayWhere(isArrayWhere(isFormulaOrTerm)));
// initialize buckets to a two-level clone of varsByWeight
var buckets = _.map(varsByWeight, _.clone);
var lowestWeight = 0; // index of the first non-empty array
var output = [];
while (lowestWeight < buckets.length) {
var bucket = buckets[lowestWeight];
if (! bucket.length) {
output.push(Logic.FALSE);
lowestWeight++;
} else if (bucket.length === 1) {
output.push(bucket[0]);
lowestWeight++;
} else if (bucket.length === 2) {
var sum = new Logic.HalfAdderSum(bucket[0], bucket[1]);
var carry = new Logic.HalfAdderCarry(bucket[0], bucket[1]);
bucket.length = 0;
bucket.push(sum);
pushToNth(buckets, lowestWeight+1, carry);
} else {
// Whether we take variables from the start or end of the
// bucket (i.e. `pop` or `shift`) determines the shape of the tree.
// Empirically, some logic problems are faster with `shift` (2x or so),
// but `pop` gives an order-of-magnitude speed-up on the Meteor Version
// Solver "benchmark-tests" suite (Slava's benchmarks based on data from
// Rails). So, `pop` it is.
var c = bucket.pop();
var b = bucket.pop();
var a = bucket.pop();
var sum = new Logic.FullAdderSum(a, b, c);
var carry = new Logic.FullAdderCarry(a, b, c);
bucket.push(sum);
pushToNth(buckets, lowestWeight+1, carry);
}
}
return output;
};
// Push `newItem` onto the array at arrayOfArrays[n],
// first ensuring that it exists by pushing empty
// arrays onto arrayOfArrays.
var pushToNth = function (arrayOfArrays, n, newItem) {
while (n >= arrayOfArrays.length) {
arrayOfArrays.push([]);
}
arrayOfArrays[n].push(newItem);
};
var checkWeightedSumArgs = function (formulas, weights) {
if (assert) assert(formulas, isArrayWhere(isFormulaOrTerm));
if (typeof weights === 'number') {
if (assert) assert(weights, Logic.isWholeNumber);
} else {
if (assert) assert(weights, isArrayWhere(Logic.isWholeNumber));
if (formulas.length !== weights.length) {
throw new Error("Formula array and weight array must be same length" +
"; they are " + formulas.length + " and " + weights.length);
}
}
};
Logic.weightedSum = function (formulas, weights) {
checkWeightedSumArgs(formulas, weights);
if (formulas.length === 0) {
return new Logic.Bits([]);
}
if (typeof weights === 'number') {
weights = _.map(formulas, function () { return weights; });
}
var binaryWeighted = [];
_.each(formulas, function (f, i) {
var w = weights[i];
var whichBit = 0;
while (w) {
if (w & 1) {
pushToNth(binaryWeighted, whichBit, f);
}
w >>>= 1;
whichBit++;
}
});
return new Logic.Bits(binaryWeightedSum(binaryWeighted));
};
Logic.sum = function (/*formulaOrBitsOrArray, ...*/) {
var things = _.flatten(arguments);
if (assert) assert(things, isArrayWhere(isFormulaOrTermOrBits));
var binaryWeighted = [];
_.each(things, function (x) {
if (x instanceof Logic.Bits) {
_.each(x.bits, function (b, i) {
pushToNth(binaryWeighted, i, b);
});
} else {
pushToNth(binaryWeighted, 0, x);
}
});
return new Logic.Bits(binaryWeightedSum(binaryWeighted));
};
////////////////////////////////////////
Logic.Solver.prototype.solve = function (_assumpVar) {
var self = this;
if (_assumpVar !== undefined) {
if (! (_assumpVar >= 1)) {
throw new Error("_assumpVar must be a variable number");
}
}
if (self._unsat) {
return null;
}
while (self._numClausesAddedToMiniSat < self.clauses.length) {
var i = self._numClausesAddedToMiniSat;
var stillSat = self._minisat.addClause(self.clauses[i].terms);
self._numClausesAddedToMiniSat++;
if (! stillSat) {
self._unsat = true;
return null;
}
}
self._minisat.ensureVar(this._num2name.length - 1);
var stillSat = (_assumpVar ?
self._minisat.solveAssuming(_assumpVar) :
self._minisat.solve());
if (! stillSat) {
if (! _assumpVar) {
self._unsat = true;
}
return null;
}
return new Logic.Solution(self, self._minisat.getSolution());
};
Logic.Solver.prototype.solveAssuming = function (formula) {
if (assert) assert(formula, isFormulaOrTerm);
// Wrap the formula in a formula of type Assumption, so that
// we always generate a var like `$assump123`, regardless
// of whether `formula` is a Term, a NotFormula, an already
// required or forbidden Formula, etc.
var assump = new Logic.Assumption(formula);
var assumpVar = this._formulaToTerm(assump);
if (! (typeof assumpVar === 'number' && assumpVar > 0)) {
throw new Error("Assertion failure: not a positive numeric term");
}
// Generate clauses as if we used the assumption variable in a
// clause, in the positive. So if we assume "A v B", we might get a
// clause like "A v B v -$assump123" (or actually, "$or1 v
// -$assump123"), as if we had used $assump123 in a clause. Instead
// of using it in a clause, though, we temporarily assume it to be
// true.
this._useFormulaTerm(assumpVar);
var result = this.solve(assumpVar);
// Tell MiniSat that we will never use assumpVar again.
// The formula may be used again, however. (For example, you
// can solve assuming a formula F, and if it works, require F.)
this._minisat.retireVar(assumpVar);
return result;
};
Logic.Assumption = function (formula) {
if (assert) assert(formula, isFormulaOrTerm);
this.formula = formula;
};
Logic._defineFormula(Logic.Assumption, 'assump', {
generateClauses: function (isTrue, t) {
if (isTrue) {
return t.clause(this.formula);
} else {
return t.clause(Logic.not(this.formula));
}
}
});
Logic.Solution = function (_solver, _assignment) {
var self = this;
self._solver = _solver;
self._assignment = _assignment;
// save a snapshot of which formulas have variables designated
// for them, but where we haven't generated clauses that constrain
// those variables in both the positive and the negative direction.
self._ungeneratedFormulas = _.clone(_solver._ungeneratedFormulas);
self._formulaValueCache = {};
self._termifier = new Logic.Termifier(self._solver);
// Normally, when a Formula uses a Termifier to generate clauses that
// refer to other Formulas, the Termifier replaces the Formulas with
// their variables. We hijack this mechanism to replace the Formulas
// with their truth variables instead, leading to recursive evaluation.
// Note that we cache the evaluated truth values of Formulas to avoid
// redundant evaluation.
self._termifier.term = function (formula) {
return self.evaluate(formula) ? Logic.NUM_TRUE : Logic.NUM_FALSE;
};
// When true, evaluation doesn't throw errors when
// `evaluate` or `getWeightedSum` encounter named variables that are
// unknown or variables that weren't present when this Solution was
// generated. Instead, the unknown variables are assumed to be false.
self._ignoreUnknownVariables = false;
};
Logic.Solution.prototype.ignoreUnknownVariables = function () {
// We only make this settable one way (false to true).
// Setting it back and forth would be questionable, since we keep
// a cache of Formula evaluations.
this._ignoreUnknownVariables = true;
};
// Get a map of variables to their assignments,
// such as `{A: true, B: false, C: true}`.
// Internal variables are excluded.
Logic.Solution.prototype.getMap = function () {
var solver = this._solver;
var assignment = this._assignment;
var result = {};
for (var i = 1; i < assignment.length; i++) {
var name = solver.getVarName(i);
if (name && name.charAt(0) !== '$') {
result[name] = assignment[i];
}
}
return result;
};
// Get an array of variables that are assigned
// `true` by this solution, sorted by name.
// Internal variables are excluded.
Logic.Solution.prototype.getTrueVars = function () {
var solver = this._solver;
var assignment = this._assignment;
var result = [];
for (var i = 1; i < assignment.length; i++) {
if (assignment[i]) {
var name = solver.getVarName(i);
if (name && name.charAt(0) !== '$') {
result.push(name);
}
}
}
result.sort();
return result;
};
// Get a Formula that says that the variables are assigned
// according to this solution. (Internal variables are
// excluded.) By forbidding this Formula and solving again,
// you can see if there are other solutions.
Logic.Solution.prototype.getFormula = function () {
var solver = this._solver;
var assignment = this._assignment;
var terms = [];
for (var i = 1; i < assignment.length; i++) {
var name = solver.getVarName(i);
if (name && name.charAt(0) !== '$') {
terms.push(assignment[i] ? i : -i);
}
}
return Logic.and(terms);
};
// Returns a boolean if the argument is a Formula (or Term), and an integer
// if the argument is a Logic.Bits.
Logic.Solution.prototype.evaluate = function (formulaOrBits) {
var self = this;
if (assert) assert(formulaOrBits, isFormulaOrTermOrBits);
if (formulaOrBits instanceof Logic.Bits) {
// Evaluate to an integer
var ret = 0;
_.each(formulaOrBits.bits, function (f, i) {
if (self.evaluate(f)) {
ret += 1 << i;
}
});
return ret;
}
var solver = self._solver;
var ignoreUnknownVariables = self._ignoreUnknownVariables;
var assignment = self._assignment;
var formula = formulaOrBits;
if (formula instanceof Logic.NotFormula) {
return ! self.evaluate(formula.operand);
} else if (formula instanceof Logic.Formula) {
var cachedResult = self._formulaValueCache[formula.guid()];
if (typeof cachedResult === 'boolean') {
return cachedResult;
} else {
var value;
var info = solver._getFormulaInfo(formula, true);
if (info && info.varNum && info.varNum < assignment.length &&
! _.has(self._ungeneratedFormulas, info.varNum)) {
// as an optimization, read the value of the formula directly
// from a variable if the formula's clauses were completely
// generated at the time of solving. (We must be careful,
// because if we didn't generate both the positive and the
// negative polarity clauses for the formula, then the formula
// variable is not actually constrained to have the right
// value.)
value = assignment[info.varNum];
} else {
var clauses = solver._generateFormula(true, formula, self._termifier);
var value = _.all(clauses, function (cls) {
return _.any(cls.terms, function (t) {
return self.evaluate(t);
});
});
}
self._formulaValueCache[formula.guid()] = value;
return value;
}
} else {
// Term; convert to numeric (possibly negative), but throw
// an error if the name is not found. If `ignoreUnknownVariables`
// is set, return false instead.
var numTerm = solver.toNumTerm(formula, true);
if (! numTerm) {
if (ignoreUnknownVariables) {
return false;
} else {
// formula must be a NameTerm naming a variable that doesn't exist
var vname = String(formula).replace(/^-*/, '');
throw new Error("No such variable: " + vname);
}
}
var v = numTerm;
var isNot = false;
if (numTerm < 0) {
v = -v;
isNot = true;
}
if (v < 1 || v >= assignment.length) {
var vname = v;
if (v >= 1 && v < solver._num2name.length) {
vname = solver._num2name[v];
}
if (ignoreUnknownVariables) {
return false;
} else {
throw new Error("Variable not part of solution: " + vname);
}
}
var ret = assignment[v];
if (isNot) {
ret = ! ret;
}
return ret;
}
};
Logic.Solution.prototype.getWeightedSum = function (formulas, weights) {
checkWeightedSumArgs(formulas, weights);
var total = 0;
if (typeof weights === 'number') {
for (var i = 0; i < formulas.length; i++) {
total += weights * (this.evaluate(formulas[i]) ? 1 : 0);
}
} else {
for (var i = 0; i < formulas.length; i++) {
total += weights[i] * (this.evaluate(formulas[i]) ? 1 : 0);
}
}
return total;
};
| lorensr/meteor | packages/logic-solver/logic.js | JavaScript | mit | 52,306 |
//
// Licensed under the terms in License.txt
//
// Copyright 2010 Allen Ding. All rights reserved.
//
#import "KWMessagePattern.h"
#import "KWFormatter.h"
#import "KWNull.h"
#import "KWObjCUtilities.h"
#import "KWValue.h"
#import "NSInvocation+KiwiAdditions.h"
#import "NSMethodSignature+KiwiAdditions.h"
#import "KWGenericMatchEvaluator.h"
#import "Kiwi.h"
@implementation KWMessagePattern
#pragma mark - Initializing
- (id)initWithSelector:(SEL)aSelector {
return [self initWithSelector:aSelector argumentFilters:nil];
}
- (id)initWithSelector:(SEL)aSelector argumentFilters:(NSArray *)anArray {
self = [super init];
if (self) {
selector = aSelector;
if ([anArray count] > 0)
argumentFilters = [anArray copy];
}
return self;
}
- (id)initWithSelector:(SEL)aSelector firstArgumentFilter:(id)firstArgumentFilter argumentList:(va_list)argumentList {
NSUInteger count = KWSelectorParameterCount(aSelector);
NSMutableArray *array = [NSMutableArray arrayWithCapacity:count];
[array addObject:(firstArgumentFilter != nil) ? firstArgumentFilter : [KWNull null]];
for (NSUInteger i = 1; i < count; ++i)
{
id object = va_arg(argumentList, id);
[array addObject:(object != nil) ? object : [KWNull null]];
}
va_end(argumentList);
return [self initWithSelector:aSelector argumentFilters:array];
}
+ (id)messagePatternWithSelector:(SEL)aSelector {
return [self messagePatternWithSelector:aSelector argumentFilters:nil];
}
+ (id)messagePatternWithSelector:(SEL)aSelector argumentFilters:(NSArray *)anArray {
return [[self alloc] initWithSelector:aSelector argumentFilters:anArray];
}
+ (id)messagePatternWithSelector:(SEL)aSelector firstArgumentFilter:(id)firstArgumentFilter argumentList:(va_list)argumentList {
return [[self alloc] initWithSelector:aSelector firstArgumentFilter:firstArgumentFilter argumentList:argumentList];
}
+ (id)messagePatternFromInvocation:(NSInvocation *)anInvocation {
NSMethodSignature *signature = [anInvocation methodSignature];
NSUInteger numberOfMessageArguments = [signature numberOfMessageArguments];
NSMutableArray *argumentFilters = nil;
if (numberOfMessageArguments > 0) {
argumentFilters = [[NSMutableArray alloc] initWithCapacity:numberOfMessageArguments];
for (NSUInteger i = 0; i < numberOfMessageArguments; ++i) {
const char *type = [signature messageArgumentTypeAtIndex:i];
void* argumentDataBuffer = malloc(KWObjCTypeLength(type));
[anInvocation getMessageArgument:argumentDataBuffer atIndex:i];
id object = nil;
if(*(__unsafe_unretained id*)argumentDataBuffer != [KWAny any] && !KWObjCTypeIsObject(type)) {
NSData *data = [anInvocation messageArgumentDataAtIndex:i];
object = [KWValue valueWithBytes:[data bytes] objCType:type];
} else {
object = *(__unsafe_unretained id*)argumentDataBuffer;
if (object != [KWAny any] && KWObjCTypeIsBlock(type)) {
object = [object copy]; // Converting NSStackBlock to NSMallocBlock
}
}
[argumentFilters addObject:(object != nil) ? object : [KWNull null]];
free(argumentDataBuffer);
}
}
return [self messagePatternWithSelector:[anInvocation selector] argumentFilters:argumentFilters];
}
#pragma mark - Properties
@synthesize selector;
@synthesize argumentFilters;
#pragma mark - Matching Invocations
- (BOOL)argumentFiltersMatchInvocationArguments:(NSInvocation *)anInvocation {
if (self.argumentFilters == nil)
return YES;
NSMethodSignature *signature = [anInvocation methodSignature];
NSUInteger numberOfArgumentFilters = [self.argumentFilters count];
NSUInteger numberOfMessageArguments = [signature numberOfMessageArguments];
for (NSUInteger i = 0; i < numberOfMessageArguments && i < numberOfArgumentFilters; ++i) {
const char *objCType = [signature messageArgumentTypeAtIndex:i];
id __autoreleasing object = nil;
// Extract message argument into object (wrapping values if neccesary)
if (KWObjCTypeIsObject(objCType) || KWObjCTypeIsClass(objCType)) {
[anInvocation getMessageArgument:&object atIndex:i];
} else {
NSData *data = [anInvocation messageArgumentDataAtIndex:i];
object = [KWValue valueWithBytes:[data bytes] objCType:objCType];
}
// Match argument filter to object
id argumentFilter = (self.argumentFilters)[i];
if ([argumentFilter isEqual:[KWAny any]]) {
continue;
}
if ([KWGenericMatchEvaluator isGenericMatcher:argumentFilter]) {
id matcher = argumentFilter;
if ([object isKindOfClass:[KWValue class]] && [object isNumeric]) {
NSNumber *number = [object numberValue];
if (![KWGenericMatchEvaluator genericMatcher:matcher matches:number]) {
return NO;
}
} else if (![KWGenericMatchEvaluator genericMatcher:matcher matches:object]) {
return NO;
}
} else if ([argumentFilter isEqual:[KWNull null]]) {
if (!KWObjCTypeIsPointerLike(objCType)) {
[NSException raise:@"KWMessagePatternException" format:@"nil was specified as an argument filter, but argument(%d) is not a pointer for @selector(%@)", (int)(i + 1), NSStringFromSelector([anInvocation selector])];
}
void *p = nil;
[anInvocation getMessageArgument:&p atIndex:i];
if (p != nil)
return NO;
} else if (![argumentFilter isEqual:object]) {
return NO;
}
}
return YES;
}
- (BOOL)matchesInvocation:(NSInvocation *)anInvocation {
return self.selector == [anInvocation selector] && [self argumentFiltersMatchInvocationArguments:anInvocation];
}
#pragma mark - Comparing Message Patterns
- (NSUInteger)hash {
return [NSStringFromSelector(self.selector) hash];
}
- (BOOL)isEqual:(id)object {
if (![object isKindOfClass:[KWMessagePattern class]])
return NO;
return [self isEqualToMessagePattern:object];
}
- (BOOL)isEqualToMessagePattern:(KWMessagePattern *)aMessagePattern {
if (self.selector != aMessagePattern.selector)
return NO;
if (self.argumentFilters == nil && aMessagePattern.argumentFilters == nil)
return YES;
return [self.argumentFilters isEqualToArray:aMessagePattern.argumentFilters];
}
#pragma mark - Retrieving String Representations
- (NSString *)selectorString {
return NSStringFromSelector(self.selector);
}
- (NSString *)selectorAndArgumentFiltersString {
NSMutableString *description = [[NSMutableString alloc] init];
NSArray *components = [NSStringFromSelector(self.selector) componentsSeparatedByString:@":"];
NSUInteger count = [components count] - 1;
for (NSUInteger i = 0; i < count; ++i) {
NSString *selectorComponent = components[i];
NSString *argumentFilterString = [KWFormatter formatObject:(self.argumentFilters)[i]];
[description appendFormat:@"%@:%@ ", selectorComponent, argumentFilterString];
}
return description;
}
- (NSString *)stringValue {
if (self.argumentFilters == nil)
return [self selectorString];
else
return [self selectorAndArgumentFiltersString];
}
#pragma mark - Debugging
- (NSString *)description {
return [NSString stringWithFormat:@"selector: %@\nargumentFilters: %@",
NSStringFromSelector(self.selector),
self.argumentFilters];
}
@end
| Codedazur/pdf-reader-ios | Example/Pods/Kiwi/Classes/Core/KWMessagePattern.m | Matlab | mit | 7,661 |
/*
* Copyright 2011 Twitter, 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.
*/
// A wrapper for compatibility with Mustache.js, quirks and all
var Hogan = {};
(function (Hogan, useArrayBuffer) {
Hogan.Template = function (renderFunc, text, compiler, options) {
this.r = renderFunc || this.r;
this.c = compiler;
this.options = options;
this.text = text || '';
this.buf = (useArrayBuffer) ? [] : '';
}
Hogan.Template.prototype = {
// render: replaced by generated code.
r: function (context, partials, indent) { return ''; },
// variable escaping
v: hoganEscape,
// triple stache
t: coerceToString,
render: function render(context, partials, indent) {
return this.ri([context], partials || {}, indent);
},
// render internal -- a hook for overrides that catches partials too
ri: function (context, partials, indent) {
return this.r(context, partials, indent);
},
// tries to find a partial in the curent scope and render it
rp: function(name, context, partials, indent) {
var partial = partials[name];
if (!partial) {
return '';
}
if (this.c && typeof partial == 'string') {
partial = this.c.compile(partial, this.options);
}
return partial.ri(context, partials, indent);
},
// render a section
rs: function(context, partials, section) {
var tail = context[context.length - 1];
if (!isArray(tail)) {
section(context, partials, this);
return;
}
for (var i = 0; i < tail.length; i++) {
context.push(tail[i]);
section(context, partials, this);
context.pop();
}
},
// maybe start a section
s: function(val, ctx, partials, inverted, start, end, tags) {
var pass;
if (isArray(val) && val.length === 0) {
return false;
}
if (typeof val == 'function') {
val = this.ls(val, ctx, partials, inverted, start, end, tags);
}
pass = (val === '') || !!val;
if (!inverted && pass && ctx) {
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
}
return pass;
},
// find values with dotted names
d: function(key, ctx, partials, returnFound) {
var names = key.split('.'),
val = this.f(names[0], ctx, partials, returnFound),
cx = null;
if (key === '.' && isArray(ctx[ctx.length - 2])) {
return ctx[ctx.length - 1];
}
for (var i = 1; i < names.length; i++) {
if (val && typeof val == 'object' && names[i] in val) {
cx = val;
val = val[names[i]];
} else {
val = '';
}
}
if (returnFound && !val) {
return false;
}
if (!returnFound && typeof val == 'function') {
ctx.push(cx);
val = this.lv(val, ctx, partials);
ctx.pop();
}
return val;
},
// find values with normal names
f: function(key, ctx, partials, returnFound) {
var val = false,
v = null,
found = false;
for (var i = ctx.length - 1; i >= 0; i--) {
v = ctx[i];
if (v && typeof v == 'object' && key in v) {
val = v[key];
found = true;
break;
}
}
if (!found) {
return (returnFound) ? false : "";
}
if (!returnFound && typeof val == 'function') {
val = this.lv(val, ctx, partials);
}
return val;
},
// higher order templates
ho: function(val, cx, partials, text, tags) {
var compiler = this.c;
var options = this.options;
options.delimiters = tags;
var t = val.call(cx, text, function(t) {
return compiler.compile(t, options).render(cx, partials);
});
this.b(compiler.compile(t.toString(), options).render(cx, partials));
return false;
},
// template result buffering
b: (useArrayBuffer) ? function(s) { this.buf.push(s); } :
function(s) { this.buf += s; },
fl: (useArrayBuffer) ? function() { var r = this.buf.join(''); this.buf = []; return r; } :
function() { var r = this.buf; this.buf = ''; return r; },
// lambda replace section
ls: function(val, ctx, partials, inverted, start, end, tags) {
var cx = ctx[ctx.length - 1],
t = null;
if (!inverted && this.c && val.length > 0) {
return this.ho(val, cx, partials, this.text.substring(start, end), tags);
}
t = val.call(cx);
if (typeof t == 'function') {
if (inverted) {
return true;
} else if (this.c) {
return this.ho(t, cx, partials, this.text.substring(start, end), tags);
}
}
return t;
},
// lambda replace variable
lv: function(val, ctx, partials) {
var cx = ctx[ctx.length - 1];
var result = val.call(cx);
if (typeof result == 'function') {
result = result.call(cx);
}
result = coerceToString(result);
if (this.c && ~result.indexOf("{\u007B")) {
return this.c.compile(result, this.options).render(cx, partials);
}
return result;
}
};
var rAmp = /&/g,
rLt = /</g,
rGt = />/g,
rApos =/\'/g,
rQuot = /\"/g,
hChars =/[&<>\"\']/;
function coerceToString(val) {
return String((val === null || val === undefined) ? '' : val);
}
function hoganEscape(str) {
str = coerceToString(str);
return hChars.test(str) ?
str
.replace(rAmp,'&')
.replace(rLt,'<')
.replace(rGt,'>')
.replace(rApos,''')
.replace(rQuot, '"') :
str;
}
var isArray = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
};
})(typeof exports !== 'undefined' ? exports : Hogan);
(function (Hogan) {
// Setup regex assignments
// remove whitespace according to Mustache spec
var rIsWhitespace = /\S/,
rQuot = /\"/g,
rNewline = /\n/g,
rCr = /\r/g,
rSlash = /\\/g,
tagTypes = {
'#': 1, '^': 2, '/': 3, '!': 4, '>': 5,
'<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
};
Hogan.scan = function scan(text, delimiters) {
var len = text.length,
IN_TEXT = 0,
IN_TAG_TYPE = 1,
IN_TAG = 2,
state = IN_TEXT,
tagType = null,
tag = null,
buf = '',
tokens = [],
seenTag = false,
i = 0,
lineStart = 0,
otag = '{{',
ctag = '}}';
function addBuf() {
if (buf.length > 0) {
tokens.push(new String(buf));
buf = '';
}
}
function lineIsWhitespace() {
var isAllWhitespace = true;
for (var j = lineStart; j < tokens.length; j++) {
isAllWhitespace =
(tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
(!tokens[j].tag && tokens[j].match(rIsWhitespace) === null);
if (!isAllWhitespace) {
return false;
}
}
return isAllWhitespace;
}
function filterLine(haveSeenTag, noNewLine) {
addBuf();
if (haveSeenTag && lineIsWhitespace()) {
for (var j = lineStart, next; j < tokens.length; j++) {
if (!tokens[j].tag) {
if ((next = tokens[j+1]) && next.tag == '>') {
// set indent to token value
next.indent = tokens[j].toString()
}
tokens.splice(j, 1);
}
}
} else if (!noNewLine) {
tokens.push({tag:'\n'});
}
seenTag = false;
lineStart = tokens.length;
}
function changeDelimiters(text, index) {
var close = '=' + ctag,
closeIndex = text.indexOf(close, index),
delimiters = trim(
text.substring(text.indexOf('=', index) + 1, closeIndex)
).split(' ');
otag = delimiters[0];
ctag = delimiters[1];
return closeIndex + close.length - 1;
}
if (delimiters) {
delimiters = delimiters.split(' ');
otag = delimiters[0];
ctag = delimiters[1];
}
for (i = 0; i < len; i++) {
if (state == IN_TEXT) {
if (tagChange(otag, text, i)) {
--i;
addBuf();
state = IN_TAG_TYPE;
} else {
if (text.charAt(i) == '\n') {
filterLine(seenTag);
} else {
buf += text.charAt(i);
}
}
} else if (state == IN_TAG_TYPE) {
i += otag.length - 1;
tag = tagTypes[text.charAt(i + 1)];
tagType = tag ? text.charAt(i + 1) : '_v';
if (tagType == '=') {
i = changeDelimiters(text, i);
state = IN_TEXT;
} else {
if (tag) {
i++;
}
state = IN_TAG;
}
seenTag = i;
} else {
if (tagChange(ctag, text, i)) {
tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
buf = '';
i += ctag.length - 1;
state = IN_TEXT;
if (tagType == '{') {
if (ctag == '}}') {
i++;
} else {
cleanTripleStache(tokens[tokens.length - 1]);
}
}
} else {
buf += text.charAt(i);
}
}
}
filterLine(seenTag, true);
return tokens;
}
function cleanTripleStache(token) {
if (token.n.substr(token.n.length - 1) === '}') {
token.n = token.n.substring(0, token.n.length - 1);
}
}
function trim(s) {
if (s.trim) {
return s.trim();
}
return s.replace(/^\s*|\s*$/g, '');
}
function tagChange(tag, text, index) {
if (text.charAt(index) != tag.charAt(0)) {
return false;
}
for (var i = 1, l = tag.length; i < l; i++) {
if (text.charAt(index + i) != tag.charAt(i)) {
return false;
}
}
return true;
}
function buildTree(tokens, kind, stack, customTags) {
var instructions = [],
opener = null,
token = null;
while (tokens.length > 0) {
token = tokens.shift();
if (token.tag == '#' || token.tag == '^' || isOpener(token, customTags)) {
stack.push(token);
token.nodes = buildTree(tokens, token.tag, stack, customTags);
instructions.push(token);
} else if (token.tag == '/') {
if (stack.length === 0) {
throw new Error('Closing tag without opener: /' + token.n);
}
opener = stack.pop();
if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
}
opener.end = token.i;
return instructions;
} else {
instructions.push(token);
}
}
if (stack.length > 0) {
throw new Error('missing closing tag: ' + stack.pop().n);
}
return instructions;
}
function isOpener(token, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].o == token.n) {
token.tag = '#';
return true;
}
}
}
function isCloser(close, open, tags) {
for (var i = 0, l = tags.length; i < l; i++) {
if (tags[i].c == close && tags[i].o == open) {
return true;
}
}
}
function writeCode(tree) {
return 'var _=this;_.b(i=i||"");' + walk(tree) + 'return _.fl();';
}
Hogan.generate = function (code, text, options) {
if (options.asString) {
return 'function(c,p,i){' + code + ';}';
}
return new Hogan.Template(new Function('c', 'p', 'i', code), text, Hogan, options);
}
function esc(s) {
return s.replace(rSlash, '\\\\')
.replace(rQuot, '\\\"')
.replace(rNewline, '\\n')
.replace(rCr, '\\r');
}
function chooseMethod(s) {
return (~s.indexOf('.')) ? 'd' : 'f';
}
function walk(tree) {
var code = '';
for (var i = 0, l = tree.length; i < l; i++) {
var tag = tree[i].tag;
if (tag == '#') {
code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
tree[i].i, tree[i].end, tree[i].otag + " " + tree[i].ctag);
} else if (tag == '^') {
code += invertedSection(tree[i].nodes, tree[i].n,
chooseMethod(tree[i].n));
} else if (tag == '<' || tag == '>') {
code += partial(tree[i]);
} else if (tag == '{' || tag == '&') {
code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
} else if (tag == '\n') {
code += text('"\\n"' + (tree.length-1 == i ? '' : ' + i'));
} else if (tag == '_v') {
code += variable(tree[i].n, chooseMethod(tree[i].n));
} else if (tag === undefined) {
code += text('"' + esc(tree[i]) + '"');
}
}
return code;
}
function section(nodes, id, method, start, end, tags) {
return 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),' +
'c,p,0,' + start + ',' + end + ',"' + tags + '")){' +
'_.rs(c,p,' +
'function(c,p,_){' +
walk(nodes) +
'});c.pop();}';
}
function invertedSection(nodes, id, method) {
return 'if(!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0,"")){' +
walk(nodes) +
'};';
}
function partial(tok) {
return '_.b(_.rp("' + esc(tok.n) + '",c,p,"' + (tok.indent || '') + '"));';
}
function tripleStache(id, method) {
return '_.b(_.t(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function variable(id, method) {
return '_.b(_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
}
function text(id) {
return '_.b(' + id + ');';
}
Hogan.parse = function(tokens, text, options) {
options = options || {};
return buildTree(tokens, '', [], options.sectionTags || []);
},
Hogan.cache = {};
Hogan.compile = function(text, options) {
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options = options || {};
var key = text + '||' + !!options.asString;
var t = this.cache[key];
if (t) {
return t;
}
t = this.generate(writeCode(this.parse(this.scan(text, options.delimiters), text, options)), text, options);
return this.cache[key] = t;
};
})(typeof exports !== 'undefined' ? exports : Hogan);
var Mustache = (function (Hogan) {
// Mustache.js has non-spec partial context behavior
function mustachePartial(name, context, partials, indent) {
var partialScope = this.f(name, context, partials, 0);
var cx = context;
if (partialScope) {
cx = cx.concat(partialScope);
}
return Hogan.Template.prototype.rp.call(this, name, cx, partials, indent);
}
var HoganTemplateWrapper = function(renderFunc, text, compiler){
this.rp = mustachePartial;
Hogan.Template.call(this, renderFunc, text, compiler);
};
HoganTemplateWrapper.prototype = Hogan.Template.prototype;
// Add a wrapper for Hogan's generate method. Mustache and Hogan keep
// separate caches, and Mustache returns wrapped templates.
var wrapper;
var HoganWrapper = function(){
this.cache = {};
this.generate = function(code, text, options) {
return new HoganTemplateWrapper(new Function('c', 'p', 'i', code), text, wrapper);
}
};
HoganWrapper.prototype = Hogan;
wrapper = new HoganWrapper();
return {
to_html: function(text, data, partials, sendFun) {
var template = wrapper.compile(text);
var result = template.render(data, partials);
if (!sendFun) {
return result;
}
sendFun(result);
}
}
})(Hogan);
| Miserlou/bootstrap-tagsinput | examples/bower_components/hogan/web/builds/1.0.5/hogan-1.0.5.mustache.js | JavaScript | mit | 16,619 |
/*! SWFMini - a SWFObject 2.2 cut down version for webshims
*
* based on SWFObject v2.2 <http://code.google.com/p/swfobject/>
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfmini=function(){function a(){if(!s){s=!0;for(var a=r.length,b=0;a>b;b++)r[b]()}}function b(a){s?a():r[r.length]=a}function c(){q&&d()}function d(){var a=o.getElementsByTagName("body")[0],b=e(i);b.setAttribute("type",m);var c=a.appendChild(b);if(c){var d=0;!function(){if(typeof c.GetVariable!=h){var e=c.GetVariable("$version");e&&(e=e.split(" ")[1].split(","),u.pv=[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10)])}else if(10>d)return d++,void setTimeout(arguments.callee,10);a.removeChild(b),c=null}()}}function e(a){return o.createElement(a)}function f(a){var b=u.pv,c=a.split(".");return c[0]=parseInt(c[0],10),c[1]=parseInt(c[1],10)||0,c[2]=parseInt(c[2],10)||0,b[0]>c[0]||b[0]==c[0]&&b[1]>c[1]||b[0]==c[0]&&b[1]==c[1]&&b[2]>=c[2]?!0:!1}var g=function(){j.error("This method was removed from swfmini")},h="undefined",i="object",j=window.webshims,k="Shockwave Flash",l="ShockwaveFlash.ShockwaveFlash",m="application/x-shockwave-flash",n=window,o=document,p=navigator,q=!1,r=[c],s=!1,t=!0,u=function(){var a=typeof o.getElementById!=h&&typeof o.getElementsByTagName!=h&&typeof o.createElement!=h,b=p.userAgent.toLowerCase(),c=p.platform.toLowerCase(),d=/win/.test(c?c:b),e=/mac/.test(c?c:b),f=/webkit/.test(b)?parseFloat(b.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,g=!1,j=[0,0,0],r=null;if(typeof p.plugins!=h&&typeof p.plugins[k]==i)r=p.plugins[k].description,!r||typeof p.mimeTypes!=h&&p.mimeTypes[m]&&!p.mimeTypes[m].enabledPlugin||(q=!0,g=!1,r=r.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),j[0]=parseInt(r.replace(/^(.*)\..*$/,"$1"),10),j[1]=parseInt(r.replace(/^.*\.(.*)\s.*$/,"$1"),10),j[2]=/[a-zA-Z]/.test(r)?parseInt(r.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof n.ActiveXObject!=h)try{var s=new ActiveXObject(l);s&&(r=s.GetVariable("$version"),r&&(g=!0,r=r.split(" ")[1].split(","),j=[parseInt(r[0],10),parseInt(r[1],10),parseInt(r[2],10)]))}catch(t){}return{w3:a,pv:j,wk:f,ie:g,win:d,mac:e}}();j.ready("DOM",a),j.loader.addModule("swfmini-embed",{d:["swfmini"]});var v=f("9.0.0")?function(){return j.loader.loadList(["swfmini-embed"]),!0}:j.$.noop;return Modernizr.video?j.ready("WINDOWLOAD",v):v(),{registerObject:g,getObjectById:g,embedSWF:function(a,b,c,d,e,f,g,h,i,k){var l=arguments;v()?j.ready("swfmini-embed",function(){swfmini.embedSWF.apply(swfmini,l)}):k&&k({success:!1,id:b})},switchOffAutoHideShow:function(){t=!1},ua:u,getFlashPlayerVersion:function(){return{major:u.pv[0],minor:u.pv[1],release:u.pv[2]}},hasFlashPlayerVersion:f,createSWF:function(a,b,c){return u.w3?createSWF(a,b,c):void 0},showExpressInstall:g,removeSWF:g,createCSS:g,addDomLoadEvent:b,addLoadEvent:g,expressInstallCallback:g}}();webshims.isReady("swfmini",!0),function(a,b){"use strict";var c=a.audio&&a.video,d=!1,e=b.bugs,f="mediaelement-jaris",g=function(){b.ready(f,function(){b.mediaelement.createSWF||(b.mediaelement.loadSwf=!0,b.reTest([f],c))})},h=b.cfg,i=h.mediaelement,j=-1!=navigator.userAgent.indexOf("MSIE");if(!i)return void b.error("mediaelement wasn't implemented but loaded");if(c){var k=document.createElement("video");a.videoBuffered="buffered"in k,a.mediaDefaultMuted="defaultMuted"in k,d="loop"in k,a.mediaLoop=d,b.capturingEvents(["play","playing","waiting","paused","ended","durationchange","loadedmetadata","canplay","volumechange"]),(!a.videoBuffered||!d||!a.mediaDefaultMuted&&j&&"ActiveXObject"in window)&&(b.addPolyfill("mediaelement-native-fix",{d:["dom-support"]}),b.loader.loadList(["mediaelement-native-fix"]))}a.track&&!e.track&&!function(){if(!e.track){window.VTTCue&&!window.TextTrackCue?window.TextTrackCue=window.VTTCue:window.VTTCue||(window.VTTCue=window.TextTrackCue);try{new VTTCue(2,3,"")}catch(a){e.track=!0}}}(),b.register("mediaelement-core",function(b,e,h,i,j,k){var l=swfmini.hasFlashPlayerVersion("10.0.3"),m=e.mediaelement;m.parseRtmp=function(a){var b,c,d,f=a.src.split("://"),g=f[1].split("/");for(a.server=f[0]+"://"+g[0]+"/",a.streamId=[],b=1,c=g.length;c>b;b++)d||-1===g[b].indexOf(":")||(g[b]=g[b].split(":")[1],d=!0),d?a.streamId.push(g[b]):a.server+=g[b]+"/";a.streamId.length||e.error("Could not parse rtmp url"),a.streamId=a.streamId.join("/")};var n=function(a,c){a=b(a);var d,e={src:a.attr("src")||"",elem:a,srcProp:a.prop("src")};return e.src?(d=a.attr("data-server"),null!=d&&(e.server=d),d=a.attr("type")||a.attr("data-type"),d?(e.type=d,e.container=b.trim(d.split(";")[0])):(c||(c=a[0].nodeName.toLowerCase(),"source"==c&&(c=(a.closest("video, audio")[0]||{nodeName:"video"}).nodeName.toLowerCase())),e.server?(e.type=c+"/rtmp",e.container=c+"/rtmp"):(d=m.getTypeForSrc(e.src,c,e),d&&(e.type=d,e.container=d))),d=a.attr("media"),d&&(e.media=d),("audio/rtmp"==e.type||"video/rtmp"==e.type)&&(e.server?e.streamId=e.src:m.parseRtmp(e)),e):e},o=!l&&"postMessage"in h&&c,p=function(){p.loaded||(p.loaded=!0,k.noAutoTrack||e.ready("WINDOWLOAD",function(){r(),e.loader.loadList(["track-ui"])}))},q=function(){var a;return function(){!a&&o&&(a=!0,e.loader.loadScript("https://www.youtube.com/player_api"),b(function(){e._polyfill(["mediaelement-yt"])}))}}(),r=function(){l?g():q()};e.addPolyfill("mediaelement-yt",{test:!o,d:["dom-support"]}),m.mimeTypes={audio:{"audio/ogg":["ogg","oga","ogm"],'audio/ogg;codecs="opus"':"opus","audio/mpeg":["mp2","mp3","mpga","mpega"],"audio/mp4":["mp4","mpg4","m4r","m4a","m4p","m4b","aac"],"audio/wav":["wav"],"audio/3gpp":["3gp","3gpp"],"audio/webm":["webm"],"audio/fla":["flv","f4a","fla"],"application/x-mpegURL":["m3u8","m3u"]},video:{"video/ogg":["ogg","ogv","ogm"],"video/mpeg":["mpg","mpeg","mpe"],"video/mp4":["mp4","mpg4","m4v"],"video/quicktime":["mov","qt"],"video/x-msvideo":["avi"],"video/x-ms-asf":["asf","asx"],"video/flv":["flv","f4v"],"video/3gpp":["3gp","3gpp"],"video/webm":["webm"],"application/x-mpegURL":["m3u8","m3u"],"video/MP2T":["ts"]}},m.mimeTypes.source=b.extend({},m.mimeTypes.audio,m.mimeTypes.video),m.getTypeForSrc=function(a,c){if(-1!=a.indexOf("youtube.com/watch?")||-1!=a.indexOf("youtube.com/v/"))return"video/youtube";if(0===a.indexOf("rtmp"))return c+"/rtmp";a=a.split("?")[0].split("#")[0].split("."),a=a[a.length-1];var d;return b.each(m.mimeTypes[c],function(b,c){return-1!==c.indexOf(a)?(d=b,!1):void 0}),d},m.srces=function(a,c){if(a=b(a),!c){c=[];var d=a[0].nodeName.toLowerCase(),f=n(a,d);return f.src?c.push(f):b("source",a).each(function(){f=n(this,d),f.src&&c.push(f)}),c}e.error("setting sources was removed.")},m.swfMimeTypes=["video/3gpp","video/x-msvideo","video/quicktime","video/x-m4v","video/mp4","video/m4p","video/x-flv","video/flv","audio/mpeg","audio/aac","audio/mp4","audio/x-m4a","audio/m4a","audio/mp3","audio/x-fla","audio/fla","youtube/flv","video/jarisplayer","jarisplayer/jarisplayer","video/youtube","video/rtmp","audio/rtmp"],m.canThirdPlaySrces=function(a,c){var d="";return(l||o)&&(a=b(a),c=c||m.srces(a),b.each(c,function(a,b){return b.container&&b.src&&(l&&-1!=m.swfMimeTypes.indexOf(b.container)||o&&"video/youtube"==b.container)?(d=b,!1):void 0})),d};var s={};m.canNativePlaySrces=function(a,d){var e="";if(c){a=b(a);var f=(a[0].nodeName||"").toLowerCase(),g=(s[f]||{prop:{_supvalue:!1}}).prop._supvalue||a[0].canPlayType;if(!g)return e;d=d||m.srces(a),b.each(d,function(b,c){return c.type&&g.call(a[0],c.type)?(e=c,!1):void 0})}return e};var t=/^\s*application\/octet\-stream\s*$/i,u=function(){var a=t.test(b.attr(this,"type")||"");return a&&b(this).removeAttr("type"),a};m.setError=function(a,c){if(b("source",a).filter(u).length){e.error('"application/octet-stream" is a useless mimetype for audio/video. Please change this attribute.');try{b(a).mediaLoad()}catch(d){}}else c||(c="can't play sources"),b(a).pause().data("mediaerror",c),e.error("mediaelementError: "+c+". Run the following line in your console to get more info: webshim.mediaelement.loadDebugger();"),setTimeout(function(){b(a).data("mediaerror")&&b(a).addClass("media-error").trigger("mediaerror")},1)};var v=function(){var a,c=l?f:"mediaelement-yt";return function(d,f,g){e.ready(c,function(){m.createSWF&&b(d).parent()[0]?m.createSWF(d,f,g):a||(a=!0,r(),v(d,f,g))}),a||!o||m.createSWF||q()}}(),w={"native":function(a,b,c){c&&"third"==c.isActive&&m.setActive(a,"html5",c)},third:v},x=function(a,b,c){var d,e,f=[{test:"canNativePlaySrces",activate:"native"},{test:"canThirdPlaySrces",activate:"third"}];for((k.preferFlash||b&&"third"==b.isActive)&&f.reverse(),d=0;2>d;d++)if(e=m[f[d].test](a,c)){w[f[d].activate](a,e,b);break}e||(m.setError(a,!1),b&&"third"==b.isActive&&m.setActive(a,"html5",b))},y={metadata:1,auto:1,"":1},z=function(a){var d,e;"none"==a.getAttribute("preload")&&(y[d=b.attr(a,"data-preload")]?b.attr(a,"preload",d):c&&(d=a.getAttribute("poster"))&&(e=i.createElement("img"),e.src=d))},A=/^(?:embed|object|datalist)$/i,B=function(a,c){var d=e.data(a,"mediaelementBase")||e.data(a,"mediaelementBase",{}),f=m.srces(a),g=a.parentNode;clearTimeout(d.loadTimer),b(a).removeClass("media-error"),b.data(a,"mediaerror",!1),f.length&&g&&1==g.nodeType&&!A.test(g.nodeName||"")&&(c=c||e.data(a,"mediaelement"),m.sortMedia&&f.sort(m.sortMedia),z(a),x(a,c,f))};m.selectSource=B,b(i).on("ended",function(a){var c=e.data(a.target,"mediaelement");(!d||c&&"html5"!=c.isActive||b.prop(a.target,"loop"))&&setTimeout(function(){!b.prop(a.target,"paused")&&b.prop(a.target,"loop")&&b(a.target).prop("currentTime",0).play()})});var C=!1,D=function(){var f=function(){e.implement(this,"mediaelement")&&(B(this),a.mediaDefaultMuted||null==b.attr(this,"muted")||b.prop(this,"muted",!0))};e.ready("dom-support",function(){C=!0,d||e.defineNodeNamesBooleanProperty(["audio","video"],"loop"),["audio","video"].forEach(function(a){var d;d=e.defineNodeNameProperty(a,"load",{prop:{value:function(){var a=e.data(this,"mediaelement");B(this,a),!c||a&&"html5"!=a.isActive||!d.prop._supvalue||d.prop._supvalue.apply(this,arguments),!p.loaded&&b("track",this).length&&p(),b(this).triggerHandler("wsmediareload")}}}),s[a]=e.defineNodeNameProperty(a,"canPlayType",{prop:{value:function(d){var e="";return c&&s[a].prop._supvalue&&(e=s[a].prop._supvalue.call(this,d),"no"==e&&(e="")),!e&&l&&(d=b.trim((d||"").split(";")[0]),-1!=m.swfMimeTypes.indexOf(d)&&(e="maybe")),!e&&o&&"video/youtube"==d&&(e="maybe"),e}}})}),e.onNodeNamesPropertyModify(["audio","video"],["src","poster"],{set:function(){var a=this,b=e.data(a,"mediaelementBase")||e.data(a,"mediaelementBase",{});clearTimeout(b.loadTimer),b.loadTimer=setTimeout(function(){B(a),a=null},9)}}),e.addReady(function(a,c){var d=b("video, audio",a).add(c.filter("video, audio")).each(f);!p.loaded&&b("track",d).length&&p(),d=null})}),c&&!C&&e.addReady(function(a,c){C||b("video, audio",a).add(c.filter("video, audio")).each(function(){return m.canNativePlaySrces(this)?void 0:(r(),C=!0,!1)})})};m.loadDebugger=function(){e.ready("dom-support",function(){e.loader.loadScript("mediaelement-debug")})},{noCombo:1,media:1}[e.cfg.debug]&&b(i).on("mediaerror",function(){m.loadDebugger()}),c?(e.isReady("mediaelement-core",!0),D(),e.ready("WINDOWLOAD mediaelement",r)):e.ready(f,D),e.ready("track",p)})}(Modernizr,webshims); | fredericksilva/cdnjs | ajax/libs/webshim/1.14.3/minified/shims/combos/23.js | JavaScript | mit | 11,227 |
<?php
namespace Doctrine\Bundle\DoctrineCacheBundle\Tests\Acl\Domain;
use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
use Symfony\Component\Security\Acl\Domain\PermissionGrantingStrategy;
use Symfony\Component\Security\Acl\Domain\Acl;
use Doctrine\Bundle\DoctrineCacheBundle\Acl\Model\AclCache;
use Doctrine\Common\Cache\ArrayCache;
class AclCacheTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Doctrine\Common\Cache\ArrayCache
*/
private $cacheProvider;
/**
* @var \Symfony\Component\Security\Acl\Domain\PermissionGrantingStrategy
*/
private $permissionGrantingStrategy;
/**
* @var \Doctrine\Bundle\DoctrineCacheBundle\Acl\Model\AclCache
*/
private $aclCache;
public function setUp()
{
$this->cacheProvider = new ArrayCache();
$this->permissionGrantingStrategy = new PermissionGrantingStrategy();
$this->aclCache = new AclCache($this->cacheProvider, $this->permissionGrantingStrategy);
}
public function tearDown()
{
$this->cacheProvider = null;
$this->permissionGrantingStrategy = null;
$this->aclCache = null;
}
/**
* @dataProvider provideDataForEvictFromCacheById
*/
public function testEvictFromCacheById($expected, $primaryKey)
{
$this->cacheProvider->save('bar', 'foo_1');
$this->cacheProvider->save('foo_1', 's:4:test;');
$this->aclCache->evictFromCacheById($primaryKey);
$this->assertEquals($expected, $this->cacheProvider->contains('bar'));
$this->assertEquals($expected, $this->cacheProvider->contains('foo_1'));
}
public function provideDataForEvictFromCacheById()
{
return array(
array(false, 'bar'),
array(true, 'test'),
);
}
/**
* @dataProvider provideDataForEvictFromCacheByIdentity
*/
public function testEvictFromCacheByIdentity($expected, $identity)
{
$this->cacheProvider->save('foo_1', 's:4:test;');
$this->aclCache->evictFromCacheByIdentity($identity);
$this->assertEquals($expected, $this->cacheProvider->contains('foo_1'));
}
public function provideDataForEvictFromCacheByIdentity()
{
return array(
array(false, new ObjectIdentity(1, 'foo')),
);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testPutInCacheWithoutId()
{
$acl = new Acl(null, new ObjectIdentity(1, 'foo'), $this->permissionGrantingStrategy, array(), false);
$this->aclCache->putInCache($acl);
}
public function testPutInCacheWithoutParent()
{
$acl = $this->getAcl(0);
$this->aclCache->putInCache($acl);
$this->assertTrue($this->cacheProvider->contains('foo1_class'));
$this->assertTrue($this->cacheProvider->contains('oid1'));
}
public function testPutInCacheWithParent()
{
$acl = $this->getAcl(2);
$this->aclCache->putInCache($acl);
// current
$this->assertTrue($this->cacheProvider->contains('foo2_class'));
$this->assertTrue($this->cacheProvider->contains('oid2'));
// parent
$this->assertTrue($this->cacheProvider->contains('foo3_class'));
$this->assertTrue($this->cacheProvider->contains('oid3'));
// grand-parent
$this->assertTrue($this->cacheProvider->contains('foo4_class'));
$this->assertTrue($this->cacheProvider->contains('oid4'));
}
public function testClearCache()
{
$acl = $this->getAcl(0);
$this->aclCache->putInCache($acl);
$this->aclCache->clearCache();
$this->assertFalse($this->cacheProvider->contains('foo5_class'));
$this->assertFalse($this->cacheProvider->contains('oid5'));
}
public function testGetFromCacheById()
{
$acl = $this->getAcl(1);
$this->aclCache->putInCache($acl);
$cachedAcl = $this->aclCache->getFromCacheById($acl->getId());
$this->assertEquals($acl->getId(), $cachedAcl->getId());
$this->assertNotNull($cachedParentAcl = $cachedAcl->getParentAcl());
$this->assertEquals($acl->getParentAcl()->getId(), $cachedParentAcl->getId());
$this->assertEquals($acl->getClassFieldAces('foo'), $cachedAcl->getClassFieldAces('foo'));
$this->assertEquals($acl->getObjectFieldAces('foo'), $cachedAcl->getObjectFieldAces('foo'));
}
public function testGetFromCacheByIdentity()
{
$acl = $this->getAcl(1);
$this->aclCache->putInCache($acl);
$cachedAcl = $this->aclCache->getFromCacheByIdentity($acl->getObjectIdentity());
$this->assertEquals($acl->getId(), $cachedAcl->getId());
$this->assertNotNull($cachedParentAcl = $cachedAcl->getParentAcl());
$this->assertEquals($acl->getParentAcl()->getId(), $cachedParentAcl->getId());
$this->assertEquals($acl->getClassFieldAces('foo'), $cachedAcl->getClassFieldAces('foo'));
$this->assertEquals($acl->getObjectFieldAces('foo'), $cachedAcl->getObjectFieldAces('foo'));
}
protected function getAcl($depth = 0)
{
static $id = 1;
$acl = new Acl(
'oid' . $id,
new ObjectIdentity('class', 'foo' . $id),
$this->permissionGrantingStrategy,
array(),
$depth > 0
);
// insert some ACEs
$sid = new UserSecurityIdentity('johannes', 'Foo');
$acl->insertClassAce($sid, 1);
$acl->insertClassFieldAce('foo', $sid, 1);
$acl->insertObjectAce($sid, 1);
$acl->insertObjectFieldAce('foo', $sid, 1);
$id++;
if ($depth > 0) {
$acl->setParentAcl($this->getAcl($depth - 1));
}
return $acl;
}
}
| auticomp/ValidCode | vendor/doctrine/doctrine-cache-bundle/Tests/Acl/Model/AclCacheTest.php | PHP | mit | 5,946 |
//! moment.js
//! version : 2.8.4
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
(function(a){function b(a,b,c){switch(arguments.length){case 2:return null!=a?a:b;case 3:return null!=a?a:null!=b?b:c;default:throw new Error("Implement me")}}function c(a,b){return zb.call(a,b)}function d(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function e(a){tb.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+a)}function f(a,b){var c=!0;return m(function(){return c&&(e(a),c=!1),b.apply(this,arguments)},b)}function g(a,b){qc[a]||(e(b),qc[a]=!0)}function h(a,b){return function(c){return p(a.call(this,c),b)}}function i(a,b){return function(c){return this.localeData().ordinal(a.call(this,c),b)}}function j(){}function k(a,b){b!==!1&&F(a),n(this,a),this._d=new Date(+a._d)}function l(a){var b=y(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=tb.localeData(),this._bubble()}function m(a,b){for(var d in b)c(b,d)&&(a[d]=b[d]);return c(b,"toString")&&(a.toString=b.toString),c(b,"valueOf")&&(a.valueOf=b.valueOf),a}function n(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=b._pf),"undefined"!=typeof b._locale&&(a._locale=b._locale),Ib.length>0)for(c in Ib)d=Ib[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function o(a){return 0>a?Math.ceil(a):Math.floor(a)}function p(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}function q(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function r(a,b){var c;return b=K(b,a),a.isBefore(b)?c=q(a,b):(c=q(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function s(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(g(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=tb.duration(c,d),t(this,e,a),this}}function t(a,b,c,d){var e=b._milliseconds,f=b._days,g=b._months;d=null==d?!0:d,e&&a._d.setTime(+a._d+e*c),f&&nb(a,"Date",mb(a,"Date")+f*c),g&&lb(a,mb(a,"Month")+g*c),d&&tb.updateOffset(a,f||g)}function u(a){return"[object Array]"===Object.prototype.toString.call(a)}function v(a){return"[object Date]"===Object.prototype.toString.call(a)||a instanceof Date}function w(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&A(a[d])!==A(b[d]))&&g++;return g+f}function x(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=jc[a]||kc[b]||b}return a}function y(a){var b,d,e={};for(d in a)c(a,d)&&(b=x(d),b&&(e[b]=a[d]));return e}function z(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}tb[b]=function(e,f){var g,h,i=tb._locale[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=tb().utc().set(d,a);return i.call(tb._locale,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function A(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function B(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function C(a,b,c){return hb(tb([a,11,31+b-c]),b,c).week}function D(a){return E(a)?366:365}function E(a){return a%4===0&&a%100!==0||a%400===0}function F(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[Bb]<0||a._a[Bb]>11?Bb:a._a[Cb]<1||a._a[Cb]>B(a._a[Ab],a._a[Bb])?Cb:a._a[Db]<0||a._a[Db]>24||24===a._a[Db]&&(0!==a._a[Eb]||0!==a._a[Fb]||0!==a._a[Gb])?Db:a._a[Eb]<0||a._a[Eb]>59?Eb:a._a[Fb]<0||a._a[Fb]>59?Fb:a._a[Gb]<0||a._a[Gb]>999?Gb:-1,a._pf._overflowDayOfYear&&(Ab>b||b>Cb)&&(b=Cb),a._pf.overflow=b)}function G(b){return null==b._isValid&&(b._isValid=!isNaN(b._d.getTime())&&b._pf.overflow<0&&!b._pf.empty&&!b._pf.invalidMonth&&!b._pf.nullInput&&!b._pf.invalidFormat&&!b._pf.userInvalidated,b._strict&&(b._isValid=b._isValid&&0===b._pf.charsLeftOver&&0===b._pf.unusedTokens.length&&b._pf.bigHour===a)),b._isValid}function H(a){return a?a.toLowerCase().replace("_","-"):a}function I(a){for(var b,c,d,e,f=0;f<a.length;){for(e=H(a[f]).split("-"),b=e.length,c=H(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=J(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&w(e,c,!0)>=b-1)break;b--}f++}return null}function J(a){var b=null;if(!Hb[a]&&Jb)try{b=tb.locale(),require("./locale/"+a),tb.locale(b)}catch(c){}return Hb[a]}function K(a,b){var c,d;return b._isUTC?(c=b.clone(),d=(tb.isMoment(a)||v(a)?+a:+tb(a))-+c,c._d.setTime(+c._d+d),tb.updateOffset(c,!1),c):tb(a).local()}function L(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function M(a){var b,c,d=a.match(Nb);for(b=0,c=d.length;c>b;b++)d[b]=pc[d[b]]?pc[d[b]]:L(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function N(a,b){return a.isValid()?(b=O(b,a.localeData()),lc[b]||(lc[b]=M(b)),lc[b](a)):a.localeData().invalidDate()}function O(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Ob.lastIndex=0;d>=0&&Ob.test(a);)a=a.replace(Ob,c),Ob.lastIndex=0,d-=1;return a}function P(a,b){var c,d=b._strict;switch(a){case"Q":return Zb;case"DDDD":return _b;case"YYYY":case"GGGG":case"gggg":return d?ac:Rb;case"Y":case"G":case"g":return cc;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?bc:Sb;case"S":if(d)return Zb;case"SS":if(d)return $b;case"SSS":if(d)return _b;case"DDD":return Qb;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Ub;case"a":case"A":return b._locale._meridiemParse;case"x":return Xb;case"X":return Yb;case"Z":case"ZZ":return Vb;case"T":return Wb;case"SSSS":return Tb;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?$b:Pb;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Pb;case"Do":return d?b._locale._ordinalParse:b._locale._ordinalParseLenient;default:return c=new RegExp(Y(X(a.replace("\\","")),"i"))}}function Q(a){a=a||"";var b=a.match(Vb)||[],c=b[b.length-1]||[],d=(c+"").match(hc)||["-",0,0],e=+(60*d[1])+A(d[2]);return"+"===d[0]?-e:e}function R(a,b,c){var d,e=c._a;switch(a){case"Q":null!=b&&(e[Bb]=3*(A(b)-1));break;case"M":case"MM":null!=b&&(e[Bb]=A(b)-1);break;case"MMM":case"MMMM":d=c._locale.monthsParse(b,a,c._strict),null!=d?e[Bb]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[Cb]=A(b));break;case"Do":null!=b&&(e[Cb]=A(parseInt(b.match(/\d{1,2}/)[0],10)));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=A(b));break;case"YY":e[Ab]=tb.parseTwoDigitYear(b);break;case"YYYY":case"YYYYY":case"YYYYYY":e[Ab]=A(b);break;case"a":case"A":c._isPm=c._locale.isPM(b);break;case"h":case"hh":c._pf.bigHour=!0;case"H":case"HH":e[Db]=A(b);break;case"m":case"mm":e[Eb]=A(b);break;case"s":case"ss":e[Fb]=A(b);break;case"S":case"SS":case"SSS":case"SSSS":e[Gb]=A(1e3*("0."+b));break;case"x":c._d=new Date(A(b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=Q(b);break;case"dd":case"ddd":case"dddd":d=c._locale.weekdaysParse(b),null!=d?(c._w=c._w||{},c._w.d=d):c._pf.invalidWeekday=b;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":a=a.substr(0,1);case"gggg":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=A(b));break;case"gg":case"GG":c._w=c._w||{},c._w[a]=tb.parseTwoDigitYear(b)}}function S(a){var c,d,e,f,g,h,i;c=a._w,null!=c.GG||null!=c.W||null!=c.E?(g=1,h=4,d=b(c.GG,a._a[Ab],hb(tb(),1,4).year),e=b(c.W,1),f=b(c.E,1)):(g=a._locale._week.dow,h=a._locale._week.doy,d=b(c.gg,a._a[Ab],hb(tb(),g,h).year),e=b(c.w,1),null!=c.d?(f=c.d,g>f&&++e):f=null!=c.e?c.e+g:g),i=ib(d,e,f,h,g),a._a[Ab]=i.year,a._dayOfYear=i.dayOfYear}function T(a){var c,d,e,f,g=[];if(!a._d){for(e=V(a),a._w&&null==a._a[Cb]&&null==a._a[Bb]&&S(a),a._dayOfYear&&(f=b(a._a[Ab],e[Ab]),a._dayOfYear>D(f)&&(a._pf._overflowDayOfYear=!0),d=db(f,0,a._dayOfYear),a._a[Bb]=d.getUTCMonth(),a._a[Cb]=d.getUTCDate()),c=0;3>c&&null==a._a[c];++c)a._a[c]=g[c]=e[c];for(;7>c;c++)a._a[c]=g[c]=null==a._a[c]?2===c?1:0:a._a[c];24===a._a[Db]&&0===a._a[Eb]&&0===a._a[Fb]&&0===a._a[Gb]&&(a._nextDay=!0,a._a[Db]=0),a._d=(a._useUTC?db:cb).apply(null,g),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()+a._tzm),a._nextDay&&(a._a[Db]=24)}}function U(a){var b;a._d||(b=y(a._i),a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],T(a))}function V(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function W(b){if(b._f===tb.ISO_8601)return void $(b);b._a=[],b._pf.empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=O(b._f,b._locale).match(Nb)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(P(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&b._pf.unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),pc[f]?(d?b._pf.empty=!1:b._pf.unusedTokens.push(f),R(f,d,b)):b._strict&&!d&&b._pf.unusedTokens.push(f);b._pf.charsLeftOver=i-j,h.length>0&&b._pf.unusedInput.push(h),b._pf.bigHour===!0&&b._a[Db]<=12&&(b._pf.bigHour=a),b._isPm&&b._a[Db]<12&&(b._a[Db]+=12),b._isPm===!1&&12===b._a[Db]&&(b._a[Db]=0),T(b),F(b)}function X(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function Y(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Z(a){var b,c,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;f<a._f.length;f++)g=0,b=n({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._pf=d(),b._f=a._f[f],W(b),G(b)&&(g+=b._pf.charsLeftOver,g+=10*b._pf.unusedTokens.length,b._pf.score=g,(null==e||e>g)&&(e=g,c=b));m(a,c||b)}function $(a){var b,c,d=a._i,e=dc.exec(d);if(e){for(a._pf.iso=!0,b=0,c=fc.length;c>b;b++)if(fc[b][1].exec(d)){a._f=fc[b][0]+(e[6]||" ");break}for(b=0,c=gc.length;c>b;b++)if(gc[b][1].exec(d)){a._f+=gc[b][0];break}d.match(Vb)&&(a._f+="Z"),W(a)}else a._isValid=!1}function _(a){$(a),a._isValid===!1&&(delete a._isValid,tb.createFromInputFallback(a))}function ab(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function bb(b){var c,d=b._i;d===a?b._d=new Date:v(d)?b._d=new Date(+d):null!==(c=Kb.exec(d))?b._d=new Date(+c[1]):"string"==typeof d?_(b):u(d)?(b._a=ab(d.slice(0),function(a){return parseInt(a,10)}),T(b)):"object"==typeof d?U(b):"number"==typeof d?b._d=new Date(d):tb.createFromInputFallback(b)}function cb(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function db(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function eb(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function fb(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function gb(a,b,c){var d=tb.duration(a).abs(),e=yb(d.as("s")),f=yb(d.as("m")),g=yb(d.as("h")),h=yb(d.as("d")),i=yb(d.as("M")),j=yb(d.as("y")),k=e<mc.s&&["s",e]||1===f&&["m"]||f<mc.m&&["mm",f]||1===g&&["h"]||g<mc.h&&["hh",g]||1===h&&["d"]||h<mc.d&&["dd",h]||1===i&&["M"]||i<mc.M&&["MM",i]||1===j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,fb.apply({},k)}function hb(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=tb(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ib(a,b,c,d,e){var f,g,h=db(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:D(a-1)+g}}function jb(b){var c,d=b._i,e=b._f;return b._locale=b._locale||tb.localeData(b._l),null===d||e===a&&""===d?tb.invalid({nullInput:!0}):("string"==typeof d&&(b._i=d=b._locale.preparse(d)),tb.isMoment(d)?new k(d,!0):(e?u(e)?Z(b):W(b):bb(b),c=new k(b),c._nextDay&&(c.add(1,"d"),c._nextDay=a),c))}function kb(a,b){var c,d;if(1===b.length&&u(b[0])&&(b=b[0]),!b.length)return tb();for(c=b[0],d=1;d<b.length;++d)b[d][a](c)&&(c=b[d]);return c}function lb(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),B(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function mb(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function nb(a,b,c){return"Month"===b?lb(a,c):a._d["set"+(a._isUTC?"UTC":"")+b](c)}function ob(a,b){return function(c){return null!=c?(nb(this,a,c),tb.updateOffset(this,b),this):mb(this,a)}}function pb(a){return 400*a/146097}function qb(a){return 146097*a/400}function rb(a){tb.duration.fn[a]=function(){return this._data[a]}}function sb(a){"undefined"==typeof ender&&(ub=xb.moment,xb.moment=a?f("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.",tb):tb)}for(var tb,ub,vb,wb="2.8.4",xb="undefined"!=typeof global?global:this,yb=Math.round,zb=Object.prototype.hasOwnProperty,Ab=0,Bb=1,Cb=2,Db=3,Eb=4,Fb=5,Gb=6,Hb={},Ib=[],Jb="undefined"!=typeof module&&module&&module.exports,Kb=/^\/?Date\((\-?\d+)/i,Lb=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Mb=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Nb=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,Ob=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Pb=/\d\d?/,Qb=/\d{1,3}/,Rb=/\d{1,4}/,Sb=/[+\-]?\d{1,6}/,Tb=/\d+/,Ub=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Vb=/Z|[\+\-]\d\d:?\d\d/gi,Wb=/T/i,Xb=/[\+\-]?\d+/,Yb=/[\+\-]?\d+(\.\d{1,3})?/,Zb=/\d/,$b=/\d\d/,_b=/\d{3}/,ac=/\d{4}/,bc=/[+-]?\d{6}/,cc=/[+-]?\d+/,dc=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ec="YYYY-MM-DDTHH:mm:ssZ",fc=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],gc=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],hc=/([\+\-]|\d\d)/gi,ic=("Date|Hours|Minutes|Seconds|Milliseconds".split("|"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),jc={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},kc={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},lc={},mc={s:45,m:45,h:22,d:26,M:11},nc="DDD w W M D d".split(" "),oc="M D H h m s w W".split(" "),pc={M:function(){return this.month()+1},MMM:function(a){return this.localeData().monthsShort(this,a)},MMMM:function(a){return this.localeData().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.localeData().weekdaysMin(this,a)},ddd:function(a){return this.localeData().weekdaysShort(this,a)},dddd:function(a){return this.localeData().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return p(this.year()%100,2)},YYYY:function(){return p(this.year(),4)},YYYYY:function(){return p(this.year(),5)},YYYYYY:function(){var a=this.year(),b=a>=0?"+":"-";return b+p(Math.abs(a),6)},gg:function(){return p(this.weekYear()%100,2)},gggg:function(){return p(this.weekYear(),4)},ggggg:function(){return p(this.weekYear(),5)},GG:function(){return p(this.isoWeekYear()%100,2)},GGGG:function(){return p(this.isoWeekYear(),4)},GGGGG:function(){return p(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return A(this.milliseconds()/100)},SS:function(){return p(A(this.milliseconds()/10),2)},SSS:function(){return p(this.milliseconds(),3)},SSSS:function(){return p(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+p(A(a/60),2)+":"+p(A(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+p(A(a/60),2)+p(A(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},x:function(){return this.valueOf()},X:function(){return this.unix()},Q:function(){return this.quarter()}},qc={},rc=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];nc.length;)vb=nc.pop(),pc[vb+"o"]=i(pc[vb],vb);for(;oc.length;)vb=oc.pop(),pc[vb+vb]=h(pc[vb],2);pc.DDDD=h(pc.DDD,3),m(j.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a,b,c){var d,e,f;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=tb.utc([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=tb([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.apply(b,[c]):d},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",_ordinalParse:/\d{1,2}/,preparse:function(a){return a},postformat:function(a){return a},week:function(a){return hb(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),tb=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=b,g._f=c,g._l=e,g._strict=f,g._isUTC=!1,g._pf=d(),jb(g)},tb.suppressDeprecationWarnings=!1,tb.createFromInputFallback=f("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),tb.min=function(){var a=[].slice.call(arguments,0);return kb("isBefore",a)},tb.max=function(){var a=[].slice.call(arguments,0);return kb("isAfter",a)},tb.utc=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=b,g._f=c,g._strict=f,g._pf=d(),jb(g).utc()},tb.unix=function(a){return tb(1e3*a)},tb.duration=function(a,b){var d,e,f,g,h=a,i=null;return tb.isDuration(a)?h={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(h={},b?h[b]=a:h.milliseconds=a):(i=Lb.exec(a))?(d="-"===i[1]?-1:1,h={y:0,d:A(i[Cb])*d,h:A(i[Db])*d,m:A(i[Eb])*d,s:A(i[Fb])*d,ms:A(i[Gb])*d}):(i=Mb.exec(a))?(d="-"===i[1]?-1:1,f=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*d},h={y:f(i[2]),M:f(i[3]),d:f(i[4]),h:f(i[5]),m:f(i[6]),s:f(i[7]),w:f(i[8])}):"object"==typeof h&&("from"in h||"to"in h)&&(g=r(tb(h.from),tb(h.to)),h={},h.ms=g.milliseconds,h.M=g.months),e=new l(h),tb.isDuration(a)&&c(a,"_locale")&&(e._locale=a._locale),e},tb.version=wb,tb.defaultFormat=ec,tb.ISO_8601=function(){},tb.momentProperties=Ib,tb.updateOffset=function(){},tb.relativeTimeThreshold=function(b,c){return mc[b]===a?!1:c===a?mc[b]:(mc[b]=c,!0)},tb.lang=f("moment.lang is deprecated. Use moment.locale instead.",function(a,b){return tb.locale(a,b)}),tb.locale=function(a,b){var c;return a&&(c="undefined"!=typeof b?tb.defineLocale(a,b):tb.localeData(a),c&&(tb.duration._locale=tb._locale=c)),tb._locale._abbr},tb.defineLocale=function(a,b){return null!==b?(b.abbr=a,Hb[a]||(Hb[a]=new j),Hb[a].set(b),tb.locale(a),Hb[a]):(delete Hb[a],null)},tb.langData=f("moment.langData is deprecated. Use moment.localeData instead.",function(a){return tb.localeData(a)}),tb.localeData=function(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return tb._locale;if(!u(a)){if(b=J(a))return b;a=[a]}return I(a)},tb.isMoment=function(a){return a instanceof k||null!=a&&c(a,"_isAMomentObject")},tb.isDuration=function(a){return a instanceof l};for(vb=rc.length-1;vb>=0;--vb)z(rc[vb]);tb.normalizeUnits=function(a){return x(a)},tb.invalid=function(a){var b=tb.utc(0/0);return null!=a?m(b._pf,a):b._pf.userInvalidated=!0,b},tb.parseZone=function(){return tb.apply(null,arguments).parseZone()},tb.parseTwoDigitYear=function(a){return A(a)+(A(a)>68?1900:2e3)},m(tb.fn=k.prototype,{clone:function(){return tb(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=tb(this).utc();return 0<a.year()&&a.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():N(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):N(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return G(this)},isDSTShifted:function(){return this._a?this.isValid()&&w(this._a,(this._isUTC?tb.utc(this._a):tb(this._a)).toArray())>0:!1},parsingFlags:function(){return m({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(a){return this.zone(0,a)},local:function(a){return this._isUTC&&(this.zone(0,a),this._isUTC=!1,a&&this.add(this._dateTzOffset(),"m")),this},format:function(a){var b=N(this,a||tb.defaultFormat);return this.localeData().postformat(b)},add:s(1,"add"),subtract:s(-1,"subtract"),diff:function(a,b,c){var d,e,f,g=K(a,this),h=6e4*(this.zone()-g.zone());return b=x(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+g.daysInMonth()),e=12*(this.year()-g.year())+(this.month()-g.month()),f=this-tb(this).startOf("month")-(g-tb(g).startOf("month")),f-=6e4*(this.zone()-tb(this).startOf("month").zone()-(g.zone()-tb(g).startOf("month").zone())),e+=f/d,"year"===b&&(e/=12)):(d=this-g,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-h)/864e5:"week"===b?(d-h)/6048e5:d),c?e:o(e)},from:function(a,b){return tb.duration({to:this,from:a}).locale(this.locale()).humanize(!b)},fromNow:function(a){return this.from(tb(),a)},calendar:function(a){var b=a||tb(),c=K(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,tb(b)))},isLeapYear:function(){return E(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=eb(a,this.localeData()),this.add(a-b,"d")):b},month:ob("Month",!0),startOf:function(a){switch(a=x(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this},endOf:function(b){return b=x(b),b===a||"millisecond"===b?this:this.startOf(b).add(1,"isoWeek"===b?"week":b).subtract(1,"ms")},isAfter:function(a,b){var c;return b=x("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=tb.isMoment(a)?a:tb(a),+this>+a):(c=tb.isMoment(a)?+a:+tb(a),c<+this.clone().startOf(b))},isBefore:function(a,b){var c;return b=x("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=tb.isMoment(a)?a:tb(a),+a>+this):(c=tb.isMoment(a)?+a:+tb(a),+this.clone().endOf(b)<c)},isSame:function(a,b){var c;return b=x(b||"millisecond"),"millisecond"===b?(a=tb.isMoment(a)?a:tb(a),+this===+a):(c=+tb(a),+this.clone().startOf(b)<=c&&c<=+this.clone().endOf(b))},min:f("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(a){return a=tb.apply(null,arguments),this>a?this:a}),max:f("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(a){return a=tb.apply(null,arguments),a>this?this:a}),zone:function(a,b){var c,d=this._offset||0;return null==a?this._isUTC?d:this._dateTzOffset():("string"==typeof a&&(a=Q(a)),Math.abs(a)<16&&(a=60*a),!this._isUTC&&b&&(c=this._dateTzOffset()),this._offset=a,this._isUTC=!0,null!=c&&this.subtract(c,"m"),d!==a&&(!b||this._changeInProgress?t(this,tb.duration(d-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,tb.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?tb(a).zone():0,(this.zone()-a)%60===0},daysInMonth:function(){return B(this.year(),this.month())},dayOfYear:function(a){var b=yb((tb(this).startOf("day")-tb(this).startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")},quarter:function(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)},weekYear:function(a){var b=hb(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")},isoWeekYear:function(a){var b=hb(this,1,4).year;return null==a?b:this.add(a-b,"y")},week:function(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")},isoWeek:function(a){var b=hb(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")},weekday:function(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return C(this.year(),1,4)},weeksInYear:function(){var a=this.localeData()._week;return C(this.year(),a.dow,a.doy)},get:function(a){return a=x(a),this[a]()},set:function(a,b){return a=x(a),"function"==typeof this[a]&&this[a](b),this},locale:function(b){var c;return b===a?this._locale._abbr:(c=tb.localeData(b),null!=c&&(this._locale=c),this)},lang:f("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(b){return b===a?this.localeData():this.locale(b)}),localeData:function(){return this._locale},_dateTzOffset:function(){return 15*Math.round(this._d.getTimezoneOffset()/15)}}),tb.fn.millisecond=tb.fn.milliseconds=ob("Milliseconds",!1),tb.fn.second=tb.fn.seconds=ob("Seconds",!1),tb.fn.minute=tb.fn.minutes=ob("Minutes",!1),tb.fn.hour=tb.fn.hours=ob("Hours",!0),tb.fn.date=ob("Date",!0),tb.fn.dates=f("dates accessor is deprecated. Use date instead.",ob("Date",!0)),tb.fn.year=ob("FullYear",!0),tb.fn.years=f("years accessor is deprecated. Use year instead.",ob("FullYear",!0)),tb.fn.days=tb.fn.day,tb.fn.months=tb.fn.month,tb.fn.weeks=tb.fn.week,tb.fn.isoWeeks=tb.fn.isoWeek,tb.fn.quarters=tb.fn.quarter,tb.fn.toJSON=tb.fn.toISOString,m(tb.duration.fn=l.prototype,{_bubble:function(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;g.milliseconds=d%1e3,a=o(d/1e3),g.seconds=a%60,b=o(a/60),g.minutes=b%60,c=o(b/60),g.hours=c%24,e+=o(c/24),h=o(pb(e)),e-=o(qb(h)),f+=o(e/30),e%=30,h+=o(f/12),f%=12,g.days=e,g.months=f,g.years=h},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return o(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*A(this._months/12)},humanize:function(a){var b=gb(this,!a,this.localeData());return a&&(b=this.localeData().pastFuture(+this,b)),this.localeData().postformat(b)},add:function(a,b){var c=tb.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=tb.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=x(a),this[a.toLowerCase()+"s"]()},as:function(a){var b,c;if(a=x(a),"month"===a||"year"===a)return b=this._days+this._milliseconds/864e5,c=this._months+12*pb(b),"month"===a?c:c/12;switch(b=this._days+Math.round(qb(this._months/12)),a){case"week":return b/7+this._milliseconds/6048e5;case"day":return b+this._milliseconds/864e5;case"hour":return 24*b+this._milliseconds/36e5;case"minute":return 24*b*60+this._milliseconds/6e4;case"second":return 24*b*60*60+this._milliseconds/1e3;
case"millisecond":return Math.floor(24*b*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+a)}},lang:tb.fn.lang,locale:tb.fn.locale,toIsoString:f("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"},localeData:function(){return this._locale}}),tb.duration.fn.toString=tb.duration.fn.toISOString;for(vb in ic)c(ic,vb)&&rb(vb.toLowerCase());tb.duration.fn.asMilliseconds=function(){return this.as("ms")},tb.duration.fn.asSeconds=function(){return this.as("s")},tb.duration.fn.asMinutes=function(){return this.as("m")},tb.duration.fn.asHours=function(){return this.as("h")},tb.duration.fn.asDays=function(){return this.as("d")},tb.duration.fn.asWeeks=function(){return this.as("weeks")},tb.duration.fn.asMonths=function(){return this.as("M")},tb.duration.fn.asYears=function(){return this.as("y")},tb.locale("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===A(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),Jb?module.exports=tb:"function"==typeof define&&define.amd?(define("moment",function(a,b,c){return c.config&&c.config()&&c.config().noGlobal===!0&&(xb.moment=ub),tb}),sb(!0)):sb()}).call(this); | korusdipl/jsdelivr | files/momentjs/2.8.4/moment.min.js | JavaScript | mit | 33,783 |
<?php
/**
* Customize Widgets Class
*
* Implements widget management in the Customizer.
*
* @package WordPress
* @subpackage Customize
* @since 3.9.0
*/
final class WP_Customize_Widgets {
/**
* WP_Customize_Manager instance.
*
* @since 3.9.0
* @access public
* @var WP_Customize_Manager
*/
public $manager;
/**
* All id_bases for widgets defined in core.
*
* @since 3.9.0
* @access protected
* @var array
*/
protected $core_widget_id_bases = array(
'archives', 'calendar', 'categories', 'links', 'meta',
'nav_menu', 'pages', 'recent-comments', 'recent-posts',
'rss', 'search', 'tag_cloud', 'text',
);
/**
* @since 3.9.0
* @access protected
* @var
*/
protected $_customized;
/**
* @since 3.9.0
* @access protected
* @var array
*/
protected $_prepreview_added_filters = array();
/**
* @since 3.9.0
* @access protected
* @var array
*/
protected $rendered_sidebars = array();
/**
* @since 3.9.0
* @access protected
* @var array
*/
protected $rendered_widgets = array();
/**
* @since 3.9.0
* @access protected
* @var array
*/
protected $old_sidebars_widgets = array();
/**
* Initial loader.
*
* @since 3.9.0
* @access public
*
* @param WP_Customize_Manager $manager Customize manager bootstrap instance.
*/
public function __construct( $manager ) {
$this->manager = $manager;
add_action( 'after_setup_theme', array( $this, 'setup_widget_addition_previews' ) );
add_action( 'wp_loaded', array( $this, 'override_sidebars_widgets_for_theme_switch' ) );
add_action( 'customize_controls_init', array( $this, 'customize_controls_init' ) );
add_action( 'customize_register', array( $this, 'schedule_customize_register' ), 1 );
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'customize_controls_print_styles', array( $this, 'print_styles' ) );
add_action( 'customize_controls_print_scripts', array( $this, 'print_scripts' ) );
add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_footer_scripts' ) );
add_action( 'customize_controls_print_footer_scripts', array( $this, 'output_widget_control_templates' ) );
add_action( 'customize_preview_init', array( $this, 'customize_preview_init' ) );
add_action( 'dynamic_sidebar', array( $this, 'tally_rendered_widgets' ) );
add_filter( 'is_active_sidebar', array( $this, 'tally_sidebars_via_is_active_sidebar_calls' ), 10, 2 );
add_filter( 'dynamic_sidebar_has_widgets', array( $this, 'tally_sidebars_via_dynamic_sidebar_calls' ), 10, 2 );
}
/**
* Get an unslashed post value or return a default.
*
* @since 3.9.0
*
* @access protected
*
* @param string $name Post value.
* @param mixed $default Default post value.
* @return mixed Unslashed post value or default value.
*/
protected function get_post_value( $name, $default = null ) {
if ( ! isset( $_POST[ $name ] ) ) {
return $default;
}
return wp_unslash( $_POST[$name] );
}
/**
* Set up widget addition previews.
*
* Since the widgets get registered on 'widgets_init' before the Customizer
* settings are set up on 'customize_register', we have to filter the options
* similarly to how the setting previewer will filter the options later.
*
* @since 3.9.0
*
* @access public
*/
public function setup_widget_addition_previews() {
$is_customize_preview = false;
if ( ! empty( $this->manager ) && ! is_admin() && 'on' === $this->get_post_value( 'wp_customize' ) ) {
$is_customize_preview = check_ajax_referer( 'preview-customize_' . $this->manager->get_stylesheet(), 'nonce', false );
}
$is_ajax_widget_update = false;
if ( $this->manager->doing_ajax() && 'update-widget' === $this->get_post_value( 'action' ) ) {
$is_ajax_widget_update = check_ajax_referer( 'update-widget', 'nonce', false );
}
$is_ajax_customize_save = false;
if ( $this->manager->doing_ajax() && 'customize_save' === $this->get_post_value( 'action' ) ) {
$is_ajax_customize_save = check_ajax_referer( 'save-customize_' . $this->manager->get_stylesheet(), 'nonce', false );
}
$is_valid_request = ( $is_ajax_widget_update || $is_customize_preview || $is_ajax_customize_save );
if ( ! $is_valid_request ) {
return;
}
// Input from Customizer preview.
if ( isset( $_POST['customized'] ) ) {
$this->_customized = json_decode( $this->get_post_value( 'customized' ), true );
} else { // Input from ajax widget update request.
$this->_customized = array();
$id_base = $this->get_post_value( 'id_base' );
$widget_number = $this->get_post_value( 'widget_number', false );
$option_name = 'widget_' . $id_base;
$this->_customized[ $option_name ] = array();
if ( preg_match( '/^[0-9]+$/', $widget_number ) ) {
$option_name .= '[' . $widget_number . ']';
$this->_customized[ $option_name ][ $widget_number ] = array();
}
}
$function = array( $this, 'prepreview_added_sidebars_widgets' );
$hook = 'option_sidebars_widgets';
add_filter( $hook, $function );
$this->_prepreview_added_filters[] = compact( 'hook', 'function' );
$hook = 'default_option_sidebars_widgets';
add_filter( $hook, $function );
$this->_prepreview_added_filters[] = compact( 'hook', 'function' );
$function = array( $this, 'prepreview_added_widget_instance' );
foreach ( $this->_customized as $setting_id => $value ) {
if ( preg_match( '/^(widget_.+?)(?:\[(\d+)\])?$/', $setting_id, $matches ) ) {
$option = $matches[1];
$hook = sprintf( 'option_%s', $option );
if ( ! has_filter( $hook, $function ) ) {
add_filter( $hook, $function );
$this->_prepreview_added_filters[] = compact( 'hook', 'function' );
}
$hook = sprintf( 'default_option_%s', $option );
if ( ! has_filter( $hook, $function ) ) {
add_filter( $hook, $function );
$this->_prepreview_added_filters[] = compact( 'hook', 'function' );
}
/*
* Make sure the option is registered so that the update_option()
* won't fail due to the filters providing a default value, which
* causes the update_option() to get confused.
*/
add_option( $option, array() );
}
}
}
/**
* Ensure that newly-added widgets will appear in the widgets_sidebars.
*
* This is necessary because the Customizer's setting preview filters
* are added after the widgets_init action, which is too late for the
* widgets to be set up properly.
*
* @since 3.9.0
* @access public
*
* @param array $sidebars_widgets Associative array of sidebars and their widgets.
* @return array Filtered array of sidebars and their widgets.
*/
public function prepreview_added_sidebars_widgets( $sidebars_widgets ) {
foreach ( $this->_customized as $setting_id => $value ) {
if ( preg_match( '/^sidebars_widgets\[(.+?)\]$/', $setting_id, $matches ) ) {
$sidebar_id = $matches[1];
$sidebars_widgets[ $sidebar_id ] = $value;
}
}
return $sidebars_widgets;
}
/**
* Ensure newly-added widgets have empty instances so they
* will be recognized.
*
* This is necessary because the Customizer's setting preview
* filters are added after the widgets_init action, which is
* too late for the widgets to be set up properly.
*
* @since 3.9.0
* @access public
*
* @param array|bool|mixed $value Widget instance(s), false if open was empty.
* @return array|mixed Widget instance(s) with additions.
*/
public function prepreview_added_widget_instance( $value = false ) {
if ( ! preg_match( '/^(?:default_)?option_(widget_(.+))/', current_filter(), $matches ) ) {
return $value;
}
$id_base = $matches[2];
foreach ( $this->_customized as $setting_id => $setting ) {
$parsed_setting_id = $this->parse_widget_setting_id( $setting_id );
if ( is_wp_error( $parsed_setting_id ) || $id_base !== $parsed_setting_id['id_base'] ) {
continue;
}
$widget_number = $parsed_setting_id['number'];
if ( is_null( $widget_number ) ) {
// Single widget.
if ( false === $value ) {
$value = array();
}
} else {
// Multi widget.
if ( empty( $value ) ) {
$value = array( '_multiwidget' => 1 );
}
if ( ! isset( $value[ $widget_number ] ) ) {
$value[ $widget_number ] = array();
}
}
}
return $value;
}
/**
* Remove pre-preview filters.
*
* Removes filters added in setup_widget_addition_previews()
* to ensure widgets are populating the options during
* 'widgets_init'.
*
* @since 3.9.0
* @access public
*/
public function remove_prepreview_filters() {
foreach ( $this->_prepreview_added_filters as $prepreview_added_filter ) {
remove_filter( $prepreview_added_filter['hook'], $prepreview_added_filter['function'] );
}
$this->_prepreview_added_filters = array();
}
/**
* Override sidebars_widgets for theme switch.
*
* When switching a theme via the Customizer, supply any previously-configured
* sidebars_widgets from the target theme as the initial sidebars_widgets
* setting. Also store the old theme's existing settings so that they can
* be passed along for storing in the sidebars_widgets theme_mod when the
* theme gets switched.
*
* @since 3.9.0
* @access public
*/
public function override_sidebars_widgets_for_theme_switch() {
global $sidebars_widgets;
if ( $this->manager->doing_ajax() || $this->manager->is_theme_active() ) {
return;
}
$this->old_sidebars_widgets = wp_get_sidebars_widgets();
add_filter( 'customize_value_old_sidebars_widgets_data', array( $this, 'filter_customize_value_old_sidebars_widgets_data' ) );
// retrieve_widgets() looks at the global $sidebars_widgets
$sidebars_widgets = $this->old_sidebars_widgets;
$sidebars_widgets = retrieve_widgets( 'customize' );
add_filter( 'option_sidebars_widgets', array( $this, 'filter_option_sidebars_widgets_for_theme_switch' ), 1 );
}
/**
* Filter old_sidebars_widgets_data Customizer setting.
*
* When switching themes, filter the Customizer setting
* old_sidebars_widgets_data to supply initial $sidebars_widgets before they
* were overridden by retrieve_widgets(). The value for
* old_sidebars_widgets_data gets set in the old theme's sidebars_widgets
* theme_mod.
*
* @see WP_Customize_Widgets::handle_theme_switch()
* @since 3.9.0
* @access public
*
* @param array $old_sidebars_widgets
*/
public function filter_customize_value_old_sidebars_widgets_data( $old_sidebars_widgets ) {
return $this->old_sidebars_widgets;
}
/**
* Filter sidebars_widgets option for theme switch.
*
* When switching themes, the retrieve_widgets() function is run when the
* Customizer initializes, and then the new sidebars_widgets here get
* supplied as the default value for the sidebars_widgets option.
*
* @see WP_Customize_Widgets::handle_theme_switch()
* @since 3.9.0
* @access public
*
* @param array $sidebars_widgets
*/
public function filter_option_sidebars_widgets_for_theme_switch( $sidebars_widgets ) {
$sidebars_widgets = $GLOBALS['sidebars_widgets'];
$sidebars_widgets['array_version'] = 3;
return $sidebars_widgets;
}
/**
* Make sure all widgets get loaded into the Customizer.
*
* Note: these actions are also fired in wp_ajax_update_widget().
*
* @since 3.9.0
* @access public
*/
public function customize_controls_init() {
/** This action is documented in wp-admin/includes/ajax-actions.php */
do_action( 'load-widgets.php' );
/** This action is documented in wp-admin/includes/ajax-actions.php */
do_action( 'widgets.php' );
/** This action is documented in wp-admin/widgets.php */
do_action( 'sidebar_admin_setup' );
}
/**
* Ensure widgets are available for all types of previews.
*
* When in preview, hook to 'customize_register' for settings
* after WordPress is loaded so that all filters have been
* initialized (e.g. Widget Visibility).
*
* @since 3.9.0
* @access public
*/
public function schedule_customize_register() {
if ( is_admin() ) { // @todo for some reason, $wp_customize->is_preview() is true here?
$this->customize_register();
} else {
add_action( 'wp', array( $this, 'customize_register' ) );
}
}
/**
* Register Customizer settings and controls for all sidebars and widgets.
*
* @since 3.9.0
* @access public
*/
public function customize_register() {
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_sidebars;
$sidebars_widgets = array_merge(
array( 'wp_inactive_widgets' => array() ),
array_fill_keys( array_keys( $GLOBALS['wp_registered_sidebars'] ), array() ),
wp_get_sidebars_widgets()
);
$new_setting_ids = array();
/*
* Register a setting for all widgets, including those which are active,
* inactive, and orphaned since a widget may get suppressed from a sidebar
* via a plugin (like Widget Visibility).
*/
foreach ( array_keys( $wp_registered_widgets ) as $widget_id ) {
$setting_id = $this->get_setting_id( $widget_id );
$setting_args = $this->get_setting_args( $setting_id );
$setting_args['sanitize_callback'] = array( $this, 'sanitize_widget_instance' );
$setting_args['sanitize_js_callback'] = array( $this, 'sanitize_widget_js_instance' );
$this->manager->add_setting( $setting_id, $setting_args );
$new_setting_ids[] = $setting_id;
}
/*
* Add a setting which will be supplied for the theme's sidebars_widgets
* theme_mod when the the theme is switched.
*/
if ( ! $this->manager->is_theme_active() ) {
$setting_id = 'old_sidebars_widgets_data';
$setting_args = $this->get_setting_args( $setting_id, array(
'type' => 'global_variable',
) );
$this->manager->add_setting( $setting_id, $setting_args );
}
$this->manager->add_panel( 'widgets', array(
'title' => __( 'Widgets' ),
'description' => __( 'Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).' ),
'priority' => 110,
) );
foreach ( $sidebars_widgets as $sidebar_id => $sidebar_widget_ids ) {
if ( empty( $sidebar_widget_ids ) ) {
$sidebar_widget_ids = array();
}
$is_registered_sidebar = isset( $GLOBALS['wp_registered_sidebars'][$sidebar_id] );
$is_inactive_widgets = ( 'wp_inactive_widgets' === $sidebar_id );
$is_active_sidebar = ( $is_registered_sidebar && ! $is_inactive_widgets );
// Add setting for managing the sidebar's widgets.
if ( $is_registered_sidebar || $is_inactive_widgets ) {
$setting_id = sprintf( 'sidebars_widgets[%s]', $sidebar_id );
$setting_args = $this->get_setting_args( $setting_id );
$setting_args['sanitize_callback'] = array( $this, 'sanitize_sidebar_widgets' );
$setting_args['sanitize_js_callback'] = array( $this, 'sanitize_sidebar_widgets_js_instance' );
$this->manager->add_setting( $setting_id, $setting_args );
$new_setting_ids[] = $setting_id;
// Add section to contain controls.
$section_id = sprintf( 'sidebar-widgets-%s', $sidebar_id );
if ( $is_active_sidebar ) {
$section_args = array(
'title' => $GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['name'],
'description' => $GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['description'],
'priority' => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
'panel' => 'widgets',
'sidebar_id' => $sidebar_id,
);
/**
* Filter Customizer widget section arguments for a given sidebar.
*
* @since 3.9.0
*
* @param array $section_args Array of Customizer widget section arguments.
* @param string $section_id Customizer section ID.
* @param int|string $sidebar_id Sidebar ID.
*/
$section_args = apply_filters( 'customizer_widgets_section_args', $section_args, $section_id, $sidebar_id );
$section = new WP_Customize_Sidebar_Section( $this->manager, $section_id, $section_args );
$this->manager->add_section( $section );
$control = new WP_Widget_Area_Customize_Control( $this->manager, $setting_id, array(
'section' => $section_id,
'sidebar_id' => $sidebar_id,
'priority' => count( $sidebar_widget_ids ), // place 'Add Widget' and 'Reorder' buttons at end.
) );
$new_setting_ids[] = $setting_id;
$this->manager->add_control( $control );
}
}
// Add a control for each active widget (located in a sidebar).
foreach ( $sidebar_widget_ids as $i => $widget_id ) {
// Skip widgets that may have gone away due to a plugin being deactivated.
if ( ! $is_active_sidebar || ! isset( $GLOBALS['wp_registered_widgets'][$widget_id] ) ) {
continue;
}
$registered_widget = $GLOBALS['wp_registered_widgets'][$widget_id];
$setting_id = $this->get_setting_id( $widget_id );
$id_base = $GLOBALS['wp_registered_widget_controls'][$widget_id]['id_base'];
$control = new WP_Widget_Form_Customize_Control( $this->manager, $setting_id, array(
'label' => $registered_widget['name'],
'section' => $section_id,
'sidebar_id' => $sidebar_id,
'widget_id' => $widget_id,
'widget_id_base' => $id_base,
'priority' => $i,
'width' => $wp_registered_widget_controls[$widget_id]['width'],
'height' => $wp_registered_widget_controls[$widget_id]['height'],
'is_wide' => $this->is_wide_widget( $widget_id ),
) );
$this->manager->add_control( $control );
}
}
/*
* We have to register these settings later than customize_preview_init
* so that other filters have had a chance to run.
*/
if ( did_action( 'customize_preview_init' ) ) {
foreach ( $new_setting_ids as $new_setting_id ) {
$this->manager->get_setting( $new_setting_id )->preview();
}
}
$this->remove_prepreview_filters();
}
/**
* Covert a widget_id into its corresponding Customizer setting ID (option name).
*
* @since 3.9.0
* @access public
*
* @param string $widget_id Widget ID.
* @return string Maybe-parsed widget ID.
*/
public function get_setting_id( $widget_id ) {
$parsed_widget_id = $this->parse_widget_id( $widget_id );
$setting_id = sprintf( 'widget_%s', $parsed_widget_id['id_base'] );
if ( ! is_null( $parsed_widget_id['number'] ) ) {
$setting_id .= sprintf( '[%d]', $parsed_widget_id['number'] );
}
return $setting_id;
}
/**
* Determine whether the widget is considered "wide".
*
* Core widgets which may have controls wider than 250, but can
* still be shown in the narrow Customizer panel. The RSS and Text
* widgets in Core, for example, have widths of 400 and yet they
* still render fine in the Customizer panel. This method will
* return all Core widgets as being not wide, but this can be
* overridden with the is_wide_widget_in_customizer filter.
*
* @since 3.9.0
* @access public
*
* @param string $widget_id Widget ID.
* @return bool Whether or not the widget is a "wide" widget.
*/
public function is_wide_widget( $widget_id ) {
global $wp_registered_widget_controls;
$parsed_widget_id = $this->parse_widget_id( $widget_id );
$width = $wp_registered_widget_controls[$widget_id]['width'];
$is_core = in_array( $parsed_widget_id['id_base'], $this->core_widget_id_bases );
$is_wide = ( $width > 250 && ! $is_core );
/**
* Filter whether the given widget is considered "wide".
*
* @since 3.9.0
*
* @param bool $is_wide Whether the widget is wide, Default false.
* @param string $widget_id Widget ID.
*/
return apply_filters( 'is_wide_widget_in_customizer', $is_wide, $widget_id );
}
/**
* Covert a widget ID into its id_base and number components.
*
* @since 3.9.0
* @access public
*
* @param string $widget_id Widget ID.
* @return array Array containing a widget's id_base and number components.
*/
public function parse_widget_id( $widget_id ) {
$parsed = array(
'number' => null,
'id_base' => null,
);
if ( preg_match( '/^(.+)-(\d+)$/', $widget_id, $matches ) ) {
$parsed['id_base'] = $matches[1];
$parsed['number'] = intval( $matches[2] );
} else {
// likely an old single widget
$parsed['id_base'] = $widget_id;
}
return $parsed;
}
/**
* Convert a widget setting ID (option path) to its id_base and number components.
*
* @since 3.9.0
* @access public
*
* @param string $setting_id Widget setting ID.
* @return WP_Error|array Array containing a widget's id_base and number components,
* or a WP_Error object.
*/
public function parse_widget_setting_id( $setting_id ) {
if ( ! preg_match( '/^(widget_(.+?))(?:\[(\d+)\])?$/', $setting_id, $matches ) ) {
return new WP_Error( 'widget_setting_invalid_id' );
}
$id_base = $matches[2];
$number = isset( $matches[3] ) ? intval( $matches[3] ) : null;
return compact( 'id_base', 'number' );
}
/**
* Call admin_print_styles-widgets.php and admin_print_styles hooks to
* allow custom styles from plugins.
*
* @since 3.9.0
* @access public
*/
public function print_styles() {
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_print_styles-widgets.php' );
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_print_styles' );
}
/**
* Call admin_print_scripts-widgets.php and admin_print_scripts hooks to
* allow custom scripts from plugins.
*
* @since 3.9.0
* @access public
*/
public function print_scripts() {
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_print_scripts-widgets.php' );
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_print_scripts' );
}
/**
* Enqueue scripts and styles for Customizer panel and export data to JavaScript.
*
* @since 3.9.0
* @access public
*/
public function enqueue_scripts() {
wp_enqueue_style( 'customize-widgets' );
wp_enqueue_script( 'customize-widgets' );
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_enqueue_scripts', 'widgets.php' );
/*
* Export available widgets with control_tpl removed from model
* since plugins need templates to be in the DOM.
*/
$available_widgets = array();
foreach ( $this->get_available_widgets() as $available_widget ) {
unset( $available_widget['control_tpl'] );
$available_widgets[] = $available_widget;
}
$widget_reorder_nav_tpl = sprintf(
'<div class="widget-reorder-nav"><span class="move-widget" tabindex="0">%1$s</span><span class="move-widget-down" tabindex="0">%2$s</span><span class="move-widget-up" tabindex="0">%3$s</span></div>',
__( 'Move to another area…' ),
__( 'Move down' ),
__( 'Move up' )
);
$move_widget_area_tpl = str_replace(
array( '{description}', '{btn}' ),
array(
__( 'Select an area to move this widget into:' ),
_x( 'Move', 'Move widget' ),
),
'<div class="move-widget-area">
<p class="description">{description}</p>
<ul class="widget-area-select">
<% _.each( sidebars, function ( sidebar ){ %>
<li class="" data-id="<%- sidebar.id %>" title="<%- sidebar.description %>" tabindex="0"><%- sidebar.name %></li>
<% }); %>
</ul>
<div class="move-widget-actions">
<button class="move-widget-btn button-secondary" type="button">{btn}</button>
</div>
</div>'
);
global $wp_scripts;
$settings = array(
'nonce' => wp_create_nonce( 'update-widget' ),
'registeredSidebars' => array_values( $GLOBALS['wp_registered_sidebars'] ),
'registeredWidgets' => $GLOBALS['wp_registered_widgets'],
'availableWidgets' => $available_widgets, // @todo Merge this with registered_widgets
'l10n' => array(
'saveBtnLabel' => __( 'Apply' ),
'saveBtnTooltip' => __( 'Save and preview changes before publishing them.' ),
'removeBtnLabel' => __( 'Remove' ),
'removeBtnTooltip' => __( 'Trash widget by moving it to the inactive widgets sidebar.' ),
'error' => __( 'An error has occurred. Please reload the page and try again.' ),
'widgetMovedUp' => __( 'Widget moved up' ),
'widgetMovedDown' => __( 'Widget moved down' ),
),
'tpl' => array(
'widgetReorderNav' => $widget_reorder_nav_tpl,
'moveWidgetArea' => $move_widget_area_tpl,
),
);
foreach ( $settings['registeredWidgets'] as &$registered_widget ) {
unset( $registered_widget['callback'] ); // may not be JSON-serializeable
}
$wp_scripts->add_data(
'customize-widgets',
'data',
sprintf( 'var _wpCustomizeWidgetsSettings = %s;', wp_json_encode( $settings ) )
);
}
/**
* Render the widget form control templates into the DOM.
*
* @since 3.9.0
* @access public
*/
public function output_widget_control_templates() {
?>
<div id="widgets-left"><!-- compatibility with JS which looks for widget templates here -->
<div id="available-widgets">
<div id="available-widgets-filter">
<label class="screen-reader-text" for="widgets-search"><?php _e( 'Search Widgets' ); ?></label>
<input type="search" id="widgets-search" placeholder="<?php esc_attr_e( 'Search widgets…' ) ?>" />
</div>
<?php foreach ( $this->get_available_widgets() as $available_widget ): ?>
<div id="widget-tpl-<?php echo esc_attr( $available_widget['id'] ) ?>" data-widget-id="<?php echo esc_attr( $available_widget['id'] ) ?>" class="widget-tpl <?php echo esc_attr( $available_widget['id'] ) ?>" tabindex="0">
<?php echo $available_widget['control_tpl']; ?>
</div>
<?php endforeach; ?>
</div><!-- #available-widgets -->
</div><!-- #widgets-left -->
<?php
}
/**
* Call admin_print_footer_scripts and admin_print_scripts hooks to
* allow custom scripts from plugins.
*
* @since 3.9.0
* @access public
*/
public function print_footer_scripts() {
/** This action is documented in wp-admin/admin-footer.php */
do_action( 'admin_print_footer_scripts' );
/** This action is documented in wp-admin/admin-footer.php */
do_action( 'admin_footer-widgets.php' );
}
/**
* Get common arguments to supply when constructing a Customizer setting.
*
* @since 3.9.0
* @access public
*
* @param string $id Widget setting ID.
* @param array $overrides Array of setting overrides.
* @return array Possibly modified setting arguments.
*/
public function get_setting_args( $id, $overrides = array() ) {
$args = array(
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => array(),
);
$args = array_merge( $args, $overrides );
/**
* Filter the common arguments supplied when constructing a Customizer setting.
*
* @since 3.9.0
*
* @see WP_Customize_Setting
*
* @param array $args Array of Customizer setting arguments.
* @param string $id Widget setting ID.
*/
return apply_filters( 'widget_customizer_setting_args', $args, $id );
}
/**
* Make sure that sidebar widget arrays only ever contain widget IDS.
*
* Used as the 'sanitize_callback' for each $sidebars_widgets setting.
*
* @since 3.9.0
* @access public
*
* @param array $widget_ids Array of widget IDs.
* @return array Array of sanitized widget IDs.
*/
public function sanitize_sidebar_widgets( $widget_ids ) {
global $wp_registered_widgets;
$widget_ids = array_map( 'strval', (array) $widget_ids );
$sanitized_widget_ids = array();
foreach ( $widget_ids as $widget_id ) {
if ( array_key_exists( $widget_id, $wp_registered_widgets ) ) {
$sanitized_widget_ids[] = $widget_id;
}
}
return $sanitized_widget_ids;
}
/**
* Build up an index of all available widgets for use in Backbone models.
*
* @since 3.9.0
* @access public
*
* @see wp_list_widgets()
*
* @return array List of available widgets.
*/
public function get_available_widgets() {
static $available_widgets = array();
if ( ! empty( $available_widgets ) ) {
return $available_widgets;
}
global $wp_registered_widgets, $wp_registered_widget_controls;
require_once ABSPATH . '/wp-admin/includes/widgets.php'; // for next_widget_id_number()
$sort = $wp_registered_widgets;
usort( $sort, array( $this, '_sort_name_callback' ) );
$done = array();
foreach ( $sort as $widget ) {
if ( in_array( $widget['callback'], $done, true ) ) { // We already showed this multi-widget
continue;
}
$sidebar = is_active_widget( $widget['callback'], $widget['id'], false, false );
$done[] = $widget['callback'];
if ( ! isset( $widget['params'][0] ) ) {
$widget['params'][0] = array();
}
$available_widget = $widget;
unset( $available_widget['callback'] ); // not serializable to JSON
$args = array(
'widget_id' => $widget['id'],
'widget_name' => $widget['name'],
'_display' => 'template',
);
$is_disabled = false;
$is_multi_widget = ( isset( $wp_registered_widget_controls[$widget['id']]['id_base'] ) && isset( $widget['params'][0]['number'] ) );
if ( $is_multi_widget ) {
$id_base = $wp_registered_widget_controls[$widget['id']]['id_base'];
$args['_temp_id'] = "$id_base-__i__";
$args['_multi_num'] = next_widget_id_number( $id_base );
$args['_add'] = 'multi';
} else {
$args['_add'] = 'single';
if ( $sidebar && 'wp_inactive_widgets' !== $sidebar ) {
$is_disabled = true;
}
$id_base = $widget['id'];
}
$list_widget_controls_args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) );
$control_tpl = $this->get_widget_control( $list_widget_controls_args );
// The properties here are mapped to the Backbone Widget model.
$available_widget = array_merge( $available_widget, array(
'temp_id' => isset( $args['_temp_id'] ) ? $args['_temp_id'] : null,
'is_multi' => $is_multi_widget,
'control_tpl' => $control_tpl,
'multi_number' => ( $args['_add'] === 'multi' ) ? $args['_multi_num'] : false,
'is_disabled' => $is_disabled,
'id_base' => $id_base,
'transport' => 'refresh',
'width' => $wp_registered_widget_controls[$widget['id']]['width'],
'height' => $wp_registered_widget_controls[$widget['id']]['height'],
'is_wide' => $this->is_wide_widget( $widget['id'] ),
) );
$available_widgets[] = $available_widget;
}
return $available_widgets;
}
/**
* Naturally order available widgets by name.
*
* @since 3.9.0
* @static
* @access protected
*
* @param array $widget_a The first widget to compare.
* @param array $widget_b The second widget to compare.
* @return int Reorder position for the current widget comparison.
*/
protected function _sort_name_callback( $widget_a, $widget_b ) {
return strnatcasecmp( $widget_a['name'], $widget_b['name'] );
}
/**
* Get the widget control markup.
*
* @since 3.9.0
* @access public
*
* @param array $args Widget control arguments.
* @return string Widget control form HTML markup.
*/
public function get_widget_control( $args ) {
ob_start();
call_user_func_array( 'wp_widget_control', $args );
$replacements = array(
'<form action="" method="post">' => '<div class="form">',
'</form>' => '</div><!-- .form -->',
);
$control_tpl = ob_get_clean();
$control_tpl = str_replace( array_keys( $replacements ), array_values( $replacements ), $control_tpl );
return $control_tpl;
}
/**
* Add hooks for the Customizer preview.
*
* @since 3.9.0
* @access public
*/
public function customize_preview_init() {
add_filter( 'sidebars_widgets', array( $this, 'preview_sidebars_widgets' ), 1 );
add_action( 'wp_enqueue_scripts', array( $this, 'customize_preview_enqueue' ) );
add_action( 'wp_print_styles', array( $this, 'print_preview_css' ), 1 );
add_action( 'wp_footer', array( $this, 'export_preview_data' ), 20 );
}
/**
* When previewing, make sure the proper previewing widgets are used.
*
* Because wp_get_sidebars_widgets() gets called early at init
* (via wp_convert_widget_settings()) and can set global variable
* $_wp_sidebars_widgets to the value of get_option( 'sidebars_widgets' )
* before the Customizer preview filter is added, we have to reset
* it after the filter has been added.
*
* @since 3.9.0
* @access public
*
* @param array $sidebars_widgets List of widgets for the current sidebar.
*/
public function preview_sidebars_widgets( $sidebars_widgets ) {
$sidebars_widgets = get_option( 'sidebars_widgets' );
unset( $sidebars_widgets['array_version'] );
return $sidebars_widgets;
}
/**
* Enqueue scripts for the Customizer preview.
*
* @since 3.9.0
* @access public
*/
public function customize_preview_enqueue() {
wp_enqueue_script( 'customize-preview-widgets' );
}
/**
* Insert default style for highlighted widget at early point so theme
* stylesheet can override.
*
* @since 3.9.0
* @access public
*
* @action wp_print_styles
*/
public function print_preview_css() {
?>
<style>
.widget-customizer-highlighted-widget {
outline: none;
-webkit-box-shadow: 0 0 2px rgba(30,140,190,0.8);
box-shadow: 0 0 2px rgba(30,140,190,0.8);
position: relative;
z-index: 1;
}
</style>
<?php
}
/**
* At the very end of the page, at the very end of the wp_footer,
* communicate the sidebars that appeared on the page.
*
* @since 3.9.0
* @access public
*/
public function export_preview_data() {
// Prepare Customizer settings to pass to JavaScript.
$settings = array(
'renderedSidebars' => array_fill_keys( array_unique( $this->rendered_sidebars ), true ),
'renderedWidgets' => array_fill_keys( array_keys( $this->rendered_widgets ), true ),
'registeredSidebars' => array_values( $GLOBALS['wp_registered_sidebars'] ),
'registeredWidgets' => $GLOBALS['wp_registered_widgets'],
'l10n' => array(
'widgetTooltip' => __( 'Shift-click to edit this widget.' ),
),
);
foreach ( $settings['registeredWidgets'] as &$registered_widget ) {
unset( $registered_widget['callback'] ); // may not be JSON-serializeable
}
?>
<script type="text/javascript">
var _wpWidgetCustomizerPreviewSettings = <?php echo wp_json_encode( $settings ); ?>;
</script>
<?php
}
/**
* Keep track of the widgets that were rendered.
*
* @since 3.9.0
* @access public
*
* @param array $widget Rendered widget to tally.
*/
public function tally_rendered_widgets( $widget ) {
$this->rendered_widgets[ $widget['id'] ] = true;
}
/**
* Determine if a widget is rendered on the page.
*
* @since 4.0.0
* @access public
*
* @param string $widget_id Widget ID to check.
* @return bool Whether the widget is rendered.
*/
public function is_widget_rendered( $widget_id ) {
return in_array( $widget_id, $this->rendered_widgets );
}
/**
* Determine if a sidebar is rendered on the page.
*
* @since 4.0.0
* @access public
*
* @param string $sidebar_id Sidebar ID to check.
* @return bool Whether the sidebar is rendered.
*/
public function is_sidebar_rendered( $sidebar_id ) {
return in_array( $sidebar_id, $this->rendered_sidebars );
}
/**
* Tally the sidebars rendered via is_active_sidebar().
*
* Keep track of the times that is_active_sidebar() is called
* in the template, and assume that this means that the sidebar
* would be rendered on the template if there were widgets
* populating it.
*
* @since 3.9.0
* @access public
*
* @param bool $is_active Whether the sidebar is active.
* @param string $sidebar_id Sidebar ID.
*/
public function tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id ) {
if ( isset( $GLOBALS['wp_registered_sidebars'][$sidebar_id] ) ) {
$this->rendered_sidebars[] = $sidebar_id;
}
/*
* We may need to force this to true, and also force-true the value
* for 'dynamic_sidebar_has_widgets' if we want to ensure that there
* is an area to drop widgets into, if the sidebar is empty.
*/
return $is_active;
}
/**
* Tally the sidebars rendered via dynamic_sidebar().
*
* Keep track of the times that dynamic_sidebar() is called in the template,
* and assume this means the sidebar would be rendered on the template if
* there were widgets populating it.
*
* @since 3.9.0
* @access public
*
* @param bool $has_widgets Whether the current sidebar has widgets.
* @param string $sidebar_id Sidebar ID.
*/
public function tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id ) {
if ( isset( $GLOBALS['wp_registered_sidebars'][$sidebar_id] ) ) {
$this->rendered_sidebars[] = $sidebar_id;
}
/*
* We may need to force this to true, and also force-true the value
* for 'is_active_sidebar' if we want to ensure there is an area to
* drop widgets into, if the sidebar is empty.
*/
return $has_widgets;
}
/**
* Get MAC for a serialized widget instance string.
*
* Allows values posted back from JS to be rejected if any tampering of the
* data has occurred.
*
* @since 3.9.0
* @access protected
*
* @param string $serialized_instance Widget instance.
* @return string MAC for serialized widget instance.
*/
protected function get_instance_hash_key( $serialized_instance ) {
return wp_hash( $serialized_instance );
}
/**
* Sanitize a widget instance.
*
* Unserialize the JS-instance for storing in the options. It's important
* that this filter only get applied to an instance once.
*
* @since 3.9.0
* @access public
*
* @param array $value Widget instance to sanitize.
* @return array Sanitized widget instance.
*/
public function sanitize_widget_instance( $value ) {
if ( $value === array() ) {
return $value;
}
if ( empty( $value['is_widget_customizer_js_value'] )
|| empty( $value['instance_hash_key'] )
|| empty( $value['encoded_serialized_instance'] ) )
{
return null;
}
$decoded = base64_decode( $value['encoded_serialized_instance'], true );
if ( false === $decoded ) {
return null;
}
if ( $this->get_instance_hash_key( $decoded ) !== $value['instance_hash_key'] ) {
return null;
}
$instance = unserialize( $decoded );
if ( false === $instance ) {
return null;
}
return $instance;
}
/**
* Convert widget instance into JSON-representable format.
*
* @since 3.9.0
* @access public
*
* @param array $value Widget instance to convert to JSON.
* @return array JSON-converted widget instance.
*/
public function sanitize_widget_js_instance( $value ) {
if ( empty( $value['is_widget_customizer_js_value'] ) ) {
$serialized = serialize( $value );
$value = array(
'encoded_serialized_instance' => base64_encode( $serialized ),
'title' => empty( $value['title'] ) ? '' : $value['title'],
'is_widget_customizer_js_value' => true,
'instance_hash_key' => $this->get_instance_hash_key( $serialized ),
);
}
return $value;
}
/**
* Strip out widget IDs for widgets which are no longer registered.
*
* One example where this might happen is when a plugin orphans a widget
* in a sidebar upon deactivation.
*
* @since 3.9.0
* @access public
*
* @param array $widget_ids List of widget IDs.
* @return array Parsed list of widget IDs.
*/
public function sanitize_sidebar_widgets_js_instance( $widget_ids ) {
global $wp_registered_widgets;
$widget_ids = array_values( array_intersect( $widget_ids, array_keys( $wp_registered_widgets ) ) );
return $widget_ids;
}
/**
* Find and invoke the widget update and control callbacks.
*
* Requires that $_POST be populated with the instance data.
*
* @since 3.9.0
* @access public
*
* @param string $widget_id Widget ID.
* @return WP_Error|array Array containing the updated widget information.
* A WP_Error object, otherwise.
*/
public function call_widget_update( $widget_id ) {
global $wp_registered_widget_updates, $wp_registered_widget_controls;
$this->start_capturing_option_updates();
$parsed_id = $this->parse_widget_id( $widget_id );
$option_name = 'widget_' . $parsed_id['id_base'];
/*
* If a previously-sanitized instance is provided, populate the input vars
* with its values so that the widget update callback will read this instance
*/
$added_input_vars = array();
if ( ! empty( $_POST['sanitized_widget_setting'] ) ) {
$sanitized_widget_setting = json_decode( $this->get_post_value( 'sanitized_widget_setting' ), true );
if ( false === $sanitized_widget_setting ) {
$this->stop_capturing_option_updates();
return new WP_Error( 'widget_setting_malformed' );
}
$instance = $this->sanitize_widget_instance( $sanitized_widget_setting );
if ( is_null( $instance ) ) {
$this->stop_capturing_option_updates();
return new WP_Error( 'widget_setting_unsanitized' );
}
if ( ! is_null( $parsed_id['number'] ) ) {
$value = array();
$value[$parsed_id['number']] = $instance;
$key = 'widget-' . $parsed_id['id_base'];
$_REQUEST[$key] = $_POST[$key] = wp_slash( $value );
$added_input_vars[] = $key;
} else {
foreach ( $instance as $key => $value ) {
$_REQUEST[$key] = $_POST[$key] = wp_slash( $value );
$added_input_vars[] = $key;
}
}
}
// Invoke the widget update callback.
foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
if ( $name === $parsed_id['id_base'] && is_callable( $control['callback'] ) ) {
ob_start();
call_user_func_array( $control['callback'], $control['params'] );
ob_end_clean();
break;
}
}
// Clean up any input vars that were manually added
foreach ( $added_input_vars as $key ) {
unset( $_POST[$key] );
unset( $_REQUEST[$key] );
}
// Make sure the expected option was updated.
if ( 0 !== $this->count_captured_options() ) {
if ( $this->count_captured_options() > 1 ) {
$this->stop_capturing_option_updates();
return new WP_Error( 'widget_setting_too_many_options' );
}
$updated_option_name = key( $this->get_captured_options() );
if ( $updated_option_name !== $option_name ) {
$this->stop_capturing_option_updates();
return new WP_Error( 'widget_setting_unexpected_option' );
}
}
// Obtain the widget control with the updated instance in place.
ob_start();
$form = $wp_registered_widget_controls[$widget_id];
if ( $form ) {
call_user_func_array( $form['callback'], $form['params'] );
}
$form = ob_get_clean();
// Obtain the widget instance.
$option = get_option( $option_name );
if ( null !== $parsed_id['number'] ) {
$instance = $option[$parsed_id['number']];
} else {
$instance = $option;
}
$this->stop_capturing_option_updates();
return compact( 'instance', 'form' );
}
/**
* Update widget settings asynchronously.
*
* Allows the Customizer to update a widget using its form, but return the new
* instance info via Ajax instead of saving it to the options table.
*
* Most code here copied from wp_ajax_save_widget()
*
* @since 3.9.0
* @access public
*
* @see wp_ajax_save_widget()
*
*/
public function wp_ajax_update_widget() {
if ( ! is_user_logged_in() ) {
wp_die( 0 );
}
check_ajax_referer( 'update-widget', 'nonce' );
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_die( -1 );
}
if ( ! isset( $_POST['widget-id'] ) ) {
wp_send_json_error();
}
/** This action is documented in wp-admin/includes/ajax-actions.php */
do_action( 'load-widgets.php' );
/** This action is documented in wp-admin/includes/ajax-actions.php */
do_action( 'widgets.php' );
/** This action is documented in wp-admin/widgets.php */
do_action( 'sidebar_admin_setup' );
$widget_id = $this->get_post_value( 'widget-id' );
$parsed_id = $this->parse_widget_id( $widget_id );
$id_base = $parsed_id['id_base'];
if ( isset( $_POST['widget-' . $id_base] ) && is_array( $_POST['widget-' . $id_base] ) && preg_match( '/__i__|%i%/', key( $_POST['widget-' . $id_base] ) ) ) {
wp_send_json_error();
}
$updated_widget = $this->call_widget_update( $widget_id ); // => {instance,form}
if ( is_wp_error( $updated_widget ) ) {
wp_send_json_error();
}
$form = $updated_widget['form'];
$instance = $this->sanitize_widget_js_instance( $updated_widget['instance'] );
wp_send_json_success( compact( 'form', 'instance' ) );
}
/***************************************************************************
* Option Update Capturing
***************************************************************************/
/**
* List of captured widget option updates.
*
* @since 3.9.0
* @access protected
* @var array $_captured_options Values updated while option capture is happening.
*/
protected $_captured_options = array();
/**
* Whether option capture is currently happening.
*
* @since 3.9.0
* @access protected
* @var bool $_is_current Whether option capture is currently happening or not.
*/
protected $_is_capturing_option_updates = false;
/**
* Determine whether the captured option update should be ignored.
*
* @since 3.9.0
* @access protected
*
* @param string $option_name Option name.
* @return boolean Whether the option capture is ignored.
*/
protected function is_option_capture_ignored( $option_name ) {
return ( 0 === strpos( $option_name, '_transient_' ) );
}
/**
* Retrieve captured widget option updates.
*
* @since 3.9.0
* @access protected
*
* @return array Array of captured options.
*/
protected function get_captured_options() {
return $this->_captured_options;
}
/**
* Get the number of captured widget option updates.
*
* @since 3.9.0
* @access protected
*
* @return int Number of updated options.
*/
protected function count_captured_options() {
return count( $this->_captured_options );
}
/**
* Start keeping track of changes to widget options, caching new values.
*
* @since 3.9.0
* @access protected
*/
protected function start_capturing_option_updates() {
if ( $this->_is_capturing_option_updates ) {
return;
}
$this->_is_capturing_option_updates = true;
add_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10, 3 );
}
/**
* Pre-filter captured option values before updating.
*
* @since 3.9.0
* @access public
*
* @param mixed $new_value
* @param string $option_name
* @param mixed $old_value
* @return mixed
*/
public function capture_filter_pre_update_option( $new_value, $option_name, $old_value ) {
if ( $this->is_option_capture_ignored( $option_name ) ) {
return;
}
if ( ! isset( $this->_captured_options[$option_name] ) ) {
add_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) );
}
$this->_captured_options[$option_name] = $new_value;
return $old_value;
}
/**
* Pre-filter captured option values before retrieving.
*
* @since 3.9.0
* @access public
*
* @param mixed $value Option
* @return mixed
*/
public function capture_filter_pre_get_option( $value ) {
$option_name = preg_replace( '/^pre_option_/', '', current_filter() );
if ( isset( $this->_captured_options[$option_name] ) ) {
$value = $this->_captured_options[$option_name];
/** This filter is documented in wp-includes/option.php */
$value = apply_filters( 'option_' . $option_name, $value );
}
return $value;
}
/**
* Undo any changes to the options since options capture began.
*
* @since 3.9.0
* @access protected
*/
protected function stop_capturing_option_updates() {
if ( ! $this->_is_capturing_option_updates ) {
return;
}
remove_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10, 3 );
foreach ( array_keys( $this->_captured_options ) as $option_name ) {
remove_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) );
}
$this->_captured_options = array();
$this->_is_capturing_option_updates = false;
}
}
| Genokilller/sonutri | wp/wp-includes/class-wp-customize-widgets.php | PHP | mit | 48,571 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../../addon/mode/simple"), require("../../addon/mode/multiplex"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../../addon/mode/simple", "../../addon/mode/multiplex"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineSimpleMode("handlebars-tags", {
start: [
{ regex: /\{\{!--/, push: "dash_comment", token: "comment" },
{ regex: /\{\{!/, push: "comment", token: "comment" },
{ regex: /\{\{/, push: "handlebars", token: "tag" }
],
handlebars: [
{ regex: /\}\}/, pop: true, token: "tag" },
// Double and single quotes
{ regex: /"(?:[^\\"]|\\.)*"?/, token: "string" },
{ regex: /'(?:[^\\']|\\.)*'?/, token: "string" },
// Handlebars keywords
{ regex: />|[#\/]([A-Za-z_]\w*)/, token: "keyword" },
{ regex: /(?:else|this)\b/, token: "keyword" },
// Numeral
{ regex: /\d+/i, token: "number" },
// Atoms like = and .
{ regex: /=|~|@|true|false/, token: "atom" },
// Paths
{ regex: /(?:\.\.\/)*(?:[A-Za-z_][\w\.]*)+/, token: "variable-2" }
],
dash_comment: [
{ regex: /--\}\}/, pop: true, token: "comment" },
// Commented code
{ regex: /./, token: "comment"}
],
comment: [
{ regex: /\}\}/, pop: true, token: "comment" },
{ regex: /./, token: "comment" }
]
});
CodeMirror.defineMode("handlebars", function(config, parserConfig) {
var handlebars = CodeMirror.getMode(config, "handlebars-tags");
if (!parserConfig || !parserConfig.base) return handlebars;
return CodeMirror.multiplexingMode(
CodeMirror.getMode(config, parserConfig.base),
{open: "{{", close: "}}", mode: handlebars, parseDelimiters: true}
);
});
CodeMirror.defineMIME("text/x-handlebars-template", "handlebars");
});
| brix/cdnjs | ajax/libs/codemirror/5.17.0/mode/handlebars/handlebars.js | JavaScript | mit | 2,172 |
/*
* /MathJax/fonts/HTML-CSS/TeX/png/imagedata.js
*
* Copyright (c) 2010 Design Science, Inc.
*
* 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
*/
(function(b,a){b.defineImageData({MathJax_Caligraphic:{32:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],48:[[4,4,0],[4,4,0],[5,5,0],[6,6,0],[7,7,0],[8,8,0],[9,9,0],[11,11,1],[13,13,1],[16,16,1],[18,19,1],[22,22,1],[26,26,1],[31,32,1]],49:[[3,3,0],[4,4,0],[5,5,0],[5,6,0],[6,7,0],[8,8,0],[9,9,0],[10,12,1],[12,14,1],[15,15,0],[17,18,0],[20,21,0],[24,25,0],[29,30,0]],50:[[4,3,0],[4,4,0],[5,5,0],[6,6,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,13,0],[15,15,0],[18,18,0],[21,21,0],[25,25,0],[30,30,0]],51:[[4,5,2],[4,6,2],[5,7,2],[6,8,3],[7,10,3],[8,11,4],[9,13,4],[11,16,5],[13,19,7],[15,24,8],[18,26,8],[22,31,10],[26,37,12],[30,44,14]],52:[[4,5,2],[4,6,2],[5,7,2],[6,9,3],[7,10,3],[8,11,3],[10,13,4],[11,16,5],[14,19,6],[16,22,6],[19,26,8],[22,31,9],[27,36,11],[31,43,13]],53:[[4,5,2],[4,6,2],[5,7,2],[6,9,3],[7,10,3],[8,11,4],[9,13,4],[11,17,6],[13,19,7],[15,23,8],[18,26,8],[21,31,10],[25,37,12],[30,44,14]],54:[[4,5,0],[4,6,0],[5,7,0],[6,8,0],[7,10,0],[8,12,0],[9,13,0],[11,16,1],[13,19,1],[15,22,1],[18,28,1],[22,32,1],[26,38,1],[30,45,1]],55:[[4,6,2],[5,7,2],[5,8,3],[6,9,3],[7,10,3],[9,11,3],[10,14,4],[12,16,5],[14,20,7],[16,23,8],[19,27,9],[23,32,10],[27,38,12],[32,45,14]],56:[[4,5,0],[4,6,0],[5,7,0],[6,8,0],[7,10,0],[8,12,0],[9,13,0],[11,16,1],[13,19,1],[15,23,1],[18,27,1],[22,32,1],[26,38,1],[30,45,1]],57:[[4,5,2],[4,6,2],[5,7,2],[6,8,3],[7,10,3],[8,11,4],[9,13,4],[11,16,5],[13,19,7],[16,24,8],[18,26,8],[22,31,10],[26,37,12],[31,44,14]],65:[[6,5,0],[7,6,0],[9,8,1],[10,9,1],[12,11,1],[14,12,0],[16,15,1],[20,18,2],[23,22,2],[27,26,2],[33,31,2],[39,36,2],[46,43,2],[54,51,3]],66:[[5,5,0],[6,6,0],[7,7,0],[8,8,0],[10,10,0],[11,12,0],[13,14,0],[16,17,1],[19,21,1],[22,24,1],[26,29,1],[31,34,1],[37,40,1],[44,48,1]],67:[[4,5,0],[5,6,0],[6,7,0],[7,8,0],[8,10,0],[9,12,0],[11,14,0],[13,17,1],[15,21,1],[18,24,1],[21,29,1],[25,34,1],[30,40,1],[36,48,1]],68:[[6,5,0],[7,6,0],[8,7,0],[9,8,0],[11,9,0],[13,12,1],[15,15,1],[18,16,0],[22,19,0],[26,23,0],[30,27,0],[36,32,0],[43,37,0],[51,45,0]],69:[[4,5,0],[5,6,0],[6,7,0],[7,8,0],[8,10,0],[10,12,0],[11,14,0],[14,17,1],[16,21,1],[19,24,1],[23,29,1],[27,34,1],[32,40,1],[38,48,1]],70:[[6,5,0],[7,6,0],[9,7,0],[10,8,0],[12,10,0],[14,12,0],[17,15,0],[20,17,1],[23,20,1],[28,24,1],[33,28,1],[39,34,1],[46,40,2],[55,47,2]],71:[[5,6,1],[5,7,1],[6,8,1],[8,10,2],[9,11,1],[10,14,2],[12,17,3],[14,19,3],[17,23,3],[20,27,4],[24,32,4],[28,39,6],[34,46,7],[40,54,7]],72:[[6,5,0],[7,6,0],[8,7,0],[10,8,0],[12,10,0],[14,12,0],[16,14,0],[19,17,1],[23,21,1],[27,24,1],[32,29,2],[38,34,2],[45,41,2],[53,48,3]],73:[[6,5,0],[7,6,0],[8,7,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[16,16,0],[19,19,0],[23,23,0],[28,27,0],[32,32,0],[38,38,0],[45,45,0]],74:[[6,6,1],[7,7,1],[9,8,1],[10,10,1],[12,11,2],[14,14,3],[17,17,3],[20,19,3],[24,22,3],[28,27,4],[33,32,5],[40,38,6],[47,44,7],[56,53,8]],75:[[6,5,0],[7,6,0],[8,7,0],[9,8,0],[11,10,0],[13,12,0],[15,14,0],[17,17,1],[21,21,1],[25,24,1],[29,29,1],[34,34,1],[41,40,1],[49,48,1]],76:[[5,5,0],[6,6,0],[7,7,0],[8,8,0],[10,10,0],[11,12,0],[13,14,0],[16,17,1],[19,21,1],[22,24,1],[26,29,1],[31,34,1],[37,40,1],[44,48,1]],77:[[8,5,0],[10,7,1],[12,8,1],[14,8,0],[16,10,0],[19,13,1],[23,15,1],[27,18,2],[32,22,2],[38,25,2],[45,30,2],[53,35,2],[63,41,2],[75,50,3]],78:[[8,6,0],[10,7,0],[11,9,1],[13,12,1],[15,13,1],[18,14,0],[21,17,1],[24,20,2],[29,24,2],[34,28,2],[40,33,2],[48,39,2],[57,46,2],[67,56,3]],79:[[6,5,0],[7,6,0],[8,7,0],[10,8,0],[11,10,0],[13,12,0],[16,14,0],[19,17,1],[22,21,1],[26,24,1],[31,29,1],[37,34,1],[43,40,1],[52,48,1]],80:[[6,6,1],[7,6,0],[8,8,1],[9,9,1],[11,11,1],[13,13,1],[15,16,2],[17,18,1],[21,21,2],[24,25,2],[29,29,3],[34,35,3],[41,41,3],[48,49,4]],81:[[6,6,1],[7,7,1],[8,8,1],[10,9,1],[11,11,1],[14,14,2],[16,17,3],[19,19,3],[22,24,4],[26,28,5],[31,33,5],[37,39,6],[44,46,7],[52,55,8]],82:[[6,5,0],[7,6,0],[9,7,0],[10,8,0],[12,10,0],[14,12,0],[17,15,0],[20,17,1],[24,19,1],[28,23,1],[33,28,1],[39,33,1],[47,39,1],[56,46,1]],83:[[5,5,0],[6,6,0],[7,7,0],[8,8,0],[9,10,0],[11,12,0],[13,14,0],[15,17,1],[18,21,1],[22,24,1],[26,29,1],[30,34,1],[36,40,1],[43,48,1]],84:[[6,6,1],[7,7,1],[9,8,1],[10,9,1],[12,11,1],[14,13,1],[17,15,1],[20,18,2],[23,22,2],[28,26,3],[33,31,3],[39,37,4],[46,44,4],[55,52,5]],85:[[6,5,0],[7,6,0],[8,7,0],[10,8,0],[11,10,0],[13,12,0],[15,14,0],[17,17,1],[20,20,1],[24,24,1],[28,28,1],[33,33,1],[40,39,1],[48,47,1]],86:[[5,6,1],[6,7,1],[7,8,1],[8,9,1],[10,11,1],[11,13,1],[13,15,1],[16,18,1],[19,21,2],[22,25,2],[26,30,3],[31,34,2],[37,41,3],[44,49,3]],87:[[8,6,1],[9,7,1],[11,8,1],[13,9,1],[15,11,1],[18,13,1],[21,15,1],[25,18,1],[29,21,2],[35,26,3],[41,30,3],[49,35,3],[58,42,4],[69,50,4]],88:[[6,5,0],[7,6,0],[8,7,0],[10,8,0],[12,9,0],[14,11,0],[16,14,0],[19,16,0],[23,19,0],[27,23,0],[32,27,0],[38,32,0],[45,38,0],[54,45,0]],89:[[5,6,1],[6,7,1],[8,8,1],[9,11,3],[10,12,2],[12,14,2],[14,16,2],[17,20,3],[20,23,4],[24,28,5],[29,33,6],[34,39,7],[40,46,8],[48,55,9]],90:[[6,5,0],[7,6,0],[8,7,0],[10,8,0],[11,10,0],[13,12,0],[15,14,0],[18,16,0],[22,19,0],[26,23,0],[31,27,0],[36,32,0],[43,38,0],[51,45,0]],160:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]]},"MathJax_Fraktur-bold":{},MathJax_Fraktur:{},"MathJax_Main-bold":{32:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],33:[[2,5,0],[3,6,0],[3,8,0],[4,8,0],[4,9,0],[5,12,0],[6,14,0],[7,17,0],[8,20,0],[9,23,0],[11,28,0],[13,32,0],[15,39,0],[18,47,0]],34:[[4,3,-2],[5,4,-2],[5,4,-4],[6,4,-4],[7,5,-4],[9,7,-5],[10,8,-6],[12,9,-8],[14,11,-9],[17,13,-10],[20,15,-13],[23,17,-15],[28,20,-18],[33,25,-21]],35:[[7,6,1],[8,8,2],[9,10,2],[11,10,2],[13,12,3],[15,15,3],[18,18,4],[21,22,5],[25,26,6],[30,29,6],[35,36,8],[42,41,9],[50,49,11],[59,59,13]],36:[[4,6,1],[5,8,1],[5,9,1],[6,9,1],[8,11,1],[9,15,1],[10,17,2],[12,20,1],[15,24,2],[17,27,2],[20,33,3],[24,38,3],[29,45,3],[34,54,4]],37:[[7,6,1],[8,8,1],[9,9,1],[11,9,1],[13,11,1],[15,14,1],[18,16,1],[21,21,2],[25,24,2],[30,27,2],[35,32,2],[42,38,3],[50,45,3],[59,54,4]],38:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[17,14,0],[20,17,0],[24,20,0],[28,23,0],[33,28,0],[39,32,0],[47,38,0],[55,46,0]],39:[[2,3,-2],[3,4,-2],[3,4,-4],[4,4,-4],[4,5,-4],[5,7,-5],[6,8,-6],[7,9,-8],[8,11,-9],[9,13,-10],[11,15,-13],[13,17,-15],[15,20,-18],[18,25,-21]],40:[[3,7,2],[4,9,2],[4,12,3],[5,12,3],[6,14,3],[7,18,4],[8,20,5],[9,25,6],[11,29,7],[13,34,8],[15,40,10],[18,47,12],[22,56,14],[25,67,17]],41:[[3,7,2],[3,9,2],[4,12,3],[5,12,3],[5,14,3],[6,18,4],[7,20,5],[8,25,6],[10,29,7],[12,34,8],[14,40,10],[16,47,12],[19,56,14],[23,67,17]],42:[[4,3,-2],[5,4,-3],[5,5,-3],[6,5,-3],[7,6,-4],[9,8,-5],[10,9,-6],[12,11,-7],[14,13,-9],[17,15,-10],[20,18,-12],[24,21,-14],[28,25,-17],[33,30,-20]],43:[[6,6,1],[7,7,1],[9,9,1],[10,9,1],[12,11,2],[14,14,2],[17,16,3],[20,19,3],[23,22,4],[28,26,4],[33,31,5],[39,36,6],[46,43,7],[55,51,9]],44:[[2,3,1],[3,4,2],[3,4,2],[4,4,2],[4,6,3],[5,7,3],[6,8,4],[6,10,5],[8,11,6],[9,12,6],[11,15,8],[12,17,9],[15,21,11],[17,25,13]],45:[[3,1,-1],[3,1,-1],[4,3,-1],[4,3,-1],[5,3,-2],[6,2,-3],[7,3,-3],[8,3,-4],[9,4,-5],[11,4,-6],[13,5,-7],[15,6,-8],[18,7,-9],[21,8,-11]],46:[[2,2,0],[3,2,0],[3,2,0],[3,2,0],[4,3,0],[5,4,0],[5,4,0],[6,5,0],[7,5,0],[9,6,0],[10,7,0],[12,8,0],[14,10,0],[17,12,0]],47:[[4,7,2],[5,9,2],[5,11,3],[6,11,3],[8,14,3],[9,18,4],[10,20,5],[12,25,6],[15,29,7],[17,33,8],[20,40,10],[24,47,12],[29,56,14],[34,67,17]],48:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[9,12,0],[11,13,0],[13,17,0],[15,20,0],[18,22,0],[21,26,0],[25,31,0],[30,37,0],[35,44,0]],49:[[4,5,0],[5,6,0],[5,7,0],[6,8,0],[7,9,0],[9,12,0],[10,13,0],[12,16,0],[14,19,0],[17,22,0],[20,26,0],[23,31,0],[28,36,0],[33,44,0]],50:[[4,5,0],[5,6,0],[6,7,0],[7,7,0],[8,9,0],[9,12,0],[11,14,0],[12,16,0],[15,19,0],[18,22,0],[21,26,0],[25,30,0],[29,36,0],[35,44,0]],51:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[9,12,0],[11,13,0],[13,17,0],[15,19,0],[18,22,0],[21,27,0],[25,31,0],[30,37,0],[35,44,0]],52:[[4,5,0],[5,7,1],[6,8,1],[7,9,1],[8,10,1],[9,13,1],[11,14,1],[13,17,1],[15,20,1],[18,23,1],[22,27,1],[26,32,1],[30,37,1],[36,45,1]],53:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[9,12,0],[11,14,0],[12,16,0],[15,19,0],[18,23,0],[21,27,0],[25,31,0],[29,37,0],[35,45,0]],54:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[9,12,0],[11,13,0],[13,17,0],[15,19,0],[18,22,0],[21,27,0],[25,31,0],[30,37,0],[35,44,0]],55:[[4,5,0],[5,7,0],[6,8,0],[7,8,0],[8,9,0],[10,12,0],[11,14,0],[13,17,0],[16,20,0],[19,23,0],[22,27,0],[26,32,0],[31,38,0],[37,45,0]],56:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[9,12,0],[11,13,0],[13,17,0],[15,19,0],[18,22,0],[21,27,0],[25,31,0],[30,37,0],[35,44,0]],57:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[9,12,0],[11,13,0],[13,17,0],[15,20,0],[18,22,0],[21,27,0],[25,31,0],[30,37,0],[35,44,0]],58:[[2,3,0],[3,4,0],[3,5,0],[3,5,0],[4,6,0],[5,8,0],[5,9,0],[6,11,0],[7,13,0],[9,15,0],[10,18,0],[12,21,0],[14,25,0],[17,30,0]],59:[[2,4,1],[3,6,2],[3,7,2],[3,7,2],[4,9,3],[5,11,3],[5,13,4],[6,16,5],[7,19,6],[9,21,6],[10,26,8],[12,30,9],[14,36,11],[17,43,13]],60:[[6,5,1],[7,6,1],[8,8,1],[10,8,1],[12,9,1],[14,12,1],[16,14,2],[19,17,2],[23,20,2],[27,23,3],[32,27,3],[38,32,4],[45,38,5],[53,45,6]],61:[[6,2,0],[7,3,-1],[9,3,-1],[10,3,-1],[12,4,-1],[14,6,-1],[17,6,-1],[20,8,-2],[23,8,-3],[28,9,-4],[33,12,-4],[39,13,-5],[46,16,-6],[55,19,-7]],62:[[6,5,1],[7,6,1],[8,8,1],[10,8,1],[11,9,1],[14,12,1],[16,14,2],[19,17,2],[22,20,2],[27,23,3],[32,27,3],[37,32,4],[45,38,5],[53,45,6]],63:[[4,5,0],[4,6,0],[5,8,0],[6,8,0],[7,9,0],[8,12,0],[10,14,0],[11,17,0],[14,20,0],[16,23,0],[19,28,0],[23,32,0],[27,38,0],[32,46,0]],64:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[17,14,0],[20,17,0],[23,20,0],[28,23,0],[33,28,0],[39,32,0],[46,38,0],[55,46,0]],65:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[17,14,0],[20,17,0],[23,20,0],[28,23,0],[33,28,0],[39,32,0],[46,38,0],[55,46,0]],66:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[18,17,0],[21,20,0],[25,23,0],[30,28,0],[36,32,0],[42,38,0],[50,46,0]],67:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[18,17,0],[22,20,0],[26,23,0],[30,28,0],[36,32,0],[43,38,0],[51,46,0]],68:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[16,14,0],[19,17,0],[23,20,0],[27,23,0],[32,28,0],[38,32,0],[46,38,0],[54,45,0]],69:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[10,9,0],[12,12,0],[15,14,0],[17,17,0],[20,20,0],[24,23,0],[29,28,0],[34,32,0],[40,38,0],[48,46,0]],70:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[10,9,0],[12,12,0],[14,14,0],[16,17,0],[19,20,0],[23,23,0],[27,28,0],[32,32,0],[38,38,0],[45,46,0]],71:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[17,14,0],[20,17,0],[24,20,0],[28,23,0],[34,28,0],[40,33,1],[47,39,1],[56,47,1]],72:[[6,5,0],[8,6,0],[9,8,0],[11,8,0],[12,9,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[29,23,0],[34,28,0],[40,32,0],[48,38,0],[57,46,0]],73:[[3,5,0],[4,6,0],[5,8,0],[5,8,0],[6,9,0],[7,12,0],[8,14,0],[10,17,0],[12,20,0],[14,23,0],[17,28,0],[20,32,0],[23,38,0],[27,46,0]],74:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[9,12,0],[11,14,0],[13,17,0],[15,20,0],[18,23,0],[21,28,0],[25,32,0],[30,38,0],[35,46,0]],75:[[6,5,0],[8,6,0],[9,8,0],[11,8,0],[12,9,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[29,23,0],[34,28,0],[40,32,0],[48,38,0],[57,46,0]],76:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[13,14,0],[16,17,0],[18,20,0],[22,23,0],[26,28,0],[31,32,0],[36,38,0],[43,46,0]],77:[[8,6,0],[9,7,0],[11,9,0],[13,9,0],[15,10,0],[18,13,0],[21,15,0],[25,18,0],[29,21,0],[35,24,0],[42,29,0],[49,33,0],[58,39,0],[70,47,0]],78:[[6,5,0],[8,6,0],[9,8,0],[11,8,0],[12,9,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[29,23,0],[34,28,0],[40,32,0],[48,38,0],[57,46,0]],79:[[6,5,0],[7,6,0],[8,8,0],[10,8,0],[12,9,0],[14,12,0],[16,14,0],[19,17,0],[23,20,0],[27,23,0],[32,28,0],[38,32,0],[45,38,0],[53,46,0]],80:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[10,9,0],[12,12,0],[15,14,0],[17,17,0],[20,20,0],[24,23,0],[29,28,0],[34,32,0],[40,38,0],[48,46,0]],81:[[6,6,1],[7,8,2],[8,10,2],[10,10,2],[12,12,3],[14,15,3],[16,18,4],[19,22,5],[23,26,6],[27,29,6],[32,36,8],[38,41,9],[45,49,11],[53,59,13]],82:[[6,5,0],[8,6,0],[9,8,0],[11,8,0],[12,9,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[29,23,0],[34,28,0],[40,32,0],[48,38,0],[57,46,0]],83:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[10,12,0],[12,14,0],[14,17,0],[16,20,0],[19,23,0],[23,28,0],[27,32,0],[32,38,0],[38,46,0]],84:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[18,17,0],[21,19,0],[25,23,0],[30,27,0],[36,31,0],[42,38,0],[50,45,0]],85:[[6,5,0],[8,6,0],[9,8,0],[10,8,0],[12,9,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[28,23,0],[34,28,0],[40,32,0],[47,39,1],[56,47,1]],86:[[6,6,1],[7,7,1],[9,9,1],[10,9,1],[12,10,1],[14,13,1],[17,15,1],[20,18,1],[24,21,1],[28,24,1],[33,29,1],[40,33,1],[47,40,1],[56,47,1]],87:[[8,6,0],[10,7,0],[12,9,0],[14,9,0],[17,10,0],[20,13,0],[23,15,0],[27,18,0],[33,21,0],[39,24,0],[46,29,0],[54,33,0],[65,39,0],[77,47,0]],88:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[17,14,0],[20,17,0],[24,20,0],[28,23,0],[33,28,0],[39,32,0],[47,38,0],[55,46,0]],89:[[6,5,0],[8,6,0],[9,8,0],[10,8,0],[12,9,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[28,23,0],[34,28,0],[40,32,0],[47,38,0],[56,46,0]],90:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[13,14,0],[15,17,0],[18,20,0],[22,23,0],[26,28,0],[30,32,0],[36,38,0],[43,46,0]],91:[[3,7,2],[3,9,2],[3,11,3],[4,11,3],[5,13,3],[5,19,5],[6,22,6],[7,26,7],[9,29,7],[10,34,8],[12,40,10],[14,47,12],[17,56,14],[20,67,17]],92:[[4,7,2],[5,9,2],[5,11,3],[6,11,3],[8,14,3],[9,18,4],[10,20,5],[12,25,6],[15,29,7],[17,33,8],[20,40,10],[24,47,12],[29,56,14],[34,67,17]],93:[[2,7,2],[2,9,2],[2,11,3],[3,11,3],[3,13,3],[4,19,5],[4,22,6],[5,26,7],[6,29,7],[7,34,8],[8,40,10],[9,47,12],[11,56,14],[13,67,17]],94:[[4,2,-3],[4,2,-5],[5,2,-6],[6,2,-6],[7,3,-7],[8,4,-9],[9,4,-10],[11,5,-13],[13,5,-15],[15,6,-17],[18,7,-21],[21,9,-24],[25,10,-29],[30,12,-35]],95:[[4,2,1],[5,2,1],[6,2,1],[7,2,1],[8,2,1],[10,2,1],[12,3,2],[14,3,2],[16,3,2],[19,3,2],[23,3,2],[27,4,3],[32,4,3],[38,5,4]],96:[[3,2,-3],[3,2,-4],[4,3,-5],[4,3,-5],[5,3,-6],[6,4,-8],[7,5,-9],[8,5,-12],[10,6,-14],[12,7,-16],[14,9,-19],[16,10,-23],[19,12,-27],[23,14,-33]],97:[[4,3,0],[5,4,0],[6,5,0],[7,5,0],[8,6,0],[10,8,0],[11,9,0],[13,11,0],[16,13,0],[19,15,0],[22,18,0],[26,21,0],[31,25,0],[37,30,0]],98:[[5,5,0],[5,6,0],[6,8,0],[8,8,0],[9,9,0],[10,12,0],[12,14,0],[14,17,0],[17,20,0],[20,23,0],[24,28,0],[28,32,0],[34,38,0],[40,46,0]],99:[[4,3,0],[4,4,0],[5,5,0],[6,5,0],[7,6,0],[8,8,0],[10,9,0],[12,11,0],[14,13,0],[16,15,0],[19,18,0],[23,21,0],[27,25,0],[32,30,0]],100:[[5,5,0],[6,6,0],[6,8,0],[8,8,0],[9,9,0],[11,12,0],[12,14,0],[15,17,0],[17,20,0],[20,23,0],[24,28,0],[29,32,0],[34,38,0],[40,46,0]],101:[[4,3,0],[5,4,0],[5,5,0],[6,5,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,13,0],[17,15,0],[20,18,0],[23,21,0],[28,25,0],[33,30,0]],102:[[4,5,0],[4,6,0],[5,8,0],[6,8,0],[7,9,0],[8,12,0],[9,14,0],[11,17,0],[13,20,0],[15,23,0],[18,28,0],[21,32,0],[25,38,0],[30,46,0]],103:[[4,4,1],[5,6,2],[6,7,2],[7,7,2],[8,9,3],[10,11,3],[11,13,4],[13,16,5],[16,19,6],[19,21,6],[22,26,8],[26,30,9],[31,36,11],[37,43,13]],104:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[13,14,0],[15,17,0],[18,20,0],[21,23,0],[25,28,0],[29,32,0],[35,38,0],[41,46,0]],105:[[3,5,0],[3,6,0],[3,8,0],[4,8,0],[5,9,0],[5,12,0],[6,14,0],[7,17,0],[9,20,0],[10,23,0],[12,28,0],[14,32,0],[17,38,0],[20,46,0]],106:[[3,6,1],[4,8,2],[4,10,2],[5,10,2],[5,12,3],[7,15,3],[8,18,4],[9,22,5],[10,26,6],[13,29,6],[14,36,8],[17,41,9],[20,49,11],[24,59,13]],107:[[5,5,0],[5,6,0],[6,8,0],[7,8,0],[9,9,0],[10,12,0],[12,14,0],[14,17,0],[17,20,0],[20,23,0],[23,28,0],[28,32,0],[33,38,0],[39,46,0]],108:[[3,5,0],[3,6,0],[3,8,0],[4,8,0],[5,9,0],[5,12,0],[6,14,0],[7,17,0],[9,20,0],[10,23,0],[12,28,0],[14,32,0],[17,38,0],[20,46,0]],109:[[7,3,0],[8,4,0],[10,5,0],[12,5,0],[14,6,0],[16,8,0],[19,9,0],[22,11,0],[27,13,0],[31,15,0],[37,18,0],[44,21,0],[53,25,0],[62,30,0]],110:[[5,3,0],[6,5,0],[7,5,0],[8,5,0],[9,6,0],[11,8,0],[13,9,0],[15,11,0],[18,13,0],[21,15,0],[25,18,0],[29,21,0],[35,25,0],[41,30,0]],111:[[4,3,0],[5,4,0],[6,5,0],[7,5,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,13,0],[18,15,0],[22,18,0],[26,21,0],[30,25,0],[36,30,0]],112:[[5,4,1],[5,6,2],[6,7,2],[7,7,2],[9,9,3],[10,11,3],[12,13,4],[14,16,5],[17,19,6],[20,21,6],[24,26,8],[28,30,9],[33,36,11],[40,43,13]],113:[[5,4,1],[6,6,2],[6,7,2],[8,7,2],[9,9,3],[11,11,3],[12,13,4],[15,16,5],[17,19,6],[21,21,6],[24,26,8],[29,30,9],[34,36,11],[41,43,13]],114:[[4,3,0],[4,4,0],[5,5,0],[6,5,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,13,0],[15,15,0],[18,18,0],[21,21,0],[25,25,0],[29,30,0]],115:[[3,3,0],[4,4,0],[5,5,0],[5,5,0],[6,6,0],[7,8,0],[9,9,0],[10,11,0],[12,13,0],[14,15,0],[17,18,0],[20,21,0],[23,25,0],[28,30,0]],116:[[3,5,0],[4,6,0],[4,7,0],[5,7,0],[6,9,0],[7,12,0],[8,13,0],[9,16,0],[11,19,0],[13,22,0],[15,26,0],[18,30,0],[22,36,0],[26,43,0]],117:[[5,3,0],[6,4,0],[7,5,0],[8,5,0],[9,6,0],[11,8,0],[13,9,0],[15,11,0],[18,13,0],[21,15,0],[25,18,0],[29,21,0],[35,25,0],[41,30,0]],118:[[4,3,0],[5,4,0],[6,5,0],[7,5,0],[8,6,0],[10,8,0],[12,9,0],[14,11,0],[16,13,0],[19,15,0],[23,18,0],[27,21,0],[32,25,0],[38,30,0]],119:[[6,3,0],[7,4,0],[8,5,0],[10,5,0],[12,6,0],[14,8,0],[16,9,0],[19,11,0],[23,13,0],[27,15,0],[32,18,0],[38,21,0],[45,25,0],[53,30,0]],120:[[5,3,0],[5,4,0],[6,5,0],[7,5,0],[9,6,0],[10,8,0],[12,9,0],[14,11,0],[17,13,0],[20,15,0],[23,18,0],[28,21,0],[33,25,0],[39,30,0]],121:[[4,4,1],[5,6,2],[6,7,2],[7,7,2],[9,9,3],[10,11,3],[12,13,4],[14,16,5],[17,19,6],[20,21,6],[23,26,8],[27,30,9],[33,36,11],[39,43,13]],122:[[4,3,0],[4,4,0],[5,5,0],[6,5,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,13,0],[16,15,0],[19,18,0],[22,21,0],[26,25,0],[31,30,0]],123:[[4,7,2],[5,9,2],[5,11,3],[6,11,3],[7,14,3],[9,18,4],[10,21,6],[12,25,7],[14,30,7],[17,33,8],[20,40,10],[24,47,12],[28,55,14],[34,66,17]],124:[[2,7,2],[2,9,2],[2,12,3],[3,12,3],[3,14,3],[4,18,4],[4,20,5],[5,25,6],[6,29,7],[7,34,8],[8,40,10],[9,47,12],[11,56,14],[13,67,17]],125:[[4,7,2],[5,9,2],[5,11,3],[6,11,3],[7,14,3],[9,18,4],[10,21,6],[12,26,7],[14,29,7],[17,33,8],[20,40,10],[24,47,11],[28,56,14],[34,66,16]],126:[[4,1,-1],[4,1,-2],[5,3,-1],[6,3,-1],[7,4,-2],[8,3,-4],[10,3,-4],[12,4,-5],[14,5,-6],[16,6,-7],[19,6,-8],[23,7,-9],[27,9,-11],[32,10,-13]],915:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[13,14,0],[15,17,0],[18,20,0],[22,23,0],[26,27,0],[30,32,0],[36,38,0],[43,46,0]],916:[[7,5,0],[8,6,0],[9,8,0],[11,8,0],[13,9,0],[15,12,0],[18,14,0],[21,17,0],[25,20,0],[30,23,0],[36,28,0],[42,32,0],[50,38,0],[60,46,0]],920:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[17,14,0],[20,17,0],[23,20,0],[28,23,0],[33,28,0],[39,32,0],[46,38,0],[55,46,0]],923:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[18,17,0],[22,20,0],[26,23,0],[30,28,0],[36,32,0],[43,38,0],[51,46,0]],926:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[10,9,0],[12,12,0],[14,14,0],[17,17,0],[20,20,0],[24,23,0],[28,27,0],[34,31,0],[40,37,0],[48,45,0]],928:[[6,5,0],[8,6,0],[9,8,0],[11,8,0],[12,9,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[29,23,0],[34,27,0],[40,32,0],[48,38,0],[57,46,0]],931:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[18,17,0],[22,20,0],[26,23,0],[30,28,0],[36,32,0],[43,38,0],[51,46,0]],933:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[17,14,0],[20,17,0],[23,20,0],[28,23,0],[33,28,0],[39,32,0],[46,38,0],[55,46,0]],934:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[18,17,0],[22,20,0],[26,23,0],[30,28,0],[36,32,0],[43,38,0],[51,46,0]],936:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[17,14,0],[20,17,0],[23,20,0],[28,23,0],[33,28,0],[39,32,0],[46,38,0],[55,46,0]],937:[[6,5,0],[7,6,0],[8,8,0],[10,8,0],[11,9,0],[13,12,0],[16,14,0],[18,17,0],[22,20,0],[26,23,0],[31,28,0],[36,32,0],[43,38,0],[51,46,0]]},"MathJax_Main-italic":{32:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],33:[[3,5,0],[4,6,0],[4,6,0],[5,8,0],[6,9,0],[7,11,0],[8,14,0],[9,15,0],[11,20,0],[13,24,0],[15,28,0],[18,34,0],[22,41,0],[25,47,0]],34:[[4,3,-2],[5,3,-3],[6,3,-3],[7,4,-4],[8,5,-4],[9,5,-6],[11,7,-7],[13,8,-8],[15,9,-10],[18,11,-12],[22,13,-14],[25,15,-18],[30,18,-21],[36,21,-24]],35:[[6,6,1],[7,8,2],[9,8,2],[10,10,2],[12,12,3],[14,14,3],[17,18,4],[20,20,4],[23,24,5],[28,29,6],[33,34,7],[39,42,9],[46,50,11],[55,58,13]],37:[[6,6,1],[8,8,1],[9,8,1],[10,10,1],[12,11,1],[15,13,1],[17,17,1],[20,18,1],[24,23,2],[28,29,3],[34,33,3],[40,38,3],[47,46,3],[56,53,4]],38:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[12,9,0],[14,11,0],[16,14,0],[19,17,1],[23,21,1],[27,25,1],[32,29,0],[38,35,1],[45,43,2],[53,49,2]],39:[[3,3,-2],[4,3,-3],[4,3,-3],[5,4,-4],[6,5,-4],[7,5,-6],[8,7,-7],[9,8,-8],[11,9,-10],[13,11,-12],[15,13,-14],[18,15,-18],[21,18,-21],[25,21,-24]],40:[[4,8,3],[5,10,3],[6,10,3],[7,13,4],[8,15,4],[9,17,5],[11,22,6],[12,24,7],[15,28,8],[18,35,9],[21,40,11],[25,49,13],[29,58,15],[35,67,17]],41:[[3,7,2],[4,9,2],[4,9,2],[5,12,3],[6,14,3],[7,16,4],[8,21,5],[10,23,6],[11,27,7],[13,34,8],[16,39,10],[19,48,12],[22,57,14],[26,66,16]],42:[[5,3,-2],[5,5,-2],[6,5,-2],[7,6,-3],[9,6,-4],[10,8,-4],[12,9,-6],[14,10,-7],[17,12,-9],[20,15,-11],[23,17,-12],[28,21,-15],[33,25,-18],[39,28,-21]],43:[[6,5,1],[7,7,1],[8,7,1],[9,7,1],[11,9,1],[13,11,2],[15,13,1],[18,15,2],[21,18,3],[25,21,2],[30,24,2],[35,30,3],[42,35,3],[50,41,4]],44:[[2,2,1],[2,3,2],[3,3,2],[3,4,2],[4,5,3],[4,5,3],[5,7,4],[6,7,4],[7,9,5],[8,10,6],[10,12,7],[11,15,9],[13,18,11],[16,21,13]],45:[[3,1,-1],[3,1,-1],[4,1,-1],[4,1,-2],[5,1,-2],[6,2,-2],[7,3,-3],[8,3,-3],[10,2,-5],[12,3,-6],[14,3,-7],[16,4,-9],[19,5,-10],[23,5,-12]],46:[[2,1,0],[2,2,0],[3,2,0],[3,2,0],[4,2,0],[4,2,0],[5,3,0],[6,3,0],[7,4,0],[8,5,0],[10,5,0],[11,6,0],[13,7,0],[16,8,0]],47:[[5,7,2],[6,9,2],[7,9,2],[8,12,3],[9,14,3],[11,16,4],[12,21,5],[15,23,6],[18,27,7],[21,34,8],[25,39,10],[29,48,12],[35,57,14],[41,66,16]],48:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[14,16,1],[16,19,1],[19,24,1],[22,27,0],[27,33,1],[32,39,1],[37,45,1]],49:[[4,5,0],[4,6,0],[5,6,0],[6,8,0],[7,9,0],[8,11,0],[10,14,0],[11,15,0],[13,19,0],[16,23,0],[19,26,0],[22,32,0],[26,38,0],[31,44,0]],50:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[13,16,1],[16,20,1],[19,24,1],[22,27,0],[26,33,1],[31,39,1],[37,45,1]],51:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[14,15,0],[16,19,0],[19,23,0],[22,26,0],[27,33,1],[32,39,1],[37,45,1]],52:[[4,6,1],[4,8,2],[5,8,2],[6,10,2],[7,12,3],[8,14,3],[10,18,4],[12,19,4],[14,24,5],[16,29,6],[19,33,7],[23,41,9],[27,49,11],[32,57,13]],53:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,10,0],[10,11,0],[12,14,0],[14,16,1],[16,20,1],[19,23,1],[23,27,0],[27,33,1],[32,39,1],[38,45,1]],54:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[12,14,0],[14,16,1],[16,19,1],[19,24,1],[23,28,1],[27,33,1],[32,39,1],[38,45,2]],55:[[5,5,0],[6,6,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,14,0],[15,16,1],[18,20,1],[21,24,1],[25,27,0],[30,33,1],[36,40,2],[42,46,2]],56:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[13,16,1],[16,20,1],[19,24,1],[22,27,0],[26,33,1],[31,39,1],[37,45,1]],57:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[13,16,1],[16,19,1],[19,24,1],[22,27,0],[26,33,1],[31,39,1],[37,45,1]],58:[[3,3,0],[3,4,0],[4,4,0],[4,5,0],[5,6,0],[6,7,0],[6,9,0],[8,10,0],[9,12,0],[11,15,0],[13,17,0],[15,21,0],[18,24,0],[21,28,0]],59:[[3,4,1],[3,6,2],[4,6,2],[4,7,2],[5,9,3],[6,10,3],[6,13,4],[8,14,4],[9,17,5],[11,21,6],[13,24,7],[15,30,9],[18,35,11],[21,41,13]],61:[[6,2,-1],[7,3,-1],[8,3,-1],[10,3,-1],[11,4,-2],[13,4,-2],[16,5,-3],[19,5,-3],[22,7,-3],[26,10,-4],[31,9,-5],[37,11,-6],[43,14,-8],[52,16,-9]],63:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[13,15,0],[16,20,0],[19,24,0],[22,28,0],[26,34,0],[31,41,0],[37,47,0]],64:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[11,9,0],[14,11,0],[16,14,0],[19,15,0],[22,20,0],[26,24,0],[31,27,0],[37,34,1],[44,41,1],[52,47,1]],65:[[5,5,0],[6,7,0],[7,7,0],[9,8,0],[10,10,0],[12,12,0],[14,15,0],[17,16,0],[20,20,0],[23,24,0],[28,28,0],[33,34,0],[39,41,0],[46,47,0]],66:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[17,15,0],[21,19,0],[25,23,0],[29,26,0],[34,33,0],[41,39,0],[49,45,0]],67:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[12,9,0],[14,11,0],[16,14,0],[19,16,1],[23,21,1],[27,25,1],[32,27,0],[38,35,1],[45,41,1],[54,48,1]],68:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[11,9,0],[13,11,0],[16,14,0],[18,15,0],[22,19,0],[26,23,0],[31,26,0],[36,33,0],[43,39,0],[51,45,0]],69:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,15,0],[21,19,0],[25,23,0],[30,26,0],[35,33,0],[42,39,0],[50,46,1]],70:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[17,15,0],[21,19,0],[24,23,0],[29,26,0],[34,33,0],[41,38,0],[48,45,0]],71:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[12,9,0],[14,11,0],[16,14,0],[19,16,1],[23,21,1],[27,25,1],[32,27,0],[38,35,1],[45,41,1],[54,48,1]],72:[[6,5,0],[8,6,0],[9,6,0],[11,8,0],[12,9,0],[15,11,0],[17,14,0],[20,15,0],[24,19,0],[29,23,0],[34,26,0],[40,33,0],[48,39,0],[57,45,0]],73:[[4,5,0],[5,6,0],[5,6,0],[6,8,0],[8,9,0],[9,11,0],[10,14,0],[12,15,0],[15,19,0],[17,23,0],[20,26,0],[24,33,0],[29,39,0],[34,45,0]],74:[[5,5,0],[6,6,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,14,0],[15,16,1],[18,20,1],[21,24,1],[25,26,0],[29,34,1],[35,40,1],[41,46,1]],75:[[6,5,0],[8,7,1],[9,7,1],[11,9,1],[12,10,1],[15,12,1],[17,15,1],[20,16,1],[24,20,1],[29,24,1],[34,27,1],[40,33,0],[48,39,0],[57,46,1]],76:[[5,6,1],[6,7,1],[7,7,1],[8,9,1],[9,10,1],[11,12,1],[13,15,1],[15,16,1],[18,20,1],[21,24,1],[25,27,1],[30,33,1],[35,40,1],[42,46,1]],77:[[7,5,0],[9,6,0],[10,6,0],[12,8,0],[14,9,0],[17,11,0],[20,14,0],[24,15,0],[28,19,0],[34,23,0],[40,26,0],[47,33,0],[56,39,0],[67,46,1]],78:[[6,5,0],[8,6,0],[9,6,0],[11,8,0],[12,10,0],[15,11,0],[17,14,0],[20,16,0],[24,19,0],[29,24,0],[34,27,0],[40,34,0],[48,40,0],[57,45,0]],79:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[11,9,0],[14,11,0],[16,14,0],[19,16,1],[22,21,1],[26,25,1],[31,27,0],[37,35,1],[44,41,1],[52,48,1]],80:[[6,5,0],[7,7,1],[8,7,1],[9,9,1],[11,10,1],[13,12,1],[15,15,1],[17,16,1],[21,20,1],[24,24,1],[29,27,1],[34,34,1],[41,40,1],[48,46,1]],81:[[6,6,1],[7,8,2],[8,8,2],[10,10,2],[11,12,3],[14,14,3],[16,18,4],[19,19,4],[22,25,5],[26,30,6],[31,34,7],[37,43,9],[44,51,11],[52,59,13]],82:[[5,6,0],[6,7,0],[8,7,0],[9,9,0],[10,10,0],[12,12,0],[15,15,0],[17,17,1],[20,21,1],[24,25,1],[29,27,0],[34,35,1],[40,41,1],[48,47,1]],83:[[5,5,0],[6,7,0],[7,7,0],[8,8,0],[9,10,0],[11,12,0],[13,15,0],[15,17,1],[18,21,1],[21,25,1],[25,28,0],[30,35,1],[35,41,1],[42,48,1]],84:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[12,9,0],[14,11,0],[16,14,0],[19,15,0],[23,19,0],[27,23,0],[32,26,0],[38,32,0],[45,38,0],[54,45,0]],85:[[6,5,0],[8,6,0],[9,6,0],[11,8,0],[12,9,0],[15,11,0],[17,14,0],[20,16,1],[24,20,1],[29,24,1],[34,26,0],[40,34,1],[48,40,1],[57,47,2]],86:[[6,5,0],[8,6,0],[9,6,0],[11,8,0],[12,9,0],[15,11,0],[17,14,0],[21,17,1],[24,20,1],[29,24,1],[34,27,0],[41,34,1],[48,40,1],[58,47,2]],87:[[8,5,0],[10,6,0],[12,6,0],[14,8,0],[16,9,0],[19,11,0],[22,14,0],[27,17,1],[32,20,1],[37,24,1],[44,27,0],[53,34,1],[63,41,2],[74,47,2]],88:[[6,5,0],[7,7,1],[9,7,1],[10,9,1],[12,10,1],[14,12,1],[16,15,1],[20,16,1],[23,20,1],[28,24,1],[33,27,1],[39,34,1],[46,39,0],[55,45,0]],89:[[7,5,0],[8,6,0],[9,6,0],[11,8,0],[13,9,0],[15,11,0],[18,14,0],[21,15,0],[25,19,0],[29,23,0],[35,26,0],[41,33,0],[49,39,0],[58,45,0]],90:[[5,5,0],[6,6,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[17,15,0],[20,19,0],[24,23,0],[28,26,0],[33,33,0],[39,39,0],[47,45,0]],91:[[4,8,2],[4,10,3],[5,10,3],[6,12,3],[7,14,4],[8,16,4],[9,21,5],[11,23,6],[13,28,8],[15,36,9],[18,39,10],[21,47,12],[25,57,14],[30,66,16]],93:[[4,8,2],[4,10,3],[5,10,3],[6,12,3],[6,14,4],[7,16,4],[8,21,5],[10,23,6],[11,28,8],[13,36,9],[15,39,10],[18,48,12],[21,57,14],[25,66,16]],94:[[4,1,-4],[5,2,-4],[6,2,-4],[7,2,-6],[8,2,-7],[9,3,-8],[11,4,-10],[13,4,-12],[15,5,-14],[18,6,-17],[21,7,-20],[25,8,-25],[30,10,-29],[35,11,-34]],95:[[4,2,1],[5,2,1],[6,2,1],[7,2,1],[8,2,1],[10,2,1],[11,2,1],[14,2,1],[16,3,2],[19,4,3],[22,4,3],[27,5,4],[32,5,4],[37,6,5]],97:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[11,9,0],[13,10,0],[16,12,0],[18,15,0],[22,17,0],[26,22,1],[31,26,1],[36,30,1]],98:[[4,5,0],[4,6,0],[5,6,0],[6,8,0],[7,9,0],[8,11,0],[10,14,0],[11,16,0],[13,19,0],[16,23,0],[19,27,0],[22,34,1],[26,40,1],[31,46,1]],99:[[4,3,0],[4,4,0],[5,4,0],[6,5,0],[7,6,0],[8,7,0],[10,9,0],[11,10,0],[13,12,0],[16,15,0],[19,17,0],[22,22,1],[26,26,1],[31,30,1]],100:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[12,14,0],[14,15,0],[16,19,0],[19,23,0],[23,26,0],[27,34,1],[32,40,1],[38,46,1]],101:[[4,3,0],[4,4,0],[5,4,0],[6,5,0],[7,6,0],[8,7,0],[10,9,0],[11,10,0],[13,12,0],[16,15,0],[19,17,0],[22,22,1],[26,26,1],[31,30,1]],102:[[5,6,1],[5,8,2],[6,8,2],[7,10,2],[8,12,3],[9,14,3],[10,18,4],[12,19,4],[14,25,5],[16,30,6],[19,35,8],[23,44,10],[27,52,12],[32,60,13]],103:[[4,4,1],[5,6,2],[5,6,2],[6,7,2],[7,9,3],[9,10,3],[10,13,4],[12,14,4],[14,17,5],[17,21,6],[20,25,8],[23,31,10],[28,37,12],[33,43,14]],104:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[13,16,0],[16,19,0],[18,23,0],[22,27,0],[26,34,1],[31,40,1],[36,46,1]],105:[[3,5,0],[3,6,0],[4,6,0],[4,8,0],[5,10,0],[6,11,0],[7,14,0],[8,15,0],[10,18,0],[12,23,0],[14,26,0],[16,32,1],[19,38,1],[23,44,1]],106:[[4,6,1],[5,8,2],[5,8,2],[6,10,2],[7,13,3],[8,14,3],[9,18,4],[10,20,4],[12,24,5],[14,30,6],[17,34,8],[19,42,10],[23,49,12],[27,57,14]],107:[[4,5,0],[5,6,0],[5,6,0],[6,8,0],[7,9,0],[9,11,0],[10,14,0],[12,16,0],[14,19,0],[17,23,0],[20,27,0],[24,34,1],[28,40,1],[33,46,1]],108:[[3,5,0],[3,6,0],[4,6,0],[4,8,0],[5,9,0],[6,11,0],[7,14,0],[8,16,0],[9,19,0],[11,23,0],[13,27,0],[15,34,1],[18,40,1],[21,46,1]],109:[[6,3,0],[8,4,0],[9,4,0],[10,5,0],[12,6,0],[15,7,0],[17,9,0],[20,10,0],[24,12,0],[28,15,0],[34,17,0],[40,22,1],[48,26,1],[56,30,1]],110:[[5,3,0],[5,4,0],[6,4,0],[7,5,0],[9,6,0],[10,7,0],[12,9,0],[14,10,0],[17,12,0],[20,15,0],[24,17,0],[28,22,1],[33,26,1],[39,30,1]],111:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[9,7,0],[11,9,0],[12,10,0],[15,12,0],[18,15,0],[21,17,0],[25,22,1],[29,26,1],[35,30,1]],112:[[4,4,1],[5,6,2],[5,6,2],[6,7,2],[8,9,3],[9,10,3],[10,13,4],[12,14,4],[15,17,5],[17,21,6],[20,24,7],[24,30,9],[29,36,11],[34,43,14]],113:[[4,4,1],[5,6,2],[5,6,2],[6,7,2],[7,9,3],[9,10,3],[10,13,4],[12,14,4],[14,17,5],[17,21,6],[20,24,7],[24,30,9],[28,36,11],[34,42,13]],114:[[4,3,0],[5,4,0],[5,4,0],[6,5,0],[7,6,0],[9,7,0],[10,9,0],[12,10,0],[14,12,0],[16,15,0],[19,17,0],[23,22,1],[27,26,1],[32,30,1]],115:[[3,3,0],[4,4,0],[5,4,0],[5,5,0],[6,6,0],[7,7,0],[9,9,0],[10,11,1],[12,13,1],[14,16,1],[17,17,0],[20,22,1],[24,26,1],[28,30,1]],116:[[3,5,0],[4,6,0],[4,6,0],[5,7,0],[6,9,0],[7,10,0],[8,13,0],[9,15,0],[11,17,0],[13,22,0],[15,25,0],[18,30,1],[21,36,1],[25,42,1]],117:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[12,9,0],[14,10,0],[16,12,0],[19,15,0],[23,17,0],[27,22,1],[32,26,1],[38,30,1]],118:[[4,3,0],[5,4,0],[5,4,0],[6,5,0],[7,6,0],[9,7,0],[10,9,0],[12,10,0],[14,12,0],[17,15,0],[20,17,0],[23,22,1],[28,26,1],[33,30,1]],119:[[5,3,0],[6,4,0],[7,4,0],[9,5,0],[10,6,0],[12,7,0],[14,9,0],[17,10,0],[20,12,0],[23,15,0],[28,17,0],[33,22,1],[39,26,1],[46,30,1]],120:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[9,7,0],[10,9,0],[12,10,0],[15,12,0],[17,15,0],[21,17,0],[24,22,1],[29,26,1],[34,30,1]],121:[[4,4,1],[5,6,2],[6,6,2],[7,7,2],[8,9,3],[9,10,3],[11,13,4],[13,14,4],[15,17,5],[18,21,6],[21,25,8],[25,31,10],[29,37,12],[35,43,14]],122:[[4,3,0],[4,4,0],[5,4,0],[6,5,0],[7,6,0],[8,7,0],[10,9,0],[11,10,0],[13,12,0],[16,15,0],[19,17,0],[22,22,1],[26,26,1],[31,30,1]],126:[[4,1,-1],[5,1,-2],[6,1,-2],[7,2,-2],[8,2,-3],[10,2,-3],[12,3,-3],[14,4,-4],[16,3,-6],[19,4,-7],[23,5,-8],[27,5,-10],[32,7,-12],[38,7,-14]],163:[[5,5,0],[6,6,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[17,15,0],[20,20,0],[24,24,0],[28,27,0],[33,34,1],[39,41,1],[47,48,1]],305:[[3,3,0],[3,4,0],[4,4,0],[4,5,0],[5,6,0],[6,7,0],[7,9,0],[8,10,0],[10,12,0],[12,15,0],[14,17,0],[16,22,1],[19,26,1],[23,30,1]],567:[[4,4,1],[4,6,2],[5,6,2],[5,7,2],[6,9,3],[7,10,3],[8,13,4],[9,14,4],[11,17,5],[12,21,6],[15,25,8],[18,31,10],[21,37,12],[24,43,14]],915:[[5,5,0],[6,6,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[17,15,0],[20,19,0],[24,23,0],[28,26,0],[33,33,0],[39,38,0],[47,45,0]],916:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,15,0],[21,20,0],[25,24,0],[30,28,0],[35,34,0],[42,41,0],[50,47,0]],920:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[11,9,0],[14,11,0],[16,14,0],[19,16,1],[22,21,1],[26,25,1],[31,27,0],[37,35,1],[44,42,1],[52,48,1]],923:[[5,5,0],[6,7,1],[7,7,1],[8,9,1],[9,10,1],[11,12,1],[13,15,1],[15,16,1],[18,21,1],[22,25,1],[26,28,1],[31,35,1],[36,42,1],[43,48,1]],926:[[6,6,1],[7,7,1],[8,7,1],[9,9,1],[11,10,1],[13,12,1],[15,15,1],[18,16,1],[21,20,1],[25,24,1],[30,27,1],[36,33,0],[42,40,1],[50,46,1]],928:[[6,5,0],[8,6,0],[9,6,0],[11,8,0],[12,9,0],[15,11,0],[17,14,0],[20,15,0],[24,19,0],[29,23,0],[34,26,0],[40,33,0],[48,39,0],[57,45,0]],931:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[11,9,0],[13,11,0],[16,14,0],[19,15,0],[22,19,0],[26,23,0],[31,26,0],[37,33,0],[44,39,0],[52,45,0]],933:[[6,5,0],[7,6,0],[9,6,0],[10,8,0],[12,9,0],[14,11,0],[17,14,0],[20,15,0],[23,20,0],[28,24,0],[33,27,0],[39,33,0],[46,40,0],[55,46,0]],934:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[17,15,0],[21,19,0],[24,23,0],[29,26,0],[34,33,0],[41,39,0],[48,45,0]],936:[[6,5,0],[7,6,0],[9,6,0],[10,8,0],[12,9,0],[14,11,0],[17,14,0],[20,15,0],[23,19,0],[28,23,0],[33,26,0],[39,33,0],[46,39,0],[55,45,0]],937:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,15,0],[21,20,0],[25,24,0],[30,27,0],[36,34,0],[42,40,0],[50,47,0]]},MathJax_Main:{32:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],33:[[2,5,0],[2,6,0],[2,8,0],[3,8,0],[3,9,0],[4,12,0],[4,14,0],[5,18,0],[6,21,0],[7,24,0],[8,29,0],[10,34,0],[11,40,0],[14,48,0]],34:[[3,3,-2],[4,3,-3],[4,4,-4],[5,4,-4],[6,5,-4],[7,6,-6],[8,7,-7],[9,8,-9],[11,10,-10],[13,11,-12],[15,13,-15],[18,15,-18],[21,18,-21],[25,22,-25]],35:[[6,6,1],[7,8,2],[8,10,2],[10,10,2],[11,12,3],[13,16,4],[16,18,4],[19,22,5],[22,26,6],[26,30,7],[31,35,8],[37,42,9],[43,50,11],[52,60,13]],36:[[4,6,1],[4,8,1],[5,10,1],[6,9,1],[7,11,1],[8,15,1],[9,17,1],[11,20,1],[13,24,2],[15,27,2],[18,33,2],[21,38,2],[25,45,3],[30,54,3]],37:[[6,6,1],[7,8,1],[8,10,1],[10,10,1],[11,11,1],[13,15,1],[16,16,1],[19,20,1],[22,24,2],[26,29,3],[31,33,3],[37,38,3],[43,46,3],[52,54,4]],38:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[17,19,1],[21,22,1],[24,25,1],[29,30,0],[34,35,2],[41,41,1],[48,49,1]],39:[[2,3,-2],[2,3,-3],[3,4,-4],[3,4,-4],[3,5,-4],[4,6,-6],[5,7,-7],[5,8,-9],[6,10,-10],[7,11,-12],[9,13,-15],[10,15,-18],[12,18,-21],[14,22,-25]],40:[[3,7,2],[3,9,2],[4,12,3],[4,12,3],[5,14,3],[6,18,4],[7,21,5],[8,25,6],[10,29,7],[11,34,8],[13,41,10],[16,47,12],[19,56,14],[22,67,17]],41:[[3,7,2],[3,9,2],[3,12,3],[4,12,3],[5,14,3],[5,18,4],[6,21,5],[7,25,6],[9,29,7],[10,34,8],[12,41,10],[14,47,12],[17,56,14],[20,67,17]],42:[[3,3,-3],[4,4,-3],[5,5,-4],[6,5,-4],[6,6,-4],[8,8,-6],[9,9,-7],[10,11,-8],[12,13,-9],[15,15,-11],[17,18,-13],[20,21,-15],[24,25,-18],[29,29,-21]],43:[[5,5,1],[6,6,1],[8,8,1],[9,8,1],[10,9,1],[12,12,1],[14,14,2],[17,17,2],[20,20,2],[24,23,3],[28,27,3],[34,32,4],[40,38,5],[48,45,5]],44:[[2,2,1],[2,4,2],[3,4,2],[3,4,2],[3,5,3],[4,7,4],[5,7,4],[5,8,5],[6,10,6],[7,12,7],[9,13,8],[10,15,9],[12,18,11],[14,22,13]],45:[[2,1,-1],[3,1,-1],[3,1,-2],[4,1,-2],[4,1,-2],[5,3,-2],[6,3,-3],[7,2,-4],[8,3,-5],[10,3,-6],[11,3,-7],[13,4,-8],[16,5,-10],[19,5,-12]],46:[[2,1,0],[2,2,0],[2,2,0],[3,2,0],[3,2,0],[4,3,0],[4,3,0],[5,3,0],[6,4,0],[7,5,0],[8,5,0],[10,6,0],[11,7,0],[14,9,0]],47:[[4,7,2],[4,9,2],[5,11,3],[6,11,3],[7,14,3],[8,18,4],[9,20,5],[11,25,6],[13,29,7],[15,34,8],[18,40,10],[21,47,12],[25,56,14],[30,67,17]],48:[[4,5,0],[4,6,0],[5,8,0],[6,8,0],[7,9,0],[8,12,0],[9,14,0],[11,18,1],[13,21,1],[16,25,1],[18,28,0],[22,32,1],[26,39,1],[31,46,1]],49:[[3,5,0],[4,6,0],[5,8,0],[6,8,0],[6,9,0],[8,12,0],[9,14,0],[10,17,0],[12,20,0],[15,23,0],[17,27,0],[20,31,0],[24,37,0],[29,45,0]],50:[[4,5,0],[4,6,0],[5,8,0],[6,8,0],[7,9,0],[8,12,0],[9,14,0],[11,17,0],[13,20,0],[15,23,0],[18,27,0],[21,32,0],[25,37,0],[30,45,0]],51:[[4,5,0],[4,6,0],[5,8,0],[6,8,0],[7,9,0],[8,12,0],[9,14,0],[11,18,1],[13,21,1],[15,24,1],[18,28,0],[22,32,0],[26,39,0],[30,46,0]],52:[[4,5,0],[4,6,0],[5,8,0],[6,8,0],[7,9,0],[8,12,0],[10,14,0],[11,17,0],[14,20,0],[16,23,0],[19,27,0],[22,32,0],[27,38,0],[31,46,0]],53:[[4,5,0],[4,6,0],[5,8,0],[6,8,0],[7,10,0],[8,12,0],[9,14,0],[11,18,1],[13,21,1],[15,24,1],[18,28,1],[21,32,1],[25,39,1],[30,47,2]],54:[[4,5,0],[4,6,0],[5,8,0],[6,8,0],[7,9,0],[8,12,0],[9,14,0],[11,18,1],[13,21,1],[15,24,1],[18,28,0],[22,33,2],[26,39,1],[30,46,1]],55:[[4,5,0],[5,6,0],[5,8,0],[6,8,0],[7,10,0],[9,12,0],[10,14,0],[12,18,1],[14,21,1],[16,24,1],[19,27,0],[23,33,1],[27,39,1],[32,47,1]],56:[[4,5,0],[4,6,0],[5,8,0],[6,8,0],[7,9,0],[8,12,0],[9,14,0],[11,18,1],[13,21,1],[16,24,1],[18,28,0],[22,32,1],[26,39,1],[31,46,1]],57:[[4,5,0],[4,6,0],[5,8,0],[6,8,0],[7,9,0],[8,12,0],[9,14,0],[11,18,1],[13,20,1],[16,23,1],[18,28,0],[22,32,1],[26,38,1],[31,46,1]],58:[[2,3,0],[2,4,0],[2,5,0],[3,5,0],[3,6,0],[4,8,0],[4,9,0],[5,11,0],[6,13,0],[7,14,0],[8,17,0],[10,20,0],[11,24,0],[14,29,0]],59:[[2,4,1],[2,6,2],[2,7,2],[3,7,2],[3,9,3],[4,12,4],[4,13,4],[5,16,5],[6,19,6],[7,21,7],[8,25,8],[10,29,9],[12,35,11],[14,42,13]],60:[[5,4,0],[6,6,0],[7,7,0],[9,7,0],[10,8,0],[12,11,0],[14,12,0],[17,15,1],[20,17,1],[23,20,1],[28,24,2],[33,28,2],[39,33,2],[46,39,3]],61:[[5,2,-1],[6,3,-1],[8,3,-1],[9,3,-1],[10,4,-2],[12,4,-2],[15,5,-3],[17,6,-3],[20,8,-3],[24,10,-4],[29,10,-5],[34,11,-6],[40,13,-7],[48,16,-9]],62:[[5,4,0],[6,6,0],[7,7,0],[9,7,0],[10,8,1],[12,11,1],[14,12,1],[17,15,1],[20,17,1],[23,20,1],[28,24,2],[33,28,2],[39,33,2],[46,39,3]],63:[[3,5,0],[4,6,0],[5,8,0],[5,8,0],[6,9,0],[7,12,0],[9,14,0],[10,18,0],[12,21,0],[14,24,0],[17,29,0],[20,33,0],[23,40,0],[28,47,0]],64:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[10,9,0],[12,12,0],[15,14,0],[17,18,0],[20,21,0],[24,24,0],[29,30,0],[34,34,0],[40,40,0],[48,48,0]],65:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[10,9,0],[12,12,0],[14,14,0],[17,18,0],[20,21,0],[24,24,0],[29,29,0],[34,34,0],[40,40,0],[48,48,0]],66:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[13,14,0],[16,17,0],[18,20,0],[22,23,0],[26,27,0],[31,32,0],[36,38,0],[43,46,0]],67:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[10,9,0],[12,12,0],[13,14,0],[16,19,1],[19,22,1],[22,25,1],[27,29,0],[31,34,1],[37,41,1],[44,49,1]],68:[[5,5,0],[6,6,0],[7,8,0],[9,8,0],[10,9,0],[12,12,0],[14,14,0],[17,17,0],[20,20,0],[24,23,0],[28,28,0],[33,32,0],[40,38,0],[47,46,0]],69:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[13,14,0],[16,17,0],[18,20,0],[22,23,0],[26,27,0],[31,32,0],[36,38,0],[43,46,0]],70:[[5,5,0],[6,6,0],[6,8,0],[8,8,0],[9,9,0],[11,12,0],[12,14,0],[15,17,0],[17,20,0],[20,23,0],[24,27,0],[29,32,0],[34,38,0],[40,46,0]],71:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[17,19,1],[21,22,1],[25,25,1],[29,29,0],[34,35,2],[41,42,2],[49,49,2]],72:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[17,17,0],[21,20,0],[24,23,0],[29,27,0],[34,32,0],[41,38,0],[48,46,0]],73:[[3,5,0],[3,6,0],[4,8,0],[4,8,0],[5,9,0],[6,12,0],[7,14,0],[8,17,0],[10,20,0],[12,23,0],[14,27,0],[16,32,0],[19,38,0],[23,46,0]],74:[[4,5,0],[4,6,0],[5,8,0],[6,8,0],[7,9,0],[8,12,0],[10,14,0],[11,18,1],[13,21,1],[16,24,1],[19,27,0],[22,32,0],[26,39,1],[31,47,1]],75:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[18,17,0],[21,20,0],[25,23,0],[29,27,0],[35,32,0],[41,38,0],[49,46,0]],76:[[5,5,0],[5,6,0],[6,8,0],[7,8,0],[9,9,0],[10,12,0],[12,14,0],[14,17,0],[17,20,0],[20,23,0],[23,27,0],[28,32,0],[33,38,0],[39,46,0]],77:[[7,5,0],[8,6,0],[9,8,0],[11,8,0],[13,9,0],[15,12,0],[18,14,0],[21,17,0],[25,20,0],[30,23,0],[35,28,0],[42,32,0],[50,38,0],[59,46,0]],78:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[17,17,0],[21,20,0],[24,23,0],[29,27,0],[34,32,0],[41,38,0],[48,46,0]],79:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[10,9,0],[12,12,0],[15,14,0],[17,19,1],[20,22,1],[24,25,1],[29,29,0],[34,34,1],[40,41,1],[48,49,1]],80:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[13,14,0],[15,17,0],[18,20,0],[21,23,0],[25,27,0],[29,32,0],[35,38,0],[42,46,0]],81:[[6,6,1],[7,8,2],[8,10,2],[9,10,2],[11,12,3],[13,16,4],[15,18,4],[17,23,5],[21,27,6],[24,31,7],[29,36,8],[34,42,9],[41,51,11],[48,60,13]],82:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[17,18,1],[21,21,1],[25,24,1],[29,27,0],[34,32,0],[41,39,1],[49,48,2]],83:[[4,5,0],[5,6,0],[5,8,0],[6,8,0],[7,9,0],[9,12,0],[10,14,0],[12,19,1],[14,22,1],[17,25,1],[20,29,0],[24,34,1],[28,41,1],[33,49,1]],84:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[10,9,0],[12,12,0],[14,14,0],[16,17,0],[19,20,0],[23,23,0],[27,27,0],[32,32,0],[38,38,0],[45,46,0]],85:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[17,18,1],[21,21,1],[24,24,1],[29,27,0],[34,33,1],[41,40,2],[48,48,2]],86:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[17,18,1],[21,21,1],[24,24,1],[29,27,0],[34,34,2],[41,40,2],[48,48,2]],87:[[7,5,0],[9,6,0],[10,8,0],[12,8,0],[14,9,0],[17,12,0],[20,14,0],[24,18,1],[28,21,1],[34,24,1],[40,27,0],[47,34,2],[56,40,2],[67,48,2]],88:[[5,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[17,17,0],[21,20,0],[24,23,0],[29,27,0],[34,32,0],[41,38,0],[48,46,0]],89:[[6,6,1],[7,7,1],[8,9,1],[9,9,1],[11,10,1],[13,13,1],[15,15,1],[18,18,1],[21,21,1],[25,24,1],[29,28,1],[35,33,1],[41,39,1],[49,47,1]],90:[[4,6,1],[5,7,1],[6,9,1],[7,9,1],[8,10,1],[10,13,1],[11,15,1],[13,18,1],[16,21,1],[19,24,1],[22,27,0],[26,32,0],[31,38,0],[37,46,0]],91:[[2,7,2],[3,10,3],[3,12,3],[3,12,3],[4,14,4],[5,18,5],[5,20,5],[6,25,6],[8,30,8],[9,35,9],[10,40,10],[12,47,12],[15,56,14],[17,67,17]],92:[[4,7,2],[4,9,2],[5,11,3],[6,11,3],[7,14,3],[8,18,4],[9,20,5],[11,25,6],[13,29,7],[15,34,8],[18,40,10],[21,47,12],[25,56,14],[30,67,17]],93:[[2,7,2],[2,10,3],[2,12,3],[2,12,3],[3,14,4],[3,18,5],[4,20,5],[4,25,6],[5,30,8],[6,35,9],[7,40,10],[8,47,12],[9,56,14],[11,67,17]],94:[[3,2,-3],[4,3,-4],[4,3,-5],[5,3,-5],[6,3,-7],[7,4,-9],[8,4,-10],[9,5,-13],[11,6,-15],[13,7,-17],[16,7,-21],[18,9,-24],[22,10,-29],[26,12,-35]],95:[[4,2,1],[5,2,1],[5,2,1],[6,2,1],[7,2,1],[9,2,1],[10,2,1],[12,3,2],[14,4,3],[17,4,3],[20,4,3],[24,4,3],[28,4,3],[33,5,4]],96:[[3,2,-3],[3,2,-4],[3,3,-5],[4,3,-5],[5,3,-6],[5,4,-8],[6,4,-10],[7,6,-12],[9,7,-14],[10,7,-17],[12,8,-20],[14,10,-23],[17,11,-28],[20,13,-34]],97:[[4,3,0],[5,4,0],[5,5,0],[6,5,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,13,0],[17,15,0],[20,18,0],[23,21,0],[28,26,0],[33,31,0]],98:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[9,12,0],[11,14,0],[13,17,0],[15,20,0],[18,23,0],[21,29,0],[25,33,0],[29,40,0],[35,47,0]],99:[[3,3,0],[4,4,0],[5,5,0],[5,5,0],[6,6,0],[7,8,0],[9,9,0],[10,11,0],[12,13,0],[14,15,0],[17,18,0],[20,21,0],[23,26,0],[28,31,0]],100:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[9,12,0],[11,14,0],[13,17,0],[15,20,0],[18,23,0],[21,29,0],[25,33,0],[30,40,0],[36,47,0]],101:[[3,3,0],[4,4,0],[5,5,0],[5,5,0],[6,6,0],[7,8,0],[9,9,0],[10,11,0],[12,13,0],[14,15,0],[17,18,0],[20,21,0],[23,26,0],[28,31,0]],102:[[3,5,0],[4,6,0],[4,8,0],[5,8,0],[6,9,0],[7,12,0],[8,14,0],[9,18,0],[11,21,0],[13,24,0],[15,29,0],[18,33,0],[21,40,0],[25,47,0]],103:[[4,4,1],[5,6,2],[5,7,2],[6,7,2],[7,9,3],[9,12,4],[10,13,4],[12,16,5],[14,19,6],[16,22,7],[19,26,8],[23,30,9],[27,37,11],[32,44,13]],104:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[10,12,0],[11,14,0],[13,17,0],[16,20,0],[18,23,0],[22,27,0],[26,32,0],[31,38,0],[36,46,0]],105:[[2,5,0],[3,6,0],[3,8,0],[3,8,0],[4,9,0],[5,12,0],[5,14,0],[6,17,0],[8,20,0],[9,23,0],[10,27,0],[12,32,0],[15,37,0],[17,45,0]],106:[[3,6,1],[3,8,2],[4,10,2],[4,10,2],[5,12,3],[5,16,4],[7,18,4],[8,22,5],[9,26,6],[10,30,7],[12,35,8],[14,41,9],[17,49,11],[19,59,13]],107:[[4,5,0],[5,6,0],[6,8,0],[6,8,0],[8,9,0],[9,12,0],[10,14,0],[12,18,0],[15,21,0],[17,24,0],[20,28,0],[24,33,0],[29,39,0],[34,47,0]],108:[[2,5,0],[3,6,0],[3,8,0],[4,8,0],[4,9,0],[5,12,0],[6,14,0],[7,17,0],[8,20,0],[9,23,0],[11,28,0],[13,33,0],[15,39,0],[18,47,0]],109:[[6,3,0],[7,4,0],[9,5,0],[10,5,0],[12,6,0],[14,8,0],[16,9,0],[20,11,0],[23,13,0],[27,14,0],[33,17,0],[39,20,0],[46,25,0],[54,30,0]],110:[[4,3,0],[5,4,0],[6,5,0],[7,5,0],[8,6,0],[10,8,0],[11,9,0],[13,11,0],[16,13,0],[18,14,0],[22,17,0],[26,20,0],[31,24,0],[36,30,0]],111:[[4,3,0],[4,4,0],[5,5,0],[6,5,0],[7,6,0],[8,8,0],[10,9,0],[11,11,0],[14,13,0],[16,15,0],[19,18,0],[22,21,0],[27,26,0],[31,31,0]],112:[[4,4,1],[5,6,2],[6,7,2],[7,7,2],[8,9,3],[9,12,4],[11,13,4],[13,16,5],[15,19,6],[18,21,7],[21,25,8],[25,29,9],[29,36,11],[35,43,13]],113:[[4,4,1],[5,6,2],[6,7,2],[7,7,2],[8,9,3],[9,12,4],[11,13,4],[13,16,5],[15,19,6],[18,22,7],[21,26,8],[25,30,9],[30,36,11],[36,43,13]],114:[[3,3,0],[4,5,1],[4,6,1],[5,6,1],[6,7,1],[7,9,1],[8,10,1],[9,12,1],[11,14,1],[12,15,1],[15,18,1],[17,21,1],[21,26,1],[24,30,1]],115:[[3,3,0],[3,4,0],[4,5,0],[5,5,0],[5,6,0],[6,8,0],[7,9,0],[9,11,0],[10,13,0],[12,15,0],[14,18,0],[17,21,0],[20,26,0],[24,31,0]],116:[[3,4,0],[3,6,0],[4,7,0],[4,7,0],[5,9,0],[6,11,0],[7,13,0],[8,16,0],[10,18,0],[11,21,0],[13,25,0],[16,29,0],[19,35,0],[22,42,0]],117:[[4,3,0],[5,4,0],[6,5,0],[7,5,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,13,0],[18,15,0],[22,18,0],[26,21,0],[30,26,0],[36,31,1]],118:[[4,3,0],[5,4,0],[5,5,0],[6,5,0],[8,6,0],[9,8,0],[10,9,0],[12,11,0],[15,13,0],[17,14,0],[20,17,0],[24,20,0],[29,25,0],[34,30,0]],119:[[5,3,0],[6,4,0],[7,5,0],[9,5,0],[10,6,0],[12,8,0],[14,9,0],[17,11,0],[20,13,0],[23,14,0],[28,17,0],[33,20,0],[39,25,0],[46,30,0]],120:[[4,4,1],[5,5,1],[6,6,1],[7,6,1],[8,7,1],[9,9,1],[11,10,1],[12,12,1],[15,14,1],[17,15,1],[21,18,1],[24,21,1],[29,25,1],[34,30,1]],121:[[4,4,1],[5,6,2],[5,7,2],[6,7,2],[8,9,3],[9,12,4],[10,13,4],[12,16,5],[15,19,6],[17,21,7],[20,25,8],[24,29,9],[29,36,11],[34,43,13]],122:[[3,3,0],[4,4,0],[4,5,0],[5,5,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[12,13,0],[14,14,0],[16,17,0],[19,20,0],[23,25,0],[27,29,0]],123:[[3,7,2],[4,10,3],[5,12,3],[6,12,3],[6,14,4],[8,18,5],[9,20,5],[11,25,6],[12,30,8],[15,35,9],[17,41,11],[21,47,12],[24,56,14],[29,67,17]],124:[[2,7,2],[2,9,2],[2,12,3],[2,12,3],[3,14,3],[3,18,4],[4,21,5],[4,25,6],[5,29,7],[6,34,8],[7,41,10],[8,47,12],[9,56,14],[11,67,17]],125:[[3,7,2],[4,10,3],[5,12,3],[6,12,3],[6,14,4],[8,18,5],[9,20,5],[11,25,6],[12,30,8],[15,34,9],[17,42,11],[21,47,12],[24,56,14],[29,67,17]],126:[[3,1,-1],[4,1,-2],[5,1,-2],[5,1,-2],[6,1,-3],[7,3,-3],[9,4,-4],[10,3,-5],[12,3,-6],[14,4,-7],[17,4,-9],[20,5,-10],[23,6,-12],[28,7,-14]],160:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],168:[[3,1,-4],[4,2,-4],[4,2,-6],[5,2,-6],[6,2,-7],[7,3,-9],[8,3,-11],[10,3,-14],[12,4,-16],[14,4,-19],[16,5,-22],[19,6,-26],[23,7,-31],[27,8,-37]],172:[[5,3,0],[6,3,0],[6,4,0],[8,4,0],[9,4,-1],[11,5,-2],[12,6,-1],[15,7,-2],[17,8,-2],[21,10,-3],[24,11,-4],[29,13,-4],[34,16,-5],[41,18,-6]],175:[[3,1,-3],[4,1,-5],[5,1,-6],[6,1,-6],[6,1,-7],[8,1,-10],[9,1,-11],[10,2,-13],[12,3,-15],[15,2,-18],[17,2,-22],[20,3,-26],[24,3,-30],[29,4,-36]],176:[[3,2,-3],[3,2,-4],[4,2,-6],[5,2,-6],[5,3,-6],[6,3,-9],[7,4,-10],[9,5,-13],[10,6,-15],[12,7,-17],[14,8,-22],[17,8,-25],[20,10,-30],[24,12,-36]],177:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[10,9,0],[12,12,0],[15,14,0],[17,17,0],[20,20,0],[24,23,0],[29,27,0],[34,31,0],[40,37,0],[48,45,0]],180:[[3,2,-3],[4,2,-4],[4,3,-5],[5,3,-5],[6,3,-6],[7,4,-8],[8,5,-9],[10,6,-12],[11,7,-14],[13,7,-17],[16,9,-19],[19,10,-23],[22,12,-28],[26,13,-34]],215:[[5,4,0],[6,5,0],[7,6,0],[8,6,0],[9,7,0],[11,9,0],[13,10,0],[15,12,0],[18,14,0],[21,17,0],[25,20,0],[30,23,0],[36,27,-1],[42,33,-1]],247:[[5,4,0],[6,6,0],[8,7,0],[9,7,0],[10,8,0],[12,10,0],[15,12,0],[17,15,1],[20,18,1],[24,19,1],[29,23,1],[34,27,2],[40,32,2],[48,39,2]],305:[[2,3,0],[3,4,0],[3,5,0],[3,5,0],[4,6,0],[5,8,0],[5,9,0],[6,11,0],[8,13,0],[9,15,0],[10,18,0],[12,21,0],[15,25,0],[17,30,0]],567:[[3,4,1],[3,6,2],[4,7,2],[4,7,2],[5,9,3],[5,12,4],[7,13,4],[8,16,5],[9,19,6],[10,22,7],[12,26,8],[14,30,9],[17,36,11],[19,44,13]],710:[[3,2,-3],[4,3,-4],[4,3,-5],[5,3,-5],[6,3,-7],[7,4,-9],[8,4,-10],[9,5,-13],[11,6,-15],[13,7,-17],[16,7,-21],[18,9,-24],[22,10,-29],[26,12,-35]],711:[[3,1,-3],[4,1,-5],[4,2,-6],[5,2,-6],[6,2,-7],[7,3,-9],[8,3,-10],[9,3,-13],[11,4,-15],[13,5,-17],[16,6,-21],[18,6,-24],[22,8,-29],[26,9,-34]],713:[[3,1,-3],[4,1,-5],[5,1,-6],[6,1,-6],[6,1,-7],[8,1,-10],[9,1,-11],[10,2,-13],[12,3,-15],[15,2,-18],[17,2,-22],[20,3,-26],[24,3,-30],[29,4,-36]],714:[[3,2,-3],[4,2,-4],[4,3,-5],[5,3,-5],[6,3,-6],[7,4,-8],[8,5,-9],[10,6,-12],[11,7,-14],[13,7,-17],[16,9,-19],[19,10,-23],[22,12,-28],[26,13,-34]],715:[[3,2,-3],[3,2,-4],[3,3,-5],[4,3,-5],[5,3,-6],[5,4,-8],[6,4,-10],[7,6,-12],[9,7,-14],[10,7,-17],[12,8,-20],[14,10,-23],[17,11,-28],[20,13,-34]],728:[[3,2,-3],[4,2,-4],[4,2,-6],[5,2,-6],[6,3,-6],[7,3,-9],[8,4,-10],[10,5,-12],[12,5,-15],[14,6,-17],[16,7,-21],[19,9,-24],[23,10,-29],[27,12,-34]],729:[[3,1,-4],[3,2,-4],[4,2,-6],[4,2,-6],[5,2,-7],[6,3,-9],[7,3,-11],[8,3,-14],[9,4,-16],[11,5,-18],[13,5,-22],[15,6,-26],[18,7,-31],[21,9,-37]],732:[[3,1,-4],[4,1,-5],[5,1,-7],[5,1,-7],[6,1,-8],[7,3,-9],[9,3,-11],[10,3,-14],[12,3,-17],[14,4,-19],[17,4,-23],[20,5,-26],[23,6,-32],[28,7,-38]],915:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[10,12,0],[12,14,0],[14,17,0],[16,20,0],[20,23,0],[23,27,0],[27,32,0],[32,38,0],[39,46,0]],916:[[6,5,0],[7,6,0],[8,8,0],[10,8,0],[11,9,0],[14,12,0],[16,14,0],[19,18,0],[22,21,0],[26,24,0],[31,29,0],[37,34,0],[44,40,0],[52,48,0]],920:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[10,9,0],[12,12,0],[15,14,0],[17,19,1],[20,22,1],[24,25,1],[29,29,0],[34,34,1],[40,41,1],[48,49,1]],923:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[10,9,0],[11,12,0],[13,14,0],[16,18,0],[19,21,0],[22,24,0],[26,29,0],[31,34,0],[37,40,0],[44,48,0]],926:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[13,14,0],[15,17,0],[18,20,0],[21,23,0],[25,27,0],[29,32,0],[35,38,0],[42,46,0]],928:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[17,17,0],[21,20,0],[24,23,0],[29,27,0],[34,32,0],[41,38,0],[48,46,0]],931:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[10,9,0],[12,12,0],[13,14,0],[16,17,0],[19,20,0],[22,23,0],[27,27,0],[31,32,0],[37,38,0],[44,46,0]],933:[[5,5,0],[6,6,0],[8,8,0],[9,8,0],[10,9,0],[12,12,0],[14,14,0],[17,18,0],[20,21,0],[24,24,0],[29,28,0],[34,33,0],[40,40,0],[48,47,0]],934:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[10,9,0],[12,12,0],[13,14,0],[16,17,0],[19,20,0],[22,23,0],[27,27,0],[31,32,0],[37,38,0],[44,46,0]],936:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[17,17,0],[21,20,0],[24,23,0],[29,27,0],[34,32,0],[41,38,0],[48,46,0]],937:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[10,9,0],[12,12,0],[14,14,0],[16,18,0],[19,21,0],[23,24,0],[27,29,0],[32,33,0],[38,40,0],[45,47,0]],8194:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],8195:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],8196:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],8197:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],8198:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],8201:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],8202:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],8211:[[4,1,-1],[5,1,-2],[5,1,-2],[6,1,-2],[7,1,-3],[9,1,-4],[10,1,-5],[12,1,-6],[14,2,-6],[17,3,-8],[20,3,-9],[24,2,-12],[28,3,-14],[33,3,-17]],8212:[[7,1,-1],[9,1,-2],[10,1,-2],[12,1,-2],[14,1,-3],[17,1,-4],[20,1,-5],[24,1,-6],[28,2,-6],[33,3,-8],[40,3,-9],[47,2,-12],[56,3,-14],[66,3,-17]],8216:[[2,2,-3],[2,4,-2],[2,4,-4],[3,4,-4],[3,4,-5],[4,6,-6],[4,7,-7],[5,8,-9],[6,9,-11],[7,11,-12],[8,13,-15],[10,15,-18],[11,18,-21],[14,21,-25]],8217:[[2,3,-2],[2,3,-3],[3,4,-4],[3,4,-4],[3,5,-4],[4,6,-6],[5,7,-7],[5,8,-9],[6,10,-10],[7,11,-12],[9,13,-15],[10,15,-18],[12,18,-21],[14,22,-25]],8220:[[4,2,-3],[4,4,-2],[5,4,-4],[6,4,-4],[7,4,-5],[8,6,-6],[10,7,-7],[11,8,-9],[13,9,-11],[16,11,-12],[19,13,-15],[22,15,-18],[26,18,-21],[31,21,-25]],8221:[[3,3,-2],[4,3,-3],[4,4,-4],[5,4,-4],[6,5,-4],[7,6,-6],[8,7,-7],[9,8,-9],[11,10,-10],[13,11,-12],[15,13,-15],[18,15,-18],[21,18,-21],[25,22,-25]],8224:[[3,6,1],[4,8,2],[4,10,2],[5,10,2],[6,12,3],[7,16,4],[8,18,4],[9,23,5],[11,27,6],[13,31,7],[16,37,8],[18,44,11],[22,52,12],[26,62,15]],8225:[[3,6,1],[4,8,2],[4,10,2],[5,10,2],[6,12,3],[7,16,4],[8,18,4],[10,23,5],[11,27,6],[13,31,7],[16,37,8],[19,43,9],[22,51,11],[26,61,13]],8230:[[8,1,0],[10,2,0],[11,2,0],[13,2,0],[16,2,0],[19,3,0],[22,3,0],[26,3,0],[31,4,0],[36,5,0],[43,5,0],[51,6,0],[61,7,0],[72,9,0]],8242:[[2,4,0],[3,5,0],[3,6,0],[4,6,0],[4,7,-1],[5,9,-1],[6,11,-1],[7,13,-1],[8,15,-1],[9,18,-1],[11,21,-2],[13,24,-2],[15,29,-2],[18,35,-3]],8407:[[4,2,-3],[4,2,-4],[5,3,-5],[6,3,-6],[7,3,-7],[8,4,-8],[10,5,-9],[11,5,-12],[14,6,-14],[16,7,-17],[18,9,-20],[21,10,-24],[26,12,-28],[30,14,-33]],8463:[[4,6,1],[5,7,1],[6,7,0],[7,10,1],[8,11,1],[10,13,1],[11,15,1],[13,18,1],[16,21,1],[19,25,1],[22,29,1],[26,34,1],[31,40,1],[37,47,1]],8465:[[5,6,1],[6,7,1],[7,8,1],[8,9,0],[10,11,1],[12,13,1],[14,15,1],[17,18,1],[20,21,1],[23,25,1],[28,29,1],[33,34,1],[39,40,1],[46,48,1]],8467:[[4,5,0],[4,7,1],[4,8,1],[5,10,1],[6,11,1],[7,13,1],[8,15,1],[10,18,1],[12,21,1],[14,25,1],[16,29,1],[19,34,1],[23,41,2],[27,49,2]],8472:[[5,5,2],[5,6,2],[6,7,2],[8,9,3],[9,10,3],[11,12,4],[13,13,4],[15,16,5],[18,19,6],[21,23,8],[25,27,9],[29,32,11],[35,37,12],[41,45,15]],8476:[[6,5,0],[6,6,0],[7,8,0],[9,9,0],[11,11,1],[13,13,1],[15,16,1],[17,18,1],[21,22,1],[24,25,1],[29,30,1],[34,35,1],[40,41,1],[48,50,2]],8501:[[4,5,0],[5,6,0],[6,7,0],[7,9,0],[8,10,0],[10,12,0],[11,14,0],[13,17,0],[16,20,0],[19,23,0],[22,28,0],[26,33,0],[31,39,0],[37,46,0]],8592:[[7,5,1],[8,5,0],[10,6,1],[12,7,1],[14,9,1],[16,9,0],[19,11,1],[22,13,1],[27,15,1],[32,18,1],[37,22,1],[44,25,1],[53,30,1],[63,35,1]],8593:[[4,7,2],[5,8,2],[5,9,2],[6,12,3],[7,13,3],[9,16,4],[10,18,4],[11,22,5],[13,26,6],[16,30,7],[19,36,8],[22,42,9],[27,50,11],[32,59,13]],8594:[[7,5,1],[8,5,0],[10,7,1],[12,7,1],[14,9,1],[16,9,0],[19,11,1],[22,13,1],[27,15,1],[32,18,1],[37,22,1],[44,25,1],[53,30,1],[63,35,1]],8595:[[4,7,2],[5,8,2],[5,9,2],[6,12,3],[7,13,3],[9,16,4],[10,18,4],[12,22,5],[14,26,6],[16,30,7],[19,36,8],[23,42,9],[27,50,11],[32,59,13]],8596:[[7,5,1],[8,5,0],[10,7,1],[12,7,1],[14,9,1],[16,9,0],[19,11,1],[22,13,1],[27,15,1],[32,18,1],[37,22,1],[44,25,1],[53,30,1],[63,35,1]],8597:[[4,8,2],[5,10,3],[5,11,3],[6,14,4],[7,15,4],[9,18,5],[10,22,6],[12,25,7],[14,30,8],[16,35,9],[19,42,11],[23,49,13],[27,59,16],[32,69,18]],8598:[[7,7,2],[8,8,2],[10,10,2],[12,12,3],[14,13,3],[16,16,4],[19,19,4],[22,22,5],[27,26,6],[32,31,7],[38,37,8],[45,44,10],[53,52,12],[63,61,13]],8599:[[7,7,2],[9,8,2],[10,10,2],[12,12,3],[14,13,3],[16,16,4],[19,19,4],[23,22,5],[27,26,6],[32,31,7],[38,37,8],[46,44,10],[54,52,11],[64,61,13]],8600:[[7,7,2],[9,8,2],[10,10,3],[12,12,3],[14,13,3],[17,16,4],[19,19,5],[23,23,6],[27,26,6],[32,31,8],[38,37,9],[46,44,11],[54,52,13],[64,61,15]],8601:[[7,7,2],[8,8,2],[10,10,3],[12,12,3],[14,13,3],[16,16,4],[19,19,5],[22,23,6],[26,26,6],[32,31,8],[37,37,9],[44,44,11],[53,52,13],[63,61,15]],8614:[[7,5,1],[8,5,0],[10,7,1],[11,7,1],[14,9,1],[16,9,0],[19,11,1],[22,13,1],[27,15,1],[32,18,1],[37,22,1],[44,25,1],[53,30,1],[63,35,1]],8617:[[8,5,1],[9,5,0],[11,7,1],[13,7,1],[15,9,1],[18,9,0],[21,11,1],[25,13,1],[30,15,1],[36,18,1],[42,21,1],[50,25,1],[60,30,1],[71,35,1]],8618:[[8,5,1],[9,5,0],[11,7,1],[13,7,1],[15,9,1],[18,9,0],[21,11,1],[25,13,1],[30,15,1],[36,18,1],[42,22,1],[50,25,1],[60,30,1],[71,35,1]],8636:[[7,3,-1],[8,3,-2],[10,4,-2],[12,4,-2],[14,5,-3],[16,5,-4],[19,6,-4],[22,7,-5],[27,8,-6],[32,10,-7],[37,11,-9],[44,14,-10],[53,17,-12],[63,19,-15]],8637:[[7,3,1],[8,3,0],[10,4,1],[12,4,1],[14,5,1],[16,5,0],[19,7,1],[22,8,1],[27,9,1],[32,10,1],[37,12,1],[44,14,1],[53,16,1],[63,19,1]],8640:[[7,3,-1],[8,3,-2],[10,4,-2],[12,4,-2],[14,5,-3],[16,5,-4],[19,6,-4],[22,7,-5],[27,8,-6],[32,10,-7],[37,11,-9],[44,14,-10],[53,17,-12],[63,19,-15]],8641:[[7,3,1],[8,3,0],[10,4,1],[12,4,1],[14,5,1],[16,5,0],[19,7,1],[22,8,1],[27,9,1],[32,10,1],[37,12,1],[44,14,1],[53,16,1],[63,19,1]],8652:[[7,6,1],[8,6,0],[10,8,1],[12,9,1],[14,11,1],[16,11,0],[19,14,1],[22,17,1],[27,20,1],[32,24,1],[37,28,1],[44,33,1],[53,39,1],[63,45,1]],8656:[[7,5,1],[8,6,1],[10,7,1],[12,8,1],[14,9,1],[16,10,1],[19,11,1],[22,14,1],[27,16,1],[32,20,2],[37,23,2],[44,27,2],[53,31,2],[63,38,3]],8657:[[4,7,2],[5,8,2],[6,9,2],[7,12,3],[8,13,3],[10,16,4],[12,18,4],[14,22,5],[17,26,6],[20,30,7],[23,36,8],[28,43,10],[32,50,11],[38,59,13]],8658:[[7,5,1],[8,6,1],[10,7,1],[12,8,1],[14,9,1],[16,10,1],[19,12,1],[22,14,1],[27,16,1],[32,19,1],[37,22,1],[44,26,1],[53,32,2],[63,37,2]],8659:[[5,7,2],[5,8,2],[6,9,2],[7,12,3],[8,13,3],[10,16,4],[12,18,4],[14,22,5],[17,26,6],[20,30,7],[23,36,8],[28,43,10],[32,50,11],[39,59,13]],8660:[[7,5,1],[9,6,1],[10,7,1],[12,8,1],[14,9,1],[17,10,1],[19,12,1],[23,14,1],[27,16,1],[32,19,1],[38,23,2],[45,27,2],[54,31,2],[64,37,2]],8661:[[4,8,2],[5,10,3],[6,11,3],[7,14,4],[8,15,4],[10,18,5],[12,22,6],[14,26,7],[17,30,8],[20,35,9],[23,42,11],[28,50,13],[32,58,15],[39,70,18]],8704:[[4,6,1],[5,7,1],[6,8,1],[7,10,1],[8,11,1],[10,13,1],[11,15,1],[13,18,1],[16,20,1],[19,24,1],[22,29,1],[26,35,2],[31,41,2],[37,48,2]],8706:[[4,5,0],[5,6,0],[6,7,0],[7,9,0],[8,11,1],[10,13,1],[11,15,1],[14,18,1],[16,21,1],[19,25,1],[23,30,1],[27,35,1],[32,42,2],[38,50,2]],8707:[[4,5,0],[4,6,0],[5,7,0],[6,8,0],[7,10,0],[9,12,0],[10,14,0],[12,16,0],[14,20,0],[17,23,0],[20,28,0],[24,33,0],[28,39,0],[33,46,0]],8709:[[4,7,1],[4,8,1],[5,9,1],[6,12,2],[7,13,2],[8,15,2],[9,18,2],[11,22,3],[13,25,3],[16,29,3],[18,35,4],[22,40,4],[26,48,5],[31,57,6]],8711:[[6,6,1],[7,7,1],[8,8,1],[10,10,1],[11,11,1],[14,13,1],[16,15,1],[19,17,1],[22,20,1],[26,24,1],[31,29,2],[37,34,2],[44,40,2],[52,48,3]],8712:[[5,5,1],[5,6,1],[6,7,1],[7,8,1],[9,9,1],[10,10,1],[12,12,1],[14,14,1],[16,17,2],[20,20,2],[23,24,2],[27,28,2],[33,33,3],[39,39,3]],8713:[[4,7,2],[5,8,2],[6,11,3],[7,12,3],[8,13,3],[10,16,4],[12,20,5],[14,23,6],[16,27,7],[20,32,8],[23,37,9],[27,44,11],[33,52,13],[39,62,15]],8715:[[4,5,1],[5,6,1],[6,7,1],[7,8,1],[8,9,1],[10,10,1],[12,12,1],[14,14,1],[17,17,2],[20,20,2],[23,24,2],[28,28,2],[33,33,3],[39,39,3]],8722:[[5,1,-1],[6,1,-2],[7,1,-2],[9,1,-2],[10,1,-3],[12,1,-4],[14,2,-4],[17,2,-5],[20,2,-6],[23,2,-7],[28,2,-9],[33,3,-10],[39,3,-12],[46,3,-15]],8723:[[5,6,2],[6,6,2],[8,7,2],[9,8,2],[10,10,3],[12,12,3],[15,14,4],[17,16,4],[20,19,5],[24,23,6],[29,27,7],[34,32,8],[40,38,10],[48,44,11]],8725:[[4,8,2],[4,10,3],[5,11,3],[6,12,3],[7,15,4],[8,18,5],[9,20,5],[11,24,6],[13,28,7],[15,34,9],[18,40,10],[21,47,12],[25,56,14],[30,67,17]],8726:[[4,8,2],[4,10,3],[5,11,3],[6,12,3],[7,15,4],[8,18,5],[9,20,5],[11,24,6],[13,28,7],[15,34,9],[18,40,10],[21,47,12],[25,56,14],[30,67,17]],8727:[[3,4,0],[4,4,0],[5,5,0],[6,6,0],[6,7,0],[8,8,0],[9,10,0],[11,11,0],[12,13,0],[15,15,-1],[17,18,-1],[21,21,-1],[24,25,-1],[29,29,-2]],8728:[[3,3,0],[4,4,0],[5,5,0],[5,5,0],[7,6,0],[8,7,-1],[9,8,-1],[11,10,-1],[13,12,-1],[15,14,-1],[18,16,-2],[21,19,-2],[25,22,-3],[30,27,-3]],8729:[[4,4,0],[4,4,0],[5,5,0],[6,6,0],[7,7,0],[8,8,0],[9,8,-1],[11,10,-1],[13,12,-1],[15,14,-1],[18,16,-2],[21,19,-2],[25,22,-3],[30,27,-3]],8730:[[6,8,2],[8,9,2],[9,10,2],[11,13,3],[12,15,3],[15,18,4],[17,20,4],[20,24,5],[24,29,6],[29,34,7],[34,40,8],[40,48,10],[48,57,12],[57,67,14]],8733:[[5,3,0],[6,4,0],[8,5,0],[9,5,0],[11,6,0],[13,8,0],[15,9,0],[17,12,1],[21,14,1],[24,16,1],[29,19,1],[34,22,1],[40,26,1],[48,30,1]],8734:[[7,3,0],[8,4,0],[10,5,0],[11,5,0],[14,6,0],[16,9,1],[19,10,1],[22,12,1],[27,14,1],[32,16,1],[37,19,1],[44,22,1],[53,26,1],[63,31,1]],8736:[[5,5,0],[6,6,0],[7,7,0],[8,9,0],[10,10,0],[12,12,0],[13,14,0],[16,17,0],[19,20,0],[22,23,0],[27,28,0],[31,33,0],[37,39,0],[44,46,0]],8739:[[1,8,2],[2,10,3],[2,11,3],[2,12,3],[2,15,4],[3,18,5],[3,20,5],[4,24,6],[5,28,7],[6,34,9],[7,40,10],[8,47,12],[9,56,14],[11,67,17]],8741:[[3,8,2],[4,10,3],[4,11,3],[5,14,4],[6,16,5],[7,18,5],[8,22,6],[9,25,7],[11,30,8],[13,36,10],[15,42,11],[18,50,13],[21,59,16],[25,70,19]],8743:[[5,6,1],[6,6,1],[6,7,1],[8,9,1],[9,10,1],[11,11,1],[12,13,1],[15,15,1],[17,18,1],[21,21,1],[24,25,1],[29,30,2],[34,36,2],[41,42,2]],8744:[[5,6,1],[6,6,1],[6,7,1],[8,9,1],[9,10,1],[11,11,1],[12,13,1],[15,15,1],[17,18,1],[21,21,1],[24,25,1],[29,30,2],[34,36,2],[41,42,2]],8745:[[5,5,1],[5,6,1],[6,7,1],[7,8,1],[9,10,1],[10,11,1],[12,13,1],[14,15,1],[17,18,1],[21,21,1],[24,25,1],[29,30,2],[34,36,2],[41,42,2]],8746:[[5,5,1],[6,6,1],[6,7,1],[8,8,1],[9,10,1],[11,11,1],[12,13,1],[14,15,1],[18,18,1],[21,21,1],[24,25,1],[29,29,1],[34,36,2],[41,42,2]],8747:[[3,7,2],[4,8,2],[5,9,2],[6,12,3],[7,13,3],[8,16,4],[10,18,4],[11,23,6],[13,26,6],[16,32,8],[19,38,9],[22,45,11],[26,52,12],[31,63,15]],8764:[[5,2,-1],[6,2,-1],[7,3,-1],[9,4,-1],[10,3,-2],[12,5,-2],[14,6,-2],[17,6,-3],[20,8,-3],[24,9,-4],[29,10,-5],[34,12,-6],[40,14,-7],[48,17,-8]],8768:[[2,5,1],[2,6,1],[2,7,1],[3,8,1],[4,9,1],[4,12,2],[5,14,2],[6,16,2],[7,19,3],[8,23,3],[9,27,4],[11,32,4],[13,38,5],[15,45,6]],8771:[[5,4,0],[6,4,0],[8,5,0],[9,6,0],[10,7,0],[12,8,0],[15,10,0],[17,10,-1],[20,12,-1],[24,15,-1],[29,18,-1],[34,21,-1],[40,25,-1],[48,29,-2]],8773:[[5,4,0],[6,5,0],[8,6,0],[9,7,0],[10,8,0],[12,10,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[29,24,0],[34,27,-1],[40,32,-1],[48,38,-1]],8776:[[5,4,0],[6,4,0],[7,5,0],[9,6,0],[10,6,-1],[12,9,0],[14,9,-1],[17,11,-1],[20,13,-1],[24,15,-1],[29,17,-2],[34,21,-2],[40,24,-3],[48,29,-3]],8781:[[5,4,0],[6,5,0],[8,5,0],[9,6,0],[10,7,0],[12,9,0],[15,10,0],[17,12,0],[20,14,0],[24,16,0],[29,19,0],[34,23,0],[40,27,0],[48,31,-1]],8784:[[5,4,-1],[6,5,-1],[8,6,-1],[9,7,-1],[10,8,-2],[12,10,-2],[15,12,-2],[17,13,-3],[20,16,-3],[24,19,-4],[29,22,-5],[34,26,-6],[40,31,-7],[48,37,-8]],8800:[[5,7,2],[6,8,2],[8,10,3],[9,12,3],[10,13,3],[12,16,4],[15,19,5],[17,23,6],[20,26,6],[24,32,8],[29,38,9],[34,45,11],[40,53,13],[48,62,15]],8801:[[5,4,0],[6,4,0],[8,5,0],[9,6,0],[10,7,0],[12,8,0],[15,9,0],[17,10,-1],[20,12,-1],[24,15,-1],[29,18,-1],[34,21,-1],[40,25,-1],[48,29,-2]],8804:[[5,6,1],[6,7,1],[8,9,2],[9,10,2],[10,11,2],[12,14,3],[15,16,3],[17,18,3],[20,22,4],[24,26,5],[28,31,6],[34,37,7],[40,44,8],[48,52,10]],8805:[[5,6,1],[6,7,1],[7,9,2],[9,10,2],[10,11,2],[12,14,3],[14,16,3],[17,18,3],[20,22,4],[23,26,5],[28,31,6],[33,37,7],[39,44,8],[46,52,10]],8810:[[7,5,1],[8,6,1],[10,7,1],[12,8,1],[14,9,1],[16,12,2],[19,14,2],[22,16,2],[27,18,2],[31,22,3],[37,26,3],[44,31,4],[53,36,4],[62,43,5]],8811:[[7,5,1],[8,6,1],[10,7,1],[12,8,1],[14,9,1],[16,12,2],[19,14,2],[23,16,2],[27,18,2],[32,22,3],[38,26,3],[45,31,4],[53,36,4],[63,43,5]],8826:[[5,5,1],[6,6,1],[7,7,1],[9,8,1],[10,9,1],[12,10,1],[14,12,1],[17,14,1],[20,17,2],[23,20,2],[28,24,2],[33,28,2],[39,33,3],[46,39,3]],8827:[[5,5,1],[6,6,1],[7,7,1],[9,8,1],[10,9,1],[12,10,1],[14,12,1],[17,14,1],[20,17,2],[23,20,2],[28,24,2],[33,27,2],[39,33,3],[46,39,3]],8834:[[5,5,1],[6,6,1],[7,7,1],[9,8,1],[10,9,1],[12,10,1],[14,12,1],[17,14,1],[19,17,2],[23,20,2],[27,23,2],[33,27,2],[39,33,3],[46,39,3]],8835:[[5,5,1],[6,6,1],[7,7,1],[8,8,1],[10,9,1],[12,10,1],[14,12,1],[17,14,1],[20,17,2],[23,20,2],[28,24,2],[33,28,2],[39,33,3],[46,39,3]],8838:[[5,6,1],[6,7,1],[7,9,2],[9,10,2],[10,11,2],[12,14,3],[14,16,3],[17,19,4],[19,22,4],[23,26,5],[27,31,6],[33,37,7],[39,44,8],[46,52,10]],8839:[[5,6,1],[6,7,1],[7,9,2],[8,10,2],[10,11,2],[12,14,3],[14,16,3],[17,18,3],[20,22,4],[23,26,5],[28,31,6],[33,37,7],[39,44,8],[46,51,9]],8846:[[5,6,1],[6,6,1],[6,7,1],[8,9,1],[9,10,1],[11,11,1],[12,13,1],[14,16,1],[18,18,1],[21,21,1],[24,25,1],[29,29,1],[34,36,2],[41,42,2]],8849:[[5,6,1],[6,7,1],[7,9,2],[9,10,2],[10,11,2],[12,14,3],[14,16,3],[17,18,3],[20,22,4],[24,26,5],[28,31,6],[34,37,7],[40,44,8],[47,52,10]],8850:[[5,6,1],[6,7,1],[7,9,2],[9,10,2],[10,11,2],[12,14,3],[14,16,3],[17,18,3],[20,22,4],[23,26,5],[28,31,6],[33,37,7],[39,44,8],[46,52,10]],8851:[[5,5,1],[5,5,0],[6,6,0],[7,8,1],[9,10,1],[10,10,0],[12,12,0],[14,14,0],[17,18,1],[20,20,0],[24,24,0],[29,28,0],[34,34,0],[40,40,0]],8852:[[5,5,0],[5,5,0],[6,6,0],[7,8,0],[9,9,0],[10,10,0],[12,12,0],[14,14,0],[17,17,0],[20,20,0],[24,24,0],[29,28,0],[34,34,0],[40,40,0]],8853:[[5,5,1],[6,6,1],[8,7,1],[9,8,1],[11,9,1],[13,12,2],[15,14,2],[17,16,2],[20,20,3],[24,23,3],[29,27,4],[34,32,4],[40,38,5],[48,45,6]],8854:[[5,5,1],[6,6,1],[7,7,1],[9,8,1],[10,9,1],[12,12,2],[14,14,2],[17,16,2],[21,20,3],[24,23,3],[29,27,4],[34,32,4],[40,38,5],[48,45,6]],8855:[[5,5,1],[6,6,1],[7,7,1],[9,8,1],[10,9,1],[12,12,2],[15,14,2],[17,16,2],[21,20,3],[24,23,3],[29,27,4],[34,32,4],[40,38,5],[48,45,6]],8856:[[5,5,1],[6,6,1],[7,7,1],[9,8,1],[10,9,1],[12,12,2],[15,14,2],[17,16,2],[21,20,3],[24,23,3],[29,27,4],[34,32,4],[40,38,5],[48,45,6]],8857:[[5,5,1],[6,6,1],[7,7,1],[9,8,1],[10,9,1],[12,12,2],[15,14,2],[17,16,2],[21,20,3],[24,23,3],[29,27,4],[34,32,4],[40,38,5],[48,45,6]],8866:[[4,5,0],[5,6,0],[6,7,0],[7,9,0],[8,10,0],[10,12,0],[11,14,0],[13,17,0],[16,20,0],[19,23,0],[22,28,0],[26,33,0],[31,39,0],[37,46,0]],8867:[[4,5,0],[5,6,0],[6,7,0],[7,9,0],[8,10,0],[9,12,0],[11,14,0],[13,17,0],[16,20,0],[19,23,0],[22,28,0],[26,33,0],[31,39,0],[37,46,0]],8868:[[5,5,0],[6,6,0],[8,7,0],[9,8,0],[10,11,1],[12,12,1],[15,14,1],[17,16,0],[20,20,1],[24,22,0],[29,27,0],[34,32,0],[40,37,0],[48,44,0]],8869:[[5,5,0],[6,6,0],[8,7,0],[9,8,0],[10,10,0],[12,12,0],[15,14,0],[17,16,0],[20,19,0],[24,22,0],[29,27,0],[34,32,0],[40,37,0],[48,44,0]],8872:[[6,8,2],[7,10,3],[8,11,3],[10,12,3],[12,15,4],[14,18,5],[16,20,5],[19,24,6],[23,28,7],[27,34,9],[32,40,10],[38,47,12],[45,56,14],[54,67,17]],8900:[[4,4,0],[5,5,0],[5,5,0],[6,6,0],[7,7,0],[9,9,0],[10,10,0],[12,12,0],[14,14,0],[17,17,0],[20,20,0],[23,23,0],[27,27,0],[33,33,0]],8901:[[2,1,-1],[2,2,-1],[2,3,-1],[3,2,-2],[3,3,-2],[4,3,-3],[4,4,-3],[5,4,-4],[6,4,-5],[7,5,-6],[8,6,-7],[10,7,-8],[11,8,-10],[14,9,-12]],8902:[[4,4,0],[5,5,0],[5,5,0],[6,6,0],[7,7,0],[9,9,0],[10,10,0],[12,12,0],[14,14,0],[17,16,0],[20,20,0],[24,23,0],[28,27,0],[33,31,-1]],8904:[[7,5,1],[8,6,1],[9,6,1],[11,7,1],[13,8,1],[15,10,1],[17,11,1],[21,13,1],[25,15,1],[29,18,1],[35,21,1],[41,25,1],[49,29,1],[58,35,1]],8942:[[2,6,0],[2,9,1],[2,10,1],[3,12,1],[3,14,1],[4,16,1],[4,19,1],[5,22,1],[6,26,1],[7,31,1],[8,38,2],[10,44,2],[11,52,2],[14,62,2]],8943:[[8,1,-1],[9,2,-1],[11,3,-1],[13,2,-2],[16,3,-2],[19,3,-3],[22,4,-3],[26,4,-4],[31,4,-5],[36,5,-6],[43,6,-7],[51,7,-8],[61,8,-10],[73,9,-12]],8945:[[8,6,0],[10,7,0],[12,9,0],[14,9,-1],[16,11,-1],[20,13,-1],[23,15,-1],[27,18,-2],[32,21,-2],[38,24,-3],[46,30,-3],[54,35,-4],[64,41,-5],[76,48,-6]],8968:[[3,8,2],[4,9,2],[5,11,3],[5,12,3],[6,15,4],[8,17,4],[9,20,5],[10,25,7],[12,28,7],[14,34,9],[17,40,10],[20,47,12],[24,56,14],[28,67,17]],8969:[[2,8,2],[3,9,2],[3,11,3],[3,12,3],[4,15,4],[5,17,4],[5,20,5],[7,24,6],[8,28,7],[9,34,9],[11,40,10],[13,47,12],[15,56,14],[18,67,17]],8970:[[3,8,2],[4,9,2],[5,11,3],[5,12,3],[6,15,4],[8,17,4],[8,20,5],[10,24,6],[12,28,7],[14,34,9],[17,40,10],[20,47,12],[24,56,14],[28,67,17]],8971:[[2,8,2],[3,9,2],[3,11,3],[3,12,3],[4,15,4],[5,17,4],[5,20,5],[6,24,6],[8,28,7],[9,34,9],[11,40,10],[13,47,12],[15,56,14],[18,67,17]],8994:[[7,3,0],[8,4,0],[10,3,-1],[12,4,-1],[14,5,-1],[16,6,-1],[19,6,-2],[22,8,-2],[27,8,-3],[32,9,-4],[37,12,-4],[44,13,-5],[53,16,-6],[63,19,-7]],8995:[[7,2,-1],[8,3,-1],[10,3,-1],[12,4,-1],[14,4,-2],[16,5,-2],[19,6,-2],[22,6,-3],[27,8,-3],[32,9,-4],[38,10,-5],[44,12,-6],[53,15,-7],[63,17,-8]],9136:[[3,8,2],[3,9,2],[4,11,3],[5,12,3],[5,15,4],[6,17,4],[7,20,5],[9,24,6],[10,28,7],[12,33,8],[14,40,10],[17,46,11],[20,55,13],[24,65,16]],9137:[[3,8,2],[3,9,2],[4,11,3],[5,12,3],[5,15,4],[6,17,4],[7,20,5],[9,24,6],[10,28,7],[12,33,8],[14,39,10],[17,47,12],[20,55,14],[24,65,16]],10216:[[3,8,2],[3,10,3],[4,11,3],[4,12,3],[5,15,4],[6,18,5],[7,20,5],[8,24,6],[10,28,7],[11,34,9],[14,40,10],[16,47,12],[19,56,14],[22,67,17]],10217:[[2,8,2],[3,10,3],[3,11,3],[4,12,3],[4,15,4],[5,18,5],[6,20,5],[7,24,6],[8,28,7],[10,34,9],[11,40,10],[13,47,12],[16,56,14],[19,67,17]],10222:[[3,8,2],[3,9,2],[4,11,3],[5,12,3],[5,15,4],[6,17,4],[8,20,5],[9,24,6],[10,28,7],[12,33,8],[14,40,10],[17,47,12],[20,56,14],[24,65,16]],10223:[[2,8,2],[2,9,2],[3,11,3],[3,12,3],[4,15,4],[4,17,4],[5,20,5],[6,24,6],[7,28,7],[8,33,8],[10,40,10],[12,46,11],[14,55,13],[16,65,16]],10229:[[11,5,1],[13,5,0],[15,6,1],[18,7,1],[22,9,1],[26,9,0],[30,11,1],[36,13,1],[43,15,1],[51,18,1],[60,21,1],[71,25,1],[85,30,1],[101,35,1]],10230:[[11,5,1],[13,5,0],[16,7,1],[19,7,1],[22,9,1],[26,9,0],[31,11,1],[37,13,1],[43,15,1],[52,18,1],[61,22,1],[73,25,1],[86,30,1],[103,35,1]],10231:[[13,5,1],[15,5,0],[18,6,1],[22,7,1],[25,9,1],[30,9,0],[36,11,1],[42,13,1],[50,15,1],[60,18,1],[71,22,1],[84,25,1],[100,30,1],[119,35,1]],10232:[[11,5,1],[13,6,1],[16,7,1],[19,8,1],[22,9,1],[26,10,1],[31,11,1],[37,14,1],[43,16,1],[52,20,2],[61,23,2],[73,27,2],[86,31,2],[103,37,2]],10233:[[11,5,1],[14,6,1],[16,7,1],[19,8,1],[22,9,1],[27,10,1],[31,12,1],[37,14,1],[44,16,1],[52,19,1],[62,22,1],[74,26,1],[88,32,2],[104,37,2]],10234:[[13,5,1],[15,6,1],[18,7,1],[22,8,1],[25,9,1],[30,10,1],[36,12,1],[42,14,1],[50,16,1],[60,20,2],[71,23,2],[84,27,2],[100,31,2],[119,37,2]],10236:[[11,5,1],[13,5,0],[16,7,1],[19,7,1],[22,9,1],[26,9,0],[31,11,1],[37,13,1],[44,15,1],[52,18,1],[61,22,1],[73,25,1],[86,30,1],[103,35,1]],10815:[[5,5,0],[6,6,0],[8,7,0],[9,9,0],[10,10,0],[12,12,0],[15,14,0],[17,16,0],[20,19,0],[24,23,0],[29,27,0],[34,32,0],[40,38,0],[48,45,0]],10927:[[5,6,1],[6,7,1],[7,9,2],[9,10,2],[10,11,2],[12,14,3],[14,16,3],[17,18,3],[20,22,4],[23,26,5],[28,31,6],[33,37,7],[39,44,8],[46,52,10]],10928:[[5,6,1],[6,7,1],[7,9,2],[9,10,2],[10,11,2],[12,14,3],[14,16,3],[17,19,4],[20,22,4],[23,26,5],[28,31,6],[33,37,7],[39,44,8],[46,52,10]]},"MathJax_Math-bold-italic":{32:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],47:[[6,6,1],[7,8,2],[8,10,2],[9,10,2],[11,12,3],[13,16,4],[15,18,4],[18,22,5],[21,26,6],[25,31,7],[29,37,8],[35,43,9],[41,51,11],[49,62,14]],65:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[17,14,0],[20,17,0],[24,20,0],[28,23,0],[33,29,0],[40,33,0],[47,40,0],[56,47,0]],66:[[6,5,0],[8,6,0],[9,8,0],[11,8,0],[12,9,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[29,23,0],[34,28,0],[40,32,0],[48,38,0],[57,46,0]],67:[[6,5,0],[8,6,0],[9,8,0],[11,8,0],[12,9,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[29,24,1],[34,29,1],[40,33,1],[48,40,0],[57,49,2]],68:[[7,5,0],[8,6,0],[9,8,0],[11,8,0],[13,9,0],[16,12,0],[18,14,0],[22,17,0],[26,20,0],[31,23,0],[36,28,0],[43,32,0],[51,38,0],[61,46,0]],69:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[17,14,0],[20,17,0],[23,20,0],[28,23,0],[33,28,0],[39,32,0],[46,38,0],[55,46,0]],70:[[6,5,0],[7,6,0],[8,8,0],[10,8,0],[12,9,0],[14,12,0],[16,14,0],[19,17,0],[23,20,0],[27,23,0],[32,28,0],[38,32,0],[45,38,0],[54,46,0]],71:[[6,5,0],[8,6,0],[9,8,0],[11,8,0],[12,9,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[29,24,1],[34,29,1],[40,33,1],[48,40,0],[57,48,1]],72:[[8,5,0],[9,6,0],[11,8,0],[13,8,0],[15,9,0],[18,12,0],[21,14,0],[24,17,0],[29,20,0],[34,23,0],[41,28,0],[48,32,0],[58,38,0],[68,46,0]],73:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[10,12,0],[12,14,0],[14,17,0],[16,20,0],[19,23,0],[23,28,0],[27,32,0],[32,38,0],[38,46,0]],74:[[5,5,0],[6,6,0],[7,8,0],[9,8,0],[10,9,0],[12,12,0],[14,14,0],[17,17,0],[20,20,0],[23,24,1],[28,29,1],[33,33,1],[39,39,1],[46,47,1]],75:[[7,5,0],[9,6,0],[10,8,0],[12,8,0],[14,9,0],[17,12,0],[20,14,0],[24,17,0],[28,20,0],[34,23,0],[40,28,0],[47,32,0],[56,38,0],[67,46,0]],76:[[5,5,0],[6,6,0],[7,8,0],[9,8,0],[10,9,0],[12,12,0],[14,14,0],[17,17,0],[20,20,0],[24,23,0],[28,28,0],[34,32,0],[40,38,0],[47,46,0]],77:[[9,6,0],[11,7,0],[12,9,0],[15,9,0],[17,10,0],[21,13,0],[24,15,0],[29,18,0],[34,21,0],[41,24,0],[48,29,0],[57,33,0],[68,39,0],[81,47,0]],78:[[8,5,0],[9,6,0],[11,8,0],[13,8,0],[15,9,0],[18,12,0],[20,14,0],[24,17,0],[29,20,0],[34,23,0],[41,28,0],[48,32,0],[57,38,0],[68,46,0]],79:[[6,5,0],[7,6,0],[8,8,0],[10,8,0],[12,9,0],[14,12,0],[16,14,0],[19,17,0],[23,20,0],[27,24,1],[32,29,1],[38,33,1],[46,40,1],[54,48,2]],80:[[6,5,0],[8,7,0],[9,9,0],[10,9,0],[12,10,0],[15,13,0],[17,15,0],[20,18,0],[24,21,0],[28,24,0],[34,29,0],[40,33,0],[48,39,0],[56,47,0]],81:[[6,6,1],[7,8,2],[8,10,2],[10,10,2],[12,12,3],[14,16,4],[16,18,4],[19,22,5],[23,26,6],[27,30,7],[32,36,8],[38,41,9],[46,50,11],[54,60,14]],82:[[7,5,0],[8,6,0],[9,8,0],[11,8,0],[13,9,0],[15,12,0],[18,14,0],[21,17,0],[25,20,0],[30,24,1],[35,29,1],[42,33,1],[49,39,0],[59,47,1]],83:[[5,5,0],[6,6,0],[7,8,0],[9,8,0],[10,9,0],[12,12,0],[14,14,0],[17,17,0],[20,20,0],[24,24,1],[28,29,1],[34,33,1],[40,41,2],[47,48,2]],84:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[18,17,0],[22,19,0],[26,22,0],[30,27,0],[36,31,0],[43,38,0],[51,45,0]],85:[[7,5,0],[8,6,0],[9,8,0],[11,8,0],[13,9,0],[15,12,0],[18,14,0],[21,17,0],[25,20,0],[29,24,1],[35,29,1],[41,33,1],[49,39,0],[58,47,1]],86:[[7,5,0],[8,6,0],[9,8,0],[11,8,0],[13,9,0],[15,12,0],[18,14,0],[21,17,0],[25,20,0],[29,24,1],[35,29,1],[41,33,1],[49,39,0],[58,47,1]],87:[[9,5,0],[10,6,0],[12,8,0],[15,8,0],[17,9,0],[20,12,0],[24,14,0],[28,17,0],[34,20,0],[40,24,1],[48,29,1],[56,33,1],[67,39,0],[80,48,1]],88:[[7,5,0],[8,6,0],[10,8,0],[12,8,0],[14,9,0],[16,12,0],[19,14,0],[23,17,0],[27,20,0],[32,23,0],[38,28,0],[45,32,0],[53,39,1],[63,46,0]],89:[[7,5,0],[8,6,0],[9,8,0],[11,8,0],[13,9,0],[15,12,0],[18,14,0],[21,17,0],[25,20,0],[29,23,0],[35,28,0],[41,32,0],[49,38,0],[58,45,0]],90:[[6,5,0],[7,6,0],[8,8,0],[10,8,0],[12,9,0],[14,12,0],[16,14,0],[19,17,0],[23,20,0],[27,23,0],[32,28,0],[38,32,0],[45,38,0],[54,46,0]],97:[[5,3,0],[6,4,0],[6,5,0],[8,5,0],[9,6,0],[11,8,0],[12,9,0],[15,11,0],[17,13,0],[20,15,0],[24,18,0],[29,21,0],[34,25,0],[40,31,1]],98:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[9,12,0],[10,14,0],[12,17,0],[15,20,0],[17,23,0],[21,28,0],[24,32,0],[29,38,0],[34,47,1]],99:[[4,3,0],[5,4,0],[5,5,0],[6,5,0],[8,6,0],[9,8,0],[10,9,0],[12,11,0],[15,13,0],[17,15,0],[20,18,0],[24,21,0],[29,25,0],[34,31,1]],100:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[12,14,0],[15,17,0],[17,20,0],[21,23,0],[25,28,0],[29,32,0],[34,38,0],[41,47,1]],101:[[4,3,0],[5,4,0],[5,5,0],[6,5,0],[8,6,0],[9,8,0],[10,9,0],[12,11,0],[15,13,0],[17,15,0],[20,18,0],[24,21,0],[29,25,0],[34,31,1]],102:[[5,6,1],[6,8,2],[7,10,2],[8,10,2],[9,12,3],[11,16,4],[13,18,4],[15,22,5],[18,26,6],[21,30,7],[25,36,8],[30,41,9],[35,50,11],[42,59,13]],103:[[4,4,1],[5,6,2],[6,7,2],[7,7,2],[8,9,3],[9,12,4],[11,13,4],[13,16,5],[15,19,6],[18,22,7],[22,26,8],[26,30,9],[30,36,11],[36,43,13]],104:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[13,14,0],[15,17,0],[18,20,0],[21,23,0],[25,28,0],[30,33,1],[36,39,0],[42,47,1]],105:[[3,5,0],[4,6,0],[4,8,0],[5,8,0],[6,9,0],[7,12,0],[8,14,0],[9,17,0],[11,20,0],[12,23,0],[15,28,0],[17,32,0],[21,38,0],[24,47,1]],106:[[5,6,1],[5,8,2],[6,10,2],[7,10,2],[8,12,3],[9,16,4],[10,18,4],[12,22,5],[14,26,6],[16,30,7],[19,36,8],[23,41,9],[27,49,11],[31,59,13]],107:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[10,12,0],[12,14,0],[14,17,0],[16,20,0],[19,23,0],[23,28,0],[27,32,0],[32,38,0],[38,47,1]],108:[[3,5,0],[3,6,0],[3,8,0],[4,8,0],[5,9,0],[5,12,0],[6,14,0],[7,17,0],[9,20,0],[10,23,0],[12,28,0],[14,32,0],[17,38,0],[20,47,1]],109:[[7,3,0],[9,4,0],[10,5,0],[12,5,0],[14,6,0],[17,8,0],[20,9,0],[24,11,0],[28,13,0],[33,15,0],[40,18,0],[47,21,0],[56,25,0],[66,31,1]],110:[[5,3,0],[6,4,0],[7,5,0],[9,5,0],[10,6,0],[12,8,0],[14,9,0],[16,11,0],[19,13,0],[23,15,0],[27,18,0],[32,21,0],[38,25,0],[45,31,1]],111:[[4,3,0],[5,4,0],[6,5,0],[7,5,0],[8,6,0],[10,8,0],[12,9,0],[14,11,0],[16,13,0],[19,15,0],[23,18,0],[27,21,0],[32,25,0],[38,31,1]],112:[[6,4,1],[6,6,2],[7,7,2],[8,7,2],[10,9,3],[11,12,4],[13,13,4],[15,16,5],[18,19,6],[21,22,7],[25,26,8],[30,30,9],[35,36,11],[42,44,14]],113:[[4,4,1],[5,6,2],[6,7,2],[7,7,2],[8,9,3],[10,12,4],[11,13,4],[13,16,5],[16,19,6],[19,22,7],[22,26,8],[26,30,9],[31,36,11],[37,44,14]],114:[[4,3,0],[5,4,0],[5,5,0],[6,5,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,13,0],[17,15,0],[20,18,0],[24,21,0],[28,25,0],[33,31,1]],115:[[4,3,0],[4,4,0],[5,5,0],[6,5,0],[7,6,0],[8,8,0],[10,9,0],[12,11,0],[14,13,0],[16,15,0],[19,18,0],[23,21,0],[27,25,0],[32,31,1]],116:[[3,5,0],[4,6,0],[4,7,0],[5,7,0],[6,9,0],[7,12,0],[8,13,0],[9,16,0],[11,19,0],[13,22,0],[16,26,0],[18,30,0],[22,36,0],[26,43,1]],117:[[5,3,0],[6,4,0],[7,5,0],[8,5,0],[9,6,0],[11,8,0],[13,9,0],[16,11,0],[18,13,0],[22,15,0],[26,18,0],[31,21,0],[36,25,0],[43,31,1]],118:[[4,3,0],[5,4,0],[6,5,0],[7,5,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,13,0],[18,15,0],[22,18,0],[25,21,0],[30,25,0],[36,31,1]],119:[[6,3,0],[7,4,0],[8,5,0],[10,5,0],[11,6,0],[14,8,0],[16,9,0],[19,11,0],[22,13,0],[27,15,0],[32,18,0],[37,21,0],[44,25,0],[53,31,1]],120:[[5,3,0],[5,4,0],[6,5,0],[8,5,0],[9,6,0],[10,8,0],[12,9,0],[14,11,0],[17,13,0],[20,15,0],[24,18,0],[28,21,0],[34,25,0],[40,31,1]],121:[[5,4,1],[5,6,2],[6,7,2],[7,7,2],[9,9,3],[10,12,4],[12,13,4],[14,16,5],[17,19,6],[20,22,7],[23,26,8],[28,30,9],[33,36,11],[39,43,13]],122:[[4,3,0],[5,4,0],[6,5,0],[7,5,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,13,0],[18,15,0],[22,18,0],[25,21,0],[30,25,0],[36,31,1]],160:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],915:[[6,5,0],[7,6,0],[8,8,0],[10,8,0],[11,9,0],[13,12,0],[16,14,0],[19,17,0],[22,20,0],[26,23,0],[31,28,0],[37,32,0],[43,38,0],[52,46,0]],916:[[7,5,0],[8,7,1],[9,9,1],[11,9,1],[13,10,1],[15,13,1],[18,15,1],[21,18,1],[25,21,1],[30,24,1],[36,30,1],[42,34,1],[50,41,1],[60,48,1]],920:[[6,5,0],[7,6,0],[9,8,0],[10,8,0],[12,9,0],[14,12,0],[17,14,0],[20,17,0],[24,20,0],[28,24,1],[34,29,1],[40,33,1],[47,39,1],[56,47,1]],923:[[6,5,0],[7,6,0],[8,8,0],[10,8,0],[11,9,0],[13,12,0],[16,14,0],[18,17,0],[22,20,0],[26,24,0],[31,29,0],[36,33,0],[43,40,0],[51,47,0]],926:[[6,5,0],[8,6,0],[9,8,0],[11,8,0],[12,9,0],[15,12,0],[17,14,0],[20,17,0],[24,20,0],[29,23,0],[34,27,0],[40,31,0],[48,38,0],[57,45,0]],928:[[8,5,0],[9,6,0],[11,8,0],[13,8,0],[15,9,0],[18,12,0],[21,14,0],[24,17,0],[29,20,0],[34,23,0],[41,27,0],[48,32,0],[57,38,0],[68,46,0]],931:[[7,5,0],[8,6,0],[9,8,0],[11,8,0],[13,9,0],[15,12,0],[18,14,0],[21,17,0],[25,20,0],[30,23,0],[36,28,0],[42,32,0],[50,38,0],[60,46,0]],933:[[6,5,0],[7,6,0],[8,8,0],[10,8,0],[12,9,0],[14,12,0],[16,14,0],[19,17,0],[23,20,0],[27,23,0],[32,28,0],[38,32,0],[45,39,0],[53,47,0]],934:[[6,5,0],[7,6,0],[8,8,0],[9,8,0],[11,9,0],[13,12,0],[15,14,0],[18,17,0],[21,20,0],[25,23,0],[29,28,0],[35,32,0],[41,38,0],[49,46,0]],936:[[6,5,0],[7,6,0],[8,8,0],[10,8,0],[12,9,0],[14,12,0],[16,14,0],[19,17,0],[23,20,0],[27,23,0],[32,28,0],[38,32,0],[45,38,0],[53,45,0]],937:[[7,5,0],[8,6,0],[9,8,0],[11,8,0],[13,9,0],[15,12,0],[18,14,0],[21,17,0],[25,20,0],[29,23,0],[35,28,0],[41,32,0],[49,39,0],[58,47,0]],945:[[5,3,0],[6,4,0],[7,5,0],[9,5,0],[10,6,0],[12,8,0],[14,9,0],[17,11,0],[20,13,0],[24,15,0],[28,18,0],[34,21,0],[40,25,0],[47,31,1]],946:[[5,6,1],[6,8,2],[7,10,2],[8,10,2],[9,12,3],[11,16,4],[13,18,4],[15,22,5],[18,26,6],[21,30,7],[25,36,8],[30,41,9],[36,50,11],[42,60,14]],947:[[5,4,1],[6,6,2],[7,7,2],[8,7,2],[9,9,3],[11,12,4],[13,13,4],[15,16,5],[18,19,6],[21,22,7],[25,26,8],[29,30,9],[35,37,12],[41,45,15]],948:[[4,5,0],[5,7,0],[6,8,0],[7,8,0],[8,10,0],[9,13,0],[10,16,0],[12,18,0],[15,21,0],[17,25,0],[21,29,0],[24,34,0],[29,41,0],[34,49,1]],949:[[4,3,0],[5,4,0],[5,5,0],[6,5,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,13,0],[17,16,1],[20,19,1],[23,22,1],[28,27,1],[33,32,1]],950:[[4,6,1],[5,8,2],[6,10,2],[7,10,2],[8,12,3],[9,16,4],[11,18,4],[13,22,5],[15,26,6],[18,31,7],[21,37,8],[25,43,9],[30,51,11],[35,61,13]],951:[[5,4,1],[5,6,2],[6,7,2],[7,7,2],[9,9,3],[10,12,4],[12,13,4],[14,16,5],[17,19,6],[20,22,7],[24,26,8],[28,30,9],[33,36,11],[39,45,15]],952:[[4,5,0],[5,6,0],[6,8,0],[7,8,0],[8,9,0],[10,12,0],[11,14,0],[13,17,0],[16,20,0],[19,23,0],[22,28,0],[26,32,0],[31,39,0],[37,47,1]],953:[[3,3,0],[4,4,0],[4,5,0],[5,5,0],[6,6,0],[7,8,0],[8,9,0],[9,11,0],[11,13,0],[13,15,0],[16,18,0],[18,21,0],[22,25,0],[26,31,1]],954:[[5,3,0],[6,4,0],[7,5,0],[8,5,0],[9,6,0],[11,8,0],[13,9,0],[15,11,0],[18,13,0],[22,15,0],[26,18,0],[30,21,0],[36,25,0],[43,31,1]],955:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[13,14,0],[16,17,0],[18,20,0],[22,24,1],[26,29,1],[31,33,1],[36,38,0],[43,47,1]],956:[[5,4,1],[6,6,2],[7,7,2],[8,7,2],[10,9,3],[12,12,4],[14,13,4],[16,16,5],[19,19,6],[23,22,7],[27,26,8],[32,31,10],[38,37,12],[45,45,15]],957:[[5,3,0],[6,4,0],[6,5,0],[8,5,0],[9,6,0],[11,8,0],[12,9,0],[15,11,0],[17,13,0],[20,15,0],[24,18,0],[29,21,0],[34,25,0],[40,31,1]],958:[[4,6,1],[5,8,2],[5,10,2],[6,10,2],[7,12,3],[9,16,4],[10,18,4],[12,22,5],[14,26,6],[17,30,7],[20,36,8],[23,43,9],[28,51,11],[33,61,13]],959:[[4,3,0],[5,4,0],[6,5,0],[7,5,0],[8,6,0],[10,8,0],[12,9,0],[14,11,0],[16,13,0],[19,15,0],[23,18,0],[27,21,0],[32,25,0],[38,31,1]],960:[[5,3,0],[6,4,0],[7,5,0],[8,5,0],[10,6,0],[12,8,0],[14,9,0],[16,11,0],[19,13,0],[23,15,0],[27,18,0],[32,21,0],[38,25,0],[45,31,1]],961:[[5,4,1],[5,6,2],[6,7,2],[8,7,2],[9,9,3],[10,12,4],[12,13,4],[14,16,5],[17,19,6],[20,22,7],[24,26,8],[29,30,9],[34,37,12],[40,45,15]],962:[[4,4,1],[4,5,1],[5,6,1],[6,6,1],[7,7,1],[8,10,2],[9,12,3],[11,14,3],[13,16,3],[16,18,3],[18,22,4],[22,26,5],[26,31,6],[31,37,7]],963:[[5,3,0],[6,4,0],[7,5,0],[8,5,0],[10,6,0],[12,8,0],[14,9,0],[16,11,0],[19,13,0],[23,15,0],[27,18,0],[32,21,0],[38,25,0],[45,30,1]],964:[[5,3,0],[6,4,0],[6,5,0],[8,5,0],[9,6,0],[11,8,0],[12,9,0],[15,11,0],[17,13,0],[20,16,1],[24,19,1],[29,22,1],[34,25,0],[40,31,1]],965:[[5,3,0],[5,4,0],[6,5,0],[8,5,0],[9,6,0],[10,8,0],[12,9,0],[14,11,0],[17,13,0],[20,15,0],[24,18,0],[28,21,0],[34,25,0],[40,31,1]],966:[[5,4,1],[6,6,2],[7,7,2],[9,7,2],[10,9,3],[12,12,4],[14,13,4],[17,16,5],[20,19,6],[24,22,7],[28,26,8],[33,31,10],[39,37,12],[47,44,14]],967:[[5,4,1],[6,6,2],[7,7,2],[9,7,2],[10,9,3],[12,12,4],[14,13,4],[17,16,5],[20,19,6],[23,22,7],[28,26,8],[33,30,9],[39,36,11],[46,43,13]],968:[[6,6,1],[7,8,2],[8,10,2],[9,10,2],[11,12,3],[13,16,4],[15,18,4],[17,22,5],[21,26,6],[24,30,7],[29,36,8],[34,41,9],[41,50,11],[48,59,13]],969:[[5,3,0],[6,4,0],[7,5,0],[9,5,0],[10,6,0],[12,8,0],[14,9,0],[17,11,0],[20,13,0],[23,15,0],[28,18,0],[33,21,0],[39,25,0],[46,31,1]],977:[[5,5,0],[6,6,0],[7,8,0],[8,8,0],[9,9,0],[11,12,0],[13,14,0],[16,17,0],[18,20,0],[22,23,0],[26,28,0],[31,32,0],[36,39,0],[43,47,1]],981:[[5,6,1],[6,8,2],[7,10,2],[9,10,2],[10,12,3],[12,16,4],[14,18,4],[16,22,5],[20,26,6],[23,30,7],[27,36,8],[32,41,9],[39,49,11],[46,59,13]],982:[[7,3,0],[8,4,0],[10,5,0],[12,5,0],[14,6,0],[16,8,0],[19,9,0],[23,11,0],[27,13,0],[32,15,0],[38,18,0],[45,21,0],[53,25,0],[63,31,1]],1009:[[5,4,1],[5,6,2],[6,7,2],[8,7,2],[9,9,3],[10,12,4],[12,13,4],[14,16,5],[17,19,6],[20,22,7],[24,26,8],[28,30,9],[34,36,11],[40,44,14]],1013:[[4,3,0],[4,4,0],[5,5,0],[6,5,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,13,0],[15,15,0],[18,18,0],[22,21,0],[26,25,0],[30,30,1]]},"MathJax_Math-italic":{32:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],47:[[5,6,1],[6,8,2],[7,8,2],[8,10,2],[9,12,3],[11,14,3],[13,18,4],[15,21,5],[18,25,6],[21,31,7],[25,36,8],[30,45,10],[36,53,12],[42,61,14]],65:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[17,16,0],[21,19,0],[24,24,0],[29,28,0],[34,34,1],[41,41,1],[48,47,1]],66:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],[21,19,0],[25,23,0],[30,27,0],[36,33,0],[42,39,0],[50,45,0]],67:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],[21,20,1],[25,25,1],[30,29,1],[36,35,1],[42,41,1],[50,48,1]],68:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[12,10,0],[14,11,0],[16,14,0],[19,16,0],[23,19,0],[27,23,0],[32,27,0],[38,33,0],[45,39,0],[53,45,0]],69:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],[22,19,0],[26,23,0],[30,27,0],[36,33,0],[43,39,0],[51,46,0]],70:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],[21,19,0],[25,23,0],[30,27,0],[35,33,0],[42,39,0],[50,45,-1]],71:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],[21,20,1],[25,25,1],[30,29,1],[36,35,1],[42,41,1],[50,48,1]],72:[[7,5,0],[8,7,0],[9,7,0],[11,9,0],[13,10,0],[15,12,0],[18,15,0],[21,17,0],[25,20,0],[30,24,0],[35,28,0],[42,34,0],[50,40,0],[59,46,0]],73:[[4,5,0],[5,6,0],[5,6,0],[6,8,0],[7,9,0],[9,11,0],[10,14,0],[12,16,0],[14,19,0],[17,23,0],[20,27,0],[24,33,0],[28,39,0],[34,45,0]],74:[[5,5,0],[6,7,0],[7,6,0],[8,9,0],[9,10,0],[11,12,0],[13,15,0],[15,17,0],[18,21,1],[21,25,1],[25,29,1],[30,35,1],[35,41,1],[42,47,1]],75:[[7,5,0],[8,6,0],[9,6,0],[11,8,0],[13,10,0],[15,11,0],[18,14,0],[21,16,0],[25,19,0],[30,23,0],[35,27,0],[42,33,0],[50,39,0],[59,45,0]],76:[[5,5,0],[6,6,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,14,0],[15,16,0],[18,19,0],[22,23,0],[26,27,0],[30,33,0],[36,39,0],[43,45,-1]],77:[[8,5,0],[9,6,0],[11,6,0],[13,8,0],[15,10,0],[18,11,0],[21,14,0],[25,16,0],[29,19,0],[35,24,0],[42,27,0],[49,33,0],[58,39,0],[70,45,-1]],78:[[7,5,0],[8,7,0],[9,6,0],[11,9,0],[13,10,0],[15,12,0],[18,15,0],[21,17,0],[25,20,0],[30,24,0],[35,28,0],[42,34,0],[50,39,0],[59,46,0]],79:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],[21,20,1],[25,25,1],[29,29,1],[35,35,2],[41,41,1],[49,48,1]],80:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],[21,19,0],[25,23,0],[30,27,0],[35,33,0],[42,39,0],[50,45,0]],81:[[6,6,1],[7,8,2],[8,8,2],[9,10,2],[11,12,3],[13,14,3],[15,18,4],[18,21,5],[21,25,6],[25,31,7],[29,36,8],[35,44,10],[41,51,11],[49,59,13]],82:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],[21,20,1],[25,24,1],[30,28,1],[35,34,1],[42,40,1],[50,46,1]],83:[[5,5,0],[6,6,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,14,0],[15,16,0],[18,20,1],[22,25,1],[26,29,1],[31,35,2],[36,41,1],[43,48,2]],84:[[5,5,0],[6,6,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[17,16,0],[20,19,0],[24,23,0],[28,26,0],[33,32,0],[40,38,0],[47,44,0]],85:[[6,5,0],[7,6,0],[8,7,0],[10,9,0],[11,10,0],[13,12,0],[15,15,0],[18,17,0],[22,21,1],[26,25,1],[31,29,1],[36,35,1],[43,41,1],[51,48,1]],86:[[6,6,1],[7,7,1],[8,7,1],[10,9,1],[11,10,1],[13,12,1],[15,15,1],[18,17,1],[22,20,1],[26,24,1],[31,28,1],[36,35,2],[43,41,2],[51,47,1]],87:[[8,5,0],[9,6,0],[11,6,0],[13,8,0],[15,9,0],[18,11,0],[21,14,0],[25,16,0],[29,20,1],[35,24,1],[41,28,1],[49,34,1],[58,41,2],[69,48,2]],88:[[6,5,0],[8,7,1],[9,7,1],[10,9,1],[12,10,1],[15,12,1],[17,15,1],[20,17,1],[24,20,1],[28,24,1],[34,28,1],[40,34,1],[48,40,1],[56,46,1]],89:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],[22,19,0],[26,23,0],[30,27,0],[36,33,0],[43,39,0],[51,45,-1]],90:[[5,5,0],[6,6,0],[8,6,0],[9,8,0],[10,9,0],[12,11,0],[15,14,0],[17,16,0],[20,19,0],[24,23,0],[29,27,0],[34,33,0],[40,39,0],[48,45,0]],97:[[4,3,0],[5,4,0],[5,4,0],[6,5,0],[7,6,0],[9,7,0],[10,9,0],[12,10,0],[14,12,0],[17,15,0],[20,17,0],[24,22,1],[28,26,1],[34,30,1]],98:[[3,5,0],[4,6,0],[5,6,0],[5,8,0],[6,9,0],[7,11,0],[9,14,0],[10,16,0],[12,19,0],[14,24,0],[17,27,0],[20,34,1],[24,40,1],[28,47,1]],99:[[3,3,0],[4,4,0],[5,4,0],[6,5,0],[6,6,0],[8,7,0],[9,9,0],[10,10,0],[12,12,0],[15,15,0],[17,17,0],[21,22,1],[24,26,1],[29,30,1]],100:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[9,11,0],[11,14,0],[13,16,0],[15,19,0],[18,24,0],[21,27,0],[25,34,1],[30,40,1],[35,47,1]],101:[[3,3,0],[4,4,0],[5,4,0],[6,5,0],[6,6,0],[8,7,0],[9,9,0],[10,10,0],[12,12,0],[15,15,0],[17,17,0],[20,22,1],[24,26,1],[29,30,1]],102:[[4,6,1],[5,8,2],[6,8,2],[7,10,2],[8,12,3],[10,14,3],[11,18,4],[13,21,5],[16,25,6],[19,31,7],[22,36,8],[26,43,10],[31,51,12],[37,60,13]],103:[[4,4,1],[4,6,2],[5,6,2],[6,7,2],[7,9,3],[8,10,3],[10,13,4],[12,15,5],[14,18,6],[16,22,7],[19,25,8],[23,31,10],[27,37,12],[32,42,13]],104:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[13,16,0],[16,19,0],[19,24,0],[22,27,0],[26,34,1],[31,40,1],[37,47,1]],105:[[3,5,0],[3,6,0],[3,6,0],[4,8,0],[5,10,0],[5,11,0],[6,14,0],[7,16,0],[9,18,0],[10,23,0],[12,26,0],[14,32,1],[17,38,1],[20,44,1]],106:[[4,6,1],[5,8,2],[5,8,2],[6,10,2],[7,13,3],[8,14,3],[9,18,4],[11,20,5],[13,24,6],[15,30,7],[17,33,8],[20,41,10],[24,49,12],[28,57,13]],107:[[4,5,0],[5,6,0],[5,6,0],[6,8,0],[7,9,0],[9,11,0],[10,14,0],[12,16,0],[14,19,0],[17,24,0],[20,27,0],[24,34,1],[28,40,1],[33,47,1]],108:[[2,6,0],[3,7,0],[3,7,0],[4,9,0],[4,10,0],[5,12,0],[6,15,0],[7,17,0],[8,20,0],[9,24,0],[11,28,0],[13,35,1],[15,40,1],[18,47,1]],109:[[6,3,0],[8,4,0],[9,4,0],[10,5,0],[12,6,0],[15,7,0],[17,9,0],[20,10,0],[24,12,0],[28,15,0],[34,17,0],[40,22,1],[48,26,1],[56,30,1]],110:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[12,9,0],[14,10,0],[16,12,0],[19,15,0],[23,17,0],[27,22,1],[32,26,1],[38,30,1]],111:[[4,3,0],[4,4,0],[5,4,0],[6,5,0],[7,6,0],[8,7,0],[10,9,0],[12,10,0],[14,12,0],[16,15,0],[19,17,0],[23,22,1],[27,26,1],[32,30,1]],112:[[5,4,1],[6,6,2],[6,6,2],[7,7,2],[8,9,3],[10,10,3],[11,13,4],[13,15,5],[16,18,6],[19,22,7],[22,25,8],[26,31,10],[31,37,12],[36,43,14]],113:[[4,4,1],[4,6,2],[5,6,2],[6,7,2],[7,9,3],[8,10,3],[9,13,4],[11,15,5],[13,18,6],[16,22,7],[18,24,7],[22,31,10],[26,37,12],[31,42,13]],114:[[3,3,0],[4,4,0],[5,4,0],[6,5,0],[6,6,0],[8,7,0],[9,9,0],[10,10,0],[12,12,0],[15,15,0],[17,17,0],[20,22,1],[24,26,1],[29,30,1]],115:[[3,3,0],[4,4,0],[5,4,0],[5,5,0],[6,6,0],[7,7,0],[9,9,0],[10,10,0],[12,12,0],[14,15,0],[17,17,0],[20,22,1],[24,26,1],[28,30,1]],116:[[3,5,0],[3,6,0],[4,6,0],[4,7,0],[5,9,0],[6,10,0],[7,13,0],[8,15,0],[10,18,0],[11,22,0],[13,25,0],[16,30,1],[19,36,1],[22,42,1]],117:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[11,9,0],[13,10,0],[16,12,0],[19,15,0],[22,17,0],[26,22,1],[31,26,1],[37,30,1]],118:[[4,3,0],[4,4,0],[5,4,0],[6,5,0],[7,6,0],[8,7,0],[10,9,0],[11,10,0],[13,12,0],[16,15,0],[19,17,0],[22,22,1],[26,26,1],[31,30,1]],119:[[5,3,0],[6,4,0],[7,4,0],[9,5,0],[10,6,0],[12,7,0],[14,9,0],[16,10,0],[20,12,0],[23,15,0],[27,17,0],[32,22,1],[39,26,1],[46,30,1]],120:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[9,7,0],[11,9,0],[13,10,0],[15,12,0],[18,15,0],[21,17,0],[25,22,1],[29,26,1],[35,30,1]],121:[[4,4,1],[5,6,2],[5,6,2],[6,7,2],[7,9,3],[9,10,3],[10,13,4],[12,15,5],[14,18,6],[17,22,7],[20,25,8],[23,31,10],[28,37,12],[33,42,13]],122:[[4,3,0],[4,4,0],[5,4,0],[6,5,0],[7,6,0],[8,7,0],[10,9,0],[11,10,0],[13,12,0],[16,15,0],[19,17,0],[22,22,1],[26,26,1],[31,30,1]],160:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],915:[[5,5,0],[6,6,0],[8,6,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[17,16,0],[20,19,0],[24,23,0],[29,27,0],[34,33,0],[40,39,0],[48,45,0]],916:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[11,9,0],[14,11,0],[16,14,0],[19,16,0],[22,19,0],[26,24,0],[31,28,0],[37,34,0],[44,41,0],[52,47,0]],920:[[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],[21,20,1],[25,25,1],[29,29,1],[35,35,2],[41,41,1],[49,48,1]],923:[[5,5,0],[6,7,0],[7,7,0],[8,8,0],[10,10,0],[12,12,0],[14,15,0],[16,16,0],[19,20,0],[23,24,0],[27,28,0],[32,34,1],[38,41,1],[45,47,0]],926:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[11,9,0],[13,11,0],[16,14,0],[19,16,0],[22,19,0],[26,23,0],[31,27,0],[37,32,0],[43,38,0],[52,45,0]],928:[[7,5,0],[8,6,0],[9,6,0],[11,8,0],[13,9,0],[15,11,0],[18,14,0],[21,16,0],[25,19,0],[30,23,0],[35,27,0],[42,33,0],[50,39,0],[59,45,0]],931:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[12,9,0],[14,11,0],[16,14,0],[19,16,0],[23,19,0],[27,23,0],[32,27,0],[38,33,0],[45,39,0],[54,46,0]],933:[[5,5,0],[6,6,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[17,16,0],[20,19,0],[23,24,0],[28,28,0],[33,34,0],[39,40,0],[46,46,0]],934:[[5,5,0],[6,6,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,14,0],[15,16,0],[18,19,0],[22,23,0],[26,27,0],[30,32,-1],[36,39,0],[43,45,-1]],936:[[5,5,0],[6,6,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[17,16,0],[20,19,0],[23,23,0],[28,27,0],[33,32,-1],[39,39,0],[46,45,-1]],937:[[6,5,0],[7,6,0],[8,6,0],[10,8,0],[11,9,0],[14,11,0],[16,14,0],[19,16,0],[22,19,0],[26,24,0],[31,28,0],[37,34,0],[44,40,0],[52,47,0]],945:[[5,3,0],[5,4,0],[6,4,0],[8,5,0],[9,6,0],[10,7,0],[12,9,0],[14,10,0],[17,12,0],[20,15,0],[24,17,0],[28,22,1],[34,26,1],[40,30,1]],946:[[4,6,1],[5,8,2],[6,8,2],[7,10,2],[8,12,3],[10,14,3],[12,18,4],[14,21,5],[16,25,6],[19,31,7],[23,36,8],[27,43,10],[32,52,12],[38,59,13]],947:[[4,4,1],[5,6,2],[6,6,2],[7,7,2],[8,9,3],[10,10,3],[11,13,4],[13,15,5],[16,18,6],[18,22,7],[22,25,8],[26,32,11],[31,38,13],[36,44,15]],948:[[4,5,0],[4,6,0],[5,6,0],[6,8,0],[7,9,0],[8,11,0],[9,14,0],[11,16,0],[13,19,0],[15,24,0],[18,28,0],[21,35,1],[25,41,1],[30,48,1]],949:[[3,3,0],[4,4,0],[5,4,0],[6,5,0],[6,6,0],[8,7,0],[9,9,0],[10,10,0],[12,13,1],[15,16,1],[17,18,1],[20,22,1],[24,27,2],[29,31,1]],950:[[4,6,1],[4,8,2],[5,8,2],[6,10,2],[7,12,3],[8,14,3],[10,18,4],[11,21,5],[13,25,6],[16,31,7],[19,36,8],[22,43,10],[26,52,12],[31,60,13]],951:[[4,4,1],[5,6,2],[5,6,2],[6,7,2],[7,9,3],[9,10,3],[10,13,4],[12,15,5],[14,18,6],[17,22,7],[20,25,8],[24,32,11],[28,38,13],[33,44,15]],952:[[4,5,0],[4,6,0],[5,6,0],[6,8,0],[7,9,0],[8,11,0],[9,14,0],[11,16,0],[13,19,0],[16,24,0],[19,28,0],[22,34,1],[26,41,1],[31,47,1]],953:[[3,3,0],[3,4,0],[4,4,0],[4,5,0],[5,6,0],[6,7,0],[7,9,0],[8,10,0],[10,12,0],[11,15,0],[13,17,0],[16,22,1],[19,26,1],[22,30,1]],954:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[11,9,0],[13,10,0],[16,12,0],[19,15,0],[22,17,0],[26,22,1],[31,26,1],[37,30,1]],955:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[13,16,0],[16,19,0],[19,24,0],[22,27,0],[26,34,1],[31,40,1],[37,47,1]],956:[[4,4,1],[5,6,2],[6,6,2],[7,7,2],[8,9,3],[10,10,3],[12,13,4],[14,15,5],[16,18,6],[20,22,7],[23,25,8],[27,32,11],[33,38,13],[39,44,15]],957:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[9,7,0],[11,9,0],[13,10,0],[15,12,0],[18,15,0],[21,17,0],[25,22,1],[30,25,0],[35,29,0]],958:[[4,6,1],[4,8,2],[5,8,2],[6,10,2],[7,12,3],[8,14,3],[9,18,4],[11,21,5],[13,25,6],[15,31,7],[18,36,8],[21,43,10],[25,52,12],[30,60,13]],959:[[4,3,0],[4,4,0],[5,4,0],[6,5,0],[7,6,0],[8,7,0],[10,9,0],[12,10,0],[14,12,0],[16,15,0],[19,17,0],[23,22,1],[27,26,1],[32,30,1]],960:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[12,9,0],[14,10,0],[16,12,0],[19,15,0],[23,17,0],[27,22,1],[32,25,1],[38,29,1]],961:[[4,4,1],[5,6,2],[5,6,2],[6,7,2],[7,9,3],[9,10,3],[10,13,4],[12,15,5],[14,18,6],[17,22,7],[20,25,8],[24,32,11],[28,38,13],[34,44,15]],962:[[3,4,1],[4,5,1],[5,5,1],[5,7,2],[6,8,2],[7,9,2],[8,11,2],[10,13,3],[12,15,3],[14,19,4],[17,22,5],[20,26,5],[23,32,7],[27,36,7]],963:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[12,9,0],[14,10,0],[16,12,0],[19,15,0],[23,17,0],[27,22,1],[32,25,1],[38,29,1]],964:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[9,7,0],[10,9,0],[12,10,0],[15,12,0],[17,15,0],[21,17,0],[24,21,1],[29,26,1],[34,29,1]],965:[[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[9,7,0],[11,9,0],[13,10,0],[15,12,0],[18,15,0],[21,17,0],[25,22,1],[29,26,1],[35,30,1]],966:[[5,4,1],[6,6,2],[7,6,2],[8,7,2],[9,9,3],[11,10,3],[13,13,4],[15,15,5],[18,18,6],[21,22,7],[25,25,8],[29,32,11],[35,38,13],[41,44,15]],967:[[5,4,1],[5,6,2],[6,6,2],[8,7,2],[9,9,3],[10,10,3],[12,13,4],[14,15,5],[17,18,6],[20,22,7],[24,25,8],[28,31,10],[34,37,12],[40,42,13]],968:[[5,6,1],[6,8,2],[7,8,2],[8,10,2],[9,12,3],[11,14,3],[13,18,4],[15,21,5],[18,25,6],[21,31,7],[25,35,8],[30,43,10],[35,51,12],[42,59,13]],969:[[5,3,0],[6,4,0],[6,4,0],[8,5,0],[9,6,0],[11,7,0],[12,9,0],[15,10,0],[17,12,0],[20,15,0],[24,17,0],[29,22,1],[34,26,1],[40,30,1]],977:[[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[14,16,0],[16,19,0],[19,24,0],[23,28,0],[27,34,1],[32,41,1],[38,47,1]],981:[[4,6,1],[5,8,2],[6,8,2],[7,10,2],[8,12,3],[10,14,3],[12,18,4],[14,21,5],[16,25,6],[20,31,7],[23,35,8],[27,43,10],[32,51,12],[39,59,13]],982:[[6,3,0],[7,4,0],[9,4,0],[10,5,0],[12,6,0],[14,7,0],[17,9,0],[20,10,0],[23,12,0],[28,15,0],[33,17,0],[39,22,1],[46,25,1],[55,29,1]],1009:[[4,4,1],[5,6,2],[5,6,2],[6,7,2],[8,9,3],[9,10,3],[10,13,4],[12,15,5],[15,18,6],[17,22,7],[20,25,8],[24,31,10],[29,37,12],[34,42,13]],1013:[[3,3,0],[4,4,0],[4,4,0],[5,5,0],[6,6,0],[7,7,0],[8,9,0],[9,10,0],[11,12,0],[13,15,0],[15,17,0],[18,21,1],[21,25,1],[25,30,1]]},MathJax_Size1:{32:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],40:[[3,9,2],[4,10,3],[5,12,3],[5,15,4],[6,17,5],[7,20,6],[9,24,7],[10,28,8],[12,34,10],[14,40,11],[17,47,14],[20,56,16],[24,67,19],[28,79,23]],41:[[3,9,2],[3,10,3],[3,12,3],[4,15,4],[5,17,5],[6,20,6],[6,24,7],[8,28,8],[9,34,10],[11,40,11],[12,47,14],[15,56,16],[17,67,19],[21,79,23]],47:[[4,9,2],[5,10,3],[6,12,3],[7,14,4],[8,17,5],[9,20,6],[11,24,7],[13,28,8],[15,33,10],[18,40,11],[21,47,14],[25,56,16],[29,67,19],[35,79,23]],91:[[3,9,3],[4,11,3],[4,12,4],[5,15,4],[6,17,5],[7,20,6],[8,24,7],[10,28,8],[11,34,10],[13,41,12],[16,47,14],[19,56,16],[22,67,19],[26,79,23]],92:[[4,9,2],[5,10,3],[6,12,3],[7,14,4],[8,17,5],[9,20,6],[11,24,7],[13,28,8],[15,33,10],[18,40,11],[21,47,14],[25,56,16],[29,67,19],[35,79,23]],93:[[2,9,3],[2,11,3],[3,12,4],[3,15,4],[3,17,5],[4,20,6],[5,24,7],[5,28,8],[6,34,10],[8,41,12],[9,47,14],[10,56,16],[12,67,19],[15,79,23]],123:[[4,9,2],[4,10,3],[5,12,3],[6,15,4],[7,17,5],[8,20,6],[10,24,7],[12,28,8],[14,34,10],[16,40,12],[19,47,14],[23,56,16],[27,67,20],[32,79,23]],125:[[4,9,2],[4,10,3],[5,12,3],[6,15,4],[7,17,5],[8,20,6],[10,24,7],[12,28,8],[14,34,10],[16,40,11],[19,47,13],[23,56,16],[27,67,19],[32,79,23]],160:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],710:[[5,3,-3],[6,3,-4],[7,3,-5],[8,3,-6],[9,4,-7],[11,4,-9],[12,4,-10],[15,5,-13],[17,7,-14],[20,7,-17],[24,8,-21],[28,10,-25],[33,12,-30],[39,14,-36]],732:[[4,1,-4],[5,2,-5],[6,2,-6],[7,2,-7],[8,2,-8],[10,3,-9],[11,4,-11],[13,4,-13],[16,4,-17],[19,5,-20],[22,5,-23],[26,6,-28],[31,7,-33],[37,9,-39]],770:[[5,3,-3],[6,3,-4],[7,3,-5],[8,3,-6],[9,4,-7],[11,4,-9],[12,4,-10],[15,5,-13],[17,7,-14],[20,7,-17],[24,8,-21],[28,10,-25],[33,12,-30],[39,14,-36]],771:[[4,1,-4],[5,2,-5],[6,2,-6],[7,2,-7],[8,2,-8],[10,3,-9],[11,4,-11],[13,4,-13],[16,4,-17],[19,5,-20],[22,5,-23],[26,6,-28],[31,7,-33],[37,9,-39]],8214:[[4,5,0],[5,5,0],[6,6,0],[7,8,0],[8,9,0],[9,10,0],[11,12,0],[13,14,0],[15,17,0],[18,20,0],[21,24,0],[25,28,0],[29,34,0],[35,40,0]],8593:[[4,5,0],[5,5,0],[6,6,0],[7,8,0],[8,9,0],[10,10,0],[11,12,0],[13,14,0],[16,17,0],[19,20,0],[22,24,0],[26,28,0],[31,34,0],[37,40,0]],8595:[[4,5,0],[5,5,0],[6,6,0],[7,8,0],[8,9,0],[10,10,0],[11,12,0],[13,14,0],[16,17,0],[19,20,0],[22,24,0],[26,28,0],[31,34,0],[37,40,0]],8657:[[5,5,0],[7,5,0],[7,6,0],[9,8,0],[10,9,0],[13,10,0],[14,12,0],[17,14,0],[20,17,0],[24,20,0],[29,24,0],[34,28,0],[40,34,0],[48,40,0]],8659:[[5,5,0],[7,5,0],[7,6,0],[9,8,0],[10,9,0],[13,10,0],[14,12,0],[17,14,0],[20,17,0],[24,20,0],[29,24,0],[34,28,0],[40,34,0],[48,40,0]],8719:[[7,8,2],[8,9,2],[9,11,3],[11,12,3],[13,15,4],[15,17,4],[18,20,5],[21,24,6],[25,28,7],[30,34,9],[35,40,10],[42,47,12],[50,56,14],[59,67,17]],8720:[[7,8,2],[8,9,2],[9,11,3],[11,12,3],[13,15,4],[15,17,4],[18,20,5],[21,24,6],[25,28,7],[30,34,9],[35,40,10],[42,47,12],[50,56,14],[59,67,17]],8721:[[7,8,2],[9,9,2],[10,11,3],[12,12,3],[14,15,4],[17,18,5],[20,20,5],[24,24,6],[28,28,7],[33,34,9],[40,40,10],[47,47,12],[56,56,14],[66,67,17]],8730:[[8,9,3],[9,11,3],[11,13,4],[12,15,5],[15,17,5],[17,21,6],[20,24,7],[24,29,9],[29,34,10],[34,40,12],[40,48,14],[48,57,17],[57,67,20],[68,80,24]],8739:[[2,6,1],[2,7,1],[2,8,1],[2,9,1],[3,10,1],[3,12,1],[4,14,1],[5,16,1],[6,19,1],[7,22,1],[8,26,1],[9,31,1],[11,36,1],[13,43,1]],8741:[[3,6,1],[4,7,1],[4,8,1],[5,9,1],[6,10,1],[7,12,1],[8,14,1],[10,16,1],[12,19,1],[14,22,1],[17,26,1],[20,31,1],[23,36,1],[27,43,1]],8747:[[5,8,2],[5,10,3],[6,11,3],[7,14,4],[9,16,4],[11,19,5],[12,22,6],[15,26,7],[17,32,9],[21,38,11],[24,44,12],[29,53,15],[34,62,17],[41,74,21]],8748:[[7,8,2],[8,10,3],[10,11,3],[11,14,4],[14,16,4],[16,19,5],[19,22,6],[23,26,7],[27,32,9],[32,38,11],[38,44,12],[45,53,15],[53,62,17],[64,74,21]],8749:[[9,8,2],[11,10,3],[13,11,3],[15,14,4],[19,16,4],[22,19,5],[26,22,6],[31,26,7],[37,32,9],[43,38,11],[52,44,12],[61,53,15],[73,62,17],[86,74,21]],8750:[[5,8,2],[5,10,3],[6,11,3],[7,14,4],[9,16,4],[11,19,5],[12,22,6],[15,26,7],[17,32,9],[21,38,11],[24,44,12],[29,53,15],[34,62,17],[41,74,21]],8896:[[6,8,2],[7,10,3],[8,11,3],[10,12,3],[11,15,4],[13,18,5],[16,20,5],[19,24,6],[22,28,7],[26,34,9],[31,40,10],[37,47,12],[43,56,14],[52,67,17]],8897:[[6,8,2],[7,10,3],[8,11,3],[10,13,4],[11,15,4],[13,18,5],[16,21,6],[19,25,7],[22,29,8],[26,34,9],[31,41,11],[37,48,13],[43,57,15],[52,68,18]],8898:[[6,7,2],[7,10,3],[8,11,3],[10,12,3],[11,15,4],[13,18,5],[16,20,5],[18,25,7],[22,29,8],[26,34,9],[31,40,10],[36,47,12],[43,57,15],[51,67,17]],8899:[[6,8,2],[7,10,3],[8,11,3],[10,12,3],[11,15,4],[13,18,5],[16,20,5],[18,24,6],[22,28,7],[26,34,9],[31,40,10],[36,47,12],[43,56,14],[51,67,17]],8968:[[4,9,3],[4,10,3],[5,13,4],[6,15,5],[7,17,5],[8,20,6],[9,24,7],[11,28,8],[13,34,10],[15,40,12],[18,48,14],[21,56,16],[25,67,20],[30,79,23]],8969:[[2,9,3],[3,10,3],[3,13,4],[3,15,5],[4,17,5],[5,20,6],[6,24,7],[7,28,8],[8,34,10],[9,40,12],[11,48,14],[13,56,16],[15,67,20],[18,79,23]],8970:[[4,9,3],[4,11,3],[5,13,4],[6,15,4],[7,17,5],[8,21,6],[9,24,7],[11,28,8],[13,34,10],[15,41,12],[18,48,14],[21,57,17],[25,68,20],[30,79,23]],8971:[[2,9,3],[3,11,3],[3,13,4],[3,15,4],[4,17,5],[5,21,6],[6,24,7],[7,28,8],[8,34,10],[9,41,12],[11,48,14],[13,57,17],[15,68,20],[18,79,23]],9168:[[3,5,0],[3,5,0],[4,6,0],[4,8,0],[5,9,0],[6,10,0],[7,12,0],[9,14,0],[10,17,0],[12,20,0],[14,24,0],[17,28,0],[20,34,0],[24,40,0]],10216:[[3,9,3],[4,11,3],[4,13,4],[5,15,5],[6,17,5],[7,21,6],[8,24,7],[10,29,9],[11,34,10],[13,40,12],[16,48,14],[19,57,17],[22,67,20],[26,80,24]],10217:[[3,9,3],[4,11,3],[4,13,4],[5,15,5],[6,17,5],[7,21,6],[8,24,7],[9,29,9],[11,34,10],[13,40,12],[15,48,14],[18,57,17],[21,67,20],[25,80,24]],10752:[[8,8,2],[9,9,2],[11,11,3],[13,12,3],[15,15,4],[18,18,5],[21,20,5],[25,24,6],[30,28,7],[35,34,9],[42,40,10],[50,47,12],[59,56,14],[70,67,17]],10753:[[8,8,2],[9,8,2],[11,11,3],[13,12,3],[15,15,4],[18,18,5],[21,20,5],[25,24,6],[30,28,7],[35,34,9],[42,40,10],[49,47,12],[59,56,14],[70,67,17]],10754:[[8,8,2],[9,9,2],[11,11,3],[13,12,3],[15,15,4],[18,18,5],[21,20,5],[25,24,6],[30,28,7],[35,34,9],[42,40,10],[50,47,12],[59,56,14],[70,67,17]],10756:[[6,8,2],[7,10,3],[8,11,3],[10,12,3],[11,15,4],[13,18,5],[16,20,5],[18,24,6],[22,28,7],[26,34,9],[31,40,10],[36,47,12],[43,56,14],[51,67,17]],10758:[[6,8,2],[7,9,2],[8,11,3],[10,12,3],[11,15,4],[13,18,5],[16,20,5],[19,24,6],[22,28,7],[26,34,9],[31,40,10],[37,47,12],[43,56,14],[52,67,17]]},MathJax_Size2:{32:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],40:[[4,13,4],[5,15,5],[6,18,6],[7,22,8],[8,25,9],[10,30,11],[11,36,13],[14,42,15],[16,50,18],[19,60,21],[22,71,25],[27,84,30],[32,100,36],[37,119,43]],41:[[3,13,4],[4,15,5],[5,18,6],[5,22,8],[6,25,9],[7,30,11],[9,36,13],[10,42,15],[12,50,18],[14,60,21],[17,71,25],[20,84,30],[23,100,36],[28,119,43]],47:[[6,13,4],[7,15,5],[8,18,6],[9,21,8],[11,25,9],[13,30,11],[15,35,13],[18,42,15],[21,50,18],[25,59,21],[30,71,25],[36,84,30],[42,100,36],[50,119,43]],91:[[4,13,5],[4,16,6],[5,18,7],[6,22,8],[7,25,9],[8,30,11],[9,35,13],[11,43,16],[13,51,19],[15,59,21],[18,70,25],[22,84,30],[26,100,36],[30,119,43]],92:[[6,13,4],[7,15,5],[8,18,6],[9,21,8],[11,25,9],[13,30,11],[15,35,13],[18,42,15],[21,50,18],[25,59,21],[30,71,25],[35,84,30],[42,100,36],[50,119,43]],93:[[2,13,5],[3,16,6],[3,18,7],[3,22,8],[4,25,9],[5,30,11],[5,35,13],[6,43,16],[7,51,19],[9,59,21],[10,70,25],[12,84,30],[14,100,36],[17,119,43]],123:[[4,13,4],[5,15,5],[6,18,6],[7,22,8],[8,25,9],[10,30,11],[11,36,13],[13,42,15],[16,50,18],[18,60,21],[22,71,25],[26,84,30],[31,100,36],[36,119,43]],125:[[4,13,4],[5,15,5],[6,18,6],[7,22,8],[8,25,9],[10,30,11],[11,36,13],[13,42,15],[16,50,18],[18,60,21],[22,71,25],[26,84,30],[31,100,36],[36,119,43]],160:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],710:[[8,2,-4],[10,2,-5],[11,3,-6],[13,3,-7],[15,3,-8],[18,4,-9],[21,4,-11],[25,5,-13],[29,6,-16],[35,8,-19],[41,9,-22],[48,10,-26],[57,12,-31],[68,14,-37]],732:[[7,2,-4],[9,2,-5],[10,2,-6],[12,2,-7],[14,2,-8],[17,2,-10],[20,4,-11],[24,5,-13],[28,4,-17],[33,5,-20],[40,6,-24],[47,7,-28],[56,8,-34],[66,9,-40]],770:[[8,2,-4],[10,2,-5],[11,3,-6],[13,3,-7],[15,3,-8],[18,4,-9],[21,4,-11],[25,5,-13],[29,6,-16],[35,8,-19],[41,9,-22],[48,10,-26],[57,12,-31],[68,14,-37]],771:[[7,2,-4],[9,2,-5],[10,2,-6],[12,2,-7],[14,2,-8],[17,2,-10],[20,4,-11],[24,5,-13],[28,4,-17],[33,5,-20],[40,6,-24],[47,7,-28],[56,8,-34],[66,9,-40]],8719:[[9,10,3],[11,12,4],[12,15,5],[15,17,6],[17,19,6],[21,24,8],[24,28,9],[29,34,11],[34,40,13],[41,47,15],[48,56,18],[57,66,21],[68,78,25],[81,93,30]],8720:[[9,10,3],[11,12,4],[12,15,5],[15,17,6],[17,19,6],[21,24,8],[24,28,9],[29,34,11],[34,40,13],[41,47,15],[48,56,18],[57,66,21],[68,78,25],[81,93,30]],8721:[[10,10,3],[12,12,4],[14,15,5],[17,17,6],[20,20,7],[24,24,8],[28,28,9],[33,34,11],[39,40,13],[46,47,15],[55,56,18],[65,66,21],[77,78,25],[92,93,30]],8730:[[8,13,5],[9,16,6],[11,19,7],[12,22,8],[15,25,9],[17,31,11],[20,36,13],[24,43,16],[29,50,18],[34,60,22],[40,71,26],[48,85,31],[57,100,36],[68,119,43]],8747:[[7,16,6],[8,19,7],[10,23,9],[12,26,10],[14,31,12],[16,38,15],[19,44,17],[22,53,21],[27,62,24],[32,74,29],[37,88,34],[44,105,41],[53,124,48],[63,147,57]],8748:[[10,16,6],[13,19,7],[15,23,9],[18,26,10],[21,31,12],[25,38,15],[29,44,17],[35,53,21],[41,62,24],[49,74,29],[58,88,34],[69,105,41],[82,124,48],[98,147,57]],8749:[[14,16,6],[17,19,7],[20,23,9],[24,26,10],[28,31,12],[33,38,15],[39,44,17],[47,53,21],[56,62,24],[66,74,29],[78,88,34],[93,105,41],[110,124,48],[131,147,57]],8750:[[7,16,6],[8,19,7],[10,23,9],[12,26,10],[14,31,12],[16,38,15],[19,44,17],[22,53,21],[27,62,24],[32,74,29],[37,88,34],[44,105,41],[53,124,48],[63,147,57]],8896:[[8,11,4],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],[30,40,13],[35,47,15],[42,56,18],[50,66,21],[59,78,25],[70,93,30]],8897:[[8,11,4],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],[30,40,13],[35,47,15],[42,56,18],[50,66,21],[59,78,25],[70,93,30]],8898:[[8,10,3],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],[30,40,13],[35,47,15],[42,56,18],[50,66,21],[59,78,25],[70,93,30]],8899:[[8,10,3],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],[30,40,13],[35,47,15],[42,56,18],[50,66,21],[59,78,25],[70,93,30]],8968:[[4,13,5],[5,16,6],[6,19,7],[6,22,8],[8,25,9],[9,30,11],[10,36,13],[12,42,15],[15,50,18],[17,60,22],[21,71,26],[24,85,31],[29,100,36],[34,119,43]],8969:[[2,13,5],[3,16,6],[3,19,7],[4,22,8],[4,25,9],[5,30,11],[6,36,13],[8,42,15],[9,50,18],[10,60,22],[12,71,26],[15,85,31],[17,100,36],[20,119,43]],8970:[[4,13,5],[5,16,6],[6,19,7],[6,22,8],[8,25,9],[9,30,11],[10,36,13],[12,43,16],[15,50,18],[17,60,22],[21,72,26],[24,85,31],[29,100,36],[34,119,43]],8971:[[2,13,5],[3,16,6],[3,19,7],[4,22,8],[4,25,9],[5,30,11],[6,36,13],[8,43,16],[9,50,18],[10,60,22],[12,72,26],[15,85,31],[17,100,36],[20,119,43]],10216:[[4,13,5],[5,16,6],[6,19,7],[7,22,8],[8,25,9],[9,31,11],[11,36,13],[13,43,16],[15,50,18],[18,60,22],[21,71,26],[25,85,31],[29,100,36],[35,119,43]],10217:[[4,13,5],[4,16,6],[5,19,7],[6,22,8],[7,25,9],[9,31,11],[10,36,13],[12,43,16],[14,50,18],[17,60,22],[20,71,26],[24,85,31],[28,100,36],[33,119,43]],10752:[[10,10,3],[13,12,4],[15,15,5],[18,18,6],[21,21,7],[25,24,8],[29,28,9],[34,34,11],[41,40,13],[48,47,15],[57,56,18],[68,66,21],[81,78,25],[96,93,30]],10753:[[10,10,3],[12,13,4],[15,15,5],[18,17,6],[21,21,7],[25,24,8],[29,28,9],[34,34,11],[41,40,13],[48,47,15],[57,56,18],[68,66,21],[81,78,25],[96,93,30]],10754:[[10,10,3],[13,12,4],[15,15,5],[18,18,6],[21,21,7],[25,24,8],[29,28,9],[34,34,11],[41,40,13],[48,47,15],[57,56,18],[68,66,21],[81,78,25],[96,93,30]],10756:[[8,10,3],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],[30,40,13],[35,47,15],[42,56,18],[50,65,21],[59,78,25],[70,93,30]],10758:[[7,10,3],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],[29,40,13],[35,47,15],[42,55,18],[49,66,21],[59,78,25],[70,93,30]]},MathJax_Size3:{32:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],40:[[5,17,7],[6,20,8],[7,24,9],[9,29,11],[10,34,13],[12,40,16],[14,47,18],[17,56,22],[20,67,26],[24,79,31],[28,94,37],[33,112,44],[39,133,52],[47,158,62]],41:[[4,17,7],[5,20,8],[6,24,9],[7,29,11],[8,34,13],[9,40,16],[11,47,18],[13,56,22],[15,67,26],[18,79,31],[21,94,37],[25,112,44],[30,133,52],[35,158,62]],47:[[7,17,7],[9,20,8],[10,24,9],[12,28,11],[14,33,13],[17,40,16],[20,47,18],[23,56,22],[28,67,26],[33,79,31],[39,94,37],[46,112,44],[55,133,52],[66,158,62]],91:[[4,17,7],[5,20,8],[6,24,10],[7,28,11],[8,33,13],[9,41,17],[11,48,19],[12,57,23],[15,66,26],[17,79,31],[21,94,37],[24,111,44],[29,133,52],[34,158,62]],92:[[7,17,7],[9,20,8],[10,24,9],[12,28,11],[14,33,13],[17,40,16],[20,47,18],[23,56,22],[28,67,26],[33,79,31],[39,94,37],[46,112,44],[55,133,52],[65,158,62]],93:[[2,17,7],[3,20,8],[3,24,10],[4,28,11],[4,33,13],[5,41,17],[6,48,19],[7,57,23],[8,66,26],[10,79,31],[11,94,37],[13,111,44],[16,133,52],[19,158,62]],123:[[5,17,7],[6,20,8],[7,24,9],[8,29,11],[9,34,13],[11,40,16],[13,47,18],[15,56,22],[18,67,26],[21,79,31],[25,94,37],[29,112,44],[35,133,52],[41,158,62]],125:[[5,17,7],[6,20,8],[7,24,9],[8,29,11],[9,34,13],[11,40,16],[13,47,18],[15,56,22],[18,67,26],[21,79,31],[25,94,37],[29,112,44],[35,133,52],[41,158,62]],160:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],710:[[11,2,-4],[13,2,-5],[16,2,-6],[18,3,-7],[22,3,-8],[26,4,-9],[30,4,-11],[35,5,-13],[41,6,-16],[49,7,-19],[58,8,-22],[69,10,-26],[82,12,-31],[97,14,-37]],732:[[10,2,-4],[12,2,-5],[15,2,-6],[17,2,-7],[20,2,-8],[24,2,-10],[29,4,-11],[34,4,-13],[40,5,-16],[48,5,-20],[57,6,-24],[67,7,-28],[80,8,-34],[95,9,-40]],770:[[11,2,-4],[14,2,-5],[16,2,-6],[19,3,-7],[22,3,-8],[26,4,-9],[30,4,-11],[35,5,-13],[42,6,-16],[49,7,-19],[58,8,-22],[69,10,-26],[82,12,-31],[97,14,-37]],771:[[10,2,-4],[12,2,-5],[15,2,-6],[17,2,-7],[20,2,-8],[24,2,-10],[29,4,-11],[34,4,-13],[40,5,-16],[48,5,-20],[57,6,-24],[68,7,-28],[80,8,-34],[95,9,-40]],8730:[[8,17,7],[9,21,8],[10,25,10],[12,30,12],[15,35,14],[17,41,16],[20,48,19],[24,57,23],[29,68,27],[34,80,32],[40,95,38],[48,113,45],[57,134,53],[67,159,63]],8968:[[4,17,7],[5,20,8],[6,25,10],[7,29,12],[8,34,14],[10,41,16],[12,48,19],[14,57,23],[16,68,27],[19,80,32],[23,94,37],[27,113,45],[32,134,53],[38,159,63]],8969:[[3,17,7],[3,20,8],[5,25,10],[4,29,12],[5,34,14],[6,41,16],[7,48,19],[8,57,23],[10,68,27],[12,80,32],[14,94,37],[16,113,45],[19,134,53],[23,159,63]],8970:[[4,18,7],[5,21,8],[6,25,10],[7,29,11],[8,34,13],[10,40,16],[12,48,19],[14,57,23],[16,68,27],[19,80,32],[23,95,38],[27,113,45],[32,134,53],[38,159,63]],8971:[[3,18,7],[3,21,8],[5,25,10],[4,29,11],[5,34,13],[6,40,16],[7,48,19],[8,57,23],[10,68,27],[12,80,32],[14,95,38],[16,113,45],[19,134,53],[23,159,63]],10216:[[5,18,7],[6,21,8],[7,25,10],[8,30,12],[10,35,14],[11,41,16],[13,48,19],[16,57,23],[19,68,27],[22,80,32],[26,95,38],[31,113,45],[37,134,53],[44,159,63]],10217:[[5,17,7],[6,21,8],[7,25,10],[8,30,12],[9,35,14],[11,41,16],[13,48,19],[15,57,23],[18,68,27],[21,80,32],[25,95,38],[29,113,45],[35,134,53],[41,159,63]]},MathJax_Size4:{32:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],40:[[6,21,9],[7,25,10],[8,30,12],[9,36,15],[11,42,17],[13,50,21],[15,59,24],[18,70,29],[21,83,35],[25,99,41],[30,118,49],[36,140,58],[42,166,69],[50,198,82]],41:[[4,22,9],[5,25,10],[6,30,12],[7,36,15],[8,42,17],[10,50,21],[11,59,24],[13,70,29],[16,84,35],[19,99,41],[22,118,49],[26,140,58],[31,166,69],[37,198,82]],47:[[9,21,9],[11,25,10],[12,30,12],[15,35,15],[17,42,17],[21,50,21],[24,59,24],[29,70,29],[34,83,35],[41,99,41],[48,118,49],[57,140,58],[68,166,69],[81,198,82]],91:[[4,21,9],[5,25,11],[6,30,12],[7,35,15],[8,42,17],[10,51,22],[12,60,25],[14,70,29],[16,83,35],[19,99,41],[23,117,49],[27,140,58],[32,166,69],[38,197,82]],92:[[9,21,9],[11,25,10],[12,30,12],[15,35,15],[17,42,17],[21,50,21],[24,59,24],[29,70,29],[34,83,35],[41,99,41],[48,118,49],[57,140,58],[68,166,69],[81,198,82]],93:[[3,21,9],[3,25,11],[4,30,12],[4,35,15],[5,42,17],[6,51,22],[7,60,25],[8,70,29],[9,83,35],[11,99,41],[13,117,49],[15,140,58],[18,166,69],[21,197,82]],123:[[5,21,9],[6,25,10],[7,30,12],[8,36,15],[10,42,17],[11,50,21],[13,59,24],[16,70,29],[19,83,35],[22,99,41],[26,118,49],[31,140,58],[37,166,69],[44,198,82]],125:[[5,21,9],[6,25,10],[7,30,12],[8,36,15],[10,42,17],[11,50,21],[13,59,24],[16,70,29],[19,83,35],[22,99,41],[26,118,49],[31,140,58],[37,166,69],[44,198,82]],160:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],710:[[15,2,-4],[17,3,-5],[20,3,-6],[24,4,-7],[28,4,-8],[33,5,-9],[39,6,-11],[46,7,-13],[54,8,-16],[64,10,-18],[76,11,-22],[90,13,-26],[107,16,-31],[127,19,-37]],732:[[14,2,-4],[17,2,-5],[20,3,-5],[24,5,-6],[28,4,-8],[33,4,-10],[38,5,-11],[45,6,-14],[54,7,-16],[63,8,-19],[75,10,-23],[89,12,-27],[106,14,-32],[125,16,-38]],770:[[15,2,-4],[17,3,-5],[20,3,-6],[24,4,-7],[28,4,-8],[33,5,-9],[39,6,-11],[46,7,-13],[54,8,-16],[64,10,-18],[76,11,-22],[90,13,-26],[107,16,-31],[127,19,-37]],771:[[14,2,-4],[16,2,-5],[19,3,-5],[23,5,-6],[27,4,-8],[32,4,-10],[37,5,-11],[44,6,-14],[53,7,-16],[63,8,-19],[74,10,-23],[88,12,-27],[105,14,-32],[125,16,-38]],8730:[[8,22,9],[9,26,11],[10,31,13],[12,36,15],[15,43,18],[17,51,21],[20,60,25],[24,71,30],[29,84,35],[34,100,42],[40,118,49],[48,141,59],[57,167,70],[67,199,83]],8968:[[5,21,9],[6,26,11],[7,30,13],[8,36,15],[9,43,18],[11,51,21],[13,60,25],[15,70,29],[18,84,35],[21,100,42],[25,118,49],[30,141,59],[36,166,69],[42,199,83]],8969:[[3,21,9],[4,26,11],[4,30,13],[6,36,15],[6,43,18],[7,51,21],[8,60,25],[9,70,29],[11,84,35],[13,100,42],[15,118,49],[18,141,59],[21,166,69],[25,199,83]],8970:[[5,22,9],[6,26,11],[7,31,13],[8,36,15],[9,43,18],[11,50,21],[13,60,25],[15,70,29],[18,84,35],[21,100,42],[25,118,49],[30,140,58],[36,167,70],[42,199,83]],8971:[[3,22,9],[4,26,11],[4,31,13],[6,36,15],[6,43,18],[7,50,21],[8,60,25],[9,70,29],[11,84,35],[13,100,42],[15,118,49],[18,140,58],[21,167,70],[25,199,83]],9115:[[6,13,5],[7,16,6],[9,19,7],[10,22,8],[12,26,10],[14,31,11],[17,36,13],[20,43,16],[24,51,19],[28,60,22],[33,72,26],[40,85,31],[47,101,37],[56,120,44]],9116:[[3,6,1],[4,7,1],[5,7,1],[5,9,1],[6,10,1],[7,12,1],[9,13,1],[10,16,1],[12,18,1],[14,22,1],[17,25,1],[20,31,2],[24,36,2],[28,43,2]],9117:[[6,14,5],[7,16,6],[9,19,7],[10,22,8],[12,26,9],[14,31,11],[17,36,13],[20,43,15],[24,51,18],[28,61,22],[33,72,26],[40,85,30],[47,101,36],[56,120,43]],9118:[[5,13,5],[5,16,6],[6,19,7],[7,22,8],[9,26,10],[10,31,11],[12,36,13],[14,43,16],[17,51,19],[20,60,22],[23,72,26],[28,85,31],[33,101,37],[39,120,44]],9119:[[5,6,1],[5,7,1],[6,7,1],[7,9,1],[9,10,1],[10,12,1],[12,13,1],[14,16,1],[17,18,1],[20,22,1],[23,25,1],[28,31,2],[33,36,2],[39,43,2]],9120:[[5,14,5],[5,16,6],[6,19,7],[7,22,8],[9,26,9],[10,31,11],[12,36,13],[14,43,15],[17,51,18],[20,61,22],[23,72,26],[28,85,30],[33,101,36],[39,120,43]],9121:[[5,13,5],[6,16,6],[7,19,7],[8,22,8],[9,25,9],[11,31,11],[14,36,13],[16,42,15],[19,50,18],[22,60,22],[27,72,26],[32,84,30],[37,100,36],[44,119,43]],9122:[[3,5,0],[4,5,0],[4,6,0],[5,8,0],[6,9,0],[7,10,0],[8,12,0],[10,14,0],[12,17,0],[14,20,0],[16,24,0],[19,28,0],[23,34,0],[27,40,0]],9123:[[5,13,5],[6,16,6],[7,19,7],[8,22,8],[9,25,9],[11,31,11],[14,36,13],[16,42,15],[19,50,18],[22,61,22],[27,72,26],[32,84,30],[37,100,36],[44,119,43]],9124:[[3,13,5],[3,16,6],[5,19,7],[5,22,8],[5,25,9],[6,31,11],[8,36,13],[9,42,15],[11,50,18],[12,60,22],[15,72,26],[18,84,30],[21,100,36],[23,119,43]],9125:[[3,5,0],[3,5,0],[4,6,0],[5,8,0],[5,9,0],[6,10,0],[7,12,0],[9,14,0],[10,17,0],[12,20,0],[14,24,0],[17,28,0],[20,34,0],[23,40,0]],9126:[[3,13,5],[3,16,6],[5,19,7],[5,22,8],[5,25,9],[6,31,11],[8,36,13],[9,42,15],[11,50,18],[12,61,22],[15,72,26],[18,84,30],[21,100,36],[23,119,43]],9127:[[5,8,1],[6,9,1],[8,10,1],[9,12,1],[10,14,1],[12,16,1],[14,19,1],[17,22,1],[20,26,1],[24,31,1],[29,37,1],[34,44,2],[40,52,2],[48,62,2]],9128:[[4,14,5],[5,16,6],[5,19,7],[6,23,9],[7,27,10],[9,32,12],[10,37,14],[12,44,16],[15,52,19],[17,62,23],[20,73,27],[24,87,32],[28,103,38],[34,123,45]],9129:[[6,8,7],[6,9,8],[8,10,9],[9,12,11],[10,14,13],[12,16,15],[14,19,18],[17,22,21],[20,26,25],[24,31,30],[29,37,36],[34,43,42],[40,51,50],[48,61,60]],9130:[[4,4,1],[5,4,1],[5,5,1],[6,5,1],[7,6,1],[9,7,1],[10,8,1],[12,9,1],[14,10,1],[17,12,1],[20,14,1],[24,17,2],[28,19,1],[34,23,2]],9131:[[4,8,1],[5,9,1],[5,10,1],[6,12,1],[7,14,1],[9,16,1],[10,19,1],[12,22,1],[14,26,1],[17,31,1],[20,37,1],[24,43,1],[28,52,2],[34,62,2]],9132:[[6,14,5],[6,16,6],[8,19,7],[9,23,9],[10,27,10],[13,32,12],[14,37,14],[17,44,16],[20,52,19],[24,62,23],[29,73,27],[34,87,32],[40,103,38],[48,123,45]],9133:[[4,8,7],[5,9,8],[5,10,9],[6,12,11],[7,14,13],[9,16,15],[10,19,18],[12,22,21],[14,26,25],[17,31,30],[20,37,36],[24,44,42],[28,52,50],[34,62,60]],9143:[[5,14,7],[6,16,8],[8,19,9],[9,22,11],[11,26,13],[13,31,15],[15,37,18],[18,43,21],[21,51,25],[25,61,30],[30,72,35],[35,86,42],[42,101,49],[49,121,59]],10216:[[5,22,9],[6,26,11],[7,31,13],[9,36,15],[10,43,18],[12,51,21],[14,60,25],[17,70,29],[20,84,35],[24,100,42],[28,118,49],[33,140,58],[39,166,69],[47,199,83]],10217:[[5,22,9],[6,26,11],[7,31,13],[8,36,15],[10,43,18],[11,51,21],[13,60,25],[16,70,29],[19,84,35],[22,100,42],[26,118,49],[31,140,58],[37,167,70],[44,199,83]],57344:[[5,6,1],[6,7,1],[8,8,1],[9,9,1],[11,10,1],[13,12,1],[15,14,1],[18,16,1],[21,19,1],[25,22,1],[29,26,1],[35,30,1],[41,36,1],[49,43,1]],57345:[[8,5,0],[9,6,1],[11,7,1],[13,8,1],[15,9,0],[18,11,1],[22,13,1],[25,15,1],[30,18,1],[36,21,1],[42,25,1],[50,30,1],[60,35,1],[71,41,1]],57680:[[5,3,2],[5,3,2],[6,5,3],[7,5,3],[8,5,3],[9,6,4],[10,8,5],[12,8,5],[14,10,6],[17,12,8],[19,14,9],[24,16,10],[28,19,12],[33,23,15]],57681:[[5,3,2],[5,4,2],[6,5,3],[7,5,3],[8,5,3],[9,7,4],[11,8,5],[12,8,5],[15,10,6],[17,12,7],[20,14,9],[23,16,10],[28,19,12],[33,23,14]],57682:[[5,3,0],[5,3,0],[6,4,0],[7,4,0],[8,5,0],[9,6,0],[10,7,0],[12,8,0],[14,10,0],[17,11,0],[19,13,0],[24,16,0],[28,19,0],[33,22,0]],57683:[[5,3,0],[5,3,0],[6,4,0],[7,4,0],[8,5,0],[9,6,0],[11,7,0],[12,8,0],[15,10,0],[17,12,0],[20,14,0],[24,16,0],[28,19,0],[33,23,0]],57684:[[4,1,0],[5,1,0],[6,2,0],[6,2,0],[7,2,0],[8,2,0],[9,3,0],[11,3,0],[13,4,0],[15,4,0],[18,5,0],[21,6,0],[24,7,0],[28,8,0]]}});a.loadComplete(b.imgDir+b.imgPacked+"/imagedata.js")})(MathJax.OutputJax["HTML-CSS"],MathJax.Ajax);
| KevinSheedy/cdnjs | ajax/libs/mathjax/2.1/fonts/HTML-CSS/TeX/png/imagedata.js | JavaScript | mit | 118,906 |
/*
* /MathJax/fonts/HTML-CSS/TeX/png/Size3/Regular/Main.js
*
* Copyright (c) 2010 Design Science, Inc.
*
* 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.OutputJax["HTML-CSS"].defineImageData({MathJax_Size3:{32:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],40:[[5,17,7],[6,20,8],[7,24,9],[9,29,11],[10,34,13],[12,40,16],[14,47,18],[17,56,22],[20,67,26],[24,79,31],[28,94,37],[33,112,44],[39,133,52],[47,158,62]],41:[[4,17,7],[5,20,8],[6,24,9],[7,29,11],[8,34,13],[9,40,16],[11,47,18],[13,56,22],[15,67,26],[18,79,31],[21,94,37],[25,112,44],[30,133,52],[35,158,62]],47:[[7,17,7],[9,20,8],[10,24,9],[12,28,11],[14,33,13],[17,40,16],[20,47,18],[23,56,22],[28,67,26],[33,79,31],[39,94,37],[46,112,44],[55,133,52],[66,158,62]],91:[[4,17,7],[5,20,8],[6,24,10],[7,28,11],[8,33,13],[9,41,17],[11,48,19],[12,57,23],[15,66,26],[17,79,31],[21,94,37],[24,111,44],[29,133,52],[34,158,62]],92:[[7,17,7],[9,20,8],[10,24,9],[12,28,11],[14,33,13],[17,40,16],[20,47,18],[23,56,22],[28,67,26],[33,79,31],[39,94,37],[46,112,44],[55,133,52],[65,158,62]],93:[[2,17,7],[3,20,8],[3,24,10],[4,28,11],[4,33,13],[5,41,17],[6,48,19],[7,57,23],[8,66,26],[10,79,31],[11,94,37],[13,111,44],[16,133,52],[19,158,62]],123:[[5,17,7],[6,20,8],[7,24,9],[8,29,11],[9,34,13],[11,40,16],[13,47,18],[15,56,22],[18,67,26],[21,79,31],[25,94,37],[29,112,44],[35,133,52],[41,158,62]],125:[[5,17,7],[6,20,8],[7,24,9],[8,29,11],[9,34,13],[11,40,16],[13,47,18],[15,56,22],[18,67,26],[21,79,31],[25,94,37],[29,112,44],[35,133,52],[41,158,62]],160:[[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]],710:[[11,2,-4],[13,2,-5],[16,2,-6],[18,3,-7],[22,3,-8],[26,4,-9],[30,4,-11],[35,5,-13],[41,6,-16],[49,7,-19],[58,8,-22],[69,10,-26],[82,12,-31],[97,14,-37]],732:[[10,2,-4],[12,2,-5],[15,2,-6],[17,2,-7],[20,2,-8],[24,2,-10],[29,4,-11],[34,4,-13],[40,5,-16],[48,5,-20],[57,6,-24],[67,7,-28],[80,8,-34],[95,9,-40]],770:[[11,2,-4],[14,2,-5],[16,2,-6],[19,3,-7],[22,3,-8],[26,4,-9],[30,4,-11],[35,5,-13],[42,6,-16],[49,7,-19],[58,8,-22],[69,10,-26],[82,12,-31],[97,14,-37]],771:[[10,2,-4],[12,2,-5],[15,2,-6],[17,2,-7],[20,2,-8],[24,2,-10],[29,4,-11],[34,4,-13],[40,5,-16],[48,5,-20],[57,6,-24],[68,7,-28],[80,8,-34],[95,9,-40]],8730:[[8,17,7],[9,21,8],[10,25,10],[12,30,12],[15,35,14],[17,41,16],[20,48,19],[24,57,23],[29,68,27],[34,80,32],[40,95,38],[48,113,45],[57,134,53],[67,159,63]],8968:[[4,17,7],[5,20,8],[6,25,10],[7,29,12],[8,34,14],[10,41,16],[12,48,19],[14,57,23],[16,68,27],[19,80,32],[23,94,37],[27,113,45],[32,134,53],[38,159,63]],8969:[[3,17,7],[3,20,8],[5,25,10],[4,29,12],[5,34,14],[6,41,16],[7,48,19],[8,57,23],[10,68,27],[12,80,32],[14,94,37],[16,113,45],[19,134,53],[23,159,63]],8970:[[4,18,7],[5,21,8],[6,25,10],[7,29,11],[8,34,13],[10,40,16],[12,48,19],[14,57,23],[16,68,27],[19,80,32],[23,95,38],[27,113,45],[32,134,53],[38,159,63]],8971:[[3,18,7],[3,21,8],[5,25,10],[4,29,11],[5,34,13],[6,40,16],[7,48,19],[8,57,23],[10,68,27],[12,80,32],[14,95,38],[16,113,45],[19,134,53],[23,159,63]],10216:[[5,18,7],[6,21,8],[7,25,10],[8,30,12],[10,35,14],[11,41,16],[13,48,19],[16,57,23],[19,68,27],[22,80,32],[26,95,38],[31,113,45],[37,134,53],[44,159,63]],10217:[[5,17,7],[6,21,8],[7,25,10],[8,30,12],[9,35,14],[11,41,16],[13,48,19],[15,57,23],[18,68,27],[21,80,32],[25,95,38],[29,113,45],[35,134,53],[41,159,63]]}});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].imgDir+"/Size3/Regular"+MathJax.OutputJax["HTML-CSS"].imgPacked+"/Main.js");
| alexmojaki/cdnjs | ajax/libs/mathjax/2.0/fonts/HTML-CSS/TeX/png/Size3/Regular/Main.js | JavaScript | mit | 3,768 |
var fs = require('fs'),
path = require('path')
// add bash completions to your
// yargs-powered applications.
module.exports = function (yargs, usage) {
var self = {
completionKey: 'get-yargs-completions'
}
// get a list of completion commands.
self.getCompletion = function (done) {
var completions = [],
current = process.argv[process.argv.length - 1],
previous = process.argv.slice(process.argv.indexOf('--' + self.completionKey) + 1),
argv = yargs.parse(previous)
// a custom completion function can be provided
// to completion().
if (completionFunction) {
if (completionFunction.length < 3) {
// synchronous completion function.
return done(completionFunction(current, argv))
} else {
// asynchronous completion function
return completionFunction(current, argv, function (completions) {
done(completions)
})
}
}
if (!current.match(/^-/)) {
usage.getCommands().forEach(function (command) {
completions.push(command[0])
})
}
if (current.match(/^-/)) {
Object.keys(yargs.getOptions().key).forEach(function (key) {
completions.push('--' + key)
})
}
done(completions)
}
// generate the completion script to add to your .bashrc.
self.generateCompletionScript = function ($0) {
var script = fs.readFileSync(
path.resolve(__dirname, '../completion.sh.hbs'),
'utf-8'
),
name = path.basename($0)
// add ./to applications not yet installed as bin.
if ($0.match(/\.js$/)) $0 = './' + $0
script = script.replace(/{{app_name}}/g, name)
return script.replace(/{{app_path}}/g, $0)
}
// register a function to perform your own custom
// completions., this function can be either
// synchrnous or asynchronous.
var completionFunction = null
self.registerFunction = function (fn) {
completionFunction = fn
}
return self
}
| fahidRM/aqua-couch-test | node_modules/webpack/node_modules/yargs/lib/completion.js | JavaScript | mit | 1,961 |
// Because sometimes you need to mark the selected *text*.
//
// Adds an option 'styleSelectedText' which, when enabled, gives
// selected text the CSS class given as option value, or
// "CodeMirror-selectedtext" when the value is not a string.
(function() {
"use strict";
CodeMirror.defineOption("styleSelectedText", false, function(cm, val, old) {
var prev = old && old != CodeMirror.Init;
if (val && !prev) {
cm.state.markedSelection = [];
cm.state.markedSelectionStyle = typeof val == "string" ? val : "CodeMirror-selectedtext";
reset(cm);
cm.on("cursorActivity", onCursorActivity);
cm.on("change", onChange);
} else if (!val && prev) {
cm.off("cursorActivity", onCursorActivity);
cm.off("change", onChange);
clear(cm);
cm.state.markedSelection = cm.state.markedSelectionStyle = null;
}
});
function onCursorActivity(cm) {
cm.operation(function() { update(cm); });
}
function onChange(cm) {
if (cm.state.markedSelection.length)
cm.operation(function() { clear(cm); });
}
var CHUNK_SIZE = 8;
var Pos = CodeMirror.Pos;
function cmp(pos1, pos2) {
return pos1.line - pos2.line || pos1.ch - pos2.ch;
}
function coverRange(cm, from, to, addAt) {
if (cmp(from, to) == 0) return;
var array = cm.state.markedSelection;
var cls = cm.state.markedSelectionStyle;
for (var line = from.line;;) {
var start = line == from.line ? from : Pos(line, 0);
var endLine = line + CHUNK_SIZE, atEnd = endLine >= to.line;
var end = atEnd ? to : Pos(endLine, 0);
var mark = cm.markText(start, end, {className: cls});
if (addAt == null) array.push(mark);
else array.splice(addAt++, 0, mark);
if (atEnd) break;
line = endLine;
}
}
function clear(cm) {
var array = cm.state.markedSelection;
for (var i = 0; i < array.length; ++i) array[i].clear();
array.length = 0;
}
function reset(cm) {
clear(cm);
var from = cm.getCursor("start"), to = cm.getCursor("end");
coverRange(cm, from, to);
}
function update(cm) {
var from = cm.getCursor("start"), to = cm.getCursor("end");
if (cmp(from, to) == 0) return clear(cm);
var array = cm.state.markedSelection;
if (!array.length) return coverRange(cm, from, to);
var coverStart = array[0].find(), coverEnd = array[array.length - 1].find();
if (!coverStart || !coverEnd || to.line - from.line < CHUNK_SIZE ||
cmp(from, coverEnd.to) >= 0 || cmp(to, coverStart.from) <= 0)
return reset(cm);
while (cmp(from, coverStart.from) > 0) {
array.shift().clear();
coverStart = array[0].find();
}
if (cmp(from, coverStart.from) < 0) {
if (coverStart.to.line - from.line < CHUNK_SIZE) {
array.shift().clear();
coverRange(cm, from, coverStart.to, 0);
} else {
coverRange(cm, from, coverStart.from, 0);
}
}
while (cmp(to, coverEnd.to) < 0) {
array.pop().clear();
coverEnd = array[array.length - 1].find();
}
if (cmp(to, coverEnd.to) > 0) {
if (to.line - coverEnd.from.line < CHUNK_SIZE) {
array.pop().clear();
coverRange(cm, coverEnd.from, to);
} else {
coverRange(cm, coverEnd.to, to);
}
}
}
})();
| ewalczak10/echarsi | node_modules/grunt-node-inspector/node_modules/node-inspector/front-end/cm/markselection.js | JavaScript | mit | 3,306 |
require "spec_helper"
describe Rack::Test::Session do
describe "initialization" do
it "supports being initialized with a Rack::MockSession app" do
session = Rack::Test::Session.new(Rack::MockSession.new(app))
session.request("/").should be_ok
end
it "supports being initialized with an app" do
session = Rack::Test::Session.new(app)
session.request("/").should be_ok
end
end
describe "#request" do
it "requests the URI using GET by default" do
request "/"
last_request.should be_get
last_response.should be_ok
end
it "returns a response" do
request("/").should be_ok
end
it "uses the provided env" do
request "/", "X-Foo" => "bar"
last_request.env["X-Foo"].should == "bar"
end
it "allows HTTP_HOST to be set" do
request "/", "HTTP_HOST" => "www.example.ua"
last_request.env['HTTP_HOST'].should == "www.example.ua"
end
it "sets HTTP_HOST with port for non-default ports" do
request "http://foo.com:8080"
last_request.env["HTTP_HOST"].should == "foo.com:8080"
request "https://foo.com:8443"
last_request.env["HTTP_HOST"].should == "foo.com:8443"
end
it "sets HTTP_HOST without port for default ports" do
request "http://foo.com"
last_request.env["HTTP_HOST"].should == "foo.com"
request "http://foo.com:80"
last_request.env["HTTP_HOST"].should == "foo.com"
request "https://foo.com:443"
last_request.env["HTTP_HOST"].should == "foo.com"
end
it "defaults to GET" do
request "/"
last_request.env["REQUEST_METHOD"].should == "GET"
end
it "defaults the REMOTE_ADDR to 127.0.0.1" do
request "/"
last_request.env["REMOTE_ADDR"].should == "127.0.0.1"
end
it "sets rack.test to true in the env" do
request "/"
last_request.env["rack.test"].should == true
end
it "defaults to port 80" do
request "/"
last_request.env["SERVER_PORT"].should == "80"
end
it "defaults to example.org" do
request "/"
last_request.env["SERVER_NAME"].should == "example.org"
end
it "yields the response to a given block" do
request "/" do |response|
response.should be_ok
end
end
it "supports sending :params" do
request "/", :params => { "foo" => "bar" }
last_request.GET["foo"].should == "bar"
end
it "doesn't follow redirects by default" do
request "/redirect"
last_response.should be_redirect
last_response.body.should be_empty
end
it "allows passing :input in for POSTs" do
request "/", :method => :post, :input => "foo"
last_request.env["rack.input"].read.should == "foo"
end
it "converts method names to a uppercase strings" do
request "/", :method => :put
last_request.env["REQUEST_METHOD"].should == "PUT"
end
it "prepends a slash to the URI path" do
request "foo"
last_request.env["PATH_INFO"].should == "/foo"
end
it "accepts params and builds query strings for GET requests" do
request "/foo?baz=2", :params => {:foo => {:bar => "1"}}
last_request.GET.should == { "baz" => "2", "foo" => { "bar" => "1" }}
end
it "parses query strings with repeated variable names correctly" do
request "/foo?bar=2&bar=3"
last_request.GET.should == { "bar" => "3" }
end
it "accepts raw input in params for GET requests" do
request "/foo?baz=2", :params => "foo[bar]=1"
last_request.GET.should == { "baz" => "2", "foo" => { "bar" => "1" }}
end
it "does not rewrite a GET query string when :params is not supplied" do
request "/foo?a=1&b=2&c=3&e=4&d=5+%20"
last_request.query_string.should == "a=1&b=2&c=3&e=4&d=5+%20"
end
it "accepts params and builds url encoded params for POST requests" do
request "/foo", :method => :post, :params => {:foo => {:bar => "1"}}
last_request.env["rack.input"].read.should == "foo[bar]=1"
end
it "accepts raw input in params for POST requests" do
request "/foo", :method => :post, :params => "foo[bar]=1"
last_request.env["rack.input"].read.should == "foo[bar]=1"
end
context "when the response body responds_to?(:close)" do
class CloseableBody
def initialize
@closed = false
end
def each
return if @closed
yield "Hello, World!"
end
def close
@closed = true
end
end
it "closes response's body" do
body = CloseableBody.new
body.should_receive(:close)
app = lambda do |env|
[200, {"Content-Type" => "text/html", "Content-Length" => "13"}, body]
end
session = Rack::Test::Session.new(Rack::MockSession.new(app))
session.request("/")
end
it "closes response's body after iteration" do
app = lambda do |env|
[200, {"Content-Type" => "text/html", "Content-Length" => "13"}, CloseableBody.new]
end
session = Rack::Test::Session.new(Rack::MockSession.new(app))
session.request("/")
session.last_response.body.should == "Hello, World!"
end
end
context "when input is given" do
it "sends the input" do
request "/", :method => "POST", :input => "foo"
last_request.env["rack.input"].read.should == "foo"
end
it "does not send a multipart request" do
request "/", :method => "POST", :input => "foo"
last_request.env["CONTENT_TYPE"].should_not == "application/x-www-form-urlencoded"
end
end
context "for a POST specified with :method" do
it "uses application/x-www-form-urlencoded as the CONTENT_TYPE" do
request "/", :method => "POST"
last_request.env["CONTENT_TYPE"].should == "application/x-www-form-urlencoded"
end
end
context "for a POST specified with REQUEST_METHOD" do
it "uses application/x-www-form-urlencoded as the CONTENT_TYPE" do
request "/", "REQUEST_METHOD" => "POST"
last_request.env["CONTENT_TYPE"].should == "application/x-www-form-urlencoded"
end
end
context "when CONTENT_TYPE is specified in the env" do
it "does not overwrite the CONTENT_TYPE" do
request "/", "CONTENT_TYPE" => "application/xml"
last_request.env["CONTENT_TYPE"].should == "application/xml"
end
end
context "when the URL is https://" do
it "sets rack.url_scheme to https" do
get "https://example.org/"
last_request.env["rack.url_scheme"].should == "https"
end
it "sets SERVER_PORT to 443" do
get "https://example.org/"
last_request.env["SERVER_PORT"].should == "443"
end
it "sets HTTPS to on" do
get "https://example.org/"
last_request.env["HTTPS"].should == "on"
end
end
context "for a XHR" do
it "sends XMLHttpRequest for the X-Requested-With header" do
request "/", :xhr => true
last_request.env["HTTP_X_REQUESTED_WITH"].should == "XMLHttpRequest"
last_request.should be_xhr
end
end
end
describe "#header" do
it "sets a header to be sent with requests" do
header "User-Agent", "Firefox"
request "/"
last_request.env["HTTP_USER_AGENT"].should == "Firefox"
end
it "sets a Content-Type to be sent with requests" do
header "Content-Type", "application/json"
request "/"
last_request.env["CONTENT_TYPE"].should == "application/json"
end
it "sets a Host to be sent with requests" do
header "Host", "www.example.ua"
request "/"
last_request.env["HTTP_HOST"].should == "www.example.ua"
end
it "persists across multiple requests" do
header "User-Agent", "Firefox"
request "/"
request "/"
last_request.env["HTTP_USER_AGENT"].should == "Firefox"
end
it "overwrites previously set headers" do
header "User-Agent", "Firefox"
header "User-Agent", "Safari"
request "/"
last_request.env["HTTP_USER_AGENT"].should == "Safari"
end
it "can be used to clear a header" do
header "User-Agent", "Firefox"
header "User-Agent", nil
request "/"
last_request.env.should_not have_key("HTTP_USER_AGENT")
end
it "is overridden by headers sent during the request" do
header "User-Agent", "Firefox"
request "/", "HTTP_USER_AGENT" => "Safari"
last_request.env["HTTP_USER_AGENT"].should == "Safari"
end
end
describe "#env" do
it "sets the env to be sent with requests" do
env "rack.session", {:csrf => 'token'}
request "/"
last_request.env["rack.session"].should == {:csrf => 'token'}
end
it "persists across multiple requests" do
env "rack.session", {:csrf => 'token'}
request "/"
request "/"
last_request.env["rack.session"].should == {:csrf => 'token'}
end
it "overwrites previously set envs" do
env "rack.session", {:csrf => 'token'}
env "rack.session", {:some => :thing}
request "/"
last_request.env["rack.session"].should == {:some => :thing}
end
it "can be used to clear a env" do
env "rack.session", {:csrf => 'token'}
env "rack.session", nil
request "/"
last_request.env.should_not have_key("X_CSRF_TOKEN")
end
it "is overridden by envs sent during the request" do
env "rack.session", {:csrf => 'token'}
request "/", "rack.session" => {:some => :thing}
last_request.env["rack.session"].should == {:some => :thing}
end
end
describe "#authorize" do
it "sets the HTTP_AUTHORIZATION header" do
authorize "bryan", "secret"
request "/"
last_request.env["HTTP_AUTHORIZATION"].should == "Basic YnJ5YW46c2VjcmV0\n"
end
it "includes the header for subsequent requests" do
basic_authorize "bryan", "secret"
request "/"
request "/"
last_request.env["HTTP_AUTHORIZATION"].should == "Basic YnJ5YW46c2VjcmV0\n"
end
end
describe "follow_redirect!" do
it "follows redirects" do
get "/redirect"
follow_redirect!
last_response.should_not be_redirect
last_response.body.should == "You've been redirected"
last_request.env["HTTP_REFERER"].should eql("http://example.org/redirect")
end
it "does not include params when following the redirect" do
get "/redirect", { "foo" => "bar" }
follow_redirect!
last_request.GET.should == {}
end
it "raises an error if the last_response is not set" do
lambda {
follow_redirect!
}.should raise_error(Rack::Test::Error)
end
it "raises an error if the last_response is not a redirect" do
get "/"
lambda {
follow_redirect!
}.should raise_error(Rack::Test::Error)
end
end
describe "#last_request" do
it "returns the most recent request" do
request "/"
last_request.env["PATH_INFO"].should == "/"
end
it "raises an error if no requests have been issued" do
lambda {
last_request
}.should raise_error(Rack::Test::Error)
end
end
describe "#last_response" do
it "returns the most recent response" do
request "/"
last_response["Content-Type"].should == "text/html;charset=utf-8"
end
it "raises an error if no requests have been issued" do
lambda {
last_response
}.should raise_error
end
end
describe "after_request" do
it "runs callbacks after each request" do
ran = false
rack_mock_session.after_request do
ran = true
end
get "/"
ran.should == true
end
it "runs multiple callbacks" do
count = 0
2.times do
rack_mock_session.after_request do
count += 1
end
end
get "/"
count.should == 2
end
end
describe "#get" do
it_should_behave_like "any #verb methods"
def verb
"get"
end
it "uses the provided params hash" do
get "/", :foo => "bar"
last_request.GET.should == { "foo" => "bar" }
end
it "sends params with parens in names" do
get "/", "foo(1i)" => "bar"
last_request.GET["foo(1i)"].should == "bar"
end
it "supports params with encoding sensitive names" do
get "/", "foo bar" => "baz"
last_request.GET["foo bar"].should == "baz"
end
it "supports params with nested encoding sensitive names" do
get "/", "boo" => {"foo bar" => "baz"}
last_request.GET.should == {"boo" => {"foo bar" => "baz"}}
end
it "accepts params in the path" do
get "/?foo=bar"
last_request.GET.should == { "foo" => "bar" }
end
end
describe "#head" do
it_should_behave_like "any #verb methods"
def verb
"head"
end
end
describe "#post" do
it_should_behave_like "any #verb methods"
def verb
"post"
end
it "uses the provided params hash" do
post "/", :foo => "bar"
last_request.POST.should == { "foo" => "bar" }
end
it "supports params with encoding sensitive names" do
post "/", "foo bar" => "baz"
last_request.POST["foo bar"].should == "baz"
end
it "uses application/x-www-form-urlencoded as the CONTENT_TYPE" do
post "/"
last_request.env["CONTENT_TYPE"].should == "application/x-www-form-urlencoded"
end
it "accepts a body" do
post "/", "Lobsterlicious!"
last_request.body.read.should == "Lobsterlicious!"
end
context "when CONTENT_TYPE is specified in the env" do
it "does not overwrite the CONTENT_TYPE" do
post "/", {}, { "CONTENT_TYPE" => "application/xml" }
last_request.env["CONTENT_TYPE"].should == "application/xml"
end
end
end
describe "#put" do
it_should_behave_like "any #verb methods"
def verb
"put"
end
it "accepts a body" do
put "/", "Lobsterlicious!"
last_request.body.read.should == "Lobsterlicious!"
end
end
describe "#patch" do
it_should_behave_like "any #verb methods"
def verb
"patch"
end
it "accepts a body" do
patch "/", "Lobsterlicious!"
last_request.body.read.should == "Lobsterlicious!"
end
end
describe "#delete" do
it_should_behave_like "any #verb methods"
def verb
"delete"
end
end
describe "#options" do
it_should_behave_like "any #verb methods"
def verb
"options"
end
end
end
| julrusak/yoga-blog-app | vendor/bundle/ruby/2.2.0/gems/rack-test-0.6.3/spec/rack/test_spec.rb | Ruby | mit | 14,619 |
/*!
* jQuery UI Accordion 1.8.23
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Accordion#theming
*/
/* IE/Win - Fix animation bug - #4615 */
.ui-accordion { width: 100%; }
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-li-fix { display: inline; }
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
.ui-accordion .ui-accordion-content-active { display: block; }
| murali2706/AngularJS | app/bower_components/jquery-ui/themes/smoothness/jquery.ui.accordion.css | CSS | mit | 1,067 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../python/python"), require("../stex/stex"), require("../../addon/mode/overlay"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../python/python", "../stex/stex", "../../addon/mode/overlay"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode('rst', function (config, options) {
var rx_strong = /^\*\*[^\*\s](?:[^\*]*[^\*\s])?\*\*/;
var rx_emphasis = /^\*[^\*\s](?:[^\*]*[^\*\s])?\*/;
var rx_literal = /^``[^`\s](?:[^`]*[^`\s])``/;
var rx_number = /^(?:[\d]+(?:[\.,]\d+)*)/;
var rx_positive = /^(?:\s\+[\d]+(?:[\.,]\d+)*)/;
var rx_negative = /^(?:\s\-[\d]+(?:[\.,]\d+)*)/;
var rx_uri_protocol = "[Hh][Tt][Tt][Pp][Ss]?://";
var rx_uri_domain = "(?:[\\d\\w.-]+)\\.(?:\\w{2,6})";
var rx_uri_path = "(?:/[\\d\\w\\#\\%\\&\\-\\.\\,\\/\\:\\=\\?\\~]+)*";
var rx_uri = new RegExp("^" + rx_uri_protocol + rx_uri_domain + rx_uri_path);
var overlay = {
token: function (stream) {
if (stream.match(rx_strong) && stream.match (/\W+|$/, false))
return 'strong';
if (stream.match(rx_emphasis) && stream.match (/\W+|$/, false))
return 'em';
if (stream.match(rx_literal) && stream.match (/\W+|$/, false))
return 'string-2';
if (stream.match(rx_number))
return 'number';
if (stream.match(rx_positive))
return 'positive';
if (stream.match(rx_negative))
return 'negative';
if (stream.match(rx_uri))
return 'link';
while (stream.next() != null) {
if (stream.match(rx_strong, false)) break;
if (stream.match(rx_emphasis, false)) break;
if (stream.match(rx_literal, false)) break;
if (stream.match(rx_number, false)) break;
if (stream.match(rx_positive, false)) break;
if (stream.match(rx_negative, false)) break;
if (stream.match(rx_uri, false)) break;
}
return null;
}
};
var mode = CodeMirror.getMode(
config, options.backdrop || 'rst-base'
);
return CodeMirror.overlayMode(mode, overlay, true); // combine
}, 'python', 'stex');
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
CodeMirror.defineMode('rst-base', function (config) {
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
function format(string) {
var args = Array.prototype.slice.call(arguments, 1);
return string.replace(/{(\d+)}/g, function (match, n) {
return typeof args[n] != 'undefined' ? args[n] : match;
});
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
var mode_python = CodeMirror.getMode(config, 'python');
var mode_stex = CodeMirror.getMode(config, 'stex');
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
var SEPA = "\\s+";
var TAIL = "(?:\\s*|\\W|$)",
rx_TAIL = new RegExp(format('^{0}', TAIL));
var NAME =
"(?:[^\\W\\d_](?:[\\w!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)",
rx_NAME = new RegExp(format('^{0}', NAME));
var NAME_WWS =
"(?:[^\\W\\d_](?:[\\w\\s!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)";
var REF_NAME = format('(?:{0}|`{1}`)', NAME, NAME_WWS);
var TEXT1 = "(?:[^\\s\\|](?:[^\\|]*[^\\s\\|])?)";
var TEXT2 = "(?:[^\\`]+)",
rx_TEXT2 = new RegExp(format('^{0}', TEXT2));
var rx_section = new RegExp(
"^([!'#$%&\"()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\\1{3,}\\s*$");
var rx_explicit = new RegExp(
format('^\\.\\.{0}', SEPA));
var rx_link = new RegExp(
format('^_{0}:{1}|^__:{1}', REF_NAME, TAIL));
var rx_directive = new RegExp(
format('^{0}::{1}', REF_NAME, TAIL));
var rx_substitution = new RegExp(
format('^\\|{0}\\|{1}{2}::{3}', TEXT1, SEPA, REF_NAME, TAIL));
var rx_footnote = new RegExp(
format('^\\[(?:\\d+|#{0}?|\\*)]{1}', REF_NAME, TAIL));
var rx_citation = new RegExp(
format('^\\[{0}\\]{1}', REF_NAME, TAIL));
var rx_substitution_ref = new RegExp(
format('^\\|{0}\\|', TEXT1));
var rx_footnote_ref = new RegExp(
format('^\\[(?:\\d+|#{0}?|\\*)]_', REF_NAME));
var rx_citation_ref = new RegExp(
format('^\\[{0}\\]_', REF_NAME));
var rx_link_ref1 = new RegExp(
format('^{0}__?', REF_NAME));
var rx_link_ref2 = new RegExp(
format('^`{0}`_', TEXT2));
var rx_role_pre = new RegExp(
format('^:{0}:`{1}`{2}', NAME, TEXT2, TAIL));
var rx_role_suf = new RegExp(
format('^`{1}`:{0}:{2}', NAME, TEXT2, TAIL));
var rx_role = new RegExp(
format('^:{0}:{1}', NAME, TAIL));
var rx_directive_name = new RegExp(format('^{0}', REF_NAME));
var rx_directive_tail = new RegExp(format('^::{0}', TAIL));
var rx_substitution_text = new RegExp(format('^\\|{0}\\|', TEXT1));
var rx_substitution_sepa = new RegExp(format('^{0}', SEPA));
var rx_substitution_name = new RegExp(format('^{0}', REF_NAME));
var rx_substitution_tail = new RegExp(format('^::{0}', TAIL));
var rx_link_head = new RegExp("^_");
var rx_link_name = new RegExp(format('^{0}|_', REF_NAME));
var rx_link_tail = new RegExp(format('^:{0}', TAIL));
var rx_verbatim = new RegExp('^::\\s*$');
var rx_examples = new RegExp('^\\s+(?:>>>|In \\[\\d+\\]:)\\s');
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
function to_normal(stream, state) {
var token = null;
if (stream.sol() && stream.match(rx_examples, false)) {
change(state, to_mode, {
mode: mode_python, local: CodeMirror.startState(mode_python)
});
} else if (stream.sol() && stream.match(rx_explicit)) {
change(state, to_explicit);
token = 'meta';
} else if (stream.sol() && stream.match(rx_section)) {
change(state, to_normal);
token = 'header';
} else if (phase(state) == rx_role_pre ||
stream.match(rx_role_pre, false)) {
switch (stage(state)) {
case 0:
change(state, to_normal, context(rx_role_pre, 1));
stream.match(/^:/);
token = 'meta';
break;
case 1:
change(state, to_normal, context(rx_role_pre, 2));
stream.match(rx_NAME);
token = 'keyword';
if (stream.current().match(/^(?:math|latex)/)) {
state.tmp_stex = true;
}
break;
case 2:
change(state, to_normal, context(rx_role_pre, 3));
stream.match(/^:`/);
token = 'meta';
break;
case 3:
if (state.tmp_stex) {
state.tmp_stex = undefined; state.tmp = {
mode: mode_stex, local: CodeMirror.startState(mode_stex)
};
}
if (state.tmp) {
if (stream.peek() == '`') {
change(state, to_normal, context(rx_role_pre, 4));
state.tmp = undefined;
break;
}
token = state.tmp.mode.token(stream, state.tmp.local);
break;
}
change(state, to_normal, context(rx_role_pre, 4));
stream.match(rx_TEXT2);
token = 'string';
break;
case 4:
change(state, to_normal, context(rx_role_pre, 5));
stream.match(/^`/);
token = 'meta';
break;
case 5:
change(state, to_normal, context(rx_role_pre, 6));
stream.match(rx_TAIL);
break;
default:
change(state, to_normal);
}
} else if (phase(state) == rx_role_suf ||
stream.match(rx_role_suf, false)) {
switch (stage(state)) {
case 0:
change(state, to_normal, context(rx_role_suf, 1));
stream.match(/^`/);
token = 'meta';
break;
case 1:
change(state, to_normal, context(rx_role_suf, 2));
stream.match(rx_TEXT2);
token = 'string';
break;
case 2:
change(state, to_normal, context(rx_role_suf, 3));
stream.match(/^`:/);
token = 'meta';
break;
case 3:
change(state, to_normal, context(rx_role_suf, 4));
stream.match(rx_NAME);
token = 'keyword';
break;
case 4:
change(state, to_normal, context(rx_role_suf, 5));
stream.match(/^:/);
token = 'meta';
break;
case 5:
change(state, to_normal, context(rx_role_suf, 6));
stream.match(rx_TAIL);
break;
default:
change(state, to_normal);
}
} else if (phase(state) == rx_role || stream.match(rx_role, false)) {
switch (stage(state)) {
case 0:
change(state, to_normal, context(rx_role, 1));
stream.match(/^:/);
token = 'meta';
break;
case 1:
change(state, to_normal, context(rx_role, 2));
stream.match(rx_NAME);
token = 'keyword';
break;
case 2:
change(state, to_normal, context(rx_role, 3));
stream.match(/^:/);
token = 'meta';
break;
case 3:
change(state, to_normal, context(rx_role, 4));
stream.match(rx_TAIL);
break;
default:
change(state, to_normal);
}
} else if (phase(state) == rx_substitution_ref ||
stream.match(rx_substitution_ref, false)) {
switch (stage(state)) {
case 0:
change(state, to_normal, context(rx_substitution_ref, 1));
stream.match(rx_substitution_text);
token = 'variable-2';
break;
case 1:
change(state, to_normal, context(rx_substitution_ref, 2));
if (stream.match(/^_?_?/)) token = 'link';
break;
default:
change(state, to_normal);
}
} else if (stream.match(rx_footnote_ref)) {
change(state, to_normal);
token = 'quote';
} else if (stream.match(rx_citation_ref)) {
change(state, to_normal);
token = 'quote';
} else if (stream.match(rx_link_ref1)) {
change(state, to_normal);
if (!stream.peek() || stream.peek().match(/^\W$/)) {
token = 'link';
}
} else if (phase(state) == rx_link_ref2 ||
stream.match(rx_link_ref2, false)) {
switch (stage(state)) {
case 0:
if (!stream.peek() || stream.peek().match(/^\W$/)) {
change(state, to_normal, context(rx_link_ref2, 1));
} else {
stream.match(rx_link_ref2);
}
break;
case 1:
change(state, to_normal, context(rx_link_ref2, 2));
stream.match(/^`/);
token = 'link';
break;
case 2:
change(state, to_normal, context(rx_link_ref2, 3));
stream.match(rx_TEXT2);
break;
case 3:
change(state, to_normal, context(rx_link_ref2, 4));
stream.match(/^`_/);
token = 'link';
break;
default:
change(state, to_normal);
}
} else if (stream.match(rx_verbatim)) {
change(state, to_verbatim);
}
else {
if (stream.next()) change(state, to_normal);
}
return token;
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
function to_explicit(stream, state) {
var token = null;
if (phase(state) == rx_substitution ||
stream.match(rx_substitution, false)) {
switch (stage(state)) {
case 0:
change(state, to_explicit, context(rx_substitution, 1));
stream.match(rx_substitution_text);
token = 'variable-2';
break;
case 1:
change(state, to_explicit, context(rx_substitution, 2));
stream.match(rx_substitution_sepa);
break;
case 2:
change(state, to_explicit, context(rx_substitution, 3));
stream.match(rx_substitution_name);
token = 'keyword';
break;
case 3:
change(state, to_explicit, context(rx_substitution, 4));
stream.match(rx_substitution_tail);
token = 'meta';
break;
default:
change(state, to_normal);
}
} else if (phase(state) == rx_directive ||
stream.match(rx_directive, false)) {
switch (stage(state)) {
case 0:
change(state, to_explicit, context(rx_directive, 1));
stream.match(rx_directive_name);
token = 'keyword';
if (stream.current().match(/^(?:math|latex)/))
state.tmp_stex = true;
else if (stream.current().match(/^python/))
state.tmp_py = true;
break;
case 1:
change(state, to_explicit, context(rx_directive, 2));
stream.match(rx_directive_tail);
token = 'meta';
if (stream.match(/^latex\s*$/) || state.tmp_stex) {
state.tmp_stex = undefined; change(state, to_mode, {
mode: mode_stex, local: CodeMirror.startState(mode_stex)
});
}
break;
case 2:
change(state, to_explicit, context(rx_directive, 3));
if (stream.match(/^python\s*$/) || state.tmp_py) {
state.tmp_py = undefined; change(state, to_mode, {
mode: mode_python, local: CodeMirror.startState(mode_python)
});
}
break;
default:
change(state, to_normal);
}
} else if (phase(state) == rx_link || stream.match(rx_link, false)) {
switch (stage(state)) {
case 0:
change(state, to_explicit, context(rx_link, 1));
stream.match(rx_link_head);
stream.match(rx_link_name);
token = 'link';
break;
case 1:
change(state, to_explicit, context(rx_link, 2));
stream.match(rx_link_tail);
token = 'meta';
break;
default:
change(state, to_normal);
}
} else if (stream.match(rx_footnote)) {
change(state, to_normal);
token = 'quote';
} else if (stream.match(rx_citation)) {
change(state, to_normal);
token = 'quote';
}
else {
stream.eatSpace();
if (stream.eol()) {
change(state, to_normal);
} else {
stream.skipToEnd();
change(state, to_comment);
token = 'comment';
}
}
return token;
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
function to_comment(stream, state) {
return as_block(stream, state, 'comment');
}
function to_verbatim(stream, state) {
return as_block(stream, state, 'meta');
}
function as_block(stream, state, token) {
if (stream.eol() || stream.eatSpace()) {
stream.skipToEnd();
return token;
} else {
change(state, to_normal);
return null;
}
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
function to_mode(stream, state) {
if (state.ctx.mode && state.ctx.local) {
if (stream.sol()) {
if (!stream.eatSpace()) change(state, to_normal);
return null;
}
return state.ctx.mode.token(stream, state.ctx.local);
}
change(state, to_normal);
return null;
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
function context(phase, stage, mode, local) {
return {phase: phase, stage: stage, mode: mode, local: local};
}
function change(state, tok, ctx) {
state.tok = tok;
state.ctx = ctx || {};
}
function stage(state) {
return state.ctx.stage || 0;
}
function phase(state) {
return state.ctx.phase;
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
return {
startState: function () {
return {tok: to_normal, ctx: context(undefined, 0)};
},
copyState: function (state) {
var ctx = state.ctx, tmp = state.tmp;
if (ctx.local)
ctx = {mode: ctx.mode, local: CodeMirror.copyState(ctx.mode, ctx.local)};
if (tmp)
tmp = {mode: tmp.mode, local: CodeMirror.copyState(tmp.mode, tmp.local)};
return {tok: state.tok, ctx: ctx, tmp: tmp};
},
innerMode: function (state) {
return state.tmp ? {state: state.tmp.local, mode: state.tmp.mode}
: state.ctx.mode ? {state: state.ctx.local, mode: state.ctx.mode}
: null;
},
token: function (stream, state) {
return state.tok(stream, state);
}
};
}, 'python', 'stex');
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
CodeMirror.defineMIME('text/x-rst', 'rst');
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
});
| LSleutsky/cdnjs | ajax/libs/codemirror/4.13.0/mode/rst/rst.js | JavaScript | mit | 17,547 |
var util = require('util')
var INDENT_START = /[\{\[]/
var INDENT_END = /[\}\]]/
module.exports = function() {
var lines = []
var indent = 0
var push = function(str) {
var spaces = ''
while (spaces.length < indent*2) spaces += ' '
lines.push(spaces+str)
}
var line = function(fmt) {
if (!fmt) return line
if (INDENT_END.test(fmt.trim()[0]) && INDENT_START.test(fmt[fmt.length-1])) {
indent--
push(util.format.apply(util, arguments))
indent++
return line
}
if (INDENT_START.test(fmt[fmt.length-1])) {
push(util.format.apply(util, arguments))
indent++
return line
}
if (INDENT_END.test(fmt.trim()[0])) {
indent--
push(util.format.apply(util, arguments))
return line
}
push(util.format.apply(util, arguments))
return line
}
line.toString = function() {
return lines.join('\n')
}
line.toFunction = function(scope) {
var src = 'return ('+line.toString()+')'
var keys = Object.keys(scope || {}).map(function(key) {
return key
})
var vals = keys.map(function(key) {
return scope[key]
})
return Function.apply(null, keys.concat(src)).apply(null, vals)
}
if (arguments.length) line.apply(null, arguments)
return line
}
| CooCook/www | node_modules/grunt-contrib-less/node_modules/less/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-function/index.js | JavaScript | mit | 1,296 |
<div>
Este campo segue a sintaxe do cron (com poucas diferenças).
Especificamente, cada linha consite de 5 campos separados por tabulação (TAB) ou espeaço em branco:
<pre>MINUTO HORA DM MES DS</pre>
<table>
<tr>
<td>MINUTO</td>
<td>Minutos dentro de uma hora (0-59)</td>
</tr>
<tr>
<td>HORA</td>
<td>A hora do dia (0-23)</td>
</tr>
<tr>
<td>DM</td>
<td>O dia do mês (1-31)</td>
</tr>
<tr>
<td>MES</td>
<td>O mês (1-12)</td>
</tr>
<tr>
<td>DS</td>
<td>O dia da semana (0-7) onde 0 e 7 são Domingo.</td>
</tr>
</table>
<p>
Para especificar múltiplos valores para um campo, os seguintes operadores estão
disponíveis. Em ordem de precedência,
</p>
<ul>
<li>'*' pode ser usado para especificar todos os valores válidos.</li>
<li>'M-N' pode ser usado para especificar um intervalo, tal como "1-5"</li>
<li>'M-N/X' ou '*/X' pode ser usado para especificar saltos do valor de X entre o intervalo,
tal como "*/15" no campo MINUTO para "0,15,30,45" e "1-6/2" para "1,3,5"</li>
<li>'A,B,...,Z' pode ser usado para especificar múltiplos valores, tal como "0,30" ou "1,3,5"</li>
</ul>
<p>
Linhas vazias e linha que começam com '#' serão ignoradas como comentários.
</p><p>
Em adição, as constantes '@yearly', '@annually', '@monthly', '@weekly', '@daily', '@midnight',
e '@hourly' são suportadas.
</p>
<table>
<tr>
<td>Exemplos</td>
<td>
<pre>
# todo minuto
* * * * *
# no minuto 5 de cada hora (ou seja '2:05,3:05,...')
5 * * * *
</pre>
</td>
</tr>
</table>
</div>
| thomassuckow/jenkins | core/src/main/resources/hudson/triggers/TimerTrigger/help-spec_pt_BR.html | HTML | mit | 1,746 |
/*
Document : jquery.pnotify.default.css
Created on : Nov 23, 2009, 3:14:10 PM
Author : Hunter Perrin
Version : 1.3.1
Link : http://sciactive.com/pnotify/
Description:
Default styling for PNotify jQuery plugin.
*/
/* -- Notice */
.ui-pnotify {
top: 25px;
right: 25px;
position: absolute;
height: auto;
/* Ensures notices are above everything */
z-index: 9999;
}
/* Hides position: fixed from IE6 */
html > body > .ui-pnotify {
position: fixed;
}
.ui-pnotify .ui-pnotify-shadow {
-webkit-box-shadow: 0px 2px 10px rgba(50, 50, 50, 0.5);
-moz-box-shadow: 0px 2px 10px rgba(50, 50, 50, 0.5);
box-shadow: 0px 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;
}
/* -- History Pulldown */
.ui-pnotify-history-container {
position: absolute;
top: 0;
right: 18px;
width: 70px;
border-top: none;
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;
/* Ensures history container is above notices. */
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;
}
/* Alternate stack initial positioning. */
.ui-pnotify.stack-topleft, .ui-pnotify.stack-bottomleft {
left: 25px;
right: auto;
}
.ui-pnotify.stack-bottomright, .ui-pnotify.stack-bottomleft {
bottom: 25px;
top: auto;
} | theironcook/cdnjs | ajax/libs/pnotify/1.3.1/jquery.pnotify.default.css | CSS | mit | 2,010 |
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @link http://codeigniter.com
* @since Version 1.0.0
* @filesource
*/
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Array Helpers
*
* @package CodeIgniter
* @subpackage Helpers
* @category Helpers
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/helpers/array_helper.html
*/
// ------------------------------------------------------------------------
if ( ! function_exists('element'))
{
/**
* Element
*
* Lets you determine whether an array index is set and whether it has a value.
* If the element is empty it returns NULL (or whatever you specify as the default value.)
*
* @param string
* @param array
* @param mixed
* @return mixed depends on what the array contains
*/
function element($item, array $array, $default = NULL)
{
return array_key_exists($item, $array) ? $array[$item] : $default;
}
}
// ------------------------------------------------------------------------
if ( ! function_exists('random_element'))
{
/**
* Random Element - Takes an array as input and returns a random element
*
* @param array
* @return mixed depends on what the array contains
*/
function random_element($array)
{
return is_array($array) ? $array[array_rand($array)] : $array;
}
}
// --------------------------------------------------------------------
if ( ! function_exists('elements'))
{
/**
* Elements
*
* Returns only the array items specified. Will return a default value if
* it is not set.
*
* @param array
* @param array
* @param mixed
* @return mixed depends on what the array contains
*/
function elements($items, array $array, $default = NULL)
{
$return = array();
is_array($items) OR $items = array($items);
foreach ($items as $item)
{
$return[$item] = array_key_exists($item, $array) ? $array[$item] : $default;
}
return $return;
}
}
| heruprambadi/gc_depend_dropdown | system/helpers/array_helper.php | PHP | mit | 3,492 |
/*************************************************************
*
* MathJax/fonts/HTML-CSS/TeX/png/Math/Italic/Main.js
*
* Defines the image size data needed for the HTML-CSS OutputJax
* to display mathematics using fallback images when the fonts
* are not availble to the client browser.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2009-2010 Design Science, 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
*
* 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.
*
*/
MathJax.OutputJax["HTML-CSS"].defineImageData({
"MathJax_Math-italic": {
0x20: [ // SPACE
[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],
[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]
],
0x2F: [ // SOLIDUS
[5,6,1],[6,8,2],[7,8,2],[8,10,2],[9,12,3],[11,14,3],[13,18,4],[15,21,5],
[18,25,6],[21,31,7],[25,36,8],[30,45,10],[36,53,12],[42,61,14]
],
0x41: [ // LATIN CAPITAL LETTER A
[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[17,16,0],
[21,19,0],[24,24,0],[29,28,0],[34,34,1],[41,41,1],[48,47,1]
],
0x42: [ // LATIN CAPITAL LETTER B
[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],
[21,19,0],[25,23,0],[30,27,0],[36,33,0],[42,39,0],[50,45,0]
],
0x43: [ // LATIN CAPITAL LETTER C
[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],
[21,20,1],[25,25,1],[30,29,1],[36,35,1],[42,41,1],[50,48,1]
],
0x44: [ // LATIN CAPITAL LETTER D
[6,5,0],[7,6,0],[8,6,0],[10,8,0],[12,10,0],[14,11,0],[16,14,0],[19,16,0],
[23,19,0],[27,23,0],[32,27,0],[38,33,0],[45,39,0],[53,45,0]
],
0x45: [ // LATIN CAPITAL LETTER E
[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],
[22,19,0],[26,23,0],[30,27,0],[36,33,0],[43,39,0],[51,46,0]
],
0x46: [ // LATIN CAPITAL LETTER F
[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],
[21,19,0],[25,23,0],[30,27,0],[35,33,0],[42,39,0],[50,45,-1]
],
0x47: [ // LATIN CAPITAL LETTER G
[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],
[21,20,1],[25,25,1],[30,29,1],[36,35,1],[42,41,1],[50,48,1]
],
0x48: [ // LATIN CAPITAL LETTER H
[7,5,0],[8,7,0],[9,7,0],[11,9,0],[13,10,0],[15,12,0],[18,15,0],[21,17,0],
[25,20,0],[30,24,0],[35,28,0],[42,34,0],[50,40,0],[59,46,0]
],
0x49: [ // LATIN CAPITAL LETTER I
[4,5,0],[5,6,0],[5,6,0],[6,8,0],[7,9,0],[9,11,0],[10,14,0],[12,16,0],
[14,19,0],[17,23,0],[20,27,0],[24,33,0],[28,39,0],[34,45,0]
],
0x4A: [ // LATIN CAPITAL LETTER J
[5,5,0],[6,7,0],[7,6,0],[8,9,0],[9,10,0],[11,12,0],[13,15,0],[15,17,0],
[18,21,1],[21,25,1],[25,29,1],[30,35,1],[35,41,1],[42,47,1]
],
0x4B: [ // LATIN CAPITAL LETTER K
[7,5,0],[8,6,0],[9,6,0],[11,8,0],[13,10,0],[15,11,0],[18,14,0],[21,16,0],
[25,19,0],[30,23,0],[35,27,0],[42,33,0],[50,39,0],[59,45,0]
],
0x4C: [ // LATIN CAPITAL LETTER L
[5,5,0],[6,6,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,14,0],[15,16,0],
[18,19,0],[22,23,0],[26,27,0],[30,33,0],[36,39,0],[43,45,-1]
],
0x4D: [ // LATIN CAPITAL LETTER M
[8,5,0],[9,6,0],[11,6,0],[13,8,0],[15,10,0],[18,11,0],[21,14,0],[25,16,0],
[29,19,0],[35,24,0],[42,27,0],[49,33,0],[58,39,0],[70,45,-1]
],
0x4E: [ // LATIN CAPITAL LETTER N
[7,5,0],[8,7,0],[9,6,0],[11,9,0],[13,10,0],[15,12,0],[18,15,0],[21,17,0],
[25,20,0],[30,24,0],[35,28,0],[42,34,0],[50,39,0],[59,46,0]
],
0x4F: [ // LATIN CAPITAL LETTER O
[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],
[21,20,1],[25,25,1],[29,29,1],[35,35,2],[41,41,1],[49,48,1]
],
0x50: [ // LATIN CAPITAL LETTER P
[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],
[21,19,0],[25,23,0],[30,27,0],[35,33,0],[42,39,0],[50,45,0]
],
0x51: [ // LATIN CAPITAL LETTER Q
[6,6,1],[7,8,2],[8,8,2],[9,10,2],[11,12,3],[13,14,3],[15,18,4],[18,21,5],
[21,25,6],[25,31,7],[29,36,8],[35,44,10],[41,51,11],[49,59,13]
],
0x52: [ // LATIN CAPITAL LETTER R
[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],
[21,20,1],[25,24,1],[30,28,1],[35,34,1],[42,40,1],[50,46,1]
],
0x53: [ // LATIN CAPITAL LETTER S
[5,5,0],[6,6,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,14,0],[15,16,0],
[18,20,1],[22,25,1],[26,29,1],[31,35,2],[36,41,1],[43,48,2]
],
0x54: [ // LATIN CAPITAL LETTER T
[5,5,0],[6,6,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[17,16,0],
[20,19,0],[24,23,0],[28,26,0],[33,32,0],[40,38,0],[47,44,0]
],
0x55: [ // LATIN CAPITAL LETTER U
[6,5,0],[7,6,0],[8,7,0],[10,9,0],[11,10,0],[13,12,0],[15,15,0],[18,17,0],
[22,21,1],[26,25,1],[31,29,1],[36,35,1],[43,41,1],[51,48,1]
],
0x56: [ // LATIN CAPITAL LETTER V
[6,6,1],[7,7,1],[8,7,1],[10,9,1],[11,10,1],[13,12,1],[15,15,1],[18,17,1],
[22,20,1],[26,24,1],[31,28,1],[36,35,2],[43,41,2],[51,47,1]
],
0x57: [ // LATIN CAPITAL LETTER W
[8,5,0],[9,6,0],[11,6,0],[13,8,0],[15,9,0],[18,11,0],[21,14,0],[25,16,0],
[29,20,1],[35,24,1],[41,28,1],[49,34,1],[58,41,2],[69,48,2]
],
0x58: [ // LATIN CAPITAL LETTER X
[6,5,0],[8,7,1],[9,7,1],[10,9,1],[12,10,1],[15,12,1],[17,15,1],[20,17,1],
[24,20,1],[28,24,1],[34,28,1],[40,34,1],[48,40,1],[56,46,1]
],
0x59: [ // LATIN CAPITAL LETTER Y
[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],
[22,19,0],[26,23,0],[30,27,0],[36,33,0],[43,39,0],[51,45,-1]
],
0x5A: [ // LATIN CAPITAL LETTER Z
[5,5,0],[6,6,0],[8,6,0],[9,8,0],[10,9,0],[12,11,0],[15,14,0],[17,16,0],
[20,19,0],[24,23,0],[29,27,0],[34,33,0],[40,39,0],[48,45,0]
],
0x61: [ // LATIN SMALL LETTER A
[4,3,0],[5,4,0],[5,4,0],[6,5,0],[7,6,0],[9,7,0],[10,9,0],[12,10,0],
[14,12,0],[17,15,0],[20,17,0],[24,22,1],[28,26,1],[34,30,1]
],
0x62: [ // LATIN SMALL LETTER B
[3,5,0],[4,6,0],[5,6,0],[5,8,0],[6,9,0],[7,11,0],[9,14,0],[10,16,0],
[12,19,0],[14,24,0],[17,27,0],[20,34,1],[24,40,1],[28,47,1]
],
0x63: [ // LATIN SMALL LETTER C
[3,3,0],[4,4,0],[5,4,0],[6,5,0],[6,6,0],[8,7,0],[9,9,0],[10,10,0],
[12,12,0],[15,15,0],[17,17,0],[21,22,1],[24,26,1],[29,30,1]
],
0x64: [ // LATIN SMALL LETTER D
[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[9,11,0],[11,14,0],[13,16,0],
[15,19,0],[18,24,0],[21,27,0],[25,34,1],[30,40,1],[35,47,1]
],
0x65: [ // LATIN SMALL LETTER E
[3,3,0],[4,4,0],[5,4,0],[6,5,0],[6,6,0],[8,7,0],[9,9,0],[10,10,0],
[12,12,0],[15,15,0],[17,17,0],[20,22,1],[24,26,1],[29,30,1]
],
0x66: [ // LATIN SMALL LETTER F
[4,6,1],[5,8,2],[6,8,2],[7,10,2],[8,12,3],[10,14,3],[11,18,4],[13,21,5],
[16,25,6],[19,31,7],[22,36,8],[26,43,10],[31,51,12],[37,60,13]
],
0x67: [ // LATIN SMALL LETTER G
[4,4,1],[4,6,2],[5,6,2],[6,7,2],[7,9,3],[8,10,3],[10,13,4],[12,15,5],
[14,18,6],[16,22,7],[19,25,8],[23,31,10],[27,37,12],[32,42,13]
],
0x68: [ // LATIN SMALL LETTER H
[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[13,16,0],
[16,19,0],[19,24,0],[22,27,0],[26,34,1],[31,40,1],[37,47,1]
],
0x69: [ // LATIN SMALL LETTER I
[3,5,0],[3,6,0],[3,6,0],[4,8,0],[5,10,0],[5,11,0],[6,14,0],[7,16,0],
[9,18,0],[10,23,0],[12,26,0],[14,32,1],[17,38,1],[20,44,1]
],
0x6A: [ // LATIN SMALL LETTER J
[4,6,1],[5,8,2],[5,8,2],[6,10,2],[7,13,3],[8,14,3],[9,18,4],[11,20,5],
[13,24,6],[15,30,7],[17,33,8],[20,41,10],[24,49,12],[28,57,13]
],
0x6B: [ // LATIN SMALL LETTER K
[4,5,0],[5,6,0],[5,6,0],[6,8,0],[7,9,0],[9,11,0],[10,14,0],[12,16,0],
[14,19,0],[17,24,0],[20,27,0],[24,34,1],[28,40,1],[33,47,1]
],
0x6C: [ // LATIN SMALL LETTER L
[2,6,0],[3,7,0],[3,7,0],[4,9,0],[4,10,0],[5,12,0],[6,15,0],[7,17,0],
[8,20,0],[9,24,0],[11,28,0],[13,35,1],[15,40,1],[18,47,1]
],
0x6D: [ // LATIN SMALL LETTER M
[6,3,0],[8,4,0],[9,4,0],[10,5,0],[12,6,0],[15,7,0],[17,9,0],[20,10,0],
[24,12,0],[28,15,0],[34,17,0],[40,22,1],[48,26,1],[56,30,1]
],
0x6E: [ // LATIN SMALL LETTER N
[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[12,9,0],[14,10,0],
[16,12,0],[19,15,0],[23,17,0],[27,22,1],[32,26,1],[38,30,1]
],
0x6F: [ // LATIN SMALL LETTER O
[4,3,0],[4,4,0],[5,4,0],[6,5,0],[7,6,0],[8,7,0],[10,9,0],[12,10,0],
[14,12,0],[16,15,0],[19,17,0],[23,22,1],[27,26,1],[32,30,1]
],
0x70: [ // LATIN SMALL LETTER P
[5,4,1],[6,6,2],[6,6,2],[7,7,2],[8,9,3],[10,10,3],[11,13,4],[13,15,5],
[16,18,6],[19,22,7],[22,25,8],[26,31,10],[31,37,12],[36,43,14]
],
0x71: [ // LATIN SMALL LETTER Q
[4,4,1],[4,6,2],[5,6,2],[6,7,2],[7,9,3],[8,10,3],[9,13,4],[11,15,5],
[13,18,6],[16,22,7],[18,24,7],[22,31,10],[26,37,12],[31,42,13]
],
0x72: [ // LATIN SMALL LETTER R
[3,3,0],[4,4,0],[5,4,0],[6,5,0],[6,6,0],[8,7,0],[9,9,0],[10,10,0],
[12,12,0],[15,15,0],[17,17,0],[20,22,1],[24,26,1],[29,30,1]
],
0x73: [ // LATIN SMALL LETTER S
[3,3,0],[4,4,0],[5,4,0],[5,5,0],[6,6,0],[7,7,0],[9,9,0],[10,10,0],
[12,12,0],[14,15,0],[17,17,0],[20,22,1],[24,26,1],[28,30,1]
],
0x74: [ // LATIN SMALL LETTER T
[3,5,0],[3,6,0],[4,6,0],[4,7,0],[5,9,0],[6,10,0],[7,13,0],[8,15,0],
[10,18,0],[11,22,0],[13,25,0],[16,30,1],[19,36,1],[22,42,1]
],
0x75: [ // LATIN SMALL LETTER U
[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[11,9,0],[13,10,0],
[16,12,0],[19,15,0],[22,17,0],[26,22,1],[31,26,1],[37,30,1]
],
0x76: [ // LATIN SMALL LETTER V
[4,3,0],[4,4,0],[5,4,0],[6,5,0],[7,6,0],[8,7,0],[10,9,0],[11,10,0],
[13,12,0],[16,15,0],[19,17,0],[22,22,1],[26,26,1],[31,30,1]
],
0x77: [ // LATIN SMALL LETTER W
[5,3,0],[6,4,0],[7,4,0],[9,5,0],[10,6,0],[12,7,0],[14,9,0],[16,10,0],
[20,12,0],[23,15,0],[27,17,0],[32,22,1],[39,26,1],[46,30,1]
],
0x78: [ // LATIN SMALL LETTER X
[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[9,7,0],[11,9,0],[13,10,0],
[15,12,0],[18,15,0],[21,17,0],[25,22,1],[29,26,1],[35,30,1]
],
0x79: [ // LATIN SMALL LETTER Y
[4,4,1],[5,6,2],[5,6,2],[6,7,2],[7,9,3],[9,10,3],[10,13,4],[12,15,5],
[14,18,6],[17,22,7],[20,25,8],[23,31,10],[28,37,12],[33,42,13]
],
0x7A: [ // LATIN SMALL LETTER Z
[4,3,0],[4,4,0],[5,4,0],[6,5,0],[7,6,0],[8,7,0],[10,9,0],[11,10,0],
[13,12,0],[16,15,0],[19,17,0],[22,22,1],[26,26,1],[31,30,1]
],
0xA0: [ // NO-BREAK SPACE
[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],
[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]
],
0x393: [ // GREEK CAPITAL LETTER GAMMA
[5,5,0],[6,6,0],[8,6,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[17,16,0],
[20,19,0],[24,23,0],[29,27,0],[34,33,0],[40,39,0],[48,45,0]
],
0x394: [ // GREEK CAPITAL LETTER DELTA
[6,5,0],[7,6,0],[8,6,0],[10,8,0],[11,9,0],[14,11,0],[16,14,0],[19,16,0],
[22,19,0],[26,24,0],[31,28,0],[37,34,0],[44,41,0],[52,47,0]
],
0x398: [ // GREEK CAPITAL LETTER THETA
[6,5,0],[7,6,0],[8,6,0],[9,8,0],[11,9,0],[13,11,0],[15,14,0],[18,16,0],
[21,20,1],[25,25,1],[29,29,1],[35,35,2],[41,41,1],[49,48,1]
],
0x39B: [ // GREEK CAPITAL LETTER LAMDA
[5,5,0],[6,7,0],[7,7,0],[8,8,0],[10,10,0],[12,12,0],[14,15,0],[16,16,0],
[19,20,0],[23,24,0],[27,28,0],[32,34,1],[38,41,1],[45,47,0]
],
0x39E: [ // GREEK CAPITAL LETTER XI
[6,5,0],[7,6,0],[8,6,0],[10,8,0],[11,9,0],[13,11,0],[16,14,0],[19,16,0],
[22,19,0],[26,23,0],[31,27,0],[37,32,0],[43,38,0],[52,45,0]
],
0x3A0: [ // GREEK CAPITAL LETTER PI
[7,5,0],[8,6,0],[9,6,0],[11,8,0],[13,9,0],[15,11,0],[18,14,0],[21,16,0],
[25,19,0],[30,23,0],[35,27,0],[42,33,0],[50,39,0],[59,45,0]
],
0x3A3: [ // GREEK CAPITAL LETTER SIGMA
[6,5,0],[7,6,0],[8,6,0],[10,8,0],[12,9,0],[14,11,0],[16,14,0],[19,16,0],
[23,19,0],[27,23,0],[32,27,0],[38,33,0],[45,39,0],[54,46,0]
],
0x3A5: [ // GREEK CAPITAL LETTER UPSILON
[5,5,0],[6,6,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[17,16,0],
[20,19,0],[23,24,0],[28,28,0],[33,34,0],[39,40,0],[46,46,0]
],
0x3A6: [ // GREEK CAPITAL LETTER PHI
[5,5,0],[6,6,0],[7,6,0],[8,8,0],[9,9,0],[11,11,0],[13,14,0],[15,16,0],
[18,19,0],[22,23,0],[26,27,0],[30,32,-1],[36,39,0],[43,45,-1]
],
0x3A8: [ // GREEK CAPITAL LETTER PSI
[5,5,0],[6,6,0],[7,6,0],[9,8,0],[10,9,0],[12,11,0],[14,14,0],[17,16,0],
[20,19,0],[23,23,0],[28,27,0],[33,32,-1],[39,39,0],[46,45,-1]
],
0x3A9: [ // GREEK CAPITAL LETTER OMEGA
[6,5,0],[7,6,0],[8,6,0],[10,8,0],[11,9,0],[14,11,0],[16,14,0],[19,16,0],
[22,19,0],[26,24,0],[31,28,0],[37,34,0],[44,40,0],[52,47,0]
],
0x3B1: [ // GREEK SMALL LETTER ALPHA
[5,3,0],[5,4,0],[6,4,0],[8,5,0],[9,6,0],[10,7,0],[12,9,0],[14,10,0],
[17,12,0],[20,15,0],[24,17,0],[28,22,1],[34,26,1],[40,30,1]
],
0x3B2: [ // GREEK SMALL LETTER BETA
[4,6,1],[5,8,2],[6,8,2],[7,10,2],[8,12,3],[10,14,3],[12,18,4],[14,21,5],
[16,25,6],[19,31,7],[23,36,8],[27,43,10],[32,52,12],[38,59,13]
],
0x3B3: [ // GREEK SMALL LETTER GAMMA
[4,4,1],[5,6,2],[6,6,2],[7,7,2],[8,9,3],[10,10,3],[11,13,4],[13,15,5],
[16,18,6],[18,22,7],[22,25,8],[26,32,11],[31,38,13],[36,44,15]
],
0x3B4: [ // GREEK SMALL LETTER DELTA
[4,5,0],[4,6,0],[5,6,0],[6,8,0],[7,9,0],[8,11,0],[9,14,0],[11,16,0],
[13,19,0],[15,24,0],[18,28,0],[21,35,1],[25,41,1],[30,48,1]
],
0x3B5: [ // GREEK SMALL LETTER EPSILON
[3,3,0],[4,4,0],[5,4,0],[6,5,0],[6,6,0],[8,7,0],[9,9,0],[10,10,0],
[12,13,1],[15,16,1],[17,18,1],[20,22,1],[24,27,2],[29,31,1]
],
0x3B6: [ // GREEK SMALL LETTER ZETA
[4,6,1],[4,8,2],[5,8,2],[6,10,2],[7,12,3],[8,14,3],[10,18,4],[11,21,5],
[13,25,6],[16,31,7],[19,36,8],[22,43,10],[26,52,12],[31,60,13]
],
0x3B7: [ // GREEK SMALL LETTER ETA
[4,4,1],[5,6,2],[5,6,2],[6,7,2],[7,9,3],[9,10,3],[10,13,4],[12,15,5],
[14,18,6],[17,22,7],[20,25,8],[24,32,11],[28,38,13],[33,44,15]
],
0x3B8: [ // GREEK SMALL LETTER THETA
[4,5,0],[4,6,0],[5,6,0],[6,8,0],[7,9,0],[8,11,0],[9,14,0],[11,16,0],
[13,19,0],[16,24,0],[19,28,0],[22,34,1],[26,41,1],[31,47,1]
],
0x3B9: [ // GREEK SMALL LETTER IOTA
[3,3,0],[3,4,0],[4,4,0],[4,5,0],[5,6,0],[6,7,0],[7,9,0],[8,10,0],
[10,12,0],[11,15,0],[13,17,0],[16,22,1],[19,26,1],[22,30,1]
],
0x3BA: [ // GREEK SMALL LETTER KAPPA
[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[11,9,0],[13,10,0],
[16,12,0],[19,15,0],[22,17,0],[26,22,1],[31,26,1],[37,30,1]
],
0x3BB: [ // GREEK SMALL LETTER LAMDA
[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[13,16,0],
[16,19,0],[19,24,0],[22,27,0],[26,34,1],[31,40,1],[37,47,1]
],
0x3BC: [ // GREEK SMALL LETTER MU
[4,4,1],[5,6,2],[6,6,2],[7,7,2],[8,9,3],[10,10,3],[12,13,4],[14,15,5],
[16,18,6],[20,22,7],[23,25,8],[27,32,11],[33,38,13],[39,44,15]
],
0x3BD: [ // GREEK SMALL LETTER NU
[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[9,7,0],[11,9,0],[13,10,0],
[15,12,0],[18,15,0],[21,17,0],[25,22,1],[30,25,0],[35,29,0]
],
0x3BE: [ // GREEK SMALL LETTER XI
[4,6,1],[4,8,2],[5,8,2],[6,10,2],[7,12,3],[8,14,3],[9,18,4],[11,21,5],
[13,25,6],[15,31,7],[18,36,8],[21,43,10],[25,52,12],[30,60,13]
],
0x3BF: [ // GREEK SMALL LETTER OMICRON
[4,3,0],[4,4,0],[5,4,0],[6,5,0],[7,6,0],[8,7,0],[10,9,0],[12,10,0],
[14,12,0],[16,15,0],[19,17,0],[23,22,1],[27,26,1],[32,30,1]
],
0x3C0: [ // GREEK SMALL LETTER PI
[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[12,9,0],[14,10,0],
[16,12,0],[19,15,0],[23,17,0],[27,22,1],[32,25,1],[38,29,1]
],
0x3C1: [ // GREEK SMALL LETTER RHO
[4,4,1],[5,6,2],[5,6,2],[6,7,2],[7,9,3],[9,10,3],[10,13,4],[12,15,5],
[14,18,6],[17,22,7],[20,25,8],[24,32,11],[28,38,13],[34,44,15]
],
0x3C2: [ // GREEK SMALL LETTER FINAL SIGMA
[3,4,1],[4,5,1],[5,5,1],[5,7,2],[6,8,2],[7,9,2],[8,11,2],[10,13,3],
[12,15,3],[14,19,4],[17,22,5],[20,26,5],[23,32,7],[27,36,7]
],
0x3C3: [ // GREEK SMALL LETTER SIGMA
[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[10,7,0],[12,9,0],[14,10,0],
[16,12,0],[19,15,0],[23,17,0],[27,22,1],[32,25,1],[38,29,1]
],
0x3C4: [ // GREEK SMALL LETTER TAU
[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[9,7,0],[10,9,0],[12,10,0],
[15,12,0],[17,15,0],[21,17,0],[24,21,1],[29,26,1],[34,29,1]
],
0x3C5: [ // GREEK SMALL LETTER UPSILON
[4,3,0],[5,4,0],[6,4,0],[7,5,0],[8,6,0],[9,7,0],[11,9,0],[13,10,0],
[15,12,0],[18,15,0],[21,17,0],[25,22,1],[29,26,1],[35,30,1]
],
0x3C6: [ // GREEK SMALL LETTER PHI
[5,4,1],[6,6,2],[7,6,2],[8,7,2],[9,9,3],[11,10,3],[13,13,4],[15,15,5],
[18,18,6],[21,22,7],[25,25,8],[29,32,11],[35,38,13],[41,44,15]
],
0x3C7: [ // GREEK SMALL LETTER CHI
[5,4,1],[5,6,2],[6,6,2],[8,7,2],[9,9,3],[10,10,3],[12,13,4],[14,15,5],
[17,18,6],[20,22,7],[24,25,8],[28,31,10],[34,37,12],[40,42,13]
],
0x3C8: [ // GREEK SMALL LETTER PSI
[5,6,1],[6,8,2],[7,8,2],[8,10,2],[9,12,3],[11,14,3],[13,18,4],[15,21,5],
[18,25,6],[21,31,7],[25,35,8],[30,43,10],[35,51,12],[42,59,13]
],
0x3C9: [ // GREEK SMALL LETTER OMEGA
[5,3,0],[6,4,0],[6,4,0],[8,5,0],[9,6,0],[11,7,0],[12,9,0],[15,10,0],
[17,12,0],[20,15,0],[24,17,0],[29,22,1],[34,26,1],[40,30,1]
],
0x3D1: [ // GREEK THETA SYMBOL
[4,5,0],[5,6,0],[6,6,0],[7,8,0],[8,9,0],[10,11,0],[11,14,0],[14,16,0],
[16,19,0],[19,24,0],[23,28,0],[27,34,1],[32,41,1],[38,47,1]
],
0x3D5: [ // GREEK PHI SYMBOL
[4,6,1],[5,8,2],[6,8,2],[7,10,2],[8,12,3],[10,14,3],[12,18,4],[14,21,5],
[16,25,6],[20,31,7],[23,35,8],[27,43,10],[32,51,12],[39,59,13]
],
0x3D6: [ // GREEK PI SYMBOL
[6,3,0],[7,4,0],[9,4,0],[10,5,0],[12,6,0],[14,7,0],[17,9,0],[20,10,0],
[23,12,0],[28,15,0],[33,17,0],[39,22,1],[46,25,1],[55,29,1]
],
0x3F1: [ // GREEK RHO SYMBOL
[4,4,1],[5,6,2],[5,6,2],[6,7,2],[8,9,3],[9,10,3],[10,13,4],[12,15,5],
[15,18,6],[17,22,7],[20,25,8],[24,31,10],[29,37,12],[34,42,13]
],
0x3F5: [ // GREEK LUNATE EPSILON SYMBOL
[3,3,0],[4,4,0],[4,4,0],[5,5,0],[6,6,0],[7,7,0],[8,9,0],[9,10,0],
[11,12,0],[13,15,0],[15,17,0],[18,21,1],[21,25,1],[25,30,1]
]
}
});
MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].imgDir+"/Math/Italic"+
MathJax.OutputJax["HTML-CSS"].imgPacked+"/Main.js");
| kiwi89/cdnjs | ajax/libs/mathjax/1.1/fonts/HTML-CSS/TeX/png/Math/Italic/unpacked/Main.js | JavaScript | mit | 19,381 |
/*************************************************************
*
* MathJax/fonts/HTML-CSS/TeX/png/Size2/Regular/Main.js
*
* Defines the image size data needed for the HTML-CSS OutputJax
* to display mathematics using fallback images when the fonts
* are not availble to the client browser.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2009-2010 Design Science, 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
*
* 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.
*
*/
MathJax.OutputJax["HTML-CSS"].defineImageData({
"MathJax_Size2": {
0x20: [ // SPACE
[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],
[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]
],
0x28: [ // LEFT PARENTHESIS
[4,13,4],[5,15,5],[6,18,6],[7,22,8],[8,25,9],[10,30,11],[11,36,13],[14,42,15],
[16,50,18],[19,60,21],[22,71,25],[27,84,30],[32,100,36],[37,119,43]
],
0x29: [ // RIGHT PARENTHESIS
[3,13,4],[4,15,5],[5,18,6],[5,22,8],[6,25,9],[7,30,11],[9,36,13],[10,42,15],
[12,50,18],[14,60,21],[17,71,25],[20,84,30],[23,100,36],[28,119,43]
],
0x2F: [ // SOLIDUS
[6,13,4],[7,15,5],[8,18,6],[9,21,8],[11,25,9],[13,30,11],[15,35,13],[18,42,15],
[21,50,18],[25,59,21],[30,71,25],[36,84,30],[42,100,36],[50,119,43]
],
0x5B: [ // LEFT SQUARE BRACKET
[4,13,5],[4,16,6],[5,18,7],[6,22,8],[7,25,9],[8,30,11],[9,35,13],[11,43,16],
[13,51,19],[15,59,21],[18,70,25],[22,84,30],[26,100,36],[30,119,43]
],
0x5C: [ // REVERSE SOLIDUS
[6,13,4],[7,15,5],[8,18,6],[9,21,8],[11,25,9],[13,30,11],[15,35,13],[18,42,15],
[21,50,18],[25,59,21],[30,71,25],[35,84,30],[42,100,36],[50,119,43]
],
0x5D: [ // RIGHT SQUARE BRACKET
[2,13,5],[3,16,6],[3,18,7],[3,22,8],[4,25,9],[5,30,11],[5,35,13],[6,43,16],
[7,51,19],[9,59,21],[10,70,25],[12,84,30],[14,100,36],[17,119,43]
],
0x7B: [ // LEFT CURLY BRACKET
[4,13,4],[5,15,5],[6,18,6],[7,22,8],[8,25,9],[10,30,11],[11,36,13],[13,42,15],
[16,50,18],[18,60,21],[22,71,25],[26,84,30],[31,100,36],[36,119,43]
],
0x7D: [ // RIGHT CURLY BRACKET
[4,13,4],[5,15,5],[6,18,6],[7,22,8],[8,25,9],[10,30,11],[11,36,13],[13,42,15],
[16,50,18],[18,60,21],[22,71,25],[26,84,30],[31,100,36],[36,119,43]
],
0xA0: [ // NO-BREAK SPACE
[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],
[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0],[1,1,0]
],
0x2C6: [ // MODIFIER LETTER CIRCUMFLEX ACCENT
[8,2,-4],[10,2,-5],[11,3,-6],[13,3,-7],[15,3,-8],[18,4,-9],[21,4,-11],[25,5,-13],
[29,6,-16],[35,8,-19],[41,9,-22],[48,10,-26],[57,12,-31],[68,14,-37]
],
0x2DC: [ // SMALL TILDE
[7,2,-4],[9,2,-5],[10,2,-6],[12,2,-7],[14,2,-8],[17,2,-10],[20,4,-11],[24,5,-13],
[28,4,-17],[33,5,-20],[40,6,-24],[47,7,-28],[56,8,-34],[66,9,-40]
],
0x302: [ // COMBINING CIRCUMFLEX ACCENT
[8,2,-4],[10,2,-5],[11,3,-6],[13,3,-7],[15,3,-8],[18,4,-9],[21,4,-11],[25,5,-13],
[29,6,-16],[35,8,-19],[41,9,-22],[48,10,-26],[57,12,-31],[68,14,-37]
],
0x303: [ // COMBINING TILDE
[7,2,-4],[9,2,-5],[10,2,-6],[12,2,-7],[14,2,-8],[17,2,-10],[20,4,-11],[24,5,-13],
[28,4,-17],[33,5,-20],[40,6,-24],[47,7,-28],[56,8,-34],[66,9,-40]
],
0x220F: [ // N-ARY PRODUCT
[9,10,3],[11,12,4],[12,15,5],[15,17,6],[17,19,6],[21,24,8],[24,28,9],[29,34,11],
[34,40,13],[41,47,15],[48,56,18],[57,66,21],[68,78,25],[81,93,30]
],
0x2210: [ // N-ARY COPRODUCT
[9,10,3],[11,12,4],[12,15,5],[15,17,6],[17,19,6],[21,24,8],[24,28,9],[29,34,11],
[34,40,13],[41,47,15],[48,56,18],[57,66,21],[68,78,25],[81,93,30]
],
0x2211: [ // N-ARY SUMMATION
[10,10,3],[12,12,4],[14,15,5],[17,17,6],[20,20,7],[24,24,8],[28,28,9],[33,34,11],
[39,40,13],[46,47,15],[55,56,18],[65,66,21],[77,78,25],[92,93,30]
],
0x221A: [ // SQUARE ROOT
[8,13,5],[9,16,6],[11,19,7],[12,22,8],[15,25,9],[17,31,11],[20,36,13],[24,43,16],
[29,50,18],[34,60,22],[40,71,26],[48,85,31],[57,100,36],[68,119,43]
],
0x222B: [ // INTEGRAL
[7,16,6],[8,19,7],[10,23,9],[12,26,10],[14,31,12],[16,38,15],[19,44,17],[22,53,21],
[27,62,24],[32,74,29],[37,88,34],[44,105,41],[53,124,48],[63,147,57]
],
0x222C: [ // DOUBLE INTEGRAL
[10,16,6],[13,19,7],[15,23,9],[18,26,10],[21,31,12],[25,38,15],[29,44,17],[35,53,21],
[41,62,24],[49,74,29],[58,88,34],[69,105,41],[82,124,48],[98,147,57]
],
0x222D: [ // TRIPLE INTEGRAL
[14,16,6],[17,19,7],[20,23,9],[24,26,10],[28,31,12],[33,38,15],[39,44,17],[47,53,21],
[56,62,24],[66,74,29],[78,88,34],[93,105,41],[110,124,48],[131,147,57]
],
0x222E: [ // CONTOUR INTEGRAL
[7,16,6],[8,19,7],[10,23,9],[12,26,10],[14,31,12],[16,38,15],[19,44,17],[22,53,21],
[27,62,24],[32,74,29],[37,88,34],[44,105,41],[53,124,48],[63,147,57]
],
0x22C0: [ // N-ARY LOGICAL AND
[8,11,4],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],
[30,40,13],[35,47,15],[42,56,18],[50,66,21],[59,78,25],[70,93,30]
],
0x22C1: [ // N-ARY LOGICAL OR
[8,11,4],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],
[30,40,13],[35,47,15],[42,56,18],[50,66,21],[59,78,25],[70,93,30]
],
0x22C2: [ // N-ARY INTERSECTION
[8,10,3],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],
[30,40,13],[35,47,15],[42,56,18],[50,66,21],[59,78,25],[70,93,30]
],
0x22C3: [ // N-ARY UNION
[8,10,3],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],
[30,40,13],[35,47,15],[42,56,18],[50,66,21],[59,78,25],[70,93,30]
],
0x2308: [ // LEFT CEILING
[4,13,5],[5,16,6],[6,19,7],[6,22,8],[8,25,9],[9,30,11],[10,36,13],[12,42,15],
[15,50,18],[17,60,22],[21,71,26],[24,85,31],[29,100,36],[34,119,43]
],
0x2309: [ // RIGHT CEILING
[2,13,5],[3,16,6],[3,19,7],[4,22,8],[4,25,9],[5,30,11],[6,36,13],[8,42,15],
[9,50,18],[10,60,22],[12,71,26],[15,85,31],[17,100,36],[20,119,43]
],
0x230A: [ // LEFT FLOOR
[4,13,5],[5,16,6],[6,19,7],[6,22,8],[8,25,9],[9,30,11],[10,36,13],[12,43,16],
[15,50,18],[17,60,22],[21,72,26],[24,85,31],[29,100,36],[34,119,43]
],
0x230B: [ // RIGHT FLOOR
[2,13,5],[3,16,6],[3,19,7],[4,22,8],[4,25,9],[5,30,11],[6,36,13],[8,43,16],
[9,50,18],[10,60,22],[12,72,26],[15,85,31],[17,100,36],[20,119,43]
],
0x27E8: [ // MATHEMATICAL LEFT ANGLE BRACKET
[4,13,5],[5,16,6],[6,19,7],[7,22,8],[8,25,9],[9,31,11],[11,36,13],[13,43,16],
[15,50,18],[18,60,22],[21,71,26],[25,85,31],[29,100,36],[35,119,43]
],
0x27E9: [ // MATHEMATICAL RIGHT ANGLE BRACKET
[4,13,5],[4,16,6],[5,19,7],[6,22,8],[7,25,9],[9,31,11],[10,36,13],[12,43,16],
[14,50,18],[17,60,22],[20,71,26],[24,85,31],[28,100,36],[33,119,43]
],
0x2A00: [ // N-ARY CIRCLED DOT OPERATOR
[10,10,3],[13,12,4],[15,15,5],[18,18,6],[21,21,7],[25,24,8],[29,28,9],[34,34,11],
[41,40,13],[48,47,15],[57,56,18],[68,66,21],[81,78,25],[96,93,30]
],
0x2A01: [ // N-ARY CIRCLED PLUS OPERATOR
[10,10,3],[12,13,4],[15,15,5],[18,17,6],[21,21,7],[25,24,8],[29,28,9],[34,34,11],
[41,40,13],[48,47,15],[57,56,18],[68,66,21],[81,78,25],[96,93,30]
],
0x2A02: [ // N-ARY CIRCLED TIMES OPERATOR
[10,10,3],[13,12,4],[15,15,5],[18,18,6],[21,21,7],[25,24,8],[29,28,9],[34,34,11],
[41,40,13],[48,47,15],[57,56,18],[68,66,21],[81,78,25],[96,93,30]
],
0x2A04: [ // N-ARY UNION OPERATOR WITH PLUS
[8,10,3],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],
[30,40,13],[35,47,15],[42,56,18],[50,65,21],[59,78,25],[70,93,30]
],
0x2A06: [ // N-ARY SQUARE UNION OPERATOR
[7,10,3],[9,12,4],[11,15,5],[13,18,6],[15,21,7],[18,24,8],[21,28,9],[25,34,11],
[29,40,13],[35,47,15],[42,55,18],[49,66,21],[59,78,25],[70,93,30]
]
}
});
MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].imgDir+"/Size2/Regular"+
MathJax.OutputJax["HTML-CSS"].imgPacked+"/Main.js");
| j0k3r/cdnjs | ajax/libs/mathjax/2.1/fonts/HTML-CSS/TeX/png/Size2/Regular/unpacked/Main.js | JavaScript | mit | 8,659 |
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {"NUMBER_FORMATS":{"DECIMAL_SEP":",","GROUP_SEP":".","PATTERNS":[{"minInt":1,"minFrac":0,"macFrac":0,"posPre":"","posSuf":"","negPre":"-","negSuf":"","gSize":3,"lgSize":3,"maxFrac":3},{"minInt":1,"minFrac":2,"macFrac":0,"posPre":"","posSuf":" \u00A4","negPre":"-","negSuf":" \u00A4","gSize":3,"lgSize":3,"maxFrac":2}],"CURRENCY_SYM":"kr"},"pluralCat":function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;},"DATETIME_FORMATS":{"MONTH":["janúar","febrúar","mars","apríl","maí","júní","júlí","ágúst","september","október","nóvember","desember"],"SHORTMONTH":["jan","feb","mar","apr","maí","jún","júl","ágú","sep","okt","nóv","des"],"DAY":["sunnudagur","mánudagur","þriðjudagur","miðvikudagur","fimmtudagur","föstudagur","laugardagur"],"SHORTDAY":["sun","mán","þri","mið","fim","fös","lau"],"AMPMS":["f.h.","e.h."],"medium":"d.M.yyyy HH:mm:ss","short":"d.M.yyyy HH:mm","fullDate":"EEEE, d. MMMM y","longDate":"d. MMMM y","mediumDate":"d.M.yyyy","shortDate":"d.M.yyyy","mediumTime":"HH:mm:ss","shortTime":"HH:mm"},"id":"is-is"});
}]); | BenjaminVanRyseghem/cdnjs | ajax/libs/angular-i18n/1.0.0rc7/angular-locale_is-is.js | JavaScript | mit | 1,294 |
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":{"MONTH":["جنوری","فروری","مار چ","اپريل","مئ","جون","جولائ","اگست","ستمبر","اکتوبر","نومبر","دسمبر"],"SHORTMONTH":["جنوری","فروری","مار چ","اپريل","مئ","جون","جولائ","اگست","ستمبر","اکتوبر","نومبر","دسمبر"],"DAY":["اتوار","پير","منگل","بده","جمعرات","جمعہ","ہفتہ"],"SHORTDAY":["اتوار","پير","منگل","بده","جمعرات","جمعہ","ہفتہ"],"AMPMS":["قبل دوپہر","بعد دوپہر"],"medium":"d, MMM y h:mm:ss a","short":"d/M/yy h:mm a","fullDate":"EEEE, d, MMMM y","longDate":"d, MMMM y","mediumDate":"d, MMM y","shortDate":"d/M/yy","mediumTime":"h:mm:ss a","shortTime":"h:mm a"},"NUMBER_FORMATS":{"DECIMAL_SEP":".","GROUP_SEP":",","PATTERNS":[{"minInt":1,"minFrac":0,"macFrac":0,"posPre":"","posSuf":"","negPre":"-","negSuf":"","gSize":3,"lgSize":3,"maxFrac":3},{"minInt":1,"minFrac":2,"macFrac":0,"posPre":"\u00A4","posSuf":"","negPre":"\u00A4-","negSuf":"","gSize":3,"lgSize":3,"maxFrac":2}],"CURRENCY_SYM":"Rs."},"pluralCat":function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;},"id":"ur"});
}]); | jdh8/cdnjs | ajax/libs/angular-i18n/1.0.5/angular-locale_ur.js | JavaScript | mit | 1,420 |
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":{"MONTH":["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],"SHORTMONTH":["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],"DAY":["Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"],"SHORTDAY":["dom","seg","ter","qua","qui","sex","sáb"],"AMPMS":["Antes do meio-dia","Depois do meio-dia"],"medium":"d 'de' MMM 'de' yyyy HH:mm:ss","short":"dd/MM/yy HH:mm","fullDate":"EEEE, d 'de' MMMM 'de' y","longDate":"d 'de' MMMM 'de' y","mediumDate":"d 'de' MMM 'de' yyyy","shortDate":"dd/MM/yy","mediumTime":"HH:mm:ss","shortTime":"HH:mm"},"NUMBER_FORMATS":{"DECIMAL_SEP":",","GROUP_SEP":" ","PATTERNS":[{"minInt":1,"minFrac":0,"macFrac":0,"posPre":"","posSuf":"","negPre":"-","negSuf":"","gSize":3,"lgSize":3,"maxFrac":3},{"minInt":1,"minFrac":2,"macFrac":0,"posPre":"","posSuf":" \u00A4","negPre":"-","negSuf":" \u00A4","gSize":3,"lgSize":3,"maxFrac":2}],"CURRENCY_SYM":"€"},"pluralCat":function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;},"id":"pt-pt"});
}]); | calvinf/cdnjs | ajax/libs/angular-i18n/1.0.0rc5/angular-locale_pt-pt.js | JavaScript | mit | 1,347 |
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":{"MONTH":["Jannar","Frar","Marzu","April","Mejju","Ġunju","Lulju","Awwissu","Settembru","Ottubru","Novembru","Diċembru"],"SHORTMONTH":["Jan","Fra","Mar","Apr","Mej","Ġun","Lul","Aww","Set","Ott","Nov","Diċ"],"DAY":["Il-Ħadd","It-Tnejn","It-Tlieta","L-Erbgħa","Il-Ħamis","Il-Ġimgħa","Is-Sibt"],"SHORTDAY":["Ħad","Tne","Tli","Erb","Ħam","Ġim","Sib"],"AMPMS":["QN","WN"],"medium":"dd MMM y HH:mm:ss","short":"dd/MM/yyyy HH:mm","fullDate":"EEEE, d 'ta'’ MMMM y","longDate":"d 'ta'’ MMMM y","mediumDate":"dd MMM y","shortDate":"dd/MM/yyyy","mediumTime":"HH:mm:ss","shortTime":"HH:mm"},"NUMBER_FORMATS":{"DECIMAL_SEP":".","GROUP_SEP":",","PATTERNS":[{"minInt":1,"minFrac":0,"macFrac":0,"posPre":"","posSuf":"","negPre":"-","negSuf":"","gSize":3,"lgSize":3,"maxFrac":3},{"minInt":1,"minFrac":2,"macFrac":0,"posPre":"\u00A4","posSuf":"","negPre":"\u00A4-","negSuf":"","gSize":3,"lgSize":3,"maxFrac":2}],"CURRENCY_SYM":"₤"},"pluralCat":function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } if (n == 0 || ((n % 100) >= 2 && (n % 100) <= 4 && n == Math.floor(n))) { return PLURAL_CATEGORY.FEW; } if ((n % 100) >= 11 && (n % 100) <= 19 && n == Math.floor(n)) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;},"id":"mt"});
}]); | GaryChamberlain/cdnjs | ajax/libs/angular-i18n/1.1.0/angular-locale_mt.js | JavaScript | mit | 1,482 |
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {"NUMBER_FORMATS":{"DECIMAL_SEP":",","GROUP_SEP":".","PATTERNS":[{"minInt":1,"minFrac":0,"macFrac":0,"posPre":"","posSuf":"","negPre":"-","negSuf":"","gSize":3,"lgSize":3,"maxFrac":3},{"minInt":1,"minFrac":2,"macFrac":0,"posPre":"","posSuf":" \u00A4","negPre":"-","negSuf":" \u00A4","gSize":3,"lgSize":3,"maxFrac":2}],"CURRENCY_SYM":"Lt"},"pluralCat":function (n) { if ((n % 10) == 1 && ((n % 100) < 11 || (n % 100) > 19)) { return PLURAL_CATEGORY.ONE; } if ((n % 10) >= 2 && (n % 10) <= 9 && ((n % 100) < 11 || (n % 100) > 19) && n == Math.floor(n)) { return PLURAL_CATEGORY.FEW; } return PLURAL_CATEGORY.OTHER;},"DATETIME_FORMATS":{"MONTH":["sausis","vasaris","kovas","balandis","gegužė","birželis","liepa","rugpjūtis","rugsėjis","spalis","lapkritis","gruodis"],"SHORTMONTH":["Sau","Vas","Kov","Bal","Geg","Bir","Lie","Rgp","Rgs","Spl","Lap","Grd"],"DAY":["sekmadienis","pirmadienis","antradienis","trečiadienis","ketvirtadienis","penktadienis","šeštadienis"],"SHORTDAY":["Sk","Pr","An","Tr","Kt","Pn","Št"],"AMPMS":["priešpiet","popiet"],"medium":"yyyy.MM.dd HH:mm:ss","short":"yyyy-MM-dd HH:mm","fullDate":"y 'm'. MMMM d 'd'.,EEEE","longDate":"y 'm'. MMMM d 'd'.","mediumDate":"yyyy.MM.dd","shortDate":"yyyy-MM-dd","mediumTime":"HH:mm:ss","shortTime":"HH:mm"},"id":"lt-lt"});
}]); | tmorin/cdnjs | ajax/libs/angular-i18n/1.1.0/angular-locale_lt-lt.js | JavaScript | mit | 1,507 |
webshims.register("jme",function(a,b,c,d,e){"use strict";var f={},g={},h=Array.prototype.slice,i=a.extend({selector:".mediaplayer"},b.cfg.mediaelement.jme);b.cfg.mediaelement.jme=i,a.jme={plugins:{},data:function(b,c,d){var f=a(b).data("jme")||a.data(b,"jme",{});return d===e?c?f[c]:f:void(f[c]=d)},registerPlugin:function(b,c){this.plugins[b]=c,c.nodeName||(c.nodeName=""),c.className||(c.className=b),i[b]=a.extend(c.options||{},i[b]),i[b]&&i[b].text?c.text=i[b].text:i.i18n&&i.i18n[b]&&(c.text=i.i18n[b])},defineMethod:function(a,b){g[a]=b},defineProp:function(b,c){c||(c={}),c.set||(c.set=c.readonly?function(){throw b+" is readonly"}:a.noop),c.get||(c.get=function(c){return a.jme.data(c,b)}),f[b]=c},prop:function(b,c,d){if(!f[c])return a.prop(b,c,d);if(d===e)return f[c].get(b);var g=f[c].set(b,d);g===e&&(g=d),"noDataSet"!=g&&a.jme.data(b,c,g)}},a.fn.jmeProp=function(b,c){return a.access(this,a.jme.prop,b,c,arguments.length>1)},a.fn.jmeFn=function(b){var c,d=h.call(arguments,1);return this.each(function(){return c=(g[b]||a.prop(this,b)).apply(this,d),c!==e?!1:void 0}),c!==e?c:this};var j={emptied:1,pause:1},k={canplay:1,canplaythrough:1},l=i.selector;a.jme.initJME=function(b,c){a(l,b).add(c.filter(l)).jmePlayer()},a.jme.getDOMList=function(b){var c=[];return b||(b=[]),"string"==typeof b&&(b=b.split(" ")),a.each(b,function(a,b){b&&(b=document.getElementById(b),b&&c.push(b))}),c},a.jme.getButtonText=function(b,c){var d,e,f=function(f){e!==f&&(e=f,b.removeClass(c[f?0:1]).addClass(c[f]),d&&(b.prop("checked",!!f),(b.data("checkboxradio")||{refresh:a.noop}).refresh()))};return b.is('[type="checkbox"], [type="radio"]')?(b.prop("checked",function(){return this.defaultChecked}),d=!0):b.is("a")&&b.on("click",function(a){a.preventDefault()}),f},a.fn.jmePlayer=function(b){return this.each(function(){b&&a.jme.data(this,a.extend(!0,{},b));var c,d,e,f,g,h,l=a("audio, video",this).eq(0),m=a(this),n=a.jme.data(this),o=a.jme.data(l[0]);m.addClass(l.prop("nodeName").toLowerCase()+"player"),o.player=m,o.media=l,n.media||(e=function(){l.off("canplay",d),clearTimeout(f)},d=function(){var a=l.prop("paused")?"idle":"playing";m.attr("data-state",a)},c=function(b){var c,i,n=b.type;e(),k[n]&&"waiting"!=g||h&&"emptied"==n||("ended"==n||a.prop(this,"ended")?n="ended":"waiting"==n?a.prop(this,"readyState")>2?n="":(f=setTimeout(function(){l.prop("readyState")>2&&d()},9),l.on("canPlay",d)):j[n]?n="idle":(c=a.prop(this,"readyState"),i=a.prop(this,"paused"),n=!i&&3>c?"waiting":!i&&c>2?"playing":"idle"),"idle"==n&&m._seekpause&&(n=!1),n&&(g=n,m.attr("data-state",n)))},n.media=l,n.player=m,l.on("ended emptied play",function(){var a,b=function(){h=!1},c=function(){e(),l.jmeFn("pause"),i.noReload||!l.prop("ended")||!l.prop("paused")||l.prop("autoplay")||l.prop("loop")||l.hasClass("no-reload")||(h=!0,l.jmeFn("load"),m.attr("data-state","ended"),setTimeout(b))};return function(b){clearTimeout(a),"ended"!=b.type||i.noReload||l.prop("autoplay")||l.prop("loop")||l.hasClass("no-reload")||(a=setTimeout(c))}}()).on("emptied waiting canplay canplaythrough playing ended pause mediaerror",c).on("volumechange updateJMEState",function(){var b=a.prop(this,"volume");m[!b||a.prop(this,"muted")?"addClass":"removeClass"]("state-muted"),b=.01>b?"no":.36>b?"low":.7>b?"medium":"high",m.attr("data-volume",b)}),c&&l.on("updateJMEState",c).triggerHandler("updateJMEState"))})},a.jme.defineProp("isPlaying",{get:function(b){return!a.prop(b,"ended")&&!a.prop(b,"paused")&&a.prop(b,"readyState")>1&&!a.data(b,"mediaerror")},readonly:!0}),a.jme.defineProp("player",{readonly:!0}),a.jme.defineProp("media",{readonly:!0}),a.jme.defineProp("srces",{get:function(b){var c,d=a.jme.data(b),e=d.media.prop("src");return e?[{src:e}]:c=a.map(a("source",d.media).get(),function(b){var c={src:a.prop(b,"src")},d=a.attr(b,"media");return d&&(c.media=d),d=a.attr(b,"type"),d&&(c.type=d),c})},set:function(b,c){var d=a.jme.data(b),e=function(b,c){"string"==typeof c&&(c={src:c}),a(document.createElement("source")).attr(c).appendTo(d.media)};return d.media.removeAttr("src").find("source").remove(),a.isArray(c)?a.each(c,e):e(0,c),d.media.jmeFn("load"),"noDataSet"}}),a.jme.defineMethod("togglePlay",function(){a(this).jmeFn(f.isPlaying.get(this)?"pause":"play")}),a.jme.defineMethod("addControls",function(b){var c=a.jme.data(this)||{};if(c.media){var d=a.jme.data(c.player[0],"controlElements")||a([]);b=a(b),a.each(a.jme.plugins,function(d,e){b.filter("."+e.className).add(b.find("."+e.className)).each(function(){var b=a(this),d=a.jme.data(this);d.player=c.player,d.media=c.media,d._rendered||(d._rendered=!0,e.options&&a.each(e.options,function(a,b){a in d||(d[a]=b)}),e._create(b,c.media,c.player,d),b=null)})}),a.jme.data(c.player[0],"controlElements",d.add(b)),c.player.triggerHandler("controlsadded")}}),b.addReady(a.jme.initJME),b._polyfill(["mediaelement"])}); | iamso/cdnjs | ajax/libs/webshim/1.13.2-RC2/minified/shims/jme/b.js | JavaScript | mit | 4,849 |
.input-picker .ws-picker-body,.input-picker .ws-button-row,.input-picker .picker-grid,.input-picker .picker-list,.input-picker .ws-options button{zoom:1}.input-picker .ws-picker-body:before,.input-picker .ws-button-row:before,.input-picker .picker-grid:before,.input-picker .picker-list:before,.input-picker .ws-options button:before,.input-picker .ws-picker-body:after,.input-picker .ws-button-row:after,.input-picker .picker-grid:after,.input-picker .picker-list:after,.input-picker .ws-options button:after{display:table;clear:both;content:' '}.input-picker[data-class~=show-week] .ws-week,.show-week .input-picker .ws-week{display:table-cell}.input-picker[data-class~=show-yearbtns] .ws-picker-header,.show-yearbtns .input-picker .ws-picker-header{margin:0 4.23077em}.input-picker[data-class~=show-yearbtns] button.ws-year-btn,.show-yearbtns .input-picker button.ws-year-btn{display:inline-block}.input-picker[data-class~=hide-btnrow] .ws-button-row,.hide-btnrow .input-picker .ws-button-row{display:none}.input-picker[data-class~=show-selectnav] .ws-picker-header>button:after,.show-selectnav .input-picker .ws-picker-header>button:after,.input-picker[data-class~=show-uparrow] .ws-picker-header>button:after,.show-uparrow .input-picker .ws-picker-header>button:after{display:inline-block}.input-picker[data-class~=show-selectnav] .ws-picker-header>select,.show-selectnav .input-picker .ws-picker-header>select{display:inline-block}.input-picker[data-class~=show-selectnav] .ws-picker-header>button,.show-selectnav .input-picker .ws-picker-header>button{width:auto}.input-picker[data-class~=show-selectnav] .ws-picker-header>button>span,.show-selectnav .input-picker .ws-picker-header>button>span{display:none}.input-picker .ws-button-row button{border-radius:.30769em;background:#ccc;padding:.38462em .61538em;display:inline-block;border:.07692em solid transparent}.input-picker{overflow:visible;font-size:13px;outline:0;text-align:center;font-family:sans-serif;width:27.69231em;min-width:20.76923em;max-width:96vw}.input-picker .ws-po-outerbox{-webkit-transform:translate(0,30%);transform:translate(0,30%)}.input-picker[data-vertical=bottom] .ws-po-outerbox{-webkit-transform:translate(0,-30%);transform:translate(0,-30%)}.input-picker.time-popover,.input-picker.datetime-local-popover{width:31.92308em}.input-picker.time-popover .ws-prev,.input-picker.time-popover .ws-next,.input-picker.time-popover .ws-super-prev,.input-picker.time-popover .ws-super-next{display:none}.input-picker.ws-size-2{width:49.61538em;min-width:49.46154em}.input-picker.ws-size-3{width:73.84615em;min-width:73.53846em}.input-picker.color-popover{width:590px;min-width:575px}.input-picker abbr[title]{cursor:help}.input-picker li,.input-picker button{font-size:1em;line-height:1.23077em;color:#000;transition:all 400ms}.input-picker .ws-focus,.input-picker :focus{outline:1px dotted #000}.input-picker .ws-po-box{position:relative;padding:1.15385em 1.53846em;border-radius:.38462em;box-shadow:0 0 2px rgba(0,0,0,.3);direction:ltr}.input-picker .ws-picker-controls{position:absolute;top:1.15385em}.input-picker .ws-picker-controls>button{border:.07692em solid #ccc;border-radius:.38462em;padding:0;width:1.84615em;height:1.84615em;background:#eee;z-index:1;color:#333}.input-picker .ws-picker-controls>button.ws-year-btn:after,.input-picker .ws-picker-controls>button:before{display:inline-block;content:"";width:0;height:0;border-style:solid;margin-top:.29231em}.input-picker .ws-picker-controls>button span{display:none}.input-picker .ws-picker-controls>button:hover{border-color:#666;color:#000}.input-picker .ws-picker-controls>button[disabled]{opacity:.4;border-color:#eee;color:#ddd}.input-picker .prev-controls,.input-picker .ws-po-box[dir=rtl] .next-controls{left:1.53846em;right:auto}.input-picker .prev-controls [class*=ws-super-]:after,.input-picker .prev-controls button:before,.input-picker .ws-po-box[dir=rtl] .next-controls [class*=ws-super-]:after,.input-picker .ws-po-box[dir=rtl] .next-controls button:before{border-width:.35em .6em .35em 0;border-color:transparent #333 transparent transparent;margin-left:-.1em}.input-picker .prev-controls [class*=ws-super-],.input-picker .ws-po-box[dir=rtl] .next-controls [class*=ws-super-]{margin-right:.23077em;margin-left:0}.input-picker .prev-controls [class*=ws-super-][disabled],.input-picker .ws-po-box[dir=rtl] .next-controls [class*=ws-super-][disabled]{display:none}.input-picker .next-controls,.input-picker .ws-po-box[dir=rtl] .prev-controls{right:1.53846em;left:auto}.input-picker .next-controls button:before,.input-picker .ws-po-box[dir=rtl] .prev-controls button:before{margin-left:.11538em}.input-picker .next-controls [class*=ws-super-]:after,.input-picker .next-controls button:before,.input-picker .ws-po-box[dir=rtl] .prev-controls [class*=ws-super-]:after,.input-picker .ws-po-box[dir=rtl] .prev-controls button:before{border-width:.35em 0 .35em .6em;border-color:transparent transparent transparent #333;margin-right:-.1em}.input-picker .next-controls [class*=ws-super-],.input-picker .ws-po-box[dir=rtl] .prev-controls [class*=ws-super-]{margin-left:.23077em;margin-right:0}.input-picker .next-controls [class*=ws-super-][disabled],.input-picker .ws-po-box[dir=rtl] .prev-controls [class*=ws-super-][disabled]{display:none}.input-picker.ws-po-visible .ws-picker-controls button:after,.input-picker.ws-po-visible .ws-picker-controls button:before{content:" "}.input-picker .ws-po-box[dir=rtl]{direction:rtl}.input-picker.time-popover .ws-picker-body{padding-top:2.76923em}.input-picker .ws-picker-body{position:relative;padding:3.07692em 0 0;zoom:1;margin:0 -.76923em}.input-picker .ws-button-row{position:relative;margin:.76923em 0 0;border-top:.07692em solid #eee;padding:.76923em 0 0;text-align:left;z-index:2}.input-picker .ws-button-row button{border:.07692em solid #ccc;border-radius:5px;box-shadow:1px 1px 0 #fff;background-color:#ddd;background-image:-webkit-linear-gradient(top,#ececec 0,#ddd 100%);background-image:linear-gradient(to bottom,#ececec 0,#ddd 100%);transition:border-color 200ms linear;float:left}.input-picker .ws-button-row button.ws-empty{float:right}.input-picker .ws-po-box[dir=rtl] .ws-button-row button{float:right}.input-picker .ws-po-box[dir=rtl] .ws-button-row button.ws-empty{float:left}.input-picker[data-currentview=setMonthList] .ws-picker-header>select,.input-picker[data-currentview=setYearList] .ws-picker-header>select{max-width:90%}.input-picker[data-currentview=setDayList] .ws-picker-header>select{max-width:40%}.input-picker[data-currentview=setDayList] .ws-picker-header>.month-select{max-width:50%}.input-picker.time-popover .ws-picker-header{top:-2.30769em}.input-picker.time-popover .ws-picker-header button{font-size:1.15385em}.input-picker .ws-picker-header{position:absolute;top:-3.07692em;right:0;left:0;margin:0 2.69231em}.input-picker .ws-picker-header>button{display:inline-block;width:100%;margin:0;padding:.30769em 0;font-weight:700;color:#000}.input-picker .ws-picker-header>button>.month-digit,.input-picker .ws-picker-header>button>.monthname-short{display:none}.input-picker .ws-picker-header>button:after{content:" ";margin:-.1em .5em 0;width:0;height:0;border-style:solid;border-width:0 .3em .6em;border-color:transparent transparent #333;vertical-align:middle}.input-picker .ws-picker-header>button:hover{text-decoration:underline}.input-picker .ws-picker-header>button[disabled]:after{display:none!important}.input-picker .ws-picker-header>button[disabled]:hover{text-decoration:none}.input-picker .picker-grid{position:relative;zoom:1;overflow:hidden}.input-picker .picker-grid .monthname,.input-picker .picker-grid .month-digit{display:none}.input-picker.ws-size-1 .picker-list{float:none;width:auto}.input-picker .picker-list{position:relative;zoom:1;width:22.30769em;float:left;margin:0 10px;background:#fff}.input-picker .picker-list tr{border:0}.input-picker .picker-list th,.input-picker .picker-list td{padding:.23077em .38462em;text-align:center}.input-picker .picker-list.day-list td{padding:.03846em .15385em}.input-picker .picker-list.day-list td>button{padding:.42308em 0}.input-picker .picker-list.time-list>.ws-picker-header>button>.monthname{display:inline}.input-picker .picker-list.time-list td{padding:.07692em .38462em}.input-picker .picker-list.time-list td>button{padding:.52692em 0}.input-picker .picker-list td>button{display:block;padding:1.58992em 0;width:100%;border-radius:.38462em;color:#000;background-color:#fff}.input-picker .picker-list td>button.othermonth{color:#888}.input-picker .picker-list td>button:hover,.input-picker .picker-list td>button.checked-value{color:#fff;background:#000}.input-picker .picker-list td>button[disabled],.input-picker .picker-list td>button[disabled]:hover{color:#888;background-color:#fff}.input-picker .picker-list table{width:100%;margin:0;border:0 none;border-collapse:collapse;table-layout:fixed}.input-picker .picker-list th,.input-picker .picker-list td.week-cell{font-size:1em;line-height:1.23077em;padding-bottom:.23077em;text-transform:uppercase;font-weight:700}.input-picker .ws-options{margin:.76923em 0 0;border-top:.07692em solid #eee;padding:.76923em 0 0;text-align:left}.input-picker .ws-options h5{margin:0 0 .38462em;padding:0;font-size:1.07692em;font-weight:700}.input-picker .ws-options ul,.input-picker .ws-options li{padding:0;margin:0;list-style:none}.input-picker .ws-options button{display:block;padding:.30769em;width:100%;text-align:left;border-radius:.30769em}.input-picker .ws-options button.ws-focus,.input-picker .ws-options button:focus,.input-picker .ws-options button:hover{color:#fff;background:#000}.input-picker .ws-options button[disabled],.input-picker .ws-options button[disabled].ws-focus,.input-picker .ws-options button[disabled]:focus,.input-picker .ws-options button[disabled]:hover{color:#888;background:#fff;text-decoration:none}.input-picker .ws-options button .ws-value{float:left}.input-picker .ws-options button .ws-label{float:right;font-size:96%}.input-picker .ws-week,.input-picker .ws-year-btn{display:none}.ws-picker-controls>button{display:inline-block}.ws-picker-header>button:after{display:none}.ws-picker-header select{display:none} | froala/cdnjs | ajax/libs/webshim/1.4.2/minified/shims/styles/forms-picker.css | CSS | mit | 10,186 |
jade = (function(exports){
/*!
* Jade - runtime
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
/**
* Lame Array.isArray() polyfill for now.
*/
if (!Array.isArray) {
Array.isArray = function(arr){
return '[object Array]' == Object.prototype.toString.call(arr);
};
}
/**
* Lame Object.keys() polyfill for now.
*/
if (!Object.keys) {
Object.keys = function(obj){
var arr = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
arr.push(key);
}
}
return arr;
}
}
/**
* Merge two attribute objects giving precedence
* to values in object `b`. Classes are special-cased
* allowing for arrays and merging/joining appropriately
* resulting in a string.
*
* @param {Object} a
* @param {Object} b
* @return {Object} a
* @api private
*/
exports.merge = function merge(a, b) {
var ac = a['class'];
var bc = b['class'];
if (ac || bc) {
ac = ac || [];
bc = bc || [];
if (!Array.isArray(ac)) ac = [ac];
if (!Array.isArray(bc)) bc = [bc];
ac = ac.filter(nulls);
bc = bc.filter(nulls);
a['class'] = ac.concat(bc).join(' ');
}
for (var key in b) {
if (key != 'class') {
a[key] = b[key];
}
}
return a;
};
/**
* Filter null `val`s.
*
* @param {Mixed} val
* @return {Mixed}
* @api private
*/
function nulls(val) {
return val != null;
}
/**
* Render the given attributes object.
*
* @param {Object} obj
* @param {Object} escaped
* @return {String}
* @api private
*/
exports.attrs = function attrs(obj, escaped){
var buf = []
, terse = obj.terse;
delete obj.terse;
var keys = Object.keys(obj)
, len = keys.length;
if (len) {
buf.push('');
for (var i = 0; i < len; ++i) {
var key = keys[i]
, val = obj[key];
if ('boolean' == typeof val || null == val) {
if (val) {
terse
? buf.push(key)
: buf.push(key + '="' + key + '"');
}
} else if (0 == key.indexOf('data') && 'string' != typeof val) {
buf.push(key + "='" + JSON.stringify(val) + "'");
} else if ('class' == key && Array.isArray(val)) {
buf.push(key + '="' + exports.escape(val.join(' ')) + '"');
} else if (escaped && escaped[key]) {
buf.push(key + '="' + exports.escape(val) + '"');
} else {
buf.push(key + '="' + val + '"');
}
}
}
return buf.join(' ');
};
/**
* Escape the given string of `html`.
*
* @param {String} html
* @return {String}
* @api private
*/
exports.escape = function escape(html){
return String(html)
.replace(/&(?!(\w+|\#\d+);)/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
/**
* Re-throw the given `err` in context to the
* the jade in `filename` at the given `lineno`.
*
* @param {Error} err
* @param {String} filename
* @param {String} lineno
* @api private
*/
exports.rethrow = function rethrow(err, filename, lineno){
if (!filename) throw err;
var context = 3
, str = require('fs').readFileSync(filename, 'utf8')
, lines = str.split('\n')
, start = Math.max(lineno - context, 0)
, end = Math.min(lines.length, lineno + context);
// Error context
var context = lines.slice(start, end).map(function(line, i){
var curr = i + start + 1;
return (curr == lineno ? ' > ' : ' ')
+ curr
+ '| '
+ line;
}).join('\n');
// Alter exception message
err.path = filename;
err.message = (filename || 'Jade') + ':' + lineno
+ '\n' + context + '\n\n' + err.message;
throw err;
};
return exports;
})({});
| staugs/blog | node_modules/mocha/node_modules/jade/runtime.js | JavaScript | mit | 3,644 |
(function(){var t,n,r,e,u,i,o,s,c,a,f,h,l,p,d,v,y,m,b,g,w,E,D,S,O,M,_,A,k,I,W,P,T,x,V,F,B,H,C,q,L,U,N,z,j,R,Q,Z,$,X,G,J,K,Y,tt,nt,rt,et,ut,it,ot,st,ct,at={}.hasOwnProperty,ft=function(t,n){function r(){this.constructor=t}for(var e in n)at.call(n,e)&&(t[e]=n[e]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},ht=[].slice,lt=function(t,n){return function(){return t.apply(n,arguments)}};t={toString:function(){return"Bacon"}},t.version="0.7.64",h=("undefined"!=typeof global&&null!==global?global:this).Error,$=function(){},L=function(t,n){return n},V=function(t,n){return t},S=function(t){return t.slice(0)},H=function(t){return t instanceof Array},q=function(t){return t instanceof v},E={indexOf:Array.prototype.indexOf?function(t,n){return t.indexOf(n)}:function(t,n){var r,e,u,i;for(r=e=0,u=t.length;u>e;r=++e)if(i=t[r],n===i)return r;return-1},indexWhere:function(t,n){var r,e,u,i;for(r=e=0,u=t.length;u>e;r=++e)if(i=t[r],n(i))return r;return-1},head:function(t){return t[0]},always:function(t){return function(){return t}},negate:function(t){return function(n){return!t(n)}},empty:function(t){return 0===t.length},tail:function(t){return t.slice(1,t.length)},filter:function(t,n){var r,e,u,i;for(r=[],e=0,u=n.length;u>e;e++)i=n[e],t(i)&&r.push(i);return r},map:function(t,n){var r,e,u,i;for(u=[],r=0,e=n.length;e>r;r++)i=n[r],u.push(t(i));return u},each:function(t,n){var r,e;for(r in t)at.call(t,r)&&(e=t[r],n(r,e));return void 0},toArray:function(t){return H(t)?t:[t]},contains:function(t,n){return-1!==E.indexOf(t,n)},id:function(t){return t},last:function(t){return t[t.length-1]},all:function(t,n){var r,e,u;for(null==n&&(n=E.id),r=0,e=t.length;e>r;r++)if(u=t[r],!n(u))return!1;return!0},any:function(t,n){var r,e,u;for(null==n&&(n=E.id),r=0,e=t.length;e>r;r++)if(u=t[r],n(u))return!0;return!1},without:function(t,n){return E.filter(function(n){return n!==t},n)},remove:function(t,n){var r;return r=E.indexOf(n,t),r>=0?n.splice(r,1):void 0},fold:function(t,n,r){var e,u,i;for(e=0,u=t.length;u>e;e++)i=t[e],n=r(n,i);return n},flatMap:function(t,n){return E.fold(n,[],function(n,r){return n.concat(t(r))})},cached:function(t){var n;return n=d,function(){return n===d&&(n=t(),t=void 0),n}},isFunction:function(t){return"function"==typeof t},toString:function(t){var n,r,e,u;try{return G++,null==t?"undefined":E.isFunction(t)?"function":H(t)?G>5?"[..]":"["+E.map(E.toString,t).toString()+"]":null!=(null!=t?t.toString:void 0)&&t.toString!==Object.prototype.toString?t.toString():"object"==typeof t?G>5?"{..}":(r=function(){var r;r=[];for(e in t)at.call(t,e)&&(u=function(){try{return t[e]}catch(r){return n=r}}(),r.push(E.toString(e)+":"+E.toString(u)));return r}(),"{"+r+"}"):t}finally{G--}}},G=0,t._=E,w=t.UpdateBarrier=function(){var n,r,e,u,i,o,s,c,a,f,h,l,p,d;return f=void 0,h=[],l={},r=[],e=0,n=function(t){return f?r.push(t):t()},p=function(t,n){var r;return f?(r=l[t.id],null==r?(r=l[t.id]=[n],h.push(t)):r.push(n)):n()},i=function(){for(;h.length>0;)s(0);return void 0},s=function(t){var n,r,e,u,i,s;for(u=h[t],i=u.id,s=l[i],h.splice(t,1),delete l[i],o(u),r=0,e=s.length;e>r;r++)(n=s[r])();return void 0},o=function(t){var n,r,e,u,i;for(r=t.internalDeps(),u=0,i=r.length;i>u;u++)n=r[u],o(n),l[n.id]&&(e=E.indexOf(h,n),s(e));return void 0},a=function(t,n,u,o){var s,c;if(f)return u.apply(n,o);f=t;try{c=u.apply(n,o),i()}finally{for(f=void 0;e<r.length;)s=r[e],e++,s();e=0,r=[]}return c},u=function(){return f?f.id:void 0},d=function(r,e){var u,i,o,s;return s=!1,i=!1,u=function(){return i=!0},o=function(){return s=!0,u()},u=r.dispatcher.subscribe(function(r){return n(function(){var n;return s||(n=e(r),n!==t.noMore)?void 0:o()})}),i&&u(),o},c=function(){return h.length>0},{whenDoneWith:p,hasWaiters:c,inTransaction:a,currentEventId:u,wrappedSubscribe:d,afterTransaction:n}}(),g=function(){function t(t,n,r){this.obs=t,this.sync=n,this.lazy=null!=r?r:!1,this.queue=[]}return t.prototype.subscribe=function(t){return this.obs.dispatcher.subscribe(t)},t.prototype.toString=function(){return this.obs.toString()},t.prototype.markEnded=function(){return this.ended=!0},t.prototype.consume=function(){return this.lazy?{value:E.always(this.queue[0])}:this.queue[0]},t.prototype.push=function(t){return this.queue=[t]},t.prototype.mayHave=function(){return!0},t.prototype.hasAtLeast=function(){return this.queue.length},t.prototype.flatten=!0,t}(),u=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return ft(n,t),n.prototype.consume=function(){return this.queue.shift()},n.prototype.push=function(t){return this.queue.push(t)},n.prototype.mayHave=function(t){return!this.ended||this.queue.length>=t},n.prototype.hasAtLeast=function(t){return this.queue.length>=t},n.prototype.flatten=!1,n}(g),n=function(t){function n(t){n.__super__.constructor.call(this,t,!0)}return ft(n,t),n.prototype.consume=function(){var t;return t=this.queue,this.queue=[],{value:function(){return t}}},n.prototype.push=function(t){return this.queue.push(t.value())},n.prototype.hasAtLeast=function(){return!0},n}(g),g.isTrigger=function(t){return t instanceof g?t.sync:t instanceof f},g.fromObservable=function(t){return t instanceof g?t:t instanceof y?new g(t,!1):new u(t,!0)},i=function(){function t(t,n,r){this.context=t,this.method=n,this.args=r}return t.prototype.deps=function(){return this.cached||(this.cached=P([this.context].concat(this.args)))},t.prototype.toString=function(){return E.toString(this.context)+"."+E.toString(this.method)+"("+E.map(E.toString,this.args)+")"},t}(),A=function(){var t,n,r;return n=arguments[0],r=arguments[1],t=3<=arguments.length?ht.call(arguments,2):[],(n||r)instanceof i?n||r:new i(n,r,t)},st=function(t,n){return n.desc=t,n},P=function(t){return H(t)?E.flatMap(P,t):q(t)?[t]:t instanceof g?[t.obs]:[]},t.Desc=i,t.Desc.empty=new t.Desc("","",[]),ct=function(t){return function(){var n,r,e,u;return e=arguments[0],n=2<=arguments.length?ht.call(arguments,1):[],"object"==typeof e&&n.length&&(r=e,u=n[0],e=function(){return r[u].apply(r,arguments)},n=n.slice(1)),t.apply(null,[e].concat(ht.call(n)))}},z=function(t){return t=Array.prototype.slice.call(t),j.apply(null,t)},X=function(t,n){return function(){var r;return r=1<=arguments.length?ht.call(arguments,0):[],t.apply(null,n.concat(r))}},it=function(t){return function(n){return function(r){var e;return null==r?void 0:(e=r[n],E.isFunction(e)?e.apply(r,t):e)}}},rt=function(t,n){var r,e;return e=t.slice(1).split("."),r=E.map(it(n),e),function(n){var e,u;for(e=0,u=r.length;u>e;e++)t=r[e],n=t(n);return n}},C=function(t){return"string"==typeof t&&t.length>1&&"."===t.charAt(0)},j=ct(function(){var t,n;return n=arguments[0],t=2<=arguments.length?ht.call(arguments,1):[],E.isFunction(n)?t.length?X(n,t):n:C(n)?rt(n,t):E.always(n)}),N=function(t,n){return j.apply(null,[t].concat(ht.call(n)))},_=function(t,n,r,e){var u;return n instanceof y?(u=n.sampledBy(t,function(t,n){return[t,n]}),e.call(u,function(t){var n,r;return n=t[0],r=t[1],n}).map(function(t){var n,r;return n=t[0],r=t[1]})):(n=N(n,r),e.call(t,n))},tt=function(t){var n;if(E.isFunction(t))return t;if(C(t))return n=et(t),function(t,r){return t[n](r)};throw new h("not a function or a field key: "+t)},et=function(t){return t.slice(1)},b=function(){function t(t){this.value=t}return t.prototype.getOrElse=function(){return this.value},t.prototype.get=function(){return this.value},t.prototype.filter=function(n){return n(this.value)?new t(this.value):d},t.prototype.map=function(n){return new t(n(this.value))},t.prototype.forEach=function(t){return t(this.value)},t.prototype.isDefined=!0,t.prototype.toArray=function(){return[this.value]},t.prototype.inspect=function(){return"Some("+this.value+")"},t.prototype.toString=function(){return this.inspect()},t}(),d={getOrElse:function(t){return t},filter:function(){return d},map:function(){return d},forEach:function(){},isDefined:!1,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}},ut=function(t){return t instanceof b||t===d?t:new b(t)},t.noMore=["<no-more>"],t.more=["<more>"],I=0,a=function(){function t(){this.id=++I}return t.prototype.isEvent=function(){return!0},t.prototype.isEnd=function(){return!1},t.prototype.isInitial=function(){return!1},t.prototype.isNext=function(){return!1},t.prototype.isError=function(){return!1},t.prototype.hasValue=function(){return!1},t.prototype.filter=function(){return!0},t.prototype.inspect=function(){return this.toString()},t.prototype.log=function(){return this.toString()},t}(),p=function(t){function n(t,r){n.__super__.constructor.call(this),!r&&E.isFunction(t)||t instanceof n?(this.valueF=t,this.valueInternal=void 0):(this.valueF=void 0,this.valueInternal=t)}return ft(n,t),n.prototype.isNext=function(){return!0},n.prototype.hasValue=function(){return!0},n.prototype.value=function(){return this.valueF instanceof n?(this.valueInternal=this.valueF.value(),this.valueF=void 0):this.valueF&&(this.valueInternal=this.valueF(),this.valueF=void 0),this.valueInternal},n.prototype.fmap=function(t){var n,r;return this.valueInternal?(r=this.valueInternal,this.apply(function(){return t(r)})):(n=this,this.apply(function(){return t(n.value())}))},n.prototype.apply=function(t){return new n(t)},n.prototype.filter=function(t){return t(this.value())},n.prototype.toString=function(){return E.toString(this.value())},n.prototype.log=function(){return this.value()},n}(a),l=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return ft(n,t),n.prototype.isInitial=function(){return!0},n.prototype.isNext=function(){return!1},n.prototype.apply=function(t){return new n(t)},n.prototype.toNext=function(){return new p(this)},n}(p),s=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return ft(n,t),n.prototype.isEnd=function(){return!0},n.prototype.fmap=function(){return this},n.prototype.apply=function(){return this},n.prototype.toString=function(){return"<end>"},n}(a),c=function(t){function n(t){this.error=t}return ft(n,t),n.prototype.isError=function(){return!0},n.prototype.fmap=function(){return this},n.prototype.apply=function(){return this},n.prototype.toString=function(){return"<error> "+E.toString(this.error)},n}(a),t.Event=a,t.Initial=l,t.Next=p,t.End=s,t.Error=c,B=function(t){return new l(t,!0)},Z=function(t){return new p(t,!0)},k=function(){return new s},nt=function(t){return t instanceof a?t:Z(t)},F=0,K=function(){},v=function(){function t(t){this.desc=t,this.id=++F,this.initialDesc=this.desc}return t.prototype.subscribe=function(t){return w.wrappedSubscribe(this,t)},t.prototype.subscribeInternal=function(t){return this.dispatcher.subscribe(t)},t.prototype.onValue=function(){var t;return t=z(arguments),this.subscribe(function(n){return n.hasValue()?t(n.value()):void 0})},t.prototype.onValues=function(t){return this.onValue(function(n){return t.apply(null,n)})},t.prototype.onError=function(){var t;return t=z(arguments),this.subscribe(function(n){return n.isError()?t(n.error):void 0})},t.prototype.onEnd=function(){var t;return t=z(arguments),this.subscribe(function(n){return n.isEnd()?t():void 0})},t.prototype.name=function(t){return this._name=t,this},t.prototype.withDescription=function(){return this.desc=A.apply(null,arguments),this},t.prototype.toString=function(){return this._name?this._name:this.desc.toString()},t.prototype.internalDeps=function(){return this.initialDesc.deps()},t}(),v.prototype.assign=v.prototype.onValue,v.prototype.forEach=v.prototype.onValue,v.prototype.inspect=v.prototype.toString,t.Observable=v,e=function(){function t(t){var n,r,e;for(null==t&&(t=[]),this.unsubscribe=lt(this.unsubscribe,this),this.unsubscribed=!1,this.subscriptions=[],this.starting=[],n=0,r=t.length;r>n;n++)e=t[n],this.add(e)}return t.prototype.add=function(t){var n,r,e;if(!this.unsubscribed)return n=!1,r=$,this.starting.push(t),e=function(e){return function(){return e.unsubscribed?void 0:(n=!0,e.remove(r),E.remove(t,e.starting))}}(this),r=t(this.unsubscribe,e),this.unsubscribed||n?r():this.subscriptions.push(r),E.remove(t,this.starting),r},t.prototype.remove=function(t){return this.unsubscribed?void 0:void 0!==E.remove(t,this.subscriptions)?t():void 0},t.prototype.unsubscribe=function(){var t,n,r,e;if(!this.unsubscribed){for(this.unsubscribed=!0,r=this.subscriptions,t=0,n=r.length;n>t;t++)(e=r[t])();return this.subscriptions=[],this.starting=[]}},t.prototype.count=function(){return this.unsubscribed?0:this.subscriptions.length+this.starting.length},t.prototype.empty=function(){return 0===this.count()},t}(),t.CompositeUnsubscribe=e,o=function(){function n(t,n){this._subscribe=t,this._handleEvent=n,this.subscribe=lt(this.subscribe,this),this.handleEvent=lt(this.handleEvent,this),this.subscriptions=[],this.queue=[]}return n.prototype.pushing=!1,n.prototype.ended=!1,n.prototype.prevError=void 0,n.prototype.unsubSrc=void 0,n.prototype.hasSubscribers=function(){return this.subscriptions.length>0},n.prototype.removeSub=function(t){return this.subscriptions=E.without(t,this.subscriptions)},n.prototype.push=function(t){return t.isEnd()&&(this.ended=!0),w.inTransaction(t,this,this.pushIt,[t])},n.prototype.pushToSubscriptions=function(n){var r,e,u,i,o,s;try{for(s=this.subscriptions,e=0,u=s.length;u>e;e++)o=s[e],i=o.sink(n),(i===t.noMore||n.isEnd())&&this.removeSub(o);return!0}catch(c){throw r=c,this.pushing=!1,this.queue=[],r}},n.prototype.pushIt=function(n){if(this.pushing)return this.queue.push(n),t.more;if(n!==this.prevError){for(n.isError()&&(this.prevError=n),this.pushing=!0,this.pushToSubscriptions(n),this.pushing=!1;this.queue.length;)n=this.queue.shift(),this.push(n);return this.hasSubscribers()?t.more:(this.unsubscribeFromSource(),t.noMore)}},n.prototype.handleEvent=function(t){return this._handleEvent?this._handleEvent(t):this.push(t)},n.prototype.unsubscribeFromSource=function(){return this.unsubSrc&&this.unsubSrc(),this.unsubSrc=void 0},n.prototype.subscribe=function(t){var n;return this.ended?(t(k()),$):(n={sink:t},this.subscriptions.push(n),1===this.subscriptions.length&&(this.unsubSrc=this._subscribe(this.handleEvent)),function(t){return function(){return t.removeSub(n),t.hasSubscribers()?void 0:t.unsubscribeFromSource()}}(this))},n}(),t.Dispatcher=o,f=function(n){function r(t,n,e){E.isFunction(t)&&(e=n,n=t,t=i.empty),r.__super__.constructor.call(this,t),this.dispatcher=new o(n,e),K(this)}return ft(r,n),r.prototype.toProperty=function(n){var r,e;return e=0===arguments.length?d:ut(function(){return n}),r=this.dispatcher,new y(new t.Desc(this,"toProperty",[n]),function(n){var u,i,o,s;return u=!1,s=$,i=t.more,o=function(){return u?void 0:e.forEach(function(r){return u=!0,i=n(new l(r)),i===t.noMore?(s(),s=$):void 0})},s=r.subscribe(function(r){return r.hasValue()?u&&r.isInitial()?t.more:(r.isInitial()||o(),u=!0,e=new b(r),n(r)):(r.isEnd()&&(i=o()),i!==t.noMore?n(r):void 0)}),o(),s})},r.prototype.toEventStream=function(){return this},r.prototype.withHandler=function(n){return new r(new t.Desc(this,"withHandler",[n]),this.dispatcher.subscribe,n)},r}(v),t.EventStream=f,t.never=function(){return new f(A(t,"never"),function(t){return t(k()),$})},t.when=function(){var n,r,e,u,i,o,s,c,a,h,l,p,d,v,y,m,b,D,S,_;if(0===arguments.length)return t.never();for(s=arguments.length,_="when: expecting arguments in the form (Observable+,function)+",D=[],d=[],r=0,v=[];s>r;){for(v[r]=arguments[r],v[r+1]=arguments[r+1],p=E.toArray(arguments[r]),n=O(arguments[r+1]),l={f:n,ixs:[]},S=!1,i=0,c=p.length;c>i;i++){for(b=p[i],e=E.indexOf(D,b),S||(S=g.isTrigger(b)),0>e&&(D.push(b),e=D.length-1),y=l.ixs,o=0,a=y.length;a>o;o++)u=y[o],u.index===e&&u.count++;l.ixs.push({index:e,count:1})}p.length>0&&d.push(l),r+=2}return D.length?(D=E.map(g.fromObservable,D),h=E.any(D,function(t){return t.flatten})&&M(E.map(function(t){return t.obs},D)),m=new f(new t.Desc(t,"when",v),function(n){var e,u,i,o,s,c,a;return a=[],i=!1,o=function(t){var n,e,u;for(u=t.ixs,n=0,e=u.length;e>n;n++)if(r=u[n],!D[r.index].hasAtLeast(r.count))return!1;return!0},u=function(t){return!t.sync||t.ended},e=function(t){var n,e,u;for(u=t.ixs,n=0,e=u.length;e>n;n++)if(r=u[n],!D[r.index].mayHave(r.count))return!0},s=function(t){return!t.source.flatten},c=function(c){return function(f){var l,p,v;return p=function(){return w.whenDoneWith(m,l)},v=function(){var e,u,i,c,f,h;if(!(a.length>0))return t.more;for(f=t.more,h=a.pop(),u=0,i=d.length;i>u;u++)if(c=d[u],o(c))return e=function(){var t,n,e,u;for(e=c.ixs,u=[],n=0,t=e.length;t>n;n++)r=e[n],u.push(D[r.index].consume());return u}(),f=n(h.e.apply(function(){var t,n;return n=function(){var n,r,u;for(u=[],r=0,n=e.length;n>r;r++)t=e[r],u.push(t.value());return u}(),c.f.apply(c,n)})),a.length&&(a=E.filter(s,a)),f===t.noMore?f:v()},l=function(){var r;return r=v(),i&&(i=!1,(E.all(D,u)||E.all(d,e))&&(r=t.noMore,n(k()))),r===t.noMore&&f(),r},c.subscribe(function(r){var e;return r.isEnd()?(i=!0,c.markEnded(),p()):r.isError()?e=n(r):(c.push(r),c.sync&&(a.push({source:c,e:r}),h||w.hasWaiters()?p():l())),e===t.noMore&&f(),e||t.more})}},new t.CompositeUnsubscribe(function(){var t,n,r;for(r=[],t=0,n=D.length;n>t;t++)b=D[t],r.push(c(b));return r}()).unsubscribe})):t.never()},M=function(t,n){var r;return null==n&&(n=[]),r=function(t){var e;return E.contains(n,t)?!0:(e=t.internalDeps(),e.length?(n.push(t),E.any(e,r)):(n.push(t),!1))},E.any(t,r)},O=function(t){return E.isFunction(t)?t:E.always(t)},t.groupSimultaneous=function(){var r,e,u;return u=1<=arguments.length?ht.call(arguments,0):[],1===u.length&&H(u[0])&&(u=u[0]),e=function(){var t,e,i;for(i=[],t=0,e=u.length;e>t;t++)r=u[t],i.push(new n(r));return i}(),st(new t.Desc(t,"groupSimultaneous",u),t.when(e,function(){var t;return t=1<=arguments.length?ht.call(arguments,0):[]}))},m=function(n){function r(t,n,e){this.property=t,this.subscribe=lt(this.subscribe,this),r.__super__.constructor.call(this,n,e),this.current=d,this.currentValueRootId=void 0,this.propertyEnded=!1}return ft(r,n),r.prototype.push=function(t){return t.isEnd()&&(this.propertyEnded=!0),t.hasValue()&&(this.current=new b(t),this.currentValueRootId=w.currentEventId()),r.__super__.push.call(this,t)},r.prototype.maybeSubSource=function(n,r){return r===t.noMore?$:this.propertyEnded?(n(k()),$):o.prototype.subscribe.call(this,n)},r.prototype.subscribe=function(n){var r,e,u,i;return e=!1,u=t.more,this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)?(r=w.currentEventId(),i=this.currentValueRootId,!this.propertyEnded&&i&&r&&r!==i?(w.whenDoneWith(this.property,function(t){return function(){return t.currentValueRootId===i?n(B(t.current.get().value())):void 0}}(this)),this.maybeSubSource(n,u)):(w.inTransaction(void 0,this,function(){return u=n(B(this.current.get().value()))},[]),this.maybeSubSource(n,u))):this.maybeSubSource(n,u)},r}(o),y=function(n){function r(t,n,e){r.__super__.constructor.call(this,t),this.dispatcher=new m(this,n,e),K(this)}return ft(r,n),r.prototype.changes=function(){return new f(new t.Desc(this,"changes",[]),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()?void 0:n(t)})}}(this))},r.prototype.withHandler=function(n){return new r(new t.Desc(this,"withHandler",[n]),this.dispatcher.subscribe,n)},r.prototype.toProperty=function(){return this},r.prototype.toEventStream=function(){return new f(new t.Desc(this,"toEventStream",[]),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()&&(t=t.toNext()),n(t)})}}(this))},r}(v),t.Property=y,t.constant=function(n){return new y(new t.Desc(t,"constant",[n]),function(t){return t(B(n)),t(k()),$})},t.fromBinder=function(n,r){return null==r&&(r=E.id),new f(new t.Desc(t,"fromBinder",[n,r]),function(e){var u,i,o,s;return s=!1,u=!1,i=function(){return s?void 0:"undefined"!=typeof o&&null!==o?(o(),s=!0):u=!0},o=n(function(){var n,u,o,s,c,f;for(n=1<=arguments.length?ht.call(arguments,0):[],f=r.apply(this,n),H(f)&&E.last(f)instanceof a||(f=[f]),c=t.more,o=0,s=f.length;s>o;o++)if(u=f[o],c=e(u=nt(u)),c===t.noMore||u.isEnd())return i(),c;return c}),u&&i(),i})},W=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]],T=function(t){var n,r,e,u;for(n=0,r=W.length;r>n;n++)if(u=W[n],e=[t[u[0]],t[u[1]]],e[0]&&e[1])return e;throw new c("No suitable event methods in "+t)},t.fromEventTarget=function(n,r,e){var u,i,o;return u=T(n),i=u[0],o=u[1],st(new t.Desc(t,"fromEvent",[n,r]),t.fromBinder(function(t){return i.call(n,r,t),function(){return o.call(n,r,t)}},e))},t.fromEvent=t.fromEventTarget,t.Observable.prototype.map=function(){var n,r;return r=arguments[0],n=2<=arguments.length?ht.call(arguments,1):[],_(this,r,n,function(n){return st(new t.Desc(this,"map",[n]),this.withHandler(function(t){return this.push(t.fmap(n))}))})},t.combineAsArray=function(){var n,r,e,u,i,o,s;for(s=1<=arguments.length?ht.call(arguments,0):[],1===s.length&&H(s[0])&&(s=s[0]),n=r=0,e=s.length;e>r;n=++r)o=s[n],q(o)||(s[n]=t.constant(o));return s.length?(i=function(){var t,n,r;for(r=[],t=0,n=s.length;n>t;t++)u=s[t],r.push(new g(u,!0));return r}(),st(new t.Desc(t,"combineAsArray",s),t.when(i,function(){var t;return t=1<=arguments.length?ht.call(arguments,0):[]}).toProperty())):t.constant([])},t.onValues=function(){var n,r,e;return e=2<=arguments.length?ht.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],t.combineAsArray(e).onValues(n)},t.combineWith=function(){var n,r;return n=arguments[0],r=2<=arguments.length?ht.call(arguments,1):[],st(new t.Desc(t,"combineWith",[n].concat(ht.call(r))),t.combineAsArray(r).map(function(t){return n.apply(null,t)}))},t.combineTemplate=function(n){var r,e,u,i,o,s,c,a,f,h;return c=[],h=[],s=function(t){return t[t.length-1]},f=function(t,n,r){return s(t)[n]=r},r=function(t,n){return function(r,e){return f(r,t,e[n])}},o=function(t,n){return function(r){return f(r,t,n)}},a=function(t){return H(t)?[]:{}},u=function(t,n){var e,u;return q(n)?(h.push(n),c.push(r(t,h.length-1))):n!==Object(n)||"function"==typeof n||n instanceof RegExp||n instanceof Date?c.push(o(t,n)):(u=function(t){return function(r){var e;return e=a(n),f(r,t,e),r.push(e)}},e=function(t){return t.pop()},c.push(u(t)),i(n),c.push(e))},i=function(t){return E.each(t,u)},i(n),e=function(t){var r,e,u,i,o;for(o=a(n),r=[o],u=0,i=c.length;i>u;u++)(e=c[u])(r,t);return o},st(new t.Desc(t,"combineTemplate",[n]),t.combineAsArray(h).map(e))},t.Observable.prototype.combine=function(n,r){var e;return e=tt(r),st(new t.Desc(this,"combine",[n,r]),t.combineAsArray(this,n).map(function(t){return e(t[0],t[1])}))},t.Observable.prototype.decode=function(n){return st(new t.Desc(this,"decode",[n]),this.combine(t.combineTemplate(n),function(t,n){return n[t]}))},t.Observable.prototype.withStateMachine=function(n,r){var e;return e=n,st(new t.Desc(this,"withStateMachine",[n,r]),this.withHandler(function(n){var u,i,o,s,c,a,f;for(u=r(e,n),s=u[0],a=u[1],e=s,f=t.more,i=0,o=a.length;o>i;i++)if(c=a[i],f=this.push(c),f===t.noMore)return f;return f}))},t.Observable.prototype.skipDuplicates=function(n){return null==n&&(n=function(t,n){return t===n}),st(new t.Desc(this,"skipDuplicates",[]),this.withStateMachine(d,function(t,r){return r.hasValue()?r.isInitial()||t===d||!n(t.get(),r.value())?[new b(r.value()),[r]]:[t,[]]:[t,[r]]}))},t.Observable.prototype.awaiting=function(n){return st(new t.Desc(this,"awaiting",[n]),t.groupSimultaneous(this,n).map(function(t){var n,r;return n=t[0],r=t[1],0===r.length}).toProperty(!1).skipDuplicates())},t.Observable.prototype.not=function(){return st(new t.Desc(this,"not",[]),this.map(function(t){return!t}))},t.Property.prototype.and=function(n){return st(new t.Desc(this,"and",[n]),this.combine(n,function(t,n){return t&&n}))},t.Property.prototype.or=function(n){return st(new t.Desc(this,"or",[n]),this.combine(n,function(t,n){return t||n}))},t.scheduler={setTimeout:function(t,n){return setTimeout(t,n)},setInterval:function(t,n){return setInterval(t,n)},clearInterval:function(t){return clearInterval(t)},clearTimeout:function(t){return clearTimeout(t)},now:function(){return(new Date).getTime()}},t.EventStream.prototype.bufferWithTime=function(n){return st(new t.Desc(this,"bufferWithTime",[n]),this.bufferWithTimeOrCount(n,Number.MAX_VALUE))},t.EventStream.prototype.bufferWithCount=function(n){return st(new t.Desc(this,"bufferWithCount",[n]),this.bufferWithTimeOrCount(void 0,n))},t.EventStream.prototype.bufferWithTimeOrCount=function(n,r){var e;return e=function(t){return t.values.length===r?t.flush():void 0!==n?t.schedule():void 0},st(new t.Desc(this,"bufferWithTimeOrCount",[n,r]),this.buffer(n,e,e))},t.EventStream.prototype.buffer=function(n,r,e){var u,i,o;return null==r&&(r=$),null==e&&(e=$),u={scheduled:null,end:void 0,values:[],flush:function(){var n;if(this.scheduled&&(t.scheduler.clearTimeout(this.scheduled),this.scheduled=null),this.values.length>0){if(n=this.push(Z(this.values)),this.values=[],null!=this.end)return this.push(this.end);if(n!==t.noMore)return e(this)}else if(null!=this.end)return this.push(this.end)},schedule:function(){return this.scheduled?void 0:this.scheduled=n(function(t){return function(){return t.flush()}}(this))}},o=t.more,E.isFunction(n)||(i=n,n=function(n){return t.scheduler.setTimeout(n,i)}),st(new t.Desc(this,"buffer",[]),this.withHandler(function(t){return u.push=function(t){return function(n){return t.push(n)}}(this),t.isError()?o=this.push(t):t.isEnd()?(u.end=t,u.scheduled||u.flush()):(u.values.push(t.value()),r(u)),o}))},t.Observable.prototype.filter=function(){var n,r;return r=arguments[0],n=2<=arguments.length?ht.call(arguments,1):[],_(this,r,n,function(n){return st(new t.Desc(this,"filter",[n]),this.withHandler(function(r){return r.filter(n)?this.push(r):t.more}))})},t.once=function(n){return new f(new i(t,"once",[n]),function(t){return t(nt(n)),t(k()),$})},t.EventStream.prototype.concat=function(n){var r;return r=this,new f(new t.Desc(r,"concat",[n]),function(t){var e,u;return u=$,e=r.dispatcher.subscribe(function(r){return r.isEnd()?u=n.dispatcher.subscribe(t):t(r)}),function(){return e(),u()}})},t.Observable.prototype.flatMap=function(){return x(this,Q(arguments))},t.Observable.prototype.flatMapFirst=function(){return x(this,Q(arguments),!0)},x=function(n,r,u,i){var o,s,c;return c=[n],o=[],s=new f(new t.Desc(n,"flatMap"+(u?"First":""),[r]),function(s){var c,a,f,h,p;return f=new e,h=[],p=function(n){var e;return e=R(r(n.value())),o.push(e),f.add(function(n,r){return e.dispatcher.subscribe(function(u){var i;return u.isEnd()?(E.remove(e,o),a(),c(r),t.noMore):(u instanceof l&&(u=u.toNext()),i=s(u),i===t.noMore&&n(),i)})})},a=function(){var t;return t=h.shift(),t?p(t):void 0},c=function(t){return t(),f.empty()?s(k()):void 0},f.add(function(r,e){return n.dispatcher.subscribe(function(n){return n.isEnd()?c(e):n.isError()?s(n):u&&f.count()>1?t.more:f.unsubscribed?t.noMore:i&&f.count()>i?h.push(n):p(n)})}),f.unsubscribe}),s.internalDeps=function(){return o.length?c.concat(o):c},s},Q=function(t){return 1===t.length&&q(t[0])?E.always(t[0]):z(t)},R=function(n){return q(n)?n:t.once(n)},t.Observable.prototype.flatMapWithConcurrencyLimit=function(){var n,r;return r=arguments[0],n=2<=arguments.length?ht.call(arguments,1):[],st(new t.Desc(this,"flatMapWithConcurrencyLimit",[r].concat(ht.call(n))),x(this,Q(n),!1,r))},t.Observable.prototype.flatMapConcat=function(){return st(new t.Desc(this,"flatMapConcat",Array.prototype.slice.call(arguments,0)),this.flatMapWithConcurrencyLimit.apply(this,[1].concat(ht.call(arguments))))},t.later=function(n,r){return st(new t.Desc(t,"later",[n,r]),t.fromBinder(function(e){var u,i;return i=function(){return e([r,k()])},u=t.scheduler.setTimeout(i,n),function(){return t.scheduler.clearTimeout(u)}}))},t.Observable.prototype.bufferingThrottle=function(n){return st(new t.Desc(this,"bufferingThrottle",[n]),this.flatMapConcat(function(r){return t.once(r).concat(t.later(n).filter(!1))}))},t.Property.prototype.bufferingThrottle=function(){return t.Observable.prototype.bufferingThrottle.apply(this,arguments).toProperty()},r=function(n){function r(){this.guardedSink=lt(this.guardedSink,this),this.subscribeAll=lt(this.subscribeAll,this),this.unsubAll=lt(this.unsubAll,this),this.sink=void 0,this.subscriptions=[],this.ended=!1,r.__super__.constructor.call(this,new t.Desc(t,"Bus",[]),this.subscribeAll)}return ft(r,n),r.prototype.unsubAll=function(){var t,n,r,e;for(r=this.subscriptions,t=0,n=r.length;n>t;t++)e=r[t],"function"==typeof e.unsub&&e.unsub();return void 0},r.prototype.subscribeAll=function(t){var n,r,e,u;if(this.ended)t(k());else for(this.sink=t,e=S(this.subscriptions),n=0,r=e.length;r>n;n++)u=e[n],this.subscribeInput(u);return this.unsubAll},r.prototype.guardedSink=function(n){return function(r){return function(e){return e.isEnd()?(r.unsubscribeInput(n),t.noMore):r.sink(e)}}(this)},r.prototype.subscribeInput=function(t){return t.unsub=t.input.dispatcher.subscribe(this.guardedSink(t.input))},r.prototype.unsubscribeInput=function(t){var n,r,e,u,i;for(u=this.subscriptions,n=r=0,e=u.length;e>r;n=++r)if(i=u[n],i.input===t)return"function"==typeof i.unsub&&i.unsub(),void this.subscriptions.splice(n,1)},r.prototype.plug=function(t){var n;if(!this.ended)return n={input:t},this.subscriptions.push(n),null!=this.sink&&this.subscribeInput(n),function(n){return function(){return n.unsubscribeInput(t)}}(this)},r.prototype.end=function(){return this.ended=!0,this.unsubAll(),"function"==typeof this.sink?this.sink(k()):void 0},r.prototype.push=function(t){return this.ended?void 0:"function"==typeof this.sink?this.sink(Z(t)):void 0},r.prototype.error=function(t){return"function"==typeof this.sink?this.sink(new c(t)):void 0},r}(f),t.Bus=r,U=function(n,r){return ct(function(){var e,u,i;return u=arguments[0],e=2<=arguments.length?ht.call(arguments,1):[],i=X(r,[function(t,n){return u.apply(null,ht.call(t).concat([n]))}]),st(new t.Desc(t,n,[u].concat(ht.call(e))),t.combineAsArray(e).flatMap(i))})},t.fromCallback=U("fromCallback",function(){var n,r;return r=arguments[0],n=2<=arguments.length?ht.call(arguments,1):[],t.fromBinder(function(t){return N(r,n)(t),$},function(t){return[t,k()]})}),t.fromNodeCallback=U("fromNodeCallback",function(){var n,r;return r=arguments[0],n=2<=arguments.length?ht.call(arguments,1):[],t.fromBinder(function(t){return N(r,n)(t),$},function(t,n){return t?[new c(t),k()]:[n,k()]})}),D=function(n,r){var e;return e=new f(A(n,"justInitValue"),function(r){var u,i;return i=void 0,u=n.dispatcher.subscribe(function(n){return n.isEnd()||(i=n),t.noMore}),w.whenDoneWith(e,function(){return null!=i&&r(i),r(k())}),u}),e.concat(r).toProperty()},t.Observable.prototype.mapEnd=function(){var n;return n=z(arguments),st(new t.Desc(this,"mapEnd",[n]),this.withHandler(function(r){return r.isEnd()?(this.push(Z(n(r))),this.push(k()),t.noMore):this.push(r)}))},t.Observable.prototype.skipErrors=function(){return st(new t.Desc(this,"skipErrors",[]),this.withHandler(function(n){return n.isError()?t.more:this.push(n)}))},t.EventStream.prototype.takeUntil=function(n){var r;return r={},st(new t.Desc(this,"takeUntil",[n]),t.groupSimultaneous(this.mapEnd(r),n.skipErrors()).withHandler(function(e){var u,i,o,s,c,a;if(e.hasValue()){if(s=e.value(),u=s[0],n=s[1],n.length)return this.push(k());for(c=t.more,i=0,o=u.length;o>i;i++)a=u[i],c=this.push(a===r?k():Z(a));return c}return this.push(e)}))},t.Property.prototype.takeUntil=function(n){var r;return r=this.changes().takeUntil(n),st(new t.Desc(this,"takeUntil",[n]),D(this,r))},t.Observable.prototype.flatMapLatest=function(){var n,r;return n=Q(arguments),r=this.toEventStream(),st(new t.Desc(this,"flatMapLatest",[n]),r.flatMap(function(t){return R(n(t)).takeUntil(r)}))},t.Property.prototype.delayChanges=function(t,n){return st(t,D(this,n(this.changes())))},t.EventStream.prototype.delay=function(n){return st(new t.Desc(this,"delay",[n]),this.flatMap(function(r){return t.later(n,r)}))},t.Property.prototype.delay=function(n){return this.delayChanges(new t.Desc(this,"delay",[n]),function(t){return t.delay(n);
})},t.EventStream.prototype.debounce=function(n){return st(new t.Desc(this,"debounce",[n]),this.flatMapLatest(function(r){return t.later(n,r)}))},t.Property.prototype.debounce=function(n){return this.delayChanges(new t.Desc(this,"debounce",[n]),function(t){return t.debounce(n)})},t.EventStream.prototype.debounceImmediate=function(n){return st(new t.Desc(this,"debounceImmediate",[n]),this.flatMapFirst(function(r){return t.once(r).concat(t.later(n).filter(!1))}))},t.Observable.prototype.scan=function(n,r){var e,u,i;return r=tt(r),e=ut(n),i=function(n){return function(i){var o,s,c,a;return o=!1,a=$,s=t.more,c=function(){return o?void 0:e.forEach(function(n){return o=!0,s=i(new l(function(){return n})),s===t.noMore?(a(),a=$):void 0})},a=n.dispatcher.subscribe(function(n){var u,a;return n.hasValue()?o&&n.isInitial()?t.more:(n.isInitial()||c(),o=!0,a=e.getOrElse(void 0),u=r(a,n.value()),e=new b(u),i(n.apply(function(){return u}))):(n.isEnd()&&(s=c()),s!==t.noMore?i(n):void 0)}),w.whenDoneWith(u,c),a}}(this),u=new y(new t.Desc(this,"scan",[n,r]),i)},t.Observable.prototype.diff=function(n,r){return r=tt(r),st(new t.Desc(this,"diff",[n,r]),this.scan([n],function(t,n){return[n,r(t[0],n)]}).filter(function(t){return 2===t.length}).map(function(t){return t[1]}))},t.Observable.prototype.doAction=function(){var n;return n=z(arguments),st(new t.Desc(this,"doAction",[n]),this.withHandler(function(t){return t.hasValue()&&n(t.value()),this.push(t)}))},t.Observable.prototype.doError=function(){var n;return n=z(arguments),st(new t.Desc(this,"doError",[n]),this.withHandler(function(t){return t.isError()&&n(t.error),this.push(t)}))},t.Observable.prototype.doLog=function(){var n;return n=1<=arguments.length?ht.call(arguments,0):[],st(new t.Desc(this,"doLog",n),this.withHandler(function(t){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,ht.call(n).concat([t.log()])),this.push(t)}))},t.Observable.prototype.endOnError=function(){var n,r;return r=arguments[0],n=2<=arguments.length?ht.call(arguments,1):[],null==r&&(r=!0),_(this,r,n,function(n){return st(new t.Desc(this,"endOnError",[]),this.withHandler(function(t){return t.isError()&&n(t.error)?(this.push(t),this.push(k())):this.push(t)}))})},v.prototype.errors=function(){return st(new t.Desc(this,"errors",[]),this.filter(function(){return!1}))},ot=function(t){return[t,k()]},t.fromPromise=function(n,r,e){return null==e&&(e=ot),st(new t.Desc(t,"fromPromise",[n]),t.fromBinder(function(t){var e;return null!=(e=n.then(t,function(n){return t(new c(n))}))&&"function"==typeof e.done&&e.done(),function(){return r&&"function"==typeof n.abort?n.abort():void 0}},e))},t.Observable.prototype.mapError=function(){var n;return n=z(arguments),st(new t.Desc(this,"mapError",[n]),this.withHandler(function(t){return this.push(t.isError()?Z(n(t.error)):t)}))},t.Observable.prototype.flatMapError=function(n){return st(new t.Desc(this,"flatMapError",[n]),this.mapError(function(t){return new c(t)}).flatMap(function(r){return r instanceof c?n(r.error):t.once(r)}))},t.EventStream.prototype.sampledBy=function(n,r){return st(new t.Desc(this,"sampledBy",[n,r]),this.toProperty().sampledBy(n,r))},t.Property.prototype.sampledBy=function(n,r){var e,u,i,o,s;return null!=r?r=tt(r):(e=!0,r=function(t){return t.value()}),s=new g(this,!1,e),i=new g(n,!0,e),o=t.when([s,i],r),u=n instanceof y?o.toProperty():o,st(new t.Desc(this,"sampledBy",[n,r]),u)},t.Property.prototype.sample=function(n){return st(new t.Desc(this,"sample",[n]),this.sampledBy(t.interval(n,{})))},t.Observable.prototype.map=function(){var n,r;return r=arguments[0],n=2<=arguments.length?ht.call(arguments,1):[],r instanceof y?r.sampledBy(this,V):_(this,r,n,function(n){return st(new t.Desc(this,"map",[n]),this.withHandler(function(t){return this.push(t.fmap(n))}))})},t.Observable.prototype.fold=function(n,r){return st(new t.Desc(this,"fold",[n,r]),this.scan(n,r).sampledBy(this.filter(!1).mapEnd().toProperty()))},v.prototype.reduce=v.prototype.fold,t.fromPoll=function(n,r){return st(new t.Desc(t,"fromPoll",[n,r]),t.fromBinder(function(r){var e;return e=t.scheduler.setInterval(r,n),function(){return t.scheduler.clearInterval(e)}},r))},t.fromArray=function(n){var r;return n.length?(r=0,new f(new t.Desc(t,"fromArray",[n]),function(e){var u,i,o,s,c;return c=!1,s=t.more,o=!1,i=!1,u=function(){var a;if(i=!0,!o){for(o=!0;i;)i=!1,s===t.noMore||c||(a=n[r++],s=e(nt(a)),s!==t.noMore&&(r===n.length?e(k()):w.afterTransaction(u)));return o=!1}},u(),function(){return c=!0}})):st(new t.Desc(t,"fromArray",n),t.never())},t.EventStream.prototype.holdWhen=function(n){var r,u,i,o,s;return u=new e,i=!1,r=[],s=!1,o=this,new f(new t.Desc(this,"holdWhen",[n]),function(t){var e;return e=function(n){return"function"==typeof n&&n(),u.empty()&&s?t(k()):void 0},u.add(function(u,o){return n.subscribe(function(n){var u;return n.hasValue()?(i=n.value())?void 0:(u=r,r=[],E.each(u,function(n,r){return t(Z(r))})):n.isEnd()?e(o):t(n)})}),u.add(function(n,u){return o.subscribe(function(n){return i&&n.hasValue()?r.push(n.value()):n.isEnd()&&r.length?e(u):t(n)})}),s=!0,e(),u.unsubscribe})},t.interval=function(n,r){return null==r&&(r={}),st(new t.Desc(t,"interval",[n,r]),t.fromPoll(n,function(){return Z(r)}))},t.$={},t.$.asEventStream=function(n,r,e){var u;return E.isFunction(r)&&(u=[r,void 0],e=u[0],r=u[1]),st(new t.Desc(this.selector||this,"asEventStream",[n]),t.fromBinder(function(t){return function(e){return t.on(n,r,e),function(){return t.off(n,r,e)}}}(this),e))},null!=(J="undefined"!=typeof jQuery&&null!==jQuery?jQuery:"undefined"!=typeof Zepto&&null!==Zepto?Zepto:void 0)&&(J.fn.asEventStream=t.$.asEventStream),t.Observable.prototype.log=function(){var t;return t=1<=arguments.length?ht.call(arguments,0):[],this.subscribe(function(n){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log?console.log.apply(console,ht.call(t).concat([n.log()])):void 0}),this},t.EventStream.prototype.merge=function(n){var r;return r=this,st(new t.Desc(r,"merge",[n]),t.mergeAll(this,n))},t.mergeAll=function(){var n;return n=1<=arguments.length?ht.call(arguments,0):[],H(n[0])&&(n=n[0]),n.length?new f(new t.Desc(t,"mergeAll",n),function(r){var e,u,i;return e=0,i=function(u){return function(i){return u.dispatcher.subscribe(function(u){var o;return u.isEnd()?(e++,e===n.length?r(k()):t.more):(o=r(u),o===t.noMore&&i(),o)})}},u=E.map(i,n),new t.CompositeUnsubscribe(u).unsubscribe}):t.never()},t.repeatedly=function(n,r){var e;return e=0,st(new t.Desc(t,"repeatedly",[n,r]),t.fromPoll(n,function(){return r[e++%r.length]}))},t.repeat=function(n){var r;return r=0,t.fromBinder(function(e){var u,i,o,s,c;return u=!1,o=t.more,c=function(){},i=function(t){return t.isEnd()?u?s():u=!0:o=e(t)},s=function(){var s;for(u=!0;u&&o!==t.noMore;)s=n(r++),u=!1,s?c=s.subscribeInternal(i):e(k());return u=!0},s(),function(){return c()}})},t.retry=function(n){var r,e,u,i,o,s,c;if(!E.isFunction(n.source))throw new h("'source' option has to be a function");return c=n.source,s=n.retries||0,o=n.maxRetries||s,r=n.delay||function(){return 0},i=n.isRetryable||function(){return!0},u=!1,e=null,st(new t.Desc(t,"retry",[n]),t.repeat(function(){var n,a,f;return u?null:(f=function(){return c().endOnError().withHandler(function(t){return t.isError()?(e=t,i(e.error)&&s>0?void 0:(u=!0,this.push(t))):(t.hasValue()&&(e=null,u=!0),this.push(t))})},e?(n={error:e.error,retriesDone:o-s},a=t.later(r(n)).filter(!1),s-=1,a.concat(t.once().flatMap(f))):f())}))},t.sequentially=function(n,r){var e;return e=0,st(new t.Desc(t,"sequentially",[n,r]),t.fromPoll(n,function(){var t;return t=r[e++],e<r.length?t:e===r.length?[t,k()]:k()}))},t.Observable.prototype.skip=function(n){return st(new t.Desc(this,"skip",[n]),this.withHandler(function(r){return r.hasValue()&&n>0?(n--,t.more):this.push(r)}))},t.Observable.prototype.take=function(n){return 0>=n?t.never():st(new t.Desc(this,"take",[n]),this.withHandler(function(r){return r.hasValue()?(n--,n>0?this.push(r):(0===n&&this.push(r),this.push(k()),t.noMore)):this.push(r)}))},t.EventStream.prototype.skipUntil=function(n){var r;return r=n.take(1).map(!0).toProperty(!1),st(new t.Desc(this,"skipUntil",[n]),this.filter(r))},t.EventStream.prototype.skipWhile=function(){var n,r,e;return r=arguments[0],n=2<=arguments.length?ht.call(arguments,1):[],e=!1,_(this,r,n,function(n){return st(new t.Desc(this,"skipWhile",[n]),this.withHandler(function(r){return!e&&r.hasValue()&&n(r.value())?t.more:(r.hasValue()&&(e=!0),this.push(r))}))})},t.Observable.prototype.slidingWindow=function(n,r){return null==r&&(r=0),st(new t.Desc(this,"slidingWindow",[n,r]),this.scan([],function(t,r){return t.concat([r]).slice(-n)}).filter(function(t){return t.length>=r}))},t.spy=function(t){return Y.push(t)},Y=[],K=function(t){var n,r,e;if(Y.length&&!K.running)try{for(K.running=!0,n=0,r=Y.length;r>n;n++)(e=Y[n])(t)}finally{delete K.running}return void 0},t.Property.prototype.startWith=function(n){return st(new t.Desc(this,"startWith",[n]),this.scan(n,function(t,n){return n}))},t.EventStream.prototype.startWith=function(n){return st(new t.Desc(this,"startWith",[n]),t.once(n).concat(this))},t.Observable.prototype.takeWhile=function(){var n,r;return r=arguments[0],n=2<=arguments.length?ht.call(arguments,1):[],_(this,r,n,function(n){return st(new t.Desc(this,"takeWhile",[n]),this.withHandler(function(r){return r.filter(n)?this.push(r):(this.push(k()),t.noMore)}))})},t.update=function(){var n,r,e,u;for(r=arguments[0],u=2<=arguments.length?ht.call(arguments,1):[],e=function(t){return function(){var n;return n=1<=arguments.length?ht.call(arguments,0):[],function(r){return t.apply(null,[r].concat(n))}}},n=u.length-1;n>0;)u[n]instanceof Function||(u[n]=function(t){return function(){return t}}(u[n])),u[n]=e(u[n]),n-=2;return st(new t.Desc(t,"update",[r].concat(ht.call(u))),t.when.apply(t,u).scan(r,function(t,n){return n(t)}))},t.zipAsArray=function(){var n;return n=1<=arguments.length?ht.call(arguments,0):[],H(n[0])&&(n=n[0]),st(new t.Desc(t,"zipAsArray",n),t.zipWith(n,function(){var t;return t=1<=arguments.length?ht.call(arguments,0):[]}))},t.zipWith=function(){var n,r,e;return n=arguments[0],e=2<=arguments.length?ht.call(arguments,1):[],E.isFunction(n)||(r=[n,e[0]],e=r[0],n=r[1]),e=E.map(function(t){return t.toEventStream()},e),st(new t.Desc(t,"zipWith",[n].concat(ht.call(e))),t.when(e,n))},t.Observable.prototype.zip=function(n,r){return null==r&&(r=Array),st(new t.Desc(this,"zip",[n]),t.zipWith([this,n],r))},t.Observable.prototype.first=function(){return st(new t.Desc(this,"first",[]),this.take(1))},t.Observable.prototype.last=function(){var n;return st(new t.Desc(this,"last",[]),this.withHandler(function(r){return r.isEnd()?(n&&this.push(n),this.push(k()),t.noMore):void(n=r)}))},t.EventStream.prototype.throttle=function(n){return st(new t.Desc(this,"throttle",[n]),this.bufferWithTime(n).map(function(t){return t[t.length-1]}))},t.Property.prototype.throttle=function(n){return this.delayChanges(new t.Desc(this,"throttle",[n]),function(t){return t.throttle(n)})},v.prototype.firstToPromise=function(n){var r=this;if("function"!=typeof n){if("function"!=typeof Promise)throw new h("There isn't default Promise, use shim or parameter");n=Promise}return new n(function(n,e){return r.subscribe(function(r){return r.hasValue()&&n(r.value()),r.isError()&&e(r.error),t.noMore})})},v.prototype.toPromise=function(t){return this.last().firstToPromise(t)},"undefined"!=typeof define&&null!==define&&null!=define.amd?(define([],function(){return t}),this.Bacon=t):"undefined"!=typeof module&&null!==module&&null!=module.exports?(module.exports=t,t.Bacon=t):this.Bacon=t}).call(this);
| jessepollak/cdnjs | ajax/libs/bacon.js/0.7.64/Bacon.min.js | JavaScript | mit | 43,708 |
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return Array.isArray(a)?e.call(b,a):i(a)?z(a.call(b)):j(a)?z(a):h(a)?f(a):isPromise(a)?g(a):typeof a===w?a:y(a)||Array.isArray(a)?e.call(b,a):a}function e(a){var b=this;return function(c){function e(a,e){if(!f)try{if(a=d(a,b),typeof a!==w)return i[e]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[e]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void u.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)e(a[g[j]],g[j])}}function f(a){return function(b){var c,d=!1;a.subscribe(function(a){c=a,d=!0},b,function(){d&&b(null,c)})}}function g(a){return function(b){a.then(function(a){b(null,a)},b)}}function h(a){return a&&typeof a.subscribe===w}function i(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function j(a){return a&&typeof a.next===w&&typeof a[x]===w}function k(a){a&&u.schedule(function(){throw a})}function l(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),s(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function m(a,b,c){var d=new t;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(m(a.item(e),b,c));else a&&d.add(l(a,b,c));return d}var n=c.Observable,o=(n.prototype,n.fromPromise),p=n.throwError,q=c.AnonymousObservable,r=c.AsyncSubject,s=c.Disposable.create,t=c.CompositeDisposable,u=(c.Scheduler.immediate,c.Scheduler.timeout),v=c.helpers.isScheduler,w=(Array.prototype.slice,"function"),x="throw",y=c.internals.isObject,z=c.spawn=function(a){var b=i(a);return function(c){function e(a,b){u.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2)for(var b=[],i=1,j=arguments.length;j>i;i++)b.push(arguments[i]);if(a)try{c=h[x](a)}catch(k){return e(k)}if(!a)try{c=h.next(b)}catch(k){return e(k)}if(c.done)return e(null,c.value);if(c.value=d(c.value,g),typeof c.value!==w)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var l=!1;try{c.value.call(g,function(){l||(l=!0,f.apply(g,arguments))})}catch(k){u.schedule(function(){l||(l=!0,f.call(g,k))})}}}var g=this,h=a;if(b){for(var i=[],j=0,l=arguments.length;l>j;j++)i.push(arguments[j]);var l=i.length,m=l&&typeof i[l-1]===w;c=m?i.pop():k,h=a.apply(this,i)}else c=c||k;f()}};n.start=function(a,b,c){return A(a,b,c)()};var A=n.toAsync=function(a,b,c){return v(c)||(c=u),function(){var d=arguments,e=new r;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};n.fromCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new q(function(d){function f(){for(var a=arguments.length,e=new Array(a),f=0;a>f;f++)e[f]=arguments[f];if(c){try{e=c.apply(b,e)}catch(g){return d.onError(g)}d.onNext(e)}else e.length<=1?d.onNext.apply(d,e):d.onNext(e);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},n.fromNodeCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new q(function(d){function f(a){if(a)return void d.onError(a);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(c){try{f=c.apply(b,f)}catch(h){return d.onError(h)}d.onNext(f)}else f.length<=1?d.onNext.apply(d,f):d.onNext(f);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},c.config.useNativeEvents=!1,n.fromEvent=function(a,b,d){return a.addListener?B(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new q(function(c){return m(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return c.onError(e)}c.onNext(b)})}).publish().refCount():B(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var B=n.fromEventPattern=function(a,b,c){return new q(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e)}d.onNext(b)}var f=a(e);return s(function(){b&&b(e,f)})}).publish().refCount()};return n.startAsync=function(a){var b;try{b=a()}catch(c){return p(c)}return o(b)},c});
//# sourceMappingURL=rx.async.map | tambien/cdnjs | ajax/libs/rxjs/2.5.0/rx.async.min.js | JavaScript | mit | 4,928 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.