function AboutViewModel(t){this.el="#about-app",this.data={can_upgrade:!1,is_loading:!0,version_body:"",version_date:"",version_name:"",version_url:""},this.computed={},this.methods={init:function(){var e=this;$.ajax(t.latest_release_url,{complete:function(){e.is_loading=!1},dataType:"json",error:function(t,e,n){},method:"GET",success:function(t){e.version_body=t.body,e.version_date=t.publish_date,e.version_name=t.name,e.version_url=t.url,e.can_upgrade=t.can_upgrade}})}}}function AnalyseAlbumViewModel(){this.el="#analyse-album",this.data={imagesFailed:[],imagesToAnalyse:[],imagesInProgress:[],imagesRecentlyCompleted:[],numberSuccessful:0,numberFailed:0},this.computed={failedPercentage:function(){var t=0;return this.numberTotal>0&&(t=this.numberFailed/this.numberTotal*100),t.toFixed(2)+"%"},isCompleted:function(){return this.numberTotal>0&&this.numberSuccessful+this.numberFailed>=this.numberTotal},latestCompletedImages:function(){var t=this.imagesRecentlyCompleted.length-3<0?0:this.imagesRecentlyCompleted.length-3,e=t+3;return this.imagesRecentlyCompleted.slice(t,e)},numberTotal:function(){return this.imagesToAnalyse.length},successfulPercentage:function(){var t=0;return this.numberTotal>0&&(t=this.numberSuccessful/this.numberTotal*100),t.toFixed(2)+"%"}},this.methods={analyseImage:function(t){var e=this;this.imagesToAnalyse.push(t),$.ajax(t.url,{beforeSend:function(){e.imagesInProgress.push(t)},dataType:"json",error:function(n,i,r){e.numberFailed++,e.imagesFailed.push({name:t.name,reason:i}),t.isSuccessful=!1,t.isPending=!1},method:"POST",success:function(n){if(n.is_successful){e.numberSuccessful++,t.isSuccessful=!0,t.isPending=!1,e.imagesRecentlyCompleted.push(t);var i=e.imagesInProgress.indexOf(t);i>-1&&e.imagesInProgress.splice(i,1)}else e.numberFailed++,e.imagesFailed.push({name:t.name,reason:n.message}),t.isSuccessful=!1,t.isPending=!1}})}}}function AnalyseImageViewModel(t){this.isPending=!0,this.isSuccessful=!1,this.name=t.name,this.photoID=t.photo_id,this.url=t.url}function EditPhotosViewModel(t,e,n){this.el="#photos-tab",this.data={albums:[],bulkModifyMethod:"",isSubmitting:!1,photoIDs:[],photoIDsAvailable:[],selectAllInAlbum:0},this.methods={bulkModifySelected:function(t){if(this.isSubmitting)return!0;var n=this,i=$(t.target).closest("form");return"change_album"===this.bulkModifyMethod?(this.promptForNewAlbum(function(t){var e=$("select",t).val();$('input[name="new-album-id"]',i).val(e),n.isSubmitting=!0,$('button[name="bulk-apply"]',i).click(),_bt_showLoadingModal()}),t.preventDefault(),!1):"delete"!==this.bulkModifyMethod||(bootbox.dialog({message:e.delete_bulk_confirm_message,title:e.delete_bulk_confirm_title,buttons:{cancel:{label:e.action_cancel,className:"btn-secondary"},confirm:{label:e.action_delete,className:"btn-danger",callback:function(){n.isSubmitting=!0,$('button[name="bulk-apply"]',i).click(),_bt_showLoadingModal()}}}}),t.preventDefault(),!1)},changeAlbum:function(t){this.selectPhotoSingle(t.target);var e=this.photoIDs[0];return this.photoIDs=[],this.promptForNewAlbum(function(t){var i=$("select",t).val();$.post(n.move_photo.replace(/\/0$/,"/"+e),{new_album_id:i},function(){window.location.reload()})}),t.preventDefault(),!1},deletePhoto:function(t){var i=this;this.selectPhotoSingle(t.target);var r=i.photoIDs[0];return this.photoIDs=[],bootbox.dialog({message:e.delete_confirm_message,title:e.delete_confirm_title,buttons:{cancel:{label:e.action_cancel,className:"btn-secondary"},confirm:{label:e.action_delete,className:"btn-danger",callback:function(){var t=n.delete_photo;t=t.replace(/\/0$/,"/"+r),$(".loading",parent).show(),$.post(t,{_method:"DELETE"},function(t){window.location.reload()})}}}}),t.preventDefault(),!1},flip:function(t,e,i){var r=n.flip_photo;r=r.replace("/0/","/"+this.photoIDs[0]+"/"),r=t?r.replace(/\/-1\//,"/1/"):r.replace(/\/-1\//,"/0/"),r=e?r.replace(/\/-2$/,"/1"):r.replace(/\/-2$/,"/0"),$(".loading",i).show(),$.post(r,function(){var t=$("img.photo-thumbnail",i),e=t.data("original-src");t.attr("src",e+"&_="+(new Date).getTime()),$(".loading",i).hide()}),this.photoIDs=[]},flipBoth:function(t){return this.selectPhotoSingle(t.target),this.flip(!0,!0,$(t.target).closest(".photo")),t.preventDefault(),!1},flipHorizontal:function(t){return this.selectPhotoSingle(t.target),this.flip(!0,!1,$(t.target).closest(".photo")),t.preventDefault(),!1},flipVertical:function(t){return this.selectPhotoSingle(t.target),this.flip(!1,!0,$(t.target).closest(".photo")),t.preventDefault(),!1},isPhotoSelected:function(t){return this.photoIDs.indexOf(t)>-1?"checked":""},promptForNewAlbum:function(n){for(var i=this.albums,r=$("").attr("name","album_id").addClass("form-control"),o=0;o").attr("value",i[o].id).html(i[o].name).appendTo(r);t===i[o].id&&a.attr("selected","selected")}bootbox.dialog({message:$("").html(e.change_album_message).prop("outerHTML")+r.prop("outerHTML"),title:e.change_album_title,buttons:{cancel:{label:e.action_cancel,className:"btn-secondary"},confirm:{label:e.action_continue,className:"btn-success",callback:function(){n(this)}}}})},regenerateThumbnails:function(t){this.selectPhotoSingle(t.target);var e=$(t.target).closest(".photo"),i=n.regenerate_thumbnails;return i=i.replace(/\/0$/,"/"+this.photoIDs[0]),$(".loading",e).show(),$.post(i,function(){var t=$("img.photo-thumbnail",e),n=t.data("original-src");t.attr("src",n+"&_="+(new Date).getTime()),$(".loading",e).hide()}),this.photoIDs=[],t.preventDefault(),!1},replacePhoto:function(t){var n=this;this.selectPhotoSingle(t.target);$(t.target).closest(".photo");return bootbox.dialog({message:$("").html(e.replace_image_message).prop("outerHTML")+$("#replace-image-form").clone().removeAttr("style").attr("id","replace-image-form-visible").prop("outerHTML"),title:e.replace_image_title,buttons:{cancel:{label:e.action_cancel,className:"btn-secondary"},confirm:{label:e.action_continue,className:"btn-success",callback:function(){$('input[name="photo_id"]',"#replace-image-form-visible").val(n.photoIDs[0]),$("#replace-image-form-visible").submit()}}}}),t.preventDefault(),!1},rotate:function(t,e){var i=n.rotate_photo;i=(i=i.replace("/0/","/"+this.photoIDs[0]+"/")).replace(/\/1$/,"/"+t),$(".loading",e).show(),$.post(i,function(){var t=$("img.photo-thumbnail",e),n=t.data("original-src");t.attr("src",n+"&_="+(new Date).getTime()),$(".loading",e).hide()}),this.photoIDs=[]},rotateLeft:function(t){return this.selectPhotoSingle(t.target),this.rotate(90,$(t.target).closest(".photo")),t.preventDefault(),!1},rotateRight:function(t){return this.selectPhotoSingle(t.target),this.rotate(270,$(t.target).closest(".photo")),t.preventDefault(),!1},selectAll:function(){var t=this;return bootbox.dialog({title:e.select_all_choice_title,message:e.select_all_choice_message,buttons:{select_all:{label:e.select_all_choice_all_action,className:"btn-secondary",callback:function(){for(t.selectAllInAlbum=1,i=0;i=this.images.length&&(t=0),this.current=this.images[t],this.currentIndex=t},startSlideshow:function(){this.images.length<=0||(this.interval=window.setInterval(this.rotateNextImage,t),this.current=this.images[0],this.isRunning=!0)}}}function UploadPhotosViewModel(t,e,n,i){this.el="#upload-tab",this.data={currentStatus:"",imagesFailed:0,imagesTotal:0,imagesUploaded:0,isBulkUploadInProgress:!1,isUploadInProgress:!1,statusMessages:[]},this.computed={failedPercentage:function(){var t=0;return this.imagesTotal>0&&(t=this.imagesFailed/this.imagesTotal*100),t.toFixed(2)+"%"},successfulPercentage:function(){var t=0;return this.imagesTotal>0&&(t=this.imagesUploaded/this.imagesTotal*100),t.toFixed(2)+"%"}},this.methods={onUploadCompleted:function(){this.currentStatus=n.upload_status.replace(":current",this.imagesUploaded+this.imagesFailed).replace(":total",this.imagesTotal),this.imagesFailed+this.imagesUploaded>=this.imagesTotal&&(this.isUploadInProgress=!1,0===this.imagesFailed&&this.imagesUploaded>0&&(window.location=i.analyse))},onUploadFailed:function(t,e){this.imagesFailed++,this.statusMessages.push({message_class:"text-danger",message_text:n.image_failed.replace(":file_name",e)}),this.onUploadCompleted()},onUploadSuccessful:function(t,e){t.is_successful?(this.imagesUploaded++,this.onUploadCompleted()):this.onUploadFailed(t,e)},uploadFile:function(i,r){var o=this,a=new FormData;a.append("album_id",t),a.append("queue_token",e),a.append("photo[]",r,r.name),$.ajax({contentType:!1,data:a,error:function(t){o.onUploadFailed(t,r.name)},method:$(i).attr("method"),processData:!1,success:function(t){o.onUploadSuccessful(t,r.name)},url:$(i).attr("action")}),this.isUploadInProgress=!0,this.currentStatus=n.upload_status.replace(":current",0).replace(":total",this.imagesTotal)},uploadBulkFiles:function(t){return this.isBulkUploadInProgress=!0,!0},uploadIndividualFiles:function(t){var e=$("input[type=file]",t.target)[0].files;this.currentStatus="",this.statusMessages=[],this.imagesUploaded=0,this.imagesFailed=0,this.imagesTotal=e.length,this.isUploadInProgress=!0;for(var i=0;i0&&e-1 in t)}function r(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}function o(t,e,n){return ht.isFunction(e)?ht.grep(t,function(t,i){return!!e.call(t,i,t)!==n}):e.nodeType?ht.grep(t,function(t){return t===e!==n}):"string"!=typeof e?ht.grep(t,function(t){return at.call(e,t)>-1!==n}):Ct.test(e)?ht.filter(e,t,n):(e=ht.filter(e,t),ht.grep(t,function(t){return at.call(e,t)>-1!==n&&1===t.nodeType}))}function a(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function s(t){var e={};return ht.each(t.match(At)||[],function(t,n){e[n]=!0}),e}function l(t){return t}function u(t){throw t}function c(t,e,n,i){var r;try{t&&ht.isFunction(r=t.promise)?r.call(t).done(e).fail(n):t&&ht.isFunction(r=t.then)?r.call(t,e,n):e.apply(void 0,[t].slice(i))}catch(t){n.apply(void 0,[t])}}function d(){et.removeEventListener("DOMContentLoaded",d),t.removeEventListener("load",d),ht.ready()}function f(){this.expando=ht.expando+f.uid++}function h(t){return"true"===t||"false"!==t&&("null"===t?null:t===+t+""?+t:Lt.test(t)?JSON.parse(t):t)}function p(t,e,n){var i;if(void 0===n&&1===t.nodeType)if(i="data-"+e.replace(Ft,"-$&").toLowerCase(),"string"==typeof(n=t.getAttribute(i))){try{n=h(n)}catch(t){}Pt.set(t,e,n)}else n=void 0;return n}function g(t,e,n,i){var r,o=1,a=20,s=i?function(){return i.cur()}:function(){return ht.css(t,e,"")},l=s(),u=n&&n[3]||(ht.cssNumber[e]?"":"px"),c=(ht.cssNumber[e]||"px"!==u&&+l)&&$t.exec(ht.css(t,e));if(c&&c[3]!==u){u=u||c[3],n=n||[],c=+l||1;do{c/=o=o||".5",ht.style(t,e,c+u)}while(o!==(o=s()/l)&&1!==o&&--a)}return n&&(c=+c||+l||0,r=n[1]?c+(n[1]+1)*n[2]:+n[2],i&&(i.unit=u,i.start=c,i.end=r)),r}function m(t){var e,n=t.ownerDocument,i=t.nodeName,r=Bt[i];return r||(e=n.body.appendChild(n.createElement(i)),r=ht.css(e,"display"),e.parentNode.removeChild(e),"none"===r&&(r="block"),Bt[i]=r,r)}function v(t,e){for(var n,i,r=[],o=0,a=t.length;o-1)r&&r.push(o);else if(u=ht.contains(o.ownerDocument,o),a=y(d.appendChild(o),"script"),u&&b(a),n)for(c=0;o=a[c++];)qt.test(o.type||"")&&n.push(o);return d}function x(){return!0}function w(){return!1}function C(){try{return et.activeElement}catch(t){}}function S(t,e,n,i,r,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(i=i||n,n=void 0);for(s in e)S(t,s,n,i,e[s],o);return t}if(null==i&&null==r?(r=n,i=n=void 0):null==r&&("string"==typeof n?(r=i,i=void 0):(r=i,i=n,n=void 0)),!1===r)r=w;else if(!r)return t;return 1===o&&(a=r,(r=function(t){return ht().off(t),a.apply(this,arguments)}).guid=a.guid||(a.guid=ht.guid++)),t.each(function(){ht.event.add(this,e,r,i,n)})}function k(t,e){return r(t,"table")&&r(11!==e.nodeType?e:e.firstChild,"tr")?ht(">tbody",t)[0]||t:t}function T(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function O(t){var e=ee.exec(t.type);return e?t.type=e[1]:t.removeAttribute("type"),t}function A(t,e){var n,i,r,o,a,s,l,u;if(1===e.nodeType){if(Nt.hasData(t)&&(o=Nt.access(t),a=Nt.set(e,o),u=o.events)){delete a.handle,a.events={};for(r in u)for(n=0,i=u[r].length;n1&&"string"==typeof p&&!ft.checkClone&&te.test(p))return t.each(function(n){var o=t.eq(n);g&&(e[0]=p.call(this,n,o.html())),E(o,e,i,r)});if(f&&(o=_(e,t[0].ownerDocument,!1,t,r),a=o.firstChild,1===o.childNodes.length&&(o=a),a||r)){for(l=(s=ht.map(y(o,"script"),T)).length;d=0&&nx.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function i(t){return t[$]=!0,t}function r(t){var e=I.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function o(t,e){for(var n=t.split("|"),i=n.length;i--;)x.attrHandle[n[i]]=e}function a(t,e){var n=e&&t,i=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function s(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&wt(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function l(t){return i(function(e){return e=+e,i(function(n,i){for(var r,o=t([],n.length,e),a=o.length;a--;)n[r=o[a]]&&(n[r]=!(i[r]=n[r]))})})}function u(t){return t&&void 0!==t.getElementsByTagName&&t}function c(){}function d(t){for(var e=0,n=t.length,i="";e1?function(e,n,i){for(var r=t.length;r--;)if(!t[r](e,n,i))return!1;return!0}:t[0]}function p(t,n,i){for(var r=0,o=n.length;r-1&&(i[u]=!(a[u]=d))}}else b=g(b===a?b.splice(m,b.length):b),o?o(null,a,b,l):Q.apply(a,b)})}function v(t){for(var e,n,i,r=t.length,o=x.relative[t[0].type],a=o||x.relative[" "],s=o?1:0,l=f(function(t){return t===e},a,!0),u=f(function(t){return J(e,t)>-1},a,!0),c=[function(t,n,i){var r=!o&&(i||n!==O)||((e=n).nodeType?l(t,n,i):u(t,n,i));return e=null,r}];s1&&h(c),s>1&&d(t.slice(0,s-1).concat({value:" "===t[s-2].type?"*":""})).replace(ot,"$1"),n,s0,o=t.length>0,a=function(i,a,s,l,u){var c,d,f,h=0,p="0",m=i&&[],v=[],y=O,b=i||o&&x.find.TAG("*",u),_=H+=null==y?1:Math.random()||.1,w=b.length;for(u&&(O=a===I||a||u);p!==w&&null!=(c=b[p]);p++){if(o&&c){for(d=0,a||c.ownerDocument===I||(E(c),s=!N);f=t[d++];)if(f(c,a||I,s)){l.push(c);break}u&&(H=_)}r&&((c=!f&&c)&&h--,i&&m.push(c))}if(h+=p,r&&p!==h){for(d=0;f=n[d++];)f(m,v,a,s);if(i){if(h>0)for(;p--;)m[p]||v[p]||(v[p]=K.call(l));v=g(v)}Q.apply(l,v),u&&!i&&v.length>0&&h+n.length>1&&e.uniqueSort(l)}return u&&(H=_,O=y),m};return r?i(a):a}var b,_,x,w,C,S,k,T,O,A,D,E,I,M,N,P,L,F,R,$="sizzle"+1*new Date,j=t.document,H=0,W=0,B=n(),V=n(),z=n(),q=function(t,e){return t===e&&(D=!0),0},U={}.hasOwnProperty,Y=[],K=Y.pop,G=Y.push,Q=Y.push,X=Y.slice,J=function(t,e){for(var n=0,i=t.length;n+~]|"+tt+")"+tt+"*"),lt=new RegExp("="+tt+"*([^\\]'\"]*?)"+tt+"*\\]","g"),ut=new RegExp(it),ct=new RegExp("^"+et+"$"),dt={ID:new RegExp("^#("+et+")"),CLASS:new RegExp("^\\.("+et+")"),TAG:new RegExp("^("+et+"|[*])"),ATTR:new RegExp("^"+nt),PSEUDO:new RegExp("^"+it),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+tt+"*(even|odd|(([+-]|)(\\d*)n|)"+tt+"*(?:([+-]|)"+tt+"*(\\d+)|))"+tt+"*\\)|)","i"),bool:new RegExp("^(?:"+Z+")$","i"),needsContext:new RegExp("^"+tt+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+tt+"*((?:-\\d)?\\d*)"+tt+"*\\)|)(?=[^-]|$)","i")},ft=/^(?:input|select|textarea|button)$/i,ht=/^h\d$/i,pt=/^[^{]+\{\s*\[native \w/,gt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,mt=/[+~]/,vt=new RegExp("\\\\([\\da-f]{1,6}"+tt+"?|("+tt+")|.)","ig"),yt=function(t,e,n){var i="0x"+e-65536;return i!==i||n?e:i<0?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)},bt=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,_t=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},xt=function(){E()},wt=f(function(t){return!0===t.disabled&&("form"in t||"label"in t)},{dir:"parentNode",next:"legend"});try{Q.apply(Y=X.call(j.childNodes),j.childNodes),Y[j.childNodes.length].nodeType}catch(t){Q={apply:Y.length?function(t,e){G.apply(t,X.call(e))}:function(t,e){for(var n=t.length,i=0;t[n++]=e[i++];);t.length=n-1}}}_=e.support={},C=e.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return!!e&&"HTML"!==e.nodeName},E=e.setDocument=function(t){var e,n,i=t?t.ownerDocument||t:j;return i!==I&&9===i.nodeType&&i.documentElement?(I=i,M=I.documentElement,N=!C(I),j!==I&&(n=I.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",xt,!1):n.attachEvent&&n.attachEvent("onunload",xt)),_.attributes=r(function(t){return t.className="i",!t.getAttribute("className")}),_.getElementsByTagName=r(function(t){return t.appendChild(I.createComment("")),!t.getElementsByTagName("*").length}),_.getElementsByClassName=pt.test(I.getElementsByClassName),_.getById=r(function(t){return M.appendChild(t).id=$,!I.getElementsByName||!I.getElementsByName($).length}),_.getById?(x.filter.ID=function(t){var e=t.replace(vt,yt);return function(t){return t.getAttribute("id")===e}},x.find.ID=function(t,e){if(void 0!==e.getElementById&&N){var n=e.getElementById(t);return n?[n]:[]}}):(x.filter.ID=function(t){var e=t.replace(vt,yt);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}},x.find.ID=function(t,e){if(void 0!==e.getElementById&&N){var n,i,r,o=e.getElementById(t);if(o){if((n=o.getAttributeNode("id"))&&n.value===t)return[o];for(r=e.getElementsByName(t),i=0;o=r[i++];)if((n=o.getAttributeNode("id"))&&n.value===t)return[o]}return[]}}),x.find.TAG=_.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):_.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,i=[],r=0,o=e.getElementsByTagName(t);if("*"===t){for(;n=o[r++];)1===n.nodeType&&i.push(n);return i}return o},x.find.CLASS=_.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&N)return e.getElementsByClassName(t)},L=[],P=[],(_.qsa=pt.test(I.querySelectorAll))&&(r(function(t){M.appendChild(t).innerHTML="",t.querySelectorAll("[msallowcapture^='']").length&&P.push("[*^$]="+tt+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||P.push("\\["+tt+"*(?:value|"+Z+")"),t.querySelectorAll("[id~="+$+"-]").length||P.push("~="),t.querySelectorAll(":checked").length||P.push(":checked"),t.querySelectorAll("a#"+$+"+*").length||P.push(".#.+[+~]")}),r(function(t){t.innerHTML="";var e=I.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&P.push("name"+tt+"*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&P.push(":enabled",":disabled"),M.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&P.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),P.push(",.*:")})),(_.matchesSelector=pt.test(F=M.matches||M.webkitMatchesSelector||M.mozMatchesSelector||M.oMatchesSelector||M.msMatchesSelector))&&r(function(t){_.disconnectedMatch=F.call(t,"*"),F.call(t,"[s!='']:x"),L.push("!=",it)}),P=P.length&&new RegExp(P.join("|")),L=L.length&&new RegExp(L.join("|")),e=pt.test(M.compareDocumentPosition),R=e||pt.test(M.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},q=e?function(t,e){if(t===e)return D=!0,0;var n=!t.compareDocumentPosition-!e.compareDocumentPosition;return n||(1&(n=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!_.sortDetached&&e.compareDocumentPosition(t)===n?t===I||t.ownerDocument===j&&R(j,t)?-1:e===I||e.ownerDocument===j&&R(j,e)?1:A?J(A,t)-J(A,e):0:4&n?-1:1)}:function(t,e){if(t===e)return D=!0,0;var n,i=0,r=t.parentNode,o=e.parentNode,s=[t],l=[e];if(!r||!o)return t===I?-1:e===I?1:r?-1:o?1:A?J(A,t)-J(A,e):0;if(r===o)return a(t,e);for(n=t;n=n.parentNode;)s.unshift(n);for(n=e;n=n.parentNode;)l.unshift(n);for(;s[i]===l[i];)i++;return i?a(s[i],l[i]):s[i]===j?-1:l[i]===j?1:0},I):I},e.matches=function(t,n){return e(t,null,null,n)},e.matchesSelector=function(t,n){if((t.ownerDocument||t)!==I&&E(t),n=n.replace(lt,"='$1']"),_.matchesSelector&&N&&!z[n+" "]&&(!L||!L.test(n))&&(!P||!P.test(n)))try{var i=F.call(t,n);if(i||_.disconnectedMatch||t.document&&11!==t.document.nodeType)return i}catch(t){}return e(n,I,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!==I&&E(t),R(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==I&&E(t);var n=x.attrHandle[e.toLowerCase()],i=n&&U.call(x.attrHandle,e.toLowerCase())?n(t,e,!N):void 0;return void 0!==i?i:_.attributes||!N?t.getAttribute(e):(i=t.getAttributeNode(e))&&i.specified?i.value:null},e.escape=function(t){return(t+"").replace(bt,_t)},e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,n=[],i=0,r=0;if(D=!_.detectDuplicates,A=!_.sortStable&&t.slice(0),t.sort(q),D){for(;e=t[r++];)e===t[r]&&(i=n.push(r));for(;i--;)t.splice(n[i],1)}return A=null,t},w=e.getText=function(t){var e,n="",i=0,r=t.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=w(t)}else if(3===r||4===r)return t.nodeValue}else for(;e=t[i++];)n+=w(e);return n},(x=e.selectors={cacheLength:50,createPseudo:i,match:dt,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(vt,yt),t[3]=(t[3]||t[4]||t[5]||"").replace(vt,yt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||e.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&e.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return dt.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&ut.test(n)&&(e=S(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(vt,yt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=B[t+" "];return e||(e=new RegExp("(^|"+tt+")"+t+"("+tt+"|$)"))&&B(t,function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(t,n,i){return function(r){var o=e.attr(r,t);return null==o?"!="===n:!n||(o+="","="===n?o===i:"!="===n?o!==i:"^="===n?i&&0===o.indexOf(i):"*="===n?i&&o.indexOf(i)>-1:"$="===n?i&&o.slice(-i.length)===i:"~="===n?(" "+o.replace(rt," ")+" ").indexOf(i)>-1:"|="===n&&(o===i||o.slice(0,i.length+1)===i+"-"))}},CHILD:function(t,e,n,i,r){var o="nth"!==t.slice(0,3),a="last"!==t.slice(-4),s="of-type"===e;return 1===i&&0===r?function(t){return!!t.parentNode}:function(e,n,l){var u,c,d,f,h,p,g=o!==a?"nextSibling":"previousSibling",m=e.parentNode,v=s&&e.nodeName.toLowerCase(),y=!l&&!s,b=!1;if(m){if(o){for(;g;){for(f=e;f=f[g];)if(s?f.nodeName.toLowerCase()===v:1===f.nodeType)return!1;p=g="only"===t&&!p&&"nextSibling"}return!0}if(p=[a?m.firstChild:m.lastChild],a&&y){for(b=(h=(u=(c=(d=(f=m)[$]||(f[$]={}))[f.uniqueID]||(d[f.uniqueID]={}))[t]||[])[0]===H&&u[1])&&u[2],f=h&&m.childNodes[h];f=++h&&f&&f[g]||(b=h=0)||p.pop();)if(1===f.nodeType&&++b&&f===e){c[t]=[H,h,b];break}}else if(y&&(b=h=(u=(c=(d=(f=e)[$]||(f[$]={}))[f.uniqueID]||(d[f.uniqueID]={}))[t]||[])[0]===H&&u[1]),!1===b)for(;(f=++h&&f&&f[g]||(b=h=0)||p.pop())&&((s?f.nodeName.toLowerCase()!==v:1!==f.nodeType)||!++b||(y&&((c=(d=f[$]||(f[$]={}))[f.uniqueID]||(d[f.uniqueID]={}))[t]=[H,b]),f!==e)););return(b-=r)===i||b%i==0&&b/i>=0}}},PSEUDO:function(t,n){var r,o=x.pseudos[t]||x.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return o[$]?o(n):o.length>1?(r=[t,t,"",n],x.setFilters.hasOwnProperty(t.toLowerCase())?i(function(t,e){for(var i,r=o(t,n),a=r.length;a--;)t[i=J(t,r[a])]=!(e[i]=r[a])}):function(t){return o(t,0,r)}):o}},pseudos:{not:i(function(t){var e=[],n=[],r=k(t.replace(ot,"$1"));return r[$]?i(function(t,e,n,i){for(var o,a=r(t,null,i,[]),s=t.length;s--;)(o=a[s])&&(t[s]=!(e[s]=o))}):function(t,i,o){return e[0]=t,r(e,null,o,n),e[0]=null,!n.pop()}}),has:i(function(t){return function(n){return e(t,n).length>0}}),contains:i(function(t){return t=t.replace(vt,yt),function(e){return(e.textContent||e.innerText||w(e)).indexOf(t)>-1}}),lang:i(function(t){return ct.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(vt,yt).toLowerCase(),function(e){var n;do{if(n=N?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(n=n.toLowerCase())===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===M},focus:function(t){return t===I.activeElement&&(!I.hasFocus||I.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:s(!1),disabled:s(!0),checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!x.pseudos.empty(t)},header:function(t){return ht.test(t.nodeName)},input:function(t){return ft.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:l(function(){return[0]}),last:l(function(t,e){return[e-1]}),eq:l(function(t,e,n){return[n<0?n+e:n]}),even:l(function(t,e){for(var n=0;n=0;)t.push(i);return t}),gt:l(function(t,e,n){for(var i=n<0?n+e:n;++i2&&"ID"===(a=o[0]).type&&9===e.nodeType&&N&&x.relative[o[1].type]){if(!(e=(x.find.ID(a.matches[0].replace(vt,yt),e)||[])[0]))return n;c&&(e=e.parentNode),t=t.slice(o.shift().value.length)}for(r=dt.needsContext.test(t)?0:o.length;r--&&(a=o[r],!x.relative[s=a.type]);)if((l=x.find[s])&&(i=l(a.matches[0].replace(vt,yt),mt.test(o[0].type)&&u(e.parentNode)||e))){if(o.splice(r,1),!(t=i.length&&d(o)))return Q.apply(n,i),n;break}}return(c||k(t,f))(i,e,!N,n,!e||mt.test(t)&&u(e.parentNode)||e),n},_.sortStable=$.split("").sort(q).join("")===$,_.detectDuplicates=!!D,E(),_.sortDetached=r(function(t){return 1&t.compareDocumentPosition(I.createElement("fieldset"))}),r(function(t){return t.innerHTML="","#"===t.firstChild.getAttribute("href")})||o("type|href|height|width",function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)}),_.attributes&&r(function(t){return t.innerHTML="",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")})||o("value",function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue}),r(function(t){return null==t.getAttribute("disabled")})||o(Z,function(t,e,n){var i;if(!n)return!0===t[e]?e.toLowerCase():(i=t.getAttributeNode(e))&&i.specified?i.value:null}),e}(t);ht.find=yt,ht.expr=yt.selectors,ht.expr[":"]=ht.expr.pseudos,ht.uniqueSort=ht.unique=yt.uniqueSort,ht.text=yt.getText,ht.isXMLDoc=yt.isXML,ht.contains=yt.contains,ht.escapeSelector=yt.escape;var bt=function(t,e,n){for(var i=[],r=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(r&&ht(t).is(n))break;i.push(t)}return i},_t=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},xt=ht.expr.match.needsContext,wt=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Ct=/^.[^:#\[\.,]*$/;ht.filter=function(t,e,n){var i=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===i.nodeType?ht.find.matchesSelector(i,t)?[i]:[]:ht.find.matches(t,ht.grep(e,function(t){return 1===t.nodeType}))},ht.fn.extend({find:function(t){var e,n,i=this.length,r=this;if("string"!=typeof t)return this.pushStack(ht(t).filter(function(){for(e=0;e1?ht.uniqueSort(n):n},filter:function(t){return this.pushStack(o(this,t||[],!1))},not:function(t){return this.pushStack(o(this,t||[],!0))},is:function(t){return!!o(this,"string"==typeof t&&xt.test(t)?ht(t):t||[],!1).length}});var St,kt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(ht.fn.init=function(t,e,n){var i,r;if(!t)return this;if(n=n||St,"string"==typeof t){if(!(i="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:kt.exec(t))||!i[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(i[1]){if(e=e instanceof ht?e[0]:e,ht.merge(this,ht.parseHTML(i[1],e&&e.nodeType?e.ownerDocument||e:et,!0)),wt.test(i[1])&&ht.isPlainObject(e))for(i in e)ht.isFunction(this[i])?this[i](e[i]):this.attr(i,e[i]);return this}return(r=et.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):ht.isFunction(t)?void 0!==n.ready?n.ready(t):t(ht):ht.makeArray(t,this)}).prototype=ht.fn,St=ht(et);var Tt=/^(?:parents|prev(?:Until|All))/,Ot={children:!0,contents:!0,next:!0,prev:!0};ht.fn.extend({has:function(t){var e=ht(t,this),n=e.length;return this.filter(function(){for(var t=0;t-1:1===n.nodeType&&ht.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?ht.uniqueSort(o):o)},index:function(t){return t?"string"==typeof t?at.call(ht(t),this[0]):at.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(ht.uniqueSort(ht.merge(this.get(),ht(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),ht.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return bt(t,"parentNode")},parentsUntil:function(t,e,n){return bt(t,"parentNode",n)},next:function(t){return a(t,"nextSibling")},prev:function(t){return a(t,"previousSibling")},nextAll:function(t){return bt(t,"nextSibling")},prevAll:function(t){return bt(t,"previousSibling")},nextUntil:function(t,e,n){return bt(t,"nextSibling",n)},prevUntil:function(t,e,n){return bt(t,"previousSibling",n)},siblings:function(t){return _t((t.parentNode||{}).firstChild,t)},children:function(t){return _t(t.firstChild)},contents:function(t){return r(t,"iframe")?t.contentDocument:(r(t,"template")&&(t=t.content||t),ht.merge([],t.childNodes))}},function(t,e){ht.fn[t]=function(n,i){var r=ht.map(this,e,n);return"Until"!==t.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=ht.filter(i,r)),this.length>1&&(Ot[t]||ht.uniqueSort(r),Tt.test(t)&&r.reverse()),this.pushStack(r)}});var At=/[^\x20\t\r\n\f]+/g;ht.Callbacks=function(t){t="string"==typeof t?s(t):ht.extend({},t);var e,n,i,r,o=[],a=[],l=-1,u=function(){for(r=r||t.once,i=e=!0;a.length;l=-1)for(n=a.shift();++l-1;)o.splice(n,1),n<=l&&l--}),this},has:function(t){return t?ht.inArray(t,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return r=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return r=a=[],n||e||(o=n=""),this},locked:function(){return!!r},fireWith:function(t,n){return r||(n=[t,(n=n||[]).slice?n.slice():n],a.push(n),e||u()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!i}};return c},ht.extend({Deferred:function(e){var n=[["notify","progress",ht.Callbacks("memory"),ht.Callbacks("memory"),2],["resolve","done",ht.Callbacks("once memory"),ht.Callbacks("once memory"),0,"resolved"],["reject","fail",ht.Callbacks("once memory"),ht.Callbacks("once memory"),1,"rejected"]],i="pending",r={state:function(){return i},always:function(){return o.done(arguments).fail(arguments),this},catch:function(t){return r.then(null,t)},pipe:function(){var t=arguments;return ht.Deferred(function(e){ht.each(n,function(n,i){var r=ht.isFunction(t[i[4]])&&t[i[4]];o[i[1]](function(){var t=r&&r.apply(this,arguments);t&&ht.isFunction(t.promise)?t.promise().progress(e.notify).done(e.resolve).fail(e.reject):e[i[0]+"With"](this,r?[t]:arguments)})}),t=null}).promise()},then:function(e,i,r){function o(e,n,i,r){return function(){var s=this,c=arguments,d=function(){var t,d;if(!(e=a&&(i!==u&&(s=void 0,c=[t]),n.rejectWith(s,c))}};e?f():(ht.Deferred.getStackHook&&(f.stackTrace=ht.Deferred.getStackHook()),t.setTimeout(f))}}var a=0;return ht.Deferred(function(t){n[0][3].add(o(0,t,ht.isFunction(r)?r:l,t.notifyWith)),n[1][3].add(o(0,t,ht.isFunction(e)?e:l)),n[2][3].add(o(0,t,ht.isFunction(i)?i:u))}).promise()},promise:function(t){return null!=t?ht.extend(t,r):r}},o={};return ht.each(n,function(t,e){var a=e[2],s=e[5];r[e[1]]=a.add,s&&a.add(function(){i=s},n[3-t][2].disable,n[0][2].lock),a.add(e[3].fire),o[e[0]]=function(){return o[e[0]+"With"](this===o?void 0:this,arguments),this},o[e[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(t){var e=arguments.length,n=e,i=Array(n),r=it.call(arguments),o=ht.Deferred(),a=function(t){return function(n){i[t]=this,r[t]=arguments.length>1?it.call(arguments):n,--e||o.resolveWith(i,r)}};if(e<=1&&(c(t,o.done(a(n)).resolve,o.reject,!e),"pending"===o.state()||ht.isFunction(r[n]&&r[n].then)))return o.then();for(;n--;)c(r[n],a(n),o.reject);return o.promise()}});var Dt=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ht.Deferred.exceptionHook=function(e,n){t.console&&t.console.warn&&e&&Dt.test(e.name)&&t.console.warn("jQuery.Deferred exception: "+e.message,e.stack,n)},ht.readyException=function(e){t.setTimeout(function(){throw e})};var Et=ht.Deferred();ht.fn.ready=function(t){return Et.then(t).catch(function(t){ht.readyException(t)}),this},ht.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--ht.readyWait:ht.isReady)||(ht.isReady=!0,!0!==t&&--ht.readyWait>0||Et.resolveWith(et,[ht]))}}),ht.ready.then=Et.then,"complete"===et.readyState||"loading"!==et.readyState&&!et.documentElement.doScroll?t.setTimeout(ht.ready):(et.addEventListener("DOMContentLoaded",d),t.addEventListener("load",d));var It=function(t,e,n,i,r,o,a){var s=0,l=t.length,u=null==n;if("object"===ht.type(n)){r=!0;for(s in n)It(t,e,s,n[s],!0,o,a)}else if(void 0!==i&&(r=!0,ht.isFunction(i)||(a=!0),u&&(a?(e.call(t,i),e=null):(u=e,e=function(t,e,n){return u.call(ht(t),n)})),e))for(;s1,null,!0)},removeData:function(t){return this.each(function(){Pt.remove(this,t)})}}),ht.extend({queue:function(t,e,n){var i;if(t)return e=(e||"fx")+"queue",i=Nt.get(t,e),n&&(!i||Array.isArray(n)?i=Nt.access(t,e,ht.makeArray(n)):i.push(n)),i||[]},dequeue:function(t,e){e=e||"fx";var n=ht.queue(t,e),i=n.length,r=n.shift(),o=ht._queueHooks(t,e);"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===e&&n.unshift("inprogress"),delete o.stop,r.call(t,function(){ht.dequeue(t,e)},o)),!i&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return Nt.get(t,n)||Nt.access(t,n,{empty:ht.Callbacks("once memory").add(function(){Nt.remove(t,[e+"queue",n])})})}}),ht.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length\x20\t\r\n\f]+)/i,qt=/^$|\/(?:java|ecma)script/i,Ut={option:[1,""],thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};Ut.optgroup=Ut.option,Ut.tbody=Ut.tfoot=Ut.colgroup=Ut.caption=Ut.thead,Ut.th=Ut.td;var Yt=/<|?\w+;/;!function(){var t=et.createDocumentFragment().appendChild(et.createElement("div")),e=et.createElement("input");e.setAttribute("type","radio"),e.setAttribute("checked","checked"),e.setAttribute("name","t"),t.appendChild(e),ft.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="",ft.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var Kt=et.documentElement,Gt=/^key/,Qt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Xt=/^([^.]*)(?:\.(.+)|)/;ht.event={global:{},add:function(t,e,n,i,r){var o,a,s,l,u,c,d,f,h,p,g,m=Nt.get(t);if(m)for(n.handler&&(n=(o=n).handler,r=o.selector),r&&ht.find.matchesSelector(Kt,r),n.guid||(n.guid=ht.guid++),(l=m.events)||(l=m.events={}),(a=m.handle)||(a=m.handle=function(e){return void 0!==ht&&ht.event.triggered!==e.type?ht.event.dispatch.apply(t,arguments):void 0}),u=(e=(e||"").match(At)||[""]).length;u--;)h=g=(s=Xt.exec(e[u])||[])[1],p=(s[2]||"").split(".").sort(),h&&(d=ht.event.special[h]||{},h=(r?d.delegateType:d.bindType)||h,d=ht.event.special[h]||{},c=ht.extend({type:h,origType:g,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&ht.expr.match.needsContext.test(r),namespace:p.join(".")},o),(f=l[h])||((f=l[h]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(t,i,p,a)||t.addEventListener&&t.addEventListener(h,a)),d.add&&(d.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),r?f.splice(f.delegateCount++,0,c):f.push(c),ht.event.global[h]=!0)},remove:function(t,e,n,i,r){var o,a,s,l,u,c,d,f,h,p,g,m=Nt.hasData(t)&&Nt.get(t);if(m&&(l=m.events)){for(u=(e=(e||"").match(At)||[""]).length;u--;)if(s=Xt.exec(e[u])||[],h=g=s[1],p=(s[2]||"").split(".").sort(),h){for(d=ht.event.special[h]||{},f=l[h=(i?d.delegateType:d.bindType)||h]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=f.length;o--;)c=f[o],!r&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||i&&i!==c.selector&&("**"!==i||!c.selector)||(f.splice(o,1),c.selector&&f.delegateCount--,d.remove&&d.remove.call(t,c));a&&!f.length&&(d.teardown&&!1!==d.teardown.call(t,p,m.handle)||ht.removeEvent(t,h,m.handle),delete l[h])}else for(h in l)ht.event.remove(t,h+e[u],n,i,!0);ht.isEmptyObject(l)&&Nt.remove(t,"handle events")}},dispatch:function(t){var e,n,i,r,o,a,s=ht.event.fix(t),l=new Array(arguments.length),u=(Nt.get(this,"events")||{})[s.type]||[],c=ht.event.special[s.type]||{};for(l[0]=s,e=1;e=1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&("click"!==t.type||!0!==u.disabled)){for(o=[],a={},n=0;n-1:ht.find(r,this,null,[u]).length),a[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return u=this,l\x20\t\r\n\f]*)[^>]*)\/>/gi,Zt=/