rails-assets-lygneo_jsxc 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/README.md +22 -0
  4. data/Rakefile +1 -0
  5. data/app/.DS_Store +0 -0
  6. data/app/assets/documents/lygneo_jsxc/dep.json +82 -0
  7. data/app/assets/javascripts/lygneo_jsxc.js +10 -0
  8. data/app/assets/javascripts/lygneo_jsxc/jsxc.min.js +28 -0
  9. data/app/assets/javascripts/lygneo_jsxc/lib/dsa-ww.js +50 -0
  10. data/app/assets/javascripts/lygneo_jsxc/lib/jquery.colorbox-min.js +7 -0
  11. data/app/assets/javascripts/lygneo_jsxc/lib/jquery.fullscreen.js +88 -0
  12. data/app/assets/javascripts/lygneo_jsxc/lib/jquery.min.js +4 -0
  13. data/app/assets/javascripts/lygneo_jsxc/lib/jquery.slimscroll.js +474 -0
  14. data/app/assets/javascripts/lygneo_jsxc/lib/jquery.ui.min.js +7 -0
  15. data/app/assets/javascripts/lygneo_jsxc/lib/jsxc.dep.min.js +72 -0
  16. data/app/assets/javascripts/lygneo_jsxc/lib/strophe.caps.js +270 -0
  17. data/app/assets/javascripts/lygneo_jsxc/lib/strophe.disco.js +232 -0
  18. data/app/assets/javascripts/lygneo_jsxc/lib/strophe.js +5153 -0
  19. data/app/assets/javascripts/lygneo_jsxc/lib/strophe.muc.js +1020 -0
  20. data/app/assets/javascripts/lygneo_jsxc/lib/strophe.vcard.js +66 -0
  21. data/app/assets/stylesheets/lygneo_jsxc.scss +5 -0
  22. data/app/assets/stylesheets/lygneo_jsxc/build/jsxc.scss +1325 -0
  23. data/app/assets/stylesheets/lygneo_jsxc/build/jsxc.webrtc.scss +379 -0
  24. data/app/assets/stylesheets/lygneo_jsxc/lib/jquery-ui.min.scss +4 -0
  25. data/app/assets/stylesheets/lygneo_jsxc/lib/jquery.colorbox.scss +189 -0
  26. data/app/assets/stylesheets/lygneo_jsxc/lib/jquery.mCustomScrollbar.scss +241 -0
  27. data/lib/rails-assets-lygneo_jsxc.rb +55 -0
  28. data/lib/rails-assets-lygneo_jsxc/version.rb +3 -0
  29. data/rails-assets-lygneo_jsxc.gemspec +25 -0
  30. metadata +169 -0
@@ -0,0 +1,7 @@
1
+ /*! jQuery UI - v1.10.3 - 2013-10-20
2
+ * http://jqueryui.com
3
+ * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js
4
+ * Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ (function(e,t){function i(t,i){var s,n,r,o=t.nodeName.toLowerCase();return"area"===o?(s=t.parentNode,n=s.name,t.href&&n&&"map"===s.nodeName.toLowerCase()?(r=e("img[usemap=#"+n+"]")[0],!!r&&a(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||i:i)&&a(t)}function a(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var s=0,n=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,a){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),a&&a.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var a,s,n=e(this[0]);n.length&&n[0]!==document;){if(a=n.css("position"),("absolute"===a||"relative"===a||"fixed"===a)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++s)})},removeUniqueId:function(){return this.each(function(){n.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,a){return!!e.data(t,a[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var a=e.attr(t,"tabindex"),s=isNaN(a);return(s||a>=0)&&i(t,!s)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,a){function s(t,i,a,s){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,a&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===a?["Left","Right"]:["Top","Bottom"],r=a.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+a]=function(i){return i===t?o["inner"+a].call(this):this.each(function(){e(this).css(r,s(this,i)+"px")})},e.fn["outer"+a]=function(t,i){return"number"!=typeof t?o["outer"+a].call(this,t):this.each(function(){e(this).css(r,s(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,a){var s,n=e.ui[t].prototype;for(s in a)n.plugins[s]=n.plugins[s]||[],n.plugins[s].push([i,a[s]])},call:function(e,t,i){var a,s=e.plugins[t];if(s&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(a=0;s.length>a;a++)e.options[s[a][0]]&&s[a][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var a=i&&"left"===i?"scrollLeft":"scrollTop",s=!1;return t[a]>0?!0:(t[a]=1,s=t[a]>0,t[a]=0,s)}})})(jQuery);(function(e,t){var i=0,s=Array.prototype.slice,a=e.cleanData;e.cleanData=function(t){for(var i,s=0;null!=(i=t[s]);s++)try{e(i).triggerHandler("remove")}catch(n){}a(t)},e.widget=function(i,s,a){var n,r,o,h,l={},u=i.split(".")[0];i=i.split(".")[1],n=u+"-"+i,a||(a=s,s=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[u]=e[u]||{},r=e[u][i],o=e[u][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new o(e,i)},e.extend(o,r,{version:a.version,_proto:e.extend({},a),_childConstructors:[]}),h=new s,h.options=e.widget.extend({},h.options),e.each(a,function(i,a){return e.isFunction(a)?(l[i]=function(){var e=function(){return s.prototype[i].apply(this,arguments)},t=function(e){return s.prototype[i].apply(this,e)};return function(){var i,s=this._super,n=this._superApply;return this._super=e,this._superApply=t,i=a.apply(this,arguments),this._super=s,this._superApply=n,i}}(),t):(l[i]=a,t)}),o.prototype=e.widget.extend(h,{widgetEventPrefix:r?h.widgetEventPrefix:i},l,{constructor:o,namespace:u,widgetName:i,widgetFullName:n}),r?(e.each(r._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete r._childConstructors):s._childConstructors.push(o),e.widget.bridge(i,o)},e.widget.extend=function(i){for(var a,n,r=s.call(arguments,1),o=0,h=r.length;h>o;o++)for(a in r[o])n=r[o][a],r[o].hasOwnProperty(a)&&n!==t&&(i[a]=e.isPlainObject(n)?e.isPlainObject(i[a])?e.widget.extend({},i[a],n):e.widget.extend({},n):n);return i},e.widget.bridge=function(i,a){var n=a.prototype.widgetFullName||i;e.fn[i]=function(r){var o="string"==typeof r,h=s.call(arguments,1),l=this;return r=!o&&h.length?e.widget.extend.apply(null,[r].concat(h)):r,o?this.each(function(){var s,a=e.data(this,n);return a?e.isFunction(a[r])&&"_"!==r.charAt(0)?(s=a[r].apply(a,h),s!==a&&s!==t?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):t):e.error("no such method '"+r+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+r+"'")}):this.each(function(){var t=e.data(this,n);t?t.option(r||{})._init():e.data(this,n,new a(r,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,s){s=e(s||this.defaultElement||this)[0],this.element=e(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),s!==this&&(e.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===s&&this.destroy()}}),this.document=e(s.style?s.ownerDocument:s.document||s),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(i,s){var a,n,r,o=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(o={},a=i.split("."),i=a.shift(),a.length){for(n=o[i]=e.widget.extend({},this.options[i]),r=0;a.length-1>r;r++)n[a[r]]=n[a[r]]||{},n=n[a[r]];if(i=a.pop(),s===t)return n[i]===t?null:n[i];n[i]=s}else{if(s===t)return this.options[i]===t?null:this.options[i];o[i]=s}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,a){var n,r=this;"boolean"!=typeof i&&(a=s,s=i,i=!1),a?(s=n=e(s),this.bindings=this.bindings.add(s)):(a=s,s=this.element,n=this.widget()),e.each(a,function(a,o){function h(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?r[o]:o).apply(r,arguments):t}"string"!=typeof o&&(h.guid=o.guid=o.guid||h.guid||e.guid++);var l=a.match(/^(\w+)\s*(.*)$/),u=l[1]+r.eventNamespace,c=l[2];c?n.delegate(c,u,h):s.bind(u,h)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var a,n,r=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],n=i.originalEvent)for(a in n)a in i||(i[a]=n[a]);return this.element.trigger(i,s),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,a,n){"string"==typeof a&&(a={effect:a});var r,o=a?a===!0||"number"==typeof a?i:a.effect||i:t;a=a||{},"number"==typeof a&&(a={duration:a}),r=!e.isEmptyObject(a),a.complete=n,a.delay&&s.delay(a.delay),r&&e.effects&&e.effects.effect[o]?s[t](a):o!==t&&s[o]?s[o](a.duration,a.easing,n):s.queue(function(i){e(this)[t](),n&&n.call(s[0]),i()})}})})(jQuery);(function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!t){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,a=1===i.which,n="string"==typeof this.options.cancel&&i.target.nodeName?e(i.target).closest(this.options.cancel).length:!1;return a&&!n&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===e.data(i.target,this.widgetName+".preventClickEvent")&&e.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return s._mouseMove(e)},this._mouseUpDelegate=function(e){return s._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);(function(e,t){function i(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function s(t,i){return parseInt(e.css(t,i),10)||0}function a(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,r=Math.max,o=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,c=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(n!==t)return n;var i,s,a=e("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),r=a.children()[0];return e("body").append(a),i=r.offsetWidth,a.css("overflow","scroll"),s=r.offsetWidth,i===s&&(s=a[0].clientWidth),a.remove(),n=i-s},getScrollInfo:function(t){var i=t.isWindow?"":t.element.css("overflow-x"),s=t.isWindow?"":t.element.css("overflow-y"),a="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,n="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:n?e.position.scrollbarWidth():0,height:a?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]);return{element:i,isWindow:s,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s?i.width():i.outerWidth(),height:s?i.height():i.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return f.apply(this,arguments);t=e.extend({},t);var n,p,m,g,v,y,b=e(t.of),_=e.position.getWithinInfo(t.within),x=e.position.getScrollInfo(_),k=(t.collision||"flip").split(" "),w={};return y=a(b),b[0].preventDefault&&(t.at="left top"),p=y.width,m=y.height,g=y.offset,v=e.extend({},g),e.each(["my","at"],function(){var e,i,s=(t[this]||"").split(" ");1===s.length&&(s=l.test(s[0])?s.concat(["center"]):u.test(s[0])?["center"].concat(s):["center","center"]),s[0]=l.test(s[0])?s[0]:"center",s[1]=u.test(s[1])?s[1]:"center",e=c.exec(s[0]),i=c.exec(s[1]),w[this]=[e?e[0]:0,i?i[0]:0],t[this]=[d.exec(s[0])[0],d.exec(s[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===t.at[0]?v.left+=p:"center"===t.at[0]&&(v.left+=p/2),"bottom"===t.at[1]?v.top+=m:"center"===t.at[1]&&(v.top+=m/2),n=i(w.at,p,m),v.left+=n[0],v.top+=n[1],this.each(function(){var a,l,u=e(this),c=u.outerWidth(),d=u.outerHeight(),f=s(this,"marginLeft"),y=s(this,"marginTop"),D=c+f+s(this,"marginRight")+x.width,T=d+y+s(this,"marginBottom")+x.height,M=e.extend({},v),S=i(w.my,u.outerWidth(),u.outerHeight());"right"===t.my[0]?M.left-=c:"center"===t.my[0]&&(M.left-=c/2),"bottom"===t.my[1]?M.top-=d:"center"===t.my[1]&&(M.top-=d/2),M.left+=S[0],M.top+=S[1],e.support.offsetFractions||(M.left=h(M.left),M.top=h(M.top)),a={marginLeft:f,marginTop:y},e.each(["left","top"],function(i,s){e.ui.position[k[i]]&&e.ui.position[k[i]][s](M,{targetWidth:p,targetHeight:m,elemWidth:c,elemHeight:d,collisionPosition:a,collisionWidth:D,collisionHeight:T,offset:[n[0]+S[0],n[1]+S[1]],my:t.my,at:t.at,within:_,elem:u})}),t.using&&(l=function(e){var i=g.left-M.left,s=i+p-c,a=g.top-M.top,n=a+m-d,h={target:{element:b,left:g.left,top:g.top,width:p,height:m},element:{element:u,left:M.left,top:M.top,width:c,height:d},horizontal:0>s?"left":i>0?"right":"center",vertical:0>n?"top":a>0?"bottom":"middle"};c>p&&p>o(i+s)&&(h.horizontal="center"),d>m&&m>o(a+n)&&(h.vertical="middle"),h.important=r(o(i),o(s))>r(o(a),o(n))?"horizontal":"vertical",t.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,a=s.isWindow?s.scrollLeft:s.offset.left,n=s.width,o=e.left-t.collisionPosition.marginLeft,h=a-o,l=o+t.collisionWidth-n-a;t.collisionWidth>n?h>0&&0>=l?(i=e.left+h+t.collisionWidth-n-a,e.left+=h-i):e.left=l>0&&0>=h?a:h>l?a+n-t.collisionWidth:a:h>0?e.left+=h:l>0?e.left-=l:e.left=r(e.left-o,e.left)},top:function(e,t){var i,s=t.within,a=s.isWindow?s.scrollTop:s.offset.top,n=t.within.height,o=e.top-t.collisionPosition.marginTop,h=a-o,l=o+t.collisionHeight-n-a;t.collisionHeight>n?h>0&&0>=l?(i=e.top+h+t.collisionHeight-n-a,e.top+=h-i):e.top=l>0&&0>=h?a:h>l?a+n-t.collisionHeight:a:h>0?e.top+=h:l>0?e.top-=l:e.top=r(e.top-o,e.top)}},flip:{left:function(e,t){var i,s,a=t.within,n=a.offset.left+a.scrollLeft,r=a.width,h=a.isWindow?a.scrollLeft:a.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,c=l+t.collisionWidth-r-h,d="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+d+p+f+t.collisionWidth-r-n,(0>i||o(u)>i)&&(e.left+=d+p+f)):c>0&&(s=e.left-t.collisionPosition.marginLeft+d+p+f-h,(s>0||c>o(s))&&(e.left+=d+p+f))},top:function(e,t){var i,s,a=t.within,n=a.offset.top+a.scrollTop,r=a.height,h=a.isWindow?a.scrollTop:a.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,c=l+t.collisionHeight-r-h,d="top"===t.my[1],p=d?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-r-n,e.top+p+f+m>u&&(0>s||o(u)>s)&&(e.top+=p+f+m)):c>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,e.top+p+f+m>c&&(i>0||c>o(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,a,n,r=document.getElementsByTagName("body")[0],o=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(n in s)t.style[n]=s[n];t.appendChild(o),i=r||document.documentElement,i.insertBefore(t,i.firstChild),o.style.cssText="position: absolute; left: 10.7432222px;",a=e(o).offset().left,e.support.offsetFractions=a>10&&11>a,t.innerHTML="",i.removeChild(t)}()})(jQuery);(function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var i=this.options;return this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!i){var a=this._uiHash();if(this._trigger("drag",t,a)===!1)return this._mouseUp({}),!1;this.position=a.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,a=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(a=e.ui.ddmanager.drop(this,t)),this.dropped&&(a=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!a||"valid"===this.options.revert&&a||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,a)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(t){var i=this.options,a=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return a.parents("body").length||a.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),a[0]===this.element[0]||/(fixed|absolute)/.test(a.css("position"))||a.css("position","absolute"),a},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,a,s=this.options;return s.containment?"window"===s.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===s.containment?(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):s.containment.constructor===Array?(this.containment=s.containment,undefined):("parent"===s.containment&&(s.containment=this.helper[0].parentNode),i=e(s.containment),a=i[0],a&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(a.scrollWidth,a.offsetWidth):a.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(a.scrollHeight,a.offsetHeight):a.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),undefined):(this.containment=null,undefined)},_convertPositionTo:function(t,i){i||(i=this.position);var a="absolute"===t?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:s.scrollTop(),left:s.scrollLeft()}),{top:i.top+this.offset.relative.top*a+this.offset.parent.top*a-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*a,left:i.left+this.offset.relative.left*a+this.offset.parent.left*a-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*a}},_generatePosition:function(t){var i,a,s,n,r=this.options,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=t.pageX,h=t.pageY;return this.offset.scroll||(this.offset.scroll={top:o.scrollTop(),left:o.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(a=this.relative_container.offset(),i=[this.containment[0]+a.left,this.containment[1]+a.top,this.containment[2]+a.left,this.containment[3]+a.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(l=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(h=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(l=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),r.grid&&(s=r.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/r.grid[1])*r.grid[1]:this.originalPageY,h=i?s-this.offset.click.top>=i[1]||s-this.offset.click.top>i[3]?s:s-this.offset.click.top>=i[1]?s-r.grid[1]:s+r.grid[1]:s,n=r.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/r.grid[0])*r.grid[0]:this.originalPageX,l=i?n-this.offset.click.left>=i[0]||n-this.offset.click.left>i[2]?n:n-this.offset.click.left>=i[0]?n-r.grid[0]:n+r.grid[0]:n)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,i,a){return a=a||this._uiHash(),e.ui.plugin.call(this,t,[i,a]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,a)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i){var a=e(this).data("ui-draggable"),s=a.options,n=e.extend({},i,{item:a.element});a.sortables=[],e(s.connectToSortable).each(function(){var i=e.data(this,"ui-sortable");i&&!i.options.disabled&&(a.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i){var a=e(this).data("ui-draggable"),s=e.extend({},i,{item:a.element});e.each(a.sortables,function(){this.instance.isOver?(this.instance.isOver=0,a.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===a.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,s))})},drag:function(t,i){var a=e(this).data("ui-draggable"),s=this;e.each(a.sortables,function(){var n=!1,r=this;this.instance.positionAbs=a.positionAbs,this.instance.helperProportions=a.helperProportions,this.instance.offset.click=a.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(n=!0,e.each(a.sortables,function(){return this.instance.positionAbs=a.positionAbs,this.instance.helperProportions=a.helperProportions,this.instance.offset.click=a.offset.click,this!==r&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(r.instance.element[0],this.instance.element[0])&&(n=!1),n})),n?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(s).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=a.offset.click.top,this.instance.offset.click.left=a.offset.click.left,this.instance.offset.parent.left-=a.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=a.offset.parent.top-this.instance.offset.parent.top,a._trigger("toSortable",t),a.dropped=this.instance.element,a.currentItem=a.element,this.instance.fromOutside=a),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),a._trigger("fromSortable",t),a.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),i=e(this).data("ui-draggable").options;t.css("cursor")&&(i._cursor=t.css("cursor")),t.css("cursor",i.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i){var a=e(i.helper),s=e(this).data("ui-draggable").options;a.css("opacity")&&(s._opacity=a.css("opacity")),a.css("opacity",s.opacity)},stop:function(t,i){var a=e(this).data("ui-draggable").options;a._opacity&&e(i.helper).css("opacity",a._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var i=e(this).data("ui-draggable"),a=i.options,s=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(a.axis&&"x"===a.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-t.pageY<a.scrollSensitivity?i.scrollParent[0].scrollTop=s=i.scrollParent[0].scrollTop+a.scrollSpeed:t.pageY-i.overflowOffset.top<a.scrollSensitivity&&(i.scrollParent[0].scrollTop=s=i.scrollParent[0].scrollTop-a.scrollSpeed)),a.axis&&"y"===a.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-t.pageX<a.scrollSensitivity?i.scrollParent[0].scrollLeft=s=i.scrollParent[0].scrollLeft+a.scrollSpeed:t.pageX-i.overflowOffset.left<a.scrollSensitivity&&(i.scrollParent[0].scrollLeft=s=i.scrollParent[0].scrollLeft-a.scrollSpeed))):(a.axis&&"x"===a.axis||(t.pageY-e(document).scrollTop()<a.scrollSensitivity?s=e(document).scrollTop(e(document).scrollTop()-a.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<a.scrollSensitivity&&(s=e(document).scrollTop(e(document).scrollTop()+a.scrollSpeed))),a.axis&&"y"===a.axis||(t.pageX-e(document).scrollLeft()<a.scrollSensitivity?s=e(document).scrollLeft(e(document).scrollLeft()-a.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<a.scrollSensitivity&&(s=e(document).scrollLeft(e(document).scrollLeft()+a.scrollSpeed)))),s!==!1&&e.ui.ddmanager&&!a.dropBehaviour&&e.ui.ddmanager.prepareOffsets(i,t)}}),e.ui.plugin.add("draggable","snap",{start:function(){var t=e(this).data("ui-draggable"),i=t.options;t.snapElements=[],e(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=e(this),a=i.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:a.top,left:a.left})})},drag:function(t,i){var a,s,n,r,o,l,h,u,d,c,p=e(this).data("ui-draggable"),f=p.options,m=f.snapTolerance,g=i.offset.left,v=g+p.helperProportions.width,y=i.offset.top,b=y+p.helperProportions.height;for(d=p.snapElements.length-1;d>=0;d--)o=p.snapElements[d].left,l=o+p.snapElements[d].width,h=p.snapElements[d].top,u=h+p.snapElements[d].height,o-m>v||g>l+m||h-m>b||y>u+m||!e.contains(p.snapElements[d].item.ownerDocument,p.snapElements[d].item)?(p.snapElements[d].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[d].item})),p.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(a=m>=Math.abs(h-b),s=m>=Math.abs(u-y),n=m>=Math.abs(o-v),r=m>=Math.abs(l-g),a&&(i.position.top=p._convertPositionTo("relative",{top:h-p.helperProportions.height,left:0}).top-p.margins.top),s&&(i.position.top=p._convertPositionTo("relative",{top:u,left:0}).top-p.margins.top),n&&(i.position.left=p._convertPositionTo("relative",{top:0,left:o-p.helperProportions.width}).left-p.margins.left),r&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l}).left-p.margins.left)),c=a||s||n||r,"outer"!==f.snapMode&&(a=m>=Math.abs(h-y),s=m>=Math.abs(u-b),n=m>=Math.abs(o-g),r=m>=Math.abs(l-v),a&&(i.position.top=p._convertPositionTo("relative",{top:h,left:0}).top-p.margins.top),s&&(i.position.top=p._convertPositionTo("relative",{top:u-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.left=p._convertPositionTo("relative",{top:0,left:o}).left-p.margins.left),r&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[d].snapping&&(a||s||n||r||c)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[d].item})),p.snapElements[d].snapping=a||s||n||r||c)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,i=this.data("ui-draggable").options,a=e.makeArray(e(i.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});a.length&&(t=parseInt(e(a[0]).css("zIndex"),10)||0,e(a).each(function(i){e(this).css("zIndex",t+i)}),this.css("zIndex",t+a.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i){var a=e(i.helper),s=e(this).data("ui-draggable").options;a.css("zIndex")&&(s._zIndex=a.css("zIndex")),a.css("zIndex",s.zIndex)},stop:function(t,i){var a=e(this).data("ui-draggable").options;a._zIndex&&e(i.helper).css("zIndex",a._zIndex)}})})(jQuery);(function(e){function t(e,t,i){return e>t&&t+i>e}e.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t=this.options,i=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(i)?i:function(e){return e.is(i)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,i=e.ui.ddmanager.droppables[this.options.scope];i.length>t;t++)i[t]===this&&i.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){"accept"===t&&(this.accept=e.isFunction(i)?i:function(e){return e.is(i)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var a=i||e.ui.ddmanager.current,s=!1;return a&&(a.currentItem||a.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===a.options.scope&&t.accept.call(t.element[0],a.currentItem||a.element)&&e.ui.intersect(a,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(s=!0,!1):undefined}),s?!1:this.accept.call(this.element[0],a.currentItem||a.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(a)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,i,a){if(!i.offset)return!1;var s,n,r=(e.positionAbs||e.position.absolute).left,o=r+e.helperProportions.width,l=(e.positionAbs||e.position.absolute).top,h=l+e.helperProportions.height,u=i.offset.left,d=u+i.proportions.width,c=i.offset.top,p=c+i.proportions.height;switch(a){case"fit":return r>=u&&d>=o&&l>=c&&p>=h;case"intersect":return r+e.helperProportions.width/2>u&&d>o-e.helperProportions.width/2&&l+e.helperProportions.height/2>c&&p>h-e.helperProportions.height/2;case"pointer":return s=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,n=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(n,c,i.proportions.height)&&t(s,u,i.proportions.width);case"touch":return(l>=c&&p>=l||h>=c&&p>=h||c>l&&h>p)&&(r>=u&&d>=r||o>=u&&d>=o||u>r&&o>d);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var a,s,n=e.ui.ddmanager.droppables[t.options.scope]||[],r=i?i.type:null,o=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(a=0;n.length>a;a++)if(!(n[a].options.disabled||t&&!n[a].accept.call(n[a].element[0],t.currentItem||t.element))){for(s=0;o.length>s;s++)if(o[s]===n[a].element[0]){n[a].proportions.height=0;continue e}n[a].visible="none"!==n[a].element.css("display"),n[a].visible&&("mousedown"===r&&n[a]._activate.call(n[a],i),n[a].offset=n[a].element.offset(),n[a].proportions={width:n[a].element[0].offsetWidth,height:n[a].element[0].offsetHeight})}},drop:function(t,i){var a=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(a=this._drop.call(this,i)||a),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),a},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var a,s,n,r=e.ui.intersect(t,this,this.options.tolerance),o=!r&&this.isover?"isout":r&&!this.isover?"isover":null;o&&(this.options.greedy&&(s=this.options.scope,n=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===s}),n.length&&(a=e.data(n[0],"ui-droppable"),a.greedyChild="isover"===o)),a&&"isover"===o&&(a.isover=!1,a.isout=!0,a._out.call(a,i)),this[o]=!0,this["isout"===o?"isover":"isout"]=!1,this["isover"===o?"_over":"_out"].call(this,i),a&&"isout"===o&&(a.isout=!1,a.isover=!0,a._over.call(a,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}}})(jQuery);(function(e){function t(e){return parseInt(e,10)||0}function i(e){return!isNaN(parseInt(e,10))}e.widget("ui.resizable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var t,i,s,a,n,r=this,o=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!o.aspectRatio,aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=o.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),n="ui-resizable-"+s,a=e("<div class='ui-resizable-handle "+n+"'></div>"),a.css({zIndex:o.zIndex}),"se"===s&&a.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(a);this._renderAxis=function(t){var i,s,a,n;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=e(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=e(this.handles[i],this.element),n=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),a=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(a,n),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){r.resizing||(this.className&&(a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=a&&a[1]?a[1]:"se")}),o.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){o.disabled||(e(this).removeClass("ui-resizable-autohide"),r._handles.show())}).mouseleave(function(){o.disabled||r.resizing||(e(this).addClass("ui-resizable-autohide"),r._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,a=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(a=!0);return!this.options.disabled&&a},_mouseStart:function(i){var s,a,n,r=this.options,o=this.element.position(),h=this.element;return this.resizing=!0,/absolute/.test(h.css("position"))?h.css({position:"absolute",top:h.css("top"),left:h.css("left")}):h.is(".ui-draggable")&&h.css({position:"absolute",top:o.top,left:o.left}),this._renderProxy(),s=t(this.helper.css("left")),a=t(this.helper.css("top")),r.containment&&(s+=e(r.containment).scrollLeft()||0,a+=e(r.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:s,top:a},this.size=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalSize=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalPosition={left:s,top:a},this.sizeDiff={width:h.outerWidth()-h.width(),height:h.outerHeight()-h.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof r.aspectRatio?r.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),h.addClass("ui-resizable-resizing"),this._propagate("start",i),!0},_mouseDrag:function(t){var i,s=this.helper,a={},n=this.originalMousePosition,r=this.axis,o=this.position.top,h=this.position.left,l=this.size.width,u=this.size.height,c=t.pageX-n.left||0,d=t.pageY-n.top||0,p=this._change[r];return p?(i=p.apply(this,[t,c,d]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),this.position.top!==o&&(a.top=this.position.top+"px"),this.position.left!==h&&(a.left=this.position.left+"px"),this.size.width!==l&&(a.width=this.size.width+"px"),this.size.height!==u&&(a.height=this.size.height+"px"),s.css(a),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(a)||this._trigger("resize",t,this.ui()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,a,n,r,o,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),a=s&&e.ui.hasScroll(i[0],"left")?0:u.sizeDiff.height,n=s?0:u.sizeDiff.width,r={width:u.helper.width()-n,height:u.helper.height()-a},o=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(r,{top:h,left:o})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,s,a,n,r,o=this.options;r={minWidth:i(o.minWidth)?o.minWidth:0,maxWidth:i(o.maxWidth)?o.maxWidth:1/0,minHeight:i(o.minHeight)?o.minHeight:0,maxHeight:i(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=r.minHeight*this.aspectRatio,a=r.minWidth/this.aspectRatio,s=r.maxHeight*this.aspectRatio,n=r.maxWidth/this.aspectRatio,t>r.minWidth&&(r.minWidth=t),a>r.minHeight&&(r.minHeight=a),r.maxWidth>s&&(r.maxWidth=s),r.maxHeight>n&&(r.maxHeight=n)),this._vBoundaries=r},_updateCache:function(e){this.offset=this.helper.offset(),i(e.left)&&(this.position.left=e.left),i(e.top)&&(this.position.top=e.top),i(e.height)&&(this.size.height=e.height),i(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,s=this.size,a=this.axis;return i(e.height)?e.width=e.height*this.aspectRatio:i(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===a&&(e.left=t.left+(s.width-e.width),e.top=null),"nw"===a&&(e.top=t.top+(s.height-e.height),e.left=t.left+(s.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,s=this.axis,a=i(e.width)&&t.maxWidth&&t.maxWidth<e.width,n=i(e.height)&&t.maxHeight&&t.maxHeight<e.height,r=i(e.width)&&t.minWidth&&t.minWidth>e.width,o=i(e.height)&&t.minHeight&&t.minHeight>e.height,h=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,u=/sw|nw|w/.test(s),c=/nw|ne|n/.test(s);return r&&(e.width=t.minWidth),o&&(e.height=t.minHeight),a&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),r&&u&&(e.left=h-t.minWidth),a&&u&&(e.left=h-t.maxWidth),o&&c&&(e.top=l-t.minHeight),n&&c&&(e.top=l-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var e,t,i,s,a,n=this.helper||this.element;for(e=0;this._proportionallyResizeElements.length>e;e++){if(a=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],i=[a.css("borderTopWidth"),a.css("borderRightWidth"),a.css("borderBottomWidth"),a.css("borderLeftWidth")],s=[a.css("paddingTop"),a.css("paddingRight"),a.css("paddingBottom"),a.css("paddingLeft")],t=0;i.length>t;t++)this.borderDif[t]=(parseInt(i[t],10)||0)+(parseInt(s[t],10)||0);a.css({height:n.height()-this.borderDif[0]-this.borderDif[2]||0,width:n.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,a=this.originalPosition;return{top:a.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).data("ui-resizable"),s=i.options,a=i._proportionallyResizeElements,n=a.length&&/textarea/i.test(a[0].nodeName),r=n&&e.ui.hasScroll(a[0],"left")?0:i.sizeDiff.height,o=n?0:i.sizeDiff.width,h={width:i.size.width-o,height:i.size.height-r},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};a&&a.length&&e(a[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var i,s,a,n,r,o,h,l=e(this).data("ui-resizable"),u=l.options,c=l.element,d=u.containment,p=d instanceof e?d.get(0):/parent/.test(d)?c.parent().get(0):d;p&&(l.containerElement=e(p),/document/.test(d)||d===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(i=e(p),s=[],e(["Top","Right","Left","Bottom"]).each(function(e,a){s[e]=t(i.css("padding"+a))}),l.containerOffset=i.offset(),l.containerPosition=i.position(),l.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},a=l.containerOffset,n=l.containerSize.height,r=l.containerSize.width,o=e.ui.hasScroll(p,"left")?p.scrollWidth:r,h=e.ui.hasScroll(p)?p.scrollHeight:n,l.parentData={element:p,left:a.left,top:a.top,width:o,height:h}))},resize:function(t){var i,s,a,n,r=e(this).data("ui-resizable"),o=r.options,h=r.containerOffset,l=r.position,u=r._aspectRatio||t.shiftKey,c={top:0,left:0},d=r.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(c=h),l.left<(r._helper?h.left:0)&&(r.size.width=r.size.width+(r._helper?r.position.left-h.left:r.position.left-c.left),u&&(r.size.height=r.size.width/r.aspectRatio),r.position.left=o.helper?h.left:0),l.top<(r._helper?h.top:0)&&(r.size.height=r.size.height+(r._helper?r.position.top-h.top:r.position.top),u&&(r.size.width=r.size.height*r.aspectRatio),r.position.top=r._helper?h.top:0),r.offset.left=r.parentData.left+r.position.left,r.offset.top=r.parentData.top+r.position.top,i=Math.abs((r._helper?r.offset.left-c.left:r.offset.left-c.left)+r.sizeDiff.width),s=Math.abs((r._helper?r.offset.top-c.top:r.offset.top-h.top)+r.sizeDiff.height),a=r.containerElement.get(0)===r.element.parent().get(0),n=/relative|absolute/.test(r.containerElement.css("position")),a&&n&&(i-=r.parentData.left),i+r.size.width>=r.parentData.width&&(r.size.width=r.parentData.width-i,u&&(r.size.height=r.size.width/r.aspectRatio)),s+r.size.height>=r.parentData.height&&(r.size.height=r.parentData.height-s,u&&(r.size.width=r.size.height*r.aspectRatio))},stop:function(){var t=e(this).data("ui-resizable"),i=t.options,s=t.containerOffset,a=t.containerPosition,n=t.containerElement,r=e(t.helper),o=r.offset(),h=r.outerWidth()-t.sizeDiff.width,l=r.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(n.css("position"))&&e(this).css({left:o.left-a.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(n.css("position"))&&e(this).css({left:o.left-a.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,s=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e)})},resize:function(t,i){var s=e(this).data("ui-resizable"),a=s.options,n=s.originalSize,r=s.originalPosition,o={height:s.size.height-n.height||0,width:s.size.width-n.width||0,top:s.position.top-r.top||0,left:s.position.left-r.left||0},h=function(t,s){e(t).each(function(){var t=e(this),a=e(this).data("ui-resizable-alsoresize"),n={},r=s&&s.length?s:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(e,t){var i=(a[t]||0)+(o[t]||0);i&&i>=0&&(n[t]=i||null)}),t.css(n)})};"object"!=typeof a.alsoResize||a.alsoResize.nodeType?h(a.alsoResize):e.each(a.alsoResize,function(e,t){h(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).data("ui-resizable");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).data("ui-resizable");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).data("ui-resizable"),i=t.options,s=t.size,a=t.originalSize,n=t.originalPosition,r=t.axis,o="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=o[0]||1,l=o[1]||1,u=Math.round((s.width-a.width)/h)*h,c=Math.round((s.height-a.height)/l)*l,d=a.width+u,p=a.height+c,f=i.maxWidth&&d>i.maxWidth,m=i.maxHeight&&p>i.maxHeight,g=i.minWidth&&i.minWidth>d,v=i.minHeight&&i.minHeight>p;i.grid=o,g&&(d+=h),v&&(p+=l),f&&(d-=h),m&&(p-=l),/^(se|s|e)$/.test(r)?(t.size.width=d,t.size.height=p):/^(ne)$/.test(r)?(t.size.width=d,t.size.height=p,t.position.top=n.top-c):/^(sw)$/.test(r)?(t.size.width=d,t.size.height=p,t.position.left=n.left-u):(t.size.width=d,t.size.height=p,t.position.top=n.top-c,t.position.left=n.left-u)}})})(jQuery);(function(e){e.widget("ui.selectable",e.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,a=e.data(this,"selectable-item");return a?(s=!t.metaKey&&!t.ctrlKey||!a.$element.hasClass("ui-selected"),a.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),a.unselecting=!s,a.selecting=s,a.selected=s,s?i._trigger("selecting",t,{selecting:a.element}):i._trigger("unselecting",t,{unselecting:a.element}),!1):undefined}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,a=this.options,n=this.opos[0],r=this.opos[1],o=t.pageX,h=t.pageY;return n>o&&(i=o,o=n,n=i),r>h&&(i=h,h=r,r=i),this.helper.css({left:n,top:r,width:o-n,height:h-r}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===a.tolerance?l=!(i.left>o||n>i.right||i.top>h||r>i.bottom):"fit"===a.tolerance&&(l=i.left>n&&o>i.right&&i.top>r&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}})})(jQuery);(function(e){function t(e,t,i){return e>t&&t+i>e}function i(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))}e.widget("ui.sortable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,i){"disabled"===t?(this.options[t]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,i){var s=null,a=!1,n=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,n.widgetName+"-item")===n?(s=e(this),!1):undefined}),e.data(t.target,n.widgetName+"-item")===n&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(a=!0)}),a)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var a,n,r=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,r.cursorAt&&this._adjustOffsetFromHelper(r.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),r.containment&&this._setContainment(),r.cursor&&"auto"!==r.cursor&&(n=this.document.find("body"),this.storedCursor=n.css("cursor"),n.css("cursor",r.cursor),this.storedStylesheet=e("<style>*{ cursor: "+r.cursor+" !important; }</style>").appendTo(n)),r.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",r.opacity)),r.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",r.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(a=this.containers.length-1;a>=0;a--)this.containers[a]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!r.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,a,n,r=this.options,o=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<r.scrollSensitivity?this.scrollParent[0].scrollTop=o=this.scrollParent[0].scrollTop+r.scrollSpeed:t.pageY-this.overflowOffset.top<r.scrollSensitivity&&(this.scrollParent[0].scrollTop=o=this.scrollParent[0].scrollTop-r.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<r.scrollSensitivity?this.scrollParent[0].scrollLeft=o=this.scrollParent[0].scrollLeft+r.scrollSpeed:t.pageX-this.overflowOffset.left<r.scrollSensitivity&&(this.scrollParent[0].scrollLeft=o=this.scrollParent[0].scrollLeft-r.scrollSpeed)):(t.pageY-e(document).scrollTop()<r.scrollSensitivity?o=e(document).scrollTop(e(document).scrollTop()-r.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<r.scrollSensitivity&&(o=e(document).scrollTop(e(document).scrollTop()+r.scrollSpeed)),t.pageX-e(document).scrollLeft()<r.scrollSensitivity?o=e(document).scrollLeft(e(document).scrollLeft()-r.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<r.scrollSensitivity&&(o=e(document).scrollLeft(e(document).scrollLeft()+r.scrollSpeed))),o!==!1&&e.ui.ddmanager&&!r.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],a=s.item[0],n=this._intersectsWithPointer(s),n&&s.instance===this.currentContainer&&a!==this.currentItem[0]&&this.placeholder[1===n?"next":"prev"]()[0]!==a&&!e.contains(this.placeholder[0],a)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],a):!0)){if(this.direction=1===n?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,a=this.placeholder.offset(),n=this.options.axis,r={};n&&"x"!==n||(r.left=a.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),n&&"y"!==n||(r.top=a.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(r,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,a=s+this.helperProportions.height,n=e.left,r=n+e.width,o=e.top,h=o+e.height,l=this.offset.click.top,u=this.offset.click.left,c="x"===this.options.axis||s+l>o&&h>s+l,d="y"===this.options.axis||t+u>n&&r>t+u,p=c&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>n&&r>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>o&&h>a-this.helperProportions.height/2},_intersectsWithPointer:function(e){var i="x"===this.options.axis||t(this.positionAbs.top+this.offset.click.top,e.top,e.height),s="y"===this.options.axis||t(this.positionAbs.left+this.offset.click.left,e.left,e.width),a=i&&s,n=this._getDragVerticalDirection(),r=this._getDragHorizontalDirection();return a?this.floating?r&&"right"===r||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var i=t(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),s=t(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),a=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&s||"left"===n&&!s:a&&("down"===a&&i||"up"===a&&!i)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){var i,s,a,n,r=[],o=[],h=this._connectWith();if(h&&t)for(i=h.length-1;i>=0;i--)for(a=e(h[i]),s=a.length-1;s>=0;s--)n=e.data(a[s],this.widgetFullName),n&&n!==this&&!n.options.disabled&&o.push([e.isFunction(n.options.items)?n.options.items.call(n.element):e(n.options.items,n.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),n]);for(o.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=o.length-1;i>=0;i--)o[i][0].each(function(){r.push(this)});return e(r)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,a,n,r,o,h,l,u=this.items,c=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(a=e(d[i]),s=a.length-1;s>=0;s--)n=e.data(a[s],this.widgetFullName),n&&n!==this&&!n.options.disabled&&(c.push([e.isFunction(n.options.items)?n.options.items.call(n.element[0],t,{item:this.currentItem}):e(n.options.items,n.element),n]),this.containers.push(n));for(i=c.length-1;i>=0;i--)for(r=c[i][1],o=c[i][0],s=0,l=o.length;l>s;s++)h=e(o[s]),h.data(this.widgetName+"-item",r),u.push({item:h,instance:r,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,a,n;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(a=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=a.outerWidth(),s.height=a.outerHeight()),n=a.offset(),s.left=n.left,s.top=n.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)n=this.containers[i].element.offset(),this.containers[i].containerCache.left=n.left,this.containers[i].containerCache.top=n.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),a=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?t.currentItem.children().each(function(){e("<td>&#160;</td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(a)}):"img"===s&&a.attr("src",t.currentItem.attr("src")),i||a.css("visibility","hidden"),a},update:function(e,a){(!i||s.forcePlaceholderSize)&&(a.height()||a.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),a.width()||a.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_contactContainers:function(s){var a,n,r,o,h,l,u,c,d,p,f=null,m=null;for(a=this.containers.length-1;a>=0;a--)if(!e.contains(this.currentItem[0],this.containers[a].element[0]))if(this._intersectsWith(this.containers[a].containerCache)){if(f&&e.contains(this.containers[a].element[0],f.element[0]))continue;f=this.containers[a],m=a}else this.containers[a].containerCache.over&&(this.containers[a]._trigger("out",s,this._uiHash(this)),this.containers[a].containerCache.over=0);if(f)if(1===this.containers.length)this.containers[m].containerCache.over||(this.containers[m]._trigger("over",s,this._uiHash(this)),this.containers[m].containerCache.over=1);else{for(r=1e4,o=null,p=f.floating||i(this.currentItem),h=p?"left":"top",l=p?"width":"height",u=this.positionAbs[h]+this.offset.click[h],n=this.items.length-1;n>=0;n--)e.contains(this.containers[m].element[0],this.items[n].item[0])&&this.items[n].item[0]!==this.currentItem[0]&&(!p||t(this.positionAbs.top+this.offset.click.top,this.items[n].top,this.items[n].height))&&(c=this.items[n].item.offset()[h],d=!1,Math.abs(c-u)>Math.abs(c+this.items[n][l]-u)&&(d=!0,c+=this.items[n][l]),r>Math.abs(c-u)&&(r=Math.abs(c-u),o=this.items[n],this.direction=d?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[m])return;o?this._rearrange(s,o,null,!0):this._rearrange(s,null,this.containers[m].element,!0),this._trigger("change",s,this._uiHash()),this.containers[m]._trigger("change",s,this._uiHash(this)),this.currentContainer=this.containers[m],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[m]._trigger("over",s,this._uiHash(this)),this.containers[m].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,a=this.options;"parent"===a.containment&&(a.containment=this.helper[0].parentNode),("document"===a.containment||"window"===a.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===a.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===a.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(a.containment)||(t=e(a.containment)[0],i=e(a.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,a="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,n=/(html|body)/i.test(a[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():n?0:a.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():n?0:a.scrollLeft())*s}},_generatePosition:function(t){var i,s,a=this.options,n=t.pageX,r=t.pageY,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(o[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(n=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(r=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(n=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(r=this.containment[3]+this.offset.click.top)),a.grid&&(i=this.originalPageY+Math.round((r-this.originalPageY)/a.grid[1])*a.grid[1],r=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-a.grid[1]:i+a.grid[1]:i,s=this.originalPageX+Math.round((n-this.originalPageX)/a.grid[0])*a.grid[0],n=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-a.grid[0]:s+a.grid[0]:s)),{top:r-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:o.scrollTop()),left:n-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:o.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var a=this.counter;this._delay(function(){a===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&s.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||s.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(s.push(function(e){this._trigger("remove",e,this._uiHash())}),s.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)t||s.push(function(e){return function(t){e._trigger("deactivate",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(function(e){return function(t){e._trigger("out",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!t){for(this._trigger("beforeStop",e,this._uiHash()),i=0;s.length>i;i++)s[i].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!1}if(t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!t){for(i=0;s.length>i;i++)s[i].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}})})(jQuery);(function(e){var t=0,i={},a={};i.height=i.paddingTop=i.paddingBottom=i.borderTopWidth=i.borderBottomWidth="hide",a.height=a.paddingTop=a.paddingBottom=a.borderTopWidth=a.borderBottomWidth="show",e.widget("ui.accordion",{version:"1.10.3",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e(),content:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),e=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),undefined):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t),undefined)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,a=this.headers.length,s=this.headers.index(t.target),n=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:n=this.headers[(s+1)%a];break;case i.LEFT:case i.UP:n=this.headers[(s-1+a)%a];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:n=this.headers[0];break;case i.END:n=this.headers[a-1]}n&&(e(t.target).attr("tabIndex",-1),e(n).attr("tabIndex",0),n.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var i,a=this.options,s=a.heightStyle,n=this.element.parent(),r=this.accordionId="ui-accordion-"+(this.element.attr("id")||++t);this.active=this._findActive(a.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(t){var i=e(this),a=i.attr("id"),s=i.next(),n=s.attr("id");a||(a=r+"-header-"+t,i.attr("id",a)),n||(n=r+"-panel-"+t,s.attr("id",n)),i.attr("aria-controls",n),s.attr("aria-labelledby",a)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(a.event),"fill"===s?(i=n.height(),this.element.siblings(":visible").each(function(){var t=e(this),a=t.css("position");"absolute"!==a&&"fixed"!==a&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(i=0,this.headers.next().each(function(){i=Math.max(i,e(this).css("height","").height())}).height(i))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,a=this.active,s=e(t.currentTarget),n=s[0]===a[0],r=n&&i.collapsible,o=r?e():s.next(),h=a.next(),l={oldHeader:a,oldPanel:h,newHeader:r?e():s,newPanel:o};t.preventDefault(),n&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=r?!1:this.headers.index(s),this.active=n?e():s,this._toggle(l),a.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&a.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),n||(s.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),s.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,a=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=a,this.options.animate?this._animate(i,a,t):(a.hide(),i.show(),this._toggleComplete(t)),a.attr({"aria-expanded":"false","aria-hidden":"true"}),a.prev().attr("aria-selected","false"),i.length&&a.length?a.prev().attr("tabIndex",-1):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(e,t,s){var n,r,o,h=this,l=0,u=e.length&&(!t.length||e.index()<t.index()),d=this.options.animate||{},c=u&&d.down||d,p=function(){h._toggleComplete(s)};return"number"==typeof c&&(o=c),"string"==typeof c&&(r=c),r=r||c.easing||d.easing,o=o||c.duration||d.duration,t.length?e.length?(n=e.show().outerHeight(),t.animate(i,{duration:o,easing:r,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(a,{duration:o,easing:r,complete:p,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?l+=i.now:"content"!==h.options.heightStyle&&(i.now=Math.round(n-t.outerHeight()-l),l=0)}}),undefined):t.animate(i,o,r,p):e.animate(a,o,r,p)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}})})(jQuery);(function(e){var t=0;e.widget("ui.autocomplete",{version:"1.10.3",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,i,a,s=this.element[0].nodeName.toLowerCase(),n="textarea"===s,r="input"===s;this.isMultiLine=n?!0:r?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[n||r?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(s){if(this.element.prop("readOnly"))return t=!0,a=!0,i=!0,undefined;t=!1,a=!1,i=!1;var n=e.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:t=!0,this._move("previousPage",s);break;case n.PAGE_DOWN:t=!0,this._move("nextPage",s);break;case n.UP:t=!0,this._keyEvent("previous",s);break;case n.DOWN:t=!0,this._keyEvent("next",s);break;case n.ENTER:case n.NUMPAD_ENTER:this.menu.active&&(t=!0,s.preventDefault(),this.menu.select(s));break;case n.TAB:this.menu.active&&this.menu.select(s);break;case n.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(s),s.preventDefault());break;default:i=!0,this._searchTimeout(s)}},keypress:function(a){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&a.preventDefault(),undefined;if(!i){var s=e.ui.keyCode;switch(a.keyCode){case s.PAGE_UP:this._move("previousPage",a);break;case s.PAGE_DOWN:this._move("nextPage",a);break;case s.UP:this._keyEvent("previous",a);break;case s.DOWN:this._keyEvent("next",a)}}},input:function(e){return a?(a=!1,e.preventDefault(),undefined):(this._searchTimeout(e),undefined)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,undefined):(clearTimeout(this.searching),this.close(e),this._change(e),undefined)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().data("ui-menu"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(a){a.target===t.element[0]||a.target===i||e.contains(i,a.target)||t.close()})})},menufocus:function(t,i){if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),undefined;var a=i.item.data("ui-autocomplete-item");!1!==this._trigger("focus",t,{item:a})?t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(a.value):this.liveRegion.text(a.value)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),a=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=a,this._delay(function(){this.previous=a,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertBefore(this.element),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,a=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,a){a(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,s){a.xhr&&a.xhr.abort(),a.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){s(e)},error:function(){s([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):undefined},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var e=this,i=++t;return function(a){i===t&&e.__response(a),e.pending--,e.pending||e.element.removeClass("ui-autocomplete-loading")}},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({label:t.label||t.value,value:t.value||t.label},t)})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var a=this;e.each(i,function(e,i){a._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").append(e("<a>").text(i.label)).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this._value(this.term),this.menu.blur(),undefined):(this.menu[e](t),undefined):(this.search(null,t),undefined)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var a=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return a.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var t;this._superApply(arguments),this.options.disabled||this.cancelSearch||(t=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.text(t))}})})(jQuery);(function(e){var t,i,a,s,n="ui-button ui-widget ui-state-default ui-corner-all",r="ui-state-hover ui-state-active ",o="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",h=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},l=function(t){var i=t.name,a=t.form,s=e([]);return i&&(i=i.replace(/'/g,"\\'"),s=a?e(a).find("[name='"+i+"']"):e("[name='"+i+"']",t.ownerDocument).filter(function(){return!this.form})),s};e.widget("ui.button",{version:"1.10.3",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,h),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var r=this,o=this.options,u="checkbox"===this.type||"radio"===this.type,d=u?"":"ui-state-active",c="ui-state-focus";null===o.label&&(o.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(n).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){o.disabled||this===t&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){o.disabled||e(this).removeClass(d)}).bind("click"+this.eventNamespace,function(e){o.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this.element.bind("focus"+this.eventNamespace,function(){r.buttonElement.addClass(c)}).bind("blur"+this.eventNamespace,function(){r.buttonElement.removeClass(c)}),u&&(this.element.bind("change"+this.eventNamespace,function(){s||r.refresh()}),this.buttonElement.bind("mousedown"+this.eventNamespace,function(e){o.disabled||(s=!1,i=e.pageX,a=e.pageY)}).bind("mouseup"+this.eventNamespace,function(e){o.disabled||(i!==e.pageX||a!==e.pageY)&&(s=!0)})),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return o.disabled||s?!1:undefined}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(o.disabled||s)return!1;e(this).addClass("ui-state-active"),r.buttonElement.attr("aria-pressed","true");var t=r.element[0];l(t).not(t).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return o.disabled?!1:(e(this).addClass("ui-state-active"),t=this,r.document.one("mouseup",function(){t=null}),undefined)}).bind("mouseup"+this.eventNamespace,function(){return o.disabled?!1:(e(this).removeClass("ui-state-active"),undefined)}).bind("keydown"+this.eventNamespace,function(t){return o.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),undefined)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",o.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(n+" "+r+" "+o).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(t?this.element.prop("disabled",!0):this.element.prop("disabled",!1),undefined):(this._resetButton(),undefined)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?l(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),undefined;var t=this.buttonElement.removeClass(o),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),a=this.options.icons,s=a.primary&&a.secondary,n=[];a.primary||a.secondary?(this.options.text&&n.push("ui-button-text-icon"+(s?"s":a.primary?"-primary":"-secondary")),a.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+a.primary+"'></span>"),a.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+a.secondary+"'></span>"),this.options.text||(n.push(s?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):n.push("ui-button-text-only"),t.addClass(n.join(" "))}}),e.widget("ui.buttonset",{version:"1.10.3",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})})(jQuery);(function(e,t){function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){e.datepicker._isDisabledDatepicker(n.inline?t.parent()[0]:n.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))})}function s(t,i){e.extend(t,i);for(var a in i)null==i[a]&&(t[a]=i[a]);return t}e.extend(e.ui,{datepicker:{version:"1.10.3"}});var n,r="datepicker";e.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return s(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var a,s,n;a=t.nodeName.toLowerCase(),s="div"===a||"span"===a,t.id||(this.uuid+=1,t.id="dp"+this.uuid),n=this._newInst(e(t),s),n.settings=e.extend({},i||{}),"input"===a?this._connectDatepicker(t,n):s&&this._inlineDatepicker(t,n)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?a(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var a=e(t);i.append=e([]),i.trigger=e([]),a.hasClass(this.markerClassName)||(this._attachments(a,i),a.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,r,i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var a,s,n,r=this._get(i,"appendText"),o=this._get(i,"isRTL");i.append&&i.append.remove(),r&&(i.append=e("<span class='"+this._appendClass+"'>"+r+"</span>"),t[o?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),a=this._get(i,"showOn"),("focus"===a||"both"===a)&&t.focus(this._showDatepicker),("button"===a||"both"===a)&&(s=this._get(i,"buttonText"),n=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:n,alt:s,title:s}):e("<button type='button'></button>").addClass(this._triggerClass).html(n?e("<img/>").attr({src:n,alt:s,title:s}):s)),t[o?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,a,s,n=new Date(2009,11,20),r=this._get(e,"dateFormat");r.match(/[DM]/)&&(t=function(e){for(i=0,a=0,s=0;e.length>s;s++)e[s].length>i&&(i=e[s].length,a=s);return a},n.setMonth(t(this._get(e,r.match(/MM/)?"monthNames":"monthNamesShort"))),n.setDate(t(this._get(e,r.match(/DD/)?"dayNames":"dayNamesShort"))+20-n.getDay())),e.input.attr("size",this._formatDate(e,n).length)}},_inlineDatepicker:function(t,i){var a=e(t);a.hasClass(this.markerClassName)||(a.addClass(this.markerClassName).append(i.dpDiv),e.data(t,r,i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,a,n,o){var h,l,u,d,c,p=this._dialogInst;return p||(this.uuid+=1,h="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+h+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},e.data(this._dialogInput[0],r,p)),s(p.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(l=document.documentElement.clientWidth,u=document.documentElement.clientHeight,d=document.documentElement.scrollLeft||document.body.scrollLeft,c=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[l/2-100+d,u/2-150+c]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=a,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],r,p),this},_destroyDatepicker:function(t){var i,a=e(t),s=e.data(t,r);a.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,r),"input"===i?(s.append.remove(),s.trigger.remove(),a.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&a.removeClass(this.markerClassName).empty())},_enableDatepicker:function(t){var i,a,s=e(t),n=e.data(t,r);s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,n.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(a=s.children("."+this._inlineClass),a.children().removeClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,a,s=e(t),n=e.data(t,r);s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,n.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(a=s.children("."+this._inlineClass),a.children().addClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,r)}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(i,a,n){var r,o,h,l,u=this._getInst(i);return 2===arguments.length&&"string"==typeof a?"defaults"===a?e.extend({},e.datepicker._defaults):u?"all"===a?e.extend({},u.settings):this._get(u,a):null:(r=a||{},"string"==typeof a&&(r={},r[a]=n),u&&(this._curInst===u&&this._hideDatepicker(),o=this._getDateDatepicker(i,!0),h=this._getMinMaxDate(u,"min"),l=this._getMinMaxDate(u,"max"),s(u.settings,r),null!==h&&r.dateFormat!==t&&r.minDate===t&&(u.settings.minDate=this._formatDate(u,h)),null!==l&&r.dateFormat!==t&&r.maxDate===t&&(u.settings.maxDate=this._formatDate(u,l)),"disabled"in r&&(r.disabled?this._disableDatepicker(i):this._enableDatepicker(i)),this._attachments(e(i),u),this._autoSize(u),this._setDate(u,o),this._updateAlternate(u),this._updateDatepicker(u)),t)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,a,s,n=e.datepicker._getInst(t.target),r=!0,o=n.dpDiv.is(".ui-datepicker-rtl");if(n._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),r=!1;break;case 13:return s=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",n.dpDiv),s[0]&&e.datepicker._selectDay(t.target,n.selectedMonth,n.selectedYear,s[0]),i=e.datepicker._get(n,"onSelect"),i?(a=e.datepicker._formatDate(n),i.apply(n.input?n.input[0]:null,[a,n])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(n,"stepBigMonths"):-e.datepicker._get(n,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(n,"stepBigMonths"):+e.datepicker._get(n,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),r=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),r=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,o?1:-1,"D"),r=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(n,"stepBigMonths"):-e.datepicker._get(n,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),r=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,o?-1:1,"D"),r=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(n,"stepBigMonths"):+e.datepicker._get(n,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),r=t.ctrlKey||t.metaKey;break;default:r=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):r=!1;r&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(i){var a,s,n=e.datepicker._getInst(i.target);return e.datepicker._get(n,"constrainInput")?(a=e.datepicker._possibleChars(e.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==i.charCode?i.keyCode:i.charCode),i.ctrlKey||i.metaKey||" ">s||!a||a.indexOf(s)>-1):t},_doKeyUp:function(t){var i,a=e.datepicker._getInst(t.target);if(a.input.val()!==a.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,e.datepicker._getFormatConfig(a)),i&&(e.datepicker._setDateFromField(a),e.datepicker._updateAlternate(a),e.datepicker._updateDatepicker(a))}catch(s){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,a,n,r,o,h,l;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),a=e.datepicker._get(i,"beforeShow"),n=a?a.apply(t,[t,i]):{},n!==!1&&(s(i.settings,n),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),r=!1,e(t).parents().each(function(){return r|="fixed"===e(this).css("position"),!r}),o={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),o=e.datepicker._checkOffset(i,o,r),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":r?"fixed":"absolute",display:"none",left:o.left+"px",top:o.top+"px"}),i.inline||(h=e.datepicker._get(i,"showAnim"),l=e.datepicker._get(i,"duration"),i.dpDiv.zIndex(e(t).zIndex()+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[h]?i.dpDiv.show(h,e.datepicker._get(i,"showOptions"),l):i.dpDiv[h||"show"](h?l:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,n=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t),t.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i,a=this._getNumberOfMonths(t),s=a[1],r=17;t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),s>1&&t.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",r*s+"em"),t.dpDiv[(1!==a[0]||1!==a[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,a){var s=t.dpDiv.outerWidth(),n=t.dpDiv.outerHeight(),r=t.input?t.input.outerWidth():0,o=t.input?t.input.outerHeight():0,h=document.documentElement.clientWidth+(a?0:e(document).scrollLeft()),l=document.documentElement.clientHeight+(a?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?s-r:0,i.left-=a&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=a&&i.top===t.input.offset().top+o?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+s>h&&h>s?Math.abs(i.left+s-h):0),i.top-=Math.min(i.top,i.top+n>l&&l>n?Math.abs(n+o):0),i},_findPos:function(t){for(var i,a=this._getInst(t),s=this._get(a,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[s?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,a,s,n,o=this._curInst;!o||t&&o!==e.data(t,r)||this._datepickerShowing&&(i=this._get(o,"showAnim"),a=this._get(o,"duration"),s=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[i]||e.effects[i])?o.dpDiv.hide(i,e.datepicker._get(o,"showOptions"),a,s):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?a:null,s),i||s(),this._datepickerShowing=!1,n=this._get(o,"onClose"),n&&n.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),a=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==a)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,a){var s=e(t),n=this._getInst(s[0]);this._isDisabledDatepicker(s[0])||(this._adjustInstDate(n,i+("M"===a?this._get(n,"showCurrentAtPos"):0),a),this._updateDatepicker(n))},_gotoToday:function(t){var i,a=e(t),s=this._getInst(a[0]);this._get(s,"gotoCurrent")&&s.currentDay?(s.selectedDay=s.currentDay,s.drawMonth=s.selectedMonth=s.currentMonth,s.drawYear=s.selectedYear=s.currentYear):(i=new Date,s.selectedDay=i.getDate(),s.drawMonth=s.selectedMonth=i.getMonth(),s.drawYear=s.selectedYear=i.getFullYear()),this._notifyChange(s),this._adjustDate(a)},_selectMonthYear:function(t,i,a){var s=e(t),n=this._getInst(s[0]);n["selected"+("M"===a?"Month":"Year")]=n["draw"+("M"===a?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(n),this._adjustDate(s)},_selectDay:function(t,i,a,s){var n,r=e(t);e(s).hasClass(this._unselectableClass)||this._isDisabledDatepicker(r[0])||(n=this._getInst(r[0]),n.selectedDay=n.currentDay=e("a",s).html(),n.selectedMonth=n.currentMonth=i,n.selectedYear=n.currentYear=a,this._selectDate(t,this._formatDate(n,n.currentDay,n.currentMonth,n.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var a,s=e(t),n=this._getInst(s[0]);i=null!=i?i:this._formatDate(n),n.input&&n.input.val(i),this._updateAlternate(n),a=this._get(n,"onSelect"),a?a.apply(n.input?n.input[0]:null,[i,n]):n.input&&n.input.trigger("change"),n.inline?this._updateDatepicker(n):(this._hideDatepicker(),this._lastInput=n.input[0],"object"!=typeof n.input[0]&&n.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,a,s,n=this._get(t,"altField");n&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),a=this._getDate(t),s=this.formatDate(i,a,this._getFormatConfig(t)),e(n).each(function(){e(this).val(s)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(i,a,s){if(null==i||null==a)throw"Invalid arguments";if(a="object"==typeof a?""+a:a+"",""===a)return null;var n,r,o,h,l=0,u=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,d="string"!=typeof u?u:(new Date).getFullYear()%100+parseInt(u,10),c=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,p=(s?s.dayNames:null)||this._defaults.dayNames,m=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,v=-1,y=-1,b=-1,_=!1,k=function(e){var t=i.length>n+1&&i.charAt(n+1)===e;return t&&n++,t},x=function(e){var t=k(e),i="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,s=RegExp("^\\d{1,"+i+"}"),n=a.substring(l).match(s);if(!n)throw"Missing number at position "+l;return l+=n[0].length,parseInt(n[0],10)},D=function(i,s,n){var r=-1,o=e.map(k(i)?n:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,i){var s=i[1];return a.substr(l,s.length).toLowerCase()===s.toLowerCase()?(r=i[0],l+=s.length,!1):t}),-1!==r)return r+1;throw"Unknown name at position "+l},w=function(){if(a.charAt(l)!==i.charAt(n))throw"Unexpected literal at position "+l;l++};for(n=0;i.length>n;n++)if(_)"'"!==i.charAt(n)||k("'")?w():_=!1;else switch(i.charAt(n)){case"d":y=x("d");break;case"D":D("D",c,p);break;case"o":b=x("o");break;case"m":v=x("m");break;case"M":v=D("M",m,f);break;case"y":g=x("y");break;case"@":h=new Date(x("@")),g=h.getFullYear(),v=h.getMonth()+1,y=h.getDate();break;case"!":h=new Date((x("!")-this._ticksTo1970)/1e4),g=h.getFullYear(),v=h.getMonth()+1,y=h.getDate();break;case"'":k("'")?w():_=!0;break;default:w()}if(a.length>l&&(o=a.substr(l),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(d>=g?0:-100)),b>-1)for(v=1,y=b;;){if(r=this._getDaysInMonth(g,v-1),r>=y)break;v++,y-=r}if(h=this._daylightSavingAdjust(new Date(g,v-1,y)),h.getFullYear()!==g||h.getMonth()+1!==v||h.getDate()!==y)throw"Invalid date";return h},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var a,s=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,n=(i?i.dayNames:null)||this._defaults.dayNames,r=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,o=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>a+1&&e.charAt(a+1)===t;return i&&a++,i},l=function(e,t,i){var a=""+t;if(h(e))for(;i>a.length;)a="0"+a;return a},u=function(e,t,i,a){return h(e)?a[t]:i[t]},d="",c=!1;if(t)for(a=0;e.length>a;a++)if(c)"'"!==e.charAt(a)||h("'")?d+=e.charAt(a):c=!1;else switch(e.charAt(a)){case"d":d+=l("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),s,n);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=l("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),r,o);break;case"y":d+=h("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(a)}return d},_possibleChars:function(e){var t,i="",a=!1,s=function(i){var a=e.length>t+1&&e.charAt(t+1)===i;return a&&t++,a};for(t=0;e.length>t;t++)if(a)"'"!==e.charAt(t)||s("'")?i+=e.charAt(t):a=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":s("'")?i+="'":a=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,i){return e.settings[i]!==t?e.settings[i]:this._defaults[i]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),a=e.lastVal=e.input?e.input.val():null,s=this._getDefaultDate(e),n=s,r=this._getFormatConfig(e);try{n=this.parseDate(i,a,r)||s}catch(o){a=t?"":a}e.selectedDay=n.getDate(),e.drawMonth=e.selectedMonth=n.getMonth(),e.drawYear=e.selectedYear=n.getFullYear(),e.currentDay=a?n.getDate():0,e.currentMonth=a?n.getMonth():0,e.currentYear=a?n.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,a){var s=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},n=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(a){}for(var s=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,n=s.getFullYear(),r=s.getMonth(),o=s.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":o+=parseInt(l[1],10);break;case"w":case"W":o+=7*parseInt(l[1],10);break;case"m":case"M":r+=parseInt(l[1],10),o=Math.min(o,e.datepicker._getDaysInMonth(n,r));break;case"y":case"Y":n+=parseInt(l[1],10),o=Math.min(o,e.datepicker._getDaysInMonth(n,r))}l=h.exec(i)}return new Date(n,r,o)},r=null==i||""===i?a:"string"==typeof i?n(i):"number"==typeof i?isNaN(i)?a:s(i):new Date(i.getTime());return r=r&&"Invalid Date"==""+r?a:r,r&&(r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0)),this._daylightSavingAdjust(r)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var a=!t,s=e.selectedMonth,n=e.selectedYear,r=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=r.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=r.getMonth(),e.drawYear=e.selectedYear=e.currentYear=r.getFullYear(),s===e.selectedMonth&&n===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(a?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),a="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(a,-i,"M")},next:function(){e.datepicker._adjustDate(a,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(a)},selectDay:function(){return e.datepicker._selectDay(a,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(a,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(a,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,a,s,n,r,o,h,l,u,d,c,p,m,f,g,v,y,b,_,k,x,D,w,T,M,S,N,C,A,P,I,F,j,H,E,z,L,O,R=new Date,W=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),Y=this._get(e,"isRTL"),J=this._get(e,"showButtonPanel"),$=this._get(e,"hideIfNoPrevNext"),Q=this._get(e,"navigationAsDateFormat"),B=this._getNumberOfMonths(e),K=this._get(e,"showCurrentAtPos"),V=this._get(e,"stepMonths"),U=1!==B[0]||1!==B[1],G=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),q=this._getMinMaxDate(e,"min"),X=this._getMinMaxDate(e,"max"),Z=e.drawMonth-K,et=e.drawYear;if(0>Z&&(Z+=12,et--),X)for(t=this._daylightSavingAdjust(new Date(X.getFullYear(),X.getMonth()-B[0]*B[1]+1,X.getDate())),t=q&&q>t?q:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=Q?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-V,1)),this._getFormatConfig(e)):i,a=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":$?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",s=this._get(e,"nextText"),s=Q?this.formatDate(s,this._daylightSavingAdjust(new Date(et,Z+V,1)),this._getFormatConfig(e)):s,n=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+s+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+s+"</span></a>":$?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+s+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+s+"</span></a>",r=this._get(e,"currentText"),o=this._get(e,"gotoCurrent")&&e.currentDay?G:W,r=Q?this.formatDate(r,o,this._getFormatConfig(e)):r,h=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",l=J?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(e,o)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+r+"</button>":"")+(Y?"":h)+"</div>":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),m=this._get(e,"monthNames"),f=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",x=0;B[0]>x;x++){for(D="",this.maxRows=4,w=0;B[1]>w;w++){if(T=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),M=" ui-corner-all",S="",U){if(S+="<div class='ui-datepicker-group",B[1]>1)switch(w){case 0:S+=" ui-datepicker-group-first",M=" ui-corner-"+(Y?"right":"left");break;case B[1]-1:S+=" ui-datepicker-group-last",M=" ui-corner-"+(Y?"left":"right");break;default:S+=" ui-datepicker-group-middle",M=""}S+="'>"}for(S+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+M+"'>"+(/all|left/.test(M)&&0===x?Y?n:a:"")+(/all|right/.test(M)&&0===x?Y?a:n:"")+this._generateMonthYearHeader(e,Z,et,q,X,x>0||w>0,m,f)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",N=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",k=0;7>k;k++)C=(k+u)%7,N+="<th"+((k+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+c[C]+"'>"+p[C]+"</span></th>";for(S+=N+"</tr></thead><tbody>",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),P=(this._getFirstDayOfMonth(et,Z)-u+7)%7,I=Math.ceil((P+A)/7),F=U?this.maxRows>I?this.maxRows:I:I,this.maxRows=F,j=this._daylightSavingAdjust(new Date(et,Z,1-P)),H=0;F>H;H++){for(S+="<tr>",E=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(j)+"</td>":"",k=0;7>k;k++)z=g?g.apply(e.input?e.input[0]:null,[j]):[!0,""],L=j.getMonth()!==Z,O=L&&!y||!z[0]||q&&q>j||X&&j>X,E+="<td class='"+((k+u+6)%7>=5?" ui-datepicker-week-end":"")+(L?" ui-datepicker-other-month":"")+(j.getTime()===T.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===j.getTime()&&b.getTime()===T.getTime()?" "+this._dayOverClass:"")+(O?" "+this._unselectableClass+" ui-state-disabled":"")+(L&&!v?"":" "+z[1]+(j.getTime()===G.getTime()?" "+this._currentClass:"")+(j.getTime()===W.getTime()?" ui-datepicker-today":""))+"'"+(L&&!v||!z[2]?"":" title='"+z[2].replace(/'/g,"&#39;")+"'")+(O?"":" data-handler='selectDay' data-event='click' data-month='"+j.getMonth()+"' data-year='"+j.getFullYear()+"'")+">"+(L&&!v?"&#xa0;":O?"<span class='ui-state-default'>"+j.getDate()+"</span>":"<a class='ui-state-default"+(j.getTime()===W.getTime()?" ui-state-highlight":"")+(j.getTime()===G.getTime()?" ui-state-active":"")+(L?" ui-priority-secondary":"")+"' href='#'>"+j.getDate()+"</a>")+"</td>",j.setDate(j.getDate()+1),j=this._daylightSavingAdjust(j);S+=E+"</tr>"}Z++,Z>11&&(Z=0,et++),S+="</tbody></table>"+(U?"</div>"+(B[0]>0&&w===B[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),D+=S}_+=D}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,a,s,n,r,o){var h,l,u,d,c,p,m,f,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",_="";if(n||!g)_+="<span class='ui-datepicker-month'>"+r[t]+"</span>";else{for(h=a&&a.getFullYear()===i,l=s&&s.getFullYear()===i,_+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!h||u>=a.getMonth())&&(!l||s.getMonth()>=u)&&(_+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+o[u]+"</option>");_+="</select>"}if(y||(b+=_+(!n&&g&&v?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",n||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);
7
+ return isNaN(t)?c:t},m=p(d[0]),f=Math.max(m,p(d[1]||"")),m=a?Math.max(m,a.getFullYear()):m,f=s?Math.min(f,s.getFullYear()):f,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";f>=m;m++)e.yearshtml+="<option value='"+m+"'"+(m===i?" selected='selected'":"")+">"+m+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!n&&g&&v?"":"&#xa0;")+_),b+="</div>"},_adjustInstDate:function(e,t,i){var a=e.drawYear+("Y"===i?t:0),s=e.drawMonth+("M"===i?t:0),n=Math.min(e.selectedDay,this._getDaysInMonth(a,s))+("D"===i?t:0),r=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(a,s,n)));e.selectedDay=r.getDate(),e.drawMonth=e.selectedMonth=r.getMonth(),e.drawYear=e.selectedYear=r.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),s=i&&i>t?i:t;return a&&s>a?a:s},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,a){var s=this._getNumberOfMonths(e),n=this._daylightSavingAdjust(new Date(i,a+(0>t?t:s[0]*s[1]),1));return 0>t&&n.setDate(this._getDaysInMonth(n.getFullYear(),n.getMonth())),this._isInRange(e,n)},_isInRange:function(e,t){var i,a,s=this._getMinMaxDate(e,"min"),n=this._getMinMaxDate(e,"max"),r=null,o=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),a=(new Date).getFullYear(),r=parseInt(i[0],10),o=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(r+=a),i[1].match(/[+\-].*/)&&(o+=a)),(!s||t.getTime()>=s.getTime())&&(!n||t.getTime()<=n.getTime())&&(!r||t.getFullYear()>=r)&&(!o||o>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,a){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var s=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(a,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),s,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new i,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.10.3"})(jQuery);(function(e){var t={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},i={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};e.widget("ui.dialog",{version:"1.10.3",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i=this;this._isOpen&&this._trigger("beforeClose",t)!==!1&&(this._isOpen=!1,this._destroyOverlay(),this.opener.filter(":focusable").focus().length||e(this.document[0].activeElement).blur(),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",t)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,t){var i=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;return i&&!t&&this._trigger("focus",e),i},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),undefined):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._trigger("open"),undefined)},_focusTabbable:function(){var e=this.element.find("[autofocus]");e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),undefined;if(t.keyCode===e.ui.keyCode.TAB){var i=this.uiDialog.find(":tabbable"),a=i.filter(":first"),s=i.filter(":last");t.target!==s[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==a[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(s.focus(1),t.preventDefault()):(a.focus(1),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),undefined):(e.each(i,function(i,a){var s,n;a=e.isFunction(a)?{click:a,text:i}:a,a=e.extend({type:"button"},a),s=a.click,a.click=function(){s.apply(t.element[0],arguments)},n={icons:a.icons,text:a.showText},delete a.icons,delete a.showText,e("<button></button>",a).button(n).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),undefined)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,a=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(a,s){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",a,t(s))},drag:function(e,a){i._trigger("drag",e,t(a))},stop:function(s,n){a.position=[n.position.left-i.document.scrollLeft(),n.position.top-i.document.scrollTop()],e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",s,t(n))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,a=this.options,s=a.resizable,n=this.uiDialog.css("position"),r="string"==typeof s?s:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:a.maxWidth,maxHeight:a.maxHeight,minWidth:a.minWidth,minHeight:this._minHeight(),handles:r,start:function(a,s){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",a,t(s))},resize:function(e,a){i._trigger("resize",e,t(a))},stop:function(s,n){a.height=e(this).height(),a.width=e(this).width(),e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",s,t(n))}}).css("position",n)},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(a){var s=this,n=!1,r={};e.each(a,function(e,a){s._setOption(e,a),e in t&&(n=!0),e in i&&(r[e]=a)}),n&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",r)},_setOption:function(e,t){var i,a,s=this.uiDialog;"dialogClass"===e&&s.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=s.is(":data(ui-draggable)"),i&&!t&&s.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(a=s.is(":data(ui-resizable)"),a&&!t&&s.resizable("destroy"),a&&"string"==typeof t&&s.resizable("option","handles",t),a||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,a=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),a.minWidth>a.width&&(a.width=a.minWidth),e=this.uiDialog.css({height:"auto",width:a.width}).outerHeight(),t=Math.max(0,a.minHeight-e),i="number"==typeof a.maxHeight?Math.max(0,a.maxHeight-e):"none","auto"===a.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,a.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=this,i=this.widgetFullName;e.ui.dialog.overlayInstances||this._delay(function(){e.ui.dialog.overlayInstances&&this.document.bind("focusin.dialog",function(a){t._allowInteraction(a)||(a.preventDefault(),e(".ui-dialog:visible:last .ui-dialog-content").data(i)._focusTabbable())})}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),e.ui.dialog.overlayInstances++}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(e.ui.dialog.overlayInstances--,e.ui.dialog.overlayInstances||this.document.unbind("focusin.dialog"),this.overlay.remove(),this.overlay=null)}}),e.ui.dialog.overlayInstances=0,e.uiBackCompat!==!1&&e.widget("ui.dialog",e.ui.dialog,{_position:function(){var t,i=this.options.position,a=[],s=[0,0];i?(("string"==typeof i||"object"==typeof i&&"0"in i)&&(a=i.split?i.split(" "):[i[0],i[1]],1===a.length&&(a[1]=a[0]),e.each(["left","top"],function(e,t){+a[e]===a[e]&&(s[e]=a[e],a[e]=t)}),i={my:a[0]+(0>s[0]?s[0]:"+"+s[0])+" "+a[1]+(0>s[1]?s[1]:"+"+s[1]),at:a.join(" ")}),i=e.extend({},e.ui.dialog.prototype.options.position,i)):i=e.ui.dialog.prototype.options.position,t=this.uiDialog.is(":visible"),t||this.uiDialog.show(),this.uiDialog.position(i),t||this.uiDialog.hide()}})})(jQuery);(function(e){e.widget("ui.menu",{version:"1.10.3",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,e.proxy(function(e){this.options.disabled&&e.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(e){e.preventDefault()},"click .ui-state-disabled > a":function(e){e.preventDefault()},"click .ui-menu-item:has(a)":function(t){var i=e(t.target).closest(".ui-menu-item");!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.mouseHandled=!0,this.select(t),i.has(".ui-menu").length?this.expand(t):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var i=e(t.currentTarget);i.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.children(".ui-menu-item").eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){e(t.target).closest(".ui-menu").length||this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){function i(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var s,a,n,r,o,h=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:h=!1,a=this.previousFilter||"",n=String.fromCharCode(t.keyCode),r=!1,clearTimeout(this.filterTimer),n===a?r=!0:n=a+n,o=RegExp("^"+i(n),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())}),s=r&&-1!==s.index(this.active.next())?this.active.nextAll(".ui-menu-item"):s,s.length||(n=String.fromCharCode(t.keyCode),o=RegExp("^"+i(n),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())})),s.length?(this.focus(t,s),s.length>1?(this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}h&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(e):this.select(e))},refresh:function(){var t,i=this.options.icons.submenu,s=this.element.find(this.options.menus);s.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),s=t.prev("a"),a=e("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);s.attr("aria-haspopup","true").prepend(a),t.attr("aria-labelledby",s.attr("id"))}),t=s.add(this.element),t.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()}),t.children(":not(.ui-menu-item)").each(function(){var t=e(this);/[^\-\u2014\u2013\s]/.test(t.text())||t.addClass("ui-widget-content ui-menu-divider")}),t.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,a,n,r,o;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,a=t.offset().top-this.activeMenu.offset().top-i-s,n=this.activeMenu.scrollTop(),r=this.activeMenu.height(),o=t.height(),0>a?this.activeMenu.scrollTop(n+a):a+o>r&&this.activeMenu.scrollTop(n+a-r+o))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.children(".ui-menu-item")[t]()),this.focus(i,s)},nextPage:function(t){var i,s,a;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,a=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-s-a}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]())),undefined):(this.next(t),undefined)},previousPage:function(t){var i,s,a;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,a=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-s+a>0}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item").first())),undefined):(this.next(t),undefined)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)}})})(jQuery);(function(e,t){e.widget("ui.progressbar",{version:"1.10.3",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return e===t?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),t)},_constrainedValue:function(e){return e===t&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}})})(jQuery);(function(e){var t=5;e.widget("ui.slider",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,s=this.options,a=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),n="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",r=[];for(i=s.values&&s.values.length||1,a.length>i&&(a.slice(i).remove(),a=a.slice(0,i)),t=a.length;i>t;t++)r.push(n);this.handles=a.add(e(r.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):this.range=e([])},_setupEvents:function(){var e=this.handles.add(this.range).filter("a");this._off(e),this._on(e,this._handleEvents),this._hoverable(e),this._focusable(e)},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,s,a,n,r,o,h,l,u=this,c=this.options;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),a=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));(a>i||a===i&&(t===u._lastChangedValue||u.values(t)===c.min))&&(a=i,n=e(this),r=t)}),o=this._start(t,r),o===!1?!1:(this._mouseSliding=!0,this._handleIndex=r,n.addClass("ui-state-active").focus(),h=n.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-n.width()/2,top:t.pageY-h.top-n.height()/2-(parseInt(n.css("borderTopWidth"),10)||0)-(parseInt(n.css("borderBottomWidth"),10)||0)+(parseInt(n.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,r,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,a,n;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),a=this._valueMax()-this._valueMin(),n=this._valueMin()+s*a,this._trimAlignValue(n)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var s,a,n;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(a=this.values(),a[t]=i,n=this._trigger("slide",e,{handle:this.handles[t],value:i,values:a}),s=this.values(t?0:1),n!==!1&&this.values(t,i,!0))):i!==this.value()&&(n=this._trigger("slide",e,{handle:this.handles[t],value:i}),n!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),undefined):this._value()},values:function(t,i){var s,a,n;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),undefined;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(s=this.options.values,a=arguments[0],n=0;s.length>n;n+=1)s[n]=this._trimAlignValue(a[n]),this._change(null,n);this._refreshValue()},_setOption:function(t,i){var s,a=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(a=this.options.values.length),e.Widget.prototype._setOption.apply(this,arguments),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;a>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var t,i,s,a,n,r=this.options.range,o=this.options,h=this,l=this._animateOff?!1:o.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,o.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},o.animate),1===s&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:o.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},o.animate),1===s&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:o.animate}))),t=i}):(s=this.value(),a=this._valueMin(),n=this._valueMax(),i=n!==a?100*((s-a)/(n-a)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,o.animate),"min"===r&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},o.animate),"max"===r&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:o.animate}),"min"===r&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},o.animate),"max"===r&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:o.animate}))},_handleEvents:{keydown:function(i){var s,a,n,r,o=e(i.target).data("ui-slider-handle-index");switch(i.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(i.target).addClass("ui-state-active"),s=this._start(i,o),s===!1))return}switch(r=this.options.step,a=n=this.options.values&&this.options.values.length?this.values(o):this.value(),i.keyCode){case e.ui.keyCode.HOME:n=this._valueMin();break;case e.ui.keyCode.END:n=this._valueMax();break;case e.ui.keyCode.PAGE_UP:n=this._trimAlignValue(a+(this._valueMax()-this._valueMin())/t);break;case e.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(a-(this._valueMax()-this._valueMin())/t);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(a===this._valueMax())return;n=this._trimAlignValue(a+r);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(a===this._valueMin())return;n=this._trimAlignValue(a-r)}this._slide(i,o,n)},click:function(e){e.preventDefault()},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}})})(jQuery);(function(e){function t(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.widget("ui.spinner",{version:"1.10.3",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,s){var a=i.attr(s);void 0!==a&&a.length&&(t[s]=a)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(t?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:t(function(e){this._super(e),this._value(this.element.val())}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:t(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:t(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:t(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:t(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(t(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}})})(jQuery);(function(e,t){function i(){return++a}function s(e){return e.hash.length>1&&decodeURIComponent(e.href.replace(n,""))===decodeURIComponent(location.href.replace(n,""))}var a=0,n=/#.*$/;e.widget("ui.tabs",{version:"1.10.3",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var i=this.options.active,s=this.options.collapsible,a=location.hash.substring(1);return null===i&&(a&&this.tabs.each(function(s,n){return e(n).attr("aria-controls")===a?(i=s,!1):t}),null===i&&(i=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===i||-1===i)&&(i=this.tabs.length?0:!1)),i!==!1&&(i=this.tabs.index(this.tabs.eq(i)),-1===i&&(i=s?!1:0)),!s&&i===!1&&this.anchors.length&&(i=0),i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(i){var s=e(this.document[0].activeElement).closest("li"),a=this.tabs.index(s),n=!0;if(!this._handlePageNav(i)){switch(i.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:a++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:n=!1,a--;break;case e.ui.keyCode.END:a=this.anchors.length-1;break;case e.ui.keyCode.HOME:a=0;break;case e.ui.keyCode.SPACE:return i.preventDefault(),clearTimeout(this.activating),this._activate(a),t;case e.ui.keyCode.ENTER:return i.preventDefault(),clearTimeout(this.activating),this._activate(a===this.options.active?!1:a),t;default:return}i.preventDefault(),clearTimeout(this.activating),a=this._focusNextTab(a,n),i.ctrlKey||(s.attr("aria-selected","false"),this.tabs.eq(a).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",a)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(i){return i.altKey&&i.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):i.altKey&&i.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):t},_findNextTab:function(t,i){function s(){return t>a&&(t=0),0>t&&(t=a),t}for(var a=this.tabs.length-1;-1!==e.inArray(s(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,i){return"active"===e?(this._activate(i),t):"disabled"===e?(this._setupDisabled(i),t):(this._super(e,i),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",i),i||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(i),"heightStyle"===e&&this._setupHeightStyle(i),t)},_tabId:function(e){return e.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,a){var n,r,o,h=e(a).uniqueId().attr("id"),l=e(a).closest("li"),u=l.attr("aria-controls");s(a)?(n=a.hash,r=t.element.find(t._sanitizeSelector(n))):(o=t._tabId(l),n="#"+o,r=t.element.find(n),r.length||(r=t._createPanel(o),r.insertAfter(t.panels[i-1]||t.tablist)),r.attr("aria-live","polite")),r.length&&(t.panels=t.panels.add(r)),u&&l.data("ui-tabs-aria-controls",u),l.attr({"aria-controls":n.substring(1),"aria-labelledby":h}),r.attr("aria-labelledby",h)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={click:function(e){e.preventDefault()}};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,s=this.element.parent();"fill"===t?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,a=e(t.currentTarget),n=a.closest("li"),r=n[0]===s[0],o=r&&i.collapsible,h=o?e():this._getPanelForTab(n),l=s.length?this._getPanelForTab(s):e(),u={oldTab:s,oldPanel:l,newTab:o?e():n,newPanel:h};t.preventDefault(),n.hasClass("ui-state-disabled")||n.hasClass("ui-tabs-loading")||this.running||r&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=o?!1:this.tabs.index(n),this.active=r?e():n,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(n),t),this._toggle(t,u))},_toggle:function(t,i){function s(){n.running=!1,n._trigger("activate",t,i)}function a(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),r.length&&n.options.show?n._show(r,n.options.show,s):(r.show(),s())}var n=this,r=i.newPanel,o=i.oldPanel;this.running=!0,o.length&&this.options.hide?this._hide(o,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),a()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),o.hide(),a()),o.attr({"aria-expanded":"false","aria-hidden":"true"}),i.oldTab.attr("aria-selected","false"),r.length&&o.length?i.oldTab.attr("tabIndex",-1):r.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),r.attr({"aria-expanded":"true","aria-hidden":"false"}),i.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var s=this.options.disabled;s!==!1&&(i===t?s=!1:(i=this._getIndex(i),s=e.isArray(s)?e.map(s,function(e){return e!==i?e:null}):e.map(this.tabs,function(e,t){return t!==i?t:null})),this._setupDisabled(s))},disable:function(i){var s=this.options.disabled;if(s!==!0){if(i===t)s=!0;else{if(i=this._getIndex(i),-1!==e.inArray(i,s))return;s=e.isArray(s)?e.merge([i],s).sort():[i]}this._setupDisabled(s)}},load:function(t,i){t=this._getIndex(t);var a=this,n=this.tabs.eq(t),r=n.find(".ui-tabs-anchor"),o=this._getPanelForTab(n),h={tab:n,panel:o};s(r[0])||(this.xhr=e.ajax(this._ajaxSettings(r,i,h)),this.xhr&&"canceled"!==this.xhr.statusText&&(n.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){o.html(e),a._trigger("load",i,h)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&a.panels.stop(!1,!0),n.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===a.xhr&&delete a.xhr},1)})))},_ajaxSettings:function(t,i,s){var a=this;return{url:t.attr("href"),beforeSend:function(t,n){return a._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:n},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}})})(jQuery);(function(e){function t(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))}function i(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),a=e.inArray(i,s);-1!==a&&s.splice(a,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")}var s=0;e.widget("ui.tooltip",{version:"1.10.3",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,s){var a=e.Event("blur");a.target=a.currentTarget=s[0],t.close(a,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&s.parents().each(function(){var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,a=this,n=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){e.data("ui-tooltip-open")&&a._delay(function(){t&&(t.type=n),this._open(t,e,i)})}),i&&this._open(t,e,i),void 0)},_open:function(i,s,a){function n(e){l.of=e,r.is(":hidden")||r.position(l)}var r,o,h,l=e.extend({},this.options.position);if(a){if(r=this._find(s),r.length)return r.find(".ui-tooltip-content").html(a),void 0;s.is("[title]")&&(i&&"mouseover"===i.type?s.attr("title",""):s.removeAttr("title")),r=this._tooltip(s),t(s,r.attr("id")),r.find(".ui-tooltip-content").html(a),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:n}),n(i)):r.position(e.extend({of:s},this.options.position)),r.hide(),this._show(r,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){r.is(":visible")&&(n(l.of),clearInterval(h))},e.fx.interval)),this._trigger("open",i,{tooltip:r}),o={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var i=e.Event(t);i.currentTarget=s[0],this.close(i,!0)}},remove:function(){this._removeTooltip(r)}},i&&"mouseover"!==i.type||(o.mouseleave="close"),i&&"focusin"!==i.type||(o.focusout="close"),this._on(!0,s,o)}},close:function(t){var s=this,a=e(t?t.currentTarget:this.element),n=this._find(a);this.closing||(clearInterval(this.delayedShow),a.data("ui-tooltip-title")&&a.attr("title",a.data("ui-tooltip-title")),i(a),n.stop(!0),this._hide(n,this.options.hide,function(){s._removeTooltip(e(this))}),a.removeData("ui-tooltip-open"),this._off(a,"mouseleave focusout keyup"),a[0]!==this.element[0]&&this._off(a,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete s.parents[t]}),this.closing=!0,this._trigger("close",t,{tooltip:n}),this.closing=!1)},_tooltip:function(t){var i="ui-tooltip-"+s++,a=e("<div>").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return e("<div>").addClass("ui-tooltip-content").appendTo(a),a.appendTo(this.document[0].body),this.tooltips[i]=t,a},_find:function(t){var i=t.data("ui-tooltip-id");return i?e("#"+i):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,s){var a=e.Event("blur");a.target=a.currentTarget=s[0],t.close(a,!0),e("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))})}})})(jQuery);(function(e,t){var i="ui-effects-";e.effects={effect:{}},function(e,t){function i(e,t,i){var s=c[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),a=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,n){var r,o=n.re.exec(i),h=o&&n.parse(o),l=n.space||"rgba";return h?(r=s[l](h),s[u[l].cache]=r[u[l].cache],a=s._rgba=r._rgba,!1):t}),a.length?("0,0,0,0"===a.join()&&e.extend(a,n.transparent),s):n[i]}function a(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var n,r="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",o=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,a){return new e.Color.fn.parse(t,i,s,a)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},c={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(a,r,o,h){if(a===t)return this._rgba=[null,null,null,null],this;(a.jquery||a.nodeType)&&(a=e(a).css(r),r=t);var c=this,d=e.type(a),p=this._rgba=[];return r!==t&&(a=[a,r,o,h],d="array"),"string"===d?this.parse(s(a)||n._default):"array"===d?(f(u.rgba.props,function(e,t){p[t.idx]=i(a[t.idx],t)}),this):"object"===d?(a instanceof l?f(u,function(e,t){a[t.cache]&&(c[t.cache]=a[t.cache].slice())}):f(u,function(t,s){var n=s.cache;f(s.props,function(e,t){if(!c[n]&&s.to){if("alpha"===e||null==a[e])return;c[n]=s.to(c._rgba)}c[n][t.idx]=i(a[e],t,!0)}),c[n]&&0>e.inArray(null,c[n].slice(0,3))&&(c[n][3]=1,s.from&&(c._rgba=s.from(c[n])))}),this):t},is:function(e){var i=l(e),s=!0,a=this;return f(u,function(e,n){var r,o=i[n.cache];return o&&(r=a[n.cache]||n.to&&n.to(a._rgba)||[],f(n.props,function(e,i){return null!=o[i.idx]?s=o[i.idx]===r[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),a=s._space(),n=u[a],r=0===this.alpha()?l("transparent"):this,o=r[n.cache]||n.to(r._rgba),h=o.slice();return s=s[n.cache],f(n.props,function(e,a){var n=a.idx,r=o[n],l=s[n],u=c[a.type]||{};null!==l&&(null===r?h[n]=l:(u.mod&&(l-r>u.mod/2?r+=u.mod:r-l>u.mod/2&&(r-=u.mod)),h[n]=i((l-r)*t+r,a)))}),this[a](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),a=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*a[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,a=e[1]/255,n=e[2]/255,r=e[3],o=Math.max(s,a,n),h=Math.min(s,a,n),l=o-h,u=o+h,c=.5*u;return t=h===o?0:s===o?60*(a-n)/l+360:a===o?60*(n-s)/l+120:60*(s-a)/l+240,i=0===l?0:.5>=c?l/u:l/(2-u),[Math.round(t)%360,i,c,null==r?1:r]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],n=e[3],r=.5>=s?s*(1+i):s+i-s*i,o=2*s-r;return[Math.round(255*a(o,r,t+1/3)),Math.round(255*a(o,r,t)),Math.round(255*a(o,r,t-1/3)),n]},f(u,function(s,a){var n=a.props,r=a.cache,h=a.to,u=a.from;l.fn[s]=function(s){if(h&&!this[r]&&(this[r]=h(this._rgba)),s===t)return this[r].slice();var a,o=e.type(s),c="array"===o||"object"===o?s:arguments,d=this[r].slice();return f(n,function(e,t){var s=c["object"===o?e:t.idx];null==s&&(s=d[t.idx]),d[t.idx]=i(s,t)}),u?(a=l(u(d)),a[r]=d,a):l(d)},f(n,function(t,i){l.fn[t]||(l.fn[t]=function(a){var n,r=e.type(a),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===r?u:("function"===r&&(a=a.call(this,u),r=e.type(a)),null==a&&i.empty?this:("string"===r&&(n=o.exec(a),n&&(a=u+parseFloat(n[2])*("+"===n[1]?1:-1))),l[i.idx]=a,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,a){var n,r,o="";if("transparent"!==a&&("string"!==e.type(a)||(n=s(a)))){if(a=l(n||a),!d.rgba&&1!==a._rgba[3]){for(r="backgroundColor"===i?t.parentNode:t;(""===o||"transparent"===o)&&r&&r.style;)try{o=e.css(r,"backgroundColor"),r=r.parentNode}catch(h){}a=a.blend(o&&"transparent"!==o?o:"_default")}a=a.toRgbaString()}try{t.style[i]=a}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(r),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},n=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(t){var i,s,a=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,n={};if(a&&a.length&&a[0]&&a[a[0]])for(s=a.length;s--;)i=a[s],"string"==typeof a[i]&&(n[e.camelCase(i)]=a[i]);else for(i in a)"string"==typeof a[i]&&(n[i]=a[i]);return n}function s(t,i){var s,a,r={};for(s in i)a=i[s],t[s]!==a&&(n[s]||(e.fx.step[s]||!isNaN(parseFloat(a)))&&(r[s]=a));return r}var a=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(t,n,r,o){var h=e.speed(n,r,o);return this.queue(function(){var n,r=e(this),o=r.attr("class")||"",l=h.children?r.find("*").addBack():r;l=l.map(function(){var t=e(this);return{el:t,start:i(this)}}),n=function(){e.each(a,function(e,i){t[i]&&r[i+"Class"](t[i])})},n(),l=l.map(function(){return this.end=i(this.el[0]),this.diff=s(this.start,this.end),this}),r.attr("class",o),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){n(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(r[0])})})},e.fn.extend({addClass:function(t){return function(i,s,a,n){return s?e.effects.animateClass.call(this,{add:i},s,a,n):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,a,n){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,a,n):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(i){return function(s,a,n,r,o){return"boolean"==typeof a||a===t?n?e.effects.animateClass.call(this,a?{add:s}:{remove:s},n,r,o):i.apply(this,arguments):e.effects.animateClass.call(this,{toggle:s},a,n,r)}}(e.fn.toggleClass),switchClass:function(t,i,s,a,n){return e.effects.animateClass.call(this,{add:i,remove:t},s,a,n)}})}(),function(){function s(t,i,s,a){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(a=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(a=s,s=i,i={}),e.isFunction(s)&&(a=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=a||i.complete,t}function a(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.10.3",save:function(e,t){for(var s=0;t.length>s;s++)null!==t[s]&&e.data(i+t[s],e[0].style[t[s]])},restore:function(e,s){var a,n;for(n=0;s.length>n;n++)null!==s[n]&&(a=e.data(i+s[n]),a===t&&(a=""),e.css(s[n],a))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),a={width:t.width(),height:t.height()},n=document.activeElement;try{n.id}catch(r){n=document.body}return t.wrap(s),(t[0]===n||e.contains(t[0],n))&&e(n).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(a),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,a){return a=a||{},e.each(i,function(e,i){var n=t.cssUnit(i);n[0]>0&&(a[i]=n[0]*s+n[1])}),a}}),e.fn.extend({effect:function(){function t(t){function s(){e.isFunction(n)&&n.call(a[0]),e.isFunction(t)&&t()}var a=e(this),n=i.complete,o=i.mode;(a.is(":hidden")?"hide"===o:"show"===o)?(a[o](),s()):r.call(a[0],i,s)}var i=s.apply(this,arguments),a=i.mode,n=i.queue,r=e.effects.effect[i.effect];return e.fx.off||!r?a?this[a](i.duration,i.complete):this.each(function(){i.complete&&i.complete.call(this)}):n===!1?this.each(t):this.queue(n||"fx",t)},show:function(e){return function(t){if(a(t))return e.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(e.fn.show),hide:function(e){return function(t){if(a(t))return e.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(e.fn.hide),toggle:function(e){return function(t){if(a(t)||"boolean"==typeof t)return e.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}()})(jQuery);(function(e){var t=/up|down|vertical/,i=/up|left|vertical|horizontal/;e.effects.effect.blind=function(a,s){var n,r,o,l=e(this),h=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(l,a.mode||"hide"),d=a.direction||"up",c=t.test(d),p=c?"height":"width",f=c?"top":"left",m=i.test(d),g={},v="show"===u;l.parent().is(".ui-effects-wrapper")?e.effects.save(l.parent(),h):e.effects.save(l,h),l.show(),n=e.effects.createWrapper(l).css({overflow:"hidden"}),r=n[p](),o=parseFloat(n.css(f))||0,g[p]=v?r:0,m||(l.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?o:r+o),v&&(n.css(p,0),m||n.css(f,o+r)),n.animate(g,{duration:a.duration,easing:a.easing,queue:!1,complete:function(){"hide"===u&&l.hide(),e.effects.restore(l,h),e.effects.removeWrapper(l),s()}})}})(jQuery);(function(e){e.effects.effect.bounce=function(t,i){var a,s,n,r=e(this),o=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(r,t.mode||"effect"),h="hide"===l,u="show"===l,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||h?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=r.queue(),_=b.length;for((u||h)&&o.push("opacity"),e.effects.save(r,o),r.show(),e.effects.createWrapper(r),c||(c=r["top"===v?"outerHeight":"outerWidth"]()/3),u&&(n={opacity:1},n[v]=0,r.css("opacity",0).css(v,y?2*-c:2*c).animate(n,m,g)),h&&(c/=Math.pow(2,p-1)),n={},n[v]=0,a=0;p>a;a++)s={},s[v]=(y?"-=":"+=")+c,r.animate(s,m,g).animate(n,m,g),c=h?2*c:c/2;h&&(s={opacity:0},s[v]=(y?"-=":"+=")+c,r.animate(s,m,g)),r.queue(function(){h&&r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),r.dequeue()}})(jQuery);(function(e){e.effects.effect.clip=function(t,i){var a,s,n,r=e(this),o=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(r,t.mode||"hide"),h="show"===l,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(r,o),r.show(),a=e.effects.createWrapper(r).css({overflow:"hidden"}),s="IMG"===r[0].tagName?a:r,n=s[c](),h&&(s.css(c,0),s.css(p,n/2)),f[c]=h?n:0,f[p]=h?0:n/2,s.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){h||r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),i()}})}})(jQuery);(function(e){e.effects.effect.drop=function(t,i){var a,s=e(this),n=["position","top","bottom","left","right","opacity","height","width"],r=e.effects.setMode(s,t.mode||"hide"),o="show"===r,l=t.direction||"left",h="up"===l||"down"===l?"top":"left",u="up"===l||"left"===l?"pos":"neg",d={opacity:o?1:0};e.effects.save(s,n),s.show(),e.effects.createWrapper(s),a=t.distance||s["top"===h?"outerHeight":"outerWidth"](!0)/2,o&&s.css("opacity",0).css(h,"pos"===u?-a:a),d[h]=(o?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+a,s.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===r&&s.hide(),e.effects.restore(s,n),e.effects.removeWrapper(s),i()}})}})(jQuery);(function(e){e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&a()}function a(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var n,r,o,l,h,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(n=0;d>n;n++)for(l=g.top+n*y,u=n-(d-1)/2,r=0;c>r;r++)o=g.left+r*v,h=r-(c-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-r*v,top:-n*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:o+(m?h*v:0),top:l+(m?u*y:0),opacity:m?0:1}).animate({left:o+(m?0:h*v),top:l+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)}})(jQuery);(function(e){e.effects.effect.fade=function(t,i){var s=e(this),a=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:a},{queue:!1,duration:t.duration,easing:t.easing,complete:i})}})(jQuery);(function(e){e.effects.effect.fold=function(t,i){var s,a,n=e(this),r=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"hide"),l="show"===o,h="hide"===o,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=l!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(n,r),n.show(),s=e.effects.createWrapper(n).css({overflow:"hidden"}),a=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*a[h?0:1]),l&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=l?a[0]:u,v[f[1]]=l?a[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){h&&n.hide(),e.effects.restore(n,r),e.effects.removeWrapper(n),i()})}})(jQuery);(function(e){e.effects.effect.highlight=function(t,i){var s=e(this),a=["backgroundImage","backgroundColor","opacity"],n=e.effects.setMode(s,t.mode||"show"),r={backgroundColor:s.css("backgroundColor")};"hide"===n&&(r.opacity=0),e.effects.save(s,a),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(r,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===n&&s.hide(),e.effects.restore(s,a),i()}})}})(jQuery);(function(e){e.effects.effect.pulsate=function(t,i){var s,a=e(this),n=e.effects.setMode(a,t.mode||"show"),r="show"===n,o="hide"===n,l=r||"hide"===n,h=2*(t.times||5)+(l?1:0),u=t.duration/h,d=0,c=a.queue(),p=c.length;for((r||!a.is(":visible"))&&(a.css("opacity",0).show(),d=1),s=1;h>s;s++)a.animate({opacity:d},u,t.easing),d=1-d;a.animate({opacity:d},u,t.easing),a.queue(function(){o&&a.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,h+1))),a.dequeue()}})(jQuery);(function(e){e.effects.effect.puff=function(t,i){var s=e(this),a=e.effects.setMode(s,t.mode||"hide"),n="hide"===a,r=parseInt(t.percent,10)||150,o=r/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:a,complete:i,percent:n?r:100,from:n?h:{height:h.height*o,width:h.width*o,outerHeight:h.outerHeight*o,outerWidth:h.outerWidth*o}}),s.effect(t)},e.effects.effect.scale=function(t,i){var s=e(this),a=e.extend(!0,{},t),n=e.effects.setMode(s,t.mode||"effect"),r=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===n?0:100),o=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==o?r/100:1,x:"vertical"!==o?r/100:1};a.effect="size",a.queue=!1,a.complete=i,"effect"!==n&&(a.origin=h||["middle","center"],a.restore=!0),a.from=t.from||("show"===n?{height:0,width:0,outerHeight:0,outerWidth:0}:l),a.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},a.fade&&("show"===n&&(a.from.opacity=0,a.to.opacity=1),"hide"===n&&(a.from.opacity=1,a.to.opacity=0)),s.effect(a)},e.effects.effect.size=function(t,i){var s,a,n,r=e(this),o=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(r,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=r.css("position"),y=f?o:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&r.show(),s={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()},"toggle"===t.mode&&"show"===p?(r.from=t.to||b,r.to=t.from||s):(r.from=t.from||("show"===p?b:s),r.to=t.to||("hide"===p?b:s)),n={from:{y:r.from.height/s.height,x:r.from.width/s.width},to:{y:r.to.height/s.height,x:r.to.width/s.width}},("box"===m||"both"===m)&&(n.from.y!==n.to.y&&(y=y.concat(d),r.from=e.effects.setTransition(r,d,n.from.y,r.from),r.to=e.effects.setTransition(r,d,n.to.y,r.to)),n.from.x!==n.to.x&&(y=y.concat(c),r.from=e.effects.setTransition(r,c,n.from.x,r.from),r.to=e.effects.setTransition(r,c,n.to.x,r.to))),("content"===m||"both"===m)&&n.from.y!==n.to.y&&(y=y.concat(u).concat(l),r.from=e.effects.setTransition(r,u,n.from.y,r.from),r.to=e.effects.setTransition(r,u,n.to.y,r.to)),e.effects.save(r,y),r.show(),e.effects.createWrapper(r),r.css("overflow","hidden").css(r.from),g&&(a=e.effects.getBaseline(g,s),r.from.top=(s.outerHeight-r.outerHeight())*a.y,r.from.left=(s.outerWidth-r.outerWidth())*a.x,r.to.top=(s.outerHeight-r.to.outerHeight)*a.y,r.to.left=(s.outerWidth-r.to.outerWidth)*a.x),r.css(r.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=o.concat(d).concat(c),r.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&e.effects.save(i,l),i.from={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},i.to={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x},n.from.y!==n.to.y&&(i.from=e.effects.setTransition(i,d,n.from.y,i.from),i.to=e.effects.setTransition(i,d,n.to.y,i.to)),n.from.x!==n.to.x&&(i.from=e.effects.setTransition(i,c,n.from.x,i.from),i.to=e.effects.setTransition(i,c,n.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),r.animate(r.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===r.to.opacity&&r.css("opacity",r.from.opacity),"hide"===p&&r.hide(),e.effects.restore(r,y),f||("static"===v?r.css({position:"relative",top:r.to.top,left:r.to.left}):e.each(["top","left"],function(e,t){r.css(t,function(t,i){var s=parseInt(i,10),a=e?r.to.left:r.to.top;return"auto"===i?a+"px":s+a+"px"})})),e.effects.removeWrapper(r),i()}})}})(jQuery);(function(e){e.effects.effect.shake=function(t,i){var s,a=e(this),n=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"effect"),o=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===o||"down"===o?"top":"left",p="up"===o||"left"===o,f={},m={},g={},v=a.queue(),y=v.length;for(e.effects.save(a,n),a.show(),e.effects.createWrapper(a),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,a.animate(f,d,t.easing),s=1;l>s;s++)a.animate(m,d,t.easing).animate(g,d,t.easing);a.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===r&&a.hide(),e.effects.restore(a,n),e.effects.removeWrapper(a),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),a.dequeue()}})(jQuery);(function(e){e.effects.effect.slide=function(t,i){var s,a=e(this),n=["position","top","bottom","left","right","width","height"],r=e.effects.setMode(a,t.mode||"show"),o="show"===r,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(a,n),a.show(),s=t.distance||a["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(a).css({overflow:"hidden"}),o&&a.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(o?u?"+=":"-=":u?"-=":"+=")+s,a.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===r&&a.hide(),e.effects.restore(a,n),e.effects.removeWrapper(a),i()}})}})(jQuery);(function(e){e.effects.effect.transfer=function(t,i){var s=e(this),a=e(t.to),n="fixed"===a.css("position"),r=e("body"),o=n?r.scrollTop():0,h=n?r.scrollLeft():0,l=a.offset(),u={top:l.top-o,left:l.left-h,height:a.innerHeight(),width:a.innerWidth()},d=s.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:d.top-o,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:n?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})}})(jQuery);
@@ -0,0 +1,72 @@
1
+ /*!
2
+ * jsxc v1.0.0 - 2015-01-15
3
+ *
4
+ * This file concatenates all dependencies of jsxc.
5
+ *
6
+ */
7
+ /*!
8
+ * Source: build/lib/strophe.js, license: multiple, url: http://strophe.im/strophejs/ */
9
+ /*! This code was written by Tyler Akins and has been placed in the
10
+ public domain. It would be nice if you left this header intact.
11
+ Base64 code from Tyler Akins -- http://rumkin.com
12
+ */
13
+ /*!
14
+ * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
15
+ * in FIPS PUB 180-1
16
+ * Version 2.1a Copyright Paul Johnston 2000 - 2002.
17
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
18
+ * Distributed under the BSD License
19
+ * See http://pajhome.org.uk/crypt/md5 for details.
20
+ */
21
+ function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),8*s.length))}function str_sha1(s){return binb2str(core_sha1(str2binb(s),8*s.length))}function b64_hmac_sha1(key,data){return binb2b64(core_hmac_sha1(key,data))}function str_hmac_sha1(key,data){return binb2str(core_hmac_sha1(key,data))}function core_sha1(x,len){x[len>>5]|=128<<24-len%32,x[(len+64>>9<<4)+15]=len;var i,j,t,olda,oldb,oldc,oldd,olde,w=new Array(80),a=1732584193,b=-271733879,c=-1732584194,d=271733878,e=-1009589776;for(i=0;i<x.length;i+=16){for(olda=a,oldb=b,oldc=c,oldd=d,olde=e,j=0;80>j;j++)w[j]=16>j?x[i+j]:rol(w[j-3]^w[j-8]^w[j-14]^w[j-16],1),t=safe_add(safe_add(rol(a,5),sha1_ft(j,b,c,d)),safe_add(safe_add(e,w[j]),sha1_kt(j))),e=d,d=c,c=rol(b,30),b=a,a=t;a=safe_add(a,olda),b=safe_add(b,oldb),c=safe_add(c,oldc),d=safe_add(d,oldd),e=safe_add(e,olde)}return[a,b,c,d,e]}function sha1_ft(t,b,c,d){return 20>t?b&c|~b&d:40>t?b^c^d:60>t?b&c|b&d|c&d:b^c^d}function sha1_kt(t){return 20>t?1518500249:40>t?1859775393:60>t?-1894007588:-899497514}function core_hmac_sha1(key,data){var bkey=str2binb(key);bkey.length>16&&(bkey=core_sha1(bkey,8*key.length));for(var ipad=new Array(16),opad=new Array(16),i=0;16>i;i++)ipad[i]=909522486^bkey[i],opad[i]=1549556828^bkey[i];var hash=core_sha1(ipad.concat(str2binb(data)),512+8*data.length);return core_sha1(opad.concat(hash),672)}function safe_add(x,y){var lsw=(65535&x)+(65535&y),msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|65535&lsw}function rol(num,cnt){return num<<cnt|num>>>32-cnt}function str2binb(str){for(var bin=[],mask=255,i=0;i<8*str.length;i+=8)bin[i>>5]|=(str.charCodeAt(i/8)&mask)<<24-i%32;return bin}function binb2str(bin){for(var str="",mask=255,i=0;i<32*bin.length;i+=8)str+=String.fromCharCode(bin[i>>5]>>>24-i%32&mask);return str}function binb2b64(binarray){for(var triplet,j,tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",str="",i=0;i<4*binarray.length;i+=3)for(triplet=(binarray[i>>2]>>8*(3-i%4)&255)<<16|(binarray[i+1>>2]>>8*(3-(i+1)%4)&255)<<8|binarray[i+2>>2]>>8*(3-(i+2)%4)&255,j=0;4>j;j++)str+=8*i+6*j>32*binarray.length?"=":tab.charAt(triplet>>6*(3-j)&63);return str}var Base64=function(){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",obj={encode:function(input){var chr1,chr2,chr3,enc1,enc2,enc3,enc4,output="",i=0;do chr1=input.charCodeAt(i++),chr2=input.charCodeAt(i++),chr3=input.charCodeAt(i++),enc1=chr1>>2,enc2=(3&chr1)<<4|chr2>>4,enc3=(15&chr2)<<2|chr3>>6,enc4=63&chr3,isNaN(chr2)?enc3=enc4=64:isNaN(chr3)&&(enc4=64),output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);while(i<input.length);return output},decode:function(input){var chr1,chr2,chr3,enc1,enc2,enc3,enc4,output="",i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do enc1=keyStr.indexOf(input.charAt(i++)),enc2=keyStr.indexOf(input.charAt(i++)),enc3=keyStr.indexOf(input.charAt(i++)),enc4=keyStr.indexOf(input.charAt(i++)),chr1=enc1<<2|enc2>>4,chr2=(15&enc2)<<4|enc3>>2,chr3=(3&enc3)<<6|enc4,output+=String.fromCharCode(chr1),64!=enc3&&(output+=String.fromCharCode(chr2)),64!=enc4&&(output+=String.fromCharCode(chr3));while(i<input.length);return output}};return obj}(),MD5=function(){var safe_add=function(x,y){var lsw=(65535&x)+(65535&y),msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|65535&lsw},bit_rol=function(num,cnt){return num<<cnt|num>>>32-cnt},str2binl=function(str){for(var bin=[],i=0;i<8*str.length;i+=8)bin[i>>5]|=(255&str.charCodeAt(i/8))<<i%32;return bin},binl2str=function(bin){for(var str="",i=0;i<32*bin.length;i+=8)str+=String.fromCharCode(bin[i>>5]>>>i%32&255);return str},binl2hex=function(binarray){for(var hex_tab="0123456789abcdef",str="",i=0;i<4*binarray.length;i++)str+=hex_tab.charAt(binarray[i>>2]>>i%4*8+4&15)+hex_tab.charAt(binarray[i>>2]>>i%4*8&15);return str},md5_cmn=function(q,a,b,x,s,t){return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b)},md5_ff=function(a,b,c,d,x,s,t){return md5_cmn(b&c|~b&d,a,b,x,s,t)},md5_gg=function(a,b,c,d,x,s,t){return md5_cmn(b&d|c&~d,a,b,x,s,t)},md5_hh=function(a,b,c,d,x,s,t){return md5_cmn(b^c^d,a,b,x,s,t)},md5_ii=function(a,b,c,d,x,s,t){return md5_cmn(c^(b|~d),a,b,x,s,t)},core_md5=function(x,len){x[len>>5]|=128<<len%32,x[(len+64>>>9<<4)+14]=len;for(var olda,oldb,oldc,oldd,a=1732584193,b=-271733879,c=-1732584194,d=271733878,i=0;i<x.length;i+=16)olda=a,oldb=b,oldc=c,oldd=d,a=md5_ff(a,b,c,d,x[i+0],7,-680876936),d=md5_ff(d,a,b,c,x[i+1],12,-389564586),c=md5_ff(c,d,a,b,x[i+2],17,606105819),b=md5_ff(b,c,d,a,x[i+3],22,-1044525330),a=md5_ff(a,b,c,d,x[i+4],7,-176418897),d=md5_ff(d,a,b,c,x[i+5],12,1200080426),c=md5_ff(c,d,a,b,x[i+6],17,-1473231341),b=md5_ff(b,c,d,a,x[i+7],22,-45705983),a=md5_ff(a,b,c,d,x[i+8],7,1770035416),d=md5_ff(d,a,b,c,x[i+9],12,-1958414417),c=md5_ff(c,d,a,b,x[i+10],17,-42063),b=md5_ff(b,c,d,a,x[i+11],22,-1990404162),a=md5_ff(a,b,c,d,x[i+12],7,1804603682),d=md5_ff(d,a,b,c,x[i+13],12,-40341101),c=md5_ff(c,d,a,b,x[i+14],17,-1502002290),b=md5_ff(b,c,d,a,x[i+15],22,1236535329),a=md5_gg(a,b,c,d,x[i+1],5,-165796510),d=md5_gg(d,a,b,c,x[i+6],9,-1069501632),c=md5_gg(c,d,a,b,x[i+11],14,643717713),b=md5_gg(b,c,d,a,x[i+0],20,-373897302),a=md5_gg(a,b,c,d,x[i+5],5,-701558691),d=md5_gg(d,a,b,c,x[i+10],9,38016083),c=md5_gg(c,d,a,b,x[i+15],14,-660478335),b=md5_gg(b,c,d,a,x[i+4],20,-405537848),a=md5_gg(a,b,c,d,x[i+9],5,568446438),d=md5_gg(d,a,b,c,x[i+14],9,-1019803690),c=md5_gg(c,d,a,b,x[i+3],14,-187363961),b=md5_gg(b,c,d,a,x[i+8],20,1163531501),a=md5_gg(a,b,c,d,x[i+13],5,-1444681467),d=md5_gg(d,a,b,c,x[i+2],9,-51403784),c=md5_gg(c,d,a,b,x[i+7],14,1735328473),b=md5_gg(b,c,d,a,x[i+12],20,-1926607734),a=md5_hh(a,b,c,d,x[i+5],4,-378558),d=md5_hh(d,a,b,c,x[i+8],11,-2022574463),c=md5_hh(c,d,a,b,x[i+11],16,1839030562),b=md5_hh(b,c,d,a,x[i+14],23,-35309556),a=md5_hh(a,b,c,d,x[i+1],4,-1530992060),d=md5_hh(d,a,b,c,x[i+4],11,1272893353),c=md5_hh(c,d,a,b,x[i+7],16,-155497632),b=md5_hh(b,c,d,a,x[i+10],23,-1094730640),a=md5_hh(a,b,c,d,x[i+13],4,681279174),d=md5_hh(d,a,b,c,x[i+0],11,-358537222),c=md5_hh(c,d,a,b,x[i+3],16,-722521979),b=md5_hh(b,c,d,a,x[i+6],23,76029189),a=md5_hh(a,b,c,d,x[i+9],4,-640364487),d=md5_hh(d,a,b,c,x[i+12],11,-421815835),c=md5_hh(c,d,a,b,x[i+15],16,530742520),b=md5_hh(b,c,d,a,x[i+2],23,-995338651),a=md5_ii(a,b,c,d,x[i+0],6,-198630844),d=md5_ii(d,a,b,c,x[i+7],10,1126891415),c=md5_ii(c,d,a,b,x[i+14],15,-1416354905),b=md5_ii(b,c,d,a,x[i+5],21,-57434055),a=md5_ii(a,b,c,d,x[i+12],6,1700485571),d=md5_ii(d,a,b,c,x[i+3],10,-1894986606),c=md5_ii(c,d,a,b,x[i+10],15,-1051523),b=md5_ii(b,c,d,a,x[i+1],21,-2054922799),a=md5_ii(a,b,c,d,x[i+8],6,1873313359),d=md5_ii(d,a,b,c,x[i+15],10,-30611744),c=md5_ii(c,d,a,b,x[i+6],15,-1560198380),b=md5_ii(b,c,d,a,x[i+13],21,1309151649),a=md5_ii(a,b,c,d,x[i+4],6,-145523070),d=md5_ii(d,a,b,c,x[i+11],10,-1120210379),c=md5_ii(c,d,a,b,x[i+2],15,718787259),b=md5_ii(b,c,d,a,x[i+9],21,-343485551),a=safe_add(a,olda),b=safe_add(b,oldb),c=safe_add(c,oldc),d=safe_add(d,oldd);return[a,b,c,d]},obj={hexdigest:function(s){return binl2hex(core_md5(str2binl(s),8*s.length))},hash:function(s){return binl2str(core_md5(str2binl(s),8*s.length))}};return obj}();/*!
22
+ This program is distributed under the terms of the MIT license.
23
+ Please see the LICENSE file for details.
24
+
25
+ Copyright 2006-2008, OGG, LLC
26
+ */
27
+ Function.prototype.bind||(Function.prototype.bind=function(obj){var func=this,_slice=Array.prototype.slice,_concat=Array.prototype.concat,_args=_slice.call(arguments,1);return function(){return func.apply(obj?obj:this,_concat.call(_args,_slice.call(arguments,0)))}}),Array.prototype.indexOf||(Array.prototype.indexOf=function(elt){var len=this.length,from=Number(arguments[1])||0;for(from=0>from?Math.ceil(from):Math.floor(from),0>from&&(from+=len);len>from;from++)if(from in this&&this[from]===elt)return from;return-1}),function(callback){function $build(name,attrs){return new Strophe.Builder(name,attrs)}function $msg(attrs){return new Strophe.Builder("message",attrs)}function $iq(attrs){return new Strophe.Builder("iq",attrs)}function $pres(attrs){return new Strophe.Builder("presence",attrs)}var Strophe;Strophe={VERSION:"1.1.3",NS:{HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas",XHTML_IM:"http://jabber.org/protocol/xhtml-im",XHTML:"http://www.w3.org/1999/xhtml"},XHTML:{tags:["a","blockquote","br","cite","em","img","li","ol","p","span","strong","ul","body"],attributes:{a:["href"],blockquote:["style"],br:[],cite:["style"],em:[],img:["src","alt","style","height","width"],li:["style"],ol:["style"],p:["style"],span:["style"],strong:[],ul:["style"],body:[]},css:["background-color","color","font-family","font-size","font-style","font-weight","margin-left","margin-right","text-align","text-decoration"],validTag:function(tag){for(var i=0;i<Strophe.XHTML.tags.length;i++)if(tag==Strophe.XHTML.tags[i])return!0;return!1},validAttribute:function(tag,attribute){if("undefined"!=typeof Strophe.XHTML.attributes[tag]&&Strophe.XHTML.attributes[tag].length>0)for(var i=0;i<Strophe.XHTML.attributes[tag].length;i++)if(attribute==Strophe.XHTML.attributes[tag][i])return!0;return!1},validCSS:function(style){for(var i=0;i<Strophe.XHTML.css.length;i++)if(style==Strophe.XHTML.css[i])return!0;return!1}},Status:{ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3,CDATA:4,FRAGMENT:11},TIMEOUT:1.1,SECONDARY_TIMEOUT:.1,addNamespace:function(name,value){Strophe.NS[name]=value},forEachChild:function(elem,elemName,func){var i,childNode;for(i=0;i<elem.childNodes.length;i++)childNode=elem.childNodes[i],childNode.nodeType!=Strophe.ElementType.NORMAL||elemName&&!this.isTagEqual(childNode,elemName)||func(childNode)},isTagEqual:function(el,name){return el.tagName.toLowerCase()==name.toLowerCase()},_xmlGenerator:null,_makeGenerator:function(){var doc;return void 0===document.implementation.createDocument||document.implementation.createDocument&&document.documentMode&&document.documentMode<10?(doc=this._getIEXmlDom(),doc.appendChild(doc.createElement("strophe"))):doc=document.implementation.createDocument("jabber:client","strophe",null),doc},xmlGenerator:function(){return Strophe._xmlGenerator||(Strophe._xmlGenerator=Strophe._makeGenerator()),Strophe._xmlGenerator},_getIEXmlDom:function(){for(var doc=null,docStrings=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"],d=0;d<docStrings.length&&null===doc;d++)try{doc=new ActiveXObject(docStrings[d])}catch(e){doc=null}return doc},xmlElement:function(name){if(!name)return null;var a,i,k,node=Strophe.xmlGenerator().createElement(name);for(a=1;a<arguments.length;a++)if(arguments[a])if("string"==typeof arguments[a]||"number"==typeof arguments[a])node.appendChild(Strophe.xmlTextNode(arguments[a]));else if("object"==typeof arguments[a]&&"function"==typeof arguments[a].sort)for(i=0;i<arguments[a].length;i++)"object"==typeof arguments[a][i]&&"function"==typeof arguments[a][i].sort&&node.setAttribute(arguments[a][i][0],arguments[a][i][1]);else if("object"==typeof arguments[a])for(k in arguments[a])arguments[a].hasOwnProperty(k)&&node.setAttribute(k,arguments[a][k]);return node},xmlescape:function(text){return text=text.replace(/\&/g,"&amp;"),text=text.replace(/</g,"&lt;"),text=text.replace(/>/g,"&gt;"),text=text.replace(/'/g,"&apos;"),text=text.replace(/"/g,"&quot;")},xmlTextNode:function(text){return Strophe.xmlGenerator().createTextNode(text)},xmlHtmlNode:function(html){var node;if(window.DOMParser){var parser=new DOMParser;node=parser.parseFromString(html,"text/xml")}else node=new ActiveXObject("Microsoft.XMLDOM"),node.async="false",node.loadXML(html);return node},getText:function(elem){if(!elem)return null;var str="";0===elem.childNodes.length&&elem.nodeType==Strophe.ElementType.TEXT&&(str+=elem.nodeValue);for(var i=0;i<elem.childNodes.length;i++)elem.childNodes[i].nodeType==Strophe.ElementType.TEXT&&(str+=elem.childNodes[i].nodeValue);return Strophe.xmlescape(str)},copyElement:function(elem){var i,el;if(elem.nodeType==Strophe.ElementType.NORMAL){for(el=Strophe.xmlElement(elem.tagName),i=0;i<elem.attributes.length;i++)el.setAttribute(elem.attributes[i].nodeName.toLowerCase(),elem.attributes[i].value);for(i=0;i<elem.childNodes.length;i++)el.appendChild(Strophe.copyElement(elem.childNodes[i]))}else elem.nodeType==Strophe.ElementType.TEXT&&(el=Strophe.xmlGenerator().createTextNode(elem.nodeValue));return el},createHtml:function(elem){var i,el,j,tag,attribute,value,css,cssAttrs,attr,cssName,cssValue;if(elem.nodeType==Strophe.ElementType.NORMAL)if(tag=elem.nodeName.toLowerCase(),Strophe.XHTML.validTag(tag))try{for(el=Strophe.xmlElement(tag),i=0;i<Strophe.XHTML.attributes[tag].length;i++)if(attribute=Strophe.XHTML.attributes[tag][i],value=elem.getAttribute(attribute),"undefined"!=typeof value&&null!==value&&""!==value&&value!==!1&&0!==value)if("style"==attribute&&"object"==typeof value&&"undefined"!=typeof value.cssText&&(value=value.cssText),"style"==attribute){for(css=[],cssAttrs=value.split(";"),j=0;j<cssAttrs.length;j++)attr=cssAttrs[j].split(":"),cssName=attr[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase(),Strophe.XHTML.validCSS(cssName)&&(cssValue=attr[1].replace(/^\s*/,"").replace(/\s*$/,""),css.push(cssName+": "+cssValue));css.length>0&&(value=css.join("; "),el.setAttribute(attribute,value))}else el.setAttribute(attribute,value);for(i=0;i<elem.childNodes.length;i++)el.appendChild(Strophe.createHtml(elem.childNodes[i]))}catch(e){el=Strophe.xmlTextNode("")}else for(el=Strophe.xmlGenerator().createDocumentFragment(),i=0;i<elem.childNodes.length;i++)el.appendChild(Strophe.createHtml(elem.childNodes[i]));else if(elem.nodeType==Strophe.ElementType.FRAGMENT)for(el=Strophe.xmlGenerator().createDocumentFragment(),i=0;i<elem.childNodes.length;i++)el.appendChild(Strophe.createHtml(elem.childNodes[i]));else elem.nodeType==Strophe.ElementType.TEXT&&(el=Strophe.xmlTextNode(elem.nodeValue));return el},escapeNode:function(node){return node.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40")},unescapeNode:function(node){return node.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(jid){return jid.indexOf("@")<0?null:jid.split("@")[0]},getDomainFromJid:function(jid){var bare=Strophe.getBareJidFromJid(jid);if(bare.indexOf("@")<0)return bare;var parts=bare.split("@");return parts.splice(0,1),parts.join("@")},getResourceFromJid:function(jid){var s=jid.split("/");return s.length<2?null:(s.splice(0,1),s.join("/"))},getBareJidFromJid:function(jid){return jid?jid.split("/")[0]:null},log:function(){},debug:function(msg){this.log(this.LogLevel.DEBUG,msg)},info:function(msg){this.log(this.LogLevel.INFO,msg)},warn:function(msg){this.log(this.LogLevel.WARN,msg)},error:function(msg){this.log(this.LogLevel.ERROR,msg)},fatal:function(msg){this.log(this.LogLevel.FATAL,msg)},serialize:function(elem){var result;if(!elem)return null;"function"==typeof elem.tree&&(elem=elem.tree());var i,child,nodeName=elem.nodeName;for(elem.getAttribute("_realname")&&(nodeName=elem.getAttribute("_realname")),result="<"+nodeName,i=0;i<elem.attributes.length;i++)"_realname"!=elem.attributes[i].nodeName&&(result+=" "+elem.attributes[i].nodeName.toLowerCase()+"='"+elem.attributes[i].value.replace(/&/g,"&amp;").replace(/\'/g,"&apos;").replace(/>/g,"&gt;").replace(/</g,"&lt;")+"'");if(elem.childNodes.length>0){for(result+=">",i=0;i<elem.childNodes.length;i++)switch(child=elem.childNodes[i],child.nodeType){case Strophe.ElementType.NORMAL:result+=Strophe.serialize(child);break;case Strophe.ElementType.TEXT:result+=Strophe.xmlescape(child.nodeValue);break;case Strophe.ElementType.CDATA:result+="<![CDATA["+child.nodeValue+"]]>"}result+="</"+nodeName+">"}else result+="/>";return result},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(name,ptype){Strophe._connectionPlugins[name]=ptype}},Strophe.Builder=function(name,attrs){("presence"==name||"message"==name||"iq"==name)&&(attrs&&!attrs.xmlns?attrs.xmlns=Strophe.NS.CLIENT:attrs||(attrs={xmlns:Strophe.NS.CLIENT})),this.nodeTree=Strophe.xmlElement(name,attrs),this.node=this.nodeTree},Strophe.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return Strophe.serialize(this.nodeTree)},up:function(){return this.node=this.node.parentNode,this},attrs:function(moreattrs){for(var k in moreattrs)moreattrs.hasOwnProperty(k)&&this.node.setAttribute(k,moreattrs[k]);return this},c:function(name,attrs,text){var child=Strophe.xmlElement(name,attrs,text);return this.node.appendChild(child),text||(this.node=child),this},cnode:function(elem){var impNode,xmlGen=Strophe.xmlGenerator();try{impNode=void 0!==xmlGen.importNode}catch(e){impNode=!1}var newElem=impNode?xmlGen.importNode(elem,!0):Strophe.copyElement(elem);return this.node.appendChild(newElem),this.node=newElem,this},t:function(text){var child=Strophe.xmlTextNode(text);return this.node.appendChild(child),this},h:function(html){var fragment=document.createElement("body");fragment.innerHTML=html;for(var xhtml=Strophe.createHtml(fragment);xhtml.childNodes.length>0;)this.node.appendChild(xhtml.childNodes[0]);return this}},Strophe.Handler=function(handler,ns,name,type,id,from,options){this.handler=handler,this.ns=ns,this.name=name,this.type=type,this.id=id,this.options=options||{matchBare:!1},this.options.matchBare||(this.options.matchBare=!1),this.from=this.options.matchBare?from?Strophe.getBareJidFromJid(from):null:from,this.user=!0},Strophe.Handler.prototype={isMatch:function(elem){var nsMatch,from=null;if(from=this.options.matchBare?Strophe.getBareJidFromJid(elem.getAttribute("from")):elem.getAttribute("from"),nsMatch=!1,this.ns){var that=this;Strophe.forEachChild(elem,null,function(elem){elem.getAttribute("xmlns")==that.ns&&(nsMatch=!0)}),nsMatch=nsMatch||elem.getAttribute("xmlns")==this.ns}else nsMatch=!0;return!nsMatch||this.name&&!Strophe.isTagEqual(elem,this.name)||this.type&&elem.getAttribute("type")!=this.type||this.id&&elem.getAttribute("id")!=this.id||this.from&&from!=this.from?!1:!0},run:function(elem){var result=null;try{result=this.handler(elem)}catch(e){throw e.sourceURL?Strophe.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?("undefined"!=typeof console&&(console.trace(),console.error(this.handler," - error - ",e,e.message)),Strophe.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message)):Strophe.fatal("error: "+e.message+"\n"+e.stack),e}return result},toString:function(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},Strophe.TimedHandler=function(period,handler){this.period=period,this.handler=handler,this.lastCalled=(new Date).getTime(),this.user=!0},Strophe.TimedHandler.prototype={run:function(){return this.lastCalled=(new Date).getTime(),this.handler()},reset:function(){this.lastCalled=(new Date).getTime()},toString:function(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}},Strophe.Connection=function(service,options){this.service=service,this.options=options||{};var proto=this.options.protocol||"";this._proto=0===service.indexOf("ws:")||0===service.indexOf("wss:")||0===proto.indexOf("ws")?new Strophe.Websocket(this):new Strophe.Bosh(this),this.jid="",this.domain=null,this.features=null,this._sasl_data={},this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._authentication={},this._idleTimeout=null,this._disconnectTimeout=null,this.do_authentication=!0,this.authenticated=!1,this.disconnecting=!1,this.connected=!1,this.errors=0,this.paused=!1,this._data=[],this._uniqueId=0,this._sasl_success_handler=null,this._sasl_failure_handler=null,this._sasl_challenge_handler=null,this.maxRetries=5,this._idleTimeout=setTimeout(this._onIdle.bind(this),100);for(var k in Strophe._connectionPlugins)if(Strophe._connectionPlugins.hasOwnProperty(k)){var ptype=Strophe._connectionPlugins[k],F=function(){};F.prototype=ptype,this[k]=new F,this[k].init(this)}},Strophe.Connection.prototype={reset:function(){this._proto._reset(),this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._authentication={},this.authenticated=!1,this.disconnecting=!1,this.connected=!1,this.errors=0,this._requests=[],this._uniqueId=0},pause:function(){this.paused=!0},resume:function(){this.paused=!1},getUniqueId:function(suffix){return"string"==typeof suffix||"number"==typeof suffix?++this._uniqueId+":"+suffix:++this._uniqueId+""},connect:function(jid,pass,callback,wait,hold,route){this.jid=jid,this.authzid=Strophe.getBareJidFromJid(this.jid),this.authcid=Strophe.getNodeFromJid(this.jid),this.pass=pass,this.servtype="xmpp",this.connect_callback=callback,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.errors=0,this.domain=Strophe.getDomainFromJid(this.jid),this._changeConnectStatus(Strophe.Status.CONNECTING,null),this._proto._connect(wait,hold,route)},attach:function(jid,sid,rid,callback,wait,hold,wind){this._proto._attach(jid,sid,rid,callback,wait,hold,wind)},xmlInput:function(){},xmlOutput:function(){},rawInput:function(){},rawOutput:function(){},send:function(elem){if(null!==elem){if("function"==typeof elem.sort)for(var i=0;i<elem.length;i++)this._queueData(elem[i]);else this._queueData("function"==typeof elem.tree?elem.tree():elem);this._proto._send()}},flush:function(){clearTimeout(this._idleTimeout),this._onIdle()},sendIQ:function(elem,callback,errback,timeout){var timeoutHandler=null,that=this;"function"==typeof elem.tree&&(elem=elem.tree());var id=elem.getAttribute("id");id||(id=this.getUniqueId("sendIQ"),elem.setAttribute("id",id));var handler=this.addHandler(function(stanza){timeoutHandler&&that.deleteTimedHandler(timeoutHandler);var iqtype=stanza.getAttribute("type");if("result"==iqtype)callback&&callback(stanza);else{if("error"!=iqtype)throw{name:"StropheError",message:"Got bad IQ type of "+iqtype};errback&&errback(stanza)}},null,"iq",null,id);return timeout&&(timeoutHandler=this.addTimedHandler(timeout,function(){return that.deleteHandler(handler),errback&&errback(null),!1})),this.send(elem),id},_queueData:function(element){if(null===element||!element.tagName||!element.childNodes)throw{name:"StropheError",message:"Cannot queue non-DOMElement."};this._data.push(element)},_sendRestart:function(){this._data.push("restart"),this._proto._sendRestart(),this._idleTimeout=setTimeout(this._onIdle.bind(this),100)},addTimedHandler:function(period,handler){var thand=new Strophe.TimedHandler(period,handler);return this.addTimeds.push(thand),thand},deleteTimedHandler:function(handRef){this.removeTimeds.push(handRef)},addHandler:function(handler,ns,name,type,id,from,options){var hand=new Strophe.Handler(handler,ns,name,type,id,from,options);return this.addHandlers.push(hand),hand},deleteHandler:function(handRef){this.removeHandlers.push(handRef)},disconnect:function(reason){if(this._changeConnectStatus(Strophe.Status.DISCONNECTING,reason),Strophe.info("Disconnect was called because: "+reason),this.connected){var pres=!1;this.disconnecting=!0,this.authenticated&&(pres=$pres({xmlns:Strophe.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(pres)}},_changeConnectStatus:function(status,condition){for(var k in Strophe._connectionPlugins)if(Strophe._connectionPlugins.hasOwnProperty(k)){var plugin=this[k];if(plugin.statusChanged)try{plugin.statusChanged(status,condition)}catch(err){Strophe.error(""+k+" plugin caused an exception changing status: "+err)}}if(this.connect_callback)try{this.connect_callback(status,condition)}catch(e){Strophe.error("User connection callback caused an exception: "+e)}},_doDisconnect:function(){null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),Strophe.info("_doDisconnect was called"),this._proto._doDisconnect(),this.authenticated=!1,this.disconnecting=!1,this.handlers=[],this.timedHandlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._changeConnectStatus(Strophe.Status.DISCONNECTED,null),this.connected=!1},_dataRecv:function(req,raw){Strophe.info("_dataRecv called");var elem=this._proto._reqToData(req);if(null!==elem){this.xmlInput!==Strophe.Connection.prototype.xmlInput&&this.xmlInput(elem.nodeName===this._proto.strip&&elem.childNodes.length?elem.childNodes[0]:elem),this.rawInput!==Strophe.Connection.prototype.rawInput&&this.rawInput(raw?raw:Strophe.serialize(elem));for(var i,hand;this.removeHandlers.length>0;)hand=this.removeHandlers.pop(),i=this.handlers.indexOf(hand),i>=0&&this.handlers.splice(i,1);for(;this.addHandlers.length>0;)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._proto._emptyQueue())return void this._doDisconnect();var cond,conflict,typ=elem.getAttribute("type");if(null!==typ&&"terminate"==typ){if(this.disconnecting)return;return cond=elem.getAttribute("condition"),conflict=elem.getElementsByTagName("conflict"),null!==cond?("remote-stream-error"==cond&&conflict.length>0&&(cond="conflict"),this._changeConnectStatus(Strophe.Status.CONNFAIL,cond)):this._changeConnectStatus(Strophe.Status.CONNFAIL,"unknown"),void this.disconnect("unknown stream-error")}var that=this;Strophe.forEachChild(elem,null,function(child){var i,newList;for(newList=that.handlers,that.handlers=[],i=0;i<newList.length;i++){var hand=newList[i];try{!hand.isMatch(child)||!that.authenticated&&hand.user?that.handlers.push(hand):hand.run(child)&&that.handlers.push(hand)}catch(e){Strophe.warn("Removing Strophe handlers due to uncaught exception: "+e.message)}}})}},mechanisms:{},_connect_cb:function(req,_callback,raw){Strophe.info("_connect_cb was called"),this.connected=!0;var bodyWrap=this._proto._reqToData(req);if(bodyWrap){this.xmlInput!==Strophe.Connection.prototype.xmlInput&&this.xmlInput(bodyWrap.nodeName===this._proto.strip&&bodyWrap.childNodes.length?bodyWrap.childNodes[0]:bodyWrap),this.rawInput!==Strophe.Connection.prototype.rawInput&&this.rawInput(raw?raw:Strophe.serialize(bodyWrap));var conncheck=this._proto._connect_cb(bodyWrap);if(conncheck!==Strophe.Status.CONNFAIL){this._authentication.sasl_scram_sha1=!1,this._authentication.sasl_plain=!1,this._authentication.sasl_digest_md5=!1,this._authentication.sasl_anonymous=!1,this._authentication.legacy_auth=!1;var hasFeatures=bodyWrap.getElementsByTagName("stream:features").length>0;hasFeatures||(hasFeatures=bodyWrap.getElementsByTagName("features").length>0);var i,mech,mechanisms=bodyWrap.getElementsByTagName("mechanism"),matched=[],found_authentication=!1;if(!hasFeatures)return void this._proto._no_auth_received(_callback);if(mechanisms.length>0)for(i=0;i<mechanisms.length;i++)mech=Strophe.getText(mechanisms[i]),this.mechanisms[mech]&&matched.push(this.mechanisms[mech]);return this._authentication.legacy_auth=bodyWrap.getElementsByTagName("auth").length>0,(found_authentication=this._authentication.legacy_auth||matched.length>0)?void(this.do_authentication!==!1&&this.authenticate(matched)):void this._proto._no_auth_received(_callback)}}},authenticate:function(matched){var i;for(i=0;i<matched.length-1;++i){for(var higher=i,j=i+1;j<matched.length;++j)matched[j].prototype.priority>matched[higher].prototype.priority&&(higher=j);if(higher!=i){var swap=matched[i];matched[i]=matched[higher],matched[higher]=swap}}var mechanism_found=!1;for(i=0;i<matched.length;++i)if(matched[i].test(this)){this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge_cb.bind(this),null,"challenge",null,null),this._sasl_mechanism=new matched[i],this._sasl_mechanism.onStart(this);var request_auth_exchange=$build("auth",{xmlns:Strophe.NS.SASL,mechanism:this._sasl_mechanism.name});if(this._sasl_mechanism.isClientFirst){var response=this._sasl_mechanism.onChallenge(this,null);request_auth_exchange.t(Base64.encode(response))}this.send(request_auth_exchange.tree()),mechanism_found=!0;break}mechanism_found||(null===Strophe.getNodeFromJid(this.jid)?(this._changeConnectStatus(Strophe.Status.CONNFAIL,"x-strophe-bad-non-anon-jid"),this.disconnect("x-strophe-bad-non-anon-jid")):(this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null),this._addSysHandler(this._auth1_cb.bind(this),null,null,null,"_auth_1"),this.send($iq({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:Strophe.NS.AUTH}).c("username",{}).t(Strophe.getNodeFromJid(this.jid)).tree())))},_sasl_challenge_cb:function(elem){var challenge=Base64.decode(Strophe.getText(elem)),response=this._sasl_mechanism.onChallenge(this,challenge),stanza=$build("response",{xmlns:Strophe.NS.SASL});return""!==response&&stanza.t(Base64.encode(response)),this.send(stanza.tree()),!0},_auth1_cb:function(){var iq=$iq({type:"set",id:"_auth_2"}).c("query",{xmlns:Strophe.NS.AUTH}).c("username",{}).t(Strophe.getNodeFromJid(this.jid)).up().c("password").t(this.pass);return Strophe.getResourceFromJid(this.jid)||(this.jid=Strophe.getBareJidFromJid(this.jid)+"/strophe"),iq.up().c("resource",{}).t(Strophe.getResourceFromJid(this.jid)),this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2"),this.send(iq.tree()),!1},_sasl_success_cb:function(elem){if(this._sasl_data["server-signature"]){var serverSignature,success=Base64.decode(Strophe.getText(elem)),attribMatch=/([a-z]+)=([^,]+)(,|$)/,matches=success.match(attribMatch);if("v"==matches[1]&&(serverSignature=matches[2]),serverSignature!=this._sasl_data["server-signature"])return this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_data={},this._sasl_failure_cb(null)}return Strophe.info("SASL authentication succeeded."),this._sasl_mechanism&&this._sasl_mechanism.onSuccess(),this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._addSysHandler(this._sasl_auth1_cb.bind(this),null,"stream:features",null,null),this._sendRestart(),!1},_sasl_auth1_cb:function(elem){this.features=elem;var i,child;for(i=0;i<elem.childNodes.length;i++)child=elem.childNodes[i],"bind"==child.nodeName&&(this.do_bind=!0),"session"==child.nodeName&&(this.do_session=!0);if(!this.do_bind)return this._changeConnectStatus(Strophe.Status.AUTHFAIL,null),!1;this._addSysHandler(this._sasl_bind_cb.bind(this),null,null,null,"_bind_auth_2");var resource=Strophe.getResourceFromJid(this.jid);return this.send(resource?$iq({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:Strophe.NS.BIND}).c("resource",{}).t(resource).tree():$iq({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:Strophe.NS.BIND}).tree()),!1},_sasl_bind_cb:function(elem){if("error"==elem.getAttribute("type")){Strophe.info("SASL binding failed.");var condition,conflict=elem.getElementsByTagName("conflict");return conflict.length>0&&(condition="conflict"),this._changeConnectStatus(Strophe.Status.AUTHFAIL,condition),!1}var jidNode,bind=elem.getElementsByTagName("bind");return bind.length>0?(jidNode=bind[0].getElementsByTagName("jid"),void(jidNode.length>0&&(this.jid=Strophe.getText(jidNode[0]),this.do_session?(this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2"),this.send($iq({type:"set",id:"_session_auth_2"}).c("session",{xmlns:Strophe.NS.SESSION}).tree())):(this.authenticated=!0,this._changeConnectStatus(Strophe.Status.CONNECTED,null))))):(Strophe.info("SASL binding failed."),this._changeConnectStatus(Strophe.Status.AUTHFAIL,null),!1)},_sasl_session_cb:function(elem){if("result"==elem.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(Strophe.Status.CONNECTED,null);else if("error"==elem.getAttribute("type"))return Strophe.info("Session creation failed."),this._changeConnectStatus(Strophe.Status.AUTHFAIL,null),!1;return!1},_sasl_failure_cb:function(){return this._sasl_success_handler&&(this.deleteHandler(this._sasl_success_handler),this._sasl_success_handler=null),this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_mechanism&&this._sasl_mechanism.onFailure(),this._changeConnectStatus(Strophe.Status.AUTHFAIL,null),!1},_auth2_cb:function(elem){return"result"==elem.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(Strophe.Status.CONNECTED,null)):"error"==elem.getAttribute("type")&&(this._changeConnectStatus(Strophe.Status.AUTHFAIL,null),this.disconnect("authentication failed")),!1},_addSysTimedHandler:function(period,handler){var thand=new Strophe.TimedHandler(period,handler);return thand.user=!1,this.addTimeds.push(thand),thand},_addSysHandler:function(handler,ns,name,type,id){var hand=new Strophe.Handler(handler,ns,name,type,id);return hand.user=!1,this.addHandlers.push(hand),hand},_onDisconnectTimeout:function(){return Strophe.info("_onDisconnectTimeout was called"),this._proto._onDisconnectTimeout(),this._doDisconnect(),!1},_onIdle:function(){for(var i,thand,since,newList;this.addTimeds.length>0;)this.timedHandlers.push(this.addTimeds.pop());for(;this.removeTimeds.length>0;)thand=this.removeTimeds.pop(),i=this.timedHandlers.indexOf(thand),i>=0&&this.timedHandlers.splice(i,1);var now=(new Date).getTime();for(newList=[],i=0;i<this.timedHandlers.length;i++)thand=this.timedHandlers[i],(this.authenticated||!thand.user)&&(since=thand.lastCalled+thand.period,0>=since-now?thand.run()&&newList.push(thand):newList.push(thand));this.timedHandlers=newList,clearTimeout(this._idleTimeout),this._proto._onIdle(),this.connected&&(this._idleTimeout=setTimeout(this._onIdle.bind(this),100))}},callback&&callback(Strophe,$build,$msg,$iq,$pres),Strophe.SASLMechanism=function(name,isClientFirst,priority){this.name=name,this.isClientFirst=isClientFirst,this.priority=priority},Strophe.SASLMechanism.prototype={test:function(){return!0},onStart:function(connection){this._connection=connection},onChallenge:function(){throw new Error("You should implement challenge handling!")},onFailure:function(){this._connection=null},onSuccess:function(){this._connection=null}},Strophe.SASLAnonymous=function(){},Strophe.SASLAnonymous.prototype=new Strophe.SASLMechanism("ANONYMOUS",!1,10),Strophe.SASLAnonymous.test=function(connection){return null===connection.authcid},Strophe.Connection.prototype.mechanisms[Strophe.SASLAnonymous.prototype.name]=Strophe.SASLAnonymous,Strophe.SASLPlain=function(){},Strophe.SASLPlain.prototype=new Strophe.SASLMechanism("PLAIN",!0,20),Strophe.SASLPlain.test=function(connection){return null!==connection.authcid},Strophe.SASLPlain.prototype.onChallenge=function(connection){var auth_str=connection.authzid;return auth_str+="\x00",auth_str+=connection.authcid,auth_str+="\x00",auth_str+=connection.pass},Strophe.Connection.prototype.mechanisms[Strophe.SASLPlain.prototype.name]=Strophe.SASLPlain,Strophe.SASLSHA1=function(){},Strophe.SASLSHA1.prototype=new Strophe.SASLMechanism("SCRAM-SHA-1",!0,40),Strophe.SASLSHA1.test=function(connection){return null!==connection.authcid},Strophe.SASLSHA1.prototype.onChallenge=function(connection,challenge,test_cnonce){var cnonce=test_cnonce||MD5.hexdigest(1234567890*Math.random()),auth_str="n="+connection.authcid;return auth_str+=",r=",auth_str+=cnonce,connection._sasl_data.cnonce=cnonce,connection._sasl_data["client-first-message-bare"]=auth_str,auth_str="n,,"+auth_str,this.onChallenge=function(connection,challenge){for(var nonce,salt,iter,Hi,U,U_old,i,k,clientKey,serverKey,clientSignature,responseText="c=biws,",authMessage=connection._sasl_data["client-first-message-bare"]+","+challenge+",",cnonce=connection._sasl_data.cnonce,attribMatch=/([a-z]+)=([^,]+)(,|$)/;challenge.match(attribMatch);){var matches=challenge.match(attribMatch);switch(challenge=challenge.replace(matches[0],""),matches[1]){case"r":nonce=matches[2];break;case"s":salt=matches[2];break;case"i":iter=matches[2]}}if(nonce.substr(0,cnonce.length)!==cnonce)return connection._sasl_data={},connection._sasl_failure_cb();for(responseText+="r="+nonce,authMessage+=responseText,salt=Base64.decode(salt),salt+="\x00\x00\x00",Hi=U_old=core_hmac_sha1(connection.pass,salt),i=1;iter>i;i++){for(U=core_hmac_sha1(connection.pass,binb2str(U_old)),k=0;5>k;k++)Hi[k]^=U[k];U_old=U}for(Hi=binb2str(Hi),clientKey=core_hmac_sha1(Hi,"Client Key"),serverKey=str_hmac_sha1(Hi,"Server Key"),clientSignature=core_hmac_sha1(str_sha1(binb2str(clientKey)),authMessage),connection._sasl_data["server-signature"]=b64_hmac_sha1(serverKey,authMessage),k=0;5>k;k++)clientKey[k]^=clientSignature[k];return responseText+=",p="+Base64.encode(binb2str(clientKey))}.bind(this),auth_str},Strophe.Connection.prototype.mechanisms[Strophe.SASLSHA1.prototype.name]=Strophe.SASLSHA1,Strophe.SASLMD5=function(){},Strophe.SASLMD5.prototype=new Strophe.SASLMechanism("DIGEST-MD5",!1,30),Strophe.SASLMD5.test=function(connection){return null!==connection.authcid},Strophe.SASLMD5.prototype._quote=function(str){return'"'+str.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'},Strophe.SASLMD5.prototype.onChallenge=function(connection,challenge,test_cnonce){for(var matches,attribMatch=/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/,cnonce=test_cnonce||MD5.hexdigest(""+1234567890*Math.random()),realm="",host=null,nonce="",qop="";challenge.match(attribMatch);)switch(matches=challenge.match(attribMatch),challenge=challenge.replace(matches[0],""),matches[2]=matches[2].replace(/^"(.+)"$/,"$1"),matches[1]){case"realm":realm=matches[2];break;case"nonce":nonce=matches[2];break;case"qop":qop=matches[2];break;case"host":host=matches[2]}var digest_uri=connection.servtype+"/"+connection.domain;null!==host&&(digest_uri=digest_uri+"/"+host);var A1=MD5.hash(connection.authcid+":"+realm+":"+this._connection.pass)+":"+nonce+":"+cnonce,A2="AUTHENTICATE:"+digest_uri,responseText="";return responseText+="charset=utf-8,",responseText+="username="+this._quote(connection.authcid)+",",responseText+="realm="+this._quote(realm)+",",responseText+="nonce="+this._quote(nonce)+",",responseText+="nc=00000001,",responseText+="cnonce="+this._quote(cnonce)+",",responseText+="digest-uri="+this._quote(digest_uri)+",",responseText+="response="+MD5.hexdigest(MD5.hexdigest(A1)+":"+nonce+":00000001:"+cnonce+":auth:"+MD5.hexdigest(A2))+",",responseText+="qop=auth",this.onChallenge=function(){return""
28
+ }.bind(this),responseText},Strophe.Connection.prototype.mechanisms[Strophe.SASLMD5.prototype.name]=Strophe.SASLMD5}(function(){window.Strophe=arguments[0],window.$build=arguments[1],window.$msg=arguments[2],window.$iq=arguments[3],window.$pres=arguments[4]}),Strophe.Request=function(elem,func,rid,sends){this.id=++Strophe._requestId,this.xmlData=elem,this.data=Strophe.serialize(elem),this.origFunc=func,this.func=func,this.rid=rid,this.date=0/0,this.sends=sends||0,this.abort=!1,this.dead=null,this.age=function(){if(!this.date)return 0;var now=new Date;return(now-this.date)/1e3},this.timeDead=function(){if(!this.dead)return 0;var now=new Date;return(now-this.dead)/1e3},this.xhr=this._newXHR()},Strophe.Request.prototype={getResponse:function(){var node=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){if(node=this.xhr.responseXML.documentElement,"parsererror"==node.tagName)throw Strophe.error("invalid response received"),Strophe.error("responseText: "+this.xhr.responseText),Strophe.error("responseXML: "+Strophe.serialize(this.xhr.responseXML)),"parsererror"}else this.xhr.responseText&&(Strophe.error("invalid response received"),Strophe.error("responseText: "+this.xhr.responseText),Strophe.error("responseXML: "+Strophe.serialize(this.xhr.responseXML)));return node},_newXHR:function(){var xhr=null;return window.XMLHttpRequest?(xhr=new XMLHttpRequest,xhr.overrideMimeType&&xhr.overrideMimeType("text/xml")):window.ActiveXObject&&(xhr=new ActiveXObject("Microsoft.XMLHTTP")),xhr.onreadystatechange=this.func.bind(null,this),xhr}},Strophe.Bosh=function(connection){this._conn=connection,this.rid=Math.floor(4294967295*Math.random()),this.sid=null,this.hold=1,this.wait=60,this.window=5,this._requests=[]},Strophe.Bosh.prototype={strip:null,_buildBody:function(){var bodyWrap=$build("body",{rid:this.rid++,xmlns:Strophe.NS.HTTPBIND});return null!==this.sid&&bodyWrap.attrs({sid:this.sid}),bodyWrap},_reset:function(){this.rid=Math.floor(4294967295*Math.random()),this.sid=null,jQuery(document).trigger("ridChange",{rid:this.rid})},_connect:function(wait,hold,route){this.wait=wait||this.wait,this.hold=hold||this.hold;var body=this._buildBody().attrs({to:this._conn.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":Strophe.NS.BOSH});route&&body.attrs({route:route});var _connect_cb=this._conn._connect_cb;this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this,_connect_cb.bind(this._conn)),body.tree().getAttribute("rid"))),this._throttledRequestHandler()},_attach:function(jid,sid,rid,callback,wait,hold,wind){this._conn.jid=jid,this.sid=sid,this.rid=rid,this._conn.connect_callback=callback,this._conn.domain=Strophe.getDomainFromJid(this._conn.jid),this._conn.authenticated=!0,this._conn.connected=!0,this.wait=wait||this.wait,this.hold=hold||this.hold,this.window=wind||this.window,this._conn._changeConnectStatus(Strophe.Status.ATTACHED,null)},_connect_cb:function(bodyWrap){var cond,conflict,typ=bodyWrap.getAttribute("type");if(null!==typ&&"terminate"==typ)return Strophe.error("BOSH-Connection failed: "+cond),cond=bodyWrap.getAttribute("condition"),conflict=bodyWrap.getElementsByTagName("conflict"),null!==cond?("remote-stream-error"==cond&&conflict.length>0&&(cond="conflict"),this._conn._changeConnectStatus(Strophe.Status.CONNFAIL,cond)):this._conn._changeConnectStatus(Strophe.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(),Strophe.Status.CONNFAIL;this.sid||(this.sid=bodyWrap.getAttribute("sid"));var wind=bodyWrap.getAttribute("requests");wind&&(this.window=parseInt(wind,10));var hold=bodyWrap.getAttribute("hold");hold&&(this.hold=parseInt(hold,10));var wait=bodyWrap.getAttribute("wait");wait&&(this.wait=parseInt(wait,10))},_disconnect:function(pres){this._sendTerminate(pres)},_doDisconnect:function(){this.sid=null,this.rid=Math.floor(4294967295*Math.random()),jQuery(document).trigger("ridChange",{rid:this.rid})},_emptyQueue:function(){return 0===this._requests.length},_hitError:function(reqStatus){this.errors++,Strophe.warn("request errored, status: "+reqStatus+", number of errors: "+this.errors),this.errors>4&&this._onDisconnectTimeout()},_no_auth_received:function(_callback){_callback=_callback?_callback.bind(this._conn):this._conn._connect_cb.bind(this._conn);var body=this._buildBody();this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this,_callback.bind(this._conn)),body.tree().getAttribute("rid"))),this._throttledRequestHandler()},_onDisconnectTimeout:function(){for(var req;this._requests.length>0;)req=this._requests.pop(),req.abort=!0,req.xhr.abort(),req.xhr.onreadystatechange=function(){}},_onIdle:function(){var data=this._conn._data;if(this._conn.authenticated&&0===this._requests.length&&0===data.length&&!this._conn.disconnecting&&(Strophe.info("no requests during idle cycle, sending blank request"),data.push(null)),this._requests.length<2&&data.length>0&&!this._conn.paused){for(var body=this._buildBody(),i=0;i<data.length;i++)null!==data[i]&&("restart"===data[i]?body.attrs({to:this._conn.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":Strophe.NS.BOSH}):body.cnode(data[i]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),body.tree().getAttribute("rid"))),this._processRequest(this._requests.length-1)}if(this._requests.length>0){var time_elapsed=this._requests[0].age();null!==this._requests[0].dead&&this._requests[0].timeDead()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),time_elapsed>Math.floor(Strophe.TIMEOUT*this.wait)&&(Strophe.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(Strophe.TIMEOUT*this.wait)+" seconds since last activity"),this._throttledRequestHandler())}},_onRequestStateChange:function(func,req){if(Strophe.debug("request id "+req.id+"."+req.sends+" state changed to "+req.xhr.readyState),req.abort)return void(req.abort=!1);2==req.xhr.readyState&&jQuery(document).trigger("ridChange",{rid:Number(req.rid)+1});var reqStatus;if(4==req.xhr.readyState){reqStatus=0;try{reqStatus=req.xhr.status}catch(e){}if("undefined"==typeof reqStatus&&(reqStatus=0),this.disconnecting&&reqStatus>=400)return void this._hitError(reqStatus);var reqIs0=this._requests[0]==req,reqIs1=this._requests[1]==req;(reqStatus>0&&500>reqStatus||req.sends>5)&&(this._removeRequest(req),Strophe.debug("request id "+req.id+" should now be removed")),200==reqStatus?((reqIs1||reqIs0&&this._requests.length>0&&this._requests[0].age()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),Strophe.debug("request id "+req.id+"."+req.sends+" got 200"),func(req),this.errors=0):(Strophe.error("request id "+req.id+"."+req.sends+" error "+reqStatus+" happened"),(0===reqStatus||reqStatus>=400&&600>reqStatus||reqStatus>=12e3)&&(this._hitError(reqStatus),reqStatus>=400&&500>reqStatus&&(this._conn._changeConnectStatus(Strophe.Status.DISCONNECTING,null),this._conn._doDisconnect()))),reqStatus>0&&500>reqStatus||req.sends>5||this._throttledRequestHandler()}},_processRequest:function(i){var self=this,req=this._requests[i],reqStatus=-1;try{4==req.xhr.readyState&&(reqStatus=req.xhr.status)}catch(e){Strophe.error("caught an error in _requests["+i+"], reqStatus: "+reqStatus)}if("undefined"==typeof reqStatus&&(reqStatus=-1),req.sends>this.maxRetries)return void this._onDisconnectTimeout();var time_elapsed=req.age(),primaryTimeout=!isNaN(time_elapsed)&&time_elapsed>Math.floor(Strophe.TIMEOUT*this.wait),secondaryTimeout=null!==req.dead&&req.timeDead()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait),requestCompletedWithServerError=4==req.xhr.readyState&&(1>reqStatus||reqStatus>=500);if((primaryTimeout||secondaryTimeout||requestCompletedWithServerError)&&(secondaryTimeout&&Strophe.error("Request "+this._requests[i].id+" timed out (secondary), restarting"),req.abort=!0,req.xhr.abort(),req.xhr.onreadystatechange=function(){},this._requests[i]=new Strophe.Request(req.xmlData,req.origFunc,req.rid,req.sends),req=this._requests[i]),0===req.xhr.readyState){Strophe.debug("request id "+req.id+"."+req.sends+" posting");try{req.xhr.open("POST",this._conn.service,this._conn.options.sync?!1:!0)}catch(e2){return Strophe.error("XHR open failed."),this._conn.connected||this._conn._changeConnectStatus(Strophe.Status.CONNFAIL,"bad-service"),void this._conn.disconnect()}var sendFunc=function(){if(req.date=new Date,self._conn.options.customHeaders){var headers=self._conn.options.customHeaders;for(var header in headers)headers.hasOwnProperty(header)&&req.xhr.setRequestHeader(header,headers[header])}req.xhr.send(req.data)};if(req.sends>1){var backoff=1e3*Math.min(Math.floor(Strophe.TIMEOUT*this.wait),Math.pow(req.sends,3));setTimeout(sendFunc,backoff)}else sendFunc();req.sends++,this._conn.xmlOutput!==Strophe.Connection.prototype.xmlOutput&&this._conn.xmlOutput(req.xmlData.nodeName===this.strip&&req.xmlData.childNodes.length?req.xmlData.childNodes[0]:req.xmlData),this._conn.rawOutput!==Strophe.Connection.prototype.rawOutput&&this._conn.rawOutput(req.data)}else Strophe.debug("_processRequest: "+(0===i?"first":"second")+" request has readyState of "+req.xhr.readyState)},_removeRequest:function(req){Strophe.debug("removing request");var i;for(i=this._requests.length-1;i>=0;i--)req==this._requests[i]&&this._requests.splice(i,1);req.xhr.onreadystatechange=function(){},this._throttledRequestHandler()},_restartRequest:function(i){var req=this._requests[i];null===req.dead&&(req.dead=new Date),this._processRequest(i)},_reqToData:function(req){try{return req.getResponse()}catch(e){if("parsererror"!=e)throw e;this._conn.disconnect("strophe-parsererror")}},_sendTerminate:function(pres){Strophe.info("_sendTerminate was called");var body=this._buildBody().attrs({type:"terminate"});pres&&body.cnode(pres.tree());var req=new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),body.tree().getAttribute("rid"));this._requests.push(req),this._throttledRequestHandler()},_send:function(){clearTimeout(this._conn._idleTimeout),this._throttledRequestHandler(),this._conn._idleTimeout=setTimeout(this._conn._onIdle.bind(this._conn),100)},_sendRestart:function(){this._throttledRequestHandler(),clearTimeout(this._conn._idleTimeout)},_throttledRequestHandler:function(){Strophe.debug(this._requests?"_throttledRequestHandler called with "+this._requests.length+" requests":"_throttledRequestHandler called with undefined requests"),this._requests&&0!==this._requests.length&&(this._requests.length>0&&this._processRequest(0),this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid)<this.window&&this._processRequest(1))}},Strophe.Websocket=function(connection){this._conn=connection,this.strip="stream:stream";var service=connection.service;if(0!==service.indexOf("ws:")&&0!==service.indexOf("wss:")){var new_service="";new_service+="ws"===connection.options.protocol&&"https:"!==window.location.protocol?"ws":"wss",new_service+="://"+window.location.host,new_service+=0!==service.indexOf("/")?window.location.pathname+service:service,connection.service=new_service}},Strophe.Websocket.prototype={_buildStream:function(){return $build("stream:stream",{to:this._conn.domain,xmlns:Strophe.NS.CLIENT,"xmlns:stream":Strophe.NS.STREAM,version:"1.0"})},_check_streamerror:function(bodyWrap,connectstatus){var errors=bodyWrap.getElementsByTagName("stream:error");if(0===errors.length)return!1;for(var error=errors[0],condition="",text="",ns="urn:ietf:params:xml:ns:xmpp-streams",i=0;i<error.childNodes.length;i++){var e=error.childNodes[i];if(e.getAttribute("xmlns")!==ns)break;"text"===e.nodeName?text=e.textContent:condition=e.nodeName}var errorString="WebSocket stream error: ";return errorString+=condition?condition:"unknown",text&&(errorString+=" - "+condition),Strophe.error(errorString),this._conn._changeConnectStatus(connectstatus,condition),this._conn._doDisconnect(),!0},_reset:function(){},_connect:function(){this._closeSocket(),this.socket=new WebSocket(this._conn.service,"xmpp"),this.socket.onopen=this._onOpen.bind(this),this.socket.onerror=this._onError.bind(this),this.socket.onclose=this._onClose.bind(this),this.socket.onmessage=this._connect_cb_wrapper.bind(this)},_connect_cb:function(bodyWrap){var error=this._check_streamerror(bodyWrap,Strophe.Status.CONNFAIL);return error?Strophe.Status.CONNFAIL:void 0},_handleStreamStart:function(message){var error=!1,ns=message.getAttribute("xmlns");"string"!=typeof ns?error="Missing xmlns in stream:stream":ns!==Strophe.NS.CLIENT&&(error="Wrong xmlns in stream:stream: "+ns);var ns_stream=message.namespaceURI;"string"!=typeof ns_stream?error="Missing xmlns:stream in stream:stream":ns_stream!==Strophe.NS.STREAM&&(error="Wrong xmlns:stream in stream:stream: "+ns_stream);var ver=message.getAttribute("version");return"string"!=typeof ver?error="Missing version in stream:stream":"1.0"!==ver&&(error="Wrong version in stream:stream: "+ver),error?(this._conn._changeConnectStatus(Strophe.Status.CONNFAIL,error),this._conn._doDisconnect(),!1):!0},_connect_cb_wrapper:function(message){if(0===message.data.indexOf("<stream:stream ")||0===message.data.indexOf("<?xml")){var data=message.data.replace(/^(<\?.*?\?>\s*)*/,"");if(""===data)return;data=message.data.replace(/<stream:stream (.*[^\/])>/,"<stream:stream $1/>");var streamStart=(new DOMParser).parseFromString(data,"text/xml").documentElement;this._conn.xmlInput(streamStart),this._conn.rawInput(message.data),this._handleStreamStart(streamStart)&&(this._connect_cb(streamStart),this.streamStart=message.data.replace(/^<stream:(.*)\/>$/,"<stream:$1>"))}else{if("</stream:stream>"===message.data)return this._conn.rawInput(message.data),this._conn.xmlInput(document.createElement("stream:stream")),this._conn._changeConnectStatus(Strophe.Status.CONNFAIL,"Received closing stream"),void this._conn._doDisconnect();var string=this._streamWrap(message.data),elem=(new DOMParser).parseFromString(string,"text/xml").documentElement;this.socket.onmessage=this._onMessage.bind(this),this._conn._connect_cb(elem,null,message.data)}},_disconnect:function(pres){if(this.socket.readyState!==WebSocket.CLOSED){pres&&this._conn.send(pres);var close="</stream:stream>";this._conn.xmlOutput(document.createElement("stream:stream")),this._conn.rawOutput(close);try{this.socket.send(close)}catch(e){Strophe.info("Couldn't send closing stream tag.")}}this._conn._doDisconnect()},_doDisconnect:function(){Strophe.info("WebSockets _doDisconnect was called"),this._closeSocket()},_streamWrap:function(stanza){return this.streamStart+stanza+"</stream:stream>"},_closeSocket:function(){if(this.socket)try{this.socket.close()}catch(e){}this.socket=null},_emptyQueue:function(){return!0},_onClose:function(){this._conn.connected&&!this._conn.disconnecting?(Strophe.error("Websocket closed unexcectedly"),this._conn._doDisconnect()):Strophe.info("Websocket closed")},_no_auth_received:function(_callback){Strophe.error("Server did not send any auth methods"),this._conn._changeConnectStatus(Strophe.Status.CONNFAIL,"Server did not send any auth methods"),_callback&&(_callback=_callback.bind(this._conn))(),this._conn._doDisconnect()},_onDisconnectTimeout:function(){},_onError:function(error){Strophe.error("Websocket error "+error),this._conn._changeConnectStatus(Strophe.Status.CONNFAIL,"The WebSocket connection could not be established was disconnected."),this._disconnect()},_onIdle:function(){var data=this._conn._data;if(data.length>0&&!this._conn.paused){for(var i=0;i<data.length;i++)if(null!==data[i]){var stanza,rawStanza;"restart"===data[i]?(stanza=this._buildStream(),rawStanza=this._removeClosingTag(stanza),stanza=stanza.tree()):(stanza=data[i],rawStanza=Strophe.serialize(stanza)),this._conn.xmlOutput(stanza),this._conn.rawOutput(rawStanza),this.socket.send(rawStanza)}this._conn._data=[]}},_onMessage:function(message){var elem,data;if("</stream:stream>"===message.data){var close="</stream:stream>";return this._conn.rawInput(close),this._conn.xmlInput(document.createElement("stream:stream")),void(this._conn.disconnecting||this._conn._doDisconnect())}if(0===message.data.search("<stream:stream ")){if(data=message.data.replace(/<stream:stream (.*[^\/])>/,"<stream:stream $1/>"),elem=(new DOMParser).parseFromString(data,"text/xml").documentElement,!this._handleStreamStart(elem))return}else data=this._streamWrap(message.data),elem=(new DOMParser).parseFromString(data,"text/xml").documentElement;if(!this._check_streamerror(elem,Strophe.Status.ERROR))return this._conn.disconnecting&&"presence"===elem.firstChild.nodeName&&"unavailable"===elem.firstChild.getAttribute("type")?(this._conn.xmlInput(elem),void this._conn.rawInput(Strophe.serialize(elem))):void this._conn._dataRecv(elem,message.data)},_onOpen:function(){Strophe.info("Websocket open");var start=this._buildStream();this._conn.xmlOutput(start.tree());var startString=this._removeClosingTag(start);this._conn.rawOutput(startString),this.socket.send(startString)},_removeClosingTag:function(elem){var string=Strophe.serialize(elem);return string=string.replace(/<(stream:stream .*[^\/])\/>$/,"<$1>")},_reqToData:function(stanza){return stanza},_send:function(){this._conn.flush()},_sendRestart:function(){clearTimeout(this._conn._idleTimeout),this._conn._onIdle.bind(this._conn)()}};/*!
29
+ * Source: build/lib/strophe.muc.js, license: MIT, url: https://github.com/strophe/strophejs-plugins */
30
+ var Occupant,RoomConfig,XmppRoom,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};Strophe.addConnectionPlugin("muc",{_connection:null,rooms:{},roomNames:[],init:function(conn){return this._connection=conn,this._muc_handler=null,Strophe.addNamespace("MUC_OWNER",Strophe.NS.MUC+"#owner"),Strophe.addNamespace("MUC_ADMIN",Strophe.NS.MUC+"#admin"),Strophe.addNamespace("MUC_USER",Strophe.NS.MUC+"#user"),Strophe.addNamespace("MUC_ROOMCONF",Strophe.NS.MUC+"#roomconfig")},join:function(room,nick,msg_handler_cb,pres_handler_cb,roster_cb,password,history_attrs,extended_presence){var msg,room_nick,_ref,_this=this;return room_nick=this.test_append_nick(room,nick),msg=$pres({from:this._connection.jid,to:room_nick}).c("x",{xmlns:Strophe.NS.MUC}),null!=history_attrs&&(msg=msg.c("history",history_attrs).up()),null!=password&&msg.cnode(Strophe.xmlElement("password",[],password)),null!=extended_presence&&msg.up().cnode(extended_presence),null==(_ref=this._muc_handler)&&(this._muc_handler=this._connection.addHandler(function(stanza){var from,handler,handlers,id,roomname,x,xmlns,xquery,_i,_len;if(from=stanza.getAttribute("from"),!from)return!0;if(roomname=from.split("/")[0],!_this.rooms[roomname])return!0;if(room=_this.rooms[roomname],handlers={},"message"===stanza.nodeName)handlers=room._message_handlers;else if("presence"===stanza.nodeName&&(xquery=stanza.getElementsByTagName("x"),xquery.length>0))for(_i=0,_len=xquery.length;_len>_i;_i++)if(x=xquery[_i],xmlns=x.getAttribute("xmlns"),xmlns&&xmlns.match(Strophe.NS.MUC)){handlers=room._presence_handlers;break}for(id in handlers)handler=handlers[id],handler(stanza,room)||delete handlers[id];return!0})),this.rooms.hasOwnProperty(room)||(this.rooms[room]=new XmppRoom(this,room,nick,password),this.roomNames.push(room)),pres_handler_cb&&this.rooms[room].addHandler("presence",pres_handler_cb),msg_handler_cb&&this.rooms[room].addHandler("message",msg_handler_cb),roster_cb&&this.rooms[room].addHandler("roster",roster_cb),this._connection.send(msg)},leave:function(room,nick,handler_cb,exit_msg){var id,presence,presenceid,room_nick;return id=this.roomNames.indexOf(room),delete this.rooms[room],id>=0&&(this.roomNames.splice(id,1),0===this.roomNames.length&&(this._connection.deleteHandler(this._muc_handler),this._muc_handler=null)),room_nick=this.test_append_nick(room,nick),presenceid=this._connection.getUniqueId(),presence=$pres({type:"unavailable",id:presenceid,from:this._connection.jid,to:room_nick}),null!=exit_msg&&presence.c("status",exit_msg),null!=handler_cb&&this._connection.addHandler(handler_cb,null,"presence",null,presenceid),this._connection.send(presence),presenceid},message:function(room,nick,message,html_message,type){var msg,msgid,parent,room_nick;return room_nick=this.test_append_nick(room,nick),type=type||(null!=nick?"chat":"groupchat"),msgid=this._connection.getUniqueId(),msg=$msg({to:room_nick,from:this._connection.jid,type:type,id:msgid}).c("body",{xmlns:Strophe.NS.CLIENT}).t(message),msg.up(),null!=html_message&&(msg.c("html",{xmlns:Strophe.NS.XHTML_IM}).c("body",{xmlns:Strophe.NS.XHTML}).t(html_message),0===msg.node.childNodes.length?(parent=msg.node.parentNode,msg.up().up(),msg.node.removeChild(parent)):msg.up().up()),msg.c("x",{xmlns:"jabber:x:event"}).c("composing"),this._connection.send(msg),msgid},groupchat:function(room,message,html_message){return this.message(room,null,message,html_message)},invite:function(room,receiver,reason){var invitation,msgid;return msgid=this._connection.getUniqueId(),invitation=$msg({from:this._connection.jid,to:room,id:msgid}).c("x",{xmlns:Strophe.NS.MUC_USER}).c("invite",{to:receiver}),null!=reason&&invitation.c("reason",reason),this._connection.send(invitation),msgid},directInvite:function(room,receiver,reason,password){var attrs,invitation,msgid;return msgid=this._connection.getUniqueId(),attrs={xmlns:"jabber:x:conference",jid:room},null!=reason&&(attrs.reason=reason),null!=password&&(attrs.password=password),invitation=$msg({from:this._connection.jid,to:receiver,id:msgid}).c("x",attrs),this._connection.send(invitation),msgid},queryOccupants:function(room,success_cb,error_cb){var attrs,info;return attrs={xmlns:Strophe.NS.DISCO_ITEMS},info=$iq({from:this._connection.jid,to:room,type:"get"}).c("query",attrs),this._connection.sendIQ(info,success_cb,error_cb)},configure:function(room,handler_cb,error_cb){var config,stanza;return config=$iq({to:room,type:"get"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}),stanza=config.tree(),this._connection.sendIQ(stanza,handler_cb,error_cb)},cancelConfigure:function(room){var config,stanza;return config=$iq({to:room,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).c("x",{xmlns:"jabber:x:data",type:"cancel"}),stanza=config.tree(),this._connection.sendIQ(stanza)},saveConfiguration:function(room,config,success_cb,error_cb){var conf,iq,stanza,_i,_len;if(iq=$iq({to:room,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}),config instanceof Form)config.type="submit",iq.cnode(config.toXML());else for(iq.c("x",{xmlns:"jabber:x:data",type:"submit"}),_i=0,_len=config.length;_len>_i;_i++)conf=config[_i],iq.cnode(conf).up();return stanza=iq.tree(),this._connection.sendIQ(stanza,success_cb,error_cb)},createInstantRoom:function(room,success_cb,error_cb){var roomiq;return roomiq=$iq({to:room,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).c("x",{xmlns:"jabber:x:data",type:"submit"}),this._connection.sendIQ(roomiq.tree(),success_cb,error_cb)},setTopic:function(room,topic){var msg;return msg=$msg({to:room,from:this._connection.jid,type:"groupchat"}).c("subject",{xmlns:"jabber:client"}).t(topic),this._connection.send(msg.tree())},_modifyPrivilege:function(room,item,reason,handler_cb,error_cb){var iq;return iq=$iq({to:room,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_ADMIN}).cnode(item.node),null!=reason&&iq.c("reason",reason),this._connection.sendIQ(iq.tree(),handler_cb,error_cb)},modifyRole:function(room,nick,role,reason,handler_cb,error_cb){var item;return item=$build("item",{nick:nick,role:role}),this._modifyPrivilege(room,item,reason,handler_cb,error_cb)},kick:function(room,nick,reason,handler_cb,error_cb){return this.modifyRole(room,nick,"none",reason,handler_cb,error_cb)},voice:function(room,nick,reason,handler_cb,error_cb){return this.modifyRole(room,nick,"participant",reason,handler_cb,error_cb)},mute:function(room,nick,reason,handler_cb,error_cb){return this.modifyRole(room,nick,"visitor",reason,handler_cb,error_cb)},op:function(room,nick,reason,handler_cb,error_cb){return this.modifyRole(room,nick,"moderator",reason,handler_cb,error_cb)},deop:function(room,nick,reason,handler_cb,error_cb){return this.modifyRole(room,nick,"participant",reason,handler_cb,error_cb)},modifyAffiliation:function(room,jid,affiliation,reason,handler_cb,error_cb){var item;return item=$build("item",{jid:jid,affiliation:affiliation}),this._modifyPrivilege(room,item,reason,handler_cb,error_cb)},ban:function(room,jid,reason,handler_cb,error_cb){return this.modifyAffiliation(room,jid,"outcast",reason,handler_cb,error_cb)},member:function(room,jid,reason,handler_cb,error_cb){return this.modifyAffiliation(room,jid,"member",reason,handler_cb,error_cb)},revoke:function(room,jid,reason,handler_cb,error_cb){return this.modifyAffiliation(room,jid,"none",reason,handler_cb,error_cb)},owner:function(room,jid,reason,handler_cb,error_cb){return this.modifyAffiliation(room,jid,"owner",reason,handler_cb,error_cb)},admin:function(room,jid,reason,handler_cb,error_cb){return this.modifyAffiliation(room,jid,"admin",reason,handler_cb,error_cb)},changeNick:function(room,user){var presence,room_nick;return room_nick=this.test_append_nick(room,user),presence=$pres({from:this._connection.jid,to:room_nick,id:this._connection.getUniqueId()}),this._connection.send(presence.tree())},setStatus:function(room,user,show,status){var presence,room_nick;return room_nick=this.test_append_nick(room,user),presence=$pres({from:this._connection.jid,to:room_nick}),null!=show&&presence.c("show",show).up(),null!=status&&presence.c("status",status),this._connection.send(presence.tree())},listRooms:function(server,handle_cb,error_cb){var iq;return iq=$iq({to:server,from:this._connection.jid,type:"get"}).c("query",{xmlns:Strophe.NS.DISCO_ITEMS}),this._connection.sendIQ(iq,handle_cb,error_cb)},test_append_nick:function(room,nick){return room+(null!=nick?"/"+Strophe.escapeNode(nick):"")}}),XmppRoom=function(){function XmppRoom(client,name,nick,password){this.client=client,this.name=name,this.nick=nick,this.password=password,this._roomRosterHandler=__bind(this._roomRosterHandler,this),this._addOccupant=__bind(this._addOccupant,this),this.roster={},this._message_handlers={},this._presence_handlers={},this._roster_handlers={},this._handler_ids=0,client.muc&&(this.client=client.muc),this.name=Strophe.getBareJidFromJid(name),this.addHandler("presence",this._roomRosterHandler)}return XmppRoom.prototype.join=function(msg_handler_cb,pres_handler_cb,roster_cb){return this.client.join(this.name,this.nick,msg_handler_cb,pres_handler_cb,roster_cb,this.password)},XmppRoom.prototype.leave=function(handler_cb,message){return this.client.leave(this.name,this.nick,handler_cb,message),delete this.client.rooms[this.name]},XmppRoom.prototype.message=function(nick,message,html_message,type){return this.client.message(this.name,nick,message,html_message,type)},XmppRoom.prototype.groupchat=function(message,html_message){return this.client.groupchat(this.name,message,html_message)},XmppRoom.prototype.invite=function(receiver,reason){return this.client.invite(this.name,receiver,reason)},XmppRoom.prototype.directInvite=function(receiver,reason){return this.client.directInvite(this.name,receiver,reason,this.password)},XmppRoom.prototype.configure=function(handler_cb){return this.client.configure(this.name,handler_cb)},XmppRoom.prototype.cancelConfigure=function(){return this.client.cancelConfigure(this.name)},XmppRoom.prototype.saveConfiguration=function(config){return this.client.saveConfiguration(this.name,config)},XmppRoom.prototype.queryOccupants=function(success_cb,error_cb){return this.client.queryOccupants(this.name,success_cb,error_cb)},XmppRoom.prototype.setTopic=function(topic){return this.client.setTopic(this.name,topic)},XmppRoom.prototype.modifyRole=function(nick,role,reason,success_cb,error_cb){return this.client.modifyRole(this.name,nick,role,reason,success_cb,error_cb)},XmppRoom.prototype.kick=function(nick,reason,handler_cb,error_cb){return this.client.kick(this.name,nick,reason,handler_cb,error_cb)},XmppRoom.prototype.voice=function(nick,reason,handler_cb,error_cb){return this.client.voice(this.name,nick,reason,handler_cb,error_cb)},XmppRoom.prototype.mute=function(nick,reason,handler_cb,error_cb){return this.client.mute(this.name,nick,reason,handler_cb,error_cb)},XmppRoom.prototype.op=function(nick,reason,handler_cb,error_cb){return this.client.op(this.name,nick,reason,handler_cb,error_cb)},XmppRoom.prototype.deop=function(nick,reason,handler_cb,error_cb){return this.client.deop(this.name,nick,reason,handler_cb,error_cb)},XmppRoom.prototype.modifyAffiliation=function(jid,affiliation,reason,success_cb,error_cb){return this.client.modifyAffiliation(this.name,jid,affiliation,reason,success_cb,error_cb)},XmppRoom.prototype.ban=function(jid,reason,handler_cb,error_cb){return this.client.ban(this.name,jid,reason,handler_cb,error_cb)},XmppRoom.prototype.member=function(jid,reason,handler_cb,error_cb){return this.client.member(this.name,jid,reason,handler_cb,error_cb)},XmppRoom.prototype.revoke=function(jid,reason,handler_cb,error_cb){return this.client.revoke(this.name,jid,reason,handler_cb,error_cb)},XmppRoom.prototype.owner=function(jid,reason,handler_cb,error_cb){return this.client.owner(this.name,jid,reason,handler_cb,error_cb)},XmppRoom.prototype.admin=function(jid,reason,handler_cb,error_cb){return this.client.admin(this.name,jid,reason,handler_cb,error_cb)},XmppRoom.prototype.changeNick=function(nick){return this.nick=nick,this.client.changeNick(this.name,nick)},XmppRoom.prototype.setStatus=function(show,status){return this.client.setStatus(this.name,this.nick,show,status)},XmppRoom.prototype.addHandler=function(handler_type,handler){var id;switch(id=this._handler_ids++,handler_type){case"presence":this._presence_handlers[id]=handler;break;case"message":this._message_handlers[id]=handler;break;case"roster":this._roster_handlers[id]=handler;break;default:return this._handler_ids--,null}return id},XmppRoom.prototype.removeHandler=function(id){return delete this._presence_handlers[id],delete this._message_handlers[id],delete this._roster_handlers[id]},XmppRoom.prototype._addOccupant=function(data){var occ;return occ=new Occupant(data,this),this.roster[occ.nick]=occ,occ},XmppRoom.prototype._roomRosterHandler=function(pres){var data,handler,id,newnick,nick,_ref;switch(data=XmppRoom._parsePresence(pres),nick=data.nick,newnick=data.newnick||null,data.type){case"error":return;case"unavailable":newnick&&(data.nick=newnick,this.roster[nick]&&this.roster[newnick]&&(this.roster[nick].update(this.roster[newnick]),this.roster[newnick]=this.roster[nick]),this.roster[nick]&&!this.roster[newnick]&&(this.roster[newnick]=this.roster[nick].update(data))),delete this.roster[nick];break;default:this.roster[nick]?this.roster[nick].update(data):this._addOccupant(data)}_ref=this._roster_handlers;for(id in _ref)handler=_ref[id],handler(this.roster,this)||delete this._roster_handlers[id];return!0},XmppRoom._parsePresence=function(pres){var a,c,c2,data,_i,_j,_len,_len1,_ref,_ref1,_ref2,_ref3,_ref4,_ref5,_ref6,_ref7;for(data={},a=pres.attributes,data.nick=Strophe.getResourceFromJid(a.from.textContent),data.type=(null!=(_ref=a.type)?_ref.textContent:void 0)||null,data.states=[],_ref1=pres.childNodes,_i=0,_len=_ref1.length;_len>_i;_i++)switch(c=_ref1[_i],c.nodeName){case"status":data.status=c.textContent||null;break;case"show":data.show=c.textContent||null;break;case"x":if(a=c.attributes,(null!=(_ref2=a.xmlns)?_ref2.textContent:void 0)===Strophe.NS.MUC_USER)for(_ref3=c.childNodes,_j=0,_len1=_ref3.length;_len1>_j;_j++)switch(c2=_ref3[_j],c2.nodeName){case"item":a=c2.attributes,data.affiliation=(null!=(_ref4=a.affiliation)?_ref4.textContent:void 0)||null,data.role=(null!=(_ref5=a.role)?_ref5.textContent:void 0)||null,data.jid=(null!=(_ref6=a.jid)?_ref6.textContent:void 0)||null,data.newnick=(null!=(_ref7=a.nick)?_ref7.textContent:void 0)||null;break;case"status":c2.attributes.code&&data.states.push(c2.attributes.code.textContent)}}return data},XmppRoom}(),RoomConfig=function(){function RoomConfig(info){this.parse=__bind(this.parse,this),null!=info&&this.parse(info)}return RoomConfig.prototype.parse=function(result){var attr,attrs,child,field,identity,query,_i,_j,_k,_len,_len1,_len2,_ref;for(query=result.getElementsByTagName("query")[0].childNodes,this.identities=[],this.features=[],this.x=[],_i=0,_len=query.length;_len>_i;_i++)switch(child=query[_i],attrs=child.attributes,child.nodeName){case"identity":for(identity={},_j=0,_len1=attrs.length;_len1>_j;_j++)attr=attrs[_j],identity[attr.name]=attr.textContent;this.identities.push(identity);break;case"feature":this.features.push(attrs["var"].textContent);break;case"x":if(attrs=child.childNodes[0].attributes,"FORM_TYPE"===!attrs["var"].textContent||"hidden"===!attrs.type.textContent)break;for(_ref=child.childNodes,_k=0,_len2=_ref.length;_len2>_k;_k++)field=_ref[_k],field.attributes.type||(attrs=field.attributes,this.x.push({"var":attrs["var"].textContent,label:attrs.label.textContent||"",value:field.firstChild.textContent||""}))}return{identities:this.identities,features:this.features,x:this.x}},RoomConfig}(),Occupant=function(){function Occupant(data,room){this.room=room,this.update=__bind(this.update,this),this.admin=__bind(this.admin,this),this.owner=__bind(this.owner,this),this.revoke=__bind(this.revoke,this),this.member=__bind(this.member,this),this.ban=__bind(this.ban,this),this.modifyAffiliation=__bind(this.modifyAffiliation,this),this.deop=__bind(this.deop,this),this.op=__bind(this.op,this),this.mute=__bind(this.mute,this),this.voice=__bind(this.voice,this),this.kick=__bind(this.kick,this),this.modifyRole=__bind(this.modifyRole,this),this.update(data)}return Occupant.prototype.modifyRole=function(role,reason,success_cb,error_cb){return this.room.modifyRole(this.nick,role,reason,success_cb,error_cb)},Occupant.prototype.kick=function(reason,handler_cb,error_cb){return this.room.kick(this.nick,reason,handler_cb,error_cb)},Occupant.prototype.voice=function(reason,handler_cb,error_cb){return this.room.voice(this.nick,reason,handler_cb,error_cb)},Occupant.prototype.mute=function(reason,handler_cb,error_cb){return this.room.mute(this.nick,reason,handler_cb,error_cb)},Occupant.prototype.op=function(reason,handler_cb,error_cb){return this.room.op(this.nick,reason,handler_cb,error_cb)},Occupant.prototype.deop=function(reason,handler_cb,error_cb){return this.room.deop(this.nick,reason,handler_cb,error_cb)},Occupant.prototype.modifyAffiliation=function(affiliation,reason,success_cb,error_cb){return this.room.modifyAffiliation(this.jid,affiliation,reason,success_cb,error_cb)},Occupant.prototype.ban=function(reason,handler_cb,error_cb){return this.room.ban(this.jid,reason,handler_cb,error_cb)},Occupant.prototype.member=function(reason,handler_cb,error_cb){return this.room.member(this.jid,reason,handler_cb,error_cb)},Occupant.prototype.revoke=function(reason,handler_cb,error_cb){return this.room.revoke(this.jid,reason,handler_cb,error_cb)},Occupant.prototype.owner=function(reason,handler_cb,error_cb){return this.room.owner(this.jid,reason,handler_cb,error_cb)},Occupant.prototype.admin=function(reason,handler_cb,error_cb){return this.room.admin(this.jid,reason,handler_cb,error_cb)},Occupant.prototype.update=function(data){return this.nick=data.nick||null,this.affiliation=data.affiliation||null,this.role=data.role||null,this.jid=data.jid||null,this.status=data.status||null,this.show=data.show||null,this},Occupant}(),/*!
31
+ * Source: build/lib/strophe.disco.js, license: MIT, url: https://github.com/strophe/strophejs-plugins */
32
+ Strophe.addConnectionPlugin("disco",{_connection:null,_identities:[],_features:[],_items:[],init:function(conn){this._connection=conn,this._identities=[],this._features=[],this._items=[],conn.addHandler(this._onDiscoInfo.bind(this),Strophe.NS.DISCO_INFO,"iq","get",null,null),conn.addHandler(this._onDiscoItems.bind(this),Strophe.NS.DISCO_ITEMS,"iq","get",null,null)},addIdentity:function(category,type,name,lang){for(var i=0;i<this._identities.length;i++)if(this._identities[i].category==category&&this._identities[i].type==type&&this._identities[i].name==name&&this._identities[i].lang==lang)return!1;return this._identities.push({category:category,type:type,name:name,lang:lang}),!0},addFeature:function(var_name){for(var i=0;i<this._features.length;i++)if(this._features[i]==var_name)return!1;return this._features.push(var_name),!0},removeFeature:function(var_name){for(var i=0;i<this._features.length;i++)if(this._features[i]===var_name)return this._features.splice(i,1),!0;return!1},addItem:function(jid,name,node,call_back){return node&&!call_back?!1:(this._items.push({jid:jid,name:name,node:node,call_back:call_back}),!0)},info:function(jid,node,success,error,timeout){var attrs={xmlns:Strophe.NS.DISCO_INFO};node&&(attrs.node=node);var info=$iq({from:this._connection.jid,to:jid,type:"get"}).c("query",attrs);this._connection.sendIQ(info,success,error,timeout)},items:function(jid,node,success,error,timeout){var attrs={xmlns:Strophe.NS.DISCO_ITEMS};node&&(attrs.node=node);var items=$iq({from:this._connection.jid,to:jid,type:"get"}).c("query",attrs);this._connection.sendIQ(items,success,error,timeout)},_buildIQResult:function(stanza,query_attrs){var id=stanza.getAttribute("id"),from=stanza.getAttribute("from"),iqresult=$iq({type:"result",id:id});return null!==from&&iqresult.attrs({to:from}),iqresult.c("query",query_attrs)},_onDiscoInfo:function(stanza){var node=stanza.getElementsByTagName("query")[0].getAttribute("node"),attrs={xmlns:Strophe.NS.DISCO_INFO};node&&(attrs.node=node);for(var iqresult=this._buildIQResult(stanza,attrs),i=0;i<this._identities.length;i++){var attrs={category:this._identities[i].category,type:this._identities[i].type};this._identities[i].name&&(attrs.name=this._identities[i].name),this._identities[i].lang&&(attrs["xml:lang"]=this._identities[i].lang),iqresult.c("identity",attrs).up()}for(var i=0;i<this._features.length;i++)iqresult.c("feature",{"var":this._features[i]}).up();return this._connection.send(iqresult.tree()),!0},_onDiscoItems:function(stanza){var query_attrs={xmlns:Strophe.NS.DISCO_ITEMS},node=stanza.getElementsByTagName("query")[0].getAttribute("node");if(node){query_attrs.node=node;for(var items=[],i=0;i<this._items.length;i++)if(this._items[i].node==node){items=this._items[i].call_back(stanza);break}}else var items=this._items;for(var iqresult=this._buildIQResult(stanza,query_attrs),i=0;i<items.length;i++){var attrs={jid:items[i].jid};items[i].name&&(attrs.name=items[i].name),items[i].node&&(attrs.node=items[i].node),iqresult.c("item",attrs).up()}return this._connection.send(iqresult.tree()),!0}}),/*!
33
+ * Source: build/lib/strophe.caps.js, license: MIT, url: https://github.com/strophe/strophejs-plugins */
34
+ /**
35
+ * Entity Capabilities (XEP-0115)
36
+ *
37
+ * Depends on disco plugin.
38
+ *
39
+ * See: http://xmpp.org/extensions/xep-0115.html
40
+ *
41
+ * Authors: - Michael Weibel <michael.weibel@gmail.com> - Klaus Herberth <klaus@jsxc.org>
42
+ * Copyright: - Michael Weibel <michael.weibel@gmail.com>
43
+ *
44
+ * @license MIT
45
+ */
46
+ function($){Strophe.addConnectionPlugin("caps",{HASH:"sha-1",node:"http://strophe.im/strophejs/",_ver:"",_connection:null,_knownCapabilities:JSON.parse(localStorage.getItem("strophe.caps._knownCapabilities"))||{},_jidVerIndex:JSON.parse(localStorage.getItem("strophe.caps._jidVerIndex"))||{},init:function(conn){if(this._connection=conn,Strophe.addNamespace("CAPS","http://jabber.org/protocol/caps"),!this._connection.disco)throw"Caps plugin requires the disco plugin to be installed.";this._connection.disco.addFeature(Strophe.NS.CAPS),this._connection.addHandler(this._delegateCapabilities.bind(this),Strophe.NS.CAPS)},generateCapsAttrs:function(){return{xmlns:Strophe.NS.CAPS,hash:this.HASH,node:this.node,ver:this.generateVer()}},generateVer:function(){if(""!==this._ver)return this._ver;for(var ver="",identities=this._connection.disco._identities.sort(this._sortIdentities),identitiesLen=identities.length,features=this._connection.disco._features.sort(),featuresLen=features.length,i=0;identitiesLen>i;i++){var curIdent=identities[i];ver+=curIdent.category+"/"+curIdent.type+"/"+curIdent.lang+"/"+curIdent.name+"<"}for(var i=0;featuresLen>i;i++)ver+=features[i]+"<";return this._ver=b64_sha1(ver),this._ver},getCapabilitiesByJid:function(jid){return this._jidVerIndex[jid]?this._knownCapabilities[this._jidVerIndex[jid]]:null},hasFeatureByJid:function(jid,feature){if(this._jidVerIndex[jid]&&null!==feature&&"undefined"!=typeof feature){$.isArray(feature)||(feature=$.makeArray(feature));var i;for(i=0;i<feature.length;i++)if(this._knownCapabilities[this._jidVerIndex[jid]].features.indexOf(feature[i])<0)return!1;return!0}return!1},_delegateCapabilities:function(stanza){var from=stanza.getAttribute("from"),c=stanza.querySelector("c"),ver=c.getAttribute("ver"),node=c.getAttribute("node");return this._knownCapabilities[ver]?(this._jidVerIndex[from]=ver,this._jidVerIndex[from]&&!this._jidVerIndex[from]===ver||(this._jidVerIndex[from]=ver),localStorage.setItem("strophe.caps._jidVerIndex",JSON.stringify(this._jidVerIndex)),$(document).trigger("caps.strophe",[from]),!0):this._requestCapabilities(from,node,ver)},_requestCapabilities:function(to,node,ver){if(to!==this._connection.jid){var id=this._connection.disco.info(to,node+"#"+ver);this._connection.addHandler(this._handleDiscoInfoReply.bind(this),Strophe.NS.DISCO_INFO,"iq","result",id,to)}return!0},_handleDiscoInfoReply:function(stanza){var query=stanza.querySelector("query"),from=stanza.getAttribute("from"),node=query.getAttribute("node"),ver=node?node.split("#")[1]:this._jidVerIndex[from];if(this._knownCapabilities[ver])this._jidVerIndex[from]&&!this._jidVerIndex[from]===ver||(this._jidVerIndex[from]=ver);else{var childNodes=query.childNodes,childNodesLen=childNodes.length;this._knownCapabilities[ver]={features:[],identities:[]};for(var i=0;childNodesLen>i;i++){var node=childNodes[i];"feature"==node.nodeName?this._knownCapabilities[ver].features.push(node.getAttribute("var")):"identity"==node.nodeName?this._knownCapabilities[ver].identities.push(this._attributesToJsObject(node.attributes)):("undefined"==typeof this._knownCapabilities[ver][node.nodeName]&&(this._knownCapabilities[ver][node.nodeName]=[]),this._knownCapabilities[ver][node.nodeName].push(this._attributesToJsObject(node.attributes)))}this._jidVerIndex[from]=ver}return localStorage.setItem("strophe.caps._jidVerIndex",JSON.stringify(this._jidVerIndex)),localStorage.setItem("strophe.caps._knownCapabilities",JSON.stringify(this._knownCapabilities)),$(document).trigger("caps.strophe",[from]),!1},_attributesToJsObject:function(attr){var obj={};for(i=0;i<attr.length;i++)obj[attr[i].name]=attr[i].value;return obj},_sortIdentities:function(a,b){return a.category>b.category?1:a.category<b.category?-1:a.type>b.type?1:a.type<b.type?-1:a.lang>b.lang?1:a.lang<b.lang?-1:0}})}(jQuery);/*!
47
+ * Source: build/lib/strophe.vcard.js, license: MIT, url: https://github.com/strophe/strophejs-plugins */
48
+ var buildIq;buildIq=function(type,jid,vCardEl){var iq;return iq=$iq(jid?{type:type,to:jid}:{type:type}),iq.c("vCard",{xmlns:Strophe.NS.VCARD}),vCardEl&&iq.cnode(vCardEl),iq},Strophe.addConnectionPlugin("vcard",{_connection:null,init:function(conn){return this._connection=conn,Strophe.addNamespace("VCARD","vcard-temp")},get:function(handler_cb,jid,error_cb){var iq;return iq=buildIq("get",jid),this._connection.sendIQ(iq,handler_cb,error_cb)},set:function(handler_cb,vCardEl,jid){var iq;return iq=buildIq("set",jid,vCardEl),this._connection.sendIQ(iq,handler_cb,error_rb)}}),/*!
49
+ * Source: build/lib/strophe.jingle/strophe.jingle.js, license: MIT, url: https://github.com/ESTOS/strophe.jingle */
50
+ function($){Strophe.addConnectionPlugin("jingle",{connection:null,sessions:{},jid2session:{},ice_config:{iceServers:[]},pc_constraints:{},media_constraints:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},localStream:null,init:function(conn){this.connection=conn,this.connection.disco&&(this.connection.disco.addFeature("urn:xmpp:jingle:1"),this.connection.disco.addFeature("urn:xmpp:jingle:apps:rtp:1"),this.connection.disco.addFeature("urn:xmpp:jingle:transports:ice-udp:1"),this.connection.disco.addFeature("urn:xmpp:jingle:apps:rtp:audio"),this.connection.disco.addFeature("urn:xmpp:jingle:apps:rtp:video"),this.connection.disco.addFeature("urn:ietf:rfc:5761")),this.connection.addHandler(this.onJingle.bind(this),"urn:xmpp:jingle:1","iq","set",null,null)},onJingle:function(iq){var sid=$(iq).find("jingle").attr("sid"),action=$(iq).find("jingle").attr("action"),ack=$iq({type:"result",to:iq.getAttribute("from"),id:iq.getAttribute("id")});console.log("on jingle "+action);var sess=this.sessions[sid];if("session-initiate"!=action){if(null===sess)return ack.type="error",ack.c("error",{type:"cancel"}).c("item-not-found",{xmlns:"urn:ietf:params:xml:ns:xmpp-stanzas"}).up().c("unknown-session",{xmlns:"urn:xmpp:jingle:errors:1"}),this.connection.send(ack),!0;if(Strophe.getBareJidFromJid(iq.getAttribute("from"))!=Strophe.getBareJidFromJid(sess.peerjid))return console.warn("jid mismatch for session id",sid,iq.getAttribute("from"),sess.peerjid),ack.type="error",ack.c("error",{type:"cancel"}).c("item-not-found",{xmlns:"urn:ietf:params:xml:ns:xmpp-stanzas"}).up().c("unknown-session",{xmlns:"urn:xmpp:jingle:errors:1"}),this.connection.send(ack),!0}else if(void 0!==sess)return ack.type="error",ack.c("error",{type:"cancel"}).c("service-unavailable",{xmlns:"urn:ietf:params:xml:ns:xmpp-stanzas"}).up(),console.warn("duplicate session id",sid),this.connection.send(ack),!0;switch(this.connection.send(ack),action){case"session-initiate":sess=new JingleSession($(iq).attr("to"),$(iq).find("jingle").attr("sid"),this.connection),this.localStream&&sess.localStreams.push(this.localStream),sess.media_constraints=this.media_constraints,sess.pc_constraints=this.pc_constraints,sess.ice_config=this.ice_config,sess.initiate($(iq).attr("from"),!1),sess.setRemoteDescription($(iq).find(">jingle"),"offer"),$(iq).find('>jingle>muted[xmlns="http://jitsi.org/protocol/meet#startmuted"]').length&&(console.log("got a request to start muted"),sess.startmuted=!0),this.sessions[sess.sid]=sess,this.jid2session[sess.peerjid]=sess,$(document).trigger("callincoming.jingle",[sess.sid]);break;case"session-accept":sess.setRemoteDescription($(iq).find(">jingle"),"answer"),sess.accept(),$(document).trigger("callaccepted.jingle",[sess.sid]);break;case"session-terminate":console.log("terminating..."),sess.terminate(),this.terminate(sess.sid),$(iq).find(">jingle>reason").length?$(document).trigger("callterminated.jingle",[sess.sid,$(iq).find(">jingle>reason>:first")[0].tagName,$(iq).find(">jingle>reason>text").text()]):$(document).trigger("callterminated.jingle",[sess.sid]);break;case"transport-info":sess.addIceCandidate($(iq).find(">jingle>content"));break;case"session-info":var affected;$(iq).find('>jingle>ringing[xmlns="urn:xmpp:jingle:apps:rtp:info:1"]').length?$(document).trigger("ringing.jingle",[sess.sid]):$(iq).find('>jingle>mute[xmlns="urn:xmpp:jingle:apps:rtp:info:1"]').length?(affected=$(iq).find('>jingle>mute[xmlns="urn:xmpp:jingle:apps:rtp:info:1"]').attr("name"),$(document).trigger("mute.jingle",[sess.sid,affected])):$(iq).find('>jingle>unmute[xmlns="urn:xmpp:jingle:apps:rtp:info:1"]').length&&(affected=$(iq).find('>jingle>unmute[xmlns="urn:xmpp:jingle:apps:rtp:info:1"]').attr("name"),$(document).trigger("unmute.jingle",[sess.sid,affected]));break;case"addsource":sess.addSource($(iq).find(">jingle>content"));break;case"removesource":sess.removeSource($(iq).find(">jingle>content"));break;default:console.warn("jingle action not implemented",action)}return!0},initiate:function(peerjid,myjid){var sess=new JingleSession(myjid||this.connection.jid,Math.random().toString(36).substr(2,12),this.connection);return this.localStream&&sess.localStreams.push(this.localStream),sess.media_constraints=this.media_constraints,sess.pc_constraints=this.pc_constraints,sess.ice_config=this.ice_config,sess.initiate(peerjid,!0),this.sessions[sess.sid]=sess,this.jid2session[sess.peerjid]=sess,sess.sendOffer(),sess},terminate:function(sid,reason,text){if(null===sid||void 0===sid)for(sid in this.sessions)"ended"!=this.sessions[sid].state&&(this.sessions[sid].sendTerminate(reason||!this.sessions[sid].active()?"cancel":null,text),this.sessions[sid].terminate()),delete this.jid2session[this.sessions[sid].peerjid],delete this.sessions[sid];else this.sessions.hasOwnProperty(sid)&&("ended"!=this.sessions[sid].state&&(this.sessions[sid].sendTerminate(reason||!this.sessions[sid].active()?"cancel":null,text),this.sessions[sid].terminate()),delete this.jid2session[this.sessions[sid].peerjid],delete this.sessions[sid])},terminateByJid:function(jid){if(this.jid2session.hasOwnProperty(jid)){var sess=this.jid2session[jid];sess&&(sess.terminate(),console.log("peer went away silently",jid),delete this.sessions[sess.sid],delete this.jid2session[jid],$(document).trigger("callterminated.jingle",[sess.sid,"gone"]))}},getStunAndTurnCredentials:function(){var self=this;this.connection.sendIQ($iq({type:"get",to:this.connection.domain}).c("services",{xmlns:"urn:xmpp:extdisco:1"}).c("service",{host:"turn."+this.connection.domain}),function(res){var iceservers=[];$(res).find(">services>service").each(function(idx,el){el=$(el);var dict={};switch(el.attr("type")){case"stun":dict.url="stun:"+el.attr("host"),el.attr("port")&&(dict.url+=":"+el.attr("port")),iceservers.push(dict);break;case"turn":dict.url="turn:",el.attr("username")&&(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)&&parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2],10)<28?dict.url+=el.attr("username")+"@":dict.username=el.attr("username")),dict.url+=el.attr("host"),el.attr("port")&&"3478"!=el.attr("port")&&(dict.url+=":"+el.attr("port")),el.attr("transport")&&"udp"!=el.attr("transport")&&(dict.url+="?transport="+el.attr("transport")),el.attr("password")&&(dict.credential=el.attr("password")),iceservers.push(dict)}}),self.ice_config.iceServers=iceservers},function(err){console.warn("getting turn credentials failed",err),console.warn("is mod_turncredentials or similar installed?")})}})}(jQuery);/*!
51
+ * Source: build/lib/strophe.jingle/strophe.jingle.session.js, license: MIT, url: https://github.com/ESTOS/strophe.jingle */
52
+ var JingleSession;!function($){JingleSession=function(me,sid,connection){this.me=me,this.sid=sid,this.connection=connection,this.initiator=null,this.responder=null,this.isInitiator=null,this.peerjid=null,this.state=null,this.peerconnection=null,this.remoteStream=null,this.localSDP=null,this.remoteSDP=null,this.localStreams=[],this.relayedStreams=[],this.remoteStreams=[],this.startTime=null,this.stopTime=null,this.media_constraints=null,this.pc_constraints=null,this.ice_config={},this.drip_container=[],this.usetrickle=!0,this.usepranswer=!1,this.usedrip=!1,this.hadstuncandidate=!1,this.hadturncandidate=!1,this.lasticecandidate=!1,this.statsinterval=null,this.reason=null,this.addssrc=[],this.removessrc=[],this.pendingop=null,this.wait=!0,this.nickname=null,this.startmuted=!1,this.filter_candidates=null},JingleSession.prototype.initiate=function(peerjid,isInitiator){var self=this;if(null!==this.state)return void console.error("attempt to initiate on session "+this.sid+"in state "+this.state);this.isInitiator=isInitiator,this.state="pending",this.initiator=isInitiator?this.me:peerjid,this.responder=isInitiator?peerjid:this.me,this.peerjid=peerjid;try{this.peerconnection=new RTCPeerconnection(this.ice_config,this.pc_constraints)}catch(e){return console.error("Failed to create PeerConnection, exception: ",e.message),void console.error(e)}this.hadstuncandidate=!1,this.hadturncandidate=!1,this.lasticecandidate=!1,this.peerconnection.onicecandidate=function(event){self.sendIceCandidate(event.candidate)},this.peerconnection.onaddstream=function(event){self.remoteStream=event.stream,self.remoteStreams.push(event.stream),$(document).trigger("remotestreamadded.jingle",[event,self.sid])},this.peerconnection.onremovestream=function(event){self.remoteStream=null,$(document).trigger("remotestreamremoved.jingle",[event,self.sid])},this.peerconnection.onsignalingstatechange=function(){!self||!self.peerconnection},this.peerconnection.oniceconnectionstatechange=function(){if(self&&self.peerconnection){switch(self.peerconnection.iceConnectionState){case"connected":this.startTime=new Date;break;case"disconnected":this.stopTime=new Date}$(document).trigger("iceconnectionstatechange.jingle",[self.sid,self])}},this.localStreams.forEach(function(stream){self.peerconnection.addStream(stream)}),this.relayedStreams.forEach(function(stream){self.peerconnection.addStream(stream)})},JingleSession.prototype.accept=function(){var self=this;this.state="active";var pranswer=this.peerconnection.localDescription;if(pranswer&&"pranswer"==pranswer.type){if(console.log("going from pranswer to answer"),this.usetrickle)for(var lines=SDPUtil.find_lines(pranswer.sdp,"a=candidate:"),i=0;i<lines.length;i++)pranswer.sdp=pranswer.sdp.replace(lines[i]+"\r\n","");for(;SDPUtil.find_line(pranswer.sdp,"a=inactive");)pranswer.sdp=pranswer.sdp.replace("a=inactive","a=sendrecv");var prsdp=new SDP(pranswer.sdp),accept=$iq({to:this.peerjid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"session-accept",initiator:this.initiator,responder:this.responder,sid:this.sid});prsdp.toJingle(accept,this.initiator==this.me?"initiator":"responder"),this.connection.sendIQ(accept,function(){var ack={};ack.source="answer",$(document).trigger("ack.jingle",[self.sid,ack])},function(stanza){var error=$(stanza).find("error").length?{code:$(stanza).find("error").attr("code"),reason:$(stanza).find("error :first")[0].tagName}:{};error.source="answer",$(document).trigger("error.jingle",[self.sid,error])},1e4);for(var sdp=this.peerconnection.localDescription.sdp;SDPUtil.find_line(sdp,"a=inactive");)sdp=sdp.replace("a=inactive","a=sendrecv");this.peerconnection.setLocalDescription(new RTCSessionDescription({type:"answer",sdp:sdp}),function(){$(document).trigger("setLocalDescription.jingle",[self.sid])},function(e){console.error("setLocalDescription failed",e)})}},JingleSession.prototype.terminate=function(reason){this.state="ended",this.reason=reason,this.peerconnection.close(),null!==this.statsinterval&&(window.clearInterval(this.statsinterval),this.statsinterval=null)},JingleSession.prototype.active=function(){return"active"==this.state},JingleSession.prototype.sendIceCandidate=function(candidate){var self=this;if(candidate&&!this.lasticecandidate){var ice=SDPUtil.iceparams(this.localSDP.media[candidate.sdpMLineIndex],this.localSDP.session),jcand=SDPUtil.candidateToJingle(candidate.candidate);if(!ice||!jcand)return void console.error("failed to get ice && jcand");if(ice.xmlns="urn:xmpp:jingle:transports:ice-udp:1","srflx"===jcand.type?this.hadstuncandidate=!0:"relay"===jcand.type&&(this.hadturncandidate=!0),(null===this.filter_candidates||jcand.type===this.filter_candidates)&&this.usetrickle){if(console.log("sendIceCandidate using trickle"),this.usedrip)return 0===this.drip_container.length&&window.setTimeout(function(){console.log("sending drip container"),0!==self.drip_container.length&&(self.sendIceCandidates(self.drip_container),self.drip_container=[])},20),void this.drip_container.push(event.candidate);console.log("sending single candidate"),self.sendIceCandidates([event.candidate])}}else{if(console.log("sendIceCandidate: last candidate..."),!this.usetrickle){console.log("should send full offer now...");var init=$iq({to:this.peerjid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"offer"==this.peerconnection.localDescription.type?"session-initiate":"session-accept",initiator:this.initiator,sid:this.sid});null!=this.nickname&&init.c("nick",{xmlns:"http://jabber.org/protocol/nick"}).t(this.nickname).up(),this.startmuted&&init.c("muted",{xmlns:"http://jitsi.org/protocol/meet#startmuted"}).up(),this.localSDP=new SDP(this.peerconnection.localDescription.sdp),this.localSDP.toJingle(init,this.initiator==this.me?"initiator":"responder"),console.log("try to send ack(offer)..."),this.connection.sendIQ(init,function(){console.log("Sent session initiate (ACK, offer)...");var ack={};ack.source="offer",$(document).trigger("ack.jingle",[self.sid,ack])},function(stanza){self.state="error",self.peerconnection.close();var error=$(stanza).find("error").length?{code:$(stanza).find("error").attr("code"),reason:$(stanza).find("error :first")[0].tagName}:{};error.source="offer",$(document).trigger("error.jingle",[self.sid,error])},1e4)}this.lasticecandidate=!0,console.log("Have we encountered any srflx candidates? "+this.hadstuncandidate),console.log("Have we encountered any relay candidates? "+this.hadturncandidate),this.hadstuncandidate||this.hadturncandidate||"closed"==this.peerconnection.signalingState||(console.log("no candidates found!"),$(document).trigger("nostuncandidates.jingle",[this.sid]))}},JingleSession.prototype.sendIceCandidates=function(candidates){console.log("sendIceCandidates",candidates);for(var cand=$iq({to:this.peerjid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"transport-info",initiator:this.initiator,sid:this.sid}),mid=0;mid<this.localSDP.media.length;mid++){var cands=candidates.filter(function(el){return el.sdpMLineIndex==mid});if(cands.length>0){var ice=SDPUtil.iceparams(this.localSDP.media[mid],this.localSDP.session);ice.xmlns="urn:xmpp:jingle:transports:ice-udp:1",cand.c("content",{creator:this.initiator==this.me?"initiator":"responder",name:cands[0].sdpMid}).c("transport",ice);for(var i=0;i<cands.length;i++)cand.c("candidate",SDPUtil.candidateToJingle(cands[i].candidate)).up();if(SDPUtil.find_line(this.localSDP.media[mid],"a=fingerprint:",this.localSDP.session)){var tmp=SDPUtil.parse_fingerprint(SDPUtil.find_line(this.localSDP.media[mid],"a=fingerprint:",this.localSDP.session));tmp.required=!0,cand.c("fingerprint").t(tmp.fingerprint),delete tmp.fingerprint,cand.attrs(tmp),cand.up()}cand.up(),cand.up()}}console.log("try to send ack(transportinfo)..."),this.connection.sendIQ(cand,function(){var ack={};ack.source="transportinfo",console.log("Sent session initiate (ACK, transportinfo)..."),$(document).trigger("ack.jingle",[this.sid,ack])},function(stanza){var error=$(stanza).find("error").length?{code:$(stanza).find("error").attr("code"),reason:$(stanza).find("error :first")[0].tagName}:{};error.source="transportinfo",$(document).trigger("error.jingle",[this.sid,error])},1e4)},JingleSession.prototype.sendOffer=function(){var self=this;this.peerconnection.createOffer(function(sdp){self.createdOffer(sdp)},function(e){console.error("createOffer failed",e)},this.media_constraints)},JingleSession.prototype.createdOffer=function(sdp){var self=this;if(this.localSDP=new SDP(sdp.sdp),this.usetrickle){var init=$iq({to:this.peerjid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"session-initiate",initiator:this.initiator,sid:this.sid});null!=this.nickname&&init.c("nick",{xmlns:"http://jabber.org/protocol/nick"}).t(this.nickname).up(),this.startmuted&&init.c("muted",{xmlns:"http://jitsi.org/protocol/meet#startmuted"}).up(),this.localSDP.toJingle(init,this.initiator==this.me?"initiator":"responder"),this.connection.sendIQ(init,function(){var ack={};ack.source="offer",$(document).trigger("ack.jingle",[self.sid,ack])},function(stanza){self.state="error",self.peerconnection.close();var error=$(stanza).find("error").length?{code:$(stanza).find("error").attr("code"),reason:$(stanza).find("error :first")[0].tagName}:{};error.source="offer",$(document).trigger("error.jingle",[self.sid,error])},1e4)}sdp.sdp=this.localSDP.raw,this.peerconnection.setLocalDescription(sdp,function(){$(document).trigger("setLocalDescription.jingle",[self.sid])},function(e){console.error("setLocalDescription failed",e)});for(var cands=SDPUtil.find_lines(this.localSDP.raw,"a=candidate:"),i=0;i<cands.length;i++){var cand=SDPUtil.parse_icecandidate(cands[i]);"srflx"==cand.type?this.hadstuncandidate=!0:"relay"==cand.type&&(this.hadturncandidate=!0)}},JingleSession.prototype.setRemoteDescription=function(elem,desctype){if(this.remoteSDP=new SDP(""),this.remoteSDP.fromJingle(elem),null!==this.peerconnection.remoteDescription&&(console.log("setRemoteDescription when remote description is not null, should be pranswer",this.peerconnection.remoteDescription),"pranswer"==this.peerconnection.remoteDescription.type)){for(var pranswer=new SDP(this.peerconnection.remoteDescription.sdp),i=0;i<pranswer.media.length;i++){SDPUtil.find_line(this.remoteSDP.media[i],"a=ice-ufrag:",this.remoteSDP.session)||(SDPUtil.find_line(pranswer.media[i],"a=ice-ufrag:",pranswer.session)?this.remoteSDP.media[i]+=SDPUtil.find_line(pranswer.media[i],"a=ice-ufrag:",pranswer.session)+"\r\n":console.warn("no ice ufrag?"),SDPUtil.find_line(pranswer.media[i],"a=ice-pwd:",pranswer.session)?this.remoteSDP.media[i]+=SDPUtil.find_line(pranswer.media[i],"a=ice-pwd:",pranswer.session)+"\r\n":console.warn("no ice pwd?"));for(var lines=SDPUtil.find_lines(pranswer.media[i],"a=candidate:"),j=0;j<lines.length;j++)this.remoteSDP.media[i]+=lines[j]+"\r\n"}this.remoteSDP.raw=this.remoteSDP.session+this.remoteSDP.media.join("")}var remotedesc=new RTCSessionDescription({type:desctype,sdp:this.remoteSDP.raw});this.peerconnection.setRemoteDescription(remotedesc,function(){},function(e){console.error("setRemoteDescription error",e)})},JingleSession.prototype.addIceCandidate=function(elem){var self=this;if("closed"!=this.peerconnection.signalingState){if(!this.peerconnection.remoteDescription&&"have-local-offer"==this.peerconnection.signalingState){if(console.log("trickle ice candidate arriving before session accept..."),!this.remoteSDP){for(var cobbled="v=0\r\no=- 1923518516 2 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\n",i=0;i<this.localSDP.media.length;i++)cobbled+=SDPUtil.find_line(this.localSDP.media[i],"m=")+"\r\n",cobbled+=SDPUtil.find_lines(this.localSDP.media[i],"a=rtpmap:").join("\r\n")+"\r\n",SDPUtil.find_line(this.localSDP.media[i],"a=mid:")&&(cobbled+=SDPUtil.find_line(this.localSDP.media[i],"a=mid:")+"\r\n"),cobbled+="a=inactive\r\n";this.remoteSDP=new SDP(cobbled)}elem.each(function(){for(var i=0;i<self.remoteSDP.media.length;i++)if((SDPUtil.find_line(self.remoteSDP.media[i],"a=mid:"+$(this).attr("name"))||0===self.remoteSDP.media[i].indexOf("m="+$(this).attr("name")))&&!SDPUtil.find_line(self.remoteSDP.media[i],"a=ice-ufrag:")){var tmp=$(this).find("transport");self.remoteSDP.media[i]+="a=ice-ufrag:"+tmp.attr("ufrag")+"\r\n",self.remoteSDP.media[i]+="a=ice-pwd:"+tmp.attr("pwd")+"\r\n",tmp=$(this).find("transport>fingerprint"),tmp.length?self.remoteSDP.media[i]+="a=fingerprint:"+tmp.attr("hash")+" "+tmp.text()+"\r\n":(console.log("no dtls fingerprint (webrtc issue #1718?)"),self.remoteSDP.media[i]+="a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:BAADBAADBAADBAADBAADBAADBAADBAADBAADBAAD\r\n");break}}),this.remoteSDP.raw=this.remoteSDP.session+this.remoteSDP.media.join("");var iscomplete=this.remoteSDP.media.filter(function(mediapart){return SDPUtil.find_line(mediapart,"a=ice-ufrag:")}).length==this.remoteSDP.media.length;if(iscomplete){console.log("setting pranswer");try{this.peerconnection.setRemoteDescription(new RTCSessionDescription({type:"pranswer",sdp:this.remoteSDP.raw}),function(){},function(e){console.log("setRemoteDescription pranswer failed",e.toString())})}catch(e){console.error("setting pranswer failed",e)}}}elem.each(function(){var i,idx=-1;for(i=0;i<self.remoteSDP.media.length;i++)if(SDPUtil.find_line(self.remoteSDP.media[i],"a=mid:"+$(this).attr("name"))||0===self.remoteSDP.media[i].indexOf("m="+$(this).attr("name"))){idx=i;break}if(-1==idx)for(i=0;i<self.localSDP.media.length;i++)if(SDPUtil.find_line(self.localSDP.media[i],"a=mid:"+$(this).attr("name"))||0===self.localSDP.media[i].indexOf("m="+$(this).attr("name"))){idx=i;break}var name=$(this).attr("name");$(this).find("transport>candidate").each(function(){var line,candidate;line=SDPUtil.candidateFromJingle(this),candidate=new RTCIceCandidate({sdpMLineIndex:idx,sdpMid:name,candidate:line});try{self.peerconnection.addIceCandidate(candidate)}catch(e){console.error("addIceCandidate failed",e.toString(),line)}})})}},JingleSession.prototype.sendAnswer=function(provisional){var self=this;this.peerconnection.createAnswer(function(sdp){self.createdAnswer(sdp,provisional)},function(e){console.error("createAnswer failed",e)},this.media_constraints)},JingleSession.prototype.createdAnswer=function(sdp,provisional){var self=this;if(this.localSDP=new SDP(sdp.sdp),this.usepranswer=provisional===!0,this.startmuted&&(console.log("we got a request to start muted..."),this.connection.jingle.localStream.getAudioTracks().forEach(function(track){track.enabled=!1}),this.connection.jingle.localStream.getVideoTracks().forEach(function(track){track.enabled=!1}),this.localSDP.media[1]=this.localSDP.media[1].replace("a=sendrecv","a=recvonly"),SDPUtil.find_lines(this.localSDP.media[1],"a=ssrc:").forEach(function(line){self.localSDP.media[1]=self.localSDP.media[1].replace(line+"\r\n","")}),this.localSDP.raw=this.localSDP.session+this.localSDP.media.join("")),this.usetrickle)if(this.usepranswer){sdp.type="pranswer";for(var i=0;i<this.localSDP.media.length;i++)this.localSDP.media[i]=this.localSDP.media[i].replace("a=sendrecv\r\n","a=inactive\r\n");this.localSDP.raw=this.localSDP.session+this.localSDP.media.join("")}else{var accept=$iq({to:this.peerjid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"session-accept",initiator:this.initiator,responder:this.responder,sid:this.sid});this.localSDP.toJingle(accept,this.initiator==this.me?"initiator":"responder"),this.connection.sendIQ(accept,function(){var ack={};ack.source="answer",$(document).trigger("ack.jingle",[self.sid,ack])},function(stanza){var error=$(stanza).find("error").length?{code:$(stanza).find("error").attr("code"),reason:$(stanza).find("error :first")[0].tagName}:{};error.source="answer",$(document).trigger("error.jingle",[self.sid,error])},1e4)}sdp.sdp=this.localSDP.raw,this.peerconnection.setLocalDescription(sdp,function(){$(document).trigger("setLocalDescription.jingle",[self.sid])},function(e){console.error("setLocalDescription failed",e)});for(var cands=SDPUtil.find_lines(this.localSDP.raw,"a=candidate:"),j=0;j<cands.length;j++){var cand=SDPUtil.parse_icecandidate(cands[j]);"srflx"==cand.type?this.hadstuncandidate=!0:"relay"==cand.type&&(this.hadturncandidate=!0)}},JingleSession.prototype.sendTerminate=function(reason,text){var self=this,term=$iq({to:this.peerjid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"session-terminate",initiator:this.initiator,sid:this.sid}).c("reason").c(reason||"success");text&&term.up().c("text").t(text),this.connection.sendIQ(term,function(){self.peerconnection.close(),self.peerconnection=null,self.terminate();var ack={};ack.source="terminate",$(document).trigger("ack.jingle",[self.sid,ack])},function(stanza){var error=$(stanza).find("error").length?{code:$(stanza).find("error").attr("code"),reason:$(stanza).find("error :first")[0].tagName}:{};$(document).trigger("ack.jingle",[self.sid,error])},1e4),null!==this.statsinterval&&(window.clearInterval(this.statsinterval),this.statsinterval=null)},JingleSession.prototype.addSource=function(elem){console.log("addssrc",(new Date).getTime()),console.log("ice",this.peerconnection.iceConnectionState);var sdp=new SDP(this.peerconnection.remoteDescription.sdp),self=this;$(elem).each(function(idx,content){var name=$(content).attr("name"),lines="";tmp=$(content).find('>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]'),tmp.each(function(){var ssrc=$(this).attr("ssrc");$(this).find(">parameter").each(function(){lines+="a=ssrc:"+ssrc+" "+$(this).attr("name"),$(this).attr("value")&&$(this).attr("value").length&&(lines+=":"+$(this).attr("value")),lines+="\r\n"})}),sdp.media.forEach(function(media,idx){SDPUtil.find_line(media,"a=mid:"+name)&&(sdp.media[idx]+=lines,self.addssrc[idx]||(self.addssrc[idx]=""),self.addssrc[idx]+=lines)}),sdp.raw=sdp.session+sdp.media.join("")}),this.modifySources()},JingleSession.prototype.removeSource=function(elem){console.log("removessrc",(new Date).getTime()),console.log("ice",this.peerconnection.iceConnectionState);var sdp=new SDP(this.peerconnection.remoteDescription.sdp),self=this;$(elem).each(function(idx,content){var name=$(content).attr("name"),lines="";tmp=$(content).find('>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]'),tmp.each(function(){var ssrc=$(this).attr("ssrc");$(this).find(">parameter").each(function(){lines+="a=ssrc:"+ssrc+" "+$(this).attr("name"),$(this).attr("value")&&$(this).attr("value").length&&(lines+=":"+$(this).attr("value")),lines+="\r\n"})}),sdp.media.forEach(function(media,idx){SDPUtil.find_line(media,"a=mid:"+name)&&(sdp.media[idx]+=lines,self.addssrc[idx]||(self.removessrc[idx]=""),self.removessrc[idx]+=lines)}),sdp.raw=sdp.session+sdp.media.join("")}),this.modifySources()},JingleSession.prototype.modifySources=function(){var self=this;if("closed"!=this.peerconnection.signalingState&&(this.addssrc.length||this.removessrc.length||null!==this.pendingop)){if("stable"!=this.peerconnection.signalingState||"connected"!=this.peerconnection.iceConnectionState)return console.warn("modifySources not yet",this.peerconnection.signalingState,this.peerconnection.iceConnectionState),this.wait=!0,void window.setTimeout(function(){self.modifySources()},250);if(this.wait)return window.setTimeout(function(){self.modifySources()},2500),void(this.wait=!1);var sdp=new SDP(this.peerconnection.remoteDescription.sdp);this.addssrc.forEach(function(lines,idx){sdp.media[idx]+=lines}),this.addssrc=[],this.removessrc.forEach(function(lines,idx){lines=lines.split("\r\n"),lines.pop(),lines.forEach(function(line){sdp.media[idx]=sdp.media[idx].replace(line+"\r\n","")})}),this.removessrc=[],sdp.raw=sdp.session+sdp.media.join(""),this.peerconnection.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:sdp.raw}),function(){self.peerconnection.createAnswer(function(modifiedAnswer){if(null!==self.pendingop){var sdp=new SDP(modifiedAnswer.sdp);if(sdp.media.length>1){switch(self.pendingop){case"mute":sdp.media[1]=sdp.media[1].replace("a=sendrecv","a=recvonly");break;case"unmute":sdp.media[1]=sdp.media[1].replace("a=recvonly","a=sendrecv")}sdp.raw=sdp.session+sdp.media.join(""),modifiedAnswer.sdp=sdp.raw}self.pendingop=null}self.peerconnection.setLocalDescription(modifiedAnswer,function(){$(document).trigger("setLocalDescription.jingle",[self.sid])},function(){console.log("modified setLocalDescription failed")})},function(){console.log("modified answer failed")})},function(){console.log("modify failed")})}},JingleSession.prototype.hardMuteVideo=function(muted){this.pendingop=muted?"mute":"unmute",this.modifySources(),this.connection.jingle.localStream.getVideoTracks().forEach(function(track){track.enabled=!muted})},JingleSession.prototype.sendMute=function(muted,content){var info=$iq({to:this.peerjid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"session-info",initiator:this.initiator,sid:this.sid});info.c(muted?"mute":"unmute",{xmlns:"urn:xmpp:jingle:apps:rtp:info:1"}),info.attrs({creator:this.me==this.initiator?"creator":"responder"}),content&&info.attrs({name:content}),this.connection.send(info)},JingleSession.prototype.sendRinging=function(){var info=$iq({to:this.peerjid,type:"set"}).c("jingle",{xmlns:"urn:xmpp:jingle:1",action:"session-info",initiator:this.initiator,sid:this.sid});info.c("ringing",{xmlns:"urn:xmpp:jingle:apps:rtp:info:1"}),this.connection.send(info)},JingleSession.prototype.getStats=function(interval){var self=this,recv={audio:0,video:0},lost={audio:0,video:0},lastrecv={audio:0,video:0},lastlost={audio:0,video:0},loss={audio:0,video:0},delta={audio:0,video:0};return this.statsinterval=window.setInterval(function(){self&&self.peerconnection&&self.peerconnection.getStats&&self.peerconnection.getStats(function(stats){for(var results=stats.result(),i=0;i<results.length;++i)if("ssrc"==results[i].type){var packetsrecv=results[i].stat("packetsReceived"),packetslost=results[i].stat("packetsLost");packetsrecv&&packetslost&&(packetsrecv=parseInt(packetsrecv,10),packetslost=parseInt(packetslost,10),results[i].stat("googFrameRateReceived")?(lastlost.video=lost.video,lastrecv.video=recv.video,recv.video=packetsrecv,lost.video=packetslost):(lastlost.audio=lost.audio,lastrecv.audio=recv.audio,recv.audio=packetsrecv,lost.audio=packetslost))}delta.audio=recv.audio-lastrecv.audio,delta.video=recv.video-lastrecv.video,loss.audio=delta.audio>0?Math.ceil(100*(lost.audio-lastlost.audio)/delta.audio):0,loss.video=delta.video>0?Math.ceil(100*(lost.video-lastlost.video)/delta.video):0,$(document).trigger("packetloss.jingle",[self.sid,loss])})},interval||3e3),this.statsinterval}}(jQuery);/*!
53
+ * Source: build/lib/strophe.jingle/strophe.jingle.sdp.js, license: MIT, url: https://github.com/ESTOS/strophe.jingle */
54
+ var SDP;!function($){SDP=function(sdp){this.media=sdp.split("\r\nm=");for(var i=1;i<this.media.length;i++)this.media[i]="m="+this.media[i],i!=this.media.length-1&&(this.media[i]+="\r\n");this.session=this.media.shift()+"\r\n",this.raw=this.session+this.media.join("")},SDP.prototype.mangle=function(){var i,j,mline,lines,rtpmap,newdesc;for(i=0;i<this.media.length;i++)if(lines=this.media[i].split("\r\n"),lines.pop(),mline=SDPUtil.parse_mline(lines.shift()),"audio"==mline.media){for(newdesc="",mline.fmt.length=0,j=0;j<lines.length;j++)if("a=rtpmap:"==lines[j].substr(0,9)){if(rtpmap=SDPUtil.parse_rtpmap(lines[j]),"CN"==rtpmap.name||"ISAC"==rtpmap.name)continue;mline.fmt.push(rtpmap.id),newdesc+=lines[j]+"\r\n"}else newdesc+=lines[j]+"\r\n";this.media[i]=SDPUtil.build_mline(mline)+"\r\n",this.media[i]+=newdesc}this.raw=this.session+this.media.join("")},SDP.prototype.removeSessionLines=function(prefix){var self=this,lines=SDPUtil.find_lines(this.session,prefix);return lines.forEach(function(line){self.session=self.session.replace(line+"\r\n","")}),this.raw=this.session+this.media.join(""),lines},SDP.prototype.removeMediaLines=function(mediaindex,prefix){var self=this,lines=SDPUtil.find_lines(this.media[mediaindex],prefix);return lines.forEach(function(line){self.media[mediaindex]=self.media[mediaindex].replace(line+"\r\n","")}),this.raw=this.session+this.media.join(""),lines},SDP.prototype.toJingle=function(elem,thecreator){var i,j,k,mline,ssrc,rtpmap,tmp,lines;if(SDPUtil.find_line(this.session,"a=group:"))for(lines=SDPUtil.find_lines(this.session,"a=group:"),i=0;i<lines.length;i++){tmp=lines[i].split(" ");var semantics=tmp.shift().substr(8);for(elem.c("group",{xmlns:"urn:xmpp:jingle:apps:grouping:0",semantics:semantics}),j=0;j<tmp.length;j++)elem.c("content",{name:tmp[j]}).up();elem.up()}var bundle=[];for(SDPUtil.find_line(this.session,"a=group:BUNDLE")&&(bundle=SDPUtil.find_line(this.session,"a=group:BUNDLE ").split(" "),bundle.shift()),i=0;i<this.media.length;i++)if(mline=SDPUtil.parse_mline(this.media[i].split("\r\n")[0]),"audio"==mline.media||"video"==mline.media){if(ssrc=SDPUtil.find_line(this.media[i],"a=ssrc:")?SDPUtil.find_line(this.media[i],"a=ssrc:").substring(7).split(" ")[0]:!1,elem.c("content",{creator:thecreator,name:mline.media}),SDPUtil.find_line(this.media[i],"a=mid:")){var mid=SDPUtil.parse_mid(SDPUtil.find_line(this.media[i],"a=mid:"));elem.attrs({name:mid}),-1!=bundle.indexOf(mid)&&(elem.c("bundle",{xmlns:"http://estos.de/ns/bundle"}).up(),bundle.splice(bundle.indexOf(mid),1))}if(SDPUtil.find_line(this.media[i],"a=rtpmap:").length){for(elem.c("description",{xmlns:"urn:xmpp:jingle:apps:rtp:1",media:mline.media}),ssrc&&elem.attrs({ssrc:ssrc}),j=0;j<mline.fmt.length;j++){if(rtpmap=SDPUtil.find_line(this.media[i],"a=rtpmap:"+mline.fmt[j]),elem.c("payload-type",SDPUtil.parse_rtpmap(rtpmap)),SDPUtil.find_line(this.media[i],"a=fmtp:"+mline.fmt[j]))for(tmp=SDPUtil.parse_fmtp(SDPUtil.find_line(this.media[i],"a=fmtp:"+mline.fmt[j])),k=0;k<tmp.length;k++)elem.c("parameter",tmp[k]).up();this.RtcpFbToJingle(i,elem,mline.fmt[j]),elem.up()}if(SDPUtil.find_line(this.media[i],"a=crypto:",this.session)){elem.c("encryption",{required:1});var crypto=SDPUtil.find_lines(this.media[i],"a=crypto:",this.session);crypto.forEach(function(line){elem.c("crypto",SDPUtil.parse_crypto(line)).up()}),elem.up()}if(ssrc){elem.c("source",{ssrc:ssrc,xmlns:"urn:xmpp:jingle:apps:rtp:ssma:0"});var ssrclines=SDPUtil.find_lines(this.media[i],"a=ssrc:");ssrclines.forEach(function(line){idx=line.indexOf(" ");var linessrc=line.substr(0,idx).substr(7);linessrc!=ssrc&&(elem.up(),ssrc=linessrc,elem.c("source",{ssrc:ssrc,xmlns:"urn:xmpp:jingle:apps:rtp:ssma:0"}));var kv=line.substr(idx+1);elem.c("parameter"),-1==kv.indexOf(":")?elem.attrs({name:kv}):(elem.attrs({name:kv.split(":",2)[0]}),elem.attrs({value:kv.split(":",2)[1]})),elem.up()}),elem.up(),tmp=SDPUtil.parse_ssrc(this.media[i]),tmp.xmlns="http://estos.de/ns/ssrc",tmp.ssrc=ssrc,elem.c("ssrc",tmp).up()}if(SDPUtil.find_line(this.media[i],"a=rtcp-mux")&&elem.c("rtcp-mux").up(),this.RtcpFbToJingle(i,elem,"*"),SDPUtil.find_line(this.media[i],"a=extmap:"))for(lines=SDPUtil.find_lines(this.media[i],"a=extmap:"),j=0;j<lines.length;j++){if(tmp=SDPUtil.parse_extmap(lines[j]),elem.c("rtp-hdrext",{xmlns:"urn:xmpp:jingle:apps:rtp:rtp-hdrext:0",uri:tmp.uri,id:tmp.value}),tmp.hasOwnProperty("direction"))switch(tmp.direction){case"sendonly":elem.attrs({senders:"responder"});break;case"recvonly":elem.attrs({senders:"initiator"});break;case"sendrecv":elem.attrs({senders:"both"});break;case"inactive":elem.attrs({senders:"none"})}elem.up()}elem.up()}this.TransportToJingle(i,elem),SDPUtil.find_line(this.media[i],"a=sendrecv",this.session)?elem.attrs({senders:"both"}):SDPUtil.find_line(this.media[i],"a=sendonly",this.session)?elem.attrs({senders:"initiator"}):SDPUtil.find_line(this.media[i],"a=recvonly",this.session)?elem.attrs({senders:"responder"}):SDPUtil.find_line(this.media[i],"a=inactive",this.session)&&elem.attrs({senders:"none"}),"0"==mline.port&&elem.attrs({senders:"rejected"}),elem.up()}return elem.up(),elem},SDP.prototype.TransportToJingle=function(mediaindex,elem){var tmp,self=this;elem.c("transport");var fingerprints=SDPUtil.find_lines(this.media[mediaindex],"a=fingerprint:",this.session);if(fingerprints.forEach(function(line){tmp=SDPUtil.parse_fingerprint(line),tmp.xmlns="urn:xmpp:tmp:jingle:apps:dtls:0",elem.c("fingerprint").t(tmp.fingerprint),delete tmp.fingerprint,line=SDPUtil.find_line(self.media[mediaindex],"a=setup:",self.session),line&&(tmp.setup=line.substr(8)),elem.attrs(tmp),elem.up()}),tmp=SDPUtil.iceparams(this.media[mediaindex],this.session),tmp&&(tmp.xmlns="urn:xmpp:jingle:transports:ice-udp:1",elem.attrs(tmp),SDPUtil.find_line(this.media[mediaindex],"a=candidate:",this.session))){var lines=SDPUtil.find_lines(this.media[mediaindex],"a=candidate:",this.session);lines.forEach(function(line){elem.c("candidate",SDPUtil.candidateToJingle(line)).up()})}elem.up()},SDP.prototype.RtcpFbToJingle=function(mediaindex,elem,payloadtype){var lines=SDPUtil.find_lines(this.media[mediaindex],"a=rtcp-fb:"+payloadtype);lines.forEach(function(line){var tmp=SDPUtil.parse_rtcpfb(line);"trr-int"==tmp.type?(elem.c("rtcp-fb-trr-int",{xmlns:"urn:xmpp:jingle:apps:rtp:rtcp-fb:0",value:tmp.params[0]}),elem.up()):(elem.c("rtcp-fb",{xmlns:"urn:xmpp:jingle:apps:rtp:rtcp-fb:0",type:tmp.type}),tmp.params.length>0&&elem.attrs({subtype:tmp.params[0]}),elem.up())})},SDP.prototype.RtcpFbFromJingle=function(elem,payloadtype){var media="",tmp=elem.find('>rtcp-fb-trr-int[xmlns="urn:xmpp:jingle:apps:rtp:rtcp-fb:0"]');return tmp.length&&(media+="a=rtcp-fb:* trr-int ",media+=tmp.attr("value")?tmp.attr("value"):"0",media+="\r\n"),tmp=elem.find('>rtcp-fb[xmlns="urn:xmpp:jingle:apps:rtp:rtcp-fb:0"]'),tmp.each(function(){media+="a=rtcp-fb:"+payloadtype+" "+$(this).attr("type"),$(this).attr("subtype")&&(media+=" "+$(this).attr("subtype")),media+="\r\n"}),media},SDP.prototype.fromJingle=function(jingle){var self=this;if(this.raw="v=0\r\no=- 1923518516 2 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\n",$(jingle).find('>group[xmlns="urn:xmpp:jingle:apps:grouping:0"]').length)$(jingle).find('>group[xmlns="urn:xmpp:jingle:apps:grouping:0"]').each(function(idx,group){var contents=$(group).find(">content").map(function(idx,content){return content.getAttribute("name")}).get();contents.length>0&&(self.raw+="a=group:"+(group.getAttribute("semantics")||group.getAttribute("type"))+" "+contents.join(" ")+"\r\n")});else if($(jingle).find('>group[xmlns="urn:ietf:rfc:5888"]').length)$(jingle).find('>group[xmlns="urn:ietf:rfc:5888"]').each(function(idx,group){var contents=$(group).find(">content").map(function(idx,content){return content.getAttribute("name")}).get();null!==group.getAttribute("type")&&contents.length>0&&(self.raw+="a=group:"+group.getAttribute("type")+" "+contents.join(" ")+"\r\n")});else{var bundle=$(jingle).find(">content").filter(function(idx,content){return $(content).find(">bundle").length>0}).map(function(idx,content){return content.getAttribute("name")}).get();bundle.length&&(this.raw+="a=group:BUNDLE "+bundle.join(" ")+"\r\n")}this.session=this.raw,jingle.find(">content").each(function(){var m=self.jingle2media($(this));self.media.push(m)}),this.raw=this.session+this.media.join("")},SDP.prototype.jingle2media=function(content){var tmp,media="",desc=content.find("description"),ssrc=desc.attr("ssrc"),self=this;switch(tmp={media:desc.attr("media")},tmp.port="1","rejected"==content.attr("senders")&&(tmp.port="0"),tmp.proto=content.find(">transport>fingerprint").length||desc.find("encryption").length?"RTP/SAVPF":"RTP/AVPF",tmp.fmt=desc.find("payload-type").map(function(){return this.getAttribute("id")}).get(),media+=SDPUtil.build_mline(tmp)+"\r\n",media+="c=IN IP4 0.0.0.0\r\n",media+="a=rtcp:1 IN IP4 0.0.0.0\r\n",tmp=content.find('>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]'),tmp.length&&(tmp.attr("ufrag")&&(media+=SDPUtil.build_iceufrag(tmp.attr("ufrag"))+"\r\n"),tmp.attr("pwd")&&(media+=SDPUtil.build_icepwd(tmp.attr("pwd"))+"\r\n"),tmp.find(">fingerprint").each(function(){media+="a=fingerprint:"+this.getAttribute("hash"),media+=" "+$(this).text(),media+="\r\n",this.getAttribute("setup")&&(media+="a=setup:"+this.getAttribute("setup")+"\r\n")})),content.attr("senders")){case"initiator":media+="a=sendonly\r\n";break;case"responder":media+="a=recvonly\r\n";break;case"none":media+="a=inactive\r\n";break;case"both":media+="a=sendrecv\r\n"}return media+="a=mid:"+content.attr("name")+"\r\n",desc.find("rtcp-mux").length&&(media+="a=rtcp-mux\r\n"),desc.find("encryption").length&&desc.find("encryption>crypto").each(function(){media+="a=crypto:"+this.getAttribute("tag"),media+=" "+this.getAttribute("crypto-suite"),media+=" "+this.getAttribute("key-params"),this.getAttribute("session-params")&&(media+=" "+this.getAttribute("session-params")),media+="\r\n"}),desc.find("payload-type").each(function(){media+=SDPUtil.build_rtpmap(this)+"\r\n",$(this).find(">parameter").length&&(media+="a=fmtp:"+this.getAttribute("id")+" ",media+=$(this).find("parameter").map(function(){return(this.getAttribute("name")?this.getAttribute("name")+"=":"")+this.getAttribute("value")}).get().join(";"),media+="\r\n"),media+=self.RtcpFbFromJingle($(this),this.getAttribute("id"))}),media+=self.RtcpFbFromJingle(desc,"*"),tmp=desc.find('>rtp-hdrext[xmlns="urn:xmpp:jingle:apps:rtp:rtp-hdrext:0"]'),tmp.each(function(){media+="a=extmap:"+this.getAttribute("id")+" "+this.getAttribute("uri")+"\r\n"}),content.find('>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]>candidate').each(function(){media+=SDPUtil.candidateFromJingle(this)}),tmp=content.find('description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]'),tmp.each(function(){var ssrc=this.getAttribute("ssrc");$(this).find(">parameter").each(function(){media+="a=ssrc:"+ssrc+" "+this.getAttribute("name"),this.getAttribute("value")&&this.getAttribute("value").length&&(media+=":"+this.getAttribute("value")),media+="\r\n"})}),0===tmp.length&&(tmp=content.find('description>ssrc[xmlns="http://estos.de/ns/ssrc"]'),tmp.length&&(media+="a=ssrc:"+ssrc+" cname:"+tmp.attr("cname")+"\r\n",media+="a=ssrc:"+ssrc+" msid:"+tmp.attr("msid")+"\r\n",media+="a=ssrc:"+ssrc+" mslabel:"+tmp.attr("mslabel")+"\r\n",media+="a=ssrc:"+ssrc+" label:"+tmp.attr("label")+"\r\n")),media},SDPUtil={iceparams:function(mediadesc,sessiondesc){var data=null;return SDPUtil.find_line(mediadesc,"a=ice-ufrag:",sessiondesc)&&SDPUtil.find_line(mediadesc,"a=ice-pwd:",sessiondesc)&&(data={ufrag:SDPUtil.parse_iceufrag(SDPUtil.find_line(mediadesc,"a=ice-ufrag:",sessiondesc)),pwd:SDPUtil.parse_icepwd(SDPUtil.find_line(mediadesc,"a=ice-pwd:",sessiondesc))}),data},parse_iceufrag:function(line){return line.substring(12)},build_iceufrag:function(frag){return"a=ice-ufrag:"+frag},parse_icepwd:function(line){return line.substring(10)},build_icepwd:function(pwd){return"a=ice-pwd:"+pwd},parse_mid:function(line){return line.substring(6)},parse_mline:function(line){var parts=line.substring(2).split(" "),data={};return data.media=parts.shift(),data.port=parts.shift(),data.proto=parts.shift(),""===parts[parts.length-1]&&parts.pop(),data.fmt=parts,data},build_mline:function(mline){return"m="+mline.media+" "+mline.port+" "+mline.proto+" "+mline.fmt.join(" ")},parse_rtpmap:function(line){var parts=line.substring(9).split(" "),data={};return data.id=parts.shift(),parts=parts[0].split("/"),data.name=parts.shift(),data.clockrate=parts.shift(),data.channels=parts.length?parts.shift():"1",data},build_rtpmap:function(el){var line="a=rtpmap:"+el.getAttribute("id")+" "+el.getAttribute("name")+"/"+el.getAttribute("clockrate");return el.getAttribute("channels")&&"1"!=el.getAttribute("channels")&&(line+="/"+el.getAttribute("channels")),line},parse_crypto:function(line){var parts=line.substring(9).split(" "),data={};return data.tag=parts.shift(),data["crypto-suite"]=parts.shift(),data["key-params"]=parts.shift(),parts.length&&(data["session-params"]=parts.join(" ")),data},parse_fingerprint:function(line){var parts=line.substring(14).split(" "),data={};return data.hash=parts.shift(),data.fingerprint=parts.shift(),data},parse_fmtp:function(line){var i,key,value,parts=line.split(" "),data=[];for(parts.shift(),parts=parts.join(" ").split(";"),i=0;i<parts.length;i++){for(key=parts[i].split("=")[0];key.length&&" "==key[0];)key=key.substring(1);value=parts[i].split("=")[1],key&&value?data.push({name:key,value:value}):key&&data.push({name:"",value:key})}return data},parse_icecandidate:function(line){var candidate={},elems=line.split(" ");candidate.foundation=elems[0].substring(12),candidate.component=elems[1],candidate.protocol=elems[2].toLowerCase(),candidate.priority=elems[3],candidate.ip=elems[4],candidate.port=elems[5],candidate.type=elems[7],candidate.generation=0;for(var i=8;i<elems.length;i+=2)switch(elems[i]){case"raddr":candidate["rel-addr"]=elems[i+1];break;case"rport":candidate["rel-port"]=elems[i+1];break;case"generation":candidate.generation=elems[i+1];break;case"tcptype":candidate.tcptype=elems[i+1];break;default:console.log('parse_icecandidate not translating "'+elems[i]+'" = "'+elems[i+1]+'"')}return candidate.network="1",candidate.id=Math.random().toString(36).substr(2,10),candidate},build_icecandidate:function(cand){var line=["a=candidate:"+cand.foundation,cand.component,cand.protocol,cand.priority,cand.ip,cand.port,"typ",cand.type].join(" ");switch(line+=" ",cand.type){case"srflx":case"prflx":case"relay":cand.hasOwnAttribute("rel-addr")&&cand.hasOwnAttribute("rel-port")&&(line+="raddr",line+=" ",line+=cand["rel-addr"],line+=" ",line+="rport",line+=" ",line+=cand["rel-port"],line+=" ")}return cand.hasOwnAttribute("tcptype")&&(line+="tcptype",line+=" ",line+=cand.tcptype,line+=" "),line+="generation",line+=" ",line+=cand.hasOwnAttribute("generation")?cand.generation:"0"},parse_ssrc:function(desc){for(var lines=desc.split("\r\n"),data={},i=0;i<lines.length;i++)if("a=ssrc:"==lines[i].substring(0,7)){var idx=lines[i].indexOf(" ");data[lines[i].substr(idx+1).split(":",2)[0]]=lines[i].substr(idx+1).split(":",2)[1]}return data},parse_rtcpfb:function(line){var parts=line.substr(10).split(" "),data={};return data.pt=parts.shift(),data.type=parts.shift(),data.params=parts,data},parse_extmap:function(line){var parts=line.substr(9).split(" "),data={};return data.value=parts.shift(),-1!=data.value.indexOf("/")?(data.direction=data.value.substr(data.value.indexOf("/")+1),data.value=data.value.substr(0,data.value.indexOf("/"))):data.direction="both",data.uri=parts.shift(),data.params=parts,data},find_line:function(haystack,needle,sessionpart){for(var lines=haystack.split("\r\n"),i=0;i<lines.length;i++)if(lines[i].substring(0,needle.length)==needle)return lines[i];if(!sessionpart)return!1;lines=sessionpart.split("\r\n");for(var j=0;j<lines.length;j++)if(lines[j].substring(0,needle.length)==needle)return lines[j];return!1},find_lines:function(haystack,needle,sessionpart){for(var lines=haystack.split("\r\n"),needles=[],i=0;i<lines.length;i++)lines[i].substring(0,needle.length)==needle&&needles.push(lines[i]);if(needles.length||!sessionpart)return needles;lines=sessionpart.split("\r\n");for(var j=0;j<lines.length;j++)lines[j].substring(0,needle.length)==needle&&needles.push(lines[j]);return needles},candidateToJingle:function(line){if(0===line.indexOf("candidate:"))line="a="+line;else if("a=candidate:"!=line.substring(0,12))return console.log("parseCandidate called with a line that is not a candidate line"),console.log(line),null;"\r\n"==line.substring(line.length-2)&&(line=line.substring(0,line.length-2));var i,candidate={},elems=line.split(" ");if("typ"!=elems[6])return console.log("did not find typ in the right place"),console.log(line),null;for(candidate.foundation=elems[0].substring(12),candidate.component=elems[1],candidate.protocol=elems[2].toLowerCase(),candidate.priority=elems[3],candidate.ip=elems[4],candidate.port=elems[5],candidate.type=elems[7],candidate.generation="0",i=8;i<elems.length;i+=2)switch(elems[i]){case"raddr":candidate["rel-addr"]=elems[i+1];break;case"rport":candidate["rel-port"]=elems[i+1];break;case"generation":candidate.generation=elems[i+1];break;case"tcptype":candidate.tcptype=elems[i+1];break;default:console.log('not translating "'+elems[i]+'" = "'+elems[i+1]+'"')}return candidate.network="1",candidate.id=Math.random().toString(36).substr(2,10),candidate},candidateFromJingle:function(cand){var line="a=candidate:";switch(line+=cand.getAttribute("foundation"),line+=" ",line+=cand.getAttribute("component"),line+=" ",line+=cand.getAttribute("protocol"),line+=" ",line+=cand.getAttribute("priority"),line+=" ",line+=cand.getAttribute("ip"),line+=" ",line+=cand.getAttribute("port"),line+=" ",line+="typ",line+=" "+cand.getAttribute("type"),line+=" ",cand.getAttribute("type")){case"srflx":case"prflx":case"relay":cand.getAttribute("rel-addr")&&cand.getAttribute("rel-port")&&(line+="raddr",line+=" ",line+=cand.getAttribute("rel-addr"),line+=" ",line+="rport",line+=" ",line+=cand.getAttribute("rel-port"),line+=" ")}return line+="generation",line+=" ",line+=cand.getAttribute("generation")||"0",line+"\r\n"}}}(jQuery);/*!
55
+ * Source: build/lib/strophe.jingle/strophe.jingle.adapter.js, license: MIT, url: https://github.com/ESTOS/strophe.jingle */
56
+ var setupRTC,getUserMediaWithConstraints,TraceablePeerConnection;!function($){TraceablePeerConnection=function(ice_config,constraints){var self=this,RTCPeerconnection=navigator.mozGetUserMedia?mozRTCPeerConnection:webkitRTCPeerConnection;this.peerconnection=new RTCPeerconnection(ice_config,constraints),this.updateLog=[],this.stats={},this.statsinterval=null,this.maxstats=300,this.trace=function(what,info){self.updateLog.push({time:new Date,type:what,value:info||""})},this.onicecandidate=null,this.peerconnection.onicecandidate=function(event){self.trace("onicecandidate",JSON.stringify(event.candidate,null," ")),null!==self.onicecandidate&&self.onicecandidate(event)},this.onaddstream=null,this.peerconnection.onaddstream=function(event){self.trace("onaddstream",event.stream.id),null!==self.onaddstream&&self.onaddstream(event)},this.onremovestream=null,this.peerconnection.onremovestream=function(event){self.trace("onremovestream",event.stream.id),null!==self.onremovestream&&self.onremovestream(event)},this.onsignalingstatechange=null,this.peerconnection.onsignalingstatechange=function(event){self.trace("onsignalingstatechange",self.signalingState),null!==self.onsignalingstatechange&&self.onsignalingstatechange(event)},this.oniceconnectionstatechange=null,this.peerconnection.oniceconnectionstatechange=function(event){self.trace("oniceconnectionstatechange",self.iceConnectionState),null!==self.oniceconnectionstatechange&&self.oniceconnectionstatechange(event)},this.onnegotiationneeded=null,this.peerconnection.onnegotiationneeded=function(event){self.trace("onnegotiationneeded"),null!==self.onnegotiationneeded&&self.onnegotiationneeded(event)},self.ondatachannel=null,this.peerconnection.ondatachannel=function(event){self.trace("ondatachannel",event),null!==self.ondatachannel&&self.ondatachannel(event)},navigator.mozGetUserMedia||(this.statsinterval=window.setInterval(function(){self.peerconnection.getStats(function(stats){for(var results=stats.result(),i=0;i<results.length;++i){var now=new Date;results[i].names().forEach(function(name){var id=results[i].id+"-"+name;self.stats[id]||(self.stats[id]={startTime:now,endTime:now,values:[],times:[]}),self.stats[id].values.push(results[i].stat(name)),self.stats[id].times.push(now.getTime()),self.stats[id].values.length>self.maxstats&&(self.stats[id].values.shift(),self.stats[id].times.shift()),self.stats[id].endTime=now})}})},1e3))},dumpSDP=function(description){return"type: "+description.type+"\r\n"+description.sdp},void 0!==TraceablePeerConnection.prototype.__defineGetter__&&(TraceablePeerConnection.prototype.__defineGetter__("signalingState",function(){return this.peerconnection.signalingState}),TraceablePeerConnection.prototype.__defineGetter__("iceConnectionState",function(){return this.peerconnection.iceConnectionState}),TraceablePeerConnection.prototype.__defineGetter__("localDescription",function(){return this.peerconnection.localDescription}),TraceablePeerConnection.prototype.__defineGetter__("remoteDescription",function(){return this.peerconnection.remoteDescription})),TraceablePeerConnection.prototype.addStream=function(stream){this.trace("addStream",stream.id),this.peerconnection.addStream(stream)},TraceablePeerConnection.prototype.removeStream=function(stream){this.trace("removeStream",stream.id),this.peerconnection.removeStream(stream)},TraceablePeerConnection.prototype.createDataChannel=function(label,opts){this.trace("createDataChannel",label,opts),this.peerconnection.createDataChannel(label,opts)},TraceablePeerConnection.prototype.setLocalDescription=function(description,successCallback,failureCallback){var self=this;this.trace("setLocalDescription",dumpSDP(description)),this.peerconnection.setLocalDescription(description,function(){self.trace("setLocalDescriptionOnSuccess"),successCallback()},function(err){self.trace("setLocalDescriptionOnFailure",err),failureCallback(err)})},TraceablePeerConnection.prototype.setRemoteDescription=function(description,successCallback,failureCallback){var self=this;this.trace("setRemoteDescription",dumpSDP(description)),this.peerconnection.setRemoteDescription(description,function(){self.trace("setRemoteDescriptionOnSuccess"),successCallback()},function(err){self.trace("setRemoteDescriptionOnFailure",err),failureCallback(err)})},TraceablePeerConnection.prototype.close=function(){this.trace("stop"),null!==this.statsinterval&&(window.clearInterval(this.statsinterval),this.statsinterval=null),this.peerconnection.close()},TraceablePeerConnection.prototype.createOffer=function(successCallback,failureCallback,constraints){var self=this;this.trace("createOffer",JSON.stringify(constraints,null," ")),this.peerconnection.createOffer(function(offer){self.trace("createOfferOnSuccess",dumpSDP(offer)),successCallback(offer)},function(err){self.trace("createOfferOnFailure",err),failureCallback(err)},constraints)},TraceablePeerConnection.prototype.createAnswer=function(successCallback,failureCallback,constraints){var self=this;this.trace("createAnswer",JSON.stringify(constraints,null," ")),this.peerconnection.createAnswer(function(answer){self.trace("createAnswerOnSuccess",dumpSDP(answer)),successCallback(answer)},function(err){self.trace("createAnswerOnFailure",err),failureCallback(err)},constraints)},TraceablePeerConnection.prototype.addIceCandidate=function(candidate){this.trace("addIceCandidate",JSON.stringify(candidate,null," ")),this.peerconnection.addIceCandidate(candidate)},TraceablePeerConnection.prototype.getStats=function(callback){navigator.mozGetUserMedia||this.peerconnection.getStats(callback)},setupRTC=function(){var RTC=null;if(navigator.mozGetUserMedia){console.log("This appears to be Firefox");var version=parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1],10);version>=22&&(RTC={peerconnection:mozRTCPeerConnection,browser:"firefox",getUserMedia:navigator.mozGetUserMedia.bind(navigator),attachMediaStream:function(element,stream){element[0].mozSrcObject=stream,element[0].play()},pc_constraints:{}},MediaStream.prototype.getVideoTracks||(MediaStream.prototype.getVideoTracks=function(){return[]}),MediaStream.prototype.getAudioTracks||(MediaStream.prototype.getAudioTracks=function(){return[]}),RTCSessionDescription=mozRTCSessionDescription,RTCIceCandidate=mozRTCIceCandidate)}else navigator.webkitGetUserMedia&&(console.log("This appears to be Chrome"),RTC={peerconnection:webkitRTCPeerConnection,browser:"chrome",getUserMedia:navigator.webkitGetUserMedia.bind(navigator),attachMediaStream:function(element,stream){element.attr("src",webkitURL.createObjectURL(stream))},pc_constraints:{optional:[{DtlsSrtpKeyAgreement:"true"}]}},-1!=navigator.userAgent.indexOf("Android")&&(RTC.pc_constraints={}),webkitMediaStream.prototype.getVideoTracks||(webkitMediaStream.prototype.getVideoTracks=function(){return this.videoTracks}),webkitMediaStream.prototype.getAudioTracks||(webkitMediaStream.prototype.getAudioTracks=function(){return this.audioTracks}));if(null===RTC)try{console.log("Browser does not appear to be WebRTC-capable")}catch(e){}return RTC},getUserMediaWithConstraints=function(um,resolution,bandwidth,fps){var constraints={audio:!1,video:!1};switch(um.indexOf("video")>=0&&(constraints.video={mandatory:{}}),um.indexOf("audio")>=0&&(constraints.audio={}),um.indexOf("screen")>=0&&(constraints.video={mandatory:{chromeMediaSource:"screen"}}),resolution&&!constraints.video&&(constraints.video={mandatory:{}}),resolution){case"1080":case"fullhd":constraints.video.mandatory.minWidth=1920,constraints.video.mandatory.minHeight=1080,constraints.video.mandatory.minAspectRatio=1.77;break;case"720":case"hd":constraints.video.mandatory.minWidth=1280,constraints.video.mandatory.minHeight=720,constraints.video.mandatory.minAspectRatio=1.77;break;case"360":constraints.video.mandatory.minWidth=640,constraints.video.mandatory.minHeight=360,constraints.video.mandatory.minAspectRatio=1.77;break;case"180":constraints.video.mandatory.minWidth=320,constraints.video.mandatory.minHeight=180,constraints.video.mandatory.minAspectRatio=1.77;break;case"960":constraints.video.mandatory.minWidth=960,constraints.video.mandatory.minHeight=720;break;case"640":case"vga":constraints.video.mandatory.minWidth=640,constraints.video.mandatory.minHeight=480;break;case"320":constraints.video.mandatory.minWidth=320,constraints.video.mandatory.minHeight=240;break;default:-1!=navigator.userAgent.indexOf("Android")&&(constraints.video.mandatory.minWidth=320,constraints.video.mandatory.minHeight=240,constraints.video.mandatory.maxFrameRate=15)}bandwidth&&(constraints.video||(constraints.video={mandatory:{}}),constraints.video.optional=[{bandwidth:bandwidth}]),fps&&(constraints.video||(constraints.video={mandatory:{}}),constraints.video.mandatory.minFrameRate=fps);try{RTC.getUserMedia(constraints,function(stream){console.log("onUserMediaSuccess"),$(document).trigger("mediaready.jingle",[stream])},function(error){console.warn("Failed to get access to local media. Error ",error),$(document).trigger("mediafailure.jingle",[error])})}catch(e){console.error("GUM failed: ",e),$(document).trigger("mediafailure.jingle")}}}(jQuery),function(root,factory){"function"==typeof define&&define.amd?define(factory):"undefined"!=typeof module&&module.exports?module.exports=factory():root.Salsa20=factory()}(this,function(){function Salsa20(key,nonce){this.rounds=20,this.sigmaWords=[1634760805,857760878,2036477234,1797285236],this.keyWords=[],this.nonceWords=[0,0],this.counterWords=[0,0],this.block=[],this.blockUsed=64,this.setKey(key),this.setNonce(nonce)}return Salsa20.prototype.setKey=function(key){for(var i=0,j=0;8>i;i++,j+=4)this.keyWords[i]=255&key[j]|(255&key[j+1])<<8|(255&key[j+2])<<16|(255&key[j+3])<<24;this._reset()},Salsa20.prototype.setNonce=function(nonce){this.nonceWords[0]=255&nonce[0]|(255&nonce[1])<<8|(255&nonce[2])<<16|(255&nonce[3])<<24,this.nonceWords[1]=255&nonce[4]|(255&nonce[5])<<8|(255&nonce[6])<<16|(255&nonce[7])<<24,this._reset()},Salsa20.prototype.getBytes=function(numberOfBytes){for(var out=new Array(numberOfBytes),i=0;numberOfBytes>i;i++)64==this.blockUsed&&(this._generateBlock(),this._incrementCounter(),this.blockUsed=0),out[i]=this.block[this.blockUsed],this.blockUsed++;return out},Salsa20.prototype.getHexString=function(numberOfBytes){for(var hex=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],out=[],bytes=this.getBytes(numberOfBytes),i=0;i<bytes.length;i++)out.push(hex[bytes[i]>>4&15]),out.push(hex[15&bytes[i]]);return out.join("")},Salsa20.prototype._reset=function(){this.counterWords[0]=0,this.counterWords[1]=0,this.blockUsed=64},Salsa20.prototype._incrementCounter=function(){this.counterWords[0]=this.counterWords[0]+1&4294967295,0==this.counterWords[0]&&(this.counterWords[1]=this.counterWords[1]+1&4294967295)},Salsa20.prototype._generateBlock=function(){for(var u,j0=this.sigmaWords[0],j1=this.keyWords[0],j2=this.keyWords[1],j3=this.keyWords[2],j4=this.keyWords[3],j5=this.sigmaWords[1],j6=this.nonceWords[0],j7=this.nonceWords[1],j8=this.counterWords[0],j9=this.counterWords[1],j10=this.sigmaWords[2],j11=this.keyWords[4],j12=this.keyWords[5],j13=this.keyWords[6],j14=this.keyWords[7],j15=this.sigmaWords[3],x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,i=0;i<this.rounds;i+=2)u=x0+x12,x4^=u<<7|u>>>25,u=x4+x0,x8^=u<<9|u>>>23,u=x8+x4,x12^=u<<13|u>>>19,u=x12+x8,x0^=u<<18|u>>>14,u=x5+x1,x9^=u<<7|u>>>25,u=x9+x5,x13^=u<<9|u>>>23,u=x13+x9,x1^=u<<13|u>>>19,u=x1+x13,x5^=u<<18|u>>>14,u=x10+x6,x14^=u<<7|u>>>25,u=x14+x10,x2^=u<<9|u>>>23,u=x2+x14,x6^=u<<13|u>>>19,u=x6+x2,x10^=u<<18|u>>>14,u=x15+x11,x3^=u<<7|u>>>25,u=x3+x15,x7^=u<<9|u>>>23,u=x7+x3,x11^=u<<13|u>>>19,u=x11+x7,x15^=u<<18|u>>>14,u=x0+x3,x1^=u<<7|u>>>25,u=x1+x0,x2^=u<<9|u>>>23,u=x2+x1,x3^=u<<13|u>>>19,u=x3+x2,x0^=u<<18|u>>>14,u=x5+x4,x6^=u<<7|u>>>25,u=x6+x5,x7^=u<<9|u>>>23,u=x7+x6,x4^=u<<13|u>>>19,u=x4+x7,x5^=u<<18|u>>>14,u=x10+x9,x11^=u<<7|u>>>25,u=x11+x10,x8^=u<<9|u>>>23,u=x8+x11,x9^=u<<13|u>>>19,u=x9+x8,x10^=u<<18|u>>>14,u=x15+x14,x12^=u<<7|u>>>25,u=x12+x15,x13^=u<<9|u>>>23,u=x13+x12,x14^=u<<13|u>>>19,u=x14+x13,x15^=u<<18|u>>>14;x0+=j0,x1+=j1,x2+=j2,x3+=j3,x4+=j4,x5+=j5,x6+=j6,x7+=j7,x8+=j8,x9+=j9,x10+=j10,x11+=j11,x12+=j12,x13+=j13,x14+=j14,x15+=j15,this.block[0]=x0>>>0&255,this.block[1]=x0>>>8&255,this.block[2]=x0>>>16&255,this.block[3]=x0>>>24&255,this.block[4]=x1>>>0&255,this.block[5]=x1>>>8&255,this.block[6]=x1>>>16&255,this.block[7]=x1>>>24&255,this.block[8]=x2>>>0&255,this.block[9]=x2>>>8&255,this.block[10]=x2>>>16&255,this.block[11]=x2>>>24&255,this.block[12]=x3>>>0&255,this.block[13]=x3>>>8&255,this.block[14]=x3>>>16&255,this.block[15]=x3>>>24&255,this.block[16]=x4>>>0&255,this.block[17]=x4>>>8&255,this.block[18]=x4>>>16&255,this.block[19]=x4>>>24&255,this.block[20]=x5>>>0&255,this.block[21]=x5>>>8&255,this.block[22]=x5>>>16&255,this.block[23]=x5>>>24&255,this.block[24]=x6>>>0&255,this.block[25]=x6>>>8&255,this.block[26]=x6>>>16&255,this.block[27]=x6>>>24&255,this.block[28]=x7>>>0&255,this.block[29]=x7>>>8&255,this.block[30]=x7>>>16&255,this.block[31]=x7>>>24&255,this.block[32]=x8>>>0&255,this.block[33]=x8>>>8&255,this.block[34]=x8>>>16&255,this.block[35]=x8>>>24&255,this.block[36]=x9>>>0&255,this.block[37]=x9>>>8&255,this.block[38]=x9>>>16&255,this.block[39]=x9>>>24&255,this.block[40]=x10>>>0&255,this.block[41]=x10>>>8&255,this.block[42]=x10>>>16&255,this.block[43]=x10>>>24&255,this.block[44]=x11>>>0&255,this.block[45]=x11>>>8&255,this.block[46]=x11>>>16&255,this.block[47]=x11>>>24&255,this.block[48]=x12>>>0&255,this.block[49]=x12>>>8&255,this.block[50]=x12>>>16&255,this.block[51]=x12>>>24&255,this.block[52]=x13>>>0&255,this.block[53]=x13>>>8&255,this.block[54]=x13>>>16&255,this.block[55]=x13>>>24&255,this.block[56]=x14>>>0&255,this.block[57]=x14>>>8&255,this.block[58]=x14>>>16&255,this.block[59]=x14>>>24&255,this.block[60]=x15>>>0&255,this.block[61]=x15>>>8&255,this.block[62]=x15>>>16&255,this.block[63]=x15>>>24&255},Salsa20}),function(root,factory){"function"==typeof define&&define.amd?define(factory.bind(root,root.crypto||root.msCrypto)):"undefined"!=typeof module&&module.exports?module.exports=factory(require("crypto")):root.BigInt=factory(root.crypto||root.msCrypto)}(this,function(crypto){function findPrimes(n){var i,s,p,ans;for(s=new Array(n),i=0;n>i;i++)s[i]=0;for(s[0]=2,p=0;s[p]<n;){for(i=s[p]*s[p];n>i;i+=s[p])s[i]=1;for(p++,s[p]=s[p-1]+1;s[p]<n&&s[s[p]];s[p]++);}for(ans=new Array(p),i=0;p>i;i++)ans[i]=s[i];return ans}function millerRabin(x,b){var i,j,k,s;if(mr_x1.length!=x.length&&(mr_x1=dup(x),mr_r=dup(x),mr_a=dup(x)),copy_(mr_a,b),copy_(mr_r,x),copy_(mr_x1,x),addInt_(mr_r,-1),addInt_(mr_x1,-1),isZero(mr_r))return 0;for(k=0;0==mr_r[k];k++);for(i=1,j=2;mr_r[k]%j==0;j*=2,i++);if(s=k*bpe+i-1,s&&rightShift_(mr_r,s),powMod_(mr_a,mr_r,x),!equalsInt(mr_a,1)&&!equals(mr_a,mr_x1)){for(j=1;s-1>=j&&!equals(mr_a,mr_x1);){if(squareMod_(mr_a,x),equalsInt(mr_a,1))return 0;j++}if(!equals(mr_a,mr_x1))return 0}return 1}function bitSize(x){var j,z,w;for(j=x.length-1;0==x[j]&&j>0;j--);for(z=0,w=x[j];w;w>>=1,z++);return z+=bpe*j}function expand(x,n){var ans=int2bigInt(0,(x.length>n?x.length:n)*bpe,0);return copy_(ans,x),ans}function mod(x,n){var ans=dup(x);return mod_(ans,n),trim(ans,1)}function mult(x,y){var ans=expand(x,x.length+y.length);return mult_(ans,y),trim(ans,1)}function powMod(x,y,n){var ans=expand(x,n.length);return powMod_(ans,trim(y,2),trim(n,2),0),trim(ans,1)}function sub(x,y){var ans=expand(x,x.length>y.length?x.length+1:y.length+1);return sub_(ans,y),trim(ans,1)}function add(x,y){var ans=expand(x,x.length>y.length?x.length+1:y.length+1);return add_(ans,y),trim(ans,1)}function inverseMod(x,n){var s,ans=expand(x,n.length);return s=inverseMod_(ans,n),s?trim(ans,1):null}function multMod(x,y,n){var ans=expand(x,n.length);return multMod_(ans,y,n),trim(ans,1)}function randBigInt(n,s){var a,b;return a=Math.floor((n-1)/bpe)+2,b=int2bigInt(0,0,a),randBigInt_(b,n,s),b}function randBigInt_(b,n,s){var i,a;for(i=0;i<b.length;i++)b[i]=0;for(a=Math.floor((n-1)/bpe)+1,i=0;a>i;i++)b[i]=randomBitInt(bpe);b[a-1]&=(2<<(n-1)%bpe)-1,1==s&&(b[a-1]|=1<<(n-1)%bpe)}function inverseMod_(x,n){var k=1+2*Math.max(x.length,n.length);if(!(1&x[0]||1&n[0]))return copyInt_(x,0),0;for(eg_u.length!=k&&(eg_u=new Array(k),eg_v=new Array(k),eg_A=new Array(k),eg_B=new Array(k),eg_C=new Array(k),eg_D=new Array(k)),copy_(eg_u,x),copy_(eg_v,n),copyInt_(eg_A,1),copyInt_(eg_B,0),copyInt_(eg_C,0),copyInt_(eg_D,1);;){for(;!(1&eg_u[0]);)halve_(eg_u),1&eg_A[0]||1&eg_B[0]?(add_(eg_A,n),halve_(eg_A),sub_(eg_B,x),halve_(eg_B)):(halve_(eg_A),halve_(eg_B));for(;!(1&eg_v[0]);)halve_(eg_v),1&eg_C[0]||1&eg_D[0]?(add_(eg_C,n),halve_(eg_C),sub_(eg_D,x),halve_(eg_D)):(halve_(eg_C),halve_(eg_D));if(greater(eg_v,eg_u)?(sub_(eg_v,eg_u),sub_(eg_C,eg_A),sub_(eg_D,eg_B)):(sub_(eg_u,eg_v),sub_(eg_A,eg_C),sub_(eg_B,eg_D)),equalsInt(eg_u,0)){for(;negative(eg_C);)add_(eg_C,n);return copy_(x,eg_C),equalsInt(eg_v,1)?1:(copyInt_(x,0),0)}}}function inverseModInt(x,n){for(var a=1,b=0;;){if(1==x)return a;if(0==x)return 0;if(b-=a*Math.floor(n/x),n%=x,1==n)return b;if(0==n)return 0;a-=b*Math.floor(x/n),x%=n}}function negative(x){return x[x.length-1]>>bpe-1&1}function greaterShift(x,y,shift){var i,kx=x.length,ky=y.length,k=ky>kx+shift?kx+shift:ky;for(i=ky-1-shift;kx>i&&i>=0;i++)if(x[i]>0)return 1;for(i=kx-1+shift;ky>i;i++)if(y[i]>0)return 0;for(i=k-1;i>=shift;i--){if(x[i-shift]>y[i])return 1;if(x[i-shift]<y[i])return 0}return 0}function greater(x,y){var i,k=x.length<y.length?x.length:y.length;for(i=x.length;i<y.length;i++)if(y[i])return 0;for(i=y.length;i<x.length;i++)if(x[i])return 1;for(i=k-1;i>=0;i--){if(x[i]>y[i])return 1;if(x[i]<y[i])return 0}return 0}function divide_(x,y,q,r){var kx,ky,i,y1,y2,c,a,b;for(copy_(r,x),ky=y.length;0==y[ky-1];ky--);for(b=y[ky-1],a=0;b;a++)b>>=1;for(a=bpe-a,leftShift_(y,a),leftShift_(r,a),kx=r.length;0==r[kx-1]&&kx>ky;kx--);for(copyInt_(q,0);!greaterShift(y,r,kx-ky);)subShift_(r,y,kx-ky),q[kx-ky]++;for(i=kx-1;i>=ky;i--){for(q[i-ky]=r[i]==y[ky-1]?mask:Math.floor((r[i]*radix+r[i-1])/y[ky-1]);y2=(ky>1?y[ky-2]:0)*q[i-ky],c=y2,y2&=mask,c=(c-y2)/radix,y1=c+q[i-ky]*y[ky-1],c=y1,y1&=mask,c=(c-y1)/radix,c==r[i]?y1==r[i-1]?y2>(i>1?r[i-2]:0):y1>r[i-1]:c>r[i];)q[i-ky]--;linCombShift_(r,y,-q[i-ky],i-ky),negative(r)&&(addShift_(r,y,i-ky),q[i-ky]--)}rightShift_(y,a),rightShift_(r,a)}function modInt(x,n){var i,c=0;for(i=x.length-1;i>=0;i--)c=(c*radix+x[i])%n;return c}function int2bigInt(t,bits,minSize){var k,buff;return k=Math.ceil(bits/bpe)+1,k=minSize>k?minSize:k,buff=new Array(k),copyInt_(buff,t),buff}function str2bigInt(s,base,minSize){var d,i,x,y,kk,k=s.length;if(-1==base){for(x=new Array(0);;){for(y=new Array(x.length+1),i=0;i<x.length;i++)y[i+1]=x[i];if(y[0]=parseInt(s,10),x=y,d=s.indexOf(",",0),1>d)break;if(s=s.substring(d+1),0==s.length)break}return x.length<minSize?(y=new Array(minSize),copy_(y,x),y):x}for(var bb=base,p=0,b=1==base?k:0;bb>1;)1&bb&&(p=1),b+=k,bb>>=1;for(b+=p*k,x=int2bigInt(0,b,0),i=0;k>i&&(d=digitsStr.indexOf(s.substring(i,i+1),0),36>=base&&d>=36&&(d-=26),!(d>=base||0>d));i++)multInt_(x,base),addInt_(x,d);for(k=x.length;k>0&&!x[k-1];k--);for(k=minSize>k+1?minSize:k+1,y=new Array(k),kk=k<x.length?k:x.length,i=0;kk>i;i++)y[i]=x[i];for(;k>i;i++)y[i]=0;return y}function equalsInt(x,y){var i;if(x[0]!=y)return 0;for(i=1;i<x.length;i++)if(x[i])return 0;return 1}function equals(x,y){var i,k=x.length<y.length?x.length:y.length;for(i=0;k>i;i++)if(x[i]!=y[i])return 0;if(x.length>y.length){for(;i<x.length;i++)if(x[i])return 0}else for(;i<y.length;i++)if(y[i])return 0;return 1}function isZero(x){var i;for(i=0;i<x.length;i++)if(x[i])return 0;return 1}function bigInt2str(x,base){var i,t,s="";if(s6.length!=x.length?s6=dup(x):copy_(s6,x),-1==base){for(i=x.length-1;i>0;i--)s+=x[i]+",";s+=x[0]}else for(;!isZero(s6);)t=divInt_(s6,base),s=digitsStr.substring(t,t+1)+s;return 0==s.length&&(s="0"),s}function dup(x){var buff;return buff=new Array(x.length),copy_(buff,x),buff}function copy_(x,y){var i,k=x.length<y.length?x.length:y.length;for(i=0;k>i;i++)x[i]=y[i];for(i=k;i<x.length;i++)x[i]=0}function copyInt_(x,n){var i,c;for(c=n,i=0;i<x.length;i++)x[i]=c&mask,c>>=bpe}function addInt_(x,n){var i,k,c,b;for(x[0]+=n,k=x.length,c=0,i=0;k>i;i++)if(c+=x[i],b=0,0>c&&(b=c&mask,b=-((c-b)/radix),c+=b*radix),x[i]=c&mask,c=(c-x[i])/radix-b,!c)return}function rightShift_(x,n){var i,k=Math.floor(n/bpe);if(k){for(i=0;i<x.length-k;i++)x[i]=x[i+k];for(;i<x.length;i++)x[i]=0;n%=bpe}for(i=0;i<x.length-1;i++)x[i]=mask&(x[i+1]<<bpe-n|x[i]>>n);x[i]>>=n}function halve_(x){var i;for(i=0;i<x.length-1;i++)x[i]=mask&(x[i+1]<<bpe-1|x[i]>>1);x[i]=x[i]>>1|x[i]&radix>>1}function leftShift_(x,n){var i,k=Math.floor(n/bpe);if(k){for(i=x.length;i>=k;i--)x[i]=x[i-k];for(;i>=0;i--)x[i]=0;n%=bpe}if(n){for(i=x.length-1;i>0;i--)x[i]=mask&(x[i]<<n|x[i-1]>>bpe-n);x[i]=mask&x[i]<<n}}function multInt_(x,n){var i,k,c,b;if(n)for(k=x.length,c=0,i=0;k>i;i++)c+=x[i]*n,b=0,0>c&&(b=c&mask,b=-((c-b)/radix),c+=b*radix),x[i]=c&mask,c=(c-x[i])/radix-b}function divInt_(x,n){var i,s,r=0;for(i=x.length-1;i>=0;i--)s=r*radix+x[i],x[i]=Math.floor(s/n),r=s%n;return r}function linCombShift_(x,y,b,ys){var i,c,k,kk;for(k=x.length<ys+y.length?x.length:ys+y.length,kk=x.length,c=0,i=ys;k>i;i++)c+=x[i]+b*y[i-ys],x[i]=c&mask,c=(c-x[i])/radix;for(i=k;c&&kk>i;i++)c+=x[i],x[i]=c&mask,c=(c-x[i])/radix}function addShift_(x,y,ys){var i,c,k,kk;for(k=x.length<ys+y.length?x.length:ys+y.length,kk=x.length,c=0,i=ys;k>i;i++)c+=x[i]+y[i-ys],x[i]=c&mask,c=(c-x[i])/radix;for(i=k;c&&kk>i;i++)c+=x[i],x[i]=c&mask,c=(c-x[i])/radix}function subShift_(x,y,ys){var i,c,k,kk;for(k=x.length<ys+y.length?x.length:ys+y.length,kk=x.length,c=0,i=ys;k>i;i++)c+=x[i]-y[i-ys],x[i]=c&mask,c=(c-x[i])/radix;for(i=k;c&&kk>i;i++)c+=x[i],x[i]=c&mask,c=(c-x[i])/radix}function sub_(x,y){var i,c,k;for(k=x.length<y.length?x.length:y.length,c=0,i=0;k>i;i++)c+=x[i]-y[i],x[i]=c&mask,c=(c-x[i])/radix;for(i=k;c&&i<x.length;i++)c+=x[i],x[i]=c&mask,c=(c-x[i])/radix}function add_(x,y){var i,c,k;for(k=x.length<y.length?x.length:y.length,c=0,i=0;k>i;i++)c+=x[i]+y[i],x[i]=c&mask,c=(c-x[i])/radix;for(i=k;c&&i<x.length;i++)c+=x[i],x[i]=c&mask,c=(c-x[i])/radix}function mult_(x,y){var i;for(ss.length!=2*x.length&&(ss=new Array(2*x.length)),copyInt_(ss,0),i=0;i<y.length;i++)y[i]&&linCombShift_(ss,x,y[i],i);copy_(x,ss)}function mod_(x,n){s4.length!=x.length?s4=dup(x):copy_(s4,x),s5.length!=x.length&&(s5=dup(x)),divide_(s4,n,s5,x)}function multMod_(x,y,n){var i;for(s0.length!=2*x.length&&(s0=new Array(2*x.length)),copyInt_(s0,0),i=0;i<y.length;i++)y[i]&&linCombShift_(s0,x,y[i],i);mod_(s0,n),copy_(x,s0)}function squareMod_(x,n){var i,j,c,kx,k;for(kx=x.length;kx>0&&!x[kx-1];kx--);for(k=kx>n.length?2*kx:2*n.length,s0.length!=k&&(s0=new Array(k)),copyInt_(s0,0),i=0;kx>i;i++){for(c=s0[2*i]+x[i]*x[i],s0[2*i]=c&mask,c=(c-s0[2*i])/radix,j=i+1;kx>j;j++)c=s0[i+j]+2*x[i]*x[j]+c,s0[i+j]=c&mask,c=(c-s0[i+j])/radix;s0[i+kx]=c}mod_(s0,n),copy_(x,s0)}function trim(x,k){var i,y;for(i=x.length;i>0&&!x[i-1];i--);return y=new Array(i+k),copy_(y,x),y}function powMod_(x,y,n){var k1,k2,kn,np;if(s7.length!=n.length&&(s7=dup(n)),0!=(1&n[0])){for(copyInt_(s7,0),kn=n.length;kn>0&&!n[kn-1];kn--);for(np=radix-inverseModInt(modInt(n,radix),radix),s7[kn]=1,multMod_(x,s7,n),s3.length!=x.length?s3=dup(x):copy_(s3,x),k1=y.length-1;k1>0&!y[k1];k1--);if(0==y[k1])return void copyInt_(x,1);for(k2=1<<bpe-1;k2&&!(y[k1]&k2);k2>>=1);for(;;){if(!(k2>>=1)){if(k1--,0>k1)return void mont_(x,one,n,np);k2=1<<bpe-1}mont_(x,x,n,np),k2&y[k1]&&mont_(x,s3,n,np)}}else for(copy_(s7,x),copyInt_(x,1);!equalsInt(y,0);)1&y[0]&&multMod_(x,s7,n),divInt_(y,2),squareMod_(s7,n)}function mont_(x,y,n,np){var i,j,c,ui,t,t2,ks,kn=n.length,ky=y.length;for(sa.length!=kn&&(sa=new Array(kn)),copyInt_(sa,0);kn>0&&0==n[kn-1];kn--);for(;ky>0&&0==y[ky-1];ky--);for(ks=sa.length-1,i=0;kn>i;i++){for(t=sa[0]+x[i]*y[0],ui=(t&mask)*np&mask,c=t+ui*n[0],c=(c-(c&mask))/radix,t=x[i],j=1;ky-4>j;)c+=sa[j]+ui*n[j]+t*y[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++,c+=sa[j]+ui*n[j]+t*y[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++,c+=sa[j]+ui*n[j]+t*y[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++,c+=sa[j]+ui*n[j]+t*y[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++,c+=sa[j]+ui*n[j]+t*y[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++;for(;ky>j;)c+=sa[j]+ui*n[j]+t*y[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++;for(;kn-4>j;)c+=sa[j]+ui*n[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++,c+=sa[j]+ui*n[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++,c+=sa[j]+ui*n[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++,c+=sa[j]+ui*n[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++,c+=sa[j]+ui*n[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++;for(;kn>j;)c+=sa[j]+ui*n[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++;for(;ks>j;)c+=sa[j],t2=sa[j-1]=c&mask,c=(c-t2)/radix,j++;sa[j-1]=c&mask}greater(n,sa)||sub_(sa,n),copy_(x,sa)}function divMod(num,den,n){return multMod(num,inverseMod(den,n),n)}function subMod(one,two,n){return one=mod(one,n),two=mod(two,n),greater(two,one)&&(one=add(one,n)),sub(one,two)}function twoToThe(m){for(var b=Math.floor(m/bpe)+2,t=new Array(b),i=0;b>i;i++)t[i]=0;return t[b-2]=1<<m%bpe,t}function bigInt2bits(bi,pad){pad||(pad=0),bi=dup(bi);for(var ba="";!isZero(bi);)ba=_num2bin[255&bi[0]]+ba,rightShift_(bi,8);for(;ba.length<pad;)ba="\x00"+ba;return ba}function ba2bigInt(data){var mpi=str2bigInt("0",10,data.length);return data.forEach(function(d,i){i&&leftShift_(mpi,8),mpi[0]|=d}),mpi}function getSeed(){return randomBytes(40)}function randomByte(){return randomBytes(1)[0]}function randomBitInt(k){if(k>31)throw new Error("Too many bits.");var i=0,r=0,b=Math.floor(k/8),mask=(1<<k%8)-1;for(mask&&(r=randomByte()&mask);b>i;i++)r=256*r+randomByte();return r}var bpe=26,radix=1<<bpe,mask=radix-1,digitsStr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_=!@#$%^&*()[]{}|;:,.<>/?`~ \\'\"+-",one=int2bigInt(1,1,1),t=new Array(0),ss=t,s0=t,s3=t,s4=t,s5=t,s6=t,s7=t,sa=t,mr_x1=t,mr_r=t,mr_a=t,eg_v=t,eg_u=t,eg_A=t,eg_B=t,eg_C=t,eg_D=t,primes=t,_num2bin=function(){for(var i=0,_num2bin={};256>i;++i)_num2bin[i]=String.fromCharCode(i);return _num2bin}(),randomBytes=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomBytes)return function(n){try{var buf=crypto.randomBytes(n)}catch(e){throw e}return Array.prototype.slice.call(buf,0)};if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues)return function(n){var buf=new Uint8Array(n);return crypto.getRandomValues(buf),Array.prototype.slice.call(buf,0)};throw new Error("Keys should not be generated without CSPRNG.")}();return{str2bigInt:str2bigInt,bigInt2str:bigInt2str,int2bigInt:int2bigInt,multMod:multMod,powMod:powMod,inverseMod:inverseMod,randBigInt:randBigInt,randBigInt_:randBigInt_,equals:equals,equalsInt:equalsInt,sub:sub,mod:mod,modInt:modInt,mult:mult,divInt_:divInt_,rightShift_:rightShift_,dup:dup,greater:greater,add:add,isZero:isZero,bitSize:bitSize,millerRabin:millerRabin,divide_:divide_,trim:trim,primes:primes,findPrimes:findPrimes,getSeed:getSeed,divMod:divMod,subMod:subMod,twoToThe:twoToThe,bigInt2bits:bigInt2bits,ba2bigInt:ba2bigInt}}),function(root,factory){"function"==typeof define&&define.amd?define(factory):"undefined"!=typeof module&&module.exports?module.exports=factory():root.CryptoJS=factory()}(this,function(){var CryptoJS=CryptoJS||function(Math,undefined){var C={},C_lib=C.lib={},Base=C_lib.Base=function(){function F(){}return{extend:function(overrides){F.prototype=this;var subtype=new F;return overrides&&subtype.mixIn(overrides),subtype.hasOwnProperty("init")||(subtype.init=function(){subtype.$super.init.apply(this,arguments)}),subtype.init.prototype=subtype,subtype.$super=this,subtype},create:function(){var instance=this.extend();return instance.init.apply(instance,arguments),instance},init:function(){},mixIn:function(properties){for(var propertyName in properties)properties.hasOwnProperty(propertyName)&&(this[propertyName]=properties[propertyName]);properties.hasOwnProperty("toString")&&(this.toString=properties.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),WordArray=C_lib.WordArray=Base.extend({init:function(words,sigBytes){words=this.words=words||[],this.sigBytes=sigBytes!=undefined?sigBytes:4*words.length},toString:function(encoder){return(encoder||Hex).stringify(this)},concat:function(wordArray){var thisWords=this.words,thatWords=wordArray.words,thisSigBytes=this.sigBytes,thatSigBytes=wordArray.sigBytes;if(this.clamp(),thisSigBytes%4)for(var i=0;thatSigBytes>i;i++){var thatByte=thatWords[i>>>2]>>>24-i%4*8&255;thisWords[thisSigBytes+i>>>2]|=thatByte<<24-(thisSigBytes+i)%4*8}else if(thatWords.length>65535)for(var i=0;thatSigBytes>i;i+=4)thisWords[thisSigBytes+i>>>2]=thatWords[i>>>2];else thisWords.push.apply(thisWords,thatWords);return this.sigBytes+=thatSigBytes,this},clamp:function(){var words=this.words,sigBytes=this.sigBytes;words[sigBytes>>>2]&=4294967295<<32-sigBytes%4*8,words.length=Math.ceil(sigBytes/4)},clone:function(){var clone=Base.clone.call(this);return clone.words=this.words.slice(0),clone},random:function(nBytes){for(var words=[],i=0;nBytes>i;i+=4)words.push(4294967296*Math.random()|0);return new WordArray.init(words,nBytes)}}),C_enc=C.enc={},Hex=C_enc.Hex={stringify:function(wordArray){for(var words=wordArray.words,sigBytes=wordArray.sigBytes,hexChars=[],i=0;sigBytes>i;i++){var bite=words[i>>>2]>>>24-i%4*8&255;hexChars.push((bite>>>4).toString(16)),hexChars.push((15&bite).toString(16))}return hexChars.join("")},parse:function(hexStr){for(var hexStrLength=hexStr.length,words=[],i=0;hexStrLength>i;i+=2)words[i>>>3]|=parseInt(hexStr.substr(i,2),16)<<24-i%8*4;return new WordArray.init(words,hexStrLength/2)}},Latin1=C_enc.Latin1={stringify:function(wordArray){for(var words=wordArray.words,sigBytes=wordArray.sigBytes,latin1Chars=[],i=0;sigBytes>i;i++){var bite=words[i>>>2]>>>24-i%4*8&255;latin1Chars.push(String.fromCharCode(bite))}return latin1Chars.join("")},parse:function(latin1Str){for(var latin1StrLength=latin1Str.length,words=[],i=0;latin1StrLength>i;i++)words[i>>>2]|=(255&latin1Str.charCodeAt(i))<<24-i%4*8;return new WordArray.init(words,latin1StrLength)}},Utf8=C_enc.Utf8={stringify:function(wordArray){try{return decodeURIComponent(escape(Latin1.stringify(wordArray)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(utf8Str){return Latin1.parse(unescape(encodeURIComponent(utf8Str)))}},BufferedBlockAlgorithm=C_lib.BufferedBlockAlgorithm=Base.extend({reset:function(){this._data=new WordArray.init,this._nDataBytes=0},_append:function(data){"string"==typeof data&&(data=Utf8.parse(data)),this._data.concat(data),this._nDataBytes+=data.sigBytes},_process:function(doFlush){var data=this._data,dataWords=data.words,dataSigBytes=data.sigBytes,blockSize=this.blockSize,blockSizeBytes=4*blockSize,nBlocksReady=dataSigBytes/blockSizeBytes;nBlocksReady=doFlush?Math.ceil(nBlocksReady):Math.max((0|nBlocksReady)-this._minBufferSize,0);var nWordsReady=nBlocksReady*blockSize,nBytesReady=Math.min(4*nWordsReady,dataSigBytes);if(nWordsReady){for(var offset=0;nWordsReady>offset;offset+=blockSize)this._doProcessBlock(dataWords,offset);var processedWords=dataWords.splice(0,nWordsReady);data.sigBytes-=nBytesReady}return new WordArray.init(processedWords,nBytesReady)},clone:function(){var clone=Base.clone.call(this);return clone._data=this._data.clone(),clone},_minBufferSize:0}),C_algo=(C_lib.Hasher=BufferedBlockAlgorithm.extend({cfg:Base.extend(),init:function(cfg){this.cfg=this.cfg.extend(cfg),this.reset()},reset:function(){BufferedBlockAlgorithm.reset.call(this),this._doReset()},update:function(messageUpdate){return this._append(messageUpdate),this._process(),this},finalize:function(messageUpdate){messageUpdate&&this._append(messageUpdate);var hash=this._doFinalize();return hash},blockSize:16,_createHelper:function(hasher){return function(message,cfg){return new hasher.init(cfg).finalize(message)}},_createHmacHelper:function(hasher){return function(message,key){return new C_algo.HMAC.init(hasher,key).finalize(message)}}}),C.algo={});
57
+ return C}(Math);return function(){{var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,C_enc=C.enc;C_enc.Base64={stringify:function(wordArray){var words=wordArray.words,sigBytes=wordArray.sigBytes,map=this._map;wordArray.clamp();for(var base64Chars=[],i=0;sigBytes>i;i+=3)for(var byte1=words[i>>>2]>>>24-i%4*8&255,byte2=words[i+1>>>2]>>>24-(i+1)%4*8&255,byte3=words[i+2>>>2]>>>24-(i+2)%4*8&255,triplet=byte1<<16|byte2<<8|byte3,j=0;4>j&&sigBytes>i+.75*j;j++)base64Chars.push(map.charAt(triplet>>>6*(3-j)&63));var paddingChar=map.charAt(64);if(paddingChar)for(;base64Chars.length%4;)base64Chars.push(paddingChar);return base64Chars.join("")},parse:function(base64Str){var base64StrLength=base64Str.length,map=this._map,paddingChar=map.charAt(64);if(paddingChar){var paddingIndex=base64Str.indexOf(paddingChar);-1!=paddingIndex&&(base64StrLength=paddingIndex)}for(var words=[],nBytes=0,i=0;base64StrLength>i;i++)if(i%4){var bits1=map.indexOf(base64Str.charAt(i-1))<<i%4*2,bits2=map.indexOf(base64Str.charAt(i))>>>6-i%4*2;words[nBytes>>>2]|=(bits1|bits2)<<24-nBytes%4*8,nBytes++}return WordArray.create(words,nBytes)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}}(),CryptoJS.lib.Cipher||function(undefined){var C=CryptoJS,C_lib=C.lib,Base=C_lib.Base,WordArray=C_lib.WordArray,BufferedBlockAlgorithm=C_lib.BufferedBlockAlgorithm,C_enc=C.enc,Base64=(C_enc.Utf8,C_enc.Base64),C_algo=C.algo,EvpKDF=C_algo.EvpKDF,Cipher=C_lib.Cipher=BufferedBlockAlgorithm.extend({cfg:Base.extend(),createEncryptor:function(key,cfg){return this.create(this._ENC_XFORM_MODE,key,cfg)},createDecryptor:function(key,cfg){return this.create(this._DEC_XFORM_MODE,key,cfg)},init:function(xformMode,key,cfg){this.cfg=this.cfg.extend(cfg),this._xformMode=xformMode,this._key=key,this.reset()},reset:function(){BufferedBlockAlgorithm.reset.call(this),this._doReset()},process:function(dataUpdate){return this._append(dataUpdate),this._process()},finalize:function(dataUpdate){dataUpdate&&this._append(dataUpdate);var finalProcessedData=this._doFinalize();return finalProcessedData},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function selectCipherStrategy(key){return"string"==typeof key?PasswordBasedCipher:SerializableCipher}return function(cipher){return{encrypt:function(message,key,cfg){return selectCipherStrategy(key).encrypt(cipher,message,key,cfg)},decrypt:function(ciphertext,key,cfg){return selectCipherStrategy(key).decrypt(cipher,ciphertext,key,cfg)}}}}()}),C_mode=(C_lib.StreamCipher=Cipher.extend({_doFinalize:function(){var finalProcessedBlocks=this._process(!0);return finalProcessedBlocks},blockSize:1}),C.mode={}),BlockCipherMode=C_lib.BlockCipherMode=Base.extend({createEncryptor:function(cipher,iv){return this.Encryptor.create(cipher,iv)},createDecryptor:function(cipher,iv){return this.Decryptor.create(cipher,iv)},init:function(cipher,iv){this._cipher=cipher,this._iv=iv}}),CBC=C_mode.CBC=function(){function xorBlock(words,offset,blockSize){var iv=this._iv;if(iv){var block=iv;this._iv=undefined}else var block=this._prevBlock;for(var i=0;blockSize>i;i++)words[offset+i]^=block[i]}var CBC=BlockCipherMode.extend();return CBC.Encryptor=CBC.extend({processBlock:function(words,offset){var cipher=this._cipher,blockSize=cipher.blockSize;xorBlock.call(this,words,offset,blockSize),cipher.encryptBlock(words,offset),this._prevBlock=words.slice(offset,offset+blockSize)}}),CBC.Decryptor=CBC.extend({processBlock:function(words,offset){var cipher=this._cipher,blockSize=cipher.blockSize,thisBlock=words.slice(offset,offset+blockSize);cipher.decryptBlock(words,offset),xorBlock.call(this,words,offset,blockSize),this._prevBlock=thisBlock}}),CBC}(),C_pad=C.pad={},Pkcs7=C_pad.Pkcs7={pad:function(data,blockSize){for(var blockSizeBytes=4*blockSize,nPaddingBytes=blockSizeBytes-data.sigBytes%blockSizeBytes,paddingWord=nPaddingBytes<<24|nPaddingBytes<<16|nPaddingBytes<<8|nPaddingBytes,paddingWords=[],i=0;nPaddingBytes>i;i+=4)paddingWords.push(paddingWord);var padding=WordArray.create(paddingWords,nPaddingBytes);data.concat(padding)},unpad:function(data){var nPaddingBytes=255&data.words[data.sigBytes-1>>>2];data.sigBytes-=nPaddingBytes}},CipherParams=(C_lib.BlockCipher=Cipher.extend({cfg:Cipher.cfg.extend({mode:CBC,padding:Pkcs7}),reset:function(){Cipher.reset.call(this);var cfg=this.cfg,iv=cfg.iv,mode=cfg.mode;if(this._xformMode==this._ENC_XFORM_MODE)var modeCreator=mode.createEncryptor;else{var modeCreator=mode.createDecryptor;this._minBufferSize=1}this._mode=modeCreator.call(mode,this,iv&&iv.words)},_doProcessBlock:function(words,offset){this._mode.processBlock(words,offset)},_doFinalize:function(){var padding=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){padding.pad(this._data,this.blockSize);var finalProcessedBlocks=this._process(!0)}else{var finalProcessedBlocks=this._process(!0);padding.unpad(finalProcessedBlocks)}return finalProcessedBlocks},blockSize:4}),C_lib.CipherParams=Base.extend({init:function(cipherParams){this.mixIn(cipherParams)},toString:function(formatter){return(formatter||this.formatter).stringify(this)}})),C_format=C.format={},OpenSSLFormatter=C_format.OpenSSL={stringify:function(cipherParams){var ciphertext=cipherParams.ciphertext,salt=cipherParams.salt;if(salt)var wordArray=WordArray.create([1398893684,1701076831]).concat(salt).concat(ciphertext);else var wordArray=ciphertext;return wordArray.toString(Base64)},parse:function(openSSLStr){var ciphertext=Base64.parse(openSSLStr),ciphertextWords=ciphertext.words;if(1398893684==ciphertextWords[0]&&1701076831==ciphertextWords[1]){var salt=WordArray.create(ciphertextWords.slice(2,4));ciphertextWords.splice(0,4),ciphertext.sigBytes-=16}return CipherParams.create({ciphertext:ciphertext,salt:salt})}},SerializableCipher=C_lib.SerializableCipher=Base.extend({cfg:Base.extend({format:OpenSSLFormatter}),encrypt:function(cipher,message,key,cfg){cfg=this.cfg.extend(cfg);var encryptor=cipher.createEncryptor(key,cfg),ciphertext=encryptor.finalize(message),cipherCfg=encryptor.cfg;return CipherParams.create({ciphertext:ciphertext,key:key,iv:cipherCfg.iv,algorithm:cipher,mode:cipherCfg.mode,padding:cipherCfg.padding,blockSize:cipher.blockSize,formatter:cfg.format})},decrypt:function(cipher,ciphertext,key,cfg){cfg=this.cfg.extend(cfg),ciphertext=this._parse(ciphertext,cfg.format);var plaintext=cipher.createDecryptor(key,cfg).finalize(ciphertext.ciphertext);return plaintext},_parse:function(ciphertext,format){return"string"==typeof ciphertext?format.parse(ciphertext,this):ciphertext}}),C_kdf=C.kdf={},OpenSSLKdf=C_kdf.OpenSSL={execute:function(password,keySize,ivSize,salt){salt||(salt=WordArray.random(8));var key=EvpKDF.create({keySize:keySize+ivSize}).compute(password,salt),iv=WordArray.create(key.words.slice(keySize),4*ivSize);return key.sigBytes=4*keySize,CipherParams.create({key:key,iv:iv,salt:salt})}},PasswordBasedCipher=C_lib.PasswordBasedCipher=SerializableCipher.extend({cfg:SerializableCipher.cfg.extend({kdf:OpenSSLKdf}),encrypt:function(cipher,message,password,cfg){cfg=this.cfg.extend(cfg);var derivedParams=cfg.kdf.execute(password,cipher.keySize,cipher.ivSize);cfg.iv=derivedParams.iv;var ciphertext=SerializableCipher.encrypt.call(this,cipher,message,derivedParams.key,cfg);return ciphertext.mixIn(derivedParams),ciphertext},decrypt:function(cipher,ciphertext,password,cfg){cfg=this.cfg.extend(cfg),ciphertext=this._parse(ciphertext,cfg.format);var derivedParams=cfg.kdf.execute(password,cipher.keySize,cipher.ivSize,ciphertext.salt);cfg.iv=derivedParams.iv;var plaintext=SerializableCipher.decrypt.call(this,cipher,ciphertext,derivedParams.key,cfg);return plaintext}})}(),function(){var C=CryptoJS,C_lib=C.lib,BlockCipher=C_lib.BlockCipher,C_algo=C.algo,SBOX=[],INV_SBOX=[],SUB_MIX_0=[],SUB_MIX_1=[],SUB_MIX_2=[],SUB_MIX_3=[],INV_SUB_MIX_0=[],INV_SUB_MIX_1=[],INV_SUB_MIX_2=[],INV_SUB_MIX_3=[];!function(){for(var d=[],i=0;256>i;i++)d[i]=128>i?i<<1:i<<1^283;for(var x=0,xi=0,i=0;256>i;i++){var sx=xi^xi<<1^xi<<2^xi<<3^xi<<4;sx=sx>>>8^255&sx^99,SBOX[x]=sx,INV_SBOX[sx]=x;var x2=d[x],x4=d[x2],x8=d[x4],t=257*d[sx]^16843008*sx;SUB_MIX_0[x]=t<<24|t>>>8,SUB_MIX_1[x]=t<<16|t>>>16,SUB_MIX_2[x]=t<<8|t>>>24,SUB_MIX_3[x]=t;var t=16843009*x8^65537*x4^257*x2^16843008*x;INV_SUB_MIX_0[sx]=t<<24|t>>>8,INV_SUB_MIX_1[sx]=t<<16|t>>>16,INV_SUB_MIX_2[sx]=t<<8|t>>>24,INV_SUB_MIX_3[sx]=t,x?(x=x2^d[d[d[x8^x2]]],xi^=d[d[xi]]):x=xi=1}}();var RCON=[0,1,2,4,8,16,32,64,128,27,54],AES=C_algo.AES=BlockCipher.extend({_doReset:function(){for(var key=this._key,keyWords=key.words,keySize=key.sigBytes/4,nRounds=this._nRounds=keySize+6,ksRows=4*(nRounds+1),keySchedule=this._keySchedule=[],ksRow=0;ksRows>ksRow;ksRow++)if(keySize>ksRow)keySchedule[ksRow]=keyWords[ksRow];else{var t=keySchedule[ksRow-1];ksRow%keySize?keySize>6&&ksRow%keySize==4&&(t=SBOX[t>>>24]<<24|SBOX[t>>>16&255]<<16|SBOX[t>>>8&255]<<8|SBOX[255&t]):(t=t<<8|t>>>24,t=SBOX[t>>>24]<<24|SBOX[t>>>16&255]<<16|SBOX[t>>>8&255]<<8|SBOX[255&t],t^=RCON[ksRow/keySize|0]<<24),keySchedule[ksRow]=keySchedule[ksRow-keySize]^t}for(var invKeySchedule=this._invKeySchedule=[],invKsRow=0;ksRows>invKsRow;invKsRow++){var ksRow=ksRows-invKsRow;if(invKsRow%4)var t=keySchedule[ksRow];else var t=keySchedule[ksRow-4];invKeySchedule[invKsRow]=4>invKsRow||4>=ksRow?t:INV_SUB_MIX_0[SBOX[t>>>24]]^INV_SUB_MIX_1[SBOX[t>>>16&255]]^INV_SUB_MIX_2[SBOX[t>>>8&255]]^INV_SUB_MIX_3[SBOX[255&t]]}},encryptBlock:function(M,offset){this._doCryptBlock(M,offset,this._keySchedule,SUB_MIX_0,SUB_MIX_1,SUB_MIX_2,SUB_MIX_3,SBOX)},decryptBlock:function(M,offset){var t=M[offset+1];M[offset+1]=M[offset+3],M[offset+3]=t,this._doCryptBlock(M,offset,this._invKeySchedule,INV_SUB_MIX_0,INV_SUB_MIX_1,INV_SUB_MIX_2,INV_SUB_MIX_3,INV_SBOX);var t=M[offset+1];M[offset+1]=M[offset+3],M[offset+3]=t},_doCryptBlock:function(M,offset,keySchedule,SUB_MIX_0,SUB_MIX_1,SUB_MIX_2,SUB_MIX_3,SBOX){for(var nRounds=this._nRounds,s0=M[offset]^keySchedule[0],s1=M[offset+1]^keySchedule[1],s2=M[offset+2]^keySchedule[2],s3=M[offset+3]^keySchedule[3],ksRow=4,round=1;nRounds>round;round++){var t0=SUB_MIX_0[s0>>>24]^SUB_MIX_1[s1>>>16&255]^SUB_MIX_2[s2>>>8&255]^SUB_MIX_3[255&s3]^keySchedule[ksRow++],t1=SUB_MIX_0[s1>>>24]^SUB_MIX_1[s2>>>16&255]^SUB_MIX_2[s3>>>8&255]^SUB_MIX_3[255&s0]^keySchedule[ksRow++],t2=SUB_MIX_0[s2>>>24]^SUB_MIX_1[s3>>>16&255]^SUB_MIX_2[s0>>>8&255]^SUB_MIX_3[255&s1]^keySchedule[ksRow++],t3=SUB_MIX_0[s3>>>24]^SUB_MIX_1[s0>>>16&255]^SUB_MIX_2[s1>>>8&255]^SUB_MIX_3[255&s2]^keySchedule[ksRow++];s0=t0,s1=t1,s2=t2,s3=t3}var t0=(SBOX[s0>>>24]<<24|SBOX[s1>>>16&255]<<16|SBOX[s2>>>8&255]<<8|SBOX[255&s3])^keySchedule[ksRow++],t1=(SBOX[s1>>>24]<<24|SBOX[s2>>>16&255]<<16|SBOX[s3>>>8&255]<<8|SBOX[255&s0])^keySchedule[ksRow++],t2=(SBOX[s2>>>24]<<24|SBOX[s3>>>16&255]<<16|SBOX[s0>>>8&255]<<8|SBOX[255&s1])^keySchedule[ksRow++],t3=(SBOX[s3>>>24]<<24|SBOX[s0>>>16&255]<<16|SBOX[s1>>>8&255]<<8|SBOX[255&s2])^keySchedule[ksRow++];M[offset]=t0,M[offset+1]=t1,M[offset+2]=t2,M[offset+3]=t3},keySize:8});C.AES=BlockCipher._createHelper(AES)}(),function(){var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_algo=C.algo,W=[],SHA1=C_algo.SHA1=Hasher.extend({_doReset:function(){this._hash=new WordArray.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(M,offset){for(var H=this._hash.words,a=H[0],b=H[1],c=H[2],d=H[3],e=H[4],i=0;80>i;i++){if(16>i)W[i]=0|M[offset+i];else{var n=W[i-3]^W[i-8]^W[i-14]^W[i-16];W[i]=n<<1|n>>>31}var t=(a<<5|a>>>27)+e+W[i];t+=20>i?(b&c|~b&d)+1518500249:40>i?(b^c^d)+1859775393:60>i?(b&c|b&d|c&d)-1894007588:(b^c^d)-899497514,e=d,d=c,c=b<<30|b>>>2,b=a,a=t}H[0]=H[0]+a|0,H[1]=H[1]+b|0,H[2]=H[2]+c|0,H[3]=H[3]+d|0,H[4]=H[4]+e|0},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;return dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32,dataWords[(nBitsLeft+64>>>9<<4)+14]=Math.floor(nBitsTotal/4294967296),dataWords[(nBitsLeft+64>>>9<<4)+15]=nBitsTotal,data.sigBytes=4*dataWords.length,this._process(),this._hash},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone}});C.SHA1=Hasher._createHelper(SHA1),C.HmacSHA1=Hasher._createHmacHelper(SHA1)}(),function(Math){var C=CryptoJS,C_lib=C.lib,WordArray=C_lib.WordArray,Hasher=C_lib.Hasher,C_algo=C.algo,H=[],K=[];!function(){function isPrime(n){for(var sqrtN=Math.sqrt(n),factor=2;sqrtN>=factor;factor++)if(!(n%factor))return!1;return!0}function getFractionalBits(n){return 4294967296*(n-(0|n))|0}for(var n=2,nPrime=0;64>nPrime;)isPrime(n)&&(8>nPrime&&(H[nPrime]=getFractionalBits(Math.pow(n,.5))),K[nPrime]=getFractionalBits(Math.pow(n,1/3)),nPrime++),n++}();var W=[],SHA256=C_algo.SHA256=Hasher.extend({_doReset:function(){this._hash=new WordArray.init(H.slice(0))},_doProcessBlock:function(M,offset){for(var H=this._hash.words,a=H[0],b=H[1],c=H[2],d=H[3],e=H[4],f=H[5],g=H[6],h=H[7],i=0;64>i;i++){if(16>i)W[i]=0|M[offset+i];else{var gamma0x=W[i-15],gamma0=(gamma0x<<25|gamma0x>>>7)^(gamma0x<<14|gamma0x>>>18)^gamma0x>>>3,gamma1x=W[i-2],gamma1=(gamma1x<<15|gamma1x>>>17)^(gamma1x<<13|gamma1x>>>19)^gamma1x>>>10;W[i]=gamma0+W[i-7]+gamma1+W[i-16]}var ch=e&f^~e&g,maj=a&b^a&c^b&c,sigma0=(a<<30|a>>>2)^(a<<19|a>>>13)^(a<<10|a>>>22),sigma1=(e<<26|e>>>6)^(e<<21|e>>>11)^(e<<7|e>>>25),t1=h+sigma1+ch+K[i]+W[i],t2=sigma0+maj;h=g,g=f,f=e,e=d+t1|0,d=c,c=b,b=a,a=t1+t2|0}H[0]=H[0]+a|0,H[1]=H[1]+b|0,H[2]=H[2]+c|0,H[3]=H[3]+d|0,H[4]=H[4]+e|0,H[5]=H[5]+f|0,H[6]=H[6]+g|0,H[7]=H[7]+h|0},_doFinalize:function(){var data=this._data,dataWords=data.words,nBitsTotal=8*this._nDataBytes,nBitsLeft=8*data.sigBytes;return dataWords[nBitsLeft>>>5]|=128<<24-nBitsLeft%32,dataWords[(nBitsLeft+64>>>9<<4)+14]=Math.floor(nBitsTotal/4294967296),dataWords[(nBitsLeft+64>>>9<<4)+15]=nBitsTotal,data.sigBytes=4*dataWords.length,this._process(),this._hash},clone:function(){var clone=Hasher.clone.call(this);return clone._hash=this._hash.clone(),clone}});C.SHA256=Hasher._createHelper(SHA256),C.HmacSHA256=Hasher._createHmacHelper(SHA256)}(Math),function(){{var C=CryptoJS,C_lib=C.lib,Base=C_lib.Base,C_enc=C.enc,Utf8=C_enc.Utf8,C_algo=C.algo;C_algo.HMAC=Base.extend({init:function(hasher,key){hasher=this._hasher=new hasher.init,"string"==typeof key&&(key=Utf8.parse(key));var hasherBlockSize=hasher.blockSize,hasherBlockSizeBytes=4*hasherBlockSize;key.sigBytes>hasherBlockSizeBytes&&(key=hasher.finalize(key)),key.clamp();for(var oKey=this._oKey=key.clone(),iKey=this._iKey=key.clone(),oKeyWords=oKey.words,iKeyWords=iKey.words,i=0;hasherBlockSize>i;i++)oKeyWords[i]^=1549556828,iKeyWords[i]^=909522486;oKey.sigBytes=iKey.sigBytes=hasherBlockSizeBytes,this.reset()},reset:function(){var hasher=this._hasher;hasher.reset(),hasher.update(this._iKey)},update:function(messageUpdate){return this._hasher.update(messageUpdate),this},finalize:function(messageUpdate){var hasher=this._hasher,innerHash=hasher.finalize(messageUpdate);hasher.reset();var hmac=hasher.finalize(this._oKey.clone().concat(innerHash));return hmac}})}}(),CryptoJS.pad.NoPadding={pad:function(){},unpad:function(){}},CryptoJS.mode.CTR=function(){var CTR=CryptoJS.lib.BlockCipherMode.extend(),Encryptor=CTR.Encryptor=CTR.extend({processBlock:function(words,offset){var cipher=this._cipher,blockSize=cipher.blockSize,iv=this._iv,counter=this._counter;iv&&(counter=this._counter=iv.slice(0),this._iv=void 0);var keystream=counter.slice(0);cipher.encryptBlock(keystream,0),counter[blockSize-1]=counter[blockSize-1]+1|0;for(var i=0;blockSize>i;i++)words[offset+i]^=keystream[i]}});return CTR.Decryptor=Encryptor,CTR}(),CryptoJS}),/*!
58
+ * Source: build/lib/otr/build/dep/eventemitter.js, license: MIT, url: http://git.io/ee */
59
+ /*!
60
+ * EventEmitter v4.2.3 - git.io/ee
61
+ * Oliver Caldwell
62
+ * MIT license
63
+ * @preserve
64
+ */
65
+ function(){"use strict";function EventEmitter(){}function indexOfListener(listeners,listener){for(var i=listeners.length;i--;)if(listeners[i].listener===listener)return i;return-1}function alias(name){return function(){return this[name].apply(this,arguments)}}var proto=EventEmitter.prototype;proto.getListeners=function(evt){var response,key,events=this._getEvents();if("object"==typeof evt){response={};for(key in events)events.hasOwnProperty(key)&&evt.test(key)&&(response[key]=events[key])}else response=events[evt]||(events[evt]=[]);return response},proto.flattenListeners=function(listeners){var i,flatListeners=[];for(i=0;i<listeners.length;i+=1)flatListeners.push(listeners[i].listener);return flatListeners},proto.getListenersAsObject=function(evt){var response,listeners=this.getListeners(evt);return listeners instanceof Array&&(response={},response[evt]=listeners),response||listeners},proto.addListener=function(evt,listener){var key,listeners=this.getListenersAsObject(evt),listenerIsWrapped="object"==typeof listener;for(key in listeners)listeners.hasOwnProperty(key)&&-1===indexOfListener(listeners[key],listener)&&listeners[key].push(listenerIsWrapped?listener:{listener:listener,once:!1});return this},proto.on=alias("addListener"),proto.addOnceListener=function(evt,listener){return this.addListener(evt,{listener:listener,once:!0})},proto.once=alias("addOnceListener"),proto.defineEvent=function(evt){return this.getListeners(evt),this},proto.defineEvents=function(evts){for(var i=0;i<evts.length;i+=1)this.defineEvent(evts[i]);return this},proto.removeListener=function(evt,listener){var index,key,listeners=this.getListenersAsObject(evt);for(key in listeners)listeners.hasOwnProperty(key)&&(index=indexOfListener(listeners[key],listener),-1!==index&&listeners[key].splice(index,1));return this},proto.off=alias("removeListener"),proto.addListeners=function(evt,listeners){return this.manipulateListeners(!1,evt,listeners)},proto.removeListeners=function(evt,listeners){return this.manipulateListeners(!0,evt,listeners)},proto.manipulateListeners=function(remove,evt,listeners){var i,value,single=remove?this.removeListener:this.addListener,multiple=remove?this.removeListeners:this.addListeners;if("object"!=typeof evt||evt instanceof RegExp)for(i=listeners.length;i--;)single.call(this,evt,listeners[i]);else for(i in evt)evt.hasOwnProperty(i)&&(value=evt[i])&&("function"==typeof value?single.call(this,i,value):multiple.call(this,i,value));return this},proto.removeEvent=function(evt){var key,type=typeof evt,events=this._getEvents();if("string"===type)delete events[evt];else if("object"===type)for(key in events)events.hasOwnProperty(key)&&evt.test(key)&&delete events[key];else delete this._events;return this},proto.emitEvent=function(evt,args){var listener,i,key,response,listeners=this.getListenersAsObject(evt);for(key in listeners)if(listeners.hasOwnProperty(key))for(i=listeners[key].length;i--;)listener=listeners[key][i],listener.once===!0&&this.removeListener(evt,listener.listener),response=listener.listener.apply(this,args||[]),response===this._getOnceReturnValue()&&this.removeListener(evt,listener.listener);return this},proto.trigger=alias("emitEvent"),proto.emit=function(evt){var args=Array.prototype.slice.call(arguments,1);return this.emitEvent(evt,args)},proto.setOnceReturnValue=function(value){return this._onceReturnValue=value,this},proto._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},proto._getEvents=function(){return this._events||(this._events={})},"function"==typeof define&&define.amd?define(function(){return EventEmitter}):"object"==typeof module&&module.exports?module.exports=EventEmitter:this.EventEmitter=EventEmitter}.call(this),function(root,factory){"function"==typeof define&&define.amd?define(["bigint","crypto","eventemitter"],function(BigInt,CryptoJS,EventEmitter){var root={BigInt:BigInt,CryptoJS:CryptoJS,EventEmitter:EventEmitter,OTR:{},DSA:{}};return factory.call(root)}):(root.OTR={},root.DSA={},factory.call(root))}(this,function(){return function(){"use strict";var root=this,CONST={N:"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF",G:"2",MSGSTATE_PLAINTEXT:0,MSGSTATE_ENCRYPTED:1,MSGSTATE_FINISHED:2,AUTHSTATE_NONE:0,AUTHSTATE_AWAITING_DHKEY:1,AUTHSTATE_AWAITING_REVEALSIG:2,AUTHSTATE_AWAITING_SIG:3,WHITESPACE_TAG:" ",WHITESPACE_TAG_V2:" ",WHITESPACE_TAG_V3:" ",OTR_TAG:"?OTR",OTR_VERSION_1:"\x00",OTR_VERSION_2:"\x00",OTR_VERSION_3:"\x00",SMPSTATE_EXPECT0:0,SMPSTATE_EXPECT1:1,SMPSTATE_EXPECT2:2,SMPSTATE_EXPECT3:3,SMPSTATE_EXPECT4:4,STATUS_SEND_QUERY:0,STATUS_AKE_INIT:1,STATUS_AKE_SUCCESS:2,STATUS_END_OTR:3};"undefined"!=typeof module&&module.exports?module.exports=CONST:root.OTR.CONST=CONST}.call(this),function(){"use strict";function intCompare(x,y){var z=~(x^y);return z&=z>>16,z&=z>>8,z&=z>>4,z&=z>>2,z&=z>>1,1&z}var CryptoJS,BigInt,root=this,HLP={};"undefined"!=typeof module&&module.exports?(module.exports=HLP={},CryptoJS=require("../vendor/crypto.js"),BigInt=require("../vendor/bigint.js")):(root.OTR&&(root.OTR.HLP=HLP),root.DSA&&(root.DSA.HLP=HLP),CryptoJS=root.CryptoJS,BigInt=root.BigInt);var DTS={BYTE:1,SHORT:2,INT:4,CTR:8,MAC:20,SIG:40},WRAPPER_BEGIN="?OTR",WRAPPER_END=".",TWO=BigInt.str2bigInt("2",10);HLP.debug=function(msg){this.debug&&"function"!=typeof this.debug&&"undefined"!=typeof console&&console.log(msg)},HLP.extend=function(child,parent){function Ctor(){this.constructor=child}for(var key in parent)Object.hasOwnProperty.call(parent,key)&&(child[key]=parent[key]);Ctor.prototype=parent.prototype,child.prototype=new Ctor,child.__super__=parent.prototype},HLP.compare=function(str1,str2){if(str1.length!==str2.length)return!1;for(var i=0,result=0;i<str1.length;i++)result|=str1[i].charCodeAt(0)^str2[i].charCodeAt(0);return intCompare(result,0)},HLP.randomExponent=function(){return BigInt.randBigInt(1536)},HLP.smpHash=function(version,fmpi,smpi){var sha256=CryptoJS.algo.SHA256.create();sha256.update(CryptoJS.enc.Latin1.parse(HLP.packBytes(version,DTS.BYTE))),sha256.update(CryptoJS.enc.Latin1.parse(HLP.packMPI(fmpi))),smpi&&sha256.update(CryptoJS.enc.Latin1.parse(HLP.packMPI(smpi)));var hash=sha256.finalize();return HLP.bits2bigInt(hash.toString(CryptoJS.enc.Latin1))},HLP.makeMac=function(aesctr,m){var pass=CryptoJS.enc.Latin1.parse(m),mac=CryptoJS.HmacSHA256(CryptoJS.enc.Latin1.parse(aesctr),pass);return HLP.mask(mac.toString(CryptoJS.enc.Latin1),0,160)},HLP.make1Mac=function(aesctr,m){var pass=CryptoJS.enc.Latin1.parse(m),mac=CryptoJS.HmacSHA1(CryptoJS.enc.Latin1.parse(aesctr),pass);return mac.toString(CryptoJS.enc.Latin1)},HLP.encryptAes=function(msg,c,iv){var opts={mode:CryptoJS.mode.CTR,iv:CryptoJS.enc.Latin1.parse(iv),padding:CryptoJS.pad.NoPadding},aesctr=CryptoJS.AES.encrypt(msg,CryptoJS.enc.Latin1.parse(c),opts),aesctr_decoded=CryptoJS.enc.Base64.parse(aesctr.toString());return CryptoJS.enc.Latin1.stringify(aesctr_decoded)},HLP.decryptAes=function(msg,c,iv){msg=CryptoJS.enc.Latin1.parse(msg);var opts={mode:CryptoJS.mode.CTR,iv:CryptoJS.enc.Latin1.parse(iv),padding:CryptoJS.pad.NoPadding};return CryptoJS.AES.decrypt(CryptoJS.enc.Base64.stringify(msg),CryptoJS.enc.Latin1.parse(c),opts)},HLP.multPowMod=function(a,b,c,d,e){return BigInt.multMod(BigInt.powMod(a,b,e),BigInt.powMod(c,d,e),e)},HLP.ZKP=function(v,c,d,e){return BigInt.equals(c,HLP.smpHash(v,d,e))},HLP.GTOE=function(a,b){return BigInt.equals(a,b)||BigInt.greater(a,b)},HLP.between=function(x,a,b){return BigInt.greater(x,a)&&BigInt.greater(b,x)},HLP.checkGroup=function(g,N_MINUS_2){return HLP.GTOE(g,TWO)&&HLP.GTOE(N_MINUS_2,g)},HLP.h1=function(b,secbytes){var sha1=CryptoJS.algo.SHA1.create();return sha1.update(CryptoJS.enc.Latin1.parse(b)),sha1.update(CryptoJS.enc.Latin1.parse(secbytes)),sha1.finalize().toString(CryptoJS.enc.Latin1)},HLP.h2=function(b,secbytes){var sha256=CryptoJS.algo.SHA256.create();return sha256.update(CryptoJS.enc.Latin1.parse(b)),sha256.update(CryptoJS.enc.Latin1.parse(secbytes)),sha256.finalize().toString(CryptoJS.enc.Latin1)},HLP.mask=function(bytes,start,n){return bytes.substr(start/8,n/8)};var _toString=String.fromCharCode;HLP.packBytes=function(val,bytes){val=val.toString(16);for(var nex,res="";bytes>0;bytes--)nex=val.length?val.substr(-2,2):"0",val=val.substr(0,val.length-2),res=_toString(parseInt(nex,16))+res;return res},HLP.packINT=function(d){return HLP.packBytes(d,DTS.INT)},HLP.packCtr=function(d){return HLP.padCtr(HLP.packBytes(d,DTS.CTR))},HLP.padCtr=function(ctr){return ctr+"\x00\x00\x00\x00\x00\x00\x00\x00"},HLP.unpackCtr=function(d){return d=HLP.toByteArray(d.substring(0,8)),HLP.unpack(d)},HLP.unpack=function(arr){for(var val=0,i=0,len=arr.length;len>i;i++)val=256*val+arr[i];return val},HLP.packData=function(d){return HLP.packINT(d.length)+d},HLP.bits2bigInt=function(bits){return bits=HLP.toByteArray(bits),BigInt.ba2bigInt(bits)},HLP.packMPI=function(mpi){return HLP.packData(BigInt.bigInt2bits(BigInt.trim(mpi,0)))},HLP.packSHORT=function(short){return HLP.packBytes(short,DTS.SHORT)},HLP.unpackSHORT=function(short){return short=HLP.toByteArray(short),HLP.unpack(short)},HLP.packTLV=function(type,value){return HLP.packSHORT(type)+HLP.packSHORT(value.length)+value},HLP.readLen=function(msg){return msg=HLP.toByteArray(msg.substring(0,4)),HLP.unpack(msg)},HLP.readData=function(data){var n=HLP.unpack(data.splice(0,4));return[n,data]},HLP.readMPI=function(data){return data=HLP.toByteArray(data),data=HLP.readData(data),BigInt.ba2bigInt(data[1])},HLP.packMPIs=function(arr){return arr.reduce(function(prv,cur){return prv+HLP.packMPI(cur)},"")},HLP.unpackMPIs=function(num,mpis){for(var i=0,arr=[];num>i;i++)arr.push("MPI");return HLP.splitype(arr,mpis).map(function(m){return HLP.readMPI(m)})},HLP.wrapMsg=function(msg,fs,v3,our_it,their_it){msg=CryptoJS.enc.Base64.stringify(CryptoJS.enc.Latin1.parse(msg)),msg=WRAPPER_BEGIN+":"+msg+WRAPPER_END;var its;if(v3&&(its="|",its+=HLP.readLen(our_it).toString(16),its+="|",its+=HLP.readLen(their_it).toString(16)),!fs)return[null,msg];var n=Math.ceil(msg.length/fs);if(n>65535)return["Too many fragments"];if(1==n)return[null,msg];var k,bi,ei,frag,mf,mfs=[];for(k=1;n>=k;k++)bi=(k-1)*fs,ei=k*fs,frag=msg.slice(bi,ei),mf=WRAPPER_BEGIN,v3&&(mf+=its),mf+=","+k+",",mf+=n+",",mf+=frag+",",mfs.push(mf);return[null,mfs]},HLP.splitype=function splitype(arr,msg){var data=[];return arr.forEach(function(a){var str;switch(a){case"PUBKEY":str=splitype(["SHORT","MPI","MPI","MPI","MPI"],msg).join("");break;case"DATA":case"MPI":str=msg.substring(0,HLP.readLen(msg)+4);break;default:str=msg.substring(0,DTS[a])}data.push(str),msg=msg.substring(str.length)}),data};var _bin2num=function(){for(var i=0,_bin2num={};256>i;++i)_bin2num[String.fromCharCode(i)]=i;for(i=128;256>i;++i)_bin2num[String.fromCharCode(63232+i)]=i;return _bin2num}();HLP.toByteArray=function(data){for(var rv=[],ary=data.split(""),i=-1,iz=ary.length,remain=iz%8;remain--;)++i,rv[i]=_bin2num[ary[i]];for(remain=iz>>3;remain--;)rv.push(_bin2num[ary[++i]],_bin2num[ary[++i]],_bin2num[ary[++i]],_bin2num[ary[++i]],_bin2num[ary[++i]],_bin2num[ary[++i]],_bin2num[ary[++i]],_bin2num[ary[++i]]);return rv}}.call(this),function(){"use strict";function timer(){var start=(new Date).getTime();return function(s){if(DEBUG&&"undefined"!=typeof console){var t=(new Date).getTime();console.log(s+": "+(t-start)),start=t}}}function makeRandom(min,max){var c=BigInt.randBigInt(BigInt.bitSize(max));return HLP.between(c,min,max)?c:makeRandom(min,max)}function isProbPrime(k,n){var i,B=3e4,l=BigInt.bitSize(k),primes=BigInt.primes;for(0===primes.length&&(primes=BigInt.findPrimes(B)),rpprb.length!=k.length&&(rpprb=BigInt.dup(k)),i=0;i<primes.length&&primes[i]<=B;i++)if(0===BigInt.modInt(k,primes[i])&&!BigInt.equalsInt(k,primes[i]))return 0;for(i=0;n>i;i++){for(BigInt.randBigInt_(rpprb,l,0);!BigInt.greater(k,rpprb);)BigInt.randBigInt_(rpprb,l,0);if(!BigInt.millerRabin(k,rpprb))return 0}return 1}function generatePrimes(bit_length){for(var q,p,rem,counter,t=timer(),repeat=bit_lengths[bit_length].repeat,N=bit_lengths[bit_length].N,LM1=BigInt.twoToThe(bit_length-1),bl4=4*bit_length,brk=!1;;)if(q=BigInt.randBigInt(N,1),q[0]|=1,isProbPrime(q,repeat)){for(t("q"),counter=0;bl4>counter;counter++)if(p=BigInt.randBigInt(bit_length,1),p[0]|=1,rem=BigInt.mod(p,q),rem=BigInt.sub(rem,ONE),p=BigInt.sub(p,rem),!BigInt.greater(LM1,p)&&isProbPrime(p,repeat)){t("p"),primes[bit_length]={p:p,q:q},brk=!0;break}if(brk)break}for(var g,h=BigInt.dup(TWO),pm1=BigInt.sub(p,ONE),e=BigInt.multMod(pm1,BigInt.inverseMod(q,p),p);;){g=BigInt.powMod(h,e,p);{if(!BigInt.equals(g,ONE))return primes[bit_length].g=g,void t("g");h=BigInt.add(h,ONE)}}throw new Error("Unreachable!")}function DSA(obj,opts){if(!(this instanceof DSA))return new DSA(obj,opts);if(opts=opts||{},obj){var self=this;return["p","q","g","y","x"].forEach(function(prop){self[prop]=obj[prop]}),void(this.type=obj.type||KEY_TYPE)}var bit_length=parseInt(opts.bit_length?opts.bit_length:1024,10);if(!bit_lengths[bit_length])throw new Error("Unsupported bit length.");primes[bit_length]||generatePrimes(bit_length),this.p=primes[bit_length].p,this.q=primes[bit_length].q,this.g=primes[bit_length].g,this.type=KEY_TYPE,this.x=makeRandom(ZERO,this.q),this.y=BigInt.powMod(this.g,this.x,this.p),opts.nocache&&(primes[bit_length]=null)}function tokenizeStr(str){var start,end;if(start=str.indexOf("("),end=str.lastIndexOf(")"),0>start||0>end)throw new Error("Malformed S-Expression");str=str.substring(start+1,end);var splt=str.search(/\s/),obj={type:str.substring(0,splt),val:[]};if(str=str.substring(splt+1,end),start=str.indexOf("("),0>start)obj.val.push(str);else for(var i,len,ss,es;start>-1;){for(i=start+1,len=str.length,ss=1,es=0;len>i&&ss>es;i++)"("===str[i]&&ss++,")"===str[i]&&es++;obj.val.push(tokenizeStr(str.substring(start,++i))),str=str.substring(++i),start=str.indexOf("(")}return obj}function parseLibotr(obj){if(!obj.type)throw new Error("Parse error.");var o,val;return"privkeys"===obj.type?(o=[],obj.val.forEach(function(i){o.push(parseLibotr(i))}),o):(o={},obj.val.forEach(function(i){val=i.val[0],"string"==typeof val?0===val.indexOf("#")&&(val=val.substring(1,val.lastIndexOf("#")),val=BigInt.str2bigInt(val,16)):val=parseLibotr(i),o[i.type]=val}),o)}var CryptoJS,BigInt,Worker,WWPath,HLP,root=this;"undefined"!=typeof module&&module.exports?(module.exports=DSA,CryptoJS=require("../vendor/crypto.js"),BigInt=require("../vendor/bigint.js"),WWPath=require("path").join(__dirname,"/dsa-webworker.js"),HLP=require("./helpers.js")):(Object.keys(root.DSA).forEach(function(k){DSA[k]=root.DSA[k]}),root.DSA=DSA,CryptoJS=root.CryptoJS,BigInt=root.BigInt,Worker=root.Worker,WWPath="dsa-webworker.js",HLP=DSA.HLP);var ZERO=BigInt.str2bigInt("0",10),ONE=BigInt.str2bigInt("1",10),TWO=BigInt.str2bigInt("2",10),KEY_TYPE="\x00\x00",DEBUG=!1,rpprb=[],bit_lengths={1024:{N:160,repeat:40},2048:{N:224,repeat:56}},primes={};DSA.prototype={constructor:DSA,packPublic:function(){var str=this.type;return str+=HLP.packMPI(this.p),str+=HLP.packMPI(this.q),str+=HLP.packMPI(this.g),str+=HLP.packMPI(this.y)},packPrivate:function(){var str=this.packPublic()+HLP.packMPI(this.x);return str=CryptoJS.enc.Latin1.parse(str),str.toString(CryptoJS.enc.Base64)},generateNonce:function(m){var priv=BigInt.bigInt2bits(BigInt.trim(this.x,0)),rand=BigInt.bigInt2bits(BigInt.randBigInt(256)),sha256=CryptoJS.algo.SHA256.create();sha256.update(CryptoJS.enc.Latin1.parse(priv)),sha256.update(m),sha256.update(CryptoJS.enc.Latin1.parse(rand));var hash=sha256.finalize();return hash=HLP.bits2bigInt(hash.toString(CryptoJS.enc.Latin1)),BigInt.rightShift_(hash,256-BigInt.bitSize(this.q)),HLP.between(hash,ZERO,this.q)?hash:this.generateNonce(m)},sign:function(m){m=CryptoJS.enc.Latin1.parse(m);for(var k,b=BigInt.str2bigInt(m.toString(CryptoJS.enc.Hex),16),r=ZERO,s=ZERO;BigInt.isZero(s)||BigInt.isZero(r);)k=this.generateNonce(m),r=BigInt.mod(BigInt.powMod(this.g,k,this.p),this.q),BigInt.isZero(r)||(s=BigInt.inverseMod(k,this.q),s=BigInt.mult(s,BigInt.add(b,BigInt.mult(this.x,r))),s=BigInt.mod(s,this.q));return[r,s]},fingerprint:function(){var pk=this.packPublic();return this.type===KEY_TYPE&&(pk=pk.substring(2)),pk=CryptoJS.enc.Latin1.parse(pk),CryptoJS.SHA1(pk).toString(CryptoJS.enc.Hex)}},DSA.parsePublic=function(str,priv){var fields=["SHORT","MPI","MPI","MPI","MPI"];priv&&fields.push("MPI"),str=HLP.splitype(fields,str);var obj={type:str[0],p:HLP.readMPI(str[1]),q:HLP.readMPI(str[2]),g:HLP.readMPI(str[3]),y:HLP.readMPI(str[4])};return priv&&(obj.x=HLP.readMPI(str[5])),new DSA(obj)},DSA.parsePrivate=function(str,libotr){return libotr?parseLibotr(tokenizeStr(str))[0]["private-key"].dsa:(str=CryptoJS.enc.Base64.parse(str),str=str.toString(CryptoJS.enc.Latin1),DSA.parsePublic(str,!0))},DSA.verify=function(key,m,r,s){if(!HLP.between(r,ZERO,key.q)||!HLP.between(s,ZERO,key.q))return!1;var hm=CryptoJS.enc.Latin1.parse(m);hm=BigInt.str2bigInt(hm.toString(CryptoJS.enc.Hex),16);var w=BigInt.inverseMod(s,key.q),u1=BigInt.multMod(hm,w,key.q),u2=BigInt.multMod(r,w,key.q);u1=BigInt.powMod(key.g,u1,key.p),u2=BigInt.powMod(key.y,u2,key.p);var v=BigInt.mod(BigInt.multMod(u1,u2,key.p),key.q);return BigInt.equals(v,r)},DSA.createInWebWorker=function(options,cb){var opts={path:WWPath,seed:BigInt.getSeed};options&&"object"==typeof options&&Object.keys(options).forEach(function(k){opts[k]=options[k]}),"undefined"!=typeof module&&module.exports&&(Worker=require("webworker-threads").Worker);var worker=new Worker(opts.path);worker.onmessage=function(e){var data=e.data;switch(data.type){case"debug":if(!DEBUG||"undefined"==typeof console)return;console.log(data.val);break;case"data":worker.terminate(),cb(DSA.parsePrivate(data.val));break;default:throw new Error("Unrecognized type.")}},worker.postMessage({seed:opts.seed(),imports:opts.imports,debug:DEBUG})}}.call(this),function(){"use strict";var CryptoJS,CONST,HLP,root=this,Parse={};"undefined"!=typeof module&&module.exports?(module.exports=Parse,CryptoJS=require("../vendor/crypto.js"),CONST=require("./const.js"),HLP=require("./helpers.js")):(root.OTR.Parse=Parse,CryptoJS=root.CryptoJS,CONST=root.OTR.CONST,HLP=root.OTR.HLP);var tags={};tags[CONST.WHITESPACE_TAG_V2]=CONST.OTR_VERSION_2,tags[CONST.WHITESPACE_TAG_V3]=CONST.OTR_VERSION_3,Parse.parseMsg=function(otr,msg){var ver=[],start=msg.indexOf(CONST.OTR_TAG);if(!~start){if(this.initFragment(otr),ind=msg.indexOf(CONST.WHITESPACE_TAG),~ind){msg=msg.split(""),msg.splice(ind,16);for(var tag,len=msg.length;len>ind;)tag=msg.slice(ind,ind+8).join(""),Object.hasOwnProperty.call(tags,tag)?(msg.splice(ind,8),ver.push(tags[tag])):ind+=8;msg=msg.join("")}return{msg:msg,ver:ver}}var ind=start+CONST.OTR_TAG.length,com=msg[ind];if(","===com||"|"===com)return this.msgFragment(otr,msg.substring(ind+1),"|"===com);if(this.initFragment(otr),~["?","v"].indexOf(com)){"?"===msg[ind]&&(ver.push(CONST.OTR_VERSION_1),ind+=1);var vers={2:CONST.OTR_VERSION_2,3:CONST.OTR_VERSION_3},qs=msg.substring(ind+1),qi=qs.indexOf("?");return qi>=1&&(qs=qs.substring(0,qi).split(""),"v"===msg[ind]&&qs.forEach(function(q){Object.hasOwnProperty.call(vers,q)&&ver.push(vers[q])})),{cls:"query",ver:ver}}if(":"===com){ind+=1;var info=msg.substring(ind,ind+4);if(info.length<4)return{msg:msg};info=CryptoJS.enc.Base64.parse(info).toString(CryptoJS.enc.Latin1);var version=info.substring(0,2),type=info.substring(2);if(!otr["ALLOW_V"+HLP.unpackSHORT(version)])return{msg:msg};ind+=4;var end=msg.substring(ind).indexOf(".");if(!~end)return{msg:msg};msg=CryptoJS.enc.Base64.parse(msg.substring(ind,ind+end)),msg=CryptoJS.enc.Latin1.stringify(msg);var instance_tags;version===CONST.OTR_VERSION_3&&(instance_tags=msg.substring(0,8),msg=msg.substring(8));var cls;return~["","\n","",""].indexOf(type)?cls="ake":""===type&&(cls="data"),{version:version,type:type,msg:msg,cls:cls,instance_tags:instance_tags}}return" Error:"===msg.substring(ind,ind+7)?(otr.ERROR_START_AKE&&otr.sendQueryMsg(),{msg:msg.substring(ind+7),cls:"error"}):{msg:msg}},Parse.initFragment=function(otr){otr.fragment={s:"",j:0,k:0}},Parse.msgFragment=function(otr,msg,v3){if(msg=msg.split(","),v3){var its=msg.shift().split("|"),their_it=HLP.packINT(parseInt(its[0],16)),our_it=HLP.packINT(parseInt(its[1],16));if(otr.checkInstanceTags(their_it+our_it))return}if(!(msg.length<4||isNaN(parseInt(msg[0],10))||isNaN(parseInt(msg[1],10)))){var k=parseInt(msg[0],10),n=parseInt(msg[1],10);return msg=msg[2],k>n||0===n||0===k?void this.initFragment(otr):(1===k?(this.initFragment(otr),otr.fragment={k:1,n:n,s:msg}):n===otr.fragment.n&&k===otr.fragment.k+1?(otr.fragment.s+=msg,otr.fragment.k+=1):this.initFragment(otr),n===k?(msg=otr.fragment.s,this.initFragment(otr),this.parseMsg(otr,msg)):void 0)}}}.call(this),function(){"use strict";function hMac(gx,gy,pk,kid,m){var pass=CryptoJS.enc.Latin1.parse(m),hmac=CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256,pass);return hmac.update(CryptoJS.enc.Latin1.parse(HLP.packMPI(gx))),hmac.update(CryptoJS.enc.Latin1.parse(HLP.packMPI(gy))),hmac.update(CryptoJS.enc.Latin1.parse(pk)),hmac.update(CryptoJS.enc.Latin1.parse(kid)),hmac.finalize().toString(CryptoJS.enc.Latin1)}function AKE(otr){if(!(this instanceof AKE))return new AKE(otr);this.otr=otr,this.our_dh=otr.our_old_dh,this.our_keyid=otr.our_keyid-1,this.their_y=null,this.their_keyid=null,this.their_priv_pk=null,this.ssid=null,this.transmittedRS=!1,this.r=null;var self=this;["sendMsg"].forEach(function(meth){self[meth]=self[meth].bind(self)})}var CryptoJS,BigInt,CONST,HLP,DSA,root=this;"undefined"!=typeof module&&module.exports?(module.exports=AKE,CryptoJS=require("../vendor/crypto.js"),BigInt=require("../vendor/bigint.js"),CONST=require("./const.js"),HLP=require("./helpers.js"),DSA=require("./dsa.js")):(root.OTR.AKE=AKE,CryptoJS=root.CryptoJS,BigInt=root.BigInt,CONST=root.OTR.CONST,HLP=root.OTR.HLP,DSA=root.DSA);var N=BigInt.str2bigInt(CONST.N,16),N_MINUS_2=BigInt.sub(N,BigInt.str2bigInt("2",10));AKE.prototype={constructor:AKE,createKeys:function(g){var s=BigInt.powMod(g,this.our_dh.privateKey,N),secbytes=HLP.packMPI(s);this.ssid=HLP.mask(HLP.h2("\x00",secbytes),0,64);var tmp=HLP.h2("",secbytes);this.c=HLP.mask(tmp,0,128),this.c_prime=HLP.mask(tmp,128,128),this.m1=HLP.h2("",secbytes),this.m2=HLP.h2("",secbytes),this.m1_prime=HLP.h2("",secbytes),this.m2_prime=HLP.h2("",secbytes)},verifySignMac:function(mac,aesctr,m2,c,their_y,our_dh_pk,m1,ctr){var vmac=HLP.makeMac(aesctr,m2);if(!HLP.compare(mac,vmac))return["MACs do not match."];var x=HLP.decryptAes(aesctr.substring(4),c,ctr);x=HLP.splitype(["PUBKEY","INT","SIG"],x.toString(CryptoJS.enc.Latin1));var m=hMac(their_y,our_dh_pk,x[0],x[1],m1),pub=DSA.parsePublic(x[0]),r=HLP.bits2bigInt(x[2].substring(0,20)),s=HLP.bits2bigInt(x[2].substring(20));return DSA.verify(pub,m,r,s)?[null,HLP.readLen(x[1]),pub]:["Cannot verify signature of m."]},makeM:function(their_y,m1,c,m2){var pk=this.otr.priv.packPublic(),kid=HLP.packINT(this.our_keyid),m=hMac(this.our_dh.publicKey,their_y,pk,kid,m1);m=this.otr.priv.sign(m);var msg=pk+kid;msg+=BigInt.bigInt2bits(m[0],20),msg+=BigInt.bigInt2bits(m[1],20),msg=CryptoJS.enc.Latin1.parse(msg);var aesctr=HLP.packData(HLP.encryptAes(msg,c,HLP.packCtr(0))),mac=HLP.makeMac(aesctr,m2);return aesctr+mac},akeSuccess:function(version){return HLP.debug.call(this.otr,"success"),BigInt.equals(this.their_y,this.our_dh.publicKey)?this.otr.error("equal keys - we have a problem."):(this.otr.our_old_dh=this.our_dh,this.otr.their_priv_pk=this.their_priv_pk,this.their_keyid===this.otr.their_keyid&&BigInt.equals(this.their_y,this.otr.their_y)||this.their_keyid===this.otr.their_keyid-1&&BigInt.equals(this.their_y,this.otr.their_old_y)||(this.otr.their_y=this.their_y,this.otr.their_old_y=null,this.otr.their_keyid=this.their_keyid,this.otr.sessKeys[0]=[new this.otr.DHSession(this.otr.our_dh,this.otr.their_y),null],this.otr.sessKeys[1]=[new this.otr.DHSession(this.otr.our_old_dh,this.otr.their_y),null]),this.otr.ssid=this.ssid,this.otr.transmittedRS=this.transmittedRS,this.otr_version=version,this.otr.authstate=CONST.AUTHSTATE_NONE,this.otr.msgstate=CONST.MSGSTATE_ENCRYPTED,this.r=null,this.myhashed=null,this.dhcommit=null,this.encrypted=null,this.hashed=null,this.otr.trigger("status",[CONST.STATUS_AKE_SUCCESS]),void this.otr.sendStored())},handleAKE:function(msg){var send,vsm,type,version=msg.version;switch(msg.type){case"":if(HLP.debug.call(this.otr,"d-h key message"),msg=HLP.splitype(["DATA","DATA"],msg.msg),this.otr.authstate===CONST.AUTHSTATE_AWAITING_DHKEY){var ourHash=HLP.readMPI(this.myhashed),theirHash=HLP.readMPI(msg[1]);if(BigInt.greater(ourHash,theirHash)){type="",send=this.dhcommit;break}this.our_dh=this.otr.dh(),this.otr.authstate=CONST.AUTHSTATE_NONE,this.r=null,this.myhashed=null}else this.otr.authstate===CONST.AUTHSTATE_AWAITING_SIG&&(this.our_dh=this.otr.dh());this.otr.authstate=CONST.AUTHSTATE_AWAITING_REVEALSIG,this.encrypted=msg[0].substring(4),this.hashed=msg[1].substring(4),type="\n",send=HLP.packMPI(this.our_dh.publicKey);break;case"\n":if(HLP.debug.call(this.otr,"reveal signature message"),msg=HLP.splitype(["MPI"],msg.msg),this.otr.authstate!==CONST.AUTHSTATE_AWAITING_DHKEY){if(this.otr.authstate!==CONST.AUTHSTATE_AWAITING_SIG)return;if(!BigInt.equals(this.their_y,HLP.readMPI(msg[0])))return}if(this.otr.authstate=CONST.AUTHSTATE_AWAITING_SIG,this.their_y=HLP.readMPI(msg[0]),!HLP.checkGroup(this.their_y,N_MINUS_2))return this.otr.error("Illegal g^y.");this.createKeys(this.their_y),type="",send=HLP.packMPI(this.r),send+=this.makeM(this.their_y,this.m1,this.c,this.m2),this.m1=null,this.m2=null,this.c=null;break;case"":if(HLP.debug.call(this.otr,"signature message"),this.otr.authstate!==CONST.AUTHSTATE_AWAITING_REVEALSIG)return;msg=HLP.splitype(["DATA","DATA","MAC"],msg.msg),this.r=HLP.readMPI(msg[0]);var key=CryptoJS.enc.Hex.parse(BigInt.bigInt2str(this.r,16));key=CryptoJS.enc.Latin1.stringify(key);var gxmpi=HLP.decryptAes(this.encrypted,key,HLP.packCtr(0));gxmpi=gxmpi.toString(CryptoJS.enc.Latin1),this.their_y=HLP.readMPI(gxmpi);var hash=CryptoJS.SHA256(CryptoJS.enc.Latin1.parse(gxmpi));return HLP.compare(this.hashed,hash.toString(CryptoJS.enc.Latin1))?HLP.checkGroup(this.their_y,N_MINUS_2)?(this.createKeys(this.their_y),vsm=this.verifySignMac(msg[2],msg[1],this.m2,this.c,this.their_y,this.our_dh.publicKey,this.m1,HLP.packCtr(0)),vsm[0]?this.otr.error(vsm[0]):(this.their_keyid=vsm[1],this.their_priv_pk=vsm[2],send=this.makeM(this.their_y,this.m1_prime,this.c_prime,this.m2_prime),this.m1=null,this.m2=null,this.m1_prime=null,this.m2_prime=null,this.c=null,this.c_prime=null,this.sendMsg(version,"",send),void this.akeSuccess(version))):this.otr.error("Illegal g^x."):this.otr.error("Hashed g^x does not match.");case"":if(HLP.debug.call(this.otr,"data message"),this.otr.authstate!==CONST.AUTHSTATE_AWAITING_SIG)return;return msg=HLP.splitype(["DATA","MAC"],msg.msg),vsm=this.verifySignMac(msg[1],msg[0],this.m2_prime,this.c_prime,this.their_y,this.our_dh.publicKey,this.m1_prime,HLP.packCtr(0)),vsm[0]?this.otr.error(vsm[0]):(this.their_keyid=vsm[1],this.their_priv_pk=vsm[2],this.m1_prime=null,this.m2_prime=null,this.c_prime=null,this.transmittedRS=!0,void this.akeSuccess(version));default:return}this.sendMsg(version,type,send)},sendMsg:function(version,type,msg){var send=version+type,v3=version===CONST.OTR_VERSION_3;return v3&&(HLP.debug.call(this.otr,"instance tags"),send+=this.otr.our_instance_tag,send+=this.otr.their_instance_tag),send+=msg,send=HLP.wrapMsg(send,this.otr.fragment_size,v3,this.otr.our_instance_tag,this.otr.their_instance_tag),send[0]?this.otr.error(send[0]):void this.otr.io(send[1])},initiateAKE:function(version){HLP.debug.call(this.otr,"d-h commit message"),this.otr.trigger("status",[CONST.STATUS_AKE_INIT]),this.otr.authstate=CONST.AUTHSTATE_AWAITING_DHKEY;var gxmpi=HLP.packMPI(this.our_dh.publicKey);gxmpi=CryptoJS.enc.Latin1.parse(gxmpi),this.r=BigInt.randBigInt(128);var key=CryptoJS.enc.Hex.parse(BigInt.bigInt2str(this.r,16));key=CryptoJS.enc.Latin1.stringify(key),this.myhashed=CryptoJS.SHA256(gxmpi),this.myhashed=HLP.packData(this.myhashed.toString(CryptoJS.enc.Latin1)),this.dhcommit=HLP.packData(HLP.encryptAes(gxmpi,key,HLP.packCtr(0))),this.dhcommit+=this.myhashed,this.sendMsg(version,"",this.dhcommit)}}}.call(this),function(){"use strict";function SM(reqs){return this instanceof SM?(this.version=1,this.our_fp=reqs.our_fp,this.their_fp=reqs.their_fp,this.ssid=reqs.ssid,this.debug=!!reqs.debug,void this.init()):new SM(reqs)}var CryptoJS,BigInt,EventEmitter,CONST,HLP,root=this;"undefined"!=typeof module&&module.exports?(module.exports=SM,CryptoJS=require("../vendor/crypto.js"),BigInt=require("../vendor/bigint.js"),EventEmitter=require("../vendor/eventemitter.js"),CONST=require("./const.js"),HLP=require("./helpers.js")):(root.OTR.SM=SM,CryptoJS=root.CryptoJS,BigInt=root.BigInt,EventEmitter=root.EventEmitter,CONST=root.OTR.CONST,HLP=root.OTR.HLP);var G=BigInt.str2bigInt(CONST.G,10),N=BigInt.str2bigInt(CONST.N,16),N_MINUS_2=BigInt.sub(N,BigInt.str2bigInt("2",10)),Q=BigInt.sub(N,BigInt.str2bigInt("1",10));BigInt.divInt_(Q,2),HLP.extend(SM,EventEmitter),SM.prototype.init=function(){this.smpstate=CONST.SMPSTATE_EXPECT1,this.secret=null},SM.prototype.makeSecret=function(our,secret){var sha256=CryptoJS.algo.SHA256.create();sha256.update(CryptoJS.enc.Latin1.parse(HLP.packBytes(this.version,1))),sha256.update(CryptoJS.enc.Hex.parse(our?this.our_fp:this.their_fp)),sha256.update(CryptoJS.enc.Hex.parse(our?this.their_fp:this.our_fp)),sha256.update(CryptoJS.enc.Latin1.parse(this.ssid)),sha256.update(CryptoJS.enc.Latin1.parse(secret));var hash=sha256.finalize();this.secret=HLP.bits2bigInt(hash.toString(CryptoJS.enc.Latin1))},SM.prototype.makeG2s=function(){this.a2=HLP.randomExponent(),this.a3=HLP.randomExponent(),this.g2a=BigInt.powMod(G,this.a2,N),this.g3a=BigInt.powMod(G,this.a3,N),HLP.checkGroup(this.g2a,N_MINUS_2)&&HLP.checkGroup(this.g3a,N_MINUS_2)||this.makeG2s()},SM.prototype.computeGs=function(g2a,g3a){this.g2=BigInt.powMod(g2a,this.a2,N),this.g3=BigInt.powMod(g3a,this.a3,N)},SM.prototype.computePQ=function(r){this.p=BigInt.powMod(this.g3,r,N),this.q=HLP.multPowMod(G,r,this.g2,this.secret,N)},SM.prototype.computeR=function(){this.r=BigInt.powMod(this.QoQ,this.a3,N)},SM.prototype.computeRab=function(r){return BigInt.powMod(r,this.a3,N)},SM.prototype.computeC=function(v,r){return HLP.smpHash(v,BigInt.powMod(G,r,N))},SM.prototype.computeD=function(r,a,c){return BigInt.subMod(r,BigInt.multMod(a,c,Q),Q)},SM.prototype.handleSM=function(msg){var send,r2,r3,r7,t1,t2,t3,t4,rab,tmp2,cR,d7,ms,trust,expectStates={2:CONST.SMPSTATE_EXPECT1,3:CONST.SMPSTATE_EXPECT2,4:CONST.SMPSTATE_EXPECT3,5:CONST.SMPSTATE_EXPECT4,7:CONST.SMPSTATE_EXPECT1};if(6===msg.type)return this.init(),void this.trigger("abort");if(this.smpstate!==expectStates[msg.type])return this.abort();switch(this.smpstate){case CONST.SMPSTATE_EXPECT1:HLP.debug.call(this,"smp tlv 2");var ind,question;return 7===msg.type&&(ind=msg.msg.indexOf("\x00"),question=msg.msg.substring(0,ind),msg.msg=msg.msg.substring(ind+1)),ms=HLP.readLen(msg.msg.substr(0,4)),6!==ms?this.abort():(msg=HLP.unpackMPIs(6,msg.msg.substring(4)),HLP.checkGroup(msg[0],N_MINUS_2)&&HLP.checkGroup(msg[3],N_MINUS_2)&&HLP.ZKP(1,msg[1],HLP.multPowMod(G,msg[2],msg[0],msg[1],N))&&HLP.ZKP(2,msg[4],HLP.multPowMod(G,msg[5],msg[3],msg[4],N))?(this.g3ao=msg[3],this.makeG2s(),r2=HLP.randomExponent(),r3=HLP.randomExponent(),this.c2=this.computeC(3,r2),this.c3=this.computeC(4,r3),this.d2=this.computeD(r2,this.a2,this.c2),this.d3=this.computeD(r3,this.a3,this.c3),this.computeGs(msg[0],msg[3]),this.smpstate=CONST.SMPSTATE_EXPECT0,question=CryptoJS.enc.Latin1.parse(question).toString(CryptoJS.enc.Utf8),void this.trigger("question",[question])):this.abort());
66
+ case CONST.SMPSTATE_EXPECT2:if(HLP.debug.call(this,"smp tlv 3"),ms=HLP.readLen(msg.msg.substr(0,4)),11!==ms)return this.abort();if(msg=HLP.unpackMPIs(11,msg.msg.substring(4)),!(HLP.checkGroup(msg[0],N_MINUS_2)&&HLP.checkGroup(msg[3],N_MINUS_2)&&HLP.checkGroup(msg[6],N_MINUS_2)&&HLP.checkGroup(msg[7],N_MINUS_2)))return this.abort();if(!HLP.ZKP(3,msg[1],HLP.multPowMod(G,msg[2],msg[0],msg[1],N)))return this.abort();if(!HLP.ZKP(4,msg[4],HLP.multPowMod(G,msg[5],msg[3],msg[4],N)))return this.abort();if(this.g3ao=msg[3],this.computeGs(msg[0],msg[3]),t1=HLP.multPowMod(this.g3,msg[9],msg[6],msg[8],N),t2=HLP.multPowMod(G,msg[9],this.g2,msg[10],N),t2=BigInt.multMod(t2,BigInt.powMod(msg[7],msg[8],N),N),!HLP.ZKP(5,msg[8],t1,t2))return this.abort();var r4=HLP.randomExponent();this.computePQ(r4);var r5=HLP.randomExponent(),r6=HLP.randomExponent(),tmp=HLP.multPowMod(G,r5,this.g2,r6,N),cP=HLP.smpHash(6,BigInt.powMod(this.g3,r5,N),tmp),d5=this.computeD(r5,r4,cP),d6=this.computeD(r6,this.secret,cP);this.QoQ=BigInt.divMod(this.q,msg[7],N),this.PoP=BigInt.divMod(this.p,msg[6],N),this.computeR(),r7=HLP.randomExponent(),tmp2=BigInt.powMod(this.QoQ,r7,N),cR=HLP.smpHash(7,BigInt.powMod(G,r7,N),tmp2),d7=this.computeD(r7,this.a3,cR),this.smpstate=CONST.SMPSTATE_EXPECT4,send=HLP.packINT(8)+HLP.packMPIs([this.p,this.q,cP,d5,d6,this.r,cR,d7]),send=HLP.packTLV(4,send);break;case CONST.SMPSTATE_EXPECT3:if(HLP.debug.call(this,"smp tlv 4"),ms=HLP.readLen(msg.msg.substr(0,4)),8!==ms)return this.abort();if(msg=HLP.unpackMPIs(8,msg.msg.substring(4)),!HLP.checkGroup(msg[0],N_MINUS_2)||!HLP.checkGroup(msg[1],N_MINUS_2)||!HLP.checkGroup(msg[5],N_MINUS_2))return this.abort();if(t1=HLP.multPowMod(this.g3,msg[3],msg[0],msg[2],N),t2=HLP.multPowMod(G,msg[3],this.g2,msg[4],N),t2=BigInt.multMod(t2,BigInt.powMod(msg[1],msg[2],N),N),!HLP.ZKP(6,msg[2],t1,t2))return this.abort();if(t3=HLP.multPowMod(G,msg[7],this.g3ao,msg[6],N),this.QoQ=BigInt.divMod(msg[1],this.q,N),t4=HLP.multPowMod(this.QoQ,msg[7],msg[5],msg[6],N),!HLP.ZKP(7,msg[6],t3,t4))return this.abort();this.computeR(),r7=HLP.randomExponent(),tmp2=BigInt.powMod(this.QoQ,r7,N),cR=HLP.smpHash(8,BigInt.powMod(G,r7,N),tmp2),d7=this.computeD(r7,this.a3,cR),send=HLP.packINT(3)+HLP.packMPIs([this.r,cR,d7]),send=HLP.packTLV(5,send),rab=this.computeRab(msg[5]),trust=!!BigInt.equals(rab,BigInt.divMod(msg[0],this.p,N)),this.trigger("trust",[trust,"answered"]),this.init();break;case CONST.SMPSTATE_EXPECT4:return HLP.debug.call(this,"smp tlv 5"),ms=HLP.readLen(msg.msg.substr(0,4)),3!==ms?this.abort():(msg=HLP.unpackMPIs(3,msg.msg.substring(4)),HLP.checkGroup(msg[0],N_MINUS_2)?(t3=HLP.multPowMod(G,msg[2],this.g3ao,msg[1],N),t4=HLP.multPowMod(this.QoQ,msg[2],msg[0],msg[1],N),HLP.ZKP(8,msg[1],t3,t4)?(rab=this.computeRab(msg[0]),trust=!!BigInt.equals(rab,this.PoP),this.trigger("trust",[trust,"asked"]),void this.init()):this.abort()):this.abort())}this.sendMsg(send)},SM.prototype.sendMsg=function(send){this.trigger("send",[this.ssid,"\x00"+send])},SM.prototype.rcvSecret=function(secret,question){HLP.debug.call(this,"receive secret");var fn,our=!1;this.smpstate===CONST.SMPSTATE_EXPECT0?fn=this.answer:(fn=this.initiate,our=!0),this.makeSecret(our,secret),fn.call(this,question)},SM.prototype.answer=function(){HLP.debug.call(this,"smp answer");var r4=HLP.randomExponent();this.computePQ(r4);var r5=HLP.randomExponent(),r6=HLP.randomExponent(),tmp=HLP.multPowMod(G,r5,this.g2,r6,N),cP=HLP.smpHash(5,BigInt.powMod(this.g3,r5,N),tmp),d5=this.computeD(r5,r4,cP),d6=this.computeD(r6,this.secret,cP);this.smpstate=CONST.SMPSTATE_EXPECT3;var send=HLP.packINT(11)+HLP.packMPIs([this.g2a,this.c2,this.d2,this.g3a,this.c3,this.d3,this.p,this.q,cP,d5,d6]);this.sendMsg(HLP.packTLV(3,send))},SM.prototype.initiate=function(question){HLP.debug.call(this,"smp initiate"),this.smpstate!==CONST.SMPSTATE_EXPECT1&&this.abort(),this.makeG2s();var r2=HLP.randomExponent(),r3=HLP.randomExponent();this.c2=this.computeC(1,r2),this.c3=this.computeC(2,r3),this.d2=this.computeD(r2,this.a2,this.c2),this.d3=this.computeD(r3,this.a3,this.c3),this.smpstate=CONST.SMPSTATE_EXPECT2;var send="",type=2;question&&(send+=question,send+="\x00",type=7),send+=HLP.packINT(6)+HLP.packMPIs([this.g2a,this.c2,this.d2,this.g3a,this.c3,this.d3]),this.sendMsg(HLP.packTLV(type,send))},SM.prototype.abort=function(){this.init(),this.sendMsg(HLP.packTLV(6,"")),this.trigger("abort")}}.call(this),function(){"use strict";function OTRCB(cb){this.cb=cb}function OTR(options){if(!(this instanceof OTR))return new OTR(options);if(options=options||{},options.priv&&!(options.priv instanceof DSA))throw new Error("Requires long-lived DSA key.");if(this.priv=options.priv?options.priv:new DSA,this.fragment_size=options.fragment_size||0,this.fragment_size<0)throw new Error("Fragment size must be a positive integer.");if(this.send_interval=options.send_interval||0,this.send_interval<0)throw new Error("Send interval must be a positive integer.");this.outgoing=[],this.our_instance_tag=options.instance_tag||OTR.makeInstanceTag(),this.debug=!!options.debug,this.smw=options.smw,this.init();var self=this;["sendMsg","receiveMsg"].forEach(function(meth){self[meth]=self[meth].bind(self)}),EventEmitter.call(this)}var CryptoJS,BigInt,EventEmitter,Worker,SMWPath,CONST,HLP,Parse,AKE,SM,DSA,root=this;"undefined"!=typeof module&&module.exports?(module.exports=OTR,CryptoJS=require("../vendor/crypto.js"),BigInt=require("../vendor/bigint.js"),EventEmitter=require("../vendor/eventemitter.js"),SMWPath=require("path").join(__dirname,"/sm-webworker.js"),CONST=require("./const.js"),HLP=require("./helpers.js"),Parse=require("./parse.js"),AKE=require("./ake.js"),SM=require("./sm.js"),DSA=require("./dsa.js"),OTR.CONST=CONST):(Object.keys(root.OTR).forEach(function(k){OTR[k]=root.OTR[k]}),root.OTR=OTR,CryptoJS=root.CryptoJS,BigInt=root.BigInt,EventEmitter=root.EventEmitter,Worker=root.Worker,SMWPath="sm-webworker.js",CONST=OTR.CONST,HLP=OTR.HLP,Parse=OTR.Parse,AKE=OTR.AKE,SM=OTR.SM,DSA=root.DSA);var G=BigInt.str2bigInt(CONST.G,10),N=BigInt.str2bigInt(CONST.N,16),MAX_INT=Math.pow(2,53)-1,MAX_UINT=Math.pow(2,31)-1;HLP.extend(OTR,EventEmitter),OTR.prototype.init=function(){this.msgstate=CONST.MSGSTATE_PLAINTEXT,this.authstate=CONST.AUTHSTATE_NONE,this.ALLOW_V2=!0,this.ALLOW_V3=!0,this.REQUIRE_ENCRYPTION=!1,this.SEND_WHITESPACE_TAG=!1,this.WHITESPACE_START_AKE=!1,this.ERROR_START_AKE=!1,Parse.initFragment(this),this.their_y=null,this.their_old_y=null,this.their_keyid=0,this.their_priv_pk=null,this.their_instance_tag="\x00\x00\x00\x00",this.our_dh=this.dh(),this.our_old_dh=this.dh(),this.our_keyid=2,this.sessKeys=[new Array(2),new Array(2)],this.storedMgs=[],this.oldMacKeys=[],this.sm=null,this._akeInit(),this.receivedPlaintext=!1},OTR.prototype._akeInit=function(){this.ake=new AKE(this),this.transmittedRS=!1,this.ssid=null},OTR.prototype._SMW=function(otr,reqs){this.otr=otr;var opts={path:SMWPath,seed:BigInt.getSeed};"object"==typeof otr.smw&&Object.keys(otr.smw).forEach(function(k){opts[k]=otr.smw[k]}),"undefined"!=typeof module&&module.exports&&(Worker=require("webworker-threads").Worker),this.worker=new Worker(opts.path);var self=this;this.worker.onmessage=function(e){var d=e.data;d&&self.trigger(d.method,d.args)},this.worker.postMessage({type:"seed",seed:opts.seed(),imports:opts.imports}),this.worker.postMessage({type:"init",reqs:reqs})},HLP.extend(OTR.prototype._SMW,EventEmitter),["handleSM","rcvSecret","abort"].forEach(function(m){OTR.prototype._SMW.prototype[m]=function(){this.worker.postMessage({type:"method",method:m,args:Array.prototype.slice.call(arguments,0)})}}),OTR.prototype._smInit=function(){var reqs={ssid:this.ssid,our_fp:this.priv.fingerprint(),their_fp:this.their_priv_pk.fingerprint(),debug:this.debug};this.smw?(this.sm&&this.sm.worker.terminate(),this.sm=new this._SMW(this,reqs)):this.sm=new SM(reqs);var self=this;["trust","abort","question"].forEach(function(e){self.sm.on(e,function(){self.trigger("smp",[e].concat(Array.prototype.slice.call(arguments)))})}),this.sm.on("send",function(ssid,send){self.ssid===ssid&&(send=self.prepareMsg(send),self.io(send))})},OTR.prototype.io=function(msg,meta){msg=[].concat(msg).map(function(m){return{msg:m,meta:meta}}),this.outgoing=this.outgoing.concat(msg);var self=this;!function send(first){if(!first){if(!self.outgoing.length)return;var elem=self.outgoing.shift(),cb=null;elem.meta instanceof OTRCB&&(cb=elem.meta.cb,elem.meta=null),self.trigger("io",[elem.msg,elem.meta]),cb&&cb()}setTimeout(send,first?0:self.send_interval)}(!0)},OTR.prototype.dh=function(){var keys={privateKey:BigInt.randBigInt(320)};return keys.publicKey=BigInt.powMod(G,keys.privateKey,N),keys},OTR.prototype.DHSession=function DHSession(our_dh,their_y){if(!(this instanceof DHSession))return new DHSession(our_dh,their_y);var s=BigInt.powMod(their_y,our_dh.privateKey,N),secbytes=HLP.packMPI(s);this.id=HLP.mask(HLP.h2("\x00",secbytes),0,64);var sq=BigInt.greater(our_dh.publicKey,their_y),sendbyte=sq?"":"",rcvbyte=sq?"":"";this.sendenc=HLP.mask(HLP.h1(sendbyte,secbytes),0,128),this.sendmac=CryptoJS.SHA1(CryptoJS.enc.Latin1.parse(this.sendenc)),this.sendmac=this.sendmac.toString(CryptoJS.enc.Latin1),this.rcvenc=HLP.mask(HLP.h1(rcvbyte,secbytes),0,128),this.rcvmac=CryptoJS.SHA1(CryptoJS.enc.Latin1.parse(this.rcvenc)),this.rcvmac=this.rcvmac.toString(CryptoJS.enc.Latin1),this.rcvmacused=!1,this.extra_symkey=HLP.h2("ÿ",secbytes),this.send_counter=0,this.rcv_counter=0},OTR.prototype.rotateOurKeys=function(){var self=this;this.sessKeys[1].forEach(function(sk){sk&&sk.rcvmacused&&self.oldMacKeys.push(sk.rcvmac)}),this.our_old_dh=this.our_dh,this.our_dh=this.dh(),this.our_keyid+=1,this.sessKeys[1][0]=this.sessKeys[0][0],this.sessKeys[1][1]=this.sessKeys[0][1],this.sessKeys[0]=[this.their_y?new this.DHSession(this.our_dh,this.their_y):null,this.their_old_y?new this.DHSession(this.our_dh,this.their_old_y):null]},OTR.prototype.rotateTheirKeys=function(their_y){this.their_keyid+=1;var self=this;this.sessKeys.forEach(function(sk){sk[1]&&sk[1].rcvmacused&&self.oldMacKeys.push(sk[1].rcvmac)}),this.their_old_y=this.their_y,this.sessKeys[0][1]=this.sessKeys[0][0],this.sessKeys[1][1]=this.sessKeys[1][0],this.their_y=their_y,this.sessKeys[0][0]=new this.DHSession(this.our_dh,this.their_y),this.sessKeys[1][0]=new this.DHSession(this.our_old_dh,this.their_y)},OTR.prototype.prepareMsg=function(msg,esk){if(this.msgstate!==CONST.MSGSTATE_ENCRYPTED||0===this.their_keyid)return this.notify("Not ready to encrypt.");var sessKeys=this.sessKeys[1][0];if(sessKeys.send_counter>=MAX_INT)return this.notify("Should have rekeyed by now.");sessKeys.send_counter+=1;var ctr=HLP.packCtr(sessKeys.send_counter),send=this.ake.otr_version+"",v3=this.ake.otr_version===CONST.OTR_VERSION_3;if(v3&&(send+=this.our_instance_tag,send+=this.their_instance_tag),send+="\x00",send+=HLP.packINT(this.our_keyid-1),send+=HLP.packINT(this.their_keyid),send+=HLP.packMPI(this.our_dh.publicKey),send+=ctr.substring(0,8),Math.ceil(msg.length/8)>=MAX_UINT)return this.notify("Message is too long.");var aes=HLP.encryptAes(CryptoJS.enc.Latin1.parse(msg),sessKeys.sendenc,ctr);return send+=HLP.packData(aes),send+=HLP.make1Mac(send,sessKeys.sendmac),send+=HLP.packData(this.oldMacKeys.splice(0).join("")),send=HLP.wrapMsg(send,this.fragment_size,v3,this.our_instance_tag,this.their_instance_tag),send[0]?this.notify(send[0]):(esk&&this.trigger("file",["send",sessKeys.extra_symkey,esk]),send[1])},OTR.prototype.handleDataMsg=function(msg){var vt=msg.version+msg.type;this.ake.otr_version===CONST.OTR_VERSION_3&&(vt+=msg.instance_tags);var types=["BYTE","INT","INT","MPI","CTR","DATA","MAC","DATA"];msg=HLP.splitype(types,msg.msg);var ign=""===msg[0];if(this.msgstate!==CONST.MSGSTATE_ENCRYPTED||8!==msg.length)return void(ign||this.error("Received an unreadable encrypted message."));var our_keyid=this.our_keyid-HLP.readLen(msg[2]),their_keyid=this.their_keyid-HLP.readLen(msg[1]);if(0>our_keyid||our_keyid>1)return void(ign||this.error("Not of our latest keys."));if(0>their_keyid||their_keyid>1)return void(ign||this.error("Not of your latest keys."));var their_y=their_keyid?this.their_old_y:this.their_y;if(1===their_keyid&&!their_y)return void(ign||this.error("Do not have that key."));var sessKeys=this.sessKeys[our_keyid][their_keyid],ctr=HLP.unpackCtr(msg[4]);if(ctr<=sessKeys.rcv_counter)return void(ign||this.error("Counter in message is not larger."));sessKeys.rcv_counter=ctr,vt+=msg.slice(0,6).join("");var vmac=HLP.make1Mac(vt,sessKeys.rcvmac);if(!HLP.compare(msg[6],vmac))return void(ign||this.error("MACs do not match."));sessKeys.rcvmacused=!0;var out=HLP.decryptAes(msg[5].substring(4),sessKeys.rcvenc,HLP.padCtr(msg[4]));out=out.toString(CryptoJS.enc.Latin1),our_keyid||this.rotateOurKeys(),their_keyid||this.rotateTheirKeys(HLP.readMPI(msg[3]));var ind=out.indexOf("\x00");return~ind&&(this.handleTLVs(out.substring(ind+1),sessKeys),out=out.substring(0,ind)),out=CryptoJS.enc.Latin1.parse(out),out.toString(CryptoJS.enc.Utf8)},OTR.prototype.handleTLVs=function(tlvs,sessKeys){for(var type,len,msg;tlvs.length&&(type=HLP.unpackSHORT(tlvs.substr(0,2)),len=HLP.unpackSHORT(tlvs.substr(2,2)),msg=tlvs.substr(4,len),!(msg.length<len));){switch(type){case 1:this.msgstate=CONST.MSGSTATE_FINISHED,this.trigger("status",[CONST.STATUS_END_OTR]);break;case 2:case 3:case 4:case 5:case 6:case 7:if(this.msgstate!==CONST.MSGSTATE_ENCRYPTED)return void(this.sm&&this.sm.abort());this.sm||this._smInit(),this.sm.handleSM({msg:msg,type:type});break;case 8:msg=msg.substring(4),msg=CryptoJS.enc.Latin1.parse(msg),msg=msg.toString(CryptoJS.enc.Utf8),this.trigger("file",["receive",sessKeys.extra_symkey,msg])}tlvs=tlvs.substring(4+len)}},OTR.prototype.smpSecret=function(secret,question){return this.msgstate!==CONST.MSGSTATE_ENCRYPTED?this.notify("Must be encrypted for SMP."):"string"!=typeof secret||secret.length<1?this.notify("Secret is required."):(this.sm||this._smInit(),secret=CryptoJS.enc.Utf8.parse(secret).toString(CryptoJS.enc.Latin1),question=CryptoJS.enc.Utf8.parse(question).toString(CryptoJS.enc.Latin1),void this.sm.rcvSecret(secret,question))},OTR.prototype.sendQueryMsg=function(){var versions={},msg=CONST.OTR_TAG;this.ALLOW_V2&&(versions[2]=!0),this.ALLOW_V3&&(versions[3]=!0);var vs=Object.keys(versions);vs.length&&(msg+="v",vs.forEach(function(v){"1"!==v&&(msg+=v)}),msg+="?"),this.io(msg),this.trigger("status",[CONST.STATUS_SEND_QUERY])},OTR.prototype.sendMsg=function(msg,meta){switch((this.REQUIRE_ENCRYPTION||this.msgstate!==CONST.MSGSTATE_PLAINTEXT)&&(msg=CryptoJS.enc.Utf8.parse(msg),msg=msg.toString(CryptoJS.enc.Latin1)),this.msgstate){case CONST.MSGSTATE_PLAINTEXT:if(this.REQUIRE_ENCRYPTION)return this.storedMgs.push({msg:msg,meta:meta}),void this.sendQueryMsg();this.SEND_WHITESPACE_TAG&&!this.receivedPlaintext&&(msg+=CONST.WHITESPACE_TAG,this.ALLOW_V3&&(msg+=CONST.WHITESPACE_TAG_V3),this.ALLOW_V2&&(msg+=CONST.WHITESPACE_TAG_V2));break;case CONST.MSGSTATE_FINISHED:return this.storedMgs.push({msg:msg,meta:meta}),void this.notify("Message cannot be sent at this time.","warn");case CONST.MSGSTATE_ENCRYPTED:msg=this.prepareMsg(msg);break;default:throw new Error("Unknown message state.")}msg&&this.io(msg,meta)},OTR.prototype.receiveMsg=function(msg){if(msg=Parse.parseMsg(this,msg)){switch(msg.cls){case"error":return void this.notify(msg.msg);case"ake":return msg.version===CONST.OTR_VERSION_3&&this.checkInstanceTags(msg.instance_tags)?void this.notify("Received a message intended for a different session.","warn"):void this.ake.handleAKE(msg);case"data":if(msg.version===CONST.OTR_VERSION_3&&this.checkInstanceTags(msg.instance_tags))return void this.notify("Received a message intended for a different session.","warn");msg.msg=this.handleDataMsg(msg),msg.encrypted=!0;break;case"query":this.msgstate===CONST.MSGSTATE_ENCRYPTED&&this._akeInit(),this.doAKE(msg);break;default:(this.REQUIRE_ENCRYPTION||this.msgstate!==CONST.MSGSTATE_PLAINTEXT)&&this.notify("Received an unencrypted message.","warn"),this.receivedPlaintext=!0,this.WHITESPACE_START_AKE&&msg.ver.length>0&&this.doAKE(msg)}msg.msg&&this.trigger("ui",[msg.msg,!!msg.encrypted])}},OTR.prototype.checkInstanceTags=function(it){var their_it=HLP.readLen(it.substr(0,4)),our_it=HLP.readLen(it.substr(4,4));if(our_it&&our_it!==HLP.readLen(this.our_instance_tag))return!0;if(HLP.readLen(this.their_instance_tag)){if(HLP.readLen(this.their_instance_tag)!==their_it)return!0}else{if(100>their_it)return!0;this.their_instance_tag=HLP.packINT(their_it)}},OTR.prototype.doAKE=function(msg){this.ALLOW_V3&&~msg.ver.indexOf(CONST.OTR_VERSION_3)?this.ake.initiateAKE(CONST.OTR_VERSION_3):this.ALLOW_V2&&~msg.ver.indexOf(CONST.OTR_VERSION_2)?this.ake.initiateAKE(CONST.OTR_VERSION_2):this.notify("OTR conversation requested, but no compatible protocol version found.","warn")},OTR.prototype.error=function(err){this.debug||(err="An OTR error has occurred."),this.io("?OTR Error:"+err),this.notify(err)},OTR.prototype.notify=function(err,severity){this.trigger("error",[err,severity||"error"])},OTR.prototype.sendStored=function(){var self=this;this.storedMgs.splice(0).forEach(function(elem){var msg=self.prepareMsg(elem.msg);self.io(msg,elem.meta)})},OTR.prototype.sendFile=function(filename){if(this.msgstate!==CONST.MSGSTATE_ENCRYPTED)return this.notify("Not ready to encrypt.");if(this.ake.otr_version!==CONST.OTR_VERSION_3)return this.notify("Protocol v3 required.");if(!filename)return this.notify("Please specify a filename.");var l1name=CryptoJS.enc.Utf8.parse(filename);if(l1name=l1name.toString(CryptoJS.enc.Latin1),l1name.length>=65532)return this.notify("Filename is too long.");var msg="\x00";msg+="\x00\b",msg+=HLP.packSHORT(4+l1name.length),msg+="\x00\x00\x00",msg+=l1name,msg=this.prepareMsg(msg,filename),this.io(msg)},OTR.prototype.endOtr=function(cb){this.msgstate===CONST.MSGSTATE_ENCRYPTED&&("function"==typeof cb&&(cb=new OTRCB(cb)),this.sendMsg("\x00\x00\x00\x00",cb),this.sm&&(this.smw&&this.sm.worker.terminate(),this.sm=null)),this.msgstate=CONST.MSGSTATE_PLAINTEXT,this.receivedPlaintext=!1,this.trigger("status",[CONST.STATUS_END_OTR])},OTR.makeInstanceTag=function(){var num=BigInt.randBigInt(32);return BigInt.greater(BigInt.str2bigInt("100",16),num)?OTR.makeInstanceTag():HLP.packINT(parseInt(BigInt.bigInt2str(num,10),10))}}.call(this),{OTR:this.OTR,DSA:this.DSA}}),/*!
67
+ * Source: build/lib/i18next/release/i18next-latest.min.js, license: MIT, url: http://i18next.com/ */
68
+ !function(){function a(a,b){if(!b||"function"==typeof b)return a;for(var c in b)a[c]=b[c];return a}function b(a,c){for(var d in c)d in a?b(a[d],c[d]):a[d]=c[d];return a}function c(a,b,c){var d,e=0,f=a.length,g=void 0===f||"[object Array]"!==Object.prototype.toString.apply(a)||"function"==typeof a;if(c)if(g){for(d in a)if(b.apply(a[d],c)===!1)break}else for(;f>e&&b.apply(a[e++],c)!==!1;);else if(g){for(d in a)if(b.call(a[d],d,a[d])===!1)break}else for(;f>e&&b.call(a[e],e,a[e++])!==!1;);return a}function d(a){return"string"==typeof a?a.replace(/[&<>"'\/]/g,function(a){return O[a]}):a}function e(a){var b=function(a){if(window.XMLHttpRequest)return a(null,new XMLHttpRequest);if(window.ActiveXObject)try{return a(null,new ActiveXObject("Msxml2.XMLHTTP"))}catch(b){return a(null,new ActiveXObject("Microsoft.XMLHTTP"))}return a(new Error)},c=function(a){if("string"==typeof a)return a;var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b.join("&")},d=function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(192|d>>6),b+=String.fromCharCode(128|63&d)):(b+=String.fromCharCode(224|d>>12),b+=String.fromCharCode(128|63&d>>6),b+=String.fromCharCode(128|63&d))}return b},e=function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a=d(a);var c,e,f,g,h,i,j,k="",l=0;do c=a.charCodeAt(l++),e=a.charCodeAt(l++),f=a.charCodeAt(l++),g=c>>2,h=(3&c)<<4|e>>4,i=(15&e)<<2|f>>6,j=63&f,isNaN(e)?i=j=64:isNaN(f)&&(j=64),k+=b.charAt(g)+b.charAt(h)+b.charAt(i)+b.charAt(j),c=e=f="",g=h=i=j="";while(l<a.length);return k},f=function(){for(var a=arguments[0],b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}return a},g=function(a,d,e,h){"function"==typeof e&&(h=e,e={}),e.cache=e.cache||!1,e.data=e.data||{},e.headers=e.headers||{},e.jsonp=e.jsonp||!1,e.async=void 0===e.async?!0:e.async;var i,j=f({accept:"*/*","content-type":"application/x-www-form-urlencoded;charset=UTF-8"},g.headers,e.headers);if(i="application/json"===j["content-type"]?JSON.stringify(e.data):c(e.data),"GET"===a){var k=[];if(i&&(k.push(i),i=null),e.cache||k.push("_="+(new Date).getTime()),e.jsonp&&(k.push("callback="+e.jsonp),k.push("jsonp="+e.jsonp)),k=k.join("&"),k.length>1&&(d+=d.indexOf("?")>-1?"&"+k:"?"+k),e.jsonp){var l=document.getElementsByTagName("head")[0],m=document.createElement("script");return m.type="text/javascript",m.src=d,void l.appendChild(m)}}b(function(b,c){if(b)return h(b);c.open(a,d,e.async);for(var f in j)j.hasOwnProperty(f)&&c.setRequestHeader(f,j[f]);c.onreadystatechange=function(){if(4===c.readyState){var a=c.responseText||"";if(!h)return;h(c.status,{text:function(){return a},json:function(){return JSON.parse(a)}})}},c.send(i)})},h={authBasic:function(a,b){g.headers.Authorization="Basic "+e(a+":"+b)},connect:function(a,b,c){return g("CONNECT",a,b,c)},del:function(a,b,c){return g("DELETE",a,b,c)},get:function(a,b,c){return g("GET",a,b,c)},head:function(a,b,c){return g("HEAD",a,b,c)},headers:function(a){g.headers=a||{}},isAllowed:function(a,b,c){this.options(a,function(a,d){c(-1!==d.text().indexOf(b))})},options:function(a,b,c){return g("OPTIONS",a,b,c)},patch:function(a,b,c){return g("PATCH",a,b,c)},post:function(a,b,c){return g("POST",a,b,c)},put:function(a,b,c){return g("PUT",a,b,c)},trace:function(a,b,c){return g("TRACE",a,b,c)}},i=a.type?a.type.toLowerCase():"get";h[i](a.url,a,function(b,c){200===b||0===b&&c.text()?a.success(c.json(),b,null):a.error(c.text(),b,null)})}function f(a,b){"function"==typeof a&&(b=a,a={}),a=a||{},R.extend(N,a),delete N.fixLng,"string"==typeof N.ns&&(N.ns={namespaces:[N.ns],defaultNs:N.ns}),"string"==typeof N.fallbackNS&&(N.fallbackNS=[N.fallbackNS]),("string"==typeof N.fallbackLng||"boolean"==typeof N.fallbackLng)&&(N.fallbackLng=[N.fallbackLng]),N.interpolationPrefixEscaped=R.regexEscape(N.interpolationPrefix),N.interpolationSuffixEscaped=R.regexEscape(N.interpolationSuffix),N.lng||(N.lng=R.detectLanguage()),J=R.toLanguages(N.lng),D=J[0],R.log("currentLng set to: "+D),N.useCookie&&R.cookie.read(N.cookieName)!==D&&R.cookie.create(N.cookieName,D,N.cookieExpirationTime,N.cookieDomain),N.detectLngFromLocalStorage&&"undefined"!=typeof document&&window.localstorage&&window.localStorage.setItem("i18next_lng",D);var c=x;a.fixLng&&(c=function(a,b){return b=b||{},b.lng=b.lng||c.lng,x(a,b)},c.lng=D),S.setCurrentLng(D),F&&N.setJqueryExt&&q();var d;if(F&&F.Deferred&&(d=F.Deferred()),!N.resStore){var e=R.toLanguages(N.lng);"string"==typeof N.preload&&(N.preload=[N.preload]);for(var f=0,g=N.preload.length;g>f;f++)for(var h=R.toLanguages(N.preload[f]),i=0,j=h.length;j>i;i++)e.indexOf(h[i])<0&&e.push(h[i]);return G.sync.load(e,N,function(a,e){H=e,K=!0,b&&b(c),d&&d.resolve(c)}),d?d.promise():void 0}return H=N.resStore,K=!0,b&&b(c),d&&d.resolve(c),d?d.promise():void 0}function g(a,b){"string"==typeof a&&(a=[a]);for(var c=0,d=a.length;d>c;c++)N.preload.indexOf(a[c])<0&&N.preload.push(a[c]);return f(b)}function h(a,b,c,d){"string"!=typeof b?(c=b,b=N.ns.defaultNs):N.ns.namespaces.indexOf(b)<0&&N.ns.namespaces.push(b),H[a]=H[a]||{},H[a][b]=H[a][b]||{},d?R.deepExtend(H[a][b],c):R.extend(H[a][b],c)}function i(a,b){"string"!=typeof b&&(b=N.ns.defaultNs),H[a]=H[a]||{},H[a][b]={}}function j(a,b,c,d){"string"!=typeof b?(resource=b,b=N.ns.defaultNs):N.ns.namespaces.indexOf(b)<0&&N.ns.namespaces.push(b),H[a]=H[a]||{},H[a][b]=H[a][b]||{};for(var e=c.split(N.keyseparator),f=0,g=H[N.lng][b];e[f];)f==e.length-1?g[e[f]]=d:(null==g[e[f]]&&(g[e[f]]={}),g=g[e[f]]),f++}function k(a,b,c){"string"!=typeof b?(resource=b,b=N.ns.defaultNs):N.ns.namespaces.indexOf(b)<0&&N.ns.namespaces.push(b);for(var d in c)"string"==typeof c[d]&&j(a,b,d,c[d])}function l(a){N.ns.defaultNs=a}function m(a,b){n([a],b)}function n(a,b){var c={dynamicLoad:N.dynamicLoad,resGetPath:N.resGetPath,getAsync:N.getAsync,customLoad:N.customLoad,ns:{namespaces:a,defaultNs:""}},d=R.toLanguages(N.lng);"string"==typeof N.preload&&(N.preload=[N.preload]);for(var e=0,f=N.preload.length;f>e;e++)for(var g=R.toLanguages(N.preload[e]),h=0,i=g.length;i>h;h++)d.indexOf(g[h])<0&&d.push(g[h]);for(var j=[],k=0,l=d.length;l>k;k++){var m=!1,n=H[d[k]];if(n)for(var o=0,p=a.length;p>o;o++)n[a[o]]||(m=!0);else m=!0;m&&j.push(d[k])}j.length?G.sync._fetch(j,c,function(c,d){var e=a.length*j.length;R.each(a,function(a,c){N.ns.namespaces.indexOf(c)<0&&N.ns.namespaces.push(c),R.each(j,function(a,f){H[f]=H[f]||{},H[f][c]=d[f][c],e--,0===e&&b&&(N.useLocalStorage&&G.sync._storeLocal(H),b())})})}):b&&b()}function o(a,b,c){return"function"==typeof b?(c=b,b={}):b||(b={}),b.lng=a,f(b,c)}function p(){return D}function q(){function a(a,b,c){if(0!==b.length){var d="text";if(0===b.indexOf("[")){var e=b.split("]");b=e[1],d=e[0].substr(1,e[0].length-1)}b.indexOf(";")===b.length-1&&(b=b.substr(0,b.length-2));var f;if("html"===d)f=N.defaultValueFromContent?F.extend({defaultValue:a.html()},c):c,a.html(F.t(b,f));else if("text"===d)f=N.defaultValueFromContent?F.extend({defaultValue:a.text()},c):c,a.text(F.t(b,f));else if("prepend"===d)f=N.defaultValueFromContent?F.extend({defaultValue:a.html()},c):c,a.prepend(F.t(b,f));else if("append"===d)f=N.defaultValueFromContent?F.extend({defaultValue:a.html()},c):c,a.append(F.t(b,f));else if(0===d.indexOf("data-")){var g=d.substr("data-".length);f=N.defaultValueFromContent?F.extend({defaultValue:a.data(g)},c):c;var h=F.t(b,f);a.data(g,h),a.attr(d,h)}else f=N.defaultValueFromContent?F.extend({defaultValue:a.attr(d)},c):c,a.attr(d,F.t(b,f))}}function b(b,c){var d=b.attr(N.selectorAttr);if(d||"undefined"==typeof d||d===!1||(d=b.text()||b.val()),d){var e=b,f=b.data("i18n-target");if(f&&(e=b.find(f)||b),c||N.useDataAttrOptions!==!0||(c=b.data("i18n-options")),c=c||{},d.indexOf(";")>=0){var g=d.split(";");F.each(g,function(b,d){""!==d&&a(e,d,c)})}else a(e,d,c);N.useDataAttrOptions===!0&&b.data("i18n-options",c)}}F.t=F.t||x,F.fn.i18n=function(a){return this.each(function(){b(F(this),a);var c=F(this).find("["+N.selectorAttr+"]");c.each(function(){b(F(this),a)})})}}function r(a,b,c,d){if(!a)return a;if(d=d||b,a.indexOf(d.interpolationPrefix||N.interpolationPrefix)<0)return a;var e=d.interpolationPrefix?R.regexEscape(d.interpolationPrefix):N.interpolationPrefixEscaped,f=d.interpolationSuffix?R.regexEscape(d.interpolationSuffix):N.interpolationSuffixEscaped,g="HTML"+f,h=b.replace&&"object"==typeof b.replace?b.replace:b;return R.each(h,function(b,h){var i=c?c+N.keyseparator+b:b;"object"==typeof h&&null!==h?a=r(a,h,i,d):d.escapeInterpolation||N.escapeInterpolation?(a=a.replace(new RegExp([e,i,g].join(""),"g"),R.regexReplacementEscape(h)),a=a.replace(new RegExp([e,i,f].join(""),"g"),R.regexReplacementEscape(R.escape(h)))):a=a.replace(new RegExp([e,i,f].join(""),"g"),R.regexReplacementEscape(h))}),a}function s(a,b){var c=",",d="{",e="}",f=R.extend({},b);for(delete f.postProcess;-1!=a.indexOf(N.reusePrefix)&&(I++,!(I>N.maxRecursion));){var g=a.lastIndexOf(N.reusePrefix),h=a.indexOf(N.reuseSuffix,g)+N.reuseSuffix.length,i=a.substring(g,h),j=i.replace(N.reusePrefix,"").replace(N.reuseSuffix,"");if(g>=h)return R.error("there is an missing closing in following translation value",a),"";if(-1!=j.indexOf(c)){var k=j.indexOf(c);if(-1!=j.indexOf(d,k)&&-1!=j.indexOf(e,k)){var l=j.indexOf(d,k),m=j.indexOf(e,l)+e.length;try{f=R.extend(f,JSON.parse(j.substring(l,m))),j=j.substring(0,k)}catch(n){}}}var o=A(j,f);a=a.replace(i,R.regexReplacementEscape(o))}return a}function t(a){return a.context&&("string"==typeof a.context||"number"==typeof a.context)}function u(a,b){return void 0!==a.count&&"string"!=typeof a.count&&S.needsPlural(b,a.count)}function v(a){return void 0!==a.indefinite_article&&"string"!=typeof a.indefinite_article&&a.indefinite_article}function w(a,b){b=b||{};var c=y(a,b),d=B(a,b);return void 0!==d||d===c}function x(a,b){return b=b||{},K?(I=0,A.apply(null,arguments)):(R.log("i18next not finished initialization. you might have called t function before loading resources finished."),b.defaultValue||"")}function y(a,b){return void 0!==b.defaultValue?b.defaultValue:a}function z(){for(var a=[],b=1;b<arguments.length;b++)a.push(arguments[b]);return{postProcess:"sprintf",sprintf:a}}function A(a,b){if(b&&"object"!=typeof b?"sprintf"===N.shortcutFunction?b=z.apply(null,arguments):"defaultValue"===N.shortcutFunction&&(b={defaultValue:b}):b=b||{},void 0===a||null===a||""===a)return"";"string"==typeof a&&(a=[a]);var c=a[0];if(a.length>1)for(var d=0;d<a.length&&(c=a[d],!w(c,b));d++);var e,f=y(c,b),g=B(c,b),h=b.lng?R.toLanguages(b.lng,b.fallbackLng):J,i=b.ns||N.ns.defaultNs;c.indexOf(N.nsseparator)>-1&&(e=c.split(N.nsseparator),i=e[0],c=e[1]),void 0===g&&N.sendMissing&&"function"==typeof N.missingKeyHandler&&(b.lng?N.missingKeyHandler(h[0],i,c,f,h):N.missingKeyHandler(N.lng,i,c,f,h));var j=b.postProcess||N.postProcess;void 0!==g&&j&&T[j]&&(g=T[j](g,c,b));var k=f;if(f.indexOf(N.nsseparator)>-1&&(e=f.split(N.nsseparator),k=e[1]),k===c&&N.parseMissingKey&&(f=N.parseMissingKey(f)),void 0===g&&(f=r(f,b),f=s(f,b),j&&T[j])){var l=y(c,b);g=T[j](l,c,b)}return void 0!==g?g:f}function B(a,b){b=b||{};var c,d,e=y(a,b),f=J;if(!H)return e;if("cimode"===f[0].toLowerCase())return e;if(b.lng&&(f=R.toLanguages(b.lng,b.fallbackLng),!H[f[0]])){var g=N.getAsync;N.getAsync=!1,G.sync.load(f,N,function(a,b){R.extend(H,b),N.getAsync=g})}var h=b.ns||N.ns.defaultNs;if(a.indexOf(N.nsseparator)>-1){var i=a.split(N.nsseparator);h=i[0],a=i[1]}if(t(b)){c=R.extend({},b),delete c.context,c.defaultValue=N.contextNotFound;var j=h+N.nsseparator+a+"_"+b.context;if(d=x(j,c),d!=N.contextNotFound)return r(d,{context:b.context})}if(u(b,f[0])){c=R.extend({},b),delete c.count,c.defaultValue=N.pluralNotFound;var k=h+N.nsseparator+a+N.pluralSuffix,l=S.get(f[0],b.count);if(l>=0?k=k+"_"+l:1===l&&(k=h+N.nsseparator+a),d=x(k,c),d!=N.pluralNotFound)return r(d,{count:b.count,interpolationPrefix:b.interpolationPrefix,interpolationSuffix:b.interpolationSuffix})}if(v(b)){var m=R.extend({},b);delete m.indefinite_article,m.defaultValue=N.indefiniteNotFound;var n=h+N.nsseparator+a+(b.count&&!u(b,f[0])||!b.count?N.indefiniteSuffix:"");if(d=x(n,m),d!=N.indefiniteNotFound)return d}for(var o,p=a.split(N.keyseparator),q=0,w=f.length;w>q&&void 0===o;q++){for(var z=f[q],C=0,D=H[z]&&H[z][h];p[C];)D=D&&D[p[C]],C++;if(void 0!==D){var E=Object.prototype.toString.apply(D);if("string"==typeof D)D=r(D,b),D=s(D,b);else if("[object Array]"!==E||N.returnObjectTrees||b.returnObjectTrees){if(null===D&&N.fallbackOnNull===!0)D=void 0;else if(null!==D)if(N.returnObjectTrees||b.returnObjectTrees){if("[object Number]"!==E&&"[object Function]"!==E&&"[object RegExp]"!==E){var F="[object Array]"===E?[]:{};R.each(D,function(c){F[c]=A(h+N.nsseparator+a+N.keyseparator+c,b)}),D=F}}else N.objectTreeKeyHandler&&"function"==typeof N.objectTreeKeyHandler?D=N.objectTreeKeyHandler(a,D,z,h,b):(D="key '"+h+":"+a+" ("+z+")' returned an object instead of string.",R.log(D))}else D=D.join("\n"),D=r(D,b),D=s(D,b);"string"==typeof D&&""===D.trim()&&N.fallbackOnEmpty===!0&&(D=void 0),o=D}}if(void 0===o&&!b.isFallbackLookup&&(N.fallbackToDefaultNS===!0||N.fallbackNS&&N.fallbackNS.length>0)){if(b.isFallbackLookup=!0,N.fallbackNS.length){for(var I=0,K=N.fallbackNS.length;K>I;I++)if(o=B(N.fallbackNS[I]+N.nsseparator+a,b)){var L=o.indexOf(N.nsseparator)>-1?o.split(N.nsseparator)[1]:o,M=e.indexOf(N.nsseparator)>-1?e.split(N.nsseparator)[1]:e;if(L!==M)break}}else o=B(a,b);b.isFallbackLookup=!1}return o}function C(){var a,b=[];if("undefined"!=typeof window&&(!function(){for(var a=window.location.search.substring(1),c=a.split("&"),d=0;d<c.length;d++){var e=c[d].indexOf("=");if(e>0){var f=c[d].substring(0,e),g=c[d].substring(e+1);b[f]=g}}}(),b[N.detectLngQS]&&(a=b[N.detectLngQS])),!a&&"undefined"!=typeof document&&N.useCookie){var c=R.cookie.read(N.cookieName);c&&(a=c)}return!a&&"undefined"!=typeof document&&window.localstorage&&N.detectLngFromLocalStorage&&(a=window.localStorage.getItem("i18next_lng")),a||"undefined"==typeof navigator||(a=navigator.language?navigator.language:navigator.userLanguage),a||(a=N.fallbackLng[0]),a}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:0!=d&&1/0!=d&&d!=-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(a){"use strict";if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=c;arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!=d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));for(var e=d>=0?Math.min(d,c-1):c-Math.abs(d);e>=0;e--)if(e in b&&b[e]===a)return e;return-1}),"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var D,E=this,F=E.jQuery||E.Zepto,G={},H={},I=0,J=[],K=!1,L={};if("undefined"!=typeof module&&module.exports){if(!F)try{F=require("jquery")}catch(M){}F&&(F.i18n=F.i18n||G),module.exports=G}else F&&(F.i18n=F.i18n||G),E.i18n=E.i18n||G;L={load:function(a,b,c){b.useLocalStorage?L._loadLocal(a,b,function(d,e){for(var f=[],g=0,h=a.length;h>g;g++)e[a[g]]||f.push(a[g]);f.length>0?L._fetch(f,b,function(a,b){R.extend(e,b),L._storeLocal(b),c(null,e)}):c(null,e)}):L._fetch(a,b,function(a,b){c(null,b)})},_loadLocal:function(a,b,c){var d={},e=(new Date).getTime();if(window.localStorage){var f=a.length;R.each(a,function(a,g){var h=window.localStorage.getItem("res_"+g);h&&(h=JSON.parse(h),h.i18nStamp&&h.i18nStamp+b.localStorageExpirationTime>e&&(d[g]=h)),f--,0===f&&c(null,d)})}},_storeLocal:function(a){if(window.localStorage)for(var b in a)a[b].i18nStamp=(new Date).getTime(),window.localStorage.setItem("res_"+b,JSON.stringify(a[b]))},_fetch:function(a,b,c){var d=b.ns,e={};if(b.dynamicLoad){var f=function(a,b){c(null,b)};if("function"==typeof b.customLoad)b.customLoad(a,d.namespaces,b,f);else{var g=r(b.resGetPath,{lng:a.join("+"),ns:d.namespaces.join("+")});R.ajax({url:g,success:function(a){R.log("loaded: "+g),f(null,a)},error:function(a,b,c){R.log("failed loading: "+g),f("failed loading resource.json error: "+c)},dataType:"json",async:b.getAsync})}}else{var h,i=d.namespaces.length*a.length;R.each(d.namespaces,function(d,f){R.each(a,function(a,d){var g=function(a,b){a&&(h=h||[],h.push(a)),e[d]=e[d]||{},e[d][f]=b,i--,0===i&&c(h,e)};"function"==typeof b.customLoad?b.customLoad(d,f,b,g):L._fetchOne(d,f,b,g)})})}},_fetchOne:function(a,b,c,d){var e=r(c.resGetPath,{lng:a,ns:b});R.ajax({url:e,success:function(a){R.log("loaded: "+e),d(null,a)},error:function(a,b,c){if(b&&200==b||a&&a.status&&200==a.status)R.error("There is a typo in: "+e);else if(b&&404==b||a&&a.status&&404==a.status)R.log("Does not exist: "+e);else{var f=b?b:a&&a.status?a.status:null;R.log(f+" when loading "+e)}d(c,{})},dataType:"json",async:c.getAsync})},postMissing:function(a,b,c,d,e){var f={};f[c]=d;var g=[];if("fallback"===N.sendMissingTo&&N.fallbackLng[0]!==!1)for(var h=0;h<N.fallbackLng.length;h++)g.push({lng:N.fallbackLng[h],url:r(N.resPostPath,{lng:N.fallbackLng[h],ns:b})});else if("current"===N.sendMissingTo||"fallback"===N.sendMissingTo&&N.fallbackLng[0]===!1)g.push({lng:a,url:r(N.resPostPath,{lng:a,ns:b})});else if("all"===N.sendMissingTo)for(var h=0,i=e.length;i>h;h++)g.push({lng:e[h],url:r(N.resPostPath,{lng:e[h],ns:b})});for(var j=0,k=g.length;k>j;j++){var l=g[j];R.ajax({url:l.url,type:N.sendType,data:f,success:function(){R.log("posted missing key '"+c+"' to: "+l.url);for(var a=c.split("."),e=0,f=H[l.lng][b];a[e];)f=f[a[e]]=e===a.length-1?d:f[a[e]]||{},e++},error:function(){R.log("failed posting missing key '"+c+"' to: "+l.url)},dataType:"json",async:N.postAsync})}}};var N={lng:void 0,load:"all",preload:[],lowerCaseLng:!1,returnObjectTrees:!1,fallbackLng:["dev"],fallbackNS:[],detectLngQS:"setLng",detectLngFromLocalStorage:!1,ns:"translation",fallbackOnNull:!0,fallbackOnEmpty:!1,fallbackToDefaultNS:!1,nsseparator:":",keyseparator:".",selectorAttr:"data-i18n",debug:!1,resGetPath:"locales/__lng__/__ns__.json",resPostPath:"locales/add/__lng__/__ns__",getAsync:!0,postAsync:!0,resStore:void 0,useLocalStorage:!1,localStorageExpirationTime:6048e5,dynamicLoad:!1,sendMissing:!1,sendMissingTo:"fallback",sendType:"POST",interpolationPrefix:"__",interpolationSuffix:"__",reusePrefix:"$t(",reuseSuffix:")",pluralSuffix:"_plural",pluralNotFound:["plural_not_found",Math.random()].join(""),contextNotFound:["context_not_found",Math.random()].join(""),escapeInterpolation:!1,indefiniteSuffix:"_indefinite",indefiniteNotFound:["indefinite_not_found",Math.random()].join(""),setJqueryExt:!0,defaultValueFromContent:!0,useDataAttrOptions:!1,cookieExpirationTime:void 0,useCookie:!0,cookieName:"i18next",cookieDomain:void 0,objectTreeKeyHandler:void 0,postProcess:void 0,parseMissingKey:void 0,missingKeyHandler:L.postMissing,shortcutFunction:"sprintf"},O={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},P={create:function(a,b,c,d){var e;if(c){var f=new Date;f.setTime(f.getTime()+6e4*c),e="; expires="+f.toGMTString()}else e="";d=d?"domain="+d+";":"",document.cookie=a+"="+b+e+";"+d+"path=/"},read:function(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "==e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(b))return e.substring(b.length,e.length)}return null},remove:function(a){this.create(a,"",-1)}},Q={create:function(){},read:function(){return null},remove:function(){}},R={extend:F?F.extend:a,deepExtend:b,each:F?F.each:c,ajax:F?F.ajax:"undefined"!=typeof document?e:function(){},cookie:"undefined"!=typeof document?P:Q,detectLanguage:C,escape:d,log:function(a){N.debug&&"undefined"!=typeof console&&console.log(a)},error:function(a){"undefined"!=typeof console&&console.error(a)},getCountyIndexOfLng:function(a){var b=0;return("nb-NO"===a||"nn-NO"===a)&&(b=1),b},toLanguages:function(a){var b=this.log,c=[],d=N.lngWhitelist||!1,e=function(a){!d||d.indexOf(a)>-1?c.push(a):b("rejecting non-whitelisted language: "+a)};if("string"==typeof a&&a.indexOf("-")>-1){var f=a.split("-");a=N.lowerCaseLng?f[0].toLowerCase()+"-"+f[1].toLowerCase():f[0].toLowerCase()+"-"+f[1].toUpperCase(),"unspecific"!==N.load&&e(a),"current"!==N.load&&e(f[this.getCountyIndexOfLng(a)])}else e(a);for(var g=0;g<N.fallbackLng.length;g++)-1===c.indexOf(N.fallbackLng[g])&&N.fallbackLng[g]&&c.push(N.fallbackLng[g]);return c},regexEscape:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},regexReplacementEscape:function(a){return"string"==typeof a?a.replace(/\$/g,"$$$$"):a}};R.applyReplacement=r;var S={rules:{ach:{name:"Acholi",numbers:[1,2],plurals:function(a){return Number(a>1)}},af:{name:"Afrikaans",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ak:{name:"Akan",numbers:[1,2],plurals:function(a){return Number(a>1)}},am:{name:"Amharic",numbers:[1,2],plurals:function(a){return Number(a>1)}},an:{name:"Aragonese",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ar:{name:"Arabic",numbers:[0,1,2,3,11,100],plurals:function(a){return Number(0===a?0:1==a?1:2==a?2:a%100>=3&&10>=a%100?3:a%100>=11?4:5)}},arn:{name:"Mapudungun",numbers:[1,2],plurals:function(a){return Number(a>1)}},ast:{name:"Asturian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ay:{name:"Aymará",numbers:[1],plurals:function(){return 0}},az:{name:"Azerbaijani",numbers:[1,2],plurals:function(a){return Number(1!=a)}},be:{name:"Belarusian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&11!=a%100?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)}},bg:{name:"Bulgarian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},bn:{name:"Bengali",numbers:[1,2],plurals:function(a){return Number(1!=a)}},bo:{name:"Tibetan",numbers:[1],plurals:function(){return 0}},br:{name:"Breton",numbers:[1,2],plurals:function(a){return Number(a>1)}},bs:{name:"Bosnian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&11!=a%100?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)}},ca:{name:"Catalan",numbers:[1,2],plurals:function(a){return Number(1!=a)}},cgg:{name:"Chiga",numbers:[1],plurals:function(){return 0}},cs:{name:"Czech",numbers:[1,2,5],plurals:function(a){return Number(1==a?0:a>=2&&4>=a?1:2)}},csb:{name:"Kashubian",numbers:[1,2,5],plurals:function(a){return Number(1==a?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)}},cy:{name:"Welsh",numbers:[1,2,3,8],plurals:function(a){return Number(1==a?0:2==a?1:8!=a&&11!=a?2:3)}},da:{name:"Danish",numbers:[1,2],plurals:function(a){return Number(1!=a)}},de:{name:"German",numbers:[1,2],plurals:function(a){return Number(1!=a)}},dz:{name:"Dzongkha",numbers:[1],plurals:function(){return 0}},el:{name:"Greek",numbers:[1,2],plurals:function(a){return Number(1!=a)}},en:{name:"English",numbers:[1,2],plurals:function(a){return Number(1!=a)}},eo:{name:"Esperanto",numbers:[1,2],plurals:function(a){return Number(1!=a)}},es:{name:"Spanish",numbers:[1,2],plurals:function(a){return Number(1!=a)}},es_ar:{name:"Argentinean Spanish",numbers:[1,2],plurals:function(a){return Number(1!=a)}},et:{name:"Estonian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},eu:{name:"Basque",numbers:[1,2],plurals:function(a){return Number(1!=a)}},fa:{name:"Persian",numbers:[1],plurals:function(){return 0}},fi:{name:"Finnish",numbers:[1,2],plurals:function(a){return Number(1!=a)}},fil:{name:"Filipino",numbers:[1,2],plurals:function(a){return Number(a>1)}},fo:{name:"Faroese",numbers:[1,2],plurals:function(a){return Number(1!=a)}},fr:{name:"French",numbers:[1,2],plurals:function(a){return Number(a>=2)}},fur:{name:"Friulian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},fy:{name:"Frisian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ga:{name:"Irish",numbers:[1,2,3,7,11],plurals:function(a){return Number(1==a?0:2==a?1:7>a?2:11>a?3:4)}},gd:{name:"Scottish Gaelic",numbers:[1,2,3,20],plurals:function(a){return Number(1==a||11==a?0:2==a||12==a?1:a>2&&20>a?2:3)}},gl:{name:"Galician",numbers:[1,2],plurals:function(a){return Number(1!=a)}},gu:{name:"Gujarati",numbers:[1,2],plurals:function(a){return Number(1!=a)}},gun:{name:"Gun",numbers:[1,2],plurals:function(a){return Number(a>1)}},ha:{name:"Hausa",numbers:[1,2],plurals:function(a){return Number(1!=a)}},he:{name:"Hebrew",numbers:[1,2],plurals:function(a){return Number(1!=a)}},hi:{name:"Hindi",numbers:[1,2],plurals:function(a){return Number(1!=a)}},hr:{name:"Croatian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&11!=a%100?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)}},hu:{name:"Hungarian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},hy:{name:"Armenian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ia:{name:"Interlingua",numbers:[1,2],plurals:function(a){return Number(1!=a)}},id:{name:"Indonesian",numbers:[1],plurals:function(){return 0}},is:{name:"Icelandic",numbers:[1,2],plurals:function(a){return Number(1!=a%10||11==a%100)}},it:{name:"Italian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ja:{name:"Japanese",numbers:[1],plurals:function(){return 0}},jbo:{name:"Lojban",numbers:[1],plurals:function(){return 0}},jv:{name:"Javanese",numbers:[0,1],plurals:function(a){return Number(0!==a)}},ka:{name:"Georgian",numbers:[1],plurals:function(){return 0}},kk:{name:"Kazakh",numbers:[1],plurals:function(){return 0}},km:{name:"Khmer",numbers:[1],plurals:function(){return 0}},kn:{name:"Kannada",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ko:{name:"Korean",numbers:[1],plurals:function(){return 0}},ku:{name:"Kurdish",numbers:[1,2],plurals:function(a){return Number(1!=a)}},kw:{name:"Cornish",numbers:[1,2,3,4],plurals:function(a){return Number(1==a?0:2==a?1:3==a?2:3)}},ky:{name:"Kyrgyz",numbers:[1],plurals:function(){return 0}},lb:{name:"Letzeburgesch",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ln:{name:"Lingala",numbers:[1,2],plurals:function(a){return Number(a>1)}},lo:{name:"Lao",numbers:[1],plurals:function(){return 0}},lt:{name:"Lithuanian",numbers:[1,2,10],plurals:function(a){return Number(1==a%10&&11!=a%100?0:a%10>=2&&(10>a%100||a%100>=20)?1:2)}},lv:{name:"Latvian",numbers:[1,2,0],plurals:function(a){return Number(1==a%10&&11!=a%100?0:0!==a?1:2)}},mai:{name:"Maithili",numbers:[1,2],plurals:function(a){return Number(1!=a)}},mfe:{name:"Mauritian Creole",numbers:[1,2],plurals:function(a){return Number(a>1)}},mg:{name:"Malagasy",numbers:[1,2],plurals:function(a){return Number(a>1)}},mi:{name:"Maori",numbers:[1,2],plurals:function(a){return Number(a>1)}},mk:{name:"Macedonian",numbers:[1,2],plurals:function(a){return Number(1==a||1==a%10?0:1)}},ml:{name:"Malayalam",numbers:[1,2],plurals:function(a){return Number(1!=a)}},mn:{name:"Mongolian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},mnk:{name:"Mandinka",numbers:[0,1,2],plurals:function(a){return Number(1==a?1:2)}},mr:{name:"Marathi",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ms:{name:"Malay",numbers:[1],plurals:function(){return 0}},mt:{name:"Maltese",numbers:[1,2,11,20],plurals:function(a){return Number(1==a?0:0===a||a%100>1&&11>a%100?1:a%100>10&&20>a%100?2:3)}},nah:{name:"Nahuatl",numbers:[1,2],plurals:function(a){return Number(1!=a)}},nap:{name:"Neapolitan",numbers:[1,2],plurals:function(a){return Number(1!=a)}},nb:{name:"Norwegian Bokmal",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ne:{name:"Nepali",numbers:[1,2],plurals:function(a){return Number(1!=a)}},nl:{name:"Dutch",numbers:[1,2],plurals:function(a){return Number(1!=a)}},nn:{name:"Norwegian Nynorsk",numbers:[1,2],plurals:function(a){return Number(1!=a)}},no:{name:"Norwegian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},nso:{name:"Northern Sotho",numbers:[1,2],plurals:function(a){return Number(1!=a)}},oc:{name:"Occitan",numbers:[1,2],plurals:function(a){return Number(a>1)}},or:{name:"Oriya",numbers:[2,1],plurals:function(a){return Number(1!=a)}},pa:{name:"Punjabi",numbers:[1,2],plurals:function(a){return Number(1!=a)}},pap:{name:"Papiamento",numbers:[1,2],plurals:function(a){return Number(1!=a)}},pl:{name:"Polish",numbers:[1,2,5],plurals:function(a){return Number(1==a?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)}},pms:{name:"Piemontese",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ps:{name:"Pashto",numbers:[1,2],plurals:function(a){return Number(1!=a)}},pt:{name:"Portuguese",numbers:[1,2],plurals:function(a){return Number(1!=a)}},pt_br:{name:"Brazilian Portuguese",numbers:[1,2],plurals:function(a){return Number(1!=a)}},rm:{name:"Romansh",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ro:{name:"Romanian",numbers:[1,2,20],plurals:function(a){return Number(1==a?0:0===a||a%100>0&&20>a%100?1:2)}},ru:{name:"Russian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&11!=a%100?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)}},sah:{name:"Yakut",numbers:[1],plurals:function(){return 0}},sco:{name:"Scots",numbers:[1,2],plurals:function(a){return Number(1!=a)}},se:{name:"Northern Sami",numbers:[1,2],plurals:function(a){return Number(1!=a)}},si:{name:"Sinhala",numbers:[1,2],plurals:function(a){return Number(1!=a)}},sk:{name:"Slovak",numbers:[1,2,5],plurals:function(a){return Number(1==a?0:a>=2&&4>=a?1:2)}},sl:{name:"Slovenian",numbers:[5,1,2,3],plurals:function(a){return Number(1==a%100?1:2==a%100?2:3==a%100||4==a%100?3:0)}},so:{name:"Somali",numbers:[1,2],plurals:function(a){return Number(1!=a)}},son:{name:"Songhay",numbers:[1,2],plurals:function(a){return Number(1!=a)}},sq:{name:"Albanian",numbers:[1,2],plurals:function(a){return Number(1!=a)}},sr:{name:"Serbian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&11!=a%100?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)}},su:{name:"Sundanese",numbers:[1],plurals:function(){return 0}},sv:{name:"Swedish",numbers:[1,2],plurals:function(a){return Number(1!=a)}},sw:{name:"Swahili",numbers:[1,2],plurals:function(a){return Number(1!=a)}},ta:{name:"Tamil",numbers:[1,2],plurals:function(a){return Number(1!=a)}},te:{name:"Telugu",numbers:[1,2],plurals:function(a){return Number(1!=a)}},tg:{name:"Tajik",numbers:[1,2],plurals:function(a){return Number(a>1)}},th:{name:"Thai",numbers:[1],plurals:function(){return 0}},ti:{name:"Tigrinya",numbers:[1,2],plurals:function(a){return Number(a>1)}},tk:{name:"Turkmen",numbers:[1,2],plurals:function(a){return Number(1!=a)}},tr:{name:"Turkish",numbers:[1,2],plurals:function(a){return Number(a>1)}},tt:{name:"Tatar",numbers:[1],plurals:function(){return 0}},ug:{name:"Uyghur",numbers:[1],plurals:function(){return 0}},uk:{name:"Ukrainian",numbers:[1,2,5],plurals:function(a){return Number(1==a%10&&11!=a%100?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)}},ur:{name:"Urdu",numbers:[1,2],plurals:function(a){return Number(1!=a)}},uz:{name:"Uzbek",numbers:[1,2],plurals:function(a){return Number(a>1)}},vi:{name:"Vietnamese",numbers:[1],plurals:function(){return 0}},wa:{name:"Walloon",numbers:[1,2],plurals:function(a){return Number(a>1)}},wo:{name:"Wolof",numbers:[1],plurals:function(){return 0}},yo:{name:"Yoruba",numbers:[1,2],plurals:function(a){return Number(1!=a)}},zh:{name:"Chinese",numbers:[1],plurals:function(){return 0}}},addRule:function(a,b){S.rules[a]=b},setCurrentLng:function(a){if(!S.currentRule||S.currentRule.lng!==a){var b=a.split("-");S.currentRule={lng:a,rule:S.rules[b[0]]}}},needsPlural:function(a,b){var c,d=a.split("-");return c=S.currentRule&&S.currentRule.lng===a?S.currentRule.rule:S.rules[d[R.getCountyIndexOfLng(a)]],c&&c.numbers.length<=1?!1:1!==this.get(a,b)},get:function(a,b){function c(b,c){var d;if(d=S.currentRule&&S.currentRule.lng===a?S.currentRule.rule:S.rules[b]){var e;e=d.plurals(d.noAbs?c:Math.abs(c));var f=d.numbers[e];return 2===d.numbers.length&&1===d.numbers[0]&&(2===f?f=-1:1===f&&(f=1)),f}return 1===c?"1":"-1"}var d=a.split("-");return c(d[R.getCountyIndexOfLng(a)],b)
69
+ }},T={},U=function(a,b){T[a]=b},V=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function b(a,b){for(var c=[];b>0;c[--b]=a);return c.join("")}var c=function(){return c.cache.hasOwnProperty(arguments[0])||(c.cache[arguments[0]]=c.parse(arguments[0])),c.format.call(null,c.cache[arguments[0]],arguments)};return c.format=function(c,d){var e,f,g,h,i,j,k,l=1,m=c.length,n="",o=[];for(f=0;m>f;f++)if(n=a(c[f]),"string"===n)o.push(c[f]);else if("array"===n){if(h=c[f],h[2])for(e=d[l],g=0;g<h[2].length;g++){if(!e.hasOwnProperty(h[2][g]))throw V('[sprintf] property "%s" does not exist',h[2][g]);e=e[h[2][g]]}else e=h[1]?d[h[1]]:d[l++];if(/[^s]/.test(h[8])&&"number"!=a(e))throw V("[sprintf] expecting number but found %s",a(e));switch(h[8]){case"b":e=e.toString(2);break;case"c":e=String.fromCharCode(e);break;case"d":e=parseInt(e,10);break;case"e":e=h[7]?e.toExponential(h[7]):e.toExponential();break;case"f":e=h[7]?parseFloat(e).toFixed(h[7]):parseFloat(e);break;case"o":e=e.toString(8);break;case"s":e=(e=String(e))&&h[7]?e.substring(0,h[7]):e;break;case"u":e=Math.abs(e);break;case"x":e=e.toString(16);break;case"X":e=e.toString(16).toUpperCase()}e=/[def]/.test(h[8])&&h[3]&&e>=0?"+"+e:e,j=h[4]?"0"==h[4]?"0":h[4].charAt(1):" ",k=h[6]-String(e).length,i=h[6]?b(j,k):"",o.push(h[5]?e+i:i+e)}return o.join("")},c.cache={},c.parse=function(a){for(var b=a,c=[],d=[],e=0;b;){if(null!==(c=/^[^\x25]+/.exec(b)))d.push(c[0]);else if(null!==(c=/^\x25{2}/.exec(b)))d.push("%");else{if(null===(c=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(b)))throw"[sprintf] huh?";if(c[2]){e|=1;var f=[],g=c[2],h=[];if(null===(h=/^([a-z_][a-z_\d]*)/i.exec(g)))throw"[sprintf] huh?";for(f.push(h[1]);""!==(g=g.substring(h[0].length));)if(null!==(h=/^\.([a-z_][a-z_\d]*)/i.exec(g)))f.push(h[1]);else{if(null===(h=/^\[(\d+)\]/.exec(g)))throw"[sprintf] huh?";f.push(h[1])}c[2]=f}else e|=2;if(3===e)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";d.push(c)}b=b.substring(c[0].length)}return d},c}(),W=function(a,b){return b.unshift(a),V.apply(null,b)};U("sprintf",function(a,b,c){return c.sprintf?"[object Array]"===Object.prototype.toString.apply(c.sprintf)?W(a,c.sprintf):"object"==typeof c.sprintf?V(a,c.sprintf):a:a}),G.init=f,G.setLng=o,G.preload=g,G.addResourceBundle=h,G.addResource=j,G.addResources=k,G.removeResourceBundle=i,G.loadNamespace=m,G.loadNamespaces=n,G.setDefaultNamespace=l,G.t=x,G.translate=x,G.exists=w,G.detectLanguage=R.detectLanguage,G.pluralExtensions=S,G.sync=L,G.functions=R,G.lng=p,G.addPostProcessor=U,G.options=N}();/*!
70
+ * Source: build/lib/translation.json, license: MIT, url: https://webtranslateit.com/en/projects/10365-JSXC */
71
+ var I18next={de:{translation:{Logging_in:"Login läuft…",your_connection_is_unencrypted:"Deine Verbindung ist Unverschlüsselt.",your_connection_is_encrypted:"Deine Verbindung ist verschlüsselt.",your_buddy_closed_the_private_connection:"Dein Kontakt hat die private Verbindung getrennt.",start_private:"Privat starten",close_private:"Privat abbrechen",your_buddy_is_verificated:"Dein Kontakt ist verifiziert.",you_have_only_a_subscription_in_one_way:"Der Kontaktstatus ist einseitig.",authentication_query_sent:"Authentifizierungsanfrage gesendet.",your_message_wasnt_send_please_end_your_private_conversation:"Deine Nachricht wurde nicht gesendet. Bitte beende die private Konversation.",unencrypted_message_received:"Unverschlüsselte Nachricht erhalten.",your_message_wasnt_send_because_you_have_no_valid_subscription:"Deine Nachricht wurde nicht gesandt, da der Kontaktstatus einseitig ist.",not_available:"Nicht verfügbar.",no_connection:"Keine Verbindung.",relogin:"Neu anmelden.",trying_to_start_private_conversation:"Versuche private Konversation zu starten.",Verified:"Verifiziert",Unverified:"Unverifiziert",private_conversation_started:"Private Konversation gestartet.",private_conversation_aborted:"Private Konversation abgebrochen.",your_buddy_closed_the_private_conversation_you_should_do_the_same:"Dein Kontakt hat die private Konversation beendet. Das solltest du auch tun!",conversation_is_now_verified:"Konversation ist jetzt verifiziert",authentication_failed:"Authentifizierung fehlgeschlagen.",your_buddy_is_attempting_to_determine_:"Dein Kontakt versucht herauszufinden ob er wirklich mit dir redet.",to_authenticate_to_your_buddy:"Um dich gegenüber deinem Kontakt zu verifizieren ",enter_the_answer_and_click_answer:"gib die Antwort ein und klick auf Antworten.",enter_the_secret:"gib das Geheimnis ein.",Creating_your_private_key_:"Wir werden jetzt deinen privaten Schlüssel generieren. Das kann einige Zeit in Anspruch nehmen.",Authenticating_a_buddy_helps_:"Einen Kontakt zu authentifizieren hilft sicher zustellen, dass die Person mit der du sprichst auch die ist die sie sagt.",How_do_you_want_to_authenticate_your_buddy:"Wie willst du {{bid_name}} (<b>{{bid_jid}}</b>) authentifizieren?",Select_method:"Wähle...",Manual:"Manual",Question:"Frage",Secret:"Geheimnis",To_verify_the_fingerprint_:"Um den Fingerprint zu verifizieren kontaktiere dein Kontakt über einen anderen Kommunikationsweg. Zum Beispiel per Telefonanruf.",Your_fingerprint:"Dein Fingerprint",Buddy_fingerprint:"Sein/Ihr Fingerprint",Close:"Schließen",Compared:"Verglichen",To_authenticate_using_a_question_:"Um die Authentifizierung per Frage durchzuführen, wähle eine Frage bei welcher nur dein Kontakt die Antwort weiß.",Ask:"Frage",To_authenticate_pick_a_secret_:"Um deinen Kontakt zu authentifizieren, wähle ein Geheimnis welches nur deinem Kontakt und dir bekannt ist.",Compare:"Vergleiche",Fingerprints:"Fingerprints",Authentication:"Authentifizierung",Message:"Nachricht",Add_buddy:"Kontakt hinzufügen",rename_buddy:"Kontakt umbenennen",delete_buddy:"Kontakt löschen",Login:"Anmeldung",Username:"Benutzername",Password:"Passwort",Cancel:"Abbrechen",Connect:"Verbinden",Type_in_the_full_username_:"Gib bitte den vollen Benutzernamen und optional ein Alias an.",Alias:"Alias",Add:"Hinzufügen",Subscription_request:"Kontaktanfrage",You_have_a_request_from:"Du hast eine Anfrage von",Deny:"Ablehnen",Approve:"Bestätigen",Remove_buddy:"Kontakt entfernen",You_are_about_to_remove_:"Du bist gerade dabei {{bid_name}} (<b>{{bid_jid}}</b>) von deiner Kontaktliste zu entfernen. Alle Chats werden geschlossen.",Continue_without_chat:"Weiter ohne Chat",Please_wait:"Bitte warten",Login_failed:"Chat-Anmeldung fehlgeschlagen",Sorry_we_cant_authentikate_:"Der Chatserver hat die Anmeldung abgelehnt. Falsches Passwort?",Retry:"Zurück",clear_history:"Lösche Verlauf",New_message_from:"Neue Nachricht von",Should_we_notify_you_:"Sollen wir dich in Zukunft über eingehende Nachrichten informieren, auch wenn dieser Tab nicht im Vordergrund ist?",Please_accept_:'Bitte klick auf den "Zulassen" Button oben.',Hide_offline:"Offline ausblenden",Show_offline:"Offline einblenden",About:"Über",dnd:"Beschäftigt",Mute:"Ton aus",Unmute:"Ton an",Subscription:"Bezug",both:"beidseitig",Status:"Status",online:"online",chat:"chat",away:"abwesend",xa:"länger abwesend",offline:"offline",none:"keine",Unknown_instance_tag:"Unbekannter instance tag.",Not_one_of_our_latest_keys:"Nicht einer unserer letzten Schlüssel.",Received_an_unreadable_encrypted_message:"Eine unlesbare verschlüsselte Nachricht erhalten.",Online:"Online",Chatty:"Gesprächig",Away:"Abwesend",Extended_away:"Länger abwesend",Offline:"Offline",Friendship_request:"Kontaktanfrage",Confirm:"Bestätigen",Dismiss:"Ablehnen",Remove:"Löschen",Online_help:"Online Hilfe",FN:"Name",N:" ",FAMILY:"Familienname",GIVEN:"Vorname",NICKNAME:"Spitzname",URL:"URL",ADR:"Adresse",STREET:"Straße",EXTADD:"Zusätzliche Adresse",LOCALITY:"Ortschaft",REGION:"Region",PCODE:"Postleitzahl",CTRY:"Land",TEL:"Telefon",NUMBER:"Nummer",EMAIL:"E-Mail",USERID:" ",ORG:"Organisation",ORGNAME:"Name",ORGUNIT:"Abteilung",TITLE:"Titel",ROLE:"Rolle",BDAY:"Geburtstag",DESC:"Beschreibung",PHOTO:" ",send_message:"Sende Nachricht",get_info:"Benutzerinformationen",Settings:"Einstellungen",Priority:"Priorität",Save:"Speichern",User_settings:"Benutzereinstellungen",A_fingerprint_:"Ein Fingerabdruck wird dazu benutzt deinen Gesprächspartner zu identifizieren.",Your_roster_is_empty_add_a:"Deine Kontaktliste ist leer, füge einen neuen Kontakt ",new_buddy:"hinzu",is:"ist",Login_options:"Anmeldeoptionen",BOSH_url:"BOSH url",Domain:"Domain",Resource:"Ressource",On_login:"Beim Anmelden",Received_an_unencrypted_message:"Unverschlüsselte Nachricht empfangen",Sorry_your_buddy_doesnt_provide_any_information:"Dein Kontakt stellt leider keine Informationen bereit.",Info_about:"Info über",Authentication_aborted:"Authentifizierung abgebrochen.",Authentication_request_received:"Authentifizierunganfrage empfangen.",Do_you_want_to_display_them:"Möchtest du sie sehen?",Log_in_without_chat:"Anmelden ohne Chat",has_come_online:"ist online gekommen",Unknown_sender:"Unbekannter Sender",You_received_a_message_from_an_unknown_sender:"Du hast eine Nachricht von einem unbekannten Sender erhalten",Please_allow_access_to_microphone_and_camera:'Bitte klick auf den "Zulassen" Button oben, um den Zugriff auf Kamera und Mikrofon zu erlauben.',Incoming_call:"Eingehender Anruf",from:"von",Do_you_want_to_accept_the_call_from:"Möchtest Du den Anruf annehmen von",Reject:"Ablehnen",Accept:"Annehmen",hang_up:"Auflegen",snapshot:"Schnappschuss",mute_my_audio:"Mein Ton aus",pause_my_video:"Mein Video pausieren",fullscreen:"Vollbild",Info:"Info",Local_IP:"Lokale IP",Remote_IP:"Remote IP",Local_Fingerprint:"Lokaler Fingerprint",Remote_Fingerprint:"Remote Fingerprint",Video_call_not_possible:"Videoanruf nicht verfügbar. Dein Gesprächspartner unterstützt keine Videotelefonie.",Start_video_call:"Starte Videoanruf"}},el:{translation:{Logging_in:null,your_connection_is_unencrypted:null,your_connection_is_encrypted:null,your_buddy_closed_the_private_connection:null,start_private:null,close_private:null,your_buddy_is_verificated:null,you_have_only_a_subscription_in_one_way:null,authentication_query_sent:null,your_message_wasnt_send_please_end_your_private_conversation:null,unencrypted_message_received:null,your_message_wasnt_send_because_you_have_no_valid_subscription:null,not_available:null,no_connection:null,relogin:null,trying_to_start_private_conversation:null,Verified:null,Unverified:null,private_conversation_started:null,private_conversation_aborted:null,your_buddy_closed_the_private_conversation_you_should_do_the_same:null,conversation_is_now_verified:null,authentication_failed:null,your_buddy_is_attempting_to_determine_:null,to_authenticate_to_your_buddy:null,enter_the_answer_and_click_answer:null,enter_the_secret:null,Creating_your_private_key_:null,Authenticating_a_buddy_helps_:null,How_do_you_want_to_authenticate_your_buddy:null,Select_method:null,Manual:null,Question:null,Secret:null,To_verify_the_fingerprint_:null,Your_fingerprint:null,Buddy_fingerprint:null,Close:null,Compared:null,To_authenticate_using_a_question_:null,Ask:null,To_authenticate_pick_a_secret_:null,Compare:null,Fingerprints:null,Authentication:null,Message:null,Add_buddy:null,rename_buddy:null,delete_buddy:null,Login:null,Username:null,Password:null,Cancel:null,Connect:null,Type_in_the_full_username_:null,Alias:null,Add:null,Subscription_request:null,You_have_a_request_from:null,Deny:null,Approve:null,Remove_buddy:null,You_are_about_to_remove_:null,Continue_without_chat:null,Please_wait:null,Login_failed:null,Sorry_we_cant_authentikate_:null,Retry:null,clear_history:null,New_message_from:null,Should_we_notify_you_:null,Please_accept_:null,Hide_offline:null,Show_offline:null,About:null,dnd:null,Mute:null,Unmute:null,Subscription:null,both:null,Status:null,online:null,chat:null,away:null,xa:null,offline:null,none:null,Unknown_instance_tag:null,Not_one_of_our_latest_keys:null,Received_an_unreadable_encrypted_message:null,Online:null,Chatty:null,Away:null,Extended_away:null,Offline:null,Friendship_request:null,Confirm:null,Dismiss:null,Remove:null,Online_help:null,FN:null,N:null,FAMILY:null,GIVEN:null,NICKNAME:null,URL:null,ADR:null,STREET:null,EXTADD:null,LOCALITY:null,REGION:null,PCODE:null,CTRY:null,TEL:null,NUMBER:null,EMAIL:null,USERID:null,ORG:null,ORGNAME:null,ORGUNIT:null,TITLE:null,ROLE:null,BDAY:null,DESC:null,PHOTO:null,send_message:null,get_info:null,Settings:null,Priority:null,Save:null,User_settings:null,A_fingerprint_:null,Your_roster_is_empty_add_a:null,new_buddy:null,is:null,Login_options:null,BOSH_url:null,Domain:null,Resource:null,On_login:null,Received_an_unencrypted_message:null,Sorry_your_buddy_doesnt_provide_any_information:null,Info_about:null,Authentication_aborted:null,Authentication_request_received:null,Do_you_want_to_display_them:null,Log_in_without_chat:null,has_come_online:null,Unknown_sender:null,You_received_a_message_from_an_unknown_sender:null,Please_allow_access_to_microphone_and_camera:null,Incoming_call:null,from:null,Do_you_want_to_accept_the_call_from:null,Reject:null,Accept:null,hang_up:null,snapshot:null,mute_my_audio:null,pause_my_video:null,fullscreen:null,Info:null,Local_IP:null,Remote_IP:null,Local_Fingerprint:null,Remote_Fingerprint:null,Video_call_not_possible:null,Start_video_call:null}},en:{translation:{Logging_in:"Logging in…",your_connection_is_unencrypted:"Your connection is unencrypted.",your_connection_is_encrypted:"Your connection is encrypted.",your_buddy_closed_the_private_connection:"Your buddy closed the private connection.",start_private:"Start private",close_private:"Close private",your_buddy_is_verificated:"Your buddy is verified.",you_have_only_a_subscription_in_one_way:"You only have a one-way subscription.",authentication_query_sent:"Authentication query sent.",your_message_wasnt_send_please_end_your_private_conversation:"Your message was not sent. Please end your private conversation.",unencrypted_message_received:"Unencrypted message received",your_message_wasnt_send_because_you_have_no_valid_subscription:"Your message was not sent because you have no valid subscription.",not_available:"Not available",no_connection:"No connection!",relogin:"relogin",trying_to_start_private_conversation:"Trying to start private conversation!",Verified:"Verified",Unverified:"Unverified",private_conversation_started:"Private conversation started.",private_conversation_aborted:"Private conversation aborted!",your_buddy_closed_the_private_conversation_you_should_do_the_same:"Your buddy closed the private conversation! You should do the same.",conversation_is_now_verified:"Conversation is now verified.",authentication_failed:"Authentication failed.",your_buddy_is_attempting_to_determine_:"You buddy is attempting to determine if he or she is really talking to you.",to_authenticate_to_your_buddy:"To authenticate to your buddy, ",enter_the_answer_and_click_answer:"enter the answer and click Answer.",enter_the_secret:"enter the secret.",Creating_your_private_key_:"Creating your private key; this may take a while.",Authenticating_a_buddy_helps_:"Authenticating a buddy helps ensure that the person you are talking to is really the one he or she claims to be.",How_do_you_want_to_authenticate_your_buddy:"How do you want to authenticate {{bid_name}} (<b>{{bid_jid}}</b>)?",Select_method:"Select method...",Manual:"Manual",Question:"Question",Secret:"Secret",To_verify_the_fingerprint_:"To verify the fingerprint, contact your buddy via some other trustworthy channel, such as the telephone.",Your_fingerprint:"Your fingerprint",Buddy_fingerprint:"Buddy fingerprint",Close:"Close",Compared:"Compared",To_authenticate_using_a_question_:"To authenticate using a question, pick a question whose answer is known only you and your buddy.",Ask:"Ask",To_authenticate_pick_a_secret_:"To authenticate, pick a secret known only to you and your buddy.",Compare:"Compare",Fingerprints:"Fingerprints",Authentication:"Authentication",Message:"Message",Add_buddy:"Add buddy",rename_buddy:"rename buddy",delete_buddy:"delete buddy",Login:"Login",Username:"Username",Password:"Password",Cancel:"Cancel",Connect:"Connect",Type_in_the_full_username_:"Type in the full username and an optional alias.",Alias:"Alias",Add:"Add",Subscription_request:"Subscription request",You_have_a_request_from:"You have a request from",Deny:"Deny",Approve:"Approve",Remove_buddy:"Remove buddy",You_are_about_to_remove_:"You are about to remove {{bid_name}} (<b>{{bid_jid}}</b>) from your buddy list. All related chats will be closed.",Continue_without_chat:"Continue without chat",Please_wait:"Please wait",Login_failed:"Chat login failed",Sorry_we_cant_authentikate_:"Authentication failed with the chat server. Maybe the password is wrong?",Retry:"Back",clear_history:"Clear history",New_message_from:"New message from",Should_we_notify_you_:"Should we notify you about new messages in the future?",Please_accept_:'Please click the "Allow" button at the top.',Hide_offline:"Hide offline contacts",Show_offline:"Show offline contacts",About:"About",dnd:"Do Not Disturb",Mute:"Mute",Unmute:"Unmute",Subscription:"Subscription",both:"both",Status:"Status",online:"online",chat:"chat",away:"away",xa:"extended away",offline:"offline",none:"none",Unknown_instance_tag:"Unknown instance tag.",Not_one_of_our_latest_keys:"Not one of our latest keys.",Received_an_unreadable_encrypted_message:"Received an unreadable encrypted message.",Online:"Online",Chatty:"Chatty",Away:"Away",Extended_away:"Extended away",Offline:"Offline",Friendship_request:"Friendship request",Confirm:"Confirm",Dismiss:"Dismiss",Remove:"Remove",Online_help:"Online help",FN:"Full name",N:" ",FAMILY:"Family name",GIVEN:"Given name",NICKNAME:"Nickname",URL:"URL",ADR:"Address",STREET:"Street Address",EXTADD:"Extended Address",LOCALITY:"Locality",REGION:"Region",PCODE:"Postal Code",CTRY:"Country",TEL:"Telephone",NUMBER:"Number",EMAIL:"Email",USERID:" ",ORG:"Organization",ORGNAME:"Name",ORGUNIT:"Unit",TITLE:"Job title",ROLE:"Role",BDAY:"Birthday",DESC:"Description",PHOTO:" ",send_message:"Send message",get_info:"Show information",Settings:"Settings",Priority:"Priority",Save:"Save",User_settings:"User settings",A_fingerprint_:"A fingerprint is used to make sure that the person you are talking to is who he or she is saying.",Your_roster_is_empty_add_a:"Your roster is empty, add a ",new_buddy:"new buddy",is:"is",Login_options:"Login options",BOSH_url:"BOSH URL",Domain:"Domain",Resource:"Resource",On_login:"On login",Received_an_unencrypted_message:"Received an unencrypted message",Sorry_your_buddy_doesnt_provide_any_information:"Sorry, your buddy does not provide any information.",Info_about:"Info about",Authentication_aborted:"Authentication aborted.",Authentication_request_received:"Authentication request received.",Do_you_want_to_display_them:"Do you want to display them?",Log_in_without_chat:"Log in without chat",has_come_online:"has come online",Unknown_sender:"Unknown sender",You_received_a_message_from_an_unknown_sender:"You received a message from an unknown sender",Please_allow_access_to_microphone_and_camera:'Please click the "Allow" button at the top, to allow access to microphone and camera.',Incoming_call:"Incoming call",from:"from",Do_you_want_to_accept_the_call_from:"Do you want to accept the call from",Reject:"Reject",Accept:"Accept",hang_up:"hang up",snapshot:"snapshot",mute_my_audio:"mute my audio",pause_my_video:"pause my video",fullscreen:"fullscreen",Info:"Info",Local_IP:"Local IP",Remote_IP:"Remote IP",Local_Fingerprint:"Local fingerprint",Remote_Fingerprint:"Remote fingerprint",Video_call_not_possible:"Video call not possible. Your buddy does not support video calls.",Start_video_call:"Start video call"}},es:{translation:{Logging_in:"Por favor, espere...",your_connection_is_unencrypted:"Su conexión no está cifrada.",your_connection_is_encrypted:"Su conexión está cifrada.",your_buddy_closed_the_private_connection:"Su amigo ha cerrado la conexión privada.",start_private:"Iniciar privado",close_private:"Cerrar privado",your_buddy_is_verificated:"Tu amigo está verificado.",you_have_only_a_subscription_in_one_way:"Sólo tienes una suscripción de un modo.",authentication_query_sent:"Consulta de verificación enviada.",your_message_wasnt_send_please_end_your_private_conversation:"Su mensaje no fue enviado. Por favor, termine su conversación privada.",unencrypted_message_received:"Mensaje no cifrado recibido:",your_message_wasnt_send_because_you_have_no_valid_subscription:"Su mensaje no se ha enviado, porque usted no tiene suscripción válida.",not_available:"No disponible",no_connection:"Sin conexión!",relogin:"iniciar sesión nuevamente",trying_to_start_private_conversation:"Intentando iniciar una conversación privada!",Verified:"Verificado",Unverified:"No verificado",private_conversation_started:"se inició una conversación privada.",private_conversation_aborted:"Conversación privada abortada!",your_buddy_closed_the_private_conversation_you_should_do_the_same:"Su amigo cerró la conversación privada! Usted debería hacer lo mismo.",conversation_is_now_verified:"La conversación es ahora verificada.",authentication_failed:"Fallo la verificación.",your_buddy_is_attempting_to_determine_:"Tu amigo está tratando de determinar si él o ella está realmente hablando con usted.",to_authenticate_to_your_buddy:"Para autenticar a su amigo, ",enter_the_answer_and_click_answer:"introduce la respuesta y haga clic en Contestar.",enter_the_secret:"especifique el secreto.",Creating_your_private_key_:"Ahora vamos a crear su clave privada. Esto puede tomar algún tiempo.",Authenticating_a_buddy_helps_:"Autenticación de un amigo ayuda a garantizar que la persona que está hablando es quien él o ella está diciendo.",How_do_you_want_to_authenticate_your_buddy:"¿Cómo desea autenticar {{bid_name}} (<b>{{bid_jid}}</b>)?",Select_method:"Escoja un método...",Manual:"Manual",Question:"Pregunta",Secret:"Secreto",To_verify_the_fingerprint_:"Para verificar la firma digital, póngase en contacto con su amigo a través de algún otro canal autenticado, como el teléfono.",Your_fingerprint:"Tu firma digital",Buddy_fingerprint:"firma digital de tu amigo",Close:"Cerrar",Compared:"Comparado",To_authenticate_using_a_question_:"Para autenticar mediante una pregunta, elegir una pregunta cuya respuesta se conoce sólo usted y su amigo.",Ask:"Preguntar",To_authenticate_pick_a_secret_:"Para autenticar, elija un secreto conocido sólo por usted y su amigo.",Compare:"Comparar",Fingerprints:"Firmas digitales",Authentication:"Autenticación",Message:"Mensaje",Add_buddy:"Añadir amigo",rename_buddy:"renombrar amigo",delete_buddy:"eliminar amigo",Login:"Iniciar Sesión",Username:"Usuario",Password:"Contraseña",Cancel:"Cancelar",Connect:"Conectar",Type_in_the_full_username_:"Escriba el usuario completo y un alias opcional.",Alias:"Alias",Add:"Añadir",Subscription_request:"Solicitud de suscripción",You_have_a_request_from:"Tienes una petición de",Deny:"Rechazar",Approve:"Aprobar",Remove_buddy:"Eliminar amigo",You_are_about_to_remove_:"Vas a eliminar a {{bid_name}} (<b>{{bid_jid}}</b>) de tu lista de amigos. Todas las conversaciones relacionadas serán cerradas.",Continue_without_chat:"Continuar",Please_wait:"Espere por favor",Login_failed:"Fallo el inicio de sesión",Sorry_we_cant_authentikate_:"Lo sentimos, no podemos autentificarlo en nuestro servidor de chat. ¿Tal vez la contraseña es incorrecta?",Retry:"Reintentar",clear_history:"Borrar el historial",New_message_from:"Nuevo mensaje de",Should_we_notify_you_:"¿Debemos notificarle sobre nuevos mensajes en el futuro?",Please_accept_:'Por favor, haga clic en el botón "Permitir" en la parte superior.',Hide_offline:"Ocultar contactos desconectados",Show_offline:"Mostrar contactos desconectados",About:"Acerca de",dnd:"No Molestar",Mute:"Desactivar sonido",Unmute:"Activar sonido",Subscription:"Suscripción",both:"ambos",Status:"Estado",online:"en línea",chat:"chat",away:"ausente",xa:"mas ausente",offline:"desconectado",none:"nadie",Unknown_instance_tag:"Etiqueta de instancia desconocida.",Not_one_of_our_latest_keys:"No de nuestra ultima tecla.",Received_an_unreadable_encrypted_message:"Se recibió un mensaje cifrado ilegible.",Online:"En linea",Chatty:"Hablador",Away:"Ausente",Extended_away:"Mas ausente",Offline:"Desconectado",Friendship_request:"Solicitud de amistad",Confirm:"Confirmar",Dismiss:"Rechazar",Remove:"Eliminar",Online_help:"Ayuda en línea",FN:"Nombre completo ",N:" ",FAMILY:"Apellido",GIVEN:"Nombre",NICKNAME:"Apodar",URL:"URL",ADR:"Dirección",STREET:"Calle",EXTADD:"Extendido dirección",LOCALITY:"Población",REGION:"Región",PCODE:"Código postal",CTRY:"País",TEL:"Teléfono",NUMBER:"Número",EMAIL:"Emilio",USERID:" ",ORG:"Organización",ORGNAME:"Nombre",ORGUNIT:"Departamento",TITLE:"Título",ROLE:"Rol",BDAY:"Cumpleaños",DESC:"Descripción",PHOTO:" ",send_message:"mandar un texto",get_info:"obtener información",Settings:"Ajustes",Priority:"Prioridad",Save:"Guardar",User_settings:"Configuración de usuario",A_fingerprint_:"La huella digital se utiliza para que puedas estar seguro que la persona con la que estas hablando es quien realmente dice ser",Your_roster_is_empty_add_a:"Tu lista de amigos esta vacia",new_buddy:"Nuevo amigo",is:"es",Login_options:"Opciones de login",BOSH_url:"BOSH url",Domain:"Dominio",Resource:"Recurso",On_login:"Iniciar sesión",Received_an_unencrypted_message:"Recibe un mensaje no cifrado",Sorry_your_buddy_doesnt_provide_any_information:"Lo sentimos, su amigo no provee ninguna información.",Info_about:"Info acerca de",Authentication_aborted:"Autenticación abortada",Authentication_request_received:"Pedido de autenticación recibido.",Do_you_want_to_display_them:"¿Quiere mostrarlos?",Log_in_without_chat:"Ingresar sin chat",has_come_online:"se ha conectado",Unknown_sender:"Remitente desconocido",You_received_a_message_from_an_unknown_sender:"Ha recibido un mensaje de un remitente desconocido",Please_allow_access_to_microphone_and_camera:"Por favor, permitir el acceso al micrófono y la cámara.",Incoming_call:"Llamada entrante",from:"de",Do_you_want_to_accept_the_call_from:"Desea aceptar la llamada de",Reject:"Rechazar",Accept:"Aceptar",hang_up:"colgar",snapshot:"instantánea",mute_my_audio:"silenciar mi audio",pause_my_video:"pausar mi vídeo",fullscreen:"pantalla completa",Info:"Info",Local_IP:"IP local",Remote_IP:"IP remota",Local_Fingerprint:"Firma digital local",Remote_Fingerprint:"Firma digital remota",Video_call_not_possible:"Llamada de vídeo no es posible",Start_video_call:"Iniciar llamada de vídeo"}},fr:{translation:{Logging_in:"Connexion...",your_connection_is_unencrypted:"Connexion non chiffrée.",your_connection_is_encrypted:"Connexion chiffrée.",your_buddy_closed_the_private_connection:"Votre ami a fermé la connexion privée.",start_private:"Démarrer une conversation privé",close_private:"Clôturer une conversation privée",your_buddy_is_verificated:"Votre ami est vérifié.",you_have_only_a_subscription_in_one_way:"Vous ne pouvez souscrire qu'une fois.",authentication_query_sent:"Requête d’authentification envoyée.",your_message_wasnt_send_please_end_your_private_conversation:"Votre message n'a pas été envoyé. Veuillez terminer votre conversation privée.",unencrypted_message_received:"Reçu message non chiffré",your_message_wasnt_send_because_you_have_no_valid_subscription:"Votre message n'a pas été envoyé car votre abonnement n'est pas valide.",not_available:"Pas disponible",no_connection:"Pas de connexion !",relogin:"Re-connexion",trying_to_start_private_conversation:"Essai de démarrage d'une conversation privée !",Verified:"Vérifié",Unverified:"Non vérifié",private_conversation_started:"Conversation privé démarrée.",private_conversation_aborted:"Conversation privée interrompue !",your_buddy_closed_the_private_conversation_you_should_do_the_same:"Votre ami a fermé la conversation privée ! Vous devriez faire de même.",conversation_is_now_verified:"La conversation est maintenant vérifiée.",authentication_failed:"L'authentification a échoué.",your_buddy_is_attempting_to_determine_:"Votre ami tente de déterminer si il ou elle parle vraiment à vous.",to_authenticate_to_your_buddy:"Vous authentifier à votre ami, ",enter_the_answer_and_click_answer:"Saisissez une réponse et cliquer sur Répondre.",enter_the_secret:"Entrez le mot secret",Creating_your_private_key_:"Création de votre clé privée; cela peut prendre un moment.",Authenticating_a_buddy_helps_:"L'authentification d'un ami permet de s'assurer que la personne à qui vous parlez est vraiment celui qu'il ou elle prétend être.",How_do_you_want_to_authenticate_your_buddy:"Comment voulez-vous vous authentifier {{bid_name}} (<b>{{bid_jid}}</b>)?",Select_method:"Sélection de la méthode...",Manual:"Manuel",Question:"Question",Secret:"Sécurité",To_verify_the_fingerprint_:"Pour vérifier l'empreinte, contactez votre ami via un autre canal digne de confiance, tel que le téléphone.",Your_fingerprint:"Votre empreinte",Buddy_fingerprint:"Empreinte de l'ami",Close:"Fermer",Compared:"Comparé",To_authenticate_using_a_question_:"Pour s'authentifier à l'aide d'une question, choisissez une question dont la réponse n'est connue que vous et de votre ami.",Ask:"Demander",To_authenticate_pick_a_secret_:"Pour vous authentifier, choisissez un secret connu seulement de vous et de votre ami.",Compare:"Comparer",Fingerprints:"Empreintes",Authentication:"Authentification",Message:"Message",Add_buddy:"Ajouter comme ami",rename_buddy:"Renommer l'ami",delete_buddy:"Supprimer l'ami",Login:"Connexion",Username:"Nom d'utilisateur",Password:"Mot de passe",Cancel:"Annuler",Connect:"Connecter",Type_in_the_full_username_:"Tapez un nom d'utilisateur complet et un alias(optionnel).",Alias:"Alias",Add:"Ajouter",Subscription_request:"Demande d'abonnement",You_have_a_request_from:"Vous avez une requête de ",Deny:"Refuser",Approve:"Approuver",Remove_buddy:"Supprimer l'ami",You_are_about_to_remove_:"Vous allez retirer {{bid_name}} (<b>{{bid_jid}}</b>) de votre liste d'amis. Toutes les fenêtres de chat en lien avec celui-ci seront fermées.",Continue_without_chat:"Continuer sans tchat",Please_wait:"Merci de patienter",Login_failed:"Authentification échouée",Sorry_we_cant_authentikate_:"La connexion avec le serveur de tchat a échoué. Vérifiez le mot de passe.",Retry:"Retour",clear_history:"Effacer l’historique",New_message_from:"Nouveau message de",Should_we_notify_you_:"Dans le futur, devrons-nous vous notifier les nouveaux messages ?",Please_accept_:'Merci de cliquer sur le bouton "autoriser" en haut de page',Hide_offline:"Masquer les contacts non connectés",Show_offline:"Afficher les contacts non connectés",About:"À propos",dnd:"Ne pas déranger",Mute:"Muet",Unmute:"Son actif",Subscription:"Abonnement",both:"Les deux",Status:"Status",online:"En ligne",chat:"tchat",away:"Absent",xa:"Options étendues",offline:"Hors ligne",none:"Aucun",Unknown_instance_tag:"Tag inconnu",Not_one_of_our_latest_keys:"Ce n'est pas l'une des dernières touches",Received_an_unreadable_encrypted_message:"Message chiffré non lisible",Online:"En ligne",Chatty:"tchatty",Away:"Absent",Extended_away:"Options étendues",Offline:"Hors ligne",Friendship_request:"Demande d'amitié",Confirm:"Valider",Dismiss:"Rejeter",Remove:"Supprimer",Online_help:"Aide en ligne",FN:"Nom",N:" N ",FAMILY:"Nom de famille",GIVEN:"prénom",NICKNAME:"Surnom",URL:"URL",ADR:"Adresse",STREET:"Rue",EXTADD:"Adresse (suite)",LOCALITY:"Localité",REGION:"Région",PCODE:"Code Postal",CTRY:"Pays",TEL:"Téléphone",NUMBER:"Numéro",EMAIL:"Courriel",USERID:" USERID ",ORG:"Organisation",ORGNAME:"Nom",ORGUNIT:"Unité",TITLE:"Qualité:",ROLE:"Rôle",BDAY:"Date de naissance",DESC:"Description",PHOTO:"Photo",send_message:"Envoyer le message",get_info:"Montrer les informations",Settings:"Réglages",Priority:"Priorité",Save:"Enregistrer",User_settings:"Paramètres utilisateur",A_fingerprint_:"Une empreinte est utilisée pour s'assurer de l'identité de la personne à qui vous parlez",Your_roster_is_empty_add_a:"Votre liste est vide, ajouter ",new_buddy:"Nouvel ami",is:"est",Login_options:"Options d'identification",BOSH_url:"URL BOSH",Domain:"Domaine",Resource:"Ressource",On_login:"Après authentification",Received_an_unencrypted_message:"Reçu un message non chiffré",Sorry_your_buddy_doesnt_provide_any_information:"Désolé, votre ami n'a pas fourni d'informations",Info_about:"A propos de",Authentication_aborted:"Authentification interrompue.",Authentication_request_received:"Requête d'authentification reçue.",Do_you_want_to_display_them:"Voulez-vous les afficher ?",Log_in_without_chat:"S'identifier sans tchat",has_come_online:"vient d'arriver",Unknown_sender:"Expéditeur inconnu",You_received_a_message_from_an_unknown_sender:"Vous avez reçu un message d'un expéditeur inconnu",Please_allow_access_to_microphone_and_camera:'Veuillez cliquez sur le bouton "Autoriser" en haut, pour permettre l\'accès au micro et à la caméra.',Incoming_call:"Appel entrant",from:"de",Do_you_want_to_accept_the_call_from:"Voulez-vous accepter l'appel de",Reject:"Rejeté",Accept:"Accepté",hang_up:"Décrochez",snapshot:"Capture d’écran",mute_my_audio:"Couper l'audio",pause_my_video:"Mettre ma vidéo en pause",fullscreen:"Plein écran",Info:"Info",Local_IP:"IP locale",Remote_IP:"IP distante",Local_Fingerprint:"Empreinte locale",Remote_Fingerprint:"Empreinte distante",Video_call_not_possible:"L'appel vidéo n'est possible. Votre ami ne supporte pas les appels vidéo.",Start_video_call:"Démarrer l'appel vidéo"}},nds:{translation:{Logging_in:null,your_connection_is_unencrypted:null,your_connection_is_encrypted:null,your_buddy_closed_the_private_connection:null,start_private:null,close_private:null,your_buddy_is_verificated:null,you_have_only_a_subscription_in_one_way:null,authentication_query_sent:null,your_message_wasnt_send_please_end_your_private_conversation:null,unencrypted_message_received:null,your_message_wasnt_send_because_you_have_no_valid_subscription:null,not_available:null,no_connection:null,relogin:null,trying_to_start_private_conversation:null,Verified:null,Unverified:null,private_conversation_started:null,private_conversation_aborted:null,your_buddy_closed_the_private_conversation_you_should_do_the_same:null,conversation_is_now_verified:null,authentication_failed:null,your_buddy_is_attempting_to_determine_:null,to_authenticate_to_your_buddy:null,enter_the_answer_and_click_answer:null,enter_the_secret:null,Creating_your_private_key_:null,Authenticating_a_buddy_helps_:null,How_do_you_want_to_authenticate_your_buddy:null,Select_method:null,Manual:null,Question:null,Secret:null,To_verify_the_fingerprint_:null,Your_fingerprint:null,Buddy_fingerprint:null,Close:null,Compared:null,To_authenticate_using_a_question_:null,Ask:null,To_authenticate_pick_a_secret_:null,Compare:null,Fingerprints:null,Authentication:null,Message:null,Add_buddy:null,rename_buddy:null,delete_buddy:null,Login:null,Username:null,Password:null,Cancel:null,Connect:null,Type_in_the_full_username_:null,Alias:null,Add:null,Subscription_request:null,You_have_a_request_from:null,Deny:null,Approve:null,Remove_buddy:null,You_are_about_to_remove_:null,Continue_without_chat:null,Please_wait:null,Login_failed:null,Sorry_we_cant_authentikate_:null,Retry:null,clear_history:null,New_message_from:null,Should_we_notify_you_:null,Please_accept_:null,Hide_offline:null,Show_offline:null,About:null,dnd:null,Mute:null,Unmute:null,Subscription:null,both:null,Status:null,online:null,chat:null,away:null,xa:null,offline:null,none:null,Unknown_instance_tag:null,Not_one_of_our_latest_keys:null,Received_an_unreadable_encrypted_message:null,Online:null,Chatty:null,Away:null,Extended_away:null,Offline:null,Friendship_request:null,Confirm:null,Dismiss:null,Remove:null,Online_help:null,FN:null,N:null,FAMILY:null,GIVEN:null,NICKNAME:null,URL:null,ADR:null,STREET:null,EXTADD:null,LOCALITY:null,REGION:null,PCODE:null,CTRY:null,TEL:null,NUMBER:null,EMAIL:null,USERID:null,ORG:null,ORGNAME:null,ORGUNIT:null,TITLE:null,ROLE:null,BDAY:null,DESC:null,PHOTO:null,send_message:null,get_info:null,Settings:null,Priority:null,Save:null,User_settings:null,A_fingerprint_:null,Your_roster_is_empty_add_a:null,new_buddy:null,is:null,Login_options:null,BOSH_url:null,Domain:null,Resource:null,On_login:null,Received_an_unencrypted_message:null,Sorry_your_buddy_doesnt_provide_any_information:null,Info_about:null,Authentication_aborted:null,Authentication_request_received:null,Do_you_want_to_display_them:null,Log_in_without_chat:null,has_come_online:null,Unknown_sender:null,You_received_a_message_from_an_unknown_sender:null,Please_allow_access_to_microphone_and_camera:null,Incoming_call:null,from:null,Do_you_want_to_accept_the_call_from:null,Reject:null,Accept:null,hang_up:null,snapshot:null,mute_my_audio:null,pause_my_video:null,fullscreen:null,Info:null,Local_IP:null,Remote_IP:null,Local_Fingerprint:null,Remote_Fingerprint:null,Video_call_not_possible:null,Start_video_call:null}},"pt-BR":{translation:{Logging_in:"Entrando...",your_connection_is_unencrypted:"Sua conexão não é encriptada",your_connection_is_encrypted:"Sua conexão é encriptada",your_buddy_closed_the_private_connection:"Seu contato fechou a conexão privada",start_private:"Iniciar conversa privada",close_private:"Fechar conversa privada",your_buddy_is_verificated:"Seu contato está verificado",you_have_only_a_subscription_in_one_way:"Você só tem a inscrição one-way",authentication_query_sent:"Pergunta de autenticação enviada",your_message_wasnt_send_please_end_your_private_conversation:"Sua mensagem não foi enviada. Por favor finalize sua conversa privada",unencrypted_message_received:"Mensagem não encriptada recebida",your_message_wasnt_send_because_you_have_no_valid_subscription:"Sua mensagem não foi enviada porque sua inscrição não é válida",not_available:"Indisponível",no_connection:"Sem conexão!",relogin:"reentrar",trying_to_start_private_conversation:"Tentando iniciar conversa privada",Verified:"Verificado",Unverified:"Não verificado",private_conversation_started:"Conversa privada iniciada.",private_conversation_aborted:"Conversa privada abortada!",your_buddy_closed_the_private_conversation_you_should_do_the_same:"Seu contato encerrou a conversa privada! Você deveria fazer o mesmo.",conversation_is_now_verified:"Conversa verificada.",authentication_failed:"Autenticação falhou.",your_buddy_is_attempting_to_determine_:"Seu contato está tentando determinar se ele realmente está falando contigo.",to_authenticate_to_your_buddy:"Para autenticar seu contato, ",enter_the_answer_and_click_answer:"entre com a resposta e clique em Responder.",enter_the_secret:"escreva a senha.",Creating_your_private_key_:"Criando sua chave privada: isso pode demorar um pouco.",Authenticating_a_buddy_helps_:"Autenticar seu contato ajuda a garantir que a pessoa com a qual você está falando é realmente a pessoa que ela alega ser.",How_do_you_want_to_authenticate_your_buddy:"Como você gostaria de se autenticar {{bid_name}} (<b>{{bid_jid}}</b>)?",Select_method:"Selecione o método...",Manual:"Manual",Question:"Pergunta",Secret:"Senha",To_verify_the_fingerprint_:"Para verificar o fingerprint, entre em contato com seu contato usando outro meio, de preferência seguro, como o telefone.",Your_fingerprint:"Seu fingerprint",Buddy_fingerprint:"Fingerprint do contato",Close:"Fechar",Compared:"Comparado",To_authenticate_using_a_question_:"Para autenticar seu contato faça uma pergunta, mas escolha que só ele saiba a resposta.",Ask:"Pergunta",To_authenticate_pick_a_secret_:"Para autenticar, escolha um segredo que somente você e seu contato saibam.",Compare:"Compare",Fingerprints:"Fingerprints",Authentication:"Autenticação",Message:"Mensagem",Add_buddy:"Adicionar contato",rename_buddy:"renomear contato",delete_buddy:"remover contato",Login:"Entrar",Username:"Usuário",Password:"Senha",Cancel:"Cancelar",Connect:"Conectar",Type_in_the_full_username_:"Digite seu nome completo e um apelido opcional.",Alias:"Apelido",Add:"Adicionar",Subscription_request:"Pedido de inscrição",You_have_a_request_from:"Você tem um pedido de",Deny:"Negar",Approve:"Aprovar",Remove_buddy:"Remover contato",You_are_about_to_remove_:"Você está prestes a remover {{bid_name}} (<b>{{bid_jid}}</b>) de sua lista de contatos. Todas as conversas serão fechadas.",Continue_without_chat:"Continue sem converar",Please_wait:"Por favor aguarde",Login_failed:"Autenticação da conversa falhou",Sorry_we_cant_authentikate_:"A autenticação com o servidor falhou. Talvez seja a senha errada?",Retry:"Voltar",clear_history:"Limpar histórico",New_message_from:"Nova mensagem de",Should_we_notify_you_:"Devemos continuar notificando sobre novas mensagens no futuro?",Please_accept_:'Por favor clique no botão "Permitir" na parte superior.',Hide_offline:"Esconder contatos desconectados",Show_offline:"Mostrar contatos desconectados",About:"Sobre",dnd:"Não perturbe",Mute:"Mudo",Unmute:"Ligar",Subscription:"Inscrição",both:"ambos",Status:"Status",online:"online",chat:"conversa",away:"ausente",xa:"ausente por mais tempo",offline:"desativado",none:"nenhum",Unknown_instance_tag:"Marcação desconhecida da instância",Not_one_of_our_latest_keys:"Nenhuma de nossas ultimas chaves.",Received_an_unreadable_encrypted_message:"Mensagem encriptada ilegível foi recebida.",Online:"Online",Chatty:"Tagarela",Away:"Ausente",Extended_away:"Ausente por mais tempo",Offline:"Desativado",Friendship_request:"Pedido de amizade",Confirm:"Confirmar",Dismiss:"Ignorar",Remove:"Remover",Online_help:"Ajuda online",FN:"Nome completo",N:" ",FAMILY:"Sobrenome",GIVEN:"Nome",NICKNAME:"Apelido",URL:"URL",ADR:"Endereço",STREET:"Rua, Av, etc",EXTADD:"Complemento",LOCALITY:"Localidade",REGION:"Região",PCODE:"CEP",CTRY:"País",TEL:"Telefone",NUMBER:"Número",EMAIL:"Email",USERID:" ",ORG:"Empresa",ORGNAME:"Nome",ORGUNIT:"Unidade",TITLE:"Cargo",ROLE:"Rol",BDAY:"Data de nascimento",DESC:"Descrição",PHOTO:" ",send_message:"Enviar mensagem",get_info:"Exibir informações",Settings:"Configurações",Priority:"Prioridade",Save:"Salvar",User_settings:"Configurações do usuário",A_fingerprint_:"O fingerprint é usado para certificar que a pessoa com a qual se está falando é que ela diz ser.",Your_roster_is_empty_add_a:"Sua lista está vazia, adicione um ",new_buddy:"novo contato",is:"é",Login_options:"Opções de login",BOSH_url:"BOSH URL",Domain:"Domínio",Resource:"Recurso",On_login:"Ao autenticar",Received_an_unencrypted_message:"Mensagem não encriptada recebida",Sorry_your_buddy_doesnt_provide_any_information:"Desculpe, seu contato não forneceu nenhuma informação",Info_about:"Informações sobre",Authentication_aborted:"Autenticação encerrada.",Authentication_request_received:"Pedido de autenticação recebido",Do_you_want_to_display_them:"Você quer mostrá-los?",Log_in_without_chat:"Entrar sem conversar",has_come_online:"ficou online",Unknown_sender:"Emissor desconhecido",You_received_a_message_from_an_unknown_sender:"Você recebeu uma mensagem de um emissor desconhecido",Please_allow_access_to_microphone_and_camera:'Por favor clique no botão "Permitir" no topo, para conceder acesso ao seu microfone e câmera.',Incoming_call:"Recebendo chamada",from:"de",Do_you_want_to_accept_the_call_from:"Você aceita a chamada de",Reject:"Negar",Accept:"Aceitar",hang_up:"desligar",snapshot:"registrar imagem",mute_my_audio:"mudo",pause_my_video:"pausar vídeo",fullscreen:"tela cheia",Info:"Informações",Local_IP:"IP local",Remote_IP:"IP remoto",Local_Fingerprint:"Fingerprint local",Remote_Fingerprint:"Fingerprint remoto",Video_call_not_possible:"Chamada de vídeo impossível. Seu contato não suporta chamadas desse tipo.",Start_video_call:"Iniciar chamada de vídeo"}}};
72
+
@@ -0,0 +1,270 @@
1
+ /**
2
+ * Entity Capabilities (XEP-0115)
3
+ *
4
+ * Depends on disco plugin.
5
+ *
6
+ * See: http://xmpp.org/extensions/xep-0115.html
7
+ *
8
+ * Authors: - Michael Weibel <michael.weibel@gmail.com> - Klaus Herberth <klaus@jsxc.org>
9
+ * Copyright: - Michael Weibel <michael.weibel@gmail.com>
10
+ *
11
+ * @license MIT
12
+ */
13
+
14
+ (function($) {
15
+ Strophe.addConnectionPlugin('caps', {
16
+ /**
17
+ * Constant: HASH Hash used
18
+ *
19
+ * Currently only sha-1 is supported.
20
+ */
21
+ HASH: 'sha-1',
22
+ /**
23
+ * Variable: node Client which is being used.
24
+ *
25
+ * Can be overwritten as soon as Strophe has been initialized.
26
+ */
27
+ node: 'http://strophe.im/strophejs/',
28
+ /**
29
+ * PrivateVariable: _ver Own generated version string
30
+ */
31
+ _ver: '',
32
+ /**
33
+ * PrivateVariable: _connection Strophe connection
34
+ */
35
+ _connection: null,
36
+ /**
37
+ * PrivateVariable: _knownCapabilities A hashtable containing
38
+ * version-strings and their capabilities, serialized as string.
39
+ *
40
+ * TODO: Maybe those caps shouldn't be serialized.
41
+ */
42
+ _knownCapabilities: JSON.parse(localStorage.getItem('strophe.caps._knownCapabilities')) || {},
43
+
44
+ /**
45
+ * PrivateVariable: _jidVerIndex A hashtable containing jids and their
46
+ * versions for better lookup of capabilities.
47
+ */
48
+ _jidVerIndex: JSON.parse(localStorage.getItem('strophe.caps._jidVerIndex')) || {},
49
+
50
+ /**
51
+ * Function: init Initialize plugin: - Add caps namespace - Add caps
52
+ * feature to disco plugin - Add handler for caps stanzas
53
+ *
54
+ * Parameters: (Strophe.Connection) conn - Strophe connection
55
+ */
56
+ init: function(conn) {
57
+ this._connection = conn;
58
+
59
+ Strophe.addNamespace('CAPS', 'http://jabber.org/protocol/caps');
60
+
61
+ if (!this._connection.disco) {
62
+ throw "Caps plugin requires the disco plugin to be installed.";
63
+ }
64
+
65
+ this._connection.disco.addFeature(Strophe.NS.CAPS);
66
+ this._connection.addHandler(this._delegateCapabilities.bind(this), Strophe.NS.CAPS);
67
+ },
68
+
69
+ /**
70
+ * Function: generateCapsAttrs Returns the attributes for generating the
71
+ * "c"-stanza containing the own version
72
+ *
73
+ * Returns: (Object) - attributes
74
+ */
75
+ generateCapsAttrs: function() {
76
+ return {
77
+ 'xmlns': Strophe.NS.CAPS,
78
+ 'hash': this.HASH,
79
+ 'node': this.node,
80
+ 'ver': this.generateVer()
81
+ };
82
+ },
83
+
84
+ /**
85
+ * Function: generateVer Returns the base64 encoded version string
86
+ * (encoded itself with sha1)
87
+ *
88
+ * Returns: (String) - version
89
+ */
90
+ generateVer: function() {
91
+ if (this._ver !== "") {
92
+ return this._ver;
93
+ }
94
+
95
+ var ver = "", identities = this._connection.disco._identities.sort(this._sortIdentities), identitiesLen = identities.length, features = this._connection.disco._features.sort(), featuresLen = features.length;
96
+ for (var i = 0; i < identitiesLen; i++) {
97
+ var curIdent = identities[i];
98
+ ver += curIdent.category + "/" + curIdent.type + "/" + curIdent.lang + "/" + curIdent.name + "<";
99
+ }
100
+ for (var i = 0; i < featuresLen; i++) {
101
+ ver += features[i] + '<';
102
+ }
103
+
104
+ this._ver = b64_sha1(ver);
105
+ return this._ver;
106
+ },
107
+
108
+ /**
109
+ * Function: getCapabilitiesByJid Returns serialized capabilities of a jid
110
+ * (if available). Otherwise null.
111
+ *
112
+ * Parameters: (String) jid - Jabber id
113
+ *
114
+ * Returns: (String|null) - capabilities, serialized; or null when not
115
+ * available.
116
+ */
117
+ getCapabilitiesByJid: function(jid) {
118
+ if (this._jidVerIndex[jid]) {
119
+ return this._knownCapabilities[this._jidVerIndex[jid]];
120
+ }
121
+ return null;
122
+ },
123
+ hasFeatureByJid: function(jid, feature) {
124
+ if (this._jidVerIndex[jid] && feature !== null && typeof feature !== 'undefined') {
125
+ if(!$.isArray(feature)){
126
+ feature = $.makeArray(feature);
127
+ };
128
+
129
+ var i;
130
+ for (i = 0; i < feature.length; i++) {
131
+ if (this._knownCapabilities[this._jidVerIndex[jid]]['features'].indexOf(feature[i]) < 0)
132
+ return false;
133
+ }
134
+ return true;
135
+ }
136
+ return false;
137
+ },
138
+
139
+ /**
140
+ * PrivateFunction: _delegateCapabilities Checks if the version has
141
+ * already been saved. If yes: do nothing. If no: Request capabilities
142
+ *
143
+ * Parameters: (Strophe.Builder) stanza - Stanza
144
+ *
145
+ * Returns: (Boolean)
146
+ */
147
+ _delegateCapabilities: function(stanza) {
148
+ var from = stanza.getAttribute('from'), c = stanza.querySelector('c'), ver = c.getAttribute('ver'), node = c.getAttribute('node');
149
+ if (!this._knownCapabilities[ver]) {
150
+ return this._requestCapabilities(from, node, ver);
151
+ } else {
152
+ this._jidVerIndex[from] = ver;
153
+ }
154
+ if (!this._jidVerIndex[from] || !this._jidVerIndex[from] !== ver) {
155
+ this._jidVerIndex[from] = ver;
156
+ }
157
+
158
+ localStorage.setItem('strophe.caps._jidVerIndex', JSON.stringify(this._jidVerIndex));
159
+ $(document).trigger('caps.strophe', [ from ]);
160
+
161
+ return true;
162
+ },
163
+
164
+ /**
165
+ * PrivateFunction: _requestCapabilities Requests capabilities from the
166
+ * one which sent the caps-info stanza. This is done using disco info.
167
+ *
168
+ * Additionally, it registers a handler for handling the reply.
169
+ *
170
+ * Parameters: (String) to - Destination jid (String) node - Node
171
+ * attribute of the caps-stanza (String) ver - Version of the caps-stanza
172
+ *
173
+ * Returns: (Boolean) - true
174
+ */
175
+ _requestCapabilities: function(to, node, ver) {
176
+ if (to !== this._connection.jid) {
177
+ var id = this._connection.disco.info(to, node + '#' + ver);
178
+ this._connection.addHandler(this._handleDiscoInfoReply.bind(this), Strophe.NS.DISCO_INFO, 'iq', 'result', id, to);
179
+ }
180
+ return true;
181
+ },
182
+
183
+ /**
184
+ * PrivateFunction: _handleDiscoInfoReply Parses the disco info reply and
185
+ * adds the version & it's capabilities to the _knownCapabilities
186
+ * variable. Additionally, it adds the jid & the version to the
187
+ * _jidVerIndex variable for a better lookup.
188
+ *
189
+ * Parameters: (Strophe.Builder) stanza - Disco info stanza
190
+ *
191
+ * Returns: (Boolean) - false, to automatically remove the handler.
192
+ */
193
+ _handleDiscoInfoReply: function(stanza) {
194
+ var query = stanza.querySelector('query');
195
+ var from = stanza.getAttribute('from');
196
+ var node = query.getAttribute('node');
197
+ var ver = (node)? node.split('#')[1] : this._jidVerIndex[from]; //fix open prosody issue
198
+
199
+ if (!this._knownCapabilities[ver]) {
200
+ var childNodes = query.childNodes, childNodesLen = childNodes.length;
201
+ this._knownCapabilities[ver] = {
202
+ features: [],
203
+ identities: []
204
+ };
205
+
206
+ for (var i = 0; i < childNodesLen; i++) {
207
+ var node = childNodes[i];
208
+ if (node.nodeName == 'feature') {
209
+ this._knownCapabilities[ver]['features'].push(node.getAttribute('var'));
210
+ } else if (node.nodeName == 'identity') {
211
+ this._knownCapabilities[ver]['identities'].push(this._attributesToJsObject(node.attributes));
212
+ } else {
213
+ if (typeof this._knownCapabilities[ver][node.nodeName] === 'undefined')
214
+ this._knownCapabilities[ver][node.nodeName] = [];
215
+ this._knownCapabilities[ver][node.nodeName].push(this._attributesToJsObject(node.attributes));
216
+ }
217
+
218
+ }
219
+ this._jidVerIndex[from] = ver;
220
+ } else if (!this._jidVerIndex[from] || !this._jidVerIndex[from] !== ver) {
221
+ this._jidVerIndex[from] = ver;
222
+ }
223
+
224
+ localStorage.setItem('strophe.caps._jidVerIndex', JSON.stringify(this._jidVerIndex));
225
+ localStorage.setItem('strophe.caps._knownCapabilities', JSON.stringify(this._knownCapabilities));
226
+ $(document).trigger('caps.strophe', [ from ]);
227
+
228
+ return false;
229
+ },
230
+
231
+ _attributesToJsObject: function(attr) {
232
+ var obj = {};
233
+
234
+ for (i = 0; i < attr.length; i++)
235
+ obj[attr[i].name] = attr[i].value;
236
+
237
+ return obj;
238
+ },
239
+
240
+ /**
241
+ * PrivateFunction: _sortIdentities Sorts two identities according the
242
+ * sorting requirements in XEP-0115.
243
+ *
244
+ * Parameters: (Object) a - Identity a (Object) b - Identity b
245
+ *
246
+ * Returns: (Integer) - 1, 0 or -1; according to which one's greater.
247
+ */
248
+ _sortIdentities: function(a, b) {
249
+ if (a.category > b.category) {
250
+ return 1;
251
+ }
252
+ if (a.category < b.category) {
253
+ return -1;
254
+ }
255
+ if (a.type > b.type) {
256
+ return 1;
257
+ }
258
+ if (a.type < b.type) {
259
+ return -1;
260
+ }
261
+ if (a.lang > b.lang) {
262
+ return 1;
263
+ }
264
+ if (a.lang < b.lang) {
265
+ return -1;
266
+ }
267
+ return 0;
268
+ }
269
+ });
270
+ }(jQuery));
@@ -0,0 +1,232 @@
1
+ /*
2
+ Copyright 2010, François de Metz <francois@2metz.fr>
3
+ */
4
+
5
+ /**
6
+ * Disco Strophe Plugin
7
+ * Implement http://xmpp.org/extensions/xep-0030.html
8
+ * TODO: manage node hierarchies, and node on info request
9
+ */
10
+ Strophe.addConnectionPlugin('disco',
11
+ {
12
+ _connection: null,
13
+ _identities : [],
14
+ _features : [],
15
+ _items : [],
16
+ /** Function: init
17
+ * Plugin init
18
+ *
19
+ * Parameters:
20
+ * (Strophe.Connection) conn - Strophe connection
21
+ */
22
+ init: function(conn)
23
+ {
24
+ this._connection = conn;
25
+ this._identities = [];
26
+ this._features = [];
27
+ this._items = [];
28
+ // disco info
29
+ conn.addHandler(this._onDiscoInfo.bind(this), Strophe.NS.DISCO_INFO, 'iq', 'get', null, null);
30
+ // disco items
31
+ conn.addHandler(this._onDiscoItems.bind(this), Strophe.NS.DISCO_ITEMS, 'iq', 'get', null, null);
32
+ },
33
+ /** Function: addIdentity
34
+ * See http://xmpp.org/registrar/disco-categories.html
35
+ * Parameters:
36
+ * (String) category - category of identity (like client, automation, etc ...)
37
+ * (String) type - type of identity (like pc, web, bot , etc ...)
38
+ * (String) name - name of identity in natural language
39
+ * (String) lang - lang of name parameter
40
+ *
41
+ * Returns:
42
+ * Boolean
43
+ */
44
+ addIdentity: function(category, type, name, lang)
45
+ {
46
+ for (var i=0; i<this._identities.length; i++)
47
+ {
48
+ if (this._identities[i].category == category &&
49
+ this._identities[i].type == type &&
50
+ this._identities[i].name == name &&
51
+ this._identities[i].lang == lang)
52
+ {
53
+ return false;
54
+ }
55
+ }
56
+ this._identities.push({category: category, type: type, name: name, lang: lang});
57
+ return true;
58
+ },
59
+ /** Function: addFeature
60
+ *
61
+ * Parameters:
62
+ * (String) var_name - feature name (like jabber:iq:version)
63
+ *
64
+ * Returns:
65
+ * boolean
66
+ */
67
+ addFeature: function(var_name)
68
+ {
69
+ for (var i=0; i<this._features.length; i++)
70
+ {
71
+ if (this._features[i] == var_name)
72
+ return false;
73
+ }
74
+ this._features.push(var_name);
75
+ return true;
76
+ },
77
+ /** Function: removeFeature
78
+ *
79
+ * Parameters:
80
+ * (String) var_name - feature name (like jabber:iq:version)
81
+ *
82
+ * Returns:
83
+ * boolean
84
+ */
85
+ removeFeature: function(var_name)
86
+ {
87
+ for (var i=0; i<this._features.length; i++)
88
+ {
89
+ if (this._features[i] === var_name){
90
+ this._features.splice(i,1)
91
+ return true;
92
+ }
93
+ }
94
+ return false;
95
+ },
96
+ /** Function: addItem
97
+ *
98
+ * Parameters:
99
+ * (String) jid
100
+ * (String) name
101
+ * (String) node
102
+ * (Function) call_back
103
+ *
104
+ * Returns:
105
+ * boolean
106
+ */
107
+ addItem: function(jid, name, node, call_back)
108
+ {
109
+ if (node && !call_back)
110
+ return false;
111
+ this._items.push({jid: jid, name: name, node: node, call_back: call_back});
112
+ return true;
113
+ },
114
+ /** Function: info
115
+ * Info query
116
+ *
117
+ * Parameters:
118
+ * (Function) call_back
119
+ * (String) jid
120
+ * (String) node
121
+ */
122
+ info: function(jid, node, success, error, timeout)
123
+ {
124
+ var attrs = {xmlns: Strophe.NS.DISCO_INFO};
125
+ if (node)
126
+ attrs.node = node;
127
+
128
+ var info = $iq({from:this._connection.jid,
129
+ to:jid, type:'get'}).c('query', attrs);
130
+ this._connection.sendIQ(info, success, error, timeout);
131
+ },
132
+ /** Function: items
133
+ * Items query
134
+ *
135
+ * Parameters:
136
+ * (Function) call_back
137
+ * (String) jid
138
+ * (String) node
139
+ */
140
+ items: function(jid, node, success, error, timeout)
141
+ {
142
+ var attrs = {xmlns: Strophe.NS.DISCO_ITEMS};
143
+ if (node)
144
+ attrs.node = node;
145
+
146
+ var items = $iq({from:this._connection.jid,
147
+ to:jid, type:'get'}).c('query', attrs);
148
+ this._connection.sendIQ(items, success, error, timeout);
149
+ },
150
+
151
+ /** PrivateFunction: _buildIQResult
152
+ */
153
+ _buildIQResult: function(stanza, query_attrs)
154
+ {
155
+ var id = stanza.getAttribute('id');
156
+ var from = stanza.getAttribute('from');
157
+ var iqresult = $iq({type: 'result', id: id});
158
+
159
+ if (from !== null) {
160
+ iqresult.attrs({to: from});
161
+ }
162
+
163
+ return iqresult.c('query', query_attrs);
164
+ },
165
+
166
+ /** PrivateFunction: _onDiscoInfo
167
+ * Called when receive info request
168
+ */
169
+ _onDiscoInfo: function(stanza)
170
+ {
171
+ var node = stanza.getElementsByTagName('query')[0].getAttribute('node');
172
+ var attrs = {xmlns: Strophe.NS.DISCO_INFO};
173
+ if (node)
174
+ {
175
+ attrs.node = node;
176
+ }
177
+ var iqresult = this._buildIQResult(stanza, attrs);
178
+ for (var i=0; i<this._identities.length; i++)
179
+ {
180
+ var attrs = {category: this._identities[i].category,
181
+ type : this._identities[i].type};
182
+ if (this._identities[i].name)
183
+ attrs.name = this._identities[i].name;
184
+ if (this._identities[i].lang)
185
+ attrs['xml:lang'] = this._identities[i].lang;
186
+ iqresult.c('identity', attrs).up();
187
+ }
188
+ for (var i=0; i<this._features.length; i++)
189
+ {
190
+ iqresult.c('feature', {'var':this._features[i]}).up();
191
+ }
192
+ this._connection.send(iqresult.tree());
193
+ return true;
194
+ },
195
+ /** PrivateFunction: _onDiscoItems
196
+ * Called when receive items request
197
+ */
198
+ _onDiscoItems: function(stanza)
199
+ {
200
+ var query_attrs = {xmlns: Strophe.NS.DISCO_ITEMS};
201
+ var node = stanza.getElementsByTagName('query')[0].getAttribute('node');
202
+ if (node)
203
+ {
204
+ query_attrs.node = node;
205
+ var items = [];
206
+ for (var i = 0; i < this._items.length; i++)
207
+ {
208
+ if (this._items[i].node == node)
209
+ {
210
+ items = this._items[i].call_back(stanza);
211
+ break;
212
+ }
213
+ }
214
+ }
215
+ else
216
+ {
217
+ var items = this._items;
218
+ }
219
+ var iqresult = this._buildIQResult(stanza, query_attrs);
220
+ for (var i = 0; i < items.length; i++)
221
+ {
222
+ var attrs = {jid: items[i].jid};
223
+ if (items[i].name)
224
+ attrs.name = items[i].name;
225
+ if (items[i].node)
226
+ attrs.node = items[i].node;
227
+ iqresult.c('item', attrs).up();
228
+ }
229
+ this._connection.send(iqresult.tree());
230
+ return true;
231
+ }
232
+ });