diff --git a/public/bin/base.min.js b/public/bin/base.min.js index 38bf8418..6ddeee88 100644 --- a/public/bin/base.min.js +++ b/public/bin/base.min.js @@ -1,50 +1,50 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;othis.length)at=this.length;if(at<0)at+=this.length+1;var set=[];var toAdd=[];var toMerge=[];var toRemove=[];var modelMap={};var add=options.add;var merge=options.merge;var remove=options.remove;var sort=false;var sortable=this.comparator&&at==null&&options.sort!==false;var sortAttr=_.isString(this.comparator)?this.comparator:null;var model,i;for(i=0;i7);this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(rootStripper,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var rootPath=this.root.slice(0,-1)||"/";this.location.replace(rootPath+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var body=document.body;var iWindow=body.insertBefore(this.iframe,body.firstChild).contentWindow;iWindow.document.open();iWindow.document.close();iWindow.location.hash="#"+this.fragment}var addEventListener=window.addEventListener||function(eventName,listener){return attachEvent("on"+eventName,listener)};if(this._usePushState){addEventListener("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){addEventListener("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var removeEventListener=window.removeEventListener||function(eventName,listener){return detachEvent("on"+eventName,listener)};if(this._usePushState){removeEventListener("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){removeEventListener("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);History.started=false},route:function(route,callback){this.handlers.unshift({route:route,callback:callback})},checkUrl:function(e){var current=this.getFragment();if(current===this.fragment&&this.iframe){current=this.getHash(this.iframe.contentWindow)}if(current===this.fragment)return false;if(this.iframe)this.navigate(current);this.loadUrl()},loadUrl:function(fragment){if(!this.matchRoot())return false;fragment=this.fragment=this.getFragment(fragment);return _.some(this.handlers,function(handler){if(handler.route.test(fragment)){handler.callback(fragment);return true}})},navigate:function(fragment,options){if(!History.started)return false;if(!options||options===true)options={trigger:!!options};fragment=this.getFragment(fragment||"");var rootPath=this.root;if(fragment===""||fragment.charAt(0)==="?"){rootPath=rootPath.slice(0,-1)||"/"}var url=rootPath+fragment;fragment=this.decodeFragment(fragment.replace(pathStripper,""));if(this.fragment===fragment)return;this.fragment=fragment;if(this._usePushState){this.history[options.replace?"replaceState":"pushState"]({},document.title,url)}else if(this._wantsHashChange){this._updateHash(this.location,fragment,options.replace);if(this.iframe&&fragment!==this.getHash(this.iframe.contentWindow)){var iWindow=this.iframe.contentWindow;if(!options.replace){iWindow.document.open();iWindow.document.close()}this._updateHash(iWindow.location,fragment,options.replace)}}else{return this.location.assign(url)}if(options.trigger)return this.loadUrl(fragment)},_updateHash:function(location,fragment,replace){if(replace){var href=location.href.replace(/(javascript:|#).*$/,"");location.replace(href+"#"+fragment)}else{location.hash="#"+fragment}}});Backbone.history=new History;var extend=function(protoProps,staticProps){var parent=this;var child;if(protoProps&&_.has(protoProps,"constructor")){child=protoProps.constructor}else{child=function(){return parent.apply(this,arguments)}}_.extend(child,parent,staticProps);child.prototype=_.create(parent.prototype,protoProps);child.prototype.constructor=child;child.__super__=parent.prototype;return child};Model.extend=Collection.extend=Router.extend=View.extend=History.extend=extend;var urlError=function(){throw new Error('A "url" property or function must be specified'); -};var wrapError=function(model,options){var error=options.error;options.error=function(resp){if(error)error.call(options.context,model,resp,options);model.trigger("error",model,resp,options)}};return Backbone})}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{jquery:139,underscore:140}],2:[function(require,module,exports){(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof exports==="object"){factory(require("jquery"))}else{factory(jQuery)}})(function($){var defaults={element:"body",position:null,type:"info",allow_dismiss:true,newest_on_top:false,showProgressbar:false,placement:{from:"top",align:"right"},offset:20,spacing:10,z_index:1031,delay:5e3,timer:1e3,url_target:"_blank",mouse_over:null,animate:{enter:"animated fadeInDown",exit:"animated fadeOutUp"},onShow:null,onShown:null,onClose:null,onClosed:null,icon_type:"class",template:''};String.format=function(){var str=arguments[0];for(var i=1;i .progress-bar').removeClass("progress-bar-"+self.settings.type);self.settings.type=commands[command];this.$ele.addClass("alert-"+commands[command]).find('[data-notify="progressbar"] > .progress-bar').addClass("progress-bar-"+commands[command]);break;case"icon":var $icon=this.$ele.find('[data-notify="icon"]');if(self.settings.icon_type.toLowerCase()=="class"){$icon.removeClass(self.settings.content.icon).addClass(commands[command])}else{if(!$icon.is("img")){$icon.find("img")}$icon.attr("src",commands[command])}break;case"progress":var newDelay=self.settings.delay-self.settings.delay*(commands[command]/100);this.$ele.data("notify-delay",newDelay);this.$ele.find('[data-notify="progressbar"] > div').attr("aria-valuenow",commands[command]).css("width",commands[command]+"%");break;case"url":this.$ele.find('[data-notify="url"]').attr("href",commands[command]);break;case"target":this.$ele.find('[data-notify="url"]').attr("target",commands[command]);break;default:this.$ele.find('[data-notify="'+command+'"]').html(commands[command])}}var posX=this.$ele.outerHeight()+parseInt(self.settings.spacing)+parseInt(self.settings.offset.y);self.reposition(posX)},close:function(){self.close()}}},buildNotify:function(){var content=this.settings.content;this.$ele=$(String.format(this.settings.template,this.settings.type,content.title,content.message,content.url,content.target));this.$ele.attr("data-notify-position",this.settings.placement.from+"-"+this.settings.placement.align);if(!this.settings.allow_dismiss){this.$ele.find('[data-notify="dismiss"]').css("display","none")}if(this.settings.delay<=0&&!this.settings.showProgressbar||!this.settings.showProgressbar){this.$ele.find('[data-notify="progressbar"]').remove()}},setIcon:function(){if(this.settings.icon_type.toLowerCase()=="class"){this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon)}else{if(this.$ele.find('[data-notify="icon"]').is("img")){this.$ele.find('[data-notify="icon"]').attr("src",this.settings.content.icon)}else{this.$ele.find('[data-notify="icon"]').append('Notify Icon')}}},styleDismiss:function(){this.$ele.find('[data-notify="dismiss"]').css({position:"absolute",right:"10px",top:"5px",zIndex:this.settings.z_index+2})},styleURL:function(){this.$ele.find('[data-notify="url"]').css({backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)",height:"100%",left:"0px",position:"absolute",top:"0px",width:"100%",zIndex:this.settings.z_index+1})},placement:function(){var self=this,offsetAmt=this.settings.offset.y,css={display:"inline-block",margin:"0px auto",position:this.settings.position?this.settings.position:this.settings.element==="body"?"fixed":"absolute",transition:"all .5s ease-in-out",zIndex:this.settings.z_index},hasAnimation=false,settings=this.settings;$('[data-notify-position="'+this.settings.placement.from+"-"+this.settings.placement.align+'"]:not([data-closing="true"])').each(function(){return offsetAmt=Math.max(offsetAmt,parseInt($(this).css(settings.placement.from))+parseInt($(this).outerHeight())+parseInt(settings.spacing))});if(this.settings.newest_on_top==true){offsetAmt=this.settings.offset.y}css[this.settings.placement.from]=offsetAmt+"px";switch(this.settings.placement.align){case"left":case"right":css[this.settings.placement.align]=this.settings.offset.x+"px";break;case"center":css.left=0;css.right=0;break}this.$ele.css(css).addClass(this.settings.animate.enter);$.each(Array("webkit-","moz-","o-","ms-",""),function(index,prefix){self.$ele[0].style[prefix+"AnimationIterationCount"]=1});$(this.settings.element).append(this.$ele);if(this.settings.newest_on_top==true){offsetAmt=parseInt(offsetAmt)+parseInt(this.settings.spacing)+this.$ele.outerHeight();this.reposition(offsetAmt)}if($.isFunction(self.settings.onShow)){self.settings.onShow.call(this.$ele)}this.$ele.one(this.animations.start,function(event){hasAnimation=true}).one(this.animations.end,function(event){if($.isFunction(self.settings.onShown)){self.settings.onShown.call(this)}});setTimeout(function(){if(!hasAnimation){if($.isFunction(self.settings.onShown)){self.settings.onShown.call(this)}}},600)},bind:function(){var self=this;this.$ele.find('[data-notify="dismiss"]').on("click",function(){self.close()});this.$ele.mouseover(function(e){$(this).data("data-hover","true")}).mouseout(function(e){$(this).data("data-hover","false")});this.$ele.data("data-hover","false");if(this.settings.delay>0){self.$ele.data("notify-delay",self.settings.delay);var timer=setInterval(function(){var delay=parseInt(self.$ele.data("notify-delay"))-self.settings.timer;if(self.$ele.data("data-hover")==="false"&&self.settings.mouse_over=="pause"||self.settings.mouse_over!="pause"){var percent=(self.settings.delay-delay)/self.settings.delay*100;self.$ele.data("notify-delay",delay);self.$ele.find('[data-notify="progressbar"] > div').attr("aria-valuenow",percent).css("width",percent+"%")}if(delay<=-self.settings.timer){clearInterval(timer);self.close()}},self.settings.timer)}},close:function(){var self=this,$successors=null,posX=parseInt(this.$ele.css(this.settings.placement.from)),hasAnimation=false;this.$ele.data("closing","true").addClass(this.settings.animate.exit);self.reposition(posX);if($.isFunction(self.settings.onClose)){self.settings.onClose.call(this.$ele)}this.$ele.one(this.animations.start,function(event){hasAnimation=true}).one(this.animations.end,function(event){$(this).remove();if($.isFunction(self.settings.onClosed)){self.settings.onClosed.call(this)}});setTimeout(function(){if(!hasAnimation){self.$ele.remove();if(self.settings.onClosed){self.settings.onClosed(self.$ele)}}},600)},reposition:function(posX){var self=this,notifies='[data-notify-position="'+this.settings.placement.from+"-"+this.settings.placement.align+'"]:not([data-closing="true"])',$elements=this.$ele.nextAll(notifies);if(this.settings.newest_on_top==true){$elements=this.$ele.prevAll(notifies)}$elements.each(function(){$(this).css(self.settings.placement.from,posX);posX=parseInt(posX)+parseInt(self.settings.spacing)+$(this).outerHeight()})}});$.notify=function(content,options){var plugin=new Notify(this,content,options);return plugin.notify};$.notifyDefaults=function(options){defaults=$.extend(true,{},defaults,options);return defaults};$.notifyClose=function(command){if(typeof command==="undefined"||command=="all"){$("[data-notify]").find('[data-notify="dismiss"]').trigger("click")}else{$('[data-notify-position="'+command+'"]').find('[data-notify="dismiss"]').trigger("click")}}})},{jquery:139}],3:[function(require,module,exports){(function(root,factory){if(typeof define==="function"&&define.amd){define(["jquery"],function(a0){return factory(a0)})}else if(typeof module==="object"&&module.exports){module.exports=factory(require("jquery"))}else{factory(root["jQuery"])}})(this,function(jQuery){(function($){"use strict";if(!String.prototype.includes){(function(){"use strict";var toString={}.toString;var defineProperty=function(){try{var object={};var $defineProperty=Object.defineProperty;var result=$defineProperty(object,object,object)&&$defineProperty}catch(error){}return result}();var indexOf="".indexOf;var includes=function(search){if(this==null){throw new TypeError}var string=String(this);if(search&&toString.call(search)=="[object RegExp]"){throw new TypeError}var stringLength=string.length;var searchString=String(search);var searchLength=searchString.length;var position=arguments.length>1?arguments[1]:undefined;var pos=position?Number(position):0;if(pos!=pos){pos=0}var start=Math.min(Math.max(pos,0),stringLength);if(searchLength+start>stringLength){return false}return indexOf.call(string,searchString,pos)!=-1};if(defineProperty){defineProperty(String.prototype,"includes",{value:includes,configurable:true,writable:true})}else{String.prototype.includes=includes}})()}if(!String.prototype.startsWith){(function(){"use strict";var defineProperty=function(){try{var object={};var $defineProperty=Object.defineProperty;var result=$defineProperty(object,object,object)&&$defineProperty}catch(error){}return result}();var toString={}.toString;var startsWith=function(search){if(this==null){throw new TypeError}var string=String(this);if(search&&toString.call(search)=="[object RegExp]"){throw new TypeError}var stringLength=string.length;var searchString=String(search);var searchLength=searchString.length;var position=arguments.length>1?arguments[1]:undefined;var pos=position?Number(position):0;if(pos!=pos){pos=0}var start=Math.min(Math.max(pos,0),stringLength);if(searchLength+start>stringLength){return false}var index=-1;while(++index":">",'"':""","'":"'","`":"`"};var unescapeMap={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"};var createEscaper=function(map){var escaper=function(match){return map[match]};var source="(?:"+Object.keys(map).join("|")+")";var testRegexp=RegExp(source);var replaceRegexp=RegExp(source,"g");return function(string){string=string==null?"":""+string;return testRegexp.test(string)?string.replace(replaceRegexp,escaper):string}};var htmlEscape=createEscaper(escapeMap);var htmlUnescape=createEscaper(unescapeMap);var Selectpicker=function(element,options){if(!valHooks.useDefault){$.valHooks.select.set=valHooks._set;valHooks.useDefault=true}this.$element=$(element);this.$newElement=null;this.$button=null;this.$menu=null;this.$lis=null;this.options=options;if(this.options.title===null){this.options.title=this.$element.attr("title")}var winPad=this.options.windowPadding;if(typeof winPad==="number"){this.options.windowPadding=[winPad,winPad,winPad,winPad]}this.val=Selectpicker.prototype.val;this.render=Selectpicker.prototype.render;this.refresh=Selectpicker.prototype.refresh;this.setStyle=Selectpicker.prototype.setStyle;this.selectAll=Selectpicker.prototype.selectAll;this.deselectAll=Selectpicker.prototype.deselectAll;this.destroy=Selectpicker.prototype.destroy;this.remove=Selectpicker.prototype.remove;this.show=Selectpicker.prototype.show;this.hide=Selectpicker.prototype.hide;this.init()};Selectpicker.VERSION="1.12.2";Selectpicker.DEFAULTS={noneSelectedText:"Nothing selected",noneResultsText:"No results matched {0}",countSelectedText:function(numSelected,numTotal){return numSelected==1?"{0} item selected":"{0} items selected"},maxOptionsText:function(numAll,numGroup){return[numAll==1?"Limit reached ({n} item max)":"Limit reached ({n} items max)",numGroup==1?"Group limit reached ({n} item max)":"Group limit reached ({n} items max)"]},selectAllText:"Select All",deselectAllText:"Deselect All",doneButton:false,doneButtonText:"Close",multipleSeparator:", ",styleBase:"btn",style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",width:false,container:false,hideDisabled:false,showSubtext:false,showIcon:true,showContent:true,dropupAuto:true,header:false,liveSearch:false,liveSearchPlaceholder:null,liveSearchNormalize:false,liveSearchStyle:"contains",actionsBox:false,iconBase:"glyphicon",tickIcon:"glyphicon-ok",showTick:false,template:{caret:''},maxOptions:false,mobile:false,selectOnTab:false,dropdownAlignRight:false,windowPadding:0};Selectpicker.prototype={constructor:Selectpicker,init:function(){var that=this,id=this.$element.attr("id");this.$element.addClass("bs-select-hidden");this.liObj={};this.multiple=this.$element.prop("multiple");this.autofocus=this.$element.prop("autofocus");this.$newElement=this.createView();this.$element.after(this.$newElement).appendTo(this.$newElement);this.$button=this.$newElement.children("button");this.$menu=this.$newElement.children(".dropdown-menu");this.$menuInner=this.$menu.children(".inner");this.$searchbox=this.$menu.find("input");this.$element.removeClass("bs-select-hidden");if(this.options.dropdownAlignRight===true)this.$menu.addClass("dropdown-menu-right");if(typeof id!=="undefined"){this.$button.attr("data-id",id);$('label[for="'+id+'"]').click(function(e){e.preventDefault();that.$button.focus()})}this.checkDisabled();this.clickListener();if(this.options.liveSearch)this.liveSearchListener();this.render();this.setStyle();this.setWidth();if(this.options.container)this.selectPosition();this.$menu.data("this",this);this.$newElement.data("this",this);if(this.options.mobile)this.mobile();this.$newElement.on({"hide.bs.dropdown":function(e){that.$menuInner.attr("aria-expanded",false);that.$element.trigger("hide.bs.select",e)},"hidden.bs.dropdown":function(e){that.$element.trigger("hidden.bs.select",e)},"show.bs.dropdown":function(e){that.$menuInner.attr("aria-expanded",true);that.$element.trigger("show.bs.select",e)},"shown.bs.dropdown":function(e){that.$element.trigger("shown.bs.select",e)}});if(that.$element[0].hasAttribute("required")){this.$element.on("invalid",function(){that.$button.addClass("bs-invalid").focus();that.$element.on({"focus.bs.select":function(){that.$button.focus();that.$element.off("focus.bs.select")},"shown.bs.select":function(){that.$element.val(that.$element.val()).off("shown.bs.select")},"rendered.bs.select":function(){if(this.validity.valid)that.$button.removeClass("bs-invalid");that.$element.off("rendered.bs.select")}})})}setTimeout(function(){that.$element.trigger("loaded.bs.select")})},createDropdown:function(){var showTick=this.multiple||this.options.showTick?" show-tick":"",inputGroup=this.$element.parent().hasClass("input-group")?" input-group-btn":"",autofocus=this.autofocus?" autofocus":"";var header=this.options.header?'
'+this.options.header+"
":"";var searchbox=this.options.liveSearch?'":"";var actionsbox=this.multiple&&this.options.actionsBox?'
'+'
'+'"+'"+"
"+"
":"";var donebutton=this.multiple&&this.options.doneButton?'
'+'
'+'"+"
"+"
":"";var drop='
'+'"+'"+"
";return $(drop)},createView:function(){var $drop=this.createDropdown(),li=this.createLi();$drop.find("ul")[0].innerHTML=li;return $drop},reloadLi:function(){var li=this.createLi();this.$menuInner[0].innerHTML=li},createLi:function(){var that=this,_li=[],optID=0,titleOption=document.createElement("option"),liIndex=-1;var generateLI=function(content,index,classes,optgroup){return""+content+""};var generateA=function(text,classes,inline,tokens){return''+text+''+""};if(this.options.title&&!this.multiple){liIndex--;if(!this.$element.find(".bs-title-option").length){var element=this.$element[0];titleOption.className="bs-title-option";titleOption.innerHTML=this.options.title;titleOption.value="";element.insertBefore(titleOption,element.firstChild);var $opt=$(element.options[element.selectedIndex]);if($opt.attr("selected")===undefined&&this.$element.data("selected")===undefined){titleOption.selected=true}}}this.$element.find("option").each(function(index){var $this=$(this);liIndex++;if($this.hasClass("bs-title-option"))return;var optionClass=this.className||"",inline=this.style.cssText,text=$this.data("content")?$this.data("content"):$this.html(),tokens=$this.data("tokens")?$this.data("tokens"):null,subtext=typeof $this.data("subtext")!=="undefined"?''+$this.data("subtext")+"":"",icon=typeof $this.data("icon")!=="undefined"?' ':"",$parent=$this.parent(),isOptgroup=$parent[0].tagName==="OPTGROUP",isOptgroupDisabled=isOptgroup&&$parent[0].disabled,isDisabled=this.disabled||isOptgroupDisabled;if(icon!==""&&isDisabled){icon=""+icon+""}if(that.options.hideDisabled&&(isDisabled&&!isOptgroup||isOptgroupDisabled)){liIndex--;return}if(!$this.data("content")){text=icon+''+text+subtext+""}if(isOptgroup&&$this.data("divider")!==true){if(that.options.hideDisabled&&isDisabled){if($parent.data("allOptionsDisabled")===undefined){var $options=$parent.children();$parent.data("allOptionsDisabled",$options.filter(":disabled").length===$options.length)}if($parent.data("allOptionsDisabled")){liIndex--;return}}var optGroupClass=" "+$parent[0].className||"";if($this.index()===0){optID+=1;var label=$parent[0].label,labelSubtext=typeof $parent.data("subtext")!=="undefined"?''+$parent.data("subtext")+"":"",labelIcon=$parent.data("icon")?' ':"";label=labelIcon+''+htmlEscape(label)+labelSubtext+"";if(index!==0&&_li.length>0){liIndex++;_li.push(generateLI("",null,"divider",optID+"div"))}liIndex++;_li.push(generateLI(label,null,"dropdown-header"+optGroupClass,optID))}if(that.options.hideDisabled&&isDisabled){liIndex--;return}_li.push(generateLI(generateA(text,"opt "+optionClass+optGroupClass,inline,tokens),index,"",optID))}else if($this.data("divider")===true){_li.push(generateLI("",index,"divider"))}else if($this.data("hidden")===true){_li.push(generateLI(generateA(text,optionClass,inline,tokens),index,"hidden is-hidden"))}else{var showDivider=this.previousElementSibling&&this.previousElementSibling.tagName==="OPTGROUP";if(!showDivider&&that.options.hideDisabled){var $prev=$(this).prevAll();for(var i=0;i<$prev.length;i++){if($prev[i].tagName==="OPTGROUP"){var optGroupDistance=0;for(var d=0;d ':"",subtext;if(that.options.showSubtext&&$this.data("subtext")&&!that.multiple){subtext=' '+$this.data("subtext")+""}else{subtext=""}if(typeof $this.attr("title")!=="undefined"){return $this.attr("title")}else if($this.data("content")&&that.options.showContent){return $this.data("content").toString()}else{return icon+$this.html()+subtext}}}).toArray();var title=!this.multiple?selectedItems[0]:selectedItems.join(this.options.multipleSeparator);if(this.multiple&&this.options.selectedTextFormat.indexOf("count")>-1){var max=this.options.selectedTextFormat.split(">");if(max.length>1&&selectedItems.length>max[1]||max.length==1&&selectedItems.length>=2){notDisabled=this.options.hideDisabled?", [disabled]":"";var totalCount=this.$element.find("option").not('[data-divider="true"], [data-hidden="true"]'+notDisabled).length,tr8nText=typeof this.options.countSelectedText==="function"?this.options.countSelectedText(selectedItems.length,totalCount):this.options.countSelectedText;title=tr8nText.replace("{0}",selectedItems.length.toString()).replace("{1}",totalCount.toString())}}if(this.options.title==undefined){this.options.title=this.$element.attr("title")}if(this.options.selectedTextFormat=="static"){title=this.options.title}if(!title){title=typeof this.options.title!=="undefined"?this.options.title:this.options.noneSelectedText}this.$button.attr("title",htmlUnescape($.trim(title.replace(/<[^>]*>?/g,""))));this.$button.children(".filter-option").html(title);this.$element.trigger("rendered.bs.select")},setStyle:function(style,status){if(this.$element.attr("class")){this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,""))}var buttonClass=style?style:this.options.style;if(status=="add"){this.$button.addClass(buttonClass)}else if(status=="remove"){this.$button.removeClass(buttonClass)}else{this.$button.removeClass(this.options.style);this.$button.addClass(buttonClass)}},liHeight:function(refresh){if(!refresh&&(this.options.size===false||this.sizeInfo))return;var newElement=document.createElement("div"),menu=document.createElement("div"),menuInner=document.createElement("ul"),divider=document.createElement("li"),li=document.createElement("li"),a=document.createElement("a"),text=document.createElement("span"),header=this.options.header&&this.$menu.find(".popover-title").length>0?this.$menu.find(".popover-title")[0].cloneNode(true):null,search=this.options.liveSearch?document.createElement("div"):null,actions=this.options.actionsBox&&this.multiple&&this.$menu.find(".bs-actionsbox").length>0?this.$menu.find(".bs-actionsbox")[0].cloneNode(true):null,doneButton=this.options.doneButton&&this.multiple&&this.$menu.find(".bs-donebutton").length>0?this.$menu.find(".bs-donebutton")[0].cloneNode(true):null;text.className="text";newElement.className=this.$menu[0].parentNode.className+" open";menu.className="dropdown-menu open";menuInner.className="dropdown-menu inner";divider.className="divider";text.appendChild(document.createTextNode("Inner text"));a.appendChild(text);li.appendChild(a);menuInner.appendChild(li);menuInner.appendChild(divider);if(header)menu.appendChild(header);if(search){var input=document.createElement("input");search.className="bs-searchbox";input.className="form-control";search.appendChild(input);menu.appendChild(search)}if(actions)menu.appendChild(actions);menu.appendChild(menuInner);if(doneButton)menu.appendChild(doneButton);newElement.appendChild(menu);document.body.appendChild(newElement);var liHeight=a.offsetHeight,headerHeight=header?header.offsetHeight:0,searchHeight=search?search.offsetHeight:0,actionsHeight=actions?actions.offsetHeight:0,doneButtonHeight=doneButton?doneButton.offsetHeight:0,dividerHeight=$(divider).outerHeight(true),menuStyle=typeof getComputedStyle==="function"?getComputedStyle(menu):false,$menu=menuStyle?null:$(menu),menuPadding={vert:parseInt(menuStyle?menuStyle.paddingTop:$menu.css("paddingTop"))+parseInt(menuStyle?menuStyle.paddingBottom:$menu.css("paddingBottom"))+parseInt(menuStyle?menuStyle.borderTopWidth:$menu.css("borderTopWidth"))+parseInt(menuStyle?menuStyle.borderBottomWidth:$menu.css("borderBottomWidth")),horiz:parseInt(menuStyle?menuStyle.paddingLeft:$menu.css("paddingLeft"))+parseInt(menuStyle?menuStyle.paddingRight:$menu.css("paddingRight"))+parseInt(menuStyle?menuStyle.borderLeftWidth:$menu.css("borderLeftWidth"))+parseInt(menuStyle?menuStyle.borderRightWidth:$menu.css("borderRightWidth"))},menuExtras={vert:menuPadding.vert+parseInt(menuStyle?menuStyle.marginTop:$menu.css("marginTop"))+parseInt(menuStyle?menuStyle.marginBottom:$menu.css("marginBottom"))+2,horiz:menuPadding.horiz+parseInt(menuStyle?menuStyle.marginLeft:$menu.css("marginLeft"))+parseInt(menuStyle?menuStyle.marginRight:$menu.css("marginRight"))+2};document.body.removeChild(newElement);this.sizeInfo={liHeight:liHeight,headerHeight:headerHeight,searchHeight:searchHeight,actionsHeight:actionsHeight,doneButtonHeight:doneButtonHeight,dividerHeight:dividerHeight,menuPadding:menuPadding,menuExtras:menuExtras}},setSize:function(){this.findLis();this.liHeight();if(this.options.header)this.$menu.css("padding-top",0);if(this.options.size===false)return;var that=this,$menu=this.$menu,$menuInner=this.$menuInner,$window=$(window),selectHeight=this.$newElement[0].offsetHeight,selectWidth=this.$newElement[0].offsetWidth,liHeight=this.sizeInfo["liHeight"],headerHeight=this.sizeInfo["headerHeight"],searchHeight=this.sizeInfo["searchHeight"],actionsHeight=this.sizeInfo["actionsHeight"],doneButtonHeight=this.sizeInfo["doneButtonHeight"],divHeight=this.sizeInfo["dividerHeight"],menuPadding=this.sizeInfo["menuPadding"],menuExtras=this.sizeInfo["menuExtras"],notDisabled=this.options.hideDisabled?".disabled":"",menuHeight,menuWidth,getHeight,getWidth,selectOffsetTop,selectOffsetBot,selectOffsetLeft,selectOffsetRight,getPos=function(){var pos=that.$newElement.offset(),$container=$(that.options.container),containerPos;if(that.options.container&&!$container.is("body")){containerPos=$container.offset();containerPos.top+=parseInt($container.css("borderTopWidth"));containerPos.left+=parseInt($container.css("borderLeftWidth"))}else{containerPos={top:0,left:0}}var winPad=that.options.windowPadding;selectOffsetTop=pos.top-containerPos.top-$window.scrollTop(); +};var wrapError=function(model,options){var error=options.error;options.error=function(resp){if(error)error.call(options.context,model,resp,options);model.trigger("error",model,resp,options)}};return Backbone})}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{jquery:140,underscore:141}],2:[function(require,module,exports){(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof exports==="object"){factory(require("jquery"))}else{factory(jQuery)}})(function($){var defaults={element:"body",position:null,type:"info",allow_dismiss:true,newest_on_top:false,showProgressbar:false,placement:{from:"top",align:"right"},offset:20,spacing:10,z_index:1031,delay:5e3,timer:1e3,url_target:"_blank",mouse_over:null,animate:{enter:"animated fadeInDown",exit:"animated fadeOutUp"},onShow:null,onShown:null,onClose:null,onClosed:null,icon_type:"class",template:''};String.format=function(){var str=arguments[0];for(var i=1;i .progress-bar').removeClass("progress-bar-"+self.settings.type);self.settings.type=commands[command];this.$ele.addClass("alert-"+commands[command]).find('[data-notify="progressbar"] > .progress-bar').addClass("progress-bar-"+commands[command]);break;case"icon":var $icon=this.$ele.find('[data-notify="icon"]');if(self.settings.icon_type.toLowerCase()=="class"){$icon.removeClass(self.settings.content.icon).addClass(commands[command])}else{if(!$icon.is("img")){$icon.find("img")}$icon.attr("src",commands[command])}break;case"progress":var newDelay=self.settings.delay-self.settings.delay*(commands[command]/100);this.$ele.data("notify-delay",newDelay);this.$ele.find('[data-notify="progressbar"] > div').attr("aria-valuenow",commands[command]).css("width",commands[command]+"%");break;case"url":this.$ele.find('[data-notify="url"]').attr("href",commands[command]);break;case"target":this.$ele.find('[data-notify="url"]').attr("target",commands[command]);break;default:this.$ele.find('[data-notify="'+command+'"]').html(commands[command])}}var posX=this.$ele.outerHeight()+parseInt(self.settings.spacing)+parseInt(self.settings.offset.y);self.reposition(posX)},close:function(){self.close()}}},buildNotify:function(){var content=this.settings.content;this.$ele=$(String.format(this.settings.template,this.settings.type,content.title,content.message,content.url,content.target));this.$ele.attr("data-notify-position",this.settings.placement.from+"-"+this.settings.placement.align);if(!this.settings.allow_dismiss){this.$ele.find('[data-notify="dismiss"]').css("display","none")}if(this.settings.delay<=0&&!this.settings.showProgressbar||!this.settings.showProgressbar){this.$ele.find('[data-notify="progressbar"]').remove()}},setIcon:function(){if(this.settings.icon_type.toLowerCase()=="class"){this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon)}else{if(this.$ele.find('[data-notify="icon"]').is("img")){this.$ele.find('[data-notify="icon"]').attr("src",this.settings.content.icon)}else{this.$ele.find('[data-notify="icon"]').append('Notify Icon')}}},styleDismiss:function(){this.$ele.find('[data-notify="dismiss"]').css({position:"absolute",right:"10px",top:"5px",zIndex:this.settings.z_index+2})},styleURL:function(){this.$ele.find('[data-notify="url"]').css({backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)",height:"100%",left:"0px",position:"absolute",top:"0px",width:"100%",zIndex:this.settings.z_index+1})},placement:function(){var self=this,offsetAmt=this.settings.offset.y,css={display:"inline-block",margin:"0px auto",position:this.settings.position?this.settings.position:this.settings.element==="body"?"fixed":"absolute",transition:"all .5s ease-in-out",zIndex:this.settings.z_index},hasAnimation=false,settings=this.settings;$('[data-notify-position="'+this.settings.placement.from+"-"+this.settings.placement.align+'"]:not([data-closing="true"])').each(function(){return offsetAmt=Math.max(offsetAmt,parseInt($(this).css(settings.placement.from))+parseInt($(this).outerHeight())+parseInt(settings.spacing))});if(this.settings.newest_on_top==true){offsetAmt=this.settings.offset.y}css[this.settings.placement.from]=offsetAmt+"px";switch(this.settings.placement.align){case"left":case"right":css[this.settings.placement.align]=this.settings.offset.x+"px";break;case"center":css.left=0;css.right=0;break}this.$ele.css(css).addClass(this.settings.animate.enter);$.each(Array("webkit-","moz-","o-","ms-",""),function(index,prefix){self.$ele[0].style[prefix+"AnimationIterationCount"]=1});$(this.settings.element).append(this.$ele);if(this.settings.newest_on_top==true){offsetAmt=parseInt(offsetAmt)+parseInt(this.settings.spacing)+this.$ele.outerHeight();this.reposition(offsetAmt)}if($.isFunction(self.settings.onShow)){self.settings.onShow.call(this.$ele)}this.$ele.one(this.animations.start,function(event){hasAnimation=true}).one(this.animations.end,function(event){if($.isFunction(self.settings.onShown)){self.settings.onShown.call(this)}});setTimeout(function(){if(!hasAnimation){if($.isFunction(self.settings.onShown)){self.settings.onShown.call(this)}}},600)},bind:function(){var self=this;this.$ele.find('[data-notify="dismiss"]').on("click",function(){self.close()});this.$ele.mouseover(function(e){$(this).data("data-hover","true")}).mouseout(function(e){$(this).data("data-hover","false")});this.$ele.data("data-hover","false");if(this.settings.delay>0){self.$ele.data("notify-delay",self.settings.delay);var timer=setInterval(function(){var delay=parseInt(self.$ele.data("notify-delay"))-self.settings.timer;if(self.$ele.data("data-hover")==="false"&&self.settings.mouse_over=="pause"||self.settings.mouse_over!="pause"){var percent=(self.settings.delay-delay)/self.settings.delay*100;self.$ele.data("notify-delay",delay);self.$ele.find('[data-notify="progressbar"] > div').attr("aria-valuenow",percent).css("width",percent+"%")}if(delay<=-self.settings.timer){clearInterval(timer);self.close()}},self.settings.timer)}},close:function(){var self=this,$successors=null,posX=parseInt(this.$ele.css(this.settings.placement.from)),hasAnimation=false;this.$ele.data("closing","true").addClass(this.settings.animate.exit);self.reposition(posX);if($.isFunction(self.settings.onClose)){self.settings.onClose.call(this.$ele)}this.$ele.one(this.animations.start,function(event){hasAnimation=true}).one(this.animations.end,function(event){$(this).remove();if($.isFunction(self.settings.onClosed)){self.settings.onClosed.call(this)}});setTimeout(function(){if(!hasAnimation){self.$ele.remove();if(self.settings.onClosed){self.settings.onClosed(self.$ele)}}},600)},reposition:function(posX){var self=this,notifies='[data-notify-position="'+this.settings.placement.from+"-"+this.settings.placement.align+'"]:not([data-closing="true"])',$elements=this.$ele.nextAll(notifies);if(this.settings.newest_on_top==true){$elements=this.$ele.prevAll(notifies)}$elements.each(function(){$(this).css(self.settings.placement.from,posX);posX=parseInt(posX)+parseInt(self.settings.spacing)+$(this).outerHeight()})}});$.notify=function(content,options){var plugin=new Notify(this,content,options);return plugin.notify};$.notifyDefaults=function(options){defaults=$.extend(true,{},defaults,options);return defaults};$.notifyClose=function(command){if(typeof command==="undefined"||command=="all"){$("[data-notify]").find('[data-notify="dismiss"]').trigger("click")}else{$('[data-notify-position="'+command+'"]').find('[data-notify="dismiss"]').trigger("click")}}})},{jquery:140}],3:[function(require,module,exports){(function(root,factory){if(typeof define==="function"&&define.amd){define(["jquery"],function(a0){return factory(a0)})}else if(typeof module==="object"&&module.exports){module.exports=factory(require("jquery"))}else{factory(root["jQuery"])}})(this,function(jQuery){(function($){"use strict";if(!String.prototype.includes){(function(){"use strict";var toString={}.toString;var defineProperty=function(){try{var object={};var $defineProperty=Object.defineProperty;var result=$defineProperty(object,object,object)&&$defineProperty}catch(error){}return result}();var indexOf="".indexOf;var includes=function(search){if(this==null){throw new TypeError}var string=String(this);if(search&&toString.call(search)=="[object RegExp]"){throw new TypeError}var stringLength=string.length;var searchString=String(search);var searchLength=searchString.length;var position=arguments.length>1?arguments[1]:undefined;var pos=position?Number(position):0;if(pos!=pos){pos=0}var start=Math.min(Math.max(pos,0),stringLength);if(searchLength+start>stringLength){return false}return indexOf.call(string,searchString,pos)!=-1};if(defineProperty){defineProperty(String.prototype,"includes",{value:includes,configurable:true,writable:true})}else{String.prototype.includes=includes}})()}if(!String.prototype.startsWith){(function(){"use strict";var defineProperty=function(){try{var object={};var $defineProperty=Object.defineProperty;var result=$defineProperty(object,object,object)&&$defineProperty}catch(error){}return result}();var toString={}.toString;var startsWith=function(search){if(this==null){throw new TypeError}var string=String(this);if(search&&toString.call(search)=="[object RegExp]"){throw new TypeError}var stringLength=string.length;var searchString=String(search);var searchLength=searchString.length;var position=arguments.length>1?arguments[1]:undefined;var pos=position?Number(position):0;if(pos!=pos){pos=0}var start=Math.min(Math.max(pos,0),stringLength);if(searchLength+start>stringLength){return false}var index=-1;while(++index":">",'"':""","'":"'","`":"`"};var unescapeMap={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"};var createEscaper=function(map){var escaper=function(match){return map[match]};var source="(?:"+Object.keys(map).join("|")+")";var testRegexp=RegExp(source);var replaceRegexp=RegExp(source,"g");return function(string){string=string==null?"":""+string;return testRegexp.test(string)?string.replace(replaceRegexp,escaper):string}};var htmlEscape=createEscaper(escapeMap);var htmlUnescape=createEscaper(unescapeMap);var Selectpicker=function(element,options){if(!valHooks.useDefault){$.valHooks.select.set=valHooks._set;valHooks.useDefault=true}this.$element=$(element);this.$newElement=null;this.$button=null;this.$menu=null;this.$lis=null;this.options=options;if(this.options.title===null){this.options.title=this.$element.attr("title")}var winPad=this.options.windowPadding;if(typeof winPad==="number"){this.options.windowPadding=[winPad,winPad,winPad,winPad]}this.val=Selectpicker.prototype.val;this.render=Selectpicker.prototype.render;this.refresh=Selectpicker.prototype.refresh;this.setStyle=Selectpicker.prototype.setStyle;this.selectAll=Selectpicker.prototype.selectAll;this.deselectAll=Selectpicker.prototype.deselectAll;this.destroy=Selectpicker.prototype.destroy;this.remove=Selectpicker.prototype.remove;this.show=Selectpicker.prototype.show;this.hide=Selectpicker.prototype.hide;this.init()};Selectpicker.VERSION="1.12.2";Selectpicker.DEFAULTS={noneSelectedText:"Nothing selected",noneResultsText:"No results matched {0}",countSelectedText:function(numSelected,numTotal){return numSelected==1?"{0} item selected":"{0} items selected"},maxOptionsText:function(numAll,numGroup){return[numAll==1?"Limit reached ({n} item max)":"Limit reached ({n} items max)",numGroup==1?"Group limit reached ({n} item max)":"Group limit reached ({n} items max)"]},selectAllText:"Select All",deselectAllText:"Deselect All",doneButton:false,doneButtonText:"Close",multipleSeparator:", ",styleBase:"btn",style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",width:false,container:false,hideDisabled:false,showSubtext:false,showIcon:true,showContent:true,dropupAuto:true,header:false,liveSearch:false,liveSearchPlaceholder:null,liveSearchNormalize:false,liveSearchStyle:"contains",actionsBox:false,iconBase:"glyphicon",tickIcon:"glyphicon-ok",showTick:false,template:{caret:''},maxOptions:false,mobile:false,selectOnTab:false,dropdownAlignRight:false,windowPadding:0};Selectpicker.prototype={constructor:Selectpicker,init:function(){var that=this,id=this.$element.attr("id");this.$element.addClass("bs-select-hidden");this.liObj={};this.multiple=this.$element.prop("multiple");this.autofocus=this.$element.prop("autofocus");this.$newElement=this.createView();this.$element.after(this.$newElement).appendTo(this.$newElement);this.$button=this.$newElement.children("button");this.$menu=this.$newElement.children(".dropdown-menu");this.$menuInner=this.$menu.children(".inner");this.$searchbox=this.$menu.find("input");this.$element.removeClass("bs-select-hidden");if(this.options.dropdownAlignRight===true)this.$menu.addClass("dropdown-menu-right");if(typeof id!=="undefined"){this.$button.attr("data-id",id);$('label[for="'+id+'"]').click(function(e){e.preventDefault();that.$button.focus()})}this.checkDisabled();this.clickListener();if(this.options.liveSearch)this.liveSearchListener();this.render();this.setStyle();this.setWidth();if(this.options.container)this.selectPosition();this.$menu.data("this",this);this.$newElement.data("this",this);if(this.options.mobile)this.mobile();this.$newElement.on({"hide.bs.dropdown":function(e){that.$menuInner.attr("aria-expanded",false);that.$element.trigger("hide.bs.select",e)},"hidden.bs.dropdown":function(e){that.$element.trigger("hidden.bs.select",e)},"show.bs.dropdown":function(e){that.$menuInner.attr("aria-expanded",true);that.$element.trigger("show.bs.select",e)},"shown.bs.dropdown":function(e){that.$element.trigger("shown.bs.select",e)}});if(that.$element[0].hasAttribute("required")){this.$element.on("invalid",function(){that.$button.addClass("bs-invalid").focus();that.$element.on({"focus.bs.select":function(){that.$button.focus();that.$element.off("focus.bs.select")},"shown.bs.select":function(){that.$element.val(that.$element.val()).off("shown.bs.select")},"rendered.bs.select":function(){if(this.validity.valid)that.$button.removeClass("bs-invalid");that.$element.off("rendered.bs.select")}})})}setTimeout(function(){that.$element.trigger("loaded.bs.select")})},createDropdown:function(){var showTick=this.multiple||this.options.showTick?" show-tick":"",inputGroup=this.$element.parent().hasClass("input-group")?" input-group-btn":"",autofocus=this.autofocus?" autofocus":"";var header=this.options.header?'
'+this.options.header+"
":"";var searchbox=this.options.liveSearch?'":"";var actionsbox=this.multiple&&this.options.actionsBox?'
'+'
'+'"+'"+"
"+"
":"";var donebutton=this.multiple&&this.options.doneButton?'
'+'
'+'"+"
"+"
":"";var drop='
'+'"+'"+"
";return $(drop)},createView:function(){var $drop=this.createDropdown(),li=this.createLi();$drop.find("ul")[0].innerHTML=li;return $drop},reloadLi:function(){var li=this.createLi();this.$menuInner[0].innerHTML=li},createLi:function(){var that=this,_li=[],optID=0,titleOption=document.createElement("option"),liIndex=-1;var generateLI=function(content,index,classes,optgroup){return""+content+""};var generateA=function(text,classes,inline,tokens){return''+text+''+""};if(this.options.title&&!this.multiple){liIndex--;if(!this.$element.find(".bs-title-option").length){var element=this.$element[0];titleOption.className="bs-title-option";titleOption.innerHTML=this.options.title;titleOption.value="";element.insertBefore(titleOption,element.firstChild);var $opt=$(element.options[element.selectedIndex]);if($opt.attr("selected")===undefined&&this.$element.data("selected")===undefined){titleOption.selected=true}}}this.$element.find("option").each(function(index){var $this=$(this);liIndex++;if($this.hasClass("bs-title-option"))return;var optionClass=this.className||"",inline=this.style.cssText,text=$this.data("content")?$this.data("content"):$this.html(),tokens=$this.data("tokens")?$this.data("tokens"):null,subtext=typeof $this.data("subtext")!=="undefined"?''+$this.data("subtext")+"":"",icon=typeof $this.data("icon")!=="undefined"?' ':"",$parent=$this.parent(),isOptgroup=$parent[0].tagName==="OPTGROUP",isOptgroupDisabled=isOptgroup&&$parent[0].disabled,isDisabled=this.disabled||isOptgroupDisabled;if(icon!==""&&isDisabled){icon=""+icon+""}if(that.options.hideDisabled&&(isDisabled&&!isOptgroup||isOptgroupDisabled)){liIndex--;return}if(!$this.data("content")){text=icon+''+text+subtext+""}if(isOptgroup&&$this.data("divider")!==true){if(that.options.hideDisabled&&isDisabled){if($parent.data("allOptionsDisabled")===undefined){var $options=$parent.children();$parent.data("allOptionsDisabled",$options.filter(":disabled").length===$options.length)}if($parent.data("allOptionsDisabled")){liIndex--;return}}var optGroupClass=" "+$parent[0].className||"";if($this.index()===0){optID+=1;var label=$parent[0].label,labelSubtext=typeof $parent.data("subtext")!=="undefined"?''+$parent.data("subtext")+"":"",labelIcon=$parent.data("icon")?' ':"";label=labelIcon+''+htmlEscape(label)+labelSubtext+"";if(index!==0&&_li.length>0){liIndex++;_li.push(generateLI("",null,"divider",optID+"div"))}liIndex++;_li.push(generateLI(label,null,"dropdown-header"+optGroupClass,optID))}if(that.options.hideDisabled&&isDisabled){liIndex--;return}_li.push(generateLI(generateA(text,"opt "+optionClass+optGroupClass,inline,tokens),index,"",optID))}else if($this.data("divider")===true){_li.push(generateLI("",index,"divider"))}else if($this.data("hidden")===true){_li.push(generateLI(generateA(text,optionClass,inline,tokens),index,"hidden is-hidden"))}else{var showDivider=this.previousElementSibling&&this.previousElementSibling.tagName==="OPTGROUP";if(!showDivider&&that.options.hideDisabled){var $prev=$(this).prevAll();for(var i=0;i<$prev.length;i++){if($prev[i].tagName==="OPTGROUP"){var optGroupDistance=0;for(var d=0;d ':"",subtext;if(that.options.showSubtext&&$this.data("subtext")&&!that.multiple){subtext=' '+$this.data("subtext")+""}else{subtext=""}if(typeof $this.attr("title")!=="undefined"){return $this.attr("title")}else if($this.data("content")&&that.options.showContent){return $this.data("content").toString()}else{return icon+$this.html()+subtext}}}).toArray();var title=!this.multiple?selectedItems[0]:selectedItems.join(this.options.multipleSeparator);if(this.multiple&&this.options.selectedTextFormat.indexOf("count")>-1){var max=this.options.selectedTextFormat.split(">");if(max.length>1&&selectedItems.length>max[1]||max.length==1&&selectedItems.length>=2){notDisabled=this.options.hideDisabled?", [disabled]":"";var totalCount=this.$element.find("option").not('[data-divider="true"], [data-hidden="true"]'+notDisabled).length,tr8nText=typeof this.options.countSelectedText==="function"?this.options.countSelectedText(selectedItems.length,totalCount):this.options.countSelectedText;title=tr8nText.replace("{0}",selectedItems.length.toString()).replace("{1}",totalCount.toString())}}if(this.options.title==undefined){this.options.title=this.$element.attr("title")}if(this.options.selectedTextFormat=="static"){title=this.options.title}if(!title){title=typeof this.options.title!=="undefined"?this.options.title:this.options.noneSelectedText}this.$button.attr("title",htmlUnescape($.trim(title.replace(/<[^>]*>?/g,""))));this.$button.children(".filter-option").html(title);this.$element.trigger("rendered.bs.select")},setStyle:function(style,status){if(this.$element.attr("class")){this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,""))}var buttonClass=style?style:this.options.style;if(status=="add"){this.$button.addClass(buttonClass)}else if(status=="remove"){this.$button.removeClass(buttonClass)}else{this.$button.removeClass(this.options.style);this.$button.addClass(buttonClass)}},liHeight:function(refresh){if(!refresh&&(this.options.size===false||this.sizeInfo))return;var newElement=document.createElement("div"),menu=document.createElement("div"),menuInner=document.createElement("ul"),divider=document.createElement("li"),li=document.createElement("li"),a=document.createElement("a"),text=document.createElement("span"),header=this.options.header&&this.$menu.find(".popover-title").length>0?this.$menu.find(".popover-title")[0].cloneNode(true):null,search=this.options.liveSearch?document.createElement("div"):null,actions=this.options.actionsBox&&this.multiple&&this.$menu.find(".bs-actionsbox").length>0?this.$menu.find(".bs-actionsbox")[0].cloneNode(true):null,doneButton=this.options.doneButton&&this.multiple&&this.$menu.find(".bs-donebutton").length>0?this.$menu.find(".bs-donebutton")[0].cloneNode(true):null;text.className="text";newElement.className=this.$menu[0].parentNode.className+" open";menu.className="dropdown-menu open";menuInner.className="dropdown-menu inner";divider.className="divider";text.appendChild(document.createTextNode("Inner text"));a.appendChild(text);li.appendChild(a);menuInner.appendChild(li);menuInner.appendChild(divider);if(header)menu.appendChild(header);if(search){var input=document.createElement("input");search.className="bs-searchbox";input.className="form-control";search.appendChild(input);menu.appendChild(search)}if(actions)menu.appendChild(actions);menu.appendChild(menuInner);if(doneButton)menu.appendChild(doneButton);newElement.appendChild(menu);document.body.appendChild(newElement);var liHeight=a.offsetHeight,headerHeight=header?header.offsetHeight:0,searchHeight=search?search.offsetHeight:0,actionsHeight=actions?actions.offsetHeight:0,doneButtonHeight=doneButton?doneButton.offsetHeight:0,dividerHeight=$(divider).outerHeight(true),menuStyle=typeof getComputedStyle==="function"?getComputedStyle(menu):false,$menu=menuStyle?null:$(menu),menuPadding={vert:parseInt(menuStyle?menuStyle.paddingTop:$menu.css("paddingTop"))+parseInt(menuStyle?menuStyle.paddingBottom:$menu.css("paddingBottom"))+parseInt(menuStyle?menuStyle.borderTopWidth:$menu.css("borderTopWidth"))+parseInt(menuStyle?menuStyle.borderBottomWidth:$menu.css("borderBottomWidth")),horiz:parseInt(menuStyle?menuStyle.paddingLeft:$menu.css("paddingLeft"))+parseInt(menuStyle?menuStyle.paddingRight:$menu.css("paddingRight"))+parseInt(menuStyle?menuStyle.borderLeftWidth:$menu.css("borderLeftWidth"))+parseInt(menuStyle?menuStyle.borderRightWidth:$menu.css("borderRightWidth"))},menuExtras={vert:menuPadding.vert+parseInt(menuStyle?menuStyle.marginTop:$menu.css("marginTop"))+parseInt(menuStyle?menuStyle.marginBottom:$menu.css("marginBottom"))+2,horiz:menuPadding.horiz+parseInt(menuStyle?menuStyle.marginLeft:$menu.css("marginLeft"))+parseInt(menuStyle?menuStyle.marginRight:$menu.css("marginRight"))+2};document.body.removeChild(newElement);this.sizeInfo={liHeight:liHeight,headerHeight:headerHeight,searchHeight:searchHeight,actionsHeight:actionsHeight,doneButtonHeight:doneButtonHeight,dividerHeight:dividerHeight,menuPadding:menuPadding,menuExtras:menuExtras}},setSize:function(){this.findLis();this.liHeight();if(this.options.header)this.$menu.css("padding-top",0);if(this.options.size===false)return;var that=this,$menu=this.$menu,$menuInner=this.$menuInner,$window=$(window),selectHeight=this.$newElement[0].offsetHeight,selectWidth=this.$newElement[0].offsetWidth,liHeight=this.sizeInfo["liHeight"],headerHeight=this.sizeInfo["headerHeight"],searchHeight=this.sizeInfo["searchHeight"],actionsHeight=this.sizeInfo["actionsHeight"],doneButtonHeight=this.sizeInfo["doneButtonHeight"],divHeight=this.sizeInfo["dividerHeight"],menuPadding=this.sizeInfo["menuPadding"],menuExtras=this.sizeInfo["menuExtras"],notDisabled=this.options.hideDisabled?".disabled":"",menuHeight,menuWidth,getHeight,getWidth,selectOffsetTop,selectOffsetBot,selectOffsetLeft,selectOffsetRight,getPos=function(){var pos=that.$newElement.offset(),$container=$(that.options.container),containerPos;if(that.options.container&&!$container.is("body")){containerPos=$container.offset();containerPos.top+=parseInt($container.css("borderTopWidth"));containerPos.left+=parseInt($container.css("borderLeftWidth"))}else{containerPos={top:0,left:0}}var winPad=that.options.windowPadding;selectOffsetTop=pos.top-containerPos.top-$window.scrollTop(); -selectOffsetBot=$window.height()-selectOffsetTop-selectHeight-containerPos.top-winPad[2];selectOffsetLeft=pos.left-containerPos.left-$window.scrollLeft();selectOffsetRight=$window.width()-selectOffsetLeft-selectWidth-containerPos.left-winPad[1];selectOffsetTop-=winPad[0];selectOffsetLeft-=winPad[3]};getPos();if(this.options.size==="auto"){var getSize=function(){var minHeight,hasClass=function(className,include){return function(element){if(include){return element.classList?element.classList.contains(className):$(element).hasClass(className)}else{return!(element.classList?element.classList.contains(className):$(element).hasClass(className))}}},lis=that.$menuInner[0].getElementsByTagName("li"),lisVisible=Array.prototype.filter?Array.prototype.filter.call(lis,hasClass("hidden",false)):that.$lis.not(".hidden"),optGroup=Array.prototype.filter?Array.prototype.filter.call(lisVisible,hasClass("dropdown-header",true)):lisVisible.filter(".dropdown-header");getPos();menuHeight=selectOffsetBot-menuExtras.vert;menuWidth=selectOffsetRight-menuExtras.horiz;if(that.options.container){if(!$menu.data("height"))$menu.data("height",$menu.height());getHeight=$menu.data("height");if(!$menu.data("width"))$menu.data("width",$menu.width());getWidth=$menu.data("width")}else{getHeight=$menu.height();getWidth=$menu.width()}if(that.options.dropupAuto){that.$newElement.toggleClass("dropup",selectOffsetTop>selectOffsetBot&&menuHeight-menuExtras.vertselectOffsetRight&&menuWidth-menuExtras.horiz3){minHeight=liHeight*3+menuExtras.vert-2}else{minHeight=0}$menu.css({"max-height":menuHeight+"px",overflow:"hidden","min-height":minHeight+headerHeight+searchHeight+actionsHeight+doneButtonHeight+"px"});$menuInner.css({"max-height":menuHeight-headerHeight-searchHeight-actionsHeight-doneButtonHeight-menuPadding.vert+"px","overflow-y":"auto","min-height":Math.max(minHeight-menuPadding.vert,0)+"px"})};getSize();this.$searchbox.off("input.getSize propertychange.getSize").on("input.getSize propertychange.getSize",getSize);$window.off("resize.getSize scroll.getSize").on("resize.getSize scroll.getSize",getSize)}else if(this.options.size&&this.options.size!="auto"&&this.$lis.not(notDisabled).length>this.options.size){var optIndex=this.$lis.not(".divider").not(notDisabled).children().slice(0,this.options.size).last().parent().index(),divLength=this.$lis.slice(0,optIndex+1).filter(".divider").length;menuHeight=liHeight*this.options.size+divLength*divHeight+menuPadding.vert;if(that.options.container){if(!$menu.data("height"))$menu.data("height",$menu.height());getHeight=$menu.data("height")}else{getHeight=$menu.height()}if(that.options.dropupAuto){this.$newElement.toggleClass("dropup",selectOffsetTop>selectOffsetBot&&menuHeight-menuExtras.vert');var that=this,$container=$(this.options.container),pos,containerPos,actualHeight,getPlacement=function($element){that.$bsContainer.addClass($element.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass("dropup",$element.hasClass("dropup"));pos=$element.offset();if(!$container.is("body")){containerPos=$container.offset();containerPos.top+=parseInt($container.css("borderTopWidth"))-$container.scrollTop();containerPos.left+=parseInt($container.css("borderLeftWidth"))-$container.scrollLeft()}else{containerPos={top:0,left:0}}actualHeight=$element.hasClass("dropup")?0:$element[0].offsetHeight;that.$bsContainer.css({top:pos.top-containerPos.top+actualHeight,left:pos.left-containerPos.left,width:$element[0].offsetWidth})};this.$button.on("click",function(){var $this=$(this);if(that.isDisabled()){return}getPlacement(that.$newElement);that.$bsContainer.appendTo(that.options.container).toggleClass("open",!$this.hasClass("open")).append(that.$menu)});$(window).on("resize scroll",function(){getPlacement(that.$newElement)});this.$element.on("hide.bs.select",function(){that.$menu.data("height",that.$menu.height());that.$bsContainer.detach()})},setSelected:function(index,selected,$lis){if(!$lis){this.togglePlaceholder();$lis=this.findLis().eq(this.liObj[index])}$lis.toggleClass("selected",selected).find("a").attr("aria-selected",selected)},setDisabled:function(index,disabled,$lis){if(!$lis){$lis=this.findLis().eq(this.liObj[index])}if(disabled){$lis.addClass("disabled").children("a").attr("href","#").attr("tabindex",-1).attr("aria-disabled",true)}else{$lis.removeClass("disabled").children("a").removeAttr("href").attr("tabindex",0).attr("aria-disabled",false)}},isDisabled:function(){return this.$element[0].disabled},checkDisabled:function(){var that=this;if(this.isDisabled()){this.$newElement.addClass("disabled");this.$button.addClass("disabled").attr("tabindex",-1).attr("aria-disabled",true)}else{if(this.$button.hasClass("disabled")){this.$newElement.removeClass("disabled");this.$button.removeClass("disabled").attr("aria-disabled",false)}if(this.$button.attr("tabindex")==-1&&!this.$element.data("tabindex")){this.$button.removeAttr("tabindex")}}this.$button.click(function(){return!that.isDisabled()})},togglePlaceholder:function(){var value=this.$element.val();this.$button.toggleClass("bs-placeholder",value===null||value===""||value.constructor===Array&&value.length===0)},tabIndex:function(){if(this.$element.data("tabindex")!==this.$element.attr("tabindex")&&(this.$element.attr("tabindex")!==-98&&this.$element.attr("tabindex")!=="-98")){this.$element.data("tabindex",this.$element.attr("tabindex"));this.$button.attr("tabindex",this.$element.data("tabindex"))}this.$element.attr("tabindex",-98)},clickListener:function(){var that=this,$document=$(document);$document.data("spaceSelect",false);this.$button.on("keyup",function(e){if(/(32)/.test(e.keyCode.toString(10))&&$document.data("spaceSelect")){e.preventDefault();$document.data("spaceSelect",false)}});this.$button.on("click",function(){that.setSize()});this.$element.on("shown.bs.select",function(){if(!that.options.liveSearch&&!that.multiple){that.$menuInner.find(".selected a").focus()}else if(!that.multiple){var selectedIndex=that.liObj[that.$element[0].selectedIndex];if(typeof selectedIndex!=="number"||that.options.size===false)return;var offset=that.$lis.eq(selectedIndex)[0].offsetTop-that.$menuInner[0].offsetTop;offset=offset-that.$menuInner[0].offsetHeight/2+that.sizeInfo.liHeight/2;that.$menuInner[0].scrollTop=offset}});this.$menuInner.on("click","li a",function(e){var $this=$(this),clickedIndex=$this.parent().data("originalIndex"),prevValue=that.$element.val(),prevIndex=that.$element.prop("selectedIndex"),triggerChange=true;if(that.multiple&&that.options.maxOptions!==1){e.stopPropagation()}e.preventDefault();if(!that.isDisabled()&&!$this.parent().hasClass("disabled")){var $options=that.$element.find("option"),$option=$options.eq(clickedIndex),state=$option.prop("selected"),$optgroup=$option.parent("optgroup"),maxOptions=that.options.maxOptions,maxOptionsGrp=$optgroup.data("maxOptions")||false;if(!that.multiple){$options.prop("selected",false);$option.prop("selected",true);that.$menuInner.find(".selected").removeClass("selected").find("a").attr("aria-selected",false);that.setSelected(clickedIndex,true)}else{$option.prop("selected",!state);that.setSelected(clickedIndex,!state);$this.blur();if(maxOptions!==false||maxOptionsGrp!==false){var maxReached=maxOptions<$options.filter(":selected").length,maxReachedGrp=maxOptionsGrp<$optgroup.find("option:selected").length;if(maxOptions&&maxReached||maxOptionsGrp&&maxReachedGrp){if(maxOptions&&maxOptions==1){$options.prop("selected",false);$option.prop("selected",true);that.$menuInner.find(".selected").removeClass("selected");that.setSelected(clickedIndex,true)}else if(maxOptionsGrp&&maxOptionsGrp==1){$optgroup.find("option:selected").prop("selected",false);$option.prop("selected",true);var optgroupID=$this.parent().data("optgroup");that.$menuInner.find('[data-optgroup="'+optgroupID+'"]').removeClass("selected");that.setSelected(clickedIndex,true)}else{var maxOptionsText=typeof that.options.maxOptionsText==="string"?[that.options.maxOptionsText,that.options.maxOptionsText]:that.options.maxOptionsText,maxOptionsArr=typeof maxOptionsText==="function"?maxOptionsText(maxOptions,maxOptionsGrp):maxOptionsText,maxTxt=maxOptionsArr[0].replace("{n}",maxOptions),maxTxtGrp=maxOptionsArr[1].replace("{n}",maxOptionsGrp),$notify=$('
');if(maxOptionsArr[2]){maxTxt=maxTxt.replace("{var}",maxOptionsArr[2][maxOptions>1?0:1]);maxTxtGrp=maxTxtGrp.replace("{var}",maxOptionsArr[2][maxOptionsGrp>1?0:1])}$option.prop("selected",false);that.$menu.append($notify);if(maxOptions&&maxReached){$notify.append($("
"+maxTxt+"
"));triggerChange=false;that.$element.trigger("maxReached.bs.select")}if(maxOptionsGrp&&maxReachedGrp){$notify.append($("
"+maxTxtGrp+"
"));triggerChange=false;that.$element.trigger("maxReachedGrp.bs.select")}setTimeout(function(){that.setSelected(clickedIndex,false)},10);$notify.delay(750).fadeOut(300,function(){$(this).remove()})}}}}if(!that.multiple||that.multiple&&that.options.maxOptions===1){that.$button.focus()}else if(that.options.liveSearch){that.$searchbox.focus()}if(triggerChange){if(prevValue!=that.$element.val()&&that.multiple||prevIndex!=that.$element.prop("selectedIndex")&&!that.multiple){changed_arguments=[clickedIndex,$option.prop("selected"),state];that.$element.triggerNative("change")}}}});this.$menu.on("click","li.disabled a, .popover-title, .popover-title :not(.close)",function(e){if(e.currentTarget==this){e.preventDefault();e.stopPropagation();if(that.options.liveSearch&&!$(e.target).hasClass("close")){that.$searchbox.focus()}else{that.$button.focus()}}});this.$menuInner.on("click",".divider, .dropdown-header",function(e){e.preventDefault();e.stopPropagation();if(that.options.liveSearch){that.$searchbox.focus()}else{that.$button.focus()}});this.$menu.on("click",".popover-title .close",function(){that.$button.click()});this.$searchbox.on("click",function(e){e.stopPropagation()});this.$menu.on("click",".actions-btn",function(e){if(that.options.liveSearch){that.$searchbox.focus()}else{that.$button.focus()}e.preventDefault();e.stopPropagation();if($(this).hasClass("bs-select-all")){that.selectAll()}else{that.deselectAll()}});this.$element.change(function(){that.render(false);that.$element.trigger("changed.bs.select",changed_arguments);changed_arguments=null})},liveSearchListener:function(){var that=this,$no_results=$('
  • ');this.$button.on("click.dropdown.data-api",function(){that.$menuInner.find(".active").removeClass("active");if(!!that.$searchbox.val()){that.$searchbox.val("");that.$lis.not(".is-hidden").removeClass("hidden");if(!!$no_results.parent().length)$no_results.remove()}if(!that.multiple)that.$menuInner.find(".selected").addClass("active");setTimeout(function(){that.$searchbox.focus()},10)});this.$searchbox.on("click.dropdown.data-api focus.dropdown.data-api touchend.dropdown.data-api",function(e){e.stopPropagation()});this.$searchbox.on("input propertychange",function(){that.$lis.not(".is-hidden").removeClass("hidden");that.$lis.filter(".active").removeClass("active");$no_results.remove();if(that.$searchbox.val()){var $searchBase=that.$lis.not(".is-hidden, .divider, .dropdown-header"),$hideItems;if(that.options.liveSearchNormalize){$hideItems=$searchBase.find("a").not(":a"+that._searchStyle()+'("'+normalizeToBase(that.$searchbox.val())+'")')}else{$hideItems=$searchBase.find("a").not(":"+that._searchStyle()+'("'+that.$searchbox.val()+'")')}if($hideItems.length===$searchBase.length){$no_results.html(that.options.noneResultsText.replace("{0}",'"'+htmlEscape(that.$searchbox.val())+'"'));that.$menuInner.append($no_results);that.$lis.addClass("hidden")}else{$hideItems.parent().addClass("hidden");var $lisVisible=that.$lis.not(".hidden"),$foundDiv;$lisVisible.each(function(index){var $this=$(this);if($this.hasClass("divider")){if($foundDiv===undefined){$this.addClass("hidden")}else{if($foundDiv)$foundDiv.addClass("hidden");$foundDiv=$this}}else if($this.hasClass("dropdown-header")&&$lisVisible.eq(index+1).data("optgroup")!==$this.data("optgroup")){$this.addClass("hidden")}else{$foundDiv=null}});if($foundDiv)$foundDiv.addClass("hidden");$searchBase.not(".hidden").first().addClass("active")}}})},_searchStyle:function(){var styles={begins:"ibegins",startsWith:"ibegins"};return styles[this.options.liveSearchStyle]||"icontains"},val:function(value){if(typeof value!=="undefined"){this.$element.val(value);this.render();return this.$element}else{return this.$element.val()}},changeAll:function(status){if(!this.multiple)return;if(typeof status==="undefined")status=true;this.findLis();var $options=this.$element.find("option"),$lisVisible=this.$lis.not(".divider, .dropdown-header, .disabled, .hidden"),lisVisLen=$lisVisible.length,selectedOptions=[];if(status){if($lisVisible.filter(".selected").length===$lisVisible.length)return}else{if($lisVisible.filter(".selected").length===0)return}$lisVisible.toggleClass("selected",status);for(var i=0;i=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105||e.keyCode>=65&&e.keyCode<=90)){if(!that.options.container){that.setSize();that.$menu.parent().addClass("open");isActive=true}else{that.$button.trigger("click")}that.$searchbox.focus();return}if(that.options.liveSearch){if(/(^9$|27)/.test(e.keyCode.toString(10))&&isActive){e.preventDefault();e.stopPropagation();that.$menuInner.click();that.$button.focus()}$items=$('[role="listbox"] li'+selector,$parent);if(!$this.val()&&!/(38|40)/.test(e.keyCode.toString(10))){if($items.filter(".active").length===0){$items=that.$menuInner.find("li");if(that.options.liveSearchNormalize){$items=$items.filter(":a"+that._searchStyle()+"("+normalizeToBase(keyCodeMap[e.keyCode])+")")}else{$items=$items.filter(":"+that._searchStyle()+"("+keyCodeMap[e.keyCode]+")")}}}}if(!$items.length)return;if(/(38|40)/.test(e.keyCode.toString(10))){index=$items.index($items.find("a").filter(":focus").parent());first=$items.filter(selector).first().index();last=$items.filter(selector).last().index();next=$items.eq(index).nextAll(selector).eq(0).index();prev=$items.eq(index).prevAll(selector).eq(0).index();nextPrev=$items.eq(next).prevAll(selector).eq(0).index();if(that.options.liveSearch){$items.each(function(i){if(!$(this).hasClass("disabled")){$(this).data("index",i)}});index=$items.index($items.filter(".active"));first=$items.first().data("index");last=$items.last().data("index");next=$items.eq(index).nextAll().eq(0).data("index");prev=$items.eq(index).prevAll().eq(0).data("index");nextPrev=$items.eq(next).prevAll().eq(0).data("index")}prevIndex=$this.data("prevIndex");if(e.keyCode==38){if(that.options.liveSearch)index--;if(index!=nextPrev&&index>prev)index=prev;if(indexlast)index=last;if(index==prevIndex)index=first}$this.data("prevIndex",index);if(!that.options.liveSearch){$items.eq(index).children("a").focus()}else{e.preventDefault();if(!$this.hasClass("dropdown-toggle")){$items.removeClass("active").eq(index).addClass("active").children("a").focus();$this.focus()}}}else if(!$this.is("input")){var keyIndex=[],count,prevKey;$items.each(function(){if(!$(this).hasClass("disabled")){if($.trim($(this).children("a").text().toLowerCase()).substring(0,1)==keyCodeMap[e.keyCode]){keyIndex.push($(this).index())}}});count=$(document).data("keycount");count++;$(document).data("keycount",count);prevKey=$.trim($(":focus").text().toLowerCase()).substring(0,1);if(prevKey!=keyCodeMap[e.keyCode]){count=1;$(document).data("keycount",count)}else if(count>=keyIndex.length){$(document).data("keycount",0);if(count>keyIndex.length)count=1}$items.eq(keyIndex[count-1]).children("a").focus()}if((/(13|32)/.test(e.keyCode.toString(10))||/(^9$)/.test(e.keyCode.toString(10))&&that.options.selectOnTab)&&isActive){if(!/(32)/.test(e.keyCode.toString(10)))e.preventDefault();if(!that.options.liveSearch){var elem=$(":focus");elem.click();elem.focus();e.preventDefault();$(document).data("spaceSelect",true)}else if(!/(32)/.test(e.keyCode.toString(10))){that.$menuInner.find(".active a").click();$this.focus()}$(document).data("keycount",0)}if(/(^9$|27)/.test(e.keyCode.toString(10))&&isActive&&(that.multiple||that.options.liveSearch)||/(27)/.test(e.keyCode.toString(10))&&!isActive){that.$menu.parent().removeClass("open");if(that.options.container)that.$newElement.removeClass("open");that.$button.focus()}},mobile:function(){this.$element.addClass("mobile-device")},refresh:function(){this.$lis=null;this.liObj={};this.reloadLi();this.render();this.checkDisabled();this.liHeight(true);this.setStyle();this.setWidth();if(this.$lis)this.$searchbox.trigger("propertychange");this.$element.trigger("refreshed.bs.select")},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove();this.$element.remove()},destroy:function(){this.$newElement.before(this.$element).remove();if(this.$bsContainer){this.$bsContainer.remove()}else{this.$menu.remove()}this.$element.off(".bs.select").removeData("selectpicker").removeClass("bs-select-hidden selectpicker")}};function Plugin(option){var args=arguments;var _option=option;[].shift.apply(args);var value;var chain=this.each(function(){var $this=$(this);if($this.is("select")){var data=$this.data("selectpicker"),options=typeof _option=="object"&&_option;if(!data){var config=$.extend({},Selectpicker.DEFAULTS,$.fn.selectpicker.defaults||{},$this.data(),options);config.template=$.extend({},Selectpicker.DEFAULTS.template,$.fn.selectpicker.defaults?$.fn.selectpicker.defaults.template:{},$this.data().template,options.template);$this.data("selectpicker",data=new Selectpicker(this,config))}else if(options){for(var i in options){if(options.hasOwnProperty(i)){data.options[i]=options[i]}}}if(typeof _option=="string"){if(data[_option]instanceof Function){value=data[_option].apply(data,args)}else{value=data.options[_option]}}}});if(typeof value!=="undefined"){return value}else{return chain}}var old=$.fn.selectpicker;$.fn.selectpicker=Plugin;$.fn.selectpicker.Constructor=Selectpicker;$.fn.selectpicker.noConflict=function(){$.fn.selectpicker=old;return this};$(document).data("keycount",0).on("keydown.bs.select",'.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="listbox"], .bs-searchbox input',Selectpicker.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="listbox"], .bs-searchbox input',function(e){e.stopPropagation()});$(window).on("load.bs.select.data-api",function(){$(".selectpicker").each(function(){var $selectpicker=$(this);Plugin.call($selectpicker,$selectpicker.data())})})})(jQuery)})},{jquery:139}],4:[function(require,module,exports){require("../../js/transition.js");require("../../js/alert.js");require("../../js/button.js");require("../../js/carousel.js");require("../../js/collapse.js");require("../../js/dropdown.js");require("../../js/modal.js");require("../../js/tooltip.js");require("../../js/popover.js");require("../../js/scrollspy.js");require("../../js/tab.js");require("../../js/affix.js")},{"../../js/affix.js":5,"../../js/alert.js":6,"../../js/button.js":7,"../../js/carousel.js":8,"../../js/collapse.js":9,"../../js/dropdown.js":10,"../../js/modal.js":11,"../../js/popover.js":12,"../../js/scrollspy.js":13,"../../js/tab.js":14,"../../js/tooltip.js":15,"../../js/transition.js":16}],5:[function(require,module,exports){+function($){"use strict";var Affix=function(element,options){this.options=$.extend({},Affix.DEFAULTS,options);this.$target=$(this.options.target).on("scroll.bs.affix.data-api",$.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",$.proxy(this.checkPositionWithEventLoop,this));this.$element=$(element);this.affixed=null;this.unpin=null;this.pinnedOffset=null;this.checkPosition()};Affix.VERSION="3.3.7";Affix.RESET="affix affix-top affix-bottom";Affix.DEFAULTS={offset:0,target:window};Affix.prototype.getState=function(scrollHeight,height,offsetTop,offsetBottom){var scrollTop=this.$target.scrollTop();var position=this.$element.offset();var targetHeight=this.$target.height();if(offsetTop!=null&&this.affixed=="top")return scrollTop=scrollHeight-offsetBottom)return"bottom";return false};Affix.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(Affix.RESET).addClass("affix");var scrollTop=this.$target.scrollTop();var position=this.$element.offset();return this.pinnedOffset=position.top-scrollTop};Affix.prototype.checkPositionWithEventLoop=function(){setTimeout($.proxy(this.checkPosition,this),1)};Affix.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var height=this.$element.height();var offset=this.options.offset;var offsetTop=offset.top;var offsetBottom=offset.bottom;var scrollHeight=Math.max($(document).height(),$(document.body).height());if(typeof offset!="object")offsetBottom=offsetTop=offset;if(typeof offsetTop=="function")offsetTop=offset.top(this.$element);if(typeof offsetBottom=="function")offsetBottom=offset.bottom(this.$element);var affix=this.getState(scrollHeight,height,offsetTop,offsetBottom);if(this.affixed!=affix){if(this.unpin!=null)this.$element.css("top","");var affixType="affix"+(affix?"-"+affix:"");var e=$.Event(affixType+".bs.affix");this.$element.trigger(e);if(e.isDefaultPrevented())return;this.affixed=affix;this.unpin=affix=="bottom"?this.getPinnedOffset():null;this.$element.removeClass(Affix.RESET).addClass(affixType).trigger(affixType.replace("affix","affixed")+".bs.affix")}if(affix=="bottom"){this.$element.offset({top:scrollHeight-height-offsetBottom})}};function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.affix");var options=typeof option=="object"&&option;if(!data)$this.data("bs.affix",data=new Affix(this,options));if(typeof option=="string")data[option]()})}var old=$.fn.affix;$.fn.affix=Plugin;$.fn.affix.Constructor=Affix;$.fn.affix.noConflict=function(){$.fn.affix=old;return this};$(window).on("load",function(){$('[data-spy="affix"]').each(function(){var $spy=$(this);var data=$spy.data();data.offset=data.offset||{};if(data.offsetBottom!=null)data.offset.bottom=data.offsetBottom;if(data.offsetTop!=null)data.offset.top=data.offsetTop;Plugin.call($spy,data)})})}(jQuery)},{}],6:[function(require,module,exports){+function($){"use strict";var dismiss='[data-dismiss="alert"]';var Alert=function(el){$(el).on("click",dismiss,this.close)};Alert.VERSION="3.3.7";Alert.TRANSITION_DURATION=150;Alert.prototype.close=function(e){var $this=$(this);var selector=$this.attr("data-target");if(!selector){selector=$this.attr("href");selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,"")}var $parent=$(selector==="#"?[]:selector);if(e)e.preventDefault();if(!$parent.length){$parent=$this.closest(".alert")}$parent.trigger(e=$.Event("close.bs.alert"));if(e.isDefaultPrevented())return;$parent.removeClass("in");function removeElement(){$parent.detach().trigger("closed.bs.alert").remove()}$.support.transition&&$parent.hasClass("fade")?$parent.one("bsTransitionEnd",removeElement).emulateTransitionEnd(Alert.TRANSITION_DURATION):removeElement()};function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.alert");if(!data)$this.data("bs.alert",data=new Alert(this));if(typeof option=="string")data[option].call($this)})}var old=$.fn.alert;$.fn.alert=Plugin;$.fn.alert.Constructor=Alert;$.fn.alert.noConflict=function(){$.fn.alert=old;return this};$(document).on("click.bs.alert.data-api",dismiss,Alert.prototype.close)}(jQuery)},{}],7:[function(require,module,exports){+function($){"use strict";var Button=function(element,options){this.$element=$(element);this.options=$.extend({},Button.DEFAULTS,options);this.isLoading=false};Button.VERSION="3.3.7";Button.DEFAULTS={loadingText:"loading..."};Button.prototype.setState=function(state){var d="disabled";var $el=this.$element;var val=$el.is("input")?"val":"html";var data=$el.data();state+="Text";if(data.resetText==null)$el.data("resetText",$el[val]());setTimeout($.proxy(function(){$el[val](data[state]==null?this.options[state]:data[state]);if(state=="loadingText"){this.isLoading=true;$el.addClass(d).attr(d,d).prop(d,true)}else if(this.isLoading){this.isLoading=false;$el.removeClass(d).removeAttr(d).prop(d,false)}},this),0)};Button.prototype.toggle=function(){var changed=true;var $parent=this.$element.closest('[data-toggle="buttons"]');if($parent.length){var $input=this.$element.find("input");if($input.prop("type")=="radio"){if($input.prop("checked"))changed=false;$parent.find(".active").removeClass("active");this.$element.addClass("active")}else if($input.prop("type")=="checkbox"){if($input.prop("checked")!==this.$element.hasClass("active"))changed=false;this.$element.toggleClass("active")}$input.prop("checked",this.$element.hasClass("active"));if(changed)$input.trigger("change")}else{this.$element.attr("aria-pressed",!this.$element.hasClass("active"));this.$element.toggleClass("active")}};function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.button");var options=typeof option=="object"&&option;if(!data)$this.data("bs.button",data=new Button(this,options));if(option=="toggle")data.toggle();else if(option)data.setState(option)})}var old=$.fn.button;$.fn.button=Plugin;$.fn.button.Constructor=Button;$.fn.button.noConflict=function(){$.fn.button=old;return this};$(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(e){var $btn=$(e.target).closest(".btn");Plugin.call($btn,"toggle");if(!$(e.target).is('input[type="radio"], input[type="checkbox"]')){e.preventDefault();if($btn.is("input,button"))$btn.trigger("focus");else $btn.find("input:visible,button:visible").first().trigger("focus")}}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(e){$(e.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(e.type))})}(jQuery)},{}],8:[function(require,module,exports){+function($){"use strict";var Carousel=function(element,options){this.$element=$(element);this.$indicators=this.$element.find(".carousel-indicators");this.options=options;this.paused=null;this.sliding=null;this.interval=null;this.$active=null;this.$items=null;this.options.keyboard&&this.$element.on("keydown.bs.carousel",$.proxy(this.keydown,this));this.options.pause=="hover"&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",$.proxy(this.pause,this)).on("mouseleave.bs.carousel",$.proxy(this.cycle,this))};Carousel.VERSION="3.3.7";Carousel.TRANSITION_DURATION=600;Carousel.DEFAULTS={interval:5e3,pause:"hover",wrap:true,keyboard:true};Carousel.prototype.keydown=function(e){if(/input|textarea/i.test(e.target.tagName))return;switch(e.which){case 37:this.prev();break;case 39:this.next();break;default:return}e.preventDefault()};Carousel.prototype.cycle=function(e){e||(this.paused=false);this.interval&&clearInterval(this.interval);this.options.interval&&!this.paused&&(this.interval=setInterval($.proxy(this.next,this),this.options.interval));return this};Carousel.prototype.getItemIndex=function(item){this.$items=item.parent().children(".item");return this.$items.index(item||this.$active)};Carousel.prototype.getItemForDirection=function(direction,active){var activeIndex=this.getItemIndex(active);var willWrap=direction=="prev"&&activeIndex===0||direction=="next"&&activeIndex==this.$items.length-1;if(willWrap&&!this.options.wrap)return active;var delta=direction=="prev"?-1:1;var itemIndex=(activeIndex+delta)%this.$items.length;return this.$items.eq(itemIndex)};Carousel.prototype.to=function(pos){var that=this;var activeIndex=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(pos>this.$items.length-1||pos<0)return;if(this.sliding)return this.$element.one("slid.bs.carousel",function(){that.to(pos)});if(activeIndex==pos)return this.pause().cycle();return this.slide(pos>activeIndex?"next":"prev",this.$items.eq(pos))};Carousel.prototype.pause=function(e){e||(this.paused=true);if(this.$element.find(".next, .prev").length&&$.support.transition){this.$element.trigger($.support.transition.end);this.cycle(true)}this.interval=clearInterval(this.interval);return this};Carousel.prototype.next=function(){if(this.sliding)return;return this.slide("next")};Carousel.prototype.prev=function(){if(this.sliding)return;return this.slide("prev")};Carousel.prototype.slide=function(type,next){var $active=this.$element.find(".item.active");var $next=next||this.getItemForDirection(type,$active);var isCycling=this.interval;var direction=type=="next"?"left":"right";var that=this;if($next.hasClass("active"))return this.sliding=false;var relatedTarget=$next[0];var slideEvent=$.Event("slide.bs.carousel",{ +selectOffsetBot=$window.height()-selectOffsetTop-selectHeight-containerPos.top-winPad[2];selectOffsetLeft=pos.left-containerPos.left-$window.scrollLeft();selectOffsetRight=$window.width()-selectOffsetLeft-selectWidth-containerPos.left-winPad[1];selectOffsetTop-=winPad[0];selectOffsetLeft-=winPad[3]};getPos();if(this.options.size==="auto"){var getSize=function(){var minHeight,hasClass=function(className,include){return function(element){if(include){return element.classList?element.classList.contains(className):$(element).hasClass(className)}else{return!(element.classList?element.classList.contains(className):$(element).hasClass(className))}}},lis=that.$menuInner[0].getElementsByTagName("li"),lisVisible=Array.prototype.filter?Array.prototype.filter.call(lis,hasClass("hidden",false)):that.$lis.not(".hidden"),optGroup=Array.prototype.filter?Array.prototype.filter.call(lisVisible,hasClass("dropdown-header",true)):lisVisible.filter(".dropdown-header");getPos();menuHeight=selectOffsetBot-menuExtras.vert;menuWidth=selectOffsetRight-menuExtras.horiz;if(that.options.container){if(!$menu.data("height"))$menu.data("height",$menu.height());getHeight=$menu.data("height");if(!$menu.data("width"))$menu.data("width",$menu.width());getWidth=$menu.data("width")}else{getHeight=$menu.height();getWidth=$menu.width()}if(that.options.dropupAuto){that.$newElement.toggleClass("dropup",selectOffsetTop>selectOffsetBot&&menuHeight-menuExtras.vertselectOffsetRight&&menuWidth-menuExtras.horiz3){minHeight=liHeight*3+menuExtras.vert-2}else{minHeight=0}$menu.css({"max-height":menuHeight+"px",overflow:"hidden","min-height":minHeight+headerHeight+searchHeight+actionsHeight+doneButtonHeight+"px"});$menuInner.css({"max-height":menuHeight-headerHeight-searchHeight-actionsHeight-doneButtonHeight-menuPadding.vert+"px","overflow-y":"auto","min-height":Math.max(minHeight-menuPadding.vert,0)+"px"})};getSize();this.$searchbox.off("input.getSize propertychange.getSize").on("input.getSize propertychange.getSize",getSize);$window.off("resize.getSize scroll.getSize").on("resize.getSize scroll.getSize",getSize)}else if(this.options.size&&this.options.size!="auto"&&this.$lis.not(notDisabled).length>this.options.size){var optIndex=this.$lis.not(".divider").not(notDisabled).children().slice(0,this.options.size).last().parent().index(),divLength=this.$lis.slice(0,optIndex+1).filter(".divider").length;menuHeight=liHeight*this.options.size+divLength*divHeight+menuPadding.vert;if(that.options.container){if(!$menu.data("height"))$menu.data("height",$menu.height());getHeight=$menu.data("height")}else{getHeight=$menu.height()}if(that.options.dropupAuto){this.$newElement.toggleClass("dropup",selectOffsetTop>selectOffsetBot&&menuHeight-menuExtras.vert');var that=this,$container=$(this.options.container),pos,containerPos,actualHeight,getPlacement=function($element){that.$bsContainer.addClass($element.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass("dropup",$element.hasClass("dropup"));pos=$element.offset();if(!$container.is("body")){containerPos=$container.offset();containerPos.top+=parseInt($container.css("borderTopWidth"))-$container.scrollTop();containerPos.left+=parseInt($container.css("borderLeftWidth"))-$container.scrollLeft()}else{containerPos={top:0,left:0}}actualHeight=$element.hasClass("dropup")?0:$element[0].offsetHeight;that.$bsContainer.css({top:pos.top-containerPos.top+actualHeight,left:pos.left-containerPos.left,width:$element[0].offsetWidth})};this.$button.on("click",function(){var $this=$(this);if(that.isDisabled()){return}getPlacement(that.$newElement);that.$bsContainer.appendTo(that.options.container).toggleClass("open",!$this.hasClass("open")).append(that.$menu)});$(window).on("resize scroll",function(){getPlacement(that.$newElement)});this.$element.on("hide.bs.select",function(){that.$menu.data("height",that.$menu.height());that.$bsContainer.detach()})},setSelected:function(index,selected,$lis){if(!$lis){this.togglePlaceholder();$lis=this.findLis().eq(this.liObj[index])}$lis.toggleClass("selected",selected).find("a").attr("aria-selected",selected)},setDisabled:function(index,disabled,$lis){if(!$lis){$lis=this.findLis().eq(this.liObj[index])}if(disabled){$lis.addClass("disabled").children("a").attr("href","#").attr("tabindex",-1).attr("aria-disabled",true)}else{$lis.removeClass("disabled").children("a").removeAttr("href").attr("tabindex",0).attr("aria-disabled",false)}},isDisabled:function(){return this.$element[0].disabled},checkDisabled:function(){var that=this;if(this.isDisabled()){this.$newElement.addClass("disabled");this.$button.addClass("disabled").attr("tabindex",-1).attr("aria-disabled",true)}else{if(this.$button.hasClass("disabled")){this.$newElement.removeClass("disabled");this.$button.removeClass("disabled").attr("aria-disabled",false)}if(this.$button.attr("tabindex")==-1&&!this.$element.data("tabindex")){this.$button.removeAttr("tabindex")}}this.$button.click(function(){return!that.isDisabled()})},togglePlaceholder:function(){var value=this.$element.val();this.$button.toggleClass("bs-placeholder",value===null||value===""||value.constructor===Array&&value.length===0)},tabIndex:function(){if(this.$element.data("tabindex")!==this.$element.attr("tabindex")&&(this.$element.attr("tabindex")!==-98&&this.$element.attr("tabindex")!=="-98")){this.$element.data("tabindex",this.$element.attr("tabindex"));this.$button.attr("tabindex",this.$element.data("tabindex"))}this.$element.attr("tabindex",-98)},clickListener:function(){var that=this,$document=$(document);$document.data("spaceSelect",false);this.$button.on("keyup",function(e){if(/(32)/.test(e.keyCode.toString(10))&&$document.data("spaceSelect")){e.preventDefault();$document.data("spaceSelect",false)}});this.$button.on("click",function(){that.setSize()});this.$element.on("shown.bs.select",function(){if(!that.options.liveSearch&&!that.multiple){that.$menuInner.find(".selected a").focus()}else if(!that.multiple){var selectedIndex=that.liObj[that.$element[0].selectedIndex];if(typeof selectedIndex!=="number"||that.options.size===false)return;var offset=that.$lis.eq(selectedIndex)[0].offsetTop-that.$menuInner[0].offsetTop;offset=offset-that.$menuInner[0].offsetHeight/2+that.sizeInfo.liHeight/2;that.$menuInner[0].scrollTop=offset}});this.$menuInner.on("click","li a",function(e){var $this=$(this),clickedIndex=$this.parent().data("originalIndex"),prevValue=that.$element.val(),prevIndex=that.$element.prop("selectedIndex"),triggerChange=true;if(that.multiple&&that.options.maxOptions!==1){e.stopPropagation()}e.preventDefault();if(!that.isDisabled()&&!$this.parent().hasClass("disabled")){var $options=that.$element.find("option"),$option=$options.eq(clickedIndex),state=$option.prop("selected"),$optgroup=$option.parent("optgroup"),maxOptions=that.options.maxOptions,maxOptionsGrp=$optgroup.data("maxOptions")||false;if(!that.multiple){$options.prop("selected",false);$option.prop("selected",true);that.$menuInner.find(".selected").removeClass("selected").find("a").attr("aria-selected",false);that.setSelected(clickedIndex,true)}else{$option.prop("selected",!state);that.setSelected(clickedIndex,!state);$this.blur();if(maxOptions!==false||maxOptionsGrp!==false){var maxReached=maxOptions<$options.filter(":selected").length,maxReachedGrp=maxOptionsGrp<$optgroup.find("option:selected").length;if(maxOptions&&maxReached||maxOptionsGrp&&maxReachedGrp){if(maxOptions&&maxOptions==1){$options.prop("selected",false);$option.prop("selected",true);that.$menuInner.find(".selected").removeClass("selected");that.setSelected(clickedIndex,true)}else if(maxOptionsGrp&&maxOptionsGrp==1){$optgroup.find("option:selected").prop("selected",false);$option.prop("selected",true);var optgroupID=$this.parent().data("optgroup");that.$menuInner.find('[data-optgroup="'+optgroupID+'"]').removeClass("selected");that.setSelected(clickedIndex,true)}else{var maxOptionsText=typeof that.options.maxOptionsText==="string"?[that.options.maxOptionsText,that.options.maxOptionsText]:that.options.maxOptionsText,maxOptionsArr=typeof maxOptionsText==="function"?maxOptionsText(maxOptions,maxOptionsGrp):maxOptionsText,maxTxt=maxOptionsArr[0].replace("{n}",maxOptions),maxTxtGrp=maxOptionsArr[1].replace("{n}",maxOptionsGrp),$notify=$('
    ');if(maxOptionsArr[2]){maxTxt=maxTxt.replace("{var}",maxOptionsArr[2][maxOptions>1?0:1]);maxTxtGrp=maxTxtGrp.replace("{var}",maxOptionsArr[2][maxOptionsGrp>1?0:1])}$option.prop("selected",false);that.$menu.append($notify);if(maxOptions&&maxReached){$notify.append($("
    "+maxTxt+"
    "));triggerChange=false;that.$element.trigger("maxReached.bs.select")}if(maxOptionsGrp&&maxReachedGrp){$notify.append($("
    "+maxTxtGrp+"
    "));triggerChange=false;that.$element.trigger("maxReachedGrp.bs.select")}setTimeout(function(){that.setSelected(clickedIndex,false)},10);$notify.delay(750).fadeOut(300,function(){$(this).remove()})}}}}if(!that.multiple||that.multiple&&that.options.maxOptions===1){that.$button.focus()}else if(that.options.liveSearch){that.$searchbox.focus()}if(triggerChange){if(prevValue!=that.$element.val()&&that.multiple||prevIndex!=that.$element.prop("selectedIndex")&&!that.multiple){changed_arguments=[clickedIndex,$option.prop("selected"),state];that.$element.triggerNative("change")}}}});this.$menu.on("click","li.disabled a, .popover-title, .popover-title :not(.close)",function(e){if(e.currentTarget==this){e.preventDefault();e.stopPropagation();if(that.options.liveSearch&&!$(e.target).hasClass("close")){that.$searchbox.focus()}else{that.$button.focus()}}});this.$menuInner.on("click",".divider, .dropdown-header",function(e){e.preventDefault();e.stopPropagation();if(that.options.liveSearch){that.$searchbox.focus()}else{that.$button.focus()}});this.$menu.on("click",".popover-title .close",function(){that.$button.click()});this.$searchbox.on("click",function(e){e.stopPropagation()});this.$menu.on("click",".actions-btn",function(e){if(that.options.liveSearch){that.$searchbox.focus()}else{that.$button.focus()}e.preventDefault();e.stopPropagation();if($(this).hasClass("bs-select-all")){that.selectAll()}else{that.deselectAll()}});this.$element.change(function(){that.render(false);that.$element.trigger("changed.bs.select",changed_arguments);changed_arguments=null})},liveSearchListener:function(){var that=this,$no_results=$('
  • ');this.$button.on("click.dropdown.data-api",function(){that.$menuInner.find(".active").removeClass("active");if(!!that.$searchbox.val()){that.$searchbox.val("");that.$lis.not(".is-hidden").removeClass("hidden");if(!!$no_results.parent().length)$no_results.remove()}if(!that.multiple)that.$menuInner.find(".selected").addClass("active");setTimeout(function(){that.$searchbox.focus()},10)});this.$searchbox.on("click.dropdown.data-api focus.dropdown.data-api touchend.dropdown.data-api",function(e){e.stopPropagation()});this.$searchbox.on("input propertychange",function(){that.$lis.not(".is-hidden").removeClass("hidden");that.$lis.filter(".active").removeClass("active");$no_results.remove();if(that.$searchbox.val()){var $searchBase=that.$lis.not(".is-hidden, .divider, .dropdown-header"),$hideItems;if(that.options.liveSearchNormalize){$hideItems=$searchBase.find("a").not(":a"+that._searchStyle()+'("'+normalizeToBase(that.$searchbox.val())+'")')}else{$hideItems=$searchBase.find("a").not(":"+that._searchStyle()+'("'+that.$searchbox.val()+'")')}if($hideItems.length===$searchBase.length){$no_results.html(that.options.noneResultsText.replace("{0}",'"'+htmlEscape(that.$searchbox.val())+'"'));that.$menuInner.append($no_results);that.$lis.addClass("hidden")}else{$hideItems.parent().addClass("hidden");var $lisVisible=that.$lis.not(".hidden"),$foundDiv;$lisVisible.each(function(index){var $this=$(this);if($this.hasClass("divider")){if($foundDiv===undefined){$this.addClass("hidden")}else{if($foundDiv)$foundDiv.addClass("hidden");$foundDiv=$this}}else if($this.hasClass("dropdown-header")&&$lisVisible.eq(index+1).data("optgroup")!==$this.data("optgroup")){$this.addClass("hidden")}else{$foundDiv=null}});if($foundDiv)$foundDiv.addClass("hidden");$searchBase.not(".hidden").first().addClass("active")}}})},_searchStyle:function(){var styles={begins:"ibegins",startsWith:"ibegins"};return styles[this.options.liveSearchStyle]||"icontains"},val:function(value){if(typeof value!=="undefined"){this.$element.val(value);this.render();return this.$element}else{return this.$element.val()}},changeAll:function(status){if(!this.multiple)return;if(typeof status==="undefined")status=true;this.findLis();var $options=this.$element.find("option"),$lisVisible=this.$lis.not(".divider, .dropdown-header, .disabled, .hidden"),lisVisLen=$lisVisible.length,selectedOptions=[];if(status){if($lisVisible.filter(".selected").length===$lisVisible.length)return}else{if($lisVisible.filter(".selected").length===0)return}$lisVisible.toggleClass("selected",status);for(var i=0;i=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105||e.keyCode>=65&&e.keyCode<=90)){if(!that.options.container){that.setSize();that.$menu.parent().addClass("open");isActive=true}else{that.$button.trigger("click")}that.$searchbox.focus();return}if(that.options.liveSearch){if(/(^9$|27)/.test(e.keyCode.toString(10))&&isActive){e.preventDefault();e.stopPropagation();that.$menuInner.click();that.$button.focus()}$items=$('[role="listbox"] li'+selector,$parent);if(!$this.val()&&!/(38|40)/.test(e.keyCode.toString(10))){if($items.filter(".active").length===0){$items=that.$menuInner.find("li");if(that.options.liveSearchNormalize){$items=$items.filter(":a"+that._searchStyle()+"("+normalizeToBase(keyCodeMap[e.keyCode])+")")}else{$items=$items.filter(":"+that._searchStyle()+"("+keyCodeMap[e.keyCode]+")")}}}}if(!$items.length)return;if(/(38|40)/.test(e.keyCode.toString(10))){index=$items.index($items.find("a").filter(":focus").parent());first=$items.filter(selector).first().index();last=$items.filter(selector).last().index();next=$items.eq(index).nextAll(selector).eq(0).index();prev=$items.eq(index).prevAll(selector).eq(0).index();nextPrev=$items.eq(next).prevAll(selector).eq(0).index();if(that.options.liveSearch){$items.each(function(i){if(!$(this).hasClass("disabled")){$(this).data("index",i)}});index=$items.index($items.filter(".active"));first=$items.first().data("index");last=$items.last().data("index");next=$items.eq(index).nextAll().eq(0).data("index");prev=$items.eq(index).prevAll().eq(0).data("index");nextPrev=$items.eq(next).prevAll().eq(0).data("index")}prevIndex=$this.data("prevIndex");if(e.keyCode==38){if(that.options.liveSearch)index--;if(index!=nextPrev&&index>prev)index=prev;if(indexlast)index=last;if(index==prevIndex)index=first}$this.data("prevIndex",index);if(!that.options.liveSearch){$items.eq(index).children("a").focus()}else{e.preventDefault();if(!$this.hasClass("dropdown-toggle")){$items.removeClass("active").eq(index).addClass("active").children("a").focus();$this.focus()}}}else if(!$this.is("input")){var keyIndex=[],count,prevKey;$items.each(function(){if(!$(this).hasClass("disabled")){if($.trim($(this).children("a").text().toLowerCase()).substring(0,1)==keyCodeMap[e.keyCode]){keyIndex.push($(this).index())}}});count=$(document).data("keycount");count++;$(document).data("keycount",count);prevKey=$.trim($(":focus").text().toLowerCase()).substring(0,1);if(prevKey!=keyCodeMap[e.keyCode]){count=1;$(document).data("keycount",count)}else if(count>=keyIndex.length){$(document).data("keycount",0);if(count>keyIndex.length)count=1}$items.eq(keyIndex[count-1]).children("a").focus()}if((/(13|32)/.test(e.keyCode.toString(10))||/(^9$)/.test(e.keyCode.toString(10))&&that.options.selectOnTab)&&isActive){if(!/(32)/.test(e.keyCode.toString(10)))e.preventDefault();if(!that.options.liveSearch){var elem=$(":focus");elem.click();elem.focus();e.preventDefault();$(document).data("spaceSelect",true)}else if(!/(32)/.test(e.keyCode.toString(10))){that.$menuInner.find(".active a").click();$this.focus()}$(document).data("keycount",0)}if(/(^9$|27)/.test(e.keyCode.toString(10))&&isActive&&(that.multiple||that.options.liveSearch)||/(27)/.test(e.keyCode.toString(10))&&!isActive){that.$menu.parent().removeClass("open");if(that.options.container)that.$newElement.removeClass("open");that.$button.focus()}},mobile:function(){this.$element.addClass("mobile-device")},refresh:function(){this.$lis=null;this.liObj={};this.reloadLi();this.render();this.checkDisabled();this.liHeight(true);this.setStyle();this.setWidth();if(this.$lis)this.$searchbox.trigger("propertychange");this.$element.trigger("refreshed.bs.select")},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove();this.$element.remove()},destroy:function(){this.$newElement.before(this.$element).remove();if(this.$bsContainer){this.$bsContainer.remove()}else{this.$menu.remove()}this.$element.off(".bs.select").removeData("selectpicker").removeClass("bs-select-hidden selectpicker")}};function Plugin(option){var args=arguments;var _option=option;[].shift.apply(args);var value;var chain=this.each(function(){var $this=$(this);if($this.is("select")){var data=$this.data("selectpicker"),options=typeof _option=="object"&&_option;if(!data){var config=$.extend({},Selectpicker.DEFAULTS,$.fn.selectpicker.defaults||{},$this.data(),options);config.template=$.extend({},Selectpicker.DEFAULTS.template,$.fn.selectpicker.defaults?$.fn.selectpicker.defaults.template:{},$this.data().template,options.template);$this.data("selectpicker",data=new Selectpicker(this,config))}else if(options){for(var i in options){if(options.hasOwnProperty(i)){data.options[i]=options[i]}}}if(typeof _option=="string"){if(data[_option]instanceof Function){value=data[_option].apply(data,args)}else{value=data.options[_option]}}}});if(typeof value!=="undefined"){return value}else{return chain}}var old=$.fn.selectpicker;$.fn.selectpicker=Plugin;$.fn.selectpicker.Constructor=Selectpicker;$.fn.selectpicker.noConflict=function(){$.fn.selectpicker=old;return this};$(document).data("keycount",0).on("keydown.bs.select",'.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="listbox"], .bs-searchbox input',Selectpicker.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="listbox"], .bs-searchbox input',function(e){e.stopPropagation()});$(window).on("load.bs.select.data-api",function(){$(".selectpicker").each(function(){var $selectpicker=$(this);Plugin.call($selectpicker,$selectpicker.data())})})})(jQuery)})},{jquery:140}],4:[function(require,module,exports){require("../../js/transition.js");require("../../js/alert.js");require("../../js/button.js");require("../../js/carousel.js");require("../../js/collapse.js");require("../../js/dropdown.js");require("../../js/modal.js");require("../../js/tooltip.js");require("../../js/popover.js");require("../../js/scrollspy.js");require("../../js/tab.js");require("../../js/affix.js")},{"../../js/affix.js":5,"../../js/alert.js":6,"../../js/button.js":7,"../../js/carousel.js":8,"../../js/collapse.js":9,"../../js/dropdown.js":10,"../../js/modal.js":11,"../../js/popover.js":12,"../../js/scrollspy.js":13,"../../js/tab.js":14,"../../js/tooltip.js":15,"../../js/transition.js":16}],5:[function(require,module,exports){+function($){"use strict";var Affix=function(element,options){this.options=$.extend({},Affix.DEFAULTS,options);this.$target=$(this.options.target).on("scroll.bs.affix.data-api",$.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",$.proxy(this.checkPositionWithEventLoop,this));this.$element=$(element);this.affixed=null;this.unpin=null;this.pinnedOffset=null;this.checkPosition()};Affix.VERSION="3.3.7";Affix.RESET="affix affix-top affix-bottom";Affix.DEFAULTS={offset:0,target:window};Affix.prototype.getState=function(scrollHeight,height,offsetTop,offsetBottom){var scrollTop=this.$target.scrollTop();var position=this.$element.offset();var targetHeight=this.$target.height();if(offsetTop!=null&&this.affixed=="top")return scrollTop=scrollHeight-offsetBottom)return"bottom";return false};Affix.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(Affix.RESET).addClass("affix");var scrollTop=this.$target.scrollTop();var position=this.$element.offset();return this.pinnedOffset=position.top-scrollTop};Affix.prototype.checkPositionWithEventLoop=function(){setTimeout($.proxy(this.checkPosition,this),1)};Affix.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var height=this.$element.height();var offset=this.options.offset;var offsetTop=offset.top;var offsetBottom=offset.bottom;var scrollHeight=Math.max($(document).height(),$(document.body).height());if(typeof offset!="object")offsetBottom=offsetTop=offset;if(typeof offsetTop=="function")offsetTop=offset.top(this.$element);if(typeof offsetBottom=="function")offsetBottom=offset.bottom(this.$element);var affix=this.getState(scrollHeight,height,offsetTop,offsetBottom);if(this.affixed!=affix){if(this.unpin!=null)this.$element.css("top","");var affixType="affix"+(affix?"-"+affix:"");var e=$.Event(affixType+".bs.affix");this.$element.trigger(e);if(e.isDefaultPrevented())return;this.affixed=affix;this.unpin=affix=="bottom"?this.getPinnedOffset():null;this.$element.removeClass(Affix.RESET).addClass(affixType).trigger(affixType.replace("affix","affixed")+".bs.affix")}if(affix=="bottom"){this.$element.offset({top:scrollHeight-height-offsetBottom})}};function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.affix");var options=typeof option=="object"&&option;if(!data)$this.data("bs.affix",data=new Affix(this,options));if(typeof option=="string")data[option]()})}var old=$.fn.affix;$.fn.affix=Plugin;$.fn.affix.Constructor=Affix;$.fn.affix.noConflict=function(){$.fn.affix=old;return this};$(window).on("load",function(){$('[data-spy="affix"]').each(function(){var $spy=$(this);var data=$spy.data();data.offset=data.offset||{};if(data.offsetBottom!=null)data.offset.bottom=data.offsetBottom;if(data.offsetTop!=null)data.offset.top=data.offsetTop;Plugin.call($spy,data)})})}(jQuery)},{}],6:[function(require,module,exports){+function($){"use strict";var dismiss='[data-dismiss="alert"]';var Alert=function(el){$(el).on("click",dismiss,this.close)};Alert.VERSION="3.3.7";Alert.TRANSITION_DURATION=150;Alert.prototype.close=function(e){var $this=$(this);var selector=$this.attr("data-target");if(!selector){selector=$this.attr("href");selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,"")}var $parent=$(selector==="#"?[]:selector);if(e)e.preventDefault();if(!$parent.length){$parent=$this.closest(".alert")}$parent.trigger(e=$.Event("close.bs.alert"));if(e.isDefaultPrevented())return;$parent.removeClass("in");function removeElement(){$parent.detach().trigger("closed.bs.alert").remove()}$.support.transition&&$parent.hasClass("fade")?$parent.one("bsTransitionEnd",removeElement).emulateTransitionEnd(Alert.TRANSITION_DURATION):removeElement()};function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.alert");if(!data)$this.data("bs.alert",data=new Alert(this));if(typeof option=="string")data[option].call($this)})}var old=$.fn.alert;$.fn.alert=Plugin;$.fn.alert.Constructor=Alert;$.fn.alert.noConflict=function(){$.fn.alert=old;return this};$(document).on("click.bs.alert.data-api",dismiss,Alert.prototype.close)}(jQuery)},{}],7:[function(require,module,exports){+function($){"use strict";var Button=function(element,options){this.$element=$(element);this.options=$.extend({},Button.DEFAULTS,options);this.isLoading=false};Button.VERSION="3.3.7";Button.DEFAULTS={loadingText:"loading..."};Button.prototype.setState=function(state){var d="disabled";var $el=this.$element;var val=$el.is("input")?"val":"html";var data=$el.data();state+="Text";if(data.resetText==null)$el.data("resetText",$el[val]());setTimeout($.proxy(function(){$el[val](data[state]==null?this.options[state]:data[state]);if(state=="loadingText"){this.isLoading=true;$el.addClass(d).attr(d,d).prop(d,true)}else if(this.isLoading){this.isLoading=false;$el.removeClass(d).removeAttr(d).prop(d,false)}},this),0)};Button.prototype.toggle=function(){var changed=true;var $parent=this.$element.closest('[data-toggle="buttons"]');if($parent.length){var $input=this.$element.find("input");if($input.prop("type")=="radio"){if($input.prop("checked"))changed=false;$parent.find(".active").removeClass("active");this.$element.addClass("active")}else if($input.prop("type")=="checkbox"){if($input.prop("checked")!==this.$element.hasClass("active"))changed=false;this.$element.toggleClass("active")}$input.prop("checked",this.$element.hasClass("active"));if(changed)$input.trigger("change")}else{this.$element.attr("aria-pressed",!this.$element.hasClass("active"));this.$element.toggleClass("active")}};function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.button");var options=typeof option=="object"&&option;if(!data)$this.data("bs.button",data=new Button(this,options));if(option=="toggle")data.toggle();else if(option)data.setState(option)})}var old=$.fn.button;$.fn.button=Plugin;$.fn.button.Constructor=Button;$.fn.button.noConflict=function(){$.fn.button=old;return this};$(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(e){var $btn=$(e.target).closest(".btn");Plugin.call($btn,"toggle");if(!$(e.target).is('input[type="radio"], input[type="checkbox"]')){e.preventDefault();if($btn.is("input,button"))$btn.trigger("focus");else $btn.find("input:visible,button:visible").first().trigger("focus")}}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(e){$(e.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(e.type))})}(jQuery)},{}],8:[function(require,module,exports){+function($){"use strict";var Carousel=function(element,options){this.$element=$(element);this.$indicators=this.$element.find(".carousel-indicators");this.options=options;this.paused=null;this.sliding=null;this.interval=null;this.$active=null;this.$items=null;this.options.keyboard&&this.$element.on("keydown.bs.carousel",$.proxy(this.keydown,this));this.options.pause=="hover"&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",$.proxy(this.pause,this)).on("mouseleave.bs.carousel",$.proxy(this.cycle,this))};Carousel.VERSION="3.3.7";Carousel.TRANSITION_DURATION=600;Carousel.DEFAULTS={interval:5e3,pause:"hover",wrap:true,keyboard:true};Carousel.prototype.keydown=function(e){if(/input|textarea/i.test(e.target.tagName))return;switch(e.which){case 37:this.prev();break;case 39:this.next();break;default:return}e.preventDefault()};Carousel.prototype.cycle=function(e){e||(this.paused=false);this.interval&&clearInterval(this.interval);this.options.interval&&!this.paused&&(this.interval=setInterval($.proxy(this.next,this),this.options.interval));return this};Carousel.prototype.getItemIndex=function(item){this.$items=item.parent().children(".item");return this.$items.index(item||this.$active)};Carousel.prototype.getItemForDirection=function(direction,active){var activeIndex=this.getItemIndex(active);var willWrap=direction=="prev"&&activeIndex===0||direction=="next"&&activeIndex==this.$items.length-1;if(willWrap&&!this.options.wrap)return active;var delta=direction=="prev"?-1:1;var itemIndex=(activeIndex+delta)%this.$items.length;return this.$items.eq(itemIndex)};Carousel.prototype.to=function(pos){var that=this;var activeIndex=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(pos>this.$items.length-1||pos<0)return;if(this.sliding)return this.$element.one("slid.bs.carousel",function(){that.to(pos)});if(activeIndex==pos)return this.pause().cycle();return this.slide(pos>activeIndex?"next":"prev",this.$items.eq(pos))};Carousel.prototype.pause=function(e){e||(this.paused=true);if(this.$element.find(".next, .prev").length&&$.support.transition){this.$element.trigger($.support.transition.end);this.cycle(true)}this.interval=clearInterval(this.interval);return this};Carousel.prototype.next=function(){if(this.sliding)return;return this.slide("next")};Carousel.prototype.prev=function(){if(this.sliding)return;return this.slide("prev")};Carousel.prototype.slide=function(type,next){var $active=this.$element.find(".item.active");var $next=next||this.getItemForDirection(type,$active);var isCycling=this.interval;var direction=type=="next"?"left":"right";var that=this;if($next.hasClass("active"))return this.sliding=false;var relatedTarget=$next[0];var slideEvent=$.Event("slide.bs.carousel",{ relatedTarget:relatedTarget,direction:direction});this.$element.trigger(slideEvent);if(slideEvent.isDefaultPrevented())return;this.sliding=true;isCycling&&this.pause();if(this.$indicators.length){this.$indicators.find(".active").removeClass("active");var $nextIndicator=$(this.$indicators.children()[this.getItemIndex($next)]);$nextIndicator&&$nextIndicator.addClass("active")}var slidEvent=$.Event("slid.bs.carousel",{relatedTarget:relatedTarget,direction:direction});if($.support.transition&&this.$element.hasClass("slide")){$next.addClass(type);$next[0].offsetWidth;$active.addClass(direction);$next.addClass(direction);$active.one("bsTransitionEnd",function(){$next.removeClass([type,direction].join(" ")).addClass("active");$active.removeClass(["active",direction].join(" "));that.sliding=false;setTimeout(function(){that.$element.trigger(slidEvent)},0)}).emulateTransitionEnd(Carousel.TRANSITION_DURATION)}else{$active.removeClass("active");$next.addClass("active");this.sliding=false;this.$element.trigger(slidEvent)}isCycling&&this.cycle();return this};function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.carousel");var options=$.extend({},Carousel.DEFAULTS,$this.data(),typeof option=="object"&&option);var action=typeof option=="string"?option:options.slide;if(!data)$this.data("bs.carousel",data=new Carousel(this,options));if(typeof option=="number")data.to(option);else if(action)data[action]();else if(options.interval)data.pause().cycle()})}var old=$.fn.carousel;$.fn.carousel=Plugin;$.fn.carousel.Constructor=Carousel;$.fn.carousel.noConflict=function(){$.fn.carousel=old;return this};var clickHandler=function(e){var href;var $this=$(this);var $target=$($this.attr("data-target")||(href=$this.attr("href"))&&href.replace(/.*(?=#[^\s]+$)/,""));if(!$target.hasClass("carousel"))return;var options=$.extend({},$target.data(),$this.data());var slideIndex=$this.attr("data-slide-to");if(slideIndex)options.interval=false;Plugin.call($target,options);if(slideIndex){$target.data("bs.carousel").to(slideIndex)}e.preventDefault()};$(document).on("click.bs.carousel.data-api","[data-slide]",clickHandler).on("click.bs.carousel.data-api","[data-slide-to]",clickHandler);$(window).on("load",function(){$('[data-ride="carousel"]').each(function(){var $carousel=$(this);Plugin.call($carousel,$carousel.data())})})}(jQuery)},{}],9:[function(require,module,exports){+function($){"use strict";var Collapse=function(element,options){this.$element=$(element);this.options=$.extend({},Collapse.DEFAULTS,options);this.$trigger=$('[data-toggle="collapse"][href="#'+element.id+'"],'+'[data-toggle="collapse"][data-target="#'+element.id+'"]');this.transitioning=null;if(this.options.parent){this.$parent=this.getParent()}else{this.addAriaAndCollapsedClass(this.$element,this.$trigger)}if(this.options.toggle)this.toggle()};Collapse.VERSION="3.3.7";Collapse.TRANSITION_DURATION=350;Collapse.DEFAULTS={toggle:true};Collapse.prototype.dimension=function(){var hasWidth=this.$element.hasClass("width");return hasWidth?"width":"height"};Collapse.prototype.show=function(){if(this.transitioning||this.$element.hasClass("in"))return;var activesData;var actives=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(actives&&actives.length){activesData=actives.data("bs.collapse");if(activesData&&activesData.transitioning)return}var startEvent=$.Event("show.bs.collapse");this.$element.trigger(startEvent);if(startEvent.isDefaultPrevented())return;if(actives&&actives.length){Plugin.call(actives,"hide");activesData||actives.data("bs.collapse",null)}var dimension=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[dimension](0).attr("aria-expanded",true);this.$trigger.removeClass("collapsed").attr("aria-expanded",true);this.transitioning=1;var complete=function(){this.$element.removeClass("collapsing").addClass("collapse in")[dimension]("");this.transitioning=0;this.$element.trigger("shown.bs.collapse")};if(!$.support.transition)return complete.call(this);var scrollSize=$.camelCase(["scroll",dimension].join("-"));this.$element.one("bsTransitionEnd",$.proxy(complete,this)).emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])};Collapse.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass("in"))return;var startEvent=$.Event("hide.bs.collapse");this.$element.trigger(startEvent);if(startEvent.isDefaultPrevented())return;var dimension=this.dimension();this.$element[dimension](this.$element[dimension]())[0].offsetHeight;this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",false);this.$trigger.addClass("collapsed").attr("aria-expanded",false);this.transitioning=1;var complete=function(){this.transitioning=0;this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!$.support.transition)return complete.call(this);this.$element[dimension](0).one("bsTransitionEnd",$.proxy(complete,this)).emulateTransitionEnd(Collapse.TRANSITION_DURATION)};Collapse.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};Collapse.prototype.getParent=function(){return $(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each($.proxy(function(i,element){var $element=$(element);this.addAriaAndCollapsedClass(getTargetFromTrigger($element),$element)},this)).end()};Collapse.prototype.addAriaAndCollapsedClass=function($element,$trigger){var isOpen=$element.hasClass("in");$element.attr("aria-expanded",isOpen);$trigger.toggleClass("collapsed",!isOpen).attr("aria-expanded",isOpen)};function getTargetFromTrigger($trigger){var href;var target=$trigger.attr("data-target")||(href=$trigger.attr("href"))&&href.replace(/.*(?=#[^\s]+$)/,"");return $(target)}function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.collapse");var options=$.extend({},Collapse.DEFAULTS,$this.data(),typeof option=="object"&&option);if(!data&&options.toggle&&/show|hide/.test(option))options.toggle=false;if(!data)$this.data("bs.collapse",data=new Collapse(this,options));if(typeof option=="string")data[option]()})}var old=$.fn.collapse;$.fn.collapse=Plugin;$.fn.collapse.Constructor=Collapse;$.fn.collapse.noConflict=function(){$.fn.collapse=old;return this};$(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(e){var $this=$(this);if(!$this.attr("data-target"))e.preventDefault();var $target=getTargetFromTrigger($this);var data=$target.data("bs.collapse");var option=data?"toggle":$this.data();Plugin.call($target,option)})}(jQuery)},{}],10:[function(require,module,exports){+function($){"use strict";var backdrop=".dropdown-backdrop";var toggle='[data-toggle="dropdown"]';var Dropdown=function(element){$(element).on("click.bs.dropdown",this.toggle)};Dropdown.VERSION="3.3.7";function getParent($this){var selector=$this.attr("data-target");if(!selector){selector=$this.attr("href");selector=selector&&/#[A-Za-z]/.test(selector)&&selector.replace(/.*(?=#[^\s]*$)/,"")}var $parent=selector&&$(selector);return $parent&&$parent.length?$parent:$this.parent()}function clearMenus(e){if(e&&e.which===3)return;$(backdrop).remove();$(toggle).each(function(){var $this=$(this);var $parent=getParent($this);var relatedTarget={relatedTarget:this};if(!$parent.hasClass("open"))return;if(e&&e.type=="click"&&/input|textarea/i.test(e.target.tagName)&&$.contains($parent[0],e.target))return;$parent.trigger(e=$.Event("hide.bs.dropdown",relatedTarget));if(e.isDefaultPrevented())return;$this.attr("aria-expanded","false");$parent.removeClass("open").trigger($.Event("hidden.bs.dropdown",relatedTarget))})}Dropdown.prototype.toggle=function(e){var $this=$(this);if($this.is(".disabled, :disabled"))return;var $parent=getParent($this);var isActive=$parent.hasClass("open");clearMenus();if(!isActive){if("ontouchstart"in document.documentElement&&!$parent.closest(".navbar-nav").length){$(document.createElement("div")).addClass("dropdown-backdrop").insertAfter($(this)).on("click",clearMenus)}var relatedTarget={relatedTarget:this};$parent.trigger(e=$.Event("show.bs.dropdown",relatedTarget));if(e.isDefaultPrevented())return;$this.trigger("focus").attr("aria-expanded","true");$parent.toggleClass("open").trigger($.Event("shown.bs.dropdown",relatedTarget))}return false};Dropdown.prototype.keydown=function(e){if(!/(38|40|27|32)/.test(e.which)||/input|textarea/i.test(e.target.tagName))return;var $this=$(this);e.preventDefault();e.stopPropagation();if($this.is(".disabled, :disabled"))return;var $parent=getParent($this);var isActive=$parent.hasClass("open");if(!isActive&&e.which!=27||isActive&&e.which==27){if(e.which==27)$parent.find(toggle).trigger("focus");return $this.trigger("click")}var desc=" li:not(.disabled):visible a";var $items=$parent.find(".dropdown-menu"+desc);if(!$items.length)return;var index=$items.index(e.target);if(e.which==38&&index>0)index--;if(e.which==40&&index<$items.length-1)index++;if(!~index)index=0;$items.eq(index).trigger("focus")};function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.dropdown");if(!data)$this.data("bs.dropdown",data=new Dropdown(this));if(typeof option=="string")data[option].call($this)})}var old=$.fn.dropdown;$.fn.dropdown=Plugin;$.fn.dropdown.Constructor=Dropdown;$.fn.dropdown.noConflict=function(){$.fn.dropdown=old;return this};$(document).on("click.bs.dropdown.data-api",clearMenus).on("click.bs.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.bs.dropdown.data-api",toggle,Dropdown.prototype.toggle).on("keydown.bs.dropdown.data-api",toggle,Dropdown.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",Dropdown.prototype.keydown)}(jQuery)},{}],11:[function(require,module,exports){+function($){"use strict";var Modal=function(element,options){this.options=options;this.$body=$(document.body);this.$element=$(element);this.$dialog=this.$element.find(".modal-dialog");this.$backdrop=null;this.isShown=null;this.originalBodyPad=null;this.scrollbarWidth=0;this.ignoreBackdropClick=false;if(this.options.remote){this.$element.find(".modal-content").load(this.options.remote,$.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))}};Modal.VERSION="3.3.7";Modal.TRANSITION_DURATION=300;Modal.BACKDROP_TRANSITION_DURATION=150;Modal.DEFAULTS={backdrop:true,keyboard:true,show:true};Modal.prototype.toggle=function(_relatedTarget){return this.isShown?this.hide():this.show(_relatedTarget)};Modal.prototype.show=function(_relatedTarget){var that=this;var e=$.Event("show.bs.modal",{relatedTarget:_relatedTarget});this.$element.trigger(e);if(this.isShown||e.isDefaultPrevented())return;this.isShown=true;this.checkScrollbar();this.setScrollbar();this.$body.addClass("modal-open");this.escape();this.resize();this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',$.proxy(this.hide,this));this.$dialog.on("mousedown.dismiss.bs.modal",function(){that.$element.one("mouseup.dismiss.bs.modal",function(e){if($(e.target).is(that.$element))that.ignoreBackdropClick=true})});this.backdrop(function(){var transition=$.support.transition&&that.$element.hasClass("fade");if(!that.$element.parent().length){that.$element.appendTo(that.$body)}that.$element.show().scrollTop(0);that.adjustDialog();if(transition){that.$element[0].offsetWidth}that.$element.addClass("in");that.enforceFocus();var e=$.Event("shown.bs.modal",{relatedTarget:_relatedTarget});transition?that.$dialog.one("bsTransitionEnd",function(){that.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(Modal.TRANSITION_DURATION):that.$element.trigger("focus").trigger(e)})};Modal.prototype.hide=function(e){if(e)e.preventDefault();e=$.Event("hide.bs.modal");this.$element.trigger(e);if(!this.isShown||e.isDefaultPrevented())return;this.isShown=false;this.escape();this.resize();$(document).off("focusin.bs.modal");this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal");this.$dialog.off("mousedown.dismiss.bs.modal");$.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",$.proxy(this.hideModal,this)).emulateTransitionEnd(Modal.TRANSITION_DURATION):this.hideModal()};Modal.prototype.enforceFocus=function(){$(document).off("focusin.bs.modal").on("focusin.bs.modal",$.proxy(function(e){if(document!==e.target&&this.$element[0]!==e.target&&!this.$element.has(e.target).length){this.$element.trigger("focus")}},this))};Modal.prototype.escape=function(){if(this.isShown&&this.options.keyboard){this.$element.on("keydown.dismiss.bs.modal",$.proxy(function(e){e.which==27&&this.hide()},this))}else if(!this.isShown){this.$element.off("keydown.dismiss.bs.modal")}};Modal.prototype.resize=function(){if(this.isShown){$(window).on("resize.bs.modal",$.proxy(this.handleUpdate,this))}else{$(window).off("resize.bs.modal")}};Modal.prototype.hideModal=function(){var that=this;this.$element.hide();this.backdrop(function(){that.$body.removeClass("modal-open");that.resetAdjustments();that.resetScrollbar();that.$element.trigger("hidden.bs.modal")})};Modal.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove();this.$backdrop=null};Modal.prototype.backdrop=function(callback){var that=this;var animate=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var doAnimate=$.support.transition&&animate;this.$backdrop=$(document.createElement("div")).addClass("modal-backdrop "+animate).appendTo(this.$body);this.$element.on("click.dismiss.bs.modal",$.proxy(function(e){if(this.ignoreBackdropClick){this.ignoreBackdropClick=false;return}if(e.target!==e.currentTarget)return;this.options.backdrop=="static"?this.$element[0].focus():this.hide()},this));if(doAnimate)this.$backdrop[0].offsetWidth;this.$backdrop.addClass("in");if(!callback)return;doAnimate?this.$backdrop.one("bsTransitionEnd",callback).emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION):callback()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var callbackRemove=function(){that.removeBackdrop();callback&&callback()};$.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",callbackRemove).emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION):callbackRemove()}else if(callback){callback()}};Modal.prototype.handleUpdate=function(){this.adjustDialog()};Modal.prototype.adjustDialog=function(){var modalIsOverflowing=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&modalIsOverflowing?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!modalIsOverflowing?this.scrollbarWidth:""})};Modal.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})};Modal.prototype.checkScrollbar=function(){var fullWindowWidth=window.innerWidth;if(!fullWindowWidth){var documentElementRect=document.documentElement.getBoundingClientRect();fullWindowWidth=documentElementRect.right-Math.abs(documentElementRect.left)}this.bodyIsOverflowing=document.body.clientWidth

    '});Popover.prototype=$.extend({},$.fn.tooltip.Constructor.prototype);Popover.prototype.constructor=Popover;Popover.prototype.getDefaults=function(){return Popover.DEFAULTS};Popover.prototype.setContent=function(){var $tip=this.tip();var title=this.getTitle();var content=this.getContent();$tip.find(".popover-title")[this.options.html?"html":"text"](title);$tip.find(".popover-content").children().detach().end()[this.options.html?typeof content=="string"?"html":"append":"text"](content);$tip.removeClass("fade top bottom left right in");if(!$tip.find(".popover-title").html())$tip.find(".popover-title").hide()};Popover.prototype.hasContent=function(){return this.getTitle()||this.getContent()};Popover.prototype.getContent=function(){var $e=this.$element;var o=this.options;return $e.attr("data-content")||(typeof o.content=="function"?o.content.call($e[0]):o.content)};Popover.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.popover");var options=typeof option=="object"&&option;if(!data&&/destroy|hide/.test(option))return;if(!data)$this.data("bs.popover",data=new Popover(this,options));if(typeof option=="string")data[option]()})}var old=$.fn.popover;$.fn.popover=Plugin;$.fn.popover.Constructor=Popover;$.fn.popover.noConflict=function(){$.fn.popover=old;return this}}(jQuery)},{}],13:[function(require,module,exports){+function($){"use strict";function ScrollSpy(element,options){this.$body=$(document.body);this.$scrollElement=$(element).is(document.body)?$(window):$(element);this.options=$.extend({},ScrollSpy.DEFAULTS,options);this.selector=(this.options.target||"")+" .nav li > a";this.offsets=[];this.targets=[];this.activeTarget=null;this.scrollHeight=0;this.$scrollElement.on("scroll.bs.scrollspy",$.proxy(this.process,this));this.refresh();this.process()}ScrollSpy.VERSION="3.3.7";ScrollSpy.DEFAULTS={offset:10};ScrollSpy.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)};ScrollSpy.prototype.refresh=function(){var that=this;var offsetMethod="offset";var offsetBase=0;this.offsets=[];this.targets=[];this.scrollHeight=this.getScrollHeight();if(!$.isWindow(this.$scrollElement[0])){offsetMethod="position";offsetBase=this.$scrollElement.scrollTop()}this.$body.find(this.selector).map(function(){var $el=$(this);var href=$el.data("target")||$el.attr("href");var $href=/^#./.test(href)&&$(href);return $href&&$href.length&&$href.is(":visible")&&[[$href[offsetMethod]().top+offsetBase,href]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){that.offsets.push(this[0]);that.targets.push(this[1])})};ScrollSpy.prototype.process=function(){var scrollTop=this.$scrollElement.scrollTop()+this.options.offset;var scrollHeight=this.getScrollHeight();var maxScroll=this.options.offset+scrollHeight-this.$scrollElement.height();var offsets=this.offsets;var targets=this.targets;var activeTarget=this.activeTarget;var i;if(this.scrollHeight!=scrollHeight){this.refresh()}if(scrollTop>=maxScroll){return activeTarget!=(i=targets[targets.length-1])&&this.activate(i)}if(activeTarget&&scrollTop=offsets[i]&&(offsets[i+1]===undefined||scrollTop .active");var transition=callback&&$.support.transition&&($active.length&&$active.hasClass("fade")||!!container.find("> .fade").length);function next(){$active.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",false);element.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",true);if(transition){element[0].offsetWidth;element.addClass("in")}else{element.removeClass("fade")}if(element.parent(".dropdown-menu").length){element.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",true)}callback&&callback()}$active.length&&transition?$active.one("bsTransitionEnd",next).emulateTransitionEnd(Tab.TRANSITION_DURATION):next();$active.removeClass("in")};function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.tab");if(!data)$this.data("bs.tab",data=new Tab(this));if(typeof option=="string")data[option]()})}var old=$.fn.tab;$.fn.tab=Plugin;$.fn.tab.Constructor=Tab;$.fn.tab.noConflict=function(){$.fn.tab=old;return this};var clickHandler=function(e){e.preventDefault();Plugin.call($(this),"show")};$(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',clickHandler).on("click.bs.tab.data-api",'[data-toggle="pill"]',clickHandler)}(jQuery)},{}],15:[function(require,module,exports){+function($){"use strict";var Tooltip=function(element,options){this.type=null;this.options=null;this.enabled=null;this.timeout=null;this.hoverState=null;this.$element=null;this.inState=null;this.init("tooltip",element,options)};Tooltip.VERSION="3.3.7";Tooltip.TRANSITION_DURATION=150;Tooltip.DEFAULTS={animation:true,placement:"top",selector:false,template:'',trigger:"hover focus",title:"",delay:0,html:false,container:false,viewport:{selector:"body",padding:0}};Tooltip.prototype.init=function(type,element,options){this.enabled=true;this.type=type;this.$element=$(element);this.options=this.getOptions(options);this.$viewport=this.options.viewport&&$($.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport);this.inState={click:false,hover:false,focus:false};if(this.$element[0]instanceof document.constructor&&!this.options.selector){throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!")}var triggers=this.options.trigger.split(" ");for(var i=triggers.length;i--;){var trigger=triggers[i];if(trigger=="click"){this.$element.on("click."+this.type,this.options.selector,$.proxy(this.toggle,this))}else if(trigger!="manual"){var eventIn=trigger=="hover"?"mouseenter":"focusin";var eventOut=trigger=="hover"?"mouseleave":"focusout";this.$element.on(eventIn+"."+this.type,this.options.selector,$.proxy(this.enter,this));this.$element.on(eventOut+"."+this.type,this.options.selector,$.proxy(this.leave,this))}}this.options.selector?this._options=$.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()};Tooltip.prototype.getDefaults=function(){return Tooltip.DEFAULTS};Tooltip.prototype.getOptions=function(options){options=$.extend({},this.getDefaults(),this.$element.data(),options);if(options.delay&&typeof options.delay=="number"){options.delay={show:options.delay,hide:options.delay}}return options};Tooltip.prototype.getDelegateOptions=function(){var options={};var defaults=this.getDefaults();this._options&&$.each(this._options,function(key,value){if(defaults[key]!=value)options[key]=value});return options};Tooltip.prototype.enter=function(obj){var self=obj instanceof this.constructor?obj:$(obj.currentTarget).data("bs."+this.type);if(!self){self=new this.constructor(obj.currentTarget,this.getDelegateOptions());$(obj.currentTarget).data("bs."+this.type,self)}if(obj instanceof $.Event){self.inState[obj.type=="focusin"?"focus":"hover"]=true}if(self.tip().hasClass("in")||self.hoverState=="in"){self.hoverState="in";return}clearTimeout(self.timeout);self.hoverState="in";if(!self.options.delay||!self.options.delay.show)return self.show();self.timeout=setTimeout(function(){if(self.hoverState=="in")self.show()},self.options.delay.show)};Tooltip.prototype.isInStateTrue=function(){for(var key in this.inState){if(this.inState[key])return true}return false};Tooltip.prototype.leave=function(obj){var self=obj instanceof this.constructor?obj:$(obj.currentTarget).data("bs."+this.type);if(!self){self=new this.constructor(obj.currentTarget,this.getDelegateOptions());$(obj.currentTarget).data("bs."+this.type,self)}if(obj instanceof $.Event){self.inState[obj.type=="focusout"?"focus":"hover"]=false}if(self.isInStateTrue())return;clearTimeout(self.timeout);self.hoverState="out";if(!self.options.delay||!self.options.delay.hide)return self.hide();self.timeout=setTimeout(function(){if(self.hoverState=="out")self.hide()},self.options.delay.hide)};Tooltip.prototype.show=function(){var e=$.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var inDom=$.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!inDom)return;var that=this;var $tip=this.tip();var tipId=this.getUID(this.type);this.setContent();$tip.attr("id",tipId);this.$element.attr("aria-describedby",tipId);if(this.options.animation)$tip.addClass("fade");var placement=typeof this.options.placement=="function"?this.options.placement.call(this,$tip[0],this.$element[0]):this.options.placement;var autoToken=/\s?auto?\s?/i;var autoPlace=autoToken.test(placement);if(autoPlace)placement=placement.replace(autoToken,"")||"top";$tip.detach().css({top:0,left:0,display:"block"}).addClass(placement).data("bs."+this.type,this);this.options.container?$tip.appendTo(this.options.container):$tip.insertAfter(this.$element);this.$element.trigger("inserted.bs."+this.type);var pos=this.getPosition();var actualWidth=$tip[0].offsetWidth;var actualHeight=$tip[0].offsetHeight;if(autoPlace){var orgPlacement=placement;var viewportDim=this.getPosition(this.$viewport);placement=placement=="bottom"&&pos.bottom+actualHeight>viewportDim.bottom?"top":placement=="top"&&pos.top-actualHeightviewportDim.width?"left":placement=="left"&&pos.left-actualWidthviewportDimensions.top+viewportDimensions.height){delta.top=viewportDimensions.top+viewportDimensions.height-bottomEdgeOffset}}else{var leftEdgeOffset=pos.left-viewportPadding;var rightEdgeOffset=pos.left+viewportPadding+actualWidth;if(leftEdgeOffsetviewportDimensions.right){delta.left=viewportDimensions.left+viewportDimensions.width-rightEdgeOffset}}return delta};Tooltip.prototype.getTitle=function(){var title;var $e=this.$element;var o=this.options;title=$e.attr("data-original-title")||(typeof o.title=="function"?o.title.call($e[0]):o.title);return title};Tooltip.prototype.getUID=function(prefix){do prefix+=~~(Math.random()*1e6);while(document.getElementById(prefix));return prefix};Tooltip.prototype.tip=function(){if(!this.$tip){this.$tip=$(this.options.template);if(this.$tip.length!=1){throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!")}}return this.$tip};Tooltip.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")};Tooltip.prototype.enable=function(){this.enabled=true};Tooltip.prototype.disable=function(){this.enabled=false};Tooltip.prototype.toggleEnabled=function(){this.enabled=!this.enabled};Tooltip.prototype.toggle=function(e){var self=this;if(e){self=$(e.currentTarget).data("bs."+this.type);if(!self){self=new this.constructor(e.currentTarget,this.getDelegateOptions());$(e.currentTarget).data("bs."+this.type,self)}}if(e){self.inState.click=!self.inState.click;if(self.isInStateTrue())self.enter(self);else self.leave(self)}else{self.tip().hasClass("in")?self.leave(self):self.enter(self)}};Tooltip.prototype.destroy=function(){var that=this;clearTimeout(this.timeout);this.hide(function(){that.$element.off("."+that.type).removeData("bs."+that.type);if(that.$tip){that.$tip.detach()}that.$tip=null;that.$arrow=null;that.$viewport=null;that.$element=null})};function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.tooltip");var options=typeof option=="object"&&option;if(!data&&/destroy|hide/.test(option))return;if(!data)$this.data("bs.tooltip",data=new Tooltip(this,options));if(typeof option=="string")data[option]()})}var old=$.fn.tooltip;$.fn.tooltip=Plugin;$.fn.tooltip.Constructor=Tooltip;$.fn.tooltip.noConflict=function(){$.fn.tooltip=old;return this}}(jQuery)},{}],16:[function(require,module,exports){+function($){"use strict";function transitionEnd(){var el=document.createElement("bootstrap");var transEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var name in transEndEventNames){if(el.style[name]!==undefined){return{end:transEndEventNames[name]}}}return false}$.fn.emulateTransitionEnd=function(duration){var called=false;var $el=this;$(this).one("bsTransitionEnd",function(){called=true});var callback=function(){if(!called)$($el).trigger($.support.transition.end)};setTimeout(callback,duration);return this};$(function(){$.support.transition=transitionEnd();if(!$.support.transition)return;$.event.special.bsTransitionEnd={bindType:$.support.transition.end,delegateType:$.support.transition.end,handle:function(e){if($(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}}})}(jQuery)},{}],17:[function(require,module,exports){(function(){"use strict";var $=typeof jQuery===typeof undefined?null:jQuery;var register=function(cytoscape,$){if(!cytoscape){return}var cy;var defaults={menuItems:[],menuItemClasses:[],contextMenuClasses:[]};var options;var $cxtMenu;var menuItemCSSClass="cy-context-menus-cxt-menuitem";var dividerCSSClass="cy-context-menus-divider";var eventCyTapStart;var active=false;var anyVisibleChild=false;function extend(defaults,options){var obj={};for(var i in defaults){obj[i]=defaults[i]}for(var i in options){obj[i]=options[i]}return obj}function preventDefaultContextTap(){$("#cy-context-menus-cxt-menu").contextmenu(function(){return false})}function getMenuItemClassStr(classes,hasTrailingDivider){var str=getClassStr(classes);str+=" "+menuItemCSSClass;if(hasTrailingDivider){str+=" "+dividerCSSClass}return str}function getClassStr(classes){var str="";for(var i=0;iwait){complete(trailingCall,maxTimeoutId)}else{timeoutId=setTimeout(delayed,remaining)}}function maxDelayed(){complete(trailing,timeoutId)}function debounced(){args=arguments;stamp=now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId}else{if(!maxTimeoutId&&!leading){lastCalled=stamp}var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0||remaining>maxWait;if(isCalled){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId)}lastCalled=stamp;result=func.apply(thisArg,args)}else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining)}}if(isCalled&&timeoutId){timeoutId=clearTimeout(timeoutId)}else if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait)}if(leadingCall){isCalled=true;result=func.apply(thisArg,args)}if(isCalled&&!timeoutId&&!maxTimeoutId){args=thisArg=undefined}return result}debounced.cancel=cancel;return debounced}function isObject(value){var type=typeof value;return!!value&&(type=="object"||type=="function")}return debounce}();module.exports=debounce},{}],20:[function(require,module,exports){module.exports=function(cy,snap){var discreteDrag={};var attachedNode;var draggedNodes;var startPos;var endPos;discreteDrag.onTapStartNode=function(e){if(e.cyTarget.selected())draggedNodes=e.cy.$(":selected");else draggedNodes=e.cyTarget;startPos=e.cyPosition;attachedNode=e.cyTarget;attachedNode.lock();attachedNode.trigger("grab");cy.on("tapdrag",onTapDrag);cy.on("tapend",onTapEndNode)};var onTapEndNode=function(e){cy.off("tapdrag",onTapDrag);cy.off("tapend",onTapEndNode);attachedNode.unlock();e.preventDefault()};var getDist=function(){return{x:endPos.x-startPos.x,y:endPos.y-startPos.y}};function getTopMostNodes(nodes){var nodesMap={};for(var i=0;i");var $container=$(cy.container());var ctx=$canvas[0].getContext("2d");$container.append($canvas);var drawGrid=function(){clearDrawing();var zoom=cy.zoom();var canvasWidth=$container.width();var canvasHeight=$container.height();var increment=options.gridSpacing*zoom;var pan=cy.pan();var initialValueX=pan.x%increment;var initialValueY=pan.y%increment;ctx.strokeStyle=options.strokeStyle;ctx.lineWidth=options.lineWidth;if(options.zoomDash){var zoomedDash=options.lineDash.slice();for(var i=0;i=0){if(optsKey=="drawGrid"){drawGrid.changeOptions(options);if(options.drawGrid)drawGrid.resizeCanvas()}if(optsKey=="snapToGrid"){snap.changeOptions(options);if(options.snapToGrid)snapAllNodes()}if(optsKey=="guidelines")guidelines.changeOptions(options);if(optsKey=="resize"){resize.changeOptions(options);if(options.resize)resizeAllNodes()}if(optsKey=="parentPadding")parentPadding.changeOptions(options)}}}latestOptions=$.extend(true,latestOptions,options)}return{init:syncWithOptions,syncWithOptions:syncWithOptions}}},{}],23:[function(require,module,exports){module.exports=function(opts,cy,$,debounce){var options=opts;var changeOptions=function(opts){options=opts};function calcDistance(p1,p2){return Math.sqrt(Math.pow(p1.x-p2.x,2)+Math.pow(p1.y-p2.y,2))}function getExtraDim(node,paddingDim){}var dims=function(node){var pos=node.renderedPosition();var width=node.renderedWidth();var height=node.renderedHeight();var padding={left:Number(node.renderedStyle("padding-left").replace("px","")),right:Number(node.renderedStyle("padding-right").replace("px","")),top:Number(node.renderedStyle("padding-top").replace("px","")),bottom:Number(node.renderedStyle("padding-bottom").replace("px",""))};this.horizontal={center:pos.x,left:pos.x-(padding.left+width/2),right:pos.x+(padding.right+width/2)};this.vertical={center:pos.y,top:pos.y-(padding.top+height/2),bottom:pos.y+(padding.bottom+height/2)};return this};var $canvas=$("");var $container=$(cy.container());var ctx=$canvas[0].getContext("2d");$container.append($canvas);$canvas.attr("height",$container.height()).attr("width",$container.width()).css({position:"absolute",top:0,left:0,"z-index":options.guidelinesStackOrder});var canvasBb=$canvas.offset();var containerBb=$container.offset();$canvas.attr("height",$container.height()).attr("width",$container.width()).css({top:-(canvasBb.top-containerBb.top),left:-(canvasBb.left-containerBb.left)});var clearDrawing=function(){var width=$container.width();var height=$container.height();ctx.clearRect(0,0,width,height)};var pickedNode;function onGrabNode(e){pickedNode=e.cyTarget;onDragNode(e)}var onDragNode=debounce(function(e){if(pickedNode){var node=pickedNode;var mainDims=new dims(node);var cy=e.cy;var nearests={horizontal:{distance:Number.MAX_VALUE},vertical:{distance:Number.MAX_VALUE}};cy.nodes(":visible").not(node.ancestors()).not(node.descendants()).not(node).each(function(i,ele){var nodeDims=new dims(ele);for(var dim in mainDims){var mainDim=mainDims[dim];var nodeDim=nodeDims[dim];var otherDim=dim=="horizontal"?"y":"x";var eitherDim=otherDim=="x"?"y":"x";for(var key in mainDim){for(var key2 in nodeDim){if(Math.abs(mainDim[key]-nodeDim[key2])distance){nearests[dim]={to:ele.id(),toPos:{},from:node.id(),fromPos:{},distance:distance};nearests[dim].fromPos[eitherDim]=mainDim[key];nearests[dim].fromPos[otherDim]=node.renderedPosition(otherDim);nearests[dim].toPos[eitherDim]=nodeDim[key2];nearests[dim].toPos[otherDim]=ele.renderedPosition(otherDim)}}}}}});clearDrawing();for(var key in nearests){var item=nearests[key];if(item.from){ctx.beginPath();ctx.moveTo(item.fromPos.x,item.fromPos.y);ctx.lineTo(item.toPos.x,item.toPos.y);ctx.setLineDash(options.guidelinesStyle.lineDash);for(var styleKey in options.guidelinesStyle)ctx[styleKey]=options.guidelinesStyle[styleKey];ctx.stroke()}}}},0,true);function onFreeNode(){pickedNode=undefined;clearDrawing()}var resizeCanvas=debounce(function(){$canvas.attr("height",$container.height()).attr("width",$container.width()).css({position:"absolute",top:0,left:0,"z-index":options.guidelinesStackOrder});setTimeout(function(){var canvasBb=$canvas.offset();var containerBb=$container.offset();$canvas.attr("height",$container.height()).attr("width",$container.width()).css({top:-(canvasBb.top-containerBb.top),left:-(canvasBb.left-containerBb.left)})},0)},250);resizeCanvas();return{onDragNode:onDragNode,onZoom:onDragNode,onGrabNode:onGrabNode,onFreeNode:onFreeNode,changeOptions:changeOptions,resizeCanvas:resizeCanvas}}},{}],24:[function(require,module,exports){(function(){"use strict";var register=function(cytoscape){if(!cytoscape){return}var options={snapToGrid:true,discreteDrag:true,guidelines:true,resize:true,parentPadding:true,drawGrid:true,gridSpacing:20,zoomDash:true,panGrid:true,gridStackOrder:-1,strokeStyle:"#dedede",lineWidth:1,lineDash:[2.5,4],guidelinesStackOrder:4,guidelinesTolerance:2,guidelinesStyle:{strokeStyle:"#8b7d6b",lineDash:[3,5]},parentSpacing:-1};var _snap=require("./snap");var _discreteDrag=require("./discrete_drag");var _drawGrid=require("./draw_grid");var _resize=require("./resize");var _eventsController=require("./events_controller");var _guidelines=require("./guidelines");var _parentPadding=require("./parentPadding");var _alignment=require("./alignment");var debounce=require("./debounce");var snap,resize,discreteDrag,drawGrid,eventsController,guidelines,parentPadding,alignment;function getScratch(cy){if(!cy.scratch("_gridGuide")){cy.scratch("_gridGuide",{})}return cy.scratch("_gridGuide")}cytoscape("core","gridGuide",function(opts){var cy=this;$.extend(true,options,opts);if(!getScratch(cy).initialized){snap=_snap(cy,options.gridSpacing);resize=_resize(options.gridSpacing);discreteDrag=_discreteDrag(cy,snap);drawGrid=_drawGrid(options,cy,$,debounce);guidelines=_guidelines(options,cy,$,debounce);parentPadding=_parentPadding(options,cy);eventsController=_eventsController(cy,snap,resize,discreteDrag,drawGrid,guidelines,parentPadding,$);alignment=_alignment(cytoscape,cy,$);eventsController.init(options);getScratch(cy).initialized=true}else eventsController.syncWithOptions(options);return this})};if(typeof module!=="undefined"&&module.exports){module.exports=register}if(typeof define!=="undefined"&&define.amd){define("cytoscape-grid-guide",function(){return register})}if(typeof cytoscape!=="undefined"){register(cytoscape)}})()},{"./alignment":18,"./debounce":19,"./discrete_drag":20,"./draw_grid":21,"./events_controller":22,"./guidelines":23,"./parentPadding":25,"./resize":26,"./snap":27}],25:[function(require,module,exports){module.exports=function(opts,cy){var options=opts;var ppClass="_gridParentPadding";function initPadding(){var padding=options.parentSpacing<0?options.gridSpacing:options.parentSpacing;cy.style().selector("."+ppClass).style("compound-sizing-wrt-labels","exclude").style("padding-left",padding).style("padding-right",padding).style("padding-top",padding).style("padding-bottom",padding).update()}function changeOptions(opts){options=opts;padding=options.parentSpacing<0?options.gridSpacing:options.parentSpacing;initPadding()}function setPaddingOfParent(node,enable){if(enable)node.addClass(ppClass);else node.removeClass(ppClass)}return{changeOptions:changeOptions,setPaddingOfParent:setPaddingOfParent}}},{}],26:[function(require,module,exports){module.exports=function(gridSpacing){var changeOptions=function(opts){gridSpacing=Number(opts.gridSpacing)};var getScratch=function(node){if(!node.scratch("_gridGuide"))node.scratch("_gridGuide",{});return node.scratch("_gridGuide")};function resizeNode(node){var width=node.width();var height=node.height();var newWidth=Math.round((width-gridSpacing)/(gridSpacing*2))*(gridSpacing*2);var newHeight=Math.round((height-gridSpacing)/(gridSpacing*2))*(gridSpacing*2);newWidth=newWidth>0?newWidth+gridSpacing:gridSpacing;newHeight=newHeight>0?newHeight+gridSpacing:gridSpacing;if(width!=newWidth||height!=newHeight){node.style({width:newWidth,height:newHeight});getScratch(node).resize={ -oldWidth:width,oldHeight:height}}}function recoverNodeDimensions(node){var oldSizes=getScratch(node).resize;if(oldSizes)node.style({width:oldSizes.oldWidth,height:oldSizes.oldHeight})}return{resizeNode:resizeNode,recoverNodeDimensions:recoverNodeDimensions,changeOptions:changeOptions}}},{}],27:[function(require,module,exports){module.exports=function(cy,gridSpacing){var snap={};snap.changeOptions=function(opts){gridSpacing=opts.gridSpacing};var getScratch=function(node){if(!node.scratch("_gridGuide"))node.scratch("_gridGuide",{});return node.scratch("_gridGuide")};function getTopMostNodes(nodes){var nodesMap={};for(var i=0;iwait){complete(trailingCall,maxTimeoutId)}else{timeoutId=setTimeout(delayed,remaining)}}function maxDelayed(){complete(trailing,timeoutId)}function debounced(){args=arguments;stamp=now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId}else{if(!maxTimeoutId&&!leading){lastCalled=stamp}var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0||remaining>maxWait;if(isCalled){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId)}lastCalled=stamp;result=func.apply(thisArg,args)}else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining)}}if(isCalled&&timeoutId){timeoutId=clearTimeout(timeoutId)}else if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait)}if(leadingCall){isCalled=true;result=func.apply(thisArg,args)}if(isCalled&&!timeoutId&&!maxTimeoutId){args=thisArg=undefined}return result}debounced.cancel=cancel;return debounced}function isObject(value){var type=typeof value;return!!value&&(type=="object"||type=="function")}return debounce}();var throttle=function(func,wait,options){var leading=true,trailing=true;if(options===false){leading=false}else if(typeof options===typeof{}){leading="leading"in options?options.leading:leading;trailing="trailing"in options?options.trailing:trailing}options=options||{};options.leading=leading;options.maxWait=wait;options.trailing=trailing;return debounce(func,wait,options)};var Navigator=function(element,options){this._init(element,options)};Navigator.prototype={constructor:Navigator,bb:function(){var bb=this.cy.elements().boundingBox();if(bb.w===0||bb.h===0){return{x1:0,x2:Infinity,y1:0,y2:Infinity,w:Infinity,h:Infinity}}return bb},_init:function(cy,options){this.$element=$(cy.container());this.options=$.extend({},defaults,options);this.cy=cy;this.boundingBox=this.bb();this.width=this.$element.width();this.height=this.$element.height();this._initPanel();this._initThumbnail();this._initView();this._initOverlay()},destroy:function(){this._removeEventsHandling();if(this.options.container&&!this.options.removeCustomContainer){this.$panel.empty()}else{this.$panel.remove()}this.$element.removeData("navigator")},_initPanel:function(){var options=this.options;if(options.container){if(options.container instanceof jQuery){if(options.container.length>0){this.$panel=options.container.first()}else{$.error("Container for jquery.cyNavigator is empty");return}}else if($(options.container).length>0){this.$panel=$(options.container).first()}else{$.error("There is no any element matching your selector for jquery.cyNavigator");return}}else{this.$panel=$('
    ');$("body").append(this.$panel)}this._setupPanel();this.cy.on("resize",$.proxy(this.resize,this))},_setupPanel:function(){var options=this.options;this.panelWidth=this.$panel.width();this.panelHeight=this.$panel.height()},_initThumbnail:function(){this.$thumbnail=$("");this.$panel.append(this.$thumbnail);this._setupThumbnailSizes();this._setupThumbnail()},_setupThumbnail:function(){this._updateThumbnailImage()},_setupThumbnailSizes:function(){this.boundingBox=this.bb();this.thumbnailZoom=Math.min(this.panelHeight/this.boundingBox.h,this.panelWidth/this.boundingBox.w);this.thumbnailPan={x:(this.panelWidth-this.thumbnailZoom*(this.boundingBox.x1+this.boundingBox.x2))/2,y:(this.panelHeight-this.thumbnailZoom*(this.boundingBox.y1+this.boundingBox.y2))/2}},_checkThumbnailSizesAndUpdate:function(){var _zoom=this.thumbnailZoom,_pan_x=this.thumbnailPan.x,_pan_y=this.thumbnailPan.y;this._setupThumbnailSizes();if(_zoom!=this.thumbnailZoom||_pan_x!=this.thumbnailPan.x||_pan_y!=this.thumbnailPan.y){this._setupThumbnail();this._setupView()}else{this._updateThumbnailImage()}},_initView:function(){var that=this;this.$view=$('
    ');this.$panel.append(this.$view);this.viewBorderTop=parseInt(this.$view.css("border-top-width"),10);this.viewBorderRight=parseInt(this.$view.css("border-right-width"),10);this.viewBorderBottom=parseInt(this.$view.css("border-bottom-width"),10);this.viewBorderLeft=parseInt(this.$view.css("border-left-width"),10);this.viewBorderHorizontal=this.viewBorderLeft+this.viewBorderRight;this.viewBorderVertical=this.viewBorderTop+this.viewBorderBottom;this._setupView();this.cy.on("zoom pan",$.proxy(this._setupView,this))},_setupView:function(){if(this.viewLocked)return;var cyZoom=this.cy.zoom(),cyPan=this.cy.pan();this.viewW=this.width/cyZoom*this.thumbnailZoom;this.viewX=-cyPan.x*this.viewW/this.width+this.thumbnailPan.x-this.viewBorderLeft;this.viewH=this.height/cyZoom*this.thumbnailZoom;this.viewY=-cyPan.y*this.viewH/this.height+this.thumbnailPan.y-this.viewBorderTop;this.$view.width(this.viewW).height(this.viewH).css({position:"absolute",left:this.viewX,top:this.viewY})},_initOverlay:function(){this.$overlay=$('
    ');this.$panel.append(this.$overlay);this.overlayHookPointX=0;this.overlayHookPointY=0;this._initEventsHandling()},resize:function(){this.width=this.$element.width();this.height=this.$element.height();this._thumbnailSetup=false;this._setupPanel();this._checkThumbnailSizesAndUpdate();this._setupView()},_initEventsHandling:function(){var that=this,eventsLocal=["mousedown","mousewheel","DOMMouseScroll","touchstart"],eventsGlobal=["mouseup","mouseout","mousemove","touchmove","touchend"];var overlayListener;this.$overlay.on(eventsLocal.join(" "),overlayListener=function(ev){if(ev.type=="touchstart"){ev.offsetX=that.viewX+that.viewW/2;ev.offsetY=that.viewY+that.viewH/2}if(ev.offsetX===undefined||ev.offsetY===undefined){var targetOffset=$(ev.target).offset();ev.offsetX=ev.pageX-targetOffset.left;ev.offsetY=ev.pageY-targetOffset.top}if(ev.type=="mousedown"||ev.type=="touchstart"){that._eventMoveStart(ev)}else if(ev.type=="mousewheel"||ev.type=="DOMMouseScroll"){that._eventZoom(ev)}return false});var globalListener;$(window).on(eventsGlobal.join(" "),globalListener=function(ev){if(!that.overlayInMovement)return;if(ev.type=="touchend"){ev.offsetX=that.viewX+that.viewW/2;ev.offsetY=that.viewY+that.viewH/2}else if(ev.type=="touchmove"){ev.pageX=ev.originalEvent.touches[0].pageX;ev.pageY=ev.originalEvent.touches[0].pageY}if(ev.offsetX===undefined||ev.offsetY===undefined){var targetOffset=$(ev.target).offset();ev.offsetX=ev.pageX-targetOffset.left;ev.offsetY=ev.pageY-targetOffset.top}if(ev.target!==that.$overlay[0]){var targetOffset=$(ev.target).offset(),overlayOffset=that.$overlay.offset();ev.offsetX=ev.offsetX-overlayOffset.left+targetOffset.left;ev.offsetY=ev.offsetY-overlayOffset.top+targetOffset.top}if(ev.type=="mousemove"||ev.type=="touchmove"){that._eventMove(ev)}else if(ev.type=="mouseup"||ev.type=="touchend"){that._eventMoveEnd(ev)}return false});this._removeEventsHandling=function(){this.$overlay.off(eventsLocal.join(" "),overlayListener);$(window).off(eventsGlobal.join(" "),globalListener)}},_eventMoveStart:function(ev){var now=(new Date).getTime();if(this.overlayLastMoveStartTime&&this.overlayLastMoveStartTime+this.options.dblClickDelay>now){this.overlayLastMoveStartTime=0;this.overlayInMovement=true;this.overlayHookPointX=this.viewW/2;this.overlayHookPointY=this.viewH/2;if(this.options.viewLiveFramerate!==false){this._eventMove({offsetX:this.panelWidth/2,offsetY:this.panelHeight/2})}else{this._eventMoveEnd({offsetX:this.panelWidth/2,offsetY:this.panelHeight/2})}this.overlayInMovement=false}else{this.overlayLastMoveStartTime=now;this.overlayInMovement=true;this.viewLocked=true;if(ev.offsetX>=this.viewX&&ev.offsetX<=this.viewX+this.viewW&&ev.offsetY>=this.viewY&&ev.offsetY<=this.viewY+this.viewH){this.overlayHookPointX=ev.offsetX-this.viewX;this.overlayHookPointY=ev.offsetY-this.viewY}else{this.overlayHookPointX=this.viewW/2;this.overlayHookPointY=this.viewH/2;this._eventMove(ev)}}},_eventMove:function(ev){var that=this;this._checkMousePosition(ev);if(!this.overlayInMovement){return}this.viewX=ev.offsetX-this.overlayHookPointX;this.viewY=ev.offsetY-this.overlayHookPointY;this.$view.css("left",this.viewX);this.$view.css("top",this.viewY);if(this.options.viewLiveFramerate!==false){if(this.options.viewLiveFramerate==0){this._moveCy()}else if(!this.overlayTimeout){this.overlayTimeout=setTimeout(function(){that._moveCy();that.overlayTimeout=false},1e3/this.options.viewLiveFramerate)}}},_checkMousePosition:function(ev){if(ev.offsetX>this.viewX&&ev.offsetXthis.viewY&&ev.offsetY
    ');$container.prepend($panzoom);$panzoom.css("position","absolute");$panzoom.data("winbdgs",winbdgs);$panzoom.data("cybdgs",cybdgs);if(options.zoomOnly){$panzoom.addClass("cy-panzoom-zoom-only")}var $zoomIn=$('
    ');$panzoom.append($zoomIn);var $zoomOut=$('
    ');$panzoom.append($zoomOut);var $reset=$('
    ');$panzoom.append($reset);var $slider=$('
    ');$panzoom.append($slider);$slider.append('
    ');var $sliderHandle=$('
    ');$slider.append($sliderHandle);var $noZoomTick=$('
    ');$slider.append($noZoomTick);var $panner=$('
    ');$panzoom.append($panner);var $pHandle=$('
    ');$panner.append($pHandle);var $pUp=$('
    ');var $pDown=$('
    ');var $pLeft=$('
    ');var $pRight=$('
    ');$panner.append($pUp).append($pDown).append($pLeft).append($pRight);var $pIndicator=$('
    ');$panner.append($pIndicator);function handle2pan(e){var v={x:e.originalEvent.pageX-$panner.offset().left-$panner.width()/2,y:e.originalEvent.pageY-$panner.offset().top-$panner.height()/2};var r=options.panDragAreaSize;var d=Math.sqrt(v.x*v.x+v.y*v.y);var percent=Math.min(d/r,1);if(dmax){top=max}var percent=1-(top-min)/(max-min);$sliderHandle.css("top",top);var zmin=options.minZoom;var zmax=options.maxZoom;var x=Math.log(zmin)/Math.log(zmax);var p=(1-x)*percent+x;var z=Math.pow(zmax,p);if(zzmax){z=zmax}zoomTo(z)}var sliderMdownHandler,sliderMmoveHandler;$sliderHandle.bind("mousedown",sliderMdownHandler=function(mdEvt){var handleOffset=mdEvt.target===$sliderHandle[0]?mdEvt.offsetY:0;sliding=true;startZooming();$sliderHandle.addClass("active");var lastMove=0;windowBind("mousemove",sliderMmoveHandler=function(mmEvt){var now=+new Date;if(now>lastMove+10){lastMove=now}else{return false}setSliderFromMouse(mmEvt,handleOffset);return false});windowBind("mouseup",function(){windowUnbind("mousemove",sliderMmoveHandler);sliding=false;$sliderHandle.removeClass("active");endZooming()});return false});$slider.bind("mousedown",function(e){if(e.target!==$sliderHandle[0]){sliderMdownHandler(e);setSliderFromMouse(e)}});function positionSliderFromZoom(){var cy=$container.cytoscape("get");var z=cy.zoom();var zmin=options.minZoom;var zmax=options.maxZoom;var x=Math.log(zmin)/Math.log(zmax);var p=Math.log(z)/Math.log(zmax);var percent=1-(p-x)/(1-x);var min=sliderPadding;var max=$slider.height()-$sliderHandle.height()-2*sliderPadding;var top=percent*(max-min);if(topmax){top=max}$sliderHandle.css("top",top)}positionSliderFromZoom();cyOn("zoom",function(){if(!sliding){positionSliderFromZoom()}});(function(){var z=1;var zmin=options.minZoom;var zmax=options.maxZoom;var x=Math.log(zmin)/Math.log(zmax);var p=Math.log(z)/Math.log(zmax);var percent=1-(p-x)/(1-x);if(percent>1||percent<0){$noZoomTick.hide();return}var min=sliderPadding;var max=$slider.height()-$sliderHandle.height()-2*sliderPadding;var top=percent*(max-min);if(topmax){top=max}$noZoomTick.css("top",top)})();function bindButton($button,factor){var zoomInterval;$button.bind("mousedown",function(e){e.preventDefault();e.stopPropagation();if(e.button!=0){return}var cy=$container.cytoscape("get");var doZoom=function(){var zoom=cy.zoom();var lvl=cy.zoom()*factor;if(lvloptions.maxZoom){lvl=options.maxZoom}if(lvl==options.maxZoom&&zoom==options.maxZoom||lvl==options.minZoom&&zoom==options.minZoom){return}zoomTo(lvl)};startZooming();doZoom();zoomInterval=setInterval(doZoom,options.zoomDelay);return false});windowBind("mouseup blur",function(){clearInterval(zoomInterval);endZooming()})}bindButton($zoomIn,1+options.zoomFactor);bindButton($zoomOut,1-options.zoomFactor);$reset.bind("mousedown",function(e){if(e.button!=0){return}var cy=$container.cytoscape("get");if(cy.elements().size()===0){cy.reset()}else{cy.fit(options.fitPadding)}return false})})}};if(functions[fn]){return functions[fn].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof fn=="object"||!fn){return functions.init.apply(this,arguments)}else{$.error("No such function `"+fn+"` for jquery.cytoscapePanzoom")}return $(this)};if(typeof module!=="undefined"&&module.exports){module.exports=register}if(typeof define!=="undefined"&&define.amd){define("cytoscape-panzoom",function(){return register})}if(typeof cytoscape!=="undefined"&&typeof jQuery!=="undefined"){register(cytoscape,jQuery)}})()},{}],30:[function(require,module,exports){(function($,$$){"use strict";var isObject=function(o){return o!=null&&typeof o==="object"};var isFunction=function(o){return o!=null&&typeof o==="function"};var isNumber=function(o){return o!=null&&typeof o==="number"};var isString=function(o){return o!=null&&typeof o==="string"};var isUndef=function(o){return o===undefined};var wrap=function(obj,target){if(isFunction(obj)){return function(event,api){return obj.apply(target,[event,api])}}else{return obj}};var throttle=function(func,wait,options){var leading=true,trailing=true;if(options===false){leading=false}else if(isObject(options)){leading="leading"in options?options.leading:leading;trailing="trailing"in options?options.trailing:trailing}options=options||{};options.leading=leading;options.maxWait=wait;options.trailing=trailing;return debounce(func,wait,options)};var debounce=function(func,wait,options){var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=false,trailing=true;if(!isFunction(func)){return}wait=Math.max(0,wait)||0;if(options===true){var leading=true;trailing=false}else if(isObject(options)){leading=options.leading;maxWait="maxWait"in options&&(Math.max(wait,options.maxWait)||0);trailing="trailing"in options?options.trailing:trailing}var delayed=function(){var remaining=wait-(Date.now()-stamp);if(remaining<=0){if(maxTimeoutId){clearTimeout(maxTimeoutId)}var isCalled=trailingCall;maxTimeoutId=timeoutId=trailingCall=undefined;if(isCalled){lastCalled=Date.now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}}else{timeoutId=setTimeout(delayed,remaining)}};var maxDelayed=function(){if(timeoutId){clearTimeout(timeoutId)}maxTimeoutId=timeoutId=trailingCall=undefined;if(trailing||maxWait!==wait){lastCalled=Date.now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}};return function(){args=arguments;stamp=Date.now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId}else{if(!maxTimeoutId&&!leading){lastCalled=stamp}var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0;if(isCalled){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId)}lastCalled=stamp;result=func.apply(thisArg,args)}else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining)}}if(isCalled&&timeoutId){timeoutId=clearTimeout(timeoutId)}else if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait)}if(leadingCall){isCalled=true;result=func.apply(thisArg,args)}if(isCalled&&!timeoutId&&!maxTimeoutId){args=thisArg=null}return result}};function register($$,$){var $qtipContainer=$("
    ");var viewportDebounceRate=250;function generateOpts(target,passedOpts){var qtip=target.scratch().qtip;var opts=$.extend({},passedOpts);if(!opts.id){opts.id="cy-qtip-target-"+(Date.now()+Math.round(Math.random()*1e4))}if(!qtip.$domEle){qtip.$domEle=$qtipContainer}opts.position=opts.position||{};opts.position.container=opts.position.container||$(document.body);opts.position.viewport=opts.position.viewport||$(document.body);opts.position.target=[0,0];opts.position.my=opts.position.my||"top center";opts.position.at=opts.position.at||"bottom center";var adjust=opts.position.adjust=opts.position.adjust||{};adjust.method=adjust.method||"flip";adjust.mouse=false;if(isUndef(adjust.cyAdjustToEleBB)){adjust.cyAdjustToEleBB=true}opts.show=opts.show||{};if(isUndef(opts.show.event)){opts.show.event="tap"}opts.hide=opts.hide||{};opts.hide.cyViewport=opts.hide.cyViewport===undefined?true:opts.hide.cyViewport;if(isUndef(opts.hide.event)){opts.hide.event="unfocus"}opts.overwrite=false;if(opts.content){if(isFunction(opts.content)||isString(opts.content)){opts.content=wrap(opts.content,target)}else{opts.content={text:wrap(opts.content.text,target),title:wrap(opts.content.title,target)}}}return opts}$$("collection","qtip",function(passedOpts){var eles=this;var cy=this.cy();var container=cy.container();if(passedOpts==="api"){return this.scratch().qtip.api}eles.each(function(i,ele){var scratch=ele.scratch();var qtip=scratch.qtip=scratch.qtip||{};var opts=generateOpts(ele,passedOpts);var adjNums=opts.position.adjust;qtip.$domEle.qtip(opts);var qtipApi=qtip.api=qtip.$domEle.qtip("api");qtip.$domEle.removeData("qtip");var updatePosition=function(e){var cOff=container.getBoundingClientRect();var pos=ele.renderedPosition()||(e?e.cyRenderedPosition:undefined);if(!pos||pos.x==null||isNaN(pos.x)){return}if(opts.position.adjust.cyAdjustToEleBB&&ele.isNode()){var my=opts.position.my.toLowerCase();var at=opts.position.at.toLowerCase();var z=cy.zoom();var w=ele.outerWidth()*z;var h=ele.outerHeight()*z;if(at.match("top")){pos.y-=h/2}else if(at.match("bottom")){pos.y+=h/2}if(at.match("left")){pos.x-=w/2}else if(at.match("right")){pos.x+=w/2}if(isNumber(adjNums.x)){pos.x+=adjNums.x}if(isNumber(adjNums.y)){pos.y+=adjNums.y}}qtipApi.set("position.adjust.x",cOff.left+pos.x+window.pageXOffset);qtipApi.set("position.adjust.y",cOff.top+pos.y+window.pageYOffset)};updatePosition();ele.on(opts.show.event,function(e){updatePosition(e);qtipApi.show()});ele.on(opts.hide.event,function(e){qtipApi.hide()});if(opts.hide.cyViewport){cy.on("viewport",debounce(function(){qtipApi.hide()},viewportDebounceRate,{leading:true}))}if(opts.position.adjust.cyViewport){cy.on("pan zoom",debounce(function(e){updatePosition(e);qtipApi.reposition()},viewportDebounceRate,{trailing:true}))}});return this});$$("core","qtip",function(passedOpts){var cy=this;var container=cy.container();if(passedOpts==="api"){return this.scratch().qtip.api}var scratch=cy.scratch();var qtip=scratch.qtip=scratch.qtip||{};var opts=generateOpts(cy,passedOpts);qtip.$domEle.qtip(opts);var qtipApi=qtip.api=qtip.$domEle.qtip("api");qtip.$domEle.removeData("qtip");var updatePosition=function(e){var cOff=container.getBoundingClientRect();var pos=e.cyRenderedPosition;if(!pos||pos.x==null||isNaN(pos.x)){return}qtipApi.set("position.adjust.x",cOff.left+pos.x+window.pageXOffset);qtipApi.set("position.adjust.y",cOff.top+pos.y+window.pageYOffset)};cy.on(opts.show.event,function(e){if(!opts.show.cyBgOnly||opts.show.cyBgOnly&&e.cyTarget===cy){updatePosition(e);qtipApi.show()}});cy.on(opts.hide.event,function(e){if(!opts.hide.cyBgOnly||opts.hide.cyBgOnly&&e.cyTarget===cy){qtipApi.hide()}});if(opts.hide.cyViewport){cy.on("viewport",debounce(function(){qtipApi.hide()},viewportDebounceRate,{leading:true}))}return this})}if(typeof module!=="undefined"&&module.exports){module.exports=register}if(typeof define!=="undefined"&&define.amd){define("cytoscape-qtip",function(){return register})}if($&&$$){register($$,$)}})(typeof jQuery!=="undefined"?jQuery:null,typeof cytoscape!=="undefined"?cytoscape:null)},{}],31:[function(require,module,exports){(function(){"use strict";var register=function(cytoscape){if(!cytoscape){return}var cy;var actions={};var undoStack=[];var redoStack=[];var _instance={options:{isDebug:false,actions:{},undoableDrag:true,stackSizeLimit:undefined,beforeUndo:function(){},afterUndo:function(){},beforeRedo:function(){},afterRedo:function(){},ready:function(){}}};cytoscape("core","undoRedo",function(options,dontInit){cy=this;function getScratch(){if(!cy.scratch("_undoRedo")){cy.scratch("_undoRedo",{})}return cy.scratch("_undoRedo")}if(options){for(var key in options)if(_instance.options.hasOwnProperty(key))_instance.options[key]=options[key];if(options.actions)for(var key in options.actions)actions[key]=options.actions[key]}if(!getScratch().isInitialized&&!dontInit){var defActions=defaultActions();for(var key in defActions)actions[key]=defActions[key];setDragUndo(_instance.options.undoableDrag);getScratch().isInitialized=true}_instance.options.ready();return _instance});_instance.reset=function(){undoStack=[];redoStack=[]};_instance.undo=function(){if(!this.isUndoStackEmpty()){var action=undoStack.pop();cy.trigger("beforeUndo",[action.name,action.args]);var res=actions[action.name]._undo(action.args);redoStack.push({name:action.name,args:res});cy.trigger("afterUndo",[action.name,action.args,res]);return res}else if(_instance.options.isDebug){console.log("Undoing cannot be done because undo stack is empty!")}};_instance.redo=function(){if(!this.isRedoStackEmpty()){var action=redoStack.pop();cy.trigger(action.firstTime?"beforeDo":"beforeRedo",[action.name,action.args]);if(!action.args)action.args={};action.args.firstTime=action.firstTime?true:false;var res=actions[action.name]._do(action.args);undoStack.push({name:action.name,args:res});if(_instance.options.stackSizeLimit!=undefined&&undoStack.length>_instance.options.stackSizeLimit){undoStack.shift()}cy.trigger(action.firstTime?"afterDo":"afterRedo",[action.name,action.args,res]);return res}else if(_instance.options.isDebug){console.log("Redoing cannot be done because redo stack is empty!")}};_instance.do=function(actionName,args){redoStack=[];redoStack.push({name:actionName,args:args,firstTime:true});return this.redo()};_instance.undoAll=function(){while(!this.isUndoStackEmpty()){this.undo()}};_instance.redoAll=function(){while(!this.isRedoStackEmpty()){this.redo()}};_instance.action=function(actionName,_do,_undo){actions[actionName]={_do:_do,_undo:_undo};return _instance};_instance.removeAction=function(actionName){delete actions[actionName]};_instance.isUndoStackEmpty=function(){return undoStack.length===0};_instance.isRedoStackEmpty=function(){return redoStack.length===0; +oldWidth:width,oldHeight:height}}}function recoverNodeDimensions(node){var oldSizes=getScratch(node).resize;if(oldSizes)node.style({width:oldSizes.oldWidth,height:oldSizes.oldHeight})}return{resizeNode:resizeNode,recoverNodeDimensions:recoverNodeDimensions,changeOptions:changeOptions}}},{}],27:[function(require,module,exports){module.exports=function(cy,gridSpacing){var snap={};snap.changeOptions=function(opts){gridSpacing=opts.gridSpacing};var getScratch=function(node){if(!node.scratch("_gridGuide"))node.scratch("_gridGuide",{});return node.scratch("_gridGuide")};function getTopMostNodes(nodes){var nodesMap={};for(var i=0;iwait){complete(trailingCall,maxTimeoutId)}else{timeoutId=setTimeout(delayed,remaining)}}function maxDelayed(){complete(trailing,timeoutId)}function debounced(){args=arguments;stamp=now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId}else{if(!maxTimeoutId&&!leading){lastCalled=stamp}var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0||remaining>maxWait;if(isCalled){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId)}lastCalled=stamp;result=func.apply(thisArg,args)}else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining)}}if(isCalled&&timeoutId){timeoutId=clearTimeout(timeoutId)}else if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait)}if(leadingCall){isCalled=true;result=func.apply(thisArg,args)}if(isCalled&&!timeoutId&&!maxTimeoutId){args=thisArg=undefined}return result}debounced.cancel=cancel;return debounced}function isObject(value){var type=typeof value;return!!value&&(type=="object"||type=="function")}return debounce}();var throttle=function(func,wait,options){var leading=true,trailing=true;if(options===false){leading=false}else if(typeof options===typeof{}){leading="leading"in options?options.leading:leading;trailing="trailing"in options?options.trailing:trailing}options=options||{};options.leading=leading;options.maxWait=wait;options.trailing=trailing;return debounce(func,wait,options)};var Navigator=function(element,options){this._init(element,options)};Navigator.prototype={constructor:Navigator,bb:function(){var bb=this.cy.elements().boundingBox();if(bb.w===0||bb.h===0){return{x1:0,x2:Infinity,y1:0,y2:Infinity,w:Infinity,h:Infinity}}return bb},_init:function(cy,options){this.$element=$(cy.container());this.options=$.extend({},defaults,options);this.cy=cy;this.boundingBox=this.bb();this.width=this.$element.width();this.height=this.$element.height();this._initPanel();this._initThumbnail();this._initView();this._initOverlay()},destroy:function(){this._removeEventsHandling();if(this.options.container&&!this.options.removeCustomContainer){this.$panel.empty()}else{this.$panel.remove()}this.$element.removeData("navigator")},_initPanel:function(){var options=this.options;if(options.container){if(options.container instanceof jQuery){if(options.container.length>0){this.$panel=options.container.first()}else{$.error("Container for jquery.cyNavigator is empty");return}}else if($(options.container).length>0){this.$panel=$(options.container).first()}else{$.error("There is no any element matching your selector for jquery.cyNavigator");return}}else{this.$panel=$('
    ');$("body").append(this.$panel)}this._setupPanel();this.cy.on("resize",$.proxy(this.resize,this))},_setupPanel:function(){var options=this.options;this.panelWidth=this.$panel.width();this.panelHeight=this.$panel.height()},_initThumbnail:function(){this.$thumbnail=$("");this.$panel.append(this.$thumbnail);this._setupThumbnailSizes();this._setupThumbnail()},_setupThumbnail:function(){this._updateThumbnailImage()},_setupThumbnailSizes:function(){this.boundingBox=this.bb();this.thumbnailZoom=Math.min(this.panelHeight/this.boundingBox.h,this.panelWidth/this.boundingBox.w);this.thumbnailPan={x:(this.panelWidth-this.thumbnailZoom*(this.boundingBox.x1+this.boundingBox.x2))/2,y:(this.panelHeight-this.thumbnailZoom*(this.boundingBox.y1+this.boundingBox.y2))/2}},_checkThumbnailSizesAndUpdate:function(){var _zoom=this.thumbnailZoom,_pan_x=this.thumbnailPan.x,_pan_y=this.thumbnailPan.y;this._setupThumbnailSizes();if(_zoom!=this.thumbnailZoom||_pan_x!=this.thumbnailPan.x||_pan_y!=this.thumbnailPan.y){this._setupThumbnail();this._setupView()}else{this._updateThumbnailImage()}},_initView:function(){var that=this;this.$view=$('
    ');this.$panel.append(this.$view);this.viewBorderTop=parseInt(this.$view.css("border-top-width"),10);this.viewBorderRight=parseInt(this.$view.css("border-right-width"),10);this.viewBorderBottom=parseInt(this.$view.css("border-bottom-width"),10);this.viewBorderLeft=parseInt(this.$view.css("border-left-width"),10);this.viewBorderHorizontal=this.viewBorderLeft+this.viewBorderRight;this.viewBorderVertical=this.viewBorderTop+this.viewBorderBottom;this._setupView();this.cy.on("zoom pan",$.proxy(this._setupView,this))},_setupView:function(){if(this.viewLocked)return;var cyZoom=this.cy.zoom(),cyPan=this.cy.pan();this.viewW=this.width/cyZoom*this.thumbnailZoom;this.viewX=-cyPan.x*this.viewW/this.width+this.thumbnailPan.x-this.viewBorderLeft;this.viewH=this.height/cyZoom*this.thumbnailZoom;this.viewY=-cyPan.y*this.viewH/this.height+this.thumbnailPan.y-this.viewBorderTop;this.$view.width(this.viewW).height(this.viewH).css({position:"absolute",left:this.viewX,top:this.viewY})},_initOverlay:function(){this.$overlay=$('
    ');this.$panel.append(this.$overlay);this.overlayHookPointX=0;this.overlayHookPointY=0;this._initEventsHandling()},resize:function(){this.width=this.$element.width();this.height=this.$element.height();this._thumbnailSetup=false;this._setupPanel();this._checkThumbnailSizesAndUpdate();this._setupView()},_initEventsHandling:function(){var that=this,eventsLocal=["mousedown","mousewheel","DOMMouseScroll","touchstart"],eventsGlobal=["mouseup","mouseout","mousemove","touchmove","touchend"];var overlayListener;this.$overlay.on(eventsLocal.join(" "),overlayListener=function(ev){if(ev.type=="touchstart"){ev.offsetX=that.viewX+that.viewW/2;ev.offsetY=that.viewY+that.viewH/2}if(ev.offsetX===undefined||ev.offsetY===undefined){var targetOffset=$(ev.target).offset();ev.offsetX=ev.pageX-targetOffset.left;ev.offsetY=ev.pageY-targetOffset.top}if(ev.type=="mousedown"||ev.type=="touchstart"){that._eventMoveStart(ev)}else if(ev.type=="mousewheel"||ev.type=="DOMMouseScroll"){that._eventZoom(ev)}return false});var globalListener;$(window).on(eventsGlobal.join(" "),globalListener=function(ev){if(!that.overlayInMovement)return;if(ev.type=="touchend"){ev.offsetX=that.viewX+that.viewW/2;ev.offsetY=that.viewY+that.viewH/2}else if(ev.type=="touchmove"){ev.pageX=ev.originalEvent.touches[0].pageX;ev.pageY=ev.originalEvent.touches[0].pageY}if(ev.offsetX===undefined||ev.offsetY===undefined){var targetOffset=$(ev.target).offset();ev.offsetX=ev.pageX-targetOffset.left;ev.offsetY=ev.pageY-targetOffset.top}if(ev.target!==that.$overlay[0]){var targetOffset=$(ev.target).offset(),overlayOffset=that.$overlay.offset();ev.offsetX=ev.offsetX-overlayOffset.left+targetOffset.left;ev.offsetY=ev.offsetY-overlayOffset.top+targetOffset.top}if(ev.type=="mousemove"||ev.type=="touchmove"){that._eventMove(ev)}else if(ev.type=="mouseup"||ev.type=="touchend"){that._eventMoveEnd(ev)}return false});this._removeEventsHandling=function(){this.$overlay.off(eventsLocal.join(" "),overlayListener);$(window).off(eventsGlobal.join(" "),globalListener)}},_eventMoveStart:function(ev){var now=(new Date).getTime();if(this.overlayLastMoveStartTime&&this.overlayLastMoveStartTime+this.options.dblClickDelay>now){this.overlayLastMoveStartTime=0;this.overlayInMovement=true;this.overlayHookPointX=this.viewW/2;this.overlayHookPointY=this.viewH/2;if(this.options.viewLiveFramerate!==false){this._eventMove({offsetX:this.panelWidth/2,offsetY:this.panelHeight/2})}else{this._eventMoveEnd({offsetX:this.panelWidth/2,offsetY:this.panelHeight/2})}this.overlayInMovement=false}else{this.overlayLastMoveStartTime=now;this.overlayInMovement=true;this.viewLocked=true;if(ev.offsetX>=this.viewX&&ev.offsetX<=this.viewX+this.viewW&&ev.offsetY>=this.viewY&&ev.offsetY<=this.viewY+this.viewH){this.overlayHookPointX=ev.offsetX-this.viewX;this.overlayHookPointY=ev.offsetY-this.viewY}else{this.overlayHookPointX=this.viewW/2;this.overlayHookPointY=this.viewH/2;this._eventMove(ev)}}},_eventMove:function(ev){var that=this;this._checkMousePosition(ev);if(!this.overlayInMovement){return}this.viewX=ev.offsetX-this.overlayHookPointX;this.viewY=ev.offsetY-this.overlayHookPointY;this.$view.css("left",this.viewX);this.$view.css("top",this.viewY);if(this.options.viewLiveFramerate!==false){if(this.options.viewLiveFramerate==0){this._moveCy()}else if(!this.overlayTimeout){this.overlayTimeout=setTimeout(function(){that._moveCy();that.overlayTimeout=false},1e3/this.options.viewLiveFramerate)}}},_checkMousePosition:function(ev){if(ev.offsetX>this.viewX&&ev.offsetXthis.viewY&&ev.offsetY
    ');$container.prepend($panzoom);$panzoom.css("position","absolute");$panzoom.data("winbdgs",winbdgs);$panzoom.data("cybdgs",cybdgs);if(options.zoomOnly){$panzoom.addClass("cy-panzoom-zoom-only")}var $zoomIn=$('
    ');$panzoom.append($zoomIn);var $zoomOut=$('
    ');$panzoom.append($zoomOut);var $reset=$('
    ');$panzoom.append($reset);var $slider=$('
    ');$panzoom.append($slider);$slider.append('
    ');var $sliderHandle=$('
    ');$slider.append($sliderHandle);var $noZoomTick=$('
    ');$slider.append($noZoomTick);var $panner=$('
    ');$panzoom.append($panner);var $pHandle=$('
    ');$panner.append($pHandle);var $pUp=$('
    ');var $pDown=$('
    ');var $pLeft=$('
    ');var $pRight=$('
    ');$panner.append($pUp).append($pDown).append($pLeft).append($pRight);var $pIndicator=$('
    ');$panner.append($pIndicator);function handle2pan(e){var v={x:e.originalEvent.pageX-$panner.offset().left-$panner.width()/2,y:e.originalEvent.pageY-$panner.offset().top-$panner.height()/2};var r=options.panDragAreaSize;var d=Math.sqrt(v.x*v.x+v.y*v.y);var percent=Math.min(d/r,1);if(dmax){top=max}var percent=1-(top-min)/(max-min);$sliderHandle.css("top",top);var zmin=options.minZoom;var zmax=options.maxZoom;var x=Math.log(zmin)/Math.log(zmax);var p=(1-x)*percent+x;var z=Math.pow(zmax,p);if(zzmax){z=zmax}zoomTo(z)}var sliderMdownHandler,sliderMmoveHandler;$sliderHandle.bind("mousedown",sliderMdownHandler=function(mdEvt){var handleOffset=mdEvt.target===$sliderHandle[0]?mdEvt.offsetY:0;sliding=true;startZooming();$sliderHandle.addClass("active");var lastMove=0;windowBind("mousemove",sliderMmoveHandler=function(mmEvt){var now=+new Date;if(now>lastMove+10){lastMove=now}else{return false}setSliderFromMouse(mmEvt,handleOffset);return false});windowBind("mouseup",function(){windowUnbind("mousemove",sliderMmoveHandler);sliding=false;$sliderHandle.removeClass("active");endZooming()});return false});$slider.bind("mousedown",function(e){if(e.target!==$sliderHandle[0]){sliderMdownHandler(e);setSliderFromMouse(e)}});function positionSliderFromZoom(){var cy=$container.cytoscape("get");var z=cy.zoom();var zmin=options.minZoom;var zmax=options.maxZoom;var x=Math.log(zmin)/Math.log(zmax);var p=Math.log(z)/Math.log(zmax);var percent=1-(p-x)/(1-x);var min=sliderPadding;var max=$slider.height()-$sliderHandle.height()-2*sliderPadding;var top=percent*(max-min);if(topmax){top=max}$sliderHandle.css("top",top)}positionSliderFromZoom();cyOn("zoom",function(){if(!sliding){positionSliderFromZoom()}});(function(){var z=1;var zmin=options.minZoom;var zmax=options.maxZoom;var x=Math.log(zmin)/Math.log(zmax);var p=Math.log(z)/Math.log(zmax);var percent=1-(p-x)/(1-x);if(percent>1||percent<0){$noZoomTick.hide();return}var min=sliderPadding;var max=$slider.height()-$sliderHandle.height()-2*sliderPadding;var top=percent*(max-min);if(topmax){top=max}$noZoomTick.css("top",top)})();function bindButton($button,factor){var zoomInterval;$button.bind("mousedown",function(e){e.preventDefault();e.stopPropagation();if(e.button!=0){return}var cy=$container.cytoscape("get");var doZoom=function(){var zoom=cy.zoom();var lvl=cy.zoom()*factor;if(lvloptions.maxZoom){lvl=options.maxZoom}if(lvl==options.maxZoom&&zoom==options.maxZoom||lvl==options.minZoom&&zoom==options.minZoom){return}zoomTo(lvl)};startZooming();doZoom();zoomInterval=setInterval(doZoom,options.zoomDelay);return false});windowBind("mouseup blur",function(){clearInterval(zoomInterval);endZooming()})}bindButton($zoomIn,1+options.zoomFactor);bindButton($zoomOut,1-options.zoomFactor);$reset.bind("mousedown",function(e){if(e.button!=0){return}var cy=$container.cytoscape("get");if(cy.elements().size()===0){cy.reset()}else{cy.fit(options.fitPadding)}return false})})}};if(functions[fn]){return functions[fn].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof fn=="object"||!fn){return functions.init.apply(this,arguments)}else{$.error("No such function `"+fn+"` for jquery.cytoscapePanzoom")}return $(this)};if(typeof module!=="undefined"&&module.exports){module.exports=register}if(typeof define!=="undefined"&&define.amd){define("cytoscape-panzoom",function(){return register})}if(typeof cytoscape!=="undefined"&&typeof jQuery!=="undefined"){register(cytoscape,jQuery)}})()},{}],30:[function(require,module,exports){(function($,$$){"use strict";var isObject=function(o){return o!=null&&typeof o==="object"};var isFunction=function(o){return o!=null&&typeof o==="function"};var isNumber=function(o){return o!=null&&typeof o==="number"};var isString=function(o){return o!=null&&typeof o==="string"};var isUndef=function(o){return o===undefined};var wrap=function(obj,target){if(isFunction(obj)){return function(event,api){return obj.apply(target,[event,api])}}else{return obj}};var throttle=function(func,wait,options){var leading=true,trailing=true;if(options===false){leading=false}else if(isObject(options)){leading="leading"in options?options.leading:leading;trailing="trailing"in options?options.trailing:trailing}options=options||{};options.leading=leading;options.maxWait=wait;options.trailing=trailing;return debounce(func,wait,options)};var debounce=function(func,wait,options){var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=false,trailing=true;if(!isFunction(func)){return}wait=Math.max(0,wait)||0;if(options===true){var leading=true;trailing=false}else if(isObject(options)){leading=options.leading;maxWait="maxWait"in options&&(Math.max(wait,options.maxWait)||0);trailing="trailing"in options?options.trailing:trailing}var delayed=function(){var remaining=wait-(Date.now()-stamp);if(remaining<=0){if(maxTimeoutId){clearTimeout(maxTimeoutId)}var isCalled=trailingCall;maxTimeoutId=timeoutId=trailingCall=undefined;if(isCalled){lastCalled=Date.now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}}else{timeoutId=setTimeout(delayed,remaining)}};var maxDelayed=function(){if(timeoutId){clearTimeout(timeoutId)}maxTimeoutId=timeoutId=trailingCall=undefined;if(trailing||maxWait!==wait){lastCalled=Date.now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}};return function(){args=arguments;stamp=Date.now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId}else{if(!maxTimeoutId&&!leading){lastCalled=stamp}var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0;if(isCalled){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId)}lastCalled=stamp;result=func.apply(thisArg,args)}else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining)}}if(isCalled&&timeoutId){timeoutId=clearTimeout(timeoutId)}else if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait)}if(leadingCall){isCalled=true;result=func.apply(thisArg,args)}if(isCalled&&!timeoutId&&!maxTimeoutId){args=thisArg=null}return result}};function register($$,$){var $qtipContainer=$("
    ");var viewportDebounceRate=250;function generateOpts(target,passedOpts){var qtip=target.scratch().qtip;var opts=$.extend({},passedOpts);if(!opts.id){opts.id="cy-qtip-target-"+(Date.now()+Math.round(Math.random()*1e4))}if(!qtip.$domEle){qtip.$domEle=$qtipContainer}opts.position=opts.position||{};opts.position.container=opts.position.container||$(document.body);opts.position.viewport=opts.position.viewport||$(document.body);opts.position.target=[0,0];opts.position.my=opts.position.my||"top center";opts.position.at=opts.position.at||"bottom center";var adjust=opts.position.adjust=opts.position.adjust||{};adjust.method=adjust.method||"flip";adjust.mouse=false;if(isUndef(adjust.cyAdjustToEleBB)){adjust.cyAdjustToEleBB=true}opts.show=opts.show||{};if(isUndef(opts.show.event)){opts.show.event="tap"}opts.hide=opts.hide||{};opts.hide.cyViewport=opts.hide.cyViewport===undefined?true:opts.hide.cyViewport;if(isUndef(opts.hide.event)){opts.hide.event="unfocus"}opts.overwrite=false;if(opts.content){if(isFunction(opts.content)||isString(opts.content)){opts.content=wrap(opts.content,target)}else{opts.content={text:wrap(opts.content.text,target),title:wrap(opts.content.title,target)}}}return opts}$$("collection","qtip",function(passedOpts){var eles=this;var cy=this.cy();var container=cy.container();if(passedOpts==="api"){return this.scratch().qtip.api}eles.each(function(i,ele){var scratch=ele.scratch();var qtip=scratch.qtip=scratch.qtip||{};var opts=generateOpts(ele,passedOpts);var adjNums=opts.position.adjust;qtip.$domEle.qtip(opts);var qtipApi=qtip.api=qtip.$domEle.qtip("api");qtip.$domEle.removeData("qtip");var updatePosition=function(e){var cOff=container.getBoundingClientRect();var pos=ele.renderedPosition()||(e?e.cyRenderedPosition:undefined);if(!pos||pos.x==null||isNaN(pos.x)){return}if(opts.position.adjust.cyAdjustToEleBB&&ele.isNode()){var my=opts.position.my.toLowerCase();var at=opts.position.at.toLowerCase();var z=cy.zoom();var w=ele.outerWidth()*z;var h=ele.outerHeight()*z;if(at.match("top")){pos.y-=h/2}else if(at.match("bottom")){pos.y+=h/2}if(at.match("left")){pos.x-=w/2}else if(at.match("right")){pos.x+=w/2}if(isNumber(adjNums.x)){pos.x+=adjNums.x}if(isNumber(adjNums.y)){pos.y+=adjNums.y}}qtipApi.set("position.adjust.x",cOff.left+pos.x+window.pageXOffset);qtipApi.set("position.adjust.y",cOff.top+pos.y+window.pageYOffset)};updatePosition();ele.on(opts.show.event,function(e){updatePosition(e);qtipApi.show()});ele.on(opts.hide.event,function(e){qtipApi.hide()});if(opts.hide.cyViewport){cy.on("viewport",debounce(function(){qtipApi.hide()},viewportDebounceRate,{leading:true}))}if(opts.position.adjust.cyViewport){cy.on("pan zoom",debounce(function(e){updatePosition(e);qtipApi.reposition()},viewportDebounceRate,{trailing:true}))}});return this});$$("core","qtip",function(passedOpts){var cy=this;var container=cy.container();if(passedOpts==="api"){return this.scratch().qtip.api}var scratch=cy.scratch();var qtip=scratch.qtip=scratch.qtip||{};var opts=generateOpts(cy,passedOpts);qtip.$domEle.qtip(opts);var qtipApi=qtip.api=qtip.$domEle.qtip("api");qtip.$domEle.removeData("qtip");var updatePosition=function(e){var cOff=container.getBoundingClientRect();var pos=e.cyRenderedPosition;if(!pos||pos.x==null||isNaN(pos.x)){return}qtipApi.set("position.adjust.x",cOff.left+pos.x+window.pageXOffset);qtipApi.set("position.adjust.y",cOff.top+pos.y+window.pageYOffset)};cy.on(opts.show.event,function(e){if(!opts.show.cyBgOnly||opts.show.cyBgOnly&&e.cyTarget===cy){updatePosition(e);qtipApi.show()}});cy.on(opts.hide.event,function(e){if(!opts.hide.cyBgOnly||opts.hide.cyBgOnly&&e.cyTarget===cy){qtipApi.hide()}});if(opts.hide.cyViewport){cy.on("viewport",debounce(function(){qtipApi.hide()},viewportDebounceRate,{leading:true}))}return this})}if(typeof module!=="undefined"&&module.exports){module.exports=register}if(typeof define!=="undefined"&&define.amd){define("cytoscape-qtip",function(){return register})}if($&&$$){register($$,$)}})(typeof jQuery!=="undefined"?jQuery:null,typeof cytoscape!=="undefined"?cytoscape:null)},{}],31:[function(require,module,exports){(function(){"use strict";var register=function(cytoscape){if(!cytoscape){return}var cy;var actions={};var undoStack=[];var redoStack=[];var _instance={options:{isDebug:false,actions:{},undoableDrag:true,stackSizeLimit:undefined,beforeUndo:function(){},afterUndo:function(){},beforeRedo:function(){},afterRedo:function(){},ready:function(){}}};cytoscape("core","undoRedo",function(options,dontInit){cy=this;function getScratch(){if(!cy.scratch("_undoRedo")){cy.scratch("_undoRedo",{})}return cy.scratch("_undoRedo")}if(options){for(var key in options)if(_instance.options.hasOwnProperty(key))_instance.options[key]=options[key];if(options.actions)for(var key in options.actions)actions[key]=options.actions[key]}if(!getScratch().isInitialized&&!dontInit){var defActions=defaultActions();for(var key in defActions)actions[key]=defActions[key];setDragUndo(_instance.options.undoableDrag);getScratch().isInitialized=true}_instance.options.ready();return _instance});_instance.reset=function(){undoStack=[];redoStack=[]};_instance.undo=function(){if(!this.isUndoStackEmpty()){var action=undoStack.pop();cy.trigger("beforeUndo",[action.name,action.args]);var res=actions[action.name]._undo(action.args);redoStack.push({name:action.name,args:res});cy.trigger("afterUndo",[action.name,action.args,res]);return res}else if(_instance.options.isDebug){console.log("Undoing cannot be done because undo stack is empty!")}};_instance.redo=function(){if(!this.isRedoStackEmpty()){var action=redoStack.pop();cy.trigger(action.firstTime?"beforeDo":"beforeRedo",[action.name,action.args]);if(!action.args)action.args={};action.args.firstTime=action.firstTime?true:false;var res=actions[action.name]._do(action.args);undoStack.push({name:action.name,args:res});if(_instance.options.stackSizeLimit!=undefined&&undoStack.length>_instance.options.stackSizeLimit){undoStack.shift()}cy.trigger(action.firstTime?"afterDo":"afterRedo",[action.name,action.args,res]);return res}else if(_instance.options.isDebug){console.log("Redoing cannot be done because redo stack is empty!")}};_instance.do=function(actionName,args){redoStack=[];redoStack.push({name:actionName,args:args,firstTime:true});return this.redo()};_instance.undoAll=function(){while(!this.isUndoStackEmpty()){this.undo()}};_instance.redoAll=function(){while(!this.isRedoStackEmpty()){this.redo()}};_instance.action=function(actionName,_do,_undo){actions[actionName]={_do:_do,_undo:_undo};return _instance};_instance.removeAction=function(actionName){delete actions[actionName]};_instance.isUndoStackEmpty=function(){return undoStack.length===0};_instance.isRedoStackEmpty=function(){return redoStack.length===0; -};_instance.getUndoStack=function(){return undoStack};_instance.getRedoStack=function(){return redoStack};var lastMouseDownNodeInfo=null;var isDragDropSet=false;function setDragUndo(undoable){isDragDropSet=true;cy.on("grab","node",function(){if(typeof undoable==="function"?undoable.call(this):undoable){lastMouseDownNodeInfo={};lastMouseDownNodeInfo.lastMouseDownPosition={x:this.position("x"),y:this.position("y")};lastMouseDownNodeInfo.node=this}});cy.on("free","node",function(){if(typeof undoable==="function"?undoable.call(this):undoable){if(lastMouseDownNodeInfo==null){return}var node=lastMouseDownNodeInfo.node;var lastMouseDownPosition=lastMouseDownNodeInfo.lastMouseDownPosition;var mouseUpPosition={x:node.position("x"),y:node.position("y")};if(mouseUpPosition.x!=lastMouseDownPosition.x||mouseUpPosition.y!=lastMouseDownPosition.y){var positionDiff={x:mouseUpPosition.x-lastMouseDownPosition.x,y:mouseUpPosition.y-lastMouseDownPosition.y};var nodes;if(node.selected()){nodes=cy.nodes(":visible").filter(":selected")}else{nodes=cy.collection([node])}var param={positionDiff:positionDiff,nodes:nodes,move:false};_instance.do("drag",param);lastMouseDownNodeInfo=null}}})}function getTopMostNodes(nodes){var nodesMap={};for(var i=0;i0){location.parent=eles.newNodes[0].parent();for(var i=0;i0){var minPos=findMin(openSet,fScore);var cMin=cy.getElementById(openSet[minPos]);steps++;if(cMin.id()==target.id()){var rPath=reconstructPath(source.id(),target.id(),cameFrom,[]);rPath.reverse();return{found:true,distance:gScore[cMin.id()],path:eles.spawn(rPath),steps:steps}}closedSet.push(cMin.id());openSet.splice(minPos,1);var vwEdges=cMin.connectedEdges();if(directed){vwEdges=vwEdges.stdFilter(function(ele){return ele.data("source")===cMin.id()})}vwEdges=vwEdges.intersect(edges);for(var i=0;imax){max=val}},get:function(key){return _C[key]}};for(var i=0;i0){edge=vEle.edgesTo(w)[0]}else{edge=w.edgesTo(vEle)[0]}var edgeWeight=weightFn.apply(edge,[edge]);w=w.id();if(d[w]>d[v]+edgeWeight){d[w]=d[v]+edgeWeight;if(Q.nodes.indexOf(w)<0){Q.push(w)}else{Q.updateItem(w)}g[w]=0;P[w]=[]}if(d[w]==d[v]+edgeWeight){g[w]=g[w]+g[v];P[w].push(v)}}}else{for(var j=0;j0){var w=S.pop();for(var j=0;j0){var u=Q.pop();var smalletsDist=getDist(u);var uid=u.id();knownDist[uid]=smalletsDist;if(smalletsDist===Math.Infinite){break}var neighbors=u.neighborhood().intersect(nodes);for(var i=0;i0){S.unshift(target);while(prev[u.id()]){var p=prev[u.id()];S.unshift(p.edge);S.unshift(p.node);u=p.node}}return cy.collection(S)}}}};module.exports=elesfn},{"../../heap":112,"../../is":114}],41:[function(require,module,exports){"use strict";var is=require("../../is");var elesfn={floydWarshall:function(options){options=options||{};var cy=this.cy();if(options.weight!=null&&is.fn(options.weight)){var weightFn=options.weight}else{var weightFn=function(e){return 1}}if(options.directed!=null){var directed=options.directed}else{var directed=false}var edges=this.edges().stdFilter(function(e){return!e.isLoop()});var nodes=this.nodes();var numNodes=nodes.length;var id2position={};for(var i=0;iweight){dist[sourceIndex][targetIndex]=weight;next[sourceIndex][targetIndex]=targetIndex;edgeNext[sourceIndex][targetIndex]=edges[i]}}if(!directed){for(var i=0;iweight){dist[sourceIndex][targetIndex]=weight;next[sourceIndex][targetIndex]=targetIndex;edgeNext[sourceIndex][targetIndex]=edges[i]}}}for(var k=0;k0){location.parent=eles.newNodes[0].parent();for(var i=0;i":".","?":"/","|":"\\"};var _SPECIAL_ALIASES={option:"alt",command:"meta","return":"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"};var _REVERSE_MAP;for(var i=1;i<20;++i){_MAP[111+i]="f"+i}for(i=0;i<=9;++i){_MAP[i+96]=i}function _addEvent(object,type,callback){if(object.addEventListener){object.addEventListener(type,callback,false);return}object.attachEvent("on"+type,callback)}function _characterFromEvent(e){if(e.type=="keypress"){var character=String.fromCharCode(e.which);if(!e.shiftKey){character=character.toLowerCase()}return character}if(_MAP[e.which]){return _MAP[e.which]}if(_KEYCODE_MAP[e.which]){return _KEYCODE_MAP[e.which]}return String.fromCharCode(e.which).toLowerCase()}function _modifiersMatch(modifiers1,modifiers2){return modifiers1.sort().join(",")===modifiers2.sort().join(",")}function _eventModifiers(e){var modifiers=[];if(e.shiftKey){modifiers.push("shift")}if(e.altKey){modifiers.push("alt")}if(e.ctrlKey){modifiers.push("ctrl")}if(e.metaKey){modifiers.push("meta")}return modifiers}function _preventDefault(e){if(e.preventDefault){e.preventDefault();return}e.returnValue=false}function _stopPropagation(e){if(e.stopPropagation){e.stopPropagation();return}e.cancelBubble=true}function _isModifier(key){return key=="shift"||key=="ctrl"||key=="alt"||key=="meta"}function _getReverseMap(){if(!_REVERSE_MAP){_REVERSE_MAP={};for(var key in _MAP){if(key>95&&key<112){continue}if(_MAP.hasOwnProperty(key)){_REVERSE_MAP[_MAP[key]]=key}}}return _REVERSE_MAP}function _pickBestAction(key,modifiers,action){if(!action){action=_getReverseMap()[key]?"keydown":"keypress"}if(action=="keypress"&&modifiers.length){action="keydown"}return action}function _keysFromString(combination){if(combination==="+"){return["+"]}combination=combination.replace(/\+{2}/g,"+plus");return combination.split("+")}function _getKeyInfo(combination,action){var keys;var key;var i;var modifiers=[];keys=_keysFromString(combination);for(i=0;i1){_bindSequence(combination,sequence,callback,action);return}info=_getKeyInfo(combination,action);self._callbacks[info.key]=self._callbacks[info.key]||[];_getMatches(info.key,info.modifiers,{type:info.action},sequenceName,combination,level);self._callbacks[info.key][sequenceName?"unshift":"push"]({callback:callback,modifiers:info.modifiers,action:info.action,seq:sequenceName,level:level,combo:combination})}self._bindMultiple=function(combinations,callback,action){for(var i=0;i-1){return false}if(_belongsTo(element,self.target)){return false}return element.tagName=="INPUT"||element.tagName=="SELECT"||element.tagName=="TEXTAREA"||element.isContentEditable};Mousetrap.prototype.handleKey=function(){var self=this;return self._handleKey.apply(self,arguments)};Mousetrap.addKeycodes=function(object){for(var key in object){if(object.hasOwnProperty(key)){_MAP[key]=object[key]}}_REVERSE_MAP=null};Mousetrap.init=function(){var documentMousetrap=Mousetrap(document);for(var method in documentMousetrap){if(method.charAt(0)!=="_"){Mousetrap[method]=function(method){return function(){return documentMousetrap[method].apply(documentMousetrap,arguments)}}(method)}}};Mousetrap.init();window.Mousetrap=Mousetrap;if(typeof module!=="undefined"&&module.exports){module.exports=Mousetrap}if(typeof define==="function"&&define.amd){define(function(){return Mousetrap})}})(typeof window!=="undefined"?window:null,typeof window!=="undefined"?document:null)},{}],2:[function(_dereq_,module,exports){(function(){"use strict";var register=function(cytoscape,$){if(!cytoscape||!$){return}var options={node:{highlighted:{},unhighlighted:{opacity:.3}},edge:{highlighted:{},unhighlighted:{opacity:.3}},setVisibilityOnHide:false,setDisplayOnHide:true,neighbor:function(node){return false},neighborSelectTime:500};var undoRedo=_dereq_("./undo-redo");var viewUtilities=_dereq_("./view-utilities");var Mousetrap=_dereq_("mousetrap");cytoscape("core","viewUtilities",function(opts){var cy=this;if(opts==="get"){return viewUtilities}$.extend(true,options,opts);function getScratch(eleOrCy){if(!eleOrCy.scratch("_viewUtilities")){eleOrCy.scratch("_viewUtilities",{})}return eleOrCy.scratch("_viewUtilities")}if(!getScratch(cy).initialized){getScratch(cy).initialized=true;viewUtilities(cy,options);if(cy.undoRedo){var ur=cy.undoRedo(null,true);undoRedo(cy,ur,viewUtilities)}var mt=new Mousetrap;var shiftKeyDown=false;mt.bind(["shift"],function(){shiftKeyDown=true},"keydown");mt.bind(["shift"],function(){shiftKeyDown=false},"keyup");cy.on("taphold","node",function(event){var cyTarget=event.cyTarget;var tapheld=false;var neighborhood;var timeout=setTimeout(function(){if(shiftKeyDown==true){cy.elements().unselect();neighborhood=options.neighbor(cyTarget);neighborhood.select();cyTarget.lock();tapheld=true}},options.neighborSelectTime-500);cy.on("free",cyTarget,function(){if(tapheld===true){tapheld=false;neighborhood.select();cyTarget.unlock()}else{clearTimeout(timeout)}});cy.on("drag",cyTarget,function(){if(tapheld===false){clearTimeout(timeout)}})})}return viewUtilities})};if(typeof module!=="undefined"&&module.exports){module.exports=register}if(typeof define!=="undefined"&&define.amd){define("cytoscape-view-utilities",function(){return register})}if(typeof cytoscape!=="undefined"&&typeof $!=="undefined"){register(cytoscape,$)}})()},{"./undo-redo":3,"./view-utilities":4,mousetrap:1}],3:[function(_dereq_,module,exports){function highlightUR(cy,ur,viewUtilities){function getStatus(eles){eles=eles?eles:cy.elements();return{highlighteds:eles.filter(".highlighted:visible"),unhighlighteds:eles.filter(".unhighlighted:visible"),notHighlighteds:eles.filter(":visible").not(".highlighted, .unhighlighted")}}function generalUndo(args){var current=args.current;var highlighteds=viewUtilities.highlight(args.highlighteds);var unhighlighteds=viewUtilities.unhighlight(args.unhighlighteds);var notHighlighteds=viewUtilities.removeHighlights(args.notHighlighteds);return{highlighteds:highlighteds,unhighlighteds:unhighlighteds,notHighlighteds:notHighlighteds,current:current}}function generalRedo(args){var current=args.current;var highlighteds=viewUtilities.highlight(args.current.highlighteds);var unhighlighteds=viewUtilities.unhighlight(args.current.unhighlighteds);var notHighlighteds=viewUtilities.removeHighlights(args.current.notHighlighteds);return{highlighteds:highlighteds,unhighlighteds:unhighlighteds,notHighlighteds:notHighlighteds,current:current}}function generateDoFunc(func){return function(eles){var res=getStatus();if(eles.firstTime)viewUtilities[func](eles);else generalRedo(eles);res.current=getStatus();return res}}function urRemoveHighlights(args){var res=getStatus();if(args.firstTime)viewUtilities.removeHighlights();else generalRedo(args);res.current=getStatus();return res}ur.action("highlightNeighbors",generateDoFunc("highlightNeighbors"),generalUndo);ur.action("highlightNeighbours",generateDoFunc("highlightNeighbours"),generalUndo);ur.action("highlight",generateDoFunc("highlight"),generalUndo);ur.action("unhighlight",generateDoFunc("unhighlight"),generalUndo);ur.action("unhighlightNeighbors",generateDoFunc("unhighlightNeighbors"),generalUndo);ur.action("unhighlightNeighbours",generateDoFunc("unhighlightNeighbours"),generalUndo);ur.action("removeHighlights",urRemoveHighlights,generalUndo)}function hideShowUR(cy,ur,viewUtilities){function urShow(eles){return viewUtilities.show(eles)}function urHide(eles){return viewUtilities.hide(eles)}ur.action("show",urShow,urHide);ur.action("hide",urHide,urShow)}module.exports=function(cy,ur,viewUtilities){highlightUR(cy,ur,viewUtilities);hideShowUR(cy,ur,viewUtilities)}},{}],4:[function(_dereq_,module,exports){var cy,options;var viewUtilities=function(_cy,_options){cy=_cy;options=_options;cy.style().selector("node.highlighted").css(options.node.highlighted).selector("node.unhighlighted").css(options.node.unhighlighted).selector("edge.highlighted").css(options.edge.highlighted).selector("edge.unhighlighted").css(options.edge.unhighlighted).update()};function highlight(eles){eles.removeClass("unhighlighted").addClass("highlighted")}function getWithNeighbors(eles){return eles.add(eles.descendants()).closedNeighborhood()}viewUtilities.hide=function(eles){eles=eles.filter(":visible");eles=eles.union(eles.connectedEdges());eles.unselect();if(options.setVisibilityOnHide){eles.css("visibility","hidden")}if(options.setDisplayOnHide){eles.css("display","none")}return eles};viewUtilities.show=function(eles){eles=eles.not(":visible");eles=eles.union(eles.connectedEdges());eles.unselect();if(options.setVisibilityOnHide){eles.css("visibility","visible")}if(options.setDisplayOnHide){eles.css("display","element")}return eles};viewUtilities.highlight=function(eles){var others=cy.elements().difference(eles.union(eles.ancestors()));if(cy.$(".highlighted:visible").length==0)this.unhighlight(others);highlight(eles);return eles};viewUtilities.unhighlight=function(eles){eles.removeClass("highlighted").addClass("unhighlighted")};viewUtilities.highlightNeighbors=function(eles){var allEles=getWithNeighbors(eles);return this.highlight(allEles)};viewUtilities.highlightNeighbours=function(eles){return this.highlightNeighbors(eles)};viewUtilities.unhighlightNeighbors=function(eles){var allEles=getWithNeighbors(eles);return this.unhighlight(allEles)};viewUtilities.unhighlightNeighbours=function(eles){this.unhighlightNeighbors(eles)};viewUtilities.removeHighlights=function(eles){if(!eles){eles=cy.elements()}return eles.removeClass("highlighted").removeClass("unhighlighted").removeData("highlighted")};viewUtilities.isHighlighted=function(ele){return ele.is(".highlighted:visible")?true:false};module.exports=viewUtilities},{}]},{},[2])(2)})}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],33:[function(require,module,exports){"use strict"},{}],34:[function(require,module,exports){"use strict";var util=require("./util");var is=require("./is");var Promise=require("./promise");var Animation=function(target,opts,opts2){if(!(this instanceof Animation)){return new Animation(target,opts,opts2)}var _p=this._private=util.extend({duration:1e3},opts,opts2);_p.target=target;_p.style=_p.style||_p.css;_p.started=false;_p.playing=false;_p.hooked=false;_p.applying=false;_p.progress=0;_p.completes=[];_p.frames=[];if(_p.complete&&is.fn(_p.complete)){_p.completes.push(_p.complete)}this.length=1;this[0]=this};var anifn=Animation.prototype;util.extend(anifn,{instanceString:function(){return"animation"},hook:function(){var _p=this._private;if(!_p.hooked){var q;var tAni=_p.target._private.animation;if(_p.queue){q=tAni.queue}else{q=tAni.current}q.push(this);if(is.elementOrCollection(_p.target)){_p.target.cy().addToAnimationPool(_p.target)}_p.hooked=true}return this},play:function(){var _p=this._private;if(_p.progress===1){_p.progress=0}_p.playing=true;_p.started=false;_p.stopped=false;this.hook();return this},playing:function(){return this._private.playing},apply:function(){var _p=this._private;_p.applying=true;_p.started=false;_p.stopped=false;this.hook();return this},applying:function(){return this._private.applying},pause:function(){var _p=this._private;_p.playing=false;_p.started=false;return this},stop:function(){var _p=this._private;_p.playing=false;_p.started=false;_p.stopped=true;return this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(t){var _p=this._private;if(t===undefined){return _p.progress*_p.duration}else{return this.progress(t/_p.duration)}},progress:function(p){var _p=this._private;var wasPlaying=_p.playing;if(p===undefined){return _p.progress}else{if(wasPlaying){this.pause()}_p.progress=p;_p.started=false;if(wasPlaying){this.play()}}return this},completed:function(){return this._private.progress===1},reverse:function(){var _p=this._private;var wasPlaying=_p.playing;if(wasPlaying){this.pause()}_p.progress=1-_p.progress;_p.started=false;var swap=function(a,b){var _pa=_p[a];_p[a]=_p[b];_p[b]=_pa};swap("zoom","startZoom");swap("pan","startPan");swap("position","startPosition");for(var i=0;i<_p.style.length;i++){var prop=_p.style[i];var name=prop.name;var startStyleProp=_p.startStyle[name];_p.startStyle[name]=prop;_p.style[i]=startStyleProp}if(wasPlaying){this.play()}return this},promise:function(type){var _p=this._private;var arr;switch(type){case"frame":arr=_p.frames;break;default:case"complete":case"completed":arr=_p.completes}return new Promise(function(resolve,reject){arr.push(function(){resolve()})})}});anifn.complete=anifn.completed;module.exports=Animation},{"./is":115,"./promise":118,"./util":132}],35:[function(require,module,exports){"use strict";var is=require("../../is");var elesfn={aStar:function(options){var eles=this;options=options||{};var reconstructPath=function(start,end,cameFromMap,pathAcum){if(start==end){pathAcum.push(cy.getElementById(end));return pathAcum}if(end in cameFromMap){var previous=cameFromMap[end];var previousEdge=cameFromEdge[end];pathAcum.push(cy.getElementById(end));pathAcum.push(cy.getElementById(previousEdge));return reconstructPath(start,previous,cameFromMap,pathAcum)}return undefined};var findMin=function(openSet,fScore){if(openSet.length===0){return undefined}var minPos=0;var tempScore=fScore[openSet[0]];for(var i=1;i0){var minPos=findMin(openSet,fScore);var cMin=cy.getElementById(openSet[minPos]);steps++;if(cMin.id()==target.id()){var rPath=reconstructPath(source.id(),target.id(),cameFrom,[]);rPath.reverse();return{found:true,distance:gScore[cMin.id()],path:eles.spawn(rPath),steps:steps}}closedSet.push(cMin.id());openSet.splice(minPos,1);var vwEdges=cMin.connectedEdges();if(directed){vwEdges=vwEdges.stdFilter(function(ele){return ele.data("source")===cMin.id()})}vwEdges=vwEdges.intersect(edges);for(var i=0;imax){max=val}},get:function(key){return _C[key]}};for(var i=0;i0){edge=vEle.edgesTo(w)[0]}else{edge=w.edgesTo(vEle)[0]}var edgeWeight=weightFn.apply(edge,[edge]);w=w.id();if(d[w]>d[v]+edgeWeight){d[w]=d[v]+edgeWeight;if(Q.nodes.indexOf(w)<0){Q.push(w)}else{Q.updateItem(w)}g[w]=0;P[w]=[]}if(d[w]==d[v]+edgeWeight){g[w]=g[w]+g[v];P[w].push(v)}}}else{for(var j=0;j0){var w=S.pop();for(var j=0;j0){this.spawn(changed).updateStyle().trigger("class")}return self},addClass:function(classes){return this.toggleClass(classes,true)},hasClass:function(className){var ele=this[0];return ele!=null&&ele._private.classes[className]?true:false},toggleClass:function(classesStr,toggle){var classes=classesStr.match(/\S+/g)||[];var self=this;var changed=[];for(var i=0,il=self.length;i0){this.spawn(changed).updateStyle().trigger("class")}return self},removeClass:function(classes){return this.toggleClass(classes,false)},flashClass:function(classes,duration){var self=this;if(duration==null){duration=250}else if(duration===0){return self}self.addClass(classes);setTimeout(function(){self.removeClass(classes)},duration);return self}};module.exports=elesfn},{"../util":131}],48:[function(require,module,exports){"use strict";var elesfn={allAre:function(selector){return this.filter(selector).length===this.length},is:function(selector){return this.filter(selector).length>0},some:function(fn,thisArg){for(var i=0;i0},allAreNeighbors:function(collection){collection=this.cy().collection(collection);return this.neighborhood().intersect(collection).length===collection.length}};elesfn.allAreNeighbours=elesfn.allAreNeighbors;module.exports=elesfn},{}],49:[function(require,module,exports){"use strict";var elesfn={parent:function(selector){var parents=[];var cy=this._private.cy;for(var i=0;i0){parents.push(parent)}}return this.spawn(parents,{unique:true}).filter(selector)},parents:function(selector){var parents=[];var eles=this.parent();while(eles.nonempty()){for(var i=0;imax}),minIndegree:defineDegreeBoundsFunction("indegree",function(degree,min){return degreemax}),minOutdegree:defineDegreeBoundsFunction("outdegree",function(degree,min){return degreemax})});util.extend(elesfn,{totalDegree:function(includeLoops){var total=0;var nodes=this.nodes();for(var i=0;i0?this.add(updatedEles):this;if(silent){toTrigger.trigger("position")}else{toTrigger.rtrigger("position")}}return this},silentPositions:function(pos){return this.positions(pos,true)},renderedPosition:function(dim,val){var ele=this[0];var cy=this.cy();var zoom=cy.zoom();var pan=cy.pan();var rpos=is.plainObject(dim)?dim:undefined;var setting=rpos!==undefined||val!==undefined&&is.string(dim);if(ele&&ele.isNode()){if(setting){for(var i=0;i0;var relativeToParent=hasParent;if(hasParent){parent=parent[0]}var origin=relativeToParent?parent._private.position:{x:0,y:0};if(val!==undefined){ele._private.position[dim]=val+origin[dim]}else if(ppos!==undefined){ele._private.position={x:ppos.x+origin.x,y:ppos.y+origin.y}}}this.rtrigger("position")}else{var pos=ele._private.position;var parent=hasCompoundNodes?ele.parent():null;var hasParent=parent&&parent.length>0;var relativeToParent=hasParent;if(hasParent){parent=parent[0]}var origin=relativeToParent?parent._private.position:{x:0,y:0};ppos={x:pos.x-origin.x,y:pos.y-origin.y};if(dim===undefined){return ppos}else{return ppos[dim]}}}else if(!setting){return undefined}return this},renderedBoundingBox:function(options){var bb=this.boundingBox(options);var cy=this.cy();var zoom=cy.zoom();var pan=cy.pan();var x1=bb.x1*zoom+pan.x;var x2=bb.x2*zoom+pan.x;var y1=bb.y1*zoom+pan.y;var y2=bb.y2*zoom+pan.y;return{x1:x1,x2:x2,y1:y1,y2:y2,w:x2-x1,h:y2-y1}},updateCompoundBounds:function(){var cy=this.cy();if(!cy.styleEnabled()||!cy.hasCompoundNodes()){return cy.collection()}var updated=[];function update(parent){if(!parent.isParent()){return}var _p=parent._private;var children=parent.children();var includeLabels=parent.pstyle("compound-sizing-wrt-labels").value==="include";var bb=children.boundingBox({includeLabels:includeLabels,includeShadows:false,includeOverlays:false,useCache:false});var padding={top:parent.pstyle("padding-top").pfValue,bottom:parent.pstyle("padding-bottom").pfValue,left:parent.pstyle("padding-left").pfValue,right:parent.pstyle("padding-right").pfValue};var pos=_p.position;_p.autoWidth=bb.w;pos.x=(bb.x1+bb.x2-padding.left+padding.right)/2;_p.autoHeight=bb.h;pos.y=(bb.y1+bb.y2-padding.top+padding.bottom)/2;updated.push(parent)}var eles=this;while(eles.nonempty()){for(var i=0;ib.x2?x2:b.x2;b.y1=y1b.y2?y2:b.y2};var updateBoundsFromBox=function(b,b2){return updateBounds(b,b2.x1,b2.y1,b2.x2,b2.y2)};var prefixedProperty=function(obj,field,prefix){return util.getPrefixedProperty(obj,field,prefix)};var updateBoundsFromArrow=function(bounds,ele,prefix,options){var _p=ele._private;var rstyle=_p.rstyle;var halfArW=rstyle.arrowWidth/2;var arrowType=ele.pstyle(prefix+"-arrow-shape").value;var x;var y;if(arrowType!=="none"){if(prefix==="source"){x=rstyle.srcX;y=rstyle.srcY}else if(prefix==="target"){x=rstyle.tgtX;y=rstyle.tgtY}else{x=rstyle.midX;y=rstyle.midY}updateBounds(bounds,x-halfArW,y-halfArW,x+halfArW,y+halfArW)}};var updateBoundsFromLabel=function(bounds,ele,prefix,options){var prefixDash;if(prefix){prefixDash=prefix+"-"}else{prefixDash=""}var _p=ele._private;var rstyle=_p.rstyle;var label=ele.pstyle(prefixDash+"label").strValue;if(label){var halign=ele.pstyle("text-halign");var valign=ele.pstyle("text-valign");var labelWidth=prefixedProperty(rstyle,"labelWidth",prefix);var labelHeight=prefixedProperty(rstyle,"labelHeight",prefix);var labelX=prefixedProperty(rstyle,"labelX",prefix);var labelY=prefixedProperty(rstyle,"labelY",prefix);var marginX=ele.pstyle(prefixDash+"text-margin-x").pfValue;var marginY=ele.pstyle(prefixDash+"text-margin-y").pfValue;var isEdge=ele.isEdge();var rotation=ele.pstyle(prefixDash+"text-rotation");var shadowR=ele.pstyle("text-shadow-blur").pfValue/2;var shadowX=ele.pstyle("text-shadow-offset-x").pfValue;var shadowY=ele.pstyle("text-shadow-offset-y").pfValue;var shadowOpacity=ele.pstyle("text-shadow-opacity").value;var outlineWidth=ele.pstyle("text-outline-width").pfValue;var borderWidth=ele.pstyle("text-border-width").pfValue;var halfBorderWidth=borderWidth/2;var lh=labelHeight;var lw=labelWidth;var lw_2=lw/2;var lh_2=lh/2;var lx1,lx2,ly1,ly2;if(isEdge){lx1=labelX-lw_2;lx2=labelX+lw_2;ly1=labelY-lh_2;ly2=labelY+lh_2}else{switch(halign.value){case"left":lx1=labelX-lw;lx2=labelX;break;case"center":lx1=labelX-lw_2;lx2=labelX+lw_2;break;case"right":lx1=labelX;lx2=labelX+lw;break}switch(valign.value){case"top":ly1=labelY-lh;ly2=labelY;break;case"center":ly1=labelY-lh_2;ly2=labelY+lh_2;break;case"bottom":ly1=labelY;ly2=labelY+lh;break}}var isAutorotate=isEdge&&rotation.strValue==="autorotate";var isPfValue=rotation.pfValue!=null&&rotation.pfValue!==0;if(isAutorotate||isPfValue){var theta=isAutorotate?prefixedProperty(_p.rstyle,"labelAngle",prefix):rotation.pfValue;var cos=Math.cos(theta);var sin=Math.sin(theta);var rotate=function(x,y){x=x-labelX;y=y-labelY;return{x:x*cos-y*sin+labelX,y:x*sin+y*cos+labelY}};var px1y1=rotate(lx1,ly1);var px1y2=rotate(lx1,ly2);var px2y1=rotate(lx2,ly1);var px2y2=rotate(lx2,ly2);lx1=Math.min(px1y1.x,px1y2.x,px2y1.x,px2y2.x);lx2=Math.max(px1y1.x,px1y2.x,px2y1.x,px2y2.x);ly1=Math.min(px1y1.y,px1y2.y,px2y1.y,px2y2.y);ly2=Math.max(px1y1.y,px1y2.y,px2y1.y,px2y2.y)}lx1+=marginX-Math.max(outlineWidth,halfBorderWidth);lx2+=marginX+Math.max(outlineWidth,halfBorderWidth);ly1+=marginY-Math.max(outlineWidth,halfBorderWidth);ly2+=marginY+Math.max(outlineWidth,halfBorderWidth);updateBounds(bounds,lx1,ly1,lx2,ly2);if(options.includeShadows&&shadowOpacity>0){lx1+=-shadowR+shadowX;lx2+=+shadowR+shadowX;ly1+=-shadowR+shadowY;ly2+=+shadowR+shadowY;updateBounds(bounds,lx1,ly1,lx2,ly2)}}return bounds};var boundingBoxImpl=function(ele,options){var cy=ele._private.cy;var cy_p=cy._private;var styleEnabled=cy_p.styleEnabled;var bounds={x1:Infinity,y1:Infinity,x2:-Infinity,y2:-Infinity};var _p=ele._private;var display=styleEnabled?ele.pstyle("display").value:"element";var isNode=ele.isNode();var isEdge=ele.isEdge();var ex1,ex2,ey1,ey2,x,y;var displayed=display!=="none";if(displayed){var overlayOpacity=0;var overlayPadding=0;if(styleEnabled&&options.includeOverlays){overlayOpacity=ele.pstyle("overlay-opacity").value;if(overlayOpacity!==0){overlayPadding=ele.pstyle("overlay-padding").value}}var w=0;var wHalf=0;if(styleEnabled){w=ele.pstyle("width").pfValue;wHalf=w/2}if(isNode&&options.includeNodes){var pos=_p.position;x=pos.x;y=pos.y;var w=ele.outerWidth();var halfW=w/2;var h=ele.outerHeight();var halfH=h/2;ex1=x-halfW-overlayPadding;ex2=x+halfW+overlayPadding;ey1=y-halfH-overlayPadding;ey2=y+halfH+overlayPadding;updateBounds(bounds,ex1,ey1,ex2,ey2)}else if(isEdge&&options.includeEdges){var rstyle=_p.rstyle||{};if(styleEnabled){ex1=Math.min(rstyle.srcX,rstyle.midX,rstyle.tgtX);ex2=Math.max(rstyle.srcX,rstyle.midX,rstyle.tgtX);ey1=Math.min(rstyle.srcY,rstyle.midY,rstyle.tgtY);ey2=Math.max(rstyle.srcY,rstyle.midY,rstyle.tgtY);ex1-=wHalf;ex2+=wHalf;ey1-=wHalf;ey2+=wHalf;updateBounds(bounds,ex1,ey1,ex2,ey2)}if(styleEnabled&&ele.pstyle("curve-style").strValue==="haystack"){var hpts=rstyle.haystackPts;ex1=hpts[0].x;ey1=hpts[0].y;ex2=hpts[1].x;ey2=hpts[1].y;if(ex1>ex2){var temp=ex1;ex1=ex2;ex2=temp}if(ey1>ey2){var temp=ey1;ey1=ey2;ey2=temp}updateBounds(bounds,ex1-wHalf,ey1-wHalf,ex2+wHalf,ey2+wHalf)}else{var pts=rstyle.bezierPts||rstyle.linePts||[];for(var j=0;jex2){var temp=ex1;ex1=ex2;ex2=temp}if(ey1>ey2){var temp=ey1;ey1=ey2;ey2=temp}ex1-=wHalf;ex2+=wHalf;ey1-=wHalf;ey2+=wHalf;updateBounds(bounds,ex1,ey1,ex2,ey2)}}}if(styleEnabled){ex1=bounds.x1;ex2=bounds.x2;ey1=bounds.y1;ey2=bounds.y2;if(options.includeShadows&&ele.pstyle("shadow-opacity").value>0){var r=ele.pstyle("shadow-blur").pfValue/2;var ox=ele.pstyle("shadow-offset-x").pfValue;var oy=ele.pstyle("shadow-offset-y").pfValue;updateBounds(bounds,ex1-r+ox,ey1-r+oy,ex2+r+ox,ey2+r+oy)}updateBounds(bounds,ex1-overlayPadding,ey1-overlayPadding,ex2+overlayPadding,ey2+overlayPadding)}if(styleEnabled&&options.includeEdges&&isEdge){updateBoundsFromArrow(bounds,ele,"mid-source",options);updateBoundsFromArrow(bounds,ele,"mid-target",options);updateBoundsFromArrow(bounds,ele,"source",options);updateBoundsFromArrow(bounds,ele,"target",options)}if(styleEnabled&&options.includeLabels){updateBoundsFromLabel(bounds,ele,null,options);if(isEdge){updateBoundsFromLabel(bounds,ele,"source",options);updateBoundsFromLabel(bounds,ele,"target",options)}}}bounds.x1=noninf(bounds.x1);bounds.y1=noninf(bounds.y1);bounds.x2=noninf(bounds.x2);bounds.y2=noninf(bounds.y2);bounds.w=noninf(bounds.x2-bounds.x1);bounds.h=noninf(bounds.y2-bounds.y1);if(bounds.w>0&&bounds.h>0&&displayed){math.expandBoundingBox(bounds,1)}return bounds};var tf=function(val){if(val){return"t"}else{return"f"}};var getKey=function(opts){var key="";key+=tf(opts.incudeNodes);key+=tf(opts.includeEdges);key+=tf(opts.includeLabels);key+=tf(opts.includeShadows);key+=tf(opts.includeOverlays);return key};var cachedBoundingBoxImpl=function(ele,opts){var _p=ele._private;var bb;var headless=ele.cy().headless();var key=opts===defBbOpts?defBbOptsKey:getKey(opts);if(!opts.useCache||headless||!_p.bbCache||!_p.bbCache[key]){bb=boundingBoxImpl(ele,opts);if(!headless){_p.bbCache=_p.bbCache||{};_p.bbCache[key]=bb}}else{bb=_p.bbCache[key]}return bb};var defBbOpts={includeNodes:true,includeEdges:true,includeLabels:true,includeShadows:true,includeOverlays:true,useCache:true};var defBbOptsKey=getKey(defBbOpts);elesfn.recalculateRenderedStyle=function(useCache){var cy=this.cy();var renderer=cy.renderer();var styleEnabled=cy.styleEnabled();if(renderer&&styleEnabled){renderer.recalculateRenderedStyle(this,useCache)}return this};elesfn.boundingBox=function(options){if(this.length===1&&this[0]._private.bbCache&&(options===undefined||options.useCache===undefined||options.useCache===true)){if(options===undefined){options=defBbOpts}return cachedBoundingBoxImpl(this[0],options)}var bounds={x1:Infinity,y1:Infinity,x2:-Infinity,y2:-Infinity};options=options||util.staticEmptyObject();var opts={includeNodes:util.default(options.includeNodes,defBbOpts.includeNodes),includeEdges:util.default(options.includeEdges,defBbOpts.includeEdges),includeLabels:util.default(options.includeLabels,defBbOpts.includeLabels),includeShadows:util.default(options.includeShadows,defBbOpts.includeShadows),includeOverlays:util.default(options.includeOverlays,defBbOpts.includeOverlays),useCache:util.default(options.useCache,defBbOpts.useCache)};var eles=this;var cy=eles.cy();var styleEnabled=cy.styleEnabled();if(styleEnabled){this.recalculateRenderedStyle(opts.useCache)}for(var i=0;i1&&!unmergedLastEle){ -var lastEleI=this.length-1;var lastEle=this[lastEleI];var lastEleId=lastEle._private.data.id;this[lastEleI]=undefined;this[i]=lastEle;_p.indexes[lastEleId]=i}this.length--;return this},unmerge:function(toRemove){var cy=this._private.cy;if(!toRemove){return this}if(toRemove&&is.string(toRemove)){var selector=toRemove;toRemove=cy.mutableElements().filter(selector)}for(var i=0;imax){max=val;maxEle=ele}}return{value:max,ele:maxEle}},min:function(valFn,thisArg){var min=Infinity;var minEle;var eles=this;for(var i=0;i0&&is.plainObject(elements[0])&&!is.element(elements[0])){createdElements=true;var eles=[];var elesIds={};for(var i=0,l=elements.length;i0){var restored=new Collection(cy,elements);for(var i=0;i0){if(notifyRenderer){this.cy().notify({type:"remove",eles:removedElements})}removedElements.trigger("remove")}for(var i=0;i=0&&i0?this.add(updatedCompounds):this;if(notifyRenderer){toNotify.rtrigger("style")}else{toNotify.trigger("style")}return this},updateMappers:function(notifyRenderer){var cy=this._private.cy;var style=cy.style();notifyRenderer=notifyRenderer||notifyRenderer===undefined?true:false;if(!cy.styleEnabled()){return this}style.updateMappers(this);var updatedCompounds=this.updateCompoundBounds();var toNotify=updatedCompounds.length>0?this.add(updatedCompounds):this;if(notifyRenderer){toNotify.rtrigger("style")}else{toNotify.trigger("style")}return this},parsedStyle:function(property){var ele=this[0];if(!ele.cy().styleEnabled()){return}if(ele){return ele._private.style[property]||ele.cy().style().getDefaultProperty(property)}},renderedStyle:function(property){var cy=this.cy();if(!cy.styleEnabled()){return this}var ele=this[0];if(ele){var renstyle=ele.cy().style().getRenderedStyle(ele);if(property===undefined){return renstyle}else{return renstyle[property]}}},style:function(name,value){var cy=this.cy();if(!cy.styleEnabled()){return this}var updateTransitions=false;var style=cy.style();if(is.plainObject(name)){var props=name;style.applyBypass(this,props,updateTransitions);var updatedCompounds=this.updateCompoundBounds();var toNotify=updatedCompounds.length>0?this.add(updatedCompounds):this;toNotify.rtrigger("style")}else if(is.string(name)){if(value===undefined){var ele=this[0];if(ele){return style.getStylePropertyValue(ele,name)}else{return}}else{style.applyBypass(this,name,value,updateTransitions);var updatedCompounds=this.updateCompoundBounds();var toNotify=updatedCompounds.length>0?this.add(updatedCompounds):this;toNotify.rtrigger("style")}}else if(name===undefined){var ele=this[0];if(ele){return style.getRawStyle(ele)}else{return}}return this},removeStyle:function(names){var cy=this.cy();if(!cy.styleEnabled()){return this}var updateTransitions=false;var style=cy.style();var eles=this;if(names===undefined){for(var i=0;i0?this.add(updatedCompounds):this;toNotify.rtrigger("style");return this},show:function(){this.css("display","element");return this},hide:function(){this.css("display","none");return this},visible:function(){var cy=this.cy();if(!cy.styleEnabled()){return true}var ele=this[0];var hasCompoundNodes=cy.hasCompoundNodes();if(ele){if(ele.pstyle("visibility").value!=="visible"||ele.pstyle("display").value!=="element"||ele.pstyle("width").pfValue===0){return false}if(ele._private.group==="nodes"){if(ele.pstyle("height").pfValue===0){return false}if(!hasCompoundNodes){return true}var parents=ele._private.data.parent?ele.parents():null;if(parents){for(var i=0;i0){elements.push(otherNode[0])}elements.push(edge[0])}}return this.spawn(elements,{unique:true}).filter(selector)},"neighborhood"),closedNeighborhood:function(selector){return this.neighborhood().add(this).filter(selector)},openNeighborhood:function(selector){return this.neighborhood(selector)}});elesfn.neighbourhood=elesfn.neighborhood;elesfn.closedNeighbourhood=elesfn.closedNeighborhood;elesfn.openNeighbourhood=elesfn.openNeighborhood;util.extend(elesfn,{source:cache(function sourceImpl(selector){var ele=this[0];var src;if(ele){src=ele._private.source||ele.cy().collection()}return src&&selector?src.filter(selector):src},"source"),target:cache(function targetImpl(selector){var ele=this[0];var tgt;if(ele){tgt=ele._private.target||ele.cy().collection()}return tgt&&selector?tgt.filter(selector):tgt},"target"),sources:defineSourceFunction({attr:"source"}),targets:defineSourceFunction({attr:"target"})});function defineSourceFunction(params){return function sourceImpl(selector){var sources=[];for(var i=0;i0);return components.map(function(component){var connectedEdges=component.connectedEdges().stdFilter(function(edge){return component.anySame(edge.source())&&component.anySame(edge.target())});return component.union(connectedEdges)})}});module.exports=elesfn},{"../is":114,"../util":131}],63:[function(require,module,exports){"use strict";var zIndexSort=function(a,b){var cy=a.cy();var zDiff=a.pstyle("z-index").value-b.pstyle("z-index").value;var depthA=0;var depthB=0;var hasCompoundNodes=cy.hasCompoundNodes();var aIsNode=a.isNode();var aIsEdge=!aIsNode;var bIsNode=b.isNode();var bIsEdge=!bIsNode;if(hasCompoundNodes){depthA=a.zDepth();depthB=b.zDepth()}var depthDiff=depthA-depthB;var sameDepth=depthDiff===0;if(sameDepth){if(aIsNode&&bIsEdge){return 1}else if(aIsEdge&&bIsNode){return-1}else{if(zDiff===0){return a.poolIndex()-b.poolIndex()}else{return zDiff}}}else{return depthDiff}};module.exports=zIndexSort},{}],64:[function(require,module,exports){"use strict";var is=require("../is");var util=require("../util");var Collection=require("../collection");var Element=require("../collection/element");var corefn={add:function(opts){var elements;var cy=this;if(is.elementOrCollection(opts)){var eles=opts;if(eles._private.cy===cy){elements=eles.restore(); +}return C.get(node)},betweennessNormalized:function(node){if(max==0)return 0;if(is.string(node)){var node=cy.filter(node).id()}else{var node=node.id()}return C.get(node)/max}};ret.betweennessNormalised=ret.betweennessNormalized;return ret}};elesfn.bc=elesfn.betweennessCentrality;module.exports=elesfn},{"../../heap":113,"../../is":115}],38:[function(require,module,exports){"use strict";var is=require("../../is");var defineSearch=function(params){params={bfs:params.bfs||!params.dfs,dfs:params.dfs||!params.bfs};return function searchFn(roots,fn,directed){var options;var std;var thisArg;if(is.plainObject(roots)&&!is.elementOrCollection(roots)){options=roots;roots=options.roots||options.root;fn=options.visit;directed=options.directed;std=options.std;thisArg=options.thisArg}directed=arguments.length===2&&!is.fn(fn)?fn:directed;fn=is.fn(fn)?fn:function(){};var cy=this._private.cy;var v=roots=is.string(roots)?this.filter(roots):roots;var Q=[];var connectedNodes=[];var connectedBy={};var id2depth={};var V={};var j=0;var found;var nodes=this.nodes();var edges=this.edges();for(var i=0;i0){var u=Q.pop();var smalletsDist=getDist(u);var uid=u.id();knownDist[uid]=smalletsDist;if(smalletsDist===Math.Infinite){break}var neighbors=u.neighborhood().intersect(nodes);for(var i=0;i0){S.unshift(target);while(prev[u.id()]){var p=prev[u.id()];S.unshift(p.edge);S.unshift(p.node);u=p.node}}return cy.collection(S)}}}};module.exports=elesfn},{"../../heap":113,"../../is":115}],42:[function(require,module,exports){"use strict";var is=require("../../is");var elesfn={floydWarshall:function(options){options=options||{};var cy=this.cy();if(options.weight!=null&&is.fn(options.weight)){var weightFn=options.weight}else{var weightFn=function(e){return 1}}if(options.directed!=null){var directed=options.directed}else{var directed=false}var edges=this.edges().stdFilter(function(e){return!e.isLoop()});var nodes=this.nodes();var numNodes=nodes.length;var id2position={};for(var i=0;iweight){dist[sourceIndex][targetIndex]=weight;next[sourceIndex][targetIndex]=targetIndex;edgeNext[sourceIndex][targetIndex]=edges[i]}}if(!directed){for(var i=0;iweight){dist[sourceIndex][targetIndex]=weight;next[sourceIndex][targetIndex]=targetIndex;edgeNext[sourceIndex][targetIndex]=edges[i]}}}for(var k=0;k0){this.spawn(changed).updateStyle().trigger("class")}return self},addClass:function(classes){return this.toggleClass(classes,true)},hasClass:function(className){var ele=this[0];return ele!=null&&ele._private.classes[className]?true:false},toggleClass:function(classesStr,toggle){var classes=classesStr.match(/\S+/g)||[];var self=this;var changed=[];for(var i=0,il=self.length;i0){this.spawn(changed).updateStyle().trigger("class")}return self},removeClass:function(classes){return this.toggleClass(classes,false)},flashClass:function(classes,duration){var self=this;if(duration==null){duration=250}else if(duration===0){return self}self.addClass(classes);setTimeout(function(){self.removeClass(classes)},duration);return self}};module.exports=elesfn},{"../util":132}],49:[function(require,module,exports){"use strict";var elesfn={allAre:function(selector){return this.filter(selector).length===this.length},is:function(selector){return this.filter(selector).length>0},some:function(fn,thisArg){for(var i=0;i0},allAreNeighbors:function(collection){collection=this.cy().collection(collection);return this.neighborhood().intersect(collection).length===collection.length}};elesfn.allAreNeighbours=elesfn.allAreNeighbors;module.exports=elesfn},{}],50:[function(require,module,exports){"use strict";var elesfn={parent:function(selector){var parents=[];var cy=this._private.cy;for(var i=0;i0){parents.push(parent)}}return this.spawn(parents,{unique:true}).filter(selector)},parents:function(selector){var parents=[];var eles=this.parent();while(eles.nonempty()){for(var i=0;imax}),minIndegree:defineDegreeBoundsFunction("indegree",function(degree,min){return degreemax}),minOutdegree:defineDegreeBoundsFunction("outdegree",function(degree,min){return degreemax})});util.extend(elesfn,{totalDegree:function(includeLoops){var total=0;var nodes=this.nodes();for(var i=0;i0?this.add(updatedEles):this;if(silent){toTrigger.trigger("position")}else{toTrigger.rtrigger("position")}}return this},silentPositions:function(pos){return this.positions(pos,true)},renderedPosition:function(dim,val){var ele=this[0];var cy=this.cy();var zoom=cy.zoom();var pan=cy.pan();var rpos=is.plainObject(dim)?dim:undefined;var setting=rpos!==undefined||val!==undefined&&is.string(dim);if(ele&&ele.isNode()){if(setting){for(var i=0;i0;var relativeToParent=hasParent;if(hasParent){parent=parent[0]}var origin=relativeToParent?parent._private.position:{x:0,y:0};if(val!==undefined){ele._private.position[dim]=val+origin[dim]}else if(ppos!==undefined){ele._private.position={x:ppos.x+origin.x,y:ppos.y+origin.y}}}this.rtrigger("position")}else{var pos=ele._private.position;var parent=hasCompoundNodes?ele.parent():null;var hasParent=parent&&parent.length>0;var relativeToParent=hasParent;if(hasParent){parent=parent[0]}var origin=relativeToParent?parent._private.position:{x:0,y:0};ppos={x:pos.x-origin.x,y:pos.y-origin.y};if(dim===undefined){return ppos}else{return ppos[dim]}}}else if(!setting){return undefined}return this},renderedBoundingBox:function(options){var bb=this.boundingBox(options);var cy=this.cy();var zoom=cy.zoom();var pan=cy.pan();var x1=bb.x1*zoom+pan.x;var x2=bb.x2*zoom+pan.x;var y1=bb.y1*zoom+pan.y;var y2=bb.y2*zoom+pan.y;return{x1:x1,x2:x2,y1:y1,y2:y2,w:x2-x1,h:y2-y1}},updateCompoundBounds:function(){var cy=this.cy();if(!cy.styleEnabled()||!cy.hasCompoundNodes()){return cy.collection()}var updated=[];function update(parent){if(!parent.isParent()){return}var _p=parent._private;var children=parent.children();var includeLabels=parent.pstyle("compound-sizing-wrt-labels").value==="include";var bb=children.boundingBox({includeLabels:includeLabels,includeShadows:false,includeOverlays:false,useCache:false});var padding={top:parent.pstyle("padding-top").pfValue,bottom:parent.pstyle("padding-bottom").pfValue,left:parent.pstyle("padding-left").pfValue,right:parent.pstyle("padding-right").pfValue};var pos=_p.position;_p.autoWidth=bb.w;pos.x=(bb.x1+bb.x2-padding.left+padding.right)/2;_p.autoHeight=bb.h;pos.y=(bb.y1+bb.y2-padding.top+padding.bottom)/2;updated.push(parent)}var eles=this;while(eles.nonempty()){for(var i=0;i0){oldEles.remove()}if(elements!=null){if(is.plainObject(elements)||is.array(elements)){cy.add(elements)}}cy.one("layoutready",function(e){cy.notifications(true);cy.trigger(e);cy.notify({type:"load",eles:cy.mutableElements()});cy.one("load",onload);cy.trigger("load")}).one("layoutstop",function(){cy.one("done",ondone);cy.trigger("done")});var layoutOpts=util.extend({},cy._private.options.layout);layoutOpts.eles=cy.elements();cy.layout(layoutOpts);return this}};module.exports=corefn},{"../collection":57,"../collection/element":53,"../is":114,"../util":131}],65:[function(require,module,exports){"use strict";var define=require("../define");var util=require("../util");var is=require("../is");var corefn={animate:define.animate(),animation:define.animation(),animated:define.animated(),clearQueue:define.clearQueue(),delay:define.delay(),delayAnimation:define.delayAnimation(),stop:define.stop(),addToAnimationPool:function(eles){var cy=this;if(!cy.styleEnabled()){return}cy._private.aniEles.merge(eles)},stopAnimationLoop:function(){this._private.animationsRunning=false},startAnimationLoop:function(){var cy=this;cy._private.animationsRunning=true;if(!cy.styleEnabled()){return}function globalAnimationStep(){if(!cy._private.animationsRunning){return}util.requestAnimationFrame(function animationStep(now){handleElements(now);globalAnimationStep()})}var renderer=cy.renderer();if(renderer&&renderer.beforeRender){renderer.beforeRender(function rendererAnimationStep(willDraw,now){handleElements(now)},renderer.beforeRenderPriorities.animations)}else{globalAnimationStep()}function handleElements(now){var eles=cy._private.aniEles;var doneEles=[];function handleElement(ele,isCore){var _p=ele._private;var current=_p.animation.current;var queue=_p.animation.queue;var ranAnis=false;if(current.length===0){var next=queue.shift();if(next){current.push(next)}}var callbacks=function(callbacks){for(var j=callbacks.length-1;j>=0;j--){var cb=callbacks[j];cb()}callbacks.splice(0,callbacks.length)};for(var i=current.length-1;i>=0;i--){var ani=current[i];var ani_p=ani._private;if(ani_p.stopped){current.splice(i,1);ani_p.hooked=false;ani_p.playing=false;ani_p.started=false;callbacks(ani_p.frames);continue}if(!ani_p.playing&&!ani_p.applying){continue}if(ani_p.playing&&ani_p.applying){ani_p.applying=false}if(!ani_p.started){startAnimation(ele,ani,now)}step(ele,ani,now,isCore);if(is.fn(ani_p.step)){ani_p.step.call(ele,now)}if(ani_p.applying){ani_p.applying=false}callbacks(ani_p.frames);if(ani.completed()){current.splice(i,1);ani_p.hooked=false;ani_p.playing=false;ani_p.started=false;callbacks(ani_p.completes)}ranAnis=true}if(!isCore&¤t.length===0&&queue.length===0){doneEles.push(ele)}return ranAnis}var ranEleAni=false;for(var e=0;e0){var updatedEles=eles.updateCompoundBounds().spawnSelf().merge(eles);cy.notify({type:"draw",eles:updatedEles})}else{cy.notify({type:"draw"})}}eles.unmerge(doneEles);cy.trigger("step")}function startAnimation(self,ani,now){var isCore=is.core(self);var isEles=!isCore;var ele=self;var style=cy._private.style;var ani_p=ani._private;if(isEles){var pos=ele._private.position;ani_p.startPosition=ani_p.startPosition||{x:pos.x,y:pos.y};ani_p.startStyle=ani_p.startStyle||style.getAnimationStartStyle(ele,ani_p.style)}if(isCore){var pan=cy._private.pan;ani_p.startPan=ani_p.startPan||{x:pan.x,y:pan.y};ani_p.startZoom=ani_p.startZoom!=null?ani_p.startZoom:cy._private.zoom}ani_p.started=true;ani_p.startTime=now-ani_p.progress*ani_p.duration}function step(self,ani,now,isCore){var style=cy._private.style;var isEles=!isCore;var _p=self._private;var ani_p=ani._private;var pEasing=ani_p.easing;var startTime=ani_p.startTime;if(!ani_p.easingImpl){if(pEasing==null){ani_p.easingImpl=easings["linear"]}else{var easingVals;if(is.string(pEasing)){var easingProp=style.parse("transition-timing-function",pEasing);easingVals=easingProp.value}else{easingVals=pEasing}var name,args;if(is.string(easingVals)){name=easingVals;args=[]}else{name=easingVals[1];args=easingVals.slice(2).map(function(n){return+n})}if(args.length>0){if(name==="spring"){args.push(ani_p.duration)}ani_p.easingImpl=easings[name].apply(null,args)}else{ani_p.easingImpl=easings[name]}}}var easing=ani_p.easingImpl;var percent;if(ani_p.duration===0){percent=1}else{percent=(now-startTime)/ani_p.duration}if(ani_p.applying){percent=ani_p.progress}if(percent<0){percent=0}else if(percent>1){percent=1}if(ani_p.delay==null){var startPos=ani_p.startPosition;var endPos=ani_p.position;var pos=_p.position;if(endPos&&isEles){if(valid(startPos.x,endPos.x)){pos.x=ease(startPos.x,endPos.x,percent,easing)}if(valid(startPos.y,endPos.y)){pos.y=ease(startPos.y,endPos.y,percent,easing)}self.trigger("position")}var startPan=ani_p.startPan;var endPan=ani_p.pan;var pan=_p.pan;var animatingPan=endPan!=null&&isCore;if(animatingPan){if(valid(startPan.x,endPan.x)){pan.x=ease(startPan.x,endPan.x,percent,easing)}if(valid(startPan.y,endPan.y)){pan.y=ease(startPan.y,endPan.y,percent,easing)}self.trigger("pan")}var startZoom=ani_p.startZoom;var endZoom=ani_p.zoom;var animatingZoom=endZoom!=null&&isCore;if(animatingZoom){if(valid(startZoom,endZoom)){_p.zoom=ease(startZoom,endZoom,percent,easing)}self.trigger("zoom")}if(animatingPan||animatingZoom){self.trigger("viewport")}var props=ani_p.style;if(props&&props.length>0&&isEles){for(var i=0;itolerance&&Math.abs(last_state.v)>tolerance)){break}}return!have_duration?time_lapsed:function(percentComplete){return path[percentComplete*(path.length-1)|0]}}}();var easings={linear:function(start,end,percent){return start+(end-start)*percent},ease:cubicBezier(.25,.1,.25,1),"ease-in":cubicBezier(.42,0,1,1),"ease-out":cubicBezier(0,0,.58,1),"ease-in-out":cubicBezier(.42,0,.58,1),"ease-in-sine":cubicBezier(.47,0,.745,.715),"ease-out-sine":cubicBezier(.39,.575,.565,1),"ease-in-out-sine":cubicBezier(.445,.05,.55,.95),"ease-in-quad":cubicBezier(.55,.085,.68,.53),"ease-out-quad":cubicBezier(.25,.46,.45,.94),"ease-in-out-quad":cubicBezier(.455,.03,.515,.955),"ease-in-cubic":cubicBezier(.55,.055,.675,.19),"ease-out-cubic":cubicBezier(.215,.61,.355,1),"ease-in-out-cubic":cubicBezier(.645,.045,.355,1),"ease-in-quart":cubicBezier(.895,.03,.685,.22),"ease-out-quart":cubicBezier(.165,.84,.44,1),"ease-in-out-quart":cubicBezier(.77,0,.175,1),"ease-in-quint":cubicBezier(.755,.05,.855,.06),"ease-out-quint":cubicBezier(.23,1,.32,1),"ease-in-out-quint":cubicBezier(.86,0,.07,1),"ease-in-expo":cubicBezier(.95,.05,.795,.035),"ease-out-expo":cubicBezier(.19,1,.22,1),"ease-in-out-expo":cubicBezier(1,0,0,1),"ease-in-circ":cubicBezier(.6,.04,.98,.335),"ease-out-circ":cubicBezier(.075,.82,.165,1),"ease-in-out-circ":cubicBezier(.785,.135,.15,.86),spring:function(tension,friction,duration){if(duration===0){return easings.linear}var spring=generateSpringRK4(tension,friction,duration);return function(start,end,percent){return start+(end-start)*spring(percent)}},"cubic-bezier":function(x1,y1,x2,y2){return cubicBezier(x1,y1,x2,y2)}};function ease(startProp,endProp,percent,easingFn){if(percent<0){percent=0}else if(percent>1){percent=1}var start,end;if(startProp.pfValue!=null||startProp.value!=null){start=startProp.pfValue!=null?startProp.pfValue:startProp.value}else{start=startProp}if(endProp.pfValue!=null||endProp.value!=null){end=endProp.pfValue!=null?endProp.pfValue:endProp.value}else{end=endProp}if(is.number(start)&&is.number(end)){return easingFn(start,end,percent)}else if(is.array(start)&&is.array(end)){var easedArr=[];for(var i=0;i0?options.wheelSensitivity:1,motionBlur:options.motionBlur===undefined?false:options.motionBlur,motionBlurOpacity:options.motionBlurOpacity===undefined?.05:options.motionBlurOpacity,pixelRatio:is.number(options.pixelRatio)&&options.pixelRatio>0?options.pixelRatio:undefined,desktopTapThreshold:options.desktopTapThreshold===undefined?4:options.desktopTapThreshold,touchTapThreshold:options.touchTapThreshold===undefined?8:options.touchTapThreshold},options.renderer));loadExtData([options.style,options.elements],function(thens){var initStyle=thens[0];var initEles=thens[1];if(_p.styleEnabled){cy.setStyle(initStyle)}if(options.initrender){cy.on("initrender",options.initrender);cy.on("initrender",function(){_p.initrender=true})}cy.load(initEles,function(){cy.startAnimationLoop();_p.ready=true;if(is.fn(options.ready)){cy.on("ready",options.ready)}for(var i=0;i0){domEle.removeChild(domEle.childNodes[0])}}cy._private.renderer=null},onRender:function(fn){return this.on("render",fn)},offRender:function(fn){return this.off("render",fn)}};corefn.invalidateDimensions=corefn.resize;module.exports=corefn},{"../util":131}],72:[function(require,module,exports){"use strict";var is=require("../is");var Collection=require("../collection");var corefn={collection:function(eles,opts){if(is.string(eles)){return this.$(eles)}else if(is.elementOrCollection(eles)){return eles.collection()}else if(is.array(eles)){return new Collection(this,eles,opts)}return new Collection(this)},nodes:function(selector){var nodes=this.$(function(){return this.isNode()});if(selector){return nodes.filter(selector)}return nodes},edges:function(selector){var edges=this.$(function(){return this.isEdge()});if(selector){return edges.filter(selector)}return edges},$:function(selector){var eles=this._private.elements;if(selector){return eles.filter(selector)}else{return eles.spawnSelf()}},mutableElements:function(){return this._private.elements}};corefn.elements=corefn.filter=corefn.$;module.exports=corefn},{"../collection":57,"../is":114}],73:[function(require,module,exports){"use strict";var is=require("../is");var Style=require("../style");var corefn={style:function(newStyle){if(newStyle){var s=this.setStyle(newStyle);s.update()}return this._private.style},setStyle:function(style){var _p=this._private;if(is.stylesheet(style)){_p.style=style.generateStyle(this)}else if(is.array(style)){_p.style=Style.fromJson(this,style)}else if(is.string(style)){_p.style=Style.fromString(this,style)}else{_p.style=Style(this)}return _p.style}};module.exports=corefn},{"../is":114,"../style":123}],74:[function(require,module,exports){"use strict";var is=require("../is");var corefn={autolock:function(bool){if(bool!==undefined){this._private.autolock=bool?true:false}else{return this._private.autolock}return this},autoungrabify:function(bool){if(bool!==undefined){this._private.autoungrabify=bool?true:false}else{return this._private.autoungrabify}return this},autounselectify:function(bool){if(bool!==undefined){this._private.autounselectify=bool?true:false}else{return this._private.autounselectify}return this},panningEnabled:function(bool){if(bool!==undefined){this._private.panningEnabled=bool?true:false}else{return this._private.panningEnabled}return this},userPanningEnabled:function(bool){if(bool!==undefined){this._private.userPanningEnabled=bool?true:false}else{return this._private.userPanningEnabled}return this},zoomingEnabled:function(bool){if(bool!==undefined){this._private.zoomingEnabled=bool?true:false}else{return this._private.zoomingEnabled}return this},userZoomingEnabled:function(bool){if(bool!==undefined){this._private.userZoomingEnabled=bool?true:false}else{return this._private.userZoomingEnabled}return this},boxSelectionEnabled:function(bool){if(bool!==undefined){this._private.boxSelectionEnabled=bool?true:false}else{return this._private.boxSelectionEnabled}return this},pan:function(){var args=arguments;var pan=this._private.pan;var dim,val,dims,x,y;switch(args.length){case 0:return pan;case 1:if(is.string(args[0])){dim=args[0];return pan[dim]}else if(is.plainObject(args[0])){if(!this._private.panningEnabled){return this}dims=args[0];x=dims.x;y=dims.y;if(is.number(x)){pan.x=x}if(is.number(y)){pan.y=y}this.trigger("pan viewport")}break;case 2:if(!this._private.panningEnabled){return this}dim=args[0];val=args[1];if((dim==="x"||dim==="y")&&is.number(val)){pan[dim]=val}this.trigger("pan viewport");break;default:break}this.notify({type:"viewport"});return this},panBy:function(params){var args=arguments;var pan=this._private.pan;var dim,val,dims,x,y;if(!this._private.panningEnabled){return this}switch(args.length){case 1:if(is.plainObject(args[0])){dims=args[0];x=dims.x;y=dims.y;if(is.number(x)){pan.x+=x}if(is.number(y)){pan.y+=y}this.trigger("pan viewport")}break;case 2:dim=args[0];val=args[1];if((dim==="x"||dim==="y")&&is.number(val)){pan[dim]+=val}this.trigger("pan viewport");break;default:break}this.notify({type:"viewport"});return this},fit:function(elements,padding){var viewportState=this.getFitViewport(elements,padding);if(viewportState){var _p=this._private;_p.zoom=viewportState.zoom;_p.pan=viewportState.pan;this.trigger("pan zoom viewport");this.notify({type:"viewport"})}return this},getFitViewport:function(elements,padding){if(is.number(elements)&&padding===undefined){padding=elements;elements=undefined}if(!this._private.panningEnabled||!this._private.zoomingEnabled){return}var bb;if(is.string(elements)){var sel=elements;elements=this.$(sel)}else if(is.boundingBox(elements)){var bbe=elements;bb={x1:bbe.x1,y1:bbe.y1,x2:bbe.x2,y2:bbe.y2};bb.w=bb.x2-bb.x1;bb.h=bb.y2-bb.y1}else if(!is.elementOrCollection(elements)){elements=this.mutableElements()}bb=bb||elements.boundingBox();var w=this.width();var h=this.height();var zoom;padding=is.number(padding)?padding:0;if(!isNaN(w)&&!isNaN(h)&&w>0&&h>0&&!isNaN(bb.w)&&!isNaN(bb.h)&&bb.w>0&&bb.h>0){zoom=Math.min((w-2*padding)/bb.w,(h-2*padding)/bb.h);zoom=zoom>this._private.maxZoom?this._private.maxZoom:zoom;zoom=zoomthis._private.maxZoom?this._private.maxZoom:zoom;zoom=zoom_p.maxZoom||!_p.zoomingEnabled){zoomFailed=true}else{_p.zoom=z;events.push("zoom")}}if(panDefd&&(!zoomFailed||!opts.cancelOnFailedZoom)&&_p.panningEnabled){var p=opts.pan;if(is.number(p.x)){_p.pan.x=p.x;panFailed=false}if(is.number(p.y)){_p.pan.y=p.y;panFailed=false}if(!panFailed){events.push("pan")}}if(events.length>0){events.push("viewport");this.trigger(events.join(" "));this.notify({type:"viewport"})}return this},center:function(elements){var pan=this.getCenterPan(elements);if(pan){this._private.pan=pan;this.trigger("pan viewport");this.notify({type:"viewport"})}return this},getCenterPan:function(elements,zoom){if(!this._private.panningEnabled){return}if(is.string(elements)){var selector=elements;elements=this.mutableElements().filter(selector)}else if(!is.elementOrCollection(elements)){elements=this.mutableElements()}var bb=elements.boundingBox();var w=this.width();var h=this.height();zoom=zoom===undefined?this._private.zoom:zoom;var pan={x:(w-zoom*(bb.x1+bb.x2))/2,y:(h-zoom*(bb.y1+bb.y2))/2};return pan},reset:function(){if(!this._private.panningEnabled||!this._private.zoomingEnabled){return this}this.viewport({pan:{x:0,y:0},zoom:1});return this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var _p=this._private;var container=_p.container;return _p.sizeCache=_p.sizeCache||(container?{width:container.clientWidth,height:container.clientHeight}:{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var pan=this._private.pan;var zoom=this._private.zoom;var rb=this.renderedExtent();var b={x1:(rb.x1-pan.x)/zoom,x2:(rb.x2-pan.x)/zoom,y1:(rb.y1-pan.y)/zoom,y2:(rb.y2-pan.y)/zoom};b.w=b.x2-b.x1;b.h=b.y2-b.y1;return b},renderedExtent:function(){var width=this.width();var height=this.height();return{x1:0,y1:0,x2:width,y2:height,w:width,h:height}}};corefn.centre=corefn.center;corefn.autolockNodes=corefn.autolock;corefn.autoungrabifyNodes=corefn.autoungrabify;module.exports=corefn},{"../is":114}],75:[function(require,module,exports){"use strict";var util=require("./util");var is=require("./is");var Selector=require("./selector");var Promise=require("./promise");var Event=require("./event");var Animation=require("./animation"); +b.x2=x2>b.x2?x2:b.x2;b.y1=y1b.y2?y2:b.y2};var updateBoundsFromBox=function(b,b2){return updateBounds(b,b2.x1,b2.y1,b2.x2,b2.y2)};var prefixedProperty=function(obj,field,prefix){return util.getPrefixedProperty(obj,field,prefix)};var updateBoundsFromArrow=function(bounds,ele,prefix,options){var _p=ele._private;var rstyle=_p.rstyle;var halfArW=rstyle.arrowWidth/2;var arrowType=ele.pstyle(prefix+"-arrow-shape").value;var x;var y;if(arrowType!=="none"){if(prefix==="source"){x=rstyle.srcX;y=rstyle.srcY}else if(prefix==="target"){x=rstyle.tgtX;y=rstyle.tgtY}else{x=rstyle.midX;y=rstyle.midY}updateBounds(bounds,x-halfArW,y-halfArW,x+halfArW,y+halfArW)}};var updateBoundsFromLabel=function(bounds,ele,prefix,options){var prefixDash;if(prefix){prefixDash=prefix+"-"}else{prefixDash=""}var _p=ele._private;var rstyle=_p.rstyle;var label=ele.pstyle(prefixDash+"label").strValue;if(label){var halign=ele.pstyle("text-halign");var valign=ele.pstyle("text-valign");var labelWidth=prefixedProperty(rstyle,"labelWidth",prefix);var labelHeight=prefixedProperty(rstyle,"labelHeight",prefix);var labelX=prefixedProperty(rstyle,"labelX",prefix);var labelY=prefixedProperty(rstyle,"labelY",prefix);var marginX=ele.pstyle(prefixDash+"text-margin-x").pfValue;var marginY=ele.pstyle(prefixDash+"text-margin-y").pfValue;var isEdge=ele.isEdge();var rotation=ele.pstyle(prefixDash+"text-rotation");var shadowR=ele.pstyle("text-shadow-blur").pfValue/2;var shadowX=ele.pstyle("text-shadow-offset-x").pfValue;var shadowY=ele.pstyle("text-shadow-offset-y").pfValue;var shadowOpacity=ele.pstyle("text-shadow-opacity").value;var outlineWidth=ele.pstyle("text-outline-width").pfValue;var borderWidth=ele.pstyle("text-border-width").pfValue;var halfBorderWidth=borderWidth/2;var lh=labelHeight;var lw=labelWidth;var lw_2=lw/2;var lh_2=lh/2;var lx1,lx2,ly1,ly2;if(isEdge){lx1=labelX-lw_2;lx2=labelX+lw_2;ly1=labelY-lh_2;ly2=labelY+lh_2}else{switch(halign.value){case"left":lx1=labelX-lw;lx2=labelX;break;case"center":lx1=labelX-lw_2;lx2=labelX+lw_2;break;case"right":lx1=labelX;lx2=labelX+lw;break}switch(valign.value){case"top":ly1=labelY-lh;ly2=labelY;break;case"center":ly1=labelY-lh_2;ly2=labelY+lh_2;break;case"bottom":ly1=labelY;ly2=labelY+lh;break}}var isAutorotate=isEdge&&rotation.strValue==="autorotate";var isPfValue=rotation.pfValue!=null&&rotation.pfValue!==0;if(isAutorotate||isPfValue){var theta=isAutorotate?prefixedProperty(_p.rstyle,"labelAngle",prefix):rotation.pfValue;var cos=Math.cos(theta);var sin=Math.sin(theta);var rotate=function(x,y){x=x-labelX;y=y-labelY;return{x:x*cos-y*sin+labelX,y:x*sin+y*cos+labelY}};var px1y1=rotate(lx1,ly1);var px1y2=rotate(lx1,ly2);var px2y1=rotate(lx2,ly1);var px2y2=rotate(lx2,ly2);lx1=Math.min(px1y1.x,px1y2.x,px2y1.x,px2y2.x);lx2=Math.max(px1y1.x,px1y2.x,px2y1.x,px2y2.x);ly1=Math.min(px1y1.y,px1y2.y,px2y1.y,px2y2.y);ly2=Math.max(px1y1.y,px1y2.y,px2y1.y,px2y2.y)}lx1+=marginX-Math.max(outlineWidth,halfBorderWidth);lx2+=marginX+Math.max(outlineWidth,halfBorderWidth);ly1+=marginY-Math.max(outlineWidth,halfBorderWidth);ly2+=marginY+Math.max(outlineWidth,halfBorderWidth);updateBounds(bounds,lx1,ly1,lx2,ly2);if(options.includeShadows&&shadowOpacity>0){lx1+=-shadowR+shadowX;lx2+=+shadowR+shadowX;ly1+=-shadowR+shadowY;ly2+=+shadowR+shadowY;updateBounds(bounds,lx1,ly1,lx2,ly2)}}return bounds};var boundingBoxImpl=function(ele,options){var cy=ele._private.cy;var cy_p=cy._private;var styleEnabled=cy_p.styleEnabled;var bounds={x1:Infinity,y1:Infinity,x2:-Infinity,y2:-Infinity};var _p=ele._private;var display=styleEnabled?ele.pstyle("display").value:"element";var isNode=ele.isNode();var isEdge=ele.isEdge();var ex1,ex2,ey1,ey2,x,y;var displayed=display!=="none";if(displayed){var overlayOpacity=0;var overlayPadding=0;if(styleEnabled&&options.includeOverlays){overlayOpacity=ele.pstyle("overlay-opacity").value;if(overlayOpacity!==0){overlayPadding=ele.pstyle("overlay-padding").value}}var w=0;var wHalf=0;if(styleEnabled){w=ele.pstyle("width").pfValue;wHalf=w/2}if(isNode&&options.includeNodes){var pos=_p.position;x=pos.x;y=pos.y;var w=ele.outerWidth();var halfW=w/2;var h=ele.outerHeight();var halfH=h/2;ex1=x-halfW-overlayPadding;ex2=x+halfW+overlayPadding;ey1=y-halfH-overlayPadding;ey2=y+halfH+overlayPadding;updateBounds(bounds,ex1,ey1,ex2,ey2)}else if(isEdge&&options.includeEdges){var rstyle=_p.rstyle||{};if(styleEnabled){ex1=Math.min(rstyle.srcX,rstyle.midX,rstyle.tgtX);ex2=Math.max(rstyle.srcX,rstyle.midX,rstyle.tgtX);ey1=Math.min(rstyle.srcY,rstyle.midY,rstyle.tgtY);ey2=Math.max(rstyle.srcY,rstyle.midY,rstyle.tgtY);ex1-=wHalf;ex2+=wHalf;ey1-=wHalf;ey2+=wHalf;updateBounds(bounds,ex1,ey1,ex2,ey2)}if(styleEnabled&&ele.pstyle("curve-style").strValue==="haystack"){var hpts=rstyle.haystackPts;ex1=hpts[0].x;ey1=hpts[0].y;ex2=hpts[1].x;ey2=hpts[1].y;if(ex1>ex2){var temp=ex1;ex1=ex2;ex2=temp}if(ey1>ey2){var temp=ey1;ey1=ey2;ey2=temp}updateBounds(bounds,ex1-wHalf,ey1-wHalf,ex2+wHalf,ey2+wHalf)}else{var pts=rstyle.bezierPts||rstyle.linePts||[];for(var j=0;jex2){var temp=ex1;ex1=ex2;ex2=temp}if(ey1>ey2){var temp=ey1;ey1=ey2;ey2=temp}ex1-=wHalf;ex2+=wHalf;ey1-=wHalf;ey2+=wHalf;updateBounds(bounds,ex1,ey1,ex2,ey2)}}}if(styleEnabled){ex1=bounds.x1;ex2=bounds.x2;ey1=bounds.y1;ey2=bounds.y2;if(options.includeShadows&&ele.pstyle("shadow-opacity").value>0){var r=ele.pstyle("shadow-blur").pfValue/2;var ox=ele.pstyle("shadow-offset-x").pfValue;var oy=ele.pstyle("shadow-offset-y").pfValue;updateBounds(bounds,ex1-r+ox,ey1-r+oy,ex2+r+ox,ey2+r+oy)}updateBounds(bounds,ex1-overlayPadding,ey1-overlayPadding,ex2+overlayPadding,ey2+overlayPadding)}if(styleEnabled&&options.includeEdges&&isEdge){updateBoundsFromArrow(bounds,ele,"mid-source",options);updateBoundsFromArrow(bounds,ele,"mid-target",options);updateBoundsFromArrow(bounds,ele,"source",options);updateBoundsFromArrow(bounds,ele,"target",options)}if(styleEnabled&&options.includeLabels){updateBoundsFromLabel(bounds,ele,null,options);if(isEdge){updateBoundsFromLabel(bounds,ele,"source",options);updateBoundsFromLabel(bounds,ele,"target",options)}}}bounds.x1=noninf(bounds.x1);bounds.y1=noninf(bounds.y1);bounds.x2=noninf(bounds.x2);bounds.y2=noninf(bounds.y2);bounds.w=noninf(bounds.x2-bounds.x1);bounds.h=noninf(bounds.y2-bounds.y1);if(bounds.w>0&&bounds.h>0&&displayed){math.expandBoundingBox(bounds,1)}return bounds};var tf=function(val){if(val){return"t"}else{return"f"}};var getKey=function(opts){var key="";key+=tf(opts.incudeNodes);key+=tf(opts.includeEdges);key+=tf(opts.includeLabels);key+=tf(opts.includeShadows);key+=tf(opts.includeOverlays);return key};var cachedBoundingBoxImpl=function(ele,opts){var _p=ele._private;var bb;var headless=ele.cy().headless();var key=opts===defBbOpts?defBbOptsKey:getKey(opts);if(!opts.useCache||headless||!_p.bbCache||!_p.bbCache[key]){bb=boundingBoxImpl(ele,opts);if(!headless){_p.bbCache=_p.bbCache||{};_p.bbCache[key]=bb}}else{bb=_p.bbCache[key]}return bb};var defBbOpts={includeNodes:true,includeEdges:true,includeLabels:true,includeShadows:true,includeOverlays:true,useCache:true};var defBbOptsKey=getKey(defBbOpts);elesfn.recalculateRenderedStyle=function(useCache){var cy=this.cy();var renderer=cy.renderer();var styleEnabled=cy.styleEnabled();if(renderer&&styleEnabled){renderer.recalculateRenderedStyle(this,useCache)}return this};elesfn.boundingBox=function(options){if(this.length===1&&this[0]._private.bbCache&&(options===undefined||options.useCache===undefined||options.useCache===true)){if(options===undefined){options=defBbOpts}return cachedBoundingBoxImpl(this[0],options)}var bounds={x1:Infinity,y1:Infinity,x2:-Infinity,y2:-Infinity};options=options||util.staticEmptyObject();var opts={includeNodes:util.default(options.includeNodes,defBbOpts.includeNodes),includeEdges:util.default(options.includeEdges,defBbOpts.includeEdges),includeLabels:util.default(options.includeLabels,defBbOpts.includeLabels),includeShadows:util.default(options.includeShadows,defBbOpts.includeShadows),includeOverlays:util.default(options.includeOverlays,defBbOpts.includeOverlays),useCache:util.default(options.useCache,defBbOpts.useCache)};var eles=this;var cy=eles.cy();var styleEnabled=cy.styleEnabled();if(styleEnabled){this.recalculateRenderedStyle(opts.useCache)}for(var i=0;i1&&!unmergedLastEle){var lastEleI=this.length-1;var lastEle=this[lastEleI];var lastEleId=lastEle._private.data.id;this[lastEleI]=undefined;this[i]=lastEle;_p.indexes[lastEleId]=i}this.length--;return this},unmerge:function(toRemove){var cy=this._private.cy;if(!toRemove){return this}if(toRemove&&is.string(toRemove)){var selector=toRemove;toRemove=cy.mutableElements().filter(selector)}for(var i=0;imax){max=val;maxEle=ele}}return{value:max,ele:maxEle}},min:function(valFn,thisArg){var min=Infinity;var minEle;var eles=this;for(var i=0;i0&&is.plainObject(elements[0])&&!is.element(elements[0])){createdElements=true;var eles=[];var elesIds={};for(var i=0,l=elements.length;i0){var restored=new Collection(cy,elements);for(var i=0;i0){if(notifyRenderer){this.cy().notify({type:"remove",eles:removedElements})}removedElements.trigger("remove")}for(var i=0;i=0&&i0}}},clearQueue:function(fnParams){var defaults={};fnParams=util.extend({},defaults,fnParams);return function clearQueueImpl(){var self=this;var selfIsArrayLike=self.length!==undefined;var all=selfIsArrayLike?self:[self];var cy=this._private.cy||this;if(!cy.styleEnabled()){return this}for(var i=0;i0){var currComp=cy.collection();eles.bfs({roots:unhandledNodes[0],visit:function(i,depth,node,edge,pNode){currComp=currComp.add(node)},directed:false});unhandledNodes=unhandledNodes.not(currComp);components.push(currComp)}roots=cy.collection();for(var i=0;idepths.length-1){depths.push([])}depths[newDepth].push(ele);info.depth=newDepth;info.index=depths[newDepth].length-1}assignDepthsToEles()}var minDistance=0;if(options.avoidOverlap){for(var i=0;idepth||eleDepth===0){percent+=index/nDepth;samples++}}samples=Math.max(1,samples);percent=percent/samples;if(samples===0){percent=undefined}cachedWeightedPercent[ele.id()]=percent;return percent};var sortFn=function(a,b){var apct=getWeightedPercent(a);var bpct=getWeightedPercent(b);return apct-bpct};for(var times=0;times<3;times++){for(var i=0;i0&&depths[0].length<=3?radiusStepSize/2:0);var theta=2*Math.PI/depths[depth].length*index;if(depth===0&&depths[0].length===1){radius=1}return{x:center.x+radius*Math.cos(theta),y:center.y+radius*Math.sin(theta)}}else{return{x:center.x+(index+1-(depthSize+1)/2)*distanceX,y:(depth+1)*distanceY}}}};var pos={};for(var i=depths.length-1;i>=0;i--){var depth=depths[i];for(var j=0;j1&&options.avoidOverlap){minDistance*=1.75;var dcos=Math.cos(dTheta)-Math.cos(0);var dsin=Math.sin(dTheta)-Math.sin(0);var rMin=Math.sqrt(minDistance*minDistance/(dcos*dcos+dsin*dsin));r=Math.max(rMin,r)}var getPos=function(i,ele){var theta=options.startAngle+i*dTheta*(clockwise?1:-1);var rx=r*Math.cos(theta);var ry=r*Math.sin(theta);var pos={x:center.x+rx,y:center.y+ry};return pos};nodes.layoutPositions(this,options,getPos);return this};module.exports=CircleLayout},{"../../is":114,"../../math":116,"../../util":131}],81:[function(require,module,exports){"use strict";var util=require("../../util");var math=require("../../math");var defaults={fit:true,padding:30,startAngle:3/2*Math.PI,sweep:undefined,clockwise:true,equidistant:false,minNodeSpacing:10,boundingBox:undefined,avoidOverlap:true,height:undefined,width:undefined,concentric:function(node){return node.degree()},levelWidth:function(nodes){return nodes.maxDegree()/4},animate:false,animationDuration:500,animationEasing:undefined,ready:undefined,stop:undefined};function ConcentricLayout(options){this.options=util.extend({},defaults,options)}ConcentricLayout.prototype.run=function(){var params=this.options;var options=params;var clockwise=options.counterclockwise!==undefined?!options.counterclockwise:options.clockwise;var cy=params.cy;var eles=options.eles;var nodes=eles.nodes().not(":parent");var bb=math.makeBoundingBox(options.boundingBox?options.boundingBox:{x1:0,y1:0,w:cy.width(),h:cy.height()});var center={x:bb.x1+bb.w/2,y:bb.y1+bb.h/2};var nodeValues=[];var theta=options.startAngle;var maxNodeSize=0;for(var i=0;i0){var diff=Math.abs(currentLevel[0].value-val.value);if(diff>=levelWidth){currentLevel=[];levels.push(currentLevel)}}currentLevel.push(val)}var minDist=maxNodeSize+options.minNodeSpacing;if(!options.avoidOverlap){var firstLvlHasMulti=levels.length>0&&levels[0].length>1;var maxR=Math.min(bb.w,bb.h)/2-minDist;var rStep=maxR/(levels.length+firstLvlHasMulti?1:0);minDist=Math.min(minDist,rStep)}var r=0;for(var i=0;i1&&options.avoidOverlap){var dcos=Math.cos(dTheta)-Math.cos(0);var dsin=Math.sin(dTheta)-Math.sin(0);var rMin=Math.sqrt(minDist*minDist/(dcos*dcos+dsin*dsin));r=Math.max(rMin,r)}level.r=r;r+=minDist}if(options.equidistant){var rDeltaMax=0;var r=0;for(var i=0;i0){var force=options.nodeOverlap*overlap;var distance=Math.sqrt(directionX*directionX+directionY*directionY);var forceX=force*directionX/distance;var forceY=force*directionY/distance}else{var point1=findClippingPoint(node1,directionX,directionY);var point2=findClippingPoint(node2,-1*directionX,-1*directionY);var distanceX=point2.x-point1.x;var distanceY=point2.y-point1.y;var distanceSqr=distanceX*distanceX+distanceY*distanceY;var distance=Math.sqrt(distanceSqr);var force=(node1.nodeRepulsion+node2.nodeRepulsion)/distanceSqr;var forceX=force*distanceX/distance;var forceY=force*distanceY/distance}if(!node1.isLocked){node1.offsetX-=forceX;node1.offsetY-=forceY}if(!node2.isLocked){node2.offsetX+=forceX;node2.offsetY+=forceY}return};var nodesOverlap=function(node1,node2,dX,dY){if(dX>0){var overlapX=node1.maxX-node2.minX}else{var overlapX=node2.maxX-node1.minX}if(dY>0){var overlapY=node1.maxY-node2.minY}else{var overlapY=node2.maxY-node1.minY}if(overlapX>=0&&overlapY>=0){return Math.sqrt(overlapX*overlapX+overlapY*overlapY)}else{return 0}};var findClippingPoint=function(node,dX,dY){var X=node.positionX;var Y=node.positionY;var H=node.height||1;var W=node.width||1;var dirSlope=dY/dX;var nodeSlope=H/W;var res={};do{if(0===dX&&0dY){res.x=X;res.y=Y+H/2;break}if(0dX&&-1*nodeSlope<=dirSlope&&dirSlope<=nodeSlope){res.x=X-W/2;res.y=Y-W*dY/2/dX;break}if(0=nodeSlope)){res.x=X+H*dX/2/dY;res.y=Y+H/2;break}if(0>dY&&(dirSlope<=-1*nodeSlope||dirSlope>=nodeSlope)){res.x=X-H*dX/2/dY;res.y=Y-H/2;break}}while(false);return res};var calculateEdgeForces=function(layoutInfo,options){for(var i=0;idistThreshold){var fx=options.gravity*dx/d;var fy=options.gravity*dy/d;node.offsetX+=fx;node.offsetY+=fy}else{}}}};var propagateForces=function(layoutInfo,options){var queue=[];var start=0;var end=-1;queue.push.apply(queue,layoutInfo.graphSet[0]);end+=layoutInfo.graphSet[0].length;while(start<=end){var nodeId=queue[start++];var nodeIndex=layoutInfo.idToIndex[nodeId];var node=layoutInfo.layoutNodes[nodeIndex];var children=node.children;if(0max){var res={x:max*forceX/force,y:max*forceY/force}}else{var res={x:forceX,y:forceY}}return res};var updateAncestryBoundaries=function(node,layoutInfo){var parentId=node.parentId;if(null==parentId){return}var p=layoutInfo.layoutNodes[layoutInfo.idToIndex[parentId]];var flag=false;if(null==p.maxX||node.maxX+p.padRight>p.maxX){p.maxX=node.maxX+p.padRight;flag=true}if(null==p.minX||node.minX-p.padLeftp.maxY){p.maxY=node.maxY+p.padBottom;flag=true}if(null==p.minY||node.minY-p.padTopmaxRowW){y+=rowH+options.componentSpacing;x=0;usedW=0;rowH=0}}};var mainLoop=function(i){if(stopped){return false}step(layoutInfo,options,i);layoutInfo.temperature=layoutInfo.temperature*options.coolingFactor;if(layoutInfo.temperature0){layoutInfo.graphSet.push(children);for(var i=0;ires.count){return 0}else{return res.graph}};var findLCA_aux=function(node1,node2,graphIx,layoutInfo){var graph=layoutInfo.graphSet[graphIx];if(-1cells){var sm=small();var lg=large();if((sm-1)*lg>=cells){small(sm-1)}else if((lg-1)*sm>=cells){large(lg-1)}}else{while(cols*rows=cells){large(lg+1)}else{small(sm+1)}}}var cellWidth=bb.w/cols;var cellHeight=bb.h/rows;if(options.condense){cellWidth=0;cellHeight=0}if(options.avoidOverlap){for(var i=0;i=cols){col=0;row++}};var id2manPos={};for(var i=0;i(sqDist=math.sqdistToFiniteLine(x,y,pts[i],pts[i+1],pts[i+2],pts[i+3]))){addEle(edge,sqDist)}}}else if(rs.edgeType==="bezier"||rs.edgeType==="multibezier"||rs.edgeType==="self"||rs.edgeType==="compound"){var pts=rs.allpts;for(var i=0;i+5(sqDist=math.sqdistToQuadraticBezier(x,y,pts[i],pts[i+1],pts[i+2],pts[i+3],pts[i+4],pts[i+5]))){addEle(edge,sqDist)}}}if(inEdgeBB&&passesVisibilityCheck()){var src=src||_p.source;var tgt=tgt||_p.target;var eWidth=edge.pstyle("width").pfValue;var arSize=self.getArrowWidth(eWidth);var arrows=[{name:"source",x:rs.arrowStartX,y:rs.arrowStartY,angle:rs.srcArrowAngle},{name:"target",x:rs.arrowEndX,y:rs.arrowEndY,angle:rs.tgtArrowAngle},{name:"mid-source",x:rs.midX,y:rs.midY,angle:rs.midsrcArrowAngle},{name:"mid-target",x:rs.midX,y:rs.midY,angle:rs.midtgtArrowAngle}];for(var i=0;i0){checkNode(src);checkNode(tgt)}}function preprop(obj,name,pre){return util.getPrefixedProperty(obj,name,pre)}function checkLabel(ele,prefix){var _p=ele._private;var th=labelThreshold;var prefixDash;if(prefix){prefixDash=prefix+"-"}else{prefixDash=""}if(ele.pstyle("text-events").strValue==="no"){return}var rotation=ele.pstyle(prefixDash+"text-rotation");if(rotation.strValue==="autorotate"||!!rotation.pfValue){var rstyle=_p.rstyle;var bw=ele.pstyle("text-border-width").pfValue;var lw=preprop(rstyle,"labelWidth",prefix)+bw/2+2*th;var lh=preprop(rstyle,"labelHeight",prefix)+bw/2+2*th;var lx=preprop(rstyle,"labelX",prefix);var ly=preprop(rstyle,"labelY",prefix);var theta=preprop(_p.rscratch,"labelAngle",prefix);var cos=Math.cos(theta);var sin=Math.sin(theta);var rotate=function(x,y){x=x-lx;y=y-ly;return{x:x*cos-y*sin+lx,y:x*sin+y*cos+ly}};var lx1=lx-lw/2;var lx2=lx+lw/2;var ly1=ly-lh/2;var ly2=ly+lh/2;var px1y1=rotate(lx1,ly1);var px1y2=rotate(lx1,ly2);var px2y1=rotate(lx2,ly1);var px2y2=rotate(lx2,ly2);var points=[px1y1.x,px1y1.y,px2y1.x,px2y1.y,px2y2.x,px2y2.y,px1y2.x,px1y2.y];if(math.pointInsidePolygonPoints(x,y,points)){addEle(ele)}}else{var bb=ele.boundingBox({includeLabels:true,includeNodes:false,includeEdges:false});bb.x1-=th;bb.y1-=th;bb.x2+=th;bb.y2+=th;bb.w=bb.x2-bb.x1;bb.h=bb.y2-bb.y1;if(math.inBoundingBox(bb,x,y)){addEle(ele)}}}for(var i=eles.length-1;i>=0;i--){var ele=eles[i];if(ele.isNode()){checkNode(ele);checkLabel(ele)}else{checkEdge(ele);checkLabel(ele);checkLabel(ele,"source");checkLabel(ele,"target")}}return near};BRp.getAllInBox=function(x1,y1,x2,y2){var eles=this.getCachedZSortedEles();var nodes=eles.nodes;var edges=eles.edges;var box=[];var x1c=Math.min(x1,x2);var x2c=Math.max(x1,x2);var y1c=Math.min(y1,y2);var y2c=Math.max(y1,y2);x1=x1c;x2=x2c;y1=y1c;y2=y2c;var boxBb=math.makeBoundingBox({x1:x1,y1:y1,x2:x2,y2:y2});for(var i=0;i=offset||lastSeg){selected={cp:cp,segment:seg};break}}if(selected){break}}var cp=selected.cp;var seg=selected.segment;var tSegment=(offset-startDist)/seg.length;var segDt=seg.t1-seg.t0;var t=isSrc?seg.t0+segDt*tSegment:seg.t1-segDt*tSegment;t=math.bound(0,t,1);p=math.qbezierPtAt(cp.p0,cp.p1,cp.p2,t);angle=bezierAngle(cp.p0,cp.p1,cp.p2,t,p);break;case"straight":case"segments":case"haystack":var d=0,di,d0;var p0,p1;var l=rs.allpts.length;for(var i=0;i+3=offset){break}}var pD=offset-d0;var t=pD/di;t=math.bound(0,t,1);p=math.lineAt(p0,p1,t);angle=lineAngle(p0,p1);break}setRs("labelX",prefix,p.x);setRs("labelY",prefix,p.y);setRs("labelAutoAngle",prefix,angle)};calculateEndProjection("source");calculateEndProjection("target");this.applyLabelDimensions(edge)};BRp.applyLabelDimensions=function(ele){this.applyPrefixedLabelDimensions(ele);if(ele.isEdge()){this.applyPrefixedLabelDimensions(ele,"source");this.applyPrefixedLabelDimensions(ele,"target")}};BRp.applyPrefixedLabelDimensions=function(ele,prefix){var _p=ele._private;var text=this.getLabelText(ele,prefix);var labelDims=this.calculateLabelDimensions(ele,text);util.setPrefixedProperty(_p.rstyle,"labelWidth",prefix,labelDims.width);util.setPrefixedProperty(_p.rscratch,"labelWidth",prefix,labelDims.width);util.setPrefixedProperty(_p.rstyle,"labelHeight",prefix,labelDims.height);util.setPrefixedProperty(_p.rscratch,"labelHeight",prefix,labelDims.height)};BRp.getLabelText=function(ele,prefix){var _p=ele._private;var pfd=prefix?prefix+"-":"";var text=ele.pstyle(pfd+"label").strValue;var textTransform=ele.pstyle("text-transform").value;var rscratch=function(propName,value){if(value){util.setPrefixedProperty(_p.rscratch,propName,prefix,value);return value}else{return util.getPrefixedProperty(_p.rscratch,propName,prefix)}};if(textTransform=="none"){}else if(textTransform=="uppercase"){text=text.toUpperCase()}else if(textTransform=="lowercase"){text=text.toLowerCase()}if(ele.pstyle("text-wrap").value==="wrap"){var labelKey=rscratch("labelKey");if(labelKey&&rscratch("labelWrapKey")===labelKey){return rscratch("labelWrapCachedText")}var lines=text.split("\n");var maxW=ele.pstyle("text-max-width").pfValue;var wrappedLines=[];for(var l=0;lmaxW){var words=line.split(/\s+/);var subline="";for(var w=0;wtgtId?tgtId+"$-$"+srcId:srcId+"$-$"+tgtId;if(edgeIsUnbundled){pairId="unbundled"+"$-$"+data.id}if(hashTable[pairId]==null){hashTable[pairId]=[];pairIds.push(pairId)}hashTable[pairId].push(edge);if(edgeIsUnbundled){hashTable[pairId].hasUnbundled=true}}var src,tgt,src_p,tgt_p,srcPos,tgtPos,srcW,srcH,tgtW,tgtH,srcShape,tgtShape;var vectorNormInverse;var badBezier;for(var p=0;ptgt.id()){var temp=src;src=tgt;tgt=temp}src_p=src._private;tgt_p=tgt._private;srcPos=src_p.position;tgtPos=tgt_p.position;srcW=src.outerWidth();srcH=src.outerHeight();tgtW=tgt.outerWidth();tgtH=tgt.outerHeight();srcShape=r.nodeShapes[this.getNodeShape(src)];tgtShape=r.nodeShapes[this.getNodeShape(tgt)];badBezier=false;if(pairEdges.length>1&&src!==tgt||pairEdges.hasUnbundled){var srcOutside=srcShape.intersectLine(srcPos.x,srcPos.y,srcW,srcH,tgtPos.x,tgtPos.y,0);var tgtOutside=tgtShape.intersectLine(tgtPos.x,tgtPos.y,tgtW,tgtH,srcPos.x,srcPos.y,0);var midptSrcPts={x1:srcOutside[0],x2:tgtOutside[0],y1:srcOutside[1],y2:tgtOutside[1]};var posPts={x1:srcPos.x,x2:tgtPos.x,y1:srcPos.y,y2:tgtPos.y};var dy=tgtOutside[1]-srcOutside[1];var dx=tgtOutside[0]-srcOutside[0];var l=Math.sqrt(dx*dx+dy*dy);var vector={x:dx,y:dy};var vectorNorm={x:vector.x/l,y:vector.y/l};vectorNormInverse={x:-vectorNorm.y,y:vectorNorm.x};if(tgtShape.checkPoint(srcOutside[0],srcOutside[1],0,tgtW,tgtH,tgtPos.x,tgtPos.y)&&srcShape.checkPoint(tgtOutside[0],tgtOutside[1],0,srcW,srcH,srcPos.x,srcPos.y)){vectorNormInverse={};badBezier=true}}var edge;var edge_p;var rs;for(var i=0;icontainerPageCoords[0]&&e.clientXcontainerPageCoords[1]&&e.clientY=r.desktopTapThreshold2}var multSelKeyDown=isMultSelKeyDown(e);if(isOverThresholdDrag){r.hoverData.tapholdCancelled=true}var updateDragDelta=function(){var dragDelta=r.hoverData.dragDelta=r.hoverData.dragDelta||[];if(dragDelta.length===0){dragDelta.push(disp[0]);dragDelta.push(disp[1])}else{dragDelta[0]+=disp[0];dragDelta[1]+=disp[1]}};preventDefault=true;triggerEvents(near,["mousemove","vmousemove","tapdrag"],e,{cyPosition:{x:pos[0],y:pos[1]}});if(r.hoverData.which===3){if(isOverThresholdDrag){var cxtEvt=new Event(e,{type:"cxtdrag",cyPosition:{x:pos[0],y:pos[1]}});if(down){down.trigger(cxtEvt)}else{cy.trigger(cxtEvt)}r.hoverData.cxtDragged=true;if(!r.hoverData.cxtOver||near!==r.hoverData.cxtOver){if(r.hoverData.cxtOver){r.hoverData.cxtOver.trigger(new Event(e,{type:"cxtdragout",cyPosition:{x:pos[0],y:pos[1]}}))}r.hoverData.cxtOver=near;if(near){near.trigger(new Event(e,{type:"cxtdragover",cyPosition:{x:pos[0],y:pos[1]}}))}}}}else if(r.hoverData.dragging){preventDefault=true;if(cy.panningEnabled()&&cy.userPanningEnabled()){var deltaP;if(r.hoverData.justStartedPan){var mdPos=r.hoverData.mdownPos;deltaP={x:(pos[0]-mdPos[0])*zoom,y:(pos[1]-mdPos[1])*zoom};r.hoverData.justStartedPan=false}else{deltaP={x:disp[0]*zoom,y:disp[1]*zoom}}cy.panBy(deltaP);r.hoverData.dragged=true}pos=r.projectIntoViewport(e.clientX,e.clientY)}else if(select[4]==1&&(down==null||down.isEdge())){if(isOverThresholdDrag){if(!r.hoverData.dragging&&cy.boxSelectionEnabled()&&(multSelKeyDown||!cy.panningEnabled()||!cy.userPanningEnabled())){r.data.bgActivePosistion=undefined;if(!r.hoverData.selecting){cy.trigger("boxstart")}r.hoverData.selecting=true;r.redrawHint("select",true);r.redraw()}else if(!r.hoverData.selecting&&cy.panningEnabled()&&cy.userPanningEnabled()){var allowPassthrough=allowPanningPassthrough(down,r.hoverData.downs);if(allowPassthrough){r.hoverData.dragging=true;r.hoverData.justStartedPan=true;select[4]=0;r.data.bgActivePosistion=math.array2point(mdownPos);r.redrawHint("select",true);r.redraw()}}if(down&&down.isEdge()&&down.active()){down.unactivate()}}}else{if(down&&down.isEdge()&&down.active()){down.unactivate()}if((!down||!down.grabbed())&&near!=last){if(last){triggerEvents(last,["mouseout","tapdragout"],e,{cyPosition:{x:pos[0],y:pos[1]}})}if(near){triggerEvents(near,["mouseover","tapdragover"],e,{cyPosition:{x:pos[0],y:pos[1]}})}r.hoverData.last=near}if(down&&r.nodeIsDraggable(down)){if(isOverThresholdDrag){var justStartedDrag=!r.dragData.didDrag;if(justStartedDrag){r.redrawHint("eles",true)}r.dragData.didDrag=true;var toTrigger=[];if(!r.hoverData.draggingEles){addNodesToDrag(cy.collection(draggedElements),{inDragLayer:true})}for(var i=0;i0){r.redrawHint("eles",true)}r.dragData.possibleDragElements=draggedElements=[]}triggerEvents(near,["mouseup","tapend","vmouseup"],e,{cyPosition:{x:pos[0],y:pos[1]}});if(!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting){triggerEvents(down,["click","tap","vclick"],e,{cyPosition:{x:pos[0],y:pos[1]}})}if(near==down&&!r.dragData.didDrag&&!r.hoverData.selecting){if(near!=null&&near._private.selectable){if(r.hoverData.dragging){}else if(cy.selectionType()==="additive"||multSelKeyDown){if(near.selected()){near.unselect()}else{near.select()}}else{if(!multSelKeyDown){cy.$(":selected").unmerge(near).unselect();near.select()}}r.redrawHint("eles",true)}}if(r.hoverData.selecting){var box=cy.collection(r.getAllInBox(select[0],select[1],select[2],select[3]));r.redrawHint("select",true);if(box.length>0){r.redrawHint("eles",true)}cy.trigger("boxend");var eleWouldBeSelected=function(ele){return ele.selectable()&&!ele.selected()};if(cy.selectionType()==="additive"){box.trigger("box").stdFilter(eleWouldBeSelected).select().trigger("boxselect")}else{if(!multSelKeyDown){cy.$(":selected").unmerge(box).unselect()}box.trigger("box").stdFilter(eleWouldBeSelected).select().trigger("boxselect")}r.redraw()}if(r.hoverData.dragging){r.hoverData.dragging=false;r.redrawHint("select",true);r.redrawHint("eles",true);r.redraw()}if(!select[4]){r.redrawHint("drag",true);r.redrawHint("eles",true);var downWasGrabbed=down&&down.grabbed();freeDraggedElements(draggedElements);if(downWasGrabbed){down.trigger("free")}}}select[4]=0;r.hoverData.down=null;r.hoverData.cxtStarted=false;r.hoverData.draggingEles=false;r.hoverData.selecting=false;r.dragData.didDrag=false;r.hoverData.dragged=false;r.hoverData.dragDelta=[];r.hoverData.mdownPos=null;r.hoverData.mdownGPos=null},false);var wheelHandler=function(e){if(r.scrollingPage){return}var cy=r.cy;var pos=r.projectIntoViewport(e.clientX,e.clientY);var rpos=[pos[0]*cy.zoom()+cy.pan().x,pos[1]*cy.zoom()+cy.pan().y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||inBoxSelection()){e.preventDefault();return}if(cy.panningEnabled()&&cy.userPanningEnabled()&&cy.zoomingEnabled()&&cy.userZoomingEnabled()){e.preventDefault();r.data.wheelZooming=true;clearTimeout(r.data.wheelTimeout);r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=false;r.redrawHint("eles",true);r.redraw()},150);var diff;if(e.deltaY!=null){diff=e.deltaY/-250}else if(e.wheelDeltaY!=null){diff=e.wheelDeltaY/1e3}else{diff=e.wheelDelta/1e3}diff=diff*r.wheelSensitivity;var needsWheelFix=e.deltaMode===1;if(needsWheelFix){diff*=33}cy.zoom({level:cy.zoom()*Math.pow(10,diff),renderedPosition:{x:rpos[0],y:rpos[1]}})}};r.registerBinding(r.container,"wheel",wheelHandler,true);r.registerBinding(window,"scroll",function scrollHandler(e){r.scrollingPage=true;clearTimeout(r.scrollingPageTimeout);r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=false},250)},true);r.registerBinding(r.container,"mouseout",function mouseOutHandler(e){var pos=r.projectIntoViewport(e.clientX,e.clientY);r.cy.trigger(new Event(e,{type:"mouseout",cyPosition:{x:pos[0],y:pos[1]}}))},false);r.registerBinding(r.container,"mouseover",function mouseOverHandler(e){var pos=r.projectIntoViewport(e.clientX,e.clientY);r.cy.trigger(new Event(e,{type:"mouseover",cyPosition:{x:pos[0],y:pos[1]}}))},false);var f1x1,f1y1,f2x1,f2y1;var distance1,distance1Sq;var center1,modelCenter1;var offsetLeft,offsetTop;var containerWidth,containerHeight;var twoFingersStartInside;var distance=function(x1,y1,x2,y2){return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))};var distanceSq=function(x1,y1,x2,y2){return(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)};var touchstartHandler;r.registerBinding(r.container,"touchstart",touchstartHandler=function(e){r.touchData.capture=true;r.data.bgActivePosistion=undefined;var cy=r.cy;var now=r.touchData.now;var earlier=r.touchData.earlier;if(e.touches[0]){var pos=r.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);now[0]=pos[0];now[1]=pos[1]}if(e.touches[1]){var pos=r.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);now[2]=pos[0];now[3]=pos[1]}if(e.touches[2]){var pos=r.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);now[4]=pos[0];now[5]=pos[1]}if(e.touches[1]){freeDraggedElements(r.dragData.touchDragEles);var offsets=r.findContainerClientCoords();offsetLeft=offsets[0];offsetTop=offsets[1];containerWidth=offsets[2];containerHeight=offsets[3];f1x1=e.touches[0].clientX-offsetLeft;f1y1=e.touches[0].clientY-offsetTop;f2x1=e.touches[1].clientX-offsetLeft;f2y1=e.touches[1].clientY-offsetTop;twoFingersStartInside=0<=f1x1&&f1x1<=containerWidth&&0<=f2x1&&f2x1<=containerWidth&&0<=f1y1&&f1y1<=containerHeight&&0<=f2y1&&f2y1<=containerHeight;var pan=cy.pan();var zoom=cy.zoom();distance1=distance(f1x1,f1y1,f2x1,f2y1);distance1Sq=distanceSq(f1x1,f1y1,f2x1,f2y1);center1=[(f1x1+f2x1)/2,(f1y1+f2y1)/2];modelCenter1=[(center1[0]-pan.x)/zoom,(center1[1]-pan.y)/zoom];var cxtDistThreshold=200;var cxtDistThresholdSq=cxtDistThreshold*cxtDistThreshold;if(distance1Sq=r.touchTapThreshold2}if(capture&&r.touchData.cxt){e.preventDefault();var f1x2=e.touches[0].clientX-offsetLeft,f1y2=e.touches[0].clientY-offsetTop;var f2x2=e.touches[1].clientX-offsetLeft,f2y2=e.touches[1].clientY-offsetTop;var distance2Sq=distanceSq(f1x2,f1y2,f2x2,f2y2);var factorSq=distance2Sq/distance1Sq;var distThreshold=150;var distThresholdSq=distThreshold*distThreshold;var factorThreshold=1.5;var factorThresholdSq=factorThreshold*factorThreshold;if(factorSq>=factorThresholdSq||distance2Sq>=distThresholdSq){r.touchData.cxt=false;if(r.touchData.start){r.touchData.start.unactivate();r.touchData.start=null}r.data.bgActivePosistion=undefined;r.redrawHint("select",true);var cxtEvt=new Event(e,{type:"cxttapend",cyPosition:{x:now[0],y:now[1]}});if(r.touchData.start){r.touchData.start.trigger(cxtEvt)}else{cy.trigger(cxtEvt)}}}if(capture&&r.touchData.cxt){var cxtEvt=new Event(e,{type:"cxtdrag",cyPosition:{x:now[0],y:now[1]}});r.data.bgActivePosistion=undefined;r.redrawHint("select",true);if(r.touchData.start){r.touchData.start.trigger(cxtEvt)}else{cy.trigger(cxtEvt)}if(r.touchData.start){r.touchData.start._private.grabbed=false}r.touchData.cxtDragged=true;var near=r.findNearestElement(now[0],now[1],true,true);if(!r.touchData.cxtOver||near!==r.touchData.cxtOver){if(r.touchData.cxtOver){r.touchData.cxtOver.trigger(new Event(e,{type:"cxtdragout",cyPosition:{x:now[0],y:now[1]}}))}r.touchData.cxtOver=near;if(near){near.trigger(new Event(e,{type:"cxtdragover",cyPosition:{x:now[0],y:now[1]}}))}}}else if(capture&&e.touches[2]&&cy.boxSelectionEnabled()){e.preventDefault();r.data.bgActivePosistion=undefined;this.lastThreeTouch=+new Date;if(!r.touchData.selecting){cy.trigger("boxstart")}r.touchData.selecting=true;r.redrawHint("select",true);if(!select||select.length===0||select[0]===undefined){select[0]=(now[0]+now[2]+now[4])/3;select[1]=(now[1]+now[3]+now[5])/3;select[2]=(now[0]+now[2]+now[4])/3+1;select[3]=(now[1]+now[3]+now[5])/3+1}else{select[2]=(now[0]+now[2]+now[4])/3;select[3]=(now[1]+now[3]+now[5])/3}select[4]=1;r.touchData.selecting=true;r.redraw()}else if(capture&&e.touches[1]&&cy.zoomingEnabled()&&cy.panningEnabled()&&cy.userZoomingEnabled()&&cy.userPanningEnabled()){e.preventDefault();r.data.bgActivePosistion=undefined;r.redrawHint("select",true);var draggedEles=r.dragData.touchDragEles;if(draggedEles){r.redrawHint("drag",true);for(var i=0;i0||textBorderWidth>0&&borderOpacity>0){var bgX=textX;switch(halign){case"left":bgX-=textW;break;case"center":bgX-=textW/2;break;case"right":break}var bgY=textY-textH;if(backgroundOpacity>0){var textFill=context.fillStyle;var textBackgroundColor=ele.pstyle("text-background-color").value;context.fillStyle="rgba("+textBackgroundColor[0]+","+textBackgroundColor[1]+","+textBackgroundColor[2]+","+backgroundOpacity*parentOpacity+")";var styleShape=ele.pstyle("text-background-shape").strValue;if(styleShape=="roundrectangle"){roundRect(context,bgX,bgY,textW,textH,2)}else{context.fillRect(bgX,bgY,textW,textH)}context.fillStyle=textFill}if(textBorderWidth>0&&borderOpacity>0){var textStroke=context.strokeStyle;var textLineWidth=context.lineWidth;var textBorderColor=ele.pstyle("text-border-color").value;var textBorderStyle=ele.pstyle("text-border-style").value;context.strokeStyle="rgba("+textBorderColor[0]+","+textBorderColor[1]+","+textBorderColor[2]+","+borderOpacity*parentOpacity+")";context.lineWidth=textBorderWidth;if(context.setLineDash){switch(textBorderStyle){case"dotted":context.setLineDash([1,1]);break;case"dashed":context.setLineDash([4,2]);break;case"double":context.lineWidth=textBorderWidth/4;context.setLineDash([]);break;case"solid":context.setLineDash([]);break}}context.strokeRect(bgX,bgY,textW,textH);if(textBorderStyle==="double"){var whiteWidth=textBorderWidth/2;context.strokeRect(bgX+whiteWidth,bgY+whiteWidth,textW-whiteWidth*2,textH-whiteWidth*2)}if(context.setLineDash){context.setLineDash([])}context.lineWidth=textLineWidth;context.strokeStyle=textStroke}}var lineWidth=2*ele.pstyle("text-outline-width").pfValue;if(lineWidth>0){context.lineWidth=lineWidth}if(ele.pstyle("text-wrap").value==="wrap"){var lines=rscratch.labelWrapCachedLines;var lineHeight=textH/lines.length;switch(valign){case"top":textY-=(lines.length-1)*lineHeight;break;case"center":case"bottom":textY-=(lines.length-1)*lineHeight;break}for(var l=0;l0){context.strokeText(lines[l],textX,textY)}context.fillText(lines[l],textX,textY);textY+=lineHeight}}else{if(lineWidth>0){context.strokeText(text,textX,textY)}context.fillText(text,textX,textY)}if(theta!==0){context.rotate(-theta);context.translate(-orgTextX,-orgTextY)}this.shadowStyle(context,"transparent",0)}};module.exports=CRp},{"../../../math":116,"../../../util":131}],100:[function(require,module,exports){"use strict";var is=require("../../../is");var CRp={};CRp.drawNode=function(context,node,shiftToOriginWithBb,drawLabel){var r=this;var nodeWidth,nodeHeight;var rs=node._private.rscratch;var _p=node._private;var pos=pos||_p.position;if(!is.number(pos.x)||!is.number(pos.y)){return}if(!node.visible()){return}var parentOpacity=node.effectiveOpacity();var usePaths=this.usePaths();var path;var pathCacheHit=false;nodeWidth=node.width()+node.pstyle("padding-left").pfValue+node.pstyle("padding-right").pfValue;nodeHeight=node.height()+node.pstyle("padding-top").pfValue+node.pstyle("padding-bottom").pfValue;context.lineWidth=node.pstyle("border-width").pfValue;var bb;if(shiftToOriginWithBb){bb=shiftToOriginWithBb;context.translate(-bb.x1,-bb.y1)}var bgImgProp=node.pstyle("background-image");var url=bgImgProp.value[2]||bgImgProp.value[1];var image;if(url!==undefined){image=this.getCachedImage(url,function(){node.trigger("background");r.redrawHint("eles",true);r.redrawHint("drag",true);r.drawingImage=true;r.redraw()});var prevBging=_p.backgrounding;_p.backgrounding=!image.complete;if(prevBging!==_p.backgrounding){node.updateStyle(false)}}var bgColor=node.pstyle("background-color").value;var borderColor=node.pstyle("border-color").value;var borderStyle=node.pstyle("border-style").value;this.fillStyle(context,bgColor[0],bgColor[1],bgColor[2],node.pstyle("background-opacity").value*parentOpacity);this.strokeStyle(context,borderColor[0],borderColor[1],borderColor[2],node.pstyle("border-opacity").value*parentOpacity);var shadowBlur=node.pstyle("shadow-blur").pfValue;var shadowOpacity=node.pstyle("shadow-opacity").value;var shadowColor=node.pstyle("shadow-color").value;var shadowOffsetX=node.pstyle("shadow-offset-x").pfValue;var shadowOffsetY=node.pstyle("shadow-offset-y").pfValue;this.shadowStyle(context,shadowColor,shadowOpacity,shadowBlur,shadowOffsetX,shadowOffsetY);context.lineJoin="miter";if(context.setLineDash){switch(borderStyle){case"dotted":context.setLineDash([1,1]);break;case"dashed":context.setLineDash([4,2]);break;case"solid":case"double":context.setLineDash([]);break}}var styleShape=node.pstyle("shape").strValue;var shapePts=node.pstyle("shape-polygon-points").pfValue;if(usePaths){var pathCacheKey=styleShape+"$"+nodeWidth+"$"+nodeHeight+(styleShape==="polygon"?"$"+shapePts.join("$"):"");context.translate(pos.x,pos.y);if(rs.pathCacheKey===pathCacheKey){path=rs.pathCache;pathCacheHit=true}else{path=new Path2D;rs.pathCacheKey=pathCacheKey;rs.pathCache=path}}if(!pathCacheHit){var npos=pos;if(usePaths){npos={x:0,y:0}}r.nodeShapes[this.getNodeShape(node)].draw(path||context,npos.x,npos.y,nodeWidth,nodeHeight)}if(usePaths){context.fill(path)}else{context.fill()}this.shadowStyle(context,"transparent",0);if(url!==undefined){if(image.complete){this.drawInscribedImage(context,image,node)}}var darkness=node.pstyle("background-blacken").value;var borderWidth=node.pstyle("border-width").pfValue;if(this.hasPie(node)){this.drawPie(context,node,parentOpacity);if(darkness!==0||borderWidth!==0){if(!usePaths){r.nodeShapes[this.getNodeShape(node)].draw(context,pos.x,pos.y,nodeWidth,nodeHeight)}}}if(darkness>0){this.fillStyle(context,0,0,0,darkness);if(usePaths){context.fill(path)}else{context.fill()}}else if(darkness<0){this.fillStyle(context,255,255,255,-darkness);if(usePaths){context.fill(path)}else{context.fill()}}if(borderWidth>0){if(usePaths){context.stroke(path)}else{context.stroke()}if(borderStyle==="double"){context.lineWidth=node.pstyle("border-width").pfValue/3;var gco=context.globalCompositeOperation;context.globalCompositeOperation="destination-out";if(usePaths){context.stroke(path)}else{context.stroke()}context.globalCompositeOperation=gco}}if(usePaths){context.translate(-pos.x,-pos.y)}if(context.setLineDash){context.setLineDash([])}r.drawElementText(context,node,drawLabel);var overlayPadding=node.pstyle("overlay-padding").pfValue;var overlayOpacity=node.pstyle("overlay-opacity").value;var overlayColor=node.pstyle("overlay-color").value;if(overlayOpacity>0){this.fillStyle(context,overlayColor[0],overlayColor[1],overlayColor[2],overlayOpacity);r.nodeShapes["roundrectangle"].draw(context,node._private.position.x,node._private.position.y,nodeWidth+overlayPadding*2,nodeHeight+overlayPadding*2); +})).then(function(){cy.off("step.*",onStep);if(options.zoom!=null){cy.zoom(options.zoom)}if(options.pan){cy.pan(options.pan)}if(options.fit){cy.fit(options.eles,options.padding)}layout.one("layoutstop",options.stop);layout.trigger({type:"layoutstop",layout:layout})})}else{nodes.positions(fn);if(options.fit){cy.fit(options.eles,options.padding)}if(options.zoom!=null){cy.zoom(options.zoom)}if(options.pan){cy.pan(options.pan)}layout.one("layoutready",options.ready);layout.trigger({type:"layoutready",layout:layout});layout.one("layoutstop",options.stop);layout.trigger({type:"layoutstop",layout:layout})}return this},layout:function(options){var cy=this.cy();cy.layout(util.extend({},options,{eles:this}));return this},makeLayout:function(options){var cy=this.cy();return cy.makeLayout(util.extend({},options,{eles:this}))}};elesfn.createLayout=elesfn.makeLayout;module.exports=elesfn},{"../is":115,"../promise":118,"../util":132}],61:[function(require,module,exports){"use strict";var is=require("../is");var elesfn={updateStyle:function(notifyRenderer){var cy=this._private.cy;if(!cy.styleEnabled()){return this}if(cy._private.batchingStyle){var bEles=cy._private.batchStyleEles;bEles.merge(this);return this}var style=cy.style();notifyRenderer=notifyRenderer||notifyRenderer===undefined?true:false;style.apply(this);var updatedCompounds=this.updateCompoundBounds();var toNotify=updatedCompounds.length>0?this.add(updatedCompounds):this;if(notifyRenderer){toNotify.rtrigger("style")}else{toNotify.trigger("style")}return this},updateMappers:function(notifyRenderer){var cy=this._private.cy;var style=cy.style();notifyRenderer=notifyRenderer||notifyRenderer===undefined?true:false;if(!cy.styleEnabled()){return this}style.updateMappers(this);var updatedCompounds=this.updateCompoundBounds();var toNotify=updatedCompounds.length>0?this.add(updatedCompounds):this;if(notifyRenderer){toNotify.rtrigger("style")}else{toNotify.trigger("style")}return this},parsedStyle:function(property){var ele=this[0];if(!ele.cy().styleEnabled()){return}if(ele){return ele._private.style[property]||ele.cy().style().getDefaultProperty(property)}},renderedStyle:function(property){var cy=this.cy();if(!cy.styleEnabled()){return this}var ele=this[0];if(ele){var renstyle=ele.cy().style().getRenderedStyle(ele);if(property===undefined){return renstyle}else{return renstyle[property]}}},style:function(name,value){var cy=this.cy();if(!cy.styleEnabled()){return this}var updateTransitions=false;var style=cy.style();if(is.plainObject(name)){var props=name;style.applyBypass(this,props,updateTransitions);var updatedCompounds=this.updateCompoundBounds();var toNotify=updatedCompounds.length>0?this.add(updatedCompounds):this;toNotify.rtrigger("style")}else if(is.string(name)){if(value===undefined){var ele=this[0];if(ele){return style.getStylePropertyValue(ele,name)}else{return}}else{style.applyBypass(this,name,value,updateTransitions);var updatedCompounds=this.updateCompoundBounds();var toNotify=updatedCompounds.length>0?this.add(updatedCompounds):this;toNotify.rtrigger("style")}}else if(name===undefined){var ele=this[0];if(ele){return style.getRawStyle(ele)}else{return}}return this},removeStyle:function(names){var cy=this.cy();if(!cy.styleEnabled()){return this}var updateTransitions=false;var style=cy.style();var eles=this;if(names===undefined){for(var i=0;i0?this.add(updatedCompounds):this;toNotify.rtrigger("style");return this},show:function(){this.css("display","element");return this},hide:function(){this.css("display","none");return this},visible:function(){var cy=this.cy();if(!cy.styleEnabled()){return true}var ele=this[0];var hasCompoundNodes=cy.hasCompoundNodes();if(ele){if(ele.pstyle("visibility").value!=="visible"||ele.pstyle("display").value!=="element"||ele.pstyle("width").pfValue===0){return false}if(ele._private.group==="nodes"){if(ele.pstyle("height").pfValue===0){return false}if(!hasCompoundNodes){return true}var parents=ele._private.data.parent?ele.parents():null;if(parents){for(var i=0;i0){elements.push(otherNode[0])}elements.push(edge[0])}}return this.spawn(elements,{unique:true}).filter(selector)},"neighborhood"),closedNeighborhood:function(selector){return this.neighborhood().add(this).filter(selector)},openNeighborhood:function(selector){return this.neighborhood(selector)}});elesfn.neighbourhood=elesfn.neighborhood;elesfn.closedNeighbourhood=elesfn.closedNeighborhood;elesfn.openNeighbourhood=elesfn.openNeighborhood;util.extend(elesfn,{source:cache(function sourceImpl(selector){var ele=this[0];var src;if(ele){src=ele._private.source||ele.cy().collection()}return src&&selector?src.filter(selector):src},"source"),target:cache(function targetImpl(selector){var ele=this[0];var tgt;if(ele){tgt=ele._private.target||ele.cy().collection()}return tgt&&selector?tgt.filter(selector):tgt},"target"),sources:defineSourceFunction({attr:"source"}),targets:defineSourceFunction({attr:"target"})});function defineSourceFunction(params){return function sourceImpl(selector){var sources=[];for(var i=0;i0);return components.map(function(component){var connectedEdges=component.connectedEdges().stdFilter(function(edge){return component.anySame(edge.source())&&component.anySame(edge.target())});return component.union(connectedEdges)})}});module.exports=elesfn},{"../is":115,"../util":132}],64:[function(require,module,exports){"use strict";var zIndexSort=function(a,b){var cy=a.cy();var zDiff=a.pstyle("z-index").value-b.pstyle("z-index").value;var depthA=0;var depthB=0;var hasCompoundNodes=cy.hasCompoundNodes();var aIsNode=a.isNode();var aIsEdge=!aIsNode;var bIsNode=b.isNode();var bIsEdge=!bIsNode;if(hasCompoundNodes){depthA=a.zDepth();depthB=b.zDepth()}var depthDiff=depthA-depthB;var sameDepth=depthDiff===0;if(sameDepth){if(aIsNode&&bIsEdge){return 1}else if(aIsEdge&&bIsNode){return-1}else{if(zDiff===0){return a.poolIndex()-b.poolIndex()}else{return zDiff}}}else{return depthDiff}};module.exports=zIndexSort},{}],65:[function(require,module,exports){"use strict";var is=require("../is");var util=require("../util");var Collection=require("../collection");var Element=require("../collection/element");var corefn={add:function(opts){var elements;var cy=this;if(is.elementOrCollection(opts)){var eles=opts;if(eles._private.cy===cy){elements=eles.restore()}else{var jsons=[];for(var i=0;i0){oldEles.remove()}if(elements!=null){if(is.plainObject(elements)||is.array(elements)){cy.add(elements)}}cy.one("layoutready",function(e){cy.notifications(true);cy.trigger(e);cy.notify({type:"load",eles:cy.mutableElements()});cy.one("load",onload);cy.trigger("load")}).one("layoutstop",function(){cy.one("done",ondone);cy.trigger("done")});var layoutOpts=util.extend({},cy._private.options.layout);layoutOpts.eles=cy.elements();cy.layout(layoutOpts);return this}};module.exports=corefn},{"../collection":58,"../collection/element":54,"../is":115,"../util":132}],66:[function(require,module,exports){"use strict";var define=require("../define");var util=require("../util");var is=require("../is");var corefn={animate:define.animate(),animation:define.animation(),animated:define.animated(),clearQueue:define.clearQueue(),delay:define.delay(),delayAnimation:define.delayAnimation(),stop:define.stop(),addToAnimationPool:function(eles){var cy=this;if(!cy.styleEnabled()){return}cy._private.aniEles.merge(eles)},stopAnimationLoop:function(){this._private.animationsRunning=false},startAnimationLoop:function(){var cy=this;cy._private.animationsRunning=true;if(!cy.styleEnabled()){return}function globalAnimationStep(){if(!cy._private.animationsRunning){return}util.requestAnimationFrame(function animationStep(now){handleElements(now);globalAnimationStep()})}var renderer=cy.renderer();if(renderer&&renderer.beforeRender){renderer.beforeRender(function rendererAnimationStep(willDraw,now){handleElements(now)},renderer.beforeRenderPriorities.animations)}else{globalAnimationStep()}function handleElements(now){var eles=cy._private.aniEles;var doneEles=[];function handleElement(ele,isCore){var _p=ele._private;var current=_p.animation.current;var queue=_p.animation.queue;var ranAnis=false;if(current.length===0){var next=queue.shift();if(next){current.push(next)}}var callbacks=function(callbacks){for(var j=callbacks.length-1;j>=0;j--){var cb=callbacks[j];cb()}callbacks.splice(0,callbacks.length)};for(var i=current.length-1;i>=0;i--){var ani=current[i];var ani_p=ani._private;if(ani_p.stopped){current.splice(i,1);ani_p.hooked=false;ani_p.playing=false;ani_p.started=false;callbacks(ani_p.frames);continue}if(!ani_p.playing&&!ani_p.applying){continue}if(ani_p.playing&&ani_p.applying){ani_p.applying=false}if(!ani_p.started){startAnimation(ele,ani,now)}step(ele,ani,now,isCore);if(is.fn(ani_p.step)){ani_p.step.call(ele,now)}if(ani_p.applying){ani_p.applying=false}callbacks(ani_p.frames);if(ani.completed()){current.splice(i,1);ani_p.hooked=false;ani_p.playing=false;ani_p.started=false;callbacks(ani_p.completes)}ranAnis=true}if(!isCore&¤t.length===0&&queue.length===0){doneEles.push(ele)}return ranAnis}var ranEleAni=false;for(var e=0;e0){var updatedEles=eles.updateCompoundBounds().spawnSelf().merge(eles);cy.notify({type:"draw",eles:updatedEles})}else{cy.notify({type:"draw"})}}eles.unmerge(doneEles);cy.trigger("step")}function startAnimation(self,ani,now){var isCore=is.core(self);var isEles=!isCore;var ele=self;var style=cy._private.style;var ani_p=ani._private;if(isEles){var pos=ele._private.position;ani_p.startPosition=ani_p.startPosition||{x:pos.x,y:pos.y};ani_p.startStyle=ani_p.startStyle||style.getAnimationStartStyle(ele,ani_p.style)}if(isCore){var pan=cy._private.pan;ani_p.startPan=ani_p.startPan||{x:pan.x,y:pan.y};ani_p.startZoom=ani_p.startZoom!=null?ani_p.startZoom:cy._private.zoom}ani_p.started=true;ani_p.startTime=now-ani_p.progress*ani_p.duration}function step(self,ani,now,isCore){var style=cy._private.style;var isEles=!isCore;var _p=self._private;var ani_p=ani._private;var pEasing=ani_p.easing;var startTime=ani_p.startTime;if(!ani_p.easingImpl){if(pEasing==null){ani_p.easingImpl=easings["linear"]}else{var easingVals;if(is.string(pEasing)){var easingProp=style.parse("transition-timing-function",pEasing);easingVals=easingProp.value}else{easingVals=pEasing}var name,args;if(is.string(easingVals)){name=easingVals;args=[]}else{name=easingVals[1];args=easingVals.slice(2).map(function(n){return+n})}if(args.length>0){if(name==="spring"){args.push(ani_p.duration)}ani_p.easingImpl=easings[name].apply(null,args)}else{ani_p.easingImpl=easings[name]}}}var easing=ani_p.easingImpl;var percent;if(ani_p.duration===0){percent=1}else{percent=(now-startTime)/ani_p.duration}if(ani_p.applying){percent=ani_p.progress}if(percent<0){percent=0}else if(percent>1){percent=1}if(ani_p.delay==null){var startPos=ani_p.startPosition;var endPos=ani_p.position;var pos=_p.position;if(endPos&&isEles){if(valid(startPos.x,endPos.x)){pos.x=ease(startPos.x,endPos.x,percent,easing)}if(valid(startPos.y,endPos.y)){pos.y=ease(startPos.y,endPos.y,percent,easing)}self.trigger("position")}var startPan=ani_p.startPan;var endPan=ani_p.pan;var pan=_p.pan;var animatingPan=endPan!=null&&isCore;if(animatingPan){if(valid(startPan.x,endPan.x)){pan.x=ease(startPan.x,endPan.x,percent,easing)}if(valid(startPan.y,endPan.y)){pan.y=ease(startPan.y,endPan.y,percent,easing)}self.trigger("pan")}var startZoom=ani_p.startZoom;var endZoom=ani_p.zoom;var animatingZoom=endZoom!=null&&isCore;if(animatingZoom){if(valid(startZoom,endZoom)){_p.zoom=ease(startZoom,endZoom,percent,easing)}self.trigger("zoom")}if(animatingPan||animatingZoom){self.trigger("viewport")}var props=ani_p.style;if(props&&props.length>0&&isEles){for(var i=0;itolerance&&Math.abs(last_state.v)>tolerance)){break}}return!have_duration?time_lapsed:function(percentComplete){return path[percentComplete*(path.length-1)|0]}}}();var easings={linear:function(start,end,percent){return start+(end-start)*percent},ease:cubicBezier(.25,.1,.25,1),"ease-in":cubicBezier(.42,0,1,1),"ease-out":cubicBezier(0,0,.58,1),"ease-in-out":cubicBezier(.42,0,.58,1),"ease-in-sine":cubicBezier(.47,0,.745,.715),"ease-out-sine":cubicBezier(.39,.575,.565,1),"ease-in-out-sine":cubicBezier(.445,.05,.55,.95),"ease-in-quad":cubicBezier(.55,.085,.68,.53),"ease-out-quad":cubicBezier(.25,.46,.45,.94),"ease-in-out-quad":cubicBezier(.455,.03,.515,.955),"ease-in-cubic":cubicBezier(.55,.055,.675,.19),"ease-out-cubic":cubicBezier(.215,.61,.355,1),"ease-in-out-cubic":cubicBezier(.645,.045,.355,1),"ease-in-quart":cubicBezier(.895,.03,.685,.22),"ease-out-quart":cubicBezier(.165,.84,.44,1),"ease-in-out-quart":cubicBezier(.77,0,.175,1),"ease-in-quint":cubicBezier(.755,.05,.855,.06),"ease-out-quint":cubicBezier(.23,1,.32,1),"ease-in-out-quint":cubicBezier(.86,0,.07,1),"ease-in-expo":cubicBezier(.95,.05,.795,.035),"ease-out-expo":cubicBezier(.19,1,.22,1),"ease-in-out-expo":cubicBezier(1,0,0,1),"ease-in-circ":cubicBezier(.6,.04,.98,.335),"ease-out-circ":cubicBezier(.075,.82,.165,1),"ease-in-out-circ":cubicBezier(.785,.135,.15,.86),spring:function(tension,friction,duration){if(duration===0){return easings.linear}var spring=generateSpringRK4(tension,friction,duration);return function(start,end,percent){return start+(end-start)*spring(percent)}},"cubic-bezier":function(x1,y1,x2,y2){return cubicBezier(x1,y1,x2,y2)}};function ease(startProp,endProp,percent,easingFn){if(percent<0){percent=0}else if(percent>1){percent=1}var start,end;if(startProp.pfValue!=null||startProp.value!=null){start=startProp.pfValue!=null?startProp.pfValue:startProp.value}else{start=startProp}if(endProp.pfValue!=null||endProp.value!=null){end=endProp.pfValue!=null?endProp.pfValue:endProp.value}else{end=endProp}if(is.number(start)&&is.number(end)){return easingFn(start,end,percent)}else if(is.array(start)&&is.array(end)){var easedArr=[];for(var i=0;i0?options.wheelSensitivity:1,motionBlur:options.motionBlur===undefined?false:options.motionBlur,motionBlurOpacity:options.motionBlurOpacity===undefined?.05:options.motionBlurOpacity,pixelRatio:is.number(options.pixelRatio)&&options.pixelRatio>0?options.pixelRatio:undefined,desktopTapThreshold:options.desktopTapThreshold===undefined?4:options.desktopTapThreshold,touchTapThreshold:options.touchTapThreshold===undefined?8:options.touchTapThreshold},options.renderer));loadExtData([options.style,options.elements],function(thens){var initStyle=thens[0];var initEles=thens[1];if(_p.styleEnabled){cy.setStyle(initStyle)}if(options.initrender){cy.on("initrender",options.initrender);cy.on("initrender",function(){_p.initrender=true})}cy.load(initEles,function(){cy.startAnimationLoop();_p.ready=true;if(is.fn(options.ready)){cy.on("ready",options.ready)}for(var i=0;i0){domEle.removeChild(domEle.childNodes[0])}}cy._private.renderer=null},onRender:function(fn){return this.on("render",fn)},offRender:function(fn){return this.off("render",fn)}};corefn.invalidateDimensions=corefn.resize;module.exports=corefn},{"../util":132}],73:[function(require,module,exports){"use strict";var is=require("../is");var Collection=require("../collection");var corefn={collection:function(eles,opts){if(is.string(eles)){return this.$(eles)}else if(is.elementOrCollection(eles)){return eles.collection()}else if(is.array(eles)){return new Collection(this,eles,opts)}return new Collection(this)},nodes:function(selector){var nodes=this.$(function(){return this.isNode()});if(selector){return nodes.filter(selector)}return nodes},edges:function(selector){var edges=this.$(function(){return this.isEdge()});if(selector){return edges.filter(selector)}return edges},$:function(selector){var eles=this._private.elements;if(selector){return eles.filter(selector)}else{return eles.spawnSelf()}},mutableElements:function(){return this._private.elements}};corefn.elements=corefn.filter=corefn.$;module.exports=corefn},{"../collection":58,"../is":115}],74:[function(require,module,exports){"use strict";var is=require("../is");var Style=require("../style");var corefn={style:function(newStyle){if(newStyle){var s=this.setStyle(newStyle);s.update()}return this._private.style},setStyle:function(style){var _p=this._private;if(is.stylesheet(style)){_p.style=style.generateStyle(this)}else if(is.array(style)){_p.style=Style.fromJson(this,style)}else if(is.string(style)){_p.style=Style.fromString(this,style)}else{_p.style=Style(this)}return _p.style}};module.exports=corefn},{"../is":115,"../style":124}],75:[function(require,module,exports){"use strict";var is=require("../is");var corefn={autolock:function(bool){if(bool!==undefined){this._private.autolock=bool?true:false}else{return this._private.autolock}return this},autoungrabify:function(bool){if(bool!==undefined){this._private.autoungrabify=bool?true:false}else{return this._private.autoungrabify}return this},autounselectify:function(bool){if(bool!==undefined){this._private.autounselectify=bool?true:false}else{return this._private.autounselectify}return this},panningEnabled:function(bool){if(bool!==undefined){this._private.panningEnabled=bool?true:false}else{return this._private.panningEnabled}return this},userPanningEnabled:function(bool){if(bool!==undefined){this._private.userPanningEnabled=bool?true:false}else{return this._private.userPanningEnabled}return this},zoomingEnabled:function(bool){if(bool!==undefined){this._private.zoomingEnabled=bool?true:false}else{return this._private.zoomingEnabled}return this},userZoomingEnabled:function(bool){if(bool!==undefined){this._private.userZoomingEnabled=bool?true:false}else{return this._private.userZoomingEnabled}return this},boxSelectionEnabled:function(bool){if(bool!==undefined){this._private.boxSelectionEnabled=bool?true:false}else{return this._private.boxSelectionEnabled}return this},pan:function(){var args=arguments;var pan=this._private.pan;var dim,val,dims,x,y;switch(args.length){case 0:return pan;case 1:if(is.string(args[0])){dim=args[0];return pan[dim]}else if(is.plainObject(args[0])){if(!this._private.panningEnabled){return this}dims=args[0];x=dims.x;y=dims.y;if(is.number(x)){pan.x=x}if(is.number(y)){pan.y=y}this.trigger("pan viewport")}break;case 2:if(!this._private.panningEnabled){return this}dim=args[0];val=args[1];if((dim==="x"||dim==="y")&&is.number(val)){pan[dim]=val}this.trigger("pan viewport");break;default:break}this.notify({type:"viewport"});return this},panBy:function(params){var args=arguments;var pan=this._private.pan;var dim,val,dims,x,y;if(!this._private.panningEnabled){return this}switch(args.length){case 1:if(is.plainObject(args[0])){dims=args[0];x=dims.x;y=dims.y;if(is.number(x)){pan.x+=x}if(is.number(y)){pan.y+=y}this.trigger("pan viewport")}break;case 2:dim=args[0];val=args[1];if((dim==="x"||dim==="y")&&is.number(val)){pan[dim]+=val}this.trigger("pan viewport");break;default:break}this.notify({type:"viewport"});return this},fit:function(elements,padding){var viewportState=this.getFitViewport(elements,padding);if(viewportState){var _p=this._private;_p.zoom=viewportState.zoom;_p.pan=viewportState.pan;this.trigger("pan zoom viewport");this.notify({type:"viewport"})}return this},getFitViewport:function(elements,padding){if(is.number(elements)&&padding===undefined){padding=elements;elements=undefined}if(!this._private.panningEnabled||!this._private.zoomingEnabled){return}var bb;if(is.string(elements)){var sel=elements;elements=this.$(sel)}else if(is.boundingBox(elements)){var bbe=elements;bb={x1:bbe.x1,y1:bbe.y1,x2:bbe.x2,y2:bbe.y2};bb.w=bb.x2-bb.x1;bb.h=bb.y2-bb.y1}else if(!is.elementOrCollection(elements)){elements=this.mutableElements()}bb=bb||elements.boundingBox();var w=this.width();var h=this.height();var zoom;padding=is.number(padding)?padding:0;if(!isNaN(w)&&!isNaN(h)&&w>0&&h>0&&!isNaN(bb.w)&&!isNaN(bb.h)&&bb.w>0&&bb.h>0){zoom=Math.min((w-2*padding)/bb.w,(h-2*padding)/bb.h);zoom=zoom>this._private.maxZoom?this._private.maxZoom:zoom;zoom=zoomthis._private.maxZoom?this._private.maxZoom:zoom;zoom=zoom_p.maxZoom||!_p.zoomingEnabled){zoomFailed=true}else{_p.zoom=z;events.push("zoom")}}if(panDefd&&(!zoomFailed||!opts.cancelOnFailedZoom)&&_p.panningEnabled){var p=opts.pan;if(is.number(p.x)){_p.pan.x=p.x;panFailed=false}if(is.number(p.y)){_p.pan.y=p.y;panFailed=false}if(!panFailed){events.push("pan")}}if(events.length>0){events.push("viewport");this.trigger(events.join(" "));this.notify({type:"viewport"})}return this},center:function(elements){var pan=this.getCenterPan(elements);if(pan){this._private.pan=pan;this.trigger("pan viewport");this.notify({type:"viewport"})}return this},getCenterPan:function(elements,zoom){if(!this._private.panningEnabled){return}if(is.string(elements)){var selector=elements;elements=this.mutableElements().filter(selector)}else if(!is.elementOrCollection(elements)){elements=this.mutableElements()}var bb=elements.boundingBox();var w=this.width();var h=this.height();zoom=zoom===undefined?this._private.zoom:zoom;var pan={x:(w-zoom*(bb.x1+bb.x2))/2,y:(h-zoom*(bb.y1+bb.y2))/2};return pan},reset:function(){if(!this._private.panningEnabled||!this._private.zoomingEnabled){return this}this.viewport({pan:{x:0,y:0},zoom:1});return this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var _p=this._private;var container=_p.container;return _p.sizeCache=_p.sizeCache||(container?{width:container.clientWidth,height:container.clientHeight}:{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var pan=this._private.pan;var zoom=this._private.zoom;var rb=this.renderedExtent();var b={x1:(rb.x1-pan.x)/zoom,x2:(rb.x2-pan.x)/zoom,y1:(rb.y1-pan.y)/zoom,y2:(rb.y2-pan.y)/zoom};b.w=b.x2-b.x1;b.h=b.y2-b.y1;return b},renderedExtent:function(){var width=this.width();var height=this.height();return{x1:0,y1:0,x2:width,y2:height,w:width,h:height}}};corefn.centre=corefn.center;corefn.autolockNodes=corefn.autolock;corefn.autoungrabifyNodes=corefn.autoungrabify;module.exports=corefn},{"../is":115}],76:[function(require,module,exports){"use strict";var util=require("./util");var is=require("./is");var Selector=require("./selector");var Promise=require("./promise");var Event=require("./event");var Animation=require("./animation");var define={data:function(params){var defaults={field:"data",bindingEvent:"data",allowBinding:false,allowSetting:false,allowGetting:false,settingEvent:"data",settingTriggersEvent:false,triggerFnName:"trigger",immutableKeys:{},updateStyle:false,onSet:function(self){},canSet:function(self){return true}};params=util.extend({},defaults,params);return function dataImpl(name,value){var p=params;var self=this;var selfIsArrayLike=self.length!==undefined;var all=selfIsArrayLike?self:[self];var single=selfIsArrayLike?self[0]:self;if(is.string(name)){if(p.allowGetting&&value===undefined){var ret;if(single){ret=single._private[p.field][name]}return ret}else if(p.allowSetting&&value!==undefined){var valid=!p.immutableKeys[name];if(valid){for(var i=0,l=all.length;i0}}},clearQueue:function(fnParams){var defaults={};fnParams=util.extend({},defaults,fnParams);return function clearQueueImpl(){var self=this;var selfIsArrayLike=self.length!==undefined;var all=selfIsArrayLike?self:[self];var cy=this._private.cy||this;if(!cy.styleEnabled()){return this}for(var i=0;i1){percent=1-lastPercent}var angleStart=1.5*Math.PI+2*Math.PI*lastPercent;var angleDelta=2*Math.PI*percent;var angleEnd=angleStart+angleDelta;if(size===0||lastPercent>=1||lastPercent+percent>1){continue}context.beginPath();context.moveTo(x,y);context.arc(x,y,radius,angleStart,angleEnd);context.closePath();this.fillStyle(context,color[0],color[1],color[2],opacity);context.fill();lastPercent+=percent}};module.exports=CRp},{"../../../is":114}],101:[function(require,module,exports){"use strict";var CRp={};var util=require("../../../util");var motionBlurDelay=100;CRp.getPixelRatio=function(){var context=this.data.contexts[0];if(this.forcedPixelRatio!=null){return this.forcedPixelRatio}var backingStore=context.backingStorePixelRatio||context.webkitBackingStorePixelRatio||context.mozBackingStorePixelRatio||context.msBackingStorePixelRatio||context.oBackingStorePixelRatio||context.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/backingStore};CRp.paintCache=function(context){var caches=this.paintCaches=this.paintCaches||[];var needToCreateCache=true;var cache;for(var i=0;i0){context.shadowBlur=blur*zoom;context.shadowColor="rgba("+color[0]+","+color[1]+","+color[2]+","+opacity+")";context.shadowOffsetX=offsetX*zoom;context.shadowOffsetY=offsetY*zoom}else{context.shadowBlur=0;context.shadowColor="transparent";context.shadowOffsetX=0;context.shadowOffsetY=0}};CRp.matchCanvasSize=function(container){var r=this;var data=r.data;var width=container.clientWidth;var height=container.clientHeight;var pixelRatio=r.getPixelRatio();var mbPxRatio=r.motionBlurPxRatio;if(container===r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_NODE]||container===r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_DRAG]){pixelRatio=mbPxRatio}var canvasWidth=width*pixelRatio;var canvasHeight=height*pixelRatio;var canvas;if(canvasWidth===r.canvasWidth&&canvasHeight===r.canvasHeight){return}r.fontCaches=null;var canvasContainer=data.canvasContainer;canvasContainer.style.width=width+"px";canvasContainer.style.height=height+"px";for(var i=0;ir.minMbLowQualFrames){r.motionBlurPxRatio=r.mbPxRBlurry}}if(r.clearingMotionBlur){r.motionBlurPxRatio=1}if(r.textureDrawLastFrame&&!textureDraw){needDraw[r.NODE]=true;needDraw[r.SELECT_BOX]=true}var coreStyle=cy.style()._private.coreStyle;var zoom=cy.zoom();var effectiveZoom=forcedZoom!==undefined?forcedZoom:zoom;var pan=cy.pan();var effectivePan={x:pan.x,y:pan.y};var vp={zoom:zoom,pan:{x:pan.x,y:pan.y}};var prevVp=r.prevViewport;var viewportIsDiff=prevVp===undefined||vp.zoom!==prevVp.zoom||vp.pan.x!==prevVp.pan.x||vp.pan.y!==prevVp.pan.y;if(!viewportIsDiff&&!(inNodeDragGesture&&!hasCompoundNodes)){r.motionBlurPxRatio=1}if(forcedPan){effectivePan=forcedPan}effectiveZoom*=pixelRatio;effectivePan.x*=pixelRatio;effectivePan.y*=pixelRatio;var eles=r.getCachedZSortedEles();function mbclear(context,x,y,w,h){var gco=context.globalCompositeOperation;context.globalCompositeOperation="destination-out";r.fillStyle(context,255,255,255,r.motionBlurTransparency);context.fillRect(x,y,w,h);context.globalCompositeOperation=gco}function setContextTransform(context,clear){var ePan,eZoom,w,h;if(!r.clearingMotionBlur&&(context===data.bufferContexts[r.MOTIONBLUR_BUFFER_NODE]||context===data.bufferContexts[r.MOTIONBLUR_BUFFER_DRAG])){ePan={x:pan.x*mbPxRatio,y:pan.y*mbPxRatio};eZoom=zoom*mbPxRatio;w=r.canvasWidth*mbPxRatio;h=r.canvasHeight*mbPxRatio}else{ePan=effectivePan;eZoom=effectiveZoom;w=r.canvasWidth;h=r.canvasHeight}context.setTransform(1,0,0,1,0,0);if(clear==="motionBlur"){mbclear(context,0,0,w,h)}else if(!forcedContext&&(clear===undefined||clear)){context.clearRect(0,0,w,h)}if(!drawAllLayers){context.translate(ePan.x,ePan.y);context.scale(eZoom,eZoom)}if(forcedPan){context.translate(forcedPan.x,forcedPan.y)}if(forcedZoom){context.scale(forcedZoom,forcedZoom)}}if(!textureDraw){r.textureDrawLastFrame=false}if(textureDraw){r.textureDrawLastFrame=true;var bb;if(!r.textureCache){r.textureCache={};bb=r.textureCache.bb=cy.mutableElements().boundingBox();r.textureCache.texture=r.data.bufferCanvases[r.TEXTURE_BUFFER];var cxt=r.data.bufferContexts[r.TEXTURE_BUFFER];cxt.setTransform(1,0,0,1,0,0);cxt.clearRect(0,0,r.canvasWidth*r.textureMult,r.canvasHeight*r.textureMult);r.render({forcedContext:cxt,drawOnlyNodeLayer:true,forcedPxRatio:pixelRatio*r.textureMult});var vp=r.textureCache.viewport={zoom:cy.zoom(),pan:cy.pan(),width:r.canvasWidth,height:r.canvasHeight};vp.mpan={x:(0-vp.pan.x)/vp.zoom,y:(0-vp.pan.y)/vp.zoom}}needDraw[r.DRAG]=false;needDraw[r.NODE]=false;var context=data.contexts[r.NODE];var texture=r.textureCache.texture;var vp=r.textureCache.viewport;bb=r.textureCache.bb;context.setTransform(1,0,0,1,0,0);if(motionBlur){mbclear(context,0,0,vp.width,vp.height)}else{context.clearRect(0,0,vp.width,vp.height)}var outsideBgColor=coreStyle["outside-texture-bg-color"].value;var outsideBgOpacity=coreStyle["outside-texture-bg-opacity"].value;r.fillStyle(context,outsideBgColor[0],outsideBgColor[1],outsideBgColor[2],outsideBgOpacity);context.fillRect(0,0,vp.width,vp.height);var zoom=cy.zoom();setContextTransform(context,false);context.clearRect(vp.mpan.x,vp.mpan.y,vp.width/vp.zoom/pixelRatio,vp.height/vp.zoom/pixelRatio);context.drawImage(texture,vp.mpan.x,vp.mpan.y,vp.width/vp.zoom/pixelRatio,vp.height/vp.zoom/pixelRatio)}else if(r.textureOnViewport&&!forcedContext){r.textureCache=null}var extent=cy.extent();var vpManip=r.pinching||r.hoverData.dragging||r.swipePanning||r.data.wheelZooming||r.hoverData.draggingEles;var hideEdges=r.hideEdgesOnViewport&&vpManip;var needMbClear=[];needMbClear[r.NODE]=!needDraw[r.NODE]&&motionBlur&&!r.clearedForMotionBlur[r.NODE]||r.clearingMotionBlur;if(needMbClear[r.NODE]){r.clearedForMotionBlur[r.NODE]=true}needMbClear[r.DRAG]=!needDraw[r.DRAG]&&motionBlur&&!r.clearedForMotionBlur[r.DRAG]||r.clearingMotionBlur;if(needMbClear[r.DRAG]){r.clearedForMotionBlur[r.DRAG]=true}if(needDraw[r.NODE]||drawAllLayers||drawOnlyNodeLayer||needMbClear[r.NODE]){var useBuffer=motionBlur&&!needMbClear[r.NODE]&&mbPxRatio!==1;var context=forcedContext||(useBuffer?r.data.bufferContexts[r.MOTIONBLUR_BUFFER_NODE]:data.contexts[r.NODE]);var clear=motionBlur&&!useBuffer?"motionBlur":undefined;setContextTransform(context,clear);if(hideEdges){r.drawCachedNodes(context,eles.nondrag,pixelRatio,extent)}else{r.drawLayeredElements(context,eles.nondrag,pixelRatio,extent)}if(!drawAllLayers&&!motionBlur){needDraw[r.NODE]=false}}if(!drawOnlyNodeLayer&&(needDraw[r.DRAG]||drawAllLayers||needMbClear[r.DRAG])){var useBuffer=motionBlur&&!needMbClear[r.DRAG]&&mbPxRatio!==1;var context=forcedContext||(useBuffer?r.data.bufferContexts[r.MOTIONBLUR_BUFFER_DRAG]:data.contexts[r.DRAG]);setContextTransform(context,motionBlur&&!useBuffer?"motionBlur":undefined);if(hideEdges){r.drawCachedNodes(context,eles.drag,pixelRatio,extent)}else{r.drawCachedElements(context,eles.drag,pixelRatio,extent)}if(!drawAllLayers&&!motionBlur){needDraw[r.DRAG]=false}}if(r.showFps||!drawOnlyNodeLayer&&(needDraw[r.SELECT_BOX]&&!drawAllLayers)){var context=forcedContext||data.contexts[r.SELECT_BOX];setContextTransform(context);if(r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var zoom=r.cy.zoom();var borderWidth=coreStyle["selection-box-border-width"].value/zoom;context.lineWidth=borderWidth;context.fillStyle="rgba("+coreStyle["selection-box-color"].value[0]+","+coreStyle["selection-box-color"].value[1]+","+coreStyle["selection-box-color"].value[2]+","+coreStyle["selection-box-opacity"].value+")";context.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]);if(borderWidth>0){context.strokeStyle="rgba("+coreStyle["selection-box-border-color"].value[0]+","+coreStyle["selection-box-border-color"].value[1]+","+coreStyle["selection-box-border-color"].value[2]+","+coreStyle["selection-box-opacity"].value+")";context.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1])}}if(data.bgActivePosistion&&!r.hoverData.selecting){var zoom=r.cy.zoom();var pos=data.bgActivePosistion;context.fillStyle="rgba("+coreStyle["active-bg-color"].value[0]+","+coreStyle["active-bg-color"].value[1]+","+coreStyle["active-bg-color"].value[2]+","+coreStyle["active-bg-opacity"].value+")";context.beginPath();context.arc(pos.x,pos.y,coreStyle["active-bg-size"].pfValue/zoom,0,2*Math.PI);context.fill()}var timeToRender=r.lastRedrawTime;if(r.showFps&&timeToRender){timeToRender=Math.round(timeToRender);var fps=Math.round(1e3/timeToRender);context.setTransform(1,0,0,1,0,0);context.fillStyle="rgba(255, 0, 0, 0.75)";context.strokeStyle="rgba(255, 0, 0, 0.75)";context.lineWidth=1;context.fillText("1 frame = "+timeToRender+" ms = "+fps+" fps",0,20);var maxFps=60;context.strokeRect(0,30,250,20);context.fillRect(0,30,250*Math.min(fps/maxFps,1),20)}if(!drawAllLayers){needDraw[r.SELECT_BOX]=false}}if(motionBlur&&mbPxRatio!==1){var cxtNode=data.contexts[r.NODE];var txtNode=r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_NODE];var cxtDrag=data.contexts[r.DRAG];var txtDrag=r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_DRAG];var drawMotionBlur=function(cxt,txt,needClear){cxt.setTransform(1,0,0,1,0,0);if(needClear||!motionBlurFadeEffect){cxt.clearRect(0,0,r.canvasWidth,r.canvasHeight)}else{mbclear(cxt,0,0,r.canvasWidth,r.canvasHeight)}var pxr=mbPxRatio;cxt.drawImage(txt,0,0,r.canvasWidth*pxr,r.canvasHeight*pxr,0,0,r.canvasWidth,r.canvasHeight)};if(needDraw[r.NODE]||needMbClear[r.NODE]){drawMotionBlur(cxtNode,txtNode,needMbClear[r.NODE]);needDraw[r.NODE]=false}if(needDraw[r.DRAG]||needMbClear[r.DRAG]){drawMotionBlur(cxtDrag,txtDrag,needMbClear[r.DRAG]);needDraw[r.DRAG]=false}}r.prevViewport=vp;if(r.clearingMotionBlur){r.clearingMotionBlur=false;r.motionBlurCleared=true;r.motionBlur=true}if(motionBlur){r.motionBlurTimeout=setTimeout(function(){r.motionBlurTimeout=null;r.clearedForMotionBlur[r.NODE]=false;r.clearedForMotionBlur[r.DRAG]=false;r.motionBlur=false;r.clearingMotionBlur=!textureDraw;r.mbFrames=0;needDraw[r.NODE]=true;needDraw[r.DRAG]=true;r.redraw()},motionBlurDelay)}r.drawingImage=false;if(!forcedContext&&!r.initrender){r.initrender=true;cy.trigger("initrender")}if(!forcedContext){cy.trigger("render")}};module.exports=CRp},{"../../../util":131}],102:[function(require,module,exports){"use strict";var math=require("../../../math");var CRp={};CRp.drawPolygonPath=function(context,x,y,width,height,points){var halfW=width/2;var halfH=height/2;if(context.beginPath){context.beginPath()}context.moveTo(x+halfW*points[0],y+halfH*points[1]);for(var i=1;i=maxZoom||lvl>maxLvl){return null}var scale=Math.pow(2,lvl);var eleScaledH=bb.h*scale;var eleScaledW=bb.w*scale;var caches=rs.imgCaches=rs.imgCaches||{};var eleCache=caches[lvl];if(eleCache){return eleCache}var txrH;if(eleScaledH<=minTxrH){txrH=minTxrH}else if(eleScaledH<=txrStepH){txrH=txrStepH}else{txrH=Math.ceil(eleScaledH/txrStepH)*txrStepH}if(eleScaledH>maxTxrH||eleScaledW>maxTxrW||!allowEdgeTxrCaching&&ele.isEdge()||!allowParentTxrCaching&&ele.isParent()){return null}var txrQ=self.getTextureQueue(txrH);var txr=txrQ[txrQ.length-2];var addNewTxr=function(){return self.recycleTexture(txrH,eleScaledW)||self.addTexture(txrH,eleScaledW)};if(!txr){txr=txrQ[txrQ.length-1]}if(!txr){txr=addNewTxr()}if(txr.width-txr.usedWidthlvl;l--){oneUpCache=self.getElement(ele,bb,pxRatio,l,getTxrReasons.downscale)}downscale()}else{self.queueElement(ele,bb,higherCache.level-1);return higherCache}}else{var lowerCache;if(!deqing&&!highQualityReq&&!downscaleReq){for(var l=lvl-1;l>=minLvl;l--){var c=caches[l];if(c){lowerCache=c;break}}}if(scalableFrom(lowerCache)){self.queueElement(ele,bb,lvl);return lowerCache}txr.context.translate(txr.usedWidth,0);txr.context.scale(scale,scale);r.drawElement(txr.context,ele,bb,scaledLabelShown);txr.context.scale(1/scale,1/scale);txr.context.translate(-txr.usedWidth,0)}eleCache=caches[lvl]={ele:ele,x:txr.usedWidth,texture:txr,level:lvl,scale:scale,width:eleScaledW,height:eleScaledH,scaledLabelShown:scaledLabelShown};txr.usedWidth+=Math.ceil(eleScaledW+eleTxrSpacing);txr.eleCaches.push(eleCache);self.checkTextureFullness(txr);return eleCache};ETCp.invalidateElement=function(ele){var self=this;var caches=ele._private.rscratch.imgCaches;if(caches){for(var lvl=minLvl;lvl<=maxLvl;lvl++){var cache=caches[lvl];if(cache){var txr=cache.texture;txr.invalidatedWidth+=cache.width;caches[lvl]=null;util.removeFromArray(txr.eleCaches,cache);self.checkTextureUtility(txr)}}}};ETCp.checkTextureUtility=function(txr){if(txr.invalidatedWidth>=minUtility*txr.width){this.retireTexture(txr)}};ETCp.checkTextureFullness=function(txr){var self=this;var txrQ=self.getTextureQueue(txr.height);if(txr.usedWidth/txr.width>maxFullness&&txr.fullnessChecks>=maxFullnessChecks){util.removeFromArray(txrQ,txr)}else{txr.fullnessChecks++}};ETCp.retireTexture=function(txr){var self=this;var txrH=txr.height;var txrQ=self.getTextureQueue(txrH);util.removeFromArray(txrQ,txr);txr.retired=true;var eleCaches=txr.eleCaches;for(var i=0;i=minW){txr.retired=false;txr.usedWidth=0;txr.invalidatedWidth=0;txr.fullnessChecks=0;util.clearArray(txr.eleCaches);txr.context.clearRect(0,0,txr.width,txr.height);util.removeFromArray(rtxtrQ,txr);txrQ.push(txr);return txr}}};ETCp.queueElement=function(ele,bb,lvl){var self=this;var q=self.getElementQueue();var id2q=self.getElementIdToQueue();var id=ele.id();var existingReq=id2q[id];if(existingReq){existingReq.level=Math.max(existingReq.level,lvl);existingReq.reqs++;q.updateItem(existingReq)}else{var req={ele:ele,bb:bb,position:math.copyPosition(ele.position()),level:lvl,reqs:1};if(ele.isEdge()){req.positions={source:math.copyPosition(ele.source().position()),target:math.copyPosition(ele.target().position())}}q.push(req);id2q[id]=req}};ETCp.dequeue=function(pxRatio,extent){var self=this;var q=self.getElementQueue();var id2q=self.getElementIdToQueue();var dequeued=[];for(var i=0;i0){var req=q.pop();id2q[req.ele.id()]=null;dequeued.push(req);var ele=req.ele;var bb;if(ele.isEdge()&&(!math.arePositionsSame(ele.source().position(),req.positions.source)||!math.arePositionsSame(ele.target().position(),req.positions.target))||!math.arePositionsSame(ele.position(),req.position)){bb=ele.boundingBox()}else{bb=req.bb}self.getElement(req.ele,bb,pxRatio,req.level,getTxrReasons.dequeue)}else{break}}return dequeued};ETCp.onDequeue=function(fn){this.onDequeues.push(fn)};ETCp.offDequeue=function(fn){util.removeFromArray(this.onDequeues,fn)};ETCp.setupDequeueing=defs.setupDequeueing({deqRedrawThreshold:deqRedrawThreshold,deqCost:deqCost,deqAvgCost:deqAvgCost,deqNoDrawCost:deqNoDrawCost,deqFastCost:deqFastCost,deq:function(self,pxRatio,extent){return self.dequeue(pxRatio,extent)},onDeqd:function(self,deqd){for(var i=0;i0&&height>0){buffCxt.clearRect(0,0,width,height);if(options.bg){buffCxt.fillStyle=options.bg;buffCxt.rect(0,0,width,height);buffCxt.fill()}buffCxt.globalCompositeOperation="source-over";var zsortedEles=this.getCachedZSortedEles();if(options.full){buffCxt.translate(-bb.x1*scale,-bb.y1*scale);buffCxt.scale(scale,scale);this.drawElements(buffCxt,zsortedEles)}else{var pan=cy.pan();var translation={x:pan.x*scale,y:pan.y*scale};scale*=cy.zoom();buffCxt.translate(translation.x,translation.y);buffCxt.scale(scale,scale);this.drawElements(buffCxt,zsortedEles)}}return buffCanvas};CRp.png=function(options){return this.bufferCanvasImage(options).toDataURL("image/png")};CRp.jpg=function(options){return this.bufferCanvasImage(options).toDataURL("image/jpeg")};module.exports=CRp},{"../../../is":114}],105:[function(require,module,exports){"use strict";var util=require("../../../util");var is=require("../../../is");var ElementTextureCache=require("./ele-texture-cache");var LayeredTextureCache=require("./layered-texture-cache");var CR=CanvasRenderer;var CRp=CanvasRenderer.prototype;CRp.CANVAS_LAYERS=3;CRp.SELECT_BOX=0;CRp.DRAG=1;CRp.NODE=2;CRp.BUFFER_COUNT=3;CRp.TEXTURE_BUFFER=0;CRp.MOTIONBLUR_BUFFER_NODE=1;CRp.MOTIONBLUR_BUFFER_DRAG=2;function CanvasRenderer(options){var r=this;r.data={canvases:new Array(CRp.CANVAS_LAYERS),contexts:new Array(CRp.CANVAS_LAYERS),canvasNeedsRedraw:new Array(CRp.CANVAS_LAYERS),bufferCanvases:new Array(CRp.BUFFER_COUNT),bufferContexts:new Array(CRp.CANVAS_LAYERS)};r.data.canvasContainer=document.createElement("div");var containerStyle=r.data.canvasContainer.style;r.data.canvasContainer.setAttribute("style","-webkit-tap-highlight-color: rgba(0,0,0,0);");containerStyle.position="relative";containerStyle.zIndex="0";containerStyle.overflow="hidden";var container=options.cy.container();container.appendChild(r.data.canvasContainer);container.setAttribute("style",(container.getAttribute("style")||"")+"-webkit-tap-highlight-color: rgba(0,0,0,0);");for(var i=0;i0){r.data.lyrTxrCache.invalidateElements(eles)}})}CRp.redrawHint=function(group,bool){var r=this;switch(group){case"eles":r.data.canvasNeedsRedraw[CRp.NODE]=bool;break;case"drag":r.data.canvasNeedsRedraw[CRp.DRAG]=bool;break;case"select":r.data.canvasNeedsRedraw[CRp.SELECT_BOX]=bool;break}};var pathsImpld=typeof Path2D!=="undefined";CRp.path2dEnabled=function(on){if(on===undefined){return this.pathsEnabled}this.pathsEnabled=on?true:false};CRp.usePaths=function(){return pathsImpld&&this.pathsEnabled};[require("./arrow-shapes"),require("./drawing-elements"),require("./drawing-edges"),require("./drawing-images"),require("./drawing-label-text"),require("./drawing-nodes"),require("./drawing-redraw"),require("./drawing-shapes"),require("./export-image"),require("./node-shapes")].forEach(function(props){util.extend(CRp,props)});module.exports=CR},{"../../../is":114,"../../../util":131,"./arrow-shapes":95,"./drawing-edges":96,"./drawing-elements":97,"./drawing-images":98,"./drawing-label-text":99,"./drawing-nodes":100,"./drawing-redraw":101,"./drawing-shapes":102,"./ele-texture-cache":103,"./export-image":104,"./layered-texture-cache":106,"./node-shapes":107}],106:[function(require,module,exports){"use strict";var util=require("../../../util");var math=require("../../../math");var Heap=require("../../../heap");var is=require("../../../is");var defs=require("./texture-cache-defs");var defNumLayers=1;var minLvl=-4;var maxLvl=2;var maxZoom=3.99;var deqRedrawThreshold=50;var refineEleDebounceTime=50;var disableEleImgSmoothing=true;var deqCost=.15;var deqAvgCost=.1;var deqNoDrawCost=.9;var deqFastCost=.9;var maxDeqSize=1;var invalidThreshold=250;var maxLayerArea=4e3*4e3;var alwaysQueue=true;var useHighQualityEleTxrReqs=true;var useEleTxrCaching=true;var LayeredTextureCache=function(renderer,eleTxrCache){var self=this;var r=self.renderer=renderer;self.layersByLevel={};self.firstGet=true;self.lastInvalidationTime=util.performanceNow()-2*invalidThreshold;self.skipping=false;r.beforeRender(function(willDraw,now){if(now-self.lastInvalidationTime<=invalidThreshold){self.skipping=true}else{self.skipping=false}});var qSort=function(a,b){return b.reqs-a.reqs};self.layersQueue=new Heap(qSort);self.eleTxrCache=eleTxrCache;self.setupEleCacheInvalidation();self.setupDequeueing()};var LTCp=LayeredTextureCache.prototype;var layerIdPool=0;var MAX_INT=Math.pow(2,53)-1;LTCp.makeLayer=function(bb,lvl){var scale=Math.pow(2,lvl);var w=Math.ceil(bb.w*scale);var h=Math.ceil(bb.h*scale);var canvas=document.createElement("canvas");canvas.width=w;canvas.height=h;var layer={id:layerIdPool=++layerIdPool%MAX_INT,bb:bb,level:lvl,width:w,height:h,canvas:canvas,context:canvas.getContext("2d"),eles:[],elesQueue:[],reqs:0};var cxt=layer.context;var dx=-layer.bb.x1;var dy=-layer.bb.y1;cxt.scale(scale,scale);cxt.translate(dx,dy);return layer};LTCp.getLayers=function(eles,pxRatio,lvl){var self=this;var r=self.renderer;var cy=r.cy;var zoom=cy.zoom();var firstGet=self.firstGet;self.firstGet=false;if(lvl==null){lvl=Math.ceil(math.log2(zoom*pxRatio));if(lvl=maxZoom||lvl>maxLvl){return null}}self.validateLayersElesOrdering(lvl,eles);var layersByLvl=self.layersByLevel;var scale=Math.pow(2,lvl);var layers=layersByLvl[lvl]=layersByLvl[lvl]||[];var bb;var lvlComplete=self.levelIsComplete(lvl,eles);var tmpLayers;var checkTempLevels=function(){var canUseAsTmpLvl=function(l){self.validateLayersElesOrdering(l,eles);if(self.levelIsComplete(l,eles)){tmpLayers=layersByLvl[l];return true}};var checkLvls=function(dir){if(tmpLayers){return}for(var l=lvl+dir;minLvl<=l&&l<=maxLvl;l+=dir){if(canUseAsTmpLvl(l)){break}}};checkLvls(+1);checkLvls(-1); +}}if(!layoutProto.stop){layoutProto.stop=function(){var opts=this.options;if(opts&&opts.animate){var anis=this.animations;for(var i=0;i0){var currComp=cy.collection();eles.bfs({roots:unhandledNodes[0],visit:function(i,depth,node,edge,pNode){currComp=currComp.add(node)},directed:false});unhandledNodes=unhandledNodes.not(currComp);components.push(currComp)}roots=cy.collection();for(var i=0;idepths.length-1){depths.push([])}depths[newDepth].push(ele);info.depth=newDepth;info.index=depths[newDepth].length-1}assignDepthsToEles()}var minDistance=0;if(options.avoidOverlap){for(var i=0;idepth||eleDepth===0){percent+=index/nDepth;samples++}}samples=Math.max(1,samples);percent=percent/samples;if(samples===0){percent=undefined}cachedWeightedPercent[ele.id()]=percent;return percent};var sortFn=function(a,b){var apct=getWeightedPercent(a);var bpct=getWeightedPercent(b);return apct-bpct};for(var times=0;times<3;times++){for(var i=0;i0&&depths[0].length<=3?radiusStepSize/2:0);var theta=2*Math.PI/depths[depth].length*index;if(depth===0&&depths[0].length===1){radius=1}return{x:center.x+radius*Math.cos(theta),y:center.y+radius*Math.sin(theta)}}else{return{x:center.x+(index+1-(depthSize+1)/2)*distanceX,y:(depth+1)*distanceY}}}};var pos={};for(var i=depths.length-1;i>=0;i--){var depth=depths[i];for(var j=0;j1&&options.avoidOverlap){minDistance*=1.75;var dcos=Math.cos(dTheta)-Math.cos(0);var dsin=Math.sin(dTheta)-Math.sin(0);var rMin=Math.sqrt(minDistance*minDistance/(dcos*dcos+dsin*dsin));r=Math.max(rMin,r)}var getPos=function(i,ele){var theta=options.startAngle+i*dTheta*(clockwise?1:-1);var rx=r*Math.cos(theta);var ry=r*Math.sin(theta);var pos={x:center.x+rx,y:center.y+ry};return pos};nodes.layoutPositions(this,options,getPos);return this};module.exports=CircleLayout},{"../../is":115,"../../math":117,"../../util":132}],82:[function(require,module,exports){"use strict";var util=require("../../util");var math=require("../../math");var defaults={fit:true,padding:30,startAngle:3/2*Math.PI,sweep:undefined,clockwise:true,equidistant:false,minNodeSpacing:10,boundingBox:undefined,avoidOverlap:true,height:undefined,width:undefined,concentric:function(node){return node.degree()},levelWidth:function(nodes){return nodes.maxDegree()/4},animate:false,animationDuration:500,animationEasing:undefined,ready:undefined,stop:undefined};function ConcentricLayout(options){this.options=util.extend({},defaults,options)}ConcentricLayout.prototype.run=function(){var params=this.options;var options=params;var clockwise=options.counterclockwise!==undefined?!options.counterclockwise:options.clockwise;var cy=params.cy;var eles=options.eles;var nodes=eles.nodes().not(":parent");var bb=math.makeBoundingBox(options.boundingBox?options.boundingBox:{x1:0,y1:0,w:cy.width(),h:cy.height()});var center={x:bb.x1+bb.w/2,y:bb.y1+bb.h/2};var nodeValues=[];var theta=options.startAngle;var maxNodeSize=0;for(var i=0;i0){var diff=Math.abs(currentLevel[0].value-val.value);if(diff>=levelWidth){currentLevel=[];levels.push(currentLevel)}}currentLevel.push(val)}var minDist=maxNodeSize+options.minNodeSpacing;if(!options.avoidOverlap){var firstLvlHasMulti=levels.length>0&&levels[0].length>1;var maxR=Math.min(bb.w,bb.h)/2-minDist;var rStep=maxR/(levels.length+firstLvlHasMulti?1:0);minDist=Math.min(minDist,rStep)}var r=0;for(var i=0;i1&&options.avoidOverlap){var dcos=Math.cos(dTheta)-Math.cos(0);var dsin=Math.sin(dTheta)-Math.sin(0);var rMin=Math.sqrt(minDist*minDist/(dcos*dcos+dsin*dsin));r=Math.max(rMin,r)}level.r=r;r+=minDist}if(options.equidistant){var rDeltaMax=0;var r=0;for(var i=0;i0){var force=options.nodeOverlap*overlap;var distance=Math.sqrt(directionX*directionX+directionY*directionY);var forceX=force*directionX/distance;var forceY=force*directionY/distance}else{var point1=findClippingPoint(node1,directionX,directionY);var point2=findClippingPoint(node2,-1*directionX,-1*directionY);var distanceX=point2.x-point1.x;var distanceY=point2.y-point1.y;var distanceSqr=distanceX*distanceX+distanceY*distanceY;var distance=Math.sqrt(distanceSqr);var force=(node1.nodeRepulsion+node2.nodeRepulsion)/distanceSqr;var forceX=force*distanceX/distance;var forceY=force*distanceY/distance}if(!node1.isLocked){node1.offsetX-=forceX;node1.offsetY-=forceY}if(!node2.isLocked){node2.offsetX+=forceX;node2.offsetY+=forceY}return};var nodesOverlap=function(node1,node2,dX,dY){if(dX>0){var overlapX=node1.maxX-node2.minX}else{var overlapX=node2.maxX-node1.minX}if(dY>0){var overlapY=node1.maxY-node2.minY}else{var overlapY=node2.maxY-node1.minY}if(overlapX>=0&&overlapY>=0){return Math.sqrt(overlapX*overlapX+overlapY*overlapY)}else{return 0}};var findClippingPoint=function(node,dX,dY){var X=node.positionX;var Y=node.positionY;var H=node.height||1;var W=node.width||1;var dirSlope=dY/dX;var nodeSlope=H/W;var res={};do{if(0===dX&&0dY){res.x=X;res.y=Y+H/2;break}if(0dX&&-1*nodeSlope<=dirSlope&&dirSlope<=nodeSlope){res.x=X-W/2;res.y=Y-W*dY/2/dX;break}if(0=nodeSlope)){res.x=X+H*dX/2/dY;res.y=Y+H/2;break}if(0>dY&&(dirSlope<=-1*nodeSlope||dirSlope>=nodeSlope)){res.x=X-H*dX/2/dY;res.y=Y-H/2;break}}while(false);return res};var calculateEdgeForces=function(layoutInfo,options){for(var i=0;idistThreshold){var fx=options.gravity*dx/d;var fy=options.gravity*dy/d;node.offsetX+=fx;node.offsetY+=fy}else{}}}};var propagateForces=function(layoutInfo,options){var queue=[];var start=0;var end=-1;queue.push.apply(queue,layoutInfo.graphSet[0]);end+=layoutInfo.graphSet[0].length;while(start<=end){var nodeId=queue[start++];var nodeIndex=layoutInfo.idToIndex[nodeId];var node=layoutInfo.layoutNodes[nodeIndex];var children=node.children;if(0max){var res={x:max*forceX/force,y:max*forceY/force}}else{var res={x:forceX,y:forceY}}return res};var updateAncestryBoundaries=function(node,layoutInfo){var parentId=node.parentId;if(null==parentId){return}var p=layoutInfo.layoutNodes[layoutInfo.idToIndex[parentId]];var flag=false;if(null==p.maxX||node.maxX+p.padRight>p.maxX){p.maxX=node.maxX+p.padRight;flag=true}if(null==p.minX||node.minX-p.padLeftp.maxY){p.maxY=node.maxY+p.padBottom;flag=true}if(null==p.minY||node.minY-p.padTopmaxRowW){y+=rowH+options.componentSpacing;x=0;usedW=0;rowH=0}}};var mainLoop=function(i){if(stopped){return false}step(layoutInfo,options,i);layoutInfo.temperature=layoutInfo.temperature*options.coolingFactor;if(layoutInfo.temperature0){layoutInfo.graphSet.push(children);for(var i=0;ires.count){return 0}else{return res.graph}};var findLCA_aux=function(node1,node2,graphIx,layoutInfo){var graph=layoutInfo.graphSet[graphIx];if(-1cells){var sm=small();var lg=large();if((sm-1)*lg>=cells){small(sm-1)}else if((lg-1)*sm>=cells){large(lg-1)}}else{while(cols*rows=cells){large(lg+1)}else{small(sm+1)}}}var cellWidth=bb.w/cols;var cellHeight=bb.h/rows;if(options.condense){cellWidth=0;cellHeight=0}if(options.avoidOverlap){for(var i=0;i=cols){col=0;row++}};var id2manPos={};for(var i=0;i(sqDist=math.sqdistToFiniteLine(x,y,pts[i],pts[i+1],pts[i+2],pts[i+3]))){addEle(edge,sqDist)}}}else if(rs.edgeType==="bezier"||rs.edgeType==="multibezier"||rs.edgeType==="self"||rs.edgeType==="compound"){var pts=rs.allpts;for(var i=0;i+5(sqDist=math.sqdistToQuadraticBezier(x,y,pts[i],pts[i+1],pts[i+2],pts[i+3],pts[i+4],pts[i+5]))){addEle(edge,sqDist)}}}if(inEdgeBB&&passesVisibilityCheck()){var src=src||_p.source;var tgt=tgt||_p.target;var eWidth=edge.pstyle("width").pfValue;var arSize=self.getArrowWidth(eWidth);var arrows=[{name:"source",x:rs.arrowStartX,y:rs.arrowStartY,angle:rs.srcArrowAngle},{name:"target",x:rs.arrowEndX,y:rs.arrowEndY,angle:rs.tgtArrowAngle},{name:"mid-source",x:rs.midX,y:rs.midY,angle:rs.midsrcArrowAngle},{name:"mid-target",x:rs.midX,y:rs.midY,angle:rs.midtgtArrowAngle}];for(var i=0;i0){checkNode(src);checkNode(tgt)}}function preprop(obj,name,pre){return util.getPrefixedProperty(obj,name,pre)}function checkLabel(ele,prefix){var _p=ele._private;var th=labelThreshold;var prefixDash;if(prefix){prefixDash=prefix+"-"}else{prefixDash=""}if(ele.pstyle("text-events").strValue==="no"){return}var rotation=ele.pstyle(prefixDash+"text-rotation");if(rotation.strValue==="autorotate"||!!rotation.pfValue){var rstyle=_p.rstyle;var bw=ele.pstyle("text-border-width").pfValue;var lw=preprop(rstyle,"labelWidth",prefix)+bw/2+2*th;var lh=preprop(rstyle,"labelHeight",prefix)+bw/2+2*th;var lx=preprop(rstyle,"labelX",prefix);var ly=preprop(rstyle,"labelY",prefix);var theta=preprop(_p.rscratch,"labelAngle",prefix);var cos=Math.cos(theta);var sin=Math.sin(theta);var rotate=function(x,y){x=x-lx;y=y-ly;return{x:x*cos-y*sin+lx,y:x*sin+y*cos+ly}};var lx1=lx-lw/2;var lx2=lx+lw/2;var ly1=ly-lh/2;var ly2=ly+lh/2;var px1y1=rotate(lx1,ly1);var px1y2=rotate(lx1,ly2);var px2y1=rotate(lx2,ly1);var px2y2=rotate(lx2,ly2);var points=[px1y1.x,px1y1.y,px2y1.x,px2y1.y,px2y2.x,px2y2.y,px1y2.x,px1y2.y];if(math.pointInsidePolygonPoints(x,y,points)){addEle(ele)}}else{var bb=ele.boundingBox({includeLabels:true,includeNodes:false,includeEdges:false});bb.x1-=th;bb.y1-=th;bb.x2+=th;bb.y2+=th;bb.w=bb.x2-bb.x1;bb.h=bb.y2-bb.y1;if(math.inBoundingBox(bb,x,y)){addEle(ele)}}}for(var i=eles.length-1;i>=0;i--){var ele=eles[i];if(ele.isNode()){checkNode(ele);checkLabel(ele)}else{checkEdge(ele);checkLabel(ele);checkLabel(ele,"source");checkLabel(ele,"target")}}return near};BRp.getAllInBox=function(x1,y1,x2,y2){var eles=this.getCachedZSortedEles();var nodes=eles.nodes;var edges=eles.edges;var box=[];var x1c=Math.min(x1,x2);var x2c=Math.max(x1,x2);var y1c=Math.min(y1,y2);var y2c=Math.max(y1,y2);x1=x1c;x2=x2c;y1=y1c;y2=y2c;var boxBb=math.makeBoundingBox({x1:x1,y1:y1,x2:x2,y2:y2});for(var i=0;i=offset||lastSeg){selected={cp:cp,segment:seg};break}}if(selected){break}}var cp=selected.cp;var seg=selected.segment;var tSegment=(offset-startDist)/seg.length;var segDt=seg.t1-seg.t0;var t=isSrc?seg.t0+segDt*tSegment:seg.t1-segDt*tSegment;t=math.bound(0,t,1);p=math.qbezierPtAt(cp.p0,cp.p1,cp.p2,t);angle=bezierAngle(cp.p0,cp.p1,cp.p2,t,p);break;case"straight":case"segments":case"haystack":var d=0,di,d0;var p0,p1;var l=rs.allpts.length;for(var i=0;i+3=offset){break}}var pD=offset-d0;var t=pD/di;t=math.bound(0,t,1);p=math.lineAt(p0,p1,t);angle=lineAngle(p0,p1);break}setRs("labelX",prefix,p.x);setRs("labelY",prefix,p.y);setRs("labelAutoAngle",prefix,angle)};calculateEndProjection("source");calculateEndProjection("target");this.applyLabelDimensions(edge)};BRp.applyLabelDimensions=function(ele){this.applyPrefixedLabelDimensions(ele);if(ele.isEdge()){this.applyPrefixedLabelDimensions(ele,"source");this.applyPrefixedLabelDimensions(ele,"target")}};BRp.applyPrefixedLabelDimensions=function(ele,prefix){var _p=ele._private;var text=this.getLabelText(ele,prefix);var labelDims=this.calculateLabelDimensions(ele,text);util.setPrefixedProperty(_p.rstyle,"labelWidth",prefix,labelDims.width);util.setPrefixedProperty(_p.rscratch,"labelWidth",prefix,labelDims.width);util.setPrefixedProperty(_p.rstyle,"labelHeight",prefix,labelDims.height);util.setPrefixedProperty(_p.rscratch,"labelHeight",prefix,labelDims.height)};BRp.getLabelText=function(ele,prefix){var _p=ele._private;var pfd=prefix?prefix+"-":"";var text=ele.pstyle(pfd+"label").strValue;var textTransform=ele.pstyle("text-transform").value;var rscratch=function(propName,value){if(value){util.setPrefixedProperty(_p.rscratch,propName,prefix,value);return value}else{return util.getPrefixedProperty(_p.rscratch,propName,prefix)}};if(textTransform=="none"){}else if(textTransform=="uppercase"){text=text.toUpperCase()}else if(textTransform=="lowercase"){text=text.toLowerCase()}if(ele.pstyle("text-wrap").value==="wrap"){var labelKey=rscratch("labelKey");if(labelKey&&rscratch("labelWrapKey")===labelKey){return rscratch("labelWrapCachedText")}var lines=text.split("\n");var maxW=ele.pstyle("text-max-width").pfValue;var wrappedLines=[];for(var l=0;lmaxW){var words=line.split(/\s+/);var subline="";for(var w=0;wtgtId?tgtId+"$-$"+srcId:srcId+"$-$"+tgtId;if(edgeIsUnbundled){pairId="unbundled"+"$-$"+data.id}if(hashTable[pairId]==null){hashTable[pairId]=[];pairIds.push(pairId)}hashTable[pairId].push(edge);if(edgeIsUnbundled){hashTable[pairId].hasUnbundled=true}}var src,tgt,src_p,tgt_p,srcPos,tgtPos,srcW,srcH,tgtW,tgtH,srcShape,tgtShape;var vectorNormInverse;var badBezier;for(var p=0;ptgt.id()){var temp=src;src=tgt;tgt=temp}src_p=src._private; -for(var i=layers.length-1;i>=0;i--){var layer=layers[i];if(layer.invalid){util.removeFromArray(layers,layer)}}};if(!lvlComplete){checkTempLevels()}else{return layers}var getBb=function(){if(!bb){bb=math.makeBoundingBox();for(var i=0;imaxLayerArea){return null}var layer=self.makeLayer(bb,lvl);if(after!=null){var index=layers.indexOf(after)+1;layers.splice(index,0,layer)}else if(opts.insert===undefined||opts.insert){layers.unshift(layer)}return layer};if(self.skipping&&!firstGet){return null}var layer=null;var maxElesPerLayer=eles.length/defNumLayers;var allowLazyQueueing=alwaysQueue&&!firstGet;for(var i=0;i=maxElesPerLayer||!math.boundingBoxInBoundingBox(layer.bb,ele.boundingBox())){layer=makeLayer({insert:true,after:layer});if(!layer){return null}}if(tmpLayers||allowLazyQueueing){self.queueLayer(layer,ele)}else{self.drawEleInLayer(layer,ele,lvl,pxRatio)}layer.eles.push(ele);caches[lvl]=layer}if(tmpLayers){return tmpLayers}if(allowLazyQueueing){return null}return layers};LTCp.getEleLevelForLayerLevel=function(lvl,pxRatio){return lvl};function imgSmoothing(context,bool){if(context.imageSmoothingEnabled!=null){context.imageSmoothingEnabled=bool}else{context.webkitImageSmoothingEnabled=bool;context.mozImageSmoothingEnabled=bool;context.msImageSmoothingEnabled=bool}}LTCp.drawEleInLayer=function(layer,ele,lvl,pxRatio){var self=this;var r=this.renderer;var context=layer.context;var bb=ele.boundingBox();if(bb.w===0||bb.h===0){return}var eleCache=self.eleTxrCache;var reason=useHighQualityEleTxrReqs?eleCache.reasons.highQuality:undefined;lvl=self.getEleLevelForLayerLevel(lvl,pxRatio);var cache=useEleTxrCaching?eleCache.getElement(ele,bb,null,lvl,reason):null;if(cache){if(disableEleImgSmoothing){imgSmoothing(context,false)}context.drawImage(cache.texture.canvas,cache.x,0,cache.width,cache.height,bb.x1,bb.y1,bb.w,bb.h);if(disableEleImgSmoothing){imgSmoothing(context,true)}}else{r.drawElement(context,ele)}};LTCp.levelIsComplete=function(lvl,eles){var self=this;var layers=self.layersByLevel[lvl];if(!layers||layers.length===0){return false}var numElesInLayers=0;for(var i=0;i0){return false}if(layer.invalid){return false}numElesInLayers+=layer.eles.length}if(numElesInLayers!==eles.length){return false}return true};LTCp.validateLayersElesOrdering=function(lvl,eles){var layers=this.layersByLevel[lvl];if(!layers){return}for(var i=0;i0){haveLayers=true;break}}return haveLayers};LTCp.invalidateElements=function(eles){var self=this;self.lastInvalidationTime=util.performanceNow();if(eles.length===0||!self.haveLayers()){return}self.updateElementsInLayers(eles,function invalAssocLayers(layer,ele,req){self.invalidateLayer(layer)})};LTCp.invalidateLayer=function(layer){this.lastInvalidationTime=util.performanceNow();if(layer.invalid){return}var lvl=layer.level;var eles=layer.eles;var layers=this.layersByLevel[lvl];util.removeFromArray(layers,layer);layer.elesQueue=[];layer.invalid=true;if(layer.replacement){layer.replacement.invalid=true}for(var i=0;i=opts.deqFastCost*timeAvailable){break}}else{if(willDraw){if(duration>=opts.deqCost*renderTime||duration>=opts.deqAvgCost*avgRenderTime){break}}else if(frameDuration>=opts.deqNoDrawCost*fullFpsTime){break}}var thisDeqd=opts.deq(self,pixelRatio,extent);if(thisDeqd.length>0){for(var i=0;i0){opts.onDeqd(self,deqd);if(!willDraw&&opts.shouldRedraw(self,deqd,pixelRatio,extent)){queueRedraw()}}};var priority=opts.priority||util.noop;r.beforeRender(dequeue,priority(self))}}}},{"../../../util":131}],109:[function(require,module,exports){"use strict";module.exports=[{name:"null",impl:require("./null")},{name:"base",impl:require("./base")},{name:"canvas",impl:require("./canvas")}]},{"./base":91,"./canvas":105,"./null":110}],110:[function(require,module,exports){"use strict";function NullRenderer(options){this.options=options;this.notifications=0}var noop=function(){};NullRenderer.prototype={recalculateRenderedStyle:noop,notify:function(){this.notifications++},init:noop};module.exports=NullRenderer},{}],111:[function(require,module,exports){"use strict";var is=require("./is");var util=require("./util");var Thread=require("./thread");var Promise=require("./promise");var define=require("./define");var Fabric=function(N){if(!(this instanceof Fabric)){return new Fabric(N)}this._private={pass:[]};var defN=4;if(is.number(N)){}if(typeof navigator!=="undefined"&&navigator.hardwareConcurrency!=null){N=navigator.hardwareConcurrency}else{try{N=require("os").cpus().length}catch(err){N=defN}}for(var i=0;ib){return 1}return 0};self.require(cmp,"_$_$_cmp");return self.spread(function(split){var sortedSplit=split.sort(_$_$_cmp);resolve(sortedSplit)}).then(function(joined){var merge=function(i,j,max){j=Math.min(j,P);max=Math.min(max,P);var l=i;var r=j;var sorted=[];for(var k=l;k=max||cmp(eleI,eleJ)<=0)){sorted.push(eleI);i++}else{sorted.push(eleJ);j++}}for(var k=0;ky){return 1}return 0};insort=function(a,x,lo,hi,cmp){var mid;if(lo==null){lo=0}if(cmp==null){cmp=defaultCmp}if(lo<0){throw new Error("lo must be non-negative")}if(hi==null){hi=a.length}while(lo_ref;0<=_ref?_j++:_j--){_results1.push(_j)}return _results1}.apply(this).reverse();_results=[];for(_i=0,_len=_ref1.length;_i<_len;_i++){i=_ref1[_i];_results.push(_siftup(array,i,cmp))}return _results};updateItem=function(array,item,cmp){var pos;if(cmp==null){cmp=defaultCmp}pos=array.indexOf(item);if(pos===-1){return}_siftdown(array,0,pos,cmp);return _siftup(array,pos,cmp)};nlargest=function(array,n,cmp){var elem,result,_i,_len,_ref;if(cmp==null){cmp=defaultCmp}result=array.slice(0,n);if(!result.length){return result}heapify(result,cmp);_ref=array.slice(n);for(_i=0,_len=_ref.length;_i<_len;_i++){elem=_ref[_i];heappushpop(result,elem,cmp)}return result.sort(cmp).reverse()};nsmallest=function(array,n,cmp){var elem,i,los,result,_i,_j,_len,_ref,_ref1,_results;if(cmp==null){cmp=defaultCmp}if(n*10<=array.length){result=array.slice(0,n).sort(cmp);if(!result.length){return result}los=result[result.length-1];_ref=array.slice(n);for(_i=0,_len=_ref.length;_i<_len;_i++){elem=_ref[_i];if(cmp(elem,los)<0){insort(result,elem,0,null,cmp);result.pop();los=result[result.length-1]}}return result}heapify(array,cmp);_results=[];for(i=_j=0,_ref1=min(n,array.length);0<=_ref1?_j<_ref1:_j>_ref1;i=0<=_ref1?++_j:--_j){_results.push(heappop(array,cmp))}return _results};_siftdown=function(array,startpos,pos,cmp){var newitem,parent,parentpos;if(cmp==null){cmp=defaultCmp}newitem=array[pos];while(pos>startpos){parentpos=pos-1>>1;parent=array[parentpos];if(cmp(newitem,parent)<0){array[pos]=parent;pos=parentpos;continue}break}return array[pos]=newitem};_siftup=function(array,pos,cmp){var childpos,endpos,newitem,rightpos,startpos;if(cmp==null){cmp=defaultCmp}endpos=array.length;startpos=pos;newitem=array[pos];childpos=2*pos+1;while(childpos0){return 1}else if(x<0){return-1}else{return 0}};math.dist=function(p1,p2){return Math.sqrt(math.sqdist(p1,p2))};math.sqdist=function(p1,p2){var dx=p2.x-p1.x;var dy=p2.y-p1.y;return dx*dx+dy*dy};math.qbezierAt=function(p0,p1,p2,t){return(1-t)*(1-t)*p0+2*(1-t)*t*p1+t*t*p2};math.qbezierPtAt=function(p0,p1,p2,t){return{x:math.qbezierAt(p0.x,p1.x,p2.x,t),y:math.qbezierAt(p0.y,p1.y,p2.y,t)}};math.lineAt=function(p0,p1,t,d){var vec={x:p1.x-p0.x,y:p1.y-p0.y};var vecDist=math.dist(p0,p1);var normVec={x:vec.x/vecDist,y:vec.y/vecDist};t=t==null?0:t;var d=d!=null?d:t*vecDist;return{x:p0.x+normVec.x*d,y:p0.y+normVec.y*d}};math.lineAtDist=function(p0,p1,d){return math.lineAt(p0,p1,undefined,d)};math.triangleAngle=function(A,B,C){var a=math.dist(B,C);var b=math.dist(A,C);var c=math.dist(A,B);return Math.acos((a*a+b*b-c*c)/(2*a*b))};math.bound=function(min,val,max){return Math.max(min,Math.min(max,val))};math.makeBoundingBox=function(bb){if(bb==null){return{x1:Infinity,y1:Infinity,x2:-Infinity,y2:-Infinity,w:0,h:0}}else if(bb.x1!=null&&bb.y1!=null){if(bb.x2!=null&&bb.y2!=null&&bb.x2>=bb.x1&&bb.y2>=bb.y1){return{x1:bb.x1,y1:bb.y1,x2:bb.x2,y2:bb.y2,w:bb.x2-bb.x1,h:bb.y2-bb.y1}}else if(bb.w!=null&&bb.h!=null&&bb.w>=0&&bb.h>=0){return{x1:bb.x1,y1:bb.y1,x2:bb.x1+bb.w,y2:bb.y1+bb.h,w:bb.w,h:bb.h}}}};math.updateBoundingBox=function(bb1,bb2){bb1.x1=Math.min(bb1.x1,bb2.x1);bb1.x2=Math.max(bb1.x2,bb2.x2);bb1.w=bb1.x2-bb1.x1;bb1.y1=Math.min(bb1.y1,bb2.y1);bb1.y2=Math.max(bb1.y2,bb2.y2);bb1.h=bb1.y2-bb1.y1};math.expandBoundingBox=function(bb,padding){bb.x1-=padding;bb.x2+=padding;bb.y1-=padding;bb.y2+=padding;bb.w=bb.x2-bb.x1;bb.h=bb.y2-bb.y1;return bb};math.boundingBoxesIntersect=function(bb1,bb2){if(bb1.x1>bb2.x2){return false}if(bb2.x1>bb1.x2){return false}if(bb1.x2bb2.y2){return false}if(bb2.y1>bb1.y2){return false}return true};math.inBoundingBox=function(bb,x,y){return bb.x1<=x&&x<=bb.x2&&bb.y1<=y&&y<=bb.y2};math.pointInBoundingBox=function(bb,pt){return this.inBoundingBox(bb,pt.x,pt.y)};math.boundingBoxInBoundingBox=function(bb1,bb2){return math.inBoundingBox(bb1,bb2.x1,bb2.y1)&&math.inBoundingBox(bb1,bb2.x2,bb2.y2)};math.roundRectangleIntersectLine=function(x,y,nodeX,nodeY,width,height,padding){var cornerRadius=this.getRoundRectangleRadius(width,height);var halfWidth=width/2;var halfHeight=height/2;var straightLineIntersections;{var topStartX=nodeX-halfWidth+cornerRadius-padding;var topStartY=nodeY-halfHeight-padding;var topEndX=nodeX+halfWidth-cornerRadius+padding;var topEndY=topStartY;straightLineIntersections=this.finiteLinesIntersect(x,y,nodeX,nodeY,topStartX,topStartY,topEndX,topEndY,false);if(straightLineIntersections.length>0){return straightLineIntersections}}{var rightStartX=nodeX+halfWidth+padding;var rightStartY=nodeY-halfHeight+cornerRadius-padding;var rightEndX=rightStartX;var rightEndY=nodeY+halfHeight-cornerRadius+padding;straightLineIntersections=this.finiteLinesIntersect(x,y,nodeX,nodeY,rightStartX,rightStartY,rightEndX,rightEndY,false);if(straightLineIntersections.length>0){return straightLineIntersections}}{var bottomStartX=nodeX-halfWidth+cornerRadius-padding;var bottomStartY=nodeY+halfHeight+padding;var bottomEndX=nodeX+halfWidth-cornerRadius+padding;var bottomEndY=bottomStartY;straightLineIntersections=this.finiteLinesIntersect(x,y,nodeX,nodeY,bottomStartX,bottomStartY,bottomEndX,bottomEndY,false);if(straightLineIntersections.length>0){return straightLineIntersections}}{var leftStartX=nodeX-halfWidth-padding;var leftStartY=nodeY-halfHeight+cornerRadius-padding;var leftEndX=leftStartX;var leftEndY=nodeY+halfHeight-cornerRadius+padding;straightLineIntersections=this.finiteLinesIntersect(x,y,nodeX,nodeY,leftStartX,leftStartY,leftEndX,leftEndY,false);if(straightLineIntersections.length>0){return straightLineIntersections}}var arcIntersections;{var topLeftCenterX=nodeX-halfWidth+cornerRadius;var topLeftCenterY=nodeY-halfHeight+cornerRadius;arcIntersections=this.intersectLineCircle(x,y,nodeX,nodeY,topLeftCenterX,topLeftCenterY,cornerRadius+padding);if(arcIntersections.length>0&&arcIntersections[0]<=topLeftCenterX&&arcIntersections[1]<=topLeftCenterY){return[arcIntersections[0],arcIntersections[1]]}}{var topRightCenterX=nodeX+halfWidth-cornerRadius;var topRightCenterY=nodeY-halfHeight+cornerRadius;arcIntersections=this.intersectLineCircle(x,y,nodeX,nodeY,topRightCenterX,topRightCenterY,cornerRadius+padding);if(arcIntersections.length>0&&arcIntersections[0]>=topRightCenterX&&arcIntersections[1]<=topRightCenterY){return[arcIntersections[0],arcIntersections[1]]}}{var bottomRightCenterX=nodeX+halfWidth-cornerRadius;var bottomRightCenterY=nodeY+halfHeight-cornerRadius;arcIntersections=this.intersectLineCircle(x,y,nodeX,nodeY,bottomRightCenterX,bottomRightCenterY,cornerRadius+padding);if(arcIntersections.length>0&&arcIntersections[0]>=bottomRightCenterX&&arcIntersections[1]>=bottomRightCenterY){return[arcIntersections[0],arcIntersections[1]]}}{var bottomLeftCenterX=nodeX-halfWidth+cornerRadius;var bottomLeftCenterY=nodeY+halfHeight-cornerRadius;arcIntersections=this.intersectLineCircle(x,y,nodeX,nodeY,bottomLeftCenterX,bottomLeftCenterY,cornerRadius+padding);if(arcIntersections.length>0&&arcIntersections[0]<=bottomLeftCenterX&&arcIntersections[1]>=bottomLeftCenterY){return[arcIntersections[0],arcIntersections[1]]}}return[]};math.inLineVicinity=function(x,y,lx1,ly1,lx2,ly2,tolerance){var t=tolerance;var x1=Math.min(lx1,lx2);var x2=Math.max(lx1,lx2);var y1=Math.min(ly1,ly2);var y2=Math.max(ly1,ly2);return x1-t<=x&&x<=x2+t&&y1-t<=y&&y<=y2+t};math.inBezierVicinity=function(x,y,x1,y1,x2,y2,x3,y3,tolerance){var bb={x1:Math.min(x1,x3,x2)-tolerance,x2:Math.max(x1,x3,x2)+tolerance,y1:Math.min(y1,y3,y2)-tolerance,y2:Math.max(y1,y3,y2)+tolerance};if(xbb.x2||ybb.y2){return false}else{return true}};math.solveCubic=function(a,b,c,d,result){b/=a;c/=a;d/=a;var discriminant,q,r,dum1,s,t,term1,r13;q=(3*c-b*b)/9;r=-(27*d)+b*(9*c-2*(b*b));r/=54;discriminant=q*q*q+r*r;result[1]=0;term1=b/3;if(discriminant>0){s=r+Math.sqrt(discriminant);s=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3);t=r-Math.sqrt(discriminant);t=t<0?-Math.pow(-t,1/3):Math.pow(t,1/3);result[0]=-term1+s+t;term1+=(s+t)/2;result[4]=result[2]=-term1;term1=Math.sqrt(3)*(-t+s)/2;result[3]=term1;result[5]=-term1;return}result[5]=result[3]=0;if(discriminant===0){r13=r<0?-Math.pow(-r,1/3):Math.pow(r,1/3);result[0]=-term1+2*r13;result[4]=result[2]=-(r13+term1);return}q=-q;dum1=q*q*q;dum1=Math.acos(r/Math.sqrt(dum1));r13=2*Math.sqrt(q);result[0]=-term1+r13*Math.cos(dum1/3);result[2]=-term1+r13*Math.cos((dum1+2*Math.PI)/3);result[4]=-term1+r13*Math.cos((dum1+4*Math.PI)/3);return};math.sqdistToQuadraticBezier=function(x,y,x1,y1,x2,y2,x3,y3){var a=1*x1*x1-4*x1*x2+2*x1*x3+4*x2*x2-4*x2*x3+x3*x3+y1*y1-4*y1*y2+2*y1*y3+4*y2*y2-4*y2*y3+y3*y3;var b=1*9*x1*x2-3*x1*x1-3*x1*x3-6*x2*x2+3*x2*x3+9*y1*y2-3*y1*y1-3*y1*y3-6*y2*y2+3*y2*y3;var c=1*3*x1*x1-6*x1*x2+x1*x3-x1*x+2*x2*x2+2*x2*x-x3*x+3*y1*y1-6*y1*y2+y1*y3-y1*y+2*y2*y2+2*y2*y-y3*y;var d=1*x1*x2-x1*x1+x1*x-x2*x+y1*y2-y1*y1+y1*y-y2*y;var roots=[];this.solveCubic(a,b,c,d,roots);var zeroThreshold=1e-7;var params=[];for(var index=0;index<6;index+=2){if(Math.abs(roots[index+1])=0&&roots[index]<=1){params.push(roots[index])}}params.push(1);params.push(0);var minDistanceSquared=-1;var closestParam;var curX,curY,distSquared;for(var i=0;i=0){if(distSquared1&&src!==tgt||pairEdges.hasUnbundled){var srcOutside=srcShape.intersectLine(srcPos.x,srcPos.y,srcW,srcH,tgtPos.x,tgtPos.y,0);var tgtOutside=tgtShape.intersectLine(tgtPos.x,tgtPos.y,tgtW,tgtH,srcPos.x,srcPos.y,0);var midptSrcPts={x1:srcOutside[0],x2:tgtOutside[0],y1:srcOutside[1],y2:tgtOutside[1]};var posPts={x1:srcPos.x,x2:tgtPos.x,y1:srcPos.y,y2:tgtPos.y};var dy=tgtOutside[1]-srcOutside[1];var dx=tgtOutside[0]-srcOutside[0];var l=Math.sqrt(dx*dx+dy*dy);var vector={x:dx,y:dy};var vectorNorm={x:vector.x/l,y:vector.y/l};vectorNormInverse={x:-vectorNorm.y,y:vectorNorm.x};if(tgtShape.checkPoint(srcOutside[0],srcOutside[1],0,tgtW,tgtH,tgtPos.x,tgtPos.y)&&srcShape.checkPoint(tgtOutside[0],tgtOutside[1],0,srcW,srcH,srcPos.x,srcPos.y)){vectorNormInverse={};badBezier=true}}var edge;var edge_p;var rs;for(var i=0;icontainerPageCoords[0]&&e.clientXcontainerPageCoords[1]&&e.clientY=r.desktopTapThreshold2}var multSelKeyDown=isMultSelKeyDown(e);if(isOverThresholdDrag){r.hoverData.tapholdCancelled=true}var updateDragDelta=function(){var dragDelta=r.hoverData.dragDelta=r.hoverData.dragDelta||[];if(dragDelta.length===0){dragDelta.push(disp[0]);dragDelta.push(disp[1])}else{dragDelta[0]+=disp[0];dragDelta[1]+=disp[1]}};preventDefault=true;triggerEvents(near,["mousemove","vmousemove","tapdrag"],e,{cyPosition:{x:pos[0],y:pos[1]}});if(r.hoverData.which===3){if(isOverThresholdDrag){var cxtEvt=new Event(e,{type:"cxtdrag",cyPosition:{x:pos[0],y:pos[1]}});if(down){down.trigger(cxtEvt)}else{cy.trigger(cxtEvt)}r.hoverData.cxtDragged=true;if(!r.hoverData.cxtOver||near!==r.hoverData.cxtOver){if(r.hoverData.cxtOver){r.hoverData.cxtOver.trigger(new Event(e,{type:"cxtdragout",cyPosition:{x:pos[0],y:pos[1]}}))}r.hoverData.cxtOver=near;if(near){near.trigger(new Event(e,{type:"cxtdragover",cyPosition:{x:pos[0],y:pos[1]}}))}}}}else if(r.hoverData.dragging){preventDefault=true;if(cy.panningEnabled()&&cy.userPanningEnabled()){var deltaP;if(r.hoverData.justStartedPan){var mdPos=r.hoverData.mdownPos;deltaP={x:(pos[0]-mdPos[0])*zoom,y:(pos[1]-mdPos[1])*zoom};r.hoverData.justStartedPan=false}else{deltaP={x:disp[0]*zoom,y:disp[1]*zoom}}cy.panBy(deltaP);r.hoverData.dragged=true}pos=r.projectIntoViewport(e.clientX,e.clientY)}else if(select[4]==1&&(down==null||down.isEdge())){if(isOverThresholdDrag){if(!r.hoverData.dragging&&cy.boxSelectionEnabled()&&(multSelKeyDown||!cy.panningEnabled()||!cy.userPanningEnabled())){r.data.bgActivePosistion=undefined;if(!r.hoverData.selecting){cy.trigger("boxstart")}r.hoverData.selecting=true;r.redrawHint("select",true);r.redraw()}else if(!r.hoverData.selecting&&cy.panningEnabled()&&cy.userPanningEnabled()){var allowPassthrough=allowPanningPassthrough(down,r.hoverData.downs);if(allowPassthrough){r.hoverData.dragging=true;r.hoverData.justStartedPan=true;select[4]=0;r.data.bgActivePosistion=math.array2point(mdownPos);r.redrawHint("select",true);r.redraw()}}if(down&&down.isEdge()&&down.active()){down.unactivate()}}}else{if(down&&down.isEdge()&&down.active()){down.unactivate()}if((!down||!down.grabbed())&&near!=last){if(last){triggerEvents(last,["mouseout","tapdragout"],e,{cyPosition:{x:pos[0],y:pos[1]}})}if(near){triggerEvents(near,["mouseover","tapdragover"],e,{cyPosition:{x:pos[0],y:pos[1]}})}r.hoverData.last=near}if(down&&r.nodeIsDraggable(down)){if(isOverThresholdDrag){var justStartedDrag=!r.dragData.didDrag;if(justStartedDrag){r.redrawHint("eles",true)}r.dragData.didDrag=true;var toTrigger=[];if(!r.hoverData.draggingEles){addNodesToDrag(cy.collection(draggedElements),{inDragLayer:true})}for(var i=0;i0){r.redrawHint("eles",true)}r.dragData.possibleDragElements=draggedElements=[]}triggerEvents(near,["mouseup","tapend","vmouseup"],e,{cyPosition:{x:pos[0],y:pos[1]}});if(!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting){triggerEvents(down,["click","tap","vclick"],e,{cyPosition:{x:pos[0],y:pos[1]}})}if(near==down&&!r.dragData.didDrag&&!r.hoverData.selecting){if(near!=null&&near._private.selectable){if(r.hoverData.dragging){}else if(cy.selectionType()==="additive"||multSelKeyDown){if(near.selected()){near.unselect()}else{near.select()}}else{if(!multSelKeyDown){cy.$(":selected").unmerge(near).unselect();near.select()}}r.redrawHint("eles",true)}}if(r.hoverData.selecting){var box=cy.collection(r.getAllInBox(select[0],select[1],select[2],select[3]));r.redrawHint("select",true);if(box.length>0){r.redrawHint("eles",true)}cy.trigger("boxend");var eleWouldBeSelected=function(ele){return ele.selectable()&&!ele.selected()};if(cy.selectionType()==="additive"){box.trigger("box").stdFilter(eleWouldBeSelected).select().trigger("boxselect")}else{if(!multSelKeyDown){cy.$(":selected").unmerge(box).unselect()}box.trigger("box").stdFilter(eleWouldBeSelected).select().trigger("boxselect")}r.redraw()}if(r.hoverData.dragging){r.hoverData.dragging=false;r.redrawHint("select",true);r.redrawHint("eles",true);r.redraw()}if(!select[4]){r.redrawHint("drag",true);r.redrawHint("eles",true);var downWasGrabbed=down&&down.grabbed();freeDraggedElements(draggedElements);if(downWasGrabbed){down.trigger("free")}}}select[4]=0;r.hoverData.down=null;r.hoverData.cxtStarted=false;r.hoverData.draggingEles=false;r.hoverData.selecting=false;r.dragData.didDrag=false;r.hoverData.dragged=false;r.hoverData.dragDelta=[];r.hoverData.mdownPos=null;r.hoverData.mdownGPos=null},false);var wheelHandler=function(e){if(r.scrollingPage){return}var cy=r.cy;var pos=r.projectIntoViewport(e.clientX,e.clientY);var rpos=[pos[0]*cy.zoom()+cy.pan().x,pos[1]*cy.zoom()+cy.pan().y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||inBoxSelection()){e.preventDefault();return}if(cy.panningEnabled()&&cy.userPanningEnabled()&&cy.zoomingEnabled()&&cy.userZoomingEnabled()){e.preventDefault();r.data.wheelZooming=true;clearTimeout(r.data.wheelTimeout);r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=false;r.redrawHint("eles",true);r.redraw()},150);var diff;if(e.deltaY!=null){diff=e.deltaY/-250}else if(e.wheelDeltaY!=null){diff=e.wheelDeltaY/1e3}else{diff=e.wheelDelta/1e3}diff=diff*r.wheelSensitivity;var needsWheelFix=e.deltaMode===1;if(needsWheelFix){diff*=33}cy.zoom({level:cy.zoom()*Math.pow(10,diff),renderedPosition:{x:rpos[0],y:rpos[1]}})}};r.registerBinding(r.container,"wheel",wheelHandler,true);r.registerBinding(window,"scroll",function scrollHandler(e){r.scrollingPage=true;clearTimeout(r.scrollingPageTimeout);r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=false},250)},true);r.registerBinding(r.container,"mouseout",function mouseOutHandler(e){var pos=r.projectIntoViewport(e.clientX,e.clientY);r.cy.trigger(new Event(e,{type:"mouseout",cyPosition:{x:pos[0],y:pos[1]}}))},false);r.registerBinding(r.container,"mouseover",function mouseOverHandler(e){var pos=r.projectIntoViewport(e.clientX,e.clientY);r.cy.trigger(new Event(e,{type:"mouseover",cyPosition:{x:pos[0],y:pos[1]}}))},false);var f1x1,f1y1,f2x1,f2y1;var distance1,distance1Sq;var center1,modelCenter1;var offsetLeft,offsetTop;var containerWidth,containerHeight;var twoFingersStartInside;var distance=function(x1,y1,x2,y2){return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))};var distanceSq=function(x1,y1,x2,y2){return(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)};var touchstartHandler;r.registerBinding(r.container,"touchstart",touchstartHandler=function(e){r.touchData.capture=true;r.data.bgActivePosistion=undefined;var cy=r.cy;var now=r.touchData.now;var earlier=r.touchData.earlier;if(e.touches[0]){var pos=r.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);now[0]=pos[0];now[1]=pos[1]}if(e.touches[1]){var pos=r.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);now[2]=pos[0];now[3]=pos[1]}if(e.touches[2]){var pos=r.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);now[4]=pos[0];now[5]=pos[1]}if(e.touches[1]){freeDraggedElements(r.dragData.touchDragEles);var offsets=r.findContainerClientCoords();offsetLeft=offsets[0];offsetTop=offsets[1];containerWidth=offsets[2];containerHeight=offsets[3];f1x1=e.touches[0].clientX-offsetLeft;f1y1=e.touches[0].clientY-offsetTop;f2x1=e.touches[1].clientX-offsetLeft;f2y1=e.touches[1].clientY-offsetTop;twoFingersStartInside=0<=f1x1&&f1x1<=containerWidth&&0<=f2x1&&f2x1<=containerWidth&&0<=f1y1&&f1y1<=containerHeight&&0<=f2y1&&f2y1<=containerHeight;var pan=cy.pan();var zoom=cy.zoom();distance1=distance(f1x1,f1y1,f2x1,f2y1);distance1Sq=distanceSq(f1x1,f1y1,f2x1,f2y1);center1=[(f1x1+f2x1)/2,(f1y1+f2y1)/2];modelCenter1=[(center1[0]-pan.x)/zoom,(center1[1]-pan.y)/zoom];var cxtDistThreshold=200;var cxtDistThresholdSq=cxtDistThreshold*cxtDistThreshold;if(distance1Sq=r.touchTapThreshold2}if(capture&&r.touchData.cxt){e.preventDefault();var f1x2=e.touches[0].clientX-offsetLeft,f1y2=e.touches[0].clientY-offsetTop;var f2x2=e.touches[1].clientX-offsetLeft,f2y2=e.touches[1].clientY-offsetTop;var distance2Sq=distanceSq(f1x2,f1y2,f2x2,f2y2);var factorSq=distance2Sq/distance1Sq;var distThreshold=150;var distThresholdSq=distThreshold*distThreshold;var factorThreshold=1.5;var factorThresholdSq=factorThreshold*factorThreshold;if(factorSq>=factorThresholdSq||distance2Sq>=distThresholdSq){r.touchData.cxt=false;if(r.touchData.start){r.touchData.start.unactivate();r.touchData.start=null}r.data.bgActivePosistion=undefined;r.redrawHint("select",true);var cxtEvt=new Event(e,{type:"cxttapend",cyPosition:{x:now[0],y:now[1]}});if(r.touchData.start){r.touchData.start.trigger(cxtEvt)}else{cy.trigger(cxtEvt)}}}if(capture&&r.touchData.cxt){var cxtEvt=new Event(e,{type:"cxtdrag",cyPosition:{x:now[0],y:now[1]}});r.data.bgActivePosistion=undefined;r.redrawHint("select",true);if(r.touchData.start){r.touchData.start.trigger(cxtEvt)}else{cy.trigger(cxtEvt)}if(r.touchData.start){r.touchData.start._private.grabbed=false}r.touchData.cxtDragged=true;var near=r.findNearestElement(now[0],now[1],true,true);if(!r.touchData.cxtOver||near!==r.touchData.cxtOver){if(r.touchData.cxtOver){r.touchData.cxtOver.trigger(new Event(e,{type:"cxtdragout",cyPosition:{x:now[0],y:now[1]}}))}r.touchData.cxtOver=near;if(near){near.trigger(new Event(e,{type:"cxtdragover",cyPosition:{x:now[0],y:now[1]}}))}}}else if(capture&&e.touches[2]&&cy.boxSelectionEnabled()){e.preventDefault();r.data.bgActivePosistion=undefined;this.lastThreeTouch=+new Date;if(!r.touchData.selecting){cy.trigger("boxstart")}r.touchData.selecting=true;r.redrawHint("select",true);if(!select||select.length===0||select[0]===undefined){select[0]=(now[0]+now[2]+now[4])/3;select[1]=(now[1]+now[3]+now[5])/3;select[2]=(now[0]+now[2]+now[4])/3+1;select[3]=(now[1]+now[3]+now[5])/3+1}else{select[2]=(now[0]+now[2]+now[4])/3;select[3]=(now[1]+now[3]+now[5])/3}select[4]=1;r.touchData.selecting=true;r.redraw()}else if(capture&&e.touches[1]&&cy.zoomingEnabled()&&cy.panningEnabled()&&cy.userZoomingEnabled()&&cy.userPanningEnabled()){e.preventDefault();r.data.bgActivePosistion=undefined;r.redrawHint("select",true);var draggedEles=r.dragData.touchDragEles;if(draggedEles){r.redrawHint("drag",true);for(var i=0;ilineSq){return(x-x2)*(x-x2)+(y-y2)*(y-y2)}return hypSq-adjSq};math.pointInsidePolygonPoints=function(x,y,points){var x1,y1,x2,y2;var y3;var up=0;var down=0;for(var i=0;i=x&&x>=x2||x1<=x&&x<=x2){y3=(x-x1)/(x2-x1)*(y2-y1)+y1;if(y3>y){up++}if(y30){var expandedLineSet=this.expandPolygon(transformedPoints,-padding);points=this.joinLines(expandedLineSet)}else{points=transformedPoints}return math.pointInsidePolygonPoints(x,y,points)};math.joinLines=function(lineSet){var vertices=new Array(lineSet.length/2);var currentLineStartX,currentLineStartY,currentLineEndX,currentLineEndY;var nextLineStartX,nextLineStartY,nextLineEndX,nextLineEndY;for(var i=0;i=0&&tMin<=1){inRangeParams.push(tMin)}if(tMax>=0&&tMax<=1){inRangeParams.push(tMax)}if(inRangeParams.length===0){return[]}var nearIntersectionX=inRangeParams[0]*d[0]+x1;var nearIntersectionY=inRangeParams[0]*d[1]+y1;if(inRangeParams.length>1){if(inRangeParams[0]==inRangeParams[1]){return[nearIntersectionX,nearIntersectionY]}else{var farIntersectionX=inRangeParams[1]*d[0]+x1;var farIntersectionY=inRangeParams[1]*d[1]+y1;return[nearIntersectionX,nearIntersectionY,farIntersectionX,farIntersectionY]}}else{return[nearIntersectionX,nearIntersectionY]}};math.findCircleNearPoint=function(centerX,centerY,radius,farX,farY){var displacementX=farX-centerX;var displacementY=farY-centerY;var distance=Math.sqrt(displacementX*displacementX+displacementY*displacementY);var unitDisplacementX=displacementX/distance;var unitDisplacementY=displacementY/distance;return[centerX+unitDisplacementX*radius,centerY+unitDisplacementY*radius]};math.findMaxSqDistanceToOrigin=function(points){var maxSqDistance=1e-6;var sqDistance;for(var i=0;imaxSqDistance){maxSqDistance=sqDistance}}return maxSqDistance};math.midOfThree=function(a,b,c){if(b<=a&&a<=c||c<=a&&a<=b){return a}else if(a<=b&&b<=c||c<=b&&b<=a){return b}else{return c}};math.finiteLinesIntersect=function(x1,y1,x2,y2,x3,y3,x4,y4,infiniteLines){var dx13=x1-x3;var dx21=x2-x1;var dx43=x4-x3;var dy13=y1-y3;var dy21=y2-y1;var dy43=y4-y3;var ua_t=dx43*dy13-dy43*dx13;var ub_t=dx21*dy13-dy21*dx13;var u_b=dy43*dx21-dx43*dy21;if(u_b!==0){var ua=ua_t/u_b;var ub=ub_t/u_b;var flptThreshold=.001;var min=0-flptThreshold;var max=1+flptThreshold;if(min<=ua&&ua<=max&&min<=ub&&ub<=max){return[x1+ua*dx21,y1+ua*dy21]}else{if(!infiniteLines){return[]}else{return[x1+ua*dx21,y1+ua*dy21]}}}else{if(ua_t===0||ub_t===0){if(this.midOfThree(x1,x2,x4)===x4){return[x4,y4]}if(this.midOfThree(x1,x2,x3)===x3){return[x3,y3]}if(this.midOfThree(x3,x4,x2)===x2){return[x2,y2]}return[]}else{return[]}}};math.polygonIntersectLine=function(x,y,basePoints,centerX,centerY,width,height,padding){var intersections=[];var intersection;var transformedPoints=new Array(basePoints.length);for(var i=0;i0){var expandedLineSet=math.expandPolygon(transformedPoints,-padding);points=math.joinLines(expandedLineSet)}else{points=transformedPoints}var currentX,currentY,nextX,nextY;for(var i=0;i\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:'"(?:\\\\"|[^"])+"'+"|"+"'(?:\\\\'|[^'])+'",number:util.regex.number,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$"};tokens.variable="(?:[\\w-]|(?:\\\\"+tokens.metaChar+"))+";tokens.value=tokens.string+"|"+tokens.number;tokens.className=tokens.variable;tokens.id=tokens.variable;var cleanMetaChars=function(str){return str.replace(new RegExp("\\\\("+tokens.metaChar+")","g"),function(match,$1,offset,original){return $1})};var ops=tokens.comparatorOp.split("|");for(var i=0;i=0){continue}if(op==="="){continue}tokens.comparatorOp+="|\\!"+op}var exprs=[{name:"group",query:true,regex:"(node|edge|\\*)",populate:function(group){this.group=group==="*"?group:group+"s"}},{name:"state",query:true,regex:"(:selected|:unselected|:locked|:unlocked|:visible|:hidden|:transparent|:grabbed|:free|:removed|:inside|:grabbable|:ungrabbable|:animated|:unanimated|:selectable|:unselectable|:orphan|:nonorphan|:parent|:child|:loop|:simple|:active|:inactive|:touch|:backgrounding|:nonbackgrounding)",populate:function(state){this.colonSelectors.push(state)}},{name:"id",query:true,regex:"\\#("+tokens.id+")",populate:function(id){this.ids.push(cleanMetaChars(id))}},{name:"className",query:true,regex:"\\.("+tokens.className+")",populate:function(className){this.classes.push(cleanMetaChars(className))}},{name:"dataExists",query:true,regex:"\\[\\s*("+tokens.variable+")\\s*\\]",populate:function(variable){this.data.push({field:cleanMetaChars(variable)})}},{name:"dataCompare",query:true,regex:"\\[\\s*("+tokens.variable+")\\s*("+tokens.comparatorOp+")\\s*("+tokens.value+")\\s*\\]",populate:function(variable,comparatorOp,value){var valueIsString=new RegExp("^"+tokens.string+"$").exec(value)!=null;if(valueIsString){value=value.substring(1,value.length-1)}else{value=parseFloat(value)}this.data.push({field:cleanMetaChars(variable),operator:comparatorOp,value:value})}},{name:"dataBool",query:true,regex:"\\[\\s*("+tokens.boolOp+")\\s*("+tokens.variable+")\\s*\\]",populate:function(boolOp,variable){this.data.push({field:cleanMetaChars(variable),operator:boolOp})}},{name:"metaCompare",query:true,regex:"\\[\\[\\s*("+tokens.meta+")\\s*("+tokens.comparatorOp+")\\s*("+tokens.number+")\\s*\\]\\]",populate:function(meta,comparatorOp,number){this.meta.push({field:cleanMetaChars(meta),operator:comparatorOp,value:parseFloat(number)})}},{name:"nextQuery",separator:true,regex:tokens.separator,populate:function(){self[++i]=newQuery();currentSubject=null}},{name:"child",separator:true,regex:tokens.child,populate:function(){var childQuery=newQuery();childQuery.parent=this;childQuery.subject=currentSubject;self[i]=childQuery}},{name:"descendant",separator:true,regex:tokens.descendant,populate:function(){var descendantQuery=newQuery();descendantQuery.ancestor=this;descendantQuery.subject=currentSubject;self[i]=descendantQuery}},{name:"subject",modifier:true,regex:tokens.subject,populate:function(){if(currentSubject!=null&&this.subject!=this){util.error("Redefinition of subject in selector `"+selector+"`");return false}currentSubject=this;this.subject=this}}];self._private.selectorText=selector;var remaining=selector;var i=0;var consumeExpr=function(expectation){var expr;var match;var name;for(var j=0;j=0){fieldStr=fieldStr.toLowerCase();valStr=valStr.toLowerCase();operator=operator.replace("@","");caseInsensitive=true}var notExpr=false;if(operator.indexOf("!")>=0){operator=operator.replace("!","");notExpr=true}if(caseInsensitive){value=valStr.toLowerCase();fieldVal=fieldStr.toLowerCase()}var isIneqCmp=false;switch(operator){case"*=":matches=fieldStr.indexOf(valStr)>=0;break;case"$=":matches=fieldStr.indexOf(valStr,fieldStr.length-valStr.length)>=0;break;case"^=":matches=fieldStr.indexOf(valStr)===0;break;case"=":matches=fieldVal===value;break;case">":isIneqCmp=true;matches=fieldVal>value;break;case">=":isIneqCmp=true;matches=fieldVal>=value;break;case"<":isIneqCmp=true;matches=fieldVal "+str}if(query.ancestor!=null){str=queryToString(query.ancestor)+" "+str}if(query.child!=null){str+=" > "+queryToString(query.child)}if(query.descendant!=null){str+=" "+queryToString(query.descendant)}return str};for(var i=0;i1&&i0;if(cxtHasDiffed||cxtHasMappedProps){var props;if(cxtHasDiffed&&cxtHasMappedProps){props=cxt.properties}else if(cxtHasDiffed){props=cxt.properties}else if(cxtHasMappedProps){props=cxt.mappedProperties}for(var j=0;j0){hasPie=true;break}}}_p.hasPie=hasPie;var transform=ele.pstyle("text-transform").strValue;var content=ele.pstyle("label").strValue;var srcContent=ele.pstyle("source-label").strValue;var tgtContent=ele.pstyle("target-label").strValue;var fStyle=ele.pstyle("font-style").strValue;var size=ele.pstyle("font-size").pfValue+"px";var family=ele.pstyle("font-family").strValue;var weight=ele.pstyle("font-weight").strValue;var valign=ele.pstyle("text-valign").strValue;var halign=ele.pstyle("text-valign").strValue;var oWidth=ele.pstyle("text-outline-width").pfValue;var wrap=ele.pstyle("text-wrap").strValue;var wrapW=ele.pstyle("text-max-width").pfValue;var labelStyleKey=fStyle+"$"+size+"$"+family+"$"+weight+"$"+transform+"$"+valign+"$"+halign+"$"+oWidth+"$"+wrap+"$"+wrapW;_p.labelStyleKey=labelStyleKey;_p.sourceLabelKey=labelStyleKey+"$"+srcContent;_p.targetLabelKey=labelStyleKey+"$"+tgtContent;_p.labelKey=labelStyleKey+"$"+content;_p.fontKey=fStyle+"$"+weight+"$"+size+"$"+family;_p.styleKey=Date.now()};styfn.applyParsedProperty=function(ele,parsedProp){var self=this;var prop=parsedProp;var style=ele._private.style;var fieldVal,flatProp;var types=self.types;var type=self.properties[prop.name].type;var propIsBypass=prop.bypass;var origProp=style[prop.name];var origPropIsBypass=origProp&&origProp.bypass;var _p=ele._private;if(parsedProp.name==="curve-style"&&parsedProp.value==="haystack"&&ele.isEdge()&&(ele.isLoop()||ele.source().isParent()||ele.target().isParent())){prop=parsedProp=this.parse(parsedProp.name,"bezier",propIsBypass)}if(prop.delete){style[prop.name]=undefined;return true}if(prop.deleteBypassed){if(!origProp){return true}else if(origProp.bypass){origProp.bypassed=undefined;return true}else{return false}}if(prop.deleteBypass){if(!origProp){return true}else if(origProp.bypass){style[prop.name]=origProp.bypassed;return true}else{return false}}var printMappingErr=function(){util.error("Do not assign mappings to elements without corresponding data (e.g. ele `"+ele.id()+"` for property `"+prop.name+"` with data field `"+prop.field+"`); try a `["+prop.field+"]` selector to limit scope to elements with `"+prop.field+"` defined")};switch(prop.mapped){case types.mapData:case types.mapLayoutData:case types.mapScratch:var isLayout=prop.mapped===types.mapLayoutData;var isScratch=prop.mapped===types.mapScratch;var fields=prop.field.split(".");var fieldVal;if(isScratch||isLayout){fieldVal=_p.scratch}else{fieldVal=_p.data}for(var i=0;i1){percent=1}if(type.color){var r1=prop.valueMin[0];var r2=prop.valueMax[0];var g1=prop.valueMin[1];var g2=prop.valueMax[1];var b1=prop.valueMin[2];var b2=prop.valueMax[2];var a1=prop.valueMin[3]==null?1:prop.valueMin[3];var a2=prop.valueMax[3]==null?1:prop.valueMax[3];var clr=[Math.round(r1+(r2-r1)*percent),Math.round(g1+(g2-g1)*percent),Math.round(b1+(b2-b1)*percent),Math.round(a1+(a2-a1)*percent)];flatProp={bypass:prop.bypass,name:prop.name,value:clr,strValue:"rgb("+clr[0]+", "+clr[1]+", "+clr[2]+")"}}else if(type.number){var calcValue=prop.valueMin+(prop.valueMax-prop.valueMin)*percent;flatProp=this.parse(prop.name,calcValue,prop.bypass,true)}else{return false; +}}if(context.beginPath){context.beginPath()}if(!pathCacheHit){shapeImpl.draw(context,size,angle,translation)}if(!shapeImpl.leavePathOpen&&context.closePath){context.closePath()}context=canvasContext;if(fill==="filled"||fill==="both"){if(usePaths){context.fill(path)}else{context.fill()}}if(fill==="hollow"||fill==="both"){context.lineWidth=shapeImpl.matchEdgeWidth?edgeWidth:1;context.lineJoin="miter";if(usePaths){context.stroke(path)}else{context.stroke()}}};module.exports=CRp},{}],98:[function(require,module,exports){"use strict";var math=require("../../../math");var CRp={};CRp.drawElement=function(context,ele,shiftToOriginWithBb,showLabel){var r=this;if(ele.isNode()){r.drawNode(context,ele,shiftToOriginWithBb,showLabel)}else{r.drawEdge(context,ele,shiftToOriginWithBb,showLabel)}};CRp.drawCachedElement=function(context,ele,pxRatio,extent){var r=this;var bb=ele.boundingBox();if(bb.w===0||bb.h===0){return}if(!extent||math.boundingBoxesIntersect(bb,extent)){var cache=r.data.eleTxrCache.getElement(ele,bb,pxRatio);if(cache){context.drawImage(cache.texture.canvas,cache.x,0,cache.width,cache.height,bb.x1,bb.y1,bb.w,bb.h)}else{r.drawElement(context,ele)}}};CRp.drawElements=function(context,eles){var r=this;for(var i=0;i0||textBorderWidth>0&&borderOpacity>0){var bgX=textX;switch(halign){case"left":bgX-=textW;break;case"center":bgX-=textW/2;break;case"right":break}var bgY=textY-textH;if(backgroundOpacity>0){var textFill=context.fillStyle;var textBackgroundColor=ele.pstyle("text-background-color").value;context.fillStyle="rgba("+textBackgroundColor[0]+","+textBackgroundColor[1]+","+textBackgroundColor[2]+","+backgroundOpacity*parentOpacity+")";var styleShape=ele.pstyle("text-background-shape").strValue;if(styleShape=="roundrectangle"){roundRect(context,bgX,bgY,textW,textH,2)}else{context.fillRect(bgX,bgY,textW,textH)}context.fillStyle=textFill}if(textBorderWidth>0&&borderOpacity>0){var textStroke=context.strokeStyle;var textLineWidth=context.lineWidth;var textBorderColor=ele.pstyle("text-border-color").value;var textBorderStyle=ele.pstyle("text-border-style").value;context.strokeStyle="rgba("+textBorderColor[0]+","+textBorderColor[1]+","+textBorderColor[2]+","+borderOpacity*parentOpacity+")";context.lineWidth=textBorderWidth;if(context.setLineDash){switch(textBorderStyle){case"dotted":context.setLineDash([1,1]);break;case"dashed":context.setLineDash([4,2]);break;case"double":context.lineWidth=textBorderWidth/4;context.setLineDash([]);break;case"solid":context.setLineDash([]);break}}context.strokeRect(bgX,bgY,textW,textH);if(textBorderStyle==="double"){var whiteWidth=textBorderWidth/2;context.strokeRect(bgX+whiteWidth,bgY+whiteWidth,textW-whiteWidth*2,textH-whiteWidth*2)}if(context.setLineDash){context.setLineDash([])}context.lineWidth=textLineWidth;context.strokeStyle=textStroke}}var lineWidth=2*ele.pstyle("text-outline-width").pfValue;if(lineWidth>0){context.lineWidth=lineWidth}if(ele.pstyle("text-wrap").value==="wrap"){var lines=rscratch.labelWrapCachedLines;var lineHeight=textH/lines.length;switch(valign){case"top":textY-=(lines.length-1)*lineHeight;break;case"center":case"bottom":textY-=(lines.length-1)*lineHeight;break}for(var l=0;l0){context.strokeText(lines[l],textX,textY)}context.fillText(lines[l],textX,textY);textY+=lineHeight}}else{if(lineWidth>0){context.strokeText(text,textX,textY)}context.fillText(text,textX,textY)}if(theta!==0){context.rotate(-theta);context.translate(-orgTextX,-orgTextY)}this.shadowStyle(context,"transparent",0)}};module.exports=CRp},{"../../../math":117,"../../../util":132}],101:[function(require,module,exports){"use strict";var is=require("../../../is");var CRp={};CRp.drawNode=function(context,node,shiftToOriginWithBb,drawLabel){var r=this;var nodeWidth,nodeHeight;var rs=node._private.rscratch;var _p=node._private;var pos=pos||_p.position;if(!is.number(pos.x)||!is.number(pos.y)){return}if(!node.visible()){return}var parentOpacity=node.effectiveOpacity();var usePaths=this.usePaths();var path;var pathCacheHit=false;nodeWidth=node.width()+node.pstyle("padding-left").pfValue+node.pstyle("padding-right").pfValue;nodeHeight=node.height()+node.pstyle("padding-top").pfValue+node.pstyle("padding-bottom").pfValue;context.lineWidth=node.pstyle("border-width").pfValue;var bb;if(shiftToOriginWithBb){bb=shiftToOriginWithBb;context.translate(-bb.x1,-bb.y1)}var bgImgProp=node.pstyle("background-image");var url=bgImgProp.value[2]||bgImgProp.value[1];var image;if(url!==undefined){image=this.getCachedImage(url,function(){node.trigger("background");r.redrawHint("eles",true);r.redrawHint("drag",true);r.drawingImage=true;r.redraw()});var prevBging=_p.backgrounding;_p.backgrounding=!image.complete;if(prevBging!==_p.backgrounding){node.updateStyle(false)}}var bgColor=node.pstyle("background-color").value;var borderColor=node.pstyle("border-color").value;var borderStyle=node.pstyle("border-style").value;this.fillStyle(context,bgColor[0],bgColor[1],bgColor[2],node.pstyle("background-opacity").value*parentOpacity);this.strokeStyle(context,borderColor[0],borderColor[1],borderColor[2],node.pstyle("border-opacity").value*parentOpacity);var shadowBlur=node.pstyle("shadow-blur").pfValue;var shadowOpacity=node.pstyle("shadow-opacity").value;var shadowColor=node.pstyle("shadow-color").value;var shadowOffsetX=node.pstyle("shadow-offset-x").pfValue;var shadowOffsetY=node.pstyle("shadow-offset-y").pfValue;this.shadowStyle(context,shadowColor,shadowOpacity,shadowBlur,shadowOffsetX,shadowOffsetY);context.lineJoin="miter";if(context.setLineDash){switch(borderStyle){case"dotted":context.setLineDash([1,1]);break;case"dashed":context.setLineDash([4,2]);break;case"solid":case"double":context.setLineDash([]);break}}var styleShape=node.pstyle("shape").strValue;var shapePts=node.pstyle("shape-polygon-points").pfValue;if(usePaths){var pathCacheKey=styleShape+"$"+nodeWidth+"$"+nodeHeight+(styleShape==="polygon"?"$"+shapePts.join("$"):"");context.translate(pos.x,pos.y);if(rs.pathCacheKey===pathCacheKey){path=rs.pathCache;pathCacheHit=true}else{path=new Path2D;rs.pathCacheKey=pathCacheKey;rs.pathCache=path}}if(!pathCacheHit){var npos=pos;if(usePaths){npos={x:0,y:0}}r.nodeShapes[this.getNodeShape(node)].draw(path||context,npos.x,npos.y,nodeWidth,nodeHeight)}if(usePaths){context.fill(path)}else{context.fill()}this.shadowStyle(context,"transparent",0);if(url!==undefined){if(image.complete){this.drawInscribedImage(context,image,node)}}var darkness=node.pstyle("background-blacken").value;var borderWidth=node.pstyle("border-width").pfValue;if(this.hasPie(node)){this.drawPie(context,node,parentOpacity);if(darkness!==0||borderWidth!==0){if(!usePaths){r.nodeShapes[this.getNodeShape(node)].draw(context,pos.x,pos.y,nodeWidth,nodeHeight)}}}if(darkness>0){this.fillStyle(context,0,0,0,darkness);if(usePaths){context.fill(path)}else{context.fill()}}else if(darkness<0){this.fillStyle(context,255,255,255,-darkness);if(usePaths){context.fill(path)}else{context.fill()}}if(borderWidth>0){if(usePaths){context.stroke(path)}else{context.stroke()}if(borderStyle==="double"){context.lineWidth=node.pstyle("border-width").pfValue/3;var gco=context.globalCompositeOperation;context.globalCompositeOperation="destination-out";if(usePaths){context.stroke(path)}else{context.stroke()}context.globalCompositeOperation=gco}}if(usePaths){context.translate(-pos.x,-pos.y)}if(context.setLineDash){context.setLineDash([])}r.drawElementText(context,node,drawLabel);var overlayPadding=node.pstyle("overlay-padding").pfValue;var overlayOpacity=node.pstyle("overlay-opacity").value;var overlayColor=node.pstyle("overlay-color").value;if(overlayOpacity>0){this.fillStyle(context,overlayColor[0],overlayColor[1],overlayColor[2],overlayOpacity);r.nodeShapes["roundrectangle"].draw(context,node._private.position.x,node._private.position.y,nodeWidth+overlayPadding*2,nodeHeight+overlayPadding*2);context.fill()}if(shiftToOriginWithBb){context.translate(bb.x1,bb.y1)}};CRp.hasPie=function(node){node=node[0];return node._private.hasPie};CRp.drawPie=function(context,node,nodeOpacity,pos){node=node[0];var _p=node._private;var cyStyle=node.cy().style();var pieSize=node.pstyle("pie-size");var nodeW=node.width();var nodeH=node.height();var pos=pos||_p.position;var x=pos.x;var y=pos.y;var radius=Math.min(nodeW,nodeH)/2;var lastPercent=0;var usePaths=this.usePaths();if(usePaths){x=0;y=0}if(pieSize.units==="%"){radius=radius*pieSize.value/100}else if(pieSize.pfValue!==undefined){radius=pieSize.pfValue/2}for(var i=1;i<=cyStyle.pieBackgroundN;i++){var size=node.pstyle("pie-"+i+"-background-size").value;var color=node.pstyle("pie-"+i+"-background-color").value;var opacity=node.pstyle("pie-"+i+"-background-opacity").value*nodeOpacity;var percent=size/100;if(percent+lastPercent>1){percent=1-lastPercent}var angleStart=1.5*Math.PI+2*Math.PI*lastPercent;var angleDelta=2*Math.PI*percent;var angleEnd=angleStart+angleDelta;if(size===0||lastPercent>=1||lastPercent+percent>1){continue}context.beginPath();context.moveTo(x,y);context.arc(x,y,radius,angleStart,angleEnd);context.closePath();this.fillStyle(context,color[0],color[1],color[2],opacity);context.fill();lastPercent+=percent}};module.exports=CRp},{"../../../is":115}],102:[function(require,module,exports){"use strict";var CRp={};var util=require("../../../util");var motionBlurDelay=100;CRp.getPixelRatio=function(){var context=this.data.contexts[0];if(this.forcedPixelRatio!=null){return this.forcedPixelRatio}var backingStore=context.backingStorePixelRatio||context.webkitBackingStorePixelRatio||context.mozBackingStorePixelRatio||context.msBackingStorePixelRatio||context.oBackingStorePixelRatio||context.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/backingStore};CRp.paintCache=function(context){var caches=this.paintCaches=this.paintCaches||[];var needToCreateCache=true;var cache;for(var i=0;i0){context.shadowBlur=blur*zoom;context.shadowColor="rgba("+color[0]+","+color[1]+","+color[2]+","+opacity+")";context.shadowOffsetX=offsetX*zoom;context.shadowOffsetY=offsetY*zoom}else{context.shadowBlur=0;context.shadowColor="transparent";context.shadowOffsetX=0;context.shadowOffsetY=0}};CRp.matchCanvasSize=function(container){var r=this;var data=r.data;var width=container.clientWidth;var height=container.clientHeight;var pixelRatio=r.getPixelRatio();var mbPxRatio=r.motionBlurPxRatio;if(container===r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_NODE]||container===r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_DRAG]){pixelRatio=mbPxRatio}var canvasWidth=width*pixelRatio;var canvasHeight=height*pixelRatio;var canvas;if(canvasWidth===r.canvasWidth&&canvasHeight===r.canvasHeight){return}r.fontCaches=null;var canvasContainer=data.canvasContainer;canvasContainer.style.width=width+"px";canvasContainer.style.height=height+"px";for(var i=0;ir.minMbLowQualFrames){r.motionBlurPxRatio=r.mbPxRBlurry}}if(r.clearingMotionBlur){r.motionBlurPxRatio=1}if(r.textureDrawLastFrame&&!textureDraw){needDraw[r.NODE]=true;needDraw[r.SELECT_BOX]=true}var coreStyle=cy.style()._private.coreStyle;var zoom=cy.zoom();var effectiveZoom=forcedZoom!==undefined?forcedZoom:zoom;var pan=cy.pan();var effectivePan={x:pan.x,y:pan.y};var vp={zoom:zoom,pan:{x:pan.x,y:pan.y}};var prevVp=r.prevViewport;var viewportIsDiff=prevVp===undefined||vp.zoom!==prevVp.zoom||vp.pan.x!==prevVp.pan.x||vp.pan.y!==prevVp.pan.y;if(!viewportIsDiff&&!(inNodeDragGesture&&!hasCompoundNodes)){r.motionBlurPxRatio=1}if(forcedPan){effectivePan=forcedPan}effectiveZoom*=pixelRatio;effectivePan.x*=pixelRatio;effectivePan.y*=pixelRatio;var eles=r.getCachedZSortedEles();function mbclear(context,x,y,w,h){var gco=context.globalCompositeOperation;context.globalCompositeOperation="destination-out";r.fillStyle(context,255,255,255,r.motionBlurTransparency);context.fillRect(x,y,w,h);context.globalCompositeOperation=gco}function setContextTransform(context,clear){var ePan,eZoom,w,h;if(!r.clearingMotionBlur&&(context===data.bufferContexts[r.MOTIONBLUR_BUFFER_NODE]||context===data.bufferContexts[r.MOTIONBLUR_BUFFER_DRAG])){ePan={x:pan.x*mbPxRatio,y:pan.y*mbPxRatio};eZoom=zoom*mbPxRatio;w=r.canvasWidth*mbPxRatio;h=r.canvasHeight*mbPxRatio}else{ePan=effectivePan;eZoom=effectiveZoom;w=r.canvasWidth;h=r.canvasHeight}context.setTransform(1,0,0,1,0,0);if(clear==="motionBlur"){mbclear(context,0,0,w,h)}else if(!forcedContext&&(clear===undefined||clear)){context.clearRect(0,0,w,h)}if(!drawAllLayers){context.translate(ePan.x,ePan.y);context.scale(eZoom,eZoom)}if(forcedPan){context.translate(forcedPan.x,forcedPan.y)}if(forcedZoom){context.scale(forcedZoom,forcedZoom)}}if(!textureDraw){r.textureDrawLastFrame=false}if(textureDraw){r.textureDrawLastFrame=true;var bb;if(!r.textureCache){r.textureCache={};bb=r.textureCache.bb=cy.mutableElements().boundingBox();r.textureCache.texture=r.data.bufferCanvases[r.TEXTURE_BUFFER];var cxt=r.data.bufferContexts[r.TEXTURE_BUFFER];cxt.setTransform(1,0,0,1,0,0);cxt.clearRect(0,0,r.canvasWidth*r.textureMult,r.canvasHeight*r.textureMult);r.render({forcedContext:cxt,drawOnlyNodeLayer:true,forcedPxRatio:pixelRatio*r.textureMult});var vp=r.textureCache.viewport={zoom:cy.zoom(),pan:cy.pan(),width:r.canvasWidth,height:r.canvasHeight};vp.mpan={x:(0-vp.pan.x)/vp.zoom,y:(0-vp.pan.y)/vp.zoom}}needDraw[r.DRAG]=false;needDraw[r.NODE]=false;var context=data.contexts[r.NODE];var texture=r.textureCache.texture;var vp=r.textureCache.viewport;bb=r.textureCache.bb;context.setTransform(1,0,0,1,0,0);if(motionBlur){mbclear(context,0,0,vp.width,vp.height)}else{context.clearRect(0,0,vp.width,vp.height)}var outsideBgColor=coreStyle["outside-texture-bg-color"].value;var outsideBgOpacity=coreStyle["outside-texture-bg-opacity"].value;r.fillStyle(context,outsideBgColor[0],outsideBgColor[1],outsideBgColor[2],outsideBgOpacity);context.fillRect(0,0,vp.width,vp.height);var zoom=cy.zoom();setContextTransform(context,false);context.clearRect(vp.mpan.x,vp.mpan.y,vp.width/vp.zoom/pixelRatio,vp.height/vp.zoom/pixelRatio);context.drawImage(texture,vp.mpan.x,vp.mpan.y,vp.width/vp.zoom/pixelRatio,vp.height/vp.zoom/pixelRatio)}else if(r.textureOnViewport&&!forcedContext){r.textureCache=null}var extent=cy.extent();var vpManip=r.pinching||r.hoverData.dragging||r.swipePanning||r.data.wheelZooming||r.hoverData.draggingEles;var hideEdges=r.hideEdgesOnViewport&&vpManip;var needMbClear=[];needMbClear[r.NODE]=!needDraw[r.NODE]&&motionBlur&&!r.clearedForMotionBlur[r.NODE]||r.clearingMotionBlur;if(needMbClear[r.NODE]){r.clearedForMotionBlur[r.NODE]=true}needMbClear[r.DRAG]=!needDraw[r.DRAG]&&motionBlur&&!r.clearedForMotionBlur[r.DRAG]||r.clearingMotionBlur;if(needMbClear[r.DRAG]){r.clearedForMotionBlur[r.DRAG]=true}if(needDraw[r.NODE]||drawAllLayers||drawOnlyNodeLayer||needMbClear[r.NODE]){var useBuffer=motionBlur&&!needMbClear[r.NODE]&&mbPxRatio!==1;var context=forcedContext||(useBuffer?r.data.bufferContexts[r.MOTIONBLUR_BUFFER_NODE]:data.contexts[r.NODE]);var clear=motionBlur&&!useBuffer?"motionBlur":undefined;setContextTransform(context,clear);if(hideEdges){r.drawCachedNodes(context,eles.nondrag,pixelRatio,extent)}else{r.drawLayeredElements(context,eles.nondrag,pixelRatio,extent)}if(!drawAllLayers&&!motionBlur){needDraw[r.NODE]=false}}if(!drawOnlyNodeLayer&&(needDraw[r.DRAG]||drawAllLayers||needMbClear[r.DRAG])){var useBuffer=motionBlur&&!needMbClear[r.DRAG]&&mbPxRatio!==1;var context=forcedContext||(useBuffer?r.data.bufferContexts[r.MOTIONBLUR_BUFFER_DRAG]:data.contexts[r.DRAG]);setContextTransform(context,motionBlur&&!useBuffer?"motionBlur":undefined);if(hideEdges){r.drawCachedNodes(context,eles.drag,pixelRatio,extent)}else{r.drawCachedElements(context,eles.drag,pixelRatio,extent)}if(!drawAllLayers&&!motionBlur){needDraw[r.DRAG]=false}}if(r.showFps||!drawOnlyNodeLayer&&(needDraw[r.SELECT_BOX]&&!drawAllLayers)){var context=forcedContext||data.contexts[r.SELECT_BOX];setContextTransform(context);if(r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var zoom=r.cy.zoom();var borderWidth=coreStyle["selection-box-border-width"].value/zoom;context.lineWidth=borderWidth;context.fillStyle="rgba("+coreStyle["selection-box-color"].value[0]+","+coreStyle["selection-box-color"].value[1]+","+coreStyle["selection-box-color"].value[2]+","+coreStyle["selection-box-opacity"].value+")";context.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]);if(borderWidth>0){context.strokeStyle="rgba("+coreStyle["selection-box-border-color"].value[0]+","+coreStyle["selection-box-border-color"].value[1]+","+coreStyle["selection-box-border-color"].value[2]+","+coreStyle["selection-box-opacity"].value+")";context.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1])}}if(data.bgActivePosistion&&!r.hoverData.selecting){var zoom=r.cy.zoom();var pos=data.bgActivePosistion;context.fillStyle="rgba("+coreStyle["active-bg-color"].value[0]+","+coreStyle["active-bg-color"].value[1]+","+coreStyle["active-bg-color"].value[2]+","+coreStyle["active-bg-opacity"].value+")";context.beginPath();context.arc(pos.x,pos.y,coreStyle["active-bg-size"].pfValue/zoom,0,2*Math.PI);context.fill()}var timeToRender=r.lastRedrawTime;if(r.showFps&&timeToRender){timeToRender=Math.round(timeToRender);var fps=Math.round(1e3/timeToRender);context.setTransform(1,0,0,1,0,0);context.fillStyle="rgba(255, 0, 0, 0.75)";context.strokeStyle="rgba(255, 0, 0, 0.75)";context.lineWidth=1;context.fillText("1 frame = "+timeToRender+" ms = "+fps+" fps",0,20);var maxFps=60;context.strokeRect(0,30,250,20);context.fillRect(0,30,250*Math.min(fps/maxFps,1),20)}if(!drawAllLayers){needDraw[r.SELECT_BOX]=false}}if(motionBlur&&mbPxRatio!==1){var cxtNode=data.contexts[r.NODE];var txtNode=r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_NODE];var cxtDrag=data.contexts[r.DRAG];var txtDrag=r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_DRAG];var drawMotionBlur=function(cxt,txt,needClear){cxt.setTransform(1,0,0,1,0,0);if(needClear||!motionBlurFadeEffect){cxt.clearRect(0,0,r.canvasWidth,r.canvasHeight)}else{mbclear(cxt,0,0,r.canvasWidth,r.canvasHeight)}var pxr=mbPxRatio;cxt.drawImage(txt,0,0,r.canvasWidth*pxr,r.canvasHeight*pxr,0,0,r.canvasWidth,r.canvasHeight)};if(needDraw[r.NODE]||needMbClear[r.NODE]){drawMotionBlur(cxtNode,txtNode,needMbClear[r.NODE]);needDraw[r.NODE]=false}if(needDraw[r.DRAG]||needMbClear[r.DRAG]){drawMotionBlur(cxtDrag,txtDrag,needMbClear[r.DRAG]);needDraw[r.DRAG]=false}}r.prevViewport=vp;if(r.clearingMotionBlur){r.clearingMotionBlur=false;r.motionBlurCleared=true;r.motionBlur=true}if(motionBlur){r.motionBlurTimeout=setTimeout(function(){r.motionBlurTimeout=null;r.clearedForMotionBlur[r.NODE]=false;r.clearedForMotionBlur[r.DRAG]=false;r.motionBlur=false;r.clearingMotionBlur=!textureDraw;r.mbFrames=0;needDraw[r.NODE]=true;needDraw[r.DRAG]=true;r.redraw()},motionBlurDelay)}r.drawingImage=false;if(!forcedContext&&!r.initrender){r.initrender=true;cy.trigger("initrender")}if(!forcedContext){cy.trigger("render")}};module.exports=CRp},{"../../../util":132}],103:[function(require,module,exports){"use strict";var math=require("../../../math");var CRp={};CRp.drawPolygonPath=function(context,x,y,width,height,points){var halfW=width/2;var halfH=height/2;if(context.beginPath){context.beginPath()}context.moveTo(x+halfW*points[0],y+halfH*points[1]);for(var i=1;i0&&duration>0){var css={};var anyPrev=false;for(var i=0;i0){ele.delay(delay)}ele.animate({css:css},{duration:duration,easing:ele.pstyle("transition-timing-function").value,queue:false,complete:function(){if(!isBypass){self.removeBypasses(ele,props)}_p.transitioning=false}})}else if(_p.transitioning){ele.stop();this.removeBypasses(ele,props);_p.transitioning=false}};module.exports=styfn},{"../is":114,"../util":131}],120:[function(require,module,exports){"use strict";var is=require("../is");var util=require("../util");var styfn={};styfn.applyBypass=function(eles,name,value,updateTransitions){var self=this;var props=[];var isBypass=true;if(name==="*"||name==="**"){if(value!==undefined){for(var i=0;itype.max){return null}var ret={name:name,value:value,strValue:""+value+(units?units:""),units:units,bypass:propIsBypass};if(type.unitless||units!=="px"&&units!=="em"){ret.pfValue=value}else{ret.pfValue=units==="px"||!units?value:this.getEmSizeInPixels()*value}if(units==="ms"||units==="s"){ret.pfValue=units==="ms"?value:1e3*value}if(units==="deg"||units==="rad"){ret.pfValue=units==="rad"?value:math.deg2rad(value)}return ret}else if(type.propList){var props=[];var propsStr=""+value;if(propsStr==="none"){}else{var propsSplit=propsStr.split(",");for(var i=0;i node").css({shape:"rectangle","padding-top":10,"padding-right":10,"padding-left":10,"padding-bottom":10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3,"curve-style":"haystack"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector("node:parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}).selector("core").css({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125});this.defaultLength=this.length};module.exports=styfn},{"../util":131}],127:[function(require,module,exports){"use strict";var util=require("../util");var Selector=require("../selector");var styfn={};styfn.applyFromString=function(string){var self=this;var style=this;var remaining=""+string;var selAndBlockStr;var blockRem;var propAndValStr;remaining=remaining.replace(/[\/][*](\s|.)+?[*][\/]/g,"");function removeSelAndBlockFromRemaining(){if(remaining.length>selAndBlockStr.length){remaining=remaining.substr(selAndBlockStr.length); +var defTxrWidth=1024;var maxTxrW=1024;var maxTxrH=1024;var minUtility=.5;var maxFullness=.8;var maxFullnessChecks=10;var allowEdgeTxrCaching=false;var allowParentTxrCaching=false;var deqCost=.15;var deqAvgCost=.1;var deqNoDrawCost=.9;var deqFastCost=.9;var deqRedrawThreshold=100;var maxDeqSize=1;var getTxrReasons={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"};var ElementTextureCache=function(renderer){var self=this;self.renderer=renderer;self.onDequeues=[];self.setupDequeueing()};var ETCp=ElementTextureCache.prototype;ETCp.reasons=getTxrReasons;ETCp.getTextureQueue=function(txrH){var self=this;self.eleImgCaches=self.eleImgCaches||{};return self.eleImgCaches[txrH]=self.eleImgCaches[txrH]||[]};ETCp.getRetiredTextureQueue=function(txrH){var self=this;var rtxtrQs=self.eleImgCaches.retired=self.eleImgCaches.retired||{};var rtxtrQ=rtxtrQs[txrH]=rtxtrQs[txrH]||[];return rtxtrQ};ETCp.getElementQueue=function(){var self=this;var q=self.eleCacheQueue=self.eleCacheQueue||new Heap(function(a,b){return b.reqs-a.reqs});return q};ETCp.getElementIdToQueue=function(){var self=this;var id2q=self.eleIdToCacheQueue=self.eleIdToCacheQueue||{};return id2q};ETCp.getElement=function(ele,bb,pxRatio,lvl,reason){var self=this;var r=this.renderer;var rs=ele._private.rscratch;var zoom=r.cy.zoom();if(bb.w===0||bb.h===0){return null}if(lvl==null){lvl=Math.ceil(math.log2(zoom*pxRatio))}if(lvl=maxZoom||lvl>maxLvl){return null}var scale=Math.pow(2,lvl);var eleScaledH=bb.h*scale;var eleScaledW=bb.w*scale;var caches=rs.imgCaches=rs.imgCaches||{};var eleCache=caches[lvl];if(eleCache){return eleCache}var txrH;if(eleScaledH<=minTxrH){txrH=minTxrH}else if(eleScaledH<=txrStepH){txrH=txrStepH}else{txrH=Math.ceil(eleScaledH/txrStepH)*txrStepH}if(eleScaledH>maxTxrH||eleScaledW>maxTxrW||!allowEdgeTxrCaching&&ele.isEdge()||!allowParentTxrCaching&&ele.isParent()){return null}var txrQ=self.getTextureQueue(txrH);var txr=txrQ[txrQ.length-2];var addNewTxr=function(){return self.recycleTexture(txrH,eleScaledW)||self.addTexture(txrH,eleScaledW)};if(!txr){txr=txrQ[txrQ.length-1]}if(!txr){txr=addNewTxr()}if(txr.width-txr.usedWidthlvl;l--){oneUpCache=self.getElement(ele,bb,pxRatio,l,getTxrReasons.downscale)}downscale()}else{self.queueElement(ele,bb,higherCache.level-1);return higherCache}}else{var lowerCache;if(!deqing&&!highQualityReq&&!downscaleReq){for(var l=lvl-1;l>=minLvl;l--){var c=caches[l];if(c){lowerCache=c;break}}}if(scalableFrom(lowerCache)){self.queueElement(ele,bb,lvl);return lowerCache}txr.context.translate(txr.usedWidth,0);txr.context.scale(scale,scale);r.drawElement(txr.context,ele,bb,scaledLabelShown);txr.context.scale(1/scale,1/scale);txr.context.translate(-txr.usedWidth,0)}eleCache=caches[lvl]={ele:ele,x:txr.usedWidth,texture:txr,level:lvl,scale:scale,width:eleScaledW,height:eleScaledH,scaledLabelShown:scaledLabelShown};txr.usedWidth+=Math.ceil(eleScaledW+eleTxrSpacing);txr.eleCaches.push(eleCache);self.checkTextureFullness(txr);return eleCache};ETCp.invalidateElement=function(ele){var self=this;var caches=ele._private.rscratch.imgCaches;if(caches){for(var lvl=minLvl;lvl<=maxLvl;lvl++){var cache=caches[lvl];if(cache){var txr=cache.texture;txr.invalidatedWidth+=cache.width;caches[lvl]=null;util.removeFromArray(txr.eleCaches,cache);self.checkTextureUtility(txr)}}}};ETCp.checkTextureUtility=function(txr){if(txr.invalidatedWidth>=minUtility*txr.width){this.retireTexture(txr)}};ETCp.checkTextureFullness=function(txr){var self=this;var txrQ=self.getTextureQueue(txr.height);if(txr.usedWidth/txr.width>maxFullness&&txr.fullnessChecks>=maxFullnessChecks){util.removeFromArray(txrQ,txr)}else{txr.fullnessChecks++}};ETCp.retireTexture=function(txr){var self=this;var txrH=txr.height;var txrQ=self.getTextureQueue(txrH);util.removeFromArray(txrQ,txr);txr.retired=true;var eleCaches=txr.eleCaches;for(var i=0;i=minW){txr.retired=false;txr.usedWidth=0;txr.invalidatedWidth=0;txr.fullnessChecks=0;util.clearArray(txr.eleCaches);txr.context.clearRect(0,0,txr.width,txr.height);util.removeFromArray(rtxtrQ,txr);txrQ.push(txr);return txr}}};ETCp.queueElement=function(ele,bb,lvl){var self=this;var q=self.getElementQueue();var id2q=self.getElementIdToQueue();var id=ele.id();var existingReq=id2q[id];if(existingReq){existingReq.level=Math.max(existingReq.level,lvl);existingReq.reqs++;q.updateItem(existingReq)}else{var req={ele:ele,bb:bb,position:math.copyPosition(ele.position()),level:lvl,reqs:1};if(ele.isEdge()){req.positions={source:math.copyPosition(ele.source().position()),target:math.copyPosition(ele.target().position())}}q.push(req);id2q[id]=req}};ETCp.dequeue=function(pxRatio,extent){var self=this;var q=self.getElementQueue();var id2q=self.getElementIdToQueue();var dequeued=[];for(var i=0;i0){var req=q.pop();id2q[req.ele.id()]=null;dequeued.push(req);var ele=req.ele;var bb;if(ele.isEdge()&&(!math.arePositionsSame(ele.source().position(),req.positions.source)||!math.arePositionsSame(ele.target().position(),req.positions.target))||!math.arePositionsSame(ele.position(),req.position)){bb=ele.boundingBox()}else{bb=req.bb}self.getElement(req.ele,bb,pxRatio,req.level,getTxrReasons.dequeue)}else{break}}return dequeued};ETCp.onDequeue=function(fn){this.onDequeues.push(fn)};ETCp.offDequeue=function(fn){util.removeFromArray(this.onDequeues,fn)};ETCp.setupDequeueing=defs.setupDequeueing({deqRedrawThreshold:deqRedrawThreshold,deqCost:deqCost,deqAvgCost:deqAvgCost,deqNoDrawCost:deqNoDrawCost,deqFastCost:deqFastCost,deq:function(self,pxRatio,extent){return self.dequeue(pxRatio,extent)},onDeqd:function(self,deqd){for(var i=0;i0&&height>0){buffCxt.clearRect(0,0,width,height);if(options.bg){buffCxt.fillStyle=options.bg;buffCxt.rect(0,0,width,height);buffCxt.fill()}buffCxt.globalCompositeOperation="source-over";var zsortedEles=this.getCachedZSortedEles();if(options.full){buffCxt.translate(-bb.x1*scale,-bb.y1*scale);buffCxt.scale(scale,scale);this.drawElements(buffCxt,zsortedEles)}else{var pan=cy.pan();var translation={x:pan.x*scale,y:pan.y*scale};scale*=cy.zoom();buffCxt.translate(translation.x,translation.y);buffCxt.scale(scale,scale);this.drawElements(buffCxt,zsortedEles)}}return buffCanvas};CRp.png=function(options){return this.bufferCanvasImage(options).toDataURL("image/png")};CRp.jpg=function(options){return this.bufferCanvasImage(options).toDataURL("image/jpeg")};module.exports=CRp},{"../../../is":115}],106:[function(require,module,exports){"use strict";var util=require("../../../util");var is=require("../../../is");var ElementTextureCache=require("./ele-texture-cache");var LayeredTextureCache=require("./layered-texture-cache");var CR=CanvasRenderer;var CRp=CanvasRenderer.prototype;CRp.CANVAS_LAYERS=3;CRp.SELECT_BOX=0;CRp.DRAG=1;CRp.NODE=2;CRp.BUFFER_COUNT=3;CRp.TEXTURE_BUFFER=0;CRp.MOTIONBLUR_BUFFER_NODE=1;CRp.MOTIONBLUR_BUFFER_DRAG=2;function CanvasRenderer(options){var r=this;r.data={canvases:new Array(CRp.CANVAS_LAYERS),contexts:new Array(CRp.CANVAS_LAYERS),canvasNeedsRedraw:new Array(CRp.CANVAS_LAYERS),bufferCanvases:new Array(CRp.BUFFER_COUNT),bufferContexts:new Array(CRp.CANVAS_LAYERS)};r.data.canvasContainer=document.createElement("div");var containerStyle=r.data.canvasContainer.style;r.data.canvasContainer.setAttribute("style","-webkit-tap-highlight-color: rgba(0,0,0,0);");containerStyle.position="relative";containerStyle.zIndex="0";containerStyle.overflow="hidden";var container=options.cy.container();container.appendChild(r.data.canvasContainer);container.setAttribute("style",(container.getAttribute("style")||"")+"-webkit-tap-highlight-color: rgba(0,0,0,0);");for(var i=0;i0){r.data.lyrTxrCache.invalidateElements(eles)}})}CRp.redrawHint=function(group,bool){var r=this;switch(group){case"eles":r.data.canvasNeedsRedraw[CRp.NODE]=bool;break;case"drag":r.data.canvasNeedsRedraw[CRp.DRAG]=bool;break;case"select":r.data.canvasNeedsRedraw[CRp.SELECT_BOX]=bool;break}};var pathsImpld=typeof Path2D!=="undefined";CRp.path2dEnabled=function(on){if(on===undefined){return this.pathsEnabled}this.pathsEnabled=on?true:false};CRp.usePaths=function(){return pathsImpld&&this.pathsEnabled};[require("./arrow-shapes"),require("./drawing-elements"),require("./drawing-edges"),require("./drawing-images"),require("./drawing-label-text"),require("./drawing-nodes"),require("./drawing-redraw"),require("./drawing-shapes"),require("./export-image"),require("./node-shapes")].forEach(function(props){util.extend(CRp,props)});module.exports=CR},{"../../../is":115,"../../../util":132,"./arrow-shapes":96,"./drawing-edges":97,"./drawing-elements":98,"./drawing-images":99,"./drawing-label-text":100,"./drawing-nodes":101,"./drawing-redraw":102,"./drawing-shapes":103,"./ele-texture-cache":104,"./export-image":105,"./layered-texture-cache":107,"./node-shapes":108}],107:[function(require,module,exports){"use strict";var util=require("../../../util");var math=require("../../../math");var Heap=require("../../../heap");var is=require("../../../is");var defs=require("./texture-cache-defs");var defNumLayers=1;var minLvl=-4;var maxLvl=2;var maxZoom=3.99;var deqRedrawThreshold=50;var refineEleDebounceTime=50;var disableEleImgSmoothing=true;var deqCost=.15;var deqAvgCost=.1;var deqNoDrawCost=.9;var deqFastCost=.9;var maxDeqSize=1;var invalidThreshold=250;var maxLayerArea=4e3*4e3;var alwaysQueue=true;var useHighQualityEleTxrReqs=true;var useEleTxrCaching=true;var LayeredTextureCache=function(renderer,eleTxrCache){var self=this;var r=self.renderer=renderer;self.layersByLevel={};self.firstGet=true;self.lastInvalidationTime=util.performanceNow()-2*invalidThreshold;self.skipping=false;r.beforeRender(function(willDraw,now){if(now-self.lastInvalidationTime<=invalidThreshold){self.skipping=true}else{self.skipping=false}});var qSort=function(a,b){return b.reqs-a.reqs};self.layersQueue=new Heap(qSort);self.eleTxrCache=eleTxrCache;self.setupEleCacheInvalidation();self.setupDequeueing()};var LTCp=LayeredTextureCache.prototype;var layerIdPool=0;var MAX_INT=Math.pow(2,53)-1;LTCp.makeLayer=function(bb,lvl){var scale=Math.pow(2,lvl);var w=Math.ceil(bb.w*scale);var h=Math.ceil(bb.h*scale);var canvas=document.createElement("canvas");canvas.width=w;canvas.height=h;var layer={id:layerIdPool=++layerIdPool%MAX_INT,bb:bb,level:lvl,width:w,height:h,canvas:canvas,context:canvas.getContext("2d"),eles:[],elesQueue:[],reqs:0};var cxt=layer.context;var dx=-layer.bb.x1;var dy=-layer.bb.y1;cxt.scale(scale,scale);cxt.translate(dx,dy);return layer};LTCp.getLayers=function(eles,pxRatio,lvl){var self=this;var r=self.renderer;var cy=r.cy;var zoom=cy.zoom();var firstGet=self.firstGet;self.firstGet=false;if(lvl==null){lvl=Math.ceil(math.log2(zoom*pxRatio));if(lvl=maxZoom||lvl>maxLvl){return null}}self.validateLayersElesOrdering(lvl,eles);var layersByLvl=self.layersByLevel;var scale=Math.pow(2,lvl);var layers=layersByLvl[lvl]=layersByLvl[lvl]||[];var bb;var lvlComplete=self.levelIsComplete(lvl,eles);var tmpLayers;var checkTempLevels=function(){var canUseAsTmpLvl=function(l){self.validateLayersElesOrdering(l,eles);if(self.levelIsComplete(l,eles)){tmpLayers=layersByLvl[l];return true}};var checkLvls=function(dir){if(tmpLayers){return}for(var l=lvl+dir;minLvl<=l&&l<=maxLvl;l+=dir){if(canUseAsTmpLvl(l)){break}}};checkLvls(+1);checkLvls(-1);for(var i=layers.length-1;i>=0;i--){var layer=layers[i];if(layer.invalid){util.removeFromArray(layers,layer)}}};if(!lvlComplete){checkTempLevels()}else{return layers}var getBb=function(){if(!bb){bb=math.makeBoundingBox();for(var i=0;imaxLayerArea){return null}var layer=self.makeLayer(bb,lvl);if(after!=null){var index=layers.indexOf(after)+1;layers.splice(index,0,layer)}else if(opts.insert===undefined||opts.insert){layers.unshift(layer)}return layer};if(self.skipping&&!firstGet){return null}var layer=null;var maxElesPerLayer=eles.length/defNumLayers;var allowLazyQueueing=alwaysQueue&&!firstGet;for(var i=0;i=maxElesPerLayer||!math.boundingBoxInBoundingBox(layer.bb,ele.boundingBox())){layer=makeLayer({insert:true,after:layer});if(!layer){return null}}if(tmpLayers||allowLazyQueueing){self.queueLayer(layer,ele)}else{self.drawEleInLayer(layer,ele,lvl,pxRatio)}layer.eles.push(ele);caches[lvl]=layer}if(tmpLayers){return tmpLayers}if(allowLazyQueueing){return null}return layers};LTCp.getEleLevelForLayerLevel=function(lvl,pxRatio){return lvl};function imgSmoothing(context,bool){if(context.imageSmoothingEnabled!=null){context.imageSmoothingEnabled=bool}else{context.webkitImageSmoothingEnabled=bool;context.mozImageSmoothingEnabled=bool;context.msImageSmoothingEnabled=bool}}LTCp.drawEleInLayer=function(layer,ele,lvl,pxRatio){var self=this;var r=this.renderer;var context=layer.context;var bb=ele.boundingBox();if(bb.w===0||bb.h===0){return}var eleCache=self.eleTxrCache;var reason=useHighQualityEleTxrReqs?eleCache.reasons.highQuality:undefined;lvl=self.getEleLevelForLayerLevel(lvl,pxRatio);var cache=useEleTxrCaching?eleCache.getElement(ele,bb,null,lvl,reason):null;if(cache){if(disableEleImgSmoothing){imgSmoothing(context,false)}context.drawImage(cache.texture.canvas,cache.x,0,cache.width,cache.height,bb.x1,bb.y1,bb.w,bb.h);if(disableEleImgSmoothing){imgSmoothing(context,true)}}else{r.drawElement(context,ele)}};LTCp.levelIsComplete=function(lvl,eles){var self=this;var layers=self.layersByLevel[lvl];if(!layers||layers.length===0){return false}var numElesInLayers=0;for(var i=0;i0){return false}if(layer.invalid){return false}numElesInLayers+=layer.eles.length}if(numElesInLayers!==eles.length){return false}return true};LTCp.validateLayersElesOrdering=function(lvl,eles){var layers=this.layersByLevel[lvl];if(!layers){return}for(var i=0;i0){haveLayers=true;break}}return haveLayers};LTCp.invalidateElements=function(eles){var self=this;self.lastInvalidationTime=util.performanceNow();if(eles.length===0||!self.haveLayers()){return}self.updateElementsInLayers(eles,function invalAssocLayers(layer,ele,req){self.invalidateLayer(layer)})};LTCp.invalidateLayer=function(layer){this.lastInvalidationTime=util.performanceNow();if(layer.invalid){return}var lvl=layer.level;var eles=layer.eles;var layers=this.layersByLevel[lvl];util.removeFromArray(layers,layer);layer.elesQueue=[];layer.invalid=true;if(layer.replacement){layer.replacement.invalid=true}for(var i=0;i=opts.deqFastCost*timeAvailable){break}}else{if(willDraw){if(duration>=opts.deqCost*renderTime||duration>=opts.deqAvgCost*avgRenderTime){break}}else if(frameDuration>=opts.deqNoDrawCost*fullFpsTime){break}}var thisDeqd=opts.deq(self,pixelRatio,extent);if(thisDeqd.length>0){for(var i=0;i0){opts.onDeqd(self,deqd);if(!willDraw&&opts.shouldRedraw(self,deqd,pixelRatio,extent)){queueRedraw()}}};var priority=opts.priority||util.noop;r.beforeRender(dequeue,priority(self))}}}},{"../../../util":132}],110:[function(require,module,exports){"use strict";module.exports=[{name:"null",impl:require("./null")},{name:"base",impl:require("./base")},{name:"canvas",impl:require("./canvas")}]},{"./base":92,"./canvas":106,"./null":111}],111:[function(require,module,exports){"use strict";function NullRenderer(options){this.options=options;this.notifications=0}var noop=function(){};NullRenderer.prototype={recalculateRenderedStyle:noop,notify:function(){this.notifications++},init:noop};module.exports=NullRenderer},{}],112:[function(require,module,exports){"use strict";var is=require("./is");var util=require("./util");var Thread=require("./thread");var Promise=require("./promise");var define=require("./define");var Fabric=function(N){if(!(this instanceof Fabric)){return new Fabric(N)}this._private={pass:[]};var defN=4;if(is.number(N)){}if(typeof navigator!=="undefined"&&navigator.hardwareConcurrency!=null){N=navigator.hardwareConcurrency}else{try{N=require("os").cpus().length}catch(err){N=defN}}for(var i=0;ib){return 1}return 0};self.require(cmp,"_$_$_cmp");return self.spread(function(split){var sortedSplit=split.sort(_$_$_cmp);resolve(sortedSplit)}).then(function(joined){var merge=function(i,j,max){j=Math.min(j,P);max=Math.min(max,P);var l=i;var r=j;var sorted=[];for(var k=l;k=max||cmp(eleI,eleJ)<=0)){sorted.push(eleI);i++}else{sorted.push(eleJ);j++}}for(var k=0;ky){return 1}return 0};insort=function(a,x,lo,hi,cmp){var mid;if(lo==null){lo=0}if(cmp==null){cmp=defaultCmp}if(lo<0){throw new Error("lo must be non-negative")}if(hi==null){hi=a.length}while(lo_ref;0<=_ref?_j++:_j--){_results1.push(_j)}return _results1}.apply(this).reverse();_results=[];for(_i=0,_len=_ref1.length;_i<_len;_i++){i=_ref1[_i];_results.push(_siftup(array,i,cmp))}return _results};updateItem=function(array,item,cmp){var pos;if(cmp==null){cmp=defaultCmp}pos=array.indexOf(item);if(pos===-1){return}_siftdown(array,0,pos,cmp);return _siftup(array,pos,cmp)};nlargest=function(array,n,cmp){var elem,result,_i,_len,_ref;if(cmp==null){cmp=defaultCmp}result=array.slice(0,n);if(!result.length){return result}heapify(result,cmp);_ref=array.slice(n);for(_i=0,_len=_ref.length;_i<_len;_i++){elem=_ref[_i];heappushpop(result,elem,cmp)}return result.sort(cmp).reverse()};nsmallest=function(array,n,cmp){var elem,i,los,result,_i,_j,_len,_ref,_ref1,_results;if(cmp==null){ +cmp=defaultCmp}if(n*10<=array.length){result=array.slice(0,n).sort(cmp);if(!result.length){return result}los=result[result.length-1];_ref=array.slice(n);for(_i=0,_len=_ref.length;_i<_len;_i++){elem=_ref[_i];if(cmp(elem,los)<0){insort(result,elem,0,null,cmp);result.pop();los=result[result.length-1]}}return result}heapify(array,cmp);_results=[];for(i=_j=0,_ref1=min(n,array.length);0<=_ref1?_j<_ref1:_j>_ref1;i=0<=_ref1?++_j:--_j){_results.push(heappop(array,cmp))}return _results};_siftdown=function(array,startpos,pos,cmp){var newitem,parent,parentpos;if(cmp==null){cmp=defaultCmp}newitem=array[pos];while(pos>startpos){parentpos=pos-1>>1;parent=array[parentpos];if(cmp(newitem,parent)<0){array[pos]=parent;pos=parentpos;continue}break}return array[pos]=newitem};_siftup=function(array,pos,cmp){var childpos,endpos,newitem,rightpos,startpos;if(cmp==null){cmp=defaultCmp}endpos=array.length;startpos=pos;newitem=array[pos];childpos=2*pos+1;while(childpos0){return 1}else if(x<0){return-1}else{return 0}};math.dist=function(p1,p2){return Math.sqrt(math.sqdist(p1,p2))};math.sqdist=function(p1,p2){var dx=p2.x-p1.x;var dy=p2.y-p1.y;return dx*dx+dy*dy};math.qbezierAt=function(p0,p1,p2,t){return(1-t)*(1-t)*p0+2*(1-t)*t*p1+t*t*p2};math.qbezierPtAt=function(p0,p1,p2,t){return{x:math.qbezierAt(p0.x,p1.x,p2.x,t),y:math.qbezierAt(p0.y,p1.y,p2.y,t)}};math.lineAt=function(p0,p1,t,d){var vec={x:p1.x-p0.x,y:p1.y-p0.y};var vecDist=math.dist(p0,p1);var normVec={x:vec.x/vecDist,y:vec.y/vecDist};t=t==null?0:t;var d=d!=null?d:t*vecDist;return{x:p0.x+normVec.x*d,y:p0.y+normVec.y*d}};math.lineAtDist=function(p0,p1,d){return math.lineAt(p0,p1,undefined,d)};math.triangleAngle=function(A,B,C){var a=math.dist(B,C);var b=math.dist(A,C);var c=math.dist(A,B);return Math.acos((a*a+b*b-c*c)/(2*a*b))};math.bound=function(min,val,max){return Math.max(min,Math.min(max,val))};math.makeBoundingBox=function(bb){if(bb==null){return{x1:Infinity,y1:Infinity,x2:-Infinity,y2:-Infinity,w:0,h:0}}else if(bb.x1!=null&&bb.y1!=null){if(bb.x2!=null&&bb.y2!=null&&bb.x2>=bb.x1&&bb.y2>=bb.y1){return{x1:bb.x1,y1:bb.y1,x2:bb.x2,y2:bb.y2,w:bb.x2-bb.x1,h:bb.y2-bb.y1}}else if(bb.w!=null&&bb.h!=null&&bb.w>=0&&bb.h>=0){return{x1:bb.x1,y1:bb.y1,x2:bb.x1+bb.w,y2:bb.y1+bb.h,w:bb.w,h:bb.h}}}};math.updateBoundingBox=function(bb1,bb2){bb1.x1=Math.min(bb1.x1,bb2.x1);bb1.x2=Math.max(bb1.x2,bb2.x2);bb1.w=bb1.x2-bb1.x1;bb1.y1=Math.min(bb1.y1,bb2.y1);bb1.y2=Math.max(bb1.y2,bb2.y2);bb1.h=bb1.y2-bb1.y1};math.expandBoundingBox=function(bb,padding){bb.x1-=padding;bb.x2+=padding;bb.y1-=padding;bb.y2+=padding;bb.w=bb.x2-bb.x1;bb.h=bb.y2-bb.y1;return bb};math.boundingBoxesIntersect=function(bb1,bb2){if(bb1.x1>bb2.x2){return false}if(bb2.x1>bb1.x2){return false}if(bb1.x2bb2.y2){return false}if(bb2.y1>bb1.y2){return false}return true};math.inBoundingBox=function(bb,x,y){return bb.x1<=x&&x<=bb.x2&&bb.y1<=y&&y<=bb.y2};math.pointInBoundingBox=function(bb,pt){return this.inBoundingBox(bb,pt.x,pt.y)};math.boundingBoxInBoundingBox=function(bb1,bb2){return math.inBoundingBox(bb1,bb2.x1,bb2.y1)&&math.inBoundingBox(bb1,bb2.x2,bb2.y2)};math.roundRectangleIntersectLine=function(x,y,nodeX,nodeY,width,height,padding){var cornerRadius=this.getRoundRectangleRadius(width,height);var halfWidth=width/2;var halfHeight=height/2;var straightLineIntersections;{var topStartX=nodeX-halfWidth+cornerRadius-padding;var topStartY=nodeY-halfHeight-padding;var topEndX=nodeX+halfWidth-cornerRadius+padding;var topEndY=topStartY;straightLineIntersections=this.finiteLinesIntersect(x,y,nodeX,nodeY,topStartX,topStartY,topEndX,topEndY,false);if(straightLineIntersections.length>0){return straightLineIntersections}}{var rightStartX=nodeX+halfWidth+padding;var rightStartY=nodeY-halfHeight+cornerRadius-padding;var rightEndX=rightStartX;var rightEndY=nodeY+halfHeight-cornerRadius+padding;straightLineIntersections=this.finiteLinesIntersect(x,y,nodeX,nodeY,rightStartX,rightStartY,rightEndX,rightEndY,false);if(straightLineIntersections.length>0){return straightLineIntersections}}{var bottomStartX=nodeX-halfWidth+cornerRadius-padding;var bottomStartY=nodeY+halfHeight+padding;var bottomEndX=nodeX+halfWidth-cornerRadius+padding;var bottomEndY=bottomStartY;straightLineIntersections=this.finiteLinesIntersect(x,y,nodeX,nodeY,bottomStartX,bottomStartY,bottomEndX,bottomEndY,false);if(straightLineIntersections.length>0){return straightLineIntersections}}{var leftStartX=nodeX-halfWidth-padding;var leftStartY=nodeY-halfHeight+cornerRadius-padding;var leftEndX=leftStartX;var leftEndY=nodeY+halfHeight-cornerRadius+padding;straightLineIntersections=this.finiteLinesIntersect(x,y,nodeX,nodeY,leftStartX,leftStartY,leftEndX,leftEndY,false);if(straightLineIntersections.length>0){return straightLineIntersections}}var arcIntersections;{var topLeftCenterX=nodeX-halfWidth+cornerRadius;var topLeftCenterY=nodeY-halfHeight+cornerRadius;arcIntersections=this.intersectLineCircle(x,y,nodeX,nodeY,topLeftCenterX,topLeftCenterY,cornerRadius+padding);if(arcIntersections.length>0&&arcIntersections[0]<=topLeftCenterX&&arcIntersections[1]<=topLeftCenterY){return[arcIntersections[0],arcIntersections[1]]}}{var topRightCenterX=nodeX+halfWidth-cornerRadius;var topRightCenterY=nodeY-halfHeight+cornerRadius;arcIntersections=this.intersectLineCircle(x,y,nodeX,nodeY,topRightCenterX,topRightCenterY,cornerRadius+padding);if(arcIntersections.length>0&&arcIntersections[0]>=topRightCenterX&&arcIntersections[1]<=topRightCenterY){return[arcIntersections[0],arcIntersections[1]]}}{var bottomRightCenterX=nodeX+halfWidth-cornerRadius;var bottomRightCenterY=nodeY+halfHeight-cornerRadius;arcIntersections=this.intersectLineCircle(x,y,nodeX,nodeY,bottomRightCenterX,bottomRightCenterY,cornerRadius+padding);if(arcIntersections.length>0&&arcIntersections[0]>=bottomRightCenterX&&arcIntersections[1]>=bottomRightCenterY){return[arcIntersections[0],arcIntersections[1]]}}{var bottomLeftCenterX=nodeX-halfWidth+cornerRadius;var bottomLeftCenterY=nodeY+halfHeight-cornerRadius;arcIntersections=this.intersectLineCircle(x,y,nodeX,nodeY,bottomLeftCenterX,bottomLeftCenterY,cornerRadius+padding);if(arcIntersections.length>0&&arcIntersections[0]<=bottomLeftCenterX&&arcIntersections[1]>=bottomLeftCenterY){return[arcIntersections[0],arcIntersections[1]]}}return[]};math.inLineVicinity=function(x,y,lx1,ly1,lx2,ly2,tolerance){var t=tolerance;var x1=Math.min(lx1,lx2);var x2=Math.max(lx1,lx2);var y1=Math.min(ly1,ly2);var y2=Math.max(ly1,ly2);return x1-t<=x&&x<=x2+t&&y1-t<=y&&y<=y2+t};math.inBezierVicinity=function(x,y,x1,y1,x2,y2,x3,y3,tolerance){var bb={x1:Math.min(x1,x3,x2)-tolerance,x2:Math.max(x1,x3,x2)+tolerance,y1:Math.min(y1,y3,y2)-tolerance,y2:Math.max(y1,y3,y2)+tolerance};if(xbb.x2||ybb.y2){return false}else{return true}};math.solveCubic=function(a,b,c,d,result){b/=a;c/=a;d/=a;var discriminant,q,r,dum1,s,t,term1,r13;q=(3*c-b*b)/9;r=-(27*d)+b*(9*c-2*(b*b));r/=54;discriminant=q*q*q+r*r;result[1]=0;term1=b/3;if(discriminant>0){s=r+Math.sqrt(discriminant);s=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3);t=r-Math.sqrt(discriminant);t=t<0?-Math.pow(-t,1/3):Math.pow(t,1/3);result[0]=-term1+s+t;term1+=(s+t)/2;result[4]=result[2]=-term1;term1=Math.sqrt(3)*(-t+s)/2;result[3]=term1;result[5]=-term1;return}result[5]=result[3]=0;if(discriminant===0){r13=r<0?-Math.pow(-r,1/3):Math.pow(r,1/3);result[0]=-term1+2*r13;result[4]=result[2]=-(r13+term1);return}q=-q;dum1=q*q*q;dum1=Math.acos(r/Math.sqrt(dum1));r13=2*Math.sqrt(q);result[0]=-term1+r13*Math.cos(dum1/3);result[2]=-term1+r13*Math.cos((dum1+2*Math.PI)/3);result[4]=-term1+r13*Math.cos((dum1+4*Math.PI)/3);return};math.sqdistToQuadraticBezier=function(x,y,x1,y1,x2,y2,x3,y3){var a=1*x1*x1-4*x1*x2+2*x1*x3+4*x2*x2-4*x2*x3+x3*x3+y1*y1-4*y1*y2+2*y1*y3+4*y2*y2-4*y2*y3+y3*y3;var b=1*9*x1*x2-3*x1*x1-3*x1*x3-6*x2*x2+3*x2*x3+9*y1*y2-3*y1*y1-3*y1*y3-6*y2*y2+3*y2*y3;var c=1*3*x1*x1-6*x1*x2+x1*x3-x1*x+2*x2*x2+2*x2*x-x3*x+3*y1*y1-6*y1*y2+y1*y3-y1*y+2*y2*y2+2*y2*y-y3*y;var d=1*x1*x2-x1*x1+x1*x-x2*x+y1*y2-y1*y1+y1*y-y2*y;var roots=[];this.solveCubic(a,b,c,d,roots);var zeroThreshold=1e-7;var params=[];for(var index=0;index<6;index+=2){if(Math.abs(roots[index+1])=0&&roots[index]<=1){params.push(roots[index])}}params.push(1);params.push(0);var minDistanceSquared=-1;var closestParam;var curX,curY,distSquared;for(var i=0;i=0){if(distSquaredlineSq){return(x-x2)*(x-x2)+(y-y2)*(y-y2)}return hypSq-adjSq};math.pointInsidePolygonPoints=function(x,y,points){var x1,y1,x2,y2;var y3;var up=0;var down=0;for(var i=0;i=x&&x>=x2||x1<=x&&x<=x2){y3=(x-x1)/(x2-x1)*(y2-y1)+y1;if(y3>y){up++}if(y30){var expandedLineSet=this.expandPolygon(transformedPoints,-padding);points=this.joinLines(expandedLineSet)}else{points=transformedPoints}return math.pointInsidePolygonPoints(x,y,points)};math.joinLines=function(lineSet){var vertices=new Array(lineSet.length/2);var currentLineStartX,currentLineStartY,currentLineEndX,currentLineEndY;var nextLineStartX,nextLineStartY,nextLineEndX,nextLineEndY;for(var i=0;i=0&&tMin<=1){inRangeParams.push(tMin)}if(tMax>=0&&tMax<=1){inRangeParams.push(tMax)}if(inRangeParams.length===0){return[]}var nearIntersectionX=inRangeParams[0]*d[0]+x1;var nearIntersectionY=inRangeParams[0]*d[1]+y1;if(inRangeParams.length>1){if(inRangeParams[0]==inRangeParams[1]){return[nearIntersectionX,nearIntersectionY]}else{var farIntersectionX=inRangeParams[1]*d[0]+x1;var farIntersectionY=inRangeParams[1]*d[1]+y1;return[nearIntersectionX,nearIntersectionY,farIntersectionX,farIntersectionY]}}else{return[nearIntersectionX,nearIntersectionY]}};math.findCircleNearPoint=function(centerX,centerY,radius,farX,farY){var displacementX=farX-centerX;var displacementY=farY-centerY;var distance=Math.sqrt(displacementX*displacementX+displacementY*displacementY);var unitDisplacementX=displacementX/distance;var unitDisplacementY=displacementY/distance;return[centerX+unitDisplacementX*radius,centerY+unitDisplacementY*radius]};math.findMaxSqDistanceToOrigin=function(points){var maxSqDistance=1e-6;var sqDistance;for(var i=0;imaxSqDistance){maxSqDistance=sqDistance}}return maxSqDistance};math.midOfThree=function(a,b,c){if(b<=a&&a<=c||c<=a&&a<=b){return a}else if(a<=b&&b<=c||c<=b&&b<=a){return b}else{return c}};math.finiteLinesIntersect=function(x1,y1,x2,y2,x3,y3,x4,y4,infiniteLines){var dx13=x1-x3;var dx21=x2-x1;var dx43=x4-x3;var dy13=y1-y3;var dy21=y2-y1;var dy43=y4-y3;var ua_t=dx43*dy13-dy43*dx13;var ub_t=dx21*dy13-dy21*dx13;var u_b=dy43*dx21-dx43*dy21;if(u_b!==0){var ua=ua_t/u_b;var ub=ub_t/u_b;var flptThreshold=.001;var min=0-flptThreshold;var max=1+flptThreshold;if(min<=ua&&ua<=max&&min<=ub&&ub<=max){return[x1+ua*dx21,y1+ua*dy21]}else{if(!infiniteLines){return[]}else{return[x1+ua*dx21,y1+ua*dy21]}}}else{if(ua_t===0||ub_t===0){if(this.midOfThree(x1,x2,x4)===x4){return[x4,y4]}if(this.midOfThree(x1,x2,x3)===x3){return[x3,y3]}if(this.midOfThree(x3,x4,x2)===x2){return[x2,y2]}return[]}else{return[]}}};math.polygonIntersectLine=function(x,y,basePoints,centerX,centerY,width,height,padding){var intersections=[];var intersection;var transformedPoints=new Array(basePoints.length);for(var i=0;i0){var expandedLineSet=math.expandPolygon(transformedPoints,-padding);points=math.joinLines(expandedLineSet)}else{points=transformedPoints}var currentX,currentY,nextX,nextY;for(var i=0;i\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:'"(?:\\\\"|[^"])+"'+"|"+"'(?:\\\\'|[^'])+'",number:util.regex.number,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$"};tokens.variable="(?:[\\w-]|(?:\\\\"+tokens.metaChar+"))+";tokens.value=tokens.string+"|"+tokens.number;tokens.className=tokens.variable;tokens.id=tokens.variable;var cleanMetaChars=function(str){return str.replace(new RegExp("\\\\("+tokens.metaChar+")","g"),function(match,$1,offset,original){return $1})};var ops=tokens.comparatorOp.split("|");for(var i=0;i=0){continue}if(op==="="){continue}tokens.comparatorOp+="|\\!"+op}var exprs=[{name:"group",query:true,regex:"(node|edge|\\*)",populate:function(group){this.group=group==="*"?group:group+"s"}},{name:"state",query:true,regex:"(:selected|:unselected|:locked|:unlocked|:visible|:hidden|:transparent|:grabbed|:free|:removed|:inside|:grabbable|:ungrabbable|:animated|:unanimated|:selectable|:unselectable|:orphan|:nonorphan|:parent|:child|:loop|:simple|:active|:inactive|:touch|:backgrounding|:nonbackgrounding)",populate:function(state){this.colonSelectors.push(state)}},{name:"id",query:true,regex:"\\#("+tokens.id+")",populate:function(id){this.ids.push(cleanMetaChars(id))}},{name:"className",query:true,regex:"\\.("+tokens.className+")",populate:function(className){this.classes.push(cleanMetaChars(className))}},{name:"dataExists",query:true,regex:"\\[\\s*("+tokens.variable+")\\s*\\]",populate:function(variable){this.data.push({field:cleanMetaChars(variable)})}},{name:"dataCompare",query:true,regex:"\\[\\s*("+tokens.variable+")\\s*("+tokens.comparatorOp+")\\s*("+tokens.value+")\\s*\\]",populate:function(variable,comparatorOp,value){var valueIsString=new RegExp("^"+tokens.string+"$").exec(value)!=null;if(valueIsString){value=value.substring(1,value.length-1)}else{value=parseFloat(value)}this.data.push({field:cleanMetaChars(variable),operator:comparatorOp,value:value})}},{name:"dataBool",query:true,regex:"\\[\\s*("+tokens.boolOp+")\\s*("+tokens.variable+")\\s*\\]",populate:function(boolOp,variable){this.data.push({field:cleanMetaChars(variable),operator:boolOp})}},{name:"metaCompare",query:true,regex:"\\[\\[\\s*("+tokens.meta+")\\s*("+tokens.comparatorOp+")\\s*("+tokens.number+")\\s*\\]\\]",populate:function(meta,comparatorOp,number){this.meta.push({field:cleanMetaChars(meta),operator:comparatorOp,value:parseFloat(number)})}},{name:"nextQuery",separator:true,regex:tokens.separator,populate:function(){self[++i]=newQuery();currentSubject=null}},{name:"child",separator:true,regex:tokens.child,populate:function(){var childQuery=newQuery();childQuery.parent=this;childQuery.subject=currentSubject;self[i]=childQuery}},{name:"descendant",separator:true,regex:tokens.descendant,populate:function(){var descendantQuery=newQuery();descendantQuery.ancestor=this;descendantQuery.subject=currentSubject;self[i]=descendantQuery}},{name:"subject",modifier:true,regex:tokens.subject,populate:function(){ +if(currentSubject!=null&&this.subject!=this){util.error("Redefinition of subject in selector `"+selector+"`");return false}currentSubject=this;this.subject=this}}];self._private.selectorText=selector;var remaining=selector;var i=0;var consumeExpr=function(expectation){var expr;var match;var name;for(var j=0;j=0){fieldStr=fieldStr.toLowerCase();valStr=valStr.toLowerCase();operator=operator.replace("@","");caseInsensitive=true}var notExpr=false;if(operator.indexOf("!")>=0){operator=operator.replace("!","");notExpr=true}if(caseInsensitive){value=valStr.toLowerCase();fieldVal=fieldStr.toLowerCase()}var isIneqCmp=false;switch(operator){case"*=":matches=fieldStr.indexOf(valStr)>=0;break;case"$=":matches=fieldStr.indexOf(valStr,fieldStr.length-valStr.length)>=0;break;case"^=":matches=fieldStr.indexOf(valStr)===0;break;case"=":matches=fieldVal===value;break;case">":isIneqCmp=true;matches=fieldVal>value;break;case">=":isIneqCmp=true;matches=fieldVal>=value;break;case"<":isIneqCmp=true;matches=fieldVal "+str}if(query.ancestor!=null){str=queryToString(query.ancestor)+" "+str}if(query.child!=null){str+=" > "+queryToString(query.child)}if(query.descendant!=null){str+=" "+queryToString(query.descendant)}return str};for(var i=0;i1&&i0;if(cxtHasDiffed||cxtHasMappedProps){var props;if(cxtHasDiffed&&cxtHasMappedProps){props=cxt.properties}else if(cxtHasDiffed){props=cxt.properties}else if(cxtHasMappedProps){props=cxt.mappedProperties}for(var j=0;j0){hasPie=true;break}}}_p.hasPie=hasPie;var transform=ele.pstyle("text-transform").strValue;var content=ele.pstyle("label").strValue;var srcContent=ele.pstyle("source-label").strValue;var tgtContent=ele.pstyle("target-label").strValue;var fStyle=ele.pstyle("font-style").strValue;var size=ele.pstyle("font-size").pfValue+"px";var family=ele.pstyle("font-family").strValue;var weight=ele.pstyle("font-weight").strValue;var valign=ele.pstyle("text-valign").strValue;var halign=ele.pstyle("text-valign").strValue;var oWidth=ele.pstyle("text-outline-width").pfValue;var wrap=ele.pstyle("text-wrap").strValue;var wrapW=ele.pstyle("text-max-width").pfValue;var labelStyleKey=fStyle+"$"+size+"$"+family+"$"+weight+"$"+transform+"$"+valign+"$"+halign+"$"+oWidth+"$"+wrap+"$"+wrapW;_p.labelStyleKey=labelStyleKey;_p.sourceLabelKey=labelStyleKey+"$"+srcContent;_p.targetLabelKey=labelStyleKey+"$"+tgtContent;_p.labelKey=labelStyleKey+"$"+content;_p.fontKey=fStyle+"$"+weight+"$"+size+"$"+family;_p.styleKey=Date.now()};styfn.applyParsedProperty=function(ele,parsedProp){var self=this;var prop=parsedProp;var style=ele._private.style;var fieldVal,flatProp;var types=self.types;var type=self.properties[prop.name].type;var propIsBypass=prop.bypass;var origProp=style[prop.name];var origPropIsBypass=origProp&&origProp.bypass;var _p=ele._private;if(parsedProp.name==="curve-style"&&parsedProp.value==="haystack"&&ele.isEdge()&&(ele.isLoop()||ele.source().isParent()||ele.target().isParent())){prop=parsedProp=this.parse(parsedProp.name,"bezier",propIsBypass)}if(prop.delete){style[prop.name]=undefined;return true}if(prop.deleteBypassed){if(!origProp){return true}else if(origProp.bypass){origProp.bypassed=undefined;return true}else{return false}}if(prop.deleteBypass){if(!origProp){return true}else if(origProp.bypass){style[prop.name]=origProp.bypassed;return true}else{return false}}var printMappingErr=function(){util.error("Do not assign mappings to elements without corresponding data (e.g. ele `"+ele.id()+"` for property `"+prop.name+"` with data field `"+prop.field+"`); try a `["+prop.field+"]` selector to limit scope to elements with `"+prop.field+"` defined")};switch(prop.mapped){case types.mapData:case types.mapLayoutData:case types.mapScratch:var isLayout=prop.mapped===types.mapLayoutData;var isScratch=prop.mapped===types.mapScratch;var fields=prop.field.split(".");var fieldVal;if(isScratch||isLayout){fieldVal=_p.scratch}else{fieldVal=_p.data}for(var i=0;i1){percent=1}if(type.color){var r1=prop.valueMin[0];var r2=prop.valueMax[0];var g1=prop.valueMin[1];var g2=prop.valueMax[1];var b1=prop.valueMin[2];var b2=prop.valueMax[2];var a1=prop.valueMin[3]==null?1:prop.valueMin[3];var a2=prop.valueMax[3]==null?1:prop.valueMax[3];var clr=[Math.round(r1+(r2-r1)*percent),Math.round(g1+(g2-g1)*percent),Math.round(b1+(b2-b1)*percent),Math.round(a1+(a2-a1)*percent)];flatProp={bypass:prop.bypass,name:prop.name,value:clr,strValue:"rgb("+clr[0]+", "+clr[1]+", "+clr[2]+")"}}else if(type.number){var calcValue=prop.valueMin+(prop.valueMax-prop.valueMin)*percent;flatProp=this.parse(prop.name,calcValue,prop.bypass,true)}else{return false}if(!flatProp){flatProp=this.parse(prop.name,origProp.strValue,prop.bypass,true)}if(!flatProp){printMappingErr()}flatProp.mapping=prop;prop=flatProp;break;case types.data:case types.layoutData:case types.scratch:var isLayout=prop.mapped===types.layoutData;var isScratch=prop.mapped===types.scratch;var fields=prop.field.split(".");var fieldVal;if(isScratch||isLayout){fieldVal=_p.scratch}else{fieldVal=_p.data}if(fieldVal){for(var i=0;i0&&duration>0){var css={};var anyPrev=false;for(var i=0;i0){ele.delay(delay)}ele.animate({css:css},{duration:duration,easing:ele.pstyle("transition-timing-function").value,queue:false,complete:function(){if(!isBypass){self.removeBypasses(ele,props)}_p.transitioning=false}})}else if(_p.transitioning){ele.stop();this.removeBypasses(ele,props);_p.transitioning=false}};module.exports=styfn},{"../is":115,"../util":132}],121:[function(require,module,exports){"use strict";var is=require("../is");var util=require("../util");var styfn={};styfn.applyBypass=function(eles,name,value,updateTransitions){var self=this;var props=[];var isBypass=true;if(name==="*"||name==="**"){if(value!==undefined){for(var i=0;itype.max){return null}var ret={name:name,value:value,strValue:""+value+(units?units:""),units:units,bypass:propIsBypass};if(type.unitless||units!=="px"&&units!=="em"){ret.pfValue=value}else{ret.pfValue=units==="px"||!units?value:this.getEmSizeInPixels()*value}if(units==="ms"||units==="s"){ret.pfValue=units==="ms"?value:1e3*value}if(units==="deg"||units==="rad"){ret.pfValue=units==="rad"?value:math.deg2rad(value)}return ret}else if(type.propList){var props=[];var propsStr=""+value;if(propsStr==="none"){}else{var propsSplit=propsStr.split(",");for(var i=0;i node").css({shape:"rectangle","padding-top":10,"padding-right":10,"padding-left":10,"padding-bottom":10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3,"curve-style":"haystack"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector("node:parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}).selector("core").css({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125});this.defaultLength=this.length};module.exports=styfn},{"../util":132}],128:[function(require,module,exports){"use strict";var util=require("../util");var Selector=require("../selector");var styfn={};styfn.applyFromString=function(string){var self=this;var style=this;var remaining=""+string;var selAndBlockStr;var blockRem;var propAndValStr;remaining=remaining.replace(/[\/][*](\s|.)+?[*][\/]/g,"");function removeSelAndBlockFromRemaining(){if(remaining.length>selAndBlockStr.length){remaining=remaining.substr(selAndBlockStr.length)}else{remaining=""}}function removePropAndValFromRem(){if(blockRem.length>propAndValStr.length){blockRem=blockRem.substr(propAndValStr.length)}else{blockRem=""}}while(true){var nothingLeftToParse=remaining.match(/^\s*$/);if(nothingLeftToParse){break}var selAndBlock=remaining.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!selAndBlock){util.error("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+remaining);break}selAndBlockStr=selAndBlock[0];var selectorStr=selAndBlock[1];if(selectorStr!=="core"){var selector=new Selector(selectorStr);if(selector._private.invalid){util.error("Skipping parsing of block: Invalid selector found in string stylesheet: "+selectorStr);removeSelAndBlockFromRemaining();continue}}var blockStr=selAndBlock[2];var invalidBlock=false;blockRem=blockStr;var props=[];while(true){var nothingLeftToParse=blockRem.match(/^\s*$/);if(nothingLeftToParse){break}var propAndVal=blockRem.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!propAndVal){util.error("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+blockStr);invalidBlock=true;break}propAndValStr=propAndVal[0];var propStr=propAndVal[1];var valStr=propAndVal[2];var prop=self.properties[propStr];if(!prop){util.error("Skipping property: Invalid property name in: "+propAndValStr);removePropAndValFromRem();continue}var parsedProp=style.parse(propStr,valStr);if(!parsedProp){util.error("Skipping property: Invalid property definition in: "+propAndValStr);removePropAndValFromRem();continue}props.push({name:propStr,val:valStr});removePropAndValFromRem()}if(invalidBlock){removeSelAndBlockFromRemaining();break}style.selector(selectorStr);for(var i=0;i1?", "+JSON.stringify(arg1):"")+" );"," "," resolve = origResolve;"," resolve( res.length > 0 ? res : ret );","}"].join("\n"))}};util.extend(thdfn,{reduce:defineFnal({name:"reduce"}),reduceRight:defineFnal({name:"reduceRight"}),map:defineFnal({name:"map"})});var fn=thdfn;fn.promise=fn.run;fn.terminate=fn.halt=fn.stop;fn.include=fn.require;util.extend(thdfn,{on:define.on(),one:define.on({unbindSelfOnTrigger:true}),off:define.off(),trigger:define.trigger()});define.eventAliasesOn(thdfn);module.exports=Thread}).call(this,"/node_modules/cytoscape/src")},{"./define":76,"./event":77,"./is":115,"./promise":118,"./util":132,"./window":139,child_process:201,path:203}],131:[function(require,module,exports){"use strict";var is=require("../is");module.exports={hex2tuple:function(hex){if(!(hex.length===4||hex.length===7)||hex[0]!=="#"){return}var shortHex=hex.length===4;var r,g,b;var base=16;if(shortHex){r=parseInt(hex[1]+hex[1],base);g=parseInt(hex[2]+hex[2],base);b=parseInt(hex[3]+hex[3],base)}else{r=parseInt(hex[1]+hex[2],base);g=parseInt(hex[3]+hex[4],base);b=parseInt(hex[5]+hex[6],base)}return[r,g,b]},hsl2tuple:function(hsl){var ret;var h,s,l,a,r,g,b;function hue2rgb(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p}var m=new RegExp("^"+this.regex.hsla+"$").exec(hsl);if(m){h=parseInt(m[1]);if(h<0){h=(360- -1*h%360)%360}else if(h>360){h=h%360}h/=360;s=parseFloat(m[2]);if(s<0||s>100){return}s=s/100;l=parseFloat(m[3]);if(l<0||l>100){return}l=l/100;a=m[4];if(a!==undefined){a=parseFloat(a);if(a<0||a>1){return}}if(s===0){r=g=b=Math.round(l*255)}else{var q=l<.5?l*(1+s):l+s-l*s;var p=2*l-q;r=Math.round(255*hue2rgb(p,q,h+1/3));g=Math.round(255*hue2rgb(p,q,h));b=Math.round(255*hue2rgb(p,q,h-1/3))}ret=[r,g,b,a]}return ret},rgb2tuple:function(rgb){var ret;var m=new RegExp("^"+this.regex.rgba+"$").exec(rgb);if(m){ret=[];var isPct=[];for(var i=1;i<=3;i++){var channel=m[i];if(channel[channel.length-1]==="%"){isPct[i]=true}channel=parseFloat(channel);if(isPct[i]){channel=channel/100*255}if(channel<0||channel>255){return}ret.push(Math.floor(channel))}var atLeastOneIsPct=isPct[1]||isPct[2]||isPct[3];var allArePct=isPct[1]&&isPct[2]&&isPct[3];if(atLeastOneIsPct&&!allArePct){return}var alpha=m[4];if(alpha!==undefined){alpha=parseFloat(alpha);if(alpha<0||alpha>1){return}ret.push(alpha)}}return ret},colorname2tuple:function(color){return this.colors[color.toLowerCase()]},color2tuple:function(color){return(is.array(color)?color:null)||this.colorname2tuple(color)||this.hex2tuple(color)||this.rgb2tuple(color)||this.hsl2tuple(color)},colors:{transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96], +seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}}},{"../is":115}],132:[function(require,module,exports){"use strict";var is=require("../is");var math=require("../math");var util={trueify:function(){return true},falsify:function(){return false},zeroify:function(){return 0},noop:function(){},error:function(msg){if(console.error){console.error.apply(console,arguments);if(console.trace){console.trace()}}else{console.log.apply(console,arguments);if(console.trace){console.trace()}}},clone:function(obj){return this.extend({},obj)},copy:function(obj){if(obj==null){return obj}if(is.array(obj)){return obj.slice()}else if(is.plainObject(obj)){return this.clone(obj)}else{return obj}},uuid:function(a,b){for(b=a="";a++<36;b+=a*51&52?(a^15?8^Math.random()*(a^20?16:4):4).toString(16):"-");return b}};util.makeBoundingBox=math.makeBoundingBox.bind(math);util._staticEmptyObject={};util.staticEmptyObject=function(){return util._staticEmptyObject};util.extend=Object.assign!=null?Object.assign:function(tgt){var args=arguments;for(var i=1;i=0;i--){if(arr[i]===ele){arr.splice(i,1);if(!manyCopies){break}}}};util.clearArray=function(arr){arr.splice(0,arr.length)};util.getPrefixedProperty=function(obj,propName,prefix){if(prefix){propName=this.prependCamel(prefix,propName)}return obj[propName]};util.setPrefixedProperty=function(obj,propName,prefix,value){if(prefix){propName=this.prependCamel(prefix,propName)}obj[propName]=value};[require("./colors"),require("./maps"),{memoize:require("./memoize")},require("./regex"),require("./strings"),require("./timing")].forEach(function(req){util.extend(util,req)});module.exports=util},{"../is":115,"../math":117,"./colors":131,"./maps":133,"./memoize":134,"./regex":135,"./strings":136,"./timing":137}],133:[function(require,module,exports){"use strict";var is=require("../is");module.exports={mapEmpty:function(map){var empty=true;if(map!=null){return Object.keys(map).length===0}return empty},pushMap:function(options){var array=this.getMap(options);if(array==null){this.setMap(this.extend({},options,{value:[options.value]}))}else{array.push(options.value)}},setMap:function(options){var obj=options.map;var key;var keys=options.keys;var l=keys.length;for(var i=0;i=0&&j=0},isPlainObject:function(obj){var key;if(jQuery.type(obj)!=="object"||obj.nodeType||jQuery.isWindow(obj)){return false}if(obj.constructor&&!hasOwn.call(obj,"constructor")&&!hasOwn.call(obj.constructor.prototype||{},"isPrototypeOf")){return false}for(key in obj){}return key===undefined||hasOwn.call(obj,key)},isEmptyObject:function(obj){var name;for(name in obj){return false}return true},type:function(obj){if(obj==null){return obj+""}return typeof obj==="object"||typeof obj==="function"?class2type[toString.call(obj)]||"object":typeof obj},globalEval:function(code){var script,indirect=eval;code=jQuery.trim(code);if(code){if(code.indexOf("use strict")===1){script=document.createElement("script");script.text=code;document.head.appendChild(script).parentNode.removeChild(script)}else{indirect(code)}}},camelCase:function(string){return string.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase)},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toLowerCase()===name.toLowerCase()},each:function(obj,callback){var length,i=0;if(isArrayLike(obj)){length=obj.length;for(;i0&&length-1 in obj}var Sizzle=function(window){var i,support,Expr,getText,isXML,tokenize,compile,select,outermostContext,sortInput,hasDuplicate,setDocument,document,docElem,documentIsHTML,rbuggyQSA,rbuggyMatches,matches,contains,expando="sizzle"+1*new Date,preferredDoc=window.document,dirruns=0,done=0,classCache=createCache(),tokenCache=createCache(),compilerCache=createCache(),sortOrder=function(a,b){if(a===b){hasDuplicate=true}return 0},MAX_NEGATIVE=1<<31,hasOwn={}.hasOwnProperty,arr=[],pop=arr.pop,push_native=arr.push,push=arr.push,slice=arr.slice,indexOf=function(list,elem){var i=0,len=list.length;for(;i+~]|"+whitespace+")"+whitespace+"*"),rattributeQuotes=new RegExp("="+whitespace+"*([^\\]'\"]*?)"+whitespace+"*\\]","g"),rpseudo=new RegExp(pseudos),ridentifier=new RegExp("^"+identifier+"$"),matchExpr={ID:new RegExp("^#("+identifier+")"),CLASS:new RegExp("^\\.("+identifier+")"),TAG:new RegExp("^("+identifier+"|[*])"),ATTR:new RegExp("^"+attributes),PSEUDO:new RegExp("^"+pseudos),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+whitespace+"*(even|odd|(([+-]|)(\\d*)n|)"+whitespace+"*(?:([+-]|)"+whitespace+"*(\\d+)|))"+whitespace+"*\\)|)","i"),bool:new RegExp("^(?:"+booleans+")$","i"),needsContext:new RegExp("^"+whitespace+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+whitespace+"*((?:-\\d)?\\d*)"+whitespace+"*\\)|)(?=[^-]|$)","i")},rinputs=/^(?:input|select|textarea|button)$/i,rheader=/^h\d$/i,rnative=/^[^{]+\{\s*\[native \w/,rquickExpr=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,rsibling=/[+~]/,rescape=/'|\\/g,runescape=new RegExp("\\\\([\\da-f]{1,6}"+whitespace+"?|("+whitespace+")|.)","ig"),funescape=function(_,escaped,escapedWhitespace){var high="0x"+escaped-65536;return high!==high||escapedWhitespace?escaped:high<0?String.fromCharCode(high+65536):String.fromCharCode(high>>10|55296,high&1023|56320)},unloadHandler=function(){setDocument()};try{push.apply(arr=slice.call(preferredDoc.childNodes),preferredDoc.childNodes);arr[preferredDoc.childNodes.length].nodeType}catch(e){push={apply:arr.length?function(target,els){push_native.apply(target,slice.call(els))}:function(target,els){var j=target.length,i=0;while(target[j++]=els[i++]){}target.length=j-1}}}function Sizzle(selector,context,results,seed){var m,i,elem,nid,nidselect,match,groups,newSelector,newContext=context&&context.ownerDocument,nodeType=context?context.nodeType:9;results=results||[];if(typeof selector!=="string"||!selector||nodeType!==1&&nodeType!==9&&nodeType!==11){return results}if(!seed){if((context?context.ownerDocument||context:preferredDoc)!==document){setDocument(context)}context=context||document;if(documentIsHTML){if(nodeType!==11&&(match=rquickExpr.exec(selector))){if(m=match[1]){if(nodeType===9){if(elem=context.getElementById(m)){if(elem.id===m){results.push(elem);return results}}else{return results}}else{if(newContext&&(elem=newContext.getElementById(m))&&contains(context,elem)&&elem.id===m){results.push(elem);return results}}}else if(match[2]){push.apply(results,context.getElementsByTagName(selector));return results}else if((m=match[3])&&support.getElementsByClassName&&context.getElementsByClassName){push.apply(results,context.getElementsByClassName(m));return results}}if(support.qsa&&!compilerCache[selector+" "]&&(!rbuggyQSA||!rbuggyQSA.test(selector))){if(nodeType!==1){newContext=context;newSelector=selector}else if(context.nodeName.toLowerCase()!=="object"){if(nid=context.getAttribute("id")){nid=nid.replace(rescape,"\\$&")}else{context.setAttribute("id",nid=expando)}groups=tokenize(selector);i=groups.length;nidselect=ridentifier.test(nid)?"#"+nid:"[id='"+nid+"']";while(i--){groups[i]=nidselect+" "+toSelector(groups[i])}newSelector=groups.join(",");newContext=rsibling.test(selector)&&testContext(context.parentNode)||context}if(newSelector){try{push.apply(results,newContext.querySelectorAll(newSelector));return results}catch(qsaError){}finally{if(nid===expando){context.removeAttribute("id")}}}}}}return select(selector.replace(rtrim,"$1"),context,results,seed)}function createCache(){var keys=[];function cache(key,value){if(keys.push(key+" ")>Expr.cacheLength){delete cache[keys.shift()]}return cache[key+" "]=value}return cache}function markFunction(fn){fn[expando]=true;return fn}function assert(fn){var div=document.createElement("div");try{return!!fn(div)}catch(e){return false}finally{if(div.parentNode){div.parentNode.removeChild(div)}div=null}}function addHandle(attrs,handler){var arr=attrs.split("|"),i=arr.length;while(i--){Expr.attrHandle[arr[i]]=handler}}function siblingCheck(a,b){var cur=b&&a,diff=cur&&a.nodeType===1&&b.nodeType===1&&(~b.sourceIndex||MAX_NEGATIVE)-(~a.sourceIndex||MAX_NEGATIVE);if(diff){return diff}if(cur){while(cur=cur.nextSibling){if(cur===b){return-1}}}return a?1:-1}function createInputPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type===type}}function createButtonPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&elem.type===type}}function createPositionalPseudo(fn){return markFunction(function(argument){argument=+argument;return markFunction(function(seed,matches){var j,matchIndexes=fn([],seed.length,argument),i=matchIndexes.length;while(i--){if(seed[j=matchIndexes[i]]){seed[j]=!(matches[j]=seed[j])}}})})}function testContext(context){return context&&typeof context.getElementsByTagName!=="undefined"&&context}support=Sizzle.support={};isXML=Sizzle.isXML=function(elem){var documentElement=elem&&(elem.ownerDocument||elem).documentElement;return documentElement?documentElement.nodeName!=="HTML":false};setDocument=Sizzle.setDocument=function(node){var hasCompare,parent,doc=node?node.ownerDocument||node:preferredDoc;if(doc===document||doc.nodeType!==9||!doc.documentElement){return document}document=doc;docElem=document.documentElement;documentIsHTML=!isXML(document);if((parent=document.defaultView)&&parent.top!==parent){if(parent.addEventListener){parent.addEventListener("unload",unloadHandler,false)}else if(parent.attachEvent){parent.attachEvent("onunload",unloadHandler)}}support.attributes=assert(function(div){div.className="i";return!div.getAttribute("className")});support.getElementsByTagName=assert(function(div){div.appendChild(document.createComment(""));return!div.getElementsByTagName("*").length});support.getElementsByClassName=rnative.test(document.getElementsByClassName);support.getById=assert(function(div){docElem.appendChild(div).id=expando;return!document.getElementsByName||!document.getElementsByName(expando).length});if(support.getById){Expr.find["ID"]=function(id,context){if(typeof context.getElementById!=="undefined"&&documentIsHTML){var m=context.getElementById(id);return m?[m]:[]}};Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){return elem.getAttribute("id")===attrId}}}else{delete Expr.find["ID"];Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return node&&node.value===attrId}}}Expr.find["TAG"]=support.getElementsByTagName?function(tag,context){if(typeof context.getElementsByTagName!=="undefined"){return context.getElementsByTagName(tag)}else if(support.qsa){return context.querySelectorAll(tag)}}:function(tag,context){var elem,tmp=[],i=0,results=context.getElementsByTagName(tag);if(tag==="*"){while(elem=results[i++]){if(elem.nodeType===1){tmp.push(elem)}}return tmp}return results};Expr.find["CLASS"]=support.getElementsByClassName&&function(className,context){if(typeof context.getElementsByClassName!=="undefined"&&documentIsHTML){return context.getElementsByClassName(className)}};rbuggyMatches=[];rbuggyQSA=[];if(support.qsa=rnative.test(document.querySelectorAll)){assert(function(div){docElem.appendChild(div).innerHTML=""+"";if(div.querySelectorAll("[msallowcapture^='']").length){rbuggyQSA.push("[*^$]="+whitespace+"*(?:''|\"\")")}if(!div.querySelectorAll("[selected]").length){rbuggyQSA.push("\\["+whitespace+"*(?:value|"+booleans+")")}if(!div.querySelectorAll("[id~="+expando+"-]").length){rbuggyQSA.push("~=")}if(!div.querySelectorAll(":checked").length){rbuggyQSA.push(":checked")}if(!div.querySelectorAll("a#"+expando+"+*").length){rbuggyQSA.push(".#.+[+~]")}});assert(function(div){var input=document.createElement("input");input.setAttribute("type","hidden");div.appendChild(input).setAttribute("name","D");if(div.querySelectorAll("[name=d]").length){rbuggyQSA.push("name"+whitespace+"*[*^$|!~]?=")}if(!div.querySelectorAll(":enabled").length){rbuggyQSA.push(":enabled",":disabled")}div.querySelectorAll("*,:x");rbuggyQSA.push(",.*:")})}if(support.matchesSelector=rnative.test(matches=docElem.matches||docElem.webkitMatchesSelector||docElem.mozMatchesSelector||docElem.oMatchesSelector||docElem.msMatchesSelector)){assert(function(div){support.disconnectedMatch=matches.call(div,"div");matches.call(div,"[s!='']:x");rbuggyMatches.push("!=",pseudos)})}rbuggyQSA=rbuggyQSA.length&&new RegExp(rbuggyQSA.join("|"));rbuggyMatches=rbuggyMatches.length&&new RegExp(rbuggyMatches.join("|"));hasCompare=rnative.test(docElem.compareDocumentPosition);contains=hasCompare||rnative.test(docElem.contains)?function(a,b){var adown=a.nodeType===9?a.documentElement:a,bup=b&&b.parentNode;return a===bup||!!(bup&&bup.nodeType===1&&(adown.contains?adown.contains(bup):a.compareDocumentPosition&&a.compareDocumentPosition(bup)&16))}:function(a,b){if(b){while(b=b.parentNode){if(b===a){return true}}}return false};sortOrder=hasCompare?function(a,b){if(a===b){hasDuplicate=true;return 0}var compare=!a.compareDocumentPosition-!b.compareDocumentPosition;if(compare){return compare}compare=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1;if(compare&1||!support.sortDetached&&b.compareDocumentPosition(a)===compare){if(a===document||a.ownerDocument===preferredDoc&&contains(preferredDoc,a)){return-1}if(b===document||b.ownerDocument===preferredDoc&&contains(preferredDoc,b)){return 1}return sortInput?indexOf(sortInput,a)-indexOf(sortInput,b):0}return compare&4?-1:1}:function(a,b){if(a===b){hasDuplicate=true;return 0}var cur,i=0,aup=a.parentNode,bup=b.parentNode,ap=[a],bp=[b];if(!aup||!bup){return a===document?-1:b===document?1:aup?-1:bup?1:sortInput?indexOf(sortInput,a)-indexOf(sortInput,b):0}else if(aup===bup){return siblingCheck(a,b)}cur=a;while(cur=cur.parentNode){ap.unshift(cur)}cur=b;while(cur=cur.parentNode){bp.unshift(cur)}while(ap[i]===bp[i]){i++}return i?siblingCheck(ap[i],bp[i]):ap[i]===preferredDoc?-1:bp[i]===preferredDoc?1:0};return document};Sizzle.matches=function(expr,elements){return Sizzle(expr,null,null,elements)};Sizzle.matchesSelector=function(elem,expr){if((elem.ownerDocument||elem)!==document){setDocument(elem)}expr=expr.replace(rattributeQuotes,"='$1']");if(support.matchesSelector&&documentIsHTML&&!compilerCache[expr+" "]&&(!rbuggyMatches||!rbuggyMatches.test(expr))&&(!rbuggyQSA||!rbuggyQSA.test(expr))){try{var ret=matches.call(elem,expr);if(ret||support.disconnectedMatch||elem.document&&elem.document.nodeType!==11){return ret}}catch(e){}}return Sizzle(expr,document,null,[elem]).length>0};Sizzle.contains=function(context,elem){if((context.ownerDocument||context)!==document){setDocument(context)}return contains(context,elem)};Sizzle.attr=function(elem,name){if((elem.ownerDocument||elem)!==document){setDocument(elem)}var fn=Expr.attrHandle[name.toLowerCase()],val=fn&&hasOwn.call(Expr.attrHandle,name.toLowerCase())?fn(elem,name,!documentIsHTML):undefined;return val!==undefined?val:support.attributes||!documentIsHTML?elem.getAttribute(name):(val=elem.getAttributeNode(name))&&val.specified?val.value:null};Sizzle.error=function(msg){throw new Error("Syntax error, unrecognized expression: "+msg)};Sizzle.uniqueSort=function(results){var elem,duplicates=[],j=0,i=0;hasDuplicate=!support.detectDuplicates;sortInput=!support.sortStable&&results.slice(0);results.sort(sortOrder);if(hasDuplicate){while(elem=results[i++]){if(elem===results[i]){j=duplicates.push(i)}}while(j--){results.splice(duplicates[j],1)}}sortInput=null;return results};getText=Sizzle.getText=function(elem){var node,ret="",i=0,nodeType=elem.nodeType;if(!nodeType){while(node=elem[i++]){ret+=getText(node)}}else if(nodeType===1||nodeType===9||nodeType===11){if(typeof elem.textContent==="string"){return elem.textContent}else{for(elem=elem.firstChild;elem;elem=elem.nextSibling){ret+=getText(elem)}}}else if(nodeType===3||nodeType===4){return elem.nodeValue}return ret};Expr=Sizzle.selectors={cacheLength:50,createPseudo:markFunction,match:matchExpr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(match){match[1]=match[1].replace(runescape,funescape);match[3]=(match[3]||match[4]||match[5]||"").replace(runescape,funescape);if(match[2]==="~="){match[3]=" "+match[3]+" "}return match.slice(0,4)},CHILD:function(match){match[1]=match[1].toLowerCase();if(match[1].slice(0,3)==="nth"){if(!match[3]){Sizzle.error(match[0])}match[4]=+(match[4]?match[5]+(match[6]||1):2*(match[3]==="even"||match[3]==="odd"));match[5]=+(match[7]+match[8]||match[3]==="odd")}else if(match[3]){Sizzle.error(match[0])}return match},PSEUDO:function(match){var excess,unquoted=!match[6]&&match[2];if(matchExpr["CHILD"].test(match[0])){return null}if(match[3]){match[2]=match[4]||match[5]||""}else if(unquoted&&rpseudo.test(unquoted)&&(excess=tokenize(unquoted,true))&&(excess=unquoted.indexOf(")",unquoted.length-excess)-unquoted.length)){match[0]=match[0].slice(0,excess);match[2]=unquoted.slice(0,excess)}return match.slice(0,3)}},filter:{TAG:function(nodeNameSelector){var nodeName=nodeNameSelector.replace(runescape,funescape).toLowerCase();return nodeNameSelector==="*"?function(){return true}:function(elem){return elem.nodeName&&elem.nodeName.toLowerCase()===nodeName}},CLASS:function(className){var pattern=classCache[className+" "];return pattern||(pattern=new RegExp("(^|"+whitespace+")"+className+"("+whitespace+"|$)"))&&classCache(className,function(elem){return pattern.test(typeof elem.className==="string"&&elem.className||typeof elem.getAttribute!=="undefined"&&elem.getAttribute("class")||"")})},ATTR:function(name,operator,check){return function(elem){var result=Sizzle.attr(elem,name);if(result==null){return operator==="!="}if(!operator){return true}result+="";return operator==="="?result===check:operator==="!="?result!==check:operator==="^="?check&&result.indexOf(check)===0:operator==="*="?check&&result.indexOf(check)>-1:operator==="$="?check&&result.slice(-check.length)===check:operator==="~="?(" "+result.replace(rwhitespace," ")+" ").indexOf(check)>-1:operator==="|="?result===check||result.slice(0,check.length+1)===check+"-":false}},CHILD:function(type,what,argument,first,last){var simple=type.slice(0,3)!=="nth",forward=type.slice(-4)!=="last",ofType=what==="of-type";return first===1&&last===0?function(elem){return!!elem.parentNode}:function(elem,context,xml){var cache,uniqueCache,outerCache,node,nodeIndex,start,dir=simple!==forward?"nextSibling":"previousSibling",parent=elem.parentNode,name=ofType&&elem.nodeName.toLowerCase(),useCache=!xml&&!ofType,diff=false;if(parent){if(simple){while(dir){node=elem;while(node=node[dir]){if(ofType?node.nodeName.toLowerCase()===name:node.nodeType===1){return false}}start=dir=type==="only"&&!start&&"nextSibling"}return true}start=[forward?parent.firstChild:parent.lastChild];if(forward&&useCache){node=parent;outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});cache=uniqueCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex&&cache[2];node=nodeIndex&&parent.childNodes[nodeIndex];while(node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop()){if(node.nodeType===1&&++diff&&node===elem){uniqueCache[type]=[dirruns,nodeIndex,diff];break}}}else{if(useCache){node=elem;outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});cache=uniqueCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex}if(diff===false){while(node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop()){ +if((ofType?node.nodeName.toLowerCase()===name:node.nodeType===1)&&++diff){if(useCache){outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});uniqueCache[type]=[dirruns,diff]}if(node===elem){break}}}}}diff-=last;return diff===first||diff%first===0&&diff/first>=0}}},PSEUDO:function(pseudo,argument){var args,fn=Expr.pseudos[pseudo]||Expr.setFilters[pseudo.toLowerCase()]||Sizzle.error("unsupported pseudo: "+pseudo);if(fn[expando]){return fn(argument)}if(fn.length>1){args=[pseudo,pseudo,"",argument];return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase())?markFunction(function(seed,matches){var idx,matched=fn(seed,argument),i=matched.length;while(i--){idx=indexOf(seed,matched[i]);seed[idx]=!(matches[idx]=matched[i])}}):function(elem){return fn(elem,0,args)}}return fn}},pseudos:{not:markFunction(function(selector){var input=[],results=[],matcher=compile(selector.replace(rtrim,"$1"));return matcher[expando]?markFunction(function(seed,matches,context,xml){var elem,unmatched=matcher(seed,null,xml,[]),i=seed.length;while(i--){if(elem=unmatched[i]){seed[i]=!(matches[i]=elem)}}}):function(elem,context,xml){input[0]=elem;matcher(input,null,xml,results);input[0]=null;return!results.pop()}}),has:markFunction(function(selector){return function(elem){return Sizzle(selector,elem).length>0}}),contains:markFunction(function(text){text=text.replace(runescape,funescape);return function(elem){return(elem.textContent||elem.innerText||getText(elem)).indexOf(text)>-1}}),lang:markFunction(function(lang){if(!ridentifier.test(lang||"")){Sizzle.error("unsupported lang: "+lang)}lang=lang.replace(runescape,funescape).toLowerCase();return function(elem){var elemLang;do{if(elemLang=documentIsHTML?elem.lang:elem.getAttribute("xml:lang")||elem.getAttribute("lang")){elemLang=elemLang.toLowerCase();return elemLang===lang||elemLang.indexOf(lang+"-")===0}}while((elem=elem.parentNode)&&elem.nodeType===1);return false}}),target:function(elem){var hash=window.location&&window.location.hash;return hash&&hash.slice(1)===elem.id},root:function(elem){return elem===docElem},focus:function(elem){return elem===document.activeElement&&(!document.hasFocus||document.hasFocus())&&!!(elem.type||elem.href||~elem.tabIndex)},enabled:function(elem){return elem.disabled===false},disabled:function(elem){return elem.disabled===true},checked:function(elem){var nodeName=elem.nodeName.toLowerCase();return nodeName==="input"&&!!elem.checked||nodeName==="option"&&!!elem.selected},selected:function(elem){if(elem.parentNode){elem.parentNode.selectedIndex}return elem.selected===true},empty:function(elem){for(elem=elem.firstChild;elem;elem=elem.nextSibling){if(elem.nodeType<6){return false}}return true},parent:function(elem){return!Expr.pseudos["empty"](elem)},header:function(elem){return rheader.test(elem.nodeName)},input:function(elem){return rinputs.test(elem.nodeName)},button:function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type==="button"||name==="button"},text:function(elem){var attr;return elem.nodeName.toLowerCase()==="input"&&elem.type==="text"&&((attr=elem.getAttribute("type"))==null||attr.toLowerCase()==="text")},first:createPositionalPseudo(function(){return[0]}),last:createPositionalPseudo(function(matchIndexes,length){return[length-1]}),eq:createPositionalPseudo(function(matchIndexes,length,argument){return[argument<0?argument+length:argument]}),even:createPositionalPseudo(function(matchIndexes,length){var i=0;for(;i=0;){matchIndexes.push(i)}return matchIndexes}),gt:createPositionalPseudo(function(matchIndexes,length,argument){var i=argument<0?argument+length:argument;for(;++i1?function(elem,context,xml){var i=matchers.length;while(i--){if(!matchers[i](elem,context,xml)){return false}}return true}:matchers[0]}function multipleContexts(selector,contexts,results){var i=0,len=contexts.length;for(;i-1){seed[temp]=!(results[temp]=elem)}}}}else{matcherOut=condense(matcherOut===results?matcherOut.splice(preexisting,matcherOut.length):matcherOut);if(postFinder){postFinder(null,results,matcherOut,xml)}else{push.apply(results,matcherOut)}}})}function matcherFromTokens(tokens){var checkContext,matcher,j,len=tokens.length,leadingRelative=Expr.relative[tokens[0].type],implicitRelative=leadingRelative||Expr.relative[" "],i=leadingRelative?1:0,matchContext=addCombinator(function(elem){return elem===checkContext},implicitRelative,true),matchAnyContext=addCombinator(function(elem){return indexOf(checkContext,elem)>-1},implicitRelative,true),matchers=[function(elem,context,xml){var ret=!leadingRelative&&(xml||context!==outermostContext)||((checkContext=context).nodeType?matchContext(elem,context,xml):matchAnyContext(elem,context,xml));checkContext=null;return ret}];for(;i1&&elementMatcher(matchers),i>1&&toSelector(tokens.slice(0,i-1).concat({value:tokens[i-2].type===" "?"*":""})).replace(rtrim,"$1"),matcher,i0,byElement=elementMatchers.length>0,superMatcher=function(seed,context,xml,results,outermost){var elem,j,matcher,matchedCount=0,i="0",unmatched=seed&&[],setMatched=[],contextBackup=outermostContext,elems=seed||byElement&&Expr.find["TAG"]("*",outermost),dirrunsUnique=dirruns+=contextBackup==null?1:Math.random()||.1,len=elems.length;if(outermost){outermostContext=context===document||context||outermost}for(;i!==len&&(elem=elems[i])!=null;i++){if(byElement&&elem){j=0;if(!context&&elem.ownerDocument!==document){setDocument(elem);xml=!documentIsHTML}while(matcher=elementMatchers[j++]){if(matcher(elem,context||document,xml)){results.push(elem);break}}if(outermost){dirruns=dirrunsUnique}}if(bySet){if(elem=!matcher&&elem){matchedCount--}if(seed){unmatched.push(elem)}}}matchedCount+=i;if(bySet&&i!==matchedCount){j=0;while(matcher=setMatchers[j++]){matcher(unmatched,setMatched,context,xml)}if(seed){if(matchedCount>0){while(i--){if(!(unmatched[i]||setMatched[i])){setMatched[i]=pop.call(results)}}}setMatched=condense(setMatched)}push.apply(results,setMatched);if(outermost&&!seed&&setMatched.length>0&&matchedCount+setMatchers.length>1){Sizzle.uniqueSort(results)}}if(outermost){dirruns=dirrunsUnique;outermostContext=contextBackup}return unmatched};return bySet?markFunction(superMatcher):superMatcher}compile=Sizzle.compile=function(selector,match){var i,setMatchers=[],elementMatchers=[],cached=compilerCache[selector+" "];if(!cached){if(!match){match=tokenize(selector)}i=match.length;while(i--){cached=matcherFromTokens(match[i]);if(cached[expando]){setMatchers.push(cached)}else{elementMatchers.push(cached)}}cached=compilerCache(selector,matcherFromGroupMatchers(elementMatchers,setMatchers));cached.selector=selector}return cached};select=Sizzle.select=function(selector,context,results,seed){var i,tokens,token,type,find,compiled=typeof selector==="function"&&selector,match=!seed&&tokenize(selector=compiled.selector||selector);results=results||[];if(match.length===1){tokens=match[0]=match[0].slice(0);if(tokens.length>2&&(token=tokens[0]).type==="ID"&&support.getById&&context.nodeType===9&&documentIsHTML&&Expr.relative[tokens[1].type]){context=(Expr.find["ID"](token.matches[0].replace(runescape,funescape),context)||[])[0];if(!context){return results}else if(compiled){context=context.parentNode}selector=selector.slice(tokens.shift().value.length)}i=matchExpr["needsContext"].test(selector)?0:tokens.length;while(i--){token=tokens[i];if(Expr.relative[type=token.type]){break}if(find=Expr.find[type]){if(seed=find(token.matches[0].replace(runescape,funescape),rsibling.test(tokens[0].type)&&testContext(context.parentNode)||context)){tokens.splice(i,1);selector=seed.length&&toSelector(tokens);if(!selector){push.apply(results,seed);return results}break}}}}(compiled||compile(selector,match))(seed,context,!documentIsHTML,results,!context||rsibling.test(selector)&&testContext(context.parentNode)||context);return results};support.sortStable=expando.split("").sort(sortOrder).join("")===expando;support.detectDuplicates=!!hasDuplicate;setDocument();support.sortDetached=assert(function(div1){return div1.compareDocumentPosition(document.createElement("div"))&1});if(!assert(function(div){div.innerHTML="";return div.firstChild.getAttribute("href")==="#"})){addHandle("type|href|height|width",function(elem,name,isXML){if(!isXML){return elem.getAttribute(name,name.toLowerCase()==="type"?1:2)}})}if(!support.attributes||!assert(function(div){div.innerHTML="";div.firstChild.setAttribute("value","");return div.firstChild.getAttribute("value")===""})){addHandle("value",function(elem,name,isXML){if(!isXML&&elem.nodeName.toLowerCase()==="input"){return elem.defaultValue}})}if(!assert(function(div){return div.getAttribute("disabled")==null})){addHandle(booleans,function(elem,name,isXML){var val;if(!isXML){return elem[name]===true?name.toLowerCase():(val=elem.getAttributeNode(name))&&val.specified?val.value:null}})}return Sizzle}(window);jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.pseudos;jQuery.uniqueSort=jQuery.unique=Sizzle.uniqueSort;jQuery.text=Sizzle.getText;jQuery.isXMLDoc=Sizzle.isXML;jQuery.contains=Sizzle.contains;var dir=function(elem,dir,until){var matched=[],truncate=until!==undefined;while((elem=elem[dir])&&elem.nodeType!==9){if(elem.nodeType===1){if(truncate&&jQuery(elem).is(until)){break}matched.push(elem)}}return matched};var siblings=function(n,elem){var matched=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){matched.push(n)}}return matched};var rneedsContext=jQuery.expr.match.needsContext;var rsingleTag=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/;var risSimple=/^.[^:#\[\.,]*$/;function winnow(elements,qualifier,not){if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){return!!qualifier.call(elem,i,elem)!==not})}if(qualifier.nodeType){return jQuery.grep(elements,function(elem){return elem===qualifier!==not})}if(typeof qualifier==="string"){if(risSimple.test(qualifier)){return jQuery.filter(qualifier,elements,not)}qualifier=jQuery.filter(qualifier,elements)}return jQuery.grep(elements,function(elem){return indexOf.call(qualifier,elem)>-1!==not})}jQuery.filter=function(expr,elems,not){var elem=elems[0];if(not){expr=":not("+expr+")"}return elems.length===1&&elem.nodeType===1?jQuery.find.matchesSelector(elem,expr)?[elem]:[]:jQuery.find.matches(expr,jQuery.grep(elems,function(elem){return elem.nodeType===1}))};jQuery.fn.extend({find:function(selector){var i,len=this.length,ret=[],self=this;if(typeof selector!=="string"){return this.pushStack(jQuery(selector).filter(function(){for(i=0;i1?jQuery.unique(ret):ret);ret.selector=this.selector?this.selector+" "+selector:selector;return ret},filter:function(selector){return this.pushStack(winnow(this,selector||[],false))},not:function(selector){return this.pushStack(winnow(this,selector||[],true))},is:function(selector){return!!winnow(this,typeof selector==="string"&&rneedsContext.test(selector)?jQuery(selector):selector||[],false).length}});var rootjQuery,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,init=jQuery.fn.init=function(selector,context,root){var match,elem;if(!selector){return this}root=root||rootjQuery;if(typeof selector==="string"){if(selector[0]==="<"&&selector[selector.length-1]===">"&&selector.length>=3){match=[null,selector,null]}else{match=rquickExpr.exec(selector)}if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;jQuery.merge(this,jQuery.parseHTML(match[1],context&&context.nodeType?context.ownerDocument||context:document,true));if(rsingleTag.test(match[1])&&jQuery.isPlainObject(context)){for(match in context){if(jQuery.isFunction(this[match])){this[match](context[match])}else{this.attr(match,context[match])}}}return this}else{elem=document.getElementById(match[2]);if(elem&&elem.parentNode){this.length=1;this[0]=elem}this.context=document;this.selector=selector;return this}}else if(!context||context.jquery){return(context||root).find(selector)}else{return this.constructor(context).find(selector)}}else if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this}else if(jQuery.isFunction(selector)){return root.ready!==undefined?root.ready(selector):selector(jQuery)}if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context}return jQuery.makeArray(selector,this)};init.prototype=jQuery.fn;rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({has:function(target){var targets=jQuery(target,this),l=targets.length;return this.filter(function(){var i=0;for(;i-1:cur.nodeType===1&&jQuery.find.matchesSelector(cur,selectors))){matched.push(cur);break}}}return this.pushStack(matched.length>1?jQuery.uniqueSort(matched):matched)},index:function(elem){if(!elem){return this[0]&&this[0].parentNode?this.first().prevAll().length:-1}if(typeof elem==="string"){return indexOf.call(jQuery(elem),this[0])}return indexOf.call(this,elem.jquery?elem[0]:elem)},add:function(selector,context){return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(),jQuery(selector,context))))},addBack:function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}});function sibling(cur,dir){while((cur=cur[dir])&&cur.nodeType!==1){}return cur}jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null},parents:function(elem){return dir(elem,"parentNode")},parentsUntil:function(elem,i,until){return dir(elem,"parentNode",until)},next:function(elem){return sibling(elem,"nextSibling")},prev:function(elem){return sibling(elem,"previousSibling")},nextAll:function(elem){return dir(elem,"nextSibling")},prevAll:function(elem){return dir(elem,"previousSibling")},nextUntil:function(elem,i,until){return dir(elem,"nextSibling",until)},prevUntil:function(elem,i,until){return dir(elem,"previousSibling",until)},siblings:function(elem){return siblings((elem.parentNode||{}).firstChild,elem)},children:function(elem){return siblings(elem.firstChild)},contents:function(elem){return elem.contentDocument||jQuery.merge([],elem.childNodes)}},function(name,fn){jQuery.fn[name]=function(until,selector){var matched=jQuery.map(this,fn,until);if(name.slice(-5)!=="Until"){selector=until}if(selector&&typeof selector==="string"){matched=jQuery.filter(selector,matched)}if(this.length>1){if(!guaranteedUnique[name]){jQuery.uniqueSort(matched)}if(rparentsprev.test(name)){matched.reverse()}}return this.pushStack(matched)}});var rnotwhite=/\S+/g;function createOptions(options){var object={};jQuery.each(options.match(rnotwhite)||[],function(_,flag){object[flag]=true});return object}jQuery.Callbacks=function(options){options=typeof options==="string"?createOptions(options):jQuery.extend({},options);var firing,memory,fired,locked,list=[],queue=[],firingIndex=-1,fire=function(){locked=options.once;fired=firing=true;for(;queue.length;firingIndex=-1){memory=queue.shift();while(++firingIndex-1){list.splice(index,1);if(index<=firingIndex){firingIndex--}}});return this},has:function(fn){return fn?jQuery.inArray(fn,list)>-1:list.length>0},empty:function(){if(list){list=[]}return this},disable:function(){locked=queue=[];list=memory="";return this},disabled:function(){return!list},lock:function(){locked=queue=[];if(!memory){list=memory=""}return this},locked:function(){return!!locked},fireWith:function(context,args){if(!locked){args=args||[];args=[context,args.slice?args.slice():args];queue.push(args);if(!firing){fire()}}return this},fire:function(){self.fireWith(this,arguments);return this},fired:function(){return!!fired}};return self};jQuery.extend({Deferred:function(func){var tuples=[["resolve","done",jQuery.Callbacks("once memory"),"resolved"],["reject","fail",jQuery.Callbacks("once memory"),"rejected"],["notify","progress",jQuery.Callbacks("memory")]],state="pending",promise={state:function(){return state},always:function(){deferred.done(arguments).fail(arguments);return this},then:function(){var fns=arguments;return jQuery.Deferred(function(newDefer){jQuery.each(tuples,function(i,tuple){var fn=jQuery.isFunction(fns[i])&&fns[i];deferred[tuple[1]](function(){var returned=fn&&fn.apply(this,arguments);if(returned&&jQuery.isFunction(returned.promise)){returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject)}else{newDefer[tuple[0]+"With"](this===promise?newDefer.promise():this,fn?[returned]:arguments)}})});fns=null}).promise()},promise:function(obj){return obj!=null?jQuery.extend(obj,promise):promise}},deferred={};promise.pipe=promise.then;jQuery.each(tuples,function(i,tuple){var list=tuple[2],stateString=tuple[3];promise[tuple[1]]=list.add;if(stateString){list.add(function(){state=stateString},tuples[i^1][2].disable,tuples[2][2].lock)}deferred[tuple[0]]=function(){deferred[tuple[0]+"With"](this===deferred?promise:this,arguments);return this};deferred[tuple[0]+"With"]=list.fireWith});promise.promise(deferred);if(func){func.call(deferred,deferred)}return deferred},when:function(subordinate){var i=0,resolveValues=slice.call(arguments),length=resolveValues.length,remaining=length!==1||subordinate&&jQuery.isFunction(subordinate.promise)?length:0,deferred=remaining===1?subordinate:jQuery.Deferred(),updateFunc=function(i,contexts,values){return function(value){contexts[i]=this;values[i]=arguments.length>1?slice.call(arguments):value;if(values===progressValues){deferred.notifyWith(contexts,values)}else if(!--remaining){deferred.resolveWith(contexts,values)}}},progressValues,progressContexts,resolveContexts;if(length>1){progressValues=new Array(length);progressContexts=new Array(length);resolveContexts=new Array(length);for(;i0){return}readyList.resolveWith(document,[jQuery]);if(jQuery.fn.triggerHandler){jQuery(document).triggerHandler("ready");jQuery(document).off("ready")}}});function completed(){document.removeEventListener("DOMContentLoaded",completed);window.removeEventListener("load",completed);jQuery.ready()}jQuery.ready.promise=function(obj){if(!readyList){readyList=jQuery.Deferred();if(document.readyState==="complete"||document.readyState!=="loading"&&!document.documentElement.doScroll){window.setTimeout(jQuery.ready)}else{document.addEventListener("DOMContentLoaded",completed);window.addEventListener("load",completed)}}return readyList.promise(obj)};jQuery.ready.promise();var access=function(elems,fn,key,value,chainable,emptyGet,raw){var i=0,len=elems.length,bulk=key==null;if(jQuery.type(key)==="object"){chainable=true;for(i in key){access(elems,fn,i,key[i],true,emptyGet,raw)}}else if(value!==undefined){chainable=true;if(!jQuery.isFunction(value)){raw=true}if(bulk){if(raw){fn.call(elems,value);fn=null}else{bulk=fn;fn=function(elem,key,value){return bulk.call(jQuery(elem),value)}}}if(fn){for(;i-1&&data!==undefined){dataUser.set(this,key,value)}})},null,value,arguments.length>1,null,true)},removeData:function(key){return this.each(function(){dataUser.remove(this,key)})}});jQuery.extend({queue:function(elem,type,data){var queue;if(elem){type=(type||"fx")+"queue";queue=dataPriv.get(elem,type);if(data){if(!queue||jQuery.isArray(data)){queue=dataPriv.access(elem,type,jQuery.makeArray(data))}else{queue.push(data)}}return queue||[]}},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),startLength=queue.length,fn=queue.shift(),hooks=jQuery._queueHooks(elem,type),next=function(){jQuery.dequeue(elem,type)};if(fn==="inprogress"){fn=queue.shift();startLength--}if(fn){if(type==="fx"){queue.unshift("inprogress")}delete hooks.stop;fn.call(elem,next,hooks)}if(!startLength&&hooks){hooks.empty.fire()}},_queueHooks:function(elem,type){var key=type+"queueHooks";return dataPriv.get(elem,key)||dataPriv.access(elem,key,{empty:jQuery.Callbacks("once memory").add(function(){dataPriv.remove(elem,[type+"queue",key])})})}});jQuery.fn.extend({queue:function(type,data){var setter=2;if(typeof type!=="string"){data=type;type="fx";setter--}if(arguments.lengthpropAndValStr.length){blockRem=blockRem.substr(propAndValStr.length)}else{blockRem=""}}while(true){var nothingLeftToParse=remaining.match(/^\s*$/);if(nothingLeftToParse){break}var selAndBlock=remaining.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!selAndBlock){util.error("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+remaining);break}selAndBlockStr=selAndBlock[0];var selectorStr=selAndBlock[1];if(selectorStr!=="core"){var selector=new Selector(selectorStr);if(selector._private.invalid){util.error("Skipping parsing of block: Invalid selector found in string stylesheet: "+selectorStr);removeSelAndBlockFromRemaining();continue}}var blockStr=selAndBlock[2];var invalidBlock=false;blockRem=blockStr;var props=[];while(true){var nothingLeftToParse=blockRem.match(/^\s*$/);if(nothingLeftToParse){break}var propAndVal=blockRem.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!propAndVal){util.error("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+blockStr);invalidBlock=true;break}propAndValStr=propAndVal[0];var propStr=propAndVal[1];var valStr=propAndVal[2];var prop=self.properties[propStr];if(!prop){util.error("Skipping property: Invalid property name in: "+propAndValStr);removePropAndValFromRem();continue}var parsedProp=style.parse(propStr,valStr);if(!parsedProp){util.error("Skipping property: Invalid property definition in: "+propAndValStr);removePropAndValFromRem();continue}props.push({name:propStr,val:valStr});removePropAndValFromRem()}if(invalidBlock){removeSelAndBlockFromRemaining();break}style.selector(selectorStr);for(var i=0;i1?", "+JSON.stringify(arg1):"")+" );"," "," resolve = origResolve;"," resolve( res.length > 0 ? res : ret );","}"].join("\n"))}};util.extend(thdfn,{reduce:defineFnal({name:"reduce"}),reduceRight:defineFnal({name:"reduceRight"}),map:defineFnal({name:"map"})});var fn=thdfn;fn.promise=fn.run;fn.terminate=fn.halt=fn.stop;fn.include=fn.require;util.extend(thdfn,{on:define.on(),one:define.on({unbindSelfOnTrigger:true}),off:define.off(),trigger:define.trigger()});define.eventAliasesOn(thdfn);module.exports=Thread}).call(this,"/node_modules/cytoscape/src")},{"./define":75,"./event":76,"./is":114,"./promise":117,"./util":131,"./window":138,child_process:200,path:202}],130:[function(require,module,exports){"use strict";var is=require("../is");module.exports={hex2tuple:function(hex){if(!(hex.length===4||hex.length===7)||hex[0]!=="#"){return}var shortHex=hex.length===4;var r,g,b;var base=16;if(shortHex){r=parseInt(hex[1]+hex[1],base);g=parseInt(hex[2]+hex[2],base);b=parseInt(hex[3]+hex[3],base)}else{r=parseInt(hex[1]+hex[2],base);g=parseInt(hex[3]+hex[4],base);b=parseInt(hex[5]+hex[6],base)}return[r,g,b]},hsl2tuple:function(hsl){var ret;var h,s,l,a,r,g,b;function hue2rgb(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p}var m=new RegExp("^"+this.regex.hsla+"$").exec(hsl);if(m){h=parseInt(m[1]);if(h<0){h=(360- -1*h%360)%360}else if(h>360){h=h%360}h/=360;s=parseFloat(m[2]);if(s<0||s>100){return}s=s/100;l=parseFloat(m[3]);if(l<0||l>100){return}l=l/100;a=m[4];if(a!==undefined){a=parseFloat(a);if(a<0||a>1){return}}if(s===0){r=g=b=Math.round(l*255)}else{var q=l<.5?l*(1+s):l+s-l*s;var p=2*l-q;r=Math.round(255*hue2rgb(p,q,h+1/3));g=Math.round(255*hue2rgb(p,q,h));b=Math.round(255*hue2rgb(p,q,h-1/3))}ret=[r,g,b,a]}return ret},rgb2tuple:function(rgb){var ret;var m=new RegExp("^"+this.regex.rgba+"$").exec(rgb);if(m){ret=[];var isPct=[];for(var i=1;i<=3;i++){var channel=m[i];if(channel[channel.length-1]==="%"){isPct[i]=true}channel=parseFloat(channel);if(isPct[i]){channel=channel/100*255}if(channel<0||channel>255){return}ret.push(Math.floor(channel))}var atLeastOneIsPct=isPct[1]||isPct[2]||isPct[3];var allArePct=isPct[1]&&isPct[2]&&isPct[3];if(atLeastOneIsPct&&!allArePct){return}var alpha=m[4];if(alpha!==undefined){alpha=parseFloat(alpha);if(alpha<0||alpha>1){return}ret.push(alpha)}}return ret},colorname2tuple:function(color){return this.colors[color.toLowerCase()]},color2tuple:function(color){return(is.array(color)?color:null)||this.colorname2tuple(color)||this.hex2tuple(color)||this.rgb2tuple(color)||this.hsl2tuple(color)},colors:{transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}}},{"../is":114}],131:[function(require,module,exports){"use strict";var is=require("../is");var math=require("../math");var util={trueify:function(){return true},falsify:function(){return false},zeroify:function(){return 0},noop:function(){},error:function(msg){if(console.error){console.error.apply(console,arguments);if(console.trace){console.trace()}}else{console.log.apply(console,arguments);if(console.trace){console.trace()}}},clone:function(obj){return this.extend({},obj)},copy:function(obj){if(obj==null){return obj}if(is.array(obj)){return obj.slice()}else if(is.plainObject(obj)){return this.clone(obj)}else{return obj}},uuid:function(a,b){for(b=a="";a++<36;b+=a*51&52?(a^15?8^Math.random()*(a^20?16:4):4).toString(16):"-");return b}};util.makeBoundingBox=math.makeBoundingBox.bind(math);util._staticEmptyObject={};util.staticEmptyObject=function(){return util._staticEmptyObject};util.extend=Object.assign!=null?Object.assign:function(tgt){var args=arguments;for(var i=1;i=0;i--){if(arr[i]===ele){arr.splice(i,1);if(!manyCopies){break}}}};util.clearArray=function(arr){arr.splice(0,arr.length)};util.getPrefixedProperty=function(obj,propName,prefix){if(prefix){propName=this.prependCamel(prefix,propName)}return obj[propName]};util.setPrefixedProperty=function(obj,propName,prefix,value){if(prefix){propName=this.prependCamel(prefix,propName)}obj[propName]=value};[require("./colors"),require("./maps"),{memoize:require("./memoize")},require("./regex"),require("./strings"),require("./timing")].forEach(function(req){util.extend(util,req)});module.exports=util},{"../is":114,"../math":116,"./colors":130,"./maps":132,"./memoize":133,"./regex":134,"./strings":135,"./timing":136}],132:[function(require,module,exports){"use strict";var is=require("../is");module.exports={mapEmpty:function(map){var empty=true;if(map!=null){return Object.keys(map).length===0}return empty},pushMap:function(options){var array=this.getMap(options);if(array==null){this.setMap(this.extend({},options,{value:[options.value]}))}else{array.push(options.value)}},setMap:function(options){var obj=options.map;var key;var keys=options.keys;var l=keys.length;for(var i=0;i=0&&j=0},isPlainObject:function(obj){var key;if(jQuery.type(obj)!=="object"||obj.nodeType||jQuery.isWindow(obj)){return false}if(obj.constructor&&!hasOwn.call(obj,"constructor")&&!hasOwn.call(obj.constructor.prototype||{},"isPrototypeOf")){return false}for(key in obj){}return key===undefined||hasOwn.call(obj,key)},isEmptyObject:function(obj){var name;for(name in obj){return false}return true},type:function(obj){if(obj==null){return obj+""}return typeof obj==="object"||typeof obj==="function"?class2type[toString.call(obj)]||"object":typeof obj},globalEval:function(code){var script,indirect=eval;code=jQuery.trim(code);if(code){if(code.indexOf("use strict")===1){script=document.createElement("script");script.text=code;document.head.appendChild(script).parentNode.removeChild(script)}else{indirect(code)}}},camelCase:function(string){return string.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase)},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toLowerCase()===name.toLowerCase()},each:function(obj,callback){var length,i=0;if(isArrayLike(obj)){length=obj.length;for(;i0&&length-1 in obj}var Sizzle=function(window){var i,support,Expr,getText,isXML,tokenize,compile,select,outermostContext,sortInput,hasDuplicate,setDocument,document,docElem,documentIsHTML,rbuggyQSA,rbuggyMatches,matches,contains,expando="sizzle"+1*new Date,preferredDoc=window.document,dirruns=0,done=0,classCache=createCache(),tokenCache=createCache(),compilerCache=createCache(),sortOrder=function(a,b){if(a===b){hasDuplicate=true}return 0},MAX_NEGATIVE=1<<31,hasOwn={}.hasOwnProperty,arr=[],pop=arr.pop,push_native=arr.push,push=arr.push,slice=arr.slice,indexOf=function(list,elem){var i=0,len=list.length;for(;i+~]|"+whitespace+")"+whitespace+"*"),rattributeQuotes=new RegExp("="+whitespace+"*([^\\]'\"]*?)"+whitespace+"*\\]","g"),rpseudo=new RegExp(pseudos),ridentifier=new RegExp("^"+identifier+"$"),matchExpr={ -ID:new RegExp("^#("+identifier+")"),CLASS:new RegExp("^\\.("+identifier+")"),TAG:new RegExp("^("+identifier+"|[*])"),ATTR:new RegExp("^"+attributes),PSEUDO:new RegExp("^"+pseudos),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+whitespace+"*(even|odd|(([+-]|)(\\d*)n|)"+whitespace+"*(?:([+-]|)"+whitespace+"*(\\d+)|))"+whitespace+"*\\)|)","i"),bool:new RegExp("^(?:"+booleans+")$","i"),needsContext:new RegExp("^"+whitespace+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+whitespace+"*((?:-\\d)?\\d*)"+whitespace+"*\\)|)(?=[^-]|$)","i")},rinputs=/^(?:input|select|textarea|button)$/i,rheader=/^h\d$/i,rnative=/^[^{]+\{\s*\[native \w/,rquickExpr=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,rsibling=/[+~]/,rescape=/'|\\/g,runescape=new RegExp("\\\\([\\da-f]{1,6}"+whitespace+"?|("+whitespace+")|.)","ig"),funescape=function(_,escaped,escapedWhitespace){var high="0x"+escaped-65536;return high!==high||escapedWhitespace?escaped:high<0?String.fromCharCode(high+65536):String.fromCharCode(high>>10|55296,high&1023|56320)},unloadHandler=function(){setDocument()};try{push.apply(arr=slice.call(preferredDoc.childNodes),preferredDoc.childNodes);arr[preferredDoc.childNodes.length].nodeType}catch(e){push={apply:arr.length?function(target,els){push_native.apply(target,slice.call(els))}:function(target,els){var j=target.length,i=0;while(target[j++]=els[i++]){}target.length=j-1}}}function Sizzle(selector,context,results,seed){var m,i,elem,nid,nidselect,match,groups,newSelector,newContext=context&&context.ownerDocument,nodeType=context?context.nodeType:9;results=results||[];if(typeof selector!=="string"||!selector||nodeType!==1&&nodeType!==9&&nodeType!==11){return results}if(!seed){if((context?context.ownerDocument||context:preferredDoc)!==document){setDocument(context)}context=context||document;if(documentIsHTML){if(nodeType!==11&&(match=rquickExpr.exec(selector))){if(m=match[1]){if(nodeType===9){if(elem=context.getElementById(m)){if(elem.id===m){results.push(elem);return results}}else{return results}}else{if(newContext&&(elem=newContext.getElementById(m))&&contains(context,elem)&&elem.id===m){results.push(elem);return results}}}else if(match[2]){push.apply(results,context.getElementsByTagName(selector));return results}else if((m=match[3])&&support.getElementsByClassName&&context.getElementsByClassName){push.apply(results,context.getElementsByClassName(m));return results}}if(support.qsa&&!compilerCache[selector+" "]&&(!rbuggyQSA||!rbuggyQSA.test(selector))){if(nodeType!==1){newContext=context;newSelector=selector}else if(context.nodeName.toLowerCase()!=="object"){if(nid=context.getAttribute("id")){nid=nid.replace(rescape,"\\$&")}else{context.setAttribute("id",nid=expando)}groups=tokenize(selector);i=groups.length;nidselect=ridentifier.test(nid)?"#"+nid:"[id='"+nid+"']";while(i--){groups[i]=nidselect+" "+toSelector(groups[i])}newSelector=groups.join(",");newContext=rsibling.test(selector)&&testContext(context.parentNode)||context}if(newSelector){try{push.apply(results,newContext.querySelectorAll(newSelector));return results}catch(qsaError){}finally{if(nid===expando){context.removeAttribute("id")}}}}}}return select(selector.replace(rtrim,"$1"),context,results,seed)}function createCache(){var keys=[];function cache(key,value){if(keys.push(key+" ")>Expr.cacheLength){delete cache[keys.shift()]}return cache[key+" "]=value}return cache}function markFunction(fn){fn[expando]=true;return fn}function assert(fn){var div=document.createElement("div");try{return!!fn(div)}catch(e){return false}finally{if(div.parentNode){div.parentNode.removeChild(div)}div=null}}function addHandle(attrs,handler){var arr=attrs.split("|"),i=arr.length;while(i--){Expr.attrHandle[arr[i]]=handler}}function siblingCheck(a,b){var cur=b&&a,diff=cur&&a.nodeType===1&&b.nodeType===1&&(~b.sourceIndex||MAX_NEGATIVE)-(~a.sourceIndex||MAX_NEGATIVE);if(diff){return diff}if(cur){while(cur=cur.nextSibling){if(cur===b){return-1}}}return a?1:-1}function createInputPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type===type}}function createButtonPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&elem.type===type}}function createPositionalPseudo(fn){return markFunction(function(argument){argument=+argument;return markFunction(function(seed,matches){var j,matchIndexes=fn([],seed.length,argument),i=matchIndexes.length;while(i--){if(seed[j=matchIndexes[i]]){seed[j]=!(matches[j]=seed[j])}}})})}function testContext(context){return context&&typeof context.getElementsByTagName!=="undefined"&&context}support=Sizzle.support={};isXML=Sizzle.isXML=function(elem){var documentElement=elem&&(elem.ownerDocument||elem).documentElement;return documentElement?documentElement.nodeName!=="HTML":false};setDocument=Sizzle.setDocument=function(node){var hasCompare,parent,doc=node?node.ownerDocument||node:preferredDoc;if(doc===document||doc.nodeType!==9||!doc.documentElement){return document}document=doc;docElem=document.documentElement;documentIsHTML=!isXML(document);if((parent=document.defaultView)&&parent.top!==parent){if(parent.addEventListener){parent.addEventListener("unload",unloadHandler,false)}else if(parent.attachEvent){parent.attachEvent("onunload",unloadHandler)}}support.attributes=assert(function(div){div.className="i";return!div.getAttribute("className")});support.getElementsByTagName=assert(function(div){div.appendChild(document.createComment(""));return!div.getElementsByTagName("*").length});support.getElementsByClassName=rnative.test(document.getElementsByClassName);support.getById=assert(function(div){docElem.appendChild(div).id=expando;return!document.getElementsByName||!document.getElementsByName(expando).length});if(support.getById){Expr.find["ID"]=function(id,context){if(typeof context.getElementById!=="undefined"&&documentIsHTML){var m=context.getElementById(id);return m?[m]:[]}};Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){return elem.getAttribute("id")===attrId}}}else{delete Expr.find["ID"];Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return node&&node.value===attrId}}}Expr.find["TAG"]=support.getElementsByTagName?function(tag,context){if(typeof context.getElementsByTagName!=="undefined"){return context.getElementsByTagName(tag)}else if(support.qsa){return context.querySelectorAll(tag)}}:function(tag,context){var elem,tmp=[],i=0,results=context.getElementsByTagName(tag);if(tag==="*"){while(elem=results[i++]){if(elem.nodeType===1){tmp.push(elem)}}return tmp}return results};Expr.find["CLASS"]=support.getElementsByClassName&&function(className,context){if(typeof context.getElementsByClassName!=="undefined"&&documentIsHTML){return context.getElementsByClassName(className)}};rbuggyMatches=[];rbuggyQSA=[];if(support.qsa=rnative.test(document.querySelectorAll)){assert(function(div){docElem.appendChild(div).innerHTML=""+"";if(div.querySelectorAll("[msallowcapture^='']").length){rbuggyQSA.push("[*^$]="+whitespace+"*(?:''|\"\")")}if(!div.querySelectorAll("[selected]").length){rbuggyQSA.push("\\["+whitespace+"*(?:value|"+booleans+")")}if(!div.querySelectorAll("[id~="+expando+"-]").length){rbuggyQSA.push("~=")}if(!div.querySelectorAll(":checked").length){rbuggyQSA.push(":checked")}if(!div.querySelectorAll("a#"+expando+"+*").length){rbuggyQSA.push(".#.+[+~]")}});assert(function(div){var input=document.createElement("input");input.setAttribute("type","hidden");div.appendChild(input).setAttribute("name","D");if(div.querySelectorAll("[name=d]").length){rbuggyQSA.push("name"+whitespace+"*[*^$|!~]?=")}if(!div.querySelectorAll(":enabled").length){rbuggyQSA.push(":enabled",":disabled")}div.querySelectorAll("*,:x");rbuggyQSA.push(",.*:")})}if(support.matchesSelector=rnative.test(matches=docElem.matches||docElem.webkitMatchesSelector||docElem.mozMatchesSelector||docElem.oMatchesSelector||docElem.msMatchesSelector)){assert(function(div){support.disconnectedMatch=matches.call(div,"div");matches.call(div,"[s!='']:x");rbuggyMatches.push("!=",pseudos)})}rbuggyQSA=rbuggyQSA.length&&new RegExp(rbuggyQSA.join("|"));rbuggyMatches=rbuggyMatches.length&&new RegExp(rbuggyMatches.join("|"));hasCompare=rnative.test(docElem.compareDocumentPosition);contains=hasCompare||rnative.test(docElem.contains)?function(a,b){var adown=a.nodeType===9?a.documentElement:a,bup=b&&b.parentNode;return a===bup||!!(bup&&bup.nodeType===1&&(adown.contains?adown.contains(bup):a.compareDocumentPosition&&a.compareDocumentPosition(bup)&16))}:function(a,b){if(b){while(b=b.parentNode){if(b===a){return true}}}return false};sortOrder=hasCompare?function(a,b){if(a===b){hasDuplicate=true;return 0}var compare=!a.compareDocumentPosition-!b.compareDocumentPosition;if(compare){return compare}compare=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1;if(compare&1||!support.sortDetached&&b.compareDocumentPosition(a)===compare){if(a===document||a.ownerDocument===preferredDoc&&contains(preferredDoc,a)){return-1}if(b===document||b.ownerDocument===preferredDoc&&contains(preferredDoc,b)){return 1}return sortInput?indexOf(sortInput,a)-indexOf(sortInput,b):0}return compare&4?-1:1}:function(a,b){if(a===b){hasDuplicate=true;return 0}var cur,i=0,aup=a.parentNode,bup=b.parentNode,ap=[a],bp=[b];if(!aup||!bup){return a===document?-1:b===document?1:aup?-1:bup?1:sortInput?indexOf(sortInput,a)-indexOf(sortInput,b):0}else if(aup===bup){return siblingCheck(a,b)}cur=a;while(cur=cur.parentNode){ap.unshift(cur)}cur=b;while(cur=cur.parentNode){bp.unshift(cur)}while(ap[i]===bp[i]){i++}return i?siblingCheck(ap[i],bp[i]):ap[i]===preferredDoc?-1:bp[i]===preferredDoc?1:0};return document};Sizzle.matches=function(expr,elements){return Sizzle(expr,null,null,elements)};Sizzle.matchesSelector=function(elem,expr){if((elem.ownerDocument||elem)!==document){setDocument(elem)}expr=expr.replace(rattributeQuotes,"='$1']");if(support.matchesSelector&&documentIsHTML&&!compilerCache[expr+" "]&&(!rbuggyMatches||!rbuggyMatches.test(expr))&&(!rbuggyQSA||!rbuggyQSA.test(expr))){try{var ret=matches.call(elem,expr);if(ret||support.disconnectedMatch||elem.document&&elem.document.nodeType!==11){return ret}}catch(e){}}return Sizzle(expr,document,null,[elem]).length>0};Sizzle.contains=function(context,elem){if((context.ownerDocument||context)!==document){setDocument(context)}return contains(context,elem)};Sizzle.attr=function(elem,name){if((elem.ownerDocument||elem)!==document){setDocument(elem)}var fn=Expr.attrHandle[name.toLowerCase()],val=fn&&hasOwn.call(Expr.attrHandle,name.toLowerCase())?fn(elem,name,!documentIsHTML):undefined;return val!==undefined?val:support.attributes||!documentIsHTML?elem.getAttribute(name):(val=elem.getAttributeNode(name))&&val.specified?val.value:null};Sizzle.error=function(msg){throw new Error("Syntax error, unrecognized expression: "+msg)};Sizzle.uniqueSort=function(results){var elem,duplicates=[],j=0,i=0;hasDuplicate=!support.detectDuplicates;sortInput=!support.sortStable&&results.slice(0);results.sort(sortOrder);if(hasDuplicate){while(elem=results[i++]){if(elem===results[i]){j=duplicates.push(i)}}while(j--){results.splice(duplicates[j],1)}}sortInput=null;return results};getText=Sizzle.getText=function(elem){var node,ret="",i=0,nodeType=elem.nodeType;if(!nodeType){while(node=elem[i++]){ret+=getText(node)}}else if(nodeType===1||nodeType===9||nodeType===11){if(typeof elem.textContent==="string"){return elem.textContent}else{for(elem=elem.firstChild;elem;elem=elem.nextSibling){ret+=getText(elem)}}}else if(nodeType===3||nodeType===4){return elem.nodeValue}return ret};Expr=Sizzle.selectors={cacheLength:50,createPseudo:markFunction,match:matchExpr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(match){match[1]=match[1].replace(runescape,funescape);match[3]=(match[3]||match[4]||match[5]||"").replace(runescape,funescape);if(match[2]==="~="){match[3]=" "+match[3]+" "}return match.slice(0,4)},CHILD:function(match){match[1]=match[1].toLowerCase();if(match[1].slice(0,3)==="nth"){if(!match[3]){Sizzle.error(match[0])}match[4]=+(match[4]?match[5]+(match[6]||1):2*(match[3]==="even"||match[3]==="odd"));match[5]=+(match[7]+match[8]||match[3]==="odd")}else if(match[3]){Sizzle.error(match[0])}return match},PSEUDO:function(match){var excess,unquoted=!match[6]&&match[2];if(matchExpr["CHILD"].test(match[0])){return null}if(match[3]){match[2]=match[4]||match[5]||""}else if(unquoted&&rpseudo.test(unquoted)&&(excess=tokenize(unquoted,true))&&(excess=unquoted.indexOf(")",unquoted.length-excess)-unquoted.length)){match[0]=match[0].slice(0,excess);match[2]=unquoted.slice(0,excess)}return match.slice(0,3)}},filter:{TAG:function(nodeNameSelector){var nodeName=nodeNameSelector.replace(runescape,funescape).toLowerCase();return nodeNameSelector==="*"?function(){return true}:function(elem){return elem.nodeName&&elem.nodeName.toLowerCase()===nodeName}},CLASS:function(className){var pattern=classCache[className+" "];return pattern||(pattern=new RegExp("(^|"+whitespace+")"+className+"("+whitespace+"|$)"))&&classCache(className,function(elem){return pattern.test(typeof elem.className==="string"&&elem.className||typeof elem.getAttribute!=="undefined"&&elem.getAttribute("class")||"")})},ATTR:function(name,operator,check){return function(elem){var result=Sizzle.attr(elem,name);if(result==null){return operator==="!="}if(!operator){return true}result+="";return operator==="="?result===check:operator==="!="?result!==check:operator==="^="?check&&result.indexOf(check)===0:operator==="*="?check&&result.indexOf(check)>-1:operator==="$="?check&&result.slice(-check.length)===check:operator==="~="?(" "+result.replace(rwhitespace," ")+" ").indexOf(check)>-1:operator==="|="?result===check||result.slice(0,check.length+1)===check+"-":false}},CHILD:function(type,what,argument,first,last){var simple=type.slice(0,3)!=="nth",forward=type.slice(-4)!=="last",ofType=what==="of-type";return first===1&&last===0?function(elem){return!!elem.parentNode}:function(elem,context,xml){var cache,uniqueCache,outerCache,node,nodeIndex,start,dir=simple!==forward?"nextSibling":"previousSibling",parent=elem.parentNode,name=ofType&&elem.nodeName.toLowerCase(),useCache=!xml&&!ofType,diff=false;if(parent){if(simple){while(dir){node=elem;while(node=node[dir]){if(ofType?node.nodeName.toLowerCase()===name:node.nodeType===1){return false}}start=dir=type==="only"&&!start&&"nextSibling"}return true}start=[forward?parent.firstChild:parent.lastChild];if(forward&&useCache){node=parent;outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});cache=uniqueCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex&&cache[2];node=nodeIndex&&parent.childNodes[nodeIndex];while(node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop()){if(node.nodeType===1&&++diff&&node===elem){uniqueCache[type]=[dirruns,nodeIndex,diff];break}}}else{if(useCache){node=elem;outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});cache=uniqueCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex}if(diff===false){while(node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop()){if((ofType?node.nodeName.toLowerCase()===name:node.nodeType===1)&&++diff){if(useCache){outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});uniqueCache[type]=[dirruns,diff]}if(node===elem){break}}}}}diff-=last;return diff===first||diff%first===0&&diff/first>=0}}},PSEUDO:function(pseudo,argument){var args,fn=Expr.pseudos[pseudo]||Expr.setFilters[pseudo.toLowerCase()]||Sizzle.error("unsupported pseudo: "+pseudo);if(fn[expando]){return fn(argument)}if(fn.length>1){args=[pseudo,pseudo,"",argument];return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase())?markFunction(function(seed,matches){var idx,matched=fn(seed,argument),i=matched.length;while(i--){idx=indexOf(seed,matched[i]);seed[idx]=!(matches[idx]=matched[i])}}):function(elem){return fn(elem,0,args)}}return fn}},pseudos:{not:markFunction(function(selector){var input=[],results=[],matcher=compile(selector.replace(rtrim,"$1"));return matcher[expando]?markFunction(function(seed,matches,context,xml){var elem,unmatched=matcher(seed,null,xml,[]),i=seed.length;while(i--){if(elem=unmatched[i]){seed[i]=!(matches[i]=elem)}}}):function(elem,context,xml){input[0]=elem;matcher(input,null,xml,results);input[0]=null;return!results.pop()}}),has:markFunction(function(selector){return function(elem){return Sizzle(selector,elem).length>0}}),contains:markFunction(function(text){text=text.replace(runescape,funescape);return function(elem){return(elem.textContent||elem.innerText||getText(elem)).indexOf(text)>-1}}),lang:markFunction(function(lang){if(!ridentifier.test(lang||"")){Sizzle.error("unsupported lang: "+lang)}lang=lang.replace(runescape,funescape).toLowerCase();return function(elem){var elemLang;do{if(elemLang=documentIsHTML?elem.lang:elem.getAttribute("xml:lang")||elem.getAttribute("lang")){elemLang=elemLang.toLowerCase();return elemLang===lang||elemLang.indexOf(lang+"-")===0}}while((elem=elem.parentNode)&&elem.nodeType===1);return false}}),target:function(elem){var hash=window.location&&window.location.hash;return hash&&hash.slice(1)===elem.id},root:function(elem){return elem===docElem},focus:function(elem){return elem===document.activeElement&&(!document.hasFocus||document.hasFocus())&&!!(elem.type||elem.href||~elem.tabIndex)},enabled:function(elem){return elem.disabled===false},disabled:function(elem){return elem.disabled===true},checked:function(elem){var nodeName=elem.nodeName.toLowerCase();return nodeName==="input"&&!!elem.checked||nodeName==="option"&&!!elem.selected},selected:function(elem){if(elem.parentNode){elem.parentNode.selectedIndex}return elem.selected===true},empty:function(elem){for(elem=elem.firstChild;elem;elem=elem.nextSibling){if(elem.nodeType<6){return false}}return true},parent:function(elem){return!Expr.pseudos["empty"](elem)},header:function(elem){return rheader.test(elem.nodeName)},input:function(elem){return rinputs.test(elem.nodeName)},button:function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type==="button"||name==="button"},text:function(elem){var attr;return elem.nodeName.toLowerCase()==="input"&&elem.type==="text"&&((attr=elem.getAttribute("type"))==null||attr.toLowerCase()==="text")},first:createPositionalPseudo(function(){return[0]}),last:createPositionalPseudo(function(matchIndexes,length){return[length-1]}),eq:createPositionalPseudo(function(matchIndexes,length,argument){return[argument<0?argument+length:argument]}),even:createPositionalPseudo(function(matchIndexes,length){var i=0;for(;i=0;){matchIndexes.push(i)}return matchIndexes}),gt:createPositionalPseudo(function(matchIndexes,length,argument){var i=argument<0?argument+length:argument;for(;++i1?function(elem,context,xml){var i=matchers.length;while(i--){if(!matchers[i](elem,context,xml)){return false}}return true}:matchers[0]}function multipleContexts(selector,contexts,results){var i=0,len=contexts.length;for(;i-1){seed[temp]=!(results[temp]=elem)}}}}else{matcherOut=condense(matcherOut===results?matcherOut.splice(preexisting,matcherOut.length):matcherOut);if(postFinder){postFinder(null,results,matcherOut,xml)}else{push.apply(results,matcherOut)}}})}function matcherFromTokens(tokens){var checkContext,matcher,j,len=tokens.length,leadingRelative=Expr.relative[tokens[0].type],implicitRelative=leadingRelative||Expr.relative[" "],i=leadingRelative?1:0,matchContext=addCombinator(function(elem){return elem===checkContext},implicitRelative,true),matchAnyContext=addCombinator(function(elem){return indexOf(checkContext,elem)>-1},implicitRelative,true),matchers=[function(elem,context,xml){var ret=!leadingRelative&&(xml||context!==outermostContext)||((checkContext=context).nodeType?matchContext(elem,context,xml):matchAnyContext(elem,context,xml));checkContext=null;return ret}];for(;i1&&elementMatcher(matchers),i>1&&toSelector(tokens.slice(0,i-1).concat({value:tokens[i-2].type===" "?"*":""})).replace(rtrim,"$1"),matcher,i0,byElement=elementMatchers.length>0,superMatcher=function(seed,context,xml,results,outermost){var elem,j,matcher,matchedCount=0,i="0",unmatched=seed&&[],setMatched=[],contextBackup=outermostContext,elems=seed||byElement&&Expr.find["TAG"]("*",outermost),dirrunsUnique=dirruns+=contextBackup==null?1:Math.random()||.1,len=elems.length;if(outermost){outermostContext=context===document||context||outermost}for(;i!==len&&(elem=elems[i])!=null;i++){if(byElement&&elem){j=0;if(!context&&elem.ownerDocument!==document){setDocument(elem);xml=!documentIsHTML}while(matcher=elementMatchers[j++]){if(matcher(elem,context||document,xml)){results.push(elem);break}}if(outermost){dirruns=dirrunsUnique}}if(bySet){if(elem=!matcher&&elem){matchedCount--}if(seed){unmatched.push(elem)}}}matchedCount+=i;if(bySet&&i!==matchedCount){j=0;while(matcher=setMatchers[j++]){matcher(unmatched,setMatched,context,xml)}if(seed){if(matchedCount>0){while(i--){if(!(unmatched[i]||setMatched[i])){setMatched[i]=pop.call(results)}}}setMatched=condense(setMatched)}push.apply(results,setMatched);if(outermost&&!seed&&setMatched.length>0&&matchedCount+setMatchers.length>1){Sizzle.uniqueSort(results)}}if(outermost){dirruns=dirrunsUnique;outermostContext=contextBackup}return unmatched};return bySet?markFunction(superMatcher):superMatcher}compile=Sizzle.compile=function(selector,match){var i,setMatchers=[],elementMatchers=[],cached=compilerCache[selector+" "];if(!cached){if(!match){match=tokenize(selector)}i=match.length;while(i--){cached=matcherFromTokens(match[i]);if(cached[expando]){setMatchers.push(cached)}else{elementMatchers.push(cached)}}cached=compilerCache(selector,matcherFromGroupMatchers(elementMatchers,setMatchers));cached.selector=selector}return cached};select=Sizzle.select=function(selector,context,results,seed){var i,tokens,token,type,find,compiled=typeof selector==="function"&&selector,match=!seed&&tokenize(selector=compiled.selector||selector);results=results||[];if(match.length===1){tokens=match[0]=match[0].slice(0);if(tokens.length>2&&(token=tokens[0]).type==="ID"&&support.getById&&context.nodeType===9&&documentIsHTML&&Expr.relative[tokens[1].type]){context=(Expr.find["ID"](token.matches[0].replace(runescape,funescape),context)||[])[0];if(!context){return results}else if(compiled){context=context.parentNode}selector=selector.slice(tokens.shift().value.length)}i=matchExpr["needsContext"].test(selector)?0:tokens.length;while(i--){token=tokens[i];if(Expr.relative[type=token.type]){break}if(find=Expr.find[type]){if(seed=find(token.matches[0].replace(runescape,funescape),rsibling.test(tokens[0].type)&&testContext(context.parentNode)||context)){tokens.splice(i,1);selector=seed.length&&toSelector(tokens);if(!selector){push.apply(results,seed);return results}break}}}}(compiled||compile(selector,match))(seed,context,!documentIsHTML,results,!context||rsibling.test(selector)&&testContext(context.parentNode)||context);return results};support.sortStable=expando.split("").sort(sortOrder).join("")===expando;support.detectDuplicates=!!hasDuplicate;setDocument();support.sortDetached=assert(function(div1){return div1.compareDocumentPosition(document.createElement("div"))&1});if(!assert(function(div){div.innerHTML="";return div.firstChild.getAttribute("href")==="#"})){addHandle("type|href|height|width",function(elem,name,isXML){if(!isXML){return elem.getAttribute(name,name.toLowerCase()==="type"?1:2)}})}if(!support.attributes||!assert(function(div){div.innerHTML="";div.firstChild.setAttribute("value","");return div.firstChild.getAttribute("value")===""})){addHandle("value",function(elem,name,isXML){if(!isXML&&elem.nodeName.toLowerCase()==="input"){return elem.defaultValue}})}if(!assert(function(div){return div.getAttribute("disabled")==null})){addHandle(booleans,function(elem,name,isXML){var val;if(!isXML){return elem[name]===true?name.toLowerCase():(val=elem.getAttributeNode(name))&&val.specified?val.value:null}})}return Sizzle}(window);jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.pseudos;jQuery.uniqueSort=jQuery.unique=Sizzle.uniqueSort;jQuery.text=Sizzle.getText;jQuery.isXMLDoc=Sizzle.isXML;jQuery.contains=Sizzle.contains;var dir=function(elem,dir,until){var matched=[],truncate=until!==undefined;while((elem=elem[dir])&&elem.nodeType!==9){if(elem.nodeType===1){if(truncate&&jQuery(elem).is(until)){break}matched.push(elem)}}return matched};var siblings=function(n,elem){var matched=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){matched.push(n)}}return matched};var rneedsContext=jQuery.expr.match.needsContext;var rsingleTag=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/;var risSimple=/^.[^:#\[\.,]*$/;function winnow(elements,qualifier,not){if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){return!!qualifier.call(elem,i,elem)!==not})}if(qualifier.nodeType){return jQuery.grep(elements,function(elem){return elem===qualifier!==not})}if(typeof qualifier==="string"){if(risSimple.test(qualifier)){return jQuery.filter(qualifier,elements,not)}qualifier=jQuery.filter(qualifier,elements)}return jQuery.grep(elements,function(elem){return indexOf.call(qualifier,elem)>-1!==not})}jQuery.filter=function(expr,elems,not){var elem=elems[0];if(not){expr=":not("+expr+")"}return elems.length===1&&elem.nodeType===1?jQuery.find.matchesSelector(elem,expr)?[elem]:[]:jQuery.find.matches(expr,jQuery.grep(elems,function(elem){return elem.nodeType===1}))};jQuery.fn.extend({find:function(selector){var i,len=this.length,ret=[],self=this;if(typeof selector!=="string"){return this.pushStack(jQuery(selector).filter(function(){for(i=0;i1?jQuery.unique(ret):ret);ret.selector=this.selector?this.selector+" "+selector:selector;return ret},filter:function(selector){return this.pushStack(winnow(this,selector||[],false))},not:function(selector){return this.pushStack(winnow(this,selector||[],true))},is:function(selector){return!!winnow(this,typeof selector==="string"&&rneedsContext.test(selector)?jQuery(selector):selector||[],false).length}});var rootjQuery,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,init=jQuery.fn.init=function(selector,context,root){var match,elem;if(!selector){return this}root=root||rootjQuery;if(typeof selector==="string"){if(selector[0]==="<"&&selector[selector.length-1]===">"&&selector.length>=3){match=[null,selector,null]}else{match=rquickExpr.exec(selector)}if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;jQuery.merge(this,jQuery.parseHTML(match[1],context&&context.nodeType?context.ownerDocument||context:document,true));if(rsingleTag.test(match[1])&&jQuery.isPlainObject(context)){for(match in context){if(jQuery.isFunction(this[match])){ -this[match](context[match])}else{this.attr(match,context[match])}}}return this}else{elem=document.getElementById(match[2]);if(elem&&elem.parentNode){this.length=1;this[0]=elem}this.context=document;this.selector=selector;return this}}else if(!context||context.jquery){return(context||root).find(selector)}else{return this.constructor(context).find(selector)}}else if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this}else if(jQuery.isFunction(selector)){return root.ready!==undefined?root.ready(selector):selector(jQuery)}if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context}return jQuery.makeArray(selector,this)};init.prototype=jQuery.fn;rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({has:function(target){var targets=jQuery(target,this),l=targets.length;return this.filter(function(){var i=0;for(;i-1:cur.nodeType===1&&jQuery.find.matchesSelector(cur,selectors))){matched.push(cur);break}}}return this.pushStack(matched.length>1?jQuery.uniqueSort(matched):matched)},index:function(elem){if(!elem){return this[0]&&this[0].parentNode?this.first().prevAll().length:-1}if(typeof elem==="string"){return indexOf.call(jQuery(elem),this[0])}return indexOf.call(this,elem.jquery?elem[0]:elem)},add:function(selector,context){return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(),jQuery(selector,context))))},addBack:function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}});function sibling(cur,dir){while((cur=cur[dir])&&cur.nodeType!==1){}return cur}jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null},parents:function(elem){return dir(elem,"parentNode")},parentsUntil:function(elem,i,until){return dir(elem,"parentNode",until)},next:function(elem){return sibling(elem,"nextSibling")},prev:function(elem){return sibling(elem,"previousSibling")},nextAll:function(elem){return dir(elem,"nextSibling")},prevAll:function(elem){return dir(elem,"previousSibling")},nextUntil:function(elem,i,until){return dir(elem,"nextSibling",until)},prevUntil:function(elem,i,until){return dir(elem,"previousSibling",until)},siblings:function(elem){return siblings((elem.parentNode||{}).firstChild,elem)},children:function(elem){return siblings(elem.firstChild)},contents:function(elem){return elem.contentDocument||jQuery.merge([],elem.childNodes)}},function(name,fn){jQuery.fn[name]=function(until,selector){var matched=jQuery.map(this,fn,until);if(name.slice(-5)!=="Until"){selector=until}if(selector&&typeof selector==="string"){matched=jQuery.filter(selector,matched)}if(this.length>1){if(!guaranteedUnique[name]){jQuery.uniqueSort(matched)}if(rparentsprev.test(name)){matched.reverse()}}return this.pushStack(matched)}});var rnotwhite=/\S+/g;function createOptions(options){var object={};jQuery.each(options.match(rnotwhite)||[],function(_,flag){object[flag]=true});return object}jQuery.Callbacks=function(options){options=typeof options==="string"?createOptions(options):jQuery.extend({},options);var firing,memory,fired,locked,list=[],queue=[],firingIndex=-1,fire=function(){locked=options.once;fired=firing=true;for(;queue.length;firingIndex=-1){memory=queue.shift();while(++firingIndex-1){list.splice(index,1);if(index<=firingIndex){firingIndex--}}});return this},has:function(fn){return fn?jQuery.inArray(fn,list)>-1:list.length>0},empty:function(){if(list){list=[]}return this},disable:function(){locked=queue=[];list=memory="";return this},disabled:function(){return!list},lock:function(){locked=queue=[];if(!memory){list=memory=""}return this},locked:function(){return!!locked},fireWith:function(context,args){if(!locked){args=args||[];args=[context,args.slice?args.slice():args];queue.push(args);if(!firing){fire()}}return this},fire:function(){self.fireWith(this,arguments);return this},fired:function(){return!!fired}};return self};jQuery.extend({Deferred:function(func){var tuples=[["resolve","done",jQuery.Callbacks("once memory"),"resolved"],["reject","fail",jQuery.Callbacks("once memory"),"rejected"],["notify","progress",jQuery.Callbacks("memory")]],state="pending",promise={state:function(){return state},always:function(){deferred.done(arguments).fail(arguments);return this},then:function(){var fns=arguments;return jQuery.Deferred(function(newDefer){jQuery.each(tuples,function(i,tuple){var fn=jQuery.isFunction(fns[i])&&fns[i];deferred[tuple[1]](function(){var returned=fn&&fn.apply(this,arguments);if(returned&&jQuery.isFunction(returned.promise)){returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject)}else{newDefer[tuple[0]+"With"](this===promise?newDefer.promise():this,fn?[returned]:arguments)}})});fns=null}).promise()},promise:function(obj){return obj!=null?jQuery.extend(obj,promise):promise}},deferred={};promise.pipe=promise.then;jQuery.each(tuples,function(i,tuple){var list=tuple[2],stateString=tuple[3];promise[tuple[1]]=list.add;if(stateString){list.add(function(){state=stateString},tuples[i^1][2].disable,tuples[2][2].lock)}deferred[tuple[0]]=function(){deferred[tuple[0]+"With"](this===deferred?promise:this,arguments);return this};deferred[tuple[0]+"With"]=list.fireWith});promise.promise(deferred);if(func){func.call(deferred,deferred)}return deferred},when:function(subordinate){var i=0,resolveValues=slice.call(arguments),length=resolveValues.length,remaining=length!==1||subordinate&&jQuery.isFunction(subordinate.promise)?length:0,deferred=remaining===1?subordinate:jQuery.Deferred(),updateFunc=function(i,contexts,values){return function(value){contexts[i]=this;values[i]=arguments.length>1?slice.call(arguments):value;if(values===progressValues){deferred.notifyWith(contexts,values)}else if(!--remaining){deferred.resolveWith(contexts,values)}}},progressValues,progressContexts,resolveContexts;if(length>1){progressValues=new Array(length);progressContexts=new Array(length);resolveContexts=new Array(length);for(;i0){return}readyList.resolveWith(document,[jQuery]);if(jQuery.fn.triggerHandler){jQuery(document).triggerHandler("ready");jQuery(document).off("ready")}}});function completed(){document.removeEventListener("DOMContentLoaded",completed);window.removeEventListener("load",completed);jQuery.ready()}jQuery.ready.promise=function(obj){if(!readyList){readyList=jQuery.Deferred();if(document.readyState==="complete"||document.readyState!=="loading"&&!document.documentElement.doScroll){window.setTimeout(jQuery.ready)}else{document.addEventListener("DOMContentLoaded",completed);window.addEventListener("load",completed)}}return readyList.promise(obj)};jQuery.ready.promise();var access=function(elems,fn,key,value,chainable,emptyGet,raw){var i=0,len=elems.length,bulk=key==null;if(jQuery.type(key)==="object"){chainable=true;for(i in key){access(elems,fn,i,key[i],true,emptyGet,raw)}}else if(value!==undefined){chainable=true;if(!jQuery.isFunction(value)){raw=true}if(bulk){if(raw){fn.call(elems,value);fn=null}else{bulk=fn;fn=function(elem,key,value){return bulk.call(jQuery(elem),value)}}}if(fn){for(;i-1&&data!==undefined){dataUser.set(this,key,value)}})},null,value,arguments.length>1,null,true)},removeData:function(key){return this.each(function(){dataUser.remove(this,key)})}});jQuery.extend({queue:function(elem,type,data){var queue;if(elem){type=(type||"fx")+"queue";queue=dataPriv.get(elem,type);if(data){if(!queue||jQuery.isArray(data)){queue=dataPriv.access(elem,type,jQuery.makeArray(data))}else{queue.push(data)}}return queue||[]}},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),startLength=queue.length,fn=queue.shift(),hooks=jQuery._queueHooks(elem,type),next=function(){jQuery.dequeue(elem,type)};if(fn==="inprogress"){fn=queue.shift();startLength--}if(fn){if(type==="fx"){queue.unshift("inprogress")}delete hooks.stop;fn.call(elem,next,hooks)}if(!startLength&&hooks){hooks.empty.fire()}},_queueHooks:function(elem,type){var key=type+"queueHooks";return dataPriv.get(elem,key)||dataPriv.access(elem,key,{empty:jQuery.Callbacks("once memory").add(function(){dataPriv.remove(elem,[type+"queue",key])})})}});jQuery.fn.extend({queue:function(type,data){var setter=2;if(typeof type!=="string"){data=type;type="fx";setter--}if(arguments.length",""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;function getAll(context,tag){var ret=typeof context.getElementsByTagName!=="undefined"?context.getElementsByTagName(tag||"*"):typeof context.querySelectorAll!=="undefined"?context.querySelectorAll(tag||"*"):[];return tag===undefined||tag&&jQuery.nodeName(context,tag)?jQuery.merge([context],ret):ret}function setGlobalEval(elems,refElements){var i=0,l=elems.length;for(;i-1){if(ignored){ignored.push(elem)}continue}contains=jQuery.contains(elem.ownerDocument,elem);tmp=getAll(fragment.appendChild(elem),"script");if(contains){setGlobalEval(tmp)}if(scripts){j=0;while(elem=tmp[j++]){if(rscriptType.test(elem.type||"")){scripts.push(elem)}}}}return fragment}(function(){var fragment=document.createDocumentFragment(),div=fragment.appendChild(document.createElement("div")),input=document.createElement("input");input.setAttribute("type","radio");input.setAttribute("checked","checked");input.setAttribute("name","t");div.appendChild(input);support.checkClone=div.cloneNode(true).cloneNode(true).lastChild.checked;div.innerHTML="";support.noCloneChecked=!!div.cloneNode(true).lastChild.defaultValue})();var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rtypenamespace=/^([^.]*)(?:\.(.+)|)/;function returnTrue(){return true}function returnFalse(){return false}function safeActiveElement(){try{return document.activeElement}catch(err){}}function on(elem,types,selector,data,fn,one){var origFn,type;if(typeof types==="object"){if(typeof selector!=="string"){data=data||selector;selector=undefined}for(type in types){on(elem,type,selector,data,types[type],one)}return elem}if(data==null&&fn==null){fn=selector;data=selector=undefined}else if(fn==null){if(typeof selector==="string"){fn=data;data=undefined}else{fn=data;data=selector;selector=undefined}}if(fn===false){fn=returnFalse}else if(!fn){return elem}if(one===1){origFn=fn;fn=function(event){jQuery().off(event);return origFn.apply(this,arguments)};fn.guid=origFn.guid||(origFn.guid=jQuery.guid++)}return elem.each(function(){jQuery.event.add(this,types,fn,data,selector)})}jQuery.event={global:{},add:function(elem,types,handler,data,selector){var handleObjIn,eventHandle,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.get(elem);if(!elemData){return}if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;selector=handleObjIn.selector}if(!handler.guid){handler.guid=jQuery.guid++}if(!(events=elemData.events)){events=elemData.events={}}if(!(eventHandle=elemData.handle)){eventHandle=elemData.handle=function(e){return typeof jQuery!=="undefined"&&jQuery.event.triggered!==e.type?jQuery.event.dispatch.apply(elem,arguments):undefined}}types=(types||"").match(rnotwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){continue}special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;special=jQuery.event.special[type]||{};handleObj=jQuery.extend({type:type,origType:origType,data:data,handler:handler,guid:handler.guid,selector:selector,needsContext:selector&&jQuery.expr.match.needsContext.test(selector),namespace:namespaces.join(".")},handleObjIn);if(!(handlers=events[type])){handlers=events[type]=[];handlers.delegateCount=0;if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){if(elem.addEventListener){elem.addEventListener(type,eventHandle)}}}if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid}}if(selector){handlers.splice(handlers.delegateCount++,0,handleObj)}else{handlers.push(handleObj)}jQuery.event.global[type]=true}},remove:function(elem,types,handler,selector,mappedTypes){var j,origCount,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.hasData(elem)&&dataPriv.get(elem);if(!elemData||!(events=elemData.events)){return}types=(types||"").match(rnotwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){for(type in events){jQuery.event.remove(elem,type+types[t],handler,selector,true)}continue}special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;handlers=events[type]||[];tmp=tmp[2]&&new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)");origCount=j=handlers.length;while(j--){handleObj=handlers[j];if((mappedTypes||origType===handleObj.origType)&&(!handler||handler.guid===handleObj.guid)&&(!tmp||tmp.test(handleObj.namespace))&&(!selector||selector===handleObj.selector||selector==="**"&&handleObj.selector)){handlers.splice(j,1);if(handleObj.selector){handlers.delegateCount--}if(special.remove){special.remove.call(elem,handleObj)}}}if(origCount&&!handlers.length){if(!special.teardown||special.teardown.call(elem,namespaces,elemData.handle)===false){jQuery.removeEvent(elem,type,elemData.handle)}delete events[type]}}if(jQuery.isEmptyObject(events)){dataPriv.remove(elem,"handle events")}},dispatch:function(event){event=jQuery.event.fix(event);var i,j,ret,matched,handleObj,handlerQueue=[],args=slice.call(arguments),handlers=(dataPriv.get(this,"events")||{})[event.type]||[],special=jQuery.event.special[event.type]||{};args[0]=event;event.delegateTarget=this;if(special.preDispatch&&special.preDispatch.call(this,event)===false){return}handlerQueue=jQuery.event.handlers.call(this,event,handlers);i=0;while((matched=handlerQueue[i++])&&!event.isPropagationStopped()){event.currentTarget=matched.elem;j=0;while((handleObj=matched.handlers[j++])&&!event.isImmediatePropagationStopped()){if(!event.rnamespace||event.rnamespace.test(handleObj.namespace)){event.handleObj=handleObj;event.data=handleObj.data;ret=((jQuery.event.special[handleObj.origType]||{}).handle||handleObj.handler).apply(matched.elem,args);if(ret!==undefined){if((event.result=ret)===false){event.preventDefault();event.stopPropagation()}}}}}if(special.postDispatch){special.postDispatch.call(this,event)}return event.result},handlers:function(event,handlers){var i,matches,sel,handleObj,handlerQueue=[],delegateCount=handlers.delegateCount,cur=event.target;if(delegateCount&&cur.nodeType&&(event.type!=="click"||isNaN(event.button)||event.button<1)){for(;cur!==this;cur=cur.parentNode||this){if(cur.nodeType===1&&(cur.disabled!==true||event.type!=="click")){matches=[];for(i=0;i-1:jQuery.find(sel,this,null,[cur]).length}if(matches[sel]){matches.push(handleObj)}}if(matches.length){handlerQueue.push({elem:cur,handlers:matches})}}}}if(delegateCount]*)\/>/gi,rnoInnerhtml=/\s*$/g;function manipulationTarget(elem,content){return jQuery.nodeName(elem,"table")&&jQuery.nodeName(content.nodeType!==11?content:content.firstChild,"tr")?elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody")):elem}function disableScript(elem){elem.type=(elem.getAttribute("type")!==null)+"/"+elem.type;return elem}function restoreScript(elem){var match=rscriptTypeMasked.exec(elem.type);if(match){elem.type=match[1]}else{elem.removeAttribute("type")}return elem}function cloneCopyEvent(src,dest){var i,l,type,pdataOld,pdataCur,udataOld,udataCur,events;if(dest.nodeType!==1){return}if(dataPriv.hasData(src)){pdataOld=dataPriv.access(src);pdataCur=dataPriv.set(dest,pdataOld);events=pdataOld.events;if(events){delete pdataCur.handle;pdataCur.events={};for(type in events){for(i=0,l=events[type].length;i1&&typeof value==="string"&&!support.checkClone&&rchecked.test(value)){return collection.each(function(index){var self=collection.eq(index);if(isFunction){args[0]=value.call(this,index,self.html())}domManip(self,args,callback,ignored)})}if(l){fragment=buildFragment(args,collection[0].ownerDocument,false,collection,ignored);first=fragment.firstChild;if(fragment.childNodes.length===1){fragment=first}if(first||ignored){scripts=jQuery.map(getAll(fragment,"script"),disableScript);hasScripts=scripts.length;for(;i")},clone:function(elem,dataAndEvents,deepDataAndEvents){var i,l,srcElements,destElements,clone=elem.cloneNode(true),inPage=jQuery.contains(elem.ownerDocument,elem);if(!support.noCloneChecked&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){destElements=getAll(clone);srcElements=getAll(elem);for(i=0,l=srcElements.length;i0){setGlobalEval(destElements,!inPage&&getAll(elem,"script"))}return clone},cleanData:function(elems){var data,elem,type,special=jQuery.event.special,i=0;for(;(elem=elems[i])!==undefined;i++){if(acceptData(elem)){if(data=elem[dataPriv.expando]){if(data.events){for(type in data.events){if(special[type]){jQuery.event.remove(elem,type)}else{jQuery.removeEvent(elem,type,data.handle)}}}elem[dataPriv.expando]=undefined}if(elem[dataUser.expando]){elem[dataUser.expando]=undefined}}}}});jQuery.fn.extend({domManip:domManip,detach:function(selector){return remove(this,selector,true)},remove:function(selector){return remove(this,selector)},text:function(value){return access(this,function(value){return value===undefined?jQuery.text(this):this.empty().each(function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){this.textContent=value}})},null,value,arguments.length)},append:function(){return domManip(this,arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.appendChild(elem)}})},prepend:function(){return domManip(this,arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.insertBefore(elem,target.firstChild)}})},before:function(){return domManip(this,arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this)}})},after:function(){return domManip(this,arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this.nextSibling)}})},empty:function(){var elem,i=0;for(;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));elem.textContent=""}}return this},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents)})},html:function(value){return access(this,function(value){var elem=this[0]||{},i=0,l=this.length;if(value===undefined&&elem.nodeType===1){return elem.innerHTML}if(typeof value==="string"&&!rnoInnerhtml.test(value)&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=jQuery.htmlPrefilter(value);try{for(;i")).appendTo(doc.documentElement);doc=iframe[0].contentDocument;doc.write();doc.close();display=actualDisplay(nodeName,doc);iframe.detach()}elemdisplay[nodeName]=display}return display}var rmargin=/^margin/;var rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i");var getStyles=function(elem){var view=elem.ownerDocument.defaultView;if(!view||!view.opener){view=window}return view.getComputedStyle(elem)};var swap=function(elem,options,callback,args){var ret,name,old={};for(name in options){old[name]=elem.style[name];elem.style[name]=options[name]}ret=callback.apply(elem,args||[]);for(name in options){elem.style[name]=old[name]}return ret};var documentElement=document.documentElement;(function(){var pixelPositionVal,boxSizingReliableVal,pixelMarginRightVal,reliableMarginLeftVal,container=document.createElement("div"),div=document.createElement("div");if(!div.style){return}div.style.backgroundClip="content-box";div.cloneNode(true).style.backgroundClip="";support.clearCloneStyle=div.style.backgroundClip==="content-box";container.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;"+"padding:0;margin-top:1px;position:absolute";container.appendChild(div);function computeStyleTests(){div.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;"+"position:relative;display:block;"+"margin:auto;border:1px;padding:1px;"+"top:1%;width:50%";div.innerHTML="";documentElement.appendChild(container);var divStyle=window.getComputedStyle(div);pixelPositionVal=divStyle.top!=="1%";reliableMarginLeftVal=divStyle.marginLeft==="2px";boxSizingReliableVal=divStyle.width==="4px";div.style.marginRight="50%";pixelMarginRightVal=divStyle.marginRight==="4px";documentElement.removeChild(container)}jQuery.extend(support,{pixelPosition:function(){computeStyleTests();return pixelPositionVal},boxSizingReliable:function(){if(boxSizingReliableVal==null){computeStyleTests()}return boxSizingReliableVal},pixelMarginRight:function(){if(boxSizingReliableVal==null){computeStyleTests()}return pixelMarginRightVal},reliableMarginLeft:function(){if(boxSizingReliableVal==null){computeStyleTests()}return reliableMarginLeftVal},reliableMarginRight:function(){var ret,marginDiv=div.appendChild(document.createElement("div"));marginDiv.style.cssText=div.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;"+"display:block;margin:0;border:0;padding:0";marginDiv.style.marginRight=marginDiv.style.width="0";div.style.width="1px";documentElement.appendChild(container);ret=!parseFloat(window.getComputedStyle(marginDiv).marginRight);documentElement.removeChild(container);div.removeChild(marginDiv);return ret}})})();function curCSS(elem,name,computed){var width,minWidth,maxWidth,ret,style=elem.style;computed=computed||getStyles(elem);ret=computed?computed.getPropertyValue(name)||computed[name]:undefined;if((ret===""||ret===undefined)&&!jQuery.contains(elem.ownerDocument,elem)){ret=jQuery.style(elem,name)}if(computed){if(!support.pixelMarginRight()&&rnumnonpx.test(ret)&&rmargin.test(name)){width=style.width;minWidth=style.minWidth;maxWidth=style.maxWidth;style.minWidth=style.maxWidth=style.width=ret;ret=computed.width;style.width=width;style.minWidth=minWidth;style.maxWidth=maxWidth}}return ret!==undefined?ret+"":ret}function addGetHookIf(conditionFn,hookFn){return{get:function(){if(conditionFn()){delete this.get;return}return(this.get=hookFn).apply(this,arguments)}}}var rdisplayswap=/^(none|table(?!-c[ea]).+)/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"},cssPrefixes=["Webkit","O","Moz","ms"],emptyStyle=document.createElement("div").style;function vendorPropName(name){if(name in emptyStyle){return name}var capName=name[0].toUpperCase()+name.slice(1),i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in emptyStyle){return name}}}function setPositiveNumber(elem,value,subtract){var matches=rcssNum.exec(value);return matches?Math.max(0,matches[2]-(subtract||0))+(matches[3]||"px"):value}function augmentWidthOrHeight(elem,name,extra,isBorderBox,styles){var i=extra===(isBorderBox?"border":"content")?4:name==="width"?1:0,val=0;for(;i<4;i+=2){if(extra==="margin"){val+=jQuery.css(elem,extra+cssExpand[i],true,styles)}if(isBorderBox){if(extra==="content"){val-=jQuery.css(elem,"padding"+cssExpand[i],true,styles)}if(extra!=="margin"){val-=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles)}}else{val+=jQuery.css(elem,"padding"+cssExpand[i],true,styles);if(extra!=="padding"){val+=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles)}}}return val}function getWidthOrHeight(elem,name,extra){var valueIsBorderBox=true,val=name==="width"?elem.offsetWidth:elem.offsetHeight,styles=getStyles(elem),isBorderBox=jQuery.css(elem,"boxSizing",false,styles)==="border-box";if(val<=0||val==null){val=curCSS(elem,name,styles);if(val<0||val==null){val=elem.style[name]}if(rnumnonpx.test(val)){return val}valueIsBorderBox=isBorderBox&&(support.boxSizingReliable()||val===elem.style[name]);val=parseFloat(val)||0}return val+augmentWidthOrHeight(elem,name,extra||(isBorderBox?"border":"content"),valueIsBorderBox,styles)+"px"}function showHide(elements,show){var display,elem,hidden,values=[],index=0,length=elements.length;for(;index1)},show:function(){return showHide(this,true)},hide:function(){return showHide(this)},toggle:function(state){if(typeof state==="boolean"){return state?this.show():this.hide()}return this.each(function(){if(isHidden(this)){jQuery(this).show()}else{jQuery(this).hide()}})}});function Tween(elem,options,prop,end,easing){return new Tween.prototype.init(elem,options,prop,end,easing)}jQuery.Tween=Tween;Tween.prototype={constructor:Tween,init:function(elem,options,prop,end,easing,unit){this.elem=elem;this.prop=prop;this.easing=easing||jQuery.easing._default;this.options=options;this.start=this.now=this.cur();this.end=end;this.unit=unit||(jQuery.cssNumber[prop]?"":"px")},cur:function(){var hooks=Tween.propHooks[this.prop];return hooks&&hooks.get?hooks.get(this):Tween.propHooks._default.get(this)},run:function(percent){var eased,hooks=Tween.propHooks[this.prop];if(this.options.duration){this.pos=eased=jQuery.easing[this.easing](percent,this.options.duration*percent,0,1,this.options.duration)}else{this.pos=eased=percent}this.now=(this.end-this.start)*eased+this.start;if(this.options.step){this.options.step.call(this.elem,this.now,this)}if(hooks&&hooks.set){hooks.set(this)}else{Tween.propHooks._default.set(this)}return this}};Tween.prototype.init.prototype=Tween.prototype;Tween.propHooks={_default:{get:function(tween){var result;if(tween.elem.nodeType!==1||tween.elem[tween.prop]!=null&&tween.elem.style[tween.prop]==null){return tween.elem[tween.prop]}result=jQuery.css(tween.elem,tween.prop,"");return!result||result==="auto"?0:result},set:function(tween){if(jQuery.fx.step[tween.prop]){jQuery.fx.step[tween.prop](tween)}else if(tween.elem.nodeType===1&&(tween.elem.style[jQuery.cssProps[tween.prop]]!=null||jQuery.cssHooks[tween.prop])){jQuery.style(tween.elem,tween.prop,tween.now+tween.unit)}else{tween.elem[tween.prop]=tween.now}}}};Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(tween){if(tween.elem.nodeType&&tween.elem.parentNode){tween.elem[tween.prop]=tween.now}}};jQuery.easing={linear:function(p){return p},swing:function(p){return.5-Math.cos(p*Math.PI)/2},_default:"swing"};jQuery.fx=Tween.prototype.init;jQuery.fx.step={};var fxNow,timerId,rfxtypes=/^(?:toggle|show|hide)$/,rrun=/queueHooks$/;function createFxNow(){window.setTimeout(function(){fxNow=undefined});return fxNow=jQuery.now()}function genFx(type,includeWidth){var which,i=0,attrs={height:type};includeWidth=includeWidth?1:0;for(;i<4;i+=2-includeWidth){which=cssExpand[i];attrs["margin"+which]=attrs["padding"+which]=type}if(includeWidth){attrs.opacity=attrs.width=type}return attrs}function createTween(value,prop,animation){var tween,collection=(Animation.tweeners[prop]||[]).concat(Animation.tweeners["*"]),index=0,length=collection.length;for(;index1)},removeAttr:function(name){return this.each(function(){jQuery.removeAttr(this,name)})}});jQuery.extend({attr:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return}if(typeof elem.getAttribute==="undefined"){return jQuery.prop(elem,name,value)}if(nType!==1||!jQuery.isXMLDoc(elem)){name=name.toLowerCase();hooks=jQuery.attrHooks[name]||(jQuery.expr.match.bool.test(name)?boolHook:undefined)}if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);return}if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret}elem.setAttribute(name,value+"");return value}if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret}ret=jQuery.find.attr(elem,name);return ret==null?undefined:ret},attrHooks:{type:{set:function(elem,value){if(!support.radioValue&&value==="radio"&&jQuery.nodeName(elem,"input")){var val=elem.value;elem.setAttribute("type",value);if(val){elem.value=val}return value}}}},removeAttr:function(elem,value){var name,propName,i=0,attrNames=value&&value.match(rnotwhite);if(attrNames&&elem.nodeType===1){while(name=attrNames[i++]){propName=jQuery.propFix[name]||name;if(jQuery.expr.match.bool.test(name)){elem[propName]=false}elem.removeAttribute(name)}}}});boolHook={set:function(elem,value,name){if(value===false){jQuery.removeAttr(elem,name)}else{elem.setAttribute(name,name)}return name}};jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),function(i,name){var getter=attrHandle[name]||jQuery.find.attr;attrHandle[name]=function(elem,name,isXML){var ret,handle;if(!isXML){handle=attrHandle[name];attrHandle[name]=ret;ret=getter(elem,name,isXML)!=null?name.toLowerCase():null;attrHandle[name]=handle}return ret}});var rfocusable=/^(?:input|select|textarea|button)$/i,rclickable=/^(?:a|area)$/i;jQuery.fn.extend({prop:function(name,value){return access(this,jQuery.prop,name,value,arguments.length>1)},removeProp:function(name){return this.each(function(){delete this[jQuery.propFix[name]||name]})}});jQuery.extend({prop:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return}if(nType!==1||!jQuery.isXMLDoc(elem)){name=jQuery.propFix[name]||name;hooks=jQuery.propHooks[name]}if(value!==undefined){if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret}return elem[name]=value}if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret}return elem[name]},propHooks:{tabIndex:{get:function(elem){var tabindex=jQuery.find.attr(elem,"tabindex");return tabindex?parseInt(tabindex,10):rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}});if(!support.optSelected){jQuery.propHooks.selected={get:function(elem){var parent=elem.parentNode;if(parent&&parent.parentNode){parent.parentNode.selectedIndex}return null},set:function(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex}}}}}jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){jQuery.propFix[this.toLowerCase()]=this});var rclass=/[\t\r\n\f]/g;function getClass(elem){return elem.getAttribute&&elem.getAttribute("class")||""}jQuery.fn.extend({addClass:function(value){var classes,elem,cur,curValue,clazz,j,finalValue,i=0;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).addClass(value.call(this,j,getClass(this)))})}if(typeof value==="string"&&value){classes=value.match(rnotwhite)||[];while(elem=this[i++]){curValue=getClass(elem);cur=elem.nodeType===1&&(" "+curValue+" ").replace(rclass," ");if(cur){j=0;while(clazz=classes[j++]){if(cur.indexOf(" "+clazz+" ")<0){cur+=clazz+" "}}finalValue=jQuery.trim(cur);if(curValue!==finalValue){elem.setAttribute("class",finalValue)}}}}return this},removeClass:function(value){var classes,elem,cur,curValue,clazz,j,finalValue,i=0;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).removeClass(value.call(this,j,getClass(this)))})}if(!arguments.length){return this.attr("class","")}if(typeof value==="string"&&value){classes=value.match(rnotwhite)||[];while(elem=this[i++]){curValue=getClass(elem);cur=elem.nodeType===1&&(" "+curValue+" ").replace(rclass," ");if(cur){j=0;while(clazz=classes[j++]){while(cur.indexOf(" "+clazz+" ")>-1){cur=cur.replace(" "+clazz+" "," ")}}finalValue=jQuery.trim(cur);if(curValue!==finalValue){elem.setAttribute("class",finalValue)}}}}return this},toggleClass:function(value,stateVal){var type=typeof value;if(typeof stateVal==="boolean"&&type==="string"){return stateVal?this.addClass(value):this.removeClass(value)}if(jQuery.isFunction(value)){return this.each(function(i){jQuery(this).toggleClass(value.call(this,i,getClass(this),stateVal),stateVal)})}return this.each(function(){var className,i,self,classNames;if(type==="string"){i=0;self=jQuery(this);classNames=value.match(rnotwhite)||[];while(className=classNames[i++]){if(self.hasClass(className)){self.removeClass(className)}else{self.addClass(className)}}}else if(value===undefined||type==="boolean"){className=getClass(this);if(className){dataPriv.set(this,"__className__",className)}if(this.setAttribute){this.setAttribute("class",className||value===false?"":dataPriv.get(this,"__className__")||"")}}})},hasClass:function(selector){var className,elem,i=0; +}while(scale!==(scale=currentValue()/initial)&&scale!==1&&--maxIterations)}if(valueParts){initialInUnit=+initialInUnit||+initial||0;adjusted=valueParts[1]?initialInUnit+(valueParts[1]+1)*valueParts[2]:+valueParts[2];if(tween){tween.unit=unit;tween.start=initialInUnit;tween.end=adjusted}}return adjusted}var rcheckableType=/^(?:checkbox|radio)$/i;var rtagName=/<([\w:-]+)/;var rscriptType=/^$|\/(?:java|ecma)script/i;var wrapMap={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;function getAll(context,tag){var ret=typeof context.getElementsByTagName!=="undefined"?context.getElementsByTagName(tag||"*"):typeof context.querySelectorAll!=="undefined"?context.querySelectorAll(tag||"*"):[];return tag===undefined||tag&&jQuery.nodeName(context,tag)?jQuery.merge([context],ret):ret}function setGlobalEval(elems,refElements){var i=0,l=elems.length;for(;i-1){if(ignored){ignored.push(elem)}continue}contains=jQuery.contains(elem.ownerDocument,elem);tmp=getAll(fragment.appendChild(elem),"script");if(contains){setGlobalEval(tmp)}if(scripts){j=0;while(elem=tmp[j++]){if(rscriptType.test(elem.type||"")){scripts.push(elem)}}}}return fragment}(function(){var fragment=document.createDocumentFragment(),div=fragment.appendChild(document.createElement("div")),input=document.createElement("input");input.setAttribute("type","radio");input.setAttribute("checked","checked");input.setAttribute("name","t");div.appendChild(input);support.checkClone=div.cloneNode(true).cloneNode(true).lastChild.checked;div.innerHTML="";support.noCloneChecked=!!div.cloneNode(true).lastChild.defaultValue})();var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rtypenamespace=/^([^.]*)(?:\.(.+)|)/;function returnTrue(){return true}function returnFalse(){return false}function safeActiveElement(){try{return document.activeElement}catch(err){}}function on(elem,types,selector,data,fn,one){var origFn,type;if(typeof types==="object"){if(typeof selector!=="string"){data=data||selector;selector=undefined}for(type in types){on(elem,type,selector,data,types[type],one)}return elem}if(data==null&&fn==null){fn=selector;data=selector=undefined}else if(fn==null){if(typeof selector==="string"){fn=data;data=undefined}else{fn=data;data=selector;selector=undefined}}if(fn===false){fn=returnFalse}else if(!fn){return elem}if(one===1){origFn=fn;fn=function(event){jQuery().off(event);return origFn.apply(this,arguments)};fn.guid=origFn.guid||(origFn.guid=jQuery.guid++)}return elem.each(function(){jQuery.event.add(this,types,fn,data,selector)})}jQuery.event={global:{},add:function(elem,types,handler,data,selector){var handleObjIn,eventHandle,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.get(elem);if(!elemData){return}if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;selector=handleObjIn.selector}if(!handler.guid){handler.guid=jQuery.guid++}if(!(events=elemData.events)){events=elemData.events={}}if(!(eventHandle=elemData.handle)){eventHandle=elemData.handle=function(e){return typeof jQuery!=="undefined"&&jQuery.event.triggered!==e.type?jQuery.event.dispatch.apply(elem,arguments):undefined}}types=(types||"").match(rnotwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){continue}special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;special=jQuery.event.special[type]||{};handleObj=jQuery.extend({type:type,origType:origType,data:data,handler:handler,guid:handler.guid,selector:selector,needsContext:selector&&jQuery.expr.match.needsContext.test(selector),namespace:namespaces.join(".")},handleObjIn);if(!(handlers=events[type])){handlers=events[type]=[];handlers.delegateCount=0;if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){if(elem.addEventListener){elem.addEventListener(type,eventHandle)}}}if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid}}if(selector){handlers.splice(handlers.delegateCount++,0,handleObj)}else{handlers.push(handleObj)}jQuery.event.global[type]=true}},remove:function(elem,types,handler,selector,mappedTypes){var j,origCount,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.hasData(elem)&&dataPriv.get(elem);if(!elemData||!(events=elemData.events)){return}types=(types||"").match(rnotwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){for(type in events){jQuery.event.remove(elem,type+types[t],handler,selector,true)}continue}special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;handlers=events[type]||[];tmp=tmp[2]&&new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)");origCount=j=handlers.length;while(j--){handleObj=handlers[j];if((mappedTypes||origType===handleObj.origType)&&(!handler||handler.guid===handleObj.guid)&&(!tmp||tmp.test(handleObj.namespace))&&(!selector||selector===handleObj.selector||selector==="**"&&handleObj.selector)){handlers.splice(j,1);if(handleObj.selector){handlers.delegateCount--}if(special.remove){special.remove.call(elem,handleObj)}}}if(origCount&&!handlers.length){if(!special.teardown||special.teardown.call(elem,namespaces,elemData.handle)===false){jQuery.removeEvent(elem,type,elemData.handle)}delete events[type]}}if(jQuery.isEmptyObject(events)){dataPriv.remove(elem,"handle events")}},dispatch:function(event){event=jQuery.event.fix(event);var i,j,ret,matched,handleObj,handlerQueue=[],args=slice.call(arguments),handlers=(dataPriv.get(this,"events")||{})[event.type]||[],special=jQuery.event.special[event.type]||{};args[0]=event;event.delegateTarget=this;if(special.preDispatch&&special.preDispatch.call(this,event)===false){return}handlerQueue=jQuery.event.handlers.call(this,event,handlers);i=0;while((matched=handlerQueue[i++])&&!event.isPropagationStopped()){event.currentTarget=matched.elem;j=0;while((handleObj=matched.handlers[j++])&&!event.isImmediatePropagationStopped()){if(!event.rnamespace||event.rnamespace.test(handleObj.namespace)){event.handleObj=handleObj;event.data=handleObj.data;ret=((jQuery.event.special[handleObj.origType]||{}).handle||handleObj.handler).apply(matched.elem,args);if(ret!==undefined){if((event.result=ret)===false){event.preventDefault();event.stopPropagation()}}}}}if(special.postDispatch){special.postDispatch.call(this,event)}return event.result},handlers:function(event,handlers){var i,matches,sel,handleObj,handlerQueue=[],delegateCount=handlers.delegateCount,cur=event.target;if(delegateCount&&cur.nodeType&&(event.type!=="click"||isNaN(event.button)||event.button<1)){for(;cur!==this;cur=cur.parentNode||this){if(cur.nodeType===1&&(cur.disabled!==true||event.type!=="click")){matches=[];for(i=0;i-1:jQuery.find(sel,this,null,[cur]).length}if(matches[sel]){matches.push(handleObj)}}if(matches.length){handlerQueue.push({elem:cur,handlers:matches})}}}}if(delegateCount]*)\/>/gi,rnoInnerhtml=/\s*$/g;function manipulationTarget(elem,content){return jQuery.nodeName(elem,"table")&&jQuery.nodeName(content.nodeType!==11?content:content.firstChild,"tr")?elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody")):elem}function disableScript(elem){elem.type=(elem.getAttribute("type")!==null)+"/"+elem.type;return elem}function restoreScript(elem){var match=rscriptTypeMasked.exec(elem.type);if(match){elem.type=match[1]}else{elem.removeAttribute("type")}return elem}function cloneCopyEvent(src,dest){var i,l,type,pdataOld,pdataCur,udataOld,udataCur,events;if(dest.nodeType!==1){return}if(dataPriv.hasData(src)){pdataOld=dataPriv.access(src);pdataCur=dataPriv.set(dest,pdataOld);events=pdataOld.events;if(events){delete pdataCur.handle;pdataCur.events={};for(type in events){for(i=0,l=events[type].length;i1&&typeof value==="string"&&!support.checkClone&&rchecked.test(value)){return collection.each(function(index){var self=collection.eq(index);if(isFunction){args[0]=value.call(this,index,self.html())}domManip(self,args,callback,ignored)})}if(l){fragment=buildFragment(args,collection[0].ownerDocument,false,collection,ignored);first=fragment.firstChild;if(fragment.childNodes.length===1){fragment=first}if(first||ignored){scripts=jQuery.map(getAll(fragment,"script"),disableScript);hasScripts=scripts.length;for(;i")},clone:function(elem,dataAndEvents,deepDataAndEvents){var i,l,srcElements,destElements,clone=elem.cloneNode(true),inPage=jQuery.contains(elem.ownerDocument,elem);if(!support.noCloneChecked&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){destElements=getAll(clone);srcElements=getAll(elem);for(i=0,l=srcElements.length;i0){setGlobalEval(destElements,!inPage&&getAll(elem,"script"))}return clone},cleanData:function(elems){var data,elem,type,special=jQuery.event.special,i=0;for(;(elem=elems[i])!==undefined;i++){if(acceptData(elem)){if(data=elem[dataPriv.expando]){if(data.events){for(type in data.events){if(special[type]){jQuery.event.remove(elem,type)}else{jQuery.removeEvent(elem,type,data.handle)}}}elem[dataPriv.expando]=undefined}if(elem[dataUser.expando]){elem[dataUser.expando]=undefined}}}}});jQuery.fn.extend({domManip:domManip,detach:function(selector){return remove(this,selector,true)},remove:function(selector){return remove(this,selector)},text:function(value){return access(this,function(value){return value===undefined?jQuery.text(this):this.empty().each(function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){this.textContent=value}})},null,value,arguments.length)},append:function(){return domManip(this,arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.appendChild(elem)}})},prepend:function(){return domManip(this,arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.insertBefore(elem,target.firstChild)}})},before:function(){return domManip(this,arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this)}})},after:function(){return domManip(this,arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this.nextSibling)}})},empty:function(){var elem,i=0;for(;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));elem.textContent=""}}return this},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents)})},html:function(value){return access(this,function(value){var elem=this[0]||{},i=0,l=this.length;if(value===undefined&&elem.nodeType===1){return elem.innerHTML}if(typeof value==="string"&&!rnoInnerhtml.test(value)&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=jQuery.htmlPrefilter(value);try{for(;i")).appendTo(doc.documentElement);doc=iframe[0].contentDocument;doc.write();doc.close();display=actualDisplay(nodeName,doc);iframe.detach()}elemdisplay[nodeName]=display}return display}var rmargin=/^margin/;var rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i");var getStyles=function(elem){var view=elem.ownerDocument.defaultView;if(!view||!view.opener){view=window}return view.getComputedStyle(elem)};var swap=function(elem,options,callback,args){var ret,name,old={};for(name in options){old[name]=elem.style[name];elem.style[name]=options[name]}ret=callback.apply(elem,args||[]);for(name in options){elem.style[name]=old[name]}return ret};var documentElement=document.documentElement;(function(){var pixelPositionVal,boxSizingReliableVal,pixelMarginRightVal,reliableMarginLeftVal,container=document.createElement("div"),div=document.createElement("div");if(!div.style){return}div.style.backgroundClip="content-box";div.cloneNode(true).style.backgroundClip="";support.clearCloneStyle=div.style.backgroundClip==="content-box";container.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;"+"padding:0;margin-top:1px;position:absolute";container.appendChild(div);function computeStyleTests(){div.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;"+"position:relative;display:block;"+"margin:auto;border:1px;padding:1px;"+"top:1%;width:50%";div.innerHTML="";documentElement.appendChild(container);var divStyle=window.getComputedStyle(div);pixelPositionVal=divStyle.top!=="1%";reliableMarginLeftVal=divStyle.marginLeft==="2px";boxSizingReliableVal=divStyle.width==="4px";div.style.marginRight="50%";pixelMarginRightVal=divStyle.marginRight==="4px";documentElement.removeChild(container)}jQuery.extend(support,{pixelPosition:function(){computeStyleTests();return pixelPositionVal},boxSizingReliable:function(){if(boxSizingReliableVal==null){computeStyleTests()}return boxSizingReliableVal},pixelMarginRight:function(){if(boxSizingReliableVal==null){computeStyleTests()}return pixelMarginRightVal},reliableMarginLeft:function(){if(boxSizingReliableVal==null){computeStyleTests()}return reliableMarginLeftVal},reliableMarginRight:function(){var ret,marginDiv=div.appendChild(document.createElement("div"));marginDiv.style.cssText=div.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;"+"display:block;margin:0;border:0;padding:0";marginDiv.style.marginRight=marginDiv.style.width="0";div.style.width="1px";documentElement.appendChild(container);ret=!parseFloat(window.getComputedStyle(marginDiv).marginRight);documentElement.removeChild(container);div.removeChild(marginDiv);return ret}})})();function curCSS(elem,name,computed){var width,minWidth,maxWidth,ret,style=elem.style;computed=computed||getStyles(elem);ret=computed?computed.getPropertyValue(name)||computed[name]:undefined;if((ret===""||ret===undefined)&&!jQuery.contains(elem.ownerDocument,elem)){ret=jQuery.style(elem,name)}if(computed){if(!support.pixelMarginRight()&&rnumnonpx.test(ret)&&rmargin.test(name)){width=style.width;minWidth=style.minWidth;maxWidth=style.maxWidth;style.minWidth=style.maxWidth=style.width=ret;ret=computed.width;style.width=width;style.minWidth=minWidth;style.maxWidth=maxWidth}}return ret!==undefined?ret+"":ret}function addGetHookIf(conditionFn,hookFn){return{get:function(){if(conditionFn()){delete this.get;return}return(this.get=hookFn).apply(this,arguments)}}}var rdisplayswap=/^(none|table(?!-c[ea]).+)/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"},cssPrefixes=["Webkit","O","Moz","ms"],emptyStyle=document.createElement("div").style;function vendorPropName(name){if(name in emptyStyle){return name}var capName=name[0].toUpperCase()+name.slice(1),i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in emptyStyle){return name}}}function setPositiveNumber(elem,value,subtract){var matches=rcssNum.exec(value);return matches?Math.max(0,matches[2]-(subtract||0))+(matches[3]||"px"):value}function augmentWidthOrHeight(elem,name,extra,isBorderBox,styles){var i=extra===(isBorderBox?"border":"content")?4:name==="width"?1:0,val=0;for(;i<4;i+=2){if(extra==="margin"){val+=jQuery.css(elem,extra+cssExpand[i],true,styles)}if(isBorderBox){if(extra==="content"){val-=jQuery.css(elem,"padding"+cssExpand[i],true,styles)}if(extra!=="margin"){val-=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles)}}else{val+=jQuery.css(elem,"padding"+cssExpand[i],true,styles);if(extra!=="padding"){val+=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles)}}}return val}function getWidthOrHeight(elem,name,extra){var valueIsBorderBox=true,val=name==="width"?elem.offsetWidth:elem.offsetHeight,styles=getStyles(elem),isBorderBox=jQuery.css(elem,"boxSizing",false,styles)==="border-box";if(val<=0||val==null){val=curCSS(elem,name,styles);if(val<0||val==null){val=elem.style[name]}if(rnumnonpx.test(val)){return val}valueIsBorderBox=isBorderBox&&(support.boxSizingReliable()||val===elem.style[name]);val=parseFloat(val)||0}return val+augmentWidthOrHeight(elem,name,extra||(isBorderBox?"border":"content"),valueIsBorderBox,styles)+"px"}function showHide(elements,show){var display,elem,hidden,values=[],index=0,length=elements.length;for(;index1)},show:function(){return showHide(this,true)},hide:function(){return showHide(this)},toggle:function(state){if(typeof state==="boolean"){return state?this.show():this.hide()}return this.each(function(){if(isHidden(this)){jQuery(this).show()}else{jQuery(this).hide()}})}});function Tween(elem,options,prop,end,easing){return new Tween.prototype.init(elem,options,prop,end,easing)}jQuery.Tween=Tween;Tween.prototype={constructor:Tween,init:function(elem,options,prop,end,easing,unit){this.elem=elem;this.prop=prop;this.easing=easing||jQuery.easing._default;this.options=options;this.start=this.now=this.cur();this.end=end;this.unit=unit||(jQuery.cssNumber[prop]?"":"px")},cur:function(){var hooks=Tween.propHooks[this.prop];return hooks&&hooks.get?hooks.get(this):Tween.propHooks._default.get(this)},run:function(percent){var eased,hooks=Tween.propHooks[this.prop];if(this.options.duration){this.pos=eased=jQuery.easing[this.easing](percent,this.options.duration*percent,0,1,this.options.duration)}else{this.pos=eased=percent}this.now=(this.end-this.start)*eased+this.start;if(this.options.step){this.options.step.call(this.elem,this.now,this)}if(hooks&&hooks.set){hooks.set(this)}else{Tween.propHooks._default.set(this)}return this}};Tween.prototype.init.prototype=Tween.prototype;Tween.propHooks={_default:{get:function(tween){var result;if(tween.elem.nodeType!==1||tween.elem[tween.prop]!=null&&tween.elem.style[tween.prop]==null){return tween.elem[tween.prop]}result=jQuery.css(tween.elem,tween.prop,"");return!result||result==="auto"?0:result},set:function(tween){if(jQuery.fx.step[tween.prop]){jQuery.fx.step[tween.prop](tween)}else if(tween.elem.nodeType===1&&(tween.elem.style[jQuery.cssProps[tween.prop]]!=null||jQuery.cssHooks[tween.prop])){ +jQuery.style(tween.elem,tween.prop,tween.now+tween.unit)}else{tween.elem[tween.prop]=tween.now}}}};Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(tween){if(tween.elem.nodeType&&tween.elem.parentNode){tween.elem[tween.prop]=tween.now}}};jQuery.easing={linear:function(p){return p},swing:function(p){return.5-Math.cos(p*Math.PI)/2},_default:"swing"};jQuery.fx=Tween.prototype.init;jQuery.fx.step={};var fxNow,timerId,rfxtypes=/^(?:toggle|show|hide)$/,rrun=/queueHooks$/;function createFxNow(){window.setTimeout(function(){fxNow=undefined});return fxNow=jQuery.now()}function genFx(type,includeWidth){var which,i=0,attrs={height:type};includeWidth=includeWidth?1:0;for(;i<4;i+=2-includeWidth){which=cssExpand[i];attrs["margin"+which]=attrs["padding"+which]=type}if(includeWidth){attrs.opacity=attrs.width=type}return attrs}function createTween(value,prop,animation){var tween,collection=(Animation.tweeners[prop]||[]).concat(Animation.tweeners["*"]),index=0,length=collection.length;for(;index1)},removeAttr:function(name){return this.each(function(){jQuery.removeAttr(this,name)})}});jQuery.extend({attr:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return}if(typeof elem.getAttribute==="undefined"){return jQuery.prop(elem,name,value)}if(nType!==1||!jQuery.isXMLDoc(elem)){name=name.toLowerCase();hooks=jQuery.attrHooks[name]||(jQuery.expr.match.bool.test(name)?boolHook:undefined)}if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);return}if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret}elem.setAttribute(name,value+"");return value}if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret}ret=jQuery.find.attr(elem,name);return ret==null?undefined:ret},attrHooks:{type:{set:function(elem,value){if(!support.radioValue&&value==="radio"&&jQuery.nodeName(elem,"input")){var val=elem.value;elem.setAttribute("type",value);if(val){elem.value=val}return value}}}},removeAttr:function(elem,value){var name,propName,i=0,attrNames=value&&value.match(rnotwhite);if(attrNames&&elem.nodeType===1){while(name=attrNames[i++]){propName=jQuery.propFix[name]||name;if(jQuery.expr.match.bool.test(name)){elem[propName]=false}elem.removeAttribute(name)}}}});boolHook={set:function(elem,value,name){if(value===false){jQuery.removeAttr(elem,name)}else{elem.setAttribute(name,name)}return name}};jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),function(i,name){var getter=attrHandle[name]||jQuery.find.attr;attrHandle[name]=function(elem,name,isXML){var ret,handle;if(!isXML){handle=attrHandle[name];attrHandle[name]=ret;ret=getter(elem,name,isXML)!=null?name.toLowerCase():null;attrHandle[name]=handle}return ret}});var rfocusable=/^(?:input|select|textarea|button)$/i,rclickable=/^(?:a|area)$/i;jQuery.fn.extend({prop:function(name,value){return access(this,jQuery.prop,name,value,arguments.length>1)},removeProp:function(name){return this.each(function(){delete this[jQuery.propFix[name]||name]})}});jQuery.extend({prop:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return}if(nType!==1||!jQuery.isXMLDoc(elem)){name=jQuery.propFix[name]||name;hooks=jQuery.propHooks[name]}if(value!==undefined){if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret}return elem[name]=value}if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret}return elem[name]},propHooks:{tabIndex:{get:function(elem){var tabindex=jQuery.find.attr(elem,"tabindex");return tabindex?parseInt(tabindex,10):rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}});if(!support.optSelected){jQuery.propHooks.selected={get:function(elem){var parent=elem.parentNode;if(parent&&parent.parentNode){parent.parentNode.selectedIndex}return null},set:function(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex}}}}}jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){jQuery.propFix[this.toLowerCase()]=this});var rclass=/[\t\r\n\f]/g;function getClass(elem){return elem.getAttribute&&elem.getAttribute("class")||""}jQuery.fn.extend({addClass:function(value){var classes,elem,cur,curValue,clazz,j,finalValue,i=0;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).addClass(value.call(this,j,getClass(this)))})}if(typeof value==="string"&&value){classes=value.match(rnotwhite)||[];while(elem=this[i++]){curValue=getClass(elem);cur=elem.nodeType===1&&(" "+curValue+" ").replace(rclass," ");if(cur){j=0;while(clazz=classes[j++]){if(cur.indexOf(" "+clazz+" ")<0){cur+=clazz+" "}}finalValue=jQuery.trim(cur);if(curValue!==finalValue){elem.setAttribute("class",finalValue)}}}}return this},removeClass:function(value){var classes,elem,cur,curValue,clazz,j,finalValue,i=0;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).removeClass(value.call(this,j,getClass(this)))})}if(!arguments.length){return this.attr("class","")}if(typeof value==="string"&&value){classes=value.match(rnotwhite)||[];while(elem=this[i++]){curValue=getClass(elem);cur=elem.nodeType===1&&(" "+curValue+" ").replace(rclass," ");if(cur){j=0;while(clazz=classes[j++]){while(cur.indexOf(" "+clazz+" ")>-1){cur=cur.replace(" "+clazz+" "," ")}}finalValue=jQuery.trim(cur);if(curValue!==finalValue){elem.setAttribute("class",finalValue)}}}}return this},toggleClass:function(value,stateVal){var type=typeof value;if(typeof stateVal==="boolean"&&type==="string"){return stateVal?this.addClass(value):this.removeClass(value)}if(jQuery.isFunction(value)){return this.each(function(i){jQuery(this).toggleClass(value.call(this,i,getClass(this),stateVal),stateVal)})}return this.each(function(){var className,i,self,classNames;if(type==="string"){i=0;self=jQuery(this);classNames=value.match(rnotwhite)||[];while(className=classNames[i++]){if(self.hasClass(className)){self.removeClass(className)}else{self.addClass(className)}}}else if(value===undefined||type==="boolean"){className=getClass(this);if(className){dataPriv.set(this,"__className__",className)}if(this.setAttribute){this.setAttribute("class",className||value===false?"":dataPriv.get(this,"__className__")||"")}}})},hasClass:function(selector){var className,elem,i=0;className=" "+selector+" ";while(elem=this[i++]){if(elem.nodeType===1&&(" "+getClass(elem)+" ").replace(rclass," ").indexOf(className)>-1){return true}}return false}});var rreturn=/\r/g,rspaces=/[\x20\t\r\n\f]+/g;jQuery.fn.extend({val:function(value){var hooks,ret,isFunction,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.type]||jQuery.valHooks[elem.nodeName.toLowerCase()];if(hooks&&"get"in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret}ret=elem.value;return typeof ret==="string"?ret.replace(rreturn,""):ret==null?"":ret}return}isFunction=jQuery.isFunction(value);return this.each(function(i){var val;if(this.nodeType!==1){return}if(isFunction){val=value.call(this,i,jQuery(this).val())}else{val=value}if(val==null){val=""}else if(typeof val==="number"){val+=""}else if(jQuery.isArray(val)){val=jQuery.map(val,function(value){return value==null?"":value+""})}hooks=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];if(!hooks||!("set"in hooks)||hooks.set(this,val,"value")===undefined){this.value=val}})}});jQuery.extend({valHooks:{option:{get:function(elem){var val=jQuery.find.attr(elem,"value");return val!=null?val:jQuery.trim(jQuery.text(elem)).replace(rspaces," ")}},select:{get:function(elem){var value,option,options=elem.options,index=elem.selectedIndex,one=elem.type==="select-one"||index<0,values=one?null:[],max=one?index+1:options.length,i=index<0?max:one?index:0;for(;i-1){optionSet=true}}if(!optionSet){elem.selectedIndex=-1}return values}}}});jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={set:function(elem,value){if(jQuery.isArray(value)){return elem.checked=jQuery.inArray(jQuery(elem).val(),value)>-1}}};if(!support.checkOn){jQuery.valHooks[this].get=function(elem){return elem.getAttribute("value")===null?"on":elem.value}}});var rfocusMorph=/^(?:focusinfocus|focusoutblur)$/;jQuery.extend(jQuery.event,{trigger:function(event,data,elem,onlyHandlers){var i,cur,tmp,bubbleType,ontype,handle,special,eventPath=[elem||document],type=hasOwn.call(event,"type")?event.type:event,namespaces=hasOwn.call(event,"namespace")?event.namespace.split("."):[];cur=tmp=elem=elem||document;if(elem.nodeType===3||elem.nodeType===8){return}if(rfocusMorph.test(type+jQuery.event.triggered)){return}if(type.indexOf(".")>-1){namespaces=type.split(".");type=namespaces.shift();namespaces.sort()}ontype=type.indexOf(":")<0&&"on"+type;event=event[jQuery.expando]?event:new jQuery.Event(type,typeof event==="object"&&event);event.isTrigger=onlyHandlers?2:3;event.namespace=namespaces.join(".");event.rnamespace=event.namespace?new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;event.result=undefined;if(!event.target){event.target=elem}data=data==null?[event]:jQuery.makeArray(data,[event]);special=jQuery.event.special[type]||{};if(!onlyHandlers&&special.trigger&&special.trigger.apply(elem,data)===false){return}if(!onlyHandlers&&!special.noBubble&&!jQuery.isWindow(elem)){bubbleType=special.delegateType||type;if(!rfocusMorph.test(bubbleType+type)){cur=cur.parentNode}for(;cur;cur=cur.parentNode){eventPath.push(cur);tmp=cur}if(tmp===(elem.ownerDocument||document)){eventPath.push(tmp.defaultView||tmp.parentWindow||window)}}i=0;while((cur=eventPath[i++])&&!event.isPropagationStopped()){event.type=i>1?bubbleType:special.bindType||type;handle=(dataPriv.get(cur,"events")||{})[event.type]&&dataPriv.get(cur,"handle");if(handle){handle.apply(cur,data)}handle=ontype&&cur[ontype];if(handle&&handle.apply&&acceptData(cur)){event.result=handle.apply(cur,data);if(event.result===false){event.preventDefault()}}}event.type=type;if(!onlyHandlers&&!event.isDefaultPrevented()){if((!special._default||special._default.apply(eventPath.pop(),data)===false)&&acceptData(elem)){if(ontype&&jQuery.isFunction(elem[type])&&!jQuery.isWindow(elem)){tmp=elem[ontype];if(tmp){elem[ontype]=null}jQuery.event.triggered=type;elem[type]();jQuery.event.triggered=undefined;if(tmp){elem[ontype]=tmp}}}}return event.result},simulate:function(type,elem,event){var e=jQuery.extend(new jQuery.Event,event,{type:type,isSimulated:true});jQuery.event.trigger(e,null,elem)}});jQuery.fn.extend({trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this)})},triggerHandler:function(type,data){var elem=this[0];if(elem){return jQuery.event.trigger(type,data,elem,true)}}});jQuery.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(i,name){jQuery.fn[name]=function(data,fn){return arguments.length>0?this.on(name,null,data,fn):this.trigger(name)}});jQuery.fn.extend({hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver)}});support.focusin="onfocusin"in window;if(!support.focusin){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){var handler=function(event){jQuery.event.simulate(fix,event.target,jQuery.event.fix(event))};jQuery.event.special[fix]={setup:function(){var doc=this.ownerDocument||this,attaches=dataPriv.access(doc,fix);if(!attaches){doc.addEventListener(orig,handler,true)}dataPriv.access(doc,fix,(attaches||0)+1)},teardown:function(){var doc=this.ownerDocument||this,attaches=dataPriv.access(doc,fix)-1;if(!attaches){doc.removeEventListener(orig,handler,true);dataPriv.remove(doc,fix)}else{dataPriv.access(doc,fix,attaches)}}}})}var location=window.location;var nonce=jQuery.now();var rquery=/\?/;jQuery.parseJSON=function(data){return JSON.parse(data+"")};jQuery.parseXML=function(data){var xml;if(!data||typeof data!=="string"){return null}try{xml=(new window.DOMParser).parseFromString(data,"text/xml")}catch(e){xml=undefined}if(!xml||xml.getElementsByTagName("parsererror").length){jQuery.error("Invalid XML: "+data)}return xml};var rhash=/#.*$/,rts=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)$/gm,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,prefilters={},transports={},allTypes="*/".concat("*"),originAnchor=document.createElement("a");originAnchor.href=location.href;function addToPrefiltersOrTransports(structure){return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*"}var dataType,i=0,dataTypes=dataTypeExpression.toLowerCase().match(rnotwhite)||[];if(jQuery.isFunction(func)){while(dataType=dataTypes[i++]){if(dataType[0]==="+"){dataType=dataType.slice(1)||"*";(structure[dataType]=structure[dataType]||[]).unshift(func)}else{(structure[dataType]=structure[dataType]||[]).push(func)}}}}}function inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR){var inspected={},seekingTransport=structure===transports;function inspect(dataType){var selected;inspected[dataType]=true;jQuery.each(structure[dataType]||[],function(_,prefilterOrFactory){var dataTypeOrTransport=prefilterOrFactory(options,originalOptions,jqXHR);if(typeof dataTypeOrTransport==="string"&&!seekingTransport&&!inspected[dataTypeOrTransport]){options.dataTypes.unshift(dataTypeOrTransport);inspect(dataTypeOrTransport);return false}else if(seekingTransport){return!(selected=dataTypeOrTransport)}});return selected}return inspect(options.dataTypes[0])||!inspected["*"]&&inspect("*")}function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key]}}if(deep){jQuery.extend(true,target,deep)}return target}function ajaxHandleResponses(s,jqXHR,responses){var ct,type,finalDataType,firstDataType,contents=s.contents,dataTypes=s.dataTypes;while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("Content-Type")}}if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break}}}if(dataTypes[0]in responses){finalDataType=dataTypes[0]}else{for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break}if(!firstDataType){firstDataType=type}}finalDataType=finalDataType||firstDataType}if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType)}return responses[finalDataType]}}function ajaxConvert(s,response,jqXHR,isSuccess){var conv2,current,conv,tmp,prev,converters={},dataTypes=s.dataTypes.slice();if(dataTypes[1]){for(conv in s.converters){converters[conv.toLowerCase()]=s.converters[conv]}}current=dataTypes.shift();while(current){if(s.responseFields[current]){jqXHR[s.responseFields[current]]=response}if(!prev&&isSuccess&&s.dataFilter){response=s.dataFilter(response,s.dataType)}prev=current;current=dataTypes.shift();if(current){if(current==="*"){current=prev}else if(prev!=="*"&&prev!==current){conv=converters[prev+" "+current]||converters["* "+current];if(!conv){for(conv2 in converters){tmp=conv2.split(" ");if(tmp[1]===current){conv=converters[prev+" "+tmp[0]]||converters["* "+tmp[0]];if(conv){if(conv===true){conv=converters[conv2]}else if(converters[conv2]!==true){current=tmp[0];dataTypes.unshift(tmp[1])}break}}}}if(conv!==true){if(conv&&s.throws){response=conv(response)}else{try{response=conv(response)}catch(e){return{state:"parsererror",error:conv?e:"No conversion from "+prev+" to "+current}}}}}}}return{state:"success",data:response}}jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:location.href,type:"GET",isLocal:rlocalProtocol.test(location.protocol),global:true,processData:true,async:true,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":true,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{url:true,context:true}},ajaxSetup:function(target,settings){return settings?ajaxExtend(ajaxExtend(target,jQuery.ajaxSettings),settings):ajaxExtend(jQuery.ajaxSettings,target)},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(url,options){if(typeof url==="object"){options=url;url=undefined}options=options||{};var transport,cacheURL,responseHeadersString,responseHeaders,timeoutTimer,urlAnchor,fireGlobals,i,s=jQuery.ajaxSetup({},options),callbackContext=s.context||s,globalEventContext=s.context&&(callbackContext.nodeType||callbackContext.jquery)?jQuery(callbackContext):jQuery.event,deferred=jQuery.Deferred(),completeDeferred=jQuery.Callbacks("once memory"),statusCode=s.statusCode||{},requestHeaders={},requestHeadersNames={},state=0,strAbort="canceled",jqXHR={readyState:0,getResponseHeader:function(key){var match;if(state===2){if(!responseHeaders){responseHeaders={};while(match=rheaders.exec(responseHeadersString)){responseHeaders[match[1].toLowerCase()]=match[2]}}match=responseHeaders[key.toLowerCase()]}return match==null?null:match},getAllResponseHeaders:function(){return state===2?responseHeadersString:null},setRequestHeader:function(name,value){var lname=name.toLowerCase();if(!state){name=requestHeadersNames[lname]=requestHeadersNames[lname]||name;requestHeaders[name]=value}return this},overrideMimeType:function(type){if(!state){s.mimeType=type}return this},statusCode:function(map){var code;if(map){if(state<2){for(code in map){statusCode[code]=[statusCode[code],map[code]]}}else{jqXHR.always(map[jqXHR.status])}}return this},abort:function(statusText){var finalText=statusText||strAbort;if(transport){transport.abort(finalText)}done(0,finalText);return this}};deferred.promise(jqXHR).complete=completeDeferred.add;jqXHR.success=jqXHR.done;jqXHR.error=jqXHR.fail;s.url=((url||s.url||location.href)+"").replace(rhash,"").replace(rprotocol,location.protocol+"//");s.type=options.method||options.type||s.method||s.type;s.dataTypes=jQuery.trim(s.dataType||"*").toLowerCase().match(rnotwhite)||[""];if(s.crossDomain==null){urlAnchor=document.createElement("a");try{urlAnchor.href=s.url;urlAnchor.href=urlAnchor.href;s.crossDomain=originAnchor.protocol+"//"+originAnchor.host!==urlAnchor.protocol+"//"+urlAnchor.host}catch(e){s.crossDomain=true}}if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional)}inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);if(state===2){return jqXHR}fireGlobals=jQuery.event&&s.global;if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart")}s.type=s.type.toUpperCase();s.hasContent=!rnoContent.test(s.type);cacheURL=s.url;if(!s.hasContent){if(s.data){cacheURL=s.url+=(rquery.test(cacheURL)?"&":"?")+s.data;delete s.data}if(s.cache===false){s.url=rts.test(cacheURL)?cacheURL.replace(rts,"$1_="+nonce++):cacheURL+(rquery.test(cacheURL)?"&":"?")+"_="+nonce++}}if(s.ifModified){if(jQuery.lastModified[cacheURL]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[cacheURL])}if(jQuery.etag[cacheURL]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[cacheURL])}}if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType)}jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+(s.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):s.accepts["*"]);for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i])}if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||state===2)){return jqXHR.abort()}strAbort="abort";for(i in{success:1,error:1,complete:1}){jqXHR[i](s[i])}transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);if(!transport){done(-1,"No Transport")}else{jqXHR.readyState=1;if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s])}if(state===2){return jqXHR}if(s.async&&s.timeout>0){timeoutTimer=window.setTimeout(function(){jqXHR.abort("timeout")},s.timeout)}try{state=1;transport.send(requestHeaders,done)}catch(e){if(state<2){done(-1,e)}else{throw e}}}function done(status,nativeStatusText,responses,headers){var isSuccess,success,error,response,modified,statusText=nativeStatusText;if(state===2){return}state=2;if(timeoutTimer){window.clearTimeout(timeoutTimer)}transport=undefined;responseHeadersString=headers||"";jqXHR.readyState=status>0?4:0;isSuccess=status>=200&&status<300||status===304;if(responses){response=ajaxHandleResponses(s,jqXHR,responses)}response=ajaxConvert(s,response,jqXHR,isSuccess);if(isSuccess){if(s.ifModified){modified=jqXHR.getResponseHeader("Last-Modified");if(modified){jQuery.lastModified[cacheURL]=modified}modified=jqXHR.getResponseHeader("etag");if(modified){jQuery.etag[cacheURL]=modified}}if(status===204||s.type==="HEAD"){statusText="nocontent"}else if(status===304){statusText="notmodified"}else{statusText=response.state;success=response.data;error=response.error;isSuccess=!error}}else{error=statusText;if(status||!statusText){statusText="error";if(status<0){status=0}}}jqXHR.status=status;jqXHR.statusText=(nativeStatusText||statusText)+""; -className=" "+selector+" ";while(elem=this[i++]){if(elem.nodeType===1&&(" "+getClass(elem)+" ").replace(rclass," ").indexOf(className)>-1){return true}}return false}});var rreturn=/\r/g,rspaces=/[\x20\t\r\n\f]+/g;jQuery.fn.extend({val:function(value){var hooks,ret,isFunction,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.type]||jQuery.valHooks[elem.nodeName.toLowerCase()];if(hooks&&"get"in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret}ret=elem.value;return typeof ret==="string"?ret.replace(rreturn,""):ret==null?"":ret}return}isFunction=jQuery.isFunction(value);return this.each(function(i){var val;if(this.nodeType!==1){return}if(isFunction){val=value.call(this,i,jQuery(this).val())}else{val=value}if(val==null){val=""}else if(typeof val==="number"){val+=""}else if(jQuery.isArray(val)){val=jQuery.map(val,function(value){return value==null?"":value+""})}hooks=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];if(!hooks||!("set"in hooks)||hooks.set(this,val,"value")===undefined){this.value=val}})}});jQuery.extend({valHooks:{option:{get:function(elem){var val=jQuery.find.attr(elem,"value");return val!=null?val:jQuery.trim(jQuery.text(elem)).replace(rspaces," ")}},select:{get:function(elem){var value,option,options=elem.options,index=elem.selectedIndex,one=elem.type==="select-one"||index<0,values=one?null:[],max=one?index+1:options.length,i=index<0?max:one?index:0;for(;i-1){optionSet=true}}if(!optionSet){elem.selectedIndex=-1}return values}}}});jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={set:function(elem,value){if(jQuery.isArray(value)){return elem.checked=jQuery.inArray(jQuery(elem).val(),value)>-1}}};if(!support.checkOn){jQuery.valHooks[this].get=function(elem){return elem.getAttribute("value")===null?"on":elem.value}}});var rfocusMorph=/^(?:focusinfocus|focusoutblur)$/;jQuery.extend(jQuery.event,{trigger:function(event,data,elem,onlyHandlers){var i,cur,tmp,bubbleType,ontype,handle,special,eventPath=[elem||document],type=hasOwn.call(event,"type")?event.type:event,namespaces=hasOwn.call(event,"namespace")?event.namespace.split("."):[];cur=tmp=elem=elem||document;if(elem.nodeType===3||elem.nodeType===8){return}if(rfocusMorph.test(type+jQuery.event.triggered)){return}if(type.indexOf(".")>-1){namespaces=type.split(".");type=namespaces.shift();namespaces.sort()}ontype=type.indexOf(":")<0&&"on"+type;event=event[jQuery.expando]?event:new jQuery.Event(type,typeof event==="object"&&event);event.isTrigger=onlyHandlers?2:3;event.namespace=namespaces.join(".");event.rnamespace=event.namespace?new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;event.result=undefined;if(!event.target){event.target=elem}data=data==null?[event]:jQuery.makeArray(data,[event]);special=jQuery.event.special[type]||{};if(!onlyHandlers&&special.trigger&&special.trigger.apply(elem,data)===false){return}if(!onlyHandlers&&!special.noBubble&&!jQuery.isWindow(elem)){bubbleType=special.delegateType||type;if(!rfocusMorph.test(bubbleType+type)){cur=cur.parentNode}for(;cur;cur=cur.parentNode){eventPath.push(cur);tmp=cur}if(tmp===(elem.ownerDocument||document)){eventPath.push(tmp.defaultView||tmp.parentWindow||window)}}i=0;while((cur=eventPath[i++])&&!event.isPropagationStopped()){event.type=i>1?bubbleType:special.bindType||type;handle=(dataPriv.get(cur,"events")||{})[event.type]&&dataPriv.get(cur,"handle");if(handle){handle.apply(cur,data)}handle=ontype&&cur[ontype];if(handle&&handle.apply&&acceptData(cur)){event.result=handle.apply(cur,data);if(event.result===false){event.preventDefault()}}}event.type=type;if(!onlyHandlers&&!event.isDefaultPrevented()){if((!special._default||special._default.apply(eventPath.pop(),data)===false)&&acceptData(elem)){if(ontype&&jQuery.isFunction(elem[type])&&!jQuery.isWindow(elem)){tmp=elem[ontype];if(tmp){elem[ontype]=null}jQuery.event.triggered=type;elem[type]();jQuery.event.triggered=undefined;if(tmp){elem[ontype]=tmp}}}}return event.result},simulate:function(type,elem,event){var e=jQuery.extend(new jQuery.Event,event,{type:type,isSimulated:true});jQuery.event.trigger(e,null,elem)}});jQuery.fn.extend({trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this)})},triggerHandler:function(type,data){var elem=this[0];if(elem){return jQuery.event.trigger(type,data,elem,true)}}});jQuery.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(i,name){jQuery.fn[name]=function(data,fn){return arguments.length>0?this.on(name,null,data,fn):this.trigger(name)}});jQuery.fn.extend({hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver)}});support.focusin="onfocusin"in window;if(!support.focusin){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){var handler=function(event){jQuery.event.simulate(fix,event.target,jQuery.event.fix(event))};jQuery.event.special[fix]={setup:function(){var doc=this.ownerDocument||this,attaches=dataPriv.access(doc,fix);if(!attaches){doc.addEventListener(orig,handler,true)}dataPriv.access(doc,fix,(attaches||0)+1)},teardown:function(){var doc=this.ownerDocument||this,attaches=dataPriv.access(doc,fix)-1;if(!attaches){doc.removeEventListener(orig,handler,true);dataPriv.remove(doc,fix)}else{dataPriv.access(doc,fix,attaches)}}}})}var location=window.location;var nonce=jQuery.now();var rquery=/\?/;jQuery.parseJSON=function(data){return JSON.parse(data+"")};jQuery.parseXML=function(data){var xml;if(!data||typeof data!=="string"){return null}try{xml=(new window.DOMParser).parseFromString(data,"text/xml")}catch(e){xml=undefined}if(!xml||xml.getElementsByTagName("parsererror").length){jQuery.error("Invalid XML: "+data)}return xml};var rhash=/#.*$/,rts=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)$/gm,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,prefilters={},transports={},allTypes="*/".concat("*"),originAnchor=document.createElement("a");originAnchor.href=location.href;function addToPrefiltersOrTransports(structure){return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*"}var dataType,i=0,dataTypes=dataTypeExpression.toLowerCase().match(rnotwhite)||[];if(jQuery.isFunction(func)){while(dataType=dataTypes[i++]){if(dataType[0]==="+"){dataType=dataType.slice(1)||"*";(structure[dataType]=structure[dataType]||[]).unshift(func)}else{(structure[dataType]=structure[dataType]||[]).push(func)}}}}}function inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR){var inspected={},seekingTransport=structure===transports;function inspect(dataType){var selected;inspected[dataType]=true;jQuery.each(structure[dataType]||[],function(_,prefilterOrFactory){var dataTypeOrTransport=prefilterOrFactory(options,originalOptions,jqXHR);if(typeof dataTypeOrTransport==="string"&&!seekingTransport&&!inspected[dataTypeOrTransport]){options.dataTypes.unshift(dataTypeOrTransport);inspect(dataTypeOrTransport);return false}else if(seekingTransport){return!(selected=dataTypeOrTransport)}});return selected}return inspect(options.dataTypes[0])||!inspected["*"]&&inspect("*")}function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key]}}if(deep){jQuery.extend(true,target,deep)}return target}function ajaxHandleResponses(s,jqXHR,responses){var ct,type,finalDataType,firstDataType,contents=s.contents,dataTypes=s.dataTypes;while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("Content-Type")}}if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break}}}if(dataTypes[0]in responses){finalDataType=dataTypes[0]}else{for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break}if(!firstDataType){firstDataType=type}}finalDataType=finalDataType||firstDataType}if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType)}return responses[finalDataType]}}function ajaxConvert(s,response,jqXHR,isSuccess){var conv2,current,conv,tmp,prev,converters={},dataTypes=s.dataTypes.slice();if(dataTypes[1]){for(conv in s.converters){converters[conv.toLowerCase()]=s.converters[conv]}}current=dataTypes.shift();while(current){if(s.responseFields[current]){jqXHR[s.responseFields[current]]=response}if(!prev&&isSuccess&&s.dataFilter){response=s.dataFilter(response,s.dataType)}prev=current;current=dataTypes.shift();if(current){if(current==="*"){current=prev}else if(prev!=="*"&&prev!==current){conv=converters[prev+" "+current]||converters["* "+current];if(!conv){for(conv2 in converters){tmp=conv2.split(" ");if(tmp[1]===current){conv=converters[prev+" "+tmp[0]]||converters["* "+tmp[0]];if(conv){if(conv===true){conv=converters[conv2]}else if(converters[conv2]!==true){current=tmp[0];dataTypes.unshift(tmp[1])}break}}}}if(conv!==true){if(conv&&s.throws){response=conv(response)}else{try{response=conv(response)}catch(e){return{state:"parsererror",error:conv?e:"No conversion from "+prev+" to "+current}}}}}}}return{state:"success",data:response}}jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:location.href,type:"GET",isLocal:rlocalProtocol.test(location.protocol),global:true,processData:true,async:true,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":true,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{url:true,context:true}},ajaxSetup:function(target,settings){return settings?ajaxExtend(ajaxExtend(target,jQuery.ajaxSettings),settings):ajaxExtend(jQuery.ajaxSettings,target)},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(url,options){if(typeof url==="object"){options=url;url=undefined}options=options||{};var transport,cacheURL,responseHeadersString,responseHeaders,timeoutTimer,urlAnchor,fireGlobals,i,s=jQuery.ajaxSetup({},options),callbackContext=s.context||s,globalEventContext=s.context&&(callbackContext.nodeType||callbackContext.jquery)?jQuery(callbackContext):jQuery.event,deferred=jQuery.Deferred(),completeDeferred=jQuery.Callbacks("once memory"),statusCode=s.statusCode||{},requestHeaders={},requestHeadersNames={},state=0,strAbort="canceled",jqXHR={readyState:0,getResponseHeader:function(key){var match;if(state===2){if(!responseHeaders){responseHeaders={};while(match=rheaders.exec(responseHeadersString)){responseHeaders[match[1].toLowerCase()]=match[2]}}match=responseHeaders[key.toLowerCase()]}return match==null?null:match},getAllResponseHeaders:function(){return state===2?responseHeadersString:null},setRequestHeader:function(name,value){var lname=name.toLowerCase();if(!state){name=requestHeadersNames[lname]=requestHeadersNames[lname]||name;requestHeaders[name]=value}return this},overrideMimeType:function(type){if(!state){s.mimeType=type}return this},statusCode:function(map){var code;if(map){if(state<2){for(code in map){statusCode[code]=[statusCode[code],map[code]]}}else{jqXHR.always(map[jqXHR.status])}}return this},abort:function(statusText){var finalText=statusText||strAbort;if(transport){transport.abort(finalText)}done(0,finalText);return this}};deferred.promise(jqXHR).complete=completeDeferred.add;jqXHR.success=jqXHR.done;jqXHR.error=jqXHR.fail;s.url=((url||s.url||location.href)+"").replace(rhash,"").replace(rprotocol,location.protocol+"//");s.type=options.method||options.type||s.method||s.type;s.dataTypes=jQuery.trim(s.dataType||"*").toLowerCase().match(rnotwhite)||[""];if(s.crossDomain==null){urlAnchor=document.createElement("a");try{urlAnchor.href=s.url;urlAnchor.href=urlAnchor.href;s.crossDomain=originAnchor.protocol+"//"+originAnchor.host!==urlAnchor.protocol+"//"+urlAnchor.host}catch(e){s.crossDomain=true}}if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional)}inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);if(state===2){return jqXHR}fireGlobals=jQuery.event&&s.global;if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart")}s.type=s.type.toUpperCase();s.hasContent=!rnoContent.test(s.type);cacheURL=s.url;if(!s.hasContent){if(s.data){cacheURL=s.url+=(rquery.test(cacheURL)?"&":"?")+s.data;delete s.data}if(s.cache===false){s.url=rts.test(cacheURL)?cacheURL.replace(rts,"$1_="+nonce++):cacheURL+(rquery.test(cacheURL)?"&":"?")+"_="+nonce++}}if(s.ifModified){if(jQuery.lastModified[cacheURL]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[cacheURL])}if(jQuery.etag[cacheURL]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[cacheURL])}}if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType)}jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+(s.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):s.accepts["*"]);for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i])}if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||state===2)){return jqXHR.abort()}strAbort="abort";for(i in{success:1,error:1,complete:1}){jqXHR[i](s[i])}transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);if(!transport){done(-1,"No Transport")}else{jqXHR.readyState=1;if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s])}if(state===2){return jqXHR}if(s.async&&s.timeout>0){timeoutTimer=window.setTimeout(function(){jqXHR.abort("timeout")},s.timeout)}try{state=1;transport.send(requestHeaders,done)}catch(e){if(state<2){done(-1,e)}else{throw e}}}function done(status,nativeStatusText,responses,headers){var isSuccess,success,error,response,modified,statusText=nativeStatusText;if(state===2){return}state=2;if(timeoutTimer){window.clearTimeout(timeoutTimer)}transport=undefined;responseHeadersString=headers||"";jqXHR.readyState=status>0?4:0;isSuccess=status>=200&&status<300||status===304;if(responses){response=ajaxHandleResponses(s,jqXHR,responses)}response=ajaxConvert(s,response,jqXHR,isSuccess);if(isSuccess){if(s.ifModified){modified=jqXHR.getResponseHeader("Last-Modified");if(modified){jQuery.lastModified[cacheURL]=modified}modified=jqXHR.getResponseHeader("etag");if(modified){jQuery.etag[cacheURL]=modified}}if(status===204||s.type==="HEAD"){statusText="nocontent"}else if(status===304){statusText="notmodified"}else{statusText=response.state;success=response.data;error=response.error;isSuccess=!error}}else{error=statusText;if(status||!statusText){statusText="error";if(status<0){status=0}}}jqXHR.status=status;jqXHR.statusText=(nativeStatusText||statusText)+"";if(isSuccess){deferred.resolveWith(callbackContext,[success,statusText,jqXHR])}else{deferred.rejectWith(callbackContext,[jqXHR,statusText,error])}jqXHR.statusCode(statusCode);statusCode=undefined;if(fireGlobals){globalEventContext.trigger(isSuccess?"ajaxSuccess":"ajaxError",[jqXHR,s,isSuccess?success:error])}completeDeferred.fireWith(callbackContext,[jqXHR,statusText]);if(fireGlobals){globalEventContext.trigger("ajaxComplete",[jqXHR,s]);if(!--jQuery.active){jQuery.event.trigger("ajaxStop")}}}return jqXHR},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json")},getScript:function(url,callback){return jQuery.get(url,undefined,callback,"script")}});jQuery.each(["get","post"],function(i,method){jQuery[method]=function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data=undefined}return jQuery.ajax(jQuery.extend({url:url,type:method,dataType:type,data:data,success:callback},jQuery.isPlainObject(url)&&url))}});jQuery._evalUrl=function(url){return jQuery.ajax({url:url,type:"GET",dataType:"script",async:false,global:false,"throws":true})};jQuery.fn.extend({wrapAll:function(html){var wrap;if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i))})}if(this[0]){wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0])}wrap.map(function(){var elem=this;while(elem.firstElementChild){elem=elem.firstElementChild}return elem}).append(this)}return this},wrapInner:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i))})}return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html)}else{self.append(html)}})},wrap:function(html){var isFunction=jQuery.isFunction(html);return this.each(function(i){jQuery(this).wrapAll(isFunction?html.call(this,i):html)})},unwrap:function(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes)}}).end()}});jQuery.expr.filters.hidden=function(elem){return!jQuery.expr.filters.visible(elem)};jQuery.expr.filters.visible=function(elem){return elem.offsetWidth>0||elem.offsetHeight>0||elem.getClientRects().length>0};var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;function buildParams(prefix,obj,traditional,add){var name;if(jQuery.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional||rbracket.test(prefix)){add(prefix,v)}else{buildParams(prefix+"["+(typeof v==="object"&&v!=null?i:"")+"]",v,traditional,add)}})}else if(!traditional&&jQuery.type(obj)==="object"){for(name in obj){buildParams(prefix+"["+name+"]",obj[name],traditional,add)}}else{add(prefix,obj)}}jQuery.param=function(a,traditional){var prefix,s=[],add=function(key,value){value=jQuery.isFunction(value)?value():value==null?"":value;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value)};if(traditional===undefined){traditional=jQuery.ajaxSettings&&jQuery.ajaxSettings.traditional}if(jQuery.isArray(a)||a.jquery&&!jQuery.isPlainObject(a)){jQuery.each(a,function(){add(this.name,this.value)})}else{for(prefix in a){buildParams(prefix,a[prefix],traditional,add)}}return s.join("&").replace(r20,"+")};jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var elements=jQuery.prop(this,"elements");return elements?jQuery.makeArray(elements):this}).filter(function(){var type=this.type;return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(type)&&(this.checked||!rcheckableType.test(type))}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val){return{name:elem.name,value:val.replace(rCRLF,"\r\n")}}):{name:elem.name,value:val.replace(rCRLF,"\r\n")}}).get()}});jQuery.ajaxSettings.xhr=function(){try{return new window.XMLHttpRequest}catch(e){}};var xhrSuccessStatus={0:200,1223:204},xhrSupported=jQuery.ajaxSettings.xhr();support.cors=!!xhrSupported&&"withCredentials"in xhrSupported;support.ajax=xhrSupported=!!xhrSupported;jQuery.ajaxTransport(function(options){var callback,errorCallback;if(support.cors||xhrSupported&&!options.crossDomain){return{send:function(headers,complete){var i,xhr=options.xhr();xhr.open(options.type,options.url,options.async,options.username,options.password);if(options.xhrFields){for(i in options.xhrFields){xhr[i]=options.xhrFields[i]}}if(options.mimeType&&xhr.overrideMimeType){xhr.overrideMimeType(options.mimeType)}if(!options.crossDomain&&!headers["X-Requested-With"]){headers["X-Requested-With"]="XMLHttpRequest"}for(i in headers){xhr.setRequestHeader(i,headers[i])}callback=function(type){return function(){if(callback){callback=errorCallback=xhr.onload=xhr.onerror=xhr.onabort=xhr.onreadystatechange=null;if(type==="abort"){xhr.abort()}else if(type==="error"){if(typeof xhr.status!=="number"){complete(0,"error")}else{complete(xhr.status,xhr.statusText)}}else{complete(xhrSuccessStatus[xhr.status]||xhr.status,xhr.statusText,(xhr.responseType||"text")!=="text"||typeof xhr.responseText!=="string"?{binary:xhr.response}:{text:xhr.responseText},xhr.getAllResponseHeaders())}}}};xhr.onload=callback();errorCallback=xhr.onerror=callback("error");if(xhr.onabort!==undefined){xhr.onabort=errorCallback}else{xhr.onreadystatechange=function(){if(xhr.readyState===4){window.setTimeout(function(){if(callback){errorCallback()}})}}}callback=callback("abort");try{xhr.send(options.hasContent&&options.data||null)}catch(e){if(callback){throw e}}},abort:function(){if(callback){callback()}}}}});jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, "+"application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(text){jQuery.globalEval(text);return text}}});jQuery.ajaxPrefilter("script",function(s){if(s.cache===undefined){s.cache=false}if(s.crossDomain){s.type="GET"}});jQuery.ajaxTransport("script",function(s){if(s.crossDomain){var script,callback;return{send:function(_,complete){script=jQuery(" - - + +