Created
December 18, 2012 08:19
-
-
Save bergie/4326087 to your computer and use it in GitHub Desktop.
VIE and Backbone.js example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Backbone.js 0.9.2 | |
| // (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. | |
| // Backbone may be freely distributed under the MIT license. | |
| // For all details and documentation: | |
| // http://backbonejs.org | |
| (function(){var l=this,y=l.Backbone,z=Array.prototype.slice,A=Array.prototype.splice,g;g="undefined"!==typeof exports?exports:l.Backbone={};g.VERSION="0.9.2";var f=l._;!f&&"undefined"!==typeof require&&(f=require("underscore"));var i=l.jQuery||l.Zepto||l.ender;g.setDomLibrary=function(a){i=a};g.noConflict=function(){l.Backbone=y;return this};g.emulateHTTP=!1;g.emulateJSON=!1;var p=/\s+/,k=g.Events={on:function(a,b,c){var d,e,f,g,j;if(!b)return this;a=a.split(p);for(d=this._callbacks||(this._callbacks= | |
| {});e=a.shift();)f=(j=d[e])?j.tail:{},f.next=g={},f.context=c,f.callback=b,d[e]={tail:g,next:j?j.next:f};return this},off:function(a,b,c){var d,e,h,g,j,q;if(e=this._callbacks){if(!a&&!b&&!c)return delete this._callbacks,this;for(a=a?a.split(p):f.keys(e);d=a.shift();)if(h=e[d],delete e[d],h&&(b||c))for(g=h.tail;(h=h.next)!==g;)if(j=h.callback,q=h.context,b&&j!==b||c&&q!==c)this.on(d,j,q);return this}},trigger:function(a){var b,c,d,e,f,g;if(!(d=this._callbacks))return this;f=d.all;a=a.split(p);for(g= | |
| z.call(arguments,1);b=a.shift();){if(c=d[b])for(e=c.tail;(c=c.next)!==e;)c.callback.apply(c.context||this,g);if(c=f){e=c.tail;for(b=[b].concat(g);(c=c.next)!==e;)c.callback.apply(c.context||this,b)}}return this}};k.bind=k.on;k.unbind=k.off;var o=g.Model=function(a,b){var c;a||(a={});b&&b.parse&&(a=this.parse(a));if(c=n(this,"defaults"))a=f.extend({},c,a);b&&b.collection&&(this.collection=b.collection);this.attributes={};this._escapedAttributes={};this.cid=f.uniqueId("c");this.changed={};this._silent= | |
| {};this._pending={};this.set(a,{silent:!0});this.changed={};this._silent={};this._pending={};this._previousAttributes=f.clone(this.attributes);this.initialize.apply(this,arguments)};f.extend(o.prototype,k,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(){return f.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;if(b=this._escapedAttributes[a])return b;b=this.get(a);return this._escapedAttributes[a]=f.escape(null== | |
| b?"":""+b)},has:function(a){return null!=this.get(a)},set:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c||(c={});if(!d)return this;d instanceof o&&(d=d.attributes);if(c.unset)for(e in d)d[e]=void 0;if(!this._validate(d,c))return!1;this.idAttribute in d&&(this.id=d[this.idAttribute]);var b=c.changes={},h=this.attributes,g=this._escapedAttributes,j=this._previousAttributes||{};for(e in d){a=d[e];if(!f.isEqual(h[e],a)||c.unset&&f.has(h,e))delete g[e],(c.silent?this._silent: | |
| b)[e]=!0;c.unset?delete h[e]:h[e]=a;!f.isEqual(j[e],a)||f.has(h,e)!=f.has(j,e)?(this.changed[e]=a,c.silent||(this._pending[e]=!0)):(delete this.changed[e],delete this._pending[e])}c.silent||this.change(c);return this},unset:function(a,b){(b||(b={})).unset=!0;return this.set(a,null,b)},clear:function(a){(a||(a={})).unset=!0;return this.set(f.clone(this.attributes),a)},fetch:function(a){var a=a?f.clone(a):{},b=this,c=a.success;a.success=function(d,e,f){if(!b.set(b.parse(d,f),a))return!1;c&&c(b,d)}; | |
| a.error=g.wrapError(a.error,b,a);return(this.sync||g.sync).call(this,"read",this,a)},save:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c=c?f.clone(c):{};if(c.wait){if(!this._validate(d,c))return!1;e=f.clone(this.attributes)}a=f.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?a:c))return!1;var h=this,i=c.success;c.success=function(a,b,e){b=h.parse(a,e);if(c.wait){delete c.wait;b=f.extend(d||{},b)}if(!h.set(b,c))return false;i?i(h,a):h.trigger("sync",h,a,c)};c.error=g.wrapError(c.error, | |
| h,c);b=this.isNew()?"create":"update";b=(this.sync||g.sync).call(this,b,this,c);c.wait&&this.set(e,a);return b},destroy:function(a){var a=a?f.clone(a):{},b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};if(this.isNew())return d(),!1;a.success=function(e){a.wait&&d();c?c(b,e):b.trigger("sync",b,e,a)};a.error=g.wrapError(a.error,b,a);var e=(this.sync||g.sync).call(this,"delete",this,a);a.wait||d();return e},url:function(){var a=n(this,"urlRoot")||n(this.collection,"url")||t(); | |
| return this.isNew()?a:a+("/"==a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(a){a||(a={});var b=this._changing;this._changing=!0;for(var c in this._silent)this._pending[c]=!0;var d=f.extend({},a.changes,this._silent);this._silent={};for(c in d)this.trigger("change:"+c,this,this.get(c),a);if(b)return this;for(;!f.isEmpty(this._pending);){this._pending= | |
| {};this.trigger("change",this,a);for(c in this.changed)!this._pending[c]&&!this._silent[c]&&delete this.changed[c];this._previousAttributes=f.clone(this.attributes)}this._changing=!1;return this},hasChanged:function(a){return!arguments.length?!f.isEmpty(this.changed):f.has(this.changed,a)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this.changed):!1;var b,c=!1,d=this._previousAttributes,e;for(e in a)if(!f.isEqual(d[e],b=a[e]))(c||(c={}))[e]=b;return c},previous:function(a){return!arguments.length|| | |
| !this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(a,b){if(b.silent||!this.validate)return!0;var a=f.extend({},this.attributes,a),c=this.validate(a,b);if(!c)return!0;b&&b.error?b.error(this,c,b):this.trigger("error",this,c,b);return!1}});var r=g.Collection=function(a,b){b||(b={});b.model&&(this.model=b.model);b.comparator&&(this.comparator=b.comparator); | |
| this._reset();this.initialize.apply(this,arguments);a&&this.reset(a,{silent:!0,parse:b.parse})};f.extend(r.prototype,k,{model:o,initialize:function(){},toJSON:function(a){return this.map(function(b){return b.toJSON(a)})},add:function(a,b){var c,d,e,g,i,j={},k={},l=[];b||(b={});a=f.isArray(a)?a.slice():[a];c=0;for(d=a.length;c<d;c++){if(!(e=a[c]=this._prepareModel(a[c],b)))throw Error("Can't add an invalid model to a collection");g=e.cid;i=e.id;j[g]||this._byCid[g]||null!=i&&(k[i]||this._byId[i])? | |
| l.push(c):j[g]=k[i]=e}for(c=l.length;c--;)a.splice(l[c],1);c=0;for(d=a.length;c<d;c++)(e=a[c]).on("all",this._onModelEvent,this),this._byCid[e.cid]=e,null!=e.id&&(this._byId[e.id]=e);this.length+=d;A.apply(this.models,[null!=b.at?b.at:this.models.length,0].concat(a));this.comparator&&this.sort({silent:!0});if(b.silent)return this;c=0;for(d=this.models.length;c<d;c++)if(j[(e=this.models[c]).cid])b.index=c,e.trigger("add",e,this,b);return this},remove:function(a,b){var c,d,e,g;b||(b={});a=f.isArray(a)? | |
| a.slice():[a];c=0;for(d=a.length;c<d;c++)if(g=this.getByCid(a[c])||this.get(a[c]))delete this._byId[g.id],delete this._byCid[g.cid],e=this.indexOf(g),this.models.splice(e,1),this.length--,b.silent||(b.index=e,g.trigger("remove",g,this,b)),this._removeReference(g);return this},push:function(a,b){a=this._prepareModel(a,b);this.add(a,b);return a},pop:function(a){var b=this.at(this.length-1);this.remove(b,a);return b},unshift:function(a,b){a=this._prepareModel(a,b);this.add(a,f.extend({at:0},b));return a}, | |
| shift:function(a){var b=this.at(0);this.remove(b,a);return b},get:function(a){return null==a?void 0:this._byId[null!=a.id?a.id:a]},getByCid:function(a){return a&&this._byCid[a.cid||a]},at:function(a){return this.models[a]},where:function(a){return f.isEmpty(a)?[]:this.filter(function(b){for(var c in a)if(a[c]!==b.get(c))return!1;return!0})},sort:function(a){a||(a={});if(!this.comparator)throw Error("Cannot sort a set without a comparator");var b=f.bind(this.comparator,this);1==this.comparator.length? | |
| this.models=this.sortBy(b):this.models.sort(b);a.silent||this.trigger("reset",this,a);return this},pluck:function(a){return f.map(this.models,function(b){return b.get(a)})},reset:function(a,b){a||(a=[]);b||(b={});for(var c=0,d=this.models.length;c<d;c++)this._removeReference(this.models[c]);this._reset();this.add(a,f.extend({silent:!0},b));b.silent||this.trigger("reset",this,b);return this},fetch:function(a){a=a?f.clone(a):{};void 0===a.parse&&(a.parse=!0);var b=this,c=a.success;a.success=function(d, | |
| e,f){b[a.add?"add":"reset"](b.parse(d,f),a);c&&c(b,d)};a.error=g.wrapError(a.error,b,a);return(this.sync||g.sync).call(this,"read",this,a)},create:function(a,b){var c=this,b=b?f.clone(b):{},a=this._prepareModel(a,b);if(!a)return!1;b.wait||c.add(a,b);var d=b.success;b.success=function(e,f){b.wait&&c.add(e,b);d?d(e,f):e.trigger("sync",a,f,b)};a.save(null,b);return a},parse:function(a){return a},chain:function(){return f(this.models).chain()},_reset:function(){this.length=0;this.models=[];this._byId= | |
| {};this._byCid={}},_prepareModel:function(a,b){b||(b={});a instanceof o?a.collection||(a.collection=this):(b.collection=this,a=new this.model(a,b),a._validate(a.attributes,b)||(a=!1));return a},_removeReference:function(a){this==a.collection&&delete a.collection;a.off("all",this._onModelEvent,this)},_onModelEvent:function(a,b,c,d){("add"==a||"remove"==a)&&c!=this||("destroy"==a&&this.remove(b,d),b&&a==="change:"+b.idAttribute&&(delete this._byId[b.previous(b.idAttribute)],this._byId[b.id]=b),this.trigger.apply(this, | |
| arguments))}});f.each("forEach,each,map,reduce,reduceRight,find,detect,filter,select,reject,every,all,some,any,include,contains,invoke,max,min,sortBy,sortedIndex,toArray,size,first,initial,rest,last,without,indexOf,shuffle,lastIndexOf,isEmpty,groupBy".split(","),function(a){r.prototype[a]=function(){return f[a].apply(f,[this.models].concat(f.toArray(arguments)))}});var u=g.Router=function(a){a||(a={});a.routes&&(this.routes=a.routes);this._bindRoutes();this.initialize.apply(this,arguments)},B=/:\w+/g, | |
| C=/\*\w+/g,D=/[-[\]{}()+?.,\\^$|#\s]/g;f.extend(u.prototype,k,{initialize:function(){},route:function(a,b,c){g.history||(g.history=new m);f.isRegExp(a)||(a=this._routeToRegExp(a));c||(c=this[b]);g.history.route(a,f.bind(function(d){d=this._extractParameters(a,d);c&&c.apply(this,d);this.trigger.apply(this,["route:"+b].concat(d));g.history.trigger("route",this,b,d)},this));return this},navigate:function(a,b){g.history.navigate(a,b)},_bindRoutes:function(){if(this.routes){var a=[],b;for(b in this.routes)a.unshift([b, | |
| this.routes[b]]);b=0;for(var c=a.length;b<c;b++)this.route(a[b][0],a[b][1],this[a[b][1]])}},_routeToRegExp:function(a){a=a.replace(D,"\\$&").replace(B,"([^/]+)").replace(C,"(.*?)");return RegExp("^"+a+"$")},_extractParameters:function(a,b){return a.exec(b).slice(1)}});var m=g.History=function(){this.handlers=[];f.bindAll(this,"checkUrl")},s=/^[#\/]/,E=/msie [\w.]+/;m.started=!1;f.extend(m.prototype,k,{interval:50,getHash:function(a){return(a=(a?a.location:window.location).href.match(/#(.*)$/))?a[1]: | |
| ""},getFragment:function(a,b){if(null==a)if(this._hasPushState||b){var a=window.location.pathname,c=window.location.search;c&&(a+=c)}else a=this.getHash();a.indexOf(this.options.root)||(a=a.substr(this.options.root.length));return a.replace(s,"")},start:function(a){if(m.started)throw Error("Backbone.history has already been started");m.started=!0;this.options=f.extend({},{root:"/"},this.options,a);this._wantsHashChange=!1!==this.options.hashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState= | |
| !(!this.options.pushState||!window.history||!window.history.pushState);var a=this.getFragment(),b=document.documentMode;if(b=E.exec(navigator.userAgent.toLowerCase())&&(!b||7>=b))this.iframe=i('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(a);this._hasPushState?i(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!b?i(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl, | |
| this.interval));this.fragment=a;a=window.location;b=a.pathname==this.options.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!b)return this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&b&&a.hash&&(this.fragment=this.getHash().replace(s,""),window.history.replaceState({},document.title,a.protocol+"//"+a.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()}, | |
| stop:function(){i(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl);clearInterval(this._checkUrlInterval);m.started=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();a==this.fragment&&this.iframe&&(a=this.getFragment(this.getHash(this.iframe)));if(a==this.fragment)return!1;this.iframe&&this.navigate(a);this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(a){var b=this.fragment=this.getFragment(a);return f.any(this.handlers, | |
| function(a){if(a.route.test(b))return a.callback(b),!0})},navigate:function(a,b){if(!m.started)return!1;if(!b||!0===b)b={trigger:b};var c=(a||"").replace(s,"");this.fragment!=c&&(this._hasPushState?(0!=c.indexOf(this.options.root)&&(c=this.options.root+c),this.fragment=c,window.history[b.replace?"replaceState":"pushState"]({},document.title,c)):this._wantsHashChange?(this.fragment=c,this._updateHash(window.location,c,b.replace),this.iframe&&c!=this.getFragment(this.getHash(this.iframe))&&(b.replace|| | |
| this.iframe.document.open().close(),this._updateHash(this.iframe.location,c,b.replace))):window.location.assign(this.options.root+a),b.trigger&&this.loadUrl(a))},_updateHash:function(a,b,c){c?a.replace(a.toString().replace(/(javascript:|#).*$/,"")+"#"+b):a.hash=b}});var v=g.View=function(a){this.cid=f.uniqueId("view");this._configure(a||{});this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()},F=/^(\S+)\s*(.*)$/,w="model,collection,el,id,attributes,className,tagName".split(","); | |
| f.extend(v.prototype,k,{tagName:"div",$:function(a){return this.$el.find(a)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();return this},make:function(a,b,c){a=document.createElement(a);b&&i(a).attr(b);c&&i(a).html(c);return a},setElement:function(a,b){this.$el&&this.undelegateEvents();this.$el=a instanceof i?a:i(a);this.el=this.$el[0];!1!==b&&this.delegateEvents();return this},delegateEvents:function(a){if(a||(a=n(this,"events"))){this.undelegateEvents(); | |
| for(var b in a){var c=a[b];f.isFunction(c)||(c=this[a[b]]);if(!c)throw Error('Method "'+a[b]+'" does not exist');var d=b.match(F),e=d[1],d=d[2],c=f.bind(c,this),e=e+(".delegateEvents"+this.cid);""===d?this.$el.bind(e,c):this.$el.delegate(d,e,c)}}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(a){this.options&&(a=f.extend({},this.options,a));for(var b=0,c=w.length;b<c;b++){var d=w[b];a[d]&&(this[d]=a[d])}this.options=a},_ensureElement:function(){if(this.el)this.setElement(this.el, | |
| !1);else{var a=n(this,"attributes")||{};this.id&&(a.id=this.id);this.className&&(a["class"]=this.className);this.setElement(this.make(this.tagName,a),!1)}}});o.extend=r.extend=u.extend=v.extend=function(a,b){var c=G(this,a,b);c.extend=this.extend;return c};var H={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};g.sync=function(a,b,c){var d=H[a];c||(c={});var e={type:d,dataType:"json"};c.url||(e.url=n(b,"url")||t());if(!c.data&&b&&("create"==a||"update"==a))e.contentType="application/json", | |
| e.data=JSON.stringify(b.toJSON());g.emulateJSON&&(e.contentType="application/x-www-form-urlencoded",e.data=e.data?{model:e.data}:{});if(g.emulateHTTP&&("PUT"===d||"DELETE"===d))g.emulateJSON&&(e.data._method=d),e.type="POST",e.beforeSend=function(a){a.setRequestHeader("X-HTTP-Method-Override",d)};"GET"!==e.type&&!g.emulateJSON&&(e.processData=!1);return i.ajax(f.extend(e,c))};g.wrapError=function(a,b,c){return function(d,e){e=d===b?e:d;a?a(b,e,c):b.trigger("error",b,e,c)}};var x=function(){},G=function(a, | |
| b,c){var d;d=b&&b.hasOwnProperty("constructor")?b.constructor:function(){a.apply(this,arguments)};f.extend(d,a);x.prototype=a.prototype;d.prototype=new x;b&&f.extend(d.prototype,b);c&&f.extend(d,c);d.prototype.constructor=d;d.__super__=a.prototype;return d},n=function(a,b){return!a||!a[b]?null:f.isFunction(a[b])?a[b]():a[b]},t=function(){throw Error('A "url" property or function must be specified');}}).call(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>VIE and Backbone.js example</title> | |
| <script src="lib/jquery.min.js"></script> | |
| <script src="lib/underscore.min.js"></script> | |
| <script src="lib/backbone.min.js"></script> | |
| <script src="lib/vie.min.js"></script> | |
| </head> | |
| <body> | |
| <h1>Backbone.js example</h1> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*! jQuery v1.8.3 jquery.com | jquery.org/license */ | |
| (function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,i=1-r,s=0,o=f.tweens.length;for(;s<o;s++)f.tweens[s].run(i);return u.notifyWith(e,[f,i,n]),i<1&&o?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},m=[],g=e.nodeType&&Gt(e);n.queue||(l=v._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,v.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",v.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r],a=a||s==="toggle";if(s===(g?"hide":"show"))continue;m.push(r)}}o=m.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),"hidden"in u&&(g=u.hidden),a&&(u.hidden=!g),g?v(e).show():h.done(function(){v(e).hide()}),h.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in d)v.style(e,t,d[t])});for(r=0;r<o;r++)i=m[r],f=h.createTween(i,g?u[i]:0),d[i]=u[i]||v.style(e,i),i in u||(u[i]=f.start,g&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call("\ufeff\u00a0")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(v.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!v.nodeName(n.parentNode,"optgroup"))){t=v(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=lt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?T.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r<i;r++)nt(e,t[r],n);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:st(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=[],r=1,i=0;l=h,e.sort(f);if(l){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e+" "];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,n=v.timers,r=0;qn=v.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||v.fx.stop(),qn=t},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,v=e.reduce,h=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,j=i.bind,w=function(n){return n instanceof w?n:this instanceof w?(this._wrapped=n,void 0):new w(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=w),exports._=w):n._=w,w.VERSION="1.4.3";var A=w.each=w.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(w.has(n,a)&&t.call(e,n[a],a,n)===r)return};w.map=w.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e[e.length]=t.call(r,n,u,i)}),e)};var O="Reduce of empty array with no initial value";w.reduce=w.foldl=w.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduce===v)return e&&(t=w.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},w.reduceRight=w.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduceRight===h)return e&&(t=w.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=w.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},w.find=w.detect=function(n,t,r){var e;return E(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},w.filter=w.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&(e[e.length]=n)}),e)},w.reject=function(n,t,r){return w.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},w.every=w.all=function(n,t,e){t||(t=w.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var E=w.some=w.any=function(n,t,e){t||(t=w.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};w.contains=w.include=function(n,t){return null==n?!1:y&&n.indexOf===y?-1!=n.indexOf(t):E(n,function(n){return n===t})},w.invoke=function(n,t){var r=o.call(arguments,2);return w.map(n,function(n){return(w.isFunction(t)?t:n[t]).apply(n,r)})},w.pluck=function(n,t){return w.map(n,function(n){return n[t]})},w.where=function(n,t){return w.isEmpty(t)?[]:w.filter(n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},w.max=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.max.apply(Math,n);if(!t&&w.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>=e.computed&&(e={value:n,computed:a})}),e.value},w.min=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.min.apply(Math,n);if(!t&&w.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;e.computed>a&&(e={value:n,computed:a})}),e.value},w.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=w.random(r++),e[r-1]=e[t],e[t]=n}),e};var F=function(n){return w.isFunction(n)?n:function(t){return t[n]}};w.sortBy=function(n,t,r){var e=F(t);return w.pluck(w.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||void 0===r)return 1;if(e>r||void 0===e)return-1}return n.index<t.index?-1:1}),"value")};var k=function(n,t,r,e){var u={},i=F(t||w.identity);return A(n,function(t,a){var o=i.call(r,t,a,n);e(u,o,t)}),u};w.groupBy=function(n,t,r){return k(n,t,r,function(n,t,r){(w.has(n,t)?n[t]:n[t]=[]).push(r)})},w.countBy=function(n,t,r){return k(n,t,r,function(n,t){w.has(n,t)||(n[t]=0),n[t]++})},w.sortedIndex=function(n,t,r,e){r=null==r?w.identity:F(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;u>r.call(e,n[o])?i=o+1:a=o}return i},w.toArray=function(n){return n?w.isArray(n)?o.call(n):n.length===+n.length?w.map(n,w.identity):w.values(n):[]},w.size=function(n){return null==n?0:n.length===+n.length?n.length:w.keys(n).length},w.first=w.head=w.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},w.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},w.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},w.rest=w.tail=w.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},w.compact=function(n){return w.filter(n,w.identity)};var R=function(n,t,r){return A(n,function(n){w.isArray(n)?t?a.apply(r,n):R(n,t,r):r.push(n)}),r};w.flatten=function(n,t){return R(n,t,[])},w.without=function(n){return w.difference(n,o.call(arguments,1))},w.uniq=w.unique=function(n,t,r,e){w.isFunction(t)&&(e=r,r=t,t=!1);var u=r?w.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:w.contains(a,r))||(a.push(r),i.push(n[e]))}),i},w.union=function(){return w.uniq(c.apply(e,arguments))},w.intersection=function(n){var t=o.call(arguments,1);return w.filter(w.uniq(n),function(n){return w.every(t,function(t){return w.indexOf(t,n)>=0})})},w.difference=function(n){var t=c.apply(e,o.call(arguments,1));return w.filter(n,function(n){return!w.contains(t,n)})},w.zip=function(){for(var n=o.call(arguments),t=w.max(w.pluck(n,"length")),r=Array(t),e=0;t>e;e++)r[e]=w.pluck(n,""+e);return r},w.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},w.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=w.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},w.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},w.range=function(n,t,r){1>=arguments.length&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=Array(e);e>u;)i[u++]=n,n+=r;return i};var I=function(){};w.bind=function(n,t){var r,e;if(n.bind===j&&j)return j.apply(n,o.call(arguments,1));if(!w.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));I.prototype=n.prototype;var u=new I;I.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},w.bindAll=function(n){var t=o.call(arguments,1);return 0==t.length&&(t=w.functions(n)),A(t,function(t){n[t]=w.bind(n[t],n)}),n},w.memoize=function(n,t){var r={};return t||(t=w.identity),function(){var e=t.apply(this,arguments);return w.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},w.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},w.defer=function(n){return w.delay.apply(w,[n,1].concat(o.call(arguments,1)))},w.throttle=function(n,t){var r,e,u,i,a=0,o=function(){a=new Date,u=null,i=n.apply(r,e)};return function(){var c=new Date,l=t-(c-a);return r=this,e=arguments,0>=l?(clearTimeout(u),u=null,a=c,i=n.apply(r,e)):u||(u=setTimeout(o,l)),i}},w.debounce=function(n,t,r){var e,u;return function(){var i=this,a=arguments,o=function(){e=null,r||(u=n.apply(i,a))},c=r&&!e;return clearTimeout(e),e=setTimeout(o,t),c&&(u=n.apply(i,a)),u}},w.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},w.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},w.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},w.after=function(n,t){return 0>=n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},w.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)w.has(n,r)&&(t[t.length]=r);return t},w.values=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push(n[r]);return t},w.pairs=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push([r,n[r]]);return t},w.invert=function(n){var t={};for(var r in n)w.has(n,r)&&(t[n[r]]=r);return t},w.functions=w.methods=function(n){var t=[];for(var r in n)w.isFunction(n[r])&&t.push(r);return t.sort()},w.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},w.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},w.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)w.contains(r,u)||(t[u]=n[u]);return t},w.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)null==n[r]&&(n[r]=t[r])}),n},w.clone=function(n){return w.isObject(n)?w.isArray(n)?n.slice():w.extend({},n):n},w.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof w&&(n=n._wrapped),t instanceof w&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==t+"";case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;r.push(n),e.push(t);var a=0,o=!0;if("[object Array]"==u){if(a=n.length,o=a==t.length)for(;a--&&(o=S(n[a],t[a],r,e)););}else{var c=n.constructor,f=t.constructor;if(c!==f&&!(w.isFunction(c)&&c instanceof c&&w.isFunction(f)&&f instanceof f))return!1;for(var s in n)if(w.has(n,s)&&(a++,!(o=w.has(t,s)&&S(n[s],t[s],r,e))))break;if(o){for(s in t)if(w.has(t,s)&&!a--)break;o=!a}}return r.pop(),e.pop(),o};w.isEqual=function(n,t){return S(n,t,[],[])},w.isEmpty=function(n){if(null==n)return!0;if(w.isArray(n)||w.isString(n))return 0===n.length;for(var t in n)if(w.has(n,t))return!1;return!0},w.isElement=function(n){return!(!n||1!==n.nodeType)},w.isArray=x||function(n){return"[object Array]"==l.call(n)},w.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){w["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),w.isArguments(arguments)||(w.isArguments=function(n){return!(!n||!w.has(n,"callee"))}),w.isFunction=function(n){return"function"==typeof n},w.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},w.isNaN=function(n){return w.isNumber(n)&&n!=+n},w.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},w.isNull=function(n){return null===n},w.isUndefined=function(n){return void 0===n},w.has=function(n,t){return f.call(n,t)},w.noConflict=function(){return n._=t,this},w.identity=function(n){return n},w.times=function(n,t,r){for(var e=Array(n),u=0;n>u;u++)e[u]=t.call(r,u);return e},w.random=function(n,t){return null==t&&(t=n,n=0),n+(0|Math.random()*(t-n+1))};var T={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};T.unescape=w.invert(T.escape);var M={escape:RegExp("["+w.keys(T.escape).join("")+"]","g"),unescape:RegExp("("+w.keys(T.unescape).join("|")+")","g")};w.each(["escape","unescape"],function(n){w[n]=function(t){return null==t?"":(""+t).replace(M[n],function(t){return T[n][t]})}}),w.result=function(n,t){if(null==n)return null;var r=n[t];return w.isFunction(r)?r.call(n):r},w.mixin=function(n){A(w.functions(n),function(t){var r=w[t]=n[t];w.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(w,n))}})};var N=0;w.uniqueId=function(n){var t=""+ ++N;return n?n+t:t},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;w.template=function(n,t,r){r=w.defaults({},r,w.templateSettings);var e=RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,a,o){return i+=n.slice(u,o).replace(D,function(n){return"\\"+B[n]}),r&&(i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(i+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),a&&(i+="';\n"+a+"\n__p+='"),u=o+t.length,t}),i+="';\n",r.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var a=Function(r.variable||"obj","_",i)}catch(o){throw o.source=i,o}if(t)return a(t,w);var c=function(n){return a.call(this,n,w)};return c.source="function("+(r.variable||"obj")+"){\n"+i+"}",c},w.chain=function(n){return w(n).chain()};var z=function(n){return this._chain?w(n).chain():n};w.mixin(w),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];w.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];w.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),w.extend(w.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* VIE 2.1.0 may be freely distributed under the MIT license. See http://viejs.org/ for more details. */(function(){var a=this,d=a.jQuery,e=a.Backbone,b=a._;var c=a.VIE=function(f){this.config=(f)?f:{};this.services={};this.jQuery=d;this.entities=new this.Collection([],{vie:this});this.Entity.prototype.entities=this.entities;this.Entity.prototype.entityCollection=this.Collection;this.Entity.prototype.vie=this;this.Namespaces.prototype.vie=this;this.namespaces=new this.Namespaces((this.config.baseNamespace)?this.config.baseNamespace:"http://viejs.org/ns/",{owl:"http://www.w3.org/2002/07/owl#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",schema:"http://schema.org/",foaf:"http://xmlns.com/foaf/0.1/",geo:"http://www.w3.org/2003/01/geo/wgs84_pos#",dbpedia:"http://dbpedia.org/ontology/",dbprop:"http://dbpedia.org/property/",skos:"http://www.w3.org/2004/02/skos/core#",xsd:"http://www.w3.org/2001/XMLSchema#",sioc:"http://rdfs.org/sioc/ns#",dcterms:"http://purl.org/dc/terms/"});this.Type.prototype.vie=this;this.Types.prototype.vie=this;this.Attribute.prototype.vie=this;this.Attributes.prototype.vie=this;this.types=new this.Types();this.types.add("owl:Thing");if(this.config.classic===true){this.RDFa=new this.ClassicRDFa(this);this.RDFaEntities=new this.ClassicRDFaEntities(this);this.EntityManager=new this.ClassicEntityManager(this);this.cleanup=function(){this.entities.reset()}}};c.prototype.use=function(f,g){if(!g&&!f.name){throw new Error("Please provide a name for the service!")}f.vie=this;f.name=(g)?g:f.name;if(f.init){f.init()}this.services[f.name]=f;return this};c.prototype.service=function(f){if(!this.hasService(f)){throw"Undefined service "+f}return this.services[f]};c.prototype.hasService=function(f){if(!this.services[f]){return false}return true};c.prototype.getServicesArray=function(){return b.map(this.services,function(f){return f})};c.prototype.load=function(f){if(!f){f={}}f.vie=this;return new this.Loadable(f)};c.prototype.save=function(f){if(!f){f={}}f.vie=this;return new this.Savable(f)};c.prototype.remove=function(f){if(!f){f={}}f.vie=this;return new this.Removable(f)};c.prototype.analyze=function(f){if(!f){f={}}f.vie=this;return new this.Analyzable(f)};c.prototype.find=function(f){if(!f){f={}}f.vie=this;return new this.Findable(f)};c.prototype.loadSchema=function(g,f){f=(!f)?{}:f;if(!g){throw new Error("Please provide a proper URL")}else{var h=this;d.getJSON(g).success(function(i){try{c.Util.loadSchemaOrg(h,i,f.baseNS);if(f.success){f.success.call(h)}}catch(j){f.error.call(h,j);return}}).error(function(j,k,i){if(f.error){console.warn(j,k,i);f.error.call(h,"Could not load schema from URL ("+g+")")}})}return this};c.prototype.getTypedEntityClass=function(h){var g=this.types.get(h);if(!g){throw new Error("Unknown type "+h)}var f=function(i,j){if(!i){i={}}i["@type"]=h;this.set(i,j)};f.prototype=new this.Entity();f.prototype.schema=function(){return c.Util.getFormSchemaForType(g)};return f};if(typeof exports==="object"){exports.VIE=c;if(!d){d=require("jquery")}if(!e){e=require("backbone");e.setDomLibrary(d)}if(!b){b=require("underscore")._}}c.prototype.Able=function(){this.init=function(g,f){this.options=g;this.services=g.from||g.using||g.to||[];this.vie=g.vie;this.methodName=f;this.deferred=d.Deferred();this.resolve=this.deferred.resolve;this.resolveWith=this.deferred.resolveWith;this.reject=this.deferred.reject;this.rejectWith=this.deferred.rejectWith;this.success=this.done=this.deferred.done;this.fail=this.deferred.fail;this.then=this.deferred.then;this.always=this.deferred.always;this.from=this.using;this.to=this.using;return this};this.using=function(g){var f=this;g=(b.isArray(g))?g:[g];b.each(g,function(h){var i=(typeof h==="string")?f.vie.service(h):h;f.services.push(i)});return this};this.execute=function(){var f=this;b(this.services).each(function(g){g[f.methodName](f)});return this}};c.prototype.Loadable=function(f){this.init(f,"load")};c.prototype.Loadable.prototype=new c.prototype.Able();c.prototype.Savable=function(f){this.init(f,"save")};c.prototype.Savable.prototype=new c.prototype.Able();c.prototype.Removable=function(f){this.init(f,"remove")};c.prototype.Removable.prototype=new c.prototype.Able();c.prototype.Analyzable=function(f){this.init(f,"analyze")};c.prototype.Analyzable.prototype=new c.prototype.Able();c.prototype.Findable=function(f){this.init(f,"find")};c.prototype.Findable.prototype=new c.prototype.Able();c.Util={toCurie:function(g,j,i){if(c.Util.isCurie(g,i)){return g}var l=":";for(var f in i.toObj()){if(g.indexOf(i.get(f))===1){var h=new RegExp("^<?"+i.get(f));if(f===""){l=""}return((j)?"[":"")+g.replace(h,f+l).replace(/>$/,"")+((j)?"]":"")}}throw new Error("No prefix found for URI '"+g+"'!")},isCurie:function(f,g){if(c.Util.isUri(f)){return false}else{try{c.Util.toUri(f,g);return true}catch(h){return false}}},toUri:function(f,i){if(c.Util.isUri(f)){return f}var j=":";for(var h in i.toObj()){if(h!==""&&(f.indexOf(h+":")===0||f.indexOf("["+h+":")===0)){var g=new RegExp("^\\[{0,1}"+h+j);return"<"+f.replace(g,i.get(h)).replace(/\]{0,1}$/,"")+">"}}if(f.indexOf(j)===-1){return"<"+i.base()+f+">"}throw new Error("No prefix found for CURIE '"+f+"'!")},isUri:function(f){return(typeof f==="string"&&f.search(/^<.+>$/)===0)},mapAttributeNS:function(f,h){var g=f;if(h.isUri(f)||f.indexOf("@")===0){}else{if(h.isCurie(f)){g=h.uri(f)}else{if(!h.isUri(f)){if(f.indexOf(":")===-1){g="<"+h.base()+f+">"}else{g="<"+f+">"}}}}return g},rdf2Entities:function(m,g){if(typeof d.rdf!=="function"){return c.Util._rdf2EntitiesNoRdfQuery(m,g)}try{var l=(g instanceof d.rdf)?g.base(m.vie.namespaces.base()):d.rdf().base(m.vie.namespaces.base()).load(g,{});if(m.rules){var p=d.rdf.ruleset();for(var j in m.vie.namespaces.toObj()){if(j!==""){p.prefix(j,m.vie.namespaces.get(j))}}for(var h=0;h<m.rules.length;h++){if(m.rules.hasOwnProperty(h)){var o=m.rules[h];p.add(o.left,o.right)}}l=l.reason(p,10)}var k={};l.where("?subject ?property ?object").each(function(){var q=this.subject.toString();if(!k[q]){k[q]={"@subject":q,"@context":m.vie.namespaces.toObj(true),"@type":[]}}var s=this.property.toString();var t;try{t=m.vie.namespaces.curie(s)}catch(r){t=s}k[q][t]=k[q][t]||[];function i(u){if(typeof u.value==="string"){if(u.lang){var v={toString:function(){return this["@value"]},"@value":u.value.replace(/^"|"$/g,""),"@language":u.lang};return v}else{return u.value}return u.value.toString()}else{if(u.type==="uri"){return u.toString()}else{return u.value}}}k[q][t].push(i(this.object))});b(k).each(function(i){i["@type"]=i["@type"].concat(i["rdf:type"]);delete i["rdf:type"];b(i).each(function(r,q){if(r.length===1){i[q]=r[0]}})});var f=[];d.each(k,function(){var i=new m.vie.Entity(this);i=m.vie.entities.addOrUpdate(i);f.push(i)});return f}catch(n){console.warn("Something went wrong while parsing the returned results!",n);return[]}},getPreferredLangForPreferredProperty:function(k,q,i){var j,t,h,g,s,o,n,r,f,m=this;o=[];b.each(i,function(l){b.each(q,function(p){t=null;if(typeof p==="string"&&k.get(p)){t=b.flatten([k.get(p)]);b(t).each(function(u){var v,x,w;x=g;v=u["@language"];if(typeof u==="string"&&(u.indexOf("@")===u.length-3||u.indexOf("@")===u.length-5)){v=u.replace(/(^\"*|\"*@)..(..)?$/g,"")}if(v){if(v===l){x+=j}else{x+=20}}else{x+=10}w=u.toString();w=w.replace(/(^\"*|\"*@..$)/g,"");return o.push({score:x,value:w})})}else{if(typeof p==="object"&&k.get(p.property)){n=b.flatten([k.get(p.property)]);n=b(n).map(function(u){if(u.isEntity){return u.getSubject()}else{return u}});o.push({score:g,value:p.makeLabel(n)})}}})});o=b(o).sortBy(function(l){return l.score});if(o.length){return o[0].value}else{return"n/a"}},_rdf2EntitiesNoRdfQuery:function(f,g){var h=[];b.forEach(g,function(k,j){var i={};i["@subject"]="<"+j+">";b.forEach(k,function(m,l){l="<"+l+">";b.forEach(m,function(n){if(n.type==="uri"){n.value="<"+n.value+">"}if(i[l]&&!b.isArray(i[l])){i[l]=[i[l]]}if(b.isArray(i[l])){i[l].push(n.value);return}i[l]=n.value})});h.push(i)});return h},loadSchemaOrg:function(n,k,o){if(!k){throw new Error("Please load the schema.json file.")}n.types.remove("<http://schema.org/Thing>");var h=(o)?o:n.namespaces.base();n.namespaces.base(o);var i={DataType:"xsd:anyType",Boolean:"xsd:boolean",Date:"xsd:date",DateTime:"xsd:dateTime",Time:"xsd:time",Float:"xsd:float",Integer:"xsd:integer",Number:"xsd:anySimpleType",Text:"xsd:string",URL:"xsd:anyURI"};var j=function(t,u){var s=n.types.add(u,[{id:"value",range:i[u]}]);for(var r=0;r<t.length;r++){var q=(n.types.get(t[r]))?n.types.get(t[r]):j.call(n,k.datatypes[t[r]].supertypes,t[r]);s.inherit(q)}return s};for(var g in k.datatypes){if(!n.types.get(g)){var p=k.datatypes[g].supertypes;j.call(n,p,g)}}var m=function(r){var q={};if(r.label){q.label=r.label}if(r.url){q.url=r.url}if(r.comment){q.comment=r.comment}if(r.metadata){q=b.extend(q,r.metadata)}return q};var l=function(r){var q=[];b.each(k.types[r].specific_properties,function(s){var t=k.properties[s];q.push({id:t.id,range:t.ranges,min:t.min,max:t.max,metadata:m(t)})});return q};var f=function(v,w,u,s){var t=n.types.add(w,u,s);for(var r=0;r<v.length;r++){var q=(n.types.get(v[r]))?n.types.get(v[r]):f.call(n,k.types[v[r]].supertypes,v[r],l.call(n,v[r]),m(k.types[v[r]]));t.inherit(q)}if(w==="Thing"&&!t.isof("owl:Thing")){t.inherit("owl:Thing")}return t};b.each(k.types,function(s){if(n.types.get(s.id)){return}var r=s.supertypes;var q=m(s);f.call(n,r,s.id,l.call(n,s.id),q)});n.namespaces.base(h)},getEntityTypeUnion:function(f){var g=f.vie;return new g.Type("Union").inherit(f.get("@type"))},getFormSchemaForType:function(g,f){var h={};b.each(g.attributes.toArray(),function(j){var i=c.Util.toCurie(j.id,false,j.vie.namespaces);h[i]=c.Util.getFormSchemaForAttribute(j)});b.each(h,function(i,j){if(!i.type){delete h[j]}if(i.type==="URL"){i.type="Text";i.dataType="url"}if(i.type==="List"&&!i.listType){delete h[j]}if(!f){if(i.type==="NestedModel"||i.listType==="NestedModel"){delete h[j]}}});return h},getFormSchemaForAttribute:function(h){var f=h.range[0];var g={};var i=function(k){switch(k){case"xsd:anySimpleType":case"xsd:float":case"xsd:integer":return"Number";case"xsd:string":return"Text";case"xsd:date":return"Date";case"xsd:dateTime":return"DateTime";case"xsd:boolean":return"Checkbox";case"xsd:anyURI":return"URL";default:var j=h.vie.types.get(k);if(!j){return null}if(j.attributes.get("value")){return i(j.attributes.get("value").range[0])}return"NestedModel"}};g.title=c.Util.toCurie(h.id,false,h.vie.namespaces);if(h.min>0){g.validators=["required"]}if(h.max>1){g.type="List";g.listType=i(f);if(g.listType==="NestedModel"){g.nestedModelType=f}return g}g.type=i(f);if(g.type==="NestedModel"){g.nestedModelType=f}return g},getFormSchema:function(g){if(!g||!g.isEntity){return{}}var f=c.Util.getEntityTypeUnion(g);var h=c.Util.getFormSchemaForType(f,true);b.each(h,function(i,j){if(i.type!=="NestedModel"&&i.listType!=="NestedModel"){return}h[j].model=g.vie.getTypedEntityClass(i.nestedModelType)});return h},xsdDateTime:function(g){function l(p){var o=p.toString();return o.length<2?"0"+o:o}var m=g.getFullYear();var k=l(g.getMonth()+1);var f=l(g.getDate());var i=l(g.getHours());var j=l(g.getMinutes());var h=l(g.getSeconds());return m+"-"+k+"-"+f+"T"+i+":"+j+":"+h},extractLanguageString:function(o,s,m){var g,r,f,q,j;if(o&&typeof o!=="string"){s=(b.isArray(s))?s:[s];m=(b.isArray(m))?m:[m];for(g=0;g<s.length;g++){for(var k=0;k<m.length;k++){var h=m[k];r=s[g];if(o.has(r)){f=o.get(r);f=(b.isArray(f))?f:[f];for(q=0;q<f.length;q++){j=f[q];if(j.isEntity){j=c.Util.extractLanguageString(j,s,h)}else{if(typeof j==="string"){j=j}else{j=""}}if(j&&j.indexOf("@"+h)>-1){return j.replace(/"/g,"").replace(/@[a-z]+/,"").trim()}}}}}for(g=0;g<s.length;g++){r=s[g];if(o.has(r)){f=o.get(r);f=(b.isArray(f))?f:[f];for(q=0;q<f.length;q++){j=f[q];if(j.isEntity){j=c.Util.extractLanguageString(j,s,[])}if(j&&(typeof j==="string")&&j.indexOf("@")===-1){return j.replace(/"/g,"").replace(/@[a-z]+/,"").trim()}}}}}return undefined},transformationRules:function(f){var g=[{left:["?subject a dbpedia:Person","?subject rdfs:label ?label"],right:function(h){return function(){return[d.rdf.triple(this.subject.toString(),"a","<"+h.base()+"Person>",{namespaces:h.toObj()}),d.rdf.triple(this.subject.toString(),"<"+h.base()+"name>",this.label,{namespaces:h.toObj()})]}}(f.vie.namespaces)},{left:["?subject a foaf:Person","?subject rdfs:label ?label"],right:function(h){return function(){return[d.rdf.triple(this.subject.toString(),"a","<"+h.base()+"Person>",{namespaces:h.toObj()}),d.rdf.triple(this.subject.toString(),"<"+h.base()+"name>",this.label,{namespaces:h.toObj()})]}}(f.vie.namespaces)},{left:["?subject a dbpedia:Place","?subject rdfs:label ?label"],right:function(h){return function(){return[d.rdf.triple(this.subject.toString(),"a","<"+h.base()+"Place>",{namespaces:h.toObj()}),d.rdf.triple(this.subject.toString(),"<"+h.base()+"name>",this.label.toString(),{namespaces:h.toObj()})]}}(f.vie.namespaces)},{left:["?subject a dbpedia:City","?subject rdfs:label ?label","?subject dbpedia:abstract ?abs","?subject dbpedia:country ?country"],right:function(h){return function(){return[d.rdf.triple(this.subject.toString(),"a","<"+h.base()+"City>",{namespaces:h.toObj()}),d.rdf.triple(this.subject.toString(),"<"+h.base()+"name>",this.label.toString(),{namespaces:h.toObj()}),d.rdf.triple(this.subject.toString(),"<"+h.base()+"description>",this.abs.toString(),{namespaces:h.toObj()}),d.rdf.triple(this.subject.toString(),"<"+h.base()+"containedIn>",this.country.toString(),{namespaces:h.toObj()})]}}(f.vie.namespaces)}];return g},getAdditionalRules:function(f){var h={Work:"CreativeWork",Film:"Movie",TelevisionEpisode:"TVEpisode",TelevisionShow:"TVSeries",Website:"WebPage",Painting:"Painting",Sculpture:"Sculpture",Event:"Event",SportsEvent:"SportsEvent",MusicFestival:"Festival",FilmFestival:"Festival",Place:"Place",Continent:"Continent",Country:"Country",City:"City",Airport:"Airport",Station:"TrainStation",Hospital:"GovernmentBuilding",Mountain:"Mountain",BodyOfWater:"BodyOfWater",Company:"Organization",Person:"Person"};var g=[];b.each(h,function(k,j){var i={left:["?subject a dbpedia:"+j,"?subject rdfs:label ?label"],right:function(l){return function(){return[d.rdf.triple(this.subject.toString(),"a","<"+l.base()+k+">",{namespaces:l.toObj()}),d.rdf.triple(this.subject.toString(),"<"+l.base()+"name>",this.label.toString(),{namespaces:l.toObj()})]}}(f.vie.namespaces)};g.push(i)});return g}};c.prototype.Entity=function(g,h){g=(g)?g:{};h=(h)?h:{};var f=this;if(g["@type"]!==undefined){g["@type"]=(b.isArray(g["@type"]))?g["@type"]:[g["@type"]];g["@type"]=b.map(g["@type"],function(j){if(!f.vie.types.get(j)){f.vie.types.add(j).inherit("owl:Thing")}return f.vie.types.get(j).id});g["@type"]=(g["@type"].length===1)?g["@type"][0]:g["@type"]}else{g["@type"]=f.vie.types.get("owl:Thing").id}b.each(g,function(k,j){var l=c.Util.mapAttributeNS(j,this.namespaces);if(j!==l){delete g[j];g[l]=k}},f.vie);var i=e.Model.extend({idAttribute:"@subject",initialize:function(j,k){if(j["@subject"]){this.id=this["@subject"]=this.toReference(j["@subject"])}else{this.id=this["@subject"]=j["@subject"]=this.cid.replace("c","_:bnode")}return this},schema:function(){return c.Util.getFormSchema(this)},get:function(j){j=c.Util.mapAttributeNS(j,f.vie.namespaces);var k=e.Model.prototype.get.call(this,j);k=(b.isArray(k))?k:[k];k=b.map(k,function(l){if(l!==undefined&&j==="@type"&&f.vie.types.get(l)){return f.vie.types.get(l)}else{if(l!==undefined&&f.vie.entities.get(l)){return f.vie.entities.get(l)}else{return l}}},this);if(k.length===0){return undefined}k=(k.length===1)?k[0]:k;return k},has:function(j){j=c.Util.mapAttributeNS(j,f.vie.namespaces);return e.Model.prototype.has.call(this,j)},hasRelations:function(){var j=false;b.each(this.attributes,function(k){if(k&&k.isCollection){j=true}});return j},set:function(m,l,o){if(!m){return this}if(m["@subject"]){m["@subject"]=this.toReference(m["@subject"])}if(typeof m==="string"){var p={};p[m]=l;return this.set(p,o)}if(m.attributes){m=m.attributes}var j=this;var n;b.each(m,function(r,q){var s=c.Util.mapAttributeNS(q,j.vie.namespaces);if(q!==s){delete m[q];m[s]=r}},this);b.each(m,function(s,r){if(!s){return}if(r.indexOf("@")===-1){if(s.isCollection){s.each(function(u){j.vie.entities.addOrUpdate(u)})}else{if(s.isEntity){j.vie.entities.addOrUpdate(s);n=new j.vie.Collection(s,{vie:j.vie,predicate:r});m[r]=n}else{if(b.isArray(s)){if(this.attributes[r]&&this.attributes[r].isCollection){var q=this.attributes[r].addOrUpdate(s);m[r]=this.attributes[r];m[r].reset(q)}}else{if(s["@value"]){}else{if(b.isObject(s)&&!b.isDate(s)){var t=new j.vie.Entity(s,l);j.vie.entities.addOrUpdate(t);n=new j.vie.Collection(s,{vie:j.vie,predicate:r});m[r]=n}else{}}}}}}},this);var k=e.Model.prototype.set.call(this,m,l);if(l&&l.ignoreChanges){this.changed={};this._previousAttributes=b.clone(this.attributes)}return k},unset:function(j,k){j=c.Util.mapAttributeNS(j,f.vie.namespaces);return e.Model.prototype.unset.call(this,j,k)},validate:function(j,m){if(m&&m.validate===false){return}var l=this.get("@type");if(b.isArray(l)){var k=[];b.each(l,function(o){var n=this.validateByType(o,j,m);if(n){k.push(n)}},this);if(b.isEmpty(k)){return}return b.flatten(k)}return this.validateByType(l,j,m)},validateByType:function(m,k,o){var n={max:"<%= property %> cannot contain more than <%= num %> items",min:"<%= property %> must contain at least <%= num %> items",required:"<%= property %> is required"};if(!m.attributes){return}var q=function(s,t,r){return{property:s.id,constraint:t,message:b.template(n[t],b.extend({property:s.id},r))}};var j=function(s,r){if(!r[s.id]||b.isEmpty(r[s.id])){return q(s,"required",{})}};var p=function(s,r){if(!r[s.id]){return}if(!r[s.id].isCollection&&!b.isArray(r[s.id])){return}if(r[s.id].length>s.max){return q(s,"max",{num:s.max})}};var l=[];b.each(m.attributes.list(),function(s){var r;if(s.max&&s.max!=-1){r=p(s,k);if(r){l.push(r)}}if(s.min&&s.min>0){r=j(s,k);if(r){l.push(r)}}});if(b.isEmpty(l)){return}return l},isNew:function(){if(this.getSubjectUri().substr(0,7)==="_:bnode"){return true}return false},hasChanged:function(j){if(this.markedChanged){return true}return e.Model.prototype.hasChanged.call(this,j)},forceChanged:function(j){this.markedChanged=j?true:false},getSubject:function(){if(typeof this.id==="undefined"){this.id=this.attributes[this.idAttribute]}if(typeof this.id==="string"){if(this.id.substr(0,7)==="http://"||this.id.substr(0,4)==="urn:"){return this.toReference(this.id)}return this.id}return this.cid.replace("c","_:bnode")},getSubjectUri:function(){return this.fromReference(this.getSubject())},isReference:function(j){var k=new RegExp("^\\<([^\\>]*)\\>$");if(k.exec(j)){return true}return false},toReference:function(m){if(b.isArray(m)){var j=this;return b.map(m,function(n){return j.toReference(n)})}var l=this.vie.namespaces;var k=m;if(m.substring(0,2)==="_:"){k=m}else{if(l.isCurie(m)){k=l.uri(m);if(k==="<"+l.base()+m+">"){k="<"+m+">"}}else{if(!l.isUri(m)){k="<"+m+">"}}}return k},fromReference:function(k){var j=this.vie.namespaces;if(!j.isUri(k)){return k}return k.substring(1,k.length-1)},as:function(j){if(j==="JSON"){return this.toJSON()}if(j==="JSONLD"){return this.toJSONLD()}throw new Error("Unknown encoding "+j)},toJSONLD:function(){var k={};var j=this;b.each(j.attributes,function(n,m){var l=n;if(n instanceof j.vie.Collection){l=n.map(function(o){return o.getSubject()})}k[m]=l});k["@subject"]=j.getSubject();return k},setOrAdd:function(l,k,m){var j=this;if(typeof l==="string"&&k){j._setOrAddOne(l,k,m)}else{if(typeof l==="object"){b(l).each(function(o,n){j._setOrAddOne(n,o,k)})}}return this},_setOrAddOne:function(k,o,m){if(!k||!o){return}m=(m)?m:{};var l;k=c.Util.mapAttributeNS(k,f.vie.namespaces);if(b.isArray(o)){for(l=0;l<o.length;l++){this._setOrAddOne(k,o[l],m)}return}if(k==="@type"&&o instanceof f.vie.Type){o=o.id}var p={};var n=e.Model.prototype.get.call(this,k);if(!n){p[k]=o;this.set(p,m)}else{if(n.isCollection){if(o.isCollection){o.each(function(q){n.add(q)})}else{if(o.isEntity){n.add(o)}else{if(typeof o==="object"){o=new this.vie.Entity(o);n.add(o)}else{throw new Error("you cannot add a literal to a collection of entities!")}}}this.trigger("change:"+k,this,o,{});this.change({})}else{if(b.isArray(n)){if(o.isCollection){for(l=0;l<o.size();l++){this._setOrAddOne(k,o.at(l).getSubject(),m)}}else{if(o.isEntity){this._setOrAddOne(k,o.getSubject(),m)}else{if(typeof o==="object"){o=new this.vie.Entity(o);this._setOrAddOne(k,o,m)}else{n.push(o);p[k]=n;this.set(p)}}}}else{var j=[n];j.push(o);p[k]=j;return this.set(p,m)}}}},hasType:function(j){j=f.vie.types.get(j);return this.hasPropertyValue("@type",j)},hasPropertyValue:function(l,k){var j=this.get(l);if(!(k instanceof Object)){k=f.vie.entities.get(k)}if(j instanceof Array){return j.indexOf(k)!==-1}else{return j===k}},isof:function(l){var k=this.get("@type");if(k===undefined){return false}k=(b.isArray(k))?k:[k];l=(f.vie.types.get(l))?f.vie.types.get(l):new f.vie.Type(l);for(var j=0;j<k.length;j++){if(f.vie.types.get(k[j])){if(f.vie.types.get(k[j]).isof(l)){return true}}else{var m=new f.vie.Type(k[j]);if(m.id===l.id){return true}}}return false},addTo:function(k,l){var j=this;if(k instanceof j.vie.Collection){if(l){k.addOrUpdate(j)}else{k.add(j)}return this}throw new Error("Please provide a proper collection of type VIE.Collection as argument!")},isEntity:true,vie:f.vie});return new i(g,h)};c.prototype.Collection=e.Collection.extend({model:c.prototype.Entity,initialize:function(g,f){if(!f||!f.vie){throw new Error("Each collection needs a VIE reference")}this.vie=f.vie;this.predicate=f.predicate},canAdd:function(f){return true},get:function(f){if(f===null){return null}f=(f.getSubject)?f.getSubject():f;if(typeof f==="string"&&f.indexOf("_:")===0){if(f.indexOf("bnode")===2){f=f.replace("_:bnode","c");return this._byCid[f]}else{return this._byId["<"+f+">"]}}else{f=this.toReference(f);return this._byId[f]}},addOrUpdate:function(g,f){f=f||{};var k=this;var i;if(b.isArray(g)){var j=[];b.each(g,function(l){j.push(k.addOrUpdate(l,f))});return j}if(g===undefined){throw new Error("No model given")}if(b.isString(g)){g={"@subject":g,id:g}}if(!g.isEntity){g=new this.model(g)}if(g.id&&this.get(g.id)){i=this.get(g.id)}if(this.getByCid(g.cid)){i=this.getByCid(g.cid)}if(i){var h={};b.each(g.attributes,function(n,m){if(!i.has(m)){h[m]=n;return true}if(m==="@subject"){if(g.isNew()&&!i.isNew()){return true}}if(i.get(m)===n){return true}var o=i.attributes[m];var l=n;if(o instanceof k.vie.Collection){return true}if(f.overrideAttributes){h[m]=n;return true}if(m==="@context"){h[m]=d.extend(true,{},o,l)}else{o=(d.isArray(o))?o:[o];l=(d.isArray(l))?l:[l];h[m]=b.uniq(o.concat(l));h[m]=(h[m].length===1)?h[m][0]:h[m]}});if(!b.isEmpty(h)){i.set(h,f.updateOptions)}return i}this.add(g,f.addOptions);return g},isReference:function(f){var g=new RegExp("^\\<([^\\>]*)\\>$");if(g.exec(f)){return true}return false},toReference:function(f){if(this.isReference(f)){return f}return"<"+f+">"},fromReference:function(f){if(!this.isReference(f)){return f}return f.substring(1,f.length-1)},isCollection:true});if(c.prototype.Type){throw new Error("ERROR: VIE.Type is already defined. Please check your installation!")}if(c.prototype.Types){throw new Error("ERROR: VIE.Types is already defined. Please check your installation!")}c.prototype.Type=function(h,f,g){if(h===undefined||typeof h!=="string"){throw"The type constructor needs an 'id' of type string! E.g., 'Person'"}this.id=this.vie.namespaces.isUri(h)?h:this.vie.namespaces.uri(h);if(this.vie.types.get(this.id)){throw new Error("The type "+this.id+" is already defined!")}this.supertypes=new this.vie.Types();this.subtypes=new this.vie.Types();this.attributes=new this.vie.Attributes(this,(f)?f:[]);this.metadata=g?g:{};this.isof=function(i){i=this.vie.types.get(i);if(i){return i.subsumes(this.id)}else{throw new Error("No valid type given")}};this.subsumes=function(i){i=this.vie.types.get(i);if(i){if(this.id===i.id){return true}var j=this.subtypes.list();for(var l=0;l<j.length;l++){var k=j[l];if(k){if(k.id===i.id||k.subsumes(i)){return true}}}return false}else{throw new Error("No valid type given")}};this.inherit=function(j){if(typeof j==="string"){this.inherit(this.vie.types.get(j))}else{if(j instanceof this.vie.Type){j.subtypes.addOrOverwrite(this);this.supertypes.addOrOverwrite(j);try{this.attributes.list()}catch(m){j.subtypes.remove(this);this.supertypes.remove(j);throw m}}else{if(d.isArray(j)){for(var k=0,l=j.length;k<l;k++){this.inherit(j[k])}}else{throw new Error("Wrong argument in VIE.Type.inherit()")}}}return this};this.hierarchy=function(){var k={id:this.id,subtypes:[]};var j=this.subtypes.list();for(var m=0,i=j.length;m<i;m++){var l=this.vie.types.get(j[m]);k.subtypes.push(l.hierarchy())}return k};this.instance=function(j,k){j=(j)?j:{};k=(k)?k:{};if(k.typeChecking!==false){for(var i in j){if(i.indexOf("@")!==0&&!this.attributes.get(i)){throw new Error("Cannot create an instance of "+this.id+" as the type does not allow an attribute '"+i+"'!")}}}if(j["@type"]){j["@type"].push(this.id)}else{j["@type"]=this.id}return new this.vie.Entity(j,k)};this.toString=function(){return this.id}};c.prototype.Types=function(){this._types={};this.add=function(i,f,h){if(b.isArray(i)){b.each(i,function(j){this.add(j)},this);return this}if(this.get(i)){throw new Error("Type '"+i+"' already registered.")}else{if(typeof i==="string"){var g=new this.vie.Type(i,f,h);this._types[g.id]=g;return g}else{if(i instanceof this.vie.Type){this._types[i.id]=i;return i}else{throw new Error("Wrong argument to VIE.Types.add()!")}}}return this};this.addOrOverwrite=function(g,f){if(this.get(g)){this.remove(g)}return this.add(g,f)};this.get=function(g){if(!g){return undefined}if(typeof g==="string"){var f=this.vie.namespaces.isUri(g)?g:this.vie.namespaces.uri(g);return this._types[f]}else{if(g instanceof this.vie.Type){return this.get(g.id)}}return undefined};this.remove=function(j){var f=this.get(j);if(!f){return this}if(!f||f.subsumes("owl:Thing")){console.warn("You are not allowed to remove 'owl:Thing'.");return this}delete this._types[f.id];var g=f.subtypes.list();for(var i=0;i<g.length;i++){var h=g[i];if(h.supertypes.list().length===1){this.remove(h)}else{h.supertypes.remove(f.id)}}return f};this.toArray=this.list=function(){var f=[];for(var g in this._types){f.push(this._types[g])}return f};this.sort=function(i,h){var n=this;i=(d.isArray(i))?i:[i];h=(h)?true:false;if(i.length===0){return[]}var f=[i[0]];var l,g;for(l=1,g=i.length;l<g;l++){var m=i[l];var j=n.get(m);if(j){for(var k=0;k<f.length;k++){if(j.subsumes(f[k])){f.splice(k,0,m);break}else{if(k===f.length-1){f.push(m)}}}}}for(l=0;l<f.length;l++){if(f.lastIndexOf(f[l])!==l){f.splice(l,1);l--}}if(!h){f.reverse()}return f}};if(c.prototype.Attribute){throw new Error("ERROR: VIE.Attribute is already defined. Please check your VIE installation!")}if(c.prototype.Attributes){throw new Error("ERROR: VIE.Attributes is already defined. Please check your VIE installation!")}c.prototype.Attribute=function(k,f,j,h,i,g){if(k===undefined||typeof k!=="string"){throw new Error("The attribute constructor needs an 'id' of type string! E.g., 'Person'")}if(f===undefined){throw new Error("The attribute constructor of "+k+" needs 'range'.")}if(j===undefined){throw new Error("The attribute constructor of "+k+" needs a 'domain'.")}this._domain=j;this.id=this.vie.namespaces.isUri(k)?k:this.vie.namespaces.uri(k);this.range=(b.isArray(f))?f:[f];h=h?h:0;this.min=(h>0)?h:0;i=i?i:1;if(i===-1){i=Number.MAX_VALUE}this.max=(i>=this.min)?i:this.min;this.metadata=g?g:{};this.applies=function(n){if(this.vie.types.get(n)){n=this.vie.types.get(n)}for(var o=0,m=this.range.length;o<m;o++){var l=this.vie.types.get(this.range[o]);if(l===undefined&&typeof n==="string"){if(n===this.range[o]){return true}}else{if(n.isof(this.range[o])){return true}}}return false}};c.prototype.Attributes=function(g,f){this._local={};this._attributes={};this.domain=g;this.add=function(m,j,l,h,k){if(b.isArray(m)){b.each(m,function(n){this.add(n)},this);return this}if(this.get(m)){throw new Error("Attribute '"+m+"' already registered for domain "+this.domain.id+"!")}else{if(typeof m==="string"){var i=new this.vie.Attribute(m,j,this.domain,l,h,k);this._local[i.id]=i;return i}else{if(m instanceof this.vie.Attribute){m.domain=this.domain;m.vie=this.vie;this._local[m.id]=m;return m}else{throw new Error("Wrong argument to VIE.Types.add()!")}}}};this.remove=function(i){var h=this.get(i);if(h.id in this._local){delete this._local[h.id];return h}throw new Error("The attribute "+i+" is inherited and cannot be removed from the domain "+this.domain.id+"!")};this.get=function(i){if(typeof i==="string"){var h=this.vie.namespaces.isUri(i)?i:this.vie.namespaces.uri(i);return this._inherit()._attributes[h]}else{if(i instanceof this.vie.Attribute){return this.get(i.id)}else{throw new Error("Wrong argument in VIE.Attributes.get()")}}};this._inherit=function(){var D,t,A;var q=d.extend(true,{},this._local);var E=b.map(this.domain.supertypes.list(),function(p){return p.attributes});var u={};var m={};var s,l;for(D=0,s=E.length;D<s;D++){var B=E[D].list();for(t=0,l=B.length;t<l;t++){A=B[t].id;if(!(A in q)){if(!(A in u)&&!(A in m)){u[A]=B[t]}else{if(!m[A]){m[A]={range:[],mins:[],maxs:[],metadatas:[]}}if(A in u){m[A].range=d.merge(m[A].range,u[A].range);m[A].mins=d.merge(m[A].mins,[u[A].min]);m[A].maxs=d.merge(m[A].maxs,[u[A].max]);m[A].metadatas=d.merge(m[A].metadatas,[u[A].metadata]);delete u[A]}m[A].range=d.merge(m[A].range,B[t].range);m[A].mins=d.merge(m[A].mins,[B[t].min]);m[A].maxs=d.merge(m[A].maxs,[B[t].max]);m[A].metadatas=d.merge(m[A].metadatas,[B[t].metadata]);m[A].range=b.uniq(m[A].range);m[A].mins=b.uniq(m[A].mins);m[A].maxs=b.uniq(m[A].maxs);m[A].metadatas=b.uniq(m[A].metadatas)}}}}d.extend(q,u);for(A in m){var z=m[A].range;var o=m[A].mins;var n=m[A].maxs;var j=m[A].metadatas;var k=[];for(var v=0,h=z.length;v<h;v++){var y=this.vie.types.get(z[v]);var F=false;if(y){for(t=0;t<h;t++){if(t===v){continue}var C=this.vie.types.get(z[t]);if(C&&C.isof(y)){F=true;break}}}if(!F){k.push(z[v])}}var i=b.max(o);var w=b.min(n);if(i<=w&&w>=0&&i>=0){q[A]=new this.vie.Attribute(A,k,this,i,w,j[0])}else{throw new Error("This inheritance is not allowed because of an invalid minCount/maxCount pair!")}}this._attributes=q;return this};this.toArray=this.list=function(j){var k=[];var i=this._inherit()._attributes;for(var h in i){if(!j||i[h].applies(j)){k.push(i[h])}}return k};f=b.isArray(f)?f:[f];b.each(f,function(h){this.add(h.id,h.range,h.min,h.max,h.metadata)},this)};if(c.prototype.Namespaces){throw new Error("ERROR: VIE.Namespaces is already defined. Please check your VIE installation!")}c.prototype.Namespaces=function(g,f){if(!g){throw new Error("Please provide a base namespace!")}this._base=g;this._namespaces=(f)?f:{};if(typeof this._namespaces!=="object"||b.isArray(this._namespaces)){throw new Error("If you want to initialise VIE namespace prefixes, please provide a proper object!")}};c.prototype.Namespaces.prototype.base=function(f){if(!f){return this._base}else{if(typeof f==="string"){this.removeNamespace(f);this._base=f;return this._base}else{throw new Error("Please provide a valid namespace!")}}};c.prototype.Namespaces.prototype.add=function(g,f){if(typeof g==="object"){for(var h in g){this.add(h,g[h])}return this}if(g===""){this.base(f);return this}else{if(this.contains(g)&&f!==this._namespaces[g]){throw new Error("ERROR: Trying to register namespace prefix mapping ("+g+","+f+")!There is already a mapping existing: '("+g+","+this.get(g)+")'!")}else{d.each(this._namespaces,function(j,i){if(i===f&&j!==g){throw new Error("ERROR: Trying to register namespace prefix mapping ("+g+","+f+")!There is already a mapping existing: '("+j+","+f+")'!")}})}}this._namespaces[g]=f;return this};c.prototype.Namespaces.prototype.addOrReplace=function(g,f){if(typeof g==="object"){for(var h in g){this.addOrReplace(h,g[h])}return this}this.remove(g);this.removeNamespace(f);return this.add(g,f)};c.prototype.Namespaces.prototype.get=function(f){if(f===""){return this.base()}return this._namespaces[f]};c.prototype.Namespaces.prototype.getPrefix=function(f){var g;if(f.indexOf("<")===0){f=f.substring(1,f.length-1)}d.each(this._namespaces,function(i,h){if(f.indexOf(h)===0){g=i}if(f.indexOf(i+":")===0){g=i}});return g};c.prototype.Namespaces.prototype.contains=function(f){return(f in this._namespaces)};c.prototype.Namespaces.prototype.containsNamespace=function(f){return this.getPrefix(f)!==undefined};c.prototype.Namespaces.prototype.update=function(g,f){this.remove(g);return this.add(g,f)};c.prototype.Namespaces.prototype.updateNamespace=function(g,f){this.removeNamespace(g);return this.add(g,f)};c.prototype.Namespaces.prototype.remove=function(f){if(f){delete this._namespaces[f]}return this};c.prototype.Namespaces.prototype.removeNamespace=function(f){var g=this.getPrefix(f);if(g){delete this._namespaces[g]}return this};c.prototype.Namespaces.prototype.toObj=function(f){if(f){return d.extend({},this._namespaces)}return d.extend({"":this._base},this._namespaces)};c.prototype.Namespaces.prototype.curie=function(f,g){return c.Util.toCurie(f,g,this)};c.prototype.Namespaces.prototype.isCurie=function(f){return c.Util.isCurie(f,this)};c.prototype.Namespaces.prototype.uri=function(f){return c.Util.toUri(f,this)};c.prototype.Namespaces.prototype.isUri=c.Util.isUri;c.prototype.ClassicRDFa=function(f){this.vie=f};c.prototype.ClassicRDFa.prototype={readEntities:function(f){var g=[];var h=this.vie.RDFaEntities.getInstances(f);b.each(h,function(i){g.push(i.toJSONLD())});return g},findPredicateElements:function(h,g,f){return this.vie.services.rdfa.findPredicateElements(h,g,f)},getPredicate:function(f){return this.vie.services.rdfa.getElementPredicate(f)},getSubject:function(f){return this.vie.services.rdfa.getElementSubject(f)}};c.prototype.ClassicRDFaEntities=function(f){this.vie=f};c.prototype.ClassicRDFaEntities.prototype={getInstances:function(f){if(!this.vie.services.rdfa){this.vie.use(new this.vie.RdfaService())}var g=null;var h=false;this.vie.load({element:f}).from("rdfa").execute().done(function(i){g=i;h=true});while(!h){}return g},getInstance:function(f){var g=this.getInstances(f);if(g&&g.length){return g.pop()}return null}};c.prototype.ClassicEntityManager=function(f){this.vie=f;this.entities=this.vie.entities};c.prototype.ClassicEntityManager.prototype={getBySubject:function(f){return this.vie.entities.get(f)},getByJSONLD:function(f){if(typeof f==="string"){try{f=d.parseJSON(f)}catch(g){return null}}return this.vie.entities.addOrUpdate(f)},initializeCollection:function(){return}};(function(){c.prototype.DBPediaService=function(f){var g={name:"dbpedia",namespaces:{owl:"http://www.w3.org/2002/07/owl#",yago:"http://dbpedia.org/class/yago/",foaf:"http://xmlns.com/foaf/0.1/",georss:"http://www.georss.org/georss/",geo:"http://www.w3.org/2003/01/geo/wgs84_pos#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",dbpedia:"http://dbpedia.org/ontology/",dbprop:"http://dbpedia.org/property/",dcelements:"http://purl.org/dc/elements/1.1/"},rules:[]};this.options=d.extend(true,g,f?f:{});this.vie=null;this.name=this.options.name;d.ajaxSetup({converters:{"text application/rdf+json":function(h){return JSON.parse(h)}},timeout:60000})};c.prototype.DBPediaService.prototype={init:function(){for(var f in this.options.namespaces){var g=this.options.namespaces[f];this.vie.namespaces.add(f,g)}this.rules=d.extend([],c.Util.transformationRules(this));this.rules=d.merge(this.rules,(this.options.rules)?this.options.rules:[]);this.connector=new this.vie.DBPediaConnector(this.options);return this},load:function(l){var h=this;var j=l instanceof this.vie.Loadable;if(!j){throw new Error("Invalid Loadable passed")}var m=function(o){o=(typeof o==="string")?JSON.parse(o):o;b.defer(function(){try{var q=c.Util.rdf2Entities(h,o);q=(b.isArray(q))?q:[q];b.each(q,function(r){r.set("DBPediaServiceLoad",c.Util.xsdDateTime(new Date()))});q=(q.length===1)?q[0]:q;l.resolve(q)}catch(p){l.reject(p)}})};var k=function(o){l.reject(o)};var g=(l.options.entity)?l.options.entity:l.options.entities;if(!g){l.reject([])}else{g=(b.isArray(g))?g:[g];var n=[];for(var i=0;i<g.length;i++){var f=(typeof g[i]==="string")?g[i]:g[i].id;n.push(f)}this.connector.load(n,m,k)}return this}};c.prototype.DBPediaConnector=function(f){this.options=f;this.baseUrl="http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&timeout=0"};c.prototype.DBPediaConnector.prototype={load:function(g,l,j,o){if(!o){o={}}var f=this.baseUrl+"&format="+encodeURIComponent("application/rdf+json")+"&query=";if(b.isArray(g)){var n="";var h="";for(var m=0;m<g.length;m++){var i=(/^<.+>$/.test(g[m]))?g[m]:"<"+g[m]+">";if(m>0){n+=" .";h+=" UNION "}n+=" "+i+" ?prop"+m+" ?val"+m;h+=" { "+i+" ?prop"+m+" ?val"+m+" }"}f+=encodeURIComponent("CONSTRUCT {"+n+" } WHERE {"+h+" }")}else{g=(/^<.+>$/.test(g))?g:"<"+g+">";f+=encodeURIComponent("CONSTRUCT { "+g+" ?prop ?val } WHERE { "+g+" ?prop ?val }")}var k=o.format||"application/rdf+json";if(typeof exports!=="undefined"&&typeof process!=="undefined"){return this._loadNode(f,l,j,o,k)}d.ajax({success:function(p){l(p)},error:j,type:"GET",url:f,accepts:{"application/rdf+json":"application/rdf+json"}});return this},_loadNode:function(j,l,g,f,k){var i=require("request");var h=i({method:"GET",uri:j,headers:{Accept:k}},function(o,n,m){if(n.statusCode!==200){return g(m)}l(JSON.parse(m))});h.end();return this}}})();(function(){c.prototype.OpenCalaisService=function(f){var g={name:"opencalais",url:["http://api.opencalais.com/enlighten/rest/"],timeout:60000,namespaces:{opencalaisc:"http://s.opencalais.com/1/pred/",opencalaiscr:"http://s.opencalais.com/1/type/er/",opencalaiscm:"http://s.opencalais.com/1/type/em/e/"},rules:[]};this.options=d.extend(true,g,f?f:{});this.vie=null;this.name=this.options.name;d.ajaxSetup({converters:{"text application/rdf+json":function(h){return JSON.parse(h)}},timeout:this.options.timeout})};c.prototype.OpenCalaisService.prototype={init:function(){for(var f in this.options.namespaces){var g=this.options.namespaces[f];this.vie.namespaces.add(f,g)}this.rules=d.extend([],c.Util.transformationRules(this));this.rules=d.merge(this.rules,(this.options.rules)?this.options.rules:[]);this.connector=new this.vie.OpenCalaisConnector(this.options)},analyze:function(l){var f=this;var h=l instanceof this.vie.Analyzable;if(!h){throw"Invalid Analyzable passed"}var i=l.options.element?l.options.element:d("body");var k=f._extractText(i);if(k.length>0){var j=function(m){b.defer(function(){var n=c.Util.rdf2Entities(f,m);l.resolve(n)})};var g=function(m){l.reject(m)};this.connector.analyze(k,j,g)}else{console.warn("No text found in element.");l.resolve([])}},_extractText:function(g){if(g.get(0)&&g.get(0).tagName&&(g.get(0).tagName=="TEXTAREA"||g.get(0).tagName=="INPUT"&&g.attr("type","text"))){return g.get(0).val()}else{var f=g.text().replace(/\s+/g," ").replace(/\0\b\n\r\f\t/g,"");return d.trim(f)}}};c.prototype.OpenCalaisConnector=function(f){this.options=f;this.baseUrl=(b.isArray(f.url))?f.url:[f.url];this.enhancerUrlPrefix="/"};c.prototype.OpenCalaisConnector.prototype={analyze:function(l,k,h,g){if(!g){g={urlIndex:0}}if(g.urlIndex>=this.baseUrl.length){h("Could not connect to the given OpenCalais endpoints! Please check for their setup!");return}var f=this.baseUrl[g.urlIndex].replace(/\/$/,"");f+=this.enhancerUrlPrefix;var j=g.format||"application/rdf+json";var m=function(u,n,p,q,r){return function(){console.error("OpenCalais connection error",arguments);u.analyze(n,p,q,b.extend(r,{urlIndex:r.urlIndex+1}))}}(this,l,k,h,g);var i=this._prepareData(l);if(typeof exports!=="undefined"&&typeof process!=="undefined"){return this._analyzeNode(f,i,k,m,g,j)}d.ajax({success:function(o,n,q){var p=q.responseText.replace(/<!--[\s\S]*?-->/g,"");k(p)},error:m,type:"POST",url:f,data:i,accept:"text/plain"})},_analyzeNode:function(g,m,l,h,f,k){var j=require("request");var i=j({method:"POST",uri:g,body:m,headers:{Accept:k}},function(p,o,n){try{l({results:JSON.parse(n)})}catch(q){h(q)}});i.end()},_prepareData:function(f){return{licenseID:this.options.api_key,calculareRelevanceScore:"true",enableMetadataType:"GenericRelations,SocialTags",contentType:"text/html",content:f}}}})();(function(){c.prototype.RdfaRdfQueryService=function(f){var g={name:"rdfardfquery",namespaces:{},rules:[]};this.options=d.extend(true,g,f?f:{});this.views=[];this.vie=null;this.name=this.options.name};c.prototype.RdfaRdfQueryService.prototype={init:function(){for(var f in this.options.namespaces){var g=this.options.namespaces[f];this.vie.namespaces.add(f,g)}this.rules=d.extend([],c.Util.transformationRules(this));this.rules=d.merge(this.rules,(this.options.rules)?this.options.rules:[])},analyze:function(f){return this.load(f)},load:function(l){var f=this;var g=l instanceof this.vie.Loadable||l instanceof this.vie.Analyzable;if(!g){throw new Error("Invalid Loadable/Analyzable passed")}var i=l.options.element?l.options.element:d(document);try{var h=d(i).find("[about],[typeof]").rdfa();d.each(d(i).xmlns(),function(n,m){f.vie.namespaces.addOrReplace(n,m.toString())});var k=c.Util.rdf2Entities(this,h);l.resolve(k)}catch(j){l.reject(j)}},save:function(i){var g=i instanceof this.vie.Savable;if(!g){i.reject("Invalid Savable passed")}if(!i.options.element){i.reject("Unable to write entity to RDFa, no element given")}if(!i.options.entity){i.reject("Unable to write to RDFa, no entity given")}if(!d.rdf){i.reject("No rdfQuery found.")}var f=i.options.entity;var j=[];var h=f.get("@type");h=(d.isArray(h))?h[0]:h;h=h.id;j.push(f.getSubject()+" a "+h);d(i.options.element).rdfa(j);i.resolve()}}})();(function(){c.prototype.RdfaService=function(f){var g={name:"rdfa",namespaces:{},subjectSelector:"[about],[typeof],[src],html",predicateSelector:"[property],[rel]",rules:[],bnodePrefix:"_a"};this.options=d.extend(true,g,f?f:{});this.bnodes=0;this.views=[];this.templates={};this.datatypeReaders={"<http://www.w3.org/2001/XMLSchema#boolean>":function(h){if(h==="true"||h===1||h===true){return true}return false},"<http://www.w3.org/2001/XMLSchema#dateTime>":function(h){return new Date(h)},"<http://www.w3.org/2001/XMLSchema#integer>":function(h){return parseInt(h,10)}};this.datatypeWriters={"<http://www.w3.org/2001/XMLSchema#dateTime>":function(h){if(!b.isDate(h)){return h}return h.toISOString()}};this.vie=null;this.name=this.options.name};c.prototype.RdfaService.prototype={init:function(){for(var f in this.options.namespaces){var g=this.options.namespaces[f];this.vie.namespaces.add(f,g)}this.rules=d.merge([],c.Util.transformationRules(this));this.rules=d.merge(this.rules,(this.options.rules)?this.options.rules:[])},analyze:function(f){return this.load(f)},load:function(j){var f=this;var g=j instanceof this.vie.Loadable||j instanceof this.vie.Analyzable;if(!g){throw new Error("Invalid Loadable/Analyzable passed")}var h;if(!j.options.element){if(typeof document==="undefined"){return j.resolve([])}h=d(document)}else{h=j.options.element}var i=this.readEntities(h);j.resolve(i)},save:function(g){var f=g instanceof this.vie.Savable;if(!f){throw"Invalid Savable passed"}if(!g.options.element){throw"Unable to write entity to RDFa, no element given"}if(!g.options.entity){throw"Unable to write to RDFa, no entity given"}this._writeEntity(g.options.entity,g.options.element);g.resolve()},readEntities:function(h){var g=this;var i=this.xmlns(h);for(var j in i){this.vie.namespaces.addOrReplace(j,i[j])}var k=[];var f=d(this.options.subjectSelector,h).add(d(h).filter(this.options.subjectSelector)).each(function(){var l=g._readEntity(d(this));if(l){k.push(l)}});return k},_readEntity:function(i){var h=this.getElementSubject(i);var j=this._getElementType(i);var f=this._readEntityPredicates(h,i,false);if(d.isEmptyObject(f)){return null}var k=this.vie;b.each(f,function(n,m){if(!b.isArray(n)){return}var l=new this.vie.Collection([],{vie:k,predicate:m});b.each(n,function(o){var p=k.entities.addOrUpdate({"@subject":o});l.addOrUpdate(p)});f[m]=l},this);f["@subject"]=h;if(j){f["@type"]=j}var g=new this.vie.Entity(f);g=this.vie.entities.addOrUpdate(g,{updateOptions:{silent:true,ignoreChanges:true}});this._registerEntityView(g,i);return g},_writeEntity:function(g,h){var f=this;this.findPredicateElements(this.getElementSubject(h),h,true).each(function(){var j=d(this);var i=f.getElementPredicate(j);if(!g.has(i)){return true}var k=g.get(i);if(k&&k.isCollection){return true}if(k===f.readElementValue(i,j)){return true}f.writeElementValue(i,j,k)});return true},_getViewForElement:function(h,f){var g;d.each(this.views,function(){if(d(this.el).get(0)===h.get(0)){if(f&&!this.template){return true}g=this;return false}});return g},_registerEntityView:function(i,j,g){if(!j.length){return}var f=this;var h=this._getViewForElement(j);if(h){if(i.hasRelations()&&!h.collectionsChecked){this._registerEntityCollectionViews(i,j,h)}return h}h=new this.vie.view.Entity({model:i,el:j,tagName:j.get(0).nodeName,vie:this.vie,service:this.name});this.views.push(h);if(g){d(j).find(this.options.predicateSelector).add(d(j).filter(this.options.predicateSelector)).each(function(){var k=d(this).attr("rel");if(!k){return}i.set(k,new f.vie.Collection([],{vie:f.vie,predicate:k}))})}this._registerEntityCollectionViews(i,j,h);return h},_registerEntityCollectionViews:function(h,i,g){var f=this;b.each(h.attributes,function(l,j){var k=h.fromReference(h.get(j));if(k&&k.isCollection){d.each(f.getElementByPredicate(j,i),function(){f._registerCollectionView(k,d(this),h)});g.collectionsChecked=true}})},setTemplate:function(i,f,h){var g;if(!h){h=f;f="default"}i=this.vie.namespaces.isUri(i)?i:this.vie.namespaces.uri(i);if(b.isFunction(h)){g=h}else{g=this.getElementTemplate(h)}if(!this.templates[i]){this.templates[i]={}}this.templates[i][f]=g;b.each(this.views,function(j){if(!(j instanceof this.vie.view.Collection)){return}if(j.collection.predicate!==f){return}j.templates[i]=g},this)},getTemplate:function(g,f){if(!f){f="default"}g=this.vie.namespaces.isUri(g)?g:this.vie.namespaces.uri(g);if(!this.templates[g]){return}return this.templates[g][f]},_getElementTemplates:function(j,h,f){var i={};var l=h.get("@type");if(l&&l.attributes&&l.attributes.get(f)){var m=l.attributes.get(f);b.each(m.range,function(n){var o=this.getTemplate(n,f);if(o){var p=this.vie.types.get(n);i[p.id]=o}},this);if(!b.isEmpty(i)){return i}}var g=this;d("[typeof]",j).each(function(){var p=d(this);var n=p.attr("typeof");n=g.vie.namespaces.isUri(n)?n:g.vie.namespaces.uri(n);if(i[n]){return}var o=g.getElementTemplate(p);i[n]=o;i["<http://www.w3.org/2002/07/owl#Thing>"]=o});if(b.isEmpty(i)){var k=j.children(":first-child");if(k.length){i["<http://www.w3.org/2002/07/owl#Thing>"]=g.getElementTemplate(k)}}return i},getElementTemplate:function(g){var f=this;return function(h,k){var j=d(g).clone(false);if(j.attr("about")!==undefined){j.attr("about","")}j.find("[about]").attr("about","");var i=f.findPredicateElements(i,j,false).each(function(){var m=d(this);var l=f.getElementPredicate(m);if(h.has(l)&&h.get(l).isCollection){return true}f.writeElementValue(null,m,"")});k(j)}},_registerCollectionView:function(i,h,g){var f=this._getViewForElement(h,true);if(f){return f}f=new this.vie.view.Collection({owner:g,collection:i,model:i.model,el:h,templates:this._getElementTemplates(h,g,i.predicate),service:this});this.views.push(f);return f},_getElementType:function(f){var g;if(d(f).attr("typeof")!==this.options.attributeExistenceComparator){g=d(f).attr("typeof");if(g.indexOf("://")!==-1){return"<"+g+">"}else{return g}}return null},_generatebnodeId:function(){var f=this.options.bnodePrefix+":"+this.bnodes;this.bnodes++;return f},getElementSubject:function(i,j){var g=this;if(typeof document!=="undefined"){if(i===document){return document.baseURI}}var h;var f=null;d(i).closest(this.options.subjectSelector).each(function(){f=this;if(d(this).attr("about")!==g.options.attributeExistenceComparator){h=d(this).attr("about");return true}if(d(this).attr("src")!==g.options.attributeExistenceComparator){h=d(this).attr("src");return true}if(d(this).attr("typeof")!==g.options.attributeExistenceComparator){var k=d(this);if(k.data("vie-bnode")){h=k.data("vie-bnode");return true}h=g._generatebnodeId();k.data("vie-bnode",h);return true}if(d(this).get(0).nodeName==="HTML"){d("base",this).each(function(){h=d(this).attr("href")})}});if(!h){if(f===i){return g.getElementSubject(d(i).parent())}return undefined}if(typeof h==="object"){return h}if(h.indexOf("_:")===0){return h}if(h.indexOf("<")===0){return h}return"<"+h+">"},setElementSubject:function(g,f){if(d(f).attr("src")){return d(f).attr("src",g)}return d(f).attr("about",g)},getElementPredicate:function(g){var f;g=d(g);f=g.attr("property");if(!f){f=g.attr("rel")}return f},getElementBySubject:function(h,g){var f=this;return d(g).find(this.options.subjectSelector).add(d(g).filter(this.options.subjectSelector)).filter(function(){if(f.getElementSubject(d(this))!==h){return false}return true})},getElementByPredicate:function(g,i){var f=this;var h=this.getElementSubject(i);return d(i).find(this.options.predicateSelector).add(d(i).filter(this.options.predicateSelector)).filter(function(){var j=f.getElementPredicate(d(this));if(f.vie.namespaces.curie(j)!==f.vie.namespaces.curie(g)){return false}if(f.getElementSubject(this)!==h){return false}return true})},_readEntityPredicates:function(h,g,j){var f=this;var i={};this.findPredicateElements(h,g,true).each(function(){var l=d(this);var k=f.getElementPredicate(l);if(k===""){return}var m=f.readElementValue(k,l);if(m===null&&!j){return}i[k]=m});if(d(g).get(0).tagName!=="HTML"){d(g).parent("[rev]").each(function(){var k=d(this).attr("rev");if(!k){return}i[d(this).attr("rev")]=f.getElementSubject(this)})}return i},findSubjectElements:function(f){return d("[about]",f)},findPredicateElements:function(i,h,g){var f=this;return d(h).find(this.options.predicateSelector).add(d(h).filter(this.options.predicateSelector)).filter(function(){if(f.getElementSubject(this)!==i){return false}if(!g){if(!d(this).parents("[property]").length){return true}return false}return true})},parseElementValue:function(h,f){if(!f.attr("datatype")){return h}var g=this.vie.namespaces.uri(f.attr("datatype"));if(!this.datatypeReaders[g]){return h}return this.datatypeReaders[g](h)},generateElementValue:function(h,f){if(!f.attr("datatype")){return h}var g=this.vie.namespaces.uri(f.attr("datatype"));if(!this.datatypeWriters[g]){return h}return this.datatypeWriters[g](h)},readElementValue:function(g,i){var j=i.attr("content");if(j){return this.parseElementValue(j,i)}var l=i.attr("resource");if(l){return["<"+l+">"]}var h=i.attr("href");if(h&&i.attr("rel")===g){return["<"+h+">"]}if(i.attr("rel")){var k=[];var f=this;d(i).children(this.options.subjectSelector).each(function(){k.push(f.getElementSubject(this,true))});return k}return this.parseElementValue(i.html(),i)},writeElementValue:function(f,g,j){j=this.generateElementValue(j,g);if(b.isArray(j)&&j.length>0){j=j[0]}var h=g.attr("content");if(h){g.attr("content",j);return}var i=g.attr("resource");if(i){g.attr("resource",j)}g.html(j)},xmlns:function(g){var f;if(!g){if(typeof document==="undefined"){return{}}f=d(document)}else{f=d(g)}f=f.add(f.parents());var h={};f.each(function(k,n){if(n.attributes){for(k=0;k<n.attributes.length;k+=1){var j=n.attributes[k];if(/^xmlns(:(.+))?$/.test(j.nodeName)){var m=/^xmlns(:(.+))?$/.exec(j.nodeName)[2]||"";var l=j.nodeValue;if(m===""||l!==""){h[m]=j.nodeValue}}}}});return h}}})();(function(){c.prototype.StanbolService=function(f){var g={name:"stanbol",url:["http://dev.iks-project.eu/stanbolfull"],timeout:20000,namespaces:{semdeski:"http://www.semanticdesktop.org/ontologies/2007/01/19/nie#",semdeskf:"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#",skos:"http://www.w3.org/2004/02/skos/core#",foaf:"http://xmlns.com/foaf/0.1/",opengis:"http://www.opengis.net/gml/",dbpedia:"http://dbpedia.org/ontology/",dbprop:"http://dbpedia.org/property/",owl:"http://www.w3.org/2002/07/owl#",geonames:"http://www.geonames.org/ontology#",enhancer:"http://fise.iks-project.eu/ontology/",entityhub:"http://www.iks-project.eu/ontology/rick/model/",entityhub2:"http://www.iks-project.eu/ontology/rick/query/",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",dcterms:"http://purl.org/dc/terms/",schema:"http://schema.org/",geo:"http://www.w3.org/2003/01/geo/wgs84_pos#"},rules:[{left:["?subject a <http://fise.iks-project.eu/ontology/EntityAnnotation>","?subject enhancer:entity-type ?type","?subject enhancer:confidence ?confidence","?subject enhancer:entity-reference ?entity","?subject dcterms:relation ?relation","?relation a <http://fise.iks-project.eu/ontology/TextAnnotation>","?relation enhancer:selected-text ?selected-text","?relation enhancer:selection-context ?selection-context","?relation enhancer:start ?start","?relation enhancer:end ?end"],right:["?entity a ?type","?entity enhancer:hasTextAnnotation ?relation","?entity enhancer:hasEntityAnnotation ?subject"]}],enhancer:{chain:"default"},entityhub:{site:undefined}};this.options=d.extend(true,g,f?f:{});this.vie=null;this.name=this.options.name};c.prototype.StanbolService.prototype={init:function(){for(var f in this.options.namespaces){var g=this.options.namespaces[f];this.vie.namespaces.add(f,g)}this.rules=d.extend([],c.Util.transformationRules(this));this.rules=d.merge(this.rules,(this.options.rules)?this.options.rules:[]);this.connector=new this.vie.StanbolConnector(this.options);this.vie.types.addOrOverwrite("enhancer:EntityAnnotation",[]).inherit("owl:Thing");this.vie.types.addOrOverwrite("enhancer:TextAnnotation",[]).inherit("owl:Thing");this.vie.types.addOrOverwrite("enhancer:Enhancement",[]).inherit("owl:Thing")},analyze:function(m){var f=this;var i=m instanceof this.vie.Analyzable;if(!i){throw"Invalid Analyzable passed"}var j=m.options.element?m.options.element:d("body");var l=f._extractText(j);if(l.length>0){var k=function(n){b.defer(function(){var o=c.Util.rdf2Entities(f,n);m.resolve(o)})};var h=function(n){m.reject(n)};var g={chain:(m.options.chain)?m.options.chain:f.options.enhancer.chain};this.connector.analyze(l,k,h,g)}else{console.warn("No text found in element.");m.resolve([])}},find:function(l){var j=l instanceof this.vie.Findable;if(!j){throw"Invalid Findable passed"}var i=this;if(!l.options.term){console.info("StanbolConnector: No term to look for!");l.reject([])}var f=escape(l.options.term);var g=(typeof l.options.limit==="undefined")?20:l.options.limit;var h=(typeof l.options.offset==="undefined")?0:l.options.offset;var p=function(q){b.defer(function(){var r=c.Util.rdf2Entities(i,q);l.resolve(r)})};var m=function(q){l.reject(q)};l.options.site=(l.options.site)?l.options.site:i.options.entityhub.site;var n=this.vie;if(l.options.properties){var k=l.options.properties;l.options.ldPath=b(k).map(function(q){if(n.namespaces.isCurie(q)){return n.namespaces.uri(q)+";"}else{return q}}).join("")}if(l.options.field&&n.namespaces.isCurie(o)){var o=l.options.field;l.options.field=n.namespaces.uri(o)}this.connector.find(f,g,h,p,m,l.options)},load:function(l){var j=l instanceof this.vie.Loadable;if(!j){throw"Invalid Loadable passed"}var f=this;var g=l.options.entity;if(!g){console.warn("StanbolConnector: No entity to look for!");l.resolve([])}var k=function(m){b.defer(function(){var n=c.Util.rdf2Entities(f,m);l.resolve(n)})};var i=function(m){l.reject(m)};var h={site:(l.options.site)?l.options.site:f.options.entityhub.site,local:l.options.local};this.connector.load(g,k,i,h)},save:function(k){var j=k instanceof this.vie.Savable;if(!j){throw"Invalid Savable passed"}var f=this;var g=k.options.entity;if(!g){console.warn("StanbolConnector: No entity to save!");k.reject("StanbolConnector: No entity to save!")}var l=function(m){b.defer(function(){var n=c.Util.rdf2Entities(f,m);k.resolve(n)})};var i=function(m){k.reject(m)};var h={site:(k.options.site)?k.options.site:f.options.entityhub.site,local:k.options.local};this.connector.save(g,l,i,h)},_extractText:function(g){if(g.get(0)&&g.get(0).tagName&&(g.get(0).tagName=="TEXTAREA"||g.get(0).tagName=="INPUT"&&g.attr("type","text"))){return g.get(0).val()}else{var f=g.text().replace(/\s+/g," ").replace(/\0\b\n\r\f\t/g,"");return d.trim(f)}}};c.prototype.StanbolConnector=function(f){var g={url:["http://dev.iks-project.eu/stanbolfull"],timeout:20000,enhancer:{urlPostfix:"/enhancer",chain:"default"},entityhub:{site:undefined,urlPostfix:"/entityhub",local:false},sparql:{urlPostfix:"/sparql"},contenthub:{urlPostfix:"/contenthub",index:"contenthub"},ontonet:{urlPostfix:"/ontonet"},factstore:{urlPostfix:"/factstore"},rules:{urlPostfix:"/rules"},cmsadapter:{urlPostfix:"/cmsadapter"}};this.options=d.extend(true,g,f?f:{});this.options.url=(b.isArray(this.options.url))?this.options.url:[this.options.url];this._init();this.baseUrl=(b.isArray(f.url))?f.url:[f.url]};c.prototype.StanbolConnector.prototype={_init:function(){var f=this;d.ajaxSetup({converters:{"text application/rdf+json":function(g){return JSON.parse(g)}},timeout:f.options.timeout});return this},_iterate:function(f){if(!f){return}if(f.urlIndex>=this.options.url.length){f.error.call(this,"Could not connect to the given Stanbol endpoints! Please check for their setup!");return}var g=function(i,h){return function(){console.log("Stanbol connection error",arguments);h.urlIndex=h.urlIndex+1;i._iterate(h)}}(this,f);if(typeof exports!=="undefined"&&typeof process!=="undefined"){return f.methodNode.call(this,f.url.call(this,f.urlIndex,f.args.options),f.args,f.success,g)}return f.method.call(this,f.url.call(this,f.urlIndex,f.args.options),f.args,f.success,g)},analyze:function(j,i,h,g){g=(g)?g:{};var f=this;f._iterate({method:f._analyze,methodNode:f._analyzeNode,url:function(k,n){var m=(n.chain)?n.chain:this.options.enhancer.chain;var l=this.options.url[k].replace(/\/$/,"");l+=this.options.enhancer.urlPostfix+"/chain/"+m.replace(/\/$/,"");return l},args:{text:j,format:g.format||"application/rdf+json",options:g},success:i,error:h,urlIndex:0})},_analyze:function(h,g,i,f){d.ajax({success:i,error:f,url:h,type:"POST",data:g.text,dataType:g.format,contentType:"text/plain",accepts:{"application/rdf+json":"application/rdf+json"}})},_analyzeNode:function(h,g,k,f){var j=require("request");var i=j({method:"POST",uri:h,body:g.text,headers:{Accept:g.format,"Content-Type":"text/plain"}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()},load:function(i,j,h,g){var f=this;g=(g)?g:{};g.uri=i.replace(/^</,"").replace(/>$/,"");f._iterate({method:f._load,methodNode:f._loadNode,success:j,error:h,url:function(k,o){var m=(o.site)?o.site:this.options.entityhub.site;m=(m)?"/"+m:"s";var n=o.local;var l=this.options.url[k].replace(/\/$/,"")+this.options.entityhub.urlPostfix;if(n){l+="/entity?id="+escape(o.uri)}else{l+="/site"+m+"/entity?id="+escape(o.uri)}return l},args:{format:g.format||"application/rdf+json",options:g},urlIndex:0})},_load:function(h,g,i,f){d.ajax({success:i,error:f,url:h,type:"GET",dataType:g.format,contentType:"text/plain",accepts:{"application/rdf+json":"application/rdf+json"}})},_loadNode:function(h,g,k,f){var j=require("request");var i=j({method:"GET",uri:h,body:g.text,headers:{Accept:g.format}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()},find:function(j,g,l,k,i,h){h=(h)?h:{};var f=this;if(!j||j===""){i("No term given!");return}l=(l)?l:0;g=(g)?g:10;f._iterate({method:f._find,methodNode:f._findNode,success:k,error:i,url:function(m,q){var o=(q.site)?q.site:this.options.entityhub.site;o=(o)?"/"+o:"s";var p=q.local;var n=this.options.url[m].replace(/\/$/,"")+this.options.entityhub.urlPostfix;if(p){n+="/sites/find"}else{n+="/site"+o+"/find"}return n},args:{term:j,offset:l,limit:g,format:h.format||"application/rdf+json",options:h},urlIndex:0})},_find:function(h,g,i,f){d.ajax({success:i,error:f,url:h,type:"POST",data:"name="+g.term+"&limit="+g.limit+"&offset="+g.offset,dataType:g.format,contentType:"application/x-www-form-urlencoded",accepts:{"application/rdf+json":"application/rdf+json"}})},_findNode:function(h,g,k,f){var j=require("request");var i=j({method:"POST",uri:h,body:"name="+g.term+"&limit="+g.limit+"&offset="+g.offset,headers:{Accept:g.format}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()},lookup:function(i,j,h,g){g=(g)?g:{};var f=this;i=i.replace(/^</,"").replace(/>$/,"");g.uri=i;g.create=(g.create)?g.create:false;f._iterate({method:f._lookup,methodNode:f._lookupNode,success:j,error:h,url:function(k,m){var l=this.options.url[k].replace(/\/$/,"")+this.options.entityhub.urlPostfix;l+="/lookup?id="+escape(m.uri)+"&create="+m.create;return l},args:{format:g.format||"application/rdf+json",options:g},urlIndex:0})},_lookup:function(h,g,i,f){d.ajax({success:i,error:f,url:h,type:"GET",dataType:g.format,contentType:"text/plain",accepts:{"application/rdf+json":"application/rdf+json"}})},_lookupNode:function(h,g,k,f){var j=require("request");var i=j({method:"GET",uri:h,body:g.text,headers:{Accept:g.format}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()},referenced:function(j,h,g){g=(g)?g:{};var f=this;var i=function(o){if(!b.isArray(o)){o=JSON.parse(o)}var m=[];for(var n=0,k=o.length;n<k;n++){m.push(o[n].replace(/.+\/(.+?)\/?$/,"$1"))}return j(m)};f._iterate({method:f._referenced,methodNode:f._referencedNode,success:i,error:h,url:function(k,m){var l=this.options.url[k].replace(/\/$/,"");l+=this.options.entityhub.urlPostfix+"/sites/referenced";return l},args:{options:g},urlIndex:0})},_referenced:function(h,g,i,f){d.ajax({success:i,error:f,url:h,type:"GET",accepts:{"application/rdf+json":"application/rdf+json"}})},_referencedNode:function(h,g,k,f){var j=require("request");var i=j({method:"GET",uri:h,headers:{Accept:g.format}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()},sparql:function(i,j,h,g){g=(g)?g:{};var f=this;f._iterate({method:f._sparql,methodNode:f._sparqlNode,success:j,error:h,url:function(k,m){var l=this.options.url[k].replace(/\/$/,"");l+=this.options.sparql.urlPostfix.replace(/\/$/,"");return l},args:{query:i,options:g},urlIndex:0})},_sparql:function(h,g,i,f){d.ajax({success:i,error:f,url:h,type:"POST",data:"query="+g.query,contentType:"application/x-www-form-urlencoded"})},_sparqlNode:function(h,g,k,f){var j=require("request");var i=j({method:"POST",uri:h,body:JSON.stringify({query:g.query}),headers:{Accept:g.format}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()},ldpath:function(j,i,l,h,g){g=(g)?g:{};var f=this;i=(b.isArray(i))?i:[i];var k="";for(var m=0;m<i.length;m++){k+="&context="+i[m]}f._iterate({method:f._ldpath,methodNode:f._ldpathNode,success:l,error:h,url:function(n,r){var p=(r.site)?r.site:this.options.entityhub.site;p=(p)?"/"+p:"s";var q=r.local;var o=this.options.url[n].replace(/\/$/,"")+this.options.entityhub.urlPostfix;if(!q){o+="/site"+p}o+="/ldpath";return o},args:{ldpath:j,context:k,format:g.format||"application/rdf+json",options:g},urlIndex:0})},_ldpath:function(h,g,i,f){d.ajax({success:i,error:f,url:h,type:"POST",data:"ldpath="+g.ldpath+g.context,contentType:"application/x-www-form-urlencoded",dataType:g.format,accepts:{"application/rdf+json":"application/rdf+json"}})},_ldpathNode:function(h,g,k,f){var j=require("request");var i=j({method:"POST",uri:h,body:"ldpath="+g.ldpath+g.context,headers:{Accept:g.format}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()},uploadContent:function(i,j,h,g){g=(g)?g:{};var f=this;f._iterate({method:f._uploadContent,methodNode:f._uploadContentNode,success:j,error:h,url:function(k,n){var m=this.options.url[k].replace(/\/$/,"");m+=this.options.contenthub.urlPostfix.replace(/\/$/,"");var l=(n.index)?n.index:this.options.contenthub.index;m+="/"+l.replace(/\/$/,"");m+="/store";return m},args:{content:i,options:g},urlIndex:0})},_uploadContent:function(h,g,i,f){d.ajax({success:i,error:f,url:h,type:"POST",data:g.content,contentType:"text/plain"})},_uploadContentNode:function(h,g,k,f){var j=require("request");var i=j({method:"POST",uri:h,body:g.content,headers:{Accept:"application/rdf+xml","Content-Type":"text/plain"}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()},createFactSchema:function(i,j,k,h,g){g=(g)?g:{};var f=this;g.url=i;f._iterate({method:f._createFactSchema,methodNode:f._createFactSchemaNode,success:k,error:h,url:function(l,n){var m=this.options.url[l].replace(/\/$/,"");m+=this.options.factstore.urlPostfix.replace(/\/$/,"");m+="/facts/"+escape(n.url);return m},args:{url:i,schema:j,options:g},urlIndex:0})},_createFactSchema:function(h,g,i,f){d.ajax({success:i,error:f,url:h,type:"PUT",data:g.schema,contentType:"application/json",dataType:"application/json"})},_createFactSchemaNode:function(h,g,k,f){var j=require("request");var i=j({method:"PUT",uri:h,body:g.schema,headers:{Accept:"application/json","Content-Type":"application/json"}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()},createFact:function(i,j,h,g){g=(g)?g:{};var f=this;f._iterate({method:f._createFact,methodNode:f._createFactNode,success:j,error:h,url:function(k,m){var l=this.options.url[k].replace(/\/$/,"");l+=this.options.factstore.urlPostfix.replace(/\/$/,"");l+="/facts";return l},args:{fact:i,options:g},urlIndex:0})},_createFact:function(h,g,i,f){d.ajax({success:i,error:f,url:h,type:"POST",data:g.fact,contentType:"application/json",dataType:"application/json"})},_createFactNode:function(h,g,k,f){var j=require("request");var i=j({method:"POST",uri:h,body:g.fact,headers:{Accept:"application/json","Content-Type":"application/json"}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()},queryFact:function(i,j,h,g){g=(g)?g:{};var f=this;f._iterate({method:f._queryFact,methodNode:f._queryFactNode,success:j,error:h,url:function(k,m){var l=this.options.url[k].replace(/\/$/,"");l+=this.options.factstore.urlPostfix.replace(/\/$/,"");l+="/query";return l},args:{query:i,options:g},urlIndex:0})},_queryFact:function(h,g,i,f){d.ajax({success:i,error:f,url:h,type:"POST",data:g.query,contentType:"application/json",dataType:"application/json"})},_queryFactNode:function(h,g,k,f){var j=require("request");var i=j({method:"POST",uri:h,body:g.query,headers:{Accept:"application/json","Content-Type":"application/json"}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()}}})();(function(){c.prototype.ZemantaService=function(f){var g={name:"zemanta",url:["http://api.zemanta.com/services/rest/0.0/"],timeout:20000,namespaces:{zemanta:"http://s.zemanta.com/ns#"},rules:[{left:["?subject a zemanta:Recognition","?subject zemanta:object ?object","?object owl:sameAs ?entity"],right:["?entity zemanta:hasEntityAnnotation ?subject"]}],api_key:undefined};this.options=d.extend(true,g,f?f:{});this.vie=null;this.name=this.options.name;d.ajaxSetup({converters:{"text application/rdf+json":function(h){return JSON.parse(h)}},timeout:this.options.timeout})};c.prototype.ZemantaService.prototype={init:function(){for(var f in this.options.namespaces){var g=this.options.namespaces[f];this.vie.namespaces.add(f,g)}this.rules=d.extend([],c.Util.transformationRules(this));this.rules=d.merge(this.rules,(this.options.rules)?this.options.rules:[]);this.connector=new this.vie.ZemantaConnector(this.options);this.vie.types.addOrOverwrite("zemanta:Recognition",[]).inherit("owl:Thing")},analyze:function(m){var f=this;var i=m instanceof this.vie.Analyzable;if(!i){throw"Invalid Analyzable passed"}var j=m.options.element?m.options.element:d("body");var l=f._extractText(j);if(l.length>0){var k=function(n){b.defer(function(){var o=c.Util.rdf2Entities(f,n);m.resolve(o)})};var h=function(n){m.reject(n)};var g={};this.connector.analyze(l,k,h,g)}else{console.warn("No text found in element.");m.resolve([])}},_extractText:function(f){return d(f).wrap("<div>").parent().html()}};c.prototype.ZemantaConnector=function(f){var g={url:["http://api.zemanta.com/services/rest/0.0/"],timeout:20000,api_key:undefined};this.options=d.extend(true,g,f?f:{});this.options.url=(b.isArray(this.options.url))?this.options.url:[this.options.url];this._init();this.baseUrl=(b.isArray(f.url))?f.url:[f.url]};c.prototype.ZemantaConnector.prototype={_init:function(){var f=this;d.ajaxSetup({converters:{"text application/rdf+json":function(g){return JSON.parse(g)}},timeout:f.options.timeout});return this},_iterate:function(f){if(!f){return}if(f.urlIndex>=this.options.url.length){f.error.call(this,"Could not connect to the given Zemanta endpoints! Please check for their setup!");return}var g=function(i,h){return function(){console.log("Zemanta connection error",arguments);h.urlIndex=h.urlIndex+1;i._iterate(h)}}(this,f);if(typeof exports!=="undefined"&&typeof process!=="undefined"){return f.methodNode.call(this,f.url.call(this,f.urlIndex,f.args.options),f.args,f.success,g)}return f.method.call(this,f.url.call(this,f.urlIndex,f.args.options),f.args,f.success,g)},analyze:function(j,i,h,g){g=(g)?g:{};var f=this;f._iterate({method:f._analyze,methodNode:f._analyzeNode,success:i,error:h,url:function(k,m){var l=this.options.url[k].replace(/\/$/,"");return l},args:{text:j,format:g.format||"rdfxml",options:g},urlIndex:0})},_analyze:function(h,g,i,f){d.ajax({success:function(k,j,m){var l=m.responseText.replace(/<z:signature>.*?<\/z:signature>/,"");i(l)},error:f,url:h,type:"POST",dataType:"xml",data:{method:"zemanta.suggest",text:g.text,format:g.format,api_key:this.options.api_key,return_rdf_links:g.options.return_rdf_links},contentType:"text/plain",accepts:{"application/rdf+json":"application/rdf+json"}})},_analyzeNode:function(h,g,k,f){var j=require("request");var i=j({method:"POST",uri:h,body:g.text,headers:{Accept:g.format,"Content-Type":"text/plain"}},function(n,m,l){try{k({results:JSON.parse(l)})}catch(o){f(o)}});i.end()}}})();if(!c.prototype.view){c.prototype.view={}}c.prototype.view.Collection=e.View.extend({initialize:function(){this.templates=this.options.templates;this.service=this.options.service;if(!this.service){throw"No RDFa service provided to the Collection View"}this.owner=this.options.owner;this.definition=this.options.definition;this.entityViews={};b.bindAll(this,"addItem","removeItem","refreshItems");this.collection.on("add",this.addItem);this.collection.on("remove",this.removeItem);this.collection.on("reset",this.refreshItems);this.collection.each(function(f){this.registerItem(f,this.collection)},this)},canAdd:function(f){if(b.isEmpty(this.templates)){return false}if(f&&!this.templates[f]){return false}return this.collection.canAdd(f)},addItem:function(g,j){if(j!==this.collection){return}var h=g.get("@type");var i;if(b.isArray(h)){b.each(h,function(k){if(this.canAdd(k.id)){i=k.id}},this)}else{if(this.canAdd(h.id)){i=h.id}}if(!i){return}var f=this;this.templates[i](g,function(l){var k=f.service._registerEntityView(g,l,true);var m=k.render().$el;if(g.id){f.service.setElementSubject(g.getSubjectUri(),m)}var o=j.indexOf(g);if(o===0){f.$el.prepend(m)}else{var p=j.at(o-1);var n=f.entityViews[p.cid];if(n){n.$el.after(m)}else{f.$el.append(m)}}f.findReverseRelations(g,m);f.trigger("add",k);f.entityViews[g.cid]=k;m.show()},this)},findReverseRelations:function(g,h){var f=this.service;h.parent("[rev]").each(function(){var i=d(this).attr("rev");var j={};j[i]=new f.vie.Collection([],{vie:f.vie,predicate:i});var k=f.vie.entities.get(f.getElementSubject(this));if(k){j[i].addOrUpdate(k)}g.set(j)})},registerItem:function(g,i){var h=this.service.getElementBySubject(g.id,this.el);if(!h){return}var f=this.service._registerEntityView(g,h);this.entityViews[g.cid]=f},removeItem:function(f){if(!this.entityViews[f.cid]){return}this.trigger("remove",this.entityViews[f.cid]);d(this.entityViews[f.cid].el).remove();delete (this.entityViews[f.cid])},refreshItems:function(f){b.each(this.entityViews,function(g,h){d(g.el).remove()});this.entityViews={};f.forEach(function(g){this.addItem(g,f)},this)}});if(!c.prototype.view){c.prototype.view={}}c.prototype.view.Entity=e.View.extend({initialize:function(f){this.service=f.service?f.service:"rdfa";this.vie=f.vie;b.bindAll(this,"render","renderAbout");this.model.on("change",this.render);this.model.on("change:@subject",this.renderAbout)},render:function(){this.vie.save({element:this.el,entity:this.model}).to(this.service).execute();return this},renderAbout:function(){this.vie.service(this.service).setElementSubject(this.model.getSubjectUri(),this.el)}});var a=this;(function(f){if(a.XDomainRequest){f.ajaxTransport(function(h){if(h.crossDomain&&h.async){if(h.timeout){h.xdrTimeout=h.timeout;delete h.timeout}var g;return{send:function(j,i){function l(m,p,o,n){g.onload=g.onerror=g.ontimeout=f.noop;g=undefined;i(m,p,o,n)}g=new XDomainRequest();if(h.dataType){var k="header_Accept="+encodeURIComponent(h.dataType);h.url=h.url+(h.url.indexOf("?")===-1?"?":"&")+k}g.open(h.type,h.url);g.onload=function(n,m){l(200,"OK",{text:g.responseText},"Content-Type: "+g.contentType)};g.onerror=function(m){console.error(JSON.stringify(m));l(404,"Not Found")};if(h.xdrTimeout){g.ontimeout=function(){l(0,"timeout")};g.timeout=h.xdrTimeout}g.send((h.hasContent&&h.data)||null)},abort:function(){if(g){g.onerror=f.noop();g.abort()}}}}})}})(d)})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment