path
stringlengths
5
304
repo_name
stringlengths
6
79
content
stringlengths
27
1.05M
app/javascript/flavours/glitch/containers/account_container.js
glitch-soc/mastodon
import React from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { makeGetAccount } from 'flavours/glitch/selectors'; import Account from 'flavours/glitch/components/account'; import { followAccount, unfollowAccount, blockAccount, unblockAccount, muteAccount, unmuteAccount, } from 'flavours/glitch/actions/accounts'; import { openModal } from 'flavours/glitch/actions/modal'; import { initMuteModal } from 'flavours/glitch/actions/mutes'; import { unfollowModal } from 'flavours/glitch/util/initial_state'; const messages = defineMessages({ unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' }, }); const makeMapStateToProps = () => { const getAccount = makeGetAccount(); const mapStateToProps = (state, props) => ({ account: getAccount(state, props.id), }); return mapStateToProps; }; const mapDispatchToProps = (dispatch, { intl }) => ({ onFollow (account) { if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) { if (unfollowModal) { dispatch(openModal('CONFIRM', { message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />, confirm: intl.formatMessage(messages.unfollowConfirm), onConfirm: () => dispatch(unfollowAccount(account.get('id'))), })); } else { dispatch(unfollowAccount(account.get('id'))); } } else { dispatch(followAccount(account.get('id'))); } }, onBlock (account) { if (account.getIn(['relationship', 'blocking'])) { dispatch(unblockAccount(account.get('id'))); } else { dispatch(blockAccount(account.get('id'))); } }, onMute (account) { if (account.getIn(['relationship', 'muting'])) { dispatch(unmuteAccount(account.get('id'))); } else { dispatch(initMuteModal(account)); } }, onMuteNotifications (account, notifications) { dispatch(muteAccount(account.get('id'), notifications)); }, }); export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Account));
public/js/jquery.min.js
inobrega/zf2_livraria
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license //@ sourceMappingURL=jquery-1.10.2.min.map */ (function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t }({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle); u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
app/components/stations/StationValuesGrid.js
sheldhur/Vector
import { remote } from 'electron'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; import ReactDOM from 'react-dom'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { Icon, Popconfirm } from 'antd'; import moment from 'moment'; import resourcePath from '../../lib/resourcePath'; import Grid from '../grid/Grid'; import * as uiActions from '../../actions/ui'; import * as stationActions from '../../actions/station'; import * as app from '../../constants/app'; const { Menu } = remote; class StationGrid extends Component { state = { availableHeight: 'auto', pageSize: 5, pageCurrent: null, }; componentDidMount = () => { window.addEventListener('resize', this.handlerResize); }; componentWillReceiveProps = (nextProps) => { if (!nextProps.isLoading) { if (this.state.availableHeight === 'auto') { setTimeout(() => { this.setPagination(nextProps); }, 300); } else { this.setState({ pageCurrent: this.calcPageCurrent(nextProps, this.state.pageSize) }); } } }; componentWillUnmount = () => { window.removeEventListener('resize', this.handlerResize); this.props.uiActions.setGridSelectedRows(null); }; handlerResize = () => { const { pageSize, availableHeight } = this.calcPageSize(); this.setState({ availableHeight, pageSize, }); }; setPagination = (props) => { const { availableHeight, pageSize } = this.calcPageSize(); const pageCurrent = this.calcPageCurrent(props, pageSize); this.setState({ availableHeight, pageSize, pageCurrent, }); }; calcPageCurrent = (props, pageSize) => { const { values, currentTime } = props; const data = values ? Object.values(values) : []; const currentTimeStr = moment(currentTime).format(app.FORMAT_DATE_SQL); let currentPage = 0; for (let i = 0; i < data.length; i++) { if (data[i].time === currentTimeStr) { currentPage = Math.floor(i / pageSize) + 1; break; } } return currentPage; }; calcPageSize = () => { const grid = ReactDOM.findDOMNode(this.refs.grid); const pagination = grid.querySelector('.ant-pagination'); const theadHeight = grid.querySelector('thead').clientHeight || 0; const paginationHeight = pagination ? pagination.clientHeight : 0; const row = grid.querySelector('tbody > tr'); const rowHeight = row ? row.offsetHeight : 28; const availableHeight = window.innerHeight - grid.getBoundingClientRect().top; const pageSize = Math.floor((availableHeight - theadHeight - (paginationHeight + 16 * 2)) / rowHeight); return { availableHeight, pageSize }; }; handlerPageChange = (page) => { this.setState({ pageCurrent: page }); }; handlerCellChange = (field, id, value, afterAction) => { if (['compX', 'compY', 'compZ'].indexOf(field) !== -1 && value.trim() === '') { value = null; } this.props.stationActions.updateStationValue(id, { [field]: value }, afterAction); }; handlerRowOnContextMenu = (record, index, e) => { if (!e.ctrlKey) { e.preventDefault(); return Menu.buildFromTemplate([ { label: 'Clear values', icon: resourcePath('./assets/icons/eraser.png'), click: () => this.props.stationActions.updateStationValue(record.id, { compX: null, compY: null, compZ: null }) }, { label: 'Delete values', icon: resourcePath('./assets/icons/table-delete-row.png'), click: () => this.props.stationActions.deleteStationValue({ id: record.id }) } ]).popup(remote.getCurrentWindow()); } }; render = () => { const compWidth = 165; const columns = [{ title: 'Time', dataIndex: 'time', hasFilter: true, hasSorter: true, onCell: (record) => ({ onClick: () => this.props.uiActions.setChartCurrentTime(new Date(record.time)) }), }, { title: 'X', dataIndex: 'compX', hasFilter: true, hasSorter: true, render: (text, record, index) => (<Grid.InputCell value={text} onChange={ (value, afterAction) => this.handlerCellChange('compX', record.id, value, afterAction) } />), width: compWidth }, { title: 'Y', dataIndex: 'compY', hasFilter: true, hasSorter: true, render: (text, record, index) => (<Grid.InputCell value={text} onChange={ (value, afterAction) => this.handlerCellChange('compY', record.id, value, afterAction) } />), width: compWidth }, { title: 'Z', dataIndex: 'compZ', hasFilter: true, hasSorter: true, render: (text, record, index) => (<Grid.InputCell value={text} onChange={ (value, afterAction) => this.handlerCellChange('compZ', record.id, value, afterAction) } />), width: compWidth }, { title: '', dataIndex: 'format', hasFilter: true, hasSorter: true, render: (text, record, index) => app.VALUES_CONVERT_FORMAT[text], width: 80 }]; const { values, isLoading, currentTime } = this.props; const currentTimeStr = moment(currentTime).format(app.FORMAT_DATE_SQL); const data = values ? Object.values(values) : []; const rowSelection = { onChange: (selectedRowKeys, selectedRows) => { this.props.uiActions.setGridSelectedRows(selectedRows); }, selections: true }; return ( <div style={{ height: this.state.availableHeight }}> <Grid rowClassName={(record) => (record.time === currentTimeStr ? 'select-row' : '')} ref="grid" rowKey="id" columns={columns} data={data} loading={isLoading} rowSelection={rowSelection} pagination={{ pageSize: this.state.pageSize, showQuickJumper: true, current: this.state.pageCurrent, onChange: this.handlerPageChange }} size="x-small" bordered onRow={(record, index) => ({ onContextMenu: (event) => this.handlerRowOnContextMenu(record, index, event) })} /> </div> ); }; } StationGrid.propTypes = { width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), }; StationGrid.defaultProps = { width: '100%', height: '100%', }; function mapStateToProps(state) { return { values: state.station.stationView.values, isLoading: state.station.stationView.isLoading, currentTime: state.ui.chartCurrentTime, }; } function mapDispatchToProps(dispatch) { return { uiActions: bindActionCreators(uiActions, dispatch), stationActions: bindActionCreators(stationActions, dispatch) }; } export default connect(mapStateToProps, mapDispatchToProps)(StationGrid);
third_party/prometheus_ui/base/web/ui/node_modules/reactstrap/src/CardBody.js
GoogleCloudPlatform/prometheus-engine
import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { mapToCssModules, tagPropType } from './utils'; const propTypes = { tag: tagPropType, className: PropTypes.string, cssModule: PropTypes.object, innerRef: PropTypes.oneOfType([ PropTypes.object, PropTypes.string, PropTypes.func, ]), }; const defaultProps = { tag: 'div' }; const CardBody = (props) => { const { className, cssModule, innerRef, tag: Tag, ...attributes } = props; const classes = mapToCssModules(classNames( className, 'card-body' ), cssModule); return ( <Tag {...attributes} className={classes} ref={innerRef} /> ); }; CardBody.propTypes = propTypes; CardBody.defaultProps = defaultProps; export default CardBody;
app/components/calendar/Calendar.js
phoenixmusical/web-client
import React, { Component } from 'react'; import Relay from 'react-relay'; import IconButton from 'material-ui/IconButton'; import CalendarDay from './CalendarDay'; export default class Calendar extends Component { render () { const { events, startDate, onNextWeek, onPreviousWeek } = this.props; const dates = []; const daysMap = {}; for (let i = 0; i < 7; i++) { const date = new Date(startDate.getTime()); date.setDate(date.getDate() + i); dates.push(date); daysMap[i] = []; } events.forEach(event => { const date = new Date(Date.parse(event.startDate)); daysMap[date.getDay()].push(event); }); return ( <div> <div style={{ textAlign: 'center' }}> <IconButton iconClassName="mdi mdi-arrow-left-bold" onClick={onPreviousWeek} /> <IconButton iconClassName="mdi mdi-arrow-right-bold" onClick={onNextWeek} /> </div> {dates.map(date => ( <CalendarDay key={date.getDay()} date={date} events={daysMap[date.getDay()] || []} /> ))} </div> ); } }
packages/material-ui-icons/src/SimCard.js
cherniavskii/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <g><path d="M19.99 4c0-1.1-.89-2-1.99-2h-8L4 8v12c0 1.1.9 2 2 2h12.01c1.1 0 1.99-.9 1.99-2l-.01-16zM9 19H7v-2h2v2zm8 0h-2v-2h2v2zm-8-4H7v-4h2v4zm4 4h-2v-4h2v4zm0-6h-2v-2h2v2zm4 2h-2v-4h2v4z" /></g> , 'SimCard');
admin/client/views/list.js
riyadhalnur/keystone
'use strict'; import React from 'react'; import ReactDOM from 'react-dom'; import classnames from 'classnames'; import CurrentListStore from '../stores/CurrentListStore'; import Columns from '../columns'; import ConfirmationDialog from '../components/ConfirmationDialog'; import CreateForm from '../components/CreateForm'; import FlashMessages from '../components/FlashMessages'; import Footer from '../components/Footer'; import ItemsTable from '../components/ItemsTable'; import ListColumnsForm from '../components/ListColumnsForm'; import ListControl from '../components/ListControl'; import ListDownloadForm from '../components/ListDownloadForm'; import ListFilters from '../components/ListFilters'; import ListFiltersAdd from '../components/ListFiltersAdd'; import ListSort from '../components/ListSort'; import MobileNavigation from '../components/MobileNavigation'; import PrimaryNavigation from '../components/PrimaryNavigation'; import SecondaryNavigation from '../components/SecondaryNavigation'; import UpdateForm from '../components/UpdateForm'; import { BlankState, Button, Container, FormInput, InputGroup, Pagination, Spinner } from 'elemental'; import { plural } from '../utils'; const TABLE_CONTROL_COLUMN_WIDTH = 26; // icon + padding const ListView = React.createClass({ getInitialState () { return { confirmationDialog: { isOpen: false, }, checkedItems: {}, constrainTableWidth: true, manageMode: false, searchString: '', showCreateForm: window.location.search === '?create' || Keystone.createFormErrors, showUpdateForm: false, ...this.getStateFromStore(), }; }, componentDidMount () { CurrentListStore.addChangeListener(this.updateStateFromStore); }, componentWillUnmount () { CurrentListStore.removeChangeListener(this.updateStateFromStore); }, updateStateFromStore () { this.setState(this.getStateFromStore()); }, getStateFromStore () { var state = { columns: CurrentListStore.getActiveColumns(), currentPage: CurrentListStore.getCurrentPage(), filters: CurrentListStore.getActiveFilters(), items: CurrentListStore.getItems(), list: CurrentListStore.getList(), loading: CurrentListStore.isLoading(), pageSize: CurrentListStore.getPageSize(), ready: CurrentListStore.isReady(), search: CurrentListStore.getActiveSearch(), rowAlert: CurrentListStore.rowAlert(), }; if (!this._searchTimeout) { state.searchString = state.search; } state.showBlankState = (state.ready && !state.loading && !state.items.results.length && !state.search && !state.filters.length); return state; }, // ============================== // HEADER // ============================== updateSearch (e) { clearTimeout(this._searchTimeout); this.setState({ searchString: e.target.value, }); var delay = e.target.value.length > 1 ? 150 : 0; this._searchTimeout = setTimeout(() => { delete this._searchTimeout; CurrentListStore.setActiveSearch(this.state.searchString); }, delay); }, handleSearchClear () { CurrentListStore.setActiveSearch(''); this.setState({ searchString: '' }); ReactDOM.findDOMNode(this.refs.listSearchInput).focus(); }, handleSearchKey (e) { // clear on esc if (e.which === 27) { this.handleSearchClear(); } }, handlePageSelect (i) { CurrentListStore.setCurrentPage(i); }, toggleManageMode (filter = !this.state.manageMode) { this.setState({ manageMode: filter, checkedItems: {}, }); }, toggleUpdateModal (filter = !this.state.showUpdateForm) { this.setState({ showUpdateForm: filter, }); }, massUpdate () { // TODO: Implement update multi-item console.log('Update ALL the things!'); }, massDelete () { let { checkedItems, list } = this.state; let itemCount = plural(checkedItems, ('* ' + list.singular.toLowerCase()), ('* ' + list.plural.toLowerCase())); let itemIds = Object.keys(checkedItems); this.setState({ confirmationDialog: { isOpen: true, label: 'Delete', body: `Are you sure you want to delete ${itemCount}?<br /><br />This cannot be undone.`, onConfirmation: () => { CurrentListStore.deleteItems(itemIds); this.toggleManageMode(); this.removeConfirmationDialog(); } } }); }, handleManagementSelect (selection) { if (selection === 'all') this.checkAllTableItems(); if (selection === 'none') this.uncheckAllTableItems(); if (selection === 'visible') this.checkAllTableItems(); return false; }, renderSearch () { var searchClearIcon = classnames('ListHeader__search__icon octicon', { 'is-search octicon-search': !this.state.searchString.length, 'is-clear octicon-x': this.state.searchString.length, }); return ( <InputGroup.Section grow className="ListHeader__search"> <FormInput ref="listSearchInput" value={this.state.searchString} onChange={this.updateSearch} onKeyUp={this.handleSearchKey} placeholder="Search" className="ListHeader__searchbar-input" /> <button ref="listSearchClear" type="button" title="Clear search query" onClick={this.handleSearchClear} disabled={!this.state.searchString.length} className={searchClearIcon} /> </InputGroup.Section> ); }, renderCreateButton () { if (this.state.list.nocreate) return null; var props = { type: 'success' }; if (this.state.list.autocreate) { props.href = '?new' + Keystone.csrf.query; } else { props.onClick = () => this.toggleCreateModal(true); } return ( <InputGroup.Section className="ListHeader__create"> <Button {...props} title={'Create ' + this.state.list.singular}> <span className="ListHeader__create__icon octicon octicon-plus" /> <span className="ListHeader__create__label"> Create </span> <span className="ListHeader__create__label--lg"> Create {this.state.list.singular} </span> </Button> </InputGroup.Section> ); }, renderConfirmationDialog () { const props = this.state.confirmationDialog; return ( <ConfirmationDialog isOpen={props.isOpen} body={props.body} confirmationLabel={props.label} onCancel={this.removeConfirmationDialog} onConfirmation={props.onConfirmation} /> ); }, renderManagement () { // WIP: Management mode currently under development, so the UI is disabled // unless the KEYSTONE_DEV environment variable is set if (!Keystone.devMode) return; let { checkedItems, items, list, manageMode, pageSize } = this.state; if (!items.count || (list.nodelete && list.noedit)) return; let checkedItemCount = Object.keys(checkedItems).length; let buttonNoteStyles = { color: '#999', fontWeight: 'normal' }; // action buttons let actionUpdateButton = !list.noedit ? ( <InputGroup.Section> <Button onClick={this.toggleUpdateModal} disabled={!checkedItemCount}>Update</Button> </InputGroup.Section> ) : null; let actionDeleteButton = !list.nodelete ? ( <InputGroup.Section> <Button onClick={this.massDelete} disabled={!checkedItemCount}>Delete</Button> </InputGroup.Section> ) : null; let actionButtons = manageMode ? ( <InputGroup.Section> <InputGroup contiguous> {actionUpdateButton} {actionDeleteButton} </InputGroup> </InputGroup.Section> ) : null; // select buttons let selectAllButton = items.count > pageSize ? ( <InputGroup.Section> <Button onClick={() => this.handleManagementSelect('all')} title="Select all rows (including those not visible)">All <small style={buttonNoteStyles}>({items.count})</small></Button> </InputGroup.Section> ) : null; let selectButtons = manageMode ? ( <InputGroup.Section> <InputGroup contiguous> {selectAllButton} <InputGroup.Section> <Button onClick={() => this.handleManagementSelect('visible')} title="Select all rows">{items.count > pageSize ? 'Page' : 'All'} <small style={buttonNoteStyles}>({items.results.length})</small></Button> </InputGroup.Section> <InputGroup.Section> <Button onClick={() => this.handleManagementSelect('none')} title="Deselect all rows">None</Button> </InputGroup.Section> </InputGroup> </InputGroup.Section> ) : null; // selected count text let selectedCountText = manageMode ? ( <InputGroup.Section grow> <span style={{ color: '#666', display: 'inline-block', lineHeight: '2.4em', margin: 1 }}>{checkedItemCount} selected</span> </InputGroup.Section> ) : null; // put it all together return ( <InputGroup style={{ float: 'left', marginRight: '.75em' }}> <InputGroup.Section> <Button isActive={manageMode} onClick={() => this.toggleManageMode(!manageMode)}>Manage</Button> </InputGroup.Section> {selectButtons} {actionButtons} {selectedCountText} </InputGroup> ); }, renderPagination () { let { currentPage, items, list, manageMode, pageSize } = this.state; if (manageMode || !items.count) return; return ( <Pagination className="ListHeader__pagination" currentPage={currentPage} onPageSelect={this.handlePageSelect} pageSize={pageSize} plural={list.plural} singular={list.singular} style={{ marginBottom: 0 }} total={items.count} limit={10} /> ); }, renderHeader () { let { items, list } = this.state; return ( <div className="ListHeader"> <Container> <h2 className="ListHeader__title"> {plural(items.count, ('* ' + list.singular), ('* ' + list.plural))} <ListSort /> </h2> <InputGroup className="ListHeader__bar"> {this.renderSearch()} <ListFiltersAdd className="ListHeader__filter" /> <ListColumnsForm className="ListHeader__columns" /> <ListDownloadForm className="ListHeader__download" /> <InputGroup.Section className="ListHeader__expand"> <Button isActive={!this.state.constrainTableWidth} onClick={this.toggleTableWidth} title="Expand table width"> <span className="octicon octicon-mirror" /> </Button> </InputGroup.Section> {this.renderCreateButton()} </InputGroup> <ListFilters /> <div style={{ height: 34, marginBottom: '2em' }}> {this.renderManagement()} {this.renderPagination()} <span style={{ clear: 'both', display: 'table' }} /> </div> </Container> </div> ); }, // ============================== // TABLE // ============================== checkTableItem (item, e) { e.preventDefault(); let newCheckedItems = { ...this.state.checkedItems }; let itemId = item.id; if (this.state.checkedItems[itemId]) { delete newCheckedItems[itemId]; } else { newCheckedItems[itemId] = true; } this.setState({ checkedItems: newCheckedItems, }); }, checkAllTableItems () { let checkedItems = {}; this.state.items.results.forEach(item => { checkedItems[item.id] = true; }); this.setState({ checkedItems: checkedItems, }); }, uncheckAllTableItems () { this.setState({ checkedItems: {}, }); }, deleteTableItem (item, e) { if (e.altKey) { return CurrentListStore.deleteItem(item.id); } e.preventDefault(); this.setState({ confirmationDialog: { isOpen: true, label: 'Delete', body: `Are you sure you want to delete <strong>${item.name}</strong>?<br /><br />This cannot be undone.`, onConfirmation: () => { CurrentListStore.deleteItem(item.id); this.removeConfirmationDialog(); }, }, }); }, removeConfirmationDialog () { this.setState({ confirmationDialog: { isOpen: false, }, }); }, toggleTableWidth () { this.setState({ constrainTableWidth: !this.state.constrainTableWidth, }); }, // ============================== // COMMON // ============================== toggleCreateModal (visible) { this.setState({ showCreateForm: visible, }); }, renderBlankStateCreateButton () { var props = { type: 'success' }; if (this.state.list.nocreate) return null; if (this.state.list.autocreate) { props.href = '?new' + this.props.csrfQuery; } else { props.onClick = () => this.toggleCreateModal(true); } return ( <Button {...props}> <span className="octicon octicon-plus" /> Create {this.state.list.singular} </Button> ); }, renderBlankState () { if (!this.state.showBlankState) return null; return ( <Container> <FlashMessages messages={this.props.messages} /> <BlankState style={{ marginTop: 40 }}> <BlankState.Heading>No {this.state.list.plural.toLowerCase()} found&hellip;</BlankState.Heading> {this.renderBlankStateCreateButton()} </BlankState> </Container> ); }, renderActiveState () { if (this.state.showBlankState) return null; let containerStyle = { transition: 'max-width 160ms ease-out', msTransition: 'max-width 160ms ease-out', MozTransition: 'max-width 160ms ease-out', WebkitTransition: 'max-width 160ms ease-out', }; if (!this.state.constrainTableWidth) containerStyle['maxWidth'] = '100%'; return ( <div> {this.renderHeader()} <Container style={containerStyle}> <FlashMessages messages={this.props.messages} /> <ItemsTable deleteTableItem={this.deleteTableItem} list={this.state.list} columns={this.state.columns} items={this.state.items} manageMode={this.state.manageMode} checkedItems={this.state.checkedItems} rowAlert={this.state.rowAlert} checkTableItem={this.checkTableItem} /> {this.renderNoSearchResults()} </Container> </div> ); }, renderNoSearchResults () { if (this.state.items.results.length) return null; let matching = this.state.search; if (this.state.filters.length) { matching += (matching ? ' and ' : '') + plural(this.state.filters.length, '* filter', '* filters'); } matching = matching ? ' found matching ' + matching : '.'; return ( <BlankState style={{ marginTop: 20, marginBottom: 20 }}> <span className="octicon octicon-search" style={{ fontSize: 32, marginBottom: 20 }} /> <BlankState.Heading>No {this.state.list.plural.toLowerCase()}{matching}</BlankState.Heading> </BlankState> ); }, render () { return !this.state.ready ? ( <div className="view-loading-indicator"><Spinner size="md" /></div> ) : ( <div className="keystone-wrapper"> <header className="keystone-header"> <MobileNavigation brand={this.props.brand} currentListKey={this.state.list.path} currentSectionKey={this.props.nav.currentSection.key} sections={this.props.nav.sections} signoutUrl={this.props.signoutUrl} /> <PrimaryNavigation brand={this.props.brand} currentSectionKey={this.props.nav.currentSection.key} sections={this.props.nav.sections} signoutUrl={this.props.signoutUrl} /> <SecondaryNavigation currentListKey={this.state.list.path} lists={this.props.nav.currentSection.lists} /> </header> <div className="keystone-body"> {this.renderBlankState()} {this.renderActiveState()} </div> <Footer appversion={this.props.appversion} backUrl={this.props.backUrl} brand={this.props.brand} User={this.props.User} user={this.props.user} version={this.props.version} /> <CreateForm err={this.props.createFormErrors} isOpen={this.state.showCreateForm} list={this.state.list} onCancel={() => this.toggleCreateModal(false)} values={this.props.createFormData} /> <UpdateForm isOpen={this.state.showUpdateForm} itemIds={Object.keys(this.state.checkedItems)} list={this.state.list} onCancel={() => this.toggleUpdateModal(false)} /> {this.renderConfirmationDialog()} </div> ); }, }); ReactDOM.render( <ListView appversion={Keystone.appversion} backUrl={Keystone.backUrl} brand={Keystone.brand} createFormData={Keystone.createFormData} createFormErrors={Keystone.createFormErrors} csrfQuery={Keystone.csrf.query} messages={Keystone.messages} nav={Keystone.nav} signoutUrl={Keystone.signoutUrl} user={Keystone.user} User={Keystone.User} version={Keystone.version} />, document.getElementById('list-view') );
ajax/libs/angular.js/0.10.1/angular.js
advancedpartnerships/cdnjs
/** * @license AngularJS v0.10.1 * (c) 2010-2011 AngularJS http://angularjs.org * License: MIT */ 'use strict'; (function(window, document, undefined){ //////////////////////////////////// if (typeof document.getAttribute == $undefined) document.getAttribute = function() {}; /** * @ngdoc function * @name angular.lowercase * @function * * @description Converts the specified string to lowercase. * @param {string} string String to be converted to lowercase. * @returns {string} Lowercased string. */ var lowercase = function (string){ return isString(string) ? string.toLowerCase() : string; }; /** * @ngdoc function * @name angular.uppercase * @function * * @description Converts the specified string to uppercase. * @param {string} string String to be converted to uppercase. * @returns {string} Uppercased string. */ var uppercase = function (string){ return isString(string) ? string.toUpperCase() : string; }; var manualLowercase = function (s) { return isString(s) ? s.replace(/[A-Z]/g, function (ch) {return fromCharCode(ch.charCodeAt(0) | 32); }) : s; }; var manualUppercase = function (s) { return isString(s) ? s.replace(/[a-z]/g, function (ch) {return fromCharCode(ch.charCodeAt(0) & ~32); }) : s; }; // String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish // locale, for this reason we need to detect this case and redefine lowercase/uppercase methods // with correct but slower alternatives. if ('i' !== 'I'.toLowerCase()) { lowercase = manualLowercase; uppercase = manualUppercase; } function fromCharCode(code) { return String.fromCharCode(code); } var _undefined = undefined, _null = null, $$scope = '$scope', $$validate = '$validate', $angular = 'angular', $array = 'array', $boolean = 'boolean', $console = 'console', $date = 'date', $length = 'length', $name = 'name', $noop = 'noop', $null = 'null', $number = 'number', $object = 'object', $string = 'string', $value = 'value', $selected = 'selected', $undefined = 'undefined', NG_EXCEPTION = 'ng-exception', NG_VALIDATION_ERROR = 'ng-validation-error', NOOP = 'noop', Error = window.Error, /** holds major version number for IE or NaN for real browsers */ msie = parseInt((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1], 10), jqLite, // delay binding since jQuery could be loaded after us. jQuery, // delay binding slice = [].slice, push = [].push, error = window[$console] ? bind(window[$console], window[$console]['error'] || noop) : noop, /** @name angular */ angular = window[$angular] || (window[$angular] = {}), /** @name angular.markup */ angularTextMarkup = extensionMap(angular, 'markup'), /** @name angular.attrMarkup */ angularAttrMarkup = extensionMap(angular, 'attrMarkup'), /** @name angular.directive */ angularDirective = extensionMap(angular, 'directive'), /** @name angular.widget */ angularWidget = extensionMap(angular, 'widget', lowercase), /** @name angular.validator */ angularValidator = extensionMap(angular, 'validator'), /** @name angular.fileter */ angularFilter = extensionMap(angular, 'filter'), /** @name angular.formatter */ angularFormatter = extensionMap(angular, 'formatter'), /** @name angular.service */ angularService = extensionMap(angular, 'service'), angularCallbacks = extensionMap(angular, 'callbacks'), nodeName_, rngScript = /^(|.*\/)angular(-.*?)?(\.min)?.js(\?[^#]*)?(#(.*))?$/, uid = ['0', '0', '0'], DATE_ISOSTRING_LN = 24; /** * @ngdoc function * @name angular.forEach * @function * * @description * Invokes the `iterator` function once for each item in `obj` collection, which can be either an * object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value` * is the value of an object property or an array element and `key` is the object property key or * array element index. Specifying a `context` for the function is optional. * * Note: this function was previously known as `angular.foreach`. * <pre> var values = {name: 'misko', gender: 'male'}; var log = []; angular.forEach(values, function(value, key){ this.push(key + ': ' + value); }, log); expect(log).toEqual(['name: misko', 'gender:male']); </pre> * * @param {Object|Array} obj Object to iterate over. * @param {function()} iterator Iterator function. * @param {Object=} context Object to become context (`this`) for the iterator function. * @returns {Object|Array} Reference to `obj`. */ function forEach(obj, iterator, context) { var key; if (obj) { if (isFunction(obj)){ for (key in obj) { if (key != 'prototype' && key != $length && key != $name && obj.hasOwnProperty(key)) { iterator.call(context, obj[key], key); } } } else if (obj.forEach && obj.forEach !== forEach) { obj.forEach(iterator, context); } else if (isObject(obj) && isNumber(obj.length)) { for (key = 0; key < obj.length; key++) iterator.call(context, obj[key], key); } else { for (key in obj) iterator.call(context, obj[key], key); } } return obj; } function forEachSorted(obj, iterator, context) { var keys = []; for (var key in obj) keys.push(key); keys.sort(); for ( var i = 0; i < keys.length; i++) { iterator.call(context, obj[keys[i]], keys[i]); } return keys; } function formatError(arg) { if (arg instanceof Error) { if (arg.stack) { arg = (arg.message && arg.stack.indexOf(arg.message) === -1) ? 'Error: ' + arg.message + '\n' + arg.stack : arg.stack; } else if (arg.sourceURL) { arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line; } } return arg; } /** * @description * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric * characters such as '012ABC'. The reason why we are not using simply a number counter is that * the number string gets longer over time, and it can also overflow, where as the the nextId * will grow much slower, it is a string, and it will never overflow. * * @returns an unique alpha-numeric string */ function nextUid() { var index = uid.length; var digit; while(index) { index--; digit = uid[index].charCodeAt(0); if (digit == 57 /*'9'*/) { uid[index] = 'A'; return uid.join(''); } if (digit == 90 /*'Z'*/) { uid[index] = '0'; } else { uid[index] = String.fromCharCode(digit + 1); return uid.join(''); } } uid.unshift('0'); return uid.join(''); } /** * @ngdoc function * @name angular.extend * @function * * @description * Extends the destination object `dst` by copying all of the properties from the `src` object(s) * to `dst`. You can specify multiple `src` objects. * * @param {Object} dst Destination object. * @param {...Object} src Source object(s). */ function extend(dst) { forEach(arguments, function(obj){ if (obj !== dst) { forEach(obj, function(value, key){ dst[key] = value; }); } }); return dst; } function inherit(parent, extra) { return extend(new (extend(function(){}, {prototype:parent}))(), extra); } /** * @ngdoc function * @name angular.noop * @function * * @description * A function that performs no operations. This function can be useful when writing code in the * functional style. <pre> function foo(callback) { var result = calculateResult(); (callback || angular.noop)(result); } </pre> */ function noop() {} /** * @ngdoc function * @name angular.identity * @function * * @description * A function that returns its first argument. This function is useful when writing code in the * functional style. * <pre> function transformer(transformationFn, value) { return (transformationFn || identity)(value); }; </pre> */ function identity($) {return $;} function valueFn(value) {return function(){ return value; };} function extensionMap(angular, name, transform) { var extPoint; return angular[name] || (extPoint = angular[name] = function (name, fn, prop){ name = (transform || identity)(name); if (isDefined(fn)) { extPoint[name] = extend(fn, prop || {}); } return extPoint[name]; }); } /** * @ngdoc function * @name angular.isUndefined * @function * * @description * Determines if a reference is undefined. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is undefined. */ function isUndefined(value){ return typeof value == $undefined; } /** * @ngdoc function * @name angular.isDefined * @function * * @description * Determines if a reference is defined. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is defined. */ function isDefined(value){ return typeof value != $undefined; } /** * @ngdoc function * @name angular.isObject * @function * * @description * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not * considered to be objects. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is an `Object` but not `null`. */ function isObject(value){ return value!=null && typeof value == $object;} /** * @ngdoc function * @name angular.isString * @function * * @description * Determines if a reference is a `String`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `String`. */ function isString(value){ return typeof value == $string;} /** * @ngdoc function * @name angular.isNumber * @function * * @description * Determines if a reference is a `Number`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Number`. */ function isNumber(value){ return typeof value == $number;} /** * @ngdoc function * @name angular.isDate * @function * * @description * Determines if a value is a date. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Date`. */ function isDate(value){ return value instanceof Date; } /** * @ngdoc function * @name angular.isArray * @function * * @description * Determines if a reference is an `Array`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is an `Array`. */ function isArray(value) { return value instanceof Array; } /** * @ngdoc function * @name angular.isFunction * @function * * @description * Determines if a reference is a `Function`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Function`. */ function isFunction(value){ return typeof value == 'function';} /** * Checks if `obj` is a window object. * * @private * @param {*} obj Object to check * @returns {boolean} True if `obj` is a window obj. */ function isWindow(obj) { return obj && obj.document && obj.location && obj.alert && obj.setInterval; } function isBoolean(value) { return typeof value == $boolean; } function isTextNode(node) { return nodeName_(node) == '#text'; } function trim(value) { return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value; } function isElement(node) { return node && (node.nodeName // we are a direct element || (node.bind && node.find)); // we have a bind and find method part of jQuery API } /** * @param str 'key1,key2,...' * @returns {object} in the form of {key1:true, key2:true, ...} */ function makeMap(str){ var obj = {}, items = str.split(","), i; for ( i = 0; i < items.length; i++ ) obj[ items[i] ] = true; return obj; } /** * HTML class which is the only class which can be used in ng:bind to inline HTML for security * reasons. * * @constructor * @param html raw (unsafe) html * @param {string=} option If set to 'usafe', get method will return raw (unsafe/unsanitized) html */ function HTML(html, option) { this.html = html; this.get = lowercase(option) == 'unsafe' ? valueFn(html) : function htmlSanitize() { var buf = []; htmlParser(html, htmlSanitizeWriter(buf)); return buf.join(''); }; } if (msie < 9) { nodeName_ = function(element) { element = element.nodeName ? element : element[0]; return (element.scopeName && element.scopeName != 'HTML') ? uppercase(element.scopeName + ':' + element.nodeName) : element.nodeName; }; } else { nodeName_ = function(element) { return element.nodeName ? element.nodeName : element[0].nodeName; }; } function isVisible(element) { var rect = element[0].getBoundingClientRect(), width = (rect.width || (rect.right||0 - rect.left||0)), height = (rect.height || (rect.bottom||0 - rect.top||0)); return width>0 && height>0; } function map(obj, iterator, context) { var results = []; forEach(obj, function(value, index, list) { results.push(iterator.call(context, value, index, list)); }); return results; } /** * @ngdoc function * @name angular.Object.size * @function * * @description * Determines the number of elements in an array, the number of properties an object has, or * the length of a string. * * Note: This function is used to augment the Object type in Angular expressions. See * {@link angular.Object} for more information about Angular arrays. * * @param {Object|Array|string} obj Object, array, or string to inspect. * @param {boolean} [ownPropsOnly=false] Count only "own" properties in an object * @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array. * * @example * <doc:example> * <doc:source> * <script> * function SizeCtrl() { * this.fooStringLength = angular.Object.size('foo'); * } * </script> * <div ng:controller="SizeCtrl"> * Number of items in array: {{ [1,2].$size() }}<br/> * Number of items in object: {{ {a:1, b:2, c:3}.$size() }}<br/> * String length: {{fooStringLength}} * </div> * </doc:source> * <doc:scenario> * it('should print correct sizes for an array and an object', function() { * expect(binding('[1,2].$size()')).toBe('2'); * expect(binding('{a:1, b:2, c:3}.$size()')).toBe('3'); * expect(binding('fooStringLength')).toBe('3'); * }); * </doc:scenario> * </doc:example> */ function size(obj, ownPropsOnly) { var size = 0, key; if (isArray(obj) || isString(obj)) { return obj.length; } else if (isObject(obj)){ for (key in obj) if (!ownPropsOnly || obj.hasOwnProperty(key)) size++; } return size; } function includes(array, obj) { for ( var i = 0; i < array.length; i++) { if (obj === array[i]) return true; } return false; } function indexOf(array, obj) { for ( var i = 0; i < array.length; i++) { if (obj === array[i]) return i; } return -1; } function isLeafNode (node) { if (node) { switch (node.nodeName) { case "OPTION": case "PRE": case "TITLE": return true; } } return false; } /** * @ngdoc function * @name angular.copy * @function * * @description * Alias for {@link angular.Object.copy} */ /** * @ngdoc function * @name angular.Object.copy * @function * * @description * Creates a deep copy of `source`, which should be an object or an array. * * * If no destination is supplied, a copy of the object or array is created. * * If a destination is provided, all of its elements (for array) or properties (for objects) * are deleted and then all elements/properties from the source are copied to it. * * If `source` is not an object or array, `source` is returned. * * Note: this function is used to augment the Object type in Angular expressions. See * {@link angular.Array} for more information about Angular arrays. * * @param {*} source The source that will be used to make a copy. * Can be any type, including primitives, `null`, and `undefined`. * @param {(Object|Array)=} destination Destination into which the source is copied. If * provided, must be of the same type as `source`. * @returns {*} The copy or updated `destination`, if `destination` was specified. * * @example * <doc:example> * <doc:source> Salutation: <input type="text" name="master.salutation" value="Hello" /><br/> Name: <input type="text" name="master.name" value="world"/><br/> <button ng:click="form = master.$copy()">copy</button> <hr/> The master object is <span ng:hide="master.$equals(form)">NOT</span> equal to the form object. <pre>master={{master}}</pre> <pre>form={{form}}</pre> * </doc:source> * <doc:scenario> it('should print that initialy the form object is NOT equal to master', function() { expect(element('.doc-example-live input[name=master.salutation]').val()).toBe('Hello'); expect(element('.doc-example-live input[name=master.name]').val()).toBe('world'); expect(element('.doc-example-live span').css('display')).toBe('inline'); }); it('should make form and master equal when the copy button is clicked', function() { element('.doc-example-live button').click(); expect(element('.doc-example-live span').css('display')).toBe('none'); }); * </doc:scenario> * </doc:example> */ function copy(source, destination){ if (!destination) { destination = source; if (source) { if (isArray(source)) { destination = copy(source, []); } else if (isDate(source)) { destination = new Date(source.getTime()); } else if (isObject(source)) { destination = copy(source, {}); } } } else { if (isArray(source)) { while(destination.length) { destination.pop(); } for ( var i = 0; i < source.length; i++) { destination.push(copy(source[i])); } } else { forEach(destination, function(value, key){ delete destination[key]; }); for ( var key in source) { destination[key] = copy(source[key]); } } } return destination; } /** * @ngdoc function * @name angular.equals * @function * * @description * Alias for {@link angular.Object.equals} */ /** * @ngdoc function * @name angular.Object.equals * @function * * @description * Determines if two objects or two values are equivalent. Supports value types, arrays and * objects. * * Two objects or values are considered equivalent if at least one of the following is true: * * * Both objects or values pass `===` comparison. * * Both objects or values are of the same type and all of their properties pass `===` comparison. * * During a property comparision, properties of `function` type and properties with names * that begin with `$` are ignored. * * Note: This function is used to augment the Object type in Angular expressions. See * {@link angular.Array} for more information about Angular arrays. * * @param {*} o1 Object or value to compare. * @param {*} o2 Object or value to compare. * @returns {boolean} True if arguments are equal. * * @example * <doc:example> * <doc:source> Salutation: <input type="text" name="greeting.salutation" value="Hello" /><br/> Name: <input type="text" name="greeting.name" value="world"/><br/> <hr/> The <code>greeting</code> object is <span ng:hide="greeting.$equals({salutation:'Hello', name:'world'})">NOT</span> equal to <code>{salutation:'Hello', name:'world'}</code>. <pre>greeting={{greeting}}</pre> * </doc:source> * <doc:scenario> it('should print that initialy greeting is equal to the hardcoded value object', function() { expect(element('.doc-example-live input[name=greeting.salutation]').val()).toBe('Hello'); expect(element('.doc-example-live input[name=greeting.name]').val()).toBe('world'); expect(element('.doc-example-live span').css('display')).toBe('none'); }); it('should say that the objects are not equal when the form is modified', function() { input('greeting.name').enter('kitty'); expect(element('.doc-example-live span').css('display')).toBe('inline'); }); * </doc:scenario> * </doc:example> */ function equals(o1, o2) { if (o1 === o2) return true; if (o1 === null || o2 === null) return false; var t1 = typeof o1, t2 = typeof o2, length, key, keySet; if (t1 == t2 && t1 == 'object') { if (o1 instanceof Array) { if ((length = o1.length) == o2.length) { for(key=0; key<length; key++) { if (!equals(o1[key], o2[key])) return false; } return true; } } else { keySet = {}; for(key in o1) { if (key.charAt(0) !== '$' && !isFunction(o1[key]) && !equals(o1[key], o2[key])) { return false; } keySet[key] = true; } for(key in o2) { if (!keySet[key] && key.charAt(0) !== '$' && !isFunction(o2[key])) return false; } return true; } } return false; } function setHtml(node, html) { if (isLeafNode(node)) { if (msie) { node.innerText = html; } else { node.textContent = html; } } else { node.innerHTML = html; } } function isRenderableElement(element) { var name = element && element[0] && element[0].nodeName; return name && name.charAt(0) != '#' && !includes(['TR', 'COL', 'COLGROUP', 'TBODY', 'THEAD', 'TFOOT'], name); } function elementError(element, type, error) { var parent; while (!isRenderableElement(element)) { parent = element.parent(); if (parent.length) { element = element.parent(); } else { return; } } if (element[0]['$NG_ERROR'] !== error) { element[0]['$NG_ERROR'] = error; if (error) { element.addClass(type); element.attr(type, error.message || error); } else { element.removeClass(type); element.removeAttr(type); } } } function concat(array1, array2, index) { return array1.concat(slice.call(array2, index)); } function sliceArgs(args, startIndex) { return slice.call(args, startIndex || 0); } /** * @ngdoc function * @name angular.bind * @function * * @description * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for * `fn`). You can supply optional `args` that are are prebound to the function. This feature is also * known as [function currying](http://en.wikipedia.org/wiki/Currying). * * @param {Object} self Context which `fn` should be evaluated in. * @param {function()} fn Function to be bound. * @param {...*} args Optional arguments to be prebound to the `fn` function call. * @returns {function()} Function that wraps the `fn` with all the specified bindings. */ function bind(self, fn) { var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; if (isFunction(fn) && !(fn instanceof RegExp)) { return curryArgs.length ? function() { return arguments.length ? fn.apply(self, curryArgs.concat(slice.call(arguments, 0))) : fn.apply(self, curryArgs); } : function() { return arguments.length ? fn.apply(self, arguments) : fn.call(self); }; } else { // in IE, native methods are not functions so they cannot be bound (note: they don't need to be) return fn; } } function toBoolean(value) { if (value && value.length !== 0) { var v = lowercase("" + value); value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]'); } else { value = false; } return value; } /** @name angular.compile */ function compile(element) { return new Compiler(angularTextMarkup, angularAttrMarkup, angularDirective, angularWidget) .compile(element); } ///////////////////////////////////////////////// /** * Parses an escaped url query string into key-value pairs. * @returns Object.<(string|boolean)> */ function parseKeyValue(/**string*/keyValue) { var obj = {}, key_value, key; forEach((keyValue || "").split('&'), function(keyValue){ if (keyValue) { key_value = keyValue.split('='); key = decodeURIComponent(key_value[0]); obj[key] = isDefined(key_value[1]) ? decodeURIComponent(key_value[1]) : true; } }); return obj; } function toKeyValue(obj) { var parts = []; forEach(obj, function(value, key) { parts.push(encodeUriQuery(key, true) + (value === true ? '' : '=' + encodeUriQuery(value, true))); }); return parts.length ? parts.join('&') : ''; } /** * We need our custom mehtod because encodeURIComponent is too agressive and doesn't follow * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path * segments: * segment = *pchar * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" * pct-encoded = "%" HEXDIG HEXDIG * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" * / "*" / "+" / "," / ";" / "=" */ function encodeUriSegment(val) { return encodeUriQuery(val, true). replace(/%26/gi, '&'). replace(/%3D/gi, '='). replace(/%2B/gi, '+'); } /** * This method is intended for encoding *key* or *value* parts of query component. We need a custom * method becuase encodeURIComponent is too agressive and encodes stuff that doesn't have to be * encoded per http://tools.ietf.org/html/rfc3986: * query = *( pchar / "/" / "?" ) * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" * pct-encoded = "%" HEXDIG HEXDIG * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" * / "*" / "+" / "," / ";" / "=" */ function encodeUriQuery(val, pctEncodeSpaces) { return encodeURIComponent(val). replace(/%40/gi, '@'). replace(/%3A/gi, ':'). replace(/%24/g, '$'). replace(/%2C/gi, ','). replace((pctEncodeSpaces ? null : /%20/g), '+'); } /** * @ngdoc directive * @name angular.directive.ng:autobind * @element script * * @TODO ng:autobind is not a directive!! it should be documented as bootstrap parameter in a * separate bootstrap section. * @TODO rename to ng:autobind to ng:autoboot * * @description * Technically, ng:autobind is not a directive; it is an Angular bootstrap parameter that can act * as a directive. It must exist in the script used to boot Angular and can be used only one time. * For details on bootstrapping Angular, see {@link guide/dev_guide.bootstrap Initializing Angular} * in the Angular Developer Guide. * * `ng:autobind` with no parameters tells Angular to compile and manage the whole page. * * `ng:autobind="[root element ID]"` tells Angular to compile and manage part of the document, * starting at "root element ID". * */ function angularInit(config, document){ var autobind = config.autobind; if (autobind) { var element = isString(autobind) ? document.getElementById(autobind) : document, scope = compile(element)(createScope()), $browser = scope.$service('$browser'); if (config.css) $browser.addCss(config.base_url + config.css); else if(msie<8) $browser.addJs(config.ie_compat, config.ie_compat_id); scope.$apply(); } } function angularJsConfig(document, config) { bindJQuery(); var scripts = document.getElementsByTagName("script"), match; config = extend({ ie_compat_id: 'ng-ie-compat' }, config); for(var j = 0; j < scripts.length; j++) { match = (scripts[j].src || "").match(rngScript); if (match) { config.base_url = match[1]; config.ie_compat = match[1] + 'angular-ie-compat' + (match[2] || '') + '.js'; extend(config, parseKeyValue(match[6])); eachAttribute(jqLite(scripts[j]), function(value, name){ if (/^ng:/.exec(name)) { name = name.substring(3).replace(/-/g, '_'); value = value || true; config[name] = value; } }); } } return config; } function bindJQuery(){ // bind to jQuery if present; jQuery = window.jQuery; // reset to jQuery or default to us. if (jQuery) { jqLite = jQuery; extend(jQuery.fn, { scope: JQLitePrototype.scope }); } else { jqLite = jqLiteWrap; } angular.element = jqLite; } /** * throw error of the argument is falsy. */ function assertArg(arg, name, reason) { if (!arg) { var error = new Error("Argument '" + (name||'?') + "' is " + (reason || "required")); throw error; } } function assertArgFn(arg, name) { assertArg(isFunction(arg), name, 'not a function, got ' + (typeof arg == 'object' ? arg.constructor.name : typeof arg)); } /** * @ngdoc property * @name angular.version * @description * An object that contains information about the current AngularJS version. This object has the * following properties: * * - `full` – `{string}` – Full version string, such as "0.9.18". * - `major` – `{number}` – Major version number, such as "0". * - `minor` – `{number}` – Minor version number, such as "9". * - `dot` – `{number}` – Dot version number, such as "18". * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". */ var version = { full: '0.10.1', // all of these placeholder strings will be replaced by rake's major: 0, // compile task minor: 10, dot: 1, codeName: 'inexorable-juggernaut' }; var array = [].constructor; /** * @ngdoc function * @name angular.toJson * @function * * @description * Serializes input into a JSON-formatted string. * * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON. * @param {boolean=} pretty If set to true, the JSON output will contain newlines and whitespace. * @returns {string} Jsonified string representing `obj`. */ function toJson(obj, pretty) { var buf = []; toJsonArray(buf, obj, pretty ? "\n " : null, []); return buf.join(''); } /** * @ngdoc function * @name angular.fromJson * @function * * @description * Deserializes a JSON string. * * @param {string} json JSON string to deserialize. * @param {boolean} [useNative=false] Use native JSON parser, if available. * @returns {Object|Array|Date|string|number} Deserialized thingy. */ function fromJson(json, useNative) { if (!isString(json)) return json; var obj; try { if (useNative && window.JSON && window.JSON.parse) { obj = JSON.parse(json); return transformDates(obj); } return parser(json, true).primary()(); } catch (e) { error("fromJson error: ", json, e); throw e; } // TODO make forEach optionally recursive and remove this function function transformDates(obj) { if (isString(obj) && obj.length === DATE_ISOSTRING_LN) { return angularString.toDate(obj); } else if (isArray(obj) || isObject(obj)) { forEach(obj, function(val, name) { obj[name] = transformDates(val); }); } return obj; } } angular.toJson = toJson; angular.fromJson = fromJson; function toJsonArray(buf, obj, pretty, stack) { if (isObject(obj)) { if (obj === window) { buf.push('WINDOW'); return; } if (obj === document) { buf.push('DOCUMENT'); return; } if (includes(stack, obj)) { buf.push('RECURSION'); return; } stack.push(obj); } if (obj === null) { buf.push($null); } else if (obj instanceof RegExp) { buf.push(angularString.quoteUnicode(obj.toString())); } else if (isFunction(obj)) { return; } else if (isBoolean(obj)) { buf.push('' + obj); } else if (isNumber(obj)) { if (isNaN(obj)) { buf.push($null); } else { buf.push('' + obj); } } else if (isString(obj)) { return buf.push(angularString.quoteUnicode(obj)); } else if (isObject(obj)) { if (isArray(obj)) { buf.push("["); var len = obj.length; var sep = false; for(var i=0; i<len; i++) { var item = obj[i]; if (sep) buf.push(","); if (!(item instanceof RegExp) && (isFunction(item) || isUndefined(item))) { buf.push($null); } else { toJsonArray(buf, item, pretty, stack); } sep = true; } buf.push("]"); } else if (isElement(obj)) { // TODO(misko): maybe in dev mode have a better error reporting? buf.push('DOM_ELEMENT'); } else if (isDate(obj)) { buf.push(angularString.quoteUnicode(angular.Date.toString(obj))); } else { buf.push("{"); if (pretty) buf.push(pretty); var comma = false; var childPretty = pretty ? pretty + " " : false; var keys = []; for(var k in obj) { if (obj.hasOwnProperty(k) && obj[k] !== undefined) { keys.push(k); } } keys.sort(); for ( var keyIndex = 0; keyIndex < keys.length; keyIndex++) { var key = keys[keyIndex]; var value = obj[key]; if (!isFunction(value)) { if (comma) { buf.push(","); if (pretty) buf.push(pretty); } buf.push(angularString.quote(key)); buf.push(":"); toJsonArray(buf, value, childPretty, stack); comma = true; } } buf.push("}"); } } if (isObject(obj)) { stack.pop(); } } /** * Template provides directions an how to bind to a given element. * It contains a list of init functions which need to be called to * bind to a new instance of elements. It also provides a list * of child paths which contain child templates */ function Template() { this.paths = []; this.children = []; this.linkFns = []; this.newScope = false; } Template.prototype = { link: function(element, scope) { var childScope = scope; if (this.newScope) { childScope = isFunction(this.newScope) ? scope.$new(this.newScope(scope)) : scope.$new(); element.data($$scope, childScope); } forEach(this.linkFns, function(fn) { try { childScope.$service.invoke(childScope, fn, [element]); } catch (e) { childScope.$service('$exceptionHandler')(e); } }); var i, childNodes = element[0].childNodes, children = this.children, paths = this.paths, length = paths.length; for (i = 0; i < length; i++) { children[i].link(jqLite(childNodes[paths[i]]), childScope); } }, addLinkFn:function(linkingFn) { if (linkingFn) { if (!linkingFn.$inject) linkingFn.$inject = []; this.linkFns.push(linkingFn); } }, addChild: function(index, template) { if (template) { this.paths.push(index); this.children.push(template); } }, empty: function() { return this.linkFns.length === 0 && this.paths.length === 0; } }; /////////////////////////////////// //Compiler ////////////////////////////////// /** * @workInProgress * @ngdoc function * @name angular.compile * @function * * @description * Compiles a piece of HTML string or DOM into a template and produces a template function, which * can then be used to link {@link angular.scope scope} and the template together. * * The compilation is a process of walking the DOM tree and trying to match DOM elements to * {@link angular.markup markup}, {@link angular.attrMarkup attrMarkup}, * {@link angular.widget widgets}, and {@link angular.directive directives}. For each match it * executes corresponding markup, attrMarkup, widget or directive template function and collects the * instance functions into a single template function which is then returned. * * The template function can then be used once to produce the view or as it is the case with * {@link angular.widget.@ng:repeat repeater} many-times, in which case each call results in a view * that is a DOM clone of the original template. * <pre> // compile the entire window.document and give me the scope bound to this template. var rootScope = angular.compile(window.document)(); // compile a piece of html var rootScope2 = angular.compile('<div ng:click="clicked = true">click me</div>')(); // compile a piece of html and retain reference to both the dom and scope var template = angular.element('<div ng:click="clicked = true">click me</div>'), scope = angular.compile(template)(); // at this point template was transformed into a view </pre> * * * @param {string|DOMElement} element Element or HTML to compile into a template function. * @returns {function([scope][, cloneAttachFn])} a template function which is used to bind template * (a DOM element/tree) to a scope. Where: * * * `scope` - A {@link angular.scope Scope} to bind to. If none specified, then a new * root scope is created. * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the * `template` and call the `cloneAttachFn` function allowing the caller to attach the * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is * called as: <br/> `cloneAttachFn(clonedElement, scope)` where: * * * `clonedElement` - is a clone of the original `element` passed into the compiler. * * `scope` - is the current scope with which the linking function is working with. * * Calling the template function returns the scope to which the element is bound to. It is either * the same scope as the one passed into the template function, or if none were provided it's the * newly create scope. * * If you need access to the bound view, there are two ways to do it: * * - If you are not asking the linking function to clone the template, create the DOM element(s) * before you send them to the compiler and keep this reference around. * <pre> * var view = angular.element('<p>{{total}}</p>'), * scope = angular.compile(view)(); * </pre> * * - if on the other hand, you need the element to be cloned, the view reference from the original * example would not point to the clone, but rather to the original template that was cloned. In * this case, you can access the clone via the cloneAttachFn: * <pre> * var original = angular.element('<p>{{total}}</p>'), * scope = someParentScope.$new(), * clone; * * angular.compile(original)(scope, function(clonedElement, scope) { * clone = clonedElement; * //attach the clone to DOM document at the right place * }); * * //now we have reference to the cloned DOM via `clone` * </pre> * * * Compiler Methods For Widgets and Directives: * * The following methods are available for use when you write your own widgets, directives, * and markup. (Recall that the compile function's this is a reference to the compiler.) * * `compile(element)` - returns linker - * Invoke a new instance of the compiler to compile a DOM element and return a linker function. * You can apply the linker function to the original element or a clone of the original element. * The linker function returns a scope. * * * `comment(commentText)` - returns element - Create a comment element. * * * `element(elementName)` - returns element - Create an element by name. * * * `text(text)` - returns element - Create a text element. * * * `descend([set])` - returns descend state (true or false). Get or set the current descend * state. If true the compiler will descend to children elements. * * * `directives([set])` - returns directive state (true or false). Get or set the current * directives processing state. The compiler will process directives only when directives set to * true. * * For information on how the compiler works, see the * {@link guide/dev_guide.compiler Angular HTML Compiler} section of the Developer Guide. */ function Compiler(markup, attrMarkup, directives, widgets){ this.markup = markup; this.attrMarkup = attrMarkup; this.directives = directives; this.widgets = widgets; } Compiler.prototype = { compile: function(templateElement) { templateElement = jqLite(templateElement); var index = 0, template, parent = templateElement.parent(); if (templateElement.length > 1) { // https://github.com/angular/angular.js/issues/338 throw Error("Cannot compile multiple element roots: " + jqLite('<div>').append(templateElement.clone()).html()); } if (parent && parent[0]) { parent = parent[0]; for(var i = 0; i < parent.childNodes.length; i++) { if (parent.childNodes[i] == templateElement[0]) { index = i; } } } template = this.templatize(templateElement, index) || new Template(); return function(scope, cloneConnectFn){ // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart // and sometimes changes the structure of the DOM. var element = cloneConnectFn ? JQLitePrototype.clone.call(templateElement) // IMPORTANT!!! : templateElement; scope = scope || createScope(); element.data($$scope, scope); scope.$element = element; (cloneConnectFn||noop)(element, scope); template.link(element, scope); return scope; }; }, templatize: function(element, elementIndex){ var self = this, widget, fn, directiveFns = self.directives, descend = true, directives = true, elementName = nodeName_(element), elementNamespace = elementName.indexOf(':') > 0 ? lowercase(elementName).replace(':', '-') : '', template, selfApi = { compile: bind(self, self.compile), descend: function(value){ if(isDefined(value)) descend = value; return descend;}, directives: function(value){ if(isDefined(value)) directives = value; return directives;}, scope: function(value){ if(isDefined(value)) template.newScope = template.newScope || value; return template.newScope;} }; element.addClass(elementNamespace); template = new Template(); eachAttribute(element, function(value, name){ if (!widget) { if ((widget = self.widgets('@' + name))) { element.addClass('ng-attr-widget'); widget = bind(selfApi, widget, value, element); } } }); if (!widget) { if ((widget = self.widgets(elementName))) { if (elementNamespace) element.addClass('ng-widget'); widget = bind(selfApi, widget, element); } } if (widget) { descend = false; directives = false; var parent = element.parent(); template.addLinkFn(widget.call(selfApi, element)); if (parent && parent[0]) { element = jqLite(parent[0].childNodes[elementIndex]); } } if (descend){ // process markup for text nodes only for(var i=0, child=element[0].childNodes; i<child.length; i++) { if (isTextNode(child[i])) { forEach(self.markup, function(markup){ if (i<child.length) { var textNode = jqLite(child[i]); markup.call(selfApi, textNode.text(), textNode, element); } }); } } } if (directives) { // Process attributes/directives eachAttribute(element, function(value, name){ forEach(self.attrMarkup, function(markup){ markup.call(selfApi, value, name, element); }); }); eachAttribute(element, function(value, name){ fn = directiveFns[name]; if (fn) { element.addClass('ng-directive'); template.addLinkFn((directiveFns[name]).call(selfApi, value, element)); } }); } // Process non text child nodes if (descend) { eachNode(element, function(child, i){ template.addChild(i, self.templatize(child, i)); }); } return template.empty() ? null : template; } }; function eachNode(element, fn){ var i, chldNodes = element[0].childNodes || [], chld; for (i = 0; i < chldNodes.length; i++) { if(!isTextNode(chld = chldNodes[i])) { fn(jqLite(chld), i); } } } function eachAttribute(element, fn){ var i, attrs = element[0].attributes || [], chld, attr, name, value, attrValue = {}; for (i = 0; i < attrs.length; i++) { attr = attrs[i]; name = attr.name; value = attr.value; if (msie && name == 'href') { value = decodeURIComponent(element[0].getAttribute(name, 2)); } attrValue[name] = value; } forEachSorted(attrValue, fn); } /** * DESIGN NOTES * * The design decisions behind the scope ware heavily favored for speed and memory consumption. * * The typical use of scope is to watch the expressions, which most of the time return the same * value as last time so we optimize the operation. * * Closures construction is expensive from speed as well as memory: * - no closures, instead ups prototypical inheritance for API * - Internal state needs to be stored on scope directly, which means that private state is * exposed as $$____ properties * * Loop operations are optimized by using while(count--) { ... } * - this means that in order to keep the same order of execution as addition we have to add * items to the array at the begging (shift) instead of at the end (push) * * Child scopes are created and removed often * - Using array would be slow since inserts in meddle are expensive so we use linked list * * There are few watches then a lot of observers. This is why you don't want the observer to be * implemented in the same way as watch. Watch requires return of initialization function which * are expensive to construct. */ function createScope(providers, instanceCache) { var scope = new Scope(); (scope.$service = createInjector(scope, providers, instanceCache)).eager(); return scope; } /** * @ngdoc function * @name angular.scope * * @description * A root scope can be created by calling {@link angular.scope angular.scope()}. Child scopes * are created using the {@link angular.scope.$new $new()} method. * (Most scopes are created automatically when compiled HTML template is executed.) * * Here is a simple scope snippet to show how you can interact with the scope. * <pre> var scope = angular.scope(); scope.salutation = 'Hello'; scope.name = 'World'; expect(scope.greeting).toEqual(undefined); scope.$watch('name', function(){ this.greeting = this.salutation + ' ' + this.name + '!'; }); // initialize the watch expect(scope.greeting).toEqual(undefined); scope.name = 'Misko'; // still old value, since watches have not been called yet expect(scope.greeting).toEqual(undefined); scope.$digest(); // fire all the watches expect(scope.greeting).toEqual('Hello Misko!'); * </pre> * * # Inheritance * A scope can inherit from a parent scope, as in this example: * <pre> var parent = angular.scope(); var child = parent.$new(); parent.salutation = "Hello"; child.name = "World"; expect(child.salutation).toEqual('Hello'); child.salutation = "Welcome"; expect(child.salutation).toEqual('Welcome'); expect(parent.salutation).toEqual('Hello'); * </pre> * * # Dependency Injection * See {@link guide/dev_guide.di dependency injection}. * * * @param {Object.<string, function()>=} providers Map of service factory which need to be provided * for the current scope. Defaults to {@link angular.service}. * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should * append/override services provided by `providers`. This is handy when unit-testing and having * the need to override a default service. * @returns {Object} Newly created scope. * */ function Scope() { this.$id = nextUid(); this.$$phase = this.$parent = this.$$watchers = this.$$nextSibling = this.$$prevSibling = this.$$childHead = this.$$childTail = null; this.$destructor = noop; this['this'] = this.$root = this; this.$$asyncQueue = []; this.$$listeners = {}; } /** * @ngdoc property * @name angular.scope.$id * @returns {number} Unique scope ID (monotonically increasing alphanumeric sequence) useful for * debugging. */ /** * @ngdoc property * @name angular.scope.$service * @function * * @description * Provides reference to an instance of {@link angular.injector injector} which can be used to * retrieve {@link angular.service services}. In general the use of this api is discouraged, * in favor of proper {@link guide/dev_guide.di dependency injection}. * * @returns {function} {@link angular.injector injector} */ /** * @ngdoc property * @name angular.scope.$root * @returns {Scope} The root scope of the current scope hierarchy. */ /** * @ngdoc property * @name angular.scope.$parent * @returns {Scope} The parent scope of the current scope. */ Scope.prototype = { /** * @ngdoc function * @name angular.scope.$new * @function * * @description * Creates a new child {@link angular.scope scope}. The new scope can optionally behave as a * controller. The parent scope will propagate the {@link angular.scope.$digest $digest()} and * {@link angular.scope.$digest $digest()} events. The scope can be removed from the scope * hierarchy using {@link angular.scope.$destroy $destroy()}. * * {@link angular.scope.$destroy $destroy()} must be called on a scope when it is desired for * the scope and its child scopes to be permanently detached from the parent and thus stop * participating in model change detection and listener notification by invoking. * * @param {function()=} Class Constructor function which the scope should be applied to the scope. * @param {...*} curryArguments Any additional arguments which are curried into the constructor. * See {@link guide/dev_guide.di dependency injection}. * @returns {Object} The newly created child scope. * */ $new: function(Class, curryArguments) { var Child = function() {}; // should be anonymous; This is so that when the minifier munges // the name it does not become random set of chars. These will then show up as class // name in the debugger. var child; Child.prototype = this; child = new Child(); child['this'] = child; child.$$listeners = {}; child.$parent = this; child.$id = nextUid(); child.$$asyncQueue = []; child.$$phase = child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null; child.$$prevSibling = this.$$childTail; if (this.$$childHead) { this.$$childTail.$$nextSibling = child; this.$$childTail = child; } else { this.$$childHead = this.$$childTail = child; } // short circuit if we have no class if (Class) { // can't use forEach, we need speed! var ClassPrototype = Class.prototype; for(var key in ClassPrototype) { child[key] = bind(child, ClassPrototype[key]); } this.$service.invoke(child, Class, curryArguments); } return child; }, /** * @ngdoc function * @name angular.scope.$watch * @function * * @description * Registers a `listener` callback to be executed whenever the `watchExpression` changes. * * - The `watchExpression` is called on every call to {@link angular.scope.$digest $digest()} and * should return the value which will be watched. (Since {@link angular.scope.$digest $digest()} * reruns when it detects changes the `watchExpression` can execute multiple times per * {@link angular.scope.$digest $digest()} and should be idempotent.) * - The `listener` is called only when the value from the current `watchExpression` and the * previous call to `watchExpression' are not equal. The inequality is determined according to * {@link angular.equals} function. To save the value of the object for later comparison * {@link angular.copy} function is used. It also means that watching complex options will * have adverse memory and performance implications. * - The watch `listener` may change the model, which may trigger other `listener`s to fire. This * is achieved by rerunning the watchers until no changes are detected. The rerun iteration * limit is 100 to prevent infinity loop deadlock. * * * If you want to be notified whenever {@link angular.scope.$digest $digest} is called, * you can register an `watchExpression` function with no `listener`. (Since `watchExpression`, * can execute multiple times per {@link angular.scope.$digest $digest} cycle when a change is * detected, be prepared for multiple calls to your listener.) * * * # Example <pre> var scope = angular.scope(); scope.name = 'misko'; scope.counter = 0; expect(scope.counter).toEqual(0); scope.$watch('name', function(scope, newValue, oldValue) { counter = counter + 1; }); expect(scope.counter).toEqual(0); scope.$digest(); // no variable change expect(scope.counter).toEqual(0); scope.name = 'adam'; scope.$digest(); expect(scope.counter).toEqual(1); </pre> * * * * @param {(function()|string)} watchExpression Expression that is evaluated on each * {@link angular.scope.$digest $digest} cycle. A change in the return value triggers a * call to the `listener`. * * - `string`: Evaluated as {@link guide/dev_guide.expressions expression} * - `function(scope)`: called with current `scope` as a parameter. * @param {(function()|string)=} listener Callback called whenever the return value of * the `watchExpression` changes. * * - `string`: Evaluated as {@link guide/dev_guide.expressions expression} * - `function(scope, newValue, oldValue)`: called with current `scope` an previous and * current values as parameters. * @returns {function()} Returns a deregistration function for this listener. */ $watch: function(watchExp, listener) { var scope = this, get = compileToFn(watchExp, 'watch'), listenFn = compileToFn(listener || noop, 'listener'), array = scope.$$watchers, watcher = { fn: listenFn, last: Number.NaN, // NaN !== NaN. We used this to force $watch to fire on first run. get: get }; if (!array) { array = scope.$$watchers = []; } // we use unshift since we use a while loop in $digest for speed. // the while loop reads in reverse order. array.unshift(watcher); return function() { angularArray.remove(array, watcher); }; }, /** * @ngdoc function * @name angular.scope.$digest * @function * * @description * Process all of the {@link angular.scope.$watch watchers} of the current scope and its children. * Because a {@link angular.scope.$watch watcher}'s listener can change the model, the * `$digest()` keeps calling the {@link angular.scope.$watch watchers} until no more listeners are * firing. This means that it is possible to get into an infinite loop. This function will throw * `'Maximum iteration limit exceeded.'` if the number of iterations exceeds 100. * * Usually you don't call `$digest()` directly in * {@link angular.directive.ng:controller controllers} or in {@link angular.directive directives}. * Instead a call to {@link angular.scope.$apply $apply()} (typically from within a * {@link angular.directive directive}) will force a `$digest()`. * * If you want to be notified whenever `$digest()` is called, * you can register a `watchExpression` function with {@link angular.scope.$watch $watch()} * with no `listener`. * * You may have a need to call `$digest()` from within unit-tests, to simulate the scope * life-cycle. * * # Example <pre> var scope = angular.scope(); scope.name = 'misko'; scope.counter = 0; expect(scope.counter).toEqual(0); scope.$digest('name', function(scope, newValue, oldValue) { counter = counter + 1; }); expect(scope.counter).toEqual(0); scope.$digest(); // no variable change expect(scope.counter).toEqual(0); scope.name = 'adam'; scope.$digest(); expect(scope.counter).toEqual(1); </pre> * */ $digest: function() { var watch, value, last, watchers, asyncQueue, length, dirty, ttl = 100, next, current, target = this; if (target.$$phase) { throw Error(target.$$phase + ' already in progress'); } do { dirty = false; current = target; do { current.$$phase = '$digest'; asyncQueue = current.$$asyncQueue; while(asyncQueue.length) { try { current.$eval(asyncQueue.shift()); } catch (e) { current.$service('$exceptionHandler')(e); } } if ((watchers = current.$$watchers)) { // process our watches length = watchers.length; while (length--) { try { watch = watchers[length]; // Most common watches are on primitives, in which case we can short // circuit it with === operator, only when === fails do we use .equals if ((value = watch.get(current)) !== (last = watch.last) && !equals(value, last)) { dirty = true; watch.fn(current, watch.last = copy(value), last); } } catch (e) { current.$service('$exceptionHandler')(e); } } } current.$$phase = null; // Insanity Warning: scope depth-first traversal // yes, this code is a bit crazy, but it works and we have tests to prove it! // this piece should be kept in sync with the traversal in $broadcast if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) { while(current !== target && !(next = current.$$nextSibling)) { current = current.$parent; } } } while ((current = next)); if(!(ttl--)) { throw Error('100 $digest() iterations reached. Aborting!'); } } while (dirty); }, /** * @ngdoc function * @name angular.scope.$destroy * @function * * @description * Remove the current scope (and all of its children) from the parent scope. Removal implies * that calls to {@link angular.scope.$digest $digest()} will no longer propagate to the current * scope and its children. Removal also implies that the current scope is eligible for garbage * collection. * * The destructing scope emits an `$destroy` {@link angular.scope.$emit event}. * * The `$destroy()` is usually used by directives such as * {@link angular.widget.@ng:repeat ng:repeat} for managing the unrolling of the loop. * */ $destroy: function() { if (this.$root == this) return; // we can't remove the root node; this.$emit('$destroy'); var parent = this.$parent; if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling; if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling; if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling; if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling; }, /** * @ngdoc function * @name angular.scope.$eval * @function * * @description * Executes the `expression` on the current scope returning the result. Any exceptions in the * expression are propagated (uncaught). This is useful when evaluating engular expressions. * * # Example <pre> var scope = angular.scope(); scope.a = 1; scope.b = 2; expect(scope.$eval('a+b')).toEqual(3); expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3); </pre> * * @param {(string|function())=} expression An angular expression to be executed. * * - `string`: execute using the rules as defined in {@link guide/dev_guide.expressions expression}. * - `function(scope)`: execute the function with the current `scope` parameter. * * @returns {*} The result of evaluating the expression. */ $eval: function(expr) { var fn = isString(expr) ? expressionCompile(expr) : expr || noop; return fn(this); }, /** * @ngdoc function * @name angular.scope.$evalAsync * @function * * @description * Executes the expression on the current scope at a later point in time. * * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only that: * * - it will execute in the current script execution context (before any DOM rendering). * - at least one {@link angular.scope.$digest $digest cycle} will be performed after * `expression` execution. * * Any exceptions from the execution of the expression are forwarded to the * {@link angular.service.$exceptionHandler $exceptionHandler} service. * * @param {(string|function())=} expression An angular expression to be executed. * * - `string`: execute using the rules as defined in {@link guide/dev_guide.expressions expression}. * - `function(scope)`: execute the function with the current `scope` parameter. * */ $evalAsync: function(expr) { this.$$asyncQueue.push(expr); }, /** * @ngdoc function * @name angular.scope.$apply * @function * * @description * `$apply()` is used to execute an expression in angular from outside of the angular framework. * (For example from browser DOM events, setTimeout, XHR or third party libraries). * Because we are calling into the angular framework we need to perform proper scope life-cycle * of {@link angular.service.$exceptionHandler exception handling}, * {@link angular.scope.$digest executing watches}. * * ## Life cycle * * # Pseudo-Code of `$apply()` function $apply(expr) { try { return $eval(expr); } catch (e) { $exceptionHandler(e); } finally { $root.$digest(); } } * * * Scope's `$apply()` method transitions through the following stages: * * 1. The {@link guide/dev_guide.expressions expression} is executed using the * {@link angular.scope.$eval $eval()} method. * 2. Any exceptions from the execution of the expression are forwarded to the * {@link angular.service.$exceptionHandler $exceptionHandler} service. * 3. The {@link angular.scope.$watch watch} listeners are fired immediately after the expression * was executed using the {@link angular.scope.$digest $digest()} method. * * * @param {(string|function())=} exp An angular expression to be executed. * * - `string`: execute using the rules as defined in {@link guide/dev_guide.expressions expression}. * - `function(scope)`: execute the function with current `scope` parameter. * * @returns {*} The result of evaluating the expression. */ $apply: function(expr) { try { return this.$eval(expr); } catch (e) { this.$service('$exceptionHandler')(e); } finally { this.$root.$digest(); } }, /** * @ngdoc function * @name angular.scope.$on * @function * * @description * Listen on events of a given type. See {@link angular.scope.$emit $emit} for discussion of * event life cycle. * * @param {string} name Event name to listen on. * @param {function(event)} listener Function to call when the event is emitted. * @returns {function()} Returns a deregistration function for this listener. * * The event listener function format is: `function(event)`. The `event` object passed into the * listener has the following attributes * - `targetScope` - {Scope}: the scope on which the event was `$emit`-ed or `$broadcast`-ed. * - `currentScope` - {Scope}: the current scope which is handling the event. * - `name` - {string}: Name of the event. * - `cancel` - {function=}: calling `cancel` function will cancel further event propagation * (available only for events that were `$emit`-ed). */ $on: function(name, listener) { var namedListeners = this.$$listeners[name]; if (!namedListeners) { this.$$listeners[name] = namedListeners = []; } namedListeners.push(listener); return function() { angularArray.remove(namedListeners, listener); }; }, /** * @ngdoc function * @name angular.scope.$emit * @function * * @description * Dispatches an event `name` upwards through the scope hierarchy notifying the * registered {@link angular.scope.$on} listeners. * * The event life cycle starts at the scope on which `$emit` was called. All * {@link angular.scope.$on listeners} listening for `name` event on this scope get notified. * Afterwards, the event traverses upwards toward the root scope and calls all registered * listeners along the way. The event will stop propagating if one of the listeners cancels it. * * Any exception emmited from the {@link angular.scope.$on listeners} will be passed * onto the {@link angular.service.$exceptionHandler $exceptionHandler} service. * * @param {string} name Event name to emit. * @param {...*} args Optional set of arguments which will be passed onto the event listeners. */ $emit: function(name, args) { var empty = [], namedListeners, canceled = false, scope = this, event = { name: name, targetScope: scope, cancel: function(){canceled = true;} }, listenerArgs = concat([event], arguments, 1), i, length; do { namedListeners = scope.$$listeners[name] || empty; event.currentScope = scope; for (i=0, length=namedListeners.length; i<length; i++) { try { namedListeners[i].apply(null, listenerArgs); if (canceled) return; } catch (e) { scope.$service('$exceptionHandler')(e); } } //traverse upwards scope = scope.$parent; } while (scope); }, /** * @ngdoc function * @name angular.scope.$broadcast * @function * * @description * Dispatches an event `name` downwards to all child scopes (and their children) notifying the * registered {@link angular.scope.$on} listeners. * * The event life cycle starts at the scope on which `$broadcast` was called. All * {@link angular.scope.$on listeners} listening for `name` event on this scope get notified. * Afterwards, the event propagates to all direct and indirect scopes of the current scope and * calls all registered listeners along the way. The event cannot be canceled. * * Any exception emmited from the {@link angular.scope.$on listeners} will be passed * onto the {@link angular.service.$exceptionHandler $exceptionHandler} service. * * @param {string} name Event name to emit. * @param {...*} args Optional set of arguments which will be passed onto the event listeners. */ $broadcast: function(name, args) { var target = this, current = target, next = target, event = { name: name, targetScope: target }, listenerArgs = concat([event], arguments, 1); //down while you can, then up and next sibling or up and next sibling until back at root do { current = next; event.currentScope = current; forEach(current.$$listeners[name], function(listener) { try { listener.apply(null, listenerArgs); } catch(e) { current.$service('$exceptionHandler')(e); } }); // Insanity Warning: scope depth-first traversal // yes, this code is a bit crazy, but it works and we have tests to prove it! // this piece should be kept in sync with the traversal in $digest if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) { while(current !== target && !(next = current.$$nextSibling)) { current = current.$parent; } } } while ((current = next)); } }; function compileToFn(exp, name) { var fn = isString(exp) ? expressionCompile(exp) : exp; assertArgFn(fn, name); return fn; } /** * @ngdoc function * @name angular.injector * @function * * @description * Creates an injector function that can be used for retrieving services as well as for * dependency injection (see {@link guide/dev_guide.di dependency injection}). * * Angular creates an injector automatically for the root scope and it is available as the * {@link angular.scope.$service $service} property. Creating an injector doesn't automatically * create all of the `$eager` {@link angular.service services}. You have to call `injector.eager()` * to initialize them. * * @param {Object=} [factoryScope={}] The `this` for the service factory function. * @param {Object.<string, function()>=} [factories=angular.service] Map of the service factory * functions. * @param {Object.<string, function()>=} [instanceCache={}] Place where instances of services are * saved for reuse. Can also be used to override services specified by `serviceFactory` * (useful in tests). * @returns {function()} Injector function: * * * `injector(serviceName)`: * * `serviceName` - `{string=}` - Name of the service to retrieve. * * The injector function also has these properties: * * * An `invoke` property which can be used to invoke methods with dependency-injected arguments. * `injector.invoke(self, fn, curryArgs)` * * `self` - The "`this`" to be used when invoking the function. * * `fn` - The function to be invoked. The function may have the `$inject` property that * lists the set of arguments which should be auto-injected. * (see {@link guide/dev_guide.di dependency injection}). * * `curryArgs(array)` - Optional array of arguments to pass to the function * invocation after the injection arguments (also known as curry arguments or currying). * * An `eager` property which is used to initialize the eager services. * `injector.eager()` */ function createInjector(factoryScope, factories, instanceCache) { factories = factories || angularService; instanceCache = instanceCache || {}; factoryScope = factoryScope || {}; injector.invoke = invoke; injector.eager = function(){ forEach(factories, function(factory, name){ if (factory.$eager) injector(name); if (factory.$creation) throw new Error("Failed to register service '" + name + "': $creation property is unsupported. Use $eager:true or see release notes."); }); }; return injector; function injector(value){ if (!(value in instanceCache)) { var factory = factories[value]; if (!factory) throw Error("Unknown provider for '"+value+"'."); instanceCache[value] = invoke(factoryScope, factory); } return instanceCache[value]; } function invoke(self, fn, args){ args = args || []; var injectNames = injectionArgs(fn); var i = injectNames.length; while(i--) { args.unshift(injector(injectNames[i])); } return fn.apply(self, args); } } /** * THIS IS NOT PUBLIC DOC YET! * * @name angular.annotate * @function * * @description * Annotate the function with injection arguments. This is equivalent to setting the `$inject` * property as described in {@link guide.di dependency injection}. * * <pre> * var MyController = angular.annotate('$location', function($location){ ... }); * </pre> * * is the same as * * <pre> * var MyController = function($location){ ... }; * MyController.$inject = ['$location']; * </pre> * * @param {String|Array} serviceName... zero or more service names to inject into the * `annotatedFunction`. * @param {function} annotatedFunction function to annotate with `$inject` * functions. * @returns {function} `annotatedFunction` */ function annotate(services, fn) { if (services instanceof Array) { fn.$inject = services; return fn; } else { var i = 0, length = arguments.length - 1, // last one is the destination function $inject = arguments[length].$inject = []; for (; i < length; i++) { $inject.push(arguments[i]); } return arguments[length]; // return the last one } } function angularServiceInject(name, fn, inject, eager) { angularService(name, fn, {$inject:inject, $eager:eager}); } /** * @returns the $inject property of function. If not found the * the $inject is computed by looking at the toString of function and * extracting all arguments which and assuming that they are the * injection names. */ var FN_ARGS = /^function\s*[^\(]*\(([^\)]*)\)/m; var FN_ARG_SPLIT = /,/; var FN_ARG = /^\s*(.+?)\s*$/; var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; function injectionArgs(fn) { assertArgFn(fn); if (!fn.$inject) { var args = fn.$inject = []; var fnText = fn.toString().replace(STRIP_COMMENTS, ''); var argDecl = fnText.match(FN_ARGS); forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){ arg.replace(FN_ARG, function(all, name){ args.push(name); }); }); } return fn.$inject; } var OPERATORS = { 'null':function(self){return null;}, 'true':function(self){return true;}, 'false':function(self){return false;}, $undefined:noop, '+':function(self, a,b){return (isDefined(a)?a:0)+(isDefined(b)?b:0);}, '-':function(self, a,b){return (isDefined(a)?a:0)-(isDefined(b)?b:0);}, '*':function(self, a,b){return a*b;}, '/':function(self, a,b){return a/b;}, '%':function(self, a,b){return a%b;}, '^':function(self, a,b){return a^b;}, '=':noop, '==':function(self, a,b){return a==b;}, '!=':function(self, a,b){return a!=b;}, '<':function(self, a,b){return a<b;}, '>':function(self, a,b){return a>b;}, '<=':function(self, a,b){return a<=b;}, '>=':function(self, a,b){return a>=b;}, '&&':function(self, a,b){return a&&b;}, '||':function(self, a,b){return a||b;}, '&':function(self, a,b){return a&b;}, // '|':function(self, a,b){return a|b;}, '|':function(self, a,b){return b(self, a);}, '!':function(self, a){return !a;} }; var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'}; function lex(text, parseStringsForObjects){ var dateParseLength = parseStringsForObjects ? DATE_ISOSTRING_LN : -1, tokens = [], token, index = 0, json = [], ch, lastCh = ':'; // can start regexp while (index < text.length) { ch = text.charAt(index); if (is('"\'')) { readString(ch); } else if (isNumber(ch) || is('.') && isNumber(peek())) { readNumber(); } else if (isIdent(ch)) { readIdent(); // identifiers can only be if the preceding char was a { or , if (was('{,') && json[0]=='{' && (token=tokens[tokens.length-1])) { token.json = token.text.indexOf('.') == -1; } } else if (is('(){}[].,;:')) { tokens.push({ index:index, text:ch, json:(was(':[,') && is('{[')) || is('}]:,') }); if (is('{[')) json.unshift(ch); if (is('}]')) json.shift(); index++; } else if (isWhitespace(ch)) { index++; continue; } else { var ch2 = ch + peek(), fn = OPERATORS[ch], fn2 = OPERATORS[ch2]; if (fn2) { tokens.push({index:index, text:ch2, fn:fn2}); index += 2; } else if (fn) { tokens.push({index:index, text:ch, fn:fn, json: was('[,:') && is('+-')}); index += 1; } else { throwError("Unexpected next character ", index, index+1); } } lastCh = ch; } return tokens; function is(chars) { return chars.indexOf(ch) != -1; } function was(chars) { return chars.indexOf(lastCh) != -1; } function peek() { return index + 1 < text.length ? text.charAt(index + 1) : false; } function isNumber(ch) { return '0' <= ch && ch <= '9'; } function isWhitespace(ch) { return ch == ' ' || ch == '\r' || ch == '\t' || ch == '\n' || ch == '\v' || ch == '\u00A0'; // IE treats non-breaking space as \u00A0 } function isIdent(ch) { return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || '_' == ch || ch == '$'; } function isExpOperator(ch) { return ch == '-' || ch == '+' || isNumber(ch); } function throwError(error, start, end) { end = end || index; throw Error("Lexer Error: " + error + " at column" + (isDefined(start) ? "s " + start + "-" + index + " [" + text.substring(start, end) + "]" : " " + end) + " in expression [" + text + "]."); } function readNumber() { var number = ""; var start = index; while (index < text.length) { var ch = lowercase(text.charAt(index)); if (ch == '.' || isNumber(ch)) { number += ch; } else { var peekCh = peek(); if (ch == 'e' && isExpOperator(peekCh)) { number += ch; } else if (isExpOperator(ch) && peekCh && isNumber(peekCh) && number.charAt(number.length - 1) == 'e') { number += ch; } else if (isExpOperator(ch) && (!peekCh || !isNumber(peekCh)) && number.charAt(number.length - 1) == 'e') { throwError('Invalid exponent'); } else { break; } } index++; } number = 1 * number; tokens.push({index:start, text:number, json:true, fn:function(){return number;}}); } function readIdent() { var ident = ""; var start = index; var fn; while (index < text.length) { var ch = text.charAt(index); if (ch == '.' || isIdent(ch) || isNumber(ch)) { ident += ch; } else { break; } index++; } fn = OPERATORS[ident]; tokens.push({ index:start, text:ident, json: fn, fn:fn||extend(getterFn(ident), { assign:function(self, value){ return setter(self, ident, value); } }) }); } function readString(quote) { var start = index; index++; var string = ""; var rawString = quote; var escape = false; while (index < text.length) { var ch = text.charAt(index); rawString += ch; if (escape) { if (ch == 'u') { var hex = text.substring(index + 1, index + 5); if (!hex.match(/[\da-f]{4}/i)) throwError( "Invalid unicode escape [\\u" + hex + "]"); index += 4; string += String.fromCharCode(parseInt(hex, 16)); } else { var rep = ESCAPE[ch]; if (rep) { string += rep; } else { string += ch; } } escape = false; } else if (ch == '\\') { escape = true; } else if (ch == quote) { index++; tokens.push({index:start, text:rawString, string:string, json:true, fn:function(){ return (string.length == dateParseLength) ? angular['String']['toDate'](string) : string; }}); return; } else { string += ch; } index++; } throwError("Unterminated quote", start); } } ///////////////////////////////////////// function parser(text, json){ var ZERO = valueFn(0), tokens = lex(text, json), assignment = _assignment, assignable = logicalOR, functionCall = _functionCall, fieldAccess = _fieldAccess, objectIndex = _objectIndex, filterChain = _filterChain, functionIdent = _functionIdent, pipeFunction = _pipeFunction; if(json){ // The extra level of aliasing is here, just in case the lexer misses something, so that // we prevent any accidental execution in JSON. assignment = logicalOR; functionCall = fieldAccess = objectIndex = assignable = filterChain = functionIdent = pipeFunction = function (){ throwError("is not valid json", {text:text, index:0}); }; } //TODO: Shouldn't all of the public methods have assertAllConsumed? //TODO: I think these should be public as part of the parser api instead of scope.$eval(). return { assignable: assertConsumed(assignable), primary: assertConsumed(primary), statements: assertConsumed(statements), validator: assertConsumed(validator), formatter: assertConsumed(formatter), filter: assertConsumed(filter) }; function assertConsumed(fn) { return function(){ var value = fn(); if (tokens.length !== 0) { throwError("is an unexpected token", tokens[0]); } return value; }; } /////////////////////////////////// function throwError(msg, token) { throw Error("Syntax Error: Token '" + token.text + "' " + msg + " at column " + (token.index + 1) + " of the expression [" + text + "] starting at [" + text.substring(token.index) + "]."); } function peekToken() { if (tokens.length === 0) throw Error("Unexpected end of expression: " + text); return tokens[0]; } function peek(e1, e2, e3, e4) { if (tokens.length > 0) { var token = tokens[0]; var t = token.text; if (t==e1 || t==e2 || t==e3 || t==e4 || (!e1 && !e2 && !e3 && !e4)) { return token; } } return false; } function expect(e1, e2, e3, e4){ var token = peek(e1, e2, e3, e4); if (token) { if (json && !token.json) { throwError("is not valid json", token); } tokens.shift(); return token; } return false; } function consume(e1){ if (!expect(e1)) { throwError("is unexpected, expecting [" + e1 + "]", peek()); } } function unaryFn(fn, right) { return function(self) { return fn(self, right(self)); }; } function binaryFn(left, fn, right) { return function(self) { return fn(self, left(self), right(self)); }; } function hasTokens () { return tokens.length > 0; } function statements(){ var statements = []; while(true) { if (tokens.length > 0 && !peek('}', ')', ';', ']')) statements.push(filterChain()); if (!expect(';')) { // optimize for the common case where there is only one statement. // TODO(size): maybe we should not support multiple statements? return statements.length == 1 ? statements[0] : function (self){ var value; for ( var i = 0; i < statements.length; i++) { var statement = statements[i]; if (statement) value = statement(self); } return value; }; } } } function _filterChain(){ var left = expression(); var token; while(true) { if ((token = expect('|'))) { left = binaryFn(left, token.fn, filter()); } else { return left; } } } function filter(){ return pipeFunction(angularFilter); } function validator(){ return pipeFunction(angularValidator); } function formatter(){ var token = expect(); var formatter = angularFormatter[token.text]; var argFns = []; if (!formatter) throwError('is not a valid formatter.', token); while(true) { if ((token = expect(':'))) { argFns.push(expression()); } else { return valueFn({ format:invokeFn(formatter.format), parse:invokeFn(formatter.parse) }); } } function invokeFn(fn){ return function(self, input){ var args = [input]; for ( var i = 0; i < argFns.length; i++) { args.push(argFns[i](self)); } return fn.apply(self, args); }; } } function _pipeFunction(fnScope){ var fn = functionIdent(fnScope); var argsFn = []; var token; while(true) { if ((token = expect(':'))) { argsFn.push(expression()); } else { var fnInvoke = function(self, input){ var args = [input]; for ( var i = 0; i < argsFn.length; i++) { args.push(argsFn[i](self)); } return fn.apply(self, args); }; return function(){ return fnInvoke; }; } } } function expression(){ return assignment(); } function _assignment(){ var left = logicalOR(); var right; var token; if ((token = expect('='))) { if (!left.assign) { throwError("implies assignment but [" + text.substring(0, token.index) + "] can not be assigned to", token); } right = logicalOR(); return function(self){ return left.assign(self, right(self)); }; } else { return left; } } function logicalOR(){ var left = logicalAND(); var token; while(true) { if ((token = expect('||'))) { left = binaryFn(left, token.fn, logicalAND()); } else { return left; } } } function logicalAND(){ var left = equality(); var token; if ((token = expect('&&'))) { left = binaryFn(left, token.fn, logicalAND()); } return left; } function equality(){ var left = relational(); var token; if ((token = expect('==','!='))) { left = binaryFn(left, token.fn, equality()); } return left; } function relational(){ var left = additive(); var token; if ((token = expect('<', '>', '<=', '>='))) { left = binaryFn(left, token.fn, relational()); } return left; } function additive(){ var left = multiplicative(); var token; while ((token = expect('+','-'))) { left = binaryFn(left, token.fn, multiplicative()); } return left; } function multiplicative(){ var left = unary(); var token; while ((token = expect('*','/','%'))) { left = binaryFn(left, token.fn, unary()); } return left; } function unary(){ var token; if (expect('+')) { return primary(); } else if ((token = expect('-'))) { return binaryFn(ZERO, token.fn, unary()); } else if ((token = expect('!'))) { return unaryFn(token.fn, unary()); } else { return primary(); } } function _functionIdent(fnScope) { var token = expect(); var element = token.text.split('.'); var instance = fnScope; var key; for ( var i = 0; i < element.length; i++) { key = element[i]; if (instance) instance = instance[key]; } if (!isFunction(instance)) { throwError("should be a function", token); } return instance; } function primary() { var primary; if (expect('(')) { var expression = filterChain(); consume(')'); primary = expression; } else if (expect('[')) { primary = arrayDeclaration(); } else if (expect('{')) { primary = object(); } else { var token = expect(); primary = token.fn; if (!primary) { throwError("not a primary expression", token); } } var next; while ((next = expect('(', '[', '.'))) { if (next.text === '(') { primary = functionCall(primary); } else if (next.text === '[') { primary = objectIndex(primary); } else if (next.text === '.') { primary = fieldAccess(primary); } else { throwError("IMPOSSIBLE"); } } return primary; } function _fieldAccess(object) { var field = expect().text; var getter = getterFn(field); return extend(function (self){ return getter(object(self)); }, { assign:function(self, value){ return setter(object(self), field, value); } }); } function _objectIndex(obj) { var indexFn = expression(); consume(']'); return extend( function (self){ var o = obj(self); var i = indexFn(self); return (o) ? o[i] : undefined; }, { assign:function(self, value){ return obj(self)[indexFn(self)] = value; } }); } function _functionCall(fn) { var argsFn = []; if (peekToken().text != ')') { do { argsFn.push(expression()); } while (expect(',')); } consume(')'); return function (self){ var args = []; for ( var i = 0; i < argsFn.length; i++) { args.push(argsFn[i](self)); } var fnPtr = fn(self) || noop; // IE stupidity! return fnPtr.apply ? fnPtr.apply(self, args) : fnPtr(args[0], args[1], args[2], args[3], args[4]); }; } // This is used with json array declaration function arrayDeclaration () { var elementFns = []; if (peekToken().text != ']') { do { elementFns.push(expression()); } while (expect(',')); } consume(']'); return function (self){ var array = []; for ( var i = 0; i < elementFns.length; i++) { array.push(elementFns[i](self)); } return array; }; } function object () { var keyValues = []; if (peekToken().text != '}') { do { var token = expect(), key = token.string || token.text; consume(":"); var value = expression(); keyValues.push({key:key, value:value}); } while (expect(',')); } consume('}'); return function (self){ var object = {}; for ( var i = 0; i < keyValues.length; i++) { var keyValue = keyValues[i]; var value = keyValue.value(self); object[keyValue.key] = value; } return object; }; } function watchDecl () { var anchorName = expect().text; consume(":"); var expressionFn; if (peekToken().text == '{') { consume("{"); expressionFn = statements(); consume("}"); } else { expressionFn = expression(); } return function(self) { return {name:anchorName, fn:expressionFn}; }; } } ////////////////////////////////////////////////// // Parser helper functions ////////////////////////////////////////////////// function setter(obj, path, setValue) { var element = path.split('.'); for (var i = 0; element.length > 1; i++) { var key = element.shift(); var propertyObj = obj[key]; if (!propertyObj) { propertyObj = {}; obj[key] = propertyObj; } obj = propertyObj; } obj[element.shift()] = setValue; return setValue; } /** * Return the value accesible from the object by path. Any undefined traversals are ignored * @param {Object} obj starting object * @param {string} path path to traverse * @param {boolean=true} bindFnToScope * @returns value as accesbile by path */ function getter(obj, path, bindFnToScope) { if (!path) return obj; var keys = path.split('.'); var key; var lastInstance = obj; var len = keys.length; for (var i = 0; i < len; i++) { key = keys[i]; if (obj) { obj = (lastInstance = obj)[key]; } if (isUndefined(obj) && key.charAt(0) == '$') { var type = angularGlobal.typeOf(lastInstance); type = angular[type.charAt(0).toUpperCase()+type.substring(1)]; var fn = type ? type[[key.substring(1)]] : _undefined; if (fn) { return obj = bind(lastInstance, fn, lastInstance); } } } if (!bindFnToScope && isFunction(obj)) { return bind(lastInstance, obj); } return obj; } var getterFnCache = {}, compileCache = {}, JS_KEYWORDS = {}; forEach( ("abstract,boolean,break,byte,case,catch,char,class,const,continue,debugger,default," + "delete,do,double,else,enum,export,extends,false,final,finally,float,for,function,goto," + "if,implements,import,ininstanceof,intinterface,long,native,new,null,package,private," + "protected,public,return,short,static,super,switch,synchronized,this,throw,throws," + "transient,true,try,typeof,var,volatile,void,undefined,while,with").split(/,/), function(key){ JS_KEYWORDS[key] = true;} ); function getterFn(path) { var fn = getterFnCache[path]; if (fn) return fn; var code = 'var l, fn, t;\n'; forEach(path.split('.'), function(key) { key = (JS_KEYWORDS[key]) ? '["' + key + '"]' : '.' + key; code += 'if(!s) return s;\n' + 'l=s;\n' + 's=s' + key + ';\n' + 'if(typeof s=="function" && !(s instanceof RegExp)) s = function(){ return l' + key + '.apply(l, arguments); };\n'; if (key.charAt(1) == '$') { // special code for super-imposed functions var name = key.substr(2); code += 'if(!s) {\n' + ' t = angular.Global.typeOf(l);\n' + ' fn = (angular[t.charAt(0).toUpperCase() + t.substring(1)]||{})["' + name + '"];\n' + ' if (fn) s = function(){ return fn.apply(l, ' + '[l].concat(Array.prototype.slice.call(arguments, 0))); };\n' + '}\n'; } }); code += 'return s;'; fn = Function('s', code); fn["toString"] = function(){ return code; }; return getterFnCache[path] = fn; } /////////////////////////////////// // TODO(misko): Should this function be public? function compileExpr(expr) { return parser(expr).statements(); } // TODO(misko): Deprecate? Remove! // I think that compilation should be a service. function expressionCompile(exp) { if (isFunction(exp)) return exp; var fn = compileCache[exp]; if (!fn) { fn = compileCache[exp] = parser(exp).statements(); } return fn; } function Route(template, defaults) { this.template = template = template + '#'; this.defaults = defaults || {}; var urlParams = this.urlParams = {}; forEach(template.split(/\W/), function(param){ if (param && template.match(new RegExp(":" + param + "\\W"))) { urlParams[param] = true; } }); } Route.prototype = { url: function(params) { var self = this, url = this.template, encodedVal; params = params || {}; forEach(this.urlParams, function(_, urlParam){ encodedVal = encodeUriSegment(params[urlParam] || self.defaults[urlParam] || ""); url = url.replace(new RegExp(":" + urlParam + "(\\W)"), encodedVal + "$1"); }); url = url.replace(/\/?#$/, ''); var query = []; forEachSorted(params, function(value, key){ if (!self.urlParams[key]) { query.push(encodeUriQuery(key) + '=' + encodeUriQuery(value)); } }); url = url.replace(/\/*$/, ''); return url + (query.length ? '?' + query.join('&') : ''); } }; function ResourceFactory(xhr) { this.xhr = xhr; } ResourceFactory.DEFAULT_ACTIONS = { 'get': {method:'GET'}, 'save': {method:'POST'}, 'query': {method:'GET', isArray:true}, 'remove': {method:'DELETE'}, 'delete': {method:'DELETE'} }; ResourceFactory.prototype = { route: function(url, paramDefaults, actions){ var self = this; var route = new Route(url); actions = extend({}, ResourceFactory.DEFAULT_ACTIONS, actions); function extractParams(data){ var ids = {}; forEach(paramDefaults || {}, function(value, key){ ids[key] = value.charAt && value.charAt(0) == '@' ? getter(data, value.substr(1)) : value; }); return ids; } function Resource(value){ copy(value || {}, this); } forEach(actions, function(action, name){ var isPostOrPut = action.method == 'POST' || action.method == 'PUT'; Resource[name] = function (a1, a2, a3, a4) { var params = {}; var data; var success = noop; var error = null; switch(arguments.length) { case 4: error = a4; success = a3; //fallthrough case 3: case 2: if (isFunction(a2)) { if (isFunction(a1)) { success = a1; error = a2; break; } success = a2; error = a3; //fallthrough } else { params = a1; data = a2; success = a3; break; } case 1: if (isFunction(a1)) success = a1; else if (isPostOrPut) data = a1; else params = a1; break; case 0: break; default: throw "Expected between 0-4 arguments [params, data, success, error], got " + arguments.length + " arguments."; } var value = this instanceof Resource ? this : (action.isArray ? [] : new Resource(data)); self.xhr( action.method, route.url(extend({}, action.params || {}, extractParams(data), params)), data, function(status, response) { if (response) { if (action.isArray) { value.length = 0; forEach(response, function(item) { value.push(new Resource(item)); }); } else { copy(response, value); } } (success||noop)(value); }, error || action.verifyCache, action.verifyCache); return value; }; Resource.bind = function(additionalParamDefaults){ return self.route(url, extend({}, paramDefaults, additionalParamDefaults), actions); }; Resource.prototype['$' + name] = function(a1, a2, a3) { var params = extractParams(this), success = noop, error; switch(arguments.length) { case 3: params = a1; success = a2; error = a3; break; case 2: case 1: if (isFunction(a1)) { success = a1; error = a2; } else { params = a1; success = a2 || noop; } case 0: break; default: throw "Expected between 1-3 arguments [params, success, error], got " + arguments.length + " arguments."; } var data = isPostOrPut ? this : undefined; Resource[name].call(this, params, data, success, error); }; }); return Resource; } }; ////////////////////////////// // Browser ////////////////////////////// var XHR = window.XMLHttpRequest || function () { try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {} try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {} try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e3) {} throw new Error("This browser does not support XMLHttpRequest."); }; /** * @ngdoc service * @name angular.service.$browser * @requires $log * * @description * Constructor for the object exposed as $browser service. * * This object has two goals: * * - hide all the global state in the browser caused by the window object * - abstract away all the browser specific features and inconsistencies * * For tests we provide {@link angular.mock.service.$browser mock implementation} of the `$browser` * service, which can be used for convenient testing of the application without the interaction with * the real browser apis. */ /** * @param {object} window The global window object. * @param {object} document jQuery wrapped document. * @param {object} body jQuery wrapped document.body. * @param {function()} XHR XMLHttpRequest constructor. * @param {object} $log console.log or an object with the same interface. * @param {object} $sniffer $sniffer service */ function Browser(window, document, body, XHR, $log, $sniffer) { var self = this, rawDocument = document[0], location = window.location, history = window.history, setTimeout = window.setTimeout, clearTimeout = window.clearTimeout, pendingDeferIds = {}; self.isMock = false; ////////////////////////////////////////////////////////////// // XHR API ////////////////////////////////////////////////////////////// var idCounter = 0; var outstandingRequestCount = 0; var outstandingRequestCallbacks = []; /** * Executes the `fn` function (supports currying) and decrements the `outstandingRequestCallbacks` * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed. */ function completeOutstandingRequest(fn) { try { fn.apply(null, sliceArgs(arguments, 1)); } finally { outstandingRequestCount--; if (outstandingRequestCount === 0) { while(outstandingRequestCallbacks.length) { try { outstandingRequestCallbacks.pop()(); } catch (e) { $log.error(e); } } } } } /** * @workInProgress * @ngdoc method * @name angular.service.$browser#xhr * @methodOf angular.service.$browser * * @param {string} method Requested method (get|post|put|delete|head|json) * @param {string} url Requested url * @param {?string} post Post data to send (null if nothing to post) * @param {function(number, string)} callback Function that will be called on response * @param {object=} header additional HTTP headers to send with XHR. * Standard headers are: * <ul> * <li><tt>Content-Type</tt>: <tt>application/x-www-form-urlencoded</tt></li> * <li><tt>Accept</tt>: <tt>application/json, text/plain, &#42;/&#42;</tt></li> * <li><tt>X-Requested-With</tt>: <tt>XMLHttpRequest</tt></li> * </ul> * * @description * Send ajax request */ self.xhr = function(method, url, post, callback, headers) { outstandingRequestCount ++; if (lowercase(method) == 'json') { var callbackId = ("angular_" + Math.random() + '_' + (idCounter++)).replace(/\d\./, ''); window[callbackId] = function(data) { window[callbackId].data = data; }; var script = self.addJs(url.replace('JSON_CALLBACK', callbackId), null, function() { if (window[callbackId].data) { completeOutstandingRequest(callback, 200, window[callbackId].data); } else { completeOutstandingRequest(callback); } delete window[callbackId]; body[0].removeChild(script); }); } else { var xhr = new XHR(); xhr.open(method, url, true); forEach(headers, function(value, key) { if (value) xhr.setRequestHeader(key, value); }); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { // normalize IE bug (http://bugs.jquery.com/ticket/1450) var status = xhr.status == 1223 ? 204 : xhr.status; completeOutstandingRequest(callback, status, xhr.responseText); } }; xhr.send(post || ''); } }; /** * @private * Note: this method is used only by scenario runner * TODO(vojta): prefix this method with $$ ? * @param {function()} callback Function that will be called when no outstanding request */ self.notifyWhenNoOutstandingRequests = function(callback) { // force browser to execute all pollFns - this is needed so that cookies and other pollers fire // at some deterministic time in respect to the test runner's actions. Leaving things up to the // regular poller would result in flaky tests. forEach(pollFns, function(pollFn){ pollFn(); }); if (outstandingRequestCount === 0) { callback(); } else { outstandingRequestCallbacks.push(callback); } }; ////////////////////////////////////////////////////////////// // Poll Watcher API ////////////////////////////////////////////////////////////// var pollFns = [], pollTimeout; /** * @workInProgress * @ngdoc method * @name angular.service.$browser#addPollFn * @methodOf angular.service.$browser * * @param {function()} fn Poll function to add * * @description * Adds a function to the list of functions that poller periodically executes, * and starts polling if not started yet. * * @returns {function()} the added function */ self.addPollFn = function(fn) { if (isUndefined(pollTimeout)) startPoller(100, setTimeout); pollFns.push(fn); return fn; }; /** * @param {number} interval How often should browser call poll functions (ms) * @param {function()} setTimeout Reference to a real or fake `setTimeout` function. * * @description * Configures the poller to run in the specified intervals, using the specified * setTimeout fn and kicks it off. */ function startPoller(interval, setTimeout) { (function check() { forEach(pollFns, function(pollFn){ pollFn(); }); pollTimeout = setTimeout(check, interval); })(); } ////////////////////////////////////////////////////////////// // URL API ////////////////////////////////////////////////////////////// var lastBrowserUrl = location.href; /** * @workInProgress * @ngdoc method * @name angular.service.$browser#url * @methodOf angular.service.$browser * * @description * GETTER: * Without any argument, this method just returns current value of location.href. * * SETTER: * With at least one argument, this method sets url to new value. * If html5 history api supported, pushState/replaceState is used, otherwise * location.href/location.replace is used. * Returns its own instance to allow chaining * * NOTE: this api is intended for use only by the $location service. Please use the * {@link angular.service.$location $location service} to change url. * * @param {string} url New url (when used as setter) * @param {boolean=} replace Should new url replace current history record ? */ self.url = function(url, replace) { // setter if (url) { lastBrowserUrl = url; if ($sniffer.history) { if (replace) history.replaceState(null, '', url); else history.pushState(null, '', url); } else { if (replace) location.replace(url); else location.href = url; } return self; // getter } else { return location.href; } }; var urlChangeListeners = [], urlChangeInit = false; function fireUrlChange() { if (lastBrowserUrl == self.url()) return; lastBrowserUrl = self.url(); forEach(urlChangeListeners, function(listener) { listener(self.url()); }); } /** * @workInProgress * @ngdoc method * @name angular.service.$browser#onUrlChange * @methodOf angular.service.$browser * @TODO(vojta): refactor to use node's syntax for events * * @description * Register callback function that will be called, when url changes. * * It's only called when the url is changed by outside of angular: * - user types different url into address bar * - user clicks on history (forward/back) button * - user clicks on a link * * It's not called when url is changed by $browser.url() method * * The listener gets called with new url as parameter. * * NOTE: this api is intended for use only by the $location service. Please use the * {@link angular.service.$location $location service} to monitor url changes in angular apps. * * @param {function(string)} listener Listener function to be called when url changes. * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous. */ self.onUrlChange = function(callback) { if (!urlChangeInit) { // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera) // don't fire popstate when user change the address bar and don't fire hashchange when url // changed by push/replaceState // html5 history api - popstate event if ($sniffer.history) jqLite(window).bind('popstate', fireUrlChange); // hashchange event if ($sniffer.hashchange) jqLite(window).bind('hashchange', fireUrlChange); // polling else self.addPollFn(fireUrlChange); urlChangeInit = true; } urlChangeListeners.push(callback); return callback; }; ////////////////////////////////////////////////////////////// // Cookies API ////////////////////////////////////////////////////////////// var lastCookies = {}; var lastCookieString = ''; /** * @workInProgress * @ngdoc method * @name angular.service.$browser#cookies * @methodOf angular.service.$browser * * @param {string=} name Cookie name * @param {string=} value Cokkie value * * @description * The cookies method provides a 'private' low level access to browser cookies. * It is not meant to be used directly, use the $cookie service instead. * * The return values vary depending on the arguments that the method was called with as follows: * <ul> * <li>cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify it</li> * <li>cookies(name, value) -> set name to value, if value is undefined delete the cookie</li> * <li>cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that way)</li> * </ul> * * @returns {Object} Hash of all cookies (if called without any parameter) */ self.cookies = function (name, value) { var cookieLength, cookieArray, cookie, i, keyValue, index; if (name) { if (value === undefined) { rawDocument.cookie = escape(name) + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; } else { if (isString(value)) { rawDocument.cookie = escape(name) + '=' + escape(value); cookieLength = name.length + value.length + 1; if (cookieLength > 4096) { $log.warn("Cookie '"+ name +"' possibly not set or overflowed because it was too large ("+ cookieLength + " > 4096 bytes)!"); } if (lastCookies.length > 20) { $log.warn("Cookie '"+ name +"' possibly not set or overflowed because too many cookies " + "were already set (" + lastCookies.length + " > 20 )"); } } } } else { if (rawDocument.cookie !== lastCookieString) { lastCookieString = rawDocument.cookie; cookieArray = lastCookieString.split("; "); lastCookies = {}; for (i = 0; i < cookieArray.length; i++) { cookie = cookieArray[i]; index = cookie.indexOf('='); if (index > 0) { //ignore nameless cookies lastCookies[unescape(cookie.substring(0, index))] = unescape(cookie.substring(index + 1)); } } } return lastCookies; } }; /** * @workInProgress * @ngdoc method * @name angular.service.$browser#defer * @methodOf angular.service.$browser * @param {function()} fn A function, who's execution should be defered. * @param {number=} [delay=0] of milliseconds to defer the function execution. * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`. * * @description * Executes a fn asynchroniously via `setTimeout(fn, delay)`. * * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed * via `$browser.defer.flush()`. * */ self.defer = function(fn, delay) { var timeoutId; outstandingRequestCount++; timeoutId = setTimeout(function() { delete pendingDeferIds[timeoutId]; completeOutstandingRequest(fn); }, delay || 0); pendingDeferIds[timeoutId] = true; return timeoutId; }; /** * THIS DOC IS NOT VISIBLE because ngdocs can't process docs for foo#method.method * * @name angular.service.$browser#defer.cancel * @methodOf angular.service.$browser.defer * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfuly canceled. * * @description * Cancels a defered task identified with `deferId`. */ self.defer.cancel = function(deferId) { if (pendingDeferIds[deferId]) { delete pendingDeferIds[deferId]; clearTimeout(deferId); completeOutstandingRequest(noop); return true; } }; ////////////////////////////////////////////////////////////// // Misc API ////////////////////////////////////////////////////////////// var hoverListener = noop; /** * @workInProgress * @ngdoc method * @name angular.service.$browser#hover * @methodOf angular.service.$browser * * @description * Set hover listener. * * @param {function(Object, boolean)} listener Function that will be called when a hover event * occurs. */ self.hover = function(listener) { hoverListener = listener; }; /** * @workInProgress * @ngdoc method * @name angular.service.$browser#bind * @methodOf angular.service.$browser * * @description * Register hover function to real browser */ self.bind = function() { document.bind("mouseover", function(event){ hoverListener(jqLite(msie ? event.srcElement : event.target), true); return true; }); document.bind("mouseleave mouseout click dblclick keypress keyup", function(event){ hoverListener(jqLite(event.target), false); return true; }); }; /** * @workInProgress * @ngdoc method * @name angular.service.$browser#addCss * @methodOf angular.service.$browser * * @param {string} url Url to css file * @description * Adds a stylesheet tag to the head. */ self.addCss = function(url) { var link = jqLite(rawDocument.createElement('link')); link.attr('rel', 'stylesheet'); link.attr('type', 'text/css'); link.attr('href', url); body.append(link); }; /** * @workInProgress * @ngdoc method * @name angular.service.$browser#addJs * @methodOf angular.service.$browser * * @param {string} url Url to js file * @param {string=} domId Optional id for the script tag * * @description * Adds a script tag to the head. */ self.addJs = function(url, domId, done) { // we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.: // - fetches local scripts via XHR and evals them // - adds and immediately removes script elements from the document // // We need addJs to be able to add angular-ie-compat.js which is very special and must remain // part of the DOM so that the embedded images can reference it. jQuery's append implementation // (v1.4.2) fubars it. var script = rawDocument.createElement('script'); script.type = 'text/javascript'; script.src = url; if (domId) script.id = domId; if (msie) { script.onreadystatechange = function() { /loaded|complete/.test(script.readyState) && done && done(); }; } else { if (done) script.onload = script.onerror = done; } body[0].appendChild(script); return script; }; /** * Returns current <base href> * (always relative - without domain) * * @returns {string=} */ self.baseHref = function() { var href = document.find('base').attr('href'); return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : href; }; } /* * HTML Parser By Misko Hevery (misko@hevery.com) * based on: HTML Parser By John Resig (ejohn.org) * Original code by Erik Arvidsson, Mozilla Public License * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js * * // Use like so: * htmlParser(htmlString, { * start: function(tag, attrs, unary) {}, * end: function(tag) {}, * chars: function(text) {}, * comment: function(text) {} * }); * */ // Regular Expressions for parsing tags and attributes var START_TAG_REGEXP = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/, END_TAG_REGEXP = /^<\s*\/\s*([\w:-]+)[^>]*>/, ATTR_REGEXP = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g, BEGIN_TAG_REGEXP = /^</, BEGING_END_TAGE_REGEXP = /^<\s*\//, COMMENT_REGEXP = /<!--(.*?)-->/g, CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g, URI_REGEXP = /^((ftp|https?):\/\/|mailto:|#)/, NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g; // Match everything outside of normal chars and " (quote character) // Empty Elements - HTML 4.01 var emptyElements = makeMap("area,br,col,hr,img"); // Block Elements - HTML 4.01 var blockElements = makeMap("address,blockquote,center,dd,del,dir,div,dl,dt,"+ "hr,ins,li,map,menu,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"); // Inline Elements - HTML 4.01 var inlineElements = makeMap("a,abbr,acronym,b,bdo,big,br,cite,code,del,dfn,em,font,i,img,"+ "ins,kbd,label,map,q,s,samp,small,span,strike,strong,sub,sup,tt,u,var"); // Elements that you can, intentionally, leave open // (and which close themselves) var closeSelfElements = makeMap("colgroup,dd,dt,li,p,td,tfoot,th,thead,tr"); // Special Elements (can contain anything) var specialElements = makeMap("script,style"); var validElements = extend({}, emptyElements, blockElements, inlineElements, closeSelfElements); //Attributes that have href and hence need to be sanitized var uriAttrs = makeMap("background,href,longdesc,src,usemap"); var validAttrs = extend({}, uriAttrs, makeMap( 'abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,'+ 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,'+ 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,'+ 'scope,scrolling,shape,span,start,summary,target,title,type,'+ 'valign,value,vspace,width')); /** * @example * htmlParser(htmlString, { * start: function(tag, attrs, unary) {}, * end: function(tag) {}, * chars: function(text) {}, * comment: function(text) {} * }); * * @param {string} html string * @param {object} handler */ function htmlParser( html, handler ) { var index, chars, match, stack = [], last = html; stack.last = function(){ return stack[ stack.length - 1 ]; }; while ( html ) { chars = true; // Make sure we're not in a script or style element if ( !stack.last() || !specialElements[ stack.last() ] ) { // Comment if ( html.indexOf("<!--") === 0 ) { index = html.indexOf("-->"); if ( index >= 0 ) { if (handler.comment) handler.comment( html.substring( 4, index ) ); html = html.substring( index + 3 ); chars = false; } // end tag } else if ( BEGING_END_TAGE_REGEXP.test(html) ) { match = html.match( END_TAG_REGEXP ); if ( match ) { html = html.substring( match[0].length ); match[0].replace( END_TAG_REGEXP, parseEndTag ); chars = false; } // start tag } else if ( BEGIN_TAG_REGEXP.test(html) ) { match = html.match( START_TAG_REGEXP ); if ( match ) { html = html.substring( match[0].length ); match[0].replace( START_TAG_REGEXP, parseStartTag ); chars = false; } } if ( chars ) { index = html.indexOf("<"); var text = index < 0 ? html : html.substring( 0, index ); html = index < 0 ? "" : html.substring( index ); if (handler.chars) handler.chars( decodeEntities(text) ); } } else { html = html.replace(new RegExp("(.*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'), function(all, text){ text = text. replace(COMMENT_REGEXP, "$1"). replace(CDATA_REGEXP, "$1"); if (handler.chars) handler.chars( decodeEntities(text) ); return ""; }); parseEndTag( "", stack.last() ); } if ( html == last ) { throw "Parse Error: " + html; } last = html; } // Clean up any remaining tags parseEndTag(); function parseStartTag( tag, tagName, rest, unary ) { tagName = lowercase(tagName); if ( blockElements[ tagName ] ) { while ( stack.last() && inlineElements[ stack.last() ] ) { parseEndTag( "", stack.last() ); } } if ( closeSelfElements[ tagName ] && stack.last() == tagName ) { parseEndTag( "", tagName ); } unary = emptyElements[ tagName ] || !!unary; if ( !unary ) stack.push( tagName ); var attrs = {}; rest.replace(ATTR_REGEXP, function(match, name, doubleQuotedValue, singleQoutedValue, unqoutedValue) { var value = doubleQuotedValue || singleQoutedValue || unqoutedValue || ''; attrs[name] = decodeEntities(value); }); if (handler.start) handler.start( tagName, attrs, unary ); } function parseEndTag( tag, tagName ) { var pos = 0, i; tagName = lowercase(tagName); if ( tagName ) // Find the closest opened tag of the same type for ( pos = stack.length - 1; pos >= 0; pos-- ) if ( stack[ pos ] == tagName ) break; if ( pos >= 0 ) { // Close all the open elements, up the stack for ( i = stack.length - 1; i >= pos; i-- ) if (handler.end) handler.end( stack[ i ] ); // Remove the open elements from the stack stack.length = pos; } } } /** * decodes all entities into regular string * @param value * @returns {string} A string with decoded entities. */ var hiddenPre=document.createElement("pre"); function decodeEntities(value) { hiddenPre.innerHTML=value.replace(/</g,"&lt;"); return hiddenPre.innerText || hiddenPre.textContent || ''; } /** * Escapes all potentially dangerous characters, so that the * resulting string can be safely inserted into attribute or * element text. * @param value * @returns escaped text */ function encodeEntities(value) { return value. replace(/&/g, '&amp;'). replace(NON_ALPHANUMERIC_REGEXP, function(value){ return '&#' + value.charCodeAt(0) + ';'; }). replace(/</g, '&lt;'). replace(/>/g, '&gt;'); } /** * create an HTML/XML writer which writes to buffer * @param {Array} buf use buf.jain('') to get out sanitized html string * @returns {object} in the form of { * start: function(tag, attrs, unary) {}, * end: function(tag) {}, * chars: function(text) {}, * comment: function(text) {} * } */ function htmlSanitizeWriter(buf){ var ignore = false; var out = bind(buf, buf.push); return { start: function(tag, attrs, unary){ tag = lowercase(tag); if (!ignore && specialElements[tag]) { ignore = tag; } if (!ignore && validElements[tag] == true) { out('<'); out(tag); forEach(attrs, function(value, key){ var lkey=lowercase(key); if (validAttrs[lkey]==true && (uriAttrs[lkey]!==true || value.match(URI_REGEXP))) { out(' '); out(key); out('="'); out(encodeEntities(value)); out('"'); } }); out(unary ? '/>' : '>'); } }, end: function(tag){ tag = lowercase(tag); if (!ignore && validElements[tag] == true) { out('</'); out(tag); out('>'); } if (tag == ignore) { ignore = false; } }, chars: function(chars){ if (!ignore) { out(encodeEntities(chars)); } } }; } ////////////////////////////////// //JQLite ////////////////////////////////// /** * @ngdoc function * @name angular.element * @function * * @description * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element. * `angular.element` can be either an alias for [jQuery](http://api.jquery.com/jQuery/) function, if * jQuery is available, or a function that wraps the element or string in Angular's jQuery lite * implementation (commonly referred to as jqLite). * * Real jQuery always takes precedence over jqLite, provided it was loaded before `DOMContentLoaded` * event fired. * * jqLite is a tiny, API-compatible subset of jQuery that allows * Angular to manipulate the DOM. jqLite implements only the most commonly needed functionality * within a very small footprint, so only a subset of the jQuery API - methods, arguments and * invocation styles - are supported. * * Note: All element references in Angular are always wrapped with jQuery or jqLite; they are never * raw DOM references. * * ## Angular's jQuery lite provides the following methods: * * - [addClass()](http://api.jquery.com/addClass/) * - [after()](http://api.jquery.com/after/) * - [append()](http://api.jquery.com/append/) * - [attr()](http://api.jquery.com/attr/) * - [bind()](http://api.jquery.com/bind/) * - [children()](http://api.jquery.com/children/) * - [clone()](http://api.jquery.com/clone/) * - [css()](http://api.jquery.com/css/) * - [data()](http://api.jquery.com/data/) * - [hasClass()](http://api.jquery.com/hasClass/) * - [parent()](http://api.jquery.com/parent/) * - [remove()](http://api.jquery.com/remove/) * - [removeAttr()](http://api.jquery.com/removeAttr/) * - [removeClass()](http://api.jquery.com/removeClass/) * - [removeData()](http://api.jquery.com/removeData/) * - [replaceWith()](http://api.jquery.com/replaceWith/) * - [text()](http://api.jquery.com/text/) * - [trigger()](http://api.jquery.com/trigger/) * - [eq()](http://api.jquery.com/eq/) * * ## In addtion to the above, Angular privides an additional method to both jQuery and jQuery lite: * * - `scope()` - retrieves the current Angular scope of the element. * * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery. * @returns {Object} jQuery object. */ var jqCache = {}, jqName = 'ng-' + new Date().getTime(), jqId = 1, addEventListenerFn = (window.document.addEventListener ? function(element, type, fn) {element.addEventListener(type, fn, false);} : function(element, type, fn) {element.attachEvent('on' + type, fn);}), removeEventListenerFn = (window.document.removeEventListener ? function(element, type, fn) {element.removeEventListener(type, fn, false); } : function(element, type, fn) {element.detachEvent('on' + type, fn); }); function jqNextId() { return (jqId++); } function getStyle(element) { var current = {}, style = element[0].style, value, name, i; if (typeof style.length == 'number') { for(i = 0; i < style.length; i++) { name = style[i]; current[name] = style[name]; } } else { for (name in style) { value = style[name]; if (1*name != name && name != 'cssText' && value && typeof value == 'string' && value !='false') current[name] = value; } } return current; } ///////////////////////////////////////////// function jqLiteWrap(element) { if (isString(element) && element.charAt(0) != '<') { throw new Error('selectors not implemented'); } return new JQLite(element); } function JQLite(element) { if (element instanceof JQLite) { return element; } else if (isString(element)) { var div = document.createElement('div'); // Read about the NoScope elements here: // http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx div.innerHTML = '<div>&nbsp;</div>' + element; // IE insanity to make NoScope elements work! div.removeChild(div.firstChild); // remove the superfluous div JQLiteAddNodes(this, div.childNodes); this.remove(); // detach the elements from the temporary DOM div. } else { JQLiteAddNodes(this, element); } } function JQLiteClone(element) { return element.cloneNode(true); } function JQLiteDealoc(element){ JQLiteRemoveData(element); for ( var i = 0, children = element.childNodes || []; i < children.length; i++) { JQLiteDealoc(children[i]); } } function JQLiteRemoveData(element) { var cacheId = element[jqName], cache = jqCache[cacheId]; if (cache) { forEach(cache.bind || {}, function(fn, type){ removeEventListenerFn(element, type, fn); }); delete jqCache[cacheId]; element[jqName] = undefined; // ie does not allow deletion of attributes on elements. } } function JQLiteData(element, key, value) { var cacheId = element[jqName], cache = jqCache[cacheId || -1]; if (isDefined(value)) { if (!cache) { element[jqName] = cacheId = jqNextId(); cache = jqCache[cacheId] = {}; } cache[key] = value; } else { return cache ? cache[key] : null; } } function JQLiteHasClass(element, selector, _) { // the argument '_' is important, since it makes the function have 3 arguments, which // is needed for delegate function to realize the this is a getter. var className = " " + selector + " "; return ((" " + element.className + " ").replace(/[\n\t]/g, " ").indexOf( className ) > -1); } function JQLiteRemoveClass(element, selector) { if (selector) { forEach(selector.split(' '), function(cssClass) { element.className = trim( (" " + element.className + " ") .replace(/[\n\t]/g, " ") .replace(" " + trim(cssClass) + " ", " ") ); }); } } function JQLiteAddClass(element, selector) { if (selector) { forEach(selector.split(' '), function(cssClass) { if (!JQLiteHasClass(element, cssClass)) { element.className = trim(element.className + ' ' + trim(cssClass)); } }); } } function JQLiteAddNodes(root, elements) { if (elements) { elements = (!elements.nodeName && isDefined(elements.length) && !isWindow(elements)) ? elements : [ elements ]; for(var i=0; i < elements.length; i++) { root.push(elements[i]); } } } ////////////////////////////////////////// // Functions which are declared directly. ////////////////////////////////////////// var JQLitePrototype = JQLite.prototype = { ready: function(fn) { var fired = false; function trigger() { if (fired) return; fired = true; fn(); } this.bind('DOMContentLoaded', trigger); // works for modern browsers and IE9 // we can not use jqLite since we are not done loading and jQuery could be loaded later. jqLiteWrap(window).bind('load', trigger); // fallback to window.onload for others }, toString: function() { var value = []; forEach(this, function(e){ value.push('' + e);}); return '[' + value.join(', ') + ']'; }, eq: function(index) { return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]); }, length: 0, push: push, sort: [].sort, splice: [].splice }; ////////////////////////////////////////// // Functions iterating getter/setters. // these functions return self on setter and // value on get. ////////////////////////////////////////// var SPECIAL_ATTR = makeMap("multiple,selected,checked,disabled,readonly"); forEach({ data: JQLiteData, scope: function(element) { var scope; while (element && !(scope = jqLite(element).data($$scope))) { element = element.parentNode; } return scope; }, removeAttr: function(element,name) { element.removeAttribute(name); }, hasClass: JQLiteHasClass, css: function(element, name, value) { if (isDefined(value)) { element.style[name] = value; } else { return element.style[name]; } }, attr: function(element, name, value){ if (name === 'class') { if(isDefined(value)) { element.className = value; } else { return element.className; } } else if (SPECIAL_ATTR[name]) { if (isDefined(value)) { element[name] = !!value; } else { return element[name]; } } else if (isDefined(value)) { element.setAttribute(name, value); } else if (element.getAttribute) { // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code // some elements (e.g. Document) don't have get attribute, so return undefined var ret = element.getAttribute(name, 2); // normalize non-existing attributes to undefined (as jQuery) return ret === null ? undefined : ret; } }, text: extend((msie < 9) ? function(element, value) { // NodeType == 3 is text node if (element.nodeType == 3) { if (isUndefined(value)) return element.nodeValue; element.nodeValue = value; } else { if (isUndefined(value)) return element.innerText; element.innerText = value; } } : function(element, value) { if (isUndefined(value)) { return element.textContent; } element.textContent = value; }, {$dv:''}), val: function(element, value) { if (isUndefined(value)) { return element.value; } element.value = value; }, html: function(element, value) { if (isUndefined(value)) { return element.innerHTML; } for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) { JQLiteDealoc(childNodes[i]); } element.innerHTML = value; } }, function(fn, name){ /** * Properties: writes return selection, reads return first value */ JQLite.prototype[name] = function(arg1, arg2) { var i, key; if ((fn.length == 2 ? arg1 : arg2) === undefined) { if (isObject(arg1)) { // we are a write, but the object properties are the key/values for(i=0; i < this.length; i++) { for (key in arg1) { fn(this[i], key, arg1[key]); } } // return self for chaining return this; } else { // we are a read, so read the first child. if (this.length) return fn(this[0], arg1, arg2); } } else { // we are a write, so apply to all children for(i=0; i < this.length; i++) { fn(this[i], arg1, arg2); } // return self for chaining return this; } return fn.$dv; }; }); ////////////////////////////////////////// // Functions iterating traversal. // These functions chain results into a single // selector. ////////////////////////////////////////// forEach({ removeData: JQLiteRemoveData, dealoc: JQLiteDealoc, bind: function(element, type, fn){ var bind = JQLiteData(element, 'bind'); if (!bind) JQLiteData(element, 'bind', bind = {}); forEach(type.split(' '), function(type){ var eventHandler = bind[type]; if (!eventHandler) { bind[type] = eventHandler = function(event) { if (!event.preventDefault) { event.preventDefault = function(){ event.returnValue = false; //ie }; } if (!event.stopPropagation) { event.stopPropagation = function() { event.cancelBubble = true; //ie }; } if (!event.target) { event.target = event.srcElement || document; } if (isUndefined(event.defaultPrevented)) { var prevent = event.preventDefault; event.preventDefault = function() { event.defaultPrevented = true; prevent.call(event); }; event.defaultPrevented = false; } event.isDefaultPrevented = function() { return event.defaultPrevented; }; forEach(eventHandler.fns, function(fn){ fn.call(element, event); }); }; eventHandler.fns = []; addEventListenerFn(element, type, eventHandler); } eventHandler.fns.push(fn); }); }, replaceWith: function(element, replaceNode) { var index, parent = element.parentNode; JQLiteDealoc(element); forEach(new JQLite(replaceNode), function(node){ if (index) { parent.insertBefore(node, index.nextSibling); } else { parent.replaceChild(node, element); } index = node; }); }, children: function(element) { var children = []; forEach(element.childNodes, function(element){ if (element.nodeName != '#text') children.push(element); }); return children; }, append: function(element, node) { forEach(new JQLite(node), function(child){ if (element.nodeType === 1) element.appendChild(child); }); }, prepend: function(element, node) { if (element.nodeType === 1) { var index = element.firstChild; forEach(new JQLite(node), function(child){ if (index) { element.insertBefore(child, index); } else { element.appendChild(child); index = child; } }); } }, remove: function(element) { JQLiteDealoc(element); var parent = element.parentNode; if (parent) parent.removeChild(element); }, after: function(element, newElement) { var index = element, parent = element.parentNode; forEach(new JQLite(newElement), function(node){ parent.insertBefore(node, index.nextSibling); index = node; }); }, addClass: JQLiteAddClass, removeClass: JQLiteRemoveClass, toggleClass: function(element, selector, condition) { if (isUndefined(condition)) { condition = !JQLiteHasClass(element, selector); } (condition ? JQLiteAddClass : JQLiteRemoveClass)(element, selector); }, parent: function(element) { var parent = element.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, next: function(element) { return element.nextSibling; }, find: function(element, selector) { return element.getElementsByTagName(selector); }, clone: JQLiteClone }, function(fn, name){ /** * chaining functions */ JQLite.prototype[name] = function(arg1, arg2) { var value; for(var i=0; i < this.length; i++) { if (value == undefined) { value = fn(this[i], arg1, arg2); if (value !== undefined) { // any function which returns a value needs to be wrapped value = jqLite(value); } } else { JQLiteAddNodes(value, fn(this[i], arg1, arg2)); } } return value == undefined ? this : value; }; }); var angularGlobal = { 'typeOf':function(obj){ if (obj === null) return $null; var type = typeof obj; if (type == $object) { if (obj instanceof Array) return $array; if (isDate(obj)) return $date; if (obj.nodeType == 1) return 'element'; } return type; } }; /** * @ngdoc overview * @name angular.Object * @function * * @description * A namespace for utility functions used to work with JavaScript objects. These functions are * exposed in two ways: * * * __Angular expressions:__ Functions are bound to all objects and augment the Object type. * The names of these methods are prefixed with the '$' character in order to minimize naming * collisions. To call a method, invoke the function without the first argument, for example, * `myObject.$foo(param2)`. * * * __JavaScript code:__ Functions don't augment the Object type and must be invoked as functions * of `angular.Object` as `angular.Object.foo(myObject, param2)`. * * * {@link angular.Object.copy angular.Object.copy()} - Creates a deep copy of the source * parameter. * * {@link angular.Object.equals angular.Object.equals()} - Determines if two objects or values * are equivalent. * * {@link angular.Object.size angular.Object.size()} - Determines the number of elements in * strings, arrays, and objects. */ var angularCollection = { 'copy': copy, 'size': size, 'equals': equals }; var angularObject = { 'extend': extend }; /** * @ngdoc overview * @name angular.Array * * @description * A namespace for utility functions for the manipulation of JavaScript Array objects. * * These functions are exposed in two ways: * * * __Angular expressions:__ Functions are bound to the Array objects and augment the Array type * as array methods. The names of these methods are prefixed with the `$` character to minimize * naming collisions. To call a method, invoke myArrayObject.$foo(params). * * Because Array type is a subtype of the Object type, all angular.Object functions augment * the Array type in Angular expressions as well. * * * __JavaScript code:__ Functions do nor augment the Array type and must be invoked as functions * of `angular.Array` as `angular.Array.foo(myArrayObject, params)`. * * The following APIs are built in to the Angular Array object: * * * {@link angular.Array.add angular.Array.add()} - Optionally adds a new element to an array. * * {@link angular.Array.count angular.Array.count()} - Determines the number of elements in an * array. * * {@link angular.Array.filter angular.Array.filter()} - Returns the subset of elements specified * in the filter as a new array. * * {@link angular.Array.indexOf angular.Array.indexOf()} - Determines the index of an array * value. * * {@link angular.Array.limitTo angular.Array.limitTo()} - Creates a sub-array of an existing * array. * * {@link angular.Array.orderBy angular.Array.orderBy()} - Orders array elements. * * {@link angular.Array.remove angular.Array.remove()} - Removes array elements. * * {@link angular.Array.sum angular.Array.sum()} - Sums the numbers in an array. */ var angularArray = { /** * @ngdoc function * @name angular.Array.indexOf * @function * * @description * Determines the index of a `value` in an `array`. * * Note: This function is used to augment the `Array` type in Angular expressions. See * {@link angular.Array} for more information about Angular arrays. * * @param {Array} array Array to search. * @param {*} value Value to search for. * @returns {number} The position of the element in `array`. The position is 0-based. * If the value cannot be found, `-1` is returned. * * @example <doc:example> <doc:source> <div ng:init="books = ['Moby Dick', 'Great Gatsby', 'Romeo and Juliet']"></div> <input name='bookName' value='Romeo and Juliet'> <br> Index of '{{bookName}}' in the list {{books}} is <em>{{books.$indexOf(bookName)}}</em>. </doc:source> <doc:scenario> it('should correctly calculate the initial index', function() { expect(binding('books.$indexOf(bookName)')).toBe('2'); }); it('should recalculate', function() { input('bookName').enter('foo'); expect(binding('books.$indexOf(bookName)')).toBe('-1'); input('bookName').enter('Moby Dick'); expect(binding('books.$indexOf(bookName)')).toBe('0'); }); </doc:scenario> </doc:example> */ 'indexOf': indexOf, /** * @ngdoc function * @name angular.Array.sum * @function * * @description * The `sum` function calculates the sum of all numbers in an `array`. If an `expression` is * supplied, `sum` evaluates each element in the `array` with the expression and then returns * the sum of the calculated values. * * Note: This function is used to augment the `Array` type in Angular expressions. See * {@link angular.Array} for more info about Angular arrays. * * @param {Array} array The source array. * @param {(string|function())=} expression Angular expression or a function to be evaluated for * each element in `array`. The array element becomes the `this` during the evaluation. * @returns {number} Sum of items in the array. * * @example <doc:example> <doc:source> <table ng:init="invoice= {items:[{qty:10, description:'gadget', cost:9.95}]}"> <tr><th>Qty</th><th>Description</th><th>Cost</th><th>Total</th><th></th></tr> <tr ng:repeat="item in invoice.items"> <td><input name="item.qty" value="1" size="4" ng:required ng:validate="integer"></td> <td><input name="item.description"></td> <td><input name="item.cost" value="0.00" ng:required ng:validate="number" size="6"></td> <td>{{item.qty * item.cost | currency}}</td> <td>[<a href ng:click="invoice.items.$remove(item)">X</a>]</td> </tr> <tr> <td><a href ng:click="invoice.items.$add()">add item</a></td> <td></td> <td>Total:</td> <td>{{invoice.items.$sum('qty*cost') | currency}}</td> </tr> </table> </doc:source> <doc:scenario> //TODO: these specs are lame because I had to work around issues #164 and #167 it('should initialize and calculate the totals', function() { expect(repeater('.doc-example-live table tr', 'item in invoice.items').count()).toBe(3); expect(repeater('.doc-example-live table tr', 'item in invoice.items').row(1)). toEqual(['$99.50']); expect(binding("invoice.items.$sum('qty*cost')")).toBe('$99.50'); expect(binding("invoice.items.$sum('qty*cost')")).toBe('$99.50'); }); it('should add an entry and recalculate', function() { element('.doc-example-live a:contains("add item")').click(); using('.doc-example-live tr:nth-child(3)').input('item.qty').enter('20'); using('.doc-example-live tr:nth-child(3)').input('item.cost').enter('100'); expect(repeater('.doc-example-live table tr', 'item in invoice.items').row(2)). toEqual(['$2,000.00']); expect(binding("invoice.items.$sum('qty*cost')")).toBe('$2,099.50'); }); </doc:scenario> </doc:example> */ 'sum':function(array, expression) { var fn = angularFunction.compile(expression); var sum = 0; for (var i = 0; i < array.length; i++) { var value = 1 * fn(array[i]); if (!isNaN(value)){ sum += value; } } return sum; }, /** * @ngdoc function * @name angular.Array.remove * @function * * @description * Modifies `array` by removing an element from it. The element will be looked up using the * {@link angular.Array.indexOf indexOf} function on the `array` and only the first instance of * the element will be removed. * * Note: This function is used to augment the `Array` type in Angular expressions. See * {@link angular.Array} for more information about Angular arrays. * * @param {Array} array Array from which an element should be removed. * @param {*} value Element to be removed. * @returns {*} The removed element. * * @example <doc:example> <doc:source> <ul ng:init="tasks=['Learn Angular', 'Read Documentation', 'Check out demos', 'Build cool applications']"> <li ng:repeat="task in tasks"> {{task}} [<a href="" ng:click="tasks.$remove(task)">X</a>] </li> </ul> <hr/> tasks = {{tasks}} </doc:source> <doc:scenario> it('should initialize the task list with for tasks', function() { expect(repeater('.doc-example-live ul li', 'task in tasks').count()).toBe(4); expect(repeater('.doc-example-live ul li', 'task in tasks').column('task')). toEqual(['Learn Angular', 'Read Documentation', 'Check out demos', 'Build cool applications']); }); it('should initialize the task list with for tasks', function() { element('.doc-example-live ul li a:contains("X"):first').click(); expect(repeater('.doc-example-live ul li', 'task in tasks').count()).toBe(3); element('.doc-example-live ul li a:contains("X"):last').click(); expect(repeater('.doc-example-live ul li', 'task in tasks').count()).toBe(2); expect(repeater('.doc-example-live ul li', 'task in tasks').column('task')). toEqual(['Read Documentation', 'Check out demos']); }); </doc:scenario> </doc:example> */ 'remove':function(array, value) { var index = indexOf(array, value); if (index >=0) array.splice(index, 1); return value; }, /** * @ngdoc function * @name angular.Array.filter * @function * * @description * Selects a subset of items from `array` and returns it as a new array. * * Note: This function is used to augment the `Array` type in Angular expressions. See * {@link angular.Array} for more information about Angular arrays. * * @param {Array} array The source array. * @param {string|Object|function()} expression The predicate to be used for selecting items from * `array`. * * Can be one of: * * - `string`: Predicate that results in a substring match using the value of `expression` * string. All strings or objects with string properties in `array` that contain this string * will be returned. The predicate can be negated by prefixing the string with `!`. * * - `Object`: A pattern object can be used to filter specific properties on objects contained * by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items * which have property `name` containing "M" and property `phone` containing "1". A special * property name `$` can be used (as in `{$:"text"}`) to accept a match against any * property of the object. That's equivalent to the simple substring match with a `string` * as described above. * * - `function`: A predicate function can be used to write arbitrary filters. The function is * called for each element of `array`. The final result is an array of those elements that * the predicate returned true for. * * @example <doc:example> <doc:source> <div ng:init="friends = [{name:'John', phone:'555-1276'}, {name:'Mary', phone:'800-BIG-MARY'}, {name:'Mike', phone:'555-4321'}, {name:'Adam', phone:'555-5678'}, {name:'Julie', phone:'555-8765'}]"></div> Search: <input name="searchText"/> <table id="searchTextResults"> <tr><th>Name</th><th>Phone</th><tr> <tr ng:repeat="friend in friends.$filter(searchText)"> <td>{{friend.name}}</td> <td>{{friend.phone}}</td> <tr> </table> <hr> Any: <input name="search.$"/> <br> Name only <input name="search.name"/><br> Phone only <input name="search.phone"/><br> <table id="searchObjResults"> <tr><th>Name</th><th>Phone</th><tr> <tr ng:repeat="friend in friends.$filter(search)"> <td>{{friend.name}}</td> <td>{{friend.phone}}</td> <tr> </table> </doc:source> <doc:scenario> it('should search across all fields when filtering with a string', function() { input('searchText').enter('m'); expect(repeater('#searchTextResults tr', 'friend in friends').column('name')). toEqual(['Mary', 'Mike', 'Adam']); input('searchText').enter('76'); expect(repeater('#searchTextResults tr', 'friend in friends').column('name')). toEqual(['John', 'Julie']); }); it('should search in specific fields when filtering with a predicate object', function() { input('search.$').enter('i'); expect(repeater('#searchObjResults tr', 'friend in friends').column('name')). toEqual(['Mary', 'Mike', 'Julie']); }); </doc:scenario> </doc:example> */ 'filter':function(array, expression) { var predicates = []; predicates.check = function(value) { for (var j = 0; j < predicates.length; j++) { if(!predicates[j](value)) { return false; } } return true; }; var search = function(obj, text){ if (text.charAt(0) === '!') { return !search(obj, text.substr(1)); } switch (typeof obj) { case "boolean": case "number": case "string": return ('' + obj).toLowerCase().indexOf(text) > -1; case "object": for ( var objKey in obj) { if (objKey.charAt(0) !== '$' && search(obj[objKey], text)) { return true; } } return false; case "array": for ( var i = 0; i < obj.length; i++) { if (search(obj[i], text)) { return true; } } return false; default: return false; } }; switch (typeof expression) { case "boolean": case "number": case "string": expression = {$:expression}; case "object": for (var key in expression) { if (key == '$') { (function(){ var text = (''+expression[key]).toLowerCase(); if (!text) return; predicates.push(function(value) { return search(value, text); }); })(); } else { (function(){ var path = key; var text = (''+expression[key]).toLowerCase(); if (!text) return; predicates.push(function(value) { return search(getter(value, path), text); }); })(); } } break; case 'function': predicates.push(expression); break; default: return array; } var filtered = []; for ( var j = 0; j < array.length; j++) { var value = array[j]; if (predicates.check(value)) { filtered.push(value); } } return filtered; }, /** * @ngdoc function * @name angular.Array.add * @function * * @description * The `add` function in Angualar is similar to JavaScript's `Array#push` method in that it * appends a new element to an array. Angular's function differs from the JavaScript method in * that specifying a value for the function is optional and the default for the function is an * empty object. * * Note: This function is used to augment the `Array` type in Angular expressions. See * {@link angular.Array} for more information about Angular arrays. * * @param {Array} array The array to be expanded. * @param {*=} [value={}] The value to be appended. * @returns {Array} The expanded array. * * @TODO simplify the example. * * @example * This example shows how you can use the `$add` method to populate an initially empty array * with objects created from user input. <doc:example> <doc:source> [<a href="" ng:click="people.$add()">add empty</a>] [<a href="" ng:click="people.$add({name:'John', sex:'male'})">add 'John'</a>] [<a href="" ng:click="people.$add({name:'Mary', sex:'female'})">add 'Mary'</a>] <ul ng:init="people=[]"> <li ng:repeat="person in people"> <input name="person.name"> <select name="person.sex"> <option value="">--chose one--</option> <option>male</option> <option>female</option> </select> [<a href="" ng:click="people.$remove(person)">X</a>] </li> </ul> <pre>people = {{people}}</pre> </doc:source> <doc:scenario> beforeEach(function() { expect(binding('people')).toBe('people = []'); }); it('should create an empty record when "add empty" is clicked', function() { element('.doc-example-live a:contains("add empty")').click(); expect(binding('people')).toBe('people = [{\n "name":"",\n "sex":null}]'); }); it('should create a "John" record when "add \'John\'" is clicked', function() { element('.doc-example-live a:contains("add \'John\'")').click(); expect(binding('people')).toBe('people = [{\n "name":"John",\n "sex":"male"}]'); }); it('should create a "Mary" record when "add \'Mary\'" is clicked', function() { element('.doc-example-live a:contains("add \'Mary\'")').click(); expect(binding('people')).toBe('people = [{\n "name":"Mary",\n "sex":"female"}]'); }); it('should delete a record when "X" is clicked', function() { element('.doc-example-live a:contains("add empty")').click(); element('.doc-example-live li a:contains("X"):first').click(); expect(binding('people')).toBe('people = []'); }); </doc:scenario> </doc:example> */ 'add':function(array, value) { array.push(isUndefined(value)? {} : value); return array; }, /** * @ngdoc function * @name angular.Array.count * @function * * @description * Determines the number of elements in an array. Provides an option for counting only those * elements for which a specified `condition` evaluates to `true`. * * Note: This function is used to augment the `Array` type in Angular expressions. See * {@link angular.Array} for more information about Angular arrays. * * @param {Array} array The array containing the elements to be counted. * @param {(function()|string)=} condition A function to be evaluated or * an Angular expression to be compiled and evaluated. The element being * iterated over is exposed to the `condition` as `this`. * @returns {number} Number of elements in the array. If a `condition` is specified, returns * the number of elements whose `condition` evaluates to `true`. * * @example <doc:example> <doc:source> <pre ng:init="items = [{name:'knife', points:1}, {name:'fork', points:3}, {name:'spoon', points:1}]"></pre> <ul> <li ng:repeat="item in items"> {{item.name}}: points= <input type="text" name="item.points"/> <!-- id="item{{$index}} --> </li> </ul> <p>Number of items which have one point: <em>{{ items.$count('points==1') }}</em></p> <p>Number of items which have more than one point: <em>{{items.$count('points&gt;1')}}</em></p> </doc:source> <doc:scenario> it('should calculate counts', function() { expect(binding('items.$count(\'points==1\')')).toEqual('2'); expect(binding('items.$count(\'points>1\')')).toEqual('1'); }); it('should recalculate when updated', function() { using('.doc-example-live li:first-child').input('item.points').enter('23'); expect(binding('items.$count(\'points==1\')')).toEqual('1'); expect(binding('items.$count(\'points>1\')')).toEqual('2'); }); </doc:scenario> </doc:example> */ 'count':function(array, condition) { if (!condition) return array.length; var fn = angularFunction.compile(condition), count = 0; forEach(array, function(value){ if (fn(value)) { count ++; } }); return count; }, /** * @ngdoc function * @name angular.Array.orderBy * @function * * @description * Orders a specified `array` by the `expression` predicate. * * Note: this function is used to augment the `Array` type in Angular expressions. See * {@link angular.Array} for more informaton about Angular arrays. * * @param {Array} array The array to sort. * @param {function(*)|string|Array.<(function(*)|string)>} expression A predicate to be * used by the comparator to determine the order of elements. * * Can be one of: * * - `function`: Getter function. The result of this function will be sorted using the * `<`, `=`, `>` operator. * - `string`: An Angular expression which evaluates to an object to order by, such as 'name' * to sort by a property called 'name'. Optionally prefixed with `+` or `-` to control * ascending or descending sort order (for example, +name or -name). * - `Array`: An array of function or string predicates. The first predicate in the array * is used for sorting, but when two items are equivalent, the next predicate is used. * * @param {boolean=} reverse Reverse the order the array. * @returns {Array} Sorted copy of the source array. * * @example <doc:example> <doc:source> <div ng:init="friends = [{name:'John', phone:'555-1212', age:10}, {name:'Mary', phone:'555-9876', age:19}, {name:'Mike', phone:'555-4321', age:21}, {name:'Adam', phone:'555-5678', age:35}, {name:'Julie', phone:'555-8765', age:29}]"></div> <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre> <hr/> [ <a href="" ng:click="predicate=''">unsorted</a> ] <table ng:init="predicate='-age'"> <tr> <th><a href="" ng:click="predicate = 'name'; reverse=false">Name</a> (<a href ng:click="predicate = '-name'; reverse=false">^</a>)</th> <th><a href="" ng:click="predicate = 'phone'; reverse=!reverse">Phone Number</a></th> <th><a href="" ng:click="predicate = 'age'; reverse=!reverse">Age</a></th> <tr> <tr ng:repeat="friend in friends.$orderBy(predicate, reverse)"> <td>{{friend.name}}</td> <td>{{friend.phone}}</td> <td>{{friend.age}}</td> <tr> </table> </doc:source> <doc:scenario> it('should be reverse ordered by aged', function() { expect(binding('predicate')).toBe('Sorting predicate = -age; reverse = '); expect(repeater('.doc-example-live table', 'friend in friends').column('friend.age')). toEqual(['35', '29', '21', '19', '10']); expect(repeater('.doc-example-live table', 'friend in friends').column('friend.name')). toEqual(['Adam', 'Julie', 'Mike', 'Mary', 'John']); }); it('should reorder the table when user selects different predicate', function() { element('.doc-example-live a:contains("Name")').click(); expect(repeater('.doc-example-live table', 'friend in friends').column('friend.name')). toEqual(['Adam', 'John', 'Julie', 'Mary', 'Mike']); expect(repeater('.doc-example-live table', 'friend in friends').column('friend.age')). toEqual(['35', '10', '29', '19', '21']); element('.doc-example-live a:contains("Phone")').click(); expect(repeater('.doc-example-live table', 'friend in friends').column('friend.phone')). toEqual(['555-9876', '555-8765', '555-5678', '555-4321', '555-1212']); expect(repeater('.doc-example-live table', 'friend in friends').column('friend.name')). toEqual(['Mary', 'Julie', 'Adam', 'Mike', 'John']); }); </doc:scenario> </doc:example> */ 'orderBy':function(array, sortPredicate, reverseOrder) { if (!sortPredicate) return array; sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate]; sortPredicate = map(sortPredicate, function(predicate){ var descending = false, get = predicate || identity; if (isString(predicate)) { if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) { descending = predicate.charAt(0) == '-'; predicate = predicate.substring(1); } get = expressionCompile(predicate); } return reverseComparator(function(a,b){ return compare(get(a),get(b)); }, descending); }); var arrayCopy = []; for ( var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); } return arrayCopy.sort(reverseComparator(comparator, reverseOrder)); function comparator(o1, o2){ for ( var i = 0; i < sortPredicate.length; i++) { var comp = sortPredicate[i](o1, o2); if (comp !== 0) return comp; } return 0; } function reverseComparator(comp, descending) { return toBoolean(descending) ? function(a,b){return comp(b,a);} : comp; } function compare(v1, v2){ var t1 = typeof v1; var t2 = typeof v2; if (t1 == t2) { if (t1 == "string") v1 = v1.toLowerCase(); if (t1 == "string") v2 = v2.toLowerCase(); if (v1 === v2) return 0; return v1 < v2 ? -1 : 1; } else { return t1 < t2 ? -1 : 1; } } }, /** * @ngdoc function * @name angular.Array.limitTo * @function * * @description * Creates a new array containing only a specified number of elements in an array. The elements * are taken from either the beginning or the end of the source array, as specified by the * value and sign (positive or negative) of `limit`. * * Note: This function is used to augment the `Array` type in Angular expressions. See * {@link angular.Array} for more information about Angular arrays. * * @param {Array} array Source array to be limited. * @param {string|Number} limit The length of the returned array. If the `limit` number is * positive, `limit` number of items from the beginning of the source array are copied. * If the number is negative, `limit` number of items from the end of the source array are * copied. * @returns {Array} A new sub-array of length `limit`. * * @example <doc:example> <doc:source> <div ng:init="numbers = [1,2,3,4,5,6,7,8,9]"> Limit [1,2,3,4,5,6,7,8,9] to: <input name="limit" value="3"/> <p>Output: {{ numbers.$limitTo(limit) | json }}</p> </div> </doc:source> <doc:scenario> it('should limit the numer array to first three items', function() { expect(element('.doc-example-live input[name=limit]').val()).toBe('3'); expect(binding('numbers.$limitTo(limit) | json')).toEqual('[1,2,3]'); }); it('should update the output when -3 is entered', function() { input('limit').enter(-3); expect(binding('numbers.$limitTo(limit) | json')).toEqual('[7,8,9]'); }); </doc:scenario> </doc:example> */ limitTo: function(array, limit) { limit = parseInt(limit, 10); var out = [], i, n; if (limit > 0) { i = 0; n = limit; } else { i = array.length + limit; n = array.length; } for (; i<n; i++) { out.push(array[i]); } return out; } }; var R_ISO8061_STR = /^(\d{4})-(\d\d)-(\d\d)(?:T(\d\d)(?:\:(\d\d)(?:\:(\d\d)(?:\.(\d{3}))?)?)?Z)?$/; var angularString = { 'quote':function(string) { return '"' + string.replace(/\\/g, '\\\\'). replace(/"/g, '\\"'). replace(/\n/g, '\\n'). replace(/\f/g, '\\f'). replace(/\r/g, '\\r'). replace(/\t/g, '\\t'). replace(/\v/g, '\\v') + '"'; }, 'quoteUnicode':function(string) { var str = angular['String']['quote'](string); var chars = []; for ( var i = 0; i < str.length; i++) { var ch = str.charCodeAt(i); if (ch < 128) { chars.push(str.charAt(i)); } else { var encode = "000" + ch.toString(16); chars.push("\\u" + encode.substring(encode.length - 4)); } } return chars.join(''); }, /** * Tries to convert input to date and if successful returns the date, otherwise returns the * input. * * @param {string} string * @return {(Date|string)} */ 'toDate':function(string){ var match; if (isString(string) && (match = string.match(R_ISO8061_STR))){ var date = new Date(0); date.setUTCFullYear(match[1], match[2] - 1, match[3]); date.setUTCHours(match[4]||0, match[5]||0, match[6]||0, match[7]||0); return date; } return string; } }; var angularDate = { 'toString':function(date){ if (!date) return date; var isoString = date.toISOString ? date.toISOString() : ''; return (isoString.length==24) ? isoString : padNumber(date.getUTCFullYear(), 4) + '-' + padNumber(date.getUTCMonth() + 1, 2) + '-' + padNumber(date.getUTCDate(), 2) + 'T' + padNumber(date.getUTCHours(), 2) + ':' + padNumber(date.getUTCMinutes(), 2) + ':' + padNumber(date.getUTCSeconds(), 2) + '.' + padNumber(date.getUTCMilliseconds(), 3) + 'Z'; } }; var angularFunction = { 'compile': function(expression) { if (isFunction(expression)){ return expression; } else if (expression){ return expressionCompile(expression); } else { return identity; } } }; /** * Computes a hash of an 'obj'. * Hash of a: * string is string * number is number as string * object is either call $hashKey function on object or assign unique hashKey id. * * @param obj * @returns {String} hash string such that the same input will have the same hash string */ function hashKey(obj) { var objType = typeof obj; var key = obj; if (objType == 'object') { if (typeof (key = obj.$hashKey) == 'function') { // must invoke on object to keep the right this key = obj.$hashKey(); } else if (key === undefined) { key = obj.$hashKey = nextUid(); } } return objType + ':' + key; } /** * HashMap which can use objects as keys */ function HashMap(){} HashMap.prototype = { /** * Store key value pair * @param key key to store can be any type * @param value value to store can be any type * @returns old value if any */ put: function(key, value) { var _key = hashKey(key); var oldValue = this[_key]; this[_key] = value; return oldValue; }, /** * @param key * @returns the value for the key */ get: function(key) { return this[hashKey(key)]; }, /** * Remove the key/value pair * @param key * @returns value associated with key before it was removed */ remove: function(key) { var _key = hashKey(key); var value = this[_key]; delete this[_key]; return value; } }; function defineApi(dst, chain){ angular[dst] = angular[dst] || {}; forEach(chain, function(parent){ extend(angular[dst], parent); }); } defineApi('Global', [angularGlobal]); defineApi('Collection', [angularGlobal, angularCollection]); defineApi('Array', [angularGlobal, angularCollection, angularArray]); defineApi('Object', [angularGlobal, angularCollection, angularObject]); defineApi('String', [angularGlobal, angularString]); defineApi('Date', [angularGlobal, angularDate]); //IE bug angular.Date.toString = angularDate.toString; defineApi('Function', [angularGlobal, angularCollection, angularFunction]); /** * @workInProgress * @ngdoc overview * @name angular.filter * @description * * Filters are used for formatting data displayed to the user. * * The general syntax in templates is as follows: * * {{ expression | [ filter_name ] }} * * Following is the list of built-in angular filters: * * * {@link angular.filter.currency currency} * * {@link angular.filter.date date} * * {@link angular.filter.html html} * * {@link angular.filter.json json} * * {@link angular.filter.linky linky} * * {@link angular.filter.lowercase lowercase} * * {@link angular.filter.number number} * * {@link angular.filter.uppercase uppercase} * * For more information about how angular filters work, and how to create your own filters, see * {@link guide/dev_guide.templates.filters Understanding Angular Filters} in the angular Developer * Guide. */ /** * @workInProgress * @ngdoc filter * @name angular.filter.currency * @function * * @description * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default * symbol for current locale is used. * * @param {number} amount Input to filter. * @param {string=} symbol Currency symbol or identifier to be displayed. * @returns {string} Formatted number. * * @css ng-format-negative * When the value is negative, this css class is applied to the binding making it (by default) red. * * @example <doc:example> <doc:source> <input type="text" name="amount" value="1234.56"/> <br/> default currency symbol ($): {{amount | currency}}<br/> custom currency identifier (USD$): {{amount | currency:"USD$"}} </doc:source> <doc:scenario> it('should init with 1234.56', function(){ expect(binding('amount | currency')).toBe('$1,234.56'); expect(binding('amount | currency:"USD$"')).toBe('USD$1,234.56'); }); it('should update', function(){ input('amount').enter('-1234'); expect(binding('amount | currency')).toBe('($1,234.00)'); expect(binding('amount | currency:"USD$"')).toBe('(USD$1,234.00)'); expect(element('.doc-example-live .ng-binding').attr('className')). toMatch(/ng-format-negative/); }); </doc:scenario> </doc:example> */ angularFilter.currency = function(amount, currencySymbol){ var formats = this.$service('$locale').NUMBER_FORMATS; this.$element.toggleClass('ng-format-negative', amount < 0); if (isUndefined(currencySymbol)) currencySymbol = formats.CURRENCY_SYM; return formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, 2). replace(/\u00A4/g, currencySymbol); }; /** * @workInProgress * @ngdoc filter * @name angular.filter.number * @function * * @description * Formats a number as text. * * If the input is not a number an empty string is returned. * * @param {number|string} number Number to format. * @param {(number|string)=} [fractionSize=2] Number of decimal places to round the number to. * @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit. * * @example <doc:example> <doc:source> Enter number: <input name='val' value='1234.56789' /><br/> Default formatting: {{val | number}}<br/> No fractions: {{val | number:0}}<br/> Negative number: {{-val | number:4}} </doc:source> <doc:scenario> it('should format numbers', function(){ expect(binding('val | number')).toBe('1,234.568'); expect(binding('val | number:0')).toBe('1,235'); expect(binding('-val | number:4')).toBe('-1,234.5679'); }); it('should update', function(){ input('val').enter('3374.333'); expect(binding('val | number')).toBe('3,374.333'); expect(binding('val | number:0')).toBe('3,374'); expect(binding('-val | number:4')).toBe('-3,374.3330'); }); </doc:scenario> </doc:example> */ var DECIMAL_SEP = '.'; angularFilter.number = function(number, fractionSize) { var formats = this.$service('$locale').NUMBER_FORMATS; return formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize); }; function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) { if (isNaN(number) || !isFinite(number)) return ''; var isNegative = number < 0; number = Math.abs(number); var numStr = number + '', formatedText = '', parts = []; if (numStr.indexOf('e') !== -1) { formatedText = numStr; } else { var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length; // determine fractionSize if it is not specified if (isUndefined(fractionSize)) { fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac); } var pow = Math.pow(10, fractionSize); number = Math.round(number * pow) / pow; var fraction = ('' + number).split(DECIMAL_SEP); var whole = fraction[0]; fraction = fraction[1] || ''; var pos = 0, lgroup = pattern.lgSize, group = pattern.gSize; if (whole.length >= (lgroup + group)) { pos = whole.length - lgroup; for (var i = 0; i < pos; i++) { if ((pos - i)%group === 0 && i !== 0) { formatedText += groupSep; } formatedText += whole.charAt(i); } } for (i = pos; i < whole.length; i++) { if ((whole.length - i)%lgroup === 0 && i !== 0) { formatedText += groupSep; } formatedText += whole.charAt(i); } // format fraction part. while(fraction.length < fractionSize) { fraction += '0'; } if (fractionSize) formatedText += decimalSep + fraction.substr(0, fractionSize); } parts.push(isNegative ? pattern.negPre : pattern.posPre); parts.push(formatedText); parts.push(isNegative ? pattern.negSuf : pattern.posSuf); return parts.join(''); } function padNumber(num, digits, trim) { var neg = ''; if (num < 0) { neg = '-'; num = -num; } num = '' + num; while(num.length < digits) num = '0' + num; if (trim) num = num.substr(num.length - digits); return neg + num; } function dateGetter(name, size, offset, trim) { return function(date) { var value = date['get' + name](); if (offset > 0 || value > -offset) value += offset; if (value === 0 && offset == -12 ) value = 12; return padNumber(value, size, trim); }; } function dateStrGetter(name, shortForm) { return function(date, formats) { var value = date['get' + name](); var get = uppercase(shortForm ? ('SHORT' + name) : name); return formats[get][value]; }; } function timeZoneGetter(date) { var offset = date.getTimezoneOffset(); return padNumber(offset / 60, 2) + padNumber(Math.abs(offset % 60), 2); } function ampmGetter(date, formats) { return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1]; } var DATE_FORMATS = { yyyy: dateGetter('FullYear', 4), yy: dateGetter('FullYear', 2, 0, true), y: dateGetter('FullYear', 1), MMMM: dateStrGetter('Month'), MMM: dateStrGetter('Month', true), MM: dateGetter('Month', 2, 1), M: dateGetter('Month', 1, 1), dd: dateGetter('Date', 2), d: dateGetter('Date', 1), HH: dateGetter('Hours', 2), H: dateGetter('Hours', 1), hh: dateGetter('Hours', 2, -12), h: dateGetter('Hours', 1, -12), mm: dateGetter('Minutes', 2), m: dateGetter('Minutes', 1), ss: dateGetter('Seconds', 2), s: dateGetter('Seconds', 1), EEEE: dateStrGetter('Day'), EEE: dateStrGetter('Day', true), a: ampmGetter, Z: timeZoneGetter }; var GET_TIME_ZONE = /[A-Z]{3}(?![+\-])/, DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/, OPERA_TOSTRING_PATTERN = /^[\d].*Z$/, NUMBER_STRING = /^\d+$/; /** * @workInProgress * @ngdoc filter * @name angular.filter.date * @function * * @description * Formats `date` to a string based on the requested `format`. * * `format` string can be composed of the following elements: * * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010) * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10) * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199) * * `'MMMM'`: Month in year (January-December) * * `'MMM'`: Month in year (Jan-Dec) * * `'MM'`: Month in year, padded (01-12) * * `'M'`: Month in year (1-12) * * `'dd'`: Day in month, padded (01-31) * * `'d'`: Day in month (1-31) * * `'EEEE'`: Day in Week,(Sunday-Saturday) * * `'EEE'`: Day in Week, (Sun-Sat) * * `'HH'`: Hour in day, padded (00-23) * * `'H'`: Hour in day (0-23) * * `'hh'`: Hour in am/pm, padded (01-12) * * `'h'`: Hour in am/pm, (1-12) * * `'mm'`: Minute in hour, padded (00-59) * * `'m'`: Minute in hour (0-59) * * `'ss'`: Second in minute, padded (00-59) * * `'s'`: Second in minute (0-59) * * `'a'`: am/pm marker * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-1200) * * `format` string can also be one of the following predefined * {@link guide/dev_guide.i18n localizable formats}: * * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale * (e.g. Sep 3, 2010 12:05:08 pm) * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 pm) * * `'fullDate'`: equivalent to `'EEEE, MMMM d,y'` for en_US locale * (e.g. Friday, September 3, 2010) * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010 * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010) * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10) * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 pm) * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 pm) * * `format` string can contain literal values. These need to be quoted with single quotes (e.g. * `"h 'in the morning'"`). In order to output single quote, use two single quotes in a sequence * (e.g. `"h o''clock"`). * * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or * number) or ISO 8601 extended datetime string (yyyy-MM-ddTHH:mm:ss.SSSZ). * @param {string=} format Formatting rules (see Description). If not specified, * Date#toLocaleDateString is used. * @returns {string} Formatted string or the input if input is not recognized as date/millis. * * @example <doc:example> <doc:source> <span ng:non-bindable>{{1288323623006 | date:'medium'}}</span>: {{1288323623006 | date:'medium'}}<br/> <span ng:non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>: {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}<br/> <span ng:non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>: {{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}<br/> </doc:source> <doc:scenario> it('should format date', function(){ expect(binding("1288323623006 | date:'medium'")). toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/); expect(binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")). toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} \-?\d{4}/); expect(binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")). toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/); }); </doc:scenario> </doc:example> */ angularFilter.date = function(date, format) { var $locale = this.$service('$locale'); format = $locale.DATETIME_FORMATS[format] || format; if (isString(date)) { if (NUMBER_STRING.test(date)) { date = parseInt(date, 10); } else { date = angularString.toDate(date); } } if (isNumber(date)) { date = new Date(date); } if (!isDate(date)) { return date; } var text = date.toLocaleDateString(), fn; if (format && isString(format)) { text = ''; var parts = [], match; while(format) { match = DATE_FORMATS_SPLIT.exec(format); if (match) { parts = concat(parts, match, 1); format = parts.pop(); } else { parts.push(format); format = null; } } forEach(parts, function(value){ fn = DATE_FORMATS[value]; text += fn ? fn(date, $locale.DATETIME_FORMATS) : value.replace(/(^'|'$)/g, '').replace(/''/g, "'"); }); } return text; }; /** * @workInProgress * @ngdoc filter * @name angular.filter.json * @function * * @description * Allows you to convert a JavaScript object into JSON string. * * This filter is mostly useful for debugging. When using the double curly {{value}} notation * the binding is automatically converted to JSON. * * @param {*} object Any JavaScript object (including arrays and primitive types) to filter. * @returns {string} JSON string. * * @css ng-monospace Always applied to the encapsulating element. * * @example: <doc:example> <doc:source> <pre>{{ {'name':'value'} | json }}</pre> </doc:source> <doc:scenario> it('should jsonify filtered objects', function() { expect(binding('| json')).toBe('{\n "name":"value"}'); }); </doc:scenario> </doc:example> * */ angularFilter.json = function(object) { this.$element.addClass("ng-monospace"); return toJson(object, true); }; /** * @workInProgress * @ngdoc filter * @name angular.filter.lowercase * @function * * @see angular.lowercase */ angularFilter.lowercase = lowercase; /** * @workInProgress * @ngdoc filter * @name angular.filter.uppercase * @function * * @see angular.uppercase */ angularFilter.uppercase = uppercase; /** * @workInProgress * @ngdoc filter * @name angular.filter.html * @function * * @description * Prevents the input from getting escaped by angular. By default the input is sanitized and * inserted into the DOM as is. * * The input is sanitized by parsing the html into tokens. All safe tokens (from a whitelist) are * then serialized back to properly escaped html string. This means that no unsafe input can make * it into the returned string, however, since our parser is more strict than a typical browser * parser, it's possible that some obscure input, which would be recognized as valid HTML by a * browser, won't make it through the sanitizer. * * If you hate your users, you may call the filter with optional 'unsafe' argument, which bypasses * the html sanitizer, but makes your application vulnerable to XSS and other attacks. Using this * option is strongly discouraged and should be used only if you absolutely trust the input being * filtered and you can't get the content through the sanitizer. * * @param {string} html Html input. * @param {string=} option If 'unsafe' then do not sanitize the HTML input. * @returns {string} Sanitized or raw html. * * @example <doc:example> <doc:source> Snippet: <textarea name="snippet" cols="60" rows="3"> &lt;p style="color:blue"&gt;an html &lt;em onmouseover="this.textContent='PWN3D!'"&gt;click here&lt;/em&gt; snippet&lt;/p&gt;</textarea> <table> <tr> <td>Filter</td> <td>Source</td> <td>Rendered</td> </tr> <tr id="html-filter"> <td>html filter</td> <td> <pre>&lt;div ng:bind="snippet | html"&gt;<br/>&lt;/div&gt;</pre> </td> <td> <div ng:bind="snippet | html"></div> </td> </tr> <tr id="escaped-html"> <td>no filter</td> <td><pre>&lt;div ng:bind="snippet"&gt;<br/>&lt;/div&gt;</pre></td> <td><div ng:bind="snippet"></div></td> </tr> <tr id="html-unsafe-filter"> <td>unsafe html filter</td> <td><pre>&lt;div ng:bind="snippet | html:'unsafe'"&gt;<br/>&lt;/div&gt;</pre></td> <td><div ng:bind="snippet | html:'unsafe'"></div></td> </tr> </table> </doc:source> <doc:scenario> it('should sanitize the html snippet ', function(){ expect(using('#html-filter').binding('snippet | html')). toBe('<p>an html\n<em>click here</em>\nsnippet</p>'); }); it('should escape snippet without any filter', function() { expect(using('#escaped-html').binding('snippet')). toBe("&lt;p style=\"color:blue\"&gt;an html\n" + "&lt;em onmouseover=\"this.textContent='PWN3D!'\"&gt;click here&lt;/em&gt;\n" + "snippet&lt;/p&gt;"); }); it('should inline raw snippet if filtered as unsafe', function() { expect(using('#html-unsafe-filter').binding("snippet | html:'unsafe'")). toBe("<p style=\"color:blue\">an html\n" + "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" + "snippet</p>"); }); it('should update', function(){ input('snippet').enter('new <b>text</b>'); expect(using('#html-filter').binding('snippet | html')).toBe('new <b>text</b>'); expect(using('#escaped-html').binding('snippet')).toBe("new &lt;b&gt;text&lt;/b&gt;"); expect(using('#html-unsafe-filter').binding("snippet | html:'unsafe'")).toBe('new <b>text</b>'); }); </doc:scenario> </doc:example> */ angularFilter.html = function(html, option){ return new HTML(html, option); }; /** * @workInProgress * @ngdoc filter * @name angular.filter.linky * @function * * @description * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and * plain email address links. * * @param {string} text Input text. * @returns {string} Html-linkified text. * * @example <doc:example> <doc:source> Snippet: <textarea name="snippet" cols="60" rows="3"> Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, another@somewhere.org, and one more: ftp://127.0.0.1/.</textarea> <table> <tr> <td>Filter</td> <td>Source</td> <td>Rendered</td> </tr> <tr id="linky-filter"> <td>linky filter</td> <td> <pre>&lt;div ng:bind="snippet | linky"&gt;<br/>&lt;/div&gt;</pre> </td> <td> <div ng:bind="snippet | linky"></div> </td> </tr> <tr id="escaped-html"> <td>no filter</td> <td><pre>&lt;div ng:bind="snippet"&gt;<br/>&lt;/div&gt;</pre></td> <td><div ng:bind="snippet"></div></td> </tr> </table> </doc:source> <doc:scenario> it('should linkify the snippet with urls', function(){ expect(using('#linky-filter').binding('snippet | linky')). toBe('Pretty text with some links:\n' + '<a href="http://angularjs.org/">http://angularjs.org/</a>,\n' + '<a href="mailto:us@somewhere.org">us@somewhere.org</a>,\n' + '<a href="mailto:another@somewhere.org">another@somewhere.org</a>,\n' + 'and one more: <a href="ftp://127.0.0.1/">ftp://127.0.0.1/</a>.'); }); it ('should not linkify snippet without the linky filter', function() { expect(using('#escaped-html').binding('snippet')). toBe("Pretty text with some links:\n" + "http://angularjs.org/,\n" + "mailto:us@somewhere.org,\n" + "another@somewhere.org,\n" + "and one more: ftp://127.0.0.1/."); }); it('should update', function(){ input('snippet').enter('new http://link.'); expect(using('#linky-filter').binding('snippet | linky')). toBe('new <a href="http://link">http://link</a>.'); expect(using('#escaped-html').binding('snippet')).toBe('new http://link.'); }); </doc:scenario> </doc:example> */ var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}\<\>]/, MAILTO_REGEXP = /^mailto:/; angularFilter.linky = function(text) { if (!text) return text; var match; var raw = text; var html = []; var writer = htmlSanitizeWriter(html); var url; var i; while ((match = raw.match(LINKY_URL_REGEXP))) { // We can not end in these as they are sometimes found at the end of the sentence url = match[0]; // if we did not match ftp/http/mailto then assume mailto if (match[2] == match[3]) url = 'mailto:' + url; i = match.index; writer.chars(raw.substr(0, i)); writer.start('a', {href:url}); writer.chars(match[0].replace(MAILTO_REGEXP, '')); writer.end('a'); raw = raw.substring(i + match[0].length); } writer.chars(raw); return new HTML(html.join('')); }; /** * @workInProgress * @ngdoc overview * @name angular.formatter * @description * * Formatters are used for translating data formats between those used for display and those used * for storage. * * Following is the list of built-in angular formatters: * * * {@link angular.formatter.boolean boolean} - Formats user input in boolean format * * {@link angular.formatter.json json} - Formats user input in JSON format * * {@link angular.formatter.list list} - Formats user input string as an array * * {@link angular.formatter.number number} - Formats user input strings as a number * * {@link angular.formatter.trim trim} - Trims extras spaces from end of user input * * For more information about how angular formatters work, and how to create your own formatters, * see {@link guide/dev_guide.templates.formatters Understanding Angular Formatters} in the angular * Developer Guide. */ function formatter(format, parse) {return {'format':format, 'parse':parse || format};} function toString(obj) { return (isDefined(obj) && obj !== null) ? "" + obj : obj; } var NUMBER = /^\s*[-+]?\d*(\.\d*)?\s*$/; angularFormatter.noop = formatter(identity, identity); /** * @workInProgress * @ngdoc formatter * @name angular.formatter.json * * @description * Formats the user input as JSON text. * * @returns {?string} A JSON string representation of the model. * * @example <doc:example> <doc:source> <div ng:init="data={name:'misko', project:'angular'}"> <input type="text" size='50' name="data" ng:format="json"/> <pre>data={{data}}</pre> </div> </doc:source> <doc:scenario> it('should format json', function(){ expect(binding('data')).toEqual('data={\n \"name\":\"misko\",\n \"project\":\"angular\"}'); input('data').enter('{}'); expect(binding('data')).toEqual('data={\n }'); }); </doc:scenario> </doc:example> */ angularFormatter.json = formatter(toJson, function(value){ return fromJson(value || 'null'); }); /** * @workInProgress * @ngdoc formatter * @name angular.formatter.boolean * * @description * Use boolean formatter if you wish to store the data as boolean. * * @returns {boolean} Converts to `true` unless user enters (blank), `f`, `false`, `0`, `no`, `[]`. * * @example <doc:example> <doc:source> Enter truthy text: <input type="text" name="value" ng:format="boolean" value="no"/> <input type="checkbox" name="value"/> <pre>value={{value}}</pre> </doc:source> <doc:scenario> it('should format boolean', function(){ expect(binding('value')).toEqual('value=false'); input('value').enter('truthy'); expect(binding('value')).toEqual('value=true'); }); </doc:scenario> </doc:example> */ angularFormatter['boolean'] = formatter(toString, toBoolean); /** * @workInProgress * @ngdoc formatter * @name angular.formatter.number * * @description * Use number formatter if you wish to convert the user entered string to a number. * * @returns {number} Number from the parsed string. * * @example <doc:example> <doc:source> Enter valid number: <input type="text" name="value" ng:format="number" value="1234"/> <pre>value={{value}}</pre> </doc:source> <doc:scenario> it('should format numbers', function(){ expect(binding('value')).toEqual('value=1234'); input('value').enter('5678'); expect(binding('value')).toEqual('value=5678'); }); </doc:scenario> </doc:example> */ angularFormatter.number = formatter(toString, function(obj){ if (obj == null || NUMBER.exec(obj)) { return obj===null || obj === '' ? null : 1*obj; } else { throw "Not a number"; } }); /** * @workInProgress * @ngdoc formatter * @name angular.formatter.list * * @description * Use list formatter if you wish to convert the user entered string to an array. * * @returns {Array} Array parsed from the entered string. * * @example <doc:example> <doc:source> Enter a list of items: <input type="text" name="value" ng:format="list" value=" chair ,, table"/> <input type="text" name="value" ng:format="list"/> <pre>value={{value}}</pre> </doc:source> <doc:scenario> it('should format lists', function(){ expect(binding('value')).toEqual('value=["chair","table"]'); this.addFutureAction('change to XYZ', function($window, $document, done){ $document.elements('.doc-example-live :input:last').val(',,a,b,').trigger('change'); done(); }); expect(binding('value')).toEqual('value=["a","b"]'); }); </doc:scenario> </doc:example> */ angularFormatter.list = formatter( function(obj) { return obj ? obj.join(", ") : obj; }, function(value) { var list = []; forEach((value || '').split(','), function(item){ item = trim(item); if (item) list.push(item); }); return list; } ); /** * @workInProgress * @ngdoc formatter * @name angular.formatter.trim * * @description * Use trim formatter if you wish to trim extra spaces in user text. * * @returns {String} Trim excess leading and trailing space. * * @example <doc:example> <doc:source> Enter text with leading/trailing spaces: <input type="text" name="value" ng:format="trim" value=" book "/> <input type="text" name="value" ng:format="trim"/> <pre>value={{value|json}}</pre> </doc:source> <doc:scenario> it('should format trim', function(){ expect(binding('value')).toEqual('value="book"'); this.addFutureAction('change to XYZ', function($window, $document, done){ $document.elements('.doc-example-live :input:last').val(' text ').trigger('change'); done(); }); expect(binding('value')).toEqual('value="text"'); }); </doc:scenario> </doc:example> */ angularFormatter.trim = formatter( function(obj) { return obj ? trim("" + obj) : ""; } ); /** * @workInProgress * @ngdoc overview * @name angular.validator * @description * * Most of the built-in angular validators are used to check user input against defined types or * patterns. You can easily create your own custom validators as well. * * Following is the list of built-in angular validators: * * * {@link angular.validator.asynchronous asynchronous()} - Provides asynchronous validation via a * callback function. * * {@link angular.validator.date date()} - Checks user input against default date format: * "MM/DD/YYYY" * * {@link angular.validator.email email()} - Validates that user input is a well-formed email * address. * * {@link angular.validator.integer integer()} - Validates that user input is an integer * * {@link angular.validator.json json()} - Validates that user input is valid JSON * * {@link angular.validator.number number()} - Validates that user input is a number * * {@link angular.validator.phone phone()} - Validates that user input matches the pattern * "1(123)123-1234" * * {@link angular.validator.regexp regexp()} - Restricts valid input to a specified regular * expression pattern * * {@link angular.validator.url url()} - Validates that user input is a well-formed URL. * * For more information about how angular validators work, and how to create your own validators, * see {@link guide/dev_guide.templates.validators Understanding Angular Validators} in the angular * Developer Guide. */ extend(angularValidator, { 'noop': function() { return null; }, /** * @workInProgress * @ngdoc validator * @name angular.validator.regexp * @description * Use regexp validator to restrict the input to any Regular Expression. * * @param {string} value value to validate * @param {string|regexp} expression regular expression. * @param {string=} msg error message to display. * @css ng-validation-error * * @example <doc:example> <doc:source> <script> function Cntl(){ this.ssnRegExp = /^\d\d\d-\d\d-\d\d\d\d$/; } </script> Enter valid SSN: <div ng:controller="Cntl"> <input name="ssn" value="123-45-6789" ng:validate="regexp:ssnRegExp" > </div> </doc:source> <doc:scenario> it('should invalidate non ssn', function(){ var textBox = element('.doc-example-live :input'); expect(textBox.attr('className')).not().toMatch(/ng-validation-error/); expect(textBox.val()).toEqual('123-45-6789'); input('ssn').enter('123-45-67890'); expect(textBox.attr('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> * */ 'regexp': function(value, regexp, msg) { if (!value.match(regexp)) { return msg || "Value does not match expected format " + regexp + "."; } else { return null; } }, /** * @workInProgress * @ngdoc validator * @name angular.validator.number * @description * Use number validator to restrict the input to numbers with an * optional range. (See integer for whole numbers validator). * * @param {string} value value to validate * @param {int=} [min=MIN_INT] minimum value. * @param {int=} [max=MAX_INT] maximum value. * @css ng-validation-error * * @example <doc:example> <doc:source> Enter number: <input name="n1" ng:validate="number" > <br> Enter number greater than 10: <input name="n2" ng:validate="number:10" > <br> Enter number between 100 and 200: <input name="n3" ng:validate="number:100:200" > <br> </doc:source> <doc:scenario> it('should invalidate number', function(){ var n1 = element('.doc-example-live :input[name=n1]'); expect(n1.attr('className')).not().toMatch(/ng-validation-error/); input('n1').enter('1.x'); expect(n1.attr('className')).toMatch(/ng-validation-error/); var n2 = element('.doc-example-live :input[name=n2]'); expect(n2.attr('className')).not().toMatch(/ng-validation-error/); input('n2').enter('9'); expect(n2.attr('className')).toMatch(/ng-validation-error/); var n3 = element('.doc-example-live :input[name=n3]'); expect(n3.attr('className')).not().toMatch(/ng-validation-error/); input('n3').enter('201'); expect(n3.attr('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> * */ 'number': function(value, min, max) { var num = 1 * value; if (num == value) { if (typeof min != $undefined && num < min) { return "Value can not be less than " + min + "."; } if (typeof min != $undefined && num > max) { return "Value can not be greater than " + max + "."; } return null; } else { return "Not a number"; } }, /** * @workInProgress * @ngdoc validator * @name angular.validator.integer * @description * Use number validator to restrict the input to integers with an * optional range. (See integer for whole numbers validator). * * @param {string} value value to validate * @param {int=} [min=MIN_INT] minimum value. * @param {int=} [max=MAX_INT] maximum value. * @css ng-validation-error * * @example <doc:example> <doc:source> Enter integer: <input name="n1" ng:validate="integer" > <br> Enter integer equal or greater than 10: <input name="n2" ng:validate="integer:10" > <br> Enter integer between 100 and 200 (inclusive): <input name="n3" ng:validate="integer:100:200" > <br> </doc:source> <doc:scenario> it('should invalidate integer', function(){ var n1 = element('.doc-example-live :input[name=n1]'); expect(n1.attr('className')).not().toMatch(/ng-validation-error/); input('n1').enter('1.1'); expect(n1.attr('className')).toMatch(/ng-validation-error/); var n2 = element('.doc-example-live :input[name=n2]'); expect(n2.attr('className')).not().toMatch(/ng-validation-error/); input('n2').enter('10.1'); expect(n2.attr('className')).toMatch(/ng-validation-error/); var n3 = element('.doc-example-live :input[name=n3]'); expect(n3.attr('className')).not().toMatch(/ng-validation-error/); input('n3').enter('100.1'); expect(n3.attr('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> */ 'integer': function(value, min, max) { var numberError = angularValidator['number'](value, min, max); if (numberError) return numberError; if (!("" + value).match(/^\s*[\d+]*\s*$/) || value != Math.round(value)) { return "Not a whole number"; } return null; }, /** * @workInProgress * @ngdoc validator * @name angular.validator.date * @description * Use date validator to restrict the user input to a valid date * in format in format MM/DD/YYYY. * * @param {string} value value to validate * @css ng-validation-error * * @example <doc:example> <doc:source> Enter valid date: <input name="text" value="1/1/2009" ng:validate="date" > </doc:source> <doc:scenario> it('should invalidate date', function(){ var n1 = element('.doc-example-live :input'); expect(n1.attr('className')).not().toMatch(/ng-validation-error/); input('text').enter('123/123/123'); expect(n1.attr('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> * */ 'date': function(value) { var fields = /^(\d\d?)\/(\d\d?)\/(\d\d\d\d)$/.exec(value); var date = fields ? new Date(fields[3], fields[1]-1, fields[2]) : 0; return (date && date.getFullYear() == fields[3] && date.getMonth() == fields[1]-1 && date.getDate() == fields[2]) ? null : "Value is not a date. (Expecting format: 12/31/2009)."; }, /** * @workInProgress * @ngdoc validator * @name angular.validator.email * @description * Use email validator if you wist to restrict the user input to a valid email. * * @param {string} value value to validate * @css ng-validation-error * * @example <doc:example> <doc:source> Enter valid email: <input name="text" ng:validate="email" value="me@example.com"> </doc:source> <doc:scenario> it('should invalidate email', function(){ var n1 = element('.doc-example-live :input'); expect(n1.attr('className')).not().toMatch(/ng-validation-error/); input('text').enter('a@b.c'); expect(n1.attr('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> * */ 'email': function(value) { if (value.match(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/)) { return null; } return "Email needs to be in username@host.com format."; }, /** * @workInProgress * @ngdoc validator * @name angular.validator.phone * @description * Use phone validator to restrict the input phone numbers. * * @param {string} value value to validate * @css ng-validation-error * * @example <doc:example> <doc:source> Enter valid phone number: <input name="text" value="1(234)567-8901" ng:validate="phone" > </doc:source> <doc:scenario> it('should invalidate phone', function(){ var n1 = element('.doc-example-live :input'); expect(n1.attr('className')).not().toMatch(/ng-validation-error/); input('text').enter('+12345678'); expect(n1.attr('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> * */ 'phone': function(value) { if (value.match(/^1\(\d\d\d\)\d\d\d-\d\d\d\d$/)) { return null; } if (value.match(/^\+\d{2,3} (\(\d{1,5}\))?[\d ]+\d$/)) { return null; } return "Phone number needs to be in 1(987)654-3210 format in North America " + "or +999 (123) 45678 906 internationally."; }, /** * @workInProgress * @ngdoc validator * @name angular.validator.url * @description * Use phone validator to restrict the input URLs. * * @param {string} value value to validate * @css ng-validation-error * * @example <doc:example> <doc:source> Enter valid URL: <input name="text" value="http://example.com/abc.html" size="40" ng:validate="url" > </doc:source> <doc:scenario> it('should invalidate url', function(){ var n1 = element('.doc-example-live :input'); expect(n1.attr('className')).not().toMatch(/ng-validation-error/); input('text').enter('abc://server/path'); expect(n1.attr('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> * */ 'url': function(value) { if (value.match(/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/)) { return null; } return "URL needs to be in http://server[:port]/path format."; }, /** * @workInProgress * @ngdoc validator * @name angular.validator.json * @description * Use json validator if you wish to restrict the user input to a valid JSON. * * @param {string} value value to validate * @css ng-validation-error * * @example <doc:example> <doc:source> <textarea name="json" cols="60" rows="5" ng:validate="json"> {name:'abc'} </textarea> </doc:source> <doc:scenario> it('should invalidate json', function(){ var n1 = element('.doc-example-live :input'); expect(n1.attr('className')).not().toMatch(/ng-validation-error/); input('json').enter('{name}'); expect(n1.attr('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> * */ 'json': function(value) { try { fromJson(value); return null; } catch (e) { return e.toString(); } }, /** * @workInProgress * @ngdoc validator * @name angular.validator.asynchronous * @description * Use asynchronous validator if the validation can not be computed * immediately, but is provided through a callback. The widget * automatically shows a spinning indicator while the validity of * the widget is computed. This validator caches the result. * * @param {string} value value to validate * @param {function(inputToValidate,validationDone)} validate function to call to validate the state * of the input. * @param {function(data)=} [update=noop] function to call when state of the * validator changes * * @paramDescription * The `validate` function (specified by you) is called as * `validate(inputToValidate, validationDone)`: * * * `inputToValidate`: value of the input box. * * `validationDone`: `function(error, data){...}` * * `error`: error text to display if validation fails * * `data`: data object to pass to update function * * The `update` function is optionally specified by you and is * called by <angular/> on input change. Since the * asynchronous validator caches the results, the update * function can be called without a call to `validate` * function. The function is called as `update(data)`: * * * `data`: data object as passed from validate function * * @css ng-input-indicator-wait, ng-validation-error * * @example <doc:example> <doc:source> <script> function MyCntl(){ this.myValidator = function (inputToValidate, validationDone) { setTimeout(function(){ validationDone(inputToValidate.length % 2); }, 500); } } </script> This input is validated asynchronously: <div ng:controller="MyCntl"> <input name="text" ng:validate="asynchronous:myValidator"> </div> </doc:source> <doc:scenario> it('should change color in delayed way', function(){ var textBox = element('.doc-example-live :input'); expect(textBox.attr('className')).not().toMatch(/ng-input-indicator-wait/); expect(textBox.attr('className')).not().toMatch(/ng-validation-error/); input('text').enter('X'); expect(textBox.attr('className')).toMatch(/ng-input-indicator-wait/); sleep(.6); expect(textBox.attr('className')).not().toMatch(/ng-input-indicator-wait/); expect(textBox.attr('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> * */ /* * cache is attached to the element * cache: { * inputs : { * 'user input': { * response: server response, * error: validation error * }, * current: 'current input' * } * } * */ 'asynchronous': function(input, asynchronousFn, updateFn) { if (!input) return; var scope = this; var element = scope.$element; var cache = element.data('$asyncValidator'); if (!cache) { element.data('$asyncValidator', cache = {inputs:{}}); } cache.current = input; var inputState = cache.inputs[input], $invalidWidgets = scope.$service('$invalidWidgets'); if (!inputState) { cache.inputs[input] = inputState = { inFlight: true }; $invalidWidgets.markInvalid(scope.$element); element.addClass('ng-input-indicator-wait'); asynchronousFn(input, function(error, data) { inputState.response = data; inputState.error = error; inputState.inFlight = false; if (cache.current == input) { element.removeClass('ng-input-indicator-wait'); $invalidWidgets.markValid(element); } element.data($$validate)(); }); } else if (inputState.inFlight) { // request in flight, mark widget invalid, but don't show it to user $invalidWidgets.markInvalid(scope.$element); } else { (updateFn||noop)(inputState.response); } return inputState.error; } }); /** * @workInProgress * @ngdoc service * @name angular.service.$cookieStore * @requires $cookies * * @description * Provides a key-value (string-object) storage, that is backed by session cookies. * Objects put or retrieved from this storage are automatically serialized or * deserialized by angular's toJson/fromJson. * @example */ angularServiceInject('$cookieStore', function($store) { return { /** * @workInProgress * @ngdoc method * @name angular.service.$cookieStore#get * @methodOf angular.service.$cookieStore * * @description * Returns the value of given cookie key * * @param {string} key Id to use for lookup. * @returns {Object} Deserialized cookie value. */ get: function(key) { return fromJson($store[key]); }, /** * @workInProgress * @ngdoc method * @name angular.service.$cookieStore#put * @methodOf angular.service.$cookieStore * * @description * Sets a value for given cookie key * * @param {string} key Id for the `value`. * @param {Object} value Value to be stored. */ put: function(key, value) { $store[key] = toJson(value); }, /** * @workInProgress * @ngdoc method * @name angular.service.$cookieStore#remove * @methodOf angular.service.$cookieStore * * @description * Remove given cookie * * @param {string} key Id of the key-value pair to delete. */ remove: function(key) { delete $store[key]; } }; }, ['$cookies']); /** * @workInProgress * @ngdoc service * @name angular.service.$cookies * @requires $browser * * @description * Provides read/write access to browser's cookies. * * Only a simple Object is exposed and by adding or removing properties to/from * this object, new cookies are created/deleted at the end of current $eval. * * @example */ angularServiceInject('$cookies', function($browser) { var rootScope = this, cookies = {}, lastCookies = {}, lastBrowserCookies, runEval = false; //creates a poller fn that copies all cookies from the $browser to service & inits the service $browser.addPollFn(function() { var currentCookies = $browser.cookies(); if (lastBrowserCookies != currentCookies) { //relies on browser.cookies() impl lastBrowserCookies = currentCookies; copy(currentCookies, lastCookies); copy(currentCookies, cookies); if (runEval) rootScope.$apply(); } })(); runEval = true; //at the end of each eval, push cookies //TODO: this should happen before the "delayed" watches fire, because if some cookies are not // strings or browser refuses to store some cookies, we update the model in the push fn. this.$watch(push); return cookies; /** * Pushes all the cookies from the service to the browser and verifies if all cookies were stored. */ function push(){ var name, value, browserCookies, updated; //delete any cookies deleted in $cookies for (name in lastCookies) { if (isUndefined(cookies[name])) { $browser.cookies(name, undefined); } } //update all cookies updated in $cookies for(name in cookies) { value = cookies[name]; if (!isString(value)) { if (isDefined(lastCookies[name])) { cookies[name] = lastCookies[name]; } else { delete cookies[name]; } } else if (value !== lastCookies[name]) { $browser.cookies(name, value); updated = true; } } //verify what was actually stored if (updated){ updated = false; browserCookies = $browser.cookies(); for (name in cookies) { if (cookies[name] !== browserCookies[name]) { //delete or reset all cookies that the browser dropped from $cookies if (isUndefined(browserCookies[name])) { delete cookies[name]; } else { cookies[name] = browserCookies[name]; } updated = true; } } } } }, ['$browser']); /** * @workInProgress * @ngdoc service * @name angular.service.$defer * @requires $browser * * @description * Delegates to {@link angular.service.$browser $browser.defer}, but wraps the `fn` function * into a try/catch block and delegates any exceptions to * {@link angular.service.$exceptionHandler $exceptionHandler} service. * * In tests you can use `$browser.defer.flush()` to flush the queue of deferred functions. * * @param {function()} fn A function, who's execution should be deferred. * @param {number=} [delay=0] of milliseconds to defer the function execution. */ angularServiceInject('$defer', function($browser) { var scope = this; return function(fn, delay) { $browser.defer(function() { scope.$apply(fn); }, delay); }; }, ['$browser']); /** * @workInProgress * @ngdoc service * @name angular.service.$document * @requires $window * * @description * A {@link angular.element jQuery (lite)}-wrapped reference to the browser's `window.document` * element. */ angularServiceInject("$document", function(window){ return jqLite(window.document); }, ['$window']); /** * @workInProgress * @ngdoc service * @name angular.service.$exceptionHandler * @requires $log * * @description * Any uncaught exception in angular expressions is delegated to this service. * The default implementation simply delegates to `$log.error` which logs it into * the browser console. * * In unit tests, if `angular-mocks.js` is loaded, this service is overriden by * {@link angular.mock.service.$exceptionHandler mock $exceptionHandler} * * @example */ var $exceptionHandlerFactory; //reference to be used only in tests angularServiceInject('$exceptionHandler', $exceptionHandlerFactory = function($log){ return function(e) { $log.error(e); }; }, ['$log']); /** * @workInProgress * @ngdoc service * @name angular.service.$hover * @requires $browser * @requires $document * * @description * * @example */ angularServiceInject("$hover", function(browser, document) { var tooltip, self = this, error, width = 300, arrowWidth = 10, body = jqLite(document[0].body); browser.hover(function(element, show){ if (show && (error = element.attr(NG_EXCEPTION) || element.attr(NG_VALIDATION_ERROR))) { if (!tooltip) { tooltip = { callout: jqLite('<div id="ng-callout"></div>'), arrow: jqLite('<div></div>'), title: jqLite('<div class="ng-title"></div>'), content: jqLite('<div class="ng-content"></div>') }; tooltip.callout.append(tooltip.arrow); tooltip.callout.append(tooltip.title); tooltip.callout.append(tooltip.content); body.append(tooltip.callout); } var docRect = body[0].getBoundingClientRect(), elementRect = element[0].getBoundingClientRect(), leftSpace = docRect.right - elementRect.right - arrowWidth; tooltip.title.text(element.hasClass("ng-exception") ? "EXCEPTION:" : "Validation error..."); tooltip.content.text(error); if (leftSpace < width) { tooltip.arrow.addClass('ng-arrow-right'); tooltip.arrow.css({left: (width + 1)+'px'}); tooltip.callout.css({ position: 'fixed', left: (elementRect.left - arrowWidth - width - 4) + "px", top: (elementRect.top - 3) + "px", width: width + "px" }); } else { tooltip.arrow.addClass('ng-arrow-left'); tooltip.callout.css({ position: 'fixed', left: (elementRect.right + arrowWidth) + "px", top: (elementRect.top - 3) + "px", width: width + "px" }); } } else if (tooltip) { tooltip.callout.remove(); tooltip = null; } }); }, ['$browser', '$document'], true); /** * @workInProgress * @ngdoc service * @name angular.service.$invalidWidgets * * @description * Keeps references to all invalid widgets found during validation. * Can be queried to find whether there are any invalid widgets currently displayed. * * @example */ angularServiceInject("$invalidWidgets", function(){ var invalidWidgets = []; /** Remove an element from the array of invalid widgets */ invalidWidgets.markValid = function(element){ var index = indexOf(invalidWidgets, element); if (index != -1) invalidWidgets.splice(index, 1); }; /** Add an element to the array of invalid widgets */ invalidWidgets.markInvalid = function(element){ var index = indexOf(invalidWidgets, element); if (index === -1) invalidWidgets.push(element); }; /** Return count of all invalid widgets that are currently visible */ invalidWidgets.visible = function() { var count = 0; forEach(invalidWidgets, function(widget){ count = count + (isVisible(widget) ? 1 : 0); }); return count; }; /* At the end of each eval removes all invalid widgets that are not part of the current DOM. */ this.$watch(function() { for(var i = 0; i < invalidWidgets.length;) { var widget = invalidWidgets[i]; if (isOrphan(widget[0])) { invalidWidgets.splice(i, 1); if (widget.dealoc) widget.dealoc(); } else { i++; } } }); /** * Traverses DOM element's (widget's) parents and considers the element to be an orphan if one of * it's parents isn't the current window.document. */ function isOrphan(widget) { if (widget == window.document) return false; var parent = widget.parentNode; return !parent || isOrphan(parent); } return invalidWidgets; }); var URL_MATCH = /^(file|ftp|http|https):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/, PATH_MATCH = /^([^\?#]*)?(\?([^#]*))?(#(.*))?$/, HASH_MATCH = PATH_MATCH, DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21}; /** * Encode path using encodeUriSegment, ignoring forward slashes * * @param {string} path Path to encode * @returns {string} */ function encodePath(path) { var segments = path.split('/'), i = segments.length; while (i--) { segments[i] = encodeUriSegment(segments[i]); } return segments.join('/'); } function matchUrl(url, obj) { var match = URL_MATCH.exec(url), match = { protocol: match[1], host: match[3], port: parseInt(match[5]) || DEFAULT_PORTS[match[1]] || null, path: match[6] || '/', search: match[8], hash: match[10] }; if (obj) { obj.$$protocol = match.protocol; obj.$$host = match.host; obj.$$port = match.port; } return match; } function composeProtocolHostPort(protocol, host, port) { return protocol + '://' + host + (port == DEFAULT_PORTS[protocol] ? '' : ':' + port); } function pathPrefixFromBase(basePath) { return basePath.substr(0, basePath.lastIndexOf('/')); } function convertToHtml5Url(url, basePath, hashPrefix) { var match = matchUrl(url); // already html5 url if (decodeURIComponent(match.path) != basePath || isUndefined(match.hash) || match.hash.indexOf(hashPrefix) != 0) { return url; // convert hashbang url -> html5 url } else { return composeProtocolHostPort(match.protocol, match.host, match.port) + pathPrefixFromBase(basePath) + match.hash.substr(hashPrefix.length); } } function convertToHashbangUrl(url, basePath, hashPrefix) { var match = matchUrl(url); // already hashbang url if (decodeURIComponent(match.path) == basePath) { return url; // convert html5 url -> hashbang url } else { var search = match.search && '?' + match.search || '', hash = match.hash && '#' + match.hash || '', pathPrefix = pathPrefixFromBase(basePath), path = match.path.substr(pathPrefix.length); if (match.path.indexOf(pathPrefix) != 0) { throw 'Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !'; } return composeProtocolHostPort(match.protocol, match.host, match.port) + basePath + '#' + hashPrefix + path + search + hash; } } /** * LocationUrl represents an url * This object is exposed as $location service when html5 is enabled and supported * * @constructor * @param {string} url Html5 url * @param {string} pathPrefix */ function LocationUrl(url, pathPrefix) { pathPrefix = pathPrefix || ''; /** * Parse given html5 (regular) url string into properties * @param {string} url Html5 url * @private */ this.$$parse = function(url) { var match = matchUrl(url, this); if (match.path.indexOf(pathPrefix) != 0) { throw 'Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !'; } this.$$path = decodeURIComponent(match.path.substr(pathPrefix.length)); this.$$search = parseKeyValue(match.search); this.$$hash = match.hash && decodeURIComponent(match.hash) || ''; this.$$compose(); }, /** * Compose url and update `absUrl` property * @private */ this.$$compose = function() { var search = toKeyValue(this.$$search), hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; this.$$absUrl = composeProtocolHostPort(this.$$protocol, this.$$host, this.$$port) + pathPrefix + this.$$url; }; this.$$parse(url); } /** * LocationHashbangUrl represents url * This object is exposed as $location service when html5 history api is disabled or not supported * * @constructor * @param {string} url Legacy url * @param {string} hashPrefix Prefix for hash part (containing path and search) */ function LocationHashbangUrl(url, hashPrefix) { var basePath; /** * Parse given hashbang url into properties * @param {string} url Hashbang url * @private */ this.$$parse = function(url) { var match = matchUrl(url, this); if (match.hash && match.hash.indexOf(hashPrefix) != 0) { throw 'Invalid url "' + url + '", missing hash prefix "' + hashPrefix + '" !'; } basePath = match.path + (match.search ? '?' + match.search : ''); match = HASH_MATCH.exec((match.hash || '').substr(hashPrefix.length)); if (match[1]) { this.$$path = (match[1].charAt(0) == '/' ? '' : '/') + decodeURIComponent(match[1]); } else { this.$$path = ''; } this.$$search = parseKeyValue(match[3]); this.$$hash = match[5] && decodeURIComponent(match[5]) || ''; this.$$compose(); }; /** * Compose hashbang url and update `absUrl` property * @private */ this.$$compose = function() { var search = toKeyValue(this.$$search), hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; this.$$absUrl = composeProtocolHostPort(this.$$protocol, this.$$host, this.$$port) + basePath + (this.$$url ? '#' + hashPrefix + this.$$url : ''); }; this.$$parse(url); } LocationUrl.prototype = LocationHashbangUrl.prototype = { /** * Has any change been replacing ? * @private */ $$replace: false, /** * @ngdoc method * @name angular.service.$location#absUrl * @methodOf angular.service.$location * * @description * This method is getter only. * * Return full url representation with all segments encoded according to rules specified in * {@link http://www.ietf.org/rfc/rfc3986.txt RFC 3986}. * * @return {string} */ absUrl: locationGetter('$$absUrl'), /** * @ngdoc method * @name angular.service.$location#url * @methodOf angular.service.$location * * @description * This method is getter / setter. * * Return url (e.g. `/path?a=b#hash`) when called without any parameter. * * Change path, search and hash, when called with parameter and return `$location`. * * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`) * @return {string} */ url: function(url, replace) { if (isUndefined(url)) return this.$$url; var match = PATH_MATCH.exec(url); this.path(decodeURIComponent(match[1] || '')).search(match[3] || '') .hash(match[5] || '', replace); return this; }, /** * @ngdoc method * @name angular.service.$location#protocol * @methodOf angular.service.$location * * @description * This method is getter only. * * Return protocol of current url. * * @return {string} */ protocol: locationGetter('$$protocol'), /** * @ngdoc method * @name angular.service.$location#host * @methodOf angular.service.$location * * @description * This method is getter only. * * Return host of current url. * * @return {string} */ host: locationGetter('$$host'), /** * @ngdoc method * @name angular.service.$location#port * @methodOf angular.service.$location * * @description * This method is getter only. * * Return port of current url. * * @return {Number} */ port: locationGetter('$$port'), /** * @ngdoc method * @name angular.service.$location#path * @methodOf angular.service.$location * * @description * This method is getter / setter. * * Return path of current url when called without any parameter. * * Change path when called with parameter and return `$location`. * * Note: Path should always begin with forward slash (/), this method will add the forward slash * if it is missing. * * @param {string=} path New path * @return {string} */ path: locationGetterSetter('$$path', function(path) { return path.charAt(0) == '/' ? path : '/' + path; }), /** * @ngdoc method * @name angular.service.$location#search * @methodOf angular.service.$location * * @description * This method is getter / setter. * * Return search part (as object) of current url when called without any parameter. * * Change search part when called with parameter and return `$location`. * * @param {string|object<string,string>=} search New search part - string or hash object * @return {string} */ search: function(search, paramValue) { if (isUndefined(search)) return this.$$search; if (isDefined(paramValue)) { if (paramValue === null) { delete this.$$search[search]; } else { this.$$search[search] = encodeUriQuery(paramValue); } } else { this.$$search = isString(search) ? parseKeyValue(search) : search; } this.$$compose(); return this; }, /** * @ngdoc method * @name angular.service.$location#hash * @methodOf angular.service.$location * * @description * This method is getter / setter. * * Return hash fragment when called without any parameter. * * Change hash fragment when called with parameter and return `$location`. * * @param {string=} hash New hash fragment * @return {string} */ hash: locationGetterSetter('$$hash', identity), /** * @ngdoc method * @name angular.service.$location#replace * @methodOf angular.service.$location * * @description * If called, all changes to $location during current `$digest` will be replacing current history * record, instead of adding new one. */ replace: function() { this.$$replace = true; return this; } }; function locationGetter(property) { return function() { return this[property]; }; } function locationGetterSetter(property, preprocess) { return function(value) { if (isUndefined(value)) return this[property]; this[property] = preprocess(value); this.$$compose(); return this; }; } /** * @ngdoc service * @name angular.service.$location * * @requires $browser * @requires $sniffer * @requires $config * @requires $document * * @description * The $location service parses the URL in the browser address bar (based on the {@link https://developer.mozilla.org/en/window.location window.location}) and makes the URL available to your application. Changes to the URL in the address bar are reflected into $location service and changes to $location are reflected into the browser address bar. * * **The $location service:** * * - Exposes the current URL in the browser address bar, so you can * - Watch and observe the URL. * - Change the URL. * - Synchronizes the URL with the browser when the user * - Changes the address bar. * - Clicks the back or forward button (or clicks a History link). * - Clicks on a link. * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash). * * For more information see {@link guide/dev_guide.services.$location Developer Guide: Angular Services: Using $location} */ angularServiceInject('$location', function($browser, $sniffer, $config, $document) { var scope = this, currentUrl, basePath = $browser.baseHref() || '/', pathPrefix = pathPrefixFromBase(basePath), hashPrefix = $config.hashPrefix || '', initUrl = $browser.url(); if ($config.html5Mode) { if ($sniffer.history) { currentUrl = new LocationUrl(convertToHtml5Url(initUrl, basePath, hashPrefix), pathPrefix); } else { currentUrl = new LocationHashbangUrl(convertToHashbangUrl(initUrl, basePath, hashPrefix), hashPrefix); } // link rewriting var u = currentUrl, absUrlPrefix = composeProtocolHostPort(u.protocol(), u.host(), u.port()) + pathPrefix; $document.bind('click', function(event) { // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser) // currently we open nice url link and redirect then if (uppercase(event.target.nodeName) != 'A' || event.ctrlKey || event.which == 2) return; var elm = jqLite(event.target), href = elm.attr('href'); if (!href || isDefined(elm.attr('ng:ext-link')) || elm.attr('target')) return; // remove same domain from full url links (IE7 always returns full hrefs) href = href.replace(absUrlPrefix, ''); // link to different domain (or base path) if (href.substr(0, 4) == 'http') return; // remove pathPrefix from absolute links href = href.indexOf(pathPrefix) === 0 ? href.substr(pathPrefix.length) : href; currentUrl.url(href); scope.$apply(); event.preventDefault(); }); } else { currentUrl = new LocationHashbangUrl(initUrl, hashPrefix); } // rewrite hashbang url <> html5 url if (currentUrl.absUrl() != initUrl) { $browser.url(currentUrl.absUrl(), true); } // update $location when $browser url changes $browser.onUrlChange(function(newUrl) { if (currentUrl.absUrl() != newUrl) { currentUrl.$$parse(newUrl); scope.$apply(); } }); // update browser var changeCounter = 0; scope.$watch(function() { if ($browser.url() != currentUrl.absUrl()) { changeCounter++; scope.$evalAsync(function() { $browser.url(currentUrl.absUrl(), currentUrl.$$replace); currentUrl.$$replace = false; }); } return changeCounter; }); return currentUrl; }, ['$browser', '$sniffer', '$locationConfig', '$document']); angular.service('$locationConfig', function() { return { html5Mode: false, hashPrefix: '' }; }); /** * @workInProgress * @ngdoc service * @name angular.service.$log * @requires $window * * @description * Simple service for logging. Default implementation writes the message * into the browser's console (if present). * * The main purpose of this service is to simplify debugging and troubleshooting. * * @example <doc:example> <doc:source> <p>Reload this page with open console, enter text and hit the log button...</p> Message: <input type="text" name="message" value="Hello World!"/> <button ng:click="$log.log(message)">log</button> <button ng:click="$log.warn(message)">warn</button> <button ng:click="$log.info(message)">info</button> <button ng:click="$log.error(message)">error</button> </doc:source> <doc:scenario> </doc:scenario> </doc:example> */ var $logFactory; //reference to be used only in tests angularServiceInject("$log", $logFactory = function($window){ return { /** * @workInProgress * @ngdoc method * @name angular.service.$log#log * @methodOf angular.service.$log * * @description * Write a log message */ log: consoleLog('log'), /** * @workInProgress * @ngdoc method * @name angular.service.$log#warn * @methodOf angular.service.$log * * @description * Write a warning message */ warn: consoleLog('warn'), /** * @workInProgress * @ngdoc method * @name angular.service.$log#info * @methodOf angular.service.$log * * @description * Write an information message */ info: consoleLog('info'), /** * @workInProgress * @ngdoc method * @name angular.service.$log#error * @methodOf angular.service.$log * * @description * Write an error message */ error: consoleLog('error') }; function consoleLog(type) { var console = $window.console || {}; var logFn = console[type] || console.log || noop; if (logFn.apply) { return function(){ var args = []; forEach(arguments, function(arg){ args.push(formatError(arg)); }); return logFn.apply(console, args); }; } else { // we are IE, in which case there is nothing we can do return logFn; } } }, ['$window']); /** * @workInProgress * @ngdoc service * @name angular.service.$resource * @requires $xhr.cache * * @description * A factory which creates a resource object that lets you interact with * [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources. * * The returned resource object has action methods which provide high-level behaviors without * the need to interact with the low level {@link angular.service.$xhr $xhr} service or * raw XMLHttpRequest. * * @param {string} url A parameterized URL template with parameters prefixed by `:` as in * `/user/:username`. * * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in * `actions` methods. * * Each key value in the parameter object is first bound to url template if present and then any * excess keys are appended to the url search query after the `?`. * * Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in * URL `/path/greet?salutation=Hello`. * * If the parameter value is prefixed with `@` then the value of that parameter is extracted from * the data object (useful for non-GET operations). * * @param {Object.<Object>=} actions Hash with declaration of custom action that should extend the * default set of resource actions. The declaration should be created in the following format: * * {action1: {method:?, params:?, isArray:?, verifyCache:?}, * action2: {method:?, params:?, isArray:?, verifyCache:?}, * ...} * * Where: * * - `action` – {string} – The name of action. This name becomes the name of the method on your * resource object. * - `method` – {string} – HTTP request method. Valid methods are: `GET`, `POST`, `PUT`, `DELETE`, * and `JSON` (also known as JSONP). * - `params` – {object=} – Optional set of pre-bound parameters for this action. * - isArray – {boolean=} – If true then the returned object for this action is an array, see * `returns` section. * - verifyCache – {boolean=} – If true then whenever cache hit occurs, the object is returned and * an async request will be made to the server and the resources as well as the cache will be * updated when the response is received. * * @returns {Object} A resource "class" object with methods for the default set of resource actions * optionally extended with custom `actions`. The default set contains these actions: * * { 'get': {method:'GET'}, * 'save': {method:'POST'}, * 'query': {method:'GET', isArray:true}, * 'remove': {method:'DELETE'}, * 'delete': {method:'DELETE'} }; * * Calling these methods invoke an {@link angular.service.$xhr} with the specified http method, * destination and parameters. When the data is returned from the server then the object is an * instance of the resource class `save`, `remove` and `delete` actions are available on it as * methods with the `$` prefix. This allows you to easily perform CRUD operations (create, read, * update, delete) on server-side data like this: * <pre> var User = $resource('/user/:userId', {userId:'@id'}); var user = User.get({userId:123}, function(){ user.abc = true; user.$save(); }); </pre> * * It is important to realize that invoking a $resource object method immediately returns an * empty reference (object or array depending on `isArray`). Once the data is returned from the * server the existing reference is populated with the actual data. This is a useful trick since * usually the resource is assigned to a model which is then rendered by the view. Having an empty * object results in no rendering, once the data arrives from the server then the object is * populated with the data and the view automatically re-renders itself showing the new data. This * means that in most case one never has to write a callback function for the action methods. * * The action methods on the class object or instance object can be invoked with the following * parameters: * * - HTTP GET "class" actions: `Resource.action([parameters], [success], [error])` * - non-GET "class" actions: `Resource.action(postData, [parameters], [success], [error])` * - non-GET instance actions: `instance.$action([parameters], [success], [error])` * * * @example * * # Credit card resource * * <pre> // Define CreditCard class var CreditCard = $resource('/user/:userId/card/:cardId', {userId:123, cardId:'@id'}, { charge: {method:'POST', params:{charge:true}} }); // We can retrieve a collection from the server var cards = CreditCard.query(); // GET: /user/123/card // server returns: [ {id:456, number:'1234', name:'Smith'} ]; var card = cards[0]; // each item is an instance of CreditCard expect(card instanceof CreditCard).toEqual(true); card.name = "J. Smith"; // non GET methods are mapped onto the instances card.$save(); // POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'} // server returns: {id:456, number:'1234', name: 'J. Smith'}; // our custom method is mapped as well. card.$charge({amount:9.99}); // POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'} // server returns: {id:456, number:'1234', name: 'J. Smith'}; // we can create an instance as well var newCard = new CreditCard({number:'0123'}); newCard.name = "Mike Smith"; newCard.$save(); // POST: /user/123/card {number:'0123', name:'Mike Smith'} // server returns: {id:789, number:'01234', name: 'Mike Smith'}; expect(newCard.id).toEqual(789); * </pre> * * The object returned from this function execution is a resource "class" which has "static" method * for each action in the definition. * * Calling these methods invoke `$xhr` on the `url` template with the given `method` and `params`. * When the data is returned from the server then the object is an instance of the resource type and * all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD * operations (create, read, update, delete) on server-side data. <pre> var User = $resource('/user/:userId', {userId:'@id'}); var user = User.get({userId:123}, function(){ user.abc = true; user.$save(); }); </pre> * * It's worth noting that the success callback for `get`, `query` and other method gets passed * in the response that came from the server, so one could rewrite the above example as: * <pre> var User = $resource('/user/:userId', {userId:'@id'}); User.get({userId:123}, function(u){ u.abc = true; u.$save(); }); </pre> * # Buzz client Let's look at what a buzz client created with the `$resource` service looks like: <doc:example> <doc:source jsfiddle="false"> <script> function BuzzController($resource) { this.Activity = $resource( 'https://www.googleapis.com/buzz/v1/activities/:userId/:visibility/:activityId/:comments', {alt:'json', callback:'JSON_CALLBACK'}, {get:{method:'JSON', params:{visibility:'@self'}}, replies: {method:'JSON', params:{visibility:'@self', comments:'@comments'}}} ); } BuzzController.prototype = { fetch: function() { this.activities = this.Activity.get({userId:this.userId}); }, expandReplies: function(activity) { activity.replies = this.Activity.replies({userId:this.userId, activityId:activity.id}); } }; BuzzController.$inject = ['$resource']; </script> <div ng:controller="BuzzController"> <input name="userId" value="googlebuzz"/> <button ng:click="fetch()">fetch</button> <hr/> <div ng:repeat="item in activities.data.items"> <h1 style="font-size: 15px;"> <img src="{{item.actor.thumbnailUrl}}" style="max-height:30px;max-width:30px;"/> <a href="{{item.actor.profileUrl}}">{{item.actor.name}}</a> <a href ng:click="expandReplies(item)" style="float: right;">Expand replies: {{item.links.replies[0].count}}</a> </h1> {{item.object.content | html}} <div ng:repeat="reply in item.replies.data.items" style="margin-left: 20px;"> <img src="{{reply.actor.thumbnailUrl}}" style="max-height:30px;max-width:30px;"/> <a href="{{reply.actor.profileUrl}}">{{reply.actor.name}}</a>: {{reply.content | html}} </div> </div> </div> </doc:source> <doc:scenario> </doc:scenario> </doc:example> */ angularServiceInject('$resource', function($xhr){ var resource = new ResourceFactory($xhr); return bind(resource, resource.route); }, ['$xhr.cache']); /** * @workInProgress * @ngdoc service * @name angular.service.$route * @requires $location * @requires $routeParams * * @property {Object} current Reference to the current route definition. * @property {Array.<Object>} routes Array of all configured routes. * * @description * Watches `$location.url()` and tries to map the path to an existing route * definition. It is used for deep-linking URLs to controllers and views (HTML partials). * * The `$route` service is typically used in conjunction with {@link angular.widget.ng:view ng:view} * widget and the {@link angular.service.$routeParams $routeParams} service. * * @example This example shows how changing the URL hash causes the <tt>$route</tt> to match a route against the URL, and the <tt>[[ng:include]]</tt> pulls in the partial. <doc:example> <doc:source jsfiddle="false"> <script> function MainCntl($route, $routeParams, $location) { this.$route = $route; this.$location = $location; this.$routeParams = $routeParams; $route.when('/Book/:bookId', {template: 'examples/book.html', controller: BookCntl}); $route.when('/Book/:bookId/ch/:chapterId', {template: 'examples/chapter.html', controller: ChapterCntl}); } function BookCntl($routeParams) { this.name = "BookCntl"; this.params = $routeParams; } function ChapterCntl($routeParams) { this.name = "ChapterCntl"; this.params = $routeParams; } </script> <div ng:controller="MainCntl"> Choose: <a href="#/Book/Moby">Moby</a> | <a href="#/Book/Moby/ch/1">Moby: Ch1</a> | <a href="#/Book/Gatsby">Gatsby</a> | <a href="#/Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a><br/> <pre>$location.path() = {{$location.path()}}</pre> <pre>$route.current.template = {{$route.current.template}}</pre> <pre>$route.current.params = {{$route.current.params}}</pre> <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre> <pre>$routeParams = {{$routeParams}}</pre> <hr /> <ng:view></ng:view> </div> </doc:source> <doc:scenario> </doc:scenario> </doc:example> */ angularServiceInject('$route', function($location, $routeParams) { /** * @workInProgress * @ngdoc event * @name angular.service.$route#$beforeRouteChange * @eventOf angular.service.$route * @eventType broadcast on root scope * @description * Broadcasted before a route change. * * @param {Route} next Future route information. * @param {Route} current Current route information. * * The `Route` object extends the route definition with the following properties. * * * `scope` - The instance of the route controller. * * `params` - The current {@link angular.service.$routeParams params}. * */ /** * @workInProgress * @ngdoc event * @name angular.service.$route#$afterRouteChange * @eventOf angular.service.$route * @eventType broadcast on root scope * @description * Broadcasted after a route change. * * @param {Route} current Current route information. * @param {Route} previous Previous route information. * * The `Route` object extends the route definition with the following properties. * * * `scope` - The instance of the route controller. * * `params` - The current {@link angular.service.$routeParams params}. * */ /** * @workInProgress * @ngdoc event * @name angular.service.$route#$routeUpdate * @eventOf angular.service.$route * @eventType emit on the current route scope * @description * * The `reloadOnSearch` property has been set to false, and we are reusing the same * instance of the Controller. */ var routes = {}, matcher = switchRouteMatcher, parentScope = this, rootScope = this, dirty = 0, forceReload = false, $route = { routes: routes, /** * @workInProgress * @ngdoc method * @name angular.service.$route#parent * @methodOf angular.service.$route * * @param {Scope} [scope=rootScope] Scope to be used as parent for newly created * `$route.current.scope` scopes. * * @description * Sets a scope to be used as the parent scope for scopes created on route change. If not * set, defaults to the root scope. */ parent: function(scope) { if (scope) parentScope = scope; }, /** * @workInProgress * @ngdoc method * @name angular.service.$route#when * @methodOf angular.service.$route * * @param {string} path Route path (matched against `$location.hash`) * @param {Object} route Mapping information to be assigned to `$route.current` on route * match. * * Object properties: * * - `controller` – `{function()=}` – Controller fn that should be associated with newly * created scope. * - `template` – `{string=}` – path to an html template that should be used by * {@link angular.widget.ng:view ng:view} or * {@link angular.widget.ng:include ng:include} widgets. * - `redirectTo` – {(string|function())=} – value to update * {@link angular.service.$location $location} path with and trigger route redirection. * * If `redirectTo` is a function, it will be called with the following parameters: * * - `{Object.<string>}` - route parameters extracted from the current * `$location.path()` by applying the current route template. * - `{string}` - current `$location.path()` * - `{Object}` - current `$location.search()` * * The custom `redirectTo` function is expected to return a string which will be used * to update `$location.path()` and `$location.search()`. * * - `[reloadOnSearch=true]` - {boolean=} - reload route when only $location.search() * changes. * * If the option is set to false and url in the browser changes, then * $routeUpdate event is emited on the current route scope. You can use this event to * react to {@link angular.service.$routeParams} changes: * * function MyCtrl($route, $routeParams) { * this.$on('$routeUpdate', function() { * // do stuff with $routeParams * }); * } * * @returns {Object} route object * * @description * Adds a new route definition to the `$route` service. */ when: function (path, route) { var routeDef = routes[path]; if (!routeDef) routeDef = routes[path] = {reloadOnSearch: true}; if (route) extend(routeDef, route); // TODO(im): what the heck? merge two route definitions? dirty++; return routeDef; }, /** * @workInProgress * @ngdoc method * @name angular.service.$route#otherwise * @methodOf angular.service.$route * * @description * Sets route definition that will be used on route change when no other route definition * is matched. * * @param {Object} params Mapping information to be assigned to `$route.current`. */ otherwise: function(params) { $route.when(null, params); }, /** * @workInProgress * @ngdoc method * @name angular.service.$route#reload * @methodOf angular.service.$route * * @description * Causes `$route` service to reload (and recreate the `$route.current` scope) upon the next * eval even if {@link angular.service.$location $location} hasn't changed. */ reload: function() { dirty++; forceReload = true; } }; this.$watch(function() { return dirty + $location.url(); }, updateRoute); return $route; ///////////////////////////////////////////////////// function switchRouteMatcher(on, when) { var regex = '^' + when.replace(/[\.\\\(\)\^\$]/g, "\$1") + '$', params = [], dst = {}; forEach(when.split(/\W/), function(param) { if (param) { var paramRegExp = new RegExp(":" + param + "([\\W])"); if (regex.match(paramRegExp)) { regex = regex.replace(paramRegExp, "([^\/]*)$1"); params.push(param); } } }); var match = on.match(new RegExp(regex)); if (match) { forEach(params, function(name, index) { dst[name] = match[index + 1]; }); } return match ? dst : null; } function updateRoute() { var next = parseRoute(), last = $route.current; if (next && last && next.$route === last.$route && equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) { $route.current = next; copy(next.params, $routeParams); last.scope && last.scope.$emit('$routeUpdate'); } else { forceReload = false; rootScope.$broadcast('$beforeRouteChange', next, last); last && last.scope && last.scope.$destroy(); $route.current = next; if (next) { if (next.redirectTo) { if (isString(next.redirectTo)) { $location.path(interpolate(next.redirectTo, next.params)).search(next.params) .replace(); } else { $location.url(next.redirectTo(next.pathParams, $location.path(), $location.search())) .replace(); } } else { copy(next.params, $routeParams); next.scope = parentScope.$new(next.controller); } } rootScope.$broadcast('$afterRouteChange', next, last); } } /** * @returns the current active route, by matching it against the URL */ function parseRoute() { // Match a route var params, match; forEach(routes, function(route, path) { if (!match && (params = matcher($location.path(), path))) { match = inherit(route, { params: extend({}, $location.search(), params), pathParams: params}); match.$route = route; } }); // No route matched; fallback to "otherwise" route return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}}); } /** * @returns interpolation of the redirect path with the parametrs */ function interpolate(string, params) { var result = []; forEach((string||'').split(':'), function(segment, i) { if (i == 0) { result.push(segment); } else { var segmentMatch = segment.match(/(\w+)(.*)/); var key = segmentMatch[1]; result.push(params[key]); result.push(segmentMatch[2] || ''); delete params[key]; } }); return result.join(''); } }, ['$location', '$routeParams']); /** * @workInProgress * @ngdoc service * @name angular.service.$routeParams * @requires $route * * @description * Current set of route parameters. The route parameters are a combination of the * {@link angular.service.$location $location} `search()`, and `path()`. The `path` parameters * are extracted when the {@link angular.service.$route $route} path is matched. * * In case of parameter name collision, `path` params take precedence over `search` params. * * The service guarantees that the identity of the `$routeParams` object will remain unchanged * (but its properties will likely change) even when a route change occurs. * * @example * <pre> * // Given: * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby * // Route: /Chapter/:chapterId/Section/:sectionId * // * // Then * $routeParams ==> {chapterId:1, sectionId:2, search:'moby'} * </pre> */ angularService('$routeParams', function(){ return {}; }); /** * @workInProgress * @ngdoc service * @name angular.service.$sniffer * @requires $window * * @property {boolean} history Does the browser support html5 history api ? * @property {boolean} hashchange Does the browser support hashchange event ? * * @description * This is very simple implementation of testing browser's features. */ angularServiceInject('$sniffer', function($window) { if ($window.Modernizr) return $window.Modernizr; return { history: !!($window.history && $window.history.pushState), hashchange: 'onhashchange' in $window && // IE8 compatible mode lies (!$window.document.documentMode || $window.document.documentMode > 7) }; }, ['$window']); /** * @workInProgress * @ngdoc service * @name angular.service.$window * * @description * A reference to the browser's `window` object. While `window` * is globally available in JavaScript, it causes testability problems, because * it is a global variable. In angular we always refer to it through the * `$window` service, so it may be overriden, removed or mocked for testing. * * All expressions are evaluated with respect to current scope so they don't * suffer from window globality. * * @example <doc:example> <doc:source> <input ng:init="$window = $service('$window'); greeting='Hello World!'" type="text" name="greeting" /> <button ng:click="$window.alert(greeting)">ALERT</button> </doc:source> <doc:scenario> </doc:scenario> </doc:example> */ angularServiceInject("$window", bind(window, identity, window)); /** * @workInProgress * @ngdoc service * @name angular.service.$xhr.bulk * @requires $xhr * @requires $xhr.error * @requires $log * * @description * * @example */ angularServiceInject('$xhr.bulk', function($xhr, $error, $log){ var requests = [], scope = this; function bulkXHR(method, url, post, success, error) { if (isFunction(post)) { error = success; success = post; post = null; } var currentQueue; forEach(bulkXHR.urls, function(queue){ if (isFunction(queue.match) ? queue.match(url) : queue.match.exec(url)) { currentQueue = queue; } }); if (currentQueue) { if (!currentQueue.requests) currentQueue.requests = []; var request = { method: method, url: url, data: post, success: success}; if (error) request.error = error; currentQueue.requests.push(request); } else { $xhr(method, url, post, success, error); } } bulkXHR.urls = {}; bulkXHR.flush = function(success, errorback) { assertArgFn(success = success || noop, 0); assertArgFn(errorback = errorback || noop, 1); forEach(bulkXHR.urls, function(queue, url) { var currentRequests = queue.requests; if (currentRequests && currentRequests.length) { queue.requests = []; queue.callbacks = []; $xhr('POST', url, {requests: currentRequests}, function(code, response) { forEach(response, function(response, i) { try { if (response.status == 200) { (currentRequests[i].success || noop)(response.status, response.response); } else if (isFunction(currentRequests[i].error)) { currentRequests[i].error(response.status, response.response); } else { $error(currentRequests[i], response); } } catch(e) { $log.error(e); } }); success(); }, function(code, response) { forEach(currentRequests, function(request, i) { try { if (isFunction(request.error)) { request.error(code, response); } else { $error(request, response); } } catch(e) { $log.error(e); } }); noop(); }); } }); }; this.$watch(function(){ bulkXHR.flush(); }); return bulkXHR; }, ['$xhr', '$xhr.error', '$log']); /** * @workInProgress * @ngdoc service * @name angular.service.$xhr.cache * @function * * @requires $xhr.bulk * @requires $defer * @requires $xhr.error * @requires $log * * @description * Acts just like the {@link angular.service.$xhr $xhr} service but caches responses for `GET` * requests. All cache misses are delegated to the $xhr service. * * @property {function()} delegate Function to delegate all the cache misses to. Defaults to * the {@link angular.service.$xhr $xhr} service. * @property {object} data The hashmap where all cached entries are stored. * * @param {string} method HTTP method. * @param {string} url Destination URL. * @param {(string|Object)=} post Request body. * @param {function(number, (string|Object))} success Response success callback. * @param {function(number, (string|Object))=} error Response error callback. * @param {boolean=} [verifyCache=false] If `true` then a result is immediately returned from cache * (if present) while a request is sent to the server for a fresh response that will update the * cached entry. The `success` function will be called when the response is received. * @param {boolean=} [sync=false] in case of cache hit execute `success` synchronously. */ angularServiceInject('$xhr.cache', function($xhr, $defer, $error, $log) { var inflight = {}, self = this; function cache(method, url, post, success, error, verifyCache, sync) { if (isFunction(post)) { if (!isFunction(success)) { verifyCache = success; sync = error; error = null; } else { sync = verifyCache; verifyCache = error; error = success; } success = post; post = null; } else if (!isFunction(error)) { sync = verifyCache; verifyCache = error; error = null; } if (method == 'GET') { var data, dataCached; if ((dataCached = cache.data[url])) { if (sync) { success(200, copy(dataCached.value)); } else { $defer(function() { success(200, copy(dataCached.value)); }); } if (!verifyCache) return; } if ((data = inflight[url])) { data.successes.push(success); data.errors.push(error); } else { inflight[url] = {successes: [success], errors: [error]}; cache.delegate(method, url, post, function(status, response) { if (status == 200) cache.data[url] = {value: response}; var successes = inflight[url].successes; delete inflight[url]; forEach(successes, function(success) { try { (success||noop)(status, copy(response)); } catch(e) { $log.error(e); } }); }, function(status, response) { var errors = inflight[url].errors, successes = inflight[url].successes; delete inflight[url]; forEach(errors, function(error, i) { try { if (isFunction(error)) { error(status, copy(response)); } else { $error( {method: method, url: url, data: post, success: successes[i]}, {status: status, body: response}); } } catch(e) { $log.error(e); } }); }); } } else { cache.data = {}; cache.delegate(method, url, post, success, error); } } cache.data = {}; cache.delegate = $xhr; return cache; }, ['$xhr.bulk', '$defer', '$xhr.error', '$log']); /** * @workInProgress * @ngdoc service * @name angular.service.$xhr.error * @function * @requires $log * * @description * Error handler for {@link angular.service.$xhr $xhr service}. An application can replaces this * service with one specific for the application. The default implementation logs the error to * {@link angular.service.$log $log.error}. * * @param {Object} request Request object. * * The object has the following properties * * - `method` – `{string}` – The http request method. * - `url` – `{string}` – The request destination. * - `data` – `{(string|Object)=} – An optional request body. * - `success` – `{function()}` – The success callback function * * @param {Object} response Response object. * * The response object has the following properties: * * - status – {number} – Http status code. * - body – {string|Object} – Body of the response. * * @example <doc:example> <doc:source> fetch a non-existent file and log an error in the console: <button ng:click="$service('$xhr')('GET', '/DOESNT_EXIST')">fetch</button> </doc:source> </doc:example> */ angularServiceInject('$xhr.error', function($log){ return function(request, response){ $log.error('ERROR: XHR: ' + request.url, request, response); }; }, ['$log']); /** * @workInProgress * @ngdoc service * @name angular.service.$xhr * @function * @requires $browser $xhr delegates all XHR requests to the `$browser.xhr()`. A mock version * of the $browser exists which allows setting expectations on XHR requests * in your tests * @requires $xhr.error $xhr delegates all non `2xx` response code to this service. * @requires $log $xhr delegates all exceptions to `$log.error()`. * * @description * Generates an XHR request. The $xhr service delegates all requests to * {@link angular.service.$browser $browser.xhr()} and adds error handling and security features. * While $xhr service provides nicer api than raw XmlHttpRequest, it is still considered a lower * level api in angular. For a higher level abstraction that utilizes `$xhr`, please check out the * {@link angular.service.$resource $resource} service. * * # Error handling * If no `error callback` is specified, XHR response with response code other then `2xx` will be * delegated to {@link angular.service.$xhr.error $xhr.error}. The `$xhr.error` can intercept the * request and process it in application specific way, or resume normal execution by calling the * request `success` method. * * # HTTP Headers * The $xhr service will automatically add certain http headers to all requests. These defaults can * be fully configured by accessing the `$xhr.defaults.headers` configuration object, which * currently contains this default configuration: * * - `$xhr.defaults.headers.common` (headers that are common for all requests): * - `Accept: application/json, text/plain, *\/*` * - `X-Requested-With: XMLHttpRequest` * - `$xhr.defaults.headers.post` (header defaults for HTTP POST requests): * - `Content-Type: application/x-www-form-urlencoded` * * To add or overwrite these defaults, simple add or remove a property from this configuration * object. To add headers for an HTTP method other than POST, simple create a new object with name * equal to the lowercased http method name, e.g. `$xhr.defaults.headers.get['My-Header']='value'`. * * * # Security Considerations * When designing web applications your design needs to consider security threats from * {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx * JSON Vulnerability} and {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF}. * Both server and the client must cooperate in order to eliminate these threats. Angular comes * pre-configured with strategies that address these issues, but for this to work backend server * cooperation is required. * * ## JSON Vulnerability Protection * A {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx * JSON Vulnerability} allows third party web-site to turn your JSON resource URL into * {@link http://en.wikipedia.org/wiki/JSON#JSONP JSONP} request under some conditions. To * counter this your server can prefix all JSON requests with following string `")]}',\n"`. * Angular will automatically strip the prefix before processing it as JSON. * * For example if your server needs to return: * <pre> * ['one','two'] * </pre> * * which is vulnerable to attack, your server can return: * <pre> * )]}', * ['one','two'] * </pre> * * angular will strip the prefix, before processing the JSON. * * * ## Cross Site Request Forgery (XSRF) Protection * {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF} is a technique by which an * unauthorized site can gain your user's private data. Angular provides following mechanism to * counter XSRF. When performing XHR requests, the $xhr service reads a token from a cookie * called `XSRF-TOKEN` and sets it as the HTTP header `X-XSRF-TOKEN`. Since only JavaScript that * runs on your domain could read the cookie, your server can be assured that the XHR came from * JavaScript running on your domain. * * To take advantage of this, your server needs to set a token in a JavaScript readable session * cookie called `XSRF-TOKEN` on first HTTP GET request. On subsequent non-GET requests the server * can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure that only * JavaScript running on your domain could have read the token. The token must be unique for each * user and must be verifiable by the server (to prevent the JavaScript making up its own tokens). * We recommend that the token is a digest of your site's authentication cookie with * {@link http://en.wikipedia.org/wiki/Rainbow_table salt for added security}. * * @param {string} method HTTP method to use. Valid values are: `GET`, `POST`, `PUT`, `DELETE`, and * `JSON`. `JSON` is a special case which causes a * [JSONP](http://en.wikipedia.org/wiki/JSON#JSONP) cross domain request using script tag * insertion. * @param {string} url Relative or absolute URL specifying the destination of the request. For * `JSON` requests, `url` should include `JSON_CALLBACK` string to be replaced with a name of an * angular generated callback function. * @param {(string|Object)=} post Request content as either a string or an object to be stringified * as JSON before sent to the server. * @param {function(number, (string|Object))} success A function to be called when the response is * received. The success function will be called with: * * - {number} code [HTTP status code](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes) of * the response. This will currently always be 200, since all non-200 responses are routed to * {@link angular.service.$xhr.error} service (or custom error callback). * - {string|Object} response Response object as string or an Object if the response was in JSON * format. * @param {function(number, (string|Object))} error A function to be called if the response code is * not 2xx.. Accepts the same arguments as success, above. * * @example <doc:example> <doc:source jsfiddle="false"> <script> function FetchCntl($xhr) { var self = this; this.fetch = function() { self.code = null; self.response = null; $xhr(self.method, self.url, function(code, response) { self.code = code; self.response = response; }, function(code, response) { self.code = code; self.response = response || "Request failed"; }); }; this.updateModel = function(method, url) { self.method = method; self.url = url; }; } FetchCntl.$inject = ['$xhr']; </script> <div ng:controller="FetchCntl"> <select name="method"> <option>GET</option> <option>JSON</option> </select> <input type="text" name="url" value="index.html" size="80"/> <button ng:click="fetch()">fetch</button><br> <button ng:click="updateModel('GET', 'index.html')">Sample GET</button> <button ng:click="updateModel('JSON', 'http://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">Sample JSONP</button> <button ng:click="updateModel('JSON', 'http://angularjs.org/doesntexist&callback=JSON_CALLBACK')">Invalid JSONP</button> <pre>code={{code}}</pre> <pre>response={{response}}</pre> </div> </doc:source> <doc:scenario> it('should make xhr GET request', function() { element(':button:contains("Sample GET")').click(); element(':button:contains("fetch")').click(); expect(binding('code')).toBe('code=200'); expect(binding('response')).toMatch(/angularjs.org/); }); it('should make JSONP request to the angularjs.org', function() { element(':button:contains("Sample JSONP")').click(); element(':button:contains("fetch")').click(); expect(binding('code')).toBe('code=200'); expect(binding('response')).toMatch(/Super Hero!/); }); it('should make JSONP request to invalid URL and invoke the error handler', function() { element(':button:contains("Invalid JSONP")').click(); element(':button:contains("fetch")').click(); expect(binding('code')).toBe('code='); expect(binding('response')).toBe('response=Request failed'); }); </doc:scenario> </doc:example> */ angularServiceInject('$xhr', function($browser, $error, $log){ var rootScope = this; var xhrHeaderDefaults = { common: { "Accept": "application/json, text/plain, */*", "X-Requested-With": "XMLHttpRequest" }, post: {'Content-Type': 'application/x-www-form-urlencoded'}, get: {}, // all these empty properties are needed so that client apps can just do: head: {}, // $xhr.defaults.headers.head.foo="bar" without having to create head object put: {}, // it also means that if we add a header for these methods in the future, it 'delete': {}, // won't be easily silently lost due to an object assignment. patch: {} }; function xhr(method, url, post, success, error) { if (isFunction(post)) { error = success; success = post; post = null; } if (post && isObject(post)) { post = toJson(post); } $browser.xhr(method, url, post, function(code, response){ try { if (isString(response)) { if (response.match(/^\)\]\}',\n/)) response=response.substr(6); if (/^\s*[\[\{]/.exec(response) && /[\}\]]\s*$/.exec(response)) { response = fromJson(response, true); } } rootScope.$apply(function(){ if (200 <= code && code < 300) { success(code, response); } else if (isFunction(error)) { error(code, response); } else { $error( {method: method, url: url, data: post, success: success}, {status: code, body: response}); } }); } catch (e) { $log.error(e); } }, extend({'X-XSRF-TOKEN': $browser.cookies()['XSRF-TOKEN']}, xhrHeaderDefaults.common, xhrHeaderDefaults[lowercase(method)])); } xhr.defaults = {headers: xhrHeaderDefaults}; return xhr; }, ['$browser', '$xhr.error', '$log']); /** * @ngdoc service * @name angular.service.$locale * * @description * $locale service provides localization rules for various Angular components. As of right now the * only public api is: * * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`) */ angularServiceInject('$locale', function() { return { id: 'en-us', NUMBER_FORMATS: { DECIMAL_SEP: '.', GROUP_SEP: ',', PATTERNS: [ { // Decimal Pattern minInt: 1, minFrac: 0, maxFrac: 3, posPre: '', posSuf: '', negPre: '-', negSuf: '', gSize: 3, lgSize: 3 },{ //Currency Pattern minInt: 1, minFrac: 2, maxFrac: 2, posPre: '\u00A4', posSuf: '', negPre: '(\u00A4', negSuf: ')', gSize: 3, lgSize: 3 } ], CURRENCY_SYM: '$' }, DATETIME_FORMATS: { MONTH: 'January,February,March,April,May,June,July,August,September,October,November,December' .split(','), SHORTMONTH: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','), DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','), SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','), AMPMS: ['AM','PM'], medium: 'MMM d, y h:mm:ss a', short: 'M/d/yy h:mm a', fullDate: 'EEEE, MMMM d, y', longDate: 'MMMM d, y', mediumDate: 'MMM d, y', shortDate: 'M/d/yy', mediumTime: 'h:mm:ss a', shortTime: 'h:mm a' }, pluralCat: function(num) { if (num === 1) { return 'one'; } return 'other'; } }; }); /** * @ngdoc overview * @name angular.directive * @description * * Angular directives create custom attributes for DOM elements. A directive can modify the * behavior of the element in which it is specified. Do not use directives to add elements to the * DOM; instead, use {@link angular.widget widgets} to add DOM elements. * * Following is the list of built-in Angular directives: * * * {@link angular.directive.ng:autobind ng:autobind} - An Angular bootstrap parameter that can * act as a directive. * * {@link angular.directive.ng:bind ng:bind} - Creates a data-binding between an HTML text value * and a data model. * * {@link angular.directive.ng:bind-attr ng:bind-attr} - Creates a data-binding in a way similar * to `ng:bind`, but uses JSON key / value pairs to do so. * * {@link angular.directive.ng:bind-template ng:bind-template} - Replaces the text value of an * element with a specified template. * * {@link angular.directive.ng:change ng:change} - Executes an expression when the value of an * input widget changes. * * {@link angular.directive.ng:class ng:class} - Conditionally set a CSS class on an element. * * {@link angular.directive.ng:class-even ng:class-even} - Like `ng:class`, but works in * conjunction with {@link angular.widget.@ng:repeat} to affect even rows in a collection. * * {@link angular.directive.ng:class-odd ng:class-odd} - Like `ng:class`, but works with {@link * angular.widget.@ng:repeat} to affect odd rows. * * {@link angular.directive.ng:click ng:click} - Executes custom behavior when an element is * clicked. * * {@link angular.directive.ng:controller ng:controller} - Creates a scope object linked to the * DOM element and assigns behavior to the scope. * * {@link angular.directive.ng:hide ng:hide} - Conditionally hides a portion of HTML. * * {@link angular.directive.ng:href ng:href} - Places an href in the Angular namespace. * * {@link angular.directive.ng:init} - Initialization tasks run before a template is executed. * * {@link angular.directive.ng:show ng:show} - Conditionally displays a portion of HTML. * * {@link angular.directive.ng:src ng:src} - Places a `src` attribute into the Angular namespace. * * {@link angular.directive.ng:style ng:style} - Conditionally set CSS styles on an element. * * {@link angular.directive.ng:submit} - Binds Angular expressions to `onSubmit` events. * * For more information about how Angular directives work, and to learn how to create your own * directives, see {@link guide/dev_guide.compiler.directives Understanding Angular Directives} in * the Angular Developer Guide. */ /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:init * * @description * The `ng:init` attribute specifies initialization tasks to be executed * before the template enters execution mode during bootstrap. * * @element ANY * @param {expression} expression {@link guide/dev_guide.expressions Expression} to eval. * * @example <doc:example> <doc:source> <div ng:init="greeting='Hello'; person='World'"> {{greeting}} {{person}}! </div> </doc:source> <doc:scenario> it('should check greeting', function(){ expect(binding('greeting')).toBe('Hello'); expect(binding('person')).toBe('World'); }); </doc:scenario> </doc:example> */ angularDirective("ng:init", function(expression){ return function(element){ this.$eval(expression); }; }); /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:controller * * @description * The `ng:controller` directive assigns behavior to a scope. This is a key aspect of how angular * supports the principles behind the Model-View-Controller design pattern. * * MVC components in angular: * * * Model — The Model is data in scope properties; scopes are attached to the DOM. * * View — The template (HTML with data bindings) is rendered into the View. * * Controller — The `ng:controller` directive specifies a Controller class; the class has * methods that typically express the business logic behind the application. * * Note that an alternative way to define controllers is via the `{@link angular.service.$route}` * service. * * @element ANY * @param {expression} expression Name of a globally accessible constructor function or an * {@link guide/dev_guide.expressions expression} that on the current scope evaluates to a * constructor function. * * @example * Here is a simple form for editing user contact information. Adding, removing, clearing, and * greeting are methods declared on the controller (see source tab). These methods can * easily be called from the angular markup. Notice that the scope becomes the `this` for the * controller's instance. This allows for easy access to the view data from the controller. Also * notice that any changes to the data are automatically reflected in the View without the need * for a manual update. <doc:example> <doc:source> <script type="text/javascript"> function SettingsController() { this.name = "John Smith"; this.contacts = [ {type:'phone', value:'408 555 1212'}, {type:'email', value:'john.smith@example.org'} ]; } SettingsController.prototype = { greet: function(){ alert(this.name); }, addContact: function(){ this.contacts.push({type:'email', value:'yourname@example.org'}); }, removeContact: function(contactToRemove) { angular.Array.remove(this.contacts, contactToRemove); }, clearContact: function(contact) { contact.type = 'phone'; contact.value = ''; } }; </script> <div ng:controller="SettingsController"> Name: <input type="text" name="name"/> [ <a href="" ng:click="greet()">greet</a> ]<br/> Contact: <ul> <li ng:repeat="contact in contacts"> <select name="contact.type"> <option>phone</option> <option>email</option> </select> <input type="text" name="contact.value"/> [ <a href="" ng:click="clearContact(contact)">clear</a> | <a href="" ng:click="removeContact(contact)">X</a> ] </li> <li>[ <a href="" ng:click="addContact()">add</a> ]</li> </ul> </div> </doc:source> <doc:scenario> it('should check controller', function(){ expect(element('.doc-example-live div>:input').val()).toBe('John Smith'); expect(element('.doc-example-live li[ng\\:repeat-index="0"] input').val()) .toBe('408 555 1212'); expect(element('.doc-example-live li[ng\\:repeat-index="1"] input').val()) .toBe('john.smith@example.org'); element('.doc-example-live li:first a:contains("clear")').click(); expect(element('.doc-example-live li:first input').val()).toBe(''); element('.doc-example-live li:last a:contains("add")').click(); expect(element('.doc-example-live li[ng\\:repeat-index="2"] input').val()) .toBe('yourname@example.org'); }); </doc:scenario> </doc:example> */ angularDirective("ng:controller", function(expression){ this.scope(function(scope){ var Controller = getter(scope, expression, true) || getter(window, expression, true); assertArgFn(Controller, expression); return Controller; }); return noop; }); /** * @ngdoc directive * @name angular.directive.ng:bind * * @description * The `ng:bind` attribute tells Angular to replace the text content of the specified HTML element * with the value of a given expression, and to update the text content when the value of that * expression changes. * * Typically, you don't use `ng:bind` directly, but instead you use the double curly markup like * `{{ expression }}` and let the Angular compiler transform it to * `<span ng:bind="expression"></span>` when the template is compiled. * * @element ANY * @param {expression} expression {@link guide/dev_guide.expressions Expression} to evaluate. * * @example * Enter a name in the Live Preview text box; the greeting below the text box changes instantly. <doc:example> <doc:source> Enter name: <input type="text" name="name" value="Whirled"> <br> Hello <span ng:bind="name"></span>! </doc:source> <doc:scenario> it('should check ng:bind', function(){ expect(using('.doc-example-live').binding('name')).toBe('Whirled'); using('.doc-example-live').input('name').enter('world'); expect(using('.doc-example-live').binding('name')).toBe('world'); }); </doc:scenario> </doc:example> */ angularDirective("ng:bind", function(expression, element){ element.addClass('ng-binding'); var exprFn = parser(expression).statements(); return function(element) { var lastValue = noop, lastError = noop; this.$watch(function(scope) { // TODO(misko): remove error handling https://github.com/angular/angular.js/issues/347 var error, value, html, isHtml, isDomElement, hadOwnElement = scope.hasOwnProperty('$element'), oldElement = scope.$element; // TODO(misko): get rid of $element https://github.com/angular/angular.js/issues/348 scope.$element = element; try { value = exprFn(scope); } catch (e) { scope.$service('$exceptionHandler')(e); error = formatError(e); } finally { if (hadOwnElement) { scope.$element = oldElement; } else { delete scope.$element; } } // If we are HTML, then save the raw HTML data so that we don't // recompute sanitization since that is expensive. // TODO: turn this into a more generic way to compute this if ((isHtml = (value instanceof HTML))) value = (html = value).html; if (lastValue === value && lastError == error) return; isDomElement = isElement(value); if (!isHtml && !isDomElement && isObject(value)) { value = toJson(value, true); } if (value != lastValue || error != lastError) { lastValue = value; lastError = error; elementError(element, NG_EXCEPTION, error); if (error) value = error; if (isHtml) { element.html(html.get()); } else if (isDomElement) { element.html(''); element.append(value); } else { element.text(value == undefined ? '' : value); } } }); }; }); var bindTemplateCache = {}; function compileBindTemplate(template){ var fn = bindTemplateCache[template]; if (!fn) { var bindings = []; forEach(parseBindings(template), function(text){ var exp = binding(text); bindings.push(exp ? function(scope, element) { var error, value; try { value = scope.$eval(exp); } catch(e) { scope.$service('$exceptionHandler')(e); error = toJson(e); } elementError(element, NG_EXCEPTION, error); return error ? error : value; } : function() { return text; }); }); bindTemplateCache[template] = fn = function(scope, element, prettyPrintJson) { var parts = [], hadOwnElement = scope.hasOwnProperty('$element'), oldElement = scope.$element; // TODO(misko): get rid of $element scope.$element = element; try { for (var i = 0; i < bindings.length; i++) { var value = bindings[i](scope, element); if (isElement(value)) value = ''; else if (isObject(value)) value = toJson(value, prettyPrintJson); parts.push(value); } return parts.join(''); } finally { if (hadOwnElement) { scope.$element = oldElement; } else { delete scope.$element; } } }; } return fn; } /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:bind-template * * @description * The `ng:bind-template` attribute specifies that the element * text should be replaced with the template in ng:bind-template. * Unlike ng:bind the ng:bind-template can contain multiple `{{` `}}` * expressions. (This is required since some HTML elements * can not have SPAN elements such as TITLE, or OPTION to name a few.) * * @element ANY * @param {string} template of form * <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval. * * @example * Try it here: enter text in text box and watch the greeting change. <doc:example> <doc:source> Salutation: <input type="text" name="salutation" value="Hello"><br/> Name: <input type="text" name="name" value="World"><br/> <pre ng:bind-template="{{salutation}} {{name}}!"></pre> </doc:source> <doc:scenario> it('should check ng:bind', function(){ expect(using('.doc-example-live').binding('{{salutation}} {{name}}')). toBe('Hello World!'); using('.doc-example-live').input('salutation').enter('Greetings'); using('.doc-example-live').input('name').enter('user'); expect(using('.doc-example-live').binding('{{salutation}} {{name}}')). toBe('Greetings user!'); }); </doc:scenario> </doc:example> */ angularDirective("ng:bind-template", function(expression, element){ element.addClass('ng-binding'); var templateFn = compileBindTemplate(expression); return function(element) { var lastValue; this.$watch(function(scope) { var value = templateFn(scope, element, true); if (value != lastValue) { element.text(value); lastValue = value; } }); }; }); var REMOVE_ATTRIBUTES = { 'disabled':'disabled', 'readonly':'readOnly', 'checked':'checked', 'selected':'selected', 'multiple':'multiple' }; /** * @ngdoc directive * @name angular.directive.ng:bind-attr * * @description * The `ng:bind-attr` attribute specifies that a * {@link guide/dev_guide.templates.databinding databinding} should be created between a particular * element attribute and a given expression. Unlike `ng:bind`, the `ng:bind-attr` contains one or * more JSON key value pairs; each pair specifies an attribute and the * {@link guide/dev_guide.expressions expression} to which it will be mapped. * * Instead of writing `ng:bind-attr` statements in your HTML, you can use double-curly markup to * specify an <tt ng:non-bindable>{{expression}}</tt> for the value of an attribute. * At compile time, the attribute is translated into an `<span ng:bind-attr="{attr:expression}"/>` * * The following HTML snippet shows how to specify `ng:bind-attr`: * <pre> * <a href="http://www.google.com/search?q={{query}}">Google</a> * </pre> * * During compilation, the snippet gets translated to the following: * <pre> * <a ng:bind-attr='{"href":"http://www.google.com/search?q={{query}}"}'>Google</a> * </pre> * * @element ANY * @param {string} attribute_json one or more JSON key-value pairs representing * the attributes to replace with expressions. Each key matches an attribute * which needs to be replaced. Each value is a text template of * the attribute with the embedded * <tt ng:non-bindable>{{expression}}</tt>s. Any number of * key-value pairs can be specified. * * @example * Enter a search string in the Live Preview text box and then click "Google". The search executes instantly. <doc:example> <doc:source> Google for: <input type="text" name="query" value="AngularJS"/> <a href="http://www.google.com/search?q={{query}}">Google</a> </doc:source> <doc:scenario> it('should check ng:bind-attr', function(){ expect(using('.doc-example-live').element('a').attr('href')). toBe('http://www.google.com/search?q=AngularJS'); using('.doc-example-live').input('query').enter('google'); expect(using('.doc-example-live').element('a').attr('href')). toBe('http://www.google.com/search?q=google'); }); </doc:scenario> </doc:example> */ angularDirective("ng:bind-attr", function(expression){ return function(element){ var lastValue = {}; this.$watch(function(scope){ var values = scope.$eval(expression); for(var key in values) { var value = compileBindTemplate(values[key])(scope, element), specialName = REMOVE_ATTRIBUTES[lowercase(key)]; if (lastValue[key] !== value) { lastValue[key] = value; if (specialName) { if (toBoolean(value)) { element.attr(specialName, specialName); element.attr('ng-' + specialName, value); } else { element.removeAttr(specialName); element.removeAttr('ng-' + specialName); } (element.data($$validate)||noop)(); } else { element.attr(key, value); } } } }); }; }); /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:click * * @description * The ng:click allows you to specify custom behavior when * element is clicked. * * @element ANY * @param {expression} expression {@link guide/dev_guide.expressions Expression} to evaluate upon * click. * * @example <doc:example> <doc:source> <button ng:click="count = count + 1" ng:init="count=0"> Increment </button> count: {{count}} </doc:source> <doc:scenario> it('should check ng:click', function(){ expect(binding('count')).toBe('0'); element('.doc-example-live :button').click(); expect(binding('count')).toBe('1'); }); </doc:scenario> </doc:example> */ /* * A directive that allows creation of custom onclick handlers that are defined as angular * expressions and are compiled and executed within the current scope. * * Events that are handled via these handler are always configured not to propagate further. * * TODO: maybe we should consider allowing users to control event propagation in the future. */ angularDirective("ng:click", function(expression, element){ return function(element){ var self = this; element.bind('click', function(event){ self.$apply(expression); event.stopPropagation(); }); }; }); /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:submit * * @description * Enables binding angular expressions to onsubmit events. * * Additionally it prevents the default action (which for form means sending the request to the * server and reloading the current page). * * @element form * @param {expression} expression {@link guide/dev_guide.expressions Expression} to eval. * * @example <doc:example> <doc:source> <form ng:submit="list.push(text);text='';" ng:init="list=[]"> Enter text and hit enter: <input type="text" name="text" value="hello"/> <input type="submit" id="submit" value="Submit" /> </form> <pre>list={{list}}</pre> </doc:source> <doc:scenario> it('should check ng:submit', function(){ expect(binding('list')).toBe('list=[]'); element('.doc-example-live #submit').click(); expect(binding('list')).toBe('list=["hello"]'); }); </doc:scenario> </doc:example> */ angularDirective("ng:submit", function(expression, element) { return function(element) { var self = this; element.bind('submit', function(event) { self.$apply(expression); event.preventDefault(); }); }; }); function ngClass(selector) { return function(expression, element) { return function(element) { this.$watch(expression, function(scope, newVal, oldVal) { if (selector(scope.$index)) { element.removeClass(isArray(oldVal) ? oldVal.join(' ') : oldVal) element.addClass(isArray(newVal) ? newVal.join(' ') : newVal); } }); }; }; } /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:class * * @description * The `ng:class` allows you to set CSS class on HTML element dynamically by databinding an * expression that represents all classes to be added. * * The directive won't add duplicate classes if a particular class was already set. * * When the expression changes, the previously added classes are removed and only then the classes * new classes are added. * * @element ANY * @param {expression} expression {@link guide/dev_guide.expressions Expression} to eval. The result * of the evaluation can be a string representing space delimited class names or an array. * * @example <doc:example> <doc:source> <input type="button" value="set" ng:click="myVar='ng-input-indicator-wait'"> <input type="button" value="clear" ng:click="myVar=''"> <br> <span ng:class="myVar">Sample Text &nbsp;&nbsp;&nbsp;&nbsp;</span> </doc:source> <doc:scenario> it('should check ng:class', function(){ expect(element('.doc-example-live span').attr('className')).not(). toMatch(/ng-input-indicator-wait/); using('.doc-example-live').element(':button:first').click(); expect(element('.doc-example-live span').attr('className')). toMatch(/ng-input-indicator-wait/); using('.doc-example-live').element(':button:last').click(); expect(element('.doc-example-live span').attr('className')).not(). toMatch(/ng-input-indicator-wait/); }); </doc:scenario> </doc:example> */ angularDirective("ng:class", ngClass(function(){return true;})); /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:class-odd * * @description * The `ng:class-odd` and `ng:class-even` works exactly as * {@link angular.directive.ng:class ng:class}, except it works in conjunction with `ng:repeat` and * takes affect only on odd (even) rows. * * This directive can be applied only within a scope of an * {@link angular.widget.@ng:repeat ng:repeat}. * * @element ANY * @param {expression} expression {@link guide/dev_guide.expressions Expression} to eval. The result * of the evaluation can be a string representing space delimited class names or an array. * * @example <doc:example> <doc:source> <ol ng:init="names=['John', 'Mary', 'Cate', 'Suz']"> <li ng:repeat="name in names"> <span ng:class-odd="'ng-format-negative'" ng:class-even="'ng-input-indicator-wait'"> {{name}} &nbsp; &nbsp; &nbsp; </span> </li> </ol> </doc:source> <doc:scenario> it('should check ng:class-odd and ng:class-even', function(){ expect(element('.doc-example-live li:first span').attr('className')). toMatch(/ng-format-negative/); expect(element('.doc-example-live li:last span').attr('className')). toMatch(/ng-input-indicator-wait/); }); </doc:scenario> </doc:example> */ angularDirective("ng:class-odd", ngClass(function(i){return i % 2 === 0;})); /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:class-even * * @description * The `ng:class-odd` and `ng:class-even` works exactly as * {@link angular.directive.ng:class ng:class}, except it works in conjunction with `ng:repeat` and * takes affect only on odd (even) rows. * * This directive can be applied only within a scope of an * {@link angular.widget.@ng:repeat ng:repeat}. * * @element ANY * @param {expression} expression {@link guide/dev_guide.expressions Expression} to eval. The result * of the evaluation can be a string representing space delimited class names or an array. * * @example <doc:example> <doc:source> <ol ng:init="names=['John', 'Mary', 'Cate', 'Suz']"> <li ng:repeat="name in names"> <span ng:class-odd="'ng-format-negative'" ng:class-even="'ng-input-indicator-wait'"> {{name}} &nbsp; &nbsp; &nbsp; </span> </li> </ol> </doc:source> <doc:scenario> it('should check ng:class-odd and ng:class-even', function(){ expect(element('.doc-example-live li:first span').attr('className')). toMatch(/ng-format-negative/); expect(element('.doc-example-live li:last span').attr('className')). toMatch(/ng-input-indicator-wait/); }); </doc:scenario> </doc:example> */ angularDirective("ng:class-even", ngClass(function(i){return i % 2 === 1;})); /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:show * * @description * The `ng:show` and `ng:hide` directives show or hide a portion of the DOM tree (HTML) * conditionally. * * @element ANY * @param {expression} expression If the {@link guide/dev_guide.expressions expression} is truthy * then the element is shown or hidden respectively. * * @example <doc:example> <doc:source> Click me: <input type="checkbox" name="checked"><br/> Show: <span ng:show="checked">I show up when your checkbox is checked.</span> <br/> Hide: <span ng:hide="checked">I hide when your checkbox is checked.</span> </doc:source> <doc:scenario> it('should check ng:show / ng:hide', function(){ expect(element('.doc-example-live span:first:hidden').count()).toEqual(1); expect(element('.doc-example-live span:last:visible').count()).toEqual(1); input('checked').check(); expect(element('.doc-example-live span:first:visible').count()).toEqual(1); expect(element('.doc-example-live span:last:hidden').count()).toEqual(1); }); </doc:scenario> </doc:example> */ angularDirective("ng:show", function(expression, element){ return function(element){ this.$watch(expression, function(scope, value){ element.css('display', toBoolean(value) ? '' : 'none'); }); }; }); /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:hide * * @description * The `ng:hide` and `ng:show` directives hide or show a portion * of the HTML conditionally. * * @element ANY * @param {expression} expression If the {@link guide/dev_guide.expressions expression} truthy then * the element is shown or hidden respectively. * * @example <doc:example> <doc:source> Click me: <input type="checkbox" name="checked"><br/> Show: <span ng:show="checked">I show up when you checkbox is checked?</span> <br/> Hide: <span ng:hide="checked">I hide when you checkbox is checked?</span> </doc:source> <doc:scenario> it('should check ng:show / ng:hide', function(){ expect(element('.doc-example-live span:first:hidden').count()).toEqual(1); expect(element('.doc-example-live span:last:visible').count()).toEqual(1); input('checked').check(); expect(element('.doc-example-live span:first:visible').count()).toEqual(1); expect(element('.doc-example-live span:last:hidden').count()).toEqual(1); }); </doc:scenario> </doc:example> */ angularDirective("ng:hide", function(expression, element){ return function(element){ this.$watch(expression, function(scope, value){ element.css('display', toBoolean(value) ? 'none' : ''); }); }; }); /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:style * * @description * The ng:style allows you to set CSS style on an HTML element conditionally. * * @element ANY * @param {expression} expression {@link guide/dev_guide.expressions Expression} which evals to an * object whose keys are CSS style names and values are corresponding values for those CSS * keys. * * @example <doc:example> <doc:source> <input type="button" value="set" ng:click="myStyle={color:'red'}"> <input type="button" value="clear" ng:click="myStyle={}"> <br/> <span ng:style="myStyle">Sample Text</span> <pre>myStyle={{myStyle}}</pre> </doc:source> <doc:scenario> it('should check ng:style', function(){ expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)'); element('.doc-example-live :button[value=set]').click(); expect(element('.doc-example-live span').css('color')).toBe('red'); element('.doc-example-live :button[value=clear]').click(); expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)'); }); </doc:scenario> </doc:example> */ angularDirective("ng:style", function(expression, element){ return function(element){ var resetStyle = getStyle(element); this.$watch(function(scope){ var style = scope.$eval(expression) || {}, key, mergedStyle = {}; for(key in style) { if (resetStyle[key] === undefined) resetStyle[key] = ''; mergedStyle[key] = style[key]; } for(key in resetStyle) { mergedStyle[key] = mergedStyle[key] || resetStyle[key]; } element.css(mergedStyle); }); }; }); /** * @ngdoc directive * @name angular.directive.ng:cloak * * @description * The `ng:cloak` directive is used to prevent the Angular html template from being briefly * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this * directive to avoid the undesirable flicker effect caused by the html template display. * * The directive can be applied to the `<body>` element, but typically a fine-grained application is * prefered in order to benefit from progressive rendering of the browser view. * * `ng:cloak` works in cooperation with a css rule that is embedded within `angular.js` and * `angular.min.js` files. Following is the css rule: * * <pre> * [ng\:cloak], .ng-cloak { * display: none; * } * </pre> * * When this css rule is loaded by the browser, all html elements (including their children) that * are tagged with the `ng:cloak` directive are hidden. When Angular comes across this directive * during the compilation of the template it deletes the `ng:cloak` element attribute, which * makes the compiled element visible. * * For the best result, `angular.js` script must be loaded in the head section of the html file; * alternatively, the css rule (above) must be included in the external stylesheet of the * application. * * Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they * cannot match the `[ng\:cloak]` selector. To work around this limitation, you must add the css * class `ng-cloak` in addition to `ng:cloak` directive as shown in the example below. * * @element ANY * * @example <doc:example> <doc:source> <div id="template1" ng:cloak>{{ 'hello' }}</div> <div id="template2" ng:cloak class="ng-cloak">{{ 'hello IE7' }}</div> </doc:source> <doc:scenario> it('should remove the template directive and css class', function() { expect(element('.doc-example-live #template1').attr('ng:cloak')). not().toBeDefined(); expect(element('.doc-example-live #template2').attr('ng:cloak')). not().toBeDefined(); }); </doc:scenario> </doc:example> * */ angularDirective("ng:cloak", function(expression, element) { element.removeAttr('ng:cloak'); element.removeClass('ng-cloak'); }); /** * @ngdoc overview * @name angular.markup * @description * * Angular markup transforms the content of DOM elements or portions of the content into other * text or DOM elements for further compilation. * * Markup extensions do not themselves produce linking functions. Think of markup as a way to * produce shorthand for a {@link angular.widget widget} or a {@link angular.directive directive}. * * The most prominent example of a markup in Angular is the built-in, double curly markup * `{{expression}}`, which is shorthand for `<span ng:bind="expression"></span>`. * * Create custom markup like this: * * <pre> * angular.markup('newMarkup', function(text, textNode, parentElement){ * //tranformation code * }); * </pre> * * For more information, see {@link guide/dev_guide.compiler.markup Understanding Angular Markup} * in the Angular Developer Guide. */ /** * @ngdoc overview * @name angular.attrMarkup * @description * * Attribute markup allows you to modify the state of an attribute's text. * * Attribute markup extends the Angular complier in a way similar to {@link angular.markup}, * which allows you to modify the content of a node. * * The most prominent example of an attribute markup in Angular is the built-in double curly markup * which is a shorthand for {@link angular.directive.ng:bind-attr ng:bind-attr}. * * ## Example * * <pre> * angular.attrMarkup('newAttrMarkup', function(attrValue, attrName, element){ * //tranformation code * }); * </pre> * * For more information about Angular attribute markup, see {@link guide/dev_guide.compiler.markup * Understanding Angular Markup} in the Angular Developer Guide. */ function parseBindings(string) { var results = []; var lastIndex = 0; var index; while((index = string.indexOf('{{', lastIndex)) > -1) { if (lastIndex < index) results.push(string.substr(lastIndex, index - lastIndex)); lastIndex = index; index = string.indexOf('}}', index); index = index < 0 ? string.length : index + 2; results.push(string.substr(lastIndex, index - lastIndex)); lastIndex = index; } if (lastIndex != string.length) results.push(string.substr(lastIndex, string.length - lastIndex)); return results.length === 0 ? [ string ] : results; } function binding(string) { var binding = string.replace(/\n/gm, ' ').match(/^\{\{(.*)\}\}$/); return binding ? binding[1] : null; } function hasBindings(bindings) { return bindings.length > 1 || binding(bindings[0]) !== null; } angularTextMarkup('{{}}', function(text, textNode, parentElement) { var bindings = parseBindings(text), self = this; if (hasBindings(bindings)) { if (isLeafNode(parentElement[0])) { parentElement.attr('ng:bind-template', text); } else { var cursor = textNode, newElement; forEach(parseBindings(text), function(text){ var exp = binding(text); if (exp) { newElement = jqLite('<span>'); newElement.attr('ng:bind', exp); } else { newElement = jqLite(document.createTextNode(text)); } if (msie && text.charAt(0) == ' ') { newElement = jqLite('<span>&nbsp;</span>'); var nbsp = newElement.html(); newElement.text(text.substr(1)); newElement.html(nbsp + newElement.html()); } cursor.after(newElement); cursor = newElement; }); textNode.remove(); } } }); /** * This tries to normalize the behavior of value attribute across browsers. If value attribute is * not specified, then specify it to be that of the text. */ angularTextMarkup('option', function(text, textNode, parentElement){ if (lowercase(nodeName_(parentElement)) == 'option') { if (msie <= 7) { // In IE7 The issue is that there is no way to see if the value was specified hence // we have to resort to parsing HTML; htmlParser(parentElement[0].outerHTML, { start: function(tag, attrs) { if (isUndefined(attrs.value)) { parentElement.attr('value', text); } } }); } else if (parentElement[0].getAttribute('value') == null) { // jQuery does normalization on 'value' so we have to bypass it. parentElement.attr('value', text); } } }); /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:href * * @description * Using <angular/> markup like {{hash}} in an href attribute makes * the page open to a wrong URL, if the user clicks that link before * angular has a chance to replace the {{hash}} with actual URL, the * link will be broken and will most likely return a 404 error. * The `ng:href` solves this problem by placing the `href` in the * `ng:` namespace. * * The buggy way to write it: * <pre> * <a href="http://www.gravatar.com/avatar/{{hash}}"/> * </pre> * * The correct way to write it: * <pre> * <a ng:href="http://www.gravatar.com/avatar/{{hash}}"/> * </pre> * * @element ANY * @param {template} template any string which can contain `{{}}` markup. * * @example * This example uses `link` variable inside `href` attribute: <doc:example> <doc:source> <input name="value" /><br /> <a id="link-1" href ng:click="value = 1">link 1</a> (link, don't reload)<br /> <a id="link-2" href="" ng:click="value = 2">link 2</a> (link, don't reload)<br /> <a id="link-3" ng:href="#!/{{'123'}}" ng:click="value = 3">link 3</a> (link, reload!)<br /> <a id="link-4" href="" name="xx" ng:click="value = 4">anchor</a> (link, don't reload)<br /> <a id="link-5" name="xxx" ng:click="value = 5">anchor</a> (no link)<br /> <a id="link-6" ng:href="#!/{{value}}">link</a> (link, change hash) </doc:source> <doc:scenario> it('should execute ng:click but not reload when href without value', function() { element('#link-1').click(); expect(input('value').val()).toEqual('1'); expect(element('#link-1').attr('href')).toBe(""); }); it('should execute ng:click but not reload when href empty string', function() { element('#link-2').click(); expect(input('value').val()).toEqual('2'); expect(element('#link-2').attr('href')).toBe(""); }); it('should execute ng:click and change url when ng:href specified', function() { element('#link-3').click(); expect(input('value').val()).toEqual('3'); expect(element('#link-3').attr('href')).toBe("#!/123"); expect(browser().location().hash()).toEqual('!/123'); }); it('should execute ng:click but not reload when href empty string and name specified', function() { element('#link-4').click(); expect(input('value').val()).toEqual('4'); expect(element('#link-4').attr('href')).toBe(""); }); it('should execute ng:click but not reload when no href but name specified', function() { element('#link-5').click(); expect(input('value').val()).toEqual('5'); expect(element('#link-5').attr('href')).toBe(undefined); }); it('should only change url when only ng:href', function() { input('value').enter('6'); element('#link-6').click(); expect(browser().location().hash()).toEqual('!/6'); expect(element('#link-6').attr('href')).toBe("#!/6"); }); </doc:scenario> </doc:example> */ /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:src * * @description * Using <angular/> markup like `{{hash}}` in a `src` attribute doesn't * work right: The browser will fetch from the URL with the literal * text `{{hash}}` until <angular/> replaces the expression inside * `{{hash}}`. The `ng:src` attribute solves this problem by placing * the `src` attribute in the `ng:` namespace. * * The buggy way to write it: * <pre> * <img src="http://www.gravatar.com/avatar/{{hash}}"/> * </pre> * * The correct way to write it: * <pre> * <img ng:src="http://www.gravatar.com/avatar/{{hash}}"/> * </pre> * * @element ANY * @param {template} template any string which can contain `{{}}` markup. */ /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:disabled * * @description * * The following markup will make the button enabled on Chrome/Firefox but not on IE8 and older IEs: * <pre> * <div ng:init="scope = { isDisabled: false }"> * <button disabled="{{scope.isDisabled}}">Disabled</button> * </div> * </pre> * * The HTML specs do not require browsers to preserve the special attributes such as disabled. * (The presence of them means true and absence means false) * This prevents the angular compiler from correctly retrieving the binding expression. * To solve this problem, we introduce ng:disabled. * * @example <doc:example> <doc:source> Click me to toggle: <input type="checkbox" name="checked"><br/> <button name="button" ng:disabled="{{checked}}">Button</button> </doc:source> <doc:scenario> it('should toggle button', function() { expect(element('.doc-example-live :button').attr('disabled')).toBeFalsy(); input('checked').check(); expect(element('.doc-example-live :button').attr('disabled')).toBeTruthy(); }); </doc:scenario> </doc:example> * * @element ANY * @param {template} template any string which can contain '{{}}' markup. */ /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:checked * * @description * The HTML specs do not require browsers to preserve the special attributes such as checked. * (The presence of them means true and absence means false) * This prevents the angular compiler from correctly retrieving the binding expression. * To solve this problem, we introduce ng:checked. * @example <doc:example> <doc:source> Check me to check both: <input type="checkbox" name="master"><br/> <input id="checkSlave" type="checkbox" ng:checked="{{master}}"> </doc:source> <doc:scenario> it('should check both checkBoxes', function() { expect(element('.doc-example-live #checkSlave').attr('checked')).toBeFalsy(); input('master').check(); expect(element('.doc-example-live #checkSlave').attr('checked')).toBeTruthy(); }); </doc:scenario> </doc:example> * * @element ANY * @param {template} template any string which can contain '{{}}' markup. */ /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:multiple * * @description * The HTML specs do not require browsers to preserve the special attributes such as multiple. * (The presence of them means true and absence means false) * This prevents the angular compiler from correctly retrieving the binding expression. * To solve this problem, we introduce ng:multiple. * * @example <doc:example> <doc:source> Check me check multiple: <input type="checkbox" name="checked"><br/> <select id="select" ng:multiple="{{checked}}"> <option>Misko</option> <option>Igor</option> <option>Vojta</option> <option>Di</option> </select> </doc:source> <doc:scenario> it('should toggle multiple', function() { expect(element('.doc-example-live #select').attr('multiple')).toBeFalsy(); input('checked').check(); expect(element('.doc-example-live #select').attr('multiple')).toBeTruthy(); }); </doc:scenario> </doc:example> * * @element ANY * @param {template} template any string which can contain '{{}}' markup. */ /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:readonly * * @description * The HTML specs do not require browsers to preserve the special attributes such as readonly. * (The presence of them means true and absence means false) * This prevents the angular compiler from correctly retrieving the binding expression. * To solve this problem, we introduce ng:readonly. * @example <doc:example> <doc:source> Check me to make text readonly: <input type="checkbox" name="checked"><br/> <input type="text" ng:readonly="{{checked}}" value="I'm Angular"/> </doc:source> <doc:scenario> it('should toggle readonly attr', function() { expect(element('.doc-example-live :text').attr('readonly')).toBeFalsy(); input('checked').check(); expect(element('.doc-example-live :text').attr('readonly')).toBeTruthy(); }); </doc:scenario> </doc:example> * * @element ANY * @param {template} template any string which can contain '{{}}' markup. */ /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:selected * * @description * The HTML specs do not require browsers to preserve the special attributes such as selected. * (The presence of them means true and absence means false) * This prevents the angular compiler from correctly retrieving the binding expression. * To solve this problem, we introduce ng:selected. * @example <doc:example> <doc:source> Check me to select: <input type="checkbox" name="checked"><br/> <select> <option>Hello!</option> <option id="greet" ng:selected="{{checked}}">Greetings!</option> </select> </doc:source> <doc:scenario> it('should select Greetings!', function() { expect(element('.doc-example-live #greet').attr('selected')).toBeFalsy(); input('checked').check(); expect(element('.doc-example-live #greet').attr('selected')).toBeTruthy(); }); </doc:scenario> </doc:example> * @element ANY * @param {template} template any string which can contain '{{}}' markup. */ var NG_BIND_ATTR = 'ng:bind-attr'; var SPECIAL_ATTRS = {}; forEach('src,href,checked,disabled,multiple,readonly,selected'.split(','), function(name) { SPECIAL_ATTRS['ng:' + name] = name; }); angularAttrMarkup('{{}}', function(value, name, element){ // don't process existing attribute markup if (angularDirective(name) || angularDirective("@" + name)) return; if (msie && name == 'src') value = decodeURI(value); var bindings = parseBindings(value), bindAttr; if (hasBindings(bindings) || SPECIAL_ATTRS[name]) { element.removeAttr(name); bindAttr = fromJson(element.attr(NG_BIND_ATTR) || "{}"); bindAttr[SPECIAL_ATTRS[name] || name] = value; element.attr(NG_BIND_ATTR, toJson(bindAttr)); } }); /** * @workInProgress * @ngdoc overview * @name angular.widget * @description * * An angular widget can be either a custom attribute that modifies an existing DOM element or an * entirely new DOM element. * * During html compilation, widgets are processed after {@link angular.markup markup}, but before * {@link angular.directive directives}. * * Following is the list of built-in angular widgets: * * * {@link angular.widget.@ng:format ng:format} - Formats data for display to user and for storage. * * {@link angular.widget.@ng:non-bindable ng:non-bindable} - Blocks angular from processing an * HTML element. * * {@link angular.widget.@ng:repeat ng:repeat} - Creates and manages a collection of cloned HTML * elements. * * {@link angular.widget.@ng:required ng:required} - Verifies presence of user input. * * {@link angular.widget.@ng:validate ng:validate} - Validates content of user input. * * {@link angular.widget.HTML HTML input elements} - Standard HTML input elements data-bound by * angular. * * {@link angular.widget.ng:view ng:view} - Works with $route to "include" partial templates * * {@link angular.widget.ng:switch ng:switch} - Conditionally changes DOM structure * * {@link angular.widget.ng:include ng:include} - Includes an external HTML fragment * * For more information about angular widgets, see {@link guide/dev_guide.compiler.widgets * Understanding Angular Widgets} in the angular Developer Guide. */ /** * @workInProgress * @ngdoc widget * @name angular.widget.HTML * * @description * The most common widgets you will use will be in the form of the * standard HTML set. These widgets are bound using the `name` attribute * to an expression. In addition, they can have `ng:validate`, `ng:required`, * `ng:format`, `ng:change` attribute to further control their behavior. * * @usageContent * see example below for usage * * <input type="text|checkbox|..." ... /> * <textarea ... /> * <select ...> * <option>...</option> * </select> * * @example <doc:example> <doc:source> <table style="font-size:.9em;"> <tr> <th>Name</th> <th>Format</th> <th>HTML</th> <th>UI</th> <th ng:non-bindable>{{input#}}</th> </tr> <tr> <th>text</th> <td>String</td> <td><tt>&lt;input type="text" name="input1"&gt;</tt></td> <td><input type="text" name="input1" size="4"></td> <td><tt>{{input1|json}}</tt></td> </tr> <tr> <th>textarea</th> <td>String</td> <td><tt>&lt;textarea name="input2"&gt;&lt;/textarea&gt;</tt></td> <td><textarea name="input2" cols='6'></textarea></td> <td><tt>{{input2|json}}</tt></td> </tr> <tr> <th>radio</th> <td>String</td> <td><tt> &lt;input type="radio" name="input3" value="A"&gt;<br> &lt;input type="radio" name="input3" value="B"&gt; </tt></td> <td> <input type="radio" name="input3" value="A"> <input type="radio" name="input3" value="B"> </td> <td><tt>{{input3|json}}</tt></td> </tr> <tr> <th>checkbox</th> <td>Boolean</td> <td><tt>&lt;input type="checkbox" name="input4" value="checked"&gt;</tt></td> <td><input type="checkbox" name="input4" value="checked"></td> <td><tt>{{input4|json}}</tt></td> </tr> <tr> <th>pulldown</th> <td>String</td> <td><tt> &lt;select name="input5"&gt;<br> &nbsp;&nbsp;&lt;option value="c"&gt;C&lt;/option&gt;<br> &nbsp;&nbsp;&lt;option value="d"&gt;D&lt;/option&gt;<br> &lt;/select&gt;<br> </tt></td> <td> <select name="input5"> <option value="c">C</option> <option value="d">D</option> </select> </td> <td><tt>{{input5|json}}</tt></td> </tr> <tr> <th>multiselect</th> <td>Array</td> <td><tt> &lt;select name="input6" multiple size="4"&gt;<br> &nbsp;&nbsp;&lt;option value="e"&gt;E&lt;/option&gt;<br> &nbsp;&nbsp;&lt;option value="f"&gt;F&lt;/option&gt;<br> &lt;/select&gt;<br> </tt></td> <td> <select name="input6" multiple size="4"> <option value="e">E</option> <option value="f">F</option> </select> </td> <td><tt>{{input6|json}}</tt></td> </tr> </table> </doc:source> <doc:scenario> it('should exercise text', function(){ input('input1').enter('Carlos'); expect(binding('input1')).toEqual('"Carlos"'); }); it('should exercise textarea', function(){ input('input2').enter('Carlos'); expect(binding('input2')).toEqual('"Carlos"'); }); it('should exercise radio', function(){ expect(binding('input3')).toEqual('null'); input('input3').select('A'); expect(binding('input3')).toEqual('"A"'); input('input3').select('B'); expect(binding('input3')).toEqual('"B"'); }); it('should exercise checkbox', function(){ expect(binding('input4')).toEqual('false'); input('input4').check(); expect(binding('input4')).toEqual('true'); }); it('should exercise pulldown', function(){ expect(binding('input5')).toEqual('"c"'); select('input5').option('d'); expect(binding('input5')).toEqual('"d"'); }); it('should exercise multiselect', function(){ expect(binding('input6')).toEqual('[]'); select('input6').options('e'); expect(binding('input6')).toEqual('["e"]'); select('input6').options('e', 'f'); expect(binding('input6')).toEqual('["e","f"]'); }); </doc:scenario> </doc:example> */ function modelAccessor(scope, element) { var expr = element.attr('name'); var exprFn, assignFn; if (expr) { exprFn = parser(expr).assignable(); assignFn = exprFn.assign; if (!assignFn) throw new Error("Expression '" + expr + "' is not assignable."); return { get: function() { return exprFn(scope); }, set: function(value) { if (value !== undefined) { assignFn(scope, value); } } }; } } function modelFormattedAccessor(scope, element) { var accessor = modelAccessor(scope, element), formatterName = element.attr('ng:format') || NOOP, formatter = compileFormatter(formatterName); if (accessor) { return { get: function() { return formatter.format(scope, accessor.get()); }, set: function(value) { return accessor.set(formatter.parse(scope, value)); } }; } } function compileValidator(expr) { return parser(expr).validator()(); } function compileFormatter(expr) { return parser(expr).formatter()(); } /** * @workInProgress * @ngdoc widget * @name angular.widget.@ng:validate * * @description * The `ng:validate` attribute widget validates the user input. If the input does not pass * validation, the `ng-validation-error` CSS class and the `ng:error` attribute are set on the input * element. Check out {@link angular.validator validators} to find out more. * * @param {string} validator The name of a built-in or custom {@link angular.validator validator} to * to be used. * * @element INPUT * @css ng-validation-error * * @example * This example shows how the input element becomes red when it contains invalid input. Correct * the input to make the error disappear. * <doc:example> <doc:source> I don't validate: <input type="text" name="value" value="NotANumber"><br/> I need an integer or nothing: <input type="text" name="value" ng:validate="integer"><br/> </doc:source> <doc:scenario> it('should check ng:validate', function(){ expect(element('.doc-example-live :input:last').attr('className')). toMatch(/ng-validation-error/); input('value').enter('123'); expect(element('.doc-example-live :input:last').attr('className')). not().toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> */ /** * @workInProgress * @ngdoc widget * @name angular.widget.@ng:required * * @description * The `ng:required` attribute widget validates that the user input is present. It is a special case * of the {@link angular.widget.@ng:validate ng:validate} attribute widget. * * @element INPUT * @css ng-validation-error * * @example * This example shows how the input element becomes red when it contains invalid input. Correct * the input to make the error disappear. * <doc:example> <doc:source> I cannot be blank: <input type="text" name="value" ng:required><br/> </doc:source> <doc:scenario> it('should check ng:required', function(){ expect(element('.doc-example-live :input').attr('className')).toMatch(/ng-validation-error/); input('value').enter('123'); expect(element('.doc-example-live :input').attr('className')).not().toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> */ /** * @workInProgress * @ngdoc widget * @name angular.widget.@ng:format * * @description * The `ng:format` attribute widget formats stored data to user-readable text and parses the text * back to the stored form. You might find this useful, for example, if you collect user input in a * text field but need to store the data in the model as a list. Check out * {@link angular.formatter formatters} to learn more. * * @param {string} formatter The name of the built-in or custom {@link angular.formatter formatter} * to be used. * * @element INPUT * * @example * This example shows how the user input is converted from a string and internally represented as an * array. * <doc:example> <doc:source> Enter a comma separated list of items: <input type="text" name="list" ng:format="list" value="table, chairs, plate"> <pre>list={{list}}</pre> </doc:source> <doc:scenario> it('should check ng:format', function(){ expect(binding('list')).toBe('list=["table","chairs","plate"]'); input('list').enter(',,, a ,,,'); expect(binding('list')).toBe('list=["a"]'); }); </doc:scenario> </doc:example> */ function valueAccessor(scope, element) { var validatorName = element.attr('ng:validate') || NOOP, validator = compileValidator(validatorName), requiredExpr = element.attr('ng:required'), formatterName = element.attr('ng:format') || NOOP, formatter = compileFormatter(formatterName), format, parse, lastError, required, invalidWidgets = scope.$service('$invalidWidgets') || {markValid:noop, markInvalid:noop}; if (!validator) throw "Validator named '" + validatorName + "' not found."; format = formatter.format; parse = formatter.parse; if (requiredExpr) { scope.$watch(requiredExpr, function(scope, newValue) { required = newValue; validate(); }); } else { required = requiredExpr === ''; } element.data($$validate, validate); return { get: function(){ if (lastError) elementError(element, NG_VALIDATION_ERROR, null); try { var value = parse(scope, element.val()); validate(); return value; } catch (e) { lastError = e; elementError(element, NG_VALIDATION_ERROR, e); } }, set: function(value) { var oldValue = element.val(), newValue = format(scope, value); if (oldValue != newValue) { element.val(newValue || ''); // needed for ie } validate(); } }; function validate() { var value = trim(element.val()); if (element[0].disabled || element[0].readOnly) { elementError(element, NG_VALIDATION_ERROR, null); invalidWidgets.markValid(element); } else { var error, validateScope = inherit(scope, {$element:element}); error = required && !value ? 'Required' : (value ? validator(validateScope, value) : null); elementError(element, NG_VALIDATION_ERROR, error); lastError = error; if (error) { invalidWidgets.markInvalid(element); } else { invalidWidgets.markValid(element); } } } } function checkedAccessor(scope, element) { var domElement = element[0], elementValue = domElement.value; return { get: function(){ return !!domElement.checked; }, set: function(value){ domElement.checked = toBoolean(value); } }; } function radioAccessor(scope, element) { var domElement = element[0]; return { get: function(){ return domElement.checked ? domElement.value : null; }, set: function(value){ domElement.checked = value == domElement.value; } }; } function optionsAccessor(scope, element) { var formatterName = element.attr('ng:format') || NOOP, formatter = compileFormatter(formatterName); return { get: function(){ var values = []; forEach(element[0].options, function(option){ if (option.selected) values.push(formatter.parse(scope, option.value)); }); return values; }, set: function(values){ var keys = {}; forEach(values, function(value){ keys[formatter.format(scope, value)] = true; }); forEach(element[0].options, function(option){ option.selected = keys[option.value]; }); } }; } function noopAccessor() { return { get: noop, set: noop }; } /* * TODO: refactor * * The table below is not quite right. In some cases the formatter is on the model side * and in some cases it is on the view side. This is a historical artifact * * The concept of model/view accessor is useful for anyone who is trying to develop UI, and * so it should be exposed to others. There should be a form object which keeps track of the * accessors and also acts as their factory. It should expose it as an object and allow * the validator to publish errors to it, so that the the error messages can be bound to it. * */ var textWidget = inputWidget('keydown change', modelAccessor, valueAccessor, initWidgetValue(), true), INPUT_TYPE = { 'text': textWidget, 'textarea': textWidget, 'hidden': textWidget, 'password': textWidget, 'checkbox': inputWidget('click', modelFormattedAccessor, checkedAccessor, initWidgetValue(false)), 'radio': inputWidget('click', modelFormattedAccessor, radioAccessor, radioInit), 'select-one': inputWidget('change', modelAccessor, valueAccessor, initWidgetValue(null)), 'select-multiple': inputWidget('change', modelAccessor, optionsAccessor, initWidgetValue([])) // 'file': fileWidget??? }; function initWidgetValue(initValue) { return function (model, view) { var value = view.get(); if (!value && isDefined(initValue)) { value = copy(initValue); } if (isUndefined(model.get()) && isDefined(value)) { model.set(value); } }; } function radioInit(model, view, element) { var modelValue = model.get(), viewValue = view.get(), input = element[0]; input.checked = false; input.name = this.$id + '@' + input.name; if (isUndefined(modelValue)) { model.set(modelValue = null); } if (modelValue == null && viewValue !== null) { model.set(viewValue); } view.set(modelValue); } /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:change * * @description * The directive executes an expression whenever the input widget changes. * * @element INPUT * @param {expression} expression to execute. * * @example * @example <doc:example> <doc:source> <div ng:init="checkboxCount=0; textCount=0"></div> <input type="text" name="text" ng:change="textCount = 1 + textCount"> changeCount {{textCount}}<br/> <input type="checkbox" name="checkbox" ng:change="checkboxCount = 1 + checkboxCount"> changeCount {{checkboxCount}}<br/> </doc:source> <doc:scenario> it('should check ng:change', function(){ expect(binding('textCount')).toBe('0'); expect(binding('checkboxCount')).toBe('0'); using('.doc-example-live').input('text').enter('abc'); expect(binding('textCount')).toBe('1'); expect(binding('checkboxCount')).toBe('0'); using('.doc-example-live').input('checkbox').check(); expect(binding('textCount')).toBe('1'); expect(binding('checkboxCount')).toBe('1'); }); </doc:scenario> </doc:example> */ function inputWidget(events, modelAccessor, viewAccessor, initFn, textBox) { return annotate('$defer', function($defer, element) { var scope = this, model = modelAccessor(scope, element), view = viewAccessor(scope, element), ngChange = element.attr('ng:change') || noop, lastValue; if (model) { initFn.call(scope, model, view, element); scope.$eval(element.attr('ng:init') || noop); element.bind(events, function(event){ function handler(){ var value = view.get(); if (!textBox || value != lastValue) { model.set(value); lastValue = model.get(); scope.$eval(ngChange); } } event.type == 'keydown' ? $defer(handler) : scope.$apply(handler); }); scope.$watch(model.get, function(scope, value) { if (!equals(lastValue, value)) { view.set(lastValue = value); } }); } }); } function inputWidgetSelector(element){ this.directives(true); this.descend(true); return INPUT_TYPE[lowercase(element[0].type)] || noop; } angularWidget('input', inputWidgetSelector); angularWidget('textarea', inputWidgetSelector); /** * @workInProgress * @ngdoc directive * @name angular.directive.ng:options * * @description * Dynamically generate a list of `<option>` elements for a `<select>` element using an array or * an object obtained by evaluating the `ng:options` expression. * * When an item in the select menu is select, the value of array element or object property * represented by the selected option will be bound to the model identified by the `name` attribute * of the parent select element. * * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can * be nested into the `<select>` element. This element will then represent `null` or "not selected" * option. See example below for demonstration. * * Note: `ng:options` provides iterator facility for `<option>` element which must be used instead * of {@link angular.widget.@ng:repeat ng:repeat}. `ng:repeat` is not suitable for use with * `<option>` element because of the following reasons: * * * value attribute of the option element that we need to bind to requires a string, but the * source of data for the iteration might be in a form of array containing objects instead of * strings * * {@link angular.widget.@ng:repeat ng:repeat} unrolls after the select binds causing * incorect rendering on most browsers. * * binding to a value not in list confuses most browsers. * * @element select * @param {comprehension_expression} comprehension in one of the following forms: * * * for array data sources: * * `label` **`for`** `value` **`in`** `array` * * `select` **`as`** `label` **`for`** `value` **`in`** `array` * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` * * `select` **`as`** `label` **`group by`** `group` **`for`** `value` **`in`** `array` * * for object data sources: * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object` * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object` * * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object` * * `select` **`as`** `label` **`group by`** `group` * **`for` `(`**`key`**`,`** `value`**`) in`** `object` * * Where: * * * `array` / `object`: an expression which evaluates to an array / object to iterate over. * * `value`: local variable which will refer to each item in the `array` or each property value * of `object` during iteration. * * `key`: local variable which will refer to a property name in `object` during iteration. * * `label`: The result of this expression will be the label for `<option>` element. The * `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`). * * `select`: The result of this expression will be bound to the model of the parent `<select>` * element. If not specified, `select` expression will default to `value`. * * `group`: The result of this expression will be used to group options using the `<optgroup>` * DOM element. * * @example <doc:example> <doc:source> <script> function MyCntrl(){ this.colors = [ {name:'black', shade:'dark'}, {name:'white', shade:'light'}, {name:'red', shade:'dark'}, {name:'blue', shade:'dark'}, {name:'yellow', shade:'light'} ]; this.color = this.colors[2]; // red } </script> <div ng:controller="MyCntrl"> <ul> <li ng:repeat="color in colors"> Name: <input name="color.name"> [<a href ng:click="colors.$remove(color)">X</a>] </li> <li> [<a href ng:click="colors.push({})">add</a>] </li> </ul> <hr/> Color (null not allowed): <select name="color" ng:options="c.name for c in colors"></select><br> Color (null allowed): <div class="nullable"> <select name="color" ng:options="c.name for c in colors"> <option value="">-- chose color --</option> </select> </div><br/> Color grouped by shade: <select name="color" ng:options="c.name group by c.shade for c in colors"> </select><br/> Select <a href ng:click="color={name:'not in list'}">bogus</a>.<br> <hr/> Currently selected: {{ {selected_color:color} }} <div style="border:solid 1px black; height:20px" ng:style="{'background-color':color.name}"> </div> </div> </doc:source> <doc:scenario> it('should check ng:options', function(){ expect(binding('color')).toMatch('red'); select('color').option('0'); expect(binding('color')).toMatch('black'); using('.nullable').select('color').option(''); expect(binding('color')).toMatch('null'); }); </doc:scenario> </doc:example> */ // 00001111100000000000222200000000000000000000003333000000000000044444444444444444000000000555555555555555550000000666666666666666660000000000000007777 var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/; angularWidget('select', function(element){ this.descend(true); this.directives(true); var isMultiselect = element.attr('multiple'), expression = element.attr('ng:options'), onChange = expressionCompile(element.attr('ng:change') || ""), match; if (!expression) { return inputWidgetSelector.call(this, element); } if (! (match = expression.match(NG_OPTIONS_REGEXP))) { throw Error( "Expected ng:options in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" + " but got '" + expression + "'."); } var displayFn = expressionCompile(match[2] || match[1]), valueName = match[4] || match[6], keyName = match[5], groupByFn = expressionCompile(match[3] || ''), valueFn = expressionCompile(match[2] ? match[1] : valueName), valuesFn = expressionCompile(match[7]), // we can't just jqLite('<option>') since jqLite is not smart enough // to create it in <select> and IE barfs otherwise. optionTemplate = jqLite(document.createElement('option')), optGroupTemplate = jqLite(document.createElement('optgroup')), nullOption = false; // if false then user will not be able to select it return function(selectElement){ // This is an array of array of existing option groups in DOM. We try to reuse these if possible // optionGroupsCache[0] is the options with no option group // optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element var optionGroupsCache = [[{element: selectElement, label:''}]], scope = this, model = modelAccessor(scope, element); // find existing special options forEach(selectElement.children(), function(option){ if (option.value == '') // User is allowed to select the null. nullOption = {label:jqLite(option).text(), id:''}; }); selectElement.html(''); // clear contents selectElement.bind('change', function(){ var optionGroup, collection = valuesFn(scope) || [], key = selectElement.val(), tempScope = scope.$new(), value, optionElement, index, groupIndex, length, groupLength; try { if (isMultiselect) { value = []; for (groupIndex = 0, groupLength = optionGroupsCache.length; groupIndex < groupLength; groupIndex++) { // list of options for that group. (first item has the parent) optionGroup = optionGroupsCache[groupIndex]; for(index = 1, length = optionGroup.length; index < length; index++) { if ((optionElement = optionGroup[index].element)[0].selected) { if (keyName) tempScope[keyName] = key; tempScope[valueName] = collection[optionElement.val()]; value.push(valueFn(tempScope)); } } } } else { if (key == '?') { value = undefined; } else if (key == ''){ value = null; } else { tempScope[valueName] = collection[key]; if (keyName) tempScope[keyName] = key; value = valueFn(tempScope); } } if (isDefined(value) && model.get() !== value) { model.set(value); onChange(scope); } scope.$root.$apply(); } finally { tempScope = null; // TODO(misko): needs to be $destroy } }); scope.$watch(function(scope) { var optionGroups = {'':[]}, // Temporary location for the option groups before we render them optionGroupNames = [''], optionGroupName, optionGroup, option, existingParent, existingOptions, existingOption, values = valuesFn(scope) || [], keys = values, key, groupLength, length, fragment, groupIndex, index, optionElement, optionScope = scope.$new(), modelValue = model.get(), selected, selectedSet = false, // nothing is selected yet isMulti = isMultiselect, lastElement, element; try { if (isMulti) { selectedSet = new HashMap(); if (modelValue && isNumber(length = modelValue.length)) { for (index = 0; index < length; index++) { selectedSet.put(modelValue[index], true); } } } else if (modelValue === null || nullOption) { // if we are not multiselect, and we are null then we have to add the nullOption optionGroups[''].push(extend({selected:modelValue === null, id:'', label:''}, nullOption)); selectedSet = true; } // If we have a keyName then we are iterating over on object. Grab the keys and sort them. if(keyName) { keys = []; for (key in values) { if (values.hasOwnProperty(key)) keys.push(key); } keys.sort(); } // We now build up the list of options we need (we merge later) for (index = 0; length = keys.length, index < length; index++) { optionScope[valueName] = values[keyName ? optionScope[keyName]=keys[index]:index]; optionGroupName = groupByFn(optionScope) || ''; if (!(optionGroup = optionGroups[optionGroupName])) { optionGroup = optionGroups[optionGroupName] = []; optionGroupNames.push(optionGroupName); } if (isMulti) { selected = !!selectedSet.remove(valueFn(optionScope)); } else { selected = modelValue === valueFn(optionScope); selectedSet = selectedSet || selected; // see if at least one item is selected } optionGroup.push({ id: keyName ? keys[index] : index, // either the index into array or key from object label: displayFn(optionScope) || '', // what will be seen by the user selected: selected // determine if we should be selected }); } optionGroupNames.sort(); if (!isMulti && !selectedSet) { // nothing was selected, we have to insert the undefined item optionGroups[''].unshift({id:'?', label:'', selected:true}); } // Now we need to update the list of DOM nodes to match the optionGroups we computed above for (groupIndex = 0, groupLength = optionGroupNames.length; groupIndex < groupLength; groupIndex++) { // current option group name or '' if no group optionGroupName = optionGroupNames[groupIndex]; // list of options for that group. (first item has the parent) optionGroup = optionGroups[optionGroupName]; if (optionGroupsCache.length <= groupIndex) { // we need to grow the optionGroups optionGroupsCache.push( existingOptions = [ existingParent = { element: optGroupTemplate.clone().attr('label', optionGroupName), label: optionGroup.label } ] ); selectElement.append(existingParent.element); } else { existingOptions = optionGroupsCache[groupIndex]; existingParent = existingOptions[0]; // either SELECT (no group) or OPTGROUP element // update the OPTGROUP label if not the same. if (existingParent.label != optionGroupName) { existingParent.element.attr('label', existingParent.label = optionGroupName); } } lastElement = null; // start at the begining for(index = 0, length = optionGroup.length; index < length; index++) { option = optionGroup[index]; if ((existingOption = existingOptions[index+1])) { // reuse elements lastElement = existingOption.element; if (existingOption.label !== option.label) { lastElement.text(existingOption.label = option.label); } if (existingOption.id !== option.id) { lastElement.val(existingOption.id = option.id); } if (existingOption.selected !== option.selected) { lastElement.attr('selected', option.selected); } } else { // grow elements // jQuery(v1.4.2) Bug: We should be able to chain the method calls, but // in this version of jQuery on some browser the .text() returns a string // rather then the element. (element = optionTemplate.clone()) .val(option.id) .attr('selected', option.selected) .text(option.label); existingOptions.push(existingOption = { element: element, label: option.label, id: option.id, checked: option.selected }); if (lastElement) { lastElement.after(element); } else { existingParent.element.append(element); } lastElement = element; } } // remove any excessive OPTIONs in a group index++; // increment since the existingOptions[0] is parent element not OPTION while(existingOptions.length > index) { existingOptions.pop().element.remove(); } } // remove any excessive OPTGROUPs from select while(optionGroupsCache.length > groupIndex) { optionGroupsCache.pop()[0].element.remove(); } } finally { optionScope.$destroy(); } }); }; }); /** * @workInProgress * @ngdoc widget * @name angular.widget.ng:include * * @description * Fetches, compiles and includes an external HTML fragment. * * Keep in mind that Same Origin Policy applies to included resources * (e.g. ng:include won't work for file:// access). * * @param {string} src angular expression evaluating to URL. If the source is a string constant, * make sure you wrap it in quotes, e.g. `src="'myPartialTemplate.html'"`. * @param {Scope=} [scope=new_child_scope] optional expression which evaluates to an * instance of angular.scope to set the HTML fragment to. * @param {string=} onload Expression to evaluate when a new partial is loaded. * * @example <doc:example> <doc:source jsfiddle="false"> <select name="url"> <option value="examples/ng-include/template1.html">template1.html</option> <option value="examples/ng-include/template2.html">template2.html</option> <option value="">(blank)</option> </select> url of the template: <tt><a href="{{url}}">{{url}}</a></tt> <hr/> <ng:include src="url"></ng:include> </doc:source> <doc:scenario> it('should load template1.html', function(){ expect(element('.doc-example-live ng\\:include').text()). toBe('Content of template1.html\n'); }); it('should load template2.html', function(){ select('url').option('examples/ng-include/template2.html'); expect(element('.doc-example-live ng\\:include').text()). toBe('Content of template2.html\n'); }); it('should change to blank', function(){ select('url').option(''); expect(element('.doc-example-live ng\\:include').text()).toEqual(''); }); </doc:scenario> </doc:example> */ angularWidget('ng:include', function(element){ var compiler = this, srcExp = element.attr("src"), scopeExp = element.attr("scope") || '', onloadExp = element[0].getAttribute('onload') || ''; //workaround for jquery bug #7537 if (element[0]['ng:compiled']) { this.descend(true); this.directives(true); } else { element[0]['ng:compiled'] = true; return extend(function(xhr, element){ var scope = this, changeCounter = 0, releaseScopes = [], childScope, oldScope; function incrementChange(){ changeCounter++;} this.$watch(srcExp, incrementChange); this.$watch(function(scope){ var newScope = scope.$eval(scopeExp); if (newScope !== oldScope) { oldScope = newScope; incrementChange(); } }); this.$watch(function(){return changeCounter;}, function(scope) { var src = scope.$eval(srcExp), useScope = scope.$eval(scopeExp); while(releaseScopes.length) { releaseScopes.pop().$destroy(); } if (src) { xhr('GET', src, null, function(code, response){ element.html(response); if (useScope) { childScope = useScope; } else { releaseScopes.push(childScope = scope.$new()); } compiler.compile(element)(childScope); scope.$eval(onloadExp); }, false, true); } else { childScope = null; element.html(''); } }); }, {$inject:['$xhr.cache']}); } }); /** * @workInProgress * @ngdoc widget * @name angular.widget.ng:switch * * @description * Conditionally change the DOM structure. * * @usageContent * <any ng:switch-when="matchValue1">...</any> * <any ng:switch-when="matchValue2">...</any> * ... * <any ng:switch-default>...</any> * * @param {*} on expression to match against <tt>ng:switch-when</tt>. * @paramDescription * On child elments add: * * * `ng:switch-when`: the case statement to match against. If match then this * case will be displayed. * * `ng:switch-default`: the default case when no other casses match. * * @example <doc:example> <doc:source> <select name="switch"> <option>settings</option> <option>home</option> <option>other</option> </select> <tt>switch={{switch}}</tt> </hr> <ng:switch on="switch" > <div ng:switch-when="settings">Settings Div</div> <span ng:switch-when="home">Home Span</span> <span ng:switch-default>default</span> </ng:switch> </code> </doc:source> <doc:scenario> it('should start in settings', function(){ expect(element('.doc-example-live ng\\:switch').text()).toEqual('Settings Div'); }); it('should change to home', function(){ select('switch').option('home'); expect(element('.doc-example-live ng\\:switch').text()).toEqual('Home Span'); }); it('should select deafault', function(){ select('switch').option('other'); expect(element('.doc-example-live ng\\:switch').text()).toEqual('default'); }); </doc:scenario> </doc:example> */ angularWidget('ng:switch', function (element) { var compiler = this, watchExpr = element.attr("on"), changeExpr = element.attr('change'), casesTemplate = {}, defaultCaseTemplate, children = element.children(), length = children.length, child, when; if (!watchExpr) throw new Error("Missing 'on' attribute."); while(length--) { child = jqLite(children[length]); // this needs to be here for IE child.remove(); when = child.attr('ng:switch-when'); if (isString(when)) { casesTemplate[when] = compiler.compile(child); } else if (isString(child.attr('ng:switch-default'))) { defaultCaseTemplate = compiler.compile(child); } } children = null; // release memory; element.html(''); return function(element){ var changeCounter = 0; var childScope; var selectedTemplate; this.$watch(watchExpr, function(scope, value) { element.html(''); if ((selectedTemplate = casesTemplate[value] || defaultCaseTemplate)) { changeCounter++; if (childScope) childScope.$destroy(); childScope = scope.$new(); childScope.$eval(changeExpr); } }); this.$watch(function(){return changeCounter;}, function() { element.html(''); if (selectedTemplate) { selectedTemplate(childScope, function(caseElement) { element.append(caseElement); }); } }); }; }); /* * Modifies the default behavior of html A tag, so that the default action is prevented when href * attribute is empty. * * The reasoning for this change is to allow easy creation of action links with ng:click without * changing the location or causing page reloads, e.g.: * <a href="" ng:click="model.$save()">Save</a> */ angularWidget('a', function() { this.descend(true); this.directives(true); return function(element) { var hasNgHref = ((element.attr('ng:bind-attr') || '').indexOf('"href":') !== -1); // turn <a href ng:click="..">link</a> into a link in IE // but only if it doesn't have name attribute, in which case it's an anchor if (!hasNgHref && !element.attr('name') && !element.attr('href')) { element.attr('href', ''); } if (element.attr('href') === '' && !hasNgHref) { element.bind('click', function(event){ event.preventDefault(); }); } }; }); /** * @workInProgress * @ngdoc widget * @name angular.widget.@ng:repeat * * @description * The `ng:repeat` widget instantiates a template once per item from a collection. The collection is * enumerated with the `ng:repeat-index` attribute, starting from 0. Each template instance gets * its own scope, where the given loop variable is set to the current collection item, and `$index` * is set to the item index or key. * * Special properties are exposed on the local scope of each template instance, including: * * * `$index` – `{number}` – iterator offset of the repeated element (0..length-1) * * `$position` – `{string}` – position of the repeated element in the iterator. One of: * * `'first'`, * * `'middle'` * * `'last'` * * Note: Although `ng:repeat` looks like a directive, it is actually an attribute widget. * * @element ANY * @param {string} repeat_expression The expression indicating how to enumerate a collection. Two * formats are currently supported: * * * `variable in expression` – where variable is the user defined loop variable and `expression` * is a scope expression giving the collection to enumerate. * * For example: `track in cd.tracks`. * * * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers, * and `expression` is the scope expression giving the collection to enumerate. * * For example: `(name, age) in {'adam':10, 'amalie':12}`. * * @example * This example initializes the scope to a list of names and * then uses `ng:repeat` to display every person: <doc:example> <doc:source> <div ng:init="friends = [{name:'John', age:25}, {name:'Mary', age:28}]"> I have {{friends.length}} friends. They are: <ul> <li ng:repeat="friend in friends"> [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old. </li> </ul> </div> </doc:source> <doc:scenario> it('should check ng:repeat', function(){ var r = using('.doc-example-live').repeater('ul li'); expect(r.count()).toBe(2); expect(r.row(0)).toEqual(["1","John","25"]); expect(r.row(1)).toEqual(["2","Mary","28"]); }); </doc:scenario> </doc:example> */ angularWidget('@ng:repeat', function(expression, element){ element.removeAttr('ng:repeat'); element.replaceWith(jqLite('<!-- ng:repeat: ' + expression + ' -->')); var linker = this.compile(element); return function(iterStartElement){ var match = expression.match(/^\s*(.+)\s+in\s+(.*)\s*$/), lhs, rhs, valueIdent, keyIdent; if (! match) { throw Error("Expected ng:repeat in form of '_item_ in _collection_' but got '" + expression + "'."); } lhs = match[1]; rhs = match[2]; match = lhs.match(/^([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\)$/); if (!match) { throw Error("'item' in 'item in collection' should be identifier or (key, value) but got '" + keyValue + "'."); } valueIdent = match[3] || match[1]; keyIdent = match[2]; var childScopes = []; var childElements = [iterStartElement]; var parentScope = this; this.$watch(function(scope){ var index = 0, childCount = childScopes.length, collection = scope.$eval(rhs), collectionLength = size(collection, true), fragment = document.createDocumentFragment(), addFragmentTo = (childCount < collectionLength) ? childElements[childCount] : null, childScope, key; for (key in collection) { if (collection.hasOwnProperty(key)) { if (index < childCount) { // reuse existing child childScope = childScopes[index]; childScope[valueIdent] = collection[key]; if (keyIdent) childScope[keyIdent] = key; childScope.$position = index == 0 ? 'first' : (index == collectionLength - 1 ? 'last' : 'middle'); childScope.$eval(); } else { // grow children childScope = parentScope.$new(); childScope[valueIdent] = collection[key]; if (keyIdent) childScope[keyIdent] = key; childScope.$index = index; childScope.$position = index == 0 ? 'first' : (index == collectionLength - 1 ? 'last' : 'middle'); childScopes.push(childScope); linker(childScope, function(clone){ clone.attr('ng:repeat-index', index); fragment.appendChild(clone[0]); // TODO(misko): Temporary hack - maybe think about it - removed after we add fragment after $digest() // This causes double $digest for children // The first flush will couse a lot of DOM access (initial) // Second flush shuld be noop since nothing has change hence no DOM access. childScope.$digest(); childElements[index + 1] = clone; }); } index ++; } } //attach new nodes buffered in doc fragment if (addFragmentTo) { // TODO(misko): For performance reasons, we should do the addition after all other widgets // have run. For this should happend after $digest() is done! addFragmentTo.after(jqLite(fragment)); } // shrink children while(childScopes.length > index) { // can not use $destroy(true) since there may be multiple iterators on same parent. childScopes.pop().$destroy(); childElements.pop().remove(); } }); }; }); /** * @workInProgress * @ngdoc widget * @name angular.widget.@ng:non-bindable * * @description * Sometimes it is necessary to write code which looks like bindings but which should be left alone * by angular. Use `ng:non-bindable` to make angular ignore a chunk of HTML. * * Note: `ng:non-bindable` looks like a directive, but is actually an attribute widget. * * @element ANY * * @example * In this example there are two location where a simple binding (`{{}}`) is present, but the one * wrapped in `ng:non-bindable` is left alone. * * @example <doc:example> <doc:source> <div>Normal: {{1 + 2}}</div> <div ng:non-bindable>Ignored: {{1 + 2}}</div> </doc:source> <doc:scenario> it('should check ng:non-bindable', function(){ expect(using('.doc-example-live').binding('1 + 2')).toBe('3'); expect(using('.doc-example-live').element('div:last').text()). toMatch(/1 \+ 2/); }); </doc:scenario> </doc:example> */ angularWidget("@ng:non-bindable", noop); /** * @ngdoc widget * @name angular.widget.ng:view * * @description * # Overview * `ng:view` is a widget that complements the {@link angular.service.$route $route} service by * including the rendered template of the current route into the main layout (`index.html`) file. * Every time the current route changes, the included view changes with it according to the * configuration of the `$route` service. * * This widget provides functionality similar to {@link angular.widget.ng:include ng:include} when * used like this: * * <ng:include src="$route.current.template" scope="$route.current.scope"></ng:include> * * * # Advantages * Compared to `ng:include`, `ng:view` offers these advantages: * * - shorter syntax * - more efficient execution * - doesn't require `$route` service to be available on the root scope * * * @example <doc:example> <doc:source jsfiddle="false"> <script> function MyCtrl($route) { $route.when('/overview', { controller: OverviewCtrl, template: 'guide/dev_guide.overview.html'}); $route.when('/bootstrap', { controller: BootstrapCtrl, template: 'guide/dev_guide.bootstrap.auto_bootstrap.html'}); }; MyCtrl.$inject = ['$route']; function BootstrapCtrl(){} function OverviewCtrl(){} </script> <div ng:controller="MyCtrl"> <a href="#!/overview">overview</a> | <a href="#!/bootstrap">bootstrap</a> | <a href="#!/undefined">undefined</a> <br/> The view is included below: <hr/> <ng:view></ng:view> </div> </doc:source> <doc:scenario> it('should load templates', function(){ element('.doc-example-live a:contains(overview)').click(); expect(element('.doc-example-live ng\\:view').text()).toMatch(/Developer Guide: Overview/); element('.doc-example-live a:contains(bootstrap)').click(); expect(element('.doc-example-live ng\\:view').text()).toMatch(/Developer Guide: Initializing Angular: Automatic Initiialization/); }); </doc:scenario> </doc:example> */ angularWidget('ng:view', function(element) { var compiler = this; if (!element[0]['ng:compiled']) { element[0]['ng:compiled'] = true; return annotate('$xhr.cache', '$route', function($xhr, $route, element){ var template; var changeCounter = 0; this.$on('$afterRouteChange', function(){ changeCounter++; }); this.$watch(function(){return changeCounter;}, function() { var template = $route.current && $route.current.template; if (template) { //xhr's callback must be async, see commit history for more info $xhr('GET', template, function(code, response) { element.html(response); compiler.compile(element)($route.current.scope); }); } else { element.html(''); } }); }); } else { compiler.descend(true); compiler.directives(true); } }); /** * @ngdoc widget * @name angular.widget.ng:pluralize * * @description * # Overview * ng:pluralize is a widget that displays messages according to en-US localization rules. * These rules are bundled with angular.js and the rules can be overridden * (see {@link guide/dev_guide.i18n Angular i18n} dev guide). You configure ng:pluralize by * specifying the mappings between * {@link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html * plural categories} and the strings to be displayed. * * # Plural categories and explicit number rules * There are two * {@link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html * plural categories} in Angular's default en-US locale: "one" and "other". * * While a pural category may match many numbers (for example, in en-US locale, "other" can match * any number that is not 1), an explicit number rule can only match one number. For example, the * explicit number rule for "3" matches the number 3. You will see the use of plural categories * and explicit number rules throughout later parts of this documentation. * * # Configuring ng:pluralize * You configure ng:pluralize by providing 2 attributes: `count` and `when`. * You can also provide an optional attribute, `offset`. * * The value of the `count` attribute can be either a string or an {@link guide/dev_guide.expressions * Angular expression}; these are evaluated on the current scope for its binded value. * * The `when` attribute specifies the mappings between plural categories and the actual * string to be displayed. The value of the attribute should be a JSON object so that Angular * can interpret it correctly. * * The following example shows how to configure ng:pluralize: * * <pre> * <ng:pluralize count="personCount" when="{'0': 'Nobody is viewing.', * 'one': '1 person is viewing.', * 'other': '{} people are viewing.'}"> * </ng:pluralize> *</pre> * * In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not * specify this rule, 0 would be matched to the "other" category and "0 people are viewing" * would be shown instead of "Nobody is viewing". You can specify an explicit number rule for * other numbers, for example 12, so that instead of showing "12 people are viewing", you can * show "a dozen people are viewing". * * You can use a set of closed braces(`{}`) as a placeholder for the number that you want substituted * into pluralized strings. In the previous example, Angular will replace `{}` with * <span ng:non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder * for <span ng:non-bindable>{{numberExpression}}</span>. * * # Configuring ng:pluralize with offset * The `offset` attribute allows further customization of pluralized text, which can result in * a better user experience. For example, instead of the message "4 people are viewing this document", * you might display "John, Kate and 2 others are viewing this document". * The offset attribute allows you to offset a number by any desired value. * Let's take a look at an example: * * <pre> * <ng:pluralize count="personCount" offset=2 * when="{'0': 'Nobody is viewing.', * '1': '{{person1}} is viewing.', * '2': '{{person1}} and {{person2}} are viewing.', * 'one': '{{person1}}, {{person2}} and one other person are viewing.', * 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}"> * </ng:pluralize> * </pre> * * Notice that we are still using two plural categories(one, other), but we added * three explicit number rules 0, 1 and 2. * When one person, perhaps John, views the document, "John is viewing" will be shown. * When three people view the document, no explicit number rule is found, so * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category. * In this case, plural category 'one' is matched and "John, Marry and one other person are viewing" * is shown. * * Note that when you specify offsets, you must provide explicit number rules for * numbers from 0 up to and including the offset. If you use an offset of 3, for example, * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for * plural categories "one" and "other". * * @param {string|expression} count The variable to be bounded to. * @param {string} when The mapping between plural category to its correspoding strings. * @param {number=} offset Offset to deduct from the total number. * * @example <doc:example> <doc:source> Person 1:<input type="text" name="person1" value="Igor" /><br/> Person 2:<input type="text" name="person2" value="Misko" /><br/> Number of People:<input type="text" name="personCount" value="1" /><br/> <!--- Example with simple pluralization rules for en locale ---> Without Offset: <ng:pluralize count="personCount" when="{'0': 'Nobody is viewing.', 'one': '1 person is viewing.', 'other': '{} people are viewing.'}"> </ng:pluralize><br> <!--- Example with offset ---> With Offset(2): <ng:pluralize count="personCount" offset=2 when="{'0': 'Nobody is viewing.', '1': '{{person1}} is viewing.', '2': '{{person1}} and {{person2}} are viewing.', 'one': '{{person1}}, {{person2}} and one other person are viewing.', 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}"> </ng:pluralize> </doc:source> <doc:scenario> it('should show correct pluralized string', function(){ expect(element('.doc-example-live .ng-pluralize:first').text()). toBe('1 person is viewing.'); expect(element('.doc-example-live .ng-pluralize:last').text()). toBe('Igor is viewing.'); using('.doc-example-live').input('personCount').enter('0'); expect(element('.doc-example-live .ng-pluralize:first').text()). toBe('Nobody is viewing.'); expect(element('.doc-example-live .ng-pluralize:last').text()). toBe('Nobody is viewing.'); using('.doc-example-live').input('personCount').enter('2'); expect(element('.doc-example-live .ng-pluralize:first').text()). toBe('2 people are viewing.'); expect(element('.doc-example-live .ng-pluralize:last').text()). toBe('Igor and Misko are viewing.'); using('.doc-example-live').input('personCount').enter('3'); expect(element('.doc-example-live .ng-pluralize:first').text()). toBe('3 people are viewing.'); expect(element('.doc-example-live .ng-pluralize:last').text()). toBe('Igor, Misko and one other person are viewing.'); using('.doc-example-live').input('personCount').enter('4'); expect(element('.doc-example-live .ng-pluralize:first').text()). toBe('4 people are viewing.'); expect(element('.doc-example-live .ng-pluralize:last').text()). toBe('Igor, Misko and 2 other people are viewing.'); }); it('should show data-binded names', function(){ using('.doc-example-live').input('personCount').enter('4'); expect(element('.doc-example-live .ng-pluralize:last').text()). toBe('Igor, Misko and 2 other people are viewing.'); using('.doc-example-live').input('person1').enter('Di'); using('.doc-example-live').input('person2').enter('Vojta'); expect(element('.doc-example-live .ng-pluralize:last').text()). toBe('Di, Vojta and 2 other people are viewing.'); }); </doc:scenario> </doc:example> */ angularWidget('ng:pluralize', function(element) { var numberExp = element.attr('count'), whenExp = element.attr('when'), offset = element.attr('offset') || 0; return annotate('$locale', function($locale, element) { var scope = this, whens = scope.$eval(whenExp), whensExpFns = {}; forEach(whens, function(expression, key) { whensExpFns[key] = compileBindTemplate(expression.replace(/{}/g, '{{' + numberExp + '-' + offset + '}}')); }); scope.$watch(function() { var value = parseFloat(scope.$eval(numberExp)); if (!isNaN(value)) { //if explicit number rule such as 1, 2, 3... is defined, just use it. Otherwise, //check it against pluralization rules in $locale service if (!whens[value]) value = $locale.pluralCat(value - offset); return whensExpFns[value](scope, element, true); } else { return ''; } }, function(scope, newVal) { element.text(newVal); }); }); }); var browserSingleton; angularService('$browser', function($log, $sniffer) { if (!browserSingleton) { browserSingleton = new Browser(window, jqLite(window.document), jqLite(window.document.body), XHR, $log, $sniffer); browserSingleton.bind(); } return browserSingleton; }, {$inject: ['$log', '$sniffer']}); extend(angular, { // disabled for now until we agree on public name //'annotate': annotate, 'compile': compile, 'scope': createScope, 'copy': copy, 'extend': extend, 'equals': equals, 'forEach': forEach, 'injector': createInjector, 'noop':noop, 'bind':bind, 'toJson': toJson, 'fromJson': fromJson, 'identity':identity, 'isUndefined': isUndefined, 'isDefined': isDefined, 'isString': isString, 'isFunction': isFunction, 'isObject': isObject, 'isNumber': isNumber, 'isArray': isArray, 'version': version, 'isDate': isDate, 'lowercase': lowercase, 'uppercase': uppercase }); //try to bind to jquery now so that one can write angular.element().read() //but we will rebind on bootstrap again. bindJQuery(); jqLiteWrap(document).ready(function(){ angularInit(angularJsConfig(document), document); }); })(window, document); angular.element(document).find('head').append('<style type="text/css">@charset "UTF-8";[ng\\:cloak],.ng-cloak{display:none;}.ng-format-negative{color:red;}.ng-exception{border:2px solid #FF0000;font-family:"Courier New",Courier,monospace;font-size:smaller;white-space:pre;}.ng-validation-error{border:2px solid #FF0000;}#ng-callout{margin:0;padding:0;border:0;outline:0;font-size:13px;font-weight:normal;font-family:Verdana,Arial,Helvetica,sans-serif;vertical-align:baseline;background:transparent;text-decoration:none;}#ng-callout .ng-arrow-left{background-image:url("data:image/gif;base64,R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrSLoc/AG8FeUUIN+sGebWAnbKSJodqqlsOxJtqYooU9vvk+vcJIcTkg+QAAA7");background-repeat:no-repeat;background-position:left top;position:absolute;z-index:101;left:-12px;height:23px;width:10px;top:-3px;}#ng-callout .ng-arrow-right{background-image:url("data:image/gif;base64,R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrCLTcoM29yN6k9socs91e5X3EyJloipYrO4ohTMqA0Fn2XVNswJe+H+SXAAA7");background-repeat:no-repeat;background-position:left top;position:absolute;z-index:101;height:23px;width:11px;top:-2px;}#ng-callout{position:absolute;z-index:100;border:2px solid #CCCCCC;background-color:#fff;}#ng-callout .ng-content{padding:10px 10px 10px 10px;color:#333333;}#ng-callout .ng-title{background-color:#CCCCCC;text-align:left;padding-left:8px;padding-bottom:5px;padding-top:2px;font-weight:bold;}.ng-input-indicator-wait{background-image:url("data:image/png;base64,R0lGODlhEAAQAPQAAP///wAAAPDw8IqKiuDg4EZGRnp6egAAAFhYWCQkJKysrL6+vhQUFJycnAQEBDY2NmhoaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAAFdyAgAgIJIeWoAkRCCMdBkKtIHIngyMKsErPBYbADpkSCwhDmQCBethRB6Vj4kFCkQPG4IlWDgrNRIwnO4UKBXDufzQvDMaoSDBgFb886MiQadgNABAokfCwzBA8LCg0Egl8jAggGAA1kBIA1BAYzlyILczULC2UhACH5BAkKAAAALAAAAAAQABAAAAV2ICACAmlAZTmOREEIyUEQjLKKxPHADhEvqxlgcGgkGI1DYSVAIAWMx+lwSKkICJ0QsHi9RgKBwnVTiRQQgwF4I4UFDQQEwi6/3YSGWRRmjhEETAJfIgMFCnAKM0KDV4EEEAQLiF18TAYNXDaSe3x6mjidN1s3IQAh+QQJCgAAACwAAAAAEAAQAAAFeCAgAgLZDGU5jgRECEUiCI+yioSDwDJyLKsXoHFQxBSHAoAAFBhqtMJg8DgQBgfrEsJAEAg4YhZIEiwgKtHiMBgtpg3wbUZXGO7kOb1MUKRFMysCChAoggJCIg0GC2aNe4gqQldfL4l/Ag1AXySJgn5LcoE3QXI3IQAh+QQJCgAAACwAAAAAEAAQAAAFdiAgAgLZNGU5joQhCEjxIssqEo8bC9BRjy9Ag7GILQ4QEoE0gBAEBcOpcBA0DoxSK/e8LRIHn+i1cK0IyKdg0VAoljYIg+GgnRrwVS/8IAkICyosBIQpBAMoKy9dImxPhS+GKkFrkX+TigtLlIyKXUF+NjagNiEAIfkECQoAAAAsAAAAABAAEAAABWwgIAICaRhlOY4EIgjH8R7LKhKHGwsMvb4AAy3WODBIBBKCsYA9TjuhDNDKEVSERezQEL0WrhXucRUQGuik7bFlngzqVW9LMl9XWvLdjFaJtDFqZ1cEZUB0dUgvL3dgP4WJZn4jkomWNpSTIyEAIfkECQoAAAAsAAAAABAAEAAABX4gIAICuSxlOY6CIgiD8RrEKgqGOwxwUrMlAoSwIzAGpJpgoSDAGifDY5kopBYDlEpAQBwevxfBtRIUGi8xwWkDNBCIwmC9Vq0aiQQDQuK+VgQPDXV9hCJjBwcFYU5pLwwHXQcMKSmNLQcIAExlbH8JBwttaX0ABAcNbWVbKyEAIfkECQoAAAAsAAAAABAAEAAABXkgIAICSRBlOY7CIghN8zbEKsKoIjdFzZaEgUBHKChMJtRwcWpAWoWnifm6ESAMhO8lQK0EEAV3rFopIBCEcGwDKAqPh4HUrY4ICHH1dSoTFgcHUiZjBhAJB2AHDykpKAwHAwdzf19KkASIPl9cDgcnDkdtNwiMJCshACH5BAkKAAAALAAAAAAQABAAAAV3ICACAkkQZTmOAiosiyAoxCq+KPxCNVsSMRgBsiClWrLTSWFoIQZHl6pleBh6suxKMIhlvzbAwkBWfFWrBQTxNLq2RG2yhSUkDs2b63AYDAoJXAcFRwADeAkJDX0AQCsEfAQMDAIPBz0rCgcxky0JRWE1AmwpKyEAIfkECQoAAAAsAAAAABAAEAAABXkgIAICKZzkqJ4nQZxLqZKv4NqNLKK2/Q4Ek4lFXChsg5ypJjs1II3gEDUSRInEGYAw6B6zM4JhrDAtEosVkLUtHA7RHaHAGJQEjsODcEg0FBAFVgkQJQ1pAwcDDw8KcFtSInwJAowCCA6RIwqZAgkPNgVpWndjdyohACH5BAkKAAAALAAAAAAQABAAAAV5ICACAimc5KieLEuUKvm2xAKLqDCfC2GaO9eL0LABWTiBYmA06W6kHgvCqEJiAIJiu3gcvgUsscHUERm+kaCxyxa+zRPk0SgJEgfIvbAdIAQLCAYlCj4DBw0IBQsMCjIqBAcPAooCBg9pKgsJLwUFOhCZKyQDA3YqIQAh+QQJCgAAACwAAAAAEAAQAAAFdSAgAgIpnOSonmxbqiThCrJKEHFbo8JxDDOZYFFb+A41E4H4OhkOipXwBElYITDAckFEOBgMQ3arkMkUBdxIUGZpEb7kaQBRlASPg0FQQHAbEEMGDSVEAA1QBhAED1E0NgwFAooCDWljaQIQCE5qMHcNhCkjIQAh+QQJCgAAACwAAAAAEAAQAAAFeSAgAgIpnOSoLgxxvqgKLEcCC65KEAByKK8cSpA4DAiHQ/DkKhGKh4ZCtCyZGo6F6iYYPAqFgYy02xkSaLEMV34tELyRYNEsCQyHlvWkGCzsPgMCEAY7Cg04Uk48LAsDhRA8MVQPEF0GAgqYYwSRlycNcWskCkApIyEAOwAAAAAAAAAAAA==");background-position:right;background-repeat:no-repeat;}</style>');
src/routes/UIElement/iconfont/index.js
shaohuawang2015/goldbeans-admin
import React from 'react' import { Iconfont } from 'components' import { Table, Row, Col, Icon } from 'antd' import styles from './index.less' import './emoji.js' const colorfulIcons = ['boluo', 'baixiangguo', 'chengzi', 'boluomei', 'caomei', 'dayouzi', 'chelizi', 'fanqie', 'hamigua', 'ganlan', 'juzi', 'heimei', 'huolongguo', 'hongmei', 'lizi', 'lanmei', 'mangguo', 'mihoutao', 'longyan', 'mugua', 'lizi1', 'ningmeng'] const flatIcons = ['home', 'user', 'timelimit', 'shopcart', 'message', 'remind', 'service', 'shop', 'sweep', 'express', 'payment', 'search', 'feedback', 'pencil', 'setting', 'refund', 'delete', 'star', 'heart', 'share', 'location', 'console'] const localSVGIcons = ['vomiting', 'smirking', 'surprised', 'unamused', 'zombie', 'tired', 'tongue', 'wink'] const localRequireSVGIcons = [ require('../../../svg/cute/congratulations.svg'), require('../../../svg/cute/cry.svg'), require('../../../svg/cute/kiss.svg'), require('../../../svg/cute/leisurely.svg'), require('../../../svg/cute/notice.svg'), require('../../../svg/cute/proud.svg'), require('../../../svg/cute/shy.svg'), require('../../../svg/cute/sweat.svg'), require('../../../svg/cute/think.svg'), ] const IcoPage = () => <div className="content-inner"> <Icon type="star-oo" /> <h2 style={{ margin: '16px 0' }}>Colorful Icon</h2> <ul className={styles.list}> {colorfulIcons.map(item => <li key={item}> <Iconfont className={styles.icon} colorful type={item} /> <span className={styles.name}>{item}</span> </li>)} </ul> <h2 style={{ margin: '16px 0' }}>Flat Icon</h2> <ul className={styles.list}> {flatIcons.map(item => <li key={item}> <Iconfont className={styles.icon} type={item} /> <span className={styles.name}>{item}</span> </li>)} </ul> <h2 style={{ margin: '16px 0' }}>Local SVG</h2> <ul className={styles.list}> {localSVGIcons.map(item => <li key={item}> <Iconfont className={styles.icon} colorful type={item} /> <span className={styles.name}>{item}</span> </li>)} </ul> <h2 style={{ margin: '16px 0' }}>Local Require SVG</h2> <ul className={styles.list}> {localRequireSVGIcons.map(item => <li key={item}> <Iconfont className={styles.icon} colorful type={item} /> <span className={styles.name}>{item}</span> </li>)} </ul> <h2 style={{ margin: '16px 0' }}>API</h2> <Row> <Col lg={18} md={24}> <Table rowKey={(record, key) => key} pagination={false} bordered scroll={{ x: 800 }} columns={[ { title: 'Property', dataIndex: 'props', }, { title: 'Description', dataIndex: 'desciption', }, { title: 'Type', dataIndex: 'type', }, { title: 'Default', dataIndex: 'default', }, ]} dataSource={[ { props: 'type', desciption: 'icon type', type: 'String', default: '-', }, { props: 'colorful', desciption: "to set the SVG has 'symbol element'", type: 'Bool', default: 'false', }]} /> </Col> </Row> <h2 style={{ margin: '16px 0' }}>Thanks</h2> <div style={{ margin: '16px 0', lineHeight: 2 }}> <p> <a href="http://www.iconfont.cn/user/detail?uid=116813">何阿酥</a> colorful fruit icon <a href="http://www.iconfont.cn/collections/detail?cid=4014" target="_blank"> http://www.iconfont.cn/collections/detail?cid=4014</a> </p> <p> <a href="http://www.iconfont.cn/user/detail?uid=496384">ColinXu</a> colorful 'tsundere' emoji icon <a href="http://www.iconfont.cn/collections/detail?cid=4116" target="_blank"> http://www.iconfont.cn/collections/detail?cid=4116</a> </p> <p> <a href="http://www.iconfont.cn/user/detail?uid=116813">咕噜小莫莫</a> colorful 'face cute' emoji icon <a href="http://www.iconfont.cn/collections/detail?cid=4268" target="_blank"> http://www.iconfont.cn/collections/detail?cid=4268</a> </p> </div> </div> export default IcoPage
src/js/components/icons/base/DocumentUpload.js
odedre/grommet-final
/** * @description DocumentUpload SVG Icon. * @property {string} a11yTitle - Accessibility Title. If not set uses the default title of the status icon. * @property {string} colorIndex - The color identifier to use for the stroke color. * If not specified, this component will default to muiTheme.palette.textColor. * @property {xsmall|small|medium|large|xlarge|huge} size - The icon size. Defaults to small. * @property {boolean} responsive - Allows you to redefine what the coordinates. * @example * <svg width="24" height="24" ><path d="M2.99787498,0.999999992 L17.4999998,0.999999992 L20.9999998,4.50000005 L21,23 L3,23 L2.99787498,0.999999992 Z M16,1 L16,6 L21,6 M12,20 L12,11 M8,14 L12,10 L16,14"/></svg> */ // (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import CSSClassnames from '../../../utils/CSSClassnames'; import Intl from '../../../utils/Intl'; import Props from '../../../utils/Props'; const CLASS_ROOT = CSSClassnames.CONTROL_ICON; const COLOR_INDEX = CSSClassnames.COLOR_INDEX; export default class Icon extends Component { render () { const { className, colorIndex } = this.props; let { a11yTitle, size, responsive } = this.props; let { intl } = this.context; const classes = classnames( CLASS_ROOT, `${CLASS_ROOT}-document-upload`, className, { [`${CLASS_ROOT}--${size}`]: size, [`${CLASS_ROOT}--responsive`]: responsive, [`${COLOR_INDEX}-${colorIndex}`]: colorIndex } ); a11yTitle = a11yTitle || Intl.getMessage(intl, 'document-upload'); const restProps = Props.omit(this.props, Object.keys(Icon.propTypes)); return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000" strokeWidth="2" d="M2.99787498,0.999999992 L17.4999998,0.999999992 L20.9999998,4.50000005 L21,23 L3,23 L2.99787498,0.999999992 Z M16,1 L16,6 L21,6 M12,20 L12,11 M8,14 L12,10 L16,14"/></svg>; } }; Icon.contextTypes = { intl: PropTypes.object }; Icon.defaultProps = { responsive: true }; Icon.displayName = 'DocumentUpload'; Icon.icon = true; Icon.propTypes = { a11yTitle: PropTypes.string, colorIndex: PropTypes.string, size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']), responsive: PropTypes.bool };
node_modules/react-bootstrap/es/ListGroupItem.js
lucketta/got-quote-generator
import _Object$values from 'babel-runtime/core-js/object/values'; import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import React, { cloneElement } from 'react'; import PropTypes from 'prop-types'; import { bsClass, bsStyles, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils'; import { State } from './utils/StyleConfig'; var propTypes = { active: PropTypes.any, disabled: PropTypes.any, header: PropTypes.node, listItem: PropTypes.bool, onClick: PropTypes.func, href: PropTypes.string, type: PropTypes.string }; var defaultProps = { listItem: false }; var ListGroupItem = function (_React$Component) { _inherits(ListGroupItem, _React$Component); function ListGroupItem() { _classCallCheck(this, ListGroupItem); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } ListGroupItem.prototype.renderHeader = function renderHeader(header, headingClassName) { if (React.isValidElement(header)) { return cloneElement(header, { className: classNames(header.props.className, headingClassName) }); } return React.createElement( 'h4', { className: headingClassName }, header ); }; ListGroupItem.prototype.render = function render() { var _props = this.props, active = _props.active, disabled = _props.disabled, className = _props.className, header = _props.header, listItem = _props.listItem, children = _props.children, props = _objectWithoutProperties(_props, ['active', 'disabled', 'className', 'header', 'listItem', 'children']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = _extends({}, getClassSet(bsProps), { active: active, disabled: disabled }); var Component = void 0; if (elementProps.href) { Component = 'a'; } else if (elementProps.onClick) { Component = 'button'; elementProps.type = elementProps.type || 'button'; } else if (listItem) { Component = 'li'; } else { Component = 'span'; } elementProps.className = classNames(className, classes); // TODO: Deprecate `header` prop. if (header) { return React.createElement( Component, elementProps, this.renderHeader(header, prefix(bsProps, 'heading')), React.createElement( 'p', { className: prefix(bsProps, 'text') }, children ) ); } return React.createElement( Component, elementProps, children ); }; return ListGroupItem; }(React.Component); ListGroupItem.propTypes = propTypes; ListGroupItem.defaultProps = defaultProps; export default bsClass('list-group-item', bsStyles(_Object$values(State), ListGroupItem));
config/shims/assetInserter/schema.js
Kalcode/Gatsby-Boilerplate
import React from 'react' import config from 'config' export default function Schema(props) { return ( <script key='schema-script' type='application/ld+json' dangerouslySetInnerHTML={{__html: JSON.stringify({ '@context': 'http://schema.org', '@type': 'Organization', 'address': { '@type': 'PostalAddress', 'addressLocality': config.address.city, 'addressRegion': config.address.state, 'postalCode': config.address.zipcode, 'streetAddress': config.address.street, 'addressCountry': config.address.country, 'areaServed': config.address.area, 'telephone': config.phone, }, 'email': config.email, 'logo': config.logo, 'name': config.name, 'legalName': config.legal_name, 'url': config.url, })}} /> ) }
node_modules/material-ui/svg-icons/image/camera-roll.js
SerendpityZOEY/Solr-Search-React-UI
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _pure = require('recompose/pure'); var _pure2 = _interopRequireDefault(_pure); var _SvgIcon = require('../../SvgIcon'); var _SvgIcon2 = _interopRequireDefault(_SvgIcon); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var ImageCameraRoll = function ImageCameraRoll(props) { return _react2.default.createElement( _SvgIcon2.default, props, _react2.default.createElement('path', { d: 'M14 5c0-1.1-.9-2-2-2h-1V2c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v1H4c-1.1 0-2 .9-2 2v15c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2h8V5h-8zm-2 13h-2v-2h2v2zm0-9h-2V7h2v2zm4 9h-2v-2h2v2zm0-9h-2V7h2v2zm4 9h-2v-2h2v2zm0-9h-2V7h2v2z' }) ); }; ImageCameraRoll = (0, _pure2.default)(ImageCameraRoll); ImageCameraRoll.displayName = 'ImageCameraRoll'; ImageCameraRoll.muiName = 'SvgIcon'; exports.default = ImageCameraRoll;
ajax/libs/yui/2.9.0/container/container.js
ProfNandaa/cdnjs
/* Copyright (c) 2011, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html version: 2.9.0 */ (function () { /** * Config is a utility used within an Object to allow the implementer to * maintain a list of local configuration properties and listen for changes * to those properties dynamically using CustomEvent. The initial values are * also maintained so that the configuration can be reset at any given point * to its initial state. * @namespace YAHOO.util * @class Config * @constructor * @param {Object} owner The owner Object to which this Config Object belongs */ YAHOO.util.Config = function (owner) { if (owner) { this.init(owner); } }; var Lang = YAHOO.lang, CustomEvent = YAHOO.util.CustomEvent, Config = YAHOO.util.Config; /** * Constant representing the CustomEvent type for the config changed event. * @property YAHOO.util.Config.CONFIG_CHANGED_EVENT * @private * @static * @final */ Config.CONFIG_CHANGED_EVENT = "configChanged"; /** * Constant representing the boolean type string * @property YAHOO.util.Config.BOOLEAN_TYPE * @private * @static * @final */ Config.BOOLEAN_TYPE = "boolean"; Config.prototype = { /** * Object reference to the owner of this Config Object * @property owner * @type Object */ owner: null, /** * Boolean flag that specifies whether a queue is currently * being executed * @property queueInProgress * @type Boolean */ queueInProgress: false, /** * Maintains the local collection of configuration property objects and * their specified values * @property config * @private * @type Object */ config: null, /** * Maintains the local collection of configuration property objects as * they were initially applied. * This object is used when resetting a property. * @property initialConfig * @private * @type Object */ initialConfig: null, /** * Maintains the local, normalized CustomEvent queue * @property eventQueue * @private * @type Object */ eventQueue: null, /** * Custom Event, notifying subscribers when Config properties are set * (setProperty is called without the silent flag * @event configChangedEvent */ configChangedEvent: null, /** * Initializes the configuration Object and all of its local members. * @method init * @param {Object} owner The owner Object to which this Config * Object belongs */ init: function (owner) { this.owner = owner; this.configChangedEvent = this.createEvent(Config.CONFIG_CHANGED_EVENT); this.configChangedEvent.signature = CustomEvent.LIST; this.queueInProgress = false; this.config = {}; this.initialConfig = {}; this.eventQueue = []; }, /** * Validates that the value passed in is a Boolean. * @method checkBoolean * @param {Object} val The value to validate * @return {Boolean} true, if the value is valid */ checkBoolean: function (val) { return (typeof val == Config.BOOLEAN_TYPE); }, /** * Validates that the value passed in is a number. * @method checkNumber * @param {Object} val The value to validate * @return {Boolean} true, if the value is valid */ checkNumber: function (val) { return (!isNaN(val)); }, /** * Fires a configuration property event using the specified value. * @method fireEvent * @private * @param {String} key The configuration property's name * @param {value} Object The value of the correct type for the property */ fireEvent: function ( key, value ) { var property = this.config[key]; if (property && property.event) { property.event.fire(value); } }, /** * Adds a property to the Config Object's private config hash. * @method addProperty * @param {String} key The configuration property's name * @param {Object} propertyObject The Object containing all of this * property's arguments */ addProperty: function ( key, propertyObject ) { key = key.toLowerCase(); this.config[key] = propertyObject; propertyObject.event = this.createEvent(key, { scope: this.owner }); propertyObject.event.signature = CustomEvent.LIST; propertyObject.key = key; if (propertyObject.handler) { propertyObject.event.subscribe(propertyObject.handler, this.owner); } this.setProperty(key, propertyObject.value, true); if (! propertyObject.suppressEvent) { this.queueProperty(key, propertyObject.value); } }, /** * Returns a key-value configuration map of the values currently set in * the Config Object. * @method getConfig * @return {Object} The current config, represented in a key-value map */ getConfig: function () { var cfg = {}, currCfg = this.config, prop, property; for (prop in currCfg) { if (Lang.hasOwnProperty(currCfg, prop)) { property = currCfg[prop]; if (property && property.event) { cfg[prop] = property.value; } } } return cfg; }, /** * Returns the value of specified property. * @method getProperty * @param {String} key The name of the property * @return {Object} The value of the specified property */ getProperty: function (key) { var property = this.config[key.toLowerCase()]; if (property && property.event) { return property.value; } else { return undefined; } }, /** * Resets the specified property's value to its initial value. * @method resetProperty * @param {String} key The name of the property * @return {Boolean} True is the property was reset, false if not */ resetProperty: function (key) { key = key.toLowerCase(); var property = this.config[key]; if (property && property.event) { if (key in this.initialConfig) { this.setProperty(key, this.initialConfig[key]); return true; } } else { return false; } }, /** * Sets the value of a property. If the silent property is passed as * true, the property's event will not be fired. * @method setProperty * @param {String} key The name of the property * @param {String} value The value to set the property to * @param {Boolean} silent Whether the value should be set silently, * without firing the property event. * @return {Boolean} True, if the set was successful, false if it failed. */ setProperty: function (key, value, silent) { var property; key = key.toLowerCase(); if (this.queueInProgress && ! silent) { // Currently running through a queue... this.queueProperty(key,value); return true; } else { property = this.config[key]; if (property && property.event) { if (property.validator && !property.validator(value)) { return false; } else { property.value = value; if (! silent) { this.fireEvent(key, value); this.configChangedEvent.fire([key, value]); } return true; } } else { return false; } } }, /** * Sets the value of a property and queues its event to execute. If the * event is already scheduled to execute, it is * moved from its current position to the end of the queue. * @method queueProperty * @param {String} key The name of the property * @param {String} value The value to set the property to * @return {Boolean} true, if the set was successful, false if * it failed. */ queueProperty: function (key, value) { key = key.toLowerCase(); var property = this.config[key], foundDuplicate = false, iLen, queueItem, queueItemKey, queueItemValue, sLen, supercedesCheck, qLen, queueItemCheck, queueItemCheckKey, queueItemCheckValue, i, s, q; if (property && property.event) { if (!Lang.isUndefined(value) && property.validator && !property.validator(value)) { // validator return false; } else { if (!Lang.isUndefined(value)) { property.value = value; } else { value = property.value; } foundDuplicate = false; iLen = this.eventQueue.length; for (i = 0; i < iLen; i++) { queueItem = this.eventQueue[i]; if (queueItem) { queueItemKey = queueItem[0]; queueItemValue = queueItem[1]; if (queueItemKey == key) { /* found a dupe... push to end of queue, null current item, and break */ this.eventQueue[i] = null; this.eventQueue.push( [key, (!Lang.isUndefined(value) ? value : queueItemValue)]); foundDuplicate = true; break; } } } // this is a refire, or a new property in the queue if (! foundDuplicate && !Lang.isUndefined(value)) { this.eventQueue.push([key, value]); } } if (property.supercedes) { sLen = property.supercedes.length; for (s = 0; s < sLen; s++) { supercedesCheck = property.supercedes[s]; qLen = this.eventQueue.length; for (q = 0; q < qLen; q++) { queueItemCheck = this.eventQueue[q]; if (queueItemCheck) { queueItemCheckKey = queueItemCheck[0]; queueItemCheckValue = queueItemCheck[1]; if (queueItemCheckKey == supercedesCheck.toLowerCase() ) { this.eventQueue.push([queueItemCheckKey, queueItemCheckValue]); this.eventQueue[q] = null; break; } } } } } return true; } else { return false; } }, /** * Fires the event for a property using the property's current value. * @method refireEvent * @param {String} key The name of the property */ refireEvent: function (key) { key = key.toLowerCase(); var property = this.config[key]; if (property && property.event && !Lang.isUndefined(property.value)) { if (this.queueInProgress) { this.queueProperty(key); } else { this.fireEvent(key, property.value); } } }, /** * Applies a key-value Object literal to the configuration, replacing * any existing values, and queueing the property events. * Although the values will be set, fireQueue() must be called for their * associated events to execute. * @method applyConfig * @param {Object} userConfig The configuration Object literal * @param {Boolean} init When set to true, the initialConfig will * be set to the userConfig passed in, so that calling a reset will * reset the properties to the passed values. */ applyConfig: function (userConfig, init) { var sKey, oConfig; if (init) { oConfig = {}; for (sKey in userConfig) { if (Lang.hasOwnProperty(userConfig, sKey)) { oConfig[sKey.toLowerCase()] = userConfig[sKey]; } } this.initialConfig = oConfig; } for (sKey in userConfig) { if (Lang.hasOwnProperty(userConfig, sKey)) { this.queueProperty(sKey, userConfig[sKey]); } } }, /** * Refires the events for all configuration properties using their * current values. * @method refresh */ refresh: function () { var prop; for (prop in this.config) { if (Lang.hasOwnProperty(this.config, prop)) { this.refireEvent(prop); } } }, /** * Fires the normalized list of queued property change events * @method fireQueue */ fireQueue: function () { var i, queueItem, key, value, property; this.queueInProgress = true; for (i = 0;i < this.eventQueue.length; i++) { queueItem = this.eventQueue[i]; if (queueItem) { key = queueItem[0]; value = queueItem[1]; property = this.config[key]; property.value = value; // Clear out queue entry, to avoid it being // re-added to the queue by any queueProperty/supercedes // calls which are invoked during fireEvent this.eventQueue[i] = null; this.fireEvent(key,value); } } this.queueInProgress = false; this.eventQueue = []; }, /** * Subscribes an external handler to the change event for any * given property. * @method subscribeToConfigEvent * @param {String} key The property name * @param {Function} handler The handler function to use subscribe to * the property's event * @param {Object} obj The Object to use for scoping the event handler * (see CustomEvent documentation) * @param {Boolean} overrideContext Optional. If true, will override * "this" within the handler to map to the scope Object passed into the * method. * @return {Boolean} True, if the subscription was successful, * otherwise false. */ subscribeToConfigEvent: function (key, handler, obj, overrideContext) { var property = this.config[key.toLowerCase()]; if (property && property.event) { if (!Config.alreadySubscribed(property.event, handler, obj)) { property.event.subscribe(handler, obj, overrideContext); } return true; } else { return false; } }, /** * Unsubscribes an external handler from the change event for any * given property. * @method unsubscribeFromConfigEvent * @param {String} key The property name * @param {Function} handler The handler function to use subscribe to * the property's event * @param {Object} obj The Object to use for scoping the event * handler (see CustomEvent documentation) * @return {Boolean} True, if the unsubscription was successful, * otherwise false. */ unsubscribeFromConfigEvent: function (key, handler, obj) { var property = this.config[key.toLowerCase()]; if (property && property.event) { return property.event.unsubscribe(handler, obj); } else { return false; } }, /** * Returns a string representation of the Config object * @method toString * @return {String} The Config object in string format. */ toString: function () { var output = "Config"; if (this.owner) { output += " [" + this.owner.toString() + "]"; } return output; }, /** * Returns a string representation of the Config object's current * CustomEvent queue * @method outputEventQueue * @return {String} The string list of CustomEvents currently queued * for execution */ outputEventQueue: function () { var output = "", queueItem, q, nQueue = this.eventQueue.length; for (q = 0; q < nQueue; q++) { queueItem = this.eventQueue[q]; if (queueItem) { output += queueItem[0] + "=" + queueItem[1] + ", "; } } return output; }, /** * Sets all properties to null, unsubscribes all listeners from each * property's change event and all listeners from the configChangedEvent. * @method destroy */ destroy: function () { var oConfig = this.config, sProperty, oProperty; for (sProperty in oConfig) { if (Lang.hasOwnProperty(oConfig, sProperty)) { oProperty = oConfig[sProperty]; oProperty.event.unsubscribeAll(); oProperty.event = null; } } this.configChangedEvent.unsubscribeAll(); this.configChangedEvent = null; this.owner = null; this.config = null; this.initialConfig = null; this.eventQueue = null; } }; /** * Checks to determine if a particular function/Object pair are already * subscribed to the specified CustomEvent * @method YAHOO.util.Config.alreadySubscribed * @static * @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check * the subscriptions * @param {Function} fn The function to look for in the subscribers list * @param {Object} obj The execution scope Object for the subscription * @return {Boolean} true, if the function/Object pair is already subscribed * to the CustomEvent passed in */ Config.alreadySubscribed = function (evt, fn, obj) { var nSubscribers = evt.subscribers.length, subsc, i; if (nSubscribers > 0) { i = nSubscribers - 1; do { subsc = evt.subscribers[i]; if (subsc && subsc.obj == obj && subsc.fn == fn) { return true; } } while (i--); } return false; }; YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider); }()); (function () { /** * The Container family of components is designed to enable developers to * create different kinds of content-containing modules on the web. Module * and Overlay are the most basic containers, and they can be used directly * or extended to build custom containers. Also part of the Container family * are four UI controls that extend Module and Overlay: Tooltip, Panel, * Dialog, and SimpleDialog. * @module container * @title Container * @requires yahoo, dom, event * @optional dragdrop, animation, button */ /** * Module is a JavaScript representation of the Standard Module Format. * Standard Module Format is a simple standard for markup containers where * child nodes representing the header, body, and footer of the content are * denoted using the CSS classes "hd", "bd", and "ft" respectively. * Module is the base class for all other classes in the YUI * Container package. * @namespace YAHOO.widget * @class Module * @constructor * @param {String} el The element ID representing the Module <em>OR</em> * @param {HTMLElement} el The element representing the Module * @param {Object} userConfig The configuration Object literal containing * the configuration that should be set for this module. See configuration * documentation for more details. */ YAHOO.widget.Module = function (el, userConfig) { if (el) { this.init(el, userConfig); } else { } }; var Dom = YAHOO.util.Dom, Config = YAHOO.util.Config, Event = YAHOO.util.Event, CustomEvent = YAHOO.util.CustomEvent, Module = YAHOO.widget.Module, UA = YAHOO.env.ua, m_oModuleTemplate, m_oHeaderTemplate, m_oBodyTemplate, m_oFooterTemplate, /** * Constant representing the name of the Module's events * @property EVENT_TYPES * @private * @final * @type Object */ EVENT_TYPES = { "BEFORE_INIT": "beforeInit", "INIT": "init", "APPEND": "append", "BEFORE_RENDER": "beforeRender", "RENDER": "render", "CHANGE_HEADER": "changeHeader", "CHANGE_BODY": "changeBody", "CHANGE_FOOTER": "changeFooter", "CHANGE_CONTENT": "changeContent", "DESTROY": "destroy", "BEFORE_SHOW": "beforeShow", "SHOW": "show", "BEFORE_HIDE": "beforeHide", "HIDE": "hide" }, /** * Constant representing the Module's configuration properties * @property DEFAULT_CONFIG * @private * @final * @type Object */ DEFAULT_CONFIG = { "VISIBLE": { key: "visible", value: true, validator: YAHOO.lang.isBoolean }, "EFFECT": { key: "effect", suppressEvent: true, supercedes: ["visible"] }, "MONITOR_RESIZE": { key: "monitorresize", value: true }, "APPEND_TO_DOCUMENT_BODY": { key: "appendtodocumentbody", value: false } }; /** * Constant representing the prefix path to use for non-secure images * @property YAHOO.widget.Module.IMG_ROOT * @static * @final * @type String */ Module.IMG_ROOT = null; /** * Constant representing the prefix path to use for securely served images * @property YAHOO.widget.Module.IMG_ROOT_SSL * @static * @final * @type String */ Module.IMG_ROOT_SSL = null; /** * Constant for the default CSS class name that represents a Module * @property YAHOO.widget.Module.CSS_MODULE * @static * @final * @type String */ Module.CSS_MODULE = "yui-module"; /** * CSS classname representing the module header. NOTE: The classname is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source. * @property YAHOO.widget.Module.CSS_HEADER * @static * @final * @type String */ Module.CSS_HEADER = "hd"; /** * CSS classname representing the module body. NOTE: The classname is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source. * @property YAHOO.widget.Module.CSS_BODY * @static * @final * @type String */ Module.CSS_BODY = "bd"; /** * CSS classname representing the module footer. NOTE: The classname is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source. * @property YAHOO.widget.Module.CSS_FOOTER * @static * @final * @type String */ Module.CSS_FOOTER = "ft"; /** * Constant representing the url for the "src" attribute of the iframe * used to monitor changes to the browser's base font size * @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL * @static * @final * @type String */ Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;"; /** * Constant representing the buffer amount (in pixels) to use when positioning * the text resize monitor offscreen. The resize monitor is positioned * offscreen by an amount eqaul to its offsetHeight + the buffer value. * * @property YAHOO.widget.Module.RESIZE_MONITOR_BUFFER * @static * @type Number */ // Set to 1, to work around pixel offset in IE8, which increases when zoom is used Module.RESIZE_MONITOR_BUFFER = 1; /** * Singleton CustomEvent fired when the font size is changed in the browser. * Opera's "zoom" functionality currently does not support text * size detection. * @event YAHOO.widget.Module.textResizeEvent */ Module.textResizeEvent = new CustomEvent("textResize"); /** * Helper utility method, which forces a document level * redraw for Opera, which can help remove repaint * irregularities after applying DOM changes. * * @method YAHOO.widget.Module.forceDocumentRedraw * @static */ Module.forceDocumentRedraw = function() { var docEl = document.documentElement; if (docEl) { docEl.className += " "; docEl.className = YAHOO.lang.trim(docEl.className); } }; function createModuleTemplate() { if (!m_oModuleTemplate) { m_oModuleTemplate = document.createElement("div"); m_oModuleTemplate.innerHTML = ("<div class=\"" + Module.CSS_HEADER + "\"></div>" + "<div class=\"" + Module.CSS_BODY + "\"></div><div class=\"" + Module.CSS_FOOTER + "\"></div>"); m_oHeaderTemplate = m_oModuleTemplate.firstChild; m_oBodyTemplate = m_oHeaderTemplate.nextSibling; m_oFooterTemplate = m_oBodyTemplate.nextSibling; } return m_oModuleTemplate; } function createHeader() { if (!m_oHeaderTemplate) { createModuleTemplate(); } return (m_oHeaderTemplate.cloneNode(false)); } function createBody() { if (!m_oBodyTemplate) { createModuleTemplate(); } return (m_oBodyTemplate.cloneNode(false)); } function createFooter() { if (!m_oFooterTemplate) { createModuleTemplate(); } return (m_oFooterTemplate.cloneNode(false)); } Module.prototype = { /** * The class's constructor function * @property contructor * @type Function */ constructor: Module, /** * The main module element that contains the header, body, and footer * @property element * @type HTMLElement */ element: null, /** * The header element, denoted with CSS class "hd" * @property header * @type HTMLElement */ header: null, /** * The body element, denoted with CSS class "bd" * @property body * @type HTMLElement */ body: null, /** * The footer element, denoted with CSS class "ft" * @property footer * @type HTMLElement */ footer: null, /** * The id of the element * @property id * @type String */ id: null, /** * A string representing the root path for all images created by * a Module instance. * @deprecated It is recommend that any images for a Module be applied * via CSS using the "background-image" property. * @property imageRoot * @type String */ imageRoot: Module.IMG_ROOT, /** * Initializes the custom events for Module which are fired * automatically at appropriate times by the Module class. * @method initEvents */ initEvents: function () { var SIGNATURE = CustomEvent.LIST; /** * CustomEvent fired prior to class initalization. * @event beforeInitEvent * @param {class} classRef class reference of the initializing * class, such as this.beforeInitEvent.fire(Module) */ this.beforeInitEvent = this.createEvent(EVENT_TYPES.BEFORE_INIT); this.beforeInitEvent.signature = SIGNATURE; /** * CustomEvent fired after class initalization. * @event initEvent * @param {class} classRef class reference of the initializing * class, such as this.beforeInitEvent.fire(Module) */ this.initEvent = this.createEvent(EVENT_TYPES.INIT); this.initEvent.signature = SIGNATURE; /** * CustomEvent fired when the Module is appended to the DOM * @event appendEvent */ this.appendEvent = this.createEvent(EVENT_TYPES.APPEND); this.appendEvent.signature = SIGNATURE; /** * CustomEvent fired before the Module is rendered * @event beforeRenderEvent */ this.beforeRenderEvent = this.createEvent(EVENT_TYPES.BEFORE_RENDER); this.beforeRenderEvent.signature = SIGNATURE; /** * CustomEvent fired after the Module is rendered * @event renderEvent */ this.renderEvent = this.createEvent(EVENT_TYPES.RENDER); this.renderEvent.signature = SIGNATURE; /** * CustomEvent fired when the header content of the Module * is modified * @event changeHeaderEvent * @param {String/HTMLElement} content String/element representing * the new header content */ this.changeHeaderEvent = this.createEvent(EVENT_TYPES.CHANGE_HEADER); this.changeHeaderEvent.signature = SIGNATURE; /** * CustomEvent fired when the body content of the Module is modified * @event changeBodyEvent * @param {String/HTMLElement} content String/element representing * the new body content */ this.changeBodyEvent = this.createEvent(EVENT_TYPES.CHANGE_BODY); this.changeBodyEvent.signature = SIGNATURE; /** * CustomEvent fired when the footer content of the Module * is modified * @event changeFooterEvent * @param {String/HTMLElement} content String/element representing * the new footer content */ this.changeFooterEvent = this.createEvent(EVENT_TYPES.CHANGE_FOOTER); this.changeFooterEvent.signature = SIGNATURE; /** * CustomEvent fired when the content of the Module is modified * @event changeContentEvent */ this.changeContentEvent = this.createEvent(EVENT_TYPES.CHANGE_CONTENT); this.changeContentEvent.signature = SIGNATURE; /** * CustomEvent fired when the Module is destroyed * @event destroyEvent */ this.destroyEvent = this.createEvent(EVENT_TYPES.DESTROY); this.destroyEvent.signature = SIGNATURE; /** * CustomEvent fired before the Module is shown * @event beforeShowEvent */ this.beforeShowEvent = this.createEvent(EVENT_TYPES.BEFORE_SHOW); this.beforeShowEvent.signature = SIGNATURE; /** * CustomEvent fired after the Module is shown * @event showEvent */ this.showEvent = this.createEvent(EVENT_TYPES.SHOW); this.showEvent.signature = SIGNATURE; /** * CustomEvent fired before the Module is hidden * @event beforeHideEvent */ this.beforeHideEvent = this.createEvent(EVENT_TYPES.BEFORE_HIDE); this.beforeHideEvent.signature = SIGNATURE; /** * CustomEvent fired after the Module is hidden * @event hideEvent */ this.hideEvent = this.createEvent(EVENT_TYPES.HIDE); this.hideEvent.signature = SIGNATURE; }, /** * String identifying whether the current platform is windows or mac. This property * currently only identifies these 2 platforms, and returns false otherwise. * @property platform * @deprecated Use YAHOO.env.ua * @type {String|Boolean} */ platform: function () { var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) { return "windows"; } else if (ua.indexOf("macintosh") != -1) { return "mac"; } else { return false; } }(), /** * String representing the user-agent of the browser * @deprecated Use YAHOO.env.ua * @property browser * @type {String|Boolean} */ browser: function () { var ua = navigator.userAgent.toLowerCase(); /* Check Opera first in case of spoof and check Safari before Gecko since Safari's user agent string includes "like Gecko" */ if (ua.indexOf('opera') != -1) { return 'opera'; } else if (ua.indexOf('msie 7') != -1) { return 'ie7'; } else if (ua.indexOf('msie') != -1) { return 'ie'; } else if (ua.indexOf('safari') != -1) { return 'safari'; } else if (ua.indexOf('gecko') != -1) { return 'gecko'; } else { return false; } }(), /** * Boolean representing whether or not the current browsing context is * secure (https) * @property isSecure * @type Boolean */ isSecure: function () { if (window.location.href.toLowerCase().indexOf("https") === 0) { return true; } else { return false; } }(), /** * Initializes the custom events for Module which are fired * automatically at appropriate times by the Module class. */ initDefaultConfig: function () { // Add properties // /** * Specifies whether the Module is visible on the page. * @config visible * @type Boolean * @default true */ this.cfg.addProperty(DEFAULT_CONFIG.VISIBLE.key, { handler: this.configVisible, value: DEFAULT_CONFIG.VISIBLE.value, validator: DEFAULT_CONFIG.VISIBLE.validator }); /** * <p> * Object or array of objects representing the ContainerEffect * classes that are active for animating the container. * </p> * <p> * <strong>NOTE:</strong> Although this configuration * property is introduced at the Module level, an out of the box * implementation is not shipped for the Module class so setting * the proroperty on the Module class has no effect. The Overlay * class is the first class to provide out of the box ContainerEffect * support. * </p> * @config effect * @type Object * @default null */ this.cfg.addProperty(DEFAULT_CONFIG.EFFECT.key, { handler: this.configEffect, suppressEvent: DEFAULT_CONFIG.EFFECT.suppressEvent, supercedes: DEFAULT_CONFIG.EFFECT.supercedes }); /** * Specifies whether to create a special proxy iframe to monitor * for user font resizing in the document * @config monitorresize * @type Boolean * @default true */ this.cfg.addProperty(DEFAULT_CONFIG.MONITOR_RESIZE.key, { handler: this.configMonitorResize, value: DEFAULT_CONFIG.MONITOR_RESIZE.value }); /** * Specifies if the module should be rendered as the first child * of document.body or appended as the last child when render is called * with document.body as the "appendToNode". * <p> * Appending to the body while the DOM is still being constructed can * lead to Operation Aborted errors in IE hence this flag is set to * false by default. * </p> * * @config appendtodocumentbody * @type Boolean * @default false */ this.cfg.addProperty(DEFAULT_CONFIG.APPEND_TO_DOCUMENT_BODY.key, { value: DEFAULT_CONFIG.APPEND_TO_DOCUMENT_BODY.value }); }, /** * The Module class's initialization method, which is executed for * Module and all of its subclasses. This method is automatically * called by the constructor, and sets up all DOM references for * pre-existing markup, and creates required markup if it is not * already present. * <p> * If the element passed in does not have an id, one will be generated * for it. * </p> * @method init * @param {String} el The element ID representing the Module <em>OR</em> * @param {HTMLElement} el The element representing the Module * @param {Object} userConfig The configuration Object literal * containing the configuration that should be set for this module. * See configuration documentation for more details. */ init: function (el, userConfig) { var elId, child; this.initEvents(); this.beforeInitEvent.fire(Module); /** * The Module's Config object used for monitoring * configuration properties. * @property cfg * @type YAHOO.util.Config */ this.cfg = new Config(this); if (this.isSecure) { this.imageRoot = Module.IMG_ROOT_SSL; } if (typeof el == "string") { elId = el; el = document.getElementById(el); if (! el) { el = (createModuleTemplate()).cloneNode(false); el.id = elId; } } this.id = Dom.generateId(el); this.element = el; child = this.element.firstChild; if (child) { var fndHd = false, fndBd = false, fndFt = false; do { // We're looking for elements if (1 == child.nodeType) { if (!fndHd && Dom.hasClass(child, Module.CSS_HEADER)) { this.header = child; fndHd = true; } else if (!fndBd && Dom.hasClass(child, Module.CSS_BODY)) { this.body = child; fndBd = true; } else if (!fndFt && Dom.hasClass(child, Module.CSS_FOOTER)){ this.footer = child; fndFt = true; } } } while ((child = child.nextSibling)); } this.initDefaultConfig(); Dom.addClass(this.element, Module.CSS_MODULE); if (userConfig) { this.cfg.applyConfig(userConfig, true); } /* Subscribe to the fireQueue() method of Config so that any queued configuration changes are excecuted upon render of the Module */ if (!Config.alreadySubscribed(this.renderEvent, this.cfg.fireQueue, this.cfg)) { this.renderEvent.subscribe(this.cfg.fireQueue, this.cfg, true); } this.initEvent.fire(Module); }, /** * Initialize an empty IFRAME that is placed out of the visible area * that can be used to detect text resize. * @method initResizeMonitor */ initResizeMonitor: function () { var isGeckoWin = (UA.gecko && this.platform == "windows"); if (isGeckoWin) { // Help prevent spinning loading icon which // started with FireFox 2.0.0.8/Win var self = this; setTimeout(function(){self._initResizeMonitor();}, 0); } else { this._initResizeMonitor(); } }, /** * Create and initialize the text resize monitoring iframe. * * @protected * @method _initResizeMonitor */ _initResizeMonitor : function() { var oDoc, oIFrame, sHTML; function fireTextResize() { Module.textResizeEvent.fire(); } if (!UA.opera) { oIFrame = Dom.get("_yuiResizeMonitor"); var supportsCWResize = this._supportsCWResize(); if (!oIFrame) { oIFrame = document.createElement("iframe"); if (this.isSecure && Module.RESIZE_MONITOR_SECURE_URL && UA.ie) { oIFrame.src = Module.RESIZE_MONITOR_SECURE_URL; } if (!supportsCWResize) { // Can't monitor on contentWindow, so fire from inside iframe sHTML = ["<html><head><script ", "type=\"text/javascript\">", "window.onresize=function(){window.parent.", "YAHOO.widget.Module.textResizeEvent.", "fire();};<", "\/script></head>", "<body></body></html>"].join(''); oIFrame.src = "data:text/html;charset=utf-8," + encodeURIComponent(sHTML); } oIFrame.id = "_yuiResizeMonitor"; oIFrame.title = "Text Resize Monitor"; oIFrame.tabIndex = -1; oIFrame.setAttribute("role", "presentation"); /* Need to set "position" property before inserting the iframe into the document or Safari's status bar will forever indicate the iframe is loading (See YUILibrary bug #1723064) */ oIFrame.style.position = "absolute"; oIFrame.style.visibility = "hidden"; var db = document.body, fc = db.firstChild; if (fc) { db.insertBefore(oIFrame, fc); } else { db.appendChild(oIFrame); } // Setting the background color fixes an issue with IE6/IE7, where // elements in the DOM, with -ve margin-top which positioned them // offscreen (so they would be overlapped by the iframe and its -ve top // setting), would have their -ve margin-top ignored, when the iframe // was added. oIFrame.style.backgroundColor = "transparent"; oIFrame.style.borderWidth = "0"; oIFrame.style.width = "2em"; oIFrame.style.height = "2em"; oIFrame.style.left = "0"; oIFrame.style.top = (-1 * (oIFrame.offsetHeight + Module.RESIZE_MONITOR_BUFFER)) + "px"; oIFrame.style.visibility = "visible"; /* Don't open/close the document for Gecko like we used to, since it leads to duplicate cookies. (See YUILibrary bug #1721755) */ if (UA.webkit) { oDoc = oIFrame.contentWindow.document; oDoc.open(); oDoc.close(); } } if (oIFrame && oIFrame.contentWindow) { Module.textResizeEvent.subscribe(this.onDomResize, this, true); if (!Module.textResizeInitialized) { if (supportsCWResize) { if (!Event.on(oIFrame.contentWindow, "resize", fireTextResize)) { /* This will fail in IE if document.domain has changed, so we must change the listener to use the oIFrame element instead */ Event.on(oIFrame, "resize", fireTextResize); } } Module.textResizeInitialized = true; } this.resizeMonitor = oIFrame; } } }, /** * Text resize monitor helper method. * Determines if the browser supports resize events on iframe content windows. * * @private * @method _supportsCWResize */ _supportsCWResize : function() { /* Gecko 1.8.0 (FF1.5), 1.8.1.0-5 (FF2) won't fire resize on contentWindow. Gecko 1.8.1.6+ (FF2.0.0.6+) and all other browsers will fire resize on contentWindow. We don't want to start sniffing for patch versions, so fire textResize the same way on all FF2 flavors */ var bSupported = true; if (UA.gecko && UA.gecko <= 1.8) { bSupported = false; } return bSupported; }, /** * Event handler fired when the resize monitor element is resized. * @method onDomResize * @param {DOMEvent} e The DOM resize event * @param {Object} obj The scope object passed to the handler */ onDomResize: function (e, obj) { var nTop = -1 * (this.resizeMonitor.offsetHeight + Module.RESIZE_MONITOR_BUFFER); this.resizeMonitor.style.top = nTop + "px"; this.resizeMonitor.style.left = "0"; }, /** * Sets the Module's header content to the markup specified, or appends * the passed element to the header. * * If no header is present, one will * be automatically created. An empty string can be passed to the method * to clear the contents of the header. * * @method setHeader * @param {HTML} headerContent The markup used to set the header content. * As a convenience, non HTMLElement objects can also be passed into * the method, and will be treated as strings, with the header innerHTML * set to their default toString implementations. * * <p>NOTE: Markup passed into this method is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.</p> * * <em>OR</em> * @param {HTMLElement} headerContent The HTMLElement to append to * <em>OR</em> * @param {DocumentFragment} headerContent The document fragment * containing elements which are to be added to the header */ setHeader: function (headerContent) { var oHeader = this.header || (this.header = createHeader()); if (headerContent.nodeName) { oHeader.innerHTML = ""; oHeader.appendChild(headerContent); } else { oHeader.innerHTML = headerContent; } if (this._rendered) { this._renderHeader(); } this.changeHeaderEvent.fire(headerContent); this.changeContentEvent.fire(); }, /** * Appends the passed element to the header. If no header is present, * one will be automatically created. * @method appendToHeader * @param {HTMLElement | DocumentFragment} element The element to * append to the header. In the case of a document fragment, the * children of the fragment will be appended to the header. */ appendToHeader: function (element) { var oHeader = this.header || (this.header = createHeader()); oHeader.appendChild(element); this.changeHeaderEvent.fire(element); this.changeContentEvent.fire(); }, /** * Sets the Module's body content to the HTML specified. * * If no body is present, one will be automatically created. * * An empty string can be passed to the method to clear the contents of the body. * @method setBody * @param {HTML} bodyContent The HTML used to set the body content * As a convenience, non HTMLElement objects can also be passed into * the method, and will be treated as strings, with the body innerHTML * set to their default toString implementations. * * <p>NOTE: Markup passed into this method is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.</p> * * <em>OR</em> * @param {HTMLElement} bodyContent The HTMLElement to add as the first and only * child of the body element. * <em>OR</em> * @param {DocumentFragment} bodyContent The document fragment * containing elements which are to be added to the body */ setBody: function (bodyContent) { var oBody = this.body || (this.body = createBody()); if (bodyContent.nodeName) { oBody.innerHTML = ""; oBody.appendChild(bodyContent); } else { oBody.innerHTML = bodyContent; } if (this._rendered) { this._renderBody(); } this.changeBodyEvent.fire(bodyContent); this.changeContentEvent.fire(); }, /** * Appends the passed element to the body. If no body is present, one * will be automatically created. * @method appendToBody * @param {HTMLElement | DocumentFragment} element The element to * append to the body. In the case of a document fragment, the * children of the fragment will be appended to the body. * */ appendToBody: function (element) { var oBody = this.body || (this.body = createBody()); oBody.appendChild(element); this.changeBodyEvent.fire(element); this.changeContentEvent.fire(); }, /** * Sets the Module's footer content to the HTML specified, or appends * the passed element to the footer. If no footer is present, one will * be automatically created. An empty string can be passed to the method * to clear the contents of the footer. * @method setFooter * @param {HTML} footerContent The HTML used to set the footer * As a convenience, non HTMLElement objects can also be passed into * the method, and will be treated as strings, with the footer innerHTML * set to their default toString implementations. * * <p>NOTE: Markup passed into this method is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.</p> * * <em>OR</em> * @param {HTMLElement} footerContent The HTMLElement to append to * the footer * <em>OR</em> * @param {DocumentFragment} footerContent The document fragment containing * elements which are to be added to the footer */ setFooter: function (footerContent) { var oFooter = this.footer || (this.footer = createFooter()); if (footerContent.nodeName) { oFooter.innerHTML = ""; oFooter.appendChild(footerContent); } else { oFooter.innerHTML = footerContent; } if (this._rendered) { this._renderFooter(); } this.changeFooterEvent.fire(footerContent); this.changeContentEvent.fire(); }, /** * Appends the passed element to the footer. If no footer is present, * one will be automatically created. * @method appendToFooter * @param {HTMLElement | DocumentFragment} element The element to * append to the footer. In the case of a document fragment, the * children of the fragment will be appended to the footer */ appendToFooter: function (element) { var oFooter = this.footer || (this.footer = createFooter()); oFooter.appendChild(element); this.changeFooterEvent.fire(element); this.changeContentEvent.fire(); }, /** * Renders the Module by inserting the elements that are not already * in the main Module into their correct places. Optionally appends * the Module to the specified node prior to the render's execution. * <p> * For Modules without existing markup, the appendToNode argument * is REQUIRED. If this argument is ommitted and the current element is * not present in the document, the function will return false, * indicating that the render was a failure. * </p> * <p> * NOTE: As of 2.3.1, if the appendToNode is the document's body element * then the module is rendered as the first child of the body element, * and not appended to it, to avoid Operation Aborted errors in IE when * rendering the module before window's load event is fired. You can * use the appendtodocumentbody configuration property to change this * to append to document.body if required. * </p> * @method render * @param {String} appendToNode The element id to which the Module * should be appended to prior to rendering <em>OR</em> * @param {HTMLElement} appendToNode The element to which the Module * should be appended to prior to rendering * @param {HTMLElement} moduleElement OPTIONAL. The element that * represents the actual Standard Module container. * @return {Boolean} Success or failure of the render */ render: function (appendToNode, moduleElement) { var me = this; function appendTo(parentNode) { if (typeof parentNode == "string") { parentNode = document.getElementById(parentNode); } if (parentNode) { me._addToParent(parentNode, me.element); me.appendEvent.fire(); } } this.beforeRenderEvent.fire(); if (! moduleElement) { moduleElement = this.element; } if (appendToNode) { appendTo(appendToNode); } else { // No node was passed in. If the element is not already in the Dom, this fails if (! Dom.inDocument(this.element)) { return false; } } this._renderHeader(moduleElement); this._renderBody(moduleElement); this._renderFooter(moduleElement); this._rendered = true; this.renderEvent.fire(); return true; }, /** * Renders the currently set header into it's proper position under the * module element. If the module element is not provided, "this.element" * is used. * * @method _renderHeader * @protected * @param {HTMLElement} moduleElement Optional. A reference to the module element */ _renderHeader: function(moduleElement){ moduleElement = moduleElement || this.element; // Need to get everything into the DOM if it isn't already if (this.header && !Dom.inDocument(this.header)) { // There is a header, but it's not in the DOM yet. Need to add it. var firstChild = moduleElement.firstChild; if (firstChild) { moduleElement.insertBefore(this.header, firstChild); } else { moduleElement.appendChild(this.header); } } }, /** * Renders the currently set body into it's proper position under the * module element. If the module element is not provided, "this.element" * is used. * * @method _renderBody * @protected * @param {HTMLElement} moduleElement Optional. A reference to the module element. */ _renderBody: function(moduleElement){ moduleElement = moduleElement || this.element; if (this.body && !Dom.inDocument(this.body)) { // There is a body, but it's not in the DOM yet. Need to add it. if (this.footer && Dom.isAncestor(moduleElement, this.footer)) { moduleElement.insertBefore(this.body, this.footer); } else { moduleElement.appendChild(this.body); } } }, /** * Renders the currently set footer into it's proper position under the * module element. If the module element is not provided, "this.element" * is used. * * @method _renderFooter * @protected * @param {HTMLElement} moduleElement Optional. A reference to the module element */ _renderFooter: function(moduleElement){ moduleElement = moduleElement || this.element; if (this.footer && !Dom.inDocument(this.footer)) { // There is a footer, but it's not in the DOM yet. Need to add it. moduleElement.appendChild(this.footer); } }, /** * Removes the Module element from the DOM, sets all child elements to null, and purges the bounding element of event listeners. * @method destroy * @param {boolean} shallowPurge If true, only the parent element's DOM event listeners are purged. If false, or not provided, all children are also purged of DOM event listeners. * NOTE: The flag is a "shallowPurge" flag, as opposed to what may be a more intuitive "purgeChildren" flag to maintain backwards compatibility with behavior prior to 2.9.0. */ destroy: function (shallowPurge) { var parent, purgeChildren = !(shallowPurge); if (this.element) { Event.purgeElement(this.element, purgeChildren); parent = this.element.parentNode; } if (parent) { parent.removeChild(this.element); } this.element = null; this.header = null; this.body = null; this.footer = null; Module.textResizeEvent.unsubscribe(this.onDomResize, this); this.cfg.destroy(); this.cfg = null; this.destroyEvent.fire(); }, /** * Shows the Module element by setting the visible configuration * property to true. Also fires two events: beforeShowEvent prior to * the visibility change, and showEvent after. * @method show */ show: function () { this.cfg.setProperty("visible", true); }, /** * Hides the Module element by setting the visible configuration * property to false. Also fires two events: beforeHideEvent prior to * the visibility change, and hideEvent after. * @method hide */ hide: function () { this.cfg.setProperty("visible", false); }, // BUILT-IN EVENT HANDLERS FOR MODULE // /** * Default event handler for changing the visibility property of a * Module. By default, this is achieved by switching the "display" style * between "block" and "none". * This method is responsible for firing showEvent and hideEvent. * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. * @method configVisible */ configVisible: function (type, args, obj) { var visible = args[0]; if (visible) { if(this.beforeShowEvent.fire()) { Dom.setStyle(this.element, "display", "block"); this.showEvent.fire(); } } else { if (this.beforeHideEvent.fire()) { Dom.setStyle(this.element, "display", "none"); this.hideEvent.fire(); } } }, /** * Default event handler for the "effect" configuration property * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. * @method configEffect */ configEffect: function (type, args, obj) { this._cachedEffects = (this.cacheEffects) ? this._createEffects(args[0]) : null; }, /** * If true, ContainerEffects (and Anim instances) are cached when "effect" is set, and reused. * If false, new instances are created each time the container is hidden or shown, as was the * behavior prior to 2.9.0. * * @property cacheEffects * @since 2.9.0 * @default true * @type boolean */ cacheEffects : true, /** * Creates an array of ContainerEffect instances from the provided configs * * @method _createEffects * @param {Array|Object} effectCfg An effect configuration or array of effect configurations * @return {Array} An array of ContainerEffect instances. * @protected */ _createEffects: function(effectCfg) { var effectInstances = null, n, i, eff; if (effectCfg) { if (effectCfg instanceof Array) { effectInstances = []; n = effectCfg.length; for (i = 0; i < n; i++) { eff = effectCfg[i]; if (eff.effect) { effectInstances[effectInstances.length] = eff.effect(this, eff.duration); } } } else if (effectCfg.effect) { effectInstances = [effectCfg.effect(this, effectCfg.duration)]; } } return effectInstances; }, /** * Default event handler for the "monitorresize" configuration property * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. * @method configMonitorResize */ configMonitorResize: function (type, args, obj) { var monitor = args[0]; if (monitor) { this.initResizeMonitor(); } else { Module.textResizeEvent.unsubscribe(this.onDomResize, this, true); this.resizeMonitor = null; } }, /** * This method is a protected helper, used when constructing the DOM structure for the module * to account for situations which may cause Operation Aborted errors in IE. It should not * be used for general DOM construction. * <p> * If the parentNode is not document.body, the element is appended as the last element. * </p> * <p> * If the parentNode is document.body the element is added as the first child to help * prevent Operation Aborted errors in IE. * </p> * * @param {parentNode} The HTML element to which the element will be added * @param {element} The HTML element to be added to parentNode's children * @method _addToParent * @protected */ _addToParent: function(parentNode, element) { if (!this.cfg.getProperty("appendtodocumentbody") && parentNode === document.body && parentNode.firstChild) { parentNode.insertBefore(element, parentNode.firstChild); } else { parentNode.appendChild(element); } }, /** * Returns a String representation of the Object. * @method toString * @return {String} The string representation of the Module */ toString: function () { return "Module " + this.id; } }; YAHOO.lang.augmentProto(Module, YAHOO.util.EventProvider); }()); (function () { /** * Overlay is a Module that is absolutely positioned above the page flow. It * has convenience methods for positioning and sizing, as well as options for * controlling zIndex and constraining the Overlay's position to the current * visible viewport. Overlay also contains a dynamicly generated IFRAME which * is placed beneath it for Internet Explorer 6 and 5.x so that it will be * properly rendered above SELECT elements. * @namespace YAHOO.widget * @class Overlay * @extends YAHOO.widget.Module * @param {String} el The element ID representing the Overlay <em>OR</em> * @param {HTMLElement} el The element representing the Overlay * @param {Object} userConfig The configuration object literal containing * the configuration that should be set for this Overlay. See configuration * documentation for more details. * @constructor */ YAHOO.widget.Overlay = function (el, userConfig) { YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig); }; var Lang = YAHOO.lang, CustomEvent = YAHOO.util.CustomEvent, Module = YAHOO.widget.Module, Event = YAHOO.util.Event, Dom = YAHOO.util.Dom, Config = YAHOO.util.Config, UA = YAHOO.env.ua, Overlay = YAHOO.widget.Overlay, _SUBSCRIBE = "subscribe", _UNSUBSCRIBE = "unsubscribe", _CONTAINED = "contained", m_oIFrameTemplate, /** * Constant representing the name of the Overlay's events * @property EVENT_TYPES * @private * @final * @type Object */ EVENT_TYPES = { "BEFORE_MOVE": "beforeMove", "MOVE": "move" }, /** * Constant representing the Overlay's configuration properties * @property DEFAULT_CONFIG * @private * @final * @type Object */ DEFAULT_CONFIG = { "X": { key: "x", validator: Lang.isNumber, suppressEvent: true, supercedes: ["iframe"] }, "Y": { key: "y", validator: Lang.isNumber, suppressEvent: true, supercedes: ["iframe"] }, "XY": { key: "xy", suppressEvent: true, supercedes: ["iframe"] }, "CONTEXT": { key: "context", suppressEvent: true, supercedes: ["iframe"] }, "FIXED_CENTER": { key: "fixedcenter", value: false, supercedes: ["iframe", "visible"] }, "WIDTH": { key: "width", suppressEvent: true, supercedes: ["context", "fixedcenter", "iframe"] }, "HEIGHT": { key: "height", suppressEvent: true, supercedes: ["context", "fixedcenter", "iframe"] }, "AUTO_FILL_HEIGHT" : { key: "autofillheight", supercedes: ["height"], value:"body" }, "ZINDEX": { key: "zindex", value: null }, "CONSTRAIN_TO_VIEWPORT": { key: "constraintoviewport", value: false, validator: Lang.isBoolean, supercedes: ["iframe", "x", "y", "xy"] }, "IFRAME": { key: "iframe", value: (UA.ie == 6 ? true : false), validator: Lang.isBoolean, supercedes: ["zindex"] }, "PREVENT_CONTEXT_OVERLAP": { key: "preventcontextoverlap", value: false, validator: Lang.isBoolean, supercedes: ["constraintoviewport"] } }; /** * The URL that will be placed in the iframe * @property YAHOO.widget.Overlay.IFRAME_SRC * @static * @final * @type String */ Overlay.IFRAME_SRC = "javascript:false;"; /** * Number representing how much the iframe shim should be offset from each * side of an Overlay instance, in pixels. * @property YAHOO.widget.Overlay.IFRAME_SRC * @default 3 * @static * @final * @type Number */ Overlay.IFRAME_OFFSET = 3; /** * Number representing the minimum distance an Overlay instance should be * positioned relative to the boundaries of the browser's viewport, in pixels. * @property YAHOO.widget.Overlay.VIEWPORT_OFFSET * @default 10 * @static * @final * @type Number */ Overlay.VIEWPORT_OFFSET = 10; /** * Constant representing the top left corner of an element, used for * configuring the context element alignment * @property YAHOO.widget.Overlay.TOP_LEFT * @static * @final * @type String */ Overlay.TOP_LEFT = "tl"; /** * Constant representing the top right corner of an element, used for * configuring the context element alignment * @property YAHOO.widget.Overlay.TOP_RIGHT * @static * @final * @type String */ Overlay.TOP_RIGHT = "tr"; /** * Constant representing the top bottom left corner of an element, used for * configuring the context element alignment * @property YAHOO.widget.Overlay.BOTTOM_LEFT * @static * @final * @type String */ Overlay.BOTTOM_LEFT = "bl"; /** * Constant representing the bottom right corner of an element, used for * configuring the context element alignment * @property YAHOO.widget.Overlay.BOTTOM_RIGHT * @static * @final * @type String */ Overlay.BOTTOM_RIGHT = "br"; Overlay.PREVENT_OVERLAP_X = { "tltr": true, "blbr": true, "brbl": true, "trtl": true }; Overlay.PREVENT_OVERLAP_Y = { "trbr": true, "tlbl": true, "bltl": true, "brtr": true }; /** * Constant representing the default CSS class used for an Overlay * @property YAHOO.widget.Overlay.CSS_OVERLAY * @static * @final * @type String */ Overlay.CSS_OVERLAY = "yui-overlay"; /** * Constant representing the default hidden CSS class used for an Overlay. This class is * applied to the overlay's outer DIV whenever it's hidden. * * @property YAHOO.widget.Overlay.CSS_HIDDEN * @static * @final * @type String */ Overlay.CSS_HIDDEN = "yui-overlay-hidden"; /** * Constant representing the default CSS class used for an Overlay iframe shim. * * @property YAHOO.widget.Overlay.CSS_IFRAME * @static * @final * @type String */ Overlay.CSS_IFRAME = "yui-overlay-iframe"; /** * Constant representing the names of the standard module elements * used in the overlay. * @property YAHOO.widget.Overlay.STD_MOD_RE * @static * @final * @type RegExp */ Overlay.STD_MOD_RE = /^\s*?(body|footer|header)\s*?$/i; /** * A singleton CustomEvent used for reacting to the DOM event for * window scroll * @event YAHOO.widget.Overlay.windowScrollEvent */ Overlay.windowScrollEvent = new CustomEvent("windowScroll"); /** * A singleton CustomEvent used for reacting to the DOM event for * window resize * @event YAHOO.widget.Overlay.windowResizeEvent */ Overlay.windowResizeEvent = new CustomEvent("windowResize"); /** * The DOM event handler used to fire the CustomEvent for window scroll * @method YAHOO.widget.Overlay.windowScrollHandler * @static * @param {DOMEvent} e The DOM scroll event */ Overlay.windowScrollHandler = function (e) { var t = Event.getTarget(e); // - Webkit (Safari 2/3) and Opera 9.2x bubble scroll events from elements to window // - FF2/3 and IE6/7, Opera 9.5x don't bubble scroll events from elements to window // - IE doesn't recognize scroll registered on the document. // // Also, when document view is scrolled, IE doesn't provide a target, // rest of the browsers set target to window.document, apart from opera // which sets target to window. if (!t || t === window || t === window.document) { if (UA.ie) { if (! window.scrollEnd) { window.scrollEnd = -1; } clearTimeout(window.scrollEnd); window.scrollEnd = setTimeout(function () { Overlay.windowScrollEvent.fire(); }, 1); } else { Overlay.windowScrollEvent.fire(); } } }; /** * The DOM event handler used to fire the CustomEvent for window resize * @method YAHOO.widget.Overlay.windowResizeHandler * @static * @param {DOMEvent} e The DOM resize event */ Overlay.windowResizeHandler = function (e) { if (UA.ie) { if (! window.resizeEnd) { window.resizeEnd = -1; } clearTimeout(window.resizeEnd); window.resizeEnd = setTimeout(function () { Overlay.windowResizeEvent.fire(); }, 100); } else { Overlay.windowResizeEvent.fire(); } }; /** * A boolean that indicated whether the window resize and scroll events have * already been subscribed to. * @property YAHOO.widget.Overlay._initialized * @private * @type Boolean */ Overlay._initialized = null; if (Overlay._initialized === null) { Event.on(window, "scroll", Overlay.windowScrollHandler); Event.on(window, "resize", Overlay.windowResizeHandler); Overlay._initialized = true; } /** * Internal map of special event types, which are provided * by the instance. It maps the event type to the custom event * instance. Contains entries for the "windowScroll", "windowResize" and * "textResize" static container events. * * @property YAHOO.widget.Overlay._TRIGGER_MAP * @type Object * @static * @private */ Overlay._TRIGGER_MAP = { "windowScroll" : Overlay.windowScrollEvent, "windowResize" : Overlay.windowResizeEvent, "textResize" : Module.textResizeEvent }; YAHOO.extend(Overlay, Module, { /** * <p> * Array of default event types which will trigger * context alignment for the Overlay class. * </p> * <p>The array is empty by default for Overlay, * but maybe populated in future releases, so classes extending * Overlay which need to define their own set of CONTEXT_TRIGGERS * should concatenate their super class's prototype.CONTEXT_TRIGGERS * value with their own array of values. * </p> * <p> * E.g.: * <code>CustomOverlay.prototype.CONTEXT_TRIGGERS = YAHOO.widget.Overlay.prototype.CONTEXT_TRIGGERS.concat(["windowScroll"]);</code> * </p> * * @property CONTEXT_TRIGGERS * @type Array * @final */ CONTEXT_TRIGGERS : [], /** * The Overlay initialization method, which is executed for Overlay and * all of its subclasses. This method is automatically called by the * constructor, and sets up all DOM references for pre-existing markup, * and creates required markup if it is not already present. * @method init * @param {String} el The element ID representing the Overlay <em>OR</em> * @param {HTMLElement} el The element representing the Overlay * @param {Object} userConfig The configuration object literal * containing the configuration that should be set for this Overlay. * See configuration documentation for more details. */ init: function (el, userConfig) { /* Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level */ Overlay.superclass.init.call(this, el/*, userConfig*/); this.beforeInitEvent.fire(Overlay); Dom.addClass(this.element, Overlay.CSS_OVERLAY); if (userConfig) { this.cfg.applyConfig(userConfig, true); } if (this.platform == "mac" && UA.gecko) { if (! Config.alreadySubscribed(this.showEvent, this.showMacGeckoScrollbars, this)) { this.showEvent.subscribe(this.showMacGeckoScrollbars, this, true); } if (! Config.alreadySubscribed(this.hideEvent, this.hideMacGeckoScrollbars, this)) { this.hideEvent.subscribe(this.hideMacGeckoScrollbars, this, true); } } this.initEvent.fire(Overlay); }, /** * Initializes the custom events for Overlay which are fired * automatically at appropriate times by the Overlay class. * @method initEvents */ initEvents: function () { Overlay.superclass.initEvents.call(this); var SIGNATURE = CustomEvent.LIST; /** * CustomEvent fired before the Overlay is moved. * @event beforeMoveEvent * @param {Number} x x coordinate * @param {Number} y y coordinate */ this.beforeMoveEvent = this.createEvent(EVENT_TYPES.BEFORE_MOVE); this.beforeMoveEvent.signature = SIGNATURE; /** * CustomEvent fired after the Overlay is moved. * @event moveEvent * @param {Number} x x coordinate * @param {Number} y y coordinate */ this.moveEvent = this.createEvent(EVENT_TYPES.MOVE); this.moveEvent.signature = SIGNATURE; }, /** * Initializes the class's configurable properties which can be changed * using the Overlay's Config object (cfg). * @method initDefaultConfig */ initDefaultConfig: function () { Overlay.superclass.initDefaultConfig.call(this); var cfg = this.cfg; // Add overlay config properties // /** * The absolute x-coordinate position of the Overlay * @config x * @type Number * @default null */ cfg.addProperty(DEFAULT_CONFIG.X.key, { handler: this.configX, validator: DEFAULT_CONFIG.X.validator, suppressEvent: DEFAULT_CONFIG.X.suppressEvent, supercedes: DEFAULT_CONFIG.X.supercedes }); /** * The absolute y-coordinate position of the Overlay * @config y * @type Number * @default null */ cfg.addProperty(DEFAULT_CONFIG.Y.key, { handler: this.configY, validator: DEFAULT_CONFIG.Y.validator, suppressEvent: DEFAULT_CONFIG.Y.suppressEvent, supercedes: DEFAULT_CONFIG.Y.supercedes }); /** * An array with the absolute x and y positions of the Overlay * @config xy * @type Number[] * @default null */ cfg.addProperty(DEFAULT_CONFIG.XY.key, { handler: this.configXY, suppressEvent: DEFAULT_CONFIG.XY.suppressEvent, supercedes: DEFAULT_CONFIG.XY.supercedes }); /** * <p> * The array of context arguments for context-sensitive positioning. * </p> * * <p> * The format of the array is: <code>[contextElementOrId, overlayCorner, contextCorner, arrayOfTriggerEvents (optional), xyOffset (optional)]</code>, the * the 5 array elements described in detail below: * </p> * * <dl> * <dt>contextElementOrId &#60;String|HTMLElement&#62;</dt> * <dd>A reference to the context element to which the overlay should be aligned (or it's id).</dd> * <dt>overlayCorner &#60;String&#62;</dt> * <dd>The corner of the overlay which is to be used for alignment. This corner will be aligned to the * corner of the context element defined by the "contextCorner" entry which follows. Supported string values are: * "tr" (top right), "tl" (top left), "br" (bottom right), or "bl" (bottom left).</dd> * <dt>contextCorner &#60;String&#62;</dt> * <dd>The corner of the context element which is to be used for alignment. Supported string values are the same ones listed for the "overlayCorner" entry above.</dd> * <dt>arrayOfTriggerEvents (optional) &#60;Array[String|CustomEvent]&#62;</dt> * <dd> * <p> * By default, context alignment is a one time operation, aligning the Overlay to the context element when context configuration property is set, or when the <a href="#method_align">align</a> * method is invoked. However, you can use the optional "arrayOfTriggerEvents" entry to define the list of events which should force the overlay to re-align itself with the context element. * This is useful in situations where the layout of the document may change, resulting in the context element's position being modified. * </p> * <p> * The array can contain either event type strings for events the instance publishes (e.g. "beforeShow") or CustomEvent instances. Additionally the following * 3 static container event types are also currently supported : <code>"windowResize", "windowScroll", "textResize"</code> (defined in <a href="#property__TRIGGER_MAP">_TRIGGER_MAP</a> private property). * </p> * </dd> * <dt>xyOffset &#60;Number[]&#62;</dt> * <dd> * A 2 element Array specifying the X and Y pixel amounts by which the Overlay should be offset from the aligned corner. e.g. [5,0] offsets the Overlay 5 pixels to the left, <em>after</em> aligning the given context corners. * NOTE: If using this property and no triggers need to be defined, the arrayOfTriggerEvents property should be set to null to maintain correct array positions for the arguments. * </dd> * </dl> * * <p> * For example, setting this property to <code>["img1", "tl", "bl"]</code> will * align the Overlay's top left corner to the bottom left corner of the * context element with id "img1". * </p> * <p> * Setting this property to <code>["img1", "tl", "bl", null, [0,5]</code> will * align the Overlay's top left corner to the bottom left corner of the * context element with id "img1", and then offset it by 5 pixels on the Y axis (providing a 5 pixel gap between the bottom of the context element and top of the overlay). * </p> * <p> * Adding the optional trigger values: <code>["img1", "tl", "bl", ["beforeShow", "windowResize"], [0,5]]</code>, * will re-align the overlay position, whenever the "beforeShow" or "windowResize" events are fired. * </p> * * @config context * @type Array * @default null */ cfg.addProperty(DEFAULT_CONFIG.CONTEXT.key, { handler: this.configContext, suppressEvent: DEFAULT_CONFIG.CONTEXT.suppressEvent, supercedes: DEFAULT_CONFIG.CONTEXT.supercedes }); /** * Determines whether or not the Overlay should be anchored * to the center of the viewport. * * <p>This property can be set to:</p> * * <dl> * <dt>true</dt> * <dd> * To enable fixed center positioning * <p> * When enabled, the overlay will * be positioned in the center of viewport when initially displayed, and * will remain in the center of the viewport whenever the window is * scrolled or resized. * </p> * <p> * If the overlay is too big for the viewport, * it's top left corner will be aligned with the top left corner of the viewport. * </p> * </dd> * <dt>false</dt> * <dd> * To disable fixed center positioning. * <p>In this case the overlay can still be * centered as a one-off operation, by invoking the <code>center()</code> method, * however it will not remain centered when the window is scrolled/resized. * </dd> * <dt>"contained"<dt> * <dd>To enable fixed center positioning, as with the <code>true</code> option. * <p>However, unlike setting the property to <code>true</code>, * when the property is set to <code>"contained"</code>, if the overlay is * too big for the viewport, it will not get automatically centered when the * user scrolls or resizes the window (until the window is large enough to contain the * overlay). This is useful in cases where the Overlay has both header and footer * UI controls which the user may need to access. * </p> * </dd> * </dl> * * @config fixedcenter * @type Boolean | String * @default false */ cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key, { handler: this.configFixedCenter, value: DEFAULT_CONFIG.FIXED_CENTER.value, validator: DEFAULT_CONFIG.FIXED_CENTER.validator, supercedes: DEFAULT_CONFIG.FIXED_CENTER.supercedes }); /** * CSS width of the Overlay. * @config width * @type String * @default null */ cfg.addProperty(DEFAULT_CONFIG.WIDTH.key, { handler: this.configWidth, suppressEvent: DEFAULT_CONFIG.WIDTH.suppressEvent, supercedes: DEFAULT_CONFIG.WIDTH.supercedes }); /** * CSS height of the Overlay. * @config height * @type String * @default null */ cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key, { handler: this.configHeight, suppressEvent: DEFAULT_CONFIG.HEIGHT.suppressEvent, supercedes: DEFAULT_CONFIG.HEIGHT.supercedes }); /** * Standard module element which should auto fill out the height of the Overlay if the height config property is set. * Supported values are "header", "body", "footer". * * @config autofillheight * @type String * @default null */ cfg.addProperty(DEFAULT_CONFIG.AUTO_FILL_HEIGHT.key, { handler: this.configAutoFillHeight, value : DEFAULT_CONFIG.AUTO_FILL_HEIGHT.value, validator : this._validateAutoFill, supercedes: DEFAULT_CONFIG.AUTO_FILL_HEIGHT.supercedes }); /** * CSS z-index of the Overlay. * @config zIndex * @type Number * @default null */ cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key, { handler: this.configzIndex, value: DEFAULT_CONFIG.ZINDEX.value }); /** * True if the Overlay should be prevented from being positioned * out of the viewport. * @config constraintoviewport * @type Boolean * @default false */ cfg.addProperty(DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key, { handler: this.configConstrainToViewport, value: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value, validator: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator, supercedes: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes }); /** * @config iframe * @description Boolean indicating whether or not the Overlay should * have an IFRAME shim; used to prevent SELECT elements from * poking through an Overlay instance in IE6. When set to "true", * the iframe shim is created when the Overlay instance is intially * made visible. * @type Boolean * @default true for IE6 and below, false for all other browsers. */ cfg.addProperty(DEFAULT_CONFIG.IFRAME.key, { handler: this.configIframe, value: DEFAULT_CONFIG.IFRAME.value, validator: DEFAULT_CONFIG.IFRAME.validator, supercedes: DEFAULT_CONFIG.IFRAME.supercedes }); /** * @config preventcontextoverlap * @description Boolean indicating whether or not the Overlay should overlap its * context element (defined using the "context" configuration property) when the * "constraintoviewport" configuration property is set to "true". * @type Boolean * @default false */ cfg.addProperty(DEFAULT_CONFIG.PREVENT_CONTEXT_OVERLAP.key, { value: DEFAULT_CONFIG.PREVENT_CONTEXT_OVERLAP.value, validator: DEFAULT_CONFIG.PREVENT_CONTEXT_OVERLAP.validator, supercedes: DEFAULT_CONFIG.PREVENT_CONTEXT_OVERLAP.supercedes }); }, /** * Moves the Overlay to the specified position. This function is * identical to calling this.cfg.setProperty("xy", [x,y]); * @method moveTo * @param {Number} x The Overlay's new x position * @param {Number} y The Overlay's new y position */ moveTo: function (x, y) { this.cfg.setProperty("xy", [x, y]); }, /** * Adds a CSS class ("hide-scrollbars") and removes a CSS class * ("show-scrollbars") to the Overlay to fix a bug in Gecko on Mac OS X * (https://bugzilla.mozilla.org/show_bug.cgi?id=187435) * @method hideMacGeckoScrollbars */ hideMacGeckoScrollbars: function () { Dom.replaceClass(this.element, "show-scrollbars", "hide-scrollbars"); }, /** * Adds a CSS class ("show-scrollbars") and removes a CSS class * ("hide-scrollbars") to the Overlay to fix a bug in Gecko on Mac OS X * (https://bugzilla.mozilla.org/show_bug.cgi?id=187435) * @method showMacGeckoScrollbars */ showMacGeckoScrollbars: function () { Dom.replaceClass(this.element, "hide-scrollbars", "show-scrollbars"); }, /** * Internal implementation to set the visibility of the overlay in the DOM. * * @method _setDomVisibility * @param {boolean} visible Whether to show or hide the Overlay's outer element * @protected */ _setDomVisibility : function(show) { Dom.setStyle(this.element, "visibility", (show) ? "visible" : "hidden"); var hiddenClass = Overlay.CSS_HIDDEN; if (show) { Dom.removeClass(this.element, hiddenClass); } else { Dom.addClass(this.element, hiddenClass); } }, // BEGIN BUILT-IN PROPERTY EVENT HANDLERS // /** * The default event handler fired when the "visible" property is * changed. This method is responsible for firing showEvent * and hideEvent. * @method configVisible * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configVisible: function (type, args, obj) { var visible = args[0], currentVis = Dom.getStyle(this.element, "visibility"), effects = this._cachedEffects || this._createEffects(this.cfg.getProperty("effect")), isMacGecko = (this.platform == "mac" && UA.gecko), alreadySubscribed = Config.alreadySubscribed, ei, e, j, k, h, nEffectInstances; if (currentVis == "inherit") { e = this.element.parentNode; while (e.nodeType != 9 && e.nodeType != 11) { currentVis = Dom.getStyle(e, "visibility"); if (currentVis != "inherit") { break; } e = e.parentNode; } if (currentVis == "inherit") { currentVis = "visible"; } } if (visible) { // Show if (isMacGecko) { this.showMacGeckoScrollbars(); } if (effects) { // Animate in if (visible) { // Animate in if not showing // Fading out is a bit of a hack, but didn't want to risk doing // something broader (e.g a generic this._animatingOut) for 2.9.0 if (currentVis != "visible" || currentVis === "" || this._fadingOut) { if (this.beforeShowEvent.fire()) { nEffectInstances = effects.length; for (j = 0; j < nEffectInstances; j++) { ei = effects[j]; if (j === 0 && !alreadySubscribed(ei.animateInCompleteEvent, this.showEvent.fire, this.showEvent)) { ei.animateInCompleteEvent.subscribe(this.showEvent.fire, this.showEvent, true); } ei.animateIn(); } } } } } else { // Show if (currentVis != "visible" || currentVis === "") { if (this.beforeShowEvent.fire()) { this._setDomVisibility(true); this.cfg.refireEvent("iframe"); this.showEvent.fire(); } } else { this._setDomVisibility(true); } } } else { // Hide if (isMacGecko) { this.hideMacGeckoScrollbars(); } if (effects) { // Animate out if showing if (currentVis == "visible" || this._fadingIn) { if (this.beforeHideEvent.fire()) { nEffectInstances = effects.length; for (k = 0; k < nEffectInstances; k++) { h = effects[k]; if (k === 0 && !alreadySubscribed(h.animateOutCompleteEvent, this.hideEvent.fire, this.hideEvent)) { h.animateOutCompleteEvent.subscribe(this.hideEvent.fire, this.hideEvent, true); } h.animateOut(); } } } else if (currentVis === "") { this._setDomVisibility(false); } } else { // Simple hide if (currentVis == "visible" || currentVis === "") { if (this.beforeHideEvent.fire()) { this._setDomVisibility(false); this.hideEvent.fire(); } } else { this._setDomVisibility(false); } } } }, /** * Fixed center event handler used for centering on scroll/resize, but only if * the overlay is visible and, if "fixedcenter" is set to "contained", only if * the overlay fits within the viewport. * * @method doCenterOnDOMEvent */ doCenterOnDOMEvent: function () { var cfg = this.cfg, fc = cfg.getProperty("fixedcenter"); if (cfg.getProperty("visible")) { if (fc && (fc !== _CONTAINED || this.fitsInViewport())) { this.center(); } } }, /** * Determines if the Overlay (including the offset value defined by Overlay.VIEWPORT_OFFSET) * will fit entirely inside the viewport, in both dimensions - width and height. * * @method fitsInViewport * @return boolean true if the Overlay will fit, false if not */ fitsInViewport : function() { var nViewportOffset = Overlay.VIEWPORT_OFFSET, element = this.element, elementWidth = element.offsetWidth, elementHeight = element.offsetHeight, viewportWidth = Dom.getViewportWidth(), viewportHeight = Dom.getViewportHeight(); return ((elementWidth + nViewportOffset < viewportWidth) && (elementHeight + nViewportOffset < viewportHeight)); }, /** * The default event handler fired when the "fixedcenter" property * is changed. * @method configFixedCenter * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configFixedCenter: function (type, args, obj) { var val = args[0], alreadySubscribed = Config.alreadySubscribed, windowResizeEvent = Overlay.windowResizeEvent, windowScrollEvent = Overlay.windowScrollEvent; if (val) { this.center(); if (!alreadySubscribed(this.beforeShowEvent, this.center)) { this.beforeShowEvent.subscribe(this.center); } if (!alreadySubscribed(windowResizeEvent, this.doCenterOnDOMEvent, this)) { windowResizeEvent.subscribe(this.doCenterOnDOMEvent, this, true); } if (!alreadySubscribed(windowScrollEvent, this.doCenterOnDOMEvent, this)) { windowScrollEvent.subscribe(this.doCenterOnDOMEvent, this, true); } } else { this.beforeShowEvent.unsubscribe(this.center); windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this); windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this); } }, /** * The default event handler fired when the "height" property is changed. * @method configHeight * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configHeight: function (type, args, obj) { var height = args[0], el = this.element; Dom.setStyle(el, "height", height); this.cfg.refireEvent("iframe"); }, /** * The default event handler fired when the "autofillheight" property is changed. * @method configAutoFillHeight * * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configAutoFillHeight: function (type, args, obj) { var fillEl = args[0], cfg = this.cfg, autoFillHeight = "autofillheight", height = "height", currEl = cfg.getProperty(autoFillHeight), autoFill = this._autoFillOnHeightChange; cfg.unsubscribeFromConfigEvent(height, autoFill); Module.textResizeEvent.unsubscribe(autoFill); this.changeContentEvent.unsubscribe(autoFill); if (currEl && fillEl !== currEl && this[currEl]) { Dom.setStyle(this[currEl], height, ""); } if (fillEl) { fillEl = Lang.trim(fillEl.toLowerCase()); cfg.subscribeToConfigEvent(height, autoFill, this[fillEl], this); Module.textResizeEvent.subscribe(autoFill, this[fillEl], this); this.changeContentEvent.subscribe(autoFill, this[fillEl], this); cfg.setProperty(autoFillHeight, fillEl, true); } }, /** * The default event handler fired when the "width" property is changed. * @method configWidth * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configWidth: function (type, args, obj) { var width = args[0], el = this.element; Dom.setStyle(el, "width", width); this.cfg.refireEvent("iframe"); }, /** * The default event handler fired when the "zIndex" property is changed. * @method configzIndex * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configzIndex: function (type, args, obj) { var zIndex = args[0], el = this.element; if (! zIndex) { zIndex = Dom.getStyle(el, "zIndex"); if (! zIndex || isNaN(zIndex)) { zIndex = 0; } } if (this.iframe || this.cfg.getProperty("iframe") === true) { if (zIndex <= 0) { zIndex = 1; } } Dom.setStyle(el, "zIndex", zIndex); this.cfg.setProperty("zIndex", zIndex, true); if (this.iframe) { this.stackIframe(); } }, /** * The default event handler fired when the "xy" property is changed. * @method configXY * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configXY: function (type, args, obj) { var pos = args[0], x = pos[0], y = pos[1]; this.cfg.setProperty("x", x); this.cfg.setProperty("y", y); this.beforeMoveEvent.fire([x, y]); x = this.cfg.getProperty("x"); y = this.cfg.getProperty("y"); this.cfg.refireEvent("iframe"); this.moveEvent.fire([x, y]); }, /** * The default event handler fired when the "x" property is changed. * @method configX * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configX: function (type, args, obj) { var x = args[0], y = this.cfg.getProperty("y"); this.cfg.setProperty("x", x, true); this.cfg.setProperty("y", y, true); this.beforeMoveEvent.fire([x, y]); x = this.cfg.getProperty("x"); y = this.cfg.getProperty("y"); Dom.setX(this.element, x, true); this.cfg.setProperty("xy", [x, y], true); this.cfg.refireEvent("iframe"); this.moveEvent.fire([x, y]); }, /** * The default event handler fired when the "y" property is changed. * @method configY * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configY: function (type, args, obj) { var x = this.cfg.getProperty("x"), y = args[0]; this.cfg.setProperty("x", x, true); this.cfg.setProperty("y", y, true); this.beforeMoveEvent.fire([x, y]); x = this.cfg.getProperty("x"); y = this.cfg.getProperty("y"); Dom.setY(this.element, y, true); this.cfg.setProperty("xy", [x, y], true); this.cfg.refireEvent("iframe"); this.moveEvent.fire([x, y]); }, /** * Shows the iframe shim, if it has been enabled. * @method showIframe */ showIframe: function () { var oIFrame = this.iframe, oParentNode; if (oIFrame) { oParentNode = this.element.parentNode; if (oParentNode != oIFrame.parentNode) { this._addToParent(oParentNode, oIFrame); } oIFrame.style.display = "block"; } }, /** * Hides the iframe shim, if it has been enabled. * @method hideIframe */ hideIframe: function () { if (this.iframe) { this.iframe.style.display = "none"; } }, /** * Syncronizes the size and position of iframe shim to that of its * corresponding Overlay instance. * @method syncIframe */ syncIframe: function () { var oIFrame = this.iframe, oElement = this.element, nOffset = Overlay.IFRAME_OFFSET, nDimensionOffset = (nOffset * 2), aXY; if (oIFrame) { // Size <iframe> oIFrame.style.width = (oElement.offsetWidth + nDimensionOffset + "px"); oIFrame.style.height = (oElement.offsetHeight + nDimensionOffset + "px"); // Position <iframe> aXY = this.cfg.getProperty("xy"); if (!Lang.isArray(aXY) || (isNaN(aXY[0]) || isNaN(aXY[1]))) { this.syncPosition(); aXY = this.cfg.getProperty("xy"); } Dom.setXY(oIFrame, [(aXY[0] - nOffset), (aXY[1] - nOffset)]); } }, /** * Sets the zindex of the iframe shim, if it exists, based on the zindex of * the Overlay element. The zindex of the iframe is set to be one less * than the Overlay element's zindex. * * <p>NOTE: This method will not bump up the zindex of the Overlay element * to ensure that the iframe shim has a non-negative zindex. * If you require the iframe zindex to be 0 or higher, the zindex of * the Overlay element should be set to a value greater than 0, before * this method is called. * </p> * @method stackIframe */ stackIframe: function () { if (this.iframe) { var overlayZ = Dom.getStyle(this.element, "zIndex"); if (!YAHOO.lang.isUndefined(overlayZ) && !isNaN(overlayZ)) { Dom.setStyle(this.iframe, "zIndex", (overlayZ - 1)); } } }, /** * The default event handler fired when the "iframe" property is changed. * @method configIframe * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configIframe: function (type, args, obj) { var bIFrame = args[0]; function createIFrame() { var oIFrame = this.iframe, oElement = this.element, oParent; if (!oIFrame) { if (!m_oIFrameTemplate) { m_oIFrameTemplate = document.createElement("iframe"); if (this.isSecure) { m_oIFrameTemplate.src = Overlay.IFRAME_SRC; } /* Set the opacity of the <iframe> to 0 so that it doesn't modify the opacity of any transparent elements that may be on top of it (like a shadow). */ if (UA.ie) { m_oIFrameTemplate.style.filter = "alpha(opacity=0)"; /* Need to set the "frameBorder" property to 0 supress the default <iframe> border in IE. Setting the CSS "border" property alone doesn't supress it. */ m_oIFrameTemplate.frameBorder = 0; } else { m_oIFrameTemplate.style.opacity = "0"; } m_oIFrameTemplate.style.position = "absolute"; m_oIFrameTemplate.style.border = "none"; m_oIFrameTemplate.style.margin = "0"; m_oIFrameTemplate.style.padding = "0"; m_oIFrameTemplate.style.display = "none"; m_oIFrameTemplate.tabIndex = -1; m_oIFrameTemplate.className = Overlay.CSS_IFRAME; } oIFrame = m_oIFrameTemplate.cloneNode(false); oIFrame.id = this.id + "_f"; oParent = oElement.parentNode; var parentNode = oParent || document.body; this._addToParent(parentNode, oIFrame); this.iframe = oIFrame; } /* Show the <iframe> before positioning it since the "setXY" method of DOM requires the element be in the document and visible. */ this.showIframe(); /* Syncronize the size and position of the <iframe> to that of the Overlay. */ this.syncIframe(); this.stackIframe(); // Add event listeners to update the <iframe> when necessary if (!this._hasIframeEventListeners) { this.showEvent.subscribe(this.showIframe); this.hideEvent.subscribe(this.hideIframe); this.changeContentEvent.subscribe(this.syncIframe); this._hasIframeEventListeners = true; } } function onBeforeShow() { createIFrame.call(this); this.beforeShowEvent.unsubscribe(onBeforeShow); this._iframeDeferred = false; } if (bIFrame) { // <iframe> shim is enabled if (this.cfg.getProperty("visible")) { createIFrame.call(this); } else { if (!this._iframeDeferred) { this.beforeShowEvent.subscribe(onBeforeShow); this._iframeDeferred = true; } } } else { // <iframe> shim is disabled this.hideIframe(); if (this._hasIframeEventListeners) { this.showEvent.unsubscribe(this.showIframe); this.hideEvent.unsubscribe(this.hideIframe); this.changeContentEvent.unsubscribe(this.syncIframe); this._hasIframeEventListeners = false; } } }, /** * Set's the container's XY value from DOM if not already set. * * Differs from syncPosition, in that the XY value is only sync'd with DOM if * not already set. The method also refire's the XY config property event, so any * beforeMove, Move event listeners are invoked. * * @method _primeXYFromDOM * @protected */ _primeXYFromDOM : function() { if (YAHOO.lang.isUndefined(this.cfg.getProperty("xy"))) { // Set CFG XY based on DOM XY this.syncPosition(); // Account for XY being set silently in syncPosition (no moveTo fired/called) this.cfg.refireEvent("xy"); this.beforeShowEvent.unsubscribe(this._primeXYFromDOM); } }, /** * The default event handler fired when the "constraintoviewport" * property is changed. * @method configConstrainToViewport * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for * the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configConstrainToViewport: function (type, args, obj) { var val = args[0]; if (val) { if (! Config.alreadySubscribed(this.beforeMoveEvent, this.enforceConstraints, this)) { this.beforeMoveEvent.subscribe(this.enforceConstraints, this, true); } if (! Config.alreadySubscribed(this.beforeShowEvent, this._primeXYFromDOM)) { this.beforeShowEvent.subscribe(this._primeXYFromDOM); } } else { this.beforeShowEvent.unsubscribe(this._primeXYFromDOM); this.beforeMoveEvent.unsubscribe(this.enforceConstraints, this); } }, /** * The default event handler fired when the "context" property * is changed. * * @method configContext * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configContext: function (type, args, obj) { var contextArgs = args[0], contextEl, elementMagnetCorner, contextMagnetCorner, triggers, offset, defTriggers = this.CONTEXT_TRIGGERS; if (contextArgs) { contextEl = contextArgs[0]; elementMagnetCorner = contextArgs[1]; contextMagnetCorner = contextArgs[2]; triggers = contextArgs[3]; offset = contextArgs[4]; if (defTriggers && defTriggers.length > 0) { triggers = (triggers || []).concat(defTriggers); } if (contextEl) { if (typeof contextEl == "string") { this.cfg.setProperty("context", [ document.getElementById(contextEl), elementMagnetCorner, contextMagnetCorner, triggers, offset], true); } if (elementMagnetCorner && contextMagnetCorner) { this.align(elementMagnetCorner, contextMagnetCorner, offset); } if (this._contextTriggers) { // Unsubscribe Old Set this._processTriggers(this._contextTriggers, _UNSUBSCRIBE, this._alignOnTrigger); } if (triggers) { // Subscribe New Set this._processTriggers(triggers, _SUBSCRIBE, this._alignOnTrigger); this._contextTriggers = triggers; } } } }, /** * Custom Event handler for context alignment triggers. Invokes the align method * * @method _alignOnTrigger * @protected * * @param {String} type The event type (not used by the default implementation) * @param {Any[]} args The array of arguments for the trigger event (not used by the default implementation) */ _alignOnTrigger: function(type, args) { this.align(); }, /** * Helper method to locate the custom event instance for the event name string * passed in. As a convenience measure, any custom events passed in are returned. * * @method _findTriggerCE * @private * * @param {String|CustomEvent} t Either a CustomEvent, or event type (e.g. "windowScroll") for which a * custom event instance needs to be looked up from the Overlay._TRIGGER_MAP. */ _findTriggerCE : function(t) { var tce = null; if (t instanceof CustomEvent) { tce = t; } else if (Overlay._TRIGGER_MAP[t]) { tce = Overlay._TRIGGER_MAP[t]; } return tce; }, /** * Utility method that subscribes or unsubscribes the given * function from the list of trigger events provided. * * @method _processTriggers * @protected * * @param {Array[String|CustomEvent]} triggers An array of either CustomEvents, event type strings * (e.g. "beforeShow", "windowScroll") to/from which the provided function should be * subscribed/unsubscribed respectively. * * @param {String} mode Either "subscribe" or "unsubscribe", specifying whether or not * we are subscribing or unsubscribing trigger listeners * * @param {Function} fn The function to be subscribed/unsubscribed to/from the trigger event. * Context is always set to the overlay instance, and no additional object argument * get passed to the subscribed function. */ _processTriggers : function(triggers, mode, fn) { var t, tce; for (var i = 0, l = triggers.length; i < l; ++i) { t = triggers[i]; tce = this._findTriggerCE(t); if (tce) { tce[mode](fn, this, true); } else { this[mode](t, fn); } } }, // END BUILT-IN PROPERTY EVENT HANDLERS // /** * Aligns the Overlay to its context element using the specified corner * points (represented by the constants TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, * and BOTTOM_RIGHT. * @method align * @param {String} elementAlign The String representing the corner of * the Overlay that should be aligned to the context element * @param {String} contextAlign The corner of the context element * that the elementAlign corner should stick to. * @param {Number[]} xyOffset Optional. A 2 element array specifying the x and y pixel offsets which should be applied * after aligning the element and context corners. For example, passing in [5, -10] for this value, would offset the * Overlay by 5 pixels along the X axis (horizontally) and -10 pixels along the Y axis (vertically) after aligning the specified corners. */ align: function (elementAlign, contextAlign, xyOffset) { var contextArgs = this.cfg.getProperty("context"), me = this, context, element, contextRegion; function doAlign(v, h) { var alignX = null, alignY = null; switch (elementAlign) { case Overlay.TOP_LEFT: alignX = h; alignY = v; break; case Overlay.TOP_RIGHT: alignX = h - element.offsetWidth; alignY = v; break; case Overlay.BOTTOM_LEFT: alignX = h; alignY = v - element.offsetHeight; break; case Overlay.BOTTOM_RIGHT: alignX = h - element.offsetWidth; alignY = v - element.offsetHeight; break; } if (alignX !== null && alignY !== null) { if (xyOffset) { alignX += xyOffset[0]; alignY += xyOffset[1]; } me.moveTo(alignX, alignY); } } if (contextArgs) { context = contextArgs[0]; element = this.element; me = this; if (! elementAlign) { elementAlign = contextArgs[1]; } if (! contextAlign) { contextAlign = contextArgs[2]; } if (!xyOffset && contextArgs[4]) { xyOffset = contextArgs[4]; } if (element && context) { contextRegion = Dom.getRegion(context); switch (contextAlign) { case Overlay.TOP_LEFT: doAlign(contextRegion.top, contextRegion.left); break; case Overlay.TOP_RIGHT: doAlign(contextRegion.top, contextRegion.right); break; case Overlay.BOTTOM_LEFT: doAlign(contextRegion.bottom, contextRegion.left); break; case Overlay.BOTTOM_RIGHT: doAlign(contextRegion.bottom, contextRegion.right); break; } } } }, /** * The default event handler executed when the moveEvent is fired, if the * "constraintoviewport" is set to true. * @method enforceConstraints * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ enforceConstraints: function (type, args, obj) { var pos = args[0]; var cXY = this.getConstrainedXY(pos[0], pos[1]); this.cfg.setProperty("x", cXY[0], true); this.cfg.setProperty("y", cXY[1], true); this.cfg.setProperty("xy", cXY, true); }, /** * Shared implementation method for getConstrainedX and getConstrainedY. * * <p> * Given a coordinate value, returns the calculated coordinate required to * position the Overlay if it is to be constrained to the viewport, based on the * current element size, viewport dimensions, scroll values and preventoverlap * settings * </p> * * @method _getConstrainedPos * @protected * @param {String} pos The coordinate which needs to be constrained, either "x" or "y" * @param {Number} The coordinate value which needs to be constrained * @return {Number} The constrained coordinate value */ _getConstrainedPos: function(pos, val) { var overlayEl = this.element, buffer = Overlay.VIEWPORT_OFFSET, x = (pos == "x"), overlaySize = (x) ? overlayEl.offsetWidth : overlayEl.offsetHeight, viewportSize = (x) ? Dom.getViewportWidth() : Dom.getViewportHeight(), docScroll = (x) ? Dom.getDocumentScrollLeft() : Dom.getDocumentScrollTop(), overlapPositions = (x) ? Overlay.PREVENT_OVERLAP_X : Overlay.PREVENT_OVERLAP_Y, context = this.cfg.getProperty("context"), bOverlayFitsInViewport = (overlaySize + buffer < viewportSize), bPreventContextOverlap = this.cfg.getProperty("preventcontextoverlap") && context && overlapPositions[(context[1] + context[2])], minConstraint = docScroll + buffer, maxConstraint = docScroll + viewportSize - overlaySize - buffer, constrainedVal = val; if (val < minConstraint || val > maxConstraint) { if (bPreventContextOverlap) { constrainedVal = this._preventOverlap(pos, context[0], overlaySize, viewportSize, docScroll); } else { if (bOverlayFitsInViewport) { if (val < minConstraint) { constrainedVal = minConstraint; } else if (val > maxConstraint) { constrainedVal = maxConstraint; } } else { constrainedVal = minConstraint; } } } return constrainedVal; }, /** * Helper method, used to position the Overlap to prevent overlap with the * context element (used when preventcontextoverlap is enabled) * * @method _preventOverlap * @protected * @param {String} pos The coordinate to prevent overlap for, either "x" or "y". * @param {HTMLElement} contextEl The context element * @param {Number} overlaySize The related overlay dimension value (for "x", the width, for "y", the height) * @param {Number} viewportSize The related viewport dimension value (for "x", the width, for "y", the height) * @param {Object} docScroll The related document scroll value (for "x", the scrollLeft, for "y", the scrollTop) * * @return {Number} The new coordinate value which was set to prevent overlap */ _preventOverlap : function(pos, contextEl, overlaySize, viewportSize, docScroll) { var x = (pos == "x"), buffer = Overlay.VIEWPORT_OFFSET, overlay = this, contextElPos = ((x) ? Dom.getX(contextEl) : Dom.getY(contextEl)) - docScroll, contextElSize = (x) ? contextEl.offsetWidth : contextEl.offsetHeight, minRegionSize = contextElPos - buffer, maxRegionSize = (viewportSize - (contextElPos + contextElSize)) - buffer, bFlipped = false, flip = function () { var flippedVal; if ((overlay.cfg.getProperty(pos) - docScroll) > contextElPos) { flippedVal = (contextElPos - overlaySize); } else { flippedVal = (contextElPos + contextElSize); } overlay.cfg.setProperty(pos, (flippedVal + docScroll), true); return flippedVal; }, setPosition = function () { var displayRegionSize = ((overlay.cfg.getProperty(pos) - docScroll) > contextElPos) ? maxRegionSize : minRegionSize, position; if (overlaySize > displayRegionSize) { if (bFlipped) { /* All possible positions and values have been tried, but none were successful, so fall back to the original size and position. */ flip(); } else { flip(); bFlipped = true; position = setPosition(); } } return position; }; setPosition(); return this.cfg.getProperty(pos); }, /** * Given x coordinate value, returns the calculated x coordinate required to * position the Overlay if it is to be constrained to the viewport, based on the * current element size, viewport dimensions and scroll values. * * @param {Number} x The X coordinate value to be constrained * @return {Number} The constrained x coordinate */ getConstrainedX: function (x) { return this._getConstrainedPos("x", x); }, /** * Given y coordinate value, returns the calculated y coordinate required to * position the Overlay if it is to be constrained to the viewport, based on the * current element size, viewport dimensions and scroll values. * * @param {Number} y The Y coordinate value to be constrained * @return {Number} The constrained y coordinate */ getConstrainedY : function (y) { return this._getConstrainedPos("y", y); }, /** * Given x, y coordinate values, returns the calculated coordinates required to * position the Overlay if it is to be constrained to the viewport, based on the * current element size, viewport dimensions and scroll values. * * @param {Number} x The X coordinate value to be constrained * @param {Number} y The Y coordinate value to be constrained * @return {Array} The constrained x and y coordinates at index 0 and 1 respectively; */ getConstrainedXY: function(x, y) { return [this.getConstrainedX(x), this.getConstrainedY(y)]; }, /** * Centers the container in the viewport. * @method center */ center: function () { var nViewportOffset = Overlay.VIEWPORT_OFFSET, elementWidth = this.element.offsetWidth, elementHeight = this.element.offsetHeight, viewPortWidth = Dom.getViewportWidth(), viewPortHeight = Dom.getViewportHeight(), x, y; if (elementWidth < viewPortWidth) { x = (viewPortWidth / 2) - (elementWidth / 2) + Dom.getDocumentScrollLeft(); } else { x = nViewportOffset + Dom.getDocumentScrollLeft(); } if (elementHeight < viewPortHeight) { y = (viewPortHeight / 2) - (elementHeight / 2) + Dom.getDocumentScrollTop(); } else { y = nViewportOffset + Dom.getDocumentScrollTop(); } this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]); this.cfg.refireEvent("iframe"); if (UA.webkit) { this.forceContainerRedraw(); } }, /** * Synchronizes the Panel's "xy", "x", and "y" properties with the * Panel's position in the DOM. This is primarily used to update * position information during drag & drop. * @method syncPosition */ syncPosition: function () { var pos = Dom.getXY(this.element); this.cfg.setProperty("x", pos[0], true); this.cfg.setProperty("y", pos[1], true); this.cfg.setProperty("xy", pos, true); }, /** * Event handler fired when the resize monitor element is resized. * @method onDomResize * @param {DOMEvent} e The resize DOM event * @param {Object} obj The scope object */ onDomResize: function (e, obj) { var me = this; Overlay.superclass.onDomResize.call(this, e, obj); setTimeout(function () { me.syncPosition(); me.cfg.refireEvent("iframe"); me.cfg.refireEvent("context"); }, 0); }, /** * Determines the content box height of the given element (height of the element, without padding or borders) in pixels. * * @method _getComputedHeight * @private * @param {HTMLElement} el The element for which the content height needs to be determined * @return {Number} The content box height of the given element, or null if it could not be determined. */ _getComputedHeight : (function() { if (document.defaultView && document.defaultView.getComputedStyle) { return function(el) { var height = null; if (el.ownerDocument && el.ownerDocument.defaultView) { var computed = el.ownerDocument.defaultView.getComputedStyle(el, ''); if (computed) { height = parseInt(computed.height, 10); } } return (Lang.isNumber(height)) ? height : null; }; } else { return function(el) { var height = null; if (el.style.pixelHeight) { height = el.style.pixelHeight; } return (Lang.isNumber(height)) ? height : null; }; } })(), /** * autofillheight validator. Verifies that the autofill value is either null * or one of the strings : "body", "header" or "footer". * * @method _validateAutoFillHeight * @protected * @param {String} val * @return true, if valid, false otherwise */ _validateAutoFillHeight : function(val) { return (!val) || (Lang.isString(val) && Overlay.STD_MOD_RE.test(val)); }, /** * The default custom event handler executed when the overlay's height is changed, * if the autofillheight property has been set. * * @method _autoFillOnHeightChange * @protected * @param {String} type The event type * @param {Array} args The array of arguments passed to event subscribers * @param {HTMLElement} el The header, body or footer element which is to be resized to fill * out the containers height */ _autoFillOnHeightChange : function(type, args, el) { var height = this.cfg.getProperty("height"); if ((height && height !== "auto") || (height === 0)) { this.fillHeight(el); } }, /** * Returns the sub-pixel height of the el, using getBoundingClientRect, if available, * otherwise returns the offsetHeight * @method _getPreciseHeight * @private * @param {HTMLElement} el * @return {Float} The sub-pixel height if supported by the browser, else the rounded height. */ _getPreciseHeight : function(el) { var height = el.offsetHeight; if (el.getBoundingClientRect) { var rect = el.getBoundingClientRect(); height = rect.bottom - rect.top; } return height; }, /** * <p> * Sets the height on the provided header, body or footer element to * fill out the height of the container. It determines the height of the * containers content box, based on it's configured height value, and * sets the height of the autofillheight element to fill out any * space remaining after the other standard module element heights * have been accounted for. * </p> * <p><strong>NOTE:</strong> This method is not designed to work if an explicit * height has not been set on the container, since for an "auto" height container, * the heights of the header/body/footer will drive the height of the container.</p> * * @method fillHeight * @param {HTMLElement} el The element which should be resized to fill out the height * of the container element. */ fillHeight : function(el) { if (el) { var container = this.innerElement || this.element, containerEls = [this.header, this.body, this.footer], containerEl, total = 0, filled = 0, remaining = 0, validEl = false; for (var i = 0, l = containerEls.length; i < l; i++) { containerEl = containerEls[i]; if (containerEl) { if (el !== containerEl) { filled += this._getPreciseHeight(containerEl); } else { validEl = true; } } } if (validEl) { if (UA.ie || UA.opera) { // Need to set height to 0, to allow height to be reduced Dom.setStyle(el, 'height', 0 + 'px'); } total = this._getComputedHeight(container); // Fallback, if we can't get computed value for content height if (total === null) { Dom.addClass(container, "yui-override-padding"); total = container.clientHeight; // Content, No Border, 0 Padding (set by yui-override-padding) Dom.removeClass(container, "yui-override-padding"); } remaining = Math.max(total - filled, 0); Dom.setStyle(el, "height", remaining + "px"); // Re-adjust height if required, to account for el padding and border if (el.offsetHeight != remaining) { remaining = Math.max(remaining - (el.offsetHeight - remaining), 0); } Dom.setStyle(el, "height", remaining + "px"); } } }, /** * Places the Overlay on top of all other instances of * YAHOO.widget.Overlay. * @method bringToTop */ bringToTop: function () { var aOverlays = [], oElement = this.element; function compareZIndexDesc(p_oOverlay1, p_oOverlay2) { var sZIndex1 = Dom.getStyle(p_oOverlay1, "zIndex"), sZIndex2 = Dom.getStyle(p_oOverlay2, "zIndex"), nZIndex1 = (!sZIndex1 || isNaN(sZIndex1)) ? 0 : parseInt(sZIndex1, 10), nZIndex2 = (!sZIndex2 || isNaN(sZIndex2)) ? 0 : parseInt(sZIndex2, 10); if (nZIndex1 > nZIndex2) { return -1; } else if (nZIndex1 < nZIndex2) { return 1; } else { return 0; } } function isOverlayElement(p_oElement) { var isOverlay = Dom.hasClass(p_oElement, Overlay.CSS_OVERLAY), Panel = YAHOO.widget.Panel; if (isOverlay && !Dom.isAncestor(oElement, p_oElement)) { if (Panel && Dom.hasClass(p_oElement, Panel.CSS_PANEL)) { aOverlays[aOverlays.length] = p_oElement.parentNode; } else { aOverlays[aOverlays.length] = p_oElement; } } } Dom.getElementsBy(isOverlayElement, "div", document.body); aOverlays.sort(compareZIndexDesc); var oTopOverlay = aOverlays[0], nTopZIndex; if (oTopOverlay) { nTopZIndex = Dom.getStyle(oTopOverlay, "zIndex"); if (!isNaN(nTopZIndex)) { var bRequiresBump = false; if (oTopOverlay != oElement) { bRequiresBump = true; } else if (aOverlays.length > 1) { var nNextZIndex = Dom.getStyle(aOverlays[1], "zIndex"); // Don't rely on DOM order to stack if 2 overlays are at the same zindex. if (!isNaN(nNextZIndex) && (nTopZIndex == nNextZIndex)) { bRequiresBump = true; } } if (bRequiresBump) { this.cfg.setProperty("zindex", (parseInt(nTopZIndex, 10) + 2)); } } } }, /** * Removes the Overlay element from the DOM and sets all child * elements to null. * @method destroy * @param {boolean} shallowPurge If true, only the parent element's DOM event listeners are purged. If false, or not provided, all children are also purged of DOM event listeners. * NOTE: The flag is a "shallowPurge" flag, as opposed to what may be a more intuitive "purgeChildren" flag to maintain backwards compatibility with behavior prior to 2.9.0. */ destroy: function (shallowPurge) { if (this.iframe) { this.iframe.parentNode.removeChild(this.iframe); } this.iframe = null; Overlay.windowResizeEvent.unsubscribe( this.doCenterOnDOMEvent, this); Overlay.windowScrollEvent.unsubscribe( this.doCenterOnDOMEvent, this); Module.textResizeEvent.unsubscribe(this._autoFillOnHeightChange); if (this._contextTriggers) { // Unsubscribe context triggers - to cover context triggers which listen for global // events such as windowResize and windowScroll. Easier just to unsubscribe all this._processTriggers(this._contextTriggers, _UNSUBSCRIBE, this._alignOnTrigger); } Overlay.superclass.destroy.call(this, shallowPurge); }, /** * Can be used to force the container to repaint/redraw it's contents. * <p> * By default applies and then removes a 1px bottom margin through the * application/removal of a "yui-force-redraw" class. * </p> * <p> * It is currently used by Overlay to force a repaint for webkit * browsers, when centering. * </p> * @method forceContainerRedraw */ forceContainerRedraw : function() { var c = this; Dom.addClass(c.element, "yui-force-redraw"); setTimeout(function() { Dom.removeClass(c.element, "yui-force-redraw"); }, 0); }, /** * Returns a String representation of the object. * @method toString * @return {String} The string representation of the Overlay. */ toString: function () { return "Overlay " + this.id; } }); }()); (function () { /** * OverlayManager is used for maintaining the focus status of * multiple Overlays. * @namespace YAHOO.widget * @namespace YAHOO.widget * @class OverlayManager * @constructor * @param {Array} overlays Optional. A collection of Overlays to register * with the manager. * @param {Object} userConfig The object literal representing the user * configuration of the OverlayManager */ YAHOO.widget.OverlayManager = function (userConfig) { this.init(userConfig); }; var Overlay = YAHOO.widget.Overlay, Event = YAHOO.util.Event, Dom = YAHOO.util.Dom, Config = YAHOO.util.Config, CustomEvent = YAHOO.util.CustomEvent, OverlayManager = YAHOO.widget.OverlayManager; /** * The CSS class representing a focused Overlay * @property OverlayManager.CSS_FOCUSED * @static * @final * @type String */ OverlayManager.CSS_FOCUSED = "focused"; OverlayManager.prototype = { /** * The class's constructor function * @property contructor * @type Function */ constructor: OverlayManager, /** * The array of Overlays that are currently registered * @property overlays * @type YAHOO.widget.Overlay[] */ overlays: null, /** * Initializes the default configuration of the OverlayManager * @method initDefaultConfig */ initDefaultConfig: function () { /** * The collection of registered Overlays in use by * the OverlayManager * @config overlays * @type YAHOO.widget.Overlay[] * @default null */ this.cfg.addProperty("overlays", { suppressEvent: true } ); /** * The default DOM event that should be used to focus an Overlay * @config focusevent * @type String * @default "mousedown" */ this.cfg.addProperty("focusevent", { value: "mousedown" } ); }, /** * Initializes the OverlayManager * @method init * @param {Overlay[]} overlays Optional. A collection of Overlays to * register with the manager. * @param {Object} userConfig The object literal representing the user * configuration of the OverlayManager */ init: function (userConfig) { /** * The OverlayManager's Config object used for monitoring * configuration properties. * @property cfg * @type Config */ this.cfg = new Config(this); this.initDefaultConfig(); if (userConfig) { this.cfg.applyConfig(userConfig, true); } this.cfg.fireQueue(); /** * The currently activated Overlay * @property activeOverlay * @private * @type YAHOO.widget.Overlay */ var activeOverlay = null; /** * Returns the currently focused Overlay * @method getActive * @return {Overlay} The currently focused Overlay */ this.getActive = function () { return activeOverlay; }; /** * Focuses the specified Overlay * @method focus * @param {Overlay} overlay The Overlay to focus * @param {String} overlay The id of the Overlay to focus */ this.focus = function (overlay) { var o = this.find(overlay); if (o) { o.focus(); } }; /** * Removes the specified Overlay from the manager * @method remove * @param {Overlay} overlay The Overlay to remove * @param {String} overlay The id of the Overlay to remove */ this.remove = function (overlay) { var o = this.find(overlay), originalZ; if (o) { if (activeOverlay == o) { activeOverlay = null; } var bDestroyed = (o.element === null && o.cfg === null) ? true : false; if (!bDestroyed) { // Set it's zindex so that it's sorted to the end. originalZ = Dom.getStyle(o.element, "zIndex"); o.cfg.setProperty("zIndex", -1000, true); } this.overlays.sort(this.compareZIndexDesc); this.overlays = this.overlays.slice(0, (this.overlays.length - 1)); o.hideEvent.unsubscribe(o.blur); o.destroyEvent.unsubscribe(this._onOverlayDestroy, o); o.focusEvent.unsubscribe(this._onOverlayFocusHandler, o); o.blurEvent.unsubscribe(this._onOverlayBlurHandler, o); if (!bDestroyed) { Event.removeListener(o.element, this.cfg.getProperty("focusevent"), this._onOverlayElementFocus); o.cfg.setProperty("zIndex", originalZ, true); o.cfg.setProperty("manager", null); } /* _managed Flag for custom or existing. Don't want to remove existing */ if (o.focusEvent._managed) { o.focusEvent = null; } if (o.blurEvent._managed) { o.blurEvent = null; } if (o.focus._managed) { o.focus = null; } if (o.blur._managed) { o.blur = null; } } }; /** * Removes focus from all registered Overlays in the manager * @method blurAll */ this.blurAll = function () { var nOverlays = this.overlays.length, i; if (nOverlays > 0) { i = nOverlays - 1; do { this.overlays[i].blur(); } while(i--); } }; /** * Updates the state of the OverlayManager and overlay, as a result of the overlay * being blurred. * * @method _manageBlur * @param {Overlay} overlay The overlay instance which got blurred. * @protected */ this._manageBlur = function (overlay) { var changed = false; if (activeOverlay == overlay) { Dom.removeClass(activeOverlay.element, OverlayManager.CSS_FOCUSED); activeOverlay = null; changed = true; } return changed; }; /** * Updates the state of the OverlayManager and overlay, as a result of the overlay * receiving focus. * * @method _manageFocus * @param {Overlay} overlay The overlay instance which got focus. * @protected */ this._manageFocus = function(overlay) { var changed = false; if (activeOverlay != overlay) { if (activeOverlay) { activeOverlay.blur(); } activeOverlay = overlay; this.bringToTop(activeOverlay); Dom.addClass(activeOverlay.element, OverlayManager.CSS_FOCUSED); changed = true; } return changed; }; var overlays = this.cfg.getProperty("overlays"); if (! this.overlays) { this.overlays = []; } if (overlays) { this.register(overlays); this.overlays.sort(this.compareZIndexDesc); } }, /** * @method _onOverlayElementFocus * @description Event handler for the DOM event that is used to focus * the Overlay instance as specified by the "focusevent" * configuration property. * @private * @param {Event} p_oEvent Object representing the DOM event * object passed back by the event utility (Event). */ _onOverlayElementFocus: function (p_oEvent) { var oTarget = Event.getTarget(p_oEvent), oClose = this.close; if (oClose && (oTarget == oClose || Dom.isAncestor(oClose, oTarget))) { this.blur(); } else { this.focus(); } }, /** * @method _onOverlayDestroy * @description "destroy" event handler for the Overlay. * @private * @param {String} p_sType String representing the name of the event * that was fired. * @param {Array} p_aArgs Array of arguments sent when the event * was fired. * @param {Overlay} p_oOverlay Object representing the overlay that * fired the event. */ _onOverlayDestroy: function (p_sType, p_aArgs, p_oOverlay) { this.remove(p_oOverlay); }, /** * @method _onOverlayFocusHandler * * @description focusEvent Handler, used to delegate to _manageFocus with the correct arguments. * * @private * @param {String} p_sType String representing the name of the event * that was fired. * @param {Array} p_aArgs Array of arguments sent when the event * was fired. * @param {Overlay} p_oOverlay Object representing the overlay that * fired the event. */ _onOverlayFocusHandler: function(p_sType, p_aArgs, p_oOverlay) { this._manageFocus(p_oOverlay); }, /** * @method _onOverlayBlurHandler * @description blurEvent Handler, used to delegate to _manageBlur with the correct arguments. * * @private * @param {String} p_sType String representing the name of the event * that was fired. * @param {Array} p_aArgs Array of arguments sent when the event * was fired. * @param {Overlay} p_oOverlay Object representing the overlay that * fired the event. */ _onOverlayBlurHandler: function(p_sType, p_aArgs, p_oOverlay) { this._manageBlur(p_oOverlay); }, /** * Subscribes to the Overlay based instance focusEvent, to allow the OverlayManager to * monitor focus state. * * If the instance already has a focusEvent (e.g. Menu), OverlayManager will subscribe * to the existing focusEvent, however if a focusEvent or focus method does not exist * on the instance, the _bindFocus method will add them, and the focus method will * update the OverlayManager's state directly. * * @method _bindFocus * @param {Overlay} overlay The overlay for which focus needs to be managed * @protected */ _bindFocus : function(overlay) { var mgr = this; if (!overlay.focusEvent) { overlay.focusEvent = overlay.createEvent("focus"); overlay.focusEvent.signature = CustomEvent.LIST; overlay.focusEvent._managed = true; } else { overlay.focusEvent.subscribe(mgr._onOverlayFocusHandler, overlay, mgr); } if (!overlay.focus) { Event.on(overlay.element, mgr.cfg.getProperty("focusevent"), mgr._onOverlayElementFocus, null, overlay); overlay.focus = function () { if (mgr._manageFocus(this)) { // For Panel/Dialog if (this.cfg.getProperty("visible") && this.focusFirst) { this.focusFirst(); } this.focusEvent.fire(); } }; overlay.focus._managed = true; } }, /** * Subscribes to the Overlay based instance's blurEvent to allow the OverlayManager to * monitor blur state. * * If the instance already has a blurEvent (e.g. Menu), OverlayManager will subscribe * to the existing blurEvent, however if a blurEvent or blur method does not exist * on the instance, the _bindBlur method will add them, and the blur method * update the OverlayManager's state directly. * * @method _bindBlur * @param {Overlay} overlay The overlay for which blur needs to be managed * @protected */ _bindBlur : function(overlay) { var mgr = this; if (!overlay.blurEvent) { overlay.blurEvent = overlay.createEvent("blur"); overlay.blurEvent.signature = CustomEvent.LIST; overlay.focusEvent._managed = true; } else { overlay.blurEvent.subscribe(mgr._onOverlayBlurHandler, overlay, mgr); } if (!overlay.blur) { overlay.blur = function () { if (mgr._manageBlur(this)) { this.blurEvent.fire(); } }; overlay.blur._managed = true; } overlay.hideEvent.subscribe(overlay.blur); }, /** * Subscribes to the Overlay based instance's destroyEvent, to allow the Overlay * to be removed for the OverlayManager when destroyed. * * @method _bindDestroy * @param {Overlay} overlay The overlay instance being managed * @protected */ _bindDestroy : function(overlay) { var mgr = this; overlay.destroyEvent.subscribe(mgr._onOverlayDestroy, overlay, mgr); }, /** * Ensures the zIndex configuration property on the managed overlay based instance * is set to the computed zIndex value from the DOM (with "auto" translating to 0). * * @method _syncZIndex * @param {Overlay} overlay The overlay instance being managed * @protected */ _syncZIndex : function(overlay) { var zIndex = Dom.getStyle(overlay.element, "zIndex"); if (!isNaN(zIndex)) { overlay.cfg.setProperty("zIndex", parseInt(zIndex, 10)); } else { overlay.cfg.setProperty("zIndex", 0); } }, /** * Registers an Overlay or an array of Overlays with the manager. Upon * registration, the Overlay receives functions for focus and blur, * along with CustomEvents for each. * * @method register * @param {Overlay} overlay An Overlay to register with the manager. * @param {Overlay[]} overlay An array of Overlays to register with * the manager. * @return {boolean} true if any Overlays are registered. */ register: function (overlay) { var registered = false, i, n; if (overlay instanceof Overlay) { overlay.cfg.addProperty("manager", { value: this } ); this._bindFocus(overlay); this._bindBlur(overlay); this._bindDestroy(overlay); this._syncZIndex(overlay); this.overlays.push(overlay); this.bringToTop(overlay); registered = true; } else if (overlay instanceof Array) { for (i = 0, n = overlay.length; i < n; i++) { registered = this.register(overlay[i]) || registered; } } return registered; }, /** * Places the specified Overlay instance on top of all other * Overlay instances. * @method bringToTop * @param {YAHOO.widget.Overlay} p_oOverlay Object representing an * Overlay instance. * @param {String} p_oOverlay String representing the id of an * Overlay instance. */ bringToTop: function (p_oOverlay) { var oOverlay = this.find(p_oOverlay), nTopZIndex, oTopOverlay, aOverlays; if (oOverlay) { aOverlays = this.overlays; aOverlays.sort(this.compareZIndexDesc); oTopOverlay = aOverlays[0]; if (oTopOverlay) { nTopZIndex = Dom.getStyle(oTopOverlay.element, "zIndex"); if (!isNaN(nTopZIndex)) { var bRequiresBump = false; if (oTopOverlay !== oOverlay) { bRequiresBump = true; } else if (aOverlays.length > 1) { var nNextZIndex = Dom.getStyle(aOverlays[1].element, "zIndex"); // Don't rely on DOM order to stack if 2 overlays are at the same zindex. if (!isNaN(nNextZIndex) && (nTopZIndex == nNextZIndex)) { bRequiresBump = true; } } if (bRequiresBump) { oOverlay.cfg.setProperty("zindex", (parseInt(nTopZIndex, 10) + 2)); } } aOverlays.sort(this.compareZIndexDesc); } } }, /** * Attempts to locate an Overlay by instance or ID. * @method find * @param {Overlay} overlay An Overlay to locate within the manager * @param {String} overlay An Overlay id to locate within the manager * @return {Overlay} The requested Overlay, if found, or null if it * cannot be located. */ find: function (overlay) { var isInstance = overlay instanceof Overlay, overlays = this.overlays, n = overlays.length, found = null, o, i; if (isInstance || typeof overlay == "string") { for (i = n-1; i >= 0; i--) { o = overlays[i]; if ((isInstance && (o === overlay)) || (o.id == overlay)) { found = o; break; } } } return found; }, /** * Used for sorting the manager's Overlays by z-index. * @method compareZIndexDesc * @private * @return {Number} 0, 1, or -1, depending on where the Overlay should * fall in the stacking order. */ compareZIndexDesc: function (o1, o2) { var zIndex1 = (o1.cfg) ? o1.cfg.getProperty("zIndex") : null, // Sort invalid (destroyed) zIndex2 = (o2.cfg) ? o2.cfg.getProperty("zIndex") : null; // objects at bottom. if (zIndex1 === null && zIndex2 === null) { return 0; } else if (zIndex1 === null){ return 1; } else if (zIndex2 === null) { return -1; } else if (zIndex1 > zIndex2) { return -1; } else if (zIndex1 < zIndex2) { return 1; } else { return 0; } }, /** * Shows all Overlays in the manager. * @method showAll */ showAll: function () { var overlays = this.overlays, n = overlays.length, i; for (i = n - 1; i >= 0; i--) { overlays[i].show(); } }, /** * Hides all Overlays in the manager. * @method hideAll */ hideAll: function () { var overlays = this.overlays, n = overlays.length, i; for (i = n - 1; i >= 0; i--) { overlays[i].hide(); } }, /** * Returns a string representation of the object. * @method toString * @return {String} The string representation of the OverlayManager */ toString: function () { return "OverlayManager"; } }; }()); (function () { /** * Tooltip is an implementation of Overlay that behaves like an OS tooltip, * displaying when the user mouses over a particular element, and * disappearing on mouse out. * @namespace YAHOO.widget * @class Tooltip * @extends YAHOO.widget.Overlay * @constructor * @param {String} el The element ID representing the Tooltip <em>OR</em> * @param {HTMLElement} el The element representing the Tooltip * @param {Object} userConfig The configuration object literal containing * the configuration that should be set for this Overlay. See configuration * documentation for more details. */ YAHOO.widget.Tooltip = function (el, userConfig) { YAHOO.widget.Tooltip.superclass.constructor.call(this, el, userConfig); }; var Lang = YAHOO.lang, Event = YAHOO.util.Event, CustomEvent = YAHOO.util.CustomEvent, Dom = YAHOO.util.Dom, Tooltip = YAHOO.widget.Tooltip, UA = YAHOO.env.ua, bIEQuirks = (UA.ie && (UA.ie <= 6 || document.compatMode == "BackCompat")), m_oShadowTemplate, /** * Constant representing the Tooltip's configuration properties * @property DEFAULT_CONFIG * @private * @final * @type Object */ DEFAULT_CONFIG = { "PREVENT_OVERLAP": { key: "preventoverlap", value: true, validator: Lang.isBoolean, supercedes: ["x", "y", "xy"] }, "SHOW_DELAY": { key: "showdelay", value: 200, validator: Lang.isNumber }, "AUTO_DISMISS_DELAY": { key: "autodismissdelay", value: 5000, validator: Lang.isNumber }, "HIDE_DELAY": { key: "hidedelay", value: 250, validator: Lang.isNumber }, "TEXT": { key: "text", suppressEvent: true }, "CONTAINER": { key: "container" }, "DISABLED": { key: "disabled", value: false, suppressEvent: true }, "XY_OFFSET": { key: "xyoffset", value: [0, 25], suppressEvent: true } }, /** * Constant representing the name of the Tooltip's events * @property EVENT_TYPES * @private * @final * @type Object */ EVENT_TYPES = { "CONTEXT_MOUSE_OVER": "contextMouseOver", "CONTEXT_MOUSE_OUT": "contextMouseOut", "CONTEXT_TRIGGER": "contextTrigger" }; /** * Constant representing the Tooltip CSS class * @property YAHOO.widget.Tooltip.CSS_TOOLTIP * @static * @final * @type String */ Tooltip.CSS_TOOLTIP = "yui-tt"; function restoreOriginalWidth(sOriginalWidth, sForcedWidth) { var oConfig = this.cfg, sCurrentWidth = oConfig.getProperty("width"); if (sCurrentWidth == sForcedWidth) { oConfig.setProperty("width", sOriginalWidth); } } /* changeContent event handler that sets a Tooltip instance's "width" configuration property to the value of its root HTML elements's offsetWidth if a specific width has not been set. */ function setWidthToOffsetWidth(p_sType, p_aArgs) { if ("_originalWidth" in this) { restoreOriginalWidth.call(this, this._originalWidth, this._forcedWidth); } var oBody = document.body, oConfig = this.cfg, sOriginalWidth = oConfig.getProperty("width"), sNewWidth, oClone; if ((!sOriginalWidth || sOriginalWidth == "auto") && (oConfig.getProperty("container") != oBody || oConfig.getProperty("x") >= Dom.getViewportWidth() || oConfig.getProperty("y") >= Dom.getViewportHeight())) { oClone = this.element.cloneNode(true); oClone.style.visibility = "hidden"; oClone.style.top = "0px"; oClone.style.left = "0px"; oBody.appendChild(oClone); sNewWidth = (oClone.offsetWidth + "px"); oBody.removeChild(oClone); oClone = null; oConfig.setProperty("width", sNewWidth); oConfig.refireEvent("xy"); this._originalWidth = sOriginalWidth || ""; this._forcedWidth = sNewWidth; } } // "onDOMReady" that renders the ToolTip function onDOMReady(p_sType, p_aArgs, p_oObject) { this.render(p_oObject); } // "init" event handler that automatically renders the Tooltip function onInit() { Event.onDOMReady(onDOMReady, this.cfg.getProperty("container"), this); } YAHOO.extend(Tooltip, YAHOO.widget.Overlay, { /** * The Tooltip initialization method. This method is automatically * called by the constructor. A Tooltip is automatically rendered by * the init method, and it also is set to be invisible by default, * and constrained to viewport by default as well. * @method init * @param {String} el The element ID representing the Tooltip <em>OR</em> * @param {HTMLElement} el The element representing the Tooltip * @param {Object} userConfig The configuration object literal * containing the configuration that should be set for this Tooltip. * See configuration documentation for more details. */ init: function (el, userConfig) { Tooltip.superclass.init.call(this, el); this.beforeInitEvent.fire(Tooltip); Dom.addClass(this.element, Tooltip.CSS_TOOLTIP); if (userConfig) { this.cfg.applyConfig(userConfig, true); } this.cfg.queueProperty("visible", false); this.cfg.queueProperty("constraintoviewport", true); this.setBody(""); this.subscribe("changeContent", setWidthToOffsetWidth); this.subscribe("init", onInit); this.subscribe("render", this.onRender); this.initEvent.fire(Tooltip); }, /** * Initializes the custom events for Tooltip * @method initEvents */ initEvents: function () { Tooltip.superclass.initEvents.call(this); var SIGNATURE = CustomEvent.LIST; /** * CustomEvent fired when user mouses over a context element. Returning false from * a subscriber to this event will prevent the tooltip from being displayed for * the current context element. * * @event contextMouseOverEvent * @param {HTMLElement} context The context element which the user just moused over * @param {DOMEvent} e The DOM event object, associated with the mouse over */ this.contextMouseOverEvent = this.createEvent(EVENT_TYPES.CONTEXT_MOUSE_OVER); this.contextMouseOverEvent.signature = SIGNATURE; /** * CustomEvent fired when the user mouses out of a context element. * * @event contextMouseOutEvent * @param {HTMLElement} context The context element which the user just moused out of * @param {DOMEvent} e The DOM event object, associated with the mouse out */ this.contextMouseOutEvent = this.createEvent(EVENT_TYPES.CONTEXT_MOUSE_OUT); this.contextMouseOutEvent.signature = SIGNATURE; /** * CustomEvent fired just before the tooltip is displayed for the current context. * <p> * You can subscribe to this event if you need to set up the text for the * tooltip based on the context element for which it is about to be displayed. * </p> * <p>This event differs from the beforeShow event in following respects:</p> * <ol> * <li> * When moving from one context element to another, if the tooltip is not * hidden (the <code>hidedelay</code> is not reached), the beforeShow and Show events will not * be fired when the tooltip is displayed for the new context since it is already visible. * However the contextTrigger event is always fired before displaying the tooltip for * a new context. * </li> * <li> * The trigger event provides access to the context element, allowing you to * set the text of the tooltip based on context element for which the tooltip is * triggered. * </li> * </ol> * <p> * It is not possible to prevent the tooltip from being displayed * using this event. You can use the contextMouseOverEvent if you need to prevent * the tooltip from being displayed. * </p> * @event contextTriggerEvent * @param {HTMLElement} context The context element for which the tooltip is triggered */ this.contextTriggerEvent = this.createEvent(EVENT_TYPES.CONTEXT_TRIGGER); this.contextTriggerEvent.signature = SIGNATURE; }, /** * Initializes the class's configurable properties which can be * changed using the Overlay's Config object (cfg). * @method initDefaultConfig */ initDefaultConfig: function () { Tooltip.superclass.initDefaultConfig.call(this); /** * Specifies whether the Tooltip should be kept from overlapping * its context element. * @config preventoverlap * @type Boolean * @default true */ this.cfg.addProperty(DEFAULT_CONFIG.PREVENT_OVERLAP.key, { value: DEFAULT_CONFIG.PREVENT_OVERLAP.value, validator: DEFAULT_CONFIG.PREVENT_OVERLAP.validator, supercedes: DEFAULT_CONFIG.PREVENT_OVERLAP.supercedes }); /** * The number of milliseconds to wait before showing a Tooltip * on mouseover. * @config showdelay * @type Number * @default 200 */ this.cfg.addProperty(DEFAULT_CONFIG.SHOW_DELAY.key, { handler: this.configShowDelay, value: 200, validator: DEFAULT_CONFIG.SHOW_DELAY.validator }); /** * The number of milliseconds to wait before automatically * dismissing a Tooltip after the mouse has been resting on the * context element. * @config autodismissdelay * @type Number * @default 5000 */ this.cfg.addProperty(DEFAULT_CONFIG.AUTO_DISMISS_DELAY.key, { handler: this.configAutoDismissDelay, value: DEFAULT_CONFIG.AUTO_DISMISS_DELAY.value, validator: DEFAULT_CONFIG.AUTO_DISMISS_DELAY.validator }); /** * The number of milliseconds to wait before hiding a Tooltip * after mouseout. * @config hidedelay * @type Number * @default 250 */ this.cfg.addProperty(DEFAULT_CONFIG.HIDE_DELAY.key, { handler: this.configHideDelay, value: DEFAULT_CONFIG.HIDE_DELAY.value, validator: DEFAULT_CONFIG.HIDE_DELAY.validator }); /** * Specifies the Tooltip's text. The text is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source. * @config text * @type HTML * @default null */ this.cfg.addProperty(DEFAULT_CONFIG.TEXT.key, { handler: this.configText, suppressEvent: DEFAULT_CONFIG.TEXT.suppressEvent }); /** * Specifies the container element that the Tooltip's markup * should be rendered into. * @config container * @type HTMLElement/String * @default document.body */ this.cfg.addProperty(DEFAULT_CONFIG.CONTAINER.key, { handler: this.configContainer, value: document.body }); /** * Specifies whether or not the tooltip is disabled. Disabled tooltips * will not be displayed. If the tooltip is driven by the title attribute * of the context element, the title attribute will still be removed for * disabled tooltips, to prevent default tooltip behavior. * * @config disabled * @type Boolean * @default false */ this.cfg.addProperty(DEFAULT_CONFIG.DISABLED.key, { handler: this.configContainer, value: DEFAULT_CONFIG.DISABLED.value, supressEvent: DEFAULT_CONFIG.DISABLED.suppressEvent }); /** * Specifies the XY offset from the mouse position, where the tooltip should be displayed, specified * as a 2 element array (e.g. [10, 20]); * * @config xyoffset * @type Array * @default [0, 25] */ this.cfg.addProperty(DEFAULT_CONFIG.XY_OFFSET.key, { value: DEFAULT_CONFIG.XY_OFFSET.value.concat(), supressEvent: DEFAULT_CONFIG.XY_OFFSET.suppressEvent }); /** * Specifies the element or elements that the Tooltip should be * anchored to on mouseover. * @config context * @type HTMLElement[]/String[] * @default null */ /** * String representing the width of the Tooltip. <em>Please note: * </em> As of version 2.3 if either no value or a value of "auto" * is specified, and the Toolip's "container" configuration property * is set to something other than <code>document.body</code> or * its "context" element resides outside the immediately visible * portion of the document, the width of the Tooltip will be * calculated based on the offsetWidth of its root HTML and set just * before it is made visible. The original value will be * restored when the Tooltip is hidden. This ensures the Tooltip is * rendered at a usable width. For more information see * YUILibrary bug #1685496 and YUILibrary * bug #1735423. * @config width * @type String * @default null */ }, // BEGIN BUILT-IN PROPERTY EVENT HANDLERS // /** * The default event handler fired when the "text" property is changed. * @method configText * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configText: function (type, args, obj) { var text = args[0]; if (text) { this.setBody(text); } }, /** * The default event handler fired when the "container" property * is changed. * @method configContainer * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For * configuration handlers, args[0] will equal the newly applied value * for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configContainer: function (type, args, obj) { var container = args[0]; if (typeof container == 'string') { this.cfg.setProperty("container", document.getElementById(container), true); } }, /** * @method _removeEventListeners * @description Removes all of the DOM event handlers from the HTML * element(s) that trigger the display of the tooltip. * @protected */ _removeEventListeners: function () { var aElements = this._context, nElements, oElement, i; if (aElements) { nElements = aElements.length; if (nElements > 0) { i = nElements - 1; do { oElement = aElements[i]; Event.removeListener(oElement, "mouseover", this.onContextMouseOver); Event.removeListener(oElement, "mousemove", this.onContextMouseMove); Event.removeListener(oElement, "mouseout", this.onContextMouseOut); } while (i--); } } }, /** * The default event handler fired when the "context" property * is changed. * @method configContext * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configContext: function (type, args, obj) { var context = args[0], aElements, nElements, oElement, i; if (context) { // Normalize parameter into an array if (! (context instanceof Array)) { if (typeof context == "string") { this.cfg.setProperty("context", [document.getElementById(context)], true); } else { // Assuming this is an element this.cfg.setProperty("context", [context], true); } context = this.cfg.getProperty("context"); } // Remove any existing mouseover/mouseout listeners this._removeEventListeners(); // Add mouseover/mouseout listeners to context elements this._context = context; aElements = this._context; if (aElements) { nElements = aElements.length; if (nElements > 0) { i = nElements - 1; do { oElement = aElements[i]; Event.on(oElement, "mouseover", this.onContextMouseOver, this); Event.on(oElement, "mousemove", this.onContextMouseMove, this); Event.on(oElement, "mouseout", this.onContextMouseOut, this); } while (i--); } } } }, // END BUILT-IN PROPERTY EVENT HANDLERS // // BEGIN BUILT-IN DOM EVENT HANDLERS // /** * The default event handler fired when the user moves the mouse while * over the context element. * @method onContextMouseMove * @param {DOMEvent} e The current DOM event * @param {Object} obj The object argument */ onContextMouseMove: function (e, obj) { obj.pageX = Event.getPageX(e); obj.pageY = Event.getPageY(e); }, /** * The default event handler fired when the user mouses over the * context element. * @method onContextMouseOver * @param {DOMEvent} e The current DOM event * @param {Object} obj The object argument */ onContextMouseOver: function (e, obj) { var context = this; if (context.title) { obj._tempTitle = context.title; context.title = ""; } // Fire first, to honor disabled set in the listner if (obj.fireEvent("contextMouseOver", context, e) !== false && !obj.cfg.getProperty("disabled")) { // Stop the tooltip from being hidden (set on last mouseout) if (obj.hideProcId) { clearTimeout(obj.hideProcId); obj.hideProcId = null; } Event.on(context, "mousemove", obj.onContextMouseMove, obj); /** * The unique process ID associated with the thread responsible * for showing the Tooltip. * @type int */ obj.showProcId = obj.doShow(e, context); } }, /** * The default event handler fired when the user mouses out of * the context element. * @method onContextMouseOut * @param {DOMEvent} e The current DOM event * @param {Object} obj The object argument */ onContextMouseOut: function (e, obj) { var el = this; if (obj._tempTitle) { el.title = obj._tempTitle; obj._tempTitle = null; } if (obj.showProcId) { clearTimeout(obj.showProcId); obj.showProcId = null; } if (obj.hideProcId) { clearTimeout(obj.hideProcId); obj.hideProcId = null; } obj.fireEvent("contextMouseOut", el, e); obj.hideProcId = setTimeout(function () { obj.hide(); }, obj.cfg.getProperty("hidedelay")); }, // END BUILT-IN DOM EVENT HANDLERS // /** * Processes the showing of the Tooltip by setting the timeout delay * and offset of the Tooltip. * @method doShow * @param {DOMEvent} e The current DOM event * @param {HTMLElement} context The current context element * @return {Number} The process ID of the timeout function associated * with doShow */ doShow: function (e, context) { var offset = this.cfg.getProperty("xyoffset"), xOffset = offset[0], yOffset = offset[1], me = this; if (UA.opera && context.tagName && context.tagName.toUpperCase() == "A") { yOffset += 12; } return setTimeout(function () { var txt = me.cfg.getProperty("text"); // title does not over-ride text if (me._tempTitle && (txt === "" || YAHOO.lang.isUndefined(txt) || YAHOO.lang.isNull(txt))) { me.setBody(me._tempTitle); } else { me.cfg.refireEvent("text"); } me.moveTo(me.pageX + xOffset, me.pageY + yOffset); if (me.cfg.getProperty("preventoverlap")) { me.preventOverlap(me.pageX, me.pageY); } Event.removeListener(context, "mousemove", me.onContextMouseMove); me.contextTriggerEvent.fire(context); me.show(); me.hideProcId = me.doHide(); }, this.cfg.getProperty("showdelay")); }, /** * Sets the timeout for the auto-dismiss delay, which by default is 5 * seconds, meaning that a tooltip will automatically dismiss itself * after 5 seconds of being displayed. * @method doHide */ doHide: function () { var me = this; return setTimeout(function () { me.hide(); }, this.cfg.getProperty("autodismissdelay")); }, /** * Fired when the Tooltip is moved, this event handler is used to * prevent the Tooltip from overlapping with its context element. * @method preventOverlay * @param {Number} pageX The x coordinate position of the mouse pointer * @param {Number} pageY The y coordinate position of the mouse pointer */ preventOverlap: function (pageX, pageY) { var height = this.element.offsetHeight, mousePoint = new YAHOO.util.Point(pageX, pageY), elementRegion = Dom.getRegion(this.element); elementRegion.top -= 5; elementRegion.left -= 5; elementRegion.right += 5; elementRegion.bottom += 5; if (elementRegion.contains(mousePoint)) { this.cfg.setProperty("y", (pageY - height - 5)); } }, /** * @method onRender * @description "render" event handler for the Tooltip. * @param {String} p_sType String representing the name of the event * that was fired. * @param {Array} p_aArgs Array of arguments sent when the event * was fired. */ onRender: function (p_sType, p_aArgs) { function sizeShadow() { var oElement = this.element, oShadow = this.underlay; if (oShadow) { oShadow.style.width = (oElement.offsetWidth + 6) + "px"; oShadow.style.height = (oElement.offsetHeight + 1) + "px"; } } function addShadowVisibleClass() { Dom.addClass(this.underlay, "yui-tt-shadow-visible"); if (UA.ie) { this.forceUnderlayRedraw(); } } function removeShadowVisibleClass() { Dom.removeClass(this.underlay, "yui-tt-shadow-visible"); } function createShadow() { var oShadow = this.underlay, oElement, Module, nIE, me; if (!oShadow) { oElement = this.element; Module = YAHOO.widget.Module; nIE = UA.ie; me = this; if (!m_oShadowTemplate) { m_oShadowTemplate = document.createElement("div"); m_oShadowTemplate.className = "yui-tt-shadow"; } oShadow = m_oShadowTemplate.cloneNode(false); oElement.appendChild(oShadow); this.underlay = oShadow; // Backward compatibility, even though it's probably // intended to be "private", it isn't marked as such in the api docs this._shadow = this.underlay; addShadowVisibleClass.call(this); this.subscribe("beforeShow", addShadowVisibleClass); this.subscribe("hide", removeShadowVisibleClass); if (bIEQuirks) { window.setTimeout(function () { sizeShadow.call(me); }, 0); this.cfg.subscribeToConfigEvent("width", sizeShadow); this.cfg.subscribeToConfigEvent("height", sizeShadow); this.subscribe("changeContent", sizeShadow); Module.textResizeEvent.subscribe(sizeShadow, this, true); this.subscribe("destroy", function () { Module.textResizeEvent.unsubscribe(sizeShadow, this); }); } } } function onBeforeShow() { createShadow.call(this); this.unsubscribe("beforeShow", onBeforeShow); } if (this.cfg.getProperty("visible")) { createShadow.call(this); } else { this.subscribe("beforeShow", onBeforeShow); } }, /** * Forces the underlay element to be repainted, through the application/removal * of a yui-force-redraw class to the underlay element. * * @method forceUnderlayRedraw */ forceUnderlayRedraw : function() { var tt = this; Dom.addClass(tt.underlay, "yui-force-redraw"); setTimeout(function() {Dom.removeClass(tt.underlay, "yui-force-redraw");}, 0); }, /** * Removes the Tooltip element from the DOM and sets all child * elements to null. * @method destroy */ destroy: function () { // Remove any existing mouseover/mouseout listeners this._removeEventListeners(); Tooltip.superclass.destroy.call(this); }, /** * Returns a string representation of the object. * @method toString * @return {String} The string representation of the Tooltip */ toString: function () { return "Tooltip " + this.id; } }); }()); (function () { /** * Panel is an implementation of Overlay that behaves like an OS window, * with a draggable header and an optional close icon at the top right. * @namespace YAHOO.widget * @class Panel * @extends YAHOO.widget.Overlay * @constructor * @param {String} el The element ID representing the Panel <em>OR</em> * @param {HTMLElement} el The element representing the Panel * @param {Object} userConfig The configuration object literal containing * the configuration that should be set for this Panel. See configuration * documentation for more details. */ YAHOO.widget.Panel = function (el, userConfig) { YAHOO.widget.Panel.superclass.constructor.call(this, el, userConfig); }; var _currentModal = null; var Lang = YAHOO.lang, Util = YAHOO.util, Dom = Util.Dom, Event = Util.Event, CustomEvent = Util.CustomEvent, KeyListener = YAHOO.util.KeyListener, Config = Util.Config, Overlay = YAHOO.widget.Overlay, Panel = YAHOO.widget.Panel, UA = YAHOO.env.ua, bIEQuirks = (UA.ie && (UA.ie <= 6 || document.compatMode == "BackCompat")), m_oMaskTemplate, m_oUnderlayTemplate, m_oCloseIconTemplate, /** * Constant representing the name of the Panel's events * @property EVENT_TYPES * @private * @final * @type Object */ EVENT_TYPES = { "BEFORE_SHOW_MASK" : "beforeShowMask", "BEFORE_HIDE_MASK" : "beforeHideMask", "SHOW_MASK": "showMask", "HIDE_MASK": "hideMask", "DRAG": "drag" }, /** * Constant representing the Panel's configuration properties * @property DEFAULT_CONFIG * @private * @final * @type Object */ DEFAULT_CONFIG = { "CLOSE": { key: "close", value: true, validator: Lang.isBoolean, supercedes: ["visible"] }, "DRAGGABLE": { key: "draggable", value: (Util.DD ? true : false), validator: Lang.isBoolean, supercedes: ["visible"] }, "DRAG_ONLY" : { key: "dragonly", value: false, validator: Lang.isBoolean, supercedes: ["draggable"] }, "UNDERLAY": { key: "underlay", value: "shadow", supercedes: ["visible"] }, "MODAL": { key: "modal", value: false, validator: Lang.isBoolean, supercedes: ["visible", "zindex"] }, "KEY_LISTENERS": { key: "keylisteners", suppressEvent: true, supercedes: ["visible"] }, "STRINGS" : { key: "strings", supercedes: ["close"], validator: Lang.isObject, value: { close: "Close" } } }; /** * Constant representing the default CSS class used for a Panel * @property YAHOO.widget.Panel.CSS_PANEL * @static * @final * @type String */ Panel.CSS_PANEL = "yui-panel"; /** * Constant representing the default CSS class used for a Panel's * wrapping container * @property YAHOO.widget.Panel.CSS_PANEL_CONTAINER * @static * @final * @type String */ Panel.CSS_PANEL_CONTAINER = "yui-panel-container"; /** * Constant representing the default set of focusable elements * on the pagewhich Modal Panels will prevent access to, when * the modal mask is displayed * * @property YAHOO.widget.Panel.FOCUSABLE * @static * @type Array */ Panel.FOCUSABLE = [ "a", "button", "select", "textarea", "input", "iframe" ]; // Private CustomEvent listeners /* "beforeRender" event handler that creates an empty header for a Panel instance if its "draggable" configuration property is set to "true" and no header has been created. */ function createHeader(p_sType, p_aArgs) { if (!this.header && this.cfg.getProperty("draggable")) { this.setHeader("&#160;"); } } /* "hide" event handler that sets a Panel instance's "width" configuration property back to its original value before "setWidthToOffsetWidth" was called. */ function restoreOriginalWidth(p_sType, p_aArgs, p_oObject) { var sOriginalWidth = p_oObject[0], sNewWidth = p_oObject[1], oConfig = this.cfg, sCurrentWidth = oConfig.getProperty("width"); if (sCurrentWidth == sNewWidth) { oConfig.setProperty("width", sOriginalWidth); } this.unsubscribe("hide", restoreOriginalWidth, p_oObject); } /* "beforeShow" event handler that sets a Panel instance's "width" configuration property to the value of its root HTML elements's offsetWidth */ function setWidthToOffsetWidth(p_sType, p_aArgs) { var oConfig, sOriginalWidth, sNewWidth; if (bIEQuirks) { oConfig = this.cfg; sOriginalWidth = oConfig.getProperty("width"); if (!sOriginalWidth || sOriginalWidth == "auto") { sNewWidth = (this.element.offsetWidth + "px"); oConfig.setProperty("width", sNewWidth); this.subscribe("hide", restoreOriginalWidth, [(sOriginalWidth || ""), sNewWidth]); } } } YAHOO.extend(Panel, Overlay, { /** * The Overlay initialization method, which is executed for Overlay and * all of its subclasses. This method is automatically called by the * constructor, and sets up all DOM references for pre-existing markup, * and creates required markup if it is not already present. * @method init * @param {String} el The element ID representing the Overlay <em>OR</em> * @param {HTMLElement} el The element representing the Overlay * @param {Object} userConfig The configuration object literal * containing the configuration that should be set for this Overlay. * See configuration documentation for more details. */ init: function (el, userConfig) { /* Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level */ Panel.superclass.init.call(this, el/*, userConfig*/); this.beforeInitEvent.fire(Panel); Dom.addClass(this.element, Panel.CSS_PANEL); this.buildWrapper(); if (userConfig) { this.cfg.applyConfig(userConfig, true); } this.subscribe("showMask", this._addFocusHandlers); this.subscribe("hideMask", this._removeFocusHandlers); this.subscribe("beforeRender", createHeader); this.subscribe("render", function() { this.setFirstLastFocusable(); this.subscribe("changeContent", this.setFirstLastFocusable); }); this.subscribe("show", this._focusOnShow); this.initEvent.fire(Panel); }, /** * @method _onElementFocus * @private * * "focus" event handler for a focuable element. Used to automatically * blur the element when it receives focus to ensure that a Panel * instance's modality is not compromised. * * @param {Event} e The DOM event object */ _onElementFocus : function(e){ if(_currentModal === this) { var target = Event.getTarget(e), doc = document.documentElement, insideDoc = (target !== doc && target !== window); // mask and documentElement checks added for IE, which focuses on the mask when it's clicked on, and focuses on // the documentElement, when the document scrollbars are clicked on if (insideDoc && target !== this.element && target !== this.mask && !Dom.isAncestor(this.element, target)) { try { this._focusFirstModal(); } catch(err){ // Just in case we fail to focus try { if (insideDoc && target !== document.body) { target.blur(); } } catch(err2) { } } } } }, /** * Focuses on the first element if present, otherwise falls back to the focus mechanisms used for * modality. This method does not try/catch focus failures. The caller is responsible for catching exceptions, * and taking remedial measures. * * @method _focusFirstModal */ _focusFirstModal : function() { var el = this.firstElement; if (el) { el.focus(); } else { if (this._modalFocus) { this._modalFocus.focus(); } else { this.innerElement.focus(); } } }, /** * @method _addFocusHandlers * @protected * * "showMask" event handler that adds a "focus" event handler to all * focusable elements in the document to enforce a Panel instance's * modality from being compromised. * * @param p_sType {String} Custom event type * @param p_aArgs {Array} Custom event arguments */ _addFocusHandlers: function(p_sType, p_aArgs) { if (!this.firstElement) { if (UA.webkit || UA.opera) { if (!this._modalFocus) { this._createHiddenFocusElement(); } } else { this.innerElement.tabIndex = 0; } } this._setTabLoop(this.firstElement, this.lastElement); Event.onFocus(document.documentElement, this._onElementFocus, this, true); _currentModal = this; }, /** * Creates a hidden focusable element, used to focus on, * to enforce modality for browsers in which focus cannot * be applied to the container box. * * @method _createHiddenFocusElement * @private */ _createHiddenFocusElement : function() { var e = document.createElement("button"); e.style.height = "1px"; e.style.width = "1px"; e.style.position = "absolute"; e.style.left = "-10000em"; e.style.opacity = 0; e.tabIndex = -1; this.innerElement.appendChild(e); this._modalFocus = e; }, /** * @method _removeFocusHandlers * @protected * * "hideMask" event handler that removes all "focus" event handlers added * by the "addFocusEventHandlers" method. * * @param p_sType {String} Event type * @param p_aArgs {Array} Event Arguments */ _removeFocusHandlers: function(p_sType, p_aArgs) { Event.removeFocusListener(document.documentElement, this._onElementFocus, this); if (_currentModal == this) { _currentModal = null; } }, /** * Focus handler for the show event * * @method _focusOnShow * @param {String} type Event Type * @param {Array} args Event arguments * @param {Object} obj Additional data */ _focusOnShow : function(type, args, obj) { if (args && args[1]) { Event.stopEvent(args[1]); } if (!this.focusFirst(type, args, obj)) { if (this.cfg.getProperty("modal")) { this._focusFirstModal(); } } }, /** * Sets focus to the first element in the Panel. * * @method focusFirst * @return {Boolean} true, if successfully focused, false otherwise */ focusFirst: function (type, args, obj) { var el = this.firstElement, focused = false; if (args && args[1]) { Event.stopEvent(args[1]); } if (el) { try { el.focus(); focused = true; } catch(err) { // Ignore } } return focused; }, /** * Sets focus to the last element in the Panel. * * @method focusLast * @return {Boolean} true, if successfully focused, false otherwise */ focusLast: function (type, args, obj) { var el = this.lastElement, focused = false; if (args && args[1]) { Event.stopEvent(args[1]); } if (el) { try { el.focus(); focused = true; } catch(err) { // Ignore } } return focused; }, /** * Protected internal method for setTabLoop, which can be used by * subclasses to jump in and modify the arguments passed in if required. * * @method _setTabLoop * @param {HTMLElement} firstElement * @param {HTMLElement} lastElement * @protected * */ _setTabLoop : function(firstElement, lastElement) { this.setTabLoop(firstElement, lastElement); }, /** * Sets up a tab, shift-tab loop between the first and last elements * provided. NOTE: Sets up the preventBackTab and preventTabOut KeyListener * instance properties, which are reset everytime this method is invoked. * * @method setTabLoop * @param {HTMLElement} firstElement * @param {HTMLElement} lastElement * */ setTabLoop : function(firstElement, lastElement) { var backTab = this.preventBackTab, tab = this.preventTabOut, showEvent = this.showEvent, hideEvent = this.hideEvent; if (backTab) { backTab.disable(); showEvent.unsubscribe(backTab.enable, backTab); hideEvent.unsubscribe(backTab.disable, backTab); backTab = this.preventBackTab = null; } if (tab) { tab.disable(); showEvent.unsubscribe(tab.enable, tab); hideEvent.unsubscribe(tab.disable,tab); tab = this.preventTabOut = null; } if (firstElement) { this.preventBackTab = new KeyListener(firstElement, {shift:true, keys:9}, {fn:this.focusLast, scope:this, correctScope:true} ); backTab = this.preventBackTab; showEvent.subscribe(backTab.enable, backTab, true); hideEvent.subscribe(backTab.disable,backTab, true); } if (lastElement) { this.preventTabOut = new KeyListener(lastElement, {shift:false, keys:9}, {fn:this.focusFirst, scope:this, correctScope:true} ); tab = this.preventTabOut; showEvent.subscribe(tab.enable, tab, true); hideEvent.subscribe(tab.disable,tab, true); } }, /** * Returns an array of the currently focusable items which reside within * Panel. The set of focusable elements the method looks for are defined * in the Panel.FOCUSABLE static property * * @method getFocusableElements * @param {HTMLElement} root element to start from. */ getFocusableElements : function(root) { root = root || this.innerElement; var focusable = {}, panel = this; for (var i = 0; i < Panel.FOCUSABLE.length; i++) { focusable[Panel.FOCUSABLE[i]] = true; } // Not looking by Tag, since we want elements in DOM order return Dom.getElementsBy(function(el) { return panel._testIfFocusable(el, focusable); }, null, root); }, /** * This is the test method used by getFocusableElements, to determine which elements to * include in the focusable elements list. Users may override this to customize behavior. * * @method _testIfFocusable * @param {Object} el The element being tested * @param {Object} focusable The hash of known focusable elements, created by an array-to-map operation on Panel.FOCUSABLE * @protected */ _testIfFocusable: function(el, focusable) { if (el.focus && el.type !== "hidden" && !el.disabled && focusable[el.tagName.toLowerCase()]) { return true; } return false; }, /** * Sets the firstElement and lastElement instance properties * to the first and last focusable elements in the Panel. * * @method setFirstLastFocusable */ setFirstLastFocusable : function() { this.firstElement = null; this.lastElement = null; var elements = this.getFocusableElements(); this.focusableElements = elements; if (elements.length > 0) { this.firstElement = elements[0]; this.lastElement = elements[elements.length - 1]; } if (this.cfg.getProperty("modal")) { this._setTabLoop(this.firstElement, this.lastElement); } }, /** * Initializes the custom events for Module which are fired * automatically at appropriate times by the Module class. */ initEvents: function () { Panel.superclass.initEvents.call(this); var SIGNATURE = CustomEvent.LIST; /** * CustomEvent fired after the modality mask is shown * @event showMaskEvent */ this.showMaskEvent = this.createEvent(EVENT_TYPES.SHOW_MASK); this.showMaskEvent.signature = SIGNATURE; /** * CustomEvent fired before the modality mask is shown. Subscribers can return false to prevent the * mask from being shown * @event beforeShowMaskEvent */ this.beforeShowMaskEvent = this.createEvent(EVENT_TYPES.BEFORE_SHOW_MASK); this.beforeShowMaskEvent.signature = SIGNATURE; /** * CustomEvent fired after the modality mask is hidden * @event hideMaskEvent */ this.hideMaskEvent = this.createEvent(EVENT_TYPES.HIDE_MASK); this.hideMaskEvent.signature = SIGNATURE; /** * CustomEvent fired before the modality mask is hidden. Subscribers can return false to prevent the * mask from being hidden * @event beforeHideMaskEvent */ this.beforeHideMaskEvent = this.createEvent(EVENT_TYPES.BEFORE_HIDE_MASK); this.beforeHideMaskEvent.signature = SIGNATURE; /** * CustomEvent when the Panel is dragged * @event dragEvent */ this.dragEvent = this.createEvent(EVENT_TYPES.DRAG); this.dragEvent.signature = SIGNATURE; }, /** * Initializes the class's configurable properties which can be changed * using the Panel's Config object (cfg). * @method initDefaultConfig */ initDefaultConfig: function () { Panel.superclass.initDefaultConfig.call(this); // Add panel config properties // /** * True if the Panel should display a "close" button * @config close * @type Boolean * @default true */ this.cfg.addProperty(DEFAULT_CONFIG.CLOSE.key, { handler: this.configClose, value: DEFAULT_CONFIG.CLOSE.value, validator: DEFAULT_CONFIG.CLOSE.validator, supercedes: DEFAULT_CONFIG.CLOSE.supercedes }); /** * Boolean specifying if the Panel should be draggable. The default * value is "true" if the Drag and Drop utility is included, * otherwise it is "false." <strong>PLEASE NOTE:</strong> There is a * known issue in IE 6 (Strict Mode and Quirks Mode) and IE 7 * (Quirks Mode) where Panels that either don't have a value set for * their "width" configuration property, or their "width" * configuration property is set to "auto" will only be draggable by * placing the mouse on the text of the Panel's header element. * To fix this bug, draggable Panels missing a value for their * "width" configuration property, or whose "width" configuration * property is set to "auto" will have it set to the value of * their root HTML element's offsetWidth before they are made * visible. The calculated width is then removed when the Panel is * hidden. <em>This fix is only applied to draggable Panels in IE 6 * (Strict Mode and Quirks Mode) and IE 7 (Quirks Mode)</em>. For * more information on this issue see: * YUILibrary bugs #1726972 and #1589210. * @config draggable * @type Boolean * @default true */ this.cfg.addProperty(DEFAULT_CONFIG.DRAGGABLE.key, { handler: this.configDraggable, value: (Util.DD) ? true : false, validator: DEFAULT_CONFIG.DRAGGABLE.validator, supercedes: DEFAULT_CONFIG.DRAGGABLE.supercedes }); /** * Boolean specifying if the draggable Panel should be drag only, not interacting with drop * targets on the page. * <p> * When set to true, draggable Panels will not check to see if they are over drop targets, * or fire the DragDrop events required to support drop target interaction (onDragEnter, * onDragOver, onDragOut, onDragDrop etc.). * If the Panel is not designed to be dropped on any target elements on the page, then this * flag can be set to true to improve performance. * </p> * <p> * When set to false, all drop target related events will be fired. * </p> * <p> * The property is set to false by default to maintain backwards compatibility but should be * set to true if drop target interaction is not required for the Panel, to improve performance.</p> * * @config dragOnly * @type Boolean * @default false */ this.cfg.addProperty(DEFAULT_CONFIG.DRAG_ONLY.key, { value: DEFAULT_CONFIG.DRAG_ONLY.value, validator: DEFAULT_CONFIG.DRAG_ONLY.validator, supercedes: DEFAULT_CONFIG.DRAG_ONLY.supercedes }); /** * Sets the type of underlay to display for the Panel. Valid values * are "shadow," "matte," and "none". <strong>PLEASE NOTE:</strong> * The creation of the underlay element is deferred until the Panel * is initially made visible. For Gecko-based browsers on Mac * OS X the underlay elment is always created as it is used as a * shim to prevent Aqua scrollbars below a Panel instance from poking * through it (See YUILibrary bug #1723530). * @config underlay * @type String * @default shadow */ this.cfg.addProperty(DEFAULT_CONFIG.UNDERLAY.key, { handler: this.configUnderlay, value: DEFAULT_CONFIG.UNDERLAY.value, supercedes: DEFAULT_CONFIG.UNDERLAY.supercedes }); /** * True if the Panel should be displayed in a modal fashion, * automatically creating a transparent mask over the document that * will not be removed until the Panel is dismissed. * @config modal * @type Boolean * @default false */ this.cfg.addProperty(DEFAULT_CONFIG.MODAL.key, { handler: this.configModal, value: DEFAULT_CONFIG.MODAL.value, validator: DEFAULT_CONFIG.MODAL.validator, supercedes: DEFAULT_CONFIG.MODAL.supercedes }); /** * A KeyListener (or array of KeyListeners) that will be enabled * when the Panel is shown, and disabled when the Panel is hidden. * @config keylisteners * @type YAHOO.util.KeyListener[] * @default null */ this.cfg.addProperty(DEFAULT_CONFIG.KEY_LISTENERS.key, { handler: this.configKeyListeners, suppressEvent: DEFAULT_CONFIG.KEY_LISTENERS.suppressEvent, supercedes: DEFAULT_CONFIG.KEY_LISTENERS.supercedes }); /** * UI Strings used by the Panel. The strings are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source. * * @config strings * @type Object * @default An object literal with the properties shown below: * <dl> * <dt>close</dt><dd><em>HTML</em> : The markup to use as the label for the close icon. Defaults to "Close".</dd> * </dl> */ this.cfg.addProperty(DEFAULT_CONFIG.STRINGS.key, { value:DEFAULT_CONFIG.STRINGS.value, handler:this.configStrings, validator:DEFAULT_CONFIG.STRINGS.validator, supercedes:DEFAULT_CONFIG.STRINGS.supercedes }); }, // BEGIN BUILT-IN PROPERTY EVENT HANDLERS // /** * The default event handler fired when the "close" property is changed. * The method controls the appending or hiding of the close icon at the * top right of the Panel. * @method configClose * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configClose: function (type, args, obj) { var val = args[0], oClose = this.close, strings = this.cfg.getProperty("strings"), fc; if (val) { if (!oClose) { if (!m_oCloseIconTemplate) { m_oCloseIconTemplate = document.createElement("a"); m_oCloseIconTemplate.className = "container-close"; m_oCloseIconTemplate.href = "#"; } oClose = m_oCloseIconTemplate.cloneNode(true); fc = this.innerElement.firstChild; if (fc) { this.innerElement.insertBefore(oClose, fc); } else { this.innerElement.appendChild(oClose); } oClose.innerHTML = (strings && strings.close) ? strings.close : "&#160;"; Event.on(oClose, "click", this._doClose, this, true); this.close = oClose; } else { oClose.style.display = "block"; } } else { if (oClose) { oClose.style.display = "none"; } } }, /** * Event handler for the close icon * * @method _doClose * @protected * * @param {DOMEvent} e */ _doClose : function (e) { Event.preventDefault(e); this.hide(); }, /** * The default event handler fired when the "draggable" property * is changed. * @method configDraggable * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configDraggable: function (type, args, obj) { var val = args[0]; if (val) { if (!Util.DD) { this.cfg.setProperty("draggable", false); return; } if (this.header) { Dom.setStyle(this.header, "cursor", "move"); this.registerDragDrop(); } this.subscribe("beforeShow", setWidthToOffsetWidth); } else { if (this.dd) { this.dd.unreg(); } if (this.header) { Dom.setStyle(this.header,"cursor","auto"); } this.unsubscribe("beforeShow", setWidthToOffsetWidth); } }, /** * The default event handler fired when the "underlay" property * is changed. * @method configUnderlay * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configUnderlay: function (type, args, obj) { var bMacGecko = (this.platform == "mac" && UA.gecko), sUnderlay = args[0].toLowerCase(), oUnderlay = this.underlay, oElement = this.element; function createUnderlay() { var bNew = false; if (!oUnderlay) { // create if not already in DOM if (!m_oUnderlayTemplate) { m_oUnderlayTemplate = document.createElement("div"); m_oUnderlayTemplate.className = "underlay"; } oUnderlay = m_oUnderlayTemplate.cloneNode(false); this.element.appendChild(oUnderlay); this.underlay = oUnderlay; if (bIEQuirks) { this.sizeUnderlay(); this.cfg.subscribeToConfigEvent("width", this.sizeUnderlay); this.cfg.subscribeToConfigEvent("height", this.sizeUnderlay); this.changeContentEvent.subscribe(this.sizeUnderlay); YAHOO.widget.Module.textResizeEvent.subscribe(this.sizeUnderlay, this, true); } if (UA.webkit && UA.webkit < 420) { this.changeContentEvent.subscribe(this.forceUnderlayRedraw); } bNew = true; } } function onBeforeShow() { var bNew = createUnderlay.call(this); if (!bNew && bIEQuirks) { this.sizeUnderlay(); } this._underlayDeferred = false; this.beforeShowEvent.unsubscribe(onBeforeShow); } function destroyUnderlay() { if (this._underlayDeferred) { this.beforeShowEvent.unsubscribe(onBeforeShow); this._underlayDeferred = false; } if (oUnderlay) { this.cfg.unsubscribeFromConfigEvent("width", this.sizeUnderlay); this.cfg.unsubscribeFromConfigEvent("height",this.sizeUnderlay); this.changeContentEvent.unsubscribe(this.sizeUnderlay); this.changeContentEvent.unsubscribe(this.forceUnderlayRedraw); YAHOO.widget.Module.textResizeEvent.unsubscribe(this.sizeUnderlay, this, true); this.element.removeChild(oUnderlay); this.underlay = null; } } switch (sUnderlay) { case "shadow": Dom.removeClass(oElement, "matte"); Dom.addClass(oElement, "shadow"); break; case "matte": if (!bMacGecko) { destroyUnderlay.call(this); } Dom.removeClass(oElement, "shadow"); Dom.addClass(oElement, "matte"); break; default: if (!bMacGecko) { destroyUnderlay.call(this); } Dom.removeClass(oElement, "shadow"); Dom.removeClass(oElement, "matte"); break; } if ((sUnderlay == "shadow") || (bMacGecko && !oUnderlay)) { if (this.cfg.getProperty("visible")) { var bNew = createUnderlay.call(this); if (!bNew && bIEQuirks) { this.sizeUnderlay(); } } else { if (!this._underlayDeferred) { this.beforeShowEvent.subscribe(onBeforeShow); this._underlayDeferred = true; } } } }, /** * The default event handler fired when the "modal" property is * changed. This handler subscribes or unsubscribes to the show and hide * events to handle the display or hide of the modality mask. * @method configModal * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configModal: function (type, args, obj) { var modal = args[0]; if (modal) { if (!this._hasModalityEventListeners) { this.subscribe("beforeShow", this.buildMask); this.subscribe("beforeShow", this.bringToTop); this.subscribe("beforeShow", this.showMask); this.subscribe("hide", this.hideMask); Overlay.windowResizeEvent.subscribe(this.sizeMask, this, true); this._hasModalityEventListeners = true; } } else { if (this._hasModalityEventListeners) { if (this.cfg.getProperty("visible")) { this.hideMask(); this.removeMask(); } this.unsubscribe("beforeShow", this.buildMask); this.unsubscribe("beforeShow", this.bringToTop); this.unsubscribe("beforeShow", this.showMask); this.unsubscribe("hide", this.hideMask); Overlay.windowResizeEvent.unsubscribe(this.sizeMask, this); this._hasModalityEventListeners = false; } } }, /** * Removes the modality mask. * @method removeMask */ removeMask: function () { var oMask = this.mask, oParentNode; if (oMask) { /* Hide the mask before destroying it to ensure that DOM event handlers on focusable elements get removed. */ this.hideMask(); oParentNode = oMask.parentNode; if (oParentNode) { oParentNode.removeChild(oMask); } this.mask = null; } }, /** * The default event handler fired when the "keylisteners" property * is changed. * @method configKeyListeners * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configKeyListeners: function (type, args, obj) { var listeners = args[0], listener, nListeners, i; if (listeners) { if (listeners instanceof Array) { nListeners = listeners.length; for (i = 0; i < nListeners; i++) { listener = listeners[i]; if (!Config.alreadySubscribed(this.showEvent, listener.enable, listener)) { this.showEvent.subscribe(listener.enable, listener, true); } if (!Config.alreadySubscribed(this.hideEvent, listener.disable, listener)) { this.hideEvent.subscribe(listener.disable, listener, true); this.destroyEvent.subscribe(listener.disable, listener, true); } } } else { if (!Config.alreadySubscribed(this.showEvent, listeners.enable, listeners)) { this.showEvent.subscribe(listeners.enable, listeners, true); } if (!Config.alreadySubscribed(this.hideEvent, listeners.disable, listeners)) { this.hideEvent.subscribe(listeners.disable, listeners, true); this.destroyEvent.subscribe(listeners.disable, listeners, true); } } } }, /** * The default handler for the "strings" property * @method configStrings */ configStrings : function(type, args, obj) { var val = Lang.merge(DEFAULT_CONFIG.STRINGS.value, args[0]); this.cfg.setProperty(DEFAULT_CONFIG.STRINGS.key, val, true); }, /** * The default event handler fired when the "height" property is changed. * @method configHeight * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configHeight: function (type, args, obj) { var height = args[0], el = this.innerElement; Dom.setStyle(el, "height", height); this.cfg.refireEvent("iframe"); }, /** * The default custom event handler executed when the Panel's height is changed, * if the autofillheight property has been set. * * @method _autoFillOnHeightChange * @protected * @param {String} type The event type * @param {Array} args The array of arguments passed to event subscribers * @param {HTMLElement} el The header, body or footer element which is to be resized to fill * out the containers height */ _autoFillOnHeightChange : function(type, args, el) { Panel.superclass._autoFillOnHeightChange.apply(this, arguments); if (bIEQuirks) { var panel = this; setTimeout(function() { panel.sizeUnderlay(); },0); } }, /** * The default event handler fired when the "width" property is changed. * @method configWidth * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configWidth: function (type, args, obj) { var width = args[0], el = this.innerElement; Dom.setStyle(el, "width", width); this.cfg.refireEvent("iframe"); }, /** * The default event handler fired when the "zIndex" property is changed. * @method configzIndex * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configzIndex: function (type, args, obj) { Panel.superclass.configzIndex.call(this, type, args, obj); if (this.mask || this.cfg.getProperty("modal") === true) { var panelZ = Dom.getStyle(this.element, "zIndex"); if (!panelZ || isNaN(panelZ)) { panelZ = 0; } if (panelZ === 0) { // Recursive call to configzindex (which should be stopped // from going further because panelZ should no longer === 0) this.cfg.setProperty("zIndex", 1); } else { this.stackMask(); } } }, // END BUILT-IN PROPERTY EVENT HANDLERS // /** * Builds the wrapping container around the Panel that is used for * positioning the shadow and matte underlays. The container element is * assigned to a local instance variable called container, and the * element is reinserted inside of it. * @method buildWrapper */ buildWrapper: function () { var elementParent = this.element.parentNode, originalElement = this.element, wrapper = document.createElement("div"); wrapper.className = Panel.CSS_PANEL_CONTAINER; wrapper.id = originalElement.id + "_c"; if (elementParent) { elementParent.insertBefore(wrapper, originalElement); } wrapper.appendChild(originalElement); this.element = wrapper; this.innerElement = originalElement; Dom.setStyle(this.innerElement, "visibility", "inherit"); }, /** * Adjusts the size of the shadow based on the size of the element. * @method sizeUnderlay */ sizeUnderlay: function () { var oUnderlay = this.underlay, oElement; if (oUnderlay) { oElement = this.element; oUnderlay.style.width = oElement.offsetWidth + "px"; oUnderlay.style.height = oElement.offsetHeight + "px"; } }, /** * Registers the Panel's header for drag & drop capability. * @method registerDragDrop */ registerDragDrop: function () { var me = this; if (this.header) { if (!Util.DD) { return; } var bDragOnly = (this.cfg.getProperty("dragonly") === true); /** * The YAHOO.util.DD instance, used to implement the draggable header for the panel if draggable is enabled * * @property dd * @type YAHOO.util.DD */ this.dd = new Util.DD(this.element.id, this.id, {dragOnly: bDragOnly}); if (!this.header.id) { this.header.id = this.id + "_h"; } this.dd.startDrag = function () { var offsetHeight, offsetWidth, viewPortWidth, viewPortHeight, scrollX, scrollY; if (YAHOO.env.ua.ie == 6) { Dom.addClass(me.element,"drag"); } if (me.cfg.getProperty("constraintoviewport")) { var nViewportOffset = Overlay.VIEWPORT_OFFSET; offsetHeight = me.element.offsetHeight; offsetWidth = me.element.offsetWidth; viewPortWidth = Dom.getViewportWidth(); viewPortHeight = Dom.getViewportHeight(); scrollX = Dom.getDocumentScrollLeft(); scrollY = Dom.getDocumentScrollTop(); if (offsetHeight + nViewportOffset < viewPortHeight) { this.minY = scrollY + nViewportOffset; this.maxY = scrollY + viewPortHeight - offsetHeight - nViewportOffset; } else { this.minY = scrollY + nViewportOffset; this.maxY = scrollY + nViewportOffset; } if (offsetWidth + nViewportOffset < viewPortWidth) { this.minX = scrollX + nViewportOffset; this.maxX = scrollX + viewPortWidth - offsetWidth - nViewportOffset; } else { this.minX = scrollX + nViewportOffset; this.maxX = scrollX + nViewportOffset; } this.constrainX = true; this.constrainY = true; } else { this.constrainX = false; this.constrainY = false; } me.dragEvent.fire("startDrag", arguments); }; this.dd.onDrag = function () { me.syncPosition(); me.cfg.refireEvent("iframe"); if (this.platform == "mac" && YAHOO.env.ua.gecko) { this.showMacGeckoScrollbars(); } me.dragEvent.fire("onDrag", arguments); }; this.dd.endDrag = function () { if (YAHOO.env.ua.ie == 6) { Dom.removeClass(me.element,"drag"); } me.dragEvent.fire("endDrag", arguments); me.moveEvent.fire(me.cfg.getProperty("xy")); }; this.dd.setHandleElId(this.header.id); this.dd.addInvalidHandleType("INPUT"); this.dd.addInvalidHandleType("SELECT"); this.dd.addInvalidHandleType("TEXTAREA"); } }, /** * Builds the mask that is laid over the document when the Panel is * configured to be modal. * @method buildMask */ buildMask: function () { var oMask = this.mask; if (!oMask) { if (!m_oMaskTemplate) { m_oMaskTemplate = document.createElement("div"); m_oMaskTemplate.className = "mask"; m_oMaskTemplate.innerHTML = "&#160;"; } oMask = m_oMaskTemplate.cloneNode(true); oMask.id = this.id + "_mask"; document.body.insertBefore(oMask, document.body.firstChild); this.mask = oMask; if (YAHOO.env.ua.gecko && this.platform == "mac") { Dom.addClass(this.mask, "block-scrollbars"); } // Stack mask based on the element zindex this.stackMask(); } }, /** * Hides the modality mask. * @method hideMask */ hideMask: function () { if (this.cfg.getProperty("modal") && this.mask && this.beforeHideMaskEvent.fire()) { this.mask.style.display = "none"; Dom.removeClass(document.body, "masked"); this.hideMaskEvent.fire(); } }, /** * Shows the modality mask. * @method showMask */ showMask: function () { if (this.cfg.getProperty("modal") && this.mask && this.beforeShowMaskEvent.fire()) { Dom.addClass(document.body, "masked"); this.sizeMask(); this.mask.style.display = "block"; this.showMaskEvent.fire(); } }, /** * Sets the size of the modality mask to cover the entire scrollable * area of the document * @method sizeMask */ sizeMask: function () { if (this.mask) { // Shrink mask first, so it doesn't affect the document size. var mask = this.mask, viewWidth = Dom.getViewportWidth(), viewHeight = Dom.getViewportHeight(); if (mask.offsetHeight > viewHeight) { mask.style.height = viewHeight + "px"; } if (mask.offsetWidth > viewWidth) { mask.style.width = viewWidth + "px"; } // Then size it to the document mask.style.height = Dom.getDocumentHeight() + "px"; mask.style.width = Dom.getDocumentWidth() + "px"; } }, /** * Sets the zindex of the mask, if it exists, based on the zindex of * the Panel element. The zindex of the mask is set to be one less * than the Panel element's zindex. * * <p>NOTE: This method will not bump up the zindex of the Panel * to ensure that the mask has a non-negative zindex. If you require the * mask zindex to be 0 or higher, the zindex of the Panel * should be set to a value higher than 0, before this method is called. * </p> * @method stackMask */ stackMask: function() { if (this.mask) { var panelZ = Dom.getStyle(this.element, "zIndex"); if (!YAHOO.lang.isUndefined(panelZ) && !isNaN(panelZ)) { Dom.setStyle(this.mask, "zIndex", panelZ - 1); } } }, /** * Renders the Panel by inserting the elements that are not already in * the main Panel into their correct places. Optionally appends the * Panel to the specified node prior to the render's execution. NOTE: * For Panels without existing markup, the appendToNode argument is * REQUIRED. If this argument is ommitted and the current element is * not present in the document, the function will return false, * indicating that the render was a failure. * @method render * @param {String} appendToNode The element id to which the Module * should be appended to prior to rendering <em>OR</em> * @param {HTMLElement} appendToNode The element to which the Module * should be appended to prior to rendering * @return {boolean} Success or failure of the render */ render: function (appendToNode) { return Panel.superclass.render.call(this, appendToNode, this.innerElement); }, /** * Renders the currently set header into it's proper position under the * module element. If the module element is not provided, "this.innerElement" * is used. * * @method _renderHeader * @protected * @param {HTMLElement} moduleElement Optional. A reference to the module element */ _renderHeader: function(moduleElement){ moduleElement = moduleElement || this.innerElement; Panel.superclass._renderHeader.call(this, moduleElement); }, /** * Renders the currently set body into it's proper position under the * module element. If the module element is not provided, "this.innerElement" * is used. * * @method _renderBody * @protected * @param {HTMLElement} moduleElement Optional. A reference to the module element. */ _renderBody: function(moduleElement){ moduleElement = moduleElement || this.innerElement; Panel.superclass._renderBody.call(this, moduleElement); }, /** * Renders the currently set footer into it's proper position under the * module element. If the module element is not provided, "this.innerElement" * is used. * * @method _renderFooter * @protected * @param {HTMLElement} moduleElement Optional. A reference to the module element */ _renderFooter: function(moduleElement){ moduleElement = moduleElement || this.innerElement; Panel.superclass._renderFooter.call(this, moduleElement); }, /** * Removes the Panel element from the DOM and sets all child elements * to null. * @method destroy * @param {boolean} shallowPurge If true, only the parent element's DOM event listeners are purged. If false, or not provided, all children are also purged of DOM event listeners. * NOTE: The flag is a "shallowPurge" flag, as opposed to what may be a more intuitive "purgeChildren" flag to maintain backwards compatibility with behavior prior to 2.9.0. */ destroy: function (shallowPurge) { Overlay.windowResizeEvent.unsubscribe(this.sizeMask, this); this.removeMask(); if (this.close) { Event.purgeElement(this.close); } Panel.superclass.destroy.call(this, shallowPurge); }, /** * Forces the underlay element to be repainted through the application/removal * of a yui-force-redraw class to the underlay element. * * @method forceUnderlayRedraw */ forceUnderlayRedraw : function () { var u = this.underlay; Dom.addClass(u, "yui-force-redraw"); setTimeout(function(){Dom.removeClass(u, "yui-force-redraw");}, 0); }, /** * Returns a String representation of the object. * @method toString * @return {String} The string representation of the Panel. */ toString: function () { return "Panel " + this.id; } }); }()); (function () { /** * <p> * Dialog is an implementation of Panel that can be used to submit form * data. * </p> * <p> * Built-in functionality for buttons with event handlers is included. * If the optional YUI Button dependancy is included on the page, the buttons * created will be instances of YAHOO.widget.Button, otherwise regular HTML buttons * will be created. * </p> * <p> * Forms can be processed in 3 ways -- via an asynchronous Connection utility call, * a simple form POST or GET, or manually. The YUI Connection utility should be * included if you're using the default "async" postmethod, but is not required if * you're using any of the other postmethod values. * </p> * @namespace YAHOO.widget * @class Dialog * @extends YAHOO.widget.Panel * @constructor * @param {String} el The element ID representing the Dialog <em>OR</em> * @param {HTMLElement} el The element representing the Dialog * @param {Object} userConfig The configuration object literal containing * the configuration that should be set for this Dialog. See configuration * documentation for more details. */ YAHOO.widget.Dialog = function (el, userConfig) { YAHOO.widget.Dialog.superclass.constructor.call(this, el, userConfig); }; var Event = YAHOO.util.Event, CustomEvent = YAHOO.util.CustomEvent, Dom = YAHOO.util.Dom, Dialog = YAHOO.widget.Dialog, Lang = YAHOO.lang, /** * Constant representing the name of the Dialog's events * @property EVENT_TYPES * @private * @final * @type Object */ EVENT_TYPES = { "BEFORE_SUBMIT": "beforeSubmit", "SUBMIT": "submit", "MANUAL_SUBMIT": "manualSubmit", "ASYNC_SUBMIT": "asyncSubmit", "FORM_SUBMIT": "formSubmit", "CANCEL": "cancel" }, /** * Constant representing the Dialog's configuration properties * @property DEFAULT_CONFIG * @private * @final * @type Object */ DEFAULT_CONFIG = { "POST_METHOD": { key: "postmethod", value: "async" }, "POST_DATA" : { key: "postdata", value: null }, "BUTTONS": { key: "buttons", value: "none", supercedes: ["visible"] }, "HIDEAFTERSUBMIT" : { key: "hideaftersubmit", value: true } }; /** * Constant representing the default CSS class used for a Dialog * @property YAHOO.widget.Dialog.CSS_DIALOG * @static * @final * @type String */ Dialog.CSS_DIALOG = "yui-dialog"; function removeButtonEventHandlers() { var aButtons = this._aButtons, nButtons, oButton, i; if (Lang.isArray(aButtons)) { nButtons = aButtons.length; if (nButtons > 0) { i = nButtons - 1; do { oButton = aButtons[i]; if (YAHOO.widget.Button && oButton instanceof YAHOO.widget.Button) { oButton.destroy(); } else if (oButton.tagName.toUpperCase() == "BUTTON") { Event.purgeElement(oButton); Event.purgeElement(oButton, false); } } while (i--); } } } YAHOO.extend(Dialog, YAHOO.widget.Panel, { /** * @property form * @description Object reference to the Dialog's * <code>&#60;form&#62;</code> element. * @default null * @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/ * level-one-html.html#ID-40002357">HTMLFormElement</a> */ form: null, /** * Initializes the class's configurable properties which can be changed * using the Dialog's Config object (cfg). * @method initDefaultConfig */ initDefaultConfig: function () { Dialog.superclass.initDefaultConfig.call(this); /** * The internally maintained callback object for use with the * Connection utility. The format of the callback object is * similar to Connection Manager's callback object and is * simply passed through to Connection Manager when the async * request is made. * @property callback * @type Object */ this.callback = { /** * The function to execute upon success of the * Connection submission (when the form does not * contain a file input element). * * @property callback.success * @type Function */ success: null, /** * The function to execute upon failure of the * Connection submission * @property callback.failure * @type Function */ failure: null, /** *<p> * The function to execute upon success of the * Connection submission, when the form contains * a file input element. * </p> * <p> * <em>NOTE:</em> Connection manager will not * invoke the success or failure handlers for the file * upload use case. This will be the only callback * handler invoked. * </p> * <p> * For more information, see the <a href="http://developer.yahoo.com/yui/connection/#file"> * Connection Manager documenation on file uploads</a>. * </p> * @property callback.upload * @type Function */ /** * The arbitrary argument or arguments to pass to the Connection * callback functions * @property callback.argument * @type Object */ argument: null }; // Add form dialog config properties // /** * The method to use for posting the Dialog's form. Possible values * are "async", "form", and "manual". * @config postmethod * @type String * @default async */ this.cfg.addProperty(DEFAULT_CONFIG.POST_METHOD.key, { handler: this.configPostMethod, value: DEFAULT_CONFIG.POST_METHOD.value, validator: function (val) { if (val != "form" && val != "async" && val != "none" && val != "manual") { return false; } else { return true; } } }); /** * Any additional post data which needs to be sent when using the * <a href="#config_postmethod">async</a> postmethod for dialog POST submissions. * The format for the post data string is defined by Connection Manager's * <a href="YAHOO.util.Connect.html#method_asyncRequest">asyncRequest</a> * method. * @config postdata * @type String * @default null */ this.cfg.addProperty(DEFAULT_CONFIG.POST_DATA.key, { value: DEFAULT_CONFIG.POST_DATA.value }); /** * This property is used to configure whether or not the * dialog should be automatically hidden after submit. * * @config hideaftersubmit * @type Boolean * @default true */ this.cfg.addProperty(DEFAULT_CONFIG.HIDEAFTERSUBMIT.key, { value: DEFAULT_CONFIG.HIDEAFTERSUBMIT.value }); /** * Array of object literals, each containing a set of properties * defining a button to be appended into the Dialog's footer. * * <p>Each button object in the buttons array can have three properties:</p> * <dl> * <dt>text:</dt> * <dd> * The text that will display on the face of the button. The text can * include HTML, as long as it is compliant with HTML Button specifications. The text is added to the DOM as HTML, * and should be escaped by the implementor if coming from an external source. * </dd> * <dt>handler:</dt> * <dd>Can be either: * <ol> * <li>A reference to a function that should fire when the * button is clicked. (In this case scope of this function is * always its Dialog instance.)</li> * * <li>An object literal representing the code to be * executed when the button is clicked. * * <p>Format:</p> * * <p> * <code>{ * <br> * <strong>fn:</strong> Function, &#47;&#47; * The handler to call when the event fires. * <br> * <strong>obj:</strong> Object, &#47;&#47; * An object to pass back to the handler. * <br> * <strong>scope:</strong> Object &#47;&#47; * The object to use for the scope of the handler. * <br> * }</code> * </p> * </li> * </ol> * </dd> * <dt>isDefault:</dt> * <dd> * An optional boolean value that specifies that a button * should be highlighted and focused by default. * </dd> * </dl> * * <em>NOTE:</em>If the YUI Button Widget is included on the page, * the buttons created will be instances of YAHOO.widget.Button. * Otherwise, HTML Buttons (<code>&#60;BUTTON&#62;</code>) will be * created. * * @config buttons * @type {Array|String} * @default "none" */ this.cfg.addProperty(DEFAULT_CONFIG.BUTTONS.key, { handler: this.configButtons, value: DEFAULT_CONFIG.BUTTONS.value, supercedes : DEFAULT_CONFIG.BUTTONS.supercedes }); }, /** * Initializes the custom events for Dialog which are fired * automatically at appropriate times by the Dialog class. * @method initEvents */ initEvents: function () { Dialog.superclass.initEvents.call(this); var SIGNATURE = CustomEvent.LIST; /** * CustomEvent fired prior to submission * @event beforeSubmitEvent */ this.beforeSubmitEvent = this.createEvent(EVENT_TYPES.BEFORE_SUBMIT); this.beforeSubmitEvent.signature = SIGNATURE; /** * CustomEvent fired after submission * @event submitEvent */ this.submitEvent = this.createEvent(EVENT_TYPES.SUBMIT); this.submitEvent.signature = SIGNATURE; /** * CustomEvent fired for manual submission, before the generic submit event is fired * @event manualSubmitEvent */ this.manualSubmitEvent = this.createEvent(EVENT_TYPES.MANUAL_SUBMIT); this.manualSubmitEvent.signature = SIGNATURE; /** * CustomEvent fired after asynchronous submission, before the generic submit event is fired * * @event asyncSubmitEvent * @param {Object} conn The connection object, returned by YAHOO.util.Connect.asyncRequest */ this.asyncSubmitEvent = this.createEvent(EVENT_TYPES.ASYNC_SUBMIT); this.asyncSubmitEvent.signature = SIGNATURE; /** * CustomEvent fired after form-based submission, before the generic submit event is fired * @event formSubmitEvent */ this.formSubmitEvent = this.createEvent(EVENT_TYPES.FORM_SUBMIT); this.formSubmitEvent.signature = SIGNATURE; /** * CustomEvent fired after cancel * @event cancelEvent */ this.cancelEvent = this.createEvent(EVENT_TYPES.CANCEL); this.cancelEvent.signature = SIGNATURE; }, /** * The Dialog initialization method, which is executed for Dialog and * all of its subclasses. This method is automatically called by the * constructor, and sets up all DOM references for pre-existing markup, * and creates required markup if it is not already present. * * @method init * @param {String} el The element ID representing the Dialog <em>OR</em> * @param {HTMLElement} el The element representing the Dialog * @param {Object} userConfig The configuration object literal * containing the configuration that should be set for this Dialog. * See configuration documentation for more details. */ init: function (el, userConfig) { /* Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level */ Dialog.superclass.init.call(this, el/*, userConfig*/); this.beforeInitEvent.fire(Dialog); Dom.addClass(this.element, Dialog.CSS_DIALOG); this.cfg.setProperty("visible", false); if (userConfig) { this.cfg.applyConfig(userConfig, true); } //this.showEvent.subscribe(this.focusFirst, this, true); this.beforeHideEvent.subscribe(this.blurButtons, this, true); this.subscribe("changeBody", this.registerForm); this.initEvent.fire(Dialog); }, /** * Submits the Dialog's form depending on the value of the * "postmethod" configuration property. <strong>Please note: * </strong> As of version 2.3 this method will automatically handle * asyncronous file uploads should the Dialog instance's form contain * <code>&#60;input type="file"&#62;</code> elements. If a Dialog * instance will be handling asyncronous file uploads, its * <code>callback</code> property will need to be setup with a * <code>upload</code> handler rather than the standard * <code>success</code> and, or <code>failure</code> handlers. For more * information, see the <a href="http://developer.yahoo.com/yui/ * connection/#file">Connection Manager documenation on file uploads</a>. * @method doSubmit */ doSubmit: function () { var Connect = YAHOO.util.Connect, oForm = this.form, bUseFileUpload = false, bUseSecureFileUpload = false, aElements, nElements, i, formAttrs; switch (this.cfg.getProperty("postmethod")) { case "async": aElements = oForm.elements; nElements = aElements.length; if (nElements > 0) { i = nElements - 1; do { if (aElements[i].type == "file") { bUseFileUpload = true; break; } } while(i--); } if (bUseFileUpload && YAHOO.env.ua.ie && this.isSecure) { bUseSecureFileUpload = true; } formAttrs = this._getFormAttributes(oForm); Connect.setForm(oForm, bUseFileUpload, bUseSecureFileUpload); var postData = this.cfg.getProperty("postdata"); var c = Connect.asyncRequest(formAttrs.method, formAttrs.action, this.callback, postData); this.asyncSubmitEvent.fire(c); break; case "form": oForm.submit(); this.formSubmitEvent.fire(); break; case "none": case "manual": this.manualSubmitEvent.fire(); break; } }, /** * Retrieves important attributes (currently method and action) from * the form element, accounting for any elements which may have the same name * as the attributes. Defaults to "POST" and "" for method and action respectively * if the attribute cannot be retrieved. * * @method _getFormAttributes * @protected * @param {HTMLFormElement} oForm The HTML Form element from which to retrieve the attributes * @return {Object} Object literal, with method and action String properties. */ _getFormAttributes : function(oForm){ var attrs = { method : null, action : null }; if (oForm) { if (oForm.getAttributeNode) { var action = oForm.getAttributeNode("action"); var method = oForm.getAttributeNode("method"); if (action) { attrs.action = action.value; } if (method) { attrs.method = method.value; } } else { attrs.action = oForm.getAttribute("action"); attrs.method = oForm.getAttribute("method"); } } attrs.method = (Lang.isString(attrs.method) ? attrs.method : "POST").toUpperCase(); attrs.action = Lang.isString(attrs.action) ? attrs.action : ""; return attrs; }, /** * Prepares the Dialog's internal FORM object, creating one if one is * not currently present. * @method registerForm */ registerForm: function() { var form = this.element.getElementsByTagName("form")[0]; if (this.form) { if (this.form == form && Dom.isAncestor(this.element, this.form)) { return; } else { Event.purgeElement(this.form); this.form = null; } } if (!form) { form = document.createElement("form"); form.name = "frm_" + this.id; this.body.appendChild(form); } if (form) { this.form = form; Event.on(form, "submit", this._submitHandler, this, true); } }, /** * Internal handler for the form submit event * * @method _submitHandler * @protected * @param {DOMEvent} e The DOM Event object */ _submitHandler : function(e) { Event.stopEvent(e); this.submit(); this.form.blur(); }, /** * Sets up a tab, shift-tab loop between the first and last elements * provided. NOTE: Sets up the preventBackTab and preventTabOut KeyListener * instance properties, which are reset everytime this method is invoked. * * @method setTabLoop * @param {HTMLElement} firstElement * @param {HTMLElement} lastElement * */ setTabLoop : function(firstElement, lastElement) { firstElement = firstElement || this.firstButton; lastElement = lastElement || this.lastButton; Dialog.superclass.setTabLoop.call(this, firstElement, lastElement); }, /** * Protected internal method for setTabLoop, which can be used by * subclasses to jump in and modify the arguments passed in if required. * * @method _setTabLoop * @param {HTMLElement} firstElement * @param {HTMLElement} lastElement * @protected */ _setTabLoop : function(firstElement, lastElement) { firstElement = firstElement || this.firstButton; lastElement = this.lastButton || lastElement; this.setTabLoop(firstElement, lastElement); }, /** * Configures instance properties, pointing to the * first and last focusable elements in the Dialog's form. * * @method setFirstLastFocusable */ setFirstLastFocusable : function() { Dialog.superclass.setFirstLastFocusable.call(this); var i, l, el, elements = this.focusableElements; this.firstFormElement = null; this.lastFormElement = null; if (this.form && elements && elements.length > 0) { l = elements.length; for (i = 0; i < l; ++i) { el = elements[i]; if (this.form === el.form) { this.firstFormElement = el; break; } } for (i = l-1; i >= 0; --i) { el = elements[i]; if (this.form === el.form) { this.lastFormElement = el; break; } } } }, // BEGIN BUILT-IN PROPERTY EVENT HANDLERS // /** * The default event handler fired when the "close" property is * changed. The method controls the appending or hiding of the close * icon at the top right of the Dialog. * @method configClose * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For * configuration handlers, args[0] will equal the newly applied value * for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configClose: function (type, args, obj) { Dialog.superclass.configClose.apply(this, arguments); }, /** * Event handler for the close icon * * @method _doClose * @protected * * @param {DOMEvent} e */ _doClose : function(e) { Event.preventDefault(e); this.cancel(); }, /** * The default event handler for the "buttons" configuration property * @method configButtons * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configButtons: function (type, args, obj) { var Button = YAHOO.widget.Button, aButtons = args[0], oInnerElement = this.innerElement, oButton, oButtonEl, oYUIButton, nButtons, oSpan, oFooter, i; removeButtonEventHandlers.call(this); this._aButtons = null; if (Lang.isArray(aButtons)) { oSpan = document.createElement("span"); oSpan.className = "button-group"; nButtons = aButtons.length; this._aButtons = []; this.defaultHtmlButton = null; for (i = 0; i < nButtons; i++) { oButton = aButtons[i]; if (Button) { oYUIButton = new Button({ label: oButton.text, type:oButton.type }); oYUIButton.appendTo(oSpan); oButtonEl = oYUIButton.get("element"); if (oButton.isDefault) { oYUIButton.addClass("default"); this.defaultHtmlButton = oButtonEl; } if (Lang.isFunction(oButton.handler)) { oYUIButton.set("onclick", { fn: oButton.handler, obj: this, scope: this }); } else if (Lang.isObject(oButton.handler) && Lang.isFunction(oButton.handler.fn)) { oYUIButton.set("onclick", { fn: oButton.handler.fn, obj: ((!Lang.isUndefined(oButton.handler.obj)) ? oButton.handler.obj : this), scope: (oButton.handler.scope || this) }); } this._aButtons[this._aButtons.length] = oYUIButton; } else { oButtonEl = document.createElement("button"); oButtonEl.setAttribute("type", "button"); if (oButton.isDefault) { oButtonEl.className = "default"; this.defaultHtmlButton = oButtonEl; } oButtonEl.innerHTML = oButton.text; if (Lang.isFunction(oButton.handler)) { Event.on(oButtonEl, "click", oButton.handler, this, true); } else if (Lang.isObject(oButton.handler) && Lang.isFunction(oButton.handler.fn)) { Event.on(oButtonEl, "click", oButton.handler.fn, ((!Lang.isUndefined(oButton.handler.obj)) ? oButton.handler.obj : this), (oButton.handler.scope || this)); } oSpan.appendChild(oButtonEl); this._aButtons[this._aButtons.length] = oButtonEl; } oButton.htmlButton = oButtonEl; if (i === 0) { this.firstButton = oButtonEl; } if (i == (nButtons - 1)) { this.lastButton = oButtonEl; } } this.setFooter(oSpan); oFooter = this.footer; if (Dom.inDocument(this.element) && !Dom.isAncestor(oInnerElement, oFooter)) { oInnerElement.appendChild(oFooter); } this.buttonSpan = oSpan; } else { // Do cleanup oSpan = this.buttonSpan; oFooter = this.footer; if (oSpan && oFooter) { oFooter.removeChild(oSpan); this.buttonSpan = null; this.firstButton = null; this.lastButton = null; this.defaultHtmlButton = null; } } this.changeContentEvent.fire(); }, /** * @method getButtons * @description Returns an array containing each of the Dialog's * buttons, by default an array of HTML <code>&#60;BUTTON&#62;</code> * elements. If the Dialog's buttons were created using the * YAHOO.widget.Button class (via the inclusion of the optional Button * dependency on the page), an array of YAHOO.widget.Button instances * is returned. * @return {Array} */ getButtons: function () { return this._aButtons || null; }, /** * <p> * Sets focus to the first focusable element in the Dialog's form if found, * else, the default button if found, else the first button defined via the * "buttons" configuration property. * </p> * <p> * This method is invoked when the Dialog is made visible. * </p> * @method focusFirst * @return {Boolean} true, if focused. false if not */ focusFirst: function (type, args, obj) { var el = this.firstFormElement, focused = false; if (args && args[1]) { Event.stopEvent(args[1]); // When tabbing here, use firstElement instead of firstFormElement if (args[0] === 9 && this.firstElement) { el = this.firstElement; } } if (el) { try { el.focus(); focused = true; } catch(oException) { // Ignore } } else { if (this.defaultHtmlButton) { focused = this.focusDefaultButton(); } else { focused = this.focusFirstButton(); } } return focused; }, /** * Sets focus to the last element in the Dialog's form or the last * button defined via the "buttons" configuration property. * @method focusLast * @return {Boolean} true, if focused. false if not */ focusLast: function (type, args, obj) { var aButtons = this.cfg.getProperty("buttons"), el = this.lastFormElement, focused = false; if (args && args[1]) { Event.stopEvent(args[1]); // When tabbing here, use lastElement instead of lastFormElement if (args[0] === 9 && this.lastElement) { el = this.lastElement; } } if (aButtons && Lang.isArray(aButtons)) { focused = this.focusLastButton(); } else { if (el) { try { el.focus(); focused = true; } catch(oException) { // Ignore } } } return focused; }, /** * Helper method to normalize button references. It either returns the * YUI Button instance for the given element if found, * or the passes back the HTMLElement reference if a corresponding YUI Button * reference is not found or YAHOO.widget.Button does not exist on the page. * * @method _getButton * @private * @param {HTMLElement} button * @return {YAHOO.widget.Button|HTMLElement} */ _getButton : function(button) { var Button = YAHOO.widget.Button; // If we have an HTML button and YUI Button is on the page, // get the YUI Button reference if available. if (Button && button && button.nodeName && button.id) { button = Button.getButton(button.id) || button; } return button; }, /** * Sets the focus to the button that is designated as the default via * the "buttons" configuration property. By default, this method is * called when the Dialog is made visible. * @method focusDefaultButton * @return {Boolean} true if focused, false if not */ focusDefaultButton: function () { var button = this._getButton(this.defaultHtmlButton), focused = false; if (button) { /* Place the call to the "focus" method inside a try/catch block to prevent IE from throwing JavaScript errors if the element is disabled or hidden. */ try { button.focus(); focused = true; } catch(oException) { } } return focused; }, /** * Blurs all the buttons defined via the "buttons" * configuration property. * @method blurButtons */ blurButtons: function () { var aButtons = this.cfg.getProperty("buttons"), nButtons, oButton, oElement, i; if (aButtons && Lang.isArray(aButtons)) { nButtons = aButtons.length; if (nButtons > 0) { i = (nButtons - 1); do { oButton = aButtons[i]; if (oButton) { oElement = this._getButton(oButton.htmlButton); if (oElement) { /* Place the call to the "blur" method inside a try/catch block to prevent IE from throwing JavaScript errors if the element is disabled or hidden. */ try { oElement.blur(); } catch(oException) { // ignore } } } } while(i--); } } }, /** * Sets the focus to the first button created via the "buttons" * configuration property. * @method focusFirstButton * @return {Boolean} true, if focused. false if not */ focusFirstButton: function () { var aButtons = this.cfg.getProperty("buttons"), oButton, oElement, focused = false; if (aButtons && Lang.isArray(aButtons)) { oButton = aButtons[0]; if (oButton) { oElement = this._getButton(oButton.htmlButton); if (oElement) { /* Place the call to the "focus" method inside a try/catch block to prevent IE from throwing JavaScript errors if the element is disabled or hidden. */ try { oElement.focus(); focused = true; } catch(oException) { // ignore } } } } return focused; }, /** * Sets the focus to the last button created via the "buttons" * configuration property. * @method focusLastButton * @return {Boolean} true, if focused. false if not */ focusLastButton: function () { var aButtons = this.cfg.getProperty("buttons"), nButtons, oButton, oElement, focused = false; if (aButtons && Lang.isArray(aButtons)) { nButtons = aButtons.length; if (nButtons > 0) { oButton = aButtons[(nButtons - 1)]; if (oButton) { oElement = this._getButton(oButton.htmlButton); if (oElement) { /* Place the call to the "focus" method inside a try/catch block to prevent IE from throwing JavaScript errors if the element is disabled or hidden. */ try { oElement.focus(); focused = true; } catch(oException) { // Ignore } } } } } return focused; }, /** * The default event handler for the "postmethod" configuration property * @method configPostMethod * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For * configuration handlers, args[0] will equal the newly applied value * for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configPostMethod: function (type, args, obj) { this.registerForm(); }, // END BUILT-IN PROPERTY EVENT HANDLERS // /** * Built-in function hook for writing a validation function that will * be checked for a "true" value prior to a submit. This function, as * implemented by default, always returns true, so it should be * overridden if validation is necessary. * @method validate */ validate: function () { return true; }, /** * Executes a submit of the Dialog if validation * is successful. By default the Dialog is hidden * after submission, but you can set the "hideaftersubmit" * configuration property to false, to prevent the Dialog * from being hidden. * * @method submit */ submit: function () { if (this.validate()) { if (this.beforeSubmitEvent.fire()) { this.doSubmit(); this.submitEvent.fire(); if (this.cfg.getProperty("hideaftersubmit")) { this.hide(); } return true; } else { return false; } } else { return false; } }, /** * Executes the cancel of the Dialog followed by a hide. * @method cancel */ cancel: function () { this.cancelEvent.fire(); this.hide(); }, /** * Returns a JSON-compatible data structure representing the data * currently contained in the form. * @method getData * @return {Object} A JSON object reprsenting the data of the * current form. */ getData: function () { var oForm = this.form, aElements, nTotalElements, oData, sName, oElement, nElements, sType, sTagName, aOptions, nOptions, aValues, oOption, oRadio, oCheckbox, valueAttr, i, n; function isFormElement(p_oElement) { var sTag = p_oElement.tagName.toUpperCase(); return ((sTag == "INPUT" || sTag == "TEXTAREA" || sTag == "SELECT") && p_oElement.name == sName); } if (oForm) { aElements = oForm.elements; nTotalElements = aElements.length; oData = {}; for (i = 0; i < nTotalElements; i++) { sName = aElements[i].name; /* Using "Dom.getElementsBy" to safeguard user from JS errors that result from giving a form field (or set of fields) the same name as a native method of a form (like "submit") or a DOM collection (such as the "item" method). Originally tried accessing fields via the "namedItem" method of the "element" collection, but discovered that it won't return a collection of fields in Gecko. */ oElement = Dom.getElementsBy(isFormElement, "*", oForm); nElements = oElement.length; if (nElements > 0) { if (nElements == 1) { oElement = oElement[0]; sType = oElement.type; sTagName = oElement.tagName.toUpperCase(); switch (sTagName) { case "INPUT": if (sType == "checkbox") { oData[sName] = oElement.checked; } else if (sType != "radio") { oData[sName] = oElement.value; } break; case "TEXTAREA": oData[sName] = oElement.value; break; case "SELECT": aOptions = oElement.options; nOptions = aOptions.length; aValues = []; for (n = 0; n < nOptions; n++) { oOption = aOptions[n]; if (oOption.selected) { valueAttr = oOption.attributes.value; aValues[aValues.length] = (valueAttr && valueAttr.specified) ? oOption.value : oOption.text; } } oData[sName] = aValues; break; } } else { sType = oElement[0].type; switch (sType) { case "radio": for (n = 0; n < nElements; n++) { oRadio = oElement[n]; if (oRadio.checked) { oData[sName] = oRadio.value; break; } } break; case "checkbox": aValues = []; for (n = 0; n < nElements; n++) { oCheckbox = oElement[n]; if (oCheckbox.checked) { aValues[aValues.length] = oCheckbox.value; } } oData[sName] = aValues; break; } } } } } return oData; }, /** * Removes the Panel element from the DOM and sets all child elements * to null. * @method destroy * @param {boolean} shallowPurge If true, only the parent element's DOM event listeners are purged. If false, or not provided, all children are also purged of DOM event listeners. * NOTE: The flag is a "shallowPurge" flag, as opposed to what may be a more intuitive "purgeChildren" flag to maintain backwards compatibility with behavior prior to 2.9.0. */ destroy: function (shallowPurge) { removeButtonEventHandlers.call(this); this._aButtons = null; var aForms = this.element.getElementsByTagName("form"), oForm; if (aForms.length > 0) { oForm = aForms[0]; if (oForm) { Event.purgeElement(oForm); if (oForm.parentNode) { oForm.parentNode.removeChild(oForm); } this.form = null; } } Dialog.superclass.destroy.call(this, shallowPurge); }, /** * Returns a string representation of the object. * @method toString * @return {String} The string representation of the Dialog */ toString: function () { return "Dialog " + this.id; } }); }()); (function () { /** * SimpleDialog is a simple implementation of Dialog that can be used to * submit a single value. Forms can be processed in 3 ways -- via an * asynchronous Connection utility call, a simple form POST or GET, * or manually. * @namespace YAHOO.widget * @class SimpleDialog * @extends YAHOO.widget.Dialog * @constructor * @param {String} el The element ID representing the SimpleDialog * <em>OR</em> * @param {HTMLElement} el The element representing the SimpleDialog * @param {Object} userConfig The configuration object literal containing * the configuration that should be set for this SimpleDialog. See * configuration documentation for more details. */ YAHOO.widget.SimpleDialog = function (el, userConfig) { YAHOO.widget.SimpleDialog.superclass.constructor.call(this, el, userConfig); }; var Dom = YAHOO.util.Dom, SimpleDialog = YAHOO.widget.SimpleDialog, /** * Constant representing the SimpleDialog's configuration properties * @property DEFAULT_CONFIG * @private * @final * @type Object */ DEFAULT_CONFIG = { "ICON": { key: "icon", value: "none", suppressEvent: true }, "TEXT": { key: "text", value: "", suppressEvent: true, supercedes: ["icon"] } }; /** * Constant for the standard network icon for a blocking action * @property YAHOO.widget.SimpleDialog.ICON_BLOCK * @static * @final * @type String */ SimpleDialog.ICON_BLOCK = "blckicon"; /** * Constant for the standard network icon for alarm * @property YAHOO.widget.SimpleDialog.ICON_ALARM * @static * @final * @type String */ SimpleDialog.ICON_ALARM = "alrticon"; /** * Constant for the standard network icon for help * @property YAHOO.widget.SimpleDialog.ICON_HELP * @static * @final * @type String */ SimpleDialog.ICON_HELP = "hlpicon"; /** * Constant for the standard network icon for info * @property YAHOO.widget.SimpleDialog.ICON_INFO * @static * @final * @type String */ SimpleDialog.ICON_INFO = "infoicon"; /** * Constant for the standard network icon for warn * @property YAHOO.widget.SimpleDialog.ICON_WARN * @static * @final * @type String */ SimpleDialog.ICON_WARN = "warnicon"; /** * Constant for the standard network icon for a tip * @property YAHOO.widget.SimpleDialog.ICON_TIP * @static * @final * @type String */ SimpleDialog.ICON_TIP = "tipicon"; /** * Constant representing the name of the CSS class applied to the element * created by the "icon" configuration property. * @property YAHOO.widget.SimpleDialog.ICON_CSS_CLASSNAME * @static * @final * @type String */ SimpleDialog.ICON_CSS_CLASSNAME = "yui-icon"; /** * Constant representing the default CSS class used for a SimpleDialog * @property YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG * @static * @final * @type String */ SimpleDialog.CSS_SIMPLEDIALOG = "yui-simple-dialog"; YAHOO.extend(SimpleDialog, YAHOO.widget.Dialog, { /** * Initializes the class's configurable properties which can be changed * using the SimpleDialog's Config object (cfg). * @method initDefaultConfig */ initDefaultConfig: function () { SimpleDialog.superclass.initDefaultConfig.call(this); // Add dialog config properties // /** * Sets the informational icon for the SimpleDialog * @config icon * @type String * @default "none" */ this.cfg.addProperty(DEFAULT_CONFIG.ICON.key, { handler: this.configIcon, value: DEFAULT_CONFIG.ICON.value, suppressEvent: DEFAULT_CONFIG.ICON.suppressEvent }); /** * Sets the text for the SimpleDialog. The text is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source. * @config text * @type HTML * @default "" */ this.cfg.addProperty(DEFAULT_CONFIG.TEXT.key, { handler: this.configText, value: DEFAULT_CONFIG.TEXT.value, suppressEvent: DEFAULT_CONFIG.TEXT.suppressEvent, supercedes: DEFAULT_CONFIG.TEXT.supercedes }); }, /** * The SimpleDialog initialization method, which is executed for * SimpleDialog and all of its subclasses. This method is automatically * called by the constructor, and sets up all DOM references for * pre-existing markup, and creates required markup if it is not * already present. * @method init * @param {String} el The element ID representing the SimpleDialog * <em>OR</em> * @param {HTMLElement} el The element representing the SimpleDialog * @param {Object} userConfig The configuration object literal * containing the configuration that should be set for this * SimpleDialog. See configuration documentation for more details. */ init: function (el, userConfig) { /* Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level */ SimpleDialog.superclass.init.call(this, el/*, userConfig*/); this.beforeInitEvent.fire(SimpleDialog); Dom.addClass(this.element, SimpleDialog.CSS_SIMPLEDIALOG); this.cfg.queueProperty("postmethod", "manual"); if (userConfig) { this.cfg.applyConfig(userConfig, true); } this.beforeRenderEvent.subscribe(function () { if (! this.body) { this.setBody(""); } }, this, true); this.initEvent.fire(SimpleDialog); }, /** * Prepares the SimpleDialog's internal FORM object, creating one if one * is not currently present, and adding the value hidden field. * @method registerForm */ registerForm: function () { SimpleDialog.superclass.registerForm.call(this); var doc = this.form.ownerDocument, input = doc.createElement("input"); input.type = "hidden"; input.name = this.id; input.value = ""; this.form.appendChild(input); }, // BEGIN BUILT-IN PROPERTY EVENT HANDLERS // /** * Fired when the "icon" property is set. * @method configIcon * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configIcon: function (type,args,obj) { var sIcon = args[0], oBody = this.body, sCSSClass = SimpleDialog.ICON_CSS_CLASSNAME, aElements, oIcon, oIconParent; if (sIcon && sIcon != "none") { aElements = Dom.getElementsByClassName(sCSSClass, "*" , oBody); if (aElements.length === 1) { oIcon = aElements[0]; oIconParent = oIcon.parentNode; if (oIconParent) { oIconParent.removeChild(oIcon); oIcon = null; } } if (sIcon.indexOf(".") == -1) { oIcon = document.createElement("span"); oIcon.className = (sCSSClass + " " + sIcon); oIcon.innerHTML = "&#160;"; } else { oIcon = document.createElement("img"); oIcon.src = (this.imageRoot + sIcon); oIcon.className = sCSSClass; } if (oIcon) { oBody.insertBefore(oIcon, oBody.firstChild); } } }, /** * Fired when the "text" property is set. * @method configText * @param {String} type The CustomEvent type (usually the property name) * @param {Object[]} args The CustomEvent arguments. For configuration * handlers, args[0] will equal the newly applied value for the property. * @param {Object} obj The scope object. For configuration handlers, * this will usually equal the owner. */ configText: function (type,args,obj) { var text = args[0]; if (text) { this.setBody(text); this.cfg.refireEvent("icon"); } }, // END BUILT-IN PROPERTY EVENT HANDLERS // /** * Returns a string representation of the object. * @method toString * @return {String} The string representation of the SimpleDialog */ toString: function () { return "SimpleDialog " + this.id; } /** * <p> * Sets the SimpleDialog's body content to the HTML specified. * If no body is present, one will be automatically created. * An empty string can be passed to the method to clear the contents of the body. * </p> * <p><strong>NOTE:</strong> SimpleDialog provides the <a href="#config_text">text</a> * and <a href="#config_icon">icon</a> configuration properties to set the contents * of it's body element in accordance with the UI design for a SimpleDialog (an * icon and message text). Calling setBody on the SimpleDialog will not enforce this * UI design constraint and will replace the entire contents of the SimpleDialog body. * It should only be used if you wish the replace the default icon/text body structure * of a SimpleDialog with your own custom markup.</p> * * @method setBody * @param {HTML} bodyContent The HTML used to set the body. * As a convenience, non HTMLElement objects can also be passed into * the method, and will be treated as strings, with the body innerHTML * set to their default toString implementations. * * <p>NOTE: Markup passed into this method is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.</p> * * <em>OR</em> * @param {HTMLElement} bodyContent The HTMLElement to add as the first and only child of the body element. * <em>OR</em> * @param {DocumentFragment} bodyContent The document fragment * containing elements which are to be added to the body */ }); }()); (function () { /** * ContainerEffect encapsulates animation transitions that are executed when * an Overlay is shown or hidden. * @namespace YAHOO.widget * @class ContainerEffect * @constructor * @param {YAHOO.widget.Overlay} overlay The Overlay that the animation * should be associated with * @param {Object} attrIn The object literal representing the animation * arguments to be used for the animate-in transition. The arguments for * this literal are: attributes(object, see YAHOO.util.Anim for description), * duration(Number), and method(i.e. Easing.easeIn). * @param {Object} attrOut The object literal representing the animation * arguments to be used for the animate-out transition. The arguments for * this literal are: attributes(object, see YAHOO.util.Anim for description), * duration(Number), and method(i.e. Easing.easeIn). * @param {HTMLElement} targetElement Optional. The target element that * should be animated during the transition. Defaults to overlay.element. * @param {class} Optional. The animation class to instantiate. Defaults to * YAHOO.util.Anim. Other options include YAHOO.util.Motion. */ YAHOO.widget.ContainerEffect = function (overlay, attrIn, attrOut, targetElement, animClass) { if (!animClass) { animClass = YAHOO.util.Anim; } /** * The overlay to animate * @property overlay * @type YAHOO.widget.Overlay */ this.overlay = overlay; /** * The animation attributes to use when transitioning into view * @property attrIn * @type Object */ this.attrIn = attrIn; /** * The animation attributes to use when transitioning out of view * @property attrOut * @type Object */ this.attrOut = attrOut; /** * The target element to be animated * @property targetElement * @type HTMLElement */ this.targetElement = targetElement || overlay.element; /** * The animation class to use for animating the overlay * @property animClass * @type class */ this.animClass = animClass; }; var Dom = YAHOO.util.Dom, CustomEvent = YAHOO.util.CustomEvent, ContainerEffect = YAHOO.widget.ContainerEffect; /** * A pre-configured ContainerEffect instance that can be used for fading * an overlay in and out. * @method FADE * @static * @param {YAHOO.widget.Overlay} overlay The Overlay object to animate * @param {Number} dur The duration of the animation * @return {YAHOO.widget.ContainerEffect} The configured ContainerEffect object */ ContainerEffect.FADE = function (overlay, dur) { var Easing = YAHOO.util.Easing, fin = { attributes: {opacity:{from:0, to:1}}, duration: dur, method: Easing.easeIn }, fout = { attributes: {opacity:{to:0}}, duration: dur, method: Easing.easeOut }, fade = new ContainerEffect(overlay, fin, fout, overlay.element); fade.handleUnderlayStart = function() { var underlay = this.overlay.underlay; if (underlay && YAHOO.env.ua.ie) { var hasFilters = (underlay.filters && underlay.filters.length > 0); if(hasFilters) { Dom.addClass(overlay.element, "yui-effect-fade"); } } }; fade.handleUnderlayComplete = function() { var underlay = this.overlay.underlay; if (underlay && YAHOO.env.ua.ie) { Dom.removeClass(overlay.element, "yui-effect-fade"); } }; fade.handleStartAnimateIn = function (type, args, obj) { obj.overlay._fadingIn = true; Dom.addClass(obj.overlay.element, "hide-select"); if (!obj.overlay.underlay) { obj.overlay.cfg.refireEvent("underlay"); } obj.handleUnderlayStart(); obj.overlay._setDomVisibility(true); Dom.setStyle(obj.overlay.element, "opacity", 0); }; fade.handleCompleteAnimateIn = function (type,args,obj) { obj.overlay._fadingIn = false; Dom.removeClass(obj.overlay.element, "hide-select"); if (obj.overlay.element.style.filter) { obj.overlay.element.style.filter = null; } obj.handleUnderlayComplete(); obj.overlay.cfg.refireEvent("iframe"); obj.animateInCompleteEvent.fire(); }; fade.handleStartAnimateOut = function (type, args, obj) { obj.overlay._fadingOut = true; Dom.addClass(obj.overlay.element, "hide-select"); obj.handleUnderlayStart(); }; fade.handleCompleteAnimateOut = function (type, args, obj) { obj.overlay._fadingOut = false; Dom.removeClass(obj.overlay.element, "hide-select"); if (obj.overlay.element.style.filter) { obj.overlay.element.style.filter = null; } obj.overlay._setDomVisibility(false); Dom.setStyle(obj.overlay.element, "opacity", 1); obj.handleUnderlayComplete(); obj.overlay.cfg.refireEvent("iframe"); obj.animateOutCompleteEvent.fire(); }; fade.init(); return fade; }; /** * A pre-configured ContainerEffect instance that can be used for sliding an * overlay in and out. * @method SLIDE * @static * @param {YAHOO.widget.Overlay} overlay The Overlay object to animate * @param {Number} dur The duration of the animation * @return {YAHOO.widget.ContainerEffect} The configured ContainerEffect object */ ContainerEffect.SLIDE = function (overlay, dur) { var Easing = YAHOO.util.Easing, x = overlay.cfg.getProperty("x") || Dom.getX(overlay.element), y = overlay.cfg.getProperty("y") || Dom.getY(overlay.element), clientWidth = Dom.getClientWidth(), offsetWidth = overlay.element.offsetWidth, sin = { attributes: { points: { to: [x, y] } }, duration: dur, method: Easing.easeIn }, sout = { attributes: { points: { to: [(clientWidth + 25), y] } }, duration: dur, method: Easing.easeOut }, slide = new ContainerEffect(overlay, sin, sout, overlay.element, YAHOO.util.Motion); slide.handleStartAnimateIn = function (type,args,obj) { obj.overlay.element.style.left = ((-25) - offsetWidth) + "px"; obj.overlay.element.style.top = y + "px"; }; slide.handleTweenAnimateIn = function (type, args, obj) { var pos = Dom.getXY(obj.overlay.element), currentX = pos[0], currentY = pos[1]; if (Dom.getStyle(obj.overlay.element, "visibility") == "hidden" && currentX < x) { obj.overlay._setDomVisibility(true); } obj.overlay.cfg.setProperty("xy", [currentX, currentY], true); obj.overlay.cfg.refireEvent("iframe"); }; slide.handleCompleteAnimateIn = function (type, args, obj) { obj.overlay.cfg.setProperty("xy", [x, y], true); obj.startX = x; obj.startY = y; obj.overlay.cfg.refireEvent("iframe"); obj.animateInCompleteEvent.fire(); }; slide.handleStartAnimateOut = function (type, args, obj) { var vw = Dom.getViewportWidth(), pos = Dom.getXY(obj.overlay.element), yso = pos[1]; obj.animOut.attributes.points.to = [(vw + 25), yso]; }; slide.handleTweenAnimateOut = function (type, args, obj) { var pos = Dom.getXY(obj.overlay.element), xto = pos[0], yto = pos[1]; obj.overlay.cfg.setProperty("xy", [xto, yto], true); obj.overlay.cfg.refireEvent("iframe"); }; slide.handleCompleteAnimateOut = function (type, args, obj) { obj.overlay._setDomVisibility(false); obj.overlay.cfg.setProperty("xy", [x, y]); obj.animateOutCompleteEvent.fire(); }; slide.init(); return slide; }; ContainerEffect.prototype = { /** * Initializes the animation classes and events. * @method init */ init: function () { this.beforeAnimateInEvent = this.createEvent("beforeAnimateIn"); this.beforeAnimateInEvent.signature = CustomEvent.LIST; this.beforeAnimateOutEvent = this.createEvent("beforeAnimateOut"); this.beforeAnimateOutEvent.signature = CustomEvent.LIST; this.animateInCompleteEvent = this.createEvent("animateInComplete"); this.animateInCompleteEvent.signature = CustomEvent.LIST; this.animateOutCompleteEvent = this.createEvent("animateOutComplete"); this.animateOutCompleteEvent.signature = CustomEvent.LIST; this.animIn = new this.animClass( this.targetElement, this.attrIn.attributes, this.attrIn.duration, this.attrIn.method); this.animIn.onStart.subscribe(this.handleStartAnimateIn, this); this.animIn.onTween.subscribe(this.handleTweenAnimateIn, this); this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this); this.animOut = new this.animClass( this.targetElement, this.attrOut.attributes, this.attrOut.duration, this.attrOut.method); this.animOut.onStart.subscribe(this.handleStartAnimateOut, this); this.animOut.onTween.subscribe(this.handleTweenAnimateOut, this); this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut, this); }, /** * Triggers the in-animation. * @method animateIn */ animateIn: function () { this._stopAnims(this.lastFrameOnStop); this.beforeAnimateInEvent.fire(); this.animIn.animate(); }, /** * Triggers the out-animation. * @method animateOut */ animateOut: function () { this._stopAnims(this.lastFrameOnStop); this.beforeAnimateOutEvent.fire(); this.animOut.animate(); }, /** * Flag to define whether Anim should jump to the last frame, * when animateIn or animateOut is stopped. * * @property lastFrameOnStop * @default true * @type boolean */ lastFrameOnStop : true, /** * Stops both animIn and animOut instances, if in progress. * * @method _stopAnims * @param {boolean} finish If true, animation will jump to final frame. * @protected */ _stopAnims : function(finish) { if (this.animOut && this.animOut.isAnimated()) { this.animOut.stop(finish); } if (this.animIn && this.animIn.isAnimated()) { this.animIn.stop(finish); } }, /** * The default onStart handler for the in-animation. * @method handleStartAnimateIn * @param {String} type The CustomEvent type * @param {Object[]} args The CustomEvent arguments * @param {Object} obj The scope object */ handleStartAnimateIn: function (type, args, obj) { }, /** * The default onTween handler for the in-animation. * @method handleTweenAnimateIn * @param {String} type The CustomEvent type * @param {Object[]} args The CustomEvent arguments * @param {Object} obj The scope object */ handleTweenAnimateIn: function (type, args, obj) { }, /** * The default onComplete handler for the in-animation. * @method handleCompleteAnimateIn * @param {String} type The CustomEvent type * @param {Object[]} args The CustomEvent arguments * @param {Object} obj The scope object */ handleCompleteAnimateIn: function (type, args, obj) { }, /** * The default onStart handler for the out-animation. * @method handleStartAnimateOut * @param {String} type The CustomEvent type * @param {Object[]} args The CustomEvent arguments * @param {Object} obj The scope object */ handleStartAnimateOut: function (type, args, obj) { }, /** * The default onTween handler for the out-animation. * @method handleTweenAnimateOut * @param {String} type The CustomEvent type * @param {Object[]} args The CustomEvent arguments * @param {Object} obj The scope object */ handleTweenAnimateOut: function (type, args, obj) { }, /** * The default onComplete handler for the out-animation. * @method handleCompleteAnimateOut * @param {String} type The CustomEvent type * @param {Object[]} args The CustomEvent arguments * @param {Object} obj The scope object */ handleCompleteAnimateOut: function (type, args, obj) { }, /** * Returns a string representation of the object. * @method toString * @return {String} The string representation of the ContainerEffect */ toString: function () { var output = "ContainerEffect"; if (this.overlay) { output += " [" + this.overlay.toString() + "]"; } return output; } }; YAHOO.lang.augmentProto(ContainerEffect, YAHOO.util.EventProvider); })(); YAHOO.register("container", YAHOO.widget.Module, {version: "2.9.0", build: "2800"});
ajax/libs/fluentui-react/8.42.2/fluentui-react.js
cdnjs/cdnjs
/*! For license information please see fluentui-react.js.LICENSE.txt */ var FluentUIReact;!function(){"use strict";var e={d:function(t,o){for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};e.r(t),e.d(t,{ActionButton:function(){return Kd},ActivityItem:function(){return zi},AnimationClassNames:function(){return Ze},AnimationDirection:function(){return Up},AnimationStyles:function(){return He},AnimationVariables:function(){return Le},Announced:function(){return na},AnnouncedBase:function(){return oa},Async:function(){return Zi},AutoScroll:function(){return zS},Autofill:function(){return Qi},BaseButton:function(){return Qu},BaseComponent:function(){return Ws},BaseExtendedPeoplePicker:function(){return OC},BaseExtendedPicker:function(){return LC},BaseFloatingPeoplePicker:function(){return P_},BaseFloatingPicker:function(){return E_},BasePeoplePicker:function(){return Ux},BasePeopleSelectedItemsList:function(){return hw},BasePicker:function(){return Nx},BasePickerListBelow:function(){return Bx},BaseSelectedItemsList:function(){return Zk},BaseSlots:function(){return OD},Breadcrumb:function(){return Ld},BreadcrumbBase:function(){return Md},Button:function(){return qd},ButtonGrid:function(){return ep},ButtonGridCell:function(){return ip},ButtonType:function(){return kd},COACHMARK_ATTRIBUTE_NAME:function(){return Dm},Calendar:function(){return Ph},Callout:function(){return kc},CalloutContent:function(){return ic},CalloutContentBase:function(){return ec},Check:function(){return Hh},CheckBase:function(){return Ah},Checkbox:function(){return Uh},CheckboxBase:function(){return zh},CheckboxVisibility:function(){return pv},ChoiceGroup:function(){return hm},ChoiceGroupBase:function(){return um},ChoiceGroupOption:function(){return im},Coachmark:function(){return Mm},CoachmarkBase:function(){return Pm},CollapseAllVisibility:function(){return sv},ColorClassNames:function(){return to},ColorPicker:function(){return rf},ColorPickerBase:function(){return Qg},ColorPickerGridCell:function(){return BI},ColorPickerGridCellBase:function(){return MI},ColumnActionsMode:function(){return lv},ColumnDragEndLocation:function(){return uv},ComboBox:function(){return bf},CommandBar:function(){return Yf},CommandBarBase:function(){return qf},CommandBarButton:function(){return Zd},CommandButton:function(){return Xd},CommunicationColors:function(){return sD},CompactPeoplePicker:function(){return Jx},CompactPeoplePickerBase:function(){return Yx},CompoundButton:function(){return Ud},ConstrainMode:function(){return cv},ContextualMenu:function(){return ju},ContextualMenuBase:function(){return Hu},ContextualMenuItem:function(){return Kc},ContextualMenuItemBase:function(){return Mc},ContextualMenuItemType:function(){return Us},Customizations:function(){return Dt},Customizer:function(){return lc},CustomizerContext:function(){return On},DATAKTP_ARIA_TARGET:function(){return Xc},DATAKTP_EXECUTE_TARGET:function(){return Zc},DATAKTP_TARGET:function(){return Yc},DATA_IS_SCROLLABLE_ATTRIBUTE:function(){return Ya},DATA_PORTAL_ATTRIBUTE:function(){return os},DAYS_IN_WEEK:function(){return ap},DEFAULT_CELL_STYLE_PROPS:function(){return Sv},DEFAULT_MASK_CHAR:function(){return uD},DEFAULT_ROW_HEIGHTS:function(){return xv},DatePicker:function(){return nv},DatePickerBase:function(){return Jf},DateRangeType:function(){return rp},DayOfWeek:function(){return tp},DefaultButton:function(){return Wd},DefaultEffects:function(){return Ot},DefaultFontStyles:function(){return pt},DefaultPalette:function(){return vt},DefaultSpacing:function(){return Ut},DelayedRender:function(){return ea},Depths:function(){return St},DetailsColumnBase:function(){return Hv},DetailsHeader:function(){return Yv},DetailsHeaderBase:function(){return Kv},DetailsList:function(){return Lb},DetailsListBase:function(){return Mb},DetailsListLayoutMode:function(){return dv},DetailsRow:function(){return ob},DetailsRowBase:function(){return Jv},DetailsRowCheck:function(){return Bv},DetailsRowFields:function(){return Zv},DetailsRowGlobalClassNames:function(){return _v},Dialog:function(){return gy},DialogBase:function(){return hy},DialogContent:function(){return cy},DialogContentBase:function(){return sy},DialogFooter:function(){return ry},DialogFooterBase:function(){return oy},DialogType:function(){return Fb},DirectionalHint:function(){return Ys},DocumentCard:function(){return ky},DocumentCardActions:function(){return Ty},DocumentCardActivity:function(){return Py},DocumentCardDetails:function(){return By},DocumentCardImage:function(){return Ky},DocumentCardLocation:function(){return Ay},DocumentCardLogo:function(){return Zy},DocumentCardPreview:function(){return Hy},DocumentCardStatus:function(){return $y},DocumentCardTitle:function(){return Uy},DocumentCardType:function(){return ey},DragDropHelper:function(){return Fv},Dropdown:function(){return NC},DropdownBase:function(){return xC},DropdownMenuItemType:function(){return tf},EdgeChromiumHighContrastSelector:function(){return so},ElementType:function(){return xd},EventGroup:function(){return zs},ExpandingCard:function(){return V_},ExpandingCardBase:function(){return W_},ExpandingCardMode:function(){return L_},ExtendedPeoplePicker:function(){return zC},ExtendedSelectedItem:function(){return lw},Fabric:function(){return mc},FabricBase:function(){return dc},FabricPerformance:function(){return rT},FabricSlots:function(){return zD},Facepile:function(){return QC},FacepileBase:function(){return ZC},FirstWeekOfYear:function(){return np},FloatingPeoplePicker:function(){return R_},FluentTheme:function(){return TD},FocusRects:function(){return ws},FocusTrapCallout:function(){return Bh},FocusTrapZone:function(){return Mh},FocusZone:function(){return bs},FocusZoneDirection:function(){return $i},FocusZoneTabbableElements:function(){return ra},FontClassNames:function(){return ft},FontIcon:function(){return ti},FontSizes:function(){return je},FontWeights:function(){return qe},GlobalSettings:function(){return yt},GroupFooter:function(){return Cb},GroupHeader:function(){return mb},GroupShowAll:function(){return vb},GroupSpacer:function(){return bv},GroupedList:function(){return Ib},GroupedListBase:function(){return wb},GroupedListSection:function(){return _b},HEX_REGEX:function(){return Km},HighContrastSelector:function(){return ro},HighContrastSelectorBlack:function(){return ao},HighContrastSelectorWhite:function(){return io},HoverCard:function(){return Z_},HoverCardBase:function(){return Y_},HoverCardType:function(){return F_},Icon:function(){return ii},IconBase:function(){return ri},IconButton:function(){return id},IconFontSizes:function(){return Ye},IconType:function(){return Er},Image:function(){return Gr},ImageBase:function(){return Vr},ImageCoverStyle:function(){return Rr},ImageFit:function(){return Pr},ImageIcon:function(){return qs},ImageLoadState:function(){return Mr},InjectionMode:function(){return v},IsFocusVisibleClassName:function(){return wo},KTP_ARIA_SEPARATOR:function(){return Jc},KTP_FULL_PREFIX:function(){return qc},KTP_LAYER_ID:function(){return Qc},KTP_PREFIX:function(){return Uc},KTP_SEPARATOR:function(){return jc},KeyCodes:function(){return Gn},KeyboardSpinDirection:function(){return Qw},Keytip:function(){return _S},KeytipData:function(){return au},KeytipEvents:function(){return wc},KeytipLayer:function(){return BS},KeytipLayerBase:function(){return NS},KeytipManager:function(){return $c},Label:function(){return Yh},LabelBase:function(){return qh},Layer:function(){return xc},LayerBase:function(){return Cc},LayerHost:function(){return LS},Link:function(){return Ns},LinkBase:function(){return Rs},List:function(){return Nf},ListPeoplePicker:function(){return $x},ListPeoplePickerBase:function(){return Zx},LocalizedFontFamilies:function(){return Ue},LocalizedFontNames:function(){return Ge},MAX_COLOR_ALPHA:function(){return Hm},MAX_COLOR_HUE:function(){return Bm},MAX_COLOR_RGB:function(){return Am},MAX_COLOR_RGBA:function(){return Lm},MAX_COLOR_SATURATION:function(){return Nm},MAX_COLOR_VALUE:function(){return Fm},MAX_HEX_LENGTH:function(){return zm},MAX_RGBA_LENGTH:function(){return Vm},MIN_HEX_LENGTH:function(){return Om},MIN_RGBA_LENGTH:function(){return Wm},MarqueeSelection:function(){return YS},MaskedTextField:function(){return dD},MeasuredContext:function(){return ld},MemberListPeoplePicker:function(){return jx},MessageBar:function(){return lx},MessageBarBase:function(){return ox},MessageBarButton:function(){return Jd},MessageBarType:function(){return US},Modal:function(){return $b},ModalBase:function(){return Jb},MonthOfYear:function(){return op},MotionAnimations:function(){return mD},MotionDurations:function(){return pD},MotionTimings:function(){return hD},Nav:function(){return gx},NavBase:function(){return mx},NeutralColors:function(){return lD},NormalPeoplePicker:function(){return Qx},NormalPeoplePickerBase:function(){return qx},OpenCardMode:function(){return B_},OverflowButtonType:function(){return HC},OverflowSet:function(){return Gf},OverflowSetBase:function(){return Vf},Overlay:function(){return Kb},OverlayBase:function(){return Wb},Panel:function(){return yC},PanelBase:function(){return cC},PanelType:function(){return fy},PeoplePickerItem:function(){return Hx},PeoplePickerItemBase:function(){return Lx},PeoplePickerItemSuggestion:function(){return Vx},PeoplePickerItemSuggestionBase:function(){return Wx},Persona:function(){return qC},PersonaBase:function(){return UC},PersonaCoin:function(){return Oi},PersonaCoinBase:function(){return Fi},PersonaInitialsColor:function(){return Xr},PersonaPresence:function(){return Zr},PersonaSize:function(){return Yr},Pivot:function(){return Ck},PivotBase:function(){return gk},PivotItem:function(){return dk},PivotLinkFormat:function(){return fk},PivotLinkSize:function(){return vk},PlainCard:function(){return j_},PlainCardBase:function(){return U_},Popup:function(){return ql},Position:function(){return Qs},PositioningContainer:function(){return Sm},PrimaryButton:function(){return jd},ProgressIndicator:function(){return Dk},ProgressIndicatorBase:function(){return xk},PulsingBeaconAnimationStyles:function(){return Lo},RGBA_REGEX:function(){return Gm},Rating:function(){return Bk},RatingBase:function(){return Nk},RatingSize:function(){return _k},Rectangle:function(){return il},RectangleEdge:function(){return Xs},ResizeGroup:function(){return gd},ResizeGroupBase:function(){return hd},ResizeGroupDirection:function(){return $u},ResponsiveMode:function(){return vu},SELECTION_CHANGE:function(){return rv},ScreenWidthMaxLarge:function(){return vo},ScreenWidthMaxMedium:function(){return fo},ScreenWidthMaxSmall:function(){return go},ScreenWidthMaxXLarge:function(){return bo},ScreenWidthMaxXXLarge:function(){return yo},ScreenWidthMinLarge:function(){return uo},ScreenWidthMinMedium:function(){return co},ScreenWidthMinSmall:function(){return lo},ScreenWidthMinUhfMobile:function(){return Co},ScreenWidthMinXLarge:function(){return po},ScreenWidthMinXXLarge:function(){return ho},ScreenWidthMinXXXLarge:function(){return mo},ScrollToMode:function(){return Tf},ScrollablePane:function(){return zk},ScrollablePaneBase:function(){return Ok},ScrollablePaneContext:function(){return Lk},ScrollbarVisibility:function(){return Ak},SearchBox:function(){return Yk},SearchBoxBase:function(){return jk},SelectAllVisibility:function(){return Nv},SelectableOptionMenuItemType:function(){return tf},SelectedPeopleList:function(){return mw},Selection:function(){return iv},SelectionDirection:function(){return tv},SelectionMode:function(){return ev},SelectionZone:function(){return vv},SemanticColorSlots:function(){return WD},Separator:function(){return vw},SeparatorBase:function(){return fw},Shade:function(){return mg},SharedColors:function(){return cD},Shimmer:function(){return Vw},ShimmerBase:function(){return Ww},ShimmerCircle:function(){return Bw},ShimmerCircleBase:function(){return Nw},ShimmerElementType:function(){return bw},ShimmerElementsDefaultHeights:function(){return yw},ShimmerElementsGroup:function(){return Ow},ShimmerElementsGroupBase:function(){return Aw},ShimmerGap:function(){return Pw},ShimmerGapBase:function(){return Tw},ShimmerLine:function(){return Iw},ShimmerLineBase:function(){return kw},ShimmeredDetailsList:function(){return Uw},ShimmeredDetailsListBase:function(){return Gw},Slider:function(){return $w},SliderBase:function(){return Xw},SpinButton:function(){return cI},Spinner:function(){return ub},SpinnerBase:function(){return sb},SpinnerSize:function(){return eb},SpinnerType:function(){return tb},Stack:function(){return DI},StackItem:function(){return _I},Sticky:function(){return TI},StickyPositionType:function(){return bI},Stylesheet:function(){return _},SuggestionActionType:function(){return px},SuggestionItemType:function(){return v_},Suggestions:function(){return _x},SuggestionsControl:function(){return D_},SuggestionsController:function(){return Sx},SuggestionsCore:function(){return f_},SuggestionsHeaderFooterItem:function(){return I_},SuggestionsItem:function(){return h_},SuggestionsStore:function(){return N_},SwatchColorPicker:function(){return OI},SwatchColorPickerBase:function(){return LI},TagItem:function(){return nk},TagItemBase:function(){return ok},TagItemSuggestion:function(){return sk},TagItemSuggestionBase:function(){return ak},TagPicker:function(){return ck},TagPickerBase:function(){return lk},TeachingBubble:function(){return QI},TeachingBubbleBase:function(){return XI},TeachingBubbleContent:function(){return qI},TeachingBubbleContentBase:function(){return WI},Text:function(){return eD},TextField:function(){return Og},TextFieldBase:function(){return Bg},TextStyles:function(){return $I},TextView:function(){return JI},ThemeContext:function(){return ED},ThemeGenerator:function(){return VD},ThemeProvider:function(){return HD},ThemeSettingName:function(){return Zt},TimeConstants:function(){return cp},TimePicker:function(){return YD},Toggle:function(){return oT},ToggleBase:function(){return eT},Tooltip:function(){return Sd},TooltipBase:function(){return _d},TooltipDelay:function(){return yd},TooltipHost:function(){return Td},TooltipHostBase:function(){return Id},TooltipOverflowMode:function(){return md},ValidationState:function(){return fx},VerticalDivider:function(){return uu},VirtualizedComboBox:function(){return Ff},WeeklyDayPicker:function(){return ST},WindowContext:function(){return zl},WindowProvider:function(){return Kl},ZIndexes:function(){return ko},addDays:function(){return up},addDirectionalKeyCode:function(){return _s},addElementAtIndex:function(){return da},addMonths:function(){return pp},addWeeks:function(){return dp},addYears:function(){return hp},allowOverscrollOnElement:function(){return Xa},allowScrollOnElement:function(){return Za},anchorProperties:function(){return dr},appendFunction:function(){return Vi},arraysEqual:function(){return ha},asAsync:function(){return aT},assertNever:function(){return sT},assign:function(){return Fs},audioProperties:function(){return sr},baseElementEvents:function(){return nr},baseElementProperties:function(){return rr},buildClassMap:function(){return Q},buildColumns:function(){return Nb},buildKeytipConfigMap:function(){return FS},buttonProperties:function(){return pr},calculatePrecision:function(){return KS},canAnyMenuItemsCheck:function(){return Bu},clamp:function(){return Xm},classNamesFunction:function(){return Jn},colGroupProperties:function(){return _r},colProperties:function(){return Sr},compareDatePart:function(){return Cp},compareDates:function(){return yp},composeComponentAs:function(){return Lf},composeRenderFunction:function(){return Xh},concatStyleSets:function(){return kn},concatStyleSetsWithProps:function(){return wn},constructKeytip:function(){return AS},correctHSV:function(){return pg},correctHex:function(){return hg},correctRGB:function(){return dg},createArray:function(){return sa},createFontStyles:function(){return et},createGenericItem:function(){return Xx},createItem:function(){return M_},createMemoizer:function(){return qo},createMergedRef:function(){return ga},createTheme:function(){return jt},css:function(){return qr},cssColor:function(){return Ym},customizable:function(){return Ju},defaultCalendarNavigationIcons:function(){return ih},defaultCalendarStrings:function(){return nh},defaultDatePickerStrings:function(){return Zf},defaultDayPickerStrings:function(){return rh},defaultWeeklyDayPickerNavigationIcons:function(){return bT},defaultWeeklyDayPickerStrings:function(){return vT},disableBodyScroll:function(){return Ja},divProperties:function(){return Dr},doesElementContainFocus:function(){return Ba},elementContains:function(){return _a},elementContainsAttribute:function(){return Ca},enableBodyScroll:function(){return $a},extendComponent:function(){return Ki},filteredAssign:function(){return As},find:function(){return aa},findElementRecursive:function(){return ya},findIndex:function(){return ia},findScrollableParent:function(){return ts},fitContentToBounds:function(){return VS},flatten:function(){return pa},focusAsync:function(){return La},focusClear:function(){return Eo},focusFirstChild:function(){return Ia},fontFace:function(){return Xe},formProperties:function(){return xr},format:function(){return Bp},getAllSelectedOptions:function(){return mf},getAriaDescribedBy:function(){return ru},getBackgroundShade:function(){return Tg},getBoundsFromTargetWindow:function(){return Ll},getChildren:function(){return lT},getColorFromHSV:function(){return ig},getColorFromRGBA:function(){return ng},getColorFromString:function(){return rg},getContrastRatio:function(){return Eg},getDatePartHashValue:function(){return Tp},getDateRangeArray:function(){return _p},getDetailsRowStyles:function(){return wv},getDistanceBetweenPoints:function(){return WS},getDocument:function(){return nt},getEdgeChromiumNoHighContrastAdjustSelector:function(){return xo},getElementIndexPath:function(){return Oa},getEndDateOfWeek:function(){return Ip},getFadedOverflowStyle:function(){return rn},getFirstFocusable:function(){return Sa},getFirstTabbable:function(){return ka},getFirstVisibleElementFromSelector:function(){return fS},getFocusOutlineStyle:function(){return Po},getFocusStyle:function(){return To},getFocusableByIndexPath:function(){return Ha},getFontIcon:function(){return oi},getFullColorString:function(){return ag},getGlobalClassNames:function(){return Qo},getHighContrastNoAdjustStyle:function(){return So},getIcon:function(){return vn},getIconClassName:function(){return xn},getIconContent:function(){return ei},getId:function(){return Ka},getInitialResponsiveMode:function(){return wu},getInitials:function(){return Hr},getInputFocusStyle:function(){return Ro},getLanguage:function(){return ut},getLastFocusable:function(){return xa},getLastTabbable:function(){return wa},getMaxHeight:function(){return Fl},getMeasurementCache:function(){return ad},getMenuItemStyles:function(){return Lc},getMonthEnd:function(){return gp},getMonthStart:function(){return mp},getNativeElementProps:function(){return Cv},getNativeProps:function(){return Tr},getNextElement:function(){return Ta},getNextResizeGroupStateProvider:function(){return sd},getOppositeEdge:function(){return Al},getParent:function(){return ba},getPersonaInitialsColor:function(){return _i},getPlaceholderStyles:function(){return sn},getPreviousElement:function(){return Da},getPropsWithDefaults:function(){return tr},getRTL:function(){return jn},getRTLSafeKeyCode:function(){return Yn},getRect:function(){return Db},getResourceUrl:function(){return mT},getResponsiveMode:function(){return Du},getScreenSelector:function(){return _o},getScrollbarWidth:function(){return es},getShade:function(){return Dg},getSplitButtonClassNames:function(){return Zu},getStartDateOfWeek:function(){return wp},getSubmenuItems:function(){return Nu},getTheme:function(){return Qt},getThemedContext:function(){return tn},getVirtualParent:function(){return va},getWeekNumber:function(){return kp},getWeekNumbersInMonth:function(){return xp},getWindow:function(){return at},getYearEnd:function(){return vp},getYearStart:function(){return fp},hasHorizontalOverflow:function(){return fd},hasOverflow:function(){return bd},hasVerticalOverflow:function(){return vd},hiddenContentStyle:function(){return Mo},hoistMethods:function(){return gu},hoistStatics:function(){return yu},hsl2hsv:function(){return Um},hsl2rgb:function(){return qm},hsv2hex:function(){return $m},hsv2hsl:function(){return tg},hsv2rgb:function(){return jm},htmlElementProperties:function(){return ir},iframeProperties:function(){return kr},imageProperties:function(){return Ir},imgProperties:function(){return wr},initializeComponentRef:function(){return Gi},initializeFocusRects:function(){return cT},initializeIcons:function(){return gS},initializeResponsiveMode:function(){return ku},inputProperties:function(){return hr},isControlled:function(){return wi},isDark:function(){return Ig},isDirectionalKeyCode:function(){return Cs},isElementFocusSubZone:function(){return Na},isElementFocusZone:function(){return Ma},isElementTabbable:function(){return Ra},isElementVisible:function(){return Ea},isElementVisibleAndNotHidden:function(){return Pa},isIE11:function(){return Wi},isIOS:function(){return Js},isInDateRangeArray:function(){return Sp},isMac:function(){return Zs},isRelativeUrl:function(){return dx},isValidShade:function(){return xg},isVirtualElement:function(){return fa},keyframes:function(){return J},ktpTargetFromId:function(){return nu},ktpTargetFromSequences:function(){return ou},labelProperties:function(){return ar},liProperties:function(){return ur},loadTheme:function(){return eo},makeStyles:function(){return BD},mapEnumByName:function(){return Ls},memoize:function(){return Uo},memoizeFunction:function(){return jo},merge:function(){return zt},mergeAriaAttributeValues:function(){return Gs},mergeCustomizations:function(){return sc},mergeOverflows:function(){return tu},mergeScopedSettings:function(){return $o},mergeSettings:function(){return Jo},mergeStyleSets:function(){return In},mergeStyles:function(){return Z},mergeThemes:function(){return Gt},modalize:function(){return Rh},noWrap:function(){return nn},normalize:function(){return on},nullRender:function(){return Ks},olProperties:function(){return cr},omit:function(){return Os},on:function(){return nl},optionProperties:function(){return fr},personaPresenceSize:function(){return $r},personaSize:function(){return Jr},portalContainsElement:function(){return rs},positionCallout:function(){return Nl},positionCard:function(){return Bl},positionElement:function(){return Ml},precisionRound:function(){return GS},presenceBoolean:function(){return li},raiseClick:function(){return Ua},registerDefaultFontFaces:function(){return gt},registerIconAlias:function(){return fn},registerIcons:function(){return mn},registerOnThemeChangeCallback:function(){return Jt},removeIndex:function(){return ca},removeOnThemeChangeCallback:function(){return $t},replaceElement:function(){return ua},resetControlledWarnings:function(){return Ii},resetIds:function(){return Ga},resetMemoizations:function(){return Go},rgb2hex:function(){return Qm},rgb2hsv:function(){return eg},safeRequestAnimationFrame:function(){return eC},safeSetTimeout:function(){return fT},selectProperties:function(){return gr},sequencesToID:function(){return eu},setBaseUrl:function(){return gT},setFocusVisibility:function(){return Do},setIconOptions:function(){return bn},setLanguage:function(){return dt},setMemoizeWeakMap:function(){return Ko},setMonth:function(){return bp},setPortalAttribute:function(){return ns},setRTL:function(){return qn},setResponsiveMode:function(){return xu},setSSR:function(){return ot},setVirtualParent:function(){return gc},setWarningCallback:function(){return un},shallowCompare:function(){return Bs},shouldWrapFocus:function(){return Fa},sizeBoolean:function(){return ai},sizeToPixels:function(){return si},styled:function(){return Vn},tableProperties:function(){return vr},tdProperties:function(){return Cr},textAreaProperties:function(){return mr},thProperties:function(){return yr},themeRulesStandardCreator:function(){return KD},toMatrix:function(){return la},trProperties:function(){return br},transitionKeysAreEqual:function(){return DS},transitionKeysContain:function(){return TS},unhoistMethods:function(){return fu},unregisterIcons:function(){return gn},updateA:function(){return ug},updateH:function(){return lg},updateRGB:function(){return cg},updateSV:function(){return sg},updateT:function(){return Pg},useCustomizationSettings:function(){return zn},useDocument:function(){return Vl},useFocusRects:function(){return ks},useHeightOffset:function(){return _m},useKeytipRef:function(){return SS},useResponsiveMode:function(){return Tu},useTheme:function(){return PD},useWindow:function(){return Wl},values:function(){return Hs},videoProperties:function(){return lr},warn:function(){return cn},warnConditionallyRequiredProps:function(){return Si},warnControlledUsage:function(){return Di},warnDeprecations:function(){return xi},warnMutuallyExclusive:function(){return ki},withResponsiveMode:function(){return Iu}});var o={};e.r(o),e.d(o,{pickerInput:function(){return FC},pickerText:function(){return BC}});var n={};e.r(n),e.d(n,{callout:function(){return JC}});var r={};e.r(r),e.d(r,{actionButton:function(){return r_},buttonSelected:function(){return i_},closeButton:function(){return t_},itemButton:function(){return n_},root:function(){return $C},suggestionsAvailable:function(){return u_},suggestionsContainer:function(){return s_},suggestionsItem:function(){return e_},suggestionsItemIsSuggested:function(){return o_},suggestionsNone:function(){return l_},suggestionsSpinner:function(){return c_},suggestionsTitle:function(){return a_}});var i={};e.r(i),e.d(i,{suggestionsContainer:function(){return m_}});var a={};e.r(a),e.d(a,{actionButton:function(){return y_},buttonSelected:function(){return C_},itemButton:function(){return x_},root:function(){return b_},screenReaderOnly:function(){return k_},suggestionsSpinner:function(){return S_},suggestionsTitle:function(){return __}});var s={};e.r(s),e.d(s,{inputDisabled:function(){return Dx},inputFocused:function(){return Ix},pickerInput:function(){return Tx},pickerItems:function(){return Ex},pickerText:function(){return wx},screenReaderOnly:function(){return Px}});var l={};e.r(l),e.d(l,{actionButton:function(){return Jk},expandButton:function(){return nw},hover:function(){return Qk},itemContainer:function(){return aw},itemContent:function(){return tw},personaContainer:function(){return Xk},personaContainerIsSelected:function(){return $k},personaDetails:function(){return iw},personaWrapper:function(){return rw},removeButton:function(){return ow},validationError:function(){return ew}});var c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(e,t)};function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}var d=function(){return(d=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function p(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}function h(e,t,o,n){var r,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(i<3?r(a):i>3?r(t,o,a):r(t,o))||a);return i>3&&a&&Object.defineProperty(t,o,a),a}function m(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;var n=Array(e),r=0;for(t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)n[r]=i[a];return n}Object.create,Object.create;var g,f=React,v={none:0,insertNode:1,appendChild:2},b="undefined"!=typeof navigator&&/rv:11.0/.test(navigator.userAgent),y={};try{y=window||{}}catch(P){}var C,_=function(){function e(e,t){var o,n,r,i,a,s;this._rules=[],this._preservedRules=[],this._counter=0,this._keyToClassName={},this._onInsertRuleCallbacks=[],this._onResetCallbacks=[],this._classNameToArgs={},this._config=d({injectionMode:"undefined"==typeof document?v.none:v.insertNode,defaultPrefix:"css",namespace:void 0,cspSettings:void 0},e),this._classNameToArgs=null!==(o=null==t?void 0:t.classNameToArgs)&&void 0!==o?o:this._classNameToArgs,this._counter=null!==(n=null==t?void 0:t.counter)&&void 0!==n?n:this._counter,this._keyToClassName=null!==(i=null!==(r=this._config.classNameCache)&&void 0!==r?r:null==t?void 0:t.keyToClassName)&&void 0!==i?i:this._keyToClassName,this._preservedRules=null!==(a=null==t?void 0:t.preservedRules)&&void 0!==a?a:this._preservedRules,this._rules=null!==(s=null==t?void 0:t.rules)&&void 0!==s?s:this._rules}return e.getInstance=function(){if(!(g=y.__stylesheet__)||g._lastStyleElement&&g._lastStyleElement.ownerDocument!==document){var t=(null==y?void 0:y.FabricConfig)||{},o=new e(t.mergeStyles,t.serializedStylesheet);g=o,y.__stylesheet__=o}return g},e.prototype.serialize=function(){return JSON.stringify({classNameToArgs:this._classNameToArgs,counter:this._counter,keyToClassName:this._keyToClassName,preservedRules:this._preservedRules,rules:this._rules})},e.prototype.setConfig=function(e){this._config=d(d({},this._config),e)},e.prototype.onReset=function(e){var t=this;return this._onResetCallbacks.push(e),function(){t._onResetCallbacks=t._onResetCallbacks.filter((function(t){return t!==e}))}},e.prototype.onInsertRule=function(e){var t=this;return this._onInsertRuleCallbacks.push(e),function(){t._onInsertRuleCallbacks=t._onInsertRuleCallbacks.filter((function(t){return t!==e}))}},e.prototype.getClassName=function(e){var t=this._config.namespace;return(t?t+"-":"")+(e||this._config.defaultPrefix)+"-"+this._counter++},e.prototype.cacheClassName=function(e,t,o,n){this._keyToClassName[t]=e,this._classNameToArgs[e]={args:o,rules:n}},e.prototype.classNameFromKey=function(e){return this._keyToClassName[e]},e.prototype.getClassNameCache=function(){return this._keyToClassName},e.prototype.argsFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.args},e.prototype.insertedRulesFromClassName=function(e){var t=this._classNameToArgs[e];return t&&t.rules},e.prototype.insertRule=function(e,t){var o=this._config.injectionMode,n=o!==v.none?this._getStyleElement():void 0;if(t&&this._preservedRules.push(e),n)switch(o){case v.insertNode:var r=n.sheet;try{r.insertRule(e,r.cssRules.length)}catch(e){}break;case v.appendChild:n.appendChild(document.createTextNode(e))}else this._rules.push(e);this._config.onInsertRule&&this._config.onInsertRule(e),this._onInsertRuleCallbacks.forEach((function(e){return e()}))},e.prototype.getRules=function(e){return(e?this._preservedRules.join(""):"")+this._rules.join("")},e.prototype.reset=function(){this._rules=[],this._counter=0,this._classNameToArgs={},this._keyToClassName={},this._onResetCallbacks.forEach((function(e){return e()}))},e.prototype.resetKeys=function(){this._keyToClassName={}},e.prototype._getStyleElement=function(){var e=this;return this._styleElement||"undefined"==typeof document||(this._styleElement=this._createStyleElement(),b||window.requestAnimationFrame((function(){e._styleElement=void 0}))),this._styleElement},e.prototype._createStyleElement=function(){var e=document.head,t=document.createElement("style"),o=null;t.setAttribute("data-merge-styles","true");var n=this._config.cspSettings;if(n&&n.nonce&&t.setAttribute("nonce",n.nonce),this._lastStyleElement)o=this._lastStyleElement.nextElementSibling;else{var r=this._findPlaceholderStyleTag();o=r?r.nextElementSibling:e.childNodes[0]}return e.insertBefore(t,e.contains(o)?o:null),this._lastStyleElement=t,t},e.prototype._findPlaceholderStyleTag=function(){var e=document.head;return e?e.querySelector("style[data-merge-styles]"):null},e}();function S(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=[],n=[],r=_.getInstance();function i(e){for(var t=0,a=e;t<a.length;t++){var s=a[t];if(s)if("string"==typeof s)if(s.indexOf(" ")>=0)i(s.split(" "));else{var l=r.argsFromClassName(s);l?i(l):-1===o.indexOf(s)&&o.push(s)}else Array.isArray(s)?i(s):"object"==typeof s&&n.push(s)}}return i(e),{classes:o,objects:n}}function x(e){C!==e&&(C=e)}function k(){return void 0===C&&(C="undefined"!=typeof document&&!!document.documentElement&&"rtl"===document.documentElement.getAttribute("dir")),C}function w(){return{rtl:k()}}C=k();var I,D={},T={"user-select":1};function E(e,t){var o=function(){var e;if(!I){var t="undefined"!=typeof document?document:void 0,o="undefined"!=typeof navigator?navigator:void 0,n=null===(e=null==o?void 0:o.userAgent)||void 0===e?void 0:e.toLowerCase();I=t?{isWebkit:!(!t||!("WebkitAppearance"in t.documentElement.style)),isMoz:!!(n&&n.indexOf("firefox")>-1),isOpera:!!(n&&n.indexOf("opera")>-1),isMs:!(!o||!/rv:11.0/i.test(o.userAgent)&&!/Edge\/\d./i.test(navigator.userAgent))}:{isWebkit:!0,isMoz:!0,isOpera:!0,isMs:!0}}return I}(),n=e[t];if(T[n]){var r=e[t+1];T[n]&&(o.isWebkit&&e.push("-webkit-"+n,r),o.isMoz&&e.push("-moz-"+n,r),o.isMs&&e.push("-ms-"+n,r),o.isOpera&&e.push("-o-"+n,r))}}var P,R=["column-count","font-weight","flex","flex-grow","flex-shrink","fill-opacity","opacity","order","z-index","zoom"];function M(e,t){var o=e[t],n=e[t+1];if("number"==typeof n){var r=R.indexOf(o)>-1,i=o.indexOf("--")>-1,a=r||i?"":"px";e[t+1]=""+n+a}}var N="left",B="right",F=((P={}).left=B,P.right=N,P),A={"w-resize":"e-resize","sw-resize":"se-resize","nw-resize":"ne-resize"};function L(e,t,o){if(e.rtl){var n=t[o];if(!n)return;var r=t[o+1];if("string"==typeof r&&r.indexOf("@noflip")>=0)t[o+1]=r.replace(/\s*(?:\/\*\s*)?\@noflip\b(?:\s*\*\/)?\s*?/g,"");else if(n.indexOf(N)>=0)t[o]=n.replace(N,B);else if(n.indexOf(B)>=0)t[o]=n.replace(B,N);else if(String(r).indexOf(N)>=0)t[o+1]=r.replace(N,B);else if(String(r).indexOf(B)>=0)t[o+1]=r.replace(B,N);else if(F[n])t[o]=F[n];else if(A[r])t[o+1]=A[r];else switch(n){case"margin":case"padding":t[o+1]=function(e){if("string"==typeof e){var t=e.split(" ");if(4===t.length)return t[0]+" "+t[3]+" "+t[2]+" "+t[1]}return e}(r);break;case"box-shadow":t[o+1]=function(e,t){var o=e.split(" "),n=parseInt(o[0],10);return o[0]=o[0].replace(String(n),String(-1*n)),o.join(" ")}(r)}}}function H(e){var t=e&&e["&"];return t?t.displayName:void 0}var O=/\:global\((.+?)\)/g;function z(e,t){return e.indexOf(":global(")>=0?e.replace(O,"$1"):0===e.indexOf(":")?t+e:e.indexOf("&")<0?t+" "+e:e}function W(e,t,o,n){void 0===t&&(t={__order:[]}),0===o.indexOf("@")?V([n],t,o=o+"{"+e):o.indexOf(",")>-1?function(e){if(!O.test(e))return e;for(var t=[],o=/\:global\((.+?)\)/g,n=null;n=o.exec(e);)n[1].indexOf(",")>-1&&t.push([n.index,n.index+n[0].length,n[1].split(",").map((function(e){return":global("+e.trim()+")"})).join(", ")]);return t.reverse().reduce((function(e,t){var o=t[0],n=t[1],r=t[2];return e.slice(0,o)+r+e.slice(n)}),e)}(o).split(",").map((function(e){return e.trim()})).forEach((function(o){return V([n],t,z(o,e))})):V([n],t,z(o,e))}function V(e,t,o){void 0===t&&(t={__order:[]}),void 0===o&&(o="&");var n=_.getInstance(),r=t[o];r||(r={},t[o]=r,t.__order.push(o));for(var i=0,a=e;i<a.length;i++){var s=a[i];if("string"==typeof s){var l=n.argsFromClassName(s);l&&V(l,t,o)}else if(Array.isArray(s))V(s,t,o);else for(var c in s)if(s.hasOwnProperty(c)){var u=s[c];if("selectors"===c){var d=s.selectors;for(var p in d)d.hasOwnProperty(p)&&W(o,t,p,d[p])}else"object"==typeof u?null!==u&&W(o,t,c,u):void 0!==u&&("margin"===c||"padding"===c?K(r,c,u):r[c]=u)}}return t}function K(e,t,o){var n="string"==typeof o?function(e){for(var t=[],o=0,n=0,r=0;r<e.length;r++)switch(e[r]){case"(":n++;break;case")":n&&n--;break;case"\t":case" ":n||(r>o&&t.push(e.substring(o,r)),o=r+1)}return o<e.length&&t.push(e.substring(o)),t}(o):[o];0===n.length&&n.push(o),"!important"===n[n.length-1]&&(n=n.slice(0,-1).map((function(e){return e+" !important"}))),e[t+"Top"]=n[0],e[t+"Right"]=n[1]||n[0],e[t+"Bottom"]=n[2]||n[0],e[t+"Left"]=n[3]||n[1]||n[0]}function G(e,t){for(var o=[e.rtl?"rtl":"ltr"],n=!1,r=0,i=t.__order;r<i.length;r++){var a=i[r];o.push(a);var s=t[a];for(var l in s)s.hasOwnProperty(l)&&void 0!==s[l]&&(n=!0,o.push(l,s[l]))}return n?o.join(""):void 0}function U(e,t){return t<=0?"":1===t?e:e+U(e,t-1)}function j(e,t){if(!t)return"";var o,n,r,i=[];for(var a in t)t.hasOwnProperty(a)&&"displayName"!==a&&void 0!==t[a]&&i.push(a,t[a]);for(var s=0;s<i.length;s+=2)r=void 0,"-"!==(r=(o=i)[n=s]).charAt(0)&&(o[n]=D[r]=D[r]||r.replace(/([A-Z])/g,"-$1").toLowerCase()),M(i,s),L(e,i,s),E(i,s);for(s=1;s<i.length;s+=4)i.splice(s,1,":",i[s],";");return i.join("")}function q(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];var n=V(t),r=G(e,n);if(r){var i=_.getInstance(),a={className:i.classNameFromKey(r),key:r,args:t};if(!a.className){a.className=i.getClassName(H(n));for(var s=[],l=0,c=n.__order;l<c.length;l++){var u=c[l];s.push(u,j(e,n[u]))}a.rulesToInsert=s}return a}}function Y(e,t){void 0===t&&(t=1);var o=_.getInstance(),n=e.className,r=e.key,i=e.args,a=e.rulesToInsert;if(a){for(var s=0;s<a.length;s+=2){var l=a[s+1];if(l){var c=a[s],u=(c=c.replace(/&/g,U("."+e.className,t)))+"{"+l+"}"+(0===c.indexOf("@")?"}":"");o.insertRule(u)}}o.cacheClassName(n,r,i,a)}}function Z(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return X(e,w())}function X(e,t){var o=S(e instanceof Array?e:[e]),n=o.classes,r=o.objects;return r.length&&n.push(function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];var n=q.apply(void 0,m([e],t));return n?(Y(n,e.specificityMultiplier),n.className):""}(t||{},r)),n.join(" ")}function Q(e){var t={},o=function(o){var n;e.hasOwnProperty(o)&&Object.defineProperty(t,o,{get:function(){return void 0===n&&(n=Z(e[o]).toString()),n},enumerable:!0,configurable:!0})};for(var n in e)o(n);return t}function J(e){var t=_.getInstance(),o=[];for(var n in e)e.hasOwnProperty(n)&&o.push(n,"{",j(w(),e[n]),"}");var r=o.join(""),i=t.classNameFromKey(r);if(i)return i;var a=t.getClassName();return t.insertRule("@keyframes "+a+"{"+r+"}",!0),t.cacheClassName(a,r,[],["keyframes",r]),a}var $="cubic-bezier(.1,.9,.2,1)",ee="cubic-bezier(.1,.25,.75,.9)",te="0.167s",oe="0.267s",ne="0.367s",re="0.467s",ie=J({from:{opacity:0},to:{opacity:1}}),ae=J({from:{opacity:1},to:{opacity:0,visibility:"hidden"}}),se=ze(-10),le=ze(-20),ce=ze(-40),ue=ze(-400),de=ze(10),pe=ze(20),he=ze(40),me=ze(400),ge=We(10),fe=We(20),ve=We(-10),be=We(-20),ye=Ve(10),Ce=Ve(20),_e=Ve(40),Se=Ve(400),xe=Ve(-10),ke=Ve(-20),we=Ve(-40),Ie=Ve(-400),De=Ke(-10),Te=Ke(-20),Ee=Ke(10),Pe=Ke(20),Re=J({from:{transform:"scale3d(.98,.98,1)"},to:{transform:"scale3d(1,1,1)"}}),Me=J({from:{transform:"scale3d(1,1,1)"},to:{transform:"scale3d(.98,.98,1)"}}),Ne=J({from:{transform:"scale3d(1.03,1.03,1)"},to:{transform:"scale3d(1,1,1)"}}),Be=J({from:{transform:"scale3d(1,1,1)"},to:{transform:"scale3d(1.03,1.03,1)"}}),Fe=J({from:{transform:"rotateZ(0deg)"},to:{transform:"rotateZ(90deg)"}}),Ae=J({from:{transform:"rotateZ(0deg)"},to:{transform:"rotateZ(-90deg)"}}),Le={easeFunction1:$,easeFunction2:ee,durationValue1:te,durationValue2:oe,durationValue3:ne,durationValue4:re},He={slideRightIn10:Oe(ie+","+se,ne,$),slideRightIn20:Oe(ie+","+le,ne,$),slideRightIn40:Oe(ie+","+ce,ne,$),slideRightIn400:Oe(ie+","+ue,ne,$),slideLeftIn10:Oe(ie+","+de,ne,$),slideLeftIn20:Oe(ie+","+pe,ne,$),slideLeftIn40:Oe(ie+","+he,ne,$),slideLeftIn400:Oe(ie+","+me,ne,$),slideUpIn10:Oe(ie+","+ge,ne,$),slideUpIn20:Oe(ie+","+fe,ne,$),slideDownIn10:Oe(ie+","+ve,ne,$),slideDownIn20:Oe(ie+","+be,ne,$),slideRightOut10:Oe(ae+","+ye,ne,$),slideRightOut20:Oe(ae+","+Ce,ne,$),slideRightOut40:Oe(ae+","+_e,ne,$),slideRightOut400:Oe(ae+","+Se,ne,$),slideLeftOut10:Oe(ae+","+xe,ne,$),slideLeftOut20:Oe(ae+","+ke,ne,$),slideLeftOut40:Oe(ae+","+we,ne,$),slideLeftOut400:Oe(ae+","+Ie,ne,$),slideUpOut10:Oe(ae+","+De,ne,$),slideUpOut20:Oe(ae+","+Te,ne,$),slideDownOut10:Oe(ae+","+Ee,ne,$),slideDownOut20:Oe(ae+","+Pe,ne,$),scaleUpIn100:Oe(ie+","+Re,ne,$),scaleDownIn100:Oe(ie+","+Ne,ne,$),scaleUpOut103:Oe(ae+","+Be,te,ee),scaleDownOut98:Oe(ae+","+Me,te,ee),fadeIn100:Oe(ie,te,ee),fadeIn200:Oe(ie,oe,ee),fadeIn400:Oe(ie,ne,ee),fadeIn500:Oe(ie,re,ee),fadeOut100:Oe(ae,te,ee),fadeOut200:Oe(ae,oe,ee),fadeOut400:Oe(ae,ne,ee),fadeOut500:Oe(ae,re,ee),rotate90deg:Oe(Fe,"0.1s",ee),rotateN90deg:Oe(Ae,"0.1s",ee)};function Oe(e,t,o){return{animationName:e,animationDuration:t,animationTimingFunction:o,animationFillMode:"both"}}function ze(e){return J({from:{transform:"translate3d("+e+"px,0,0)",pointerEvents:"none"},to:{transform:"translate3d(0,0,0)",pointerEvents:"auto"}})}function We(e){return J({from:{transform:"translate3d(0,"+e+"px,0)",pointerEvents:"none"},to:{transform:"translate3d(0,0,0)",pointerEvents:"auto"}})}function Ve(e){return J({from:{transform:"translate3d(0,0,0)"},to:{transform:"translate3d("+e+"px,0,0)"}})}function Ke(e){return J({from:{transform:"translate3d(0,0,0)"},to:{transform:"translate3d(0,"+e+"px,0)"}})}var Ge,Ue,je,qe,Ye,Ze=Q(He);function Xe(e){var t=_.getInstance(),o=j(w(),e);if(!t.classNameFromKey(o)){var n=t.getClassName();t.insertRule("@font-face{"+o+"}",!0),t.cacheClassName(n,o,[],["font-face",o])}}!function(e){e.Arabic="Segoe UI Web (Arabic)",e.Cyrillic="Segoe UI Web (Cyrillic)",e.EastEuropean="Segoe UI Web (East European)",e.Greek="Segoe UI Web (Greek)",e.Hebrew="Segoe UI Web (Hebrew)",e.Thai="Leelawadee UI Web",e.Vietnamese="Segoe UI Web (Vietnamese)",e.WestEuropean="Segoe UI Web (West European)",e.Selawik="Selawik Web",e.Armenian="Segoe UI Web (Armenian)",e.Georgian="Segoe UI Web (Georgian)"}(Ge||(Ge={})),function(e){e.Arabic="'"+Ge.Arabic+"'",e.ChineseSimplified="'Microsoft Yahei UI', Verdana, Simsun",e.ChineseTraditional="'Microsoft Jhenghei UI', Pmingliu",e.Cyrillic="'"+Ge.Cyrillic+"'",e.EastEuropean="'"+Ge.EastEuropean+"'",e.Greek="'"+Ge.Greek+"'",e.Hebrew="'"+Ge.Hebrew+"'",e.Hindi="'Nirmala UI'",e.Japanese="'Yu Gothic UI', 'Meiryo UI', Meiryo, 'MS Pgothic', Osaka",e.Korean="'Malgun Gothic', Gulim",e.Selawik="'"+Ge.Selawik+"'",e.Thai="'Leelawadee UI Web', 'Kmer UI'",e.Vietnamese="'"+Ge.Vietnamese+"'",e.WestEuropean="'"+Ge.WestEuropean+"'",e.Armenian="'"+Ge.Armenian+"'",e.Georgian="'"+Ge.Georgian+"'"}(Ue||(Ue={})),function(e){e.size10="10px",e.size12="12px",e.size14="14px",e.size16="16px",e.size18="18px",e.size20="20px",e.size24="24px",e.size28="28px",e.size32="32px",e.size42="42px",e.size68="68px",e.mini="10px",e.xSmall="10px",e.small="12px",e.smallPlus="12px",e.medium="14px",e.mediumPlus="16px",e.icon="16px",e.large="18px",e.xLarge="20px",e.xLargePlus="24px",e.xxLarge="28px",e.xxLargePlus="32px",e.superLarge="42px",e.mega="68px"}(je||(je={})),function(e){e.light=100,e.semilight=300,e.regular=400,e.semibold=600,e.bold=700}(qe||(qe={})),function(e){e.xSmall="10px",e.small="12px",e.medium="16px",e.large="20px"}(Ye||(Ye={}));var Qe="'Segoe UI', '"+Ge.WestEuropean+"'",Je={ar:Ue.Arabic,bg:Ue.Cyrillic,cs:Ue.EastEuropean,el:Ue.Greek,et:Ue.EastEuropean,he:Ue.Hebrew,hi:Ue.Hindi,hr:Ue.EastEuropean,hu:Ue.EastEuropean,ja:Ue.Japanese,kk:Ue.EastEuropean,ko:Ue.Korean,lt:Ue.EastEuropean,lv:Ue.EastEuropean,pl:Ue.EastEuropean,ru:Ue.Cyrillic,sk:Ue.EastEuropean,"sr-latn":Ue.EastEuropean,th:Ue.Thai,tr:Ue.EastEuropean,uk:Ue.Cyrillic,vi:Ue.Vietnamese,"zh-hans":Ue.ChineseSimplified,"zh-hant":Ue.ChineseTraditional,hy:Ue.Armenian,ka:Ue.Georgian};function $e(e,t,o){return{fontFamily:o,MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontSize:e,fontWeight:t}}function et(e){var t=function(e){for(var t in Je)if(Je.hasOwnProperty(t)&&e&&0===t.indexOf(e))return Je[t];return Qe}(e)+", 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif";return{tiny:$e(je.mini,qe.regular,t),xSmall:$e(je.xSmall,qe.regular,t),small:$e(je.small,qe.regular,t),smallPlus:$e(je.smallPlus,qe.regular,t),medium:$e(je.medium,qe.regular,t),mediumPlus:$e(je.mediumPlus,qe.regular,t),large:$e(je.large,qe.regular,t),xLarge:$e(je.xLarge,qe.semibold,t),xLargePlus:$e(je.xLargePlus,qe.semibold,t),xxLarge:$e(je.xxLarge,qe.semibold,t),xxLargePlus:$e(je.xxLargePlus,qe.semibold,t),superLarge:$e(je.superLarge,qe.semibold,t),mega:$e(je.mega,qe.semibold,t)}}var tt=!1;function ot(e){tt=e}function nt(e){if(!tt&&"undefined"!=typeof document){var t=e;return t&&t.ownerDocument?t.ownerDocument:document}}var rt,it=void 0;try{it=window}catch(e){}function at(e){if(!tt&&void 0!==it){var t=e;return t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:it}}function st(e){var t=null;try{var o=at();t=o?o.sessionStorage.getItem(e):null}catch(e){}return t}function lt(e,t){var o;try{null===(o=at())||void 0===o||o.sessionStorage.setItem(e,t)}catch(e){}}var ct="language";function ut(e){if(void 0===e&&(e="sessionStorage"),void 0===rt){var t=nt(),o="localStorage"===e?function(e){var t=null;try{var o=at();t=o?o.localStorage.getItem("language"):null}catch(e){}return t}():"sessionStorage"===e?st(ct):void 0;o&&(rt=o),void 0===rt&&t&&(rt=t.documentElement.getAttribute("lang")),void 0===rt&&(rt="en")}return rt}function dt(e,t){var o=nt();o&&o.documentElement.setAttribute("lang",e);var n=!0===t?"none":t||"sessionStorage";"localStorage"===n?function(e,t){try{var o=at();o&&o.localStorage.setItem("language",t)}catch(e){}}(0,e):"sessionStorage"===n&&lt(ct,e),rt=e}var pt=et(ut());function ht(e,t,o,n){Xe({fontFamily:e="'"+e+"'",src:(void 0!==n?"local('"+n+"'),":"")+"url('"+t+".woff2') format('woff2'),url('"+t+".woff') format('woff')",fontWeight:o,fontStyle:"normal",fontDisplay:"swap"})}function mt(e,t,o,n,r){void 0===n&&(n="segoeui");var i=e+"/"+o+"/"+n;ht(t,i+"-light",qe.light,r&&r+" Light"),ht(t,i+"-semilight",qe.semilight,r&&r+" SemiLight"),ht(t,i+"-regular",qe.regular,r),ht(t,i+"-semibold",qe.semibold,r&&r+" SemiBold"),ht(t,i+"-bold",qe.bold,r&&r+" Bold")}function gt(e){if(e){var t=e+"/fonts";mt(t,Ge.Thai,"leelawadeeui-thai","leelawadeeui"),mt(t,Ge.Arabic,"segoeui-arabic"),mt(t,Ge.Cyrillic,"segoeui-cyrillic"),mt(t,Ge.EastEuropean,"segoeui-easteuropean"),mt(t,Ge.Greek,"segoeui-greek"),mt(t,Ge.Hebrew,"segoeui-hebrew"),mt(t,Ge.Vietnamese,"segoeui-vietnamese"),mt(t,Ge.WestEuropean,"segoeui-westeuropean","segoeui","Segoe UI"),mt(t,Ue.Selawik,"selawik","selawik"),mt(t,Ge.Armenian,"segoeui-armenian"),mt(t,Ge.Georgian,"segoeui-georgian"),ht("Leelawadee UI Web",t+"/leelawadeeui-thai/leelawadeeui-semilight",qe.light),ht("Leelawadee UI Web",t+"/leelawadeeui-thai/leelawadeeui-bold",qe.semibold)}}gt(function(){var e,t,o=null===(e=at())||void 0===e?void 0:e.FabricConfig;return null!==(t=null==o?void 0:o.fontBaseUrl)&&void 0!==t?t:"https://static2.sharepointonline.com/files/fabric/assets"}());var ft=Q(pt),vt={themeDarker:"#004578",themeDark:"#005a9e",themeDarkAlt:"#106ebe",themePrimary:"#0078d4",themeSecondary:"#2b88d8",themeTertiary:"#71afe5",themeLight:"#c7e0f4",themeLighter:"#deecf9",themeLighterAlt:"#eff6fc",black:"#000000",blackTranslucent40:"rgba(0,0,0,.4)",neutralDark:"#201f1e",neutralPrimary:"#323130",neutralPrimaryAlt:"#3b3a39",neutralSecondary:"#605e5c",neutralSecondaryAlt:"#8a8886",neutralTertiary:"#a19f9d",neutralTertiaryAlt:"#c8c6c4",neutralQuaternary:"#d2d0ce",neutralQuaternaryAlt:"#e1dfdd",neutralLight:"#edebe9",neutralLighter:"#f3f2f1",neutralLighterAlt:"#faf9f8",accent:"#0078d4",white:"#ffffff",whiteTranslucent40:"rgba(255,255,255,.4)",yellowDark:"#d29200",yellow:"#ffb900",yellowLight:"#fff100",orange:"#d83b01",orangeLight:"#ea4300",orangeLighter:"#ff8c00",redDark:"#a4262c",red:"#e81123",magentaDark:"#5c005c",magenta:"#b4009e",magentaLight:"#e3008c",purpleDark:"#32145a",purple:"#5c2d91",purpleLight:"#b4a0ff",blueDark:"#002050",blueMid:"#00188f",blue:"#0078d4",blueLight:"#00bcf2",tealDark:"#004b50",teal:"#008272",tealLight:"#00b294",greenDark:"#004b1c",green:"#107c10",greenLight:"#bad80a"},bt=0,yt=function(){function e(){}return e.getValue=function(e,t){var o=Ct();return void 0===o[e]&&(o[e]="function"==typeof t?t():t),o[e]},e.setValue=function(e,t){var o=Ct(),n=o.__callbacks__,r=o[e];if(t!==r){o[e]=t;var i={oldValue:r,value:t,key:e};for(var a in n)n.hasOwnProperty(a)&&n[a](i)}return t},e.addChangeListener=function(e){var t=e.__id__,o=_t();t||(t=e.__id__=String(bt++)),o[t]=e},e.removeChangeListener=function(e){delete _t()[e.__id__]},e}();function Ct(){var e,t=at()||{};return t.__globalSettings__||(t.__globalSettings__=((e={}).__callbacks__={},e)),t.__globalSettings__}function _t(){return Ct().__callbacks__}var St,xt,kt={settings:{},scopedSettings:{},inCustomizerContext:!1},wt=yt.getValue("customizations",{settings:{},scopedSettings:{},inCustomizerContext:!1}),It=[],Dt=function(){function e(){}return e.reset=function(){wt.settings={},wt.scopedSettings={}},e.applySettings=function(t){wt.settings=d(d({},wt.settings),t),e._raiseChange()},e.applyScopedSettings=function(t,o){wt.scopedSettings[t]=d(d({},wt.scopedSettings[t]),o),e._raiseChange()},e.getSettings=function(e,t,o){void 0===o&&(o=kt);for(var n={},r=t&&o.scopedSettings[t]||{},i=t&&wt.scopedSettings[t]||{},a=0,s=e;a<s.length;a++){var l=s[a];n[l]=r[l]||o.settings[l]||i[l]||wt.settings[l]}return n},e.applyBatchedUpdates=function(t,o){e._suppressUpdates=!0;try{t()}catch(e){}e._suppressUpdates=!1,o||e._raiseChange()},e.observe=function(e){It.push(e)},e.unobserve=function(e){It=It.filter((function(t){return t!==e}))},e._raiseChange=function(){e._suppressUpdates||It.forEach((function(e){return e()}))},e}(),Tt=function(){return(Tt=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},Et="undefined"==typeof window?e.g:window,Pt=Et&&Et.CSPSettings&&Et.CSPSettings.nonce,Rt=((xt=Et.__themeState__||{theme:void 0,lastStyleElement:void 0,registeredStyles:[]}).runState||(xt=Tt({},xt,{perf:{count:0,duration:0},runState:{flushTimer:0,mode:0,buffer:[]}})),xt.registeredThemableStyles||(xt=Tt({},xt,{registeredThemableStyles:[]})),Et.__themeState__=xt,xt),Mt=/[\'\"]\[theme:\s*(\w+)\s*(?:\,\s*default:\s*([\\"\']?[\.\,\(\)\#\-\s\w]*[\.\,\(\)\#\-\w][\"\']?))?\s*\][\'\"]/g,Nt=function(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()};function Bt(e){var t=Nt();e();var o=Nt();Rt.perf.duration+=o-t}function Ft(e,t){void 0===t&&(t=!1),Bt((function(){var o=Array.isArray(e)?e:function(e){var t=[];if(e){for(var o=0,n=void 0;n=Mt.exec(e);){var r=n.index;r>o&&t.push({rawString:e.substring(o,r)}),t.push({theme:n[1],defaultValue:n[2]}),o=Mt.lastIndex}t.push({rawString:e.substring(o)})}return t}(e),n=Rt.runState,r=n.mode,i=n.buffer,a=n.flushTimer;t||1===r?(i.push(o),a||(Rt.runState.flushTimer=setTimeout((function(){Rt.runState.flushTimer=0,Bt((function(){var e=Rt.runState.buffer.slice();Rt.runState.buffer=[];var t=[].concat.apply([],e);t.length>0&&At(t)}))}),0))):At(o)}))}function At(e,t){Rt.loadStyles?Rt.loadStyles(Ht(e).styleString,e):function(e){if("undefined"!=typeof document){var t=document.getElementsByTagName("head")[0],o=document.createElement("style"),n=Ht(e),r=n.styleString,i=n.themable;o.setAttribute("data-load-themed-styles","true"),o.type="text/css",Pt&&o.setAttribute("nonce",Pt),o.appendChild(document.createTextNode(r)),Rt.perf.count++,t.appendChild(o);var a=document.createEvent("HTMLEvents");a.initEvent("styleinsert",!0,!1),a.args={newStyle:o},document.dispatchEvent(a);var s={styleElement:o,themableStyle:e};i?Rt.registeredThemableStyles.push(s):Rt.registeredStyles.push(s)}}(e)}function Lt(e){e.forEach((function(e){var t=e&&e.styleElement;t&&t.parentElement&&t.parentElement.removeChild(t)}))}function Ht(e){var t=Rt.theme,o=!1;return{styleString:(e||[]).map((function(e){var n=e.theme;if(n){o=!0;var r=t?t[n]:void 0,i=e.defaultValue||"inherit";return t&&!r&&console&&!(n in t)&&"undefined"!=typeof DEBUG&&DEBUG&&console.warn('Theming value not provided for "'+n+'". Falling back to "'+i+'".'),r||i}return e.rawString})).join(""),themable:o}}!function(e){e.depth0="0 0 0 0 transparent",e.depth4="0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108)",e.depth8="0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108)",e.depth16="0 6.4px 14.4px 0 rgba(0, 0, 0, 0.132), 0 1.2px 3.6px 0 rgba(0, 0, 0, 0.108)",e.depth64="0 25.6px 57.6px 0 rgba(0, 0, 0, 0.22), 0 4.8px 14.4px 0 rgba(0, 0, 0, 0.18)"}(St||(St={}));var Ot={elevation4:St.depth4,elevation8:St.depth8,elevation16:St.depth16,elevation64:St.depth64,roundedCorner2:"2px",roundedCorner4:"4px",roundedCorner6:"6px"};function zt(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];for(var n=0,r=t;n<r.length;n++){var i=r[n];Wt(e||{},i)}return e}function Wt(e,t,o){for(var n in void 0===o&&(o=[]),o.push(t),t)if(t.hasOwnProperty(n)&&"__proto__"!==n&&"constructor"!==n&&"prototype"!==n){var r=t[n];if("object"!=typeof r||null===r||Array.isArray(r))e[n]=r;else{var i=o.indexOf(r)>-1;e[n]=i?r:Wt(e[n]||{},r,o)}}return o.pop(),e}function Vt(e,t,o,n,r){return void 0===r&&(r=!1),function(e,t){var o="";return!0===t&&(o=" /* @deprecated */"),e.listTextColor=e.listText+o,e.menuItemBackgroundChecked+=o,e.warningHighlight+=o,e.warningText=e.messageText+o,e.successText+=o,e}(Kt(e,t,d({primaryButtonBorder:"transparent",errorText:n?"#F1707B":"#a4262c",messageText:n?"#F3F2F1":"#323130",messageLink:n?"#6CB8F6":"#005A9E",messageLinkHovered:n?"#82C7FF":"#004578",infoIcon:n?"#C8C6C4":"#605e5c",errorIcon:n?"#F1707B":"#A80000",blockingIcon:n?"#442726":"#FDE7E9",warningIcon:n?"#C8C6C4":"#797775",severeWarningIcon:n?"#FCE100":"#D83B01",successIcon:n?"#92C353":"#107C10",infoBackground:n?"#323130":"#f3f2f1",errorBackground:n?"#442726":"#FDE7E9",blockingBackground:n?"#442726":"#FDE7E9",warningBackground:n?"#433519":"#FFF4CE",severeWarningBackground:n?"#4F2A0F":"#FED9CC",successBackground:n?"#393D1B":"#DFF6DD",warningHighlight:n?"#fff100":"#ffb900",successText:n?"#92c353":"#107C10"},o),n),r)}function Kt(e,t,o,n,r){void 0===r&&(r=!1);var i={},a=e||{},s=a.white,l=a.black,c=a.themePrimary,u=a.themeDark,p=a.themeDarker,h=a.themeDarkAlt,m=a.themeLighter,g=a.neutralLight,f=a.neutralLighter,v=a.neutralDark,b=a.neutralQuaternary,y=a.neutralQuaternaryAlt,C=a.neutralPrimary,_=a.neutralSecondary,S=a.neutralSecondaryAlt,x=a.neutralTertiary,k=a.neutralTertiaryAlt,w=a.neutralLighterAlt,I=a.accent;return s&&(i.bodyBackground=s,i.bodyFrameBackground=s,i.accentButtonText=s,i.buttonBackground=s,i.primaryButtonText=s,i.primaryButtonTextHovered=s,i.primaryButtonTextPressed=s,i.inputBackground=s,i.inputForegroundChecked=s,i.listBackground=s,i.menuBackground=s,i.cardStandoutBackground=s),l&&(i.bodyTextChecked=l,i.buttonTextCheckedHovered=l),c&&(i.link=c,i.primaryButtonBackground=c,i.inputBackgroundChecked=c,i.inputIcon=c,i.inputFocusBorderAlt=c,i.menuIcon=c,i.menuHeader=c,i.accentButtonBackground=c),u&&(i.primaryButtonBackgroundPressed=u,i.inputBackgroundCheckedHovered=u,i.inputIconHovered=u),p&&(i.linkHovered=p),h&&(i.primaryButtonBackgroundHovered=h),m&&(i.inputPlaceholderBackgroundChecked=m),g&&(i.bodyBackgroundChecked=g,i.bodyFrameDivider=g,i.bodyDivider=g,i.variantBorder=g,i.buttonBackgroundCheckedHovered=g,i.buttonBackgroundPressed=g,i.listItemBackgroundChecked=g,i.listHeaderBackgroundPressed=g,i.menuItemBackgroundPressed=g,i.menuItemBackgroundChecked=g),f&&(i.bodyBackgroundHovered=f,i.buttonBackgroundHovered=f,i.buttonBackgroundDisabled=f,i.buttonBorderDisabled=f,i.primaryButtonBackgroundDisabled=f,i.disabledBackground=f,i.listItemBackgroundHovered=f,i.listHeaderBackgroundHovered=f,i.menuItemBackgroundHovered=f),b&&(i.primaryButtonTextDisabled=b,i.disabledSubtext=b),y&&(i.listItemBackgroundCheckedHovered=y),x&&(i.disabledBodyText=x,i.variantBorderHovered=(null==o?void 0:o.variantBorderHovered)||x,i.buttonTextDisabled=x,i.inputIconDisabled=x,i.disabledText=x),C&&(i.bodyText=C,i.actionLink=C,i.buttonText=C,i.inputBorderHovered=C,i.inputText=C,i.listText=C,i.menuItemText=C),w&&(i.bodyStandoutBackground=w,i.defaultStateBackground=w),v&&(i.actionLinkHovered=v,i.buttonTextHovered=v,i.buttonTextChecked=v,i.buttonTextPressed=v,i.inputTextHovered=v,i.menuItemTextHovered=v),_&&(i.bodySubtext=_,i.focusBorder=_,i.inputBorder=_,i.smallInputBorder=_,i.inputPlaceholderText=_),S&&(i.buttonBorder=S),k&&(i.disabledBodySubtext=k,i.disabledBorder=k,i.buttonBackgroundChecked=k,i.menuDivider=k),I&&(i.accentButtonBackground=I),(null==t?void 0:t.elevation4)&&(i.cardShadow=t.elevation4),!n&&(null==t?void 0:t.elevation8)?i.cardShadowHovered=t.elevation8:i.variantBorderHovered&&(i.cardShadowHovered="0 0 1px "+i.variantBorderHovered),d(d({},i),o)}function Gt(e,t){var o,n,r;void 0===t&&(t={});var i=zt({},e,t,{semanticColors:Kt(t.palette,t.effects,t.semanticColors,void 0===t.isInverted?e.isInverted:t.isInverted)});if((null===(o=t.palette)||void 0===o?void 0:o.themePrimary)&&!(null===(n=t.palette)||void 0===n?void 0:n.accent)&&(i.palette.accent=t.palette.themePrimary),t.defaultFontStyle)for(var a=0,s=Object.keys(i.fonts);a<s.length;a++){var l=s[a];i.fonts[l]=zt(i.fonts[l],t.defaultFontStyle,null===(r=null==t?void 0:t.fonts)||void 0===r?void 0:r[l])}return i}var Ut={s2:"4px",s1:"8px",m:"16px",l1:"20px",l2:"32px"};function jt(e,t){void 0===e&&(e={}),void 0===t&&(t=!1);var o=!!e.isInverted;return Gt({palette:vt,effects:Ot,fonts:pt,spacing:Ut,isInverted:o,disableGlobalClassNames:!1,semanticColors:Vt(vt,Ot,void 0,o,t),rtl:void 0},e)}var qt=jt({}),Yt=[],Zt="theme";function Xt(){var e,t,o,n=at();(null===(t=null==n?void 0:n.FabricConfig)||void 0===t?void 0:t.legacyTheme)?eo(n.FabricConfig.legacyTheme):Dt.getSettings([Zt]).theme||((null===(o=null==n?void 0:n.FabricConfig)||void 0===o?void 0:o.theme)&&(qt=jt(n.FabricConfig.theme)),Dt.applySettings(((e={})[Zt]=qt,e)))}function Qt(e){return void 0===e&&(e=!1),!0===e&&(qt=jt({},e)),qt}function Jt(e){-1===Yt.indexOf(e)&&Yt.push(e)}function $t(e){var t=Yt.indexOf(e);-1!==t&&Yt.splice(t,1)}function eo(e,t){var o;return void 0===t&&(t=!1),qt=jt(e,t),function(e){Rt.theme=e,function(){if(Rt.theme){for(var e=[],t=0,o=Rt.registeredThemableStyles;t<o.length;t++){var n=o[t];e.push(n.themableStyle)}e.length>0&&(void 0===(r=1)&&(r=3),3!==r&&2!==r||(Lt(Rt.registeredStyles),Rt.registeredStyles=[]),3!==r&&1!==r||(Lt(Rt.registeredThemableStyles),Rt.registeredThemableStyles=[]),At([].concat.apply([],e)))}var r}()}(d(d(d(d({},qt.palette),qt.semanticColors),qt.effects),function(e){for(var t={},o=0,n=Object.keys(e.fonts);o<n.length;o++)for(var r=n[o],i=e.fonts[r],a=0,s=Object.keys(i);a<s.length;a++){var l=s[a],c=r+l.charAt(0).toUpperCase()+l.slice(1),u=i[l];"fontSize"===l&&"number"==typeof u&&(u+="px"),t[c]=u}return t}(qt))),Dt.applySettings(((o={})[Zt]=qt,o)),Yt.forEach((function(e){try{e(qt)}catch(e){}})),qt}Xt();var to={};for(var oo in vt)vt.hasOwnProperty(oo)&&(no(to,oo,"",!1,"color"),no(to,oo,"Hover",!0,"color"),no(to,oo,"Background",!1,"background"),no(to,oo,"BackgroundHover",!0,"background"),no(to,oo,"Border",!1,"borderColor"),no(to,oo,"BorderHover",!0,"borderColor"));function no(e,t,o,n,r){Object.defineProperty(e,t+o,{get:function(){var e,o=((e={})[r]=Qt().palette[t],e);return Z(n?{selectors:{":hover":o}}:o).toString()},enumerable:!0,configurable:!0})}var ro="@media screen and (-ms-high-contrast: active), (forced-colors: active)",io="@media screen and (-ms-high-contrast: black-on-white), (forced-colors: black-on-white)",ao="@media screen and (-ms-high-contrast: white-on-black), (forced-colors: white-on-black)",so="@media screen and (forced-colors: active)",lo=320,co=480,uo=640,po=1024,ho=1366,mo=1920,go=co-1,fo=uo-1,vo=po-1,bo=ho-1,yo=mo-1,Co=768;function _o(e,t){return"@media only screen"+("number"==typeof e?" and (min-width: "+e+"px)":"")+("number"==typeof t?" and (max-width: "+t+"px)":"")}function So(){return{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}}function xo(){var e;return(e={})[so]={forcedColorAdjust:"none"},e}var ko,wo="ms-Fabric--isFocusVisible",Io="ms-Fabric--isFocusHidden";function Do(e,t){var o=t?at(t):at();if(o){var n=o.document.body.classList;n.add(e?wo:Io),n.remove(e?Io:wo)}}function To(e,t,o,n,r,i,a){return function(e,t){var o,n;void 0===t&&(t={});var r=t.inset,i=void 0===r?0:r,a=t.width,s=void 0===a?1:a,l=t.position,c=void 0===l?"relative":l,u=t.highContrastStyle,d=t.borderColor,p=void 0===d?e.palette.white:d,h=t.outlineColor,m=void 0===h?e.palette.neutralSecondary:h,g=t.isFocusedOnly;return{outline:"transparent",position:c,selectors:(o={"::-moz-focus-inner":{border:"0"}},o["."+wo+" &"+(void 0===g||g?":focus":"")+":after"]={content:'""',position:"absolute",left:i+1,top:i+1,bottom:i+1,right:i+1,border:s+"px solid "+p,outline:s+"px solid "+m,zIndex:ko.FocusStyle,selectors:(n={},n[ro]=u,n)},o)}}(e,"number"!=typeof t&&t?t:{inset:t,position:o,highContrastStyle:n,borderColor:r,outlineColor:i,isFocusedOnly:a})}function Eo(){return{selectors:{"&::-moz-focus-inner":{border:0},"&":{outline:"transparent"}}}}function Po(e,t,o,n){var r;return void 0===t&&(t=0),void 0===o&&(o=1),{selectors:(r={},r[":global("+wo+") &:focus"]={outline:o+" solid "+(n||e.palette.neutralSecondary),outlineOffset:-t+"px"},r)}}!function(e){e.Nav=1,e.ScrollablePane=1,e.FocusStyle=1,e.Coachmark=1e3,e.Layer=1e6,e.KeytipLayer=1000001}(ko||(ko={}));var Ro=function(e,t,o,n){var r,i,a;void 0===o&&(o="border"),void 0===n&&(n=-1);var s="borderBottom"===o;return{borderColor:e,selectors:{":after":(r={pointerEvents:"none",content:"''",position:"absolute",left:s?0:n,top:n,bottom:n,right:s?0:n},r[o]="2px solid "+e,r.borderRadius=t,r.width="borderBottom"===o?"100%":void 0,r.selectors=(i={},i[ro]=(a={},a["border"===o?"borderColor":"borderBottomColor"]="Highlight",a),i),r)}}},Mo={position:"absolute",width:1,height:1,margin:-1,padding:0,border:0,overflow:"hidden",whiteSpace:"nowrap"};function No(e,t){return{borderColor:e,borderWidth:"0px",width:t,height:t}}function Bo(e){return{opacity:1,borderWidth:e}}function Fo(e,t){return{borderWidth:"0",width:t,height:t,opacity:0,borderColor:e}}function Ao(e,t){return d(d({},No(e,t)),{opacity:0})}var Lo={continuousPulseAnimationDouble:function(e,t,o,n,r){return J({"0%":No(e,o),"1.42%":Bo(r),"3.57%":{opacity:1},"7.14%":Fo(t,n),"8%":Ao(e,o),"29.99%":Ao(e,o),"30%":No(e,o),"31.42%":Bo(r),"33.57%":{opacity:1},"37.14%":Fo(t,n),"38%":Ao(e,o),"79.42%":Ao(e,o),79.43:No(e,o),81.85:Bo(r),83.42:{opacity:1},"87%":Fo(t,n),"100%":{}})},continuousPulseAnimationSingle:function(e,t,o,n,r){return J({"0%":No(e,o),"14.2%":Bo(r),"35.7%":{opacity:1},"71.4%":Fo(t,n),"100%":{}})},createDefaultAnimation:function(e,t){return{animationName:e,animationIterationCount:"1",animationDuration:"14s",animationDelay:t||"2s"}}},Ho=!1,Oo=0,zo={empty:!0},Wo={},Vo="undefined"==typeof WeakMap?null:WeakMap;function Ko(e){Vo=e}function Go(){Oo++}function Uo(e,t,o){var n=jo(o.value&&o.value.bind(null));return{configurable:!0,get:function(){return n}}}function jo(e,t,o){if(void 0===t&&(t=100),void 0===o&&(o=!1),!Vo)return e;if(!Ho){var n=_.getInstance();n&&n.onReset&&_.getInstance().onReset(Go),Ho=!0}var r,i=0,a=Oo;return function(){for(var n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];var l=r;(void 0===r||a!==Oo||t>0&&i>t)&&(r=Zo(),i=0,a=Oo),l=r;for(var c=0;c<n.length;c++){var u=Yo(n[c]);l.map.has(u)||l.map.set(u,Zo()),l=l.map.get(u)}return l.hasOwnProperty("value")||(l.value=e.apply(void 0,n),i++),!o||null!==l.value&&void 0!==l.value||(l.value=e.apply(void 0,n)),l.value}}function qo(e){if(!Vo)return e;var t=new Vo;return function(o){if(!o||"function"!=typeof o&&"object"!=typeof o)return e(o);if(t.has(o))return t.get(o);var n=e(o);return t.set(o,n),n}}function Yo(e){return e?"object"==typeof e||"function"==typeof e?e:(Wo[e]||(Wo[e]={val:e}),Wo[e]):zo}function Zo(){return{map:Vo?new Vo:null}}var Xo=jo((function(e,t){var o=_.getInstance();return t?Object.keys(e).reduce((function(t,n){return t[n]=o.getClassName(e[n]),t}),{}):e}));function Qo(e,t,o){return Xo(e,void 0!==o?o:t.disableGlobalClassNames)}function Jo(e,t){return void 0===e&&(e={}),(en(t)?t:function(e){return function(t){return e?d(d({},t),e):t}}(t))(e)}function $o(e,t){return void 0===e&&(e={}),(en(t)?t:(void 0===(o=t)&&(o={}),function(e){var t=d({},e);for(var n in o)o.hasOwnProperty(n)&&(t[n]=d(d({},e[n]),o[n]));return t}))(e);var o}function en(e){return"function"==typeof e}function tn(e,t,o){var n,r=e,i=o||Dt.getSettings(["theme"],void 0,e.customizations).theme;o&&(n={theme:o});var a=t&&i&&i.schemes&&i.schemes[t];return i&&a&&i!==a&&((n={theme:a}).theme.schemes=i.schemes),n&&(r={customizations:{settings:Jo(e.customizations.settings,n),scopedSettings:e.customizations.scopedSettings}}),r}var on={boxShadow:"none",margin:0,padding:0,boxSizing:"border-box"},nn={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function rn(e,t,o,n,r){void 0===t&&(t="bodyBackground"),void 0===o&&(o="horizontal"),void 0===n&&(n=an("width",o)),void 0===r&&(r=an("height",o));var i=e.semanticColors[t]||e.palette[t],a=function(e){if("#"===e[0])return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16)};if(0===e.indexOf("rgba(")){var t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2]}}return{r:255,g:255,b:255}}(i);return{content:'""',position:"absolute",right:0,bottom:0,width:n,height:r,pointerEvents:"none",backgroundImage:"linear-gradient("+("vertical"===o?"to bottom":"to right")+", rgba("+a.r+", "+a.g+", "+a.b+", 0) 0%, "+i+" 100%)"}}function an(e,t){return"width"===e?"horizontal"===t?20:"100%":"vertical"===t?"50%":"100%"}function sn(e){return{selectors:{"::placeholder":e,":-ms-input-placeholder":e,"::-ms-input-placeholder":e}}}var ln=void 0;function cn(e){ln?ln(e):console&&console.warn&&console.warn(e)}function un(e){ln=e}var dn=yt.getValue("icons",{__options:{disableWarnings:!1,warnOnMissingIcons:!0},__remapped:{}}),pn=_.getInstance();pn&&pn.onReset&&pn.onReset((function(){for(var e in dn)dn.hasOwnProperty(e)&&dn[e].subset&&(dn[e].subset.className=void 0)}));var hn=function(e){return e.toLowerCase()};function mn(e,t){var o=d(d({},e),{isRegistered:!1,className:void 0}),n=e.icons;for(var r in t=t?d(d({},dn.__options),t):dn.__options,n)if(n.hasOwnProperty(r)){var i=n[r],a=hn(r);dn[a]?_n(r):dn[a]={code:i,subset:o}}}function gn(e){for(var t=dn.__options,o=function(e){var o=hn(e);dn[o]?delete dn[o]:t.disableWarnings||cn('The icon "'+e+'" tried to unregister but was not registered.'),dn.__remapped[o]&&delete dn.__remapped[o],Object.keys(dn.__remapped).forEach((function(e){dn.__remapped[e]===o&&delete dn.__remapped[e]}))},n=0,r=e;n<r.length;n++)o(r[n])}function fn(e,t){dn.__remapped[hn(e)]=hn(t)}function vn(e){var t=void 0,o=dn.__options;if(e=e?hn(e):"",e=dn.__remapped[e]||e)if(t=dn[e]){var n=t.subset;n&&n.fontFace&&(n.isRegistered||(Xe(n.fontFace),n.isRegistered=!0),n.className||(n.className=Z(n.style,{fontFamily:n.fontFace.fontFamily,fontWeight:n.fontFace.fontWeight||"normal",fontStyle:n.fontFace.fontStyle||"normal"})))}else!o.disableWarnings&&o.warnOnMissingIcons&&cn('The icon "'+e+'" was used but not registered. See https://github.com/microsoft/fluentui/wiki/Using-icons for more information.');return t}function bn(e){dn.__options=d(d({},dn.__options),e)}var yn=[],Cn=void 0;function _n(e){dn.__options.disableWarnings||(yn.push(e),void 0===Cn&&(Cn=setTimeout((function(){cn("Some icons were re-registered. Applications should only call registerIcons for any given icon once. Redefining what an icon is may have unintended consequences. Duplicates include: \n"+yn.slice(0,10).join(", ")+(yn.length>10?" (+ "+(yn.length-10)+" more)":"")),Cn=void 0,yn=[]}),2e3)))}var Sn={display:"inline-block"};function xn(e){var t="",o=vn(e);return o&&(t=Z(o.subset.className,Sn,{selectors:{"::before":{content:'"'+o.code+'"'}}})),t}function kn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e&&1===e.length&&e[0]&&!e[0].subComponentStyles)return e[0];for(var o={},n={},r=0,i=e;r<i.length;r++){var a=i[r];if(a)for(var s in a)if(a.hasOwnProperty(s)){if("subComponentStyles"===s&&void 0!==a.subComponentStyles){var l=a.subComponentStyles;for(var c in l)l.hasOwnProperty(c)&&(n.hasOwnProperty(c)?n[c].push(l[c]):n[c]=[l[c]]);continue}var u=o[s],d=a[s];o[s]=void 0===u?d:m(Array.isArray(u)?u:[u],Array.isArray(d)?d:[d])}}if(Object.keys(n).length>0){o.subComponentStyles={};var p=o.subComponentStyles,h=function(e){if(n.hasOwnProperty(e)){var t=n[e];p[e]=function(e){return kn.apply(void 0,t.map((function(t){return"function"==typeof t?t(e):t})))}}};for(var c in n)h(c)}return o}function wn(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];for(var n=[],r=0,i=t;r<i.length;r++){var a=i[r];a&&n.push("function"==typeof a?a(e):a)}return 1===n.length?n[0]:n.length?kn.apply(void 0,n):{}}function In(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Dn(e,w())}function Dn(e,t){var o={subComponentStyles:{}};if(!e[0]&&e.length<=1)return{subComponentStyles:{}};var n=kn.apply(void 0,e),r=[];for(var i in n)if(n.hasOwnProperty(i)){if("subComponentStyles"===i){o.subComponentStyles=n.subComponentStyles||{};continue}var a=S(n[i]),s=a.classes,l=a.objects;(null==l?void 0:l.length)?(d=q(t||{},{displayName:i},l))&&(r.push(d),o[i]=s.concat([d.className]).join(" ")):o[i]=s.join(" ")}for(var c=0,u=r;c<u.length;c++){var d;(d=u[c])&&Y(d,null==t?void 0:t.specificityMultiplier)}return o}var Tn={},En=void 0;try{En=window}catch(e){}function Pn(e,t){if(void 0!==En){var o=En.__packages__=En.__packages__||{};o[e]&&Tn[e]||(Tn[e]=t,(o[e]=o[e]||[]).push(t))}}Pn("@fluentui/set-version","6.0.0"),Pn("@fluentui/style-utilities","8.4.2"),Xt();var Rn=jo((function(e,t,o,n){return{root:Z("ms-ActivityItem",t,e.root,n&&e.isCompactRoot),pulsingBeacon:Z("ms-ActivityItem-pulsingBeacon",e.pulsingBeacon),personaContainer:Z("ms-ActivityItem-personaContainer",e.personaContainer,n&&e.isCompactPersonaContainer),activityPersona:Z("ms-ActivityItem-activityPersona",e.activityPersona,n&&e.isCompactPersona,!n&&o&&2===o.length&&e.doublePersona),activityTypeIcon:Z("ms-ActivityItem-activityTypeIcon",e.activityTypeIcon,n&&e.isCompactIcon),activityContent:Z("ms-ActivityItem-activityContent",e.activityContent,n&&e.isCompactContent),activityText:Z("ms-ActivityItem-activityText",e.activityText),commentText:Z("ms-ActivityItem-commentText",e.commentText),timeStamp:Z("ms-ActivityItem-timeStamp",e.timeStamp,n&&e.isCompactTimeStamp)}})),Mn="32px",Nn="16px",Bn="16px",Fn="13px",An=jo((function(){return J({from:{opacity:0},to:{opacity:1}})})),Ln=jo((function(){return J({from:{transform:"translateX(-10px)"},to:{transform:"translateX(0)"}})})),Hn=jo((function(e,t,o,n,r,i){var a;void 0===e&&(e=Qt());var s={animationName:Lo.continuousPulseAnimationSingle(n||e.palette.themePrimary,r||e.palette.themeTertiary,"4px","28px","4px"),animationIterationCount:"1",animationDuration:".8s",zIndex:1},l={animationName:Ln(),animationIterationCount:"1",animationDuration:".5s"},c={animationName:An(),animationIterationCount:"1",animationDuration:".5s"};return kn({root:[e.fonts.small,{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",boxSizing:"border-box",color:e.palette.neutralSecondary},i&&o&&c],pulsingBeacon:[{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"0px",height:"0px",borderRadius:"225px",borderStyle:"solid",opacity:0},i&&o&&s],isCompactRoot:{alignItems:"center"},personaContainer:{display:"flex",flexWrap:"wrap",minWidth:Mn,width:Mn,height:Mn},isCompactPersonaContainer:{display:"inline-flex",flexWrap:"nowrap",flexBasis:"auto",height:Nn,width:"auto",minWidth:"0",paddingRight:"6px"},activityTypeIcon:{height:Mn,fontSize:Bn,lineHeight:Bn,marginTop:"3px"},isCompactIcon:{height:Nn,minWidth:Nn,fontSize:Fn,lineHeight:Fn,color:e.palette.themePrimary,marginTop:"1px",position:"relative",display:"flex",justifyContent:"center",alignItems:"center",selectors:{".ms-Persona-imageArea":{margin:"-2px 0 0 -2px",border:"2px solid"+e.palette.white,borderRadius:"50%",selectors:(a={},a[ro]={border:"none",margin:"0"},a)}}},activityPersona:{display:"block"},doublePersona:{selectors:{":first-child":{alignSelf:"flex-end"}}},isCompactPersona:{display:"inline-block",width:"8px",minWidth:"8px",overflow:"visible"},activityContent:[{padding:"0 8px"},i&&o&&l],activityText:{display:"inline"},isCompactContent:{flex:"1",padding:"0 4px",whiteSpace:"nowrap",textOverflow:"ellipsis",overflowX:"hidden"},commentText:{color:e.palette.neutralPrimary},timeStamp:[e.fonts.tiny,{fontWeight:400,color:e.palette.neutralSecondary}],isCompactTimeStamp:{display:"inline-block",paddingLeft:"0.3em",fontSize:"1em"}},t)})),On=f.createContext({customizations:{inCustomizerContext:!1,settings:{},scopedSettings:{}}});function zn(e,t){var o,n=(o=f.useState(0)[1],function(){return o((function(e){return++e}))}),r=f.useContext(On).customizations,i=r.inCustomizerContext;return f.useEffect((function(){return i||Dt.observe(n),function(){i||Dt.unobserve(n)}}),[i]),Dt.getSettings(e,t,r)}var Wn=["theme","styles"];function Vn(e,t,o,n,r){var i=(n=n||{scope:"",fields:void 0}).scope,a=n.fields,s=void 0===a?Wn:a,l=f.forwardRef((function(n,r){var a=f.useRef(),l=zn(s,i),c=l.styles,u=(l.dir,p(l,["styles","dir"])),h=o?o(n):void 0,m=a.current&&a.current.__cachedInputs__||[];if(!a.current||c!==m[1]||n.styles!==m[2]){var g=function(e){return wn(e,t,c,n.styles)};g.__cachedInputs__=[t,c,n.styles],g.__noStyleOverride__=!c&&!n.styles,a.current=g}return f.createElement(e,d({ref:r},u,h,n,{styles:a.current}))}));l.displayName="Styled"+(e.displayName||e.name);var c=r?f.memo(l):l;return l.displayName&&(c.displayName=l.displayName),c}var Kn,Gn={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pauseBreak:19,capslock:20,escape:27,space:32,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,del:46,zero:48,one:49,two:50,three:51,four:52,five:53,six:54,seven:55,eight:56,nine:57,colon:58,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,leftWindow:91,rightWindow:92,select:93,zero_numpad:96,one_numpad:97,two_numpad:98,three_numpad:99,four_numpad:100,five_numpad:101,six_numpad:102,seven_numpad:103,eight_numpad:104,nine_numpad:105,multiply:106,add:107,subtract:109,decimalPoint:110,divide:111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrollLock:145,semicolon:186,equalSign:187,comma:188,dash:189,period:190,forwardSlash:191,graveAccent:192,openBracket:219,backSlash:220,closeBracket:221,singleQuote:222},Un="isRTL";function jn(e){if(void 0===e&&(e={}),void 0!==e.rtl)return e.rtl;if(void 0===Kn){var t=st(Un);null!==t&&qn(Kn="1"===t);var o=nt();void 0===Kn&&o&&x(Kn="rtl"===(o.body&&o.body.getAttribute("dir")||o.documentElement.getAttribute("dir")))}return!!Kn}function qn(e,t){void 0===t&&(t=!1);var o=nt();o&&o.documentElement.setAttribute("dir",e?"rtl":"ltr"),t&&lt(Un,e?"1":"0"),x(Kn=e)}function Yn(e,t){return void 0===t&&(t={}),jn(t)&&(e===Gn.left?e=Gn.right:e===Gn.right&&(e=Gn.left)),e}var Zn=0,Xn=_.getInstance();Xn&&Xn.onReset&&Xn.onReset((function(){return Zn++}));var Qn="__retval__";function Jn(e){void 0===e&&(e={});var t=new Map,o=0,n=0,r=Zn;return function(i,a){var s;if(void 0===a&&(a={}),e.useStaticStyles&&"function"==typeof i&&i.__noStyleOverride__)return i(a);n++;var l=t,c=a.theme,u=c&&void 0!==c.rtl?c.rtl:jn(),d=e.disableCaching;if(r!==Zn&&(r=Zn,t=new Map,o=0),e.disableCaching||(l=er(t,i),l=er(l,a)),!d&&l[Qn]||(l[Qn]=void 0===i?{}:Dn(["function"==typeof i?i(a):i],{rtl:!!u,specificityMultiplier:e.useStaticStyles?5:void 0}),d||o++),o>(e.cacheSize||50)){var p=at();(null===(s=null==p?void 0:p.FabricConfig)||void 0===s?void 0:s.enableClassNameCacheFullWarning)&&(console.warn("Styles are being recalculated too frequently. Cache miss rate is "+o+"/"+n+"."),console.trace()),t.clear(),o=0,e.disableCaching=!0}return l[Qn]}}function $n(e,t){return t=function(e){switch(e){case void 0:return"__undefined__";case null:return"__null__";default:return e}}(t),e.has(t)||e.set(t,new Map),e.get(t)}function er(e,t){if("function"==typeof t)if(t.__cachedInputs__)for(var o=0,n=t.__cachedInputs__;o<n.length;o++)e=$n(e,n[o]);else e=$n(e,t);else if("object"==typeof t)for(var r in t)t.hasOwnProperty(r)&&(e=$n(e,t[r]));return e}function tr(e,t){for(var o=d({},t),n=0,r=Object.keys(e);n<r.length;n++){var i=r[n];void 0===o[i]&&(o[i]=e[i])}return o}var or=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var o={},n=0,r=e;n<r.length;n++)for(var i=r[n],a=Array.isArray(i)?i:Object.keys(i),s=0,l=a;s<l.length;s++){var c=l[s];o[c]=1}return o},nr=or(["onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onInput","onSubmit","onLoad","onError","onKeyDown","onKeyDownCapture","onKeyPress","onKeyUp","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onClick","onClickCapture","onContextMenu","onDoubleClick","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onMouseUpCapture","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onScroll","onWheel","onPointerCancel","onPointerDown","onPointerEnter","onPointerLeave","onPointerMove","onPointerOut","onPointerOver","onPointerUp","onGotPointerCapture","onLostPointerCapture"]),rr=or(["accessKey","children","className","contentEditable","dir","draggable","hidden","htmlFor","id","lang","ref","role","style","tabIndex","title","translate","spellCheck","name"]),ir=or(rr,nr),ar=or(ir,["form"]),sr=or(ir,["height","loop","muted","preload","src","width"]),lr=or(sr,["poster"]),cr=or(ir,["start"]),ur=or(ir,["value"]),dr=or(ir,["download","href","hrefLang","media","rel","target","type"]),pr=or(ir,["autoFocus","disabled","form","formAction","formEncType","formMethod","formNoValidate","formTarget","type","value"]),hr=or(pr,["accept","alt","autoCapitalize","autoComplete","checked","dirname","form","height","inputMode","list","max","maxLength","min","minLength","multiple","pattern","placeholder","readOnly","required","src","step","size","type","value","width"]),mr=or(pr,["autoCapitalize","cols","dirname","form","maxLength","minLength","placeholder","readOnly","required","rows","wrap"]),gr=or(pr,["form","multiple","required"]),fr=or(ir,["selected","value"]),vr=or(ir,["cellPadding","cellSpacing"]),br=ir,yr=or(ir,["rowSpan","scope"]),Cr=or(ir,["colSpan","headers","rowSpan","scope"]),_r=or(ir,["span"]),Sr=or(ir,["span"]),xr=or(ir,["acceptCharset","action","encType","encType","method","noValidate","target"]),kr=or(ir,["allow","allowFullScreen","allowPaymentRequest","allowTransparency","csp","height","importance","referrerPolicy","sandbox","src","srcDoc","width"]),wr=or(ir,["alt","crossOrigin","height","src","srcSet","useMap","width"]),Ir=wr,Dr=ir;function Tr(e,t,o){for(var n=Array.isArray(t),r={},i=0,a=Object.keys(e);i<a.length;i++){var s=a[i];!(!n&&t[s]||n&&t.indexOf(s)>=0||0===s.indexOf("data-")||0===s.indexOf("aria-"))||o&&-1!==(null==o?void 0:o.indexOf(s))||(r[s]=e[s])}return r}var Er,Pr,Rr,Mr,Nr=/[\(\[\{\<][^\)\]\}\>]*[\)\]\}\>]/g,Br=/[\0-\u001F\!-/:-@\[-`\{-\u00BF\u0250-\u036F\uD800-\uFFFF]/g,Fr=/^\d+[\d\s]*(:?ext|x|)\s*\d+$/i,Ar=/\s+/g,Lr=/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uAC00-\uD7AF\uD7B0-\uD7FF\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]|[\uD840-\uD869][\uDC00-\uDED6]/;function Hr(e,t,o){return e?(e=function(e){return(e=(e=(e=e.replace(Nr,"")).replace(Br,"")).replace(Ar," ")).trim()}(e),Lr.test(e)||!o&&Fr.test(e)?"":function(e,t){var o="",n=e.split(" ");return 2===n.length?(o+=n[0].charAt(0).toUpperCase(),o+=n[1].charAt(0).toUpperCase()):3===n.length?(o+=n[0].charAt(0).toUpperCase(),o+=n[2].charAt(0).toUpperCase()):0!==n.length&&(o+=n[0].charAt(0).toUpperCase()),t&&o.length>1?o.charAt(1)+o.charAt(0):o}(e,t)):""}function Or(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=f.useCallback((function(t){o.current=t;for(var n=0,r=e;n<r.length;n++){var i=r[n];"function"==typeof i?i(t):i&&(i.current=t)}}),m(e));return o}!function(e){e[e.default=0]="default",e[e.image=1]="image",e[e.Default=1e5]="Default",e[e.Image=100001]="Image"}(Er||(Er={})),function(e){e[e.center=0]="center",e[e.contain=1]="contain",e[e.cover=2]="cover",e[e.none=3]="none",e[e.centerCover=4]="centerCover",e[e.centerContain=5]="centerContain"}(Pr||(Pr={})),function(e){e[e.landscape=0]="landscape",e[e.portrait=1]="portrait"}(Rr||(Rr={})),function(e){e[e.notLoaded=0]="notLoaded",e[e.loaded=1]="loaded",e[e.error=2]="error",e[e.errorLoaded=3]="errorLoaded"}(Mr||(Mr={}));var zr=Jn(),Wr=/\.svg$/i,Vr=f.forwardRef((function(e,t){var o=f.useRef(),n=f.useRef(),r=function(e,t){var o=e.onLoadingStateChange,n=e.onLoad,r=e.onError,i=e.src,a=f.useState(Mr.notLoaded),s=a[0],l=a[1];f.useLayoutEffect((function(){l(Mr.notLoaded)}),[i]),f.useEffect((function(){s===Mr.notLoaded&&t.current&&(i&&t.current.naturalWidth>0&&t.current.naturalHeight>0||t.current.complete&&Wr.test(i))&&l(Mr.loaded)})),f.useEffect((function(){null==o||o(s)}),[s]);var c=f.useCallback((function(e){null==n||n(e),i&&l(Mr.loaded)}),[i,n]),u=f.useCallback((function(e){null==r||r(e),l(Mr.error)}),[r]);return[s,c,u]}(e,n),i=r[0],a=r[1],s=r[2],l=Tr(e,wr,["width","height"]),c=e.src,u=e.alt,p=e.width,h=e.height,m=e.shouldFadeIn,g=void 0===m||m,v=e.shouldStartVisible,b=e.className,y=e.imageFit,C=e.role,_=e.maximizeFrame,S=e.styles,x=e.theme,k=e.loading,w=function(e,t,o,n){var r=f.useRef(t),i=f.useRef();return(void 0===i||r.current===Mr.notLoaded&&t===Mr.loaded)&&(i.current=function(e,t,o,n){var r=e.imageFit,i=e.width,a=e.height;if(void 0!==e.coverStyle)return e.coverStyle;if(t===Mr.loaded&&(r===Pr.cover||r===Pr.contain||r===Pr.centerContain||r===Pr.centerCover)&&o.current&&n.current){var s;if(s="number"==typeof i&&"number"==typeof a&&r!==Pr.centerContain&&r!==Pr.centerCover?i/a:n.current.clientWidth/n.current.clientHeight,o.current.naturalWidth/o.current.naturalHeight>s)return Rr.landscape}return Rr.portrait}(e,t,o,n)),r.current=t,i.current}(e,i,n,o),I=zr(S,{theme:x,className:b,width:p,height:h,maximizeFrame:_,shouldFadeIn:g,shouldStartVisible:v,isLoaded:i===Mr.loaded||i===Mr.notLoaded&&e.shouldStartVisible,isLandscape:w===Rr.landscape,isCenter:y===Pr.center,isCenterContain:y===Pr.centerContain,isCenterCover:y===Pr.centerCover,isContain:y===Pr.contain,isCover:y===Pr.cover,isNone:y===Pr.none,isError:i===Mr.error,isNotImageFit:void 0===y});return f.createElement("div",{className:I.root,style:{width:p,height:h},ref:o},f.createElement("img",d({},l,{onLoad:a,onError:s,key:"fabricImage"+e.src||"",className:I.image,ref:Or(n,t),src:c,alt:u,role:C,loading:k})))}));Vr.displayName="ImageBase";var Kr={root:"ms-Image",rootMaximizeFrame:"ms-Image--maximizeFrame",image:"ms-Image-image",imageCenter:"ms-Image-image--center",imageContain:"ms-Image-image--contain",imageCover:"ms-Image-image--cover",imageCenterContain:"ms-Image-image--centerContain",imageCenterCover:"ms-Image-image--centerCover",imageNone:"ms-Image-image--none",imageLandscape:"ms-Image-image--landscape",imagePortrait:"ms-Image-image--portrait"},Gr=Vn(Vr,(function(e){var t=e.className,o=e.width,n=e.height,r=e.maximizeFrame,i=e.isLoaded,a=e.shouldFadeIn,s=e.shouldStartVisible,l=e.isLandscape,c=e.isCenter,u=e.isContain,d=e.isCover,p=e.isCenterContain,h=e.isCenterCover,m=e.isNone,g=e.isError,f=e.isNotImageFit,v=e.theme,b=Qo(Kr,v),y={position:"absolute",left:"50% /* @noflip */",top:"50%",transform:"translate(-50%,-50%)"},C=at(),_=void 0!==C&&void 0===C.navigator.msMaxTouchPoints,S=u&&l||d&&!l?{width:"100%",height:"auto"}:{width:"auto",height:"100%"};return{root:[b.root,v.fonts.medium,{overflow:"hidden"},r&&[b.rootMaximizeFrame,{height:"100%",width:"100%"}],i&&a&&!s&&Ze.fadeIn400,(c||u||d||p||h)&&{position:"relative"},t],image:[b.image,{display:"block",opacity:0},i&&["is-loaded",{opacity:1}],c&&[b.imageCenter,y],u&&[b.imageContain,_&&{width:"100%",height:"100%",objectFit:"contain"},!_&&S,!_&&y],d&&[b.imageCover,_&&{width:"100%",height:"100%",objectFit:"cover"},!_&&S,!_&&y],p&&[b.imageCenterContain,l&&{maxWidth:"100%"},!l&&{maxHeight:"100%"},y],h&&[b.imageCenterCover,l&&{maxHeight:"100%"},!l&&{maxWidth:"100%"},y],m&&[b.imageNone,{width:"auto",height:"auto"}],f&&[!!o&&!n&&{height:"auto",width:"100%"},!o&&!!n&&{height:"100%",width:"auto"},!!o&&!!n&&{height:"100%",width:"100%"}],l&&b.imageLandscape,!l&&b.imagePortrait,!i&&"is-notLoaded",a&&"is-fadeIn",g&&"is-error"]}}),void 0,{scope:"Image"},!0);Gr.displayName="Image";var Ur=In({root:{display:"inline-block"},placeholder:["ms-Icon-placeHolder",{width:"1em"}],image:["ms-Icon-imageContainer",{overflow:"hidden"}]}),jr="ms-Icon";function qr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var o=[],n=0,r=e;n<r.length;n++){var i=r[n];if(i)if("string"==typeof i)o.push(i);else if(i.hasOwnProperty("toString")&&"function"==typeof i.toString)o.push(i.toString());else for(var a in i)i[a]&&o.push(a)}return o.join(" ")}var Yr,Zr,Xr,Qr,Jr,$r,ei=jo((function(e){var t=vn(e)||{subset:{},code:void 0},o=t.code,n=t.subset;return o?{children:o,iconClassName:n.className,fontFamily:n.fontFace&&n.fontFace.fontFamily,mergeImageProps:n.mergeImageProps}:null}),void 0,!0),ti=function(e){var t=e.iconName,o=e.className,n=e.style,r=void 0===n?{}:n,i=ei(t)||{},a=i.iconClassName,s=i.children,l=i.fontFamily,c=i.mergeImageProps,u=Tr(e,ir),p=e["aria-label"]||e.title,h=e["aria-label"]||e["aria-labelledby"]||e.title?{role:c?void 0:"img"}:{"aria-hidden":!0},m=s;return c&&"object"==typeof s&&"object"==typeof s.props&&p&&(m=f.cloneElement(s,{alt:p})),f.createElement("i",d({"data-icon-name":t},h,u,c?{title:void 0,"aria-label":void 0}:{},{className:qr(jr,Ur.root,a,!t&&Ur.placeholder,o),style:d({fontFamily:l},r)}),m)},oi=jo((function(e,t,o){return ti({iconName:e,className:t,"aria-label":o})})),ni=Jn({cacheSize:100}),ri=function(e){function t(t){var o=e.call(this,t)||this;return o._onImageLoadingStateChange=function(e){o.props.imageProps&&o.props.imageProps.onLoadingStateChange&&o.props.imageProps.onLoadingStateChange(e),e===Mr.error&&o.setState({imageLoadError:!0})},o.state={imageLoadError:!1},o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.children,o=e.className,n=e.styles,r=e.iconName,i=e.imageErrorAs,a=e.theme,s="string"==typeof r&&0===r.length,l=!!this.props.imageProps||this.props.iconType===Er.image||this.props.iconType===Er.Image,c=ei(r)||{},u=c.iconClassName,p=c.children,h=c.mergeImageProps,m=ni(n,{theme:a,className:o,iconClassName:u,isImage:l,isPlaceholder:s}),g=l?"span":"i",v=Tr(this.props,ir,["aria-label"]),b=this.state.imageLoadError,y=d(d({},this.props.imageProps),{onLoadingStateChange:this._onImageLoadingStateChange}),C=b&&i||Gr,_=this.props["aria-label"]||this.props.ariaLabel,S=y.alt||_||this.props.title,x=S||this.props["aria-labelledby"]||y["aria-label"]||y["aria-labelledby"]?{role:l||h?void 0:"img","aria-label":l||h?void 0:S}:{"aria-hidden":!0},k=p;return h&&p&&"object"==typeof p&&S&&(k=f.cloneElement(p,{alt:S})),f.createElement(g,d({"data-icon-name":r},x,v,h?{title:void 0,"aria-label":void 0}:{},{className:m.root}),l?f.createElement(C,d({},y)):t||k)},t}(f.Component),ii=Vn(ri,(function(e){var t=e.className,o=e.iconClassName,n=e.isPlaceholder,r=e.isImage,i=e.styles;return{root:[n&&Ur.placeholder,Ur.root,r&&Ur.image,o,t,i&&i.root,i&&i.imageContainer]}}),void 0,{scope:"Icon"},!0);ii.displayName="Icon",function(e){e[e.tiny=0]="tiny",e[e.extraExtraSmall=1]="extraExtraSmall",e[e.extraSmall=2]="extraSmall",e[e.small=3]="small",e[e.regular=4]="regular",e[e.large=5]="large",e[e.extraLarge=6]="extraLarge",e[e.size8=17]="size8",e[e.size10=9]="size10",e[e.size16=8]="size16",e[e.size24=10]="size24",e[e.size28=7]="size28",e[e.size32=11]="size32",e[e.size40=12]="size40",e[e.size48=13]="size48",e[e.size56=16]="size56",e[e.size72=14]="size72",e[e.size100=15]="size100",e[e.size120=18]="size120"}(Yr||(Yr={})),function(e){e[e.none=0]="none",e[e.offline=1]="offline",e[e.online=2]="online",e[e.away=3]="away",e[e.dnd=4]="dnd",e[e.blocked=5]="blocked",e[e.busy=6]="busy"}(Zr||(Zr={})),function(e){e[e.lightBlue=0]="lightBlue",e[e.blue=1]="blue",e[e.darkBlue=2]="darkBlue",e[e.teal=3]="teal",e[e.lightGreen=4]="lightGreen",e[e.green=5]="green",e[e.darkGreen=6]="darkGreen",e[e.lightPink=7]="lightPink",e[e.pink=8]="pink",e[e.magenta=9]="magenta",e[e.purple=10]="purple",e[e.black=11]="black",e[e.orange=12]="orange",e[e.red=13]="red",e[e.darkRed=14]="darkRed",e[e.transparent=15]="transparent",e[e.violet=16]="violet",e[e.lightRed=17]="lightRed",e[e.gold=18]="gold",e[e.burgundy=19]="burgundy",e[e.warmGray=20]="warmGray",e[e.coolGray=21]="coolGray",e[e.gray=22]="gray",e[e.cyan=23]="cyan",e[e.rust=24]="rust"}(Xr||(Xr={})),function(e){e.size8="20px",e.size10="20px",e.size16="16px",e.size24="24px",e.size28="28px",e.size32="32px",e.size40="40px",e.size48="48px",e.size56="56px",e.size72="72px",e.size100="100px",e.size120="120px"}(Jr||(Jr={})),function(e){e.size6="6px",e.size8="8px",e.size12="12px",e.size16="16px",e.size20="20px",e.size28="28px",e.size32="32px",e.border="2px"}($r||($r={}));var ai=function(e){return{isSize8:e===Yr.size8,isSize10:e===Yr.size10||e===Yr.tiny,isSize16:e===Yr.size16,isSize24:e===Yr.size24||e===Yr.extraExtraSmall,isSize28:e===Yr.size28||e===Yr.extraSmall,isSize32:e===Yr.size32,isSize40:e===Yr.size40||e===Yr.small,isSize48:e===Yr.size48||e===Yr.regular,isSize56:e===Yr.size56,isSize72:e===Yr.size72||e===Yr.large,isSize100:e===Yr.size100||e===Yr.extraLarge,isSize120:e===Yr.size120}},si=((Qr={})[Yr.tiny]=10,Qr[Yr.extraExtraSmall]=24,Qr[Yr.extraSmall]=28,Qr[Yr.small]=40,Qr[Yr.regular]=48,Qr[Yr.large]=72,Qr[Yr.extraLarge]=100,Qr[Yr.size8]=8,Qr[Yr.size10]=10,Qr[Yr.size16]=16,Qr[Yr.size24]=24,Qr[Yr.size28]=28,Qr[Yr.size32]=32,Qr[Yr.size40]=40,Qr[Yr.size48]=48,Qr[Yr.size56]=56,Qr[Yr.size72]=72,Qr[Yr.size100]=100,Qr[Yr.size120]=120,Qr),li=function(e){return{isAvailable:e===Zr.online,isAway:e===Zr.away,isBlocked:e===Zr.blocked,isBusy:e===Zr.busy,isDoNotDisturb:e===Zr.dnd,isOffline:e===Zr.offline}},ci=Jn({cacheSize:100}),ui=f.forwardRef((function(e,t){var o=e.coinSize,n=e.isOutOfOffice,r=e.styles,i=e.presence,a=e.theme,s=e.presenceTitle,l=e.presenceColors,c=Or(t,f.useRef(null)),u=ai(e.size),d=!(u.isSize8||u.isSize10||u.isSize16||u.isSize24||u.isSize28||u.isSize32)&&(!o||o>32),p=o?o/3<40?o/3+"px":"40px":"",h=o?{fontSize:o?o/6<20?o/6+"px":"20px":"",lineHeight:p}:void 0,m=o?{width:p,height:p}:void 0,g=ci(r,{theme:a,presence:i,size:e.size,isOutOfOffice:n,presenceColors:l});return i===Zr.none?null:f.createElement("div",{role:"presentation",className:g.presence,style:m,title:s,ref:c},d&&f.createElement(ii,{className:g.presenceIcon,iconName:di(e.presence,e.isOutOfOffice),style:h}))}));function di(e,t){if(e){var o="SkypeArrow";switch(Zr[e]){case"online":return"SkypeCheck";case"away":return t?o:"SkypeClock";case"dnd":return"SkypeMinus";case"offline":return t?o:""}return""}}ui.displayName="PersonaPresenceBase";var pi={presence:"ms-Persona-presence",presenceIcon:"ms-Persona-presenceIcon"};function hi(e){return{color:e,borderColor:e}}function mi(e,t){return{selectors:{":before":{border:e+" solid "+t}}}}function gi(e){return{height:e,width:e}}function fi(e){return{backgroundColor:e}}var vi,bi=Vn(ui,(function(e){var t,o,n,r,i,a,s=e.theme,l=e.presenceColors,c=s.semanticColors,u=s.fonts,p=Qo(pi,s),h=ai(e.size),m=li(e.presence),g=l&&l.available||"#6BB700",f=l&&l.away||"#FFAA44",v=l&&l.busy||"#C43148",b=l&&l.dnd||"#C50F1F",y=l&&l.offline||"#8A8886",C=l&&l.oof||"#B4009E",_=l&&l.background||c.bodyBackground,S=m.isOffline||e.isOutOfOffice&&(m.isAvailable||m.isBusy||m.isAway||m.isDoNotDisturb),x=h.isSize72||h.isSize100?"2px":"1px";return{presence:[p.presence,d(d({position:"absolute",height:$r.size12,width:$r.size12,borderRadius:"50%",top:"auto",right:"-2px",bottom:"-2px",border:"2px solid "+_,textAlign:"center",boxSizing:"content-box",backgroundClip:"border-box"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),{selectors:(t={},t[ro]={borderColor:"Window",backgroundColor:"WindowText"},t)}),(h.isSize8||h.isSize10)&&{right:"auto",top:"7px",left:0,border:0,selectors:(o={},o[ro]={top:"9px",border:"1px solid WindowText"},o)},(h.isSize8||h.isSize10||h.isSize24||h.isSize28||h.isSize32)&&gi($r.size8),(h.isSize40||h.isSize48)&&gi($r.size12),h.isSize16&&{height:$r.size6,width:$r.size6,borderWidth:"1.5px"},h.isSize56&&gi($r.size16),h.isSize72&&gi($r.size20),h.isSize100&&gi($r.size28),h.isSize120&&gi($r.size32),m.isAvailable&&{backgroundColor:g,selectors:(n={},n[ro]=fi("Highlight"),n)},m.isAway&&fi(f),m.isBlocked&&[{selectors:(r={":after":h.isSize40||h.isSize48||h.isSize72||h.isSize100?{content:'""',width:"100%",height:x,backgroundColor:v,transform:"translateY(-50%) rotate(-45deg)",position:"absolute",top:"50%",left:0}:void 0},r[ro]={selectors:{":after":{width:"calc(100% - 4px)",left:"2px",backgroundColor:"Window"}}},r)}],m.isBusy&&fi(v),m.isDoNotDisturb&&fi(b),m.isOffline&&fi(y),(S||m.isBlocked)&&[{backgroundColor:_,selectors:(i={":before":{content:'""',width:"100%",height:"100%",position:"absolute",top:0,left:0,border:x+" solid "+v,borderRadius:"50%",boxSizing:"border-box"}},i[ro]={backgroundColor:"WindowText",selectors:{":before":{width:"calc(100% - 2px)",height:"calc(100% - 2px)",top:"1px",left:"1px",borderColor:"Window"}}},i)}],S&&m.isAvailable&&mi(x,g),S&&m.isBusy&&mi(x,v),S&&m.isAway&&mi(x,C),S&&m.isDoNotDisturb&&mi(x,b),S&&m.isOffline&&mi(x,y),S&&m.isOffline&&e.isOutOfOffice&&mi(x,C)],presenceIcon:[p.presenceIcon,{color:_,fontSize:"6px",lineHeight:$r.size12,verticalAlign:"top",selectors:(a={},a[ro]={color:"Window"},a)},h.isSize56&&{fontSize:"8px",lineHeight:$r.size16},h.isSize72&&{fontSize:u.small.fontSize,lineHeight:$r.size20},h.isSize100&&{fontSize:u.medium.fontSize,lineHeight:$r.size28},h.isSize120&&{fontSize:u.medium.fontSize,lineHeight:$r.size32},m.isAway&&{position:"relative",left:S?void 0:"1px"},S&&m.isAvailable&&hi(g),S&&m.isBusy&&hi(v),S&&m.isAway&&hi(C),S&&m.isDoNotDisturb&&hi(b),S&&m.isOffline&&hi(y),S&&m.isOffline&&e.isOutOfOffice&&hi(C)]}}),void 0,{scope:"PersonaPresence"}),yi=[Xr.lightBlue,Xr.blue,Xr.darkBlue,Xr.teal,Xr.green,Xr.darkGreen,Xr.lightPink,Xr.pink,Xr.magenta,Xr.purple,Xr.orange,Xr.lightRed,Xr.darkRed,Xr.violet,Xr.gold,Xr.burgundy,Xr.warmGray,Xr.cyan,Xr.rust,Xr.coolGray],Ci=yi.length;function _i(e){var t=e.primaryText,o=e.text,n=e.initialsColor;return"string"==typeof n?n:function(e){switch(e){case Xr.lightBlue:return"#4F6BED";case Xr.blue:return"#0078D4";case Xr.darkBlue:return"#004E8C";case Xr.teal:return"#038387";case Xr.lightGreen:case Xr.green:return"#498205";case Xr.darkGreen:return"#0B6A0B";case Xr.lightPink:return"#C239B3";case Xr.pink:return"#E3008C";case Xr.magenta:return"#881798";case Xr.purple:return"#5C2E91";case Xr.orange:return"#CA5010";case Xr.red:return"#EE1111";case Xr.lightRed:return"#D13438";case Xr.darkRed:return"#A4262C";case Xr.transparent:return"transparent";case Xr.violet:return"#8764B8";case Xr.gold:return"#986F0B";case Xr.burgundy:return"#750B1C";case Xr.warmGray:return"#7A7574";case Xr.cyan:return"#005B70";case Xr.rust:return"#8E562E";case Xr.coolGray:return"#69797E";case Xr.black:return"#1D1D1D";case Xr.gray:return"#393939"}}(n=void 0!==n?n:function(e){var t=Xr.blue;if(!e)return t;for(var o=0,n=e.length-1;n>=0;n--){var r=e.charCodeAt(n),i=n%8;o^=(r<<i)+(r>>8-i)}return yi[o%Ci]}(o||t))}function Si(e,t,o,n,r){if(!0===r)for(var i=0,a=o;i<a.length;i++){var s=a[i];s in t||cn(e+" property '"+s+"' is required when '"+n+"' is used.'")}}function xi(e,t,o){for(var n in o)if(t&&n in t){var r=e+" property '"+n+"' was used but has been deprecated.",i=o[n];i&&(r+=" Use '"+i+"' instead."),cn(r)}}function ki(e,t,o){for(var n in o)if(t&&void 0!==t[n]){var r=o[n];r&&void 0!==t[r]&&cn(e+" property '"+n+"' is mutually exclusive with '"+o[n]+"'. Use one or the other.")}}function wi(e,t){return void 0!==e[t]&&null!==e[t]}function Ii(){vi.valueOnChange={},vi.valueDefaultValue={},vi.controlledToUncontrolled={},vi.uncontrolledToControlled={}}function Di(e){var t=e.componentId,o=e.componentName,n=e.defaultValueProp,r=e.props,i=e.oldProps,a=e.onChangeProp,s=e.readOnlyProp,l=e.valueProp,c=i?wi(i,l):void 0,u=wi(r,l);if(u){var d=!!r[a],p=!(!s||!r[s]);d||p||vi.valueOnChange[t]||(vi.valueOnChange[t]=!0,cn("Warning: You provided a '"+l+"' prop to a "+o+" without an '"+a+"' handler. This will render a read-only field. If the field should be mutable use '"+n+"'. Otherwise, set '"+a+"'"+(s?" or '"+s+"'":"")+".")),null==r[n]||vi.valueDefaultValue[t]||(vi.valueDefaultValue[t]=!0,cn("Warning: You provided both '"+l+"' and '"+n+"' to a "+o+". Form fields must be either controlled or uncontrolled (specify either the '"+l+"' prop, or the '"+n+"' prop, but not both). Decide between using a controlled or uncontrolled "+o+" and remove one of these props. More info: https://fb.me/react-controlled-components"))}if(i&&u!==c){var h=c?"a controlled":"an uncontrolled",m=c?"uncontrolled":"controlled",g=c?vi.controlledToUncontrolled:vi.uncontrolledToControlled;g[t]||(g[t]=!0,cn("Warning: A component is changing "+h+" "+o+" to be "+m+". "+o+"s should not switch from controlled to uncontrolled (or vice versa). Decide between using controlled or uncontrolled for the lifetime of the component. More info: https://fb.me/react-controlled-components"))}}function Ti(e){var t=(0,f.useRef)();return(0,f.useEffect)((function(){t.current=e})),t.current}function Ei(e){var t=f.useRef();return void 0===t.current&&(t.current={value:"function"==typeof e?e():e}),t.current.value}vi={valueOnChange:{},valueDefaultValue:{},controlledToUncontrolled:{},uncontrolledToControlled:{}};var Pi=0;function Ri(e){var t=e.name,o=e.props,n=e.other,r=void 0===n?[]:n,i=e.conditionallyRequired,a=e.deprecations,s=e.mutuallyExclusive,l=e.controlledUsage,c=f.useRef(!1),u=Ei((function(){return"useWarnings_"+Pi++})),p=Ti(o);if(!c.current){c.current=!0;for(var h=0,m=r;h<m.length;h++)cn(m[h]);if(i)for(var g=0,v=i;g<v.length;g++){var b=v[g];Si(t,o,b.requiredProps,b.conditionalPropName,b.condition)}a&&xi(t,o,a),s&&ki(t,o,s)}l&&Di(d(d({},l),{componentId:u,props:o,componentName:t,oldProps:p}))}var Mi=Jn({cacheSize:100}),Ni=jo((function(e,t,o,n,r,i){return Z(e,!i&&{backgroundColor:_i({text:n,initialsColor:t,primaryText:r}),color:o})})),Bi={size:Yr.size48,presence:Zr.none,imageAlt:""},Fi=f.forwardRef((function(e,t){var o=tr(Bi,e);!function(e){Ri({name:"PersonaCoin",props:e,deprecations:{primaryText:"text"}})}(o);var n=function(e){var t=e.onPhotoLoadingStateChange,o=e.imageUrl,n=f.useState(Mr.notLoaded),r=n[0],i=n[1];return f.useEffect((function(){i(Mr.notLoaded)}),[o]),[r,function(e){i(e),null==t||t(e)}]}(o),r=n[0],i=n[1],a=Ai(i),s=o.className,l=o.coinProps,c=o.showUnknownPersonaCoin,u=o.coinSize,p=o.styles,h=o.imageUrl,m=o.initialsColor,g=o.initialsTextColor,v=o.isOutOfOffice,b=o.onRenderCoin,y=void 0===b?a:b,C=o.onRenderPersonaCoin,_=void 0===C?y:C,S=o.onRenderInitials,x=void 0===S?Li:S,k=o.presence,w=o.presenceTitle,I=o.presenceColors,D=o.primaryText,T=o.showInitialsUntilImageLoads,E=o.text,P=o.theme,R=o.size,M=Tr(o,Dr),N=Tr(l||{},Dr),B=u?{width:u,height:u}:void 0,F=c,A={coinSize:u,isOutOfOffice:v,presence:k,presenceTitle:w,presenceColors:I,size:R,theme:P},L=Mi(p,{theme:P,className:l&&l.className?l.className:s,size:R,coinSize:u,showUnknownPersonaCoin:c}),H=Boolean(r!==Mr.loaded&&(T&&h||!h||r===Mr.error||F));return f.createElement("div",d({role:"presentation"},M,{className:L.coin,ref:t}),R!==Yr.size8&&R!==Yr.size10&&R!==Yr.tiny?f.createElement("div",d({role:"presentation"},N,{className:L.imageArea,style:B}),H&&f.createElement("div",{className:Ni(L.initials,m,g,E,D,c),style:B,"aria-hidden":"true"},x(o,Li)),!F&&_(o,a),f.createElement(bi,d({},A))):o.presence?f.createElement(bi,d({},A)):f.createElement(ii,{iconName:"Contact",className:L.size10WithoutPresenceIcon}),o.children)}));Fi.displayName="PersonaCoinBase";var Ai=function(e){return function(t){var o=t.coinSize,n=t.styles,r=t.imageUrl,i=t.imageAlt,a=t.imageShouldFadeIn,s=t.imageShouldStartVisible,l=t.theme,c=t.showUnknownPersonaCoin,u=t.size,d=void 0===u?Bi.size:u;if(!r)return null;var p=Mi(n,{theme:l,size:d,showUnknownPersonaCoin:c}),h=o||si[d];return f.createElement(Gr,{className:p.image,imageFit:Pr.cover,src:r,width:h,height:h,alt:i,shouldFadeIn:a,shouldStartVisible:s,onLoadingStateChange:e})}},Li=function(e){var t=e.imageInitials,o=e.allowPhoneInitials,n=e.showUnknownPersonaCoin,r=e.text,i=e.primaryText,a=e.theme;if(n)return f.createElement(ii,{iconName:"Help"});var s=jn(a);return""!==(t=t||Hr(r||i||"",s,o))?f.createElement("span",null,t):f.createElement(ii,{iconName:"Contact"})},Hi={coin:"ms-Persona-coin",imageArea:"ms-Persona-imageArea",image:"ms-Persona-image",initials:"ms-Persona-initials",size8:"ms-Persona--size8",size10:"ms-Persona--size10",size16:"ms-Persona--size16",size24:"ms-Persona--size24",size28:"ms-Persona--size28",size32:"ms-Persona--size32",size40:"ms-Persona--size40",size48:"ms-Persona--size48",size56:"ms-Persona--size56",size72:"ms-Persona--size72",size100:"ms-Persona--size100",size120:"ms-Persona--size120"},Oi=Vn(Fi,(function(e){var t,o=e.className,n=e.theme,r=e.coinSize,i=n.palette,a=n.fonts,s=ai(e.size),l=Qo(Hi,n),c=r||e.size&&si[e.size]||48;return{coin:[l.coin,a.medium,s.isSize8&&l.size8,s.isSize10&&l.size10,s.isSize16&&l.size16,s.isSize24&&l.size24,s.isSize28&&l.size28,s.isSize32&&l.size32,s.isSize40&&l.size40,s.isSize48&&l.size48,s.isSize56&&l.size56,s.isSize72&&l.size72,s.isSize100&&l.size100,s.isSize120&&l.size120,o],size10WithoutPresenceIcon:{fontSize:a.xSmall.fontSize,position:"absolute",top:"5px",right:"auto",left:0},imageArea:[l.imageArea,{position:"relative",textAlign:"center",flex:"0 0 auto",height:c,width:c},c<=10&&{overflow:"visible",background:"transparent",height:0,width:0}],image:[l.image,{marginRight:"10px",position:"absolute",top:0,left:0,width:"100%",height:"100%",border:0,borderRadius:"50%",perspective:"1px"},c<=10&&{overflow:"visible",background:"transparent",height:0,width:0},c>10&&{height:c,width:c}],initials:[l.initials,{borderRadius:"50%",color:e.showUnknownPersonaCoin?"rgb(168, 0, 0)":i.white,fontSize:a.large.fontSize,fontWeight:qe.semibold,lineHeight:48===c?46:c,height:c,selectors:(t={},t[ro]=d(d({border:"1px solid WindowText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),{color:"WindowText",boxSizing:"border-box",backgroundColor:"Window !important"}),t.i={fontWeight:qe.semibold},t)},e.showUnknownPersonaCoin&&{backgroundColor:"rgb(234, 234, 234)"},c<32&&{fontSize:a.xSmall.fontSize},c>=32&&c<40&&{fontSize:a.medium.fontSize},c>=40&&c<56&&{fontSize:a.mediumPlus.fontSize},c>=56&&c<72&&{fontSize:a.xLarge.fontSize},c>=72&&c<100&&{fontSize:a.xxLarge.fontSize},c>=100&&{fontSize:a.superLarge.fontSize}]}}),void 0,{scope:"PersonaCoin"}),zi=function(e){function t(t){var o=e.call(this,t)||this;return o._onRenderIcon=function(e){return e.activityPersonas?o._onRenderPersonaArray(e):o.props.activityIcon},o._onRenderActivityDescription=function(e){var t=o._getClassNames(e),n=e.activityDescription||e.activityDescriptionText;return n?f.createElement("span",{className:t.activityText},n):null},o._onRenderComments=function(e){var t=o._getClassNames(e),n=e.comments||e.commentText;return!e.isCompact&&n?f.createElement("div",{className:t.commentText},n):null},o._onRenderTimeStamp=function(e){var t=o._getClassNames(e);return!e.isCompact&&e.timeStamp?f.createElement("div",{className:t.timeStamp},e.timeStamp):null},o._onRenderPersonaArray=function(e){var t=o._getClassNames(e),n=null,r=e.activityPersonas;if(r[0].imageUrl||r[0].imageInitials){var i=[],a=r.length>1||e.isCompact,s=e.isCompact?3:4,l=void 0;e.isCompact&&(l={display:"inline-block",width:"10px",minWidth:"10px",overflow:"visible"}),r.filter((function(e,t){return t<s})).forEach((function(e,o){i.push(f.createElement(Oi,d({},e,{key:e.key||o,className:t.activityPersona,size:a?Yr.size16:Yr.size32,style:l})))})),n=f.createElement("div",{className:t.personaContainer},i)}return n},o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.onRenderIcon,o=void 0===t?this._onRenderIcon:t,n=e.onRenderActivityDescription,r=void 0===n?this._onRenderActivityDescription:n,i=e.onRenderComments,a=void 0===i?this._onRenderComments:i,s=e.onRenderTimeStamp,l=void 0===s?this._onRenderTimeStamp:s,c=e.animateBeaconSignal,u=e.isCompact,d=this._getClassNames(this.props);return f.createElement("div",{className:d.root,style:this.props.style},(this.props.activityPersonas||this.props.activityIcon||this.props.onRenderIcon)&&f.createElement("div",{className:d.activityTypeIcon},c&&u&&f.createElement("div",{className:d.pulsingBeacon}),o(this.props)),f.createElement("div",{className:d.activityContent},r(this.props,this._onRenderActivityDescription),a(this.props,this._onRenderComments),l(this.props,this._onRenderTimeStamp)))},t.prototype._getClassNames=function(e){return Rn(Hn(void 0,e.styles,e.animateBeaconSignal,e.beaconColorOne,e.beaconColorTwo,e.isCompact),e.className,e.activityPersonas,e.isCompact)},t}(f.Component),Wi=function(){var e,t=at();return!!(null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.userAgent)&&t.navigator.userAgent.indexOf("rv:11.0")>-1};function Vi(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];return t.length<2?t[0]:function(){for(var o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];t.forEach((function(t){return t&&t.apply(e,o)}))}}function Ki(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=Vi(e,e[o],t[o]))}function Gi(e){Ki(e,{componentDidMount:Ui,componentDidUpdate:ji,componentWillUnmount:qi})}function Ui(){Yi(this.props.componentRef,this)}function ji(e){e.componentRef!==this.props.componentRef&&(Yi(e.componentRef,null),Yi(this.props.componentRef,this))}function qi(){Yi(this.props.componentRef,null)}function Yi(e,t){e&&("object"==typeof e?e.current=t:"function"==typeof e&&e(t))}var Zi=function(){function e(e,t){this._timeoutIds=null,this._immediateIds=null,this._intervalIds=null,this._animationFrameIds=null,this._isDisposed=!1,this._parent=e||null,this._onErrorHandler=t,this._noop=function(){}}return e.prototype.dispose=function(){var e;if(this._isDisposed=!0,this._parent=null,this._timeoutIds){for(e in this._timeoutIds)this._timeoutIds.hasOwnProperty(e)&&this.clearTimeout(parseInt(e,10));this._timeoutIds=null}if(this._immediateIds){for(e in this._immediateIds)this._immediateIds.hasOwnProperty(e)&&this.clearImmediate(parseInt(e,10));this._immediateIds=null}if(this._intervalIds){for(e in this._intervalIds)this._intervalIds.hasOwnProperty(e)&&this.clearInterval(parseInt(e,10));this._intervalIds=null}if(this._animationFrameIds){for(e in this._animationFrameIds)this._animationFrameIds.hasOwnProperty(e)&&this.cancelAnimationFrame(parseInt(e,10));this._animationFrameIds=null}},e.prototype.setTimeout=function(e,t){var o=this,n=0;return this._isDisposed||(this._timeoutIds||(this._timeoutIds={}),n=setTimeout((function(){try{o._timeoutIds&&delete o._timeoutIds[n],e.apply(o._parent)}catch(e){o._logError(e)}}),t),this._timeoutIds[n]=!0),n},e.prototype.clearTimeout=function(e){this._timeoutIds&&this._timeoutIds[e]&&(clearTimeout(e),delete this._timeoutIds[e])},e.prototype.setImmediate=function(e,t){var o=this,n=0,r=at(t);return this._isDisposed||(this._immediateIds||(this._immediateIds={}),n=r.setTimeout((function(){try{o._immediateIds&&delete o._immediateIds[n],e.apply(o._parent)}catch(e){o._logError(e)}}),0),this._immediateIds[n]=!0),n},e.prototype.clearImmediate=function(e,t){var o=at(t);this._immediateIds&&this._immediateIds[e]&&(o.clearTimeout(e),delete this._immediateIds[e])},e.prototype.setInterval=function(e,t){var o=this,n=0;return this._isDisposed||(this._intervalIds||(this._intervalIds={}),n=setInterval((function(){try{e.apply(o._parent)}catch(e){o._logError(e)}}),t),this._intervalIds[n]=!0),n},e.prototype.clearInterval=function(e){this._intervalIds&&this._intervalIds[e]&&(clearInterval(e),delete this._intervalIds[e])},e.prototype.throttle=function(e,t,o){var n=this;if(this._isDisposed)return this._noop;var r,i,a=t||0,s=!0,l=!0,c=0,u=null;o&&"boolean"==typeof o.leading&&(s=o.leading),o&&"boolean"==typeof o.trailing&&(l=o.trailing);var d=function(t){var o=Date.now(),p=o-c,h=s?a-p:a;return p>=a&&(!t||s)?(c=o,u&&(n.clearTimeout(u),u=null),r=e.apply(n._parent,i)):null===u&&l&&(u=n.setTimeout(d,h)),r};return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i=e,d(!0)}},e.prototype.debounce=function(e,t,o){var n=this;if(this._isDisposed){var r=function(){};return r.cancel=function(){},r.flush=function(){return null},r.pending=function(){return!1},r}var i,a,s=t||0,l=!1,c=!0,u=null,d=0,p=Date.now(),h=null;o&&"boolean"==typeof o.leading&&(l=o.leading),o&&"boolean"==typeof o.trailing&&(c=o.trailing),o&&"number"==typeof o.maxWait&&!isNaN(o.maxWait)&&(u=o.maxWait);var m=function(e){h&&(n.clearTimeout(h),h=null),p=e},g=function(t){m(t),i=e.apply(n._parent,a)},f=function(e){var t=Date.now(),o=!1;e&&(l&&t-d>=s&&(o=!0),d=t);var r=t-d,a=s-r,m=t-p,v=!1;return null!==u&&(m>=u&&h?v=!0:a=Math.min(a,u-m)),r>=s||v||o?g(t):null!==h&&e||!c||(h=n.setTimeout(f,a)),i},v=function(){return!!h},b=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return a=e,f(!0)};return b.cancel=function(){v()&&m(Date.now())},b.flush=function(){return v()&&g(Date.now()),i},b.pending=v,b},e.prototype.requestAnimationFrame=function(e,t){var o=this,n=0,r=at(t);if(!this._isDisposed){this._animationFrameIds||(this._animationFrameIds={});var i=function(){try{o._animationFrameIds&&delete o._animationFrameIds[n],e.apply(o._parent)}catch(e){o._logError(e)}};n=r.requestAnimationFrame?r.requestAnimationFrame(i):r.setTimeout(i,0),this._animationFrameIds[n]=!0}return n},e.prototype.cancelAnimationFrame=function(e,t){var o=at(t);this._animationFrameIds&&this._animationFrameIds[e]&&(o.cancelAnimationFrame?o.cancelAnimationFrame(e):o.clearTimeout(e),delete this._animationFrameIds[e])},e.prototype._logError=function(e){this._onErrorHandler&&this._onErrorHandler(e)},e}(),Xi="backward",Qi=function(e){function t(t){var o=e.call(this,t)||this;return o._inputElement=f.createRef(),o._autoFillEnabled=!0,o._onCompositionStart=function(e){o.setState({isComposing:!0}),o._autoFillEnabled=!1},o._onCompositionUpdate=function(){Wi()&&o._updateValue(o._getCurrentInputValue(),!0)},o._onCompositionEnd=function(e){var t=o._getCurrentInputValue();o._tryEnableAutofill(t,o.value,!1,!0),o.setState({isComposing:!1}),o._async.setTimeout((function(){o._updateValue(o._getCurrentInputValue(),!1)}),0)},o._onClick=function(){o.value&&""!==o.value&&o._autoFillEnabled&&(o._autoFillEnabled=!1)},o._onKeyDown=function(e){if(o.props.onKeyDown&&o.props.onKeyDown(e),!e.nativeEvent.isComposing)switch(e.which){case Gn.backspace:o._autoFillEnabled=!1;break;case Gn.left:case Gn.right:o._autoFillEnabled&&(o.setState({inputValue:o.props.suggestedDisplayValue||""}),o._autoFillEnabled=!1);break;default:o._autoFillEnabled||-1!==o.props.enableAutofillOnKeyPress.indexOf(e.which)&&(o._autoFillEnabled=!0)}},o._onInputChanged=function(e){var t=o._getCurrentInputValue(e);if(o.state.isComposing||o._tryEnableAutofill(t,o.value,e.nativeEvent.isComposing),!Wi()||!o.state.isComposing){var n=e.nativeEvent.isComposing,r=void 0===n?o.state.isComposing:n;o._updateValue(t,r)}},o._onChanged=function(){},o._updateValue=function(e,t){if(e||e!==o.value){var n=o.props,r=n.onInputChange,i=n.onInputValueChange;r&&(e=(null==r?void 0:r(e,t))||""),o.setState({inputValue:e},(function(){return null==i?void 0:i(e,t)}))}},Gi(o),o._async=new Zi(o),o.state={inputValue:t.defaultVisibleValue||"",isComposing:!1},o}return u(t,e),t.getDerivedStateFromProps=function(e,t){if(e.updateValueInWillReceiveProps){var o=e.updateValueInWillReceiveProps();if(null!==o&&o!==t.inputValue&&!t.isComposing)return d(d({},t),{inputValue:o})}return null},Object.defineProperty(t.prototype,"cursorLocation",{get:function(){if(this._inputElement.current){var e=this._inputElement.current;return"forward"!==e.selectionDirection?e.selectionEnd:e.selectionStart}return-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isValueSelected",{get:function(){return Boolean(this.inputElement&&this.inputElement.selectionStart!==this.inputElement.selectionEnd)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._getControlledValue()||this.state.inputValue||""},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionStart",{get:function(){return this._inputElement.current?this._inputElement.current.selectionStart:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionEnd",{get:function(){return this._inputElement.current?this._inputElement.current.selectionEnd:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"inputElement",{get:function(){return this._inputElement.current},enumerable:!1,configurable:!0}),t.prototype.componentDidUpdate=function(e,t,o){var n=this.props,r=n.suggestedDisplayValue,i=n.shouldSelectFullInputValueInComponentDidUpdate,a=0;if(!n.preventValueSelection)if(this._autoFillEnabled&&this.value&&r&&Ji(r,this.value)){var s=!1;if(i&&(s=i()),s&&this._inputElement.current)this._inputElement.current.setSelectionRange(0,r.length,Xi);else{for(;a<this.value.length&&this.value[a].toLocaleLowerCase()===r[a].toLocaleLowerCase();)a++;a>0&&this._inputElement.current&&this._inputElement.current.setSelectionRange(a,r.length,Xi)}}else this._inputElement.current&&(null===o||this._autoFillEnabled||this.state.isComposing||this._inputElement.current.setSelectionRange(o.start,o.end,o.dir))},t.prototype.componentWillUnmount=function(){this._async.dispose()},t.prototype.render=function(){var e=Tr(this.props,hr),t=d(d({},this.props.style),{fontFamily:"inherit"});return f.createElement("input",d({autoCapitalize:"off",autoComplete:"off","aria-autocomplete":"both"},e,{style:t,ref:this._inputElement,value:this._getDisplayValue(),onCompositionStart:this._onCompositionStart,onCompositionUpdate:this._onCompositionUpdate,onCompositionEnd:this._onCompositionEnd,onChange:this._onChanged,onInput:this._onInputChanged,onKeyDown:this._onKeyDown,onClick:this.props.onClick?this.props.onClick:this._onClick,"data-lpignore":!0}))},t.prototype.focus=function(){this._inputElement.current&&this._inputElement.current.focus()},t.prototype.clear=function(){this._autoFillEnabled=!0,this._updateValue("",!1),this._inputElement.current&&this._inputElement.current.setSelectionRange(0,0)},t.prototype.getSnapshotBeforeUpdate=function(){var e,t,o=this._inputElement.current;return o&&o.selectionStart!==this.value.length?{start:null!==(e=o.selectionStart)&&void 0!==e?e:o.value.length,end:null!==(t=o.selectionEnd)&&void 0!==t?t:o.value.length,dir:o.selectionDirection||"backward"}:null},t.prototype._getCurrentInputValue=function(e){return e&&e.target&&e.target.value?e.target.value:this.inputElement&&this.inputElement.value?this.inputElement.value:""},t.prototype._tryEnableAutofill=function(e,t,o,n){!o&&e&&this._inputElement.current&&this._inputElement.current.selectionStart===e.length&&!this._autoFillEnabled&&(e.length>t.length||n)&&(this._autoFillEnabled=!0)},t.prototype._getDisplayValue=function(){return this._autoFillEnabled?(e=this.value,t=this.props.suggestedDisplayValue,o=e,t&&e&&Ji(t,o)&&(o=t),o):this.value;var e,t,o},t.prototype._getControlledValue=function(){var e=this.props.value;return void 0===e||"string"==typeof e?e:(console.warn("props.value of Autofill should be a string, but it is "+e+" with type of "+typeof e),e.toString())},t.defaultProps={enableAutofillOnKeyPress:[Gn.down,Gn.up]},t}(f.Component);function Ji(e,t){if(!e||!t)return!1;for(var o=0,n=[e,t];o<n.length;o++){var r=n[o];if("string"!=typeof r)throw new Error(Qi.name+' received non-string value "'+r+'" of type '+typeof r+" from either input's value or suggestedDisplayValue")}return 0===e.toLocaleLowerCase().indexOf(t.toLocaleLowerCase())}var $i,ea=function(e){function t(t){var o=e.call(this,t)||this;return o.state={isRendered:!1},o}return u(t,e),t.prototype.componentDidMount=function(){var e=this,t=this.props.delay;this._timeoutId=window.setTimeout((function(){e.setState({isRendered:!0})}),t)},t.prototype.componentWillUnmount=function(){this._timeoutId&&clearTimeout(this._timeoutId)},t.prototype.render=function(){return this.state.isRendered?f.Children.only(this.props.children):null},t.defaultProps={delay:0},t}(f.Component),ta=Jn(),oa=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.message,o=e.styles,n=e.as,r=void 0===n?"div":n,i=e.className,a=ta(o,{className:i});return f.createElement(r,d({role:"status",className:a.root},Tr(this.props,Dr,["className"])),f.createElement(ea,null,f.createElement("div",{className:a.screenReaderText},t)))},t.defaultProps={"aria-live":"polite"},t}(f.Component),na=Vn(oa,(function(e){return{root:e.className,screenReaderText:Mo}})),ra={none:0,all:1,inputOnly:2};function ia(e,t,o){void 0===o&&(o=0);for(var n=-1,r=o;e&&r<e.length;r++)if(t(e[r],r)){n=r;break}return n}function aa(e,t){var o=ia(e,t);if(!(o<0))return e[o]}function sa(e,t){for(var o=[],n=0;n<e;n++)o.push(t(n));return o}function la(e,t){return e.reduce((function(e,o,n){return n%t==0?e.push([o]):e[e.length-1].push(o),e}),[])}function ca(e,t){return e.filter((function(e,o){return t!==o}))}function ua(e,t,o){var n=e.slice();return n[o]=t,n}function da(e,t,o){var n=e.slice();return n.splice(t,0,o),n}function pa(e){var t=[];return e.forEach((function(e){return t=t.concat(e)})),t}function ha(e,t){if(e.length!==t.length)return!1;for(var o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}!function(e){e[e.vertical=0]="vertical",e[e.horizontal=1]="horizontal",e[e.bidirectional=2]="bidirectional",e[e.domOrder=3]="domOrder"}($i||($i={}));var ma=function(e){return function(t){for(var o=0,n=e.refs;o<n.length;o++){var r=n[o];"function"==typeof r?r(t):r&&(r.current=t)}}},ga=function(e){var t={refs:[]};return function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];return t.resolver&&ha(t.refs,e)||(t.resolver=ma(t)),t.refs=e,t.resolver}};function fa(e){return e&&!!e._virtual}function va(e){var t;return e&&fa(e)&&(t=e._virtual.parent),t}function ba(e,t){return void 0===t&&(t=!0),e&&(t&&va(e)||e.parentNode&&e.parentNode)}function ya(e,t){return e&&e!==document.body?t(e)?e:ya(ba(e),t):null}function Ca(e,t){var o=ya(e,(function(e){return e.hasAttribute(t)}));return o&&o.getAttribute(t)}function _a(e,t,o){void 0===o&&(o=!0);var n=!1;if(e&&t)if(o)if(e===t)n=!0;else for(n=!1;t;){var r=ba(t);if(r===e){n=!0;break}t=r}else e.contains&&(n=e.contains(t));return n}function Sa(e,t,o){return Ta(e,t,!0,!1,!1,o)}function xa(e,t,o){return Da(e,t,!0,!1,!0,o)}function ka(e,t,o,n){return void 0===n&&(n=!0),Ta(e,t,n,!1,!1,o,!1,!0)}function wa(e,t,o,n){return void 0===n&&(n=!0),Da(e,t,n,!1,!0,o,!1,!0)}function Ia(e){var t=Ta(e,e,!0,!1,!1,!0);return!!t&&(La(t),!0)}function Da(e,t,o,n,r,i,a,s){if(!t||!a&&t===e)return null;var l=Ea(t);if(r&&l&&(i||!Ma(t)&&!Na(t))){var c=Da(e,t.lastElementChild,!0,!0,!0,i,a,s);if(c){if(s&&Ra(c,!0)||!s)return c;var u=Da(e,c.previousElementSibling,!0,!0,!0,i,a,s);if(u)return u;for(var d=c.parentElement;d&&d!==t;){var p=Da(e,d.previousElementSibling,!0,!0,!0,i,a,s);if(p)return p;d=d.parentElement}}}return o&&l&&Ra(t,s)?t:Da(e,t.previousElementSibling,!0,!0,!0,i,a,s)||(n?null:Da(e,t.parentElement,!0,!1,!1,i,a,s))}function Ta(e,t,o,n,r,i,a,s){if(!t||t===e&&r&&!a)return null;var l=Ea(t);if(o&&l&&Ra(t,s))return t;if(!r&&l&&(i||!Ma(t)&&!Na(t))){var c=Ta(e,t.firstElementChild,!0,!0,!1,i,a,s);if(c)return c}return t===e?null:Ta(e,t.nextElementSibling,!0,!0,!1,i,a,s)||(n?null:Ta(e,t.parentElement,!1,!1,!0,i,a,s))}function Ea(e){if(!e||!e.getAttribute)return!1;var t=e.getAttribute("data-is-visible");return null!=t?"true"===t:0!==e.offsetHeight||null!==e.offsetParent||!0===e.isVisible}function Pa(e){return!!e&&Ea(e)&&!e.hidden&&"hidden"!==window.getComputedStyle(e).visibility}function Ra(e,t){if(!e||e.disabled)return!1;var o=0,n=null;e&&e.getAttribute&&(n=e.getAttribute("tabIndex"))&&(o=parseInt(n,10));var r=e.getAttribute?e.getAttribute("data-is-focusable"):null,i=null!==n&&o>=0,a=!!e&&"false"!==r&&("A"===e.tagName||"BUTTON"===e.tagName||"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName||"true"===r||i);return t?-1!==o&&a:a}function Ma(e){return!!(e&&e.getAttribute&&e.getAttribute("data-focuszone-id"))}function Na(e){return!(!e||!e.getAttribute||"true"!==e.getAttribute("data-is-sub-focuszone"))}function Ba(e){var t=nt(e),o=t&&t.activeElement;return!(!o||!_a(e,o))}function Fa(e,t){return"true"!==Ca(e,t)}var Aa=void 0;function La(e){if(e){if(Aa)return void(Aa=e);Aa=e;var t=at(e);t&&t.requestAnimationFrame((function(){Aa&&Aa.focus(),Aa=void 0}))}}function Ha(e,t){for(var o=e,n=0,r=t;n<r.length;n++){var i=r[n],a=o.children[Math.min(i,o.children.length-1)];if(!a)break;o=a}return Ra(o)&&Ea(o)?o:Ta(e,o,!0)||Da(e,o)}function Oa(e,t){for(var o=[];t&&e&&t!==e;){var n=ba(t,!0);if(null===n)return[];o.unshift(Array.prototype.indexOf.call(n.children,t)),t=n}return o}var za=at()||{};void 0===za.__currentId__&&(za.__currentId__=0);var Wa,Va=!1;function Ka(e){if(!Va){var t=_.getInstance();t&&t.onReset&&t.onReset(Ga),Va=!0}return(void 0===e?"id__":e)+za.__currentId__++}function Ga(e){void 0===e&&(e=0),za.__currentId__=e}function Ua(e){var t=function(e){var t;return"function"==typeof Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t}("MouseEvents");t.initEvent("click",!0,!0),e.dispatchEvent(t)}var ja=0,qa=Z({overflow:"hidden !important"}),Ya="data-is-scrollable",Za=function(e,t){if(e){var o=0,n=null;t.on(e,"touchstart",(function(e){1===e.targetTouches.length&&(o=e.targetTouches[0].clientY)}),{passive:!1}),t.on(e,"touchmove",(function(e){if(1===e.targetTouches.length&&(e.stopPropagation(),n)){var t=e.targetTouches[0].clientY-o,r=ts(e.target);r&&(n=r),0===n.scrollTop&&t>0&&e.preventDefault(),n.scrollHeight-Math.ceil(n.scrollTop)<=n.clientHeight&&t<0&&e.preventDefault()}}),{passive:!1}),n=e}},Xa=function(e,t){e&&t.on(e,"touchmove",(function(e){e.stopPropagation()}),{passive:!1})},Qa=function(e){e.preventDefault()};function Ja(){var e=nt();e&&e.body&&!ja&&(e.body.classList.add(qa),e.body.addEventListener("touchmove",Qa,{passive:!1,capture:!1})),ja++}function $a(){if(ja>0){var e=nt();e&&e.body&&1===ja&&(e.body.classList.remove(qa),e.body.removeEventListener("touchmove",Qa)),ja--}}function es(){if(void 0===Wa){var e=document.createElement("div");e.style.setProperty("width","100px"),e.style.setProperty("height","100px"),e.style.setProperty("overflow","scroll"),e.style.setProperty("position","absolute"),e.style.setProperty("top","-9999px"),document.body.appendChild(e),Wa=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return Wa}function ts(e){for(var t=e,o=nt(e);t&&t!==o.body;){if("true"===t.getAttribute(Ya))return t;t=t.parentElement}for(t=e;t&&t!==o.body;){if("false"!==t.getAttribute(Ya)){var n=getComputedStyle(t),r=n?n.getPropertyValue("overflow-y"):"";if(r&&("scroll"===r||"auto"===r))return t}t=t.parentElement}return t&&t!==o.body||(t=at(e)),t}var os="data-portal-element";function ns(e){e.setAttribute(os,"true")}function rs(e,t){var o=ya(e,(function(e){return t===e||e.hasAttribute(os)}));return null!==o&&o.hasAttribute(os)}var is,as,ss="data-is-focusable",ls="data-focuszone-id",cs="tabindex",us="data-no-vertical-wrap",ds="data-no-horizontal-wrap",ps=999999999,hs=-999999999,ms={},gs=new Set,fs=["text","number","password","email","tel","url","search"],vs=!1,bs=function(e){function t(o){var n,r,i,a,s=e.call(this,o)||this;s._root=f.createRef(),s._mergedRef=ga(),s._onFocus=function(e){if(!s._portalContainsElement(e.target)){var t,o=s.props,n=o.onActiveElementChanged,r=o.doNotAllowFocusEventToPropagate,i=o.stopFocusPropagation,a=o.onFocusNotification,l=o.onFocus,c=o.shouldFocusInnerElementWhenReceivedFocus,u=o.defaultTabbableElement,d=s._isImmediateDescendantOfZone(e.target);if(d)t=e.target;else for(var p=e.target;p&&p!==s._root.current;){if(Ra(p)&&s._isImmediateDescendantOfZone(p)){t=p;break}p=ba(p,vs)}if(c&&e.target===s._root.current){var h=u&&"function"==typeof u&&u(s._root.current);h&&Ra(h)?(t=h,h.focus()):(s.focus(!0),s._activeElement&&(t=null))}var m=!s._activeElement;t&&t!==s._activeElement&&((d||m)&&s._setFocusAlignment(t,!0,!0),s._activeElement=t,m&&s._updateTabIndexes()),n&&n(s._activeElement,e),(i||r)&&e.stopPropagation(),l?l(e):a&&a()}},s._onBlur=function(){s._setParkedFocus(!1)},s._onMouseDown=function(e){if(!s._portalContainsElement(e.target)&&!s.props.disabled){for(var t=e.target,o=[];t&&t!==s._root.current;)o.push(t),t=ba(t,vs);for(;o.length&&((t=o.pop())&&Ra(t)&&s._setActiveElement(t,!0),!Ma(t)););}},s._onKeyDown=function(e,t){if(!s._portalContainsElement(e.target)){var o=s.props,n=o.direction,r=o.disabled,i=o.isInnerZoneKeystroke,a=o.pagingSupportDisabled,l=o.shouldEnterInnerZone;if(!(r||(s.props.onKeyDown&&s.props.onKeyDown(e),e.isDefaultPrevented()||s._getDocument().activeElement===s._root.current&&s._isInnerZone))){if((l&&l(e)||i&&i(e))&&s._isImmediateDescendantOfZone(e.target)){var c=s._getFirstInnerZone();if(c){if(!c.focus(!0))return}else{if(!Na(e.target))return;if(!s.focusElement(Ta(e.target,e.target.firstChild,!0)))return}}else{if(e.altKey)return;switch(e.which){case Gn.space:if(s._shouldRaiseClicksOnSpace&&s._tryInvokeClickForFocusable(e.target))break;return;case Gn.left:if(n!==$i.vertical&&(s._preventDefaultWhenHandled(e),s._moveFocusLeft(t)))break;return;case Gn.right:if(n!==$i.vertical&&(s._preventDefaultWhenHandled(e),s._moveFocusRight(t)))break;return;case Gn.up:if(n!==$i.horizontal&&(s._preventDefaultWhenHandled(e),s._moveFocusUp()))break;return;case Gn.down:if(n!==$i.horizontal&&(s._preventDefaultWhenHandled(e),s._moveFocusDown()))break;return;case Gn.pageDown:if(!a&&s._moveFocusPaging(!0))break;return;case Gn.pageUp:if(!a&&s._moveFocusPaging(!1))break;return;case Gn.tab:if(s.props.allowTabKey||s.props.handleTabKey===ra.all||s.props.handleTabKey===ra.inputOnly&&s._isElementInput(e.target)){var u=!1;if(s._processingTabKey=!0,u=n!==$i.vertical&&s._shouldWrapFocus(s._activeElement,ds)?(jn(t)?!e.shiftKey:e.shiftKey)?s._moveFocusLeft(t):s._moveFocusRight(t):e.shiftKey?s._moveFocusUp():s._moveFocusDown(),s._processingTabKey=!1,u)break;s.props.shouldResetActiveElementWhenTabFromZone&&(s._activeElement=null)}return;case Gn.home:if(s._isContentEditableElement(e.target)||s._isElementInput(e.target)&&!s._shouldInputLoseFocus(e.target,!1))return!1;var d=s._root.current&&s._root.current.firstChild;if(s._root.current&&d&&s.focusElement(Ta(s._root.current,d,!0)))break;return;case Gn.end:if(s._isContentEditableElement(e.target)||s._isElementInput(e.target)&&!s._shouldInputLoseFocus(e.target,!0))return!1;var p=s._root.current&&s._root.current.lastChild;if(s._root.current&&s.focusElement(Da(s._root.current,p,!0,!0,!0)))break;return;case Gn.enter:if(s._shouldRaiseClicksOnEnter&&s._tryInvokeClickForFocusable(e.target))break;return;default:return}}e.preventDefault(),e.stopPropagation()}}},s._getHorizontalDistanceFromCenter=function(e,t,o){var n=s._focusAlignment.left||s._focusAlignment.x||0,r=Math.floor(o.top),i=Math.floor(t.bottom),a=Math.floor(o.bottom),l=Math.floor(t.top);return e&&r>i||!e&&a<l?n>=o.left&&n<=o.left+o.width?0:Math.abs(o.left+o.width/2-n):s._shouldWrapFocus(s._activeElement,us)?ps:hs},Gi(s),xi("FocusZone",o,{rootProps:void 0,allowTabKey:"handleTabKey",elementType:"as",ariaDescribedBy:"aria-describedby",ariaLabelledBy:"aria-labelledby"}),s._id=Ka("FocusZone"),s._focusAlignment={left:0,top:0},s._processingTabKey=!1;var l=null===(r=null!==(n=o.shouldRaiseClicks)&&void 0!==n?n:t.defaultProps.shouldRaiseClicks)||void 0===r||r;return s._shouldRaiseClicksOnEnter=null!==(i=o.shouldRaiseClicksOnEnter)&&void 0!==i?i:l,s._shouldRaiseClicksOnSpace=null!==(a=o.shouldRaiseClicksOnSpace)&&void 0!==a?a:l,s}return u(t,e),t.getOuterZones=function(){return gs.size},t._onKeyDownCapture=function(e){e.which===Gn.tab&&gs.forEach((function(e){return e._updateTabIndexes()}))},t.prototype.componentDidMount=function(){var e=this._root.current;if(ms[this._id]=this,e){this._windowElement=at(e);for(var o=ba(e,vs);o&&o!==this._getDocument().body&&1===o.nodeType;){if(Ma(o)){this._isInnerZone=!0;break}o=ba(o,vs)}this._isInnerZone||(gs.add(this),this._windowElement&&1===gs.size&&this._windowElement.addEventListener("keydown",t._onKeyDownCapture,!0)),this._root.current&&this._root.current.addEventListener("blur",this._onBlur,!0),this._updateTabIndexes(),this.props.defaultTabbableElement&&"string"==typeof this.props.defaultTabbableElement?this._activeElement=this._getDocument().querySelector(this.props.defaultTabbableElement):this.props.defaultActiveElement&&(this._activeElement=this._getDocument().querySelector(this.props.defaultActiveElement)),this.props.shouldFocusOnMount&&this.focus()}},t.prototype.componentDidUpdate=function(){var e=this._root.current,t=this._getDocument();if(!this.props.preventFocusRestoration&&t&&this._lastIndexPath&&(t.activeElement===t.body||null===t.activeElement||t.activeElement===e)){var o=Ha(e,this._lastIndexPath);o?(this._setActiveElement(o,!0),o.focus(),this._setParkedFocus(!1)):this._setParkedFocus(!0)}},t.prototype.componentWillUnmount=function(){delete ms[this._id],this._isInnerZone||(gs.delete(this),this._windowElement&&0===gs.size&&this._windowElement.removeEventListener("keydown",t._onKeyDownCapture,!0)),this._root.current&&this._root.current.removeEventListener("blur",this._onBlur,!0),this._activeElement=null,this._defaultFocusElement=null},t.prototype.render=function(){var e=this,t=this.props,o=t.as,n=t.elementType,r=t.rootProps,i=t.ariaDescribedBy,a=t.ariaLabelledBy,s=t.className,l=Tr(this.props,ir),c=o||n||"div";this._evaluateFocusBeforeRender();var u=Qt();return f.createElement(c,d({"aria-labelledby":a,"aria-describedby":i},l,r,{className:qr((is||(is=Z({selectors:{":focus":{outline:"none"}}},"ms-FocusZone")),is),s),ref:this._mergedRef(this.props.elementRef,this._root),"data-focuszone-id":this._id,onKeyDown:function(t){return e._onKeyDown(t,u)},onFocus:this._onFocus,onMouseDownCapture:this._onMouseDown}),this.props.children)},t.prototype.focus=function(e){if(void 0===e&&(e=!1),this._root.current){if(!e&&"true"===this._root.current.getAttribute(ss)&&this._isInnerZone){var t=this._getOwnerZone(this._root.current);if(t!==this._root.current){var o=ms[t.getAttribute(ls)];return!!o&&o.focusElement(this._root.current)}return!1}if(!e&&this._activeElement&&_a(this._root.current,this._activeElement)&&Ra(this._activeElement))return this._activeElement.focus(),!0;var n=this._root.current.firstChild;return this.focusElement(Ta(this._root.current,n,!0))}return!1},t.prototype.focusLast=function(){if(this._root.current){var e=this._root.current&&this._root.current.lastChild;return this.focusElement(Da(this._root.current,e,!0,!0,!0))}return!1},t.prototype.focusElement=function(e,t){var o=this.props,n=o.onBeforeFocus,r=o.shouldReceiveFocus;return!(r&&!r(e)||n&&!n(e)||!e||(this._setActiveElement(e,t),this._activeElement&&this._activeElement.focus(),0))},t.prototype.setFocusAlignment=function(e){this._focusAlignment=e},t.prototype._evaluateFocusBeforeRender=function(){var e=this._root.current,t=this._getDocument();if(t){var o=t.activeElement;if(o!==e){var n=_a(e,o,!1);this._lastIndexPath=n?Oa(e,o):void 0}}},t.prototype._setParkedFocus=function(e){var t=this._root.current;t&&this._isParked!==e&&(this._isParked=e,e?(this.props.allowFocusRoot||(this._parkedTabIndex=t.getAttribute("tabindex"),t.setAttribute("tabindex","-1")),t.focus()):this.props.allowFocusRoot||(this._parkedTabIndex?(t.setAttribute("tabindex",this._parkedTabIndex),this._parkedTabIndex=void 0):t.removeAttribute("tabindex")))},t.prototype._setActiveElement=function(e,t){var o=this._activeElement;this._activeElement=e,o&&(Ma(o)&&this._updateTabIndexes(o),o.tabIndex=-1),this._activeElement&&(this._focusAlignment&&!t||this._setFocusAlignment(e,!0,!0),this._activeElement.tabIndex=0)},t.prototype._preventDefaultWhenHandled=function(e){this.props.preventDefaultWhenHandled&&e.preventDefault()},t.prototype._tryInvokeClickForFocusable=function(e){if(e===this._root.current)return!1;do{if("BUTTON"===e.tagName||"A"===e.tagName||"INPUT"===e.tagName||"TEXTAREA"===e.tagName)return!1;if(this._isImmediateDescendantOfZone(e)&&"true"===e.getAttribute(ss)&&"true"!==e.getAttribute("data-disable-click-on-enter"))return Ua(e),!0;e=ba(e,vs)}while(e!==this._root.current);return!1},t.prototype._getFirstInnerZone=function(e){if(!(e=e||this._activeElement||this._root.current))return null;if(Ma(e))return ms[e.getAttribute(ls)];for(var t=e.firstElementChild;t;){if(Ma(t))return ms[t.getAttribute(ls)];var o=this._getFirstInnerZone(t);if(o)return o;t=t.nextElementSibling}return null},t.prototype._moveFocus=function(e,t,o,n){void 0===n&&(n=!0);var r=this._activeElement,i=-1,a=void 0,s=!1,l=this.props.direction===$i.bidirectional;if(!r||!this._root.current)return!1;if(this._isElementInput(r)&&!this._shouldInputLoseFocus(r,e))return!1;var c=l?r.getBoundingClientRect():null;do{if(r=e?Ta(this._root.current,r):Da(this._root.current,r),!l){a=r;break}if(r){var u=t(c,r.getBoundingClientRect());if(-1===u&&-1===i){a=r;break}if(u>-1&&(-1===i||u<i)&&(i=u,a=r),i>=0&&u<0)break}}while(r);if(a&&a!==this._activeElement)s=!0,this.focusElement(a);else if(this.props.isCircularNavigation&&n)return e?this.focusElement(Ta(this._root.current,this._root.current.firstElementChild,!0)):this.focusElement(Da(this._root.current,this._root.current.lastElementChild,!0,!0,!0));return s},t.prototype._moveFocusDown=function(){var e=this,t=-1,o=this._focusAlignment.left||this._focusAlignment.x||0;return!!this._moveFocus(!0,(function(n,r){var i=-1,a=Math.floor(r.top),s=Math.floor(n.bottom);return a<s?e._shouldWrapFocus(e._activeElement,us)?ps:hs:((-1===t&&a>=s||a===t)&&(t=a,i=o>=r.left&&o<=r.left+r.width?0:Math.abs(r.left+r.width/2-o)),i)}))&&(this._setFocusAlignment(this._activeElement,!1,!0),!0)},t.prototype._moveFocusUp=function(){var e=this,t=-1,o=this._focusAlignment.left||this._focusAlignment.x||0;return!!this._moveFocus(!1,(function(n,r){var i=-1,a=Math.floor(r.bottom),s=Math.floor(r.top),l=Math.floor(n.top);return a>l?e._shouldWrapFocus(e._activeElement,us)?ps:hs:((-1===t&&a<=l||s===t)&&(t=s,i=o>=r.left&&o<=r.left+r.width?0:Math.abs(r.left+r.width/2-o)),i)}))&&(this._setFocusAlignment(this._activeElement,!1,!0),!0)},t.prototype._moveFocusLeft=function(e){var t=this,o=this._shouldWrapFocus(this._activeElement,ds);return!!this._moveFocus(jn(e),(function(n,r){var i=-1;return(jn(e)?parseFloat(r.top.toFixed(3))<parseFloat(n.bottom.toFixed(3)):parseFloat(r.bottom.toFixed(3))>parseFloat(n.top.toFixed(3)))&&r.right<=n.right&&t.props.direction!==$i.vertical?i=n.right-r.right:o||(i=hs),i}),void 0,o)&&(this._setFocusAlignment(this._activeElement,!0,!1),!0)},t.prototype._moveFocusRight=function(e){var t=this,o=this._shouldWrapFocus(this._activeElement,ds);return!!this._moveFocus(!jn(e),(function(n,r){var i=-1;return(jn(e)?parseFloat(r.bottom.toFixed(3))>parseFloat(n.top.toFixed(3)):parseFloat(r.top.toFixed(3))<parseFloat(n.bottom.toFixed(3)))&&r.left>=n.left&&t.props.direction!==$i.vertical?i=r.left-n.left:o||(i=hs),i}),void 0,o)&&(this._setFocusAlignment(this._activeElement,!0,!1),!0)},t.prototype._moveFocusPaging=function(e,t){void 0===t&&(t=!0);var o=this._activeElement;if(!o||!this._root.current)return!1;if(this._isElementInput(o)&&!this._shouldInputLoseFocus(o,e))return!1;var n=ts(o);if(!n)return!1;var r=-1,i=void 0,a=-1,s=-1,l=n.clientHeight,c=o.getBoundingClientRect();do{if(o=e?Ta(this._root.current,o):Da(this._root.current,o)){var u=o.getBoundingClientRect(),d=Math.floor(u.top),p=Math.floor(c.bottom),h=Math.floor(u.bottom),m=Math.floor(c.top),g=this._getHorizontalDistanceFromCenter(e,c,u);if(e&&d>p+l||!e&&h<m-l)break;g>-1&&(e&&d>a?(a=d,r=g,i=o):!e&&h<s?(s=h,r=g,i=o):(-1===r||g<=r)&&(r=g,i=o))}}while(o);var f=!1;if(i&&i!==this._activeElement)f=!0,this.focusElement(i),this._setFocusAlignment(i,!1,!0);else if(this.props.isCircularNavigation&&t)return e?this.focusElement(Ta(this._root.current,this._root.current.firstElementChild,!0)):this.focusElement(Da(this._root.current,this._root.current.lastElementChild,!0,!0,!0));return f},t.prototype._setFocusAlignment=function(e,t,o){if(this.props.direction===$i.bidirectional&&(!this._focusAlignment||t||o)){var n=e.getBoundingClientRect(),r=n.left+n.width/2,i=n.top+n.height/2;this._focusAlignment||(this._focusAlignment={left:r,top:i}),t&&(this._focusAlignment.left=r),o&&(this._focusAlignment.top=i)}},t.prototype._isImmediateDescendantOfZone=function(e){return this._getOwnerZone(e)===this._root.current},t.prototype._getOwnerZone=function(e){for(var t=ba(e,vs);t&&t!==this._root.current&&t!==this._getDocument().body;){if(Ma(t))return t;t=ba(t,vs)}return t},t.prototype._updateTabIndexes=function(e){!this._activeElement&&this.props.defaultTabbableElement&&"function"==typeof this.props.defaultTabbableElement&&(this._activeElement=this.props.defaultTabbableElement(this._root.current)),!e&&this._root.current&&(this._defaultFocusElement=null,e=this._root.current,this._activeElement&&!_a(e,this._activeElement)&&(this._activeElement=null)),this._activeElement&&!Ra(this._activeElement)&&(this._activeElement=null);for(var t=e&&e.children,o=0;t&&o<t.length;o++){var n=t[o];Ma(n)?"true"===n.getAttribute(ss)&&(this._isInnerZone||(this._activeElement||this._defaultFocusElement)&&this._activeElement!==n?"-1"!==n.getAttribute(cs)&&n.setAttribute(cs,"-1"):(this._defaultFocusElement=n,"0"!==n.getAttribute(cs)&&n.setAttribute(cs,"0"))):(n.getAttribute&&"false"===n.getAttribute(ss)&&n.setAttribute(cs,"-1"),Ra(n)?this.props.disabled?n.setAttribute(cs,"-1"):this._isInnerZone||(this._activeElement||this._defaultFocusElement)&&this._activeElement!==n?"-1"!==n.getAttribute(cs)&&n.setAttribute(cs,"-1"):(this._defaultFocusElement=n,"0"!==n.getAttribute(cs)&&n.setAttribute(cs,"0")):"svg"===n.tagName&&"false"!==n.getAttribute("focusable")&&n.setAttribute("focusable","false")),this._updateTabIndexes(n)}},t.prototype._isContentEditableElement=function(e){return e&&"true"===e.getAttribute("contenteditable")},t.prototype._isElementInput=function(e){return!(!e||!e.tagName||"input"!==e.tagName.toLowerCase()&&"textarea"!==e.tagName.toLowerCase())},t.prototype._shouldInputLoseFocus=function(e,t){if(!this._processingTabKey&&e&&e.type&&fs.indexOf(e.type.toLowerCase())>-1){var o=e.selectionStart,n=o!==e.selectionEnd,r=e.value,i=e.readOnly;if(n||o>0&&!t&&!i||o!==r.length&&t&&!i||this.props.handleTabKey&&(!this.props.shouldInputLoseFocusOnArrowKey||!this.props.shouldInputLoseFocusOnArrowKey(e)))return!1}return!0},t.prototype._shouldWrapFocus=function(e,t){return!this.props.checkForNoWrap||Fa(e,t)},t.prototype._portalContainsElement=function(e){return e&&!!this._root.current&&rs(e,this._root.current)},t.prototype._getDocument=function(){return nt(this._root.current)},t.defaultProps={isCircularNavigation:!1,direction:$i.bidirectional,shouldRaiseClicks:!0},t}(f.Component),ys=((as={})[Gn.up]=1,as[Gn.down]=1,as[Gn.left]=1,as[Gn.right]=1,as[Gn.home]=1,as[Gn.end]=1,as[Gn.tab]=1,as[Gn.pageUp]=1,as[Gn.pageDown]=1,as);function Cs(e){return!!ys[e]}function _s(e){ys[e]=1}var Ss=new WeakMap;function xs(e,t){var o,n=Ss.get(e);return o=n?n+t:1,Ss.set(e,o),o}function ks(e){f.useEffect((function(){var t,o=at(null==e?void 0:e.current);if(o&&!0!==(null===(t=o.FabricConfig)||void 0===t?void 0:t.disableFocusRects)){var n=xs(o,1);return n<=1&&(o.addEventListener("mousedown",Is,!0),o.addEventListener("pointerdown",Ds,!0),o.addEventListener("keydown",Ts,!0)),function(){var e;o&&!0!==(null===(e=o.FabricConfig)||void 0===e?void 0:e.disableFocusRects)&&0===(n=xs(o,-1))&&(o.removeEventListener("mousedown",Is,!0),o.removeEventListener("pointerdown",Ds,!0),o.removeEventListener("keydown",Ts,!0))}}}),[e])}var ws=function(e){return ks(e.rootRef),null};function Is(e){Do(!1,e.target)}function Ds(e){"mouse"!==e.pointerType&&Do(!1,e.target)}function Ts(e){Cs(e.which)&&Do(!0,e.target)}var Es=Jn(),Ps=function(e,t){t.as;var o=t.disabled,n=t.target,r=t.href,i=(t.theme,t.getStyles,t.styles,t.componentRef,t.underline,p(t,["as","disabled","target","href","theme","getStyles","styles","componentRef","underline"]));return"string"==typeof e?"a"===e?d({target:n,href:o?void 0:r},i):"button"===e?d({type:"button",disabled:o},i):d(d({},i),{disabled:o}):d({target:n,href:r,disabled:o},i)},Rs=f.forwardRef((function(e,t){var o=function(e,t){var o=e.as,n=e.className,r=e.disabled,i=e.href,a=e.onClick,s=e.styles,l=e.theme,c=e.underline,u=f.useRef(null),p=Or(u,t);(function(e,t){f.useImperativeHandle(e.componentRef,(function(){return{focus:function(){t.current&&t.current.focus()}}}),[t])})(e,u),ks(u);var h=Es(s,{className:n,isButton:!i,isDisabled:r,isUnderlined:c,theme:l}),m=o||(i?"a":"button");return{state:{},slots:{root:m},slotProps:{root:d(d({},Ps(m,e)),{"aria-disabled":r,className:h.root,onClick:function(e){r?e.preventDefault():a&&a(e)},ref:p})}}}(e,t),n=o.slots,r=o.slotProps;return f.createElement(n.root,d({},r.root))}));Rs.displayName="LinkBase";var Ms={root:"ms-Link"},Ns=Vn(Rs,(function(e){var t,o,n,r,i,a,s=e.className,l=e.isButton,c=e.isDisabled,u=e.isUnderlined,d=e.theme,p=d.semanticColors,h=p.link,m=p.linkHovered,g=p.disabledText,f=p.focusBorder,v=Qo(Ms,d);return{root:[v.root,d.fonts.medium,{color:h,outline:"none",fontSize:"inherit",fontWeight:"inherit",textDecoration:u?"underline":"none",selectors:(t={".ms-Fabric--isFocusVisible &:focus":{boxShadow:"0 0 0 1px "+f+" inset",outline:"1px auto "+f,selectors:(o={},o[ro]={outline:"1px solid WindowText"},o)}},t[ro]={borderBottom:"none"},t)},l&&{background:"none",backgroundColor:"transparent",border:"none",cursor:"pointer",display:"inline",margin:0,overflow:"inherit",padding:0,textAlign:"left",textOverflow:"inherit",userSelect:"text",borderBottom:"1px solid transparent",selectors:(n={},n[ro]={color:"LinkText",forcedColorAdjust:"none"},n)},!l&&{selectors:(r={},r[ro]={MsHighContrastAdjust:"auto",forcedColorAdjust:"auto"},r)},c&&["is-disabled",{color:g,cursor:"default"},{selectors:{"&:link, &:visited":{pointerEvents:"none"}}}],!c&&{selectors:{"&:active, &:hover, &:active:hover":{color:m,textDecoration:"underline",selectors:(i={},i[ro]={color:"LinkText"},i)},"&:focus":{color:h,selectors:(a={},a[ro]={color:"LinkText"},a)}}},v.root,s]}}),void 0,{scope:"Link"});function Bs(e,t){for(var o in e)if(e.hasOwnProperty(o)&&(!t.hasOwnProperty(o)||t[o]!==e[o]))return!1;for(var o in t)if(t.hasOwnProperty(o)&&!e.hasOwnProperty(o))return!1;return!0}function Fs(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];return As.apply(this,[null,e].concat(t))}function As(e,t){for(var o=[],n=2;n<arguments.length;n++)o[n-2]=arguments[n];t=t||{};for(var r=0,i=o;r<i.length;r++){var a=i[r];if(a)for(var s in a)!a.hasOwnProperty(s)||e&&!e(s)||(t[s]=a[s])}return t}function Ls(e,t){return Object.keys(e).map((function(o){if(String(Number(o))!==o)return t(o,e[o])})).filter((function(e){return!!e}))}function Hs(e){return Object.keys(e).reduce((function(t,o){return t.push(e[o]),t}),[])}function Os(e,t){var o={};for(var n in e)-1===t.indexOf(n)&&e.hasOwnProperty(n)&&(o[n]=e[n]);return o}var zs=function(){function e(t){this._id=e._uniqueId++,this._parent=t,this._eventRecords=[]}return e.raise=function(t,o,n,r){var i;if(e._isElement(t)){if("undefined"!=typeof document&&document.createEvent){var a=document.createEvent("HTMLEvents");a.initEvent(o,r||!1,!0),Fs(a,n),i=t.dispatchEvent(a)}else if("undefined"!=typeof document&&document.createEventObject){var s=document.createEventObject(n);t.fireEvent("on"+o,s)}}else for(;t&&!1!==i;){var l=t.__events__,c=l?l[o]:null;if(c)for(var u in c)if(c.hasOwnProperty(u))for(var d=c[u],p=0;!1!==i&&p<d.length;p++){var h=d[p];h.objectCallback&&(i=h.objectCallback.call(h.parent,n))}t=r?t.parent:null}return i},e.isObserved=function(e,t){var o=e&&e.__events__;return!!o&&!!o[t]},e.isDeclared=function(e,t){var o=e&&e.__declaredEvents;return!!o&&!!o[t]},e.stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},e._isElement=function(e){return!!e&&(!!e.addEventListener||"undefined"!=typeof HTMLElement&&e instanceof HTMLElement)},e.prototype.dispose=function(){this._isDisposed||(this._isDisposed=!0,this.off(),this._parent=null)},e.prototype.onAll=function(e,t,o){for(var n in t)t.hasOwnProperty(n)&&this.on(e,n,t[n],o)},e.prototype.on=function(t,o,n,r){var i=this;if(o.indexOf(",")>-1)for(var a=o.split(/[ ,]+/),s=0;s<a.length;s++)this.on(t,a[s],n,r);else{var l=this._parent,c={target:t,eventName:o,parent:l,callback:n,options:r};if((a=t.__events__=t.__events__||{})[o]=a[o]||{count:0},a[o][this._id]=a[o][this._id]||[],a[o][this._id].push(c),a[o].count++,e._isElement(t)){var u=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i._isDisposed){var o;try{if(!1===(o=n.apply(l,e))&&e[0]){var r=e[0];r.preventDefault&&r.preventDefault(),r.stopPropagation&&r.stopPropagation(),r.cancelBubble=!0}}catch(r){}return o}};c.elementCallback=u,t.addEventListener?t.addEventListener(o,u,r):t.attachEvent&&t.attachEvent("on"+o,u)}else c.objectCallback=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i._isDisposed)return n.apply(l,e)};this._eventRecords.push(c)}},e.prototype.off=function(e,t,o,n){for(var r=0;r<this._eventRecords.length;r++){var i=this._eventRecords[r];if(!(e&&e!==i.target||t&&t!==i.eventName||o&&o!==i.callback||"boolean"==typeof n&&n!==i.options)){var a=i.target.__events__,s=a[i.eventName],l=s?s[this._id]:null;l&&(1!==l.length&&o?(s.count--,l.splice(l.indexOf(i),1)):(s.count-=l.length,delete a[i.eventName][this._id]),s.count||delete a[i.eventName]),i.elementCallback&&(i.target.removeEventListener?i.target.removeEventListener(i.eventName,i.elementCallback,i.options):i.target.detachEvent&&i.target.detachEvent("on"+i.eventName,i.elementCallback)),this._eventRecords.splice(r--,1)}}},e.prototype.raise=function(t,o,n){return e.raise(this._parent,t,o,n)},e.prototype.declare=function(e){var t=this._parent.__declaredEvents=this._parent.__declaredEvents||{};if("string"==typeof e)t[e]=!0;else for(var o=0;o<e.length;o++)t[e[o]]=!0},e._uniqueId=0,e}(),Ws=function(e){function t(o,n){var r=e.call(this,o,n)||this;return function(e,t,o){for(var n=0,r=o.length;n<r;n++)Vs(e,t,o[n])}(r,t.prototype,["componentDidMount","shouldComponentUpdate","getSnapshotBeforeUpdate","render","componentDidUpdate","componentWillUnmount"]),r}return u(t,e),t.prototype.componentDidUpdate=function(e,t){this._updateComponentRef(e,this.props)},t.prototype.componentDidMount=function(){this._setComponentRef(this.props.componentRef,this)},t.prototype.componentWillUnmount=function(){if(this._setComponentRef(this.props.componentRef,null),this.__disposables){for(var e=0,t=this._disposables.length;e<t;e++){var o=this.__disposables[e];o.dispose&&o.dispose()}this.__disposables=null}},Object.defineProperty(t.prototype,"className",{get:function(){if(!this.__className){var e=/function (.{1,})\(/.exec(this.constructor.toString());this.__className=e&&e.length>1?e[1]:""}return this.__className},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_disposables",{get:function(){return this.__disposables||(this.__disposables=[]),this.__disposables},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_async",{get:function(){return this.__async||(this.__async=new Zi(this),this._disposables.push(this.__async)),this.__async},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_events",{get:function(){return this.__events||(this.__events=new zs(this),this._disposables.push(this.__events)),this.__events},enumerable:!1,configurable:!0}),t.prototype._resolveRef=function(e){var t=this;return this.__resolves||(this.__resolves={}),this.__resolves[e]||(this.__resolves[e]=function(o){return t[e]=o}),this.__resolves[e]},t.prototype._updateComponentRef=function(e,t){void 0===t&&(t={}),e&&t&&e.componentRef!==t.componentRef&&(this._setComponentRef(e.componentRef,null),this._setComponentRef(t.componentRef,this))},t.prototype._warnDeprecations=function(e){xi(this.className,this.props,e)},t.prototype._warnMutuallyExclusive=function(e){ki(this.className,this.props,e)},t.prototype._warnConditionallyRequiredProps=function(e,t,o){Si(this.className,this.props,e,t,o)},t.prototype._setComponentRef=function(e,t){!this._skipComponentRefResolution&&e&&("function"==typeof e&&e(t),"object"==typeof e&&(e.current=t))},t}(f.Component);function Vs(e,t,o){var n=e[o],r=t[o];(n||r)&&(e[o]=function(){for(var e,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return r&&(e=r.apply(this,t)),n!==r&&(e=n.apply(this,t)),e})}function Ks(){return null}function Gs(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=e.filter((function(e){return e})).join(" ").trim();return""===o?void 0:o}var Us,js,qs=function(e){var t=e.className,o=e.imageProps,n=Tr(e,ir,["aria-label","aria-labelledby","title","aria-describedby"]),r=o.alt||e["aria-label"],i=r||e["aria-labelledby"]||e.title||o["aria-label"]||o["aria-labelledby"]||o.title,a={"aria-labelledby":e["aria-labelledby"],"aria-describedby":e["aria-describedby"],title:e.title},s=i?{}:{"aria-hidden":!0};return f.createElement("div",d({},s,n,{className:qr(jr,Ur.root,Ur.image,t)}),f.createElement(Gr,d({},a,o,{alt:i?r:""})))},Ys={topLeftEdge:0,topCenter:1,topRightEdge:2,topAutoEdge:3,bottomLeftEdge:4,bottomCenter:5,bottomRightEdge:6,bottomAutoEdge:7,leftTopEdge:8,leftCenter:9,leftBottomEdge:10,rightTopEdge:11,rightCenter:12,rightBottomEdge:13};function Zs(e){var t;if(void 0===js||e){var o=at(),n=null===(t=null==o?void 0:o.navigator)||void 0===t?void 0:t.userAgent;js=!!n&&-1!==n.indexOf("Macintosh")}return!!js}!function(e){e[e.Normal=0]="Normal",e[e.Divider=1]="Divider",e[e.Header=2]="Header",e[e.Section=3]="Section"}(Us||(Us={}));var Xs,Qs,Js=function(){return!!(window&&window.navigator&&window.navigator.userAgent)&&/iPad|iPhone|iPod/i.test(window.navigator.userAgent)};function $s(e){return e.canCheck?!(!e.isChecked&&!e.checked):"boolean"==typeof e.isChecked?e.isChecked:"boolean"==typeof e.checked?e.checked:null}function el(e){return!(!e.subMenuProps&&!e.items)}function tl(e){return!(!e.isDisabled&&!e.disabled)}function ol(e){return null!==$s(e)?"menuitemcheckbox":"menuitem"}function nl(e,t,o,n){return e.addEventListener(t,o,n),function(){return e.removeEventListener(t,o,n)}}!function(e){e[e.top=1]="top",e[e.bottom=-1]="bottom",e[e.left=2]="left",e[e.right=-2]="right"}(Xs||(Xs={})),function(e){e[e.top=0]="top",e[e.bottom=1]="bottom",e[e.start=2]="start",e[e.end=3]="end"}(Qs||(Qs={}));var rl,il=function(){function e(e,t,o,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===o&&(o=0),void 0===n&&(n=0),this.top=o,this.bottom=n,this.left=e,this.right=t}return Object.defineProperty(e.prototype,"width",{get:function(){return this.right-this.left},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.bottom-this.top},enumerable:!1,configurable:!0}),e.prototype.equals=function(e){return parseFloat(this.top.toFixed(4))===parseFloat(e.top.toFixed(4))&&parseFloat(this.bottom.toFixed(4))===parseFloat(e.bottom.toFixed(4))&&parseFloat(this.left.toFixed(4))===parseFloat(e.left.toFixed(4))&&parseFloat(this.right.toFixed(4))===parseFloat(e.right.toFixed(4))},e}();function al(e,t,o){return{targetEdge:e,alignmentEdge:t,isAuto:o}}var sl=((rl={})[Ys.topLeftEdge]=al(Xs.top,Xs.left),rl[Ys.topCenter]=al(Xs.top),rl[Ys.topRightEdge]=al(Xs.top,Xs.right),rl[Ys.topAutoEdge]=al(Xs.top,void 0,!0),rl[Ys.bottomLeftEdge]=al(Xs.bottom,Xs.left),rl[Ys.bottomCenter]=al(Xs.bottom),rl[Ys.bottomRightEdge]=al(Xs.bottom,Xs.right),rl[Ys.bottomAutoEdge]=al(Xs.bottom,void 0,!0),rl[Ys.leftTopEdge]=al(Xs.left,Xs.top),rl[Ys.leftCenter]=al(Xs.left),rl[Ys.leftBottomEdge]=al(Xs.left,Xs.bottom),rl[Ys.rightTopEdge]=al(Xs.right,Xs.top),rl[Ys.rightCenter]=al(Xs.right),rl[Ys.rightBottomEdge]=al(Xs.right,Xs.bottom),rl);function ll(e,t){return!(e.top<t.top||e.bottom>t.bottom||e.left<t.left||e.right>t.right)}function cl(e,t){var o=[];return e.top<t.top&&o.push(Xs.top),e.bottom>t.bottom&&o.push(Xs.bottom),e.left<t.left&&o.push(Xs.left),e.right>t.right&&o.push(Xs.right),o}function ul(e,t){return e[Xs[t]]}function dl(e,t,o){return e[Xs[t]]=o,e}function pl(e,t){var o=xl(t);return(ul(e,o.positiveEdge)+ul(e,o.negativeEdge))/2}function hl(e,t){return e>0?t:-1*t}function ml(e,t){return hl(e,ul(t,e))}function gl(e,t,o){return hl(o,ul(e,o)-ul(t,o))}function fl(e,t,o,n){void 0===n&&(n=!0);var r=ul(e,t)-o,i=dl(e,t,o);return n&&(i=dl(e,-1*t,ul(e,-1*t)-r)),i}function vl(e,t,o,n){return void 0===n&&(n=0),fl(e,o,ul(t,o)+hl(o,n))}function bl(e,t,o){return ml(o,e)>ml(o,t)}function yl(e,t){for(var o=0,n=0,r=cl(e,t);n<r.length;n++){var i=r[n];o+=Math.pow(gl(e,t,i),2)}return o}function Cl(e,t,o,n){for(var r=0,i=e;r<i.length;r++){var a=i[r],s=void 0;n&&n===-1*a?(s=fl(t.elementRectangle,a,ul(o,a),!1),t.forcedInBounds=!0):bl(s=vl(t.elementRectangle,o,a),o,-1*a)||(s=fl(s,-1*a,ul(o,-1*a),!1),t.forcedInBounds=!0),t.elementRectangle=s}return t}function _l(e,t,o){var n=xl(t).positiveEdge;return fl(e,n,o-(pl(e,t)-ul(e,n)))}function Sl(e,t,o,n,r){void 0===n&&(n=0);var i=new il(e.left,e.right,e.top,e.bottom),a=o.alignmentEdge,s=o.targetEdge,l=r?s:-1*s;return i=r?vl(i,t,s,n):function(e,t,o,n){void 0===n&&(n=0);var r=hl(-1*o,n);return fl(e,-1*o,ul(t,o)+r)}(i,t,s,n),i=a?vl(i,t,a):_l(i,l,pl(t,s))}function xl(e){return e===Xs.top||e===Xs.bottom?{positiveEdge:Xs.left,negativeEdge:Xs.right}:{positiveEdge:Xs.top,negativeEdge:Xs.bottom}}function kl(e,t,o){return o&&Math.abs(gl(e,o,t))>Math.abs(gl(e,o,-1*t))?-1*t:t}function wl(e,t,o){var n=pl(t,e),r=pl(o,e),i=xl(e),a=i.positiveEdge,s=i.negativeEdge;return n<=r?a:s}function Il(e,t,o,n,r,i,a){var s=Sl(e,t,n,r,a);return ll(s,o)?{elementRectangle:s,targetEdge:n.targetEdge,alignmentEdge:n.alignmentEdge}:function(e,t,o,n,r,i,a){void 0===r&&(r=0);var s=n.alignmentEdge,l=n.alignTargetEdge,c={elementRectangle:e,targetEdge:n.targetEdge,alignmentEdge:s};i||a||(c=function(e,t,o,n,r){void 0===r&&(r=0);var i=[Xs.left,Xs.right,Xs.bottom,Xs.top];jn()&&(i[0]*=-1,i[1]*=-1);for(var a,s=e,l=n.targetEdge,c=n.alignmentEdge,u=l,d=c,p=0;p<4;p++){if(bl(s,o,l))return{elementRectangle:s,targetEdge:l,alignmentEdge:c};var h=yl(s,o);(!a||h<a)&&(a=h,u=l,d=c),i.splice(i.indexOf(l),1),i.length>0&&(i.indexOf(-1*l)>-1?l*=-1:(c=l,l=i.slice(-1)[0]),s=Sl(e,t,{targetEdge:l,alignmentEdge:c},r))}return{elementRectangle:s=Sl(e,t,{targetEdge:u,alignmentEdge:d},r),targetEdge:u,alignmentEdge:d}}(e,t,o,n,r));var u=cl(c.elementRectangle,o),d=i?-c.targetEdge:void 0;if(u.length>0)if(l)if(c.alignmentEdge&&u.indexOf(-1*c.alignmentEdge)>-1){var p=function(e,t,o,n){var r=e.alignmentEdge,i=e.targetEdge,a=-1*r;return{elementRectangle:Sl(e.elementRectangle,t,{targetEdge:i,alignmentEdge:a},o,n),targetEdge:i,alignmentEdge:a}}(c,t,r,a);if(ll(p.elementRectangle,o))return p;c=Cl(cl(p.elementRectangle,o),c,o,d)}else c=Cl(u,c,o,d);else c=Cl(u,c,o,d);return c}(s,t,o,n,r,i,a)}function Dl(e){var t=e.getBoundingClientRect();return new il(t.left,t.right,t.top,t.bottom)}function Tl(e){return new il(e.left,e.right,e.top,e.bottom)}function El(e,t,o,n){var r=e.gapSpace?e.gapSpace:0,i=function(e,t){var o;if(t){if(t.preventDefault){var n=t;o=new il(n.clientX,n.clientX,n.clientY,n.clientY)}else if(t.getBoundingClientRect)o=Dl(t);else{var r=t,i=r.left||r.x,a=r.top||r.y,s=r.right||i,l=r.bottom||a;o=new il(i,s,a,l)}if(!ll(o,e))for(var c=0,u=cl(o,e);c<u.length;c++){var d=u[c];o[Xs[d]]=e[Xs[d]]}}else o=new il(0,0,0,0);return o}(o,e.target),a=function(e,t,o,n,r){return e.isAuto&&(e.alignmentEdge=wl(e.targetEdge,t,o)),e.alignTargetEdge=r,e}(function(e,t,o){if(void 0===e&&(e=Ys.bottomAutoEdge),o)return{alignmentEdge:o.alignmentEdge,isAuto:o.isAuto,targetEdge:o.targetEdge};var n=d({},sl[e]);return jn()?(n.alignmentEdge&&n.alignmentEdge%2==0&&(n.alignmentEdge=-1*n.alignmentEdge),void 0!==t?sl[t]:n):n}(e.directionalHint,e.directionalHintForRTL,n),i,o,e.coverTarget,e.alignTargetEdge),s=Il(Dl(t),i,o,a,r,e.directionalHintFixed,e.coverTarget);return d(d({},s),{targetRectangle:i})}function Pl(e,t,o,n,r){return{elementPosition:function(e,t,o,n,r,i,a,s){var l={},c=Dl(t),u=i?o:-1*o,d=r||xl(o).positiveEdge;return a||(d=kl(e,d,n)),l[Xs[u]]=gl(e,c,u),l[Xs[d]]=gl(e,c,d),s&&(l[Xs[-1*u]]=gl(e,c,-1*u),l[Xs[-1*d]]=gl(e,c,-1*d)),l}(e.elementRectangle,t,e.targetEdge,o,e.alignmentEdge,n,r,e.forcedInBounds),targetEdge:e.targetEdge,alignmentEdge:e.alignmentEdge}}function Rl(e,t,o,n,r){var i=e.isBeakVisible&&e.beakWidth||0,a=function(e){return Math.sqrt(e*e*2)}(i)/2+(e.gapSpace?e.gapSpace:0),s=e;s.gapSpace=a;var l,c,u,p,h,m,g,f,v=e.bounds?Tl(e.bounds):new il(0,window.innerWidth-es(),0,window.innerHeight),b=El(s,o,v,n),y=(l=b,c=function(e,t){var o=t.targetRectangle,n=xl(t.targetEdge),r=n.positiveEdge,i=n.negativeEdge,a=pl(o,t.targetEdge),s=new il(e/2,t.elementRectangle.width-e/2,e/2,t.elementRectangle.height-e/2),l=new il(0,e,0,e);return bl(l=_l(l=fl(l,-1*t.targetEdge,-e/2),-1*t.targetEdge,a-ml(r,t.elementRectangle)),s,r)?bl(l,s,i)||(l=vl(l,s,i)):l=vl(l,s,r),l}(i,b),u=v,p=-1*l.targetEdge,h=new il(0,l.elementRectangle.width,0,l.elementRectangle.height),m={},g=kl(l.elementRectangle,l.alignmentEdge?l.alignmentEdge:xl(p).positiveEdge,u),f=gl(l.elementRectangle,l.targetRectangle,p)>Math.abs(ul(c,p)),m[Xs[p]]=ul(c,p),m[Xs[g]]=gl(c,h,g),{elementPosition:d({},m),closestEdge:wl(l.targetEdge,c,h),targetEdge:p,hideBeak:!f});return d(d({},Pl(b,t,v,e.coverTarget,r)),{beakPosition:y})}function Ml(e,t,o,n){return function(e,t,o,n){var r=e.bounds?Tl(e.bounds):new il(0,window.innerWidth-es(),0,window.innerHeight);return Pl(El(e,o,r,n),t,r,e.coverTarget)}(e,t,o,n)}function Nl(e,t,o,n){return Rl(e,t,o,n)}function Bl(e,t,o,n){return function(e,t,o,n){return Rl(e,t,o,n,!0)}(e,t,o,n)}function Fl(e,t,o,n,r){void 0===o&&(o=0);var i=e,a=e,s=e,l=n?Tl(n):new il(0,window.innerWidth-es(),0,window.innerHeight),c=s.left||s.x,u=s.top||s.y,d=s.right||c,p=s.bottom||u;return function(e,t,o,n,r){var i,a=sl[t],s=r?-1*a.targetEdge:a.targetEdge;return(i=s===Xs.top?ul(e,a.targetEdge)-n.top-o:s===Xs.bottom?n.bottom-ul(e,a.targetEdge)-o:n.bottom-e.top-o)>0?i:n.height}(i.stopPropagation?new il(i.clientX,i.clientX,i.clientY,i.clientY):void 0!==c&&void 0!==u?new il(c,d,u,p):Dl(a),t,o,l,r)}function Al(e){return-1*e}function Ll(e,t){return function(e,t){var o=void 0;if(t.getWindowSegments&&(o=t.getWindowSegments()),void 0===o||o.length<=1)return{top:0,left:0,right:t.innerWidth,bottom:t.innerHeight,width:t.innerWidth,height:t.innerHeight};var n=0,r=0;if(null!==e&&e.getBoundingClientRect){var i=e.getBoundingClientRect();n=(i.left+i.right)/2,r=(i.top+i.bottom)/2}else null!==e&&(n=e.left||e.x,r=e.top||e.y);for(var a={top:0,left:0,right:0,bottom:0,width:0,height:0},s=0,l=o;s<l.length;s++){var c=l[s];n&&c.left<=n&&c.right>=n&&r&&c.top<=r&&c.bottom>=r&&(a={top:c.top,left:c.left,right:c.right,bottom:c.bottom,width:c.width,height:c.height})}return a}(e,t)}function Hl(){var e=Ei((function(){return new Zi}));return f.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function Ol(e,t,o,n){var r=f.useRef(o);r.current=o,f.useEffect((function(){var o=e&&"current"in e?e.current:e;if(o)return nl(o,t,(function(e){return r.current(e)}),n)}),[e,t,n])}var zl=f.createContext({window:"object"==typeof window?window:void 0}),Wl=function(){return f.useContext(zl).window},Vl=function(){var e;return null===(e=f.useContext(zl).window)||void 0===e?void 0:e.document},Kl=function(e){return f.createElement(zl.Provider,{value:e},e.children)};function Gl(e){var t=e.originalElement,o=e.containsFocus;t&&o&&t!==at()&&setTimeout((function(){var e;null===(e=t.focus)||void 0===e||e.call(t)}),0)}var Ul,jl=function(e,t){return e&&t?[].slice.call(t.children).filter((function(t){return t!==e})):[]},ql=f.forwardRef((function(e,t){e=d({shouldRestoreFocus:!0},e);var o=f.useRef(),n=Or(o,t);!function(e,t){var o=e["aria-modal"];f.useEffect((function(){var e,n=nt();if(o&&n&&t&&t.current){var r=null===(e=t.current.parentElement)||void 0===e?void 0:e.parentElement,i=jl(r,null==r?void 0:r.parentElement);if((null==r?void 0:r.parentElement)!==n.body){var a=function(e,t){for(var o=e;o&&o.parentElement!==t.body;)o=o.parentElement;return o}(t.current,n);i.concat(jl(a,n.body))}return(i=i.filter((function(e){return"TEMPLATE"!==e.tagName&&"SCRIPT"!==e.tagName&&"STYLE"!==e.tagName&&!e.hasAttribute("aria-hidden")}))).forEach((function(e){return e.setAttribute("aria-hidden","true")})),function(){return i.forEach((function(e){return e.removeAttribute("aria-hidden")}))}}}),[o,t])}(e,o),function(e,t){var o=e.onRestoreFocus,n=void 0===o?Gl:o,r=f.useRef(),i=f.useRef(!1);f.useEffect((function(){return r.current=nt().activeElement,Ba(t.current)&&(i.current=!0),function(){var e;null==n||n({originalElement:r.current,containsFocus:i.current,documentContainsFocus:(null===(e=nt())||void 0===e?void 0:e.hasFocus())||!1}),r.current=void 0}}),[]),Ol(t,"focus",f.useCallback((function(){i.current=!0}),[]),!0),Ol(t,"blur",f.useCallback((function(e){t.current&&e.relatedTarget&&!t.current.contains(e.relatedTarget)&&(i.current=!1)}),[]),!0)}(e,o);var r=e.role,i=e.className,a=e.ariaLabel,s=e.ariaLabelledBy,l=e.ariaDescribedBy,c=e.style,u=e.children,p=e.onDismiss,h=function(e,t){var o=Hl(),n=f.useState(!1),r=n[0],i=n[1];return f.useEffect((function(){return o.requestAnimationFrame((function(){var o;if(!e.style||!e.style.overflowY){var n=!1;if(t&&t.current&&(null===(o=t.current)||void 0===o?void 0:o.firstElementChild)){var a=t.current.clientHeight,s=t.current.firstElementChild.clientHeight;a>0&&s>a&&(n=s-a>1)}r!==n&&i(n)}})),function(){return o.dispose()}})),r}(e,o),m=f.useCallback((function(e){switch(e.which){case Gn.escape:p&&(p(e),e.preventDefault(),e.stopPropagation())}}),[p]);return Ol(Wl(),"keydown",m),f.createElement("div",d({ref:n},Tr(e,Dr),{className:i,role:r,"aria-label":a,"aria-labelledby":s,"aria-describedby":l,onKeyDown:m,style:d({overflowY:h?"scroll":void 0,outline:"none"},c)}),u)}));function Yl(e,t){var o=f.useRef(),n=f.useRef(null),r=Wl();if(!e||e!==o.current||"string"==typeof e){var i=null==t?void 0:t.current;if(e)if("string"==typeof e){var a=nt(i);n.current=a?a.querySelector(e):null}else n.current="stopPropagation"in e||"getBoundingClientRect"in e?e:"current"in e?e.current:e;o.current=e}return[n,r]}var Zl=((Ul={})[Xs.top]=Ze.slideUpIn10,Ul[Xs.bottom]=Ze.slideDownIn10,Ul[Xs.left]=Ze.slideLeftIn10,Ul[Xs.right]=Ze.slideRightIn10,Ul),Xl={opacity:0,filter:"opacity(0)",pointerEvents:"none"},Ql=["role","aria-roledescription"],Jl={preventDismissOnLostFocus:!1,preventDismissOnScroll:!1,preventDismissOnResize:!1,isBeakVisible:!0,beakWidth:16,gapSpace:0,minPagePadding:8,directionalHint:Ys.bottomAutoEdge},$l=Jn({disableCaching:!0});var ec=f.memo(f.forwardRef((function(e,t){var o=tr(Jl,e),n=o.styles,r=o.style,i=o.ariaLabel,a=o.ariaDescribedBy,s=o.ariaLabelledBy,l=o.className,c=o.isBeakVisible,u=o.children,p=o.beakWidth,h=o.calloutWidth,m=o.calloutMaxWidth,g=o.calloutMinWidth,v=o.doNotLayer,b=o.finalHeight,y=o.hideOverflow,C=void 0===y?!!b:y,_=o.backgroundColor,S=o.calloutMaxHeight,x=o.onScroll,k=o.shouldRestoreFocus,w=void 0===k||k,I=o.target,D=o.hidden,T=o.onLayerMounted,E=f.useRef(null),P=f.useState(null),R=P[0],M=P[1],N=f.useCallback((function(e){M(e)}),[]),B=Or(E,t),F=Yl(o.target,{current:R}),A=F[0],L=F[1],H=function(e,t,o){var n=e.bounds,r=e.minPagePadding,i=void 0===r?Jl.minPagePadding:r,a=e.target,s=f.useState(!1),l=s[0],c=s[1],u=f.useRef(),d=f.useCallback((function(){if(!u.current||l){var e="function"==typeof n?o?n(a,o):void 0:n;!e&&o&&(e={top:(e=Ll(t.current,o)).top+i,left:e.left+i,right:e.right-i,bottom:e.bottom-i,width:e.width-2*i,height:e.height-2*i}),u.current=e,l&&c(!1)}return u.current}),[n,i,a,t,o,l]),p=Hl();return Ol(o,"resize",p.debounce((function(){c(!0)}),500,{leading:!0})),d}(o,A,L),O=function(e,t,o,n,r){var i=f.useState(),a=i[0],s=i[1],l=f.useRef(0),c=f.useRef(),u=Hl(),p=e.hidden,h=e.target,m=e.finalHeight,g=e.onPositioned,v=e.directionalHint;return f.useEffect((function(){if(!p){var i=u.requestAnimationFrame((function(){if(t.current&&o){var i=d(d({},e),{target:n.current,bounds:r()}),u=c.current===h?a:void 0,p=m?Bl(i,t.current,o,u):Nl(i,t.current,o,u);!a&&p||a&&p&&(v=p,!oc((f=a).elementPosition,v.elementPosition)||!oc(f.beakPosition.elementPosition,v.beakPosition.elementPosition))&&l.current<5?(l.current++,s(p)):l.current>0&&(l.current=0,null==g||g(a))}var f,v}),o);return c.current=h,function(){u.cancelAnimationFrame(i),c.current=void 0}}s(void 0),l.current=0}),[p,v,u,o,t,n,m,r,g,a,e,h]),a}(o,E,R,A,H),z=function(e,t,o){var n,r=e.calloutMaxHeight,i=e.directionalHint,a=e.directionalHintFixed,s=e.hidden,l=f.useState(),c=l[0],u=l[1],d=null!==(n=null==o?void 0:o.elementPosition)&&void 0!==n?n:{},p=d.top,h=d.bottom;return f.useEffect((function(){var e,o="number"==typeof p&&"number"==typeof h,n=null!==(e=t())&&void 0!==e?e:{},i=n.top,a=n.bottom;r||o||s?u(r||void 0):"number"==typeof p&&a?u(a-p):"number"==typeof h&&"number"==typeof i&&a&&u(a-i-h)}),[h,r,i,a,t,s,o,p]),c}(o,H,O),W=function(e,t,o,n,r){var i=e.hidden,a=e.onDismiss,s=e.preventDismissOnScroll,l=e.preventDismissOnResize,c=e.preventDismissOnLostFocus,u=e.dismissOnTargetClick,d=e.shouldDismissOnWindowFocus,p=e.preventDismissOnEvent,h=f.useRef(!1),m=Hl(),g=Ei([function(){h.current=!0},function(){h.current=!1}]),v=!!t;return f.useEffect((function(){var e=function(e){v&&!s&&f(e)},t=function(e){l||p&&p(e)||null==a||a(e)},g=function(e){c||f(e)},f=function(e){var t=e.target,i=o.current&&!_a(o.current,t);if(i&&h.current)h.current=!1;else if(!n.current&&i||e.target!==r&&i&&(!n.current||"stopPropagation"in n.current||u||t!==n.current&&!_a(n.current,t))){if(p&&p(e))return;null==a||a(e)}},b=function(e){d&&((!p||p(e))&&(p||c)||(null==r?void 0:r.document.hasFocus())||null!==e.relatedTarget||null==a||a(e))},y=new Promise((function(o){m.setTimeout((function(){if(!i&&r){var n=[nl(r,"scroll",e,!0),nl(r,"resize",t,!0),nl(r.document.documentElement,"focus",g,!0),nl(r.document.documentElement,"click",g,!0),nl(r,"blur",b,!0)];o((function(){n.forEach((function(e){return e()}))}))}}),0)}));return function(){y.then((function(e){return e()}))}}),[i,m,o,n,r,a,d,u,c,l,s,v,p]),g}(o,O,E,A,L),V=W[0],K=W[1];if(function(e,t,o){var n=e.hidden,r=e.setInitialFocus,i=Hl(),a=!!t;f.useEffect((function(){if(!n&&r&&a&&o){var e=i.requestAnimationFrame((function(){return Ia(o)}),o);return function(){return i.cancelAnimationFrame(e)}}}),[n,a,i,o,r])}(o,O,R),f.useEffect((function(){D||null==T||T()}),[D]),!L)return null;var G=C,U=c&&!!I,j=$l(n,{theme:o.theme,className:l,overflowYHidden:G,calloutWidth:h,positions:O,beakWidth:p,backgroundColor:_,calloutMaxWidth:m,calloutMinWidth:g,doNotLayer:v}),q=d(d({maxHeight:S||"100%"},r),G&&{overflowY:"hidden"}),Y=o.hidden?{visibility:"hidden"}:void 0;return f.createElement("div",{ref:B,className:j.container,style:Y},f.createElement("div",d({},Tr(o,Dr,Ql),{className:qr(j.root,O&&O.targetEdge&&Zl[O.targetEdge]),style:O?d(d({},O.elementPosition),{maxHeight:z}):Xl,tabIndex:-1,ref:N}),U&&f.createElement("div",{className:j.beak,style:tc(O)}),U&&f.createElement("div",{className:j.beakCurtain}),f.createElement(ql,d({},Tr(o,Ql),{ariaDescribedBy:a,ariaLabel:i,ariaLabelledBy:s,className:j.calloutMain,onDismiss:o.onDismiss,onMouseDown:V,onMouseUp:K,onRestoreFocus:o.onRestoreFocus,onScroll:x,shouldRestoreFocus:w,style:q}),u)))})),(function(e,t){return!(t.shouldUpdateWhenHidden||!e.hidden||!t.hidden)||Bs(e,t)}));function tc(e){var t,o,n=d(d({},null===(t=null==e?void 0:e.beakPosition)||void 0===t?void 0:t.elementPosition),{display:(null===(o=null==e?void 0:e.beakPosition)||void 0===o?void 0:o.hideBeak)?"none":void 0});return n.top||n.bottom||n.left||n.right||(n.left=0,n.top=0),n}function oc(e,t){for(var o in t)if(t.hasOwnProperty(o)){var n=e[o],r=t[o];if(void 0===n||void 0===r)return!1;if(n.toFixed(2)!==r.toFixed(2))return!1}return!0}function nc(e){return{height:e,width:e}}ec.displayName="CalloutContentBase";var rc={container:"ms-Callout-container",root:"ms-Callout",beak:"ms-Callout-beak",beakCurtain:"ms-Callout-beakCurtain",calloutMain:"ms-Callout-main"},ic=Vn(ec,(function(e){var t,o=e.theme,n=e.className,r=e.overflowYHidden,i=e.calloutWidth,a=e.beakWidth,s=e.backgroundColor,l=e.calloutMaxWidth,c=e.calloutMinWidth,u=e.doNotLayer,d=Qo(rc,o),p=o.semanticColors,h=o.effects;return{container:[d.container,{position:"relative"}],root:[d.root,o.fonts.medium,{position:"absolute",display:"flex",zIndex:u?ko.Layer:void 0,boxSizing:"border-box",borderRadius:h.roundedCorner2,boxShadow:h.elevation16,selectors:(t={},t[ro]={borderWidth:1,borderStyle:"solid",borderColor:"WindowText"},t)},{selectors:{"&::-moz-focus-inner":{border:0},"&":{outline:"transparent"}}},n,!!i&&{width:i},!!l&&{maxWidth:l},!!c&&{minWidth:c}],beak:[d.beak,{position:"absolute",backgroundColor:p.menuBackground,boxShadow:"inherit",border:"inherit",boxSizing:"border-box",transform:"rotate(45deg)"},nc(a),s&&{backgroundColor:s}],beakCurtain:[d.beakCurtain,{position:"absolute",top:0,right:0,bottom:0,left:0,backgroundColor:p.menuBackground,borderRadius:h.roundedCorner2}],calloutMain:[d.calloutMain,{backgroundColor:p.menuBackground,overflowX:"hidden",overflowY:"auto",position:"relative",width:"100%",borderRadius:h.roundedCorner2},r&&{overflowY:"hidden"},s&&{backgroundColor:s}]}}),void 0,{scope:"CalloutContent"}),ac=ReactDOM;function sc(e,t){var o=(t||{}).customizations,n=void 0===o?{settings:{},scopedSettings:{}}:o;return{customizations:{settings:Jo(n.settings,e.settings),scopedSettings:$o(n.scopedSettings,e.scopedSettings),inCustomizerContext:!0}}}var lc=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._onCustomizationChange=function(){return t.forceUpdate()},t}return u(t,e),t.prototype.componentDidMount=function(){Dt.observe(this._onCustomizationChange)},t.prototype.componentWillUnmount=function(){Dt.unobserve(this._onCustomizationChange)},t.prototype.render=function(){var e=this,t=this.props.contextTransform;return f.createElement(On.Consumer,null,(function(o){var n=sc(e.props,o);return t&&(n=t(n)),f.createElement(On.Provider,{value:n},e.props.children)}))},t}(f.Component),cc=Jn(),uc=jo((function(e,t){return jt(d(d({},e),{rtl:t}))})),dc=f.forwardRef((function(e,t){var o=e.className,n=e.theme,r=e.applyTheme,i=e.applyThemeToBody,a=e.styles,s=cc(a,{theme:n,applyTheme:r,className:o}),l=f.useRef(null);return function(e,t,o){var n=t.bodyThemed;f.useEffect((function(){if(e){var t=nt(o.current);if(t)return t.body.classList.add(n),function(){t.body.classList.remove(n)}}}),[n,e,o])}(i,s,l),ks(l),f.createElement(f.Fragment,null,function(e,t,o,n){var r=t.root,i=e.as,a=void 0===i?"div":i,s=e.dir,l=e.theme,c=Tr(e,Dr,["dir"]),u=function(e){var t=e.theme,o=e.dir,n=jn(t)?"rtl":"ltr",r=jn()?"rtl":"ltr",i=o||n;return{rootDir:i!==n||i!==r?i:o,needsTheme:i!==n}}(e),p=u.rootDir,h=u.needsTheme,m=f.createElement(a,d({dir:p},c,{className:r,ref:Or(o,n)}));return h&&(m=f.createElement(lc,{settings:{theme:uc(l,"rtl"===s)}},m)),m}(e,s,l,t))}));dc.displayName="FabricBase";var pc={fontFamily:"inherit"},hc={root:"ms-Fabric",bodyThemed:"ms-Fabric-bodyThemed"},mc=Vn(dc,(function(e){var t=e.theme,o=e.className,n=e.applyTheme;return{root:[Qo(hc,t).root,t.fonts.medium,{color:t.palette.neutralPrimary,selectors:{"& button":pc,"& input":pc,"& textarea":pc}},n&&{color:t.semanticColors.bodyText,backgroundColor:t.semanticColors.bodyBackground},o],bodyThemed:[{backgroundColor:t.semanticColors.bodyBackground}]}}),void 0,{scope:"Fabric"});function gc(e,t){var o=e,n=t;o._virtual||(o._virtual={children:[]});var r=o._virtual.parent;if(r&&r!==t){var i=r._virtual.children.indexOf(o);i>-1&&r._virtual.children.splice(i,1)}o._virtual.parent=n||void 0,n&&(n._virtual||(n._virtual={children:[]}),n._virtual.children.push(o))}var fc={};function vc(e){fc[e]&&fc[e].forEach((function(e){return e()}))}var bc,yc=Jn(),Cc=f.forwardRef((function(e,t){var o=f.useRef(null),n=Or(o,t),r=f.useRef(),i=f.useState(!1),a=i[0],s=i[1],l=Vl(),c=e.eventBubblingEnabled,u=e.styles,p=e.theme,h=e.className,m=e.children,g=e.hostId,v=e.onLayerDidMount,b=void 0===v?function(){}:v,y=e.onLayerMounted,C=void 0===y?function(){}:y,_=e.onLayerWillUnmount,S=e.insertFirst,x=yc(u,{theme:p,className:h,isNotHost:!g}),k=function(){null==_||_();var e=r.current;r.current=void 0,e&&e.parentNode&&e.parentNode.removeChild(e)},w=function(){var e=function(){if(l)return g?l.getElementById(g):l.body}();if(l&&e){k();var t=l.createElement("div");t.className=x.root,ns(t),gc(t,o.current),S?e.insertBefore(t,e.firstChild):e.appendChild(t),r.current=t,s(!0)}};return f.useLayoutEffect((function(){return w(),g&&function(e,t){fc[e]||(fc[e]=[]),fc[e].push(t)}(g,w),function(){k(),g&&function(e,t){if(fc[e]){var o=fc[e].indexOf(t);o>=0&&(fc[e].splice(o,1),0===fc[e].length&&delete fc[e])}}(g,w)}}),[g]),f.useEffect((function(){r.current&&a&&(null==C||C(),null==b||b(),s(!1))}),[a,C,b]),function(e){Ri({name:"Layer",props:e,deprecations:{onLayerMounted:"onLayerDidMount"}})}(e),f.createElement("span",{className:"ms-layer",ref:n},r.current&&ac.createPortal(f.createElement(mc,d({},!c&&(bc||(bc={},["onClick","onContextMenu","onDoubleClick","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOver","onMouseOut","onMouseUp","onTouchMove","onTouchStart","onTouchCancel","onTouchEnd","onKeyDown","onKeyPress","onKeyUp","onFocus","onBlur","onChange","onInput","onInvalid","onSubmit"].forEach((function(e){return bc[e]=_c}))),bc),{className:x.content}),m),r.current))}));Cc.displayName="LayerBase";var _c=function(e){e.eventPhase===Event.BUBBLING_PHASE&&"mouseenter"!==e.type&&"mouseleave"!==e.type&&"touchstart"!==e.type&&"touchend"!==e.type&&e.stopPropagation()},Sc={root:"ms-Layer",rootNoHost:"ms-Layer--fixed",content:"ms-Layer-content"},xc=Vn(Cc,(function(e){var t=e.className,o=e.isNotHost,n=e.theme,r=Qo(Sc,n);return{root:[r.root,n.fonts.medium,o&&[r.rootNoHost,{position:"fixed",zIndex:ko.Layer,top:0,left:0,bottom:0,right:0,visibility:"hidden"}],t],content:[r.content,{visibility:"visible"}]}}),void 0,{scope:"Layer",fields:["hostId","theme","styles"]}),kc=f.forwardRef((function(e,t){var o=e.layerProps,n=e.doNotLayer,r=p(e,["layerProps","doNotLayer"]),i=f.createElement(ic,d({},r,{doNotLayer:n,ref:t}));return n?i:f.createElement(xc,d({},o),i)}));kc.displayName="Callout";var wc,Ic=function(e){var t=e.item,o=e.classNames,n=t.iconProps;return f.createElement(ii,d({},n,{className:o.icon}))},Dc=function(e){var t=e.item;return e.hasIcons?t.onRenderIcon?t.onRenderIcon(e,Ic):Ic(e):null},Tc=function(e){var t=e.onCheckmarkClick,o=e.item,n=e.classNames,r=$s(o);return t?f.createElement(ii,{iconName:!1!==o.canCheck&&r?"CheckMark":"",className:n.checkmarkIcon,onClick:function(e){return t(o,e)}}):null},Ec=function(e){var t=e.item,o=e.classNames;return t.text||t.name?f.createElement("span",{className:o.label},t.text||t.name):null},Pc=function(e){var t=e.item,o=e.classNames;return t.secondaryText?f.createElement("span",{className:o.secondaryText},t.secondaryText):null},Rc=function(e){var t=e.item,o=e.classNames,n=e.theme;return el(t)?f.createElement(ii,d({iconName:jn(n)?"ChevronLeft":"ChevronRight"},t.submenuIconProps,{className:o.subMenuIcon})):null},Mc=function(e){function t(t){var o=e.call(this,t)||this;return o.openSubMenu=function(){var e=o.props,t=e.item,n=e.openSubMenu,r=e.getSubmenuTarget;if(r){var i=r();el(t)&&n&&i&&n(t,i)}},o.dismissSubMenu=function(){var e=o.props,t=e.item,n=e.dismissSubMenu;el(t)&&n&&n()},o.dismissMenu=function(e){var t=o.props.dismissMenu;t&&t(void 0,e)},Gi(o),o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.item,o=e.classNames,n=t.onRenderContent||this._renderLayout;return f.createElement("div",{className:t.split?o.linkContentMenu:o.linkContent},n(this.props,{renderCheckMarkIcon:Tc,renderItemIcon:Dc,renderItemName:Ec,renderSecondaryText:Pc,renderSubMenuIcon:Rc}))},t.prototype._renderLayout=function(e,t){return f.createElement(f.Fragment,null,t.renderCheckMarkIcon(e),t.renderItemIcon(e),t.renderItemName(e),t.renderSecondaryText(e),t.renderSubMenuIcon(e))},t}(f.Component),Nc=jo((function(e){return In({wrapper:{display:"inline-flex",height:"100%",alignItems:"center"},divider:{width:1,height:"100%",backgroundColor:e.palette.neutralTertiaryAlt}})})),Bc=36,Fc=_o(0,fo),Ac=jo((function(){var e;return{selectors:(e={},e[ro]=d({backgroundColor:"Highlight",borderColor:"Highlight",color:"HighlightText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),e)}})),Lc=jo((function(e){var t,o,n,r,i,a,s,l=e.semanticColors,c=e.fonts,u=e.palette,p=l.menuItemBackgroundHovered,h=l.menuItemTextHovered,m=l.menuItemBackgroundPressed,g=l.bodyDivider;return kn({item:[c.medium,{color:l.bodyText,position:"relative",boxSizing:"border-box"}],divider:{display:"block",height:"1px",backgroundColor:g,position:"relative"},root:[To(e),c.medium,{color:l.bodyText,backgroundColor:"transparent",border:"none",width:"100%",height:Bc,lineHeight:Bc,display:"block",cursor:"pointer",padding:"0px 8px 0 4px",textAlign:"left"}],rootDisabled:{color:l.disabledBodyText,cursor:"default",pointerEvents:"none",selectors:(t={},t[ro]=d({color:"GrayText",opacity:1},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),t)},rootHovered:d({backgroundColor:p,color:h,selectors:{".ms-ContextualMenu-icon":{color:u.themeDarkAlt},".ms-ContextualMenu-submenuIcon":{color:u.neutralPrimary}}},Ac()),rootFocused:d({backgroundColor:u.white},Ac()),rootChecked:d({selectors:{".ms-ContextualMenu-checkmarkIcon":{color:u.neutralPrimary}}},Ac()),rootPressed:d({backgroundColor:m,selectors:{".ms-ContextualMenu-icon":{color:u.themeDark},".ms-ContextualMenu-submenuIcon":{color:u.neutralPrimary}}},Ac()),rootExpanded:d({backgroundColor:m,color:l.bodyTextChecked},Ac()),linkContent:{whiteSpace:"nowrap",height:"inherit",display:"flex",alignItems:"center",maxWidth:"100%"},anchorLink:{padding:"0px 8px 0 4px",textRendering:"auto",color:"inherit",letterSpacing:"normal",wordSpacing:"normal",textTransform:"none",textIndent:"0px",textShadow:"none",textDecoration:"none",boxSizing:"border-box"},label:{margin:"0 4px",verticalAlign:"middle",display:"inline-block",flexGrow:"1",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},secondaryText:{color:e.palette.neutralSecondary,paddingLeft:"20px",textAlign:"right"},icon:{display:"inline-block",minHeight:"1px",maxHeight:Bc,fontSize:Ye.medium,width:Ye.medium,margin:"0 4px",verticalAlign:"middle",flexShrink:"0",selectors:(o={},o[Fc]={fontSize:Ye.large,width:Ye.large},o)},iconColor:{color:l.menuIcon,selectors:(n={},n[ro]={color:"inherit"},n["$root:hover &"]={selectors:(r={},r[ro]={color:"HighlightText"},r)},n["$root:focus &"]={selectors:(i={},i[ro]={color:"HighlightText"},i)},n)},iconDisabled:{color:l.disabledBodyText},checkmarkIcon:{color:l.bodySubtext,selectors:(a={},a[ro]={color:"HighlightText"},a)},subMenuIcon:{height:Bc,lineHeight:Bc,color:u.neutralSecondary,textAlign:"center",display:"inline-block",verticalAlign:"middle",flexShrink:"0",fontSize:Ye.small,selectors:(s={":hover":{color:u.neutralPrimary},":active":{color:u.neutralPrimary}},s[Fc]={fontSize:Ye.medium},s[ro]={color:"HighlightText"},s)},splitButtonFlexContainer:[To(e),{display:"flex",height:Bc,flexWrap:"nowrap",justifyContent:"center",alignItems:"flex-start"}]})})),Hc=_o(0,fo),Oc=jo((function(e){var t;return In(Nc(e),{wrapper:{position:"absolute",right:28,selectors:(t={},t[Hc]={right:32},t)},divider:{height:16,width:1}})})),zc={item:"ms-ContextualMenu-item",divider:"ms-ContextualMenu-divider",root:"ms-ContextualMenu-link",isChecked:"is-checked",isExpanded:"is-expanded",isDisabled:"is-disabled",linkContent:"ms-ContextualMenu-linkContent",linkContentMenu:"ms-ContextualMenu-linkContent",icon:"ms-ContextualMenu-icon",iconColor:"ms-ContextualMenu-iconColor",checkmarkIcon:"ms-ContextualMenu-checkmarkIcon",subMenuIcon:"ms-ContextualMenu-submenuIcon",label:"ms-ContextualMenu-itemText",secondaryText:"ms-ContextualMenu-secondaryText",splitMenu:"ms-ContextualMenu-splitMenu",screenReaderText:"ms-ContextualMenu-screenReaderText"},Wc=jo((function(e,t,o,n,r,i,a,s,l,c,u,d){var p,h,m,g,f=Lc(e),v=Qo(zc,e);return In({item:[v.item,f.item,a],divider:[v.divider,f.divider,s],root:[v.root,f.root,n&&[v.isChecked,f.rootChecked],r&&f.anchorLink,o&&[v.isExpanded,f.rootExpanded],t&&[v.isDisabled,f.rootDisabled],!t&&!o&&[{selectors:(p={":hover":f.rootHovered,":active":f.rootPressed},p["."+wo+" &:focus, ."+wo+" &:focus:hover"]=f.rootFocused,p["."+wo+" &:hover"]={background:"inherit;"},p)}],d],splitPrimary:[f.root,{width:"calc(100% - 28px)"},n&&["is-checked",f.rootChecked],(t||u)&&["is-disabled",f.rootDisabled],!(t||u)&&!n&&[{selectors:(h={":hover":f.rootHovered},h[":hover ~ ."+v.splitMenu]=f.rootHovered,h[":active"]=f.rootPressed,h["."+wo+" &:focus, ."+wo+" &:focus:hover"]=f.rootFocused,h["."+wo+" &:hover"]={background:"inherit;"},h)}]],splitMenu:[v.splitMenu,f.root,{flexBasis:"0",padding:"0 8px",minWidth:"28px"},o&&["is-expanded",f.rootExpanded],t&&["is-disabled",f.rootDisabled],!t&&!o&&[{selectors:(m={":hover":f.rootHovered,":active":f.rootPressed},m["."+wo+" &:focus, ."+wo+" &:focus:hover"]=f.rootFocused,m["."+wo+" &:hover"]={background:"inherit;"},m)}]],anchorLink:f.anchorLink,linkContent:[v.linkContent,f.linkContent],linkContentMenu:[v.linkContentMenu,f.linkContent,{justifyContent:"center"}],icon:[v.icon,i&&f.iconColor,f.icon,l,t&&[v.isDisabled,f.iconDisabled]],iconColor:f.iconColor,checkmarkIcon:[v.checkmarkIcon,i&&f.checkmarkIcon,f.icon,l],subMenuIcon:[v.subMenuIcon,f.subMenuIcon,c,o&&{color:e.palette.neutralPrimary},t&&[f.iconDisabled]],label:[v.label,f.label],secondaryText:[v.secondaryText,f.secondaryText],splitContainer:[f.splitButtonFlexContainer,!t&&!n&&[{selectors:(g={},g["."+wo+" &:focus, ."+wo+" &:focus:hover"]=f.rootFocused,g)}]],screenReaderText:[v.screenReaderText,f.screenReaderText,Mo,{visibility:"hidden"}]})})),Vc=function(e){var t=e.theme,o=e.disabled,n=e.expanded,r=e.checked,i=e.isAnchorLink,a=e.knownIcon,s=e.itemClassName,l=e.dividerClassName,c=e.iconClassName,u=e.subMenuClassName,d=e.primaryDisabled,p=e.className;return Wc(t,o,n,r,i,a,s,l,c,u,d,p)},Kc=Vn(Mc,Vc,void 0,{scope:"ContextualMenuItem"}),Gc=function(e){function t(t){var o=e.call(this,t)||this;return o._onItemMouseEnter=function(e){var t=o.props,n=t.item,r=t.onItemMouseEnter;r&&r(n,e,e.currentTarget)},o._onItemClick=function(e){var t=o.props,n=t.item,r=t.onItemClickBase;r&&r(n,e,e.currentTarget)},o._onItemMouseLeave=function(e){var t=o.props,n=t.item,r=t.onItemMouseLeave;r&&r(n,e)},o._onItemKeyDown=function(e){var t=o.props,n=t.item,r=t.onItemKeyDown;r&&r(n,e)},o._onItemMouseMove=function(e){var t=o.props,n=t.item,r=t.onItemMouseMove;r&&r(n,e,e.currentTarget)},o._getSubmenuTarget=function(){},Gi(o),o}return u(t,e),t.prototype.shouldComponentUpdate=function(e){return!Bs(e,this.props)},t}(f.Component),Uc="ktp",jc="-",qc=Uc+jc,Yc="data-ktp-target",Zc="data-ktp-execute-target",Xc="data-ktp-aria-target",Qc="ktp-layer-id",Jc=", ";!function(e){e.KEYTIP_ADDED="keytipAdded",e.KEYTIP_REMOVED="keytipRemoved",e.KEYTIP_UPDATED="keytipUpdated",e.PERSISTED_KEYTIP_ADDED="persistedKeytipAdded",e.PERSISTED_KEYTIP_REMOVED="persistedKeytipRemoved",e.PERSISTED_KEYTIP_EXECUTE="persistedKeytipExecute",e.ENTER_KEYTIP_MODE="enterKeytipMode",e.EXIT_KEYTIP_MODE="exitKeytipMode"}(wc||(wc={}));var $c=function(){function e(){this.keytips={},this.persistedKeytips={},this.sequenceMapping={},this.inKeytipMode=!1,this.shouldEnterKeytipMode=!0,this.delayUpdatingKeytipChange=!1}return e.getInstance=function(){return this._instance},e.prototype.init=function(e){this.delayUpdatingKeytipChange=e},e.prototype.register=function(e,t){void 0===t&&(t=!1);var o=e;t||(o=this.addParentOverflow(e),this.sequenceMapping[o.keySequences.toString()]=o);var n=this._getUniqueKtp(o);if(t?this.persistedKeytips[n.uniqueID]=n:this.keytips[n.uniqueID]=n,this.inKeytipMode||!this.delayUpdatingKeytipChange){var r=t?wc.PERSISTED_KEYTIP_ADDED:wc.KEYTIP_ADDED;zs.raise(this,r,{keytip:o,uniqueID:n.uniqueID})}return n.uniqueID},e.prototype.update=function(e,t){var o=this.addParentOverflow(e),n=this._getUniqueKtp(o,t),r=this.keytips[t];r&&(n.keytip.visible=r.keytip.visible,this.keytips[t]=n,delete this.sequenceMapping[r.keytip.keySequences.toString()],this.sequenceMapping[n.keytip.keySequences.toString()]=n.keytip,!this.inKeytipMode&&this.delayUpdatingKeytipChange||zs.raise(this,wc.KEYTIP_UPDATED,{keytip:n.keytip,uniqueID:n.uniqueID}))},e.prototype.unregister=function(e,t,o){void 0===o&&(o=!1),o?delete this.persistedKeytips[t]:delete this.keytips[t],!o&&delete this.sequenceMapping[e.keySequences.toString()];var n=o?wc.PERSISTED_KEYTIP_REMOVED:wc.KEYTIP_REMOVED;!this.inKeytipMode&&this.delayUpdatingKeytipChange||zs.raise(this,n,{keytip:e,uniqueID:t})},e.prototype.enterKeytipMode=function(){zs.raise(this,wc.ENTER_KEYTIP_MODE)},e.prototype.exitKeytipMode=function(){zs.raise(this,wc.EXIT_KEYTIP_MODE)},e.prototype.getKeytips=function(){var e=this;return Object.keys(this.keytips).map((function(t){return e.keytips[t].keytip}))},e.prototype.addParentOverflow=function(e){var t=m(e.keySequences);if(t.pop(),0!==t.length){var o=this.sequenceMapping[t.toString()];if(o&&o.overflowSetSequence)return d(d({},e),{overflowSetSequence:o.overflowSetSequence})}return e},e.prototype.menuExecute=function(e,t){zs.raise(this,wc.PERSISTED_KEYTIP_EXECUTE,{overflowButtonSequences:e,keytipSequences:t})},e.prototype._getUniqueKtp=function(e,t){return void 0===t&&(t=Ka()),{keytip:d({},e),uniqueID:t}},e._instance=new e,e}();function eu(e){return e.reduce((function(e,t){return e+jc+t.split("").join(jc)}),Uc)}function tu(e,t){var o=t.length,n=m(t).pop();return da(m(e),o-1,n)}function ou(e){return"["+Yc+'="'+eu(e)+'"]'}function nu(e){return"["+Zc+'="'+e+'"]'}function ru(e){var t=" "+Qc;return e.length?t+" "+eu(e):t}function iu(e){var t=f.useRef(),o=e.keytipProps?d({disabled:e.disabled},e.keytipProps):void 0,n=Ei($c.getInstance()),r=Ti(e);f.useLayoutEffect((function(){t.current&&o&&((null==r?void 0:r.keytipProps)!==e.keytipProps||(null==r?void 0:r.disabled)!==e.disabled)&&n.update(o,t.current)})),f.useLayoutEffect((function(){return o&&(t.current=n.register(o)),function(){o&&n.unregister(o,t.current)}}),[]);var i={ariaDescribedBy:void 0,keytipId:void 0};return o&&(i=function(e,t,o){var n=e.addParentOverflow(t),r=Gs(o,ru(n.keySequences)),i=m(n.keySequences);return n.overflowSetSequence&&(i=tu(i,n.overflowSetSequence)),{ariaDescribedBy:r,keytipId:eu(i)}}(n,o,e.ariaDescribedBy)),i}var au=function(e){var t,o=e.children,n=iu(p(e,["children"])),r=n.keytipId,i=n.ariaDescribedBy;return o(((t={})[Yc]=r,t[Zc]=r,t["aria-describedby"]=i,t))},su=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._anchor=f.createRef(),t._getMemoizedMenuButtonKeytipProps=jo((function(e){return d(d({},e),{hasMenu:!0})})),t._getSubmenuTarget=function(){return t._anchor.current?t._anchor.current:void 0},t._onItemClick=function(e){var o=t.props,n=o.item,r=o.onItemClick;r&&r(n,e)},t._renderAriaDescription=function(e,o){return e?f.createElement("span",{id:t._ariaDescriptionId,className:o},e):null},t}return u(t,e),t.prototype.render=function(){var e=this,t=this.props,o=t.item,n=t.classNames,r=t.index,i=t.focusableElementIndex,a=t.totalItemCount,s=t.hasCheckmarks,l=t.hasIcons,c=t.contextualMenuItemAs,u=void 0===c?Kc:c,p=t.expandedMenuItemKey,h=t.onItemClick,m=t.openSubMenu,g=t.dismissSubMenu,v=t.dismissMenu,b=o.rel;o.target&&"_blank"===o.target.toLowerCase()&&(b=b||"nofollow noopener noreferrer");var y=el(o),C=Tr(o,dr),_=tl(o),S=o.itemProps,x=o.ariaDescription,k=o.keytipProps;k&&y&&(k=this._getMemoizedMenuButtonKeytipProps(k)),x&&(this._ariaDescriptionId=Ka());var w=Gs(o.ariaDescribedBy,x?this._ariaDescriptionId:void 0,C["aria-describedby"]),I={"aria-describedby":w};return f.createElement("div",null,f.createElement(au,{keytipProps:o.keytipProps,ariaDescribedBy:w,disabled:_},(function(t){return f.createElement("a",d({},I,C,t,{ref:e._anchor,href:o.href,target:o.target,rel:b,className:n.root,role:"menuitem","aria-haspopup":y||void 0,"aria-expanded":y?o.key===p:void 0,"aria-posinset":i+1,"aria-setsize":a,"aria-disabled":tl(o),style:o.style,onClick:e._onItemClick,onMouseEnter:e._onItemMouseEnter,onMouseLeave:e._onItemMouseLeave,onMouseMove:e._onItemMouseMove,onKeyDown:y?e._onItemKeyDown:void 0}),f.createElement(u,d({componentRef:o.componentRef,item:o,classNames:n,index:r,onCheckmarkClick:s&&h?h:void 0,hasIcons:l,openSubMenu:m,dismissSubMenu:g,dismissMenu:v,getSubmenuTarget:e._getSubmenuTarget},S)),e._renderAriaDescription(x,n.screenReaderText))})))},t}(Gc),lu=Jn(),cu=f.forwardRef((function(e,t){var o=e.styles,n=e.theme,r=e.getClassNames,i=e.className,a=lu(o,{theme:n,getClassNames:r,className:i});return f.createElement("span",{className:a.wrapper,ref:t},f.createElement("span",{className:a.divider}))}));cu.displayName="VerticalDividerBase";var uu=Vn(cu,(function(e){var t=e.theme,o=e.getClassNames,n=e.className;if(!t)throw new Error("Theme is undefined or null.");if(o){var r=o(t);return{wrapper:[r.wrapper],divider:[r.divider]}}return{wrapper:[{display:"inline-flex",height:"100%",alignItems:"center"},n],divider:[{width:1,height:"100%",backgroundColor:t.palette.neutralTertiaryAlt}]}}),void 0,{scope:"VerticalDivider"}),du=function(e){function t(t){var o=e.call(this,t)||this;return o._getMemoizedMenuButtonKeytipProps=jo((function(e){return d(d({},e),{hasMenu:!0})})),o._onItemKeyDown=function(e){var t=o.props,n=t.item,r=t.onItemKeyDown;e.which===Gn.enter?(o._executeItemClick(e),e.preventDefault(),e.stopPropagation()):r&&r(n,e)},o._getSubmenuTarget=function(){return o._splitButton},o._renderAriaDescription=function(e,t){return e?f.createElement("span",{id:o._ariaDescriptionId,className:t},e):null},o._onItemMouseEnterPrimary=function(e){var t=o.props,n=t.item,r=t.onItemMouseEnter;r&&r(d(d({},n),{subMenuProps:void 0,items:void 0}),e,o._splitButton)},o._onItemMouseEnterIcon=function(e){var t=o.props,n=t.item,r=t.onItemMouseEnter;r&&r(n,e,o._splitButton)},o._onItemMouseMovePrimary=function(e){var t=o.props,n=t.item,r=t.onItemMouseMove;r&&r(d(d({},n),{subMenuProps:void 0,items:void 0}),e,o._splitButton)},o._onItemMouseMoveIcon=function(e){var t=o.props,n=t.item,r=t.onItemMouseMove;r&&r(n,e,o._splitButton)},o._onIconItemClick=function(e){var t=o.props,n=t.item,r=t.onItemClickBase;r&&r(n,e,o._splitButton?o._splitButton:e.currentTarget)},o._executeItemClick=function(e){var t=o.props,n=t.item,r=t.executeItemClick,i=t.onItemClick;if(!n.disabled&&!n.isDisabled)return o._processingTouch&&i?i(n,e):void(r&&r(n,e))},o._onTouchStart=function(e){o._splitButton&&!("onpointerdown"in o._splitButton)&&o._handleTouchAndPointerEvent(e)},o._onPointerDown=function(e){"touch"===e.pointerType&&(o._handleTouchAndPointerEvent(e),e.preventDefault(),e.stopImmediatePropagation())},o._async=new Zi(o),o._events=new zs(o),o}return u(t,e),t.prototype.componentDidMount=function(){this._splitButton&&"onpointerdown"in this._splitButton&&this._events.on(this._splitButton,"pointerdown",this._onPointerDown,!0)},t.prototype.componentWillUnmount=function(){this._async.dispose(),this._events.dispose()},t.prototype.render=function(){var e=this,t=this.props,o=t.item,n=t.classNames,r=t.index,i=t.focusableElementIndex,a=t.totalItemCount,s=t.hasCheckmarks,l=t.hasIcons,c=t.onItemMouseLeave,u=t.expandedMenuItemKey,p=el(o),h=o.keytipProps;h&&(h=this._getMemoizedMenuButtonKeytipProps(h));var m=o.ariaDescription;return m&&(this._ariaDescriptionId=Ka()),f.createElement(au,{keytipProps:h,disabled:tl(o)},(function(t){return f.createElement("div",{"data-ktp-target":t["data-ktp-target"],ref:function(t){return e._splitButton=t},role:ol(o),"aria-label":o.ariaLabel,className:n.splitContainer,"aria-disabled":tl(o),"aria-expanded":p?o.key===u:void 0,"aria-haspopup":!0,"aria-describedby":Gs(o.ariaDescribedBy,m?e._ariaDescriptionId:void 0,t["aria-describedby"]),"aria-checked":o.isChecked||o.checked,"aria-posinset":i+1,"aria-setsize":a,onMouseEnter:e._onItemMouseEnterPrimary,onMouseLeave:c?c.bind(e,d(d({},o),{subMenuProps:null,items:null})):void 0,onMouseMove:e._onItemMouseMovePrimary,onKeyDown:e._onItemKeyDown,onClick:e._executeItemClick,onTouchStart:e._onTouchStart,tabIndex:0,"data-is-focusable":!0,"aria-roledescription":o["aria-roledescription"]},e._renderSplitPrimaryButton(o,n,r,s,l),e._renderSplitDivider(o),e._renderSplitIconButton(o,n,r,t),e._renderAriaDescription(m,n.screenReaderText))}))},t.prototype._renderSplitPrimaryButton=function(e,t,o,n,r){var i=this.props,a=i.contextualMenuItemAs,s=void 0===a?Kc:a,l=i.onItemClick,c={key:e.key,disabled:tl(e)||e.primaryDisabled,name:e.name,text:e.text||e.name,secondaryText:e.secondaryText,className:t.splitPrimary,canCheck:e.canCheck,isChecked:e.isChecked,checked:e.checked,iconProps:e.iconProps,onRenderIcon:e.onRenderIcon,data:e.data,"data-is-focusable":!1},u=e.itemProps;return f.createElement("button",d({},Tr(c,pr)),f.createElement(s,d({"data-is-focusable":!1,item:c,classNames:t,index:o,onCheckmarkClick:n&&l?l:void 0,hasIcons:r},u)))},t.prototype._renderSplitDivider=function(e){var t=e.getSplitButtonVerticalDividerClassNames||Oc;return f.createElement(uu,{getClassNames:t})},t.prototype._renderSplitIconButton=function(e,t,o,n){var r=this.props,i=r.contextualMenuItemAs,a=void 0===i?Kc:i,s=r.onItemMouseLeave,l=r.onItemMouseDown,c=r.openSubMenu,u=r.dismissSubMenu,p=r.dismissMenu,h={onClick:this._onIconItemClick,disabled:tl(e),className:t.splitMenu,subMenuProps:e.subMenuProps,submenuIconProps:e.submenuIconProps,split:!0,key:e.key},m=d(d({},Tr(h,pr)),{onMouseEnter:this._onItemMouseEnterIcon,onMouseLeave:s?s.bind(this,e):void 0,onMouseDown:function(t){return l?l(e,t):void 0},onMouseMove:this._onItemMouseMoveIcon,"data-is-focusable":!1,"data-ktp-execute-target":n["data-ktp-execute-target"],"aria-hidden":!0}),g=e.itemProps;return f.createElement("button",d({},m),f.createElement(a,d({componentRef:e.componentRef,item:h,classNames:t,index:o,hasIcons:!1,openSubMenu:c,dismissSubMenu:u,dismissMenu:p,getSubmenuTarget:this._getSubmenuTarget},g)))},t.prototype._handleTouchAndPointerEvent=function(e){var t=this,o=this.props.onTap;o&&o(e),this._lastTouchTimeoutId&&(this._async.clearTimeout(this._lastTouchTimeoutId),this._lastTouchTimeoutId=void 0),this._processingTouch=!0,this._lastTouchTimeoutId=this._async.setTimeout((function(){t._processingTouch=!1,t._lastTouchTimeoutId=void 0}),500)},t}(Gc),pu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._btn=f.createRef(),t._getMemoizedMenuButtonKeytipProps=jo((function(e){return d(d({},e),{hasMenu:!0})})),t._renderAriaDescription=function(e,o){return e?f.createElement("span",{id:t._ariaDescriptionId,className:o},e):null},t._getSubmenuTarget=function(){return t._btn.current?t._btn.current:void 0},t}return u(t,e),t.prototype.render=function(){var e=this,t=this.props,o=t.item,n=t.classNames,r=t.index,i=t.focusableElementIndex,a=t.totalItemCount,s=t.hasCheckmarks,l=t.hasIcons,c=t.contextualMenuItemAs,u=void 0===c?Kc:c,p=t.expandedMenuItemKey,h=t.onItemMouseDown,m=t.onItemClick,g=t.openSubMenu,v=t.dismissSubMenu,b=t.dismissMenu,y=$s(o),C=null!==y,_=ol(o),S=el(o),x=o.itemProps,k=o.ariaLabel,w=o.ariaDescription,I=Tr(o,pr);delete I.disabled;var D=o.role||_;w&&(this._ariaDescriptionId=Ka());var T=Gs(o.ariaDescribedBy,w?this._ariaDescriptionId:void 0,I["aria-describedby"]),E={className:n.root,onClick:this._onItemClick,onKeyDown:S?this._onItemKeyDown:void 0,onMouseEnter:this._onItemMouseEnter,onMouseLeave:this._onItemMouseLeave,onMouseDown:function(e){return h?h(o,e):void 0},onMouseMove:this._onItemMouseMove,href:o.href,title:o.title,"aria-label":k,"aria-describedby":T,"aria-haspopup":S||void 0,"aria-expanded":S?o.key===p:void 0,"aria-posinset":i+1,"aria-setsize":a,"aria-disabled":tl(o),"aria-checked":"menuitemcheckbox"!==D&&"menuitemradio"!==D||!C?void 0:!!y,"aria-selected":"menuitem"===D&&C?!!y:void 0,role:D,style:o.style},P=o.keytipProps;return P&&S&&(P=this._getMemoizedMenuButtonKeytipProps(P)),f.createElement(au,{keytipProps:P,ariaDescribedBy:T,disabled:tl(o)},(function(t){return f.createElement("button",d({ref:e._btn},I,E,t),f.createElement(u,d({componentRef:o.componentRef,item:o,classNames:n,index:r,onCheckmarkClick:s&&m?m:void 0,hasIcons:l,openSubMenu:g,dismissSubMenu:v,dismissMenu:b,getSubmenuTarget:e._getSubmenuTarget},x)),e._renderAriaDescription(w,n.screenReaderText))}))},t}(Gc);function hu(e,t){var o=f.useRef(t);return o.current||(o.current=Ka(e)),o.current}var mu=["setState","render","componentWillMount","UNSAFE_componentWillMount","componentDidMount","componentWillReceiveProps","UNSAFE_componentWillReceiveProps","shouldComponentUpdate","componentWillUpdate","getSnapshotBeforeUpdate","UNSAFE_componentWillUpdate","componentDidUpdate","componentWillUnmount"];function gu(e,t,o){void 0===o&&(o=mu);var n=[],r=function(r){"function"!=typeof t[r]||void 0!==e[r]||o&&-1!==o.indexOf(r)||(n.push(r),e[r]=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];t[r].apply(t,e)})};for(var i in t)r(i);return n}function fu(e,t){t.forEach((function(t){return delete e[t]}))}var vu,bu=function(e){function t(t){var o=e.call(this,t)||this;return o._updateComposedComponentRef=o._updateComposedComponentRef.bind(o),o}return u(t,e),t.prototype._updateComposedComponentRef=function(e){this._composedComponentInstance=e,e?this._hoisted=gu(this,e):this._hoisted&&fu(this,this._hoisted)},t}(f.Component);function yu(e,t){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o]);return t}!function(e){e[e.small=0]="small",e[e.medium=1]="medium",e[e.large=2]="large",e[e.xLarge=3]="xLarge",e[e.xxLarge=4]="xxLarge",e[e.xxxLarge=5]="xxxLarge",e[e.unknown=999]="unknown"}(vu||(vu={}));var Cu,_u,Su=[479,639,1023,1365,1919,99999999];function xu(e){Cu=e}function ku(e){var t=at(e);t&&Du(t)}function wu(){var e;return null!==(e=null!=Cu?Cu:_u)&&void 0!==e?e:vu.large}function Iu(e){var t,o=((t=function(t){function o(e){var o=t.call(this,e)||this;return o._onResize=function(){var e=Du(o.context.window);e!==o.state.responsiveMode&&o.setState({responsiveMode:e})},o._events=new zs(o),o._updateComposedComponentRef=o._updateComposedComponentRef.bind(o),o.state={responsiveMode:wu()},o}return u(o,t),o.prototype.componentDidMount=function(){this._events.on(this.context.window,"resize",this._onResize),this._onResize()},o.prototype.componentWillUnmount=function(){this._events.dispose()},o.prototype.render=function(){var t=this.state.responsiveMode;return t===vu.unknown?null:f.createElement(e,d({ref:this._updateComposedComponentRef,responsiveMode:t},this.props))},o}(bu)).contextType=zl,t);return yu(e,o)}function Du(e){var t=vu.small;if(e){try{for(;e.innerWidth>Su[t];)t++}catch(e){t=wu()}_u=t}else{if(void 0===Cu)throw new Error("Content was rendered in a server environment without providing a default responsive mode. Call setResponsiveMode to define what the responsive mode is.");t=Cu}return t}var Tu=function(e,t){var o=f.useState(wu()),n=o[0],r=o[1],i=f.useCallback((function(){var t=Du(at(e.current));n!==t&&r(t)}),[e,n]);return Ol(Wl(),"resize",i),f.useEffect((function(){void 0===t&&i()}),[t]),null!=t?t:n},Eu=f.createContext({}),Pu=Jn(),Ru=Jn(),Mu={items:[],shouldFocusOnMount:!0,gapSpace:0,directionalHint:Ys.bottomAutoEdge,beakWidth:16};function Nu(e){return e.subMenuProps?e.subMenuProps.items:e.items}function Bu(e){return e.some((function(e){return!!e.canCheck||!(!e.sectionProps||!e.sectionProps.items.some((function(e){return!0===e.canCheck})))}))}var Fu="ContextualMenu",Au=jo((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return wn.apply(void 0,m([t,Vc],e))}}));function Lu(e,t){var o=e.hidden,n=e.items,r=e.theme,i=e.className,a=e.id,s=f.useState(),l=s[0],c=s[1],u=f.useState(),d=u[0],p=u[1],h=f.useState(),m=h[0],g=h[1],v=hu(Fu,a),b=f.useCallback((function(){g(void 0),c(void 0),p(void 0)}),[]),y=f.useCallback((function(e,t,o){var n=e.key;l!==n&&(t.focus(),g(o),c(n),p(t))}),[l]);f.useEffect((function(){o&&b()}),[o,b]);var C=function(e,t){var o=f.useRef(!1);return f.useEffect((function(){return o.current=!0,function(){o.current=!1}}),[]),function(n,r){r?e(n,r):o.current&&t()}}(t,b);return[l,y,function(){var e=Vu(l,n),t=null;return e&&(t={items:Nu(e),target:d,onDismiss:C,isSubMenu:!0,id:v,shouldFocusOnMount:!0,shouldFocusOnContainer:m,directionalHint:jn(r)?Ys.leftTopEdge:Ys.rightTopEdge,className:i,gapSpace:0,isBeakVisible:!1},e.subMenuProps&&Fs(t,e.subMenuProps)),t},C]}var Hu=f.memo(f.forwardRef((function(e,t){var o,n,r=tr(Mu,e),i=(r.ref,p(r,["ref"])),a=f.useRef(null),s=Hl(),l=hu(Fu,i.id);Ri({name:Fu,props:i,deprecations:{getMenuClassNames:"styles"}});var c=function(e,t){var o;return null===(o=i.onDismiss)||void 0===o?void 0:o.call(i,e,t)},u=Yl(i.target,a),h=u[0],m=u[1],g=function(e,t){var o=e.hidden,n=e.onRestoreFocus,r=f.useRef(),i=f.useCallback((function(e){var t,o;n?n(e):(null==e?void 0:e.documentContainsFocus)&&(null===(o=null===(t=r.current)||void 0===t?void 0:t.focus)||void 0===o||o.call(t))}),[n]);return f.useLayoutEffect((function(){var e;o?r.current&&(i({originalElement:r.current,containsFocus:!0,documentContainsFocus:(null===(e=nt())||void 0===e?void 0:e.hasFocus())||!1}),r.current=void 0):r.current=null==t?void 0:t.document.activeElement}),[o,null==t?void 0:t.document.activeElement,i]),[i]}(i,m)[0],v=Lu(i,c),b=v[0],y=v[1],C=v[2],_=v[3],S=function(e){var t=e.delayUpdateFocusOnHover,o=e.hidden,n=f.useRef(!t),r=f.useRef(!1);f.useEffect((function(){n.current=!t,r.current=!o&&!t&&r.current}),[t,o]);var i=f.useCallback((function(){t&&(n.current=!0)}),[t]);return[n,r,i]}(i),x=S[0],k=S[1],w=S[2],I=function(e){var t=f.useRef(!0),o=f.useRef();return[function(){t.current||void 0===o.current?t.current=!1:(e.clearTimeout(o.current),o.current=void 0),o.current=e.setTimeout((function(){t.current=!0}),250)},t]}(s),D=I[0],T=I[1],E=function(e,t){var o=e.subMenuHoverDelay,n=void 0===o?250:o,r=f.useRef(void 0),i=function(){void 0!==r.current&&(t.clearTimeout(r.current),r.current=void 0)};return[i,function(e){r.current=t.setTimeout((function(){e(),i()}),n)},r]}(i,s),P=E[0],R=E[1],M=E[2],N=Tu(a,i.responsiveMode);!function(e,t){var o=e.hidden,n=void 0!==o&&o,r=e.onMenuDismissed,i=e.onMenuOpened,a=Ti(n),s=f.useRef(i),l=f.useRef(r),c=f.useRef(e);s.current=i,l.current=r,c.current=e,f.useEffect((function(){var e,t;n&&!1===a?null===(e=l.current)||void 0===e||e.call(l,c.current):n||!1===a||null===(t=s.current)||void 0===t||t.call(s,c.current)}),[n,a]),f.useEffect((function(){return function(){var e;return null===(e=l.current)||void 0===e?void 0:e.call(l,c.current)}}),[])}(i);var B,F=function(e,t,o,n){var r=e.theme,i=e.isSubMenu,a=e.focusZoneProps,s=void 0===a?{}:a,l=s.checkForNoWrap,c=s.direction,u=void 0===c?$i.vertical:c,d=f.useRef(),p=function(e,o,n){var r=!1;return o(e)&&(t(e,n),e.preventDefault(),e.stopPropagation(),r=!0),r},h=function(e){return e.which===Gn.escape||function(e){var t=jn(r)?Gn.right:Gn.left;return!(e.which!==t||!i||u!==$i.vertical&&(!l||Fa(e.target,"data-no-horizontal-wrap")))}(e)||e.which===Gn.up&&(e.altKey||e.metaKey)},m=function(e){d.current=Ou(e);var t=e.which===Gn.escape&&(Zs()||Js());return p(e,h,t)},g=function(e){var t=d.current&&Ou(e);return d.current=!1,!!t&&!(Js()||Zs())};return[m,function(e){return p(e,g,!0)},function(e){if(!m(e)&&o.current){var t=!(!e.altKey&&!e.metaKey),n=e.which===Gn.up,r=e.which===Gn.down;if(!t&&(n||r)){var i=n?xa(o.current,o.current.lastChild,!0):Sa(o.current,o.current.firstChild,!0);i&&(i.focus(),e.preventDefault(),e.stopPropagation())}}},function(e,t){var o=jn(r)?Gn.left:Gn.right;e.disabled||t.which!==o&&t.which!==Gn.enter&&(t.which!==Gn.down||!t.altKey&&!t.metaKey)||(n(e,t.currentTarget,!1),t.preventDefault())}]}(i,c,a,y),A=F[0],L=F[1],H=F[2],O=F[3],z=function(e,t,o,n,r,i,a,s,l,c,u,d,p){var h=function(){return!t.current||!i.current},m=function(e,t,o){var n=o||t.currentTarget;e.key!==a&&(c(),void 0===a&&n.focus(),el(e)?(t.stopPropagation(),l((function(){n.focus(),u(e,n,!0)}))):l((function(){d(t),n.focus()})))},g=function(e,t,o){var n=Nu(e);c(),el(e)||n&&n.length?e.key!==a&&u(e,o,0!==t.nativeEvent.detail||"mouse"===t.nativeEvent.pointerType):f(e,t),t.stopPropagation(),t.preventDefault()},f=function(t,o){if(!t.disabled&&!t.isDisabled){var n=!1;t.onClick?n=!!t.onClick(o,t):e.onItemClick&&(n=!!e.onItemClick(o,t)),!n&&o.defaultPrevented||p(o,!0)}};return[function(e,t,o){h()||m(e,t,o)},function(e,a,s){var l=a.currentTarget;r.current&&(i.current=!0,t.current&&void 0===o.current&&l!==(null==n?void 0:n.document.activeElement)&&m(e,a,s))},function(e,t){var o;if(!h()&&(c(),void 0===a))if(s.current.setActive)try{s.current.setActive()}catch(e){}else null===(o=s.current)||void 0===o||o.focus()},function(e,t){g(e,t,t.currentTarget)},function(e,t){f(e,t),t.stopPropagation()},f,g]}(i,T,M,m,x,k,b,a,R,P,y,_,c),W=z[0],V=z[1],K=z[2],G=z[3],U=z[4],j=z[5],q=z[6],Y=function(e,t,o){var n=0,r=e.items,i=e.totalItemCount,a=e.hasCheckmarks,s=e.hasIcons;return f.createElement("ul",{className:t.list,onKeyDown:A,onKeyUp:L,role:"presentation"},r.map((function(e,o){var r=Z(e,o,n,i,a,s,t);if(e.itemType!==Us.Divider&&e.itemType!==Us.Header){var l=e.customOnRenderListLength?e.customOnRenderListLength:1;n+=l}return r})))},Z=function(e,t,o,n,r,a,s){var l,c,u=[],d=e.iconProps||{iconName:"None"},p=e.getItemClassNames,h=e.itemProps,m=h?h.styles:void 0,g=e.itemType===Us.Divider?e.className:void 0,v=e.submenuIconProps?e.submenuIconProps.className:"";if(p)c=p(i.theme,tl(e),b===e.key,!!$s(e),!!e.href,"None"!==d.iconName,e.className,g,d.className,v,e.primaryDisabled);else{var y={theme:i.theme,disabled:tl(e),expanded:b===e.key,checked:!!$s(e),isAnchorLink:!!e.href,knownIcon:"None"!==d.iconName,itemClassName:e.className,dividerClassName:g,iconClassName:d.className,subMenuClassName:v,primaryDisabled:e.primaryDisabled};c=Ru(Au(null===(l=s.subComponentStyles)||void 0===l?void 0:l.menuItem,m),y)}switch("-"!==e.text&&"-"!==e.name||(e.itemType=Us.Divider),e.itemType){case Us.Divider:u.push(J(t,c));break;case Us.Header:u.push(J(t,c));var C=ee(e,c,s,t,r,a);u.push(Q(C,e.key||t,c,e.title));break;case Us.Section:u.push(X(e,c,s,t,r,a));break;default:var _=$(e,c,t,o,n,r,a);u.push(Q(_,e.key||t,c,e.title))}return f.createElement(f.Fragment,{key:e.key},u)},X=function(e,t,o,n,r,i){var a=e.sectionProps;if(a){var s,c;if(a.title){var u=void 0,p="";if("string"==typeof a.title){var h=l+a.title.replace(/\s/g,"");u={key:"section-"+a.title+"-title",itemType:Us.Header,text:a.title,id:h},p=h}else{var m=a.title.id||l+a.title.key.replace(/\s/g,"");u=d(d({},a.title),{id:m}),p=m}u&&(c={role:"group","aria-labelledby":p},s=ee(u,t,o,n,r,i))}return a.items&&a.items.length>0?f.createElement("li",{role:"presentation",key:a.key||e.key||"section-"+n},f.createElement("div",d({},c),f.createElement("ul",{className:o.list,role:"presentation"},a.topDivider&&J(n,t,!0,!0),s&&Q(s,e.key||n,t,e.title),a.items.map((function(e,t){return Z(e,t,t,a.items.length,r,i,o)})),a.bottomDivider&&J(n,t,!1,!0)))):void 0}},Q=function(e,t,o,n){return f.createElement("li",{role:"presentation",title:n,key:t,className:o.item},e)},J=function(e,t,o,n){return n||e>0?f.createElement("li",{role:"separator",key:"separator-"+e+(void 0===o?"":o?"-top":"-bottom"),className:t.divider,"aria-hidden":"true"}):null},$=function(e,t,o,n,r,a,s){if(e.onRender)return e.onRender(d({"aria-posinset":n+1,"aria-setsize":r},e),c);var l={item:e,classNames:t,index:o,focusableElementIndex:n,totalItemCount:r,hasCheckmarks:a,hasIcons:s,contextualMenuItemAs:i.contextualMenuItemAs,onItemMouseEnter:W,onItemMouseLeave:K,onItemMouseMove:V,onItemMouseDown:zu,executeItemClick:j,onItemKeyDown:O,expandedMenuItemKey:b,openSubMenu:y,dismissSubMenu:_,dismissMenu:c};return e.href?f.createElement(su,d({},l,{onItemClick:U})):e.split&&el(e)?f.createElement(du,d({},l,{onItemClick:G,onItemClickBase:q,onTap:P})):f.createElement(pu,d({},l,{onItemClick:G,onItemClickBase:q}))},ee=function(e,t,o,n,r,a){var s=i.contextualMenuItemAs,l=void 0===s?Kc:s,c=e.itemProps,u=e.id,p=c&&Tr(c,Dr);return f.createElement("div",d({id:u,className:o.header},p,{style:e.style}),f.createElement(l,d({item:e,classNames:t,index:n,onCheckmarkClick:r?G:void 0,hasIcons:a},c)))},te=i.isBeakVisible,oe=i.items,ne=i.labelElementId,re=i.id,ie=i.className,ae=i.beakWidth,se=i.directionalHint,le=i.directionalHintForRTL,ce=i.alignTargetEdge,ue=i.gapSpace,de=i.coverTarget,pe=i.ariaLabel,he=i.doNotLayer,me=i.target,ge=i.bounds,fe=i.useTargetWidth,ve=i.useTargetAsMinWidth,be=i.directionalHintFixed,ye=i.shouldFocusOnMount,Ce=i.shouldFocusOnContainer,_e=i.title,Se=i.styles,xe=i.theme,ke=i.calloutProps,we=i.onRenderSubMenu,Ie=void 0===we?Wu:we,De=i.onRenderMenuList,Te=void 0===De?function(e,t){return Y(e,Re)}:De,Ee=i.focusZoneProps,Pe=i.getMenuClassNames,Re=Pe?Pe(xe,ie):Pu(Se,{theme:xe,className:ie}),Me=function e(t){for(var o=0,n=t;o<n.length;o++){var r=n[o];if(r.iconProps)return!0;if(r.itemType===Us.Section&&r.sectionProps&&e(r.sectionProps.items))return!0}return!1}(oe),Ne=d(d({},Ee),{className:Re.root,isCircularNavigation:!0,handleTabKey:ra.all,direction:null!==(n=null===(o=i.focusZoneProps)||void 0===o?void 0:o.direction)&&void 0!==n?n:$i.vertical}),Be=Bu(oe),Fe=b&&!0!==i.hidden?C():null;te=void 0===te?N<=vu.medium:te;var Ae=h.current;if((fe||ve)&&Ae&&Ae.offsetWidth){var Le=Ae.getBoundingClientRect().width-2;fe?B={width:Le}:ve&&(B={minWidth:Le})}if(oe&&oe.length>0){for(var He=0,Oe=0,ze=oe;Oe<ze.length;Oe++){var We=ze[Oe];if(We.itemType!==Us.Divider&&We.itemType!==Us.Header){var Ve=We.customOnRenderListLength?We.customOnRenderListLength:1;He+=Ve}}var Ke=Re.subComponentStyles?Re.subComponentStyles.callout:void 0;return f.createElement(Eu.Consumer,null,(function(e){return f.createElement(kc,d({styles:Ke,onRestoreFocus:g},ke,{target:me||e.target,isBeakVisible:te,beakWidth:ae,directionalHint:se,directionalHintForRTL:le,gapSpace:ue,coverTarget:de,doNotLayer:he,className:qr("ms-ContextualMenu-Callout",ke&&ke.className),setInitialFocus:ye,onDismiss:i.onDismiss||e.onDismiss,onScroll:D,bounds:ge,directionalHintFixed:be,alignTargetEdge:ce,hidden:i.hidden||e.hidden,ref:t}),f.createElement("div",{style:B,ref:a,id:re,className:Re.container,tabIndex:Ce?0:-1,onKeyDown:H,onKeyUp:L,onFocusCapture:w,"aria-label":pe,"aria-labelledby":ne,role:"menu"},_e&&f.createElement("div",{className:Re.title}," ",_e," "),oe&&oe.length?function(e,t){var o=i.focusZoneAs,n=void 0===o?bs:o;return f.createElement(n,d({},t),e)}(Te({ariaLabel:pe,items:oe,totalItemCount:He,hasCheckmarks:Be,hasIcons:Me,defaultMenuItemRenderer:function(e){return function(e,t){var o=e.index,n=e.focusableElementIndex,r=e.totalItemCount,i=e.hasCheckmarks,a=e.hasIcons;return Z(e,o,n,r,i,a,t)}(e,Re)},labelElementId:ne},(function(e,t){return Y(e,Re)})),Ne):null,Fe&&Ie(Fe,Wu)))}))}return null})),(function(e,t){return!(t.shouldUpdateWhenHidden||!e.hidden||!t.hidden)||Bs(e,t)}));function Ou(e){return e.which===Gn.alt||"Meta"===e.key}function zu(e,t){var o;null===(o=e.onMouseDown)||void 0===o||o.call(e,e,t)}function Wu(e,t){throw Error("ContextualMenuBase: onRenderSubMenu callback is null or undefined. Please ensure to set `onRenderSubMenu` property either manually or with `styled` helper.")}function Vu(e,t){for(var o=0,n=t;o<n.length;o++){var r=n[o];if(r.itemType===Us.Section&&r.sectionProps){var i=Vu(e,r.sectionProps.items);if(i)return i}else if(r.key&&r.key===e)return r}}Hu.displayName="ContextualMenuBase";var Ku={root:"ms-ContextualMenu",container:"ms-ContextualMenu-container",list:"ms-ContextualMenu-list",header:"ms-ContextualMenu-header",title:"ms-ContextualMenu-title",isopen:"is-open"};function Gu(e){return f.createElement(Uu,d({},e))}var Uu=Vn(Hu,(function(e){var t=e.className,o=e.theme,n=Qo(Ku,o),r=o.fonts,i=o.semanticColors,a=o.effects;return{root:[o.fonts.medium,n.root,n.isopen,{backgroundColor:i.menuBackground,minWidth:"180px"},t],container:[n.container,{selectors:{":focus":{outline:0}}}],list:[n.list,n.isopen,{listStyleType:"none",margin:"0",padding:"0"}],header:[n.header,r.small,{fontWeight:qe.semibold,color:i.menuHeader,background:"none",backgroundColor:"transparent",border:"none",height:Bc,lineHeight:Bc,cursor:"default",padding:"0px 6px",userSelect:"none",textAlign:"left"}],title:[n.title,{fontSize:r.mediumPlus.fontSize,paddingRight:"14px",paddingLeft:"14px",paddingBottom:"5px",paddingTop:"5px",backgroundColor:i.menuItemBackgroundPressed}],subComponentStyles:{callout:{root:{boxShadow:a.elevation8}},menuItem:{}}}}),(function(){return{onRenderSubMenu:Gu}}),{scope:"ContextualMenu"}),ju=Uu;ju.displayName="ContextualMenu";var qu={msButton:"ms-Button",msButtonHasMenu:"ms-Button--hasMenu",msButtonIcon:"ms-Button-icon",msButtonMenuIcon:"ms-Button-menuIcon",msButtonLabel:"ms-Button-label",msButtonDescription:"ms-Button-description",msButtonScreenReaderText:"ms-Button-screenReaderText",msButtonFlexContainer:"ms-Button-flexContainer",msButtonTextContainer:"ms-Button-textContainer"},Yu=jo((function(e,t,o,n,r,i,a,s,l,c,u){var d,p,h=Qo(qu,e||{}),m=c&&!u;return In({root:[h.msButton,t.root,n,l&&["is-checked",t.rootChecked],m&&["is-expanded",t.rootExpanded,{selectors:(d={},d[":hover ."+h.msButtonIcon]=t.iconExpandedHovered,d[":hover ."+h.msButtonMenuIcon]=t.menuIconExpandedHovered||t.rootExpandedHovered,d[":hover"]=t.rootExpandedHovered,d)}],s&&[qu.msButtonHasMenu,t.rootHasMenu],a&&["is-disabled",t.rootDisabled],!a&&!m&&!l&&{selectors:(p={":hover":t.rootHovered},p[":hover ."+h.msButtonLabel]=t.labelHovered,p[":hover ."+h.msButtonIcon]=t.iconHovered,p[":hover ."+h.msButtonDescription]=t.descriptionHovered,p[":hover ."+h.msButtonMenuIcon]=t.menuIconHovered,p[":focus"]=t.rootFocused,p[":active"]=t.rootPressed,p[":active ."+h.msButtonIcon]=t.iconPressed,p[":active ."+h.msButtonDescription]=t.descriptionPressed,p[":active ."+h.msButtonMenuIcon]=t.menuIconPressed,p)},a&&l&&[t.rootCheckedDisabled],!a&&l&&{selectors:{":hover":t.rootCheckedHovered,":active":t.rootCheckedPressed}},o],flexContainer:[h.msButtonFlexContainer,t.flexContainer],textContainer:[h.msButtonTextContainer,t.textContainer],icon:[h.msButtonIcon,r,t.icon,m&&t.iconExpanded,l&&t.iconChecked,a&&t.iconDisabled],label:[h.msButtonLabel,t.label,l&&t.labelChecked,a&&t.labelDisabled],menuIcon:[h.msButtonMenuIcon,i,t.menuIcon,l&&t.menuIconChecked,a&&!u&&t.menuIconDisabled,!a&&!m&&!l&&{selectors:{":hover":t.menuIconHovered,":active":t.menuIconPressed}},m&&["is-expanded",t.menuIconExpanded]],description:[h.msButtonDescription,t.description,l&&t.descriptionChecked,a&&t.descriptionDisabled],screenReaderText:[h.msButtonScreenReaderText,t.screenReaderText]})})),Zu=jo((function(e,t,o,n,r){return{root:Z(e.splitButtonMenuButton,o&&[e.splitButtonMenuButtonExpanded],t&&[e.splitButtonMenuButtonDisabled],n&&!t&&[e.splitButtonMenuButtonChecked],r&&!t&&[{selectors:{":focus":e.splitButtonMenuFocused}}]),splitButtonContainer:Z(e.splitButtonContainer,!t&&n&&[e.splitButtonContainerChecked,{selectors:{":hover":e.splitButtonContainerCheckedHovered}}],!t&&!n&&[{selectors:{":hover":e.splitButtonContainerHovered,":focus":e.splitButtonContainerFocused}}],t&&e.splitButtonContainerDisabled),icon:Z(e.splitButtonMenuIcon,t&&e.splitButtonMenuIconDisabled,!t&&r&&e.splitButtonMenuIcon),flexContainer:Z(e.splitButtonFlexContainer),divider:Z(e.splitButtonDivider,(r||t)&&e.splitButtonDividerDisabled)}})),Xu="BaseButton",Qu=function(e){function t(t){var o=e.call(this,t)||this;return o._buttonElement=f.createRef(),o._splitButtonContainer=f.createRef(),o._mergedRef=ga(),o._renderedVisibleMenu=!1,o._getMemoizedMenuButtonKeytipProps=jo((function(e){return d(d({},e),{hasMenu:!0})})),o._onRenderIcon=function(e,t){var n=o.props.iconProps;if(n&&(void 0!==n.iconName||n.imageProps)){var r=n.className,i=n.imageProps,a=p(n,["className","imageProps"]);if(n.styles)return f.createElement(ii,d({className:qr(o._classNames.icon,r),imageProps:i},a));if(n.iconName)return f.createElement(ti,d({className:qr(o._classNames.icon,r)},a));if(i)return f.createElement(qs,d({className:qr(o._classNames.icon,r),imageProps:i},a))}return null},o._onRenderTextContents=function(){var e=o.props,t=e.text,n=e.children,r=e.secondaryText,i=void 0===r?o.props.description:r,a=e.onRenderText,s=void 0===a?o._onRenderText:a,l=e.onRenderDescription,c=void 0===l?o._onRenderDescription:l;return t||"string"==typeof n||i?f.createElement("span",{className:o._classNames.textContainer},s(o.props,o._onRenderText),c(o.props,o._onRenderDescription)):[s(o.props,o._onRenderText),c(o.props,o._onRenderDescription)]},o._onRenderText=function(){var e=o.props.text,t=o.props.children;return void 0===e&&"string"==typeof t&&(e=t),o._hasText()?f.createElement("span",{key:o._labelId,className:o._classNames.label,id:o._labelId},e):null},o._onRenderChildren=function(){var e=o.props.children;return"string"==typeof e?null:e},o._onRenderDescription=function(e){var t=e.secondaryText,n=void 0===t?o.props.description:t;return n?f.createElement("span",{key:o._descriptionId,className:o._classNames.description,id:o._descriptionId},n):null},o._onRenderAriaDescription=function(){var e=o.props.ariaDescription;return e?f.createElement("span",{className:o._classNames.screenReaderText,id:o._ariaDescriptionId},e):null},o._onRenderMenuIcon=function(e){var t=o.props.menuIconProps;return f.createElement(ti,d({iconName:"ChevronDown"},t,{className:o._classNames.menuIcon}))},o._onRenderMenu=function(e){var t=o.props.persistMenu,n=o.state.menuHidden,r=o.props.menuAs||ju;return e.ariaLabel||e.labelElementId||!o._hasText()||(e=d(d({},e),{labelElementId:o._labelId})),f.createElement(r,d({id:o._labelId+"-menu",directionalHint:Ys.bottomLeftEdge},e,{shouldFocusOnContainer:o._menuShouldFocusOnContainer,shouldFocusOnMount:o._menuShouldFocusOnMount,hidden:t?n:void 0,className:qr("ms-BaseButton-menuhost",e.className),target:o._isSplitButton?o._splitButtonContainer.current:o._buttonElement.current,onDismiss:o._onDismissMenu}))},o._onDismissMenu=function(e){var t=o.props.menuProps;t&&t.onDismiss&&t.onDismiss(e),e&&e.defaultPrevented||o._dismissMenu()},o._dismissMenu=function(){o._menuShouldFocusOnMount=void 0,o._menuShouldFocusOnContainer=void 0,o.setState({menuHidden:!0})},o._openMenu=function(e,t){void 0===t&&(t=!0),o.props.menuProps&&(o._menuShouldFocusOnContainer=e,o._menuShouldFocusOnMount=t,o._renderedVisibleMenu=!0,o.setState({menuHidden:!1}))},o._onToggleMenu=function(e){var t=!0;o.props.menuProps&&!1===o.props.menuProps.shouldFocusOnMount&&(t=!1),o.state.menuHidden?o._openMenu(e,t):o._dismissMenu()},o._onSplitContainerFocusCapture=function(e){var t=o._splitButtonContainer.current;!t||e.target&&rs(e.target,t)||t.focus()},o._onSplitButtonPrimaryClick=function(e){o.state.menuHidden||o._dismissMenu(),!o._processingTouch&&o.props.onClick?o.props.onClick(e):o._processingTouch&&o._onMenuClick(e)},o._onKeyDown=function(e){!o.props.disabled||e.which!==Gn.enter&&e.which!==Gn.space?o.props.disabled||(o.props.menuProps?o._onMenuKeyDown(e):void 0!==o.props.onKeyDown&&o.props.onKeyDown(e)):(e.preventDefault(),e.stopPropagation())},o._onKeyUp=function(e){o.props.disabled||void 0===o.props.onKeyUp||o.props.onKeyUp(e)},o._onKeyPress=function(e){o.props.disabled||void 0===o.props.onKeyPress||o.props.onKeyPress(e)},o._onMouseUp=function(e){o.props.disabled||void 0===o.props.onMouseUp||o.props.onMouseUp(e)},o._onMouseDown=function(e){o.props.disabled||void 0===o.props.onMouseDown||o.props.onMouseDown(e)},o._onClick=function(e){o.props.disabled||(o.props.menuProps?o._onMenuClick(e):void 0!==o.props.onClick&&o.props.onClick(e))},o._onSplitButtonContainerKeyDown=function(e){e.which===Gn.enter||e.which===Gn.space?o._buttonElement.current&&(o._buttonElement.current.click(),e.preventDefault(),e.stopPropagation()):o._onMenuKeyDown(e)},o._onMenuKeyDown=function(e){if(!o.props.disabled){o.props.onKeyDown&&o.props.onKeyDown(e);var t=e.which===Gn.up,n=e.which===Gn.down;if(!e.defaultPrevented&&o._isValidMenuOpenKey(e)){var r=o.props.onMenuClick;r&&r(e,o.props),o._onToggleMenu(!1),e.preventDefault(),e.stopPropagation()}e.which!==Gn.enter&&e.which!==Gn.space||Do(!0,e.target),e.altKey||e.metaKey||!t&&!n||!o.state.menuHidden&&o.props.menuProps&&((void 0!==o._menuShouldFocusOnMount?o._menuShouldFocusOnMount:o.props.menuProps.shouldFocusOnMount)||(e.preventDefault(),e.stopPropagation(),o._menuShouldFocusOnMount=!0,o.forceUpdate()))}},o._onTouchStart=function(){o._isSplitButton&&o._splitButtonContainer.current&&!("onpointerdown"in o._splitButtonContainer.current)&&o._handleTouchAndPointerEvent()},o._onMenuClick=function(e){var t=o.props.onMenuClick;if(t&&t(e,o.props),!e.defaultPrevented){var n=0!==e.nativeEvent.detail||"mouse"===e.nativeEvent.pointerType;o._onToggleMenu(n),e.preventDefault(),e.stopPropagation()}},Gi(o),o._async=new Zi(o),o._events=new zs(o),Si(Xu,t,["menuProps","onClick"],"split",o.props.split),xi(Xu,t,{rootProps:void 0,description:"secondaryText",toggled:"checked"}),o._labelId=Ka(),o._descriptionId=Ka(),o._ariaDescriptionId=Ka(),o.state={menuHidden:!0},o}return u(t,e),Object.defineProperty(t.prototype,"_isSplitButton",{get:function(){return!!this.props.menuProps&&!!this.props.onClick&&!0===this.props.split},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e,t=this.props,o=t.ariaDescription,n=t.ariaLabel,r=t.ariaHidden,i=t.className,a=t.disabled,s=t.allowDisabledFocus,l=t.primaryDisabled,c=t.secondaryText,u=void 0===c?this.props.description:c,d=t.href,p=t.iconProps,h=t.menuIconProps,m=t.styles,g=t.checked,f=t.variantClassName,v=t.theme,b=t.toggle,y=t.getClassNames,C=t.role,_=this.state.menuHidden,S=a||l;this._classNames=y?y(v,i,f,p&&p.className,h&&h.className,S,g,!_,!!this.props.menuProps,this.props.split,!!s):Yu(v,m,i,f,p&&p.className,h&&h.className,S,!!this.props.menuProps,g,!_,this.props.split);var x=this,k=x._ariaDescriptionId,w=x._labelId,I=x._descriptionId,D=!S&&!!d,T=D?"a":"button",E=Tr(Fs(D?{}:{type:"button"},this.props.rootProps,this.props),D?dr:pr,["disabled"]),P=n||E["aria-label"],R=void 0;o?R=k:u&&this.props.onRenderDescription!==Ks?R=I:E["aria-describedby"]&&(R=E["aria-describedby"]);var M=void 0;E["aria-labelledby"]?M=E["aria-labelledby"]:R&&!P&&(M=this._hasText()?w:void 0);var N=!(!1===this.props["data-is-focusable"]||a&&!s||this._isSplitButton),B="menuitemcheckbox"===C||"checkbox"===C,F=B||!0===b?!!g:void 0,A=Fs(E,((e={className:this._classNames.root,ref:this._mergedRef(this.props.elementRef,this._buttonElement),disabled:S&&!s,onKeyDown:this._onKeyDown,onKeyPress:this._onKeyPress,onKeyUp:this._onKeyUp,onMouseDown:this._onMouseDown,onMouseUp:this._onMouseUp,onClick:this._onClick,"aria-label":P,"aria-labelledby":M,"aria-describedby":R,"aria-disabled":S,"data-is-focusable":N})[B?"aria-checked":"aria-pressed"]=F,e));if(r&&(A["aria-hidden"]=!0),this._isSplitButton)return this._onRenderSplitButtonContent(T,A);if(this.props.menuProps){var L=this.props.menuProps.id,H=void 0===L?this._labelId+"-menu":L;Fs(A,{"aria-expanded":!_,"aria-controls":_?null:H,"aria-haspopup":!0})}return this._onRenderContent(T,A)},t.prototype.componentDidMount=function(){this._isSplitButton&&this._splitButtonContainer.current&&("onpointerdown"in this._splitButtonContainer.current&&this._events.on(this._splitButtonContainer.current,"pointerdown",this._onPointerDown,!0),"onpointerup"in this._splitButtonContainer.current&&this.props.onPointerUp&&this._events.on(this._splitButtonContainer.current,"pointerup",this.props.onPointerUp,!0))},t.prototype.componentDidUpdate=function(e,t){this.props.onAfterMenuDismiss&&!t.menuHidden&&this.state.menuHidden&&this.props.onAfterMenuDismiss()},t.prototype.componentWillUnmount=function(){this._async.dispose(),this._events.dispose()},t.prototype.focus=function(){this._isSplitButton&&this._splitButtonContainer.current?(Do(!0),this._splitButtonContainer.current.focus()):this._buttonElement.current&&(Do(!0),this._buttonElement.current.focus())},t.prototype.dismissMenu=function(){this._dismissMenu()},t.prototype.openMenu=function(e,t){this._openMenu(e,t)},t.prototype._onRenderContent=function(e,t){var o=this,n=this.props,r=e,i=n.menuIconProps,a=n.menuProps,s=n.onRenderIcon,l=void 0===s?this._onRenderIcon:s,c=n.onRenderAriaDescription,u=void 0===c?this._onRenderAriaDescription:c,p=n.onRenderChildren,h=void 0===p?this._onRenderChildren:p,m=n.onRenderMenu,g=void 0===m?this._onRenderMenu:m,v=n.onRenderMenuIcon,b=void 0===v?this._onRenderMenuIcon:v,y=n.disabled,C=n.keytipProps;C&&a&&(C=this._getMemoizedMenuButtonKeytipProps(C));var _=function(e){return f.createElement(r,d({},t,e),f.createElement("span",{className:o._classNames.flexContainer,"data-automationid":"splitbuttonprimary"},l(n,o._onRenderIcon),o._onRenderTextContents(),u(n,o._onRenderAriaDescription),h(n,o._onRenderChildren),!o._isSplitButton&&(a||i||o.props.onRenderMenuIcon)&&b(o.props,o._onRenderMenuIcon),a&&!a.doNotLayer&&o._shouldRenderMenu()&&g(a,o._onRenderMenu)))},S=C?f.createElement(au,{keytipProps:this._isSplitButton?void 0:C,ariaDescribedBy:t["aria-describedby"],disabled:y},(function(e){return _(e)})):_();return a&&a.doNotLayer?f.createElement(f.Fragment,null,S,this._shouldRenderMenu()&&g(a,this._onRenderMenu)):f.createElement(f.Fragment,null,S,f.createElement(ws,null))},t.prototype._shouldRenderMenu=function(){var e=this.state.menuHidden,t=this.props,o=t.persistMenu,n=t.renderPersistedMenuHiddenOnMount;return!e||!(!o||!this._renderedVisibleMenu&&!n)},t.prototype._hasText=function(){return null!==this.props.text&&(void 0!==this.props.text||"string"==typeof this.props.children)},t.prototype._onRenderSplitButtonContent=function(e,t){var o=this,n=this.props,r=n.styles,i=void 0===r?{}:r,a=n.disabled,s=n.allowDisabledFocus,l=n.checked,c=n.getSplitButtonClassNames,u=n.primaryDisabled,p=n.menuProps,h=n.toggle,m=n.role,g=n.primaryActionButtonProps,v=this.props.keytipProps,b=this.state.menuHidden,y=c?c(!!a,!b,!!l,!!s):i&&Zu(i,!!a,!b,!!l,!!u);Fs(t,{onClick:void 0,onPointerDown:void 0,onPointerUp:void 0,tabIndex:-1,"data-is-focusable":!1}),v&&p&&(v=this._getMemoizedMenuButtonKeytipProps(v));var C=Tr(t,[],["disabled"]);g&&Fs(t,g);var _=function(n){return f.createElement("div",d({},C,{"data-ktp-target":n?n["data-ktp-target"]:void 0,role:m||"button","aria-disabled":a,"aria-haspopup":!0,"aria-expanded":!b,"aria-pressed":h?!!l:void 0,"aria-describedby":Gs(t["aria-describedby"],n?n["aria-describedby"]:void 0),className:y&&y.splitButtonContainer,onKeyDown:o._onSplitButtonContainerKeyDown,onTouchStart:o._onTouchStart,ref:o._splitButtonContainer,"data-is-focusable":!0,onClick:a||u?void 0:o._onSplitButtonPrimaryClick,tabIndex:!a&&!u||s?0:void 0,"aria-roledescription":t["aria-roledescription"],onFocusCapture:o._onSplitContainerFocusCapture}),f.createElement("span",{style:{display:"flex"}},o._onRenderContent(e,t),o._onRenderSplitButtonMenuButton(y,n),o._onRenderSplitButtonDivider(y)))};return v?f.createElement(au,{keytipProps:v,disabled:a},(function(e){return _(e)})):_()},t.prototype._onRenderSplitButtonDivider=function(e){return e&&e.divider?f.createElement("span",{className:e.divider,"aria-hidden":!0,onClick:function(e){e.stopPropagation()}}):null},t.prototype._onRenderSplitButtonMenuButton=function(e,o){var n=this.props,r=n.allowDisabledFocus,i=n.checked,a=n.disabled,s=n.splitButtonMenuProps,l=n.splitButtonAriaLabel,c=n.primaryDisabled,u=this.state.menuHidden,p=this.props.menuIconProps;void 0===p&&(p={iconName:"ChevronDown"});var h=d(d({},s),{styles:e,checked:i,disabled:a,allowDisabledFocus:r,onClick:this._onMenuClick,menuProps:void 0,iconProps:d(d({},p),{className:this._classNames.menuIcon}),ariaLabel:l,"aria-haspopup":!0,"aria-expanded":!u,"data-is-focusable":!1});return f.createElement(t,d({},h,{"data-ktp-execute-target":o?o["data-ktp-execute-target"]:o,onMouseDown:this._onMouseDown,tabIndex:c&&!r?0:-1}))},t.prototype._onPointerDown=function(e){var t=this.props.onPointerDown;t&&t(e),"touch"===e.pointerType&&(this._handleTouchAndPointerEvent(),e.preventDefault(),e.stopImmediatePropagation())},t.prototype._handleTouchAndPointerEvent=function(){var e=this;void 0!==this._lastTouchTimeoutId&&(this._async.clearTimeout(this._lastTouchTimeoutId),this._lastTouchTimeoutId=void 0),this._processingTouch=!0,this._lastTouchTimeoutId=this._async.setTimeout((function(){e._processingTouch=!1,e._lastTouchTimeoutId=void 0,e.focus()}),500)},t.prototype._isValidMenuOpenKey=function(e){return this.props.menuTriggerKeyCode?e.which===this.props.menuTriggerKeyCode:!!this.props.menuProps&&e.which===Gn.down&&(e.altKey||e.metaKey)},t.defaultProps={baseClassName:"ms-Button",styles:{},split:!1},t}(f.Component);function Ju(e,t,o){return function(n){var r,i=((r=function(r){function i(e){var t=r.call(this,e)||this;return t._styleCache={},t._onSettingChanged=t._onSettingChanged.bind(t),t}return u(i,r),i.prototype.componentDidMount=function(){Dt.observe(this._onSettingChanged)},i.prototype.componentWillUnmount=function(){Dt.unobserve(this._onSettingChanged)},i.prototype.render=function(){var r=this;return f.createElement(On.Consumer,null,(function(i){var a=Dt.getSettings(t,e,i.customizations),s=r.props;if(a.styles&&"function"==typeof a.styles&&(a.styles=a.styles(d(d({},a),s))),o&&a.styles){if(r._styleCache.default!==a.styles||r._styleCache.component!==s.styles){var l=kn(a.styles,s.styles);r._styleCache.default=a.styles,r._styleCache.component=s.styles,r._styleCache.merged=l}return f.createElement(n,d({},a,s,{styles:r._styleCache.merged}))}return f.createElement(n,d({},a,s))}))},i.prototype._onSettingChanged=function(){this.forceUpdate()},i}(f.Component)).displayName="Customized"+e,r);return yu(n,i)}}var $u,ed={outline:0},td=function(e){return{fontSize:e,margin:"0 4px",height:"16px",lineHeight:"16px",textAlign:"center",flexShrink:0}},od=jo((function(e){var t,o,n=e.semanticColors,r=e.effects,i=e.fonts,a=n.buttonBorder,s=n.disabledBackground,l=n.disabledText,c={left:-2,top:-2,bottom:-2,right:-2,outlineColor:"ButtonText"};return{root:[To(e,{inset:1,highContrastStyle:c,borderColor:"transparent"}),e.fonts.medium,{boxSizing:"border-box",border:"1px solid "+a,userSelect:"none",display:"inline-block",textDecoration:"none",textAlign:"center",cursor:"pointer",padding:"0 16px",borderRadius:r.roundedCorner2,selectors:{":active > *":{position:"relative",left:0,top:0}}}],rootDisabled:[To(e,{inset:1,highContrastStyle:c,borderColor:"transparent"}),{backgroundColor:s,borderColor:s,color:l,cursor:"default",selectors:{":hover":ed,":focus":ed}}],iconDisabled:{color:l,selectors:(t={},t[ro]={color:"GrayText"},t)},menuIconDisabled:{color:l,selectors:(o={},o[ro]={color:"GrayText"},o)},flexContainer:{display:"flex",height:"100%",flexWrap:"nowrap",justifyContent:"center",alignItems:"center"},description:{display:"block"},textContainer:{flexGrow:1,display:"block"},icon:td(i.mediumPlus.fontSize),menuIcon:td(i.small.fontSize),label:{margin:"0 4px",lineHeight:"100%",display:"block"},screenReaderText:Mo}})),nd=jo((function(e,t){var o,n,r,i,a,s,l,c,u,p,h,m,g,f=e.effects,v=e.palette,b=e.semanticColors,y={left:-2,top:-2,bottom:-2,right:-2,border:"none"},C={position:"absolute",width:1,right:31,top:8,bottom:8};return kn({splitButtonContainer:[To(e,{highContrastStyle:y,inset:2}),{display:"inline-flex",selectors:{".ms-Button--default":{borderTopRightRadius:"0",borderBottomRightRadius:"0",borderRight:"none"},".ms-Button--primary":{borderTopRightRadius:"0",borderBottomRightRadius:"0",border:"none",selectors:(o={},o[ro]=d({color:"WindowText",backgroundColor:"Window",border:"1px solid WindowText",borderRightWidth:"0"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),o)},".ms-Button--primary + .ms-Button":{border:"none",selectors:(n={},n[ro]={border:"1px solid WindowText",borderLeftWidth:"0"},n)}}}],splitButtonContainerHovered:{selectors:{".ms-Button--primary":{selectors:(r={},r[ro]={color:"Window",backgroundColor:"Highlight"},r)},".ms-Button.is-disabled":{color:b.buttonTextDisabled,selectors:(i={},i[ro]={color:"GrayText",borderColor:"GrayText",backgroundColor:"Window"},i)}}},splitButtonContainerChecked:{selectors:{".ms-Button--primary":{selectors:(a={},a[ro]=d({color:"Window",backgroundColor:"WindowText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),a)}}},splitButtonContainerCheckedHovered:{selectors:{".ms-Button--primary":{selectors:(s={},s[ro]=d({color:"Window",backgroundColor:"WindowText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),s)}}},splitButtonContainerFocused:{outline:"none!important"},splitButtonMenuButton:(l={padding:6,height:"auto",boxSizing:"border-box",borderRadius:0,borderTopRightRadius:f.roundedCorner2,borderBottomRightRadius:f.roundedCorner2,border:"1px solid "+v.neutralSecondaryAlt,borderLeft:"none",outline:"transparent",userSelect:"none",display:"inline-block",textDecoration:"none",textAlign:"center",cursor:"pointer",verticalAlign:"top",width:32,marginLeft:-1,marginTop:0,marginRight:0,marginBottom:0},l[ro]={".ms-Button-menuIcon":{color:"WindowText"}},l),splitButtonDivider:d(d({},C),{selectors:(c={},c[ro]={backgroundColor:"WindowText"},c)}),splitButtonDividerDisabled:d(d({},C),{selectors:(u={},u[ro]={backgroundColor:"GrayText"},u)}),splitButtonMenuButtonDisabled:{pointerEvents:"none",border:"none",selectors:(p={":hover":{cursor:"default"},".ms-Button--primary":{selectors:(h={},h[ro]={color:"GrayText",borderColor:"GrayText",backgroundColor:"Window"},h)},".ms-Button-menuIcon":{selectors:(m={},m[ro]={color:"GrayText"},m)}},p[ro]={color:"GrayText",border:"1px solid GrayText",backgroundColor:"Window"},p)},splitButtonFlexContainer:{display:"flex",height:"100%",flexWrap:"nowrap",justifyContent:"center",alignItems:"center"},splitButtonContainerDisabled:{outline:"none",border:"none",selectors:(g={},g[ro]=d({color:"GrayText",borderColor:"GrayText",backgroundColor:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),g)},splitButtonMenuFocused:d({},To(e,{highContrastStyle:y,inset:2}))},t)})),rd=jo((function(e,t){var o,n=od(e),r=nd(e),i=e.palette;return kn(n,{root:{padding:"0 4px",width:"32px",height:"32px",backgroundColor:"transparent",border:"none",color:e.semanticColors.link},rootHovered:{color:i.themeDarkAlt,backgroundColor:i.neutralLighter,selectors:(o={},o[ro]={borderColor:"Highlight",color:"Highlight"},o)},rootHasMenu:{width:"auto"},rootPressed:{color:i.themeDark,backgroundColor:i.neutralLight},rootExpanded:{color:i.themeDark,backgroundColor:i.neutralLight},rootChecked:{color:i.themeDark,backgroundColor:i.neutralLight},rootCheckedHovered:{color:i.themeDark,backgroundColor:i.neutralQuaternaryAlt},rootDisabled:{color:i.neutralTertiaryAlt}},r,t)})),id=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.styles,o=e.theme;return f.createElement(Qu,d({},this.props,{variantClassName:"ms-Button--icon",styles:rd(o,t),onRenderText:Ks,onRenderDescription:Ks}))},h([Ju("IconButton",["theme","styles"],!0)],t)}(f.Component);!function(e){e[e.horizontal=0]="horizontal",e[e.vertical=1]="vertical"}($u||($u={}));var ad=function(){var e={};return{getCachedMeasurement:function(t){if(t&&t.cacheKey&&e.hasOwnProperty(t.cacheKey))return e[t.cacheKey]},addMeasurementToCache:function(t,o){t.cacheKey&&(e[t.cacheKey]=o)}}},sd=function(e){void 0===e&&(e=ad());var t,o=e;function n(e,t){var n=o.getCachedMeasurement(e);if(void 0!==n)return n;var r=t();return o.addMeasurementToCache(e,r),r}function r(e,r,i){for(var a=e,s=n(e,i);s>t;){var l=r(a);if(void 0===l)return{renderedData:a,resizeDirection:void 0,dataToMeasure:void 0};if(void 0===(s=o.getCachedMeasurement(l)))return{dataToMeasure:l,resizeDirection:"shrink"};a=l}return{renderedData:a,resizeDirection:void 0,dataToMeasure:void 0}}return{getNextState:function(e,i,a,s){if(void 0!==s||void 0!==i.dataToMeasure){if(s){if(t&&i.renderedData&&!i.dataToMeasure)return d(d({},i),function(e,o,n,r){var i;return i=e>t?r?{resizeDirection:"grow",dataToMeasure:r(n)}:{resizeDirection:"shrink",dataToMeasure:o}:{resizeDirection:"shrink",dataToMeasure:n},t=e,d(d({},i),{measureContainer:!1})}(s,e.data,i.renderedData,e.onGrowData));t=s}var l=d(d({},i),{measureContainer:!1});return i.dataToMeasure&&(l="grow"===i.resizeDirection&&e.onGrowData?d(d({},l),function(e,i,a,s){for(var l=e,c=n(e,a);c<t;){var u=i(l);if(void 0===u)return{renderedData:l,resizeDirection:void 0,dataToMeasure:void 0};if(void 0===(c=o.getCachedMeasurement(u)))return{dataToMeasure:u};l=u}return d({resizeDirection:"shrink"},r(l,s,a))}(i.dataToMeasure,e.onGrowData,a,e.onReduceData)):d(d({},l),r(i.dataToMeasure,e.onReduceData,a))),l}},shouldRenderDataForMeasurement:function(e){return!(!e||void 0!==o.getCachedMeasurement(e))},getInitialResizeGroupState:function(e){return{dataToMeasure:d({},e),resizeDirection:"grow",measureContainer:!0}}}},ld=f.createContext({isMeasured:!1}),cd={position:"fixed",visibility:"hidden"},ud={position:"relative"};function dd(e,t){var o;switch(t.type){case"resizeData":return d({},t.value);case"dataToMeasure":return d(d({},e),{dataToMeasure:t.value,resizeDirection:"grow",measureContainer:!0});default:return d(d({},e),((o={})[t.type]=t.value,o))}}var pd={isMeasured:!0},hd=f.forwardRef((function(e,t){var o=f.useRef(null),n=Or(o,t),r=function(e,t){var o=Ei(sd),n=f.useRef(null),r=f.useRef(null),i=f.useRef(!1),a=Hl(),s=function(e,t,o){var n=Ei((function(){return t.getInitialResizeGroupState(e.data)})),r=f.useReducer(dd,n),i=r[0],a=r[1];f.useEffect((function(){a({type:"dataToMeasure",value:e.data})}),[e.data]);var s=f.useRef(n);return s.current=d({},i),[s,f.useCallback((function(e){e&&a({type:"resizeData",value:e})}),[]),f.useCallback((function(){o.current&&a({type:"measureContainer",value:!0})}),[o])]}(e,o,t),l=s[0],c=s[1],u=s[2];f.useEffect((function(){var t;l.current.renderedData&&(i.current=!0,null===(t=e.dataDidRender)||void 0===t||t.call(e,l.current.renderedData))})),f.useEffect((function(){a.requestAnimationFrame((function(){var a=void 0;if(l.current.measureContainer&&t.current){var s=t.current.getBoundingClientRect();a=e.direction===$u.vertical?s.height:s.width}var u=o.getNextState(e,l.current,(function(){var t=i.current?r:n;return t.current?e.direction===$u.vertical?t.current.scrollHeight:t.current.scrollWidth:0}),a);c(u)}),t.current)})),Ol(Wl(),"resize",a.debounce(u,16,{leading:!0}));var p=o.shouldRenderDataForMeasurement(l.current.dataToMeasure),h=!i.current&&p;return[l.current.dataToMeasure,l.current.renderedData,u,n,r,p,h]}(e,o),i=r[0],a=r[1],s=r[2],l=r[3],c=r[4],u=r[5],p=r[6];f.useImperativeHandle(e.componentRef,(function(){return{remeasure:s}}),[s]),function(e){Ri({name:"ResizeGroup",props:e,deprecations:{styles:"className"}})}(e);var h=e.className,m=e.onRenderData,g=Tr(e,Dr,["data"]);return f.createElement("div",d({},g,{className:h,ref:n}),f.createElement("div",{style:ud},u&&!p&&f.createElement("div",{style:cd,ref:c},f.createElement(ld.Provider,{value:pd},m(i))),f.createElement("div",{ref:l,style:p?cd:void 0,"data-automation-id":"visibleContent"},p?m(i):a&&m(a))))}));hd.displayName="ResizeGroupBase";var md,gd=hd;function fd(e){return e.clientWidth<e.scrollWidth}function vd(e){return e.clientHeight<e.scrollHeight}function bd(e){return fd(e)||vd(e)}!function(e){e[e.Parent=0]="Parent",e[e.Self=1]="Self"}(md||(md={}));var yd,Cd=Jn(),_d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._onRenderContent=function(e){return"string"==typeof e.content?f.createElement("p",{className:t._classNames.subText},e.content):f.createElement("div",{className:t._classNames.subText},e.content)},t}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.className,o=e.calloutProps,n=e.directionalHint,r=e.directionalHintForRTL,i=e.styles,a=e.id,s=e.maxWidth,l=e.onRenderContent,c=void 0===l?this._onRenderContent:l,u=e.targetElement,p=e.theme;return this._classNames=Cd(i,{theme:p,className:t||o&&o.className,beakWidth:o&&o.beakWidth,gapSpace:o&&o.gapSpace,maxWidth:s}),f.createElement(kc,d({target:u,directionalHint:n,directionalHintForRTL:r},o,Tr(this.props,Dr,["id"]),{className:this._classNames.root}),f.createElement("div",{className:this._classNames.content,id:a,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave},c(this.props,this._onRenderContent)))},t.defaultProps={directionalHint:Ys.topCenter,maxWidth:"364px",calloutProps:{isBeakVisible:!0,beakWidth:16,gapSpace:0,setInitialFocus:!0,doNotLayer:!1}},t}(f.Component),Sd=Vn(_d,(function(e){var t=e.className,o=e.beakWidth,n=void 0===o?16:o,r=e.gapSpace,i=void 0===r?0:r,a=e.maxWidth,s=e.theme,l=s.semanticColors,c=s.fonts,u=s.effects,d=-(Math.sqrt(n*n/2)+i)+1/window.devicePixelRatio;return{root:["ms-Tooltip",s.fonts.medium,Ze.fadeIn200,{background:l.menuBackground,boxShadow:u.elevation8,padding:"8px",maxWidth:a,selectors:{":after":{content:"''",position:"absolute",bottom:d,left:d,right:d,top:d,zIndex:0}}},t],content:["ms-Tooltip-content",c.small,{position:"relative",zIndex:1,color:l.menuItemText,wordWrap:"break-word",overflowWrap:"break-word",overflow:"hidden"}],subText:["ms-Tooltip-subtext",{fontSize:"inherit",fontWeight:"inherit",color:"inherit",margin:0}]}}),void 0,{scope:"Tooltip"});!function(e){e[e.zero=0]="zero",e[e.medium=1]="medium",e[e.long=2]="long"}(yd||(yd={}));var xd,kd,wd=Jn(),Id=function(e){function t(o){var n=e.call(this,o)||this;return n._tooltipHost=f.createRef(),n._defaultTooltipId=Ka("tooltip"),n.show=function(){n._toggleTooltip(!0)},n.dismiss=function(){n._hideTooltip()},n._getTargetElement=function(){if(n._tooltipHost.current){var e=n.props.overflowMode;if(void 0!==e)switch(e){case md.Parent:return n._tooltipHost.current.parentElement;case md.Self:return n._tooltipHost.current}return n._tooltipHost.current}},n._onTooltipFocus=function(e){n._ignoreNextFocusEvent?n._ignoreNextFocusEvent=!1:n._onTooltipMouseEnter(e)},n._onTooltipBlur=function(e){n._ignoreNextFocusEvent=(null===document||void 0===document?void 0:document.activeElement)===e.target,n._hideTooltip()},n._onTooltipMouseEnter=function(e){var o=n.props,r=o.overflowMode,i=o.delay;if(t._currentVisibleTooltip&&t._currentVisibleTooltip!==n&&t._currentVisibleTooltip.dismiss(),t._currentVisibleTooltip=n,void 0!==r){var a=n._getTargetElement();if(a&&!bd(a))return}if(!e.target||!rs(e.target,n._getTargetElement()))if(n._clearDismissTimer(),n._clearOpenTimer(),i!==yd.zero){n.setState({isAriaPlaceholderRendered:!0});var s=n._getDelayTime(i);n._openTimerId=n._async.setTimeout((function(){n._toggleTooltip(!0)}),s)}else n._toggleTooltip(!0)},n._onTooltipMouseLeave=function(e){var o=n.props.closeDelay;n._clearDismissTimer(),n._clearOpenTimer(),o?n._dismissTimerId=n._async.setTimeout((function(){n._toggleTooltip(!1)}),o):n._toggleTooltip(!1),t._currentVisibleTooltip===n&&(t._currentVisibleTooltip=void 0)},n._onTooltipKeyDown=function(e){(e.which===Gn.escape||e.ctrlKey)&&n.state.isTooltipVisible&&(n._hideTooltip(),e.stopPropagation())},n._clearDismissTimer=function(){n._async.clearTimeout(n._dismissTimerId)},n._clearOpenTimer=function(){n._async.clearTimeout(n._openTimerId)},n._hideTooltip=function(){n._clearOpenTimer(),n._clearDismissTimer(),n._toggleTooltip(!1)},n._toggleTooltip=function(e){n.state.isTooltipVisible!==e&&n.setState({isAriaPlaceholderRendered:!1,isTooltipVisible:e},(function(){return n.props.onTooltipToggle&&n.props.onTooltipToggle(e)}))},n._getDelayTime=function(e){switch(e){case yd.medium:return 300;case yd.long:return 500;default:return 0}},Gi(n),n.state={isAriaPlaceholderRendered:!1,isTooltipVisible:!1},n._async=new Zi(n),n}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.calloutProps,o=e.children,n=e.content,r=e.directionalHint,i=e.directionalHintForRTL,a=e.hostClassName,s=e.id,l=e.setAriaDescribedBy,c=void 0===l||l,u=e.tooltipProps,p=e.styles,h=e.theme;this._classNames=wd(p,{theme:h,className:a});var m=this.state,g=m.isAriaPlaceholderRendered,v=m.isTooltipVisible,b=s||this._defaultTooltipId,y=!!(n||u&&u.onRenderContent&&u.onRenderContent()),C=v&&y,_=c&&v&&y?b:void 0;return f.createElement("div",d({className:this._classNames.root,ref:this._tooltipHost},{onFocusCapture:this._onTooltipFocus},{onBlurCapture:this._onTooltipBlur},{onMouseEnter:this._onTooltipMouseEnter,onMouseLeave:this._onTooltipMouseLeave,onKeyDown:this._onTooltipKeyDown,role:"none","aria-describedby":_}),o,C&&f.createElement(Sd,d({id:b,content:n,targetElement:this._getTargetElement(),directionalHint:r,directionalHintForRTL:i,calloutProps:Fs({},t,{onDismiss:this._hideTooltip,onMouseEnter:this._onTooltipMouseEnter,onMouseLeave:this._onTooltipMouseLeave}),onMouseEnter:this._onTooltipMouseEnter,onMouseLeave:this._onTooltipMouseLeave},Tr(this.props,Dr),u)),g&&f.createElement("div",{id:b,role:"none",style:Mo},n))},t.prototype.componentWillUnmount=function(){t._currentVisibleTooltip&&t._currentVisibleTooltip===this&&(t._currentVisibleTooltip=void 0),this._async.dispose()},t.defaultProps={delay:yd.medium},t}(f.Component),Dd={root:"ms-TooltipHost",ariaPlaceholder:"ms-TooltipHost-aria-placeholder"},Td=Vn(Id,(function(e){var t=e.className,o=e.theme;return{root:[Qo(Dd,o).root,{display:"inline"},t]}}),void 0,{scope:"TooltipHost"}),Ed=Jn(),Pd=function(){return null},Rd={styles:function(e){return{root:{selectors:{"&.is-disabled":{color:e.theme.semanticColors.bodyText}}}}}},Md=function(e){function t(t){var o=e.call(this,t)||this;return o._focusZone=f.createRef(),o._onReduceData=function(e){var t=e.renderedItems,o=e.renderedOverflowItems,n=e.props.overflowIndex,r=t[n];if(r)return(t=m(t)).splice(n,1),o=m(o,[r]),d(d({},e),{renderedItems:t,renderedOverflowItems:o})},o._onGrowData=function(e){var t=e.renderedItems,o=e.renderedOverflowItems,n=e.props,r=n.overflowIndex,i=n.maxDisplayedItems,a=(o=m(o)).pop();if(a&&!(t.length>=i))return(t=m(t)).splice(r,0,a),d(d({},e),{renderedItems:t,renderedOverflowItems:o})},o._onRenderBreadcrumb=function(e){var t=e.props,n=t.ariaLabel,r=t.dividerAs,i=void 0===r?ii:r,a=t.onRenderItem,s=void 0===a?o._onRenderItem:a,l=t.overflowAriaLabel,c=t.overflowIndex,u=t.onRenderOverflowIcon,p=t.overflowButtonAs,h=e.renderedOverflowItems,m=e.renderedItems,g=h.map((function(e){var t=!(!e.onClick&&!e.href);return{text:e.text,name:e.text,key:e.key,onClick:e.onClick?o._onBreadcrumbClicked.bind(o,e):null,href:e.href,disabled:!t,itemProps:t?void 0:Rd}})),v=m.length-1,b=h&&0!==h.length,y=m.map((function(e,t){return f.createElement("li",{className:o._classNames.listItem,key:e.key||String(t)},s(e,o._onRenderItem),(t!==v||b&&t===c-1)&&f.createElement(i,{className:o._classNames.chevron,iconName:jn(o.props.theme)?"ChevronLeft":"ChevronRight",item:e}))}));if(b){var C=u?{}:{iconName:"More"},_=u||Pd,S=p||id;y.splice(c,0,f.createElement("li",{className:o._classNames.overflow,key:"overflow"},f.createElement(S,{className:o._classNames.overflowButton,iconProps:C,role:"button","aria-haspopup":"true",ariaLabel:l,onRenderMenuIcon:_,menuProps:{items:g,directionalHint:Ys.bottomLeftEdge}}),c!==v+1&&f.createElement(i,{className:o._classNames.chevron,iconName:jn(o.props.theme)?"ChevronLeft":"ChevronRight",item:h[h.length-1]})))}var x=Tr(o.props,ir,["className"]);return f.createElement("div",d({className:o._classNames.root,role:"navigation","aria-label":n},x),f.createElement(bs,d({componentRef:o._focusZone,direction:$i.horizontal},o.props.focusZoneProps),f.createElement("ol",{className:o._classNames.list},y)))},o._onRenderItem=function(e){var t=e.as,n=e.href,r=e.onClick,i=e.isCurrentItem,a=e.text,s=p(e,["as","href","onClick","isCurrentItem","text"]);if(r||n)return f.createElement(Ns,d({},s,{as:t,className:o._classNames.itemLink,href:n,"aria-current":i?"page":void 0,onClick:o._onBreadcrumbClicked.bind(o,e)}),f.createElement(Td,d({content:a,overflowMode:md.Parent},o.props.tooltipHostProps),a));var l=t||"span";return f.createElement(l,d({},s,{className:o._classNames.item}),f.createElement(Td,d({content:a,overflowMode:md.Parent},o.props.tooltipHostProps),a))},o._onBreadcrumbClicked=function(e,t){e.onClick&&e.onClick(t,e)},Gi(o),o._validateProps(t),o}return u(t,e),t.prototype.focus=function(){this._focusZone.current&&this._focusZone.current.focus()},t.prototype.render=function(){this._validateProps(this.props);var e=this.props,t=e.onReduceData,o=void 0===t?this._onReduceData:t,n=e.onGrowData,r=void 0===n?this._onGrowData:n,i=e.overflowIndex,a=e.maxDisplayedItems,s=e.items,l=e.className,c=e.theme,u=e.styles,d=m(s),p=d.splice(i,d.length-a),h={props:this.props,renderedItems:d,renderedOverflowItems:p};return this._classNames=Ed(u,{className:l,theme:c}),f.createElement(gd,{onRenderData:this._onRenderBreadcrumb,onReduceData:o,onGrowData:r,data:h})},t.prototype._validateProps=function(e){var t=e.maxDisplayedItems,o=e.overflowIndex,n=e.items;if(o<0||t>1&&o>t-1||n.length>0&&o>n.length-1)throw new Error("Breadcrumb: overflowIndex out of range")},t.defaultProps={items:[],maxDisplayedItems:999,overflowIndex:0},t}(f.Component),Nd={root:"ms-Breadcrumb",list:"ms-Breadcrumb-list",listItem:"ms-Breadcrumb-listItem",chevron:"ms-Breadcrumb-chevron",overflow:"ms-Breadcrumb-overflow",overflowButton:"ms-Breadcrumb-overflowButton",itemLink:"ms-Breadcrumb-itemLink",item:"ms-Breadcrumb-item"},Bd={whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},Fd=_o(0,go),Ad=_o(co,fo),Ld=Vn(Md,(function(e){var t,o,n,r,i,a=e.className,s=e.theme,l=s.palette,c=s.semanticColors,u=s.fonts,p=Qo(Nd,s),h=c.menuItemBackgroundHovered,m=c.menuItemBackgroundPressed,g=l.neutralSecondary,f=qe.regular,v=l.neutralPrimary,b=l.neutralPrimary,y=qe.semibold,C=l.neutralSecondary,_=l.neutralSecondary,S={fontWeight:y,color:b},x={":hover":{color:v,backgroundColor:h,cursor:"pointer",selectors:(t={},t[ro]={color:"Highlight",backgroundColor:"transparent"},t)},":active":{backgroundColor:m,color:v},"&:active:hover":{color:v,backgroundColor:m},"&:active, &:hover, &:active:hover":{textDecoration:"none"}},k={color:g,padding:"0 8px",lineHeight:36,fontSize:18,fontWeight:f};return{root:[p.root,u.medium,{margin:"11px 0 1px"},a],list:[p.list,{whiteSpace:"nowrap",padding:0,margin:0,display:"flex",alignItems:"stretch"}],listItem:[p.listItem,{listStyleType:"none",margin:"0",padding:"0",display:"flex",position:"relative",alignItems:"center",selectors:{"&:last-child .ms-Breadcrumb-itemLink":d(d({},S),(o={},o[ro]={MsHighContrastAdjust:"auto",forcedColorAdjust:"auto"},o)),"&:last-child .ms-Breadcrumb-item":S}}],chevron:[p.chevron,{color:C,fontSize:u.small.fontSize,selectors:(n={},n[ro]=d({color:"WindowText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),n[Ad]={fontSize:8},n[Fd]={fontSize:8},n)}],overflow:[p.overflow,{position:"relative",display:"flex",alignItems:"center"}],overflowButton:[p.overflowButton,To(s),Bd,{fontSize:16,color:_,height:"100%",cursor:"pointer",selectors:d(d({},x),(r={},r[Fd]={padding:"4px 6px"},r[Ad]={fontSize:u.mediumPlus.fontSize},r))}],itemLink:[p.itemLink,To(s),Bd,d(d({},k),{selectors:d((i={":focus":{color:l.neutralDark}},i["."+wo+" &:focus"]={outline:"none"},i),x)})],item:[p.item,d(d({},k),{selectors:{":hover":{cursor:"default"}}})]}}),void 0,{scope:"Breadcrumb"});function Hd(e){var t,o,n,r,i,a=e.semanticColors,s=e.palette,l=a.buttonBackground,c=a.buttonBackgroundPressed,u=a.buttonBackgroundHovered,p=a.buttonBackgroundDisabled,h=a.buttonText,m=a.buttonTextHovered,g=a.buttonTextDisabled,f=a.buttonTextChecked,v=a.buttonTextCheckedHovered;return{root:{backgroundColor:l,color:h},rootHovered:{backgroundColor:u,color:m,selectors:(t={},t[ro]={borderColor:"Highlight",color:"Highlight"},t)},rootPressed:{backgroundColor:c,color:f},rootExpanded:{backgroundColor:c,color:f},rootChecked:{backgroundColor:c,color:f},rootCheckedHovered:{backgroundColor:c,color:v},rootDisabled:{color:g,backgroundColor:p,selectors:(o={},o[ro]={color:"GrayText",borderColor:"GrayText",backgroundColor:"Window"},o)},splitButtonContainer:{selectors:(n={},n[ro]={border:"none"},n)},splitButtonMenuButton:{color:s.white,backgroundColor:"transparent",selectors:{":hover":{backgroundColor:s.neutralLight,selectors:(r={},r[ro]={color:"Highlight"},r)}}},splitButtonMenuButtonDisabled:{backgroundColor:a.buttonBackgroundDisabled,selectors:{":hover":{backgroundColor:a.buttonBackgroundDisabled}}},splitButtonDivider:d(d({},{position:"absolute",width:1,right:31,top:8,bottom:8}),{backgroundColor:s.neutralTertiaryAlt,selectors:(i={},i[ro]={backgroundColor:"WindowText"},i)}),splitButtonDividerDisabled:{backgroundColor:e.palette.neutralTertiaryAlt},splitButtonMenuButtonChecked:{backgroundColor:s.neutralQuaternaryAlt,selectors:{":hover":{backgroundColor:s.neutralQuaternaryAlt}}},splitButtonMenuButtonExpanded:{backgroundColor:s.neutralQuaternaryAlt,selectors:{":hover":{backgroundColor:s.neutralQuaternaryAlt}}},splitButtonMenuIcon:{color:a.buttonText},splitButtonMenuIconDisabled:{color:a.buttonTextDisabled}}}function Od(e){var t,o,n,r,i,a,s,l,c,u=e.palette,p=e.semanticColors;return{root:{backgroundColor:p.primaryButtonBackground,border:"1px solid "+p.primaryButtonBackground,color:p.primaryButtonText,selectors:(t={},t[ro]=d({color:"Window",backgroundColor:"WindowText",borderColor:"WindowText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),t["."+wo+" &:focus"]={selectors:{":after":{border:"none",outlineColor:u.white}}},t)},rootHovered:{backgroundColor:p.primaryButtonBackgroundHovered,border:"1px solid "+p.primaryButtonBackgroundHovered,color:p.primaryButtonTextHovered,selectors:(o={},o[ro]={color:"Window",backgroundColor:"Highlight",borderColor:"Highlight"},o)},rootPressed:{backgroundColor:p.primaryButtonBackgroundPressed,border:"1px solid "+p.primaryButtonBackgroundPressed,color:p.primaryButtonTextPressed,selectors:(n={},n[ro]=d({color:"Window",backgroundColor:"WindowText",borderColor:"WindowText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),n)},rootExpanded:{backgroundColor:p.primaryButtonBackgroundPressed,color:p.primaryButtonTextPressed},rootChecked:{backgroundColor:p.primaryButtonBackgroundPressed,color:p.primaryButtonTextPressed},rootCheckedHovered:{backgroundColor:p.primaryButtonBackgroundPressed,color:p.primaryButtonTextPressed},rootDisabled:{color:p.primaryButtonTextDisabled,backgroundColor:p.primaryButtonBackgroundDisabled,selectors:(r={},r[ro]={color:"GrayText",borderColor:"GrayText",backgroundColor:"Window"},r)},splitButtonContainer:{selectors:(i={},i[ro]={border:"none"},i)},splitButtonDivider:d(d({},{position:"absolute",width:1,right:31,top:8,bottom:8}),{backgroundColor:u.white,selectors:(a={},a[ro]={backgroundColor:"Window"},a)}),splitButtonMenuButton:{backgroundColor:p.primaryButtonBackground,color:p.primaryButtonText,selectors:(s={},s[ro]={backgroundColor:"WindowText"},s[":hover"]={backgroundColor:p.primaryButtonBackgroundHovered,selectors:(l={},l[ro]={color:"Highlight"},l)},s)},splitButtonMenuButtonDisabled:{backgroundColor:p.primaryButtonBackgroundDisabled,selectors:{":hover":{backgroundColor:p.primaryButtonBackgroundDisabled}}},splitButtonMenuButtonChecked:{backgroundColor:p.primaryButtonBackgroundPressed,selectors:{":hover":{backgroundColor:p.primaryButtonBackgroundPressed}}},splitButtonMenuButtonExpanded:{backgroundColor:p.primaryButtonBackgroundPressed,selectors:{":hover":{backgroundColor:p.primaryButtonBackgroundPressed}}},splitButtonMenuIcon:{color:p.primaryButtonText},splitButtonMenuIconDisabled:{color:u.neutralTertiary,selectors:(c={},c[ro]={color:"GrayText"},c)}}}!function(e){e[e.button=0]="button",e[e.anchor=1]="anchor"}(xd||(xd={})),function(e){e[e.normal=0]="normal",e[e.primary=1]="primary",e[e.hero=2]="hero",e[e.compound=3]="compound",e[e.command=4]="command",e[e.icon=5]="icon",e[e.default=6]="default"}(kd||(kd={}));var zd=jo((function(e,t,o){var n=od(e),r=nd(e);return kn(n,{root:{minWidth:"80px",height:"32px"},label:{fontWeight:qe.semibold}},o?Od(e):Hd(e),r,t)})),Wd=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.primary,o=void 0!==t&&t,n=e.styles,r=e.theme;return f.createElement(Qu,d({},this.props,{variantClassName:o?"ms-Button--primary":"ms-Button--default",styles:zd(r,n,o),onRenderDescription:Ks}))},h([Ju("DefaultButton",["theme","styles"],!0)],t)}(f.Component),Vd=jo((function(e,t){var o,n,r;return kn(od(e),{root:{padding:"0 4px",height:"40px",color:e.palette.neutralPrimary,backgroundColor:"transparent",border:"1px solid transparent",selectors:(o={},o[ro]={borderColor:"Window"},o)},rootHovered:{color:e.palette.themePrimary,selectors:(n={},n[ro]={color:"Highlight"},n)},iconHovered:{color:e.palette.themePrimary},rootPressed:{color:e.palette.black},rootExpanded:{color:e.palette.themePrimary},iconPressed:{color:e.palette.themeDarker},rootDisabled:{color:e.palette.neutralTertiary,backgroundColor:"transparent",borderColor:"transparent",selectors:(r={},r[ro]={color:"GrayText"},r)},rootChecked:{color:e.palette.black},iconChecked:{color:e.palette.themeDarker},flexContainer:{justifyContent:"flex-start"},icon:{color:e.palette.themeDarkAlt},iconDisabled:{color:"inherit"},menuIcon:{color:e.palette.neutralSecondary},textContainer:{flexGrow:0}},t)})),Kd=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.styles,o=e.theme;return f.createElement(Qu,d({},this.props,{variantClassName:"ms-Button--action ms-Button--command",styles:Vd(o,t),onRenderDescription:Ks}))},h([Ju("ActionButton",["theme","styles"],!0)],t)}(f.Component),Gd=jo((function(e,t,o){var n,r,i,a,s,l=e.fonts,c=e.palette,u=od(e),p=nd(e),h={root:{maxWidth:"280px",minHeight:"72px",height:"auto",padding:"16px 12px"},flexContainer:{flexDirection:"row",alignItems:"flex-start",minWidth:"100%",margin:""},textContainer:{textAlign:"left"},icon:{fontSize:"2em",lineHeight:"1em",height:"1em",margin:"0px 8px 0px 0px",flexBasis:"1em",flexShrink:"0"},label:{margin:"0 0 5px",lineHeight:"100%",fontWeight:qe.semibold},description:[l.small,{lineHeight:"100%"}]},m={description:{color:c.neutralSecondary},descriptionHovered:{color:c.neutralDark},descriptionPressed:{color:"inherit"},descriptionChecked:{color:"inherit"},descriptionDisabled:{color:"inherit"}},g={description:{color:c.white,selectors:(n={},n[ro]=d({backgroundColor:"WindowText",color:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),n)},descriptionHovered:{color:c.white,selectors:(r={},r[ro]={backgroundColor:"Highlight",color:"Window"},r)},descriptionPressed:{color:"inherit",selectors:(i={},i[ro]=d({color:"Window",backgroundColor:"WindowText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),i)},descriptionChecked:{color:"inherit",selectors:(a={},a[ro]=d({color:"Window",backgroundColor:"WindowText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),a)},descriptionDisabled:{color:"inherit",selectors:(s={},s[ro]={color:"inherit"},s)}};return kn(u,h,o?Od(e):Hd(e),o?g:m,p,t)})),Ud=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.primary,o=void 0!==t&&t,n=e.styles,r=e.theme;return f.createElement(Qu,d({},this.props,{variantClassName:o?"ms-Button--compoundPrimary":"ms-Button--compound",styles:Gd(r,n,o)}))},h([Ju("CompoundButton",["theme","styles"],!0)],t)}(f.Component),jd=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){return f.createElement(Wd,d({},this.props,{primary:!0,onRenderDescription:Ks}))},h([Ju("PrimaryButton",["theme","styles"],!0)],t)}(f.Component),qd=function(e){function t(t){var o=e.call(this,t)||this;return cn("The Button component has been deprecated. Use specific variants instead. (PrimaryButton, DefaultButton, IconButton, ActionButton, etc.)"),o}return u(t,e),t.prototype.render=function(){var e=this.props;switch(e.buttonType){case kd.command:return f.createElement(Kd,d({},e));case kd.compound:return f.createElement(Ud,d({},e));case kd.icon:return f.createElement(id,d({},e));case kd.primary:return f.createElement(jd,d({},e));default:return f.createElement(Wd,d({},e))}},t}(f.Component),Yd=jo((function(e,t,o,n){var r,i,a,s,l,c,u,p,h,m,g,f,v,b,y=od(e),C=nd(e),_=e.palette,S=e.semanticColors;return kn(y,C,{root:[To(e,{inset:2,highContrastStyle:{left:4,top:4,bottom:4,right:4,border:"none"},borderColor:"transparent"}),e.fonts.medium,{minWidth:"40px",backgroundColor:_.white,color:_.neutralPrimary,padding:"0 4px",border:"none",borderRadius:0,selectors:(r={},r[ro]={border:"none"},r)}],rootHovered:{backgroundColor:_.neutralLighter,color:_.neutralDark,selectors:(i={},i[ro]={color:"Highlight"},i["."+qu.msButtonIcon]={color:_.themeDarkAlt},i["."+qu.msButtonMenuIcon]={color:_.neutralPrimary},i)},rootPressed:{backgroundColor:_.neutralLight,color:_.neutralDark,selectors:(a={},a["."+qu.msButtonIcon]={color:_.themeDark},a["."+qu.msButtonMenuIcon]={color:_.neutralPrimary},a)},rootChecked:{backgroundColor:_.neutralLight,color:_.neutralDark,selectors:(s={},s["."+qu.msButtonIcon]={color:_.themeDark},s["."+qu.msButtonMenuIcon]={color:_.neutralPrimary},s)},rootCheckedHovered:{backgroundColor:_.neutralQuaternaryAlt,selectors:(l={},l["."+qu.msButtonIcon]={color:_.themeDark},l["."+qu.msButtonMenuIcon]={color:_.neutralPrimary},l)},rootExpanded:{backgroundColor:_.neutralLight,color:_.neutralDark,selectors:(c={},c["."+qu.msButtonIcon]={color:_.themeDark},c["."+qu.msButtonMenuIcon]={color:_.neutralPrimary},c)},rootExpandedHovered:{backgroundColor:_.neutralQuaternaryAlt},rootDisabled:{backgroundColor:_.white,selectors:(u={},u["."+qu.msButtonIcon]={color:S.disabledBodySubtext,selectors:(p={},p[ro]=d({color:"GrayText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),p)},u[ro]=d({color:"GrayText",backgroundColor:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),u)},splitButtonContainer:{height:"100%",selectors:(h={},h[ro]={border:"none"},h)},splitButtonDividerDisabled:{selectors:(m={},m[ro]={backgroundColor:"Window"},m)},splitButtonDivider:{backgroundColor:_.neutralTertiaryAlt},splitButtonMenuButton:{backgroundColor:_.white,border:"none",borderTopRightRadius:"0",borderBottomRightRadius:"0",color:_.neutralSecondary,selectors:{":hover":{backgroundColor:_.neutralLighter,color:_.neutralDark,selectors:(g={},g[ro]={color:"Highlight"},g["."+qu.msButtonIcon]={color:_.neutralPrimary},g)},":active":{backgroundColor:_.neutralLight,selectors:(f={},f["."+qu.msButtonIcon]={color:_.neutralPrimary},f)}}},splitButtonMenuButtonDisabled:{backgroundColor:_.white,selectors:(v={},v[ro]=d({color:"GrayText",border:"none",backgroundColor:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),v)},splitButtonMenuButtonChecked:{backgroundColor:_.neutralLight,color:_.neutralDark,selectors:{":hover":{backgroundColor:_.neutralQuaternaryAlt}}},splitButtonMenuButtonExpanded:{backgroundColor:_.neutralLight,color:_.black,selectors:{":hover":{backgroundColor:_.neutralQuaternaryAlt}}},splitButtonMenuIcon:{color:_.neutralPrimary},splitButtonMenuIconDisabled:{color:_.neutralTertiary},label:{fontWeight:"normal"},icon:{color:_.themePrimary},menuIcon:(b={color:_.neutralSecondary},b[ro]={color:"GrayText"},b)},t)})),Zd=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.styles,o=e.theme;return f.createElement(Qu,d({},this.props,{variantClassName:"ms-Button--commandBar",styles:Yd(o,t),onRenderDescription:Ks}))},h([Ju("CommandBarButton",["theme","styles"],!0)],t)}(f.Component),Xd=Kd,Qd=jo((function(e,t){return kn({root:[To(e,{inset:1,highContrastStyle:{outlineOffset:"-4px",outline:"1px solid Window"},borderColor:"transparent"}),{height:24}]},t)})),Jd=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.styles,o=e.theme;return f.createElement(Wd,d({},this.props,{styles:Qd(o,t),onRenderDescription:Ks}))},h([Ju("MessageBarButton",["theme","styles"],!0)],t)}(f.Component),$d=Jn(),ep=Vn(f.forwardRef((function(e,t){var o=hu(void 0,e.id),n=e.items,r=e.columnCount,i=e.onRenderItem,a=e.ariaPosInSet,s=void 0===a?e.positionInSet:a,l=e.ariaSetSize,c=void 0===l?e.setSize:l,u=e.styles,p=e.doNotContainWithinFocusZone,h=Tr(e,ir,p?[]:["onBlur"]),m=$d(u,{theme:e.theme}),g=la(n,r),v=f.createElement("table",d({"aria-posinset":s,"aria-setsize":c,id:o,role:"grid"},h,{className:m.root}),f.createElement("tbody",null,g.map((function(e,t){return f.createElement("tr",{role:"row",key:t},e.map((function(e,t){return f.createElement("td",{role:"presentation",key:t+"-cell",className:m.tableCell},i(e,t))})))}))));return p?v:f.createElement(bs,{elementRef:t,isCircularNavigation:e.shouldFocusCircularNavigate,className:m.focusedContainer,onBlur:e.onBlur},v)})),(function(e){return{root:{padding:2,outline:"none"},tableCell:{padding:0}}}));ep.displayName="ButtonGrid";var tp,op,np,rp,ip=function(e){var t,o=hu("gridCell"),n=e.item,r=e.id,i=void 0===r?o:r,a=e.className,s=e.role,l=e.selected,c=e.disabled,u=void 0!==c&&c,d=e.onRenderItem,p=e.cellDisabledStyle,h=e.cellIsSelectedStyle,m=e.index,g=e.label,v=e.getClassNames,b=e.onClick,y=e.onHover,C=e.onMouseMove,_=e.onMouseLeave,S=e.onMouseEnter,x=e.onFocus,k=f.useCallback((function(){b&&!u&&b(n)}),[u,n,b]),w=f.useCallback((function(e){S&&S(e)||!y||u||y(n)}),[u,n,y,S]),I=f.useCallback((function(e){C&&C(e)||!y||u||y(n)}),[u,n,y,C]),D=f.useCallback((function(e){_&&_(e)||!y||u||y()}),[u,y,_]),T=f.useCallback((function(){x&&!u&&x(n)}),[u,n,x]);return f.createElement(Xd,{id:i,"data-index":m,"data-is-focusable":!0,disabled:u,className:qr(a,(t={},t[""+h]=l,t[""+p]=u,t)),onClick:k,onMouseEnter:w,onMouseMove:I,onMouseLeave:D,onFocus:T,role:s,"aria-selected":l,ariaLabel:g,title:g,getClassNames:v},d(n))};!function(e){e[e.Sunday=0]="Sunday",e[e.Monday=1]="Monday",e[e.Tuesday=2]="Tuesday",e[e.Wednesday=3]="Wednesday",e[e.Thursday=4]="Thursday",e[e.Friday=5]="Friday",e[e.Saturday=6]="Saturday"}(tp||(tp={})),function(e){e[e.January=0]="January",e[e.February=1]="February",e[e.March=2]="March",e[e.April=3]="April",e[e.May=4]="May",e[e.June=5]="June",e[e.July=6]="July",e[e.August=7]="August",e[e.September=8]="September",e[e.October=9]="October",e[e.November=10]="November",e[e.December=11]="December"}(op||(op={})),function(e){e[e.FirstDay=0]="FirstDay",e[e.FirstFullWeek=1]="FirstFullWeek",e[e.FirstFourDayWeek=2]="FirstFourDayWeek"}(np||(np={})),function(e){e[e.Day=0]="Day",e[e.Week=1]="Week",e[e.Month=2]="Month",e[e.WorkWeek=3]="WorkWeek"}(rp||(rp={}));var ap=7,sp={formatDay:function(e){return e.getDate().toString()},formatMonth:function(e,t){return t.months[e.getMonth()]},formatYear:function(e){return e.getFullYear().toString()},formatMonthDayYear:function(e,t){return t.months[e.getMonth()]+" "+e.getDate()+", "+e.getFullYear()},formatMonthYear:function(e,t){return t.months[e.getMonth()]+" "+e.getFullYear()}},lp=d(d({},{months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["S","M","T","W","T","F","S"]}),{goToToday:"Go to today",weekNumberFormatString:"Week number {0}",prevMonthAriaLabel:"Previous month",nextMonthAriaLabel:"Next month",prevYearAriaLabel:"Previous year",nextYearAriaLabel:"Next year",prevYearRangeAriaLabel:"Previous year range",nextYearRangeAriaLabel:"Next year range",closeButtonAriaLabel:"Close",selectedDateFormatString:"Selected date {0}",todayDateFormatString:"Today's date {0}",monthPickerHeaderAriaLabel:"{0}, change year",yearPickerHeaderAriaLabel:"{0}, change month",dayMarkedAriaLabel:"marked"}),cp={MillisecondsInOneDay:864e5,MillisecondsIn1Sec:1e3,MillisecondsIn1Min:6e4,MillisecondsIn30Mins:18e5,MillisecondsIn1Hour:36e5,MinutesInOneDay:1440,MinutesInOneHour:60,DaysInOneWeek:7,MonthInOneYear:12,HoursInOneDay:24};function up(e,t){var o=new Date(e.getTime());return o.setDate(o.getDate()+t),o}function dp(e,t){return up(e,t*cp.DaysInOneWeek)}function pp(e,t){var o=new Date(e.getTime()),n=o.getMonth()+t;return o.setMonth(n),o.getMonth()!==(n%cp.MonthInOneYear+cp.MonthInOneYear)%cp.MonthInOneYear&&(o=up(o,-o.getDate())),o}function hp(e,t){var o=new Date(e.getTime());return o.setFullYear(e.getFullYear()+t),o.getMonth()!==(e.getMonth()%cp.MonthInOneYear+cp.MonthInOneYear)%cp.MonthInOneYear&&(o=up(o,-o.getDate())),o}function mp(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}function gp(e){return new Date(e.getFullYear(),e.getMonth()+1,0,0,0,0,0)}function fp(e){return new Date(e.getFullYear(),0,1,0,0,0,0)}function vp(e){return new Date(e.getFullYear()+1,0,0,0,0,0,0)}function bp(e,t){return pp(e,t-e.getMonth())}function yp(e,t){return!e&&!t||!(!e||!t)&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Cp(e,t){return Tp(e)-Tp(t)}function _p(e,t,o,n,r){void 0===r&&(r=1);var i,a=[],s=null;switch(n||(n=[tp.Monday,tp.Tuesday,tp.Wednesday,tp.Thursday,tp.Friday]),r=Math.max(r,1),t){case rp.Day:s=up(i=Dp(e),r);break;case rp.Week:case rp.WorkWeek:s=up(i=wp(Dp(e),o),cp.DaysInOneWeek);break;case rp.Month:s=pp(i=new Date(e.getFullYear(),e.getMonth(),1),1);break;default:throw new Error("Unexpected object: "+t)}var l=i;do{(t!==rp.WorkWeek||-1!==n.indexOf(l.getDay()))&&a.push(l),l=up(l,1)}while(!yp(l,s));return a}function Sp(e,t){for(var o=0,n=t;o<n.length;o++)if(yp(e,n[o]))return!0;return!1}function xp(e,t,o,n){var r=n.getFullYear(),i=n.getMonth(),a=1,s=new Date(r,i,a),l=a+(t+cp.DaysInOneWeek-1)-function(e,t){return e!==tp.Sunday&&t<e?t+cp.DaysInOneWeek:t}(t,s.getDay()),c=new Date(r,i,l);a=c.getDate();for(var u=[],d=0;d<e;d++)u.push(kp(c,t,o)),a+=cp.DaysInOneWeek,c=new Date(r,i,a);return u}function kp(e,t,o){switch(o){case np.FirstFullWeek:return Ep(e,t,cp.DaysInOneWeek);case np.FirstFourDayWeek:return Ep(e,t,4);default:return function(e,t){var o=Pp(e)-1,n=(e.getDay()-o%cp.DaysInOneWeek-t+2*cp.DaysInOneWeek)%cp.DaysInOneWeek;return Math.floor((o+n)/cp.DaysInOneWeek+1)}(e,t)}}function wp(e,t){var o=t-e.getDay();return o>0&&(o-=cp.DaysInOneWeek),up(e,o)}function Ip(e,t){var o=(t-1>=0?t-1:cp.DaysInOneWeek-1)-e.getDay();return o<0&&(o+=cp.DaysInOneWeek),up(e,o)}function Dp(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function Tp(e){return e.getDate()+(e.getMonth()<<5)+(e.getFullYear()<<9)}function Ep(e,t,o){var n=Pp(e)-1,r=e.getDay()-n%cp.DaysInOneWeek,i=Pp(new Date(e.getFullYear()-1,op.December,31))-1,a=(t-r+2*cp.DaysInOneWeek)%cp.DaysInOneWeek;0!==a&&a>=o&&(a-=cp.DaysInOneWeek);var s=n-a;return s<0&&(0!=(a=(t-(r-=i%cp.DaysInOneWeek)+2*cp.DaysInOneWeek)%cp.DaysInOneWeek)&&a+1>=o&&(a-=cp.DaysInOneWeek),s=i-a),Math.floor(s/cp.DaysInOneWeek+1)}function Pp(e){for(var t=e.getMonth(),o=e.getFullYear(),n=0,r=0;r<t;r++)n+=Rp(r+1,o);return n+e.getDate()}function Rp(e,t){return new Date(t,e,0).getDate()}var Mp=/[\{\}]/g,Np=/\{\d+\}/g;function Bp(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];var n=t;function r(e){var t=n[e.replace(Mp,"")];return null==t&&(t=""),t}return e.replace(Np,r)}var Fp=function(e,t,o){var n=m(e);return t&&(n=n.filter((function(e){return Cp(e,t)>=0}))),o&&(n=n.filter((function(e){return Cp(e,o)<=0}))),n},Ap=function(e,t){var o=t.minDate;return!!o&&Cp(o,e)>=1},Lp=function(e,t){var o=t.maxDate;return!!o&&Cp(e,o)>=1},Hp=function(e,t){var o=t.restrictedDates,n=t.minDate,r=t.maxDate;return!!(o||n||r)&&(o&&o.some((function(t){return yp(t,e)}))||Ap(e,t)||Lp(e,t))},Op=function(e){var t=e.showWeekNumbers,o=e.strings,n=e.firstDayOfWeek,r=e.allFocusable,i=e.weeksToShow,a=e.weeks,s=e.classNames,l=o.shortDays.slice(),c=ia(a[1],(function(e){return 1===e.originalDate.getDate()}));return 1===i&&c>=0&&(l[(c+n)%ap]=o.shortMonths[a[1][c].originalDate.getMonth()]),f.createElement("tr",null,t&&f.createElement("th",{className:s.dayCell}),l.map((function(e,t){var i=(t+n)%ap,a=t===c?o.days[i]+" "+l[i]:o.days[i];return f.createElement("th",{className:qr(s.dayCell,s.weekDayLabelCell),scope:"col",key:l[i]+" "+t,title:a,"aria-label":a,"data-is-focusable":!!r||void 0},l[i])})))},zp=function(e){var t=e.targetDate,o=e.initialDate,n=e.direction,r=p(e,["targetDate","initialDate","direction"]),i=t;if(!Hp(t,r))return t;for(;0!==Cp(o,i)&&Hp(i,r)&&!Lp(i,r)&&!Ap(i,r);)i=up(i,n);return 0===Cp(o,i)||Hp(i,r)?void 0:i},Wp=function(e){var t,o=e.navigatedDate,n=e.dateTimeFormatter,r=e.allFocusable,i=e.strings,a=e.activeDescendantId,s=e.navigatedDayRef,l=e.calculateRoundedStyles,c=e.weeks,u=e.classNames,d=e.day,p=e.dayIndex,h=e.weekIndex,m=e.weekCorners,g=e.ariaHidden,v=e.customDayCellRef,b=e.dateRangeType,y=e.daysToSelectInDayView,C=e.onSelectDate,_=e.restrictedDates,S=e.minDate,x=e.maxDate,k=e.onNavigateDate,w=e.getDayInfosInRangeOfDay,I=e.getRefsFromDayInfos,D=null!==(t=null==m?void 0:m[h+"_"+p])&&void 0!==t?t:"",T=yp(o,d.originalDate),E=d.originalDate.getDate()+", "+i.months[d.originalDate.getMonth()]+", "+d.originalDate.getFullYear();return d.isMarked&&(E=E+", "+i.dayMarkedAriaLabel),f.createElement("td",{className:qr(u.dayCell,m&&D,d.isSelected&&u.daySelected,d.isSelected&&"ms-CalendarDay-daySelected",!d.isInBounds&&u.dayOutsideBounds,!d.isInMonth&&u.dayOutsideNavigatedMonth),ref:function(e){null==v||v(e,d.originalDate,u),d.setRef(e)},"aria-hidden":g,"aria-disabled":!g&&!d.isInBounds,onClick:d.isInBounds&&!g?d.onSelected:void 0,onMouseOver:g?void 0:function(e){var t=w(d),o=I(t);o.forEach((function(e,n){var r;if(e&&(e.classList.add("ms-CalendarDay-hoverStyle"),!t[n].isSelected&&b===rp.Day&&y&&y>1)){e.classList.remove(u.bottomLeftCornerDate,u.bottomRightCornerDate,u.topLeftCornerDate,u.topRightCornerDate);var i=l(u,!1,!1,n>0,n<o.length-1).trim();i&&(r=e.classList).add.apply(r,i.split(" "))}}))},onMouseDown:g?void 0:function(e){var t=w(d);I(t).forEach((function(e){e&&e.classList.add("ms-CalendarDay-pressedStyle")}))},onMouseUp:g?void 0:function(e){var t=w(d);I(t).forEach((function(e){e&&e.classList.remove("ms-CalendarDay-pressedStyle")}))},onMouseOut:g?void 0:function(e){var t=w(d),o=I(t);o.forEach((function(e,n){var r;if(e&&(e.classList.remove("ms-CalendarDay-hoverStyle"),e.classList.remove("ms-CalendarDay-pressedStyle"),!t[n].isSelected&&b===rp.Day&&y&&y>1)){var i=l(u,!1,!1,n>0,n<o.length-1).trim();i&&(r=e.classList).remove.apply(r,i.split(" "))}}))},onKeyDown:g?void 0:function(e){e.which===Gn.enter?null==C||C(d.originalDate):function(e,t){var o=void 0,n=1;if(e.which===Gn.up?(o=dp(t,-1),n=-1):e.which===Gn.down?o=dp(t,1):e.which===Yn(Gn.left)?(o=up(t,-1),n=-1):e.which===Yn(Gn.right)&&(o=up(t,1)),o){var r={initialDate:t,targetDate:o,direction:n,restrictedDates:_,minDate:S,maxDate:x},i=zp(r);i||(r.direction=-n,i=zp(r)),c&&i&&c.slice(1,c.length-1).some((function(e){return e.some((function(e){return yp(e.originalDate,i)}))}))||i&&(k(i,!0),e.preventDefault())}}(e,d.originalDate)},role:"gridcell",tabIndex:T?0:void 0,"aria-readonly":"true","aria-current":d.isSelected?"date":void 0,"aria-selected":d.isInBounds?d.isSelected:void 0,"data-is-focusable":!g&&(r||!!d.isInBounds||void 0)},f.createElement("button",{key:d.key+"button","aria-hidden":g,className:qr(u.dayButton,d.isToday&&u.dayIsToday,d.isToday&&"ms-CalendarDay-dayIsToday"),"aria-label":E,id:T?a:void 0,ref:T?s:void 0,disabled:!g&&!d.isInBounds,type:"button",tabIndex:-1,"data-is-focusable":"false"},f.createElement("span",{"aria-hidden":"true"},n.formatDay(d.originalDate)),d.isMarked&&f.createElement("div",{"aria-hidden":"true",className:u.dayMarker})))},Vp=function(e){var t=e.classNames,o=e.week,n=e.weeks,r=e.weekIndex,i=e.rowClassName,a=e.ariaRole,s=e.showWeekNumbers,l=e.firstDayOfWeek,c=e.firstWeekOfYear,u=e.navigatedDate,p=e.strings,h=s?xp(n.length,l,c,u):null,m=h?p.weekNumberFormatString&&Bp(p.weekNumberFormatString,h[r]):"";return f.createElement("tr",{role:a,className:i,key:r+"_"+o[0].key},s&&h&&f.createElement("th",{className:t.weekNumberCell,key:r,title:m,"aria-label":m,scope:"row"},f.createElement("span",null,h[r])),o.map((function(t,o){return f.createElement(Wp,d({},e,{key:t.key,day:t,dayIndex:o}))})))},Kp=Jn();function Gp(e,t,o){return f.useMemo((function(){for(var n,r=function(e){var t,o=e.selectedDate,n=e.dateRangeType,r=e.firstDayOfWeek,i=e.today,a=e.minDate,s=e.maxDate,l=e.weeksToShow,c=e.workWeekDays,u=e.daysToSelectInDayView,d=e.restrictedDates,p=e.markedDays,h={minDate:a,maxDate:s,restrictedDates:d},m=i||new Date,g=e.navigatedDate?e.navigatedDate:m;t=l&&l<=4?new Date(g.getFullYear(),g.getMonth(),g.getDate()):new Date(g.getFullYear(),g.getMonth(),1);for(var f=[];t.getDay()!==r;)t.setDate(t.getDate()-1);t=up(t,-ap);var v=!1,b=function(e,t,o){return!t||e!==rp.WorkWeek||function(e,t,o){for(var n=new Set(e),r=0,i=0,a=e;i<a.length;i++){var s=(a[i]+1)%7;(!n.has(s)||o===s)&&r++}return r<2}(t,0,o)&&0!==t.length?e:rp.Week}(n,c,r),y=[];o&&(y=_p(o,b,r,c,u),y=Fp(y,a,s));for(var C=!0,_=0;C;_++){var S=[];v=!0;for(var x=function(e){var o=new Date(t.getTime()),n={key:t.toString(),date:t.getDate().toString(),originalDate:o,isInMonth:t.getMonth()===g.getMonth(),isToday:yp(m,t),isSelected:Sp(t,y),isInBounds:!Hp(t,h),isMarked:(null==p?void 0:p.some((function(e){return yp(o,e)})))||!1};S.push(n),n.isInMonth&&(v=!1),t.setDate(t.getDate()+1)},k=0;k<ap;k++)x();C=l?_<l+1:!v||0===_,f.push(S)}return f}(e),i=r[1][0].originalDate,a=r[r.length-1][6].originalDate,s=(null===(n=e.getMarkedDays)||void 0===n?void 0:n.call(e,i,a))||[],l=[],c=0;c<r.length;c++){for(var u=[],p=function(e){var n=r[c][e],i=d(d({onSelected:function(){return t(n.originalDate)},setRef:o(n.key)},n),{isMarked:n.isMarked||(null==s?void 0:s.some((function(e){return yp(n.originalDate,e)})))});u.push(i)},h=0;h<ap;h++)p(h);l.push(u)}return l}),[e])}var Up,jp=function(e){var t=f.useRef(null),o=hu(),n=function(){var e=f.useRef({});return[e,function(t){return function(o){null===o?delete e.current[t]:e.current[t]=o}}]}(),r=n[0],i=n[1],a=Gp(e,(function(t){var o,n,r=e.firstDayOfWeek,i=e.minDate,a=e.maxDate,s=e.workWeekDays,l=e.daysToSelectInDayView,c={minDate:i,maxDate:a,restrictedDates:e.restrictedDates},u=_p(t,g,r,s,l);u=(u=Fp(u,i,a)).filter((function(e){return!Hp(e,c)})),null===(o=e.onSelectDate)||void 0===o||o.call(e,t,u),null===(n=e.onNavigateDate)||void 0===n||n.call(e,t,!0)}),i),s=function(e){var t=Ti(e[0][0].originalDate);return t&&t.getTime()!==e[0][0].originalDate.getTime()?!(t<=e[0][0].originalDate):void 0}(a),l=function(e){var t=function(e,t,o,n,r){var i=[],a=!t&&!r,s=!o&&!n,l=!o&&!r;return!t&&!n&&i.push(jn()?e.topRightCornerDate:e.topLeftCornerDate),a&&i.push(jn()?e.topLeftCornerDate:e.topRightCornerDate),s&&i.push(jn()?e.bottomRightCornerDate:e.bottomLeftCornerDate),l&&i.push(jn()?e.bottomLeftCornerDate:e.bottomRightCornerDate),i.join(" ")},o=function(t,o,n,r){var i=e.dateRangeType,a=e.firstDayOfWeek,s=e.workWeekDays,l=_p(t,i===rp.WorkWeek?rp.Week:i,a,s);return n===r&&(!(!n||!r)||l.filter((function(e){return e.getTime()===o.getTime()})).length>0)};return[function(e,n){var r={},i=n.slice(1,n.length-1);return i.forEach((function(n,a){n.forEach((function(n,s){var l=i[a-1]&&i[a-1][s]&&o(i[a-1][s].originalDate,n.originalDate,i[a-1][s].isSelected,n.isSelected),c=i[a+1]&&i[a+1][s]&&o(i[a+1][s].originalDate,n.originalDate,i[a+1][s].isSelected,n.isSelected),u=i[a][s-1]&&o(i[a][s-1].originalDate,n.originalDate,i[a][s-1].isSelected,n.isSelected),d=i[a][s+1]&&o(i[a][s+1].originalDate,n.originalDate,i[a][s+1].isSelected,n.isSelected),p=[];p.push(t(e,l,c,u,d)),p.push(function(e,t,o,n,r){var i=[];return t||i.push(e.datesAbove),o||i.push(e.datesBelow),n||i.push(jn()?e.datesRight:e.datesLeft),r||i.push(jn()?e.datesLeft:e.datesRight),i.join(" ")}(e,l,c,u,d)),r[a+"_"+s]=p.join(" ")}))})),r},t]}(e),c=l[0],u=l[1];f.useImperativeHandle(e.componentRef,(function(){return{focus:function(){var e,o;null===(o=null===(e=t.current)||void 0===e?void 0:e.focus)||void 0===o||o.call(e)}}}),[]);var p=e.styles,h=e.theme,m=e.className,g=e.dateRangeType,v=e.showWeekNumbers,b=e.labelledBy,y=e.lightenDaysOutsideNavigatedMonth,C=e.animationDirection,_=Kp(p,{theme:h,className:m,dateRangeType:g,showWeekNumbers:v,lightenDaysOutsideNavigatedMonth:void 0===y||y,animationDirection:C,animateBackwards:s}),S=c(_,a),x={weeks:a,navigatedDayRef:t,calculateRoundedStyles:u,activeDescendantId:o,classNames:_,weekCorners:S,getDayInfosInRangeOfDay:function(t){var o=function(e,t){if(t&&e===rp.WorkWeek){for(var o=t.slice().sort(),n=!0,r=1;r<o.length;r++)if(o[r]!==o[r-1]+1){n=!1;break}if(!n||0===t.length)return rp.Week}return e}(e.dateRangeType,e.workWeekDays),n=_p(t.originalDate,o,e.firstDayOfWeek,e.workWeekDays,e.daysToSelectInDayView).map((function(e){return e.getTime()}));return a.reduce((function(e,t){return e.concat(t.filter((function(e){return-1!==n.indexOf(e.originalDate.getTime())})))}),[])},getRefsFromDayInfos:function(e){return e.map((function(e){return r.current[e.key]}))}};return f.createElement(bs,{className:_.wrapper},f.createElement("table",{className:_.table,"aria-multiselectable":"false","aria-labelledby":b,"aria-activedescendant":o,role:"grid"},f.createElement("tbody",null,f.createElement(Op,d({},e,{classNames:_,weeks:a})),f.createElement(Vp,d({},e,x,{week:a[0],weekIndex:-1,rowClassName:_.firstTransitionWeek,ariaRole:"presentation",ariaHidden:!0})),a.slice(1,a.length-1).map((function(t,o){return f.createElement(Vp,d({},e,x,{key:o,week:t,weekIndex:o,rowClassName:_.weekRow}))})),f.createElement(Vp,d({},e,x,{week:a[a.length-1],weekIndex:-2,rowClassName:_.lastTransitionWeek,ariaRole:"presentation",ariaHidden:!0})))))};jp.displayName="CalendarDayGridBase",function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical"}(Up||(Up={}));var qp={hoverStyle:"ms-CalendarDay-hoverStyle",pressedStyle:"ms-CalendarDay-pressedStyle",dayIsTodayStyle:"ms-CalendarDay-dayIsToday",daySelectedStyle:"ms-CalendarDay-daySelected"},Yp=J({"100%":{width:0,height:0,overflow:"hidden"},"99.9%":{width:"100%",height:28,overflow:"visible"},"0%":{width:"100%",height:28,overflow:"visible"}}),Zp=Vn(jp,(function(e){var t,o,n,r,i,a,s,l,c,u,p=e.theme,h=e.dateRangeType,m=e.showWeekNumbers,g=e.lightenDaysOutsideNavigatedMonth,f=e.animateBackwards,v=e.animationDirection,b=p.palette,y=Qo(qp,p),C={};void 0!==f&&(C=v===Up.Horizontal?f?He.slideRightIn20:He.slideLeftIn20:f?He.slideDownIn20:He.slideUpIn20);var _={},S={};void 0!==f&&v!==Up.Horizontal&&(_=f?{animationName:""}:He.slideUpOut20,S=f?He.slideDownOut20:{animationName:""});var x={selectors:{"&, &:disabled, & button":{color:b.neutralTertiaryAlt,pointerEvents:"none"}}};return{wrapper:{paddingBottom:10},table:[{textAlign:"center",borderCollapse:"collapse",borderSpacing:"0",tableLayout:"fixed",fontSize:"inherit",marginTop:4,width:196,position:"relative",paddingBottom:10},m&&{width:226}],dayCell:{margin:0,padding:0,width:28,height:28,lineHeight:28,fontSize:je.small,fontWeight:qe.regular,color:b.neutralPrimary,cursor:"pointer",position:"relative",selectors:(t={},t[ro]=d({color:"WindowText",backgroundColor:"Window",zIndex:0},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),t["&."+y.hoverStyle]={backgroundColor:b.neutralLighter,selectors:(o={},o[ro]={zIndex:3,backgroundColor:"Window",outline:"1px solid Highlight"},o)},t["&."+y.pressedStyle]={backgroundColor:b.neutralLight,selectors:(n={},n[ro]={borderColor:"Highlight",color:"Highlight",backgroundColor:"Window"},n)},t["&."+y.pressedStyle+"."+y.hoverStyle]={selectors:(r={},r[ro]={backgroundColor:"Window",outline:"1px solid Highlight"},r)},t)},daySelected:[h!==rp.Month&&{backgroundColor:b.neutralLight+"!important",selectors:(i={"&:after":{content:'""',position:"absolute",top:0,bottom:0,left:0,right:0}},i["&:hover, &."+y.hoverStyle+", &."+y.pressedStyle]=(a={backgroundColor:b.neutralLight+"!important"},a[ro]={color:"HighlightText!important",background:"Highlight!important"},a),i[ro]=d({background:"Highlight!important",color:"HighlightText!important",borderColor:"Highlight!important"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),i)}],weekRow:C,weekDayLabelCell:He.fadeIn200,weekNumberCell:{margin:0,padding:0,borderRight:"1px solid",borderColor:b.neutralLight,backgroundColor:b.neutralLighterAlt,color:b.neutralSecondary,boxSizing:"border-box",width:28,height:28,fontWeight:qe.regular,fontSize:je.small},dayOutsideBounds:x,dayOutsideNavigatedMonth:g&&{color:b.neutralSecondary,fontWeight:qe.regular},dayButton:[To(p,{inset:-3}),{width:24,height:24,lineHeight:24,fontSize:je.small,fontWeight:"inherit",borderRadius:2,border:"none",padding:0,color:"inherit",backgroundColor:"transparent",cursor:"pointer",overflow:"visible",selectors:{span:{height:"inherit",lineHeight:"inherit"}}}],dayIsToday:{backgroundColor:b.themePrimary+"!important",borderRadius:"100%",color:b.white+"!important",fontWeight:qe.semibold+"!important",selectors:(s={},s[ro]=d({background:"WindowText!important",color:"Window!important",borderColor:"WindowText!important"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),s)},firstTransitionWeek:d(d({position:"absolute",opacity:0,width:0,height:0,overflow:"hidden"},_),{animationName:_.animationName+","+Yp}),lastTransitionWeek:d(d({position:"absolute",opacity:0,width:0,height:0,overflow:"hidden",marginTop:-28},S),{animationName:S.animationName+","+Yp}),dayMarker:{width:4,height:4,backgroundColor:b.neutralSecondary,borderRadius:"100%",bottom:1,left:0,right:0,position:"absolute",margin:"auto",selectors:(l={},l["."+y.dayIsTodayStyle+" &"]={backgroundColor:b.white,selectors:(c={},c[ro]={backgroundColor:"Window"},c)},l["."+y.daySelectedStyle+" &"]={selectors:(u={},u[ro]={backgroundColor:"HighlightText"},u)},l[ro]=d({backgroundColor:"WindowText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),l)},topRightCornerDate:{borderTopRightRadius:"2px"},topLeftCornerDate:{borderTopLeftRadius:"2px"},bottomRightCornerDate:{borderBottomRightRadius:"2px"},bottomLeftCornerDate:{borderBottomLeftRadius:"2px"},datesAbove:{"&:after":{borderTop:"1px solid "+b.neutralSecondary}},datesBelow:{"&:after":{borderBottom:"1px solid "+b.neutralSecondary}},datesLeft:{"&:after":{borderLeft:"1px solid "+b.neutralSecondary}},datesRight:{"&:after":{borderRight:"1px solid "+b.neutralSecondary}}}}),void 0,{scope:"CalendarDayGrid"}),Xp=Jn(),Qp=function(e){var t=f.useRef(null);f.useImperativeHandle(e.componentRef,(function(){return{focus:function(){var e,o;null===(o=null===(e=t.current)||void 0===e?void 0:e.focus)||void 0===o||o.call(e)}}}),[]);var o=e.strings,n=e.navigatedDate,r=e.dateTimeFormatter,i=e.styles,a=e.theme,s=e.className,l=e.onHeaderSelect,c=e.showSixWeeksByDefault,u=e.minDate,p=e.maxDate,h=e.restrictedDates,m=e.onNavigateDate,g=e.showWeekNumbers,v=e.dateRangeType,b=e.animationDirection,y=hu(),C=Xp(i,{theme:a,className:s,headerIsClickable:!!l,showWeekNumbers:g,animationDirection:b}),_=r.formatMonthYear(n,o),S=l?"button":"div",x=o.yearPickerHeaderAriaLabel?Bp(o.yearPickerHeaderAriaLabel,_):_;return f.createElement("div",{className:C.root},f.createElement("div",{className:C.header},f.createElement(S,{"aria-live":"polite","aria-atomic":"true","aria-label":l?x:void 0,key:_,className:C.monthAndYear,onClick:l,"data-is-focusable":!!l,tabIndex:l?0:-1,onKeyDown:$p(l),type:"button"},f.createElement("span",{id:y},_)),f.createElement(Jp,d({},e,{classNames:C}))),f.createElement(Zp,d({},e,{styles:i,componentRef:t,strings:o,navigatedDate:n,weeksToShow:c?6:void 0,dateTimeFormatter:r,minDate:u,maxDate:p,restrictedDates:h,onNavigateDate:m,labelledBy:y,dateRangeType:v})))};Qp.displayName="CalendarDayBase";var Jp=function(e){var t,o,n=e.minDate,r=e.maxDate,i=e.navigatedDate,a=e.allFocusable,s=e.strings,l=e.navigationIcons,c=e.showCloseButton,u=e.classNames,d=e.onNavigateDate,p=e.onDismiss,h=function(){d(pp(i,1),!1)},m=function(){d(pp(i,-1),!1)},g=l.leftNavigation,v=l.rightNavigation,b=l.closeIcon,y=!n||Cp(n,mp(i))<0,C=!r||Cp(gp(i),r)<0;return f.createElement("div",{className:u.monthComponents},f.createElement("button",{className:qr(u.headerIconButton,(t={},t[u.disabledStyle]=!y,t)),tabIndex:y?void 0:a?0:-1,"aria-disabled":!y,onClick:y?m:void 0,onKeyDown:y?$p(m):void 0,title:s.prevMonthAriaLabel?s.prevMonthAriaLabel+" "+s.months[pp(i,-1).getMonth()]:void 0,type:"button"},f.createElement(ii,{iconName:g})),f.createElement("button",{className:qr(u.headerIconButton,(o={},o[u.disabledStyle]=!C,o)),tabIndex:C?void 0:a?0:-1,"aria-disabled":!C,onClick:C?h:void 0,onKeyDown:C?$p(h):void 0,title:s.nextMonthAriaLabel?s.nextMonthAriaLabel+" "+s.months[pp(i,1).getMonth()]:void 0,type:"button"},f.createElement(ii,{iconName:v})),c&&f.createElement("button",{className:qr(u.headerIconButton),onClick:p,onKeyDown:$p(p),title:s.closeButtonAriaLabel,type:"button"},f.createElement(ii,{iconName:b})))};Jp.displayName="CalendarDayNavigationButtons";var $p=function(e){return function(t){switch(t.which){case Gn.enter:null==e||e()}}},eh=Vn(Qp,(function(e){var t,o=e.className,n=e.theme,r=e.headerIsClickable,i=e.showWeekNumbers,a=n.palette,s={selectors:(t={"&, &:disabled, & button":{color:a.neutralTertiaryAlt,pointerEvents:"none"}},t[ro]={color:"GrayText",forcedColorAdjust:"none"},t)};return{root:[on,{width:196,padding:12,boxSizing:"content-box"},i&&{width:226},o],header:{position:"relative",display:"inline-flex",height:28,lineHeight:44,width:"100%"},monthAndYear:[To(n,{inset:1}),d(d({},He.fadeIn200),{alignItems:"center",fontSize:je.medium,fontFamily:"inherit",color:a.neutralPrimary,display:"inline-block",flexGrow:1,fontWeight:qe.semibold,padding:"0 4px 0 10px",border:"none",backgroundColor:"transparent",borderRadius:2,lineHeight:28,overflow:"hidden",whiteSpace:"nowrap",textAlign:"left",textOverflow:"ellipsis"}),r&&{selectors:{"&:hover":{cursor:"pointer",background:a.neutralLight,color:a.black}}}],monthComponents:{display:"inline-flex",alignSelf:"flex-end"},headerIconButton:[To(n,{inset:-1}),{width:28,height:28,display:"block",textAlign:"center",lineHeight:28,fontSize:je.small,fontFamily:"inherit",color:a.neutralPrimary,borderRadius:2,position:"relative",backgroundColor:"transparent",border:"none",padding:0,overflow:"visible",selectors:{"&:hover":{color:a.neutralDark,backgroundColor:a.neutralLight,cursor:"pointer",outline:"1px solid transparent"}}}],disabledStyle:s}}),void 0,{scope:"CalendarDay"}),th=function(e){var t,o,n,r,i,a,s,l=e.className,c=e.theme,u=e.hasHeaderClickCallback,p=e.highlightCurrent,h=e.highlightSelected,m=e.animateBackwards,g=e.animationDirection,f=c.palette,v={};void 0!==m&&(v=g===Up.Horizontal?m?He.slideRightIn20:He.slideLeftIn20:m?He.slideDownIn20:He.slideUpIn20);var b=void 0!==m?He.fadeIn200:{};return{root:[on,{width:196,padding:12,boxSizing:"content-box",overflow:"hidden"},l],headerContainer:{display:"flex"},currentItemButton:[To(c,{inset:-1}),d(d({},b),{fontSize:je.medium,fontWeight:qe.semibold,fontFamily:"inherit",textAlign:"left",backgroundColor:"transparent",flexGrow:1,padding:"0 4px 0 10px",border:"none",overflow:"visible"}),u&&{selectors:{"&:hover, &:active":{cursor:u?"pointer":"default",color:f.neutralDark,outline:"1px solid transparent",backgroundColor:f.neutralLight}}}],navigationButtonsContainer:{display:"flex",alignItems:"center"},navigationButton:[To(c,{inset:-1}),{fontFamily:"inherit",width:28,minWidth:28,height:28,minHeight:28,display:"block",textAlign:"center",lineHeight:28,fontSize:je.small,color:f.neutralPrimary,borderRadius:2,position:"relative",backgroundColor:"transparent",border:"none",padding:0,overflow:"visible",selectors:{"&:hover":{color:f.neutralDark,cursor:"pointer",outline:"1px solid transparent",backgroundColor:f.neutralLight}}}],gridContainer:{marginTop:4},buttonRow:d(d({},v),{marginBottom:16,selectors:{"&:nth-child(n + 3)":{marginBottom:0}}}),itemButton:[To(c,{inset:-1}),{width:40,height:40,minWidth:40,minHeight:40,lineHeight:40,fontSize:je.small,fontFamily:"inherit",padding:0,margin:"0 12px 0 0",color:f.neutralPrimary,backgroundColor:"transparent",border:"none",borderRadius:2,overflow:"visible",selectors:{"&:nth-child(4n + 4)":{marginRight:0},"&:nth-child(n + 9)":{marginBottom:0},"& div":{fontWeight:qe.regular},"&:hover":{color:f.neutralDark,backgroundColor:f.neutralLight,cursor:"pointer",outline:"1px solid transparent",selectors:(t={},t[ro]=d({background:"Window",color:"WindowText",outline:"1px solid Highlight"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),t)},"&:active":{backgroundColor:f.themeLight,selectors:(o={},o[ro]=d({background:"Window",color:"Highlight"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),o)}}}],current:p?{color:f.white,backgroundColor:f.themePrimary,selectors:(n={"& div":{fontWeight:qe.semibold},"&:hover":{backgroundColor:f.themePrimary,selectors:(r={},r[ro]=d({backgroundColor:"WindowText",color:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),r)}},n[ro]=d({backgroundColor:"WindowText",color:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),n)}:{},selected:h?{color:f.neutralPrimary,backgroundColor:f.themeLight,fontWeight:qe.semibold,selectors:(i={"& div":{fontWeight:qe.semibold},"&:hover, &:active":{backgroundColor:f.themeLight,selectors:(a={},a[ro]=d({color:"Window",background:"Highlight"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),a)}},i[ro]=d({background:"Highlight",color:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),i)}:{},disabled:{selectors:(s={"&, &:disabled, & button":{color:f.neutralTertiaryAlt,pointerEvents:"none"}},s[ro]={color:"GrayText",forcedColorAdjust:"none"},s)}}},oh=function(e){return th(e)},nh=lp,rh=nh,ih={leftNavigation:"Up",rightNavigation:"Down",closeIcon:"CalculatorMultiply"},ah=Jn(),sh={prevRangeAriaLabel:void 0,nextRangeAriaLabel:void 0},lh=function(e){var t,o,n=e.styles,r=e.theme,i=e.className,a=e.highlightCurrentYear,s=e.highlightSelectedYear,l=e.year,c=e.selected,u=e.disabled,d=e.componentRef,p=e.onSelectYear,h=e.onRenderYear,m=f.useRef(null);f.useImperativeHandle(d,(function(){return{focus:function(){var e,t;null===(t=null===(e=m.current)||void 0===e?void 0:e.focus)||void 0===t||t.call(e)}}}),[]);var g=ah(n,{theme:r,className:i,highlightCurrent:a,highlightSelected:s});return f.createElement("button",{className:qr(g.itemButton,(t={},t[g.selected]=c,t[g.disabled]=u,t)),type:"button",role:"gridcell",onClick:u?void 0:function(){null==p||p(l)},onKeyDown:u?void 0:function(e){e.which===Gn.enter&&(null==p||p(l))},disabled:u,"aria-selected":c,ref:m},null!==(o=null==h?void 0:h(l))&&void 0!==o?o:l)};lh.displayName="CalendarYearGridCell";var ch,uh=function(e){var t=e.styles,o=e.theme,n=e.className,r=e.fromYear,i=e.toYear,a=e.animationDirection,s=e.animateBackwards,l=e.minYear,c=e.maxYear,u=e.onSelectYear,p=e.selectedYear,h=e.componentRef,m=f.useRef(null),g=f.useRef(null);f.useImperativeHandle(h,(function(){return{focus:function(){var e,t;null===(t=null===(e=m.current||g.current)||void 0===e?void 0:e.focus)||void 0===t||t.call(e)}}}),[]);for(var v,b,y,C,_=ah(t,{theme:o,className:n,animateBackwards:s,animationDirection:a}),S=function(t){var o,n;return null!==(n=null===(o=e.onRenderYear)||void 0===o?void 0:o.call(e,t))&&void 0!==n?n:t},x=S(r)+" - "+S(i),k=r,w=[],I=0;I<(i-r+1)/4;I++){w.push([]);for(var D=0;D<4;D++)w[I].push((void 0,void 0,void 0,b=(v=k)===p,y=void 0!==l&&v<l||void 0!==c&&v>c,C=v===(new Date).getFullYear(),f.createElement(lh,d({},e,{key:v,year:v,selected:b,current:C,disabled:y,onSelectYear:u,componentRef:b?m:C?g:void 0,theme:o})))),k++}return f.createElement(bs,null,f.createElement("div",{className:_.gridContainer,role:"grid","aria-label":x},w.map((function(e,t){return f.createElement("div",{key:"yearPickerRow_"+t+"_"+r,role:"row",className:_.buttonRow},e)}))))};uh.displayName="CalendarYearGrid",function(e){e[e.Previous=0]="Previous",e[e.Next=1]="Next"}(ch||(ch={}));var dh=function(e){var t,o=e.styles,n=e.theme,r=e.className,i=e.navigationIcons,a=void 0===i?ih:i,s=e.strings,l=void 0===s?sh:s,c=e.direction,u=e.onSelectPrev,d=e.onSelectNext,p=e.fromYear,h=e.toYear,m=e.maxYear,g=e.minYear,v=ah(o,{theme:n,className:r}),b=c===ch.Previous?l.prevRangeAriaLabel:l.nextRangeAriaLabel,y=c===ch.Previous?-12:12,C=b?"string"==typeof b?b:b({fromYear:p+y,toYear:h+y}):void 0,_=c===ch.Previous?void 0!==g&&p<g:void 0!==m&&e.fromYear+12>m,S=function(){c===ch.Previous?null==u||u():null==d||d()},x=jn()?c===ch.Next:c===ch.Previous;return f.createElement("button",{className:qr(v.navigationButton,(t={},t[v.disabled]=_,t)),onClick:_?void 0:S,onKeyDown:_?void 0:function(e){e.which===Gn.enter&&S()},type:"button",title:C,disabled:_},f.createElement(ii,{iconName:x?a.leftNavigation:a.rightNavigation}))};dh.displayName="CalendarYearNavArrow";var ph=function(e){var t=e.styles,o=e.theme,n=e.className,r=ah(t,{theme:o,className:n});return f.createElement("div",{className:r.navigationButtonsContainer},f.createElement(dh,d({},e,{direction:ch.Previous})),f.createElement(dh,d({},e,{direction:ch.Next})))};ph.displayName="CalendarYearNav";var hh=function(e){var t=e.styles,o=e.theme,n=e.className,r=e.fromYear,i=e.toYear,a=e.strings,s=void 0===a?sh:a,l=e.animateBackwards,c=e.animationDirection,u=function(){var t;null===(t=e.onHeaderSelect)||void 0===t||t.call(e,!0)},d=function(t){var o,n;return null!==(n=null===(o=e.onRenderYear)||void 0===o?void 0:o.call(e,t))&&void 0!==n?n:t},p=ah(t,{theme:o,className:n,hasHeaderClickCallback:!!e.onHeaderSelect,animateBackwards:l,animationDirection:c});if(e.onHeaderSelect){var h=s.rangeAriaLabel,m=s.headerAriaLabelFormatString,g=h?"string"==typeof h?h:h(e):void 0,v=m?Bp(m,g):g;return f.createElement("button",{className:p.currentItemButton,onClick:u,onKeyDown:function(e){e.which!==Gn.enter&&e.which!==Gn.space||u()},"aria-label":v,role:"button",type:"button","aria-atomic":!0,"aria-live":"polite"},d(r)," - ",d(i))}return f.createElement("div",{className:p.current},d(r)," - ",d(i))};hh.displayName="CalendarYearTitle";var mh,gh=function(e){var t,o=e.styles,n=e.theme,r=e.className,i=e.animateBackwards,a=e.animationDirection,s=e.onRenderTitle,l=ah(o,{theme:n,className:r,hasHeaderClickCallback:!!e.onHeaderSelect,animateBackwards:i,animationDirection:a});return f.createElement("div",{className:l.headerContainer},null!==(t=null==s?void 0:s(e))&&void 0!==t?t:f.createElement(hh,d({},e)),f.createElement(ph,d({},e)))};gh.displayName="CalendarYearHeader",function(e){e[e.Previous=0]="Previous",e[e.Next=1]="Next"}(mh||(mh={}));var fh=function(e){var t=function(e){var t=e.selectedYear,o=e.navigatedYear,n=t||o||(new Date).getFullYear(),r=10*Math.floor(n/10),i=Ti(r);return i&&i!==r?i>r:void 0}(e),o=function(e){var t=e.selectedYear,o=e.navigatedYear,n=f.useReducer((function(e,t){return e+(t===mh.Next?12:-12)}),void 0,(function(){var e=t||o||(new Date).getFullYear();return 10*Math.floor(e/10)})),r=n[0],i=n[1];return[r,r+12-1,function(){return i(mh.Next)},function(){return i(mh.Previous)}]}(e),n=o[0],r=o[1],i=o[2],a=o[3],s=f.useRef(null);f.useImperativeHandle(e.componentRef,(function(){return{focus:function(){var e,t;null===(t=null===(e=s.current)||void 0===e?void 0:e.focus)||void 0===t||t.call(e)}}}));var l=e.styles,c=e.theme,u=e.className,p=ah(l,{theme:c,className:u});return f.createElement("div",{className:p.root},f.createElement(gh,d({},e,{fromYear:n,toYear:r,onSelectPrev:a,onSelectNext:i,animateBackwards:t})),f.createElement(uh,d({},e,{fromYear:n,toYear:r,animateBackwards:t,componentRef:s})))};fh.displayName="CalendarYearBase";var vh=Vn(fh,(function(e){return th(e)}),void 0,{scope:"CalendarYear"}),bh=Jn(),yh={styles:oh,strings:void 0,navigationIcons:ih,dateTimeFormatter:sp,yearPickerHidden:!1},Ch=function(e){var t,o,n=tr(yh,e),r=function(e){var t=e.componentRef,o=f.useRef(null),n=f.useRef(null),r=f.useRef(!1),i=f.useCallback((function(){n.current?n.current.focus():o.current&&o.current.focus()}),[]);return f.useImperativeHandle(t,(function(){return{focus:i}}),[i]),f.useEffect((function(){r.current&&(i(),r.current=!1)})),[o,n,function(){r.current=!0}]}(n),i=r[0],a=r[1],s=r[2],l=f.useState(!1),c=l[0],u=l[1],d=function(e){var t=e.navigatedDate.getFullYear(),o=Ti(t);return void 0===o||o===t?void 0:o>t}(n),p=n.navigatedDate,h=n.selectedDate,m=n.strings,g=n.today,v=void 0===g?new Date:g,b=n.navigationIcons,y=n.dateTimeFormatter,C=n.minDate,_=n.maxDate,S=n.theme,x=n.styles,k=n.className,w=n.allFocusable,I=n.highlightCurrentMonth,D=n.highlightSelectedMonth,T=n.animationDirection,E=n.yearPickerHidden,P=n.onNavigateDate,R=function(e){return function(){return B(e)}},M=function(){P(hp(p,1),!1)},N=function(){P(hp(p,-1),!1)},B=function(e){var t;null===(t=n.onHeaderSelect)||void 0===t||t.call(n),P(bp(p,e),!0)},F=function(){var e;E?null===(e=n.onHeaderSelect)||void 0===e||e.call(n):(s(),u(!0))},A=b.leftNavigation,L=b.rightNavigation,H=y,O=!C||Cp(C,fp(p))<0,z=!_||Cp(vp(p),_)<0,W=bh(x,{theme:S,className:k,hasHeaderClickCallback:!!n.onHeaderSelect||!E,highlightCurrent:I,highlightSelected:D,animateBackwards:d,animationDirection:T});if(c){var V=function(e){var t=e.strings,o=e.navigatedDate,n=e.dateTimeFormatter,r=function(e){if(n){var t=new Date(o.getTime());return t.setFullYear(e),n.formatYear(t)}return String(e)},i=function(e){return r(e.fromYear)+" - "+r(e.toYear)};return[r,{rangeAriaLabel:i,prevRangeAriaLabel:function(e){return t.prevYearRangeAriaLabel?t.prevYearRangeAriaLabel+" "+i(e):""},nextRangeAriaLabel:function(e){return t.nextYearRangeAriaLabel?t.nextYearRangeAriaLabel+" "+i(e):""},headerAriaLabelFormatString:t.yearPickerHeaderAriaLabel}]}(n),K=V[0],G=V[1];return f.createElement(vh,{key:"calendarYear",minYear:C?C.getFullYear():void 0,maxYear:_?_.getFullYear():void 0,onSelectYear:function(e){if(s(),p.getFullYear()!==e){var t=new Date(p.getTime());t.setFullYear(e),_&&t>_?t=bp(t,_.getMonth()):C&&t<C&&(t=bp(t,C.getMonth())),P(t,!0)}u(!1)},navigationIcons:b,onHeaderSelect:function(e){s(),u(!1)},selectedYear:h?h.getFullYear():p?p.getFullYear():void 0,onRenderYear:K,strings:G,componentRef:a,styles:x,highlightCurrentYear:I,highlightSelectedYear:D,animationDirection:T})}for(var U=[],j=0;j<m.shortMonths.length/4;j++)U.push(j);var q=H.formatYear(p),Y=m.monthPickerHeaderAriaLabel?Bp(m.monthPickerHeaderAriaLabel,q):q;return f.createElement("div",{className:W.root},f.createElement("div",{className:W.headerContainer},f.createElement("button",{className:W.currentItemButton,onClick:F,onKeyDown:Sh(F),"aria-label":Y,"data-is-focusable":!!n.onHeaderSelect||!E,tabIndex:n.onHeaderSelect||!E?0:-1,type:"button","aria-atomic":!0,"aria-live":"polite"},q),f.createElement("div",{className:W.navigationButtonsContainer},f.createElement("button",{className:qr(W.navigationButton,(t={},t[W.disabled]=!O,t)),"aria-disabled":!O,tabIndex:O?void 0:w?0:-1,onClick:O?N:void 0,onKeyDown:O?Sh(N):void 0,title:m.prevYearAriaLabel?m.prevYearAriaLabel+" "+H.formatYear(hp(p,-1)):void 0,type:"button"},f.createElement(ii,{iconName:jn()?L:A})),f.createElement("button",{className:qr(W.navigationButton,(o={},o[W.disabled]=!z,o)),"aria-disabled":!z,tabIndex:z?void 0:w?0:-1,onClick:z?M:void 0,onKeyDown:z?Sh(M):void 0,title:m.nextYearAriaLabel?m.nextYearAriaLabel+" "+H.formatYear(hp(p,1)):void 0,type:"button"},f.createElement(ii,{iconName:jn()?A:L})))),f.createElement(bs,null,f.createElement("div",{className:W.gridContainer,role:"grid","aria-label":q},U.map((function(e){var t=m.shortMonths.slice(4*e,4*(e+1));return f.createElement("div",{key:"monthRow_"+e+p.getFullYear(),role:"row",className:W.buttonRow},t.map((function(t,o){var n,r=4*e+o,a=bp(p,r),s=p.getMonth()===r,l=h.getMonth()===r,c=h.getFullYear()===p.getFullYear(),u=(!C||Cp(C,gp(a))<1)&&(!_||Cp(mp(a),_)<1);return f.createElement("button",{ref:s?i:void 0,role:"gridcell",className:qr(W.itemButton,(n={},n[W.current]=I&&_h(r,p.getFullYear(),v),n[W.selected]=D&&l&&c,n[W.disabled]=!u,n)),disabled:!w&&!u,key:r,onClick:u?R(r):void 0,onKeyDown:u?Sh(R(r)):void 0,"aria-label":H.formatMonth(a,m),"aria-selected":s,"data-is-focusable":!!u||void 0,type:"button"},t)})))})))))};function _h(e,t,o){return o.getFullYear()===t&&o.getMonth()===e}function Sh(e){return function(t){switch(t.which){case Gn.enter:e()}}}Ch.displayName="CalendarMonthBase";var xh=Vn(Ch,oh,void 0,{scope:"CalendarMonth"});function kh(e,t,o){var n=f.useState(t),r=n[0],i=n[1],a=Ei(void 0!==e),s=a?e:r,l=f.useRef(s),c=f.useRef(o);f.useEffect((function(){l.current=s,c.current=o}));var u=Ei((function(){return function(e,t){var o="function"==typeof e?e(l.current):e;c.current&&c.current(t,o),a||i(o)}}));return[s,u]}var wh=Jn(),Ih=[tp.Monday,tp.Tuesday,tp.Wednesday,tp.Thursday,tp.Friday],Dh={isMonthPickerVisible:!0,isDayPickerVisible:!0,showMonthPickerAsOverlay:!1,today:new Date,firstDayOfWeek:tp.Sunday,dateRangeType:rp.Day,showGoToToday:!0,strings:lp,highlightCurrentMonth:!1,highlightSelectedMonth:!1,navigationIcons:ih,showWeekNumbers:!1,firstWeekOfYear:np.FirstDay,dateTimeFormatter:sp,showSixWeeksByDefault:!1,workWeekDays:Ih,showCloseButton:!1,allFocusable:!1},Th=f.forwardRef((function(e,t){var o=tr(Dh,e),n=function(e){var t=e.value,o=e.today,n=void 0===o?new Date:o,r=e.onSelectDate,i=kh(t,n),a=i[0],s=void 0===a?n:a,l=i[1],c=f.useState(t),u=c[0],d=void 0===u?n:u,p=c[1],h=f.useState(t),m=h[0],g=void 0===m?n:m,v=h[1],b=f.useState(t),y=b[0],C=void 0===y?n:y,_=b[1];return t&&C.valueOf()!==t.valueOf()&&(p(t),v(t),_(t)),[s,d,g,function(e,t){v(e),p(e),l(e),null==r||r(e,t)},function(e){v(e),p(e)},function(e){v(e)}]}(o),r=n[0],i=n[1],a=n[2],s=n[3],l=n[4],c=n[5],u=function(e){var t=kh(Eh(e)?void 0:e.isMonthPickerVisible,!1),o=t[0],n=void 0===o||o,r=t[1],i=kh(Eh(e)?void 0:e.isDayPickerVisible,!0),a=i[0],s=void 0===a||a,l=i[1];return[n,s,function(){r(!n),l(!s)}]}(o),p=u[0],h=u[1],m=u[2],g=function(e,t,o){var n=e.componentRef,r=f.useRef(null),i=f.useRef(null),a=f.useRef(!1),s=f.useCallback((function(){t&&r.current?La(r.current):o&&i.current&&La(i.current)}),[t,o]);return f.useImperativeHandle(n,(function(){return{focus:s}}),[s]),f.useEffect((function(){a.current&&(s(),a.current=!1)})),[r,i,function(){a.current=!0}]}(o,h,p),v=g[0],b=g[1],y=g[2],C=function(){var e=D;return e&&G&&(e=i.getFullYear()!==G.getFullYear()||i.getMonth()!==G.getMonth()||a.getFullYear()!==G.getFullYear()||a.getMonth()!==G.getMonth()),D&&f.createElement("button",{className:qr("js-goToday",Y.goTodayButton),onClick:S,onKeyDown:x(S),type:"button",disabled:!e},I.goToToday)},_=Eh(o)?function(){m(),y()}:void 0,S=function(){l(G),y()},x=function(e){return function(t){switch(t.which){case Gn.enter:case Gn.space:e()}}},k=o.firstDayOfWeek,w=o.dateRangeType,I=o.strings,D=o.showGoToToday,T=o.highlightCurrentMonth,E=o.highlightSelectedMonth,P=o.navigationIcons,R=o.minDate,M=o.maxDate,N=o.restrictedDates,B=o.className,F=o.showCloseButton,A=o.allFocusable,L=o.styles,H=o.showWeekNumbers,O=o.theme,z=o.calendarDayProps,W=o.calendarMonthProps,V=o.dateTimeFormatter,K=o.today,G=void 0===K?new Date:K,U=Eh(o),j=!U&&!h,q=U&&D,Y=wh(L,{theme:O,className:B,isMonthPickerVisible:p,isDayPickerVisible:h,monthPickerOnly:j,showMonthPickerAsOverlay:U,overlaidWithButton:q,overlayedWithButton:q,showGoToToday:D,showWeekNumbers:H}),Z="",X="";V&&I.todayDateFormatString&&(Z=Bp(I.todayDateFormatString,V.formatMonthDayYear(G,I))),V&&I.selectedDateFormatString&&(X=Bp(I.selectedDateFormatString,V.formatMonthDayYear(r,I)));var Q=X+", "+Z;return f.createElement("div",{ref:t,role:"group","aria-label":Q,className:qr("ms-DatePicker",Y.root,B,"ms-slideDownIn10"),onKeyDown:function(e){var t;switch(e.which){case Gn.enter:case Gn.backspace:e.preventDefault();break;case Gn.escape:null===(t=o.onDismiss)||void 0===t||t.call(o);break;case Gn.pageUp:e.ctrlKey?l(hp(i,1)):l(pp(i,1)),e.preventDefault();break;case Gn.pageDown:e.ctrlKey?l(hp(i,-1)):l(pp(i,-1)),e.preventDefault()}}},f.createElement("div",{className:Y.liveRegion,"aria-live":"polite","aria-atomic":"true"},f.createElement("span",null,X)),h&&f.createElement(eh,d({selectedDate:r,navigatedDate:i,today:o.today,onSelectDate:s,onNavigateDate:function(e,t){l(e),t&&y()},onDismiss:o.onDismiss,firstDayOfWeek:k,dateRangeType:w,strings:I,onHeaderSelect:_,navigationIcons:P,showWeekNumbers:o.showWeekNumbers,firstWeekOfYear:o.firstWeekOfYear,dateTimeFormatter:o.dateTimeFormatter,showSixWeeksByDefault:o.showSixWeeksByDefault,minDate:R,maxDate:M,restrictedDates:N,workWeekDays:o.workWeekDays,componentRef:v,showCloseButton:F,allFocusable:A},z)),h&&p&&f.createElement("div",{className:Y.divider}),p?f.createElement("div",{className:Y.monthPickerWrapper},f.createElement(xh,d({navigatedDate:a,selectedDate:i,strings:I,onNavigateDate:function(e,t){t&&y(),t?(j&&s(e),l(e)):c(e)},today:o.today,highlightCurrentMonth:T,highlightSelectedMonth:E,onHeaderSelect:_,navigationIcons:P,dateTimeFormatter:o.dateTimeFormatter,minDate:R,maxDate:M,componentRef:b},W)),C()):C(),f.createElement(ws,null))}));function Eh(e){var t=at();return e.showMonthPickerAsOverlay||t&&t.innerWidth<=440}Th.displayName="CalendarBase";var Ph=Vn(Th,(function(e){var t=e.className,o=e.theme,n=e.isDayPickerVisible,r=e.isMonthPickerVisible,i=e.showWeekNumbers,a=o.palette,s=n&&r?440:220;return i&&n&&(s+=30),{root:[on,{display:"flex",width:s},!r&&{flexDirection:"column"},t],divider:{top:0,borderRight:"1px solid",borderColor:a.neutralLight},monthPickerWrapper:[{display:"flex",flexDirection:"column"}],goTodayButton:[To(o,{inset:-1}),{bottom:0,color:a.neutralPrimary,height:30,lineHeight:30,backgroundColor:"transparent",border:"none",boxSizing:"content-box",padding:"0 4px",alignSelf:"flex-end",marginRight:16,marginTop:3,fontSize:je.small,fontFamily:"inherit",overflow:"visible",selectors:{"& div":{fontSize:je.small},"&:hover":{color:a.themePrimary,backgroundColor:"transparent",cursor:"pointer"},"&:active":{color:a.themeDark},"&:disabled":{color:a.neutralTertiaryAlt,pointerEvents:"none"}}}],liveRegion:{border:0,height:"1px",margin:"-1px",overflow:"hidden",padding:0,width:"1px",position:"absolute"}}}),void 0,{scope:"Calendar"});function Rh(e){for(var t,o=[],n=nt(e)||document;e!==n.body;){for(var r=0,i=e.parentElement.children;r<i.length;r++){var a=i[r];a!==e&&"true"!==(null===(t=a.getAttribute("aria-hidden"))||void 0===t?void 0:t.toLowerCase())&&o.push(a)}if(!e.parentElement)break;e=e.parentElement}return o.forEach((function(e){e.setAttribute("aria-hidden","true")})),function(){!function(e){e.forEach((function(e){e.setAttribute("aria-hidden","false")}))}(o),o=[]}}var Mh=f.forwardRef((function(e,t){var o=f.useRef(null),n=f.useRef(null),r=f.useRef(null),i=Or(o,t),a=hu(void 0,e.id),s=Vl(),l=Tr(e,Dr),c=Ei((function(){return{previouslyFocusedElementOutsideTrapZone:void 0,previouslyFocusedElementInTrapZone:void 0,disposeFocusHandler:void 0,disposeClickHandler:void 0,hasFocus:!1,unmodalize:void 0}})),u=e.ariaLabelledBy,p=e.className,h=e.children,m=e.componentRef,g=e.disabled,v=e.disableFirstFocus,b=void 0!==v&&v,y=e.disabled,C=void 0!==y&&y,_=e.elementToFocusOnDismiss,S=e.forceFocusInsideTrap,x=void 0===S||S,k=e.focusPreviouslyFocusedInnerElement,w=e.firstFocusableSelector,I=e.firstFocusableTarget,D=e.ignoreExternalFocusing,T=e.isClickableOutsideFocusTrap,E=void 0!==T&&T,P=e.onFocus,R=e.onBlur,M=e.onFocusCapture,N=e.onBlurCapture,B=e.enableAriaHiddenSiblings,F={"aria-hidden":!0,style:{pointerEvents:"none",position:"fixed"},tabIndex:g?-1:0,"data-is-visible":!0},A=f.useCallback((function(){if(k&&c.previouslyFocusedElementInTrapZone&&_a(o.current,c.previouslyFocusedElementInTrapZone))La(c.previouslyFocusedElementInTrapZone);else{var e="string"==typeof w?w:w&&w(),t=null;o.current&&("string"==typeof I?t=o.current.querySelector(I):I?t=I(o.current):e&&(t=o.current.querySelector("."+e)),t||(t=Ta(o.current,o.current.firstChild,!1,!1,!1,!0))),t&&La(t)}}),[w,I,k,c]),L=f.useCallback((function(e){if(!g){var t=e===c.hasFocus?r.current:n.current;if(o.current){var i=e===c.hasFocus?wa(o.current,t,!0,!1):ka(o.current,t,!0,!1);i&&(i===n.current||i===r.current?A():i.focus())}}}),[g,A,c]),H=f.useCallback((function(e){null==N||N(e);var t=e.relatedTarget;null===e.relatedTarget&&(t=s.activeElement),_a(o.current,t)||(c.hasFocus=!1)}),[s,c,N]),O=f.useCallback((function(e){null==M||M(e),e.target===n.current?L(!0):e.target===r.current&&L(!1),c.hasFocus=!0,e.target!==e.currentTarget&&e.target!==n.current&&e.target!==r.current&&(c.previouslyFocusedElementInTrapZone=e.target)}),[M,c,L]),z=f.useCallback((function(){if(Mh.focusStack=Mh.focusStack.filter((function(e){return a!==e})),s){var e=s.activeElement;D||!c.previouslyFocusedElementOutsideTrapZone||"function"!=typeof c.previouslyFocusedElementOutsideTrapZone.focus||!_a(o.current,e)&&e!==s.body||c.previouslyFocusedElementOutsideTrapZone!==n.current&&c.previouslyFocusedElementOutsideTrapZone!==r.current&&La(c.previouslyFocusedElementOutsideTrapZone)}}),[s,a,D,c]),W=f.useCallback((function(e){if(!g&&Mh.focusStack.length&&a===Mh.focusStack[Mh.focusStack.length-1]){var t=e.target;_a(o.current,t)||(A(),c.hasFocus=!0,e.preventDefault(),e.stopPropagation())}}),[g,a,A,c]),V=f.useCallback((function(e){if(!g&&Mh.focusStack.length&&a===Mh.focusStack[Mh.focusStack.length-1]){var t=e.target;t&&!_a(o.current,t)&&(A(),c.hasFocus=!0,e.preventDefault(),e.stopPropagation())}}),[g,a,A,c]),K=f.useCallback((function(){x&&!c.disposeFocusHandler?c.disposeFocusHandler=nl(window,"focus",W,!0):!x&&c.disposeFocusHandler&&(c.disposeFocusHandler(),c.disposeFocusHandler=void 0),E||c.disposeClickHandler?E&&c.disposeClickHandler&&(c.disposeClickHandler(),c.disposeClickHandler=void 0):c.disposeClickHandler=nl(window,"click",V,!0)}),[V,W,x,E,c]);return f.useEffect((function(){var e=o.current;return K(),function(){g&&!x&&_a(e,null==s?void 0:s.activeElement)||z()}}),[K]),f.useEffect((function(){var e=void 0===x||x,t=void 0!==g&&g;if(!t||e){if(C)return;Mh.focusStack.push(a),c.previouslyFocusedElementOutsideTrapZone=_||s.activeElement,b||_a(o.current,c.previouslyFocusedElementOutsideTrapZone)||A(),!c.unmodalize&&o.current&&B&&(c.unmodalize=Rh(o.current))}else e&&!t||(z(),c.unmodalize&&c.unmodalize());_&&c.previouslyFocusedElementOutsideTrapZone!==_&&(c.previouslyFocusedElementOutsideTrapZone=_)}),[_,x,g]),Nh((function(){c.disposeClickHandler&&(c.disposeClickHandler(),c.disposeClickHandler=void 0),c.disposeFocusHandler&&(c.disposeFocusHandler(),c.disposeFocusHandler=void 0),c.unmodalize&&c.unmodalize(),delete c.previouslyFocusedElementInTrapZone,delete c.previouslyFocusedElementOutsideTrapZone})),function(e,t,o){f.useImperativeHandle(e,(function(){return{get previouslyFocusedElement(){return t},focus:o}}),[t,o])}(m,c.previouslyFocusedElementInTrapZone,A),f.createElement("div",d({},l,{className:p,ref:i,"aria-labelledby":u,onFocusCapture:O,onFocus:P,onBlur:R,onBlurCapture:H}),f.createElement("div",d({},F,{ref:n})),h,f.createElement("div",d({},F,{ref:r})))})),Nh=function(e){var t=f.useRef(e);t.current=e,f.useEffect((function(){return function(){t.current&&t.current()}}),[e])};Mh.displayName="FocusTrapZone",Mh.focusStack=[];var Bh=function(e){return f.createElement(kc,d({},e),f.createElement(Mh,d({disabled:e.hidden},e.focusTrapProps),e.children))},Fh=Jn(),Ah=f.forwardRef((function(e,t){var o=e.checked,n=void 0!==o&&o,r=e.className,i=e.theme,a=e.styles,s=e.useFastIcons,l=void 0===s||s,c=Fh(a,{theme:i,className:r,checked:n}),u=l?ti:ii;return f.createElement("div",{className:c.root,ref:t},f.createElement(u,{iconName:"CircleRing",className:c.circle}),f.createElement(u,{iconName:"StatusCircleCheckmark",className:c.check}))}));Ah.displayName="CheckBase";var Lh={root:"ms-Check",circle:"ms-Check-circle",check:"ms-Check-check",checkHost:"ms-Check-checkHost"},Hh=Vn(Ah,(function(e){var t,o,n,r,i,a=e.height,s=void 0===a?e.checkBoxHeight||"18px":a,l=e.checked,c=e.className,u=e.theme,p=u.palette,h=u.semanticColors,m=u.fonts,g=jn(u),f=Qo(Lh,u),v={fontSize:s,position:"absolute",left:0,top:0,width:s,height:s,textAlign:"center",display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle"};return{root:[f.root,m.medium,{lineHeight:"1",width:s,height:s,verticalAlign:"top",position:"relative",userSelect:"none",selectors:(t={":before":{content:'""',position:"absolute",top:"1px",right:"1px",bottom:"1px",left:"1px",borderRadius:"50%",opacity:1,background:h.bodyBackground}},t["."+f.checkHost+":hover &, ."+f.checkHost+":focus &, &:hover, &:focus"]={opacity:1},t)},l&&["is-checked",{selectors:{":before":{background:p.themePrimary,opacity:1,selectors:(o={},o[ro]={background:"Window"},o)}}}],c],circle:[f.circle,v,{color:p.neutralSecondary,selectors:(n={},n[ro]={color:"WindowText"},n)},l&&{color:p.white}],check:[f.check,v,{opacity:0,color:p.neutralSecondary,fontSize:Ye.medium,left:g?"-0.5px":".5px",top:"-1px",selectors:(r={":hover":{opacity:1}},r[ro]=d({},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),r)},l&&{opacity:1,color:p.white,fontWeight:900,selectors:(i={},i[ro]={border:"none",color:"WindowText"},i)}],checkHost:f.checkHost}}),void 0,{scope:"Check"},!0),Oh=Jn(),zh=f.forwardRef((function(e,t){var o=e.disabled,n=e.required,r=e.inputProps,i=e.name,a=e.ariaLabel,s=e.ariaLabelledBy,l=e.ariaDescribedBy,c=e.ariaPositionInSet,u=e.ariaSetSize,p=e.title,h=e.checkmarkIconProps,m=e.styles,g=e.theme,v=e.className,b=e.boxSide,y=void 0===b?"start":b,C=hu("checkbox-",e.id),_=f.useRef(null),S=Or(_,t),x=f.useRef(null),k=kh(e.checked,e.defaultChecked,e.onChange),w=k[0],I=k[1],D=kh(e.indeterminate,e.defaultIndeterminate),T=D[0],E=D[1];ks(_),function(e){Ri({name:"Checkbox",props:e,mutuallyExclusive:{checked:"defaultChecked",indeterminate:"defaultIndeterminate"}})}(e),function(e,t,o,n){f.useImperativeHandle(e.componentRef,(function(){return{get checked(){return!!t},get indeterminate(){return!!o},focus:function(){n.current&&n.current.focus()}}}),[n,t,o])}(e,w,T,x);var P=Oh(m,{theme:g,className:v,disabled:o,indeterminate:T,checked:w,reversed:"start"!==y,isUsingCustomLabelRender:!!e.onRenderLabel}),R=f.useCallback((function(e){return e&&e.label?f.createElement("span",{className:P.text,title:e.title},e.label):null}),[P.text]),M=e.onRenderLabel||R,N=T?"mixed":void 0,B=d(d({className:P.input,type:"checkbox"},r),{checked:!!w,disabled:o,required:n,name:i,id:C,title:p,onChange:function(e){T?(I(!!w,e),E(!1)):I(!w,e)},"aria-disabled":o,"aria-label":a,"aria-labelledby":s,"aria-describedby":l,"aria-posinset":c,"aria-setsize":u,"aria-checked":N});return f.createElement("div",{className:P.root,title:p,ref:S},f.createElement("input",d({},B,{ref:x,title:p,"data-ktp-execute-target":!0})),f.createElement("label",{className:P.label,htmlFor:C},f.createElement("div",{className:P.checkbox,"data-ktp-target":!0},f.createElement(ii,d({iconName:"CheckMark"},h,{className:P.checkmark}))),M(e,R)))}));zh.displayName="CheckboxBase";var Wh={root:"ms-Checkbox",label:"ms-Checkbox-label",checkbox:"ms-Checkbox-checkbox",checkmark:"ms-Checkbox-checkmark",text:"ms-Checkbox-text"},Vh="20px",Kh="200ms",Gh="cubic-bezier(.4, 0, .23, 1)",Uh=Vn(zh,(function(e){var t,o,n,r,i,a,s,l,c,u,p,h,m,g,f,v,b,y,C=e.className,_=e.theme,S=e.reversed,x=e.checked,k=e.disabled,w=e.isUsingCustomLabelRender,I=e.indeterminate,D=_.semanticColors,T=_.effects,E=_.palette,P=_.fonts,R=Qo(Wh,_),M=D.inputForegroundChecked,N=E.neutralSecondary,B=E.neutralPrimary,F=D.inputBackgroundChecked,A=D.inputBackgroundChecked,L=D.disabledBodySubtext,H=D.inputBorderHovered,O=D.inputBackgroundCheckedHovered,z=D.inputBackgroundChecked,W=D.inputBackgroundCheckedHovered,V=D.inputBackgroundCheckedHovered,K=D.inputTextHovered,G=D.disabledBodySubtext,U=D.bodyText,j=D.disabledText,q=[(t={content:'""',borderRadius:T.roundedCorner2,position:"absolute",width:10,height:10,top:4,left:4,boxSizing:"border-box",borderWidth:5,borderStyle:"solid",borderColor:k?L:F,transitionProperty:"border-width, border, border-color",transitionDuration:Kh,transitionTimingFunction:Gh},t[ro]={borderColor:"WindowText"},t)];return{root:[R.root,{position:"relative",display:"flex"},S&&"reversed",x&&"is-checked",!k&&"is-enabled",k&&"is-disabled",!k&&[!x&&(o={},o[":hover ."+R.checkbox]=(n={borderColor:H},n[ro]={borderColor:"Highlight"},n),o[":focus ."+R.checkbox]={borderColor:H},o[":hover ."+R.checkmark]=(r={color:N,opacity:"1"},r[ro]={color:"Highlight"},r),o),x&&!I&&(i={},i[":hover ."+R.checkbox]={background:W,borderColor:V},i[":focus ."+R.checkbox]={background:W,borderColor:V},i[ro]=(a={},a[":hover ."+R.checkbox]={background:"Highlight",borderColor:"Highlight"},a[":focus ."+R.checkbox]={background:"Highlight"},a[":focus:hover ."+R.checkbox]={background:"Highlight"},a[":focus:hover ."+R.checkmark]={color:"Window"},a[":hover ."+R.checkmark]={color:"Window"},a),i),I&&(s={},s[":hover ."+R.checkbox+", :hover ."+R.checkbox+":after"]=(l={borderColor:O},l[ro]={borderColor:"WindowText"},l),s[":focus ."+R.checkbox]={borderColor:O},s[":hover ."+R.checkmark]={opacity:"0"},s),(c={},c[":hover ."+R.text+", :focus ."+R.text]=(u={color:K},u[ro]={color:k?"GrayText":"WindowText"},u),c)],C],input:(p={position:"absolute",background:"none",opacity:0},p["."+wo+" &:focus + label::before"]=(h={outline:"1px solid "+_.palette.neutralSecondary,outlineOffset:"2px"},h[ro]={outline:"1px solid WindowText"},h),p),label:[R.label,_.fonts.medium,{display:"flex",alignItems:w?"center":"flex-start",cursor:k?"default":"pointer",position:"relative",userSelect:"none"},S&&{flexDirection:"row-reverse",justifyContent:"flex-end"},{"&::before":{position:"absolute",left:0,right:0,top:0,bottom:0,content:'""',pointerEvents:"none"}}],checkbox:[R.checkbox,(m={position:"relative",display:"flex",flexShrink:0,alignItems:"center",justifyContent:"center",height:Vh,width:Vh,border:"1px solid "+B,borderRadius:T.roundedCorner2,boxSizing:"border-box",transitionProperty:"background, border, border-color",transitionDuration:Kh,transitionTimingFunction:Gh,overflow:"hidden",":after":I?q:null},m[ro]=d({borderColor:"WindowText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),m),I&&{borderColor:F},S?{marginLeft:4}:{marginRight:4},!k&&!I&&x&&(g={background:z,borderColor:A},g[ro]={background:"Highlight",borderColor:"Highlight"},g),k&&(f={borderColor:L},f[ro]={borderColor:"GrayText"},f),x&&k&&(v={background:G,borderColor:L},v[ro]={background:"Window"},v)],checkmark:[R.checkmark,(b={opacity:x?"1":"0",color:M},b[ro]=d({color:k?"GrayText":"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),b)],text:[R.text,(y={color:k?j:U,fontSize:P.medium.fontSize,lineHeight:"20px"},y[ro]=d({color:k?"GrayText":"WindowText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),y),S?{marginRight:4}:{marginLeft:4}]}}),void 0,{scope:"Checkbox"}),jh=Jn({cacheSize:100}),qh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.as,o=void 0===t?"label":t,n=e.children,r=e.className,i=e.disabled,a=e.styles,s=e.required,l=e.theme,c=jh(a,{className:r,disabled:i,required:s,theme:l});return f.createElement(o,d({},Tr(this.props,Dr),{className:c.root}),n)},t}(f.Component),Yh=Vn(qh,(function(e){var t,o=e.theme,n=e.className,r=e.disabled,i=e.required,a=o.semanticColors,s=qe.semibold,l=a.bodyText,c=a.disabledBodyText,u=a.errorText;return{root:["ms-Label",o.fonts.medium,{fontWeight:s,color:l,boxSizing:"border-box",boxShadow:"none",margin:0,display:"block",padding:"5px 0",wordWrap:"break-word",overflowWrap:"break-word"},r&&{color:c,selectors:(t={},t[ro]=d({color:"GrayText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),t)},i&&{selectors:{"::after":{content:"' *'",color:u,paddingRight:12}}},n]}}),void 0,{scope:"Label"}),Zh=qo((function(e){return qo((function(t){var o=qo((function(e){return function(o){return t(o,e)}}));return function(n,r){return e(n,r?o(r):t)}}))}));function Xh(e,t){return Zh(e)(t)}var Qh=Jn(),Jh={imageSize:{width:32,height:32}},$h=function(e){var t=tr(d(d({},Jh),{key:e.itemKey}),e),o=t.ariaLabel,n=t.focused,r=t.required,i=t.theme,a=t.iconProps,s=t.imageSrc,l=t.imageSize,c=t.disabled,u=t.checked,h=t.id,m=t.styles,g=t.name,v=p(t,["ariaLabel","focused","required","theme","iconProps","imageSrc","imageSize","disabled","checked","id","styles","name"]),b=Qh(m,{theme:i,hasIcon:!!a,hasImage:!!s,checked:u,disabled:c,imageIsLarge:!!s&&(l.width>71||l.height>71),imageSize:l,focused:n}),y=Tr(v,hr),C=y.className,_=p(y,["className"]),S=function(){return f.createElement("span",{id:t.labelId,className:"ms-ChoiceFieldLabel"},t.text)},x=function(){var e=t.imageAlt,o=void 0===e?"":e,n=t.selectedImageSrc,r=(t.onRenderLabel?Xh(t.onRenderLabel,S):S)(t);return f.createElement("label",{htmlFor:h,className:b.field},s&&f.createElement("div",{className:b.innerField},f.createElement("div",{className:b.imageWrapper},f.createElement(Gr,d({src:s,alt:o},l))),f.createElement("div",{className:b.selectedImageWrapper},f.createElement(Gr,d({src:n,alt:o},l)))),a&&f.createElement("div",{className:b.innerField},f.createElement("div",{className:b.iconWrapper},f.createElement(ii,d({},a)))),s||a?f.createElement("div",{className:b.labelWrapper},r):r)},k=t.onRenderField,w=void 0===k?x:k;return f.createElement("div",{className:b.root},f.createElement("div",{className:b.choiceFieldWrapper},f.createElement("input",d({"aria-label":o,id:h,className:qr(b.input,C),type:"radio",name:g,disabled:c,checked:u,required:r},_,{onChange:function(e){var o;null===(o=t.onChange)||void 0===o||o.call(t,e,t)},onFocus:function(e){var o;null===(o=t.onFocus)||void 0===o||o.call(t,e,t)},onBlur:function(e){var o;null===(o=t.onBlur)||void 0===o||o.call(t,e)}})),w(t,x)))};$h.displayName="ChoiceGroupOption";var em={root:"ms-ChoiceField",choiceFieldWrapper:"ms-ChoiceField-wrapper",input:"ms-ChoiceField-input",field:"ms-ChoiceField-field",innerField:"ms-ChoiceField-innerField",imageWrapper:"ms-ChoiceField-imageWrapper",iconWrapper:"ms-ChoiceField-iconWrapper",labelWrapper:"ms-ChoiceField-labelWrapper",checked:"is-checked"},tm="200ms",om="cubic-bezier(.4, 0, .23, 1)";function nm(e,t){var o,n;return["is-inFocus",{selectors:(o={},o["."+wo+" &"]={position:"relative",outline:"transparent",selectors:{"::-moz-focus-inner":{border:0},":after":{content:'""',top:-2,right:-2,bottom:-2,left:-2,pointerEvents:"none",border:"1px solid "+e,position:"absolute",selectors:(n={},n[ro]={borderColor:"WindowText",borderWidth:t?1:2},n)}}},o)}]}function rm(e,t,o){return[t,{paddingBottom:2,transitionProperty:"opacity",transitionDuration:tm,transitionTimingFunction:"ease",selectors:{".ms-Image":{display:"inline-block",borderStyle:"none"}}},(o?!e:e)&&["is-hidden",{position:"absolute",left:0,top:0,width:"100%",height:"100%",overflow:"hidden",opacity:0}]]}var im=Vn($h,(function(e){var t,o,n,r,i,a=e.theme,s=e.hasIcon,l=e.hasImage,c=e.checked,u=e.disabled,p=e.imageIsLarge,h=e.focused,m=e.imageSize,g=a.palette,f=a.semanticColors,v=a.fonts,b=Qo(em,a),y=g.neutralPrimary,C=f.inputBorderHovered,_=f.inputBackgroundChecked,S=g.themeDark,x=f.disabledBodySubtext,k=f.bodyBackground,w=g.neutralSecondary,I=f.inputBackgroundChecked,D=g.themeDark,T=f.disabledBodySubtext,E=g.neutralDark,P=f.focusBorder,R=f.inputBorderHovered,M=f.inputBackgroundChecked,N=g.themeDark,B=g.neutralLighter,F={selectors:{".ms-ChoiceFieldLabel":{color:E},":before":{borderColor:c?S:C},":after":[!s&&!l&&!c&&{content:'""',transitionProperty:"background-color",left:5,top:5,width:10,height:10,backgroundColor:w},c&&{borderColor:D,background:D}]}},A={borderColor:c?N:R,selectors:{":before":{opacity:1,borderColor:c?S:C}}},L=[{content:'""',display:"inline-block",backgroundColor:k,borderWidth:1,borderStyle:"solid",borderColor:y,width:20,height:20,fontWeight:"normal",position:"absolute",top:0,left:0,boxSizing:"border-box",transitionProperty:"border-color",transitionDuration:tm,transitionTimingFunction:om,borderRadius:"50%"},u&&{borderColor:x,selectors:(t={},t[ro]=d({borderColor:"GrayText",background:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),t)},c&&{borderColor:u?x:_,selectors:(o={},o[ro]={borderColor:"Highlight",background:"Window",forcedColorAdjust:"none"},o)},(s||l)&&{top:3,right:3,left:"auto",opacity:c?1:0}],H=[{content:'""',width:0,height:0,borderRadius:"50%",position:"absolute",left:10,right:0,transitionProperty:"border-width",transitionDuration:tm,transitionTimingFunction:om,boxSizing:"border-box"},c&&{borderWidth:5,borderStyle:"solid",borderColor:u?T:I,background:I,left:5,top:5,width:10,height:10,selectors:(n={},n[ro]={borderColor:"Highlight",forcedColorAdjust:"none"},n)},c&&(s||l)&&{top:8,right:8,left:"auto"}];return{root:[b.root,a.fonts.medium,{display:"flex",alignItems:"center",boxSizing:"border-box",color:f.bodyText,minHeight:26,border:"none",position:"relative",marginTop:8,selectors:{".ms-ChoiceFieldLabel":{display:"inline-block"}}},!s&&!l&&{selectors:{".ms-ChoiceFieldLabel":{paddingLeft:"26px"}}},l&&"ms-ChoiceField--image",s&&"ms-ChoiceField--icon",(s||l)&&{display:"inline-flex",fontSize:0,margin:"0 4px 4px 0",paddingLeft:0,backgroundColor:B,height:"100%"}],choiceFieldWrapper:[b.choiceFieldWrapper,h&&nm(P,s||l)],input:[b.input,{position:"absolute",opacity:0,top:0,right:0,width:"100%",height:"100%",margin:0},u&&"is-disabled"],field:[b.field,c&&b.checked,{display:"inline-block",cursor:"pointer",marginTop:0,position:"relative",verticalAlign:"top",userSelect:"none",minHeight:20,selectors:{":hover":!u&&F,":focus":!u&&F,":before":L,":after":H}},s&&"ms-ChoiceField--icon",l&&"ms-ChoiceField-field--image",(s||l)&&{boxSizing:"content-box",cursor:"pointer",paddingTop:22,margin:0,textAlign:"center",transitionProperty:"all",transitionDuration:tm,transitionTimingFunction:"ease",border:"1px solid transparent",justifyContent:"center",alignItems:"center",display:"flex",flexDirection:"column"},c&&{borderColor:M},(s||l)&&!u&&{selectors:{":hover":A,":focus":A}},u&&{cursor:"default",selectors:{".ms-ChoiceFieldLabel":{color:f.disabledBodyText,selectors:(r={},r[ro]=d({color:"GrayText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),r)}}},c&&u&&{borderColor:B}],innerField:[b.innerField,l&&{height:m.height,width:m.width},(s||l)&&{position:"relative",display:"inline-block",paddingLeft:30,paddingRight:30},(s||l)&&p&&{paddingLeft:24,paddingRight:24},(s||l)&&u&&{opacity:.25,selectors:(i={},i[ro]={color:"GrayText",opacity:1},i)}],imageWrapper:rm(!1,b.imageWrapper,c),selectedImageWrapper:rm(!0,b.imageWrapper,c),iconWrapper:[b.iconWrapper,{fontSize:32,lineHeight:32,height:32}],labelWrapper:[b.labelWrapper,v.medium,(s||l)&&{display:"block",position:"relative",margin:"4px 8px 2px 8px",height:32,lineHeight:15,maxWidth:2*m.width,overflow:"hidden",whiteSpace:"pre-wrap"}]}}),void 0,{scope:"ChoiceGroupOption"}),am=Jn(),sm=function(e,t){return t+"-"+e.key},lm=function(e,t){return void 0===t?void 0:aa(e,(function(e){return e.key===t}))},cm="ChoiceGroup",um=f.forwardRef((function(e,t){var o=e.className,n=e.theme,r=e.styles,i=e.options,a=void 0===i?[]:i,s=e.label,l=e.required,c=e.disabled,u=e.name,p=e.defaultSelectedKey,h=e.componentRef,m=e.onChange,g=hu("ChoiceGroup"),v=hu("ChoiceGroupLabel"),b=Tr(e,Dr,["onChange","className","required"]),y=am(r,{theme:n,className:o,optionsContainIconOrImage:a.some((function(e){return!(!e.iconProps&&!e.imageSrc)}))}),C=e.ariaLabelledBy||(s?v:e["aria-labelledby"]),_=kh(e.selectedKey,p),S=_[0],x=_[1],k=f.useState(),w=k[0],I=k[1];!function(e){Ri({name:cm,props:e,mutuallyExclusive:{selectedKey:"defaultSelectedKey"}})}(e),function(e,t,o,n){f.useImperativeHandle(n,(function(){return{get checkedOption(){return lm(e,t)},focus:function(){var n=lm(e,t)||e.filter((function(e){return!e.disabled}))[0],r=n&&document.getElementById(sm(n,o));r&&(r.focus(),Do(!0,r))}}}),[e,t,o])}(a,S,g,h);var D=f.useCallback((function(e,t){var o;t&&(I(t.itemKey),null===(o=t.onFocus)||void 0===o||o.call(t,e))}),[]),T=f.useCallback((function(e,t){var o;I(void 0),null===(o=null==t?void 0:t.onBlur)||void 0===o||o.call(t,e)}),[]),E=f.useCallback((function(e,t){var o;t&&(x(t.itemKey),null===(o=t.onChange)||void 0===o||o.call(t,e),null==m||m(e,lm(a,t.itemKey)))}),[m,a,x]);return f.createElement("div",d({className:y.root},b,{ref:t}),f.createElement("div",d({role:"radiogroup"},C&&{"aria-labelledby":C}),s&&f.createElement(Yh,{className:y.label,required:l,id:v,disabled:c},s),f.createElement("div",{className:y.flexContainer},a.map((function(e){return f.createElement(im,d({itemKey:e.key},e,{key:e.key,onBlur:T,onFocus:D,onChange:E,focused:e.key===w,checked:e.key===S,disabled:e.disabled||c,id:sm(e,g),labelId:e.labelId||v+"-"+e.key,name:u||g,required:l}))})))))}));um.displayName=cm;var dm,pm={root:"ms-ChoiceFieldGroup",flexContainer:"ms-ChoiceFieldGroup-flexContainer"},hm=Vn(um,(function(e){var t=e.className,o=e.optionsContainIconOrImage,n=e.theme,r=Qo(pm,n);return{root:[t,r.root,n.fonts.medium,{display:"block"}],flexContainer:[r.flexContainer,o&&{display:"flex",flexDirection:"row",flexWrap:"wrap"}]}}),void 0,{scope:"ChoiceGroup"}),mm=jo((function(){return J({"0%":{transform:"translate(0, 0)",animationTimingFunction:"linear"},"78.57%":{transform:"translate(0, 0)",animationTimingFunction:"cubic-bezier(0.62, 0, 0.56, 1)"},"82.14%":{transform:"translate(0, -5px)",animationTimingFunction:"cubic-bezier(0.58, 0, 0, 1)"},"84.88%":{transform:"translate(0, 9px)",animationTimingFunction:"cubic-bezier(1, 0, 0.56, 1)"},"88.1%":{transform:"translate(0, -2px)",animationTimingFunction:"cubic-bezier(0.58, 0, 0.67, 1)"},"90.12%":{transform:"translate(0, 0)",animationTimingFunction:"linear"},"100%":{transform:"translate(0, 0)"}})})),gm=jo((function(){return J({"0%":{transform:" scale(0)",animationTimingFunction:"linear"},"14.29%":{transform:"scale(0)",animationTimingFunction:"cubic-bezier(0.84, 0, 0.52, 0.99)"},"16.67%":{transform:"scale(1.15)",animationTimingFunction:"cubic-bezier(0.48, -0.01, 0.52, 1.01)"},"19.05%":{transform:"scale(0.95)",animationTimingFunction:"cubic-bezier(0.48, 0.02, 0.52, 0.98)"},"21.43%":{transform:"scale(1)",animationTimingFunction:"linear"},"42.86%":{transform:"scale(1)",animationTimingFunction:"cubic-bezier(0.48, -0.02, 0.52, 1.02)"},"45.71%":{transform:"scale(0.8)",animationTimingFunction:"cubic-bezier(0.48, 0.01, 0.52, 0.99)"},"50%":{transform:"scale(1)",animationTimingFunction:"linear"},"90.12%":{transform:"scale(1)",animationTimingFunction:"cubic-bezier(0.48, -0.02, 0.52, 1.02)"},"92.98%":{transform:"scale(0.8)",animationTimingFunction:"cubic-bezier(0.48, 0.01, 0.52, 0.99)"},"97.26%":{transform:"scale(1)",animationTimingFunction:"linear"},"100%":{transform:"scale(1)"}})})),fm=jo((function(){return J({"0%":{transform:"rotate(0deg)",animationTimingFunction:"linear"},"83.33%":{transform:" rotate(0deg)",animationTimingFunction:"cubic-bezier(0.33, 0, 0.67, 1)"},"83.93%":{transform:"rotate(15deg)",animationTimingFunction:"cubic-bezier(0.33, 0, 0.67, 1)"},"84.52%":{transform:"rotate(-15deg)",animationTimingFunction:"cubic-bezier(0.33, 0, 0.67, 1)"},"85.12%":{transform:"rotate(15deg)",animationTimingFunction:"cubic-bezier(0.33, 0, 0.67, 1)"},"85.71%":{transform:"rotate(-15deg)",animationTimingFunction:"cubic-bezier(0.33, 0, 0.67, 1)"},"86.31%":{transform:"rotate(0deg)",animationTimingFunction:"linear"},"100%":{transform:"rotate(0deg)"}})})),vm=jo((function(){var e;return In({root:[{position:"absolute",boxSizing:"border-box",border:"1px solid ${}",selectors:(e={},e[ro]={border:"1px solid WindowText"},e)},{selectors:{"&::-moz-focus-inner":{border:0},"&":{outline:"transparent"}}}],container:{position:"relative"},main:{backgroundColor:"#ffffff",overflowX:"hidden",overflowY:"hidden",position:"relative"},overFlowYHidden:{overflowY:"hidden"}})})),bm={opacity:0},ym=((dm={})[Xs.top]="slideUpIn20",dm[Xs.bottom]="slideDownIn20",dm[Xs.left]="slideLeftIn20",dm[Xs.right]="slideRightIn20",dm),Cm={preventDismissOnScroll:!1,offsetFromTarget:0,minPagePadding:8,directionalHint:Ys.bottomAutoEdge};function _m(e,t){var o=e.finalHeight,n=f.useState(0),r=n[0],i=n[1],a=Hl(),s=f.useRef(0),l=function(){t&&o&&(s.current=a.requestAnimationFrame((function(){if(t.current){var e=t.current.lastChild,n=e.scrollHeight,c=e.offsetHeight;i(r+(n-c)),e.offsetHeight<o?l():a.cancelAnimationFrame(s.current)}})))};return f.useEffect(l,[o]),r}var Sm=f.forwardRef((function(e,t){var o=tr(Cm,e),n=f.useRef(null),r=f.useRef(null),i=Or(t,r),a=Yl(o.target,r),s=a[0],l=a[1],c=function(e,t){var o=f.useRef();return function(){if(!o.current){var n=e.bounds;n||(n={top:0+e.minPagePadding,left:0+e.minPagePadding,right:t.innerWidth-e.minPagePadding,bottom:t.innerHeight-e.minPagePadding,width:t.innerWidth-2*e.minPagePadding,height:t.innerHeight-2*e.minPagePadding}),o.current=n}return o.current}}(o,l),u=function(e,t,o,n,r){var i=Hl(),a=f.useState(),s=a[0],l=a[1],c=f.useRef(0),u=function(){i.requestAnimationFrame((function(){return p()}))},p=function(){var i=e.offsetFromTarget,a=e.onPositioned,u=t.current,p=o.current;if(u&&p){var h=d({},e);h.bounds=r(),h.target=n.current;var m=h.target;if(m)if(!m.getBoundingClientRect&&!m.preventDefault||document.body.contains(m)){h.gapSpace=i;var g=Ml(h,u,p);!s&&g||s&&g&&!function(e,t){return function(e,t){for(var o in t)if(t.hasOwnProperty(o)){var n=e[o],r=t[o];if(n&&r&&n.toFixed(2)!==r.toFixed(2))return!1}return!0}(e.elementPosition,t.elementPosition)}(s,g)&&c.current<5?(c.current++,l(g),null==a||a(g)):(c.current=0,null==a||a(g))}else void 0!==s&&l(void 0);else void 0!==s&&l(void 0)}};return f.useEffect(u),[s,u]}(o,r,n,s,c),p=u[0],h=u[1],m=function(e,t,o){var n=e.directionalHintFixed,r=e.offsetFromTarget,i=e.directionalHint,a=e.target,s=f.useRef();return"string"==typeof a&&(s.current=void 0),f.useEffect((function(){s.current=void 0}),[a,r]),function(){if(!s.current)if(n&&t.current){var e=r||0;s.current=Fl(t.current,i,e,o())}else s.current=o().height-2;return s.current}}(o,s,c),g=_m(o,n);if(function(e,t,o){var n=e.setInitialFocus,r=f.useRef(!1);f.useEffect((function(){!r.current&&t.current&&n&&o&&(r.current=!0,Ia(t.current))}))}(o,n,p),function(e,t,o,n,r,i){var a=e.onDismiss,s=e.preventDismissOnScroll,l=Hl(),c=f.useCallback((function(e){a?a(e):i()}),[a,i]),u=f.useCallback((function(e){var r=e.target,i=t.current&&!_a(t.current,r);(!n.current&&i||e.target!==o&&i&&(n.current.stopPropagation||!n.current||r!==n.current&&!_a(n.current,r)))&&c(e)}),[c,t,n,o]),d=f.useCallback((function(e){r&&!s&&u(e)}),[u,r,s]);f.useEffect((function(){var e=new zs({});return l.setTimeout((function(){var t,n;e.on(o,"scroll",l.throttle(d,10),!0),e.on(o,"resize",l.throttle(c,10),!0),e.on(null===(t=null==o?void 0:o.document)||void 0===t?void 0:t.body,"focus",u,!0),e.on(null===(n=null==o?void 0:o.document)||void 0===n?void 0:n.body,"click",u,!0)}),0),function(){return e.dispose()}}),[d])}(o,r,l,s,p,h),f.useEffect((function(){var e;return null===(e=o.onLayerMounted)||void 0===e?void 0:e.call(o)}),[]),!l)return null;var v=o.className,b=o.doNotLayer,y=o.positioningContainerWidth,C=o.positioningContainerMaxHeight,_=o.children,S=vm(),x=p&&p.targetEdge?Ze[ym[p.targetEdge]]:"",k=m()+g,w=C&&C>k?k:C,I=f.createElement("div",{ref:i,className:qr("ms-PositioningContainer",S.container)},f.createElement("div",{className:Z("ms-PositioningContainer-layerHost",S.root,v,x,!!y&&{width:y},b&&{zIndex:ko.Layer}),style:p?p.elementPosition:bm,tabIndex:-1,ref:n},_,w));return b?I:f.createElement(xc,null,I)}));function xm(e){var t;return{root:[{position:"absolute",boxShadow:"inherit",border:"none",boxSizing:"border-box",transform:e.transform,width:e.width,height:e.height,left:e.left,top:e.top,right:e.right,bottom:e.bottom}],beak:{fill:e.color,display:"block",selectors:(t={},t[ro]={fill:"windowtext"},t)}}}Sm.displayName="PositioningContainer";var km=f.forwardRef((function(e,t){var o,n,r,i,a,s,l=e.left,c=e.top,u=e.bottom,d=e.right,p=e.color,h=e.direction,m=void 0===h?Xs.top:h;switch(m===Xs.top||m===Xs.bottom?(o=10,n=18):(o=18,n=10),m){case Xs.top:default:r="9, 0",i="18, 10",a="0, 10",s="translateY(-100%)";break;case Xs.right:r="0, 0",i="10, 10",a="0, 18",s="translateX(100%)";break;case Xs.bottom:r="0, 0",i="18, 0",a="9, 10",s="translateY(100%)";break;case Xs.left:r="10, 0",i="0, 10",a="10, 18",s="translateX(-100%)"}var g=Jn()(xm,{left:l,top:c,bottom:u,right:d,height:o+"px",width:n+"px",transform:s,color:p});return f.createElement("div",{className:g.root,role:"presentation",ref:t},f.createElement("svg",{height:o,width:n,className:g.beak},f.createElement("polygon",{points:r+" "+i+" "+a})))}));km.displayName="Beak";var wm=function(){var e=Ei({});return f.useEffect((function(){return function(){for(var t=0,o=Object.keys(e);t<o.length;t++){var n=o[t];clearTimeout(n)}}}),[e]),Ei({setTimeout:function(t,o){var n=setTimeout(t,o);return e[n]=1,n},clearTimeout:function(t){delete e[t],clearTimeout(t)}})},Im=Jn(),Dm="data-coachmarkid",Tm={isCollapsed:!0,mouseProximityOffset:10,delayBeforeMouseOpen:3600,delayBeforeCoachmarkAnimation:0,isPositionForced:!0,positioningContainerProps:{directionalHint:Ys.bottomAutoEdge}},Em="CoachmarkBase",Pm=f.forwardRef((function(e,t){var o=tr(Tm,e),n=f.useRef(null),r=f.useRef(null),i=function(){var e=Hl(),t=f.useState(),o=t[0],n=t[1],r=f.useState(),i=r[0],a=r[1];return[o,i,function(t){var o=t.alignmentEdge,r=t.targetEdge;return e.requestAnimationFrame((function(){n(o),a(r)}))}]}(),a=i[0],s=i[1],l=i[2],c=function(e,t){var o=e.isCollapsed,n=e.onAnimationOpenStart,r=e.onAnimationOpenEnd,i=f.useState(!!o),a=i[0],s=i[1],l=wm().setTimeout,c=f.useRef(!a),u=f.useCallback((function(){var e,o;c.current||(s(!1),null==n||n(),null===(o=null===(e=t.current)||void 0===e?void 0:e.addEventListener)||void 0===o||o.call(e,"transitionend",(function(){l((function(){t.current&&Ia(t.current)}),1e3),null==r||r()})),c.current=!0)}),[t,r,n,l]);return f.useEffect((function(){o||u()}),[o]),[a,u]}(o,n),u=c[0],p=c[1],h=function(e,t,o){var n=jn(e.theme);return f.useMemo((function(){var e,r,i=void 0===o?Xs.bottom:Al(o),a={direction:i},s="3px";switch(i){case Xs.top:case Xs.bottom:t?t===Xs.left?(a.left="7px",e="left"):(a.right="7px",e="right"):(a.left="calc(50% - 9px)",e="center"),i===Xs.top?(a.top=s,r="top"):(a.bottom=s,r="bottom");break;case Xs.left:case Xs.right:t?t===Xs.top?(a.top="7px",r="top"):(a.bottom="7px",r="bottom"):(a.top="calc(50% - 9px)",r="center"),i===Xs.left?(n?a.right=s:a.left=s,e="left"):(n?a.left=s:a.right=s,e="right")}return[a,e+" "+r]}),[t,o,n])}(o,a,s),m=h[0],g=h[1],v=function(e,t){var o=f.useState(!!e.isCollapsed),n=o[0],r=o[1],i=f.useState(e.isCollapsed?{width:0,height:0}:{}),a=i[0],s=i[1],l=Hl();return f.useEffect((function(){l.requestAnimationFrame((function(){t.current&&(s({width:t.current.offsetWidth,height:t.current.offsetHeight}),r(!1))}))}),[]),[n,a]}(o,n),b=v[0],y=v[1],C=function(e){var t=e.ariaAlertText,o=Hl(),n=f.useState(),r=n[0],i=n[1];return f.useEffect((function(){o.requestAnimationFrame((function(){i(t)}))}),[]),r}(o),_=function(e){var t=e.preventFocusOnMount,o=wm().setTimeout,n=f.useRef(null);return f.useEffect((function(){t||o((function(){var e;return null===(e=n.current)||void 0===e?void 0:e.focus()}),1e3)}),[]),n}(o);!function(e,t,o){var n,r=null===(n=nt())||void 0===n?void 0:n.documentElement;Ol(r,"keydown",(function(e){var n,r;(e.altKey&&e.which===Gn.c||e.which===Gn.enter&&(null===(r=null===(n=t.current)||void 0===n?void 0:n.contains)||void 0===r?void 0:r.call(n,e.target)))&&o()}),!0);var i=function(o){var n;if(e.preventDismissOnLostFocus){var r=o.target,i=t.current&&!_a(t.current,r),a=e.target;i&&r!==a&&!_a(a,r)&&(null===(n=e.onDismiss)||void 0===n||n.call(e,o))}};Ol(r,"click",i,!0),Ol(r,"focus",i,!0)}(o,r,p),function(e){var t=e.onDismiss;f.useImperativeHandle(e.componentRef,(function(e){return{dismiss:function(){null==t||t(e)}}}),[t])}(o),function(e,t,o){var n=wm(),r=n.setTimeout,i=n.clearTimeout,a=f.useRef();f.useEffect((function(){var n=function(){t.current&&(a.current=t.current.getBoundingClientRect())},s=new zs({});return r((function(){var t=e.mouseProximityOffset,l=void 0===t?0:t,c=[];r((function(){n(),s.on(window,"resize",(function(){c.forEach((function(e){i(e)})),c.splice(0,c.length),c.push(r((function(){n()}),100))}))}),10),s.on(document,"mousemove",(function(t){var r,i=t.clientY,s=t.clientX;n(),function(e,t,o,n){return void 0===n&&(n=0),t>e.left-n&&t<e.left+e.width+n&&o>e.top-n&&o<e.top+e.height+n}(a.current,s,i,l)&&o(),null===(r=e.onMouseMove)||void 0===r||r.call(e,t)}))}),e.delayBeforeMouseOpen),function(){return s.dispose()}}),[])}(o,r,p),function(e){Ri({name:Em,props:e,deprecations:{teachingBubbleRef:void 0,collapsed:"isCollapsed",beakWidth:void 0,beakHeight:void 0,width:void 0,height:void 0}})}(o);var S=o.beaconColorOne,x=o.beaconColorTwo,k=o.children,w=o.target,I=o.color,D=o.positioningContainerProps,T=o.ariaDescribedBy,E=o.ariaDescribedByText,P=o.ariaLabelledBy,R=o.ariaLabelledByText,M=o.ariaAlertText,N=o.delayBeforeCoachmarkAnimation,B=o.styles,F=o.theme,A=o.className,L=o.persistentBeak,H=I;!H&&F&&(H=F.semanticColors.primaryButtonBackground);var O=Im(B,{theme:F,beaconColorOne:S,beaconColorTwo:x,className:A,isCollapsed:u,isMeasuring:b,color:H,transformOrigin:g,entityHostHeight:void 0===y.height?void 0:y.height+"px",entityHostWidth:void 0===y.width?void 0:y.width+"px",width:"32px",height:"32px",delayBeforeCoachmarkAnimation:N+"ms"}),z=u?32:y.height;return f.createElement(Sm,d({target:w,offsetFromTarget:10,finalHeight:z,ref:t,onPositioned:l,bounds:Rm(o)},D),f.createElement("div",{className:O.root},M&&f.createElement("div",{className:O.ariaContainer,role:"alert","aria-hidden":!u},C),f.createElement("div",{className:O.pulsingBeacon}),f.createElement("div",{className:O.translateAnimationContainer,ref:r},f.createElement("div",{className:O.scaleAnimationLayer},f.createElement("div",{className:O.rotateAnimationLayer},(u||L)&&f.createElement(km,d({},m,{color:H})),f.createElement("div",{className:O.entityHost,ref:_,tabIndex:-1,"data-is-focusable":!0,role:"dialog","aria-labelledby":P,"aria-describedby":T},u&&[P&&f.createElement("p",{id:P,key:0,className:O.ariaContainer},R),T&&f.createElement("p",{id:T,key:1,className:O.ariaContainer},E)],f.createElement(Mh,{isClickableOutsideFocusTrap:!0,forceFocusInsideTrap:!1},f.createElement("div",{className:O.entityInnerHost,ref:n},f.createElement("div",{className:O.childrenContainer,"aria-hidden":u},k)))))))))}));function Rm(e){var t=e.isPositionForced,o=e.positioningContainerProps;return t?!o||o.directionalHint!==Ys.topAutoEdge&&o.directionalHint!==Ys.bottomAutoEdge?{left:-1/0,top:-1/0,bottom:1/0,right:1/0,width:1/0,height:1/0}:{left:0,top:-1/0,bottom:1/0,right:window.innerWidth,width:window.innerWidth,height:1/0}:void 0}Pm.displayName=Em;var Mm=Vn(Pm,(function(e){var t,o=e.theme,n=e.className,r=e.color,i=e.beaconColorOne,a=e.beaconColorTwo,s=e.delayBeforeCoachmarkAnimation,l=e.isCollapsed,c=e.isMeasuring,u=e.entityHostHeight,d=e.entityHostWidth,p=e.transformOrigin;if(!o)throw new Error("theme is undefined or null in base Dropdown getStyles function.");var h=Lo.continuousPulseAnimationDouble(i||o.palette.themePrimary,a||o.palette.themeTertiary,"35px","150px","10px"),m=Lo.createDefaultAnimation(h,s);return{root:[o.fonts.medium,{position:"relative"},n],pulsingBeacon:[{position:"absolute",top:"50%",left:"50%",transform:jn(o)?"translate(50%, -50%)":"translate(-50%, -50%)",width:"0px",height:"0px",borderRadius:"225px",borderStyle:"solid",opacity:"0"},l&&m],translateAnimationContainer:[{width:"100%",height:"100%"},l&&{animationDuration:"14s",animationTimingFunction:"linear",animationDirection:"normal",animationIterationCount:"1",animationDelay:"0s",animationFillMode:"forwards",animationName:mm(),transition:"opacity 0.5s ease-in-out"},!l&&{opacity:"1"}],scaleAnimationLayer:[{width:"100%",height:"100%"},l&&{animationDuration:"14s",animationTimingFunction:"linear",animationDirection:"normal",animationIterationCount:"1",animationDelay:"0s",animationFillMode:"forwards",animationName:gm()}],rotateAnimationLayer:[{width:"100%",height:"100%"},l&&{animationDuration:"14s",animationTimingFunction:"linear",animationDirection:"normal",animationIterationCount:"1",animationDelay:"0s",animationFillMode:"forwards",animationName:fm()},!l&&{opacity:"1"}],entityHost:[{position:"relative",outline:"none",overflow:"hidden",backgroundColor:r,borderRadius:32,transition:"border-radius 250ms, width 500ms, height 500ms cubic-bezier(0.5, 0, 0, 1)",visibility:"hidden",selectors:(t={},t[ro]={backgroundColor:"Window",border:"2px solid WindowText"},t["."+wo+" &:focus"]={outline:"1px solid "+o.palette.themeTertiary},t)},!c&&l&&{width:32,height:32},!c&&{visibility:"visible"},!l&&{borderRadius:"1px",opacity:"1",width:d,height:u}],entityInnerHost:[{transition:"transform 500ms cubic-bezier(0.5, 0, 0, 1)",transformOrigin:p,transform:"scale(0)"},!l&&{width:d,height:u,transform:"scale(1)"},!c&&{visibility:"visible"}],childrenContainer:[{display:!c&&l?"none":"block"}],ariaContainer:{position:"fixed",opacity:0,height:0,width:0,pointerEvents:"none"}}}),void 0,{scope:"Coachmark"}),Nm=100,Bm=359,Fm=100,Am=255,Lm=Am,Hm=100,Om=3,zm=6,Wm=1,Vm=3,Km=/^[\da-f]{0,6}$/i,Gm=/^\d{0,3}$/;function Um(e,t,o){var n=o+(t*=(o<50?o:100-o)/100);return{h:e,s:0===n?0:2*t/n*100,v:n}}function jm(e,t,o){var n=[],r=(o/=100)*(t/=100),i=e/60,a=r*(1-Math.abs(i%2-1)),s=o-r;switch(Math.floor(i)){case 0:n=[r,a,0];break;case 1:n=[a,r,0];break;case 2:n=[0,r,a];break;case 3:n=[0,a,r];break;case 4:n=[a,0,r];break;case 5:n=[r,0,a]}return{r:Math.round(Am*(n[0]+s)),g:Math.round(Am*(n[1]+s)),b:Math.round(Am*(n[2]+s))}}function qm(e,t,o){var n=Um(e,t,o);return jm(n.h,n.s,n.v)}function Ym(e){if(e)return Zm(e)||function(e){if("#"===e[0]&&7===e.length&&/^#[\da-fA-F]{6}$/.test(e))return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:Hm}}(e)||function(e){if("#"===e[0]&&4===e.length&&/^#[\da-fA-F]{3}$/.test(e))return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:Hm}}(e)||function(e){var t=e.match(/^hsl(a?)\(([\d., ]+)\)$/);if(t){var o=!!t[1],n=o?4:3,r=t[2].split(/ *, */).map(Number);if(r.length===n){var i=qm(r[0],r[1],r[2]);return i.a=o?100*r[3]:Hm,i}}}(e)||function(e){if("undefined"!=typeof document){var t=document.createElement("div");t.style.backgroundColor=e,t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.height="1px",t.style.width="1px",document.body.appendChild(t);var o=getComputedStyle(t),n=o&&o.backgroundColor;if(document.body.removeChild(t),"rgba(0, 0, 0, 0)"!==n&&"transparent"!==n)return Zm(n);switch(e.trim()){case"transparent":case"#0000":case"#00000000":return{r:0,g:0,b:0,a:0}}}}(e)}function Zm(e){if(e){var t=e.match(/^rgb(a?)\(([\d., ]+)\)$/);if(t){var o=!!t[1],n=o?4:3,r=t[2].split(/ *, */).map(Number);if(r.length===n)return{r:r[0],g:r[1],b:r[2],a:o?100*r[3]:Hm}}}}function Xm(e,t,o){return void 0===o&&(o=0),e<o?o:e>t?t:e}function Qm(e,t,o){return[Jm(e),Jm(t),Jm(o)].join("")}function Jm(e){var t=(e=Xm(e,Am)).toString(16);return 1===t.length?"0"+t:t}function $m(e,t,o){var n=jm(e,t,o);return Qm(n.r,n.g,n.b)}function eg(e,t,o){var n=NaN,r=Math.max(e,t,o),i=r-Math.min(e,t,o);return 0===i?n=0:e===r?n=(t-o)/i%6:t===r?n=(o-e)/i+2:o===r&&(n=(e-t)/i+4),(n=Math.round(60*n))<0&&(n+=360),{h:n,s:Math.round(100*(0===r?0:i/r)),v:Math.round(r/Am*100)}}function tg(e,t,o){var n=(2-(t/=Nm))*(o/=Fm),r=t*o;return{h:e,s:100*(r=(r/=n<=1?n:2-n)||0),l:100*(n/=2)}}function og(e,t,o,n,r){return n===Hm||"number"!=typeof n?"#"+r:"rgba("+e+", "+t+", "+o+", "+n/Hm+")"}function ng(e){var t=e.a,o=void 0===t?Hm:t,n=e.b,r=e.g,i=e.r,a=eg(i,r,n),s=a.h,l=a.s,c=a.v,u=Qm(i,r,n);return{a:o,b:n,g:r,h:s,hex:u,r:i,s:l,str:og(i,r,n,o,u),v:c,t:Hm-o}}function rg(e){var t=Ym(e);if(t)return d(d({},ng(t)),{str:e})}function ig(e,t){var o=e.h,n=e.s,r=e.v;t="number"==typeof t?t:Hm;var i=jm(o,n,r),a=i.r,s=i.g,l=i.b,c=$m(o,n,r);return{a:t,b:l,g:s,h:o,hex:c,r:a,s:n,str:og(a,s,l,t,c),v:r,t:Hm-t}}function ag(e){return"#"+$m(e.h,Nm,Fm)}function sg(e,t,o){var n=jm(e.h,t,o),r=n.r,i=n.g,a=n.b,s=Qm(r,i,a);return d(d({},e),{s:t,v:o,r:r,g:i,b:a,hex:s,str:og(r,i,a,e.a,s)})}function lg(e,t){var o=jm(t,e.s,e.v),n=o.r,r=o.g,i=o.b,a=Qm(n,r,i);return d(d({},e),{h:t,r:n,g:r,b:i,hex:a,str:og(n,r,i,e.a,a)})}function cg(e,t,o){var n;return ng(((n={r:e.r,g:e.g,b:e.b,a:e.a})[t]=o,n))}function ug(e,t){return d(d({},e),{a:t,t:Hm-t,str:og(e.r,e.g,e.b,t,e.hex)})}function dg(e){return{r:Xm(e.r,Am),g:Xm(e.g,Am),b:Xm(e.b,Am),a:"number"==typeof e.a?Xm(e.a,Hm):e.a}}function pg(e){return{h:Xm(e.h,Bm),s:Xm(e.s,Nm),v:Xm(e.v,Fm)}}function hg(e){return!e||e.length<Om?"ffffff":e.length>=zm?e.substring(0,zm):e.substring(0,Om)}var mg,gg=[.027,.043,.082,.145,.184,.216,.349,.537],fg=[.537,.45,.349,.216,.184,.145,.082,.043],vg=[.537,.349,.216,.184,.145,.082,.043,.027],bg=[.537,.45,.349,.216,.184,.145,.082,.043],yg=[.88,.77,.66,.55,.44,.33,.22,.11],Cg=[.11,.22,.33,.44,.55,.66,.77,.88],_g=[.96,.84,.7,.4,.12],Sg=[.1,.24,.44];function xg(e){return"number"==typeof e&&e>=mg.Unshaded&&e<=mg.Shade8}function kg(e,t){return{h:e.h,s:e.s,v:Xm(e.v-e.v*t,100,0)}}function wg(e,t){return{h:e.h,s:Xm(e.s-e.s*t,100,0),v:Xm(e.v+(100-e.v)*t,100,0)}}function Ig(e){return tg(e.h,e.s,e.v).l<50}function Dg(e,t,o){if(void 0===o&&(o=!1),!e)return null;if(t===mg.Unshaded||!xg(t))return e;var n=tg(e.h,e.s,e.v),r={h:e.h,s:e.s,v:e.v},i=t-1,a=wg,s=kg;return o&&(a=kg,s=wg),ng(Fs(jm((r=function(e){return e.r===Am&&e.g===Am&&e.b===Am}(e)?kg(r,vg[i]):function(e){return 0===e.r&&0===e.g&&0===e.b}(e)?wg(r,bg[i]):n.l/100>.8?s(r,Cg[i]):n.l/100<.2?a(r,yg[i]):i<_g.length?a(r,_g[i]):s(r,Sg[i-_g.length])).h,r.s,r.v),{a:e.a}))}function Tg(e,t,o){if(void 0===o&&(o=!1),!e)return null;if(t===mg.Unshaded||!xg(t))return e;var n={h:e.h,s:e.s,v:e.v},r=t-1;return ng(Fs(jm((n=o?wg(n,fg[bg.length-1-r]):kg(n,gg[r])).h,n.s,n.v),{a:e.a}))}function Eg(e,t){function o(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}var n=.2126*o(e.r/Am)+.7152*o(e.g/Am)+.0722*o(e.b/Am);n+=.05;var r=.2126*o(t.r/Am)+.7152*o(t.g/Am)+.0722*o(t.b/Am);return n/(r+=.05)>1?n/r:r/n}function Pg(e,t){var o=Hm-t;return d(d({},e),{t:t,a:o,str:og(e.r,e.g,e.b,o,e.hex)})}!function(e){e[e.Unshaded=0]="Unshaded",e[e.Shade1=1]="Shade1",e[e.Shade2=2]="Shade2",e[e.Shade3=3]="Shade3",e[e.Shade4=4]="Shade4",e[e.Shade5=5]="Shade5",e[e.Shade6=6]="Shade6",e[e.Shade7=7]="Shade7",e[e.Shade8=8]="Shade8"}(mg||(mg={}));var Rg,Mg=Jn(),Ng="TextField",Bg=function(e){function t(t){var o=e.call(this,t)||this;o._textElement=f.createRef(),o._onFocus=function(e){o.props.onFocus&&o.props.onFocus(e),o.setState({isFocused:!0},(function(){o.props.validateOnFocusIn&&o._validate(o.value)}))},o._onBlur=function(e){o.props.onBlur&&o.props.onBlur(e),o.setState({isFocused:!1},(function(){o.props.validateOnFocusOut&&o._validate(o.value)}))},o._onRenderLabel=function(e){var t=e.label,n=e.required,r=o._classNames.subComponentStyles?o._classNames.subComponentStyles.label:void 0;return t?f.createElement(Yh,{required:n,htmlFor:o._id,styles:r,disabled:e.disabled,id:o._labelId},e.label):null},o._onRenderDescription=function(e){return e.description?f.createElement("span",{className:o._classNames.description},e.description):null},o._onRevealButtonClick=function(e){o.setState((function(e){return{isRevealingPassword:!e.isRevealingPassword}}))},o._onInputChange=function(e){var t,n,r=e.target.value,i=Fg(o.props,o.state)||"";void 0!==r&&r!==o._lastChangeValue&&r!==i?(o._lastChangeValue=r,null===(n=(t=o.props).onChange)||void 0===n||n.call(t,e,r),o._isControlled||o.setState({uncontrolledValue:r})):o._lastChangeValue=void 0},Gi(o),o._async=new Zi(o),ki(Ng,t,{errorMessage:"onGetErrorMessage"}),o._fallbackId=Ka(Ng),o._descriptionId=Ka("TextFieldDescription"),o._labelId=Ka("TextFieldLabel"),o._warnControlledUsage();var n=t.defaultValue,r=void 0===n?"":n;return"number"==typeof r&&(r=String(r)),o.state={uncontrolledValue:o._isControlled?void 0:r,isFocused:!1,errorMessage:""},o._delayedValidate=o._async.debounce(o._validate,o.props.deferredValidationTime),o._lastValidation=0,o}return u(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return Fg(this.props,this.state)},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){this._adjustInputHeight(),this.props.validateOnLoad&&this._validate(this.value)},t.prototype.componentWillUnmount=function(){this._async.dispose()},t.prototype.getSnapshotBeforeUpdate=function(e,t){return{selection:[this.selectionStart,this.selectionEnd]}},t.prototype.componentDidUpdate=function(e,t,o){var n=this.props,r=(o||{}).selection,i=void 0===r?[null,null]:r,a=i[0],s=i[1];!!e.multiline!=!!n.multiline&&t.isFocused&&(this.focus(),null!==a&&null!==s&&a>=0&&s>=0&&this.setSelectionRange(a,s)),e.value!==n.value&&(this._lastChangeValue=void 0);var l=Fg(e,t),c=this.value;l!==c&&(this._warnControlledUsage(e),this.state.errorMessage&&!n.errorMessage&&this.setState({errorMessage:""}),this._adjustInputHeight(),Ag(n)&&this._delayedValidate(c))},t.prototype.render=function(){var e=this.props,t=e.borderless,o=e.className,n=e.disabled,r=e.invalid,i=e.iconProps,a=e.inputClassName,s=e.label,l=e.multiline,c=e.required,u=e.underlined,p=e.prefix,h=e.resizable,m=e.suffix,g=e.theme,v=e.styles,b=e.autoAdjustHeight,y=e.canRevealPassword,C=e.revealPasswordAriaLabel,_=e.type,S=e.onRenderPrefix,x=void 0===S?this._onRenderPrefix:S,k=e.onRenderSuffix,w=void 0===k?this._onRenderSuffix:k,I=e.onRenderLabel,D=void 0===I?this._onRenderLabel:I,T=e.onRenderDescription,E=void 0===T?this._onRenderDescription:T,P=this.state,R=P.isFocused,M=P.isRevealingPassword,N=this._errorMessage,B="boolean"==typeof r?r:!!N,F=!!y&&"password"===_&&function(){if("boolean"!=typeof Rg){var e=at();if(null==e?void 0:e.navigator){var t=/^Edg/.test(e.navigator.userAgent||"");Rg=!(Wi()||t)}else Rg=!0}return Rg}(),A=this._classNames=Mg(v,{theme:g,className:o,disabled:n,focused:R,required:c,multiline:l,hasLabel:!!s,hasErrorMessage:B,borderless:t,resizable:h,hasIcon:!!i,underlined:u,inputClassName:a,autoAdjustHeight:b,hasRevealButton:F});return f.createElement("div",{ref:this.props.elementRef,className:A.root},f.createElement("div",{className:A.wrapper},D(this.props,this._onRenderLabel),f.createElement("div",{className:A.fieldGroup},(void 0!==p||this.props.onRenderPrefix)&&f.createElement("div",{className:A.prefix},x(this.props,this._onRenderPrefix)),l?this._renderTextArea():this._renderInput(),i&&f.createElement(ii,d({className:A.icon},i)),F&&f.createElement("button",{"aria-label":C,className:A.revealButton,onClick:this._onRevealButtonClick,"aria-pressed":!!M,type:"button"},f.createElement("span",{className:A.revealSpan},f.createElement(ii,{className:A.revealIcon,iconName:M?"Hide":"RedEye"}))),(void 0!==m||this.props.onRenderSuffix)&&f.createElement("div",{className:A.suffix},w(this.props,this._onRenderSuffix)))),this._isDescriptionAvailable&&f.createElement("span",{id:this._descriptionId},E(this.props,this._onRenderDescription),N&&f.createElement("div",{role:"alert"},f.createElement(ea,null,this._renderErrorMessage()))))},t.prototype.focus=function(){this._textElement.current&&this._textElement.current.focus()},t.prototype.blur=function(){this._textElement.current&&this._textElement.current.blur()},t.prototype.select=function(){this._textElement.current&&this._textElement.current.select()},t.prototype.setSelectionStart=function(e){this._textElement.current&&(this._textElement.current.selectionStart=e)},t.prototype.setSelectionEnd=function(e){this._textElement.current&&(this._textElement.current.selectionEnd=e)},Object.defineProperty(t.prototype,"selectionStart",{get:function(){return this._textElement.current?this._textElement.current.selectionStart:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionEnd",{get:function(){return this._textElement.current?this._textElement.current.selectionEnd:-1},enumerable:!1,configurable:!0}),t.prototype.setSelectionRange=function(e,t){this._textElement.current&&this._textElement.current.setSelectionRange(e,t)},t.prototype._warnControlledUsage=function(e){Di({componentId:this._id,componentName:Ng,props:this.props,oldProps:e,valueProp:"value",defaultValueProp:"defaultValue",onChangeProp:"onChange",readOnlyProp:"readOnly"}),null!==this.props.value||this._hasWarnedNullValue||(this._hasWarnedNullValue=!0,cn("Warning: 'value' prop on 'TextField' should not be null. Consider using an empty string to clear the component or undefined to indicate an uncontrolled component."))},Object.defineProperty(t.prototype,"_id",{get:function(){return this.props.id||this._fallbackId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isControlled",{get:function(){return wi(this.props,"value")},enumerable:!1,configurable:!0}),t.prototype._onRenderPrefix=function(e){var t=e.prefix;return f.createElement("span",{style:{paddingBottom:"1px"}},t)},t.prototype._onRenderSuffix=function(e){var t=e.suffix;return f.createElement("span",{style:{paddingBottom:"1px"}},t)},Object.defineProperty(t.prototype,"_errorMessage",{get:function(){var e=this.props.errorMessage;return(void 0===e?this.state.errorMessage:e)||""},enumerable:!1,configurable:!0}),t.prototype._renderErrorMessage=function(){var e=this._errorMessage;return e?"string"==typeof e?f.createElement("p",{className:this._classNames.errorMessage},f.createElement("span",{"data-automation-id":"error-message"},e)):f.createElement("div",{className:this._classNames.errorMessage,"data-automation-id":"error-message"},e):null},Object.defineProperty(t.prototype,"_isDescriptionAvailable",{get:function(){var e=this.props;return!!(e.onRenderDescription||e.description||this._errorMessage)},enumerable:!1,configurable:!0}),t.prototype._renderTextArea=function(){var e=this.props.invalid,t=void 0===e?!!this._errorMessage:e,o=Tr(this.props,mr,["defaultValue"]),n=this.props["aria-labelledby"]||(this.props.label?this._labelId:void 0);return f.createElement("textarea",d({id:this._id},o,{ref:this._textElement,value:this.value||"",onInput:this._onInputChange,onChange:this._onInputChange,className:this._classNames.field,"aria-labelledby":n,"aria-describedby":this._isDescriptionAvailable?this._descriptionId:this.props["aria-describedby"],"aria-invalid":t,"aria-label":this.props.ariaLabel,readOnly:this.props.readOnly,onFocus:this._onFocus,onBlur:this._onBlur}))},t.prototype._renderInput=function(){var e=this.props,t=e.ariaLabel,o=e.invalid,n=void 0===o?!!this._errorMessage:o,r=e.type,i=void 0===r?"text":r,a=e.label,s=d(d({type:this.state.isRevealingPassword?"text":i,id:this._id},Tr(this.props,hr,["defaultValue","type"])),{"aria-labelledby":this.props["aria-labelledby"]||(a?this._labelId:void 0),ref:this._textElement,value:this.value||"",onInput:this._onInputChange,onChange:this._onInputChange,className:this._classNames.field,"aria-label":t,"aria-describedby":this._isDescriptionAvailable?this._descriptionId:this.props["aria-describedby"],"aria-invalid":n,onFocus:this._onFocus,onBlur:this._onBlur}),l=function(e){return f.createElement("input",d({},e))};return(this.props.onRenderInput||l)(s,l)},t.prototype._validate=function(e){var t=this;if(this._latestValidateValue!==e||!Ag(this.props)){this._latestValidateValue=e;var o=this.props.onGetErrorMessage,n=o&&o(e||"");if(void 0!==n)if("string"!=typeof n&&"then"in n){var r=++this._lastValidation;n.then((function(o){r===t._lastValidation&&t.setState({errorMessage:o}),t._notifyAfterValidate(e,o)}))}else this.setState({errorMessage:n}),this._notifyAfterValidate(e,n);else this._notifyAfterValidate(e,"")}},t.prototype._notifyAfterValidate=function(e,t){e===this.value&&this.props.onNotifyValidationResult&&this.props.onNotifyValidationResult(t,e)},t.prototype._adjustInputHeight=function(){if(this._textElement.current&&this.props.autoAdjustHeight&&this.props.multiline){var e=this._textElement.current;e.style.height="",e.style.height=e.scrollHeight+"px"}},t.defaultProps={resizable:!0,deferredValidationTime:200,validateOnLoad:!0},t}(f.Component);function Fg(e,t){var o=e.value,n=void 0===o?t.uncontrolledValue:o;return"number"==typeof n?String(n):n}function Ag(e){return!(e.validateOnFocusIn||e.validateOnFocusOut)}var Lg={root:"ms-TextField",description:"ms-TextField-description",errorMessage:"ms-TextField-errorMessage",field:"ms-TextField-field",fieldGroup:"ms-TextField-fieldGroup",prefix:"ms-TextField-prefix",suffix:"ms-TextField-suffix",wrapper:"ms-TextField-wrapper",revealButton:"ms-TextField-reveal",multiline:"ms-TextField--multiline",borderless:"ms-TextField--borderless",underlined:"ms-TextField--underlined",unresizable:"ms-TextField--unresizable",required:"is-required",disabled:"is-disabled",active:"is-active"};function Hg(e){var t=e.underlined,o=e.disabled,n=e.focused,r=e.theme,i=r.palette,a=r.fonts;return function(){var e;return{root:[t&&o&&{color:i.neutralTertiary},t&&{fontSize:a.medium.fontSize,marginRight:8,paddingLeft:12,paddingRight:0,lineHeight:"22px",height:32},t&&n&&{selectors:(e={},e[ro]={height:31},e)}]}}}var Og=Vn(Bg,(function(e){var t,o,n,r,i,a,s,l,c,u,p,h,m=e.theme,g=e.className,f=e.disabled,v=e.focused,b=e.required,y=e.multiline,C=e.hasLabel,_=e.borderless,S=e.underlined,x=e.hasIcon,k=e.resizable,w=e.hasErrorMessage,I=e.inputClassName,D=e.autoAdjustHeight,T=e.hasRevealButton,E=m.semanticColors,P=m.effects,R=m.fonts,M=Qo(Lg,m),N={background:E.disabledBackground,color:f?E.disabledText:E.inputPlaceholderText,display:"flex",alignItems:"center",padding:"0 10px",lineHeight:1,whiteSpace:"nowrap",flexShrink:0,selectors:(t={},t[ro]={background:"Window",color:f?"GrayText":"WindowText"},t)},B=[{color:E.inputPlaceholderText,opacity:1,selectors:(o={},o[ro]={color:"GrayText"},o)}],F={color:E.disabledText,selectors:(n={},n[ro]={color:"GrayText"},n)};return{root:[M.root,R.medium,b&&M.required,f&&M.disabled,v&&M.active,y&&M.multiline,_&&M.borderless,S&&M.underlined,on,{position:"relative"},g],wrapper:[M.wrapper,S&&[{display:"flex",borderBottom:"1px solid "+(w?E.errorText:E.inputBorder),width:"100%"},f&&{borderBottomColor:E.disabledBackground,selectors:(r={},r[ro]=d({borderColor:"GrayText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),r)},!f&&{selectors:{":hover":{borderBottomColor:w?E.errorText:E.inputBorderHovered,selectors:(i={},i[ro]=d({borderBottomColor:"Highlight"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),i)}}},v&&[{position:"relative"},Ro(w?E.errorText:E.inputFocusBorderAlt,0,"borderBottom")]]],fieldGroup:[M.fieldGroup,on,{border:"1px solid "+E.inputBorder,borderRadius:P.roundedCorner2,background:E.inputBackground,cursor:"text",height:32,display:"flex",flexDirection:"row",alignItems:"stretch",position:"relative"},y&&{minHeight:"60px",height:"auto",display:"flex"},!v&&!f&&{selectors:{":hover":{borderColor:E.inputBorderHovered,selectors:(a={},a[ro]=d({borderColor:"Highlight"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),a)}}},v&&!S&&Ro(w?E.errorText:E.inputFocusBorderAlt,P.roundedCorner2),f&&{borderColor:E.disabledBackground,selectors:(s={},s[ro]=d({borderColor:"GrayText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),s),cursor:"default"},_&&{border:"none"},_&&v&&{border:"none",selectors:{":after":{border:"none"}}},S&&{flex:"1 1 0px",border:"none",textAlign:"left"},S&&f&&{backgroundColor:"transparent"},w&&!S&&{borderColor:E.errorText,selectors:{"&:hover":{borderColor:E.errorText}}},!C&&b&&{selectors:(l={":before":{content:"'*'",color:E.errorText,position:"absolute",top:-5,right:-10}},l[ro]={selectors:{":before":{color:"WindowText",right:-14}}},l)}],field:[R.medium,M.field,on,{borderRadius:0,border:"none",background:"none",backgroundColor:"transparent",color:E.inputText,padding:"0 8px",width:"100%",minWidth:0,textOverflow:"ellipsis",outline:0,selectors:(c={"&:active, &:focus, &:hover":{outline:0},"::-ms-clear":{display:"none"}},c[ro]={background:"Window",color:f?"GrayText":"WindowText"},c)},sn(B),y&&!k&&[M.unresizable,{resize:"none"}],y&&{minHeight:"inherit",lineHeight:17,flexGrow:1,paddingTop:6,paddingBottom:6,overflow:"auto",width:"100%"},y&&D&&{overflow:"hidden"},x&&!T&&{paddingRight:24},y&&x&&{paddingRight:40},f&&[{backgroundColor:E.disabledBackground,color:E.disabledText,borderColor:E.disabledBackground},sn(F)],S&&{textAlign:"left"},v&&!_&&{selectors:(u={},u[ro]={paddingLeft:11,paddingRight:11},u)},v&&y&&!_&&{selectors:(p={},p[ro]={paddingTop:4},p)},I],icon:[y&&{paddingRight:24,alignItems:"flex-end"},{pointerEvents:"none",position:"absolute",bottom:6,right:8,top:"auto",fontSize:Ye.medium,lineHeight:18},f&&{color:E.disabledText}],description:[M.description,{color:E.bodySubtext,fontSize:R.xSmall.fontSize}],errorMessage:[M.errorMessage,Ze.slideDownIn20,R.small,{color:E.errorText,margin:0,paddingTop:5,display:"flex",alignItems:"center"}],prefix:[M.prefix,N],suffix:[M.suffix,N],revealButton:[M.revealButton,"ms-Button","ms-Button--icon",To(m,{inset:1}),{height:30,width:32,border:"none",padding:"0px 4px",backgroundColor:"transparent",color:E.link,selectors:{":hover":{outline:0,color:E.primaryButtonBackgroundHovered,backgroundColor:E.buttonBackgroundHovered,selectors:(h={},h[ro]={borderColor:"Highlight",color:"Highlight"},h)},":focus":{outline:0}}},x&&{marginRight:28}],revealSpan:{display:"flex",height:"100%",alignItems:"center"},revealIcon:{margin:"0px 4px",pointerEvents:"none",bottom:6,right:8,top:"auto",fontSize:Ye.medium,lineHeight:18},subComponentStyles:{label:Hg(e)}}}),void 0,{scope:"TextField"}),zg=Jn(),Wg=function(e){function t(t){var o=e.call(this,t)||this;return o._disposables=[],o._root=f.createRef(),o._isAdjustingSaturation=!0,o._descriptionId=Ka("ColorRectangle-description"),o._onKeyDown=function(e){var t=o.state.color,n=t.s,r=t.v,i=e.shiftKey?10:1;switch(e.which){case Gn.up:o._isAdjustingSaturation=!1,r+=i;break;case Gn.down:o._isAdjustingSaturation=!1,r-=i;break;case Gn.left:o._isAdjustingSaturation=!0,n-=i;break;case Gn.right:o._isAdjustingSaturation=!0,n+=i;break;default:return}o._updateColor(e,sg(t,Xm(n,Nm),Xm(r,Fm)))},o._onMouseDown=function(e){o._disposables.push(nl(window,"mousemove",o._onMouseMove,!0),nl(window,"mouseup",o._disposeListeners,!0)),o._onMouseMove(e)},o._onMouseMove=function(e){if(o._root.current){var t=function(e,t,o){var n=o.getBoundingClientRect(),r=(e.clientX-n.left)/n.width,i=(e.clientY-n.top)/n.height;return sg(t,Xm(Math.round(r*Nm),Nm),Xm(Math.round(Fm-i*Fm),Fm))}(e,o.state.color,o._root.current);t&&o._updateColor(e,t)}},o._disposeListeners=function(){o._disposables.forEach((function(e){return e()})),o._disposables=[]},Gi(o),o.state={color:t.color},o}return u(t,e),Object.defineProperty(t.prototype,"color",{get:function(){return this.state.color},enumerable:!1,configurable:!0}),t.prototype.componentDidUpdate=function(e,t){e!==this.props&&this.props.color&&this.setState({color:this.props.color})},t.prototype.componentWillUnmount=function(){this._disposeListeners()},t.prototype.render=function(){var e=this.props,t=e.minSize,o=e.theme,n=e.className,r=e.styles,i=e.ariaValueFormat,a=e.ariaLabel,s=e.ariaDescription,l=this.state.color,c=zg(r,{theme:o,className:n,minSize:t}),u=i.replace("{0}",String(l.s)).replace("{1}",String(l.v));return f.createElement("div",{ref:this._root,tabIndex:0,className:c.root,style:{backgroundColor:ag(l)},onMouseDown:this._onMouseDown,onKeyDown:this._onKeyDown,role:"slider","aria-valuetext":u,"aria-valuenow":this._isAdjustingSaturation?l.s:l.v,"aria-valuemin":0,"aria-valuemax":Fm,"aria-label":a,"aria-describedby":this._descriptionId,"data-is-focusable":!0},f.createElement("div",{className:c.description,id:this._descriptionId},s),f.createElement("div",{className:c.light}),f.createElement("div",{className:c.dark}),f.createElement("div",{className:c.thumb,style:{left:l.s+"%",top:Fm-l.v+"%",backgroundColor:l.str}}))},t.prototype._updateColor=function(e,t){var o=this.props.onChange,n=this.state.color;t.s===n.s&&t.v===n.v||(o&&o(e,t),e.defaultPrevented||(this.setState({color:t}),e.preventDefault()))},t.defaultProps={minSize:220,ariaLabel:"Saturation and brightness",ariaValueFormat:"Saturation {0} brightness {1}",ariaDescription:"Use left and right arrow keys to set saturation. Use up and down arrow keys to set brightness."},t}(f.Component),Vg=Vn(Wg,(function(e){var t,o,n=e.className,r=e.theme,i=e.minSize,a=r.palette,s=r.effects;return{root:["ms-ColorPicker-colorRect",{position:"relative",marginBottom:8,border:"1px solid "+a.neutralLighter,borderRadius:s.roundedCorner2,minWidth:i,minHeight:i,outline:"none",selectors:(t={},t[ro]=d({},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),t["."+wo+" &:focus"]=(o={outline:"1px solid "+a.neutralSecondary},o[""+ro]={outline:"2px solid CanvasText"},o),t)},n],light:["ms-ColorPicker-light",{position:"absolute",left:0,right:0,top:0,bottom:0,background:"linear-gradient(to right, white 0%, transparent 100%) /*@noflip*/"}],dark:["ms-ColorPicker-dark",{position:"absolute",left:0,right:0,top:0,bottom:0,background:"linear-gradient(to bottom, transparent 0, #000 100%)"}],thumb:["ms-ColorPicker-thumb",{position:"absolute",width:20,height:20,background:"white",border:"1px solid "+a.neutralSecondaryAlt,borderRadius:"50%",boxShadow:s.elevation8,transform:"translate(-50%, -50%)",selectors:{":before":{position:"absolute",left:0,right:0,top:0,bottom:0,border:"2px solid "+a.white,borderRadius:"50%",boxSizing:"border-box",content:'""'}}}],description:Mo}}),void 0,{scope:"ColorRectangle"}),Kg=Jn(),Gg=function(e){function t(t){var o=e.call(this,t)||this;return o._disposables=[],o._root=f.createRef(),o._onKeyDown=function(e){var t=o.value,n=o._maxValue,r=e.shiftKey?10:1;switch(e.which){case Gn.left:t-=r;break;case Gn.right:t+=r;break;case Gn.home:t=0;break;case Gn.end:t=n;break;default:return}o._updateValue(e,Xm(t,n))},o._onMouseDown=function(e){var t=at(o);t&&o._disposables.push(nl(t,"mousemove",o._onMouseMove,!0),nl(t,"mouseup",o._disposeListeners,!0)),o._onMouseMove(e)},o._onMouseMove=function(e){if(o._root.current){var t=o._maxValue,n=o._root.current.getBoundingClientRect(),r=(e.clientX-n.left)/n.width,i=Xm(Math.round(r*t),t);o._updateValue(e,i)}},o._disposeListeners=function(){o._disposables.forEach((function(e){return e()})),o._disposables=[]},Gi(o),xi("ColorSlider",t,{thumbColor:"styles.sliderThumb",overlayStyle:"overlayColor",isAlpha:"type",maxValue:"type",minValue:"type"}),"hue"===o._type||t.overlayColor||t.overlayStyle||cn("ColorSlider: 'overlayColor' is required when 'type' is \"alpha\" or \"transparency\""),o.state={currentValue:t.value||0},o}return u(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.state.currentValue},enumerable:!1,configurable:!0}),t.prototype.componentDidUpdate=function(e,t){e!==this.props&&void 0!==this.props.value&&this.setState({currentValue:this.props.value})},t.prototype.componentWillUnmount=function(){this._disposeListeners()},t.prototype.render=function(){var e=this._type,t=this._maxValue,o=this.props,n=o.overlayStyle,r=o.overlayColor,i=o.theme,a=o.className,s=o.styles,l=o.ariaLabel,c=void 0===l?e:l,u=this.value,d=Kg(s,{theme:i,className:a,type:e}),p=100*u/t;return f.createElement("div",{ref:this._root,className:d.root,tabIndex:0,onKeyDown:this._onKeyDown,onMouseDown:this._onMouseDown,role:"slider","aria-valuenow":u,"aria-valuetext":String(u),"aria-valuemin":0,"aria-valuemax":t,"aria-label":c,"data-is-focusable":!0},!(!r&&!n)&&f.createElement("div",{className:d.sliderOverlay,style:r?{background:"transparency"===e?"linear-gradient(to right, #"+r+", transparent)":"linear-gradient(to right, transparent, #"+r+")"}:n}),f.createElement("div",{className:d.sliderThumb,style:{left:p+"%"}}))},Object.defineProperty(t.prototype,"_type",{get:function(){var e=this.props,t=e.isAlpha,o=e.type;return void 0===o?t?"alpha":"hue":o},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_maxValue",{get:function(){return"hue"===this._type?Bm:Hm},enumerable:!1,configurable:!0}),t.prototype._updateValue=function(e,t){if(t!==this.value){var o=this.props.onChange;o&&o(e,t),e.defaultPrevented||(this.setState({currentValue:t}),e.preventDefault())}},t.defaultProps={value:0},t}(f.Component),Ug={background:"linear-gradient("+["to left","red 0","#f09 10%","#cd00ff 20%","#3200ff 30%","#06f 40%","#00fffd 50%","#0f6 60%","#35ff00 70%","#cdff00 80%","#f90 90%","red 100%"].join(",")+")"},jg={backgroundImage:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAJUlEQVQYV2N89erVfwY0ICYmxoguxjgUFKI7GsTH5m4M3w1ChQC1/Ca8i2n1WgAAAABJRU5ErkJggg==)"},qg=Vn(Gg,(function(e){var t,o,n=e.theme,r=e.className,i=e.type,a=void 0===i?"hue":i,s=e.isAlpha,l=void 0===s?"hue"!==a:s,c=n.palette,u=n.effects;return{root:["ms-ColorPicker-slider",{position:"relative",height:20,marginBottom:8,border:"1px solid "+c.neutralLight,borderRadius:u.roundedCorner2,boxSizing:"border-box",outline:"none",forcedColorAdjust:"none",selectors:(t={},t["."+wo+" &:focus"]=(o={outline:"1px solid "+c.neutralSecondary},o[""+ro]={outline:"2px solid CanvasText"},o),t)},l?jg:Ug,r],sliderOverlay:["ms-ColorPicker-sliderOverlay",{content:"",position:"absolute",left:0,right:0,top:0,bottom:0}],sliderThumb:["ms-ColorPicker-thumb","is-slider",{position:"absolute",width:20,height:20,background:"white",border:"1px solid "+c.neutralSecondaryAlt,borderRadius:"50%",boxShadow:u.elevation8,transform:"translate(-50%, -50%)",top:"50%",forcedColorAdjust:"auto"}]}}),void 0,{scope:"ColorSlider"}),Yg=Jn(),Zg=["hex","r","g","b","a","t"],Xg={hex:"hexError",r:"redError",g:"greenError",b:"blueError",a:"alphaError",t:"transparencyError"},Qg=function(e){function t(o){var n=e.call(this,o)||this;n._onSVChanged=function(e,t){n._updateColor(e,t)},n._onHChanged=function(e,t){n._updateColor(e,lg(n.state.color,t))},n._onATChanged=function(e,t){var o="transparency"===n.props.alphaType?Pg:ug;n._updateColor(e,o(n.state.color,Math.round(t)))},n._onBlur=function(e){var t,o=n.state,r=o.color,i=o.editingColor;if(i){var a=i.value,s=i.component,l="hex"===s,c="a"===s,u="t"===s,p=l?Om:Wm;if(a.length>=p&&(l||!isNaN(Number(a)))){var h=void 0;h=l?rg("#"+hg(a)):c||u?(c?ug:Pg)(r,Xm(Number(a),Hm)):ng(dg(d(d({},r),((t={})[s]=Number(a),t)))),n._updateColor(e,h)}else n.setState({editingColor:void 0})}},Gi(n);var r=o.strings;xi("ColorPicker",o,{hexLabel:"strings.hex",redLabel:"strings.red",greenLabel:"strings.green",blueLabel:"strings.blue",alphaLabel:"strings.alpha",alphaSliderHidden:"alphaType"}),r.hue&&cn("ColorPicker property 'strings.hue' was used but has been deprecated. Use 'strings.hueAriaLabel' instead."),n.state={color:Jg(o)||rg("#ffffff")},n._textChangeHandlers={};for(var i=0,a=Zg;i<a.length;i++){var s=a[i];n._textChangeHandlers[s]=n._onTextChange.bind(n,s)}var l=t.defaultProps.strings;return n._textLabels={r:o.redLabel||r.red||l.red,g:o.greenLabel||r.green||l.green,b:o.blueLabel||r.blue||l.blue,a:o.alphaLabel||r.alpha||l.alpha,hex:o.hexLabel||r.hex||l.hex,t:r.transparency||l.transparency},n._strings=d(d(d({},l),{alphaAriaLabel:n._textLabels.a,transparencyAriaLabel:n._textLabels.t}),r),n}return u(t,e),Object.defineProperty(t.prototype,"color",{get:function(){return this.state.color},enumerable:!1,configurable:!0}),t.prototype.componentDidUpdate=function(e,t){if(e!==this.props){var o=Jg(this.props);o&&this._updateColor(void 0,o)}},t.prototype.render=function(){var e=this,t=this.props,o=this._strings,n=this._textLabels,r=t.theme,i=t.className,a=t.styles,s=t.alphaType,l=t.alphaSliderHidden,c=void 0===l?"none"===s:l,u=t.tooltipProps,p=this.state.color,h="transparency"===s,m=["hex","r","g","b",h?"t":"a"],g=h?p.t:p.a,v=h?n.t:n.a,b=Yg(a,{theme:r,className:i,alphaType:s}),y=[n.r,p.r,n.g,p.g,n.b,p.b];c||"number"!=typeof g||y.push(v,g+"%");var C=o.rootAriaLabelFormat.replace("{0}",y.join(" "));return f.createElement("div",{className:b.root,role:"group","aria-label":C},f.createElement("div",{className:b.panel},f.createElement(Vg,{color:p,onChange:this._onSVChanged,ariaLabel:o.svAriaLabel,ariaDescription:o.svAriaDescription,ariaValueFormat:o.svAriaValueFormat,className:b.colorRectangle}),f.createElement("div",{className:b.flexContainer},f.createElement("div",{className:b.flexSlider},f.createElement(qg,{className:"is-hue",type:"hue",ariaLabel:o.hue||o.hueAriaLabel,value:p.h,onChange:this._onHChanged}),!c&&f.createElement(qg,{className:"is-alpha",type:s,ariaLabel:h?o.transparencyAriaLabel:o.alphaAriaLabel,overlayColor:p.hex,value:g,onChange:this._onATChanged})),t.showPreview&&f.createElement("div",{className:b.flexPreviewBox},f.createElement("div",{className:b.colorSquare+" is-preview",style:{backgroundColor:p.str}}))),f.createElement("table",{className:b.table,role:"group",cellPadding:"0",cellSpacing:"0"},f.createElement("thead",null,f.createElement("tr",{className:b.tableHeader},f.createElement("td",{className:b.tableHexCell},n.hex),f.createElement("td",null,n.r),f.createElement("td",null,n.g),f.createElement("td",null,n.b),!c&&f.createElement("td",{className:b.tableAlphaCell},v))),f.createElement("tbody",null,f.createElement("tr",null,m.map((function(t){if(("a"===t||"t"===t)&&c)return null;var o=e._getTooltipValue(t);return f.createElement("td",{key:t},f.createElement(Td,d({content:o,directionalHint:Ys.bottomCenter,role:"alert"},u),f.createElement(Og,{className:b.input,onChange:e._textChangeHandlers[t],onBlur:e._onBlur,value:e._getDisplayValue(t),spellCheck:!1,ariaLabel:n[t],autoComplete:"off",invalid:!!o})))})))))))},t.prototype._getDisplayValue=function(e){var t=this.state,o=t.color,n=t.editingColor;return n&&n.component===e?n.value:"hex"===e?o[e]||"":"number"!=typeof o[e]||isNaN(o[e])?"":String(o[e])},t.prototype._getTooltipValue=function(e){var t=this.state.editingColor;if(t&&t.component===e){var o=t.value;if(!("hex"===e&&o.length>=Om&&o.length<=zm)){var n=Xg[e];return this._strings[n]}}},t.prototype._onTextChange=function(e,t,o){var n,r=this.state.color,i="hex"===e,a="a"===e,s="t"===e;if(o=(o||"").substr(0,i?zm:Vm),(i?Km:Gm).test(o))if(""!==o&&(i?o.length===zm:a||s?Number(o)<=Hm:Number(o)<=Am))if(String(r[e])===o)this.state.editingColor&&this.setState({editingColor:void 0});else{var l=i?rg("#"+o):s?Pg(r,Number(o)):ng(d(d({},r),((n={})[e]=Number(o),n)));this._updateColor(t,l)}else this.setState({editingColor:{component:e,value:o}})},t.prototype._updateColor=function(e,t){if(t){var o=this.state,n=o.color,r=o.editingColor;if(t.h!==n.h||t.str!==n.str||r){if(e&&this.props.onChange&&(this.props.onChange(e,t),e.defaultPrevented))return;this.setState({color:t,editingColor:void 0})}}},t.defaultProps={alphaType:"alpha",strings:{rootAriaLabelFormat:"Color picker, {0} selected.",hex:"Hex",red:"Red",green:"Green",blue:"Blue",alpha:"Alpha",transparency:"Transparency",hueAriaLabel:"Hue",svAriaLabel:Wg.defaultProps.ariaLabel,svAriaValueFormat:Wg.defaultProps.ariaValueFormat,svAriaDescription:Wg.defaultProps.ariaDescription,hexError:"Hex values must be between 3 and 6 characters long",alphaError:"Alpha must be between 0 and 100",transparencyError:"Transparency must be between 0 and 100",redError:"Red must be between 0 and 255",greenError:"Green must be between 0 and 255",blueError:"Blue must be between 0 and 255"}},t}(f.Component);function Jg(e){var t=e.color;return"string"==typeof t?rg(t):t}var $g,ef,tf,of,nf,rf=Vn(Qg,(function(e){var t=e.className,o=e.theme,n=e.alphaType;return{root:["ms-ColorPicker",o.fonts.medium,{position:"relative",maxWidth:300},t],panel:["ms-ColorPicker-panel",{padding:"16px"}],table:["ms-ColorPicker-table",{tableLayout:"fixed",width:"100%",selectors:{"tbody td:last-of-type .ms-ColorPicker-input":{paddingRight:0}}}],tableHeader:[o.fonts.small,{selectors:{td:{paddingBottom:4}}}],tableHexCell:{width:"25%"},tableAlphaCell:"transparency"===n&&{width:"22%"},colorSquare:["ms-ColorPicker-colorSquare",{width:48,height:48,margin:"0 0 0 8px",border:"1px solid #c8c6c4"}],flexContainer:{display:"flex"},flexSlider:{flexGrow:"1"},flexPreviewBox:{flexGrow:"0"},input:["ms-ColorPicker-input",{width:"100%",border:"none",boxSizing:"border-box",height:30,selectors:{"&.ms-TextField":{paddingRight:4},"& .ms-TextField-field":{minWidth:"auto",padding:5,textOverflow:"clip"}}}]}}),void 0,{scope:"ColorPicker"}),af=jo((function(e){var t,o=e.semanticColors;return{backgroundColor:o.disabledBackground,color:o.disabledText,cursor:"default",selectors:(t={":after":{borderColor:o.disabledBackground}},t[ro]={color:"GrayText",selectors:{":after":{borderColor:"GrayText"}}},t)}})),sf={selectors:($g={},$g[ro]=d({backgroundColor:"Highlight",borderColor:"Highlight",color:"HighlightText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),$g)},lf={selectors:(ef={},ef[ro]=d({color:"WindowText",backgroundColor:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),ef)},cf=jo((function(e,t,o,n,r,i){var a,s=e.palette,l=e.semanticColors,c={textHoveredColor:l.menuItemTextHovered,textSelectedColor:s.neutralDark,textDisabledColor:l.disabledText,backgroundHoveredColor:l.menuItemBackgroundHovered,backgroundPressedColor:l.menuItemBackgroundPressed};return kn({root:[e.fonts.medium,{backgroundColor:n?c.backgroundHoveredColor:"transparent",boxSizing:"border-box",cursor:"pointer",display:r?"none":"block",width:"100%",height:"auto",minHeight:36,lineHeight:"20px",padding:"0 8px",position:"relative",borderWidth:"1px",borderStyle:"solid",borderColor:"transparent",borderRadius:0,wordWrap:"break-word",overflowWrap:"break-word",textAlign:"left",selectors:d(d((a={},a[ro]={border:"none",borderColor:"Background"},a),!r&&{"&.ms-Checkbox":{display:"flex",alignItems:"center"}}),{"&.ms-Button--command:hover:active":{backgroundColor:c.backgroundPressedColor},".ms-Checkbox-label":{width:"100%"}})},i?[{backgroundColor:"transparent",color:c.textSelectedColor,selectors:{":hover":[{backgroundColor:c.backgroundHoveredColor},sf]}},To(e,{inset:-1,isFocusedOnly:!1}),sf]:[]],rootHovered:{backgroundColor:c.backgroundHoveredColor,color:c.textHoveredColor},rootFocused:{backgroundColor:c.backgroundHoveredColor},rootDisabled:{color:c.textDisabledColor,cursor:"default"},optionText:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",minWidth:"0px",maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",display:"inline-block"},optionTextWrapper:{maxWidth:"100%",display:"flex",alignItems:"center"}},t,o)})),uf=jo((function(e,t){var o,n,r=e.semanticColors,i=e.fonts,a={buttonTextColor:r.bodySubtext,buttonTextHoveredCheckedColor:r.buttonTextChecked,buttonBackgroundHoveredColor:r.listItemBackgroundHovered,buttonBackgroundCheckedColor:r.listItemBackgroundChecked,buttonBackgroundCheckedHoveredColor:r.listItemBackgroundCheckedHovered},s={selectors:(o={},o[ro]=d({backgroundColor:"Highlight",borderColor:"Highlight",color:"HighlightText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),o)};return kn({root:{color:a.buttonTextColor,fontSize:i.small.fontSize,position:"absolute",top:0,height:"100%",lineHeight:30,width:32,textAlign:"center",cursor:"default",selectors:(n={},n[ro]=d({backgroundColor:"ButtonFace",borderColor:"ButtonText",color:"ButtonText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),n)},icon:{fontSize:i.small.fontSize},rootHovered:[{backgroundColor:a.buttonBackgroundHoveredColor,color:a.buttonTextHoveredCheckedColor,cursor:"pointer"},s],rootPressed:[{backgroundColor:a.buttonBackgroundCheckedColor,color:a.buttonTextHoveredCheckedColor},s],rootChecked:[{backgroundColor:a.buttonBackgroundCheckedColor,color:a.buttonTextHoveredCheckedColor},s],rootCheckedHovered:[{backgroundColor:a.buttonBackgroundCheckedHoveredColor,color:a.buttonTextHoveredCheckedColor},s],rootDisabled:[af(e),{position:"absolute"}]},t)})),df=jo((function(e,t,o){var n,r,i,a,s,l,c=e.semanticColors,u=e.fonts,p=e.effects,h={textColor:c.inputText,borderColor:c.inputBorder,borderHoveredColor:c.inputBorderHovered,borderPressedColor:c.inputFocusBorderAlt,borderFocusedColor:c.inputFocusBorderAlt,backgroundColor:c.inputBackground,erroredColor:c.errorText},m={headerTextColor:c.menuHeader,dividerBorderColor:c.bodyDivider},g={selectors:(n={},n[ro]={color:"GrayText"},n)},f=[{color:c.inputPlaceholderText},g],v=[{color:c.inputTextHovered},g],b=[{color:c.disabledText},g],y=d(d({color:"HighlightText",backgroundColor:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),{selectors:{":after":{borderColor:"Highlight"}}}),C=Ro(h.borderPressedColor,p.roundedCorner2,"border",0);return kn({container:{},label:{},labelDisabled:{},root:[e.fonts.medium,{boxShadow:"none",marginLeft:"0",paddingRight:32,paddingLeft:9,color:h.textColor,position:"relative",outline:"0",userSelect:"none",backgroundColor:h.backgroundColor,cursor:"text",display:"block",height:32,whiteSpace:"nowrap",textOverflow:"ellipsis",boxSizing:"border-box",selectors:{".ms-Label":{display:"inline-block",marginBottom:"8px"},"&.is-open":{selectors:(r={},r[ro]=y,r)},":after":{pointerEvents:"none",content:"''",position:"absolute",left:0,top:0,bottom:0,right:0,borderWidth:"1px",borderStyle:"solid",borderColor:h.borderColor,borderRadius:p.roundedCorner2}}}],rootHovered:{selectors:(i={":after":{borderColor:h.borderHoveredColor},".ms-ComboBox-Input":[{color:c.inputTextHovered},sn(v),lf]},i[ro]=d(d({color:"HighlightText",backgroundColor:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),{selectors:{":after":{borderColor:"Highlight"}}}),i)},rootPressed:[{position:"relative",selectors:(a={},a[ro]=y,a)}],rootFocused:[{selectors:(s={".ms-ComboBox-Input":[{color:c.inputTextHovered},lf]},s[ro]=y,s)},C],rootDisabled:af(e),rootError:{selectors:{":after":{borderColor:h.erroredColor},":hover:after":{borderColor:c.inputBorderHovered}}},rootDisallowFreeForm:{},input:[sn(f),{backgroundColor:h.backgroundColor,color:h.textColor,boxSizing:"border-box",width:"100%",height:"100%",borderStyle:"none",outline:"none",font:"inherit",textOverflow:"ellipsis",padding:"0",selectors:{"::-ms-clear":{display:"none"}}},lf],inputDisabled:[af(e),sn(b)],errorMessage:[e.fonts.small,{color:h.erroredColor,marginTop:"5px"}],callout:{boxShadow:p.elevation8},optionsContainerWrapper:{width:o},optionsContainer:{display:"block"},screenReaderText:Mo,header:[u.medium,{fontWeight:qe.semibold,color:m.headerTextColor,backgroundColor:"none",borderStyle:"none",height:36,lineHeight:36,cursor:"default",padding:"0 8px",userSelect:"none",textAlign:"left",selectors:(l={},l[ro]=d({color:"GrayText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),l)}],divider:{height:1,backgroundColor:m.dividerBorderColor}},t)})),pf=jo((function(e,t,o,n,r,i,a,s){return{container:Z("ms-ComboBox-container",t,e.container),label:Z(e.label,n&&e.labelDisabled),root:Z("ms-ComboBox",s?e.rootError:o&&"is-open",r&&"is-required",e.root,!a&&e.rootDisallowFreeForm,s&&!i?e.rootError:!n&&i&&e.rootFocused,!n&&{selectors:{":hover":s?e.rootError:!o&&!i&&e.rootHovered,":active":s?e.rootError:e.rootPressed,":focus":s?e.rootError:e.rootFocused}},n&&["is-disabled",e.rootDisabled]),input:Z("ms-ComboBox-Input",e.input,n&&e.inputDisabled),errorMessage:Z(e.errorMessage),callout:Z("ms-ComboBox-callout",e.callout),optionsContainerWrapper:Z("ms-ComboBox-optionsContainerWrapper",e.optionsContainerWrapper),optionsContainer:Z("ms-ComboBox-optionsContainer",e.optionsContainer),header:Z("ms-ComboBox-header",e.header),divider:Z("ms-ComboBox-divider",e.divider),screenReaderText:Z(e.screenReaderText)}})),hf=jo((function(e){return{optionText:Z("ms-ComboBox-optionText",e.optionText),root:Z("ms-ComboBox-option",e.root,{selectors:{":hover":e.rootHovered,":focus":e.rootFocused,":active":e.rootPressed}}),optionTextWrapper:Z(e.optionTextWrapper)}}));function mf(e,t){for(var o=[],n=0,r=t;n<r.length;n++){var i=e[r[n]];i&&o.push(i)}return o}!function(e){e[e.Normal=0]="Normal",e[e.Divider=1]="Divider",e[e.Header=2]="Header",e[e.SelectAll=3]="SelectAll"}(tf||(tf={})),function(e){e[e.backward=-1]="backward",e[e.none=0]="none",e[e.forward=1]="forward"}(of||(of={})),function(e){e[e.clearAll=-2]="clearAll",e[e.default=-1]="default"}(nf||(nf={}));var gf=f.memo((function(e){return(0,e.render)()}),(function(e,t){e.render;var o=p(e,["render"]);return t.render,Bs(o,p(t,["render"]))})),ff="ComboBox",vf={options:[],allowFreeform:!1,autoComplete:"on",buttonIconProps:{iconName:"ChevronDown"}};var bf=f.forwardRef((function(e,t){var o=tr(vf,e),n=(o.ref,p(o,["ref"])),r=f.useRef(null),i=Or(r,t),a=function(e){var t=e.options,o=e.defaultSelectedKey,n=e.selectedKey,r=f.useState((function(){return Cf(t,function(e,t){var o=_f(e);return o.length?o:_f(t)}(o,n))})),i=r[0],a=r[1],s=f.useState(t),l=s[0],c=s[1],u=f.useState(),d=u[0],p=u[1];return f.useEffect((function(){if(void 0!==n){var e=_f(n),o=Cf(t,e);a(o)}c(t)}),[t,n]),f.useEffect((function(){null===n&&p(void 0)}),[n]),[i,a,l,c,d,p]}(n),s=a[0],l=a[1],c=a[2],u=a[3],h=a[4],m=a[5];return f.createElement(yf,d({},n,{hoisted:{mergedRootRef:i,rootRef:r,selectedIndices:s,setSelectedIndices:l,currentOptions:c,setCurrentOptions:u,suggestedDisplayValue:h,setSuggestedDisplayValue:m}}))}));bf.displayName=ff;var yf=function(e){function t(t){var o=e.call(this,t)||this;return o._autofill=f.createRef(),o._comboBoxWrapper=f.createRef(),o._comboBoxMenu=f.createRef(),o._selectedElement=f.createRef(),o.focus=function(e,t){o._autofill.current&&(t?La(o._autofill.current):o._autofill.current.focus(),e&&o.setState({isOpen:!0})),o._hasFocus()||o.setState({focusState:"focused"})},o.dismissMenu=function(){o.state.isOpen&&o.setState({isOpen:!1})},o._onUpdateValueInAutofillWillReceiveProps=function(){var e=o._autofill.current;if(!e)return null;if(null===e.value||void 0===e.value)return null;var t=Sf(o._currentVisibleValue);return e.value!==t?t:e.value},o._renderComboBoxWrapper=function(e,t){var n=o.props,r=n.label,i=n.disabled,a=n.ariaLabel,s=n.ariaDescribedBy,l=n.required,c=n.errorMessage,u=n.buttonIconProps,p=n.isButtonAriaHidden,h=void 0===p||p,m=n.title,g=n.placeholder,v=n.tabIndex,b=n.autofill,y=n.iconButtonProps,C=n.hoisted.suggestedDisplayValue,_=o.state.isOpen,S=o._hasFocus()&&o.props.multiSelect&&e?e:g;return f.createElement("div",{"data-ktp-target":!0,ref:o._comboBoxWrapper,id:o._id+"wrapper",className:o._classNames.root,"aria-owns":_?o._id+"-list":void 0},f.createElement(Qi,d({"data-ktp-execute-target":!0,"data-is-interactable":!i,componentRef:o._autofill,id:o._id+"-input",className:o._classNames.input,type:"text",onFocus:o._onFocus,onBlur:o._onBlur,onKeyDown:o._onInputKeyDown,onKeyUp:o._onInputKeyUp,onClick:o._onAutofillClick,onTouchStart:o._onTouchStart,onInputValueChange:o._onInputChange,"aria-expanded":_,"aria-autocomplete":o._getAriaAutoCompleteValue(),role:"combobox",readOnly:i,"aria-labelledby":r&&o._id+"-label","aria-label":a&&!r?a:void 0,"aria-describedby":void 0!==c?Gs(s,t):s,"aria-activedescendant":o._getAriaActiveDescendantValue(),"aria-required":l,"aria-disabled":i,"aria-controls":_?o._id+"-list":void 0,spellCheck:!1,defaultVisibleValue:o._currentVisibleValue,suggestedDisplayValue:C,updateValueInWillReceiveProps:o._onUpdateValueInAutofillWillReceiveProps,shouldSelectFullInputValueInComponentDidUpdate:o._onShouldSelectFullInputValueInAutofillComponentDidUpdate,title:m,preventValueSelection:!o._hasFocus(),placeholder:S,tabIndex:i?-1:v},b)),f.createElement(id,d({className:"ms-ComboBox-CaretDown-button",styles:o._getCaretButtonStyles(),role:"presentation","aria-hidden":h,"data-is-focusable":!1,tabIndex:-1,onClick:o._onComboBoxClick,onBlur:o._onBlur,iconProps:u,disabled:i,checked:_},y)))},o._onShouldSelectFullInputValueInAutofillComponentDidUpdate=function(){return o._currentVisibleValue===o.props.hoisted.suggestedDisplayValue},o._getVisibleValue=function(){var e=o.props,t=e.text,n=e.allowFreeform,r=e.autoComplete,i=e.hoisted,a=i.suggestedDisplayValue,s=i.selectedIndices,l=i.currentOptions,c=o.state,u=c.currentPendingValueValidIndex,d=c.currentPendingValue,p=c.isOpen,h=xf(l,u);if((!p||!h)&&t&&null==d)return t;if(o.props.multiSelect){if(o._hasFocus()){var m=-1;return"on"===r&&h&&(m=u),o._getPendingString(d,l,m)}return o._getMultiselectDisplayString(s,l,a)}return m=o._getFirstSelectedIndex(),n?("on"===r&&h&&(m=u),o._getPendingString(d,l,m)):h&&"on"===r?(m=u,Sf(d)):!o.state.isOpen&&d?xf(l,m)?d:Sf(a):xf(l,m)?If(l[m]):Sf(a)},o._onInputChange=function(e){o.props.disabled?o._handleInputWhenDisabled(null):o.props.allowFreeform?o._processInputChangeWithFreeform(e):o._processInputChangeWithoutFreeform(e)},o._onFocus=function(){var e,t;null===(t=null===(e=o._autofill.current)||void 0===e?void 0:e.inputElement)||void 0===t||t.select(),o._hasFocus()||o.setState({focusState:"focusing"})},o._onResolveOptions=function(){if(o.props.onResolveOptions){var e=o.props.onResolveOptions(m(o.props.hoisted.currentOptions));if(Array.isArray(e))o.props.hoisted.setCurrentOptions(e);else if(e&&e.then){var t=o._currentPromise=e;t.then((function(e){t===o._currentPromise&&o.props.hoisted.setCurrentOptions(e)}))}}},o._onBlur=function(e){var t,n,r=e.relatedTarget;if(null===e.relatedTarget&&(r=document.activeElement),r){var i=null===(t=o.props.hoisted.rootRef.current)||void 0===t?void 0:t.contains(r),a=null===(n=o._comboBoxMenu.current)||void 0===n?void 0:n.contains(r),s=o._comboBoxMenu.current&&ya(o._comboBoxMenu.current,(function(e){return e===r}));if(i||a||s)return s&&o._hasFocus()&&(!o.props.multiSelect||o.props.allowFreeform)&&o._submitPendingValue(e),e.preventDefault(),void e.stopPropagation()}o._hasFocus()&&(o.setState({focusState:"none"}),o.props.multiSelect&&!o.props.allowFreeform||o._submitPendingValue(e))},o._onRenderContainer=function(e,t){var n=e.onRenderList,r=e.calloutProps,i=e.dropdownWidth,a=e.dropdownMaxWidth,s=e.onRenderUpperContent,l=void 0===s?o._onRenderUpperContent:s,c=e.onRenderLowerContent,u=void 0===c?o._onRenderLowerContent:c,p=e.useComboBoxAsMenuWidth,h=e.persistMenu,m=e.shouldRestoreFocus,g=void 0===m||m,v=o.state.isOpen,b=o._id,y=p&&o._comboBoxWrapper.current?o._comboBoxWrapper.current.clientWidth+2:void 0;return f.createElement(kc,d({isBeakVisible:!1,gapSpace:0,doNotLayer:!1,directionalHint:Ys.bottomLeftEdge,directionalHintFixed:!1},r,{onLayerMounted:o._onLayerMounted,className:qr(o._classNames.callout,null==r?void 0:r.className),target:o._comboBoxWrapper.current,onDismiss:o._onDismiss,onMouseDown:o._onCalloutMouseDown,onScroll:o._onScroll,setInitialFocus:!1,calloutWidth:p&&o._comboBoxWrapper.current?y&&y:i,calloutMaxWidth:a||y,hidden:h?!v:void 0,shouldRestoreFocus:g}),l(o.props,o._onRenderUpperContent),f.createElement("div",{className:o._classNames.optionsContainerWrapper,ref:o._comboBoxMenu},null==n?void 0:n(d(d({},e),{id:b}),o._onRenderList)),u(o.props,o._onRenderLowerContent))},o._onLayerMounted=function(){o._onCalloutLayerMounted(),o._async.setTimeout((function(){o._scrollIntoView()}),0),o.props.calloutProps&&o.props.calloutProps.onLayerMounted&&o.props.calloutProps.onLayerMounted()},o._onRenderLabel=function(e){var t=e.props,n=t.label,r=t.disabled,i=t.required;return n?f.createElement(Yh,{id:o._id+"-label",disabled:r,required:i,className:o._classNames.label},n,e.multiselectAccessibleText&&f.createElement("span",{className:o._classNames.screenReaderText},e.multiselectAccessibleText)):null},o._onRenderList=function(e){var t=e.onRenderItem,n=void 0===t?o._onRenderItem:t,r=e.label,i=e.ariaLabel,a={items:[]},s=[],l=function(){var e=a.id?[f.createElement("div",{role:"group",key:a.id,"aria-labelledby":a.id},a.items)]:a.items;s=m(s,e),a={items:[]}};e.options.forEach((function(e,t){!function(e,t){switch(e.itemType){case tf.Header:a.items.length>0&&l();var r=o._id+e.key;a.items.push(n(d(d({id:r},e),{index:t}),o._onRenderItem)),a.id=r;break;case tf.Divider:t>0&&a.items.push(n(d(d({},e),{index:t}),o._onRenderItem)),a.items.length>0&&l();break;default:a.items.push(n(d(d({},e),{index:t}),o._onRenderItem))}}(e,t)})),a.items.length>0&&l();var c=o._id;return f.createElement("div",{id:c+"-list",className:o._classNames.optionsContainer,"aria-labelledby":r&&c+"-label","aria-label":i&&!r?i:void 0,role:"listbox"},s)},o._onRenderItem=function(e){switch(e.itemType){case tf.Divider:return o._renderSeparator(e);case tf.Header:return o._renderHeader(e);default:return o._renderOption(e)}},o._onRenderLowerContent=function(){return null},o._onRenderUpperContent=function(){return null},o._renderOption=function(e){var t,n=o.props.onRenderOption,r=void 0===n?o._onRenderOptionContent:n,i=o._id,a=o._isOptionSelected(e.index),s=o._isOptionChecked(e.index),l=o._isOptionIndeterminate(e.index),c=o._getCurrentOptionStyles(e),u=hf(o._getCurrentOptionStyles(e)),p=null!==(t=e.title)&&void 0!==t?t:If(e),h=function(){return r(e,o._onRenderOptionContent)};return f.createElement(gf,{key:e.key,index:e.index,disabled:e.disabled,isSelected:a,isChecked:s,isIndeterminate:l,text:e.text,render:function(){return o.props.multiSelect?f.createElement(Uh,{id:i+"-list"+e.index,ariaLabel:e.ariaLabel,key:e.key,styles:c,className:"ms-ComboBox-option",onChange:o._onItemClick(e),label:e.text,checked:s,indeterminate:l,title:p,disabled:e.disabled,onRenderLabel:h,inputProps:d({"aria-selected":s?"true":"false",role:"option"},{"data-index":e.index,"data-is-focusable":!0})}):f.createElement(Xd,{id:i+"-list"+e.index,key:e.key,"data-index":e.index,styles:c,checked:a,className:"ms-ComboBox-option",onClick:o._onItemClick(e),onMouseEnter:o._onOptionMouseEnter.bind(o,e.index),onMouseMove:o._onOptionMouseMove.bind(o,e.index),onMouseLeave:o._onOptionMouseLeave,role:"option","aria-selected":a?"true":"false",ariaLabel:e.ariaLabel,disabled:e.disabled,title:p},f.createElement("span",{className:u.optionTextWrapper,ref:a?o._selectedElement:void 0},r(e,o._onRenderOptionContent)))},data:e.data})},o._onCalloutMouseDown=function(e){e.preventDefault()},o._onScroll=function(){o._isScrollIdle||void 0===o._scrollIdleTimeoutId?o._isScrollIdle=!1:(o._async.clearTimeout(o._scrollIdleTimeoutId),o._scrollIdleTimeoutId=void 0),o._scrollIdleTimeoutId=o._async.setTimeout((function(){o._isScrollIdle=!0}),250)},o._onRenderOptionContent=function(e){var t=hf(o._getCurrentOptionStyles(e));return f.createElement("span",{className:t.optionText},e.text)},o._onDismiss=function(){var e=o.props.onMenuDismiss;e&&e(),o.props.persistMenu&&o._onCalloutLayerMounted(),o._setOpenStateAndFocusOnClose(!1,!1),o._resetSelectedIndex()},o._onAfterClearPendingInfo=function(){o._processingClearPendingInfo=!1},o._onInputKeyDown=function(e){var t=o.props,n=t.disabled,r=t.allowFreeform,i=t.autoComplete,a=t.hoisted.currentOptions,s=o.state,l=s.isOpen,c=s.currentPendingValueValidIndexOnHover;if(o._lastKeyDownWasAltOrMeta=Df(e),n)o._handleInputWhenDisabled(e);else{var u=o._getPendingSelectedIndex(!1);switch(e.which){case Gn.enter:o._autofill.current&&o._autofill.current.inputElement&&o._autofill.current.inputElement.select(),o._submitPendingValue(e),o.props.multiSelect&&l?o.setState({currentPendingValueValidIndex:u}):(l||(!r||void 0===o.state.currentPendingValue||null===o.state.currentPendingValue||o.state.currentPendingValue.length<=0)&&o.state.currentPendingValueValidIndex<0)&&o.setState({isOpen:!l});break;case Gn.tab:return o.props.multiSelect||o._submitPendingValue(e),void(l&&o._setOpenStateAndFocusOnClose(!l,!1));case Gn.escape:if(o._resetSelectedIndex(),!l)return;o.setState({isOpen:!1});break;case Gn.up:if(c===nf.clearAll&&(u=o.props.hoisted.currentOptions.length),e.altKey||e.metaKey){if(l){o._setOpenStateAndFocusOnClose(!l,!0);break}return}e.preventDefault(),o._setPendingInfoFromIndexAndDirection(u,of.backward);break;case Gn.down:e.altKey||e.metaKey?o._setOpenStateAndFocusOnClose(!0,!0):(c===nf.clearAll&&(u=-1),e.preventDefault(),o._setPendingInfoFromIndexAndDirection(u,of.forward));break;case Gn.home:case Gn.end:if(r)return;u=-1;var d=of.forward;e.which===Gn.end&&(u=a.length,d=of.backward),o._setPendingInfoFromIndexAndDirection(u,d);break;case Gn.space:if(!r&&"off"===i)break;default:if(e.which>=112&&e.which<=123)return;if(e.keyCode===Gn.alt||"Meta"===e.key)return;if(!r&&"on"===i){o._onInputChange(e.key);break}return}e.stopPropagation(),e.preventDefault()}},o._onInputKeyUp=function(e){var t=o.props,n=t.disabled,r=t.allowFreeform,i=t.autoComplete,a=o.state.isOpen,s=o._lastKeyDownWasAltOrMeta&&Df(e);o._lastKeyDownWasAltOrMeta=!1;var l=s&&!(Zs()||Js());if(n)o._handleInputWhenDisabled(e);else switch(e.which){case Gn.space:return void(r||"off"!==i||o._setOpenStateAndFocusOnClose(!a,!!a));default:return void(l&&a?o._setOpenStateAndFocusOnClose(!a,!0):("focusing"===o.state.focusState&&o.props.openOnKeyboardFocus&&o.setState({isOpen:!0}),"focused"!==o.state.focusState&&o.setState({focusState:"focused"})))}},o._onOptionMouseLeave=function(){o._shouldIgnoreMouseEvent()||o.props.persistMenu&&!o.state.isOpen||o.setState({currentPendingValueValidIndexOnHover:nf.clearAll})},o._onComboBoxClick=function(){var e=o.props.disabled,t=o.state.isOpen;e||(o._setOpenStateAndFocusOnClose(!t,!1),o.setState({focusState:"focused"}))},o._onAutofillClick=function(){var e=o.props,t=e.disabled;e.allowFreeform&&!t?o.focus(o.state.isOpen||o._processingTouch):o._onComboBoxClick()},o._onTouchStart=function(){o._comboBoxWrapper.current&&!("onpointerdown"in o._comboBoxWrapper)&&o._handleTouchAndPointerEvent()},o._onPointerDown=function(e){"touch"===e.pointerType&&(o._handleTouchAndPointerEvent(),e.preventDefault(),e.stopImmediatePropagation())},Gi(o),o._async=new Zi(o),o._events=new zs(o),ki(ff,t,{defaultSelectedKey:"selectedKey",text:"defaultSelectedKey",selectedKey:"value",dropdownWidth:"useComboBoxAsMenuWidth",ariaLabel:"label"}),o._id=t.id||Ka("ComboBox"),o._isScrollIdle=!0,o._processingTouch=!1,o._gotMouseMove=!1,o._processingClearPendingInfo=!1,o.state={isOpen:!1,focusState:"none",currentPendingValueValidIndex:-1,currentPendingValue:void 0,currentPendingValueValidIndexOnHover:nf.default},o}return u(t,e),Object.defineProperty(t.prototype,"selectedOptions",{get:function(){var e=this.props.hoisted;return mf(e.currentOptions,e.selectedIndices)},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){this._comboBoxWrapper.current&&!this.props.disabled&&(this._events.on(this._comboBoxWrapper.current,"focus",this._onResolveOptions,!0),"onpointerdown"in this._comboBoxWrapper.current&&this._events.on(this._comboBoxWrapper.current,"pointerdown",this._onPointerDown,!0))},t.prototype.componentDidUpdate=function(e,t){var o=this,n=this.props,r=n.allowFreeform,i=n.text,a=n.onMenuOpen,s=n.onMenuDismissed,l=n.hoisted.selectedIndices,c=this.state,u=c.isOpen,d=c.currentPendingValueValidIndex;!u||t.isOpen&&t.currentPendingValueValidIndex===d||this._async.setTimeout((function(){return o._scrollIntoView()}),0),this._hasFocus()&&(u||t.isOpen&&!u&&this._focusInputAfterClose&&this._autofill.current&&document.activeElement!==this._autofill.current.inputElement)&&this.focus(void 0,!0),this._focusInputAfterClose&&(t.isOpen&&!u||this._hasFocus()&&(!u&&!this.props.multiSelect&&e.hoisted.selectedIndices&&l&&e.hoisted.selectedIndices[0]!==l[0]||!r||i!==e.text))&&this._onFocus(),this._notifyPendingValueChanged(t),u&&!t.isOpen&&a&&a(),!u&&t.isOpen&&s&&s()},t.prototype.componentWillUnmount=function(){this._async.dispose(),this._events.dispose()},t.prototype.render=function(){var e=this._id+"-error",t=this.props,o=t.className,n=t.disabled,r=t.required,i=t.errorMessage,a=t.onRenderContainer,s=void 0===a?this._onRenderContainer:a,l=t.onRenderLabel,c=void 0===l?this._onRenderLabel:l,u=t.onRenderList,p=void 0===u?this._onRenderList:u,h=t.onRenderItem,m=void 0===h?this._onRenderItem:h,g=t.onRenderOption,v=void 0===g?this._onRenderOptionContent:g,b=t.allowFreeform,y=t.styles,C=t.theme,_=t.persistMenu,S=t.multiSelect,x=t.hoisted,k=x.suggestedDisplayValue,w=x.selectedIndices,I=x.currentOptions,D=this.state.isOpen;this._currentVisibleValue=this._getVisibleValue();var T=S?this._getMultiselectDisplayString(w,I,k):void 0,E=Tr(this.props,Dr,["onChange","value"]),P=!!(i&&i.length>0);this._classNames=this.props.getClassNames?this.props.getClassNames(C,!!D,!!n,!!r,!!this._hasFocus(),!!b,!!P,o):pf(df(C,y),o,!!D,!!n,!!r,!!this._hasFocus(),!!b,!!P);var R=this._renderComboBoxWrapper(T,e);return f.createElement("div",d({},E,{ref:this.props.hoisted.mergedRootRef,className:this._classNames.container}),c({props:this.props,multiselectAccessibleText:T},this._onRenderLabel),R,(_||D)&&s(d(d({},this.props),{onRenderList:p,onRenderItem:m,onRenderOption:v,options:I.map((function(e,t){return d(d({},e),{index:t})})),onDismiss:this._onDismiss}),this._onRenderContainer),P&&f.createElement("div",{role:"alert",id:e,className:this._classNames.errorMessage},i))},t.prototype._getPendingString=function(e,t,o){return null!=e?e:xf(t,o)?t[o].text:""},t.prototype._getMultiselectDisplayString=function(e,t,o){for(var n=[],r=0;e&&r<e.length;r++){var i=e[r];t[i].itemType!==tf.SelectAll&&n.push(xf(t,i)?t[i].text:Sf(o))}var a=this.props.multiSelectDelimiter,s=void 0===a?", ":a;return n.join(s)},t.prototype._processInputChangeWithFreeform=function(e){var t=this.props.hoisted.currentOptions,o=-1;if(""===e)return 1===(r=t.map((function(e,t){return d(d({},e),{index:t})})).filter((function(t){return kf(t)&&If(t)===e}))).length&&(o=r[0].index),void this._setPendingInfo(e,o,e);var n=e;e=e.toLocaleLowerCase();var r,i="";if("on"===this.props.autoComplete){if((r=t.map((function(e,t){return d(d({},e),{index:t})})).filter((function(t){return kf(t)&&0===If(t).toLocaleLowerCase().indexOf(e)}))).length>0){var a=If(r[0]);i=a.toLocaleLowerCase()!==e?a:"",o=r[0].index}}else 1===(r=t.map((function(e,t){return d(d({},e),{index:t})})).filter((function(t){return kf(t)&&If(t).toLocaleLowerCase()===e}))).length&&(o=r[0].index);this._setPendingInfo(n,o,i)},t.prototype._processInputChangeWithoutFreeform=function(e){var t=this,o=this.props.hoisted.currentOptions,n=this.state,r=n.currentPendingValue,i=n.currentPendingValueValidIndex;if("on"===this.props.autoComplete&&""!==e){this._autoCompleteTimeout&&(this._async.clearTimeout(this._autoCompleteTimeout),this._autoCompleteTimeout=void 0,e=Sf(r)+e);var a=e;e=e.toLocaleLowerCase();var s=o.map((function(e,t){return d(d({},e),{index:t})})).filter((function(t){return kf(t)&&0===t.text.toLocaleLowerCase().indexOf(e)}));return s.length>0&&this._setPendingInfo(a,s[0].index,If(s[0])),void(this._autoCompleteTimeout=this._async.setTimeout((function(){t._autoCompleteTimeout=void 0}),1e3))}var l=i>=0?i:this._getFirstSelectedIndex();this._setPendingInfoFromIndex(l)},t.prototype._getFirstSelectedIndex=function(){var e=this.props.hoisted.selectedIndices;return(null==e?void 0:e.length)?e[0]:-1},t.prototype._getNextSelectableIndex=function(e,t){var o=this.props.hoisted.currentOptions,n=e+t;if(!xf(o,n=Math.max(0,Math.min(o.length-1,n))))return-1;var r=o[n];if(!wf(r)||!0===r.hidden){if(t===of.none||!(n>0&&t<of.none||n>=0&&n<o.length&&t>of.none))return e;n=this._getNextSelectableIndex(n,t)}return n},t.prototype._setSelectedIndex=function(e,t,o){void 0===o&&(o=of.none);var n=this.props,r=n.onChange,i=n.onPendingValueChanged,a=n.hoisted,s=a.selectedIndices,l=a.currentOptions,c=s?s.slice():[],u=l.slice();if(xf(l,e=this._getNextSelectableIndex(e,o))){if(this.props.multiSelect||c.length<1||1===c.length&&c[0]!==e){var p=d({},l[e]);if(!p||p.disabled)return;if(this.props.multiSelect)if(p.selected=void 0!==p.selected?!p.selected:c.indexOf(e)<0,p.itemType===tf.SelectAll)c=[],p.selected?l.forEach((function(e,t){!e.disabled&&wf(e)&&(c.push(t),u[t]=d(d({},e),{selected:!0}))})):u=l.map((function(e){return d(d({},e),{selected:!1})}));else{p.selected&&c.indexOf(e)<0?c.push(e):!p.selected&&c.indexOf(e)>=0&&(c=c.filter((function(t){return t!==e}))),u[e]=p;var h=u.filter((function(e){return e.itemType===tf.SelectAll}))[0];if(h){var m=this._isSelectAllChecked(c),g=u.indexOf(h);m?(c.push(g),u[g]=d(d({},h),{selected:!0})):(c=c.filter((function(e){return e!==g})),u[g]=d(d({},h),{selected:!1}))}}else c[0]=e;t.persist(),this.props.selectedKey||null===this.props.selectedKey||(this.props.hoisted.setSelectedIndices(c),this.props.hoisted.setCurrentOptions(u)),this._hasPendingValue&&i&&(i(),this._hasPendingValue=!1),r&&r(t,p,e,void 0)}this.props.multiSelect&&this.state.isOpen||this._clearPendingInfo()}},t.prototype._submitPendingValue=function(e){var t,o=this.props,n=o.onChange,r=o.allowFreeform,i=o.autoComplete,a=o.multiSelect,s=o.hoisted,l=s.currentOptions,c=this.state,u=c.currentPendingValue,d=c.currentPendingValueValidIndex,p=c.currentPendingValueValidIndexOnHover,h=this.props.hoisted.selectedIndices;if(!this._processingClearPendingInfo){if(r){if(null==u)return void(p>=0&&(this._setSelectedIndex(p,e),this._clearPendingInfo()));if(xf(l,d)){var m=If(l[d]).toLocaleLowerCase(),g=this._autofill.current;if(u.toLocaleLowerCase()===m||i&&0===m.indexOf(u.toLocaleLowerCase())&&(null==g?void 0:g.isValueSelected)&&u.length+(g.selectionEnd-g.selectionStart)===m.length||(null===(t=null==g?void 0:g.inputElement)||void 0===t?void 0:t.value.toLocaleLowerCase())===m){if(this._setSelectedIndex(d,e),a&&this.state.isOpen)return;return void this._clearPendingInfo()}}if(n)n&&n(e,void 0,void 0,u);else{var f={key:u||Ka(),text:Sf(u)};a&&(f.selected=!0);var v=l.concat([f]);h&&(a||(h=[]),h.push(v.length-1)),s.setCurrentOptions(v),s.setSelectedIndices(h)}}else d>=0?this._setSelectedIndex(d,e):p>=0&&this._setSelectedIndex(p,e);this._clearPendingInfo()}},t.prototype._onCalloutLayerMounted=function(){this._gotMouseMove=!1},t.prototype._renderSeparator=function(e){var t=e.index,o=e.key;return t&&t>0?f.createElement("div",{role:"separator",key:o,className:this._classNames.divider}):null},t.prototype._renderHeader=function(e){var t=this.props.onRenderOption,o=void 0===t?this._onRenderOptionContent:t;return f.createElement("div",{id:e.id,key:e.key,className:this._classNames.header},o(e,this._onRenderOptionContent))},t.prototype._isOptionHighlighted=function(e){var t=this.state.currentPendingValueValidIndexOnHover;return t!==nf.clearAll&&(t>=0?t===e:this._isOptionSelected(e))},t.prototype._isOptionSelected=function(e){return this._getPendingSelectedIndex(!0)===e},t.prototype._isOptionChecked=function(e){return!(!this.props.multiSelect||void 0===e||!this.props.hoisted.selectedIndices)&&this.props.hoisted.selectedIndices.indexOf(e)>=0},t.prototype._isOptionIndeterminate=function(e){var t=this.props,o=t.multiSelect,n=t.hoisted;if(o&&void 0!==e&&n.selectedIndices&&n.currentOptions){var r=n.currentOptions[e];if(r&&r.itemType===tf.SelectAll)return n.selectedIndices.length>0&&!this._isSelectAllChecked()}return!1},t.prototype._isSelectAllChecked=function(e){var t=this.props,o=t.multiSelect,n=t.hoisted,r=n.currentOptions.find((function(e){return e.itemType===tf.SelectAll})),i=e||n.selectedIndices;if(!o||!i||!r)return!1;var a=n.currentOptions.indexOf(r),s=i.filter((function(e){return e!==a})),l=n.currentOptions.filter((function(e){return!e.disabled&&e.itemType!==tf.SelectAll&&wf(e)}));return s.length===l.length},t.prototype._getPendingSelectedIndex=function(e){var t=this.state,o=t.currentPendingValueValidIndex,n=t.currentPendingValue;return o>=0||e&&null!=n?o:this.props.multiSelect?0:this._getFirstSelectedIndex()},t.prototype._scrollIntoView=function(){var e=this.props,t=e.onScrollToItem,o=e.scrollSelectedToTop,n=this.state,r=n.currentPendingValueValidIndex,i=n.currentPendingValue;if(t)t(r>=0||""!==i?r:this._getFirstSelectedIndex());else if(this._selectedElement.current&&this._selectedElement.current.offsetParent){var a=!0;if(this._comboBoxMenu.current&&this._comboBoxMenu.current.offsetParent){var s=this._comboBoxMenu.current.offsetParent,l=this._selectedElement.current.offsetParent,c=l.offsetHeight,u=l.offsetTop,d=s,p=d.offsetHeight,h=d.scrollTop,m=u+c>h+p;u<h||o?(a=!1,s.scrollTo(0,u)):m&&s.scrollTo(0,u-p+c)}else this._selectedElement.current.offsetParent.scrollIntoView(a)}},t.prototype._onItemClick=function(e){var t=this,o=this.props.onItemClick,n=e.index;return function(r){t.props.multiSelect||(t._autofill.current&&t._autofill.current.focus(),t.setState({isOpen:!1})),o&&o(r,e,n),t._setSelectedIndex(n,r)}},t.prototype._resetSelectedIndex=function(){var e=this.props.hoisted.currentOptions;this._clearPendingInfo();var t=this._getFirstSelectedIndex();t>0&&t<e.length?this.props.hoisted.setSuggestedDisplayValue(e[t].text):this.props.text&&this.props.hoisted.setSuggestedDisplayValue(this.props.text)},t.prototype._clearPendingInfo=function(){this._processingClearPendingInfo=!0,this.props.hoisted.setSuggestedDisplayValue(void 0),this.setState({currentPendingValue:void 0,currentPendingValueValidIndex:-1,currentPendingValueValidIndexOnHover:nf.default},this._onAfterClearPendingInfo)},t.prototype._setPendingInfo=function(e,t,o){void 0===t&&(t=-1),this._processingClearPendingInfo||(this.props.hoisted.setSuggestedDisplayValue(o),this.setState({currentPendingValue:Sf(e),currentPendingValueValidIndex:t,currentPendingValueValidIndexOnHover:nf.default}))},t.prototype._setPendingInfoFromIndex=function(e){var t=this.props.hoisted.currentOptions;if(e>=0&&e<t.length){var o=t[e];this._setPendingInfo(If(o),e,If(o))}else this._clearPendingInfo()},t.prototype._setPendingInfoFromIndexAndDirection=function(e,t){var o=this.props.hoisted.currentOptions;t===of.forward&&e>=o.length-1?e=-1:t===of.backward&&e<=0&&(e=o.length);var n=this._getNextSelectableIndex(e,t);e===n?t===of.forward?e=this._getNextSelectableIndex(-1,t):t===of.backward&&(e=this._getNextSelectableIndex(o.length,t)):e=n,xf(o,e)&&this._setPendingInfoFromIndex(e)},t.prototype._notifyPendingValueChanged=function(e){var t=this.props.onPendingValueChanged;if(t){var o=this.props.hoisted.currentOptions,n=this.state,r=n.currentPendingValue,i=n.currentPendingValueValidIndex,a=n.currentPendingValueValidIndexOnHover,s=void 0,l=void 0;a!==e.currentPendingValueValidIndexOnHover&&xf(o,a)?s=a:i!==e.currentPendingValueValidIndex&&xf(o,i)?s=i:r!==e.currentPendingValue&&(l=r),(void 0!==s||void 0!==l||this._hasPendingValue)&&(t(void 0!==s?o[s]:void 0,s,l),this._hasPendingValue=void 0!==s||void 0!==l)}},t.prototype._setOpenStateAndFocusOnClose=function(e,t){this._focusInputAfterClose=t,this.setState({isOpen:e})},t.prototype._onOptionMouseEnter=function(e){this._shouldIgnoreMouseEvent()||this.setState({currentPendingValueValidIndexOnHover:e})},t.prototype._onOptionMouseMove=function(e){this._gotMouseMove=!0,this._isScrollIdle&&this.state.currentPendingValueValidIndexOnHover!==e&&this.setState({currentPendingValueValidIndexOnHover:e})},t.prototype._shouldIgnoreMouseEvent=function(){return!this._isScrollIdle||!this._gotMouseMove},t.prototype._handleInputWhenDisabled=function(e){this.props.disabled&&(this.state.isOpen&&this.setState({isOpen:!1}),null!==e&&e.which!==Gn.tab&&e.which!==Gn.escape&&(e.which<112||e.which>123)&&(e.stopPropagation(),e.preventDefault()))},t.prototype._handleTouchAndPointerEvent=function(){var e=this;void 0!==this._lastTouchTimeoutId&&(this._async.clearTimeout(this._lastTouchTimeoutId),this._lastTouchTimeoutId=void 0),this._processingTouch=!0,this._lastTouchTimeoutId=this._async.setTimeout((function(){e._processingTouch=!1,e._lastTouchTimeoutId=void 0}),500)},t.prototype._getCaretButtonStyles=function(){var e=this.props.caretDownButtonStyles;return uf(this.props.theme,e)},t.prototype._getCurrentOptionStyles=function(e){var t=this.props.comboBoxOptionStyles,o=e.styles;return cf(this.props.theme,t,o,this._isPendingOption(e),e.hidden,this._isOptionHighlighted(e.index))},t.prototype._getAriaActiveDescendantValue=function(){var e=this.props.hoisted.selectedIndices,t=this.state,o=t.isOpen,n=t.currentPendingValueValidIndex,r=o&&(null==e?void 0:e.length)?this._id+"-list"+e[0]:void 0;return o&&this._hasFocus()&&-1!==n&&(r=this._id+"-list"+n),r},t.prototype._getAriaAutoCompleteValue=function(){return this.props.disabled||"on"!==this.props.autoComplete?"none":this.props.allowFreeform?"inline":"both"},t.prototype._isPendingOption=function(e){return e&&e.index===this.state.currentPendingValueValidIndex},t.prototype._hasFocus=function(){return"none"!==this.state.focusState},h([Ju("ComboBox",["theme","styles"],!0)],t)}(f.Component);function Cf(e,t){if(!e||!t)return[];var o={};e.forEach((function(e,t){e.selected&&(o[t]=!0)}));for(var n=function(t){var n=ia(e,(function(e){return e.key===t}));n>-1&&(o[n]=!0)},r=0,i=t;r<i.length;r++)n(i[r]);return Object.keys(o).map(Number).sort()}function _f(e){return void 0===e?[]:e instanceof Array?e:[e]}function Sf(e){return e||""}function xf(e,t){return!!e&&t>=0&&t<e.length}function kf(e){return e.itemType!==tf.Header&&e.itemType!==tf.Divider&&e.itemType!==tf.SelectAll}function wf(e){return e.itemType!==tf.Header&&e.itemType!==tf.Divider}function If(e){return e.useAriaLabelAsText&&e.ariaLabel?e.ariaLabel:e.text}function Df(e){return e.which===Gn.alt||"Meta"===e.key}var Tf={auto:0,top:1,bottom:2,center:3},Ef={top:-1,bottom:-1,left:-1,right:-1,width:0,height:0},Pf=function(e){return e.getBoundingClientRect()},Rf=Pf,Mf=Pf,Nf=function(e){function t(t){var o=e.call(this,t)||this;return o._root=f.createRef(),o._surface=f.createRef(),o._pageRefs={},o._getDerivedStateFromProps=function(e,t){return e.items!==o.props.items||e.renderCount!==o.props.renderCount||e.startIndex!==o.props.startIndex||e.version!==o.props.version?(o._resetRequiredWindows(),o._requiredRect=null,o._measureVersion++,o._invalidatePageCache(),o._updatePages(e,t)):t},o._onRenderRoot=function(e){var t=e.rootRef,o=e.surfaceElement,n=e.divProps;return f.createElement("div",d({ref:t},n),o)},o._onRenderSurface=function(e){var t=e.surfaceRef,o=e.pageElements,n=e.divProps;return f.createElement("div",d({ref:t},n),o)},o._onRenderPage=function(e,t){for(var n=o.props,r=n.onRenderCell,i=n.role,a=e.page,s=a.items,l=void 0===s?[]:s,c=a.startIndex,u=p(e,["page"]),h=void 0===i?"listitem":"presentation",m=[],g=0;g<l.length;g++){var v=c+g,b=l[g],y=o.props.getKey?o.props.getKey(b,v):b&&b.key;null==y&&(y=v),m.push(f.createElement("div",{role:h,className:"ms-List-cell",key:y,"data-list-index":v,"data-automationid":"ListCell"},r&&r(b,v,o.props.ignoreScrollingState?void 0:o.state.isScrolling)))}return f.createElement("div",d({},u),m)},Gi(o),o.state={pages:[],isScrolling:!1,getDerivedStateFromProps:o._getDerivedStateFromProps},o._async=new Zi(o),o._events=new zs(o),o._estimatedPageHeight=0,o._totalEstimates=0,o._requiredWindowsAhead=0,o._requiredWindowsBehind=0,o._measureVersion=0,o._onAsyncScroll=o._async.debounce(o._onAsyncScroll,100,{leading:!1,maxWait:500}),o._onAsyncIdle=o._async.debounce(o._onAsyncIdle,200,{leading:!1}),o._onAsyncResize=o._async.debounce(o._onAsyncResize,16,{leading:!1}),o._onScrollingDone=o._async.debounce(o._onScrollingDone,500,{leading:!1}),o._cachedPageHeights={},o._estimatedPageHeight=0,o._focusedIndex=-1,o._pageCache={},o}return u(t,e),t.getDerivedStateFromProps=function(e,t){return t.getDerivedStateFromProps(e,t)},Object.defineProperty(t.prototype,"pageRefs",{get:function(){return this._pageRefs},enumerable:!1,configurable:!0}),t.prototype.scrollToIndex=function(e,t,o){void 0===o&&(o=Tf.auto);for(var n=this.props.startIndex,r=n+this._getRenderCount(),i=this._allowedRect,a=0,s=1,l=n;l<r;l+=s){var c=this._getPageSpecification(l,i),u=c.height;if(s=c.itemCount,l<=e&&l+s>e){if(t&&this._scrollElement){for(var d=Mf(this._scrollElement),p={top:this._scrollElement.scrollTop,bottom:this._scrollElement.scrollTop+d.height},h=e-l,m=0;m<h;++m)a+=t(l+m);var g=a+t(e);switch(o){case Tf.top:return void(this._scrollElement.scrollTop=a);case Tf.bottom:return void(this._scrollElement.scrollTop=g-d.height);case Tf.center:return void(this._scrollElement.scrollTop=(a+g-d.height)/2);case Tf.auto:}if(a>=p.top&&g<=p.bottom)return;a<p.top||g>p.bottom&&(a=g-d.height)}return void(this._scrollElement&&(this._scrollElement.scrollTop=a))}a+=u}},t.prototype.getStartItemIndexInView=function(e){for(var t=0,o=this.state.pages||[];t<o.length;t++){var n=o[t];if(!n.isSpacer&&(this._scrollTop||0)>=n.top&&(this._scrollTop||0)<=n.top+n.height){if(!e){var r=Math.floor(n.height/n.itemCount);return n.startIndex+Math.floor((this._scrollTop-n.top)/r)}for(var i=0,a=n.startIndex;a<n.startIndex+n.itemCount;a++){if(r=e(a),n.top+i<=this._scrollTop&&this._scrollTop<n.top+i+r)return a;i+=r}}}return 0},t.prototype.componentDidMount=function(){this.setState(this._updatePages(this.props,this.state)),this._measureVersion++,this._scrollElement=ts(this._root.current),this._events.on(window,"resize",this._onAsyncResize),this._root.current&&this._events.on(this._root.current,"focus",this._onFocus,!0),this._scrollElement&&(this._events.on(this._scrollElement,"scroll",this._onScroll),this._events.on(this._scrollElement,"scroll",this._onAsyncScroll))},t.prototype.componentDidUpdate=function(e,t){var o=this.props,n=this.state;this.state.pagesVersion!==t.pagesVersion&&(o.getPageHeight?this._onAsyncIdle():this._updatePageMeasurements(n.pages)?(this._materializedRect=null,this._hasCompletedFirstRender?this._onAsyncScroll():(this._hasCompletedFirstRender=!0,this.setState(this._updatePages(o,n)))):this._onAsyncIdle(),o.onPagesUpdated&&o.onPagesUpdated(n.pages))},t.prototype.componentWillUnmount=function(){this._async.dispose(),this._events.dispose(),delete this._scrollElement},t.prototype.shouldComponentUpdate=function(e,t){var o=this.state.pages,n=t.pages,r=!1;if(!t.isScrolling&&this.state.isScrolling)return!0;if(e.version!==this.props.version)return!0;if(e.items===this.props.items&&o.length===n.length)for(var i=0;i<o.length;i++){var a=o[i],s=n[i];if(a.key!==s.key||a.itemCount!==s.itemCount){r=!0;break}}else r=!0;return r},t.prototype.forceUpdate=function(){this._invalidatePageCache(),this._updateRenderRects(this.props,this.state,!0),this.setState(this._updatePages(this.props,this.state)),this._measureVersion++,e.prototype.forceUpdate.call(this)},t.prototype.getTotalListHeight=function(){return this._surfaceRect.height},t.prototype.render=function(){for(var e=this.props,t=e.className,o=e.role,n=void 0===o?"list":o,r=e.onRenderSurface,i=e.onRenderRoot,a=this.state.pages,s=void 0===a?[]:a,l=[],c=Tr(this.props,Dr),u=0,p=s;u<p.length;u++){var h=p[u];l.push(this._renderPage(h))}var m=r?Xh(r,this._onRenderSurface):this._onRenderSurface;return(i?Xh(i,this._onRenderRoot):this._onRenderRoot)({rootRef:this._root,pages:s,surfaceElement:m({surfaceRef:this._surface,pages:s,pageElements:l,divProps:{role:"presentation",className:"ms-List-surface"}}),divProps:d(d({},c),{className:qr("ms-List",t),role:l.length>0?n:void 0})})},t.prototype._shouldVirtualize=function(e){void 0===e&&(e=this.props);var t=e.onShouldVirtualize;return!t||t(e)},t.prototype._invalidatePageCache=function(){this._pageCache={}},t.prototype._renderPage=function(e){var t,o=this,n=this.props.usePageCache;if(n&&(t=this._pageCache[e.key])&&t.pageElement)return t.pageElement;var r=this._getPageStyle(e),i=this.props.onRenderPage,a=(void 0===i?this._onRenderPage:i)({page:e,className:"ms-List-page",key:e.key,ref:function(t){o._pageRefs[e.key]=t},style:r,role:"presentation"},this._onRenderPage);return n&&0===e.startIndex&&(this._pageCache[e.key]={page:e,pageElement:a}),a},t.prototype._getPageStyle=function(e){var t=this.props.getPageStyle;return d(d({},t?t(e):{}),e.items?{}:{height:e.height})},t.prototype._onFocus=function(e){for(var t=e.target;t!==this._surface.current;){var o=t.getAttribute("data-list-index");if(o){this._focusedIndex=Number(o);break}t=ba(t)}},t.prototype._onScroll=function(){this.state.isScrolling||this.props.ignoreScrollingState||this.setState({isScrolling:!0}),this._resetRequiredWindows(),this._onScrollingDone()},t.prototype._resetRequiredWindows=function(){this._requiredWindowsAhead=0,this._requiredWindowsBehind=0},t.prototype._onAsyncScroll=function(){var e,t;this._updateRenderRects(this.props,this.state),this._materializedRect&&(e=this._requiredRect,t=this._materializedRect,e.top>=t.top&&e.left>=t.left&&e.bottom<=t.bottom&&e.right<=t.right)||this.setState(this._updatePages(this.props,this.state))},t.prototype._onAsyncIdle=function(){var e=this.props,t=e.renderedWindowsAhead,o=e.renderedWindowsBehind,n=this._requiredWindowsAhead,r=this._requiredWindowsBehind,i=Math.min(t,n+1),a=Math.min(o,r+1);i===n&&a===r||(this._requiredWindowsAhead=i,this._requiredWindowsBehind=a,this._updateRenderRects(this.props,this.state),this.setState(this._updatePages(this.props,this.state))),(t>i||o>a)&&this._onAsyncIdle()},t.prototype._onScrollingDone=function(){this.props.ignoreScrollingState||this.setState({isScrolling:!1})},t.prototype._onAsyncResize=function(){this.forceUpdate()},t.prototype._updatePages=function(e,t){this._requiredRect||this._updateRenderRects(e,t);var o=this._buildPages(e,t),n=t.pages;return this._notifyPageChanges(n,o.pages,this.props),d(d(d({},t),o),{pagesVersion:{}})},t.prototype._notifyPageChanges=function(e,t,o){var n=o.onPageAdded,r=o.onPageRemoved;if(n||r){for(var i={},a=0,s=e;a<s.length;a++)(u=s[a]).items&&(i[u.startIndex]=u);for(var l=0,c=t;l<c.length;l++){var u;(u=c[l]).items&&(i[u.startIndex]?delete i[u.startIndex]:this._onPageAdded(u))}for(var d in i)i.hasOwnProperty(d)&&this._onPageRemoved(i[d])}},t.prototype._updatePageMeasurements=function(e){var t=!1;if(!this._shouldVirtualize())return t;for(var o=0;o<e.length;o++){var n=e[o];n.items&&(t=this._measurePage(n)||t)}return t},t.prototype._measurePage=function(e){var t=!1,o=this._pageRefs[e.key],n=this._cachedPageHeights[e.startIndex];if(o&&this._shouldVirtualize()&&(!n||n.measureVersion!==this._measureVersion)){var r={width:o.clientWidth,height:o.clientHeight};(r.height||r.width)&&(t=e.height!==r.height,e.height=r.height,this._cachedPageHeights[e.startIndex]={height:r.height,measureVersion:this._measureVersion},this._estimatedPageHeight=Math.round((this._estimatedPageHeight*this._totalEstimates+r.height)/(this._totalEstimates+1)),this._totalEstimates++)}return t},t.prototype._onPageAdded=function(e){var t=this.props.onPageAdded;t&&t(e)},t.prototype._onPageRemoved=function(e){var t=this.props.onPageRemoved;t&&t(e)},t.prototype._buildPages=function(e,t){var o=e.renderCount,n=e.items,r=e.startIndex,i=e.getPageHeight;o=this._getRenderCount(e);for(var a=d({},Ef),s=[],l=1,c=0,u=null,p=this._focusedIndex,h=r+o,m=this._shouldVirtualize(e),g=0===this._estimatedPageHeight&&!i,f=this._allowedRect,v=function(e){var o=b._getPageSpecification(e,f),i=o.height,d=o.data,v=o.key;l=o.itemCount;var y,C,_=c+i-1,S=ia(t.pages,(function(t){return!!t.items&&t.startIndex===e}))>-1,x=!f||_>=f.top&&c<=f.bottom,k=!b._requiredRect||_>=b._requiredRect.top&&c<=b._requiredRect.bottom;if(!g&&(k||x&&S)||!m||p>=e&&p<e+l||e===r){u&&(s.push(u),u=null);var w=Math.min(l,h-e),I=b._createPage(v,n.slice(e,e+w),e,void 0,void 0,d);I.top=c,I.height=i,b._visibleRect&&b._visibleRect.bottom&&(I.isVisible=_>=b._visibleRect.top&&c<=b._visibleRect.bottom),s.push(I),k&&b._allowedRect&&(y=a,C={top:c,bottom:_,height:i,left:f.left,right:f.right,width:f.width},y.top=C.top<y.top||-1===y.top?C.top:y.top,y.left=C.left<y.left||-1===y.left?C.left:y.left,y.bottom=C.bottom>y.bottom||-1===y.bottom?C.bottom:y.bottom,y.right=C.right>y.right||-1===y.right?C.right:y.right,y.width=y.right-y.left+1,y.height=y.bottom-y.top+1)}else u||(u=b._createPage("spacer-"+e,void 0,e,0,void 0,d,!0)),u.height=(u.height||0)+(_-c)+1,u.itemCount+=l;if(c+=_-c+1,g&&m)return"break"},b=this,y=r;y<h&&"break"!==v(y);y+=l);return u&&(u.key="spacer-end",s.push(u)),this._materializedRect=a,d(d({},t),{pages:s,measureVersion:this._measureVersion})},t.prototype._getPageSpecification=function(e,t){var o=this.props.getPageSpecification;if(o){var n=o(e,t),r=n.itemCount,i=void 0===r?this._getItemCountForPage(e,t):r,a=n.height;return{itemCount:i,height:void 0===a?this._getPageHeight(e,t,i):a,data:n.data,key:n.key}}return{itemCount:i=this._getItemCountForPage(e,t),height:this._getPageHeight(e,t,i)}},t.prototype._getPageHeight=function(e,t,o){if(this.props.getPageHeight)return this.props.getPageHeight(e,t,o);var n=this._cachedPageHeights[e];return n?n.height:this._estimatedPageHeight||30},t.prototype._getItemCountForPage=function(e,t){return(this.props.getItemCountForPage?this.props.getItemCountForPage(e,t):10)||10},t.prototype._createPage=function(e,t,o,n,r,i,a){void 0===o&&(o=-1),void 0===n&&(n=t?t.length:0),void 0===r&&(r={}),e=e||"page-"+o;var s=this._pageCache[e];return s&&s.page?s.page:{key:e,startIndex:o,itemCount:n,items:t,style:r,top:0,height:0,data:i,isSpacer:a||!1}},t.prototype._getRenderCount=function(e){var t=e||this.props,o=t.items,n=t.startIndex,r=t.renderCount;return void 0===r?o?o.length-n:0:r},t.prototype._updateRenderRects=function(e,t,o){var n=e.renderedWindowsAhead,r=e.renderedWindowsBehind,i=t.pages;if(this._shouldVirtualize(e)){var a=this._surfaceRect||d({},Ef),s=this._scrollElement&&this._scrollElement.scrollHeight,l=this._scrollElement?this._scrollElement.scrollTop:0;this._surface.current&&(o||!i||!this._surfaceRect||!s||s!==this._scrollHeight||Math.abs(this._scrollTop-l)>this._estimatedPageHeight/3)&&(a=this._surfaceRect=Rf(this._surface.current),this._scrollTop=l),!o&&s&&s===this._scrollHeight||this._measureVersion++,this._scrollHeight=s||0;var c=Math.max(0,-a.top),u=at(this._root.current),p={top:c,left:a.left,bottom:c+u.innerHeight,right:a.right,width:a.width,height:u.innerHeight};this._requiredRect=Bf(p,this._requiredWindowsBehind,this._requiredWindowsAhead),this._allowedRect=Bf(p,r,n),this._visibleRect=p}},t.defaultProps={startIndex:0,onRenderCell:function(e,t,o){return f.createElement(f.Fragment,null,e&&e.name||"")},renderedWindowsAhead:2,renderedWindowsBehind:2},t}(f.Component);function Bf(e,t,o){var n=e.top-t*e.height,r=e.height+(t+o)*e.height;return{top:n,bottom:n+r,height:r,left:e.left,right:e.right,width:e.width}}var Ff=function(e){function t(t){var o=e.call(this,t)||this;return o._comboBox=f.createRef(),o._list=f.createRef(),o._onRenderList=function(e){var t=e.id,n=e.onRenderItem;return f.createElement(Nf,{componentRef:o._list,role:"listbox",id:t+"-list","aria-labelledby":t+"-label",items:e.options,onRenderCell:n?function(e){return n(e)}:function(){return null}})},o._onScrollToItem=function(e){o._list.current&&o._list.current.scrollToIndex(e)},Gi(o),o}return u(t,e),Object.defineProperty(t.prototype,"selectedOptions",{get:function(){return this._comboBox.current?this._comboBox.current.selectedOptions:[]},enumerable:!1,configurable:!0}),t.prototype.dismissMenu=function(){if(this._comboBox.current)return this._comboBox.current.dismissMenu()},t.prototype.focus=function(e,t){return!!this._comboBox.current&&(this._comboBox.current.focus(e,t),!0)},t.prototype.render=function(){return f.createElement(bf,d({},this.props,{componentRef:this._comboBox,onRenderList:this._onRenderList,onScrollToItem:this._onScrollToItem}))},t}(f.Component),Af=qo((function(e){var t=e;return qo((function(o){if(e===o)throw new Error("Attempted to compose a component with itself.");var n=o,r=qo((function(e){return function(t){return f.createElement(n,d({},t,{defaultRender:e}))}}));return function(e){var o=e.defaultRender;return f.createElement(t,d({},e,{defaultRender:o?r(o):n}))}}))}));function Lf(e,t){return Af(e)(t)}var Hf=function(e,t,o){for(var n=0,r=e;n<r.length;n++){var i=r[n];o[t.register(i,!0)]=i}},Of=function(e,t){for(var o=0,n=Object.keys(t);o<n.length;o++){var r=n[o];e.unregister(t[r],r,!0),delete t[r]}},zf=function(e){var t=$c.getInstance(),o=e.className,n=e.overflowItems,r=e.keytipSequences,i=e.itemSubMenuProvider,a=e.onRenderOverflowButton,s=Ei({}),l=f.useCallback((function(e){return i?i(e):e.subMenuProps?e.subMenuProps.items:void 0}),[i]),c=f.useMemo((function(){var e=[],o=[];return r?null==n||n.forEach((function(n){var i,a=n.keytipProps;if(a){var s={content:a.content,keySequences:a.keySequences,disabled:a.disabled||!(!n.disabled&&!n.isDisabled),hasDynamicChildren:a.hasDynamicChildren,hasMenu:a.hasMenu};a.hasDynamicChildren||l(n)?(s.onExecute=t.menuExecute.bind(t,r,null===(i=null==n?void 0:n.keytipProps)||void 0===i?void 0:i.keySequences),s.hasOverflowSubMenu=!0):s.onExecute=a.onExecute,e.push(s);var c=d(d({},n),{keytipProps:d(d({},a),{overflowSetSequence:r})});null==o||o.push(c)}else null==o||o.push(n)})):o=n,{modifiedOverflowItems:o,keytipsToRegister:e}}),[n,l,t,r]),u=c.modifiedOverflowItems;return function(e,t,o){var n=Ti(e);f.useEffect((function(){n&&(Of(o,n),Hf(t,o,e))})),f.useEffect((function(){return Hf(t,o,e),function(){Of(o,e)}}),[])}(s,c.keytipsToRegister,t),f.createElement("div",{className:o},a(u))},Wf=Jn(),Vf=f.forwardRef((function(e,t){var o=f.useRef(null),n=Or(o,t);!function(e,t){f.useImperativeHandle(e.componentRef,(function(){return{focus:function(){var e=!1;return t.current&&(e=Ia(t.current)),e},focusElement:function(e){var o=!1;return!!e&&(t.current&&_a(t.current,e)&&(e.focus(),o=document.activeElement===e),o)}}}),[t])}(e,o);var r=e.items,i=e.overflowItems,a=e.className,s=e.styles,l=e.vertical,c=e.role,u=e.overflowSide,p=void 0===u?"end":u,h=e.onRenderItem,m=Wf(s,{className:a,vertical:l}),g=!!i&&i.length>0;return f.createElement("div",d({},Tr(e,Dr),{role:c||"group","aria-orientation":"menubar"===c?!0===l?"vertical":"horizontal":void 0,className:m.root,ref:n}),"start"===p&&g&&f.createElement(zf,d({},e,{className:m.overflowButton})),r&&r.map((function(e,t){return f.createElement("div",{className:m.item,key:e.key,role:"none"},h(e))})),"end"===p&&g&&f.createElement(zf,d({},e,{className:m.overflowButton})))}));Vf.displayName="OverflowSet";var Kf={flexShrink:0,display:"inherit"},Gf=Vn(Vf,(function(e){var t=e.className;return{root:["ms-OverflowSet",{position:"relative",display:"flex",flexWrap:"nowrap"},e.vertical&&{flexDirection:"column"},t],item:["ms-OverflowSet-item",Kf],overflowButton:["ms-OverflowSet-overflowButton",Kf]}}),void 0,{scope:"OverflowSet"}),Uf=jo((function(e){var t={height:"100%"},o={whiteSpace:"nowrap"},n=e||{},r=n.root,i=n.label,a=p(n,["root","label"]);return d(d({},a),{root:r?[t,r]:t,label:i?[o,i]:o})})),jf=Jn(),qf=function(e){function t(t){var o=e.call(this,t)||this;return o._overflowSet=f.createRef(),o._resizeGroup=f.createRef(),o._onRenderData=function(e){var t=o.props,n=t.ariaLabel,r=t.primaryGroupAriaLabel,i=t.farItemsGroupAriaLabel,a=e.farItems&&e.farItems.length>0;return f.createElement(bs,{className:qr(o._classNames.root),direction:$i.horizontal,role:"menubar","aria-label":n},f.createElement(Gf,{role:a?"group":"none","aria-label":a?r:void 0,componentRef:o._overflowSet,className:qr(o._classNames.primarySet),items:e.primaryItems,overflowItems:e.overflowItems.length?e.overflowItems:void 0,onRenderItem:o._onRenderItem,onRenderOverflowButton:o._onRenderOverflowButton}),a&&f.createElement(Gf,{role:"group","aria-label":i,className:qr(o._classNames.secondarySet),items:e.farItems,onRenderItem:o._onRenderItem,onRenderOverflowButton:Ks}))},o._onRenderItem=function(e){if(e.onRender)return e.onRender(e,(function(){}));var t=e.text||e.name,n=d(d({allowDisabledFocus:!0,role:"menuitem"},e),{styles:Uf(e.buttonStyles),className:qr("ms-CommandBarItem-link",e.className),text:e.iconOnly?void 0:t,menuProps:e.subMenuProps,onClick:o._onButtonClick(e)});return e.iconOnly&&(void 0!==t||e.tooltipHostProps)?f.createElement(Td,d({role:"none",content:t,setAriaDescribedBy:!1},e.tooltipHostProps),o._commandButton(e,n)):o._commandButton(e,n)},o._commandButton=function(e,t){var n=o.props.buttonAs,r=e.commandBarButtonAs,i=Zd;return r&&(i=Lf(r,i)),n&&(i=Lf(n,i)),f.createElement(i,d({},t))},o._onRenderOverflowButton=function(e){var t=o.props.overflowButtonProps,n=void 0===t?{}:t,r=m(n.menuProps?n.menuProps.items:[],e),i=d(d({role:"menuitem"},n),{styles:d({menuIcon:{fontSize:"17px"}},n.styles),className:qr("ms-CommandBar-overflowButton",n.className),menuProps:d(d({},n.menuProps),{items:r}),menuIconProps:d({iconName:"More"},n.menuIconProps)}),a=o.props.overflowButtonAs?Lf(o.props.overflowButtonAs,Zd):Zd;return f.createElement(a,d({},i))},o._onReduceData=function(e){var t=o.props,n=t.shiftOnReduce,r=t.onDataReduced,i=e.primaryItems,a=e.overflowItems,s=e.cacheKey,l=i[n?0:i.length-1];if(void 0!==l){l.renderedInOverflow=!0,a=m([l],a),i=n?i.slice(1):i.slice(0,-1);var c=d(d({},e),{primaryItems:i,overflowItems:a});return s=o._computeCacheKey({primaryItems:i,overflow:a.length>0}),r&&r(l),c.cacheKey=s,c}},o._onGrowData=function(e){var t=o.props,n=t.shiftOnReduce,r=t.onDataGrown,i=e.minimumOverflowItems,a=e.primaryItems,s=e.overflowItems,l=e.cacheKey,c=s[0];if(void 0!==c&&s.length>i){c.renderedInOverflow=!1,s=s.slice(1),a=n?m([c],a):m(a,[c]);var u=d(d({},e),{primaryItems:a,overflowItems:s});return l=o._computeCacheKey({primaryItems:a,overflow:s.length>0}),r&&r(c),u.cacheKey=l,u}},Gi(o),o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.items,o=e.overflowItems,n=e.farItems,r=e.styles,i=e.theme,a=e.dataDidRender,s=e.onReduceData,l=void 0===s?this._onReduceData:s,c=e.onGrowData,u=void 0===c?this._onGrowData:c,p=e.resizeGroupAs,h=void 0===p?gd:p,g={primaryItems:m(t),overflowItems:m(o),minimumOverflowItems:m(o).length,farItems:n,cacheKey:this._computeCacheKey({primaryItems:m(t),overflow:o&&o.length>0})};this._classNames=jf(r,{theme:i});var v=Tr(this.props,Dr);return f.createElement(h,d({},v,{componentRef:this._resizeGroup,data:g,onReduceData:l,onGrowData:u,onRenderData:this._onRenderData,dataDidRender:a}))},t.prototype.focus=function(){var e=this._overflowSet.current;e&&e.focus()},t.prototype.remeasure=function(){this._resizeGroup.current&&this._resizeGroup.current.remeasure()},t.prototype._onButtonClick=function(e){return function(t){e.inactive||e.onClick&&e.onClick(t,e)}},t.prototype._computeCacheKey=function(e){var t=e.primaryItems,o=e.overflow;return[t&&t.reduce((function(e,t){var o=t.cacheKey;return e+(void 0===o?t.key:o)}),""),o?"overflow":""].join("")},t.defaultProps={items:[],overflowItems:[]},t}(f.Component),Yf=Vn(qf,(function(e){var t=e.className,o=e.theme,n=o.semanticColors;return{root:[o.fonts.medium,"ms-CommandBar",{display:"flex",backgroundColor:n.bodyBackground,padding:"0 14px 0 24px",height:44},t],primarySet:["ms-CommandBar-primaryCommand",{flexGrow:"1",display:"flex",alignItems:"stretch"}],secondarySet:["ms-CommandBar-secondaryCommand",{flexShrink:"0",display:"flex",alignItems:"stretch"}]}}),void 0,{scope:"CommandBar"}),Zf=d(d({},nh),{prevMonthAriaLabel:"Go to previous month",nextMonthAriaLabel:"Go to next month",prevYearAriaLabel:"Go to previous year",nextYearAriaLabel:"Go to next year",closeButtonAriaLabel:"Close date picker",isRequiredErrorMessage:"Field is required",invalidInputErrorMessage:"Invalid date format",isResetStatusMessage:'Invalid entry "{0}", date reset to "{1}"'}),Xf=Jn(),Qf={allowTextInput:!1,formatDate:function(e){return e?e.toDateString():""},parseDateFromString:function(e){var t=Date.parse(e);return t?new Date(t):null},firstDayOfWeek:tp.Sunday,initialPickerDate:new Date,isRequired:!1,isMonthPickerVisible:!0,showMonthPickerAsOverlay:!1,strings:Zf,highlightCurrentMonth:!1,highlightSelectedMonth:!1,borderless:!1,pickerAriaLabel:"Calendar",showWeekNumbers:!1,firstWeekOfYear:np.FirstDay,showGoToToday:!0,showCloseButton:!1,underlined:!1,allFocusable:!1},Jf=f.forwardRef((function(e,t){var o=tr(Qf,e),n=o.firstDayOfWeek,r=o.strings,i=o.label,a=o.theme,s=o.className,l=o.styles,c=o.initialPickerDate,u=o.isRequired,p=o.disabled,h=o.ariaLabel,m=o.pickerAriaLabel,g=o.placeholder,v=o.allowTextInput,b=o.borderless,y=o.minDate,C=o.maxDate,_=o.showCloseButton,S=o.calendarProps,x=o.calloutProps,k=o.textField,w=o.underlined,I=o.allFocusable,D=o.calendarAs,T=void 0===D?Ph:D,E=o.tabIndex,P=o.disableAutoFocus,R=void 0===P||P,M=hu("DatePicker",o.id),N=hu("DatePicker-Callout"),B=f.useRef(null),F=f.useRef(null),A=function(){var e=f.useRef(null),t=f.useRef(!1);return[e,function(){var t,o;null===(o=null===(t=e.current)||void 0===t?void 0:t.focus)||void 0===o||o.call(t)},t,function(){t.current=!0}]}(),L=A[0],H=A[1],O=A[2],z=A[3],W=function(e,t){var o=e.allowTextInput,n=e.onAfterMenuDismiss,r=f.useState(!1),i=r[0],a=r[1],s=f.useRef(!1),l=Hl();return f.useEffect((function(){s.current&&!i&&(o&&l.requestAnimationFrame(t),null==n||n()),s.current=!0}),[i]),[i,a]}(o,H),V=W[0],K=W[1],G=function(e){var t=e.formatDate,o=e.value,n=e.onSelectDate,r=kh(o,void 0,(function(e,t){return null==n?void 0:n(t)})),i=r[0],a=r[1],s=f.useState((function(){return o&&t?t(o):""})),l=s[0],c=s[1];return f.useEffect((function(){c(o&&t?t(o):"")}),[t,o]),[i,l,function(e){a(e),c(e&&t?t(e):"")},c]}(o),U=G[0],j=G[1],q=G[2],Y=G[3],Z=function(e,t,o,n,r){var i=e.isRequired,a=e.allowTextInput,s=e.strings,l=e.parseDateFromString,c=e.onSelectDate,u=e.formatDate,d=e.minDate,p=e.maxDate,h=f.useState(),m=h[0],g=h[1],v=f.useState(),b=v[0],y=v[1];return f.useEffect((function(){i&&!t?g(s.isRequiredErrorMessage||" "):t&&$f(t,d,p)?g(s.isOutOfBoundsErrorMessage||" "):g(void 0)}),[d&&Tp(d),p&&Tp(p),t&&Tp(t),i]),[r?void 0:m,function(e){if(void 0===e&&(e=null),a)if(n||e){if(t&&!m&&u&&u(null!=e?e:t)===n)return;if(!(e=e||l(n))||isNaN(e.getTime())){o(t);var r=u?u(t):"",h=s.isResetStatusMessage?Bp(s.isResetStatusMessage,n,r):s.invalidInputErrorMessage||"";y(h)}else $f(e,d,p)?g(s.isOutOfBoundsErrorMessage||" "):(o(e),g(void 0),y(void 0))}else g(i?s.isRequiredErrorMessage||" ":void 0),null==c||c(e);else i&&!n?g(s.isRequiredErrorMessage||" "):(g(void 0),y(void 0))},g,r?void 0:b,y]}(o,U,q,j,V),X=Z[0],Q=Z[1],J=Z[2],$=Z[3],ee=Z[4],te=f.useCallback((function(){V||(z(),K(!0))}),[V,z,K]);f.useImperativeHandle(o.componentRef,(function(){return{focus:H,reset:function(){K(!1),q(void 0),J(void 0),ee(void 0)},showDatePickerPopup:te}}),[H,J,K,q,ee,te]);var oe=function(e){V&&(K(!1),Q(e),!v&&e&&q(e))},ne=function(e){z(),oe(e)},re=Xf(l,{theme:a,className:s,disabled:p,underlined:w,label:!!i,isDatePickerShown:V}),ie=Tr(o,Dr,["value"]),ae=k&&k.iconProps,se=k&&k.id&&k.id!==M?k.id:M+"-label",le=!v&&!p;return f.createElement("div",d({},ie,{className:re.root,ref:t}),f.createElement("div",{ref:F,"aria-owns":V?N:void 0,className:re.wrapper},f.createElement(Og,d({role:"combobox",label:i,"aria-expanded":V,ariaLabel:h,"aria-haspopup":"dialog","aria-controls":V?N:void 0,required:u,disabled:p,errorMessage:X,placeholder:g,borderless:b,value:j,componentRef:L,underlined:w,tabIndex:E,readOnly:!v},k,{id:se,className:qr(re.textField,k&&k.className),iconProps:d(d({iconName:"Calendar"},ae),{className:qr(re.icon,ae&&ae.className),onClick:function(e){e.stopPropagation(),V||o.disabled?o.allowTextInput&&oe():te()}}),onRenderDescription:function(e,t){return f.createElement(f.Fragment,null,e.description?t(e):null,f.createElement("div",{"aria-live":"assertive",className:re.statusMessage},$))},onKeyDown:function(e){switch(e.which){case Gn.enter:e.preventDefault(),e.stopPropagation(),V?o.allowTextInput&&oe():(Q(),te());break;case Gn.escape:!function(e){e.stopPropagation(),ne()}(e);break;case Gn.down:e.altKey&&!V&&te()}},onFocus:function(){R||v||(O.current||te(),O.current=!1)},onBlur:function(e){Q()},onClick:function(e){!o.openOnClick&&o.disableAutoFocus||V||o.disabled?o.allowTextInput&&oe():te()},onChange:function(e,t){var n,r=o.textField;v&&(V&&oe(),Y(t)),null===(n=null==r?void 0:r.onChange)||void 0===n||n.call(r,e,t)},onRenderInput:le?function(e){var t=Tr(e,Dr);return f.createElement("div",d({},t,{className:qr(t.className,re.readOnlyTextField),tabIndex:E||0}),j||f.createElement("span",{className:re.readOnlyPlaceholder},g))}:void 0}))),V&&f.createElement(kc,d({id:N,role:"dialog",ariaLabel:m,isBeakVisible:!1,gapSpace:0,doNotLayer:!1,target:F.current,directionalHint:Ys.bottomLeftEdge},x,{className:qr(re.callout,x&&x.className),onDismiss:function(e){ne()},onPositioned:function(){var e=!0;o.calloutProps&&void 0!==o.calloutProps.setInitialFocus&&(e=o.calloutProps.setInitialFocus),B.current&&e&&B.current.focus()}}),f.createElement(Mh,{isClickableOutsideFocusTrap:!0,disableFirstFocus:R},f.createElement(T,d({},S,{onSelectDate:function(e){o.calendarProps&&o.calendarProps.onSelectDate&&o.calendarProps.onSelectDate(e),ne(e)},onDismiss:ne,isMonthPickerVisible:o.isMonthPickerVisible,showMonthPickerAsOverlay:o.showMonthPickerAsOverlay,today:o.today,value:U||c,firstDayOfWeek:n,strings:r,highlightCurrentMonth:o.highlightCurrentMonth,highlightSelectedMonth:o.highlightSelectedMonth,showWeekNumbers:o.showWeekNumbers,firstWeekOfYear:o.firstWeekOfYear,showGoToToday:o.showGoToToday,dateTimeFormatter:o.dateTimeFormatter,minDate:y,maxDate:C,componentRef:B,showCloseButton:_,allFocusable:I})))))}));function $f(e,t,o){return!!t&&Cp(t,e)>0||!!o&&Cp(o,e)<0}Jf.displayName="DatePickerBase";var ev,tv,ov={root:"ms-DatePicker",callout:"ms-DatePicker-callout",withLabel:"ms-DatePicker-event--with-label",withoutLabel:"ms-DatePicker-event--without-label",disabled:"msDatePickerDisabled "},nv=Vn(Jf,(function(e){var t,o=e.className,n=e.theme,r=e.disabled,i=e.underlined,a=e.label,s=e.isDatePickerShown,l=n.palette,c=n.semanticColors,u=n.fonts,d=Qo(ov,n),p={color:l.neutralSecondary,fontSize:je.icon,lineHeight:"18px",pointerEvents:"none",position:"absolute",right:"4px",padding:"5px"};return{root:[d.root,n.fonts.large,s&&"is-open",on,o],textField:[{position:"relative",selectors:{"& input[readonly]":{cursor:"pointer"},input:{selectors:{"::-ms-clear":{display:"none"}}}}},r&&{selectors:{"& input[readonly]":{cursor:"default"}}}],callout:[d.callout],icon:[p,a?d.withLabel:d.withoutLabel,{paddingTop:"7px"},!r&&[d.disabled,{pointerEvents:"initial",cursor:"pointer"}],r&&{color:c.disabledText,cursor:"default"}],statusMessage:[u.small,{color:c.errorText,marginTop:5}],readOnlyTextField:[{cursor:"pointer",height:32,lineHeight:30,overflow:"hidden",textOverflow:"ellipsis"},i&&{lineHeight:34}],readOnlyPlaceholder:(t={color:c.inputPlaceholderText},t[ro]={color:"GrayText"},t)}}),void 0,{scope:"DatePicker"}),rv="change";!function(e){e[e.none=0]="none",e[e.single=1]="single",e[e.multiple=2]="multiple"}(ev||(ev={})),function(e){e[e.horizontal=0]="horizontal",e[e.vertical=1]="vertical"}(tv||(tv={}));var iv=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=e[0]||{},n=o.onSelectionChanged,r=o.getKey,i=o.canSelectItem,a=void 0===i?function(){return!0}:i,s=o.items,l=o.selectionMode,c=void 0===l?ev.multiple:l;this.mode=c,this._getKey=r||av,this._changeEventSuppressionCount=0,this._exemptedCount=0,this._anchoredIndex=0,this._unselectableCount=0,this._onSelectionChanged=n,this._canSelectItem=a,this._isModal=!1,this.setItems(s||[],!0),this.count=this.getSelectedCount()}return e.prototype.canSelectItem=function(e,t){return!("number"==typeof t&&t<0)&&this._canSelectItem(e,t)},e.prototype.getKey=function(e,t){var o=this._getKey(e,t);return"number"==typeof o||o?""+o:""},e.prototype.setChangeEvents=function(e,t){this._changeEventSuppressionCount+=e?-1:1,0===this._changeEventSuppressionCount&&this._hasChanged&&(this._hasChanged=!1,t||this._change())},e.prototype.isModal=function(){return this._isModal},e.prototype.setModal=function(e){this._isModal!==e&&(this.setChangeEvents(!1),this._isModal=e,e||this.setAllSelected(!1),this._change(),this.setChangeEvents(!0))},e.prototype.setItems=function(e,t){void 0===t&&(t=!0);var o={},n={},r=!1;this.setChangeEvents(!1),this._unselectableCount=0;for(var i=0;i<e.length;i++){if(u=e[i]){var a=this.getKey(u,i);a&&(o[a]=i)}n[i]=u&&!this.canSelectItem(u),n[i]&&this._unselectableCount++}(t||0===e.length)&&this._setAllSelected(!1,!0);var s={},l=0;for(var c in this._exemptedIndices)if(this._exemptedIndices.hasOwnProperty(c)){var u,d=Number(c),p=(u=this._items[d])?this.getKey(u,Number(d)):void 0,h=p?o[p]:d;void 0===h?r=!0:(s[h]=!0,l++,r=r||h!==d)}this._items&&0===this._exemptedCount&&e.length!==this._items.length&&this._isAllSelected&&(r=!0),this._exemptedIndices=s,this._exemptedCount=l,this._keyToIndexMap=o,this._unselectableIndices=n,this._items=e,this._selectedItems=null,r&&(this._updateCount(),this._change()),this.setChangeEvents(!0)},e.prototype.getItems=function(){return this._items},e.prototype.getSelection=function(){if(!this._selectedItems){this._selectedItems=[];var e=this._items;if(e)for(var t=0;t<e.length;t++)this.isIndexSelected(t)&&this._selectedItems.push(e[t])}return this._selectedItems},e.prototype.getSelectedCount=function(){return this._isAllSelected?this._items.length-this._exemptedCount-this._unselectableCount:this._exemptedCount},e.prototype.getSelectedIndices=function(){if(!this._selectedIndices){this._selectedIndices=[];var e=this._items;if(e)for(var t=0;t<e.length;t++)this.isIndexSelected(t)&&this._selectedIndices.push(t)}return this._selectedIndices},e.prototype.isRangeSelected=function(e,t){if(0===t)return!1;for(var o=e+t,n=e;n<o;n++)if(!this.isIndexSelected(n))return!1;return!0},e.prototype.isAllSelected=function(){var e=this._items.length-this._unselectableCount;return this.mode===ev.single&&(e=Math.min(e,1)),this.count>0&&this._isAllSelected&&0===this._exemptedCount||!this._isAllSelected&&this._exemptedCount===e&&e>0},e.prototype.isKeySelected=function(e){var t=this._keyToIndexMap[e];return this.isIndexSelected(t)},e.prototype.isIndexSelected=function(e){return!!(this.count>0&&this._isAllSelected&&!this._exemptedIndices[e]&&!this._unselectableIndices[e]||!this._isAllSelected&&this._exemptedIndices[e])},e.prototype.setAllSelected=function(e){if(!e||this.mode===ev.multiple){var t=this._items?this._items.length-this._unselectableCount:0;this.setChangeEvents(!1),t>0&&(this._exemptedCount>0||e!==this._isAllSelected)&&(this._exemptedIndices={},(e!==this._isAllSelected||this._exemptedCount>0)&&(this._exemptedCount=0,this._isAllSelected=e,this._change()),this._updateCount()),this.setChangeEvents(!0)}},e.prototype.setKeySelected=function(e,t,o){var n=this._keyToIndexMap[e];n>=0&&this.setIndexSelected(n,t,o)},e.prototype.setIndexSelected=function(e,t,o){if(this.mode!==ev.none&&!((e=Math.min(Math.max(0,e),this._items.length-1))<0||e>=this._items.length)){this.setChangeEvents(!1);var n=this._exemptedIndices[e];!this._unselectableIndices[e]&&(t&&this.mode===ev.single&&this._setAllSelected(!1,!0),n&&(t&&this._isAllSelected||!t&&!this._isAllSelected)&&(delete this._exemptedIndices[e],this._exemptedCount--),!n&&(t&&!this._isAllSelected||!t&&this._isAllSelected)&&(this._exemptedIndices[e]=!0,this._exemptedCount++),o&&(this._anchoredIndex=e)),this._updateCount(),this.setChangeEvents(!0)}},e.prototype.selectToKey=function(e,t){this.selectToIndex(this._keyToIndexMap[e],t)},e.prototype.selectToIndex=function(e,t){if(this.mode!==ev.none)if(this.mode!==ev.single){var o=this._anchoredIndex||0,n=Math.min(e,o),r=Math.max(e,o);for(this.setChangeEvents(!1),t&&this._setAllSelected(!1,!0);n<=r;n++)this.setIndexSelected(n,!0,!1);this.setChangeEvents(!0)}else this.setIndexSelected(e,!0,!0)},e.prototype.toggleAllSelected=function(){this.setAllSelected(!this.isAllSelected())},e.prototype.toggleKeySelected=function(e){this.setKeySelected(e,!this.isKeySelected(e),!0)},e.prototype.toggleIndexSelected=function(e){this.setIndexSelected(e,!this.isIndexSelected(e),!0)},e.prototype.toggleRangeSelected=function(e,t){if(this.mode!==ev.none){var o=this.isRangeSelected(e,t),n=e+t;if(!(this.mode===ev.single&&t>1)){this.setChangeEvents(!1);for(var r=e;r<n;r++)this.setIndexSelected(r,!o,!1);this.setChangeEvents(!0)}}},e.prototype._updateCount=function(e){void 0===e&&(e=!1);var t=this.getSelectedCount();t!==this.count&&(this.count=t,this._change()),this.count||e||this.setModal(!1)},e.prototype._setAllSelected=function(e,t){if(void 0===t&&(t=!1),!e||this.mode===ev.multiple){var o=this._items?this._items.length-this._unselectableCount:0;this.setChangeEvents(!1),o>0&&(this._exemptedCount>0||e!==this._isAllSelected)&&(this._exemptedIndices={},(e!==this._isAllSelected||this._exemptedCount>0)&&(this._exemptedCount=0,this._isAllSelected=e,this._change()),this._updateCount(t)),this.setChangeEvents(!0)}},e.prototype._change=function(){0===this._changeEventSuppressionCount?(this._selectedItems=null,this._selectedIndices=void 0,zs.raise(this,rv),this._onSelectionChanged&&this._onSelectionChanged()):this._hasChanged=!0},e}();function av(e,t){var o=(e||{}).key;return void 0===o?""+t:o}var sv,lv,cv,uv,dv,pv,hv="data-selection-index",mv="data-selection-toggle",gv="data-selection-invoke",fv="data-selection-all-toggle",vv=function(e){function t(t){var o=e.call(this,t)||this;o._root=f.createRef(),o.ignoreNextFocus=function(){o._handleNextFocus(!1)},o._onSelectionChange=function(){var e=o.props.selection,t=e.isModal&&e.isModal();o.setState({isModal:t})},o._onMouseDownCapture=function(e){var t=e.target;if(document.activeElement===t||_a(document.activeElement,t)){if(_a(t,o._root.current))for(;t!==o._root.current;){if(o._hasAttribute(t,gv)){o.ignoreNextFocus();break}t=ba(t)}}else o.ignoreNextFocus()},o._onFocus=function(e){var t=e.target,n=o.props.selection,r=o._isCtrlPressed||o._isMetaPressed,i=o._getSelectionMode();if(o._shouldHandleFocus&&i!==ev.none){var a=o._hasAttribute(t,mv),s=o._findItemRoot(t);if(!a&&s){var l=o._getItemIndex(s);r?(n.setIndexSelected(l,n.isIndexSelected(l),!0),o.props.enterModalOnTouch&&o._isTouch&&n.setModal&&(n.setModal(!0),o._setIsTouch(!1))):o.props.isSelectedOnFocus&&o._onItemSurfaceClick(e,l)}}o._handleNextFocus(!1)},o._onMouseDown=function(e){o._updateModifiers(e);var t=e.target,n=o._findItemRoot(t);if(!o._isSelectionDisabled(t))for(;t!==o._root.current&&!o._hasAttribute(t,fv);){if(n){if(o._hasAttribute(t,mv))break;if(o._hasAttribute(t,gv))break;if(!(t!==n&&!o._shouldAutoSelect(t)||o._isShiftPressed||o._isCtrlPressed||o._isMetaPressed)){o._onInvokeMouseDown(e,o._getItemIndex(n));break}if(o.props.disableAutoSelectOnInputElements&&("A"===t.tagName||"BUTTON"===t.tagName||"INPUT"===t.tagName))return}t=ba(t)}},o._onTouchStartCapture=function(e){o._setIsTouch(!0)},o._onClick=function(e){var t=o.props.enableTouchInvocationTarget,n=void 0!==t&&t;o._updateModifiers(e);for(var r=e.target,i=o._findItemRoot(r),a=o._isSelectionDisabled(r);r!==o._root.current;){if(o._hasAttribute(r,fv)){a||o._onToggleAllClick(e);break}if(i){var s=o._getItemIndex(i);if(o._hasAttribute(r,mv)){a||(o._isShiftPressed?o._onItemSurfaceClick(e,s):o._onToggleClick(e,s));break}if(o._isTouch&&n&&o._hasAttribute(r,"data-selection-touch-invoke")||o._hasAttribute(r,gv)){o._onInvokeClick(e,s);break}if(r===i){a||o._onItemSurfaceClick(e,s);break}if("A"===r.tagName||"BUTTON"===r.tagName||"INPUT"===r.tagName)return}r=ba(r)}},o._onContextMenu=function(e){var t=e.target,n=o.props,r=n.onItemContextMenu,i=n.selection;if(r){var a=o._findItemRoot(t);if(a){var s=o._getItemIndex(a);o._onInvokeMouseDown(e,s),r(i.getItems()[s],s,e.nativeEvent)||e.preventDefault()}}},o._onDoubleClick=function(e){var t=e.target,n=o.props.onItemInvoked,r=o._findItemRoot(t);if(r&&n&&!o._isInputElement(t)){for(var i=o._getItemIndex(r);t!==o._root.current&&!o._hasAttribute(t,mv)&&!o._hasAttribute(t,gv);){if(t===r){o._onInvokeClick(e,i);break}t=ba(t)}t=ba(t)}},o._onKeyDownCapture=function(e){o._updateModifiers(e),o._handleNextFocus(!0)},o._onKeyDown=function(e){o._updateModifiers(e);var t=e.target,n=o._isSelectionDisabled(t),r=o.props.selection,i=e.which===Gn.a&&(o._isCtrlPressed||o._isMetaPressed),a=e.which===Gn.escape;if(!o._isInputElement(t)){var s=o._getSelectionMode();if(i&&s===ev.multiple&&!r.isAllSelected())return n||r.setAllSelected(!0),e.stopPropagation(),void e.preventDefault();if(a&&r.getSelectedCount()>0)return n||r.setAllSelected(!1),e.stopPropagation(),void e.preventDefault();var l=o._findItemRoot(t);if(l)for(var c=o._getItemIndex(l);t!==o._root.current&&!o._hasAttribute(t,mv);){if(o._shouldAutoSelect(t)){n||o._onInvokeMouseDown(e,c);break}if(!(e.which!==Gn.enter&&e.which!==Gn.space||"BUTTON"!==t.tagName&&"A"!==t.tagName&&"INPUT"!==t.tagName))return!1;if(t===l){if(e.which===Gn.enter)return o._onInvokeClick(e,c),void e.preventDefault();if(e.which===Gn.space)return n||o._onToggleClick(e,c),void e.preventDefault();break}t=ba(t)}}},o._events=new zs(o),o._async=new Zi(o),Gi(o);var n=o.props.selection,r=n.isModal&&n.isModal();return o.state={isModal:r},o}return u(t,e),t.getDerivedStateFromProps=function(e,t){var o=e.selection.isModal&&e.selection.isModal();return d(d({},t),{isModal:o})},t.prototype.componentDidMount=function(){var e=at(this._root.current);this._events.on(e,"keydown, keyup",this._updateModifiers,!0),this._events.on(document,"click",this._findScrollParentAndTryClearOnEmptyClick),this._events.on(document.body,"touchstart",this._onTouchStartCapture,!0),this._events.on(document.body,"touchend",this._onTouchStartCapture,!0),this._events.on(this.props.selection,"change",this._onSelectionChange)},t.prototype.render=function(){var e=this.state.isModal;return f.createElement("div",{className:qr("ms-SelectionZone",this.props.className,{"ms-SelectionZone--modal":!!e}),ref:this._root,onKeyDown:this._onKeyDown,onMouseDown:this._onMouseDown,onKeyDownCapture:this._onKeyDownCapture,onClick:this._onClick,role:"presentation",onDoubleClick:this._onDoubleClick,onContextMenu:this._onContextMenu,onMouseDownCapture:this._onMouseDownCapture,onFocusCapture:this._onFocus,"data-selection-is-modal":!!e||void 0},this.props.children,f.createElement(ws,null))},t.prototype.componentDidUpdate=function(e){var t=this.props.selection;t!==e.selection&&(this._events.off(e.selection),this._events.on(t,"change",this._onSelectionChange))},t.prototype.componentWillUnmount=function(){this._events.dispose(),this._async.dispose()},t.prototype._isSelectionDisabled=function(e){if(this._getSelectionMode()===ev.none)return!0;for(;e!==this._root.current;){if(this._hasAttribute(e,"data-selection-disabled"))return!0;e=ba(e)}return!1},t.prototype._onToggleAllClick=function(e){var t=this.props.selection;this._getSelectionMode()===ev.multiple&&(t.toggleAllSelected(),e.stopPropagation(),e.preventDefault())},t.prototype._onToggleClick=function(e,t){var o=this.props.selection,n=this._getSelectionMode();if(o.setChangeEvents(!1),this.props.enterModalOnTouch&&this._isTouch&&!o.isIndexSelected(t)&&o.setModal&&(o.setModal(!0),this._setIsTouch(!1)),n===ev.multiple)o.toggleIndexSelected(t);else{if(n!==ev.single)return void o.setChangeEvents(!0);var r=o.isIndexSelected(t),i=o.isModal&&o.isModal();o.setAllSelected(!1),o.setIndexSelected(t,!r,!0),i&&o.setModal&&o.setModal(!0)}o.setChangeEvents(!0),e.stopPropagation()},t.prototype._onInvokeClick=function(e,t){var o=this.props,n=o.selection,r=o.onItemInvoked;r&&(r(n.getItems()[t],t,e.nativeEvent),e.preventDefault(),e.stopPropagation())},t.prototype._onItemSurfaceClick=function(e,t){var o=this.props.selection,n=this._isCtrlPressed||this._isMetaPressed,r=this._getSelectionMode();r===ev.multiple?this._isShiftPressed&&!this._isTabPressed?o.selectToIndex(t,!n):n?o.toggleIndexSelected(t):this._clearAndSelectIndex(t):r===ev.single&&this._clearAndSelectIndex(t)},t.prototype._onInvokeMouseDown=function(e,t){this.props.selection.isIndexSelected(t)||this._clearAndSelectIndex(t)},t.prototype._findScrollParentAndTryClearOnEmptyClick=function(e){var t=ts(this._root.current);this._events.off(document,"click",this._findScrollParentAndTryClearOnEmptyClick),this._events.on(t,"click",this._tryClearOnEmptyClick),(t&&e.target instanceof Node&&t.contains(e.target)||t===e.target)&&this._tryClearOnEmptyClick(e)},t.prototype._tryClearOnEmptyClick=function(e){!this.props.selectionPreservedOnEmptyClick&&this._isNonHandledClick(e.target)&&this.props.selection.setAllSelected(!1)},t.prototype._clearAndSelectIndex=function(e){var t=this.props.selection;if(1!==t.getSelectedCount()||!t.isIndexSelected(e)){var o=t.isModal&&t.isModal();t.setChangeEvents(!1),t.setAllSelected(!1),t.setIndexSelected(e,!0,!0),(o||this.props.enterModalOnTouch&&this._isTouch)&&(t.setModal&&t.setModal(!0),this._isTouch&&this._setIsTouch(!1)),t.setChangeEvents(!0)}},t.prototype._updateModifiers=function(e){this._isShiftPressed=e.shiftKey,this._isCtrlPressed=e.ctrlKey,this._isMetaPressed=e.metaKey;var t=e.keyCode;this._isTabPressed=!!t&&t===Gn.tab},t.prototype._findItemRoot=function(e){for(var t=this.props.selection;e!==this._root.current;){var o=e.getAttribute(hv),n=Number(o);if(null!==o&&n>=0&&n<t.getItems().length)break;e=ba(e)}if(e!==this._root.current)return e},t.prototype._getItemIndex=function(e){return Number(e.getAttribute(hv))},t.prototype._shouldAutoSelect=function(e){return this._hasAttribute(e,"data-selection-select")},t.prototype._hasAttribute=function(e,t){for(var o=!1;!o&&e!==this._root.current;)o="true"===e.getAttribute(t),e=ba(e);return o},t.prototype._isInputElement=function(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName},t.prototype._isNonHandledClick=function(e){var t=nt();if(t&&e)for(;e&&e!==t.documentElement;){if(Ra(e))return!1;e=ba(e)}return!0},t.prototype._handleNextFocus=function(e){var t=this;this._shouldHandleFocusTimeoutId&&(this._async.clearTimeout(this._shouldHandleFocusTimeoutId),this._shouldHandleFocusTimeoutId=void 0),this._shouldHandleFocus=e,e&&this._async.setTimeout((function(){t._shouldHandleFocus=!1}),100)},t.prototype._setIsTouch=function(e){var t=this;this._isTouchTimeoutId&&(this._async.clearTimeout(this._isTouchTimeoutId),this._isTouchTimeoutId=void 0),this._isTouch=!0,e&&this._async.setTimeout((function(){t._isTouch=!1}),300)},t.prototype._getSelectionMode=function(){var e=this.props.selection,t=this.props.selectionMode;return void 0===t?e?e.mode:ev.none:t},t.defaultProps={isSelectedOnFocus:!0,selectionMode:ev.multiple},t}(f.Component);!function(e){e[e.hidden=0]="hidden",e[e.visible=1]="visible"}(sv||(sv={})),function(e){e[e.disabled=0]="disabled",e[e.clickable=1]="clickable",e[e.hasDropdown=2]="hasDropdown"}(lv||(lv={})),function(e){e[e.unconstrained=0]="unconstrained",e[e.horizontalConstrained=1]="horizontalConstrained"}(cv||(cv={})),function(e){e[e.outside=0]="outside",e[e.surface=1]="surface",e[e.header=2]="header"}(uv||(uv={})),function(e){e[e.fixedColumns=0]="fixedColumns",e[e.justified=1]="justified"}(dv||(dv={})),function(e){e[e.onHover=0]="onHover",e[e.always=1]="always",e[e.hidden=2]="hidden"}(pv||(pv={}));var bv=function(e){var t=e.count,o=e.indentWidth,n=void 0===o?36:o,r=e.role,i=void 0===r?"presentation":r,a=t*n;return t>0?f.createElement("span",{className:"ms-GroupSpacer",style:{display:"inline-block",width:a},role:i}):null},yv={label:ar,audio:sr,video:lr,ol:cr,li:ur,a:dr,button:pr,input:hr,textarea:mr,select:gr,option:fr,table:vr,tr:br,th:yr,td:Cr,colGroup:_r,col:Sr,form:xr,iframe:kr,img:wr};function Cv(e,t,o){return Tr(t,e&&yv[e]||ir,o)}var _v={root:"ms-DetailsRow",compact:"ms-DetailsList--Compact",cell:"ms-DetailsRow-cell",cellAnimation:"ms-DetailsRow-cellAnimation",cellCheck:"ms-DetailsRow-cellCheck",check:"ms-DetailsRow-check",cellMeasurer:"ms-DetailsRow-cellMeasurer",listCellFirstChild:"ms-List-cell:first-child",isContentUnselectable:"is-contentUnselectable",isSelected:"is-selected",isCheckVisible:"is-check-visible",isRowHeader:"is-row-header",fields:"ms-DetailsRow-fields"},Sv={cellLeftPadding:12,cellRightPadding:8,cellExtraRightPadding:24},xv={rowHeight:42,compactRowHeight:32},kv=d(d({},xv),{rowVerticalPadding:11,compactRowVerticalPadding:6}),wv=function(e){var t,o,n,r,i,a,s,l,c,u,p,h,m=e.theme,g=e.isSelected,f=e.canSelect,v=e.droppingClassName,b=e.anySelected,y=e.isCheckVisible,C=e.checkboxCellClassName,_=e.compact,S=e.className,x=e.cellStyleProps,k=void 0===x?Sv:x,w=e.enableUpdateAnimations,I=e.disabled,D=m.palette,T=m.fonts,E=D.neutralPrimary,P=D.white,R=D.neutralSecondary,M=D.neutralLighter,N=D.neutralLight,B=D.neutralDark,F=D.neutralQuaternaryAlt,A=m.semanticColors,L=A.focusBorder,H=A.linkHovered,O=Qo(_v,m),z={defaultHeaderText:E,defaultMetaText:R,defaultBackground:P,defaultHoverHeaderText:B,defaultHoverMetaText:E,defaultHoverBackground:M,selectedHeaderText:B,selectedMetaText:E,selectedBackground:N,selectedHoverHeaderText:B,selectedHoverMetaText:E,selectedHoverBackground:F,focusHeaderText:B,focusMetaText:E,focusBackground:N,focusHoverBackground:F},W=[To(m,{inset:-1,borderColor:L,outlineColor:P,highContrastStyle:{top:2,right:2,bottom:2,left:2}}),O.isSelected,{color:z.selectedMetaText,background:z.selectedBackground,borderBottom:"1px solid "+P,selectors:(t={"&:before":{position:"absolute",display:"block",top:-1,height:1,bottom:0,left:0,right:0,content:"",borderTop:"1px solid "+P}},t["."+O.cell+" > ."+Ms.root]={color:H},t["&:hover"]={background:z.selectedHoverBackground,color:z.selectedHoverMetaText,selectors:(o={},o["."+O.cell+" "+ro]={color:"HighlightText",selectors:{"> a":{color:"HighlightText"}}},o["."+O.isRowHeader]={color:z.selectedHoverHeaderText,selectors:(n={},n[ro]={color:"HighlightText"},n)},o[ro]={background:"Highlight"},o)},t["&:focus"]={background:z.focusBackground,selectors:(r={},r["."+O.cell]={color:z.focusMetaText,selectors:(i={},i[ro]={color:"HighlightText",selectors:{"> a":{color:"HighlightText"}}},i)},r["."+O.isRowHeader]={color:z.focusHeaderText,selectors:(a={},a[ro]={color:"HighlightText"},a)},r[ro]={background:"Highlight"},r)},t[ro]=d(d({background:"Highlight",color:"HighlightText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),{selectors:{a:{color:"HighlightText"}}}),t["&:focus:hover"]={background:z.focusHoverBackground},t)}],V=[O.isContentUnselectable,{userSelect:"none",cursor:"default"}],K={minHeight:kv.compactRowHeight,border:0},G={minHeight:kv.compactRowHeight,paddingTop:kv.compactRowVerticalPadding,paddingBottom:kv.compactRowVerticalPadding,paddingLeft:k.cellLeftPadding+"px"},U=[To(m,{inset:-1}),O.cell,{display:"inline-block",position:"relative",boxSizing:"border-box",minHeight:kv.rowHeight,verticalAlign:"top",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",paddingTop:kv.rowVerticalPadding,paddingBottom:kv.rowVerticalPadding,paddingLeft:k.cellLeftPadding+"px",selectors:(s={"& > button":{maxWidth:"100%"}},s["[data-is-focusable='true']"]=To(m,{inset:-1,borderColor:R,outlineColor:P}),s)},g&&{selectors:(l={},l[ro]=d(d({background:"Highlight",color:"HighlightText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),{selectors:{a:{color:"HighlightText"}}}),l)},_&&G,I&&{opacity:.5}];return{root:[O.root,Ze.fadeIn400,v,m.fonts.small,y&&O.isCheckVisible,To(m,{borderColor:L,outlineColor:P}),{borderBottom:"1px solid "+M,background:z.defaultBackground,color:z.defaultMetaText,display:"inline-flex",minWidth:"100%",minHeight:kv.rowHeight,whiteSpace:"nowrap",padding:0,boxSizing:"border-box",verticalAlign:"top",textAlign:"left",selectors:(c={},c["."+O.listCellFirstChild+" &:before"]={display:"none"},c["&:hover"]={background:z.defaultHoverBackground,color:z.defaultHoverMetaText,selectors:(u={},u["."+O.isRowHeader]={color:z.defaultHoverHeaderText},u["."+O.cell+" > ."+Ms.root]={color:H},u)},c["&:hover ."+O.check]={opacity:1},c["."+wo+" &:focus ."+O.check]={opacity:1},c[".ms-GroupSpacer"]={flexShrink:0,flexGrow:0},c)},g&&W,!f&&V,_&&K,S],cellUnpadded:{paddingRight:k.cellRightPadding+"px"},cellPadded:{paddingRight:k.cellExtraRightPadding+k.cellRightPadding+"px",selectors:(p={},p["&."+O.cellCheck]={paddingRight:0},p)},cell:U,cellAnimation:w&&He.slideLeftIn40,cellMeasurer:[O.cellMeasurer,{overflow:"visible",whiteSpace:"nowrap"}],checkCell:[U,O.cellCheck,C,{padding:0,paddingTop:1,marginTop:-1,flexShrink:0}],checkCover:{position:"absolute",top:-1,left:0,bottom:0,right:0,display:b?"block":"none"},fields:[O.fields,{display:"flex",alignItems:"stretch"}],isRowHeader:[O.isRowHeader,{color:z.defaultHeaderText,fontSize:T.medium.fontSize},g&&{color:z.selectedHeaderText,fontWeight:qe.semibold,selectors:(h={},h[ro]={color:"HighlightText"},h)}],isMultiline:[U,{whiteSpace:"normal",wordBreak:"break-word",textOverflow:"clip"}],check:[O.check]}},Iv={tooltipHost:"ms-TooltipHost",root:"ms-DetailsHeader",cell:"ms-DetailsHeader-cell",cellIsCheck:"ms-DetailsHeader-cellIsCheck",collapseButton:"ms-DetailsHeader-collapseButton",isCollapsed:"is-collapsed",isAllSelected:"is-allSelected",isSelectAllHidden:"is-selectAllHidden",isResizingColumn:"is-resizingColumn",cellSizer:"ms-DetailsHeader-cellSizer",isResizing:"is-resizing",dropHintCircleStyle:"ms-DetailsHeader-dropHintCircleStyle",dropHintCaretStyle:"ms-DetailsHeader-dropHintCaretStyle",dropHintLineStyle:"ms-DetailsHeader-dropHintLineStyle",cellTitle:"ms-DetailsHeader-cellTitle",cellName:"ms-DetailsHeader-cellName",filterChevron:"ms-DetailsHeader-filterChevron",gripperBarVertical:"ms-DetailsColumn-gripperBarVertical",checkTooltip:"ms-DetailsHeader-checkTooltip",check:"ms-DetailsHeader-check"},Dv=function(e){var t=e.theme,o=e.cellStyleProps,n=void 0===o?Sv:o,r=t.semanticColors;return[Qo(Iv,t).cell,To(t),{color:r.bodyText,position:"relative",display:"inline-block",boxSizing:"border-box",padding:"0 "+n.cellRightPadding+"px 0 "+n.cellLeftPadding+"px",lineHeight:"inherit",margin:"0",height:42,verticalAlign:"top",whiteSpace:"nowrap",textOverflow:"ellipsis",textAlign:"left"}]},Tv={root:"ms-DetailsRow-check",isDisabled:"ms-DetailsRow-check--isDisabled",isHeader:"ms-DetailsRow-check--isHeader"},Ev=Jn(),Pv=f.memo((function(e){return f.createElement(Hh,{theme:e.theme,checked:e.checked,className:e.className,useFastIcons:!0})}));function Rv(e){return f.createElement(Hh,{checked:e.checked})}function Mv(e){return f.createElement(Pv,{theme:e.theme,checked:e.checked})}var Nv,Bv=Vn((function(e){var t=e.isVisible,o=void 0!==t&&t,n=e.canSelect,r=void 0!==n&&n,i=e.anySelected,a=void 0!==i&&i,s=e.selected,l=void 0!==s&&s,c=e.selectionMode,u=e.isHeader,h=void 0!==u&&u,m=e.className,g=(e.checkClassName,e.styles),v=e.theme,b=e.compact,y=e.onRenderDetailsCheckbox,C=e.useFastIcons,_=void 0===C||C,S=p(e,["isVisible","canSelect","anySelected","selected","selectionMode","isHeader","className","checkClassName","styles","theme","compact","onRenderDetailsCheckbox","useFastIcons"]),x=_?Mv:Rv,k=y?Xh(y,x):x,w=Ev(g,{theme:v,canSelect:r,selected:l,anySelected:a,className:m,isHeader:h,isVisible:o,compact:b}),I={checked:l,theme:v},D=Cv("div",S,["aria-label","aria-labelledby","aria-describedby"]),T=c===ev.single?"radio":"checkbox";return r?f.createElement("div",d({},S,{role:T,className:qr(w.root,w.check),"aria-checked":l,"data-selection-toggle":!0,"data-automationid":"DetailsRowCheck",tabIndex:-1}),k(I)):f.createElement("div",d({},D,{className:qr(w.root,w.check)}))}),(function(e){var t=e.theme,o=e.className,n=e.isHeader,r=e.selected,i=e.anySelected,a=e.canSelect,s=e.compact,l=e.isVisible,c=Qo(Tv,t),u=xv.rowHeight,d=xv.compactRowHeight,p=n?42:s?d:u,h=l||r||i;return{root:[c.root,o],check:[!a&&c.isDisabled,n&&c.isHeader,To(t),t.fonts.small,Lh.checkHost,{display:"flex",alignItems:"center",justifyContent:"center",cursor:"default",boxSizing:"border-box",verticalAlign:"top",background:"none",backgroundColor:"transparent",border:"none",opacity:h?1:0,height:p,width:48,padding:0,margin:0}],isDisabled:[]}}),void 0,{scope:"DetailsRowCheck"},!0),Fv=function(){function e(e){this._selection=e.selection,this._dragEnterCounts={},this._activeTargets={},this._lastId=0,this._initialized=!1}return e.prototype.dispose=function(){this._events&&this._events.dispose()},e.prototype.subscribe=function(e,t,o){var n=this;if(!this._initialized){this._events=new zs(this);var r=nt();r&&(this._events.on(r.body,"mouseup",this._onMouseUp.bind(this),!0),this._events.on(r,"mouseup",this._onDocumentMouseUp.bind(this),!0)),this._initialized=!0}var i,a,s,l,c,u,d,p,h,m,g=o.key,f=void 0===g?""+ ++this._lastId:g,v=[];if(o&&e){var b=o.eventMap,y=o.context,C=o.updateDropState,_={root:e,options:o,key:f};if(p=this._isDraggable(_),h=this._isDroppable(_),(p||h)&&b)for(var S=0,x=b;S<x.length;S++){var k=x[S],w={callback:k.callback.bind(null,y),eventName:k.eventName};v.push(w),this._events.on(e,w.eventName,w.callback)}h&&(a=function(e){e.isHandled||(e.isHandled=!0,n._dragEnterCounts[f]--,0===n._dragEnterCounts[f]&&C(!1,e))},s=function(e){e.preventDefault(),e.isHandled||(e.isHandled=!0,n._dragEnterCounts[f]++,1===n._dragEnterCounts[f]&&C(!0,e))},l=function(e){n._dragEnterCounts[f]=0,C(!1,e)},c=function(e){n._dragEnterCounts[f]=0,C(!1,e),o.onDrop&&o.onDrop(o.context.data,e)},u=function(e){e.preventDefault(),o.onDragOver&&o.onDragOver(o.context.data,e)},this._dragEnterCounts[f]=0,t.on(e,"dragenter",s),t.on(e,"dragleave",a),t.on(e,"dragend",l),t.on(e,"drop",c),t.on(e,"dragover",u)),p&&(d=this._onMouseDown.bind(this,_),l=this._onDragEnd.bind(this,_),i=function(t){var r=o;r&&r.onDragStart&&r.onDragStart(r.context.data,r.context.index,n._selection.getSelection(),t),n._isDragging=!0,t.dataTransfer&&t.dataTransfer.setData("id",e.id)},t.on(e,"dragstart",i),t.on(e,"mousedown",d),t.on(e,"dragend",l)),m={target:_,dispose:function(){if(n._activeTargets[f]===m&&delete n._activeTargets[f],e){for(var o=0,r=v;o<r.length;o++){var g=r[o];n._events.off(e,g.eventName,g.callback)}h&&(t.off(e,"dragenter",s),t.off(e,"dragleave",a),t.off(e,"dragend",l),t.off(e,"dragover",u),t.off(e,"drop",c)),p&&(t.off(e,"dragstart",i),t.off(e,"mousedown",d),t.off(e,"dragend",l))}}},this._activeTargets[f]=m}return{key:f,dispose:function(){m&&m.dispose()}}},e.prototype.unsubscribe=function(e,t){var o=this._activeTargets[t];o&&o.dispose()},e.prototype._onDragEnd=function(e,t){var o=e.options;o.onDragEnd&&o.onDragEnd(o.context.data,t)},e.prototype._onMouseUp=function(e){if(this._isDragging=!1,this._dragData){for(var t=0,o=Object.keys(this._activeTargets);t<o.length;t++){var n=o[t],r=this._activeTargets[n];r.target.root&&(this._events.off(r.target.root,"mousemove"),this._events.off(r.target.root,"mouseleave"))}this._dragData.dropTarget&&(zs.raise(this._dragData.dropTarget.root,"dragleave"),zs.raise(this._dragData.dropTarget.root,"drop"))}this._dragData=null},e.prototype._onDocumentMouseUp=function(e){var t=nt();t&&e.target===t.documentElement&&this._onMouseUp(e)},e.prototype._onMouseMove=function(e,t){var o=t.buttons,n=void 0===o?1:o;if(this._dragData&&1!==n)this._onMouseUp(t);else{var r=e.root,i=e.key;this._isDragging&&this._isDroppable(e)&&this._dragData&&this._dragData.dropTarget&&this._dragData.dropTarget.key!==i&&!this._isChild(r,this._dragData.dropTarget.root)&&this._dragEnterCounts[this._dragData.dropTarget.key]>0&&(zs.raise(this._dragData.dropTarget.root,"dragleave"),zs.raise(r,"dragenter"),this._dragData.dropTarget=e)}},e.prototype._onMouseLeave=function(e,t){this._isDragging&&this._dragData&&this._dragData.dropTarget&&this._dragData.dropTarget.key===e.key&&(zs.raise(e.root,"dragleave"),this._dragData.dropTarget=void 0)},e.prototype._onMouseDown=function(e,t){if(0===t.button)if(this._isDraggable(e)){this._dragData={clientX:t.clientX,clientY:t.clientY,eventTarget:t.target,dragTarget:e};for(var o=0,n=Object.keys(this._activeTargets);o<n.length;o++){var r=n[o],i=this._activeTargets[r];i.target.root&&(this._events.on(i.target.root,"mousemove",this._onMouseMove.bind(this,i.target)),this._events.on(i.target.root,"mouseleave",this._onMouseLeave.bind(this,i.target)))}}else this._dragData=null},e.prototype._isChild=function(e,t){for(;t&&t.parentElement;){if(t.parentElement===e)return!0;t=t.parentElement}return!1},e.prototype._isDraggable=function(e){var t=e.options;return!(!t.canDrag||!t.canDrag(t.context.data))},e.prototype._isDroppable=function(e){var t=e.options,o=this._dragData&&this._dragData.dragTarget?this._dragData.dragTarget.options.context:void 0;return!(!t.canDrop||!t.canDrop(t.context,o))},e}(),Av=Jn(),Lv=function(e){return function(t){return t?t.column.isIconOnly?f.createElement("span",{className:e.accessibleLabel},t.column.name):f.createElement(f.Fragment,null,t.column.name):null}},Hv=function(e){function t(t){var o=e.call(this,t)||this;return o._root=f.createRef(),o._onRenderFilterIcon=function(e){return function(e){var t=e.columnProps,o=p(e,["columnProps"]),n=(null==t?void 0:t.useFastIcons)?ti:ii;return f.createElement(n,d({},o))}},o._onRenderColumnHeaderTooltip=function(e){return f.createElement("span",{className:e.hostClassName},e.children)},o._onColumnClick=function(e){var t=o.props,n=t.onColumnClick,r=t.column;r.columnActionsMode!==lv.disabled&&(r.onColumnClick&&r.onColumnClick(e,r),n&&n(e,r))},o._onDragStart=function(e,t,n,r){var i=o._classNames;t&&(o._updateHeaderDragInfo(t),o._root.current.classList.add(i.borderWhileDragging),o._async.setTimeout((function(){o._root.current&&o._root.current.classList.add(i.noBorderWhileDragging)}),20))},o._onDragEnd=function(e,t){var n=o._classNames;t&&o._updateHeaderDragInfo(-1,t),o._root.current.classList.remove(n.borderWhileDragging),o._root.current.classList.remove(n.noBorderWhileDragging)},o._updateHeaderDragInfo=function(e,t){o.props.setDraggedItemIndex&&o.props.setDraggedItemIndex(e),o.props.updateDragInfo&&o.props.updateDragInfo({itemIndex:e},t)},o._onColumnContextMenu=function(e){var t=o.props,n=t.onColumnContextMenu,r=t.column;r.onColumnContextMenu&&(r.onColumnContextMenu(r,e),e.preventDefault()),n&&(n(r,e),e.preventDefault())},o._onRootMouseDown=function(e){o.props.isDraggable&&0===e.button&&e.stopPropagation()},Gi(o),o._async=new Zi(o),o._events=new zs(o),o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.column,o=e.columnIndex,n=e.parentId,r=e.isDraggable,i=e.styles,a=e.theme,s=e.cellStyleProps,l=void 0===s?Sv:s,c=e.useFastIcons,u=void 0===c||c,p=this.props.onRenderColumnHeaderTooltip,h=void 0===p?this._onRenderColumnHeaderTooltip:p;this._classNames=Av(i,{theme:a,headerClassName:t.headerClassName,iconClassName:t.iconClassName,isActionable:t.columnActionsMode!==lv.disabled,isEmpty:!t.name,isIconVisible:t.isSorted||t.isGrouped||t.isFiltered,isPadded:t.isPadded,isIconOnly:t.isIconOnly,cellStyleProps:l,transitionDurationDrag:200,transitionDurationDrop:1500});var m=this._classNames,g=u?ti:ii,v=t.onRenderFilterIcon?Xh(t.onRenderFilterIcon,this._onRenderFilterIcon(this._classNames)):this._onRenderFilterIcon(this._classNames),b=t.onRenderHeader?Xh(t.onRenderHeader,Lv(this._classNames)):Lv(this._classNames),y=t.columnActionsMode!==lv.disabled&&(void 0!==t.onColumnClick||void 0!==this.props.onColumnClick),C={"aria-label":t.isIconOnly?t.name:void 0,"aria-labelledby":t.isIconOnly?void 0:n+"-"+t.key+"-name","aria-describedby":!this.props.onRenderColumnHeaderTooltip&&this._hasAccessibleLabel()?n+"-"+t.key+"-tooltip":void 0};return f.createElement(f.Fragment,null,f.createElement("div",d({key:t.key,ref:this._root,role:"columnheader"},!y&&C,{"aria-sort":t.isSorted?t.isSortedDescending?"descending":"ascending":"none","aria-colindex":o,"data-is-focusable":y||t.columnActionsMode===lv.disabled?void 0:"true",className:m.root,"data-is-draggable":r,draggable:r,style:{width:t.calculatedWidth+l.cellLeftPadding+l.cellRightPadding+(t.isPadded?l.cellExtraRightPadding:0)},"data-automationid":"ColumnsHeaderColumn","data-item-key":t.key}),r&&f.createElement(g,{iconName:"GripperBarVertical",className:m.gripperBarVerticalStyle}),h({hostClassName:m.cellTooltip,id:n+"-"+t.key+"-tooltip",setAriaDescribedBy:!1,column:t,content:t.columnActionsMode!==lv.disabled?t.ariaLabel:"",children:f.createElement("span",d({id:n+"-"+t.key,className:m.cellTitle,"data-is-focusable":y&&t.columnActionsMode!==lv.disabled?"true":void 0,role:y?"button":void 0},y&&C,{onContextMenu:this._onColumnContextMenu,onClick:this._onColumnClick,"aria-haspopup":t.columnActionsMode===lv.hasDropdown?"menu":void 0,"aria-expanded":t.columnActionsMode===lv.hasDropdown?!!t.isMenuOpen:void 0}),f.createElement("span",{id:n+"-"+t.key+"-name",className:m.cellName},(t.iconName||t.iconClassName)&&f.createElement(g,{className:m.iconClassName,iconName:t.iconName}),b(this.props)),t.isFiltered&&f.createElement(g,{className:m.nearIcon,iconName:"Filter"}),t.isSorted&&f.createElement(g,{className:m.sortIcon,iconName:t.isSortedDescending?"SortDown":"SortUp"}),t.isGrouped&&f.createElement(g,{className:m.nearIcon,iconName:"GroupedDescending"}),t.columnActionsMode===lv.hasDropdown&&!t.isIconOnly&&v({"aria-hidden":!0,columnProps:this.props,className:m.filterChevron,iconName:"ChevronDown"}))},this._onRenderColumnHeaderTooltip)),this.props.onRenderColumnHeaderTooltip?null:this._renderAccessibleLabel())},t.prototype.componentDidMount=function(){var e=this;this.props.dragDropHelper&&this.props.isDraggable&&this._addDragDropHandling();var t=this._classNames;this.props.isDropped&&(this._root.current&&(this._root.current.classList.add(t.borderAfterDropping),this._async.setTimeout((function(){e._root.current&&e._root.current.classList.add(t.noBorderAfterDropping)}),20)),this._async.setTimeout((function(){e._root.current&&(e._root.current.classList.remove(t.borderAfterDropping),e._root.current.classList.remove(t.noBorderAfterDropping))}),1520))},t.prototype.componentWillUnmount=function(){this._dragDropSubscription&&(this._dragDropSubscription.dispose(),delete this._dragDropSubscription),this._async.dispose(),this._events.dispose()},t.prototype.componentDidUpdate=function(){!this._dragDropSubscription&&this.props.dragDropHelper&&this.props.isDraggable&&this._addDragDropHandling(),this._dragDropSubscription&&!this.props.isDraggable&&(this._dragDropSubscription.dispose(),this._events.off(this._root.current,"mousedown"),delete this._dragDropSubscription)},t.prototype._getColumnDragDropOptions=function(){var e=this,t=this.props.columnIndex;return{selectionIndex:t,context:{data:t,index:t},canDrag:function(){return e.props.isDraggable},canDrop:function(){return!1},onDragStart:this._onDragStart,updateDropState:function(){},onDrop:function(){},onDragEnd:this._onDragEnd}},t.prototype._hasAccessibleLabel=function(){var e=this.props.column;return!!(e.ariaLabel||e.filterAriaLabel||e.sortAscendingAriaLabel||e.sortDescendingAriaLabel||e.groupAriaLabel)},t.prototype._renderAccessibleLabel=function(){var e=this.props,t=e.column,o=e.parentId,n=this._classNames;return this._hasAccessibleLabel()&&!this.props.onRenderColumnHeaderTooltip?f.createElement("label",{key:t.key+"_label",id:o+"-"+t.key+"-tooltip",className:n.accessibleLabel},t.ariaLabel,t.isFiltered&&t.filterAriaLabel||null,t.isSorted&&(t.isSortedDescending?t.sortDescendingAriaLabel:t.sortAscendingAriaLabel)||null,t.isGrouped&&t.groupAriaLabel||null):null},t.prototype._addDragDropHandling=function(){this._dragDropSubscription=this.props.dragDropHelper.subscribe(this._root.current,this._events,this._getColumnDragDropOptions()),this._events.on(this._root.current,"mousedown",this._onRootMouseDown)},t}(f.Component),Ov={isActionable:"is-actionable",cellIsCheck:"ms-DetailsHeader-cellIsCheck",collapseButton:"ms-DetailsHeader-collapseButton",isCollapsed:"is-collapsed",isAllSelected:"is-allSelected",isSelectAllHidden:"is-selectAllHidden",isResizingColumn:"is-resizingColumn",isEmpty:"is-empty",isIconVisible:"is-icon-visible",cellSizer:"ms-DetailsHeader-cellSizer",isResizing:"is-resizing",dropHintCircleStyle:"ms-DetailsHeader-dropHintCircleStyle",dropHintLineStyle:"ms-DetailsHeader-dropHintLineStyle",cellTitle:"ms-DetailsHeader-cellTitle",cellName:"ms-DetailsHeader-cellName",filterChevron:"ms-DetailsHeader-filterChevron",gripperBarVerticalStyle:"ms-DetailsColumn-gripperBar",nearIcon:"ms-DetailsColumn-nearIcon"},zv=Vn(Hv,(function(e){var t,o=e.theme,n=e.headerClassName,r=e.iconClassName,i=e.isActionable,a=e.isEmpty,s=e.isIconVisible,l=e.isPadded,c=e.isIconOnly,u=e.cellStyleProps,p=void 0===u?Sv:u,h=e.transitionDurationDrag,m=e.transitionDurationDrop,g=o.semanticColors,f=o.palette,v=o.fonts,b=Qo(Ov,o),y={iconForegroundColor:g.bodySubtext,headerForegroundColor:g.bodyText,headerBackgroundColor:g.bodyBackground,dropdownChevronForegroundColor:f.neutralSecondary,resizerColor:f.neutralTertiaryAlt},C={color:y.iconForegroundColor,opacity:1,paddingLeft:8},_={outline:"1px solid "+f.themePrimary},S={outlineColor:"transparent"};return{root:[Dv(e),v.small,i&&[b.isActionable,{selectors:{":hover":{color:g.bodyText,background:g.listHeaderBackgroundHovered},":active":{background:g.listHeaderBackgroundPressed}}}],a&&[b.isEmpty,{textOverflow:"clip"}],s&&b.isIconVisible,l&&{paddingRight:p.cellExtraRightPadding+p.cellRightPadding},{selectors:{':hover i[data-icon-name="GripperBarVertical"]':{display:"block"}}},n],gripperBarVerticalStyle:{display:"none",position:"absolute",textAlign:"left",color:f.neutralTertiary,left:1},nearIcon:[b.nearIcon,C],sortIcon:[C,{paddingLeft:4,position:"relative",top:1}],iconClassName:[{color:y.iconForegroundColor,opacity:1},r],filterChevron:[b.filterChevron,{color:y.dropdownChevronForegroundColor,paddingLeft:6,verticalAlign:"middle",fontSize:v.small.fontSize}],cellTitle:[b.cellTitle,To(o),d({display:"flex",flexDirection:"row",justifyContent:"flex-start",alignItems:"stretch",boxSizing:"border-box",overflow:"hidden",padding:"0 "+p.cellRightPadding+"px 0 "+p.cellLeftPadding+"px"},c?{alignContent:"flex-end",maxHeight:"100%",flexWrap:"wrap-reverse"}:{})],cellName:[b.cellName,{flex:"0 1 auto",overflow:"hidden",textOverflow:"ellipsis",fontWeight:qe.semibold,fontSize:v.medium.fontSize},c&&{selectors:(t={},t["."+b.nearIcon]={paddingLeft:0},t)}],cellTooltip:{display:"block",position:"absolute",top:0,left:0,bottom:0,right:0},accessibleLabel:Mo,borderWhileDragging:_,noBorderWhileDragging:[S,{transition:"outline "+h+"ms ease"}],borderAfterDropping:_,noBorderAfterDropping:[S,{transition:"outline "+m+"ms ease"}]}}),void 0,{scope:"DetailsColumn"});!function(e){e[e.none=0]="none",e[e.hidden=1]="hidden",e[e.visible=2]="visible"}(Nv||(Nv={}));var Wv=Jn(),Vv=[],Kv=function(e){function t(t){var o=e.call(this,t)||this;return o._rootElement=f.createRef(),o._rootComponent=f.createRef(),o._draggedColumnIndex=-1,o._dropHintDetails={},o._updateDroppingState=function(e,t){o._draggedColumnIndex>=0&&"drop"!==t.type&&!e&&o._resetDropHints()},o._onDragOver=function(e,t){o._draggedColumnIndex>=0&&(t.stopPropagation(),o._computeDropHintToBeShown(t.clientX))},o._onDrop=function(e,t){var n=o._getColumnReorderProps();if(o._draggedColumnIndex>=0&&t){var r=o._draggedColumnIndex>o._currentDropHintIndex?o._currentDropHintIndex:o._currentDropHintIndex-1,i=o._isValidCurrentDropHintIndex();if(t.stopPropagation(),i)if(o._onDropIndexInfo.sourceIndex=o._draggedColumnIndex,o._onDropIndexInfo.targetIndex=r,n.onColumnDrop){var a={draggedIndex:o._draggedColumnIndex,targetIndex:r};n.onColumnDrop(a)}else n.handleColumnReorder&&n.handleColumnReorder(o._draggedColumnIndex,r)}o._resetDropHints(),o._dropHintDetails={},o._draggedColumnIndex=-1},o._updateDragInfo=function(e,t){var n=o._getColumnReorderProps(),r=e.itemIndex;if(r>=0)o._draggedColumnIndex=o._isCheckboxColumnHidden()?r-1:r-2,o._getDropHintPositions(),n.onColumnDragStart&&n.onColumnDragStart(!0);else if(t&&o._draggedColumnIndex>=0&&(o._resetDropHints(),o._draggedColumnIndex=-1,o._dropHintDetails={},n.onColumnDragEnd)){var i=o._isEventOnHeader(t);n.onColumnDragEnd({dropLocation:i},t)}},o._getDropHintPositions=function(){for(var e,t=o.props.columns,n=void 0===t?Vv:t,r=o._getColumnReorderProps(),i=0,a=0,s=r.frozenColumnCountFromStart||0,l=r.frozenColumnCountFromEnd||0,c=s;c<n.length-l+1;c++)if(o._rootElement.current){var u=o._rootElement.current.querySelectorAll("#columnDropHint_"+c)[0];if(u)if(c===s)i=u.offsetLeft,a=u.offsetLeft,e=u;else{var d=(u.offsetLeft+i)/2;o._dropHintDetails[c-1]={originX:i,startX:a,endX:d,dropHintElementRef:e},a=d,e=u,i=u.offsetLeft,c===n.length-l&&(o._dropHintDetails[c]={originX:i,startX:a,endX:u.offsetLeft,dropHintElementRef:e})}}},o._computeDropHintToBeShown=function(e){var t=jn(o.props.theme);if(o._rootElement.current){var n=e-o._rootElement.current.getBoundingClientRect().left,r=o._currentDropHintIndex;if(o._isValidCurrentDropHintIndex()&&Gv(t,n,o._dropHintDetails[r].startX,o._dropHintDetails[r].endX))return;var i=o.props.columns,a=void 0===i?Vv:i,s=o._getColumnReorderProps(),l=s.frozenColumnCountFromStart||0,c=s.frozenColumnCountFromEnd||0,u=l,d=a.length-c,p=-1;if(Uv(t,n,o._dropHintDetails[u].endX)?p=u:jv(t,n,o._dropHintDetails[d].startX)?p=d:o._isValidCurrentDropHintIndex()&&(o._dropHintDetails[r+1]&&Gv(t,n,o._dropHintDetails[r+1].startX,o._dropHintDetails[r+1].endX)?p=r+1:o._dropHintDetails[r-1]&&Gv(t,n,o._dropHintDetails[r-1].startX,o._dropHintDetails[r-1].endX)&&(p=r-1)),-1===p)for(var h=l,m=d;h<m;){var g=Math.ceil((m+h)/2);if(Gv(t,n,o._dropHintDetails[g].startX,o._dropHintDetails[g].endX)){p=g;break}Uv(t,n,o._dropHintDetails[g].originX)?m=g:jv(t,n,o._dropHintDetails[g].originX)&&(h=g)}p===o._draggedColumnIndex||p===o._draggedColumnIndex+1?o._isValidCurrentDropHintIndex()&&o._resetDropHints():r!==p&&p>=0&&(o._resetDropHints(),o._updateDropHintElement(o._dropHintDetails[p].dropHintElementRef,"inline-block"),o._currentDropHintIndex=p)}},o._renderColumnSizer=function(e){var t,n=e.columnIndex,r=o.props.columns,i=void 0===r?Vv:r,a=i[n],s=o.state.columnResizeDetails,l=o._classNames;return a.isResizable?f.createElement("div",{key:a.key+"_sizer","aria-hidden":!0,role:"button","data-is-focusable":!1,onClick:qv,"data-sizer-index":n,onBlur:o._onSizerBlur,className:qr(l.cellSizer,n<i.length-1?l.cellSizerStart:l.cellSizerEnd,(t={},t[l.cellIsResizing]=s&&s.columnIndex===n,t)),onDoubleClick:o._onSizerDoubleClick.bind(o,n)}):null},o._onRenderColumnHeaderTooltip=function(e){return f.createElement("span",{className:e.hostClassName},e.children)},o._onSelectAllClicked=function(){var e=o.props.selection;e&&e.toggleAllSelected()},o._onRootMouseDown=function(e){var t=e.target.getAttribute("data-sizer-index"),n=Number(t),r=o.props.columns,i=void 0===r?Vv:r;null!==t&&0===e.button&&(o.setState({columnResizeDetails:{columnIndex:n,columnMinWidth:i[n].calculatedWidth,originX:e.clientX}}),e.preventDefault(),e.stopPropagation())},o._onRootMouseMove=function(e){var t=o.state,n=t.columnResizeDetails,r=t.isSizing;n&&!r&&e.clientX!==n.originX&&o.setState({isSizing:!0})},o._onRootKeyDown=function(e){var t=o.state,n=t.columnResizeDetails,r=t.isSizing,i=o.props,a=i.columns,s=void 0===a?Vv:a,l=i.onColumnResized,c=e.target.getAttribute("data-sizer-index");if(c&&!r){var u=Number(c);if(n){var p=void 0;e.which===Gn.enter?(o.setState({columnResizeDetails:void 0}),e.preventDefault(),e.stopPropagation()):e.which===Gn.left?p=jn(o.props.theme)?1:-1:e.which===Gn.right&&(p=jn(o.props.theme)?-1:1),p&&(e.shiftKey||(p*=10),o.setState({columnResizeDetails:d(d({},n),{columnMinWidth:n.columnMinWidth+p})}),l&&l(s[u],n.columnMinWidth+p,u),e.preventDefault(),e.stopPropagation())}else e.which===Gn.enter&&(o.setState({columnResizeDetails:{columnIndex:u,columnMinWidth:s[u].calculatedWidth}}),e.preventDefault(),e.stopPropagation())}},o._onSizerMouseMove=function(e){var t=e.buttons,n=o.props,r=n.onColumnIsSizingChanged,i=n.onColumnResized,a=n.columns,s=void 0===a?Vv:a,l=o.state.columnResizeDetails;if(void 0===t||1===t){if(e.clientX!==l.originX&&r&&r(s[l.columnIndex],!0),i){var c=e.clientX-l.originX;jn(o.props.theme)&&(c=-c),i(s[l.columnIndex],l.columnMinWidth+c,l.columnIndex)}}else o._onSizerMouseUp(e)},o._onSizerBlur=function(e){o.state.columnResizeDetails&&o.setState({columnResizeDetails:void 0,isSizing:!1})},o._onSizerMouseUp=function(e){var t=o.props,n=t.columns,r=void 0===n?Vv:n,i=t.onColumnIsSizingChanged,a=o.state.columnResizeDetails;o.setState({columnResizeDetails:void 0,isSizing:!1}),i&&i(r[a.columnIndex],!1)},o._onToggleCollapseAll=function(){var e=o.props.onToggleCollapseAll,t=!o.state.isAllCollapsed;o.setState({isAllCollapsed:t}),e&&e(t)},Gi(o),o._events=new zs(o),o.state={columnResizeDetails:void 0,isAllCollapsed:o.props.isAllCollapsed,isAllSelected:!!o.props.selection&&o.props.selection.isAllSelected()},o._onDropIndexInfo={sourceIndex:-1,targetIndex:-1},o._id=Ka("header"),o._currentDropHintIndex=-1,o._dragDropHelper=new Fv({selection:{getSelection:function(){}},minimumPixelsForDrag:o.props.minimumPixelsForDrag}),o}return u(t,e),t.prototype.componentDidMount=function(){var e=this.props.selection;this._events.on(e,rv,this._onSelectionChanged),this._rootElement.current&&(this._events.on(this._rootElement.current,"mousedown",this._onRootMouseDown),this._events.on(this._rootElement.current,"keydown",this._onRootKeyDown),this._getColumnReorderProps()&&(this._subscriptionObject=this._dragDropHelper.subscribe(this._rootElement.current,this._events,this._getHeaderDragDropOptions())))},t.prototype.componentDidUpdate=function(e){if(this._getColumnReorderProps()?!this._subscriptionObject&&this._rootElement.current&&(this._subscriptionObject=this._dragDropHelper.subscribe(this._rootElement.current,this._events,this._getHeaderDragDropOptions())):this._subscriptionObject&&(this._subscriptionObject.dispose(),delete this._subscriptionObject),this.props!==e&&this._onDropIndexInfo.sourceIndex>=0&&this._onDropIndexInfo.targetIndex>=0){var t=e.columns,o=void 0===t?Vv:t,n=this.props.columns,r=void 0===n?Vv:n;o[this._onDropIndexInfo.sourceIndex].key===r[this._onDropIndexInfo.targetIndex].key&&(this._onDropIndexInfo={sourceIndex:-1,targetIndex:-1})}this.props.isAllCollapsed!==e.isAllCollapsed&&this.setState({isAllCollapsed:this.props.isAllCollapsed})},t.prototype.componentWillUnmount=function(){this._subscriptionObject&&(this._subscriptionObject.dispose(),delete this._subscriptionObject),this._dragDropHelper.dispose(),this._events.dispose()},t.prototype.render=function(){var e=this,t=this.props,o=t.columns,n=void 0===o?Vv:o,r=t.ariaLabel,i=t.ariaLabelForToggleAllGroupsButton,a=t.ariaLabelForSelectAllCheckbox,s=t.selectAllVisibility,l=t.ariaLabelForSelectionColumn,c=t.indentWidth,u=t.onColumnClick,d=t.onColumnContextMenu,p=t.onRenderColumnHeaderTooltip,h=void 0===p?this._onRenderColumnHeaderTooltip:p,m=t.styles,g=t.selectionMode,v=t.theme,b=t.onRenderDetailsCheckbox,y=t.groupNestingDepth,C=t.useFastIcons,_=t.checkboxVisibility,S=t.className,x=this.state,k=x.isAllSelected,w=x.columnResizeDetails,I=x.isSizing,D=x.isAllCollapsed,T=s!==Nv.none,E=s===Nv.hidden,P=_===pv.always,R=this._getColumnReorderProps(),M=R&&R.frozenColumnCountFromStart?R.frozenColumnCountFromStart:0,N=R&&R.frozenColumnCountFromEnd?R.frozenColumnCountFromEnd:0;this._classNames=Wv(m,{theme:v,isAllSelected:k,isSelectAllHidden:s===Nv.hidden,isResizingColumn:!!w&&I,isSizing:I,isAllCollapsed:D,isCheckboxHidden:E,className:S});var B=this._classNames,F=C?ti:ii,A=jn(v);return f.createElement(bs,{role:"row","aria-label":r,className:B.root,componentRef:this._rootComponent,elementRef:this._rootElement,onMouseMove:this._onRootMouseMove,"data-automationid":"DetailsHeader",direction:$i.horizontal},T?[f.createElement("div",{key:"__checkbox",className:B.cellIsCheck,"aria-labelledby":this._id+"-checkTooltip",onClick:E?void 0:this._onSelectAllClicked,"aria-colindex":1,role:"columnheader"},h({hostClassName:B.checkTooltip,id:this._id+"-checkTooltip",setAriaDescribedBy:!1,content:a,children:f.createElement(Bv,{id:this._id+"-check","aria-label":g===ev.multiple?a:l,"data-is-focusable":!E||void 0,isHeader:!0,selected:k,anySelected:!1,canSelect:!E,className:B.check,onRenderDetailsCheckbox:b,useFastIcons:C,isVisible:P})},this._onRenderColumnHeaderTooltip)),this.props.onRenderColumnHeaderTooltip?null:a&&!E?f.createElement("label",{key:"__checkboxLabel",id:this._id+"-checkTooltip",className:B.accessibleLabel,"aria-hidden":!0},a):l&&E?f.createElement("label",{key:"__checkboxLabel",id:this._id+"-checkTooltip",className:B.accessibleLabel,"aria-hidden":!0},l):null]:null,y>0&&this.props.collapseAllVisibility===sv.visible?f.createElement("div",{className:B.cellIsGroupExpander,onClick:this._onToggleCollapseAll,"data-is-focusable":!0,"aria-label":i,"aria-expanded":!D,role:"columnheader"},f.createElement(F,{className:B.collapseButton,iconName:A?"ChevronLeftMed":"ChevronRightMed"})):null,f.createElement(bv,{indentWidth:c,role:"gridcell",count:y-1}),n.map((function(t,o){var r=!!R&&o>=M&&o<n.length-N;return[R&&(r||o===n.length-N)&&e._renderDropHint(o),f.createElement(zv,{column:t,styles:t.styles,key:t.key,columnIndex:(T?2:1)+o,parentId:e._id,isDraggable:r,updateDragInfo:e._updateDragInfo,dragDropHelper:e._dragDropHelper,onColumnClick:u,onColumnContextMenu:d,onRenderColumnHeaderTooltip:e.props.onRenderColumnHeaderTooltip,isDropped:e._onDropIndexInfo.targetIndex===o,cellStyleProps:e.props.cellStyleProps,useFastIcons:C}),e._renderColumnDivider(o)]})),R&&0===N&&this._renderDropHint(n.length),I&&f.createElement(xc,null,f.createElement("div",{className:B.sizingOverlay,onMouseMove:this._onSizerMouseMove,onMouseUp:this._onSizerMouseUp})))},t.prototype.focus=function(){var e;return!!(null===(e=this._rootComponent.current)||void 0===e?void 0:e.focus())},t.prototype._getColumnReorderProps=function(){var e=this.props,t=e.columnReorderOptions;return e.columnReorderProps||t&&d(d({},t),{onColumnDragEnd:void 0})},t.prototype._getHeaderDragDropOptions=function(){return{selectionIndex:1,context:{data:this,index:0},canDrag:function(){return!1},canDrop:function(){return!0},onDragStart:function(){},updateDropState:this._updateDroppingState,onDrop:this._onDrop,onDragEnd:function(){},onDragOver:this._onDragOver}},t.prototype._isValidCurrentDropHintIndex=function(){return this._currentDropHintIndex>=0},t.prototype._isCheckboxColumnHidden=function(){var e=this.props,t=e.selectionMode,o=e.checkboxVisibility;return t===ev.none||o===pv.hidden},t.prototype._resetDropHints=function(){this._currentDropHintIndex>=0&&(this._updateDropHintElement(this._dropHintDetails[this._currentDropHintIndex].dropHintElementRef,"none"),this._currentDropHintIndex=-1)},t.prototype._updateDropHintElement=function(e,t){e.childNodes[1].style.display=t,e.childNodes[0].style.display=t},t.prototype._isEventOnHeader=function(e){if(this._rootElement.current){var t=this._rootElement.current.getBoundingClientRect();if(e.clientX>t.left&&e.clientX<t.right&&e.clientY>t.top&&e.clientY<t.bottom)return uv.header}},t.prototype._renderColumnDivider=function(e){var t=this.props.columns,o=(void 0===t?Vv:t)[e],n=o.onRenderDivider;return n?n({column:o,columnIndex:e},this._renderColumnSizer):this._renderColumnSizer({column:o,columnIndex:e})},t.prototype._renderDropHint=function(e){var t=this._classNames,o=this.props.useFastIcons?ti:ii;return f.createElement("div",{key:"dropHintKey",className:t.dropHintStyle,id:"columnDropHint_"+e},f.createElement("div",{role:"presentation",key:"dropHintCircleKey",className:t.dropHintCaretStyle,"data-is-focusable":!1,"data-sizer-index":e,"aria-hidden":!0},f.createElement(o,{iconName:"CircleShapeSolid"})),f.createElement("div",{key:"dropHintLineKey","aria-hidden":!0,"data-is-focusable":!1,"data-sizer-index":e,className:t.dropHintLineStyle}))},t.prototype._onSizerDoubleClick=function(e,t){var o=this.props,n=o.onColumnAutoResized,r=o.columns;n&&n((void 0===r?Vv:r)[e],e)},t.prototype._onSelectionChanged=function(){var e=!!this.props.selection&&this.props.selection.isAllSelected();this.state.isAllSelected!==e&&this.setState({isAllSelected:e})},t.defaultProps={selectAllVisibility:Nv.visible,collapseAllVisibility:sv.visible,useFastIcons:!0},t}(f.Component);function Gv(e,t,o,n){return e?t<=o&&t>=n:t>=o&&t<=n}function Uv(e,t,o){return e?t>=o:t<=o}function jv(e,t,o){return e?t<=o:t>=o}function qv(e){e.stopPropagation()}var Yv=Vn(Kv,(function(e){var t,o,n,r,i=e.theme,a=e.className,s=e.isAllSelected,l=e.isResizingColumn,c=e.isSizing,u=e.isAllCollapsed,p=e.cellStyleProps,h=void 0===p?Sv:p,m=i.semanticColors,g=i.palette,f=i.fonts,v=Qo(Iv,i),b={iconForegroundColor:m.bodySubtext,headerForegroundColor:m.bodyText,headerBackgroundColor:m.bodyBackground,resizerColor:g.neutralTertiaryAlt},y={opacity:1,transition:"opacity 0.3s linear"},C=Dv(e);return{root:[v.root,f.small,{display:"inline-block",background:b.headerBackgroundColor,position:"relative",minWidth:"100%",verticalAlign:"top",height:42,lineHeight:42,whiteSpace:"nowrap",boxSizing:"content-box",paddingBottom:"1px",paddingTop:"16px",borderBottom:"1px solid "+m.bodyDivider,cursor:"default",userSelect:"none",selectors:(t={},t["&:hover ."+v.check]={opacity:1},t["& ."+v.tooltipHost+" ."+v.checkTooltip]={display:"block"},t)},s&&v.isAllSelected,l&&v.isResizingColumn,a],check:[v.check,{height:42},{selectors:(o={},o["."+wo+" &:focus"]={opacity:1},o)}],cellWrapperPadded:{paddingRight:h.cellExtraRightPadding+h.cellRightPadding},cellIsCheck:[C,v.cellIsCheck,{position:"relative",padding:0,margin:0,display:"inline-flex",alignItems:"center",border:"none"},s&&{opacity:1}],cellIsGroupExpander:[C,{display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:f.small.fontSize,padding:0,border:"none",width:36,color:g.neutralSecondary,selectors:{":hover":{backgroundColor:g.neutralLighter},":active":{backgroundColor:g.neutralLight}}}],cellIsActionable:{selectors:{":hover":{color:m.bodyText,background:m.listHeaderBackgroundHovered},":active":{background:m.listHeaderBackgroundPressed}}},cellIsEmpty:{textOverflow:"clip"},cellSizer:[v.cellSizer,{selectors:{"&::-moz-focus-inner":{border:0},"&":{outline:"transparent"}}},{display:"inline-block",position:"relative",cursor:"ew-resize",bottom:0,top:0,overflow:"hidden",height:"inherit",background:"transparent",zIndex:1,width:16,selectors:(n={":after":{content:'""',position:"absolute",top:0,bottom:0,width:1,background:b.resizerColor,opacity:0,left:"50%"},":focus:after":y,":hover:after":y},n["&."+v.isResizing+":after"]=[y,{boxShadow:"0 0 5px 0 rgba(0, 0, 0, 0.4)"}],n)}],cellIsResizing:v.isResizing,cellSizerStart:{margin:"0 -8px"},cellSizerEnd:{margin:0,marginLeft:-16},collapseButton:[v.collapseButton,{transformOrigin:"50% 50%",transition:"transform .1s linear"},u?[v.isCollapsed,{transform:"rotate(0deg)"}]:{transform:jn(i)?"rotate(-90deg)":"rotate(90deg)"}],checkTooltip:v.checkTooltip,sizingOverlay:c&&{position:"absolute",left:0,top:0,right:0,bottom:0,cursor:"ew-resize",background:"rgba(255, 255, 255, 0)",selectors:(r={},r[ro]=d({background:"transparent"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),r)},accessibleLabel:Mo,dropHintCircleStyle:[v.dropHintCircleStyle,{display:"inline-block",visibility:"hidden",position:"absolute",bottom:0,height:9,width:9,borderRadius:"50%",marginLeft:-5,top:34,overflow:"visible",zIndex:10,border:"1px solid "+g.themePrimary,background:g.white}],dropHintCaretStyle:[v.dropHintCaretStyle,{display:"none",position:"absolute",top:-28,left:-6.5,fontSize:f.medium.fontSize,color:g.themePrimary,overflow:"visible",zIndex:10}],dropHintLineStyle:[v.dropHintLineStyle,{display:"none",position:"absolute",bottom:0,top:0,overflow:"hidden",height:42,width:1,background:g.themePrimary,zIndex:10}],dropHintStyle:{display:"inline-block",position:"absolute"}}}),void 0,{scope:"DetailsHeader"}),Zv=function(e){var t=e.columns,o=e.columnStartIndex,n=e.rowClassNames,r=e.cellStyleProps,i=void 0===r?Sv:r,a=e.item,s=e.itemIndex,l=e.onRenderItemColumn,c=e.getCellValueKey,u=e.cellsByColumn,d=e.enableUpdateAnimations,p=e.rowHeaderId,h=f.useRef(),m=h.current||(h.current={});return f.createElement("div",{className:n.fields,"data-automationid":"DetailsRowFields",role:"presentation"},t.map((function(e,t){var r=void 0===e.calculatedWidth?"auto":e.calculatedWidth+i.cellLeftPadding+i.cellRightPadding+(e.isPadded?i.cellExtraRightPadding:0),h=e.onRender,g=void 0===h?l:h,v=e.getValueKey,b=void 0===v?c:v,y=u&&e.key in u?u[e.key]:g?g(a,s,e):function(e,t){var o=e&&t&&t.fieldName?e[t.fieldName]:"";return null==o&&(o=""),"boolean"==typeof o?o.toString():o}(a,e),C=m[e.key],_=d&&b?b(a,s,e):void 0,S=!1;void 0!==_&&void 0!==C&&_!==C&&(S=!0),m[e.key]=_;var x=e.key+(void 0!==_?"-"+_:"");return f.createElement("div",{key:x,id:e.isRowHeader?p:void 0,role:e.isRowHeader?"rowheader":"gridcell","aria-readonly":!0,"aria-colindex":t+o+1,className:qr(e.className,e.isMultiline&&n.isMultiline,e.isRowHeader&&n.isRowHeader,n.cell,e.isPadded?n.cellPadded:n.cellUnpadded,S&&n.cellAnimation),style:{width:r},"data-automationid":"DetailsRowCell","data-automation-key":e.key},y)})))},Xv=Jn(),Qv=[],Jv=function(e){function t(t){var o=e.call(this,t)||this;return o._root=f.createRef(),o._cellMeasurer=f.createRef(),o._focusZone=f.createRef(),o._onSelectionChanged=function(){var e=$v(o.props);Bs(e,o.state.selectionState)||o.setState({selectionState:e})},o._updateDroppingState=function(e,t){var n=o.state.isDropping,r=o.props,i=r.dragDropEvents,a=r.item;e?i.onDragEnter&&(o._droppingClassNames=i.onDragEnter(a,t)):i.onDragLeave&&i.onDragLeave(a,t),n!==e&&o.setState({isDropping:e})},Gi(o),o._events=new zs(o),o.state={selectionState:$v(t),columnMeasureInfo:void 0,isDropping:!1},o._droppingClassNames="",o}return u(t,e),t.getDerivedStateFromProps=function(e,t){return d(d({},t),{selectionState:$v(e)})},t.prototype.componentDidMount=function(){var e=this.props,t=e.dragDropHelper,o=e.selection,n=e.item,r=e.onDidMount;t&&this._root.current&&(this._dragDropSubscription=t.subscribe(this._root.current,this._events,this._getRowDragDropOptions())),o&&this._events.on(o,rv,this._onSelectionChanged),r&&n&&(this._onDidMountCalled=!0,r(this))},t.prototype.componentDidUpdate=function(e){var t=this.state,o=this.props,n=o.item,r=o.onDidMount,i=t.columnMeasureInfo;if(this.props.itemIndex===e.itemIndex&&this.props.item===e.item&&this.props.dragDropHelper===e.dragDropHelper||(this._dragDropSubscription&&(this._dragDropSubscription.dispose(),delete this._dragDropSubscription),this.props.dragDropHelper&&this._root.current&&(this._dragDropSubscription=this.props.dragDropHelper.subscribe(this._root.current,this._events,this._getRowDragDropOptions()))),i&&i.index>=0&&this._cellMeasurer.current){var a=this._cellMeasurer.current.getBoundingClientRect().width;i.onMeasureDone(a),this.setState({columnMeasureInfo:void 0})}n&&r&&!this._onDidMountCalled&&(this._onDidMountCalled=!0,r(this))},t.prototype.componentWillUnmount=function(){var e=this.props,t=e.item,o=e.onWillUnmount;o&&t&&o(this),this._dragDropSubscription&&(this._dragDropSubscription.dispose(),delete this._dragDropSubscription),this._events.dispose()},t.prototype.shouldComponentUpdate=function(e,t){if(this.props.useReducedRowRenderer){var o=$v(e);return this.state.selectionState.isSelected!==o.isSelected||!Bs(this.props,e)}return!0},t.prototype.render=function(){var e=this.props,t=e.className,o=e.columns,n=void 0===o?Qv:o,r=e.dragDropEvents,i=e.item,a=e.itemIndex,s=e.id,l=e.flatIndexOffset,c=void 0===l?2:l,u=e.onRenderCheck,p=void 0===u?this._onRenderCheck:u,h=e.onRenderDetailsCheckbox,m=e.onRenderItemColumn,g=e.getCellValueKey,v=e.selectionMode,b=e.rowWidth,y=void 0===b?0:b,C=e.checkboxVisibility,_=e.getRowAriaLabel,S=e.getRowAriaDescribedBy,x=e.checkButtonAriaLabel,k=e.checkboxCellClassName,w=e.rowFieldsAs,I=void 0===w?Zv:w,D=e.selection,T=e.indentWidth,E=e.enableUpdateAnimations,P=e.compact,R=e.theme,M=e.styles,N=e.cellsByColumn,B=e.groupNestingDepth,F=e.useFastIcons,A=void 0===F||F,L=e.cellStyleProps,H=e.group,O=e.focusZoneProps,z=e.disabled,W=void 0!==z&&z,V=this.state,K=V.columnMeasureInfo,G=V.isDropping,U=this.state.selectionState,j=U.isSelected,q=void 0!==j&&j,Y=U.isSelectionModal,Z=void 0!==Y&&Y,X=r?!(!r.canDrag||!r.canDrag(i)):void 0,Q=G?this._droppingClassNames||"is-dropping":"",J=_?_(i):void 0,$=S?S(i):void 0,ee=!!D&&D.canSelectItem(i,a)&&!W,te=v===ev.multiple,oe=v!==ev.none&&C!==pv.hidden,ne=v===ev.none?void 0:q,re=H?a-H.startIndex+1:void 0,ie=H?H.count:void 0,ae=O?O.direction:$i.horizontal;this._classNames=d(d({},this._classNames),Xv(M,{theme:R,isSelected:q,canSelect:!te,anySelected:Z,checkboxCellClassName:k,droppingClassName:Q,className:t,compact:P,enableUpdateAnimations:E,cellStyleProps:L,disabled:W}));var se={isMultiline:this._classNames.isMultiline,isRowHeader:this._classNames.isRowHeader,cell:this._classNames.cell,cellAnimation:this._classNames.cellAnimation,cellPadded:this._classNames.cellPadded,cellUnpadded:this._classNames.cellUnpadded,fields:this._classNames.fields};Bs(this._rowClassNames||{},se)||(this._rowClassNames=se);var le=f.createElement(I,{rowClassNames:this._rowClassNames,rowHeaderId:s+"-header",cellsByColumn:N,columns:n,item:i,itemIndex:a,columnStartIndex:(oe?1:0)+(B?1:0),onRenderItemColumn:m,getCellValueKey:g,enableUpdateAnimations:E,cellStyleProps:L}),ce=this.props.role?this.props.role:"row";return f.createElement(bs,d({"data-is-focusable":!0},Tr(this.props,Dr),"boolean"==typeof X?{"data-is-draggable":X,draggable:X}:{},O,{direction:ae,elementRef:this._root,componentRef:this._focusZone,role:ce,"aria-label":J,"aria-disabled":W||void 0,"aria-describedby":$,className:this._classNames.root,"data-selection-index":a,"data-selection-touch-invoke":!0,"data-selection-disabled":W||void 0,"data-item-index":a,"aria-rowindex":void 0===re?a+c:void 0,"aria-level":B&&B+1||void 0,"aria-posinset":re,"aria-setsize":ie,"data-automationid":"DetailsRow",style:{minWidth:y},"aria-selected":ne,allowFocusRoot:!0}),oe&&f.createElement("div",{role:"gridcell","aria-colindex":1,"data-selection-toggle":!0,className:this._classNames.checkCell},p({id:s?s+"-checkbox":void 0,selected:q,selectionMode:v,anySelected:Z,"aria-label":x,"aria-labelledby":s?s+"-checkbox "+s+"-header":void 0,canSelect:ee,compact:P,className:this._classNames.check,theme:R,isVisible:C===pv.always,onRenderDetailsCheckbox:h,useFastIcons:A})),f.createElement(bv,{indentWidth:T,role:"gridcell",count:B-(this.props.collapseAllVisibility===sv.hidden?1:0)}),i&&le,K&&f.createElement("span",{role:"presentation",className:qr(this._classNames.cellMeasurer,this._classNames.cell),ref:this._cellMeasurer},f.createElement(I,{rowClassNames:this._rowClassNames,rowHeaderId:s+"-header",columns:[K.column],item:i,itemIndex:a,columnStartIndex:(oe?1:0)+(B?1:0)+n.length,onRenderItemColumn:m,getCellValueKey:g})),f.createElement("span",{role:"checkbox",className:this._classNames.checkCover,"aria-checked":q,"data-selection-toggle":!0}))},t.prototype.measureCell=function(e,t){var o=this.props.columns,n=d({},(void 0===o?Qv:o)[e]);n.minWidth=0,n.maxWidth=999999,delete n.calculatedWidth,this.setState({columnMeasureInfo:{index:e,column:n,onMeasureDone:t}})},t.prototype.focus=function(e){var t;return void 0===e&&(e=!1),!!(null===(t=this._focusZone.current)||void 0===t?void 0:t.focus(e))},t.prototype._onRenderCheck=function(e){return f.createElement(Bv,d({},e))},t.prototype._getRowDragDropOptions=function(){var e=this.props,t=e.item,o=e.itemIndex,n=e.dragDropEvents;return{eventMap:e.eventsToRegister,selectionIndex:o,context:{data:t,index:o},canDrag:n.canDrag,canDrop:n.canDrop,onDragStart:n.onDragStart,updateDropState:this._updateDroppingState,onDrop:n.onDrop,onDragEnd:n.onDragEnd,onDragOver:n.onDragOver}},t}(f.Component);function $v(e){var t,o=e.itemIndex,n=e.selection;return{isSelected:!!(null==n?void 0:n.isIndexSelected(o)),isSelectionModal:!!(null===(t=null==n?void 0:n.isModal)||void 0===t?void 0:t.call(n))}}var eb,tb,ob=Vn(Jv,wv,void 0,{scope:"DetailsRow"}),nb={root:"ms-GroupedList",compact:"ms-GroupedList--Compact",group:"ms-GroupedList-group",link:"ms-Link",listCell:"ms-List-cell"},rb={root:"ms-GroupHeader",compact:"ms-GroupHeader--compact",check:"ms-GroupHeader-check",dropIcon:"ms-GroupHeader-dropIcon",expand:"ms-GroupHeader-expand",isCollapsed:"is-collapsed",title:"ms-GroupHeader-title",isSelected:"is-selected",iconTag:"ms-Icon--Tag",group:"ms-GroupedList-group",isDropping:"is-dropping"},ib="cubic-bezier(0.390, 0.575, 0.565, 1.000)";!function(e){e[e.xSmall=0]="xSmall",e[e.small=1]="small",e[e.medium=2]="medium",e[e.large=3]="large"}(eb||(eb={})),function(e){e[e.normal=0]="normal",e[e.large=1]="large"}(tb||(tb={}));var ab=Jn(),sb=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.type,o=e.size,n=e.ariaLabel,r=e.ariaLive,i=e.styles,a=e.label,s=e.theme,l=e.className,c=e.labelPosition,u=n,p=Tr(this.props,Dr,["size"]),h=o;void 0===h&&void 0!==t&&(h=t===tb.large?eb.large:eb.medium);var m=ab(i,{theme:s,size:h,className:l,labelPosition:c});return f.createElement("div",d({},p,{className:m.root}),f.createElement("div",{className:m.circle}),a&&f.createElement("div",{className:m.label},a),u&&f.createElement("div",{role:"status","aria-live":r},f.createElement(ea,null,f.createElement("div",{className:m.screenReaderText},u))))},t.defaultProps={size:eb.medium,ariaLive:"polite",labelPosition:"bottom"},t}(f.Component),lb={root:"ms-Spinner",circle:"ms-Spinner-circle",label:"ms-Spinner-label"},cb=jo((function(){return J({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}})})),ub=Vn(sb,(function(e){var t,o=e.theme,n=e.size,r=e.className,i=e.labelPosition,a=o.palette,s=Qo(lb,o);return{root:[s.root,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},"top"===i&&{flexDirection:"column-reverse"},"right"===i&&{flexDirection:"row"},"left"===i&&{flexDirection:"row-reverse"},r],circle:[s.circle,{boxSizing:"border-box",borderRadius:"50%",border:"1.5px solid "+a.themeLight,borderTopColor:a.themePrimary,animationName:cb(),animationDuration:"1.3s",animationIterationCount:"infinite",animationTimingFunction:"cubic-bezier(.53,.21,.29,.67)",selectors:(t={},t[ro]=d({borderTopColor:"Highlight"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),t)},n===eb.xSmall&&["ms-Spinner--xSmall",{width:12,height:12}],n===eb.small&&["ms-Spinner--small",{width:16,height:16}],n===eb.medium&&["ms-Spinner--medium",{width:20,height:20}],n===eb.large&&["ms-Spinner--large",{width:28,height:28}]],label:[s.label,o.fonts.small,{color:a.themePrimary,margin:"8px 0 0",textAlign:"center"},"top"===i&&{margin:"0 0 8px"},"right"===i&&{margin:"0 0 0 8px"},"left"===i&&{margin:"0 8px 0 0"}],screenReaderText:Mo}}),void 0,{scope:"Spinner"}),db=Jn(),pb=function(e){function t(t){var o=e.call(this,t)||this;return o._toggleCollapse=function(){var e=o.props,t=e.group,n=e.onToggleCollapse,r=e.isGroupLoading,i=!o.state.isCollapsed,a=!i&&r&&r(t);o.setState({isCollapsed:i,isLoadingVisible:a}),n&&n(t)},o._onKeyUp=function(e){var t=o.props,n=t.group,r=t.onGroupHeaderKeyUp;if(r&&r(e,n),!e.defaultPrevented){var i=o.state.isCollapsed&&e.which===Yn(Gn.right,o.props.theme);(!o.state.isCollapsed&&e.which===Yn(Gn.left,o.props.theme)||i)&&(o._toggleCollapse(),e.stopPropagation(),e.preventDefault())}},o._onToggleClick=function(e){o._toggleCollapse(),e.stopPropagation(),e.preventDefault()},o._onToggleSelectGroupClick=function(e){var t=o.props,n=t.onToggleSelectGroup,r=t.group;n&&n(r),e.preventDefault(),e.stopPropagation()},o._onHeaderClick=function(){var e=o.props,t=e.group,n=e.onGroupHeaderClick,r=e.onToggleSelectGroup;n?n(t):r&&r(t)},o._onRenderTitle=function(e){var t=e.group,n=e.ariaColSpan;return t?f.createElement("div",{className:o._classNames.title,id:o._id,role:"gridcell","aria-colspan":n},f.createElement("span",null,t.name),f.createElement("span",{className:o._classNames.headerCount},"(",t.count,t.hasMoreData&&"+",")")):null},o._id=Ka("GroupHeader"),o.state={isCollapsed:o.props.group&&o.props.group.isCollapsed,isLoadingVisible:!1},o}return u(t,e),t.getDerivedStateFromProps=function(e,t){if(e.group){var o=e.group.isCollapsed,n=e.isGroupLoading,r=!o&&n&&n(e.group);return d(d({},t),{isCollapsed:o||!1,isLoadingVisible:r||!1})}return t},t.prototype.render=function(){var e=this.props,t=e.group,o=e.groupLevel,n=void 0===o?0:o,r=e.viewport,i=e.selectionMode,a=e.loadingText,s=e.isSelected,l=void 0!==s&&s,c=e.selected,u=void 0!==c&&c,p=e.indentWidth,h=e.onRenderTitle,m=void 0===h?this._onRenderTitle:h,g=e.onRenderGroupHeaderCheckbox,v=e.isCollapsedGroupSelectVisible,b=void 0===v||v,y=e.expandButtonProps,C=e.expandButtonIcon,_=e.selectAllButtonProps,S=e.theme,x=e.styles,k=e.className,w=e.compact,I=e.ariaPosInSet,D=e.ariaSetSize,T=e.ariaRowIndex,E=e.useFastIcons?this._fastDefaultCheckboxRender:this._defaultCheckboxRender,P=g?Xh(g,E):E,R=this.state,M=R.isCollapsed,N=R.isLoadingVisible,B=i===ev.multiple,F=B&&(b||!(t&&t.isCollapsed)),A=u||l,L=jn(S);return this._classNames=db(x,{theme:S,className:k,selected:A,isCollapsed:M,compact:w}),t?f.createElement("div",{className:this._classNames.root,style:r?{minWidth:r.width}:{},onClick:this._onHeaderClick,role:"row","aria-setsize":D,"aria-posinset":I,"aria-rowindex":T,"data-is-focusable":!0,onKeyUp:this._onKeyUp,"aria-label":t.ariaLabel,"aria-labelledby":t.ariaLabel?void 0:this._id,"aria-expanded":!this.state.isCollapsed,"aria-selected":B?A:void 0,"aria-level":n+1},f.createElement("div",{className:this._classNames.groupHeaderContainer,role:"presentation"},F?f.createElement("div",{role:"gridcell"},f.createElement("button",d({"data-is-focusable":!1,type:"button",className:this._classNames.check,role:"checkbox",id:this._id+"-check","aria-checked":A,"aria-labelledby":this._id+"-check "+this._id,"data-selection-toggle":!0,onClick:this._onToggleSelectGroupClick},_),P({checked:A,theme:S},P))):i!==ev.none&&f.createElement(bv,{indentWidth:48,count:1}),f.createElement(bv,{indentWidth:p,count:n}),f.createElement("div",{className:this._classNames.dropIcon,role:"presentation"},f.createElement(ii,{iconName:"Tag"})),f.createElement("div",{role:"gridcell"},f.createElement("button",d({"data-is-focusable":!1,type:"button",className:this._classNames.expand,onClick:this._onToggleClick,"aria-expanded":!this.state.isCollapsed},y),f.createElement(ii,{className:this._classNames.expandIsCollapsed,iconName:C||(L?"ChevronLeftMed":"ChevronRightMed")}))),m(this.props,this._onRenderTitle),N&&f.createElement(ub,{label:a}))):null},t.prototype._defaultCheckboxRender=function(e){return f.createElement(Hh,{checked:e.checked})},t.prototype._fastDefaultCheckboxRender=function(e){return f.createElement(hb,{theme:e.theme,checked:e.checked})},t.defaultProps={expandButtonProps:{"aria-label":"expand collapse group"}},t}(f.Component),hb=f.memo((function(e){return f.createElement(Hh,{theme:e.theme,checked:e.checked,className:e.className,useFastIcons:!0})})),mb=Vn(pb,(function(e){var t,o,n,r,i,a=e.theme,s=e.className,l=e.selected,c=e.isCollapsed,u=e.compact,d=Sv.cellLeftPadding,p=u?40:48,h=a.semanticColors,m=a.palette,g=a.fonts,f=Qo(rb,a),v=[To(a),{cursor:"default",background:"none",backgroundColor:"transparent",border:"none",padding:0}];return{root:[f.root,To(a),a.fonts.medium,{borderBottom:"1px solid "+h.listBackground,cursor:"default",userSelect:"none",selectors:(t={":hover":{background:h.listItemBackgroundHovered,color:h.actionLinkHovered}},t["&:hover ."+f.check]={opacity:1},t["."+wo+" &:focus ."+f.check]={opacity:1},t[":global(."+f.group+"."+f.isDropping+")"]={selectors:(o={},o["& > ."+f.root+" ."+f.dropIcon]={transition:"transform "+Le.durationValue4+" cubic-bezier(0.075, 0.820, 0.165, 1.000) opacity "+Le.durationValue1+" "+ib,transitionDelay:Le.durationValue3,opacity:1,transform:"rotate(0.2deg) scale(1);"},o["."+f.check]={opacity:0},o)},t)},l&&[f.isSelected,{background:h.listItemBackgroundChecked,selectors:(n={":hover":{background:h.listItemBackgroundCheckedHovered}},n[""+f.check]={opacity:1},n)}],u&&[f.compact,{border:"none"}],s],groupHeaderContainer:[{display:"flex",alignItems:"center",height:p}],headerCount:[{padding:"0px 4px"}],check:[f.check,v,{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:1,marginTop:-1,opacity:0,width:48,height:p,selectors:(r={},r["."+wo+" &:focus"]={opacity:1},r)}],expand:[f.expand,v,{display:"flex",alignItems:"center",justifyContent:"center",fontSize:g.small.fontSize,width:36,height:p,color:l?m.neutralPrimary:m.neutralSecondary,selectors:{":hover":{backgroundColor:l?m.neutralQuaternary:m.neutralLight},":active":{backgroundColor:l?m.neutralTertiaryAlt:m.neutralQuaternaryAlt}}}],expandIsCollapsed:[c?[f.isCollapsed,{transform:"rotate(0deg)",transformOrigin:"50% 50%",transition:"transform .1s linear"}]:{transform:jn(a)?"rotate(-90deg)":"rotate(90deg)",transformOrigin:"50% 50%",transition:"transform .1s linear"}],title:[f.title,{paddingLeft:d,fontSize:u?g.medium.fontSize:g.mediumPlus.fontSize,fontWeight:c?qe.regular:qe.semibold,cursor:"pointer",outline:0,whiteSpace:"nowrap",textOverflow:"ellipsis"}],dropIcon:[f.dropIcon,{position:"absolute",left:-26,fontSize:Ye.large,color:m.neutralSecondary,transition:"transform "+Le.durationValue2+" cubic-bezier(0.600, -0.280, 0.735, 0.045), opacity "+Le.durationValue4+" "+ib,opacity:0,transform:"rotate(0.2deg) scale(0.65)",transformOrigin:"10px 10px",selectors:(i={},i[":global(."+f.iconTag+")"]={position:"absolute"},i)}]}}),void 0,{scope:"GroupHeader"}),gb={root:"ms-GroupShowAll",link:"ms-Link"},fb=Jn(),vb=Vn((function(e){var t=e.group,o=e.groupLevel,n=e.showAllLinkText,r=void 0===n?"Show All":n,i=e.styles,a=e.theme,s=e.onToggleSummarize,l=fb(i,{theme:a}),c=(0,f.useCallback)((function(e){s(t),e.stopPropagation(),e.preventDefault()}),[s,t]);return t?f.createElement("div",{className:l.root},f.createElement(bv,{count:o}),f.createElement(Ns,{onClick:c},r)):null}),(function(e){var t,o=e.theme,n=o.fonts,r=Qo(gb,o);return{root:[r.root,{position:"relative",padding:"10px 84px",cursor:"pointer",selectors:(t={},t["."+r.link]={fontSize:n.small.fontSize},t)}]}}),void 0,{scope:"GroupShowAll"}),bb={root:"ms-groupFooter"},yb=Jn(),Cb=Vn((function(e){var t=e.group,o=e.groupLevel,n=e.footerText,r=e.indentWidth,i=e.styles,a=e.theme,s=yb(i,{theme:a});return t&&n?f.createElement("div",{className:s.root},f.createElement(bv,{indentWidth:r,count:o}),n):null}),(function(e){var t=e.theme,o=e.className,n=Qo(bb,t);return{root:[t.fonts.medium,n.root,{position:"relative",padding:"5px 38px"},o]}}),void 0,{scope:"GroupFooter"}),_b=function(e){function t(o){var n=e.call(this,o)||this;n._root=f.createRef(),n._list=f.createRef(),n._subGroupRefs={},n._droppingClassName="",n._onRenderGroupHeader=function(e){return f.createElement(mb,d({},e))},n._onRenderGroupShowAll=function(e){return f.createElement(vb,d({},e))},n._onRenderGroupFooter=function(e){return f.createElement(Cb,d({},e))},n._renderSubGroup=function(e,o){var r=n.props,i=r.dragDropEvents,a=r.dragDropHelper,s=r.eventsToRegister,l=r.getGroupItemLimit,c=r.groupNestingDepth,u=r.groupProps,d=r.items,p=r.headerProps,h=r.showAllProps,m=r.footerProps,g=r.listProps,v=r.onRenderCell,b=r.selection,y=r.selectionMode,C=r.viewport,_=r.onRenderGroupHeader,S=r.onRenderGroupShowAll,x=r.onRenderGroupFooter,k=r.onShouldVirtualize,w=r.group,I=r.compact,D=e.level?e.level+1:c;return!e||e.count>0||u&&u.showEmptyGroups?f.createElement(t,{ref:function(e){return n._subGroupRefs["subGroup_"+o]=e},key:n._getGroupKey(e,o),dragDropEvents:i,dragDropHelper:a,eventsToRegister:s,footerProps:m,getGroupItemLimit:l,group:e,groupIndex:o,groupNestingDepth:D,groupProps:u,headerProps:p,items:d,listProps:g,onRenderCell:v,selection:b,selectionMode:y,showAllProps:h,viewport:C,onRenderGroupHeader:_,onRenderGroupShowAll:S,onRenderGroupFooter:x,onShouldVirtualize:k,groups:w?w.children:[],compact:I}):null},n._getGroupDragDropOptions=function(){var e=n.props,t=e.group,o=e.groupIndex,r=e.dragDropEvents;return{eventMap:e.eventsToRegister,selectionIndex:-1,context:{data:t,index:o,isGroup:!0},updateDropState:n._updateDroppingState,canDrag:r.canDrag,canDrop:r.canDrop,onDrop:r.onDrop,onDragStart:r.onDragStart,onDragEnter:r.onDragEnter,onDragLeave:r.onDragLeave,onDragEnd:r.onDragEnd,onDragOver:r.onDragOver}},n._updateDroppingState=function(e,t){var o=n.state.isDropping,r=n.props,i=r.dragDropEvents,a=r.group;o!==e&&(o?i&&i.onDragLeave&&i.onDragLeave(a,t):i&&i.onDragEnter&&(n._droppingClassName=i.onDragEnter(a,t)),n.setState({isDropping:e}))};var r=o.selection,i=o.group;return Gi(n),n._id=Ka("GroupedListSection"),n.state={isDropping:!1,isSelected:!(!r||!i)&&r.isRangeSelected(i.startIndex,i.count)},n._events=new zs(n),n}return u(t,e),t.prototype.componentDidMount=function(){var e=this.props,t=e.dragDropHelper,o=e.selection;t&&this._root.current&&(this._dragDropSubscription=t.subscribe(this._root.current,this._events,this._getGroupDragDropOptions())),o&&this._events.on(o,rv,this._onSelectionChange)},t.prototype.componentWillUnmount=function(){this._events.dispose(),this._dragDropSubscription&&this._dragDropSubscription.dispose()},t.prototype.componentDidUpdate=function(e){this.props.group===e.group&&this.props.groupIndex===e.groupIndex&&this.props.dragDropHelper===e.dragDropHelper||(this._dragDropSubscription&&(this._dragDropSubscription.dispose(),delete this._dragDropSubscription),this.props.dragDropHelper&&this._root.current&&(this._dragDropSubscription=this.props.dragDropHelper.subscribe(this._root.current,this._events,this._getGroupDragDropOptions())))},t.prototype.render=function(){var e=this.props,t=e.getGroupItemLimit,o=e.group,n=e.groupIndex,r=e.headerProps,i=e.showAllProps,a=e.footerProps,s=e.viewport,l=e.selectionMode,c=e.onRenderGroupHeader,u=void 0===c?this._onRenderGroupHeader:c,p=e.onRenderGroupShowAll,h=void 0===p?this._onRenderGroupShowAll:p,m=e.onRenderGroupFooter,g=void 0===m?this._onRenderGroupFooter:m,v=e.onShouldVirtualize,b=e.groupedListClassNames,y=e.groups,C=e.compact,_=e.listProps,S=void 0===_?{}:_,x=this.state.isSelected,k=o&&t?t(o):1/0,w=o&&!o.children&&!o.isCollapsed&&!o.isShowingAll&&(o.count>k||o.hasMoreData),I=o&&o.children&&o.children.length>0,D=S.version,T={group:o,groupIndex:n,groupLevel:o?o.level:0,isSelected:x,selected:x,viewport:s,selectionMode:l,groups:y,compact:C},E={groupedListId:this._id,ariaSetSize:y?y.length:void 0,ariaPosInSet:void 0!==n?n+1:void 0},P=d(d(d({},r),T),E),R=d(d({},i),T),M=d(d({},a),T),N=!!this.props.dragDropHelper&&this._getGroupDragDropOptions().canDrag(o)&&!!this.props.dragDropEvents.canDragGroups;return f.createElement("div",d({ref:this._root},N&&{draggable:!0},{className:qr(b&&b.group,this._getDroppingClassName()),role:"presentation"}),u(P,this._onRenderGroupHeader),o&&o.isCollapsed?null:I?f.createElement(Nf,{role:"presentation",ref:this._list,items:o?o.children:[],onRenderCell:this._renderSubGroup,getItemCountForPage:this._returnOne,onShouldVirtualize:v,version:D,id:this._id}):this._onRenderGroup(k),o&&o.isCollapsed?null:w&&h(R,this._onRenderGroupShowAll),g(M,this._onRenderGroupFooter))},t.prototype.forceUpdate=function(){e.prototype.forceUpdate.call(this),this.forceListUpdate()},t.prototype.forceListUpdate=function(){var e=this.props.group;if(this._list.current){if(this._list.current.forceUpdate(),e&&e.children&&e.children.length>0)for(var t=e.children.length,o=0;o<t;o++){var n;(n=this._list.current.pageRefs["subGroup_"+String(o)])&&n.forceListUpdate()}}else(n=this._subGroupRefs["subGroup_"+String(0)])&&n.forceListUpdate()},t.prototype._onSelectionChange=function(){var e=this.props,t=e.group,o=e.selection;if(o&&t){var n=o.isRangeSelected(t.startIndex,t.count);n!==this.state.isSelected&&this.setState({isSelected:n})}},t.prototype._onRenderGroupCell=function(e,t,o){return function(n,r){return e(t,n,r,o)}},t.prototype._onRenderGroup=function(e){var t=this.props,o=t.group,n=t.items,r=t.onRenderCell,i=t.listProps,a=t.groupNestingDepth,s=t.onShouldVirtualize,l=t.groupProps,c=o&&!o.isShowingAll?o.count:n.length,u=o?o.startIndex:0;return f.createElement(Nf,d({role:l&&l.role?l.role:"rowgroup","aria-label":null==o?void 0:o.name,items:n,onRenderCell:this._onRenderGroupCell(r,a,o),ref:this._list,renderCount:Math.min(c,e),startIndex:u,onShouldVirtualize:s,id:this._id},i))},t.prototype._returnOne=function(){return 1},t.prototype._getGroupKey=function(e,t){return"group-"+(e&&e.key?e.key:String(e.level)+String(t))},t.prototype._getDroppingClassName=function(){var e=this.state.isDropping,t=this.props,o=t.group,n=t.groupedListClassNames;return qr((e=!(!o||!e))&&this._droppingClassName,e&&"is-dropping",e&&n&&n.groupIsDropping)},t}(f.Component),Sb=Jn(),xb=xv.rowHeight,kb=xv.compactRowHeight,wb=function(e){function t(t){var o=e.call(this,t)||this;o._list=f.createRef(),o._renderGroup=function(e,t){var n=o.props,r=n.dragDropEvents,i=n.dragDropHelper,a=n.eventsToRegister,s=n.groupProps,l=n.items,c=n.listProps,u=n.onRenderCell,p=n.selectionMode,h=n.selection,m=n.viewport,g=n.onShouldVirtualize,v=n.groups,b=n.compact,y={onToggleSelectGroup:o._onToggleSelectGroup,onToggleCollapse:o._onToggleCollapse,onToggleSummarize:o._onToggleSummarize},C=d(d({},s.headerProps),y),_=d(d({},s.showAllProps),y),S=d(d({},s.footerProps),y),x=o._getGroupNestingDepth();if(!s.showEmptyGroups&&e&&0===e.count)return null;var k=d(d({},c||{}),{version:o.state.version});return f.createElement(_b,{key:o._getGroupKey(e,t),dragDropEvents:r,dragDropHelper:i,eventsToRegister:a,footerProps:S,getGroupItemLimit:s&&s.getGroupItemLimit,group:e,groupIndex:t,groupNestingDepth:x,groupProps:s,headerProps:C,listProps:k,items:l,onRenderCell:u,onRenderGroupHeader:s.onRenderHeader,onRenderGroupShowAll:s.onRenderShowAll,onRenderGroupFooter:s.onRenderFooter,selectionMode:p,selection:h,showAllProps:_,viewport:m,onShouldVirtualize:g,groupedListClassNames:o._classNames,groups:v,compact:b})},o._getDefaultGroupItemLimit=function(e){return e.children&&e.children.length>0?e.children.length:e.count},o._getGroupItemLimit=function(e){var t=o.props.groupProps;return(t&&t.getGroupItemLimit?t.getGroupItemLimit:o._getDefaultGroupItemLimit)(e)},o._getGroupHeight=function(e){var t=o.props.compact?kb:xb;return t+(e.isCollapsed?0:t*o._getGroupItemLimit(e))},o._getPageHeight=function(e){var t=o.state.groups,n=o.props.getGroupHeight,r=void 0===n?o._getGroupHeight:n,i=t&&t[e];return i?r(i,e):0},o._onToggleCollapse=function(e){var t=o.props.groupProps,n=t&&t.headerProps&&t.headerProps.onToggleCollapse;e&&(n&&n(e),e.isCollapsed=!e.isCollapsed,o._updateIsSomeGroupExpanded(),o.forceUpdate())},o._onToggleSelectGroup=function(e){var t=o.props,n=t.selection,r=t.selectionMode;e&&n&&r===ev.multiple&&n.toggleRangeSelected(e.startIndex,e.count)},o._isInnerZoneKeystroke=function(e){return e.which===Yn(Gn.right)},o._onToggleSummarize=function(e){var t=o.props.groupProps,n=t&&t.showAllProps&&t.showAllProps.onToggleSummarize;n?n(e):(e&&(e.isShowingAll=!e.isShowingAll),o.forceUpdate())},o._getPageSpecification=function(e){var t=o.state.groups,n=t&&t[e];return{key:n&&n.key}},Gi(o),o._isSomeGroupExpanded=o._computeIsSomeGroupExpanded(t.groups);var n=t.listProps,r=(void 0===n?{}:n).version,i=void 0===r?{}:r;return o.state={groups:t.groups,items:t.items,listProps:t.listProps,version:i},o}return u(t,e),t.getDerivedStateFromProps=function(e,t){var o=e.groups,n=e.selectionMode,r=e.compact,i=e.items,a=e.listProps,s=a&&a.version,l=d(d({},t),{selectionMode:n,compact:r,groups:o,listProps:a}),c=!1;return s===(t.listProps&&t.listProps.version)&&i===t.items&&o===t.groups&&n===t.selectionMode&&r===t.compact||(c=!0),o!==t.groups&&(l=d(d({},l),{groups:o})),n===t.selectionMode&&r===t.compact||(c=!0),c&&(l=d(d({},l),{version:{}})),l},t.prototype.scrollToIndex=function(e,t,o){this._list.current&&this._list.current.scrollToIndex(e,t,o)},t.prototype.getStartItemIndexInView=function(){return this._list.current.getStartItemIndexInView()||0},t.prototype.componentDidMount=function(){var e=this.props,t=e.groupProps,o=e.groups,n=void 0===o?[]:o;t&&t.isAllGroupsCollapsed&&this._setGroupsCollapsedState(n,t.isAllGroupsCollapsed)},t.prototype.render=function(){var e=this.props,t=e.className,o=e.usePageCache,n=e.onShouldVirtualize,r=e.theme,i=e.role,a=void 0===i?"treegrid":i,s=e.styles,l=e.compact,c=e.focusZoneProps,u=void 0===c?{}:c,p=e.rootListProps,h=void 0===p?{}:p,m=this.state,g=m.groups,v=m.version;this._classNames=Sb(s,{theme:r,className:t,compact:l});var b=u.shouldEnterInnerZone,y=void 0===b?this._isInnerZoneKeystroke:b;return f.createElement(bs,d({direction:$i.vertical,"data-automationid":"GroupedList","data-is-scrollable":"false",role:"presentation"},u,{shouldEnterInnerZone:y,className:qr(this._classNames.root,u.className)}),g?f.createElement(Nf,d({ref:this._list,role:a,items:g,onRenderCell:this._renderGroup,getItemCountForPage:this._returnOne,getPageHeight:this._getPageHeight,getPageSpecification:this._getPageSpecification,usePageCache:o,onShouldVirtualize:n,version:v},h)):this._renderGroup(void 0,0))},t.prototype.forceUpdate=function(){e.prototype.forceUpdate.call(this),this._forceListUpdates()},t.prototype.toggleCollapseAll=function(e){var t=this.state.groups,o=void 0===t?[]:t,n=this.props.groupProps,r=n&&n.onToggleCollapseAll;o.length>0&&(r&&r(e),this._setGroupsCollapsedState(o,e),this._updateIsSomeGroupExpanded(),this.forceUpdate())},t.prototype._setGroupsCollapsedState=function(e,t){for(var o=0;o<e.length;o++)e[o].isCollapsed=t},t.prototype._returnOne=function(){return 1},t.prototype._getGroupKey=function(e,t){return"group-"+(e&&e.key?e.key:String(t))},t.prototype._getGroupNestingDepth=function(){for(var e=0,t=this.state.groups;t&&t.length>0;)e++,t=t[0].children;return e},t.prototype._forceListUpdates=function(e){this.setState({version:{}})},t.prototype._computeIsSomeGroupExpanded=function(e){var t=this;return!(!e||!e.some((function(e){return e.children?t._computeIsSomeGroupExpanded(e.children):!e.isCollapsed})))},t.prototype._updateIsSomeGroupExpanded=function(){var e=this.state.groups,t=this.props.onGroupExpandStateChanged,o=this._computeIsSomeGroupExpanded(e);this._isSomeGroupExpanded!==o&&(t&&t(o),this._isSomeGroupExpanded=o)},t.defaultProps={selectionMode:ev.multiple,isHeaderVisible:!0,groupProps:{},compact:!1},t}(f.Component),Ib=Vn(wb,(function(e){var t,o,n=e.theme,r=e.className,i=e.compact,a=n.palette,s=Qo(nb,n);return{root:[s.root,n.fonts.small,{position:"relative",selectors:(t={},t["."+s.listCell]={minHeight:38},t)},i&&[s.compact,{selectors:(o={},o["."+s.listCell]={minHeight:32},o)}],r],group:[s.group,{transition:"background-color "+Le.durationValue2+" cubic-bezier(0.445, 0.050, 0.550, 0.950)"}],groupIsDropping:{backgroundColor:a.neutralLight}}}),void 0,{scope:"GroupedList"});function Db(e){var t;return e&&(e===window?t={left:0,top:0,width:window.innerWidth,height:window.innerHeight,right:window.innerWidth,bottom:window.innerHeight}:e.getBoundingClientRect&&(t=e.getBoundingClientRect())),t}function Tb(e){return function(t){function o(e){var o=t.call(this,e)||this;return o._root=f.createRef(),o._registerResizeObserver=function(){var e=at(o._root.current);o._viewportResizeObserver=new e.ResizeObserver(o._onAsyncResize),o._viewportResizeObserver.observe(o._root.current)},o._unregisterResizeObserver=function(){o._viewportResizeObserver&&(o._viewportResizeObserver.disconnect(),delete o._viewportResizeObserver)},o._updateViewport=function(e){var t=o.state.viewport,n=o._root.current,r=Db(ts(n)),i=Db(n);((i&&i.width)!==t.width||(r&&r.height)!==t.height)&&o._resizeAttempts<3&&i&&r?(o._resizeAttempts++,o.setState({viewport:{width:i.width,height:r.height}},(function(){o._updateViewport(e)}))):(o._resizeAttempts=0,e&&o._composedComponentInstance&&o._composedComponentInstance.forceUpdate())},o._async=new Zi(o),o._events=new zs(o),o._resizeAttempts=0,o.state={viewport:{width:0,height:0}},o}return u(o,t),o.prototype.componentDidMount=function(){var e=this,t=this.props,o=t.delayFirstMeasure,n=t.disableResizeObserver,r=t.skipViewportMeasures,i=at(this._root.current);this._onAsyncResize=this._async.debounce(this._onAsyncResize,500,{leading:!1}),r||(!n&&this._isResizeObserverAvailable()?this._registerResizeObserver():this._events.on(i,"resize",this._onAsyncResize),o?this._async.setTimeout((function(){e._updateViewport()}),500):this._updateViewport())},o.prototype.componentDidUpdate=function(e){var t=e.skipViewportMeasures,o=this.props,n=o.disableResizeObserver,r=o.skipViewportMeasures,i=at(this._root.current);r!==t&&(r?(this._unregisterResizeObserver(),this._events.off(i,"resize",this._onAsyncResize)):(!n&&this._isResizeObserverAvailable()?this._viewportResizeObserver||this._registerResizeObserver():this._events.on(i,"resize",this._onAsyncResize),this._updateViewport()))},o.prototype.componentWillUnmount=function(){this._events.dispose(),this._async.dispose(),this._unregisterResizeObserver()},o.prototype.render=function(){var t=this.state.viewport,o=t.width>0&&t.height>0?t:void 0;return f.createElement("div",{className:"ms-Viewport",ref:this._root,style:{minWidth:1,minHeight:1}},f.createElement(e,d({ref:this._updateComposedComponentRef,viewport:o},this.props)))},o.prototype.forceUpdate=function(){this._updateViewport(!0)},o.prototype._onAsyncResize=function(){this._updateViewport()},o.prototype._isResizeObserverAvailable=function(){var e=at(this._root.current);return e&&e.ResizeObserver},o}(bu)}var Eb=Jn(),Pb=100,Rb=function(e){var t=e.selection,o=e.ariaLabelForListHeader,n=e.ariaLabelForSelectAllCheckbox,r=e.ariaLabelForSelectionColumn,i=e.className,a=e.checkboxVisibility,s=e.compact,l=e.constrainMode,c=e.dragDropEvents,u=e.groups,p=e.groupProps,h=e.indentWidth,g=e.items,v=e.isPlaceholderData,b=e.isHeaderVisible,y=e.layoutMode,C=e.onItemInvoked,_=e.onItemContextMenu,S=e.onColumnHeaderClick,x=e.onColumnHeaderContextMenu,k=e.selectionMode,w=void 0===k?t.mode:k,I=e.selectionPreservedOnEmptyClick,D=e.selectionZoneProps,T=e.ariaLabel,E=e.ariaLabelForGrid,P=e.rowElementEventMap,R=e.shouldApplyApplicationRole,M=void 0!==R&&R,N=e.getKey,B=e.listProps,F=e.usePageCache,A=e.onShouldVirtualize,L=e.viewport,H=e.minimumPixelsForDrag,O=e.getGroupHeight,z=e.styles,W=e.theme,V=e.cellStyleProps,K=void 0===V?Sv:V,G=e.onRenderCheckbox,U=e.useFastIcons,j=e.dragDropHelper,q=e.adjustedColumns,Y=e.isCollapsed,Z=e.isSizing,X=e.isSomeGroupExpanded,Q=e.version,J=e.rootRef,$=e.listRef,ee=e.focusZoneRef,te=e.columnReorderOptions,oe=e.groupedListRef,ne=e.headerRef,re=e.onGroupExpandStateChanged,ie=e.onColumnIsSizingChanged,ae=e.onRowDidMount,se=e.onRowWillUnmount,le=e.disableSelectionZone,ce=e.onColumnResized,ue=e.onColumnAutoResized,de=e.onToggleCollapse,pe=e.onActiveRowChanged,he=e.onBlur,me=e.rowElementEventMap,ge=e.onRenderMissingItem,fe=e.onRenderItemColumn,ve=e.getCellValueKey,be=e.getRowAriaLabel,ye=e.getRowAriaDescribedBy,Ce=e.checkButtonAriaLabel,_e=e.checkButtonGroupAriaLabel,Se=e.checkboxCellClassName,xe=e.useReducedRowRenderer,ke=e.enableUpdateAnimations,we=e.enterModalSelectionOnTouch,Ie=e.onRenderDefaultRow,De=e.selectionZoneRef,Te=e.focusZoneProps,Ee="grid",Pe=e.role?e.role:Ee,Re=Ka("row"),Me=function(e){for(var t=0,o=e;o&&o.length>0;)t++,o=o[0].children;return t}(u),Ne=function(e){return f.useMemo((function(){var t={};if(e)for(var o=1,n=1,r=0,i=e;r<i.length;r++){var a=i[r];t[a.key]={numOfGroupHeadersBeforeItem:n,totalRowCount:o},n++,o+=a.count+1}return t}),[e])}(u),Be=f.useMemo((function(){return d({renderedWindowsAhead:Z?0:2,renderedWindowsBehind:Z?0:2,getKey:N,version:Q},B)}),[Z,N,Q,B]),Fe=Nv.none;if(w===ev.single&&(Fe=Nv.hidden),w===ev.multiple){var Ae=p&&p.headerProps&&p.headerProps.isCollapsedGroupSelectVisible;void 0===Ae&&(Ae=!0),Fe=Ae||!u||X?Nv.visible:Nv.hidden}a===pv.hidden&&(Fe=Nv.none);var Le=f.useCallback((function(e){return f.createElement(Yv,d({},e))}),[]),He=f.useCallback((function(){return null}),[]),Oe=e.onRenderDetailsHeader,ze=f.useMemo((function(){return Oe?Xh(Oe,Le):Le}),[Oe,Le]),We=e.onRenderDetailsFooter,Ve=f.useMemo((function(){return We?Xh(We,He):He}),[We,He]),Ke=f.useMemo((function(){return{columns:q,groupNestingDepth:Me,selection:t,selectionMode:w,viewport:L,checkboxVisibility:a,indentWidth:h,cellStyleProps:K}}),[q,Me,t,w,L,a,h,K]),Ge=te&&te.onDragEnd,Ue=f.useCallback((function(e,t){var o=e.dropLocation,n=uv.outside;if(Ge){if(o&&o!==uv.header)n=o;else if(J.current){var r=J.current.getBoundingClientRect();t.clientX>r.left&&t.clientX<r.right&&t.clientY>r.top&&t.clientY<r.bottom&&(n=uv.surface)}Ge(n)}}),[Ge,J]),je=f.useMemo((function(){if(te)return d(d({},te),{onColumnDragEnd:Ue})}),[te,Ue]),qe=(b?1:0)+function(e){var t=0;if(e)for(var o=m(e),n=void 0;o&&o.length>0;)++t,(n=o.pop())&&n.children&&o.push.apply(o,n.children);return t}(u)+(g?g.length:0),Ye=(Fe!==Nv.none?1:0)+(q?q.length:0)+(u?1:0),Ze=f.useMemo((function(){return Eb(z,{theme:W,compact:s,isFixed:y===dv.fixedColumns,isHorizontalConstrained:l===cv.horizontalConstrained,className:i})}),[z,W,s,y,l,i]),Xe=p&&p.onRenderFooter,Qe=f.useMemo((function(){return Xe?function(e,o){return Xe(d(d({},e),{columns:q,groupNestingDepth:Me,indentWidth:h,selection:t,selectionMode:w,viewport:L,checkboxVisibility:a,cellStyleProps:K}),o)}:void 0}),[Xe,q,Me,h,t,w,L,a,K]),Je=p&&p.onRenderHeader,$e=f.useMemo((function(){return Je?function(e,o){var n,r,i=e.groupIndex,s=void 0!==i?null===(r=null===(n=e.groups)||void 0===n?void 0:n[i])||void 0===r?void 0:r.key:void 0,l=void 0!==s&&Ne[s]?Ne[s].totalRowCount:0;return Je(d(d({},e),{columns:q,groupNestingDepth:Me,indentWidth:h,selection:t,selectionMode:a!==pv.hidden?w:ev.none,viewport:L,checkboxVisibility:a,cellStyleProps:K,ariaColSpan:q.length,ariaPosInSet:void 0,ariaSetSize:void 0,ariaRowCount:void 0,ariaRowIndex:void 0!==i?l+(b?1:0):void 0}),o)}:function(e,t){var o,n,r=e.groupIndex,i=void 0!==r?null===(n=null===(o=e.groups)||void 0===o?void 0:o[r])||void 0===n?void 0:n.key:void 0,a=void 0!==i&&Ne[i]?Ne[i].totalRowCount:0;return t(d(d({},e),{ariaColSpan:q.length,ariaPosInSet:void 0,ariaSetSize:void 0,ariaRowCount:void 0,ariaRowIndex:void 0!==r?a+(b?1:0):void 0}))}}),[Je,q,Me,h,b,t,w,L,a,K,Ne]),et=f.useMemo((function(){return d(d({},p),{role:Pe===Ee?"rowgroup":"presentation",onRenderFooter:Qe,onRenderHeader:$e,headerProps:d({selectAllButtonProps:{"aria-label":_e}},null==p?void 0:p.headerProps)})}),[p,Qe,$e,_e,Pe]),tt=Ei((function(){return jo((function(e){var t=0;return e.forEach((function(e){return t+=e.calculatedWidth||e.minWidth})),t}))})),ot=p&&p.collapseAllVisibility,nt=f.useMemo((function(){return tt(q)}),[q,tt]),rt=f.useCallback((function(o,n,r,i){var l=e.onRenderRow?Xh(e.onRenderRow,Ie):Ie,u=i?i.key:void 0,d=u&&Ne[u]?Ne[u].numOfGroupHeadersBeforeItem:0,p={item:n,itemIndex:r,flatIndexOffset:(b?2:1)+d,compact:s,columns:q,groupNestingDepth:o,id:Re+"-"+r,selectionMode:w,selection:t,onDidMount:ae,onWillUnmount:se,onRenderItemColumn:fe,getCellValueKey:ve,eventsToRegister:me,dragDropEvents:c,dragDropHelper:j,viewport:L,checkboxVisibility:a,collapseAllVisibility:ot,getRowAriaLabel:be,getRowAriaDescribedBy:ye,checkButtonAriaLabel:Ce,checkboxCellClassName:Se,useReducedRowRenderer:xe,indentWidth:h,cellStyleProps:K,onRenderDetailsCheckbox:G,enableUpdateAnimations:ke,rowWidth:nt,useFastIcons:U,role:Pe===Ee?void 0:"presentation"};return n?l(p):ge?ge(r,p):null}),[s,q,w,t,Re,ae,se,fe,ve,me,c,j,L,a,ot,be,ye,b,Ce,Se,xe,h,K,G,ke,U,Ie,ge,e.onRenderRow,nt,Pe,Ne]),it=f.useCallback((function(e){return function(t,o){return rt(e,t,o)}}),[rt]),at=f.useCallback((function(e){return e.which===Yn(Gn.right,W)}),[W]),st=d(d({},Te),{componentRef:ee,className:Ze.focusZone,direction:Te?Te.direction:$i.vertical,shouldEnterInnerZone:Te&&Te.shouldEnterInnerZone?Te.shouldEnterInnerZone:at,onActiveElementChanged:Te&&Te.onActiveElementChanged?Te.onActiveElementChanged:pe,shouldRaiseClicksOnEnter:!1,onBlur:Te&&Te.onBlur?Te.onBlur:he}),lt=u?f.createElement(Ib,{focusZoneProps:st,componentRef:oe,groups:u,groupProps:et,items:g,onRenderCell:rt,role:"presentation",selection:t,selectionMode:a!==pv.hidden?w:ev.none,dragDropEvents:c,dragDropHelper:j,eventsToRegister:P,listProps:Be,onGroupExpandStateChanged:re,usePageCache:F,onShouldVirtualize:A,getGroupHeight:O,compact:s}):f.createElement(bs,d({},st),f.createElement(Nf,d({ref:$,role:"presentation",items:g,onRenderCell:it(0),usePageCache:F,onShouldVirtualize:A},Be))),ct=f.useCallback((function(e){e.which===Gn.down&&ee.current&&ee.current.focus()&&(0===t.getSelectedIndices().length&&t.setIndexSelected(0,!0,!1),e.preventDefault(),e.stopPropagation())}),[t,ee]),ut=f.useCallback((function(e){e.which!==Gn.up||e.altKey||ne.current&&ne.current.focus()&&(e.preventDefault(),e.stopPropagation())}),[ne]);return f.createElement("div",d({ref:J,className:Ze.root,"data-automationid":"DetailsList","data-is-scrollable":"false","aria-label":T},M?{role:"application"}:{}),f.createElement(ws,null),f.createElement("div",{role:Pe,"aria-label":E,"aria-rowcount":v?-1:qe,"aria-colcount":Ye,"aria-readonly":"true","aria-busy":v},f.createElement("div",{onKeyDown:ct,role:"presentation",className:Ze.headerWrapper},b&&ze({componentRef:ne,selectionMode:w,layoutMode:y,selection:t,columns:q,onColumnClick:S,onColumnContextMenu:x,onColumnResized:ce,onColumnIsSizingChanged:ie,onColumnAutoResized:ue,groupNestingDepth:Me,isAllCollapsed:Y,onToggleCollapseAll:de,ariaLabel:o,ariaLabelForSelectAllCheckbox:n,ariaLabelForSelectionColumn:r,selectAllVisibility:Fe,collapseAllVisibility:p&&p.collapseAllVisibility,viewport:L,columnReorderProps:je,minimumPixelsForDrag:H,cellStyleProps:K,checkboxVisibility:a,indentWidth:h,onRenderDetailsCheckbox:G,rowWidth:tt(q),useFastIcons:U},ze)),f.createElement("div",{onKeyDown:ut,role:"presentation",className:Ze.contentWrapper},le?lt:f.createElement(vv,d({ref:De,selection:t,selectionPreservedOnEmptyClick:I,selectionMode:w,onItemInvoked:C,onItemContextMenu:_,enterModalOnTouch:we},D||{}),lt)),Ve(d({},Ke))))},Mb=function(e){function t(t){var o=e.call(this,t)||this;return o._root=f.createRef(),o._header=f.createRef(),o._groupedList=f.createRef(),o._list=f.createRef(),o._focusZone=f.createRef(),o._selectionZone=f.createRef(),o._onRenderRow=function(e,t){return f.createElement(ob,d({},e))},o._getDerivedStateFromProps=function(e,t){var n=o.props,r=n.checkboxVisibility,i=n.items,a=n.setKey,s=n.selectionMode,l=void 0===s?o._selection.mode:s,c=n.columns,u=n.viewport,p=n.compact,h=n.dragDropEvents,m=(o.props.groupProps||{}).isAllGroupsCollapsed,g=void 0===m?void 0:m,f=e.viewport&&e.viewport.width||0,v=u&&u.width||0,b=e.setKey!==a||void 0===e.setKey,y=!1;e.layoutMode!==o.props.layoutMode&&(y=!0);var C=t;return b&&(o._initialFocusedIndex=e.initialFocusedIndex,C=d(d({},C),{focusedItemIndex:void 0!==o._initialFocusedIndex?o._initialFocusedIndex:-1})),o.props.disableSelectionZone||e.items===i||o._selection.setItems(e.items,b),e.checkboxVisibility===r&&e.columns===c&&f===v&&e.compact===p||(y=!0),C=d(d({},C),o._adjustColumns(e,C,!0)),e.selectionMode!==l&&(y=!0),void 0===g&&e.groupProps&&void 0!==e.groupProps.isAllGroupsCollapsed&&(C=d(d({},C),{isCollapsed:e.groupProps.isAllGroupsCollapsed,isSomeGroupExpanded:!e.groupProps.isAllGroupsCollapsed})),e.dragDropEvents!==h&&(o._dragDropHelper&&o._dragDropHelper.dispose(),o._dragDropHelper=e.dragDropEvents?new Fv({selection:o._selection,minimumPixelsForDrag:e.minimumPixelsForDrag}):void 0,y=!0),y&&(C=d(d({},C),{version:{}})),C},o._onGroupExpandStateChanged=function(e){o.setState({isSomeGroupExpanded:e})},o._onColumnIsSizingChanged=function(e,t){o.setState({isSizing:t})},o._onRowDidMount=function(e){var t=e.props,n=t.item,r=t.itemIndex,i=o._getItemKey(n,r);o._activeRows[i]=e,o._setFocusToRowIfPending(e);var a=o.props.onRowDidMount;a&&a(n,r)},o._onRowWillUnmount=function(e){var t=o.props.onRowWillUnmount,n=e.props,r=n.item,i=n.itemIndex,a=o._getItemKey(r,i);delete o._activeRows[a],t&&t(r,i)},o._onToggleCollapse=function(e){o.setState({isCollapsed:e}),o._groupedList.current&&o._groupedList.current.toggleCollapseAll(e)},o._onColumnResized=function(e,t,n){var r=Math.max(e.minWidth||Pb,t);o.props.onColumnResize&&o.props.onColumnResize(e,r,n),o._rememberCalculatedWidth(e,r),o.setState(d(d({},o._adjustColumns(o.props,o.state,!0,n)),{version:{}}))},o._onColumnAutoResized=function(e,t){var n=0,r=0,i=Object.keys(o._activeRows).length;for(var a in o._activeRows)o._activeRows.hasOwnProperty(a)&&o._activeRows[a].measureCell(t,(function(a){n=Math.max(n,a),++r===i&&o._onColumnResized(e,n,t)}))},o._onActiveRowChanged=function(e,t){var n=o.props,r=n.items,i=n.onActiveItemChanged;if(e&&e.getAttribute("data-item-index")){var a=Number(e.getAttribute("data-item-index"));a>=0&&(i&&i(r[a],a,t),o.setState({focusedItemIndex:a}))}},o._onBlur=function(e){o.setState({focusedItemIndex:-1})},Gi(o),o._async=new Zi(o),o._activeRows={},o._columnOverrides={},o.state={focusedItemIndex:-1,lastWidth:0,adjustedColumns:o._getAdjustedColumns(t,void 0),isSizing:!1,isCollapsed:t.groupProps&&t.groupProps.isAllGroupsCollapsed,isSomeGroupExpanded:t.groupProps&&!t.groupProps.isAllGroupsCollapsed,version:{},getDerivedStateFromProps:o._getDerivedStateFromProps},o._selection=t.selection||new iv({onSelectionChanged:void 0,getKey:t.getKey,selectionMode:t.selectionMode}),o.props.disableSelectionZone||o._selection.setItems(t.items,!1),o._dragDropHelper=t.dragDropEvents?new Fv({selection:o._selection,minimumPixelsForDrag:t.minimumPixelsForDrag}):void 0,o._initialFocusedIndex=t.initialFocusedIndex,o}return u(t,e),t.getDerivedStateFromProps=function(e,t){return t.getDerivedStateFromProps(e,t)},t.prototype.scrollToIndex=function(e,t,o){this._list.current&&this._list.current.scrollToIndex(e,t,o),this._groupedList.current&&this._groupedList.current.scrollToIndex(e,t,o)},t.prototype.focusIndex=function(e,t,o,n){void 0===t&&(t=!1);var r=this.props.items[e];if(r){this.scrollToIndex(e,o,n);var i=this._getItemKey(r,e),a=this._activeRows[i];a&&this._setFocusToRow(a,t)}},t.prototype.getStartItemIndexInView=function(){return this._list&&this._list.current?this._list.current.getStartItemIndexInView():this._groupedList&&this._groupedList.current?this._groupedList.current.getStartItemIndexInView():0},t.prototype.componentWillUnmount=function(){this._dragDropHelper&&this._dragDropHelper.dispose(),this._async.dispose()},t.prototype.componentDidUpdate=function(e,t){if(this._notifyColumnsResized(),void 0!==this._initialFocusedIndex&&(i=this.props.items[this._initialFocusedIndex])){var o=this._getItemKey(i,this._initialFocusedIndex);(n=this._activeRows[o])&&this._setFocusToRowIfPending(n)}if(this.props.items!==e.items&&this.props.items.length>0&&-1!==this.state.focusedItemIndex&&!_a(this._root.current,document.activeElement,!1)){var n,r=this.state.focusedItemIndex<this.props.items.length?this.state.focusedItemIndex:this.props.items.length-1,i=this.props.items[r];o=this._getItemKey(i,this.state.focusedItemIndex),(n=this._activeRows[o])?this._setFocusToRow(n):this._initialFocusedIndex=r}this.props.onDidUpdate&&this.props.onDidUpdate(this)},t.prototype.render=function(){return f.createElement(Rb,d({},this.props,this.state,{selection:this._selection,dragDropHelper:this._dragDropHelper,rootRef:this._root,listRef:this._list,groupedListRef:this._groupedList,focusZoneRef:this._focusZone,headerRef:this._header,selectionZoneRef:this._selectionZone,onGroupExpandStateChanged:this._onGroupExpandStateChanged,onColumnIsSizingChanged:this._onColumnIsSizingChanged,onRowDidMount:this._onRowDidMount,onRowWillUnmount:this._onRowWillUnmount,onColumnResized:this._onColumnResized,onColumnAutoResized:this._onColumnAutoResized,onToggleCollapse:this._onToggleCollapse,onActiveRowChanged:this._onActiveRowChanged,onBlur:this._onBlur,onRenderDefaultRow:this._onRenderRow}))},t.prototype.forceUpdate=function(){e.prototype.forceUpdate.call(this),this._forceListUpdates()},t.prototype._getGroupNestingDepth=function(){for(var e=0,t=this.props.groups;t&&t.length>0;)e++,t=t[0].children;return e},t.prototype._setFocusToRowIfPending=function(e){var t=e.props.itemIndex;void 0!==this._initialFocusedIndex&&t===this._initialFocusedIndex&&(this._setFocusToRow(e),delete this._initialFocusedIndex)},t.prototype._setFocusToRow=function(e,t){void 0===t&&(t=!1),this._selectionZone.current&&this._selectionZone.current.ignoreNextFocus(),this._async.setTimeout((function(){e.focus(t)}),0)},t.prototype._forceListUpdates=function(){this._groupedList.current&&this._groupedList.current.forceUpdate(),this._list.current&&this._list.current.forceUpdate()},t.prototype._notifyColumnsResized=function(){this.state.adjustedColumns.forEach((function(e){e.onColumnResize&&e.onColumnResize(e.currentWidth)}))},t.prototype._adjustColumns=function(e,t,o,n){var r=this._getAdjustedColumns(e,t,o,n),i=this.props.viewport,a=i&&i.width?i.width:0;return d(d({},t),{adjustedColumns:r,lastWidth:a})},t.prototype._getAdjustedColumns=function(e,t,o,n){var r,i=this,a=e.items,s=e.layoutMode,l=e.selectionMode,c=e.viewport,u=c&&c.width?c.width:0,d=e.columns,p=this.props?this.props.columns:[],h=t?t.lastWidth:-1,m=t?t.lastSelectionMode:void 0;return o||h!==u||m!==l||p&&d!==p?(d=d||Nb(a,!0),s===dv.fixedColumns?(r=this._getFixedColumns(d,u,e)).forEach((function(e){i._rememberCalculatedWidth(e,e.calculatedWidth)})):(r=this._getJustifiedColumns(d,u,e)).forEach((function(e){i._getColumnOverride(e.key).currentWidth=e.calculatedWidth})),r):d||[]},t.prototype._getFixedColumns=function(e,t,o){var n=this,r=this.props,i=r.selectionMode,a=void 0===i?this._selection.mode:i,s=r.checkboxVisibility,l=r.flexMargin,c=r.skipViewportMeasures,u=t-(l||0),p=0;e.forEach((function(e){c||!e.flexGrow?u-=e.maxWidth||e.minWidth||Pb:(u-=e.minWidth||Pb,p+=e.flexGrow),u-=Bb(e,o,!0)}));var h=a!==ev.none&&s!==pv.hidden?48:0,m=36*this._getGroupNestingDepth(),g=(u-=h+m)/p;return c||e.forEach((function(e){var t=d(d({},e),n._columnOverrides[e.key]);if(t.flexGrow&&t.maxWidth){var o=t.flexGrow*g+t.minWidth,r=o-t.maxWidth;r>0&&(u+=r,p-=r/(o-t.minWidth)*t.flexGrow)}})),g=u>0?u/p:0,e.map((function(e){var t=d(d({},e),n._columnOverrides[e.key]);return!c&&t.flexGrow&&u<=0||t.calculatedWidth||(!c&&t.flexGrow?(t.calculatedWidth=t.minWidth+t.flexGrow*g,t.calculatedWidth=Math.min(t.calculatedWidth,t.maxWidth||Number.MAX_VALUE)):t.calculatedWidth=t.maxWidth||t.minWidth||Pb),t}))},t.prototype._getJustifiedColumns=function(e,t,o){var n=this,r=o.selectionMode,i=void 0===r?this._selection.mode:r,a=o.checkboxVisibility,s=i!==ev.none&&a!==pv.hidden?48:0,l=36*this._getGroupNestingDepth(),c=0,u=0,p=t-(s+l),h=e.map((function(e,t){var r=d(d({},e),{calculatedWidth:e.minWidth||Pb}),i=d(d({},r),n._columnOverrides[e.key]);return r.isCollapsible||r.isCollapsable||(u+=Bb(r,o)),c+=Bb(i,o),i}));if(u>p)return h;for(var m=h.length-1;m>=0&&c>p;){var g=(y=h[m]).minWidth||Pb,f=c-p;if(y.calculatedWidth-g>=f||!y.isCollapsible&&!y.isCollapsable){var v=y.calculatedWidth;y.calculatedWidth=Math.max(y.calculatedWidth-f,g),c-=v-y.calculatedWidth}else c-=Bb(y,o),h.splice(m,1);m--}for(var b=0;b<h.length&&c<p;b++){var y=h[b],C=b===h.length-1,_=this._columnOverrides[y.key];if(!_||!_.calculatedWidth||C){var S=p-c,x=void 0;if(C)x=S;else{var k=y.maxWidth;g=y.minWidth||k||Pb,x=k?Math.min(S,k-g):S}y.calculatedWidth=y.calculatedWidth+x,c+=x}}return h},t.prototype._rememberCalculatedWidth=function(e,t){var o=this._getColumnOverride(e.key);o.calculatedWidth=t,o.currentWidth=t},t.prototype._getColumnOverride=function(e){return this._columnOverrides[e]=this._columnOverrides[e]||{}},t.prototype._getItemKey=function(e,t){var o=this.props.getKey,n=void 0;return e&&(n=e.key),o&&(n=o(e,t)),n||(n=t),n},t.defaultProps={layoutMode:dv.justified,selectionMode:ev.multiple,constrainMode:cv.horizontalConstrained,checkboxVisibility:pv.onHover,isHeaderVisible:!0,compact:!1,useFastIcons:!0},h([Tb],t)}(f.Component);function Nb(e,t,o,n,r,i,a){var s=[];if(e&&e.length){var l=e[0];for(var c in l)l.hasOwnProperty(c)&&s.push({key:c,name:c,fieldName:c,minWidth:Pb,maxWidth:300,isCollapsable:!!s.length,isCollapsible:!!s.length,isMultiline:void 0!==a&&a,isSorted:n===c,isSortedDescending:!!r,isRowHeader:!1,columnActionsMode:lv.clickable,isResizable:t,onColumnClick:o,isGrouped:i===c})}return s}function Bb(e,t,o){var n=t.cellStyleProps,r=void 0===n?Sv:n;return(o?0:e.calculatedWidth)+r.cellLeftPadding+r.cellRightPadding+(e.isPadded?r.cellExtraRightPadding:0)}var Fb,Ab={root:"ms-DetailsList",compact:"ms-DetailsList--Compact",contentWrapper:"ms-DetailsList-contentWrapper",headerWrapper:"ms-DetailsList-headerWrapper",isFixed:"is-fixed",isHorizontalConstrained:"is-horizontalConstrained",listCell:"ms-List-cell"},Lb=Vn(Mb,(function(e){var t,o,n=e.theme,r=e.className,i=e.isHorizontalConstrained,a=e.compact,s=e.isFixed,l=n.semanticColors,c=Qo(Ab,n);return{root:[c.root,n.fonts.small,{position:"relative",color:l.listText,selectors:(t={},t["& ."+c.listCell]={minHeight:38,wordBreak:"break-word"},t)},s&&c.isFixed,a&&[c.compact,{selectors:(o={},o["."+c.listCell]={minHeight:32},o)}],i&&[c.isHorizontalConstrained,{overflowX:"auto",overflowY:"visible",WebkitOverflowScrolling:"touch"}],r],focusZone:[{display:"inline-block",minWidth:"100%",minHeight:1}],headerWrapper:c.headerWrapper,contentWrapper:c.contentWrapper}}),void 0,{scope:"DetailsList"});!function(e){e[e.normal=0]="normal",e[e.largeHeader=1]="largeHeader",e[e.close=2]="close"}(Fb||(Fb={}));var Hb=Le.durationValue2,Ob={root:"ms-Modal",main:"ms-Dialog-main",scrollableContent:"ms-Modal-scrollableContent",isOpen:"is-open",layer:"ms-Modal-Layer"},zb=Jn(),Wb=function(e){function t(t){var o=e.call(this,t)||this;Gi(o);var n=o.props.allowTouchBodyScroll,r=void 0!==n&&n;return o._allowTouchBodyScroll=r,o}return u(t,e),t.prototype.componentDidMount=function(){!this._allowTouchBodyScroll&&Ja()},t.prototype.componentWillUnmount=function(){!this._allowTouchBodyScroll&&$a()},t.prototype.render=function(){var e=this.props,t=e.isDarkThemed,o=e.className,n=e.theme,r=e.styles,i=Tr(this.props,Dr),a=zb(r,{theme:n,className:o,isDark:t});return f.createElement("div",d({},i,{className:a.root}))},t}(f.Component),Vb={root:"ms-Overlay",rootDark:"ms-Overlay--dark"},Kb=Vn(Wb,(function(e){var t,o=e.className,n=e.theme,r=e.isNone,i=e.isDark,a=n.palette,s=Qo(Vb,n);return{root:[s.root,n.fonts.medium,{backgroundColor:a.whiteTranslucent40,top:0,right:0,bottom:0,left:0,position:"absolute",selectors:(t={},t[ro]={border:"1px solid WindowText",opacity:0},t)},r&&{visibility:"hidden"},i&&[s.rootDark,{backgroundColor:a.blackTranslucent40}],o]}}),void 0,{scope:"Overlay"}),Gb=jo((function(e,t){return{root:Z(e,t&&{touchAction:"none",selectors:{"& *":{userSelect:"none"}}})}})),Ub={start:"touchstart",move:"touchmove",stop:"touchend"},jb={start:"mousedown",move:"mousemove",stop:"mouseup"},qb=function(e){function t(t){var o=e.call(this,t)||this;return o._currentEventType=jb,o._events=[],o._onMouseDown=function(e){var t=f.Children.only(o.props.children).props.onMouseDown;return t&&t(e),o._currentEventType=jb,o._onDragStart(e)},o._onMouseUp=function(e){var t=f.Children.only(o.props.children).props.onMouseUp;return t&&t(e),o._currentEventType=jb,o._onDragStop(e)},o._onTouchStart=function(e){var t=f.Children.only(o.props.children).props.onTouchStart;return t&&t(e),o._currentEventType=Ub,o._onDragStart(e)},o._onTouchEnd=function(e){var t=f.Children.only(o.props.children).props.onTouchEnd;t&&t(e),o._currentEventType=Ub,o._onDragStop(e)},o._onDragStart=function(e){if("number"==typeof e.button&&0!==e.button)return!1;if(!(o.props.handleSelector&&!o._matchesSelector(e.target,o.props.handleSelector)||o.props.preventDragSelector&&o._matchesSelector(e.target,o.props.preventDragSelector))){o._touchId=o._getTouchId(e);var t=o._getControlPosition(e);if(void 0!==t){var n=o._createDragDataFromPosition(t);o.props.onStart&&o.props.onStart(e,n),o.setState({isDragging:!0,lastPosition:t}),o._events=[nl(document.body,o._currentEventType.move,o._onDrag,!0),nl(document.body,o._currentEventType.stop,o._onDragStop,!0)]}}},o._onDrag=function(e){"touchmove"===e.type&&e.preventDefault();var t=o._getControlPosition(e);if(t){var n=o._createUpdatedDragData(o._createDragDataFromPosition(t)),r=n.position;o.props.onDragChange&&o.props.onDragChange(e,n),o.setState({position:r,lastPosition:t})}},o._onDragStop=function(e){if(o.state.isDragging){var t=o._getControlPosition(e);if(t){var n=o._createDragDataFromPosition(t);o.setState({isDragging:!1,lastPosition:void 0}),o.props.onStop&&o.props.onStop(e,n),o.props.position&&o.setState({position:o.props.position}),o._events.forEach((function(e){return e()}))}}},o.state={isDragging:!1,position:o.props.position||{x:0,y:0},lastPosition:void 0},o}return u(t,e),t.prototype.componentDidUpdate=function(e){!this.props.position||e.position&&this.props.position===e.position||this.setState({position:this.props.position})},t.prototype.componentWillUnmount=function(){this._events.forEach((function(e){return e()}))},t.prototype.render=function(){var e=f.Children.only(this.props.children),t=e.props,o=this.props.position,n=this.state,r=n.position,i=n.isDragging,a=r.x,s=r.y;return o&&!i&&(a=o.x,s=o.y),f.cloneElement(e,{style:d(d({},t.style),{transform:"translate("+a+"px, "+s+"px)"}),className:Gb(t.className,this.state.isDragging).root,onMouseDown:this._onMouseDown,onMouseUp:this._onMouseUp,onTouchStart:this._onTouchStart,onTouchEnd:this._onTouchEnd})},t.prototype._getControlPosition=function(e){var t=this._getActiveTouch(e);if(void 0===this._touchId||t){var o=t||e;return{x:o.clientX,y:o.clientY}}},t.prototype._getActiveTouch=function(e){return e.targetTouches&&this._findTouchInTouchList(e.targetTouches)||e.changedTouches&&this._findTouchInTouchList(e.changedTouches)},t.prototype._getTouchId=function(e){var t=e.targetTouches&&e.targetTouches[0]||e.changedTouches&&e.changedTouches[0];if(t)return t.identifier},t.prototype._matchesSelector=function(e,t){if(!e||e===document.body)return!1;var o=e.matches||e.webkitMatchesSelector||e.msMatchesSelector;return!!o&&(o.call(e,t)||this._matchesSelector(e.parentElement,t))},t.prototype._findTouchInTouchList=function(e){if(void 0!==this._touchId)for(var t=0;t<e.length;t++)if(e[t].identifier===this._touchId)return e[t]},t.prototype._createDragDataFromPosition=function(e){var t=this.state.lastPosition;return void 0===t?{delta:{x:0,y:0},lastPosition:e,position:e}:{delta:{x:e.x-t.x,y:e.y-t.y},lastPosition:t,position:e}},t.prototype._createUpdatedDragData=function(e){var t=this.state.position;return{position:{x:t.x+e.delta.x,y:t.y+e.delta.y},delta:e.delta,lastPosition:t}},t}(f.Component);function Yb(e){var t=f.useState(e),o=t[0],n=t[1];return[o,{setTrue:Ei((function(){return function(){n(!0)}})),setFalse:Ei((function(){return function(){n(!1)}})),toggle:Ei((function(){return function(){n((function(e){return!e}))}}))}]}var Zb={x:0,y:0},Xb={isOpen:!1,isDarkOverlay:!0,className:"",containerClassName:""},Qb=Jn(),Jb=f.forwardRef((function(e,t){var o,n,r=tr(Xb,e),i=r.allowTouchBodyScroll,a=r.className,s=r.children,l=r.containerClassName,c=r.scrollableContentClassName,u=r.elementToFocusOnDismiss,p=r.firstFocusableSelector,h=r.forceFocusInsideTrap,m=r.ignoreExternalFocusing,g=r.isBlocking,v=r.isAlert,b=r.isClickableOutsideFocusTrap,y=r.isDarkOverlay,C=r.onDismiss,_=r.layerProps,S=r.overlay,x=r.isOpen,k=r.titleAriaId,w=r.styles,I=r.subtitleAriaId,D=r.theme,T=r.topOffsetFixed,E=r.responsiveMode,P=r.onLayerDidMount,R=r.isModeless,M=r.dragOptions,N=r.onDismissed,B=r.enableAriaHiddenSiblings,F=f.useRef(null),A=f.useRef(null),L=f.useRef(null),H=Or(F,t),O=Tu(H),z=hu("ModalFocusTrapZone"),W=Wl(),V=wm(),K=V.setTimeout,G=V.clearTimeout,U=f.useState(x),j=U[0],q=U[1],Y=f.useState(x),Z=Y[0],X=Y[1],Q=f.useState(Zb),J=Q[0],$=Q[1],ee=f.useState(),te=ee[0],oe=ee[1],ne=Yb(!1),re=ne[0],ie=ne[1],ae=ie.toggle,se=ie.setFalse,le=Ei((function(){return{onModalCloseTimer:0,allowTouchBodyScroll:i,scrollableContent:null,lastSetCoordinates:Zb,events:new zs({})}})),ce=(M||{}).keepInBounds,ue=null!=v?v:g&&!R,de=void 0===_?"":_.className,pe=Qb(w,{theme:D,className:a,containerClassName:l,scrollableContentClassName:c,isOpen:x,isVisible:Z,hasBeenOpened:le.hasBeenOpened,modalRectangleTop:te,topOffsetFixed:T,isModeless:R,layerClassName:de,windowInnerHeight:null==W?void 0:W.innerHeight,isDefaultDragHandle:M&&!M.dragHandleSelector}),he=d(d({eventBubblingEnabled:!1},_),{onLayerDidMount:_&&_.onLayerDidMount?_.onLayerDidMount:P,insertFirst:R,className:pe.layer}),me=f.useCallback((function(e){e?le.allowTouchBodyScroll?Xa(e,le.events):Za(e,le.events):le.events.off(le.scrollableContent),le.scrollableContent=e}),[le]),ge=function(){var e=L.current,t=null==e?void 0:e.getBoundingClientRect();t&&(T&&oe(t.top),ce&&(le.minPosition={x:-t.left,y:-t.top},le.maxPosition={x:t.left,y:t.top}))},fe=f.useCallback((function(e,t){var o=le.minPosition,n=le.maxPosition;return ce&&o&&n&&(t=Math.max(o[e],t),t=Math.min(n[e],t)),t}),[ce,le]),ve=function(){var e;le.lastSetCoordinates=Zb,se(),le.isInKeyboardMoveMode=!1,q(!1),$(Zb),null===(e=le.disposeOnKeyUp)||void 0===e||e.call(le),null==N||N()},be=f.useCallback((function(){se(),le.isInKeyboardMoveMode=!1}),[le,se]),ye=f.useCallback((function(e,t){$((function(e){return{x:fe("x",e.x+t.delta.x),y:fe("y",e.y+t.delta.y)}}))}),[fe]),Ce=f.useCallback((function(){A.current&&A.current.focus()}),[]);f.useEffect((function(){var e;G(le.onModalCloseTimer),x&&(requestAnimationFrame((function(){return K(ge,0)})),q(!0),M&&(e=function(e){e.altKey&&e.ctrlKey&&e.keyCode===Gn.space&&_a(le.scrollableContent,e.target)&&(ae(),e.preventDefault(),e.stopPropagation())},le.disposeOnKeyUp||(le.events.on(W,"keyup",e,!0),le.disposeOnKeyUp=function(){le.events.off(W,"keyup",e,!0),le.disposeOnKeyUp=void 0})),le.hasBeenOpened=!0,X(!0)),!x&&j&&(le.onModalCloseTimer=K(ve,1e3*parseFloat(Hb)),X(!1))}),[j,x]),o=function(){le.events.dispose()},(n=f.useRef(o)).current=o,f.useEffect((function(){return function(){var e;null===(e=n.current)||void 0===e||e.call(n)}}),[]),function(e,t){f.useImperativeHandle(e.componentRef,(function(){return{focus:function(){t.current&&t.current.focus()}}}),[t])}(r,A),function(e){Ri({name:"Modal",props:e,deprecations:{onLayerDidMount:"layerProps.onLayerDidMount"}})}(r);var _e=f.createElement(Mh,{id:z,ref:L,componentRef:A,className:pe.main,elementToFocusOnDismiss:u,isClickableOutsideFocusTrap:R||b||!g,ignoreExternalFocusing:m,forceFocusInsideTrap:R?!R:h,firstFocusableSelector:p,focusPreviouslyFocusedInnerElement:!0,onBlur:le.isInKeyboardMoveMode?function(){var e;le.lastSetCoordinates=Zb,le.isInKeyboardMoveMode=!1,null===(e=le.disposeOnKeyDown)||void 0===e||e.call(le)}:void 0,enableAriaHiddenSiblings:B},M&&le.isInKeyboardMoveMode&&f.createElement("div",{className:pe.keyboardMoveIconContainer},M.keyboardMoveIconProps?f.createElement(ii,d({},M.keyboardMoveIconProps)):f.createElement(ii,{iconName:"move",className:pe.keyboardMoveIcon})),f.createElement("div",{ref:me,className:pe.scrollableContent,"data-is-scrollable":!0},M&&re&&f.createElement(M.menu,{items:[{key:"move",text:M.moveMenuItemText,onClick:function(){var e=function(e){if(e.altKey&&e.ctrlKey&&e.keyCode===Gn.space)return e.preventDefault(),void e.stopPropagation();if(re&&(e.altKey||e.keyCode===Gn.escape)&&se(),!le.isInKeyboardMoveMode||e.keyCode!==Gn.escape&&e.keyCode!==Gn.enter||(le.isInKeyboardMoveMode=!1,e.preventDefault(),e.stopPropagation()),le.isInKeyboardMoveMode){var t=!0,o=function(e){var t=10;return e.shiftKey?e.ctrlKey||(t=50):e.ctrlKey&&(t=1),t}(e);switch(e.keyCode){case Gn.escape:$(le.lastSetCoordinates);case Gn.enter:le.lastSetCoordinates=Zb;break;case Gn.up:$((function(e){return{x:e.x,y:fe("y",e.y-o)}}));break;case Gn.down:$((function(e){return{x:e.x,y:fe("y",e.y+o)}}));break;case Gn.left:$((function(e){return{x:fe("x",e.x-o),y:e.y}}));break;case Gn.right:$((function(e){return{x:fe("x",e.x+o),y:e.y}}));break;default:t=!1}t&&(e.preventDefault(),e.stopPropagation())}};le.lastSetCoordinates=J,se(),le.isInKeyboardMoveMode=!0,le.events.on(W,"keydown",e,!0),le.disposeOnKeyDown=function(){le.events.off(W,"keydown",e,!0),le.disposeOnKeyDown=void 0}}},{key:"close",text:M.closeMenuItemText,onClick:ve}],onDismiss:se,alignTargetEdge:!0,coverTarget:!0,directionalHint:Ys.topLeftEdge,directionalHintFixed:!0,shouldFocusOnMount:!0,target:le.scrollableContent}),s));return j&&O>=(E||vu.small)&&f.createElement(xc,d({ref:H},he),f.createElement(ql,{role:ue?"alertdialog":"dialog","aria-modal":!R,ariaLabelledBy:k,ariaDescribedBy:I,onDismiss:C,shouldRestoreFocus:!m},f.createElement("div",{className:pe.root,role:R?void 0:"document"},!R&&f.createElement(Kb,d({"aria-hidden":!0,isDarkThemed:y,onClick:g?void 0:C,allowTouchBodyScroll:i},S)),M?f.createElement(qb,{handleSelector:M.dragHandleSelector||"#"+z,preventDragSelector:"button",onStart:be,onDragChange:ye,onStop:Ce,position:J},_e):_e)))||null}));Jb.displayName="Modal";var $b=Vn(Jb,(function(e){var t,o=e.className,n=e.containerClassName,r=e.scrollableContentClassName,i=e.isOpen,a=e.isVisible,s=e.hasBeenOpened,l=e.modalRectangleTop,c=e.theme,u=e.topOffsetFixed,d=e.isModeless,p=e.layerClassName,h=e.isDefaultDragHandle,m=e.windowInnerHeight,g=c.palette,f=c.effects,v=c.fonts,b=Qo(Ob,c);return{root:[b.root,v.medium,{backgroundColor:"transparent",position:d?"absolute":"fixed",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",opacity:0,pointerEvents:"none",transition:"opacity "+Hb},u&&"number"==typeof l&&s&&{alignItems:"flex-start"},i&&b.isOpen,a&&{opacity:1,pointerEvents:"auto"},o],main:[b.main,{boxShadow:f.elevation64,borderRadius:f.roundedCorner2,backgroundColor:g.white,boxSizing:"border-box",position:"relative",textAlign:"left",outline:"3px solid transparent",maxHeight:"calc(100% - 32px)",maxWidth:"calc(100% - 32px)",minHeight:"176px",minWidth:"288px",overflowY:"auto",zIndex:d?ko.Layer:void 0},u&&"number"==typeof l&&s&&{top:l},h&&{cursor:"move"},n],scrollableContent:[b.scrollableContent,{overflowY:"auto",flexGrow:1,maxHeight:"100vh",selectors:(t={},t["@supports (-webkit-overflow-scrolling: touch)"]={maxHeight:m},t)},r],layer:d&&[p,b.layer,{position:"static",width:"unset",height:"unset"}],keyboardMoveIconContainer:{position:"absolute",display:"flex",justifyContent:"center",width:"100%",padding:"3px 0px"},keyboardMoveIcon:{fontSize:v.xLargePlus.fontSize,width:"24px"}}}),void 0,{scope:"Modal",fields:["theme","styles","enableAriaHiddenSiblings"]});$b.displayName="Modal";var ey,ty=Jn(),oy=function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.className,o=e.styles,n=e.theme;return this._classNames=ty(o,{theme:n,className:t}),f.createElement("div",{className:this._classNames.actions},f.createElement("div",{className:this._classNames.actionsRight},this._renderChildrenAsActions()))},t.prototype._renderChildrenAsActions=function(){var e=this;return f.Children.map(this.props.children,(function(t){return t?f.createElement("span",{className:e._classNames.action},t):null}))},t}(f.Component),ny={actions:"ms-Dialog-actions",action:"ms-Dialog-action",actionsRight:"ms-Dialog-actionsRight"},ry=Vn(oy,(function(e){var t=e.className,o=e.theme,n=Qo(ny,o);return{actions:[n.actions,{position:"relative",width:"100%",minHeight:"24px",lineHeight:"24px",margin:"16px 0 0",fontSize:"0",selectors:{".ms-Button":{lineHeight:"normal"}}},t],action:[n.action,{margin:"0 4px"}],actionsRight:[n.actionsRight,{textAlign:"right",marginRight:"-4px",fontSize:"0"}]}}),void 0,{scope:"DialogFooter"}),iy=Jn(),ay=f.createElement(ry,null).type,sy=function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),xi("DialogContent",t,{titleId:"titleProps.id"}),o}return u(t,e),t.prototype.render=function(){var e,t=this.props,o=t.showCloseButton,n=t.className,r=t.closeButtonAriaLabel,i=t.onDismiss,a=t.subTextId,s=t.subText,l=t.titleProps,c=void 0===l?{}:l,u=t.titleId,p=t.title,h=t.type,m=t.styles,g=t.theme,v=t.draggableHeaderClassName,b=iy(m,{theme:g,className:n,isLargeHeader:h===Fb.largeHeader,isClose:h===Fb.close,draggableHeaderClassName:v}),y=this._groupChildren();return s&&(e=f.createElement("p",{className:b.subText,id:a},s)),f.createElement("div",{className:b.content},f.createElement("div",{className:b.header},f.createElement("div",d({id:u,role:"heading","aria-level":1},c,{className:qr(b.title,c.className)}),p),f.createElement("div",{className:b.topButton},this.props.topButtonsProps.map((function(e,t){return f.createElement(id,d({key:e.uniqueId||t},e))})),(h===Fb.close||o&&h!==Fb.largeHeader)&&f.createElement(id,{className:b.button,iconProps:{iconName:"Cancel"},ariaLabel:r,onClick:i}))),f.createElement("div",{className:b.inner},f.createElement("div",{className:b.innerContent},e,y.contents),y.footers))},t.prototype._groupChildren=function(){var e={footers:[],contents:[]};return f.Children.map(this.props.children,(function(t){"object"==typeof t&&null!==t&&t.type===ay?e.footers.push(t):e.contents.push(t)})),e},t.defaultProps={showCloseButton:!1,className:"",topButtonsProps:[],closeButtonAriaLabel:"Close"},h([Iu],t)}(f.Component),ly={contentLgHeader:"ms-Dialog-lgHeader",close:"ms-Dialog--close",subText:"ms-Dialog-subText",header:"ms-Dialog-header",headerLg:"ms-Dialog--lgHeader",button:"ms-Dialog-button ms-Dialog-button--close",inner:"ms-Dialog-inner",content:"ms-Dialog-content",title:"ms-Dialog-title"},cy=Vn(sy,(function(e){var t,o,n,r=e.className,i=e.theme,a=e.isLargeHeader,s=e.isClose,l=e.hidden,c=e.isMultiline,u=e.draggableHeaderClassName,d=i.palette,p=i.fonts,h=i.effects,m=i.semanticColors,g=Qo(ly,i);return{content:[a&&[g.contentLgHeader,{borderTop:"4px solid "+d.themePrimary}],s&&g.close,{flexGrow:1,overflowY:"hidden"},r],subText:[g.subText,p.medium,{margin:"0 0 24px 0",color:m.bodySubtext,lineHeight:"1.5",wordWrap:"break-word",fontWeight:qe.regular}],header:[g.header,{position:"relative",width:"100%",boxSizing:"border-box"},s&&g.close,u&&[u,{cursor:"move"}]],button:[g.button,l&&{selectors:{".ms-Icon.ms-Icon--Cancel":{color:m.buttonText,fontSize:Ye.medium}}}],inner:[g.inner,{padding:"0 24px 24px",selectors:(t={},t["@media (min-width: "+lo+"px) and (max-width: "+go+"px)"]={padding:"0 16px 16px"},t)}],innerContent:[g.content,{position:"relative",width:"100%"}],title:[g.title,p.xLarge,{color:m.bodyText,margin:"0",minHeight:p.xLarge.fontSize,padding:"16px 46px 20px 24px",lineHeight:"normal",selectors:(o={},o["@media (min-width: "+lo+"px) and (max-width: "+go+"px)"]={padding:"16px 46px 16px 16px"},o)},a&&{color:m.menuHeader},c&&{fontSize:p.xxLarge.fontSize}],topButton:[{display:"flex",flexDirection:"row",flexWrap:"nowrap",position:"absolute",top:"0",right:"0",padding:"15px 15px 0 0",selectors:(n={"> *":{flex:"0 0 auto"},".ms-Dialog-button":{color:m.buttonText},".ms-Dialog-button:hover":{color:m.buttonTextHovered,borderRadius:h.roundedCorner2}},n["@media (min-width: "+lo+"px) and (max-width: "+go+"px)"]={padding:"15px 8px 0 0"},n)}]}}),void 0,{scope:"DialogContent"}),uy=Jn(),dy={isDarkOverlay:!1,isBlocking:!1,className:"",containerClassName:"",topOffsetFixed:!1},py={type:Fb.normal,className:"",topButtonsProps:[]},hy=function(e){function t(t){var o=e.call(this,t)||this;return o._getSubTextId=function(){var e=o.props,t=e.ariaDescribedById,n=e.modalProps,r=e.dialogContentProps,i=e.subText,a=n&&n.subtitleAriaId||t;return a||(a=(r&&r.subText||i)&&o._defaultSubTextId),a},o._getTitleTextId=function(){var e=o.props,t=e.ariaLabelledById,n=e.modalProps,r=e.dialogContentProps,i=e.title,a=n&&n.titleAriaId||t;return a||(a=(r&&r.title||i)&&o._defaultTitleTextId),a},o._id=Ka("Dialog"),o._defaultTitleTextId=o._id+"-title",o._defaultSubTextId=o._id+"-subText",xi("Dialog",t,{isOpen:"hidden",type:"dialogContentProps.type",subText:"dialogContentProps.subText",contentClassName:"dialogContentProps.className",topButtonsProps:"dialogContentProps.topButtonsProps",className:"modalProps.className",isDarkOverlay:"modalProps.isDarkOverlay",isBlocking:"modalProps.isBlocking",containerClassName:"modalProps.containerClassName",onDismissed:"modalProps.onDismissed",onLayerDidMount:"modalProps.layerProps.onLayerDidMount",ariaDescribedById:"modalProps.subtitleAriaId",ariaLabelledById:"modalProps.titleAriaId"}),o}return u(t,e),t.prototype.render=function(){var e,t,o,n,r=this.props,i=r.className,a=r.containerClassName,s=r.contentClassName,l=r.elementToFocusOnDismiss,c=r.firstFocusableSelector,u=r.forceFocusInsideTrap,p=r.styles,h=r.hidden,m=r.ignoreExternalFocusing,g=r.isBlocking,v=r.isClickableOutsideFocusTrap,b=r.isDarkOverlay,y=r.isOpen,C=r.onDismiss,_=r.onDismissed,S=r.onLayerDidMount,x=r.responsiveMode,k=r.subText,w=r.theme,I=r.title,D=r.topButtonsProps,T=r.type,E=r.minWidth,P=r.maxWidth,R=r.modalProps,M=d({},R?R.layerProps:{onLayerDidMount:S});S&&!M.onLayerDidMount&&(M.onLayerDidMount=S),R&&R.dragOptions&&!R.dragOptions.dragHandleSelector?(o="ms-Dialog-draggable-header",n=d(d({},R.dragOptions),{dragHandleSelector:"."+o})):n=R&&R.dragOptions;var N=d(d(d(d({},dy),{className:i,containerClassName:a,isBlocking:g,isDarkOverlay:b,onDismissed:_}),R),{layerProps:M,dragOptions:n}),B=d(d(d({className:s,subText:k,title:I,topButtonsProps:D,type:T},py),this.props.dialogContentProps),{draggableHeaderClassName:o,titleProps:d({id:(null===(e=this.props.dialogContentProps)||void 0===e?void 0:e.titleId)||this._defaultTitleTextId},null===(t=this.props.dialogContentProps)||void 0===t?void 0:t.titleProps)}),F=uy(p,{theme:w,className:N.className,containerClassName:N.containerClassName,hidden:h,dialogDefaultMinWidth:E,dialogDefaultMaxWidth:P});return f.createElement($b,d({elementToFocusOnDismiss:l,firstFocusableSelector:c,forceFocusInsideTrap:u,ignoreExternalFocusing:m,isClickableOutsideFocusTrap:v,responsiveMode:x},N,{isOpen:void 0!==y?y:!h,className:F.root,containerClassName:F.main,onDismiss:C||N.onDismiss,subtitleAriaId:this._getSubTextId(),titleAriaId:this._getTitleTextId()}),f.createElement(cy,d({subTextId:this._defaultSubTextId,showCloseButton:N.isBlocking,onDismiss:C},B),this.props.children))},t.defaultProps={hidden:!0},h([Iu],t)}(f.Component),my={root:"ms-Dialog"},gy=Vn(hy,(function(e){var t,o=e.className,n=e.containerClassName,r=e.dialogDefaultMinWidth,i=void 0===r?"288px":r,a=e.dialogDefaultMaxWidth,s=void 0===a?"340px":a,l=e.hidden,c=e.theme;return{root:[Qo(my,c).root,c.fonts.medium,o],main:[{width:i,outline:"3px solid transparent",selectors:(t={},t["@media (min-width: "+co+"px)"]={width:"auto",maxWidth:s,minWidth:i},t)},!l&&{display:"flex"},n]}}),void 0,{scope:"Dialog"});gy.displayName="Dialog",function(e){e[e.normal=0]="normal",e[e.compact=1]="compact"}(ey||(ey={}));var fy,vy=Jn(),by=function(e){function t(t){var o=e.call(this,t)||this;return o._rootElement=f.createRef(),o._onClick=function(e){o._onAction(e)},o._onKeyDown=function(e){e.which!==Gn.enter&&e.which!==Gn.space||o._onAction(e)},o._onAction=function(e){var t=o.props,n=t.onClick,r=t.onClickHref,i=t.onClickTarget;n?n(e):!n&&r&&(i?window.open(r,i,"noreferrer noopener nofollow"):window.location.href=r,e.preventDefault(),e.stopPropagation())},Gi(o),xi("DocumentCard",t,{accentColor:void 0}),o}return u(t,e),t.prototype.render=function(){var e,t=this.props,o=t.onClick,n=t.onClickHref,r=t.children,i=t.type,a=t.accentColor,s=t.styles,l=t.theme,c=t.className,u=Tr(this.props,Dr,["className","onClick","type","role"]),p=!(!o&&!n);this._classNames=vy(s,{theme:l,className:c,actionable:p,compact:i===ey.compact}),i===ey.compact&&a&&(e={borderBottomColor:a});var h=this.props.role||(p?o?"button":"link":void 0),m=p?0:void 0;return f.createElement("div",d({ref:this._rootElement,tabIndex:m,"data-is-focusable":p,role:h,className:this._classNames.root,onKeyDown:p?this._onKeyDown:void 0,onClick:p?this._onClick:void 0,style:e},u),r)},t.prototype.focus=function(){this._rootElement.current&&this._rootElement.current.focus()},t.defaultProps={type:ey.normal},t}(f.Component),yy={root:"ms-DocumentCardPreview",icon:"ms-DocumentCardPreview-icon",iconContainer:"ms-DocumentCardPreview-iconContainer"},Cy={root:"ms-DocumentCardActivity",multiplePeople:"ms-DocumentCardActivity--multiplePeople",details:"ms-DocumentCardActivity-details",name:"ms-DocumentCardActivity-name",activity:"ms-DocumentCardActivity-activity",avatars:"ms-DocumentCardActivity-avatars",avatar:"ms-DocumentCardActivity-avatar"},_y={root:"ms-DocumentCardTitle"},Sy={root:"ms-DocumentCardLocation"},xy={root:"ms-DocumentCard",rootActionable:"ms-DocumentCard--actionable",rootCompact:"ms-DocumentCard--compact"},ky=Vn(by,(function(e){var t,o,n=e.className,r=e.theme,i=e.actionable,a=e.compact,s=r.palette,l=r.fonts,c=r.effects,u=Qo(xy,r);return{root:[u.root,{WebkitFontSmoothing:"antialiased",backgroundColor:s.white,border:"1px solid "+s.neutralLight,maxWidth:"320px",minWidth:"206px",userSelect:"none",position:"relative",selectors:(t={":focus":{outline:"0px solid"}},t["."+wo+" &:focus"]=Ro(s.neutralSecondary,c.roundedCorner2),t["."+Sy.root+" + ."+_y.root]={paddingTop:"4px"},t)},i&&[u.rootActionable,{selectors:{":hover":{cursor:"pointer",borderColor:s.neutralTertiaryAlt},":hover:after":{content:'" "',position:"absolute",top:0,right:0,bottom:0,left:0,border:"1px solid "+s.neutralTertiaryAlt,pointerEvents:"none"}}}],a&&[u.rootCompact,{display:"flex",maxWidth:"480px",height:"108px",selectors:(o={},o["."+yy.root]={borderRight:"1px solid "+s.neutralLight,borderBottom:0,maxHeight:"106px",maxWidth:"144px"},o["."+yy.icon]={maxHeight:"32px",maxWidth:"32px"},o["."+Cy.root]={paddingBottom:"12px"},o["."+_y.root]={paddingBottom:"12px 16px 8px 16px",fontSize:l.mediumPlus.fontSize,lineHeight:"16px"},o)}],n]}}),void 0,{scope:"DocumentCard"}),wy=Jn(),Iy=function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),o}return u(t,e),t.prototype.render=function(){var e=this,t=this.props,o=t.actions,n=t.views,r=t.styles,i=t.theme,a=t.className;return this._classNames=wy(r,{theme:i,className:a}),f.createElement("div",{className:this._classNames.root},o&&o.map((function(t,o){return f.createElement("div",{className:e._classNames.action,key:o},f.createElement(id,d({},t)))})),n>0&&f.createElement("div",{className:this._classNames.views},f.createElement(ii,{iconName:"View",className:this._classNames.viewsIcon}),n))},t}(f.Component),Dy={root:"ms-DocumentCardActions",action:"ms-DocumentCardActions-action",views:"ms-DocumentCardActions-views"},Ty=Vn(Iy,(function(e){var t=e.className,o=e.theme,n=o.palette,r=o.fonts,i=Qo(Dy,o);return{root:[i.root,{height:"34px",padding:"4px 12px",position:"relative"},t],action:[i.action,{float:"left",marginRight:"4px",color:n.neutralSecondary,cursor:"pointer",selectors:{".ms-Button":{fontSize:r.mediumPlus.fontSize,height:34,width:34},".ms-Button:hover .ms-Button-icon":{color:o.semanticColors.buttonText,cursor:"pointer"}}}],views:[i.views,{textAlign:"right",lineHeight:34}],viewsIcon:{marginRight:"8px",fontSize:r.medium.fontSize,verticalAlign:"top"}}}),void 0,{scope:"DocumentCardActions"}),Ey=Jn(),Py=Vn(function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.activity,o=e.people,n=e.styles,r=e.theme,i=e.className;return this._classNames=Ey(n,{theme:r,className:i,multiplePeople:o.length>1}),o&&0!==o.length?f.createElement("div",{className:this._classNames.root},this._renderAvatars(o),f.createElement("div",{className:this._classNames.details},f.createElement("span",{className:this._classNames.name},this._getNameString(o)),f.createElement("span",{className:this._classNames.activity},t))):null},t.prototype._renderAvatars=function(e){return f.createElement("div",{className:this._classNames.avatars},e.length>1?this._renderAvatar(e[1]):null,this._renderAvatar(e[0]))},t.prototype._renderAvatar=function(e){return f.createElement("div",{className:this._classNames.avatar},f.createElement(Oi,{imageInitials:e.initials,text:e.name,imageUrl:e.profileImageSrc,initialsColor:e.initialsColor,allowPhoneInitials:e.allowPhoneInitials,role:"presentation",size:Yr.size32}))},t.prototype._getNameString=function(e){var t=e[0].name;return e.length>=2&&(t+=" +"+(e.length-1)),t},t}(f.Component),(function(e){var t=e.theme,o=e.className,n=e.multiplePeople,r=t.palette,i=t.fonts,a=Qo(Cy,t);return{root:[a.root,n&&a.multiplePeople,{padding:"8px 16px",position:"relative"},o],avatars:[a.avatars,{marginLeft:"-2px",height:"32px"}],avatar:[a.avatar,{display:"inline-block",verticalAlign:"top",position:"relative",textAlign:"center",width:32,height:32,selectors:{"&:after":{content:'" "',position:"absolute",left:"-1px",top:"-1px",right:"-1px",bottom:"-1px",border:"2px solid "+r.white,borderRadius:"50%"},":nth-of-type(2)":n&&{marginLeft:"-16px"}}}],details:[a.details,{left:n?"72px":"56px",height:32,position:"absolute",top:8,width:"calc(100% - 72px)"}],name:[a.name,{display:"block",fontSize:i.small.fontSize,lineHeight:"15px",height:"15px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:r.neutralPrimary,fontWeight:qe.semibold}],activity:[a.activity,{display:"block",fontSize:i.small.fontSize,lineHeight:"15px",height:"15px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:r.neutralSecondary}]}}),void 0,{scope:"DocumentCardActivity"}),Ry=Jn(),My=function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.children,o=e.styles,n=e.theme,r=e.className;return this._classNames=Ry(o,{theme:n,className:r}),f.createElement("div",{className:this._classNames.root},t)},t}(f.Component),Ny={root:"ms-DocumentCardDetails"},By=Vn(My,(function(e){var t=e.className,o=e.theme;return{root:[Qo(Ny,o).root,{display:"flex",flexDirection:"column",flex:1,justifyContent:"space-between",overflow:"hidden"},t]}}),void 0,{scope:"DocumentCardDetails"}),Fy=Jn(),Ay=Vn(function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.location,o=e.locationHref,n=e.ariaLabel,r=e.onClick,i=e.styles,a=e.theme,s=e.className;return this._classNames=Fy(i,{theme:a,className:s}),f.createElement("a",{className:this._classNames.root,href:o,onClick:r,"aria-label":n},t)},t}(f.Component),(function(e){var t=e.theme,o=e.className,n=t.palette,r=t.fonts;return{root:[Qo(Sy,t).root,r.small,{color:n.themePrimary,display:"block",fontWeight:qe.semibold,overflow:"hidden",padding:"8px 16px",position:"relative",textDecoration:"none",textOverflow:"ellipsis",whiteSpace:"nowrap",selectors:{":hover":{color:n.themePrimary,cursor:"pointer"}}},o]}}),void 0,{scope:"DocumentCardLocation"}),Ly=Jn(),Hy=Vn(function(e){function t(t){var o=e.call(this,t)||this;return o._renderPreviewList=function(e){var t=o.props,n=t.getOverflowDocumentCountText,r=t.maxDisplayCount,i=void 0===r?3:r,a=e.length-i,s=a?n?n(a):"+"+a:null,l=e.slice(0,i).map((function(e,t){return f.createElement("li",{key:t},f.createElement(Gr,{className:o._classNames.fileListIcon,src:e.iconSrc,role:"presentation",alt:"",width:"16px",height:"16px"}),f.createElement(Ns,d({className:o._classNames.fileListLink,href:e.url},e.linkProps),e.name))}));return f.createElement("div",null,f.createElement("ul",{className:o._classNames.fileList},l),s&&f.createElement("span",{className:o._classNames.fileListOverflowText},s))},Gi(o),o}return u(t,e),t.prototype.render=function(){var e,t,o=this.props,n=o.previewImages,r=o.styles,i=o.theme,a=o.className,s=n.length>1;return this._classNames=Ly(r,{theme:i,className:a,isFileList:s}),n.length>1?t=this._renderPreviewList(n):1===n.length&&(t=this._renderPreviewImage(n[0]),n[0].accentColor&&(e={borderBottomColor:n[0].accentColor})),f.createElement("div",{className:this._classNames.root,style:e},t)},t.prototype._renderPreviewImage=function(e){var t=e.width,o=e.height,n=e.imageFit,r=e.previewIconProps,i=e.previewIconContainerClass;if(r)return f.createElement("div",{className:qr(this._classNames.previewIcon,i),style:{width:t,height:o}},f.createElement(ii,d({},r)));var a,s=f.createElement(Gr,{width:t,height:o,imageFit:n,src:e.previewImageSrc,role:"presentation",alt:""});return e.iconSrc&&(a=f.createElement(Gr,{className:this._classNames.icon,src:e.iconSrc,role:"presentation",alt:""})),f.createElement("div",null,s,a)},t}(f.Component),(function(e){var t,o,n=e.theme,r=e.className,i=e.isFileList,a=n.palette,s=n.fonts,l=Qo(yy,n);return{root:[l.root,s.small,{backgroundColor:i?a.white:a.neutralLighterAlt,borderBottom:"1px solid "+a.neutralLight,overflow:"hidden",position:"relative"},r],previewIcon:[l.iconContainer,{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"}],icon:[l.icon,{left:"10px",bottom:"10px",position:"absolute"}],fileList:{padding:"16px 16px 0 16px",listStyleType:"none",margin:0,selectors:{li:{height:"16px",lineHeight:"16px",display:"flex",flexWrap:"nowrap",alignItems:"center",marginBottom:"8px",overflow:"hidden"}}},fileListIcon:{display:"inline-block",flexShrink:0,marginRight:"8px"},fileListLink:[To(n,{highContrastStyle:{border:"1px solid WindowText",outline:"none"}}),{boxSizing:"border-box",color:a.neutralDark,flexGrow:1,overflow:"hidden",display:"inline-block",textDecoration:"none",textOverflow:"ellipsis",whiteSpace:"nowrap",selectors:(t={":hover":{color:a.themePrimary}},t["."+wo+" &:focus"]={selectors:(o={},o[ro]={outline:"none"},o)},t)}],fileListOverflowText:{padding:"0px 16px 8px 16px",display:"block"}}}),void 0,{scope:"DocumentCardPreview"}),Oy=Jn(),zy=function(e){function t(t){var o=e.call(this,t)||this;return o._onImageLoad=function(){o.setState({imageHasLoaded:!0})},Gi(o),o.state={imageHasLoaded:!1},o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.styles,o=e.width,n=e.height,r=e.imageFit,i=e.imageSrc;return this._classNames=Oy(t,this.props),f.createElement("div",{className:this._classNames.root},i&&f.createElement(Gr,{width:o,height:n,imageFit:r,src:i,role:"presentation",alt:"",onLoad:this._onImageLoad}),this.state.imageHasLoaded?this._renderCornerIcon():this._renderCenterIcon())},t.prototype._renderCenterIcon=function(){var e=this.props.iconProps;return f.createElement("div",{className:this._classNames.centeredIconWrapper},f.createElement(ii,d({className:this._classNames.centeredIcon},e)))},t.prototype._renderCornerIcon=function(){var e=this.props.iconProps;return f.createElement(ii,d({className:this._classNames.cornerIcon},e))},t}(f.Component),Wy="42px",Vy="32px",Ky=Vn(zy,(function(e){var t=e.theme,o=e.className,n=e.height,r=e.width,i=t.palette;return{root:[{borderBottom:"1px solid "+i.neutralLight,position:"relative",backgroundColor:i.neutralLighterAlt,overflow:"hidden",height:n&&n+"px",width:r&&r+"px"},o],centeredIcon:[{height:Wy,width:Wy,fontSize:Wy}],centeredIconWrapper:[{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",width:"100%",position:"absolute",top:0,left:0}],cornerIcon:[{left:"10px",bottom:"10px",height:Vy,width:Vy,fontSize:Vy,position:"absolute",overflow:"visible"}]}}),void 0,{scope:"DocumentCardImage"}),Gy=Jn(),Uy=Vn(function(e){function t(t){var o=e.call(this,t)||this;return o._titleElement=f.createRef(),o._truncateTitle=function(){o._needMeasurement&&o._async.requestAnimationFrame(o._truncateWhenInAnimation)},o._truncateWhenInAnimation=function(){var e=o.props.title,t=o._titleElement.current;if(t){var n=getComputedStyle(t);if(n.width&&n.lineHeight&&n.height){var r=t.clientWidth,i=t.scrollWidth;o._clientWidth=r;var a=Math.floor((parseInt(n.height,10)+5)/parseInt(n.lineHeight,10));t.style.whiteSpace="";var s=i/(parseInt(n.width,10)*a);if(s>1){var l=e.length/s-3;return o.setState({truncatedTitleFirstPiece:e.slice(0,l/2),truncatedTitleSecondPiece:e.slice(e.length-l/2)})}}}},o._shrinkTitle=function(){var e=o.state,t=e.truncatedTitleFirstPiece,n=e.truncatedTitleSecondPiece;if(t&&n){var r=o._titleElement.current;if(!r)return;(r.scrollHeight>r.clientHeight+5||r.scrollWidth>r.clientWidth)&&o.setState({truncatedTitleFirstPiece:t.slice(0,t.length-1),truncatedTitleSecondPiece:n.slice(1)})}},Gi(o),o._async=new Zi(o),o._events=new zs(o),o._clientWidth=void 0,o.state={truncatedTitleFirstPiece:void 0,truncatedTitleSecondPiece:void 0},o}return u(t,e),t.prototype.componentDidUpdate=function(e){var t=this;this.props.title!==e.title&&this.setState({truncatedTitleFirstPiece:void 0,truncatedTitleSecondPiece:void 0}),e.shouldTruncate!==this.props.shouldTruncate?this.props.shouldTruncate?(this._truncateTitle(),this._async.requestAnimationFrame(this._shrinkTitle),this._events.on(window,"resize",this._updateTruncation)):this._events.off(window,"resize",this._updateTruncation):this._needMeasurement&&this._async.requestAnimationFrame((function(){t._truncateWhenInAnimation(),t._shrinkTitle()}))},t.prototype.componentDidMount=function(){this.props.shouldTruncate&&(this._truncateTitle(),this._events.on(window,"resize",this._updateTruncation))},t.prototype.componentWillUnmount=function(){this._events.dispose(),this._async.dispose()},t.prototype.render=function(){var e=this.props,t=e.title,o=e.shouldTruncate,n=e.showAsSecondaryTitle,r=e.styles,i=e.theme,a=e.className,s=this.state,l=s.truncatedTitleFirstPiece,c=s.truncatedTitleSecondPiece;return this._classNames=Gy(r,{theme:i,className:a,showAsSecondaryTitle:n}),o&&l&&c?f.createElement("div",{className:this._classNames.root,ref:this._titleElement,title:t},l,"…",c):f.createElement("div",{className:this._classNames.root,ref:this._titleElement,title:t,style:this._needMeasurement?{whiteSpace:"nowrap"}:void 0},t)},Object.defineProperty(t.prototype,"_needMeasurement",{get:function(){return!!this.props.shouldTruncate&&void 0===this._clientWidth},enumerable:!1,configurable:!0}),t.prototype._updateTruncation=function(){var e=this;this._timerId||(this._timerId=this._async.setTimeout((function(){delete e._timerId,e._clientWidth=void 0,e.setState({truncatedTitleFirstPiece:void 0,truncatedTitleSecondPiece:void 0})}),250))},t}(f.Component),(function(e){var t=e.theme,o=e.className,n=e.showAsSecondaryTitle,r=t.palette,i=t.fonts;return{root:[Qo(_y,t).root,n?i.medium:i.large,{padding:"8px 16px",display:"block",overflow:"hidden",wordWrap:"break-word",height:n?"45px":"38px",lineHeight:n?"18px":"21px",color:n?r.neutralSecondary:r.neutralPrimary},o]}}),void 0,{scope:"DocumentCardTitle"}),jy=Jn(),qy=function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.logoIcon,o=e.styles,n=e.theme,r=e.className;return this._classNames=jy(o,{theme:n,className:r}),f.createElement("div",{className:this._classNames.root},f.createElement(ii,{iconName:t}))},t}(f.Component),Yy={root:"ms-DocumentCardLogo"},Zy=Vn(qy,(function(e){var t=e.theme,o=e.className,n=t.palette,r=t.fonts;return{root:[Qo(Yy,t).root,{fontSize:r.xxLargePlus.fontSize,color:n.themePrimary,display:"block",padding:"16px 16px 0 16px"},o]}}),void 0,{scope:"DocumentCardLogo"}),Xy=Jn(),Qy=function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.statusIcon,o=e.status,n=e.styles,r=e.theme,i=e.className,a={iconName:t,styles:{root:{padding:"8px"}}};return this._classNames=Xy(n,{theme:r,className:i}),f.createElement("div",{className:this._classNames.root},t&&f.createElement(ii,d({},a)),o)},t}(f.Component),Jy={root:"ms-DocumentCardStatus"},$y=Vn(Qy,(function(e){var t=e.className,o=e.theme,n=o.palette,r=o.fonts;return{root:[Qo(Jy,o).root,r.medium,{margin:"8px 16px",color:n.neutralPrimary,backgroundColor:n.neutralLighter,height:"32px"},t]}}),void 0,{scope:"DocumentCardStatus"}),eC=function(e){var t;return function(o){t||(t=new Set,Ki(e,{componentWillUnmount:function(){t.forEach((function(e){return cancelAnimationFrame(e)}))}}));var n=requestAnimationFrame((function(){t.delete(n),o()}));t.add(n)}},tC=function(){function e(){this._size=0}return e.prototype.updateOptions=function(e){for(var t=[],o=0,n=0;n<e.length;n++)e[n].itemType===tf.Divider||e[n].itemType===tf.Header?t.push(n):e[n].hidden||o++;this._size=o,this._displayOnlyOptionsCache=t,this._cachedOptions=m(e)},Object.defineProperty(e.prototype,"optionSetSize",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cachedOptions",{get:function(){return this._cachedOptions},enumerable:!1,configurable:!0}),e.prototype.positionInSet=function(e){if(void 0!==e){for(var t=0;e>this._displayOnlyOptionsCache[t];)t++;if(this._displayOnlyOptionsCache[t]===e)throw new Error("Unexpected: Option at index "+e+" is not a selectable element.");return e-t+1}},e}();!function(e){e[e.smallFluid=0]="smallFluid",e[e.smallFixedFar=1]="smallFixedFar",e[e.smallFixedNear=2]="smallFixedNear",e[e.medium=3]="medium",e[e.large=4]="large",e[e.largeFixed=5]="largeFixed",e[e.extraLarge=6]="extraLarge",e[e.custom=7]="custom",e[e.customNear=8]="customNear"}(fy||(fy={}));var oC,nC=Jn();!function(e){e[e.closed=0]="closed",e[e.animatingOpen=1]="animatingOpen",e[e.open=2]="open",e[e.animatingClosed=3]="animatingClosed"}(oC||(oC={}));var rC,iC,aC,sC,lC,cC=function(e){function t(t){var o=e.call(this,t)||this;o._panel=f.createRef(),o._animationCallback=null,o._hasCustomNavigation=!(!o.props.onRenderNavigation&&!o.props.onRenderNavigationContent),o.dismiss=function(e){o.props.onDismiss&&o.isActive&&o.props.onDismiss(e),(!e||e&&!e.defaultPrevented)&&o.close()},o._allowScrollOnPanel=function(e){e?o._allowTouchBodyScroll?Xa(e,o._events):Za(e,o._events):o._events.off(o._scrollableContent),o._scrollableContent=e},o._onRenderNavigation=function(e){if(!o.props.onRenderNavigationContent&&!o.props.onRenderNavigation&&!o.props.hasCloseButton)return null;var t=o.props.onRenderNavigationContent,n=void 0===t?o._onRenderNavigationContent:t;return f.createElement("div",{className:o._classNames.navigation},n(e,o._onRenderNavigationContent))},o._onRenderNavigationContent=function(e){var t,n=e.closeButtonAriaLabel,r=e.hasCloseButton,i=e.onRenderHeader,a=void 0===i?o._onRenderHeader:i;if(r){var s=null===(t=o._classNames.subComponentStyles)||void 0===t?void 0:t.closeButton();return f.createElement(f.Fragment,null,!o._hasCustomNavigation&&a(o.props,o._onRenderHeader,o._headerTextId),f.createElement(id,{styles:s,className:o._classNames.closeButton,onClick:o._onPanelClick,ariaLabel:n,title:n,"data-is-visible":!0,iconProps:{iconName:"Cancel"}}))}return null},o._onRenderHeader=function(e,t,n){var r=e.headerText,i=e.headerTextProps,a=void 0===i?{}:i;return r?f.createElement("div",{className:o._classNames.header},f.createElement("div",d({id:n,role:"heading","aria-level":1},a,{className:qr(o._classNames.headerText,a.className)}),r)):null},o._onRenderBody=function(e){return f.createElement("div",{className:o._classNames.content},e.children)},o._onRenderFooter=function(e){var t=o.props.onRenderFooterContent,n=void 0===t?null:t;return n?f.createElement("div",{className:o._classNames.footer},f.createElement("div",{className:o._classNames.footerInner},n())):null},o._animateTo=function(e){e===oC.open&&o.props.onOpen&&o.props.onOpen(),o._animationCallback=o._async.setTimeout((function(){o.setState({visibility:e}),o._onTransitionComplete()}),200)},o._clearExistingAnimationTimer=function(){null!==o._animationCallback&&o._async.clearTimeout(o._animationCallback)},o._onPanelClick=function(e){o.dismiss(e)},o._onTransitionComplete=function(){o._updateFooterPosition(),o.state.visibility===oC.open&&o.props.onOpened&&o.props.onOpened(),o.state.visibility===oC.closed&&o.props.onDismissed&&o.props.onDismissed()};var n=o.props.allowTouchBodyScroll,r=void 0!==n&&n;return o._allowTouchBodyScroll=r,o._async=new Zi(o),o._events=new zs(o),Gi(o),xi("Panel",t,{ignoreExternalFocusing:"focusTrapZoneProps",forceFocusInsideTrap:"focusTrapZoneProps",firstFocusableSelector:"focusTrapZoneProps"}),o.state={isFooterSticky:!1,visibility:oC.closed,id:Ka("Panel")},o}return u(t,e),t.getDerivedStateFromProps=function(e,t){return void 0===e.isOpen?null:!e.isOpen||t.visibility!==oC.closed&&t.visibility!==oC.animatingClosed?e.isOpen||t.visibility!==oC.open&&t.visibility!==oC.animatingOpen?null:{visibility:oC.animatingClosed}:{visibility:oC.animatingOpen}},t.prototype.componentDidMount=function(){this._events.on(window,"resize",this._updateFooterPosition),this._shouldListenForOuterClick(this.props)&&this._events.on(document.body,"mousedown",this._dismissOnOuterClick,!0),this.props.isOpen&&this.setState({visibility:oC.animatingOpen})},t.prototype.componentDidUpdate=function(e,t){var o=this._shouldListenForOuterClick(this.props),n=this._shouldListenForOuterClick(e);this.state.visibility!==t.visibility&&(this._clearExistingAnimationTimer(),this.state.visibility===oC.animatingOpen?this._animateTo(oC.open):this.state.visibility===oC.animatingClosed&&this._animateTo(oC.closed)),o&&!n?this._events.on(document.body,"mousedown",this._dismissOnOuterClick,!0):!o&&n&&this._events.off(document.body,"mousedown",this._dismissOnOuterClick,!0)},t.prototype.componentWillUnmount=function(){this._async.dispose(),this._events.dispose()},t.prototype.render=function(){var e=this.props,t=e.className,o=void 0===t?"":t,n=e.elementToFocusOnDismiss,r=e.firstFocusableSelector,i=e.focusTrapZoneProps,a=e.forceFocusInsideTrap,s=e.hasCloseButton,l=e.headerText,c=e.headerClassName,u=void 0===c?"":c,p=e.ignoreExternalFocusing,h=e.isBlocking,m=e.isFooterAtBottom,g=e.isLightDismiss,v=e.isHiddenOnDismiss,b=e.layerProps,y=e.overlayProps,C=e.popupProps,_=e.type,S=e.styles,x=e.theme,k=e.customWidth,w=e.onLightDismissClick,I=void 0===w?this._onPanelClick:w,D=e.onRenderNavigation,T=void 0===D?this._onRenderNavigation:D,E=e.onRenderHeader,P=void 0===E?this._onRenderHeader:E,R=e.onRenderBody,M=void 0===R?this._onRenderBody:R,N=e.onRenderFooter,B=void 0===N?this._onRenderFooter:N,F=this.state,A=F.isFooterSticky,L=F.visibility,H=F.id,O=_===fy.smallFixedNear||_===fy.customNear,z=jn(x)?O:!O,W=_===fy.custom||_===fy.customNear?{width:k}:{},V=Tr(this.props,Dr),K=this.isActive,G=L===oC.animatingClosed||L===oC.animatingOpen;if(this._headerTextId=l&&H+"-headerText",!K&&!G&&!v)return null;this._classNames=nC(S,{theme:x,className:o,focusTrapZoneClassName:i?i.className:void 0,hasCloseButton:s,headerClassName:u,isAnimating:G,isFooterSticky:A,isFooterAtBottom:m,isOnRightSide:z,isOpen:K,isHiddenOnDismiss:v,type:_,hasCustomNavigation:this._hasCustomNavigation});var U,j=this._classNames,q=this._allowTouchBodyScroll;return h&&K&&(U=f.createElement(Kb,d({className:j.overlay,isDarkThemed:!1,onClick:g?I:void 0,allowTouchBodyScroll:q},y))),f.createElement(xc,d({},b),f.createElement(ql,d({role:"dialog","aria-modal":h?"true":void 0,ariaLabelledBy:this._headerTextId?this._headerTextId:void 0,onDismiss:this.dismiss,className:j.hiddenPanel},C),f.createElement("div",d({"aria-hidden":!K&&G},V,{ref:this._panel,className:j.root}),U,f.createElement(Mh,d({ignoreExternalFocusing:p,forceFocusInsideTrap:!(!h||v&&!K)&&a,firstFocusableSelector:r,isClickableOutsideFocusTrap:!0},i,{className:j.main,style:W,elementToFocusOnDismiss:n}),f.createElement("div",{className:j.contentInner},f.createElement("div",{ref:this._allowScrollOnPanel,className:j.scrollableContent,"data-is-scrollable":!0},f.createElement("div",{className:j.commands,"data-is-visible":!0},T(this.props,this._onRenderNavigation)),(this._hasCustomNavigation||!s)&&P(this.props,this._onRenderHeader,this._headerTextId),M(this.props,this._onRenderBody),B(this.props,this._onRenderFooter)))))))},t.prototype.open=function(){void 0===this.props.isOpen&&(this.isActive||this.setState({visibility:oC.animatingOpen}))},t.prototype.close=function(){void 0===this.props.isOpen&&this.isActive&&this.setState({visibility:oC.animatingClosed})},Object.defineProperty(t.prototype,"isActive",{get:function(){return this.state.visibility===oC.open||this.state.visibility===oC.animatingOpen},enumerable:!1,configurable:!0}),t.prototype._shouldListenForOuterClick=function(e){return!!e.isBlocking&&!!e.isOpen},t.prototype._updateFooterPosition=function(){var e=this._scrollableContent;if(e){var t=e.clientHeight,o=e.scrollHeight;this.setState({isFooterSticky:t<o})}},t.prototype._dismissOnOuterClick=function(e){var t=this._panel.current;this.isActive&&t&&!e.defaultPrevented&&(_a(t,e.target)||(this.props.onOuterClick?this.props.onOuterClick(e):this.dismiss(e)))},t.defaultProps={isHiddenOnDismiss:!1,isOpen:void 0,isBlocking:!0,hasCloseButton:!0,type:fy.smallFixedFar},t}(f.Component),uC={root:"ms-Panel",main:"ms-Panel-main",commands:"ms-Panel-commands",contentInner:"ms-Panel-contentInner",scrollableContent:"ms-Panel-scrollableContent",navigation:"ms-Panel-navigation",closeButton:"ms-Panel-closeButton ms-PanelAction-close",header:"ms-Panel-header",headerText:"ms-Panel-headerText",content:"ms-Panel-content",footer:"ms-Panel-footer",footerInner:"ms-Panel-footerInner",isOpen:"is-open",hasCloseButton:"ms-Panel--hasCloseButton",smallFluid:"ms-Panel--smFluid",smallFixedNear:"ms-Panel--smLeft",smallFixedFar:"ms-Panel--sm",medium:"ms-Panel--md",large:"ms-Panel--lg",largeFixed:"ms-Panel--fixed",extraLarge:"ms-Panel--xl",custom:"ms-Panel--custom",customNear:"ms-Panel--customLeft"},dC="auto",pC=((rC={})["@media (min-width: "+co+"px)"]={width:340},rC),hC=((iC={})["@media (min-width: "+uo+"px)"]={width:592},iC["@media (min-width: "+po+"px)"]={width:644},iC),mC=((aC={})["@media (min-width: "+Co+"px)"]={left:48,width:"auto"},aC["@media (min-width: "+ho+"px)"]={left:428},aC),gC=((sC={})["@media (min-width: "+ho+"px)"]={left:dC,width:940},sC),fC=((lC={})["@media (min-width: "+ho+"px)"]={left:176},lC),vC=function(e){var t;switch(e){case fy.smallFixedFar:t=d({},pC);break;case fy.medium:t=d(d({},pC),hC);break;case fy.large:t=d(d(d({},pC),hC),mC);break;case fy.largeFixed:t=d(d(d(d({},pC),hC),mC),gC);break;case fy.extraLarge:t=d(d(d(d({},pC),hC),mC),fC)}return t},bC={paddingLeft:"24px",paddingRight:"24px"},yC=Vn(cC,(function(e){var t,o,n,r,i=e.className,a=e.focusTrapZoneClassName,s=e.hasCloseButton,l=e.headerClassName,c=e.isAnimating,u=e.isFooterSticky,p=e.isFooterAtBottom,h=e.isOnRightSide,m=e.isOpen,g=e.isHiddenOnDismiss,f=e.hasCustomNavigation,v=e.theme,b=e.type,y=void 0===b?fy.smallFixedFar:b,C=v.effects,_=v.fonts,S=v.semanticColors,x=Qo(uC,v),k=y===fy.custom||y===fy.customNear;return{root:[x.root,v.fonts.medium,m&&x.isOpen,s&&x.hasCloseButton,{pointerEvents:"none",position:"absolute",top:0,left:0,right:0,bottom:0},k&&h&&x.custom,k&&!h&&x.customNear,i],overlay:[{pointerEvents:"auto",cursor:"pointer"},m&&c&&Ze.fadeIn100,!m&&c&&Ze.fadeOut100],hiddenPanel:[!m&&!c&&g&&{visibility:"hidden"}],main:[x.main,{backgroundColor:S.bodyBackground,boxShadow:C.elevation64,pointerEvents:"auto",position:"absolute",display:"flex",flexDirection:"column",overflowX:"hidden",overflowY:"auto",WebkitOverflowScrolling:"touch",bottom:0,top:0,left:dC,right:0,width:"100%",selectors:d((t={},t[ro]={borderLeft:"3px solid "+S.variantBorder,borderRight:"3px solid "+S.variantBorder},t),vC(y))},y===fy.smallFluid&&{left:0},y===fy.smallFixedNear&&{left:0,right:dC,width:272},y===fy.customNear&&{right:"auto",left:0},k&&{maxWidth:"100vw"},m&&c&&!h&&Ze.slideRightIn40,m&&c&&h&&Ze.slideLeftIn40,!m&&c&&!h&&Ze.slideLeftOut40,!m&&c&&h&&Ze.slideRightOut40,a],commands:[x.commands,{marginTop:18,selectors:(o={},o["@media (min-height: "+co+"px)"]={backgroundColor:S.bodyBackground,position:"sticky",top:0},o)},f&&{marginTop:"inherit"}],navigation:[x.navigation,{display:"flex",justifyContent:"flex-end"},f&&{height:"44px"}],contentInner:[x.contentInner,{display:"flex",flexDirection:"column",flexGrow:1,overflowY:"hidden"}],header:[x.header,bC,{alignSelf:"flex-start"},s&&!f&&{flexGrow:1},f&&{flexShrink:0}],headerText:[x.headerText,_.xLarge,{color:S.bodyText,lineHeight:"27px",overflowWrap:"break-word",wordWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},l],scrollableContent:[x.scrollableContent,{overflowY:"auto"},p&&{flexGrow:1,display:"inherit",flexDirection:"inherit"}],content:[x.content,bC,{paddingBottom:20},p&&{selectors:(n={},n["@media (min-height: "+co+"px)"]={flexGrow:1},n)}],footer:[x.footer,{flexShrink:0,borderTop:"1px solid transparent",transition:"opacity "+Le.durationValue3+" "+Le.easeFunction2,selectors:(r={},r["@media (min-height: "+co+"px)"]={position:"sticky",bottom:0},r)},u&&{background:S.bodyBackground,borderTopColor:S.variantBorder}],footerInner:[x.footerInner,bC,{paddingBottom:16,paddingTop:16}],subComponentStyles:{closeButton:{root:[x.closeButton,{marginRight:14,color:v.palette.neutralSecondary,fontSize:Ye.large},f&&{marginRight:0,height:"auto",width:"44px"}],rootHovered:{color:v.palette.neutralPrimary}}}}}),void 0,{scope:"Panel"}),CC="Dropdown",_C=Jn(),SC={options:[]},xC=f.forwardRef((function(e,t){var o=tr(SC,e),n=f.useRef(null),r=Or(t,n),i=Tu(n,o.responsiveMode),a=function(e){var t,o=e.defaultSelectedKeys,n=e.selectedKeys,r=e.defaultSelectedKey,i=e.selectedKey,a=e.options,s=e.multiSelect,l=Ti(a),c=f.useState([]),u=c[0],d=c[1],p=a!==l,h=Ti(t=s?p&&void 0!==o?o:n:p&&void 0!==r?r:i);return f.useEffect((function(){var e=function(e){return ia(a,(function(t){return null!=e?t.key===e:!!t.selected||!!t.isSelected}))};void 0===t&&l||t===h&&!p||d(function(){if(void 0===t)return s?a.map((function(e,t){return e.selected?t:-1})).filter((function(e){return-1!==e})):-1!==(i=e(null))?[i]:[];if(!Array.isArray(t))return-1!==(i=e(t))?[i]:[];for(var o=[],n=0,r=t;n<r.length;n++){var i,l=r[n];-1!==(i=e(l))&&o.push(i)}return o}())}),[p,s,l,h,a,t]),[u,d]}(o),s=a[0],l=a[1];return f.createElement(DC,d({},o,{responsiveMode:i,hoisted:{rootRef:r,selectedIndices:s,setSelectedIndices:l}}))}));xC.displayName="DropdownBase";var kC,wC,IC,DC=function(e){function t(t){var o=e.call(this,t)||this;o._host=f.createRef(),o._focusZone=f.createRef(),o._dropDown=f.createRef(),o._scrollIdleDelay=250,o._sizePosCache=new tC,o._requestAnimationFrame=eC(o),o._onChange=function(e,t,n,r,i){var a=o.props,s=a.onChange,l=a.onChanged;if(s||l){var c=i?d(d({},t[n]),{selected:!r}):t[n];s&&s(d(d({},e),{target:o._dropDown.current}),c,n),l&&l(c,n)}},o._getPlaceholder=function(){return o.props.placeholder||o.props.placeHolder},o._getTitle=function(e,t){var n=o.props.multiSelectDelimiter,r=void 0===n?", ":n;return e.map((function(e){return e.text})).join(r)},o._onRenderTitle=function(e){return f.createElement(f.Fragment,null,o._getTitle(e))},o._onRenderPlaceholder=function(e){return o._getPlaceholder()?f.createElement(f.Fragment,null,o._getPlaceholder()):null},o._onRenderContainer=function(e){var t=e.calloutProps,n=e.panelProps,r=o.props,i=r.responsiveMode,a=r.dropdownWidth,s=i<=vu.medium,l=o._classNames.subComponentStyles?o._classNames.subComponentStyles.panel:void 0,c=void 0,u=void 0;return"auto"===a?u=o._dropDown.current?o._dropDown.current.clientWidth:0:c=a||(o._dropDown.current?o._dropDown.current.clientWidth:0),s?f.createElement(yC,d({isOpen:!0,isLightDismiss:!0,onDismiss:o._onDismiss,hasCloseButton:!1,styles:l},n),o._renderFocusableList(e)):f.createElement(kc,d({isBeakVisible:!1,gapSpace:0,doNotLayer:!1,directionalHintFixed:!1,directionalHint:Ys.bottomLeftEdge,calloutWidth:c,calloutMinWidth:u},t,{className:o._classNames.callout,target:o._dropDown.current,onDismiss:o._onDismiss,onScroll:o._onScroll,onPositioned:o._onPositioned}),o._renderFocusableList(e))},o._onRenderCaretDown=function(e){return f.createElement(ii,{className:o._classNames.caretDown,iconName:"ChevronDown","aria-hidden":!0})},o._onRenderList=function(e){var t=e.onRenderItem,n=void 0===t?o._onRenderItem:t,r={items:[]},i=[],a=function(){var e=r.id?[f.createElement("div",{role:"group",key:r.id,"aria-labelledby":r.id},r.items)]:r.items;i=m(i,e),r={items:[]}};return e.options.forEach((function(e,t){!function(e,t){switch(e.itemType){case tf.Header:r.items.length>0&&a();var i=o._id+e.key;r.items.push(n(d(d({id:i},e),{index:t}),o._onRenderItem)),r.id=i;break;case tf.Divider:t>0&&r.items.push(n(d(d({},e),{index:t}),o._onRenderItem)),r.items.length>0&&a();break;default:r.items.push(n(d(d({},e),{index:t}),o._onRenderItem))}}(e,t)})),r.items.length>0&&a(),f.createElement(f.Fragment,null,i)},o._onRenderItem=function(e){switch(e.itemType){case tf.Divider:return o._renderSeparator(e);case tf.Header:return o._renderHeader(e);default:return o._renderOption(e)}},o._renderOption=function(e){var t=o.props,n=t.onRenderOption,r=void 0===n?o._onRenderOption:n,i=t.hoisted.selectedIndices,a=void 0===i?[]:i,s=!(void 0===e.index||!a)&&a.indexOf(e.index)>-1,l=e.hidden?o._classNames.dropdownItemHidden:s&&!0===e.disabled?o._classNames.dropdownItemSelectedAndDisabled:s?o._classNames.dropdownItemSelected:!0===e.disabled?o._classNames.dropdownItemDisabled:o._classNames.dropdownItem,c=e.title,u=o._classNames.subComponentStyles?o._classNames.subComponentStyles.multiSelectItem:void 0;return o.props.multiSelect?f.createElement(Uh,{id:o._listId+e.index,key:e.key,disabled:e.disabled,onChange:o._onItemClick(e),inputProps:d({"aria-selected":s,onMouseEnter:o._onItemMouseEnter.bind(o,e),onMouseLeave:o._onMouseItemLeave.bind(o,e),onMouseMove:o._onItemMouseMove.bind(o,e),role:"option"},{"data-index":e.index,"data-is-focusable":!e.disabled}),label:e.text,title:c,onRenderLabel:o._onRenderItemLabel.bind(o,e),className:l,checked:s,styles:u,ariaPositionInSet:o._sizePosCache.positionInSet(e.index),ariaSetSize:o._sizePosCache.optionSetSize,ariaLabel:e.ariaLabel}):f.createElement(Xd,{id:o._listId+e.index,key:e.key,"data-index":e.index,"data-is-focusable":!e.disabled,disabled:e.disabled,className:l,onClick:o._onItemClick(e),onMouseEnter:o._onItemMouseEnter.bind(o,e),onMouseLeave:o._onMouseItemLeave.bind(o,e),onMouseMove:o._onItemMouseMove.bind(o,e),role:"option","aria-selected":s?"true":"false",ariaLabel:e.ariaLabel,title:c,"aria-posinset":o._sizePosCache.positionInSet(e.index),"aria-setsize":o._sizePosCache.optionSetSize},r(e,o._onRenderOption))},o._onRenderOption=function(e){return f.createElement("span",{className:o._classNames.dropdownOptionText},e.text)},o._onRenderItemLabel=function(e){var t=o.props.onRenderOption;return(void 0===t?o._onRenderOption:t)(e,o._onRenderOption)},o._onPositioned=function(e){o._focusZone.current&&o._requestAnimationFrame((function(){var e=o.props.hoisted.selectedIndices;if(o._focusZone.current)if(e&&e[0]&&!o.props.options[e[0]].disabled){var t=nt().getElementById(o._id+"-list"+e[0]);t&&o._focusZone.current.focusElement(t)}else o._focusZone.current.focus()})),o.state.calloutRenderEdge&&o.state.calloutRenderEdge===e.targetEdge||o.setState({calloutRenderEdge:e.targetEdge})},o._onItemClick=function(e){return function(t){e.disabled||(o.setSelectedIndex(t,e.index),o.props.multiSelect||o.setState({isOpen:!1}))}},o._onScroll=function(){o._isScrollIdle||void 0===o._scrollIdleTimeoutId?o._isScrollIdle=!1:(clearTimeout(o._scrollIdleTimeoutId),o._scrollIdleTimeoutId=void 0),o._scrollIdleTimeoutId=window.setTimeout((function(){o._isScrollIdle=!0}),o._scrollIdleDelay)},o._onMouseItemLeave=function(e,t){if(!o._shouldIgnoreMouseEvent()&&o._host.current)if(o._host.current.setActive)try{o._host.current.setActive()}catch(e){}else o._host.current.focus()},o._onDismiss=function(){o.setState({isOpen:!1})},o._onDropdownBlur=function(e){o._isDisabled()||o.state.isOpen||(o.setState({hasFocus:!1}),o.props.onBlur&&o.props.onBlur(e))},o._onDropdownKeyDown=function(e){if(!o._isDisabled()&&(o._lastKeyDownWasAltOrMeta=o._isAltOrMeta(e),!o.props.onKeyDown||(o.props.onKeyDown(e),!e.defaultPrevented))){var t,n=o.props.hoisted.selectedIndices.length?o.props.hoisted.selectedIndices[0]:-1,r=e.altKey||e.metaKey,i=o.state.isOpen;switch(e.which){case Gn.enter:o.setState({isOpen:!i});break;case Gn.escape:if(!i)return;o.setState({isOpen:!1});break;case Gn.up:if(r){if(i){o.setState({isOpen:!1});break}return}o.props.multiSelect?o.setState({isOpen:!0}):o._isDisabled()||(t=o._moveIndex(e,-1,n-1,n));break;case Gn.down:r&&(e.stopPropagation(),e.preventDefault()),r&&!i||o.props.multiSelect?o.setState({isOpen:!0}):o._isDisabled()||(t=o._moveIndex(e,1,n+1,n));break;case Gn.home:o.props.multiSelect||(t=o._moveIndex(e,1,0,n));break;case Gn.end:o.props.multiSelect||(t=o._moveIndex(e,-1,o.props.options.length-1,n));break;case Gn.space:break;default:return}t!==n&&(e.stopPropagation(),e.preventDefault())}},o._onDropdownKeyUp=function(e){if(!o._isDisabled()){var t=o._shouldHandleKeyUp(e),n=o.state.isOpen;if(!o.props.onKeyUp||(o.props.onKeyUp(e),!e.defaultPrevented)){switch(e.which){case Gn.space:o.setState({isOpen:!n});break;default:return void(t&&n&&o.setState({isOpen:!1}))}e.stopPropagation(),e.preventDefault()}}},o._onZoneKeyDown=function(e){var t;o._lastKeyDownWasAltOrMeta=o._isAltOrMeta(e);var n=e.altKey||e.metaKey;switch(e.which){case Gn.up:n?o.setState({isOpen:!1}):o._host.current&&(t=xa(o._host.current,o._host.current.lastChild,!0));break;case Gn.home:case Gn.end:case Gn.pageUp:case Gn.pageDown:break;case Gn.down:!n&&o._host.current&&(t=Sa(o._host.current,o._host.current.firstChild,!0));break;case Gn.escape:o.setState({isOpen:!1});break;case Gn.tab:return void o.setState({isOpen:!1});default:return}t&&t.focus(),e.stopPropagation(),e.preventDefault()},o._onZoneKeyUp=function(e){o._shouldHandleKeyUp(e)&&o.state.isOpen&&(o.setState({isOpen:!1}),e.preventDefault())},o._onDropdownClick=function(e){if(!o.props.onClick||(o.props.onClick(e),!e.defaultPrevented)){var t=o.state.isOpen;o._isDisabled()||o._shouldOpenOnFocus()||o.setState({isOpen:!t}),o._isFocusedByClick=!1}},o._onDropdownMouseDown=function(){o._isFocusedByClick=!0},o._onFocus=function(e){if(!o._isDisabled()){o.props.onFocus&&o.props.onFocus(e);var t={hasFocus:!0};o._shouldOpenOnFocus()&&(t.isOpen=!0),o.setState(t)}},o._isDisabled=function(){var e=o.props.disabled,t=o.props.isDisabled;return void 0===e&&(e=t),e},o._onRenderLabel=function(e){var t=e.label,n=e.required,r=e.disabled,i=o._classNames.subComponentStyles?o._classNames.subComponentStyles.label:void 0;return t?f.createElement(Yh,{className:o._classNames.label,id:o._labelId,required:n,styles:i,disabled:r},t):null},Gi(o);var n=t.multiSelect,r=t.selectedKey,i=t.selectedKeys,a=t.defaultSelectedKey,s=t.defaultSelectedKeys,l=t.options;if(xi(CC,t,{isDisabled:"disabled",onChanged:"onChange",placeHolder:"placeholder",onRenderPlaceHolder:"onRenderPlaceholder"}),ki(CC,t,{defaultSelectedKey:"selectedKey",defaultSelectedKeys:"selectedKeys",selectedKeys:"selectedKey"}),n){var c=function(e){return cn("Dropdown property '"+e+"' cannot be used when 'multiSelect' is true. Use '"+e+"s' instead.")};void 0!==r&&c("selectedKey"),void 0!==a&&c("defaultSelectedKey")}else{var u=function(e){return cn("Dropdown property '"+e+"s' cannot be used when 'multiSelect' is false/unset. Use '"+e+"' instead.")};void 0!==i&&u("selectedKey"),void 0!==s&&u("defaultSelectedKey")}return o._id=t.id||Ka("Dropdown"),o._labelId=o._id+"-label",o._listId=o._id+"-list",o._optionId=o._id+"-option",o._isScrollIdle=!0,o._sizePosCache.updateOptions(l),o.state={isOpen:!1,hasFocus:!1,calloutRenderEdge:void 0},o}return u(t,e),Object.defineProperty(t.prototype,"selectedOptions",{get:function(){var e=this.props;return mf(e.options,e.hoisted.selectedIndices)},enumerable:!1,configurable:!0}),t.prototype.componentWillUnmount=function(){clearTimeout(this._scrollIdleTimeoutId)},t.prototype.componentDidUpdate=function(e,t){!0===t.isOpen&&!1===this.state.isOpen&&(this._gotMouseMove=!1,this.props.onDismiss&&this.props.onDismiss())},t.prototype.render=function(){var e=this._id,t=this.props,o=t.className,n=t.label,r=t.options,i=t.ariaLabel,a=t.required,s=t.errorMessage,l=t.styles,c=t.theme,u=t.panelProps,p=t.calloutProps,h=t.onRenderTitle,m=void 0===h?this._getTitle:h,g=t.onRenderContainer,v=void 0===g?this._onRenderContainer:g,b=t.onRenderCaretDown,y=void 0===b?this._onRenderCaretDown:b,C=t.onRenderLabel,_=void 0===C?this._onRenderLabel:C,S=t.hoisted.selectedIndices,x=this.state,k=x.isOpen,w=x.calloutRenderEdge,I=x.hasFocus,D=t.onRenderPlaceholder||t.onRenderPlaceHolder||this._getPlaceholder;r!==this._sizePosCache.cachedOptions&&this._sizePosCache.updateOptions(r);var T=mf(r,S),E=Tr(t,Dr),P=this._isDisabled(),R=e+"-errorMessage",M=P?void 0:k&&1===S.length&&S[0]>=0?this._listId+S[0]:void 0;this._classNames=_C(l,{theme:c,className:o,hasError:!!(s&&s.length>0),hasLabel:!!n,isOpen:k,required:a,disabled:P,isRenderingPlaceholder:!T.length,panelClassName:u?u.className:void 0,calloutClassName:p?p.className:void 0,calloutRenderEdge:w});var N=!!s&&s.length>0;return f.createElement("div",{className:this._classNames.root,ref:this.props.hoisted.rootRef,"aria-owns":k?this._listId:void 0},_(this.props,this._onRenderLabel),f.createElement("div",d({"data-is-focusable":!P,"data-ktp-target":!0,ref:this._dropDown,id:e,tabIndex:P?-1:0,role:"combobox","aria-haspopup":"listbox","aria-expanded":k?"true":"false","aria-label":i,"aria-labelledby":n&&!i?Gs(this._labelId,this._optionId):void 0,"aria-describedby":N?this._id+"-errorMessage":void 0,"aria-activedescendant":M,"aria-required":a,"aria-disabled":P,"aria-controls":k?this._listId:void 0},E,{className:this._classNames.dropdown,onBlur:this._onDropdownBlur,onKeyDown:this._onDropdownKeyDown,onKeyUp:this._onDropdownKeyUp,onClick:this._onDropdownClick,onMouseDown:this._onDropdownMouseDown,onFocus:this._onFocus}),f.createElement("span",{id:this._optionId,className:this._classNames.title,"aria-live":I?"polite":void 0,"aria-atomic":!!I||void 0,"aria-invalid":N},T.length?m(T,this._onRenderTitle):D(t,this._onRenderPlaceholder)),f.createElement("span",{className:this._classNames.caretDownWrapper},y(t,this._onRenderCaretDown))),k&&v(d(d({},t),{onDismiss:this._onDismiss}),this._onRenderContainer),N&&f.createElement("div",{role:"alert",id:R,className:this._classNames.errorMessage},s))},t.prototype.focus=function(e){this._dropDown.current&&(this._dropDown.current.focus(),e&&this.setState({isOpen:!0}))},t.prototype.setSelectedIndex=function(e,t){var o=this.props,n=o.options,r=o.selectedKey,i=o.selectedKeys,a=o.multiSelect,s=o.notifyOnReselect,l=o.hoisted.selectedIndices,c=void 0===l?[]:l,u=!!c&&c.indexOf(t)>-1,d=[];if(t=Math.max(0,Math.min(n.length-1,t)),void 0===r&&void 0===i){if(a||s||t!==c[0]){if(a)if(d=c?this._copyArray(c):[],u){var p=d.indexOf(t);p>-1&&d.splice(p,1)}else d.push(t);else d=[t];e.persist(),this.props.hoisted.setSelectedIndices(d),this._onChange(e,n,t,u,a)}}else this._onChange(e,n,t,u,a)},t.prototype._copyArray=function(e){for(var t=[],o=0,n=e;o<n.length;o++){var r=n[o];t.push(r)}return t},t.prototype._moveIndex=function(e,t,o,n){var r=this.props.options;if(n===o||0===r.length)return n;o>=r.length?o=0:o<0&&(o=r.length-1);for(var i=0;r[o].itemType===tf.Header||r[o].itemType===tf.Divider||r[o].disabled;){if(i>=r.length)return n;o+t<0?o=r.length:o+t>=r.length&&(o=-1),o+=t,i++}return this.setSelectedIndex(e,o),o},t.prototype._renderFocusableList=function(e){var t=e.onRenderList,o=void 0===t?this._onRenderList:t,n=e.label,r=e.ariaLabel,i=e.multiSelect;return f.createElement("div",{className:this._classNames.dropdownItemsWrapper,onKeyDown:this._onZoneKeyDown,onKeyUp:this._onZoneKeyUp,ref:this._host,tabIndex:0},f.createElement(bs,{ref:this._focusZone,direction:$i.vertical,id:this._listId,className:this._classNames.dropdownItems,role:"listbox","aria-label":r,"aria-labelledby":n&&!r?this._labelId:void 0,"aria-multiselectable":i},o(e,this._onRenderList)))},t.prototype._renderSeparator=function(e){var t=e.index,o=e.key;return t>0?f.createElement("div",{role:"separator",key:o,className:this._classNames.dropdownDivider}):null},t.prototype._renderHeader=function(e){var t=this.props.onRenderOption,o=void 0===t?this._onRenderOption:t,n=e.key,r=e.id;return f.createElement("div",{id:r,key:n,className:this._classNames.dropdownItemHeader},o(e,this._onRenderOption))},t.prototype._onItemMouseEnter=function(e,t){this._shouldIgnoreMouseEvent()||t.currentTarget.focus()},t.prototype._onItemMouseMove=function(e,t){var o=t.currentTarget;this._gotMouseMove=!0,this._isScrollIdle&&document.activeElement!==o&&o.focus()},t.prototype._shouldIgnoreMouseEvent=function(){return!this._isScrollIdle||!this._gotMouseMove},t.prototype._isAltOrMeta=function(e){return e.which===Gn.alt||"Meta"===e.key},t.prototype._shouldHandleKeyUp=function(e){var t=this._lastKeyDownWasAltOrMeta&&this._isAltOrMeta(e);return this._lastKeyDownWasAltOrMeta=!1,!!t&&!(Zs()||Js())},t.prototype._shouldOpenOnFocus=function(){var e=this.state.hasFocus,t=this.props.openOnKeyboardFocus;return!this._isFocusedByClick&&!0===t&&!e},t.defaultProps={options:[]},t}(f.Component),TC={root:"ms-Dropdown-container",label:"ms-Dropdown-label",dropdown:"ms-Dropdown",title:"ms-Dropdown-title",caretDownWrapper:"ms-Dropdown-caretDownWrapper",caretDown:"ms-Dropdown-caretDown",callout:"ms-Dropdown-callout",panel:"ms-Dropdown-panel",dropdownItems:"ms-Dropdown-items",dropdownItem:"ms-Dropdown-item",dropdownDivider:"ms-Dropdown-divider",dropdownOptionText:"ms-Dropdown-optionText",dropdownItemHeader:"ms-Dropdown-header",titleIsPlaceHolder:"ms-Dropdown-titleIsPlaceHolder",titleHasError:"ms-Dropdown-title--hasError"},EC=((kC={})[ro+", "+io.replace("@media ","")]=d({},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),kC),PC={selectors:d((wC={},wC[ro]={backgroundColor:"Highlight",borderColor:"Highlight",color:"HighlightText"},wC),EC)},RC={selectors:(IC={},IC[ro]={borderColor:"Highlight"},IC)},MC=_o(0,co),NC=Vn(xC,(function(e){var t,o,n,r,i,a,s,l,c,u,p,h,g=e.theme,f=e.hasError,v=e.hasLabel,b=e.className,y=e.isOpen,C=e.disabled,_=e.required,S=e.isRenderingPlaceholder,x=e.panelClassName,k=e.calloutClassName,w=e.calloutRenderEdge;if(!g)throw new Error("theme is undefined or null in base Dropdown getStyles function.");var I=Qo(TC,g),D=g.palette,T=g.semanticColors,E=g.effects,P=g.fonts,R={color:T.menuItemTextHovered},M={color:T.menuItemText},N={borderColor:T.errorText},B=[I.dropdownItem,{backgroundColor:"transparent",boxSizing:"border-box",cursor:"pointer",display:"flex",alignItems:"center",padding:"0 8px",width:"100%",minHeight:36,lineHeight:20,height:0,position:"relative",border:"1px solid transparent",borderRadius:0,wordWrap:"break-word",overflowWrap:"break-word",textAlign:"left",".ms-Button-flexContainer":{width:"100%"}}],F=T.menuItemBackgroundPressed,A=function(e){var t;return void 0===e&&(e=!1),{selectors:(t={"&:hover:focus":[{color:T.menuItemTextHovered,backgroundColor:e?F:T.menuItemBackgroundHovered},PC],"&:focus":[{backgroundColor:e?F:"transparent"},PC],"&:active":[{color:T.menuItemTextHovered,backgroundColor:e?T.menuItemBackgroundHovered:T.menuBackground},PC]},t["."+wo+" &:focus:after"]={left:0,top:0,bottom:0,right:0},t[ro]={border:"none"},t)}},L=m(B,[{backgroundColor:F,color:T.menuItemTextHovered},A(!0),PC]),H=m(B,[{color:T.disabledText,cursor:"default",selectors:(t={},t[ro]={color:"GrayText",border:"none"},t)}]),O=w===Xs.bottom?E.roundedCorner2+" "+E.roundedCorner2+" 0 0":"0 0 "+E.roundedCorner2+" "+E.roundedCorner2,z=w===Xs.bottom?"0 0 "+E.roundedCorner2+" "+E.roundedCorner2:E.roundedCorner2+" "+E.roundedCorner2+" 0 0";return{root:[I.root,b],label:I.label,dropdown:[I.dropdown,on,P.medium,{color:T.menuItemText,borderColor:T.focusBorder,position:"relative",outline:0,userSelect:"none",selectors:(o={},o["&:hover ."+I.title]=[!C&&R,{borderColor:y?D.neutralSecondary:D.neutralPrimary},RC],o["&:focus ."+I.title]=[!C&&R,{selectors:(n={},n[ro]={color:"Highlight"},n)}],o["&:focus:after"]=[{pointerEvents:"none",content:"''",position:"absolute",boxSizing:"border-box",top:"0px",left:"0px",width:"100%",height:"100%",border:C?"none":"2px solid "+D.themePrimary,borderRadius:"2px",selectors:(r={},r[ro]={color:"Highlight"},r)}],o["&:active ."+I.title]=[!C&&R,{borderColor:D.themePrimary},RC],o["&:hover ."+I.caretDown]=!C&&M,o["&:focus ."+I.caretDown]=[!C&&M,{selectors:(i={},i[ro]={color:"Highlight"},i)}],o["&:active ."+I.caretDown]=!C&&M,o["&:hover ."+I.titleIsPlaceHolder]=!C&&M,o["&:focus ."+I.titleIsPlaceHolder]=!C&&M,o["&:active ."+I.titleIsPlaceHolder]=!C&&M,o["&:hover ."+I.titleHasError]=N,o["&:active ."+I.titleHasError]=N,o)},y&&"is-open",C&&"is-disabled",_&&"is-required",_&&!v&&{selectors:(a={":before":{content:"'*'",color:T.errorText,position:"absolute",top:-5,right:-10}},a[ro]={selectors:{":after":{right:-14}}},a)}],title:[I.title,on,{backgroundColor:T.inputBackground,borderWidth:1,borderStyle:"solid",borderColor:T.inputBorder,borderRadius:y?O:E.roundedCorner2,cursor:"pointer",display:"block",height:32,lineHeight:30,padding:"0 28px 0 8px",position:"relative",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},S&&[I.titleIsPlaceHolder,{color:T.inputPlaceholderText}],f&&[I.titleHasError,N],C&&{backgroundColor:T.disabledBackground,border:"none",color:T.disabledText,cursor:"default",selectors:(s={},s[ro]=d({border:"1px solid GrayText",color:"GrayText",backgroundColor:"Window"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),s)}],caretDownWrapper:[I.caretDownWrapper,{position:"absolute",top:1,right:8,height:32,lineHeight:30},!C&&{cursor:"pointer"}],caretDown:[I.caretDown,{color:D.neutralSecondary,fontSize:P.small.fontSize,pointerEvents:"none"},C&&{color:T.disabledText,selectors:(l={},l[ro]=d({color:"GrayText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),l)}],errorMessage:d(d({color:T.errorText},g.fonts.small),{paddingTop:5}),callout:[I.callout,{boxShadow:E.elevation8,borderRadius:z,selectors:(c={},c[".ms-Callout-main"]={borderRadius:z},c)},k],dropdownItemsWrapper:{selectors:{"&:focus":{outline:0}}},dropdownItems:[I.dropdownItems,{display:"block"}],dropdownItem:m(B,[A()]),dropdownItemSelected:L,dropdownItemDisabled:H,dropdownItemSelectedAndDisabled:[L,H,{backgroundColor:"transparent"}],dropdownItemHidden:m(B,[{display:"none"}]),dropdownDivider:[I.dropdownDivider,{height:1,backgroundColor:T.bodyDivider}],dropdownOptionText:[I.dropdownOptionText,{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",minWidth:0,maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",margin:"1px"}],dropdownItemHeader:[I.dropdownItemHeader,d(d({},P.medium),{fontWeight:qe.semibold,color:T.menuHeader,background:"none",backgroundColor:"transparent",border:"none",height:36,lineHeight:36,cursor:"default",padding:"0 8px",userSelect:"none",textAlign:"left",selectors:(u={},u[ro]=d({color:"GrayText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),u)})],subComponentStyles:{label:{root:{display:"inline-block"}},multiSelectItem:{root:{padding:0},label:{alignSelf:"stretch",padding:"0 8px",width:"100%"},input:{selectors:(p={},p["."+wo+" &:focus + label::before"]={outlineOffset:"0px"},p)}},panel:{root:[x],main:{selectors:(h={},h[MC]={width:272},h)},contentInner:{padding:"0 0 20px"}}}}}),void 0,{scope:"Dropdown"});NC.displayName="Dropdown",Ft([{rawString:".pickerText_cc9894a7{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid "},{theme:"neutralTertiary",defaultValue:"#a19f9d"},{rawString:";min-width:180px;padding:1px;min-height:32px}.pickerText_cc9894a7:hover{border-color:"},{theme:"themeLight",defaultValue:"#c7e0f4"},{rawString:"}.pickerInput_cc9894a7{height:34px;border:none;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;outline:0;padding:0 6px 0;margin:1px}.pickerInput_cc9894a7::-ms-clear{display:none}"}]);var BC="pickerText_cc9894a7",FC="pickerInput_cc9894a7",AC=o,LC=function(e){function t(t){var o=e.call(this,t)||this;return o.floatingPicker=f.createRef(),o.selectedItemsList=f.createRef(),o.root=f.createRef(),o.input=f.createRef(),o.onSelectionChange=function(){o.forceUpdate()},o.onInputChange=function(e,t){t||(o.setState({queryString:e}),o.floatingPicker.current&&o.floatingPicker.current.onQueryStringChanged(e))},o.onInputFocus=function(e){o.selectedItemsList.current&&o.selectedItemsList.current.unselectAll(),o.props.inputProps&&o.props.inputProps.onFocus&&o.props.inputProps.onFocus(e)},o.onInputClick=function(e){if(o.selectedItemsList.current&&o.selectedItemsList.current.unselectAll(),o.floatingPicker.current&&o.inputElement){var t=""===o.inputElement.value||o.inputElement.value!==o.floatingPicker.current.inputText;o.floatingPicker.current.showPicker(t)}},o.onBackspace=function(e){e.which===Gn.backspace&&o.selectedItemsList.current&&o.items.length&&(o.input.current&&!o.input.current.isValueSelected&&o.input.current.inputElement===e.currentTarget.ownerDocument.activeElement&&0===o.input.current.cursorLocation?(o.floatingPicker.current&&o.floatingPicker.current.hidePicker(),e.preventDefault(),o.selectedItemsList.current.removeItemAt(o.items.length-1),o._onSelectedItemsChanged()):o.selectedItemsList.current.hasSelectedItems()&&(o.floatingPicker.current&&o.floatingPicker.current.hidePicker(),e.preventDefault(),o.selectedItemsList.current.removeSelectedItems(),o._onSelectedItemsChanged()))},o.onCopy=function(e){o.selectedItemsList.current&&o.selectedItemsList.current.onCopy(e)},o.onPaste=function(e){if(o.props.onPaste){var t=e.clipboardData.getData("Text");e.preventDefault(),o.props.onPaste(t)}},o._onSuggestionSelected=function(e){var t=o.props.currentRenderedQueryString,n=o.state.queryString;if(void 0===t||t===n){var r=o.props.onItemSelected?o.props.onItemSelected(e):e;if(null===r)return;var i,a=r,s=r;s&&s.then?s.then((function(e){i=e,o._addProcessedItem(i)})):(i=a,o._addProcessedItem(i))}},o._onSelectedItemsChanged=function(){o.focus()},o._onSuggestionsShownOrHidden=function(){o.forceUpdate()},Gi(o),o.selection=new iv({onSelectionChanged:function(){return o.onSelectionChange()}}),o.state={queryString:""},o}return u(t,e),Object.defineProperty(t.prototype,"items",{get:function(){var e,t,o,n;return null!==(n=null!==(o=null!==(e=this.props.selectedItems)&&void 0!==e?e:null===(t=this.selectedItemsList.current)||void 0===t?void 0:t.items)&&void 0!==o?o:this.props.defaultSelectedItems)&&void 0!==n?n:null},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){this.forceUpdate()},t.prototype.focus=function(){this.input.current&&this.input.current.focus()},t.prototype.clearInput=function(){this.input.current&&this.input.current.clear()},Object.defineProperty(t.prototype,"inputElement",{get:function(){return this.input.current&&this.input.current.inputElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightedItems",{get:function(){return this.selectedItemsList.current?this.selectedItemsList.current.highlightedItems():[]},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.props,t=e.className,o=e.inputProps,n=e.disabled,r=e.focusZoneProps,i=this.floatingPicker.current&&-1!==this.floatingPicker.current.currentSelectedSuggestionIndex?"sug-"+this.floatingPicker.current.currentSelectedSuggestionIndex:void 0,a=!!this.floatingPicker.current&&this.floatingPicker.current.isSuggestionsShown;return f.createElement("div",{ref:this.root,className:qr("ms-BasePicker ms-BaseExtendedPicker",t||""),onKeyDown:this.onBackspace,onCopy:this.onCopy},f.createElement(bs,d({direction:$i.bidirectional},r),f.createElement(vv,{selection:this.selection,selectionMode:ev.multiple},f.createElement("div",{className:qr("ms-BasePicker-text",AC.pickerText),role:"list"},this.props.headerComponent,this.renderSelectedItemsList(),this.canAddItems()&&f.createElement(Qi,d({},o,{className:qr("ms-BasePicker-input",AC.pickerInput),ref:this.input,onFocus:this.onInputFocus,onClick:this.onInputClick,onInputValueChange:this.onInputChange,"aria-activedescendant":i,"aria-owns":a?"suggestion-list":void 0,"aria-expanded":a,"aria-haspopup":"true",role:"combobox",disabled:n,onPaste:this.onPaste}))))),this.renderFloatingPicker())},Object.defineProperty(t.prototype,"floatingPickerProps",{get:function(){return this.props.floatingPickerProps},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectedItemsListProps",{get:function(){return this.props.selectedItemsListProps},enumerable:!1,configurable:!0}),t.prototype.canAddItems=function(){var e=this.props.itemLimit;return void 0===e||this.items.length<e},t.prototype.renderFloatingPicker=function(){var e=this.props.onRenderFloatingPicker;return f.createElement(e,d({componentRef:this.floatingPicker,onChange:this._onSuggestionSelected,onSuggestionsHidden:this._onSuggestionsShownOrHidden,onSuggestionsShown:this._onSuggestionsShownOrHidden,inputElement:this.input.current?this.input.current.inputElement:void 0,selectedItems:this.items,suggestionItems:this.props.suggestionItems?this.props.suggestionItems:void 0},this.floatingPickerProps))},t.prototype.renderSelectedItemsList=function(){var e=this.props.onRenderSelectedItems;return f.createElement(e,d({componentRef:this.selectedItemsList,selection:this.selection,selectedItems:this.props.selectedItems?this.props.selectedItems:void 0,onItemsDeleted:this.props.selectedItems?this.props.onItemsRemoved:void 0},this.selectedItemsListProps))},t.prototype._addProcessedItem=function(e){this.props.onItemAdded&&this.props.onItemAdded(e),this.selectedItemsList.current&&this.selectedItemsList.current.addItems([e]),this.input.current&&this.input.current.clear(),this.floatingPicker.current&&this.floatingPicker.current.hidePicker(),this.focus()},t}(f.Component);Ft([{rawString:".resultContent_ae2a2ef5{display:table-row}.resultContent_ae2a2ef5 .resultItem_ae2a2ef5{display:table-cell;vertical-align:bottom}.peoplePickerPersona_ae2a2ef5{width:180px}.peoplePickerPersona_ae2a2ef5 .ms-Persona-details{width:100%}.peoplePicker_ae2a2ef5 .ms-BasePicker-text{min-height:40px}.peoplePickerPersonaContent_ae2a2ef5{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center}"}]);var HC,OC=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t}(LC),zC=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t}(OC);!function(e){e[e.none=0]="none",e[e.descriptive=1]="descriptive",e[e.more=2]="more",e[e.downArrow=3]="downArrow"}(HC||(HC={}));var WC=jo((function(e,t,o){var n=od(e),r=kn(n,o);return d(d({},r),{root:[n.root,t,e.fonts.medium,o&&o.root]})})),VC=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.className,o=e.styles,n=p(e,["className","styles"]),r=WC(this.props.theme,t,o);return f.createElement(Qu,d({},n,{variantClassName:"ms-Button--facepile",styles:r,onRenderDescription:Ks}))},h([Ju("FacepileButton",["theme","styles"],!0)],t)}(f.Component),KC=Jn(),GC={size:Yr.size48,presence:Zr.none,imageAlt:"",showOverflowTooltip:!0},UC=f.forwardRef((function(e,t){var o=tr(GC,e);!function(e){Ri({name:"Persona",props:e,deprecations:{primaryText:"text"}})}(o);var n=Or(t,f.useRef(null)),r=function(){return o.text||o.primaryText||""},i=function(e,t,n){return f.createElement("div",{dir:"auto",className:e},t&&t(o,n))},a=function(e,t){return void 0===t&&(t=!0),e?t?function(){return f.createElement(Td,{content:e,overflowMode:md.Parent,directionalHint:Ys.topLeftEdge},e)}:function(){return f.createElement(f.Fragment,null,e)}:void 0},s=a(r(),o.showOverflowTooltip),l=a(o.secondaryText,o.showOverflowTooltip),c=a(o.tertiaryText,o.showOverflowTooltip),u=a(o.optionalText,o.showOverflowTooltip),p=o.hidePersonaDetails,h=o.onRenderOptionalText,m=void 0===h?u:h,g=o.onRenderPrimaryText,v=void 0===g?s:g,b=o.onRenderSecondaryText,y=void 0===b?l:b,C=o.onRenderTertiaryText,_=void 0===C?c:C,S=o.onRenderPersonaCoin,x=void 0===S?function(e){return f.createElement(Oi,d({},e))}:S,k=o.size,w=o.allowPhoneInitials,I=o.className,D=o.coinProps,T=o.showUnknownPersonaCoin,E=o.coinSize,P=o.styles,R=o.imageAlt,M=o.imageInitials,N=o.imageShouldFadeIn,B=o.imageShouldStartVisible,F=o.imageUrl,A=o.initialsColor,L=o.initialsTextColor,H=o.isOutOfOffice,O=o.onPhotoLoadingStateChange,z=o.onRenderCoin,W=o.onRenderInitials,V=o.presence,K=o.presenceTitle,G=o.presenceColors,U=o.showInitialsUntilImageLoads,j=o.showSecondaryText,q=o.theme,Y=d({allowPhoneInitials:w,showUnknownPersonaCoin:T,coinSize:E,imageAlt:R,imageInitials:M,imageShouldFadeIn:N,imageShouldStartVisible:B,imageUrl:F,initialsColor:A,initialsTextColor:L,onPhotoLoadingStateChange:O,onRenderCoin:z,onRenderInitials:W,presence:V,presenceTitle:K,showInitialsUntilImageLoads:U,size:k,text:r(),isOutOfOffice:H,presenceColors:G},D),Z=KC(P,{theme:q,className:I,showSecondaryText:j,presence:V,size:k}),X=Tr(o,Dr),Q=f.createElement("div",{className:Z.details},i(Z.primaryText,v,s),i(Z.secondaryText,y,l),i(Z.tertiaryText,_,c),i(Z.optionalText,m,u),o.children);return f.createElement("div",d({},X,{ref:n,className:Z.root,style:E?{height:E,minWidth:E}:void 0}),x(Y,x),(!p||k===Yr.size8||k===Yr.size10||k===Yr.tiny)&&Q)}));UC.displayName="PersonaBase";var jC={root:"ms-Persona",size8:"ms-Persona--size8",size10:"ms-Persona--size10",size16:"ms-Persona--size16",size24:"ms-Persona--size24",size28:"ms-Persona--size28",size32:"ms-Persona--size32",size40:"ms-Persona--size40",size48:"ms-Persona--size48",size56:"ms-Persona--size56",size72:"ms-Persona--size72",size100:"ms-Persona--size100",size120:"ms-Persona--size120",available:"ms-Persona--online",away:"ms-Persona--away",blocked:"ms-Persona--blocked",busy:"ms-Persona--busy",doNotDisturb:"ms-Persona--donotdisturb",offline:"ms-Persona--offline",details:"ms-Persona-details",primaryText:"ms-Persona-primaryText",secondaryText:"ms-Persona-secondaryText",tertiaryText:"ms-Persona-tertiaryText",optionalText:"ms-Persona-optionalText",textContent:"ms-Persona-textContent"},qC=Vn(UC,(function(e){var t=e.className,o=e.showSecondaryText,n=e.theme,r=n.semanticColors,i=n.fonts,a=Qo(jC,n),s=ai(e.size),l=li(e.presence),c="16px",u={color:r.bodySubtext,fontWeight:qe.regular,fontSize:i.small.fontSize};return{root:[a.root,n.fonts.medium,on,{color:r.bodyText,position:"relative",height:Jr.size48,minWidth:Jr.size48,display:"flex",alignItems:"center",selectors:{".contextualHost":{display:"none"}}},s.isSize8&&[a.size8,{height:Jr.size8,minWidth:Jr.size8}],s.isSize10&&[a.size10,{height:Jr.size10,minWidth:Jr.size10}],s.isSize16&&[a.size16,{height:Jr.size16,minWidth:Jr.size16}],s.isSize24&&[a.size24,{height:Jr.size24,minWidth:Jr.size24}],s.isSize24&&o&&{height:"36px"},s.isSize28&&[a.size28,{height:Jr.size28,minWidth:Jr.size28}],s.isSize28&&o&&{height:"32px"},s.isSize32&&[a.size32,{height:Jr.size32,minWidth:Jr.size32}],s.isSize40&&[a.size40,{height:Jr.size40,minWidth:Jr.size40}],s.isSize48&&a.size48,s.isSize56&&[a.size56,{height:Jr.size56,minWidth:Jr.size56}],s.isSize72&&[a.size72,{height:Jr.size72,minWidth:Jr.size72}],s.isSize100&&[a.size100,{height:Jr.size100,minWidth:Jr.size100}],s.isSize120&&[a.size120,{height:Jr.size120,minWidth:Jr.size120}],l.isAvailable&&a.available,l.isAway&&a.away,l.isBlocked&&a.blocked,l.isBusy&&a.busy,l.isDoNotDisturb&&a.doNotDisturb,l.isOffline&&a.offline,t],details:[a.details,{padding:"0 24px 0 16px",minWidth:0,width:"100%",textAlign:"left",display:"flex",flexDirection:"column",justifyContent:"space-around"},(s.isSize8||s.isSize10)&&{paddingLeft:17},(s.isSize24||s.isSize28||s.isSize32)&&{padding:"0 8px"},(s.isSize40||s.isSize48)&&{padding:"0 12px"}],primaryText:[a.primaryText,nn,{color:r.bodyText,fontWeight:qe.regular,fontSize:i.medium.fontSize,selectors:{":hover":{color:r.inputTextHovered}}},o&&{height:c,lineHeight:c,overflowX:"hidden"},(s.isSize8||s.isSize10)&&{fontSize:i.small.fontSize,lineHeight:Jr.size8},s.isSize16&&{lineHeight:Jr.size28},(s.isSize24||s.isSize28||s.isSize32||s.isSize40||s.isSize48)&&o&&{height:18},(s.isSize56||s.isSize72||s.isSize100||s.isSize120)&&{fontSize:i.xLarge.fontSize},(s.isSize56||s.isSize72||s.isSize100||s.isSize120)&&o&&{height:22}],secondaryText:[a.secondaryText,nn,u,(s.isSize8||s.isSize10||s.isSize16||s.isSize24||s.isSize28||s.isSize32)&&{display:"none"},o&&{display:"block",height:c,lineHeight:c,overflowX:"hidden"},s.isSize24&&o&&{height:18},(s.isSize56||s.isSize72||s.isSize100||s.isSize120)&&{fontSize:i.medium.fontSize},(s.isSize56||s.isSize72||s.isSize100||s.isSize120)&&o&&{height:18}],tertiaryText:[a.tertiaryText,nn,u,{display:"none",fontSize:i.medium.fontSize},(s.isSize72||s.isSize100||s.isSize120)&&{display:"block"}],optionalText:[a.optionalText,nn,u,{display:"none",fontSize:i.medium.fontSize},(s.isSize100||s.isSize120)&&{display:"block"}],textContent:[a.textContent,nn]}}),void 0,{scope:"Persona"}),YC=Jn(),ZC=function(e){function t(t){var o=e.call(this,t)||this;return o._classNames=YC(o.props.styles,{theme:o.props.theme,className:o.props.className}),o._getPersonaControl=function(e){var t=o.props,n=t.getPersonaProps,r=t.personaSize;return f.createElement(qC,d({imageInitials:e.imageInitials,imageUrl:e.imageUrl,initialsColor:e.initialsColor,allowPhoneInitials:e.allowPhoneInitials,text:e.personaName,size:r},n?n(e):null,{styles:{details:{flex:"1 0 auto"}}}))},o._getPersonaCoinControl=function(e){var t=o.props,n=t.getPersonaProps,r=t.personaSize;return f.createElement(Oi,d({imageInitials:e.imageInitials,imageUrl:e.imageUrl,initialsColor:e.initialsColor,allowPhoneInitials:e.allowPhoneInitials,text:e.personaName,size:r},n?n(e):null))},Gi(o),o._ariaDescriptionId=Ka(),o}return u(t,e),t.prototype.render=function(){var e=this.props.overflowButtonProps,t=this.props,o=t.chevronButtonProps,n=t.maxDisplayablePersonas,r=t.personas,i=t.overflowPersonas,a=t.showAddButton,s=t.ariaLabel,l=t.showTooltip,c=void 0===l||l,u=this._classNames,d="number"==typeof n?Math.min(r.length,n):r.length;o&&!e&&(e=o);var p=i&&i.length>0,h=p?r:r.slice(0,d),m=(p?i:r.slice(d))||[];return f.createElement("div",{className:u.root},this.onRenderAriaDescription(),f.createElement("div",{className:u.itemContainer},a?this._getAddNewElement():null,f.createElement("ul",{className:u.members,"aria-label":s},this._onRenderVisiblePersonas(h,0===m.length&&1===r.length,c)),e?this._getOverflowElement(m):null))},t.prototype.onRenderAriaDescription=function(){var e=this.props.ariaDescription,t=this._classNames;return e&&f.createElement("span",{className:t.screenReaderOnly,id:this._ariaDescriptionId},e)},t.prototype._onRenderVisiblePersonas=function(e,t,o){var n=this,r=this.props,i=r.onRenderPersona,a=void 0===i?this._getPersonaControl:i,s=r.onRenderPersonaCoin,l=void 0===s?this._getPersonaCoinControl:s;return e.map((function(e,r){var i=t?a(e,n._getPersonaControl):l(e,n._getPersonaCoinControl);return f.createElement("li",{key:(t?"persona":"personaCoin")+"-"+r,className:n._classNames.member},e.onClick?n._getElementWithOnClickEvent(i,e,o,r):n._getElementWithoutOnClickEvent(i,e,o,r))}))},t.prototype._getElementWithOnClickEvent=function(e,t,o,n){var r=t.keytipProps;return f.createElement(VC,d({},Tr(t,pr),this._getElementProps(t,o,n),{keytipProps:r,onClick:this._onPersonaClick.bind(this,t)}),e)},t.prototype._getElementWithoutOnClickEvent=function(e,t,o,n){return f.createElement("div",d({},Tr(t,pr),this._getElementProps(t,o,n)),e)},t.prototype._getElementProps=function(e,t,o){var n=this._classNames;return{key:(e.imageUrl?"i":"")+o,"data-is-focusable":!0,className:n.itemButton,title:t?e.personaName:void 0,onMouseMove:this._onPersonaMouseMove.bind(this,e),onMouseOut:this._onPersonaMouseOut.bind(this,e)}},t.prototype._getOverflowElement=function(e){switch(this.props.overflowButtonType){case HC.descriptive:return this._getDescriptiveOverflowElement(e);case HC.downArrow:return this._getIconElement("ChevronDown");case HC.more:return this._getIconElement("More");default:return null}},t.prototype._getDescriptiveOverflowElement=function(e){var t=this.props.personaSize;if(!e||e.length<1)return null;var o=e.map((function(e){return e.personaName})).join(", "),n=d({title:o},this.props.overflowButtonProps),r=Math.max(e.length,0),i=this._classNames;return f.createElement(VC,d({},n,{ariaDescription:n.title,className:i.descriptiveOverflowButton}),f.createElement(Oi,{size:t,onRenderInitials:this._renderInitialsNotPictured(r),initialsColor:Xr.transparent}))},t.prototype._getIconElement=function(e){var t=this.props,o=t.overflowButtonProps,n=t.personaSize,r=this._classNames;return f.createElement(VC,d({},o,{className:r.overflowButton}),f.createElement(Oi,{size:n,onRenderInitials:this._renderInitials(e,!0),initialsColor:Xr.transparent}))},t.prototype._getAddNewElement=function(){var e=this.props,t=e.addButtonProps,o=e.personaSize,n=this._classNames;return f.createElement(VC,d({},t,{className:n.addButton}),f.createElement(Oi,{size:o,onRenderInitials:this._renderInitials("AddFriend")}))},t.prototype._onPersonaClick=function(e,t){e.onClick(t,e),t.preventDefault(),t.stopPropagation()},t.prototype._onPersonaMouseMove=function(e,t){e.onMouseMove&&e.onMouseMove(t,e)},t.prototype._onPersonaMouseOut=function(e,t){e.onMouseOut&&e.onMouseOut(t,e)},t.prototype._renderInitials=function(e,t){var o=this._classNames;return function(){return f.createElement(ii,{iconName:e,className:t?o.overflowInitialsIcon:""})}},t.prototype._renderInitialsNotPictured=function(e){var t=this._classNames;return function(){return f.createElement("span",{className:t.overflowInitialsIcon},e<100?"+"+e:"99+")}},t.defaultProps={maxDisplayablePersonas:5,personas:[],overflowPersonas:[],personaSize:Yr.size32},t}(f.Component),XC={root:"ms-Facepile",addButton:"ms-Facepile-addButton ms-Facepile-itemButton",descriptiveOverflowButton:"ms-Facepile-descriptiveOverflowButton ms-Facepile-itemButton",itemButton:"ms-Facepile-itemButton ms-Facepile-person",itemContainer:"ms-Facepile-itemContainer",members:"ms-Facepile-members",member:"ms-Facepile-member",overflowButton:"ms-Facepile-overflowButton ms-Facepile-itemButton"},QC=Vn(ZC,(function(e){var t,o=e.className,n=e.theme,r=e.spacingAroundItemButton,i=void 0===r?2:r,a=n.palette,s=n.fonts,l=Qo(XC,n),c={textAlign:"center",padding:0,borderRadius:"50%",verticalAlign:"top",display:"inline",backgroundColor:"transparent",border:"none",selectors:{"&::-moz-focus-inner":{padding:0,border:0}}};return{root:[l.root,n.fonts.medium,{width:"auto"},o],addButton:[l.addButton,To(n,{inset:-1}),c,{fontSize:s.medium.fontSize,color:a.white,backgroundColor:a.themePrimary,marginRight:2*i+"px",selectors:{"&:hover":{backgroundColor:a.themeDark},"&:focus":{backgroundColor:a.themeDark},"&:active":{backgroundColor:a.themeDarker},"&:disabled":{backgroundColor:a.neutralTertiaryAlt}}}],descriptiveOverflowButton:[l.descriptiveOverflowButton,To(n,{inset:-1}),c,{fontSize:s.small.fontSize,color:a.neutralSecondary,backgroundColor:a.neutralLighter,marginLeft:2*i+"px"}],itemButton:[l.itemButton,c],itemContainer:[l.itemContainer,{display:"flex"}],members:[l.members,{display:"flex",overflow:"hidden",listStyleType:"none",padding:0,margin:"-"+i+"px"}],member:[l.member,{display:"inline-flex",flex:"0 0 auto",margin:i+"px"}],overflowButton:[l.overflowButton,To(n,{inset:-1}),c,{fontSize:s.medium.fontSize,color:a.neutralSecondary,backgroundColor:a.neutralLighter,marginLeft:2*i+"px"}],overflowInitialsIcon:[{color:a.neutralPrimary,selectors:(t={},t[ro]={color:"WindowText"},t)}],screenReaderOnly:Mo}}),void 0,{scope:"Facepile"});Ft([{rawString:".callout_0508e60b .ms-Suggestions-itemButton{padding:0;border:none}.callout_0508e60b .ms-Suggestions{min-width:300px}"}]);var JC="callout_0508e60b";Ft([{rawString:".root_2f55324e{min-width:260px}.suggestionsItem_2f55324e{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;-webkit-box-sizing:border-box;box-sizing:border-box;width:100%;position:relative;overflow:hidden}.suggestionsItem_2f55324e:hover{background:"},{theme:"neutralLighter",defaultValue:"#f3f2f1"},{rawString:"}.suggestionsItem_2f55324e:hover .closeButton_2f55324e{display:block}.suggestionsItem_2f55324e.suggestionsItemIsSuggested_2f55324e{background:"},{theme:"neutralLight",defaultValue:"#edebe9"},{rawString:"}.suggestionsItem_2f55324e.suggestionsItemIsSuggested_2f55324e:hover{background:"},{theme:"neutralTertiaryAlt",defaultValue:"#c8c6c4"},{rawString:"}@media screen and (-ms-high-contrast:active){.suggestionsItem_2f55324e.suggestionsItemIsSuggested_2f55324e:hover{background:Highlight;color:HighlightText}}@media screen and (-ms-high-contrast:active){.suggestionsItem_2f55324e.suggestionsItemIsSuggested_2f55324e{background:Highlight;color:HighlightText;-ms-high-contrast-adjust:none}}.suggestionsItem_2f55324e.suggestionsItemIsSuggested_2f55324e .closeButton_2f55324e:hover{background:"},{theme:"neutralTertiary",defaultValue:"#a19f9d"},{rawString:";color:"},{theme:"neutralPrimary",defaultValue:"#323130"},{rawString:"}@media screen and (-ms-high-contrast:active){.suggestionsItem_2f55324e.suggestionsItemIsSuggested_2f55324e .itemButton_2f55324e{color:HighlightText}}.suggestionsItem_2f55324e .closeButton_2f55324e{display:none;color:"},{theme:"neutralSecondary",defaultValue:"#605e5c"},{rawString:"}.suggestionsItem_2f55324e .closeButton_2f55324e:hover{background:"},{theme:"neutralLight",defaultValue:"#edebe9"},{rawString:"}.actionButton_2f55324e{background-color:transparent;border:0;cursor:pointer;margin:0;position:relative;border-top:1px solid "},{theme:"neutralLight",defaultValue:"#edebe9"},{rawString:";height:40px;width:100%;font-size:12px}[dir=ltr] .actionButton_2f55324e{padding-left:8px}[dir=rtl] .actionButton_2f55324e{padding-right:8px}html[dir=ltr] .actionButton_2f55324e{text-align:left}html[dir=rtl] .actionButton_2f55324e{text-align:right}.actionButton_2f55324e:hover{background-color:"},{theme:"neutralLight",defaultValue:"#edebe9"},{rawString:";cursor:pointer}.actionButton_2f55324e:active,.actionButton_2f55324e:focus{background-color:"},{theme:"themeLight",defaultValue:"#c7e0f4"},{rawString:"}.actionButton_2f55324e .ms-Button-icon{font-size:16px;width:25px}.actionButton_2f55324e .ms-Button-label{margin:0 4px 0 9px}html[dir=rtl] .actionButton_2f55324e .ms-Button-label{margin:0 9px 0 4px}.buttonSelected_2f55324e{background-color:"},{theme:"themeLight",defaultValue:"#c7e0f4"},{rawString:"}.suggestionsTitle_2f55324e{padding:0 12px;color:"},{theme:"themePrimary",defaultValue:"#0078d4"},{rawString:";font-size:12px;line-height:40px;border-bottom:1px solid "},{theme:"neutralLight",defaultValue:"#edebe9"},{rawString:"}.suggestionsContainer_2f55324e{overflow-y:auto;overflow-x:hidden;max-height:300px;border-bottom:1px solid "},{theme:"neutralLight",defaultValue:"#edebe9"},{rawString:"}.suggestionsNone_2f55324e{text-align:center;color:#797775;font-size:12px;line-height:30px}.suggestionsSpinner_2f55324e{margin:5px 0;white-space:nowrap;line-height:20px;font-size:12px}html[dir=ltr] .suggestionsSpinner_2f55324e{padding-left:14px}html[dir=rtl] .suggestionsSpinner_2f55324e{padding-right:14px}html[dir=ltr] .suggestionsSpinner_2f55324e{text-align:left}html[dir=rtl] .suggestionsSpinner_2f55324e{text-align:right}.suggestionsSpinner_2f55324e .ms-Spinner-circle{display:inline-block;vertical-align:middle}.suggestionsSpinner_2f55324e .ms-Spinner-label{display:inline-block;margin:0 10px 0 16px;vertical-align:middle}html[dir=rtl] .suggestionsSpinner_2f55324e .ms-Spinner-label{margin:0 16px 0 10px}.itemButton_2f55324e.itemButton_2f55324e{width:100%;padding:0;min-width:0;height:100%}@media screen and (-ms-high-contrast:active){.itemButton_2f55324e.itemButton_2f55324e{color:WindowText}}.itemButton_2f55324e.itemButton_2f55324e:hover{color:"},{theme:"neutralDark",defaultValue:"#201f1e"},{rawString:"}.closeButton_2f55324e.closeButton_2f55324e{padding:0 4px;height:auto;width:32px}@media screen and (-ms-high-contrast:active){.closeButton_2f55324e.closeButton_2f55324e{color:WindowText}}.closeButton_2f55324e.closeButton_2f55324e:hover{background:"},{theme:"neutralTertiaryAlt",defaultValue:"#c8c6c4"},{rawString:";color:"},{theme:"neutralDark",defaultValue:"#201f1e"},{rawString:"}.suggestionsAvailable_2f55324e{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}"}]);var $C="root_2f55324e",e_="suggestionsItem_2f55324e",t_="closeButton_2f55324e",o_="suggestionsItemIsSuggested_2f55324e",n_="itemButton_2f55324e",r_="actionButton_2f55324e",i_="buttonSelected_2f55324e",a_="suggestionsTitle_2f55324e",s_="suggestionsContainer_2f55324e",l_="suggestionsNone_2f55324e",c_="suggestionsSpinner_2f55324e",u_="suggestionsAvailable_2f55324e",d_=r,p_=Jn(),h_=function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),o}return u(t,e),t.prototype.render=function(){var e,t=this.props,o=t.suggestionModel,n=t.RenderSuggestion,r=t.onClick,i=t.className,a=t.id,s=t.onRemoveItem,l=t.isSelectedOverride,c=t.removeButtonAriaLabel,u=t.styles,d=t.theme,p=t.removeButtonIconProps,h=u?p_(u,{theme:d,className:i,suggested:o.selected||l}):{root:qr("ms-Suggestions-item",d_.suggestionsItem,(e={},e["is-suggested "+d_.suggestionsItemIsSuggested]=o.selected||l,e),i),itemButton:qr("ms-Suggestions-itemButton",d_.itemButton),closeButton:qr("ms-Suggestions-closeButton",d_.closeButton)};return f.createElement("div",{className:h.root,role:"presentation"},f.createElement(Xd,{onClick:r,className:h.itemButton,id:a,"aria-selected":o.selected,role:"option","aria-label":o.ariaLabel},n(o.item,this.props)),this.props.showRemoveButton?f.createElement(id,{iconProps:null!=p?p:{iconName:"Cancel"},styles:{icon:{fontSize:"12px"}},title:c,ariaLabel:c,onClick:s,className:h.closeButton}):null)},t}(f.Component);Ft([{rawString:".suggestionsContainer_a151d363{overflow-y:auto;overflow-x:hidden;max-height:300px}.suggestionsContainer_a151d363 .ms-Suggestion-item:hover{background-color:"},{theme:"neutralLighter",defaultValue:"#f3f2f1"},{rawString:";cursor:pointer}.suggestionsContainer_a151d363 .is-suggested{background-color:"},{theme:"themeLighter",defaultValue:"#deecf9"},{rawString:"}.suggestionsContainer_a151d363 .is-suggested:hover{background-color:"},{theme:"themeLight",defaultValue:"#c7e0f4"},{rawString:";cursor:pointer}"}]);var m_="suggestionsContainer_a151d363",g_=i,f_=function(e){function t(t){var o=e.call(this,t)||this;return o._selectedElement=f.createRef(),o.SuggestionsItemOfProperType=h_,o._onClickTypedSuggestionsItem=function(e,t){return function(n){o.props.onSuggestionClick(n,e,t)}},o._onRemoveTypedSuggestionsItem=function(e,t){return function(n){(0,o.props.onSuggestionRemove)(n,e,t),n.stopPropagation()}},Gi(o),o.currentIndex=-1,o}return u(t,e),t.prototype.nextSuggestion=function(){var e=this.props.suggestions;if(e&&e.length>0){if(-1===this.currentIndex)return this.setSelectedSuggestion(0),!0;if(this.currentIndex<e.length-1)return this.setSelectedSuggestion(this.currentIndex+1),!0;if(this.props.shouldLoopSelection&&this.currentIndex===e.length-1)return this.setSelectedSuggestion(0),!0}return!1},t.prototype.previousSuggestion=function(){var e=this.props.suggestions;if(e&&e.length>0){if(-1===this.currentIndex)return this.setSelectedSuggestion(e.length-1),!0;if(this.currentIndex>0)return this.setSelectedSuggestion(this.currentIndex-1),!0;if(this.props.shouldLoopSelection&&0===this.currentIndex)return this.setSelectedSuggestion(e.length-1),!0}return!1},Object.defineProperty(t.prototype,"selectedElement",{get:function(){return this._selectedElement.current||void 0},enumerable:!1,configurable:!0}),t.prototype.getCurrentItem=function(){return this.props.suggestions[this.currentIndex]},t.prototype.getSuggestionAtIndex=function(e){return this.props.suggestions[e]},t.prototype.hasSuggestionSelected=function(){return-1!==this.currentIndex&&this.currentIndex<this.props.suggestions.length},t.prototype.removeSuggestion=function(e){this.props.suggestions.splice(e,1)},t.prototype.deselectAllSuggestions=function(){this.currentIndex>-1&&this.props.suggestions[this.currentIndex]&&(this.props.suggestions[this.currentIndex].selected=!1,this.currentIndex=-1,this.forceUpdate())},t.prototype.setSelectedSuggestion=function(e){var t=this.props.suggestions;e>t.length-1||e<0?(this.currentIndex=0,this.currentSuggestion.selected=!1,this.currentSuggestion=t[0],this.currentSuggestion.selected=!0):(this.currentIndex>-1&&t[this.currentIndex]&&(t[this.currentIndex].selected=!1),t[e].selected=!0,this.currentIndex=e,this.currentSuggestion=t[e]),this.forceUpdate()},t.prototype.componentDidUpdate=function(){this.scrollSelected()},t.prototype.render=function(){var e=this,t=this.props,o=t.onRenderSuggestion,n=t.suggestionsItemClassName,r=t.resultsMaximumNumber,i=t.showRemoveButtons,a=t.suggestionsContainerAriaLabel,s=this.SuggestionsItemOfProperType,l=this.props.suggestions;return r&&(l=l.slice(0,r)),f.createElement("div",{className:qr("ms-Suggestions-container",g_.suggestionsContainer),id:"suggestion-list",role:"list","aria-label":a},l.map((function(t,r){return f.createElement("div",{ref:t.selected||r===e.currentIndex?e._selectedElement:void 0,key:t.item.key?t.item.key:r,id:"sug-"+r,role:"listitem","aria-label":t.ariaLabel},f.createElement(s,{id:"sug-item"+r,suggestionModel:t,RenderSuggestion:o,onClick:e._onClickTypedSuggestionsItem(t.item,r),className:n,showRemoveButton:i,onRemoveItem:e._onRemoveTypedSuggestionsItem(t.item,r),isSelectedOverride:r===e.currentIndex}))})))},t.prototype.scrollSelected=function(){var e;void 0!==(null===(e=this._selectedElement.current)||void 0===e?void 0:e.scrollIntoView)&&this._selectedElement.current.scrollIntoView(!1)},t}(f.Component);Ft([{rawString:".root_e4eecb3d{min-width:260px}.actionButton_e4eecb3d{background:0 0;background-color:transparent;border:0;cursor:pointer;margin:0;padding:0;position:relative;width:100%;font-size:12px}html[dir=ltr] .actionButton_e4eecb3d{text-align:left}html[dir=rtl] .actionButton_e4eecb3d{text-align:right}.actionButton_e4eecb3d:hover{background-color:"},{theme:"neutralLighter",defaultValue:"#f3f2f1"},{rawString:";cursor:pointer}.actionButton_e4eecb3d:active,.actionButton_e4eecb3d:focus{background-color:"},{theme:"themeLight",defaultValue:"#c7e0f4"},{rawString:"}.actionButton_e4eecb3d .ms-Button-icon{font-size:16px;width:25px}.actionButton_e4eecb3d .ms-Button-label{margin:0 4px 0 9px}html[dir=rtl] .actionButton_e4eecb3d .ms-Button-label{margin:0 9px 0 4px}.buttonSelected_e4eecb3d{background-color:"},{theme:"themeLighter",defaultValue:"#deecf9"},{rawString:"}.buttonSelected_e4eecb3d:hover{background-color:"},{theme:"themeLight",defaultValue:"#c7e0f4"},{rawString:";cursor:pointer}@media screen and (-ms-high-contrast:active){.buttonSelected_e4eecb3d:hover{background-color:Highlight;color:HighlightText}}@media screen and (-ms-high-contrast:active){.buttonSelected_e4eecb3d{background-color:Highlight;color:HighlightText;-ms-high-contrast-adjust:none}}.suggestionsTitle_e4eecb3d{font-size:12px}.suggestionsSpinner_e4eecb3d{margin:5px 0;white-space:nowrap;line-height:20px;font-size:12px}html[dir=ltr] .suggestionsSpinner_e4eecb3d{padding-left:14px}html[dir=rtl] .suggestionsSpinner_e4eecb3d{padding-right:14px}html[dir=ltr] .suggestionsSpinner_e4eecb3d{text-align:left}html[dir=rtl] .suggestionsSpinner_e4eecb3d{text-align:right}.suggestionsSpinner_e4eecb3d .ms-Spinner-circle{display:inline-block;vertical-align:middle}.suggestionsSpinner_e4eecb3d .ms-Spinner-label{display:inline-block;margin:0 10px 0 16px;vertical-align:middle}html[dir=rtl] .suggestionsSpinner_e4eecb3d .ms-Spinner-label{margin:0 16px 0 10px}.itemButton_e4eecb3d{height:100%;width:100%;padding:7px 12px}@media screen and (-ms-high-contrast:active){.itemButton_e4eecb3d{color:WindowText}}.screenReaderOnly_e4eecb3d{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}"}]);var v_,b_="root_e4eecb3d",y_="actionButton_e4eecb3d",C_="buttonSelected_e4eecb3d",__="suggestionsTitle_e4eecb3d",S_="suggestionsSpinner_e4eecb3d",x_="itemButton_e4eecb3d",k_="screenReaderOnly_e4eecb3d",w_=a;!function(e){e[e.header=0]="header",e[e.suggestion=1]="suggestion",e[e.footer=2]="footer"}(v_||(v_={}));var I_=function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),o}return u(t,e),t.prototype.render=function(){var e,t=this.props,o=t.renderItem,n=t.onExecute,r=t.isSelected,i=t.id,a=t.className;return n?f.createElement("div",{id:i,onClick:n,className:qr("ms-Suggestions-sectionButton",a,w_.actionButton,(e={},e["is-selected "+w_.buttonSelected]=r,e))},o()):f.createElement("div",{id:i,className:qr("ms-Suggestions-section",a,w_.suggestionsTitle)},o())},t}(f.Component),D_=function(e){function t(t){var o=e.call(this,t)||this;return o._selectedElement=f.createRef(),o._suggestions=f.createRef(),o.SuggestionsOfProperType=f_,Gi(o),o.state={selectedHeaderIndex:-1,selectedFooterIndex:-1,suggestions:t.suggestions},o}return u(t,e),t.prototype.componentDidMount=function(){this.resetSelectedItem()},t.prototype.componentDidUpdate=function(e){var t=this;this.scrollSelected(),e.suggestions&&e.suggestions!==this.props.suggestions&&this.setState({suggestions:this.props.suggestions},(function(){t.resetSelectedItem()}))},t.prototype.componentWillUnmount=function(){var e;null===(e=this._suggestions.current)||void 0===e||e.deselectAllSuggestions()},t.prototype.render=function(){var e=this.props,t=e.className,o=e.headerItemsProps,n=e.footerItemsProps,r=e.suggestionsAvailableAlertText,i=Z(Mo),a=this.state.suggestions&&this.state.suggestions.length>0&&r;return f.createElement("div",{className:qr("ms-Suggestions",t||"",w_.root)},o&&this.renderHeaderItems(),this._renderSuggestions(),n&&this.renderFooterItems(),a?f.createElement("span",{role:"alert","aria-live":"polite",className:i},r):null)},Object.defineProperty(t.prototype,"currentSuggestion",{get:function(){var e;return(null===(e=this._suggestions.current)||void 0===e?void 0:e.getCurrentItem())||void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentSuggestionIndex",{get:function(){return this._suggestions.current?this._suggestions.current.currentIndex:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectedElement",{get:function(){var e;return this._selectedElement.current?this._selectedElement.current:null===(e=this._suggestions.current)||void 0===e?void 0:e.selectedElement},enumerable:!1,configurable:!0}),t.prototype.hasSuggestionSelected=function(){var e;return(null===(e=this._suggestions.current)||void 0===e?void 0:e.hasSuggestionSelected())||!1},t.prototype.hasSelection=function(){var e=this.state,t=e.selectedHeaderIndex,o=e.selectedFooterIndex;return-1!==t||this.hasSuggestionSelected()||-1!==o},t.prototype.executeSelectedAction=function(){var e,t=this.props,o=t.headerItemsProps,n=t.footerItemsProps,r=this.state,i=r.selectedHeaderIndex,a=r.selectedFooterIndex;if(o&&-1!==i&&i<o.length){var s=o[i];s.onExecute&&s.onExecute()}else if(null===(e=this._suggestions.current)||void 0===e?void 0:e.hasSuggestionSelected())this.props.completeSuggestion();else if(n&&-1!==a&&a<n.length){var l=n[a];l.onExecute&&l.onExecute()}},t.prototype.removeSuggestion=function(e){var t,o;null===(t=this._suggestions.current)||void 0===t||t.removeSuggestion(e||(null===(o=this._suggestions.current)||void 0===o?void 0:o.currentIndex))},t.prototype.handleKeyDown=function(e){var t,o,n,r,i=this.state,a=i.selectedHeaderIndex,s=i.selectedFooterIndex,l=!1;return e===Gn.down?-1!==a||(null===(t=this._suggestions.current)||void 0===t?void 0:t.hasSuggestionSelected())||-1!==s?-1!==a?(this.selectNextItem(v_.header),l=!0):(null===(o=this._suggestions.current)||void 0===o?void 0:o.hasSuggestionSelected())?(this.selectNextItem(v_.suggestion),l=!0):-1!==s&&(this.selectNextItem(v_.footer),l=!0):this.selectFirstItem():e===Gn.up?-1!==a||(null===(n=this._suggestions.current)||void 0===n?void 0:n.hasSuggestionSelected())||-1!==s?-1!==a?(this.selectPreviousItem(v_.header),l=!0):(null===(r=this._suggestions.current)||void 0===r?void 0:r.hasSuggestionSelected())?(this.selectPreviousItem(v_.suggestion),l=!0):-1!==s&&(this.selectPreviousItem(v_.footer),l=!0):this.selectLastItem():e!==Gn.enter&&e!==Gn.tab||this.hasSelection()&&(this.executeSelectedAction(),l=!0),l},t.prototype.scrollSelected=function(){this._selectedElement.current&&this._selectedElement.current.scrollIntoView(!1)},t.prototype.renderHeaderItems=function(){var e=this,t=this.props,o=t.headerItemsProps,n=t.suggestionsHeaderContainerAriaLabel,r=this.state.selectedHeaderIndex;return o?f.createElement("div",{className:qr("ms-Suggestions-headerContainer",w_.suggestionsContainer),id:"suggestionHeader-list",role:"list","aria-label":n},o.map((function(t,o){var n=-1!==r&&r===o;return t.shouldShow()?f.createElement("div",{ref:n?e._selectedElement:void 0,id:"sug-header"+o,key:"sug-header"+o,role:"listitem","aria-label":t.ariaLabel},f.createElement(I_,{id:"sug-header-item"+o,isSelected:n,renderItem:t.renderItem,onExecute:t.onExecute,className:t.className})):null}))):null},t.prototype.renderFooterItems=function(){var e=this,t=this.props,o=t.footerItemsProps,n=t.suggestionsFooterContainerAriaLabel,r=this.state.selectedFooterIndex;return o?f.createElement("div",{className:qr("ms-Suggestions-footerContainer",w_.suggestionsContainer),id:"suggestionFooter-list",role:"list","aria-label":n},o.map((function(t,o){var n=-1!==r&&r===o;return t.shouldShow()?f.createElement("div",{ref:n?e._selectedElement:void 0,id:"sug-footer"+o,key:"sug-footer"+o,role:"listitem","aria-label":t.ariaLabel},f.createElement(I_,{id:"sug-footer-item"+o,isSelected:n,renderItem:t.renderItem,onExecute:t.onExecute,className:t.className})):null}))):null},t.prototype._renderSuggestions=function(){var e=this.SuggestionsOfProperType;return f.createElement(e,d({ref:this._suggestions},this.props,{suggestions:this.state.suggestions}))},t.prototype.selectNextItem=function(e,t){if(e!==t){var o=void 0!==t?t:e;this._selectNextItemOfItemType(e,o===e?this._getCurrentIndexForType(e):void 0)||this.selectNextItem(this._getNextItemSectionType(e),o)}else this._selectNextItemOfItemType(e)},t.prototype.selectPreviousItem=function(e,t){if(e!==t){var o=void 0!==t?t:e;this._selectPreviousItemOfItemType(e,o===e?this._getCurrentIndexForType(e):void 0)||this.selectPreviousItem(this._getPreviousItemSectionType(e),o)}else this._selectPreviousItemOfItemType(e)},t.prototype.resetSelectedItem=function(){var e;this.setState({selectedHeaderIndex:-1,selectedFooterIndex:-1}),null===(e=this._suggestions.current)||void 0===e||e.deselectAllSuggestions(),(void 0===this.props.shouldSelectFirstItem||this.props.shouldSelectFirstItem())&&this.selectFirstItem()},t.prototype.selectFirstItem=function(){this._selectNextItemOfItemType(v_.header)||this._selectNextItemOfItemType(v_.suggestion)||this._selectNextItemOfItemType(v_.footer)},t.prototype.selectLastItem=function(){this._selectPreviousItemOfItemType(v_.footer)||this._selectPreviousItemOfItemType(v_.suggestion)||this._selectPreviousItemOfItemType(v_.header)},t.prototype._selectNextItemOfItemType=function(e,t){var o,n;if(void 0===t&&(t=-1),e===v_.suggestion){if(this.state.suggestions.length>t+1)return null===(o=this._suggestions.current)||void 0===o||o.setSelectedSuggestion(t+1),this.setState({selectedHeaderIndex:-1,selectedFooterIndex:-1}),!0}else{var r=e===v_.header,i=r?this.props.headerItemsProps:this.props.footerItemsProps;if(i&&i.length>t+1)for(var a=t+1;a<i.length;a++){var s=i[a];if(s.onExecute&&s.shouldShow())return this.setState({selectedHeaderIndex:r?a:-1}),this.setState({selectedFooterIndex:r?-1:a}),null===(n=this._suggestions.current)||void 0===n||n.deselectAllSuggestions(),!0}}return!1},t.prototype._selectPreviousItemOfItemType=function(e,t){var o,n;if(e===v_.suggestion){if((r=void 0!==t?t:this.state.suggestions.length)>0)return null===(o=this._suggestions.current)||void 0===o||o.setSelectedSuggestion(r-1),this.setState({selectedHeaderIndex:-1,selectedFooterIndex:-1}),!0}else{var r,i=e===v_.header,a=i?this.props.headerItemsProps:this.props.footerItemsProps;if(a&&(r=void 0!==t?t:a.length)>0)for(var s=r-1;s>=0;s--){var l=a[s];if(l.onExecute&&l.shouldShow())return this.setState({selectedHeaderIndex:i?s:-1}),this.setState({selectedFooterIndex:i?-1:s}),null===(n=this._suggestions.current)||void 0===n||n.deselectAllSuggestions(),!0}}return!1},t.prototype._getCurrentIndexForType=function(e){switch(e){case v_.header:return this.state.selectedHeaderIndex;case v_.suggestion:return this._suggestions.current.currentIndex;case v_.footer:return this.state.selectedFooterIndex}},t.prototype._getNextItemSectionType=function(e){switch(e){case v_.header:return v_.suggestion;case v_.suggestion:return v_.footer;case v_.footer:return v_.header}},t.prototype._getPreviousItemSectionType=function(e){switch(e){case v_.header:return v_.footer;case v_.suggestion:return v_.header;case v_.footer:return v_.suggestion}},t}(f.Component),T_=n,E_=function(e){function t(t){var o=e.call(this,t)||this;return o.root=f.createRef(),o.suggestionsControl=f.createRef(),o.SuggestionsControlOfProperType=D_,o.isComponentMounted=!1,o.onQueryStringChanged=function(e){e!==o.state.queryString&&(o.setState({queryString:e}),o.props.onInputChanged&&o.props.onInputChanged(e),o.updateValue(e))},o.hidePicker=function(){var e=o.isSuggestionsShown;o.setState({suggestionsVisible:!1}),o.props.onSuggestionsHidden&&e&&o.props.onSuggestionsHidden()},o.showPicker=function(e){void 0===e&&(e=!1);var t=o.isSuggestionsShown;o.setState({suggestionsVisible:!0});var n=o.props.inputElement?o.props.inputElement.value:"";e&&o.updateValue(n),o.props.onSuggestionsShown&&!t&&o.props.onSuggestionsShown()},o.completeSuggestion=function(){o.suggestionsControl.current&&o.suggestionsControl.current.hasSuggestionSelected()&&o.onChange(o.suggestionsControl.current.currentSuggestion.item)},o.onSuggestionClick=function(e,t,n){o.onChange(t),o._updateSuggestionsVisible(!1)},o.onSuggestionRemove=function(e,t,n){o.props.onRemoveSuggestion&&o.props.onRemoveSuggestion(t),o.suggestionsControl.current&&o.suggestionsControl.current.removeSuggestion(n)},o.onKeyDown=function(e){if(o.state.suggestionsVisible&&(!o.props.inputElement||o.props.inputElement.contains(e.target))){var t=e.which;switch(t){case Gn.escape:o.hidePicker(),e.preventDefault(),e.stopPropagation();break;case Gn.tab:case Gn.enter:!e.shiftKey&&!e.ctrlKey&&o.suggestionsControl.current&&o.suggestionsControl.current.handleKeyDown(t)?(e.preventDefault(),e.stopPropagation()):o._onValidateInput();break;case Gn.del:o.props.onRemoveSuggestion&&o.suggestionsControl.current&&o.suggestionsControl.current.hasSuggestionSelected&&o.suggestionsControl.current.currentSuggestion&&e.shiftKey&&(o.props.onRemoveSuggestion(o.suggestionsControl.current.currentSuggestion.item),o.suggestionsControl.current.removeSuggestion(),o.forceUpdate(),e.stopPropagation());break;case Gn.up:case Gn.down:o.suggestionsControl.current&&o.suggestionsControl.current.handleKeyDown(t)&&(e.preventDefault(),e.stopPropagation(),o._updateActiveDescendant())}}},o._onValidateInput=function(){if(o.state.queryString&&o.props.onValidateInput&&o.props.createGenericItem){var e=o.props.createGenericItem(o.state.queryString,o.props.onValidateInput(o.state.queryString)),t=o.suggestionStore.convertSuggestionsToSuggestionItems([e]);o.onChange(t[0].item)}},o._async=new Zi(o),Gi(o),o.suggestionStore=t.suggestionsStore,o.state={queryString:"",didBind:!1},o}return u(t,e),Object.defineProperty(t.prototype,"inputText",{get:function(){return this.state.queryString},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"suggestions",{get:function(){return this.suggestionStore.suggestions},enumerable:!1,configurable:!0}),t.prototype.forceResolveSuggestion=function(){this.suggestionsControl.current&&this.suggestionsControl.current.hasSuggestionSelected()?this.completeSuggestion():this._onValidateInput()},Object.defineProperty(t.prototype,"currentSelectedSuggestionIndex",{get:function(){return this.suggestionsControl.current?this.suggestionsControl.current.currentSuggestionIndex:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSuggestionsShown",{get:function(){return void 0!==this.state.suggestionsVisible&&this.state.suggestionsVisible},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){this._bindToInputElement(),this.isComponentMounted=!0,this._onResolveSuggestions=this._async.debounce(this._onResolveSuggestions,this.props.resolveDelay)},t.prototype.componentDidUpdate=function(){this._bindToInputElement()},t.prototype.componentWillUnmount=function(){this._unbindFromInputElement(),this.isComponentMounted=!1},t.prototype.updateSuggestions=function(e,t){void 0===t&&(t=!1),this.suggestionStore.updateSuggestions(e),t&&this.forceUpdate()},t.prototype.render=function(){var e=this.props.className;return f.createElement("div",{ref:this.root,className:qr("ms-BasePicker ms-BaseFloatingPicker",e||"")},this.renderSuggestions())},t.prototype.renderSuggestions=function(){var e=this.SuggestionsControlOfProperType;return this.props.suggestionItems&&this.suggestionStore.updateSuggestions(this.props.suggestionItems),this.state.suggestionsVisible?f.createElement(kc,d({className:T_.callout,isBeakVisible:!1,gapSpace:5,target:this.props.inputElement,onDismiss:this.hidePicker,directionalHint:Ys.bottomLeftEdge,directionalHintForRTL:Ys.bottomRightEdge,calloutWidth:this.props.calloutWidth?this.props.calloutWidth:0},this.props.pickerCalloutProps),f.createElement(e,d({onRenderSuggestion:this.props.onRenderSuggestionsItem,onSuggestionClick:this.onSuggestionClick,onSuggestionRemove:this.onSuggestionRemove,suggestions:this.suggestionStore.getSuggestions(),componentRef:this.suggestionsControl,completeSuggestion:this.completeSuggestion,shouldLoopSelection:!1},this.props.pickerSuggestionsProps))):null},t.prototype.onSelectionChange=function(){this.forceUpdate()},t.prototype.updateValue=function(e){""===e?this.updateSuggestionWithZeroState():this._onResolveSuggestions(e)},t.prototype.updateSuggestionWithZeroState=function(){if(this.props.onZeroQuerySuggestion){var e=(0,this.props.onZeroQuerySuggestion)(this.props.selectedItems);this.updateSuggestionsList(e)}else this.hidePicker()},t.prototype.updateSuggestionsList=function(e){var t=this,o=e,n=e;if(Array.isArray(o))this.updateSuggestions(o,!0);else if(n&&n.then){var r=this.currentPromise=n;r.then((function(e){r===t.currentPromise&&t.isComponentMounted&&t.updateSuggestions(e,!0)}))}},t.prototype.onChange=function(e){this.props.onChange&&this.props.onChange(e)},t.prototype._updateActiveDescendant=function(){if(this.props.inputElement&&this.suggestionsControl.current&&this.suggestionsControl.current.selectedElement){var e=this.suggestionsControl.current.selectedElement.getAttribute("id");e&&this.props.inputElement.setAttribute("aria-activedescendant",e)}},t.prototype._onResolveSuggestions=function(e){var t=this.props.onResolveSuggestions(e,this.props.selectedItems);this._updateSuggestionsVisible(!0),null!==t&&this.updateSuggestionsList(t)},t.prototype._updateSuggestionsVisible=function(e){e?this.showPicker():this.hidePicker()},t.prototype._bindToInputElement=function(){this.props.inputElement&&!this.state.didBind&&(this.props.inputElement.addEventListener("keydown",this.onKeyDown),this.setState({didBind:!0}))},t.prototype._unbindFromInputElement=function(){this.props.inputElement&&this.state.didBind&&(this.props.inputElement.removeEventListener("keydown",this.onKeyDown),this.setState({didBind:!1}))},t}(f.Component);Ft([{rawString:".resultContent_a17eb2a2{display:table-row}.resultContent_a17eb2a2 .resultItem_a17eb2a2{display:table-cell;vertical-align:bottom}.peoplePickerPersona_a17eb2a2{width:180px}.peoplePickerPersona_a17eb2a2 .ms-Persona-details{width:100%}.peoplePicker_a17eb2a2 .ms-BasePicker-text{min-height:40px}.peoplePickerPersonaContent_a17eb2a2{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:7px 12px}"}]);var P_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t}(E_),R_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.defaultProps={onRenderSuggestionsItem:function(e,t){return o=d({},e),d({},t),f.createElement("div",{className:qr("ms-PeoplePicker-personaContent","peoplePickerPersonaContent_a17eb2a2")},f.createElement(qC,d({presence:void 0!==o.presence?o.presence:Zr.none,size:Yr.size40,className:qr("ms-PeoplePicker-Persona","peoplePickerPersona_a17eb2a2"),showSecondaryText:!0},o)));var o},createGenericItem:M_},t}(P_);function M_(e,t){var o={key:e,primaryText:e,imageInitials:"!",isValid:t};return t||(o.imageInitials=Hr(e,jn())),o}var N_=function(){function e(e){var t=this;this._isSuggestionModel=function(e){return void 0!==e.item},this._ensureSuggestionModel=function(e){return t._isSuggestionModel(e)?e:{item:e,selected:!1,ariaLabel:void 0!==t.getAriaLabel?t.getAriaLabel(e):e.name||e.text||e.primaryText}},this.suggestions=[],this.getAriaLabel=e&&e.getAriaLabel}return e.prototype.updateSuggestions=function(e){e&&e.length>0?this.suggestions=this.convertSuggestionsToSuggestionItems(e):this.suggestions=[]},e.prototype.getSuggestions=function(){return this.suggestions},e.prototype.getSuggestionAtIndex=function(e){return this.suggestions[e]},e.prototype.removeSuggestion=function(e){this.suggestions.splice(e,1)},e.prototype.convertSuggestionsToSuggestionItems=function(e){return Array.isArray(e)?e.map(this._ensureSuggestionModel):[]},e}();Pn("@fluentui/react-focus","8.3.8");var B_,F_,A_={host:"ms-HoverCard-host"};!function(e){e[e.hover=0]="hover",e[e.hotKey=1]="hotKey"}(B_||(B_={})),function(e){e.plain="PlainCard",e.expanding="ExpandingCard"}(F_||(F_={}));var L_,H_={root:"ms-ExpandingCard-root",compactCard:"ms-ExpandingCard-compactCard",expandedCard:"ms-ExpandingCard-expandedCard",expandedCardScroll:"ms-ExpandingCard-expandedCardScrollRegion"};!function(e){e[e.compact=0]="compact",e[e.expanded=1]="expanded"}(L_||(L_={}));var O_=function(e){var t=e.gapSpace,o=void 0===t?0:t,n=e.directionalHint,r=void 0===n?Ys.bottomLeftEdge:n,i=e.directionalHintFixed,a=e.targetElement,s=e.firstFocus,l=e.trapFocus,c=e.onLeave,u=e.className,p=e.finalHeight,h=e.content,m=e.calloutProps,g=d(d(d({},Tr(e,Dr)),{className:u,target:a,isBeakVisible:!1,directionalHint:r,directionalHintFixed:i,finalHeight:p,minPagePadding:24,onDismiss:c,gapSpace:o}),m);return f.createElement(f.Fragment,null,l?f.createElement(Bh,d({},g,{focusTrapProps:{forceFocusInsideTrap:!1,isClickableOutsideFocusTrap:!0,disableFirstFocus:!s}}),h):f.createElement(kc,d({},g),h))},z_=Jn(),W_=function(e){function t(t){var o=e.call(this,t)||this;return o._expandedElem=f.createRef(),o._onKeyDown=function(e){e.which===Gn.escape&&o.props.onLeave&&o.props.onLeave(e)},o._onRenderCompactCard=function(){return f.createElement("div",{className:o._classNames.compactCard},o.props.onRenderCompactCard(o.props.renderData))},o._onRenderExpandedCard=function(){return!o.state.firstFrameRendered&&o._async.requestAnimationFrame((function(){o.setState({firstFrameRendered:!0})})),f.createElement("div",{className:o._classNames.expandedCard,ref:o._expandedElem},f.createElement("div",{className:o._classNames.expandedCardScroll},o.props.onRenderExpandedCard&&o.props.onRenderExpandedCard(o.props.renderData)))},o._checkNeedsScroll=function(){var e=o.props.expandedCardHeight;o._async.requestAnimationFrame((function(){o._expandedElem.current&&o._expandedElem.current.scrollHeight>=e&&o.setState({needsScroll:!0})}))},o._async=new Zi(o),Gi(o),o.state={firstFrameRendered:!1,needsScroll:!1},o}return u(t,e),t.prototype.componentDidMount=function(){this._checkNeedsScroll()},t.prototype.componentWillUnmount=function(){this._async.dispose()},t.prototype.render=function(){var e=this.props,t=e.styles,o=e.compactCardHeight,n=e.expandedCardHeight,r=e.theme,i=e.mode,a=e.className,s=this.state,l=s.needsScroll,c=s.firstFrameRendered,u=o+n;this._classNames=z_(t,{theme:r,compactCardHeight:o,className:a,expandedCardHeight:n,needsScroll:l,expandedCardFirstFrameRendered:i===L_.expanded&&c});var p=f.createElement("div",{onMouseEnter:this.props.onEnter,onMouseLeave:this.props.onLeave,onKeyDown:this._onKeyDown},this._onRenderCompactCard(),this._onRenderExpandedCard());return f.createElement(O_,d({},this.props,{content:p,finalHeight:u,className:this._classNames.root}))},t.defaultProps={compactCardHeight:156,expandedCardHeight:384,directionalHintFixed:!0},t}(f.Component),V_=Vn(W_,(function(e){var t,o=e.theme,n=e.needsScroll,r=e.expandedCardFirstFrameRendered,i=e.compactCardHeight,a=e.expandedCardHeight,s=e.className,l=o.palette,c=Qo(H_,o);return{root:[c.root,{width:320,pointerEvents:"none",selectors:(t={},t[ro]={border:"1px solid WindowText"},t)},s],compactCard:[c.compactCard,{pointerEvents:"auto",position:"relative",height:i}],expandedCard:[c.expandedCard,{height:1,overflowY:"hidden",pointerEvents:"auto",transition:"height 0.467s cubic-bezier(0.5, 0, 0, 1)",selectors:{":before":{content:'""',position:"relative",display:"block",top:0,left:24,width:272,height:1,backgroundColor:l.neutralLighter}}},r&&{height:a}],expandedCardScroll:[c.expandedCardScroll,n&&{height:"100%",boxSizing:"border-box",overflowY:"auto"}]}}),void 0,{scope:"ExpandingCard"}),K_={root:"ms-PlainCard-root"},G_=Jn(),U_=function(e){function t(t){var o=e.call(this,t)||this;return o._onKeyDown=function(e){e.which===Gn.escape&&o.props.onLeave&&o.props.onLeave(e)},Gi(o),o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.styles,o=e.theme,n=e.className;this._classNames=G_(t,{theme:o,className:n});var r=f.createElement("div",{onMouseEnter:this.props.onEnter,onMouseLeave:this.props.onLeave,onKeyDown:this._onKeyDown},this.props.onRenderPlainCard(this.props.renderData));return f.createElement(O_,d({},this.props,{content:r,className:this._classNames.root}))},t}(f.Component),j_=Vn(U_,(function(e){var t,o=e.theme,n=e.className;return{root:[Qo(K_,o).root,{pointerEvents:"auto",selectors:(t={},t[ro]={border:"1px solid WindowText"},t)},n]}}),void 0,{scope:"PlainCard"}),q_=Jn(),Y_=function(e){function t(t){var o=e.call(this,t)||this;return o._hoverCard=f.createRef(),o.dismiss=function(e){o._async.clearTimeout(o._openTimerId),o._async.clearTimeout(o._dismissTimerId),e?o._dismissTimerId=o._async.setTimeout((function(){o._setDismissedState()}),o.props.cardDismissDelay):o._setDismissedState()},o._cardOpen=function(e){o._shouldBlockHoverCard()||"keydown"===e.type&&e.which!==o.props.openHotKey||(o._async.clearTimeout(o._dismissTimerId),"mouseenter"===e.type&&(o._currentMouseTarget=e.currentTarget),o._executeCardOpen(e))},o._executeCardOpen=function(e){o._async.clearTimeout(o._openTimerId),o._openTimerId=o._async.setTimeout((function(){o.setState((function(t){return t.isHoverCardVisible?t:{isHoverCardVisible:!0,mode:L_.compact,openMode:"keydown"===e.type?B_.hotKey:B_.hover}}))}),o.props.cardOpenDelay)},o._cardDismiss=function(e,t){if(e){if(!(t instanceof MouseEvent))return;if("keydown"===t.type&&t.which!==Gn.escape)return;o.props.sticky||o._currentMouseTarget!==t.currentTarget&&t.which!==Gn.escape||o.dismiss(!0)}else{if(o.props.sticky&&!(t instanceof MouseEvent)&&t.nativeEvent instanceof MouseEvent&&"mouseleave"===t.type)return;o.dismiss(!0)}},o._setDismissedState=function(){o.setState({isHoverCardVisible:!1,mode:L_.compact,openMode:B_.hover})},o._instantOpenAsExpanded=function(e){o._async.clearTimeout(o._dismissTimerId),o.setState((function(e){return e.isHoverCardVisible?e:{isHoverCardVisible:!0,mode:L_.expanded}}))},o._setEventListeners=function(){var e=o.props,t=e.trapFocus,n=e.instantOpenOnClick,r=e.eventListenerTarget,i=r?o._getTargetElement(r):o._getTargetElement(o.props.target),a=o._nativeDismissEvent;i&&(o._events.on(i,"mouseenter",o._cardOpen),o._events.on(i,"mouseleave",a),t?o._events.on(i,"keydown",o._cardOpen):(o._events.on(i,"focus",o._cardOpen),o._events.on(i,"blur",a)),n?o._events.on(i,"click",o._instantOpenAsExpanded):(o._events.on(i,"mousedown",a),o._events.on(i,"keydown",a)))},Gi(o),o._async=new Zi(o),o._events=new zs(o),o._nativeDismissEvent=o._cardDismiss.bind(o,!0),o._childDismissEvent=o._cardDismiss.bind(o,!1),o.state={isHoverCardVisible:!1,mode:L_.compact,openMode:B_.hover},o}return u(t,e),t.prototype.componentDidMount=function(){this._setEventListeners()},t.prototype.componentWillUnmount=function(){this._async.dispose(),this._events.dispose()},t.prototype.componentDidUpdate=function(e,t){var o=this;e.target!==this.props.target&&(this._events.off(),this._setEventListeners()),t.isHoverCardVisible!==this.state.isHoverCardVisible&&(this.state.isHoverCardVisible?(this._async.setTimeout((function(){o.setState({mode:L_.expanded},(function(){o.props.onCardExpand&&o.props.onCardExpand()}))}),this.props.expandedCardOpenDelay),this.props.onCardVisible&&this.props.onCardVisible()):(this.setState({mode:L_.compact}),this.props.onCardHide&&this.props.onCardHide()))},t.prototype.render=function(){var e=this.props,t=e.expandingCardProps,o=e.children,n=e.id,r=e.setAriaDescribedBy,i=void 0===r||r,a=e.styles,s=e.theme,l=e.className,c=e.type,u=e.plainCardProps,p=e.trapFocus,h=e.setInitialFocus,m=this.state,g=m.isHoverCardVisible,v=m.mode,b=m.openMode,y=n||Ka("hoverCard");this._classNames=q_(a,{theme:s,className:l});var C=d(d({},Tr(this.props,Dr)),{id:y,trapFocus:!!p,firstFocus:h||b===B_.hotKey,targetElement:this._getTargetElement(this.props.target),onEnter:this._cardOpen,onLeave:this._childDismissEvent}),_=d(d(d({},t),C),{mode:v}),S=d(d({},u),C);return f.createElement("div",{className:this._classNames.host,ref:this._hoverCard,"aria-describedby":i&&g?y:void 0,"data-is-focusable":!this.props.target},o,g&&(c===F_.expanding?f.createElement(V_,d({},_)):f.createElement(j_,d({},S))))},t.prototype._getTargetElement=function(e){switch(typeof e){case"string":return nt().querySelector(e);case"object":return e;default:return this._hoverCard.current||void 0}},t.prototype._shouldBlockHoverCard=function(){return!(!this.props.shouldBlockHoverCard||!this.props.shouldBlockHoverCard())},t.defaultProps={cardOpenDelay:500,cardDismissDelay:100,expandedCardOpenDelay:1500,instantOpenOnClick:!1,setInitialFocus:!1,openHotKey:Gn.c,type:F_.expanding},t}(f.Component),Z_=Vn(Y_,(function(e){var t=e.className,o=e.theme;return{host:[Qo(A_,o).host,t]}}),void 0,{scope:"HoverCard"});function X_(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons"',src:"url('"+e+"fabric-icons-a13498cf.woff') format('woff')"},icons:{GlobalNavButton:"",ChevronDown:"",ChevronUp:"",Edit:"",Add:"",Cancel:"",More:"",Settings:"",Mail:"",Filter:"",Search:"",Share:"",BlockedSite:"",FavoriteStar:"",FavoriteStarFill:"",CheckMark:"",Delete:"",ChevronLeft:"",ChevronRight:"",Calendar:"",Megaphone:"",Undo:"",Flag:"",Page:"",Pinned:"",View:"",Clear:"",Download:"",Upload:"",Folder:"",Sort:"",AlignRight:"",AlignLeft:"",Tag:"",AddFriend:"",Info:"",SortLines:"",List:"",CircleRing:"",Heart:"",HeartFill:"",Tiles:"",Embed:"",Glimmer:"",Ascending:"",Descending:"",SortUp:"",SortDown:"",SyncToPC:"",LargeGrid:"",SkypeCheck:"",SkypeClock:"",SkypeMinus:"",ClearFilter:"",Flow:"",StatusCircleCheckmark:"",MoreVertical:""}},t)}function Q_(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-0"',src:"url('"+e+"fabric-icons-0-467ee27f.woff') format('woff')"},icons:{PageLink:"",CommentSolid:"",ChangeEntitlements:"",Installation:"",WebAppBuilderModule:"",WebAppBuilderFragment:"",WebAppBuilderSlot:"",BullseyeTargetEdit:"",WebAppBuilderFragmentCreate:"",PageData:"",PageHeaderEdit:"",ProductList:"",UnpublishContent:"",DependencyAdd:"",DependencyRemove:"",EntitlementPolicy:"",EntitlementRedemption:"",SchoolDataSyncLogo:"",PinSolid12:"",PinSolidOff12:"",AddLink:"",SharepointAppIcon16:"",DataflowsLink:"",TimePicker:"",UserWarning:"",ComplianceAudit:"",InternetSharing:"",Brightness:"",MapPin:"",Airplane:"",Tablet:"",QuickNote:"",Video:"",People:"",Phone:"",Pin:"",Shop:"",Stop:"",Link:"",AllApps:"",Zoom:"",ZoomOut:"",Microphone:"",Camera:"",Attach:"",Send:"",FavoriteList:"",PageSolid:"",Forward:"",Back:"",Refresh:"",Lock:"",ReportHacked:"",EMI:"",MiniLink:"",Blocked:"",ReadingMode:"",Favicon:"",Remove:"",Checkbox:"",CheckboxComposite:"",CheckboxFill:"",CheckboxIndeterminate:"",CheckboxCompositeReversed:"",BackToWindow:"",FullScreen:"",Print:"",Up:"",Down:"",OEM:"",Save:"",ReturnKey:"",Cloud:"",Flashlight:"",CommandPrompt:"",Sad:"",RealEstate:"",SIPMove:"",EraseTool:"",GripperTool:"",Dialpad:"",PageLeft:"",PageRight:"",MultiSelect:"",KeyboardClassic:"",Play:"",Pause:"",InkingTool:"",Emoji2:"",GripperBarHorizontal:"",System:"",Personalize:"",SearchAndApps:"",Globe:"",EaseOfAccess:"",ContactInfo:"",Unpin:"",Contact:"",Memo:"",IncomingCall:""}},t)}function J_(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-1"',src:"url('"+e+"fabric-icons-1-4d521695.woff') format('woff')"},icons:{Paste:"",WindowsLogo:"",Error:"",GripperBarVertical:"",Unlock:"",Slideshow:"",Trim:"",AutoEnhanceOn:"",AutoEnhanceOff:"",Color:"",SaveAs:"",Light:"",Filters:"",AspectRatio:"",Contrast:"",Redo:"",Crop:"",PhotoCollection:"",Album:"",Rotate:"",PanoIndicator:"",Translate:"",RedEye:"",ViewOriginal:"",ThumbnailView:"",Package:"",Telemarketer:"",Warning:"",Financial:"",Education:"",ShoppingCart:"",Train:"",Move:"",TouchPointer:"",Merge:"",TurnRight:"",Ferry:"",Highlight:"",PowerButton:"",Tab:"",Admin:"",TVMonitor:"",Speakers:"",Game:"",HorizontalTabKey:"",UnstackSelected:"",StackIndicator:"",Nav2DMapView:"",StreetsideSplitMinimize:"",Car:"",Bus:"",EatDrink:"",SeeDo:"",LocationCircle:"",Home:"",SwitcherStartEnd:"",ParkingLocation:"",IncidentTriangle:"",Touch:"",MapDirections:"",CaretHollow:"",CaretSolid:"",History:"",Location:"",MapLayers:"",SearchNearby:"",Work:"",Recent:"",Hotel:"",Bank:"",LocationDot:"",Dictionary:"",ChromeBack:"",FolderOpen:"",PinnedFill:"",RevToggleKey:"",USB:"",Previous:"",Next:"",Sync:"",Help:"",Emoji:"",MailForward:"",ClosePane:"",OpenPane:"",PreviewLink:"",ZoomIn:"",Bookmarks:"",Document:"",ProtectedDocument:"",OpenInNewWindow:"",MailFill:"",ViewAll:"",Switch:"",Rename:"",Go:"",Remote:"",SelectAll:"",Orientation:"",Import:""}},t)}function $_(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-2"',src:"url('"+e+"fabric-icons-2-63c99abf.woff') format('woff')"},icons:{Picture:"",ChromeClose:"",ShowResults:"",Message:"",CalendarDay:"",CalendarWeek:"",MailReplyAll:"",Read:"",Cut:"",PaymentCard:"",Copy:"",Important:"",MailReply:"",GotoToday:"",Font:"",FontColor:"",FolderFill:"",Permissions:"",DisableUpdates:"",Unfavorite:"",Italic:"",Underline:"",Bold:"",MoveToFolder:"",Dislike:"",Like:"",AlignCenter:"",OpenFile:"",ClearSelection:"",FontDecrease:"",FontIncrease:"",FontSize:"",CellPhone:"",RepeatOne:"",RepeatAll:"",Calculator:"",Library:"",PostUpdate:"",NewFolder:"",CalendarReply:"",UnsyncFolder:"",SyncFolder:"",BlockContact:"",Accept:"",BulletedList:"",Preview:"",News:"",Chat:"",Group:"",World:"",Comment:"",DockLeft:"",DockRight:"",Repair:"",Accounts:"",Street:"",RadioBullet:"",Stopwatch:"",Clock:"",WorldClock:"",AlarmClock:"",Photo:"",ActionCenter:"",Hospital:"",Timer:"",FullCircleMask:"",LocationFill:"",ChromeMinimize:"",ChromeRestore:"",Annotation:"",Fingerprint:"",Handwriting:"",ChromeFullScreen:"",Completed:"",Label:"",FlickDown:"",FlickUp:"",FlickLeft:"",FlickRight:"",MiniExpand:"",MiniContract:"",Streaming:"",MusicInCollection:"",OneDriveLogo:"",CompassNW:"",Code:"",LightningBolt:"",CalculatorMultiply:"",CalculatorAddition:"",CalculatorSubtract:"",CalculatorPercentage:"",CalculatorEqualTo:"",PrintfaxPrinterFile:"",StorageOptical:"",Communications:"",Headset:"",Health:"",Webcam2:"",FrontCamera:"",ChevronUpSmall:""}},t)}function eS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-3"',src:"url('"+e+"fabric-icons-3-089e217a.woff') format('woff')"},icons:{ChevronDownSmall:"",ChevronLeftSmall:"",ChevronRightSmall:"",ChevronUpMed:"",ChevronDownMed:"",ChevronLeftMed:"",ChevronRightMed:"",Devices2:"",PC1:"",PresenceChickletVideo:"",Reply:"",HalfAlpha:"",ConstructionCone:"",DoubleChevronLeftMed:"",Volume0:"",Volume1:"",Volume2:"",Volume3:"",Chart:"",Robot:"",Manufacturing:"",LockSolid:"",FitPage:"",FitWidth:"",BidiLtr:"",BidiRtl:"",RightDoubleQuote:"",Sunny:"",CloudWeather:"",Cloudy:"",PartlyCloudyDay:"",PartlyCloudyNight:"",ClearNight:"",RainShowersDay:"",Rain:"",Thunderstorms:"",RainSnow:"",Snow:"",BlowingSnow:"",Frigid:"",Fog:"",Squalls:"",Duststorm:"",Unknown:"",Precipitation:"",Ribbon:"",AreaChart:"",Assign:"",FlowChart:"",CheckList:"",Diagnostic:"",Generate:"",LineChart:"",Equalizer:"",BarChartHorizontal:"",BarChartVertical:"",Freezing:"",FunnelChart:"",Processing:"",Quantity:"",ReportDocument:"",StackColumnChart:"",SnowShowerDay:"",HailDay:"",WorkFlow:"",HourGlass:"",StoreLogoMed20:"",TimeSheet:"",TriangleSolid:"",UpgradeAnalysis:"",VideoSolid:"",RainShowersNight:"",SnowShowerNight:"",Teamwork:"",HailNight:"",PeopleAdd:"",Glasses:"",DateTime2:"",Shield:"",Header1:"",PageAdd:"",NumberedList:"",PowerBILogo:"",Info2:"",MusicInCollectionFill:"",Asterisk:"",ErrorBadge:"",CircleFill:"",Record2:"",AllAppsMirrored:"",BookmarksMirrored:"",BulletedListMirrored:"",CaretHollowMirrored:"",CaretSolidMirrored:"",ChromeBackMirrored:"",ClearSelectionMirrored:"",ClosePaneMirrored:"",DockLeftMirrored:"",DoubleChevronLeftMedMirrored:"",GoMirrored:""}},t)}function tS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-4"',src:"url('"+e+"fabric-icons-4-a656cc0a.woff') format('woff')"},icons:{HelpMirrored:"",ImportMirrored:"",ImportAllMirrored:"",ListMirrored:"",MailForwardMirrored:"",MailReplyMirrored:"",MailReplyAllMirrored:"",MiniContractMirrored:"",MiniExpandMirrored:"",OpenPaneMirrored:"",ParkingLocationMirrored:"",SendMirrored:"",ShowResultsMirrored:"",ThumbnailViewMirrored:"",Media:"",Devices3:"",Focus:"",VideoLightOff:"",Lightbulb:"",StatusTriangle:"",VolumeDisabled:"",Puzzle:"",EmojiNeutral:"",EmojiDisappointed:"",HomeSolid:"",Ringer:"",PDF:"",HeartBroken:"",StoreLogo16:"",MultiSelectMirrored:"",Broom:"",AddToShoppingList:"",Cocktails:"",Wines:"",Articles:"",Cycling:"",DietPlanNotebook:"",Pill:"",ExerciseTracker:"",HandsFree:"",Medical:"",Running:"",Weights:"",Trackers:"",AddNotes:"",AllCurrency:"",BarChart4:"",CirclePlus:"",Coffee:"",Cotton:"",Market:"",Money:"",PieDouble:"",PieSingle:"",RemoveFilter:"",Savings:"",Sell:"",StockDown:"",StockUp:"",Lamp:"",Source:"",MSNVideos:"",Cricket:"",Golf:"",Baseball:"",Soccer:"",MoreSports:"",AutoRacing:"",CollegeHoops:"",CollegeFootball:"",ProFootball:"",ProHockey:"",Rugby:"",SubstitutionsIn:"",Tennis:"",Arrivals:"",Design:"",Website:"",Drop:"",HistoricalWeather:"",SkiResorts:"",Snowflake:"",BusSolid:"",FerrySolid:"",AirplaneSolid:"",TrainSolid:"",Ticket:"",WifiWarning4:"",Devices4:"",AzureLogo:"",BingLogo:"",MSNLogo:"",OutlookLogoInverse:"",OfficeLogo:"",SkypeLogo:"",Door:"",EditMirrored:"",GiftCard:"",DoubleBookmark:"",StatusErrorFull:""}},t)}function oS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-5"',src:"url('"+e+"fabric-icons-5-f95ba260.woff') format('woff')"},icons:{Certificate:"",FastForward:"",Rewind:"",Photo2:"",OpenSource:"",Movers:"",CloudDownload:"",Family:"",WindDirection:"",Bug:"",SiteScan:"",BrowserScreenShot:"",F12DevTools:"",CSS:"",JS:"",DeliveryTruck:"",ReminderPerson:"",ReminderGroup:"",ReminderTime:"",TabletMode:"",Umbrella:"",NetworkTower:"",CityNext:"",CityNext2:"",Section:"",OneNoteLogoInverse:"",ToggleFilled:"",ToggleBorder:"",SliderThumb:"",ToggleThumb:"",Documentation:"",Badge:"",Giftbox:"",VisualStudioLogo:"",HomeGroup:"",ExcelLogoInverse:"",WordLogoInverse:"",PowerPointLogoInverse:"",Cafe:"",SpeedHigh:"",Commitments:"",ThisPC:"",MusicNote:"",MicOff:"",PlaybackRate1x:"",EdgeLogo:"",CompletedSolid:"",AlbumRemove:"",MessageFill:"",TabletSelected:"",MobileSelected:"",LaptopSelected:"",TVMonitorSelected:"",DeveloperTools:"",Shapes:"",InsertTextBox:"",LowerBrightness:"",WebComponents:"",OfflineStorage:"",DOM:"",CloudUpload:"",ScrollUpDown:"",DateTime:"",Event:"",Cake:"",Org:"",PartyLeader:"",DRM:"",CloudAdd:"",AppIconDefault:"",Photo2Add:"",Photo2Remove:"",Calories:"",POI:"",AddTo:"",RadioBtnOff:"",RadioBtnOn:"",ExploreContent:"",Product:"",ProgressLoopInner:"",ProgressLoopOuter:"",Blocked2:"",FangBody:"",Toolbox:"",PageHeader:"",ChatInviteFriend:"",Brush:"",Shirt:"",Crown:"",Diamond:"",ScaleUp:"",QRCode:"",Feedback:"",SharepointLogoInverse:"",YammerLogo:"",Hide:"",Uneditable:"",ReturnToSession:"",OpenFolderHorizontal:"",CalendarMirrored:""}},t)}function nS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-6"',src:"url('"+e+"fabric-icons-6-ef6fd590.woff') format('woff')"},icons:{SwayLogoInverse:"",OutOfOffice:"",Trophy:"",ReopenPages:"",EmojiTabSymbols:"",AADLogo:"",AccessLogo:"",AdminALogoInverse32:"",AdminCLogoInverse32:"",AdminDLogoInverse32:"",AdminELogoInverse32:"",AdminLLogoInverse32:"",AdminMLogoInverse32:"",AdminOLogoInverse32:"",AdminPLogoInverse32:"",AdminSLogoInverse32:"",AdminYLogoInverse32:"",DelveLogoInverse:"",ExchangeLogoInverse:"",LyncLogo:"",OfficeVideoLogoInverse:"",SocialListeningLogo:"",VisioLogoInverse:"",Balloons:"",Cat:"",MailAlert:"",MailCheck:"",MailLowImportance:"",MailPause:"",MailRepeat:"",SecurityGroup:"",Table:"",VoicemailForward:"",VoicemailReply:"",Waffle:"",RemoveEvent:"",EventInfo:"",ForwardEvent:"",WipePhone:"",AddOnlineMeeting:"",JoinOnlineMeeting:"",RemoveLink:"",PeopleBlock:"",PeopleRepeat:"",PeopleAlert:"",PeoplePause:"",TransferCall:"",AddPhone:"",UnknownCall:"",NoteReply:"",NoteForward:"",NotePinned:"",RemoveOccurrence:"",Timeline:"",EditNote:"",CircleHalfFull:"",Room:"",Unsubscribe:"",Subscribe:"",HardDrive:"",RecurringTask:"",TaskManager:"",TaskManagerMirrored:"",Combine:"",Split:"",DoubleChevronUp:"",DoubleChevronLeft:"",DoubleChevronRight:"",TextBox:"",TextField:"",NumberField:"",Dropdown:"",PenWorkspace:"",BookingsLogo:"",ClassNotebookLogoInverse:"",DelveAnalyticsLogo:"",DocsLogoInverse:"",Dynamics365Logo:"",DynamicSMBLogo:"",OfficeAssistantLogo:"",OfficeStoreLogo:"",OneNoteEduLogoInverse:"",PlannerLogo:"",PowerApps:"",Suitcase:"",ProjectLogoInverse:"",CaretLeft8:"",CaretRight8:"",CaretUp8:"",CaretDown8:"",CaretLeftSolid8:"",CaretRightSolid8:"",CaretUpSolid8:"",CaretDownSolid8:"",ClearFormatting:"",Superscript:"",Subscript:"",Strikethrough:"",Export:"",ExportMirrored:""}},t)}function rS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-7"',src:"url('"+e+"fabric-icons-7-2b97bb99.woff') format('woff')"},icons:{SingleBookmark:"",SingleBookmarkSolid:"",DoubleChevronDown:"",FollowUser:"",ReplyAll:"",WorkforceManagement:"",RecruitmentManagement:"",Questionnaire:"",ManagerSelfService:"",ProductionFloorManagement:"",ProductRelease:"",ProductVariant:"",ReplyMirrored:"",ReplyAllMirrored:"",Medal:"",AddGroup:"",QuestionnaireMirrored:"",CloudImportExport:"",TemporaryUser:"",CaretSolid16:"",GroupedDescending:"",GroupedAscending:"",AwayStatus:"",MyMoviesTV:"",GenericScan:"",AustralianRules:"",WifiEthernet:"",TrackersMirrored:"",DateTimeMirrored:"",StopSolid:"",DoubleChevronUp12:"",DoubleChevronDown12:"",DoubleChevronLeft12:"",DoubleChevronRight12:"",CalendarAgenda:"",ConnectVirtualMachine:"",AddEvent:"",AssetLibrary:"",DataConnectionLibrary:"",DocLibrary:"",FormLibrary:"",FormLibraryMirrored:"",ReportLibrary:"",ReportLibraryMirrored:"",ContactCard:"",CustomList:"",CustomListMirrored:"",IssueTracking:"",IssueTrackingMirrored:"",PictureLibrary:"",OfficeAddinsLogo:"",OfflineOneDriveParachute:"",OfflineOneDriveParachuteDisabled:"",TriangleSolidUp12:"",TriangleSolidDown12:"",TriangleSolidLeft12:"",TriangleSolidRight12:"",TriangleUp12:"",TriangleDown12:"",TriangleLeft12:"",TriangleRight12:"",ArrowUpRight8:"",ArrowDownRight8:"",DocumentSet:"",GoToDashboard:"",DelveAnalytics:"",ArrowUpRightMirrored8:"",ArrowDownRightMirrored8:"",CompanyDirectory:"",OpenEnrollment:"",CompanyDirectoryMirrored:"",OneDriveAdd:"",ProfileSearch:"",Header2:"",Header3:"",Header4:"",RingerSolid:"",Eyedropper:"",MarketDown:"",CalendarWorkWeek:"",SidePanel:"",GlobeFavorite:"",CaretTopLeftSolid8:"",CaretTopRightSolid8:"",ViewAll2:"",DocumentReply:"",PlayerSettings:"",ReceiptForward:"",ReceiptReply:"",ReceiptCheck:"",Fax:"",RecurringEvent:"",ReplyAlt:"",ReplyAllAlt:"",EditStyle:"",EditMail:"",Lifesaver:"",LifesaverLock:"",InboxCheck:"",FolderSearch:""}},t)}function iS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-8"',src:"url('"+e+"fabric-icons-8-6fdf1528.woff') format('woff')"},icons:{CollapseMenu:"",ExpandMenu:"",Boards:"",SunAdd:"",SunQuestionMark:"",LandscapeOrientation:"",DocumentSearch:"",PublicCalendar:"",PublicContactCard:"",PublicEmail:"",PublicFolder:"",WordDocument:"",PowerPointDocument:"",ExcelDocument:"",GroupedList:"",ClassroomLogo:"",Sections:"",EditPhoto:"",Starburst:"",ShareiOS:"",AirTickets:"",PencilReply:"",Tiles2:"",SkypeCircleCheck:"",SkypeCircleClock:"",SkypeCircleMinus:"",SkypeMessage:"",ClosedCaption:"",ATPLogo:"",OfficeFormsLogoInverse:"",RecycleBin:"",EmptyRecycleBin:"",Hide2:"",Breadcrumb:"",BirthdayCake:"",TimeEntry:"",CRMProcesses:"",PageEdit:"",PageArrowRight:"",PageRemove:"",Database:"",DataManagementSettings:"",CRMServices:"",EditContact:"",ConnectContacts:"",AppIconDefaultAdd:"",AppIconDefaultList:"",ActivateOrders:"",DeactivateOrders:"",ProductCatalog:"",ScatterChart:"",AccountActivity:"",DocumentManagement:"",CRMReport:"",KnowledgeArticle:"",Relationship:"",HomeVerify:"",ZipFolder:"",SurveyQuestions:"",TextDocument:"",TextDocumentShared:"",PageCheckedOut:"",PageShared:"",SaveAndClose:"",Script:"",Archive:"",ActivityFeed:"",Compare:"",EventDate:"",ArrowUpRight:"",CaretRight:"",SetAction:"",ChatBot:"",CaretSolidLeft:"",CaretSolidDown:"",CaretSolidRight:"",CaretSolidUp:"",PowerAppsLogo:"",PowerApps2Logo:"",SearchIssue:"",SearchIssueMirrored:"",FabricAssetLibrary:"",FabricDataConnectionLibrary:"",FabricDocLibrary:"",FabricFormLibrary:"",FabricFormLibraryMirrored:"",FabricReportLibrary:"",FabricReportLibraryMirrored:"",FabricPublicFolder:"",FabricFolderSearch:"",FabricMovetoFolder:"",FabricUnsyncFolder:"",FabricSyncFolder:"",FabricOpenFolderHorizontal:"",FabricFolder:"",FabricFolderFill:"",FabricNewFolder:"",FabricPictureLibrary:"",PhotoVideoMedia:"",AddFavorite:""}},t)}function aS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-9"',src:"url('"+e+"fabric-icons-9-c6162b42.woff') format('woff')"},icons:{AddFavoriteFill:"",BufferTimeBefore:"",BufferTimeAfter:"",BufferTimeBoth:"",PublishContent:"",ClipboardList:"",ClipboardListMirrored:"",CannedChat:"",SkypeForBusinessLogo:"",TabCenter:"",PageCheckedin:"",PageList:"",ReadOutLoud:"",CaretBottomLeftSolid8:"",CaretBottomRightSolid8:"",FolderHorizontal:"",MicrosoftStaffhubLogo:"",GiftboxOpen:"",StatusCircleOuter:"",StatusCircleInner:"",StatusCircleRing:"",StatusTriangleOuter:"",StatusTriangleInner:"",StatusTriangleExclamation:"",StatusCircleExclamation:"",StatusCircleErrorX:"",StatusCircleInfo:"",StatusCircleBlock:"",StatusCircleBlock2:"",StatusCircleQuestionMark:"",StatusCircleSync:"",Toll:"",ExploreContentSingle:"",CollapseContent:"",CollapseContentSingle:"",InfoSolid:"",GroupList:"",ProgressRingDots:"",CaloriesAdd:"",BranchFork:"",MuteChat:"",AddHome:"",AddWork:"",MobileReport:"",ScaleVolume:"",HardDriveGroup:"",FastMode:"",ToggleLeft:"",ToggleRight:"",TriangleShape:"",RectangleShape:"",CubeShape:"",Trophy2:"",BucketColor:"",BucketColorFill:"",Taskboard:"",SingleColumn:"",DoubleColumn:"",TripleColumn:"",ColumnLeftTwoThirds:"",ColumnRightTwoThirds:"",AccessLogoFill:"",AnalyticsLogo:"",AnalyticsQuery:"",NewAnalyticsQuery:"",AnalyticsReport:"",WordLogo:"",WordLogoFill:"",ExcelLogo:"",ExcelLogoFill:"",OneNoteLogo:"",OneNoteLogoFill:"",OutlookLogo:"",OutlookLogoFill:"",PowerPointLogo:"",PowerPointLogoFill:"",PublisherLogo:"",PublisherLogoFill:"",ScheduleEventAction:"",FlameSolid:"",ServerProcesses:"",Server:"",SaveAll:"",LinkedInLogo:"",Decimals:"",SidePanelMirrored:"",ProtectRestrict:"",Blog:"",UnknownMirrored:"",PublicContactCardMirrored:"",GridViewSmall:"",GridViewMedium:"",GridViewLarge:"",Step:"",StepInsert:"",StepShared:"",StepSharedAdd:"",StepSharedInsert:"",ViewDashboard:"",ViewList:""}},t)}function sS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-10"',src:"url('"+e+"fabric-icons-10-c4ded8e4.woff') format('woff')"},icons:{ViewListGroup:"",ViewListTree:"",TriggerAuto:"",TriggerUser:"",PivotChart:"",StackedBarChart:"",StackedLineChart:"",BuildQueue:"",BuildQueueNew:"",UserFollowed:"",ContactLink:"",Stack:"",Bullseye:"",VennDiagram:"",FiveTileGrid:"",FocalPoint:"",Insert:"",RingerRemove:"",TeamsLogoInverse:"",TeamsLogo:"",TeamsLogoFill:"",SkypeForBusinessLogoFill:"",SharepointLogo:"",SharepointLogoFill:"",DelveLogo:"",DelveLogoFill:"",OfficeVideoLogo:"",OfficeVideoLogoFill:"",ExchangeLogo:"",ExchangeLogoFill:"",Signin:"",DocumentApproval:"",CloneToDesktop:"",InstallToDrive:"",Blur:"",Build:"",ProcessMetaTask:"",BranchFork2:"",BranchLocked:"",BranchCommit:"",BranchCompare:"",BranchMerge:"",BranchPullRequest:"",BranchSearch:"",BranchShelveset:"",RawSource:"",MergeDuplicate:"",RowsGroup:"",RowsChild:"",Deploy:"",Redeploy:"",ServerEnviroment:"",VisioDiagram:"",HighlightMappedShapes:"",TextCallout:"",IconSetsFlag:"",VisioLogo:"",VisioLogoFill:"",VisioDocument:"",TimelineProgress:"",TimelineDelivery:"",Backlog:"",TeamFavorite:"",TaskGroup:"",TaskGroupMirrored:"",ScopeTemplate:"",AssessmentGroupTemplate:"",NewTeamProject:"",CommentAdd:"",CommentNext:"",CommentPrevious:"",ShopServer:"",LocaleLanguage:"",QueryList:"",UserSync:"",UserPause:"",StreamingOff:"",ArrowTallUpLeft:"",ArrowTallUpRight:"",ArrowTallDownLeft:"",ArrowTallDownRight:"",FieldEmpty:"",FieldFilled:"",FieldChanged:"",FieldNotChanged:"",RingerOff:"",PlayResume:"",BulletedList2:"",BulletedList2Mirrored:"",ImageCrosshair:"",GitGraph:"",Repo:"",RepoSolid:"",FolderQuery:"",FolderList:"",FolderListMirrored:"",LocationOutline:"",POISolid:"",CalculatorNotEqualTo:"",BoxSubtractSolid:""}},t)}function lS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-11"',src:"url('"+e+"fabric-icons-11-2a8393d6.woff') format('woff')"},icons:{BoxAdditionSolid:"",BoxMultiplySolid:"",BoxPlaySolid:"",BoxCheckmarkSolid:"",CirclePauseSolid:"",CirclePause:"",MSNVideosSolid:"",CircleStopSolid:"",CircleStop:"",NavigateBack:"",NavigateBackMirrored:"",NavigateForward:"",NavigateForwardMirrored:"",UnknownSolid:"",UnknownMirroredSolid:"",CircleAddition:"",CircleAdditionSolid:"",FilePDB:"",FileTemplate:"",FileSQL:"",FileJAVA:"",FileASPX:"",FileCSS:"",FileSass:"",FileLess:"",FileHTML:"",JavaScriptLanguage:"",CSharpLanguage:"",CSharp:"",VisualBasicLanguage:"",VB:"",CPlusPlusLanguage:"",CPlusPlus:"",FSharpLanguage:"",FSharp:"",TypeScriptLanguage:"",PythonLanguage:"",PY:"",CoffeeScript:"",MarkDownLanguage:"",FullWidth:"",FullWidthEdit:"",Plug:"",PlugSolid:"",PlugConnected:"",PlugDisconnected:"",UnlockSolid:"",Variable:"",Parameter:"",CommentUrgent:"",Storyboard:"",DiffInline:"",DiffSideBySide:"",ImageDiff:"",ImagePixel:"",FileBug:"",FileCode:"",FileComment:"",BusinessHoursSign:"",FileImage:"",FileSymlink:"",AutoFillTemplate:"",WorkItem:"",WorkItemBug:"",LogRemove:"",ColumnOptions:"",Packages:"",BuildIssue:"",AssessmentGroup:"",VariableGroup:"",FullHistory:"",Wheelchair:"",SingleColumnEdit:"",DoubleColumnEdit:"",TripleColumnEdit:"",ColumnLeftTwoThirdsEdit:"",ColumnRightTwoThirdsEdit:"",StreamLogo:"",PassiveAuthentication:"",AlertSolid:"",MegaphoneSolid:"",TaskSolid:"",ConfigurationSolid:"",BugSolid:"",CrownSolid:"",Trophy2Solid:"",QuickNoteSolid:"",ConstructionConeSolid:"",PageListSolid:"",PageListMirroredSolid:"",StarburstSolid:"",ReadingModeSolid:"",SadSolid:"",HealthSolid:"",ShieldSolid:"",GiftBoxSolid:"",ShoppingCartSolid:"",MailSolid:"",ChatSolid:"",RibbonSolid:""}},t)}function cS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-12"',src:"url('"+e+"fabric-icons-12-7e945a1e.woff') format('woff')"},icons:{FinancialSolid:"",FinancialMirroredSolid:"",HeadsetSolid:"",PermissionsSolid:"",ParkingSolid:"",ParkingMirroredSolid:"",DiamondSolid:"",AsteriskSolid:"",OfflineStorageSolid:"",BankSolid:"",DecisionSolid:"",Parachute:"",ParachuteSolid:"",FiltersSolid:"",ColorSolid:"",ReviewSolid:"",ReviewRequestSolid:"",ReviewRequestMirroredSolid:"",ReviewResponseSolid:"",FeedbackRequestSolid:"",FeedbackRequestMirroredSolid:"",FeedbackResponseSolid:"",WorkItemBar:"",WorkItemBarSolid:"",Separator:"",NavigateExternalInline:"",PlanView:"",TimelineMatrixView:"",EngineeringGroup:"",ProjectCollection:"",CaretBottomRightCenter8:"",CaretBottomLeftCenter8:"",CaretTopRightCenter8:"",CaretTopLeftCenter8:"",DonutChart:"",ChevronUnfold10:"",ChevronFold10:"",DoubleChevronDown8:"",DoubleChevronUp8:"",DoubleChevronLeft8:"",DoubleChevronRight8:"",ChevronDownEnd6:"",ChevronUpEnd6:"",ChevronLeftEnd6:"",ChevronRightEnd6:"",ContextMenu:"",AzureAPIManagement:"",AzureServiceEndpoint:"",VSTSLogo:"",VSTSAltLogo1:"",VSTSAltLogo2:"",FileTypeSolution:"",WordLogoInverse16:"",WordLogo16:"",WordLogoFill16:"",PowerPointLogoInverse16:"",PowerPointLogo16:"",PowerPointLogoFill16:"",ExcelLogoInverse16:"",ExcelLogo16:"",ExcelLogoFill16:"",OneNoteLogoInverse16:"",OneNoteLogo16:"",OneNoteLogoFill16:"",OutlookLogoInverse16:"",OutlookLogo16:"",OutlookLogoFill16:"",PublisherLogoInverse16:"",PublisherLogo16:"",PublisherLogoFill16:"",VisioLogoInverse16:"",VisioLogo16:"",VisioLogoFill16:"",TestBeaker:"",TestBeakerSolid:"",TestExploreSolid:"",TestAutoSolid:"",TestUserSolid:"",TestImpactSolid:"",TestPlan:"",TestStep:"",TestParameter:"",TestSuite:"",TestCase:"",Sprint:"",SignOut:"",TriggerApproval:"",Rocket:"",AzureKeyVault:"",Onboarding:"",Transition:"",LikeSolid:"",DislikeSolid:"",CRMCustomerInsightsApp:"",EditCreate:"",PlayReverseResume:"",PlayReverse:"",SearchData:"",UnSetColor:"",DeclineCall:""}},t)}function uS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-13"',src:"url('"+e+"fabric-icons-13-c3989a02.woff') format('woff')"},icons:{RectangularClipping:"",TeamsLogo16:"",TeamsLogoFill16:"",Spacer:"",SkypeLogo16:"",SkypeForBusinessLogo16:"",SkypeForBusinessLogoFill16:"",FilterSolid:"",MailUndelivered:"",MailTentative:"",MailTentativeMirrored:"",MailReminder:"",ReceiptUndelivered:"",ReceiptTentative:"",ReceiptTentativeMirrored:"",Inbox:"",IRMReply:"",IRMReplyMirrored:"",IRMForward:"",IRMForwardMirrored:"",VoicemailIRM:"",EventAccepted:"",EventTentative:"",EventTentativeMirrored:"",EventDeclined:"",IDBadge:"",BackgroundColor:"",OfficeFormsLogoInverse16:"",OfficeFormsLogo:"",OfficeFormsLogoFill:"",OfficeFormsLogo16:"",OfficeFormsLogoFill16:"",OfficeFormsLogoInverse24:"",OfficeFormsLogo24:"",OfficeFormsLogoFill24:"",PageLock:"",NotExecuted:"",NotImpactedSolid:"",FieldReadOnly:"",FieldRequired:"",BacklogBoard:"",ExternalBuild:"",ExternalTFVC:"",ExternalXAML:"",IssueSolid:"",DefectSolid:"",LadybugSolid:"",NugetLogo:"",TFVCLogo:"",ProjectLogo32:"",ProjectLogoFill32:"",ProjectLogo16:"",ProjectLogoFill16:"",SwayLogo32:"",SwayLogoFill32:"",SwayLogo16:"",SwayLogoFill16:"",ClassNotebookLogo32:"",ClassNotebookLogoFill32:"",ClassNotebookLogo16:"",ClassNotebookLogoFill16:"",ClassNotebookLogoInverse32:"",ClassNotebookLogoInverse16:"",StaffNotebookLogo32:"",StaffNotebookLogoFill32:"",StaffNotebookLogo16:"",StaffNotebookLogoFill16:"",StaffNotebookLogoInverted32:"",StaffNotebookLogoInverted16:"",KaizalaLogo:"",TaskLogo:"",ProtectionCenterLogo32:"",GallatinLogo:"",Globe2:"",Guitar:"",Breakfast:"",Brunch:"",BeerMug:"",Vacation:"",Teeth:"",Taxi:"",Chopsticks:"",SyncOccurence:"",UnsyncOccurence:"",GIF:"",PrimaryCalendar:"",SearchCalendar:"",VideoOff:"",MicrosoftFlowLogo:"",BusinessCenterLogo:"",ToDoLogoBottom:"",ToDoLogoTop:"",EditSolid12:"",EditSolidMirrored12:"",UneditableSolid12:"",UneditableSolidMirrored12:"",UneditableMirrored:"",AdminALogo32:"",AdminALogoFill32:"",ToDoLogoInverse:""}},t)}function dS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-14"',src:"url('"+e+"fabric-icons-14-5cf58db8.woff') format('woff')"},icons:{Snooze:"",WaffleOffice365:"",ImageSearch:"",NewsSearch:"",VideoSearch:"",R:"",FontColorA:"",FontColorSwatch:"",LightWeight:"",NormalWeight:"",SemiboldWeight:"",GroupObject:"",UngroupObject:"",AlignHorizontalLeft:"",AlignHorizontalCenter:"",AlignHorizontalRight:"",AlignVerticalTop:"",AlignVerticalCenter:"",AlignVerticalBottom:"",HorizontalDistributeCenter:"",VerticalDistributeCenter:"",Ellipse:"",Line:"",Octagon:"",Hexagon:"",Pentagon:"",RightTriangle:"",HalfCircle:"",QuarterCircle:"",ThreeQuarterCircle:"","6PointStar":"","12PointStar":"",ArrangeBringToFront:"",ArrangeSendToBack:"",ArrangeSendBackward:"",ArrangeBringForward:"",BorderDash:"",BorderDot:"",LineStyle:"",LineThickness:"",WindowEdit:"",HintText:"",MediaAdd:"",AnchorLock:"",AutoHeight:"",ChartSeries:"",ChartXAngle:"",ChartYAngle:"",Combobox:"",LineSpacing:"",Padding:"",PaddingTop:"",PaddingBottom:"",PaddingLeft:"",PaddingRight:"",NavigationFlipper:"",AlignJustify:"",TextOverflow:"",VisualsFolder:"",VisualsStore:"",PictureCenter:"",PictureFill:"",PicturePosition:"",PictureStretch:"",PictureTile:"",Slider:"",SliderHandleSize:"",DefaultRatio:"",NumberSequence:"",GUID:"",ReportAdd:"",DashboardAdd:"",MapPinSolid:"",WebPublish:"",PieSingleSolid:"",BlockedSolid:"",DrillDown:"",DrillDownSolid:"",DrillExpand:"",DrillShow:"",SpecialEvent:"",OneDriveFolder16:"",FunctionalManagerDashboard:"",BIDashboard:"",CodeEdit:"",RenewalCurrent:"",RenewalFuture:"",SplitObject:"",BulkUpload:"",DownloadDocument:"",GreetingCard:"",Flower:"",WaitlistConfirm:"",WaitlistConfirmMirrored:"",LaptopSecure:"",DragObject:"",EntryView:"",EntryDecline:"",ContactCardSettings:"",ContactCardSettingsMirrored:""}},t)}function pS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-15"',src:"url('"+e+"fabric-icons-15-3807251b.woff') format('woff')"},icons:{CalendarSettings:"",CalendarSettingsMirrored:"",HardDriveLock:"",HardDriveUnlock:"",AccountManagement:"",ReportWarning:"",TransitionPop:"",TransitionPush:"",TransitionEffect:"",LookupEntities:"",ExploreData:"",AddBookmark:"",SearchBookmark:"",DrillThrough:"",MasterDatabase:"",CertifiedDatabase:"",MaximumValue:"",MinimumValue:"",VisualStudioIDELogo32:"",PasteAsText:"",PasteAsCode:"",BrowserTab:"",BrowserTabScreenshot:"",DesktopScreenshot:"",FileYML:"",ClipboardSolid:"",FabricUserFolder:"",FabricNetworkFolder:"",BullseyeTarget:"",AnalyticsView:"",Video360Generic:"",Untag:"",Leave:"",Trending12:"",Blocked12:"",Warning12:"",CheckedOutByOther12:"",CheckedOutByYou12:"",CircleShapeSolid:"",SquareShapeSolid:"",TriangleShapeSolid:"",DropShapeSolid:"",RectangleShapeSolid:"",ZoomToFit:"",InsertColumnsLeft:"",InsertColumnsRight:"",InsertRowsAbove:"",InsertRowsBelow:"",DeleteColumns:"",DeleteRows:"",DeleteRowsMirrored:"",DeleteTable:"",AccountBrowser:"",VersionControlPush:"",StackedColumnChart2:"",TripleColumnWide:"",QuadColumn:"",WhiteBoardApp16:"",WhiteBoardApp32:"",PinnedSolid:"",InsertSignatureLine:"",ArrangeByFrom:"",Phishing:"",CreateMailRule:"",PublishCourse:"",DictionaryRemove:"",UserRemove:"",UserEvent:"",Encryption:"",PasswordField:"",OpenInNewTab:"",Hide3:"",VerifiedBrandSolid:"",MarkAsProtected:"",AuthenticatorApp:"",WebTemplate:"",DefenderTVM:"",MedalSolid:"",D365TalentLearn:"",D365TalentInsight:"",D365TalentHRCore:"",BacklogList:"",ButtonControl:"",TableGroup:"",MountainClimbing:"",TagUnknown:"",TagUnknownMirror:"",TagUnknown12:"",TagUnknown12Mirror:"",Link12:"",Presentation:"",Presentation12:"",Lock12:"",BuildDefinition:"",ReleaseDefinition:"",SaveTemplate:"",UserGauge:"",BlockedSiteSolid12:"",TagSolid:"",OfficeChat:""}},t)}function hS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-16"',src:"url('"+e+"fabric-icons-16-9cf93f3b.woff') format('woff')"},icons:{OfficeChatSolid:"",MailSchedule:"",WarningSolid:"",Blocked2Solid:"",SkypeCircleArrow:"",SkypeArrow:"",SyncStatus:"",SyncStatusSolid:"",ProjectDocument:"",ToDoLogoOutline:"",VisioOnlineLogoFill32:"",VisioOnlineLogo32:"",VisioOnlineLogoCloud32:"",VisioDiagramSync:"",Event12:"",EventDateMissed12:"",UserOptional:"",ResponsesMenu:"",DoubleDownArrow:"",DistributeDown:"",BookmarkReport:"",FilterSettings:"",GripperDotsVertical:"",MailAttached:"",AddIn:"",LinkedDatabase:"",TableLink:"",PromotedDatabase:"",BarChartVerticalFilter:"",BarChartVerticalFilterSolid:"",MicOff2:"",MicrosoftTranslatorLogo:"",ShowTimeAs:"",FileRequest:"",WorkItemAlert:"",PowerBILogo16:"",PowerBILogoBackplate16:"",BulletedListText:"",BulletedListBullet:"",BulletedListTextMirrored:"",BulletedListBulletMirrored:"",NumberedListText:"",NumberedListNumber:"",NumberedListTextMirrored:"",NumberedListNumberMirrored:"",RemoveLinkChain:"",RemoveLinkX:"",FabricTextHighlight:"",ClearFormattingA:"",ClearFormattingEraser:"",Photo2Fill:"",IncreaseIndentText:"",IncreaseIndentArrow:"",DecreaseIndentText:"",DecreaseIndentArrow:"",IncreaseIndentTextMirrored:"",IncreaseIndentArrowMirrored:"",DecreaseIndentTextMirrored:"",DecreaseIndentArrowMirrored:"",CheckListText:"",CheckListCheck:"",CheckListTextMirrored:"",CheckListCheckMirrored:"",NumberSymbol:"",Coupon:"",VerifiedBrand:"",ReleaseGate:"",ReleaseGateCheck:"",ReleaseGateError:"",M365InvoicingLogo:"",RemoveFromShoppingList:"",ShieldAlert:"",FabricTextHighlightComposite:"",Dataflows:"",GenericScanFilled:"",DiagnosticDataBarTooltip:"",SaveToMobile:"",Orientation2:"",ScreenCast:"",ShowGrid:"",SnapToGrid:"",ContactList:"",NewMail:"",EyeShadow:"",FabricFolderConfirm:"",InformationBarriers:"",CommentActive:"",ColumnVerticalSectionEdit:"",WavingHand:"",ShakeDevice:"",SmartGlassRemote:"",Rotate90Clockwise:"",Rotate90CounterClockwise:"",CampaignTemplate:"",ChartTemplate:"",PageListFilter:"",SecondaryNav:"",ColumnVerticalSection:"",SkypeCircleSlash:"",SkypeSlash:""}},t)}function mS(e,t){void 0===e&&(e=""),mn({style:{MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",fontStyle:"normal",fontWeight:"normal",speak:"none"},fontFace:{fontFamily:'"FabricMDL2Icons-17"',src:"url('"+e+"fabric-icons-17-0c4ed701.woff') format('woff')"},icons:{CustomizeToolbar:"",DuplicateRow:"",RemoveFromTrash:"",MailOptions:"",Childof:"",Footer:"",Header:"",BarChartVerticalFill:"",StackedColumnChart2Fill:"",PlainText:"",AccessibiltyChecker:"",DatabaseSync:"",ReservationOrders:"",TabOneColumn:"",TabTwoColumn:"",TabThreeColumn:"",BulletedTreeList:"",MicrosoftTranslatorLogoGreen:"",MicrosoftTranslatorLogoBlue:"",InternalInvestigation:"",AddReaction:"",ContactHeart:"",VisuallyImpaired:"",EventToDoLogo:"",Variable2:"",ModelingView:"",DisconnectVirtualMachine:"",ReportLock:"",Uneditable2:"",Uneditable2Mirrored:"",BarChartVerticalEdit:"",GlobalNavButtonActive:"",PollResults:"",Rerun:"",QandA:"",QandAMirror:"",BookAnswers:"",AlertSettings:"",TrimStart:"",TrimEnd:"",TableComputed:"",DecreaseIndentLegacy:"",IncreaseIndentLegacy:"",SizeLegacy:""}},t)}function gS(e,t){void 0===e&&(e="https://spoppe-b.azureedge.net/files/fabric-cdn-prod_20210407.001/assets/icons/"),[X_,Q_,J_,$_,eS,tS,oS,nS,rS,iS,aS,sS,lS,cS,uS,dS,pS,hS,mS].forEach((function(o){return o(e,t)})),fn("trash","delete"),fn("onedrive","onedrivelogo"),fn("alertsolid12","eventdatemissed12"),fn("sixpointstar","6pointstar"),fn("twelvepointstar","12pointstar"),fn("toggleon","toggleleft"),fn("toggleoff","toggleright")}function fS(e){var t=nt().querySelectorAll(e);return Array.from(t).find((function(e){return Pa(e)}))}Pn("@fluentui/font-icons-mdl2","8.1.17");var vS=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.content,o=e.styles,n=e.theme,r=e.disabled,i=e.visible,a=Jn()(o,{theme:n,disabled:r,visible:i});return f.createElement("div",{className:a.container},f.createElement("span",{className:a.root},t))},t}(f.Component),bS=function(e){return{container:[],root:[{border:"none",boxShadow:"none"}],beak:[],beakCurtain:[],calloutMain:[{backgroundColor:"transparent"}]}},yS=function(e){return function(t){return In({container:[],root:[{border:"none",boxShadow:"none"}],beak:[],beakCurtain:[],calloutMain:[{backgroundColor:"transparent"}]},{root:[{marginLeft:e.left||e.x,marginTop:e.top||e.y}]})}},CS=Vn(vS,(function(e){var t,o=e.theme,n=e.disabled,r=e.visible;return{container:[{backgroundColor:o.palette.neutralDark},n&&{opacity:.5,selectors:(t={},t[ro]={color:"GrayText",opacity:1},t)},!r&&{visibility:"hidden"}],root:[o.fonts.medium,{textAlign:"center",paddingLeft:"3px",paddingRight:"3px",backgroundColor:o.palette.neutralDark,color:o.palette.neutralLight,minWidth:"11px",lineHeight:"17px",height:"17px",display:"inline-block"},n&&{color:o.palette.neutralTertiaryAlt}]}}),void 0,{scope:"KeytipContent"}),_S=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e,t=this.props,o=t.keySequences,n=t.offset,r=t.overflowSetSequence,i=this.props.calloutProps,a=fS(e=ou(r?tu(o,r):o));return a?(e=a,n&&(i=d(d({},i),{coverTarget:!0,directionalHint:Ys.topLeftEdge})),i&&void 0!==i.directionalHint||(i=d(d({},i),{directionalHint:Ys.bottomCenter})),f.createElement(kc,d({},i,{isBeakVisible:!1,doNotLayer:!0,minPagePadding:0,styles:n?yS(n):bS,preventDismissOnScroll:!0,target:e}),f.createElement(CS,d({},this.props)))):f.createElement(f.Fragment,null)},t}(f.Component);function SS(e){var t=iu(e),o=t.keytipId,n=t.ariaDescribedBy;return f.useCallback((function(e){if(e){var t=kS(e,Yc)||e,r=kS(e,Zc)||t,i=kS(e,Xc)||r;xS(t,Yc,o),xS(r,Zc,o),xS(i,"aria-describedby",n,!0)}}),[o,n])}function xS(e,t,o,n){if(void 0===n&&(n=!1),e&&o){var r=o;if(n){var i=e.getAttribute(t);i&&-1===i.indexOf(o)&&(r=i+" "+o)}e.setAttribute(t,r)}}function kS(e,t){return e.querySelector("["+t+"]")}var wS=function(e){return{root:[{zIndex:ko.KeytipLayer}]}},IS=function(){function e(){this.nodeMap={},this.root={id:Qc,children:[],parent:"",keySequences:[]},this.nodeMap[this.root.id]=this.root}return e.prototype.addNode=function(e,t,o){var n=this._getFullSequence(e),r=eu(n);n.pop();var i=this._getParentID(n),a=this._createNode(r,i,[],e,o);this.nodeMap[t]=a,this.getNodes([i]).forEach((function(e){return e.children.push(r)}))},e.prototype.updateNode=function(e,t){var o=this._getFullSequence(e),n=eu(o);o.pop();var r=this._getParentID(o),i=this.nodeMap[t],a=i.parent;i&&(a!==r&&this._removeChildFromParents(a,i.id),i.id!==n&&this.getNodes([r]).forEach((function(e){var t=e.children.indexOf(i.id);t>=0?e.children[t]=n:e.children.push(n)})),i.id=n,i.keySequences=e.keySequences,i.overflowSetSequence=e.overflowSetSequence,i.onExecute=e.onExecute,i.onReturn=e.onReturn,i.hasDynamicChildren=e.hasDynamicChildren,i.hasMenu=e.hasMenu,i.parent=r,i.disabled=e.disabled)},e.prototype.removeNode=function(e,t){var o=this._getFullSequence(e),n=eu(o);o.pop(),this._removeChildFromParents(this._getParentID(o),n),this.nodeMap[t]&&delete this.nodeMap[t]},e.prototype.getExactMatchedNode=function(e,t){var o=this,n=this.getNodes(t.children).filter((function(t){return o._getNodeSequence(t)===e&&!t.disabled}));if(0!==n.length){var r=n[0];if(1===n.length)return r;var i=r.keySequences,a=r.overflowSetSequence,s=ou(a?tu(i,a):i),l=document.querySelectorAll(s);if(n.length<l.length)return r;var c=Array.from(l).findIndex((function(e){return Pa(e)}));return-1!==c?n[c]:n.find((function(e){return e.hasOverflowSubMenu}))||r}},e.prototype.getPartiallyMatchedNodes=function(e,t){var o=this;return this.getNodes(t.children).filter((function(t){return 0===o._getNodeSequence(t).indexOf(e)&&!t.disabled}))},e.prototype.getChildren=function(e){var t=this;if(!e&&!(e=this.currentKeytip))return[];var o=e.children;return Object.keys(this.nodeMap).reduce((function(e,n){return o.indexOf(t.nodeMap[n].id)>=0&&!t.nodeMap[n].persisted&&e.push(t.nodeMap[n].id),e}),[])},e.prototype.getNodes=function(e){var t=this;return Object.keys(this.nodeMap).reduce((function(o,n){return e.indexOf(t.nodeMap[n].id)>=0&&o.push(t.nodeMap[n]),o}),[])},e.prototype.getNode=function(e){return aa(Hs(this.nodeMap),(function(t){return t.id===e}))},e.prototype.isCurrentKeytipParent=function(e){if(this.currentKeytip){var t=m(e.keySequences);e.overflowSetSequence&&(t=tu(t,e.overflowSetSequence)),t.pop();var o=0===t.length?this.root.id:eu(t),n=!1;return this.currentKeytip.overflowSetSequence&&(n=eu(this.currentKeytip.keySequences)===o),n||this.currentKeytip.id===o}return!1},e.prototype._getParentID=function(e){return 0===e.length?this.root.id:eu(e)},e.prototype._getFullSequence=function(e){var t=m(e.keySequences);return e.overflowSetSequence&&(t=tu(t,e.overflowSetSequence)),t},e.prototype._getNodeSequence=function(e){var t=m(e.keySequences);return e.overflowSetSequence&&(t=tu(t,e.overflowSetSequence)),t[t.length-1]},e.prototype._createNode=function(e,t,o,n,r){var i=this,a=n.keySequences,s=n.hasDynamicChildren,l=n.overflowSetSequence,c=n.hasMenu,u=n.onExecute,d=n.onReturn,p=n.disabled,h=n.hasOverflowSubMenu,m={id:e,keySequences:a,overflowSetSequence:l,parent:t,children:o,onExecute:u,onReturn:d,hasDynamicChildren:s,hasMenu:c,disabled:p,persisted:r,hasOverflowSubMenu:h};return m.children=Object.keys(this.nodeMap).reduce((function(t,o){return i.nodeMap[o].parent===e&&t.push(i.nodeMap[o].id),t}),[]),m},e.prototype._removeChildFromParents=function(e,t){this.getNodes([e]).forEach((function(e){var o=e.children.indexOf(t);o>=0&&e.children.splice(o,1)}))},e}();function DS(e,t){if(e.key!==t.key)return!1;var o=e.modifierKeys,n=t.modifierKeys;if(!o&&n||o&&!n)return!1;if(o&&n){if(o.length!==n.length)return!1;o=o.sort(),n=n.sort();for(var r=0;r<o.length;r++)if(o[r]!==n[r])return!1}return!0}function TS(e,t){return!!aa(e,(function(e){return DS(e,t)}))}var ES={key:Zs()?"Control":"Meta",modifierKeys:[Gn.alt]},PS=ES,RS={key:"Escape"},MS=Jn(),NS=function(e){function t(t,o){var n=e.call(this,t,o)||this;n._keytipManager=$c.getInstance(),n._delayedKeytipQueue=[],n._keyHandled=!1,n._onDismiss=function(e){n.state.inKeytipMode&&n._exitKeytipMode(e)},n._onKeyDown=function(e){n._keyHandled=!1;var t=e.key;switch(t){case"Tab":case"Enter":case"Spacebar":case" ":case"ArrowUp":case"Up":case"ArrowDown":case"Down":case"ArrowLeft":case"Left":case"ArrowRight":case"Right":n.state.inKeytipMode&&(n._keyHandled=!0,n._exitKeytipMode(e));break;default:"Esc"===t?t="Escape":"OS"!==t&&"Win"!==t||(t="Meta");var o={key:t};o.modifierKeys=n._getModifierKey(t,e),n.processTransitionInput(o,e)}},n._onKeyPress=function(e){n.state.inKeytipMode&&!n._keyHandled&&(n.processInput(e.key.toLocaleLowerCase(),e),e.preventDefault(),e.stopPropagation())},n._onKeytipAdded=function(e){var t,o=e.keytip,r=e.uniqueID;if(n._keytipTree.addNode(o,r),n._setKeytips(),n._keytipTree.isCurrentKeytipParent(o)&&(n._delayedKeytipQueue=n._delayedKeytipQueue.concat((null===(t=n._keytipTree.currentKeytip)||void 0===t?void 0:t.children)||[]),n._addKeytipToQueue(eu(o.keySequences)),n._keytipTree.currentKeytip&&n._keytipTree.currentKeytip.hasDynamicChildren&&n._keytipTree.currentKeytip.children.indexOf(o.id)<0)){var i=n._keytipTree.getNode(n._keytipTree.currentKeytip.id);i&&(n._keytipTree.currentKeytip=i)}n._persistedKeytipChecks(o)},n._onKeytipUpdated=function(e){var t,o=e.keytip,r=e.uniqueID;n._keytipTree.updateNode(o,r),n._setKeytips(),n._keytipTree.isCurrentKeytipParent(o)&&(n._delayedKeytipQueue=n._delayedKeytipQueue.concat((null===(t=n._keytipTree.currentKeytip)||void 0===t?void 0:t.children)||[]),n._addKeytipToQueue(eu(o.keySequences))),n._persistedKeytipChecks(o)},n._persistedKeytipChecks=function(e){if(n._newCurrentKeytipSequences&&ha(e.keySequences,n._newCurrentKeytipSequences)&&n._triggerKeytipImmediately(e),n._isCurrentKeytipAnAlias(e)){var t=e.keySequences;e.overflowSetSequence&&(t=tu(t,e.overflowSetSequence)),n._keytipTree.currentKeytip=n._keytipTree.getNode(eu(t))}},n._onKeytipRemoved=function(e){var t=e.keytip,o=e.uniqueID;n._removeKeytipFromQueue(eu(t.keySequences)),n._keytipTree.removeNode(t,o),n._setKeytips()},n._onPersistedKeytipAdded=function(e){var t=e.keytip,o=e.uniqueID;n._keytipTree.addNode(t,o,!0)},n._onPersistedKeytipRemoved=function(e){var t=e.keytip,o=e.uniqueID;n._keytipTree.removeNode(t,o)},n._onPersistedKeytipExecute=function(e){n._persistedKeytipExecute(e.overflowButtonSequences,e.keytipSequences)},n._setInKeytipMode=function(e){n.setState({inKeytipMode:e}),n._keytipManager.inKeytipMode=e},n._warnIfDuplicateKeytips=function(){var e=n._getDuplicateIds(n._keytipTree.getChildren());e.length&&cn("Duplicate keytips found for "+e.join(", "))},n._getDuplicateIds=function(e){var t={};return e.filter((function(e){return t[e]=t[e]?t[e]+1:1,2===t[e]}))},Gi(n),n._events=new zs(n),n._async=new Zi(n);var r=n._keytipManager.getKeytips();return n.state={inKeytipMode:!1,keytips:r,visibleKeytips:n._getVisibleKeytips(r)},n._buildTree(),n._currentSequence="",n._events.on(n._keytipManager,wc.KEYTIP_ADDED,n._onKeytipAdded),n._events.on(n._keytipManager,wc.KEYTIP_UPDATED,n._onKeytipUpdated),n._events.on(n._keytipManager,wc.KEYTIP_REMOVED,n._onKeytipRemoved),n._events.on(n._keytipManager,wc.PERSISTED_KEYTIP_ADDED,n._onPersistedKeytipAdded),n._events.on(n._keytipManager,wc.PERSISTED_KEYTIP_REMOVED,n._onPersistedKeytipRemoved),n._events.on(n._keytipManager,wc.PERSISTED_KEYTIP_EXECUTE,n._onPersistedKeytipExecute),n}return u(t,e),t.prototype.render=function(){var e=this,t=this.props,o=t.content,n=t.styles,r=this.state,i=r.keytips,a=r.visibleKeytips;return this._classNames=MS(n,{}),f.createElement(xc,{styles:wS},f.createElement("span",{id:Qc,className:this._classNames.innerContent},""+o+Jc),i&&i.map((function(t,o){return f.createElement("span",{key:o,id:eu(t.keySequences),className:e._classNames.innerContent},t.keySequences.join(Jc))})),a&&a.map((function(e){return f.createElement(_S,d({key:eu(e.keySequences)},e))})))},t.prototype.componentDidMount=function(){this._events.on(window,"mouseup",this._onDismiss,!0),this._events.on(window,"pointerup",this._onDismiss,!0),this._events.on(window,"resize",this._onDismiss),this._events.on(window,"keydown",this._onKeyDown,!0),this._events.on(window,"keypress",this._onKeyPress,!0),this._events.on(window,"scroll",this._onDismiss,!0),this._events.on(this._keytipManager,wc.ENTER_KEYTIP_MODE,this._enterKeytipMode),this._events.on(this._keytipManager,wc.EXIT_KEYTIP_MODE,this._exitKeytipMode)},t.prototype.componentWillUnmount=function(){this._async.dispose(),this._events.dispose()},t.prototype.getCurrentSequence=function(){return this._currentSequence},t.prototype.getKeytipTree=function(){return this._keytipTree},t.prototype.processTransitionInput=function(e,t){var o=this._keytipTree.currentKeytip;TS(this.props.keytipExitSequences,e)&&o?(this._keyHandled=!0,this._exitKeytipMode(t)):TS(this.props.keytipReturnSequences,e)?o&&(this._keyHandled=!0,o.id===this._keytipTree.root.id?this._exitKeytipMode(t):(o.onReturn&&o.onReturn(this._getKtpExecuteTarget(o),this._getKtpTarget(o)),this._currentSequence="",this._keytipTree.currentKeytip=this._keytipTree.getNode(o.parent),this.showKeytips(this._keytipTree.getChildren()),this._warnIfDuplicateKeytips())):TS(this.props.keytipStartSequences,e)&&!o&&(this._keyHandled=!0,this._enterKeytipMode(e),this._warnIfDuplicateKeytips())},t.prototype.processInput=function(e,t){var o=this._currentSequence+e,n=this._keytipTree.currentKeytip;if(n){var r=this._keytipTree.getExactMatchedNode(o,n);if(r){this._keytipTree.currentKeytip=n=r;var i=this._keytipTree.getChildren();return n.onExecute&&(n.onExecute(this._getKtpExecuteTarget(n),this._getKtpTarget(n)),n=this._keytipTree.currentKeytip),0!==i.length||n.hasDynamicChildren||n.hasMenu?(this.showKeytips(i),this._warnIfDuplicateKeytips()):this._exitKeytipMode(t),void(this._currentSequence="")}var a=this._keytipTree.getPartiallyMatchedNodes(o,n);if(a.length>0){var s=a.filter((function(e){return!e.persisted})).map((function(e){return e.id}));this.showKeytips(s),this._currentSequence=o}}},t.prototype.showKeytips=function(e){for(var t=0,o=this._keytipManager.getKeytips();t<o.length;t++){var n=o[t],r=eu(n.keySequences);n.overflowSetSequence&&(r=eu(tu(n.keySequences,n.overflowSetSequence))),e.indexOf(r)>=0?n.visible=!0:n.visible=!1}this._setKeytips()},t.prototype._enterKeytipMode=function(e){this._keytipManager.shouldEnterKeytipMode&&(this._keytipManager.delayUpdatingKeytipChange&&(this._buildTree(),this._setKeytips()),this._keytipTree.currentKeytip=this._keytipTree.root,this.showKeytips(this._keytipTree.getChildren()),this._setInKeytipMode(!0),this.props.onEnterKeytipMode&&this.props.onEnterKeytipMode(e))},t.prototype._buildTree=function(){this._keytipTree=new IS;for(var e=0,t=Object.keys(this._keytipManager.keytips);e<t.length;e++){var o=t[e],n=this._keytipManager.keytips[o];this._keytipTree.addNode(n.keytip,n.uniqueID)}for(var r=0,i=Object.keys(this._keytipManager.persistedKeytips);r<i.length;r++)o=i[r],n=this._keytipManager.persistedKeytips[o],this._keytipTree.addNode(n.keytip,n.uniqueID)},t.prototype._exitKeytipMode=function(e){this._keytipTree.currentKeytip=void 0,this._currentSequence="",this.showKeytips([]),this._delayedQueueTimeout&&this._async.clearTimeout(this._delayedQueueTimeout),this._delayedKeytipQueue=[],this._setInKeytipMode(!1),this.props.onExitKeytipMode&&this.props.onExitKeytipMode(e)},t.prototype._setKeytips=function(e){void 0===e&&(e=this._keytipManager.getKeytips()),this.setState({keytips:e,visibleKeytips:this._getVisibleKeytips(e)})},t.prototype._persistedKeytipExecute=function(e,t){this._newCurrentKeytipSequences=t;var o=this._keytipTree.getNode(eu(e));o&&o.onExecute&&o.onExecute(this._getKtpExecuteTarget(o),this._getKtpTarget(o))},t.prototype._getVisibleKeytips=function(e){var t={};return e.filter((function(e){var o=eu(e.keySequences);return e.overflowSetSequence&&(o=eu(tu(e.keySequences,e.overflowSetSequence))),t[o]=t[o]?t[o]+1:1,e.visible&&1===t[o]}))},t.prototype._getModifierKey=function(e,t){var o=[];return t.altKey&&"Alt"!==e&&o.push(Gn.alt),t.ctrlKey&&"Control"!==e&&o.push(Gn.ctrl),t.shiftKey&&"Shift"!==e&&o.push(Gn.shift),t.metaKey&&"Meta"!==e&&o.push(Gn.leftWindow),o.length?o:void 0},t.prototype._triggerKeytipImmediately=function(e){var t=m(e.keySequences);if(e.overflowSetSequence&&(t=tu(t,e.overflowSetSequence)),this._keytipTree.currentKeytip=this._keytipTree.getNode(eu(t)),this._keytipTree.currentKeytip){var o=this._keytipTree.getChildren();o.length&&this.showKeytips(o),this._keytipTree.currentKeytip.onExecute&&this._keytipTree.currentKeytip.onExecute(this._getKtpExecuteTarget(this._keytipTree.currentKeytip),this._getKtpTarget(this._keytipTree.currentKeytip))}this._newCurrentKeytipSequences=void 0},t.prototype._addKeytipToQueue=function(e){var t=this;this._delayedKeytipQueue.push(e),this._delayedQueueTimeout&&this._async.clearTimeout(this._delayedQueueTimeout),this._delayedQueueTimeout=this._async.setTimeout((function(){t._delayedKeytipQueue.length&&(t.showKeytips(t._delayedKeytipQueue),t._delayedKeytipQueue=[])}),300)},t.prototype._removeKeytipFromQueue=function(e){var t=this,o=this._delayedKeytipQueue.indexOf(e);o>=0&&(this._delayedKeytipQueue.splice(o,1),this._delayedQueueTimeout&&this._async.clearTimeout(this._delayedQueueTimeout),this._delayedQueueTimeout=this._async.setTimeout((function(){t._delayedKeytipQueue.length&&(t.showKeytips(t._delayedKeytipQueue),t._delayedKeytipQueue=[])}),300))},t.prototype._getKtpExecuteTarget=function(e){return nt().querySelector(nu(e.id))},t.prototype._getKtpTarget=function(e){return nt().querySelector(ou(e.keySequences))},t.prototype._isCurrentKeytipAnAlias=function(e){var t=this._keytipTree.currentKeytip;return!(!t||!t.overflowSetSequence&&!t.persisted||!ha(e.keySequences,t.keySequences))},t.defaultProps={keytipStartSequences:[ES],keytipExitSequences:[PS],keytipReturnSequences:[RS],content:""},t}(f.Component),BS=Vn(NS,(function(e){return{innerContent:[{position:"absolute",width:0,height:0,margin:0,padding:0,border:0,overflow:"hidden",visibility:"hidden"}]}}),void 0,{scope:"KeytipLayer"});function FS(e){for(var t={},o=0,n=e.keytips;o<n.length;o++)AS(t,[],n[o]);return t}function AS(e,t,o){var n=o.sequence?o.sequence:o.content.toLocaleLowerCase(),r=t.concat(n),i=d(d({},o.optionalProps),{keySequences:r,content:o.content});if(e[o.id]=i,o.children)for(var a=0,s=o.children;a<s.length;a++)AS(e,r,s[a])}Pn("@fluentui/react","8.42.2");var LS=function(e){var t=e.id,o=e.className;return f.useEffect((function(){vc(t)}),[]),HS((function(){vc(t)})),f.createElement("div",d({},e,{className:qr("ms-LayerHost",o)}))},HS=function(e){var t=f.useRef(e);t.current=e,f.useEffect((function(){return function(){t.current&&t.current()}}),[])},OS=100,zS=function(){function e(e){this._events=new zs(this),this._scrollableParent=ts(e),this._incrementScroll=this._incrementScroll.bind(this),this._scrollRect=Db(this._scrollableParent),this._scrollableParent===window&&(this._scrollableParent=document.body),this._scrollableParent&&(this._events.on(window,"mousemove",this._onMouseMove,!0),this._events.on(window,"touchmove",this._onTouchMove,!0))}return e.prototype.dispose=function(){this._events.dispose(),this._stopScroll()},e.prototype._onMouseMove=function(e){this._computeScrollVelocity(e)},e.prototype._onTouchMove=function(e){e.touches.length>0&&this._computeScrollVelocity(e)},e.prototype._computeScrollVelocity=function(e){if(this._scrollRect){var t,o;"clientX"in e?(t=e.clientX,o=e.clientY):(t=e.touches[0].clientX,o=e.touches[0].clientY);var n,r,i,a=this._scrollRect.top,s=this._scrollRect.left,l=a+this._scrollRect.height-OS,c=s+this._scrollRect.width-OS;o<a+OS||o>l?(r=o,n=a,i=l,this._isVerticalScroll=!0):(r=t,n=s,i=c,this._isVerticalScroll=!1),this._scrollVelocity=r<n+OS?Math.max(-15,(OS-(r-n))/OS*-15):r>i?Math.min(15,(r-i)/OS*15):0,this._scrollVelocity?this._startScroll():this._stopScroll()}},e.prototype._startScroll=function(){this._timeoutId||this._incrementScroll()},e.prototype._incrementScroll=function(){this._scrollableParent&&(this._isVerticalScroll?this._scrollableParent.scrollTop+=Math.round(this._scrollVelocity):this._scrollableParent.scrollLeft+=Math.round(this._scrollVelocity)),this._timeoutId=setTimeout(this._incrementScroll,16)},e.prototype._stopScroll=function(){this._timeoutId&&(clearTimeout(this._timeoutId),delete this._timeoutId)},e}();function WS(e,t){var o=e.left||e.x||0,n=e.top||e.y||0,r=t.left||t.x||0,i=t.top||t.y||0;return Math.sqrt(Math.pow(o-r,2)+Math.pow(n-i,2))}function VS(e){var t,o=e.contentSize,n=e.boundsSize,r=e.mode,i=void 0===r?"contain":r,a=e.maxScale,s=void 0===a?1:a,l=o.width/o.height,c=n.width/n.height;t=("contain"===i?l>c:l<c)?n.width/o.width:n.height/o.height;var u=Math.min(s,t);return{width:o.width*u,height:o.height*u}}function KS(e){var t=/[1-9]([0]+$)|\.([0-9]*)/.exec(String(e));return t?t[1]?-t[1].length:t[2]?t[2].length:0:0}function GS(e,t,o){void 0===o&&(o=10);var n=Math.pow(o,t);return Math.round(e*n)/n}var US,jS,qS=Jn(),YS=Vn(function(e){function t(t){var o=e.call(this,t)||this;return o._root=f.createRef(),o._onMouseDown=function(e){var t=o.props,n=t.isEnabled,r=t.onShouldStartSelection;o._isMouseEventOnScrollbar(e)||o._isInSelectionToggle(e)||o._isTouch||!n||o._isDragStartInSelection(e)||r&&!r(e)||o._scrollableSurface&&0===e.button&&o._root.current&&(o._selectedIndicies={},o._preservedIndicies=void 0,o._events.on(window,"mousemove",o._onAsyncMouseMove,!0),o._events.on(o._scrollableParent,"scroll",o._onAsyncMouseMove),o._events.on(window,"click",o._onMouseUp,!0),o._autoScroll=new zS(o._root.current),o._scrollTop=o._scrollableSurface.scrollTop,o._scrollLeft=o._scrollableSurface.scrollLeft,o._rootRect=o._root.current.getBoundingClientRect(),o._onMouseMove(e))},o._onTouchStart=function(e){o._isTouch=!0,o._async.setTimeout((function(){o._isTouch=!1}),0)},o._onPointerDown=function(e){"touch"===e.pointerType&&(o._isTouch=!0,o._async.setTimeout((function(){o._isTouch=!1}),0))},Gi(o),o._async=new Zi(o),o._events=new zs(o),o.state={dragRect:void 0},o}return u(t,e),t.prototype.componentDidMount=function(){this._scrollableParent=ts(this._root.current),this._scrollableSurface=this._scrollableParent===window?document.body:this._scrollableParent;var e=this.props.isDraggingConstrainedToRoot?this._root.current:this._scrollableSurface;this._events.on(e,"mousedown",this._onMouseDown),this._events.on(e,"touchstart",this._onTouchStart,!0),this._events.on(e,"pointerdown",this._onPointerDown,!0)},t.prototype.componentWillUnmount=function(){this._autoScroll&&this._autoScroll.dispose(),delete this._scrollableParent,delete this._scrollableSurface,this._events.dispose(),this._async.dispose()},t.prototype.render=function(){var e=this.props,t=e.rootProps,o=e.children,n=e.theme,r=e.className,i=e.styles,a=this.state.dragRect,s=qS(i,{theme:n,className:r});return f.createElement("div",d({},t,{className:s.root,ref:this._root}),o,a&&f.createElement("div",{className:s.dragMask}),a&&f.createElement("div",{className:s.box,style:a},f.createElement("div",{className:s.boxFill})))},t.prototype._isMouseEventOnScrollbar=function(e){var t=e.target,o=t.offsetWidth-t.clientWidth,n=t.offsetHeight-t.clientHeight;if(o||n){var r=t.getBoundingClientRect();if(jn(this.props.theme)){if(e.clientX<r.left+o)return!0}else if(e.clientX>r.left+t.clientWidth)return!0;if(e.clientY>r.top+t.clientHeight)return!0}return!1},t.prototype._getRootRect=function(){return{left:this._rootRect.left+(this._scrollableSurface?this._scrollLeft-this._scrollableSurface.scrollLeft:this._scrollLeft),top:this._rootRect.top+(this._scrollableSurface?this._scrollTop-this._scrollableSurface.scrollTop:this._scrollTop),width:this._rootRect.width,height:this._rootRect.height}},t.prototype._onAsyncMouseMove=function(e){var t=this;this._async.requestAnimationFrame((function(){t._onMouseMove(e)})),e.stopPropagation(),e.preventDefault()},t.prototype._onMouseMove=function(e){if(this._autoScroll){void 0!==e.clientX&&(this._lastMouseEvent=e);var t=this._getRootRect(),o={left:e.clientX-t.left,top:e.clientY-t.top};if(this._dragOrigin||(this._dragOrigin=o),void 0!==e.buttons&&0===e.buttons)this._onMouseUp(e);else if(this.state.dragRect||WS(this._dragOrigin,o)>5){if(!this.state.dragRect){var n=this.props.selection;e.shiftKey||n.setAllSelected(!1),this._preservedIndicies=n&&n.getSelectedIndices&&n.getSelectedIndices()}var r=this.props.isDraggingConstrainedToRoot?{left:Math.max(0,Math.min(t.width,this._lastMouseEvent.clientX-t.left)),top:Math.max(0,Math.min(t.height,this._lastMouseEvent.clientY-t.top))}:{left:this._lastMouseEvent.clientX-t.left,top:this._lastMouseEvent.clientY-t.top},i={left:Math.min(this._dragOrigin.left||0,r.left),top:Math.min(this._dragOrigin.top||0,r.top),width:Math.abs(r.left-(this._dragOrigin.left||0)),height:Math.abs(r.top-(this._dragOrigin.top||0))};this._evaluateSelection(i,t),this.setState({dragRect:i})}return!1}},t.prototype._onMouseUp=function(e){this._events.off(window),this._events.off(this._scrollableParent,"scroll"),this._autoScroll&&this._autoScroll.dispose(),this._autoScroll=this._dragOrigin=this._lastMouseEvent=void 0,this._selectedIndicies=this._itemRectCache=void 0,this.state.dragRect&&(this.setState({dragRect:void 0}),e.preventDefault(),e.stopPropagation())},t.prototype._isPointInRectangle=function(e,t){return!!t.top&&e.top<t.top&&e.bottom>t.top&&!!t.left&&e.left<t.left&&e.right>t.left},t.prototype._isDragStartInSelection=function(e){var t=this.props.selection;if(!this._root.current||t&&0===t.getSelectedCount())return!1;for(var o=this._root.current.querySelectorAll("[data-selection-index]"),n=0;n<o.length;n++){var r=o[n],i=Number(r.getAttribute("data-selection-index"));if(t.isIndexSelected(i)){var a=r.getBoundingClientRect();if(this._isPointInRectangle(a,{left:e.clientX,top:e.clientY}))return!0}}return!1},t.prototype._isInSelectionToggle=function(e){for(var t=e.target;t&&t!==this._root.current;){if("true"===t.getAttribute("data-selection-toggle"))return!0;t=t.parentElement}return!1},t.prototype._evaluateSelection=function(e,t){if(e&&this._root.current){var o=this.props.selection,n=this._root.current.querySelectorAll("[data-selection-index]");this._itemRectCache||(this._itemRectCache={});for(var r=0;r<n.length;r++){var i=n[r],a=i.getAttribute("data-selection-index"),s=this._itemRectCache[a];s||(s={left:(s=i.getBoundingClientRect()).left-t.left,top:s.top-t.top,width:s.width,height:s.height,right:s.left-t.left+s.width,bottom:s.top-t.top+s.height}).width>0&&s.height>0&&(this._itemRectCache[a]=s),s.top<e.top+e.height&&s.bottom>e.top&&s.left<e.left+e.width&&s.right>e.left?this._selectedIndicies[a]=!0:delete this._selectedIndicies[a]}var l=this._allSelectedIndices||{};for(var a in this._allSelectedIndices={},this._selectedIndicies)this._selectedIndicies.hasOwnProperty(a)&&(this._allSelectedIndices[a]=!0);if(this._preservedIndicies)for(var c=0,u=this._preservedIndicies;c<u.length;c++)a=u[c],this._allSelectedIndices[a]=!0;var d=!1;for(var a in this._allSelectedIndices)if(this._allSelectedIndices[a]!==l[a]){d=!0;break}if(!d)for(var a in l)if(this._allSelectedIndices[a]!==l[a]){d=!0;break}if(d){o.setChangeEvents(!1),o.setAllSelected(!1);for(var p=0,h=Object.keys(this._allSelectedIndices);p<h.length;p++)a=h[p],o.setIndexSelected(Number(a),!0,!1);o.setChangeEvents(!0)}}},t.defaultProps={rootTagName:"div",rootProps:{},isEnabled:!0},t}(f.Component),(function(e){var t,o,n,r=e.theme,i=e.className,a=r.palette;return{root:[i,{position:"relative",cursor:"default"}],dragMask:[{position:"absolute",background:"rgba(255, 0, 0, 0)",left:0,top:0,right:0,bottom:0,selectors:(t={},t[ro]={background:"none",backgroundColor:"transparent"},t)}],box:[{position:"absolute",boxSizing:"border-box",border:"1px solid "+a.themePrimary,pointerEvents:"none",zIndex:10,selectors:(o={},o[ro]={borderColor:"Highlight"},o)}],boxFill:[{position:"absolute",boxSizing:"border-box",backgroundColor:a.themePrimary,opacity:.1,left:0,top:0,right:0,bottom:0,selectors:(n={},n[ro]={background:"none",backgroundColor:"transparent"},n)}]}}),void 0,{scope:"MarqueeSelection"});!function(e){e[e.info=0]="info",e[e.error=1]="error",e[e.blocked=2]="blocked",e[e.severeWarning=3]="severeWarning",e[e.success=4]="success",e[e.warning=5]="warning"}(US||(US={}));var ZS,XS,QS,JS=((jS={})[US.info]="Info",jS[US.warning]="Info",jS[US.error]="ErrorBadge",jS[US.blocked]="Blocked2",jS[US.severeWarning]="Warning",jS[US.success]="Completed",jS),$S=Jn(),ex=function(e){switch(e){case US.blocked:case US.error:case US.severeWarning:return"assertive"}return"polite"},tx=function(e){switch(e){case US.blocked:case US.error:case US.severeWarning:return"alert"}return"status"},ox=f.forwardRef((function(e,t){var o=Yb(!1),n=o[0],r=o[1].toggle,i=hu("MessageBar"),a=e.actions,s=e.className,l=e.children,c=e.overflowButtonAriaLabel,u=e.dismissIconProps,p=e.styles,h=e.theme,m=e.messageBarType,g=void 0===m?US.info:m,v=e.onDismiss,b=void 0===v?void 0:v,y=e.isMultiline,C=void 0===y||y,_=e.truncated,S=e.dismissButtonAriaLabel,x=e.messageBarIconProps,k=e.role,w=e.delayedRender,I=void 0===w||w,D=Tr(e,ir,["className","role"]),T=$S(p,{theme:h,messageBarType:g||US.info,onDismiss:void 0!==b,actions:void 0!==a,truncated:_,isMultiline:C,expandSingleLine:n,className:s}),E={iconName:n?"DoubleChevronUp":"DoubleChevronDown"},P=a||b?{"aria-describedby":i,role:"region"}:{},R=a?f.createElement("div",{className:T.actions},a):null,M=b?f.createElement(id,{disabled:!1,className:T.dismissal,onClick:b,iconProps:u||{iconName:"Clear"},title:S,ariaLabel:S}):null;return f.createElement("div",d({ref:t,className:T.root},P),f.createElement("div",{className:T.content},f.createElement("div",{className:T.iconContainer,"aria-hidden":!0},x?f.createElement(ii,d({},x,{className:qr(T.icon,x.className)})):f.createElement(ii,{iconName:JS[g],className:T.icon})),f.createElement("div",{className:T.text,id:i,role:k||tx(g),"aria-live":ex(g)},f.createElement("span",d({className:T.innerText},D),I?f.createElement(ea,null,f.createElement("span",null,l)):f.createElement("span",null,l))),!C&&!R&&_&&f.createElement("div",{className:T.expandSingleLine},f.createElement(id,{disabled:!1,className:T.expand,onClick:r,iconProps:E,ariaLabel:c,"aria-expanded":n})),!C&&R,!C&&M&&f.createElement("div",{className:T.dismissSingleLine},M),C&&M),C&&R)}));ox.displayName="MessageBar";var nx,rx={root:"ms-MessageBar",error:"ms-MessageBar--error",blocked:"ms-MessageBar--blocked",severeWarning:"ms-MessageBar--severeWarning",success:"ms-MessageBar--success",warning:"ms-MessageBar--warning",multiline:"ms-MessageBar-multiline",singleline:"ms-MessageBar-singleline",dismissalSingleLine:"ms-MessageBar-dismissalSingleLine",expandingSingleLine:"ms-MessageBar-expandingSingleLine",content:"ms-MessageBar-content",iconContainer:"ms-MessageBar-icon",text:"ms-MessageBar-text",innerText:"ms-MessageBar-innerText",dismissSingleLine:"ms-MessageBar-dismissSingleLine",expandSingleLine:"ms-MessageBar-expandSingleLine",dismissal:"ms-MessageBar-dismissal",expand:"ms-MessageBar-expand",actions:"ms-MessageBar-actions",actionsSingleline:"ms-MessageBar-actionsSingleLine"},ix=((ZS={})[US.error]="errorBackground",ZS[US.blocked]="errorBackground",ZS[US.success]="successBackground",ZS[US.warning]="warningBackground",ZS[US.severeWarning]="severeWarningBackground",ZS[US.info]="infoBackground",ZS),ax=((XS={})[US.error]="rgba(255, 0, 0, 0.3)",XS[US.blocked]="rgba(255, 0, 0, 0.3)",XS[US.success]="rgba(48, 241, 73, 0.3)",XS[US.warning]="rgba(255, 254, 57, 0.3)",XS[US.severeWarning]="rgba(255, 0, 0, 0.3)",XS[US.info]="Window",XS),sx=((QS={})[US.error]="errorIcon",QS[US.blocked]="errorIcon",QS[US.success]="successIcon",QS[US.warning]="warningIcon",QS[US.severeWarning]="severeWarningIcon",QS[US.info]="infoIcon",QS),lx=Vn(ox,(function(e){var t,o,n,r,i,a=e.theme,s=e.className,l=e.onDismiss,c=e.truncated,u=e.isMultiline,p=e.expandSingleLine,h=e.messageBarType,m=void 0===h?US.info:h,g=a.semanticColors,f=a.fonts,v=_o(0,go),b=Qo(rx,a),y={fontSize:Ye.xSmall,height:10,lineHeight:"10px",color:g.messageText,selectors:(t={},t[ro]=d(d({},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),{color:"WindowText"}),t)},C=[To(a,{inset:1,highContrastStyle:{outlineOffset:"-6px",outline:"1px solid Highlight"},borderColor:"transparent"}),{flexShrink:0,width:32,height:32,padding:"8px 12px",selectors:{"& .ms-Button-icon":y,":hover":{backgroundColor:"transparent"},":active":{backgroundColor:"transparent"}}}];return{root:[b.root,f.medium,m===US.error&&b.error,m===US.blocked&&b.blocked,m===US.severeWarning&&b.severeWarning,m===US.success&&b.success,m===US.warning&&b.warning,u?b.multiline:b.singleline,!u&&l&&b.dismissalSingleLine,!u&&c&&b.expandingSingleLine,{background:g[ix[m]],color:g.messageText,minHeight:32,width:"100%",display:"flex",wordBreak:"break-word",selectors:(o={".ms-Link":{color:g.messageLink,selectors:{":hover":{color:g.messageLinkHovered}}}},o[ro]=d(d({},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),{background:ax[m],border:"1px solid WindowText",color:"WindowText"}),o)},u&&{flexDirection:"column"},s],content:[b.content,{display:"flex",width:"100%",lineHeight:"normal"}],iconContainer:[b.iconContainer,{fontSize:Ye.medium,minWidth:16,minHeight:16,display:"flex",flexShrink:0,margin:"8px 0 8px 12px"}],icon:{color:g[sx[m]],selectors:(n={},n[ro]=d(d({},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),{color:"WindowText"}),n)},text:[b.text,d(d({minWidth:0,display:"flex",flexGrow:1,margin:8},f.small),{selectors:(r={},r[ro]=d({},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),r)}),!l&&{marginRight:12}],innerText:[b.innerText,{lineHeight:16,selectors:{"& span a:last-child":{paddingLeft:4}}},c&&{overflow:"visible",whiteSpace:"pre-wrap"},!u&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},!u&&!c&&{selectors:(i={},i[v]={overflow:"visible",whiteSpace:"pre-wrap"},i)},p&&{overflow:"visible",whiteSpace:"pre-wrap"}],dismissSingleLine:b.dismissSingleLine,expandSingleLine:b.expandSingleLine,dismissal:[b.dismissal,C],expand:[b.expand,C],actions:[u?b.actions:b.actionsSingleline,{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto",flexDirection:"row-reverse",alignItems:"center",margin:"0 12px 0 8px",selectors:{"& button:nth-child(n+2)":{marginLeft:8}}},u&&{marginBottom:8},l&&!u&&{marginRight:0}]}}),void 0,{scope:"MessageBar"}),cx={root:"ms-Nav",linkText:"ms-Nav-linkText",compositeLink:"ms-Nav-compositeLink",link:"ms-Nav-link",chevronButton:"ms-Nav-chevronButton",chevronIcon:"ms-Nav-chevron",navItem:"ms-Nav-navItem",navItems:"ms-Nav-navItems",group:"ms-Nav-group",groupContent:"ms-Nav-groupContent"},ux={textContainer:{overflow:"hidden"},label:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"}};function dx(e){return!!e&&!/^[a-z0-9+-.]+:\/\//i.test(e)}var px,hx=Jn(),mx=function(e){function t(t){var o=e.call(this,t)||this;return o._focusZone=f.createRef(),o._onRenderLink=function(e){var t=o.props,n=t.styles,r=t.groups,i=t.theme,a=hx(n,{theme:i,groups:r});return f.createElement("div",{className:a.linkText},e.name)},o._renderGroup=function(e,t){var n=o.props,r=n.styles,i=n.groups,a=n.theme,s=n.onRenderGroupHeader,l=void 0===s?o._renderGroupHeader:s,c=o._isGroupExpanded(e),u=hx(r,{theme:a,isGroup:!0,isExpanded:c,groups:i}),p=d(d({},e),{isExpanded:c,onHeaderClick:function(t,n){o._onGroupHeaderClicked(e,t)}});return f.createElement("div",{key:t,className:u.group},p.name?l(p,o._renderGroupHeader):null,f.createElement("div",{className:u.groupContent},o._renderLinks(p.links,0)))},o._renderGroupHeader=function(e){var t=o.props,n=t.styles,r=t.groups,i=t.theme,a=t.expandButtonAriaLabel,s=e.isExpanded,l=hx(n,{theme:i,isGroup:!0,isExpanded:s,groups:r}),c=(s?e.collapseAriaLabel:e.expandAriaLabel)||a,u=e.onHeaderClick,d=u?function(e){u(e,s)}:void 0;return f.createElement("button",{className:l.chevronButton,onClick:d,"aria-label":c,"aria-expanded":s},f.createElement(ii,{className:l.chevronIcon,iconName:"ChevronDown"}),e.name)},Gi(o),o.state={isGroupCollapsed:{},isLinkExpandStateChanged:!1,selectedKey:t.initialSelectedKey||t.selectedKey},o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.styles,o=e.groups,n=e.className,r=e.isOnTop,i=e.theme;if(!o)return null;var a=o.map(this._renderGroup),s=hx(t,{theme:i,className:n,isOnTop:r,groups:o});return f.createElement(bs,{direction:$i.vertical,componentRef:this._focusZone},f.createElement("nav",{role:"navigation",className:s.root,"aria-label":this.props.ariaLabel},a))},Object.defineProperty(t.prototype,"selectedKey",{get:function(){return this.state.selectedKey},enumerable:!1,configurable:!0}),t.prototype.focus=function(e){return void 0===e&&(e=!1),!(!this._focusZone||!this._focusZone.current)&&this._focusZone.current.focus(e)},t.prototype._renderNavLink=function(e,t,o){var n=this.props,r=n.styles,i=n.groups,a=n.theme,s=e.icon||e.iconProps,l=this._isLinkSelected(e),c=e.ariaCurrent,u=void 0===c?"page":c,d=hx(r,{theme:a,isSelected:l,isDisabled:e.disabled,isButtonEntry:e.onClick&&!e.forceAnchor,leftPadding:14*o+3+(s?0:24),groups:i}),p=e.url&&e.target&&!dx(e.url)?"noopener noreferrer":void 0,h=this.props.linkAs?Lf(this.props.linkAs,Kd):Kd,m=this.props.onRenderLink?Xh(this.props.onRenderLink,this._onRenderLink):this._onRenderLink;return f.createElement(h,{className:d.link,styles:ux,href:e.url||(e.forceAnchor?"#":void 0),iconProps:e.iconProps||{iconName:e.icon},onClick:e.onClick?this._onNavButtonLinkClicked.bind(this,e):this._onNavAnchorLinkClicked.bind(this,e),title:void 0!==e.title?e.title:e.name,target:e.target,rel:p,disabled:e.disabled,"aria-current":l?u:void 0,"aria-label":e.ariaLabel?e.ariaLabel:void 0,link:e},m(e))},t.prototype._renderCompositeLink=function(e,t,o){var n=d({},Tr(e,Dr,["onClick"])),r=this.props,i=r.expandButtonAriaLabel,a=r.styles,s=r.groups,l=r.theme,c=hx(a,{theme:l,isExpanded:!!e.isExpanded,isSelected:this._isLinkSelected(e),isLink:!0,isDisabled:e.disabled,position:14*o+1,groups:s}),u="";return e.links&&e.links.length>0&&(u=e.collapseAriaLabel||e.expandAriaLabel?e.isExpanded?e.collapseAriaLabel:e.expandAriaLabel:i?e.name+" "+i:e.name),f.createElement("div",d({},n,{key:e.key||t,className:c.compositeLink}),e.links&&e.links.length>0?f.createElement("button",{className:c.chevronButton,onClick:this._onLinkExpandClicked.bind(this,e),"aria-label":u,"aria-expanded":e.isExpanded?"true":"false"},f.createElement(ii,{className:c.chevronIcon,iconName:"ChevronDown"})):null,this._renderNavLink(e,t,o))},t.prototype._renderLink=function(e,t,o){var n=this.props,r=n.styles,i=n.groups,a=n.theme,s=hx(r,{theme:a,groups:i});return f.createElement("li",{key:e.key||t,role:"listitem",className:s.navItem},this._renderCompositeLink(e,t,o),e.isExpanded?this._renderLinks(e.links,++o):null)},t.prototype._renderLinks=function(e,t){var o=this;if(!e||!e.length)return null;var n=e.map((function(e,n){return o._renderLink(e,n,t)})),r=this.props,i=r.styles,a=r.groups,s=r.theme,l=hx(i,{theme:s,groups:a});return f.createElement("ul",{role:"list",className:l.navItems},n)},t.prototype._onGroupHeaderClicked=function(e,t){e.onHeaderClick&&e.onHeaderClick(t,this._isGroupExpanded(e)),this._toggleCollapsed(e),t&&(t.preventDefault(),t.stopPropagation())},t.prototype._onLinkExpandClicked=function(e,t){var o=this.props.onLinkExpandClick;o&&o(t,e),t.defaultPrevented||(e.isExpanded=!e.isExpanded,this.setState({isLinkExpandStateChanged:!0})),t.preventDefault(),t.stopPropagation()},t.prototype._preventBounce=function(e,t){!e.url&&e.forceAnchor&&t.preventDefault()},t.prototype._onNavAnchorLinkClicked=function(e,t){this._preventBounce(e,t),this.props.onLinkClick&&this.props.onLinkClick(t,e),!e.url&&e.links&&e.links.length>0&&this._onLinkExpandClicked(e,t),this.setState({selectedKey:e.key})},t.prototype._onNavButtonLinkClicked=function(e,t){this._preventBounce(e,t),e.onClick&&e.onClick(t,e),!e.url&&e.links&&e.links.length>0&&this._onLinkExpandClicked(e,t),this.setState({selectedKey:e.key})},t.prototype._isLinkSelected=function(e){if(void 0!==this.props.selectedKey)return e.key===this.props.selectedKey;if(void 0!==this.state.selectedKey)return e.key===this.state.selectedKey;if(void 0===at()||!e.url)return!1;(nx=nx||document.createElement("a")).href=e.url||"";var t=nx.href;return location.href===t||location.protocol+"//"+location.host+location.pathname===t||!!location.hash&&(location.hash===e.url||(nx.href=location.hash.substring(1),nx.href===t))},t.prototype._isGroupExpanded=function(e){return e.name&&this.state.isGroupCollapsed.hasOwnProperty(e.name)?!this.state.isGroupCollapsed[e.name]:void 0===e.collapseByDefault||!e.collapseByDefault},t.prototype._toggleCollapsed=function(e){var t;if(e.name){var o=d(d({},this.state.isGroupCollapsed),((t={})[e.name]=this._isGroupExpanded(e),t));this.setState({isGroupCollapsed:o})}},t.defaultProps={groups:null},t}(f.Component),gx=Vn(mx,(function(e){var t,o=e.className,n=e.theme,r=e.isOnTop,i=e.isExpanded,a=e.isGroup,s=e.isLink,l=e.isSelected,c=e.isDisabled,u=e.isButtonEntry,d=e.navHeight,p=void 0===d?44:d,h=e.position,m=e.leftPadding,g=void 0===m?20:m,f=e.leftPaddingExpanded,v=void 0===f?28:f,b=e.rightPadding,y=void 0===b?20:b,C=n.palette,_=n.semanticColors,S=n.fonts,x=Qo(cx,n);return{root:[x.root,o,S.medium,{overflowY:"auto",userSelect:"none",WebkitOverflowScrolling:"touch"},r&&[{position:"absolute"},Ze.slideRightIn40]],linkText:[x.linkText,{margin:"0 4px",overflow:"hidden",verticalAlign:"middle",textAlign:"left",textOverflow:"ellipsis"}],compositeLink:[x.compositeLink,{display:"block",position:"relative",color:_.bodyText},i&&"is-expanded",l&&"is-selected",c&&"is-disabled",c&&{color:_.disabledText}],link:[x.link,To(n),{display:"block",position:"relative",height:p,width:"100%",lineHeight:p+"px",textDecoration:"none",cursor:"pointer",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",paddingLeft:g,paddingRight:y,color:_.bodyText,selectors:(t={},t[ro]={border:0,selectors:{":focus":{border:"1px solid WindowText"}}},t)},!c&&{selectors:{".ms-Nav-compositeLink:hover &":{backgroundColor:_.bodyBackgroundHovered}}},l&&{color:_.bodyTextChecked,fontWeight:qe.semibold,backgroundColor:_.bodyBackgroundChecked,selectors:{"&:after":{borderLeft:"2px solid "+C.themePrimary,content:'""',position:"absolute",top:0,right:0,bottom:0,left:0,pointerEvents:"none"}}},c&&{color:_.disabledText},u&&{color:C.themePrimary}],chevronButton:[x.chevronButton,To(n),S.small,{display:"block",textAlign:"left",lineHeight:p+"px",margin:"5px 0",padding:"0px, "+y+"px, 0px, "+v+"px",border:"none",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",cursor:"pointer",color:_.bodyText,backgroundColor:"transparent",selectors:{"&:visited":{color:_.bodyText}}},a&&{fontSize:S.large.fontSize,width:"100%",height:p,borderBottom:"1px solid "+_.bodyDivider},s&&{display:"block",width:v-2,height:p-2,position:"absolute",top:"1px",left:h+"px",zIndex:ko.Nav,padding:0,margin:0},l&&{color:C.themePrimary,backgroundColor:C.neutralLighterAlt,selectors:{"&:after":{borderLeft:"2px solid "+C.themePrimary,content:'""',position:"absolute",top:0,right:0,bottom:0,left:0,pointerEvents:"none"}}}],chevronIcon:[x.chevronIcon,{position:"absolute",left:"8px",height:p,display:"inline-flex",alignItems:"center",lineHeight:p+"px",fontSize:S.small.fontSize,transition:"transform .1s linear"},i&&{transform:"rotate(-180deg)"},s&&{top:0}],navItem:[x.navItem,{padding:0}],navItems:[x.navItems,{listStyleType:"none",padding:0,margin:0}],group:[x.group,i&&"is-expanded"],groupContent:[x.groupContent,{display:"none",marginBottom:"40px"},Ze.slideDownIn20,i&&{display:"block"}]}}),void 0,{scope:"Nav"});!function(e){e[e.none=0]="none",e[e.forceResolve=1]="forceResolve",e[e.searchMore=2]="searchMore"}(px||(px={}));var fx,vx={root:"ms-Suggestions-item",itemButton:"ms-Suggestions-itemButton",closeButton:"ms-Suggestions-closeButton",isSuggested:"is-suggested"},bx=r,yx=Jn(),Cx=Vn(h_,(function(e){var t,o,n,r,i,a,s=e.className,l=e.theme,c=e.suggested,u=l.palette,p=l.semanticColors,h=Qo(vx,l);return{root:[h.root,{display:"flex",alignItems:"stretch",boxSizing:"border-box",width:"100%",position:"relative",selectors:{"&:hover":{background:p.menuItemBackgroundHovered},"&:hover .ms-Suggestions-closeButton":{display:"block"}}},c&&{selectors:(t={},t["."+wo+" &"]={selectors:(o={},o["."+h.closeButton]={display:"block",background:p.menuItemBackgroundPressed},o)},t[":after"]={pointerEvents:"none",content:'""',position:"absolute",left:0,top:0,bottom:0,right:0,border:"1px solid "+l.semanticColors.focusBorder},t)},s],itemButton:[h.itemButton,{width:"100%",padding:0,border:"none",height:"100%",minWidth:0,overflow:"hidden",selectors:(n={},n[ro]={color:"WindowText",selectors:{":hover":d({background:"Highlight",color:"HighlightText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"})}},n[":hover"]={color:p.menuItemTextHovered},n)},c&&[h.isSuggested,{background:p.menuItemBackgroundPressed,selectors:(r={":hover":{background:p.menuDivider}},r[ro]=d({background:"Highlight",color:"HighlightText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),r)}]],closeButton:[h.closeButton,{display:"none",color:u.neutralSecondary,padding:"0 4px",height:"auto",width:32,selectors:(i={":hover, :active":{background:u.neutralTertiaryAlt,color:u.neutralDark}},i[ro]={color:"WindowText"},i)},c&&(a={},a["."+wo+" &"]={selectors:{":hover, :active":{background:u.neutralTertiary}}},a.selectors={":hover, :active":{background:u.neutralTertiary,color:u.neutralPrimary}},a)]}}),void 0,{scope:"SuggestionItem"}),_x=function(e){function t(t){var o=e.call(this,t)||this;return o._forceResolveButton=f.createRef(),o._searchForMoreButton=f.createRef(),o._selectedElement=f.createRef(),o._scrollContainer=f.createRef(),o.tryHandleKeyDown=function(e,t){var n=!1,r=null,i=o.state.selectedActionType,a=o.props.suggestions.length;if(e===Gn.down)switch(i){case px.forceResolve:a>0?(o._refocusOnSuggestions(e),r=px.none):r=o._searchForMoreButton.current?px.searchMore:px.forceResolve;break;case px.searchMore:o._forceResolveButton.current?r=px.forceResolve:a>0?(o._refocusOnSuggestions(e),r=px.none):r=px.searchMore;break;case px.none:-1===t&&o._forceResolveButton.current&&(r=px.forceResolve)}else if(e===Gn.up)switch(i){case px.forceResolve:o._searchForMoreButton.current?r=px.searchMore:a>0&&(o._refocusOnSuggestions(e),r=px.none);break;case px.searchMore:a>0?(o._refocusOnSuggestions(e),r=px.none):o._forceResolveButton.current&&(r=px.forceResolve);break;case px.none:-1===t&&o._searchForMoreButton.current&&(r=px.searchMore)}return null!==r&&(o.setState({selectedActionType:r}),n=!0),n},o._getAlertText=function(){var e=o.props,t=e.isLoading,n=e.isSearching,r=e.suggestions,i=e.suggestionsAvailableAlertText,a=e.noResultsFoundText;if(!t&&!n){if(r.length>0)return i||"";if(a)return a}return""},o._getMoreResults=function(){o.props.onGetMoreResults&&(o.props.onGetMoreResults(),o.setState({selectedActionType:px.none}))},o._forceResolve=function(){o.props.createGenericItem&&o.props.createGenericItem()},o._shouldShowForceResolve=function(){return!!o.props.showForceResolve&&o.props.showForceResolve()},o._onClickTypedSuggestionsItem=function(e,t){return function(n){o.props.onSuggestionClick(n,e,t)}},o._refocusOnSuggestions=function(e){"function"==typeof o.props.refocusSuggestions&&o.props.refocusSuggestions(e)},o._onRemoveTypedSuggestionsItem=function(e,t){return function(n){(0,o.props.onSuggestionRemove)(n,e,t),n.stopPropagation()}},Gi(o),o.state={selectedActionType:px.none},o}return u(t,e),t.prototype.componentDidMount=function(){this.scrollSelected(),this.activeSelectedElement=this._selectedElement?this._selectedElement.current:null},t.prototype.componentDidUpdate=function(){this._selectedElement.current&&this.activeSelectedElement!==this._selectedElement.current&&(this.scrollSelected(),this.activeSelectedElement=this._selectedElement.current)},t.prototype.render=function(){var e,t,o=this,n=this.props,r=n.forceResolveText,i=n.mostRecentlyUsedHeaderText,a=n.searchForMoreIcon,s=n.searchForMoreText,l=n.className,c=n.moreSuggestionsAvailable,u=n.noResultsFoundText,p=n.suggestions,h=n.isLoading,m=n.isSearching,g=n.loadingText,v=n.onRenderNoResultFound,b=n.searchingText,y=n.isMostRecentlyUsedVisible,C=n.resultsMaximumNumber,_=n.resultsFooterFull,S=n.resultsFooter,x=n.isResultsFooterVisible,k=void 0===x||x,w=n.suggestionsHeaderText,I=n.suggestionsClassName,D=n.theme,T=n.styles,E=n.suggestionsListId;this._classNames=T?yx(T,{theme:D,className:l,suggestionsClassName:I,forceResolveButtonSelected:this.state.selectedActionType===px.forceResolve,searchForMoreButtonSelected:this.state.selectedActionType===px.searchMore}):{root:qr("ms-Suggestions",l,bx.root),title:qr("ms-Suggestions-title",bx.suggestionsTitle),searchForMoreButton:qr("ms-SearchMore-button",bx.actionButton,(e={},e["is-selected "+bx.buttonSelected]=this.state.selectedActionType===px.searchMore,e)),forceResolveButton:qr("ms-forceResolve-button",bx.actionButton,(t={},t["is-selected "+bx.buttonSelected]=this.state.selectedActionType===px.forceResolve,t)),suggestionsAvailable:qr("ms-Suggestions-suggestionsAvailable",bx.suggestionsAvailable),suggestionsContainer:qr("ms-Suggestions-container",bx.suggestionsContainer,I),noSuggestions:qr("ms-Suggestions-none",bx.suggestionsNone)};var P=this._classNames.subComponentStyles?this._classNames.subComponentStyles.spinner:void 0,R=T?{styles:P}:{className:qr("ms-Suggestions-spinner",bx.suggestionsSpinner)},M=function(){return f.createElement("div",{id:"sug-noResultsFound",role:"option"},v?v(void 0,M):f.createElement("div",{className:o._classNames.noSuggestions},u))},N=w;y&&i&&(N=i);var B=void 0;k&&(B=p.length>=C?_:S);var F=!(p&&p.length||h),A=F||h?{role:"listbox",id:E}:{},L=this.state.selectedActionType===px.forceResolve?"sug-selectedAction":void 0,H=this.state.selectedActionType===px.searchMore?"sug-selectedAction":void 0;return f.createElement("div",d({className:this._classNames.root},A),f.createElement(na,{message:this._getAlertText(),"aria-live":"polite"}),N?f.createElement("div",{className:this._classNames.title},N):null,r&&this._shouldShowForceResolve()&&f.createElement(Xd,{componentRef:this._forceResolveButton,className:this._classNames.forceResolveButton,id:L,onClick:this._forceResolve,"data-automationid":"sug-forceResolve"},r),h&&f.createElement(ub,d({},R,{label:g})),F?M():this._renderSuggestions(),s&&c&&f.createElement(Xd,{componentRef:this._searchForMoreButton,className:this._classNames.searchForMoreButton,iconProps:a||{iconName:"Search"},id:H,onClick:this._getMoreResults,"data-automationid":"sug-searchForMore"},s),m?f.createElement(ub,d({},R,{label:b})):null,!B||c||y||m?null:f.createElement("div",{className:this._classNames.title},B(this.props)))},t.prototype.hasSuggestedAction=function(){return!!this._searchForMoreButton.current||!!this._forceResolveButton.current},t.prototype.hasSuggestedActionSelected=function(){return this.state.selectedActionType!==px.none},t.prototype.executeSelectedAction=function(){switch(this.state.selectedActionType){case px.forceResolve:this._forceResolve();break;case px.searchMore:this._getMoreResults()}},t.prototype.focusAboveSuggestions=function(){this._forceResolveButton.current?this.setState({selectedActionType:px.forceResolve}):this._searchForMoreButton.current&&this.setState({selectedActionType:px.searchMore})},t.prototype.focusBelowSuggestions=function(){this._searchForMoreButton.current?this.setState({selectedActionType:px.searchMore}):this._forceResolveButton.current&&this.setState({selectedActionType:px.forceResolve})},t.prototype.focusSearchForMoreButton=function(){this._searchForMoreButton.current&&this._searchForMoreButton.current.focus()},t.prototype.scrollSelected=function(){if(this._selectedElement.current&&this._scrollContainer.current&&void 0!==this._scrollContainer.current.scrollTo){var e=this._selectedElement.current,t=e.offsetHeight,o=e.offsetTop,n=this._scrollContainer.current,r=n.offsetHeight,i=n.scrollTop,a=o+t>i+r;o<i?this._scrollContainer.current.scrollTo(0,o):a&&this._scrollContainer.current.scrollTo(0,o-r+t)}},t.prototype._renderSuggestions=function(){var e=this,t=this.props,o=t.isMostRecentlyUsedVisible,n=t.mostRecentlyUsedHeaderText,r=t.onRenderSuggestion,i=t.removeSuggestionAriaLabel,a=t.suggestionsItemClassName,s=t.resultsMaximumNumber,l=t.showRemoveButtons,c=t.suggestionsContainerAriaLabel,u=t.suggestionsHeaderText,d=t.suggestionsListId,p=t.removeButtonIconProps,h=this.props.suggestions,m=Cx,g=-1;if(h.some((function(e,t){return!!e.selected&&(g=t,!0)})),s&&(h=g>=s?h.slice(g-s+1,g+1):h.slice(0,s)),0===h.length)return null;var v=u;return o&&n&&(v=n),f.createElement("div",{className:this._classNames.suggestionsContainer,id:d,ref:this._scrollContainer,role:"listbox","aria-label":c||v},h.map((function(t,o){return f.createElement("div",{ref:t.selected?e._selectedElement:void 0,key:t.item.key?t.item.key:o,role:"presentation"},f.createElement(m,{suggestionModel:t,RenderSuggestion:r,onClick:e._onClickTypedSuggestionsItem(t.item,o),className:a,showRemoveButton:l,removeButtonAriaLabel:i,onRemoveItem:e._onRemoveTypedSuggestionsItem(t.item,o),id:"sug-"+o,removeButtonIconProps:p}))})))},t}(f.Component),Sx=function(){function e(){var e=this;this._isSuggestionModel=function(e){return void 0!==e.item},this._ensureSuggestionModel=function(t){return e._isSuggestionModel(t)?t:{item:t,selected:!1,ariaLabel:t.name||t.primaryText}},this.suggestions=[],this.currentIndex=-1}return e.prototype.updateSuggestions=function(e,t){e&&e.length>0?(this.suggestions=this.convertSuggestionsToSuggestionItems(e),this.currentIndex=t||0,-1===t?this.currentSuggestion=void 0:void 0!==t&&(this.suggestions[t].selected=!0,this.currentSuggestion=this.suggestions[t])):(this.suggestions=[],this.currentIndex=-1,this.currentSuggestion=void 0)},e.prototype.nextSuggestion=function(){if(this.suggestions&&this.suggestions.length){if(this.currentIndex<this.suggestions.length-1)return this.setSelectedSuggestion(this.currentIndex+1),!0;if(this.currentIndex===this.suggestions.length-1)return this.setSelectedSuggestion(0),!0}return!1},e.prototype.previousSuggestion=function(){if(this.suggestions&&this.suggestions.length){if(this.currentIndex>0)return this.setSelectedSuggestion(this.currentIndex-1),!0;if(0===this.currentIndex)return this.setSelectedSuggestion(this.suggestions.length-1),!0}return!1},e.prototype.getSuggestions=function(){return this.suggestions},e.prototype.getCurrentItem=function(){return this.currentSuggestion},e.prototype.getSuggestionAtIndex=function(e){return this.suggestions[e]},e.prototype.hasSelectedSuggestion=function(){return!!this.currentSuggestion},e.prototype.removeSuggestion=function(e){this.suggestions.splice(e,1)},e.prototype.createGenericSuggestion=function(e){var t=this.convertSuggestionsToSuggestionItems([e])[0];this.currentSuggestion=t},e.prototype.convertSuggestionsToSuggestionItems=function(e){return Array.isArray(e)?e.map(this._ensureSuggestionModel):[]},e.prototype.deselectAllSuggestions=function(){this.currentIndex>-1&&(this.suggestions[this.currentIndex].selected=!1,this.currentIndex=-1)},e.prototype.setSelectedSuggestion=function(e){e>this.suggestions.length-1||e<0?(this.currentIndex=0,this.currentSuggestion.selected=!1,this.currentSuggestion=this.suggestions[0],this.currentSuggestion.selected=!0):(this.currentIndex>-1&&(this.suggestions[this.currentIndex].selected=!1),this.suggestions[e].selected=!0,this.currentIndex=e,this.currentSuggestion=this.suggestions[e])},e}(),xx={root:"ms-Suggestions",suggestionsContainer:"ms-Suggestions-container",title:"ms-Suggestions-title",forceResolveButton:"ms-forceResolve-button",searchForMoreButton:"ms-SearchMore-button",spinner:"ms-Suggestions-spinner",noSuggestions:"ms-Suggestions-none",suggestionsAvailable:"ms-Suggestions-suggestionsAvailable",isSelected:"is-selected"};function kx(e){var t,o=e.className,n=e.suggestionsClassName,r=e.theme,i=e.forceResolveButtonSelected,a=e.searchForMoreButtonSelected,s=r.palette,l=r.semanticColors,c=r.fonts,u=Qo(xx,r),p={backgroundColor:"transparent",border:0,cursor:"pointer",margin:0,paddingLeft:8,position:"relative",borderTop:"1px solid "+s.neutralLight,height:40,textAlign:"left",width:"100%",fontSize:c.small.fontSize,selectors:{":hover":{backgroundColor:l.menuItemBackgroundPressed,cursor:"pointer"},":focus, :active":{backgroundColor:s.themeLight},".ms-Button-icon":{fontSize:c.mediumPlus.fontSize,width:25},".ms-Button-label":{margin:"0 4px 0 9px"}}},h={backgroundColor:s.themeLight,selectors:(t={},t[ro]=d({backgroundColor:"Highlight",borderColor:"Highlight",color:"HighlightText"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),t)};return{root:[u.root,{minWidth:260},o],suggestionsContainer:[u.suggestionsContainer,{overflowY:"auto",overflowX:"hidden",maxHeight:300,transform:"translate3d(0,0,0)"},n],title:[u.title,{padding:"0 12px",fontSize:c.small.fontSize,color:s.themePrimary,lineHeight:40,borderBottom:"1px solid "+l.menuItemBackgroundPressed}],forceResolveButton:[u.forceResolveButton,p,i&&[u.isSelected,h]],searchForMoreButton:[u.searchForMoreButton,p,a&&[u.isSelected,h]],noSuggestions:[u.noSuggestions,{textAlign:"center",color:s.neutralSecondary,fontSize:c.small.fontSize,lineHeight:30}],suggestionsAvailable:[u.suggestionsAvailable,Mo],subComponentStyles:{spinner:{root:[u.spinner,{margin:"5px 0",paddingLeft:14,textAlign:"left",whiteSpace:"nowrap",lineHeight:20,fontSize:c.small.fontSize}],circle:{display:"inline-block",verticalAlign:"middle"},label:{display:"inline-block",verticalAlign:"middle",margin:"0 10px 0 16px"}}}}}!function(e){e[e.valid=0]="valid",e[e.warning=1]="warning",e[e.invalid=2]="invalid"}(fx||(fx={})),Ft([{rawString:".pickerText_15a92175{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid "},{theme:"neutralTertiary",defaultValue:"#a19f9d"},{rawString:";min-width:180px;min-height:30px}.pickerText_15a92175:hover{border-color:"},{theme:"inputBorderHovered",defaultValue:"#323130"},{rawString:"}.pickerText_15a92175.inputFocused_15a92175{position:relative;border-color:"},{theme:"inputFocusBorderAlt",defaultValue:"#0078d4"},{rawString:"}.pickerText_15a92175.inputFocused_15a92175:after{pointer-events:none;content:'';position:absolute;left:-1px;top:-1px;bottom:-1px;right:-1px;border:2px solid "},{theme:"inputFocusBorderAlt",defaultValue:"#0078d4"},{rawString:"}@media screen and (-ms-high-contrast:active){.pickerText_15a92175.inputDisabled_15a92175{position:relative;border-color:GrayText}.pickerText_15a92175.inputDisabled_15a92175:after{pointer-events:none;content:'';position:absolute;left:0;top:0;bottom:0;right:0;background-color:Window}}.pickerInput_15a92175{height:34px;border:none;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;outline:0;padding:0 6px 0;-ms-flex-item-align:end;align-self:flex-end}.pickerItems_15a92175{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;max-width:100%}.screenReaderOnly_15a92175{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}"}]);var wx="pickerText_15a92175",Ix="inputFocused_15a92175",Dx="inputDisabled_15a92175",Tx="pickerInput_15a92175",Ex="pickerItems_15a92175",Px="screenReaderOnly_15a92175",Rx=s,Mx=Jn(),Nx=function(e){function t(t){var o=e.call(this,t)||this;o.root=f.createRef(),o.input=f.createRef(),o.suggestionElement=f.createRef(),o.SuggestionOfProperType=_x,o._styledSuggestions=Vn(o.SuggestionOfProperType,kx,void 0,{scope:"Suggestions"}),o.dismissSuggestions=function(e){var t=function(){var t=!0;o.props.onDismiss&&(t=o.props.onDismiss(e,o.suggestionStore.currentSuggestion?o.suggestionStore.currentSuggestion.item:void 0)),(!e||e&&!e.defaultPrevented)&&!1!==t&&o.canAddItems()&&o.suggestionStore.hasSelectedSuggestion()&&o.state.suggestedDisplayValue&&o.addItemByIndex(0)};o.currentPromise?o.currentPromise.then((function(){return t()})):t(),o.setState({suggestionsVisible:!1})},o.refocusSuggestions=function(e){o.resetFocus(),o.suggestionStore.suggestions&&o.suggestionStore.suggestions.length>0&&(e===Gn.up?o.suggestionStore.setSelectedSuggestion(o.suggestionStore.suggestions.length-1):e===Gn.down&&o.suggestionStore.setSelectedSuggestion(0))},o.onInputChange=function(e){o.updateValue(e),o.setState({moreSuggestionsAvailable:!0,isMostRecentlyUsedVisible:!1})},o.onSuggestionClick=function(e,t,n){o.addItemByIndex(n)},o.onSuggestionRemove=function(e,t,n){o.props.onRemoveSuggestion&&o.props.onRemoveSuggestion(t),o.suggestionStore.removeSuggestion(n)},o.onInputFocus=function(e){o.selection.setAllSelected(!1),o.state.isFocused||(o._userTriggeredSuggestions(),o.props.inputProps&&o.props.inputProps.onFocus&&o.props.inputProps.onFocus(e))},o.onInputBlur=function(e){o.props.inputProps&&o.props.inputProps.onBlur&&o.props.inputProps.onBlur(e)},o.onBlur=function(e){if(o.state.isFocused){var t=e.relatedTarget;null===e.relatedTarget&&(t=document.activeElement),t&&!_a(o.root.current,t)&&(o.setState({isFocused:!1}),o.props.onBlur&&o.props.onBlur(e))}},o.onClick=function(e){void 0!==o.props.inputProps&&void 0!==o.props.inputProps.onClick&&o.props.inputProps.onClick(e),0===e.button&&o._userTriggeredSuggestions()},o.onFocus=function(){o.state.isFocused||o.setState({isFocused:!0})},o.onKeyDown=function(e){var t=e.which;switch(t){case Gn.escape:o.state.suggestionsVisible&&(o.setState({suggestionsVisible:!1}),e.preventDefault(),e.stopPropagation());break;case Gn.tab:case Gn.enter:o.suggestionElement.current&&o.suggestionElement.current.hasSuggestedActionSelected()?o.suggestionElement.current.executeSelectedAction():!e.shiftKey&&o.suggestionStore.hasSelectedSuggestion()&&o.state.suggestionsVisible?(o.completeSuggestion(),e.preventDefault(),e.stopPropagation()):o._completeGenericSuggestion();break;case Gn.backspace:o.props.disabled||o.onBackspace(e),e.stopPropagation();break;case Gn.del:o.props.disabled||(o.input.current&&e.target===o.input.current.inputElement&&o.state.suggestionsVisible&&-1!==o.suggestionStore.currentIndex?(o.props.onRemoveSuggestion&&o.props.onRemoveSuggestion(o.suggestionStore.currentSuggestion.item),o.suggestionStore.removeSuggestion(o.suggestionStore.currentIndex),o.forceUpdate()):o.onBackspace(e)),e.stopPropagation();break;case Gn.up:o.input.current&&e.target===o.input.current.inputElement&&o.state.suggestionsVisible&&(o.suggestionElement.current&&o.suggestionElement.current.tryHandleKeyDown(t,o.suggestionStore.currentIndex)?(e.preventDefault(),e.stopPropagation(),o.forceUpdate()):o.suggestionElement.current&&o.suggestionElement.current.hasSuggestedAction()&&0===o.suggestionStore.currentIndex?(e.preventDefault(),e.stopPropagation(),o.suggestionElement.current.focusAboveSuggestions(),o.suggestionStore.deselectAllSuggestions(),o.forceUpdate()):o.suggestionStore.previousSuggestion()&&(e.preventDefault(),e.stopPropagation(),o.onSuggestionSelect()));break;case Gn.down:o.input.current&&e.target===o.input.current.inputElement&&o.state.suggestionsVisible&&(o.suggestionElement.current&&o.suggestionElement.current.tryHandleKeyDown(t,o.suggestionStore.currentIndex)?(e.preventDefault(),e.stopPropagation(),o.forceUpdate()):o.suggestionElement.current&&o.suggestionElement.current.hasSuggestedAction()&&o.suggestionStore.currentIndex+1===o.suggestionStore.suggestions.length?(e.preventDefault(),e.stopPropagation(),o.suggestionElement.current.focusBelowSuggestions(),o.suggestionStore.deselectAllSuggestions(),o.forceUpdate()):o.suggestionStore.nextSuggestion()&&(e.preventDefault(),e.stopPropagation(),o.onSuggestionSelect()))}},o.onItemChange=function(e,t){var n=o.state.items;if(t>=0){var r=n;r[t]=e,o._updateSelectedItems(r)}},o.onGetMoreResults=function(){o.setState({isSearching:!0},(function(){if(o.props.onGetMoreResults&&o.input.current){var e=o.props.onGetMoreResults(o.input.current.value,o.state.items),t=e,n=e;Array.isArray(t)?(o.updateSuggestions(t),o.setState({isSearching:!1})):n.then&&n.then((function(e){o.updateSuggestions(e),o.setState({isSearching:!1})}))}else o.setState({isSearching:!1});o.input.current&&o.input.current.focus(),o.setState({moreSuggestionsAvailable:!1,isResultsFooterVisible:!0})}))},o.completeSelection=function(e){o.addItem(e),o.updateValue(""),o.input.current&&o.input.current.clear(),o.setState({suggestionsVisible:!1})},o.addItemByIndex=function(e){o.completeSelection(o.suggestionStore.getSuggestionAtIndex(e).item)},o.addItem=function(e){var t=o.props.onItemSelected?o.props.onItemSelected(e):e;if(null!==t){var n=t,r=t;if(r&&r.then)r.then((function(e){var t=o.state.items.concat([e]);o._updateSelectedItems(t)}));else{var i=o.state.items.concat([n]);o._updateSelectedItems(i)}o.setState({suggestedDisplayValue:"",selectionRemoved:void 0})}},o.removeItem=function(e){var t=o.state.items,n=t.indexOf(e);if(n>=0){var r=t.slice(0,n).concat(t.slice(n+1));o.setState({selectionRemoved:e}),o._updateSelectedItems(r)}},o.removeItems=function(e){var t=o.state.items.filter((function(t){return-1===e.indexOf(t)}));o._updateSelectedItems(t)},o._shouldFocusZoneEnterInnerZone=function(e){if(o.state.suggestionsVisible)switch(e.which){case Gn.up:case Gn.down:return!0}return e.which===Gn.enter},o._onResolveSuggestions=function(e){var t=o.props.onResolveSuggestions(e,o.state.items);null!==t&&o.updateSuggestionsList(t,e)},o._completeGenericSuggestion=function(){if(o.props.onValidateInput&&o.input.current&&o.props.onValidateInput(o.input.current.value)!==fx.invalid&&o.props.createGenericItem){var e=o.props.createGenericItem(o.input.current.value,o.props.onValidateInput(o.input.current.value));o.suggestionStore.createGenericSuggestion(e),o.completeSuggestion()}},o._userTriggeredSuggestions=function(){if(!o.state.suggestionsVisible){var e=o.input.current?o.input.current.value:"";e?0===o.suggestionStore.suggestions.length?o._onResolveSuggestions(e):o.setState({isMostRecentlyUsedVisible:!1,suggestionsVisible:!0}):o.onEmptyInputFocus()}},Gi(o),o._async=new Zi(o);var n=t.selectedItems||t.defaultSelectedItems||[];return o._id=Ka(),o._ariaMap={selectedItems:"selected-items-"+o._id,selectedSuggestionAlert:"selected-suggestion-alert-"+o._id,suggestionList:"suggestion-list-"+o._id,combobox:"combobox-"+o._id},o.suggestionStore=new Sx,o.selection=new iv({onSelectionChanged:function(){return o.onSelectionChange()}}),o.selection.setItems(n),o.state={items:n,suggestedDisplayValue:"",isMostRecentlyUsedVisible:!1,moreSuggestionsAvailable:!1,isFocused:!1,isSearching:!1,selectedIndices:[],selectionRemoved:void 0},o}return u(t,e),t.getDerivedStateFromProps=function(e){return e.selectedItems?{items:e.selectedItems}:null},Object.defineProperty(t.prototype,"items",{get:function(){return this.state.items},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){this.selection.setItems(this.state.items),this._onResolveSuggestions=this._async.debounce(this._onResolveSuggestions,this.props.resolveDelay)},t.prototype.componentDidUpdate=function(e,t){if(this.state.items&&this.state.items!==t.items){var o=this.selection.getSelectedIndices()[0];this.selection.setItems(this.state.items),this.state.isFocused&&(this.state.items.length<t.items.length?(this.selection.setIndexSelected(o,!1,!0),this.resetFocus(o)):this.state.items.length>t.items.length&&!this.canAddItems()&&this.resetFocus(this.state.items.length-1))}},t.prototype.componentWillUnmount=function(){this.currentPromise&&(this.currentPromise=void 0),this._async.dispose()},t.prototype.focus=function(){this.input.current&&this.input.current.focus()},t.prototype.focusInput=function(){this.input.current&&this.input.current.focus()},t.prototype.completeSuggestion=function(e){this.suggestionStore.hasSelectedSuggestion()&&this.input.current?this.completeSelection(this.suggestionStore.currentSuggestion.item):e&&this._completeGenericSuggestion()},t.prototype.render=function(){var e=this.state,t=e.suggestedDisplayValue,o=e.isFocused,n=e.items,r=this.props,i=r.className,a=r.inputProps,s=r.disabled,l=r.selectionAriaLabel,c=r.selectionRole,u=void 0===c?"list":c,p=r.theme,h=r.styles,m=this.state.suggestionsVisible?this._ariaMap.suggestionList:"",g=h?Mx(h,{theme:p,className:i,isFocused:o,disabled:s,inputClassName:a&&a.className}):{root:qr("ms-BasePicker",i||""),text:qr("ms-BasePicker-text",Rx.pickerText,this.state.isFocused&&Rx.inputFocused),itemsWrapper:Rx.pickerItems,input:qr("ms-BasePicker-input",Rx.pickerInput,a&&a.className),screenReaderText:Rx.screenReaderOnly},v=this.props["aria-label"]||(null==a?void 0:a["aria-label"]);return f.createElement("div",{ref:this.root,className:g.root,onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur},this.renderCustomAlert(g.screenReaderText),f.createElement("span",{id:this._ariaMap.selectedItems+"-label",hidden:!0},l||v),f.createElement(vv,{selection:this.selection,selectionMode:ev.multiple},f.createElement("div",{className:g.text,"aria-owns":m},n.length>0&&f.createElement("span",{id:this._ariaMap.selectedItems,className:g.itemsWrapper,role:u,"aria-labelledby":this._ariaMap.selectedItems+"-label"},this.renderItems()),this.canAddItems()&&f.createElement(Qi,d({spellCheck:!1},a,{className:g.input,componentRef:this.input,id:(null==a?void 0:a.id)?a.id:this._ariaMap.combobox,onClick:this.onClick,onFocus:this.onInputFocus,onBlur:this.onInputBlur,onInputValueChange:this.onInputChange,suggestedDisplayValue:t,"aria-activedescendant":this.getActiveDescendant(),"aria-controls":m,"aria-describedby":n.length>0?this._ariaMap.selectedItems:void 0,"aria-expanded":!!this.state.suggestionsVisible,"aria-haspopup":"listbox","aria-label":v,role:"combobox",disabled:s,onInputChange:this.props.onInputChange})))),this.renderSuggestions())},t.prototype.canAddItems=function(){var e=this.state.items,t=this.props.itemLimit;return void 0===t||e.length<t},t.prototype.renderSuggestions=function(){var e=this._styledSuggestions;return this.state.suggestionsVisible&&this.input?f.createElement(kc,d({isBeakVisible:!1,gapSpace:5,target:this.input.current?this.input.current.inputElement:void 0,onDismiss:this.dismissSuggestions,directionalHint:Ys.bottomLeftEdge,directionalHintForRTL:Ys.bottomRightEdge},this.props.pickerCalloutProps),f.createElement(e,d({onRenderSuggestion:this.props.onRenderSuggestionsItem,onSuggestionClick:this.onSuggestionClick,onSuggestionRemove:this.onSuggestionRemove,suggestions:this.suggestionStore.getSuggestions(),componentRef:this.suggestionElement,onGetMoreResults:this.onGetMoreResults,moreSuggestionsAvailable:this.state.moreSuggestionsAvailable,isLoading:this.state.suggestionsLoading,isSearching:this.state.isSearching,isMostRecentlyUsedVisible:this.state.isMostRecentlyUsedVisible,isResultsFooterVisible:this.state.isResultsFooterVisible,refocusSuggestions:this.refocusSuggestions,removeSuggestionAriaLabel:this.props.removeButtonAriaLabel,suggestionsListId:this._ariaMap.suggestionList,createGenericItem:this._completeGenericSuggestion},this.props.pickerSuggestionsProps))):null},t.prototype.renderItems=function(){var e=this,t=this.props,o=t.disabled,n=t.removeButtonAriaLabel,r=t.removeButtonIconProps,i=this.props.onRenderItem,a=this.state,s=a.items,l=a.selectedIndices;return s.map((function(t,a){return i({item:t,index:a,key:t.key?t.key:a,selected:-1!==l.indexOf(a),onRemoveItem:function(){return e.removeItem(t)},disabled:o,onItemChange:e.onItemChange,removeButtonAriaLabel:n,removeButtonIconProps:r})}))},t.prototype.resetFocus=function(e){var t=this.state.items;if(t.length&&e>=0){var o=this.root.current&&this.root.current.querySelectorAll("[data-selection-index]")[Math.min(e,t.length-1)];o&&o.focus()}else this.canAddItems()?this.input.current&&this.input.current.focus():this.resetFocus(t.length-1)},t.prototype.onSuggestionSelect=function(){if(this.suggestionStore.currentSuggestion){var e=this.input.current?this.input.current.value:"",t=this._getTextFromItem(this.suggestionStore.currentSuggestion.item,e);this.setState({suggestedDisplayValue:t})}},t.prototype.onSelectionChange=function(){this.setState({selectedIndices:this.selection.getSelectedIndices()})},t.prototype.updateSuggestions=function(e){this.suggestionStore.updateSuggestions(e,0),this.forceUpdate()},t.prototype.onEmptyInputFocus=function(){var e=this.props.onEmptyResolveSuggestions?this.props.onEmptyResolveSuggestions:this.props.onEmptyInputFocus;if(e){var t=e(this.state.items);this.updateSuggestionsList(t),this.setState({isMostRecentlyUsedVisible:!0,suggestionsVisible:!0,moreSuggestionsAvailable:!1})}},t.prototype.updateValue=function(e){this._onResolveSuggestions(e)},t.prototype.updateSuggestionsList=function(e,t){var o=this,n=e,r=e;if(Array.isArray(n))this._updateAndResolveValue(t,n);else if(r&&r.then){this.setState({suggestionsLoading:!0}),this.suggestionStore.updateSuggestions([]),void 0!==t?this.setState({suggestionsVisible:this._getShowSuggestions()}):this.setState({suggestionsVisible:this.input.current&&this.input.current.inputElement===document.activeElement});var i=this.currentPromise=r;i.then((function(e){i===o.currentPromise&&o._updateAndResolveValue(t,e)}))}},t.prototype.resolveNewValue=function(e,t){var o=this;this.updateSuggestions(t);var n=void 0;this.suggestionStore.currentSuggestion&&(n=this._getTextFromItem(this.suggestionStore.currentSuggestion.item,e)),this.setState({suggestedDisplayValue:n,suggestionsVisible:this._getShowSuggestions()},(function(){return o.setState({suggestionsLoading:!1})}))},t.prototype.onChange=function(e){this.props.onChange&&this.props.onChange(e)},t.prototype.onBackspace=function(e){(this.state.items.length&&!this.input.current||this.input.current&&!this.input.current.isValueSelected&&0===this.input.current.cursorLocation)&&(this.selection.getSelectedCount()>0?this.removeItems(this.selection.getSelection()):this.removeItem(this.state.items[this.state.items.length-1]))},t.prototype.getActiveDescendant=function(){var e;if(!this.state.suggestionsLoading){var t=this.suggestionStore.currentIndex;return t<0?(null===(e=this.suggestionElement.current)||void 0===e?void 0:e.hasSuggestedAction())?"sug-selectedAction":0===this.suggestionStore.suggestions.length?"sug-noResultsFound":void 0:"sug-"+t}},t.prototype.getSuggestionsAlert=function(e){void 0===e&&(e=Rx.screenReaderOnly);var t=this.suggestionStore.currentIndex;if(this.props.enableSelectedSuggestionAlert){var o=t>-1?this.suggestionStore.getSuggestionAtIndex(this.suggestionStore.currentIndex):void 0,n=o?o.ariaLabel:void 0;return f.createElement("div",{id:this._ariaMap.selectedSuggestionAlert,className:e},n+" ")}},t.prototype.renderCustomAlert=function(e){void 0===e&&(e=Rx.screenReaderOnly);var t=this.props.suggestionRemovedText,o=void 0===t?"removed {0}":t,n="";return this.state.selectionRemoved&&(n=Bp(o,this._getTextFromItem(this.state.selectionRemoved,""))),f.createElement("div",{className:e,id:this._ariaMap.selectedSuggestionAlert,"aria-live":"assertive"},this.getSuggestionsAlert(e),n)},t.prototype._updateAndResolveValue=function(e,t){void 0!==e?this.resolveNewValue(e,t):(this.suggestionStore.updateSuggestions(t,-1),this.state.suggestionsLoading&&this.setState({suggestionsLoading:!1}))},t.prototype._updateSelectedItems=function(e){var t=this;this.props.selectedItems?this.onChange(e):this.setState({items:e},(function(){t._onSelectedItemsUpdated(e)}))},t.prototype._onSelectedItemsUpdated=function(e){this.onChange(e)},t.prototype._getShowSuggestions=function(){return void 0!==this.input.current&&null!==this.input.current&&this.input.current.inputElement===document.activeElement&&""!==this.input.current.value},t.prototype._getTextFromItem=function(e,t){return this.props.getTextFromItem?this.props.getTextFromItem(e,t):""},t}(f.Component),Bx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.prototype.render=function(){var e=this.state,t=e.suggestedDisplayValue,o=e.isFocused,n=this.props,r=n.className,i=n.inputProps,a=n.disabled,s=n.selectionAriaLabel,l=n.selectionRole,c=void 0===l?"list":l,u=n.theme,p=n.styles,h=this.state.suggestionsVisible?this._ariaMap.suggestionList:"",m=p?Mx(p,{theme:u,className:r,isFocused:o,inputClassName:i&&i.className}):{root:qr("ms-BasePicker",r||""),text:qr("ms-BasePicker-text",Rx.pickerText,this.state.isFocused&&Rx.inputFocused,a&&Rx.inputDisabled),itemsWrapper:Rx.pickerItems,input:qr("ms-BasePicker-input",Rx.pickerInput,i&&i.className),screenReaderText:Rx.screenReaderOnly},g=this.props["aria-label"]||(null==i?void 0:i["aria-label"]);return f.createElement("div",{ref:this.root,onBlur:this.onBlur,onFocus:this.onFocus},f.createElement("div",{className:m.root,onKeyDown:this.onKeyDown},this.renderCustomAlert(m.screenReaderText),f.createElement("div",{className:m.text,"aria-owns":h||void 0},f.createElement(Qi,d({},i,{className:m.input,componentRef:this.input,onFocus:this.onInputFocus,onBlur:this.onInputBlur,onClick:this.onClick,onInputValueChange:this.onInputChange,suggestedDisplayValue:t,"aria-activedescendant":this.getActiveDescendant(),"aria-controls":h||void 0,"aria-expanded":!!this.state.suggestionsVisible,"aria-haspopup":"listbox","aria-label":g,role:"combobox",id:(null==i?void 0:i.id)?i.id:this._ariaMap.combobox,disabled:a,onInputChange:this.props.onInputChange})))),this.renderSuggestions(),f.createElement(vv,{selection:this.selection,selectionMode:ev.single},f.createElement("div",{id:this._ariaMap.selectedItems,className:"ms-BasePicker-selectedItems",role:c,"aria-label":s||g},this.renderItems())))},t.prototype.onBackspace=function(e){},t}(Nx),Fx={root:"ms-PickerPersona-container",itemContent:"ms-PickerItem-content",removeButton:"ms-PickerItem-removeButton",isSelected:"is-selected",isInvalid:"is-invalid"},Ax=Jn(),Lx=function(e){var t=e.item,o=e.onRemoveItem,n=e.index,r=e.selected,i=e.removeButtonAriaLabel,a=e.styles,s=e.theme,l=e.className,c=e.disabled,u=e.removeButtonIconProps,p=Ka(),h=Ax(a,{theme:s,className:l,selected:r,disabled:c,invalid:t.ValidationState===fx.warning}),m=h.subComponentStyles?h.subComponentStyles.persona:void 0,g=h.subComponentStyles?h.subComponentStyles.personaCoin:void 0;return f.createElement("div",{className:h.root,role:"listitem"},f.createElement("div",{className:h.itemContent,id:"selectedItemPersona-"+p},f.createElement(qC,d({size:Yr.size24,styles:m,coinProps:{styles:g}},t))),f.createElement(id,{id:p,onClick:o,disabled:c,iconProps:null!=u?u:{iconName:"Cancel"},styles:{icon:{fontSize:"12px"}},className:h.removeButton,ariaLabel:i,"aria-labelledby":p+" selectedItemPersona-"+p,"data-selection-index":n}))},Hx=Vn(Lx,(function(e){var t,o,n,r,i,a,s,l=e.className,c=e.theme,u=e.selected,p=e.invalid,h=e.disabled,m=c.palette,g=c.semanticColors,f=c.fonts,v=Qo(Fx,c),b=[u&&!p&&!h&&{color:m.white,selectors:(t={":hover":{color:m.white}},t[ro]={color:"HighlightText"},t)},(p&&!u||p&&u&&h)&&{color:m.redDark,borderBottom:"2px dotted "+m.redDark,selectors:(o={},o["."+v.root+":hover &"]={color:m.redDark},o)},p&&u&&!h&&{color:m.white,borderBottom:"2px dotted "+m.white},h&&{selectors:(n={},n[ro]={color:"GrayText"},n)}],y=[p&&{fontSize:f.xLarge.fontSize}];return{root:[v.root,To(c,{inset:-2}),{borderRadius:15,display:"inline-flex",alignItems:"center",background:m.neutralLighter,margin:"1px 2px",cursor:"default",userSelect:"none",maxWidth:300,verticalAlign:"middle",minWidth:0,selectors:(r={":hover":{background:u||h?"":m.neutralLight}},r[ro]=[{border:"1px solid WindowText"},h&&{borderColor:"GrayText"}],r)},u&&!h&&[v.isSelected,{background:m.themePrimary,selectors:(i={},i[ro]=d({borderColor:"HighLight",background:"Highlight"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),i)}],p&&[v.isInvalid],p&&u&&!h&&{background:m.redDark},l],itemContent:[v.itemContent,{flex:"0 1 auto",minWidth:0,maxWidth:"100%",overflow:"hidden"}],removeButton:[v.removeButton,{borderRadius:15,color:m.neutralPrimary,flex:"0 0 auto",width:24,height:24,selectors:{":hover":{background:m.neutralTertiaryAlt,color:m.neutralDark}}},u&&[{color:m.white,selectors:(a={":hover":{color:m.white,background:m.themeDark},":active":{color:m.white,background:m.themeDarker}},a[ro]={color:"HighlightText"},a)},p&&{selectors:{":hover":{background:m.red},":active":{background:m.redDark}}}],h&&{selectors:(s={},s["."+qu.msButtonIcon]={color:g.buttonText},s)}],subComponentStyles:{persona:{primaryText:b},personaCoin:{initials:y}}}}),void 0,{scope:"PeoplePickerItem"}),Ox={root:"ms-PeoplePicker-personaContent",personaWrapper:"ms-PeoplePicker-Persona"},zx=Jn(),Wx=function(e){var t=e.personaProps,o=e.suggestionsProps,n=e.compact,r=e.styles,i=e.theme,a=e.className,s=zx(r,{theme:i,className:o&&o.suggestionsItemClassName||a}),l=s.subComponentStyles&&s.subComponentStyles.persona?s.subComponentStyles.persona:void 0;return f.createElement("div",{className:s.root},f.createElement(qC,d({size:Yr.size24,styles:l,className:s.personaWrapper,showSecondaryText:!n,showOverflowTooltip:!1},t)))},Vx=Vn(Wx,(function(e){var t,o,n,r=e.className,i=e.theme,a=Qo(Ox,i),s={selectors:(t={},t["."+vx.isSuggested+" &"]={selectors:(o={},o[ro]={color:"HighlightText"},o)},t["."+a.root+":hover &"]={selectors:(n={},n[ro]={color:"HighlightText"},n)},t)};return{root:[a.root,{width:"100%",padding:"4px 12px"},r],personaWrapper:[a.personaWrapper,{width:180}],subComponentStyles:{persona:{primaryText:s,secondaryText:s}}}}),void 0,{scope:"PeoplePickerItemSuggestion"}),Kx={root:"ms-BasePicker",text:"ms-BasePicker-text",itemsWrapper:"ms-BasePicker-itemsWrapper",input:"ms-BasePicker-input"};function Gx(e){var t,o,n,r=e.className,i=e.theme,a=e.isFocused,s=e.inputClassName,l=e.disabled;if(!i)throw new Error("theme is undefined or null in base BasePicker getStyles function.");var c=i.semanticColors,u=i.effects,d=i.fonts,p=c.inputBorder,h=c.inputBorderHovered,m=c.inputFocusBorderAlt,g=Qo(Kx,i),f=[d.medium,{color:c.inputPlaceholderText,opacity:1,selectors:(t={},t[ro]={color:"GrayText"},t)}],v={color:c.disabledText,selectors:(o={},o[ro]={color:"GrayText"},o)},b="rgba(218, 218, 218, 0.29)";return{root:[g.root,r],text:[g.text,{display:"flex",position:"relative",flexWrap:"wrap",alignItems:"center",boxSizing:"border-box",minWidth:180,minHeight:30,border:"1px solid "+p,borderRadius:u.roundedCorner2},!a&&!l&&{selectors:{":hover":{borderColor:h}}},a&&!l&&Ro(m,u.roundedCorner2),l&&{borderColor:b,selectors:(n={":after":{content:'""',position:"absolute",top:0,right:0,bottom:0,left:0,background:b}},n[ro]={borderColor:"GrayText",selectors:{":after":{background:"none"}}},n)}],itemsWrapper:[g.itemsWrapper,{display:"flex",flexWrap:"wrap",maxWidth:"100%"}],input:[g.input,d.medium,{height:30,border:"none",flexGrow:1,outline:"none",padding:"0 6px 0",alignSelf:"flex-end",borderRadius:u.roundedCorner2,backgroundColor:"transparent",color:c.inputText,selectors:{"::-ms-clear":{display:"none"}}},sn(f),l&&sn(v),s],screenReaderText:Mo}}var Ux=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t}(Nx),jx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t}(Bx),qx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.defaultProps={onRenderItem:function(e){return f.createElement(Hx,d({},e))},onRenderSuggestionsItem:function(e,t){return f.createElement(Vx,{personaProps:e,suggestionsProps:t})},createGenericItem:Xx},t}(Ux),Yx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.defaultProps={onRenderItem:function(e){return f.createElement(Hx,d({},e))},onRenderSuggestionsItem:function(e,t){return f.createElement(Vx,{personaProps:e,suggestionsProps:t,compact:!0})},createGenericItem:Xx},t}(Ux),Zx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t.defaultProps={onRenderItem:function(e){return f.createElement(Hx,d({},e))},onRenderSuggestionsItem:function(e,t){return f.createElement(Vx,{personaProps:e,suggestionsProps:t})},createGenericItem:Xx},t}(jx);function Xx(e,t){var o={key:e,primaryText:e,imageInitials:"!",ValidationState:t};return t!==fx.warning&&(o.imageInitials=Hr(e,jn())),o}var Qx=Vn(qx,Gx,void 0,{scope:"NormalPeoplePicker"}),Jx=Vn(Yx,Gx,void 0,{scope:"CompactPeoplePicker"}),$x=Vn(Zx,Gx,void 0,{scope:"ListPeoplePickerBase"}),ek={root:"ms-TagItem",text:"ms-TagItem-text",close:"ms-TagItem-close",isSelected:"is-selected"},tk=Jn(),ok=function(e){var t=e.theme,o=e.styles,n=e.selected,r=e.disabled,i=e.enableTagFocusInDisabledPicker,a=e.children,s=e.className,l=e.index,c=e.onRemoveItem,u=e.removeButtonAriaLabel,p=e.title,h=void 0===p?"string"==typeof e.children?e.children:e.item.name:p,m=e.removeButtonIconProps,g=tk(o,{theme:t,className:s,selected:n,disabled:r}),v=hu(),b=i?{"aria-disabled":r,tabindex:0}:{disabled:r};return f.createElement("div",{className:g.root,role:"listitem",key:l},f.createElement("span",{className:g.text,title:h,id:v+"-text"},a),f.createElement(id,d({id:v,onClick:c},b,{iconProps:null!=m?m:{iconName:"Cancel"},styles:{icon:{fontSize:"12px"}},className:g.close,ariaLabel:u,"aria-labelledby":v+" "+v+"-text","data-selection-index":l})))},nk=Vn(ok,(function(e){var t,o,n,r,i=e.className,a=e.theme,s=e.selected,l=e.disabled,c=a.palette,u=a.effects,d=a.fonts,p=a.semanticColors,h=Qo(ek,a);return{root:[h.root,d.medium,To(a),{boxSizing:"content-box",flexShrink:"1",margin:2,height:26,lineHeight:26,cursor:"default",userSelect:"none",display:"flex",flexWrap:"nowrap",maxWidth:300,minWidth:0,borderRadius:u.roundedCorner2,color:p.inputText,background:c.neutralLighter,selectors:(t={":hover":[!l&&!s&&{color:c.neutralDark,background:c.neutralLight,selectors:{".ms-TagItem-close":{color:c.neutralPrimary}}},l&&{background:c.neutralLighter}],":focus-within":[!l&&{background:c.themePrimary,color:c.white}]},t[ro]={border:"1px solid "+(s?"WindowFrame":"WindowText")},t)},l&&{selectors:(o={},o[ro]={borderColor:"GrayText"},o)},s&&!l&&[h.isSelected],i],text:[h.text,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:30,margin:"0 8px"},l&&{selectors:(n={},n[ro]={color:"GrayText"},n)}],close:[h.close,{color:c.neutralSecondary,width:30,height:"100%",flex:"0 0 auto",borderRadius:jn(a)?u.roundedCorner2+" 0 0 "+u.roundedCorner2:"0 "+u.roundedCorner2+" "+u.roundedCorner2+" 0",selectors:{":hover":{background:c.neutralQuaternaryAlt,color:c.neutralPrimary},":focus":{color:c.white,background:c.themePrimary},":focus:hover":{color:c.white,background:c.themeDark},":active":{color:c.white,backgroundColor:c.themeDark}}},l&&{selectors:(r={},r["."+qu.msButtonIcon]={color:c.neutralSecondary},r)}]}}),void 0,{scope:"TagItem"}),rk={suggestionTextOverflow:"ms-TagItem-TextOverflow"},ik=Jn(),ak=function(e){var t=e.styles,o=e.theme,n=e.children,r=ik(t,{theme:o});return f.createElement("div",{className:r.suggestionTextOverflow}," ",n," ")},sk=Vn(ak,(function(e){var t=e.className,o=e.theme;return{suggestionTextOverflow:[Qo(rk,o).suggestionTextOverflow,{overflow:"hidden",textOverflow:"ellipsis",maxWidth:"60vw",padding:"6px 12px 7px",whiteSpace:"nowrap"},t]}}),void 0,{scope:"TagItemSuggestion"}),lk=function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),o}return u(t,e),t.defaultProps={onRenderItem:function(e){return f.createElement(nk,d({},e),e.item.name)},onRenderSuggestionsItem:function(e){return f.createElement(sk,null,e.name)}},t}(Nx),ck=Vn(lk,Gx,void 0,{scope:"TagPicker"});function uk(e,t){void 0===t&&(t=null);var o,n=f.useRef({ref:(o=function(e){n.ref.current!==e&&(n.cleanup&&(n.cleanup(),n.cleanup=void 0),n.ref.current=e,null!==e&&(n.cleanup=n.callback(e)))},o.current=t,o),callback:e}).current;return n.callback=e,n.ref}var dk=function(e){function t(t){var o=e.call(this,t)||this;return Gi(o),xi("PivotItem",t,{linkText:"headerText"}),o}return u(t,e),t.prototype.render=function(){return f.createElement("div",d({},Tr(this.props,Dr)),this.props.children)},t}(f.Component),pk=Jn(),hk=function(e,t){var o={links:[],keyToIndexMapping:{},keyToTabIdMapping:{}};return f.Children.forEach(f.Children.toArray(e.children),(function(n,r){if(mk(n)){var i=n.props,a=i.linkText,s=p(i,["linkText"]),l=n.props.itemKey||r.toString();o.links.push(d(d({headerText:a},s),{itemKey:l})),o.keyToIndexMapping[l]=r,o.keyToTabIdMapping[l]=function(e,t,o,n){return e.getTabId?e.getTabId(o,n):t+"-Tab"+n}(e,t,l,r)}else n&&cn("The children of a Pivot component must be of type PivotItem to be rendered.")})),o},mk=function(e){var t;return f.isValidElement(e)&&(null===(t=e.type)||void 0===t?void 0:t.name)===dk.name},gk=f.forwardRef((function(e,t){var o,n=f.useRef(null),r=f.useRef(null),i=hu("Pivot"),a=kh(e.selectedKey,e.defaultSelectedKey),s=a[0],l=a[1],c=e.componentRef,u=e.theme,p=e.linkSize,h=e.linkFormat,m=e.overflowBehavior,g=e.overflowAriaLabel,v=e.focusZoneProps,b={"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"]},y=Tr(e,Dr,["aria-label","aria-labelledby"]),C=hk(e,i);f.useImperativeHandle(c,(function(){return{focus:function(){var e;null===(e=n.current)||void 0===e||e.focus()}}}));var _=function(e){if(!e)return null;var t=e.itemCount,n=e.itemIcon,r=e.headerText;return f.createElement("span",{className:o.linkContent},void 0!==n&&f.createElement("span",{className:o.icon},f.createElement(ii,{iconName:n})),void 0!==r&&f.createElement("span",{className:o.text}," ",e.headerText),void 0!==t&&f.createElement("span",{className:o.count}," (",t,")"))},S=function(e,t,n,r){var i,a=t.itemKey,s=t.headerButtonProps,l=t.onRenderItemLink,c=e.keyToTabIdMapping[a],u=n===a;i=l?l(t,_):_(t);var p=t.headerText||"";return p+=t.itemCount?" ("+t.itemCount+")":"",p+=t.itemIcon?" xx":"",f.createElement(Xd,d({},s,{id:c,key:a,className:qr(r,u&&o.linkIsSelected),onClick:function(e){return x(a,e)},onKeyDown:function(e){return k(a,e)},"aria-label":t.ariaLabel,role:t.role||"tab","aria-selected":u,name:t.headerText,keytipProps:t.keytipProps,"data-content":p}),i)},x=function(e,t){t.preventDefault(),w(e,t)},k=function(e,t){t.which===Gn.enter&&(t.preventDefault(),w(e))},w=function(t,o){var n;if(l(t),C=hk(e,i),e.onLinkClick&&C.keyToIndexMapping[t]>=0){var a=C.keyToIndexMapping[t],s=f.Children.toArray(e.children)[a];mk(s)&&e.onLinkClick(s,o)}null===(n=r.current)||void 0===n||n.dismissMenu()};o=pk(e.styles,{theme:u,linkSize:p,linkFormat:h});var I,D=null===(I=s)||void 0!==I&&void 0!==C.keyToIndexMapping[I]?s:C.links.length?C.links[0].itemKey:void 0,T=D?C.keyToIndexMapping[D]:0,E=C.links.map((function(e){return S(C,e,D,o.link)})),P=f.useMemo((function(){return{items:[],alignTargetEdge:!0,directionalHint:Ys.bottomRightEdge}}),[]),R=function(e){var t=e.onOverflowItemsChanged,o=e.rtl,n=e.pinnedIndex,r=f.useRef(),i=f.useRef(),a=uk((function(e){var t=function(e,t){if("undefined"!=typeof ResizeObserver){var o=new ResizeObserver(t);return Array.isArray(e)?e.forEach((function(e){return o.observe(e)})):o.observe(e),function(){return o.disconnect()}}var n=function(){return t(void 0)},r=at(Array.isArray(e)?e[0]:e);if(!r)return function(){};var i=r.requestAnimationFrame(n);return r.addEventListener("resize",n,!1),function(){r.cancelAnimationFrame(i),r.removeEventListener("resize",n,!1)}}(e,(function(t){i.current=t?t[0].contentRect.width:e.clientWidth,r.current&&r.current()}));return function(){t(),i.current=void 0}})),s=uk((function(e){return a(e.parentElement),function(){return a(null)}}));return f.useLayoutEffect((function(){var e=a.current,l=s.current;if(e&&l){for(var c=[],u=0;u<e.children.length;u++){var d=e.children[u];d instanceof HTMLElement&&d!==l&&c.push(d)}var p=[],h=0;r.current=function(){var e=i.current;if(void 0!==e){for(var t=c.length-1;t>=0;t--){if(void 0===p[t]){var r=o?e-c[t].offsetLeft:c[t].offsetLeft+c[t].offsetWidth;t+1<c.length&&t+1===n&&(h=p[t+1]-r),t===c.length-2&&(h+=l.offsetWidth),p[t]=r+h}if(e>p[t])return void g(t+1)}g(0)}};var m=c.length,g=function(e){m!==e&&(m=e,t(e,c.map((function(t,o){return{ele:t,isOverflowing:o>=e&&o!==n}}))))},f=void 0;if(void 0!==i.current){var v=at(e);if(v){var b=v.requestAnimationFrame(r.current);f=function(){return v.cancelAnimationFrame(b)}}}return function(){f&&f(),g(c.length),r.current=void 0}}})),{menuButtonRef:s}}({onOverflowItemsChanged:function(e,t){t.forEach((function(e){var t=e.ele,o=e.isOverflowing;return t.dataset.isOverflowing=""+o})),P.items=C.links.slice(e).filter((function(e){return e.itemKey!==D})).map((function(t,n){return{key:t.itemKey||""+(e+n),onRender:function(){return S(C,t,D,o.linkInMenu)}}}))},rtl:jn(u),pinnedIndex:T}).menuButtonRef;return f.createElement("div",d({ref:t},y),f.createElement(bs,d({componentRef:n,role:"tablist"},b,{direction:$i.horizontal},v,{className:qr(o.root,null==v?void 0:v.className)}),E,"menu"===m&&f.createElement(Xd,{className:qr(o.link,o.overflowMenuButton),elementRef:R,componentRef:r,menuProps:P,menuIconProps:{iconName:"More",style:{color:"inherit"}},ariaLabel:g})),D&&C.links.map((function(t){return(!0===t.alwaysRender||D===t.itemKey)&&function(t,n){if(e.headersOnly||!t)return null;var r=C.keyToIndexMapping[t],i=C.keyToTabIdMapping[t];return f.createElement("div",{role:"tabpanel",hidden:!n,key:t,"aria-hidden":!n,"aria-labelledby":i,className:o.itemContainer},f.Children.toArray(e.children)[r])}(t.itemKey,D===t.itemKey)})))}));gk.displayName="Pivot";var fk,vk,bk={count:"ms-Pivot-count",icon:"ms-Pivot-icon",linkIsSelected:"is-selected",link:"ms-Pivot-link",linkContent:"ms-Pivot-linkContent",root:"ms-Pivot",rootIsLarge:"ms-Pivot--large",rootIsTabs:"ms-Pivot--tabs",text:"ms-Pivot-text",linkInMenu:"ms-Pivot-linkInMenu",overflowMenuButton:"ms-Pivot-overflowMenuButton"},yk=function(e,t,o){var n,r,i;void 0===o&&(o=!1);var a=e.linkSize,s=e.linkFormat,l=e.theme,c=l.semanticColors,u=l.fonts,p="large"===a,h="tabs"===s;return[u.medium,{color:c.actionLink,padding:"0 8px",position:"relative",backgroundColor:"transparent",border:0,borderRadius:0,selectors:(n={":hover":{backgroundColor:c.buttonBackgroundHovered,color:c.buttonTextHovered,cursor:"pointer"},":active":{backgroundColor:c.buttonBackgroundPressed,color:c.buttonTextHovered},":focus":{outline:"none"}},n["."+wo+" &:focus"]={outline:"1px solid "+c.focusBorder},n["."+wo+" &:focus:after"]={content:"attr(data-content)",position:"relative",border:0},n)},!o&&[{display:"inline-block",lineHeight:44,height:44,marginRight:8,textAlign:"center",selectors:{":before":{backgroundColor:"transparent",bottom:0,content:'""',height:2,left:8,position:"absolute",right:8,transition:"left "+Le.durationValue2+" "+Le.easeFunction2+",\n right "+Le.durationValue2+" "+Le.easeFunction2},":after":{color:"transparent",content:"attr(data-content)",display:"block",fontWeight:qe.bold,height:1,overflow:"hidden",visibility:"hidden"}}},p&&{fontSize:u.large.fontSize},h&&[{marginRight:0,height:44,lineHeight:44,backgroundColor:c.buttonBackground,padding:"0 10px",verticalAlign:"top",selectors:(r={":focus":{outlineOffset:"-1px"}},r["."+wo+" &:focus::before"]={height:"auto",background:"transparent",transition:"none"},r["&:hover, &:focus"]={color:c.buttonTextCheckedHovered},r["&:active, &:hover"]={color:c.primaryButtonText,backgroundColor:c.primaryButtonBackground},r["&."+t.linkIsSelected]={backgroundColor:c.primaryButtonBackground,color:c.primaryButtonText,fontWeight:qe.regular,selectors:(i={":before":{backgroundColor:"transparent",transition:"none",position:"absolute",top:0,left:0,right:0,bottom:0,content:'""',height:0},":hover":{backgroundColor:c.primaryButtonBackgroundHovered,color:c.primaryButtonText},"&:active":{backgroundColor:c.primaryButtonBackgroundPressed,color:c.primaryButtonText}},i[ro]=d({fontWeight:qe.semibold,color:"HighlightText",background:"Highlight"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),i)},r)}]]]},Ck=Vn(gk,(function(e){var t,o,n,r,i=e.className,a=e.linkSize,s=e.linkFormat,l=e.theme,c=l.semanticColors,u=l.fonts,d=Qo(bk,l),p="large"===a,h="tabs"===s;return{root:[d.root,u.medium,on,{position:"relative",color:c.link,whiteSpace:"nowrap"},p&&d.rootIsLarge,h&&d.rootIsTabs,i],itemContainer:{selectors:{"&[hidden]":{display:"none"}}},link:m([d.link],yk(e,d),[(t={},t["&[data-is-overflowing='true']"]={display:"none"},t)]),overflowMenuButton:[d.overflowMenuButton,(o={visibility:"hidden",position:"absolute",right:0},o["."+d.link+"[data-is-overflowing='true'] ~ &"]={visibility:"visible",position:"relative"},o)],linkInMenu:m([d.linkInMenu],yk(e,d,!0),[{textAlign:"left",width:"100%",height:36,lineHeight:36}]),linkIsSelected:[d.link,d.linkIsSelected,{fontWeight:qe.semibold,selectors:(n={":before":{backgroundColor:c.inputBackgroundChecked,selectors:(r={},r[ro]={backgroundColor:"Highlight"},r)},":hover::before":{left:0,right:0}},n[ro]={color:"Highlight"},n)}],linkContent:[d.linkContent,{flex:"0 1 100%",selectors:{"& > * ":{marginLeft:4},"& > *:first-child":{marginLeft:0}}}],text:[d.text,{display:"inline-block",verticalAlign:"top"}],count:[d.count,{display:"inline-block",verticalAlign:"top"}],icon:d.icon}}),void 0,{scope:"Pivot"});!function(e){e.links="links",e.tabs="tabs"}(fk||(fk={})),function(e){e.normal="normal",e.large="large"}(vk||(vk={}));var _k,Sk=Jn(),xk=function(e){function t(t){var o=e.call(this,t)||this;o._onRenderProgress=function(e){var t=o.props,n=t.ariaValueText,r=t.barHeight,i=t.className,a=t.description,s=t.label,l=void 0===s?o.props.title:s,c=t.styles,u=t.theme,d="number"==typeof o.props.percentComplete?Math.min(100,Math.max(0,100*o.props.percentComplete)):void 0,p=Sk(c,{theme:u,className:i,barHeight:r,indeterminate:void 0===d}),h={width:void 0!==d?d+"%":void 0,transition:void 0!==d&&d<.01?"none":void 0},m=void 0!==d?0:void 0,g=void 0!==d?100:void 0,v=void 0!==d?Math.floor(d):void 0;return f.createElement("div",{className:p.itemProgress},f.createElement("div",{className:p.progressTrack}),f.createElement("div",{className:p.progressBar,style:h,role:"progressbar","aria-describedby":a?o._descriptionId:void 0,"aria-labelledby":l?o._labelId:void 0,"aria-valuemin":m,"aria-valuemax":g,"aria-valuenow":v,"aria-valuetext":n}))};var n=Ka("progress-indicator");return o._labelId=n+"-label",o._descriptionId=n+"-description",o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.barHeight,o=e.className,n=e.label,r=void 0===n?this.props.title:n,i=e.description,a=e.styles,s=e.theme,l=e.progressHidden,c=e.onRenderProgress,u=void 0===c?this._onRenderProgress:c,p="number"==typeof this.props.percentComplete?Math.min(100,Math.max(0,100*this.props.percentComplete)):void 0,h=Sk(a,{theme:s,className:o,barHeight:t,indeterminate:void 0===p});return f.createElement("div",{className:h.root},r?f.createElement("div",{id:this._labelId,className:h.itemName},r):null,l?null:u(d(d({},this.props),{percentComplete:p}),this._onRenderProgress),i?f.createElement("div",{id:this._descriptionId,className:h.itemDescription},i):null)},t.defaultProps={label:"",description:"",width:180},t}(f.Component),kk={root:"ms-ProgressIndicator",itemName:"ms-ProgressIndicator-itemName",itemDescription:"ms-ProgressIndicator-itemDescription",itemProgress:"ms-ProgressIndicator-itemProgress",progressTrack:"ms-ProgressIndicator-progressTrack",progressBar:"ms-ProgressIndicator-progressBar"},wk=jo((function(){return J({"0%":{left:"-30%"},"100%":{left:"100%"}})})),Ik=jo((function(){return J({"100%":{right:"-30%"},"0%":{right:"100%"}})})),Dk=Vn(xk,(function(e){var t,o,n,r=jn(e.theme),i=e.className,a=e.indeterminate,s=e.theme,l=e.barHeight,c=void 0===l?2:l,u=s.palette,p=s.semanticColors,h=s.fonts,m=Qo(kk,s),g=u.neutralLight;return{root:[m.root,h.medium,i],itemName:[m.itemName,nn,{color:p.bodyText,paddingTop:4,lineHeight:20}],itemDescription:[m.itemDescription,{color:p.bodySubtext,fontSize:h.small.fontSize,lineHeight:18}],itemProgress:[m.itemProgress,{position:"relative",overflow:"hidden",height:c,padding:"8px 0"}],progressTrack:[m.progressTrack,{position:"absolute",width:"100%",height:c,backgroundColor:g,selectors:(t={},t[ro]={borderBottom:"1px solid WindowText"},t)}],progressBar:[{backgroundColor:u.themePrimary,height:c,position:"absolute",transition:"width .3s ease",width:0,selectors:(o={},o[ro]=d({backgroundColor:"highlight"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),o)},a?{position:"absolute",minWidth:"33%",background:"linear-gradient(to right, "+g+" 0%, "+u.themePrimary+" 50%, "+g+" 100%)",animation:(r?Ik():wk())+" 3s infinite",selectors:(n={},n[ro]={background:"highlight"},n)}:{transition:"width .15s linear"},m.progressBar]}}),void 0,{scope:"ProgressIndicator"}),Tk={root:"ms-RatingStar-root",rootIsSmall:"ms-RatingStar-root--small",rootIsLarge:"ms-RatingStar-root--large",ratingStar:"ms-RatingStar-container",ratingStarBack:"ms-RatingStar-back",ratingStarFront:"ms-RatingStar-front",ratingButton:"ms-Rating-button",ratingStarIsSmall:"ms-Rating--small",ratingStartIsLarge:"ms-Rating--large",labelText:"ms-Rating-labelText",ratingFocusZone:"ms-Rating-focuszone"};function Ek(e,t){var o;return{color:e,selectors:(o={},o[ro]={color:t},o)}}!function(e){e[e.Small=0]="Small",e[e.Large=1]="Large"}(_k||(_k={}));var Pk=Jn(),Rk=function(e){return f.createElement("div",{className:e.classNames.ratingStar},f.createElement(ii,{className:e.classNames.ratingStarBack,iconName:0===e.fillPercentage||100===e.fillPercentage?e.icon:e.unselectedIcon}),!e.disabled&&f.createElement(ii,{className:e.classNames.ratingStarFront,iconName:e.icon,style:{width:e.fillPercentage+"%"}}))},Mk=function(e,t){return e+"-star-"+(t-1)},Nk=f.forwardRef((function(e,t){var o=hu("Rating"),n=hu("RatingLabel"),r=e.ariaLabel,i=e.ariaLabelFormat,a=e.disabled,s=e.getAriaLabel,l=e.styles,c=e.min,u=void 0===c?e.allowZeroStars?0:1:c,p=e.max,h=void 0===p?5:p,m=e.readOnly,g=e.size,v=e.theme,b=e.icon,y=void 0===b?"FavoriteStarFill":b,C=e.unselectedIcon,_=void 0===C?"FavoriteStar":C,S=e.onRenderStar,x=Math.max(u,0),k=kh(e.rating,e.defaultRating,e.onChange),w=k[0],I=k[1],D=function(e,t,o){return Math.min(Math.max(null!=e?e:t,t),o)}(w,x,h);!function(e){Ri({name:"Rating",props:e,controlledUsage:{valueProp:"rating",defaultValueProp:"defaultRating",onChangeProp:"onChange",readOnlyProp:"readOnly"}})}(e),function(e,t){f.useImperativeHandle(e,(function(){return{rating:t}}),[t])}(e.componentRef,D);for(var T=Tr(e,Dr),E=Pk(l,{disabled:a,readOnly:m,theme:v}),P=null==s?void 0:s(D,h),R=r||P,M=[],N=function(e){var t,r,s=function(e,t){var o=Math.ceil(t),n=100;return e===t?n=100:e===o?n=t%1*100:e>o&&(n=0),n}(e,D),l=function(t){void 0!==w&&Math.ceil(w)===e||I(e,t)};M.push(f.createElement("button",d({className:qr(E.ratingButton,g===_k.Large?E.ratingStarIsLarge:E.ratingStarIsSmall),id:Mk(o,e),key:e},e===Math.ceil(D)&&{"data-is-current":!0},{onFocus:l,onClick:l,disabled:!(!a&&!m),role:"radio","aria-hidden":m?"true":void 0,type:"button","aria-checked":e===Math.ceil(D)}),f.createElement("span",{id:n+"-"+e,className:E.labelText},Bp(i||"",e,h)),(t={fillPercentage:s,disabled:a,classNames:E,icon:s>0?y:_,starNum:e,unselectedIcon:_},(r=S)?r(t):f.createElement(Rk,d({},t)))))},B=1;B<=h;B++)N(B);var F=g===_k.Large?E.rootIsLarge:E.rootIsSmall;return f.createElement("div",d({ref:t,className:qr("ms-Rating-star",E.root,F),"aria-label":m?void 0:R,id:o,role:m?void 0:"radiogroup"},T),f.createElement(bs,d({direction:$i.bidirectional,className:qr(E.ratingFocusZone,F),defaultActiveElement:"#"+Mk(o,Math.ceil(D))},m&&{allowFocusRoot:!0,disabled:!0,role:"textbox","aria-label":P,"aria-readonly":!0,"data-is-focusable":!0,tabIndex:0}),M))}));Nk.displayName="RatingBase";var Bk=Vn(Nk,(function(e){var t=e.disabled,o=e.readOnly,n=e.theme,r=n.semanticColors,i=n.palette,a=Qo(Tk,n),s=i.neutralSecondary,l=i.themePrimary,c=i.themeDark,u=i.neutralPrimary,d=r.disabledBodySubtext;return{root:[a.root,n.fonts.medium,!t&&!o&&{selectors:{"&:hover":{selectors:{".ms-RatingStar-back":Ek(u,"Highlight")}}}}],rootIsSmall:[a.rootIsSmall,{height:"32px"}],rootIsLarge:[a.rootIsLarge,{height:"36px"}],ratingStar:[a.ratingStar,{display:"inline-block",position:"relative",height:"inherit"}],ratingStarBack:[a.ratingStarBack,{color:s,width:"100%"},t&&Ek(d,"GrayText")],ratingStarFront:[a.ratingStarFront,{position:"absolute",height:"100 %",left:"0",top:"0",textAlign:"center",verticalAlign:"middle",overflow:"hidden"},Ek(u,"Highlight")],ratingButton:[To(n),a.ratingButton,{backgroundColor:"transparent",padding:"8px 2px",boxSizing:"content-box",margin:"0px",border:"none",cursor:"pointer",selectors:{"&:disabled":{cursor:"default"},"&[disabled]":{cursor:"default"}}},!t&&!o&&{selectors:{"&:hover ~ .ms-Rating-button":{selectors:{".ms-RatingStar-back":Ek(s,"WindowText"),".ms-RatingStar-front":Ek(s,"WindowText")}},"&:hover":{selectors:{".ms-RatingStar-back":{color:l},".ms-RatingStar-front":{color:c}}}}},t&&{cursor:"default"}],ratingStarIsSmall:[a.ratingStarIsSmall,{fontSize:"16px",lineHeight:"16px",height:"16px"}],ratingStarIsLarge:[a.ratingStartIsLarge,{fontSize:"20px",lineHeight:"20px",height:"20px"}],labelText:[a.labelText,Mo],ratingFocusZone:[To(n),a.ratingFocusZone,{display:"inline-block"}]}}),void 0,{scope:"Rating"}),Fk={root:"ms-ScrollablePane",contentContainer:"ms-ScrollablePane--contentContainer"},Ak={auto:"auto",always:"always"},Lk=f.createContext({scrollablePane:void 0}),Hk=Jn(),Ok=function(e){function t(t){var o=e.call(this,t)||this;return o._root=f.createRef(),o._stickyAboveRef=f.createRef(),o._stickyBelowRef=f.createRef(),o._contentContainer=f.createRef(),o.subscribe=function(e){o._subscribers.add(e)},o.unsubscribe=function(e){o._subscribers.delete(e)},o.addSticky=function(e){o._stickies.add(e),o.contentContainer&&(e.setDistanceFromTop(o.contentContainer),o.sortSticky(e))},o.removeSticky=function(e){o._stickies.delete(e),o._removeStickyFromContainers(e),o.notifySubscribers()},o.sortSticky=function(e,t){o.stickyAbove&&o.stickyBelow&&(t&&o._removeStickyFromContainers(e),e.canStickyTop&&e.stickyContentTop&&o._addToStickyContainer(e,o.stickyAbove,e.stickyContentTop),e.canStickyBottom&&e.stickyContentBottom&&o._addToStickyContainer(e,o.stickyBelow,e.stickyContentBottom))},o.updateStickyRefHeights=function(){var e=o._stickies,t=0,n=0;e.forEach((function(e){var r=e.state,i=r.isStickyTop,a=r.isStickyBottom;e.nonStickyContent&&(i&&(t+=e.nonStickyContent.offsetHeight),a&&(n+=e.nonStickyContent.offsetHeight),o._checkStickyStatus(e))})),o.setState({stickyTopHeight:t,stickyBottomHeight:n})},o.notifySubscribers=function(){o.contentContainer&&o._subscribers.forEach((function(e){e(o.contentContainer,o.stickyBelow)}))},o.getScrollPosition=function(){return o.contentContainer?o.contentContainer.scrollTop:0},o.syncScrollSticky=function(e){e&&o.contentContainer&&e.syncScroll(o.contentContainer)},o._getScrollablePaneContext=function(){return{scrollablePane:{subscribe:o.subscribe,unsubscribe:o.unsubscribe,addSticky:o.addSticky,removeSticky:o.removeSticky,updateStickyRefHeights:o.updateStickyRefHeights,sortSticky:o.sortSticky,notifySubscribers:o.notifySubscribers,syncScrollSticky:o.syncScrollSticky}}},o._addToStickyContainer=function(e,t,n){if(t.children.length){if(!t.contains(n)){var r=[].slice.call(t.children),i=[];o._stickies.forEach((function(n){(t===o.stickyAbove&&e.canStickyTop||e.canStickyBottom)&&i.push(n)}));for(var a=void 0,s=0,l=i.sort((function(e,t){return(e.state.distanceFromTop||0)-(t.state.distanceFromTop||0)})).filter((function(e){var n=t===o.stickyAbove?e.stickyContentTop:e.stickyContentBottom;return!!n&&r.indexOf(n)>-1}));s<l.length;s++){var c=l[s];if((c.state.distanceFromTop||0)>=(e.state.distanceFromTop||0)){a=c;break}}var u=null;a&&(u=t===o.stickyAbove?a.stickyContentTop:a.stickyContentBottom),t.insertBefore(n,u)}}else t.appendChild(n)},o._removeStickyFromContainers=function(e){o.stickyAbove&&e.stickyContentTop&&o.stickyAbove.contains(e.stickyContentTop)&&o.stickyAbove.removeChild(e.stickyContentTop),o.stickyBelow&&e.stickyContentBottom&&o.stickyBelow.contains(e.stickyContentBottom)&&o.stickyBelow.removeChild(e.stickyContentBottom)},o._onWindowResize=function(){var e=o._getScrollbarWidth(),t=o._getScrollbarHeight();o.setState({scrollbarWidth:e,scrollbarHeight:t}),o.notifySubscribers()},o._getStickyContainerStyle=function(e,t){return d(d({height:e},jn(o.props.theme)?{right:"0",left:(o.state.scrollbarWidth||o._getScrollbarWidth()||0)+"px"}:{left:"0",right:(o.state.scrollbarWidth||o._getScrollbarWidth()||0)+"px"}),t?{top:"0"}:{bottom:(o.state.scrollbarHeight||o._getScrollbarHeight()||0)+"px"})},o._onScroll=function(){var e=o.contentContainer;e&&o._stickies.forEach((function(t){t.syncScroll(e)})),o._notifyThrottled()},o._subscribers=new Set,o._stickies=new Set,Gi(o),o._async=new Zi(o),o._events=new zs(o),o.state={stickyTopHeight:0,stickyBottomHeight:0,scrollbarWidth:0,scrollbarHeight:0},o._notifyThrottled=o._async.throttle(o.notifySubscribers,50),o}return u(t,e),Object.defineProperty(t.prototype,"root",{get:function(){return this._root.current},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stickyAbove",{get:function(){return this._stickyAboveRef.current},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stickyBelow",{get:function(){return this._stickyBelowRef.current},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentContainer",{get:function(){return this._contentContainer.current},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){var e=this,t=this.props.initialScrollPosition;this._events.on(this.contentContainer,"scroll",this._onScroll),this._events.on(window,"resize",this._onWindowResize),this.contentContainer&&t&&(this.contentContainer.scrollTop=t),this.setStickiesDistanceFromTop(),this._stickies.forEach((function(t){e.sortSticky(t)})),this.notifySubscribers(),"MutationObserver"in window&&(this._mutationObserver=new MutationObserver((function(t){var o=e._getScrollbarHeight();if(o!==e.state.scrollbarHeight&&e.setState({scrollbarHeight:o}),e.notifySubscribers(),t.some(function(e){return null!==this.stickyAbove&&null!==this.stickyBelow&&(this.stickyAbove.contains(e.target)||this.stickyBelow.contains(e.target))}.bind(e)))e.updateStickyRefHeights();else{var n=[];e._stickies.forEach((function(e){e.root&&e.root.contains(t[0].target)&&n.push(e)})),n.length&&n.forEach((function(e){e.forceUpdate()}))}})),this.root&&this._mutationObserver.observe(this.root,{childList:!0,attributes:!0,subtree:!0,characterData:!0}))},t.prototype.componentWillUnmount=function(){this._events.dispose(),this._async.dispose(),this._mutationObserver&&this._mutationObserver.disconnect()},t.prototype.shouldComponentUpdate=function(e,t){return this.props.children!==e.children||this.props.initialScrollPosition!==e.initialScrollPosition||this.props.className!==e.className||this.state.stickyTopHeight!==t.stickyTopHeight||this.state.stickyBottomHeight!==t.stickyBottomHeight||this.state.scrollbarWidth!==t.scrollbarWidth||this.state.scrollbarHeight!==t.scrollbarHeight},t.prototype.componentDidUpdate=function(e,t){var o=this.props.initialScrollPosition;this.contentContainer&&"number"==typeof o&&e.initialScrollPosition!==o&&(this.contentContainer.scrollTop=o),t.stickyTopHeight===this.state.stickyTopHeight&&t.stickyBottomHeight===this.state.stickyBottomHeight||this.notifySubscribers(),this._async.setTimeout(this._onWindowResize,0)},t.prototype.render=function(){var e=this.props,t=e.className,o=e.scrollContainerFocus,n=e.scrollContainerAriaLabel,r=e.theme,i=e.styles,a=this.state,s=a.stickyTopHeight,l=a.stickyBottomHeight,c=Hk(i,{theme:r,className:t,scrollbarVisibility:this.props.scrollbarVisibility}),u=o?{role:"group",tabIndex:0,"aria-label":n}:{};return f.createElement("div",d({},Tr(this.props,Dr),{ref:this._root,className:c.root}),f.createElement("div",{ref:this._stickyAboveRef,className:c.stickyAbove,style:this._getStickyContainerStyle(s,!0)}),f.createElement("div",d({ref:this._contentContainer},u,{className:c.contentContainer,"data-is-scrollable":!0}),f.createElement(Lk.Provider,{value:this._getScrollablePaneContext()},this.props.children)),f.createElement("div",{className:c.stickyBelow,style:this._getStickyContainerStyle(l,!1)},f.createElement("div",{ref:this._stickyBelowRef,className:c.stickyBelowItems})))},t.prototype.setStickiesDistanceFromTop=function(){var e=this;this.contentContainer&&this._stickies.forEach((function(t){t.setDistanceFromTop(e.contentContainer)}))},t.prototype.forceLayoutUpdate=function(){this._onWindowResize()},t.prototype._checkStickyStatus=function(e){this.stickyAbove&&this.stickyBelow&&this.contentContainer&&e.nonStickyContent&&(e.state.isStickyTop||e.state.isStickyBottom?(e.state.isStickyTop&&!this.stickyAbove.contains(e.nonStickyContent)&&e.stickyContentTop&&e.addSticky(e.stickyContentTop),e.state.isStickyBottom&&!this.stickyBelow.contains(e.nonStickyContent)&&e.stickyContentBottom&&e.addSticky(e.stickyContentBottom)):this.contentContainer.contains(e.nonStickyContent)||e.resetSticky())},t.prototype._getScrollbarWidth=function(){var e=this.contentContainer;return e?e.offsetWidth-e.clientWidth:0},t.prototype._getScrollbarHeight=function(){var e=this.contentContainer;return e?e.offsetHeight-e.clientHeight:0},t}(f.Component),zk=Vn(Ok,(function(e){var t,o,n=e.className,r=e.theme,i=Qo(Fk,r),a={position:"absolute",pointerEvents:"none"},s={position:"absolute",top:0,right:0,bottom:0,left:0,WebkitOverflowScrolling:"touch"};return{root:[i.root,r.fonts.medium,s,n],contentContainer:[i.contentContainer,{overflowY:"always"===e.scrollbarVisibility?"scroll":"auto"},s],stickyAbove:[{top:0,zIndex:1,selectors:(t={},t[ro]={borderBottom:"1px solid WindowText"},t)},a],stickyBelow:[{bottom:0,selectors:(o={},o[ro]={borderTop:"1px solid WindowText"},o)},a],stickyBelowItems:[{bottom:0},a,{width:"100%"}]}}),void 0,{scope:"ScrollablePane"}),Wk="SearchBox",Vk={root:{height:"auto"},icon:{fontSize:"12px"}},Kk={iconName:"Clear"},Gk={ariaLabel:"Clear text"},Uk=Jn(),jk=f.forwardRef((function(e,t){var o=e.ariaLabel,n=e.className,r=e.defaultValue,i=void 0===r?"":r,a=e.disabled,s=e.underlined,l=e.styles,c=e.labelText,u=e.placeholder,p=void 0===u?c:u,h=e.theme,m=e.clearButtonProps,g=void 0===m?Gk:m,v=e.disableAnimation,b=void 0!==v&&v,y=e.showIcon,C=void 0!==y&&y,_=e.onClear,S=e.onBlur,x=e.onEscape,k=e.onSearch,w=e.onKeyDown,I=e.iconProps,D=e.role,T=e.onChange,E=e.onChanged,P=f.useState(!1),R=P[0],M=P[1],N=kh(e.value,i,f.useCallback((function(e){null==T||T(e,null==e?void 0:e.target.value),null==E||E(null==e?void 0:e.target.value)}),[T,E])),B=N[0],F=N[1],A=String(B),L=f.useRef(null),H=f.useRef(null),O=Or(L,t),z=hu(Wk,e.id),W=g.onClick,V=Uk(l,{theme:h,className:n,underlined:s,hasFocus:R,disabled:a,hasInput:A.length>0,disableAnimation:b,showIcon:C}),K=Tr(e,hr,["className","placeholder","onFocus","onBlur","value","role"]),G=f.useCallback((function(e){var t;null==_||_(e),e.defaultPrevented||(F(""),null===(t=H.current)||void 0===t||t.focus(),e.stopPropagation(),e.preventDefault())}),[_,F]),U=f.useCallback((function(e){null==W||W(e),e.defaultPrevented||G(e)}),[W,G]),j=f.useCallback((function(e){M(!1),null==S||S(e)}),[S]),q=function(e){F(e.target.value,e)};return function(e){Ri({name:Wk,props:e,deprecations:{labelText:"placeholder"}})}(e),function(e,t,o){f.useImperativeHandle(e,(function(){return{focus:function(){var e;return null===(e=t.current)||void 0===e?void 0:e.focus()},hasFocus:function(){return o}}}),[t,o])}(e.componentRef,H,R),f.createElement("div",{role:D,ref:O,className:V.root,onFocusCapture:function(t){var o;M(!0),null===(o=e.onFocus)||void 0===o||o.call(e,t)}},f.createElement("div",{className:V.iconContainer,onClick:function(){H.current&&(H.current.focus(),H.current.selectionStart=H.current.selectionEnd=0)},"aria-hidden":!0},f.createElement(ii,d({iconName:"Search"},I,{className:V.icon}))),f.createElement("input",d({},K,{id:z,className:V.field,placeholder:p,onChange:q,onInput:q,onBlur:j,onKeyDown:function(e){switch(e.which){case Gn.escape:null==x||x(e),A&&!e.defaultPrevented&&G(e);break;case Gn.enter:k&&(k(A),e.preventDefault(),e.stopPropagation());break;default:null==w||w(e),e.defaultPrevented&&e.stopPropagation()}},value:A,disabled:a,role:"searchbox","aria-label":o,ref:H})),A.length>0&&f.createElement("div",{className:V.clearButton},f.createElement(id,d({onBlur:j,styles:Vk,iconProps:Kk},g,{onClick:U}))))}));jk.displayName=Wk;var qk={root:"ms-SearchBox",iconContainer:"ms-SearchBox-iconContainer",icon:"ms-SearchBox-icon",clearButton:"ms-SearchBox-clearButton",field:"ms-SearchBox-field"},Yk=Vn(jk,(function(e){var t,o,n,r,i,a=e.theme,s=e.underlined,l=e.disabled,c=e.hasFocus,u=e.className,d=e.hasInput,p=e.disableAnimation,h=e.showIcon,m=a.palette,g=a.fonts,f=a.semanticColors,v=a.effects,b=Qo(qk,a),y={color:f.inputPlaceholderText,opacity:1},C=m.neutralSecondary,_=m.neutralPrimary,S=m.neutralLighter,x=m.neutralLighter,k=m.neutralLighter;return{root:[b.root,g.medium,on,{color:f.inputText,backgroundColor:f.inputBackground,display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"stretch",padding:"1px 0 1px 4px",borderRadius:v.roundedCorner2,border:"1px solid "+f.inputBorder,height:32,selectors:(t={},t[ro]={borderColor:"WindowText"},t[":hover"]={borderColor:f.inputBorderHovered,selectors:(o={},o[ro]={borderColor:"Highlight"},o)},t[":hover ."+b.iconContainer]={color:f.inputIconHovered},t)},!c&&d&&{selectors:(n={},n[":hover ."+b.iconContainer]={width:4},n[":hover ."+b.icon]={opacity:0},n)},c&&["is-active",{position:"relative"},Ro(f.inputFocusBorderAlt,s?0:v.roundedCorner2,s?"borderBottom":"border")],h&&[{selectors:(r={},r[":hover ."+b.iconContainer]={width:32},r[":hover ."+b.icon]={opacity:1},r)}],l&&["is-disabled",{borderColor:S,backgroundColor:k,pointerEvents:"none",cursor:"default",selectors:(i={},i[ro]={borderColor:"GrayText"},i)}],s&&["is-underlined",{borderWidth:"0 0 1px 0",borderRadius:0,padding:"1px 0 1px 8px"}],s&&l&&{backgroundColor:"transparent"},d&&"can-clear",u],iconContainer:[b.iconContainer,{display:"flex",flexDirection:"column",justifyContent:"center",flexShrink:0,fontSize:16,width:32,textAlign:"center",color:f.inputIcon,cursor:"text"},c&&{width:4},l&&{color:f.inputIconDisabled},!p&&{transition:"width "+Le.durationValue1},h&&c&&{width:32}],icon:[b.icon,{opacity:1},c&&{opacity:0},!p&&{transition:"opacity "+Le.durationValue1+" 0s"},h&&c&&{opacity:1}],clearButton:[b.clearButton,{display:"flex",flexDirection:"row",alignItems:"stretch",cursor:"pointer",flexBasis:"32px",flexShrink:0,padding:0,margin:"-1px 0px",selectors:{"&:hover .ms-Button":{backgroundColor:x},"&:hover .ms-Button-icon":{color:_},".ms-Button":{borderRadius:jn(a)?"1px 0 0 1px":"0 1px 1px 0"},".ms-Button-icon":{color:C}}}],field:[b.field,on,sn(y),{backgroundColor:"transparent",border:"none",outline:"none",fontWeight:"inherit",fontFamily:"inherit",fontSize:"inherit",color:f.inputText,flex:"1 1 0px",minWidth:"0px",overflow:"hidden",textOverflow:"ellipsis",paddingBottom:.5,selectors:{"::-ms-clear":{display:"none"}}},l&&{color:f.disabledText}]}}),void 0,{scope:"SearchBox"}),Zk=function(e){function t(t){var o=e.call(this,t)||this;o.addItems=function(e){var t=o.props.onItemSelected?o.props.onItemSelected(e):e,n=t,r=t;if(r&&r.then)r.then((function(e){var t=o.state.items.concat(e);o.updateItems(t)}));else{var i=o.state.items.concat(n);o.updateItems(i)}},o.removeItemAt=function(e){var t=o.state.items;if(o._canRemoveItem(t[e])&&e>-1){o.props.onItemsDeleted&&o.props.onItemsDeleted([t[e]]);var n=t.slice(0,e).concat(t.slice(e+1));o.updateItems(n)}},o.removeItem=function(e){var t=o.state.items.indexOf(e);o.removeItemAt(t)},o.replaceItem=function(e,t){var n=o.state.items,r=n.indexOf(e);if(r>-1){var i=n.slice(0,r).concat(t).concat(n.slice(r+1));o.updateItems(i)}},o.removeItems=function(e){var t=o.state.items,n=e.filter((function(e){return o._canRemoveItem(e)})),r=t.filter((function(e){return-1===n.indexOf(e)})),i=n[0],a=t.indexOf(i);o.props.onItemsDeleted&&o.props.onItemsDeleted(n),o.updateItems(r,a)},o.onCopy=function(e){if(o.props.onCopyItems&&o.selection.getSelectedCount()>0){var t=o.selection.getSelection();o.copyItems(t)}},o.renderItems=function(){var e=o.props.removeButtonAriaLabel,t=o.props.onRenderItem;return o.state.items.map((function(n,r){return t({item:n,index:r,key:n.key?n.key:r,selected:o.selection.isIndexSelected(r),onRemoveItem:function(){return o.removeItem(n)},onItemChange:o.onItemChange,removeButtonAriaLabel:e,onCopyItem:function(e){return o.copyItems([e])}})}))},o.onSelectionChanged=function(){o.forceUpdate()},o.onItemChange=function(e,t){var n=o.state.items;if(t>=0){var r=n;r[t]=e,o.updateItems(r)}},Gi(o);var n=t.selectedItems||t.defaultSelectedItems||[];return o.state={items:n},o._defaultSelection=new iv({onSelectionChanged:o.onSelectionChanged}),o}return u(t,e),t.getDerivedStateFromProps=function(e){return e.selectedItems?{items:e.selectedItems}:null},Object.defineProperty(t.prototype,"items",{get:function(){return this.state.items},enumerable:!1,configurable:!0}),t.prototype.removeSelectedItems=function(){this.state.items.length&&this.selection.getSelectedCount()>0&&this.removeItems(this.selection.getSelection())},t.prototype.updateItems=function(e,t){var o=this;this.props.selectedItems?this.onChange(e):this.setState({items:e},(function(){o._onSelectedItemsUpdated(e,t)}))},t.prototype.hasSelectedItems=function(){return this.selection.getSelectedCount()>0},t.prototype.componentDidUpdate=function(e,t){this.state.items&&this.state.items!==t.items&&this.selection.setItems(this.state.items)},t.prototype.unselectAll=function(){this.selection.setAllSelected(!1)},t.prototype.highlightedItems=function(){return this.selection.getSelection()},t.prototype.componentDidMount=function(){this.selection.setItems(this.state.items)},Object.defineProperty(t.prototype,"selection",{get:function(){var e;return null!==(e=this.props.selection)&&void 0!==e?e:this._defaultSelection},enumerable:!1,configurable:!0}),t.prototype.render=function(){return this.renderItems()},t.prototype.onChange=function(e){this.props.onChange&&this.props.onChange(e)},t.prototype.copyItems=function(e){if(this.props.onCopyItems){var t=this.props.onCopyItems(e),o=document.createElement("input");document.body.appendChild(o);try{if(o.value=t,o.select(),!document.execCommand("copy"))throw new Error}catch(e){}finally{document.body.removeChild(o)}}},t.prototype._onSelectedItemsUpdated=function(e,t){this.onChange(e)},t.prototype._canRemoveItem=function(e){return!this.props.canRemoveItem||this.props.canRemoveItem(e)},t}(f.Component);Ft([{rawString:".personaContainer_cbad3345{border-radius:15px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:"},{theme:"themeLighterAlt",defaultValue:"#eff6fc"},{rawString:";margin:4px;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;position:relative}.personaContainer_cbad3345::-moz-focus-inner{border:0}.personaContainer_cbad3345{outline:transparent}.personaContainer_cbad3345{position:relative}.ms-Fabric--isFocusVisible .personaContainer_cbad3345:focus:after{-webkit-box-sizing:border-box;box-sizing:border-box;content:'';position:absolute;top:-2px;right:-2px;bottom:-2px;left:-2px;pointer-events:none;border:1px solid "},{theme:"focusBorder",defaultValue:"#605e5c"},{rawString:";border-radius:0}.personaContainer_cbad3345 .ms-Persona-primaryText{color:"},{theme:"themeDark",defaultValue:"#005a9e"},{rawString:";font-size:14px;font-weight:400}.personaContainer_cbad3345 .ms-Persona-primaryText.hover_cbad3345{color:"},{theme:"themeDark",defaultValue:"#005a9e"},{rawString:"}@media screen and (-ms-high-contrast:active){.personaContainer_cbad3345 .ms-Persona-primaryText{color:HighlightText}}.personaContainer_cbad3345 .actionButton_cbad3345:hover{background:"},{theme:"themeLight",defaultValue:"#c7e0f4"},{rawString:"}.personaContainer_cbad3345 .actionButton_cbad3345 .ms-Button-icon{color:"},{theme:"themeDark",defaultValue:"#005a9e"},{rawString:"}@media screen and (-ms-high-contrast:active){.personaContainer_cbad3345 .actionButton_cbad3345 .ms-Button-icon{color:HighlightText}}.personaContainer_cbad3345:hover{background:"},{theme:"themeLighter",defaultValue:"#deecf9"},{rawString:"}.personaContainer_cbad3345:hover .ms-Persona-primaryText{color:"},{theme:"themeDark",defaultValue:"#005a9e"},{rawString:";font-size:14px;font-weight:400}@media screen and (-ms-high-contrast:active){.personaContainer_cbad3345:hover .ms-Persona-primaryText{color:HighlightText}}.personaContainer_cbad3345.personaContainerIsSelected_cbad3345{background:"},{theme:"themePrimary",defaultValue:"#0078d4"},{rawString:"}.personaContainer_cbad3345.personaContainerIsSelected_cbad3345 .ms-Persona-primaryText{color:"},{theme:"white",defaultValue:"#ffffff"},{rawString:"}@media screen and (-ms-high-contrast:active){.personaContainer_cbad3345.personaContainerIsSelected_cbad3345 .ms-Persona-primaryText{color:HighlightText}}.personaContainer_cbad3345.personaContainerIsSelected_cbad3345 .actionButton_cbad3345{color:"},{theme:"white",defaultValue:"#ffffff"},{rawString:"}.personaContainer_cbad3345.personaContainerIsSelected_cbad3345 .actionButton_cbad3345 .ms-Button-icon{color:"},{theme:"themeDark",defaultValue:"#005a9e"},{rawString:"}.personaContainer_cbad3345.personaContainerIsSelected_cbad3345 .actionButton_cbad3345 .ms-Button-icon:hover{background:"},{theme:"themeDark",defaultValue:"#005a9e"},{rawString:"}@media screen and (-ms-high-contrast:active){.personaContainer_cbad3345.personaContainerIsSelected_cbad3345 .actionButton_cbad3345 .ms-Button-icon{color:HighlightText}}@media screen and (-ms-high-contrast:active){.personaContainer_cbad3345.personaContainerIsSelected_cbad3345{border-color:Highlight;background:Highlight;-ms-high-contrast-adjust:none}}.personaContainer_cbad3345.validationError_cbad3345 .ms-Persona-primaryText{color:"},{theme:"red",defaultValue:"#e81123"},{rawString:"}.personaContainer_cbad3345.validationError_cbad3345 .ms-Persona-initials{font-size:20px}@media screen and (-ms-high-contrast:active){.personaContainer_cbad3345{border:1px solid WindowText}}.personaContainer_cbad3345 .itemContent_cbad3345{-webkit-box-flex:0;-ms-flex:0 1 auto;flex:0 1 auto;min-width:0;max-width:100%}.personaContainer_cbad3345 .removeButton_cbad3345{border-radius:15px;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:33px;height:33px;-ms-flex-preferred-size:32px;flex-basis:32px}.personaContainer_cbad3345 .expandButton_cbad3345{border-radius:15px 0 0 15px;height:33px;width:44px;padding-right:16px;position:inherit;display:-webkit-box;display:-ms-flexbox;display:flex;margin-right:-17px}.personaContainer_cbad3345 .personaWrapper_cbad3345{position:relative;display:inherit}.personaContainer_cbad3345 .personaWrapper_cbad3345 .ms-Persona-details{padding:0 8px}.personaContainer_cbad3345 .personaDetails_cbad3345{-webkit-box-flex:0;-ms-flex:0 1 auto;flex:0 1 auto}.itemContainer_cbad3345{display:inline-block;vertical-align:top}"}]);var Xk="personaContainer_cbad3345",Qk="hover_cbad3345",Jk="actionButton_cbad3345",$k="personaContainerIsSelected_cbad3345",ew="validationError_cbad3345",tw="itemContent_cbad3345",ow="removeButton_cbad3345",nw="expandButton_cbad3345",rw="personaWrapper_cbad3345",iw="personaDetails_cbad3345",aw="itemContainer_cbad3345",sw=l,lw=function(e){function t(t){var o=e.call(this,t)||this;return o.persona=f.createRef(),Gi(o),o.state={contextualMenuVisible:!1},o}return u(t,e),t.prototype.render=function(){var e,t,o=this.props,n=o.item,r=o.onExpandItem,i=o.onRemoveItem,a=o.removeButtonAriaLabel,s=o.index,l=o.selected,c=Ka();return f.createElement("div",{ref:this.persona,className:qr("ms-PickerPersona-container",sw.personaContainer,(e={},e["is-selected "+sw.personaContainerIsSelected]=l,e),(t={},t["is-invalid "+sw.validationError]=!n.isValid,t)),"data-is-focusable":!0,"data-is-sub-focuszone":!0,"data-selection-index":s,role:"listitem","aria-labelledby":"selectedItemPersona-"+c},f.createElement("div",{hidden:!n.canExpand||void 0===r},f.createElement(id,{onClick:this._onClickIconButton(r),iconProps:{iconName:"Add",style:{fontSize:"14px"}},className:qr("ms-PickerItem-removeButton",sw.expandButton,sw.actionButton),ariaLabel:a})),f.createElement("div",{className:qr(sw.personaWrapper)},f.createElement("div",{className:qr("ms-PickerItem-content",sw.itemContent),id:"selectedItemPersona-"+c},f.createElement(qC,d({},n,{onRenderCoin:this.props.renderPersonaCoin,onRenderPrimaryText:this.props.renderPrimaryText,size:Yr.size32}))),f.createElement(id,{onClick:this._onClickIconButton(i),iconProps:{iconName:"Cancel",style:{fontSize:"14px"}},className:qr("ms-PickerItem-removeButton",sw.removeButton,sw.actionButton),ariaLabel:a})))},t.prototype._onClickIconButton=function(e){return function(t){t.stopPropagation(),t.preventDefault(),e&&e()}},t}(f.Component),cw=function(e){function t(t){var o=e.call(this,t)||this;return o.itemElement=f.createRef(),o._onClick=function(e){e.preventDefault(),o.props.beginEditing&&!o.props.item.isValid?o.props.beginEditing(o.props.item):o.setState({contextualMenuVisible:!0})},o._onCloseContextualMenu=function(e){o.setState({contextualMenuVisible:!1})},Gi(o),o.state={contextualMenuVisible:!1},o}return u(t,e),t.prototype.render=function(){return f.createElement("div",{ref:this.itemElement,onContextMenu:this._onClick},this.props.renderedItem,this.state.contextualMenuVisible?f.createElement(ju,{items:this.props.menuItems,shouldFocusOnMount:!0,target:this.itemElement.current,onDismiss:this._onCloseContextualMenu,directionalHint:Ys.bottomLeftEdge}):null)},t}(f.Component),uw={root:"ms-EditingItem",input:"ms-EditingItem-input"},dw=function(e){var t=Qt();if(!t)throw new Error("theme is undefined or null in Editing item getStyles function.");var o=t.semanticColors,n=Qo(uw,t);return{root:[n.root,{margin:"4px"}],input:[n.input,{border:"0px",outline:"none",width:"100%",backgroundColor:o.inputBackground,color:o.inputText,selectors:{"::-ms-clear":{display:"none"}}}]}},pw=function(e){function t(t){var o=e.call(this,t)||this;return o._editingFloatingPicker=f.createRef(),o._renderEditingSuggestions=function(){var e=o.props.onRenderFloatingPicker,t=o.props.floatingPickerProps;return e&&t?f.createElement(e,d({componentRef:o._editingFloatingPicker,onChange:o._onSuggestionSelected,inputElement:o._editingInput,selectedItems:[]},t)):f.createElement(f.Fragment,null)},o._resolveInputRef=function(e){o._editingInput=e,o.forceUpdate((function(){o._editingInput.focus()}))},o._onInputClick=function(){o._editingFloatingPicker.current&&o._editingFloatingPicker.current.showPicker(!0)},o._onInputBlur=function(e){if(o._editingFloatingPicker.current&&null!==e.relatedTarget){var t=e.relatedTarget;-1===t.className.indexOf("ms-Suggestions-itemButton")&&-1===t.className.indexOf("ms-Suggestions-sectionButton")&&o._editingFloatingPicker.current.forceResolveSuggestion()}},o._onInputChange=function(e){var t=e.target.value;""===t?o.props.onRemoveItem&&o.props.onRemoveItem():o._editingFloatingPicker.current&&o._editingFloatingPicker.current.onQueryStringChanged(t)},o._onSuggestionSelected=function(e){o.props.onEditingComplete(o.props.item,e)},Gi(o),o.state={contextualMenuVisible:!1},o}return u(t,e),t.prototype.componentDidMount=function(){var e=(0,this.props.getEditingItemText)(this.props.item);this._editingFloatingPicker.current&&this._editingFloatingPicker.current.onQueryStringChanged(e),this._editingInput.value=e,this._editingInput.focus()},t.prototype.render=function(){var e=Ka(),t=Tr(this.props,hr),o=Jn()(dw);return f.createElement("div",{"aria-labelledby":"editingItemPersona-"+e,className:o.root},f.createElement("input",d({autoCapitalize:"off",autoComplete:"off"},t,{ref:this._resolveInputRef,onChange:this._onInputChange,onKeyDown:this._onInputKeyDown,onBlur:this._onInputBlur,onClick:this._onInputClick,"data-lpignore":!0,className:o.input,id:e})),this._renderEditingSuggestions())},t.prototype._onInputKeyDown=function(e){e.which!==Gn.backspace&&e.which!==Gn.del||e.stopPropagation()},t}(f.Component),hw=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t}(Zk),mw=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.renderItems=function(){return t.state.items.map((function(e,o){return t._renderItem(e,o)}))},t._beginEditing=function(e){e.isEditing=!0,t.forceUpdate()},t._completeEditing=function(e,o){e.isEditing=!1,t.replaceItem(e,o)},t}return u(t,e),t.prototype._renderItem=function(e,t){var o=this,n=this.props.removeButtonAriaLabel,r=this.props.onExpandGroup,i={item:e,index:t,key:e.key?e.key:t,selected:this.selection.isIndexSelected(t),onRemoveItem:function(){return o.removeItem(e)},onItemChange:this.onItemChange,removeButtonAriaLabel:n,onCopyItem:function(e){return o.copyItems([e])},onExpandItem:r?function(){return r(e)}:void 0,menuItems:this._createMenuItems(e)},a=i.menuItems.length>0;if(e.isEditing&&a)return f.createElement(pw,d({},i,{onRenderFloatingPicker:this.props.onRenderFloatingPicker,floatingPickerProps:this.props.floatingPickerProps,onEditingComplete:this._completeEditing,getEditingItemText:this.props.getEditingItemText}));var s=(0,this.props.onRenderItem)(i);return a?f.createElement(cw,{key:i.key,renderedItem:s,beginEditing:this._beginEditing,menuItems:this._createMenuItems(i.item),item:i.item}):s},t.prototype._createMenuItems=function(e){var t=this,o=[];return this.props.editMenuItemText&&this.props.getEditingItemText&&o.push({key:"Edit",text:this.props.editMenuItemText,onClick:function(e,o){t._beginEditing(o.data)},data:e}),this.props.removeMenuItemText&&o.push({key:"Remove",text:this.props.removeMenuItemText,onClick:function(e,o){t.removeItem(o.data)},data:e}),this.props.copyMenuItemText&&o.push({key:"Copy",text:this.props.copyMenuItemText,onClick:function(e,o){t.props.onCopyItems&&t.copyItems([o.data])},data:e}),o},t.defaultProps={onRenderItem:function(e){return f.createElement(lw,d({},e))}},t}(hw),gw=Jn(),fw=f.forwardRef((function(e,t){var o=e.styles,n=e.theme,r=e.className,i=e.vertical,a=e.alignContent,s=e.children,l=gw(o,{theme:n,className:r,alignContent:a,vertical:i});return f.createElement("div",{className:l.root,ref:t},f.createElement("div",{className:l.content,role:"separator","aria-orientation":i?"vertical":"horizontal"},s))})),vw=Vn(fw,(function(e){var t,o,n=e.theme,r=e.alignContent,i=e.vertical,a=e.className,s="start"===r,l="center"===r,c="end"===r;return{root:[n.fonts.medium,{position:"relative"},r&&{textAlign:r},!r&&{textAlign:"center"},i&&(l||!r)&&{verticalAlign:"middle"},i&&s&&{verticalAlign:"top"},i&&c&&{verticalAlign:"bottom"},i&&{padding:"0 4px",height:"inherit",display:"table-cell",zIndex:1,selectors:{":after":(t={backgroundColor:n.palette.neutralLighter,width:"1px",content:'""',position:"absolute",top:"0",bottom:"0",left:"50%",right:"0",zIndex:-1},t[ro]={backgroundColor:"WindowText"},t)}},!i&&{padding:"4px 0",selectors:{":before":(o={backgroundColor:n.palette.neutralLighter,height:"1px",content:'""',display:"block",position:"absolute",top:"50%",bottom:"0",left:"0",right:"0"},o[ro]={backgroundColor:"WindowText"},o)}},a],content:[{position:"relative",display:"inline-block",padding:"0 12px",color:n.semanticColors.bodyText,background:n.semanticColors.bodyBackground},i&&{padding:"12px 0"}]}}),void 0,{scope:"Separator"});vw.displayName="Separator";var bw,yw,Cw={root:"ms-Shimmer-container",shimmerWrapper:"ms-Shimmer-shimmerWrapper",shimmerGradient:"ms-Shimmer-shimmerGradient",dataWrapper:"ms-Shimmer-dataWrapper"},_w=jo((function(){return J({"0%":{transform:"translateX(-100%)"},"100%":{transform:"translateX(100%)"}})})),Sw=jo((function(){return J({"100%":{transform:"translateX(-100%)"},"0%":{transform:"translateX(100%)"}})}));!function(e){e[e.line=1]="line",e[e.circle=2]="circle",e[e.gap=3]="gap"}(bw||(bw={})),function(e){e[e.line=16]="line",e[e.gap=16]="gap",e[e.circle=24]="circle"}(yw||(yw={}));var xw=Jn(),kw=function(e){var t=e.height,o=e.styles,n=e.width,r=void 0===n?"100%":n,i=e.borderStyle,a=e.theme,s=xw(o,{theme:a,height:t,borderStyle:i});return f.createElement("div",{style:{width:r,minWidth:"number"==typeof r?r+"px":"auto"},className:s.root},f.createElement("svg",{width:"2",height:"2",className:s.topLeftCorner},f.createElement("path",{d:"M0 2 A 2 2, 0, 0, 1, 2 0 L 0 0 Z"})),f.createElement("svg",{width:"2",height:"2",className:s.topRightCorner},f.createElement("path",{d:"M0 0 A 2 2, 0, 0, 1, 2 2 L 2 0 Z"})),f.createElement("svg",{width:"2",height:"2",className:s.bottomRightCorner},f.createElement("path",{d:"M2 0 A 2 2, 0, 0, 1, 0 2 L 2 2 Z"})),f.createElement("svg",{width:"2",height:"2",className:s.bottomLeftCorner},f.createElement("path",{d:"M2 2 A 2 2, 0, 0, 1, 0 0 L 0 2 Z"})))},ww={root:"ms-ShimmerLine-root",topLeftCorner:"ms-ShimmerLine-topLeftCorner",topRightCorner:"ms-ShimmerLine-topRightCorner",bottomLeftCorner:"ms-ShimmerLine-bottomLeftCorner",bottomRightCorner:"ms-ShimmerLine-bottomRightCorner"},Iw=Vn(kw,(function(e){var t,o=e.height,n=e.borderStyle,r=e.theme,i=r.semanticColors,a=Qo(ww,r),s=n||{},l={position:"absolute",fill:i.bodyBackground};return{root:[a.root,r.fonts.medium,{height:o+"px",boxSizing:"content-box",position:"relative",borderTopStyle:"solid",borderBottomStyle:"solid",borderColor:i.bodyBackground,borderWidth:0,selectors:(t={},t[ro]={borderColor:"Window",selectors:{"> *":{fill:"Window"}}},t)},s],topLeftCorner:[a.topLeftCorner,{top:"0",left:"0"},l],topRightCorner:[a.topRightCorner,{top:"0",right:"0"},l],bottomRightCorner:[a.bottomRightCorner,{bottom:"0",right:"0"},l],bottomLeftCorner:[a.bottomLeftCorner,{bottom:"0",left:"0"},l]}}),void 0,{scope:"ShimmerLine"}),Dw=Jn(),Tw=function(e){var t=e.height,o=e.styles,n=e.width,r=void 0===n?"10px":n,i=e.borderStyle,a=e.theme,s=Dw(o,{theme:a,height:t,borderStyle:i});return f.createElement("div",{style:{width:r,minWidth:"number"==typeof r?r+"px":"auto"},className:s.root})},Ew={root:"ms-ShimmerGap-root"},Pw=Vn(Tw,(function(e){var t,o=e.height,n=e.borderStyle,r=e.theme,i=r.semanticColors,a=n||{};return{root:[Qo(Ew,r).root,r.fonts.medium,{backgroundColor:i.bodyBackground,height:o+"px",boxSizing:"content-box",borderTopStyle:"solid",borderBottomStyle:"solid",borderColor:i.bodyBackground,selectors:(t={},t[ro]={backgroundColor:"Window",borderColor:"Window"},t)},a]}}),void 0,{scope:"ShimmerGap"}),Rw={root:"ms-ShimmerCircle-root",svg:"ms-ShimmerCircle-svg"},Mw=Jn(),Nw=function(e){var t=e.height,o=e.styles,n=e.borderStyle,r=e.theme,i=Mw(o,{theme:r,height:t,borderStyle:n});return f.createElement("div",{className:i.root},f.createElement("svg",{viewBox:"0 0 10 10",width:t,height:t,className:i.svg},f.createElement("path",{d:"M0,0 L10,0 L10,10 L0,10 L0,0 Z M0,5 C0,7.76142375 2.23857625,10 5,10 C7.76142375,10 10,7.76142375 10,5 C10,2.23857625 7.76142375,2.22044605e-16 5,0 C2.23857625,-2.22044605e-16 0,2.23857625 0,5 L0,5 Z"})))},Bw=Vn(Nw,(function(e){var t,o,n=e.height,r=e.borderStyle,i=e.theme,a=i.semanticColors,s=Qo(Rw,i),l=r||{};return{root:[s.root,i.fonts.medium,{width:n+"px",height:n+"px",minWidth:n+"px",boxSizing:"content-box",borderTopStyle:"solid",borderBottomStyle:"solid",borderColor:a.bodyBackground,selectors:(t={},t[ro]={borderColor:"Window"},t)},l],svg:[s.svg,{display:"block",fill:a.bodyBackground,selectors:(o={},o[ro]={fill:"Window"},o)}]}}),void 0,{scope:"ShimmerCircle"}),Fw=Jn(),Aw=function(e){var t=e.styles,o=e.width,n=void 0===o?"auto":o,r=e.shimmerElements,i=e.rowHeight,a=void 0===i?function(e){return e.map((function(e){switch(e.type){case bw.circle:e.height||(e.height=yw.circle);break;case bw.line:e.height||(e.height=yw.line);break;case bw.gap:e.height||(e.height=yw.gap)}return e})).reduce((function(e,t){return t.height&&t.height>e?t.height:e}),0)}(r||[]):i,s=e.flexWrap,l=void 0!==s&&s,c=e.theme,u=e.backgroundColor,h=Fw(t,{theme:c,flexWrap:l});return f.createElement("div",{style:{width:n},className:h.root},function(e,t,o){return e?e.map((function(e,n){var r=e.type,i=p(e,["type"]),a=i.verticalAlign,s=i.height,l=Lw(a,r,s,t,o);switch(e.type){case bw.circle:return f.createElement(Bw,d({key:n},i,{styles:l}));case bw.gap:return f.createElement(Pw,d({key:n},i,{styles:l}));case bw.line:return f.createElement(Iw,d({key:n},i,{styles:l}))}})):f.createElement(Iw,{height:yw.line})}(r,u,a))},Lw=jo((function(e,t,o,n,r){var i,a=r&&o?r-o:0;if(e&&"center"!==e?e&&"top"===e?i={borderBottomWidth:a+"px",borderTopWidth:"0px"}:e&&"bottom"===e&&(i={borderBottomWidth:"0px",borderTopWidth:a+"px"}):i={borderBottomWidth:(a?Math.floor(a/2):0)+"px",borderTopWidth:(a?Math.ceil(a/2):0)+"px"},n)switch(t){case bw.circle:return{root:d(d({},i),{borderColor:n}),svg:{fill:n}};case bw.gap:return{root:d(d({},i),{borderColor:n,backgroundColor:n})};case bw.line:return{root:d(d({},i),{borderColor:n}),topLeftCorner:{fill:n},topRightCorner:{fill:n},bottomLeftCorner:{fill:n},bottomRightCorner:{fill:n}}}return{root:i}})),Hw={root:"ms-ShimmerElementsGroup-root"},Ow=Vn(Aw,(function(e){var t=e.flexWrap,o=e.theme;return{root:[Qo(Hw,o).root,o.fonts.medium,{display:"flex",alignItems:"center",flexWrap:t?"wrap":"nowrap",position:"relative"}]}}),void 0,{scope:"ShimmerElementsGroup"}),zw=Jn(),Ww=f.forwardRef((function(e,t){var o=e.styles,n=e.shimmerElements,r=e.children,i=e.width,a=e.className,s=e.customElementsGroup,l=e.theme,c=e.ariaLabel,u=e.shimmerColors,p=e.isDataLoaded,h=void 0!==p&&p,m=Tr(e,Dr),g=zw(o,{theme:l,isDataLoaded:h,className:a,transitionAnimationInterval:200,shimmerColor:u&&u.shimmer,shimmerWaveColor:u&&u.shimmerWave}),v=Ei({lastTimeoutId:0}),b=wm(),y=b.setTimeout,C=b.clearTimeout,_=f.useState(h),S=_[0],x=_[1],k={width:i||"100%"};return f.useEffect((function(){if(h!==S){if(h)return v.lastTimeoutId=y((function(){x(!0)}),200),function(){return C(v.lastTimeoutId)};x(!1)}}),[h]),f.createElement("div",d({},m,{className:g.root,ref:t}),!S&&f.createElement("div",{style:k,className:g.shimmerWrapper},f.createElement("div",{className:g.shimmerGradient}),s||f.createElement(Ow,{shimmerElements:n,backgroundColor:u&&u.background})),r&&f.createElement("div",{className:g.dataWrapper},r),c&&!h&&f.createElement("div",{role:"status","aria-live":"polite"},f.createElement(ea,null,f.createElement("div",{className:g.screenReaderText},c))))}));Ww.displayName="Shimmer";var Vw=Vn(Ww,(function(e){var t,o=e.isDataLoaded,n=e.className,r=e.theme,i=e.transitionAnimationInterval,a=e.shimmerColor,s=e.shimmerWaveColor,l=r.semanticColors,c=Qo(Cw,r),u=jn(r);return{root:[c.root,r.fonts.medium,{position:"relative",height:"auto"},n],shimmerWrapper:[c.shimmerWrapper,{position:"relative",overflow:"hidden",transform:"translateZ(0)",backgroundColor:a||l.disabledBackground,transition:"opacity "+i+"ms",selectors:(t={"> *":{transform:"translateZ(0)"}},t[ro]=d({background:"WindowText\n linear-gradient(\n to right,\n transparent 0%,\n Window 50%,\n transparent 100%)\n 0 0 / 90% 100%\n no-repeat"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),t)},o&&{opacity:"0",position:"absolute",top:"0",bottom:"0",left:"0",right:"0"}],shimmerGradient:[c.shimmerGradient,{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:(a||l.disabledBackground)+"\n linear-gradient(\n to right,\n "+(a||l.disabledBackground)+" 0%,\n "+(s||l.bodyDivider)+" 50%,\n "+(a||l.disabledBackground)+" 100%)\n 0 0 / 90% 100%\n no-repeat",transform:"translateX(-100%)",animationDuration:"2s",animationTimingFunction:"ease-in-out",animationDirection:"normal",animationIterationCount:"infinite",animationName:u?Sw():_w()}],dataWrapper:[c.dataWrapper,{position:"absolute",top:"0",bottom:"0",left:"0",right:"0",opacity:"0",background:"none",backgroundColor:"transparent",border:"none",transition:"opacity "+i+"ms"},o&&{opacity:"1",position:"static"}],screenReaderText:Mo}}),void 0,{scope:"Shimmer"}),Kw=Jn(),Gw=function(e){function t(t){var o=e.call(this,t)||this;return o._onRenderShimmerPlaceholder=function(e,t){var n=o.props.onRenderCustomPlaceholder,r=n?n(t,e,o._renderDefaultShimmerPlaceholder):o._renderDefaultShimmerPlaceholder(t);return f.createElement(Vw,{customElementsGroup:r})},o._renderDefaultShimmerPlaceholder=function(e){var t=e.columns,o=e.compact,n=e.selectionMode,r=e.checkboxVisibility,i=e.cellStyleProps,a=void 0===i?Sv:i,s=xv.rowHeight,l=xv.compactRowHeight,c=o?l:s+1,u=[];return n!==ev.none&&r!==pv.hidden&&u.push(f.createElement(Ow,{key:"checkboxGap",shimmerElements:[{type:bw.gap,width:"40px",height:c}]})),t.forEach((function(e,t){var o=[],n=a.cellLeftPadding+a.cellRightPadding+e.calculatedWidth+(e.isPadded?a.cellExtraRightPadding:0);o.push({type:bw.gap,width:a.cellLeftPadding,height:c}),e.isIconOnly?(o.push({type:bw.line,width:e.calculatedWidth,height:e.calculatedWidth}),o.push({type:bw.gap,width:a.cellRightPadding,height:c})):(o.push({type:bw.line,width:.95*e.calculatedWidth,height:7}),o.push({type:bw.gap,width:a.cellRightPadding+(e.calculatedWidth-.95*e.calculatedWidth)+(e.isPadded?a.cellExtraRightPadding:0),height:c})),u.push(f.createElement(Ow,{key:t,width:n+"px",shimmerElements:o}))})),u.push(f.createElement(Ow,{key:"endGap",width:"100%",shimmerElements:[{type:bw.gap,width:"100%",height:c}]})),f.createElement("div",{style:{display:"flex"}},u)},o._shimmerItems=t.shimmerLines?new Array(t.shimmerLines):new Array(10),o}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.detailsListStyles,o=e.enableShimmer,n=e.items,r=e.listProps,i=(e.onRenderCustomPlaceholder,e.removeFadingOverlay),a=(e.shimmerLines,e.styles),s=e.theme,l=e.ariaLabelForGrid,c=e.ariaLabelForShimmer,u=p(e,["detailsListStyles","enableShimmer","items","listProps","onRenderCustomPlaceholder","removeFadingOverlay","shimmerLines","styles","theme","ariaLabelForGrid","ariaLabelForShimmer"]),h=r&&r.className;this._classNames=Kw(a,{theme:s});var m=d(d({},r),{className:o&&!i?qr(this._classNames.root,h):h});return f.createElement(Lb,d({},u,{styles:t,items:o?this._shimmerItems:n,isPlaceholderData:o,ariaLabelForGrid:o&&c||l,onRenderMissingItem:this._onRenderShimmerPlaceholder,listProps:m}))},t}(f.Component),Uw=Vn(Gw,(function(e){var t=e.theme.palette;return{root:{position:"relative",selectors:{":after":{content:'""',position:"absolute",top:0,right:0,bottom:0,left:0,backgroundImage:"linear-gradient(to bottom, transparent 30%, "+t.whiteTranslucent40+" 65%,"+t.white+" 100%)"}}}}}),void 0,{scope:"ShimmeredDetailsList"}),jw=Jn(),qw=function(e){return function(t){var o;return(o={})[e]=t+"%",o}},Yw=function(e,t,o){return o===t?0:(e-t)/(o-t)*100},Zw="SliderBase",Xw=f.forwardRef((function(e,t){var o=function(e,t){var o=e.step,n=void 0===o?1:o,r=e.className,i=e.disabled,a=void 0!==i&&i,s=e.label,l=e.max,c=void 0===l?10:l,u=e.min,p=void 0===u?0:u,h=e.showValue,m=void 0===h||h,g=e.buttonProps,v=void 0===g?{}:g,b=e.vertical,y=void 0!==b&&b,C=e.snapToStep,_=e.valueFormat,S=e.styles,x=e.theme,k=e.originFromZero,w=e["aria-labelledby"],I=e["aria-label"],D=e.ranged,T=e.onChange,E=e.onChanged,P=f.useRef([]),R=wm(),M=R.setTimeout,N=R.clearTimeout,B=f.useRef(null),F=kh(e.value,e.defaultValue,(function(e,t){return null==T?void 0:T(t,D?[K.latestLowerValue,t]:void 0,e)})),A=F[0],L=F[1],H=kh(e.lowerValue,e.defaultLowerValue,(function(e,t){return null==T?void 0:T(K.latestValue,[t,K.latestValue],e)})),O=H[0],z=H[1],W=Math.max(p,Math.min(c,A||0)),V=Math.max(p,Math.min(W,O||0)),K=Ei({onKeyDownTimer:-1,isAdjustingLowerValue:!1,latestValue:W,latestLowerValue:V});K.latestValue=W,K.latestLowerValue=V;var G=hu("Slider",e.id||(null==v?void 0:v.id)),U=jw(S,{className:r,disabled:a,vertical:y,showTransitions:!C&&!K.isBetweenSteps,showValue:m,ranged:D,theme:x}),j=(c-p)/n,q=function(){N(K.onKeyDownTimer),K.onKeyDownTimer=-1},Y=function(e){q(),E&&(K.onKeyDownTimer=M((function(){E(e,K.latestValue,D?[K.latestLowerValue,K.latestValue]:void 0)}),1e3))},Z=function(t){var o=e.ariaValueText;if(void 0!==t)return o?o(t):t.toString()},X=function(e,t,o){t=Math.min(c,Math.max(p,t)),o=void 0!==o?Math.min(c,Math.max(p,o)):void 0;var r=0;if(isFinite(n))for(;Math.round(n*Math.pow(10,r))/Math.pow(10,r)!==n;)r++;var i=parseFloat(t.toFixed(r));K.isBetweenSteps=void 0!==o&&o!==i,D?K.isAdjustingLowerValue&&(k?i<=0:i<=K.latestValue)?z(i,e):!K.isAdjustingLowerValue&&(k?i>=0:i>=K.latestLowerValue)&&L(i,e):L(i,e)},Q=function(e,t){var o=0;switch(e.type){case"mousedown":case"mousemove":o=t?e.clientY:e.clientX;break;case"touchstart":case"touchmove":o=t?e.touches[0].clientY:e.touches[0].clientX}return o},J=function(t){var o,n=B.current.getBoundingClientRect(),r=(e.vertical?n.height:n.width)/j;if(e.vertical){var i=Q(t,e.vertical);o=(n.bottom-i)/r}else{var a=Q(t,e.vertical);o=(jn(e.theme)?n.right-a:a-n.left)/r}return o},$=function(e,t){var o=J(e),r=p+n*o,i=p+n*Math.round(o);X(e,i,r),t||(e.preventDefault(),e.stopPropagation())},ee=function(e){if(D){var t=J(e),o=p+n*t;K.isAdjustingLowerValue=o<=K.latestLowerValue||o-K.latestLowerValue<=K.latestValue-o}"mousedown"===e.type?P.current.push(nl(window,"mousemove",$,!0),nl(window,"mouseup",te,!0)):"touchstart"===e.type&&P.current.push(nl(window,"touchmove",$,!0),nl(window,"touchend",te,!0)),$(e,!0)},te=function(e){K.isBetweenSteps=void 0,null==E||E(e,K.latestValue,D?[K.latestLowerValue,K.latestValue]:void 0),oe()},oe=function(){P.current.forEach((function(e){return e()})),P.current=[]},ne=f.useRef(null),re=f.useRef(null);!function(e,t,o,n){f.useImperativeHandle(e.componentRef,(function(){return{get value(){return o},get range(){return n},focus:function(){t.current&&t.current.focus()}}}),[t,o,n])}(e,D&&!y?ne:re,W,D?[V,W]:void 0);var ie=qw(y?"bottom":jn(e.theme)?"right":"left"),ae=qw(y?"height":"width"),se=k?0:p,le=Yw(W,p,c),ce=Yw(V,p,c),ue=Yw(se,p,c),de=D?le-ce:Math.abs(ue-le),pe=Math.min(100-le,100-ue),he=D?ce:Math.min(le,ue),me={className:U.root,ref:t},ge={className:U.titleLabel,children:s,disabled:a,htmlFor:I?void 0:G},fe=m?{className:U.valueLabel,children:_?_(W):W,disabled:a,htmlFor:a?G:void 0}:void 0,ve=D&&m?{className:U.valueLabel,children:_?_(V):V,disabled:a}:void 0,be=k?{className:U.zeroTick,style:ie(ue)}:void 0,ye={className:qr(U.lineContainer,U.activeSection),style:ae(de)},Ce={className:qr(U.lineContainer,U.inactiveSection),style:ae(pe)},_e={className:qr(U.lineContainer,U.inactiveSection),style:ae(he)},Se=d({"aria-disabled":a,role:"slider",tabIndex:a?void 0:0},{"data-is-focusable":!a}),xe=d(d(d({id:G,className:qr(U.slideBox,v.className)},!a&&{onMouseDown:ee,onTouchStart:ee,onKeyDown:function(t){var o=K.isAdjustingLowerValue?K.latestLowerValue:K.latestValue,r=0;switch(t.which){case Yn(Gn.left,e.theme):case Gn.down:r=-n,q(),Y(t);break;case Yn(Gn.right,e.theme):case Gn.up:r=n,q(),Y(t);break;case Gn.home:o=p,q(),Y(t);break;case Gn.end:o=c,q(),Y(t);break;default:return}X(t,o+r),t.preventDefault(),t.stopPropagation()}}),v&&Tr(v,Dr,["id","className"])),!D&&d(d({},Se),{"aria-valuemin":p,"aria-valuemax":c,"aria-valuenow":W,"aria-valuetext":Z(W),"aria-label":I||s,"aria-labelledby":w})),ke=a?{}:{onFocus:function(e){K.isAdjustingLowerValue=e.target===ne.current}},we=d({ref:re,className:U.thumb,style:ie(le)},D&&d(d(d({},Se),ke),{id:"max-"+G,"aria-valuemin":V,"aria-valuemax":c,"aria-valuenow":W,"aria-valuetext":Z(W),"aria-label":"max "+(I||s)})),Ie=D?d(d(d({ref:ne,className:U.thumb,style:ie(ce)},Se),ke),{id:"min-"+G,"aria-valuemin":p,"aria-valuemax":W,"aria-valuenow":V,"aria-valuetext":Z(V),"aria-label":"min "+(I||s)}):void 0;return{root:me,label:ge,sliderBox:xe,container:{className:U.container},valueLabel:fe,lowerValueLabel:ve,thumb:we,lowerValueThumb:Ie,zeroTick:be,activeTrack:ye,topInactiveTrack:Ce,bottomInactiveTrack:_e,sliderLine:{ref:B,className:U.line}}}(e,t);return Ri({name:Zw,props:e,mutuallyExclusive:{value:"defaultValue"}}),f.createElement("div",d({},o.root),o&&f.createElement(Yh,d({},o.label)),f.createElement("div",d({},o.container),e.ranged&&(e.vertical?o.valueLabel&&f.createElement(Yh,d({},o.valueLabel)):o.lowerValueLabel&&f.createElement(Yh,d({},o.lowerValueLabel))),f.createElement("div",d({},o.sliderBox),f.createElement("div",d({},o.sliderLine),e.ranged&&f.createElement("span",d({},o.lowerValueThumb)),f.createElement("span",d({},o.thumb)),o.zeroTick&&f.createElement("span",d({},o.zeroTick)),f.createElement("span",d({},o.bottomInactiveTrack)),f.createElement("span",d({},o.activeTrack)),f.createElement("span",d({},o.topInactiveTrack)))),e.ranged&&e.vertical?o.lowerValueLabel&&f.createElement(Yh,d({},o.lowerValueLabel)):o.valueLabel&&f.createElement(Yh,d({},o.valueLabel))),f.createElement(ws,null))}));Xw.displayName=Zw;var Qw,Jw={root:"ms-Slider",enabled:"ms-Slider-enabled",disabled:"ms-Slider-disabled",row:"ms-Slider-row",column:"ms-Slider-column",container:"ms-Slider-container",slideBox:"ms-Slider-slideBox",line:"ms-Slider-line",thumb:"ms-Slider-thumb",activeSection:"ms-Slider-active",inactiveSection:"ms-Slider-inactive",valueLabel:"ms-Slider-value",showValue:"ms-Slider-showValue",showTransitions:"ms-Slider-showTransitions",zeroTick:"ms-Slider-zeroTick"},$w=Vn(Xw,(function(e){var t,o,n,r,i,a,s,l,c,u,d,p,h,g=e.className,f=e.titleLabelClassName,v=e.theme,b=e.vertical,y=e.disabled,C=e.showTransitions,_=e.showValue,S=e.ranged,x=v.semanticColors,k=Qo(Jw,v),w=x.inputBackgroundCheckedHovered,I=x.inputBackgroundChecked,D=x.inputPlaceholderBackgroundChecked,T=x.smallInputBorder,E=x.disabledBorder,P=x.disabledText,R=x.disabledBackground,M=x.inputBackground,N=x.smallInputBorder,B=x.disabledBorder,F=!y&&{backgroundColor:w,selectors:(t={},t[ro]={backgroundColor:"Highlight"},t)},A=!y&&{backgroundColor:D,selectors:(o={},o[ro]={borderColor:"Highlight"},o)},L=!y&&{backgroundColor:I,selectors:(n={},n[ro]={backgroundColor:"Highlight"},n)},H=!y&&{border:"2px solid "+w,selectors:(r={},r[ro]={borderColor:"Highlight"},r)},O=!e.disabled&&{backgroundColor:x.inputPlaceholderBackgroundChecked,selectors:(i={},i[ro]={backgroundColor:"Highlight"},i)};return{root:m([k.root,v.fonts.medium,{userSelect:"none"},b&&{marginRight:8}],[y?void 0:k.enabled],[y?k.disabled:void 0],[b?void 0:k.row],[b?k.column:void 0],[g]),titleLabel:[{padding:0},f],container:[k.container,{display:"flex",flexWrap:"nowrap",alignItems:"center"},b&&{flexDirection:"column",height:"100%",textAlign:"center",margin:"8px 0"}],slideBox:m([k.slideBox,!S&&To(v),{background:"transparent",border:"none",flexGrow:1,lineHeight:28,display:"flex",alignItems:"center",selectors:(a={},a[":active ."+k.activeSection]=F,a[":hover ."+k.activeSection]=L,a[":active ."+k.inactiveSection]=A,a[":hover ."+k.inactiveSection]=A,a[":active ."+k.thumb]=H,a[":hover ."+k.thumb]=H,a[":active ."+k.zeroTick]=O,a[":hover ."+k.zeroTick]=O,a[ro]={forcedColorAdjust:"none"},a)},b?{height:"100%",width:28,padding:"8px 0"}:{height:28,width:"auto",padding:"0 8px"}],[_?k.showValue:void 0],[C?k.showTransitions:void 0]),thumb:[k.thumb,S&&To(v,{inset:-4}),{borderWidth:2,borderStyle:"solid",borderColor:N,borderRadius:10,boxSizing:"border-box",background:M,display:"block",width:16,height:16,position:"absolute"},b?{left:-6,margin:"0 auto",transform:"translateY(8px)"}:{top:-6,transform:jn(v)?"translateX(50%)":"translateX(-50%)"},C&&{transition:"left "+Le.durationValue3+" "+Le.easeFunction1},y&&{borderColor:B,selectors:(s={},s[ro]={borderColor:"GrayText"},s)}],line:[k.line,{display:"flex",position:"relative"},b?{height:"100%",width:4,margin:"0 auto",flexDirection:"column-reverse"}:{width:"100%"}],lineContainer:[{borderRadius:4,boxSizing:"border-box"},b?{width:4,height:"100%"}:{height:4,width:"100%"}],activeSection:[k.activeSection,{background:T,selectors:(l={},l[ro]={backgroundColor:"WindowText"},l)},C&&{transition:"width "+Le.durationValue3+" "+Le.easeFunction1},y&&{background:P,selectors:(c={},c[ro]={backgroundColor:"GrayText",borderColor:"GrayText"},c)}],inactiveSection:[k.inactiveSection,{background:E,selectors:(u={},u[ro]={border:"1px solid WindowText"},u)},C&&{transition:"width "+Le.durationValue3+" "+Le.easeFunction1},y&&{background:R,selectors:(d={},d[ro]={borderColor:"GrayText"},d)}],zeroTick:[k.zeroTick,{position:"absolute",background:x.disabledBorder,selectors:(p={},p[ro]={backgroundColor:"WindowText"},p)},e.disabled&&{background:x.disabledBackground,selectors:(h={},h[ro]={backgroundColor:"GrayText"},h)},e.vertical?{width:"16px",height:"1px",transform:jn(v)?"translateX(6px)":"translateX(-6px)"}:{width:"1px",height:"16px",transform:"translateY(-6px)"}],valueLabel:[k.valueLabel,{flexShrink:1,width:30,lineHeight:"1"},b?{margin:"0 auto",whiteSpace:"nowrap",width:40}:{margin:"0 8px",whiteSpace:"nowrap",width:40}]}}),void 0,{scope:"Slider"}),eI=jo((function(e){var t,o=e.semanticColors,n=o.disabledText,r=o.disabledBackground;return{backgroundColor:r,pointerEvents:"none",cursor:"default",color:n,selectors:(t={":after":{borderColor:r}},t[ro]={color:"GrayText"},t)}})),tI=jo((function(e,t,o){var n,r,i,a=e.palette,s=e.semanticColors,l=e.effects,c=a.neutralSecondary,u=s.buttonText,d=s.buttonText,p=s.buttonBackgroundHovered,h=s.buttonBackgroundPressed;return kn({root:{outline:"none",display:"block",height:"50%",width:23,padding:0,backgroundColor:"transparent",textAlign:"center",cursor:"default",color:c,selectors:{"&.ms-DownButton":{borderRadius:"0 0 "+l.roundedCorner2+" 0"},"&.ms-UpButton":{borderRadius:"0 "+l.roundedCorner2+" 0 0"}}},rootHovered:{backgroundColor:p,color:u},rootChecked:{backgroundColor:h,color:d,selectors:(n={},n[ro]={backgroundColor:"Highlight",color:"HighlightText"},n)},rootPressed:{backgroundColor:h,color:d,selectors:(r={},r[ro]={backgroundColor:"Highlight",color:"HighlightText"},r)},rootDisabled:{opacity:.5,selectors:(i={},i[ro]={color:"GrayText",opacity:1},i)},icon:{fontSize:8,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0}},{},o)}));!function(e){e[e.down=-1]="down",e[e.notSpinning=0]="notSpinning",e[e.up=1]="up"}(Qw||(Qw={}));var oI=Jn(),nI="SpinButton",rI={disabled:!1,label:"",step:1,labelPosition:Qs.start,incrementButtonIcon:{iconName:"ChevronUpSmall"},decrementButtonIcon:{iconName:"ChevronDownSmall"}},iI=function(){},aI=function(e,t){var o=t.min,n=t.max;return"number"==typeof n&&(e=Math.min(e,n)),"number"==typeof o&&(e=Math.max(e,o)),e},sI=f.forwardRef((function(e,t){var o=tr(rI,e),n=o.disabled,r=o.label,i=o.min,a=o.max,s=o.step,l=o.defaultValue,c=o.value,u=o.precision,p=o.labelPosition,h=o.iconProps,m=o.incrementButtonIcon,g=o.incrementButtonAriaLabel,v=o.decrementButtonIcon,b=o.decrementButtonAriaLabel,y=o.ariaLabel,C=o.ariaDescribedBy,_=o.upArrowButtonStyles,S=o.downArrowButtonStyles,x=o.theme,k=o.ariaPositionInSet,w=o.ariaSetSize,I=o.ariaValueNow,D=o.ariaValueText,T=o.className,E=o.inputProps,P=o.onDecrement,R=o.onIncrement,M=o.iconButtonProps,N=o.onValidate,B=o.onChange,F=o.styles,A=f.useRef(null),L=hu("input"),H=hu("Label"),O=f.useState(!1),z=O[0],W=O[1],V=f.useState(Qw.notSpinning),K=V[0],G=V[1],U=Hl(),j=f.useMemo((function(){return null!=u?u:Math.max(KS(s),0)}),[u,s]),q=kh(c,null!=l?l:String(i||0),B),Y=q[0],Z=q[1],X=f.useState(),Q=X[0],J=X[1],$=f.useRef({stepTimeoutHandle:-1,latestValue:void 0,latestIntermediateValue:void 0}).current;$.latestValue=Y,$.latestIntermediateValue=Q;var ee=Ti(c);f.useEffect((function(){c!==ee&&void 0!==Q&&J(void 0)}),[c,ee,Q]);var te=oI(F,{theme:x,disabled:n,isFocused:z,keyboardSpinDirection:K,labelPosition:p,className:T}),oe=Tr(o,Dr,["onBlur","onFocus","className","onChange"]),ne=f.useCallback((function(e){var t=$.latestIntermediateValue;if(void 0!==t&&t!==$.latestValue){var o=void 0;N?o=N(t,e):t&&t.trim().length&&!isNaN(Number(t))&&(o=String(aI(Number(t),{min:i,max:a}))),void 0!==o&&o!==$.latestValue&&Z(o,e)}J(void 0)}),[$,a,i,N,Z]),re=f.useCallback((function(){$.stepTimeoutHandle>=0&&(U.clearTimeout($.stepTimeoutHandle),$.stepTimeoutHandle=-1),($.spinningByMouse||K!==Qw.notSpinning)&&($.spinningByMouse=!1,G(Qw.notSpinning))}),[$,K,U]),ie=f.useCallback((function(e,t){if(t.persist(),void 0!==$.latestIntermediateValue)return"keydown"===t.type&&ne(t),void U.requestAnimationFrame((function(){ie(e,t)}));var o=e($.latestValue||"",t);void 0!==o&&o!==$.latestValue&&Z(o,t);var n=$.spinningByMouse;$.spinningByMouse="mousedown"===t.type,$.spinningByMouse&&($.stepTimeoutHandle=U.setTimeout((function(){ie(e,t)}),n?75:400))}),[$,U,ne,Z]),ae=f.useCallback((function(e){if(R)return R(e);var t=aI(Number(e)+Number(s),{max:a});return t=GS(t,j),String(t)}),[j,a,R,s]),se=f.useCallback((function(e){if(P)return P(e);var t=aI(Number(e)-Number(s),{min:i});return t=GS(t,j),String(t)}),[j,i,P,s]),le=f.useCallback((function(e){(n||e.which===Gn.up||e.which===Gn.down)&&re()}),[n,re]),ce=f.useCallback((function(e){ie(ae,e)}),[ae,ie]),ue=f.useCallback((function(e){ie(se,e)}),[se,ie]);!function(e,t,o){f.useImperativeHandle(e.componentRef,(function(){return{get value(){return o},focus:function(){t.current&&t.current.focus()}}}),[t,o])}(o,A,Y),lI(o);var de=!!Y&&!isNaN(Number(Y)),pe=(h||r)&&f.createElement("div",{className:te.labelWrapper},h&&f.createElement(ii,d({},h,{className:te.icon,"aria-hidden":"true"})),r&&f.createElement(Yh,{id:H,htmlFor:L,className:te.label,disabled:n},r));return f.createElement("div",{className:te.root,ref:t},p!==Qs.bottom&&pe,f.createElement("div",d({},oe,{className:te.spinButtonWrapper,"aria-label":y&&y,"aria-posinset":k,"aria-setsize":w,"data-ktp-target":!0}),f.createElement("input",d({value:null!=Q?Q:Y,id:L,onChange:iI,onInput:function(e){J(e.target.value)},className:te.input,type:"text",autoComplete:"off",role:"spinbutton","aria-labelledby":r&&H,"aria-valuenow":null!=I?I:de?Number(Y):void 0,"aria-valuetext":null!=D?D:de?void 0:Y,"aria-valuemin":i,"aria-valuemax":a,"aria-describedby":C,onBlur:function(e){var t;ne(e),W(!1),null===(t=o.onBlur)||void 0===t||t.call(o,e)},ref:A,onFocus:function(e){var t;A.current&&(($.spinningByMouse||K!==Qw.notSpinning)&&re(),A.current.select(),W(!0),null===(t=o.onFocus)||void 0===t||t.call(o,e))},onKeyDown:function(e){if(e.which!==Gn.up&&e.which!==Gn.down&&e.which!==Gn.enter||(e.preventDefault(),e.stopPropagation()),n)re();else{var t=Qw.notSpinning;switch(e.which){case Gn.up:t=Qw.up,ie(ae,e);break;case Gn.down:t=Qw.down,ie(se,e);break;case Gn.enter:ne(e);break;case Gn.escape:J(void 0)}K!==t&&G(t)}},onKeyUp:le,disabled:n,"aria-disabled":n,"data-lpignore":!0,"data-ktp-execute-target":!0},E)),f.createElement("span",{className:te.arrowButtonsContainer},f.createElement(id,d({styles:tI(x,!0,_),className:"ms-UpButton",checked:K===Qw.up,disabled:n,iconProps:m,onMouseDown:ce,onMouseLeave:re,onMouseUp:re,tabIndex:-1,ariaLabel:g,"data-is-focusable":!1},M)),f.createElement(id,d({styles:tI(x,!1,S),className:"ms-DownButton",checked:K===Qw.down,disabled:n,iconProps:v,onMouseDown:ue,onMouseLeave:re,onMouseUp:re,tabIndex:-1,ariaLabel:b,"data-is-focusable":!1},M)))),p===Qs.bottom&&pe)}));sI.displayName=nI;var lI=function(e){Ri({name:nI,props:e,mutuallyExclusive:{value:"defaultValue"}})},cI=Vn(sI,(function(e){var t,o,n=e.theme,r=e.className,i=e.labelPosition,a=e.disabled,s=e.isFocused,l=n.palette,c=n.semanticColors,u=n.effects,d=n.fonts,p=c.inputBorder,h=c.inputBackground,m=c.inputBorderHovered,g=c.inputFocusBorderAlt,f=c.inputText,v=l.white,b=c.inputBackgroundChecked,y=c.disabledText;return{root:[d.medium,{outline:"none",width:"100%",minWidth:86},r],labelWrapper:[{display:"inline-flex",alignItems:"center"},i===Qs.start&&{height:32,float:"left",marginRight:10},i===Qs.end&&{height:32,float:"right",marginLeft:10},i===Qs.top&&{marginBottom:-1}],icon:[{padding:"0 5px",fontSize:Ye.large},a&&{color:y}],label:{pointerEvents:"none",lineHeight:Ye.large},spinButtonWrapper:[{display:"flex",position:"relative",boxSizing:"border-box",height:32,minWidth:86,selectors:{":after":{pointerEvents:"none",content:"''",position:"absolute",left:0,top:0,bottom:0,right:0,borderWidth:"1px",borderStyle:"solid",borderColor:p,borderRadius:u.roundedCorner2}}},(i===Qs.top||i===Qs.bottom)&&{width:"100%"},!a&&[{selectors:{":hover":{selectors:(t={":after":{borderColor:m}},t[ro]={selectors:{":after":{borderColor:"Highlight"}}},t)}}},s&&{selectors:{"&&":Ro(g,u.roundedCorner2)}}],a&&eI(n)],input:["ms-spinButton-input",{boxSizing:"border-box",boxShadow:"none",borderStyle:"none",flex:1,margin:0,fontSize:d.medium.fontSize,fontFamily:"inherit",color:f,backgroundColor:h,height:"100%",padding:"0 8px 0 9px",outline:0,display:"block",minWidth:61,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",cursor:"text",userSelect:"text",borderRadius:u.roundedCorner2+" 0 0 "+u.roundedCorner2},!a&&{selectors:{"::selection":{backgroundColor:b,color:v,selectors:(o={},o[ro]={backgroundColor:"Highlight",borderColor:"Highlight",color:"HighlightText"},o)}}},a&&eI(n)],arrowButtonsContainer:[{display:"block",height:"100%",cursor:"default"},a&&eI(n)]}}),void 0,{scope:"SpinButton"}),uI=d;function dI(e,t){for(var o=[],n=2;n<arguments.length;n++)o[n-2]=arguments[n];var r=e;return r.isSlot?0===(o=f.Children.toArray(o)).length?r(t):r(d(d({},t),{children:o})):f.createElement.apply(f,m([e,t],o))}function pI(e,t){void 0===t&&(t={});var o=t.defaultProp,n=void 0===o?"children":o;return function(t,o,r,i,a){if(f.isValidElement(o))return o;var s=function(e,t){for(var o=[],n=2;n<arguments.length;n++)o[n-2]=arguments[n];for(var r={},i=[],a=0,s=o;a<s.length;a++){var l=s[a];i.push(l&&l.className),uI(r,l)}return r.className=X([e,i],{rtl:jn(t)}),r}(i,a,t,function(e,t){var o,n;return"string"==typeof t||"number"==typeof t||"boolean"==typeof t?((o={})[e]=t,n=o):n=t,n}(n,o));if(r){if(r.component){var l=r.component;return f.createElement(l,d({},s))}if(r.render)return r.render(s,e)}return f.createElement(e,d({},s))}}var hI=jo((function(e){return pI(e)}));function mI(e,t){var o={},n=e,r=function(e){if(t.hasOwnProperty(e)){var r=function(o){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];if(r.length>0)throw new Error("Any module using getSlots must use withSlots. Please see withSlots javadoc for more info.");return gI(t[e],o,n[e],n.slots&&n.slots[e],n._defaultStyles&&n._defaultStyles[e],n.theme)};r.isSlot=!0,o[e]=r}};for(var i in t)r(i);return o}function gI(e,t,o,n,r,i){return void 0!==e.create?e.create(t,o,n,r):hI(e)(t,o,n,r,i)}function fI(e,t){void 0===t&&(t={});var o=t.factoryOptions,n=(void 0===o?{}:o).defaultProp,r=function(o){var n,r,i,a=(n=t.displayName,r=f.useContext(On),i=t.fields,Dt.getSettings(i||["theme","styles","tokens"],n,r.customizations)),s=t.state;s&&(o=d(d({},o),s(o)));var l=o.theme||a.theme,c=vI(o,l,t.tokens,a.tokens,o.tokens),u=function(e,t,o){for(var n=[],r=3;r<arguments.length;r++)n[r-3]=arguments[r];return kn.apply(void 0,n.map((function(n){return"function"==typeof n?n(e,t,o):n})))}(o,l,c,t.styles,a.styles,o.styles),p=d(d({},o),{styles:u,tokens:c,_defaultStyles:u,theme:l});return e(p)};return r.displayName=t.displayName||e.name,n&&(r.create=pI(r,{defaultProp:n})),uI(r,t.statics),r}function vI(e,t){for(var o=[],n=2;n<arguments.length;n++)o[n-2]=arguments[n];for(var r={},i=0,a=o;i<a.length;i++){var s=a[i];s&&(s="function"==typeof s?s(e,t):s,Array.isArray(s)&&(s=vI.apply(void 0,m([e,t],s))),uI(r,s))}return r}var bI,yI={root:"ms-StackItem"},CI={start:"flex-start",end:"flex-end"},_I=fI((function(e){var t=e.children,o=Tr(e,ir);return null==t?null:dI(mI(e,{root:"div"}).root,d({},o),t)}),{displayName:"StackItem",styles:function(e,t,o){var n=e.grow,r=e.shrink,i=e.disableShrink,a=e.align,s=e.verticalFill,l=e.order,c=e.className,u=Qo(yI,t);return{root:[t.fonts.medium,u.root,{margin:o.margin,padding:o.padding,height:s?"100%":"auto",width:"auto"},n&&{flexGrow:!0===n?1:n},(i||!n&&!r)&&{flexShrink:0},r&&!i&&{flexShrink:1},a&&{alignSelf:CI[a]||a},l&&{order:l},c]}}}),SI=function(e,t){return t.spacing.hasOwnProperty(e)?t.spacing[e]:e},xI=function(e){var t=parseFloat(e),o=isNaN(t)?0:t,n=isNaN(t)?"":t.toString();return{value:o,unit:e.substring(n.toString().length)||"px"}},kI=function(e,t){if(void 0===e||"number"==typeof e||""===e)return e;var o=e.split(" ");return o.length<2?SI(e,t):o.reduce((function(e,o){return SI(e,t)+" "+SI(o,t)}))},wI={start:"flex-start",end:"flex-end"},II={root:"ms-Stack",inner:"ms-Stack-inner"},DI=fI((function(e){var t=e.as,o=void 0===t?"div":t,n=e.disableShrink,r=e.wrap,i=p(e,["as","disableShrink","wrap"]);xi("Stack",e,{gap:"tokens.childrenGap",maxHeight:"tokens.maxHeight",maxWidth:"tokens.maxWidth",padding:"tokens.padding"});var a=f.Children.map(e.children,(function(e,t){if(!e)return null;if((r=e)&&"object"==typeof r&&r.type&&r.type.displayName===_I.displayName){var o={shrink:!n};return f.cloneElement(e,d(d({},o),e.props))}var r;return e})),s=Tr(i,ir),l=mI(e,{root:o,inner:"div"});return dI(l.root,d({},s),r?dI(l.inner,null,a):a)}),{displayName:"Stack",styles:function(e,t,o){var n,r,i,a,s,l,c,u=e.verticalFill,p=e.horizontal,h=e.reversed,m=e.grow,g=e.wrap,f=e.horizontalAlign,v=e.verticalAlign,b=e.disableShrink,y=e.className,C=Qo(II,t),_=o&&o.childrenGap?o.childrenGap:e.gap,S=o&&o.maxHeight?o.maxHeight:e.maxHeight,x=o&&o.maxWidth?o.maxWidth:e.maxWidth,k=o&&o.padding?o.padding:e.padding,w=function(e,t){if(void 0===e||""===e)return{rowGap:{value:0,unit:"px"},columnGap:{value:0,unit:"px"}};if("number"==typeof e)return{rowGap:{value:e,unit:"px"},columnGap:{value:e,unit:"px"}};var o=e.split(" ");if(o.length>2)return{rowGap:{value:0,unit:"px"},columnGap:{value:0,unit:"px"}};if(2===o.length)return{rowGap:xI(SI(o[0],t)),columnGap:xI(SI(o[1],t))};var n=xI(SI(e,t));return{rowGap:n,columnGap:n}}(_,t),I=w.rowGap,D=w.columnGap,T=""+-.5*D.value+D.unit,E=""+-.5*I.value+I.unit,P={textOverflow:"ellipsis"},R={"> *:not(.ms-StackItem)":{flexShrink:b?0:1}};return g?{root:[C.root,{flexWrap:"wrap",maxWidth:x,maxHeight:S,width:"auto",overflow:"visible",height:"100%"},f&&(n={},n[p?"justifyContent":"alignItems"]=wI[f]||f,n),v&&(r={},r[p?"alignItems":"justifyContent"]=wI[v]||v,r),y,{display:"flex"},p&&{height:u?"100%":"auto"}],inner:[C.inner,{display:"flex",flexWrap:"wrap",marginLeft:T,marginRight:T,marginTop:E,marginBottom:E,overflow:"visible",boxSizing:"border-box",padding:kI(k,t),width:0===D.value?"100%":"calc(100% + "+D.value+D.unit+")",maxWidth:"100vw",selectors:d({"> *":d({margin:""+.5*I.value+I.unit+" "+.5*D.value+D.unit},P)},R)},f&&(i={},i[p?"justifyContent":"alignItems"]=wI[f]||f,i),v&&(a={},a[p?"alignItems":"justifyContent"]=wI[v]||v,a),p&&{flexDirection:h?"row-reverse":"row",height:0===I.value?"100%":"calc(100% + "+I.value+I.unit+")",selectors:{"> *":{maxWidth:0===D.value?"100%":"calc(100% - "+D.value+D.unit+")"}}},!p&&{flexDirection:h?"column-reverse":"column",height:"calc(100% + "+I.value+I.unit+")",selectors:{"> *":{maxHeight:0===I.value?"100%":"calc(100% - "+I.value+I.unit+")"}}}]}:{root:[C.root,{display:"flex",flexDirection:p?h?"row-reverse":"row":h?"column-reverse":"column",flexWrap:"nowrap",width:"auto",height:u?"100%":"auto",maxWidth:x,maxHeight:S,padding:kI(k,t),boxSizing:"border-box",selectors:d((s={"> *":P},s[h?"> *:not(:last-child)":"> *:not(:first-child)"]=[p&&{marginLeft:""+D.value+D.unit},!p&&{marginTop:""+I.value+I.unit}],s),R)},m&&{flexGrow:!0===m?1:m},f&&(l={},l[p?"justifyContent":"alignItems"]=wI[f]||f,l),v&&(c={},c[p?"alignItems":"justifyContent"]=wI[v]||v,c),y]}},statics:{Item:_I}});!function(e){e[e.Both=0]="Both",e[e.Header=1]="Header",e[e.Footer=2]="Footer"}(bI||(bI={}));var TI=function(e){function t(t){var o=e.call(this,t)||this;return o._root=f.createRef(),o._stickyContentTop=f.createRef(),o._stickyContentBottom=f.createRef(),o._nonStickyContent=f.createRef(),o._placeHolder=f.createRef(),o.syncScroll=function(e){var t=o.nonStickyContent;t&&o.props.isScrollSynced&&(t.scrollLeft=e.scrollLeft)},o._getContext=function(){return o.context},o._onScrollEvent=function(e,t){if(o.root&&o.nonStickyContent){var n=o._getNonStickyDistanceFromTop(e),r=!1,i=!1;o.canStickyTop&&(r=n-o._getStickyDistanceFromTop()<e.scrollTop),o.canStickyBottom&&e.clientHeight-t.offsetHeight<=n&&(i=n-Math.floor(e.scrollTop)>=o._getStickyDistanceFromTopForFooter(e,t)),document.activeElement&&o.nonStickyContent.contains(document.activeElement)&&(o.state.isStickyTop!==r||o.state.isStickyBottom!==i)?o._activeElement=document.activeElement:o._activeElement=void 0,o.setState({isStickyTop:o.canStickyTop&&r,isStickyBottom:i,distanceFromTop:n})}},o._getStickyDistanceFromTop=function(){var e=0;return o.stickyContentTop&&(e=o.stickyContentTop.offsetTop),e},o._getStickyDistanceFromTopForFooter=function(e,t){var n=0;return o.stickyContentBottom&&(n=e.clientHeight-t.offsetHeight+o.stickyContentBottom.offsetTop),n},o._getNonStickyDistanceFromTop=function(e){var t=0,n=o.root;if(n){for(;n&&n.offsetParent!==e;)t+=n.offsetTop,n=n.offsetParent;n&&n.offsetParent===e&&(t+=n.offsetTop)}return t},Gi(o),o.state={isStickyTop:!1,isStickyBottom:!1,distanceFromTop:void 0},o._activeElement=void 0,o}return u(t,e),Object.defineProperty(t.prototype,"root",{get:function(){return this._root.current},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"placeholder",{get:function(){return this._placeHolder.current},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stickyContentTop",{get:function(){return this._stickyContentTop.current},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stickyContentBottom",{get:function(){return this._stickyContentBottom.current},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nonStickyContent",{get:function(){return this._nonStickyContent.current},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canStickyTop",{get:function(){return this.props.stickyPosition===bI.Both||this.props.stickyPosition===bI.Header},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canStickyBottom",{get:function(){return this.props.stickyPosition===bI.Both||this.props.stickyPosition===bI.Footer},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){var e=this._getContext().scrollablePane;e&&(e.subscribe(this._onScrollEvent),e.addSticky(this))},t.prototype.componentWillUnmount=function(){var e=this._getContext().scrollablePane;e&&(e.unsubscribe(this._onScrollEvent),e.removeSticky(this))},t.prototype.componentDidUpdate=function(e,t){var o=this._getContext().scrollablePane;if(o){var n=this.state,r=n.isStickyBottom,i=n.isStickyTop,a=n.distanceFromTop,s=!1;t.distanceFromTop!==a&&(o.sortSticky(this,!0),s=!0),t.isStickyTop===i&&t.isStickyBottom===r||(this._activeElement&&this._activeElement.focus(),o.updateStickyRefHeights(),s=!0),s&&o.syncScrollSticky(this)}},t.prototype.shouldComponentUpdate=function(e,t){if(!this.context.scrollablePane)return!0;var o=this.state,n=o.isStickyTop,r=o.isStickyBottom,i=o.distanceFromTop;return n!==t.isStickyTop||r!==t.isStickyBottom||this.props.stickyPosition!==e.stickyPosition||this.props.children!==e.children||i!==t.distanceFromTop||EI(this._nonStickyContent,this._stickyContentTop)||EI(this._nonStickyContent,this._stickyContentBottom)||EI(this._nonStickyContent,this._placeHolder)},t.prototype.render=function(){var e=this.state,t=e.isStickyTop,o=e.isStickyBottom,n=this.props,r=n.stickyClassName,i=n.children;return this.context.scrollablePane?f.createElement("div",{ref:this._root},this.canStickyTop&&f.createElement("div",{ref:this._stickyContentTop,style:{pointerEvents:t?"auto":"none"}},f.createElement("div",{style:this._getStickyPlaceholderHeight(t)})),this.canStickyBottom&&f.createElement("div",{ref:this._stickyContentBottom,style:{pointerEvents:o?"auto":"none"}},f.createElement("div",{style:this._getStickyPlaceholderHeight(o)})),f.createElement("div",{style:this._getNonStickyPlaceholderHeightAndWidth(),ref:this._placeHolder},(t||o)&&f.createElement("span",{style:Mo},i),f.createElement("div",{ref:this._nonStickyContent,className:t||o?r:void 0,style:this._getContentStyles(t||o)},i))):f.createElement("div",null,this.props.children)},t.prototype.addSticky=function(e){this.nonStickyContent&&e.appendChild(this.nonStickyContent)},t.prototype.resetSticky=function(){this.nonStickyContent&&this.placeholder&&this.placeholder.appendChild(this.nonStickyContent)},t.prototype.setDistanceFromTop=function(e){var t=this._getNonStickyDistanceFromTop(e);this.setState({distanceFromTop:t})},t.prototype._getContentStyles=function(e){return{backgroundColor:this.props.stickyBackgroundColor||this._getBackground(),overflow:e?"hidden":""}},t.prototype._getStickyPlaceholderHeight=function(e){var t=this.nonStickyContent?this.nonStickyContent.offsetHeight:0;return{visibility:e?"hidden":"visible",height:e?0:t}},t.prototype._getNonStickyPlaceholderHeightAndWidth=function(){var e=this.state,t=e.isStickyTop,o=e.isStickyBottom;if(t||o){var n=0,r=0;return this.nonStickyContent&&this.nonStickyContent.firstElementChild&&(n=this.nonStickyContent.offsetHeight,r=this.nonStickyContent.firstElementChild.scrollWidth+(this.nonStickyContent.firstElementChild.offsetWidth-this.nonStickyContent.firstElementChild.clientWidth)),{height:n,width:r}}return{}},t.prototype._getBackground=function(){if(this.root){for(var e=this.root;"rgba(0, 0, 0, 0)"===window.getComputedStyle(e).getPropertyValue("background-color")||"transparent"===window.getComputedStyle(e).getPropertyValue("background-color");){if("HTML"===e.tagName)return;e.parentElement&&(e=e.parentElement)}return window.getComputedStyle(e).getPropertyValue("background-color")}},t.defaultProps={stickyPosition:bI.Both,isScrollSynced:!0},t.contextType=Lk,t}(f.Component);function EI(e,t){return e&&t&&e.current&&t.current&&e.current.offsetHeight!==t.current.offsetHeight}var PI=Jn(),RI=jo((function(e,t,o,n,r,i,a,s,l){var c=Vd(e);return In({root:["ms-Button",c.root,o,t,a&&["is-checked",c.rootChecked],i&&["is-disabled",c.rootDisabled],!i&&!a&&{selectors:{":hover":c.rootHovered,":focus":c.rootFocused,":active":c.rootPressed}},i&&a&&[c.rootCheckedDisabled],!i&&a&&{selectors:{":hover":c.rootCheckedHovered,":active":c.rootCheckedPressed}}],flexContainer:["ms-Button-flexContainer",c.flexContainer]})})),MI=function(e){var t,o,n=e.item,r=e.idPrefix,i=void 0===r?e.id:r,a=e.selected,s=void 0!==a&&a,l=e.disabled,c=void 0!==l&&l,u=e.styles,d=e.circle,p=void 0===d||d,h=e.color,m=e.onClick,g=e.onHover,v=e.onFocus,b=e.onMouseEnter,y=e.onMouseMove,C=e.onMouseLeave,_=e.onWheel,S=e.onKeyDown,x=e.height,k=e.width,w=e.borderWidth,I=PI(u,{theme:e.theme,disabled:c,selected:s,circle:p,isWhite:(t=h,o=rg(t),"ffffff"===(null==o?void 0:o.hex)),height:x,width:k,borderWidth:w});return f.createElement(ip,{item:n,id:i+"-"+n.id+"-"+n.index,key:n.id,disabled:c,role:"gridcell",onRenderItem:function(e){var t,o=I.svg;return f.createElement("svg",{className:o,viewBox:"0 0 20 20",fill:null===(t=rg(e.color))||void 0===t?void 0:t.str},p?f.createElement("circle",{cx:"50%",cy:"50%",r:"50%"}):f.createElement("rect",{width:"100%",height:"100%"}))},selected:s,onClick:m,onHover:g,onFocus:v,label:n.label,className:I.colorCell,getClassNames:RI,index:n.index,onMouseEnter:b,onMouseMove:y,onMouseLeave:C,onWheel:_,onKeyDown:S})},NI={left:-2,top:-2,bottom:-2,right:-2,border:"none",outlineColor:"ButtonText"},BI=Vn(MI,(function(e){var t,o,n,r,i,a=e.theme,s=e.disabled,l=e.selected,c=e.circle,u=e.isWhite,d=e.height,p=void 0===d?20:d,h=e.width,m=void 0===h?20:h,g=e.borderWidth,f=a.semanticColors,v=a.palette,b=v.neutralLighter,y=v.neutralLight,C=v.neutralSecondary,_=v.neutralTertiary,S=g||(m<24?2:4);return{colorCell:[To(a,{inset:-1,position:"relative",highContrastStyle:NI}),{backgroundColor:f.bodyBackground,padding:0,position:"relative",boxSizing:"border-box",display:"inline-block",cursor:"pointer",userSelect:"none",borderRadius:0,border:"none",height:p,width:m,verticalAlign:"top"},!c&&{selectors:(t={},t["."+wo+" &:focus::after"]={outlineOffset:S-1+"px"},t)},c&&{borderRadius:"50%",selectors:(o={},o["."+wo+" &:focus::after"]={outline:"none",borderColor:f.focusBorder,borderRadius:"50%",left:-S,right:-S,top:-S,bottom:-S,selectors:(n={},n[ro]={outline:"1px solid ButtonText"},n)},o)},l&&{padding:2,border:S+"px solid "+y,selectors:(r={},r["&:hover::before"]={content:'""',height:p,width:m,position:"absolute",top:-S,left:-S,borderRadius:c?"50%":"default",boxShadow:"inset 0 0 0 1px "+C},r)},!l&&{selectors:(i={},i["&:hover, &:active, &:focus"]={backgroundColor:f.bodyBackground,padding:2,border:S+"px solid "+b},i["&:focus"]={borderColor:f.bodyBackground,padding:0,selectors:{":hover":{borderColor:a.palette.neutralLight,padding:2}}},i)},s&&{color:f.disabledBodyText,pointerEvents:"none",opacity:.3},u&&!l&&{backgroundColor:_,padding:1}],svg:[{width:"100%",height:"100%"},c&&{borderRadius:"50%"}]}}),void 0,{scope:"ColorPickerGridCell"},!0),FI=Jn(),AI="SwatchColorPicker",LI=f.forwardRef((function(e,t){var o=hu("swatchColorPicker"),n=e.id||o,r=Ei({isNavigationIdle:!0,cellFocused:!1,navigationIdleTimeoutId:void 0,navigationIdleDelay:250}),i=wm(),a=i.setTimeout,s=i.clearTimeout;!function(e){Ri({name:AI,props:e,mutuallyExclusive:{focusOnHover:"onHover",selectedId:"defaultSelectedId"},deprecations:{isControlled:"selectedId' or 'defaultSelectedId",onColorChanged:"onChange"}})}(e);var l=e.colorCells,c=e.cellShape,u=void 0===c?"circle":c,p=e.columnCount,h=e.shouldFocusCircularNavigate,m=void 0===h||h,g=e.className,v=e.disabled,b=void 0!==v&&v,y=e.doNotContainWithinFocusZone,C=e.styles,_=e.cellMargin,S=void 0===_?10:_,x=e.defaultSelectedId,k=e.focusOnHover,w=e.mouseLeaveParentSelector,I=e.onChange,D=e.onColorChanged,T=e.onCellHovered,E=e.onCellFocused,P=e.getColorGridCellStyles,R=e.cellHeight,M=e.cellWidth,N=e.cellBorderWidth,B=f.useMemo((function(){return l.map((function(e,t){return d(d({},e),{index:t})}))}),[l]),F=f.useCallback((function(e,t){var o,n=null===(o=l.filter((function(e){return e.id===t}))[0])||void 0===o?void 0:o.color;null==I||I(e,t,n),null==D||D(t,n)}),[I,D,l]),A=kh(e.selectedId,x,F),L=A[0],H=A[1],O=FI(C,{theme:e.theme,className:g,cellMargin:S}),z={root:O.root,tableCell:O.tableCell,focusedContainer:O.focusedContainer},W=f.useCallback((function(){E&&(r.cellFocused=!1,E())}),[r,E]),V=f.useCallback((function(e){return k?(r.isNavigationIdle&&!b&&e.currentTarget.focus(),!0):!r.isNavigationIdle||!!b}),[k,r,b]),K=f.useCallback((function(e){if(!k)return!r.isNavigationIdle||!!b;var t=e.currentTarget;return!r.isNavigationIdle||document&&t===document.activeElement||t.focus(),!0}),[k,r,b]),G=f.useCallback((function(e){var t=w;if(k&&t&&r.isNavigationIdle&&!b)for(var o=document.querySelectorAll(t),n=0;n<o.length;n+=1)if(o[n].contains(e.currentTarget)){if(o[n].setActive)try{o[n].setActive()}catch(e){}else o[n].focus();break}}),[b,k,r,w]),U=f.useCallback((function(e){if(T)return e?T(e.id,e.color):T()}),[T]),j=f.useCallback((function(e){if(E)return e?(r.cellFocused=!0,E(e.id,e.color)):(r.cellFocused=!1,E())}),[r,E]),q=f.useCallback((function(e){b||e.id!==L&&(E&&r.cellFocused&&(r.cellFocused=!1,E()),H(e.id))}),[b,r,E,L,H]),Y=f.useCallback((function(){r.isNavigationIdle||void 0===r.navigationIdleTimeoutId?r.isNavigationIdle=!1:(s(r.navigationIdleTimeoutId),r.navigationIdleTimeoutId=void 0),r.navigationIdleTimeoutId=a((function(){r.isNavigationIdle=!0}),r.navigationIdleDelay)}),[s,r,a]),Z=f.useCallback((function(e){e.which!==Gn.up&&e.which!==Gn.down&&e.which!==Gn.left&&e.which!==Gn.right||Y()}),[Y]),X=function(e){return f.createElement(BI,{item:e,idPrefix:n,color:e.color,styles:P,disabled:b,onClick:q,onHover:U,onFocus:j,selected:L===e.id,circle:"circle"===u,label:e.label,onMouseEnter:V,onMouseMove:K,onMouseLeave:G,onWheel:Y,onKeyDown:Z,height:R,width:M,borderWidth:N})};return l.length<1||p<1?null:f.createElement(ep,d({},e,{ref:t,id:n,items:B,columnCount:p,onRenderItem:function(t,o){var n=e.onRenderColorCell;return(void 0===n?X:n)(t,X)},shouldFocusCircularNavigate:m,doNotContainWithinFocusZone:y,onBlur:W,theme:e.theme,styles:z}))}));LI.displayName=AI;var HI={focusedContainer:"ms-swatchColorPickerBodyContainer"},OI=Vn(LI,(function(e){var t=e.className,o=e.theme;return{root:{margin:"8px 0",borderCollapse:"collapse"},tableCell:{padding:e.cellMargin/2},focusedContainer:[Qo(HI,o).focusedContainer,{clear:"both",display:"block",minWidth:"180px"},t]}}),void 0,{scope:"SwatchColorPicker"}),zI=Jn(),WI=f.forwardRef((function(e,t){var o,n,r,i,a,s,l,c=f.useRef(null),u=Vl(),p=Or(c,t),h=hu("teaching-bubble-content-"),m=hu("teaching-bubble-title-"),g=null!==(o=e.ariaDescribedBy)&&void 0!==o?o:h,v=null!==(n=e.ariaLabelledBy)&&void 0!==n?n:m,b=e.illustrationImage,y=e.primaryButtonProps,C=e.secondaryButtonProps,_=e.headline,S=e.hasCondensedHeadline,x=e.hasCloseButton,k=void 0===x?e.hasCloseIcon:x,w=e.onDismiss,I=e.closeButtonAriaLabel,D=e.hasSmallHeadline,T=e.isWide,E=e.styles,P=e.theme,R=e.footerContent,M=e.focusTrapZoneProps,N=zI(E,{theme:P,hasCondensedHeadline:S,hasSmallHeadline:D,hasCloseButton:k,hasHeadline:!!_,isWide:T,primaryButtonClassName:y?y.className:void 0,secondaryButtonClassName:C?C.className:void 0});if(Ol(u,"keydown",f.useCallback((function(e){w&&e.which===Gn.escape&&w(e)}),[w])),b&&b.src&&(r=f.createElement("div",{className:N.imageContent},f.createElement(Gr,d({},b)))),_){var B="string"==typeof _?"p":"div";i=f.createElement("div",{className:N.header},f.createElement(B,{role:"heading","aria-level":3,className:N.headline,id:v},_))}if(e.children){var F="string"==typeof e.children?"p":"div";a=f.createElement("div",{className:N.body},f.createElement(F,{className:N.subText,id:g},e.children))}return(y||C||R)&&(s=f.createElement(DI,{className:N.footer,horizontal:!0,horizontalAlign:R?"space-between":"end"},f.createElement(DI.Item,{align:"center"},f.createElement("span",null,R)),f.createElement(DI.Item,null,C&&f.createElement(Wd,d({},C,{className:N.secondaryButton})),y&&f.createElement(jd,d({},y,{className:N.primaryButton}))))),k&&(l=f.createElement(id,{className:N.closeButton,iconProps:{iconName:"Cancel"},ariaLabel:I,onClick:w})),function(e,t){f.useImperativeHandle(e,(function(){return{focus:function(){var e;return null===(e=t.current)||void 0===e?void 0:e.focus()}}}),[t])}(e.componentRef,c),f.createElement("div",{className:N.content,ref:p,role:"dialog",tabIndex:-1,"aria-labelledby":v,"aria-describedby":g,"data-is-focusable":!0},r,f.createElement(Mh,d({isClickableOutsideFocusTrap:!0},M),f.createElement("div",{className:N.bodyContent},i,a,s,l)))})),VI={root:"ms-TeachingBubble",body:"ms-TeachingBubble-body",bodyContent:"ms-TeachingBubble-bodycontent",closeButton:"ms-TeachingBubble-closebutton",content:"ms-TeachingBubble-content",footer:"ms-TeachingBubble-footer",header:"ms-TeachingBubble-header",headerIsCondensed:"ms-TeachingBubble-header--condensed",headerIsSmall:"ms-TeachingBubble-header--small",headerIsLarge:"ms-TeachingBubble-header--large",headline:"ms-TeachingBubble-headline",image:"ms-TeachingBubble-image",primaryButton:"ms-TeachingBubble-primaryButton",secondaryButton:"ms-TeachingBubble-secondaryButton",subText:"ms-TeachingBubble-subText",button:"ms-Button",buttonLabel:"ms-Button-label"},KI=jo((function(){return J({"0%":{opacity:0,animationTimingFunction:Le.easeFunction1,transform:"scale3d(.90,.90,.90)"},"100%":{opacity:1,transform:"scale3d(1,1,1)"}})})),GI=function(e,t){var o=t||{},n=o.calloutWidth,r=o.calloutMaxWidth;return[{display:"block",maxWidth:364,border:0,outline:"transparent",width:n||"calc(100% + 1px)",animationName:""+KI(),animationDuration:"300ms",animationTimingFunction:"linear",animationFillMode:"both"},e&&{maxWidth:r||456}]},UI=function(e,t,o){return t?[e.headerIsCondensed,{marginBottom:14}]:[o&&e.headerIsSmall,!o&&e.headerIsLarge,{selectors:{":not(:last-child)":{marginBottom:14}}}]},jI=function(e){var t,o,n,r=e.hasCondensedHeadline,i=e.hasSmallHeadline,a=e.hasCloseButton,s=e.hasHeadline,l=e.isWide,c=e.primaryButtonClassName,u=e.secondaryButtonClassName,d=e.theme,p=e.calloutProps,h=void 0===p?{className:void 0,theme:d}:p,g=!r&&!i,f=d.palette,v=d.semanticColors,b=d.fonts,y=Qo(VI,d),C=To(d,{outlineColor:"transparent",borderColor:"transparent"});return{root:[y.root,b.medium,h.className],body:[y.body,a&&!s&&{marginRight:24},{selectors:{":not(:last-child)":{marginBottom:20}}}],bodyContent:[y.bodyContent,{padding:"20px 24px 20px 24px"}],closeButton:[y.closeButton,{position:"absolute",right:0,top:0,margin:"15px 15px 0 0",borderRadius:0,color:f.white,fontSize:b.small.fontSize,selectors:{":hover":{background:f.themeDarkAlt,color:f.white},":active":{background:f.themeDark,color:f.white},":focus":{border:"1px solid "+v.variantBorder}}}],content:m([y.content],GI(l),[l&&{display:"flex"}]),footer:[y.footer,{display:"flex",flex:"auto",alignItems:"center",color:f.white,selectors:(t={},t["."+y.button+":not(:first-child)"]={marginLeft:10},t)}],header:m([y.header],UI(y,r,i),[a&&{marginRight:24},(r||i)&&[b.medium,{fontWeight:qe.semibold}]]),headline:[y.headline,{margin:0,color:f.white,fontWeight:qe.semibold,overflowWrap:"break-word"},g&&[{fontSize:b.xLarge.fontSize}]],imageContent:[y.header,y.image,l&&{display:"flex",alignItems:"center",maxWidth:154}],primaryButton:[y.primaryButton,c,C,{backgroundColor:f.white,borderColor:f.white,color:f.themePrimary,whiteSpace:"nowrap",selectors:(o={},o["."+y.buttonLabel]=b.medium,o[":hover"]={backgroundColor:f.themeLighter,borderColor:f.themeLighter,color:f.themeDark},o[":focus"]={backgroundColor:f.themeLighter,border:"1px solid "+f.black,color:f.themeDark,outline:"1px solid "+f.white,outlineOffset:"-2px"},o[":active"]={backgroundColor:f.white,borderColor:f.white,color:f.themePrimary},o)}],secondaryButton:[y.secondaryButton,u,C,{backgroundColor:f.themePrimary,borderColor:f.white,whiteSpace:"nowrap",selectors:(n={},n["."+y.buttonLabel]=[b.medium,{color:f.white}],n[":hover"]={backgroundColor:f.themeDarkAlt,borderColor:f.white},n[":focus"]={backgroundColor:f.themeDark,border:"1px solid "+f.black,outline:"1px solid "+f.white,outlineOffset:"-2px"},n[":active"]={backgroundColor:f.themePrimary,borderColor:f.white},n)}],subText:[y.subText,{margin:0,fontSize:b.medium.fontSize,color:f.white,fontWeight:qe.regular}],subComponentStyles:{callout:{root:m(GI(l,h),[b.medium]),beak:[{background:f.themePrimary}],calloutMain:[{background:f.themePrimary}]}}}},qI=Vn(WI,jI,void 0,{scope:"TeachingBubbleContent"}),YI={beakWidth:16,gapSpace:0,setInitialFocus:!0,doNotLayer:!1,directionalHint:Ys.rightCenter},ZI=Jn(),XI=f.forwardRef((function(e,t){var o=f.useRef(null),n=Or(o,t),r=e.calloutProps,i=e.targetElement,a=e.onDismiss,s=e.hasCloseButton,l=void 0===s?e.hasCloseIcon:s,c=e.isWide,u=e.styles,p=e.theme,h=e.target,m=f.useMemo((function(){return d(d(d({},YI),r),{theme:p})}),[r,p]),g=ZI(u,{theme:p,isWide:c,calloutProps:m,hasCloseButton:l}),v=g.subComponentStyles?g.subComponentStyles.callout:void 0;return function(e,t){f.useImperativeHandle(e,(function(){return{focus:function(){var e;return null===(e=t.current)||void 0===e?void 0:e.focus()}}}),[t])}(e.componentRef,o),f.createElement(kc,d({target:h||i,onDismiss:a},m,{className:g.root,styles:v,hideOverflow:!0}),f.createElement("div",{ref:n},f.createElement(qI,d({},e))))}));XI.displayName="TeachingBubble";var QI=Vn(XI,jI,void 0,{scope:"TeachingBubble"}),JI=function(e){if(null==e.children)return null;e.block,e.className;var t=e.as,o=void 0===t?"span":t,n=(e.variant,e.nowrap,p(e,["block","className","as","variant","nowrap"]));return dI(mI(e,{root:o}).root,d({},Tr(n,ir)))},$I=function(e,t){var o=e.as,n=e.className,r=e.block,i=e.nowrap,a=e.variant,s=t.fonts,l=t.semanticColors,c=s[a||"medium"];return{root:[c,{color:c.color||l.bodyText,display:r?"td"===o?"table-cell":"block":"inline",mozOsxFontSmoothing:c.MozOsxFontSmoothing,webkitFontSmoothing:c.WebkitFontSmoothing},i&&{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},n]}},eD=fI(JI,{displayName:"Text",styles:$I}),tD={9:/[0-9]/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/};function oD(e,t){if(void 0===t&&(t=tD),!e)return[];for(var o=[],n=0,r=0;r+n<e.length;r++){var i=e.charAt(r+n);if("\\"===i)n++;else{var a=t[i];a&&o.push({displayIndex:r,format:a})}}return o}function nD(e,t,o){var n=e;if(!n)return"";n=n.replace(/\\/g,"");var r=0;t.length>0&&(r=t[0].displayIndex-1);for(var i=0,a=t;i<a.length;i++){var s=a[i],l=" ";s.value?(l=s.value,s.displayIndex>r&&(r=s.displayIndex)):o&&(l=o),n=n.slice(0,s.displayIndex)+l+n.slice(s.displayIndex+1)}return o||(n=n.slice(0,r+1)),n}function rD(e,t){for(var o=0;o<e.length;o++)if(e[o].displayIndex>=t)return e[o].displayIndex;return e[e.length-1].displayIndex}function iD(e,t,o){for(var n=0;n<e.length;n++)if(e[n].displayIndex>=t){if(e[n].displayIndex>=t+o)break;e[n].value=void 0}return e}function aD(e,t,o){for(var n=0,r=0,i=!1,a=0;a<e.length&&n<o.length;a++)if(e[a].displayIndex>=t)for(i=!0,r=e[a].displayIndex;n<o.length;){if(e[a].format.test(o.charAt(n))){e[a].value=o.charAt(n++),a+1<e.length?r=e[a+1].displayIndex:r++;break}n++}return i?r:t}var sD,lD,cD,uD="_",dD=f.forwardRef((function(e,t){var o=f.useRef(null),n=e.componentRef,r=e.onFocus,i=e.onBlur,a=e.onMouseDown,s=e.onMouseUp,l=e.onChange,c=e.onPaste,u=e.onKeyDown,p=e.mask,h=e.maskChar,m=void 0===h?uD:h,g=e.maskFormat,v=void 0===g?tD:g,b=e.value,y=Ei((function(){return{maskCharData:oD(p,v),isFocused:!1,moveCursorOnMouseUp:!1,changeSelectionData:null}})),C=f.useState(),_=C[0],S=C[1],x=f.useState((function(){return nD(p,y.maskCharData,m)})),k=x[0],w=x[1],I=f.useCallback((function(e){for(var t=0,o=0;t<e.length&&o<y.maskCharData.length;){var n=e[t];y.maskCharData[o].format.test(n)&&(y.maskCharData[o].value=n,o++),t++}}),[y]),D=f.useCallback((function(e){null==r||r(e),y.isFocused=!0;for(var t=0;t<y.maskCharData.length;t++)if(!y.maskCharData[t].value){S(y.maskCharData[t].displayIndex);break}}),[y,r]),T=f.useCallback((function(e){null==i||i(e),y.isFocused=!1,y.moveCursorOnMouseUp=!0}),[y,i]),E=f.useCallback((function(e){null==a||a(e),y.isFocused||(y.moveCursorOnMouseUp=!0)}),[y,a]),P=f.useCallback((function(e){if(null==s||s(e),y.moveCursorOnMouseUp){y.moveCursorOnMouseUp=!1;for(var t=0;t<y.maskCharData.length;t++)if(!y.maskCharData[t].value){S(y.maskCharData[t].displayIndex);break}}}),[y,s]),R=f.useCallback((function(e,t){if(null===y.changeSelectionData&&o.current&&(y.changeSelectionData={changeType:"default",selectionStart:null!==o.current.selectionStart?o.current.selectionStart:-1,selectionEnd:null!==o.current.selectionEnd?o.current.selectionEnd:-1}),y.changeSelectionData){var n=0,r=y.changeSelectionData,i=r.changeType,a=r.selectionStart,s=r.selectionEnd;if("textPasted"===i){var c=s-a,u=t.length+c-k.length,d=a,h=t.substr(d,u);c&&(y.maskCharData=iD(y.maskCharData,a,c)),n=aD(y.maskCharData,d,h)}else if("delete"===i||"backspace"===i){var g="delete"===i;(u=s-a)?(y.maskCharData=iD(y.maskCharData,a,u),n=rD(y.maskCharData,a)):g?(y.maskCharData=function(e,t){for(var o=0;o<e.length;o++)if(e[o].displayIndex>=t){e[o].value=void 0;break}return e}(y.maskCharData,a),n=rD(y.maskCharData,a)):(y.maskCharData=function(e,t){for(var o=e.length-1;o>=0;o--)if(e[o].displayIndex<t){e[o].value=void 0;break}return e}(y.maskCharData,a),n=function(e,t){for(var o=e.length-1;o>=0;o--)if(e[o].displayIndex<t)return e[o].displayIndex;return e[0].displayIndex}(y.maskCharData,a))}else if(t.length>k.length){d=s-(u=t.length-k.length);var f=t.substr(d,u);n=aD(y.maskCharData,d,f)}else if(t.length<=k.length){u=1;var v=k.length+u-t.length;d=s-u,f=t.substr(d,u),y.maskCharData=iD(y.maskCharData,d,v),n=aD(y.maskCharData,d,f)}y.changeSelectionData=null;var b=nD(p,y.maskCharData,m);w(b),S(n),null==l||l(e,b)}}),[k.length,y,p,m,l]),M=f.useCallback((function(e){if(null==u||u(e),y.changeSelectionData=null,o.current&&o.current.value){var t=e.keyCode,n=e.ctrlKey,r=e.metaKey;if(n||r)return;if(t===Gn.backspace||t===Gn.del){var i=e.target.selectionStart,a=e.target.selectionEnd;if(!(t===Gn.backspace&&a&&a>0||t===Gn.del&&null!==i&&i<o.current.value.length))return;y.changeSelectionData={changeType:t===Gn.backspace?"backspace":"delete",selectionStart:null!==i?i:-1,selectionEnd:null!==a?a:-1}}}}),[y,u]),N=f.useCallback((function(e){null==c||c(e);var t=e.target.selectionStart,o=e.target.selectionEnd;y.changeSelectionData={changeType:"textPasted",selectionStart:null!==t?t:-1,selectionEnd:null!==o?o:-1}}),[y,c]);return f.useEffect((function(){y.maskCharData=oD(p,v),void 0!==b&&I(b),w(nD(p,y.maskCharData,m))}),[p,b]),f.useLayoutEffect((function(){void 0!==_&&o.current&&o.current.setSelectionRange(_,_)}),[_]),f.useEffect((function(){y.isFocused&&void 0!==_&&o.current&&o.current.setSelectionRange(_,_)})),function(e,t,o){f.useImperativeHandle(e,(function(){return{get value(){for(var e="",o=0;o<t.maskCharData.length;o++){if(!t.maskCharData[o].value)return;e+=t.maskCharData[o].value}return e},get selectionStart(){return o.current&&null!==o.current.selectionStart?o.current.selectionStart:-1},get selectionEnd(){return o.current&&o.current.selectionEnd?o.current.selectionEnd:-1},focus:function(){o.current&&o.current.focus()},blur:function(){o.current&&o.current.blur()},select:function(){o.current&&o.current.select()},setSelectionStart:function(e){o.current&&o.current.setSelectionStart(e)},setSelectionEnd:function(e){o.current&&o.current.setSelectionEnd(e)},setSelectionRange:function(e,t){o.current&&o.current.setSelectionRange(e,t)}}}),[t,o])}(n,y,o),f.createElement(Og,d({},e,{elementRef:t,onFocus:D,onBlur:T,onMouseDown:E,onMouseUp:P,onChange:R,onKeyDown:M,onPaste:N,value:k||"",componentRef:o}))}));dD.displayName="MaskedTextField",function(e){e.shade30="#004578",e.shade20="#005a9e",e.shade10="#106ebe",e.primary="#0078d4",e.tint10="#2b88d8",e.tint20="#c7e0f4",e.tint30="#deecf9",e.tint40="#eff6fc"}(sD||(sD={})),function(e){e.black="#000000",e.gray220="#11100f",e.gray210="#161514",e.gray200="#1b1a19",e.gray190="#201f1e",e.gray180="#252423",e.gray170="#292827",e.gray160="#323130",e.gray150="#3b3a39",e.gray140="#484644",e.gray130="#605e5c",e.gray120="#797775",e.gray110="#8a8886",e.gray100="#979593",e.gray90="#a19f9d",e.gray80="#b3b0ad",e.gray70="#bebbb8",e.gray60="#c8c6c4",e.gray50="#d2d0ce",e.gray40="#e1dfdd",e.gray30="#edebe9",e.gray20="#f3f2f1",e.gray10="#faf9f8",e.white="#ffffff"}(lD||(lD={})),function(e){e.pinkRed10="#750b1c",e.red20="#a4262c",e.red10="#d13438",e.redOrange20="#603d30",e.redOrange10="#da3b01",e.orange30="#8e562e",e.orange20="#ca5010",e.orange10="#ffaa44",e.yellow10="#fce100",e.orangeYellow20="#986f0b",e.orangeYellow10="#c19c00",e.yellowGreen10="#8cbd18",e.green20="#0b6a0b",e.green10="#498205",e.greenCyan10="#00ad56",e.cyan40="#005e50",e.cyan30="#005b70",e.cyan20="#038387",e.cyan10="#00b7c3",e.cyanBlue20="#004e8c",e.cyanBlue10="#0078d4",e.blue10="#4f6bed",e.blueMagenta40="#373277",e.blueMagenta30="#5c2e91",e.blueMagenta20="#8764b8",e.blueMagenta10="#8378de",e.magenta20="#881798",e.magenta10="#c239b3",e.magentaPink20="#9b0062",e.magentaPink10="#e3008c",e.gray40="#393939",e.gray30="#7a7574",e.gray20="#69797e",e.gray10="#a0aeb2"}(cD||(cD={}));var pD,hD,mD,gD=J({from:{opacity:0},to:{opacity:1}}),fD=J({from:{opacity:1},to:{opacity:0}}),vD=J({from:{transform:"scale3d(1.15, 1.15, 1)"},to:{transform:"scale3d(1, 1, 1)"}}),bD=J({from:{transform:"scale3d(1, 1, 1)"},to:{transform:"scale3d(0.9, 0.9, 1)"}}),yD=J({from:{transform:"translate3d(0, 0, 0)"},to:{transform:"translate3d(-48px, 0, 0)"}}),CD=J({from:{transform:"translate3d(0, 0, 0)"},to:{transform:"translate3d(48px, 0, 0)"}}),_D=J({from:{transform:"translate3d(48px, 0, 0)"},to:{transform:"translate3d(0, 0, 0)"}}),SD=J({from:{transform:"translate3d(-48px, 0, 0)"},to:{transform:"translate3d(0, 0, 0)"}}),xD=J({from:{transform:"translate3d(0, 0, 0)"},to:{transform:"translate3d(0, -48px, 0)"}}),kD=J({from:{transform:"translate3d(0, 0, 0)"},to:{transform:"translate3d(0, 48px, 0)"}}),wD=J({from:{transform:"translate3d(0, 48px, 0)"},to:{transform:"translate3d(0, 0, 0)"}}),ID=J({from:{transform:"translate3d(0, -48px, 0)"},to:{transform:"translate3d(0, 0, 0)"}});function DD(e,t,o){return e+" "+t+" "+o}!function(e){e.duration1="100ms",e.duration2="200ms",e.duration3="300ms",e.duration4="400ms"}(pD||(pD={})),function(e){e.accelerate="cubic-bezier(0.9, 0.1, 1, 0.2)",e.decelerate="cubic-bezier(0.1, 0.9, 0.2, 1)",e.linear="cubic-bezier(0, 0, 1, 1)",e.standard="cubic-bezier(0.8, 0, 0.2, 1)"}(hD||(hD={})),function(e){e.fadeIn=DD(gD,pD.duration1,hD.linear),e.fadeOut=DD(fD,pD.duration1,hD.linear),e.scaleDownIn=DD(vD,pD.duration3,hD.decelerate),e.scaleDownOut=DD(bD,pD.duration3,hD.decelerate),e.slideLeftOut=DD(yD,pD.duration1,hD.accelerate),e.slideRightOut=DD(CD,pD.duration1,hD.accelerate),e.slideLeftIn=DD(_D,pD.duration1,hD.decelerate),e.slideRightIn=DD(SD,pD.duration1,hD.decelerate),e.slideUpOut=DD(xD,pD.duration1,hD.accelerate),e.slideDownOut=DD(kD,pD.duration1,hD.accelerate),e.slideUpIn=DD(wD,pD.duration1,hD.decelerate),e.slideDownIn=DD(ID,pD.duration1,hD.decelerate)}(mD||(mD={}));var TD=jt({});Pn("@fluentui/theme","2.4.3");var ED=f.createContext(void 0),PD=function(){var e=(0,f.useContext)(ED),t=zn(["theme"]).theme;return e||t||jt({})},RD=0,MD=function(){return RD},ND=function(e,t){return Dn(Array.isArray(e)?e:[e],t)};function BD(e){var t=new Map;return function(o){void 0===o&&(o={});var n=o.theme,r=Wl(),i=PD();n=n||i;var a=MD(),s="function"==typeof e,l=s?[a,r,n]:[a,r],c=function(e,t){for(var o=0,n=t;o<n.length;o++){var r=n[o];if(!(e=e.get(r)))return}return e}(t,l);if(!c){var u=s?e(n):e;c=ND(u,{targetWindow:r,rtl:!!n.rtl}),function(e,t,o){for(var n=0;n<t.length-1;n++){var r=t[n],i=e.get(r);i||(i=new Map,e.set(r,i)),e=i}e.set(t[t.length-1],o)}(t,l,c)}return c}}var FD=BD((function(e){var t=e.semanticColors,o=e.fonts;return{body:[{color:t.bodyText,background:t.bodyBackground,fontFamily:o.medium.fontFamily,fontWeight:o.medium.fontWeight,fontSize:o.medium.fontSize,MozOsxFontSmoothing:o.medium.MozOsxFontSmoothing,WebkitFontSmoothing:o.medium.WebkitFontSmoothing}]}}));var AD=function(e){var t=e.theme,o=e.customizerContext,n=e.as||"div",r="string"==typeof e.as?Cv(e.as,e):Os(e,["as"]);return f.createElement(ED.Provider,{value:t},f.createElement(On.Provider,{value:o},f.createElement(n,d({},r))))},LD=new Map,HD=f.forwardRef((function(e,t){var o=function(e,t){var o,n,r,i,a=tr(t,e);return n=(o=a).theme,r=PD(),i=o.theme=f.useMemo((function(){var e=Gt(r,n);return e.id=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var o=[],n=0,r=e;n<r.length;n++){var i=r[n];if(i){var a=i.id||LD.get(i);a||(a=Ka(""),LD.set(i,a)),o.push(a)}}return o.join("-")}(r,n),e}),[r,n]),o.customizerContext=f.useMemo((function(){return{customizations:{inCustomizerContext:!0,settings:{theme:i},scopedSettings:i.components||{}}}}),[i]),o.theme.rtl!==r.rtl&&(o.dir=o.theme.rtl?"rtl":"ltr"),{state:a,render:AD}}(e,{ref:Or(t,f.useRef(null)),as:"div",applyTo:"element"}),n=o.render,r=o.state;return function(e){var t=FD(e),o=e.className,n=e.applyTo;!function(e,t){var o,n="body"===e.applyTo,r=null===(o=Vl())||void 0===o?void 0:o.body;f.useEffect((function(){if(n&&r){for(var e=0,o=t;e<o.length;e++){var i=o[e];i&&r.classList.add(i)}return function(){if(n&&r)for(var e=0,o=t;e<o.length;e++){var i=o[e];i&&r.classList.remove(i)}}}}),[n,r,t])}(e,[t.root,t.body]),e.className=qr(o,t.root,"element"===n&&t.body)}(r),ks(r.ref),n(r)}));HD.displayName="ThemeProvider";var OD,zD,WD,VD=function(){function e(){}return e.setSlot=function(t,o,n,r,i){if(void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i=!0),t.color||!t.value)if(i){var a=void 0;if("string"==typeof o){if(!(a=rg(o)))throw new Error("color is invalid in setSlot(): "+o)}else a=o;e._setSlot(t,a,n,r,i)}else t.color&&e._setSlot(t,t.color,n,r,i)},e.insureSlots=function(t,o){for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];if(!r.inherits&&!r.value){if(!r.color)throw new Error("A color slot rule that does not inherit must provide its own color.");e._setSlot(r,r.color,o,!1,!1)}}},e.getThemeAsJson=function(e){var t={};for(var o in e)if(e.hasOwnProperty(o)){var n=e[o];t[n.name]=n.color?n.color.str:n.value||""}return t},e.getThemeAsCode=function(t){return e._makeRemainingCode("loadTheme({\n palette: {\n",t)},e.getThemeAsCodeWithCreateTheme=function(t){return e._makeRemainingCode("const myTheme = createTheme({\n palette: {\n",t)},e.getThemeAsSass=function(e){var t="";for(var o in e)if(e.hasOwnProperty(o)){var n=e[o],r=n.name.charAt(0).toLowerCase()+n.name.slice(1);t+=Bp('${0}Color: "[theme: {1}, default: {2}]";\n',r,r,n.color?n.color.str:n.value||"")}return t},e.getThemeForPowerShell=function(e){var t="";for(var o in e)if(e.hasOwnProperty(o)){var n=e[o];if(n.value)continue;var r=n.name.charAt(0).toLowerCase()+n.name.slice(1),i=n.color?"#"+n.color.hex:n.value||"";n.color&&n.color.a&&100!==n.color.a&&(i+=String(n.color.a.toString(16))),t+=Bp('"{0}" = "{1}";\n',r,i)}return"@{\n"+t+"}"},e._setSlot=function(t,o,n,r,i){if(void 0===i&&(i=!0),(t.color||!t.value)&&(i||!t.color||!t.isCustomized||!t.inherits)){!i&&t.isCustomized||r||!t.inherits||!xg(t.asShade)?(t.color=o,t.isCustomized=!0):(t.isBackgroundShade?t.color=Tg(o,t.asShade,n):t.color=Dg(o,t.asShade,n),t.isCustomized=!1);for(var a=0,s=t.dependentRules;a<s.length;a++){var l=s[a];e._setSlot(l,t.color,n,!1,i)}}},e._makeRemainingCode=function(e,t){for(var o in t)if(t.hasOwnProperty(o)){var n=t[o];e+=Bp(" {0}: '{1}',\n",n.name.charAt(0).toLowerCase()+n.name.slice(1),n.color?"#"+n.color.hex:n.value||"")}return e+" }});"},e}();function KD(){var e={};function t(t,o,n,r){void 0===r&&(r=!1);var i=e[OD[o]],a={name:t,inherits:i,asShade:n,isCustomized:!1,isBackgroundShade:r,dependentRules:[]};e[t]=a,i.dependentRules.push(a)}return Ls(OD,(function(t){e[t]={name:t,isCustomized:!0,dependentRules:[]},Ls(mg,(function(o,n){if(o!==mg[mg.Unshaded]){var r=e[t],i={name:t+o,inherits:e[t],asShade:n,isCustomized:!1,isBackgroundShade:t===OD[OD.backgroundColor],dependentRules:[]};e[t+o]=i,r.dependentRules.push(i)}}))})),e[OD[OD.primaryColor]].color=rg("#0078d4"),e[OD[OD.backgroundColor]].color=rg("#ffffff"),e[OD[OD.foregroundColor]].color=rg("#323130"),t(zD[zD.themePrimary],OD.primaryColor,mg.Unshaded),t(zD[zD.themeLighterAlt],OD.primaryColor,mg.Shade1),t(zD[zD.themeLighter],OD.primaryColor,mg.Shade2),t(zD[zD.themeLight],OD.primaryColor,mg.Shade3),t(zD[zD.themeTertiary],OD.primaryColor,mg.Shade4),t(zD[zD.themeSecondary],OD.primaryColor,mg.Shade5),t(zD[zD.themeDarkAlt],OD.primaryColor,mg.Shade6),t(zD[zD.themeDark],OD.primaryColor,mg.Shade7),t(zD[zD.themeDarker],OD.primaryColor,mg.Shade8),t(zD[zD.neutralLighterAlt],OD.backgroundColor,mg.Shade1,!0),t(zD[zD.neutralLighter],OD.backgroundColor,mg.Shade2,!0),t(zD[zD.neutralLight],OD.backgroundColor,mg.Shade3,!0),t(zD[zD.neutralQuaternaryAlt],OD.backgroundColor,mg.Shade4,!0),t(zD[zD.neutralQuaternary],OD.backgroundColor,mg.Shade5,!0),t(zD[zD.neutralTertiaryAlt],OD.backgroundColor,mg.Shade6,!0),t(zD[zD.neutralTertiary],OD.foregroundColor,mg.Shade3),t(zD[zD.neutralSecondary],OD.foregroundColor,mg.Shade4),t(zD[zD.neutralPrimaryAlt],OD.foregroundColor,mg.Shade5),t(zD[zD.neutralPrimary],OD.foregroundColor,mg.Unshaded),t(zD[zD.neutralDark],OD.foregroundColor,mg.Shade7),t(zD[zD.black],OD.foregroundColor,mg.Shade8),t(zD[zD.white],OD.backgroundColor,mg.Unshaded,!0),e[zD[zD.neutralLighterAlt]].color=rg("#faf9f8"),e[zD[zD.neutralLighter]].color=rg("#f3f2f1"),e[zD[zD.neutralLight]].color=rg("#edebe9"),e[zD[zD.neutralQuaternaryAlt]].color=rg("#e1dfdd"),e[zD[zD.neutralDark]].color=rg("#201f1e"),e[zD[zD.neutralTertiaryAlt]].color=rg("#c8c6c4"),e[zD[zD.black]].color=rg("#000000"),e[zD[zD.neutralDark]].color=rg("#201f1e"),e[zD[zD.neutralPrimaryAlt]].color=rg("#3b3a39"),e[zD[zD.neutralSecondary]].color=rg("#605e5c"),e[zD[zD.neutralTertiary]].color=rg("#a19f9d"),e[zD[zD.white]].color=rg("#ffffff"),e[zD[zD.themeDarker]].color=rg("#004578"),e[zD[zD.themeDark]].color=rg("#005a9e"),e[zD[zD.themeDarkAlt]].color=rg("#106ebe"),e[zD[zD.themeSecondary]].color=rg("#2b88d8"),e[zD[zD.themeTertiary]].color=rg("#71afe5"),e[zD[zD.themeLight]].color=rg("#c7e0f4"),e[zD[zD.themeLighter]].color=rg("#deecf9"),e[zD[zD.themeLighterAlt]].color=rg("#eff6fc"),e[zD[zD.neutralLighterAlt]].isCustomized=!0,e[zD[zD.neutralLighter]].isCustomized=!0,e[zD[zD.neutralLight]].isCustomized=!0,e[zD[zD.neutralQuaternaryAlt]].isCustomized=!0,e[zD[zD.neutralDark]].isCustomized=!0,e[zD[zD.neutralTertiaryAlt]].isCustomized=!0,e[zD[zD.black]].isCustomized=!0,e[zD[zD.neutralDark]].isCustomized=!0,e[zD[zD.neutralPrimaryAlt]].isCustomized=!0,e[zD[zD.neutralSecondary]].isCustomized=!0,e[zD[zD.neutralTertiary]].isCustomized=!0,e[zD[zD.white]].isCustomized=!0,e[zD[zD.themeDarker]].isCustomized=!0,e[zD[zD.themeDark]].isCustomized=!0,e[zD[zD.themeDarkAlt]].isCustomized=!0,e[zD[zD.themePrimary]].isCustomized=!0,e[zD[zD.themeSecondary]].isCustomized=!0,e[zD[zD.themeTertiary]].isCustomized=!0,e[zD[zD.themeLight]].isCustomized=!0,e[zD[zD.themeLighter]].isCustomized=!0,e[zD[zD.themeLighterAlt]].isCustomized=!0,e}!function(e){e[e.primaryColor=0]="primaryColor",e[e.backgroundColor=1]="backgroundColor",e[e.foregroundColor=2]="foregroundColor"}(OD||(OD={})),function(e){e[e.themePrimary=0]="themePrimary",e[e.themeLighterAlt=1]="themeLighterAlt",e[e.themeLighter=2]="themeLighter",e[e.themeLight=3]="themeLight",e[e.themeTertiary=4]="themeTertiary",e[e.themeSecondary=5]="themeSecondary",e[e.themeDarkAlt=6]="themeDarkAlt",e[e.themeDark=7]="themeDark",e[e.themeDarker=8]="themeDarker",e[e.neutralLighterAlt=9]="neutralLighterAlt",e[e.neutralLighter=10]="neutralLighter",e[e.neutralLight=11]="neutralLight",e[e.neutralQuaternaryAlt=12]="neutralQuaternaryAlt",e[e.neutralQuaternary=13]="neutralQuaternary",e[e.neutralTertiaryAlt=14]="neutralTertiaryAlt",e[e.neutralTertiary=15]="neutralTertiary",e[e.neutralSecondary=16]="neutralSecondary",e[e.neutralPrimaryAlt=17]="neutralPrimaryAlt",e[e.neutralPrimary=18]="neutralPrimary",e[e.neutralDark=19]="neutralDark",e[e.black=20]="black",e[e.white=21]="white"}(zD||(zD={})),function(e){e[e.bodyBackground=0]="bodyBackground",e[e.bodyText=1]="bodyText",e[e.disabledBackground=2]="disabledBackground",e[e.disabledText=3]="disabledText"}(WD||(WD={}));var GD=/^((1[0-2]|0?[1-9]):([0-5][0-9]):([0-5][0-9])\s([AaPp][Mm]))$/,UD=/^((1[0-2]|0?[1-9]):[0-5][0-9]\s([AaPp][Mm]))$/,jD=/^([0-1]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/,qD=/^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$/,YD=function(e){var t=e.label,o=e.increments,n=void 0===o?30:o,r=e.showSeconds,i=void 0!==r&&r,a=e.allowFreeform,s=void 0===a||a,l=e.useHour12,c=void 0!==l&&l,u=e.timeRange,h=e.strings,m=void 0===h?function(e,t){return{invalidInputErrorMessage:"Enter a valid time in the "+(e?"12-hour":"24-hour")+" format: hh:mm"+(t?":ss":"")+(e?" AP":"")}}(c,i):h,g=e.onFormatDate,v=e.onValidateUserInput,b=e.onChange,y=p(e,["label","increments","showSeconds","allowFreeform","useHour12","timeRange","strings","onFormatDate","onValidateUserInput","onChange"]),C=f.useState(""),_=C[0],S=C[1],x=f.useState(""),k=x[0],w=x[1],I=QD(n,u),D=f.useMemo((function(){for(var e=Array(I),t=0;t<I;t++)e[t]=0;var o=XD(n,u);return e.map((function(e,t){var r,a,s=(r=n*t,(a=new Date(o.getTime())).setTime(a.getTime()+r*cp.MinutesInOneHour*cp.MillisecondsIn1Sec),a);s.setSeconds(0);var l=g?g(s):function(e,t,o){return e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",second:t?"2-digit":void 0,hour12:o})}(s,i,c);return{key:l,text:l}}))}),[u,n,I,i,g,c]),T=f.useState(D[0].key),E=T[0],P=T[1],R=f.useCallback((function(e,t,o,n){b&&b(e,t,o,n);var r=null==t?void 0:t.key,a="",l="";n?(s&&!t&&(g?v&&(l=v(n)):l=function(e){var t="";return(c?i?GD:UD:i?jD:qD).test(e)||(t=m.invalidInputErrorMessage),t}(n)),a=n):t&&(a=t.text),w(l),S(a),P(r)}),[s,g,v,i,c,b,m.invalidInputErrorMessage]);return f.createElement(bf,d({},y,{allowFreeform:s,selectedKey:E,label:t,errorMessage:k,options:D,onChange:R,text:_,onKeyPress:function(e){g||e.charCode>=Gn.zero&&e.charCode<=Gn.colon||e.charCode===Gn.space||e.charCode===Gn.a||e.charCode===Gn.m||e.charCode===Gn.p||e.preventDefault()}}))};YD.displayName="TimePicker";var ZD=function(e){return{start:Math.min(Math.max(e.start,0),23),end:Math.min(Math.max(e.end,0),23)}},XD=function(e,t){var o=new Date;if(t){var n=ZD(t);o.setHours(n.start)}return function(e,t){var o=new Date(e.getTime()),n=o.getMinutes();if(cp.MinutesInOneHour%t)o.setMinutes(0);else{for(var r=cp.MinutesInOneHour/t,i=1;i<=r;i++)if(n>t*(i-1)&&n<=t*i){n=t*i;break}o.setMinutes(n)}return o}(o,e)},QD=function(e,t){var o=cp.HoursInOneDay;if(t){var n=ZD(t);n.start>n.end?o=cp.HoursInOneDay-t.start-t.end:t.end>t.start&&(o=t.end-t.start)}return Math.floor(cp.MinutesInOneHour*o/e)},JD=Jn(),$D="Toggle",eT=f.forwardRef((function(e,t){var o=e.as,n=void 0===o?"div":o,r=e.ariaLabel,i=e.checked,a=e.className,s=e.defaultChecked,l=void 0!==s&&s,c=e.disabled,u=e.inlineLabel,p=e.label,h=e.offAriaLabel,m=e.offText,g=e.onAriaLabel,v=e.onChange,b=e.onChanged,y=e.onClick,C=e.onText,_=e.role,S=e.styles,x=e.theme,k=kh(i,l,f.useCallback((function(e,t){null==v||v(e,t),null==b||b(t)}),[v,b])),w=k[0],I=k[1],D=JD(S,{theme:x,className:a,disabled:c,checked:w,inlineLabel:u,onOffMissing:!C&&!m}),T=w?g:h,E=hu($D,e.id),P=E+"-label",R=E+"-stateText",M=w?C:m,N=Tr(e,hr,["defaultChecked"]),B=void 0;r||T||(p&&(B=P),M&&!B&&(B=R));var F=f.useRef(null);ks(F),tT(e,w,F),Ri({name:$D,props:e,deprecations:{offAriaLabel:void 0,onAriaLabel:"ariaLabel",onChanged:"onChange"},mutuallyExclusive:{checked:"defaultChecked"}});var A={root:{className:D.root,hidden:N.hidden},label:{children:p,className:D.label,htmlFor:E,id:P},container:{className:D.container},pill:d(d({},N),{"aria-disabled":c,"aria-checked":w,"aria-label":r||T,"aria-labelledby":B,className:D.pill,"data-is-focusable":!0,"data-ktp-target":!0,disabled:c,id:E,onClick:function(e){c||(I(!w,e),y&&y(e))},ref:F,role:_||"switch",type:"button"}),thumb:{className:D.thumb},stateText:{children:M,className:D.text,htmlFor:E,id:R}};return f.createElement(n,d({ref:t},A.root),p&&f.createElement(Yh,d({},A.label)),f.createElement("div",d({},A.container),f.createElement("button",d({},A.pill),f.createElement("span",d({},A.thumb))),(w&&C||m)&&f.createElement(Yh,d({},A.stateText))))}));eT.displayName="ToggleBase";var tT=function(e,t,o){f.useImperativeHandle(e.componentRef,(function(){return{get checked(){return!!t},focus:function(){o.current&&o.current.focus()}}}),[t,o])},oT=Vn(eT,(function(e){var t,o,n,r,i,a,s,l=e.theme,c=e.className,u=e.disabled,p=e.checked,h=e.inlineLabel,m=e.onOffMissing,g=l.semanticColors,f=l.palette,v=g.bodyBackground,b=g.inputBackgroundChecked,y=g.inputBackgroundCheckedHovered,C=f.neutralDark,_=g.disabledBodySubtext,S=g.smallInputBorder,x=g.inputForegroundChecked,k=g.disabledBodySubtext,w=g.disabledBackground,I=g.smallInputBorder,D=g.inputBorderHovered,T=g.disabledBodySubtext,E=g.disabledText;return{root:["ms-Toggle",p&&"is-checked",!u&&"is-enabled",u&&"is-disabled",l.fonts.medium,{marginBottom:"8px"},h&&{display:"flex",alignItems:"center"},c],label:["ms-Toggle-label",{display:"inline-block"},u&&{color:E,selectors:(t={},t[ro]={color:"GrayText"},t)},h&&!m&&{marginRight:16},m&&h&&{order:1,marginLeft:16},h&&{wordBreak:"break-word"}],container:["ms-Toggle-innerContainer",{display:"flex",position:"relative"}],pill:["ms-Toggle-background",To(l,{inset:-3}),{fontSize:"20px",boxSizing:"border-box",width:40,height:20,borderRadius:10,transition:"all 0.1s ease",border:"1px solid "+I,background:v,cursor:"pointer",display:"flex",alignItems:"center",padding:"0 3px"},!u&&[!p&&{selectors:{":hover":[{borderColor:D}],":hover .ms-Toggle-thumb":[{backgroundColor:C,selectors:(o={},o[ro]={borderColor:"Highlight"},o)}]}},p&&[{background:b,borderColor:"transparent",justifyContent:"flex-end"},{selectors:(n={":hover":[{backgroundColor:y,borderColor:"transparent",selectors:(r={},r[ro]={backgroundColor:"Highlight"},r)}]},n[ro]=d({backgroundColor:"Highlight"},{forcedColorAdjust:"none",MsHighContrastAdjust:"none"}),n)}]],u&&[{cursor:"default"},!p&&[{borderColor:T}],p&&[{backgroundColor:_,borderColor:"transparent",justifyContent:"flex-end"}]],!u&&{selectors:{"&:hover":{selectors:(i={},i[ro]={borderColor:"Highlight"},i)}}}],thumb:["ms-Toggle-thumb",{display:"block",width:12,height:12,borderRadius:"50%",transition:"all 0.1s ease",backgroundColor:S,borderColor:"transparent",borderWidth:6,borderStyle:"solid",boxSizing:"border-box"},!u&&p&&[{backgroundColor:x,selectors:(a={},a[ro]={backgroundColor:"Window",borderColor:"Window"},a)}],u&&[!p&&[{backgroundColor:k}],p&&[{backgroundColor:w}]]],text:["ms-Toggle-stateText",{selectors:{"&&":{padding:"0",margin:"0 8px",userSelect:"none",fontWeight:qe.regular}}},u&&{selectors:{"&&":{color:E,selectors:(s={},s[ro]={color:"GrayText"},s)}}}]}}),void 0,{scope:"Toggle"}),nT=function(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()},rT=function(){function e(){}return e.measure=function(t,o){e._timeoutId&&e.setPeriodicReset();var n=nT();o();var r=nT(),i=e.summary[t]||{totalDuration:0,count:0,all:[]},a=r-n;i.totalDuration+=a,i.count++,i.all.push({duration:a,timeStamp:r}),e.summary[t]=i},e.reset=function(){e.summary={},clearTimeout(e._timeoutId),e._timeoutId=NaN},e.setPeriodicReset=function(){e._timeoutId=setTimeout((function(){return e.reset()}),18e4)},e.summary={},e}(),iT="undefined"!=typeof WeakMap?new WeakMap:void 0;function aT(e){var t=function(t){function o(){var o=null!==t&&t.apply(this,arguments)||this;return o.state={Component:iT?iT.get(e.load):void 0},o}return u(o,t),o.prototype.render=function(){var e=this.props,t=e.forwardedRef,o=e.asyncPlaceholder,n=p(e,["forwardedRef","asyncPlaceholder"]),r=this.state.Component;return r?f.createElement(r,d(d({},n),{ref:t})):o?f.createElement(o,null):null},o.prototype.componentDidMount=function(){var t=this;this.state.Component||e.load().then((function(o){o&&(iT&&iT.set(e.load,o),t.setState({Component:o},e.onLoad))})).catch(e.onError)},o}(f.Component);return f.forwardRef((function(e,o){return f.createElement(t,d({},e,{forwardedRef:o}))}))}function sT(e){throw new Error("Unexpected object: "+e)}function lT(e,t){void 0===t&&(t=!0);var o=[];if(e){for(var n=0;n<e.children.length;n++)o.push(e.children.item(n));t&&fa(e)&&o.push.apply(o,e._virtual.children)}return o}function cT(e){var t,o=e||at();o&&!0!==(null===(t=o.FabricConfig)||void 0===t?void 0:t.disableFocusRects)&&(o.__hasInitializeFocusRects__||(o.__hasInitializeFocusRects__=!0,o.addEventListener("mousedown",uT,!0),o.addEventListener("pointerdown",dT,!0),o.addEventListener("keydown",pT,!0)))}function uT(e){Do(!1,e.target)}function dT(e){"mouse"!==e.pointerType&&Do(!1,e.target)}function pT(e){Cs(e.which)&&Do(!0,e.target)}var hT="";function mT(e){return hT+e}function gT(e){hT=e}var fT=function(e){var t;return function(o,n){t||(t=new Set,Ki(e,{componentWillUnmount:function(){t.forEach((function(e){return clearTimeout(e)}))}}));var r=setTimeout((function(){t.delete(r),o()}),n);t.add(r)}};Pn("@fluentui/utilities","8.3.6");var vT=d(d({},lp),{prevWeekAriaLabel:"Previous week",nextWeekAriaLabel:"Next week",prevMonthAriaLabel:"Go to previous month",nextMonthAriaLabel:"Go to next month",prevYearAriaLabel:"Go to previous year",nextYearAriaLabel:"Go to next year",closeButtonAriaLabel:"Close date picker"}),bT={leftNavigation:"ChevronLeft",rightNavigation:"ChevronRight"},yT=Jn(),CT=function(e){function t(t){var o=e.call(this,t)||this;o._dayGrid=f.createRef(),o._onSelectDate=function(e){var t=o.props.onSelectDate;o.setState({selectedDate:e}),o._focusOnUpdate=!0,t&&t(e)},o._onNavigateDate=function(e,t){var n=o.props.onNavigateDate;o.setState({navigatedDate:e}),o._focusOnUpdate=t,n&&n(e)},o._renderPreviousWeekNavigationButton=function(e){var t,n=o.props,r=n.minDate,i=n.firstDayOfWeek,a=n.navigationIcons,s=o.state.navigatedDate,l=jn()?a.rightNavigation:a.leftNavigation,c=!r||Cp(r,wp(s,i))<0;return f.createElement("button",{className:qr(e.navigationIconButton,(t={},t[e.disabledStyle]=!c,t)),disabled:!c,"aria-disabled":!c,onClick:c?o._onSelectPrevDateRange:void 0,onKeyDown:c?o._onButtonKeyDown(o._onSelectPrevDateRange):void 0,title:o._createPreviousWeekAriaLabel(),type:"button"},f.createElement(ii,{iconName:l}))},o._renderNextWeekNavigationButton=function(e){var t,n=o.props,r=n.maxDate,i=n.firstDayOfWeek,a=n.navigationIcons,s=o.state.navigatedDate,l=jn()?a.leftNavigation:a.rightNavigation,c=!r||Cp(up(wp(s,i),7),r)<0;return f.createElement("button",{className:qr(e.navigationIconButton,(t={},t[e.disabledStyle]=!c,t)),disabled:!c,"aria-disabled":!c,onClick:c?o._onSelectNextDateRange:void 0,onKeyDown:c?o._onButtonKeyDown(o._onSelectNextDateRange):void 0,title:o._createNextWeekAriaLabel(),type:"button"},f.createElement(ii,{iconName:l}))},o._onSelectPrevDateRange=function(){o.props.showFullMonth?o._navigateDate(pp(o.state.navigatedDate,-1)):o._navigateDate(up(o.state.navigatedDate,-7))},o._onSelectNextDateRange=function(){o.props.showFullMonth?o._navigateDate(pp(o.state.navigatedDate,1)):o._navigateDate(up(o.state.navigatedDate,7))},o._navigateDate=function(e){o.setState({navigatedDate:e}),o.props.onNavigateDate&&o.props.onNavigateDate(e)},o._onWrapperKeyDown=function(e){switch(e.which){case Gn.enter:case Gn.backspace:e.preventDefault()}},o._onButtonKeyDown=function(e){return function(t){switch(t.which){case Gn.enter:e()}}},o._onTouchStart=function(e){var t=e.touches[0];t&&(o._initialTouchX=t.clientX)},o._onTouchMove=function(e){var t=jn(),n=e.touches[0];n&&void 0!==o._initialTouchX&&n.clientX!==o._initialTouchX&&((n.clientX-o._initialTouchX)*(t?-1:1)<0?o._onSelectNextDateRange():o._onSelectPrevDateRange(),o._initialTouchX=void 0)},o._createPreviousWeekAriaLabel=function(){var e=o.props,t=e.strings,n=e.showFullMonth,r=e.firstDayOfWeek,i=o.state.navigatedDate,a=void 0;if(n&&t.prevMonthAriaLabel)a=t.prevMonthAriaLabel+" "+t.months[pp(i,-1).getMonth()];else if(!n&&t.prevWeekAriaLabel){var s=wp(up(i,-7),r),l=up(s,6);a=t.prevWeekAriaLabel+" "+o._formatDateRange(s,l)}return a},o._createNextWeekAriaLabel=function(){var e=o.props,t=e.strings,n=e.showFullMonth,r=e.firstDayOfWeek,i=o.state.navigatedDate,a=void 0;if(n&&t.nextMonthAriaLabel)a=t.nextMonthAriaLabel+" "+t.months[pp(i,1).getMonth()];else if(!n&&t.nextWeekAriaLabel){var s=wp(up(i,7),r),l=up(s,6);a=t.nextWeekAriaLabel+" "+o._formatDateRange(s,l)}return a},o._formatDateRange=function(e,t){var n=o.props,r=n.dateTimeFormatter,i=n.strings;return(null==r?void 0:r.formatMonthDayYear(e,i))+" - "+(null==r?void 0:r.formatMonthDayYear(t,i))},Gi(o);var n=t.initialDate&&!isNaN(t.initialDate.getTime())?t.initialDate:t.today||new Date;return o.state={selectedDate:n,navigatedDate:n,previousShowFullMonth:!!t.showFullMonth,animationDirection:t.animationDirection},o._focusOnUpdate=!1,o}return u(t,e),t.getDerivedStateFromProps=function(e,t){var o=e.initialDate&&!isNaN(e.initialDate.getTime())?e.initialDate:e.today||new Date,n=!!e.showFullMonth,r=n!==t.previousShowFullMonth?Up.Vertical:Up.Horizontal;return yp(o,t.selectedDate)?{selectedDate:o,navigatedDate:t.navigatedDate,previousShowFullMonth:n,animationDirection:r}:{selectedDate:o,navigatedDate:o,previousShowFullMonth:n,animationDirection:r}},t.prototype.focus=function(){this._dayGrid&&this._dayGrid.current&&this._dayGrid.current.focus()},t.prototype.render=function(){var e=this.props,t=e.strings,o=e.dateTimeFormatter,n=e.firstDayOfWeek,r=e.minDate,i=e.maxDate,a=e.restrictedDates,s=e.today,l=e.styles,c=e.theme,u=e.className,h=e.showFullMonth,m=e.weeksToShow,g=p(e,["strings","dateTimeFormatter","firstDayOfWeek","minDate","maxDate","restrictedDates","today","styles","theme","className","showFullMonth","weeksToShow"]),v=yT(l,{theme:c,className:u});return f.createElement("div",{className:v.root,onKeyDown:this._onWrapperKeyDown,onTouchStart:this._onTouchStart,onTouchMove:this._onTouchMove,"aria-expanded":h},this._renderPreviousWeekNavigationButton(v),f.createElement(Zp,d({styles:l,componentRef:this._dayGrid,strings:t,selectedDate:this.state.selectedDate,navigatedDate:this.state.navigatedDate,firstDayOfWeek:n,firstWeekOfYear:np.FirstDay,dateRangeType:rp.Day,weeksToShow:h?m:1,dateTimeFormatter:o,minDate:r,maxDate:i,restrictedDates:a,onSelectDate:this._onSelectDate,onNavigateDate:this._onNavigateDate,today:s,lightenDaysOutsideNavigatedMonth:h,animationDirection:this.state.animationDirection},g)),this._renderNextWeekNavigationButton(v))},t.prototype.componentDidUpdate=function(){this._focusOnUpdate&&(this.focus(),this._focusOnUpdate=!1)},t.defaultProps={onSelectDate:void 0,initialDate:void 0,today:new Date,firstDayOfWeek:tp.Sunday,strings:vT,navigationIcons:bT,dateTimeFormatter:sp,animationDirection:Up.Horizontal},t}(f.Component),_T={root:"ms-WeeklyDayPicker-root"},ST=Vn(CT,(function(e){var t,o=e.className,n=e.theme,r=n.palette,i=Qo(_T,n);return{root:[i.root,on,{width:220,padding:12,boxSizing:"content-box",display:"flex",alignItems:"center",flexDirection:"row"},o],dayButton:{borderRadius:"100%"},dayIsToday:{},dayCell:{borderRadius:"100%!important"},daySelected:{},navigationIconButton:[To(n,{inset:0}),{width:12,minWidth:12,height:0,overflow:"hidden",padding:0,margin:0,border:"none",display:"flex",alignItems:"center",backgroundColor:r.neutralLighter,fontSize:je.small,fontFamily:"inherit",selectors:(t={},t["."+i.root+":hover &, ."+wo+" ."+i.root+":focus &, ."+wo+" &:focus"]={height:53,minHeight:12,overflow:"initial"},t["."+wo+" ."+i.root+":focus-within &"]={height:53,minHeight:12,overflow:"initial"},t["&:hover"]={cursor:"pointer",backgroundColor:r.neutralLight},t["&:active"]={backgroundColor:r.neutralTertiary},t)}],disabledStyle:{selectors:{"&, &:disabled, & button":{color:r.neutralTertiaryAlt,pointerEvents:"none"}}}}}),void 0,{scope:"WeeklyDayPicker"});Pn("@fluentui/react-window-provider","2.1.4"),gS(),FluentUIReact=t}(); //# sourceMappingURL=fluentui-react.js.map
test/PopoverSpec.js
pandoraui/react-bootstrap
import React from 'react'; import ReactTestUtils from 'react/lib/ReactTestUtils'; import Popover from '../src/Popover'; describe('Popover', function () { it('Should output a popover title and content', function () { let instance = ReactTestUtils.renderIntoDocument( <Popover title="Popover title"> <strong>Popover Content</strong> </Popover> ); assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'popover-title')); assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'popover-content')); assert.ok(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'strong')); }); });
src/core/tests/snapshot/mocks/pigment-store/react.js
JulienPradet/pigment-store
/* global describe it expect */ import React from 'react' import renderer from 'react-test-renderer' const runTest = (componentName, featureName, decorators, render, actions) => { describe(componentName, () => { it(featureName, () => { const finalRender = decorators.reduce( (finalRender, decorator) => decorator(finalRender), render ) const component = renderer.create(finalRender()) expect(component.toJSON()).toMatchSnapshot() }) }) } const Component = (componentName, Component) => { const decorators = [] return { setDescription () { return this }, addDecorator (decorator) { decorators.push(decorator) return this }, feature (featureName, props, actions) { runTest(componentName, featureName, decorators, () => <Component {...props} />, actions) return this }, featureJsx (featureName, jsx, actions) { runTest(componentName, featureName, decorators, () => jsx, actions) return this } } } export default { describe: Component }
zanata-editor/src/__tests__/components/SuggestionSourceDetailsTest.js
Halcom/zanata-server
jest.disableAutomock() import React from 'react' import ReactDOMServer from 'react-dom/server' import Icon from '../../app/components/Icon' import SuggestionSourceDetails from '../../app/components/SuggestionSourceDetails' describe('SuggestionSourceDetailsTest', () => { it('SuggestionSourceDetails markup (imported)', () => { const actual = ReactDOMServer.renderToStaticMarkup( <SuggestionSourceDetails suggestion={{ matchDetails: [ { type: 'IMPORTED_TM', transMemorySlug: 'champagne' } ] }}/> ) // Note: slug wrapped as a string here to work around assertion // library, which considers ' champagne' different from // ' ' + 'champagne' const expected = ReactDOMServer.renderToStaticMarkup( <div className="TransUnit-details"> <ul className="u-textMeta u-listInline u-sizeLineHeight-1"> <li> <Icon name="import" className="Icon--xsm"/> {'champagne'} </li> </ul> </div> ) expect(actual).toEqual(expected) }) it('SuggestionSourceDetails markup (local project)', () => { const actual = ReactDOMServer.renderToStaticMarkup( <SuggestionSourceDetails suggestion={{ matchDetails: [ { type: 'LOCAL_PROJECT', projectId: 'sausages', projectName: 'Sausages', version: 'the-wurst-version', documentPath: 'what-a-brat', documentName: 'i-rote-this.txt' } ] }}/> ) const expected = ReactDOMServer.renderToStaticMarkup( <div className="TransUnit-details"> <ul className="u-textMeta u-listInline u-sizeLineHeight-1"> <li title="sausages"> <Icon name="project" className="Icon--xsm"/> {'Sausages'} </li> <li> <Icon name="version" className="Icon--xsm"/> {'the-wurst-version'} </li> <li title="what-a-brat/i-rote-this.txt"> <Icon name="document" className="Icon--xsm"/> {'i-rote-this.txt'} </li> </ul> </div> ) expect(actual).toEqual(expected) }) it('SuggestionSourceDetails markup (imported)', () => { // different type from top match so it is obvious // if display is based on the wrong one const remainingMatch = { type: 'LOCAL_PROJECT', projectId: 'sausages', projectName: 'Sausages', version: 'the-wurst-version', documentPath: 'what-a-brat', documentName: 'i-rote-this.txt' } const actual = ReactDOMServer.renderToStaticMarkup( <SuggestionSourceDetails suggestion={{ matchDetails: [ { type: 'IMPORTED_TM', transMemorySlug: 'champagne' }, remainingMatch, remainingMatch, remainingMatch ] }}/> ) // Note: some of the expected text output must be wrapped in // {} to work around a weakness in the assertion // library, which considers ' champagne' different from // ' ' + 'champagne' const expected = ReactDOMServer.renderToStaticMarkup( <div className="TransUnit-details"> <ul className="u-textMeta u-listInline u-sizeLineHeight-1"> <li> <Icon name="import" className="Icon--xsm"/> {'champagne'} </li> <li> <Icon name="translate" class="Icon--xsm" /> {3}{' more occurrences'} </li> </ul> </div> ) expect(actual).toEqual(expected) }) })
src/parser/demonhunter/havoc/modules/talents/Netherwalk.js
sMteX/WoWAnalyzer
import React from 'react'; import StatisticBox from 'interface/others/StatisticBox'; import { STATISTIC_ORDER } from 'interface/others/StatisticBox'; import SPELLS from 'common/SPELLS/index'; import SpellIcon from 'common/SpellIcon'; import Events from 'parser/core/Events'; import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer'; /** * Example Report: https://www.warcraftlogs.com/reports/PGMqmyH1b86fW7F2/#fight=55&source=10 */ class Netherwalk extends Analyzer { damageImmuned = []; constructor(...args) { super(...args); this.active = this.selectedCombatant.hasTalent(SPELLS.NETHERWALK_TALENT.id); if (!this.active) { return; } this.addEventListener(Events.damage.to(SELECTED_PLAYER), this.onNetherwalkCast); } onNetherwalkCast(event) { if(!this.selectedCombatant.hasBuff(SPELLS.NETHERWALK_TALENT.id)) { return; } this.damageImmuned.push({ name: event.ability.name, }); } statistic() { return ( <StatisticBox position={STATISTIC_ORDER.CORE(6)} icon={<SpellIcon id={SPELLS.NETHERWALK_TALENT.id} />} value={<>{this.damageImmuned.length} <small>spells immuned</small></>} label="Netherwalk" > <table className="table table-condensed"> <thead> <tr> <th>Name</th> </tr> </thead> <tbody> {Object.values(this.damageImmuned).map((e, i) => ( <tr key={i}> <th>{this.damageImmuned[i].name}</th> </tr> ))} </tbody> </table> </StatisticBox> ); } } export default Netherwalk;
ajax/libs/F2/1.3.2/f2.no-easyXDM.min.js
neveldo/cdnjs
/*! F2 - v1.3.2 - 11-18-2013 - See below for copyright and license */ (function(exports){if(!exports.F2||exports.F2_TESTING_MODE){/*! JSON.org requires the following notice to accompany json2: Copyright (c) 2002 JSON.org http://json.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software shall be used for Good, not Evil. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ "object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(e){return 10>e?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,o,i,a,s=gap,l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),"function"==typeof rep&&(l=rep.call(t,e,l)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?l+"":"null";case"boolean":case"null":return l+"";case"object":if(!l)return"null";if(gap+=indent,a=[],"[object Array]"===Object.prototype.toString.apply(l)){for(i=l.length,n=0;i>n;n+=1)a[n]=str(n,l)||"null";return o=0===a.length?"[]":gap?"[\n"+gap+a.join(",\n"+gap)+"\n"+s+"]":"["+a.join(",")+"]",gap=s,o}if(rep&&"object"==typeof rep)for(i=rep.length,n=0;i>n;n+=1)"string"==typeof rep[n]&&(r=rep[n],o=str(r,l),o&&a.push(quote(r)+(gap?": ":":")+o));else for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(o=str(r,l),o&&a.push(quote(r)+(gap?": ":":")+o));return o=0===a.length?"{}":gap?"{\n"+gap+a.join(",\n"+gap)+"\n"+s+"}":"{"+a.join(",")+"}",gap=s,o}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(e,t,n){var r;if(gap="",indent="","number"==typeof n)for(r=0;n>r;r+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var n,r,o=e[t];if(o&&"object"==typeof o)for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(r=walk(o,n),void 0!==r?o[n]=r:delete o[n]);return reviver.call(e,t,o)}var j;if(text+="",cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),/*! * jQuery JavaScript Library v1.8.3 * The jQuery Foundation and other contributors require the following notice to accompany jQuery: * * Copyright (c) 2013 jQuery Foundation and other contributors * * http://jquery.com * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software * is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ function(e,t){function n(e){var t=ht[e]={};return Y.each(e.split(tt),function(e,n){t[n]=!0}),t}function r(e,n,r){if(r===t&&1===e.nodeType){var o="data-"+n.replace(mt,"-$1").toLowerCase();if(r=e.getAttribute(o),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:gt.test(r)?Y.parseJSON(r):r}catch(i){}Y.data(e,n,r)}else r=t}return r}function o(e){var t;for(t in e)if(("data"!==t||!Y.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function i(){return!1}function a(){return!0}function s(e){return!e||!e.parentNode||11===e.parentNode.nodeType}function l(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function c(e,t,n){if(t=t||0,Y.isFunction(t))return Y.grep(e,function(e,r){var o=!!t.call(e,r,e);return o===n});if(t.nodeType)return Y.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=Y.grep(e,function(e){return 1===e.nodeType});if(Mt.test(t))return Y.filter(t,r,!n);t=Y.filter(t,r)}return Y.grep(e,function(e){return Y.inArray(e,t)>=0===n})}function u(e){var t=Dt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function p(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function f(e,t){if(1===t.nodeType&&Y.hasData(e)){var n,r,o,i=Y._data(e),a=Y._data(t,i),s=i.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,o=s[n].length;o>r;r++)Y.event.add(t,n,s[n][r])}a.data&&(a.data=Y.extend({},a.data))}}function d(e,t){var n;1===t.nodeType&&(t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),Y.support.html5Clone&&e.innerHTML&&!Y.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Vt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.selected=e.defaultSelected:"input"===n||"textarea"===n?t.defaultValue=e.defaultValue:"script"===n&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(Y.expando))}function h(e){return e.getElementsByTagName!==t?e.getElementsByTagName("*"):e.querySelectorAll!==t?e.querySelectorAll("*"):[]}function g(e){Vt.test(e.type)&&(e.defaultChecked=e.checked)}function m(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,o=vn.length;o--;)if(t=vn[o]+n,t in e)return t;return r}function y(e,t){return e=t||e,"none"===Y.css(e,"display")||!Y.contains(e.ownerDocument,e)}function v(e,t){for(var n,r,o=[],i=0,a=e.length;a>i;i++)n=e[i],n.style&&(o[i]=Y._data(n,"olddisplay"),t?(o[i]||"none"!==n.style.display||(n.style.display=""),""===n.style.display&&y(n)&&(o[i]=Y._data(n,"olddisplay",C(n.nodeName)))):(r=nn(n,"display"),o[i]||"none"===r||Y._data(n,"olddisplay",r)));for(i=0;a>i;i++)n=e[i],n.style&&(t&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=t?o[i]||"":"none"));return e}function b(e,t,n){var r=pn.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function _(e,t,n,r){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,i=0;4>o;o+=2)"margin"===n&&(i+=Y.css(e,n+yn[o],!0)),r?("content"===n&&(i-=parseFloat(nn(e,"padding"+yn[o]))||0),"margin"!==n&&(i-=parseFloat(nn(e,"border"+yn[o]+"Width"))||0)):(i+=parseFloat(nn(e,"padding"+yn[o]))||0,"padding"!==n&&(i+=parseFloat(nn(e,"border"+yn[o]+"Width"))||0));return i}function x(e,t,n){var r="width"===t?e.offsetWidth:e.offsetHeight,o=!0,i=Y.support.boxSizing&&"border-box"===Y.css(e,"boxSizing");if(0>=r||null==r){if(r=nn(e,t),(0>r||null==r)&&(r=e.style[t]),fn.test(r))return r;o=i&&(Y.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+_(e,t,n||(i?"border":"content"),o)+"px"}function C(e){if(hn[e])return hn[e];var t=Y("<"+e+">").appendTo(U.body),n=t.css("display");return t.remove(),("none"===n||""===n)&&(rn=U.body.appendChild(rn||Y.extend(U.createElement("iframe"),{frameBorder:0,width:0,height:0})),on&&rn.createElement||(on=(rn.contentWindow||rn.contentDocument).document,on.write("<!doctype html><html><body>"),on.close()),t=on.body.appendChild(on.createElement(e)),n=nn(t,"display"),U.body.removeChild(rn)),hn[e]=n,n}function w(e,t,n,r){var o;if(Y.isArray(t))Y.each(t,function(t,o){n||xn.test(e)?r(e,o):w(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==Y.type(t))r(e,t);else for(o in t)w(e+"["+o+"]",t[o],n,r)}function A(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o,i,a=t.toLowerCase().split(tt),s=0,l=a.length;if(Y.isFunction(n))for(;l>s;s++)r=a[s],i=/^\+/.test(r),i&&(r=r.substr(1)||"*"),o=e[r]=e[r]||[],o[i?"unshift":"push"](n)}}function F(e,n,r,o,i,a){i=i||n.dataTypes[0],a=a||{},a[i]=!0;for(var s,l=e[i],c=0,u=l?l.length:0,p=e===Hn;u>c&&(p||!s);c++)s=l[c](n,r,o),"string"==typeof s&&(!p||a[s]?s=t:(n.dataTypes.unshift(s),s=F(e,n,r,o,s,a)));return!p&&s||a["*"]||(s=F(e,n,r,o,"*",a)),s}function T(e,n){var r,o,i=Y.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((i[r]?e:o||(o={}))[r]=n[r]);o&&Y.extend(!0,e,o)}function k(e,n,r){var o,i,a,s,l=e.contents,c=e.dataTypes,u=e.responseFields;for(i in u)i in r&&(n[u[i]]=r[i]);for(;"*"===c[0];)c.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("content-type"));if(o)for(i in l)if(l[i]&&l[i].test(o)){c.unshift(i);break}if(c[0]in r)a=c[0];else{for(i in r){if(!c[0]||e.converters[i+" "+c[0]]){a=i;break}s||(s=i)}a=a||s}return a?(a!==c[0]&&c.unshift(a),r[a]):t}function E(e,t){var n,r,o,i,a=e.dataTypes.slice(),s=a[0],l={},c=0;if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a[1])for(n in e.converters)l[n.toLowerCase()]=e.converters[n];for(;o=a[++c];)if("*"!==o){if("*"!==s&&s!==o){if(n=l[s+" "+o]||l["* "+o],!n)for(r in l)if(i=r.split(" "),i[1]===o&&(n=l[s+" "+i[0]]||l["* "+i[0]])){n===!0?n=l[r]:l[r]!==!0&&(o=i[0],a.splice(c--,0,o));break}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(u){return{state:"parsererror",error:n?u:"No conversion from "+s+" to "+o}}}s=o}return{state:"success",data:t}}function N(){try{return new e.XMLHttpRequest}catch(t){}}function S(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function R(){return setTimeout(function(){Xn=t},0),Xn=Y.now()}function j(e,t){Y.each(t,function(t,n){for(var r=(er[t]||[]).concat(er["*"]),o=0,i=r.length;i>o;o++)if(r[o].call(e,t,n))return})}function I(e,t,n){var r,o=0,i=Zn.length,a=Y.Deferred().always(function(){delete s.elem}),s=function(){for(var t=Xn||R(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,i=0,s=l.tweens.length;s>i;i++)l.tweens[i].run(o);return a.notifyWith(e,[l,o,n]),1>o&&s?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:Y.extend({},t),opts:Y.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||R(),duration:n.duration,tweens:[],createTween:function(t,n){var r=Y.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){for(var n=0,r=t?l.tweens.length:0;r>n;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(O(c,l.opts.specialEasing);i>o;o++)if(r=Zn[o].call(l,e,c,l.opts))return r;return j(l,c),Y.isFunction(l.opts.start)&&l.opts.start.call(e,l),Y.fx.timer(Y.extend(s,{anim:l,queue:l.opts.queue,elem:e})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function O(e,t){var n,r,o,i,a;for(n in e)if(r=Y.camelCase(n),o=t[r],i=e[n],Y.isArray(i)&&(o=i[1],i=e[n]=i[0]),n!==r&&(e[r]=i,delete e[n]),a=Y.cssHooks[r],a&&"expand"in a){i=a.expand(i),delete e[r];for(n in i)n in e||(e[n]=i[n],t[n]=o)}else t[r]=o}function P(e,t,n){var r,o,i,a,s,l,c,u,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&y(e);n.queue||(u=Y._queueHooks(e,"fx"),null==u.unqueued&&(u.unqueued=0,p=u.empty.fire,u.empty.fire=function(){u.unqueued||p()}),u.unqueued++,f.always(function(){f.always(function(){u.unqueued--,Y.queue(e,"fx").length||u.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===Y.css(e,"display")&&"none"===Y.css(e,"float")&&(Y.support.inlineBlockNeedsLayout&&"inline"!==C(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",Y.support.shrinkWrapBlocks||f.done(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Kn.exec(i)){if(delete t[r],l=l||"toggle"===i,i===(m?"hide":"show"))continue;g.push(r)}if(a=g.length){s=Y._data(e,"fxshow")||Y._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),l&&(s.hidden=!m),m?Y(e).show():f.done(function(){Y(e).hide()}),f.done(function(){var t;Y.removeData(e,"fxshow",!0);for(t in h)Y.style(e,t,h[t])});for(r=0;a>r;r++)o=g[r],c=f.createTween(o,m?s[o]:0),h[o]=s[o]||Y.style(e,o),o in s||(s[o]=c.start,m&&(c.end=c.start,c.start="width"===o||"height"===o?1:0))}}function M(e,t,n,r,o){return new M.prototype.init(e,t,n,r,o)}function H(e,t){var n,r={height:e},o=0;for(t=t?1:0;4>o;o+=2-t)n=yn[o],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function L(e){return Y.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var D,B,U=e.document,Q=e.location,q=e.navigator,W=e.jQuery,$=e.$,z=Array.prototype.push,J=Array.prototype.slice,X=Array.prototype.indexOf,V=Object.prototype.toString,K=Object.prototype.hasOwnProperty,G=String.prototype.trim,Y=function(e,t){return new Y.fn.init(e,t,D)},Z=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,et=/\S/,tt=/\s+/,nt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rt=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,ot=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,it=/^[\],:{}\s]*$/,at=/(?:^|:|,)(?:\s*\[)+/g,st=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,lt=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,ct=/^-ms-/,ut=/-([\da-z])/gi,pt=function(e,t){return(t+"").toUpperCase()},ft=function(){U.addEventListener?(U.removeEventListener("DOMContentLoaded",ft,!1),Y.ready()):"complete"===U.readyState&&(U.detachEvent("onreadystatechange",ft),Y.ready())},dt={};Y.fn=Y.prototype={constructor:Y,init:function(e,n,r){var o,i,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if("string"==typeof e){if(o="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:rt.exec(e),!o||!o[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(o[1])return n=n instanceof Y?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:U,e=Y.parseHTML(o[1],a,!0),ot.test(o[1])&&Y.isPlainObject(n)&&this.attr.call(e,n,!0),Y.merge(this,e);if(i=U.getElementById(o[2]),i&&i.parentNode){if(i.id!==o[2])return r.find(e);this.length=1,this[0]=i}return this.context=U,this.selector=e,this}return Y.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),Y.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return J.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=Y.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,"find"===t?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return Y.each(this,e,t)},ready:function(e){return Y.ready.promise().done(e),this},eq:function(e){return e=+e,-1===e?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(J.apply(this,arguments),"slice",J.call(arguments).join(","))},map:function(e){return this.pushStack(Y.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:z,sort:[].sort,splice:[].splice},Y.fn.init.prototype=Y.fn,Y.extend=Y.fn.extend=function(){var e,n,r,o,i,a,s=arguments[0]||{},l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),"object"==typeof s||Y.isFunction(s)||(s={}),c===l&&(s=this,--l);c>l;l++)if(null!=(e=arguments[l]))for(n in e)r=s[n],o=e[n],s!==o&&(u&&o&&(Y.isPlainObject(o)||(i=Y.isArray(o)))?(i?(i=!1,a=r&&Y.isArray(r)?r:[]):a=r&&Y.isPlainObject(r)?r:{},s[n]=Y.extend(u,a,o)):o!==t&&(s[n]=o));return s},Y.extend({noConflict:function(t){return e.$===Y&&(e.$=$),t&&e.jQuery===Y&&(e.jQuery=W),Y},isReady:!1,readyWait:1,holdReady:function(e){e?Y.readyWait++:Y.ready(!0)},ready:function(e){if(e===!0?!--Y.readyWait:!Y.isReady){if(!U.body)return setTimeout(Y.ready,1);Y.isReady=!0,e!==!0&&--Y.readyWait>0||(B.resolveWith(U,[Y]),Y.fn.trigger&&Y(U).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===Y.type(e)},isArray:Array.isArray||function(e){return"array"===Y.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":dt[V.call(e)]||"object"},isPlainObject:function(e){if(!e||"object"!==Y.type(e)||e.nodeType||Y.isWindow(e))return!1;try{if(e.constructor&&!K.call(e,"constructor")&&!K.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||K.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){var r;return e&&"string"==typeof e?("boolean"==typeof t&&(n=t,t=0),t=t||U,(r=ot.exec(e))?[t.createElement(r[1])]:(r=Y.buildFragment([e],t,n?null:[]),Y.merge([],(r.cacheable?Y.clone(r.fragment):r.fragment).childNodes))):null},parseJSON:function(n){return n&&"string"==typeof n?(n=Y.trim(n),e.JSON&&e.JSON.parse?e.JSON.parse(n):it.test(n.replace(st,"@").replace(lt,"]").replace(at,""))?Function("return "+n)():(Y.error("Invalid JSON: "+n),t)):null},parseXML:function(n){var r,o;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(o=new DOMParser,r=o.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(i){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||Y.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&et.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ct,"ms-").replace(ut,pt)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var o,i=0,a=e.length,s=a===t||Y.isFunction(e);if(r)if(s){for(o in e)if(n.apply(e[o],r)===!1)break}else for(;a>i&&n.apply(e[i++],r)!==!1;);else if(s){for(o in e)if(n.call(e[o],o,e[o])===!1)break}else for(;a>i&&n.call(e[i],i,e[i++])!==!1;);return e},trim:G&&!G.call(" ")?function(e){return null==e?"":G.call(e)}:function(e){return null==e?"":(e+"").replace(nt,"")},makeArray:function(e,t){var n,r=t||[];return null!=e&&(n=Y.type(e),null==e.length||"string"===n||"function"===n||"regexp"===n||Y.isWindow(e)?z.call(r,e):Y.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(X)return X.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,o=e.length,i=0;if("number"==typeof r)for(;r>i;i++)e[o++]=n[i];else for(;n[i]!==t;)e[o++]=n[i++];return e.length=o,e},grep:function(e,t,n){var r,o=[],i=0,a=e.length;for(n=!!n;a>i;i++)r=!!t(e[i],i),n!==r&&o.push(e[i]);return o},map:function(e,n,r){var o,i,a=[],s=0,l=e.length,c=e instanceof Y||l!==t&&"number"==typeof l&&(l>0&&e[0]&&e[l-1]||0===l||Y.isArray(e));if(c)for(;l>s;s++)o=n(e[s],s,r),null!=o&&(a[a.length]=o);else for(i in e)o=n(e[i],i,r),null!=o&&(a[a.length]=o);return a.concat.apply([],a)},guid:1,proxy:function(e,n){var r,o,i;return"string"==typeof n&&(r=e[n],n=e,e=r),Y.isFunction(e)?(o=J.call(arguments,2),i=function(){return e.apply(n,o.concat(J.call(arguments)))},i.guid=e.guid=e.guid||Y.guid++,i):t},access:function(e,n,r,o,i,a,s){var l,c=null==r,u=0,p=e.length;if(r&&"object"==typeof r){for(u in r)Y.access(e,n,u,r[u],1,a,o);i=1}else if(o!==t){if(l=s===t&&Y.isFunction(o),c&&(l?(l=n,n=function(e,t,n){return l.call(Y(e),n)}):(n.call(e,o),n=null)),n)for(;p>u;u++)n(e[u],r,l?o.call(e[u],u,n(e[u],r)):o,s);i=1}return i?e:c?n.call(e):p?n(e[0],r):a},now:function(){return(new Date).getTime()}}),Y.ready.promise=function(t){if(!B)if(B=Y.Deferred(),"complete"===U.readyState)setTimeout(Y.ready,1);else if(U.addEventListener)U.addEventListener("DOMContentLoaded",ft,!1),e.addEventListener("load",Y.ready,!1);else{U.attachEvent("onreadystatechange",ft),e.attachEvent("onload",Y.ready);var n=!1;try{n=null==e.frameElement&&U.documentElement}catch(r){}n&&n.doScroll&&function o(){if(!Y.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}Y.ready()}}()}return B.promise(t)},Y.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){dt["[object "+t+"]"]=t.toLowerCase()}),D=Y(U);var ht={};Y.Callbacks=function(e){e="string"==typeof e?ht[e]||n(e):Y.extend({},e);var r,o,i,a,s,l,c=[],u=!e.once&&[],p=function(t){for(r=e.memory&&t,o=!0,l=a||0,a=0,s=c.length,i=!0;c&&s>l;l++)if(c[l].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}i=!1,c&&(u?u.length&&p(u.shift()):r?c=[]:f.disable())},f={add:function(){if(c){var t=c.length;(function n(t){Y.each(t,function(t,r){var o=Y.type(r);"function"===o?e.unique&&f.has(r)||c.push(r):r&&r.length&&"string"!==o&&n(r)})})(arguments),i?s=c.length:r&&(a=t,p(r))}return this},remove:function(){return c&&Y.each(arguments,function(e,t){for(var n;(n=Y.inArray(t,c,n))>-1;)c.splice(n,1),i&&(s>=n&&s--,l>=n&&l--)}),this},has:function(e){return Y.inArray(e,c)>-1},empty:function(){return c=[],this},disable:function(){return c=u=r=t,this},disabled:function(){return!c},lock:function(){return u=t,r||f.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!c||o&&!u||(i?u.push(t):p(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},Y.extend({Deferred:function(e){var t=[["resolve","done",Y.Callbacks("once memory"),"resolved"],["reject","fail",Y.Callbacks("once memory"),"rejected"],["notify","progress",Y.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return Y.Deferred(function(n){Y.each(t,function(t,r){var i=r[0],a=e[t];o[r[1]](Y.isFunction(a)?function(){var e=a.apply(this,arguments);e&&Y.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[i+"With"](this===o?n:this,[e])}:n[i])}),e=null}).promise()},promise:function(e){return null!=e?Y.extend(e,r):r}},o={};return r.pipe=r.then,Y.each(t,function(e,i){var a=i[2],s=i[3];r[i[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),o[i[0]]=a.fire,o[i[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(e){var t,n,r,o=0,i=J.call(arguments),a=i.length,s=1!==a||e&&Y.isFunction(e.promise)?a:0,l=1===s?e:Y.Deferred(),c=function(e,n,r){return function(o){n[e]=this,r[e]=arguments.length>1?J.call(arguments):o,r===t?l.notifyWith(n,r):--s||l.resolveWith(n,r)}};if(a>1)for(t=Array(a),n=Array(a),r=Array(a);a>o;o++)i[o]&&Y.isFunction(i[o].promise)?i[o].promise().done(c(o,r,i)).fail(l.reject).progress(c(o,n,t)):--s;return s||l.resolveWith(r,i),l.promise()}}),Y.support=function(){var n,r,o,i,a,s,l,c,u,p,f,d=U.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",r=d.getElementsByTagName("*"),o=d.getElementsByTagName("a")[0],!r||!o||!r.length)return{};i=U.createElement("select"),a=i.appendChild(U.createElement("option")),s=d.getElementsByTagName("input")[0],o.style.cssText="top:1px;float:left;opacity:.5",n={leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(o.getAttribute("style")),hrefNormalized:"/a"===o.getAttribute("href"),opacity:/^0.5/.test(o.style.opacity),cssFloat:!!o.style.cssFloat,checkOn:"on"===s.value,optSelected:a.selected,getSetAttribute:"t"!==d.className,enctype:!!U.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==U.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===U.compatMode,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},s.checked=!0,n.noCloneChecked=s.cloneNode(!0).checked,i.disabled=!0,n.optDisabled=!a.disabled;try{delete d.test}catch(h){n.deleteExpando=!1}if(!d.addEventListener&&d.attachEvent&&d.fireEvent&&(d.attachEvent("onclick",f=function(){n.noCloneEvent=!1}),d.cloneNode(!0).fireEvent("onclick"),d.detachEvent("onclick",f)),s=U.createElement("input"),s.value="t",s.setAttribute("type","radio"),n.radioValue="t"===s.value,s.setAttribute("checked","checked"),s.setAttribute("name","t"),d.appendChild(s),l=U.createDocumentFragment(),l.appendChild(d.lastChild),n.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,n.appendChecked=s.checked,l.removeChild(s),l.appendChild(d),d.attachEvent)for(u in{submit:!0,change:!0,focusin:!0})c="on"+u,p=c in d,p||(d.setAttribute(c,"return;"),p="function"==typeof d[c]),n[u+"Bubbles"]=p;return Y(function(){var r,o,i,a,s="padding:0;margin:0;border:0;display:block;overflow:hidden;",l=U.getElementsByTagName("body")[0];l&&(r=U.createElement("div"),r.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",l.insertBefore(r,l.firstChild),o=U.createElement("div"),r.appendChild(o),o.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=o.getElementsByTagName("td"),i[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===i[0].offsetHeight,i[0].style.display="",i[1].style.display="none",n.reliableHiddenOffsets=p&&0===i[0].offsetHeight,o.innerHTML="",o.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",n.boxSizing=4===o.offsetWidth,n.doesNotIncludeMarginInBodyOffset=1!==l.offsetTop,e.getComputedStyle&&(n.pixelPosition="1%"!==(e.getComputedStyle(o,null)||{}).top,n.boxSizingReliable="4px"===(e.getComputedStyle(o,null)||{width:"4px"}).width,a=U.createElement("div"),a.style.cssText=o.style.cssText=s,a.style.marginRight=a.style.width="0",o.style.width="1px",o.appendChild(a),n.reliableMarginRight=!parseFloat((e.getComputedStyle(a,null)||{}).marginRight)),o.style.zoom!==t&&(o.innerHTML="",o.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",n.inlineBlockNeedsLayout=3===o.offsetWidth,o.style.display="block",o.style.overflow="visible",o.innerHTML="<div></div>",o.firstChild.style.width="5px",n.shrinkWrapBlocks=3!==o.offsetWidth,r.style.zoom=1),l.removeChild(r),r=o=i=a=null)}),l.removeChild(d),r=o=i=a=s=l=d=null,n}();var gt=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,mt=/([A-Z])/g;Y.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(Y.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?Y.cache[e[Y.expando]]:e[Y.expando],!!e&&!o(e)},data:function(e,n,r,o){if(Y.acceptData(e)){var i,a,s=Y.expando,l="string"==typeof n,c=e.nodeType,u=c?Y.cache:e,p=c?e[s]:e[s]&&s;if(p&&u[p]&&(o||u[p].data)||!l||r!==t)return p||(c?e[s]=p=Y.deletedIds.pop()||Y.guid++:p=s),u[p]||(u[p]={},c||(u[p].toJSON=Y.noop)),("object"==typeof n||"function"==typeof n)&&(o?u[p]=Y.extend(u[p],n):u[p].data=Y.extend(u[p].data,n)),i=u[p],o||(i.data||(i.data={}),i=i.data),r!==t&&(i[Y.camelCase(n)]=r),l?(a=i[n],null==a&&(a=i[Y.camelCase(n)])):a=i,a}},removeData:function(e,t,n){if(Y.acceptData(e)){var r,i,a,s=e.nodeType,l=s?Y.cache:e,c=s?e[Y.expando]:Y.expando;if(l[c]){if(t&&(r=n?l[c]:l[c].data)){Y.isArray(t)||(t in r?t=[t]:(t=Y.camelCase(t),t=t in r?[t]:t.split(" ")));for(i=0,a=t.length;a>i;i++)delete r[t[i]];if(!(n?o:Y.isEmptyObject)(r))return}(n||(delete l[c].data,o(l[c])))&&(s?Y.cleanData([e],!0):Y.support.deleteExpando||l!=l.window?delete l[c]:l[c]=null)}}},_data:function(e,t,n){return Y.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&Y.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),Y.fn.extend({data:function(e,n){var o,i,a,s,l,c=this[0],u=0,p=null;if(e===t){if(this.length&&(p=Y.data(c),1===c.nodeType&&!Y._data(c,"parsedAttrs"))){for(a=c.attributes,l=a.length;l>u;u++)s=a[u].name,s.indexOf("data-")||(s=Y.camelCase(s.substring(5)),r(c,s,p[s]));Y._data(c,"parsedAttrs",!0)}return p}return"object"==typeof e?this.each(function(){Y.data(this,e)}):(o=e.split(".",2),o[1]=o[1]?"."+o[1]:"",i=o[1]+"!",Y.access(this,function(n){return n===t?(p=this.triggerHandler("getData"+i,[o[0]]),p===t&&c&&(p=Y.data(c,e),p=r(c,e,p)),p===t&&o[1]?this.data(o[0]):p):(o[1]=n,this.each(function(){var t=Y(this);t.triggerHandler("setData"+i,o),Y.data(this,e,n),t.triggerHandler("changeData"+i,o)}),t)},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){Y.removeData(this,e)})}}),Y.extend({queue:function(e,n,r){var o;return e?(n=(n||"fx")+"queue",o=Y._data(e,n),r&&(!o||Y.isArray(r)?o=Y._data(e,n,Y.makeArray(r)):o.push(r)),o||[]):t},dequeue:function(e,t){t=t||"fx";var n=Y.queue(e,t),r=n.length,o=n.shift(),i=Y._queueHooks(e,t),a=function(){Y.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,a,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y._data(e,n)||Y._data(e,n,{empty:Y.Callbacks("once memory").add(function(){Y.removeData(e,t+"queue",!0),Y.removeData(e,n,!0)})})}}),Y.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?Y.queue(this[0],e):n===t?this:this.each(function(){var t=Y.queue(this,e,n);Y._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&Y.dequeue(this,e)})},dequeue:function(e){return this.each(function(){Y.dequeue(this,e)})},delay:function(e,t){return e=Y.fx?Y.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,o=1,i=Y.Deferred(),a=this,s=this.length,l=function(){--o||i.resolveWith(a,[a])};for("string"!=typeof e&&(n=e,e=t),e=e||"fx";s--;)r=Y._data(a[s],e+"queueHooks"),r&&r.empty&&(o++,r.empty.add(l));return l(),i.promise(n)}});var yt,vt,bt,_t=/[\t\r\n]/g,xt=/\r/g,Ct=/^(?:button|input)$/i,wt=/^(?:button|input|object|select|textarea)$/i,At=/^a(?:rea|)$/i,Ft=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,Tt=Y.support.getSetAttribute;Y.fn.extend({attr:function(e,t){return Y.access(this,Y.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){Y.removeAttr(this,e)})},prop:function(e,t){return Y.access(this,Y.prop,e,t,arguments.length>1)},removeProp:function(e){return e=Y.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,o,i,a,s;if(Y.isFunction(e))return this.each(function(t){Y(this).addClass(e.call(this,t,this.className))});if(e&&"string"==typeof e)for(t=e.split(tt),n=0,r=this.length;r>n;n++)if(o=this[n],1===o.nodeType)if(o.className||1!==t.length){for(i=" "+o.className+" ",a=0,s=t.length;s>a;a++)0>i.indexOf(" "+t[a]+" ")&&(i+=t[a]+" ");o.className=Y.trim(i)}else o.className=e;return this},removeClass:function(e){var n,r,o,i,a,s,l;if(Y.isFunction(e))return this.each(function(t){Y(this).removeClass(e.call(this,t,this.className))});if(e&&"string"==typeof e||e===t)for(n=(e||"").split(tt),s=0,l=this.length;l>s;s++)if(o=this[s],1===o.nodeType&&o.className){for(r=(" "+o.className+" ").replace(_t," "),i=0,a=n.length;a>i;i++)for(;r.indexOf(" "+n[i]+" ")>=0;)r=r.replace(" "+n[i]+" "," ");o.className=e?Y.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return Y.isFunction(e)?this.each(function(n){Y(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n)for(var o,i=0,a=Y(this),s=t,l=e.split(tt);o=l[i++];)s=r?s:!a.hasClass(o),a[s?"addClass":"removeClass"](o);else("undefined"===n||"boolean"===n)&&(this.className&&Y._data(this,"__className__",this.className),this.className=this.className||e===!1?"":Y._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(_t," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,o,i=this[0];{if(arguments.length)return o=Y.isFunction(e),this.each(function(r){var i,a=Y(this);1===this.nodeType&&(i=o?e.call(this,r,a.val()):e,null==i?i="":"number"==typeof i?i+="":Y.isArray(i)&&(i=Y.map(i,function(e){return null==e?"":e+""})),n=Y.valHooks[this.type]||Y.valHooks[this.nodeName.toLowerCase()],n&&"set"in n&&n.set(this,i,"value")!==t||(this.value=i))});if(i)return n=Y.valHooks[i.type]||Y.valHooks[i.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(i,"value"))!==t?r:(r=i.value,"string"==typeof r?r.replace(xt,""):null==r?"":r)}}}),Y.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){for(var t,n,r=e.options,o=e.selectedIndex,i="select-one"===e.type||0>o,a=i?null:[],s=i?o+1:r.length,l=0>o?s:i?o:0;s>l;l++)if(n=r[l],!(!n.selected&&l!==o||(Y.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&Y.nodeName(n.parentNode,"optgroup"))){if(t=Y(n).val(),i)return t;a.push(t)}return a},set:function(e,t){var n=Y.makeArray(t);return Y(e).find("option").each(function(){this.selected=Y.inArray(Y(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,o){var i,a,s,l=e.nodeType;if(e&&3!==l&&8!==l&&2!==l)return o&&Y.isFunction(Y.fn[n])?Y(e)[n](r):e.getAttribute===t?Y.prop(e,n,r):(s=1!==l||!Y.isXMLDoc(e),s&&(n=n.toLowerCase(),a=Y.attrHooks[n]||(Ft.test(n)?vt:yt)),r!==t?null===r?(Y.removeAttr(e,n),t):a&&"set"in a&&s&&(i=a.set(e,r,n))!==t?i:(e.setAttribute(n,r+""),r):a&&"get"in a&&s&&null!==(i=a.get(e,n))?i:(i=e.getAttribute(n),null===i?t:i))},removeAttr:function(e,t){var n,r,o,i,a=0;if(t&&1===e.nodeType)for(r=t.split(tt);r.length>a;a++)o=r[a],o&&(n=Y.propFix[o]||o,i=Ft.test(o),i||Y.attr(e,o,""),e.removeAttribute(Tt?o:n),i&&n in e&&(e[n]=!1))},attrHooks:{type:{set:function(e,t){if(Ct.test(e.nodeName)&&e.parentNode)Y.error("type property can't be changed");else if(!Y.support.radioValue&&"radio"===t&&Y.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return yt&&Y.nodeName(e,"button")?yt.get(e,t):t in e?e.value:null},set:function(e,n,r){return yt&&Y.nodeName(e,"button")?yt.set(e,n,r):(e.value=n,t)}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var o,i,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!Y.isXMLDoc(e),a&&(n=Y.propFix[n]||n,i=Y.propHooks[n]),r!==t?i&&"set"in i&&(o=i.set(e,r,n))!==t?o:e[n]=r:i&&"get"in i&&null!==(o=i.get(e,n))?o:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):wt.test(e.nodeName)||At.test(e.nodeName)&&e.href?0:t}}}}),vt={get:function(e,n){var r,o=Y.prop(e,n);return o===!0||"boolean"!=typeof o&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?Y.removeAttr(e,n):(r=Y.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},Tt||(bt={name:!0,id:!0,coords:!0},yt=Y.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(bt[n]?""!==r.value:r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=U.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},Y.each(["width","height"],function(e,n){Y.attrHooks[n]=Y.extend(Y.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})}),Y.attrHooks.contenteditable={get:yt.get,set:function(e,t,n){""===t&&(t="false"),yt.set(e,t,n) }}),Y.support.hrefNormalized||Y.each(["href","src","width","height"],function(e,n){Y.attrHooks[n]=Y.extend(Y.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null===r?t:r}})}),Y.support.style||(Y.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),Y.support.optSelected||(Y.propHooks.selected=Y.extend(Y.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),Y.support.enctype||(Y.propFix.enctype="encoding"),Y.support.checkOn||Y.each(["radio","checkbox"],function(){Y.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),Y.each(["radio","checkbox"],function(){Y.valHooks[this]=Y.extend(Y.valHooks[this],{set:function(e,n){return Y.isArray(n)?e.checked=Y.inArray(Y(e).val(),n)>=0:t}})});var kt=/^(?:textarea|input|select)$/i,Et=/^([^\.]*|)(?:\.(.+)|)$/,Nt=/(?:^|\s)hover(\.\S+|)\b/,St=/^key/,Rt=/^(?:mouse|contextmenu)|click/,jt=/^(?:focusinfocus|focusoutblur)$/,It=function(e){return Y.event.special.hover?e:e.replace(Nt,"mouseenter$1 mouseleave$1")};Y.event={add:function(e,n,r,o,i){var a,s,l,c,u,p,f,d,h,g,m;if(3!==e.nodeType&&8!==e.nodeType&&n&&r&&(a=Y._data(e))){for(r.handler&&(h=r,r=h.handler,i=h.selector),r.guid||(r.guid=Y.guid++),l=a.events,l||(a.events=l={}),s=a.handle,s||(a.handle=s=function(e){return Y===t||e&&Y.event.triggered===e.type?t:Y.event.dispatch.apply(s.elem,arguments)},s.elem=e),n=Y.trim(It(n)).split(" "),c=0;n.length>c;c++)u=Et.exec(n[c])||[],p=u[1],f=(u[2]||"").split(".").sort(),m=Y.event.special[p]||{},p=(i?m.delegateType:m.bindType)||p,m=Y.event.special[p]||{},d=Y.extend({type:p,origType:u[1],data:o,handler:r,guid:r.guid,selector:i,needsContext:i&&Y.expr.match.needsContext.test(i),namespace:f.join(".")},h),g=l[p],g||(g=l[p]=[],g.delegateCount=0,m.setup&&m.setup.call(e,o,f,s)!==!1||(e.addEventListener?e.addEventListener(p,s,!1):e.attachEvent&&e.attachEvent("on"+p,s))),m.add&&(m.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),i?g.splice(g.delegateCount++,0,d):g.push(d),Y.event.global[p]=!0;e=null}},global:{},remove:function(e,t,n,r,o){var i,a,s,l,c,u,p,f,d,h,g,m=Y.hasData(e)&&Y._data(e);if(m&&(f=m.events)){for(t=Y.trim(It(t||"")).split(" "),i=0;t.length>i;i++)if(a=Et.exec(t[i])||[],s=l=a[1],c=a[2],s){for(d=Y.event.special[s]||{},s=(r?d.delegateType:d.bindType)||s,h=f[s]||[],u=h.length,c=c?RegExp("(^|\\.)"+c.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null,p=0;h.length>p;p++)g=h[p],!o&&l!==g.origType||n&&n.guid!==g.guid||c&&!c.test(g.namespace)||r&&r!==g.selector&&("**"!==r||!g.selector)||(h.splice(p--,1),g.selector&&h.delegateCount--,d.remove&&d.remove.call(e,g));0===h.length&&u!==h.length&&(d.teardown&&d.teardown.call(e,c,m.handle)!==!1||Y.removeEvent(e,s,m.handle),delete f[s])}else for(s in f)Y.event.remove(e,s+t[i],n,r,!0);Y.isEmptyObject(f)&&(delete m.handle,Y.removeData(e,"events",!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,o,i){if(!o||3!==o.nodeType&&8!==o.nodeType){var a,s,l,c,u,p,f,d,h,g,m=n.type||n,y=[];if(!jt.test(m+Y.event.triggered)&&(m.indexOf("!")>=0&&(m=m.slice(0,-1),s=!0),m.indexOf(".")>=0&&(y=m.split("."),m=y.shift(),y.sort()),o&&!Y.event.customEvent[m]||Y.event.global[m]))if(n="object"==typeof n?n[Y.expando]?n:new Y.Event(m,n):new Y.Event(m),n.type=m,n.isTrigger=!0,n.exclusive=s,n.namespace=y.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+y.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,p=0>m.indexOf(":")?"on"+m:"",o){if(n.result=t,n.target||(n.target=o),r=null!=r?Y.makeArray(r):[],r.unshift(n),f=Y.event.special[m]||{},!f.trigger||f.trigger.apply(o,r)!==!1){if(h=[[o,f.bindType||m]],!i&&!f.noBubble&&!Y.isWindow(o)){for(g=f.delegateType||m,c=jt.test(g+m)?o:o.parentNode,u=o;c;c=c.parentNode)h.push([c,g]),u=c;u===(o.ownerDocument||U)&&h.push([u.defaultView||u.parentWindow||e,g])}for(l=0;h.length>l&&!n.isPropagationStopped();l++)c=h[l][0],n.type=h[l][1],d=(Y._data(c,"events")||{})[n.type]&&Y._data(c,"handle"),d&&d.apply(c,r),d=p&&c[p],d&&Y.acceptData(c)&&d.apply&&d.apply(c,r)===!1&&n.preventDefault();return n.type=m,i||n.isDefaultPrevented()||f._default&&f._default.apply(o.ownerDocument,r)!==!1||"click"===m&&Y.nodeName(o,"a")||!Y.acceptData(o)||p&&o[m]&&("focus"!==m&&"blur"!==m||0!==n.target.offsetWidth)&&!Y.isWindow(o)&&(u=o[p],u&&(o[p]=null),Y.event.triggered=m,o[m](),Y.event.triggered=t,u&&(o[p]=u)),n.result}}else{a=Y.cache;for(l in a)a[l].events&&a[l].events[m]&&Y.event.trigger(n,r,a[l].handle.elem,!0)}}},dispatch:function(n){n=Y.event.fix(n||e.event);var r,o,i,a,s,l,c,u,p,f=(Y._data(this,"events")||{})[n.type]||[],d=f.delegateCount,h=J.call(arguments),g=!n.exclusive&&!n.namespace,m=Y.event.special[n.type]||{},y=[];if(h[0]=n,n.delegateTarget=this,!m.preDispatch||m.preDispatch.call(this,n)!==!1){if(d&&(!n.button||"click"!==n.type))for(i=n.target;i!=this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==n.type){for(s={},c=[],r=0;d>r;r++)u=f[r],p=u.selector,s[p]===t&&(s[p]=u.needsContext?Y(p,this).index(i)>=0:Y.find(p,this,null,[i]).length),s[p]&&c.push(u);c.length&&y.push({elem:i,matches:c})}for(f.length>d&&y.push({elem:this,matches:f.slice(d)}),r=0;y.length>r&&!n.isPropagationStopped();r++)for(l=y[r],n.currentTarget=l.elem,o=0;l.matches.length>o&&!n.isImmediatePropagationStopped();o++)u=l.matches[o],(g||!n.namespace&&!u.namespace||n.namespace_re&&n.namespace_re.test(u.namespace))&&(n.data=u.data,n.handleObj=u,a=((Y.event.special[u.origType]||{}).handle||u.handler).apply(l.elem,h),a!==t&&(n.result=a,a===!1&&(n.preventDefault(),n.stopPropagation())));return m.postDispatch&&m.postDispatch.call(this,n),n.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,o,i,a=n.button,s=n.fromElement;return null==e.pageX&&null!=n.clientX&&(r=e.target.ownerDocument||U,o=r.documentElement,i=r.body,e.pageX=n.clientX+(o&&o.scrollLeft||i&&i.scrollLeft||0)-(o&&o.clientLeft||i&&i.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||i&&i.scrollTop||0)-(o&&o.clientTop||i&&i.clientTop||0)),!e.relatedTarget&&s&&(e.relatedTarget=s===e.target?n.toElement:s),e.which||a===t||(e.which=1&a?1:2&a?3:4&a?2:0),e}},fix:function(e){if(e[Y.expando])return e;var t,n,r=e,o=Y.event.fixHooks[e.type]||{},i=o.props?this.props.concat(o.props):this.props;for(e=Y.Event(r),t=i.length;t;)n=i[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||U),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,o.filter?o.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){Y.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var o=Y.extend(new Y.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?Y.event.trigger(o,null,t):Y.event.dispatch.call(t,o),o.isDefaultPrevented()&&n.preventDefault()}},Y.event.handle=Y.event.dispatch,Y.removeEvent=U.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,n,r){var o="on"+n;e.detachEvent&&(e[o]===t&&(e[o]=null),e.detachEvent(o,r))},Y.Event=function(e,n){return this instanceof Y.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?a:i):this.type=e,n&&Y.extend(this,n),this.timeStamp=e&&e.timeStamp||Y.now(),this[Y.expando]=!0,t):new Y.Event(e,n)},Y.Event.prototype={preventDefault:function(){this.isDefaultPrevented=a;var e=this.originalEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=a;var e=this.originalEvent;e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=a,this.stopPropagation()},isDefaultPrevented:i,isPropagationStopped:i,isImmediatePropagationStopped:i},Y.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){Y.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,o=e.relatedTarget,i=e.handleObj;return i.selector,(!o||o!==r&&!Y.contains(r,o))&&(e.type=i.origType,n=i.handler.apply(this,arguments),e.type=t),n}}}),Y.support.submitBubbles||(Y.event.special.submit={setup:function(){return Y.nodeName(this,"form")?!1:(Y.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=Y.nodeName(n,"input")||Y.nodeName(n,"button")?n.form:t;r&&!Y._data(r,"_submit_attached")&&(Y.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),Y._data(r,"_submit_attached",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&Y.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return Y.nodeName(this,"form")?!1:(Y.event.remove(this,"._submit"),t)}}),Y.support.changeBubbles||(Y.event.special.change={setup:function(){return kt.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(Y.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),Y.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),Y.event.simulate("change",this,e,!0)})),!1):(Y.event.add(this,"beforeactivate._change",function(e){var t=e.target;kt.test(t.nodeName)&&!Y._data(t,"_change_attached")&&(Y.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||Y.event.simulate("change",this.parentNode,e,!0)}),Y._data(t,"_change_attached",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return Y.event.remove(this,"._change"),!kt.test(this.nodeName)}}),Y.support.focusinBubbles||Y.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){Y.event.simulate(t,e.target,Y.event.fix(e),!0)};Y.event.special[t]={setup:function(){0===n++&&U.addEventListener(e,r,!0)},teardown:function(){0===--n&&U.removeEventListener(e,r,!0)}}}),Y.fn.extend({on:function(e,n,r,o,a){var s,l;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(l in e)this.on(l,n,r,e[l],a);return this}if(null==r&&null==o?(o=n,r=n=t):null==o&&("string"==typeof n?(o=r,r=t):(o=r,r=n,n=t)),o===!1)o=i;else if(!o)return this;return 1===a&&(s=o,o=function(e){return Y().off(e),s.apply(this,arguments)},o.guid=s.guid||(s.guid=Y.guid++)),this.each(function(){Y.event.add(this,e,o,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var o,a;if(e&&e.preventDefault&&e.handleObj)return o=e.handleObj,Y(e.delegateTarget).off(o.namespace?o.origType+"."+o.namespace:o.origType,o.selector,o.handler),this;if("object"==typeof e){for(a in e)this.off(a,n,e[a]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=i),this.each(function(){Y.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return Y(this.context).on(e,this.selector,t,n),this},die:function(e,t){return Y(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){Y.event.trigger(e,t,this)})},triggerHandler:function(e,n){return this[0]?Y.event.trigger(e,n,this[0],!0):t},toggle:function(e){var t=arguments,n=e.guid||Y.guid++,r=0,o=function(n){var o=(Y._data(this,"lastToggle"+e.guid)||0)%r;return Y._data(this,"lastToggle"+e.guid,o+1),n.preventDefault(),t[o].apply(this,arguments)||!1};for(o.guid=n;t.length>r;)t[r++].guid=n;return this.click(o)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),Y.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){Y.fn[t]=function(e,n){return null==n&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},St.test(t)&&(Y.event.fixHooks[t]=Y.event.keyHooks),Rt.test(t)&&(Y.event.fixHooks[t]=Y.event.mouseHooks)}),/*! * Sizzle CSS Selector Engine * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://sizzlejs.com/ */ function(e,t){function n(e,t,n,r){n=n||[],t=t||R;var o,i,a,s,l=t.nodeType;if(!e||"string"!=typeof e)return n;if(1!==l&&9!==l)return[];if(a=x(t),!a&&!r&&(o=nt.exec(e)))if(s=o[1]){if(9===l){if(i=t.getElementById(s),!i||!i.parentNode)return n;if(i.id===s)return n.push(i),n}else if(t.ownerDocument&&(i=t.ownerDocument.getElementById(s))&&C(t,i)&&i.id===s)return n.push(i),n}else{if(o[2])return M.apply(n,H.call(t.getElementsByTagName(e),0)),n;if((s=o[3])&&ft&&t.getElementsByClassName)return M.apply(n,H.call(t.getElementsByClassName(s),0)),n}return g(e.replace(G,"$1"),t,n,r,a)}function r(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function o(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function i(e){return D(function(t){return t=+t,D(function(n,r){for(var o,i=e([],n.length,t),a=i.length;a--;)n[o=i[a]]&&(n[o]=!(r[o]=n[o]))})})}function a(e,t,n){if(e===t)return n;for(var r=e.nextSibling;r;){if(r===t)return-1;r=r.nextSibling}return 1}function s(e,t){var r,o,i,a,s,l,c,u=Q[N][e+" "];if(u)return t?0:u.slice(0);for(s=e,l=[],c=b.preFilter;s;){(!r||(o=Z.exec(s)))&&(o&&(s=s.slice(o[0].length)||s),l.push(i=[])),r=!1,(o=et.exec(s))&&(i.push(r=new S(o.shift())),s=s.slice(r.length),r.type=o[0].replace(G," "));for(a in b.filter)!(o=st[a].exec(s))||c[a]&&!(o=c[a](o))||(i.push(r=new S(o.shift())),s=s.slice(r.length),r.type=a,r.matches=o);if(!r)break}return t?s.length:s?n.error(e):Q(e,l).slice(0)}function l(e,t,n){var r=t.dir,o=n&&"parentNode"===t.dir,i=O++;return t.first?function(t,n,i){for(;t=t[r];)if(o||1===t.nodeType)return e(t,n,i)}:function(t,n,a){if(a){for(;t=t[r];)if((o||1===t.nodeType)&&e(t,n,a))return t}else for(var s,l=I+" "+i+" ",c=l+y;t=t[r];)if(o||1===t.nodeType){if((s=t[N])===c)return t.sizset;if("string"==typeof s&&0===s.indexOf(l)){if(t.sizset)return t}else{if(t[N]=c,e(t,n,a))return t.sizset=!0,t;t.sizset=!1}}}}function c(e){return e.length>1?function(t,n,r){for(var o=e.length;o--;)if(!e[o](t,n,r))return!1;return!0}:e[0]}function u(e,t,n,r,o){for(var i,a=[],s=0,l=e.length,c=null!=t;l>s;s++)(i=e[s])&&(!n||n(i,r,o))&&(a.push(i),c&&t.push(s));return a}function p(e,t,n,r,o,i){return r&&!r[N]&&(r=p(r)),o&&!o[N]&&(o=p(o,i)),D(function(i,a,s,l){var c,p,f,d=[],g=[],m=a.length,y=i||h(t||"*",s.nodeType?[s]:s,[]),v=!e||!i&&t?y:u(y,d,e,s,l),b=n?o||(i?e:m||r)?[]:a:v;if(n&&n(v,b,s,l),r)for(c=u(b,g),r(c,[],s,l),p=c.length;p--;)(f=c[p])&&(b[g[p]]=!(v[g[p]]=f));if(i){if(o||e){if(o){for(c=[],p=b.length;p--;)(f=b[p])&&c.push(v[p]=f);o(null,b=[],c,l)}for(p=b.length;p--;)(f=b[p])&&(c=o?L.call(i,f):d[p])>-1&&(i[c]=!(a[c]=f))}}else b=u(b===a?b.splice(m,b.length):b),o?o(null,a,b,l):M.apply(a,b)})}function f(e){for(var t,n,r,o=e.length,i=b.relative[e[0].type],a=i||b.relative[" "],s=i?1:0,u=l(function(e){return e===t},a,!0),d=l(function(e){return L.call(t,e)>-1},a,!0),h=[function(e,n,r){return!i&&(r||n!==T)||((t=n).nodeType?u(e,n,r):d(e,n,r))}];o>s;s++)if(n=b.relative[e[s].type])h=[l(c(h),n)];else{if(n=b.filter[e[s].type].apply(null,e[s].matches),n[N]){for(r=++s;o>r&&!b.relative[e[r].type];r++);return p(s>1&&c(h),s>1&&e.slice(0,s-1).join("").replace(G,"$1"),n,r>s&&f(e.slice(s,r)),o>r&&f(e=e.slice(r)),o>r&&e.join(""))}h.push(n)}return c(h)}function d(e,t){var r=t.length>0,o=e.length>0,i=function(a,s,l,c,p){var f,d,h,g=[],m=0,v="0",_=a&&[],x=null!=p,C=T,w=a||o&&b.find.TAG("*",p&&s.parentNode||s),A=I+=null==C?1:Math.E;for(x&&(T=s!==R&&s,y=i.el);null!=(f=w[v]);v++){if(o&&f){for(d=0;h=e[d];d++)if(h(f,s,l)){c.push(f);break}x&&(I=A,y=++i.el)}r&&((f=!h&&f)&&m--,a&&_.push(f))}if(m+=v,r&&v!==m){for(d=0;h=t[d];d++)h(_,g,s,l);if(a){if(m>0)for(;v--;)_[v]||g[v]||(g[v]=P.call(c));g=u(g)}M.apply(c,g),x&&!a&&g.length>0&&m+t.length>1&&n.uniqueSort(c)}return x&&(I=A,T=C),_};return i.el=0,r?D(i):i}function h(e,t,r){for(var o=0,i=t.length;i>o;o++)n(e,t[o],r);return r}function g(e,t,n,r,o){var i,a,l,c,u,p=s(e);if(p.length,!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(l=a[0]).type&&9===t.nodeType&&!o&&b.relative[a[1].type]){if(t=b.find.ID(l.matches[0].replace(at,""),t,o)[0],!t)return n;e=e.slice(a.shift().length)}for(i=st.POS.test(e)?-1:a.length-1;i>=0&&(l=a[i],!b.relative[c=l.type]);i--)if((u=b.find[c])&&(r=u(l.matches[0].replace(at,""),rt.test(a[0].type)&&t.parentNode||t,o))){if(a.splice(i,1),e=r.length&&a.join(""),!e)return M.apply(n,H.call(r,0)),n;break}}return w(e,p)(r,t,o,n,rt.test(e)),n}function m(){}var y,v,b,_,x,C,w,A,F,T,k=!0,E="undefined",N=("sizcache"+Math.random()).replace(".",""),S=String,R=e.document,j=R.documentElement,I=0,O=0,P=[].pop,M=[].push,H=[].slice,L=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1},D=function(e,t){return e[N]=null==t||t,e},B=function(){var e={},t=[];return D(function(n,r){return t.push(n)>b.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},U=B(),Q=B(),q=B(),W="[\\x20\\t\\r\\n\\f]",$="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",z=$.replace("w","w#"),J="([*^$|!~]?=)",X="\\["+W+"*("+$+")"+W+"*(?:"+J+W+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+z+")|)|)"+W+"*\\]",V=":("+$+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+X+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+W+"*((?:-\\d)?\\d*)"+W+"*\\)|)(?=[^-]|$)",G=RegExp("^"+W+"+|((?:^|[^\\\\])(?:\\\\.)*)"+W+"+$","g"),Z=RegExp("^"+W+"*,"+W+"*"),et=RegExp("^"+W+"*([\\x20\\t\\r\\n\\f>+~])"+W+"*"),tt=RegExp(V),nt=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,rt=/[\x20\t\r\n\f]*[+~]/,ot=/h\d/i,it=/input|select|textarea|button/i,at=/\\(?!\\)/g,st={ID:RegExp("^#("+$+")"),CLASS:RegExp("^\\.("+$+")"),NAME:RegExp("^\\[name=['\"]?("+$+")['\"]?\\]"),TAG:RegExp("^("+$.replace("w","w*")+")"),ATTR:RegExp("^"+X),PSEUDO:RegExp("^"+V),POS:RegExp(K,"i"),CHILD:RegExp("^:(only|nth|first|last)-child(?:\\("+W+"*(even|odd|(([+-]|)(\\d*)n|)"+W+"*(?:([+-]|)"+W+"*(\\d+)|))"+W+"*\\)|)","i"),needsContext:RegExp("^"+W+"*[>+~]|"+K,"i")},lt=function(e){var t=R.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},ct=lt(function(e){return e.appendChild(R.createComment("")),!e.getElementsByTagName("*").length}),ut=lt(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==E&&"#"===e.firstChild.getAttribute("href")}),pt=lt(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),ft=lt(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),dt=lt(function(e){e.id=N+0,e.innerHTML="<a name='"+N+"'></a><div name='"+N+"'></div>",j.insertBefore(e,j.firstChild);var t=R.getElementsByName&&R.getElementsByName(N).length===2+R.getElementsByName(N+0).length;return v=!R.getElementById(N),j.removeChild(e),t});try{H.call(j.childNodes,0)[0].nodeType}catch(ht){H=function(e){for(var t,n=[];t=this[e];e++)n.push(t);return n}}n.matches=function(e,t){return n(e,null,null,t)},n.matchesSelector=function(e,t){return n(t,null,null,[e]).length>0},_=n.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=_(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r];r++)n+=_(t);return n},x=n.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},C=n.contains=j.contains?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&1===r.nodeType&&n.contains&&n.contains(r))}:j.compareDocumentPosition?function(e,t){return t&&!!(16&e.compareDocumentPosition(t))}:function(e,t){for(;t=t.parentNode;)if(t===e)return!0;return!1},n.attr=function(e,t){var n,r=x(e);return r||(t=t.toLowerCase()),(n=b.attrHandle[t])?n(e):r||pt?e.getAttribute(t):(n=e.getAttributeNode(t),n?"boolean"==typeof e[t]?e[t]?t:null:n.specified?n.value:null:null)},b=n.selectors={cacheLength:50,createPseudo:D,match:st,attrHandle:ut?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:v?function(e,t,n){if(typeof t.getElementById!==E&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==E&&!r){var o=n.getElementById(e);return o?o.id===e||typeof o.getAttributeNode!==E&&o.getAttributeNode("id").value===e?[o]:t:[]}},TAG:ct?function(e,n){return typeof n.getElementsByTagName!==E?n.getElementsByTagName(e):t}:function(e,t){var n=t.getElementsByTagName(e);if("*"===e){for(var r,o=[],i=0;r=n[i];i++)1===r.nodeType&&o.push(r);return o}return n},NAME:dt&&function(e,n){return typeof n.getElementsByName!==E?n.getElementsByName(name):t},CLASS:ft&&function(e,n,r){return typeof n.getElementsByClassName===E||r?t:n.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(at,""),e[3]=(e[4]||e[5]||"").replace(at,""),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1]?(e[2]||n.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*("even"===e[2]||"odd"===e[2])),e[4]=+(e[6]+e[7]||"odd"===e[2])):e[2]&&n.error(e[0]),e},PSEUDO:function(e){var t,n;return st.CHILD.test(e[0])?null:(e[3]?e[2]=e[3]:(t=e[4])&&(tt.test(t)&&(n=s(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t),e.slice(0,3))}},filter:{ID:v?function(e){return e=e.replace(at,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace(at,""),function(t){var n=typeof t.getAttributeNode!==E&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(at,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=U[N][e+" "];return t||(t=RegExp("(^|"+W+")"+e+"("+W+"|$)"))&&U(e,function(e){return t.test(e.className||typeof e.getAttribute!==E&&e.getAttribute("class")||"")})},ATTR:function(e,t,r){return function(o){var i=n.attr(o,e);return null==i?"!="===t:t?(i+="","="===t?i===r:"!="===t?i!==r:"^="===t?r&&0===i.indexOf(r):"*="===t?r&&i.indexOf(r)>-1:"$="===t?r&&i.substr(i.length-r.length)===r:"~="===t?(" "+i+" ").indexOf(r)>-1:"|="===t?i===r||i.substr(0,r.length+1)===r+"-":!1):!0}},CHILD:function(e,t,n,r){return"nth"===e?function(e){var t,o,i=e.parentNode;if(1===n&&0===r)return!0;if(i)for(o=0,t=i.firstChild;t&&(1!==t.nodeType||(o++,e!==t));t=t.nextSibling);return o-=r,o===n||0===o%n&&o/n>=0}:function(t){var n=t;switch(e){case"only":case"first":for(;n=n.previousSibling;)if(1===n.nodeType)return!1;if("first"===e)return!0;n=t;case"last":for(;n=n.nextSibling;)if(1===n.nodeType)return!1;return!0}}},PSEUDO:function(e,t){var r,o=b.pseudos[e]||b.setFilters[e.toLowerCase()]||n.error("unsupported pseudo: "+e);return o[N]?o(t):o.length>1?(r=[e,e,"",t],b.setFilters.hasOwnProperty(e.toLowerCase())?D(function(e,n){for(var r,i=o(e,t),a=i.length;a--;)r=L.call(e,i[a]),e[r]=!(n[r]=i[a])}):function(e){return o(e,0,r)}):o}},pseudos:{not:D(function(e){var t=[],n=[],r=w(e.replace(G,"$1"));return r[N]?D(function(e,t,n,o){for(var i,a=r(e,null,o,[]),s=e.length;s--;)(i=a[s])&&(e[s]=!(t[s]=i))}):function(e,o,i){return t[0]=e,r(t,null,i,n),!n.pop()}}),has:D(function(e){return function(t){return n(e,t).length>0}}),contains:D(function(e){return function(t){return(t.textContent||t.innerText||_(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!b.pseudos.empty(e)},empty:function(e){var t;for(e=e.firstChild;e;){if(e.nodeName>"@"||3===(t=e.nodeType)||4===t)return!1;e=e.nextSibling}return!0},header:function(e){return ot.test(e.nodeName)},text:function(e){var t,n;return"input"===e.nodeName.toLowerCase()&&"text"===(t=e.type)&&(null==(n=e.getAttribute("type"))||n.toLowerCase()===t)},radio:r("radio"),checkbox:r("checkbox"),file:r("file"),password:r("password"),image:r("image"),submit:o("submit"),reset:o("reset"),button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},input:function(e){return it.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:i(function(){return[0]}),last:i(function(e,t){return[t-1]}),eq:i(function(e,t,n){return[0>n?n+t:n]}),even:i(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:i(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:i(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:i(function(e,t,n){for(var r=0>n?n+t:n;t>++r;)e.push(r);return e})}},A=j.compareDocumentPosition?function(e,t){return e===t?(F=!0,0):(e.compareDocumentPosition&&t.compareDocumentPosition?4&e.compareDocumentPosition(t):e.compareDocumentPosition)?-1:1}:function(e,t){if(e===t)return F=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,o=[],i=[],s=e.parentNode,l=t.parentNode,c=s;if(s===l)return a(e,t);if(!s)return-1;if(!l)return 1;for(;c;)o.unshift(c),c=c.parentNode;for(c=l;c;)i.unshift(c),c=c.parentNode;n=o.length,r=i.length;for(var u=0;n>u&&r>u;u++)if(o[u]!==i[u])return a(o[u],i[u]);return u===n?a(e,i[u],-1):a(o[u],t,1)},[0,0].sort(A),k=!F,n.uniqueSort=function(e){var t,n=[],r=1,o=0;if(F=k,e.sort(A),F){for(;t=e[r];r++)t===e[r-1]&&(o=n.push(r));for(;o--;)e.splice(n[o],1)}return e},n.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},w=n.compile=function(e,t){var n,r=[],o=[],i=q[N][e+" "];if(!i){for(t||(t=s(e)),n=t.length;n--;)i=f(t[n]),i[N]?r.push(i):o.push(i);i=q(e,d(o,r))}return i},R.querySelectorAll&&function(){var e,t=g,r=/'|\\/g,o=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],a=[":active"],l=j.matchesSelector||j.mozMatchesSelector||j.webkitMatchesSelector||j.oMatchesSelector||j.msMatchesSelector;lt(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+W+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),lt(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+W+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=RegExp(i.join("|")),g=function(e,n,o,a,l){if(!a&&!l&&!i.test(e)){var c,u,p=!0,f=N,d=n,h=9===n.nodeType&&e;if(1===n.nodeType&&"object"!==n.nodeName.toLowerCase()){for(c=s(e),(p=n.getAttribute("id"))?f=p.replace(r,"\\$&"):n.setAttribute("id",f),f="[id='"+f+"'] ",u=c.length;u--;)c[u]=f+c[u].join("");d=rt.test(e)&&n.parentNode||n,h=c.join(",")}if(h)try{return M.apply(o,H.call(d.querySelectorAll(h),0)),o}catch(g){}finally{p||n.removeAttribute("id")}}return t(e,n,o,a,l)},l&&(lt(function(t){e=l.call(t,"div");try{l.call(t,"[test!='']:sizzle"),a.push("!=",V)}catch(n){}}),a=RegExp(a.join("|")),n.matchesSelector=function(t,r){if(r=r.replace(o,"='$1']"),!x(t)&&!a.test(r)&&!i.test(r))try{var s=l.call(t,r);if(s||e||t.document&&11!==t.document.nodeType)return s}catch(c){}return n(r,null,null,[t]).length>0})}(),b.pseudos.nth=b.pseudos.eq,b.filters=m.prototype=b.pseudos,b.setFilters=new m,n.attr=Y.attr,Y.find=n,Y.expr=n.selectors,Y.expr[":"]=Y.expr.pseudos,Y.unique=n.uniqueSort,Y.text=n.getText,Y.isXMLDoc=n.isXML,Y.contains=n.contains}(e);var Ot=/Until$/,Pt=/^(?:parents|prev(?:Until|All))/,Mt=/^.[^:#\[\.,]*$/,Ht=Y.expr.match.needsContext,Lt={children:!0,contents:!0,next:!0,prev:!0};Y.fn.extend({find:function(e){var t,n,r,o,i,a,s=this;if("string"!=typeof e)return Y(e).filter(function(){for(t=0,n=s.length;n>t;t++)if(Y.contains(s[t],this))return!0});for(a=this.pushStack("","find",e),t=0,n=this.length;n>t;t++)if(r=a.length,Y.find(e,this[t],a),t>0)for(o=r;a.length>o;o++)for(i=0;r>i;i++)if(a[i]===a[o]){a.splice(o--,1);break}return a},has:function(e){var t,n=Y(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(Y.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(c(this,e,!1),"not",e)},filter:function(e){return this.pushStack(c(this,e,!0),"filter",e)},is:function(e){return!!e&&("string"==typeof e?Ht.test(e)?Y(e,this.context).index(this[0])>=0:Y.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){for(var n,r=0,o=this.length,i=[],a=Ht.test(e)||"string"!=typeof e?Y(e,t||this.context):0;o>r;r++)for(n=this[r];n&&n.ownerDocument&&n!==t&&11!==n.nodeType;){if(a?a.index(n)>-1:Y.find.matchesSelector(n,e)){i.push(n);break}n=n.parentNode}return i=i.length>1?Y.unique(i):i,this.pushStack(i,"closest",e)},index:function(e){return e?"string"==typeof e?Y.inArray(this[0],Y(e)):Y.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n="string"==typeof e?Y(e,t):Y.makeArray(e&&e.nodeType?[e]:e),r=Y.merge(this.get(),n);return this.pushStack(s(n[0])||s(r[0])?r:Y.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),Y.fn.andSelf=Y.fn.addBack,Y.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Y.dir(e,"parentNode")},parentsUntil:function(e,t,n){return Y.dir(e,"parentNode",n)},next:function(e){return l(e,"nextSibling")},prev:function(e){return l(e,"previousSibling")},nextAll:function(e){return Y.dir(e,"nextSibling")},prevAll:function(e){return Y.dir(e,"previousSibling")},nextUntil:function(e,t,n){return Y.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return Y.dir(e,"previousSibling",n)},siblings:function(e){return Y.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return Y.sibling(e.firstChild)},contents:function(e){return Y.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:Y.merge([],e.childNodes)}},function(e,t){Y.fn[e]=function(n,r){var o=Y.map(this,t,n);return Ot.test(e)||(r=n),r&&"string"==typeof r&&(o=Y.filter(r,o)),o=this.length>1&&!Lt[e]?Y.unique(o):o,this.length>1&&Pt.test(e)&&(o=o.reverse()),this.pushStack(o,e,J.call(arguments).join(","))}}),Y.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?Y.find.matchesSelector(t[0],e)?[t[0]]:[]:Y.find.matches(e,t)},dir:function(e,n,r){for(var o=[],i=e[n];i&&9!==i.nodeType&&(r===t||1!==i.nodeType||!Y(i).is(r));)1===i.nodeType&&o.push(i),i=i[n];return o},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var Dt="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Bt=/ jQuery\d+="(?:null|\d+)"/g,Ut=/^\s+/,Qt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,qt=/<([\w:]+)/,Wt=/<tbody/i,$t=/<|&#?\w+;/,zt=/<(?:script|style|link)/i,Jt=/<(?:script|object|embed|option|style)/i,Xt=RegExp("<(?:"+Dt+")[\\s/>]","i"),Vt=/^(?:checkbox|radio)$/,Kt=/checked\s*(?:[^=]|=\s*.checked.)/i,Gt=/\/(java|ecma)script/i,Yt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Zt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},en=u(U),tn=en.appendChild(U.createElement("div"));Zt.optgroup=Zt.option,Zt.tbody=Zt.tfoot=Zt.colgroup=Zt.caption=Zt.thead,Zt.th=Zt.td,Y.support.htmlSerialize||(Zt._default=[1,"X<div>","</div>"]),Y.fn.extend({text:function(e){return Y.access(this,function(e){return e===t?Y.text(this):this.empty().append((this[0]&&this[0].ownerDocument||U).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(Y.isFunction(e))return this.each(function(t){Y(this).wrapAll(e.call(this,t))});if(this[0]){var t=Y(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return Y.isFunction(e)?this.each(function(t){Y(this).wrapInner(e.call(this,t))}):this.each(function(){var t=Y(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=Y.isFunction(e);return this.each(function(n){Y(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){Y.nodeName(this,"body")||Y(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!s(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=Y.clean(arguments);return this.pushStack(Y.merge(e,this),"before",this.selector)}},after:function(){if(!s(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=Y.clean(arguments);return this.pushStack(Y.merge(this,e),"after",this.selector)}},remove:function(e,t){for(var n,r=0;null!=(n=this[r]);r++)(!e||Y.filter(e,[n]).length)&&(t||1!==n.nodeType||(Y.cleanData(n.getElementsByTagName("*")),Y.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)for(1===e.nodeType&&Y.cleanData(e.getElementsByTagName("*"));e.firstChild;)e.removeChild(e.firstChild);return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return Y.clone(this,e,t)})},html:function(e){return Y.access(this,function(e){var n=this[0]||{},r=0,o=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(Bt,""):t;if(!("string"!=typeof e||zt.test(e)||!Y.support.htmlSerialize&&Xt.test(e)||!Y.support.leadingWhitespace&&Ut.test(e)||Zt[(qt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(Qt,"<$1></$2>");try{for(;o>r;r++)n=this[r]||{},1===n.nodeType&&(Y.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(i){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return s(this[0])?this.length?this.pushStack(Y(Y.isFunction(e)?e():e),"replaceWith",e):this:Y.isFunction(e)?this.each(function(t){var n=Y(this),r=n.html();n.replaceWith(e.call(this,t,r))}):("string"!=typeof e&&(e=Y(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;Y(this).remove(),t?Y(t).before(e):Y(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var o,i,a,s,l=0,c=e[0],u=[],f=this.length;if(!Y.support.checkClone&&f>1&&"string"==typeof c&&Kt.test(c))return this.each(function(){Y(this).domManip(e,n,r)});if(Y.isFunction(c))return this.each(function(o){var i=Y(this);e[0]=c.call(this,o,n?i.html():t),i.domManip(e,n,r)});if(this[0]){if(o=Y.buildFragment(e,this,u),a=o.fragment,i=a.firstChild,1===a.childNodes.length&&(a=i),i)for(n=n&&Y.nodeName(i,"tr"),s=o.cacheable||f-1;f>l;l++)r.call(n&&Y.nodeName(this[l],"table")?p(this[l],"tbody"):this[l],l===s?a:Y.clone(a,!0,!0));a=i=null,u.length&&Y.each(u,function(e,t){t.src?Y.ajax?Y.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):Y.error("no ajax"):Y.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Yt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),Y.buildFragment=function(e,n,r){var o,i,a,s=e[0];return n=n||U,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,!(1===e.length&&"string"==typeof s&&512>s.length&&n===U&&"<"===s.charAt(0))||Jt.test(s)||!Y.support.checkClone&&Kt.test(s)||!Y.support.html5Clone&&Xt.test(s)||(i=!0,o=Y.fragments[s],a=o!==t),o||(o=n.createDocumentFragment(),Y.clean(e,n,o,r),i&&(Y.fragments[s]=a&&o)),{fragment:o,cacheable:i}},Y.fragments={},Y.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){Y.fn[e]=function(n){var r,o=0,i=[],a=Y(n),s=a.length,l=1===this.length&&this[0].parentNode;if((null==l||l&&11===l.nodeType&&1===l.childNodes.length)&&1===s)return a[t](this[0]),this;for(;s>o;o++)r=(o>0?this.clone(!0):this).get(),Y(a[o])[t](r),i=i.concat(r);return this.pushStack(i,e,a.selector)}}),Y.extend({clone:function(e,t,n){var r,o,i,a;if(Y.support.html5Clone||Y.isXMLDoc(e)||!Xt.test("<"+e.nodeName+">")?a=e.cloneNode(!0):(tn.innerHTML=e.outerHTML,tn.removeChild(a=tn.firstChild)),!(Y.support.noCloneEvent&&Y.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||Y.isXMLDoc(e)))for(d(e,a),r=h(e),o=h(a),i=0;r[i];++i)o[i]&&d(r[i],o[i]);if(t&&(f(e,a),n))for(r=h(e),o=h(a),i=0;r[i];++i)f(r[i],o[i]);return r=o=null,a},clean:function(e,n,r,o){var i,a,s,l,c,p,f,d,h,m,y,v=n===U&&en,b=[];for(n&&n.createDocumentFragment!==t||(n=U),i=0;null!=(s=e[i]);i++)if("number"==typeof s&&(s+=""),s){if("string"==typeof s)if($t.test(s)){for(v=v||u(n),f=n.createElement("div"),v.appendChild(f),s=s.replace(Qt,"<$1></$2>"),l=(qt.exec(s)||["",""])[1].toLowerCase(),c=Zt[l]||Zt._default,p=c[0],f.innerHTML=c[1]+s+c[2];p--;)f=f.lastChild;if(!Y.support.tbody)for(d=Wt.test(s),h="table"!==l||d?"<table>"!==c[1]||d?[]:f.childNodes:f.firstChild&&f.firstChild.childNodes,a=h.length-1;a>=0;--a)Y.nodeName(h[a],"tbody")&&!h[a].childNodes.length&&h[a].parentNode.removeChild(h[a]);!Y.support.leadingWhitespace&&Ut.test(s)&&f.insertBefore(n.createTextNode(Ut.exec(s)[0]),f.firstChild),s=f.childNodes,f.parentNode.removeChild(f)}else s=n.createTextNode(s);s.nodeType?b.push(s):Y.merge(b,s)}if(f&&(s=f=v=null),!Y.support.appendChecked)for(i=0;null!=(s=b[i]);i++)Y.nodeName(s,"input")?g(s):s.getElementsByTagName!==t&&Y.grep(s.getElementsByTagName("input"),g);if(r)for(m=function(e){return!e.type||Gt.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):r.appendChild(e):t},i=0;null!=(s=b[i]);i++)Y.nodeName(s,"script")&&m(s)||(r.appendChild(s),s.getElementsByTagName!==t&&(y=Y.grep(Y.merge([],s.getElementsByTagName("script")),m),b.splice.apply(b,[i+1,0].concat(y)),i+=y.length));return b},cleanData:function(e,t){for(var n,r,o,i,a=0,s=Y.expando,l=Y.cache,c=Y.support.deleteExpando,u=Y.event.special;null!=(o=e[a]);a++)if((t||Y.acceptData(o))&&(r=o[s],n=r&&l[r])){if(n.events)for(i in n.events)u[i]?Y.event.remove(o,i):Y.removeEvent(o,i,n.handle);l[r]&&(delete l[r],c?delete o[s]:o.removeAttribute?o.removeAttribute(s):o[s]=null,Y.deletedIds.push(r))}}}),function(){var e,t;Y.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=Y.uaMatch(q.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),Y.browser=t,Y.sub=function(){function e(t,n){return new e.fn.init(t,n)}Y.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(n,r){return r&&r instanceof Y&&!(r instanceof e)&&(r=e(r)),Y.fn.init.call(this,n,r,t)},e.fn.init.prototype=e.fn;var t=e(U);return e}}();var nn,rn,on,an=/alpha\([^)]*\)/i,sn=/opacity=([^)]*)/,ln=/^(top|right|bottom|left)$/,cn=/^(none|table(?!-c[ea]).+)/,un=/^margin/,pn=RegExp("^("+Z+")(.*)$","i"),fn=RegExp("^("+Z+")(?!px)[a-z%]+$","i"),dn=RegExp("^([-+])=("+Z+")","i"),hn={BODY:"block"},gn={position:"absolute",visibility:"hidden",display:"block"},mn={letterSpacing:0,fontWeight:400},yn=["Top","Right","Bottom","Left"],vn=["Webkit","O","Moz","ms"],bn=Y.fn.toggle;Y.fn.extend({css:function(e,n){return Y.access(this,function(e,n,r){return r!==t?Y.style(e,n,r):Y.css(e,n)},e,n,arguments.length>1)},show:function(){return v(this,!0)},hide:function(){return v(this)},toggle:function(e,t){var n="boolean"==typeof e;return Y.isFunction(e)&&Y.isFunction(t)?bn.apply(this,arguments):this.each(function(){(n?e:y(this))?Y(this).show():Y(this).hide()})}}),Y.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=nn(e,"opacity");return""===n?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":Y.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,o){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,a,s,l=Y.camelCase(n),c=e.style;if(n=Y.cssProps[l]||(Y.cssProps[l]=m(c,l)),s=Y.cssHooks[n]||Y.cssHooks[l],r===t)return s&&"get"in s&&(i=s.get(e,!1,o))!==t?i:c[n];if(a=typeof r,"string"===a&&(i=dn.exec(r))&&(r=(i[1]+1)*i[2]+parseFloat(Y.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||Y.cssNumber[l]||(r+="px"),s&&"set"in s&&(r=s.set(e,r,o))===t)))try{c[n]=r}catch(u){}}},css:function(e,n,r,o){var i,a,s,l=Y.camelCase(n);return n=Y.cssProps[l]||(Y.cssProps[l]=m(e.style,l)),s=Y.cssHooks[n]||Y.cssHooks[l],s&&"get"in s&&(i=s.get(e,!0,o)),i===t&&(i=nn(e,n)),"normal"===i&&n in mn&&(i=mn[n]),r||o!==t?(a=parseFloat(i),r||Y.isNumeric(a)?a||0:i):i},swap:function(e,t,n){var r,o,i={};for(o in t)i[o]=e.style[o],e.style[o]=t[o];r=n.call(e);for(o in t)e.style[o]=i[o];return r}}),e.getComputedStyle?nn=function(t,n){var r,o,i,a,s=e.getComputedStyle(t,null),l=t.style;return s&&(r=s.getPropertyValue(n)||s[n],""!==r||Y.contains(t.ownerDocument,t)||(r=Y.style(t,n)),fn.test(r)&&un.test(n)&&(o=l.width,i=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=r,r=s.width,l.width=o,l.minWidth=i,l.maxWidth=a)),r}:U.documentElement.currentStyle&&(nn=function(e,t){var n,r,o=e.currentStyle&&e.currentStyle[t],i=e.style;return null==o&&i&&i[t]&&(o=i[t]),fn.test(o)&&!ln.test(t)&&(n=i.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),i.left="fontSize"===t?"1em":o,o=i.pixelLeft+"px",i.left=n,r&&(e.runtimeStyle.left=r)),""===o?"auto":o}),Y.each(["height","width"],function(e,n){Y.cssHooks[n]={get:function(e,r,o){return r?0===e.offsetWidth&&cn.test(nn(e,"display"))?Y.swap(e,gn,function(){return x(e,n,o)}):x(e,n,o):t},set:function(e,t,r){return b(e,t,r?_(e,n,r,Y.support.boxSizing&&"border-box"===Y.css(e,"boxSizing")):0)}}}),Y.support.opacity||(Y.cssHooks.opacity={get:function(e,t){return sn.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,o=Y.isNumeric(t)?"alpha(opacity="+100*t+")":"",i=r&&r.filter||n.filter||"";n.zoom=1,t>=1&&""===Y.trim(i.replace(an,""))&&n.removeAttribute&&(n.removeAttribute("filter"),r&&!r.filter)||(n.filter=an.test(i)?i.replace(an,o):i+" "+o)}}),Y(function(){Y.support.reliableMarginRight||(Y.cssHooks.marginRight={get:function(e,n){return Y.swap(e,{display:"inline-block"},function(){return n?nn(e,"marginRight"):t})}}),!Y.support.pixelPosition&&Y.fn.position&&Y.each(["top","left"],function(e,t){Y.cssHooks[t]={get:function(e,n){if(n){var r=nn(e,t);return fn.test(r)?Y(e).position()[t]+"px":r}}}})}),Y.expr&&Y.expr.filters&&(Y.expr.filters.hidden=function(e){return 0===e.offsetWidth&&0===e.offsetHeight||!Y.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||nn(e,"display"))},Y.expr.filters.visible=function(e){return!Y.expr.filters.hidden(e)}),Y.each({margin:"",padding:"",border:"Width"},function(e,t){Y.cssHooks[e+t]={expand:function(n){var r,o="string"==typeof n?n.split(" "):[n],i={};for(r=0;4>r;r++)i[e+yn[r]+t]=o[r]||o[r-2]||o[0];return i}},un.test(e)||(Y.cssHooks[e+t].set=b)});var _n=/%20/g,xn=/\[\]$/,Cn=/\r?\n/g,wn=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,An=/^(?:select|textarea)/i; Y.fn.extend({serialize:function(){return Y.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?Y.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||An.test(this.nodeName)||wn.test(this.type))}).map(function(e,t){var n=Y(this).val();return null==n?null:Y.isArray(n)?Y.map(n,function(e){return{name:t.name,value:e.replace(Cn,"\r\n")}}):{name:t.name,value:n.replace(Cn,"\r\n")}}).get()}}),Y.param=function(e,n){var r,o=[],i=function(e,t){t=Y.isFunction(t)?t():null==t?"":t,o[o.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=Y.ajaxSettings&&Y.ajaxSettings.traditional),Y.isArray(e)||e.jquery&&!Y.isPlainObject(e))Y.each(e,function(){i(this.name,this.value)});else for(r in e)w(r,e[r],n,i);return o.join("&").replace(_n,"+")};var Fn,Tn,kn=/#.*$/,En=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Sn=/^(?:GET|HEAD)$/,Rn=/^\/\//,jn=/\?/,In=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,On=/([?&])_=[^&]*/,Pn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Mn=Y.fn.load,Hn={},Ln={},Dn=["*/"]+["*"];try{Tn=Q.href}catch(Bn){Tn=U.createElement("a"),Tn.href="",Tn=Tn.href}Fn=Pn.exec(Tn.toLowerCase())||[],Y.fn.load=function(e,n,r){if("string"!=typeof e&&Mn)return Mn.apply(this,arguments);if(!this.length)return this;var o,i,a,s=this,l=e.indexOf(" ");return l>=0&&(o=e.slice(l,e.length),e=e.slice(0,l)),Y.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(i="POST"),Y.ajax({url:e,type:i,dataType:"html",data:n,complete:function(e,t){r&&s.each(r,a||[e.responseText,t,e])}}).done(function(e){a=arguments,s.html(o?Y("<div>").append(e.replace(In,"")).find(o):e)}),this},Y.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){Y.fn[t]=function(e){return this.on(t,e)}}),Y.each(["get","post"],function(e,n){Y[n]=function(e,r,o,i){return Y.isFunction(r)&&(i=i||o,o=r,r=t),Y.ajax({type:n,url:e,data:r,success:o,dataType:i})}}),Y.extend({getScript:function(e,n){return Y.get(e,t,n,"script")},getJSON:function(e,t,n){return Y.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?T(e,Y.ajaxSettings):(t=e,e=Y.ajaxSettings),T(e,t),e},ajaxSettings:{url:Tn,isLocal:Nn.test(Fn[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Dn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":Y.parseJSON,"text xml":Y.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:A(Hn),ajaxTransport:A(Ln),ajax:function(e,n){function r(e,n,r,a){var c,p,v,b,x,w=n;2!==_&&(_=2,l&&clearTimeout(l),s=t,i=a||"",C.readyState=e>0?4:0,r&&(b=k(f,C,r)),e>=200&&300>e||304===e?(f.ifModified&&(x=C.getResponseHeader("Last-Modified"),x&&(Y.lastModified[o]=x),x=C.getResponseHeader("Etag"),x&&(Y.etag[o]=x)),304===e?(w="notmodified",c=!0):(c=E(f,b),w=c.state,p=c.data,v=c.error,c=!v)):(v=w,(!w||e)&&(w="error",0>e&&(e=0))),C.status=e,C.statusText=(n||w)+"",c?g.resolveWith(d,[p,w,C]):g.rejectWith(d,[C,w,v]),C.statusCode(y),y=t,u&&h.trigger("ajax"+(c?"Success":"Error"),[C,f,c?p:v]),m.fireWith(d,[C,w]),u&&(h.trigger("ajaxComplete",[C,f]),--Y.active||Y.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=t),n=n||{};var o,i,a,s,l,c,u,p,f=Y.ajaxSetup({},n),d=f.context||f,h=d!==f&&(d.nodeType||d instanceof Y)?Y(d):Y.event,g=Y.Deferred(),m=Y.Callbacks("once memory"),y=f.statusCode||{},v={},b={},_=0,x="canceled",C={readyState:0,setRequestHeader:function(e,t){if(!_){var n=e.toLowerCase();e=b[n]=b[n]||e,v[e]=t}return this},getAllResponseHeaders:function(){return 2===_?i:null},getResponseHeader:function(e){var n;if(2===_){if(!a)for(a={};n=En.exec(i);)a[n[1].toLowerCase()]=n[2];n=a[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return _||(f.mimeType=e),this},abort:function(e){return e=e||x,s&&s.abort(e),r(0,e),this}};if(g.promise(C),C.success=C.done,C.error=C.fail,C.complete=m.add,C.statusCode=function(e){if(e){var t;if(2>_)for(t in e)y[t]=[y[t],e[t]];else t=e[C.status],C.always(t)}return this},f.url=((e||f.url)+"").replace(kn,"").replace(Rn,Fn[1]+"//"),f.dataTypes=Y.trim(f.dataType||"*").toLowerCase().split(tt),null==f.crossDomain&&(c=Pn.exec(f.url.toLowerCase()),f.crossDomain=!(!c||c[1]===Fn[1]&&c[2]===Fn[2]&&(c[3]||("http:"===c[1]?80:443))==(Fn[3]||("http:"===Fn[1]?80:443)))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=Y.param(f.data,f.traditional)),F(Hn,f,n,C),2===_)return C;if(u=f.global,f.type=f.type.toUpperCase(),f.hasContent=!Sn.test(f.type),u&&0===Y.active++&&Y.event.trigger("ajaxStart"),!f.hasContent&&(f.data&&(f.url+=(jn.test(f.url)?"&":"?")+f.data,delete f.data),o=f.url,f.cache===!1)){var w=Y.now(),A=f.url.replace(On,"$1_="+w);f.url=A+(A===f.url?(jn.test(f.url)?"&":"?")+"_="+w:"")}(f.data&&f.hasContent&&f.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",f.contentType),f.ifModified&&(o=o||f.url,Y.lastModified[o]&&C.setRequestHeader("If-Modified-Since",Y.lastModified[o]),Y.etag[o]&&C.setRequestHeader("If-None-Match",Y.etag[o])),C.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Dn+"; q=0.01":""):f.accepts["*"]);for(p in f.headers)C.setRequestHeader(p,f.headers[p]);if(f.beforeSend&&(f.beforeSend.call(d,C,f)===!1||2===_))return C.abort();x="abort";for(p in{success:1,error:1,complete:1})C[p](f[p]);if(s=F(Ln,f,n,C)){C.readyState=1,u&&h.trigger("ajaxSend",[C,f]),f.async&&f.timeout>0&&(l=setTimeout(function(){C.abort("timeout")},f.timeout));try{_=1,s.send(v,r)}catch(T){if(!(2>_))throw T;r(-1,T)}}else r(-1,"No Transport");return C},active:0,lastModified:{},etag:{}});var Un=[],Qn=/\?/,qn=/(=)\?(?=&|$)|\?\?/,Wn=Y.now();Y.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Un.pop()||Y.expando+"_"+Wn++;return this[e]=!0,e}}),Y.ajaxPrefilter("json jsonp",function(n,r,o){var i,a,s,l=n.data,c=n.url,u=n.jsonp!==!1,p=u&&qn.test(c),f=u&&!p&&"string"==typeof l&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&qn.test(l);return"jsonp"===n.dataTypes[0]||p||f?(i=n.jsonpCallback=Y.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,a=e[i],p?n.url=c.replace(qn,"$1"+i):f?n.data=l.replace(qn,"$1"+i):u&&(n.url+=(Qn.test(c)?"&":"?")+n.jsonp+"="+i),n.converters["script json"]=function(){return s||Y.error(i+" was not called"),s[0]},n.dataTypes[0]="json",e[i]=function(){s=arguments},o.always(function(){e[i]=a,n[i]&&(n.jsonpCallback=r.jsonpCallback,Un.push(i)),s&&Y.isFunction(a)&&a(s[0]),s=a=t}),"script"):t}),Y.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return Y.globalEval(e),e}}}),Y.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),Y.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=U.head||U.getElementsByTagName("head")[0]||U.documentElement;return{send:function(o,i){n=U.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,o){(o||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,o||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var $n,zn=e.ActiveXObject?function(){for(var e in $n)$n[e](0,1)}:!1,Jn=0;Y.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&N()||S()}:N,function(e){Y.extend(Y.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(Y.ajaxSettings.xhr()),Y.support.ajax&&Y.ajaxTransport(function(n){if(!n.crossDomain||Y.support.cors){var r;return{send:function(o,i){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");try{for(s in o)l.setRequestHeader(s,o[s])}catch(c){}l.send(n.hasContent&&n.data||null),r=function(e,o){var s,c,u,p,f;try{if(r&&(o||4===l.readyState))if(r=t,a&&(l.onreadystatechange=Y.noop,zn&&delete $n[a]),o)4!==l.readyState&&l.abort();else{s=l.status,u=l.getAllResponseHeaders(),p={},f=l.responseXML,f&&f.documentElement&&(p.xml=f);try{p.text=l.responseText}catch(d){}try{c=l.statusText}catch(d){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(h){o||i(-1,h)}p&&i(s,c,p,u)},n.async?4===l.readyState?setTimeout(r,0):(a=++Jn,zn&&($n||($n={},Y(e).unload(zn)),$n[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var Xn,Vn,Kn=/^(?:toggle|show|hide)$/,Gn=RegExp("^(?:([-+])=|)("+Z+")([a-z%]*)$","i"),Yn=/queueHooks$/,Zn=[P],er={"*":[function(e,t){var n,r,o=this.createTween(e,t),i=Gn.exec(t),a=o.cur(),s=+a||0,l=1,c=20;if(i){if(n=+i[2],r=i[3]||(Y.cssNumber[e]?"":"px"),"px"!==r&&s){s=Y.css(o.elem,e,!0)||n||1;do l=l||".5",s/=l,Y.style(o.elem,e,s+r);while(l!==(l=o.cur()/a)&&1!==l&&--c)}o.unit=r,o.start=s,o.end=i[1]?s+(i[1]+1)*n:n}return o}]};Y.Animation=Y.extend(I,{tweener:function(e,t){Y.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,o=e.length;o>r;r++)n=e[r],er[n]=er[n]||[],er[n].unshift(t)},prefilter:function(e,t){t?Zn.unshift(e):Zn.push(e)}}),Y.Tween=M,M.prototype={constructor:M,init:function(e,t,n,r,o,i){this.elem=e,this.prop=n,this.easing=o||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=i||(Y.cssNumber[n]?"":"px")},cur:function(){var e=M.propHooks[this.prop];return e&&e.get?e.get(this):M.propHooks._default.get(this)},run:function(e){var t,n=M.propHooks[this.prop];return this.pos=t=this.options.duration?Y.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):M.propHooks._default.set(this),this}},M.prototype.init.prototype=M.prototype,M.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=Y.css(e.elem,e.prop,!1,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){Y.fx.step[e.prop]?Y.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[Y.cssProps[e.prop]]||Y.cssHooks[e.prop])?Y.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},M.propHooks.scrollTop=M.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},Y.each(["toggle","show","hide"],function(e,t){var n=Y.fn[t];Y.fn[t]=function(r,o,i){return null==r||"boolean"==typeof r||!e&&Y.isFunction(r)&&Y.isFunction(o)?n.apply(this,arguments):this.animate(H(t,!0),r,o,i)}}),Y.fn.extend({fadeTo:function(e,t,n,r){return this.filter(y).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var o=Y.isEmptyObject(e),i=Y.speed(t,n,r),a=function(){var t=I(this,Y.extend({},e),i);o&&t.stop(!0)};return o||i.queue===!1?this.each(a):this.queue(i.queue,a)},stop:function(e,n,r){var o=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",i=Y.timers,a=Y._data(this);if(n)a[n]&&a[n].stop&&o(a[n]);else for(n in a)a[n]&&a[n].stop&&Yn.test(n)&&o(a[n]);for(n=i.length;n--;)i[n].elem!==this||null!=e&&i[n].queue!==e||(i[n].anim.stop(r),t=!1,i.splice(n,1));(t||!r)&&Y.dequeue(this,e)})}}),Y.each({slideDown:H("show"),slideUp:H("hide"),slideToggle:H("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){Y.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),Y.speed=function(e,t,n){var r=e&&"object"==typeof e?Y.extend({},e):{complete:n||!n&&t||Y.isFunction(e)&&e,duration:e,easing:n&&t||t&&!Y.isFunction(t)&&t};return r.duration=Y.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in Y.fx.speeds?Y.fx.speeds[r.duration]:Y.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){Y.isFunction(r.old)&&r.old.call(this),r.queue&&Y.dequeue(this,r.queue)},r},Y.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},Y.timers=[],Y.fx=M.prototype.init,Y.fx.tick=function(){var e,n=Y.timers,r=0;for(Xn=Y.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||Y.fx.stop(),Xn=t},Y.fx.timer=function(e){e()&&Y.timers.push(e)&&!Vn&&(Vn=setInterval(Y.fx.tick,Y.fx.interval))},Y.fx.interval=13,Y.fx.stop=function(){clearInterval(Vn),Vn=null},Y.fx.speeds={slow:600,fast:200,_default:400},Y.fx.step={},Y.expr&&Y.expr.filters&&(Y.expr.filters.animated=function(e){return Y.grep(Y.timers,function(t){return e===t.elem}).length});var tr=/^(?:body|html)$/i;Y.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){Y.offset.setOffset(this,e,t)});var n,r,o,i,a,s,l,c={top:0,left:0},u=this[0],p=u&&u.ownerDocument;if(p)return(r=p.body)===u?Y.offset.bodyOffset(u):(n=p.documentElement,Y.contains(n,u)?(u.getBoundingClientRect!==t&&(c=u.getBoundingClientRect()),o=L(p),i=n.clientTop||r.clientTop||0,a=n.clientLeft||r.clientLeft||0,s=o.pageYOffset||n.scrollTop,l=o.pageXOffset||n.scrollLeft,{top:c.top+s-i,left:c.left+l-a}):c)},Y.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return Y.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(Y.css(e,"marginTop"))||0,n+=parseFloat(Y.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=Y.css(e,"position");"static"===r&&(e.style.position="relative");var o,i,a=Y(e),s=a.offset(),l=Y.css(e,"top"),c=Y.css(e,"left"),u=("absolute"===r||"fixed"===r)&&Y.inArray("auto",[l,c])>-1,p={},f={};u?(f=a.position(),o=f.top,i=f.left):(o=parseFloat(l)||0,i=parseFloat(c)||0),Y.isFunction(t)&&(t=t.call(e,n,s)),null!=t.top&&(p.top=t.top-s.top+o),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):a.css(p)}},Y.fn.extend({position:function(){if(this[0]){var e=this[0],t=this.offsetParent(),n=this.offset(),r=tr.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(Y.css(e,"marginTop"))||0,n.left-=parseFloat(Y.css(e,"marginLeft"))||0,r.top+=parseFloat(Y.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(Y.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||U.body;e&&!tr.test(e.nodeName)&&"static"===Y.css(e,"position");)e=e.offsetParent;return e||U.body})}}),Y.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);Y.fn[e]=function(o){return Y.access(this,function(e,o,i){var a=L(e);return i===t?a?n in a?a[n]:a.document.documentElement[o]:e[o]:(a?a.scrollTo(r?Y(a).scrollLeft():i,r?i:Y(a).scrollTop()):e[o]=i,t)},e,o,arguments.length,null)}}),Y.each({Height:"height",Width:"width"},function(e,n){Y.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,o){Y.fn[o]=function(o,i){var a=arguments.length&&(r||"boolean"!=typeof o),s=r||(o===!0||i===!0?"margin":"border");return Y.access(this,function(n,r,o){var i;return Y.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(i=n.documentElement,Math.max(n.body["scroll"+e],i["scroll"+e],n.body["offset"+e],i["offset"+e],i["client"+e])):o===t?Y.css(n,r,o,s):Y.style(n,r,o,s)},n,a?o:t,a,null)}})}),e.jQuery=e.$=Y,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return Y})}(window),/*! ========================================================= * bootstrap-modal.js v2.2.2 * http://twitter.github.com/bootstrap/javascript.html#modals * ========================================================= * Twitter, Inc. require the following notice to accompany Bootstrap: * * Copyright (c) 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work * except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing permissions and limitations under the License. * * ========================================================= */ !function(e){"use strict";var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n),this.isShown||n.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.backdrop(function(){var n=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1),t.enforceFocus(),n?t.$element.one(e.support.transition.end,function(){t.$element.focus().trigger("shown")}):t.$element.focus().trigger("shown")}))},hide:function(t){t&&t.preventDefault(),t=e.Event("hide"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),e(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),e.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())},enforceFocus:function(){var t=this;e(document).on("focusin.modal",function(e){t.$element[0]===e.target||t.$element.has(e.target).length||t.$element.focus()})},escape:function(){var e=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(t){27==t.which&&e.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),t.hideModal()},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),t.hideModal()})},hideModal:function(){this.$element.hide().trigger("hidden"),this.backdrop()},removeBackdrop:function(){this.$backdrop.remove(),this.$backdrop=null},backdrop:function(t){var n=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var r=e.support.transition&&n;this.$backdrop=e('<div class="modal-backdrop '+n+'" />').appendTo(document.body),this.$backdrop.click("static"==this.options.backdrop?e.proxy(this.$element[0].focus,this.$element[0]):e.proxy(this.hide,this)),r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),r?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,e.proxy(this.removeBackdrop,this)):this.removeBackdrop()):t&&t()}};var n=e.fn.modal;e.fn.modal=function(n){return this.each(function(){var r=e(this),o=r.data("modal"),i=e.extend({},e.fn.modal.defaults,r.data(),"object"==typeof n&&n);o||r.data("modal",o=new t(this,i)),"string"==typeof n?o[n]():i.show&&o.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r=n.attr("href"),o=e(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),i=o.data("modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},o.data(),n.data());t.preventDefault(),o.modal(i).one("hide",function(){n.focus()})})}(window.jQuery);/*! * This file creates $ and jQuery variables within the F2 closure scope */ var $,jQuery=$=window.jQuery.noConflict(!0);/*! * Hij1nx requires the following notice to accompany EventEmitter: * * Copyright (c) 2011 hij1nx * * http://www.twitter.com/hij1nx * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the 'Software'), to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ !function(e){function t(){this._events={}}function n(e){e&&(e.delimiter&&(this.delimiter=e.delimiter),e.wildcard&&(this.wildcard=e.wildcard),this.wildcard&&(this.listenerTree={}))}function r(e){this._events={},n.call(this,e)}function o(e,t,n,r){if(!n)return[];var i,a,s,l,c,u,p,f=[],d=t.length,h=t[r],g=t[r+1];if(r===d&&n._listeners){if("function"==typeof n._listeners)return e&&e.push(n._listeners),[n];for(i=0,a=n._listeners.length;a>i;i++)e&&e.push(n._listeners[i]);return[n]}if("*"===h||"**"===h||n[h]){if("*"===h){for(s in n)"_listeners"!==s&&n.hasOwnProperty(s)&&(f=f.concat(o(e,t,n[s],r+1)));return f}if("**"===h){p=r+1===d||r+2===d&&"*"===g,p&&n._listeners&&(f=f.concat(o(e,t,n,d)));for(s in n)"_listeners"!==s&&n.hasOwnProperty(s)&&("*"===s||"**"===s?(n[s]._listeners&&!p&&(f=f.concat(o(e,t,n[s],d))),f=f.concat(o(e,t,n[s],r))):f=s===g?f.concat(o(e,t,n[s],r+2)):f.concat(o(e,t,n[s],r)));return f}f=f.concat(o(e,t,n[h],r+1))}if(l=n["*"],l&&o(e,t,l,r+1),c=n["**"])if(d>r){c._listeners&&o(e,t,c,d);for(s in c)"_listeners"!==s&&c.hasOwnProperty(s)&&(s===g?o(e,t,c[s],r+2):s===h?o(e,t,c[s],r+1):(u={},u[s]=c[s],o(e,t,{"**":u},r+1)))}else c._listeners?o(e,t,c,d):c["*"]&&c["*"]._listeners&&o(e,t,c["*"],d);return f}function i(e,t){e="string"==typeof e?e.split(this.delimiter):e.slice();for(var n=0,r=e.length;r>n+1;n++)if("**"===e[n]&&"**"===e[n+1])return;for(var o=this.listenerTree,i=e.shift();i;){if(o[i]||(o[i]={}),o=o[i],0===e.length){if(o._listeners){if("function"==typeof o._listeners)o._listeners=[o._listeners,t];else if(a(o._listeners)&&(o._listeners.push(t),!o._listeners.warned)){var l=s;this._events.maxListeners!==undefined&&(l=this._events.maxListeners),l>0&&o._listeners.length>l&&(o._listeners.warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",o._listeners.length),console.trace())}}else o._listeners=t;return!0}i=e.shift()}return!0}var a=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=10;r.prototype.delimiter=".",r.prototype.setMaxListeners=function(e){this._events||t.call(this),this._events.maxListeners=e},r.prototype.event="",r.prototype.once=function(e,t){return this.many(e,1,t),this},r.prototype.many=function(e,t,n){function r(){0===--t&&o.off(e,r),n.apply(this,arguments)}var o=this;if("function"!=typeof n)throw Error("many only accepts instances of Function");return r._origin=n,this.on(e,r),o},r.prototype.emit=function(){this._events||t.call(this);var e=arguments[0];if("newListener"===e&&!this._events.newListener)return!1;if(this._all){for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(i=0,n=this._all.length;n>i;i++)this.event=e,this._all[i].apply(this,r)}if("error"===e&&!(this._all||this._events.error||this.wildcard&&this.listenerTree.error))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");var a;if(this.wildcard){a=[];var s="string"==typeof e?e.split(this.delimiter):e.slice();o.call(this,a,s,this.listenerTree,0)}else a=this._events[e];if("function"==typeof a){if(this.event=e,1===arguments.length)a.call(this);else if(arguments.length>1)switch(arguments.length){case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];a.apply(this,r)}return!0}if(a){for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(var l=a.slice(),i=0,n=l.length;n>i;i++)this.event=e,l[i].apply(this,r);return l.length>0||this._all}return this._all},r.prototype.on=function(e,n){if("function"==typeof e)return this.onAny(e),this;if("function"!=typeof n)throw Error("on only accepts instances of Function");if(this._events||t.call(this),this.emit("newListener",e,n),this.wildcard)return i.call(this,e,n),this;if(this._events[e]){if("function"==typeof this._events[e])this._events[e]=[this._events[e],n];else if(a(this._events[e])&&(this._events[e].push(n),!this._events[e].warned)){var r=s;this._events.maxListeners!==undefined&&(r=this._events.maxListeners),r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),console.trace())}}else this._events[e]=n;return this},r.prototype.onAny=function(e){if(this._all||(this._all=[]),"function"!=typeof e)throw Error("onAny only accepts instances of Function");return this._all.push(e),this},r.prototype.addListener=r.prototype.on,r.prototype.off=function(e,t){if("function"!=typeof t)throw Error("removeListener only takes instances of Function");var n,r=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();r=o.call(this,null,i,this.listenerTree,0)}else{if(!this._events[e])return this;n=this._events[e],r.push({_listeners:n})}for(var s=0;r.length>s;s++){var l=r[s];if(n=l._listeners,a(n)){for(var c=-1,u=0,p=n.length;p>u;u++)if(n[u]===t||n[u].listener&&n[u].listener===t||n[u]._origin&&n[u]._origin===t){c=u;break}if(0>c)return this;this.wildcard?l._listeners.splice(c,1):this._events[e].splice(c,1),0===n.length&&(this.wildcard?delete l._listeners:delete this._events[e])}else(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete l._listeners:delete this._events[e])}return this},r.prototype.offAny=function(e){var t,n=0,r=0;if(e&&this._all&&this._all.length>0){for(t=this._all,n=0,r=t.length;r>n;n++)if(e===t[n])return t.splice(n,1),this}else this._all=[];return this},r.prototype.removeListener=r.prototype.off,r.prototype.removeAllListeners=function(e){if(0===arguments.length)return!this._events||t.call(this),this;if(this.wildcard)for(var n="string"==typeof e?e.split(this.delimiter):e.slice(),r=o.call(this,null,n,this.listenerTree,0),i=0;r.length>i;i++){var a=r[i];a._listeners=null}else{if(!this._events[e])return this;this._events[e]=null}return this},r.prototype.listeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return o.call(this,n,r,this.listenerTree,0),n}return this._events||t.call(this),this._events[e]||(this._events[e]=[]),a(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},r.prototype.listenersAny=function(){return this._all?this._all:[]},e.EventEmitter2=r}("undefined"!=typeof process&&process.title!==void 0&&exports!==void 0?exports:window);/*! * F2 v1.3.2 11-18-2013 * Copyright (c) 2013 Markit On Demand, Inc. http://www.openf2.org * * "F2" is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific * language governing permissions and limitations under the License. * * Please note that F2 ("Software") may contain third party material that Markit * On Demand Inc. has a license to use and include within the Software (the * "Third Party Material"). A list of the software comprising the Third Party Material * and the terms and conditions under which such Third Party Material is distributed * are reproduced in the ThirdPartyMaterial.md file available at: * * https://github.com/OpenF2/F2/blob/master/ThirdPartyMaterial.md * * The inclusion of the Third Party Material in the Software does not grant, provide * nor result in you having acquiring any rights whatsoever, other than as stipulated * in the terms and conditions related to the specific Third Party Material, if any. * */ var F2;F2=function(){var e=function(e,n){function r(e){var t=[];return e.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?t.pop():t.push(e)}),t.join("").replace(/^\//,"/"===e.charAt(0)?"/":"")}return n=t(n||""),e=t(e||""),n&&e?(n.protocol||e.protocol)+(n.protocol||n.authority?n.authority:e.authority)+r(n.protocol||n.authority||"/"===n.pathname.charAt(0)?n.pathname:n.pathname?(e.authority&&!e.pathname?"/":"")+e.pathname.slice(0,e.pathname.lastIndexOf("/")+1)+n.pathname:e.pathname)+(n.protocol||n.authority||n.pathname?n.search:n.search||e.search)+n.hash:null},t=function(e){var t=(e+"").replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return t?{href:t[0]||"",protocol:t[1]||"",authority:t[2]||"",host:t[3]||"",hostname:t[4]||"",port:t[5]||"",pathname:t[6]||"",search:t[7]||"",hash:t[8]||""}:null};return{appConfigReplacer:function(e,t){return"root"==e||"ui"==e||"height"==e?void 0:t},Apps:{},extend:function(e,t,n){var r="function"==typeof t,o=e?e.split("."):[],i=this;t=t||{},"F2"===o[0]&&(o=o.slice(1));for(var a=0,s=o.length;s>a;a++)i[o[a]]||(i[o[a]]=r&&a+1==s?t:{}),i=i[o[a]];if(!r)for(var l in t)(i[l]===void 0||n)&&(i[l]=t[l]);return i},guid:function(){var e=function(){return(0|65536*(1+Math.random())).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},inArray:function(e,t){return jQuery.inArray(e,t)>-1},isLocalRequest:function(t){var n,r,o=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,i=t.toLowerCase(),a=o.exec(i);try{n=location.href}catch(s){n=document.createElement("a"),n.href="",n=n.href}n=n.toLowerCase(),a||(i=e(n,i).toLowerCase(),a=o.exec(i)),r=o.exec(n)||[];var l=!(a&&(a[1]!==r[1]||a[2]!==r[2]||(a[3]||("http:"===a[1]?"80":"443"))!==(r[3]||("http:"===r[1]?"80":"443"))));return l},isNativeDOMNode:function(e){var t="object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName,n="object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&1===e.nodeType&&"string"==typeof e.nodeName;return t||n},log:function(){for(var e,t,n,r="log",o=function(){},i=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],a=i.length,s=window.console=window.console||{};a--;)t=i[a],s[t]||(s[t]=o),arguments&&arguments.length>1&&arguments[0]==t&&(r=t,n=Array.prototype.slice.call(arguments,1));e=Function.prototype.bind?Function.prototype.bind.call(s[r],s):function(){Function.prototype.apply.call(s[r],s,n||arguments)},e.apply(this,n||arguments)},parse:function(e){return JSON.parse(e)},stringify:function(e,t,n){return JSON.stringify(e,t,n)},version:function(){return"1.3.2"}}}(),F2.extend("AppHandlers",function(){var e=F2.guid(),t=F2.guid(),n={appCreateRoot:[],appRenderBefore:[],appDestroyBefore:[],appRenderAfter:[],appDestroyAfter:[],appRender:[],appDestroy:[],appScriptLoadFailed:[]},r={appRender:function(e,t){var n=null;F2.isNativeDOMNode(e.root)?(n=jQuery(e.root),n.append(t)):(e.root=jQuery(t).get(0),n=jQuery(e.root)),jQuery("body").append(n)},appDestroy:function(e){e&&e.app&&e.app.destroy&&"function"==typeof e.app.destroy?e.app.destroy():e&&e.app&&e.app.destroy&&F2.log(e.config.appId+" has a destroy property, but destroy is not of type function and as such will not be executed."),jQuery(e.config.root).fadeOut(500,function(){jQuery(this).remove()})}},o=function(e,t,n,r){i(e);var o={func:n,namespace:t,domNode:F2.isNativeDOMNode(n)?n:null};if(!o.func&&!o.domNode)throw"Invalid or null argument passed. Handler will not be added to collection. A valid dom element or callback function is required.";if(o.domNode&&!r)throw"Invalid argument passed. Handler will not be added to collection. A callback function is required for this event type.";return o},i=function(n){if(e!=n&&t!=n)throw"Invalid token passed. Please verify that you have correctly received and stored token from F2.AppHandlers.getToken()."},a=function(e,t,r){if(i(e),r||t)if(!r&&t)n[t]=[];else if(r&&!t){r=r.toLowerCase();for(var o in n){for(var a=n[o],s=[],l=0,c=a.length;c>l;l++){var u=a[l];u&&(u.namespace&&u.namespace.toLowerCase()==r||s.push(u))}a=s}}else if(r&&n[t]){r=r.toLowerCase();for(var p=[],f=0,d=n[t].length;d>f;f++){var h=n[t][f];h&&(h.namespace&&h.namespace.toLowerCase()==r||p.push(h))}n[t]=p}};return{getToken:function(){return delete this.getToken,e},__f2GetToken:function(){return delete this.__f2GetToken,t},__trigger:function(e,o){if(e!=t)throw"Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().";if(!n||!n[o])throw"Invalid EventKey passed. Check your inputs and try again.";for(var i=[],a=2,s=arguments.length;s>a;a++)i.push(arguments[a]);if(0===n[o].length&&r[o])return r[o].apply(F2,i),this;if(0===n[o].length&&!n[o])return this;for(var l=0,c=n[o].length;c>l;l++){var u=n[o][l];if(u.domNode&&arguments[2]&&arguments[2].root&&arguments[3]){var p=jQuery(arguments[2].root).append(arguments[3]);jQuery(u.domNode).append(p)}else u.domNode&&arguments[2]&&!arguments[2].root&&arguments[3]?(arguments[2].root=jQuery(arguments[3]).get(0),jQuery(u.domNode).append(arguments[2].root)):u.func.apply(F2,i)}return this},on:function(e,t,r){var i=null;if(!t)throw"eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.";if(t.indexOf(".")>-1){var a=t.split(".");t=a[0],i=a[1]}if(!n||!n[t])throw"Invalid EventKey passed. Check your inputs and try again.";return n[t].push(o(e,i,r,"appRender"==t)),this},off:function(e,t){var r=null;if(!t)throw"eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.";if(t.indexOf(".")>-1){var o=t.split(".");t=o[0],r=o[1]}if(!n||!n[t])throw"Invalid EventKey passed. Check your inputs and try again.";return a(e,t,r),this}}}()),F2.extend("Constants",{AppHandlers:function(){return{APP_CREATE_ROOT:"appCreateRoot",APP_RENDER_BEFORE:"appRenderBefore",APP_RENDER:"appRender",APP_RENDER_AFTER:"appRenderAfter",APP_DESTROY_BEFORE:"appDestroyBefore",APP_DESTROY:"appDestroy",APP_DESTROY_AFTER:"appDestroyAfter",APP_SCRIPT_LOAD_FAILED:"appScriptLoadFailed"}}()}),F2.extend("",{App:function(){return{init:function(){}}},AppConfig:{appId:"",context:{},enableBatchRequests:!1,height:0,instanceId:"",isSecure:!1,manifestUrl:"",maxWidth:0,minGridSize:4,minWidth:300,name:"",root:void 0,ui:void 0,views:[]},AppManifest:{apps:[],inlineScripts:[],scripts:[],styles:[]},AppContent:{data:{},html:"",status:""},ContainerConfig:{afterAppRender:function(){},appRender:function(){},beforeAppRender:function(){},debugMode:!1,scriptErrorTimeout:7e3,isSecureAppPage:!1,secureAppPagePath:"",supportedViews:[],UI:{Mask:{backgroundColor:"#FFF",loadingIcon:"",opacity:.6,useClasses:!1,zIndex:2}},xhr:{dataType:function(){},type:function(){},url:function(){}}}}),F2.extend("Constants",{Css:function(){var e="f2-";return{APP:e+"app",APP_CONTAINER:e+"app-container",APP_TITLE:e+"app-title",APP_VIEW:e+"app-view",APP_VIEW_TRIGGER:e+"app-view-trigger",MASK:e+"mask",MASK_CONTAINER:e+"mask-container"}}(),Events:function(){var e="App.",t="Container.";return{APP_SYMBOL_CHANGE:e+"symbolChange",APP_WIDTH_CHANGE:e+"widthChange.",CONTAINER_SYMBOL_CHANGE:t+"symbolChange",CONTAINER_WIDTH_CHANGE:t+"widthChange"}}(),JSONP_CALLBACK:"F2_jsonpCallback_",Sockets:{EVENT:"__event__",LOAD:"__socketLoad__",RPC:"__rpc__",RPC_CALLBACK:"__rpcCallback__",UI_RPC:"__uiRpc__"},Views:{DATA_ATTRIBUTE:"data-f2-view",ABOUT:"about",HELP:"help",HOME:"home",REMOVE:"remove",SETTINGS:"settings"}}),F2.extend("Events",function(){var e=new EventEmitter2({wildcard:!0});return e.setMaxListeners(0),{_socketEmit:function(){return EventEmitter2.prototype.emit.apply(e,[].slice.call(arguments))},emit:function(){return F2.Rpc.broadcast(F2.Constants.Sockets.EVENT,[].slice.call(arguments)),EventEmitter2.prototype.emit.apply(e,[].slice.call(arguments))},many:function(t,n,r){return e.many(t,n,r)},off:function(t,n){return e.off(t,n)},on:function(t,n){return e.on(t,n)},once:function(t,n){return e.once(t,n)}}}()),F2.extend("Rpc",function(){var e={},t="",n={},r=RegExp("^"+F2.Constants.Sockets.EVENT),o=RegExp("^"+F2.Constants.Sockets.RPC),i=RegExp("^"+F2.Constants.Sockets.RPC_CALLBACK),a=RegExp("^"+F2.Constants.Sockets.LOAD),s=RegExp("^"+F2.Constants.Sockets.UI_RPC),l=function(){var e,t=!1,r=[],o=new easyXDM.Socket({onMessage:function(i,s){if(!t&&a.test(i)){i=i.replace(a,"");var l=F2.parse(i);2==l.length&&(e=l[0],n[e.instanceId]={config:e,socket:o},F2.registerApps([e],[l[1]]),jQuery.each(r,function(){p(e,i,s)}),t=!0)}else t?p(e,i,s):r.push(i)}})},c=function(e,n){var r=jQuery(e.root);if(r.is("."+F2.Constants.Css.APP_CONTAINER)||r.find("."+F2.Constants.Css.APP_CONTAINER),!r.length)return F2.log("Unable to locate app in order to establish secure connection."),void 0;var o={scrolling:"no",style:{width:"100%"}};e.height&&(o.style.height=e.height+"px");var i=new easyXDM.Socket({remote:t,container:r.get(0),props:o,onMessage:function(t,n){p(e,t,n)},onReady:function(){i.postMessage(F2.Constants.Sockets.LOAD+F2.stringify([e,n],F2.appConfigReplacer))}});return i},u=function(e,t){return function(){F2.Rpc.call(e,F2.Constants.Sockets.RPC_CALLBACK,t,[].slice.call(arguments).slice(2))}},p=function(t,n){function a(e,t){for(var n=(t+"").split("."),r=0;n.length>r;r++){if(void 0===e[n[r]]){e=void 0;break}e=e[n[r]]}return e}function l(e,t,n){var r=F2.parse(t.replace(e,""));return r.params&&r.params.length&&r.callbacks&&r.callbacks.length&&jQuery.each(r.callbacks,function(e,t){jQuery.each(r.params,function(e,o){t==o&&(r.params[e]=u(n,t))})}),r}var c,p;s.test(n)?(c=l(s,n,t.instanceId),p=a(t.ui,c.functionName),void 0!==p?p.apply(t.ui,c.params):F2.log("Unable to locate UI RPC function: "+c.functionName)):o.test(n)?(c=l(o,n,t.instanceId),p=a(window,c.functionName),void 0!==p?p.apply(p,c.params):F2.log("Unable to locate RPC function: "+c.functionName)):i.test(n)?(c=l(i,n,t.instanceId),void 0!==e[c.functionName]&&(e[c.functionName].apply(e[c.functionName],c.params),delete e[c.functionName])):r.test(n)&&(c=l(r,n,t.instanceId),F2.Events._socketEmit.apply(F2.Events,c))},f=function(t){var n=F2.guid();return e[n]=t,n};return{broadcast:function(e,t){var r=e+F2.stringify(t);jQuery.each(n,function(e,t){t.socket.postMessage(r)})},call:function(e,t,r,o){var i=[];jQuery.each(o,function(e,t){if("function"==typeof t){var n=f(t);o[e]=n,i.push(n)}}),n[e].socket.postMessage(t+F2.stringify({functionName:r,params:o,callbacks:i}))},init:function(e){t=e,t||l()},isRemote:function(e){return void 0!==n[e]&&n[e].config.isSecure&&0===jQuery(n[e].config.root).find("iframe").length},register:function(e,t){e&&t?n[e.instanceId]={config:e,socket:c(e,t)}:F2.log("Unable to register socket connection. Please check container configuration.")}}}()),F2.extend("UI",function(){var e,t=function(e){var t=e,n=jQuery(e.root),r=function(e){e=e||jQuery(t.root).outerHeight(),F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"updateHeight",[e]):(t.height=e,n.find("iframe").height(t.height))};return{hideMask:function(e){F2.UI.hideMask(t.instanceId,e)},Modals:function(){var e=function(e){return['<div class="modal">','<header class="modal-header">',"<h3>Alert!</h3>","</header>",'<div class="modal-body">',"<p>",e,"</p>","</div>",'<div class="modal-footer">','<button class="btn btn-primary btn-ok">OK</button>',"</div>","</div>"].join("")},n=function(e){return['<div class="modal">','<header class="modal-header">',"<h3>Confirm</h3>","</header>",'<div class="modal-body">',"<p>",e,"</p>","</div>",'<div class="modal-footer">','<button type="button" class="btn btn-primary btn-ok">OK</button>','<button type="button" class="btn btn-cancel">Cancel</button">',"</div>","</div>"].join("")};return{alert:function(n,r){return F2.isInit()?(F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Modals.alert",[].slice.call(arguments)):jQuery(e(n)).on("show",function(){var e=this;jQuery(e).find(".btn-primary").on("click",function(){jQuery(e).modal("hide").remove(),(r||jQuery.noop)()})}).modal({backdrop:!0}),void 0):(F2.log("F2.init() must be called before F2.UI.Modals.alert()"),void 0)},confirm:function(e,r,o){return F2.isInit()?(F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Modals.confirm",[].slice.call(arguments)):jQuery(n(e)).on("show",function(){var e=this;jQuery(e).find(".btn-ok").on("click",function(){jQuery(e).modal("hide").remove(),(r||jQuery.noop)()}),jQuery(e).find(".btn-cancel").on("click",function(){jQuery(e).modal("hide").remove(),(o||jQuery.noop)()})}).modal({backdrop:!0}),void 0):(F2.log("F2.init() must be called before F2.UI.Modals.confirm()"),void 0)}}}(),setTitle:function(e){F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"setTitle",[e]):jQuery(t.root).find("."+F2.Constants.Css.APP_TITLE).text(e)},showMask:function(e,n){F2.UI.showMask(t.instanceId,e,n)},updateHeight:r,Views:function(){var e=new EventEmitter2,o=/change/i;e.setMaxListeners(0);var i=function(e){return o.test(e)?!0:(F2.log('"'+e+'" is not a valid F2.UI.Views event name'),!1)};return{change:function(o){"function"==typeof o?this.on("change",o):"string"==typeof o&&(t.isSecure&&!F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Views.change",[].slice.call(arguments)):F2.inArray(o,t.views)&&(jQuery("."+F2.Constants.Css.APP_VIEW,n).addClass("hide").filter('[data-f2-view="'+o+'"]',n).removeClass("hide"),r(),e.emit("change",o)))},off:function(t,n){i(t)&&e.off(t,n)},on:function(t,n){i(t)&&e.on(t,n)}}}()}};return t.hideMask=function(e,t){if(!F2.isInit())return F2.log("F2.init() must be called before F2.UI.hideMask()"),void 0;if(F2.Rpc.isRemote(e)&&!jQuery(t).is("."+F2.Constants.Css.APP))F2.Rpc.call(e,F2.Constants.Sockets.RPC,"F2.UI.hideMask",[e,jQuery(t).selector]);else{var n=jQuery(t);n.find("> ."+F2.Constants.Css.MASK).remove(),n.removeClass(F2.Constants.Css.MASK_CONTAINER),n.data(F2.Constants.Css.MASK_CONTAINER)&&n.css({position:"static"})}},t.init=function(t){e=t,e.UI=jQuery.extend(!0,{},F2.ContainerConfig.UI,e.UI||{})},t.showMask=function(t,n,r){if(!F2.isInit())return F2.log("F2.init() must be called before F2.UI.showMask()"),void 0;if(F2.Rpc.isRemote(t)&&jQuery(n).is("."+F2.Constants.Css.APP))F2.Rpc.call(t,F2.Constants.Sockets.RPC,"F2.UI.showMask",[t,jQuery(n).selector,r]);else{r&&!e.UI.Mask.loadingIcon&&F2.log("Unable to display loading icon. Please set F2.ContainerConfig.UI.Mask.loadingIcon when calling F2.init();");var o=jQuery(n).addClass(F2.Constants.Css.MASK_CONTAINER),i=jQuery("<div>").height("100%").width("100%").addClass(F2.Constants.Css.MASK);e.UI.Mask.useClasses||i.css({"background-color":e.UI.Mask.backgroundColor,"background-image":e.UI.Mask.loadingIcon?"url("+e.UI.Mask.loadingIcon+")":"","background-position":"50% 50%","background-repeat":"no-repeat",display:"block",left:0,"min-height":30,padding:0,position:"absolute",top:0,"z-index":e.UI.Mask.zIndex,filter:"alpha(opacity="+100*e.UI.Mask.opacity+")",opacity:e.UI.Mask.opacity}),"static"===o.css("position")&&(o.css({position:"relative"}),o.data(F2.Constants.Css.MASK_CONTAINER,!0)),o.append(i)}},t}()),F2.extend("",function(){var _apps={},_config=!1,_bUsesAppHandlers=!1,_sAppHandlerToken=F2.AppHandlers.__f2GetToken(),_afterAppRender=function(e,t){var n=_config.afterAppRender||function(e,t){return jQuery(t).appendTo("body")},r=n(e,t);return _config.afterAppRender&&!r?(F2.log("F2.ContainerConfig.afterAppRender() must return the DOM Element that contains the app"),void 0):(jQuery(r).addClass(F2.Constants.Css.APP),r.get(0))},_appRender=function(e,t){return t=_outerHtml(jQuery(t).addClass(F2.Constants.Css.APP_CONTAINER+" "+e.appId)),_config.appRender&&(t=_config.appRender(e,t)),_outerHtml(t)},_beforeAppRender=function(e){var t=_config.beforeAppRender||jQuery.noop;return t(e)},_appScriptLoadFailed=function(e,t){var n=_config.appScriptLoadFailed||jQuery.noop;return n(e,t)},_createAppConfig=function(e){return e=jQuery.extend(!0,{},e),e.instanceId=e.instanceId||F2.guid(),e.views=e.views||[],F2.inArray(F2.Constants.Views.HOME,e.views)||e.views.push(F2.Constants.Views.HOME),e},_hydrateContainerConfig=function(e){e.scriptErrorTimeout||(e.scriptErrorTimeout=F2.ContainerConfig.scriptErrorTimeout),e.debugMode!==!0&&(e.debugMode=F2.ContainerConfig.debugMode)},_initAppEvents=function(e){jQuery(e.root).on("click","."+F2.Constants.Css.APP_VIEW_TRIGGER+"["+F2.Constants.Views.DATA_ATTRIBUTE+"]",function(t){t.preventDefault();var n=jQuery(this).attr(F2.Constants.Views.DATA_ATTRIBUTE).toLowerCase();n==F2.Constants.Views.REMOVE?F2.removeApp(e.instanceId):e.ui.Views.change(n)})},_initContainerEvents=function(){var e,t=function(){F2.Events.emit(F2.Constants.Events.CONTAINER_WIDTH_CHANGE)};jQuery(window).on("resize",function(){clearTimeout(e),e=setTimeout(t,100)})},_isInit=function(){return!!_config},_createAppInstance=function(e,t){e.ui=new F2.UI(e),void 0!==F2.Apps[e.appId]&&("function"==typeof F2.Apps[e.appId]?setTimeout(function(){_apps[e.instanceId].app=new F2.Apps[e.appId](e,t,e.root),void 0!==_apps[e.instanceId].app.init&&_apps[e.instanceId].app.init()},0):F2.log("app initialization class is defined but not a function. ("+e.appId+")"))},_loadApps=function(appConfigs,appManifest){if(appConfigs=[].concat(appConfigs),1==appConfigs.length&&appConfigs[0].isSecure&&!_config.isSecureAppPage)return _loadSecureApp(appConfigs[0],appManifest),void 0;if(appConfigs.length!=appManifest.apps.length)return F2.log("The number of apps defined in the AppManifest do not match the number requested.",appManifest),void 0;var scripts=appManifest.scripts||[],styles=appManifest.styles||[],inlines=appManifest.inlineScripts||[],scriptCount=scripts.length,scriptsLoaded=0,readyStates="addEventListener"in window?{}:{loaded:!0,complete:!0},appInit=function(){jQuery.each(appConfigs,function(e,t){_createAppInstance(t,appManifest.apps[e])})},_error=function(e){setTimeout(function(){var t={src:e.target.src,appId:appConfigs[0].appId};F2.log("Script defined in '"+t.appId+"' failed to load '"+t.src+"'"),F2.Events.emit("RESOURCE_FAILED_TO_LOAD",t),_bUsesAppHandlers?F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,appConfigs[0],t.src):_appScriptLoadFailed(appConfigs[0],t.src)},_config.scriptErrorTimeout)},evalInlines=function(){jQuery.each(inlines,function(i,e){try{eval(e)}catch(exception){F2.log("Error loading inline script: "+exception+"\n\n"+e),_bUsesAppHandlers?F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,appConfigs[0],exception):_appScriptLoadFailed(appConfigs[0],exception)}})},stylesFragment=null,useCreateStyleSheet=!!document.createStyleSheet;jQuery.each(styles,function(e,t){useCreateStyleSheet?document.createStyleSheet(t):(stylesFragment=stylesFragment||[],stylesFragment.push('<link rel="stylesheet" type="text/css" href="'+t+'"/>'))}),stylesFragment&&jQuery("head").append(stylesFragment.join("")),jQuery.each(appManifest.apps,function(e,t){if(_bUsesAppHandlers){F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER,appConfigs[e],_outerHtml(t.html));var n=appConfigs[e].appId;if(!appConfigs[e].root)throw"Root for "+n+" must be a native DOM element and cannot be null or undefined. Check your AppHandler callbacks to ensure you have set App root to a native DOM element.";var r=jQuery(appConfigs[e].root);if(0===r.parents("body:first").length)throw"App root for "+n+" was not appended to the DOM. Check your AppHandler callbacks to ensure you have rendered the app root to the DOM.";if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_AFTER,appConfigs[e]),!F2.isNativeDOMNode(appConfigs[e].root))throw"App root for "+n+" must be a native DOM element. Check your AppHandler callbacks to ensure you have set app root to a native DOM element.";r.addClass(F2.Constants.Css.APP_CONTAINER+" "+n)}else appConfigs[e].root=_afterAppRender(appConfigs[e],_appRender(appConfigs[e],t.html));_initAppEvents(appConfigs[e])}),jQuery.each(scripts,function(e,t){var n=document,r=n.createElement("script"),o=t;_config.debugMode&&(o+="?cachebuster="+(new Date).getTime()),r.async=!1,r.src=o,r.type="text/javascript",r.charset="utf-8",r.onerror=_error,r.onload=r.onreadystatechange=function(e){e=e||window.event,("load"==e.type||readyStates[r.readyState])&&(r.onload=r.onreadystatechange=r.onerror=null,r=null,++scriptsLoaded==scriptCount&&(evalInlines(),appInit()))},n.body.appendChild(r)}),scriptCount||(evalInlines(),appInit())},_loadSecureApp=function(e,t){if(_config.secureAppPagePath){if(_bUsesAppHandlers){var n=jQuery(e.root);if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER,e,t.html),0===n.parents("body:first").length)throw"App was never rendered on the page. Please check your AppHandler callbacks to ensure you have rendered the app root to the DOM.";if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_AFTER,e),!e.root)throw"App Root must be a native dom node and can not be null or undefined. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.";if(!F2.isNativeDOMNode(e.root))throw"App Root must be a native dom node. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.";jQuery(e.root).addClass(F2.Constants.Css.APP_CONTAINER+" "+e.appId)}else e.root=_afterAppRender(e,_appRender(e,"<div></div>"));e.ui=new F2.UI(e),_initAppEvents(e),F2.Rpc.register(e,t)}else F2.log('Unable to load secure app: "secureAppPagePath" is not defined in F2.ContainerConfig.')},_outerHtml=function(e){return jQuery("<div></div>").append(e).html()},_validateApp=function(e){return e.appId?e.root||e.manifestUrl?!0:(F2.log('"manifestUrl" missing from app object'),!1):(F2.log('"appId" missing from app object'),!1)},_validateContainerConfig=function(){if(_config&&_config.xhr){if("function"!=typeof _config.xhr&&"object"!=typeof _config.xhr)throw"ContainerConfig.xhr should be a function or an object";if(_config.xhr.dataType&&"function"!=typeof _config.xhr.dataType)throw"ContainerConfig.xhr.dataType should be a function";if(_config.xhr.type&&"function"!=typeof _config.xhr.type)throw"ContainerConfig.xhr.type should be a function";if(_config.xhr.url&&"function"!=typeof _config.xhr.url)throw"ContainerConfig.xhr.url should be a function"}return!0};return{getContainerState:function(){return _isInit()?jQuery.map(_apps,function(e){return{appId:e.config.appId}}):(F2.log("F2.init() must be called before F2.getContainerState()"),void 0)},init:function(e){_config=e||{},_validateContainerConfig(),_hydrateContainerConfig(_config),_bUsesAppHandlers=!(_config.beforeAppRender||_config.appRender||_config.afterAppRender||_config.appScriptLoadFailed),(_config.secureAppPagePath||_config.isSecureAppPage)&&F2.Rpc.init(_config.secureAppPagePath?_config.secureAppPagePath:!1),F2.UI.init(_config),_config.isSecureAppPage||_initContainerEvents()},isInit:_isInit,registerApps:function(e,t){if(!_isInit())return F2.log("F2.init() must be called before F2.registerApps()"),void 0;if(!e)return F2.log("At least one AppConfig must be passed when calling F2.registerApps()"),void 0;var n=[],r={},o={},i=!1;return e=[].concat(e),t=[].concat(t||[]),i=!!t.length,e.length?e.length&&i&&e.length!=t.length?(F2.log('The length of "apps" does not equal the length of "appManifests"'),void 0):(jQuery.each(e,function(e,o){if(o=_createAppConfig(o),o.root=o.root||null,_validateApp(o)){if(_apps[o.instanceId]={config:o},o.root){if(!o.root&&"string"!=typeof o.root&&!F2.isNativeDOMNode(o.root))throw F2.log("AppConfig invalid for pre-load, not a valid string and not dom node"),F2.log("AppConfig instance:",o),"Preloaded appConfig.root property must be a native dom node or a string representing a sizzle selector. Please check your inputs and try again.";if(1!=jQuery(o.root).length)throw F2.log("AppConfig invalid for pre-load, root not unique"),F2.log("AppConfig instance:",o),F2.log("Number of dom node instances:",jQuery(o.root).length),"Preloaded appConfig.root property must map to a unique dom node. Please check your inputs and try again.";return _createAppInstance(o),_initAppEvents(o),void 0}_bUsesAppHandlers?(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_CREATE_ROOT,o),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_BEFORE,o)):o.root=_beforeAppRender(o),i?_loadApps(o,t[e]):o.enableBatchRequests&&!o.isSecure?(r[o.manifestUrl.toLowerCase()]=r[o.manifestUrl.toLowerCase()]||[],r[o.manifestUrl.toLowerCase()].push(o)):n.push({apps:[o],url:o.manifestUrl})}}),i||(jQuery.each(r,function(e,t){n.push({url:e,apps:t})}),jQuery.each(n,function(e,t){var n=F2.Constants.JSONP_CALLBACK+t.apps[0].appId;o[n]=o[n]||[],o[n].push(t)}),jQuery.each(o,function(e,t){var n=function(r,o){if(o){var i=o.url,a="GET",s="jsonp",l=function(){n(e,t.pop())},c=function(){jQuery.each(o.apps,function(e,t){F2.log("Removed failed "+t.name+" app",t),F2.removeApp(t.instanceId)})},u=function(e){_loadApps(o.apps,e)};if(_config.xhr&&_config.xhr.dataType&&(s=_config.xhr.dataType(o.url,o.apps),"string"!=typeof s))throw"ContainerConfig.xhr.dataType should return a string";if(_config.xhr&&_config.xhr.type&&(a=_config.xhr.type(o.url,o.apps),"string"!=typeof a))throw"ContainerConfig.xhr.type should return a string";if(_config.xhr&&_config.xhr.url&&(i=_config.xhr.url(o.url,o.apps),"string"!=typeof i))throw"ContainerConfig.xhr.url should return a string";var p=_config.xhr;"function"!=typeof p&&(p=function(e,t,n,i,l){jQuery.ajax({url:e,type:a,data:{params:F2.stringify(o.apps,F2.appConfigReplacer)},jsonp:!1,jsonpCallback:r,dataType:s,success:n,error:function(e,t,n){F2.log("Failed to load app(s)",""+n,o.apps),i()},complete:l})}),p(i,o.apps,u,c,l)}};n(e,t.pop())})),void 0):(F2.log("At least one AppConfig must be passed when calling F2.registerApps()"),void 0)},removeAllApps:function(){return _isInit()?(jQuery.each(_apps,function(e,t){F2.removeApp(t.config.instanceId)}),void 0):(F2.log("F2.init() must be called before F2.removeAllApps()"),void 0)},removeApp:function(e){return _isInit()?(_apps[e]&&(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY_BEFORE,_apps[e]),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY,_apps[e]),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY_AFTER,_apps[e]),delete _apps[e]),void 0):(F2.log("F2.init() must be called before F2.removeApp()"),void 0)}}}()),exports.F2=F2,"undefined"!=typeof define&&define.amd&&define(function(){return F2})}})("undefined"!=typeof exports?exports:window);
src/core/__tests__/ReactEventEmitter-test.js
jaredly/react
/** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @emails react-core */ "use strict"; require('mock-modules') .dontMock('BrowserScroll') .dontMock('CallbackRegistry') .dontMock('EventPluginHub') .dontMock('ReactMount') .dontMock('ReactEventEmitter') .dontMock('ReactInstanceHandles') .dontMock('EventPluginHub') .dontMock('TapEventPlugin') .dontMock('TouchEventUtils') .dontMock('keyOf'); var keyOf = require('keyOf'); var mocks = require('mocks'); var EventPluginHub; var ReactMount = require('ReactMount'); var getID = ReactMount.getID; var setID = ReactMount.setID; var ReactEventEmitter; var ReactTestUtils; var TapEventPlugin; var tapMoveThreshold; var idCallOrder = []; var recordID = function(id) { idCallOrder.push(id); }; var recordIDAndStopPropagation = function(id, event) { recordID(id); event.stopPropagation(); }; var recordIDAndReturnFalse = function(id, event) { recordID(id); return false; }; var LISTENER = mocks.getMockFunction(); var ON_CLICK_KEY = keyOf({onClick: null}); var ON_TOUCH_TAP_KEY = keyOf({onTouchTap: null}); /** * Since `ReactEventEmitter` is fairly well separated from the DOM, we can test * almost all of `ReactEventEmitter` without ever rendering anything in the DOM. * As long as we provide IDs that follow `React's` conventional id namespace * hierarchy. The only reason why we create these DOM nodes, is so that when we * feed them into `ReactEventEmitter` (through `ReactTestUtils`), the event * handlers may receive a DOM node to inspect. */ var CHILD = document.createElement('div'); var PARENT = document.createElement('div'); var GRANDPARENT = document.createElement('div'); setID(CHILD, '.reactRoot.[0].[0].[0]'); setID(PARENT, '.reactRoot.[0].[0]'); setID(GRANDPARENT, '.reactRoot.[0]'); function registerSimpleTestHandler() { ReactEventEmitter.putListener(getID(CHILD), ON_CLICK_KEY, LISTENER); var listener = ReactEventEmitter.getListener(getID(CHILD), ON_CLICK_KEY); expect(listener).toEqual(LISTENER); return ReactEventEmitter.getListener(getID(CHILD), ON_CLICK_KEY); } describe('ReactEventEmitter', function() { beforeEach(function() { require('mock-modules').dumpCache(); EventPluginHub = require('EventPluginHub'); TapEventPlugin = require('TapEventPlugin'); ReactMount = require('ReactMount'); getID = ReactMount.getID; setID = ReactMount.setID; ReactEventEmitter = require('ReactEventEmitter'); ReactTestUtils = require('ReactTestUtils'); idCallOrder = []; tapMoveThreshold = TapEventPlugin.tapMoveThreshold; ReactEventEmitter.ensureListening(false, document); EventPluginHub.injection.injectEventPluginsByName({ TapEventPlugin: TapEventPlugin }); }); it('should store a listener correctly', function() { registerSimpleTestHandler(); var listener = ReactEventEmitter.getListener(getID(CHILD), ON_CLICK_KEY); expect(listener).toBe(LISTENER); }); it('should retrieve a listener correctly', function() { registerSimpleTestHandler(); var listener = ReactEventEmitter.getListener(getID(CHILD), ON_CLICK_KEY); expect(listener).toEqual(LISTENER); }); it('should clear all handlers when asked to', function() { registerSimpleTestHandler(); ReactEventEmitter.deleteAllListeners(getID(CHILD)); var listener = ReactEventEmitter.getListener(getID(CHILD), ON_CLICK_KEY); expect(listener).toBe(undefined); }); it('should invoke a simple handler registered on a node', function() { registerSimpleTestHandler(); ReactTestUtils.Simulate.click(CHILD); expect(LISTENER.mock.calls.length).toBe(1); }); it('should not invoke handlers if ReactEventEmitter is disabled', function() { registerSimpleTestHandler(); ReactEventEmitter.setEnabled(false); ReactTestUtils.Simulate.click(CHILD); expect(LISTENER.mock.calls.length).toBe(0); ReactEventEmitter.setEnabled(true); ReactTestUtils.Simulate.click(CHILD); expect(LISTENER.mock.calls.length).toBe(1); }); it('should bubble simply', function() { ReactEventEmitter.putListener( getID(CHILD), ON_CLICK_KEY, recordID.bind(null, getID(CHILD)) ); ReactEventEmitter.putListener( getID(PARENT), ON_CLICK_KEY, recordID.bind(null, getID(PARENT)) ); ReactEventEmitter.putListener( getID(GRANDPARENT), ON_CLICK_KEY, recordID.bind(null, getID(GRANDPARENT)) ); ReactTestUtils.Simulate.click(CHILD); expect(idCallOrder.length).toBe(3); expect(idCallOrder[0]).toBe(getID(CHILD)); expect(idCallOrder[1]).toBe(getID(PARENT)); expect(idCallOrder[2]).toBe(getID(GRANDPARENT)); }); it('should support stopPropagation()', function() { ReactEventEmitter.putListener( getID(CHILD), ON_CLICK_KEY, recordID.bind(null, getID(CHILD)) ); ReactEventEmitter.putListener( getID(PARENT), ON_CLICK_KEY, recordIDAndStopPropagation.bind(null, getID(PARENT)) ); ReactEventEmitter.putListener( getID(GRANDPARENT), ON_CLICK_KEY, recordID.bind(null, getID(GRANDPARENT)) ); ReactTestUtils.Simulate.click(CHILD); expect(idCallOrder.length).toBe(2); expect(idCallOrder[0]).toBe(getID(CHILD)); expect(idCallOrder[1]).toBe(getID(PARENT)); }); it('should stop after first dispatch if stopPropagation', function() { ReactEventEmitter.putListener( getID(CHILD), ON_CLICK_KEY, recordIDAndStopPropagation.bind(null, getID(CHILD)) ); ReactEventEmitter.putListener( getID(PARENT), ON_CLICK_KEY, recordID.bind(null, getID(PARENT)) ); ReactEventEmitter.putListener( getID(GRANDPARENT), ON_CLICK_KEY, recordID.bind(null, getID(GRANDPARENT)) ); ReactTestUtils.Simulate.click(CHILD); expect(idCallOrder.length).toBe(1); expect(idCallOrder[0]).toBe(getID(CHILD)); }); it('should stopPropagation if false is returned', function() { ReactEventEmitter.putListener( getID(CHILD), ON_CLICK_KEY, recordIDAndReturnFalse.bind(null, getID(CHILD)) ); ReactEventEmitter.putListener( getID(PARENT), ON_CLICK_KEY, recordID.bind(null, getID(PARENT)) ); ReactEventEmitter.putListener( getID(GRANDPARENT), ON_CLICK_KEY, recordID.bind(null, getID(GRANDPARENT)) ); ReactTestUtils.Simulate.click(CHILD); expect(idCallOrder.length).toBe(1); expect(idCallOrder[0]).toBe(getID(CHILD)); }); /** * The entire event registration state of the world should be "locked-in" at * the time the event occurs. This is to resolve many edge cases that come * about from a listener on a lower-in-DOM node causing structural changes at * places higher in the DOM. If this lower-in-DOM node causes new content to * be rendered at a place higher-in-DOM, we need to be careful not to invoke * these new listeners. */ it('should invoke handlers that were removed while bubbling', function() { var handleParentClick = mocks.getMockFunction(); var handleChildClick = function(event) { ReactEventEmitter.deleteAllListeners(getID(PARENT)); }; ReactEventEmitter.putListener(getID(CHILD), ON_CLICK_KEY, handleChildClick); ReactEventEmitter.putListener( getID(PARENT), ON_CLICK_KEY, handleParentClick ); ReactTestUtils.Simulate.click(CHILD); expect(handleParentClick.mock.calls.length).toBe(1); }); it('should not invoke newly inserted handlers while bubbling', function() { var handleParentClick = mocks.getMockFunction(); var handleChildClick = function(event) { ReactEventEmitter.putListener( getID(PARENT), ON_CLICK_KEY, handleParentClick ); }; ReactEventEmitter.putListener(getID(CHILD), ON_CLICK_KEY, handleChildClick); ReactTestUtils.Simulate.click(CHILD); expect(handleParentClick.mock.calls.length).toBe(0); }); it('should infer onTouchTap from a touchStart/End', function() { ReactEventEmitter.putListener( getID(CHILD), ON_TOUCH_TAP_KEY, recordID.bind(null, getID(CHILD)) ); ReactTestUtils.Simulate.touchStart( CHILD, ReactTestUtils.nativeTouchData(0, 0) ); ReactTestUtils.Simulate.touchEnd( CHILD, ReactTestUtils.nativeTouchData(0, 0) ); expect(idCallOrder.length).toBe(1); expect(idCallOrder[0]).toBe(getID(CHILD)); }); it('should infer onTouchTap from when dragging below threshold', function() { ReactEventEmitter.putListener( getID(CHILD), ON_TOUCH_TAP_KEY, recordID.bind(null, getID(CHILD)) ); ReactTestUtils.Simulate.touchStart( CHILD, ReactTestUtils.nativeTouchData(0, 0) ); ReactTestUtils.Simulate.touchEnd( CHILD, ReactTestUtils.nativeTouchData(0, tapMoveThreshold - 1) ); expect(idCallOrder.length).toBe(1); expect(idCallOrder[0]).toBe(getID(CHILD)); }); it('should not onTouchTap from when dragging beyond threshold', function() { ReactEventEmitter.putListener( getID(CHILD), ON_TOUCH_TAP_KEY, recordID.bind(null, getID(CHILD)) ); ReactTestUtils.Simulate.touchStart( CHILD, ReactTestUtils.nativeTouchData(0, 0) ); ReactTestUtils.Simulate.touchEnd( CHILD, ReactTestUtils.nativeTouchData(0, tapMoveThreshold + 1) ); expect(idCallOrder.length).toBe(0); }); it('should bubble onTouchTap', function() { ReactEventEmitter.putListener( getID(CHILD), ON_TOUCH_TAP_KEY, recordID.bind(null, getID(CHILD)) ); ReactEventEmitter.putListener( getID(PARENT), ON_TOUCH_TAP_KEY, recordID.bind(null, getID(PARENT)) ); ReactEventEmitter.putListener( getID(GRANDPARENT), ON_TOUCH_TAP_KEY, recordID.bind(null, getID(GRANDPARENT)) ); ReactTestUtils.Simulate.touchStart( CHILD, ReactTestUtils.nativeTouchData(0, 0) ); ReactTestUtils.Simulate.touchEnd( CHILD, ReactTestUtils.nativeTouchData(0, 0) ); expect(idCallOrder.length).toBe(3); expect(idCallOrder[0]).toBe(getID(CHILD)); expect(idCallOrder[1]).toBe(getID(PARENT)); expect(idCallOrder[2]).toBe(getID(GRANDPARENT)); }); });
lavalab/html/node_modules/react-bootstrap/es/Nav.js
LavaLabUSC/usclavalab.org
import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import keycode from 'keycode'; import React, { cloneElement } from 'react'; import PropTypes from 'prop-types'; import ReactDOM from 'react-dom'; import all from 'prop-types-extra/lib/all'; import warning from 'warning'; import { bsClass, bsStyles, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils'; import createChainedFunction from './utils/createChainedFunction'; import ValidComponentChildren from './utils/ValidComponentChildren'; // TODO: Should we expose `<NavItem>` as `<Nav.Item>`? // TODO: This `bsStyle` is very unlike the others. Should we rename it? // TODO: `pullRight` and `pullLeft` don't render right outside of `navbar`. // Consider renaming or replacing them. var propTypes = { /** * Marks the NavItem with a matching `eventKey` as active. Has a * higher precedence over `activeHref`. */ activeKey: PropTypes.any, /** * Marks the child NavItem with a matching `href` prop as active. */ activeHref: PropTypes.string, /** * NavItems are be positioned vertically. */ stacked: PropTypes.bool, justified: all(PropTypes.bool, function (_ref) { var justified = _ref.justified, navbar = _ref.navbar; return justified && navbar ? Error('justified navbar `Nav`s are not supported') : null; }), /** * A callback fired when a NavItem is selected. * * ```js * function ( * Any eventKey, * SyntheticEvent event? * ) * ``` */ onSelect: PropTypes.func, /** * ARIA role for the Nav, in the context of a TabContainer, the default will * be set to "tablist", but can be overridden by the Nav when set explicitly. * * When the role is set to "tablist" NavItem focus is managed according to * the ARIA authoring practices for tabs: * https://www.w3.org/TR/2013/WD-wai-aria-practices-20130307/#tabpanel */ role: PropTypes.string, /** * Apply styling an alignment for use in a Navbar. This prop will be set * automatically when the Nav is used inside a Navbar. */ navbar: PropTypes.bool, /** * Float the Nav to the right. When `navbar` is `true` the appropriate * contextual classes are added as well. */ pullRight: PropTypes.bool, /** * Float the Nav to the left. When `navbar` is `true` the appropriate * contextual classes are added as well. */ pullLeft: PropTypes.bool }; var defaultProps = { justified: false, pullRight: false, pullLeft: false, stacked: false }; var contextTypes = { $bs_navbar: PropTypes.shape({ bsClass: PropTypes.string, onSelect: PropTypes.func }), $bs_tabContainer: PropTypes.shape({ activeKey: PropTypes.any, onSelect: PropTypes.func.isRequired, getTabId: PropTypes.func.isRequired, getPaneId: PropTypes.func.isRequired }) }; var Nav = function (_React$Component) { _inherits(Nav, _React$Component); function Nav() { _classCallCheck(this, Nav); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Nav.prototype.componentDidUpdate = function componentDidUpdate() { var _this2 = this; if (!this._needsRefocus) { return; } this._needsRefocus = false; var children = this.props.children; var _getActiveProps = this.getActiveProps(), activeKey = _getActiveProps.activeKey, activeHref = _getActiveProps.activeHref; var activeChild = ValidComponentChildren.find(children, function (child) { return _this2.isActive(child, activeKey, activeHref); }); var childrenArray = ValidComponentChildren.toArray(children); var activeChildIndex = childrenArray.indexOf(activeChild); var childNodes = ReactDOM.findDOMNode(this).children; var activeNode = childNodes && childNodes[activeChildIndex]; if (!activeNode || !activeNode.firstChild) { return; } activeNode.firstChild.focus(); }; Nav.prototype.handleTabKeyDown = function handleTabKeyDown(onSelect, event) { var nextActiveChild = void 0; switch (event.keyCode) { case keycode.codes.left: case keycode.codes.up: nextActiveChild = this.getNextActiveChild(-1); break; case keycode.codes.right: case keycode.codes.down: nextActiveChild = this.getNextActiveChild(1); break; default: // It was a different key; don't handle this keypress. return; } event.preventDefault(); if (onSelect && nextActiveChild && nextActiveChild.props.eventKey != null) { onSelect(nextActiveChild.props.eventKey); } this._needsRefocus = true; }; Nav.prototype.getNextActiveChild = function getNextActiveChild(offset) { var _this3 = this; var children = this.props.children; var validChildren = children.filter(function (child) { return child.props.eventKey != null && !child.props.disabled; }); var _getActiveProps2 = this.getActiveProps(), activeKey = _getActiveProps2.activeKey, activeHref = _getActiveProps2.activeHref; var activeChild = ValidComponentChildren.find(children, function (child) { return _this3.isActive(child, activeKey, activeHref); }); // This assumes the active child is not disabled. var activeChildIndex = validChildren.indexOf(activeChild); if (activeChildIndex === -1) { // Something has gone wrong. Select the first valid child we can find. return validChildren[0]; } var nextIndex = activeChildIndex + offset; var numValidChildren = validChildren.length; if (nextIndex >= numValidChildren) { nextIndex = 0; } else if (nextIndex < 0) { nextIndex = numValidChildren - 1; } return validChildren[nextIndex]; }; Nav.prototype.getActiveProps = function getActiveProps() { var tabContainer = this.context.$bs_tabContainer; if (tabContainer) { process.env.NODE_ENV !== 'production' ? warning(this.props.activeKey == null && !this.props.activeHref, 'Specifying a `<Nav>` `activeKey` or `activeHref` in the context of ' + 'a `<TabContainer>` is not supported. Instead use `<TabContainer ' + ('activeKey={' + this.props.activeKey + '} />`.')) : void 0; return tabContainer; } return this.props; }; Nav.prototype.isActive = function isActive(_ref2, activeKey, activeHref) { var props = _ref2.props; if (props.active || activeKey != null && props.eventKey === activeKey || activeHref && props.href === activeHref) { return true; } return props.active; }; Nav.prototype.getTabProps = function getTabProps(child, tabContainer, navRole, active, onSelect) { var _this4 = this; if (!tabContainer && navRole !== 'tablist') { // No tab props here. return null; } var _child$props = child.props, id = _child$props.id, controls = _child$props['aria-controls'], eventKey = _child$props.eventKey, role = _child$props.role, onKeyDown = _child$props.onKeyDown, tabIndex = _child$props.tabIndex; if (tabContainer) { process.env.NODE_ENV !== 'production' ? warning(!id && !controls, 'In the context of a `<TabContainer>`, `<NavItem>`s are given ' + 'generated `id` and `aria-controls` attributes for the sake of ' + 'proper component accessibility. Any provided ones will be ignored. ' + 'To control these attributes directly, provide a `generateChildId` ' + 'prop to the parent `<TabContainer>`.') : void 0; id = tabContainer.getTabId(eventKey); controls = tabContainer.getPaneId(eventKey); } if (navRole === 'tablist') { role = role || 'tab'; onKeyDown = createChainedFunction(function (event) { return _this4.handleTabKeyDown(onSelect, event); }, onKeyDown); tabIndex = active ? tabIndex : -1; } return { id: id, role: role, onKeyDown: onKeyDown, 'aria-controls': controls, tabIndex: tabIndex }; }; Nav.prototype.render = function render() { var _extends2, _this5 = this; var _props = this.props, stacked = _props.stacked, justified = _props.justified, onSelect = _props.onSelect, propsRole = _props.role, propsNavbar = _props.navbar, pullRight = _props.pullRight, pullLeft = _props.pullLeft, className = _props.className, children = _props.children, props = _objectWithoutProperties(_props, ['stacked', 'justified', 'onSelect', 'role', 'navbar', 'pullRight', 'pullLeft', 'className', 'children']); var tabContainer = this.context.$bs_tabContainer; var role = propsRole || (tabContainer ? 'tablist' : null); var _getActiveProps3 = this.getActiveProps(), activeKey = _getActiveProps3.activeKey, activeHref = _getActiveProps3.activeHref; delete props.activeKey; // Accessed via this.getActiveProps(). delete props.activeHref; // Accessed via this.getActiveProps(). var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = _extends({}, getClassSet(bsProps), (_extends2 = {}, _extends2[prefix(bsProps, 'stacked')] = stacked, _extends2[prefix(bsProps, 'justified')] = justified, _extends2)); var navbar = propsNavbar != null ? propsNavbar : this.context.$bs_navbar; var pullLeftClassName = void 0; var pullRightClassName = void 0; if (navbar) { var navbarProps = this.context.$bs_navbar || { bsClass: 'navbar' }; classes[prefix(navbarProps, 'nav')] = true; pullRightClassName = prefix(navbarProps, 'right'); pullLeftClassName = prefix(navbarProps, 'left'); } else { pullRightClassName = 'pull-right'; pullLeftClassName = 'pull-left'; } classes[pullRightClassName] = pullRight; classes[pullLeftClassName] = pullLeft; return React.createElement( 'ul', _extends({}, elementProps, { role: role, className: classNames(className, classes) }), ValidComponentChildren.map(children, function (child) { var active = _this5.isActive(child, activeKey, activeHref); var childOnSelect = createChainedFunction(child.props.onSelect, onSelect, navbar && navbar.onSelect, tabContainer && tabContainer.onSelect); return cloneElement(child, _extends({}, _this5.getTabProps(child, tabContainer, role, active, childOnSelect), { active: active, activeKey: activeKey, activeHref: activeHref, onSelect: childOnSelect })); }) ); }; return Nav; }(React.Component); Nav.propTypes = propTypes; Nav.defaultProps = defaultProps; Nav.contextTypes = contextTypes; export default bsClass('nav', bsStyles(['tabs', 'pills'], Nav));
ajax/libs/reactive-coffee/1.0.0/reactive-coffee.js
NMastracchio/cdnjs
(function() { var DepArray, DepCell, DepMap, DepMgr, Ev, FakeObsCell, FakeSrcCell, IndexedArray, IndexedDepArray, IndexedMappedDepArray, MappedDepArray, ObsArray, ObsCell, ObsMap, ObsMapEntryCell, RawHtml, Recorder, SrcArray, SrcCell, SrcMap, SrcMapEntryCell, asyncBind, bind, depMgr, ev, events, firstWhere, flatten, lagBind, mkMap, mktag, mkuid, nextUid, nthWhere, permToSplices, popKey, postLagBind, prop, propSet, props, recorder, rx, rxt, setDynProp, setProp, specialAttrs, sum, tag, tags, _fn, _i, _len, _ref, _ref1, _ref2, _ref3, _ref4, __slice = [].slice, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, _this = this; if (typeof exports === 'undefined') { this.rx = rx = {}; } else { rx = exports; } nextUid = 0; mkuid = function() { return nextUid += 1; }; popKey = function(x, k) { var v; if (!(k in x)) { throw new Error('object has no key ' + k); } v = x[k]; delete x[k]; return v; }; nthWhere = function(xs, n, f) { var i, x, _i, _len; for (i = _i = 0, _len = xs.length; _i < _len; i = ++_i) { x = xs[i]; if (f(x) && (n -= 1) < 0) { return [x, i]; } } return [null, -1]; }; firstWhere = function(xs, f) { return nthWhere(xs, 0, f); }; mkMap = function(xs) { var k, map, v, _i, _len, _ref; if (xs == null) { xs = []; } map = Object.create != null ? Object.create(null) : {}; if (_.isArray(xs)) { for (_i = 0, _len = xs.length; _i < _len; _i++) { _ref = xs[_i], k = _ref[0], v = _ref[1]; map[k] = v; } } else { for (k in xs) { v = xs[k]; map[k] = v; } } return map; }; sum = function(xs) { var n, x, _i, _len; n = 0; for (_i = 0, _len = xs.length; _i < _len; _i++) { x = xs[_i]; n += x; } return n; }; DepMgr = rx.DepMgr = (function() { function DepMgr() { this.uid2src = {}; this.buffering = false; this.buffer = []; } DepMgr.prototype.sub = function(uid, src) { return this.uid2src[uid] = src; }; DepMgr.prototype.unsub = function(uid) { return popKey(this.uid2src, uid); }; DepMgr.prototype.transaction = function(f) { var b, res, _i, _len, _ref; this.buffering = true; try { res = f(); } finally { _ref = this.buffer; for (_i = 0, _len = _ref.length; _i < _len; _i++) { b = _ref[_i]; b(); } this.buffer = []; this.buffering = false; } return res; }; return DepMgr; })(); rx._depMgr = depMgr = new DepMgr(); Ev = rx.Ev = (function() { function Ev(inits) { this.inits = inits; this.subs = mkMap(); } Ev.prototype.sub = function(listener) { var init, uid, _i, _len, _ref; uid = mkuid(); if (this.inits != null) { _ref = this.inits(); for (_i = 0, _len = _ref.length; _i < _len; _i++) { init = _ref[_i]; listener(init); } } this.subs[uid] = listener; depMgr.sub(uid, this); return uid; }; Ev.prototype.pub = function(data) { var listener, uid, _ref, _results, _this = this; if (depMgr.buffering) { return depMgr.buffer.push(function() { return _this.pub(data); }); } else { _ref = this.subs; _results = []; for (uid in _ref) { listener = _ref[uid]; _results.push(listener(data)); } return _results; } }; Ev.prototype.unsub = function(uid) { popKey(this.subs, uid); return depMgr.unsub(uid, this); }; Ev.prototype.scoped = function(listener, context) { var uid; uid = this.sub(listener); try { return context(); } finally { this.unsub(uid); } }; return Ev; })(); rx.skipFirst = function(f) { var first; first = true; return function() { var args; args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; if (first) { return first = false; } else { return f.apply(null, args); } }; }; Recorder = rx.Recorder = (function() { function Recorder() { this.stack = []; this.isMutating = false; this.isIgnoring = false; this.onMutationWarning = new Ev(); } Recorder.prototype.record = function(dep, f) { var wasIgnoring, wasMutating; if (this.stack.length > 0 && !this.isMutating) { _(this.stack).last().addNestedBind(dep); } this.stack.push(dep); wasMutating = this.isMutating; this.isMutating = false; wasIgnoring = this.isIgnoring; this.isIgnoring = false; try { return f(); } finally { this.isIgnoring = wasIgnoring; this.isMutating = wasMutating; this.stack.pop(); } }; Recorder.prototype.sub = function(sub) { var handle, topCell; if (this.stack.length > 0 && !this.isIgnoring) { topCell = _(this.stack).last(); return handle = sub(topCell); } }; Recorder.prototype.addCleanup = function(cleanup) { if (this.stack.length > 0) { return _(this.stack).last().addCleanup(cleanup); } }; Recorder.prototype.mutating = function(f) { var wasMutating; if (this.stack.length > 0) { console.warn('Mutation to observable detected during a bind context'); this.onMutationWarning.pub(null); } wasMutating = this.isMutating; this.isMutating = true; try { return f(); } finally { this.isMutating = wasMutating; } }; Recorder.prototype.ignoring = function(f) { var wasIgnoring; wasIgnoring = this.isIgnoring; this.isIgnoring = true; try { return f(); } finally { this.isIgnoring = wasIgnoring; } }; return Recorder; })(); rx._recorder = recorder = new Recorder(); rx.asyncBind = asyncBind = function(init, f) { var dep; dep = new DepCell(f, init); dep.refresh(); return dep; }; rx.bind = bind = function(f) { return asyncBind(null, function() { return this.done(this.record(f)); }); }; rx.lagBind = lagBind = function(lag, init, f) { var timeout; timeout = null; return asyncBind(init, function() { var _this = this; if (timeout != null) { clearTimeout(timeout); } return timeout = setTimeout(function() { return _this.done(_this.record(f)); }, lag); }); }; rx.postLagBind = postLagBind = function(init, f) { var timeout; timeout = null; return asyncBind(init, function() { var ms, val, _ref, _this = this; _ref = this.record(f), val = _ref.val, ms = _ref.ms; if (timeout != null) { clearTimeout(timeout); } return timeout = setTimeout((function() { return _this.done(val); }), ms); }); }; rx.snap = function(f) { return recorder.ignoring(f); }; rx.onDispose = function(cleanup) { return recorder.addCleanup(cleanup); }; rx.autoSub = function(ev, listener) { var subid; subid = ev.sub(listener); rx.onDispose(function() { return ev.unsub(subid); }); return subid; }; ObsCell = rx.ObsCell = (function() { function ObsCell(x) { var _ref, _this = this; this.x = x; this.x = (_ref = this.x) != null ? _ref : null; this.onSet = new Ev(function() { return [[null, _this.x]]; }); } ObsCell.prototype.get = function() { var _this = this; recorder.sub(function(target) { return rx.autoSub(_this.onSet, function() { return target.refresh(); }); }); return this.x; }; return ObsCell; })(); SrcCell = rx.SrcCell = (function(_super) { __extends(SrcCell, _super); function SrcCell() { _ref = SrcCell.__super__.constructor.apply(this, arguments); return _ref; } SrcCell.prototype.set = function(x) { var _this = this; return recorder.mutating(function() { var old; if (_this.x !== x) { old = _this.x; _this.x = x; _this.onSet.pub([old, x]); return old; } }); }; return SrcCell; })(ObsCell); DepCell = rx.DepCell = (function(_super) { __extends(DepCell, _super); function DepCell(body, init) { this.body = body; DepCell.__super__.constructor.call(this, init != null ? init : null); this.refreshing = false; this.nestedBinds = []; this.cleanups = []; } DepCell.prototype.refresh = function() { var env, isSynchronous, old, realDone, syncResult, _this = this; if (!this.refreshing) { old = this.x; realDone = function(x) { _this.x = x; return _this.onSet.pub([old, _this.x]); }; ({ recorded: false }); syncResult = null; isSynchronous = false; env = { record: function(f) { var recorded, res; if (!_this.refreshing) { _this.disconnect(); if (recorded) { throw new Error('this refresh has already recorded its dependencies'); } _this.refreshing = true; recorded = true; try { res = recorder.record(_this, function() { return f.call(env); }); } finally { _this.refreshing = false; } if (isSynchronous) { realDone(syncResult); } return res; } }, done: function(x) { if (old !== x) { if (_this.refreshing) { isSynchronous = true; return syncResult = x; } else { return realDone(x); } } } }; return this.body.call(env); } }; DepCell.prototype.disconnect = function() { var cleanup, nestedBind, _i, _j, _len, _len1, _ref1, _ref2; _ref1 = this.cleanups; for (_i = 0, _len = _ref1.length; _i < _len; _i++) { cleanup = _ref1[_i]; cleanup(); } _ref2 = this.nestedBinds; for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { nestedBind = _ref2[_j]; nestedBind.disconnect(); } this.nestedBinds = []; return this.cleanups = []; }; DepCell.prototype.addNestedBind = function(nestedBind) { return this.nestedBinds.push(nestedBind); }; DepCell.prototype.addCleanup = function(cleanup) { return this.cleanups.push(cleanup); }; return DepCell; })(ObsCell); ObsArray = rx.ObsArray = (function() { function ObsArray(xs, diff) { var _this = this; this.xs = xs != null ? xs : []; this.diff = diff != null ? diff : rx.basicDiff(); this.onChange = new Ev(function() { return [[0, [], _this.xs]]; }); this.indexed_ = null; } ObsArray.prototype.all = function() { var _this = this; recorder.sub(function(target) { return rx.autoSub(_this.onChange, function() { return target.refresh(); }); }); return _.clone(this.xs); }; ObsArray.prototype.raw = function() { var _this = this; recorder.sub(function(target) { return rx.autoSub(_this.onChange, function() { return target.refresh(); }); }); return this.xs; }; ObsArray.prototype.at = function(i) { var _this = this; recorder.sub(function(target) { return rx.autoSub(_this.onChange, function(_arg) { var added, index, removed; index = _arg[0], removed = _arg[1], added = _arg[2]; if (index === i) { return target.refresh(); } }); }); return this.xs[i]; }; ObsArray.prototype.length = function() { var _this = this; recorder.sub(function(target) { return rx.autoSub(_this.onChange, function(_arg) { var added, index, removed; index = _arg[0], removed = _arg[1], added = _arg[2]; if (removed.length !== added.length) { return target.refresh(); } }); }); return this.xs.length; }; ObsArray.prototype.map = function(f) { var ys; ys = new MappedDepArray(); rx.autoSub(this.onChange, function(_arg) { var added, index, removed; index = _arg[0], removed = _arg[1], added = _arg[2]; return ys.realSplice(index, removed.length, added.map(f)); }); return ys; }; ObsArray.prototype.indexed = function() { var _this = this; if (this.indexed_ == null) { this.indexed_ = new IndexedDepArray(); rx.autoSub(this.onChange, function(_arg) { var added, index, removed; index = _arg[0], removed = _arg[1], added = _arg[2]; return _this.indexed_.realSplice(index, removed.length, added); }); } return this.indexed_; }; ObsArray.prototype.concat = function(that) { return rx.concat(this, that); }; ObsArray.prototype.realSplice = function(index, count, additions) { var removed; removed = this.xs.splice.apply(this.xs, [index, count].concat(additions)); return this.onChange.pub([index, removed, additions]); }; ObsArray.prototype._update = function(val, diff) { var additions, count, fullSplice, index, old, splice, splices, x, _i, _len, _ref1, _results; if (diff == null) { diff = this.diff; } old = this.xs; fullSplice = [0, old.length, val]; x = null; splices = diff != null ? (_ref1 = permToSplices(old.length, val, diff(old, val))) != null ? _ref1 : [fullSplice] : [fullSplice]; _results = []; for (_i = 0, _len = splices.length; _i < _len; _i++) { splice = splices[_i]; index = splice[0], count = splice[1], additions = splice[2]; _results.push(this.realSplice(index, count, additions)); } return _results; }; return ObsArray; })(); SrcArray = rx.SrcArray = (function(_super) { __extends(SrcArray, _super); function SrcArray() { _ref1 = SrcArray.__super__.constructor.apply(this, arguments); return _ref1; } SrcArray.prototype.spliceArray = function(index, count, additions) { var _this = this; return recorder.mutating(function() { return _this.realSplice(index, count, additions); }); }; SrcArray.prototype.splice = function() { var additions, count, index; index = arguments[0], count = arguments[1], additions = 3 <= arguments.length ? __slice.call(arguments, 2) : []; return this.spliceArray(index, count, additions); }; SrcArray.prototype.insert = function(x, index) { return this.splice(index, 0, x); }; SrcArray.prototype.remove = function(x) { var i; i = _(this.raw()).indexOf(x); if (i >= 0) { return this.removeAt(i); } }; SrcArray.prototype.removeAt = function(index) { return this.splice(index, 1); }; SrcArray.prototype.push = function(x) { return this.splice(this.length(), 0, x); }; SrcArray.prototype.put = function(i, x) { return this.splice(i, 1, x); }; SrcArray.prototype.replace = function(xs) { return this.spliceArray(0, this.length(), xs); }; SrcArray.prototype.update = function(xs) { var _this = this; return recorder.mutating(function() { return _this._update(xs); }); }; return SrcArray; })(ObsArray); MappedDepArray = rx.MappedDepArray = (function(_super) { __extends(MappedDepArray, _super); function MappedDepArray() { _ref2 = MappedDepArray.__super__.constructor.apply(this, arguments); return _ref2; } return MappedDepArray; })(ObsArray); IndexedDepArray = rx.IndexedDepArray = (function(_super) { __extends(IndexedDepArray, _super); function IndexedDepArray(xs, diff) { var i, x, _this = this; if (xs == null) { xs = []; } IndexedDepArray.__super__.constructor.call(this, xs, diff); this.is = (function() { var _i, _len, _ref3, _results; _ref3 = this.xs; _results = []; for (i = _i = 0, _len = _ref3.length; _i < _len; i = ++_i) { x = _ref3[i]; _results.push(rx.cell(i)); } return _results; }).call(this); this.onChange = new Ev(function() { return [[0, [], _.zip(_this.xs, _this.is)]]; }); } IndexedDepArray.prototype.map = function(f) { var ys; ys = new IndexedMappedDepArray(); rx.autoSub(this.onChange, function(_arg) { var a, added, i, index, removed; index = _arg[0], removed = _arg[1], added = _arg[2]; return ys.realSplice(index, removed.length, (function() { var _i, _len, _ref3, _results; _results = []; for (_i = 0, _len = added.length; _i < _len; _i++) { _ref3 = added[_i], a = _ref3[0], i = _ref3[1]; _results.push(f(a, i)); } return _results; })()); }); return ys; }; IndexedDepArray.prototype.realSplice = function(index, count, additions) { var i, newIs, offset, removed, _i, _len, _ref3, _ref4, _ref5; removed = (_ref3 = this.xs).splice.apply(_ref3, [index, count].concat(__slice.call(additions))); _ref4 = this.is.slice(index + count); for (offset = _i = 0, _len = _ref4.length; _i < _len; offset = ++_i) { i = _ref4[offset]; i.set(index + additions.length + offset); } newIs = (function() { var _j, _ref5, _results; _results = []; for (i = _j = 0, _ref5 = additions.length; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; i = 0 <= _ref5 ? ++_j : --_j) { _results.push(rx.cell(index + i)); } return _results; })(); (_ref5 = this.is).splice.apply(_ref5, [index, count].concat(__slice.call(newIs))); return this.onChange.pub([index, removed, _.zip(additions, newIs)]); }; return IndexedDepArray; })(ObsArray); IndexedMappedDepArray = rx.IndexedMappedDepArray = (function(_super) { __extends(IndexedMappedDepArray, _super); function IndexedMappedDepArray() { _ref3 = IndexedMappedDepArray.__super__.constructor.apply(this, arguments); return _ref3; } return IndexedMappedDepArray; })(IndexedDepArray); DepArray = rx.DepArray = (function(_super) { __extends(DepArray, _super); function DepArray(f, diff) { var _this = this; this.f = f; DepArray.__super__.constructor.call(this, [], diff); rx.autoSub((bind(function() { return _this.f(); })).onSet, function(_arg) { var old, val; old = _arg[0], val = _arg[1]; return _this._update(val); }); } return DepArray; })(ObsArray); IndexedArray = rx.IndexedArray = (function(_super) { __extends(IndexedArray, _super); function IndexedArray(xs) { this.xs = xs; } IndexedArray.prototype.map = function(f) { var ys; ys = new MappedDepArray(); rx.autoSub(this.xs.onChange, function(_arg) { var added, index, removed; index = _arg[0], removed = _arg[1], added = _arg[2]; return ys.realSplice(index, removed.length, added.map(f)); }); return ys; }; return IndexedArray; })(DepArray); rx.concat = function() { var repLens, xs, xss, ys; xss = 1 <= arguments.length ? __slice.call(arguments, 0) : []; ys = new MappedDepArray(); repLens = (function() { var _i, _len, _results; _results = []; for (_i = 0, _len = xss.length; _i < _len; _i++) { xs = xss[_i]; _results.push(0); } return _results; })(); xss.map(function(xs, i) { return rx.autoSub(xs.onChange, function(_arg) { var added, index, removed, xsOffset; index = _arg[0], removed = _arg[1], added = _arg[2]; xsOffset = sum(repLens.slice(0, i)); repLens[i] += added.length - removed.length; return ys.realSplice(xsOffset + index, removed.length, added); }); }); return ys; }; FakeSrcCell = rx.FakeSrcCell = (function(_super) { __extends(FakeSrcCell, _super); function FakeSrcCell(_getter, _setter) { this._getter = _getter; this._setter = _setter; } FakeSrcCell.prototype.get = function() { return this._getter(); }; FakeSrcCell.prototype.set = function(x) { return this._setter(x); }; return FakeSrcCell; })(SrcCell); FakeObsCell = rx.FakeObsCell = (function(_super) { __extends(FakeObsCell, _super); function FakeObsCell(_getter) { this._getter = _getter; } FakeObsCell.prototype.get = function() { return this._getter(); }; return FakeObsCell; })(ObsCell); SrcMapEntryCell = rx.MapEntryCell = (function(_super) { __extends(MapEntryCell, _super); function MapEntryCell(_map, _key) { this._map = _map; this._key = _key; } MapEntryCell.prototype.get = function() { return this._map.get(this._key); }; MapEntryCell.prototype.set = function(x) { return this._map.put(this._key, x); }; return MapEntryCell; })(FakeSrcCell); ObsMapEntryCell = rx.ObsMapEntryCell = (function(_super) { __extends(ObsMapEntryCell, _super); function ObsMapEntryCell(_map, _key) { this._map = _map; this._key = _key; } ObsMapEntryCell.prototype.get = function() { return this._map.get(this._key); }; return ObsMapEntryCell; })(FakeObsCell); ObsMap = rx.ObsMap = (function() { function ObsMap(x) { var _this = this; this.x = x != null ? x : {}; this.onAdd = new Ev(function() { var k, v, _results; _results = []; for (k in x) { v = x[k]; _results.push([k, v]); } return _results; }); this.onRemove = new Ev(); this.onChange = new Ev(); } ObsMap.prototype.get = function(key) { var _this = this; recorder.sub(function(target) { return rx.autoSub(_this.onAdd, function(_arg) { var subkey, val; subkey = _arg[0], val = _arg[1]; if (key === subkey) { return target.refresh(); } }); }); recorder.sub(function(target) { return rx.autoSub(_this.onChange, function(_arg) { var old, subkey, val; subkey = _arg[0], old = _arg[1], val = _arg[2]; if (key === subkey) { return target.refresh(); } }); }); recorder.sub(function(target) { return rx.autoSub(_this.onRemove, function(_arg) { var old, subkey; subkey = _arg[0], old = _arg[1]; if (key === subkey) { return target.refresh(); } }); }); return this.x[key]; }; ObsMap.prototype.all = function() { var _this = this; recorder.sub(function(target) { return rx.autoSub(_this.onAdd, function() { return target.refresh(); }); }); recorder.sub(function(target) { return rx.autoSub(_this.onChange, function() { return target.refresh(); }); }); recorder.sub(function(target) { return rx.autoSub(_this.onRemove, function() { return target.refresh(); }); }); return _.clone(this.x); }; ObsMap.prototype.realPut = function(key, val) { var old; if (key in this.x) { old = this.x[key]; this.x[key] = val; this.onChange.pub([key, old, val]); return old; } else { this.x[key] = val; this.onAdd.pub([key, val]); return void 0; } }; ObsMap.prototype.realRemove = function(key) { var val; val = popKey(this.x, key); this.onRemove.pub([key, val]); return val; }; ObsMap.prototype.cell = function(key) { return new ObsMapEntryCell(this, key); }; return ObsMap; })(); SrcMap = rx.SrcMap = (function(_super) { __extends(SrcMap, _super); function SrcMap() { _ref4 = SrcMap.__super__.constructor.apply(this, arguments); return _ref4; } SrcMap.prototype.put = function(key, val) { var _this = this; return recorder.mutating(function() { return _this.realPut(key, val); }); }; SrcMap.prototype.remove = function(key) { var _this = this; return recorder.mutating(function() { return _this.realRemove(key); }); }; SrcMap.prototype.cell = function(key) { return new SrcMapEntryCell(this, key); }; return SrcMap; })(ObsMap); DepMap = rx.DepMap = (function(_super) { __extends(DepMap, _super); function DepMap(f) { this.f = f; DepMap.__super__.constructor.call(this); rx.autoSub(new DepCell(this.f).onSet, function(_arg) { var k, old, v, val, _results; old = _arg[0], val = _arg[1]; for (k in old) { v = old[k]; if (!(k in val)) { this.realRemove(k); } } _results = []; for (k in val) { v = val[k]; if (this.x[k] !== v) { _results.push(this.realPut(k, v)); } else { _results.push(void 0); } } return _results; }); } return DepMap; })(ObsMap); rx.liftSpec = function(obj) { var name, type, val; return _.object((function() { var _i, _len, _ref5, _results; _ref5 = Object.getOwnPropertyNames(obj); _results = []; for (_i = 0, _len = _ref5.length; _i < _len; _i++) { name = _ref5[_i]; val = obj[name]; if ((val != null) && (val instanceof rx.ObsMap || val instanceof rx.ObsCell || val instanceof rx.ObsArray)) { continue; } type = _.isFunction(val) ? null : _.isArray(val) ? 'array' : 'cell'; _results.push([ name, { type: type, val: val } ]); } return _results; })()); }; rx.lift = function(x, fieldspec) { var name, spec; if (fieldspec == null) { fieldspec = rx.liftSpec(x); } for (name in fieldspec) { spec = fieldspec[name]; x[name] = (function() { switch (spec.type) { case 'cell': return rx.cell(x[name]); case 'array': return rx.array(x[name]); case 'map': return rx.map(x[name]); default: return x[name]; } })(); } return x; }; rx.unlift = function(x) { var k, v; return _.object((function() { var _results; _results = []; for (k in x) { v = x[k]; _results.push([k, v instanceof rx.ObsCell ? v.get() : v instanceof rx.ObsArray ? v.all() : v]); } return _results; })()); }; rx.reactify = function(obj, fieldspec) { var arr, methName, name, spec; if (_.isArray(obj)) { arr = rx.array(_.clone(obj)); Object.defineProperties(obj, _.object((function() { var _i, _len, _ref5, _results; _ref5 = _.functions(arr); _results = []; for (_i = 0, _len = _ref5.length; _i < _len; _i++) { methName = _ref5[_i]; if (methName !== 'length') { _results.push((function(methName) { var meth, newMeth, spec; meth = obj[methName]; newMeth = function() { var args, res, _ref6; args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; if (meth != null) { res = meth.call.apply(meth, [obj].concat(__slice.call(args))); } (_ref6 = arr[methName]).call.apply(_ref6, [arr].concat(__slice.call(args))); return res; }; spec = { configurable: true, enumerable: false, value: newMeth, writable: true }; return [methName, spec]; })(methName)); } } return _results; })())); return obj; } else { return Object.defineProperties(obj, _.object((function() { var _results; _results = []; for (name in fieldspec) { spec = fieldspec[name]; _results.push((function(name, spec) { var desc, obs, view, _ref5, _ref6; desc = null; switch (spec.type) { case 'cell': obs = rx.cell((_ref5 = spec.val) != null ? _ref5 : null); desc = { configurable: true, enumerable: true, get: function() { return obs.get(); }, set: function(x) { return obs.set(x); } }; break; case 'array': view = rx.reactify((_ref6 = spec.val) != null ? _ref6 : []); desc = { configurable: true, enumerable: true, get: function() { view.raw(); return view; }, set: function(x) { view.splice.apply(view, [0, view.length].concat(__slice.call(x))); return view; } }; break; default: throw new Error("Unknown observable type: " + type); } return [name, desc]; })(name, spec)); } return _results; })())); } }; rx.autoReactify = function(obj) { var name, type, val; return rx.reactify(obj, _.object((function() { var _i, _len, _ref5, _results; _ref5 = Object.getOwnPropertyNames(obj); _results = []; for (_i = 0, _len = _ref5.length; _i < _len; _i++) { name = _ref5[_i]; val = obj[name]; if (val instanceof ObsMap || val instanceof ObsCell || val instanceof ObsArray) { continue; } type = _.isFunction(val) ? null : _.isArray(val) ? 'array' : 'cell'; _results.push([ name, { type: type, val: val } ]); } return _results; })())); }; _.extend(rx, { cell: function(x) { return new SrcCell(x); }, array: function(xs, diff) { return new SrcArray(xs, diff); }, map: function(x) { return new SrcMap(x); } }); rx.flatten = function(xs) { return new DepArray(function() { var x; return _((function() { var _i, _len, _results; _results = []; for (_i = 0, _len = xs.length; _i < _len; _i++) { x = xs[_i]; if (x instanceof ObsArray) { _results.push(x.raw()); } else if (x instanceof ObsCell) { _results.push(x.get()); } else { _results.push(x); } } return _results; })()).chain().flatten(true).filter(function(x) { return x != null; }).value(); }); }; flatten = function(xss) { var xs; xs = _.flatten(xss); return rx.cellToArray(bind(function() { return _.flatten(xss); })); }; rx.cellToArray = function(cell, diff) { return new DepArray((function() { return cell.get(); }), diff); }; rx.basicDiff = function(key) { if (key == null) { key = rx.smartUidify; } return function(oldXs, newXs) { var i, oldKeys, x, _i, _len, _ref5, _results; oldKeys = mkMap((function() { var _i, _len, _results; _results = []; for (i = _i = 0, _len = oldXs.length; _i < _len; i = ++_i) { x = oldXs[i]; _results.push([key(x), i]); } return _results; })()); _results = []; for (_i = 0, _len = newXs.length; _i < _len; _i++) { x = newXs[_i]; _results.push((_ref5 = oldKeys[key(x)]) != null ? _ref5 : -1); } return _results; }; }; rx.uidify = function(x) { var _ref5; return (_ref5 = x.__rxUid) != null ? _ref5 : (Object.defineProperty(x, '__rxUid', { enumerable: false, value: mkuid() })).__rxUid; }; rx.smartUidify = function(x) { if (_.isObject(x)) { return rx.uidify(x); } else { return JSON.stringify(x); } }; permToSplices = function(oldLength, newXs, perm) { var cur, i, last, refs, splice, splices; refs = (function() { var _i, _len, _results; _results = []; for (_i = 0, _len = perm.length; _i < _len; _i++) { i = perm[_i]; if (i >= 0) { _results.push(i); } } return _results; })(); if (_.some((function() { var _i, _ref5, _results; _results = []; for (i = _i = 0, _ref5 = refs.length - 1; 0 <= _ref5 ? _i < _ref5 : _i > _ref5; i = 0 <= _ref5 ? ++_i : --_i) { _results.push(refs[i + 1] - refs[i] <= 0); } return _results; })())) { return null; } splices = []; last = -1; i = 0; while (i < perm.length) { while (i < perm.length && perm[i] === last + 1) { last += 1; i += 1; } splice = { index: i, count: 0, additions: [] }; while (i < perm.length && perm[i] === -1) { splice.additions.push(newXs[i]); i += 1; } cur = i === perm.length ? oldLength : perm[i]; splice.count = cur - (last + 1); if (splice.count > 0 || splice.additions.length > 0) { splices.push([splice.index, splice.count, splice.additions]); } last = cur; i += 1; } return splices; }; rx.transaction = function(f) { return depMgr.transaction(f); }; $.fn.rx = function(prop) { var checked, focused, map, val; map = this.data('rx-map'); if (map == null) { this.data('rx-map', map = mkMap()); } if (prop in map) { return map[prop]; } return map[prop] = (function() { var _this = this; switch (prop) { case 'focused': focused = rx.cell(this.is(':focus')); this.focus(function() { return focused.set(true); }); this.blur(function() { return focused.set(false); }); return focused; case 'val': val = rx.cell(this.val()); this.change(function() { return val.set(_this.val()); }); this.on('input', function() { return val.set(_this.val()); }); return val; case 'checked': checked = rx.cell(this.is(':checked')); this.change(function() { return checked.set(_this.is(':checked')); }); return checked; default: throw new Error('Unknown reactive property type'); } }).call(this); }; if (typeof exports === 'undefined') { this.rxt = rxt = {}; } else { rxt = exports; } RawHtml = rxt.RawHtml = (function() { function RawHtml(html) { this.html = html; } return RawHtml; })(); events = ["blur", "change", "click", "dblclick", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "load", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "ready", "resize", "scroll", "select", "submit", "toggle", "unload"]; specialAttrs = rxt.specialAttrs = { init: function(elt, fn) { return fn.call(elt); } }; _fn = function(ev) { return specialAttrs[ev] = function(elt, fn) { return elt[ev](function(e) { return fn.call(elt, e); }); }; }; for (_i = 0, _len = events.length; _i < _len; _i++) { ev = events[_i]; _fn(ev); } props = ['async', 'autofocus', 'checked', 'location', 'multiple', 'readOnly', 'selected', 'selectedIndex', 'tagName', 'nodeName', 'nodeType', 'ownerDocument', 'defaultChecked', 'defaultSelected']; propSet = _.object((function() { var _j, _len1, _results; _results = []; for (_j = 0, _len1 = props.length; _j < _len1; _j++) { prop = props[_j]; _results.push([prop, null]); } return _results; })()); setProp = function(elt, prop, val) { if (prop === 'value') { return elt.val(val); } else if (prop in propSet) { return elt.prop(prop, val); } else { return elt.attr(prop, val); } }; setDynProp = function(elt, prop, val, xform) { if (xform == null) { xform = _.identity; } if (val instanceof ObsCell) { return rx.autoSub(val.onSet, function(_arg) { var n, o; o = _arg[0], n = _arg[1]; return setProp(elt, prop, xform(n)); }); } else { return setProp(elt, prop, xform(val)); } }; rxt.mktag = mktag = function(tag) { return function(arg1, arg2) { var attrs, contents, elt, key, name, toNodes, updateContents, value, _ref5, _ref6; _ref5 = (arg1 == null) && (arg2 == null) ? [{}, null] : arg2 != null ? [arg1, arg2] : _.isString(arg1) || arg1 instanceof Element || arg1 instanceof RawHtml || arg1 instanceof $ || _.isArray(arg1) || arg1 instanceof ObsCell || arg1 instanceof ObsArray ? [{}, arg1] : [arg1, null], attrs = _ref5[0], contents = _ref5[1]; elt = $("<" + tag + "/>"); _ref6 = _.omit(attrs, _.keys(specialAttrs)); for (name in _ref6) { value = _ref6[name]; setDynProp(elt, name, value); } if (contents != null) { toNodes = function(contents) { var child, parsed, _j, _len1, _results; _results = []; for (_j = 0, _len1 = contents.length; _j < _len1; _j++) { child = contents[_j]; if (_.isString(child)) { _results.push(document.createTextNode(child)); } else if (child instanceof Element) { _results.push(child); } else if (child instanceof RawHtml) { parsed = $(child.html); if (parsed.length !== 1) { throw new Error('RawHtml must wrap a single element'); } _results.push(parsed[0]); } else if (child instanceof $) { if (child.length !== 1) { throw new Error('jQuery object must wrap a single element'); } _results.push(child[0]); } else { throw new Error("Unknown element type in array: " + child.constructor.name + " (must be string, Element, RawHtml, or jQuery objects)"); } } return _results; }; updateContents = function(contents) { var covers, hasWidth, left, node, nodes, top; elt.html(''); if (_.isArray(contents)) { nodes = toNodes(contents); elt.append(nodes); if (false) { hasWidth = function(node) { var e; try { return ($(node).width() != null) !== 0; } catch (_error) { e = _error; return false; } }; covers = (function() { var _j, _len1, _ref7, _ref8, _results; _ref7 = nodes != null ? nodes : []; _results = []; for (_j = 0, _len1 = _ref7.length; _j < _len1; _j++) { node = _ref7[_j]; if (!(hasWidth(node))) { continue; } _ref8 = $(node).offset(), left = _ref8.left, top = _ref8.top; _results.push($('<div/>').appendTo($('body').first()).addClass('updated-element').offset({ top: top, left: left }).width($(node).width()).height($(node).height())); } return _results; })(); return setTimeout((function() { var cover, _j, _len1, _results; _results = []; for (_j = 0, _len1 = covers.length; _j < _len1; _j++) { cover = covers[_j]; _results.push($(cover).remove()); } return _results; }), 2000); } } else if (_.isString(contents) || contents instanceof Element || contents instanceof RawHtml || contents instanceof $) { return updateContents([contents]); } else { throw new Error("Unknown type for element contents: " + contents.constructor.name + " (accepted types: string, Element, RawHtml, jQuery object of single element, or array of the aforementioned)"); } }; if (contents instanceof ObsArray) { rx.autoSub(contents.onChange, function(_arg) { var added, index, removed, toAdd; index = _arg[0], removed = _arg[1], added = _arg[2]; elt.contents().slice(index, index + removed.length).remove(); toAdd = toNodes(added); if (index === elt.contents().length) { return elt.append(toAdd); } else { return elt.contents().eq(index).before(toAdd); } }); } else if (contents instanceof ObsCell) { rx.autoSub(contents.onSet, function(_arg) { var old, val; old = _arg[0], val = _arg[1]; return updateContents(val); }); } else { updateContents(contents); } } for (key in attrs) { if (key in specialAttrs) { specialAttrs[key](elt, attrs[key], attrs, contents); } } return elt; }; }; tags = ['html', 'head', 'title', 'base', 'link', 'meta', 'style', 'script', 'noscript', 'body', 'body', 'section', 'nav', 'article', 'aside', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h1', 'h6', 'header', 'footer', 'address', 'main', 'main', 'p', 'hr', 'pre', 'blockquote', 'ol', 'ul', 'li', 'dl', 'dt', 'dd', 'dd', 'figure', 'figcaption', 'div', 'a', 'em', 'strong', 'small', 's', 'cite', 'q', 'dfn', 'abbr', 'data', 'time', 'code', 'var', 'samp', 'kbd', 'sub', 'sup', 'i', 'b', 'u', 'mark', 'ruby', 'rt', 'rp', 'bdi', 'bdo', 'span', 'br', 'wbr', 'ins', 'del', 'img', 'iframe', 'embed', 'object', 'param', 'object', 'video', 'audio', 'source', 'video', 'audio', 'track', 'video', 'audio', 'canvas', 'map', 'area', 'area', 'map', 'svg', 'math', 'table', 'caption', 'colgroup', 'col', 'tbody', 'thead', 'tfoot', 'tr', 'td', 'th', 'form', 'fieldset', 'legend', 'fieldset', 'label', 'input', 'button', 'select', 'datalist', 'optgroup', 'option', 'select', 'datalist', 'textarea', 'keygen', 'output', 'progress', 'meter', 'details', 'summary', 'details', 'menuitem', 'menu']; rxt.tags = _.object((function() { var _j, _len1, _results; _results = []; for (_j = 0, _len1 = tags.length; _j < _len1; _j++) { tag = tags[_j]; _results.push([tag, rxt.mktag(tag)]); } return _results; })()); rxt.rawHtml = function(html) { return new RawHtml(html); }; rxt.importTags = function(x) { return _(x != null ? x : _this).extend(rxt.tags); }; rxt.cast = function(opts, types) { var key, newval, value; return _.object((function() { var _results; _results = []; for (key in opts) { value = opts[key]; newval = (function() { switch (types[key]) { case 'array': if (value instanceof rx.ObsArray) { return value; } else if (_.isArray(value)) { return new rx.DepArray(function() { return value; }); } else if (value instanceof rx.ObsCell) { return new rx.DepArray(function() { return value.get(); }); } else { throw new Error('Cannot cast to array: ' + value.constructor.name); } break; case 'cell': if (value instanceof rx.ObsCell) { return value; } else { return bind(function() { return value; }); } break; default: return value; } })(); _results.push([key, newval]); } return _results; })()); }; rxt.cssify = function(map) { var k, v; return ((function() { var _results; _results = []; for (k in map) { v = map[k]; if (v != null) { _results.push("" + (_.str.dasherize(k)) + ": " + (_.isNumber(v) ? v + 'px' : v) + ";"); } } return _results; })()).join(' '); }; specialAttrs.style = function(elt, value) { return setDynProp(elt, 'style', value, function(val) { if (_.isString(val)) { return val; } else { return rxt.cssify(val); } }); }; rxt.smushClasses = function(xs) { return _(xs).chain().flatten().compact().value().join(' ').replace(/\s+/, ' ').trim(); }; specialAttrs["class"] = function(elt, value) { return setDynProp(elt, 'class', value, function(val) { if (_.isString(val)) { return val; } else { return rxt.smushClasses(val); } }); }; }).call(this);
4-add-universal/src/client.js
chemoish/react-universal-tutorial
// This will emulate a full ES6 environment. import 'babel-polyfill'; import React from 'react'; import { createHistory } from 'history'; import { Provider } from 'react-redux'; import { render } from 'react-dom'; import { Router } from 'react-router'; import { syncReduxAndRouter } from 'redux-simple-router'; import configureStore from './store/configure-store'; import Route from './route'; const history = createHistory(); const store = configureStore(); syncReduxAndRouter(history, store); const component = ( <Provider store={store} key="provider"> <Router history={history}> {Route} </Router> </Provider> ); render(component, document.getElementById('root'));
src/svg-icons/av/equalizer.js
IsenrichO/mui-with-arrows
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvEqualizer = (props) => ( <SvgIcon {...props}> <path d="M10 20h4V4h-4v16zm-6 0h4v-8H4v8zM16 9v11h4V9h-4z"/> </SvgIcon> ); AvEqualizer = pure(AvEqualizer); AvEqualizer.displayName = 'AvEqualizer'; AvEqualizer.muiName = 'SvgIcon'; export default AvEqualizer;
src/components/exercises/HasPhoneme.js
cognostics/serlo-abc
import React, { Component } from 'react'; import { View } from 'react-native'; import speakerImage from '../../assets/images/speaker.png'; import { PRIMARY } from '../../styles/colors'; import { RoundTextButton, RoundImageWithButton } from '../Components'; import { loadSound, play } from '../helpers/audio'; class HasPhoneme extends Component { constructor(props) { super(props); this.state = { highlighted: null }; } createPhonemeButton = (index, crossedOut) => { return ( <RoundTextButton onPress={() => { this.setState({ highlighted: index }); }} highlighted={index === this.state.highlighted} text={this.props.phoneme.toUpperCase() + this.props.phoneme} size={60} style={[ { marginLeft: 5, marginRight: 5 }, crossedOut && { borderWidth: 3 } ]} crossedOut={crossedOut} /> ); }; render() { return ( <View style={{ flex: 1, backgroundColor: PRIMARY, alignItems: 'center', justifyContent: 'space-around' }} > <RoundImageWithButton image={this.props.image} imageSize={150} icon={speakerImage} buttonSize={30} onPress={() => play(this.props.sound)} /> <View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }} > {this.createPhonemeButton(0, false)} {this.createPhonemeButton(1, true)} </View> </View> ); } } export default loadSound(HasPhoneme);
boilerplate/App/Containers/LaunchScreen.js
TelaClaims/ignite-tela-boilerplate
import React, { Component } from 'react' import { ScrollView, Text, Image, View } from 'react-native' import Images from 'images' // Styles import styles from './LaunchScreenStyles' export default class LaunchScreen extends Component { render () { return ( <View style={styles.mainContainer}> <Image source={Images.background} style={styles.backgroundImage} resizeMode='stretch' /> <ScrollView style={styles.container}> <View style={styles.centered}> <Image source={Images.launch} style={styles.logo} /> </View> <View style={styles.section} > <Image source={Images.ready} /> <Text style={styles.sectionText}> This probably isn't what your app is going to look like. Unless your designer handed you this screen and, in that case, congrats! You're ready to ship. For everyone else, this is where you'll see a live preview of your fully functioning app using Ignite. </Text> </View> </ScrollView> </View> ) } }
packages/react-scripts/fixtures/kitchensink/src/features/syntax/RestAndDefault.js
viankakrisna/create-react-app
/** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; function load({ id, ...rest } = { id: 0, user: { id: 42, name: '42' } }) { return [ { id: id + 1, name: '1' }, { id: id + 2, name: '2' }, { id: id + 3, name: '3' }, rest.user, ]; } export default class extends Component { static propTypes = { onReady: PropTypes.func.isRequired, }; constructor(props) { super(props); this.state = { users: [] }; } async componentDidMount() { const users = load(); this.setState({ users }); } componentDidUpdate() { this.props.onReady(); } render() { return ( <div id="feature-rest-and-default"> {this.state.users.map(user => ( <div key={user.id}>{user.name}</div> ))} </div> ); } }
ajax/libs/react-native-web/0.15.2/exports/Modal/ModalAnimation.js
cdnjs/cdnjs
/** * Copyright (c) Nicolas Gallagher. * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * */ import { useEffect, useCallback, useState, useRef } from 'react'; import StyleSheet from '../StyleSheet'; import createElement from '../createElement'; var ANIMATION_DURATION = 300; function getAnimationStyle(animationType, visible) { if (animationType === 'slide') { return visible ? animatedSlideInStyles : animatedSlideOutStyles; } if (animationType === 'fade') { return visible ? animatedFadeInStyles : animatedFadeOutStyles; } return visible ? styles.container : styles.hidden; } function ModalAnimation(props) { var animationType = props.animationType, children = props.children, onDismiss = props.onDismiss, onShow = props.onShow, visible = props.visible; var _useState = useState(false), isRendering = _useState[0], setIsRendering = _useState[1]; var wasVisible = useRef(false); var isAnimated = animationType && animationType !== 'none'; var animationEndCallback = useCallback(function (e) { if (e && e.currentTarget !== e.target) { // If the event was generated for something NOT this element we // should ignore it as it's not relevant to us return; } if (visible) { if (onShow) { onShow(); } } else { setIsRendering(false); if (onDismiss) { onDismiss(); } } }, [onDismiss, onShow, visible]); useEffect(function () { if (visible) { setIsRendering(true); } if (visible !== wasVisible.current && !isAnimated) { // Manually call `animationEndCallback` if no animation is used animationEndCallback(); } wasVisible.current = visible; }, [isAnimated, visible, animationEndCallback]); return isRendering || visible ? createElement('div', { style: isRendering ? getAnimationStyle(animationType, visible) : styles.hidden, onAnimationEnd: animationEndCallback, children: children }) : null; } var styles = StyleSheet.create({ container: { position: 'fixed', top: 0, right: 0, bottom: 0, left: 0, zIndex: 9999 }, animatedIn: { animationDuration: ANIMATION_DURATION + "ms", animationTimingFunction: 'ease-in' }, animatedOut: { pointerEvents: 'none', animationDuration: ANIMATION_DURATION + "ms", animationTimingFunction: 'ease-out' }, fadeIn: { opacity: 1, animationKeyframes: { '0%': { opacity: 0 }, '100%': { opacity: 1 } } }, fadeOut: { opacity: 0, animationKeyframes: { '0%': { opacity: 1 }, '100%': { opacity: 0 } } }, slideIn: { transform: [{ translateY: '0%' }], animationKeyframes: { '0%': { transform: [{ translateY: '100%' }] }, '100%': { transform: [{ translateY: '0%' }] } } }, slideOut: { transform: [{ translateY: '100%' }], animationKeyframes: { '0%': { transform: [{ translateY: '0%' }] }, '100%': { transform: [{ translateY: '100%' }] } } }, hidden: { opacity: 0 } }); var animatedSlideInStyles = [styles.container, styles.animatedIn, styles.slideIn]; var animatedSlideOutStyles = [styles.container, styles.animatedOut, styles.slideOut]; var animatedFadeInStyles = [styles.container, styles.animatedIn, styles.fadeIn]; var animatedFadeOutStyles = [styles.container, styles.animatedOut, styles.fadeOut]; export default ModalAnimation;
client/src/components/dashboard/Profile/Public/Table.js
FCC-Alumni/alumni-network
import { CenterAlignedWrapper } from '../../../../styles/style-utils'; import React from 'react'; const Table = ({ children, columnWidth }) => { return ( <div className={`${columnWidth} wide column`}> <CenterAlignedWrapper> <table className="ui very basic unstackable celled striped table"> <tbody> { children } </tbody> </table> </CenterAlignedWrapper> </div> ); } export default Table;
src/components/Main.js
bathpp/gallery_react
require('normalize.css/normalize.css'); require('styles/App.scss'); import React from 'react'; import ReactDOM from 'react-dom'; // url loader, return MD5 hash of the file content // let yeomanImage = require('../images/yeoman.png'); let imageData = require('../data/imageData.json'); // json object can use map? imageData = imageData.map((item) => { item.imageURL = require('../images/' + item.fileName); return item; }) // imageData = ((imageJsonData)=>{ // for (let i = 0, j = imageJsonData.length; i < j; i++) { // let singleImageData = imageJsonData[i]; // singleImageData.imageURL = require('../images/' + singleImageData.fileName); // imageJsonData[i] = singleImageData; // } // return imageJsonData; // })(imageData); // get random number between low and high let getRangeRandom = (low, high) => Math.floor(Math.random() * (high - low) + low); // random a degree to rotate, -30 ~ +30 let get30DegRandom = () => (Math.random() > 0.5 ? '' : '-') + Math.ceil(Math.random() * 30); class ImgFigure extends React.Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); } /* * handle click on img to inverse */ handleClick(e) { if (this.props.arrange.isCenter){ this.props.inverse(); } else { this.props.center(); } e.stopPropagation(); e.preventDefault(); } render(){ let styleObj = {}; // populate arranged position if (this.props.arrange.pos){ styleObj = this.props.arrange.pos; } // add rotation to imgFigure if (this.props.arrange.rotate) { (['Moz', 'ms', 'Webkit', '']).map((item) => { styleObj[item + 'Transform'] = 'rotate(' + this.props.arrange.rotate + 'deg)'; }) } // add is-inverse in className let imgFigureClassName = 'img-figure'; imgFigureClassName += this.props.arrange.isInverse ? ' is-inverse': ''; // make center pic on top if (this.props.arrange.isCenter) { styleObj['zIndex'] = 11; } return( <figure className = {imgFigureClassName} style={styleObj} onClick={this.handleClick}> <img src={this.props.data.imageURL} alt={this.props.data.title}> </img> <figcaption> <h2 className="img-title"> {this.props.data.title} </h2> <div className="img-back" onClick={this.handleClick}> <p> {this.props.data.desc} </p> </div> </figcaption> </figure> ); } } class ControllerUnit extends React.Component { // Use this // constructor(props) { // super(props); // this.handleClick = this.handleClick.bind(this); // } // or this to bind onclick // onClick={this.handleClick.bind(this)} handleClick(e) { // handle unit click if(this.props.arrange.isCenter) { this.props.inverse(); } else { this.props.center(); } e.stopPropagation(); e.preventDefault(); } render() { let controllerUnitClassName = 'controller-unit'; // modify className according to image's state if(this.props.arrange.isCenter){ controllerUnitClassName += ' is-center'; if (this.props.arrange.isInverse){ controllerUnitClassName += ' is-inverse'; } } return ( <span className={controllerUnitClassName} onClick={this.handleClick.bind(this)}></span> ); } } class GalleryByReactApp extends React.Component { constructor(props) { super(props); this.Constant = { centerPos: { left: 0, right: 0 }, hPosRange: { // horizontal leftSecX: [0, 0], rightSecX: [0, 0], y: [0, 0] }, vPosRange: { // vertical x: [0, 0], topY: [0, 0] } }; this.state = { imgArrangeArr: [ // follow the format below // { // pos:{ // left:'0', // top:'0' // }, // rotate:0, // isInverse:false // isCenter:false // } ] }; } // get pic position after mount componentDidMount() { // get stage size const stageDOM = ReactDOM.findDOMNode(this.refs.gallaryStage), stageW = stageDOM.scrollWidth, stageH = stageDOM.scrollHeight, halfStageW = Math.ceil(stageW / 2), halfStageH = Math.ceil(stageH / 2); // get imgFigure size const imgFigureDOM = ReactDOM.findDOMNode(this.refs.imgFigure0), imgW = imgFigureDOM.scrollWidth, imgH = imgFigureDOM.scrollHeight, halfImgW = Math.ceil(imgW / 2), halfImgH = Math.ceil(imgH / 2); //get the position of the center pic this.Constant.centerPos = { left: halfStageW - halfImgW, top: halfStageH - halfImgH }; //left and right pics area range this.Constant.hPosRange.leftSecX[0] = -halfImgW; this.Constant.hPosRange.leftSecX[1] = halfStageW - halfImgW * 3; this.Constant.hPosRange.rightSecX[0] = halfStageW + halfImgW; this.Constant.hPosRange.rightSecX[1] = stageW - halfImgW; this.Constant.hPosRange.y[0] = -halfImgH; this.Constant.hPosRange.y[1] = stageH - halfImgH; //top pics area range this.Constant.vPosRange.topY[0] = -halfImgH; this.Constant.vPosRange.topY[1] = halfStageH - halfImgH * 3; this.Constant.vPosRange.x[0] = halfStageW - imgW; this.Constant.vPosRange.x[1] = halfStageW; // random a pic for center, and then rearrange the rest let centerIndex = Math.floor(Math.random() * Object.keys(imageData).length); this.rearrange(centerIndex); } /* * inverse pic * @param index * @return closure, index is taken when called */ inverse (index) { return () => { const imgArrangeArr = this.state.imgArrangeArr; imgArrangeArr[index].isInverse = !imgArrangeArr[index].isInverse; this.setState( {imgArrangeArr: imgArrangeArr} ) } } /* * @param index * @return closure, index is taken when called */ center (index) { return () => { this.rearrange(index) } } /* * rearrange all the pics position * @param centerIndex */ rearrange (centerIndex){ let imgArrangeArr = this.state.imgArrangeArr, Constant = this.Constant, centerPos = Constant.centerPos, hPosRange = Constant.hPosRange, vPosRange = Constant.vPosRange, hPosRangeLeftSecX = hPosRange.leftSecX, hPosRangeRightSecX = hPosRange.rightSecX, hPosRangeY = hPosRange.y, vPosRangeTopY = vPosRange.topY, vPosRangeX = vPosRange.x, imgArrangeTopArr = [], // random 0 or 1 pic that on top area topImgNum = Math.floor(Math.random() * 2), topImgSpliceIndex = 0, imgArrangeCenterArr = imgArrangeArr.splice(centerIndex, 1); // make the center pic center imgArrangeCenterArr[0] = { pos: centerPos, rotate: 0, isCenter: true }; topImgSpliceIndex = Math.floor(Math.random() * (imgArrangeArr.length - topImgNum)); imgArrangeTopArr = imgArrangeArr.splice(topImgSpliceIndex, topImgNum); // place top area pic imgArrangeTopArr.forEach((value, index)=>{ imgArrangeTopArr[index] = { pos: { top: getRangeRandom(vPosRangeTopY[0], vPosRangeTopY[1]), left: getRangeRandom(vPosRangeX[0], vPosRangeX[1]) }, rotate: get30DegRandom(), isCenter: false }; }); // place left and right pic for (let i = 0, j = imgArrangeArr.length, k = j / 2; i < j; i++) { let hPosRangeLORX = null; // i<k is left, else is right if (i < k) { hPosRangeLORX = hPosRangeLeftSecX; } else { hPosRangeLORX = hPosRangeRightSecX; } imgArrangeArr[i] = { pos: { top: getRangeRandom(hPosRangeY[0], hPosRangeY[1]), left: getRangeRandom(hPosRangeLORX[0], hPosRangeLORX[1]) }, rotate: get30DegRandom(), isCenter: false }; } // insert the top pic back to array if (imgArrangeTopArr && imgArrangeTopArr[0]) { imgArrangeArr.splice(topImgSpliceIndex, 0, imgArrangeTopArr[0]); } // insert the center pic back to array imgArrangeArr.splice(centerIndex, 0, imgArrangeCenterArr[0]); this.setState( { imgArrangeArr: imgArrangeArr } ) } render() { let controllerUnits = [], imageFigures = []; imageData.forEach((value, index)=>{ if (!this.state.imgArrangeArr[index]){ this.state.imgArrangeArr[index] = { pos: { left: 0, top: 0 }, rotate: 0, isInverse: false, isCenter: false }; } imageFigures.push( <ImgFigure key={index} data={value} ref={'imgFigure'+index} arrange={this.state.imgArrangeArr[index]} inverse={this.inverse(index)} center={this.center(index)} /> ) controllerUnits.push ( <ControllerUnit key={index} arrange={this.state.imgArrangeArr[index]} inverse={this.inverse(index)} center={this.center(index)} /> ) }); return ( <section className="stage" ref="gallaryStage"> <section className="img-sec"> {imageFigures} </section> <nav className="controller-nav"> {controllerUnits} </nav> </section> ); } } GalleryByReactApp.defaultProps = { }; export default GalleryByReactApp;
app/containers/Root.js
AmazingHorse/ee-toolkit
// @flow import React from 'react'; import { Provider } from 'react-redux'; import { ConnectedRouter } from 'react-router-redux'; import Routes from '../routes'; type RootType = { store: {}, history: {} }; export default function Root({ store, history }: RootType) { return ( <Provider store={store}> <ConnectedRouter history={history}> <Routes /> </ConnectedRouter> </Provider> ); }
src/routes.js
apedyashev/react-calendar-app
import React from 'react'; import {Route, Redirect, IndexRedirect} from 'react-router'; import App from 'components/App'; import * as CalendarPage from 'components/Screens/Calendar'; import NotFoundView from 'components/Screens/NotFound'; export default [ <Redirect from="/" to="/calendar" />, <Route path="/" component={App}> <IndexRedirect to="calendar/week" /> <Route path="calendar" component={CalendarPage.Container}> <IndexRedirect to="week" /> <Route path="week" component={CalendarPage.Week} /> </Route> <Route path="calendar/event/:id" component={CalendarPage.EditEvent} /> <Route path="404" component={NotFoundView} /> </Route>, ];
ajax/libs/react-bootstrap-table/2.4.1/react-bootstrap-table.min.js
dlueth/cdnjs
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactBootstrapTable=t(require("react"),require("react-dom")):e.ReactBootstrapTable=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(11),a=o(n),i=r(19),s=o(i);"undefined"!=typeof window&&(window.BootstrapTable=a["default"],window.TableHeaderColumn=s["default"]),t.BootstrapTable=a["default"],t.TableHeaderColumn=s["default"]},function(t,r){t.exports=e},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={SORT_DESC:"desc",SORT_ASC:"asc",SIZE_PER_PAGE:10,NEXT_PAGE:">",LAST_PAGE:">>",PRE_PAGE:"<",FIRST_PAGE:"<<",PAGE_START_INDEX:1,ROW_SELECT_BG_COLOR:"",ROW_SELECT_NONE:"none",ROW_SELECT_SINGLE:"radio",ROW_SELECT_MULTI:"checkbox",CELL_EDIT_NONE:"none",CELL_EDIT_CLICK:"click",CELL_EDIT_DBCLICK:"dbclick",SIZE_PER_PAGE_LIST:[10,25,30,50],PAGINATION_SIZE:5,NO_DATA_TEXT:"There is no data to display",SHOW_ONLY_SELECT:"Show Selected Only",SHOW_ALL:"Show All",EXPORT_CSV_TEXT:"Export to CSV",INSERT_BTN_TEXT:"New",DELETE_BTN_TEXT:"Delete",SAVE_BTN_TEXT:"Save",CLOSE_BTN_TEXT:"Close",FILTER_DELAY:500,FILTER_TYPE:{TEXT:"TextFilter",REGEX:"RegexFilter",SELECT:"SelectFilter",NUMBER:"NumberFilter",DATE:"DateFilter",CUSTOM:"CustomFilter"}},e.exports=t["default"]},function(e,t,r){var o,n;/*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function(){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var n=typeof o;if("string"===n||"number"===n)e.push(o);else if(Array.isArray(o))e.push(r.apply(null,o));else if("object"===n)for(var i in o)a.call(o,i)&&o[i]&&e.push(i)}}return e.join(" ")}var a={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=r:(o=[],n=function(){return r}.apply(t,o),!(void 0!==n&&(e.exports=n)))}()},function(e,t){function r(){u=!1,i.length?l=i.concat(l):p=-1,l.length&&o()}function o(){if(!u){var e=setTimeout(r);u=!0;for(var t=l.length;t;){for(i=l,l=[];++p<t;)i&&i[p].run();p=-1,t=l.length}i=null,u=!1,clearTimeout(e)}}function n(e,t){this.fun=e,this.array=t}function a(){}var i,s=e.exports={},l=[],u=!1,p=-1;s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new n(e,t)),1!==l.length||u||setTimeout(o,0)},n.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=a,s.addListener=a,s.once=a,s.off=a,s.removeListener=a,s.removeAllListeners=a,s.emit=a,s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),a=o(n),i=r(2),s=o(i),l=r(3),u=o(l);t["default"]={renderReactSortCaret:function(e){var t=(0,u["default"])("order",{dropup:e===s["default"].SORT_ASC});return a["default"].createElement("span",{className:t},a["default"].createElement("span",{className:"caret",style:{margin:"10px 5px"}}))},getScrollBarWidth:function(){var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var r=e.offsetWidth;t.style.overflow="scroll";var o=e.offsetWidth;return r===o&&(o=t.clientWidth),document.body.removeChild(t),r-o},canUseDOM:function(){return"undefined"!=typeof window&&"undefined"!=typeof window.document}},e.exports=t["default"]},function(e,r){e.exports=t},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},a=r(1),i=o(a),s=function(e,t,r,o,a,s){if(e===!0||e===!1&&s||"string"==typeof e){var l=e?"text":e;return i["default"].createElement("input",n({},t,{type:l,defaultValue:a,className:(o||"")+" form-control editor edit-text"}))}if(!e){var l=e?"text":e;return i["default"].createElement("input",n({},t,{type:l,defaultValue:a,disabled:"disabled",className:(o||"")+" form-control editor edit-text"}))}if(e&&(void 0===e.type||null===e.type||""===e.type.trim())){var l=e?"text":e;return i["default"].createElement("input",n({},t,{type:l,defaultValue:a,className:(o||"")+" form-control editor edit-text"}))}if(e.type){if(e.style&&(t.style=e.style),t.className=(o||"")+" form-control editor edit-"+e.type+(e.className?" "+e.className:""),"select"===e.type){var u=[],p=e.options.values;return Array.isArray(p)&&!function(){var e=void 0;u=p.map(function(t,o){return e=r?r(t):t,i["default"].createElement("option",{key:"option"+o,value:t},e)})}(),i["default"].createElement("select",n({},t,{defaultValue:a}),u)}if("textarea"!==e.type){if("checkbox"===e.type){var p="true:false";e.options&&e.options.values&&(p=e.options.values),t.className=t.className.replace("form-control",""),t.className+=" checkbox pull-right";var c=a&&a.toString()===p.split(":")[0]?!0:!1;return i["default"].createElement("input",n({},t,{type:"checkbox",value:p,defaultChecked:c}))}return"datetime"===e.type?i["default"].createElement("input",n({},t,{type:"datetime-local",defaultValue:a})):i["default"].createElement("input",n({},t,{type:"text",defaultValue:a}))}var d=function(){e.cols&&(t.cols=e.cols),e.rows&&(t.rows=e.rows);var r=void 0,o=t.onKeyDown;return o&&(t.onKeyDown=function(e){13!==e.keyCode&&o(e)},r=i["default"].createElement("button",{className:"btn btn-info btn-xs textarea-save-btn",onClick:o},"save")),{v:i["default"].createElement("div",null,i["default"].createElement("textarea",n({},t,{defaultValue:a})),r)}}();if("object"==typeof d)return d.v}return i["default"].createElement("input",n({},t,{type:"text",className:(o||"")+" form-control editor edit-text"}))};t["default"]=s,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(37),c=u["default"].createFactory(p.ToastMessage.animation),d=function(e){function t(){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),i(t,[{key:"notice",value:function(e,t,r){this.refs.toastr[e](t,r,{mode:"single",timeOut:5e3,extendedTimeOut:1e3,showAnimation:"animated bounceIn",hideAnimation:"animated bounceOut"})}},{key:"render",value:function(){return u["default"].createElement(p.ToastContainer,{ref:"toastr",toastMessageFactory:c,id:"toast-container",className:"toast-top-right"})}}]),t}(l.Component);t["default"]=d,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.jQuery=t.animation=void 0;var a=r(1),i=o(a),s=r(10),l=o(s),u=r(3),p=o(u),c=r(35),d=o(c),f=r(36),h=o(f),y={displayName:"ToastMessage",getDefaultProps:function(){var e={error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"};return{className:"toast",iconClassNames:e,titleClassName:"toast-title",messageClassName:"toast-message",tapToDismiss:!0,closeButton:!1}},handleOnClick:function(e){this.props.handleOnClick(e),this.props.tapToDismiss&&this.hideToast(!0)},_handle_close_button_click:function(e){e.stopPropagation(),this.hideToast(!0)},_handle_remove:function(){this.props.handleRemove(this.props.toastId)},_render_close_button:function(){return this.props.closeButton?i["default"].createElement("button",{className:"toast-close-button",role:"button",onClick:this._handle_close_button_click,dangerouslySetInnerHTML:{__html:"&times;"}}):!1},_render_title_element:function(){return this.props.title?i["default"].createElement("div",{className:this.props.titleClassName},this.props.title):!1},_render_message_element:function(){return this.props.message?i["default"].createElement("div",{className:this.props.messageClassName},this.props.message):!1},render:function(){var e=this.props.iconClassName||this.props.iconClassNames[this.props.type];return i["default"].createElement("div",{className:(0,p["default"])(this.props.className,e),style:this.props.style,onClick:this.handleOnClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},this._render_close_button(),this._render_title_element(),this._render_message_element())}},v=t.animation=i["default"].createClass((0,l["default"])(y,{displayName:{$set:"ToastMessage.animation"},mixins:{$set:[d["default"]]}})),m=t.jQuery=i["default"].createClass((0,l["default"])(y,{displayName:{$set:"ToastMessage.jQuery"},mixins:{$set:[h["default"]]}}));y.handleMouseEnter=n,y.handleMouseLeave=n,y.hideToast=n;var g=i["default"].createClass(y);g.animation=v,g.jQuery=m,t["default"]=g},function(e,t,r){e.exports=r(40)},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(1),p=o(u),c=r(2),d=o(c),f=r(18),h=o(f),y=r(14),v=o(y),m=r(28),g=o(m),b=r(30),T=o(b),E=r(17),P=o(E),_=r(29),w=r(5),O=o(w),S=r(21),C=o(S),k=r(12),R=function(e){function t(e){var r=this;if(n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleSort=function(e,t){if(r.props.options.onSortChange&&r.props.options.onSortChange(t,e,r.props),r.isRemoteDataSource())return void r.store.setSortInfo(e,t);var o=r.store.sort(e,t).get();r.setState({data:o})},this.handlePaginationData=function(e,t){var o=r.props.options,n=o.onPageChange,a=o.pageStartIndex;if(n&&n(e,t),r.setState({currPage:e,sizePerPage:t}),!r.isRemoteDataSource()){var i=void 0;if(void 0!==a){var s=Math.abs(d["default"].PAGE_START_INDEX-a);i=e+s}else i=e;var l=r.store.page(i,t).get();r.setState({data:l})}},this.handleMouseLeave=function(){r.props.options.onMouseLeave&&r.props.options.onMouseLeave()},this.handleMouseEnter=function(){r.props.options.onMouseEnter&&r.props.options.onMouseEnter()},this.handleRowMouseOut=function(e,t){r.props.options.onRowMouseOut&&r.props.options.onRowMouseOut(e,t)},this.handleRowMouseOver=function(e,t){r.props.options.onRowMouseOver&&r.props.options.onRowMouseOver(e,t)},this.handleRowClick=function(e){r.props.options.onRowClick&&r.props.options.onRowClick(e)},this.handleSelectAllRow=function(e){var t=e.currentTarget.checked,o=r.store.getKeyField(),n=r.props.selectRow,a=n.onSelectAll,i=n.unselectable,s=[],l=!0,u=r.store.get();t&&i&&i.length>0&&(u=u.filter(function(e){return-1===i.indexOf(e[o])})),a&&(l=r.props.selectRow.onSelectAll(t,t?u:r.store.getRowByKey(r.state.selectedRowKeys))),("undefined"==typeof l||l!==!1)&&(t&&(s=Array.isArray(l)?l:u.map(function(e){return e[o]})),r.store.setSelectedRowKey(s),r.setState({selectedRowKeys:s}))},this.handleShowOnlySelected=function(){r.store.ignoreNonSelected();var e=void 0;e=r.props.pagination?r.store.page(1,r.state.sizePerPage).get():r.store.get(),r.setState({data:e,currPage:r.props.options.pageStartIndex||d["default"].PAGE_START_INDEX})},this.handleSelectRow=function(e,t,o){var n=!0,a=r.store.getSelectedRowKeys(),i=e[r.store.getKeyField()],s=r.props.selectRow;s.onSelect&&(n=s.onSelect(e,t,o)),("undefined"==typeof n||n!==!1)&&(s.mode===d["default"].ROW_SELECT_SINGLE?a=t?[i]:[]:t?a.push(i):a=a.filter(function(e){return i!==e}),r.store.setSelectedRowKey(a),r.setState({selectedRowKeys:a}))},this.handleAddRow=function(e){var t=r.props.options.onAddRow;if(t){var o=r.store.getColInfos();t(e,o)}if(r.isRemoteDataSource())return r.props.options.afterInsertRow&&r.props.options.afterInsertRow(e),null;try{r.store.add(e)}catch(n){return n}r._handleAfterAddingRow(e)},this.getPageByRowKey=function(e){var t=r.state.sizePerPage,o=r.store.getCurrentDisplayData(),n=r.store.getKeyField(),a=o.findIndex(function(t){return t[n]===e});return a>-1?parseInt(a/t,10)+1:a},this.handleDropRow=function(e){var t=e?e:r.store.getSelectedRowKeys();t&&t.length>0&&(r.props.options.handleConfirmDeleteRow?r.props.options.handleConfirmDeleteRow(function(){r.deleteRow(t)},t):confirm("Are you sure you want to delete?")&&r.deleteRow(t))},this.handleFilterData=function(e){var t=r.props.options.onFilterChange;if(t){var o=r.store.getColInfos();t(e,o)}if(r.setState({currPage:r.props.options.pageStartIndex||d["default"].PAGE_START_INDEX}),r.isRemoteDataSource())return void(r.props.options.afterColumnFilter&&r.props.options.afterColumnFilter(e,r.store.getDataIgnoringPagination()));r.store.filter(e);var n=r.store.getSortInfo();n&&r.store.sort(n.order,n.sortField);var a=void 0;if(r.props.pagination){var i=r.state.sizePerPage;a=r.store.page(1,i).get()}else a=r.store.get();r.props.options.afterColumnFilter&&r.props.options.afterColumnFilter(e,r.store.getDataIgnoringPagination()),r.setState({data:a})},this.handleExportCSV=function(){var e={},t=r.props.csvFileName,o=r.props.options.onExportToCSV;e=o?o():r.store.getDataIgnoringPagination();var n=[];r.props.children.map(function(e){(e.props["export"]===!0||"undefined"==typeof e.props["export"]&&e.props.hidden===!1)&&n.push({field:e.props.dataField,format:e.props.csvFormat,header:e.props.csvHeader||e.props.dataField})}),"function"==typeof t&&(t=t()),(0,C["default"])(e,n,t)},this.handleSearch=function(e){var t=r.props.options.onSearchChange;if(t){var o=r.store.getColInfos();t(e,o,r.props.multiColumnSearch)}if(r.setState({currPage:r.props.options.pageStartIndex||d["default"].PAGE_START_INDEX}),r.isRemoteDataSource())return void(r.props.options.afterSearch&&r.props.options.afterSearch(e,r.store.getDataIgnoringPagination()));r.store.search(e);var n=void 0;if(r.props.pagination){var a=r.state.sizePerPage;n=r.store.page(1,a).get()}else n=r.store.get();r.props.options.afterSearch&&r.props.options.afterSearch(e,r.store.getDataIgnoringPagination()),r.setState({data:n})},this._scrollHeader=function(e){r.refs.header.refs.container.scrollLeft=e.currentTarget.scrollLeft},this._adjustTable=function(){r._adjustHeaderWidth(),r._adjustHeight()},this._adjustHeaderWidth=function(){var e=r.refs.header.refs.header,t=r.refs.header.refs.container,o=r.refs.body.refs.tbody,n=o.childNodes[0],a=t.offsetWidth!==o.parentNode.offsetWidth,i=a?O["default"].getScrollBarWidth():0;if(n&&r.store.getDataNum())for(var s=n.childNodes,l=0;l<s.length;l++){var u=s[l],p=getComputedStyle(u),c=parseFloat(p.width.replace("px",""));if(r.isIE){var d=parseFloat(p.paddingLeft.replace("px","")),f=parseFloat(p.paddingRight.replace("px","")),h=parseFloat(p.borderRightWidth.replace("px","")),y=parseFloat(p.borderLeftWidth.replace("px",""));c=c+d+f+h+y}var v=s.length-1===l?i:0;0>=c&&(c=120,u.width=c+v+"px");var m=c+v+"px";e.childNodes[l].style.width=m,e.childNodes[l].style.minWidth=m}},this._adjustHeight=function(){("number"==typeof r.props.height&&!isNaN(r.props.height)||-1===r.props.height.indexOf("%"))&&(r.refs.body.refs.container.style.height=parseFloat(r.props.height,10)-r.refs.header.refs.container.offsetHeight+"px")},this.isIE=!1,this._attachCellEditFunc(),O["default"].canUseDOM()&&(this.isIE=document.documentMode),this.store=new _.TableDataStore(this.props.data.slice()),this.initTable(this.props),this.filter&&this.filter.on("onFilterChange",function(e){r.handleFilterData(e)}),this.props.selectRow&&this.props.selectRow.selected){var o=this.props.selectRow.selected.slice();this.store.setSelectedRowKey(o)}var a=d["default"].PAGE_START_INDEX;"undefined"!=typeof this.props.options.page?a=this.props.options.page:"undefined"!=typeof this.props.options.pageStartIndex&&(a=this.props.options.pageStartIndex),this.state={data:this.getTableData(),currPage:a,sizePerPage:this.props.options.sizePerPage||d["default"].SIZE_PER_PAGE_LIST[0],selectedRowKeys:this.store.getSelectedRowKeys()}}return a(t,e),s(t,[{key:"initTable",value:function(e){var t=this,r=e.keyField,o="string"==typeof r&&r.length;if(p["default"].Children.forEach(e.children,function(e){if(e.props.isKey){if(r)throw"Error. Multiple key column be detected in TableHeaderColumn.";r=e.props.dataField}e.props.filter&&(t.filter||(t.filter=new k.Filter),e.props.filter.emitter=t.filter)}),this.colInfos=this.getColumnsDescription(e).reduce(function(e,t){return e[t.name]=t,e},{}),!o&&!r)throw"Error. No any key column defined in TableHeaderColumn.\n Use 'isKey={true}' to specify a unique column after version 0.5.4.";this.store.setProps({isPagination:e.pagination,keyField:r,colInfos:this.colInfos,multiColumnSearch:e.multiColumnSearch,remote:this.isRemoteDataSource()})}},{key:"getTableData",value:function(){var e=[],t=this.props,r=t.options,o=t.pagination,n=r.defaultSortName||r.sortName,a=r.defaultSortOrder||r.sortOrder,i=r.defaultSearch;if(n&&a&&this.store.sort(a,n),i&&this.store.search(i),o){var s=void 0,l=void 0;this.store.isChangedPage()?(l=this.state.sizePerPage,s=this.state.currPage):(l=r.sizePerPage||d["default"].SIZE_PER_PAGE_LIST[0],s=r.page||1),e=this.store.page(s,l).get()}else e=this.store.get();return e}},{key:"getColumnsDescription",value:function(e){var t=e.children;return p["default"].Children.map(t,function(e,t){return{name:e.props.dataField,align:e.props.dataAlign,sort:e.props.dataSort,format:e.props.dataFormat,formatExtraData:e.props.formatExtraData,filterFormatted:e.props.filterFormatted,filterValue:e.props.filterValue,editable:e.props.editable,customEditor:e.props.customEditor,hidden:e.props.hidden,hiddenOnInsert:e.props.hiddenOnInsert,searchable:e.props.searchable,className:e.props.columnClassName,columnTitle:e.props.columnTitle,width:e.props.width,text:e.props.children,sortFunc:e.props.sortFunc,sortFuncExtraData:e.props.sortFuncExtraData,"export":e.props["export"],index:t}})}},{key:"componentWillReceiveProps",value:function(e){this.initTable(e);var t=e.options,r=e.selectRow;this.store.setData(e.data.slice());var o=this.state.currPage;this.props.options.page!==t.page&&(o=t.page);var n=this.state.sizePerPage;if(this.props.options.sizePerPage!==t.sizePerPage&&(n=t.sizePerPage),this.isRemoteDataSource())this.setState({data:e.data.slice(),currPage:o});else{!t.page&&o>Math.ceil(e.data.length/n)&&(o=1);var a=this.store.getSortInfo(),i=t.sortName||(a?a.sortField:void 0),s=t.sortOrder||(a?a.order:void 0);i&&s&&this.store.sort(s,i);var l=this.store.page(o,n).get();this.setState({data:l,currPage:o,sizePerPage:n})}if(r&&r.selected){var u=r.selected.slice();this.store.setSelectedRowKey(u),this.setState({selectedRowKeys:u})}}},{key:"componentDidMount",value:function(){this._adjustTable(),window.addEventListener("resize",this._adjustTable),this.refs.body.refs.container.addEventListener("scroll",this._scrollHeader)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this._adjustTable),this.refs.body.refs.container.removeEventListener("scroll",this._scrollHeader),this.filter&&this.filter.removeAllListeners("onFilterChange")}},{key:"componentDidUpdate",value:function(){this._adjustTable(),this._attachCellEditFunc(),this.props.options.afterTableComplete&&this.props.options.afterTableComplete()}},{key:"_attachCellEditFunc",value:function(){var e=this.props.cellEdit;e&&(this.props.cellEdit.__onCompleteEdit__=this.handleEditCell.bind(this),e.mode!==d["default"].CELL_EDIT_NONE&&(this.props.selectRow.clickToSelect=!1))}},{key:"isRemoteDataSource",value:function(e){return(e||this.props).remote}},{key:"render",value:function(){var e={height:this.props.height,maxHeight:this.props.maxHeight},t=this.getColumnsDescription(this.props),r=this.store.getSortInfo(),o=this.renderPagination(),n=this.renderToolBar(),a=this.renderTableFilter(t),s=this.isSelectAll(),l=this.props.options.sortIndicator;return"undefined"==typeof this.props.options.sortIndicator&&(l=!0),p["default"].createElement("div",{className:"react-bs-table-container",style:this.props.containerStyle},n,p["default"].createElement("div",{className:"react-bs-table",ref:"table",style:i({},e,this.props.tableStyle),onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},p["default"].createElement(h["default"],{ref:"header",tableHeaderClass:this.props.tableHeaderClass,style:this.props.headerStyle,rowSelectType:this.props.selectRow.mode,hideSelectColumn:this.props.selectRow.hideSelectColumn,sortName:r?r.sortField:void 0,sortOrder:r?r.order:void 0,sortIndicator:l,onSort:this.handleSort,onSelectAllRow:this.handleSelectAllRow,bordered:this.props.bordered,condensed:this.props.condensed,isFiltered:this.filter?!0:!1,isSelectAll:s},this.props.children),p["default"].createElement(v["default"],{ref:"body",tableBodyClass:this.props.tableBodyClass,style:i({},e,this.props.bodyStyle),data:this.state.data,columns:t,trClassName:this.props.trClassName,striped:this.props.striped,bordered:this.props.bordered,hover:this.props.hover,keyField:this.store.getKeyField(),condensed:this.props.condensed,selectRow:this.props.selectRow,cellEdit:this.props.cellEdit,selectedRowKeys:this.state.selectedRowKeys,onRowClick:this.handleRowClick,onRowMouseOver:this.handleRowMouseOver,onRowMouseOut:this.handleRowMouseOut,onSelectRow:this.handleSelectRow,noDataText:this.props.options.noDataText})),a,o)}},{key:"isSelectAll",value:function(){if(this.store.isEmpty())return!1;var e=this.store.getSelectedRowKeys(),t=this.store.getAllRowkey();if(0===e.length)return!1;var r=0,o=0;return e.forEach(function(e){-1!==t.indexOf(e)?r++:o++}),o===e.length?!1:r===t.length?!0:"indeterminate"}},{key:"cleanSelected",value:function(){this.store.setSelectedRowKey([]),this.setState({selectedRowKeys:[]})}},{key:"handleEditCell",value:function(e,t,r){var o=this.props.cellEdit,n=o.beforeSaveCell,a=o.afterSaveCell,i=void 0;if(p["default"].Children.forEach(this.props.children,function(e,t){return t===r?(i=e.props.dataField,!1):void 0}),n){var s=n(this.state.data[t],i,e);if(!s&&"undefined"!=typeof s)return void this.setState({data:this.store.get()})}var l=this.store.edit(e,t,i).get();this.setState({data:l}),a&&a(this.state.data[t],i,e)}},{key:"handleAddRowAtBegin",value:function(e){try{this.store.addAtBegin(e)}catch(t){return t}this._handleAfterAddingRow(e)}},{key:"getSizePerPage",value:function(){return this.state.sizePerPage}},{key:"getCurrentPage",value:function(){return this.state.currPage}},{key:"getTableDataIgnorePaging",value:function(){return this.store.getCurrentDisplayData()}},{key:"deleteRow",value:function(e){var t=this.props.options.onDeleteRow;if(t&&t(e),this.store.setSelectedRowKey([]),this.isRemoteDataSource())return void(this.props.options.afterDeleteRow&&this.props.options.afterDeleteRow(e));this.store.remove(e);var r=void 0;if(this.props.pagination){var o=this.state.sizePerPage,n=Math.ceil(this.store.getDataNum()/o),a=this.state.currPage;a>n&&(a=n),r=this.store.page(a,o).get(),this.setState({data:r,selectedRowKeys:this.store.getSelectedRowKeys(),currPage:a})}else r=this.store.get(),this.setState({data:r,selectedRowKeys:this.store.getSelectedRowKeys()});this.props.options.afterDeleteRow&&this.props.options.afterDeleteRow(e)}},{key:"renderPagination",value:function(){if(this.props.pagination){var e=void 0;e=this.isRemoteDataSource()?this.props.fetchInfo.dataTotalSize:this.store.getDataNum();var t=this.props.options;return Math.ceil(e/this.state.sizePerPage)<=1&&this.props.ignoreSinglePage?null:p["default"].createElement("div",{className:"react-bs-table-pagination"},p["default"].createElement(g["default"],{ref:"pagination",currPage:this.state.currPage,changePage:this.handlePaginationData,sizePerPage:this.state.sizePerPage,sizePerPageList:t.sizePerPageList||d["default"].SIZE_PER_PAGE_LIST,pageStartIndex:t.pageStartIndex,paginationShowsTotal:t.paginationShowsTotal,paginationSize:t.paginationSize||d["default"].PAGINATION_SIZE,remote:this.isRemoteDataSource(),dataSize:e,onSizePerPageList:t.onSizePerPageList,prePage:t.prePage||d["default"].PRE_PAGE,nextPage:t.nextPage||d["default"].NEXT_PAGE,firstPage:t.firstPage||d["default"].FIRST_PAGE,lastPage:t.lastPage||d["default"].LAST_PAGE,hideSizePerPage:t.hideSizePerPage}))}return null}},{key:"renderToolBar",value:function(){var e=this.props,t=e.selectRow,r=e.insertRow,o=e.deleteRow,n=e.search,a=e.children,i=t&&t.showOnlySelected;if(i||r||o||n||this.props.exportCSV){var s=void 0;return s=Array.isArray(a)?a.map(function(e,t){var r=e.props;return{name:r.children,field:r.dataField,hiddenOnInsert:r.hiddenOnInsert,autoValue:r.autoValue||!1,editable:r.editable&&"function"==typeof r.editable?r.editable():r.editable,format:r.dataFormat?function(e){return r.dataFormat(e,null,r.formatExtraData,t).replace(/<.*?>/g,"")}:!1}}):[{name:a.props.children,field:a.props.dataField,editable:a.props.editable,hiddenOnInsert:a.props.hiddenOnInsert}],p["default"].createElement("div",{className:"react-bs-table-tool-bar"},p["default"].createElement(T["default"],{defaultSearch:this.props.options.defaultSearch,clearSearch:this.props.options.clearSearch,searchDelayTime:this.props.options.searchDelayTime,enableInsert:r,enableDelete:o,enableSearch:n,enableExportCSV:this.props.exportCSV,enableShowOnlySelected:i,columns:s,searchPlaceholder:this.props.searchPlaceholder,exportCSVText:this.props.options.exportCSVText,insertText:this.props.options.insertText,deleteText:this.props.options.deleteText,saveText:this.props.options.saveText,closeText:this.props.options.closeText,ignoreEditable:this.props.options.ignoreEditable,onAddRow:this.handleAddRow,onDropRow:this.handleDropRow,onSearch:this.handleSearch,onExportCSV:this.handleExportCSV,onShowOnlySelected:this.handleShowOnlySelected}))}return null}},{key:"renderTableFilter",value:function(e){return this.props.columnFilter?p["default"].createElement(P["default"],{columns:e,rowSelectType:this.props.selectRow.mode,onFilter:this.handleFilterData}):null}},{key:"_handleAfterAddingRow",value:function(e){var t=void 0;if(this.props.pagination){var r=this.state.sizePerPage,o=Math.ceil(this.store.getDataNum()/r);t=this.store.page(o,r).get(),this.setState({data:t,currPage:o})}else t=this.store.get(),this.setState({data:t});this.props.options.afterInsertRow&&this.props.options.afterInsertRow(e)}}]),t}(u.Component);R.propTypes={keyField:u.PropTypes.string,height:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.number]),maxHeight:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.number]),data:u.PropTypes.oneOfType([u.PropTypes.array,u.PropTypes.object]),remote:u.PropTypes.bool,striped:u.PropTypes.bool,bordered:u.PropTypes.bool,hover:u.PropTypes.bool,condensed:u.PropTypes.bool,pagination:u.PropTypes.bool,searchPlaceholder:u.PropTypes.string,selectRow:u.PropTypes.shape({mode:u.PropTypes.oneOf([d["default"].ROW_SELECT_NONE,d["default"].ROW_SELECT_SINGLE,d["default"].ROW_SELECT_MULTI]),bgColor:u.PropTypes.string,selected:u.PropTypes.array,onSelect:u.PropTypes.func,onSelectAll:u.PropTypes.func,clickToSelect:u.PropTypes.bool,hideSelectColumn:u.PropTypes.bool,clickToSelectAndEditCell:u.PropTypes.bool,showOnlySelected:u.PropTypes.bool,unselectable:u.PropTypes.array}),cellEdit:u.PropTypes.shape({mode:u.PropTypes.string,blurToSave:u.PropTypes.bool,beforeSaveCell:u.PropTypes.func,afterSaveCell:u.PropTypes.func}),insertRow:u.PropTypes.bool,deleteRow:u.PropTypes.bool,search:u.PropTypes.bool,columnFilter:u.PropTypes.bool,trClassName:u.PropTypes.any,tableStyle:u.PropTypes.object,containerStyle:u.PropTypes.object,headerStyle:u.PropTypes.object,bodyStyle:u.PropTypes.object,tableHeaderClass:u.PropTypes.string,tableBodyClass:u.PropTypes.string,options:u.PropTypes.shape({clearSearch:u.PropTypes.bool,sortName:u.PropTypes.string,sortOrder:u.PropTypes.string,defaultSortName:u.PropTypes.string,defaultSortOrder:u.PropTypes.string,sortIndicator:u.PropTypes.bool,afterTableComplete:u.PropTypes.func,afterDeleteRow:u.PropTypes.func,afterInsertRow:u.PropTypes.func,afterSearch:u.PropTypes.func,afterColumnFilter:u.PropTypes.func,onRowClick:u.PropTypes.func,page:u.PropTypes.number,pageStartIndex:u.PropTypes.number,paginationShowsTotal:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.func]),sizePerPageList:u.PropTypes.array,sizePerPage:u.PropTypes.number,paginationSize:u.PropTypes.number,hideSizePerPage:u.PropTypes.bool,onSortChange:u.PropTypes.func,onPageChange:u.PropTypes.func,onSizePerPageList:u.PropTypes.func,onFilterChange:p["default"].PropTypes.func,onSearchChange:p["default"].PropTypes.func,onAddRow:p["default"].PropTypes.func,onExportToCSV:p["default"].PropTypes.func,noDataText:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.object]),handleConfirmDeleteRow:u.PropTypes.func,prePage:u.PropTypes.string,nextPage:u.PropTypes.string,firstPage:u.PropTypes.string,lastPage:u.PropTypes.string,searchDelayTime:u.PropTypes.number,exportCSVText:u.PropTypes.string,insertText:u.PropTypes.string,deleteText:u.PropTypes.string,saveText:u.PropTypes.string,closeText:u.PropTypes.string,ignoreEditable:u.PropTypes.bool,defaultSearch:u.PropTypes.string}),fetchInfo:u.PropTypes.shape({dataTotalSize:u.PropTypes.number}),exportCSV:u.PropTypes.bool,csvFileName:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.func]),ignoreSinglePage:u.PropTypes.bool},R.defaultProps={height:"100%",maxHeight:void 0,striped:!1,bordered:!0,hover:!1,condensed:!1,pagination:!1,searchPlaceholder:void 0,selectRow:{mode:d["default"].ROW_SELECT_NONE,bgColor:d["default"].ROW_SELECT_BG_COLOR,selected:[],onSelect:void 0,onSelectAll:void 0,clickToSelect:!1,hideSelectColumn:!1,clickToSelectAndEditCell:!1,showOnlySelected:!1,unselectable:[]},cellEdit:{mode:d["default"].CELL_EDIT_NONE,blurToSave:!1,beforeSaveCell:void 0,afterSaveCell:void 0},insertRow:!1,deleteRow:!1,search:!1,multiColumnSearch:!1,columnFilter:!1,trClassName:"",tableStyle:void 0,containerStyle:void 0,headerStyle:void 0,bodyStyle:void 0,tableHeaderClass:null,tableBodyClass:null,options:{clearSearch:!1,sortName:void 0,sortOrder:void 0,defaultSortName:void 0,defaultSortOrder:void 0,sortIndicator:!0,afterTableComplete:void 0,afterDeleteRow:void 0,afterInsertRow:void 0,afterSearch:void 0,afterColumnFilter:void 0,onRowClick:void 0,onMouseLeave:void 0,onMouseEnter:void 0,onRowMouseOut:void 0,onRowMouseOver:void 0,page:void 0,paginationShowsTotal:!1,sizePerPageList:d["default"].SIZE_PER_PAGE_LIST,sizePerPage:void 0,paginationSize:d["default"].PAGINATION_SIZE,hideSizePerPage:!1,onSizePerPageList:void 0,noDataText:void 0,handleConfirmDeleteRow:void 0,prePage:d["default"].PRE_PAGE,nextPage:d["default"].NEXT_PAGE,firstPage:d["default"].FIRST_PAGE,lastPage:d["default"].LAST_PAGE,pageStartIndex:void 0,searchDelayTime:void 0,exportCSVText:d["default"].EXPORT_CSV_TEXT,insertText:d["default"].INSERT_BTN_TEXT,deleteText:d["default"].DELETE_BTN_TEXT,saveText:d["default"].SAVE_BTN_TEXT,closeText:d["default"].CLOSE_BTN_TEXT,ignoreEditable:!1,defaultSearch:""},fetchInfo:{dataTotalSize:0},exportCSV:!1,csvFileName:"spreadsheet.csv",ignoreSinglePage:!1},t["default"]=R,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{ value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(2),u=o(l),p=r(46),c=function(e){function t(e){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.currentFilter={}}return a(t,e),i(t,[{key:"handleFilter",value:function(e,t,r){var o=r||u["default"].FILTER_TYPE.CUSTOM;if(null!==t&&"object"==typeof t){var n=!0;for(var a in t)if(!t[a]||""===t[a]){n=!1;break}n?this.currentFilter[e]={value:t,type:o}:delete this.currentFilter[e]}else t&&""!==t.trim()?this.currentFilter[e]={value:t.trim(),type:o}:delete this.currentFilter[e];this.emit("onFilterChange",this.currentFilter)}}]),t}(p.EventEmitter);t.Filter=c},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=function(e){function t(){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),i(t,[{key:"render",value:function(){return u["default"].createElement("th",{style:{textAlign:"center"}},this.props.children)}}]),t}(l.Component);p.propTypes={children:l.PropTypes.node},t["default"]=p,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(2),c=o(p),d=r(20),f=o(d),h=r(15),y=o(h),v=r(16),m=o(v),g=r(3),b=o(g),T=function(e){return e&&"function"==typeof e},E=function(e){function t(e){var r=this;n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleRowMouseOut=function(e,t){var o=r.props.data[e];r.props.onRowMouseOut(o,t)},this.handleRowMouseOver=function(e,t){var o=r.props.data[e];r.props.onRowMouseOver(o,t)},this.handleRowClick=function(e){var t=void 0,o=r.props,n=o.data,a=o.onRowClick;n.forEach(function(r,o){o===e-1&&(t=r)}),a(t)},this.handleSelectRow=function(e,t,o){var n=void 0,a=r.props,i=a.data,s=a.onSelectRow;i.forEach(function(t,r){return r===e-1?(n=t,!1):void 0}),s(n,t,o)},this.handleSelectRowColumChange=function(e){r.props.selectRow.clickToSelect&&r.props.selectRow.clickToSelectAndEditCell||r.handleSelectRow(e.currentTarget.parentElement.parentElement.rowIndex+1,e.currentTarget.checked,e)},this.handleEditCell=function(e,t,o){r.editing=!0,r._isSelectRowDefined()&&(t--,r.props.selectRow.hideSelectColumn&&t++),e--;var n={currEditCell:{rid:e,cid:t}};if(r.props.selectRow.clickToSelectAndEditCell&&r.props.cellEdit.mode!==c["default"].CELL_EDIT_DBCLICK){var a=-1!==r.props.selectedRowKeys.indexOf(r.props.data[e][r.props.keyField]);r.handleSelectRow(e+1,!a,o)}r.setState(n)},this.handleCompleteEditCell=function(e,t,o){r.setState({currEditCell:null}),null!==e&&r.props.cellEdit.__onCompleteEdit__(e,t,o)},this.state={currEditCell:null},this.editing=!1}return a(t,e),i(t,[{key:"render",value:function(){var e=(0,b["default"])("table",{"table-striped":this.props.striped,"table-bordered":this.props.bordered,"table-hover":this.props.hover,"table-condensed":this.props.condensed},this.props.tableBodyClass),t=this.props.selectRow.unselectable||[],r=this._isSelectRowDefined(),o=this.renderTableHeader(r),n=this.props.selectRow.mode===c["default"].ROW_SELECT_SINGLE?"radio":"checkbox",a=this.props.data.map(function(e,o){var a=this.props.columns.map(function(t,r){var n=e[t.name];if(this.editing&&t.name!==this.props.keyField&&t.editable&&null!==this.state.currEditCell&&this.state.currEditCell.rid===o&&this.state.currEditCell.cid===r){var a=t.editable,i=t.format?function(r){return t.format(r,e,t.formatExtraData,o).replace(/<.*?>/g,"")}:!1;return T(t.editable)&&(a=t.editable(n,e,o,r)),u["default"].createElement(m["default"],{completeEdit:this.handleCompleteEditCell,editable:a,customEditor:t.customEditor,format:t.format?i:!1,key:r,blurToSave:this.props.cellEdit.blurToSave,rowIndex:o,colIndex:r,fieldValue:n})}var s=n,l=null,p=t.className;if(T(t.className)&&(p=t.className(n,e,o,r)),"undefined"!=typeof t.format){var c=t.format(n,e,t.formatExtraData,o);u["default"].isValidElement(c)?(s=c,l=t.columnTitle&&c?c.toString():null):s=u["default"].createElement("div",{dangerouslySetInnerHTML:{__html:c}})}else l=t.columnTitle&&n?n.toString():null;return u["default"].createElement(y["default"],{key:r,dataAlign:t.align,className:p,columnTitle:l,cellEdit:this.props.cellEdit,hidden:t.hidden,onEdit:this.handleEditCell,width:t.width},s)},this),i=e[this.props.keyField],s=-1!==t.indexOf(i),l=-1!==this.props.selectedRowKeys.indexOf(i),p=r&&!this.props.selectRow.hideSelectColumn?this.renderSelectRowColumn(l,n,s):null,d=this.props.trClassName;return T(this.props.trClassName)&&(d=this.props.trClassName(e,o)),u["default"].createElement(f["default"],{isSelected:l,key:i,className:d,selectRow:r?this.props.selectRow:void 0,enableCellEdit:this.props.cellEdit.mode!==c["default"].CELL_EDIT_NONE,onRowClick:this.handleRowClick,onRowMouseOver:this.handleRowMouseOver,onRowMouseOut:this.handleRowMouseOut,onSelectRow:this.handleSelectRow,unselectableRow:s},p,a)},this);return 0===a.length&&a.push(u["default"].createElement(f["default"],{key:"##table-empty##"},u["default"].createElement("td",{colSpan:this.props.columns.length+(r?1:0),className:"react-bs-table-no-data"},this.props.noDataText||c["default"].NO_DATA_TEXT))),this.editing=!1,u["default"].createElement("div",{ref:"container",className:"react-bs-container-body",style:this.props.style},u["default"].createElement("table",{className:e},o,u["default"].createElement("tbody",{ref:"tbody"},a)))}},{key:"renderTableHeader",value:function(e){var t=null;if(e){var r={width:30,minWidth:30};this.props.selectRow.hideSelectColumn||(t=u["default"].createElement("col",{style:r,key:-1}))}var o=this.props.columns.map(function(e,t){var r={display:e.hidden?"none":null};if(e.width){var o=parseInt(e.width,10);r.width=o,r.minWidth=o}return u["default"].createElement("col",{style:r,key:t,className:e.className})});return u["default"].createElement("colgroup",{ref:"header"},t,o)}},{key:"renderSelectRowColumn",value:function(e,t,r){return u["default"].createElement(y["default"],{dataAlign:"center"},u["default"].createElement("input",{type:t,checked:e,disabled:r,onChange:this.handleSelectRowColumChange}))}},{key:"_isSelectRowDefined",value:function(){return this.props.selectRow.mode===c["default"].ROW_SELECT_SINGLE||this.props.selectRow.mode===c["default"].ROW_SELECT_MULTI}}]),t}(l.Component);E.propTypes={data:l.PropTypes.array,columns:l.PropTypes.array,striped:l.PropTypes.bool,bordered:l.PropTypes.bool,hover:l.PropTypes.bool,condensed:l.PropTypes.bool,keyField:l.PropTypes.string,selectedRowKeys:l.PropTypes.array,onRowClick:l.PropTypes.func,onSelectRow:l.PropTypes.func,noDataText:l.PropTypes.oneOfType([l.PropTypes.string,l.PropTypes.object]),style:l.PropTypes.object,tableBodyClass:l.PropTypes.string},t["default"]=E,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(1),p=o(u),c=r(2),d=o(c),f=function(e){function t(e){var r=this;n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleCellEdit=function(e){if(r.props.cellEdit.mode===d["default"].CELL_EDIT_DBCLICK)if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){var t=window.getSelection();t.removeAllRanges()}r.props.onEdit(e.currentTarget.parentElement.rowIndex+1,e.currentTarget.cellIndex,e)}}return a(t,e),s(t,[{key:"shouldComponentUpdate",value:function(e,t){var r=this.props.children,o=this.props.width!==e.width||this.props.className!==e.className||this.props.hidden!==e.hidden||this.props.dataAlign!==e.dataAlign||typeof r!=typeof e.children||(""+this.props.onEdit).toString()!==(""+e.onEdit).toString();return o?o:(o="object"==typeof r&&null!==r&&null!==r.props?"checkbox"===r.props.type||"radio"===r.props.type?o||r.props.type!==e.children.props.type||r.props.checked!==e.children.props.checked:!0:o||r!==e.children,o?o:this.props.cellEdit&&e.cellEdit?o||this.props.cellEdit.mode!==e.cellEdit.mode:!1)}},{key:"render",value:function(){var e={textAlign:this.props.dataAlign,display:this.props.hidden?"none":null},t={};return this.props.cellEdit&&(this.props.cellEdit.mode===d["default"].CELL_EDIT_CLICK?t.onClick=this.handleCellEdit:this.props.cellEdit.mode===d["default"].CELL_EDIT_DBCLICK&&(t.onDoubleClick=this.handleCellEdit)),p["default"].createElement("td",i({style:e,title:this.props.columnTitle,className:this.props.className},t),this.props.children)}}]),t}(u.Component);f.propTypes={dataAlign:u.PropTypes.string,hidden:u.PropTypes.bool,className:u.PropTypes.string,columnTitle:u.PropTypes.string,children:u.PropTypes.node},f.defaultProps={dataAlign:"left",hidden:!1,className:""},t["default"]=f,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(1),p=o(u),c=r(7),d=o(c),f=r(8),h=o(f),y=r(3),v=o(y),m=function(e){function t(e){var r=this;n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleKeyPress=function(e){if(13===e.keyCode){var t="checkbox"===e.currentTarget.type?r._getCheckBoxValue(e):e.currentTarget.value;if(!r.validator(t))return;r.props.completeEdit(t,r.props.rowIndex,r.props.colIndex)}else if(27===e.keyCode)r.props.completeEdit(null,r.props.rowIndex,r.props.colIndex);else if("click"===e.type){var t=e.target.parentElement.firstChild.value;if(!r.validator(t))return;r.props.completeEdit(t,r.props.rowIndex,r.props.colIndex)}},this.handleBlur=function(e){if(e.stopPropagation(),r.props.blurToSave){var t="checkbox"===e.currentTarget.type?r._getCheckBoxValue(e):e.currentTarget.value;if(!r.validator(t))return;r.props.completeEdit(t,r.props.rowIndex,r.props.colIndex)}},this.handleCustomUpdate=function(e){r.props.completeEdit(e,r.props.rowIndex,r.props.colIndex)},this.timeouteClear=0,this.state={shakeEditor:!1}}return a(t,e),s(t,[{key:"validator",value:function(e){var t=this;if(t.props.editable.validator){var r=t.props.editable.validator(e);if(r!==!0){t.refs.notifier.notice("error",r,"Pressed ESC can cancel");var o=t.refs.inputRef;return t.clearTimeout(),t.setState({shakeEditor:!0}),t.timeouteClear=setTimeout(function(){t.setState({shakeEditor:!1})},300),o.focus(),!1}}return!0}},{key:"clearTimeout",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){0!==this.timeouteClear&&(clearTimeout(this.timeouteClear),this.timeouteClear=0)})},{key:"componentDidMount",value:function(){this.refs.inputRef.focus()}},{key:"componentWillUnmount",value:function(){this.clearTimeout()}},{key:"render",value:function(){var e=this.props,t=e.editable,r=e.format,o=e.fieldValue,n=e.customEditor,a=this.state.shakeEditor,s={ref:"inputRef",onKeyDown:this.handleKeyPress,onBlur:this.handleBlur};t.placeholder&&(s.placeholder=t.placeholder);var l=(0,v["default"])({animated:a,shake:a}),u=void 0;if(n){var c=i({},s,{defaultValue:o||""},n.customEditorParameters);u=n.getElement(this.handleCustomUpdate,c)}else u=(0,d["default"])(t,s,r,l,o||"");return p["default"].createElement("td",{ref:"td",style:{position:"relative"}},u,p["default"].createElement(h["default"],{ref:"notifier"}))}},{key:"_getCheckBoxValue",value:function(e){var t="",r=e.currentTarget.value.split(":");return t=e.currentTarget.checked?r[0]:r[1]}}]),t}(u.Component);m.propTypes={completeEdit:u.PropTypes.func,rowIndex:u.PropTypes.number,colIndex:u.PropTypes.number,blurToSave:u.PropTypes.bool,editable:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.object]),format:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.func]),fieldValue:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.bool,u.PropTypes.number,u.PropTypes.array,u.PropTypes.object])},t["default"]=m,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(2),c=o(p),d=r(3),f=o(d),h=function(e){function t(e){var r=this;n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleKeyUp=function(e){var t=e.currentTarget,o=t.value,n=t.name;""===o.trim()?delete r.filterObj[n]:r.filterObj[n]=o,r.props.onFilter(r.filterObj)},this.filterObj={}}return a(t,e),i(t,[{key:"render",value:function(){var e=this.props,t=e.striped,r=e.condensed,o=e.rowSelectType,n=e.columns,a=(0,f["default"])("table",{"table-striped":t,"table-condensed":r}),i=null;if(o===c["default"].ROW_SELECT_SINGLE||o===c["default"].ROW_SELECT_MULTI){var s={width:35,paddingLeft:0,paddingRight:0};i=u["default"].createElement("th",{style:s,key:-1},"Filter")}var l=n.map(function(e){var t=e.hidden,r=e.width,o=e.name,n={display:t?"none":null,width:r};return u["default"].createElement("th",{key:o,style:n},u["default"].createElement("div",{className:"th-inner table-header-column"},u["default"].createElement("input",{size:"10",type:"text",placeholder:o,name:o,onKeyUp:this.handleKeyUp})))},this);return u["default"].createElement("table",{className:a,style:{marginTop:5}},u["default"].createElement("thead",null,u["default"].createElement("tr",{style:{borderBottomStyle:"hidden"}},i,l)))}}]),t}(l.Component);h.propTypes={columns:l.PropTypes.array,rowSelectType:l.PropTypes.string,onFilter:l.PropTypes.func},t["default"]=h,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(6),c=o(p),d=r(2),f=o(d),h=r(3),y=o(h),v=r(13),m=o(v),g=function(e){function t(){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),i(t,[{key:"componentDidMount",value:function(){this.update(this.props.checked)}},{key:"componentWillReceiveProps",value:function(e){this.update(e.checked)}},{key:"update",value:function(e){c["default"].findDOMNode(this).indeterminate="indeterminate"===e}},{key:"render",value:function(){return u["default"].createElement("input",{className:"react-bs-select-all",type:"checkbox",checked:this.props.checked,onChange:this.props.onChange})}}]),t}(l.Component),b=function(e){function t(){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),i(t,[{key:"render",value:function(){var e=this,t=(0,y["default"])("react-bs-container-header","table-header-wrapper"),r=(0,y["default"])("table","table-hover",{"table-bordered":this.props.bordered,"table-condensed":this.props.condensed},this.props.tableHeaderClass),o=null;this.props.hideSelectColumn||(o=this.renderSelectRowHeader());var n=0;return u["default"].createElement("div",{ref:"container",className:t,style:this.props.style},u["default"].createElement("table",{className:r},u["default"].createElement("thead",null,u["default"].createElement("tr",{ref:"header"},o,u["default"].Children.map(this.props.children,function(t){var r=e.props,o=r.sortIndicator,a=r.sortName,i=r.sortOrder,s=r.onSort,l=t.props,p=l.dataField,c=l.dataSort,d=c&&p===a?i:void 0;return u["default"].cloneElement(t,{key:n++,onSort:s,sort:d,sortIndicator:o})})))))}},{key:"renderSelectRowHeader",value:function(){return this.props.rowSelectType===f["default"].ROW_SELECT_SINGLE?u["default"].createElement(m["default"],null):this.props.rowSelectType===f["default"].ROW_SELECT_MULTI?u["default"].createElement(m["default"],null,u["default"].createElement(g,{onChange:this.props.onSelectAllRow,checked:this.props.isSelectAll})):null}}]),t}(l.Component);b.propTypes={tableHeaderClass:l.PropTypes.string,style:l.PropTypes.object,rowSelectType:l.PropTypes.string,onSort:l.PropTypes.func,onSelectAllRow:l.PropTypes.func,sortName:l.PropTypes.string,sortOrder:l.PropTypes.string,hideSelectColumn:l.PropTypes.bool,bordered:l.PropTypes.bool,condensed:l.PropTypes.bool,isFiltered:l.PropTypes.bool,isSelectAll:l.PropTypes.oneOf([!0,"indeterminate",!1]),sortIndicator:l.PropTypes.bool},t["default"]=b,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(1),p=o(u),c=r(2),d=o(c),f=r(5),h=o(f),y=r(22),v=o(y),m=r(26),g=o(m),b=r(24),T=o(b),E=r(25),P=o(E),_=r(23),w=o(_),O=function(e){function t(e){var r=this;n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleColumnClick=function(){if(r.props.dataSort){var e=r.props.sort===d["default"].SORT_DESC?d["default"].SORT_ASC:d["default"].SORT_DESC;r.props.onSort(e,r.props.dataField)}},this.handleFilter=this.handleFilter.bind(this)}return a(t,e),s(t,[{key:"handleFilter",value:function(e,t){this.props.filter.emitter.handleFilter(this.props.dataField,e,t)}},{key:"getFilters",value:function(){switch(this.props.filter.type){case d["default"].FILTER_TYPE.TEXT:return p["default"].createElement(g["default"],i({ref:"textFilter"},this.props.filter,{columnName:this.props.children,filterHandler:this.handleFilter}));case d["default"].FILTER_TYPE.REGEX:return p["default"].createElement(T["default"],i({ref:"regexFilter"},this.props.filter,{columnName:this.props.children,filterHandler:this.handleFilter}));case d["default"].FILTER_TYPE.SELECT:return p["default"].createElement(P["default"],i({ref:"selectFilter"},this.props.filter,{columnName:this.props.children,filterHandler:this.handleFilter}));case d["default"].FILTER_TYPE.NUMBER:return p["default"].createElement(w["default"],i({ref:"numberFilter"},this.props.filter,{columnName:this.props.children,filterHandler:this.handleFilter}));case d["default"].FILTER_TYPE.DATE:return p["default"].createElement(v["default"],i({ref:"dateFilter"},this.props.filter,{columnName:this.props.children,filterHandler:this.handleFilter}));case d["default"].FILTER_TYPE.CUSTOM:return this.props.filter.getElement(this.handleFilter,this.props.filter.customFilterParameters)}}},{key:"componentDidMount",value:function(){this.refs["header-col"].setAttribute("data-field",this.props.dataField)}},{key:"render",value:function(){var e=void 0,t=this.props,r=t.dataAlign,o=t.headerAlign,n=t.hidden,a=t.sort,s=t.dataSort,l=t.sortIndicator,u=t.children,c=t.caretRender,d={textAlign:o||r,display:n?"none":null};l&&(e=s?p["default"].createElement("span",{className:"order"},p["default"].createElement("span",{className:"dropdown"},p["default"].createElement("span",{className:"caret",style:{margin:"10px 0 10px 5px",color:"#ccc"}})),p["default"].createElement("span",{className:"dropup"},p["default"].createElement("span",{className:"caret",style:{margin:"10px 0",color:"#ccc"}}))):null);var f=a?h["default"].renderReactSortCaret(a):e;c&&(f=c(a));var y=this.props.className+" "+(s?"sort-column":""),v="string"==typeof u?{title:u}:null;return p["default"].createElement("th",i({ref:"header-col",className:y,style:d,onClick:this.handleColumnClick},v),u,f,p["default"].createElement("div",{onClick:function(e){return e.stopPropagation()}},this.props.filter?this.getFilters():null))}},{key:"cleanFiltered",value:function(){if(void 0!==this.props.filter)switch(this.props.filter.type){case d["default"].FILTER_TYPE.TEXT:this.refs.textFilter.cleanFiltered();break;case d["default"].FILTER_TYPE.REGEX:this.refs.regexFilter.cleanFiltered();break;case d["default"].FILTER_TYPE.SELECT:this.refs.selectFilter.cleanFiltered();break;case d["default"].FILTER_TYPE.NUMBER:this.refs.numberFilter.cleanFiltered();break;case d["default"].FILTER_TYPE.DATE:this.refs.dateFilter.cleanFiltered()}}}]),t}(u.Component),S=[];for(var C in d["default"].FILTER_TYPE)S.push(d["default"].FILTER_TYPE[C]);O.propTypes={dataField:u.PropTypes.string,dataAlign:u.PropTypes.string,headerAlign:u.PropTypes.string,dataSort:u.PropTypes.bool,onSort:u.PropTypes.func,dataFormat:u.PropTypes.func,csvFormat:u.PropTypes.func,csvHeader:u.PropTypes.string,isKey:u.PropTypes.bool,editable:u.PropTypes.any,hidden:u.PropTypes.bool,hiddenOnInsert:u.PropTypes.bool,searchable:u.PropTypes.bool,className:u.PropTypes.string,width:u.PropTypes.string,sortFunc:u.PropTypes.func,sortFuncExtraData:u.PropTypes.any,columnClassName:u.PropTypes.any,columnTitle:u.PropTypes.bool,filterFormatted:u.PropTypes.bool,filterValue:u.PropTypes.func,sort:u.PropTypes.string,caretRender:u.PropTypes.func,formatExtraData:u.PropTypes.any,filter:u.PropTypes.shape({type:u.PropTypes.oneOf(S),delay:u.PropTypes.number,options:u.PropTypes.oneOfType([u.PropTypes.object,u.PropTypes.arrayOf(u.PropTypes.number)]),numberComparators:u.PropTypes.arrayOf(u.PropTypes.string),emitter:u.PropTypes.object,placeholder:u.PropTypes.string,getElement:u.PropTypes.func,customFilterParameters:u.PropTypes.object}),sortIndicator:u.PropTypes.bool,"export":u.PropTypes.bool},O.defaultProps={dataAlign:"left",headerAlign:void 0,dataSort:!1,dataFormat:void 0,csvFormat:void 0,csvHeader:void 0,isKey:!1,editable:!0,onSort:void 0,hidden:!1,hiddenOnInsert:!1,searchable:!0,className:"",columnTitle:!1,width:null,sortFunc:void 0,columnClassName:"",filterFormatted:!1,filterValue:void 0,sort:void 0,formatExtraData:void 0,sortFuncExtraData:void 0,filter:void 0,sortIndicator:!0},t["default"]=O,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(3),p=o(u),c=r(1),d=o(c),f=function(e){function t(e){var r=this;n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.rowClick=function(e){"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&!function(){var t=e.currentTarget.rowIndex+1,o=r.props,n=o.selectRow,a=o.unselectableRow,i=o.isSelected,s=o.onSelectRow;n&&(n.clickToSelect&&!a?s(t,!i,e):n.clickToSelectAndEditCell&&!a&&(r.clickNum++,setTimeout(function(){1===r.clickNum&&s(t,!i,e),r.clickNum=0},200))),r.props.onRowClick&&r.props.onRowClick(t)}()},this.rowMouseOut=function(e){r.props.onRowMouseOut&&r.props.onRowMouseOut(e.currentTarget.rowIndex,e)},this.rowMouseOver=function(e){r.props.onRowMouseOver&&r.props.onRowMouseOver(e.currentTarget.rowIndex,e)},this.clickNum=0}return a(t,e),s(t,[{key:"render",value:function(){this.clickNum=0;var e={style:{backgroundColor:this.props.isSelected?this.props.selectRow.bgColor:null},className:(0,p["default"])(this.props.isSelected?this.props.selectRow.className:null,this.props.className)};return this.props.selectRow&&(this.props.selectRow.clickToSelect||this.props.selectRow.clickToSelectAndEditCell)||this.props.onRowClick?d["default"].createElement("tr",i({},e,{onMouseOver:this.rowMouseOver,onMouseOut:this.rowMouseOut,onClick:this.rowClick}),this.props.children):d["default"].createElement("tr",e,this.props.children)}}]),t}(c.Component);f.propTypes={isSelected:c.PropTypes.bool,enableCellEdit:c.PropTypes.bool,onRowClick:c.PropTypes.func,onSelectRow:c.PropTypes.func,onRowMouseOut:c.PropTypes.func,onRowMouseOver:c.PropTypes.func,unselectableRow:c.PropTypes.bool},f.defaultProps={onRowClick:void 0},t["default"]=f,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{ "default":e}}function n(e,t){var r="";return 0===e.length?r:(r+=t.map(function(e){return e.header}).join(",")+"\n",e.map(function(e){t.map(function(o,n){var a=o.field,i=o.format,s="undefined"!=typeof i?i(e[a],e):e[a],l="undefined"!=typeof s?'"'+s+'"':"";r+=l,n+1<t.length&&(r+=",")}),r+="\n"}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(5),i=o(a);if(i["default"].canUseDOM())var s=r(31),l=s.saveAs;var u=function(e,t,r){var o=n(e,t);"undefined"!=typeof window&&l(new Blob([o],{type:"text/plain;charset=utf-8"}),r)};t["default"]=u,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e){return e.getFullYear()+"-"+("0"+(e.getMonth()+1)).slice(-2)+"-"+("0"+e.getDate()).slice(-2)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(1),p=o(u),c=r(2),d=o(c),f=["=",">",">=","<","<=","!="],h=function(e){function t(e){n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.dateComparators=this.props.dateComparators||f,this.filter=this.filter.bind(this),this.onChangeComparator=this.onChangeComparator.bind(this)}return a(t,e),s(t,[{key:"setDefaultDate",value:function(){var e="",t=this.props.defaultValue;return t&&t.date&&(e=i(new Date(t.date))),e}},{key:"onChangeComparator",value:function(e){var t=this.refs.inputDate.value,r=e.target.value;""!==t&&(t=new Date(t),this.props.filterHandler({date:t,comparator:r},d["default"].FILTER_TYPE.DATE))}},{key:"getComparatorOptions",value:function(){var e=[];e.push(p["default"].createElement("option",{key:"-1"}));for(var t=0;t<this.dateComparators.length;t++)e.push(p["default"].createElement("option",{key:t,value:this.dateComparators[t]},this.dateComparators[t]));return e}},{key:"filter",value:function(e){var t=this.refs.dateFilterComparator.value,r=e.target.value;r?this.props.filterHandler({date:new Date(r),comparator:t},d["default"].FILTER_TYPE.DATE):this.props.filterHandler(null,d["default"].FILTER_TYPE.DATE)}},{key:"cleanFiltered",value:function(){var e=this.setDefaultDate(),t=this.props.defaultValue?this.props.defaultValue.comparator:"";this.setState({isPlaceholderSelected:""===e}),this.refs.dateFilterComparator.value=t,this.refs.inputDate.value=e,this.props.filterHandler({date:new Date(e),comparator:t},d["default"].FILTER_TYPE.DATE)}},{key:"componentDidMount",value:function(){var e=this.refs.dateFilterComparator.value,t=this.refs.inputDate.value;e&&t&&this.props.filterHandler({date:new Date(t),comparator:e},d["default"].FILTER_TYPE.DATE)}},{key:"render",value:function(){var e=this.props.defaultValue;return p["default"].createElement("div",{className:"filter date-filter"},p["default"].createElement("select",{ref:"dateFilterComparator",className:"date-filter-comparator form-control",onChange:this.onChangeComparator,defaultValue:e?e.comparator:""},this.getComparatorOptions()),p["default"].createElement("input",{ref:"inputDate",className:"filter date-filter-input form-control",type:"date",onChange:this.filter,defaultValue:this.setDefaultDate()}))}}]),t}(u.Component);h.propTypes={filterHandler:u.PropTypes.func.isRequired,defaultValue:u.PropTypes.shape({date:u.PropTypes.object,comparator:u.PropTypes.oneOf(f)}),dateComparators:function(e,t){if(e[t])for(var r=0;r<e[t].length;r++){for(var o=!1,n=0;n<f.length;n++)if(f[n]===e[t][r]){o=!0;break}if(!o)return new Error("Date comparator provided is not supported.\n Use only "+f)}},columnName:u.PropTypes.string},t["default"]=h,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(3),c=o(p),d=r(2),f=o(d),h=["=",">",">=","<","<=","!="],y=function(e){function t(e){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.numberComparators=this.props.numberComparators||h,this.timeout=null,this.state={isPlaceholderSelected:void 0===this.props.defaultValue||void 0===this.props.defaultValue.number||this.props.options&&-1===this.props.options.indexOf(this.props.defaultValue.number)},this.onChangeNumber=this.onChangeNumber.bind(this),this.onChangeNumberSet=this.onChangeNumberSet.bind(this),this.onChangeComparator=this.onChangeComparator.bind(this)}return a(t,e),i(t,[{key:"onChangeNumber",value:function(e){var t=this,r=this.refs.numberFilterComparator.value;if(""!==r){this.timeout&&clearTimeout(this.timeout);var o=e.target.value;this.timeout=setTimeout(function(){t.props.filterHandler({number:o,comparator:r},f["default"].FILTER_TYPE.NUMBER)},this.props.delay)}}},{key:"onChangeNumberSet",value:function(e){var t=this.refs.numberFilterComparator.value,r=e.target.value;this.setState({isPlaceholderSelected:""===r}),""!==t&&this.props.filterHandler({number:r,comparator:t},f["default"].FILTER_TYPE.NUMBER)}},{key:"onChangeComparator",value:function(e){var t=this.refs.numberFilter.value,r=e.target.value;""!==t&&this.props.filterHandler({number:t,comparator:r},f["default"].FILTER_TYPE.NUMBER)}},{key:"cleanFiltered",value:function(){var e=this.props.defaultValue?this.props.defaultValue.number:"",t=this.props.defaultValue?this.props.defaultValue.comparator:"";this.setState({isPlaceholderSelected:""===e}),this.refs.numberFilterComparator.value=t,this.refs.numberFilter.value=e,this.props.filterHandler({number:e,comparator:t},f["default"].FILTER_TYPE.NUMBER)}},{key:"getComparatorOptions",value:function(){var e=[];e.push(u["default"].createElement("option",{key:"-1"}));for(var t=0;t<this.numberComparators.length;t++)e.push(u["default"].createElement("option",{key:t,value:this.numberComparators[t]},this.numberComparators[t]));return e}},{key:"getNumberOptions",value:function(){var e=[],t=this.props.options;e.push(u["default"].createElement("option",{key:"-1",value:""},this.props.placeholder||"Select "+this.props.columnName+"..."));for(var r=0;r<t.length;r++)e.push(u["default"].createElement("option",{key:r,value:t[r]},t[r]));return e}},{key:"componentDidMount",value:function(){var e=this.refs.numberFilterComparator.value,t=this.refs.numberFilter.value;e&&t&&this.props.filterHandler({number:t,comparator:e},f["default"].FILTER_TYPE.NUMBER)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"render",value:function(){var e=(0,c["default"])("select-filter","number-filter-input","form-control",{"placeholder-selected":this.state.isPlaceholderSelected});return u["default"].createElement("div",{className:"filter number-filter"},u["default"].createElement("select",{ref:"numberFilterComparator",className:"number-filter-comparator form-control",onChange:this.onChangeComparator,defaultValue:this.props.defaultValue?this.props.defaultValue.comparator:""},this.getComparatorOptions()),this.props.options?u["default"].createElement("select",{ref:"numberFilter",className:e,onChange:this.onChangeNumberSet,defaultValue:this.props.defaultValue?this.props.defaultValue.number:""},this.getNumberOptions()):u["default"].createElement("input",{ref:"numberFilter",type:"number",className:"number-filter-input form-control",placeholder:this.props.placeholder||"Enter "+this.props.columnName+"...",onChange:this.onChangeNumber,defaultValue:this.props.defaultValue?this.props.defaultValue.number:""}))}}]),t}(l.Component);y.propTypes={filterHandler:l.PropTypes.func.isRequired,options:l.PropTypes.arrayOf(l.PropTypes.number),defaultValue:l.PropTypes.shape({number:l.PropTypes.number,comparator:l.PropTypes.oneOf(h)}),delay:l.PropTypes.number,numberComparators:function(e,t){if(e[t])for(var r=0;r<e[t].length;r++){for(var o=!1,n=0;n<h.length;n++)if(h[n]===e[t][r]){o=!0;break}if(!o)return new Error("Number comparator provided is not supported.\n Use only "+h)}},placeholder:l.PropTypes.string,columnName:l.PropTypes.string},y.defaultProps={delay:f["default"].FILTER_DELAY},t["default"]=y,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(2),c=o(p),d=function(e){function t(e){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.filter=this.filter.bind(this),this.timeout=null}return a(t,e),i(t,[{key:"filter",value:function(e){var t=this;this.timeout&&clearTimeout(this.timeout);var r=e.target.value;this.timeout=setTimeout(function(){t.props.filterHandler(r,c["default"].FILTER_TYPE.REGEX)},this.props.delay)}},{key:"cleanFiltered",value:function(){var e=this.props.defaultValue?this.props.defaultValue:"";this.refs.inputText.value=e,this.props.filterHandler(e,c["default"].FILTER_TYPE.TEXT)}},{key:"componentDidMount",value:function(){var e=this.refs.inputText.value;e&&this.props.filterHandler(e,c["default"].FILTER_TYPE.REGEX)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"render",value:function(){var e=this.props,t=e.defaultValue,r=e.placeholder,o=e.columnName;return u["default"].createElement("input",{ref:"inputText",className:"filter text-filter form-control",type:"text",onChange:this.filter,placeholder:r||"Enter Regex for "+o+"...",defaultValue:t?t:""})}}]),t}(l.Component);d.propTypes={filterHandler:l.PropTypes.func.isRequired,defaultValue:l.PropTypes.string,delay:l.PropTypes.number,placeholder:l.PropTypes.string,columnName:l.PropTypes.string},d.defaultProps={delay:c["default"].FILTER_DELAY},t["default"]=d,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(3),c=o(p),d=r(2),f=o(d),h=function(e){function t(e){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.filter=this.filter.bind(this),this.state={isPlaceholderSelected:void 0===this.props.defaultValue||!this.props.options.hasOwnProperty(this.props.defaultValue)}}return a(t,e),i(t,[{key:"filter",value:function(e){var t=e.target.value;this.setState({isPlaceholderSelected:""===t}),this.props.filterHandler(t,f["default"].FILTER_TYPE.SELECT)}},{key:"cleanFiltered",value:function(){var e=void 0!==this.props.defaultValue?this.props.defaultValue:"";this.setState({isPlaceholderSelected:""===e}),this.refs.selectInput.value=e,this.props.filterHandler(e,f["default"].FILTER_TYPE.SELECT)}},{key:"getOptions",value:function(){var e=[],t=this.props,r=t.options,o=t.placeholder,n=t.columnName;return e.push(u["default"].createElement("option",{key:"-1",value:""},o||"Select "+n+"...")),Object.keys(r).map(function(t){e.push(u["default"].createElement("option",{key:t,value:t},r[t]))}),e}},{key:"componentDidMount",value:function(){var e=this.refs.selectInput.value;e&&this.props.filterHandler(e,f["default"].FILTER_TYPE.SELECT)}},{key:"render",value:function(){var e=(0,c["default"])("filter","select-filter","form-control",{"placeholder-selected":this.state.isPlaceholderSelected});return u["default"].createElement("select",{ref:"selectInput",className:e,onChange:this.filter,defaultValue:void 0!==this.props.defaultValue?this.props.defaultValue:""},this.getOptions())}}]),t}(l.Component);h.propTypes={filterHandler:l.PropTypes.func.isRequired,options:l.PropTypes.object.isRequired,placeholder:l.PropTypes.string,columnName:l.PropTypes.string},t["default"]=h,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(2),c=o(p),d=function(e){function t(e){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.filter=this.filter.bind(this),this.timeout=null}return a(t,e),i(t,[{key:"filter",value:function(e){var t=this;this.timeout&&clearTimeout(this.timeout);var r=e.target.value;this.timeout=setTimeout(function(){t.props.filterHandler(r,c["default"].FILTER_TYPE.TEXT)},this.props.delay)}},{key:"cleanFiltered",value:function(){var e=this.props.defaultValue?this.props.defaultValue:"";this.refs.inputText.value=e,this.props.filterHandler(e,c["default"].FILTER_TYPE.TEXT)}},{key:"componentDidMount",value:function(){var e=this.refs.inputText.value;e&&this.props.filterHandler(e,c["default"].FILTER_TYPE.TEXT)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"render",value:function(){var e=this.props,t=e.placeholder,r=e.columnName,o=e.defaultValue;return u["default"].createElement("input",{ref:"inputText",className:"filter text-filter form-control",type:"text",onChange:this.filter,placeholder:t||"Enter "+r+"...",defaultValue:o?o:""})}}]),t}(l.Component);d.propTypes={filterHandler:l.PropTypes.func.isRequired,defaultValue:l.PropTypes.string,delay:l.PropTypes.number,placeholder:l.PropTypes.string,columnName:l.PropTypes.string},d.defaultProps={delay:c["default"].FILTER_DELAY},t["default"]=d,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(3),c=o(p),d=function(e){function t(e){var r=this;n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.pageBtnClick=function(e){e.preventDefault(),r.props.changePage(e.currentTarget.textContent)}}return a(t,e),i(t,[{key:"render",value:function(){var e=(0,c["default"])({active:this.props.active,disabled:this.props.disable,hidden:this.props.hidden});return u["default"].createElement("li",{className:e},u["default"].createElement("a",{href:"#",onClick:this.pageBtnClick},this.props.children))}}]),t}(l.Component);d.propTypes={changePage:l.PropTypes.func,active:l.PropTypes.bool,disable:l.PropTypes.bool,hidden:l.PropTypes.bool,children:l.PropTypes.node},t["default"]=d,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(27),c=o(p),d=r(2),f=o(d),h=function(e){function t(){var e=this;n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.changePage=function(t){var r=e.props,o=r.pageStartIndex,n=r.prePage,a=r.currPage,i=r.nextPage,s=r.lastPage,l=r.firstPage,u=r.sizePerPage;t=t===n?o>a-1?o:a-1:t===i?a+1>e.lastPage?e.lastPage:a+1:t===s?e.lastPage:t===l?o:parseInt(t,10),t!==a&&e.props.changePage(t,u)},this.changeSizePerPage=function(t){t.preventDefault();var r=parseInt(t.currentTarget.text,10),o=e.props.currPage;r!==e.props.sizePerPage&&(e.totalPages=Math.ceil(e.props.dataSize/r),e.lastPage=e.props.pageStartIndex+e.totalPages-1,o>e.lastPage&&(o=e.lastPage),e.props.changePage(o,r),e.props.onSizePerPageList&&e.props.onSizePerPageList(r))}}return a(t,e),i(t,[{key:"render",value:function(){var e=this,t=this.props,r=t.currPage,o=t.dataSize,n=t.sizePerPage,a=t.sizePerPageList,i=t.paginationShowsTotal,s=t.pageStartIndex,l=t.hideSizePerPage;this.totalPages=Math.ceil(o/n),this.lastPage=this.props.pageStartIndex+this.totalPages-1;var p=this.makePage(),c={"float":"right",marginTop:"0px"},d=a.map(function(t){return u["default"].createElement("li",{key:t,role:"presentation"},u["default"].createElement("a",{role:"menuitem",tabIndex:"-1",href:"#",onClick:e.changeSizePerPage},t))}),h=Math.abs(f["default"].PAGE_START_INDEX-s),y=(r-s)*n,v=Math.min(n*(r+h)-1,o),m=i?u["default"].createElement("span",null,"Showing rows ",y," to ",v," of ",o):null;"function"==typeof i&&(m=i(y,v,o));var g={visibility:l?"hidden":"visible"};return u["default"].createElement("div",{className:"row",style:{marginTop:15}},a.length>1?u["default"].createElement("div",null,u["default"].createElement("div",{className:"col-md-6"},m," ",u["default"].createElement("span",{className:"dropdown",style:g},u["default"].createElement("button",{className:"btn btn-default dropdown-toggle",type:"button",id:"pageDropDown","data-toggle":"dropdown","aria-expanded":"true"},n,u["default"].createElement("span",null," ",u["default"].createElement("span",{className:"caret"}))),u["default"].createElement("ul",{className:"dropdown-menu",role:"menu","aria-labelledby":"pageDropDown"},d))),u["default"].createElement("div",{className:"col-md-6"},u["default"].createElement("ul",{className:"pagination",style:c},p))):u["default"].createElement("div",null,u["default"].createElement("div",{className:"col-md-6"},m),u["default"].createElement("div",{className:"col-md-6"},u["default"].createElement("ul",{className:"pagination",style:c},p))))}},{key:"makePage",value:function(){var e=this.getPages();return e.map(function(e){var t=e===this.props.currPage,r=!1,o=!1;return this.props.currPage!==this.props.pageStartIndex||e!==this.props.firstPage&&e!==this.props.prePage||(r=!0,o=!0),this.props.currPage!==this.lastPage||e!==this.props.nextPage&&e!==this.props.lastPage||(r=!0,o=!0),u["default"].createElement(c["default"],{key:e,changePage:this.changePage,active:t,disable:r,hidden:o},e)},this)}},{key:"getPages",value:function(){var e=void 0,t=this.totalPages;if(0>=t)return[];var r=Math.max(this.props.currPage-Math.floor(this.props.paginationSize/2),this.props.pageStartIndex);t=r+this.props.paginationSize-1,t>this.lastPage&&(t=this.lastPage,r=t-this.props.paginationSize+1),e=r!==this.props.pageStartIndex&&this.totalPages>this.props.paginationSize?[this.props.firstPage,this.props.prePage]:this.totalPages>1?[this.props.prePage]:[];for(var o=r;t>=o;o++)o>=this.props.pageStartIndex&&e.push(o);return t<this.lastPage?(e.push(this.props.nextPage),e.push(this.props.lastPage)):t===this.lastPage&&this.props.currPage!==this.lastPage&&e.push(this.props.nextPage),e}}]),t}(l.Component);h.propTypes={currPage:l.PropTypes.number,sizePerPage:l.PropTypes.number,dataSize:l.PropTypes.number,changePage:l.PropTypes.func,sizePerPageList:l.PropTypes.array,paginationShowsTotal:l.PropTypes.bool,paginationSize:l.PropTypes.number,remote:l.PropTypes.bool,onSizePerPageList:l.PropTypes.func,prePage:l.PropTypes.string,pageStartIndex:l.PropTypes.number,hideSizePerPage:l.PropTypes.bool},h.defaultProps={sizePerPage:f["default"].SIZE_PER_PAGE,pageStartIndex:f["default"].PAGE_START_INDEX},t["default"]=h,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,r,o,n){r=r.toLowerCase();var a=r===l["default"].SORT_DESC;return e.sort(function(e,i){if(o)return o(e,i,r,t,n);var s=null===e[t]?"":e[t],l=null===i[t]?"":i[t];return a?"string"==typeof l?l.localeCompare(s):s>l?-1:l>s?1:0:"string"==typeof s?s.localeCompare(l):l>s?-1:s>l?1:0}),e}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=r(2),l=o(s),u=function(){function e(t){n(this,e),this.data=t,this.colInfos=null,this.filteredData=null,this.isOnFilter=!1,this.filterObj=null,this.searchText=null,this.sortObj=null,this.pageObj={},this.selected=[],this.multiColumnSearch=!1,this.showOnlySelected=!1,this.remote=!1}return i(e,[{key:"setProps",value:function(e){this.keyField=e.keyField,this.enablePagination=e.isPagination,this.colInfos=e.colInfos,this.remote=e.remote,this.multiColumnSearch=e.multiColumnSearch}},{key:"setData",value:function(e){this.data=e,this.remote||this._refresh(!0)}},{key:"getColInfos",value:function(){return this.colInfos}},{key:"getSortInfo",value:function(){return this.sortObj}},{key:"setSortInfo",value:function(e,t){this.sortObj={order:e,sortField:t}}},{key:"setSelectedRowKey",value:function(e){this.selected=e}},{key:"getRowByKey",value:function(e){var t=this;return e.map(function(e){var r=t.data.filter(function(r){return r[t.keyField]===e});return 0!==r.length?r[0]:void 0})}},{key:"getSelectedRowKeys",value:function(){return this.selected}},{key:"getCurrentDisplayData",value:function(){return this.isOnFilter?this.filteredData:this.data}},{key:"_refresh",value:function(e){this.isOnFilter&&(null!==this.filterObj&&this.filter(this.filterObj),null!==this.searchText&&this.search(this.searchText)),!e&&this.sortObj&&this.sort(this.sortObj.order,this.sortObj.sortField)}},{key:"ignoreNonSelected",value:function(){var e=this;this.showOnlySelected=!this.showOnlySelected,this.showOnlySelected?(this.isOnFilter=!0,this.filteredData=this.data.filter(function(t){var r=e.selected.find(function(r){return t[e.keyField]===r});return"undefined"!=typeof r?!0:!1})):this.isOnFilter=!1}},{key:"sort",value:function(e,t){this.setSortInfo(e,t);var r=this.getCurrentDisplayData();if(!this.colInfos[t])return this;var o=this.colInfos[t],n=o.sortFunc,i=o.sortFuncExtraData;return r=a(r,t,e,n,i),this}},{key:"page",value:function(e,t){return this.pageObj.end=e*t-1,this.pageObj.start=this.pageObj.end-(t-1),this}},{key:"edit",value:function(e,t,r){var o=this.getCurrentDisplayData(),n=void 0;return this.enablePagination?(o[this.pageObj.start+t][r]=e,n=o[this.pageObj.start+t][this.keyField]):(o[t][r]=e,n=o[t][this.keyField]),this.isOnFilter&&(this.data.forEach(function(t){t[this.keyField]===n&&(t[r]=e)},this),null!==this.filterObj&&this.filter(this.filterObj),null!==this.searchText&&this.search(this.searchText)),this}},{key:"addAtBegin",value:function(e){if(!e[this.keyField]||""===e[this.keyField].toString())throw this.keyField+" can't be empty value.";var t=this.getCurrentDisplayData();t.forEach(function(t){if(t[this.keyField].toString()===e[this.keyField].toString())throw this.keyField+" "+e[this.keyField]+" already exists"},this),t.unshift(e),this.isOnFilter&&this.data.unshift(e),this._refresh(!1)}},{key:"add",value:function(e){if(!e[this.keyField]||""===e[this.keyField].toString())throw this.keyField+" can't be empty value.";var t=this.getCurrentDisplayData();t.forEach(function(t){if(t[this.keyField].toString()===e[this.keyField].toString())throw this.keyField+" "+e[this.keyField]+" already exists"},this),t.push(e),this.isOnFilter&&this.data.push(e),this._refresh(!1)}},{key:"remove",value:function(e){var t=this,r=this.getCurrentDisplayData(),o=r.filter(function(r){return-1===e.indexOf(r[t.keyField])});this.isOnFilter?(this.data=this.data.filter(function(r){return-1===e.indexOf(r[t.keyField])}),this.filteredData=o):this.data=o}},{key:"filter",value:function(e){if(0===Object.keys(e).length)this.filteredData=null,this.isOnFilter=!1,this.filterObj=null,this.searchText&&this._search(this.data);else{var t=this.data;this.filterObj=e,this.searchText&&(this._search(t),t=this.filteredData),this._filter(t)}}},{key:"filterNumber",value:function(e,t,r){var o=!0;switch(r){case"=":e!=t&&(o=!1);break;case">":t>=e&&(o=!1);break;case">=":t>e&&(o=!1);break;case"<":e>=t&&(o=!1);break;case"<=":e>t&&(o=!1);break;case"!=":e==t&&(o=!1);break;default:console.error("Number comparator provided is not supported")}return o}},{key:"filterDate",value:function(e,t,r){var o=!0;switch(r){case"=":e!=t&&(o=!1);break;case">":t>=e&&(o=!1);break;case">=":t>e&&(o=!1);break;case"<":e>=t&&(o=!1);break;case"<=":e>t&&(o=!1);break;case"!=":e==t&&(o=!1);break;default:console.error("Date comparator provided is not supported")}return o}},{key:"filterRegex",value:function(e,t){try{return new RegExp(t,"i").test(e)}catch(r){return console.error("Invalid regular expression"),!0}}},{key:"filterCustom",value:function(e,t,r){return null!==r&&"object"==typeof r?r.callback(e,r.callbackParameters):this.filterText(e,t)}},{key:"filterText",value:function(e,t){return-1===e.toString().toLowerCase().indexOf(t)?!1:!0}},{key:"search",value:function(e){if(""===e.trim())this.filteredData=null,this.isOnFilter=!1,this.searchText=null,this.filterObj&&this._filter(this.data);else{var t=this.data;this.searchText=e,this.filterObj&&(this._filter(t),t=this.filteredData),this._search(t)}}},{key:"_filter",value:function(e){var t=this,r=this.filterObj;this.filteredData=e.filter(function(e,o){var n=!0,a=void 0;for(var i in r){var s=e[i];switch((null===s||void 0===s)&&(s=""),r[i].type){case l["default"].FILTER_TYPE.NUMBER:a=r[i].value.number;break;case l["default"].FILTER_TYPE.CUSTOM:a="object"==typeof r[i].value?void 0:"string"==typeof r[i].value?r[i].value.toLowerCase():r[i].value;break;case l["default"].FILTER_TYPE.DATE:a=r[i].value.date;break;case l["default"].FILTER_TYPE.REGEX:a=r[i].value;break;default:a="string"==typeof r[i].value?r[i].value.toLowerCase():r[i].value,void 0===a&&(a=r[i].toLowerCase())}var u=void 0,p=void 0,c=void 0,d=void 0;switch(t.colInfos[i]&&(u=t.colInfos[i].format,p=t.colInfos[i].filterFormatted,c=t.colInfos[i].formatExtraData,d=t.colInfos[i].filterValue,p&&u?s=u(e[i],e,c,o):d&&(s=d(e[i],e))),r[i].type){case l["default"].FILTER_TYPE.NUMBER:n=t.filterNumber(s,a,r[i].value.comparator);break;case l["default"].FILTER_TYPE.DATE:n=t.filterDate(s,a,r[i].value.comparator);break;case l["default"].FILTER_TYPE.REGEX:n=t.filterRegex(s,a);break;case l["default"].FILTER_TYPE.CUSTOM:n=t.filterCustom(s,a,r[i].value);break;default:r[i].type===l["default"].FILTER_TYPE.SELECT&&p&&p&&u&&(a=u(a,e,c,o)),n=t.filterText(s,a)}if(!n)break}return n}),this.isOnFilter=!0}},{key:"_search",value:function(e){var t=this,r=[];this.multiColumnSearch?r=this.searchText.split(" "):r.push(this.searchText),this.filteredData=e.filter(function(e,o){for(var n=Object.keys(e),a=!1,i=0,s=n.length;s>i;i++){var l=n[i];if(t.colInfos[l]&&e[l]){ var u=t.colInfos[l],p=u.format,c=u.filterFormatted,d=u.filterValue,f=u.formatExtraData,h=u.searchable,y=e[l];if(h){c&&p?y=p(y,e,f,o):d&&(y=d(y,e));for(var v=0,m=r.length;m>v;v++){var g=r[v].toLowerCase();if(-1!==y.toString().toLowerCase().indexOf(g)){a=!0;break}}}}}return a}),this.isOnFilter=!0}},{key:"getDataIgnoringPagination",value:function(){return this.getCurrentDisplayData()}},{key:"get",value:function(){var e=this.getCurrentDisplayData();if(0===e.length)return e;if(this.remote||!this.enablePagination)return e;for(var t=[],r=this.pageObj.start;r<=this.pageObj.end&&(t.push(e[r]),r+1!==e.length);r++);return t}},{key:"getKeyField",value:function(){return this.keyField}},{key:"getDataNum",value:function(){return this.getCurrentDisplayData().length}},{key:"isChangedPage",value:function(){return this.pageObj.start&&this.pageObj.end?!0:!1}},{key:"isEmpty",value:function(){return 0===this.data.length||null===this.data||void 0===this.data}},{key:"getAllRowkey",value:function(){var e=this;return this.data.map(function(t){return t[e.keyField]})}}]),e}();t.TableDataStore=u},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(3),c=o(p),d=r(2),f=o(d),h=r(7),y=o(h),v=r(8),m=o(v),g=function(e){function t(e){var r=this,o=arguments;n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleSaveBtnClick=function(){var e=r.checkAndParseForm();if(e){var t=r.props.onAddRow(e);t?(r.refs.notifier.notice("error",t,"Pressed ESC can cancel"),r.clearTimeout(),r.setState({shakeEditor:!0,validateState:"this is hack for prevent bootstrap modal hide"}),r.timeouteClear=setTimeout(function(){r.setState({shakeEditor:!1})},300)):(r.setState({validateState:null,shakeEditor:!1},function(){document.querySelector(".modal-backdrop").click(),document.querySelector("."+r.modalClassName).click()}),r.refs.form.reset())}},this.handleShowOnlyToggle=function(){r.setState({showSelected:!r.state.showSelected}),r.props.onShowOnlySelected()},this.handleDropRowBtnClick=function(){r.props.onDropRow()},this.handleDebounce=function(e,t,n){var a=void 0;return function(){var i=function(){a=null,n||e.apply(r,o)},s=n&&!a;clearTimeout(a),a=setTimeout(i,t||0),s&&e.appy(r,o)}},this.handleKeyUp=function(e){e.persist(),r.debounceCallback(e)},this.handleExportCSV=function(){r.props.onExportCSV()},this.handleClearBtnClick=function(){r.refs.seachInput.value="",r.props.onSearch("")},this.timeouteClear=0,this.modalClassName,this.state={isInsertRowTrigger:!0,validateState:null,shakeEditor:!1,showSelected:!1}}return a(t,e),i(t,null,[{key:"modalSeq",value:0,enumerable:!0}]),i(t,[{key:"componentWillMount",value:function(){var e=this,t=this.props.searchDelayTime?this.props.searchDelayTime:0;this.debounceCallback=this.handleDebounce(function(){e.props.onSearch(e.refs.seachInput.value)},t)}},{key:"componentWillUnmount",value:function(){this.clearTimeout()}},{key:"clearTimeout",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){this.timeouteClear&&(clearTimeout(this.timeouteClear),this.timeouteClear=0)})},{key:"checkAndParseForm",value:function(){var e=this,t={},r={},o=!0,n=void 0,a=void 0;return this.props.columns.forEach(function(e,i){if(e.autoValue){var s=(new Date).getTime();n="function"==typeof e.autoValue?e.autoValue():"autovalue-"+s}else if(e.hiddenOnInsert)n="";else{var l=this.refs[e.field+i];if(n=l.value,e.editable&&"checkbox"===e.editable.type){var u=n.split(":");n=l.checked?u[0]:u[1]}e.editable&&e.editable.validator&&(a=e.editable.validator(n),a!==!0&&(o=!1,r[e.field]=a))}t[e.field]=n},this),o?t:(this.clearTimeout(),this.setState({validateState:r,shakeEditor:!0}),this.refs.notifier.notice("error","Form validate errors, please checking!","Pressed ESC can cancel"),this.timeouteClear=setTimeout(function(){e.setState({shakeEditor:!1})},300),null)}},{key:"handleCloseBtn",value:function(){this.refs.warning.style.display="none"}},{key:"render",value:function(){this.modalClassName="bs-table-modal-sm"+t.modalSeq++;var e=null,r=null,o=null,n=null;this.props.enableInsert&&(e=u["default"].createElement("button",{type:"button",className:"btn btn-info react-bs-table-add-btn","data-toggle":"modal","data-target":"."+this.modalClassName},u["default"].createElement("i",{className:"glyphicon glyphicon-plus"})," ",this.props.insertText)),this.props.enableDelete&&(r=u["default"].createElement("button",{type:"button",className:"btn btn-warning react-bs-table-del-btn","data-toggle":"tooltip","data-placement":"right",title:"Drop selected row",onClick:this.handleDropRowBtnClick},u["default"].createElement("i",{className:"glyphicon glyphicon-trash"})," ",this.props.deleteText)),this.props.enableShowOnlySelected&&(n=u["default"].createElement("button",{type:"button",onClick:this.handleShowOnlyToggle,className:"btn btn-primary","data-toggle":"button","aria-pressed":"false"},this.state.showSelected?f["default"].SHOW_ALL:f["default"].SHOW_ONLY_SELECT)),this.props.enableExportCSV&&(o=u["default"].createElement("button",{type:"button",className:"btn btn-success",onClick:this.handleExportCSV},u["default"].createElement("i",{className:"glyphicon glyphicon-export"}),this.props.exportCSVText));var a=this.renderSearchPanel(),i=this.props.enableInsert?this.renderInsertRowModal():null;return u["default"].createElement("div",{className:"row"},u["default"].createElement("div",{className:"col-xs-12 col-sm-6 col-md-6 col-lg-8"},u["default"].createElement("div",{className:"btn-group btn-group-sm",role:"group"},o,e,r,n)),u["default"].createElement("div",{className:"col-xs-12 col-sm-6 col-md-6 col-lg-4"},a),u["default"].createElement(m["default"],{ref:"notifier"}),i)}},{key:"renderSearchPanel",value:function(){if(this.props.enableSearch){var e="form-group form-group-sm react-bs-table-search-form",t=null;return this.props.clearSearch&&(t=u["default"].createElement("span",{className:"input-group-btn"},u["default"].createElement("button",{className:"btn btn-default",type:"button",onClick:this.handleClearBtnClick},"Clear")),e+=" input-group input-group-sm"),u["default"].createElement("div",{className:e},u["default"].createElement("input",{ref:"seachInput",className:"form-control",type:"text",defaultValue:this.props.defaultSearch,placeholder:this.props.searchPlaceholder?this.props.searchPlaceholder:"Search",onKeyUp:this.handleKeyUp}),t)}return null}},{key:"renderInsertRowModal",value:function(){var e=this,t=this.state.validateState||{},r=this.state.shakeEditor,o=this.props.columns.map(function(r,o){var n=r.editable,a=r.format,i=r.field,s=r.name,l=r.autoValue,p=r.hiddenOnInsert,c={ref:i+o,placeholder:n.placeholder?n.placeholder:s};if(l||p)return null;var d=t[i]?u["default"].createElement("span",{className:"help-block bg-danger"},t[i]):null;return u["default"].createElement("div",{className:"form-group",key:i},u["default"].createElement("label",null,s),(0,y["default"])(n,c,a,"",void 0,e.props.ignoreEditable),d)}),n=(0,c["default"])("modal","fade",this.modalClassName,{"in":r||this.state.validateState}),a=(0,c["default"])("modal-dialog","modal-sm",{animated:r,shake:r});return u["default"].createElement("div",{ref:"modal",className:n,tabIndex:"-1",role:"dialog"},u["default"].createElement("div",{className:a},u["default"].createElement("div",{className:"modal-content"},u["default"].createElement("div",{className:"modal-header"},u["default"].createElement("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},u["default"].createElement("span",{"aria-hidden":"true"},"×")),u["default"].createElement("h4",{className:"modal-title"},"New Record")),u["default"].createElement("div",{className:"modal-body"},u["default"].createElement("form",{ref:"form"},o)),u["default"].createElement("div",{className:"modal-footer"},u["default"].createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},this.props.closeText),u["default"].createElement("button",{type:"button",className:"btn btn-primary",onClick:this.handleSaveBtnClick},this.props.saveText)))))}}]),t}(l.Component);g.propTypes={onAddRow:l.PropTypes.func,onDropRow:l.PropTypes.func,onShowOnlySelected:l.PropTypes.func,enableInsert:l.PropTypes.bool,enableDelete:l.PropTypes.bool,enableSearch:l.PropTypes.bool,enableShowOnlySelected:l.PropTypes.bool,columns:l.PropTypes.array,searchPlaceholder:l.PropTypes.string,exportCSVText:l.PropTypes.string,insertText:l.PropTypes.string,deleteText:l.PropTypes.string,saveText:l.PropTypes.string,closeText:l.PropTypes.string,clearSearch:l.PropTypes.bool,ignoreEditable:l.PropTypes.bool,defaultSearch:l.PropTypes.string},g.defaultProps={enableInsert:!1,enableDelete:!1,enableSearch:!1,enableShowOnlySelected:!1,clearSearch:!1,ignoreEditable:!1,exportCSVText:f["default"].EXPORT_CSV_TEXT,insertText:f["default"].INSERT_BTN_TEXT,deleteText:f["default"].DELETE_BTN_TEXT,saveText:f["default"].SAVE_BTN_TEXT,closeText:f["default"].CLOSE_BTN_TEXT},t["default"]=g,e.exports=t["default"]},function(e,t,r){var o,n,a=a||function(e){"use strict";if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var t=e.document,r=function(){return e.URL||e.webkitURL||e},o=t.createElementNS("http://www.w3.org/1999/xhtml","a"),n="download"in o,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},i=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),s=e.webkitRequestFileSystem,l=e.requestFileSystem||s||e.mozRequestFileSystem,u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},p="application/octet-stream",c=0,d=500,f=function(t){var o=function(){"string"==typeof t?r().revokeObjectURL(t):t.remove()};e.chrome?o():setTimeout(o,d)},h=function(e,t,r){t=[].concat(t);for(var o=t.length;o--;){var n=e["on"+t[o]];if("function"==typeof n)try{n.call(e,r||e)}catch(a){u(a)}}},y=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e},v=function(t,u,d){d||(t=y(t));var v,m,g,b=this,T=t.type,E=!1,P=function(){h(b,"writestart progress write writeend".split(" "))},_=function(){if(m&&i&&"undefined"!=typeof FileReader){var o=new FileReader;return o.onloadend=function(){var e=o.result;m.location.href="data:attachment/file"+e.slice(e.search(/[,;]/)),b.readyState=b.DONE,P()},o.readAsDataURL(t),void(b.readyState=b.INIT)}if((E||!v)&&(v=r().createObjectURL(t)),m)m.location.href=v;else{var n=e.open(v,"_blank");void 0==n&&i&&(e.location.href=v)}b.readyState=b.DONE,P(),f(v)},w=function(e){return function(){return b.readyState!==b.DONE?e.apply(this,arguments):void 0}},O={create:!0,exclusive:!1};return b.readyState=b.INIT,u||(u="download"),n?(v=r().createObjectURL(t),o.href=v,o.download=u,void setTimeout(function(){a(o),P(),f(v),b.readyState=b.DONE})):(e.chrome&&T&&T!==p&&(g=t.slice||t.webkitSlice,t=g.call(t,0,t.size,p),E=!0),s&&"download"!==u&&(u+=".download"),(T===p||s)&&(m=e),l?(c+=t.size,void l(e.TEMPORARY,c,w(function(e){e.root.getDirectory("saved",O,w(function(e){var r=function(){e.getFile(u,O,w(function(e){e.createWriter(w(function(r){r.onwriteend=function(t){m.location.href=e.toURL(),b.readyState=b.DONE,h(b,"writeend",t),f(e)},r.onerror=function(){var e=r.error;e.code!==e.ABORT_ERR&&_()},"writestart progress write abort".split(" ").forEach(function(e){r["on"+e]=b["on"+e]}),r.write(t),b.abort=function(){r.abort(),b.readyState=b.DONE},b.readyState=b.WRITING}),_)}),_)};e.getFile(u,{create:!1},w(function(e){e.remove(),r()}),w(function(e){e.code===e.NOT_FOUND_ERR?r():_()}))}),_)}),_)):void _())},m=v.prototype,g=function(e,t,r){return new v(e,t,r)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,r){return r||(e=y(e)),navigator.msSaveOrOpenBlob(e,t||"download")}:(m.abort=function(){var e=this;e.readyState=e.DONE,h(e,"abort")},m.readyState=m.INIT=0,m.WRITING=1,m.DONE=2,m.error=m.onwritestart=m.onprogress=m.onwrite=m.onabort=m.onerror=m.onwriteend=null,g)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||(void 0).content);"undefined"!=typeof e&&e.exports?e.exports.saveAs=a:null!==r(44)&&null!=r(45)&&(o=[],n=function(){return a}.apply(t,o),!(void 0!==n&&(e.exports=n)))},function(e,t,r){(function(t){"use strict";var o=r(33),n={addClass:function(e,r){return/\s/.test(r)?"production"!==t.env.NODE_ENV?o(!1,'CSSCore.addClass takes only a single class name. "%s" contains multiple classes.',r):o(!1):void 0,r&&(e.classList?e.classList.add(r):n.hasClass(e,r)||(e.className=e.className+" "+r)),e},removeClass:function(e,r){return/\s/.test(r)?"production"!==t.env.NODE_ENV?o(!1,'CSSCore.removeClass takes only a single class name. "%s" contains multiple classes.',r):o(!1):void 0,r&&(e.classList?e.classList.remove(r):n.hasClass(e,r)&&(e.className=e.className.replace(new RegExp("(^|\\s)"+r+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,""))),e},conditionClass:function(e,t,r){return(r?n.addClass:n.removeClass)(e,t)},hasClass:function(e,r){return/\s/.test(r)?"production"!==t.env.NODE_ENV?o(!1,"CSS.hasClass takes only a single class name."):o(!1):void 0,e.classList?!!r&&e.classList.contains(r):(" "+e.className+" ").indexOf(" "+r+" ")>-1}};e.exports=n}).call(t,r(4))},function(e,t,r){(function(t){"use strict";function r(e,r,o,n,a,i,s,l){if("production"!==t.env.NODE_ENV&&void 0===r)throw new Error("invariant requires an error message argument");if(!e){var u;if(void 0===r)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[o,n,a,i,s,l],c=0;u=new Error(r.replace(/%s/g,function(){return p[c++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}e.exports=r}).call(t,r(4))},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}();Object.defineProperty(t,"__esModule",{value:!0});var p=r(1),c=o(p),d=r(10),f=o(d),h=r(9),y=o(h),v=function(e){function t(){var e,r,o,n;a(this,t);for(var s=arguments.length,l=Array(s),u=0;s>u;u++)l[u]=arguments[u];return r=o=i(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.state={toasts:[],toastId:0,previousMessage:null},n=r,i(o,n)}return s(t,e),u(t,[{key:"error",value:function(e,t,r){this._notify(this.props.toastType.error,e,t,r)}},{key:"info",value:function(e,t,r){this._notify(this.props.toastType.info,e,t,r)}},{key:"success",value:function(e,t,r){this._notify(this.props.toastType.success,e,t,r)}},{key:"warning",value:function(e,t,r){this._notify(this.props.toastType.warning,e,t,r)}},{key:"clear",value:function(){var e=this;Object.keys(this.refs).forEach(function(t){e.refs[t].hideToast(!1)})}},{key:"render",value:function(){var e=this;return c["default"].createElement("div",l({},this.props,{"aria-live":"polite",role:"alert"}),this.state.toasts.map(function(t){return e.props.toastMessageFactory(t)}))}},{key:"_notify",value:function(e,t,r){var o=this,a=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];if(!this.props.preventDuplicates||this.state.previousMessage!==t){var i=this.state.toastId++,s=i,l=(0,f["default"])(a,{$merge:{type:e,title:r,message:t,toastId:s,key:i,ref:"toasts__"+i,handleOnClick:function(e){return"function"==typeof a.handleOnClick&&a.handleOnClick(),o._handle_toast_on_click(e)},handleRemove:this._handle_toast_remove.bind(this)}}),u=n({},""+(this.props.newestOnTop?"$unshift":"$push"),[l]),p=(0,f["default"])(this.state,{toasts:u,previousMessage:{$set:t}});this.setState(p)}}},{key:"_handle_toast_on_click",value:function(e){this.props.onClick(e),e.defaultPrevented||(e.preventDefault(),e.stopPropagation())}},{key:"_handle_toast_remove",value:function(e){var t=this,r=""+(this.props.newestOnTop?"reduceRight":"reduce");this.state.toasts[r](function(r,o,n){return r||o.toastId!==e?!1:(t.setState((0,f["default"])(t.state,{toasts:{$splice:[[n,1]]}})),!0)},!1)}}]),t}(p.Component);v.defaultProps={toastType:{error:"error",info:"info",success:"success",warning:"warning"},id:"toast-container",toastMessageFactory:c["default"].createFactory(y["default"]),preventDuplicates:!1,newestOnTop:!0,onClick:function(){}},t["default"]=v},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(32),a=o(n),i=r(39),s=o(i),l=r(6),u=o(l),p=17,c=Object.prototype.toString;t["default"]={getDefaultProps:function(){return{transition:null,showAnimation:"animated bounceIn",hideAnimation:"animated bounceOut",timeOut:5e3,extendedTimeOut:1e3}},componentWillMount:function(){this.classNameQueue=[],this.isHiding=!1,this.intervalId=null},componentDidMount:function(){var e=this;this._is_mounted=!0,this._show();var t=u["default"].findDOMNode(this),r=function o(){e.isHiding&&(e._set_is_hiding(!1),s["default"].removeEndEventListener(t,o),e._handle_remove())};s["default"].addEndEventListener(t,r),this.props.timeOut>0&&this._set_interval_id(setTimeout(this.hideToast,this.props.timeOut))},componentWillUnmount:function(){this._is_mounted=!1,this.intervalId&&clearTimeout(this.intervalId)},_set_transition:function(e){var t=e?"leave":"enter",r=u["default"].findDOMNode(this),o=this.props.transition+"-"+t,n=o+"-active",i=function l(e){e&&e.target!==r||(a["default"].removeClass(r,o),a["default"].removeClass(r,n),s["default"].removeEndEventListener(r,l))};s["default"].addEndEventListener(r,i),a["default"].addClass(r,o),this._queue_class(n)},_clear_transition:function(e){var t=u["default"].findDOMNode(this),r=e?"leave":"enter",o=this.props.transition+"-"+r,n=o+"-active";a["default"].removeClass(t,o),a["default"].removeClass(t,n)},_set_animation:function(e){var t=u["default"].findDOMNode(this),r=this._get_animation_classes(e),o=function n(e){e&&e.target!==t||(r.forEach(function(e){a["default"].removeClass(t,e)}),s["default"].removeEndEventListener(t,n))};s["default"].addEndEventListener(t,o),r.forEach(function(e){a["default"].addClass(t,e)})},_get_animation_classes:function(e){var t=e?this.props.hideAnimation:this.props.showAnimation;return"[object Array]"===c.call(t)?t:"string"==typeof t?t.split(" "):void 0},_clear_animation:function(e){var t=this,r=this._get_animation_classes(e);r.forEach(function(e){a["default"].removeClass(u["default"].findDOMNode(t),e)})},_queue_class:function(e){this.classNameQueue.push(e),this.timeout||(this.timeout=setTimeout(this._flush_class_name_queue,p))},_flush_class_name_queue:function(){this._is_mounted&&this.classNameQueue.forEach(a["default"].addClass.bind(a["default"],u["default"].findDOMNode(this))),this.classNameQueue.length=0,this.timeout=null},_show:function(){this.props.transition?this._set_transition():this.props.showAnimation&&this._set_animation()},handleMouseEnter:function(){clearTimeout(this.intervalId),this._set_interval_id(null),this.isHiding&&(this._set_is_hiding(!1),this.props.hideAnimation?this._clear_animation(!0):this.props.transition&&this._clear_transition(!0))},handleMouseLeave:function(){!this.isHiding&&(this.props.timeOut>0||this.props.extendedTimeOut>0)&&this._set_interval_id(setTimeout(this.hideToast,this.props.extendedTimeOut))},hideToast:function(e){this.isHiding||null===this.intervalId&&!e||(this._set_is_hiding(!0),this.props.transition?this._set_transition(!0):this.props.hideAnimation?this._set_animation(!0):this._handle_remove())},_set_interval_id:function(e){this.intervalId=e},_set_is_hiding:function(e){this.isHiding=e}}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){e[t.showMethod]({duration:t.showDuration,easing:t.showEasing})}Object.defineProperty(t,"__esModule",{value:!0});var a=r(6),i=o(a);t["default"]={getDefaultProps:function(){return{style:{display:"none"},showMethod:"fadeIn",showDuration:300,showEasing:"swing",hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",timeOut:5e3,extendedTimeOut:1e3}},getInitialState:function(){return{intervalId:null,isHiding:!1}},componentDidMount:function(){n(this._get_$_node(),this.props),this.props.timeOut>0&&this._set_interval_id(setTimeout(this.hideToast,this.props.timeOut))},handleMouseEnter:function(){clearTimeout(this.state.intervalId),this._set_interval_id(null),this._set_is_hiding(!1),n(this._get_$_node().stop(!0,!0),this.props)},handleMouseLeave:function(){!this.state.isHiding&&(this.props.timeOut>0||this.props.extendedTimeOut>0)&&this._set_interval_id(setTimeout(this.hideToast,this.props.extendedTimeOut))},hideToast:function(e){this.state.isHiding||null===this.state.intervalId&&!e||(this.setState({isHiding:!0}),this._get_$_node()[this.props.hideMethod]({duration:this.props.hideDuration,easing:this.props.hideEasing,complete:this._handle_remove}))},_get_$_node:function(){return jQuery(i["default"].findDOMNode(this))},_set_interval_id:function(e){this.setState({intervalId:e})},_set_is_hiding:function(e){this.setState({isHiding:e})}}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.ToastMessage=t.ToastContainer=void 0;var n=r(34),a=o(n),i=r(9),s=o(i);t.ToastContainer=a["default"],t.ToastMessage=s["default"]},function(e,t){"use strict";function r(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var r=Object(e),o=Object.prototype.hasOwnProperty,n=1;n<arguments.length;n++){var a=arguments[n];if(null!=a){var i=Object(a);for(var s in i)o.call(i,s)&&(r[s]=i[s])}}return r}e.exports=r},function(e,t,r){"use strict";function o(){var e=document.createElement("div"),t=e.style;"AnimationEvent"in window||delete s.animationend.animation,"TransitionEvent"in window||delete s.transitionend.transition;for(var r in s){var o=s[r];for(var n in o)if(n in t){l.push(o[n]);break}}}function n(e,t,r){e.addEventListener(t,r,!1)}function a(e,t,r){e.removeEventListener(t,r,!1)}var i=r(41),s={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},l=[];i.canUseDOM&&o();var u={addEndEventListener:function(e,t){return 0===l.length?void window.setTimeout(t,0):void l.forEach(function(r){n(e,r,t)})},removeEndEventListener:function(e,t){0!==l.length&&l.forEach(function(r){a(e,r,t)})}};e.exports=u},function(e,t,r){(function(t){"use strict";function o(e){return Array.isArray(e)?e.concat():e&&"object"==typeof e?i(new e.constructor,e):e}function n(e,r,o){Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): expected target of %s to be an array; got %s.",o,e):l(!1);var n=r[o];Array.isArray(n)?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): expected spec of %s to be an array; got %s. Did you forget to wrap your parameter in an array?",o,n):l(!1)}function a(e,r){if("object"!=typeof r?"production"!==t.env.NODE_ENV?l(!1,"update(): You provided a key path to update() that did not contain one of %s. Did you forget to include {%s: ...}?",v.join(", "),f):l(!1):void 0,u.call(r,f))return 1!==Object.keys(r).length?"production"!==t.env.NODE_ENV?l(!1,"Cannot have more than one key in an object with %s",f):l(!1):void 0,r[f];var s=o(e);if(u.call(r,h)){var g=r[h];g&&"object"==typeof g?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): %s expects a spec of type 'object'; got %s",h,g):l(!1),s&&"object"==typeof s?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): %s expects a target of type 'object'; got %s",h,s):l(!1),i(s,r[h])}u.call(r,p)&&(n(e,r,p),r[p].forEach(function(e){s.push(e)})),u.call(r,c)&&(n(e,r,c),r[c].forEach(function(e){s.unshift(e)})),u.call(r,d)&&(Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?l(!1,"Expected %s target to be an array; got %s",d,e):l(!1),Array.isArray(r[d])?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?",d,r[d]):l(!1),r[d].forEach(function(e){Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?",d,r[d]):l(!1),s.splice.apply(s,e)})),u.call(r,y)&&("function"!=typeof r[y]?"production"!==t.env.NODE_ENV?l(!1,"update(): expected spec of %s to be a function; got %s.",y,r[y]):l(!1):void 0,s=r[y](s));for(var b in r)m.hasOwnProperty(b)&&m[b]||(s[b]=a(e[b],r[b]));return s}var i=r(38),s=r(43),l=r(42),u={}.hasOwnProperty,p=s({$push:null}),c=s({$unshift:null}),d=s({$splice:null}),f=s({$set:null}),h=s({$merge:null}),y=s({$apply:null}),v=[p,c,d,f,h,y],m={};v.forEach(function(e){m[e]=!0}),e.exports=a}).call(t,r(4))},function(e,t){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};e.exports=o},function(e,t,r){(function(t){"use strict";function r(e,r,o,n,a,i,s,l){if("production"!==t.env.NODE_ENV&&void 0===r)throw new Error("invariant requires an error message argument");if(!e){var u;if(void 0===r)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[o,n,a,i,s,l],c=0;u=new Error(r.replace(/%s/g,function(){return p[c++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}e.exports=r}).call(t,r(4))},function(e,t){"use strict";var r=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};e.exports=r},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function o(e){return"function"==typeof e}function n(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!n(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,n,s,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],i(r))return!1;if(o(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(a(r))for(s=Array.prototype.slice.call(arguments,1),u=r.slice(),n=u.length,l=0;n>l;l++)u[l].apply(this,s);return!0},r.prototype.addListener=function(e,t){var n;if(!o(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,o(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(n=i(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!o(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,n,i,s;if(!o(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],i=r.length,n=-1,r===t||o(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(r)){for(s=i;s-- >0;)if(r[s]===t||r[s].listener&&r[s].listener===t){n=s;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],o(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?o(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(o(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}}])});
app/viewControllers/admin/Blog.js
Evyy/cffs-ui
'use strict'; import React from 'react'; import AdminPage from './AdminPage'; import {Link} from 'react-router'; class Blog extends React.Component { constructor(props) { super(props); } render() { return ( <AdminPage title='Blog' className='blog'> <div className="inner"> <p>nothing to see here...</p> <Link to='/admin/new-post'> Create a New Post </Link> </div> </AdminPage> ); } } export default Blog;
packages/material-ui-icons/src/LocationDisabledSharp.js
Kagami/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><g><path d="M23 13v-2h-2.06c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06c-.98.11-1.91.38-2.77.78l1.53 1.53C10.46 5.13 11.22 5 12 5c3.87 0 7 3.13 7 7 0 .79-.13 1.54-.37 2.24l1.53 1.53c.4-.86.67-1.79.78-2.77H23zM4.41 2.86L3 4.27l2.04 2.04C3.97 7.62 3.26 9.23 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c1.77-.2 3.38-.91 4.69-1.98L19.73 21l1.41-1.41L4.41 2.86zM12 19c-3.87 0-7-3.13-7-7 0-1.61.55-3.09 1.46-4.27l9.81 9.81C15.09 18.45 13.61 19 12 19z" /></g></React.Fragment> , 'LocationDisabledSharp');
public/script/my/component/ui/tip.js
yuyang041060120/react-router-demo
import React from 'react'; import $ from 'jquery'; var TipComponent = React.createClass({ render: function () { return ( <div className="alert alert-success ui-tip"> {this.props.content} </div> ) } }); var instant; var timeout; function tip(options) { clearTimeout(timeout); if (!instant) { instant = document.createElement('div'); document.body.appendChild(instant); } React.render(<TipComponent content={options.content}/>, instant); calcuPosition(); this.timeout = setTimeout(function () { React.unmountComponentAtNode(instant); }, 1500); } function calcuPosition() { var $tip = $(instant).find('.alert'); var left = ($(window).width() - $tip.width()) / 2; $tip.css({ left: left }); } export default tip;
src/components/header.js
fuqua/fuqua.github.io
import React from 'react' import { Link } from 'gatsby' import styled from 'styled-components'; const Container = styled.div` ${tw`bg-grey-lightest px-32 py-8`}; ` const Title = styled.h1` ${tw`text-grey-darkest m-0`}; ` const StyledLink = styled(Link)` ${tw`no-underline text-inherit`}; ` const Header = ({ siteTitle }) => ( <Container> <StyledLink to="/"> <Title>{siteTitle}</Title> </StyledLink> </Container> ) export default Header
karma-shim.js
spinnaker/deck
/* eslint-disable @spinnaker/import-sort */ import jQuery from 'jquery'; // jquery has to be first or many a test will break global.$ = global.jQuery = jQuery; import { configure } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; configure({ adapter: new Adapter() }); Error.stackTraceLimit = Infinity; import './packages/app/src/settings'; import './packages/app/src/app'; import { jasmineMockHttpSupport } from './packages/core/src/api/mock/jasmine'; // angular 1 test harness import 'angular'; import 'angular-mocks'; beforeEach(angular.mock.module('bcherny/ngimport')); jasmineMockHttpSupport(); let testContext; testContext = require.context('./packages/amazon/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/appengine/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/azure/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/cloudfoundry/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/core/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/dcos/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/docker/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/ecs/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/google/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/huaweicloud/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/kubernetes/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/oracle/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/tencentcloud/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext); testContext = require.context('./packages/titus/src', true, /\.spec\.(js|ts|tsx)$/); testContext.keys().forEach(testContext);
src/routes.js
Alyar-Ruby/react-redux-auth0
import React from 'react' import { Route, IndexRoute } from 'react-router' import { AppContainer } from './containers' import { HomePage, DashboardPage, AboutPage, NotFoundPage } from './components' export default function createRoutes() { return( <Route path='/' component={AppContainer}> <IndexRoute component={HomePage} /> <Route path='/dashboard' component={DashboardPage} /> <Route path='/about' component={AboutPage} /> <Route path='*' component={NotFoundPage} /> </Route> ) }
app/components/Login/index.js
hamzasurti/tenx-hackday-restart
/** * * Login * */ import React from 'react'; // import styled from 'styled-components'; import { FormattedMessage } from 'react-intl'; import messages from './messages'; class Login extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function render() { return ( <div> <FormattedMessage {...messages.header} /> </div> ); } } Login.propTypes = { }; export default Login;
test/spec/autoCompleteSpec.js
ishenli/winnie-react
/** * @file autoComplete test */ var React = require('react/addons'); var TestUtils = React.addons.TestUtils; var Simulate = TestUtils.Simulate; var AutoComplete = require('../../src/AutoComplete'); var keyCode = require('../../src/keyCode'); var node = document.createElement('div'); document.body.appendChild(node); describe('AutoComplete', function () { var autoComplete; var changeHook; function handleChangeClick() { if (changeHook) { changeHook.apply(this, arguments); } } function getDataSource() { var list = []; for (var i = 0; i < 5; i++) { list.push({ key:i, value:'value' + i }) } return list; } function handleSelect(value) { console.log(value); } beforeEach(function (done) { React.render(<AutoComplete dataSource={getDataSource} onSelect={handleSelect}/>, node, function() { autoComplete = this; done(); }); }); afterEach(function () { React.unmountComponentAtNode(node); changeHook = null; }); it('render ok', function () { expect(TestUtils.scryRenderedDOMComponentsWithClass(autoComplete, 'ui-autocomplete').length).toBe(1); }); it('suggestion ok', function () { var input = React.findDOMNode(TestUtils.scryRenderedDOMComponentsWithTag(autoComplete,'input')[0]); Simulate.change(input, {target: {value: 'query'}}); expect(autoComplete.count).toEqual(getDataSource().length); expect(TestUtils.scryRenderedDOMComponentsWithClass(autoComplete, 'ui-suggestion-item').length).toBe(5); }); it('select ok', function () { var input = React.findDOMNode(TestUtils.scryRenderedDOMComponentsWithTag(autoComplete,'input')[0]); Simulate.change(input, {target: {value: 'query'}}); Simulate.keyDown(input, {keyCode: keyCode.DOWN}); // 向下移动一个 expect(input.value).toEqual('value0'); expect(React.findDOMNode(TestUtils.scryRenderedDOMComponentsWithTag(autoComplete, 'li')[0]).className.indexOf('ui-hover')>-1).toBe(true); }); });
Rosa_Madeira/Revendedor/src/components/common/Button.js
victorditadi/IQApp
import React from 'react'; import { Text, TouchableOpacity } from 'react-native'; const ButtonForm = ({ onPress, children}) => { const { buttonStyle, textStyle } = styles; return ( <TouchableOpacity onPress={onPress} style={buttonStyle}> <Text style={textStyle}> {children} </Text> </TouchableOpacity> ); }; const styles = { textStyle: { alignSelf: 'center', color: '#007aff', fontSize: 16, fontWeight: '600', paddingTop: 10, paddingBottom: 10 }, buttonStyle: { flex: 1, alignSelf: 'stretch', backgroundColor: '#fff', borderRadius: 5, borderWidth: 1, borderColor: '#007aff', marginLeft: 5, marginRight: 5 } }; export { ButtonForm };
ajax/libs/analytics.js/2.8.4/analytics.js
menuka94/cdnjs
(function umd(require){ if ('object' == typeof exports) { module.exports = require('1'); } else if ('function' == typeof define && define.amd) { define(function(){ return require('1'); }); } else { this['analytics'] = require('1'); } })((function outer(modules, cache, entries){ /** * Global */ var global = (function(){ return this; })(); /** * Require `name`. * * @param {String} name * @param {Boolean} jumped * @api public */ function require(name, jumped){ if (cache[name]) return cache[name].exports; if (modules[name]) return call(name, require); throw new Error('cannot find module "' + name + '"'); } /** * Call module `id` and cache it. * * @param {Number} id * @param {Function} require * @return {Function} * @api private */ function call(id, require){ var m = cache[id] = { exports: {} }; var mod = modules[id]; var name = mod[2]; var fn = mod[0]; fn.call(m.exports, function(req){ var dep = modules[id][1][req]; return require(dep ? dep : req); }, m, m.exports, outer, modules, cache, entries); // expose as `name`. if (name) cache[name] = cache[id]; return cache[id].exports; } /** * Require all entries exposing them on global if needed. */ for (var id in entries) { if (entries[id]) { global[entries[id]] = require(id); } else { require(id); } } /** * Duo flag. */ require.duo = true; /** * Expose cache. */ require.cache = cache; /** * Expose modules */ require.modules = modules; /** * Return newest require. */ return require; })({ 1: [function(require, module, exports) { /** * Analytics.js * * (C) 2013 Segment.io Inc. */ var _analytics = window.analytics; var Integrations = require('analytics.js-integrations'); var Analytics = require('./analytics'); var each = require('each'); /** * Expose the `analytics` singleton. */ var analytics = module.exports = exports = new Analytics(); /** * Expose require */ analytics.require = require; /** * Expose `VERSION`. */ exports.VERSION = require('../bower.json').version; /** * Add integrations. */ each(Integrations, function (name, Integration) { analytics.use(Integration); }); }, {"analytics.js-integrations":2,"./analytics":3,"each":4,"../bower.json":5}], 2: [function(require, module, exports) { /** * Module dependencies. */ var each = require('each'); var plugins = require('./integrations.js'); /** * Expose the integrations, using their own `name` from their `prototype`. */ each(plugins, function(plugin){ var name = (plugin.Integration || plugin).prototype.name; exports[name] = plugin; }); }, {"each":4,"./integrations.js":6}], 4: [function(require, module, exports) { /** * Module dependencies. */ var type = require('type'); /** * HOP reference. */ var has = Object.prototype.hasOwnProperty; /** * Iterate the given `obj` and invoke `fn(val, i)`. * * @param {String|Array|Object} obj * @param {Function} fn * @api public */ module.exports = function(obj, fn){ switch (type(obj)) { case 'array': return array(obj, fn); case 'object': if ('number' == typeof obj.length) return array(obj, fn); return object(obj, fn); case 'string': return string(obj, fn); } }; /** * Iterate string chars. * * @param {String} obj * @param {Function} fn * @api private */ function string(obj, fn) { for (var i = 0; i < obj.length; ++i) { fn(obj.charAt(i), i); } } /** * Iterate object keys. * * @param {Object} obj * @param {Function} fn * @api private */ function object(obj, fn) { for (var key in obj) { if (has.call(obj, key)) { fn(key, obj[key]); } } } /** * Iterate array-ish. * * @param {Array|Object} obj * @param {Function} fn * @api private */ function array(obj, fn) { for (var i = 0; i < obj.length; ++i) { fn(obj[i], i); } } }, {"type":7}], 7: [function(require, module, exports) { /** * toString ref. */ var toString = Object.prototype.toString; /** * Return the type of `val`. * * @param {Mixed} val * @return {String} * @api public */ module.exports = function(val){ switch (toString.call(val)) { case '[object Date]': return 'date'; case '[object RegExp]': return 'regexp'; case '[object Arguments]': return 'arguments'; case '[object Array]': return 'array'; case '[object Error]': return 'error'; } if (val === null) return 'null'; if (val === undefined) return 'undefined'; if (val !== val) return 'nan'; if (val && val.nodeType === 1) return 'element'; val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val) return typeof val; }; }, {}], 6: [function(require, module, exports) { /** * DON'T EDIT THIS FILE. It's automatically generated! */ module.exports = [ require('./lib/adroll'), require('./lib/adwords'), require('./lib/alexa'), require('./lib/amplitude'), require('./lib/appcues'), require('./lib/atatus'), require('./lib/autosend'), require('./lib/awesm'), require('./lib/bing-ads'), require('./lib/blueshift'), require('./lib/bronto'), require('./lib/bugherd'), require('./lib/bugsnag'), require('./lib/chartbeat'), require('./lib/churnbee'), require('./lib/clicktale'), require('./lib/clicky'), require('./lib/comscore'), require('./lib/crazy-egg'), require('./lib/curebit'), require('./lib/customerio'), require('./lib/drip'), require('./lib/errorception'), require('./lib/evergage'), require('./lib/extole'), require('./lib/facebook-conversion-tracking'), require('./lib/foxmetrics'), require('./lib/frontleaf'), require('./lib/fullstory'), require('./lib/gauges'), require('./lib/get-satisfaction'), require('./lib/google-analytics'), require('./lib/google-tag-manager'), require('./lib/gosquared'), require('./lib/heap'), require('./lib/hellobar'), require('./lib/hittail'), require('./lib/hubspot'), require('./lib/improvely'), require('./lib/insidevault'), require('./lib/inspectlet'), require('./lib/intercom'), require('./lib/keen-io'), require('./lib/kenshoo'), require('./lib/kissmetrics'), require('./lib/klaviyo'), require('./lib/livechat'), require('./lib/lucky-orange'), require('./lib/lytics'), require('./lib/mixpanel'), require('./lib/mojn'), require('./lib/mouseflow'), require('./lib/mousestats'), require('./lib/navilytics'), require('./lib/nudgespot'), require('./lib/olark'), require('./lib/optimizely'), require('./lib/perfect-audience'), require('./lib/pingdom'), require('./lib/piwik'), require('./lib/preact'), require('./lib/qualaroo'), require('./lib/quantcast'), require('./lib/rollbar'), require('./lib/saasquatch'), require('./lib/satismeter'), require('./lib/segmentio'), require('./lib/sentry'), require('./lib/snapengage'), require('./lib/spinnakr'), require('./lib/tapstream'), require('./lib/trakio'), require('./lib/twitter-ads'), require('./lib/userlike'), require('./lib/uservoice'), require('./lib/vero'), require('./lib/visual-website-optimizer'), require('./lib/webengage'), require('./lib/woopra'), require('./lib/yandex-metrica') ]; }, {"./lib/adroll":8,"./lib/adwords":9,"./lib/alexa":10,"./lib/amplitude":11,"./lib/appcues":12,"./lib/atatus":13,"./lib/autosend":14,"./lib/awesm":15,"./lib/bing-ads":16,"./lib/blueshift":17,"./lib/bronto":18,"./lib/bugherd":19,"./lib/bugsnag":20,"./lib/chartbeat":21,"./lib/churnbee":22,"./lib/clicktale":23,"./lib/clicky":24,"./lib/comscore":25,"./lib/crazy-egg":26,"./lib/curebit":27,"./lib/customerio":28,"./lib/drip":29,"./lib/errorception":30,"./lib/evergage":31,"./lib/extole":32,"./lib/facebook-conversion-tracking":33,"./lib/foxmetrics":34,"./lib/frontleaf":35,"./lib/fullstory":36,"./lib/gauges":37,"./lib/get-satisfaction":38,"./lib/google-analytics":39,"./lib/google-tag-manager":40,"./lib/gosquared":41,"./lib/heap":42,"./lib/hellobar":43,"./lib/hittail":44,"./lib/hubspot":45,"./lib/improvely":46,"./lib/insidevault":47,"./lib/inspectlet":48,"./lib/intercom":49,"./lib/keen-io":50,"./lib/kenshoo":51,"./lib/kissmetrics":52,"./lib/klaviyo":53,"./lib/livechat":54,"./lib/lucky-orange":55,"./lib/lytics":56,"./lib/mixpanel":57,"./lib/mojn":58,"./lib/mouseflow":59,"./lib/mousestats":60,"./lib/navilytics":61,"./lib/nudgespot":62,"./lib/olark":63,"./lib/optimizely":64,"./lib/perfect-audience":65,"./lib/pingdom":66,"./lib/piwik":67,"./lib/preact":68,"./lib/qualaroo":69,"./lib/quantcast":70,"./lib/rollbar":71,"./lib/saasquatch":72,"./lib/satismeter":73,"./lib/segmentio":74,"./lib/sentry":75,"./lib/snapengage":76,"./lib/spinnakr":77,"./lib/tapstream":78,"./lib/trakio":79,"./lib/twitter-ads":80,"./lib/userlike":81,"./lib/uservoice":82,"./lib/vero":83,"./lib/visual-website-optimizer":84,"./lib/webengage":85,"./lib/woopra":86,"./lib/yandex-metrica":87}], 8: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var snake = require('to-snake-case'); var useHttps = require('use-https'); var each = require('each'); var is = require('is'); var del = require('obj-case').del; /** * HOP */ var has = Object.prototype.hasOwnProperty; /** * Expose `AdRoll` integration. */ var AdRoll = module.exports = integration('AdRoll') .assumesPageview() .global('__adroll_loaded') .global('adroll_adv_id') .global('adroll_pix_id') .global('adroll_custom_data') .option('advId', '') .option('pixId', '') .tag('http', '<script src="http://a.adroll.com/j/roundtrip.js">') .tag('https', '<script src="https://s.adroll.com/j/roundtrip.js">') .mapping('events'); /** * Initialize. * * http://support.adroll.com/getting-started-in-4-easy-steps/#step-one * http://support.adroll.com/enhanced-conversion-tracking/ * * @param {Object} page */ AdRoll.prototype.initialize = function(page){ window.adroll_adv_id = this.options.advId; window.adroll_pix_id = this.options.pixId; window.__adroll_loaded = true; var name = useHttps() ? 'https' : 'http'; this.load(name, this.ready); }; /** * Loaded? * * @return {Boolean} */ AdRoll.prototype.loaded = function(){ return window.__adroll; }; /** * Page. * * http://support.adroll.com/segmenting-clicks/ * * @param {Page} page */ AdRoll.prototype.page = function(page){ var name = page.fullName(); this.track(page.track(name)); }; /** * Track. * * @param {Track} track */ AdRoll.prototype.track = function(track){ var event = track.event(); var user = this.analytics.user(); var events = this.events(event); var total = track.revenue() || track.total() || 0; var orderId = track.orderId() || 0; var productId = track.id(); var sku = track.sku(); var customProps = track.properties(); var data = {}; if (user.id()) data.user_id = user.id(); if (orderId) data.order_id = orderId; if (productId) data.product_id = productId; if (sku) data.sku = sku; if (total) data.adroll_conversion_value_in_dollars = total; del(customProps, "revenue"); del(customProps, "total"); del(customProps, "orderId"); del(customProps, "id"); del(customProps, "sku"); if (!is.empty(customProps)) data.adroll_custom_data = customProps; each(events, function(event){ // the adroll interface only allows for // segment names which are snake cased. data.adroll_segments = snake(event); window.__adroll.record_user(data); }); // no events found if (!events.length) { data.adroll_segments = snake(event); window.__adroll.record_user(data); } }; }, {"analytics.js-integration":88,"to-snake-case":89,"use-https":90,"each":4,"is":91,"obj-case":92}], 88: [function(require, module, exports) { /** * Module dependencies. */ var bind = require('bind'); var callback = require('callback'); var clone = require('clone'); var debug = require('debug'); var defaults = require('defaults'); var protos = require('./protos'); var slug = require('slug'); var statics = require('./statics'); /** * Expose `createIntegration`. */ module.exports = createIntegration; /** * Create a new `Integration` constructor. * * @param {String} name * @return {Function} Integration */ function createIntegration(name){ /** * Initialize a new `Integration`. * * @param {Object} options */ function Integration(options){ if (options && options.addIntegration) { // plugin return options.addIntegration(Integration); } this.debug = debug('analytics:integration:' + slug(name)); this.options = defaults(clone(options) || {}, this.defaults); this._queue = []; this.once('ready', bind(this, this.flush)); Integration.emit('construct', this); this.ready = bind(this, this.ready); this._wrapInitialize(); this._wrapPage(); this._wrapTrack(); } Integration.prototype.defaults = {}; Integration.prototype.globals = []; Integration.prototype.templates = {}; Integration.prototype.name = name; for (var key in statics) Integration[key] = statics[key]; for (var key in protos) Integration.prototype[key] = protos[key]; return Integration; } }, {"bind":93,"callback":94,"clone":95,"debug":96,"defaults":97,"./protos":98,"slug":99,"./statics":100}], 93: [function(require, module, exports) { var bind = require('bind') , bindAll = require('bind-all'); /** * Expose `bind`. */ module.exports = exports = bind; /** * Expose `bindAll`. */ exports.all = bindAll; /** * Expose `bindMethods`. */ exports.methods = bindMethods; /** * Bind `methods` on `obj` to always be called with the `obj` as context. * * @param {Object} obj * @param {String} methods... */ function bindMethods (obj, methods) { methods = [].slice.call(arguments, 1); for (var i = 0, method; method = methods[i]; i++) { obj[method] = bind(obj, obj[method]); } return obj; } }, {"bind":101,"bind-all":102}], 101: [function(require, module, exports) { /** * Slice reference. */ var slice = [].slice; /** * Bind `obj` to `fn`. * * @param {Object} obj * @param {Function|String} fn or string * @return {Function} * @api public */ module.exports = function(obj, fn){ if ('string' == typeof fn) fn = obj[fn]; if ('function' != typeof fn) throw new Error('bind() requires a function'); var args = slice.call(arguments, 2); return function(){ return fn.apply(obj, args.concat(slice.call(arguments))); } }; }, {}], 102: [function(require, module, exports) { try { var bind = require('bind'); var type = require('type'); } catch (e) { var bind = require('bind-component'); var type = require('type-component'); } module.exports = function (obj) { for (var key in obj) { var val = obj[key]; if (type(val) === 'function') obj[key] = bind(obj, obj[key]); } return obj; }; }, {"bind":101,"type":7}], 94: [function(require, module, exports) { var next = require('next-tick'); /** * Expose `callback`. */ module.exports = callback; /** * Call an `fn` back synchronously if it exists. * * @param {Function} fn */ function callback (fn) { if ('function' === typeof fn) fn(); } /** * Call an `fn` back asynchronously if it exists. If `wait` is ommitted, the * `fn` will be called on next tick. * * @param {Function} fn * @param {Number} wait (optional) */ callback.async = function (fn, wait) { if ('function' !== typeof fn) return; if (!wait) return next(fn); setTimeout(fn, wait); }; /** * Symmetry. */ callback.sync = callback; }, {"next-tick":103}], 103: [function(require, module, exports) { "use strict" if (typeof setImmediate == 'function') { module.exports = function(f){ setImmediate(f) } } // legacy node.js else if (typeof process != 'undefined' && typeof process.nextTick == 'function') { module.exports = process.nextTick } // fallback for other environments / postMessage behaves badly on IE8 else if (typeof window == 'undefined' || window.ActiveXObject || !window.postMessage) { module.exports = function(f){ setTimeout(f) }; } else { var q = []; window.addEventListener('message', function(){ var i = 0; while (i < q.length) { try { q[i++](); } catch (e) { q = q.slice(i); window.postMessage('tic!', '*'); throw e; } } q.length = 0; }, true); module.exports = function(fn){ if (!q.length) window.postMessage('tic!', '*'); q.push(fn); } } }, {}], 95: [function(require, module, exports) { /** * Module dependencies. */ var type; try { type = require('type'); } catch(e){ type = require('type-component'); } /** * Module exports. */ module.exports = clone; /** * Clones objects. * * @param {Mixed} any object * @api public */ function clone(obj){ switch (type(obj)) { case 'object': var copy = {}; for (var key in obj) { if (obj.hasOwnProperty(key)) { copy[key] = clone(obj[key]); } } return copy; case 'array': var copy = new Array(obj.length); for (var i = 0, l = obj.length; i < l; i++) { copy[i] = clone(obj[i]); } return copy; case 'regexp': // from millermedeiros/amd-utils - MIT var flags = ''; flags += obj.multiline ? 'm' : ''; flags += obj.global ? 'g' : ''; flags += obj.ignoreCase ? 'i' : ''; return new RegExp(obj.source, flags); case 'date': return new Date(obj.getTime()); default: // string, number, boolean, … return obj; } } }, {"type":7}], 96: [function(require, module, exports) { if ('undefined' == typeof window) { module.exports = require('./lib/debug'); } else { module.exports = require('./debug'); } }, {"./lib/debug":104,"./debug":105}], 104: [function(require, module, exports) { /** * Module dependencies. */ var tty = require('tty'); /** * Expose `debug()` as the module. */ module.exports = debug; /** * Enabled debuggers. */ var names = [] , skips = []; (process.env.DEBUG || '') .split(/[\s,]+/) .forEach(function(name){ name = name.replace('*', '.*?'); if (name[0] === '-') { skips.push(new RegExp('^' + name.substr(1) + '$')); } else { names.push(new RegExp('^' + name + '$')); } }); /** * Colors. */ var colors = [6, 2, 3, 4, 5, 1]; /** * Previous debug() call. */ var prev = {}; /** * Previously assigned color. */ var prevColor = 0; /** * Is stdout a TTY? Colored output is disabled when `true`. */ var isatty = tty.isatty(2); /** * Select a color. * * @return {Number} * @api private */ function color() { return colors[prevColor++ % colors.length]; } /** * Humanize the given `ms`. * * @param {Number} m * @return {String} * @api private */ function humanize(ms) { var sec = 1000 , min = 60 * 1000 , hour = 60 * min; if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; if (ms >= min) return (ms / min).toFixed(1) + 'm'; if (ms >= sec) return (ms / sec | 0) + 's'; return ms + 'ms'; } /** * Create a debugger with the given `name`. * * @param {String} name * @return {Type} * @api public */ function debug(name) { function disabled(){} disabled.enabled = false; var match = skips.some(function(re){ return re.test(name); }); if (match) return disabled; match = names.some(function(re){ return re.test(name); }); if (!match) return disabled; var c = color(); function colored(fmt) { fmt = coerce(fmt); var curr = new Date; var ms = curr - (prev[name] || curr); prev[name] = curr; fmt = ' \u001b[9' + c + 'm' + name + ' ' + '\u001b[3' + c + 'm\u001b[90m' + fmt + '\u001b[3' + c + 'm' + ' +' + humanize(ms) + '\u001b[0m'; console.error.apply(this, arguments); } function plain(fmt) { fmt = coerce(fmt); fmt = new Date().toUTCString() + ' ' + name + ' ' + fmt; console.error.apply(this, arguments); } colored.enabled = plain.enabled = true; return isatty || process.env.DEBUG_COLORS ? colored : plain; } /** * Coerce `val`. */ function coerce(val) { if (val instanceof Error) return val.stack || val.message; return val; } }, {}], 105: [function(require, module, exports) { /** * Expose `debug()` as the module. */ module.exports = debug; /** * Create a debugger with the given `name`. * * @param {String} name * @return {Type} * @api public */ function debug(name) { if (!debug.enabled(name)) return function(){}; return function(fmt){ fmt = coerce(fmt); var curr = new Date; var ms = curr - (debug[name] || curr); debug[name] = curr; fmt = name + ' ' + fmt + ' +' + debug.humanize(ms); // This hackery is required for IE8 // where `console.log` doesn't have 'apply' window.console && console.log && Function.prototype.apply.call(console.log, console, arguments); } } /** * The currently active debug mode names. */ debug.names = []; debug.skips = []; /** * Enables a debug mode by name. This can include modes * separated by a colon and wildcards. * * @param {String} name * @api public */ debug.enable = function(name) { try { localStorage.debug = name; } catch(e){} var split = (name || '').split(/[\s,]+/) , len = split.length; for (var i = 0; i < len; i++) { name = split[i].replace('*', '.*?'); if (name[0] === '-') { debug.skips.push(new RegExp('^' + name.substr(1) + '$')); } else { debug.names.push(new RegExp('^' + name + '$')); } } }; /** * Disable debug output. * * @api public */ debug.disable = function(){ debug.enable(''); }; /** * Humanize the given `ms`. * * @param {Number} m * @return {String} * @api private */ debug.humanize = function(ms) { var sec = 1000 , min = 60 * 1000 , hour = 60 * min; if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; if (ms >= min) return (ms / min).toFixed(1) + 'm'; if (ms >= sec) return (ms / sec | 0) + 's'; return ms + 'ms'; }; /** * Returns true if the given mode name is enabled, false otherwise. * * @param {String} name * @return {Boolean} * @api public */ debug.enabled = function(name) { for (var i = 0, len = debug.skips.length; i < len; i++) { if (debug.skips[i].test(name)) { return false; } } for (var i = 0, len = debug.names.length; i < len; i++) { if (debug.names[i].test(name)) { return true; } } return false; }; /** * Coerce `val`. */ function coerce(val) { if (val instanceof Error) return val.stack || val.message; return val; } // persist try { if (window.localStorage) debug.enable(localStorage.debug); } catch(e){} }, {}], 97: [function(require, module, exports) { 'use strict'; /** * Merge default values. * * @param {Object} dest * @param {Object} defaults * @return {Object} * @api public */ var defaults = function (dest, src, recursive) { for (var prop in src) { if (recursive && dest[prop] instanceof Object && src[prop] instanceof Object) { dest[prop] = defaults(dest[prop], src[prop], true); } else if (! (prop in dest)) { dest[prop] = src[prop]; } } return dest; }; /** * Expose `defaults`. */ module.exports = defaults; }, {}], 98: [function(require, module, exports) { /** * Module dependencies. */ var loadScript = require('load-script'); var loadIframe = require('load-iframe'); var events = require('analytics-events'); var normalize = require('to-no-case'); var callback = require('callback'); var Emitter = require('emitter'); var tick = require('next-tick'); var after = require('after'); var each = require('each'); var type = require('type'); var fmt = require('fmt'); /** * Noop. */ function noop(){} /** * Window defaults. */ var setTimeout = window.setTimeout; var setInterval = window.setInterval; var onerror = window.onerror; var onload = null; /** * Mixin emitter. */ Emitter(exports); /** * Initialize. */ exports.initialize = function(){ var ready = this.ready; tick(ready); }; /** * Loaded? * * @return {Boolean} * @api private */ exports.loaded = function(){ return false; }; /** * Page. * * @param {Page} page */ exports.page = function(page){}; /** * Track. * * @param {Track} track */ exports.track = function(track){}; /** * Get events that match `str`. * * Examples: * * events = { my_event: 'a4991b88' } * .map(events, 'My Event'); * // => ["a4991b88"] * .map(events, 'whatever'); * // => [] * * events = [{ key: 'my event', value: '9b5eb1fa' }] * .map(events, 'my_event'); * // => ["9b5eb1fa"] * .map(events, 'whatever'); * // => [] * * @param {String} str * @return {Array} * @api public */ exports.map = function(obj, str){ var a = normalize(str); var ret = []; // noop if (!obj) return ret; // object if ('object' == type(obj)) { for (var k in obj) { var item = obj[k]; var b = normalize(k); if (b == a) ret.push(item); } } // array if ('array' == type(obj)) { if (!obj.length) return ret; if (!obj[0].key) return ret; for (var i = 0; i < obj.length; ++i) { var item = obj[i]; var b = normalize(item.key); if (b == a) ret.push(item.value); } } return ret; }; /** * Invoke a `method` that may or may not exist on the prototype with `args`, * queueing or not depending on whether the integration is "ready". Don't * trust the method call, since it contains integration party code. * * @param {String} method * @param {Mixed} args... * @api private */ exports.invoke = function(method){ if (!this[method]) return; var args = [].slice.call(arguments, 1); if (!this._ready) return this.queue(method, args); var ret; try { this.debug('%s with %o', method, args); ret = this[method].apply(this, args); } catch (e) { this.debug('error %o calling %s with %o', e, method, args); } return ret; }; /** * Queue a `method` with `args`. If the integration assumes an initial * pageview, then let the first call to `page` pass through. * * @param {String} method * @param {Array} args * @api private */ exports.queue = function(method, args){ if ('page' == method && this._assumesPageview && !this._initialized) { return this.page.apply(this, args); } this._queue.push({ method: method, args: args }); }; /** * Flush the internal queue. * * @api private */ exports.flush = function(){ this._ready = true; var call; while (call = this._queue.shift()) this[call.method].apply(this, call.args); }; /** * Reset the integration, removing its global variables. * * @api private */ exports.reset = function(){ for (var i = 0, key; key = this.globals[i]; i++) window[key] = undefined; window.setTimeout = setTimeout; window.setInterval = setInterval; window.onerror = onerror; window.onload = onload; }; /** * Load a tag by `name`. * * @param {String} name * @param {Function} [fn] */ exports.load = function(name, locals, fn){ if ('function' == typeof name) fn = name, locals = null, name = null; if (name && 'object' == typeof name) fn = locals, locals = name, name = null; if ('function' == typeof locals) fn = locals, locals = null; name = name || 'library'; locals = locals || {}; locals = this.locals(locals); var template = this.templates[name]; if (!template) throw new Error(fmt('template "%s" not defined.', name)); var attrs = render(template, locals); var fn = fn || noop; var self = this; var el; switch (template.type) { case 'img': attrs.width = 1; attrs.height = 1; el = loadImage(attrs, fn); break; case 'script': el = loadScript(attrs, function(err){ if (!err) return fn(); self.debug('error loading "%s" error="%s"', self.name, err); }); // TODO: hack until refactoring load-script delete attrs.src; each(attrs, function(key, val){ el.setAttribute(key, val); }); break; case 'iframe': el = loadIframe(attrs, fn); break; } return el; }; /** * Locals for tag templates. * * By default it includes a cache buster, * and all of the options. * * @param {Object} [locals] * @return {Object} */ exports.locals = function(locals){ locals = locals || {}; var cache = Math.floor(new Date().getTime() / 3600000); if (!locals.hasOwnProperty('cache')) locals.cache = cache; each(this.options, function(key, val){ if (!locals.hasOwnProperty(key)) locals[key] = val; }); return locals; }; /** * Simple way to emit ready. */ exports.ready = function(){ this.emit('ready'); }; /** * Wrap the initialize method in an exists check, so we don't have to do it for * every single integration. * * @api private */ exports._wrapInitialize = function(){ var initialize = this.initialize; this.initialize = function(){ this.debug('initialize'); this._initialized = true; var ret = initialize.apply(this, arguments); this.emit('initialize'); return ret; }; if (this._assumesPageview) this.initialize = after(2, this.initialize); }; /** * Wrap the page method to call `initialize` instead if the integration assumes * a pageview. * * @api private */ exports._wrapPage = function(){ var page = this.page; this.page = function(){ if (this._assumesPageview && !this._initialized) { return this.initialize.apply(this, arguments); } return page.apply(this, arguments); }; }; /** * Wrap the track method to call other ecommerce methods if * available depending on the `track.event()`. * * @api private */ exports._wrapTrack = function(){ var t = this.track; this.track = function(track){ var event = track.event(); var called; var ret; for (var method in events) { var regexp = events[method]; if (!this[method]) continue; if (!regexp.test(event)) continue; ret = this[method].apply(this, arguments); called = true; break; } if (!called) ret = t.apply(this, arguments); return ret; }; }; function loadImage(attrs, fn) { fn = fn || function(){}; var img = new Image; img.onerror = error(fn, 'failed to load pixel', img); img.onload = function(){ fn(); }; img.src = attrs.src; img.width = 1; img.height = 1; return img; } function error(fn, message, img){ return function(e){ e = e || window.event; var err = new Error(message); err.event = e; err.source = img; fn(err); }; } /** * Render template + locals into an `attrs` object. * * @param {Object} template * @param {Object} locals * @return {Object} */ function render(template, locals) { var attrs = {}; each(template.attrs, function(key, val){ attrs[key] = val.replace(/\{\{\ *(\w+)\ *\}\}/g, function(_, $1){ return locals[$1]; }); }); return attrs; } }, {"load-script":106,"load-iframe":107,"analytics-events":108,"to-no-case":109,"callback":94,"emitter":110,"next-tick":103,"after":111,"each":112,"type":113,"fmt":114}], 106: [function(require, module, exports) { /** * Module dependencies. */ var onload = require('script-onload'); var tick = require('next-tick'); var type = require('type'); /** * Expose `loadScript`. * * @param {Object} options * @param {Function} fn * @api public */ module.exports = function loadScript(options, fn){ if (!options) throw new Error('Cant load nothing...'); // Allow for the simplest case, just passing a `src` string. if ('string' == type(options)) options = { src : options }; var https = document.location.protocol === 'https:' || document.location.protocol === 'chrome-extension:'; // If you use protocol relative URLs, third-party scripts like Google // Analytics break when testing with `file:` so this fixes that. if (options.src && options.src.indexOf('//') === 0) { options.src = https ? 'https:' + options.src : 'http:' + options.src; } // Allow them to pass in different URLs depending on the protocol. if (https && options.https) options.src = options.https; else if (!https && options.http) options.src = options.http; // Make the `<script>` element and insert it before the first script on the // page, which is guaranteed to exist since this Javascript is running. var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = options.src; // If we have a fn, attach event handlers, even in IE. Based off of // the Third-Party Javascript script loading example: // https://github.com/thirdpartyjs/thirdpartyjs-code/blob/master/examples/templates/02/loading-files/index.html if ('function' == type(fn)) { onload(script, fn); } tick(function(){ // Append after event listeners are attached for IE. var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(script, firstScript); }); // Return the script element in case they want to do anything special, like // give it an ID or attributes. return script; }; }, {"script-onload":115,"next-tick":103,"type":7}], 115: [function(require, module, exports) { // https://github.com/thirdpartyjs/thirdpartyjs-code/blob/master/examples/templates/02/loading-files/index.html /** * Invoke `fn(err)` when the given `el` script loads. * * @param {Element} el * @param {Function} fn * @api public */ module.exports = function(el, fn){ return el.addEventListener ? add(el, fn) : attach(el, fn); }; /** * Add event listener to `el`, `fn()`. * * @param {Element} el * @param {Function} fn * @api private */ function add(el, fn){ el.addEventListener('load', function(_, e){ fn(null, e); }, false); el.addEventListener('error', function(e){ var err = new Error('script error "' + el.src + '"'); err.event = e; fn(err); }, false); } /** * Attach evnet. * * @param {Element} el * @param {Function} fn * @api private */ function attach(el, fn){ el.attachEvent('onreadystatechange', function(e){ if (!/complete|loaded/.test(el.readyState)) return; fn(null, e); }); el.attachEvent('onerror', function(e){ var err = new Error('failed to load the script "' + el.src + '"'); err.event = e || window.event; fn(err); }); } }, {}], 107: [function(require, module, exports) { /** * Module dependencies. */ var onload = require('script-onload'); var tick = require('next-tick'); var type = require('type'); /** * Expose `loadScript`. * * @param {Object} options * @param {Function} fn * @api public */ module.exports = function loadIframe(options, fn){ if (!options) throw new Error('Cant load nothing...'); // Allow for the simplest case, just passing a `src` string. if ('string' == type(options)) options = { src : options }; var https = document.location.protocol === 'https:' || document.location.protocol === 'chrome-extension:'; // If you use protocol relative URLs, third-party scripts like Google // Analytics break when testing with `file:` so this fixes that. if (options.src && options.src.indexOf('//') === 0) { options.src = https ? 'https:' + options.src : 'http:' + options.src; } // Allow them to pass in different URLs depending on the protocol. if (https && options.https) options.src = options.https; else if (!https && options.http) options.src = options.http; // Make the `<iframe>` element and insert it before the first iframe on the // page, which is guaranteed to exist since this Javaiframe is running. var iframe = document.createElement('iframe'); iframe.src = options.src; iframe.width = options.width || 1; iframe.height = options.height || 1; iframe.style.display = 'none'; // If we have a fn, attach event handlers, even in IE. Based off of // the Third-Party Javascript script loading example: // https://github.com/thirdpartyjs/thirdpartyjs-code/blob/master/examples/templates/02/loading-files/index.html if ('function' == type(fn)) { onload(iframe, fn); } tick(function(){ // Append after event listeners are attached for IE. var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(iframe, firstScript); }); // Return the iframe element in case they want to do anything special, like // give it an ID or attributes. return iframe; }; }, {"script-onload":115,"next-tick":103,"type":7}], 108: [function(require, module, exports) { module.exports = { removedProduct: /^[ _]?removed[ _]?product[ _]?$/i, viewedProduct: /^[ _]?viewed[ _]?product[ _]?$/i, viewedProductCategory: /^[ _]?viewed[ _]?product[ _]?category[ _]?$/i, addedProduct: /^[ _]?added[ _]?product[ _]?$/i, completedOrder: /^[ _]?completed[ _]?order[ _]?$/i, startedOrder: /^[ _]?started[ _]?order[ _]?$/i, updatedOrder: /^[ _]?updated[ _]?order[ _]?$/i, refundedOrder: /^[ _]?refunded?[ _]?order[ _]?$/i, viewedProductDetails: /^[ _]?viewed[ _]?product[ _]?details?[ _]?$/i, clickedProduct: /^[ _]?clicked[ _]?product[ _]?$/i, viewedPromotion: /^[ _]?viewed[ _]?promotion?[ _]?$/i, clickedPromotion: /^[ _]?clicked[ _]?promotion?[ _]?$/i, viewedCheckoutStep: /^[ _]?viewed[ _]?checkout[ _]?step[ _]?$/i, completedCheckoutStep: /^[ _]?completed[ _]?checkout[ _]?step[ _]?$/i }; }, {}], 109: [function(require, module, exports) { /** * Expose `toNoCase`. */ module.exports = toNoCase; /** * Test whether a string is camel-case. */ var hasSpace = /\s/; var hasSeparator = /[\W_]/; /** * Remove any starting case from a `string`, like camel or snake, but keep * spaces and punctuation that may be important otherwise. * * @param {String} string * @return {String} */ function toNoCase (string) { if (hasSpace.test(string)) return string.toLowerCase(); if (hasSeparator.test(string)) return unseparate(string).toLowerCase(); return uncamelize(string).toLowerCase(); } /** * Separator splitter. */ var separatorSplitter = /[\W_]+(.|$)/g; /** * Un-separate a `string`. * * @param {String} string * @return {String} */ function unseparate (string) { return string.replace(separatorSplitter, function (m, next) { return next ? ' ' + next : ''; }); } /** * Camelcase splitter. */ var camelSplitter = /(.)([A-Z]+)/g; /** * Un-camelcase a `string`. * * @param {String} string * @return {String} */ function uncamelize (string) { return string.replace(camelSplitter, function (m, previous, uppers) { return previous + ' ' + uppers.toLowerCase().split('').join(' '); }); } }, {}], 110: [function(require, module, exports) { /** * Module dependencies. */ var index = require('indexof'); /** * Expose `Emitter`. */ module.exports = Emitter; /** * Initialize a new `Emitter`. * * @api public */ function Emitter(obj) { if (obj) return mixin(obj); }; /** * Mixin the emitter properties. * * @param {Object} obj * @return {Object} * @api private */ function mixin(obj) { for (var key in Emitter.prototype) { obj[key] = Emitter.prototype[key]; } return obj; } /** * Listen on the given `event` with `fn`. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter.prototype.on = Emitter.prototype.addEventListener = function(event, fn){ this._callbacks = this._callbacks || {}; (this._callbacks[event] = this._callbacks[event] || []) .push(fn); return this; }; /** * Adds an `event` listener that will be invoked a single * time then automatically removed. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter.prototype.once = function(event, fn){ var self = this; this._callbacks = this._callbacks || {}; function on() { self.off(event, on); fn.apply(this, arguments); } fn._off = on; this.on(event, on); return this; }; /** * Remove the given callback for `event` or all * registered callbacks. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function(event, fn){ this._callbacks = this._callbacks || {}; // all if (0 == arguments.length) { this._callbacks = {}; return this; } // specific event var callbacks = this._callbacks[event]; if (!callbacks) return this; // remove all handlers if (1 == arguments.length) { delete this._callbacks[event]; return this; } // remove specific handler var i = index(callbacks, fn._off || fn); if (~i) callbacks.splice(i, 1); return this; }; /** * Emit `event` with the given args. * * @param {String} event * @param {Mixed} ... * @return {Emitter} */ Emitter.prototype.emit = function(event){ this._callbacks = this._callbacks || {}; var args = [].slice.call(arguments, 1) , callbacks = this._callbacks[event]; if (callbacks) { callbacks = callbacks.slice(0); for (var i = 0, len = callbacks.length; i < len; ++i) { callbacks[i].apply(this, args); } } return this; }; /** * Return array of callbacks for `event`. * * @param {String} event * @return {Array} * @api public */ Emitter.prototype.listeners = function(event){ this._callbacks = this._callbacks || {}; return this._callbacks[event] || []; }; /** * Check if this emitter has `event` handlers. * * @param {String} event * @return {Boolean} * @api public */ Emitter.prototype.hasListeners = function(event){ return !! this.listeners(event).length; }; }, {"indexof":116}], 116: [function(require, module, exports) { module.exports = function(arr, obj){ if (arr.indexOf) return arr.indexOf(obj); for (var i = 0; i < arr.length; ++i) { if (arr[i] === obj) return i; } return -1; }; }, {}], 111: [function(require, module, exports) { module.exports = function after (times, func) { // After 0, really? if (times <= 0) return func(); // That's more like it. return function() { if (--times < 1) { return func.apply(this, arguments); } }; }; }, {}], 112: [function(require, module, exports) { /** * Module dependencies. */ try { var type = require('type'); } catch (err) { var type = require('component-type'); } var toFunction = require('to-function'); /** * HOP reference. */ var has = Object.prototype.hasOwnProperty; /** * Iterate the given `obj` and invoke `fn(val, i)` * in optional context `ctx`. * * @param {String|Array|Object} obj * @param {Function} fn * @param {Object} [ctx] * @api public */ module.exports = function(obj, fn, ctx){ fn = toFunction(fn); ctx = ctx || this; switch (type(obj)) { case 'array': return array(obj, fn, ctx); case 'object': if ('number' == typeof obj.length) return array(obj, fn, ctx); return object(obj, fn, ctx); case 'string': return string(obj, fn, ctx); } }; /** * Iterate string chars. * * @param {String} obj * @param {Function} fn * @param {Object} ctx * @api private */ function string(obj, fn, ctx) { for (var i = 0; i < obj.length; ++i) { fn.call(ctx, obj.charAt(i), i); } } /** * Iterate object keys. * * @param {Object} obj * @param {Function} fn * @param {Object} ctx * @api private */ function object(obj, fn, ctx) { for (var key in obj) { if (has.call(obj, key)) { fn.call(ctx, key, obj[key]); } } } /** * Iterate array-ish. * * @param {Array|Object} obj * @param {Function} fn * @param {Object} ctx * @api private */ function array(obj, fn, ctx) { for (var i = 0; i < obj.length; ++i) { fn.call(ctx, obj[i], i); } } }, {"type":113,"component-type":113,"to-function":117}], 113: [function(require, module, exports) { /** * toString ref. */ var toString = Object.prototype.toString; /** * Return the type of `val`. * * @param {Mixed} val * @return {String} * @api public */ module.exports = function(val){ switch (toString.call(val)) { case '[object Function]': return 'function'; case '[object Date]': return 'date'; case '[object RegExp]': return 'regexp'; case '[object Arguments]': return 'arguments'; case '[object Array]': return 'array'; case '[object String]': return 'string'; } if (val === null) return 'null'; if (val === undefined) return 'undefined'; if (val && val.nodeType === 1) return 'element'; if (val === Object(val)) return 'object'; return typeof val; }; }, {}], 117: [function(require, module, exports) { /** * Module Dependencies */ var expr; try { expr = require('props'); } catch(e) { expr = require('component-props'); } /** * Expose `toFunction()`. */ module.exports = toFunction; /** * Convert `obj` to a `Function`. * * @param {Mixed} obj * @return {Function} * @api private */ function toFunction(obj) { switch ({}.toString.call(obj)) { case '[object Object]': return objectToFunction(obj); case '[object Function]': return obj; case '[object String]': return stringToFunction(obj); case '[object RegExp]': return regexpToFunction(obj); default: return defaultToFunction(obj); } } /** * Default to strict equality. * * @param {Mixed} val * @return {Function} * @api private */ function defaultToFunction(val) { return function(obj){ return val === obj; }; } /** * Convert `re` to a function. * * @param {RegExp} re * @return {Function} * @api private */ function regexpToFunction(re) { return function(obj){ return re.test(obj); }; } /** * Convert property `str` to a function. * * @param {String} str * @return {Function} * @api private */ function stringToFunction(str) { // immediate such as "> 20" if (/^ *\W+/.test(str)) return new Function('_', 'return _ ' + str); // properties such as "name.first" or "age > 18" or "age > 18 && age < 36" return new Function('_', 'return ' + get(str)); } /** * Convert `object` to a function. * * @param {Object} object * @return {Function} * @api private */ function objectToFunction(obj) { var match = {}; for (var key in obj) { match[key] = typeof obj[key] === 'string' ? defaultToFunction(obj[key]) : toFunction(obj[key]); } return function(val){ if (typeof val !== 'object') return false; for (var key in match) { if (!(key in val)) return false; if (!match[key](val[key])) return false; } return true; }; } /** * Built the getter function. Supports getter style functions * * @param {String} str * @return {String} * @api private */ function get(str) { var props = expr(str); if (!props.length) return '_.' + str; var val, i, prop; for (i = 0; i < props.length; i++) { prop = props[i]; val = '_.' + prop; val = "('function' == typeof " + val + " ? " + val + "() : " + val + ")"; // mimic negative lookbehind to avoid problems with nested properties str = stripNested(prop, str, val); } return str; } /** * Mimic negative lookbehind to avoid problems with nested properties. * * See: http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript * * @param {String} prop * @param {String} str * @param {String} val * @return {String} * @api private */ function stripNested (prop, str, val) { return str.replace(new RegExp('(\\.)?' + prop, 'g'), function($0, $1) { return $1 ? $0 : val; }); } }, {"props":118,"component-props":118}], 118: [function(require, module, exports) { /** * Global Names */ var globals = /\b(this|Array|Date|Object|Math|JSON)\b/g; /** * Return immediate identifiers parsed from `str`. * * @param {String} str * @param {String|Function} map function or prefix * @return {Array} * @api public */ module.exports = function(str, fn){ var p = unique(props(str)); if (fn && 'string' == typeof fn) fn = prefixed(fn); if (fn) return map(str, p, fn); return p; }; /** * Return immediate identifiers in `str`. * * @param {String} str * @return {Array} * @api private */ function props(str) { return str .replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g, '') .replace(globals, '') .match(/[$a-zA-Z_]\w*/g) || []; } /** * Return `str` with `props` mapped with `fn`. * * @param {String} str * @param {Array} props * @param {Function} fn * @return {String} * @api private */ function map(str, props, fn) { var re = /\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g; return str.replace(re, function(_){ if ('(' == _[_.length - 1]) return fn(_); if (!~props.indexOf(_)) return _; return fn(_); }); } /** * Return unique array. * * @param {Array} arr * @return {Array} * @api private */ function unique(arr) { var ret = []; for (var i = 0; i < arr.length; i++) { if (~ret.indexOf(arr[i])) continue; ret.push(arr[i]); } return ret; } /** * Map with prefix `str`. */ function prefixed(str) { return function(_){ return str + _; }; } }, {}], 114: [function(require, module, exports) { /** * toString. */ var toString = window.JSON ? JSON.stringify : function(_){ return String(_); }; /** * Export `fmt` */ module.exports = fmt; /** * Formatters */ fmt.o = toString; fmt.s = String; fmt.d = parseInt; /** * Format the given `str`. * * @param {String} str * @param {...} args * @return {String} * @api public */ function fmt(str){ var args = [].slice.call(arguments, 1); var j = 0; return str.replace(/%([a-z])/gi, function(_, f){ return fmt[f] ? fmt[f](args[j++]) : _ + f; }); } }, {}], 99: [function(require, module, exports) { /** * Generate a slug from the given `str`. * * example: * * generate('foo bar'); * // > foo-bar * * @param {String} str * @param {Object} options * @config {String|RegExp} [replace] characters to replace, defaulted to `/[^a-z0-9]/g` * @config {String} [separator] separator to insert, defaulted to `-` * @return {String} */ module.exports = function (str, options) { options || (options = {}); return str.toLowerCase() .replace(options.replace || /[^a-z0-9]/g, ' ') .replace(/^ +| +$/g, '') .replace(/ +/g, options.separator || '-') }; }, {}], 100: [function(require, module, exports) { /** * Module dependencies. */ var after = require('after'); var domify = require('domify'); var each = require('each'); var Emitter = require('emitter'); /** * Mixin emitter. */ Emitter(exports); /** * Add a new option to the integration by `key` with default `value`. * * @param {String} key * @param {Mixed} value * @return {Integration} */ exports.option = function(key, value){ this.prototype.defaults[key] = value; return this; }; /** * Add a new mapping option. * * This will create a method `name` that will return a mapping * for you to use. * * Example: * * Integration('My Integration') * .mapping('events'); * * new MyIntegration().track('My Event'); * * .track = function(track){ * var events = this.events(track.event()); * each(events, send); * }; * * @param {String} name * @return {Integration} */ exports.mapping = function(name){ this.option(name, []); this.prototype[name] = function(str){ return this.map(this.options[name], str); }; return this; }; /** * Register a new global variable `key` owned by the integration, which will be * used to test whether the integration is already on the page. * * @param {String} global * @return {Integration} */ exports.global = function(key){ this.prototype.globals.push(key); return this; }; /** * Mark the integration as assuming an initial pageview, so to defer loading * the script until the first `page` call, noop the first `initialize`. * * @return {Integration} */ exports.assumesPageview = function(){ this.prototype._assumesPageview = true; return this; }; /** * Mark the integration as being "ready" once `load` is called. * * @return {Integration} */ exports.readyOnLoad = function(){ this.prototype._readyOnLoad = true; return this; }; /** * Mark the integration as being "ready" once `initialize` is called. * * @return {Integration} */ exports.readyOnInitialize = function(){ this.prototype._readyOnInitialize = true; return this; }; /** * Define a tag to be loaded. * * @param {String} str DOM tag as string or URL * @return {Integration} */ exports.tag = function(name, str){ if (null == str) { str = name; name = 'library'; } this.prototype.templates[name] = objectify(str); return this; }; /** * Given a string, give back DOM attributes. * * Do it in a way where the browser doesn't load images or iframes. * It turns out, domify will load images/iframes, because * whenever you construct those DOM elements, * the browser immediately loads them. * * @param {String} str * @return {Object} */ function objectify(str) { // replace `src` with `data-src` to prevent image loading str = str.replace(' src="', ' data-src="'); var el = domify(str); var attrs = {}; each(el.attributes, function(attr){ // then replace it back var name = 'data-src' == attr.name ? 'src' : attr.name; if (!~str.indexOf(attr.name + '=')) return; attrs[name] = attr.value; }); return { type: el.tagName.toLowerCase(), attrs: attrs }; } }, {"after":111,"domify":119,"each":112,"emitter":110}], 119: [function(require, module, exports) { /** * Expose `parse`. */ module.exports = parse; /** * Tests for browser support. */ var div = document.createElement('div'); // Setup div.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>'; // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE var innerHTMLBug = !div.getElementsByTagName('link').length; div = undefined; /** * Wrap map from jquery. */ var map = { legend: [1, '<fieldset>', '</fieldset>'], tr: [2, '<table><tbody>', '</tbody></table>'], col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], // for script/link/style tags to work in IE6-8, you have to wrap // in a div with a non-whitespace character in front, ha! _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', ''] }; map.td = map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>']; map.option = map.optgroup = [1, '<select multiple="multiple">', '</select>']; map.thead = map.tbody = map.colgroup = map.caption = map.tfoot = [1, '<table>', '</table>']; map.polyline = map.ellipse = map.polygon = map.circle = map.text = map.line = map.path = map.rect = map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>']; /** * Parse `html` and return a DOM Node instance, which could be a TextNode, * HTML DOM Node of some kind (<div> for example), or a DocumentFragment * instance, depending on the contents of the `html` string. * * @param {String} html - HTML string to "domify" * @param {Document} doc - The `document` instance to create the Node for * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance * @api private */ function parse(html, doc) { if ('string' != typeof html) throw new TypeError('String expected'); // default to the global `document` object if (!doc) doc = document; // tag name var m = /<([\w:]+)/.exec(html); if (!m) return doc.createTextNode(html); html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace var tag = m[1]; // body support if (tag == 'body') { var el = doc.createElement('html'); el.innerHTML = html; return el.removeChild(el.lastChild); } // wrap map var wrap = map[tag] || map._default; var depth = wrap[0]; var prefix = wrap[1]; var suffix = wrap[2]; var el = doc.createElement('div'); el.innerHTML = prefix + html + suffix; while (depth--) el = el.lastChild; // one element if (el.firstChild == el.lastChild) { return el.removeChild(el.firstChild); } // several elements var fragment = doc.createDocumentFragment(); while (el.firstChild) { fragment.appendChild(el.removeChild(el.firstChild)); } return fragment; } }, {}], 89: [function(require, module, exports) { var toSpace = require('to-space-case'); /** * Expose `toSnakeCase`. */ module.exports = toSnakeCase; /** * Convert a `string` to snake case. * * @param {String} string * @return {String} */ function toSnakeCase (string) { return toSpace(string).replace(/\s/g, '_'); } }, {"to-space-case":120}], 120: [function(require, module, exports) { var clean = require('to-no-case'); /** * Expose `toSpaceCase`. */ module.exports = toSpaceCase; /** * Convert a `string` to space case. * * @param {String} string * @return {String} */ function toSpaceCase (string) { return clean(string).replace(/[\W_]+(.|$)/g, function (matches, match) { return match ? ' ' + match : ''; }); } }, {"to-no-case":121}], 121: [function(require, module, exports) { /** * Expose `toNoCase`. */ module.exports = toNoCase; /** * Test whether a string is camel-case. */ var hasSpace = /\s/; var hasCamel = /[a-z][A-Z]/; var hasSeparator = /[\W_]/; /** * Remove any starting case from a `string`, like camel or snake, but keep * spaces and punctuation that may be important otherwise. * * @param {String} string * @return {String} */ function toNoCase (string) { if (hasSpace.test(string)) return string.toLowerCase(); if (hasSeparator.test(string)) string = unseparate(string); if (hasCamel.test(string)) string = uncamelize(string); return string.toLowerCase(); } /** * Separator splitter. */ var separatorSplitter = /[\W_]+(.|$)/g; /** * Un-separate a `string`. * * @param {String} string * @return {String} */ function unseparate (string) { return string.replace(separatorSplitter, function (m, next) { return next ? ' ' + next : ''; }); } /** * Camelcase splitter. */ var camelSplitter = /(.)([A-Z]+)/g; /** * Un-camelcase a `string`. * * @param {String} string * @return {String} */ function uncamelize (string) { return string.replace(camelSplitter, function (m, previous, uppers) { return previous + ' ' + uppers.toLowerCase().split('').join(' '); }); } }, {}], 90: [function(require, module, exports) { /** * Protocol. */ module.exports = function (url) { switch (arguments.length) { case 0: return check(); case 1: return transform(url); } }; /** * Transform a protocol-relative `url` to the use the proper protocol. * * @param {String} url * @return {String} */ function transform (url) { return check() ? 'https:' + url : 'http:' + url; } /** * Check whether `https:` be used for loading scripts. * * @return {Boolean} */ function check () { return ( location.protocol == 'https:' || location.protocol == 'chrome-extension:' ); } }, {}], 91: [function(require, module, exports) { var isEmpty = require('is-empty'); try { var typeOf = require('type'); } catch (e) { var typeOf = require('component-type'); } /** * Types. */ var types = [ 'arguments', 'array', 'boolean', 'date', 'element', 'function', 'null', 'number', 'object', 'regexp', 'string', 'undefined' ]; /** * Expose type checkers. * * @param {Mixed} value * @return {Boolean} */ for (var i = 0, type; type = types[i]; i++) exports[type] = generate(type); /** * Add alias for `function` for old browsers. */ exports.fn = exports['function']; /** * Expose `empty` check. */ exports.empty = isEmpty; /** * Expose `nan` check. */ exports.nan = function (val) { return exports.number(val) && val != val; }; /** * Generate a type checker. * * @param {String} type * @return {Function} */ function generate (type) { return function (value) { return type === typeOf(value); }; } }, {"is-empty":122,"type":7,"component-type":7}], 122: [function(require, module, exports) { /** * Expose `isEmpty`. */ module.exports = isEmpty; /** * Has. */ var has = Object.prototype.hasOwnProperty; /** * Test whether a value is "empty". * * @param {Mixed} val * @return {Boolean} */ function isEmpty (val) { if (null == val) return true; if ('number' == typeof val) return 0 === val; if (undefined !== val.length) return 0 === val.length; for (var key in val) if (has.call(val, key)) return false; return true; } }, {}], 92: [function(require, module, exports) { var identity = function(_){ return _; }; /** * Module exports, export */ module.exports = multiple(find); module.exports.find = module.exports; /** * Export the replacement function, return the modified object */ module.exports.replace = function (obj, key, val, options) { multiple(replace).call(this, obj, key, val, options); return obj; }; /** * Export the delete function, return the modified object */ module.exports.del = function (obj, key, options) { multiple(del).call(this, obj, key, null, options); return obj; }; /** * Compose applying the function to a nested key */ function multiple (fn) { return function (obj, path, val, options) { var normalize = options && isFunction(options.normalizer) ? options.normalizer : defaultNormalize; path = normalize(path); var key; var finished = false; while (!finished) loop(); function loop() { for (key in obj) { var normalizedKey = normalize(key); if (0 === path.indexOf(normalizedKey)) { var temp = path.substr(normalizedKey.length); if (temp.charAt(0) === '.' || temp.length === 0) { path = temp.substr(1); var child = obj[key]; // we're at the end and there is nothing. if (null == child) { finished = true; return; } // we're at the end and there is something. if (!path.length) { finished = true; return; } // step into child obj = child; // but we're done here return; } } } key = undefined; // if we found no matching properties // on the current object, there's no match. finished = true; } if (!key) return; if (null == obj) return obj; // the `obj` and `key` is one above the leaf object and key, so // start object: { a: { 'b.c': 10 } } // end object: { 'b.c': 10 } // end key: 'b.c' // this way, you can do `obj[key]` and get `10`. return fn(obj, key, val); }; } /** * Find an object by its key * * find({ first_name : 'Calvin' }, 'firstName') */ function find (obj, key) { if (obj.hasOwnProperty(key)) return obj[key]; } /** * Delete a value for a given key * * del({ a : 'b', x : 'y' }, 'X' }) -> { a : 'b' } */ function del (obj, key) { if (obj.hasOwnProperty(key)) delete obj[key]; return obj; } /** * Replace an objects existing value with a new one * * replace({ a : 'b' }, 'a', 'c') -> { a : 'c' } */ function replace (obj, key, val) { if (obj.hasOwnProperty(key)) obj[key] = val; return obj; } /** * Normalize a `dot.separated.path`. * * A.HELL(!*&#(!)O_WOR LD.bar => ahelloworldbar * * @param {String} path * @return {String} */ function defaultNormalize(path) { return path.replace(/[^a-zA-Z0-9\.]+/g, '').toLowerCase(); } /** * Check if a value is a function. * * @param {*} val * @return {boolean} Returns `true` if `val` is a function, otherwise `false`. */ function isFunction(val) { return typeof val === 'function'; } }, {}], 9: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var domify = require('domify'); var each = require('each'); /** * HOP */ var has = Object.prototype.hasOwnProperty; /** * Expose `AdWords`. */ var AdWords = module.exports = integration('AdWords') .option('conversionId', '') .option('remarketing', false) .tag('<script src="//www.googleadservices.com/pagead/conversion_async.js">') .mapping('events'); /** * Load. * * @param {Function} fn * @api public */ AdWords.prototype.initialize = function(){ this.load(this.ready); }; /** * Loaded. * * @return {Boolean} * @api public */ AdWords.prototype.loaded = function(){ return !! document.body; }; /** * Page. * * https://support.google.com/adwords/answer/3111920#standard_parameters * https://support.google.com/adwords/answer/3103357 * https://developers.google.com/adwords-remarketing-tag/asynchronous/ * https://developers.google.com/adwords-remarketing-tag/parameters * * @param {Page} page */ AdWords.prototype.page = function(page){ var remarketing = !!this.options.remarketing; var id = this.options.conversionId; var props = {}; window.google_trackConversion({ google_conversion_id: id, google_custom_params: props, google_remarketing_only: remarketing }); }; /** * Track. * * @param {Track} * @api public */ AdWords.prototype.track = function(track){ var id = this.options.conversionId; var events = this.events(track.event()); var revenue = track.revenue() || 0; each(events, function(label){ var props = track.properties(); delete props.revenue window.google_trackConversion({ google_conversion_id: id, google_custom_params: props, google_conversion_language: 'en', google_conversion_format: '3', google_conversion_color: 'ffffff', google_conversion_label: label, google_conversion_value: revenue, google_remarketing_only: false }); }); }; }, {"analytics.js-integration":88,"domify":119,"each":4}], 10: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); /** * Expose Alexa integration. */ var Alexa = module.exports = integration('Alexa') .assumesPageview() .global('_atrk_opts') .option('account', null) .option('domain', '') .option('dynamic', true) .tag('<script src="//d31qbv1cthcecs.cloudfront.net/atrk.js">'); /** * Initialize. * * @param {Object} page */ Alexa.prototype.initialize = function(page){ var self = this; window._atrk_opts = { atrk_acct: this.options.account, domain: this.options.domain, dynamic: this.options.dynamic }; this.load(function(){ window.atrk(); self.ready(); }); }; /** * Loaded? * * @return {Boolean} */ Alexa.prototype.loaded = function(){ return !! window.atrk; }; }, {"analytics.js-integration":88}], 11: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var utm = require('utm-params'); var top = require('top-domain'); /** * UMD ? */ var umd = 'function' == typeof define && define.amd; /** * Source. */ var src = '//d24n15hnbwhuhn.cloudfront.net/libs/amplitude-2.1.0-min.js'; /** * Expose `Amplitude` integration. */ var Amplitude = module.exports = integration('Amplitude') .global('amplitude') .option('apiKey', '') .option('trackAllPages', false) .option('trackNamedPages', true) .option('trackCategorizedPages', true) .option('trackUtmProperties', true) .tag('<script src="' + src + '">'); /** * Initialize. * * https://github.com/amplitude/Amplitude-Javascript * * @param {Object} page */ Amplitude.prototype.initialize = function(page){ // jscs:disable (function(e,t){var r=e.amplitude||{};r._q=[];function a(e){r[e]=function(){r._q.push([e].concat(Array.prototype.slice.call(arguments,0)))}}var i=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties"];for(var o=0;o<i.length;o++){a(i[o])}e.amplitude=r})(window,document); // jscs:enable this.setDomain(window.location.href); window.amplitude.init(this.options.apiKey, null, { includeUtm: this.options.trackUtmProperties }); var self = this; if (umd) { window.require([src], function(amplitude){ window.amplitude = amplitude; self.ready(); }); return; } this.load(function(){ self.ready(); }); }; /** * Loaded? * * @return {Boolean} */ Amplitude.prototype.loaded = function(){ return !! (window.amplitude && window.amplitude.options); }; /** * Page. * * @param {Page} page */ Amplitude.prototype.page = function(page){ var properties = page.properties(); var category = page.category(); var name = page.fullName(); var opts = this.options; // all pages if (opts.trackAllPages) { this.track(page.track()); } // categorized pages if (category && opts.trackCategorizedPages) { this.track(page.track(category)); } // named pages if (name && opts.trackNamedPages) { this.track(page.track(name)); } }; /** * Identify. * * @param {Facade} identify */ Amplitude.prototype.identify = function(identify){ var id = identify.userId(); var traits = identify.traits(); if (id) window.amplitude.setUserId(id); if (traits) window.amplitude.setUserProperties(traits); }; /** * Track. * * @param {Track} event */ Amplitude.prototype.track = function(track){ var props = track.properties(); var event = track.event(); var revenue = track.revenue(); // track the event window.amplitude.logEvent(event, props); // also track revenue if (revenue) { window.amplitude.logRevenue(revenue, props.quantity, props.productId); } }; /** * Set domain name to root domain * * @param {String} href */ Amplitude.prototype.setDomain = function(href){ var domain = top(href); window.amplitude.setDomain(domain); }; /** * Override device ID * * @param {String} deviceId */ Amplitude.prototype.setDeviceId = function(deviceId){ if (deviceId) window.amplitude.setDeviceId(deviceId); }; }, {"analytics.js-integration":88,"utm-params":123,"top-domain":124}], 123: [function(require, module, exports) { /** * Module dependencies. */ var parse = require('querystring').parse; /** * Expose `utm` */ module.exports = utm; /** * Get all utm params from the given `querystring` * * @param {String} query * @return {Object} * @api private */ function utm(query){ if ('?' == query.charAt(0)) query = query.substring(1); var query = query.replace(/\?/g, '&'); var params = parse(query); var param; var ret = {}; for (var key in params) { if (~key.indexOf('utm_')) { param = key.substr(4); if ('campaign' == param) param = 'name'; ret[param] = params[key]; } } return ret; } }, {"querystring":125}], 125: [function(require, module, exports) { /** * Module dependencies. */ var encode = encodeURIComponent; var decode = decodeURIComponent; var trim = require('trim'); var type = require('type'); var pattern = /(\w+)\[(\d+)\]/ /** * Parse the given query `str`. * * @param {String} str * @return {Object} * @api public */ exports.parse = function(str){ if ('string' != typeof str) return {}; str = trim(str); if ('' == str) return {}; if ('?' == str.charAt(0)) str = str.slice(1); var obj = {}; var pairs = str.split('&'); for (var i = 0; i < pairs.length; i++) { var parts = pairs[i].split('='); var key = decode(parts[0]); var m; if (m = pattern.exec(key)) { obj[m[1]] = obj[m[1]] || []; obj[m[1]][m[2]] = decode(parts[1]); continue; } obj[parts[0]] = null == parts[1] ? '' : decode(parts[1]); } return obj; }; /** * Stringify the given `obj`. * * @param {Object} obj * @return {String} * @api public */ exports.stringify = function(obj){ if (!obj) return ''; var pairs = []; for (var key in obj) { var value = obj[key]; if ('array' == type(value)) { for (var i = 0; i < value.length; ++i) { pairs.push(encode(key + '[' + i + ']') + '=' + encode(value[i])); } continue; } pairs.push(encode(key) + '=' + encode(obj[key])); } return pairs.join('&'); }; }, {"trim":126,"type":7}], 126: [function(require, module, exports) { exports = module.exports = trim; function trim(str){ if (str.trim) return str.trim(); return str.replace(/^\s*|\s*$/g, ''); } exports.left = function(str){ if (str.trimLeft) return str.trimLeft(); return str.replace(/^\s*/, ''); }; exports.right = function(str){ if (str.trimRight) return str.trimRight(); return str.replace(/\s*$/, ''); }; }, {}], 124: [function(require, module, exports) { /** * Module dependencies. */ var parse = require('url').parse; /** * Expose `domain` */ module.exports = domain; /** * RegExp */ var regexp = /[a-z0-9][a-z0-9\-]*[a-z0-9]\.[a-z\.]{2,6}$/i; /** * Get the top domain. * * Official Grammar: http://tools.ietf.org/html/rfc883#page-56 * Look for tlds with up to 2-6 characters. * * Example: * * domain('http://localhost:3000/baz'); * // => '' * domain('http://dev:3000/baz'); * // => '' * domain('http://127.0.0.1:3000/baz'); * // => '' * domain('http://segment.io/baz'); * // => 'segment.io' * * @param {String} url * @return {String} * @api public */ function domain(url){ var host = parse(url).hostname; var match = host.match(regexp); return match ? match[0] : ''; }; }, {"url":127}], 127: [function(require, module, exports) { /** * Parse the given `url`. * * @param {String} str * @return {Object} * @api public */ exports.parse = function(url){ var a = document.createElement('a'); a.href = url; return { href: a.href, host: a.host || location.host, port: ('0' === a.port || '' === a.port) ? port(a.protocol) : a.port, hash: a.hash, hostname: a.hostname || location.hostname, pathname: a.pathname.charAt(0) != '/' ? '/' + a.pathname : a.pathname, protocol: !a.protocol || ':' == a.protocol ? location.protocol : a.protocol, search: a.search, query: a.search.slice(1) }; }; /** * Check if `url` is absolute. * * @param {String} url * @return {Boolean} * @api public */ exports.isAbsolute = function(url){ return 0 == url.indexOf('//') || !!~url.indexOf('://'); }; /** * Check if `url` is relative. * * @param {String} url * @return {Boolean} * @api public */ exports.isRelative = function(url){ return !exports.isAbsolute(url); }; /** * Check if `url` is cross domain. * * @param {String} url * @return {Boolean} * @api public */ exports.isCrossDomain = function(url){ url = exports.parse(url); var location = exports.parse(window.location.href); return url.hostname !== location.hostname || url.port !== location.port || url.protocol !== location.protocol; }; /** * Return default port for `protocol`. * * @param {String} protocol * @return {String} * @api private */ function port (protocol){ switch (protocol) { case 'http:': return 80; case 'https:': return 443; default: return location.port; } } }, {}], 12: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var load = require('load-script'); var is = require('is'); /** * Expose plugin. */ module.exports = exports = function(analytics){ analytics.addIntegration(Appcues); }; /** * Expose `Appcues` integration. */ var Appcues = exports.Integration = integration('Appcues') .assumesPageview() .global('Appcues') .global('AppcuesIdentity') .option('appcuesId', '') .option('userId', '') .option('userEmail', ''); /** * Initialize. * * http://appcues.com/docs/ * * @param {Object} */ Appcues.prototype.initialize = function(){ this.load(function(){ window.Appcues.init(); }); }; /** * Loaded? * * @return {Boolean} */ Appcues.prototype.loaded = function(){ return is.object(window.Appcues); }; /** * Load the Appcues library. * * @param {Function} callback */ Appcues.prototype.load = function(callback){ var script = load('//d2dubfq97s02eu.cloudfront.net/appcues-bundle.min.js', callback); script.setAttribute('data-appcues-id', this.options.appcuesId); script.setAttribute('data-user-id', this.options.userId); script.setAttribute('data-user-email', this.options.userEmail); }; /** * Identify. * * http://appcues.com/docs#identify * * @param {Identify} identify */ Appcues.prototype.identify = function(identify){ window.Appcues.identify(identify.traits()); }; }, {"analytics.js-integration":88,"load-script":128,"is":91}], 128: [function(require, module, exports) { /** * Module dependencies. */ var onload = require('script-onload'); var tick = require('next-tick'); var type = require('type'); /** * Expose `loadScript`. * * @param {Object} options * @param {Function} fn * @api public */ module.exports = function loadScript(options, fn){ if (!options) throw new Error('Cant load nothing...'); // Allow for the simplest case, just passing a `src` string. if ('string' == type(options)) options = { src : options }; var https = document.location.protocol === 'https:' || document.location.protocol === 'chrome-extension:'; // If you use protocol relative URLs, third-party scripts like Google // Analytics break when testing with `file:` so this fixes that. if (options.src && options.src.indexOf('//') === 0) { options.src = https ? 'https:' + options.src : 'http:' + options.src; } // Allow them to pass in different URLs depending on the protocol. if (https && options.https) options.src = options.https; else if (!https && options.http) options.src = options.http; // Make the `<script>` element and insert it before the first script on the // page, which is guaranteed to exist since this Javascript is running. var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = options.src; // If we have a fn, attach event handlers, even in IE. Based off of // the Third-Party Javascript script loading example: // https://github.com/thirdpartyjs/thirdpartyjs-code/blob/master/examples/templates/02/loading-files/index.html if ('function' == type(fn)) { onload(script, fn); } tick(function(){ // Append after event listeners are attached for IE. var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(script, firstScript); }); // Return the script element in case they want to do anything special, like // give it an ID or attributes. return script; }; }, {"script-onload":115,"next-tick":103,"type":7}], 13: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var is = require('is'); /** * Expose `Atatus` integration. */ var Atatus = module.exports = integration('Atatus') .global('atatus') .option('apiKey', '') .tag('<script src="//www.atatus.com/atatus.js">'); /** * Initialize. * * https://www.atatus.com/docs.html * * @param {Object} page */ Atatus.prototype.initialize = function(page){ var self = this; this.load(function(){ // Configure Atatus and install default handler to capture uncaught exceptions window.atatus.config(self.options.apiKey).install(); self.ready(); }); }; /** * Loaded? * * @return {Boolean} */ Atatus.prototype.loaded = function(){ return is.object(window.atatus); }; /** * Identify. * * @param {Identify} identify */ Atatus.prototype.identify = function(identify){ window.atatus.setCustomData({ person: identify.traits() }); }; }, {"analytics.js-integration":88,"is":91}], 14: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); /** * Expose `Autosend` integration. */ var Autosend = module.exports = integration('Autosend') .global('_autosend') .option('appKey', '') .tag('<script id="asnd-tracker" src="https://d2zjxodm1cz8d6.cloudfront.net/js/v1/autosend.js" data-auth-key="{{ appKey }}">'); /** * Initialize. * * http://autosend.io/faq/install-autosend-using-javascript/ * * @param {Object} page */ Autosend.prototype.initialize = function(page){ window._autosend = window._autosend || []; (function(){var a,b,c;a=function(f){return function(){window._autosend.push([f].concat(Array.prototype.slice.call(arguments,0))); }; }; b=["identify", "track", "cb"];for (c=0;c<b.length;c++){window._autosend[b[c]]=a(b[c]); } })(); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Autosend.prototype.loaded = function(){ return !! (window._autosend); }; /** * Identify. * * http://autosend.io/faq/install-autosend-using-javascript/ * * @param {Identify} identify */ Autosend.prototype.identify = function(identify){ var id = identify.userId(); if (!id) return; var traits = identify.traits(); traits.id = id; window._autosend.identify(traits); }; /** * Track. * * http://autosend.io/faq/install-autosend-using-javascript/ * * @param {Track} track */ Autosend.prototype.track = function(track){ window._autosend.track(track.event()); }; }, {"analytics.js-integration":88}], 15: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var each = require('each'); /** * Expose `Awesm` integration. */ var Awesm = module.exports = integration('awe.sm') .assumesPageview() .global('AWESM') .option('apiKey', '') .tag('<script src="//widgets.awe.sm/v3/widgets.js?key={{ apiKey }}&async=true">') .mapping('events'); /** * Initialize. * * http://developers.awe.sm/guides/javascript/ * * @param {Object} page */ Awesm.prototype.initialize = function(page){ window.AWESM = { api_key: this.options.apiKey }; this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Awesm.prototype.loaded = function(){ return !! (window.AWESM && window.AWESM._exists); }; /** * Track. * * @param {Track} track */ Awesm.prototype.track = function(track){ var user = this.analytics.user(); var goals = this.events(track.event()); each(goals, function(goal){ window.AWESM.convert(goal, track.cents(), null, user.id()); }); }; }, {"analytics.js-integration":88,"each":4}], 16: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var onbody = require('on-body'); var domify = require('domify'); var extend = require('extend'); var bind = require('bind'); var when = require('when'); var each = require('each'); /** * HOP. */ var has = Object.prototype.hasOwnProperty; /** * Noop. */ var noop = function(){}; /** * Expose `Bing`. * * https://bingads.microsoft.com/campaign/signup */ var Bing = module.exports = integration('Bing Ads') .global('uetq') .option('tagId', '') .tag('<script src="//bat.bing.com/bat.js">'); /** * Initialize * * inferred from their snippet * https://gist.github.com/sperand-io/8bef4207e9c66e1aa83b */ Bing.prototype.initialize = function(){ window.uetq = window.uetq || []; var self = this; self.load(function(){ var setup = { ti: self.options.tagId, q: window.uetq }; window.uetq = new UET(setup); self.ready(); }); }; /** * Loaded? * * Check for custom `push` method bestowed by UET constructor * * @return {Boolean} */ Bing.prototype.loaded = function(){ return !! (window.uetq && window.uetq.push !== Array.prototype.push); }; /** * Page */ Bing.prototype.page = function(){ window.uetq.push("pageLoad"); }; /** * Track * * Send all events then set goals based * on them retroactively: http://advertise.bingads.microsoft.com/en-us/uahelp-topic?market=en&project=Bing_Ads&querytype=topic&query=HLP_BA_PROC_UET.htm * * @param {Track} track */ Bing.prototype.track = function(track){ var event = { ea: 'track', el: track.event() }; if (track.category()) event.ec = track.category(); if (track.revenue()) event.ev = track.revenue(); window.uetq.push(event); }; }, {"analytics.js-integration":88,"on-body":129,"domify":119,"extend":130,"bind":101,"when":131,"each":4}], 129: [function(require, module, exports) { var each = require('each'); /** * Cache whether `<body>` exists. */ var body = false; /** * Callbacks to call when the body exists. */ var callbacks = []; /** * Export a way to add handlers to be invoked once the body exists. * * @param {Function} callback A function to call when the body exists. */ module.exports = function onBody (callback) { if (body) { call(callback); } else { callbacks.push(callback); } }; /** * Set an interval to check for `document.body`. */ var interval = setInterval(function () { if (!document.body) return; body = true; each(callbacks, call); clearInterval(interval); }, 5); /** * Call a callback, passing it the body. * * @param {Function} callback The callback to call. */ function call (callback) { callback(document.body); } }, {"each":112}], 130: [function(require, module, exports) { module.exports = function extend (object) { // Takes an unlimited number of extenders. var args = Array.prototype.slice.call(arguments, 1); // For each extender, copy their properties on our object. for (var i = 0, source; source = args[i]; i++) { if (!source) continue; for (var property in source) { object[property] = source[property]; } } return object; }; }, {}], 131: [function(require, module, exports) { var callback = require('callback'); /** * Expose `when`. */ module.exports = when; /** * Loop on a short interval until `condition()` is true, then call `fn`. * * @param {Function} condition * @param {Function} fn * @param {Number} interval (optional) */ function when (condition, fn, interval) { if (condition()) return callback.async(fn); var ref = setInterval(function () { if (!condition()) return; callback(fn); clearInterval(ref); }, interval || 10); } }, {"callback":94}], 17: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); /** * Expose `Blueshift` integration. */ var Blueshift = module.exports = integration('Blueshift') .global('blueshift') .global('_blueshiftid') .option('apiKey', '') .option('retarget', false) .tag('<script src="https://cdn.getblueshift.com/blueshift.js">'); /** * Initialize. * * Documentation: http://getblueshift.com/documentation * * @param {Object} page */ Blueshift.prototype.initialize = function(page){ window.blueshift=window.blueshift||[]; // jscs:disable window.blueshift.load=function(a){window._blueshiftid=a;var d=function(a){return function(){blueshift.push([a].concat(Array.prototype.slice.call(arguments,0)))}},e=["identify","track","click", "pageload", "capture", "retarget"];for(var f=0;f<e.length;f++)blueshift[e[f]]=d(e[f])}; // jscs:enable window.blueshift.load(this.options.apiKey); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Blueshift.prototype.loaded = function(){ return !! (window.blueshift && window._blueshiftid); }; /** * Page. * * @param {Page} page */ Blueshift.prototype.page = function(page){ if (this.options.retarget) window.blueshift.retarget(); var properties = page.properties(); properties._bsft_source = 'segment.com'; window.blueshift.pageload(properties); }; /** * Identify. * * @param {Identify} identify */ Blueshift.prototype.identify = function(identify){ if (!identify.userId()) return this.debug('user id required'); var traits = identify.traits({ created: 'created_at' }); traits._bsft_source = 'segment.com'; window.blueshift.identify(traits); }; /** * Group. * * @param {Group} group */ Blueshift.prototype.group = function(group){ var traits = group.traits({ created: 'created_at' }); traits._bsft_source = 'segment.com'; window.blueshift.track('group', traits); }; /** * Track. * * @param {Track} track */ Blueshift.prototype.track = function(track){ var properties = track.properties(); properties._bsft_source = 'segment.com'; window.blueshift.track(track.event(), properties); }; }, {"analytics.js-integration":88}], 18: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var Identify = require('facade').Identify; var Track = require('facade').Track; var pixel = require('load-pixel')('http://app.bronto.com/public/'); var qs = require('querystring'); var each = require('each'); /** * Expose `Bronto` integration. */ var Bronto = module.exports = integration('Bronto') .global('__bta') .option('siteId', '') .option('host', '') .tag('<script src="//p.bm23.com/bta.js">'); /** * Initialize. * * http://app.bronto.com/mail/help/help_view/?k=mail:home:api_tracking:tracking_data_store_js#addingjavascriptconversiontrackingtoyoursite * http://bronto.com/product-blog/features/using-conversion-tracking-private-domain#.Ut_Vk2T8KqB * http://bronto.com/product-blog/features/javascript-conversion-tracking-setup-and-reporting#.Ut_VhmT8KqB * * @param {Object} page */ Bronto.prototype.initialize = function(page){ var self = this; var params = qs.parse(window.location.search); if (!params._bta_tid && !params._bta_c) { this.debug('missing tracking URL parameters `_bta_tid` and `_bta_c`.'); } this.load(function(){ var opts = self.options; self.bta = new window.__bta(opts.siteId); if (opts.host) self.bta.setHost(opts.host); self.ready(); }); }; /** * Loaded? * * @return {Boolean} */ Bronto.prototype.loaded = function(){ return this.bta; }; /** * Completed order. * * The cookie is used to link the order being processed back to the delivery, * message, and contact which makes it a conversion. * Passing in just the email ensures that the order itself * gets linked to the contact record in Bronto even if the user * does not have a tracking cookie. * * @param {Track} track * @api private */ Bronto.prototype.completedOrder = function(track){ var user = this.analytics.user(); var products = track.products(); var props = track.properties(); var items = []; var identify = new Identify({ userId: user.id(), traits: user.traits() }); var email = identify.email(); // items each(products, function(product){ var track = new Track({ properties: product }); items.push({ item_id: track.id() || track.sku(), desc: product.description || track.name(), quantity: track.quantity(), amount: track.price(), }); }); // add conversion this.bta.addOrder({ order_id: track.orderId(), email: email, // they recommend not putting in a date // because it needs to be formatted correctly // YYYY-MM-DDTHH:MM:SS items: items }); }; }, {"analytics.js-integration":88,"facade":132,"load-pixel":133,"querystring":134,"each":4}], 132: [function(require, module, exports) { var Facade = require('./facade'); /** * Expose `Facade` facade. */ module.exports = Facade; /** * Expose specific-method facades. */ Facade.Alias = require('./alias'); Facade.Group = require('./group'); Facade.Identify = require('./identify'); Facade.Track = require('./track'); Facade.Page = require('./page'); Facade.Screen = require('./screen'); }, {"./facade":135,"./alias":136,"./group":137,"./identify":138,"./track":139,"./page":140,"./screen":141}], 135: [function(require, module, exports) { var traverse = require('isodate-traverse'); var isEnabled = require('./is-enabled'); var clone = require('./utils').clone; var type = require('./utils').type; var address = require('./address'); var objCase = require('obj-case'); var newDate = require('new-date'); /** * Expose `Facade`. */ module.exports = Facade; /** * Initialize a new `Facade` with an `obj` of arguments. * * @param {Object} obj */ function Facade (obj) { if (!obj.hasOwnProperty('timestamp')) obj.timestamp = new Date(); else obj.timestamp = newDate(obj.timestamp); traverse(obj); this.obj = obj; } /** * Mixin address traits. */ address(Facade.prototype); /** * Return a proxy function for a `field` that will attempt to first use methods, * and fallback to accessing the underlying object directly. You can specify * deeply nested fields too like: * * this.proxy('options.Librato'); * * @param {String} field */ Facade.prototype.proxy = function (field) { var fields = field.split('.'); field = fields.shift(); // Call a function at the beginning to take advantage of facaded fields var obj = this[field] || this.field(field); if (!obj) return obj; if (typeof obj === 'function') obj = obj.call(this) || {}; if (fields.length === 0) return transform(obj); obj = objCase(obj, fields.join('.')); return transform(obj); }; /** * Directly access a specific `field` from the underlying object, returning a * clone so outsiders don't mess with stuff. * * @param {String} field * @return {Mixed} */ Facade.prototype.field = function (field) { var obj = this.obj[field]; return transform(obj); }; /** * Utility method to always proxy a particular `field`. You can specify deeply * nested fields too like: * * Facade.proxy('options.Librato'); * * @param {String} field * @return {Function} */ Facade.proxy = function (field) { return function () { return this.proxy(field); }; }; /** * Utility method to directly access a `field`. * * @param {String} field * @return {Function} */ Facade.field = function (field) { return function () { return this.field(field); }; }; /** * Proxy multiple `path`. * * @param {String} path * @return {Array} */ Facade.multi = function(path){ return function(){ var multi = this.proxy(path + 's'); if ('array' == type(multi)) return multi; var one = this.proxy(path); if (one) one = [clone(one)]; return one || []; }; }; /** * Proxy one `path`. * * @param {String} path * @return {Mixed} */ Facade.one = function(path){ return function(){ var one = this.proxy(path); if (one) return one; var multi = this.proxy(path + 's'); if ('array' == type(multi)) return multi[0]; }; }; /** * Get the basic json object of this facade. * * @return {Object} */ Facade.prototype.json = function () { var ret = clone(this.obj); if (this.type) ret.type = this.type(); return ret; }; /** * Get the options of a call (formerly called "context"). If you pass an * integration name, it will get the options for that specific integration, or * undefined if the integration is not enabled. * * @param {String} integration (optional) * @return {Object or Null} */ Facade.prototype.context = Facade.prototype.options = function (integration) { var options = clone(this.obj.options || this.obj.context) || {}; if (!integration) return clone(options); if (!this.enabled(integration)) return; var integrations = this.integrations(); var value = integrations[integration] || objCase(integrations, integration); if ('boolean' == typeof value) value = {}; return value || {}; }; /** * Check whether an integration is enabled. * * @param {String} integration * @return {Boolean} */ Facade.prototype.enabled = function (integration) { var allEnabled = this.proxy('options.providers.all'); if (typeof allEnabled !== 'boolean') allEnabled = this.proxy('options.all'); if (typeof allEnabled !== 'boolean') allEnabled = this.proxy('integrations.all'); if (typeof allEnabled !== 'boolean') allEnabled = true; var enabled = allEnabled && isEnabled(integration); var options = this.integrations(); // If the integration is explicitly enabled or disabled, use that // First, check options.providers for backwards compatibility if (options.providers && options.providers.hasOwnProperty(integration)) { enabled = options.providers[integration]; } // Next, check for the integration's existence in 'options' to enable it. // If the settings are a boolean, use that, otherwise it should be enabled. if (options.hasOwnProperty(integration)) { var settings = options[integration]; if (typeof settings === 'boolean') { enabled = settings; } else { enabled = true; } } return enabled ? true : false; }; /** * Get all `integration` options. * * @param {String} integration * @return {Object} * @api private */ Facade.prototype.integrations = function(){ return this.obj.integrations || this.proxy('options.providers') || this.options(); }; /** * Check whether the user is active. * * @return {Boolean} */ Facade.prototype.active = function () { var active = this.proxy('options.active'); if (active === null || active === undefined) active = true; return active; }; /** * Get `sessionId / anonymousId`. * * @return {Mixed} * @api public */ Facade.prototype.sessionId = Facade.prototype.anonymousId = function(){ return this.field('anonymousId') || this.field('sessionId'); }; /** * Get `groupId` from `context.groupId`. * * @return {String} * @api public */ Facade.prototype.groupId = Facade.proxy('options.groupId'); /** * Get the call's "super properties" which are just traits that have been * passed in as if from an identify call. * * @param {Object} aliases * @return {Object} */ Facade.prototype.traits = function (aliases) { var ret = this.proxy('options.traits') || {}; var id = this.userId(); aliases = aliases || {}; if (id) ret.id = id; for (var alias in aliases) { var value = null == this[alias] ? this.proxy('options.traits.' + alias) : this[alias](); if (null == value) continue; ret[aliases[alias]] = value; delete ret[alias]; } return ret; }; /** * Add a convenient way to get the library name and version */ Facade.prototype.library = function(){ var library = this.proxy('options.library'); if (!library) return { name: 'unknown', version: null }; if (typeof library === 'string') return { name: library, version: null }; return library; }; /** * Setup some basic proxies. */ Facade.prototype.userId = Facade.field('userId'); Facade.prototype.channel = Facade.field('channel'); Facade.prototype.timestamp = Facade.field('timestamp'); Facade.prototype.userAgent = Facade.proxy('options.userAgent'); Facade.prototype.ip = Facade.proxy('options.ip'); /** * Return the cloned and traversed object * * @param {Mixed} obj * @return {Mixed} */ function transform(obj){ var cloned = clone(obj); return cloned; } }, {"isodate-traverse":142,"./is-enabled":143,"./utils":144,"./address":145,"obj-case":92,"new-date":146}], 142: [function(require, module, exports) { var is = require('is'); var isodate = require('isodate'); var each; try { each = require('each'); } catch (err) { each = require('each-component'); } /** * Expose `traverse`. */ module.exports = traverse; /** * Traverse an object or array, and return a clone with all ISO strings parsed * into Date objects. * * @param {Object} obj * @return {Object} */ function traverse (input, strict) { if (strict === undefined) strict = true; if (is.object(input)) return object(input, strict); if (is.array(input)) return array(input, strict); return input; } /** * Object traverser. * * @param {Object} obj * @param {Boolean} strict * @return {Object} */ function object (obj, strict) { each(obj, function (key, val) { if (isodate.is(val, strict)) { obj[key] = isodate.parse(val); } else if (is.object(val) || is.array(val)) { traverse(val, strict); } }); return obj; } /** * Array traverser. * * @param {Array} arr * @param {Boolean} strict * @return {Array} */ function array (arr, strict) { each(arr, function (val, x) { if (is.object(val)) { traverse(val, strict); } else if (isodate.is(val, strict)) { arr[x] = isodate.parse(val); } }); return arr; } }, {"is":147,"isodate":148,"each":4}], 147: [function(require, module, exports) { var isEmpty = require('is-empty'); try { var typeOf = require('type'); } catch (e) { var typeOf = require('component-type'); } /** * Types. */ var types = [ 'arguments', 'array', 'boolean', 'date', 'element', 'function', 'null', 'number', 'object', 'regexp', 'string', 'undefined' ]; /** * Expose type checkers. * * @param {Mixed} value * @return {Boolean} */ for (var i = 0, type; type = types[i]; i++) exports[type] = generate(type); /** * Add alias for `function` for old browsers. */ exports.fn = exports['function']; /** * Expose `empty` check. */ exports.empty = isEmpty; /** * Expose `nan` check. */ exports.nan = function (val) { return exports.number(val) && val != val; }; /** * Generate a type checker. * * @param {String} type * @return {Function} */ function generate (type) { return function (value) { return type === typeOf(value); }; } }, {"is-empty":122,"type":7,"component-type":7}], 148: [function(require, module, exports) { /** * Matcher, slightly modified from: * * https://github.com/csnover/js-iso8601/blob/lax/iso8601.js */ var matcher = /^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/; /** * Convert an ISO date string to a date. Fallback to native `Date.parse`. * * https://github.com/csnover/js-iso8601/blob/lax/iso8601.js * * @param {String} iso * @return {Date} */ exports.parse = function (iso) { var numericKeys = [1, 5, 6, 7, 11, 12]; var arr = matcher.exec(iso); var offset = 0; // fallback to native parsing if (!arr) return new Date(iso); // remove undefined values for (var i = 0, val; val = numericKeys[i]; i++) { arr[val] = parseInt(arr[val], 10) || 0; } // allow undefined days and months arr[2] = parseInt(arr[2], 10) || 1; arr[3] = parseInt(arr[3], 10) || 1; // month is 0-11 arr[2]--; // allow abitrary sub-second precision arr[8] = arr[8] ? (arr[8] + '00').substring(0, 3) : 0; // apply timezone if one exists if (arr[4] == ' ') { offset = new Date().getTimezoneOffset(); } else if (arr[9] !== 'Z' && arr[10]) { offset = arr[11] * 60 + arr[12]; if ('+' == arr[10]) offset = 0 - offset; } var millis = Date.UTC(arr[1], arr[2], arr[3], arr[5], arr[6] + offset, arr[7], arr[8]); return new Date(millis); }; /** * Checks whether a `string` is an ISO date string. `strict` mode requires that * the date string at least have a year, month and date. * * @param {String} string * @param {Boolean} strict * @return {Boolean} */ exports.is = function (string, strict) { if (strict && false === /^\d{4}-\d{2}-\d{2}/.test(string)) return false; return matcher.test(string); }; }, {}], 143: [function(require, module, exports) { /** * A few integrations are disabled by default. They must be explicitly * enabled by setting options[Provider] = true. */ var disabled = { Salesforce: true }; /** * Check whether an integration should be enabled by default. * * @param {String} integration * @return {Boolean} */ module.exports = function (integration) { return ! disabled[integration]; }; }, {}], 144: [function(require, module, exports) { /** * TODO: use component symlink, everywhere ? */ try { exports.inherit = require('inherit'); exports.clone = require('clone'); exports.type = require('type'); } catch (e) { exports.inherit = require('inherit-component'); exports.clone = require('clone-component'); exports.type = require('type-component'); } }, {"inherit":149,"clone":150,"type":7}], 149: [function(require, module, exports) { module.exports = function(a, b){ var fn = function(){}; fn.prototype = b.prototype; a.prototype = new fn; a.prototype.constructor = a; }; }, {}], 150: [function(require, module, exports) { /** * Module dependencies. */ var type; try { type = require('component-type'); } catch (_) { type = require('type'); } /** * Module exports. */ module.exports = clone; /** * Clones objects. * * @param {Mixed} any object * @api public */ function clone(obj){ switch (type(obj)) { case 'object': var copy = {}; for (var key in obj) { if (obj.hasOwnProperty(key)) { copy[key] = clone(obj[key]); } } return copy; case 'array': var copy = new Array(obj.length); for (var i = 0, l = obj.length; i < l; i++) { copy[i] = clone(obj[i]); } return copy; case 'regexp': // from millermedeiros/amd-utils - MIT var flags = ''; flags += obj.multiline ? 'm' : ''; flags += obj.global ? 'g' : ''; flags += obj.ignoreCase ? 'i' : ''; return new RegExp(obj.source, flags); case 'date': return new Date(obj.getTime()); default: // string, number, boolean, … return obj; } } }, {"component-type":7,"type":7}], 145: [function(require, module, exports) { /** * Module dependencies. */ var get = require('obj-case'); /** * Add address getters to `proto`. * * @param {Function} proto */ module.exports = function(proto){ proto.zip = trait('postalCode', 'zip'); proto.country = trait('country'); proto.street = trait('street'); proto.state = trait('state'); proto.city = trait('city'); function trait(a, b){ return function(){ var traits = this.traits(); var props = this.properties ? this.properties() : {}; return get(traits, 'address.' + a) || get(traits, a) || (b ? get(traits, 'address.' + b) : null) || (b ? get(traits, b) : null) || get(props, 'address.' + a) || get(props, a) || (b ? get(props, 'address.' + b) : null) || (b ? get(props, b) : null); }; } }; }, {"obj-case":92}], 146: [function(require, module, exports) { var is = require('is'); var isodate = require('isodate'); var milliseconds = require('./milliseconds'); var seconds = require('./seconds'); /** * Returns a new Javascript Date object, allowing a variety of extra input types * over the native Date constructor. * * @param {Date|String|Number} val */ module.exports = function newDate (val) { if (is.date(val)) return val; if (is.number(val)) return new Date(toMs(val)); // date strings if (isodate.is(val)) return isodate.parse(val); if (milliseconds.is(val)) return milliseconds.parse(val); if (seconds.is(val)) return seconds.parse(val); // fallback to Date.parse return new Date(val); }; /** * If the number passed val is seconds from the epoch, turn it into milliseconds. * Milliseconds would be greater than 31557600000 (December 31, 1970). * * @param {Number} num */ function toMs (num) { if (num < 31557600000) return num * 1000; return num; } }, {"is":151,"isodate":148,"./milliseconds":152,"./seconds":153}], 151: [function(require, module, exports) { var isEmpty = require('is-empty') , typeOf = require('type'); /** * Types. */ var types = [ 'arguments', 'array', 'boolean', 'date', 'element', 'function', 'null', 'number', 'object', 'regexp', 'string', 'undefined' ]; /** * Expose type checkers. * * @param {Mixed} value * @return {Boolean} */ for (var i = 0, type; type = types[i]; i++) exports[type] = generate(type); /** * Add alias for `function` for old browsers. */ exports.fn = exports['function']; /** * Expose `empty` check. */ exports.empty = isEmpty; /** * Expose `nan` check. */ exports.nan = function (val) { return exports.number(val) && val != val; }; /** * Generate a type checker. * * @param {String} type * @return {Function} */ function generate (type) { return function (value) { return type === typeOf(value); }; } }, {"is-empty":122,"type":7}], 152: [function(require, module, exports) { /** * Matcher. */ var matcher = /\d{13}/; /** * Check whether a string is a millisecond date string. * * @param {String} string * @return {Boolean} */ exports.is = function (string) { return matcher.test(string); }; /** * Convert a millisecond string to a date. * * @param {String} millis * @return {Date} */ exports.parse = function (millis) { millis = parseInt(millis, 10); return new Date(millis); }; }, {}], 153: [function(require, module, exports) { /** * Matcher. */ var matcher = /\d{10}/; /** * Check whether a string is a second date string. * * @param {String} string * @return {Boolean} */ exports.is = function (string) { return matcher.test(string); }; /** * Convert a second string to a date. * * @param {String} seconds * @return {Date} */ exports.parse = function (seconds) { var millis = parseInt(seconds, 10) * 1000; return new Date(millis); }; }, {}], 136: [function(require, module, exports) { /** * Module dependencies. */ var inherit = require('./utils').inherit; var Facade = require('./facade'); /** * Expose `Alias` facade. */ module.exports = Alias; /** * Initialize a new `Alias` facade with a `dictionary` of arguments. * * @param {Object} dictionary * @property {String} from * @property {String} to * @property {Object} options */ function Alias (dictionary) { Facade.call(this, dictionary); } /** * Inherit from `Facade`. */ inherit(Alias, Facade); /** * Return type of facade. * * @return {String} */ Alias.prototype.type = Alias.prototype.action = function () { return 'alias'; }; /** * Get `previousId`. * * @return {Mixed} * @api public */ Alias.prototype.from = Alias.prototype.previousId = function(){ return this.field('previousId') || this.field('from'); }; /** * Get `userId`. * * @return {String} * @api public */ Alias.prototype.to = Alias.prototype.userId = function(){ return this.field('userId') || this.field('to'); }; }, {"./utils":144,"./facade":135}], 137: [function(require, module, exports) { /** * Module dependencies. */ var inherit = require('./utils').inherit; var address = require('./address'); var isEmail = require('is-email'); var newDate = require('new-date'); var Facade = require('./facade'); /** * Expose `Group` facade. */ module.exports = Group; /** * Initialize a new `Group` facade with a `dictionary` of arguments. * * @param {Object} dictionary * @param {String} userId * @param {String} groupId * @param {Object} properties * @param {Object} options */ function Group (dictionary) { Facade.call(this, dictionary); } /** * Inherit from `Facade` */ inherit(Group, Facade); /** * Get the facade's action. */ Group.prototype.type = Group.prototype.action = function () { return 'group'; }; /** * Setup some basic proxies. */ Group.prototype.groupId = Facade.field('groupId'); /** * Get created or createdAt. * * @return {Date} */ Group.prototype.created = function(){ var created = this.proxy('traits.createdAt') || this.proxy('traits.created') || this.proxy('properties.createdAt') || this.proxy('properties.created'); if (created) return newDate(created); }; /** * Get the group's email, falling back to the group ID if it's a valid email. * * @return {String} */ Group.prototype.email = function () { var email = this.proxy('traits.email'); if (email) return email; var groupId = this.groupId(); if (isEmail(groupId)) return groupId; }; /** * Get the group's traits. * * @param {Object} aliases * @return {Object} */ Group.prototype.traits = function (aliases) { var ret = this.properties(); var id = this.groupId(); aliases = aliases || {}; if (id) ret.id = id; for (var alias in aliases) { var value = null == this[alias] ? this.proxy('traits.' + alias) : this[alias](); if (null == value) continue; ret[aliases[alias]] = value; delete ret[alias]; } return ret; }; /** * Special traits. */ Group.prototype.name = Facade.proxy('traits.name'); Group.prototype.industry = Facade.proxy('traits.industry'); Group.prototype.employees = Facade.proxy('traits.employees'); /** * Get traits or properties. * * TODO: remove me * * @return {Object} */ Group.prototype.properties = function(){ return this.field('traits') || this.field('properties') || {}; }; }, {"./utils":144,"./address":145,"is-email":154,"new-date":146,"./facade":135}], 154: [function(require, module, exports) { /** * Expose `isEmail`. */ module.exports = isEmail; /** * Email address matcher. */ var matcher = /.+\@.+\..+/; /** * Loosely validate an email address. * * @param {String} string * @return {Boolean} */ function isEmail (string) { return matcher.test(string); } }, {}], 138: [function(require, module, exports) { var address = require('./address'); var Facade = require('./facade'); var isEmail = require('is-email'); var newDate = require('new-date'); var utils = require('./utils'); var get = require('obj-case'); var trim = require('trim'); var inherit = utils.inherit; var clone = utils.clone; var type = utils.type; /** * Expose `Idenfity` facade. */ module.exports = Identify; /** * Initialize a new `Identify` facade with a `dictionary` of arguments. * * @param {Object} dictionary * @param {String} userId * @param {String} sessionId * @param {Object} traits * @param {Object} options */ function Identify (dictionary) { Facade.call(this, dictionary); } /** * Inherit from `Facade`. */ inherit(Identify, Facade); /** * Get the facade's action. */ Identify.prototype.type = Identify.prototype.action = function () { return 'identify'; }; /** * Get the user's traits. * * @param {Object} aliases * @return {Object} */ Identify.prototype.traits = function (aliases) { var ret = this.field('traits') || {}; var id = this.userId(); aliases = aliases || {}; if (id) ret.id = id; for (var alias in aliases) { var value = null == this[alias] ? this.proxy('traits.' + alias) : this[alias](); if (null == value) continue; ret[aliases[alias]] = value; if (alias !== aliases[alias]) delete ret[alias]; } return ret; }; /** * Get the user's email, falling back to their user ID if it's a valid email. * * @return {String} */ Identify.prototype.email = function () { var email = this.proxy('traits.email'); if (email) return email; var userId = this.userId(); if (isEmail(userId)) return userId; }; /** * Get the user's created date, optionally looking for `createdAt` since lots of * people do that instead. * * @return {Date or Undefined} */ Identify.prototype.created = function () { var created = this.proxy('traits.created') || this.proxy('traits.createdAt'); if (created) return newDate(created); }; /** * Get the company created date. * * @return {Date or undefined} */ Identify.prototype.companyCreated = function(){ var created = this.proxy('traits.company.created') || this.proxy('traits.company.createdAt'); if (created) return newDate(created); }; /** * Get the user's name, optionally combining a first and last name if that's all * that was provided. * * @return {String or Undefined} */ Identify.prototype.name = function () { var name = this.proxy('traits.name'); if (typeof name === 'string') return trim(name); var firstName = this.firstName(); var lastName = this.lastName(); if (firstName && lastName) return trim(firstName + ' ' + lastName); }; /** * Get the user's first name, optionally splitting it out of a single name if * that's all that was provided. * * @return {String or Undefined} */ Identify.prototype.firstName = function () { var firstName = this.proxy('traits.firstName'); if (typeof firstName === 'string') return trim(firstName); var name = this.proxy('traits.name'); if (typeof name === 'string') return trim(name).split(' ')[0]; }; /** * Get the user's last name, optionally splitting it out of a single name if * that's all that was provided. * * @return {String or Undefined} */ Identify.prototype.lastName = function () { var lastName = this.proxy('traits.lastName'); if (typeof lastName === 'string') return trim(lastName); var name = this.proxy('traits.name'); if (typeof name !== 'string') return; var space = trim(name).indexOf(' '); if (space === -1) return; return trim(name.substr(space + 1)); }; /** * Get the user's unique id. * * @return {String or undefined} */ Identify.prototype.uid = function(){ return this.userId() || this.username() || this.email(); }; /** * Get description. * * @return {String} */ Identify.prototype.description = function(){ return this.proxy('traits.description') || this.proxy('traits.background'); }; /** * Get the age. * * If the age is not explicitly set * the method will compute it from `.birthday()` * if possible. * * @return {Number} */ Identify.prototype.age = function(){ var date = this.birthday(); var age = get(this.traits(), 'age'); if (null != age) return age; if ('date' != type(date)) return; var now = new Date; return now.getFullYear() - date.getFullYear(); }; /** * Get the avatar. * * .photoUrl needed because help-scout * implementation uses `.avatar || .photoUrl`. * * .avatarUrl needed because trakio uses it. * * @return {Mixed} */ Identify.prototype.avatar = function(){ var traits = this.traits(); return get(traits, 'avatar') || get(traits, 'photoUrl') || get(traits, 'avatarUrl'); }; /** * Get the position. * * .jobTitle needed because some integrations use it. * * @return {Mixed} */ Identify.prototype.position = function(){ var traits = this.traits(); return get(traits, 'position') || get(traits, 'jobTitle'); }; /** * Setup sme basic "special" trait proxies. */ Identify.prototype.username = Facade.proxy('traits.username'); Identify.prototype.website = Facade.one('traits.website'); Identify.prototype.websites = Facade.multi('traits.website'); Identify.prototype.phone = Facade.one('traits.phone'); Identify.prototype.phones = Facade.multi('traits.phone'); Identify.prototype.address = Facade.proxy('traits.address'); Identify.prototype.gender = Facade.proxy('traits.gender'); Identify.prototype.birthday = Facade.proxy('traits.birthday'); }, {"./address":145,"./facade":135,"is-email":154,"new-date":146,"./utils":144,"obj-case":92,"trim":126}], 139: [function(require, module, exports) { var inherit = require('./utils').inherit; var clone = require('./utils').clone; var type = require('./utils').type; var Facade = require('./facade'); var Identify = require('./identify'); var isEmail = require('is-email'); var get = require('obj-case'); /** * Expose `Track` facade. */ module.exports = Track; /** * Initialize a new `Track` facade with a `dictionary` of arguments. * * @param {object} dictionary * @property {String} event * @property {String} userId * @property {String} sessionId * @property {Object} properties * @property {Object} options */ function Track (dictionary) { Facade.call(this, dictionary); } /** * Inherit from `Facade`. */ inherit(Track, Facade); /** * Return the facade's action. * * @return {String} */ Track.prototype.type = Track.prototype.action = function () { return 'track'; }; /** * Setup some basic proxies. */ Track.prototype.event = Facade.field('event'); Track.prototype.value = Facade.proxy('properties.value'); /** * Misc */ Track.prototype.category = Facade.proxy('properties.category'); /** * Ecommerce */ Track.prototype.id = Facade.proxy('properties.id'); Track.prototype.sku = Facade.proxy('properties.sku'); Track.prototype.tax = Facade.proxy('properties.tax'); Track.prototype.name = Facade.proxy('properties.name'); Track.prototype.price = Facade.proxy('properties.price'); Track.prototype.total = Facade.proxy('properties.total'); Track.prototype.coupon = Facade.proxy('properties.coupon'); Track.prototype.shipping = Facade.proxy('properties.shipping'); Track.prototype.discount = Facade.proxy('properties.discount'); /** * Description */ Track.prototype.description = Facade.proxy('properties.description'); /** * Plan */ Track.prototype.plan = Facade.proxy('properties.plan'); /** * Order id. * * @return {String} * @api public */ Track.prototype.orderId = function(){ return this.proxy('properties.id') || this.proxy('properties.orderId'); }; /** * Get subtotal. * * @return {Number} */ Track.prototype.subtotal = function(){ var subtotal = get(this.properties(), 'subtotal'); var total = this.total(); var n; if (subtotal) return subtotal; if (!total) return 0; if (n = this.tax()) total -= n; if (n = this.shipping()) total -= n; if (n = this.discount()) total += n; return total; }; /** * Get products. * * @return {Array} */ Track.prototype.products = function(){ var props = this.properties(); var products = get(props, 'products'); return 'array' == type(products) ? products : []; }; /** * Get quantity. * * @return {Number} */ Track.prototype.quantity = function(){ var props = this.obj.properties || {}; return props.quantity || 1; }; /** * Get currency. * * @return {String} */ Track.prototype.currency = function(){ var props = this.obj.properties || {}; return props.currency || 'USD'; }; /** * BACKWARDS COMPATIBILITY: should probably re-examine where these come from. */ Track.prototype.referrer = Facade.proxy('properties.referrer'); Track.prototype.query = Facade.proxy('options.query'); /** * Get the call's properties. * * @param {Object} aliases * @return {Object} */ Track.prototype.properties = function (aliases) { var ret = this.field('properties') || {}; aliases = aliases || {}; for (var alias in aliases) { var value = null == this[alias] ? this.proxy('properties.' + alias) : this[alias](); if (null == value) continue; ret[aliases[alias]] = value; delete ret[alias]; } return ret; }; /** * Get the call's username. * * @return {String or Undefined} */ Track.prototype.username = function () { return this.proxy('traits.username') || this.proxy('properties.username') || this.userId() || this.sessionId(); }; /** * Get the call's email, using an the user ID if it's a valid email. * * @return {String or Undefined} */ Track.prototype.email = function () { var email = this.proxy('traits.email'); email = email || this.proxy('properties.email'); if (email) return email; var userId = this.userId(); if (isEmail(userId)) return userId; }; /** * Get the call's revenue, parsing it from a string with an optional leading * dollar sign. * * For products/services that don't have shipping and are not directly taxed, * they only care about tracking `revenue`. These are things like * SaaS companies, who sell monthly subscriptions. The subscriptions aren't * taxed directly, and since it's a digital product, it has no shipping. * * The only case where there's a difference between `revenue` and `total` * (in the context of analytics) is on ecommerce platforms, where they want * the `revenue` function to actually return the `total` (which includes * tax and shipping, total = subtotal + tax + shipping). This is probably * because on their backend they assume tax and shipping has been applied to * the value, and so can get the revenue on their own. * * @return {Number} */ Track.prototype.revenue = function () { var revenue = this.proxy('properties.revenue'); var event = this.event(); // it's always revenue, unless it's called during an order completion. if (!revenue && event && event.match(/completed ?order/i)) { revenue = this.proxy('properties.total'); } return currency(revenue); }; /** * Get cents. * * @return {Number} */ Track.prototype.cents = function(){ var revenue = this.revenue(); return 'number' != typeof revenue ? this.value() || 0 : revenue * 100; }; /** * A utility to turn the pieces of a track call into an identify. Used for * integrations with super properties or rate limits. * * TODO: remove me. * * @return {Facade} */ Track.prototype.identify = function () { var json = this.json(); json.traits = this.traits(); return new Identify(json); }; /** * Get float from currency value. * * @param {Mixed} val * @return {Number} */ function currency(val) { if (!val) return; if (typeof val === 'number') return val; if (typeof val !== 'string') return; val = val.replace(/\$/g, ''); val = parseFloat(val); if (!isNaN(val)) return val; } }, {"./utils":144,"./facade":135,"./identify":138,"is-email":154,"obj-case":92}], 140: [function(require, module, exports) { var inherit = require('./utils').inherit; var Facade = require('./facade'); var Track = require('./track'); /** * Expose `Page` facade */ module.exports = Page; /** * Initialize new `Page` facade with `dictionary`. * * @param {Object} dictionary * @param {String} category * @param {String} name * @param {Object} traits * @param {Object} options */ function Page(dictionary){ Facade.call(this, dictionary); } /** * Inherit from `Facade` */ inherit(Page, Facade); /** * Get the facade's action. * * @return {String} */ Page.prototype.type = Page.prototype.action = function(){ return 'page'; }; /** * Fields */ Page.prototype.category = Facade.field('category'); Page.prototype.name = Facade.field('name'); /** * Proxies. */ Page.prototype.title = Facade.proxy('properties.title'); Page.prototype.path = Facade.proxy('properties.path'); Page.prototype.url = Facade.proxy('properties.url'); /** * Referrer. */ Page.prototype.referrer = function(){ return this.proxy('properties.referrer') || this.proxy('context.referrer.url'); }; /** * Get the page properties mixing `category` and `name`. * * @return {Object} */ Page.prototype.properties = function(){ var props = this.field('properties') || {}; var category = this.category(); var name = this.name(); if (category) props.category = category; if (name) props.name = name; return props; }; /** * Get the page fullName. * * @return {String} */ Page.prototype.fullName = function(){ var category = this.category(); var name = this.name(); return name && category ? category + ' ' + name : name; }; /** * Get event with `name`. * * @return {String} */ Page.prototype.event = function(name){ return name ? 'Viewed ' + name + ' Page' : 'Loaded a Page'; }; /** * Convert this Page to a Track facade with `name`. * * @param {String} name * @return {Track} */ Page.prototype.track = function(name){ var props = this.properties(); return new Track({ event: this.event(name), timestamp: this.timestamp(), context: this.context(), properties: props }); }; }, {"./utils":144,"./facade":135,"./track":139}], 141: [function(require, module, exports) { var inherit = require('./utils').inherit; var Page = require('./page'); var Track = require('./track'); /** * Expose `Screen` facade */ module.exports = Screen; /** * Initialize new `Screen` facade with `dictionary`. * * @param {Object} dictionary * @param {String} category * @param {String} name * @param {Object} traits * @param {Object} options */ function Screen(dictionary){ Page.call(this, dictionary); } /** * Inherit from `Page` */ inherit(Screen, Page); /** * Get the facade's action. * * @return {String} * @api public */ Screen.prototype.type = Screen.prototype.action = function(){ return 'screen'; }; /** * Get event with `name`. * * @param {String} name * @return {String} * @api public */ Screen.prototype.event = function(name){ return name ? 'Viewed ' + name + ' Screen' : 'Loaded a Screen'; }; /** * Convert this Screen. * * @param {String} name * @return {Track} * @api public */ Screen.prototype.track = function(name){ var props = this.properties(); return new Track({ event: this.event(name), timestamp: this.timestamp(), context: this.context(), properties: props }); }; }, {"./utils":144,"./page":140,"./track":139}], 133: [function(require, module, exports) { /** * Module dependencies. */ var stringify = require('querystring').stringify; var sub = require('substitute'); /** * Factory function to create a pixel loader. * * @param {String} path * @return {Function} * @api public */ module.exports = function(path){ return function(query, obj, fn){ if ('function' == typeof obj) fn = obj, obj = {}; obj = obj || {}; fn = fn || function(){}; var url = sub(path, obj); var img = new Image; img.onerror = error(fn, 'failed to load pixel', img); img.onload = function(){ fn(); }; query = stringify(query); if (query) query = '?' + query; img.src = url + query; img.width = 1; img.height = 1; return img; }; }; /** * Create an error handler. * * @param {Fucntion} fn * @param {String} message * @param {Image} img * @return {Function} * @api private */ function error(fn, message, img){ return function(e){ e = e || window.event; var err = new Error(message); err.event = e; err.source = img; fn(err); }; } }, {"querystring":125,"substitute":155}], 155: [function(require, module, exports) { /** * Expose `substitute` */ module.exports = substitute; /** * Type. */ var type = Object.prototype.toString; /** * Substitute `:prop` with the given `obj` in `str` * * @param {String} str * @param {Object or Array} obj * @param {RegExp} expr * @return {String} * @api public */ function substitute(str, obj, expr){ if (!obj) throw new TypeError('expected an object'); expr = expr || /:(\w+)/g; return str.replace(expr, function(_, prop){ switch (type.call(obj)) { case '[object Object]': return null != obj[prop] ? obj[prop] : _; case '[object Array]': var val = obj.shift(); return null != val ? val : _; } }); } }, {}], 134: [function(require, module, exports) { /** * Module dependencies. */ var encode = encodeURIComponent; var decode = decodeURIComponent; var trim = require('trim'); var type = require('type'); /** * Parse the given query `str`. * * @param {String} str * @return {Object} * @api public */ exports.parse = function(str){ if ('string' != typeof str) return {}; str = trim(str); if ('' == str) return {}; if ('?' == str.charAt(0)) str = str.slice(1); var obj = {}; var pairs = str.split('&'); for (var i = 0; i < pairs.length; i++) { var parts = pairs[i].split('='); var key = decode(parts[0]); var m; if (m = /(\w+)\[(\d+)\]/.exec(key)) { obj[m[1]] = obj[m[1]] || []; obj[m[1]][m[2]] = decode(parts[1]); continue; } obj[parts[0]] = null == parts[1] ? '' : decode(parts[1]); } return obj; }; /** * Stringify the given `obj`. * * @param {Object} obj * @return {String} * @api public */ exports.stringify = function(obj){ if (!obj) return ''; var pairs = []; for (var key in obj) { var value = obj[key]; if ('array' == type(value)) { for (var i = 0; i < value.length; ++i) { pairs.push(encode(key + '[' + i + ']') + '=' + encode(value[i])); } continue; } pairs.push(encode(key) + '=' + encode(obj[key])); } return pairs.join('&'); }; }, {"trim":126,"type":7}], 19: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var tick = require('next-tick'); /** * Expose `BugHerd` integration. */ var BugHerd = module.exports = integration('BugHerd') .assumesPageview() .global('BugHerdConfig') .global('_bugHerd') .option('apiKey', '') .option('showFeedbackTab', true) .tag('<script src="//www.bugherd.com/sidebarv2.js?apikey={{ apiKey }}">'); /** * Initialize. * * http://support.bugherd.com/home * * @param {Object} page */ BugHerd.prototype.initialize = function(page){ window.BugHerdConfig = { feedback: { hide: !this.options.showFeedbackTab }}; var ready = this.ready; this.load(function(){ tick(ready); }); }; /** * Loaded? * * @return {Boolean} */ BugHerd.prototype.loaded = function(){ return !! window._bugHerd; }; }, {"analytics.js-integration":88,"next-tick":103}], 20: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var is = require('is'); var extend = require('extend'); var onError = require('on-error'); /** * UMD ? */ var umd = 'function' == typeof define && define.amd; /** * Source. */ var src = '//d2wy8f7a9ursnm.cloudfront.net/bugsnag-2.min.js'; /** * Expose `Bugsnag` integration. */ var Bugsnag = module.exports = integration('Bugsnag') .global('Bugsnag') .option('apiKey', '') .tag('<script src="' + src + '">'); /** * Initialize. * * https://bugsnag.com/docs/notifiers/js * * @param {Object} page */ Bugsnag.prototype.initialize = function(page){ var self = this; if (umd) { window.require([src], function(bugsnag){ bugsnag.apiKey = self.options.apiKey; window.Bugsnag = bugsnag; self.ready(); }); return; } this.load(function(){ window.Bugsnag.apiKey = self.options.apiKey; self.ready(); }); }; /** * Loaded? * * @return {Boolean} */ Bugsnag.prototype.loaded = function(){ return is.object(window.Bugsnag); }; /** * Identify. * * @param {Identify} identify */ Bugsnag.prototype.identify = function(identify){ window.Bugsnag.metaData = window.Bugsnag.metaData || {}; extend(window.Bugsnag.metaData, identify.traits()); }; }, {"analytics.js-integration":88,"is":91,"extend":130,"on-error":156}], 156: [function(require, module, exports) { /** * Expose `onError`. */ module.exports = onError; /** * Callbacks. */ var callbacks = []; /** * Preserve existing handler. */ if ('function' == typeof window.onerror) callbacks.push(window.onerror); /** * Bind to `window.onerror`. */ window.onerror = handler; /** * Error handler. */ function handler () { for (var i = 0, fn; fn = callbacks[i]; i++) fn.apply(this, arguments); } /** * Call a `fn` on `window.onerror`. * * @param {Function} fn */ function onError (fn) { callbacks.push(fn); if (window.onerror != handler) { callbacks.push(window.onerror); window.onerror = handler; } } }, {}], 21: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var defaults = require('defaults'); var onBody = require('on-body'); /** * Expose `Chartbeat` integration. */ var Chartbeat = module.exports = integration('Chartbeat') .assumesPageview() .global('_sf_async_config') .global('_sf_endpt') .global('pSUPERFLY') .option('domain', '') .option('uid', null) .tag('<script src="//static.chartbeat.com/js/chartbeat.js">'); /** * Initialize. * * http://chartbeat.com/docs/configuration_variables/ * * @param {Object} page */ Chartbeat.prototype.initialize = function(page){ var self = this; window._sf_async_config = window._sf_async_config || {}; window._sf_async_config.useCanonical = true; defaults(window._sf_async_config, this.options); onBody(function(){ window._sf_endpt = new Date().getTime(); // Note: Chartbeat depends on document.body existing so the script does // not load until that is confirmed. Otherwise it may trigger errors. self.load(self.ready); }); }; /** * Loaded? * * @return {Boolean} */ Chartbeat.prototype.loaded = function(){ return !! window.pSUPERFLY; }; /** * Page. * * http://chartbeat.com/docs/handling_virtual_page_changes/ * * @param {Page} page */ Chartbeat.prototype.page = function(page){ var category = page.category(); if (category) window._sf_async_config.sections = category; var author = page.proxy('properties.author'); if (author) window._sf_async_config.authors = author; var props = page.properties(); var name = page.fullName(); window.pSUPERFLY.virtualPage(props.path, name || props.title); }; }, {"analytics.js-integration":88,"defaults":157,"on-body":129}], 157: [function(require, module, exports) { /** * Expose `defaults`. */ module.exports = defaults; function defaults (dest, defaults) { for (var prop in defaults) { if (! (prop in dest)) { dest[prop] = defaults[prop]; } } return dest; }; }, {}], 22: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_cbq'); var each = require('each'); /** * HOP */ var has = Object.prototype.hasOwnProperty; /** * Supported events */ var supported = { activation: true, changePlan: true, register: true, refund: true, charge: true, cancel: true, login: true }; /** * Expose `ChurnBee` integration. */ var ChurnBee = module.exports = integration('ChurnBee') .global('_cbq') .global('ChurnBee') .option('apiKey', '') .tag('<script src="//api.churnbee.com/cb.js">') .mapping('events'); /** * Initialize. * * https://churnbee.com/docs * * @param {Object} page */ ChurnBee.prototype.initialize = function(page){ push('_setApiKey', this.options.apiKey); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ ChurnBee.prototype.loaded = function(){ return !! window.ChurnBee; }; /** * Track. * * @param {Track} event */ ChurnBee.prototype.track = function(track){ var event = track.event(); var events = this.events(event); events.push(event); each(events, function(event){ if (true != supported[event]) return; push(event, track.properties({ revenue: 'amount' })); }); }; }, {"analytics.js-integration":88,"global-queue":158,"each":4}], 158: [function(require, module, exports) { /** * Expose `generate`. */ module.exports = generate; /** * Generate a global queue pushing method with `name`. * * @param {String} name * @param {Object} options * @property {Boolean} wrap * @return {Function} */ function generate (name, options) { options = options || {}; return function (args) { args = [].slice.call(arguments); window[name] || (window[name] = []); options.wrap === false ? window[name].push.apply(window[name], args) : window[name].push(args); }; } }, {}], 23: [function(require, module, exports) { /** * Module dependencies. */ var date = require('load-date'); var domify = require('domify'); var each = require('each'); var integration = require('analytics.js-integration'); var is = require('is'); var useHttps = require('use-https'); var onBody = require('on-body'); /** * Expose `ClickTale` integration. */ var ClickTale = module.exports = integration('ClickTale') .assumesPageview() .global('WRInitTime') .global('ClickTale') .global('ClickTaleSetUID') .global('ClickTaleField') .global('ClickTaleEvent') .option('httpCdnUrl', 'http://s.clicktale.net/WRe0.js') .option('httpsCdnUrl', '') .option('projectId', '') .option('recordingRatio', 0.01) .option('partitionId', '') .tag('<script src="{{src}}">'); /** * Initialize. * * http://wiki.clicktale.com/Article/JavaScript_API * * @param {Object} page */ ClickTale.prototype.initialize = function(page){ var self = this; window.WRInitTime = date.getTime(); onBody(function(body){ body.appendChild(domify('<div id="ClickTaleDiv" style="display: none;">')); }); var http = this.options.httpCdnUrl; var https = this.options.httpsCdnUrl; if (useHttps() && !https) return this.debug('https option required'); var src = useHttps() ? https : http; this.load({ src: src }, function(){ window.ClickTale( self.options.projectId, self.options.recordingRatio, self.options.partitionId ); self.ready(); }); }; /** * Loaded? * * @return {Boolean} */ ClickTale.prototype.loaded = function(){ return is.fn(window.ClickTale); }; /** * Identify. * * http://wiki.clicktale.com/Article/ClickTaleTag#ClickTaleSetUID * http://wiki.clicktale.com/Article/ClickTaleTag#ClickTaleField * * @param {Identify} identify */ ClickTale.prototype.identify = function(identify){ var id = identify.userId(); window.ClickTaleSetUID(id); each(identify.traits(), function(key, value){ window.ClickTaleField(key, value); }); }; /** * Track. * * http://wiki.clicktale.com/Article/ClickTaleTag#ClickTaleEvent * * @param {Track} track */ ClickTale.prototype.track = function(track){ window.ClickTaleEvent(track.event()); }; }, {"load-date":159,"domify":119,"each":4,"analytics.js-integration":88,"is":91,"use-https":90,"on-body":129}], 159: [function(require, module, exports) { /* * Load date. * * For reference: http://www.html5rocks.com/en/tutorials/webperformance/basics/ */ var time = new Date() , perf = window.performance; if (perf && perf.timing && perf.timing.responseEnd) { time = new Date(perf.timing.responseEnd); } module.exports = time; }, {}], 24: [function(require, module, exports) { /** * Module dependencies. */ var Identify = require('facade').Identify; var extend = require('extend'); var integration = require('analytics.js-integration'); var is = require('is'); /** * Expose `Clicky` integration. */ var Clicky = module.exports = integration('Clicky') .assumesPageview() .global('clicky') .global('clicky_site_ids') .global('clicky_custom') .option('siteId', null) .tag('<script src="//static.getclicky.com/js"></script>'); /** * Initialize. * * http://clicky.com/help/customization * * @param {Object} page */ Clicky.prototype.initialize = function(page){ var user = this.analytics.user(); window.clicky_site_ids = window.clicky_site_ids || [this.options.siteId]; this.identify(new Identify({ userId: user.id(), traits: user.traits() })); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Clicky.prototype.loaded = function(){ return is.object(window.clicky); }; /** * Page. * * http://clicky.com/help/customization#/help/custom/manual * * @param {Page} page */ Clicky.prototype.page = function(page){ var properties = page.properties(); var category = page.category(); var name = page.fullName(); window.clicky.log(properties.path, name || properties.title); }; /** * Identify. * * @param {Identify} id (optional) */ Clicky.prototype.identify = function(identify){ window.clicky_custom = window.clicky_custom || {}; window.clicky_custom.session = window.clicky_custom.session || {}; var traits = identify.traits(); var username = identify.username(); var email = identify.email(); var name = identify.name(); if (username || email || name) traits.username = username || email || name; extend(window.clicky_custom.session, traits); }; /** * Track. * * http://clicky.com/help/customization#/help/custom/manual * * @param {Track} event */ Clicky.prototype.track = function(track){ window.clicky.goal(track.event(), track.revenue()); }; }, {"facade":132,"extend":130,"analytics.js-integration":88,"is":91}], 25: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var useHttps = require('use-https'); /** * Expose `Comscore` integration. */ var Comscore = module.exports = integration('comScore') .assumesPageview() .global('_comscore') .global('COMSCORE') .option('c1', '2') .option('c2', '') .tag('http', '<script src="http://b.scorecardresearch.com/beacon.js">') .tag('https', '<script src="https://sb.scorecardresearch.com/beacon.js">'); /** * Initialize. * * @param {Object} page */ Comscore.prototype.initialize = function(page){ window._comscore = window._comscore || [this.options]; var name = useHttps() ? 'https' : 'http'; this.load(name, this.ready); }; /** * Loaded? * * @return {Boolean} */ Comscore.prototype.loaded = function(){ return !! window.COMSCORE; }; /** * Page * * @param {Object} page */ Comscore.prototype.page = function(page){ window.COMSCORE.beacon(this.options); }; }, {"analytics.js-integration":88,"use-https":90}], 26: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); /** * Expose `CrazyEgg` integration. */ var CrazyEgg = module.exports = integration('Crazy Egg') .assumesPageview() .global('CE2') .option('accountNumber', '') .tag('<script src="//dnn506yrbagrg.cloudfront.net/pages/scripts/{{ path }}.js?{{ cache }}">'); /** * Initialize. * * @param {Object} page */ CrazyEgg.prototype.initialize = function(page){ var number = this.options.accountNumber; var path = number.slice(0,4) + '/' + number.slice(4); var cache = Math.floor(new Date().getTime() / 3600000); this.load({ path: path, cache: cache }, this.ready); }; /** * Loaded? * * @return {Boolean} */ CrazyEgg.prototype.loaded = function(){ return !! window.CE2; }; }, {"analytics.js-integration":88}], 27: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_curebitq'); var Identify = require('facade').Identify; var throttle = require('throttle'); var Track = require('facade').Track; var iso = require('to-iso-string'); var clone = require('clone'); var each = require('each'); var bind = require('bind'); /** * Expose `Curebit` integration. */ var Curebit = module.exports = integration('Curebit') .global('_curebitq') .global('curebit') .option('siteId', '') .option('iframeWidth', '100%') .option('iframeHeight', '480') .option('iframeBorder', 0) .option('iframeId', 'curebit_integration') .option('responsive', true) .option('device', '') .option('insertIntoId', '') .option('campaigns', {}) .option('server', 'https://www.curebit.com') .tag('<script src="//d2jjzw81hqbuqv.cloudfront.net/integration/curebit-1.0.min.js">'); /** * Initialize. * * @param {Object} page */ Curebit.prototype.initialize = function(page){ push('init', { site_id: this.options.siteId, server: this.options.server }); this.load(this.ready); // throttle the call to `page` since curebit needs to append an iframe this.page = throttle(bind(this, this.page), 250); }; /** * Loaded? * * @return {Boolean} */ Curebit.prototype.loaded = function(){ return !!window.curebit; }; /** * Page. * * Call the `register_affiliate` method of the Curebit API that will load a * custom iframe onto the page, only if this page's path is marked as a * campaign. * * http://www.curebit.com/docs/affiliate/registration * * This is throttled to prevent accidentally drawing the iframe multiple times, * from multiple `.page()` calls. The `250` is from the curebit script. * * @param {String} url * @param {String} id * @param {Function} fn * @api private */ Curebit.prototype.injectIntoId = function(url, id, fn){ var server = this.options.server; when(function(){ return document.getElementById(id); }, function(){ var script = document.createElement('script'); script.src = url; var parent = document.getElementById(id); parent.appendChild(script); onload(script, fn); }); }; /** * Campaign tags. * * @param {Page} page */ Curebit.prototype.page = function(page){ var user = this.analytics.user(); var campaigns = this.options.campaigns; var path = window.location.pathname; if (!campaigns[path]) return; var tags = (campaigns[path] || '').split(','); if (!tags.length) return; var settings = { responsive: this.options.responsive, device: this.options.device, campaign_tags: tags, iframe: { width: this.options.iframeWidth, height: this.options.iframeHeight, id: this.options.iframeId, frameborder: this.options.iframeBorder, container: this.options.insertIntoId } }; var identify = new Identify({ userId: user.id(), traits: user.traits() }); // if we have an email, add any information about the user if (identify.email()) { settings.affiliate_member = { email: identify.email(), first_name: identify.firstName(), last_name: identify.lastName(), customer_id: identify.userId() }; } push('register_affiliate', settings); }; /** * Completed order. * * Fire the Curebit `register_purchase` with the order details and items. * * https://www.curebit.com/docs/ecommerce/custom * * @param {Track} track */ Curebit.prototype.completedOrder = function(track){ var user = this.analytics.user(); var orderId = track.orderId(); var products = track.products(); var props = track.properties(); var items = []; var identify = new Identify({ traits: user.traits(), userId: user.id() }); each(products, function(product){ var track = new Track({ properties: product }); items.push({ product_id: track.id() || track.sku(), quantity: track.quantity(), image_url: product.image, price: track.price(), title: track.name(), url: product.url, }); }); push('register_purchase', { order_date: iso(props.date || new Date()), order_number: orderId, coupon_code: track.coupon(), subtotal: track.total(), customer_id: identify.userId(), first_name: identify.firstName(), last_name: identify.lastName(), email: identify.email(), items: items }); }; }, {"analytics.js-integration":88,"global-queue":158,"facade":132,"throttle":160,"to-iso-string":161,"clone":95,"each":4,"bind":101}], 160: [function(require, module, exports) { /** * Module exports. */ module.exports = throttle; /** * Returns a new function that, when invoked, invokes `func` at most one time per * `wait` milliseconds. * * @param {Function} func The `Function` instance to wrap. * @param {Number} wait The minimum number of milliseconds that must elapse in between `func` invokations. * @return {Function} A new function that wraps the `func` function passed in. * @api public */ function throttle (func, wait) { var rtn; // return value var last = 0; // last invokation timestamp return function throttled () { var now = new Date().getTime(); var delta = now - last; if (delta >= wait) { rtn = func.apply(this, arguments); last = now; } return rtn; }; } }, {}], 161: [function(require, module, exports) { /** * Expose `toIsoString`. */ module.exports = toIsoString; /** * Turn a `date` into an ISO string. * * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString * * @param {Date} date * @return {String} */ function toIsoString (date) { return date.getUTCFullYear() + '-' + pad(date.getUTCMonth() + 1) + '-' + pad(date.getUTCDate()) + 'T' + pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + pad(date.getUTCSeconds()) + '.' + String((date.getUTCMilliseconds()/1000).toFixed(3)).slice(2, 5) + 'Z'; } /** * Pad a `number` with a ten's place zero. * * @param {Number} number * @return {String} */ function pad (number) { var n = number.toString(); return n.length === 1 ? '0' + n : n; } }, {}], 28: [function(require, module, exports) { /** * Module dependencies. */ var alias = require('alias'); var convertDates = require('convert-dates'); var Identify = require('facade').Identify; var integration = require('analytics.js-integration'); /** * Expose `Customerio` integration. */ var Customerio = module.exports = integration('Customer.io') .global('_cio') .option('siteId', '') .tag('<script id="cio-tracker" src="https://assets.customer.io/assets/track.js" data-site-id="{{ siteId }}">'); /** * Initialize. * * http://customer.io/docs/api/javascript.html * * @param {Object} page */ Customerio.prototype.initialize = function(page){ window._cio = window._cio || []; (function(){var a,b,c; a = function(f){return function(){window._cio.push([f].concat(Array.prototype.slice.call(arguments,0))); }; }; b = ['identify', 'track']; for (c = 0; c < b.length; c++) {window._cio[b[c]] = a(b[c]); } })(); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Customerio.prototype.loaded = function(){ return (!! window._cio) && (window._cio.push !== Array.prototype.push); }; /** * Identify. * * http://customer.io/docs/api/javascript.html#section-Identify_customers * * @param {Identify} identify */ Customerio.prototype.identify = function(identify){ if (!identify.userId()) return this.debug('user id required'); var traits = identify.traits({ createdAt: 'created' }); traits = alias(traits, { created: 'created_at' }); traits = convertDates(traits, convertDate); window._cio.identify(traits); }; /** * Group. * * @param {Group} group */ Customerio.prototype.group = function(group){ var traits = group.traits(); var user = this.analytics.user(); traits = alias(traits, function(trait){ return 'Group ' + trait; }); this.identify(new Identify({ userId: user.id(), traits: traits })); }; /** * Track. * * http://customer.io/docs/api/javascript.html#section-Track_a_custom_event * * @param {Track} track */ Customerio.prototype.track = function(track){ var properties = track.properties(); properties = convertDates(properties, convertDate); window._cio.track(track.event(), properties); }; /** * Convert a date to the format Customer.io supports. * * @param {Date} date * @return {Number} */ function convertDate(date){ return Math.floor(date.getTime() / 1000); } }, {"alias":162,"convert-dates":163,"facade":132,"analytics.js-integration":88}], 162: [function(require, module, exports) { var type = require('type'); try { var clone = require('clone'); } catch (e) { var clone = require('clone-component'); } /** * Expose `alias`. */ module.exports = alias; /** * Alias an `object`. * * @param {Object} obj * @param {Mixed} method */ function alias (obj, method) { switch (type(method)) { case 'object': return aliasByDictionary(clone(obj), method); case 'function': return aliasByFunction(clone(obj), method); } } /** * Convert the keys in an `obj` using a dictionary of `aliases`. * * @param {Object} obj * @param {Object} aliases */ function aliasByDictionary (obj, aliases) { for (var key in aliases) { if (undefined === obj[key]) continue; obj[aliases[key]] = obj[key]; delete obj[key]; } return obj; } /** * Convert the keys in an `obj` using a `convert` function. * * @param {Object} obj * @param {Function} convert */ function aliasByFunction (obj, convert) { // have to create another object so that ie8 won't infinite loop on keys var output = {}; for (var key in obj) output[convert(key)] = obj[key]; return output; } }, {"type":7,"clone":150}], 163: [function(require, module, exports) { var is = require('is'); try { var clone = require('clone'); } catch (e) { var clone = require('clone-component'); } /** * Expose `convertDates`. */ module.exports = convertDates; /** * Recursively convert an `obj`'s dates to new values. * * @param {Object} obj * @param {Function} convert * @return {Object} */ function convertDates (obj, convert) { obj = clone(obj); for (var key in obj) { var val = obj[key]; if (is.date(val)) obj[key] = convert(val); if (is.object(val)) obj[key] = convertDates(val, convert); } return obj; } }, {"is":91,"clone":95}], 29: [function(require, module, exports) { /** * Module dependencies. */ var alias = require('alias'); var integration = require('analytics.js-integration'); var is = require('is'); var load = require('load-script'); var push = require('global-queue')('_dcq'); /** * Expose `Drip` integration. */ var Drip = module.exports = integration('Drip') .assumesPageview() .global('_dc') .global('_dcqi') .global('_dcq') .global('_dcs') .option('account', '') .tag('<script src="//tag.getdrip.com/{{ account }}.js">'); /** * Initialize. * * @param {Object} page */ Drip.prototype.initialize = function(page){ window._dcq = window._dcq || []; window._dcs = window._dcs || {}; window._dcs.account = this.options.account; this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Drip.prototype.loaded = function(){ return is.object(window._dc); }; /** * Track. * * @param {Track} track */ Drip.prototype.track = function(track){ var props = track.properties(); var cents = track.cents(); if (cents) props.value = cents; delete props.revenue; push('track', track.event(), props); }; /** * Identify. * * @param {Identify} identify */ Drip.prototype.identify = function(identify){ push('identify', identify.traits()); }; }, {"alias":162,"analytics.js-integration":88,"is":91,"load-script":128,"global-queue":158}], 30: [function(require, module, exports) { /** * Module dependencies. */ var extend = require('extend'); var integration = require('analytics.js-integration'); var onError = require('on-error'); var push = require('global-queue')('_errs'); /** * Expose `Errorception` integration. */ var Errorception = module.exports = integration('Errorception') .assumesPageview() .global('_errs') .option('projectId', '') .option('meta', true) .tag('<script src="//beacon.errorception.com/{{ projectId }}.js">'); /** * Initialize. * * https://github.com/amplitude/Errorception-Javascript * * @param {Object} page */ Errorception.prototype.initialize = function(page){ window._errs = window._errs || [this.options.projectId]; onError(push); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Errorception.prototype.loaded = function(){ return !! (window._errs && window._errs.push !== Array.prototype.push); }; /** * Identify. * * http://blog.errorception.com/2012/11/capture-custom-data-with-your-errors.html * * @param {Object} identify */ Errorception.prototype.identify = function(identify){ if (!this.options.meta) return; var traits = identify.traits(); window._errs = window._errs || []; window._errs.meta = window._errs.meta || {}; extend(window._errs.meta, traits); }; }, {"extend":130,"analytics.js-integration":88,"on-error":156,"global-queue":158}], 31: [function(require, module, exports) { /** * Module dependencies. */ var each = require('each'); var integration = require('analytics.js-integration'); var push = require('global-queue')('_aaq'); /** * Expose `Evergage` integration.integration. */ var Evergage = module.exports = integration('Evergage') .assumesPageview() .global('_aaq') .option('account', '') .option('dataset', '') .tag('<script src="//cdn.evergage.com/beacon/{{ account }}/{{ dataset }}/scripts/evergage.min.js">'); /** * Initialize. * * @param {Object} page */ Evergage.prototype.initialize = function(page){ var account = this.options.account; var dataset = this.options.dataset; window._aaq = window._aaq || []; push('setEvergageAccount', account); push('setDataset', dataset); push('setUseSiteConfig', true); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Evergage.prototype.loaded = function(){ return !! (window._aaq && window._aaq.push !== Array.prototype.push); }; /** * Page. * * @param {Page} page */ Evergage.prototype.page = function(page){ var props = page.properties(); var name = page.name(); if (name) push('namePage', name); each(props, function(key, value){ push('setCustomField', key, value, 'page'); }); window.Evergage.init(true); }; /** * Identify. * * @param {Identify} identify */ Evergage.prototype.identify = function(identify){ var id = identify.userId(); if (!id) return; push('setUser', id); var traits = identify.traits({ email: 'userEmail', name: 'userName' }); each(traits, function(key, value){ push('setUserField', key, value, 'page'); }); }; /** * Group. * * @param {Group} group */ Evergage.prototype.group = function(group){ var props = group.traits(); var id = group.groupId(); if (!id) return; push('setCompany', id); each(props, function(key, value){ push('setAccountField', key, value, 'page'); }); }; /** * Track. * * @param {Track} track */ Evergage.prototype.track = function(track){ push('trackAction', track.event(), track.properties()); }; }, {"each":4,"analytics.js-integration":88,"global-queue":158}], 32: [function(require, module, exports) { 'use strict'; /** * Module dependencies. */ var bind = require('bind'); var domify = require('domify'); var each = require('each'); var extend = require('extend'); var integration = require('analytics.js-integration'); var json = require('json'); /** * Expose `Extole` integration. */ var Extole = module.exports = integration('Extole') .global('extole') .option('clientId', '') .mapping('events') .tag('main', '<script src="//tags.extole.com/{{ clientId }}/core.js">'); /** * Initialize. * * @param {Object} page */ Extole.prototype.initialize = function(){ if (this.loaded()) return this.ready(); this.load('main', bind(this, this.ready)); }; /** * Loaded? * * @return {Boolean} */ Extole.prototype.loaded = function(){ return !!window.extole; }; /** * Track. * * @param {Track} track */ Extole.prototype.track = function(track){ var user = this.analytics.user(); var traits = user.traits(); var userId = user.id(); var email = traits.email; if (!userId && !email) { return this.debug('User must be identified before `#track` calls'); } var event = track.event(); var extoleEvents = this.events(event); if (!extoleEvents.length) { return this.debug('No events found for %s', event); } each(extoleEvents, bind(this, function(extoleEvent){ this._registerConversion(this._createConversionTag({ type: extoleEvent, params: this._formatConversionParams(event, email, userId, track.properties()) })); })); }; /** * Register a conversion to Extole. * * @api private * @param {HTMLElement} conversionTag An Extole conversion tag. */ // TODO: If I understand Extole's lib correctly, this is sometimes async, // sometimes sync. Should probably refactor this into more predictable/sane // behavior Extole.prototype._registerConversion = function(conversionTag){ if (window.extole.main && window.extole.main.fireConversion) { return window.extole.main.fireConversion(conversionTag); } if (window.extole.initializeGo) { window.extole.initializeGo().andWhenItsReady(function(){ window.extole.main.fireConversion(conversionTag); }); } }; /** * formatConversionParams. Formats details from a Segment track event into a * data format Extole can accept. * * @param {string} event * @param {string} email * @param {string|number} userId * @param {Object} properties The result of calling `track.properties()`. * @return {Object} */ Extole.prototype._formatConversionParams = function(event, email, userId, properties){ var total; if (properties.total) { total = properties.total; delete properties.total; properties['tag:cart_value'] = total; } return extend({ 'tag:segment_event': event, e: email, partner_conversion_id: userId }, properties); }; /** * Create an Extole conversion tag. * * @param {Object} conversion An Extole conversion object. * @return {HTMLElement} */ Extole.prototype._createConversionTag = function(conversion){ return domify('<script type="extole/conversion">' + json.stringify(conversion) + '</script>'); }; }, {"bind":101,"domify":119,"each":4,"extend":130,"analytics.js-integration":88,"json":164}], 164: [function(require, module, exports) { var json = window.JSON || {}; var stringify = json.stringify; var parse = json.parse; module.exports = parse && stringify ? JSON : require('json-fallback'); }, {"json-fallback":165}], 165: [function(require, module, exports) { /* json2.js 2014-02-04 Public Domain. NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. See http://www.JSON.org/js.html This code should be minified before deployment. See http://javascript.crockford.com/jsmin.html USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO NOT CONTROL. This file creates a global JSON object containing two methods: stringify and parse. JSON.stringify(value, replacer, space) value any JavaScript value, usually an object or array. replacer an optional parameter that determines how object values are stringified for objects. It can be a function or an array of strings. space an optional parameter that specifies the indentation of nested structures. If it is omitted, the text will be packed without extra whitespace. If it is a number, it will specify the number of spaces to indent at each level. If it is a string (such as '\t' or '&nbsp;'), it contains the characters used to indent at each level. This method produces a JSON text from a JavaScript value. When an object value is found, if the object contains a toJSON method, its toJSON method will be called and the result will be stringified. A toJSON method does not serialize: it returns the value represented by the name/value pair that should be serialized, or undefined if nothing should be serialized. The toJSON method will be passed the key associated with the value, and this will be bound to the value For example, this would serialize Dates as ISO strings. Date.prototype.toJSON = function (key) { function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } return this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z'; }; You can provide an optional replacer method. It will be passed the key and value of each member, with this bound to the containing object. The value that is returned from your method will be serialized. If your method returns undefined, then the member will be excluded from the serialization. If the replacer parameter is an array of strings, then it will be used to select the members to be serialized. It filters the results such that only members with keys listed in the replacer array are stringified. Values that do not have JSON representations, such as undefined or functions, will not be serialized. Such values in objects will be dropped; in arrays they will be replaced with null. You can use a replacer function to replace those with JSON values. JSON.stringify(undefined) returns undefined. The optional space parameter produces a stringification of the value that is filled with line breaks and indentation to make it easier to read. If the space parameter is a non-empty string, then that string will be used for indentation. If the space parameter is a number, then the indentation will be that many spaces. Example: text = JSON.stringify(['e', {pluribus: 'unum'}]); // text is '["e",{"pluribus":"unum"}]' text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' text = JSON.stringify([new Date()], function (key, value) { return this[key] instanceof Date ? 'Date(' + this[key] + ')' : value; }); // text is '["Date(---current time---)"]' JSON.parse(text, reviver) This method parses a JSON text to produce an object or array. It can throw a SyntaxError exception. The optional reviver parameter is a function that can filter and transform the results. It receives each of the keys and values, and its return value is used instead of the original value. If it returns what it received, then the structure is not modified. If it returns undefined then the member is deleted. Example: // Parse the text. Values that look like ISO date strings will // be converted to Date objects. myData = JSON.parse(text, function (key, value) { var a; if (typeof value === 'string') { a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); if (a) { return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +a[5], +a[6])); } } return value; }); myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { var d; if (typeof value === 'string' && value.slice(0, 5) === 'Date(' && value.slice(-1) === ')') { d = new Date(value.slice(5, -1)); if (d) { return d; } } return value; }); This is a reference implementation. You are free to copy, modify, or redistribute. */ /*jslint evil: true, regexp: true */ /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length, parse, prototype, push, replace, slice, stringify, test, toJSON, toString, valueOf */ // Create a JSON object only if one does not already exist. We create the // methods in a closure to avoid creating global variables. (function () { 'use strict'; var JSON = module.exports = {}; function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } if (typeof Date.prototype.toJSON !== 'function') { Date.prototype.toJSON = function () { return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : null; }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function () { return this.valueOf(); }; } var cx, escapable, gap, indent, meta, rep; function quote(string) { // If the string contains no control characters, no quote characters, and no // backslash characters, then we can safely slap some quotes around it. // Otherwise we must also replace the offending characters with safe escape // sequences. escapable.lastIndex = 0; return escapable.test(string) ? '"' + string.replace(escapable, function (a) { var c = meta[a]; return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }) + '"' : '"' + string + '"'; } function str(key, holder) { // Produce a string from holder[key]. var i, // The loop counter. k, // The member key. v, // The member value. length, mind = gap, partial, value = holder[key]; // If the value has a toJSON method, call it to obtain a replacement value. if (value && typeof value === 'object' && typeof value.toJSON === 'function') { value = value.toJSON(key); } // If we were called with a replacer function, then call the replacer to // obtain a replacement value. if (typeof rep === 'function') { value = rep.call(holder, key, value); } // What happens next depends on the value's type. switch (typeof value) { case 'string': return quote(value); case 'number': // JSON numbers must be finite. Encode non-finite numbers as null. return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': // If the value is a boolean or null, convert it to a string. Note: // typeof null does not produce 'null'. The case is included here in // the remote chance that this gets fixed someday. return String(value); // If the type is 'object', we might be dealing with an object or an array or // null. case 'object': // Due to a specification blunder in ECMAScript, typeof null is 'object', // so watch out for that case. if (!value) { return 'null'; } // Make an array to hold the partial results of stringifying this object value. gap += indent; partial = []; // Is the value an array? if (Object.prototype.toString.apply(value) === '[object Array]') { // The value is an array. Stringify every element. Use null as a placeholder // for non-JSON values. length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null'; } // Join all of the elements together, separated with commas, and wrap them in // brackets. v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v; } // If the replacer is an array, use it to select the members to be stringified. if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { if (typeof rep[i] === 'string') { k = rep[i]; v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } else { // Otherwise, iterate through all of the keys in the object. for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } // Join all of the member texts together, separated with commas, // and wrap them in braces. v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v; } } // If the JSON object does not yet have a stringify method, give it one. if (typeof JSON.stringify !== 'function') { escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; meta = { // table of character substitutions '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' }; JSON.stringify = function (value, replacer, space) { // The stringify method takes a value and an optional replacer, and an optional // space parameter, and returns a JSON text. The replacer can be a function // that can replace values, or an array of strings that will select the keys. // A default replacer method can be provided. Use of the space parameter can // produce text that is more easily readable. var i; gap = ''; indent = ''; // If the space parameter is a number, make an indent string containing that // many spaces. if (typeof space === 'number') { for (i = 0; i < space; i += 1) { indent += ' '; } // If the space parameter is a string, it will be used as the indent string. } else if (typeof space === 'string') { indent = space; } // If there is a replacer, it must be a function or an array. // Otherwise, throw an error. rep = replacer; if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); } // Make a fake root object containing our value under the key of ''. // Return the result of stringifying the value. return str('', {'': value}); }; } // If the JSON object does not yet have a parse method, give it one. if (typeof JSON.parse !== 'function') { cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; JSON.parse = function (text, reviver) { // The parse method takes a text and an optional reviver function, and returns // a JavaScript value if the text is a valid JSON text. var j; function walk(holder, key) { // The walk method is used to recursively walk the resulting structure so // that modifications can be made. var k, v, value = holder[key]; if (value && typeof value === 'object') { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // Parsing happens in four stages. In the first stage, we replace certain // Unicode characters with escape sequences. JavaScript handles many characters // incorrectly, either silently deleting them, or treating them as line endings. text = String(text); cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function (a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } // In the second stage, we run the text against regular expressions that look // for non-JSON patterns. We are especially concerned with '()' and 'new' // because they can cause invocation, and '=' because it can cause mutation. // But just to be safe, we want to reject all unexpected forms. // We split the second stage into 4 regexp operations in order to work around // crippling inefficiencies in IE's and Safari's regexp engines. First we // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we // replace all simple value tokens with ']' characters. Third, we delete all // open brackets that follow a colon or comma or that begin the text. Finally, // we look to see that the remaining characters are only whitespace or ']' or // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. if (/^[\],:{}\s]*$/ .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { // In the third stage we use the eval function to compile the text into a // JavaScript structure. The '{' operator is subject to a syntactic ambiguity // in JavaScript: it can begin a block or an object literal. We wrap the text // in parens to eliminate the ambiguity. j = eval('(' + text + ')'); // In the optional fourth stage, we recursively walk the new structure, passing // each name/value pair to a reviver function for possible transformation. return typeof reviver === 'function' ? walk({'': j}, '') : j; } // If the text is not JSON parseable, then a SyntaxError is thrown. throw new SyntaxError('JSON.parse'); }; } }()); }, {}], 33: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_fbq'); var each = require('each'); /** * HOP */ var has = Object.prototype.hasOwnProperty; /** * Expose `Facebook` */ var Facebook = module.exports = integration('Facebook Conversion Tracking') .global('_fbq') .option('currency', 'USD') .tag('<script src="//connect.facebook.net/en_US/fbds.js">') .mapping('events'); /** * Initialize Facebook Conversion Tracking * * https://developers.facebook.com/docs/ads-for-websites/conversion-pixel-code-migration * * @param {Object} page */ Facebook.prototype.initialize = function(page){ window._fbq = window._fbq || []; this.load(this.ready); window._fbq.loaded = true; }; /** * Loaded? * * @return {Boolean} */ Facebook.prototype.loaded = function(){ return !! (window._fbq && window._fbq.loaded); }; /** * Page. * * @param {Page} page */ Facebook.prototype.page = function(page){ var name = page.fullName(); this.track(page.track(name)); } /** * Track. * * https://developers.facebook.com/docs/reference/ads-api/custom-audience-website-faq/#fbpixel * * @param {Track} track */ Facebook.prototype.track = function(track){ var event = track.event(); var events = this.events(event); var revenue = track.revenue() || 0; var self = this; each(events, function(event){ push('track', event, { value: String(revenue.toFixed(2)), currency: self.options.currency }); }); }; }, {"analytics.js-integration":88,"global-queue":158,"each":4}], 34: [function(require, module, exports) { /** * Module dependencies. */ var push = require('global-queue')('_fxm'); var integration = require('analytics.js-integration'); var Track = require('facade').Track; var each = require('each'); /** * Expose `FoxMetrics` integration. */ var FoxMetrics = module.exports = integration('FoxMetrics') .assumesPageview() .global('_fxm') .option('appId', '') .tag('<script src="//d35tca7vmefkrc.cloudfront.net/scripts/{{ appId }}.js">'); /** * Initialize. * * http://foxmetrics.com/documentation/apijavascript * * @param {Object} page */ FoxMetrics.prototype.initialize = function(page){ window._fxm = window._fxm || []; this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ FoxMetrics.prototype.loaded = function(){ return !! (window._fxm && window._fxm.appId); }; /** * Page. * * @param {Page} page */ FoxMetrics.prototype.page = function(page){ var properties = page.proxy('properties'); var category = page.category(); var name = page.name(); this._category = category; // store for later push( '_fxm.pages.view', properties.title, // title name, // name category, // category properties.url, // url properties.referrer // referrer ); }; /** * Identify. * * @param {Identify} identify */ FoxMetrics.prototype.identify = function(identify){ var id = identify.userId(); if (!id) return; push( '_fxm.visitor.profile', id, // user id identify.firstName(), // first name identify.lastName(), // last name identify.email(), // email identify.address(), // address undefined, // social undefined, // partners identify.traits() // attributes ); }; /** * Track. * * @param {Track} track */ FoxMetrics.prototype.track = function(track){ var props = track.properties(); var category = this._category || props.category; push(track.event(), category, props); }; /** * Viewed product. * * @param {Track} track * @api private */ FoxMetrics.prototype.viewedProduct = function(track){ ecommerce('productview', track); }; /** * Removed product. * * @param {Track} track * @api private */ FoxMetrics.prototype.removedProduct = function(track){ ecommerce('removecartitem', track); }; /** * Added product. * * @param {Track} track * @api private */ FoxMetrics.prototype.addedProduct = function(track){ ecommerce('cartitem', track); }; /** * Completed Order. * * @param {Track} track * @api private */ FoxMetrics.prototype.completedOrder = function(track){ var orderId = track.orderId(); // transaction push( '_fxm.ecommerce.order', orderId, track.subtotal(), track.shipping(), track.tax(), track.city(), track.state(), track.zip(), track.quantity() ); // items each(track.products(), function(product){ var track = new Track({ properties: product }); ecommerce('purchaseitem', track, [ track.quantity(), track.price(), orderId ]); }); }; /** * Track ecommerce `event` with `track` * with optional `arr` to append. * * @param {String} event * @param {Track} track * @param {Array} arr * @api private */ function ecommerce(event, track, arr){ push.apply(null, [ '_fxm.ecommerce.' + event, track.id() || track.sku(), track.name(), track.category() ].concat(arr || [])); } }, {"global-queue":158,"analytics.js-integration":88,"facade":132,"each":4}], 35: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var bind = require('bind'); var when = require('when'); var is = require('is'); /** * Expose `Frontleaf` integration. */ var Frontleaf = module.exports = integration('Frontleaf') .global('_fl') .global('_flBaseUrl') .option('baseUrl', 'https://api.frontleaf.com') .option('token', '') .option('stream', '') .option('trackNamedPages', false) .option('trackCategorizedPages', false) .tag('<script id="_fl" src="{{ baseUrl }}/lib/tracker.js">'); /** * Initialize. * * http://docs.frontleaf.com/#/technical-implementation/tracking-customers/tracking-beacon * * @param {Object} page */ Frontleaf.prototype.initialize = function(page){ window._fl = window._fl || []; window._flBaseUrl = window._flBaseUrl || this.options.baseUrl; this._push('setApiToken', this.options.token); this._push('setStream', this.options.stream); var loaded = bind(this, this.loaded); var ready = this.ready; this.load({ baseUrl: window._flBaseUrl }, this.ready); }; /** * Loaded? * * @return {Boolean} */ Frontleaf.prototype.loaded = function(){ return is.array(window._fl) && window._fl.ready === true; }; /** * Identify. * * @param {Identify} identify */ Frontleaf.prototype.identify = function(identify){ var userId = identify.userId(); if (userId) { this._push('setUser', { id: userId, name: identify.name() || identify.username(), data: clean(identify.traits()) }); } }; /** * Group. * * @param {Group} group */ Frontleaf.prototype.group = function(group){ var groupId = group.groupId(); if (groupId) { this._push('setAccount', { id: groupId, name: group.proxy('traits.name'), data: clean(group.traits()) }); } }; /** * Page. * * @param {Page} page */ Frontleaf.prototype.page = function(page){ var category = page.category(); var name = page.fullName(); var opts = this.options; // categorized pages if (category && opts.trackCategorizedPages) { this.track(page.track(category)); } // named pages if (name && opts.trackNamedPages) { this.track(page.track(name)); } }; /** * Track. * * @param {Track} track */ Frontleaf.prototype.track = function(track){ var event = track.event(); this._push('event', event, clean(track.properties())); }; /** * Push a command onto the global Frontleaf queue. * * @param {String} command * @return {Object} args * @api private */ Frontleaf.prototype._push = function(command){ var args = [].slice.call(arguments, 1); window._fl.push(function(t){ t[command].apply(command, args); }); }; /** * Clean all nested objects and arrays. * * @param {Object} obj * @return {Object} * @api private */ function clean(obj){ var ret = {}; // Remove traits/properties that are already represented // outside of the data container var excludeKeys = ["id","name","firstName","lastName"]; var len = excludeKeys.length; for (var i = 0; i < len; i++) { clear(obj, excludeKeys[i]); } // Flatten nested hierarchy, preserving arrays obj = flatten(obj); // Discard nulls, represent arrays as comma-separated strings for (var key in obj) { var val = obj[key]; if (null == val) { continue; } if (is.array(val)) { ret[key] = val.toString(); continue; } ret[key] = val; } return ret; } /** * Remove a property from an object if set. * * @param {Object} obj * @param {String} key * @api private */ function clear(obj, key){ if (obj.hasOwnProperty(key)) { delete obj[key]; } } /** * Flatten a nested object into a single level space-delimited * hierarchy. * * Based on https://github.com/hughsk/flat * * @param {Object} source * @return {Object} * @api private */ function flatten(source){ var output = {}; function step(object, prev){ for (var key in object) { var value = object[key]; var newKey = prev ? prev + ' ' + key : key; if (!is.array(value) && is.object(value)) { return step(value, newKey); } output[newKey] = value; } } step(source); return output; } }, {"analytics.js-integration":88,"bind":101,"when":131,"is":91}], 36: [function(require, module, exports) { /** * Module dependencies. */ var foldl = require('foldl'); var is = require('is'); var camel = require('to-camel-case'); var integration = require('analytics.js-integration'); /** * Expose `FullStory` integration. * * https://www.fullstory.com/docs/developer */ var FullStory = module.exports = integration('FullStory') .option('org', '') .option('debug', false) .tag('<script src="https://www.fullstory.com/s/fs.js"></script>') /** * Initialize. */ FullStory.prototype.initialize = function(){ var self = this; window._fs_debug = this.options.debug; window._fs_host = 'www.fullstory.com'; window._fs_org = this.options.org; (function(m,n,e,t,l,o,g,y){ g=m[e]=function(a,b){g.q?g.q.push([a,b]):g._api(a,b);};g.q=[]; // jscs:disable g.identify=function(i,v){g(l,{uid:i});if(v)g(l,v)};g.setUserVars=function(v){FS(l,v)}; // jscs:enable g.setSessionVars=function(v){FS('session',v)};g.setPageVars=function(v){FS('page',v)}; self.ready(); self.load(); })(window,document,'FS','script','user'); }; /** * Loaded? * * @return {Boolean} */ FullStory.prototype.loaded = function(){ return !! window.FS; }; /** * Identify. * * @param {Identify} identify */ FullStory.prototype.identify = function(identify){ var id = identify.userId() || identify.anonymousId(); var traits = identify.traits({ name: 'displayName' }); var newTraits = foldl(function(results, value, key){ if (key !== 'id') results[key === 'displayName' || key === 'email' ? key : convert(key, value)] = value; return results; }, {}, traits); window.FS.identify(String(id), newTraits); }; /** * Convert to FullStory format. * * @param {String} trait * @param {Property} value */ function convert (trait, value) { trait = camel(trait); if (is.string(value)) return trait += '_str'; if (isInt(value)) return trait += '_int'; if (isFloat(value)) return trait += '_real'; if (is.date(value)) return trait += '_date'; if (is.boolean(value)) return trait += '_bool'; } /** * Check if n is a float. */ function isFloat(n) { return n === +n && n !== (n|0); } /** * Check if n is an integer. */ function isInt(n) { return n === +n && n === (n|0); } }, {"foldl":166,"is":91,"to-camel-case":167,"analytics.js-integration":88}], 166: [function(require, module, exports) { 'use strict'; /** * Module dependencies. */ var each = require('each'); /** * Reduces all the values in a collection down into a single value. Does so by iterating through the * collection from left to right, repeatedly calling an `iterator` function and passing to it four * arguments: `(accumulator, value, index, collection)`. * * Returns the final return value of the `iterator` function. * * @name foldl * @api public * @param {Function} iterator The function to invoke per iteration. * @param {*} accumulator The initial accumulator value, passed to the first invocation of `iterator`. * @param {Array|Object} collection The collection to iterate over. * @return {*} The return value of the final call to `iterator`. * @example * foldl(function(total, n) { * return total + n; * }, 0, [1, 2, 3]); * //=> 6 * * var phonebook = { bob: '555-111-2345', tim: '655-222-6789', sheila: '655-333-1298' }; * * foldl(function(results, phoneNumber) { * if (phoneNumber[0] === '6') { * return results.concat(phoneNumber); * } * return results; * }, [], phonebook); * // => ['655-222-6789', '655-333-1298'] */ var foldl = function foldl(iterator, accumulator, collection) { if (typeof iterator !== 'function') { throw new TypeError('Expected a function but received a ' + typeof iterator); } each(function(val, i, collection) { accumulator = iterator(accumulator, val, i, collection); }, collection); return accumulator; }; /** * Exports. */ module.exports = foldl; }, {"each":168}], 168: [function(require, module, exports) { 'use strict'; /** * Module dependencies. */ var keys = require('keys'); /** * Object.prototype.toString reference. */ var objToString = Object.prototype.toString; /** * Tests if a value is a number. * * @name isNumber * @api private * @param {*} val The value to test. * @return {boolean} Returns `true` if `val` is a number, otherwise `false`. */ // TODO: Move to library var isNumber = function isNumber(val) { var type = typeof val; return type === 'number' || (type === 'object' && objToString.call(val) === '[object Number]'); }; /** * Tests if a value is an array. * * @name isArray * @api private * @param {*} val The value to test. * @return {boolean} Returns `true` if the value is an array, otherwise `false`. */ // TODO: Move to library var isArray = typeof Array.isArray === 'function' ? Array.isArray : function isArray(val) { return objToString.call(val) === '[object Array]'; }; /** * Tests if a value is array-like. Array-like means the value is not a function and has a numeric * `.length` property. * * @name isArrayLike * @api private * @param {*} val * @return {boolean} */ // TODO: Move to library var isArrayLike = function isArrayLike(val) { return val != null && (isArray(val) || (val !== 'function' && isNumber(val.length))); }; /** * Internal implementation of `each`. Works on arrays and array-like data structures. * * @name arrayEach * @api private * @param {Function(value, key, collection)} iterator The function to invoke per iteration. * @param {Array} array The array(-like) structure to iterate over. * @return {undefined} */ var arrayEach = function arrayEach(iterator, array) { for (var i = 0; i < array.length; i += 1) { // Break iteration early if `iterator` returns `false` if (iterator(array[i], i, array) === false) { break; } } }; /** * Internal implementation of `each`. Works on objects. * * @name baseEach * @api private * @param {Function(value, key, collection)} iterator The function to invoke per iteration. * @param {Object} object The object to iterate over. * @return {undefined} */ var baseEach = function baseEach(iterator, object) { var ks = keys(object); for (var i = 0; i < ks.length; i += 1) { // Break iteration early if `iterator` returns `false` if (iterator(object[ks[i]], ks[i], object) === false) { break; } } }; /** * Iterate over an input collection, invoking an `iterator` function for each element in the * collection and passing to it three arguments: `(value, index, collection)`. The `iterator` * function can end iteration early by returning `false`. * * @name each * @api public * @param {Function(value, key, collection)} iterator The function to invoke per iteration. * @param {Array|Object|string} collection The collection to iterate over. * @return {undefined} Because `each` is run only for side effects, always returns `undefined`. * @example * var log = console.log.bind(console); * * each(log, ['a', 'b', 'c']); * //-> 'a', 0, ['a', 'b', 'c'] * //-> 'b', 1, ['a', 'b', 'c'] * //-> 'c', 2, ['a', 'b', 'c'] * //=> undefined * * each(log, 'tim'); * //-> 't', 2, 'tim' * //-> 'i', 1, 'tim' * //-> 'm', 0, 'tim' * //=> undefined * * // Note: Iteration order not guaranteed across environments * each(log, { name: 'tim', occupation: 'enchanter' }); * //-> 'tim', 'name', { name: 'tim', occupation: 'enchanter' } * //-> 'enchanter', 'occupation', { name: 'tim', occupation: 'enchanter' } * //=> undefined */ var each = function each(iterator, collection) { return (isArrayLike(collection) ? arrayEach : baseEach).call(this, iterator, collection); }; /** * Exports. */ module.exports = each; }, {"keys":169}], 169: [function(require, module, exports) { 'use strict'; /** * charAt reference. */ var strCharAt = String.prototype.charAt; /** * Returns the character at a given index. * * @param {string} str * @param {number} index * @return {string|undefined} */ // TODO: Move to a library var charAt = function(str, index) { return strCharAt.call(str, index); }; /** * hasOwnProperty reference. */ var hop = Object.prototype.hasOwnProperty; /** * Object.prototype.toString reference. */ var toStr = Object.prototype.toString; /** * hasOwnProperty, wrapped as a function. * * @name has * @api private * @param {*} context * @param {string|number} prop * @return {boolean} */ // TODO: Move to a library var has = function has(context, prop) { return hop.call(context, prop); }; /** * Returns true if a value is a string, otherwise false. * * @name isString * @api private * @param {*} val * @return {boolean} */ // TODO: Move to a library var isString = function isString(val) { return toStr.call(val) === '[object String]'; }; /** * Returns true if a value is array-like, otherwise false. Array-like means a * value is not null, undefined, or a function, and has a numeric `length` * property. * * @name isArrayLike * @api private * @param {*} val * @return {boolean} */ // TODO: Move to a library var isArrayLike = function isArrayLike(val) { return val != null && (typeof val !== 'function' && typeof val.length === 'number'); }; /** * indexKeys * * @name indexKeys * @api private * @param {} target * @param {} pred * @return {Array} */ var indexKeys = function indexKeys(target, pred) { pred = pred || has; var results = []; for (var i = 0, len = target.length; i < len; i += 1) { if (pred(target, i)) { results.push(String(i)); } } return results; }; /** * Returns an array of all the owned * * @name objectKeys * @api private * @param {*} target * @param {Function} pred Predicate function used to include/exclude values from * the resulting array. * @return {Array} */ var objectKeys = function objectKeys(target, pred) { pred = pred || has; var results = []; for (var key in target) { if (pred(target, key)) { results.push(String(key)); } } return results; }; /** * Creates an array composed of all keys on the input object. Ignores any non-enumerable properties. * More permissive than the native `Object.keys` function (non-objects will not throw errors). * * @name keys * @api public * @category Object * @param {Object} source The value to retrieve keys from. * @return {Array} An array containing all the input `source`'s keys. * @example * keys({ likes: 'avocado', hates: 'pineapple' }); * //=> ['likes', 'pineapple']; * * // Ignores non-enumerable properties * var hasHiddenKey = { name: 'Tim' }; * Object.defineProperty(hasHiddenKey, 'hidden', { * value: 'i am not enumerable!', * enumerable: false * }) * keys(hasHiddenKey); * //=> ['name']; * * // Works on arrays * keys(['a', 'b', 'c']); * //=> ['0', '1', '2'] * * // Skips unpopulated indices in sparse arrays * var arr = [1]; * arr[4] = 4; * keys(arr); * //=> ['0', '4'] */ module.exports = function keys(source) { if (source == null) { return []; } // IE6-8 compatibility (string) if (isString(source)) { return indexKeys(source, charAt); } // IE6-8 compatibility (arguments) if (isArrayLike(source)) { return indexKeys(source, has); } return objectKeys(source); }; }, {}], 167: [function(require, module, exports) { var toSpace = require('to-space-case'); /** * Expose `toCamelCase`. */ module.exports = toCamelCase; /** * Convert a `string` to camel case. * * @param {String} string * @return {String} */ function toCamelCase (string) { return toSpace(string).replace(/\s(\w)/g, function (matches, letter) { return letter.toUpperCase(); }); } }, {"to-space-case":120}], 37: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_gauges'); /** * Expose `Gauges` integration. */ var Gauges = module.exports = integration('Gauges') .assumesPageview() .global('_gauges') .option('siteId', '') .tag('<script id="gauges-tracker" src="//secure.gaug.es/track.js" data-site-id="{{ siteId }}">'); /** * Initialize Gauges. * * http://get.gaug.es/documentation/tracking/ * * @param {Object} page */ Gauges.prototype.initialize = function(page){ window._gauges = window._gauges || []; this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Gauges.prototype.loaded = function(){ return !! (window._gauges && window._gauges.push !== Array.prototype.push); }; /** * Page. * * @param {Page} page */ Gauges.prototype.page = function(page){ push('track'); }; }, {"analytics.js-integration":88,"global-queue":158}], 38: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var onBody = require('on-body'); /** * Expose `GetSatisfaction` integration. */ var GetSatisfaction = module.exports = integration('Get Satisfaction') .assumesPageview() .global('GSFN') .option('widgetId', '') .tag('<script src="https://loader.engage.gsfn.us/loader.js">'); /** * Initialize. * * https://console.getsatisfaction.com/start/101022?signup=true#engage * * @param {Object} page */ GetSatisfaction.prototype.initialize = function(page){ var self = this; var widget = this.options.widgetId; var div = document.createElement('div'); var id = div.id = 'getsat-widget-' + widget; onBody(function(body){ body.appendChild(div); }); // usually the snippet is sync, so wait for it before initializing the tab this.load(function(){ window.GSFN.loadWidget(widget, { containerId: id }); self.ready(); }); }; /** * Loaded? * * @return {Boolean} */ GetSatisfaction.prototype.loaded = function(){ return !! window.GSFN; }; }, {"analytics.js-integration":88,"on-body":129}], 39: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_gaq'); var length = require('object').length; var canonical = require('canonical'); var useHttps = require('use-https'); var Track = require('facade').Track; var callback = require('callback'); var defaults = require('defaults'); var load = require('load-script'); var keys = require('object').keys; var select = require('select'); var dot = require('obj-case'); var each = require('each'); var type = require('type'); var url = require('url'); var is = require('is'); var group; var user; /** * Expose plugin. */ module.exports = exports = function(analytics){ analytics.addIntegration(GA); group = analytics.group(); user = analytics.user(); }; /** * Expose `GA` integration. * * http://support.google.com/analytics/bin/answer.py?hl=en&answer=2558867 * https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._setSiteSpeedSampleRate */ var GA = exports.Integration = integration('Google Analytics') .readyOnLoad() .global('ga') .global('gaplugins') .global('_gaq') .global('GoogleAnalyticsObject') .option('anonymizeIp', false) .option('classic', false) .option('domain', 'auto') .option('doubleClick', false) .option('enhancedEcommerce', false) .option('enhancedLinkAttribution', false) .option('nonInteraction', false) .option('ignoredReferrers', null) .option('includeSearch', false) .option('siteSpeedSampleRate', 1) .option('trackingId', '') .option('trackNamedPages', true) .option('trackCategorizedPages', true) .option('sendUserId', false) .option('metrics', {}) .option('dimensions', {}) .tag('library', '<script src="//www.google-analytics.com/analytics.js">') .tag('double click', '<script src="//stats.g.doubleclick.net/dc.js">') .tag('http', '<script src="http://www.google-analytics.com/ga.js">') .tag('https', '<script src="https://ssl.google-analytics.com/ga.js">'); /** * On `construct` swap any config-based methods to the proper implementation. */ GA.on('construct', function(integration){ if (integration.options.classic) { integration.initialize = integration.initializeClassic; integration.loaded = integration.loadedClassic; integration.page = integration.pageClassic; integration.track = integration.trackClassic; integration.completedOrder = integration.completedOrderClassic; } else if (integration.options.enhancedEcommerce) { integration.viewedProduct = integration.viewedProductEnhanced; integration.clickedProduct = integration.clickedProductEnhanced; integration.addedProduct = integration.addedProductEnhanced; integration.removedProduct = integration.removedProductEnhanced; integration.startedOrder = integration.startedOrderEnhanced; integration.viewedCheckoutStep = integration.viewedCheckoutStepEnhanced; integration.completedCheckoutStep = integration.completedCheckoutStepEnhanced; integration.updatedOrder = integration.updatedOrderEnhanced; integration.completedOrder = integration.completedOrderEnhanced; integration.refundedOrder = integration.refundedOrderEnhanced; integration.viewedPromotion = integration.viewedPromotionEnhanced; integration.clickedPromotion = integration.clickedPromotionEnhanced; } }); /** * Initialize. * * https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced */ GA.prototype.initialize = function(){ var opts = this.options; // setup the tracker globals window.GoogleAnalyticsObject = 'ga'; window.ga = window.ga || function(){ window.ga.q = window.ga.q || []; window.ga.q.push(arguments); }; window.ga.l = new Date().getTime(); if (window.location.hostname === 'localhost') opts.domain = 'none'; window.ga('create', opts.trackingId, { cookieDomain: opts.domain || GA.prototype.defaults.domain, // to protect against empty string siteSpeedSampleRate: opts.siteSpeedSampleRate, allowLinker: true }); // display advertising if (opts.doubleClick) { window.ga('require', 'displayfeatures'); } // send global id if (opts.sendUserId && user.id()) { window.ga('set', 'userId', user.id()); } // anonymize after initializing, otherwise a warning is shown // in google analytics debugger if (opts.anonymizeIp) window.ga('set', 'anonymizeIp', true); // custom dimensions & metrics var custom = metrics(user.traits(), opts); if (length(custom)) window.ga('set', custom); this.load('library', this.ready); }; /** * Loaded? * * @return {Boolean} */ GA.prototype.loaded = function(){ return !! window.gaplugins; }; /** * Page. * * https://developers.google.com/analytics/devguides/collection/analyticsjs/pages * * @param {Page} page */ GA.prototype.page = function(page){ var category = page.category(); var props = page.properties(); var name = page.fullName(); var opts = this.options; var campaign = page.proxy('context.campaign') || {}; var pageview = {}; var track; this._category = category; // store for later pageview.page = path(props, this.options); pageview.title = name || props.title; pageview.location = props.url; if (campaign.name) pageview.campaignName = campaign.name; if (campaign.source) pageview.campaignSource = campaign.source; if (campaign.medium) pageview.campaignMedium = campaign.medium; if (campaign.content) pageview.campaignContent = campaign.content; if (campaign.term) pageview.campaignKeyword = campaign.term; // custom dimensions and metrics var custom = metrics(props, opts); if (length(custom)) window.ga('set', custom); // send window.ga('send', 'pageview', pageview); // categorized pages if (category && this.options.trackCategorizedPages) { track = page.track(category); this.track(track, { nonInteraction: 1 }); } // named pages if (name && this.options.trackNamedPages) { track = page.track(name); this.track(track, { nonInteraction: 1 }); } }; /** * Identify. * * @param {Identify} event */ GA.prototype.identify = function(identify){ var opts = this.options; //set userId if (opts.sendUserId && identify.userId()) { window.ga('set', 'userId', identify.userId()); } //set dimensions var custom = metrics(user.traits(), opts); if (length(custom)) window.ga('set', custom); }; /** * Track. * * https://developers.google.com/analytics/devguides/collection/analyticsjs/events * https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference * * @param {Track} event */ GA.prototype.track = function(track, options){ var contextOpts = track.options(this.name); var interfaceOpts = this.options; var opts = defaults(options || {}, contextOpts); opts = defaults(opts, interfaceOpts); var props = track.properties(); var campaign = track.proxy('context.campaign') || {}; // custom dimensions & metrics var custom = metrics(props, interfaceOpts); if (length(custom)) window.ga('set', custom); var payload = { eventAction: track.event(), eventCategory: props.category || this._category || 'All', eventLabel: props.label, eventValue: formatValue(props.value || track.revenue()), nonInteraction: !!(props.nonInteraction || opts.nonInteraction) }; if (campaign.name) payload.campaignName = campaign.name; if (campaign.source) payload.campaignSource = campaign.source; if (campaign.medium) payload.campaignMedium = campaign.medium; if (campaign.content) payload.campaignContent = campaign.content; if (campaign.term) payload.campaignKeyword = campaign.term; window.ga('send', 'event', payload); }; /** * Completed order. * * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#multicurrency * * @param {Track} track * @api private */ GA.prototype.completedOrder = function(track){ var total = track.total() || track.revenue() || 0; var orderId = track.orderId(); var products = track.products(); var props = track.properties(); // orderId is required. if (!orderId) return; // require ecommerce if (!this.ecommerce) { window.ga('require', 'ecommerce'); this.ecommerce = true; } // add transaction window.ga('ecommerce:addTransaction', { affiliation: props.affiliation, shipping: track.shipping(), revenue: total, tax: track.tax(), id: orderId, currency: track.currency() }); // add products each(products, function(product){ var track = new Track({ properties: product }); window.ga('ecommerce:addItem', { category: track.category(), quantity: track.quantity(), price: track.price(), name: track.name(), sku: track.sku(), id: orderId, currency: track.currency() }); }); // send window.ga('ecommerce:send'); }; /** * Initialize (classic). * * https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration */ GA.prototype.initializeClassic = function(){ var opts = this.options; var anonymize = opts.anonymizeIp; var db = opts.doubleClick; var domain = opts.domain; var enhanced = opts.enhancedLinkAttribution; var ignore = opts.ignoredReferrers; var sample = opts.siteSpeedSampleRate; window._gaq = window._gaq || []; push('_setAccount', opts.trackingId); push('_setAllowLinker', true); if (anonymize) push('_gat._anonymizeIp'); if (domain) push('_setDomainName', domain); if (sample) push('_setSiteSpeedSampleRate', sample); if (enhanced) { var protocol = 'https:' === document.location.protocol ? 'https:' : 'http:'; var pluginUrl = protocol + '//www.google-analytics.com/plugins/ga/inpage_linkid.js'; push('_require', 'inpage_linkid', pluginUrl); } if (ignore) { if (!is.array(ignore)) ignore = [ignore]; each(ignore, function(domain){ push('_addIgnoredRef', domain); }); } if (this.options.doubleClick) { this.load('double click', this.ready); } else { var name = useHttps() ? 'https' : 'http'; this.load(name, this.ready); } }; /** * Loaded? (classic) * * @return {Boolean} */ GA.prototype.loadedClassic = function(){ return !! (window._gaq && window._gaq.push !== Array.prototype.push); }; /** * Page (classic). * * https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration * * @param {Page} page */ GA.prototype.pageClassic = function(page){ var opts = page.options(this.name); var category = page.category(); var props = page.properties(); var name = page.fullName(); var track; push('_trackPageview', path(props, this.options)); // categorized pages if (category && this.options.trackCategorizedPages) { track = page.track(category); this.track(track, { nonInteraction: 1 }); } // named pages if (name && this.options.trackNamedPages) { track = page.track(name); this.track(track, { nonInteraction: 1 }); } }; /** * Track (classic). * * https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEventTracking * * @param {Track} track */ GA.prototype.trackClassic = function(track, options){ var opts = options || track.options(this.name); var props = track.properties(); var revenue = track.revenue(); var event = track.event(); var category = this._category || props.category || 'All'; var label = props.label; var value = formatValue(revenue || props.value); var nonInteraction = !!(props.nonInteraction || opts.nonInteraction); push('_trackEvent', category, event, label, value, nonInteraction); }; /** * Completed order. * * https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingEcommerce * https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingEcommerce#localcurrencies * * @param {Track} track * @api private */ GA.prototype.completedOrderClassic = function(track){ var total = track.total() || track.revenue() || 0; var orderId = track.orderId(); var products = track.products() || []; var props = track.properties(); var currency = track.currency(); // required if (!orderId) return; // add transaction push('_addTrans', orderId, props.affiliation, total, track.tax(), track.shipping(), track.city(), track.state(), track.country()); // add items each(products, function(product){ var track = new Track({ properties: product }); push('_addItem', orderId, track.sku(), track.name(), track.category(), track.price(), track.quantity()); }); // send push('_set', 'currencyCode', currency); push('_trackTrans'); }; /** * Return the path based on `properties` and `options`. * * @param {Object} properties * @param {Object} options */ function path(properties, options) { if (!properties) return; var str = properties.path; if (options.includeSearch && properties.search) str += properties.search; return str; } /** * Format the value property to Google's liking. * * @param {Number} value * @return {Number} */ function formatValue(value) { if (!value || value < 0) return 0; return Math.round(value); } /** * Map google's custom dimensions & metrics with `obj`. * * Example: * * metrics({ revenue: 1.9 }, { { metrics : { revenue: 'metric8' } }); * // => { metric8: 1.9 } * * metrics({ revenue: 1.9 }, {}); * // => {} * * @param {Object} obj * @param {Object} data * @return {Object|null} * @api private */ function metrics(obj, data){ var dimensions = data.dimensions; var metrics = data.metrics; var names = keys(metrics).concat(keys(dimensions)); var ret = {}; for (var i = 0; i < names.length; ++i) { var name = names[i]; var key = metrics[name] || dimensions[name]; var value = dot(obj, name) || obj[name]; if (null == value) continue; ret[key] = value; } return ret; } /** * Loads ec.js (unless already loaded) */ GA.prototype.loadEnhancedEcommerce = function(track){ if (!this.enhancedEcommerceLoaded) { window.ga('require', 'ec'); this.enhancedEcommerceLoaded = true; } // Ensure we set currency for every hit window.ga('set', '&cu', track.currency()); }; /** * Pushes an event and all previously set EE data to GA. */ GA.prototype.pushEnhancedEcommerce = function(track){ // Send a custom non-interaction event to ensure all EE data is pushed. // Without doing this we'd need to require page display after setting EE data. ga('send', 'event', track.category() || 'EnhancedEcommerce', track.event(), { nonInteraction: 1 }); }; /** * Started order - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#checkout-steps * * @param {Track} track */ GA.prototype.startedOrderEnhanced = function(track){ // same as viewed checkout step #1 this.viewedCheckoutStep(track); }; /** * Updated order - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#checkout-steps * * @param {Track} track */ GA.prototype.updatedOrderEnhanced = function(track){ // Same event as started order - will override this.startedOrderEnhanced(track); }; /** * Viewed checkout step - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#checkout-steps * * @param {Track} track */ GA.prototype.viewedCheckoutStepEnhanced = function(track){ var products = track.products(); var props = track.properties(); var options = extractCheckoutOptions(props); this.loadEnhancedEcommerce(track); each(products, function(product){ var trackTemp = new Track({ properties: product }); enhancedEcommerceTrackProduct(trackTemp); }); window.ga('ec:setAction','checkout', { step: props.step || 1, option: options || undefined, }); this.pushEnhancedEcommerce(track); }; /** * Completed checkout step - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#checkout-options * * @param {Track} track */ GA.prototype.completedCheckoutStepEnhanced = function(track){ var props = track.properties(); var options = extractCheckoutOptions(props); // Only send an event if we have step and options to update if (!props.step || !options) return; this.loadEnhancedEcommerce(track); window.ga('ec:setAction', 'checkout_option', { step: props.step || 1, option: options, }); window.ga('send', 'event', 'Checkout', 'Option'); }; /** * Completed order - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-transactions * * @param {Track} track */ GA.prototype.completedOrderEnhanced = function(track){ var total = track.total() || track.revenue() || 0; var orderId = track.orderId(); var products = track.products(); var props = track.properties(); // orderId is required. if (!orderId) return; this.loadEnhancedEcommerce(track); each(products, function(product){ var track = new Track({ properties: product }); enhancedEcommerceTrackProduct(track); }); window.ga('ec:setAction', 'purchase', { id: orderId, affiliation: props.affiliation, revenue: total, tax: track.tax(), shipping: track.shipping(), coupon: track.coupon(), }); this.pushEnhancedEcommerce(track); }; /** * Refunded order - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-refunds * * @param {Track} track */ GA.prototype.refundedOrderEnhanced = function(track){ var orderId = track.orderId(); var products = track.products(); // orderId is required. if (!orderId) return; this.loadEnhancedEcommerce(track); // Without any products it's a full refund each(products, function(product){ var track = new Track({ properties: product }); window.ga('ec:addProduct', { id: track.id() || track.sku(), quantity: track.quantity(), }); }); window.ga('ec:setAction', 'refund', { id: orderId, }); this.pushEnhancedEcommerce(track); }; /** * Added product - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#add-remove-cart * * @param {Track} track */ GA.prototype.addedProductEnhanced = function(track){ this.loadEnhancedEcommerce(track); enhancedEcommerceProductAction(track, 'add'); this.pushEnhancedEcommerce(track); }; /** * Removed product - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#add-remove-cart * * @param {Track} track */ GA.prototype.removedProductEnhanced = function(track){ this.loadEnhancedEcommerce(track); enhancedEcommerceProductAction(track, 'remove'); this.pushEnhancedEcommerce(track); }; /** * Viewed product details - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#product-detail-view * * @param {Track} track */ GA.prototype.viewedProductEnhanced = function(track){ this.loadEnhancedEcommerce(track); enhancedEcommerceProductAction(track, 'detail'); this.pushEnhancedEcommerce(track); }; /** * Clicked product - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-actions * * @param {Track} track */ GA.prototype.clickedProductEnhanced = function(track){ var props = track.properties(); this.loadEnhancedEcommerce(track); enhancedEcommerceProductAction(track, 'click', { list: props.list }); this.pushEnhancedEcommerce(track); }; /** * Viewed promotion - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-promo-impressions * * @param {Track} track */ GA.prototype.viewedPromotionEnhanced = function(track){ var props = track.properties(); this.loadEnhancedEcommerce(track); window.ga('ec:addPromo', { id: track.id(), name: track.name(), creative: props.creative, position: props.position, }); this.pushEnhancedEcommerce(track); }; /** * Clicked promotion - Enhanced Ecommerce * * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-promo-clicks * * @param {Track} track */ GA.prototype.clickedPromotionEnhanced = function(track){ var props = track.properties(); this.loadEnhancedEcommerce(track); window.ga('ec:addPromo', { id: track.id(), name: track.name(), creative: props.creative, position: props.position, }); ga('ec:setAction', 'promo_click', {}); this.pushEnhancedEcommerce(track); }; /** * Enhanced ecommerce track product. * * Simple helper so that we don't repeat `ec:addProduct` everywhere. * * @param {Track} track */ function enhancedEcommerceTrackProduct(track){ var props = track.properties(); window.ga('ec:addProduct', { id: track.id() || track.sku(), name: track.name(), category: track.category(), quantity: track.quantity(), price: track.price(), brand: props.brand, variant: props.variant, }); } /** * Set `action` on `track` with `data`. * * @param {Track} track * @param {String} action * @param {Object} data */ function enhancedEcommerceProductAction(track, action, data){ enhancedEcommerceTrackProduct(track); window.ga('ec:setAction', action, data || {}); } /** * Extracts checkout options. * * @param {Object} props * @return {Null|String} */ function extractCheckoutOptions(props){ var options = [ props.paymentMethod, props.shippingMethod ]; // Remove all nulls, empty strings, zeroes, and join with commas. var valid = select(options, function(e){return e; }); return valid.length > 0 ? valid.join(', ') : null; } }, {"analytics.js-integration":88,"global-queue":158,"object":170,"canonical":171,"use-https":90,"facade":132,"callback":94,"defaults":157,"load-script":128,"select":172,"obj-case":92,"each":4,"type":113,"url":173,"is":91}], 170: [function(require, module, exports) { /** * HOP ref. */ var has = Object.prototype.hasOwnProperty; /** * Return own keys in `obj`. * * @param {Object} obj * @return {Array} * @api public */ exports.keys = Object.keys || function(obj){ var keys = []; for (var key in obj) { if (has.call(obj, key)) { keys.push(key); } } return keys; }; /** * Return own values in `obj`. * * @param {Object} obj * @return {Array} * @api public */ exports.values = function(obj){ var vals = []; for (var key in obj) { if (has.call(obj, key)) { vals.push(obj[key]); } } return vals; }; /** * Merge `b` into `a`. * * @param {Object} a * @param {Object} b * @return {Object} a * @api public */ exports.merge = function(a, b){ for (var key in b) { if (has.call(b, key)) { a[key] = b[key]; } } return a; }; /** * Return length of `obj`. * * @param {Object} obj * @return {Number} * @api public */ exports.length = function(obj){ return exports.keys(obj).length; }; /** * Check if `obj` is empty. * * @param {Object} obj * @return {Boolean} * @api public */ exports.isEmpty = function(obj){ return 0 == exports.length(obj); }; }, {}], 171: [function(require, module, exports) { module.exports = function canonical () { var tags = document.getElementsByTagName('link'); for (var i = 0, tag; tag = tags[i]; i++) { if ('canonical' == tag.getAttribute('rel')) return tag.getAttribute('href'); } }; }, {}], 172: [function(require, module, exports) { /** * Module dependencies. */ var toFunction = require('to-function'); /** * Filter the given `arr` with callback `fn(val, i)`, * when a truthy value is return then `val` is included * in the array returned. * * @param {Array} arr * @param {Function} fn * @return {Array} * @api public */ module.exports = function(arr, fn){ var ret = []; fn = toFunction(fn); for (var i = 0; i < arr.length; ++i) { if (fn(arr[i], i)) { ret.push(arr[i]); } } return ret; }; }, {"to-function":174}], 174: [function(require, module, exports) { /** * Module Dependencies */ var expr; try { expr = require('props'); } catch(e) { expr = require('component-props'); } /** * Expose `toFunction()`. */ module.exports = toFunction; /** * Convert `obj` to a `Function`. * * @param {Mixed} obj * @return {Function} * @api private */ function toFunction(obj) { switch ({}.toString.call(obj)) { case '[object Object]': return objectToFunction(obj); case '[object Function]': return obj; case '[object String]': return stringToFunction(obj); case '[object RegExp]': return regexpToFunction(obj); default: return defaultToFunction(obj); } } /** * Default to strict equality. * * @param {Mixed} val * @return {Function} * @api private */ function defaultToFunction(val) { return function(obj){ return val === obj; }; } /** * Convert `re` to a function. * * @param {RegExp} re * @return {Function} * @api private */ function regexpToFunction(re) { return function(obj){ return re.test(obj); }; } /** * Convert property `str` to a function. * * @param {String} str * @return {Function} * @api private */ function stringToFunction(str) { // immediate such as "> 20" if (/^ *\W+/.test(str)) return new Function('_', 'return _ ' + str); // properties such as "name.first" or "age > 18" or "age > 18 && age < 36" return new Function('_', 'return ' + get(str)); } /** * Convert `object` to a function. * * @param {Object} object * @return {Function} * @api private */ function objectToFunction(obj) { var match = {}; for (var key in obj) { match[key] = typeof obj[key] === 'string' ? defaultToFunction(obj[key]) : toFunction(obj[key]); } return function(val){ if (typeof val !== 'object') return false; for (var key in match) { if (!(key in val)) return false; if (!match[key](val[key])) return false; } return true; }; } /** * Built the getter function. Supports getter style functions * * @param {String} str * @return {String} * @api private */ function get(str) { var props = expr(str); if (!props.length) return '_.' + str; var val, i, prop; for (i = 0; i < props.length; i++) { prop = props[i]; val = '_.' + prop; val = "('function' == typeof " + val + " ? " + val + "() : " + val + ")"; // mimic negative lookbehind to avoid problems with nested properties str = stripNested(prop, str, val); } return str; } /** * Mimic negative lookbehind to avoid problems with nested properties. * * See: http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript * * @param {String} prop * @param {String} str * @param {String} val * @return {String} * @api private */ function stripNested (prop, str, val) { return str.replace(new RegExp('(\\.)?' + prop, 'g'), function($0, $1) { return $1 ? $0 : val; }); } }, {"props":118,"component-props":118}], 173: [function(require, module, exports) { /** * Parse the given `url`. * * @param {String} str * @return {Object} * @api public */ exports.parse = function(url){ var a = document.createElement('a'); a.href = url; return { href: a.href, host: a.host, port: a.port, hash: a.hash, hostname: a.hostname, pathname: a.pathname, protocol: a.protocol, search: a.search, query: a.search.slice(1) } }; /** * Check if `url` is absolute. * * @param {String} url * @return {Boolean} * @api public */ exports.isAbsolute = function(url){ if (0 == url.indexOf('//')) return true; if (~url.indexOf('://')) return true; return false; }; /** * Check if `url` is relative. * * @param {String} url * @return {Boolean} * @api public */ exports.isRelative = function(url){ return ! exports.isAbsolute(url); }; /** * Check if `url` is cross domain. * * @param {String} url * @return {Boolean} * @api public */ exports.isCrossDomain = function(url){ url = exports.parse(url); return url.hostname != location.hostname || url.port != location.port || url.protocol != location.protocol; }; }, {}], 40: [function(require, module, exports) { /** * Module dependencies. */ var push = require('global-queue')('dataLayer', { wrap: false }); var integration = require('analytics.js-integration'); /** * Expose `GTM`. */ var GTM = module.exports = integration('Google Tag Manager') .assumesPageview() .global('dataLayer') .global('google_tag_manager') .option('containerId', '') .option('trackNamedPages', true) .option('trackCategorizedPages', true) .tag('<script src="//www.googletagmanager.com/gtm.js?id={{ containerId }}&l=dataLayer">'); /** * Initialize. * * https://developers.google.com/tag-manager * * @param {Object} page */ GTM.prototype.initialize = function(){ push({ 'gtm.start': +new Date, event: 'gtm.js' }); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ GTM.prototype.loaded = function(){ return !! (window.dataLayer && [].push != window.dataLayer.push); }; /** * Page. * * @param {Page} page * @api public */ GTM.prototype.page = function(page){ var category = page.category(); var props = page.properties(); var name = page.fullName(); var opts = this.options; var track; // all if (opts.trackAllPages) { this.track(page.track()); } // categorized if (category && opts.trackCategorizedPages) { this.track(page.track(category)); } // named if (name && opts.trackNamedPages) { this.track(page.track(name)); } }; /** * Track. * * https://developers.google.com/tag-manager/devguide#events * * @param {Track} track * @api public */ GTM.prototype.track = function(track){ var props = track.properties(); props.event = track.event(); push(props); }; }, {"global-queue":158,"analytics.js-integration":88}], 41: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var Identify = require('facade').Identify; var Track = require('facade').Track; var callback = require('callback'); var load = require('load-script'); var onBody = require('on-body'); var each = require('each'); var is = require('is'); var pick = require('pick'); var omit = require('omit'); /** * Expose `GoSquared` integration. */ var GoSquared = module.exports = integration('GoSquared') .assumesPageview() .global('_gs') .option('siteToken', '') .option('anonymizeIP', false) .option('cookieDomain', null) .option('useCookies', true) .option('trackHash', false) .option('trackLocal', false) .option('trackParams', true) .tag('<script src="//d1l6p2sc9645hc.cloudfront.net/tracker.js">'); /** * Initialize. * * https://www.gosquared.com/developer/tracker * Options: https://www.gosquared.com/developer/tracker/configuration * * @param {Object} page */ GoSquared.prototype.initialize = function(page){ var self = this; var options = this.options; var user = this.analytics.user(); push(options.siteToken); each(options, function(name, value){ if ('siteToken' == name) return; if (null == value) return; push('set', name, value); }); self.identify(new Identify({ traits: user.traits(), userId: user.id() })); self.load(this.ready); }; /** * Loaded? (checks if the tracker version is set) * * @return {Boolean} */ GoSquared.prototype.loaded = function(){ return !! (window._gs && window._gs.v); }; /** * Page. * * https://www.gosquared.com/docs/tracking/api/#pageviews * * @param {Page} page */ GoSquared.prototype.page = function(page){ var props = page.properties(); var name = page.fullName(); push('track', props.path, name || props.title) }; /** * Identify. * * https://www.gosquared.com/docs/tracking/identify * * @param {Identify} identify */ GoSquared.prototype.identify = function(identify){ var traits = identify.traits({ createdAt: 'created_at', firstName: 'first_name', lastName: 'last_name', title: 'company_position', industry: 'company_industry' }); // https://www.gosquared.com/docs/tracking/api/#properties var specialKeys = [ 'id', 'email', 'name', 'first_name', 'last_name', 'username', 'description', 'avatar', 'phone', 'created_at', 'company_name', 'company_size', 'company_position', 'company_industry' ]; // Segment allows traits to all be in a flat object // GoSquared requires all custom properties to be in a `custom` object, // select all special keys var props = pick.apply(null, [traits].concat(specialKeys)); props.custom = omit(specialKeys, traits); var id = identify.userId(); if (id) { push('identify', id, props); } else { push('properties', props); } var email = identify.email(); var username = identify.username(); var name = email || username || id; if (name) push('set', 'visitorName', name); }; /** * Track. * * https://www.gosquared.com/docs/tracking/events * * @param {Track} track */ GoSquared.prototype.track = function(track){ push('event', track.event(), track.properties()); }; /** * Checked out. * * https://www.gosquared.com/docs/tracking/ecommerce * * @param {Track} track * @api private */ GoSquared.prototype.completedOrder = function(track){ var products = track.products(); var items = []; each(products, function(product){ var track = new Track({ properties: product }); items.push({ category: track.category(), quantity: track.quantity(), price: track.price(), name: track.name(), }); }) push('transaction', track.orderId(), { revenue: track.total(), track: true }, items); }; /** * Push to `_gs.q`. * * @param {...} args * @api private */ function push(){ var _gs = window._gs = window._gs || function(){ (_gs.q = _gs.q || []).push(arguments); }; _gs.apply(null, arguments); } }, {"analytics.js-integration":88,"facade":132,"callback":94,"load-script":128,"on-body":129,"each":4,"is":91,"pick":175,"omit":176}], 175: [function(require, module, exports) { /** * Expose `pick`. */ module.exports = pick; /** * Pick keys from an `obj`. * * @param {Object} obj * @param {Strings} keys... * @return {Object} */ function pick(obj){ var keys = [].slice.call(arguments, 1); var ret = {}; for (var i = 0, key; key = keys[i]; i++) { if (key in obj) ret[key] = obj[key]; } return ret; } }, {}], 176: [function(require, module, exports) { /** * Expose `omit`. */ module.exports = omit; /** * Return a copy of the object without the specified keys. * * @param {Array} keys * @param {Object} object * @return {Object} */ function omit(keys, object){ var ret = {}; for (var item in object) { ret[item] = object[item]; } for (var i = 0; i < keys.length; i++) { delete ret[keys[i]]; } return ret; } }, {}], 42: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var alias = require('alias'); /** * Expose `Heap` integration. */ var Heap = module.exports = integration('Heap') .global('heap') .option('appId', '') .tag('<script src="//cdn.heapanalytics.com/js/heap-{{ appId }}.js">'); /** * Initialize. * * https://heapanalytics.com/docs/installation#web * * @param {Object} page */ Heap.prototype.initialize = function(page){ window.heap = window.heap || []; window.heap.load = function(appid, config){ window.heap.appid = appid; window.heap.config = config; var methodFactory = function(type){ return function(){ heap.push([type].concat(Array.prototype.slice.call(arguments, 0))); }; }; var methods = ['clearEventProperties', 'identify', 'setEventProperties', 'track', 'unsetEventProperty']; for (var i = 0; i < methods.length; i++) { heap[methods[i]] = methodFactory(methods[i]); } }; window.heap.load(this.options.appId); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Heap.prototype.loaded = function(){ return (window.heap && window.heap.appid); }; /** * Identify. * * https://heapanalytics.com/docs#identify * * @param {Identify} identify */ Heap.prototype.identify = function(identify){ var traits = identify.traits({ email: '_email' }); var id = identify.userId(); if (id) traits.handle = id; window.heap.identify(traits); }; /** * Track. * * https://heapanalytics.com/docs#track * * @param {Track} track */ Heap.prototype.track = function(track){ window.heap.track(track.event(), track.properties()); }; }, {"analytics.js-integration":88,"alias":162}], 43: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); /** * Expose `hellobar.com` integration. */ var Hellobar = module.exports = integration('Hello Bar') .assumesPageview() .global('_hbq') .option('apiKey', '') .tag('<script src="//s3.amazonaws.com/scripts.hellobar.com/{{ apiKey }}.js">'); /** * Initialize. * * https://s3.amazonaws.com/scripts.hellobar.com/bb900665a3090a79ee1db98c3af21ea174bbc09f.js * * @param {Object} page */ Hellobar.prototype.initialize = function(page){ window._hbq = window._hbq || []; this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Hellobar.prototype.loaded = function(){ return !! (window._hbq && window._hbq.push !== Array.prototype.push); }; }, {"analytics.js-integration":88}], 44: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var is = require('is'); /** * Expose `HitTail` integration. */ var HitTail = module.exports = integration('HitTail') .assumesPageview() .global('htk') .option('siteId', '') .tag('<script src="//{{ siteId }}.hittail.com/mlt.js">'); /** * Initialize. * * @param {Object} page */ HitTail.prototype.initialize = function(page){ this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ HitTail.prototype.loaded = function(){ return is.fn(window.htk); }; }, {"analytics.js-integration":88,"is":91}], 45: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_hsq'); var convert = require('convert-dates'); /** * Expose `HubSpot` integration. */ var HubSpot = module.exports = integration('HubSpot') .assumesPageview() .global('_hsq') .option('portalId', null) .tag('<script id="hs-analytics" src="https://js.hs-analytics.net/analytics/{{ cache }}/{{ portalId }}.js">'); /** * Initialize. * * @param {Object} page */ HubSpot.prototype.initialize = function(page){ window._hsq = []; var cache = Math.ceil(new Date() / 300000) * 300000; this.load({ cache: cache }, this.ready); }; /** * Loaded? * * @return {Boolean} */ HubSpot.prototype.loaded = function(){ return !! (window._hsq && window._hsq.push !== Array.prototype.push); }; /** * Page. * * @param {String} category (optional) * @param {String} name (optional) * @param {Object} properties (optional) * @param {Object} options (optional) */ HubSpot.prototype.page = function(page){ push('_trackPageview'); }; /** * Identify. * * @param {Identify} identify */ HubSpot.prototype.identify = function(identify){ if (!identify.email()) return; var traits = identify.traits(); traits = convertDates(traits); push('identify', traits); }; /** * Track. * * @param {Track} track */ HubSpot.prototype.track = function(track){ var props = track.properties(); props = convertDates(props); push('trackEvent', track.event(), props); }; /** * Convert all the dates in the HubSpot properties to millisecond times * * @param {Object} properties */ function convertDates(properties){ return convert(properties, function(date){ return date.getTime(); }); } }, {"analytics.js-integration":88,"global-queue":158,"convert-dates":163}], 46: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var alias = require('alias'); /** * Expose `Improvely` integration. */ var Improvely = module.exports = integration('Improvely') .assumesPageview() .global('_improvely') .global('improvely') .option('domain', '') .option('projectId', null) .tag('<script src="//{{ domain }}.iljmp.com/improvely.js">'); /** * Initialize. * * http://www.improvely.com/docs/landing-page-code * * @param {Object} page */ Improvely.prototype.initialize = function(page){ window._improvely = []; window.improvely = { init: function(e, t){ window._improvely.push(["init", e, t]); }, goal: function(e){ window._improvely.push(["goal", e]); }, label: function(e){ window._improvely.push(["label", e]); }}; var domain = this.options.domain; var id = this.options.projectId; window.improvely.init(domain, id); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Improvely.prototype.loaded = function(){ return !! (window.improvely && window.improvely.identify); }; /** * Identify. * * http://www.improvely.com/docs/labeling-visitors * * @param {Identify} identify */ Improvely.prototype.identify = function(identify){ var id = identify.userId(); if (id) window.improvely.label(id); }; /** * Track. * * http://www.improvely.com/docs/conversion-code * * @param {Track} track */ Improvely.prototype.track = function(track){ var props = track.properties({ revenue: 'amount' }); props.type = track.event(); window.improvely.goal(props); }; }, {"analytics.js-integration":88,"alias":162}], 47: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_iva'); var Track = require('facade').Track; var each = require('each'); var is = require('is'); /** * HOP. */ var has = Object.prototype.hasOwnProperty; /** * Expose `InsideVault` integration. */ var InsideVault = module.exports = integration('InsideVault') .global('_iva') .option('clientId', '') .option('domain', '') .tag('<script src="//analytics.staticiv.com/iva.js">') .mapping('events'); /** * Initialize. * * @param page */ InsideVault.prototype.initialize = function(page){ var domain = this.options.domain; window._iva = window._iva || []; push('setClientId', this.options.clientId); var userId = this.analytics.user().id(); if (userId) push('setUserId', userId); if (domain) push('setDomain', domain); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ InsideVault.prototype.loaded = function(){ return !! (window._iva && window._iva.push !== Array.prototype.push); }; /** * Identify. * * @param {Identify} identify */ InsideVault.prototype.identify = function(identify){ push('setUserId', identify.userId()); }; /** * Page. * * @param {Page} page */ InsideVault.prototype.page = function(page){ // they want every landing page to send a "click" event. push('trackEvent', 'click'); }; /** * Track. * * Tracks everything except 'sale' events. * * @param {Track} track */ InsideVault.prototype.track = function(track){ var user = this.analytics.user(); var events = this.events(track.event()); var value = track.revenue() || track.value() || 0; var eventId = track.orderId() || user.id() || ''; each(events, function(event){ // 'sale' is a special event that will be routed to a table that is deprecated on InsideVault's end. // They don't want a generic 'sale' event to go to their deprecated table. if (event != 'sale') { push('trackEvent', event, value, eventId); } }); }; }, {"analytics.js-integration":88,"global-queue":158,"facade":132,"each":4,"is":91}], 48: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('__insp'); var alias = require('alias'); var clone = require('clone'); /** * Expose `Inspectlet` integration. */ var Inspectlet = module.exports = integration('Inspectlet') .assumesPageview() .global('__insp') .global('__insp_') .option('wid', '') .tag('<script src="//cdn.inspectlet.com/inspectlet.js">'); /** * Initialize. * * https://www.inspectlet.com/dashboard/embedcode/1492461759/initial * * @param {Object} page */ Inspectlet.prototype.initialize = function(page){ push('wid', this.options.wid); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Inspectlet.prototype.loaded = function(){ return !! (window.__insp_ && window.__insp); }; /** * Identify. * * http://www.inspectlet.com/docs#tagging * * @param {Identify} identify */ Inspectlet.prototype.identify = function(identify){ var traits = identify.traits({ id: 'userid' }); push('tagSession', traits); }; /** * Track. * * http://www.inspectlet.com/docs/tags * * @param {Track} track */ Inspectlet.prototype.track = function(track){ push('tagSession', track.event()); }; /** * Page. * * http://www.inspectlet.com/docs/tags * * @param {Track} track */ Inspectlet.prototype.page = function(){ push('virtualPage'); }; }, {"analytics.js-integration":88,"global-queue":158,"alias":162,"clone":95}], 49: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var convertDates = require('convert-dates'); var defaults = require('defaults'); var del = require('obj-case').del; var isEmail = require('is-email'); var load = require('load-script'); var empty = require('is-empty'); var alias = require('alias'); var each = require('each'); var when = require('when'); var is = require('is'); /** * Expose `Intercom` integration. */ var Intercom = module.exports = integration('Intercom') .assumesPageview() .global('Intercom') .option('activator', '#IntercomDefaultWidget') .option('appId', '') .option('inbox', false) .tag('<script src="https://static.intercomcdn.com/intercom.v1.js">'); /** * Initialize. * * http://docs.intercom.io/ * http://docs.intercom.io/#IntercomJS * * @param {Object} page */ Intercom.prototype.initialize = function(page){ var self = this; this.load(function(){ when(function(){ return self.loaded(); }, self.ready); }); }; /** * Loaded? * * @return {Boolean} */ Intercom.prototype.loaded = function(){ return is.fn(window.Intercom); }; /** * Page. * * @param {Page} page */ Intercom.prototype.page = function(page){ window.Intercom('update'); }; /** * Identify. * * http://docs.intercom.io/#IntercomJS * * @param {Identify} identify */ Intercom.prototype.identify = function(identify){ var traits = identify.traits({ userId: 'user_id' }); var activator = this.options.activator; var opts = identify.options(this.name); var companyCreated = identify.companyCreated(); var created = identify.created(); var email = identify.email(); var name = identify.name(); var id = identify.userId(); var group = this.analytics.group(); if (!id && !traits.email) return; // one is required traits.app_id = this.options.appId; // intercom requires `company` to be an object. default it with group traits // so that we guarantee an `id` is there, since they require it if (null != traits.company && !is.object(traits.company)) delete traits.company; if (traits.company) defaults(traits.company, group.traits()); // name if (name) traits.name = name; // handle dates if (created) { del(traits, 'created'); del(traits, 'createdAt'); traits.created_at = created; } if (companyCreated) { del(traits.company, 'created'); del(traits.company, 'createdAt'); traits.company.created_at = companyCreated; } // convert dates traits = convertDates(traits, formatDate); // handle options if (opts.increments) traits.increments = opts.increments; if (opts.userHash) traits.user_hash = opts.userHash; if (opts.user_hash) traits.user_hash = opts.user_hash; // Intercom, will force the widget to appear // if the selector is #IntercomDefaultWidget // so no need to check inbox, just need to check // that the selector isn't #IntercomDefaultWidget. if ('#IntercomDefaultWidget' != activator) { traits.widget = { activator: activator }; } var method = this._id !== id ? 'boot': 'update'; this._id = id; // cache for next time window.Intercom(method, traits); }; /** * Group. * * @param {Group} group */ Intercom.prototype.group = function(group){ var props = group.properties(); props = alias(props, { createdAt: 'created' }); props = alias(props, { created: 'created_at' }); var id = group.groupId(); if (id) props.id = id; window.Intercom('update', { company: props }); }; /** * Track. * * @param {Track} track */ Intercom.prototype.track = function(track){ window.Intercom('trackEvent', track.event(), track.properties()); }; /** * Format a date to Intercom's liking. * * @param {Date} date * @return {Number} */ function formatDate(date) { return Math.floor(date / 1000); } }, {"analytics.js-integration":88,"convert-dates":163,"defaults":157,"obj-case":92,"is-email":154,"load-script":128,"is-empty":122,"alias":162,"each":4,"when":131,"is":91}], 50: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var clone = require('clone'); /** * Expose `Keen IO` integration. */ var Keen = module.exports = integration('Keen IO') .global('Keen') .option('projectId', '') .option('readKey', '') .option('writeKey', '') .option('ipAddon', false) .option('uaAddon', false) .option('urlAddon', false) .option('referrerAddon', false) .option('trackNamedPages', true) .option('trackAllPages', false) .option('trackCategorizedPages', true) .tag('<script src="//d26b395fwzu5fz.cloudfront.net/3.0.7/{{ lib }}.min.js">'); /** * Initialize. * * https://keen.io/docs/ */ Keen.prototype.initialize = function(){ var options = this.options; !(function(a,b){ if (void 0===b[a]){ b["_"+a]={}, b[a]=function(c){ b["_"+a].clients=b["_"+a].clients||{}, b["_"+a].clients[c.projectId]=this, this._config=c }, b[a].ready=function(c){ b["_"+a].ready=b["_"+a].ready||[],b["_"+a].ready.push(c) }; for (var c=["addEvent","setGlobalProperties","trackExternalLink","on"],d=0;d<c.length;d++){ var e=c[d], f=function(a){ return function(){ return this["_"+a]=this["_"+a]||[],this["_"+a].push(arguments),this } }; b[a].prototype[e]=f(e) } } })("Keen",window); this.client = new window.Keen({ projectId: options.projectId, writeKey: options.writeKey, readKey: options.readKey }); // if you have a read-key, then load the full keen library var lib = this.options.readKey ? 'keen' : 'keen-tracker'; this.load({ lib: lib }, this.ready); }; /** * Loaded? * * @return {Boolean} */ Keen.prototype.loaded = function(){ return !!(window.Keen && window.Keen.prototype.configure); }; /** * Page. * * @param {Page} page */ Keen.prototype.page = function(page){ var category = page.category(); var props = page.properties(); var name = page.fullName(); var opts = this.options; // all pages if (opts.trackAllPages) { this.track(page.track()); } // named pages if (name && opts.trackNamedPages) { this.track(page.track(name)); } // categorized pages if (category && opts.trackCategorizedPages) { this.track(page.track(category)); } }; /** * Identify. * * TODO: migrate from old `userId` to simpler `id` * https://keen.io/docs/data-collection/data-enrichment/#add-ons * * Set up the Keen addons object. These must be specifically * enabled by the settings in order to include the plugins, or else * Keen will reject the request. * * @param {Identify} identify */ Keen.prototype.identify = function(identify){ var traits = identify.traits(); var id = identify.userId(); var user = {}; if (id) user.userId = id; if (traits) user.traits = traits; var props = { user: user }; this.addons(props, identify); this.client.setGlobalProperties(function(){ return clone(props); }); }; /** * Track. * * @param {Track} track */ Keen.prototype.track = function(track){ var props = track.properties(); this.addons(props, track); this.client.addEvent(track.event(), props); }; /** * Attach addons to `obj` with `msg`. * * @param {Object} obj * @param {Facade} msg */ Keen.prototype.addons = function(obj, msg){ var options = this.options; var addons = []; if (options.ipAddon) { addons.push({ name: 'keen:ip_to_geo', input: { ip: 'ip_address' }, output: 'ip_geo_info' }); obj.ip_address = '${keen.ip}'; } if (options.uaAddon) { addons.push({ name: 'keen:ua_parser', input: { ua_string: 'user_agent' }, output: 'parsed_user_agent' }); obj.user_agent = '${keen.user_agent}'; } if (options.urlAddon) { addons.push({ name: 'keen:url_parser', input: { url: 'page_url' }, output: 'parsed_page_url' }); obj.page_url = document.location.href; } if (options.referrerAddon) { addons.push({ name: 'keen:referrer_parser', input: { referrer_url: 'referrer_url', page_url: 'page_url' }, output: 'referrer_info' }); obj.referrer_url = document.referrer; obj.page_url = document.location.href; } obj.keen = { timestamp: msg.timestamp(), addons: addons }; }; }, {"analytics.js-integration":88,"clone":95}], 51: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var indexof = require('indexof'); var is = require('is'); /** * Expose `Kenshoo` integration. */ var Kenshoo = module.exports = integration('Kenshoo') .global('k_trackevent') .option('cid', '') .option('subdomain', '') .option('events', []) .tag('<script src="//{{ subdomain }}.xg4ken.com/media/getpx.php?cid={{ cid }}">'); /** * Initialize. * * See https://gist.github.com/justinboyle/7875832 * * @param {Object} page */ Kenshoo.prototype.initialize = function(page){ this.load(this.ready); }; /** * Loaded? (checks if the tracking function is set) * * @return {Boolean} */ Kenshoo.prototype.loaded = function(){ return is.fn(window.k_trackevent); }; /** * Track. * * Only tracks events if they are listed in the events array option. * We've asked for docs a few times but no go :/ * * https://github.com/jorgegorka/the_tracker/blob/master/lib/the_tracker/trackers/kenshoo.rb * * @param {Track} event */ Kenshoo.prototype.track = function(track){ var events = this.options.events; var traits = track.traits(); var event = track.event(); var revenue = track.revenue() || 0; if (!~indexof(events, event)) return; var params = [ 'id=' + this.options.cid, 'type=conv', 'val=' + revenue, 'orderId=' + track.orderId(), 'promoCode=' + track.coupon(), 'valueCurrency=' + track.currency(), // Live tracking fields. Ignored for now (until we get documentation). 'GCID=', 'kw=', 'product=' ]; window.k_trackevent(params, this.options.subdomain); }; }, {"analytics.js-integration":88,"indexof":116,"is":91}], 52: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_kmq'); var Track = require('facade').Track; var alias = require('alias'); var each = require('each'); var is = require('is'); /** * Expose `KISSmetrics` integration. */ var KISSmetrics = module.exports = integration('KISSmetrics') .assumesPageview() .global('_kmq') .global('KM') .global('_kmil') .option('apiKey', '') .option('trackNamedPages', true) .option('trackCategorizedPages', true) .option('prefixProperties', true) .tag('library', '<script src="//scripts.kissmetrics.com/{{ apiKey }}.2.js">'); /** * Check if browser is mobile, for kissmetrics. * * http://support.kissmetrics.com/how-tos/browser-detection.html#mobile-vs-non-mobile */ exports.isMobile = navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/iPhone|iPod/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/Opera Mini/i) || navigator.userAgent.match(/IEMobile/i); /** * Initialize. * * http://support.kissmetrics.com/apis/javascript * * @param {Object} page */ KISSmetrics.prototype.initialize = function(page){ var self = this; window._kmq = []; if (exports.isMobile) push('set', { 'Mobile Session': 'Yes' }); this.load('library', function(){ self.trackPage(page); self.ready(); }); }; /** * Loaded? * * @return {Boolean} */ KISSmetrics.prototype.loaded = function(){ return is.object(window.KM); }; /** * Page. * * @param {Page} page */ KISSmetrics.prototype.page = function(page){ if (!window.KM_SKIP_PAGE_VIEW) window.KM.pageView(); this.trackPage(page); }; /** * Track page. * * @param {Page} page */ KISSmetrics.prototype.trackPage = function(page){ var category = page.category(); var name = page.fullName(); var opts = this.options; // named pages if (name && opts.trackNamedPages) { this.track(page.track(name)); } // categorized pages if (category && opts.trackCategorizedPages) { this.track(page.track(category)); } }; /** * Identify. * * @param {Identify} identify */ KISSmetrics.prototype.identify = function(identify){ var traits = identify.traits(); var id = identify.userId(); if (id) push('identify', id); if (traits) push('set', traits); }; /** * Track. * * @param {Track} track */ KISSmetrics.prototype.track = function(track){ var mapping = { revenue: 'Billing Amount' }; var event = track.event(); var properties = track.properties(mapping); if (this.options.prefixProperties) properties = prefix(event, properties); push('record', event, properties); }; /** * Alias. * * @param {Alias} to */ KISSmetrics.prototype.alias = function(alias){ push('alias', alias.to(), alias.from()); }; /** * Completed order. * * @param {Track} track * @api private */ KISSmetrics.prototype.completedOrder = function(track){ var products = track.products(); var event = track.event(); // transaction push('record', event, prefix(event, track.properties())); // items window._kmq.push(function(){ var km = window.KM; each(products, function(product, i){ var item = prefix(event, product); item._t = km.ts() + i; item._d = 1; km.set(item); }); }); }; /** * Prefix properties with the event name. * * @param {String} event * @param {Object} properties * @return {Object} prefixed * @api private */ function prefix(event, properties){ var prefixed = {}; each(properties, function(key, val){ if (key === 'Billing Amount') { prefixed[key] = val; } else { prefixed[event + ' - ' + key] = val; } }); return prefixed; } }, {"analytics.js-integration":88,"global-queue":158,"facade":132,"alias":162,"each":4,"is":91}], 53: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_learnq'); var tick = require('next-tick'); var alias = require('alias'); /** * Trait aliases. */ var aliases = { id: '$id', email: '$email', firstName: '$first_name', lastName: '$last_name', phone: '$phone_number', title: '$title' }; /** * Expose `Klaviyo` integration. */ var Klaviyo = module.exports = integration('Klaviyo') .assumesPageview() .global('_learnq') .option('apiKey', '') .tag('<script src="//a.klaviyo.com/media/js/learnmarklet.js">'); /** * Initialize. * * https://www.klaviyo.com/docs/getting-started * * @param {Object} page */ Klaviyo.prototype.initialize = function(page){ var self = this; push('account', this.options.apiKey); this.load(function(){ tick(self.ready); }); }; /** * Loaded? * * @return {Boolean} */ Klaviyo.prototype.loaded = function(){ return !! (window._learnq && window._learnq.push !== Array.prototype.push); }; /** * Identify. * * @param {Identify} identify */ Klaviyo.prototype.identify = function(identify){ var traits = identify.traits(aliases); if (!traits.$id && !traits.$email) return; push('identify', traits); }; /** * Group. * * @param {Group} group */ Klaviyo.prototype.group = function(group){ var props = group.properties(); if (!props.name) return; push('identify', { $organization: props.name }); }; /** * Track. * * @param {Track} track */ Klaviyo.prototype.track = function(track){ push('track', track.event(), track.properties({ revenue: '$value' })); }; }, {"analytics.js-integration":88,"global-queue":158,"next-tick":103,"alias":162}], 54: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var clone = require('clone'); var each = require('each'); var Identify = require('facade').Identify; var when = require('when'); /** * Expose `LiveChat` integration. */ var LiveChat = module.exports = integration('LiveChat') .assumesPageview() .global('__lc') .global('__lc_inited') .global('LC_API') .global('LC_Invite') .option('group', 0) .option('license', '') .tag('<script src="//cdn.livechatinc.com/tracking.js">'); /** * Initialize. * * http://www.livechatinc.com/api/javascript-api * * @param {Object} page */ LiveChat.prototype.initialize = function(page){ var self = this; var user = this.analytics.user(); var identify = new Identify({ userId: user.id(), traits: user.traits() }); window.__lc = clone(this.options); window.__lc.visitor = { name: identify.name(), email: identify.email() }; this.load(function(){ when(function(){ return self.loaded(); }, self.ready); }); }; /** * Loaded? * * @return {Boolean} */ LiveChat.prototype.loaded = function(){ return !!(window.LC_API && window.LC_Invite); }; /** * Identify. * * @param {Identify} identify */ LiveChat.prototype.identify = function(identify){ var traits = identify.traits({ userId: 'User ID' }); window.LC_API.set_custom_variables(convert(traits)); }; /** * Convert a traits object into the format LiveChat requires. * * @param {Object} traits * @return {Array} */ function convert(traits){ var arr = []; each(traits, function(key, value){ arr.push({ name: key, value: value }); }); return arr; } }, {"analytics.js-integration":88,"clone":95,"each":4,"facade":132,"when":131}], 55: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var Identify = require('facade').Identify; var useHttps = require('use-https'); /** * Expose `LuckyOrange` integration. */ var LuckyOrange = module.exports = integration('Lucky Orange') .assumesPageview() .global('_loq') .global('__wtw_watcher_added') .global('__wtw_lucky_site_id') .global('__wtw_lucky_is_segment_io') .global('__wtw_custom_user_data') .option('siteId', null) .tag('http', '<script src="http://www.luckyorange.com/w.js?{{ cache }}">') .tag('https', '<script src="https://ssl.luckyorange.com/w.js?{{ cache }}">'); /** * Initialize. * * @param {Object} page */ LuckyOrange.prototype.initialize = function(page){ var user = this.analytics.user(); window._loq || (window._loq = []); window.__wtw_lucky_site_id = this.options.siteId; this.identify(new Identify({ traits: user.traits(), userId: user.id() })); var cache = Math.floor(new Date().getTime() / 60000); var name = useHttps() ? 'https' : 'http'; this.load(name, { cache: cache }, this.ready); }; /** * Loaded? * * @return {Boolean} */ LuckyOrange.prototype.loaded = function(){ return !! window.__wtw_watcher_added; }; /** * Identify. * * @param {Identify} identify */ LuckyOrange.prototype.identify = function(identify){ var traits = identify.traits(); var email = identify.email(); var name = identify.name(); if (name) traits.name = name; if (email) traits.email = email; window.__wtw_custom_user_data = traits; }; }, {"analytics.js-integration":88,"facade":132,"use-https":90}], 56: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var alias = require('alias'); /** * Expose `Lytics` integration. */ var Lytics = module.exports = integration('Lytics') .global('jstag') .option('cid', '') .option('cookie', 'seerid') .option('delay', 2000) .option('sessionTimeout', 1800) .option('url', '//c.lytics.io') .tag('<script src="//c.lytics.io/static/io.min.js">'); /** * Options aliases. */ var aliases = { sessionTimeout: 'sessecs' }; /** * Initialize. * * http://admin.lytics.io/doc#jstag * * @param {Object} page */ Lytics.prototype.initialize = function(page){ var options = alias(this.options, aliases); window.jstag = (function(){var t = { _q: [], _c: options, ts: (new Date()).getTime() }; t.send = function(){this._q.push(['ready', 'send', Array.prototype.slice.call(arguments)]); return this; }; return t; })(); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Lytics.prototype.loaded = function(){ return !! (window.jstag && window.jstag.bind); }; /** * Page. * * @param {Page} page */ Lytics.prototype.page = function(page){ window.jstag.send(page.properties()); }; /** * Idenfity. * * @param {Identify} identify */ Lytics.prototype.identify = function(identify){ var traits = identify.traits({ userId: '_uid' }); window.jstag.send(traits); }; /** * Track. * * @param {String} event * @param {Object} properties (optional) * @param {Object} options (optional) */ Lytics.prototype.track = function(track){ var props = track.properties(); props._e = track.event(); window.jstag.send(props); }; }, {"analytics.js-integration":88,"alias":162}], 57: [function(require, module, exports) { /** * Module dependencies. */ var alias = require('alias'); var clone = require('clone'); var dates = require('convert-dates'); var integration = require('analytics.js-integration'); var is = require('is'); var iso = require('to-iso-string'); var indexof = require('indexof'); var del = require('obj-case').del; var some = require('some'); /** * Expose `Mixpanel` integration. */ var Mixpanel = module.exports = integration('Mixpanel') .global('mixpanel') .option('increments', []) .option('cookieName', '') .option('crossSubdomainCookie', false) .option('secureCookie', false) .option('nameTag', true) .option('pageview', false) .option('people', false) .option('token', '') .option('trackAllPages', false) .option('trackNamedPages', true) .option('trackCategorizedPages', true) .tag('<script src="//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js">'); /** * Options aliases. */ var optionsAliases = { cookieName: 'cookie_name', crossSubdomainCookie: 'cross_subdomain_cookie', secureCookie: 'secure_cookie' }; /** * Initialize. * * https://mixpanel.com/help/reference/javascript#installing * https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.init */ Mixpanel.prototype.initialize = function(){ (function(c, a){window.mixpanel = a; var b, d, h, e; a._i = []; a.init = function(b, c, f){function d(a, b){var c = b.split('.'); 2 == c.length && (a = a[c[0]], b = c[1]); a[b] = function(){a.push([b].concat(Array.prototype.slice.call(arguments, 0))); }; } var g = a; 'undefined' !== typeof f ? g = a[f] = [] : f = 'mixpanel'; g.people = g.people || []; h = ['disable', 'track', 'track_pageview', 'track_links', 'track_forms', 'register', 'register_once', 'unregister', 'identify', 'alias', 'name_tag', 'set_config', 'people.set', 'people.increment', 'people.track_charge', 'people.append']; for (e = 0; e < h.length; e++) d(g, h[e]); a._i.push([b, c, f]); }; a.__SV = 1.2; })(document, window.mixpanel || []); this.options.increments = lowercase(this.options.increments); var options = alias(this.options, optionsAliases); window.mixpanel.init(options.token, options); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Mixpanel.prototype.loaded = function(){ return !! (window.mixpanel && window.mixpanel.config); }; /** * Page. * * https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.track_pageview * * @param {String} category (optional) * @param {String} name (optional) * @param {Object} properties (optional) * @param {Object} options (optional) */ Mixpanel.prototype.page = function(page){ var category = page.category(); var name = page.fullName(); var opts = this.options; // all pages if (opts.trackAllPages) { this.track(page.track()); } // categorized pages if (category && opts.trackCategorizedPages) { this.track(page.track(category)); } // named pages if (name && opts.trackNamedPages) { this.track(page.track(name)); } }; /** * Trait aliases. */ var traitAliases = { created: '$created', email: '$email', firstName: '$first_name', lastName: '$last_name', lastSeen: '$last_seen', name: '$name', username: '$username', phone: '$phone' }; /** * Identify. * * https://mixpanel.com/help/reference/javascript#super-properties * https://mixpanel.com/help/reference/javascript#user-identity * https://mixpanel.com/help/reference/javascript#storing-user-profiles * * @param {Identify} identify */ Mixpanel.prototype.identify = function(identify){ var username = identify.username(); var email = identify.email(); var id = identify.userId(); // id if (id) window.mixpanel.identify(id); // name tag var nametag = email || username || id; if (nametag) window.mixpanel.name_tag(nametag); // traits var traits = identify.traits(traitAliases); if (traits.$created) del(traits, 'createdAt'); window.mixpanel.register(dates(traits, iso)); if (this.options.people) window.mixpanel.people.set(traits); }; /** * Track. * * https://mixpanel.com/help/reference/javascript#sending-events * https://mixpanel.com/help/reference/javascript#tracking-revenue * * @param {Track} track */ Mixpanel.prototype.track = function(track){ var increments = this.options.increments; var increment = track.event().toLowerCase(); var people = this.options.people; var props = track.properties(); var revenue = track.revenue(); // delete mixpanel's reserved properties, so they don't conflict delete props.distinct_id; delete props.ip; delete props.mp_name_tag; delete props.mp_note; delete props.token; // convert arrays of objects to length, since mixpanel doesn't support object arrays for (var key in props) { var val = props[key]; if (is.array(val) && some(val, is.object)) props[key] = val.length; } // increment properties in mixpanel people if (people && ~indexof(increments, increment)) { window.mixpanel.people.increment(track.event()); window.mixpanel.people.set('Last ' + track.event(), new Date); } // track the event props = dates(props, iso); window.mixpanel.track(track.event(), props); // track revenue specifically if (revenue && people) { window.mixpanel.people.track_charge(revenue); } }; /** * Alias. * * https://mixpanel.com/help/reference/javascript#user-identity * https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.alias * * @param {Alias} alias */ Mixpanel.prototype.alias = function(alias){ var mp = window.mixpanel; var to = alias.to(); if (mp.get_distinct_id && mp.get_distinct_id() === to) return; // HACK: internal mixpanel API to ensure we don't overwrite if (mp.get_property && mp.get_property('$people_distinct_id') === to) return; // although undocumented, mixpanel takes an optional original id mp.alias(to, alias.from()); }; /** * Lowercase the given `arr`. * * @param {Array} arr * @return {Array} * @api private */ function lowercase(arr){ var ret = new Array(arr.length); for (var i = 0; i < arr.length; ++i) { ret[i] = String(arr[i]).toLowerCase(); } return ret; } }, {"alias":162,"clone":95,"convert-dates":163,"analytics.js-integration":88,"is":91,"to-iso-string":161,"indexof":116,"obj-case":92,"some":177}], 177: [function(require, module, exports) { /** * some */ var some = [].some; /** * test whether some elements in * the array pass the test implemented * by `fn`. * * example: * * some([1, 'foo', 'bar'], function (el, i) { * return 'string' == typeof el; * }); * // > true * * @param {Array} arr * @param {Function} fn * @return {bool} */ module.exports = function (arr, fn) { if (some) return some.call(arr, fn); for (var i = 0, l = arr.length; i < l; ++i) { if (fn(arr[i], i)) return true; } return false; }; }, {}], 58: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var bind = require('bind'); var when = require('when'); var is = require('is'); /** * Expose `Mojn` */ var Mojn = module.exports = integration('Mojn') .option('customerCode', '') .global('_mojnTrack') .tag('<script src="https://track.idtargeting.com/{{ customerCode }}/track.js">'); /** * Initialize. * * @param {Object} page */ Mojn.prototype.initialize = function(){ window._mojnTrack = window._mojnTrack || []; window._mojnTrack.push({ cid: this.options.customerCode }); var loaded = bind(this, this.loaded); var ready = this.ready; this.load(function(){ when(loaded, ready); }); }; /** * Loaded? * * @return {Boolean} */ Mojn.prototype.loaded = function(){ return is.object(window._mojnTrack); }; /** * Identify. * * @param {Identify} identify */ Mojn.prototype.identify = function(identify){ var email = identify.email(); if (!email) return; var img = new Image(); img.src = '//matcher.idtargeting.com/identify.gif?cid=' + this.options.customerCode + '&_mjnctid='+email; img.width = 1; img.height = 1; return img; }; /** * Track. * * @param {Track} event */ Mojn.prototype.track = function(track){ var properties = track.properties(); var revenue = properties.revenue; var currency = properties.currency || ''; var conv = currency + revenue; if (!revenue) return; window._mojnTrack.push({ conv: conv }); return conv; }; }, {"analytics.js-integration":88,"bind":101,"when":131,"is":91}], 59: [function(require, module, exports) { /** * Module dependencies. */ var push = require('global-queue')('_mfq'); var integration = require('analytics.js-integration'); var each = require('each'); /** * Expose `Mouseflow`. */ var Mouseflow = module.exports = integration('Mouseflow') .assumesPageview() .global('mouseflow') .global('_mfq') .option('apiKey', '') .option('mouseflowHtmlDelay', 0) .tag('<script src="//cdn.mouseflow.com/projects/{{ apiKey }}.js">'); /** * Initalize. * * @param {Object} page */ Mouseflow.prototype.initialize = function(page){ window.mouseflowHtmlDelay = this.options.mouseflowHtmlDelay; this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Mouseflow.prototype.loaded = function(){ return !! window.mouseflow; }; /** * Page. * * http://mouseflow.zendesk.com/entries/22528817-Single-page-websites * * @param {Page} page */ Mouseflow.prototype.page = function(page){ if (!window.mouseflow) return; if ('function' != typeof mouseflow.newPageView) return; mouseflow.newPageView(); }; /** * Identify. * * http://mouseflow.zendesk.com/entries/24643603-Custom-Variables-Tagging * * @param {Identify} identify */ Mouseflow.prototype.identify = function(identify){ set(identify.traits()); }; /** * Track. * * http://mouseflow.zendesk.com/entries/24643603-Custom-Variables-Tagging * * @param {Track} track */ Mouseflow.prototype.track = function(track){ var props = track.properties(); props.event = track.event(); set(props); }; /** * Push each key and value in the given `obj` onto the queue. * * @param {Object} obj */ function set(obj){ each(obj, function(key, value){ push('setVariable', key, value); }); } }, {"global-queue":158,"analytics.js-integration":88,"each":4}], 60: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var useHttps = require('use-https'); var each = require('each'); var is = require('is'); /** * Expose `MouseStats` integration. */ var MouseStats = module.exports = integration('MouseStats') .assumesPageview() .global('msaa') .global('MouseStatsVisitorPlaybacks') .option('accountNumber', '') .tag('http', '<script src="http://www2.mousestats.com/js/{{ path }}.js?{{ cache }}">') .tag('https', '<script src="https://ssl.mousestats.com/js/{{ path }}.js?{{ cache }}">'); /** * Initialize. * * http://www.mousestats.com/docs/pages/allpages * * @param {Object} page */ MouseStats.prototype.initialize = function(page){ var number = this.options.accountNumber; var path = number.slice(0,1) + '/' + number.slice(1,2) + '/' + number; var cache = Math.floor(new Date().getTime() / 60000); var name = useHttps() ? 'https' : 'http'; this.load(name, { path: path, cache: cache }, this.ready); }; /** * Loaded? * * @return {Boolean} */ MouseStats.prototype.loaded = function(){ return is.array(window.MouseStatsVisitorPlaybacks); }; /** * Identify. * * http://www.mousestats.com/docs/wiki/7/how-to-add-custom-data-to-visitor-playbacks * * @param {Identify} identify */ MouseStats.prototype.identify = function(identify){ each(identify.traits(), function(key, value){ window.MouseStatsVisitorPlaybacks.customVariable(key, value); }); }; }, {"analytics.js-integration":88,"use-https":90,"each":4,"is":91}], 61: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('__nls'); /** * Expose `Navilytics` integration. */ var Navilytics = module.exports = integration('Navilytics') .assumesPageview() .global('__nls') .option('memberId', '') .option('projectId', '') .tag('<script src="//www.navilytics.com/nls.js?mid={{ memberId }}&pid={{ projectId }}">'); /** * Initialize. * * https://www.navilytics.com/member/code_settings * * @param {Object} page */ Navilytics.prototype.initialize = function(page){ window.__nls = window.__nls || []; this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Navilytics.prototype.loaded = function(){ return !! (window.__nls && [].push != window.__nls.push); }; /** * Track. * * https://www.navilytics.com/docs#tags * * @param {Track} track */ Navilytics.prototype.track = function(track){ push('tagRecording', track.event()); }; }, {"analytics.js-integration":88,"global-queue":158}], 62: [function(require, module, exports) { var integration = require('analytics.js-integration'); var alias = require('alias'); var Identify = require('facade').Identify; /** * Expose `plugin`. */ /*module.exports = exports = function(analytics){ analytics.addIntegration(Nudgespot); };*/ /** * Expose `Nudgespot` integration. */ var Nudgespot = module.exports = integration('Nudgespot') .assumesPageview() .option('apiKey', '') .global('nudgespot') .tag('<script id="nudgespot" src="//cdn.nudgespot.com/nudgespot.js">'); /** * Initialize Nudgespot. */ Nudgespot.prototype.initialize = function(page){ window.nudgespot = window.nudgespot || []; window.nudgespot.init = function(n, t){function f(n,m){var a=m.split('.');2==a.length&&(n=n[a[0]],m=a[1]);n[m]=function(){n.push([m].concat(Array.prototype.slice.call(arguments,0)))}}n._version=0.1;n._globals=[t];n.people=n.people||[];n.params=n.params||[];m="track register unregister identify set_config people.delete people.create people.update people.create_property people.tag people.remove_Tag".split(" ");for (var i=0;i<m.length;i++)f(n,m[i])}; window.nudgespot.init(window.nudgespot, this.options.apiKey); this.load(this.ready); }; /** * Has the Nudgespot library been loaded yet? */ Nudgespot.prototype.loaded = function(){ return (!! window.nudgespot) && (window.nudgespot.push !== Array.prototype.push); }; /** * Identify a user. */ Nudgespot.prototype.identify = function(identify){ if (!identify.userId()) return this.debug('user id required'); var traits = identify.traits({ createdAt: 'created' }); traits = alias(traits, { created: 'created_at' }); window.nudgespot.identify(identify.userId(), traits); }; /** * Track an event. */ Nudgespot.prototype.track = function(track){ var properties = track.properties(); window.nudgespot.track(track.event(), properties); }; }, {"analytics.js-integration":88,"alias":162,"facade":132}], 63: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var https = require('use-https'); var tick = require('next-tick'); /** * Expose `Olark` integration. */ var Olark = module.exports = integration('Olark') .assumesPageview() .global('olark') .option('identify', true) .option('page', true) .option('siteId', '') .option('groupId', '') .option('track', false); /** * Initialize. * * http://www.olark.com/documentation * https://www.olark.com/documentation/javascript/api.chat.setOperatorGroup * * @param {Facade} page */ Olark.prototype.initialize = function(page){ var self = this; this.load(function(){ tick(self.ready); }); // assign chat to a specific site var groupId = this.options.groupId; if (groupId) api('chat.setOperatorGroup', { group: groupId }); // keep track of the widget's open state api('box.onExpand', function(){ self._open = true; }); api('box.onShrink', function(){ self._open = false; }); }; /** * Loaded? * * @return {Boolean} */ Olark.prototype.loaded = function(){ return !! window.olark; }; /** * Load. * * @param {Function} callback */ Olark.prototype.load = function(callback){ var el = document.getElementById('olark'); window.olark||(function(c){var f=window,d=document,l=https()?"https:":"http:",z=c.name,r="load";var nt=function(){f[z]=function(){(a.s=a.s||[]).push(arguments)};var a=f[z]._={},q=c.methods.length;while (q--) {(function(n){f[z][n]=function(){f[z]("call",n,arguments)}})(c.methods[q])}a.l=c.loader;a.i=nt;a.p={ 0:+new Date() };a.P=function(u){a.p[u]=new Date()-a.p[0]};function s(){a.P(r);f[z](r)}f.addEventListener?f.addEventListener(r,s,false):f.attachEvent("on"+r,s);var ld=function(){function p(hd){hd="head";return ["<",hd,"></",hd,"><",i,' onl' + 'oad="var d=',g,";d.getElementsByTagName('head')[0].",j,"(d.",h,"('script')).",k,"='",l,"//",a.l,"'",'"',"></",i,">"].join("")}var i="body",m=d[i];if (!m) {return setTimeout(ld,100)}a.P(1);var j="appendChild",h="createElement",k="src",n=d[h]("div"),v=n[j](d[h](z)),b=d[h]("iframe"),g="document",e="domain",o;n.style.display="none";m.insertBefore(n,m.firstChild).id=z;b.frameBorder="0";b.id=z+"-loader";if (/MSIE[ ]+6/.test(navigator.userAgent)) {b.src="javascript:false"}b.allowTransparency="true";v[j](b);try {b.contentWindow[g].open()}catch (w) {c[e]=d[e];o="javascript:var d="+g+".open();d.domain='"+d.domain+"';";b[k]=o+"void(0);"}try {var t=b.contentWindow[g];t.write(p());t.close()}catch (x) {b[k]=o+'d.write("'+p().replace(/"/g,String.fromCharCode(92)+'"')+'");d.close();'}a.P(2)};ld()};nt()})({ loader: "static.olark.com/jsclient/loader0.js", name:"olark", methods:["configure","extend","declare","identify"] }); window.olark.identify(this.options.siteId); callback(); }; /** * Page. * * @param {Facade} page */ Olark.prototype.page = function(page){ if (!this.options.page) return; var props = page.properties(); var name = page.fullName(); if (!name && !props.url) return; name = name ? name + ' page' : props.url; this.notify('looking at ' + name); }; /** * Identify. * * @param {Facade} identify */ Olark.prototype.identify = function(identify){ if (!this.options.identify) return; var username = identify.username(); var traits = identify.traits(); var id = identify.userId(); var email = identify.email(); var phone = identify.phone(); var name = identify.name() || identify.firstName(); if (traits) api('visitor.updateCustomFields', traits); if (email) api('visitor.updateEmailAddress', { emailAddress: email }); if (phone) api('visitor.updatePhoneNumber', { phoneNumber: phone }); if (name) api('visitor.updateFullName', { fullName: name }); // figure out best nickname var nickname = name || email || username || id; if (name && email) nickname += ' (' + email + ')'; if (nickname) api('chat.updateVisitorNickname', { snippet: nickname }); }; /** * Track. * * @param {Facade} track */ Olark.prototype.track = function(track){ if (!this.options.track) return; this.notify('visitor triggered "' + track.event() + '"'); }; /** * Send a notification `message` to the operator, only when a chat is active and * when the chat is open. * * @param {String} message */ Olark.prototype.notify = function(message){ if (!this._open) return; // lowercase since olark does message = message.toLowerCase(); api('visitor.getDetails', function(data){ if (!data || !data.isConversing) return; api('chat.sendNotificationToOperator', { body: message }); }); }; /** * Helper for Olark API calls. * * @param {String} action * @param {Object} value */ function api(action, value) { window.olark('api.' + action, value); } }, {"analytics.js-integration":88,"use-https":90,"next-tick":103}], 64: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('optimizely'); var callback = require('callback'); var tick = require('next-tick'); var bind = require('bind'); var each = require('each'); /** * Expose `Optimizely` integration. */ var Optimizely = module.exports = integration('Optimizely') .option('variations', true) .option('trackNamedPages', true) .option('trackCategorizedPages', true); /** * Initialize. * * https://www.optimizely.com/docs/api#function-calls */ Optimizely.prototype.initialize = function(){ if (this.options.variations) { var self = this; tick(function(){ self.replay(); }); } this.ready(); }; /** * Track. * * https://www.optimizely.com/docs/api#track-event * * @param {Track} track */ Optimizely.prototype.track = function(track){ var props = track.properties(); if (props.revenue) props.revenue *= 100; push('trackEvent', track.event(), props); }; /** * Page. * * https://www.optimizely.com/docs/api#track-event * * @param {Page} page */ Optimizely.prototype.page = function(page){ var category = page.category(); var name = page.fullName(); var opts = this.options; // categorized pages if (category && opts.trackCategorizedPages) { this.track(page.track(category)); } // named pages if (name && opts.trackNamedPages) { this.track(page.track(name)); } }; /** * Replay experiment data as traits to other enabled providers. * * https://www.optimizely.com/docs/api#data-object */ Optimizely.prototype.replay = function(){ if (!window.optimizely) return; // in case the snippet isnt on the page var data = window.optimizely.data; if (!data) return; var experiments = data.experiments; var map = data.state.variationNamesMap; var traits = {}; each(map, function(experimentId, variation){ var experiment = experiments[experimentId].name; traits['Experiment: ' + experiment] = variation; }); this.analytics.identify(traits); }; }, {"analytics.js-integration":88,"global-queue":158,"callback":94,"next-tick":103,"bind":101,"each":4}], 65: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_pq'); /** * Expose `PerfectAudience` integration. */ var PerfectAudience = module.exports = integration('Perfect Audience') .assumesPageview() .global('_pq') .option('siteId', '') .tag('<script src="//tag.perfectaudience.com/serve/{{ siteId }}.js">'); /** * Initialize. * * http://support.perfectaudience.com/knowledgebase/articles/212490-visitor-tracking-api * * @param {Object} page */ PerfectAudience.prototype.initialize = function(page){ window._pq = window._pq || []; this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ PerfectAudience.prototype.loaded = function(){ return !! (window._pq && window._pq.push); }; /** * Track. * * http://support.perfectaudience.com/knowledgebase/articles/212490-visitor-tracking-api * * @param {Track} event */ PerfectAudience.prototype.track = function(track){ var total = track.total() || track.revenue(); var orderId = track.orderId(); var props = {}; var sendProps = false; if (total) { props.revenue = total; sendProps = true; } if (orderId) { props.orderId = orderId; sendProps = true; } if (!sendProps) return push('track', track.event()); return push('track', track.event(), props); }; /** * Viewed Product. * * http://support.perfectaudience.com/knowledgebase/articles/212490-visitor-tracking-api * * @param {Track} event */ PerfectAudience.prototype.viewedProduct = function(track){ var product = track.sku(); push('track', track.event()); push('trackProduct', product); }; /** * Completed Purchase. * * http://support.perfectaudience.com/knowledgebase/articles/212490-visitor-tracking-api * * @param {Track} event */ PerfectAudience.prototype.completedOrder = function(track){ var total = track.total() || track.revenue(); var orderId = track.orderId(); var props = {}; if (total) props.revenue = total; if (orderId) props.orderId = orderId; push('track', track.event(), props); }; }, {"analytics.js-integration":88,"global-queue":158}], 66: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_prum'); var date = require('load-date'); /** * Expose `Pingdom` integration. */ var Pingdom = module.exports = integration('Pingdom') .assumesPageview() .global('_prum') .global('PRUM_EPISODES') .option('id', '') .tag('<script src="//rum-static.pingdom.net/prum.min.js">'); /** * Initialize. * * @param {Object} page */ Pingdom.prototype.initialize = function(page){ window._prum = window._prum || []; push('id', this.options.id); push('mark', 'firstbyte', date.getTime()); var self = this; this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Pingdom.prototype.loaded = function(){ return !! (window._prum && window._prum.push !== Array.prototype.push); }; }, {"analytics.js-integration":88,"global-queue":158,"load-date":159}], 67: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_paq'); var each = require('each'); var is = require('is'); /** * Expose `Piwik` integration. */ var Piwik = module.exports = integration('Piwik') .global('_paq') .option('url', null) .option('siteId', '') .option('customVariableLimit', 5) .mapping('goals') .tag('<script src="{{ url }}/piwik.js">'); /** * Initialize. * * http://piwik.org/docs/javascript-tracking/#toc-asynchronous-tracking */ Piwik.prototype.initialize = function(){ window._paq = window._paq || []; push('setSiteId', this.options.siteId); push('setTrackerUrl', this.options.url + '/piwik.php'); push('enableLinkTracking'); this.load(this.ready); }; /** * Check if Piwik is loaded */ Piwik.prototype.loaded = function(){ return !! (window._paq && window._paq.push != [].push); }; /** * Page * * @param {Page} page */ Piwik.prototype.page = function(page){ push('trackPageView'); }; /** * Track. * * @param {Track} track */ Piwik.prototype.track = function(track){ var goals = this.goals(track.event()); var revenue = track.revenue(); var category = track.category() || 'All'; var action = track.event(); var name = track.proxy('properties.name') || track.proxy('properties.label'); var value = track.value() || track.revenue(); var options = track.options('Piwik'); var customVariables = options.customVars || options.cvar; if (!is.object(customVariables)) { customVariables = {}; } for (var i = 1; i <= this.options.customVariableLimit; i += 1){ if (customVariables[i]) { push('setCustomVariable', i.toString(), customVariables[i][0], customVariables[i][1], 'page'); } } each(goals, function(goal){ push('trackGoal', goal, revenue); }); push('trackEvent', category, action, name, value); }; }, {"analytics.js-integration":88,"global-queue":158,"each":4,"is":91}], 68: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var convertDates = require('convert-dates'); var push = require('global-queue')('_preactq'); var alias = require('alias'); /** * Expose `Preact` integration. */ var Preact = module.exports = integration('Preact') .assumesPageview() .global('_preactq') .global('_lnq') .option('projectCode', '') .tag('<script src="//d2bbvl6dq48fa6.cloudfront.net/js/preact-4.1.min.js">'); /** * Initialize. * * http://www.preact.io/api/javascript * * @param {Object} page */ Preact.prototype.initialize = function(page){ window._preactq = window._preactq || []; window._lnq = window._lnq || []; push('_setCode', this.options.projectCode); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Preact.prototype.loaded = function(){ return !! (window._preactq && window._preactq.push !== Array.prototype.push); }; /** * Identify. * * @param {Identify} identify */ Preact.prototype.identify = function(identify){ if (!identify.userId()) return; var traits = identify.traits({ created: 'created_at' }); traits = convertDates(traits, convertDate); push('_setPersonData', { name: identify.name(), email: identify.email(), uid: identify.userId(), properties: traits }); }; /** * Group. * * @param {String} id * @param {Object} properties (optional) * @param {Object} options (optional) */ Preact.prototype.group = function(group){ if (!group.groupId()) return; push('_setAccount', group.traits()); }; /** * Track. * * @param {Track} track */ Preact.prototype.track = function(track){ var props = track.properties(); var revenue = track.revenue(); var event = track.event(); var special = { name: event }; if (revenue) { special.revenue = revenue * 100; delete props.revenue; } if (props.note) { special.note = props.note; delete props.note; } push('_logEvent', special, props); }; /** * Convert a `date` to a format Preact supports. * * @param {Date} date * @return {Number} */ function convertDate(date){ return Math.floor(date / 1000); } }, {"analytics.js-integration":88,"convert-dates":163,"global-queue":158,"alias":162}], 69: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_kiq'); var Facade = require('facade'); var Identify = Facade.Identify; var bind = require('bind'); var when = require('when'); /** * Expose `Qualaroo` integration. */ var Qualaroo = module.exports = integration('Qualaroo') .assumesPageview() .global('_kiq') .option('customerId', '') .option('siteToken', '') .option('track', false) .tag('<script src="//s3.amazonaws.com/ki.js/{{ customerId }}/{{ siteToken }}.js">'); /** * Initialize. * * @param {Object} page */ Qualaroo.prototype.initialize = function(page){ window._kiq = window._kiq || []; var loaded = bind(this, this.loaded); var ready = this.ready; this.load(function(){ when(loaded, ready); }); }; /** * Loaded? * * @return {Boolean} */ Qualaroo.prototype.loaded = function(){ return !! (window._kiq && window._kiq.push !== Array.prototype.push); }; /** * Identify. * * http://help.qualaroo.com/customer/portal/articles/731085-identify-survey-nudge-takers * http://help.qualaroo.com/customer/portal/articles/731091-set-additional-user-properties * * @param {Identify} identify */ Qualaroo.prototype.identify = function(identify){ var traits = identify.traits(); var id = identify.userId(); var email = identify.email(); if (email) id = email; if (id) push('identify', id); if (traits) push('set', traits); }; /** * Track. * * @param {String} event * @param {Object} properties (optional) * @param {Object} options (optional) */ Qualaroo.prototype.track = function(track){ if (!this.options.track) return; var event = track.event(); var traits = {}; traits['Triggered: ' + event] = true; this.identify(new Identify({ traits: traits })); }; }, {"analytics.js-integration":88,"global-queue":158,"facade":132,"bind":101,"when":131}], 70: [function(require, module, exports) { /** * Module dependencies. */ var push = require('global-queue')('_qevents', { wrap: false }); var integration = require('analytics.js-integration'); var useHttps = require('use-https'); var is = require('is'); var reduce = require('reduce'); /** * Expose `Quantcast` integration. */ var Quantcast = module.exports = integration('Quantcast') .assumesPageview() .global('_qevents') .global('__qc') .option('pCode', null) .option('advertise', false) .tag('http', '<script src="http://edge.quantserve.com/quant.js">') .tag('https', '<script src="https://secure.quantserve.com/quant.js">'); /** * Initialize. * * https://www.quantcast.com/learning-center/guides/using-the-quantcast-asynchronous-tag/ * https://www.quantcast.com/help/cross-platform-audience-measurement-guide/ * * @param {Page} page */ Quantcast.prototype.initialize = function(page){ window._qevents = window._qevents || []; var opts = this.options; var settings = { qacct: opts.pCode }; var user = this.analytics.user(); if (user.id()) settings.uid = user.id(); if (page) { settings.labels = this._labels('page', page.category(), page.name()); } push(settings); var name = useHttps() ? 'https' : 'http'; this.load(name, this.ready); }; /** * Loaded? * * @return {Boolean} */ Quantcast.prototype.loaded = function(){ return !! window.__qc; }; /** * Page. * * https://cloudup.com/cBRRFAfq6mf * * @param {Page} page */ Quantcast.prototype.page = function(page){ var category = page.category(); var name = page.name(); var customLabels = page.proxy('properties.label') var labels = this._labels('page', category, name, customLabels); var settings = { event: 'refresh', labels: labels, qacct: this.options.pCode, }; var user = this.analytics.user(); if (user.id()) settings.uid = user.id(); push(settings); }; /** * Identify. * * https://www.quantcast.com/help/cross-platform-audience-measurement-guide/ * * @param {String} id (optional) */ Quantcast.prototype.identify = function(identify){ // edit the initial quantcast settings // TODO: could be done in a cleaner way var id = identify.userId(); if (id) { window._qevents[0] = window._qevents[0] || {}; window._qevents[0].uid = id; } }; /** * Track. * * https://cloudup.com/cBRRFAfq6mf * * @param {Track} track */ Quantcast.prototype.track = function(track){ var name = track.event(); var revenue = track.revenue(); var orderId = track.orderId(); var customLabels = track.proxy('properties.label'); var labels = this._labels('event', name, customLabels); var settings = { event: 'click', labels: labels, qacct: this.options.pCode }; var user = this.analytics.user(); if (null != revenue) settings.revenue = (revenue+''); // convert to string if (orderId) settings.orderid = orderId; if (user.id()) settings.uid = user.id(); push(settings); }; /** * Completed Order. * * @param {Track} track * @api private */ Quantcast.prototype.completedOrder = function(track){ var name = track.event(); var revenue = track.total(); var customLabels = track.proxy('properties.label') var labels = this._labels('event', name, customLabels); var category = track.category(); var repeat = track.proxy('properties.repeat'); if (this.options.advertise && category) { labels += ',' + this._labels('pcat', category); } if ('boolean' == typeof repeat) { labels += ',_fp.customer.' + (repeat ? 'repeat' : 'new'); } var settings = { event: 'refresh', // the example Quantcast sent has completed order send refresh not click labels: labels, revenue: (revenue+''), // convert to string orderid: track.orderId(), qacct: this.options.pCode }; push(settings); }; /** * Generate quantcast labels. * * Example: * * options.advertise = false; * labels('event', 'my event'); * // => "event.my event" * * options.advertise = true; * labels('event', 'my event'); * // => "_fp.event.my event" * * @param {String} type * @param {String} ... * @return {String} * @api private */ Quantcast.prototype._labels = function(type){ var args = Array.prototype.slice.call(arguments, 1); var advertise = this.options.advertise; if (advertise && 'page' == type) type = 'event'; if (advertise) type = '_fp.' + type; var separator = advertise ? ' ' : '.'; var ret = reduce(args, function(ret, arg){ if (arg != null) { ret.push(String(arg).replace(/, /g, ',')); } return ret; }, []).join(separator); return [type, ret].join('.'); }; }, {"global-queue":158,"analytics.js-integration":88,"use-https":90,"is":91,"reduce":178}], 178: [function(require, module, exports) { /** * Reduce `arr` with `fn`. * * @param {Array} arr * @param {Function} fn * @param {Mixed} initial * * TODO: combatible error handling? */ module.exports = function(arr, fn, initial){ var idx = 0; var len = arr.length; var curr = arguments.length == 3 ? initial : arr[idx++]; while (idx < len) { curr = fn.call(null, curr, arr[idx], ++idx, arr); } return curr; }; }, {}], 71: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var extend = require('extend'); var is = require('is'); /** * Expose `Rollbar` integration. */ var RollbarIntegration = module.exports = integration('Rollbar') .global('Rollbar') .option('identify', true) .option('accessToken', '') .option('environment', 'unknown') .option('captureUncaught', true); /** * Initialize. * * @param {Object} page */ RollbarIntegration.prototype.initialize = function(page){ var _rollbarConfig = this.config = { accessToken: this.options.accessToken, captureUncaught: this.options.captureUncaught, payload: { environment: this.options.environment } }; // jscs:disable (function(a,b){function c(b){this.shimId=++h,this.notifier=null,this.parentShim=b,this.logger=function(){},a.console&&void 0===a.console.shimId&&(this.logger=a.console.log)}function d(b,c,d){a._rollbarWrappedError&&(d[4]||(d[4]=a._rollbarWrappedError),d[5]||(d[5]=a._rollbarWrappedError._rollbarContext),a._rollbarWrappedError=null),b.uncaughtError.apply(b,d),c&&c.apply(a,d)}function e(b){var d=c;return g(function(){if(this.notifier)return this.notifier[b].apply(this.notifier,arguments);var c=this,e="scope"===b;e&&(c=new d(this));var f=Array.prototype.slice.call(arguments,0),g={shim:c,method:b,args:f,ts:new Date};return a._rollbarShimQueue.push(g),e?c:void 0})}function f(a,b){if(b.hasOwnProperty&&b.hasOwnProperty("addEventListener")){var c=b.addEventListener;b.addEventListener=function(b,d,e){c.call(this,b,a.wrap(d),e)};var d=b.removeEventListener;b.removeEventListener=function(a,b,c){d.call(this,a,b&&b._wrapped?b._wrapped:b,c)}}}function g(a,b){return b=b||this.logger,function(){try{return a.apply(this,arguments)}catch(c){b("Rollbar internal error:",c)}}}var h=0;c.init=function(a,b){var e=b.globalAlias||"Rollbar";if("object"==typeof a[e])return a[e];a._rollbarShimQueue=[],a._rollbarWrappedError=null,b=b||{};var h=new c;return g(function(){if(h.configure(b),b.captureUncaught){var c=a.onerror;a.onerror=function(){var a=Array.prototype.slice.call(arguments,0);d(h,c,a)};var g,i,j="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(g=0;g<j.length;++g)i=j[g],a[i]&&a[i].prototype&&f(h,a[i].prototype)}return a[e]=h,h},h.logger)()},c.prototype.loadFull=function(a,b,c,d,e){var f=g(function(){var a=b.createElement("script"),e=b.getElementsByTagName("script")[0];a.src=d.rollbarJsUrl,a.async=!c,a.onload=h,e.parentNode.insertBefore(a,e)},this.logger),h=g(function(){var b;if(void 0===a._rollbarPayloadQueue){var c,d,f,g;for(b=new Error("rollbar.js did not load");c=a._rollbarShimQueue.shift();)for(f=c.args,g=0;g<f.length;++g)if(d=f[g],"function"==typeof d){d(b);break}}"function"==typeof e&&e(b)},this.logger);g(function(){c?f():a.addEventListener?a.addEventListener("load",f,!1):a.attachEvent("onload",f)},this.logger)()},c.prototype.wrap=function(b,c){try{var d;if(d="function"==typeof c?c:function(){return c||{}},"function"!=typeof b)return b;if(b._isWrap)return b;if(!b._wrapped){b._wrapped=function(){try{return b.apply(this,arguments)}catch(c){throw c._rollbarContext=d(),c._rollbarContext._wrappedSource=b.toString(),a._rollbarWrappedError=c,c}},b._wrapped._isWrap=!0;for(var e in b)b.hasOwnProperty(e)&&(b._wrapped[e]=b[e])}return b._wrapped}catch(f){return b}};for(var i="log,debug,info,warn,warning,error,critical,global,configure,scope,uncaughtError".split(","),j=0;j<i.length;++j)c.prototype[i[j]]=e(i[j]);var k="//d37gvrvc0wt4s1.cloudfront.net/js/v1.1/rollbar.min.js";_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||k;var l=c.init(a,_rollbarConfig);})(window,document); // jscs:enable this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ RollbarIntegration.prototype.loaded = function(){ return is.object(window.Rollbar) && null == window.Rollbar.shimId; }; /** * Load. * * @param {Function} callback */ RollbarIntegration.prototype.load = function(callback){ window.Rollbar.loadFull(window, document, true, this.config, callback); }; /** * Identify. * * @param {Identify} identify */ RollbarIntegration.prototype.identify = function(identify){ // do stuff with `id` or `traits` if (!this.options.identify) return; // Don't allow identify without a user id var uid = identify.userId(); if (uid === null || uid === undefined) return; var rollbar = window.Rollbar; var person = { id: uid }; extend(person, identify.traits()); rollbar.configure({ payload: { person: person }}); }; }, {"analytics.js-integration":88,"extend":130,"is":91}], 72: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); /** * Expose `SaaSquatch` integration. */ var SaaSquatch = module.exports = integration('SaaSquatch') .option('tenantAlias', '') .option('referralImage', '') .global('_sqh') .tag('<script src="//d2rcp9ak152ke1.cloudfront.net/assets/javascripts/squatch.min.js">'); /** * Initialize. * * @param {Page} page */ SaaSquatch.prototype.initialize = function(page){ window._sqh = window._sqh || []; this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ SaaSquatch.prototype.loaded = function(){ return window._sqh && window._sqh.push != [].push; }; /** * Identify. * * @param {Facade} identify */ SaaSquatch.prototype.identify = function(identify){ var sqh = window._sqh; var accountId = identify.proxy('traits.accountId'); var paymentProviderId = identify.proxy('traits.paymentProviderId'); var accountStatus = identify.proxy('traits.accountStatus'); var referralCode = identify.proxy('traits.referralCode'); var image = identify.proxy('traits.referralImage') || this.options.referralImage; var opts = identify.options(this.name); var id = identify.userId(); var email = identify.email(); if (!(id || email)) return; if (this.called) return; var init = { tenant_alias: this.options.tenantAlias, first_name: identify.firstName(), last_name: identify.lastName(), user_image: identify.avatar(), email: email, user_id: id, }; if (accountId) init.account_id = accountId; if (paymentProviderId) init.payment_provider_id = paymentProviderId; if (init.payment_provider_id == "null") init.payment_provider_id = null; if (accountStatus) init.account_status = accountStatus; if (referralCode) init.referral_code = referralCode; if (opts.checksum) init.checksum = opts.checksum; if (image) init.fb_share_image = image; sqh.push(['init', init]); this.called = true; this.load(); }; /** * Group. * * @param {Group} group */ SaaSquatch.prototype.group = function(group){ var sqh = window._sqh; var props = group.properties(); var id = group.groupId(); var image = group.proxy('traits.referralImage') || this.options.referralImage; var opts = group.options(this.name); // tenant_alias is required. if (this.called) return; var init = { tenant_alias: this.options.tenantAlias, account_id: id }; if (opts.checksum) init.checksum = opts.checksum; if (image) init.fb_share_image = image; sqh.push(['init', init]); this.called = true; this.load(); }; }, {"analytics.js-integration":88}], 73: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var when = require('when'); /** * Expose `SatisMeter` integration. */ var SatisMeter = module.exports = integration('SatisMeter') .global('satismeter') .option('token', '') .tag('<script src="https://app.satismeter.com/satismeter.js">'); /** * Initialize. * * @param {Object} page */ SatisMeter.prototype.initialize = function(page){ var self = this; this.load(function(){ when(function(){ return self.loaded(); }, self.ready); }); }; /** * Loaded? * * @return {Boolean} */ SatisMeter.prototype.loaded = function(){ return !!window.satismeter; }; /** * Identify. * * @param {Identify} identify */ SatisMeter.prototype.identify = function(identify){ var traits = identify.traits(); traits.token = this.options.token; traits.user = { id: identify.userId() }; if (identify.name()) { traits.user.name = identify.name(); } if (identify.email()) { traits.user.email = identify.email(); } if (identify.created()) { traits.user.signUpDate = identify.created().toISOString(); } // Remove traits that are already passed in user object delete traits.id; delete traits.email; delete traits.name; delete traits.created; window.satismeter(traits); }; }, {"analytics.js-integration":88,"when":131}], 74: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var localstorage = require('store'); var protocol = require('protocol'); var utm = require('utm-params'); var ads = require('ad-params'); var send = require('send-json'); var cookie = require('cookie'); var clone = require('clone'); var uuid = require('uuid'); var top = require('top-domain'); var extend = require('extend'); var json = require('segmentio/json@1.0.0'); /** * Cookie options */ var options = { maxage: 31536000000, // 1y secure: false, path: '/' }; /** * Expose `Segment` integration. */ var Segment = exports = module.exports = integration('Segment.io') .option('apiKey', ''); /** * Get the store. * * @return {Function} */ exports.storage = function(){ return 'file:' == protocol() || 'chrome-extension:' == protocol() ? localstorage : cookie; }; /** * Expose global for testing. */ exports.global = window; /** * Initialize. * * https://github.com/segmentio/segmentio/blob/master/modules/segmentjs/segment.js/v1/segment.js * * @param {Object} page */ Segment.prototype.initialize = function(page){ var self = this; this.ready(); this.analytics.on('invoke', function(msg){ var action = msg.action(); var listener = 'on' + msg.action(); self.debug('%s %o', action, msg); if (self[listener]) self[listener](msg); self.ready(); }); }; /** * Loaded. * * @return {Boolean} */ Segment.prototype.loaded = function(){ return true; }; /** * Page. * * @param {Page} page */ Segment.prototype.onpage = function(page){ this.send('/p', page.json()); }; /** * Identify. * * @param {Identify} identify */ Segment.prototype.onidentify = function(identify){ this.send('/i', identify.json()); }; /** * Group. * * @param {Group} group */ Segment.prototype.ongroup = function(group){ this.send('/g', group.json()); }; /** * Track. * * @param {Track} track */ Segment.prototype.ontrack = function(track){ var json = track.json(); delete json.traits; // TODO: figure out why we need traits. this.send('/t', json); }; /** * Alias. * * @param {Alias} alias */ Segment.prototype.onalias = function(alias){ var json = alias.json(); var user = this.analytics.user(); json.previousId = json.previousId || json.from || user.id() || user.anonymousId(); json.userId = json.userId || json.to; delete json.from; delete json.to; this.send('/a', json); }; /** * Normalize the given `msg`. * * @param {Object} msg * @api private */ Segment.prototype.normalize = function(msg){ this.debug('normalize %o', msg); var user = this.analytics.user(); var global = exports.global; var query = global.location.search; var ctx = msg.context = msg.context || msg.options || {}; delete msg.options; msg.writeKey = this.options.apiKey; ctx.userAgent = navigator.userAgent; if (!ctx.library) ctx.library = { name: 'analytics.js', version: this.analytics.VERSION }; if (query) ctx.campaign = utm(query); this.referrerId(query, ctx); msg.userId = msg.userId || user.id(); msg.anonymousId = user.anonymousId(); msg.messageId = uuid(); msg.sentAt = new Date(); this.debug('normalized %o', msg); return msg; }; /** * Send `obj` to `path`. * * @param {String} path * @param {Object} obj * @param {Function} fn * @api private */ Segment.prototype.send = function(path, msg, fn){ var url = scheme() + '//api.segment.io/v1' + path; var headers = { 'Content-Type': 'text/plain' }; var fn = fn || noop; var self = this; // msg msg = this.normalize(msg); // send send(url, msg, headers, function(err, res){ self.debug('sent %O, received %O', msg, arguments); if (err) return fn(err); res.url = url; fn(null, res); }); }; /** * Gets/sets cookies on the appropriate domain. * * @param {String} name * @param {Mixed} val */ Segment.prototype.cookie = function(name, val){ var store = Segment.storage(); if (arguments.length === 1) return store(name); var global = exports.global; var href = global.location.href; var domain = '.' + top(href); if ('.' == domain) domain = ''; this.debug('store domain %s -> %s', href, domain); var opts = clone(options); opts.domain = domain; this.debug('store %s, %s, %o', name, val, opts); store(name, val, opts); if (store(name)) return; delete opts.domain; this.debug('fallback store %s, %s, %o', name, val, opts); store(name, val, opts); }; /** * Add referrerId to context. * * TODO: remove. * * @param {Object} query * @param {Object} ctx * @api private */ Segment.prototype.referrerId = function(query, ctx){ var stored = this.cookie('s:context.referrer'); var ad; if (stored) stored = json.parse(stored); if (query) ad = ads(query); ad = ad || stored; if (!ad) return; ctx.referrer = extend(ctx.referrer || {}, ad); this.cookie('s:context.referrer', json.stringify(ad)); } /** * Get the scheme. * * The function returns `http:` * if the protocol is `http:` and * `https:` for other protocols. * * @return {String} */ function scheme(){ return 'http:' == protocol() ? 'http:' : 'https:'; } /** * Noop */ function noop(){} }, {"analytics.js-integration":88,"store":179,"protocol":180,"utm-params":123,"ad-params":181,"send-json":182,"cookie":183,"clone":95,"uuid":184,"top-domain":124,"extend":130,"segmentio/json@1.0.0":164}], 179: [function(require, module, exports) { /** * dependencies. */ var unserialize = require('unserialize'); var each = require('each'); var storage; /** * Safari throws when a user * blocks access to cookies / localstorage. */ try { storage = window.localStorage; } catch (e) { storage = null; } /** * Expose `store` */ module.exports = store; /** * Store the given `key`, `val`. * * @param {String|Object} key * @param {Mixed} value * @return {Mixed} * @api public */ function store(key, value){ var length = arguments.length; if (0 == length) return all(); if (2 <= length) return set(key, value); if (1 != length) return; if (null == key) return storage.clear(); if ('string' == typeof key) return get(key); if ('object' == typeof key) return each(key, set); } /** * supported flag. */ store.supported = !! storage; /** * Set `key` to `val`. * * @param {String} key * @param {Mixed} val */ function set(key, val){ return null == val ? storage.removeItem(key) : storage.setItem(key, JSON.stringify(val)); } /** * Get `key`. * * @param {String} key * @return {Mixed} */ function get(key){ return unserialize(storage.getItem(key)); } /** * Get all. * * @return {Object} */ function all(){ var len = storage.length; var ret = {}; var key; while (0 <= --len) { key = storage.key(len); ret[key] = get(key); } return ret; } }, {"unserialize":185,"each":112}], 185: [function(require, module, exports) { /** * Unserialize the given "stringified" javascript. * * @param {String} val * @return {Mixed} */ module.exports = function(val){ try { return JSON.parse(val); } catch (e) { return val || undefined; } }; }, {}], 180: [function(require, module, exports) { /** * Convenience alias */ var define = Object.defineProperty; /** * The base protocol */ var initialProtocol = window.location.protocol; /** * Fallback mocked protocol in case Object.defineProperty doesn't exist. */ var mockedProtocol; module.exports = function (protocol) { if (arguments.length === 0) return get(); else return set(protocol); }; /** * Sets the protocol to be http: */ module.exports.http = function () { set('http:'); }; /** * Sets the protocol to be https: */ module.exports.https = function () { set('https:'); }; /** * Reset to the initial protocol. */ module.exports.reset = function () { set(initialProtocol); }; /** * Gets the current protocol, using the fallback and then the native protocol. * * @return {String} protocol */ function get () { return mockedProtocol || window.location.protocol; } /** * Sets the protocol * * @param {String} protocol */ function set (protocol) { try { define(window.location, 'protocol', { get: function () { return protocol; } }); } catch (err) { mockedProtocol = protocol; } } }, {}], 181: [function(require, module, exports) { /** * Module dependencies. */ var parse = require('querystring').parse; /** * Expose `ads` */ module.exports = ads; /** * All the ad query params we look for. */ var QUERYIDS = { 'btid' : 'dataxu', 'urid' : 'millennial-media' }; /** * Get all ads info from the given `querystring` * * @param {String} query * @return {Object} * @api private */ function ads(query){ var params = parse(query); for (var key in params) { for (var id in QUERYIDS) { if (key === id) { return { id : params[key], type : QUERYIDS[id] }; } } } } }, {"querystring":125}], 182: [function(require, module, exports) { /** * Module dependencies. */ var encode = require('base64-encode'); var cors = require('has-cors'); var jsonp = require('jsonp'); var JSON = require('json'); /** * Expose `send` */ exports = module.exports = cors ? json : base64; /** * Expose `callback` */ exports.callback = 'callback'; /** * Expose `prefix` */ exports.prefix = 'data'; /** * Expose `json`. */ exports.json = json; /** * Expose `base64`. */ exports.base64 = base64; /** * Expose `type` */ exports.type = cors ? 'xhr' : 'jsonp'; /** * Send the given `obj` to `url` with `fn(err, req)`. * * @param {String} url * @param {Object} obj * @param {Object} headers * @param {Function} fn * @api private */ function json(url, obj, headers, fn){ if (3 == arguments.length) fn = headers, headers = {}; var req = new XMLHttpRequest; req.onerror = fn; req.onreadystatechange = done; req.open('POST', url, true); for (var k in headers) req.setRequestHeader(k, headers[k]); req.send(JSON.stringify(obj)); function done(){ if (4 == req.readyState) return fn(null, req); } } /** * Send the given `obj` to `url` with `fn(err, req)`. * * @param {String} url * @param {Object} obj * @param {Function} fn * @api private */ function base64(url, obj, _, fn){ if (3 == arguments.length) fn = _; var prefix = exports.prefix; obj = encode(JSON.stringify(obj)); obj = encodeURIComponent(obj); url += '?' + prefix + '=' + obj; jsonp(url, { param: exports.callback }, function(err, obj){ if (err) return fn(err); fn(null, { url: url, body: obj }); }); } }, {"base64-encode":186,"has-cors":187,"jsonp":188,"json":164}], 186: [function(require, module, exports) { var utf8Encode = require('utf8-encode'); var keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; module.exports = encode; function encode(input) { var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = utf8Encode(input); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4); } return output; } }, {"utf8-encode":189}], 189: [function(require, module, exports) { module.exports = encode; function encode(string) { string = string.replace(/\r\n/g, "\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if ((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; } }, {}], 187: [function(require, module, exports) { /** * Module exports. * * Logic borrowed from Modernizr: * * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js */ try { module.exports = typeof XMLHttpRequest !== 'undefined' && 'withCredentials' in new XMLHttpRequest(); } catch (err) { // if XMLHttp support is disabled in IE then it will throw // when trying to create module.exports = false; } }, {}], 188: [function(require, module, exports) { /** * Module dependencies */ var debug = require('debug')('jsonp'); /** * Module exports. */ module.exports = jsonp; /** * Callback index. */ var count = 0; /** * Noop function. */ function noop(){} /** * JSONP handler * * Options: * - param {String} qs parameter (`callback`) * - timeout {Number} how long after a timeout error is emitted (`60000`) * * @param {String} url * @param {Object|Function} optional options / callback * @param {Function} optional callback */ function jsonp(url, opts, fn){ if ('function' == typeof opts) { fn = opts; opts = {}; } if (!opts) opts = {}; var prefix = opts.prefix || '__jp'; var param = opts.param || 'callback'; var timeout = null != opts.timeout ? opts.timeout : 60000; var enc = encodeURIComponent; var target = document.getElementsByTagName('script')[0] || document.head; var script; var timer; // generate a unique id for this request var id = prefix + (count++); if (timeout) { timer = setTimeout(function(){ cleanup(); if (fn) fn(new Error('Timeout')); }, timeout); } function cleanup(){ script.parentNode.removeChild(script); window[id] = noop; } window[id] = function(data){ debug('jsonp got', data); if (timer) clearTimeout(timer); cleanup(); if (fn) fn(null, data); }; // add qs component url += (~url.indexOf('?') ? '&' : '?') + param + '=' + enc(id); url = url.replace('?&', '?'); debug('jsonp req "%s"', url); // create script script = document.createElement('script'); script.src = url; target.parentNode.insertBefore(script, target); } }, {"debug":190}], 190: [function(require, module, exports) { if ('undefined' == typeof window) { module.exports = require('./lib/debug'); } else { module.exports = require('./debug'); } }, {"./lib/debug":191,"./debug":192}], 191: [function(require, module, exports) { /** * Module dependencies. */ var tty = require('tty'); /** * Expose `debug()` as the module. */ module.exports = debug; /** * Enabled debuggers. */ var names = [] , skips = []; (process.env.DEBUG || '') .split(/[\s,]+/) .forEach(function(name){ name = name.replace('*', '.*?'); if (name[0] === '-') { skips.push(new RegExp('^' + name.substr(1) + '$')); } else { names.push(new RegExp('^' + name + '$')); } }); /** * Colors. */ var colors = [6, 2, 3, 4, 5, 1]; /** * Previous debug() call. */ var prev = {}; /** * Previously assigned color. */ var prevColor = 0; /** * Is stdout a TTY? Colored output is disabled when `true`. */ var isatty = tty.isatty(2); /** * Select a color. * * @return {Number} * @api private */ function color() { return colors[prevColor++ % colors.length]; } /** * Humanize the given `ms`. * * @param {Number} m * @return {String} * @api private */ function humanize(ms) { var sec = 1000 , min = 60 * 1000 , hour = 60 * min; if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; if (ms >= min) return (ms / min).toFixed(1) + 'm'; if (ms >= sec) return (ms / sec | 0) + 's'; return ms + 'ms'; } /** * Create a debugger with the given `name`. * * @param {String} name * @return {Type} * @api public */ function debug(name) { function disabled(){} disabled.enabled = false; var match = skips.some(function(re){ return re.test(name); }); if (match) return disabled; match = names.some(function(re){ return re.test(name); }); if (!match) return disabled; var c = color(); function colored(fmt) { fmt = coerce(fmt); var curr = new Date; var ms = curr - (prev[name] || curr); prev[name] = curr; fmt = ' \u001b[9' + c + 'm' + name + ' ' + '\u001b[3' + c + 'm\u001b[90m' + fmt + '\u001b[3' + c + 'm' + ' +' + humanize(ms) + '\u001b[0m'; console.error.apply(this, arguments); } function plain(fmt) { fmt = coerce(fmt); fmt = new Date().toUTCString() + ' ' + name + ' ' + fmt; console.error.apply(this, arguments); } colored.enabled = plain.enabled = true; return isatty || process.env.DEBUG_COLORS ? colored : plain; } /** * Coerce `val`. */ function coerce(val) { if (val instanceof Error) return val.stack || val.message; return val; } }, {}], 192: [function(require, module, exports) { /** * Expose `debug()` as the module. */ module.exports = debug; /** * Create a debugger with the given `name`. * * @param {String} name * @return {Type} * @api public */ function debug(name) { if (!debug.enabled(name)) return function(){}; return function(fmt){ fmt = coerce(fmt); var curr = new Date; var ms = curr - (debug[name] || curr); debug[name] = curr; fmt = name + ' ' + fmt + ' +' + debug.humanize(ms); // This hackery is required for IE8 // where `console.log` doesn't have 'apply' window.console && console.log && Function.prototype.apply.call(console.log, console, arguments); } } /** * The currently active debug mode names. */ debug.names = []; debug.skips = []; /** * Enables a debug mode by name. This can include modes * separated by a colon and wildcards. * * @param {String} name * @api public */ debug.enable = function(name) { try { localStorage.debug = name; } catch(e){} var split = (name || '').split(/[\s,]+/) , len = split.length; for (var i = 0; i < len; i++) { name = split[i].replace('*', '.*?'); if (name[0] === '-') { debug.skips.push(new RegExp('^' + name.substr(1) + '$')); } else { debug.names.push(new RegExp('^' + name + '$')); } } }; /** * Disable debug output. * * @api public */ debug.disable = function(){ debug.enable(''); }; /** * Humanize the given `ms`. * * @param {Number} m * @return {String} * @api private */ debug.humanize = function(ms) { var sec = 1000 , min = 60 * 1000 , hour = 60 * min; if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; if (ms >= min) return (ms / min).toFixed(1) + 'm'; if (ms >= sec) return (ms / sec | 0) + 's'; return ms + 'ms'; }; /** * Returns true if the given mode name is enabled, false otherwise. * * @param {String} name * @return {Boolean} * @api public */ debug.enabled = function(name) { for (var i = 0, len = debug.skips.length; i < len; i++) { if (debug.skips[i].test(name)) { return false; } } for (var i = 0, len = debug.names.length; i < len; i++) { if (debug.names[i].test(name)) { return true; } } return false; }; /** * Coerce `val`. */ function coerce(val) { if (val instanceof Error) return val.stack || val.message; return val; } // persist try { if (window.localStorage) debug.enable(localStorage.debug); } catch(e){} }, {}], 183: [function(require, module, exports) { /** * Module dependencies. */ var debug = require('debug')('cookie'); /** * Set or get cookie `name` with `value` and `options` object. * * @param {String} name * @param {String} value * @param {Object} options * @return {Mixed} * @api public */ module.exports = function(name, value, options){ switch (arguments.length) { case 3: case 2: return set(name, value, options); case 1: return get(name); default: return all(); } }; /** * Set cookie `name` to `value`. * * @param {String} name * @param {String} value * @param {Object} options * @api private */ function set(name, value, options) { options = options || {}; var str = encode(name) + '=' + encode(value); if (null == value) options.maxage = -1; if (options.maxage) { options.expires = new Date(+new Date + options.maxage); } if (options.path) str += '; path=' + options.path; if (options.domain) str += '; domain=' + options.domain; if (options.expires) str += '; expires=' + options.expires.toUTCString(); if (options.secure) str += '; secure'; document.cookie = str; } /** * Return all cookies. * * @return {Object} * @api private */ function all() { return parse(document.cookie); } /** * Get cookie `name`. * * @param {String} name * @return {String} * @api private */ function get(name) { return all()[name]; } /** * Parse cookie `str`. * * @param {String} str * @return {Object} * @api private */ function parse(str) { var obj = {}; var pairs = str.split(/ *; */); var pair; if ('' == pairs[0]) return obj; for (var i = 0; i < pairs.length; ++i) { pair = pairs[i].split('='); obj[decode(pair[0])] = decode(pair[1]); } return obj; } /** * Encode. */ function encode(value){ try { return encodeURIComponent(value); } catch (e) { debug('error `encode(%o)` - %o', value, e) } } /** * Decode. */ function decode(value) { try { return decodeURIComponent(value); } catch (e) { debug('error `decode(%o)` - %o', value, e) } } }, {"debug":190}], 184: [function(require, module, exports) { /** * Taken straight from jed's gist: https://gist.github.com/982883 * * Returns a random v4 UUID of the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, * where each x is replaced with a random hexadecimal digit from 0 to f, and * y is replaced with a random hexadecimal digit from 8 to b. */ module.exports = function uuid(a){ return a // if the placeholder was passed, return ? ( // a random number from 0 to 15 a ^ // unless b is 8, Math.random() // in which case * 16 // a random number from >> a/4 // 8 to 11 ).toString(16) // in hexadecimal : ( // or otherwise a concatenated string: [1e7] + // 10000000 + -1e3 + // -1000 + -4e3 + // -4000 + -8e3 + // -80000000 + -1e11 // -100000000000, ).replace( // replacing /[018]/g, // zeroes, ones, and eights with uuid // random hex digits ) }; }, {}], 75: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var is = require('is'); /** * Expose `Sentry` integration. */ var Sentry = module.exports = integration('Sentry') .global('Raven') .option('config', '') .tag('<script src="//cdn.ravenjs.com/1.1.16/native/raven.min.js">'); /** * Initialize. * * http://raven-js.readthedocs.org/en/latest/config/index.html * https://github.com/getsentry/raven-js/blob/1.1.16/src/raven.js#L734-L741 */ Sentry.prototype.initialize = function(){ var dsn = this.options.config; window.RavenConfig = { dsn: dsn }; this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Sentry.prototype.loaded = function(){ return is.object(window.Raven); }; /** * Identify. * * @param {Identify} identify */ Sentry.prototype.identify = function(identify){ window.Raven.setUser(identify.traits()); }; }, {"analytics.js-integration":88,"is":91}], 76: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var is = require('is'); /** * Expose `SnapEngage` integration. */ var SnapEngage = module.exports = integration('SnapEngage') .assumesPageview() .global('SnapABug') .option('apiKey', '') .tag('<script src="//www.snapengage.com/cdn/js/{{ apiKey }}.js">'); /** * Initialize. * * http://help.snapengage.com/installation-guide-getting-started-in-a-snap/ * * @param {Object} page */ SnapEngage.prototype.initialize = function(page){ this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ SnapEngage.prototype.loaded = function(){ return is.object(window.SnapABug); }; /** * Identify. * * @param {Identify} identify */ SnapEngage.prototype.identify = function(identify){ var email = identify.email(); if (!email) return; window.SnapABug.setUserEmail(email); }; }, {"analytics.js-integration":88,"is":91}], 77: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var bind = require('bind'); var when = require('when'); /** * Expose `Spinnakr` integration. */ var Spinnakr = module.exports = integration('Spinnakr') .assumesPageview() .global('_spinnakr_site_id') .global('_spinnakr') .option('siteId', '') .tag('<script src="//d3ojzyhbolvoi5.cloudfront.net/js/so.js">'); /** * Initialize. * * @param {Object} page */ Spinnakr.prototype.initialize = function(page){ window._spinnakr_site_id = this.options.siteId; var loaded = bind(this, this.loaded); var ready = this.ready; this.load(function(){ when(loaded, ready); }); }; /** * Loaded? * * @return {Boolean} */ Spinnakr.prototype.loaded = function(){ return !! window._spinnakr; }; }, {"analytics.js-integration":88,"bind":101,"when":131}], 78: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var slug = require('slug'); var push = require('global-queue')('_tsq'); /** * Expose `Tapstream` integration. */ var Tapstream = module.exports = integration('Tapstream') .assumesPageview() .global('_tsq') .option('accountName', '') .option('trackAllPages', true) .option('trackNamedPages', true) .option('trackCategorizedPages', true) .tag('<script src="//cdn.tapstream.com/static/js/tapstream.js">'); /** * Initialize. * * @param {Object} page */ Tapstream.prototype.initialize = function(page){ window._tsq = window._tsq || []; push('setAccountName', this.options.accountName); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Tapstream.prototype.loaded = function(){ return !! (window._tsq && window._tsq.push !== Array.prototype.push); }; /** * Page. * * @param {Page} page */ Tapstream.prototype.page = function(page){ var category = page.category(); var opts = this.options; var name = page.fullName(); // all pages if (opts.trackAllPages) { this.track(page.track()); } // named pages if (name && opts.trackNamedPages) { this.track(page.track(name)); } // categorized pages if (category && opts.trackCategorizedPages) { this.track(page.track(category)); } }; /** * Track. * * @param {Track} track */ Tapstream.prototype.track = function(track){ var props = track.properties(); push('fireHit', slug(track.event()), [props.url]); // needs events as slugs }; }, {"analytics.js-integration":88,"slug":99,"global-queue":158}], 79: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var alias = require('alias'); var clone = require('clone'); /** * Expose `Trakio` integration. */ var Trakio = module.exports = integration('trak.io') .assumesPageview() .global('trak') .option('token', '') .option('trackNamedPages', true) .option('trackCategorizedPages', true) .tag('<script src="//d29p64779x43zo.cloudfront.net/v1/trak.io.min.js">'); /** * Options aliases. */ var optionsAliases = { initialPageview: 'auto_track_page_view' }; /** * Initialize. * * https://docs.trak.io * * @param {Object} page */ Trakio.prototype.initialize = function(page){ var options = this.options; window.trak = window.trak || []; window.trak.io = window.trak.io || {}; window.trak.push = window.trak.push || function(){}; window.trak.io.load = window.trak.io.load || function(e){var r = function(e){return function(){window.trak.push([e].concat(Array.prototype.slice.call(arguments,0))); }; } ,i=["initialize","identify","track","alias","channel","source","host","protocol","page_view"]; for (var s=0;s<i.length;s++) window.trak.io[i[s]]=r(i[s]); window.trak.io.initialize.apply(window.trak.io,arguments); }; window.trak.io.load(options.token, alias(options, optionsAliases)); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Trakio.prototype.loaded = function(){ return !! (window.trak && window.trak.loaded); }; /** * Page. * * @param {Page} page */ Trakio.prototype.page = function(page){ var category = page.category(); var props = page.properties(); var name = page.fullName(); window.trak.io.page_view(props.path, name || props.title); // named pages if (name && this.options.trackNamedPages) { this.track(page.track(name)); } // categorized pages if (category && this.options.trackCategorizedPages) { this.track(page.track(category)); } }; /** * Trait aliases. * * http://docs.trak.io/properties.html#special */ var traitAliases = { avatar: 'avatar_url', firstName: 'first_name', lastName: 'last_name' }; /** * Identify. * * @param {Identify} identify */ Trakio.prototype.identify = function(identify){ var traits = identify.traits(traitAliases); var id = identify.userId(); if (id) { window.trak.io.identify(id, traits); } else { window.trak.io.identify(traits); } }; /** * Group. * * @param {String} id (optional) * @param {Object} properties (optional) * @param {Object} options (optional) * * TODO: add group * TODO: add `trait.company/organization` from trak.io docs http://docs.trak.io/properties.html#special */ /** * Track. * * @param {Track} track */ Trakio.prototype.track = function(track){ window.trak.io.track(track.event(), track.properties()); }; /** * Alias. * * @param {Alias} alias */ Trakio.prototype.alias = function(alias){ if (!window.trak.io.distinct_id) return; var from = alias.from(); var to = alias.to(); if (to === window.trak.io.distinct_id()) return; if (from) { window.trak.io.alias(from, to); } else { window.trak.io.alias(to); } }; }, {"analytics.js-integration":88,"alias":162,"clone":95}], 80: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var each = require('each'); /** * HOP. */ var has = Object.prototype.hasOwnProperty; /** * Expose `TwitterAds`. */ var TwitterAds = module.exports = integration('Twitter Ads') .option('page', '') .tag('<img src="//analytics.twitter.com/i/adsct?txn_id={{ pixelId }}&p_id=Twitter"/>') .mapping('events'); /** * Initialize. * * @param {Object} page */ TwitterAds.prototype.initialize = function(){ this.ready(); }; /** * Page. * * @param {Page} page */ TwitterAds.prototype.page = function(page){ if (this.options.page) { this.load({ pixelId: this.options.page }); } }; /** * Track. * * @param {Track} track */ TwitterAds.prototype.track = function(track){ var events = this.events(track.event()); var self = this; each(events, function(pixelId){ self.load({ pixelId: pixelId }); }); }; }, {"analytics.js-integration":88,"each":4}], 81: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var Identify = require('facade').Identify; var clone = require('clone'); /** * Expose Userlike integration. */ var Userlike = module.exports = integration('Userlike') .assumesPageview() .global('userlikeConfig') .global('userlikeData') .option('secretKey', '') .tag('<script src="//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/{{ secretKey }}.js">'); /** * Initialize. * * @param {Object} page */ Userlike.prototype.initialize = function(page){ var self = this; var user = this.analytics.user(); var identify = new Identify({ userId: user.id(), traits: user.traits() }); segment_base_info = clone(this.options); segment_base_info.visitor = { name: identify.name(), email: identify.email() }; if (!window.userlikeData) window.userlikeData = { custom:{} } window.userlikeData.custom.segmentio = segment_base_info; this.load(function(){ self.ready(); }); }; /** * Loaded? * * @return {Boolean} */ Userlike.prototype.loaded = function(){ return !! (window.userlikeConfig && window.userlikeData); }; }, {"analytics.js-integration":88,"facade":132,"clone":95}], 82: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('UserVoice'); var convertDates = require('convert-dates'); var unix = require('to-unix-timestamp'); var alias = require('alias'); var clone = require('clone'); /** * Expose `UserVoice` integration. */ var UserVoice = module.exports = integration('UserVoice') .assumesPageview() .global('UserVoice') .global('showClassicWidget') .option('apiKey', '') .option('classic', false) .option('forumId', null) .option('showWidget', true) .option('mode', 'contact') .option('accentColor', '#448dd6') .option('screenshotEnabled', true) .option('smartvote', true) .option('trigger', null) .option('triggerPosition', 'bottom-right') .option('triggerColor', '#ffffff') .option('triggerBackgroundColor', 'rgba(46, 49, 51, 0.6)') // BACKWARDS COMPATIBILITY: classic options .option('classicMode', 'full') .option('primaryColor', '#cc6d00') .option('linkColor', '#007dbf') .option('defaultMode', 'support') .option('tabLabel', 'Feedback & Support') .option('tabColor', '#cc6d00') .option('tabPosition', 'middle-right') .option('tabInverted', false) .option('customTicketFields', {}) .tag('<script src="//widget.uservoice.com/{{ apiKey }}.js">'); /** * When in "classic" mode, on `construct` swap all of the method to point to * their classic counterparts. */ UserVoice.on('construct', function(integration){ if (!integration.options.classic) return; integration.group = undefined; integration.identify = integration.identifyClassic; integration.initialize = integration.initializeClassic; }); /** * Initialize. * * @param {Object} page */ UserVoice.prototype.initialize = function(page){ var options = this.options; var opts = formatOptions(options); push('set', opts); push('autoprompt', {}); if (options.showWidget) { options.trigger ? push('addTrigger', options.trigger, opts) : push('addTrigger', opts); } this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ UserVoice.prototype.loaded = function(){ return !! (window.UserVoice && window.UserVoice.push !== Array.prototype.push); }; /** * Identify. * * @param {Identify} identify */ UserVoice.prototype.identify = function(identify){ var traits = identify.traits({ created: 'created_at' }); traits = convertDates(traits, unix); push('identify', traits); }; /** * Group. * * @param {Group} group */ UserVoice.prototype.group = function(group){ var traits = group.traits({ created: 'created_at' }); traits = convertDates(traits, unix); push('identify', { account: traits }); }; /** * Initialize (classic). * * @param {Object} options * @param {Function} ready */ UserVoice.prototype.initializeClassic = function(){ var options = this.options; window.showClassicWidget = showClassicWidget; // part of public api if (options.showWidget) showClassicWidget('showTab', formatClassicOptions(options)); this.load(this.ready); }; /** * Identify (classic). * * @param {Identify} identify */ UserVoice.prototype.identifyClassic = function(identify){ push('setCustomFields', identify.traits()); }; /** * Format the options for UserVoice. * * @param {Object} options * @return {Object} */ function formatOptions(options){ return alias(options, { forumId: 'forum_id', accentColor: 'accent_color', smartvote: 'smartvote_enabled', triggerColor: 'trigger_color', triggerBackgroundColor: 'trigger_background_color', triggerPosition: 'trigger_position', screenshotEnabled: 'screenshot_enabled', customTicketFields: 'ticket_custom_fields' }); } /** * Format the classic options for UserVoice. * * @param {Object} options * @return {Object} */ function formatClassicOptions(options){ return alias(options, { forumId: 'forum_id', classicMode: 'mode', primaryColor: 'primary_color', tabPosition: 'tab_position', tabColor: 'tab_color', linkColor: 'link_color', defaultMode: 'default_mode', tabLabel: 'tab_label', tabInverted: 'tab_inverted' }); } /** * Show the classic version of the UserVoice widget. This method is usually part * of UserVoice classic's public API. * * @param {String} type ('showTab' or 'showLightbox') * @param {Object} options (optional) */ function showClassicWidget(type, options){ type = type || 'showLightbox'; push(type, 'classic_widget', options); } }, {"analytics.js-integration":88,"global-queue":158,"convert-dates":163,"to-unix-timestamp":193,"alias":162,"clone":95}], 193: [function(require, module, exports) { /** * Expose `toUnixTimestamp`. */ module.exports = toUnixTimestamp; /** * Convert a `date` into a Unix timestamp. * * @param {Date} * @return {Number} */ function toUnixTimestamp (date) { return Math.floor(date.getTime() / 1000); } }, {}], 83: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var push = require('global-queue')('_veroq'); var cookie = require('component/cookie'); var objCase = require('obj-case'); /** * Expose `Vero` integration. */ var Vero = module.exports = integration('Vero') .global('_veroq') .option('apiKey', '') .tag('<script src="//d3qxef4rp70elm.cloudfront.net/m.js">'); /** * Initialize. * * https://github.com/getvero/vero-api/blob/master/sections/js.md * * @param {Object} page */ Vero.prototype.initialize = function(page){ // clear default cookie so vero parses correctly. // this is for the tests. // basically, they have window.addEventListener('unload') // which then saves their "command_store", which is an array. // so we just want to create that initially so we can reload the tests. if (!cookie('__veroc4')) cookie('__veroc4', '[]'); push('init', { api_key: this.options.apiKey }); this.load(this.ready); }; /** * Loaded? * * @return {Boolean} */ Vero.prototype.loaded = function(){ return !! (window._veroq && window._veroq.push !== Array.prototype.push); }; /** * Page. * * https://www.getvero.com/knowledge-base#/questions/71768-Does-Vero-track-pageviews * * @param {Page} page */ Vero.prototype.page = function(page){ push('trackPageview'); }; /** * Identify. * * https://github.com/getvero/vero-api/blob/master/sections/js.md#user-identification * * @param {Identify} identify */ Vero.prototype.identify = function(identify){ var traits = identify.traits(); var email = identify.email(); var id = identify.userId(); if (!id || !email) return; // both required push('user', traits); }; /** * Track. * * https://github.com/getvero/vero-api/blob/master/sections/js.md#tracking-events * * @param {Track} track */ Vero.prototype.track = function(track){ var regex = /[uU]nsubscribe/; if (track.event().match(regex)) { push('unsubscribe', { id: track.properties().id }); } else { push('track', track.event(), track.properties()); } }; Vero.prototype.alias = function(alias){ var to = alias.to(); if (alias.from()) { push('reidentify', to, alias.from()); } else { push('reidentify', to); } }; }, {"analytics.js-integration":88,"global-queue":158,"component/cookie":183,"obj-case":92}], 84: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var tick = require('next-tick'); var each = require('each'); /** * Expose `VWO` integration. */ var VWO = module.exports = integration('Visual Website Optimizer') .option('replay', true); /** * Initialize. * * http://v2.visualwebsiteoptimizer.com/tools/get_tracking_code.php */ VWO.prototype.initialize = function(){ if (this.options.replay) this.replay(); this.ready(); }; /** * Replay the experiments the user has seen as traits to all other integrations. * Wait for the next tick to replay so that the `analytics` object and all of * the integrations are fully initialized. */ VWO.prototype.replay = function(){ var analytics = this.analytics; tick(function(){ experiments(function(err, traits){ if (traits) analytics.identify(traits); }); }); }; /** * Get dictionary of experiment keys and variations. * * http://visualwebsiteoptimizer.com/knowledge/integration-of-vwo-with-kissmetrics/ * * @param {Function} fn * @return {Object} */ function experiments(fn){ enqueue(function(){ var data = {}; var ids = window._vwo_exp_ids; if (!ids) return fn(); each(ids, function(id){ var name = variation(id); if (name) data['Experiment: ' + id] = name; }); fn(null, data); }); } /** * Add a `fn` to the VWO queue, creating one if it doesn't exist. * * @param {Function} fn */ function enqueue(fn){ window._vis_opt_queue = window._vis_opt_queue || []; window._vis_opt_queue.push(fn); } /** * Get the chosen variation's name from an experiment `id`. * * http://visualwebsiteoptimizer.com/knowledge/integration-of-vwo-with-kissmetrics/ * * @param {String} id * @return {String} */ function variation(id){ var experiments = window._vwo_exp; if (!experiments) return null; var experiment = experiments[id]; var variationId = experiment.combination_chosen; return variationId ? experiment.comb_n[variationId] : null; } }, {"analytics.js-integration":88,"next-tick":103,"each":4}], 85: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var useHttps = require('use-https'); /** * Expose `WebEngage` integration. */ var WebEngage = module.exports = integration('WebEngage') .assumesPageview() .global('_weq') .global('webengage') .option('widgetVersion', '4.0') .option('licenseCode', '') .tag('http', '<script src="http://cdn.widgets.webengage.com/js/widget/webengage-min-v-4.0.js">') .tag('https', '<script src="https://ssl.widgets.webengage.com/js/widget/webengage-min-v-4.0.js">'); /** * Initialize. * * @param {Object} page */ WebEngage.prototype.initialize = function(page){ var _weq = window._weq = window._weq || {}; _weq['webengage.licenseCode'] = this.options.licenseCode; _weq['webengage.widgetVersion'] = this.options.widgetVersion; var name = useHttps() ? 'https' : 'http'; this.load(name, this.ready); }; /** * Loaded? * * @return {Boolean} */ WebEngage.prototype.loaded = function(){ return !! window.webengage; }; }, {"analytics.js-integration":88,"use-https":90}], 86: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var snake = require('to-snake-case'); var isEmail = require('is-email'); var extend = require('extend'); var each = require('each'); var type = require('type'); /** * Expose `Woopra` integration. */ var Woopra = module.exports = integration('Woopra') .global('woopra') .option('domain', '') .option('cookieName', 'wooTracker') .option('cookieDomain', null) .option('cookiePath', '/') .option('ping', true) .option('pingInterval', 12000) .option('idleTimeout', 300000) .option('downloadTracking', true) .option('outgoingTracking', true) .option('outgoingIgnoreSubdomain', true) .option('downloadPause', 200) .option('outgoingPause', 400) .option('ignoreQueryUrl', true) .option('hideCampaign', false) .tag('<script src="//static.woopra.com/js/w.js">'); /** * Initialize. * * http://www.woopra.com/docs/setup/javascript-tracking/ * * @param {Object} page */ Woopra.prototype.initialize = function(page){ (function(){var i, s, z, w = window, d = document, a = arguments, q = 'script', f = ['config', 'track', 'identify', 'visit', 'push', 'call'], c = function(){var i, self = this; self._e = []; for (i = 0; i < f.length; i++){(function(f){self[f] = function(){self._e.push([f].concat(Array.prototype.slice.call(arguments, 0))); return self; }; })(f[i]); } }; w._w = w._w || {}; for (i = 0; i < a.length; i++){ w._w[a[i]] = w[a[i]] = w[a[i]] || new c(); } })('woopra'); this.load(this.ready); each(this.options, function(key, value){ key = snake(key); if (null == value) return; if ('' === value) return; window.woopra.config(key, value); }); }; /** * Loaded? * * @return {Boolean} */ Woopra.prototype.loaded = function(){ return !! (window.woopra && window.woopra.loaded); }; /** * Page. * * @param {String} category (optional) */ Woopra.prototype.page = function(page){ var props = page.properties(); var name = page.fullName(); if (name) props.title = name; window.woopra.track('pv', props); }; /** * Identify. * * @param {Identify} identify */ Woopra.prototype.identify = function(identify){ var traits = identify.traits(); if (identify.name()) traits.name = identify.name(); window.woopra.identify(traits).push(); // `push` sends it off async }; /** * Track. * * @param {Track} track */ Woopra.prototype.track = function(track){ window.woopra.track(track.event(), track.properties()); }; }, {"analytics.js-integration":88,"to-snake-case":89,"is-email":154,"extend":130,"each":4,"type":113}], 87: [function(require, module, exports) { /** * Module dependencies. */ var integration = require('analytics.js-integration'); var tick = require('next-tick'); var bind = require('bind'); var when = require('when'); /** * Expose `Yandex` integration. */ var Yandex = module.exports = integration('Yandex Metrica') .assumesPageview() .global('yandex_metrika_callbacks') .global('Ya') .option('counterId', null) .option('clickmap', false) .option('webvisor', false) .tag('<script src="//mc.yandex.ru/metrika/watch.js">'); /** * Initialize. * * http://api.yandex.com/metrika/ * https://metrica.yandex.com/22522351?step=2#tab=code * * @param {Object} page */ Yandex.prototype.initialize = function(page){ var id = this.options.counterId; var clickmap = this.options.clickmap; var webvisor = this.options.webvisor; push(function(){ window['yaCounter' + id] = new window.Ya.Metrika({ id: id, clickmap: clickmap, webvisor: webvisor }); }); var loaded = bind(this, this.loaded); var ready = this.ready; this.load(function(){ when(loaded, function(){ tick(ready); }); }); }; /** * Loaded? * * @return {Boolean} */ Yandex.prototype.loaded = function(){ return !! (window.Ya && window.Ya.Metrika); }; /** * Push a new callback on the global Yandex queue. * * @param {Function} callback */ function push(callback){ window.yandex_metrika_callbacks = window.yandex_metrika_callbacks || []; window.yandex_metrika_callbacks.push(callback); } }, {"analytics.js-integration":88,"next-tick":103,"bind":101,"when":131}], 3: [function(require, module, exports) { var _analytics = window.analytics; var after = require('after'); var bind = require('bind'); var callback = require('callback'); var clone = require('clone'); var cookie = require('./cookie'); var debug = require('debug'); var defaults = require('defaults'); var each = require('each'); var Emitter = require('emitter'); var group = require('./group'); var is = require('is'); var isEmail = require('is-email'); var isMeta = require('is-meta'); var newDate = require('new-date'); var on = require('event').bind; var pageDefaults = require('./pageDefaults'); var pick = require('pick'); var prevent = require('prevent'); var querystring = require('querystring'); var normalize = require('./normalize'); var size = require('object').length; var keys = require('object').keys; var memory = require('./memory'); var store = require('./store'); var user = require('./user'); var Facade = require('facade'); var Identify = Facade.Identify; var Group = Facade.Group; var Alias = Facade.Alias; var Track = Facade.Track; var Page = Facade.Page; /** * Expose `Analytics`. */ exports = module.exports = Analytics; /** * Expose storage. */ exports.cookie = cookie; exports.store = store; exports.memory = memory; /** * Initialize a new `Analytics` instance. */ function Analytics () { this._options({}); this.Integrations = {}; this._integrations = {}; this._readied = false; this._timeout = 300; this._user = user; // BACKWARDS COMPATIBILITY this.log = debug('analytics.js'); bind.all(this); var self = this; this.on('initialize', function(settings, options){ if (options.initialPageview) self.page(); self._parseQuery(); }); } /** * Event Emitter. */ Emitter(Analytics.prototype); /** * Use a `plugin`. * * @param {Function} plugin * @return {Analytics} */ Analytics.prototype.use = function (plugin) { plugin(this); return this; }; /** * Define a new `Integration`. * * @param {Function} Integration * @return {Analytics} */ Analytics.prototype.addIntegration = function (Integration) { var name = Integration.prototype.name; if (!name) throw new TypeError('attempted to add an invalid integration'); this.Integrations[name] = Integration; return this; }; /** * Initialize with the given integration `settings` and `options`. Aliased to * `init` for convenience. * * @param {Object} settings * @param {Object} options (optional) * @return {Analytics} */ Analytics.prototype.init = Analytics.prototype.initialize = function (settings, options) { settings = settings || {}; options = options || {}; this._options(options); this._readied = false; // clean unknown integrations from settings var self = this; each(settings, function (name) { var Integration = self.Integrations[name]; if (!Integration) delete settings[name]; }); // add integrations each(settings, function (name, opts) { var Integration = self.Integrations[name]; var integration = new Integration(clone(opts)); self.log('initialize %o - %o', name, opts); self.add(integration); }); var integrations = this._integrations; // load user now that options are set user.load(); group.load(); // make ready callback var ready = after(size(integrations), function () { self._readied = true; self.emit('ready'); }); // initialize integrations, passing ready each(integrations, function (name, integration) { if (options.initialPageview && integration.options.initialPageview === false) { integration.page = after(2, integration.page); } integration.analytics = self; integration.once('ready', ready); integration.initialize(); }); // backwards compat with angular plugin. // TODO: remove this.initialized = true; this.emit('initialize', settings, options); return this; }; /** * Set the user's `id`. * * @param {Mixed} id */ Analytics.prototype.setAnonymousId = function(id){ this.user().anonymousId(id); return this; }; /** * Add an integration. * * @param {Integration} integration */ Analytics.prototype.add = function(integration){ this._integrations[integration.name] = integration; return this; }; /** * Identify a user by optional `id` and `traits`. * * @param {String} id (optional) * @param {Object} traits (optional) * @param {Object} options (optional) * @param {Function} fn (optional) * @return {Analytics} */ Analytics.prototype.identify = function (id, traits, options, fn) { if (is.fn(options)) fn = options, options = null; if (is.fn(traits)) fn = traits, options = null, traits = null; if (is.object(id)) options = traits, traits = id, id = user.id(); // clone traits before we manipulate so we don't do anything uncouth, and take // from `user` so that we carryover anonymous traits user.identify(id, traits); var msg = this.normalize({ options: options, traits: user.traits(), userId: user.id(), }); this._invoke('identify', new Identify(msg)); // emit this.emit('identify', id, traits, options); this._callback(fn); return this; }; /** * Return the current user. * * @return {Object} */ Analytics.prototype.user = function () { return user; }; /** * Identify a group by optional `id` and `traits`. Or, if no arguments are * supplied, return the current group. * * @param {String} id (optional) * @param {Object} traits (optional) * @param {Object} options (optional) * @param {Function} fn (optional) * @return {Analytics or Object} */ Analytics.prototype.group = function (id, traits, options, fn) { if (0 === arguments.length) return group; if (is.fn(options)) fn = options, options = null; if (is.fn(traits)) fn = traits, options = null, traits = null; if (is.object(id)) options = traits, traits = id, id = group.id(); // grab from group again to make sure we're taking from the source group.identify(id, traits); var msg = this.normalize({ options: options, traits: group.traits(), groupId: group.id() }); this._invoke('group', new Group(msg)); this.emit('group', id, traits, options); this._callback(fn); return this; }; /** * Track an `event` that a user has triggered with optional `properties`. * * @param {String} event * @param {Object} properties (optional) * @param {Object} options (optional) * @param {Function} fn (optional) * @return {Analytics} */ Analytics.prototype.track = function (event, properties, options, fn) { if (is.fn(options)) fn = options, options = null; if (is.fn(properties)) fn = properties, options = null, properties = null; // figure out if the event is archived. var plan = this.options.plan || {}; var events = plan.track || {}; // normalize var msg = this.normalize({ properties: properties, options: options, event: event }); // plan. if (plan = events[event]) { this.log('plan %o - %o', event, plan); if (false == plan.enabled) return this._callback(fn); defaults(msg.integrations, plan.integrations || {}); } this._invoke('track', new Track(msg)); this.emit('track', event, properties, options); this._callback(fn); return this; }; /** * Helper method to track an outbound link that would normally navigate away * from the page before the analytics calls were sent. * * BACKWARDS COMPATIBILITY: aliased to `trackClick`. * * @param {Element or Array} links * @param {String or Function} event * @param {Object or Function} properties (optional) * @return {Analytics} */ Analytics.prototype.trackClick = Analytics.prototype.trackLink = function (links, event, properties) { if (!links) return this; if (is.element(links)) links = [links]; // always arrays, handles jquery var self = this; each(links, function (el) { if (!is.element(el)) throw new TypeError('Must pass HTMLElement to `analytics.trackLink`.'); on(el, 'click', function (e) { var ev = is.fn(event) ? event(el) : event; var props = is.fn(properties) ? properties(el) : properties; var href = el.getAttribute('href') || el.getAttributeNS('http://www.w3.org/1999/xlink', 'href') || el.getAttribute('xlink:href'); self.track(ev, props); if (href && el.target !== '_blank' && !isMeta(e)) { prevent(e); self._callback(function () { window.location.href = href; }); } }); }); return this; }; /** * Helper method to track an outbound form that would normally navigate away * from the page before the analytics calls were sent. * * BACKWARDS COMPATIBILITY: aliased to `trackSubmit`. * * @param {Element or Array} forms * @param {String or Function} event * @param {Object or Function} properties (optional) * @return {Analytics} */ Analytics.prototype.trackSubmit = Analytics.prototype.trackForm = function (forms, event, properties) { if (!forms) return this; if (is.element(forms)) forms = [forms]; // always arrays, handles jquery var self = this; each(forms, function (el) { if (!is.element(el)) throw new TypeError('Must pass HTMLElement to `analytics.trackForm`.'); function handler (e) { prevent(e); var ev = is.fn(event) ? event(el) : event; var props = is.fn(properties) ? properties(el) : properties; self.track(ev, props); self._callback(function () { el.submit(); }); } // support the events happening through jQuery or Zepto instead of through // the normal DOM API, since `el.submit` doesn't bubble up events... var $ = window.jQuery || window.Zepto; if ($) { $(el).submit(handler); } else { on(el, 'submit', handler); } }); return this; }; /** * Trigger a pageview, labeling the current page with an optional `category`, * `name` and `properties`. * * @param {String} category (optional) * @param {String} name (optional) * @param {Object or String} properties (or path) (optional) * @param {Object} options (optional) * @param {Function} fn (optional) * @return {Analytics} */ Analytics.prototype.page = function (category, name, properties, options, fn) { if (is.fn(options)) fn = options, options = null; if (is.fn(properties)) fn = properties, options = properties = null; if (is.fn(name)) fn = name, options = properties = name = null; if (is.object(category)) options = name, properties = category, name = category = null; if (is.object(name)) options = properties, properties = name, name = null; if (is.string(category) && !is.string(name)) name = category, category = null; properties = clone(properties) || {}; if (name) properties.name = name; if (category) properties.category = category; // Ensure properties has baseline spec properties. // TODO: Eventually move these entirely to `options.context.page` var defs = pageDefaults(); defaults(properties, defs); // Mirror user overrides to `options.context.page` (but exclude custom properties) // (Any page defaults get applied in `this.normalize` for consistency.) // Weird, yeah--moving special props to `context.page` will fix this in the long term. var overrides = pick(keys(defs), properties); if (!is.empty(overrides)) { options = options || {}; options.context = options.context || {}; options.context.page = overrides; } var msg = this.normalize({ properties: properties, category: category, options: options, name: name }); this._invoke('page', new Page(msg)); this.emit('page', category, name, properties, options); this._callback(fn); return this; }; /** * BACKWARDS COMPATIBILITY: convert an old `pageview` to a `page` call. * * @param {String} url (optional) * @param {Object} options (optional) * @return {Analytics} * @api private */ Analytics.prototype.pageview = function (url, options) { var properties = {}; if (url) properties.path = url; this.page(properties); return this; }; /** * Merge two previously unassociated user identities. * * @param {String} to * @param {String} from (optional) * @param {Object} options (optional) * @param {Function} fn (optional) * @return {Analytics} */ Analytics.prototype.alias = function (to, from, options, fn) { if (is.fn(options)) fn = options, options = null; if (is.fn(from)) fn = from, options = null, from = null; if (is.object(from)) options = from, from = null; var msg = this.normalize({ options: options, previousId: from, userId: to }); this._invoke('alias', new Alias(msg)); this.emit('alias', to, from, options); this._callback(fn); return this; }; /** * Register a `fn` to be fired when all the analytics services are ready. * * @param {Function} fn * @return {Analytics} */ Analytics.prototype.ready = function (fn) { if (!is.fn(fn)) return this; this._readied ? callback.async(fn) : this.once('ready', fn); return this; }; /** * Set the `timeout` (in milliseconds) used for callbacks. * * @param {Number} timeout */ Analytics.prototype.timeout = function (timeout) { this._timeout = timeout; }; /** * Enable or disable debug. * * @param {String or Boolean} str */ Analytics.prototype.debug = function(str){ if (0 == arguments.length || str) { debug.enable('analytics:' + (str || '*')); } else { debug.disable(); } }; /** * Apply options. * * @param {Object} options * @return {Analytics} * @api private */ Analytics.prototype._options = function (options) { options = options || {}; this.options = options; cookie.options(options.cookie); store.options(options.localStorage); user.options(options.user); group.options(options.group); return this; }; /** * Callback a `fn` after our defined timeout period. * * @param {Function} fn * @return {Analytics} * @api private */ Analytics.prototype._callback = function (fn) { callback.async(fn, this._timeout); return this; }; /** * Call `method` with `facade` on all enabled integrations. * * @param {String} method * @param {Facade} facade * @return {Analytics} * @api private */ Analytics.prototype._invoke = function (method, facade) { var options = facade.options(); this.emit('invoke', facade); each(this._integrations, function (name, integration) { if (!facade.enabled(name)) return; integration.invoke.call(integration, method, facade); }); return this; }; /** * Push `args`. * * @param {Array} args * @api private */ Analytics.prototype.push = function(args){ var method = args.shift(); if (!this[method]) return; this[method].apply(this, args); }; /** * Reset group and user traits and id's. * * @api public */ Analytics.prototype.reset = function(){ this.user().logout(); this.group().logout(); }; /** * Parse the query string for callable methods. * * @return {Analytics} * @api private */ Analytics.prototype._parseQuery = function () { // Identify and track any `ajs_uid` and `ajs_event` parameters in the URL. var q = querystring.parse(window.location.search); if (q.ajs_uid) this.identify(q.ajs_uid); if (q.ajs_event) this.track(q.ajs_event); if (q.ajs_aid) user.anonymousId(q.ajs_aid); return this; }; /** * Normalize the given `msg`. * * @param {Object} msg * @return {Object} */ Analytics.prototype.normalize = function(msg){ msg = normalize(msg, keys(this._integrations)); if (msg.anonymousId) user.anonymousId(msg.anonymousId); msg.anonymousId = user.anonymousId(); // Ensure all outgoing requests include page data in their contexts. msg.context.page = defaults(msg.context.page || {}, pageDefaults()); return msg; }; /** * No conflict support. */ Analytics.prototype.noConflict = function(){ window.analytics = _analytics; return this; }; }, {"after":111,"bind":194,"callback":94,"clone":95,"./cookie":195,"debug":190,"defaults":97,"each":4,"emitter":110,"./group":196,"is":91,"is-email":154,"is-meta":197,"new-date":146,"event":198,"./pageDefaults":199,"pick":200,"prevent":201,"querystring":202,"./normalize":203,"object":170,"./memory":204,"./store":205,"./user":206,"facade":132}], 194: [function(require, module, exports) { try { var bind = require('bind'); } catch (e) { var bind = require('bind-component'); } var bindAll = require('bind-all'); /** * Expose `bind`. */ module.exports = exports = bind; /** * Expose `bindAll`. */ exports.all = bindAll; /** * Expose `bindMethods`. */ exports.methods = bindMethods; /** * Bind `methods` on `obj` to always be called with the `obj` as context. * * @param {Object} obj * @param {String} methods... */ function bindMethods (obj, methods) { methods = [].slice.call(arguments, 1); for (var i = 0, method; method = methods[i]; i++) { obj[method] = bind(obj, obj[method]); } return obj; } }, {"bind":101,"bind-all":102}], 195: [function(require, module, exports) { var debug = require('debug')('analytics.js:cookie'); var bind = require('bind'); var cookie = require('cookie'); var clone = require('clone'); var defaults = require('defaults'); var json = require('json'); var topDomain = require('top-domain'); /** * Initialize a new `Cookie` with `options`. * * @param {Object} options */ function Cookie (options) { this.options(options); } /** * Get or set the cookie options. * * @param {Object} options * @field {Number} maxage (1 year) * @field {String} domain * @field {String} path * @field {Boolean} secure */ Cookie.prototype.options = function (options) { if (arguments.length === 0) return this._options; options = options || {}; var domain = '.' + topDomain(window.location.href); this._options = defaults(options, { maxage: 31536000000, // default to a year path: '/', domain: domain }); // http://curl.haxx.se/rfc/cookie_spec.html // https://publicsuffix.org/list/effective_tld_names.dat // // try setting a dummy cookie with the options // if the cookie isn't set, it probably means // that the domain is on the public suffix list // like myapp.herokuapp.com or localhost / ip. this.set('ajs:test', true); if (!this.get('ajs:test')) { debug('fallback to domain=null'); this._options.domain = null; } this.remove('ajs:test'); }; /** * Set a `key` and `value` in our cookie. * * @param {String} key * @param {Object} value * @return {Boolean} saved */ Cookie.prototype.set = function (key, value) { try { value = json.stringify(value); cookie(key, value, clone(this._options)); return true; } catch (e) { return false; } }; /** * Get a value from our cookie by `key`. * * @param {String} key * @return {Object} value */ Cookie.prototype.get = function (key) { try { var value = cookie(key); value = value ? json.parse(value) : null; return value; } catch (e) { return null; } }; /** * Remove a value from our cookie by `key`. * * @param {String} key * @return {Boolean} removed */ Cookie.prototype.remove = function (key) { try { cookie(key, null, clone(this._options)); return true; } catch (e) { return false; } }; /** * Expose the cookie singleton. */ module.exports = bind.all(new Cookie()); /** * Expose the `Cookie` constructor. */ module.exports.Cookie = Cookie; }, {"debug":190,"bind":194,"cookie":183,"clone":95,"defaults":97,"json":164,"top-domain":124}], 196: [function(require, module, exports) { var debug = require('debug')('analytics:group'); var Entity = require('./entity'); var inherit = require('inherit'); var bind = require('bind'); /** * Group defaults */ Group.defaults = { persist: true, cookie: { key: 'ajs_group_id' }, localStorage: { key: 'ajs_group_properties' } }; /** * Initialize a new `Group` with `options`. * * @param {Object} options */ function Group (options) { this.defaults = Group.defaults; this.debug = debug; Entity.call(this, options); } /** * Inherit `Entity` */ inherit(Group, Entity); /** * Expose the group singleton. */ module.exports = bind.all(new Group()); /** * Expose the `Group` constructor. */ module.exports.Group = Group; }, {"debug":190,"./entity":207,"inherit":208,"bind":194}], 207: [function(require, module, exports) { var debug = require('debug')('analytics:entity'); var traverse = require('isodate-traverse'); var defaults = require('defaults'); var memory = require('./memory'); var cookie = require('./cookie'); var store = require('./store'); var extend = require('extend'); var clone = require('clone'); /** * Expose `Entity` */ module.exports = Entity; /** * Initialize new `Entity` with `options`. * * @param {Object} options */ function Entity(options){ this.options(options); this.initialize(); } /** * Initialize picks the storage. * * Checks to see if cookies can be set * otherwise fallsback to localStorage. */ Entity.prototype.initialize = function(){ cookie.set('ajs:cookies', true); // cookies are enabled. if (cookie.get('ajs:cookies')) { cookie.remove('ajs:cookies'); this._storage = cookie; return; } // localStorage is enabled. if (store.enabled) { this._storage = store; return; } // fallback to memory storage. debug('warning using memory store both cookies and localStorage are disabled'); this._storage = memory; }; /** * Get the storage. */ Entity.prototype.storage = function(){ return this._storage; }; /** * Get or set storage `options`. * * @param {Object} options * @property {Object} cookie * @property {Object} localStorage * @property {Boolean} persist (default: `true`) */ Entity.prototype.options = function (options) { if (arguments.length === 0) return this._options; options || (options = {}); defaults(options, this.defaults || {}); this._options = options; }; /** * Get or set the entity's `id`. * * @param {String} id */ Entity.prototype.id = function (id) { switch (arguments.length) { case 0: return this._getId(); case 1: return this._setId(id); } }; /** * Get the entity's id. * * @return {String} */ Entity.prototype._getId = function () { var ret = this._options.persist ? this.storage().get(this._options.cookie.key) : this._id; return ret === undefined ? null : ret; }; /** * Set the entity's `id`. * * @param {String} id */ Entity.prototype._setId = function (id) { if (this._options.persist) { this.storage().set(this._options.cookie.key, id); } else { this._id = id; } }; /** * Get or set the entity's `traits`. * * BACKWARDS COMPATIBILITY: aliased to `properties` * * @param {Object} traits */ Entity.prototype.properties = Entity.prototype.traits = function (traits) { switch (arguments.length) { case 0: return this._getTraits(); case 1: return this._setTraits(traits); } }; /** * Get the entity's traits. Always convert ISO date strings into real dates, * since they aren't parsed back from local storage. * * @return {Object} */ Entity.prototype._getTraits = function () { var ret = this._options.persist ? store.get(this._options.localStorage.key) : this._traits; return ret ? traverse(clone(ret)) : {}; }; /** * Set the entity's `traits`. * * @param {Object} traits */ Entity.prototype._setTraits = function (traits) { traits || (traits = {}); if (this._options.persist) { store.set(this._options.localStorage.key, traits); } else { this._traits = traits; } }; /** * Identify the entity with an `id` and `traits`. If we it's the same entity, * extend the existing `traits` instead of overwriting. * * @param {String} id * @param {Object} traits */ Entity.prototype.identify = function (id, traits) { traits || (traits = {}); var current = this.id(); if (current === null || current === id) traits = extend(this.traits(), traits); if (id) this.id(id); this.debug('identify %o, %o', id, traits); this.traits(traits); this.save(); }; /** * Save the entity to local storage and the cookie. * * @return {Boolean} */ Entity.prototype.save = function () { if (!this._options.persist) return false; cookie.set(this._options.cookie.key, this.id()); store.set(this._options.localStorage.key, this.traits()); return true; }; /** * Log the entity out, reseting `id` and `traits` to defaults. */ Entity.prototype.logout = function () { this.id(null); this.traits({}); cookie.remove(this._options.cookie.key); store.remove(this._options.localStorage.key); }; /** * Reset all entity state, logging out and returning options to defaults. */ Entity.prototype.reset = function () { this.logout(); this.options({}); }; /** * Load saved entity `id` or `traits` from storage. */ Entity.prototype.load = function () { this.id(cookie.get(this._options.cookie.key)); this.traits(store.get(this._options.localStorage.key)); }; }, {"debug":190,"isodate-traverse":142,"defaults":97,"./memory":204,"./cookie":195,"./store":205,"extend":130,"clone":95}], 204: [function(require, module, exports) { /** * Module Dependencies. */ var clone = require('clone'); var bind = require('bind'); /** * HOP. */ var has = Object.prototype.hasOwnProperty; /** * Expose `Memory` */ module.exports = bind.all(new Memory); /** * Initialize `Memory` store */ function Memory(){ this.store = {}; } /** * Set a `key` and `value`. * * @param {String} key * @param {Mixed} value * @return {Boolean} */ Memory.prototype.set = function(key, value){ this.store[key] = clone(value); return true; }; /** * Get a `key`. * * @param {String} key */ Memory.prototype.get = function(key){ if (!has.call(this.store, key)) return; return clone(this.store[key]); }; /** * Remove a `key`. * * @param {String} key * @return {Boolean} */ Memory.prototype.remove = function(key){ delete this.store[key]; return true; }; }, {"clone":95,"bind":194}], 205: [function(require, module, exports) { var bind = require('bind'); var defaults = require('defaults'); var store = require('store.js'); /** * Initialize a new `Store` with `options`. * * @param {Object} options */ function Store (options) { this.options(options); } /** * Set the `options` for the store. * * @param {Object} options * @field {Boolean} enabled (true) */ Store.prototype.options = function (options) { if (arguments.length === 0) return this._options; options = options || {}; defaults(options, { enabled : true }); this.enabled = options.enabled && store.enabled; this._options = options; }; /** * Set a `key` and `value` in local storage. * * @param {String} key * @param {Object} value */ Store.prototype.set = function (key, value) { if (!this.enabled) return false; return store.set(key, value); }; /** * Get a value from local storage by `key`. * * @param {String} key * @return {Object} */ Store.prototype.get = function (key) { if (!this.enabled) return null; return store.get(key); }; /** * Remove a value from local storage by `key`. * * @param {String} key */ Store.prototype.remove = function (key) { if (!this.enabled) return false; return store.remove(key); }; /** * Expose the store singleton. */ module.exports = bind.all(new Store()); /** * Expose the `Store` constructor. */ module.exports.Store = Store; }, {"bind":194,"defaults":97,"store.js":209}], 209: [function(require, module, exports) { var json = require('json') , store = {} , win = window , doc = win.document , localStorageName = 'localStorage' , namespace = '__storejs__' , storage; store.disabled = false store.set = function(key, value) {} store.get = function(key) {} store.remove = function(key) {} store.clear = function() {} store.transact = function(key, defaultVal, transactionFn) { var val = store.get(key) if (transactionFn == null) { transactionFn = defaultVal defaultVal = null } if (typeof val == 'undefined') { val = defaultVal || {} } transactionFn(val) store.set(key, val) } store.getAll = function() {} store.serialize = function(value) { return json.stringify(value) } store.deserialize = function(value) { if (typeof value != 'string') { return undefined } try { return json.parse(value) } catch(e) { return value || undefined } } // Functions to encapsulate questionable FireFox 3.6.13 behavior // when about.config::dom.storage.enabled === false // See https://github.com/marcuswestin/store.js/issues#issue/13 function isLocalStorageNameSupported() { try { return (localStorageName in win && win[localStorageName]) } catch(err) { return false } } if (isLocalStorageNameSupported()) { storage = win[localStorageName] store.set = function(key, val) { if (val === undefined) { return store.remove(key) } storage.setItem(key, store.serialize(val)) return val } store.get = function(key) { return store.deserialize(storage.getItem(key)) } store.remove = function(key) { storage.removeItem(key) } store.clear = function() { storage.clear() } store.getAll = function() { var ret = {} for (var i=0; i<storage.length; ++i) { var key = storage.key(i) ret[key] = store.get(key) } return ret } } else if (doc.documentElement.addBehavior) { var storageOwner, storageContainer // Since #userData storage applies only to specific paths, we need to // somehow link our data to a specific path. We choose /favicon.ico // as a pretty safe option, since all browsers already make a request to // this URL anyway and being a 404 will not hurt us here. We wrap an // iframe pointing to the favicon in an ActiveXObject(htmlfile) object // (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx) // since the iframe access rules appear to allow direct access and // manipulation of the document element, even for a 404 page. This // document can be used instead of the current document (which would // have been limited to the current path) to perform #userData storage. try { storageContainer = new ActiveXObject('htmlfile') storageContainer.open() storageContainer.write('<s' + 'cript>document.w=window</s' + 'cript><iframe src="/favicon.ico"></iframe>') storageContainer.close() storageOwner = storageContainer.w.frames[0].document storage = storageOwner.createElement('div') } catch(e) { // somehow ActiveXObject instantiation failed (perhaps some special // security settings or otherwse), fall back to per-path storage storage = doc.createElement('div') storageOwner = doc.body } function withIEStorage(storeFunction) { return function() { var args = Array.prototype.slice.call(arguments, 0) args.unshift(storage) // See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx // and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx storageOwner.appendChild(storage) storage.addBehavior('#default#userData') storage.load(localStorageName) var result = storeFunction.apply(store, args) storageOwner.removeChild(storage) return result } } // In IE7, keys may not contain special chars. See all of https://github.com/marcuswestin/store.js/issues/40 var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g") function ieKeyFix(key) { return key.replace(forbiddenCharsRegex, '___') } store.set = withIEStorage(function(storage, key, val) { key = ieKeyFix(key) if (val === undefined) { return store.remove(key) } storage.setAttribute(key, store.serialize(val)) storage.save(localStorageName) return val }) store.get = withIEStorage(function(storage, key) { key = ieKeyFix(key) return store.deserialize(storage.getAttribute(key)) }) store.remove = withIEStorage(function(storage, key) { key = ieKeyFix(key) storage.removeAttribute(key) storage.save(localStorageName) }) store.clear = withIEStorage(function(storage) { var attributes = storage.XMLDocument.documentElement.attributes storage.load(localStorageName) for (var i=0, attr; attr=attributes[i]; i++) { storage.removeAttribute(attr.name) } storage.save(localStorageName) }) store.getAll = withIEStorage(function(storage) { var attributes = storage.XMLDocument.documentElement.attributes var ret = {} for (var i=0, attr; attr=attributes[i]; ++i) { var key = ieKeyFix(attr.name) ret[attr.name] = store.deserialize(storage.getAttribute(key)) } return ret }) } try { store.set(namespace, namespace) if (store.get(namespace) != namespace) { store.disabled = true } store.remove(namespace) } catch(e) { store.disabled = true } store.enabled = !store.disabled module.exports = store; }, {"json":164}], 208: [function(require, module, exports) { module.exports = function(a, b){ var fn = function(){}; fn.prototype = b.prototype; a.prototype = new fn; a.prototype.constructor = a; }; }, {}], 197: [function(require, module, exports) { module.exports = function isMeta (e) { if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return true; // Logic that handles checks for the middle mouse button, based // on [jQuery](https://github.com/jquery/jquery/blob/master/src/event.js#L466). var which = e.which, button = e.button; if (!which && button !== undefined) { return (!button & 1) && (!button & 2) && (button & 4); } else if (which === 2) { return true; } return false; }; }, {}], 198: [function(require, module, exports) { /** * Bind `el` event `type` to `fn`. * * @param {Element} el * @param {String} type * @param {Function} fn * @param {Boolean} capture * @return {Function} * @api public */ exports.bind = function(el, type, fn, capture){ if (el.addEventListener) { el.addEventListener(type, fn, capture || false); } else { el.attachEvent('on' + type, fn); } return fn; }; /** * Unbind `el` event `type`'s callback `fn`. * * @param {Element} el * @param {String} type * @param {Function} fn * @param {Boolean} capture * @return {Function} * @api public */ exports.unbind = function(el, type, fn, capture){ if (el.removeEventListener) { el.removeEventListener(type, fn, capture || false); } else { el.detachEvent('on' + type, fn); } return fn; }; }, {}], 199: [function(require, module, exports) { /** * Module dependencies. */ var canonical = require('canonical'); var url = require('url'); /** * Return a default `options.context.page` object. * * https://segment.com/docs/spec/page/#properties * * @return {Object} */ function pageDefaults() { return { path: canonicalPath(), referrer: document.referrer, search: location.search, title: document.title, url: canonicalUrl(location.search) }; } /** * Return the canonical path for the page. * * @return {String} */ function canonicalPath () { var canon = canonical(); if (!canon) return window.location.pathname; var parsed = url.parse(canon); return parsed.pathname; } /** * Return the canonical URL for the page concat the given `search` * and strip the hash. * * @param {String} search * @return {String} */ function canonicalUrl (search) { var canon = canonical(); if (canon) return ~canon.indexOf('?') ? canon : canon + search; var url = window.location.href; var i = url.indexOf('#'); return -1 === i ? url : url.slice(0, i); } /** * Exports. */ module.exports = pageDefaults; }, {"canonical":171,"url":173}], 200: [function(require, module, exports) { 'use strict'; var objToString = Object.prototype.toString; // TODO: Move to lib var existy = function(val) { return val != null; }; // TODO: Move to lib var isArray = function(val) { return objToString.call(val) === '[object Array]'; }; // TODO: Move to lib var isString = function(val) { return typeof val === 'string' || objToString.call(val) === '[object String]'; }; // TODO: Move to lib var isObject = function(val) { return val != null && typeof val === 'object'; }; /** * Returns a copy of the new `object` containing only the specified properties. * * @name pick * @api public * @category Object * @see {@link omit} * @param {Array.<string>|string} props The property or properties to keep. * @param {Object} object The object to iterate over. * @return {Object} A new object containing only the specified properties from `object`. * @example * var person = { name: 'Tim', occupation: 'enchanter', fears: 'rabbits' }; * * pick('name', person); * //=> { name: 'Tim' } * * pick(['name', 'fears'], person); * //=> { name: 'Tim', fears: 'rabbits' } */ var pick = function pick(props, object) { if (!existy(object) || !isObject(object)) { return {}; } if (isString(props)) { props = [props]; } if (!isArray(props)) { props = []; } var result = {}; for (var i = 0; i < props.length; i += 1) { if (isString(props[i]) && props[i] in object) { result[props[i]] = object[props[i]]; } } return result; }; /** * Exports. */ module.exports = pick; }, {}], 201: [function(require, module, exports) { /** * prevent default on the given `e`. * * examples: * * anchor.onclick = prevent; * anchor.onclick = function(e){ * if (something) return prevent(e); * }; * * @param {Event} e */ module.exports = function(e){ e = e || window.event return e.preventDefault ? e.preventDefault() : e.returnValue = false; }; }, {}], 202: [function(require, module, exports) { /** * Module dependencies. */ var encode = encodeURIComponent; var decode = decodeURIComponent; var trim = require('trim'); var type = require('type'); /** * Parse the given query `str`. * * @param {String} str * @return {Object} * @api public */ exports.parse = function(str){ if ('string' != typeof str) return {}; str = trim(str); if ('' == str) return {}; if ('?' == str.charAt(0)) str = str.slice(1); var obj = {}; var pairs = str.split('&'); for (var i = 0; i < pairs.length; i++) { var parts = pairs[i].split('='); var key = decode(parts[0]); var m; if (m = /(\w+)\[(\d+)\]/.exec(key)) { obj[m[1]] = obj[m[1]] || []; obj[m[1]][m[2]] = decode(parts[1]); continue; } obj[parts[0]] = null == parts[1] ? '' : decode(parts[1]); } return obj; }; /** * Stringify the given `obj`. * * @param {Object} obj * @return {String} * @api public */ exports.stringify = function(obj){ if (!obj) return ''; var pairs = []; for (var key in obj) { var value = obj[key]; if ('array' == type(value)) { for (var i = 0; i < value.length; ++i) { pairs.push(encode(key + '[' + i + ']') + '=' + encode(value[i])); } continue; } pairs.push(encode(key) + '=' + encode(obj[key])); } return pairs.join('&'); }; }, {"trim":126,"type":7}], 203: [function(require, module, exports) { /** * Module Dependencies. */ var debug = require('debug')('analytics.js:normalize'); var indexof = require('component/indexof'); var defaults = require('defaults'); var map = require('component/map'); var each = require('each'); var is = require('is'); /** * HOP. */ var has = Object.prototype.hasOwnProperty; /** * Expose `normalize` */ module.exports = normalize; /** * Toplevel properties. */ var toplevel = [ 'integrations', 'anonymousId', 'timestamp', 'context' ]; /** * Normalize `msg` based on integrations `list`. * * @param {Object} msg * @param {Array} list * @return {Function} */ function normalize(msg, list){ var lower = map(list, function(s){ return s.toLowerCase(); }); var opts = msg.options || {}; var integrations = opts.integrations || {}; var providers = opts.providers || {}; var context = opts.context || {}; var ret = {}; debug('<-', msg); // integrations. each(opts, function(key, value){ if (!integration(key)) return; if (!has.call(integrations, key)) integrations[key] = value; delete opts[key]; }); // providers. delete opts.providers; each(providers, function(key, value){ if (!integration(key)) return; if (is.object(integrations[key])) return; if (has.call(integrations, key) && 'boolean' == typeof providers[key]) return; integrations[key] = value; }); // move all toplevel options to msg // and the rest to context. each(opts, function(key){ if (~indexof(toplevel, key)) { ret[key] = opts[key]; } else { context[key] = opts[key]; } }); // cleanup delete msg.options; ret.integrations = integrations; ret.context = context; ret = defaults(ret, msg); debug('->', ret); return ret; function integration(name){ return !! (~indexof(list, name) || 'all' == name.toLowerCase() || ~indexof(lower, name.toLowerCase())); } } }, {"debug":190,"component/indexof":116,"defaults":97,"component/map":210,"each":4,"is":91}], 210: [function(require, module, exports) { /** * Module dependencies. */ var toFunction = require('to-function'); /** * Map the given `arr` with callback `fn(val, i)`. * * @param {Array} arr * @param {Function} fn * @return {Array} * @api public */ module.exports = function(arr, fn){ var ret = []; fn = toFunction(fn); for (var i = 0; i < arr.length; ++i) { ret.push(fn(arr[i], i)); } return ret; }; }, {"to-function":174}], 206: [function(require, module, exports) { var debug = require('debug')('analytics:user'); var Entity = require('./entity'); var inherit = require('inherit'); var bind = require('bind'); var cookie = require('./cookie'); var uuid = require('uuid'); var rawCookie = require('cookie'); /** * User defaults */ User.defaults = { persist: true, cookie: { key: 'ajs_user_id', oldKey: 'ajs_user' }, localStorage: { key: 'ajs_user_traits' } }; /** * Initialize a new `User` with `options`. * * @param {Object} options */ function User (options) { this.defaults = User.defaults; this.debug = debug; Entity.call(this, options); } /** * Inherit `Entity` */ inherit(User, Entity); /** * Set / get the user id. * * When the user id changes, the method will * reset his anonymousId to a new one. * * Example: * * // didn't change because the user didn't have previous id. * anonId = user.anonymousId(); * user.id('foo'); * assert.equal(anonId, user.anonymousId()); * * // didn't change because the user id changed to null. * anonId = user.anonymousId(); * user.id('foo'); * user.id(null); * assert.equal(anonId, user.anonymousId()); * * // change because the user had previous id. * anonId = user.anonymousId(); * user.id('foo'); * user.id('baz'); // triggers change * user.id('baz'); // no change * assert.notEqual(anonId, user.anonymousId()); * * @param {String} id * @return {Mixed} */ User.prototype.id = function(id){ var prev = this._getId(); var ret = Entity.prototype.id.apply(this, arguments); if (null == prev) return ret; if (prev != id && id) this.anonymousId(null); return ret; }; /** * Set / get / remove anonymousId. * * @param {String} anonId * @return {String|User} */ User.prototype.anonymousId = function(anonId){ var store = this.storage(); // set / remove if (arguments.length) { store.set('ajs_anonymous_id', anonId); return this; } // new if (anonId = store.get('ajs_anonymous_id')) { return anonId; } // old - it is not stringified so we use the raw cookie. if (anonId = rawCookie('_sio')) { anonId = anonId.split('----')[0]; store.set('ajs_anonymous_id', anonId); store.remove('_sio'); return anonId; } // empty anonId = uuid(); store.set('ajs_anonymous_id', anonId); return store.get('ajs_anonymous_id'); }; /** * Remove anonymous id on logout too. */ User.prototype.logout = function(){ Entity.prototype.logout.call(this); this.anonymousId(null); }; /** * Load saved user `id` or `traits` from storage. */ User.prototype.load = function () { if (this._loadOldCookie()) return; Entity.prototype.load.call(this); }; /** * BACKWARDS COMPATIBILITY: Load the old user from the cookie. * * @return {Boolean} * @api private */ User.prototype._loadOldCookie = function () { var user = cookie.get(this._options.cookie.oldKey); if (!user) return false; this.id(user.id); this.traits(user.traits); cookie.remove(this._options.cookie.oldKey); return true; }; /** * Expose the user singleton. */ module.exports = bind.all(new User()); /** * Expose the `User` constructor. */ module.exports.User = User; }, {"debug":190,"./entity":207,"inherit":208,"bind":194,"./cookie":195,"uuid":184,"cookie":183}], 5: [function(require, module, exports) { module.exports = { "name": "analytics", "version": "2.8.3", "main": "analytics.js", "dependencies": {}, "devDependencies": {} }; }, {}]}, {}, {"1":""}) );
src/screen/Oscilloscope/components/Graph.js
wavicles/fossasia-pslab-apps
import React, { Component } from 'react'; import { ResponsiveContainer, Line, LineChart, XAxis, YAxis, CartesianGrid, Tooltip, Legend, Label, } from 'recharts'; import { withTheme } from 'styled-components'; import { GraphWrapper } from './Settings.styles'; const electron = window.require('electron'); const { ipcRenderer } = electron; class Graph extends Component { constructor(props) { super(props); this.state = { oscData: [ { ch1: 0, ch2: 0, ch3: 0, ch4: 0, time: 0, }, ], }; } componentDidMount() { ipcRenderer.on('OSC_VOLTAGE_DATA', (event, args) => { const { isReading } = this.props; isReading && this.setState({ oscData: args.data, }); }); } componentWillUnmount() { ipcRenderer.removeAllListeners('OSC_VOLTAGE_DATA'); } render() { const { activeChannels, timeBase, channelRanges, theme } = this.props; const { oscData } = this.state; return ( <GraphWrapper> <ResponsiveContainer> <LineChart data={oscData} margin={{ top: 48, right: 0, left: 0, bottom: 32, }} > <CartesianGrid strokeDasharray="3 3" /> <XAxis dataKey="time" type="number" tickCount={11} domain={[0, 10 * timeBase]} > <Label value="mSec" position="bottom" /> </XAxis> <YAxis yAxisId="left" domain={[ -1 * parseInt(channelRanges.ch1, 10), parseInt(channelRanges.ch1, 10), ]} allowDataOverflow={true} label="V" /> <YAxis yAxisId="right" domain={[ -1 * parseInt(channelRanges.ch2, 10), parseInt(channelRanges.ch2, 10), ]} orientation="right" allowDataOverflow={true} /> <Tooltip /> <Legend align="right" iconType="triangle" /> {activeChannels.ch1 && ( <Line yAxisId="left" type="monotone" dataKey="ch1" stroke={theme.ch1Color} dot={false} activeDot={{ r: 4 }} /> )} {activeChannels.ch2 && ( <Line yAxisId="right" type="monotone" dataKey="ch2" stroke={theme.ch2Color} dot={false} activeDot={{ r: 4 }} /> )} {activeChannels.ch3 && ( <Line yAxisId="left" type="monotone" dataKey="ch3" stroke={theme.ch3Color} dot={false} activeDot={{ r: 4 }} /> )} {activeChannels.mic && ( <Line yAxisId="left" type="monotone" dataKey="mic" stroke={theme.micColor} dot={false} activeDot={{ r: 4 }} /> )} </LineChart> </ResponsiveContainer> </GraphWrapper> ); } } export default withTheme(Graph);
test/unit/Divider.spec.js
rolandpoulter/material-ui
import React from 'react'; import {shallow} from 'enzyme'; import {assert} from 'chai'; import Divider from 'src/divider'; describe('<Divider />', () => { it('renders className', () => { const wrapper = shallow( <Divider className="test-class-name" /> ); assert.ok(wrapper.is('.test-class-name'), 'should contain the className'); }); it('renders inset', () => { const wrapper = shallow( <Divider inset={true} /> ); const cheerioDivider = wrapper.render().children(); assert.strictEqual(cheerioDivider.css('margin-left'), '72px'); }); it('overwrite styles', () => { const style = { backgroundColor: 'red', }; const wrapper = shallow( <Divider style={style} /> ); assert.strictEqual(wrapper.prop('style').backgroundColor, 'red', 'should have red backgroundColor'); }); });
app/react-icons/fa/unlock-alt.js
scampersand/sonos-front
import React from 'react'; import IconBase from 'react-icon-base'; export default class FaUnlockAlt extends React.Component { render() { return ( <IconBase viewBox="0 0 40 40" {...this.props}> <g><path d="m30.6 17.1q0.9 0 1.5 0.7t0.6 1.5v12.8q0 0.9-0.6 1.6t-1.5 0.6h-21.5q-0.8 0-1.5-0.6t-0.6-1.6v-12.8q0-0.9 0.6-1.5t1.5-0.7h0.8v-7.1q0-4.1 2.9-7.1t7.1-2.9 7 2.9 3 7.1q0 0.6-0.5 1t-1 0.4h-1.4q-0.6 0-1-0.4t-0.4-1q0-2.4-1.7-4t-4-1.7-4.1 1.7-1.7 4v7.1h16.5z"/></g> </IconBase> ); } }
client/app/src/components/ServiceList/index.js
gk95/nightlux
import React from 'react' import { Item } from 'semantic-ui-react'; import Service from './service'; export default function ServiceList({ services }) { return ( <Item.Group divided> { services.map(s => <Service key={s.id} service={s} />) } </Item.Group> ); }
src/wrapper.js
Brogency/baobab-react-resolver
import React from 'react'; import { RootMixin } from 'baobab-react-mixins'; export default React.createClass({ mixins: [RootMixin], childContextTypes: { onResolve: React.PropTypes.func, }, getChildContext() { return { onResolve: this.props.onResolve, }; }, render() { return this.props.children; }, });
packages/react-error-overlay/src/containers/StackTrace.js
reedsa/create-react-app
/** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /* @flow */ import React, { Component } from 'react'; import StackFrame from './StackFrame'; import Collapsible from '../components/Collapsible'; import { isInternalFile } from '../utils/isInternalFile'; import { isBultinErrorName } from '../utils/isBultinErrorName'; import type { StackFrame as StackFrameType } from '../utils/stack-frame'; const traceStyle = { fontSize: '1em', flex: '0 1 auto', minHeight: '0px', overflow: 'auto', }; type Props = {| stackFrames: StackFrameType[], errorName: string, contextSize: number, launchEditorEndpoint: ?string, |}; class StackTrace extends Component<Props> { renderFrames() { const { stackFrames, errorName, contextSize, launchEditorEndpoint, } = this.props; const renderedFrames = []; let hasReachedAppCode = false, currentBundle = [], bundleCount = 0; stackFrames.forEach((frame, index) => { const { fileName, _originalFileName: sourceFileName } = frame; const isInternalUrl = isInternalFile(sourceFileName, fileName); const isThrownIntentionally = !isBultinErrorName(errorName); const shouldCollapse = isInternalUrl && (isThrownIntentionally || hasReachedAppCode); if (!isInternalUrl) { hasReachedAppCode = true; } const frameEle = ( <StackFrame key={'frame-' + index} frame={frame} contextSize={contextSize} critical={index === 0} showCode={!shouldCollapse} launchEditorEndpoint={launchEditorEndpoint} /> ); const lastElement = index === stackFrames.length - 1; if (shouldCollapse) { currentBundle.push(frameEle); } if (!shouldCollapse || lastElement) { if (currentBundle.length === 1) { renderedFrames.push(currentBundle[0]); } else if (currentBundle.length > 1) { bundleCount++; renderedFrames.push( <Collapsible key={'bundle-' + bundleCount}> {currentBundle} </Collapsible> ); } currentBundle = []; } if (!shouldCollapse) { renderedFrames.push(frameEle); } }); return renderedFrames; } render() { return <div style={traceStyle}>{this.renderFrames()}</div>; } } export default StackTrace;
src/components/shared/CompanyModal.js
germohn/tarkvaraprojekt
import Logo from '../shared/Logo'; import React from 'react'; import PropTypes from 'prop-types'; import {Modal} from 'react-bootstrap'; import {joinFoundersToList} from '../../containers/util/OtherFunctions'; const CompanyModal = (props) => { return ( <Modal show={props.show} onHide={(e) => props.close(e)}> <Modal.Header closeButton> <div className="container-fluid"> <div className="row"> </div> <div className="row"> <div className="col-lg-3 col-xs-3 col-sm-3 col-md-3 cardLogoContainer"> <Logo url={props.company.logo100x100} view="cardView"/> </div> <div className="col-lg-9 col-xs-9 col-sm-9 col-md-9"> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12 leftAligned"> <p className='companyName'>{props.company.name}</p> </div> </div> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12 leftAligned"> <p className="tags">{props.company.tags ? props.company.tags.join(' | ') : ''}</p> </div> </div> </div> </div> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12 descContainer"> <p className='description'>{props.company.description}</p> </div> </div> </div> </Modal.Header> <Modal.Body> <div className="container-fluid"> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12"> <b><a href={props.company.url} target="_blank">See the profile...</a></b> </div> </div> <div className="row modalRow"> <div className="col-lg-4 col-xs-4 col-sm-4 col-md-4"> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12"><b>Funding:</b></div> </div> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12">{props.company.funding ? props.company.funding.toLocaleString('en-US') + ' $' : 'unknown'}</div> </div> </div> <div className="col-lg-4 col-xs-4 col-sm-4 col-md-4"> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12"><b>Employees:</b></div> </div> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12">{props.company.employees ? props.company.employees : 'unknown'}</div> </div> </div> <div className="col-lg-4 col-xs-4 col-sm-4 col-md-4"> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12"><b>Founded:</b></div> </div> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12">{props.company.foundedOn ? props.company.foundedOn.substring(0, 4) : 'unknown'}</div> </div> </div> </div> <div className="row"> <b>Founders:</b> </div> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12 founders"> {joinFoundersToList(props.company.founders)} </div> </div> <div className="row"> <b>Investors:</b> </div> <div className="row investors"> {props.company.investors ? props.company.investors.map((investor) => { return ( <div key={investor.name} className="col-lg-3 col-xs-3 col-sm-3 col-md-3 investor col-centered"> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12 modalLogoContainer"> <Logo url={investor.logo100x100} view="cardView"/> </div> </div> <div className="row"> <div className="col-lg-12 col-xs-12 col-sm-12 col-md-12"> <b> {investor.name} </b> </div> </div> </div> ); }) : ''} </div> </div> </Modal.Body> </Modal> ); }; CompanyModal.propTypes = { company: PropTypes.object.isRequired, show: PropTypes.bool.isRequired, close: PropTypes.func.isRequired }; export default CompanyModal;
packages/material-ui-icons/src/Star.js
AndriusBil/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let Star = props => <SvgIcon {...props}> <path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" /> </SvgIcon>; Star = pure(Star); Star.muiName = 'SvgIcon'; export default Star;
packages/material-ui-icons/src/AddTwoTone.js
Kagami/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" /></React.Fragment> , 'AddTwoTone');
ajax/libs/highmaps/4.2.2/highcharts.src.js
Piicksarn/cdnjs
// ==ClosureCompiler== // @compilation_level SIMPLE_OPTIMIZATIONS /** * @license Highcharts JS v4.2.2 (2016-02-04) * * (c) 2009-2016 Torstein Honsi * * License: www.highcharts.com/license */ (function (root, factory) { if (typeof module === 'object' && module.exports) { module.exports = root.document ? factory(root) : factory; } else { root.Highcharts = factory(root); } }(typeof window !== 'undefined' ? window : this, function (win) { // eslint-disable-line no-undef // encapsulated variables var UNDEFINED, doc = win.document, math = Math, mathRound = math.round, mathFloor = math.floor, mathCeil = math.ceil, mathMax = math.max, mathMin = math.min, mathAbs = math.abs, mathCos = math.cos, mathSin = math.sin, mathPI = math.PI, deg2rad = mathPI * 2 / 360, // some variables userAgent = (win.navigator && win.navigator.userAgent) || '', isOpera = win.opera, isMS = /(msie|trident|edge)/i.test(userAgent) && !isOpera, docMode8 = doc && doc.documentMode === 8, isWebKit = !isMS && /AppleWebKit/.test(userAgent), isFirefox = /Firefox/.test(userAgent), isTouchDevice = /(Mobile|Android|Windows Phone)/.test(userAgent), SVG_NS = 'http://www.w3.org/2000/svg', hasSVG = doc && doc.createElementNS && !!doc.createElementNS(SVG_NS, 'svg').createSVGRect, hasBidiBug = isFirefox && parseInt(userAgent.split('Firefox/')[1], 10) < 4, // issue #38 useCanVG = doc && !hasSVG && !isMS && !!doc.createElement('canvas').getContext, Renderer, hasTouch, symbolSizes = {}, idCounter = 0, garbageBin, defaultOptions, dateFormat, // function pathAnim, timeUnits, noop = function () {}, charts = [], chartCount = 0, PRODUCT = 'Highcharts', VERSION = '4.2.2', // some constants for frequently used strings DIV = 'div', ABSOLUTE = 'absolute', RELATIVE = 'relative', HIDDEN = 'hidden', PREFIX = 'highcharts-', VISIBLE = 'visible', PX = 'px', NONE = 'none', M = 'M', L = 'L', numRegex = /^[0-9]+$/, NORMAL_STATE = '', HOVER_STATE = 'hover', SELECT_STATE = 'select', marginNames = ['plotTop', 'marginRight', 'marginBottom', 'plotLeft'], // Object for extending Axis AxisPlotLineOrBandExtension, // constants for attributes STROKE_WIDTH = 'stroke-width', // time methods, changed based on whether or not UTC is used Date, // Allow using a different Date class makeTime, timezoneOffset, getTimezoneOffset, getMinutes, getHours, getDay, getDate, getMonth, getFullYear, setMilliseconds, setSeconds, setMinutes, setHours, setDate, setMonth, setFullYear, // lookup over the types and the associated classes seriesTypes = {}, Highcharts; /** * Provide error messages for debugging, with links to online explanation */ function error(code, stop) { var msg = 'Highcharts error #' + code + ': www.highcharts.com/errors/' + code; if (stop) { throw new Error(msg); } // else ... if (win.console) { console.log(msg); // eslint-disable-line no-console } } // The Highcharts namespace Highcharts = win.Highcharts ? error(16, true) : { win: win }; Highcharts.seriesTypes = seriesTypes; var timers = [], getStyle, // Previous adapter functions inArray, each, grep, offset, map, addEvent, removeEvent, fireEvent, animate, stop; /** * An animator object. One instance applies to one property (attribute or style prop) * on one element. * * @param {object} elem The element to animate. May be a DOM element or a Highcharts SVGElement wrapper. * @param {object} options Animation options, including duration, easing, step and complete. * @param {object} prop The property to animate. */ function Fx(elem, options, prop) { this.options = options; this.elem = elem; this.prop = prop; } Fx.prototype = { /** * Animating a path definition on SVGElement * @returns {undefined} */ dSetter: function () { var start = this.paths[0], end = this.paths[1], ret = [], now = this.now, i = start.length, startVal; if (now === 1) { // land on the final path without adjustment points appended in the ends ret = this.toD; } else if (i === end.length && now < 1) { while (i--) { startVal = parseFloat(start[i]); ret[i] = isNaN(startVal) ? // a letter instruction like M or L start[i] : now * (parseFloat(end[i] - startVal)) + startVal; } } else { // if animation is finished or length not matching, land on right value ret = end; } this.elem.attr('d', ret); }, /** * Update the element with the current animation step * @returns {undefined} */ update: function () { var elem = this.elem, prop = this.prop, // if destroyed, it is null now = this.now, step = this.options.step; // Animation setter defined from outside if (this[prop + 'Setter']) { this[prop + 'Setter'](); // Other animations on SVGElement } else if (elem.attr) { if (elem.element) { elem.attr(prop, now); } // HTML styles, raw HTML content like container size } else { elem.style[prop] = now + this.unit; } if (step) { step.call(elem, now, this); } }, /** * Run an animation */ run: function (from, to, unit) { var self = this, timer = function (gotoEnd) { return timer.stopped ? false : self.step(gotoEnd); }, i; this.startTime = +new Date(); this.start = from; this.end = to; this.unit = unit; this.now = this.start; this.pos = 0; timer.elem = this.elem; if (timer() && timers.push(timer) === 1) { timer.timerId = setInterval(function () { for (i = 0; i < timers.length; i++) { if (!timers[i]()) { timers.splice(i--, 1); } } if (!timers.length) { clearInterval(timer.timerId); } }, 13); } }, /** * Run a single step in the animation * @param {Boolean} gotoEnd Whether to go to then endpoint of the animation after abort * @returns {Boolean} True if animation continues */ step: function (gotoEnd) { var t = +new Date(), ret, done, options = this.options, elem = this.elem, complete = options.complete, duration = options.duration, curAnim = options.curAnim, i; if (elem.attr && !elem.element) { // #2616, element including flag is destroyed ret = false; } else if (gotoEnd || t >= duration + this.startTime) { this.now = this.end; this.pos = 1; this.update(); curAnim[this.prop] = true; done = true; for (i in curAnim) { if (curAnim[i] !== true) { done = false; } } if (done && complete) { complete.call(elem); } ret = false; } else { this.pos = options.easing((t - this.startTime) / duration); this.now = this.start + ((this.end - this.start) * this.pos); this.update(); ret = true; } return ret; }, /** * Prepare start and end values so that the path can be animated one to one */ initPath: function (elem, fromD, toD) { fromD = fromD || ''; var shift = elem.shift, bezier = fromD.indexOf('C') > -1, numParams = bezier ? 7 : 3, endLength, slice, i, start = fromD.split(' '), end = [].concat(toD), // copy isArea = elem.isArea, positionFactor = isArea ? 2 : 1, sixify = function (arr) { // in splines make move points have six parameters like bezier curves i = arr.length; while (i--) { if (arr[i] === M || arr[i] === L) { arr.splice(i + 1, 0, arr[i + 1], arr[i + 2], arr[i + 1], arr[i + 2]); } } }; if (bezier) { sixify(start); sixify(end); } // If shifting points, prepend a dummy point to the end path. For areas, // prepend both at the beginning and end of the path. if (shift <= end.length / numParams && start.length === end.length) { while (shift--) { end = end.slice(0, numParams).concat(end); if (isArea) { end = end.concat(end.slice(end.length - numParams)); } } } elem.shift = 0; // reset for following animations // Copy and append last point until the length matches the end length if (start.length) { endLength = end.length; while (start.length < endLength) { // Pull out the slice that is going to be appended or inserted. In a line graph, // the positionFactor is 1, and the last point is sliced out. In an area graph, // the positionFactor is 2, causing the middle two points to be sliced out, since // an area path starts at left, follows the upper path then turns and follows the // bottom back. slice = start.slice().splice( (start.length / positionFactor) - numParams, numParams * positionFactor ); // Disable first control point if (bezier) { slice[numParams - 6] = slice[numParams - 2]; slice[numParams - 5] = slice[numParams - 1]; } // Now insert the slice, either in the middle (for areas) or at the end (for lines) [].splice.apply( start, [(start.length / positionFactor), 0].concat(slice) ); } } return [start, end]; } }; // End of Fx prototype /** * Extend an object with the members of another * @param {Object} a The object to be extended * @param {Object} b The object to add to the first one */ var extend = Highcharts.extend = function (a, b) { var n; if (!a) { a = {}; } for (n in b) { a[n] = b[n]; } return a; }; /** * Deep merge two or more objects and return a third object. If the first argument is * true, the contents of the second object is copied into the first object. * Previously this function redirected to jQuery.extend(true), but this had two limitations. * First, it deep merged arrays, which lead to workarounds in Highcharts. Second, * it copied properties from extended prototypes. */ function merge() { var i, args = arguments, len, ret = {}, doCopy = function (copy, original) { var value, key; // An object is replacing a primitive if (typeof copy !== 'object') { copy = {}; } for (key in original) { if (original.hasOwnProperty(key)) { value = original[key]; // Copy the contents of objects, but not arrays or DOM nodes if (value && typeof value === 'object' && Object.prototype.toString.call(value) !== '[object Array]' && key !== 'renderTo' && typeof value.nodeType !== 'number') { copy[key] = doCopy(copy[key] || {}, value); // Primitives and arrays are copied over directly } else { copy[key] = original[key]; } } } return copy; }; // If first argument is true, copy into the existing object. Used in setOptions. if (args[0] === true) { ret = args[1]; args = Array.prototype.slice.call(args, 2); } // For each argument, extend the return len = args.length; for (i = 0; i < len; i++) { ret = doCopy(ret, args[i]); } return ret; } /** * Shortcut for parseInt * @param {Object} s * @param {Number} mag Magnitude */ function pInt(s, mag) { return parseInt(s, mag || 10); } /** * Check for string * @param {Object} s */ function isString(s) { return typeof s === 'string'; } /** * Check for object * @param {Object} obj */ function isObject(obj) { return obj && typeof obj === 'object'; } /** * Check for array * @param {Object} obj */ function isArray(obj) { return Object.prototype.toString.call(obj) === '[object Array]'; } /** * Check for number * @param {Object} n */ function isNumber(n) { return typeof n === 'number'; } function log2lin(num) { return math.log(num) / math.LN10; } function lin2log(num) { return math.pow(10, num); } /** * Remove last occurence of an item from an array * @param {Array} arr * @param {Mixed} item */ function erase(arr, item) { var i = arr.length; while (i--) { if (arr[i] === item) { arr.splice(i, 1); break; } } //return arr; } /** * Returns true if the object is not null or undefined. * @param {Object} obj */ function defined(obj) { return obj !== UNDEFINED && obj !== null; } /** * Set or get an attribute or an object of attributes. Can't use jQuery attr because * it attempts to set expando properties on the SVG element, which is not allowed. * * @param {Object} elem The DOM element to receive the attribute(s) * @param {String|Object} prop The property or an abject of key-value pairs * @param {String} value The value if a single property is set */ function attr(elem, prop, value) { var key, ret; // if the prop is a string if (isString(prop)) { // set the value if (defined(value)) { elem.setAttribute(prop, value); // get the value } else if (elem && elem.getAttribute) { // elem not defined when printing pie demo... ret = elem.getAttribute(prop); } // else if prop is defined, it is a hash of key/value pairs } else if (defined(prop) && isObject(prop)) { for (key in prop) { elem.setAttribute(key, prop[key]); } } return ret; } /** * Check if an element is an array, and if not, make it into an array. */ function splat(obj) { return isArray(obj) ? obj : [obj]; } /** * Set a timeout if the delay is given, otherwise perform the function synchronously * @param {Function} fn The function to perform * @param {Number} delay Delay in milliseconds * @param {Ojbect} context The context * @returns {Nubmer} An identifier for the timeout */ function syncTimeout(fn, delay, context) { if (delay) { return setTimeout(fn, delay, context); } fn.call(0, context); } /** * Return the first value that is defined. */ var pick = Highcharts.pick = function () { var args = arguments, i, arg, length = args.length; for (i = 0; i < length; i++) { arg = args[i]; if (arg !== UNDEFINED && arg !== null) { return arg; } } }; /** * Set CSS on a given element * @param {Object} el * @param {Object} styles Style object with camel case property names */ function css(el, styles) { if (isMS && !hasSVG) { // #2686 if (styles && styles.opacity !== UNDEFINED) { styles.filter = 'alpha(opacity=' + (styles.opacity * 100) + ')'; } } extend(el.style, styles); } /** * Utility function to create element with attributes and styles * @param {Object} tag * @param {Object} attribs * @param {Object} styles * @param {Object} parent * @param {Object} nopad */ function createElement(tag, attribs, styles, parent, nopad) { var el = doc.createElement(tag); if (attribs) { extend(el, attribs); } if (nopad) { css(el, { padding: 0, border: 'none', margin: 0 }); } if (styles) { css(el, styles); } if (parent) { parent.appendChild(el); } return el; } /** * Extend a prototyped class by new members * @param {Object} parent * @param {Object} members */ function extendClass(Parent, members) { var object = function () { }; object.prototype = new Parent(); extend(object.prototype, members); return object; } /** * Pad a string to a given length by adding 0 to the beginning * @param {Number} number * @param {Number} length */ function pad(number, length) { return new Array((length || 2) + 1 - String(number).length).join(0) + number; } /** * Return a length based on either the integer value, or a percentage of a base. */ function relativeLength(value, base) { return (/%$/).test(value) ? base * parseFloat(value) / 100 : parseFloat(value); } /** * Wrap a method with extended functionality, preserving the original function * @param {Object} obj The context object that the method belongs to * @param {String} method The name of the method to extend * @param {Function} func A wrapper function callback. This function is called with the same arguments * as the original function, except that the original function is unshifted and passed as the first * argument. */ var wrap = Highcharts.wrap = function (obj, method, func) { var proceed = obj[method]; obj[method] = function () { var args = Array.prototype.slice.call(arguments); args.unshift(proceed); return func.apply(this, args); }; }; function getTZOffset(timestamp) { return ((getTimezoneOffset && getTimezoneOffset(timestamp)) || timezoneOffset || 0) * 60000; } /** * Based on http://www.php.net/manual/en/function.strftime.php * @param {String} format * @param {Number} timestamp * @param {Boolean} capitalize */ dateFormat = function (format, timestamp, capitalize) { if (!defined(timestamp) || isNaN(timestamp)) { return defaultOptions.lang.invalidDate || ''; } format = pick(format, '%Y-%m-%d %H:%M:%S'); var date = new Date(timestamp - getTZOffset(timestamp)), key, // used in for constuct below // get the basic time values hours = date[getHours](), day = date[getDay](), dayOfMonth = date[getDate](), month = date[getMonth](), fullYear = date[getFullYear](), lang = defaultOptions.lang, langWeekdays = lang.weekdays, // List all format keys. Custom formats can be added from the outside. replacements = extend({ // Day 'a': langWeekdays[day].substr(0, 3), // Short weekday, like 'Mon' 'A': langWeekdays[day], // Long weekday, like 'Monday' 'd': pad(dayOfMonth), // Two digit day of the month, 01 to 31 'e': dayOfMonth, // Day of the month, 1 through 31 'w': day, // Week (none implemented) //'W': weekNumber(), // Month 'b': lang.shortMonths[month], // Short month, like 'Jan' 'B': lang.months[month], // Long month, like 'January' 'm': pad(month + 1), // Two digit month number, 01 through 12 // Year 'y': fullYear.toString().substr(2, 2), // Two digits year, like 09 for 2009 'Y': fullYear, // Four digits year, like 2009 // Time 'H': pad(hours), // Two digits hours in 24h format, 00 through 23 'k': hours, // Hours in 24h format, 0 through 23 'I': pad((hours % 12) || 12), // Two digits hours in 12h format, 00 through 11 'l': (hours % 12) || 12, // Hours in 12h format, 1 through 12 'M': pad(date[getMinutes]()), // Two digits minutes, 00 through 59 'p': hours < 12 ? 'AM' : 'PM', // Upper case AM or PM 'P': hours < 12 ? 'am' : 'pm', // Lower case AM or PM 'S': pad(date.getSeconds()), // Two digits seconds, 00 through 59 'L': pad(mathRound(timestamp % 1000), 3) // Milliseconds (naming from Ruby) }, Highcharts.dateFormats); // do the replaces for (key in replacements) { while (format.indexOf('%' + key) !== -1) { // regex would do it in one line, but this is faster format = format.replace('%' + key, typeof replacements[key] === 'function' ? replacements[key](timestamp) : replacements[key]); } } // Optionally capitalize the string and return return capitalize ? format.substr(0, 1).toUpperCase() + format.substr(1) : format; }; /** * Format a single variable. Similar to sprintf, without the % prefix. */ function formatSingle(format, val) { var floatRegex = /f$/, decRegex = /\.([0-9])/, lang = defaultOptions.lang, decimals; if (floatRegex.test(format)) { // float decimals = format.match(decRegex); decimals = decimals ? decimals[1] : -1; if (val !== null) { val = Highcharts.numberFormat( val, decimals, lang.decimalPoint, format.indexOf(',') > -1 ? lang.thousandsSep : '' ); } } else { val = dateFormat(format, val); } return val; } /** * Format a string according to a subset of the rules of Python's String.format method. */ function format(str, ctx) { var splitter = '{', isInside = false, segment, valueAndFormat, path, i, len, ret = [], val, index; while ((index = str.indexOf(splitter)) !== -1) { segment = str.slice(0, index); if (isInside) { // we're on the closing bracket looking back valueAndFormat = segment.split(':'); path = valueAndFormat.shift().split('.'); // get first and leave format len = path.length; val = ctx; // Assign deeper paths for (i = 0; i < len; i++) { val = val[path[i]]; } // Format the replacement if (valueAndFormat.length) { val = formatSingle(valueAndFormat.join(':'), val); } // Push the result and advance the cursor ret.push(val); } else { ret.push(segment); } str = str.slice(index + 1); // the rest isInside = !isInside; // toggle splitter = isInside ? '}' : '{'; // now look for next matching bracket } ret.push(str); return ret.join(''); } /** * Get the magnitude of a number */ function getMagnitude(num) { return math.pow(10, mathFloor(math.log(num) / math.LN10)); } /** * Take an interval and normalize it to multiples of 1, 2, 2.5 and 5 * @param {Number} interval * @param {Array} multiples * @param {Number} magnitude * @param {Object} options */ function normalizeTickInterval(interval, multiples, magnitude, allowDecimals, preventExceed) { var normalized, i, retInterval = interval; // round to a tenfold of 1, 2, 2.5 or 5 magnitude = pick(magnitude, 1); normalized = interval / magnitude; // multiples for a linear scale if (!multiples) { multiples = [1, 2, 2.5, 5, 10]; // the allowDecimals option if (allowDecimals === false) { if (magnitude === 1) { multiples = [1, 2, 5, 10]; } else if (magnitude <= 0.1) { multiples = [1 / magnitude]; } } } // normalize the interval to the nearest multiple for (i = 0; i < multiples.length; i++) { retInterval = multiples[i]; if ((preventExceed && retInterval * magnitude >= interval) || // only allow tick amounts smaller than natural (!preventExceed && (normalized <= (multiples[i] + (multiples[i + 1] || multiples[i])) / 2))) { break; } } // multiply back to the correct magnitude retInterval *= magnitude; return retInterval; } /** * Utility method that sorts an object array and keeping the order of equal items. * ECMA script standard does not specify the behaviour when items are equal. */ function stableSort(arr, sortFunction) { var length = arr.length, sortValue, i; // Add index to each item for (i = 0; i < length; i++) { arr[i].safeI = i; // stable sort index } arr.sort(function (a, b) { sortValue = sortFunction(a, b); return sortValue === 0 ? a.safeI - b.safeI : sortValue; }); // Remove index from items for (i = 0; i < length; i++) { delete arr[i].safeI; // stable sort index } } /** * Non-recursive method to find the lowest member of an array. Math.min raises a maximum * call stack size exceeded error in Chrome when trying to apply more than 150.000 points. This * method is slightly slower, but safe. */ function arrayMin(data) { var i = data.length, min = data[0]; while (i--) { if (data[i] < min) { min = data[i]; } } return min; } /** * Non-recursive method to find the lowest member of an array. Math.min raises a maximum * call stack size exceeded error in Chrome when trying to apply more than 150.000 points. This * method is slightly slower, but safe. */ function arrayMax(data) { var i = data.length, max = data[0]; while (i--) { if (data[i] > max) { max = data[i]; } } return max; } /** * Utility method that destroys any SVGElement or VMLElement that are properties on the given object. * It loops all properties and invokes destroy if there is a destroy method. The property is * then delete'ed. * @param {Object} The object to destroy properties on * @param {Object} Exception, do not destroy this property, only delete it. */ function destroyObjectProperties(obj, except) { var n; for (n in obj) { // If the object is non-null and destroy is defined if (obj[n] && obj[n] !== except && obj[n].destroy) { // Invoke the destroy obj[n].destroy(); } // Delete the property from the object. delete obj[n]; } } /** * Discard an element by moving it to the bin and delete * @param {Object} The HTML node to discard */ function discardElement(element) { // create a garbage bin element, not part of the DOM if (!garbageBin) { garbageBin = createElement(DIV); } // move the node and empty bin if (element) { garbageBin.appendChild(element); } garbageBin.innerHTML = ''; } /** * Fix JS round off float errors * @param {Number} num */ function correctFloat(num, prec) { return parseFloat( num.toPrecision(prec || 14) ); } /** * Set the global animation to either a given value, or fall back to the * given chart's animation option * @param {Object} animation * @param {Object} chart */ function setAnimation(animation, chart) { chart.renderer.globalAnimation = pick(animation, chart.animation); } /** * The time unit lookup */ timeUnits = { millisecond: 1, second: 1000, minute: 60000, hour: 3600000, day: 24 * 3600000, week: 7 * 24 * 3600000, month: 28 * 24 * 3600000, year: 364 * 24 * 3600000 }; /** * Format a number and return a string based on input settings * @param {Number} number The input number to format * @param {Number} decimals The amount of decimals * @param {String} decimalPoint The decimal point, defaults to the one given in the lang options * @param {String} thousandsSep The thousands separator, defaults to the one given in the lang options */ Highcharts.numberFormat = function (number, decimals, decimalPoint, thousandsSep) { number = +number || 0; var lang = defaultOptions.lang, origDec = (number.toString().split('.')[1] || '').length, decimalComponent, strinteger, thousands, absNumber = Math.abs(number), ret; if (decimals === -1) { decimals = Math.min(origDec, 20); // Preserve decimals. Not huge numbers (#3793). } else if (isNaN(decimals)) { decimals = 2; } // A string containing the positive integer component of the number strinteger = String(pInt(absNumber.toFixed(decimals))); // Leftover after grouping into thousands. Can be 0, 1 or 3. thousands = strinteger.length > 3 ? strinteger.length % 3 : 0; // Language decimalPoint = pick(decimalPoint, lang.decimalPoint); thousandsSep = pick(thousandsSep, lang.thousandsSep); // Start building the return ret = number < 0 ? '-' : ''; // Add the leftover after grouping into thousands. For example, in the number 42 000 000, // this line adds 42. ret += thousands ? strinteger.substr(0, thousands) + thousandsSep : ''; // Add the remaining thousands groups, joined by the thousands separator ret += strinteger.substr(thousands).replace(/(\d{3})(?=\d)/g, '$1' + thousandsSep); // Add the decimal point and the decimal component if (+decimals) { // Get the decimal component, and add power to avoid rounding errors with float numbers (#4573) decimalComponent = Math.abs(absNumber - strinteger + Math.pow(10, -Math.max(decimals, origDec) - 1)); ret += decimalPoint + decimalComponent.toFixed(decimals).slice(2); } return ret; }; /** * Easing definition * @param {Number} pos Current position, ranging from 0 to 1 */ Math.easeInOutSine = function (pos) { return -0.5 * (Math.cos(Math.PI * pos) - 1); }; /** * Internal method to return CSS value for given element and property */ getStyle = function (el, prop) { var style; // For width and height, return the actual inner pixel size (#4913) if (prop === 'width') { return Math.min(el.offsetWidth, el.scrollWidth) - getStyle(el, 'padding-left') - getStyle(el, 'padding-right'); } else if (prop === 'height') { return Math.min(el.offsetHeight, el.scrollHeight) - getStyle(el, 'padding-top') - getStyle(el, 'padding-bottom'); } // Otherwise, get the computed style style = win.getComputedStyle(el, undefined); return style && pInt(style.getPropertyValue(prop)); }; /** * Return the index of an item in an array, or -1 if not found */ inArray = function (item, arr) { return arr.indexOf ? arr.indexOf(item) : [].indexOf.call(arr, item); }; /** * Filter an array */ grep = function (elements, callback) { return [].filter.call(elements, callback); }; /** * Map an array */ map = function (arr, fn) { var results = [], i = 0, len = arr.length; for (; i < len; i++) { results[i] = fn.call(arr[i], arr[i], i, arr); } return results; }; /** * Get the element's offset position, corrected by overflow:auto. */ offset = function (el) { var docElem = doc.documentElement, box = el.getBoundingClientRect(); return { top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0), left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0) }; }; /** * Stop running animation. * A possible extension to this would be to stop a single property, when * we want to continue animating others. Then assign the prop to the timer * in the Fx.run method, and check for the prop here. This would be an improvement * in all cases where we stop the animation from .attr. Instead of stopping * everything, we can just stop the actual attributes we're setting. */ stop = function (el) { var i = timers.length; // Remove timers related to this element (#4519) while (i--) { if (timers[i].elem === el) { timers[i].stopped = true; // #4667 } } }; /** * Utility for iterating over an array. * @param {Array} arr * @param {Function} fn */ each = function (arr, fn) { // modern browsers return Array.prototype.forEach.call(arr, fn); }; /** * Add an event listener */ addEvent = function (el, type, fn) { var events = el.hcEvents = el.hcEvents || {}; function wrappedFn(e) { e.target = e.srcElement || win; // #2820 fn.call(el, e); } // Handle DOM events in modern browsers if (el.addEventListener) { el.addEventListener(type, fn, false); // Handle old IE implementation } else if (el.attachEvent) { if (!el.hcEventsIE) { el.hcEventsIE = {}; } // Link wrapped fn with original fn, so we can get this in removeEvent el.hcEventsIE[fn.toString()] = wrappedFn; el.attachEvent('on' + type, wrappedFn); } if (!events[type]) { events[type] = []; } events[type].push(fn); }; /** * Remove event added with addEvent */ removeEvent = function (el, type, fn) { var events, hcEvents = el.hcEvents, index; function removeOneEvent(type, fn) { if (el.removeEventListener) { el.removeEventListener(type, fn, false); } else if (el.attachEvent) { fn = el.hcEventsIE[fn.toString()]; el.detachEvent('on' + type, fn); } } function removeAllEvents() { var types, len, n; if (!el.nodeName) { return; // break on non-DOM events } if (type) { types = {}; types[type] = true; } else { types = hcEvents; } for (n in types) { if (hcEvents[n]) { len = hcEvents[n].length; while (len--) { removeOneEvent(n, hcEvents[n][len]); } } } } if (hcEvents) { if (type) { events = hcEvents[type] || []; if (fn) { index = inArray(fn, events); if (index > -1) { events.splice(index, 1); hcEvents[type] = events; } removeOneEvent(type, fn); } else { removeAllEvents(); hcEvents[type] = []; } } else { removeAllEvents(); el.hcEvents = {}; } } }; /** * Fire an event on a custom object */ fireEvent = function (el, type, eventArguments, defaultFunction) { var e, hcEvents = el.hcEvents, events, len, i, preventDefault, fn; eventArguments = eventArguments || {}; if (doc.createEvent && (el.dispatchEvent || el.fireEvent)) { e = doc.createEvent('Events'); e.initEvent(type, true, true); e.target = el; extend(e, eventArguments); if (el.dispatchEvent) { el.dispatchEvent(e); } else { el.fireEvent(type, e); } } else if (hcEvents) { events = hcEvents[type] || []; len = events.length; // Attach a simple preventDefault function to skip default handler if called preventDefault = function () { eventArguments.defaultPrevented = true; }; for (i = 0; i < len; i++) { fn = events[i]; // eventArguments is never null here if (eventArguments.stopped) { return; } eventArguments.preventDefault = preventDefault; eventArguments.target = el; // If the type is not set, we're running a custom event (#2297). If it is set, // we're running a browser event, and setting it will cause en error in // IE8 (#2465). if (!eventArguments.type) { eventArguments.type = type; } // If the event handler return false, prevent the default handler from executing if (fn.call(el, eventArguments) === false) { eventArguments.preventDefault(); } } } // Run the default if not prevented if (defaultFunction && !eventArguments.defaultPrevented) { defaultFunction(eventArguments); } }; /** * The global animate method, which uses Fx to create individual animators. */ animate = function (el, params, opt) { var start, unit = '', end, fx, args, prop; if (!isObject(opt)) { // Number or undefined/null args = arguments; opt = { duration: args[2], easing: args[3], complete: args[4] }; } if (!isNumber(opt.duration)) { opt.duration = 400; } opt.easing = Math[opt.easing] || Math.easeInOutSine; opt.curAnim = merge(params); for (prop in params) { fx = new Fx(el, opt, prop); end = null; if (prop === 'd') { fx.paths = fx.initPath( el, el.d, params.d ); fx.toD = params.d; start = 0; end = 1; } else if (el.attr) { start = el.attr(prop); } else { start = parseFloat(getStyle(el, prop)) || 0; if (prop !== 'opacity') { unit = 'px'; } } if (!end) { end = params[prop]; } if (end.match && end.match('px')) { end = end.replace(/px/g, ''); // #4351 } fx.run(start, end, unit); } }; /** * Register Highcharts as a plugin in jQuery */ if (win.jQuery) { win.jQuery.fn.highcharts = function () { var args = [].slice.call(arguments); if (this[0]) { // this[0] is the renderTo div // Create the chart if (args[0]) { new Highcharts[ // eslint-disable-line no-new isString(args[0]) ? args.shift() : 'Chart' // Constructor defaults to Chart ](this[0], args[0], args[1]); return this; } // When called without parameters or with the return argument, return an existing chart return charts[attr(this[0], 'data-highcharts-chart')]; } }; } /** * Compatibility section to add support for legacy IE. This can be removed if old IE * support is not needed. */ if (doc && !doc.defaultView) { getStyle = function (el, prop) { var val, alias = { width: 'clientWidth', height: 'clientHeight' }[prop]; if (el.style[prop]) { return pInt(el.style[prop]); } if (prop === 'opacity') { prop = 'filter'; } // Getting the rendered width and height if (alias) { el.style.zoom = 1; return el[alias] - 2 * getStyle(el, 'padding'); } val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b) { return b.toUpperCase(); })]; if (prop === 'filter') { val = val.replace( /alpha\(opacity=([0-9]+)\)/, function (a, b) { return b / 100; } ); } return val === '' ? 1 : pInt(val); }; } if (!Array.prototype.forEach) { each = function (arr, fn) { // legacy var i = 0, len = arr.length; for (; i < len; i++) { if (fn.call(arr[i], arr[i], i, arr) === false) { return i; } } }; } if (!Array.prototype.indexOf) { inArray = function (item, arr) { var len, i = 0; if (arr) { len = arr.length; for (; i < len; i++) { if (arr[i] === item) { return i; } } } return -1; }; } if (!Array.prototype.filter) { grep = function (elements, fn) { var ret = [], i = 0, length = elements.length; for (; i < length; i++) { if (fn(elements[i], i)) { ret.push(elements[i]); } } return ret; }; } //--- End compatibility section --- // Expose utilities Highcharts.Fx = Fx; Highcharts.inArray = inArray; Highcharts.each = each; Highcharts.grep = grep; Highcharts.offset = offset; Highcharts.map = map; Highcharts.addEvent = addEvent; Highcharts.removeEvent = removeEvent; Highcharts.fireEvent = fireEvent; Highcharts.animate = animate; Highcharts.stop = stop; /* **************************************************************************** * Handle the options * *****************************************************************************/ defaultOptions = { colors: ['#7cb5ec', '#434348', '#90ed7d', '#f7a35c', '#8085e9', '#f15c80', '#e4d354', '#2b908f', '#f45b5b', '#91e8e1'], symbols: ['circle', 'diamond', 'square', 'triangle', 'triangle-down'], lang: { loading: 'Loading...', months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // invalidDate: '', decimalPoint: '.', numericSymbols: ['k', 'M', 'G', 'T', 'P', 'E'], // SI prefixes used in axis labels resetZoom: 'Reset zoom', resetZoomTitle: 'Reset zoom level 1:1', thousandsSep: ' ' }, global: { useUTC: true, //timezoneOffset: 0, canvasToolsURL: 'http://code.highcharts.com/modules/canvas-tools.js', VMLRadialGradientURL: 'http://code.highcharts.com/4.2.2/gfx/vml-radial-gradient.png' }, chart: { //animation: true, //alignTicks: false, //reflow: true, //className: null, //events: { load, selection }, //margin: [null], //marginTop: null, //marginRight: null, //marginBottom: null, //marginLeft: null, borderColor: '#4572A7', //borderWidth: 0, borderRadius: 0, defaultSeriesType: 'line', ignoreHiddenSeries: true, //inverted: false, //shadow: false, spacing: [10, 10, 15, 10], //spacingTop: 10, //spacingRight: 10, //spacingBottom: 15, //spacingLeft: 10, //style: { // fontFamily: '"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif', // default font // fontSize: '12px' //}, backgroundColor: '#FFFFFF', //plotBackgroundColor: null, plotBorderColor: '#C0C0C0', //plotBorderWidth: 0, //plotShadow: false, //zoomType: '' resetZoomButton: { theme: { zIndex: 20 }, position: { align: 'right', x: -10, //verticalAlign: 'top', y: 10 } // relativeTo: 'plot' } }, title: { text: 'Chart title', align: 'center', // floating: false, margin: 15, // x: 0, // verticalAlign: 'top', // y: null, style: { color: '#333333', fontSize: '18px' } }, subtitle: { text: '', align: 'center', // floating: false // x: 0, // verticalAlign: 'top', // y: null, style: { color: '#555555' } }, plotOptions: { line: { // base series options allowPointSelect: false, showCheckbox: false, animation: { duration: 1000 }, //connectNulls: false, //cursor: 'default', //clip: true, //dashStyle: null, //enableMouseTracking: true, events: {}, //legendIndex: 0, //linecap: 'round', lineWidth: 2, //shadow: false, // stacking: null, marker: { //enabled: true, //symbol: null, lineWidth: 0, radius: 4, lineColor: '#FFFFFF', //fillColor: null, states: { // states for a single point hover: { enabled: true, lineWidthPlus: 1, radiusPlus: 2 }, select: { fillColor: '#FFFFFF', lineColor: '#000000', lineWidth: 2 } } }, point: { events: {} }, dataLabels: { align: 'center', // defer: true, // enabled: false, formatter: function () { return this.y === null ? '' : Highcharts.numberFormat(this.y, -1); }, style: { color: 'contrast', fontSize: '11px', fontWeight: 'bold', textShadow: '0 0 6px contrast, 0 0 3px contrast' }, verticalAlign: 'bottom', // above singular point x: 0, y: 0, // backgroundColor: undefined, // borderColor: undefined, // borderRadius: undefined, // borderWidth: undefined, padding: 5 // shadow: false }, cropThreshold: 300, // draw points outside the plot area when the number of points is less than this pointRange: 0, //pointStart: 0, //pointInterval: 1, //showInLegend: null, // auto: true for standalone series, false for linked series softThreshold: true, states: { // states for the entire series hover: { //enabled: false, lineWidthPlus: 1, marker: { // lineWidth: base + 1, // radius: base + 1 }, halo: { size: 10, opacity: 0.25 } }, select: { marker: {} } }, stickyTracking: true, //tooltip: { //pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y}</b>' //valueDecimals: null, //xDateFormat: '%A, %b %e, %Y', //valuePrefix: '', //ySuffix: '' //} turboThreshold: 1000 // zIndex: null } }, labels: { //items: [], style: { //font: defaultFont, position: ABSOLUTE, color: '#3E576F' } }, legend: { enabled: true, align: 'center', //floating: false, layout: 'horizontal', labelFormatter: function () { return this.name; }, //borderWidth: 0, borderColor: '#909090', borderRadius: 0, navigation: { // animation: true, activeColor: '#274b6d', // arrowSize: 12 inactiveColor: '#CCC' // style: {} // text styles }, // margin: 20, // reversed: false, shadow: false, // backgroundColor: null, /*style: { padding: '5px' },*/ itemStyle: { color: '#333333', fontSize: '12px', fontWeight: 'bold' }, itemHoverStyle: { //cursor: 'pointer', removed as of #601 color: '#000' }, itemHiddenStyle: { color: '#CCC' }, itemCheckboxStyle: { position: ABSOLUTE, width: '13px', // for IE precision height: '13px' }, // itemWidth: undefined, // symbolRadius: 0, // symbolWidth: 16, symbolPadding: 5, verticalAlign: 'bottom', // width: undefined, x: 0, y: 0, title: { //text: null, style: { fontWeight: 'bold' } } }, loading: { // hideDuration: 100, labelStyle: { fontWeight: 'bold', position: RELATIVE, top: '45%' }, // showDuration: 0, style: { position: ABSOLUTE, backgroundColor: 'white', opacity: 0.5, textAlign: 'center' } }, tooltip: { enabled: true, animation: hasSVG, //crosshairs: null, backgroundColor: 'rgba(249, 249, 249, .85)', borderWidth: 1, borderRadius: 3, dateTimeLabelFormats: { millisecond: '%A, %b %e, %H:%M:%S.%L', second: '%A, %b %e, %H:%M:%S', minute: '%A, %b %e, %H:%M', hour: '%A, %b %e, %H:%M', day: '%A, %b %e, %Y', week: 'Week from %A, %b %e, %Y', month: '%B %Y', year: '%Y' }, footerFormat: '', //formatter: defaultFormatter, headerFormat: '<span style="font-size: 10px">{point.key}</span><br/>', pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y}</b><br/>', shadow: true, //shape: 'callout', //shared: false, snap: isTouchDevice ? 25 : 10, style: { color: '#333333', cursor: 'default', fontSize: '12px', padding: '8px', pointerEvents: 'none', // #1686 http://caniuse.com/#feat=pointer-events whiteSpace: 'nowrap' } //xDateFormat: '%A, %b %e, %Y', //valueDecimals: null, //valuePrefix: '', //valueSuffix: '' }, credits: { enabled: true, text: 'Highcharts.com', href: 'http://www.highcharts.com', position: { align: 'right', x: -10, verticalAlign: 'bottom', y: -5 }, style: { cursor: 'pointer', color: '#909090', fontSize: '9px' } } }; /** * Set the time methods globally based on the useUTC option. Time method can be either * local time or UTC (default). */ function setTimeMethods() { var globalOptions = defaultOptions.global, useUTC = globalOptions.useUTC, GET = useUTC ? 'getUTC' : 'get', SET = useUTC ? 'setUTC' : 'set'; Date = globalOptions.Date || win.Date; timezoneOffset = useUTC && globalOptions.timezoneOffset; getTimezoneOffset = useUTC && globalOptions.getTimezoneOffset; makeTime = function (year, month, date, hours, minutes, seconds) { var d; if (useUTC) { d = Date.UTC.apply(0, arguments); d += getTZOffset(d); } else { d = new Date( year, month, pick(date, 1), pick(hours, 0), pick(minutes, 0), pick(seconds, 0) ).getTime(); } return d; }; getMinutes = GET + 'Minutes'; getHours = GET + 'Hours'; getDay = GET + 'Day'; getDate = GET + 'Date'; getMonth = GET + 'Month'; getFullYear = GET + 'FullYear'; setMilliseconds = SET + 'Milliseconds'; setSeconds = SET + 'Seconds'; setMinutes = SET + 'Minutes'; setHours = SET + 'Hours'; setDate = SET + 'Date'; setMonth = SET + 'Month'; setFullYear = SET + 'FullYear'; } /** * Merge the default options with custom options and return the new options structure * @param {Object} options The new custom options */ function setOptions(options) { // Copy in the default options defaultOptions = merge(true, defaultOptions, options); // Apply UTC setTimeMethods(); return defaultOptions; } /** * Get the updated default options. Until 3.0.7, merely exposing defaultOptions for outside modules * wasn't enough because the setOptions method created a new object. */ function getOptions() { return defaultOptions; } // Series defaults var defaultPlotOptions = defaultOptions.plotOptions, defaultSeriesOptions = defaultPlotOptions.line; // set the default time methods setTimeMethods(); /** * Handle color operations. The object methods are chainable. * @param {String} input The input color in either rbga or hex format */ function Color(input) { // Backwards compatibility, allow instanciation without new if (!(this instanceof Color)) { return new Color(input); } // Initialize this.init(input); } Color.prototype = { // Collection of parsers. This can be extended from the outside by pushing parsers // to Highcharts.Colors.prototype.parsers. parsers: [{ // RGBA color regex: /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/, parse: function (result) { return [pInt(result[1]), pInt(result[2]), pInt(result[3]), parseFloat(result[4], 10)]; } }, { // HEX color regex: /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/, parse: function (result) { return [pInt(result[1], 16), pInt(result[2], 16), pInt(result[3], 16), 1]; } }, { // RGB color regex: /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/, parse: function (result) { return [pInt(result[1]), pInt(result[2]), pInt(result[3]), 1]; } }], /** * Parse the input color to rgba array * @param {String} input */ init: function (input) { var result, rgba, i, parser; this.input = input; // Gradients if (input && input.stops) { this.stops = map(input.stops, function (stop) { return new Color(stop[1]); }); // Solid colors } else { i = this.parsers.length; while (i-- && !rgba) { parser = this.parsers[i]; result = parser.regex.exec(input); if (result) { rgba = parser.parse(result); } } } this.rgba = rgba || []; }, /** * Return the color a specified format * @param {String} format */ get: function (format) { var input = this.input, rgba = this.rgba, ret; if (this.stops) { ret = merge(input); ret.stops = [].concat(ret.stops); each(this.stops, function (stop, i) { ret.stops[i] = [ret.stops[i][0], stop.get(format)]; }); // it's NaN if gradient colors on a column chart } else if (rgba && !isNaN(rgba[0])) { if (format === 'rgb' || (!format && rgba[3] === 1)) { ret = 'rgb(' + rgba[0] + ',' + rgba[1] + ',' + rgba[2] + ')'; } else if (format === 'a') { ret = rgba[3]; } else { ret = 'rgba(' + rgba.join(',') + ')'; } } else { ret = input; } return ret; }, /** * Brighten the color * @param {Number} alpha */ brighten: function (alpha) { var i, rgba = this.rgba; if (this.stops) { each(this.stops, function (stop) { stop.brighten(alpha); }); } else if (isNumber(alpha) && alpha !== 0) { for (i = 0; i < 3; i++) { rgba[i] += pInt(alpha * 255); if (rgba[i] < 0) { rgba[i] = 0; } if (rgba[i] > 255) { rgba[i] = 255; } } } return this; }, /** * Set the color's opacity to a given alpha value * @param {Number} alpha */ setOpacity: function (alpha) { this.rgba[3] = alpha; return this; } }; /** * A wrapper object for SVG elements */ function SVGElement() {} SVGElement.prototype = { // Default base for animation opacity: 1, // For labels, these CSS properties are applied to the <text> node directly textProps: ['direction', 'fontSize', 'fontWeight', 'fontFamily', 'fontStyle', 'color', 'lineHeight', 'width', 'textDecoration', 'textOverflow', 'textShadow'], /** * Initialize the SVG renderer * @param {Object} renderer * @param {String} nodeName */ init: function (renderer, nodeName) { var wrapper = this; wrapper.element = nodeName === 'span' ? createElement(nodeName) : doc.createElementNS(SVG_NS, nodeName); wrapper.renderer = renderer; }, /** * Animate a given attribute * @param {Object} params * @param {Number} options Options include duration, easing, step and complete * @param {Function} complete Function to perform at the end of animation */ animate: function (params, options, complete) { var animOptions = pick(options, this.renderer.globalAnimation, true); stop(this); // stop regardless of animation actually running, or reverting to .attr (#607) if (animOptions) { animOptions = merge(animOptions, {}); //#2625 if (complete) { // allows using a callback with the global animation without overwriting it animOptions.complete = complete; } animate(this, params, animOptions); } else { this.attr(params, null, complete); } return this; }, /** * Build an SVG gradient out of a common JavaScript configuration object */ colorGradient: function (color, prop, elem) { var renderer = this.renderer, colorObject, gradName, gradAttr, radAttr, gradients, gradientObject, stops, stopColor, stopOpacity, radialReference, n, id, key = [], value; // Apply linear or radial gradients if (color.linearGradient) { gradName = 'linearGradient'; } else if (color.radialGradient) { gradName = 'radialGradient'; } if (gradName) { gradAttr = color[gradName]; gradients = renderer.gradients; stops = color.stops; radialReference = elem.radialReference; // Keep < 2.2 kompatibility if (isArray(gradAttr)) { color[gradName] = gradAttr = { x1: gradAttr[0], y1: gradAttr[1], x2: gradAttr[2], y2: gradAttr[3], gradientUnits: 'userSpaceOnUse' }; } // Correct the radial gradient for the radial reference system if (gradName === 'radialGradient' && radialReference && !defined(gradAttr.gradientUnits)) { radAttr = gradAttr; // Save the radial attributes for updating gradAttr = merge(gradAttr, renderer.getRadialAttr(radialReference, radAttr), { gradientUnits: 'userSpaceOnUse' } ); } // Build the unique key to detect whether we need to create a new element (#1282) for (n in gradAttr) { if (n !== 'id') { key.push(n, gradAttr[n]); } } for (n in stops) { key.push(stops[n]); } key = key.join(','); // Check if a gradient object with the same config object is created within this renderer if (gradients[key]) { id = gradients[key].attr('id'); } else { // Set the id and create the element gradAttr.id = id = PREFIX + idCounter++; gradients[key] = gradientObject = renderer.createElement(gradName) .attr(gradAttr) .add(renderer.defs); gradientObject.radAttr = radAttr; // The gradient needs to keep a list of stops to be able to destroy them gradientObject.stops = []; each(stops, function (stop) { var stopObject; if (stop[1].indexOf('rgba') === 0) { colorObject = Color(stop[1]); stopColor = colorObject.get('rgb'); stopOpacity = colorObject.get('a'); } else { stopColor = stop[1]; stopOpacity = 1; } stopObject = renderer.createElement('stop').attr({ offset: stop[0], 'stop-color': stopColor, 'stop-opacity': stopOpacity }).add(gradientObject); // Add the stop element to the gradient gradientObject.stops.push(stopObject); }); } // Set the reference to the gradient object value = 'url(' + renderer.url + '#' + id + ')'; elem.setAttribute(prop, value); elem.gradient = key; // Allow the color to be concatenated into tooltips formatters etc. (#2995) color.toString = function () { return value; }; } }, /** * Apply a polyfill to the text-stroke CSS property, by copying the text element * and apply strokes to the copy. * * Contrast checks at http://jsfiddle.net/highcharts/43soe9m1/2/ */ applyTextShadow: function (textShadow) { var elem = this.element, tspans, hasContrast = textShadow.indexOf('contrast') !== -1, styles = {}, forExport = this.renderer.forExport, // IE10 and IE11 report textShadow in elem.style even though it doesn't work. Check // this again with new IE release. In exports, the rendering is passed to PhantomJS. supports = forExport || (elem.style.textShadow !== UNDEFINED && !isMS); // When the text shadow is set to contrast, use dark stroke for light text and vice versa if (hasContrast) { styles.textShadow = textShadow = textShadow.replace(/contrast/g, this.renderer.getContrast(elem.style.fill)); } // Safari with retina displays as well as PhantomJS bug (#3974). Firefox does not tolerate this, // it removes the text shadows. if (isWebKit || forExport) { styles.textRendering = 'geometricPrecision'; } /* Selective side-by-side testing in supported browser (http://jsfiddle.net/highcharts/73L1ptrh/) if (elem.textContent.indexOf('2.') === 0) { elem.style['text-shadow'] = 'none'; supports = false; } // */ // No reason to polyfill, we've got native support if (supports) { this.css(styles); // Apply altered textShadow or textRendering workaround } else { this.fakeTS = true; // Fake text shadow // In order to get the right y position of the clones, // copy over the y setter this.ySetter = this.xSetter; tspans = [].slice.call(elem.getElementsByTagName('tspan')); each(textShadow.split(/\s?,\s?/g), function (textShadow) { var firstChild = elem.firstChild, color, strokeWidth; textShadow = textShadow.split(' '); color = textShadow[textShadow.length - 1]; // Approximately tune the settings to the text-shadow behaviour strokeWidth = textShadow[textShadow.length - 2]; if (strokeWidth) { each(tspans, function (tspan, y) { var clone; // Let the first line start at the correct X position if (y === 0) { tspan.setAttribute('x', elem.getAttribute('x')); y = elem.getAttribute('y'); tspan.setAttribute('y', y || 0); if (y === null) { elem.setAttribute('y', 0); } } // Create the clone and apply shadow properties clone = tspan.cloneNode(1); attr(clone, { 'class': PREFIX + 'text-shadow', 'fill': color, 'stroke': color, 'stroke-opacity': 1 / mathMax(pInt(strokeWidth), 3), 'stroke-width': strokeWidth, 'stroke-linejoin': 'round' }); elem.insertBefore(clone, firstChild); }); } }); } }, /** * Set or get a given attribute * @param {Object|String} hash * @param {Mixed|Undefined} val */ attr: function (hash, val, complete) { var key, value, element = this.element, hasSetSymbolSize, ret = this, skipAttr, setter; // single key-value pair if (typeof hash === 'string' && val !== UNDEFINED) { key = hash; hash = {}; hash[key] = val; } // used as a getter: first argument is a string, second is undefined if (typeof hash === 'string') { ret = (this[hash + 'Getter'] || this._defaultGetter).call(this, hash, element); // setter } else { for (key in hash) { value = hash[key]; skipAttr = false; if (this.symbolName && /^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(key)) { if (!hasSetSymbolSize) { this.symbolAttr(hash); hasSetSymbolSize = true; } skipAttr = true; } if (this.rotation && (key === 'x' || key === 'y')) { this.doTransform = true; } if (!skipAttr) { setter = this[key + 'Setter'] || this._defaultSetter; setter.call(this, value, key, element); // Let the shadow follow the main element if (this.shadows && /^(width|height|visibility|x|y|d|transform|cx|cy|r)$/.test(key)) { this.updateShadows(key, value, setter); } } } // Update transform. Do this outside the loop to prevent redundant updating for batch setting // of attributes. if (this.doTransform) { this.updateTransform(); this.doTransform = false; } } // In accordance with animate, run a complete callback if (complete) { complete(); } return ret; }, /** * Update the shadow elements with new attributes * @param {String} key The attribute name * @param {String|Number} value The value of the attribute * @param {Function} setter The setter function, inherited from the parent wrapper * @returns {undefined} */ updateShadows: function (key, value, setter) { var shadows = this.shadows, i = shadows.length; while (i--) { setter.call( null, key === 'height' ? Math.max(value - (shadows[i].cutHeight || 0), 0) : key === 'd' ? this.d : value, key, shadows[i] ); } }, /** * Add a class name to an element */ addClass: function (className) { var element = this.element, currentClassName = attr(element, 'class') || ''; if (currentClassName.indexOf(className) === -1) { attr(element, 'class', currentClassName + ' ' + className); } return this; }, /* hasClass and removeClass are not (yet) needed hasClass: function (className) { return attr(this.element, 'class').indexOf(className) !== -1; }, removeClass: function (className) { attr(this.element, 'class', attr(this.element, 'class').replace(className, '')); return this; }, */ /** * If one of the symbol size affecting parameters are changed, * check all the others only once for each call to an element's * .attr() method * @param {Object} hash */ symbolAttr: function (hash) { var wrapper = this; each(['x', 'y', 'r', 'start', 'end', 'width', 'height', 'innerR', 'anchorX', 'anchorY'], function (key) { wrapper[key] = pick(hash[key], wrapper[key]); }); wrapper.attr({ d: wrapper.renderer.symbols[wrapper.symbolName]( wrapper.x, wrapper.y, wrapper.width, wrapper.height, wrapper ) }); }, /** * Apply a clipping path to this object * @param {String} id */ clip: function (clipRect) { return this.attr('clip-path', clipRect ? 'url(' + this.renderer.url + '#' + clipRect.id + ')' : NONE); }, /** * Calculate the coordinates needed for drawing a rectangle crisply and return the * calculated attributes * @param {Number} strokeWidth * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height */ crisp: function (rect) { var wrapper = this, key, attribs = {}, normalizer, strokeWidth = rect.strokeWidth || wrapper.strokeWidth || 0; normalizer = mathRound(strokeWidth) % 2 / 2; // mathRound because strokeWidth can sometimes have roundoff errors // normalize for crisp edges rect.x = mathFloor(rect.x || wrapper.x || 0) + normalizer; rect.y = mathFloor(rect.y || wrapper.y || 0) + normalizer; rect.width = mathFloor((rect.width || wrapper.width || 0) - 2 * normalizer); rect.height = mathFloor((rect.height || wrapper.height || 0) - 2 * normalizer); rect.strokeWidth = strokeWidth; for (key in rect) { if (wrapper[key] !== rect[key]) { // only set attribute if changed wrapper[key] = attribs[key] = rect[key]; } } return attribs; }, /** * Set styles for the element * @param {Object} styles */ css: function (styles) { var elemWrapper = this, oldStyles = elemWrapper.styles, newStyles = {}, elem = elemWrapper.element, textWidth, n, serializedCss = '', hyphenate, hasNew = !oldStyles; // convert legacy if (styles && styles.color) { styles.fill = styles.color; } // Filter out existing styles to increase performance (#2640) if (oldStyles) { for (n in styles) { if (styles[n] !== oldStyles[n]) { newStyles[n] = styles[n]; hasNew = true; } } } if (hasNew) { textWidth = elemWrapper.textWidth = (styles && styles.width && elem.nodeName.toLowerCase() === 'text' && pInt(styles.width)) || elemWrapper.textWidth; // #3501 // Merge the new styles with the old ones if (oldStyles) { styles = extend( oldStyles, newStyles ); } // store object elemWrapper.styles = styles; if (textWidth && (useCanVG || (!hasSVG && elemWrapper.renderer.forExport))) { delete styles.width; } // serialize and set style attribute if (isMS && !hasSVG) { css(elemWrapper.element, styles); } else { hyphenate = function (a, b) { return '-' + b.toLowerCase(); }; for (n in styles) { serializedCss += n.replace(/([A-Z])/g, hyphenate) + ':' + styles[n] + ';'; } attr(elem, 'style', serializedCss); // #1881 } // re-build text if (textWidth && elemWrapper.added) { elemWrapper.renderer.buildText(elemWrapper); } } return elemWrapper; }, /** * Add an event listener * @param {String} eventType * @param {Function} handler */ on: function (eventType, handler) { var svgElement = this, element = svgElement.element; // touch if (hasTouch && eventType === 'click') { element.ontouchstart = function (e) { svgElement.touchEventFired = Date.now(); e.preventDefault(); handler.call(element, e); }; element.onclick = function (e) { if (userAgent.indexOf('Android') === -1 || Date.now() - (svgElement.touchEventFired || 0) > 1100) { // #2269 handler.call(element, e); } }; } else { // simplest possible event model for internal use element['on' + eventType] = handler; } return this; }, /** * Set the coordinates needed to draw a consistent radial gradient across * pie slices regardless of positioning inside the chart. The format is * [centerX, centerY, diameter] in pixels. */ setRadialReference: function (coordinates) { var existingGradient = this.renderer.gradients[this.element.gradient]; this.element.radialReference = coordinates; // On redrawing objects with an existing gradient, the gradient needs // to be repositioned (#3801) if (existingGradient && existingGradient.radAttr) { existingGradient.animate( this.renderer.getRadialAttr( coordinates, existingGradient.radAttr ) ); } return this; }, /** * Move an object and its children by x and y values * @param {Number} x * @param {Number} y */ translate: function (x, y) { return this.attr({ translateX: x, translateY: y }); }, /** * Invert a group, rotate and flip */ invert: function () { var wrapper = this; wrapper.inverted = true; wrapper.updateTransform(); return wrapper; }, /** * Private method to update the transform attribute based on internal * properties */ updateTransform: function () { var wrapper = this, translateX = wrapper.translateX || 0, translateY = wrapper.translateY || 0, scaleX = wrapper.scaleX, scaleY = wrapper.scaleY, inverted = wrapper.inverted, rotation = wrapper.rotation, element = wrapper.element, transform; // flipping affects translate as adjustment for flipping around the group's axis if (inverted) { translateX += wrapper.attr('width'); translateY += wrapper.attr('height'); } // Apply translate. Nearly all transformed elements have translation, so instead // of checking for translate = 0, do it always (#1767, #1846). transform = ['translate(' + translateX + ',' + translateY + ')']; // apply rotation if (inverted) { transform.push('rotate(90) scale(-1,1)'); } else if (rotation) { // text rotation transform.push('rotate(' + rotation + ' ' + (element.getAttribute('x') || 0) + ' ' + (element.getAttribute('y') || 0) + ')'); // Delete bBox memo when the rotation changes //delete wrapper.bBox; } // apply scale if (defined(scaleX) || defined(scaleY)) { transform.push('scale(' + pick(scaleX, 1) + ' ' + pick(scaleY, 1) + ')'); } if (transform.length) { element.setAttribute('transform', transform.join(' ')); } }, /** * Bring the element to the front */ toFront: function () { var element = this.element; element.parentNode.appendChild(element); return this; }, /** * Break down alignment options like align, verticalAlign, x and y * to x and y relative to the chart. * * @param {Object} alignOptions * @param {Boolean} alignByTranslate * @param {String[Object} box The box to align to, needs a width and height. When the * box is a string, it refers to an object in the Renderer. For example, when * box is 'spacingBox', it refers to Renderer.spacingBox which holds width, height * x and y properties. * */ align: function (alignOptions, alignByTranslate, box) { var align, vAlign, x, y, attribs = {}, alignTo, renderer = this.renderer, alignedObjects = renderer.alignedObjects; // First call on instanciate if (alignOptions) { this.alignOptions = alignOptions; this.alignByTranslate = alignByTranslate; if (!box || isString(box)) { // boxes other than renderer handle this internally this.alignTo = alignTo = box || 'renderer'; erase(alignedObjects, this); // prevent duplicates, like legendGroup after resize alignedObjects.push(this); box = null; // reassign it below } // When called on resize, no arguments are supplied } else { alignOptions = this.alignOptions; alignByTranslate = this.alignByTranslate; alignTo = this.alignTo; } box = pick(box, renderer[alignTo], renderer); // Assign variables align = alignOptions.align; vAlign = alignOptions.verticalAlign; x = (box.x || 0) + (alignOptions.x || 0); // default: left align y = (box.y || 0) + (alignOptions.y || 0); // default: top align // Align if (align === 'right' || align === 'center') { x += (box.width - (alignOptions.width || 0)) / { right: 1, center: 2 }[align]; } attribs[alignByTranslate ? 'translateX' : 'x'] = mathRound(x); // Vertical align if (vAlign === 'bottom' || vAlign === 'middle') { y += (box.height - (alignOptions.height || 0)) / ({ bottom: 1, middle: 2 }[vAlign] || 1); } attribs[alignByTranslate ? 'translateY' : 'y'] = mathRound(y); // Animate only if already placed this[this.placed ? 'animate' : 'attr'](attribs); this.placed = true; this.alignAttr = attribs; return this; }, /** * Get the bounding box (width, height, x and y) for the element */ getBBox: function (reload, rot) { var wrapper = this, bBox, // = wrapper.bBox, renderer = wrapper.renderer, width, height, rotation, rad, element = wrapper.element, styles = wrapper.styles, textStr = wrapper.textStr, textShadow, elemStyle = element.style, toggleTextShadowShim, cache = renderer.cache, cacheKeys = renderer.cacheKeys, cacheKey; rotation = pick(rot, wrapper.rotation); rad = rotation * deg2rad; if (textStr !== UNDEFINED) { // Properties that affect bounding box cacheKey = ['', rotation || 0, styles && styles.fontSize, element.style.width].join(','); // Since numbers are monospaced, and numerical labels appear a lot in a chart, // we assume that a label of n characters has the same bounding box as others // of the same length. if (textStr === '' || numRegex.test(textStr)) { cacheKey = 'num:' + textStr.toString().length + cacheKey; // Caching all strings reduces rendering time by 4-5%. } else { cacheKey = textStr + cacheKey; } } if (cacheKey && !reload) { bBox = cache[cacheKey]; } // No cache found if (!bBox) { // SVG elements if (element.namespaceURI === SVG_NS || renderer.forExport) { try { // Fails in Firefox if the container has display: none. // When the text shadow shim is used, we need to hide the fake shadows // to get the correct bounding box (#3872) toggleTextShadowShim = this.fakeTS && function (display) { each(element.querySelectorAll('.' + PREFIX + 'text-shadow'), function (tspan) { tspan.style.display = display; }); }; // Workaround for #3842, Firefox reporting wrong bounding box for shadows if (isFirefox && elemStyle.textShadow) { textShadow = elemStyle.textShadow; elemStyle.textShadow = ''; } else if (toggleTextShadowShim) { toggleTextShadowShim(NONE); } bBox = element.getBBox ? // SVG: use extend because IE9 is not allowed to change width and height in case // of rotation (below) extend({}, element.getBBox()) : // Canvas renderer and legacy IE in export mode { width: element.offsetWidth, height: element.offsetHeight }; // #3842 if (textShadow) { elemStyle.textShadow = textShadow; } else if (toggleTextShadowShim) { toggleTextShadowShim(''); } } catch (e) {} // If the bBox is not set, the try-catch block above failed. The other condition // is for Opera that returns a width of -Infinity on hidden elements. if (!bBox || bBox.width < 0) { bBox = { width: 0, height: 0 }; } // VML Renderer or useHTML within SVG } else { bBox = wrapper.htmlGetBBox(); } // True SVG elements as well as HTML elements in modern browsers using the .useHTML option // need to compensated for rotation if (renderer.isSVG) { width = bBox.width; height = bBox.height; // Workaround for wrong bounding box in IE9 and IE10 (#1101, #1505, #1669, #2568) if (isMS && styles && styles.fontSize === '11px' && height.toPrecision(3) === '16.9') { bBox.height = height = 14; } // Adjust for rotated text if (rotation) { bBox.width = mathAbs(height * mathSin(rad)) + mathAbs(width * mathCos(rad)); bBox.height = mathAbs(height * mathCos(rad)) + mathAbs(width * mathSin(rad)); } } // Cache it if (cacheKey) { // Rotate (#4681) while (cacheKeys.length > 250) { delete cache[cacheKeys.shift()]; } if (!cache[cacheKey]) { cacheKeys.push(cacheKey); } cache[cacheKey] = bBox; } } return bBox; }, /** * Show the element */ show: function (inherit) { return this.attr({ visibility: inherit ? 'inherit' : VISIBLE }); }, /** * Hide the element */ hide: function () { return this.attr({ visibility: HIDDEN }); }, fadeOut: function (duration) { var elemWrapper = this; elemWrapper.animate({ opacity: 0 }, { duration: duration || 150, complete: function () { elemWrapper.attr({ y: -9999 }); // #3088, assuming we're only using this for tooltips } }); }, /** * Add the element * @param {Object|Undefined} parent Can be an element, an element wrapper or undefined * to append the element to the renderer.box. */ add: function (parent) { var renderer = this.renderer, element = this.element, inserted; if (parent) { this.parentGroup = parent; } // mark as inverted this.parentInverted = parent && parent.inverted; // build formatted text if (this.textStr !== undefined) { renderer.buildText(this); } // Mark as added this.added = true; // If we're adding to renderer root, or other elements in the group // have a z index, we need to handle it if (!parent || parent.handleZ || this.zIndex) { inserted = this.zIndexSetter(); } // If zIndex is not handled, append at the end if (!inserted) { (parent ? parent.element : renderer.box).appendChild(element); } // fire an event for internal hooks if (this.onAdd) { this.onAdd(); } return this; }, /** * Removes a child either by removeChild or move to garbageBin. * Issue 490; in VML removeChild results in Orphaned nodes according to sIEve, discardElement does not. */ safeRemoveChild: function (element) { var parentNode = element.parentNode; if (parentNode) { parentNode.removeChild(element); } }, /** * Destroy the element and element wrapper */ destroy: function () { var wrapper = this, element = wrapper.element || {}, shadows = wrapper.shadows, parentToClean = wrapper.renderer.isSVG && element.nodeName === 'SPAN' && wrapper.parentGroup, grandParent, key, i; // remove events element.onclick = element.onmouseout = element.onmouseover = element.onmousemove = element.point = null; stop(wrapper); // stop running animations if (wrapper.clipPath) { wrapper.clipPath = wrapper.clipPath.destroy(); } // Destroy stops in case this is a gradient object if (wrapper.stops) { for (i = 0; i < wrapper.stops.length; i++) { wrapper.stops[i] = wrapper.stops[i].destroy(); } wrapper.stops = null; } // remove element wrapper.safeRemoveChild(element); // destroy shadows if (shadows) { each(shadows, function (shadow) { wrapper.safeRemoveChild(shadow); }); } // In case of useHTML, clean up empty containers emulating SVG groups (#1960, #2393, #2697). while (parentToClean && parentToClean.div && parentToClean.div.childNodes.length === 0) { grandParent = parentToClean.parentGroup; wrapper.safeRemoveChild(parentToClean.div); delete parentToClean.div; parentToClean = grandParent; } // remove from alignObjects if (wrapper.alignTo) { erase(wrapper.renderer.alignedObjects, wrapper); } for (key in wrapper) { delete wrapper[key]; } return null; }, /** * Add a shadow to the element. Must be done after the element is added to the DOM * @param {Boolean|Object} shadowOptions */ shadow: function (shadowOptions, group, cutOff) { var shadows = [], i, shadow, element = this.element, strokeWidth, shadowWidth, shadowElementOpacity, // compensate for inverted plot area transform; if (shadowOptions) { shadowWidth = pick(shadowOptions.width, 3); shadowElementOpacity = (shadowOptions.opacity || 0.15) / shadowWidth; transform = this.parentInverted ? '(-1,-1)' : '(' + pick(shadowOptions.offsetX, 1) + ', ' + pick(shadowOptions.offsetY, 1) + ')'; for (i = 1; i <= shadowWidth; i++) { shadow = element.cloneNode(0); strokeWidth = (shadowWidth * 2) + 1 - (2 * i); attr(shadow, { 'isShadow': 'true', 'stroke': shadowOptions.color || 'black', 'stroke-opacity': shadowElementOpacity * i, 'stroke-width': strokeWidth, 'transform': 'translate' + transform, 'fill': NONE }); if (cutOff) { attr(shadow, 'height', mathMax(attr(shadow, 'height') - strokeWidth, 0)); shadow.cutHeight = strokeWidth; } if (group) { group.element.appendChild(shadow); } else { element.parentNode.insertBefore(shadow, element); } shadows.push(shadow); } this.shadows = shadows; } return this; }, xGetter: function (key) { if (this.element.nodeName === 'circle') { key = { x: 'cx', y: 'cy' }[key] || key; } return this._defaultGetter(key); }, /** * Get the current value of an attribute or pseudo attribute, used mainly * for animation. */ _defaultGetter: function (key) { var ret = pick(this[key], this.element ? this.element.getAttribute(key) : null, 0); if (/^[\-0-9\.]+$/.test(ret)) { // is numerical ret = parseFloat(ret); } return ret; }, dSetter: function (value, key, element) { if (value && value.join) { // join path value = value.join(' '); } if (/(NaN| {2}|^$)/.test(value)) { value = 'M 0 0'; } element.setAttribute(key, value); this[key] = value; }, dashstyleSetter: function (value) { var i; value = value && value.toLowerCase(); if (value) { value = value .replace('shortdashdotdot', '3,1,1,1,1,1,') .replace('shortdashdot', '3,1,1,1') .replace('shortdot', '1,1,') .replace('shortdash', '3,1,') .replace('longdash', '8,3,') .replace(/dot/g, '1,3,') .replace('dash', '4,3,') .replace(/,$/, '') .split(','); // ending comma i = value.length; while (i--) { value[i] = pInt(value[i]) * this['stroke-width']; } value = value.join(',') .replace('NaN', 'none'); // #3226 this.element.setAttribute('stroke-dasharray', value); } }, alignSetter: function (value) { this.element.setAttribute('text-anchor', { left: 'start', center: 'middle', right: 'end' }[value]); }, opacitySetter: function (value, key, element) { this[key] = value; element.setAttribute(key, value); }, titleSetter: function (value) { var titleNode = this.element.getElementsByTagName('title')[0]; if (!titleNode) { titleNode = doc.createElementNS(SVG_NS, 'title'); this.element.appendChild(titleNode); } titleNode.appendChild( doc.createTextNode( (String(pick(value), '')).replace(/<[^>]*>/g, '') // #3276, #3895 ) ); }, textSetter: function (value) { if (value !== this.textStr) { // Delete bBox memo when the text changes delete this.bBox; this.textStr = value; if (this.added) { this.renderer.buildText(this); } } }, fillSetter: function (value, key, element) { if (typeof value === 'string') { element.setAttribute(key, value); } else if (value) { this.colorGradient(value, key, element); } }, visibilitySetter: function (value, key, element) { // IE9-11 doesn't handle visibilty:inherit well, so we remove the attribute instead (#2881, #3909) if (value === 'inherit') { element.removeAttribute(key); } else { element.setAttribute(key, value); } }, zIndexSetter: function (value, key) { var renderer = this.renderer, parentGroup = this.parentGroup, parentWrapper = parentGroup || renderer, parentNode = parentWrapper.element || renderer.box, childNodes, otherElement, otherZIndex, element = this.element, inserted, run = this.added, i; if (defined(value)) { element.setAttribute(key, value); // So we can read it for other elements in the group value = +value; if (this[key] === value) { // Only update when needed (#3865) run = false; } this[key] = value; } // Insert according to this and other elements' zIndex. Before .add() is called, // nothing is done. Then on add, or by later calls to zIndexSetter, the node // is placed on the right place in the DOM. if (run) { value = this.zIndex; if (value && parentGroup) { parentGroup.handleZ = true; } childNodes = parentNode.childNodes; for (i = 0; i < childNodes.length && !inserted; i++) { otherElement = childNodes[i]; otherZIndex = attr(otherElement, 'zIndex'); if (otherElement !== element && ( // Insert before the first element with a higher zIndex pInt(otherZIndex) > value || // If no zIndex given, insert before the first element with a zIndex (!defined(value) && defined(otherZIndex)) )) { parentNode.insertBefore(element, otherElement); inserted = true; } } if (!inserted) { parentNode.appendChild(element); } } return inserted; }, _defaultSetter: function (value, key, element) { element.setAttribute(key, value); } }; // Some shared setters and getters SVGElement.prototype.yGetter = SVGElement.prototype.xGetter; SVGElement.prototype.translateXSetter = SVGElement.prototype.translateYSetter = SVGElement.prototype.rotationSetter = SVGElement.prototype.verticalAlignSetter = SVGElement.prototype.scaleXSetter = SVGElement.prototype.scaleYSetter = function (value, key) { this[key] = value; this.doTransform = true; }; // WebKit and Batik have problems with a stroke-width of zero, so in this case we remove the // stroke attribute altogether. #1270, #1369, #3065, #3072. SVGElement.prototype['stroke-widthSetter'] = SVGElement.prototype.strokeSetter = function (value, key, element) { this[key] = value; // Only apply the stroke attribute if the stroke width is defined and larger than 0 if (this.stroke && this['stroke-width']) { this.strokeWidth = this['stroke-width']; SVGElement.prototype.fillSetter.call(this, this.stroke, 'stroke', element); // use prototype as instance may be overridden element.setAttribute('stroke-width', this['stroke-width']); this.hasStroke = true; } else if (key === 'stroke-width' && value === 0 && this.hasStroke) { element.removeAttribute('stroke'); this.hasStroke = false; } }; /** * The default SVG renderer */ var SVGRenderer = function () { this.init.apply(this, arguments); }; SVGRenderer.prototype = { Element: SVGElement, /** * Initialize the SVGRenderer * @param {Object} container * @param {Number} width * @param {Number} height * @param {Boolean} forExport */ init: function (container, width, height, style, forExport, allowHTML) { var renderer = this, boxWrapper, element, desc; boxWrapper = renderer.createElement('svg') .attr({ version: '1.1' }) .css(this.getStyle(style)); element = boxWrapper.element; container.appendChild(element); // For browsers other than IE, add the namespace attribute (#1978) if (container.innerHTML.indexOf('xmlns') === -1) { attr(element, 'xmlns', SVG_NS); } // object properties renderer.isSVG = true; renderer.box = element; renderer.boxWrapper = boxWrapper; renderer.alignedObjects = []; // Page url used for internal references. #24, #672, #1070 renderer.url = (isFirefox || isWebKit) && doc.getElementsByTagName('base').length ? win.location.href .replace(/#.*?$/, '') // remove the hash .replace(/([\('\)])/g, '\\$1') // escape parantheses and quotes .replace(/ /g, '%20') : // replace spaces (needed for Safari only) ''; // Add description desc = this.createElement('desc').add(); desc.element.appendChild(doc.createTextNode('Created with ' + PRODUCT + ' ' + VERSION)); renderer.defs = this.createElement('defs').add(); renderer.allowHTML = allowHTML; renderer.forExport = forExport; renderer.gradients = {}; // Object where gradient SvgElements are stored renderer.cache = {}; // Cache for numerical bounding boxes renderer.cacheKeys = []; renderer.imgCount = 0; renderer.setSize(width, height, false); // Issue 110 workaround: // In Firefox, if a div is positioned by percentage, its pixel position may land // between pixels. The container itself doesn't display this, but an SVG element // inside this container will be drawn at subpixel precision. In order to draw // sharp lines, this must be compensated for. This doesn't seem to work inside // iframes though (like in jsFiddle). var subPixelFix, rect; if (isFirefox && container.getBoundingClientRect) { renderer.subPixelFix = subPixelFix = function () { css(container, { left: 0, top: 0 }); rect = container.getBoundingClientRect(); css(container, { left: (mathCeil(rect.left) - rect.left) + PX, top: (mathCeil(rect.top) - rect.top) + PX }); }; // run the fix now subPixelFix(); // run it on resize addEvent(win, 'resize', subPixelFix); } }, getStyle: function (style) { this.style = extend({ fontFamily: '"Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif', // default font fontSize: '12px' }, style); return this.style; }, /** * Detect whether the renderer is hidden. This happens when one of the parent elements * has display: none. #608. */ isHidden: function () { return !this.boxWrapper.getBBox().width; }, /** * Destroys the renderer and its allocated members. */ destroy: function () { var renderer = this, rendererDefs = renderer.defs; renderer.box = null; renderer.boxWrapper = renderer.boxWrapper.destroy(); // Call destroy on all gradient elements destroyObjectProperties(renderer.gradients || {}); renderer.gradients = null; // Defs are null in VMLRenderer // Otherwise, destroy them here. if (rendererDefs) { renderer.defs = rendererDefs.destroy(); } // Remove sub pixel fix handler // We need to check that there is a handler, otherwise all functions that are registered for event 'resize' are removed // See issue #982 if (renderer.subPixelFix) { removeEvent(win, 'resize', renderer.subPixelFix); } renderer.alignedObjects = null; return null; }, /** * Create a wrapper for an SVG element * @param {Object} nodeName */ createElement: function (nodeName) { var wrapper = new this.Element(); wrapper.init(this, nodeName); return wrapper; }, /** * Dummy function for use in canvas renderer */ draw: function () {}, /** * Get converted radial gradient attributes */ getRadialAttr: function (radialReference, gradAttr) { return { cx: (radialReference[0] - radialReference[2] / 2) + gradAttr.cx * radialReference[2], cy: (radialReference[1] - radialReference[2] / 2) + gradAttr.cy * radialReference[2], r: gradAttr.r * radialReference[2] }; }, /** * Parse a simple HTML string into SVG tspans * * @param {Object} textNode The parent text SVG node */ buildText: function (wrapper) { var textNode = wrapper.element, renderer = this, forExport = renderer.forExport, textStr = pick(wrapper.textStr, '').toString(), hasMarkup = textStr.indexOf('<') !== -1, lines, childNodes = textNode.childNodes, styleRegex, hrefRegex, parentX = attr(textNode, 'x'), textStyles = wrapper.styles, width = wrapper.textWidth, textLineHeight = textStyles && textStyles.lineHeight, textShadow = textStyles && textStyles.textShadow, ellipsis = textStyles && textStyles.textOverflow === 'ellipsis', i = childNodes.length, tempParent = width && !wrapper.added && this.box, getLineHeight = function (tspan) { return textLineHeight ? pInt(textLineHeight) : renderer.fontMetrics( /(px|em)$/.test(tspan && tspan.style.fontSize) ? tspan.style.fontSize : ((textStyles && textStyles.fontSize) || renderer.style.fontSize || 12), tspan ).h; }, unescapeAngleBrackets = function (inputStr) { return inputStr.replace(/&lt;/g, '<').replace(/&gt;/g, '>'); }; /// remove old text while (i--) { textNode.removeChild(childNodes[i]); } // Skip tspans, add text directly to text node. The forceTSpan is a hook // used in text outline hack. if (!hasMarkup && !textShadow && !ellipsis && textStr.indexOf(' ') === -1) { textNode.appendChild(doc.createTextNode(unescapeAngleBrackets(textStr))); // Complex strings, add more logic } else { styleRegex = /<.*style="([^"]+)".*>/; hrefRegex = /<.*href="(http[^"]+)".*>/; if (tempParent) { tempParent.appendChild(textNode); // attach it to the DOM to read offset width } if (hasMarkup) { lines = textStr .replace(/<(b|strong)>/g, '<span style="font-weight:bold">') .replace(/<(i|em)>/g, '<span style="font-style:italic">') .replace(/<a/g, '<span') .replace(/<\/(b|strong|i|em|a)>/g, '</span>') .split(/<br.*?>/g); } else { lines = [textStr]; } // remove empty line at end if (lines[lines.length - 1] === '') { lines.pop(); } // build the lines each(lines, function (line, lineNo) { var spans, spanNo = 0; line = line.replace(/<span/g, '|||<span').replace(/<\/span>/g, '</span>|||'); spans = line.split('|||'); each(spans, function (span) { if (span !== '' || spans.length === 1) { var attributes = {}, tspan = doc.createElementNS(SVG_NS, 'tspan'), spanStyle; // #390 if (styleRegex.test(span)) { spanStyle = span.match(styleRegex)[1].replace(/(;| |^)color([ :])/, '$1fill$2'); attr(tspan, 'style', spanStyle); } if (hrefRegex.test(span) && !forExport) { // Not for export - #1529 attr(tspan, 'onclick', 'location.href=\"' + span.match(hrefRegex)[1] + '\"'); css(tspan, { cursor: 'pointer' }); } span = unescapeAngleBrackets(span.replace(/<(.|\n)*?>/g, '') || ' '); // Nested tags aren't supported, and cause crash in Safari (#1596) if (span !== ' ') { // add the text node tspan.appendChild(doc.createTextNode(span)); if (!spanNo) { // first span in a line, align it to the left if (lineNo && parentX !== null) { attributes.x = parentX; } } else { attributes.dx = 0; // #16 } // add attributes attr(tspan, attributes); // Append it textNode.appendChild(tspan); // first span on subsequent line, add the line height if (!spanNo && lineNo) { // allow getting the right offset height in exporting in IE if (!hasSVG && forExport) { css(tspan, { display: 'block' }); } // Set the line height based on the font size of either // the text element or the tspan element attr( tspan, 'dy', getLineHeight(tspan) ); } /*if (width) { renderer.breakText(wrapper, width); }*/ // Check width and apply soft breaks or ellipsis if (width) { var words = span.replace(/([^\^])-/g, '$1- ').split(' '), // #1273 hasWhiteSpace = spans.length > 1 || lineNo || (words.length > 1 && textStyles.whiteSpace !== 'nowrap'), tooLong, wasTooLong, actualWidth, rest = [], dy = getLineHeight(tspan), softLineNo = 1, rotation = wrapper.rotation, wordStr = span, // for ellipsis cursor = wordStr.length, // binary search cursor bBox; while ((hasWhiteSpace || ellipsis) && (words.length || rest.length)) { wrapper.rotation = 0; // discard rotation when computing box bBox = wrapper.getBBox(true); actualWidth = bBox.width; // Old IE cannot measure the actualWidth for SVG elements (#2314) if (!hasSVG && renderer.forExport) { actualWidth = renderer.measureSpanWidth(tspan.firstChild.data, wrapper.styles); } tooLong = actualWidth > width; // For ellipsis, do a binary search for the correct string length if (wasTooLong === undefined) { wasTooLong = tooLong; // First time } if (ellipsis && wasTooLong) { cursor /= 2; if (wordStr === '' || (!tooLong && cursor < 0.5)) { words = []; // All ok, break out } else { if (tooLong) { wasTooLong = true; } wordStr = span.substring(0, wordStr.length + (tooLong ? -1 : 1) * mathCeil(cursor)); words = [wordStr + (width > 3 ? '\u2026' : '')]; tspan.removeChild(tspan.firstChild); } // Looping down, this is the first word sequence that is not too long, // so we can move on to build the next line. } else if (!tooLong || words.length === 1) { words = rest; rest = []; if (words.length) { softLineNo++; tspan = doc.createElementNS(SVG_NS, 'tspan'); attr(tspan, { dy: dy, x: parentX }); if (spanStyle) { // #390 attr(tspan, 'style', spanStyle); } textNode.appendChild(tspan); } if (actualWidth > width) { // a single word is pressing it out width = actualWidth; } } else { // append to existing line tspan tspan.removeChild(tspan.firstChild); rest.unshift(words.pop()); } if (words.length) { tspan.appendChild(doc.createTextNode(words.join(' ').replace(/- /g, '-'))); } } if (wasTooLong) { wrapper.attr('title', wrapper.textStr); } wrapper.rotation = rotation; } spanNo++; } } }); }); if (tempParent) { tempParent.removeChild(textNode); // attach it to the DOM to read offset width } // Apply the text shadow if (textShadow && wrapper.applyTextShadow) { wrapper.applyTextShadow(textShadow); } } }, /* breakText: function (wrapper, width) { var bBox = wrapper.getBBox(), node = wrapper.element, textLength = node.textContent.length, pos = mathRound(width * textLength / bBox.width), // try this position first, based on average character width increment = 0, finalPos; if (bBox.width > width) { while (finalPos === undefined) { textLength = node.getSubStringLength(0, pos); if (textLength <= width) { if (increment === -1) { finalPos = pos; } else { increment = 1; } } else { if (increment === 1) { finalPos = pos - 1; } else { increment = -1; } } pos += increment; } } console.log(finalPos, node.getSubStringLength(0, finalPos)) }, */ /** * Returns white for dark colors and black for bright colors */ getContrast: function (color) { color = Color(color).rgba; return color[0] + color[1] + color[2] > 384 ? '#000000' : '#FFFFFF'; }, /** * Create a button with preset states * @param {String} text * @param {Number} x * @param {Number} y * @param {Function} callback * @param {Object} normalState * @param {Object} hoverState * @param {Object} pressedState */ button: function (text, x, y, callback, normalState, hoverState, pressedState, disabledState, shape) { var label = this.label(text, x, y, shape, null, null, null, null, 'button'), curState = 0, stateOptions, stateStyle, normalStyle, hoverStyle, pressedStyle, disabledStyle, verticalGradient = { x1: 0, y1: 0, x2: 0, y2: 1 }; // Normal state - prepare the attributes normalState = merge({ 'stroke-width': 1, stroke: '#CCCCCC', fill: { linearGradient: verticalGradient, stops: [ [0, '#FEFEFE'], [1, '#F6F6F6'] ] }, r: 2, padding: 5, style: { color: 'black' } }, normalState); normalStyle = normalState.style; delete normalState.style; // Hover state hoverState = merge(normalState, { stroke: '#68A', fill: { linearGradient: verticalGradient, stops: [ [0, '#FFF'], [1, '#ACF'] ] } }, hoverState); hoverStyle = hoverState.style; delete hoverState.style; // Pressed state pressedState = merge(normalState, { stroke: '#68A', fill: { linearGradient: verticalGradient, stops: [ [0, '#9BD'], [1, '#CDF'] ] } }, pressedState); pressedStyle = pressedState.style; delete pressedState.style; // Disabled state disabledState = merge(normalState, { style: { color: '#CCC' } }, disabledState); disabledStyle = disabledState.style; delete disabledState.style; // Add the events. IE9 and IE10 need mouseover and mouseout to funciton (#667). addEvent(label.element, isMS ? 'mouseover' : 'mouseenter', function () { if (curState !== 3) { label.attr(hoverState) .css(hoverStyle); } }); addEvent(label.element, isMS ? 'mouseout' : 'mouseleave', function () { if (curState !== 3) { stateOptions = [normalState, hoverState, pressedState][curState]; stateStyle = [normalStyle, hoverStyle, pressedStyle][curState]; label.attr(stateOptions) .css(stateStyle); } }); label.setState = function (state) { label.state = curState = state; if (!state) { label.attr(normalState) .css(normalStyle); } else if (state === 2) { label.attr(pressedState) .css(pressedStyle); } else if (state === 3) { label.attr(disabledState) .css(disabledStyle); } }; return label .on('click', function (e) { if (curState !== 3) { callback.call(label, e); } }) .attr(normalState) .css(extend({ cursor: 'default' }, normalStyle)); }, /** * Make a straight line crisper by not spilling out to neighbour pixels * @param {Array} points * @param {Number} width */ crispLine: function (points, width) { // points format: [M, 0, 0, L, 100, 0] // normalize to a crisp line if (points[1] === points[4]) { // Substract due to #1129. Now bottom and left axis gridlines behave the same. points[1] = points[4] = mathRound(points[1]) - (width % 2 / 2); } if (points[2] === points[5]) { points[2] = points[5] = mathRound(points[2]) + (width % 2 / 2); } return points; }, /** * Draw a path * @param {Array} path An SVG path in array form */ path: function (path) { var attr = { fill: NONE }; if (isArray(path)) { attr.d = path; } else if (isObject(path)) { // attributes extend(attr, path); } return this.createElement('path').attr(attr); }, /** * Draw and return an SVG circle * @param {Number} x The x position * @param {Number} y The y position * @param {Number} r The radius */ circle: function (x, y, r) { var attr = isObject(x) ? x : { x: x, y: y, r: r }, wrapper = this.createElement('circle'); // Setting x or y translates to cx and cy wrapper.xSetter = wrapper.ySetter = function (value, key, element) { element.setAttribute('c' + key, value); }; return wrapper.attr(attr); }, /** * Draw and return an arc * @param {Number} x X position * @param {Number} y Y position * @param {Number} r Radius * @param {Number} innerR Inner radius like used in donut charts * @param {Number} start Starting angle * @param {Number} end Ending angle */ arc: function (x, y, r, innerR, start, end) { var arc; if (isObject(x)) { y = x.y; r = x.r; innerR = x.innerR; start = x.start; end = x.end; x = x.x; } // Arcs are defined as symbols for the ability to set // attributes in attr and animate arc = this.symbol('arc', x || 0, y || 0, r || 0, r || 0, { innerR: innerR || 0, start: start || 0, end: end || 0 }); arc.r = r; // #959 return arc; }, /** * Draw and return a rectangle * @param {Number} x Left position * @param {Number} y Top position * @param {Number} width * @param {Number} height * @param {Number} r Border corner radius * @param {Number} strokeWidth A stroke width can be supplied to allow crisp drawing */ rect: function (x, y, width, height, r, strokeWidth) { r = isObject(x) ? x.r : r; var wrapper = this.createElement('rect'), attribs = isObject(x) ? x : x === UNDEFINED ? {} : { x: x, y: y, width: mathMax(width, 0), height: mathMax(height, 0) }; if (strokeWidth !== UNDEFINED) { attribs.strokeWidth = strokeWidth; attribs = wrapper.crisp(attribs); } if (r) { attribs.r = r; } wrapper.rSetter = function (value) { attr(this.element, { rx: value, ry: value }); }; return wrapper.attr(attribs); }, /** * Resize the box and re-align all aligned elements * @param {Object} width * @param {Object} height * @param {Boolean} animate * */ setSize: function (width, height, animate) { var renderer = this, alignedObjects = renderer.alignedObjects, i = alignedObjects.length; renderer.width = width; renderer.height = height; renderer.boxWrapper[pick(animate, true) ? 'animate' : 'attr']({ width: width, height: height }); while (i--) { alignedObjects[i].align(); } }, /** * Create a group * @param {String} name The group will be given a class name of 'highcharts-{name}'. * This can be used for styling and scripting. */ g: function (name) { var elem = this.createElement('g'); return defined(name) ? elem.attr({ 'class': PREFIX + name }) : elem; }, /** * Display an image * @param {String} src * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height */ image: function (src, x, y, width, height) { var attribs = { preserveAspectRatio: NONE }, elemWrapper; // optional properties if (arguments.length > 1) { extend(attribs, { x: x, y: y, width: width, height: height }); } elemWrapper = this.createElement('image').attr(attribs); // set the href in the xlink namespace if (elemWrapper.element.setAttributeNS) { elemWrapper.element.setAttributeNS('http://www.w3.org/1999/xlink', 'href', src); } else { // could be exporting in IE // using href throws "not supported" in ie7 and under, requries regex shim to fix later elemWrapper.element.setAttribute('hc-svg-href', src); } return elemWrapper; }, /** * Draw a symbol out of pre-defined shape paths from the namespace 'symbol' object. * * @param {Object} symbol * @param {Object} x * @param {Object} y * @param {Object} radius * @param {Object} options */ symbol: function (symbol, x, y, width, height, options) { var ren = this, obj, // get the symbol definition function symbolFn = this.symbols[symbol], // check if there's a path defined for this symbol path = symbolFn && symbolFn( mathRound(x), mathRound(y), width, height, options ), imageRegex = /^url\((.*?)\)$/, imageSrc, imageSize, centerImage; if (path) { obj = this.path(path); // expando properties for use in animate and attr extend(obj, { symbolName: symbol, x: x, y: y, width: width, height: height }); if (options) { extend(obj, options); } // image symbols } else if (imageRegex.test(symbol)) { // On image load, set the size and position centerImage = function (img, size) { if (img.element) { // it may be destroyed in the meantime (#1390) img.attr({ width: size[0], height: size[1] }); if (!img.alignByTranslate) { // #185 img.translate( mathRound((width - size[0]) / 2), // #1378 mathRound((height - size[1]) / 2) ); } } }; imageSrc = symbol.match(imageRegex)[1]; imageSize = symbolSizes[imageSrc] || (options && options.width && options.height && [options.width, options.height]); // Ireate the image synchronously, add attribs async obj = this.image(imageSrc) .attr({ x: x, y: y }); obj.isImg = true; if (imageSize) { centerImage(obj, imageSize); } else { // Initialize image to be 0 size so export will still function if there's no cached sizes. obj.attr({ width: 0, height: 0 }); // Create a dummy JavaScript image to get the width and height. Due to a bug in IE < 8, // the created element must be assigned to a variable in order to load (#292). createElement('img', { onload: function () { // Special case for SVGs on IE11, the width is not accessible until the image is // part of the DOM (#2854). if (this.width === 0) { css(this, { position: ABSOLUTE, top: '-999em' }); doc.body.appendChild(this); } // Center the image centerImage(obj, symbolSizes[imageSrc] = [this.width, this.height]); // Clean up after #2854 workaround. if (this.parentNode) { this.parentNode.removeChild(this); } // Fire the load event when all external images are loaded ren.imgCount--; if (!ren.imgCount) { charts[ren.chartIndex].onload(); } }, src: imageSrc }); } this.imgCount++; } return obj; }, /** * An extendable collection of functions for defining symbol paths. */ symbols: { 'circle': function (x, y, w, h) { var cpw = 0.166 * w; return [ M, x + w / 2, y, 'C', x + w + cpw, y, x + w + cpw, y + h, x + w / 2, y + h, 'C', x - cpw, y + h, x - cpw, y, x + w / 2, y, 'Z' ]; }, 'square': function (x, y, w, h) { return [ M, x, y, L, x + w, y, x + w, y + h, x, y + h, 'Z' ]; }, 'triangle': function (x, y, w, h) { return [ M, x + w / 2, y, L, x + w, y + h, x, y + h, 'Z' ]; }, 'triangle-down': function (x, y, w, h) { return [ M, x, y, L, x + w, y, x + w / 2, y + h, 'Z' ]; }, 'diamond': function (x, y, w, h) { return [ M, x + w / 2, y, L, x + w, y + h / 2, x + w / 2, y + h, x, y + h / 2, 'Z' ]; }, 'arc': function (x, y, w, h, options) { var start = options.start, radius = options.r || w || h, end = options.end - 0.001, // to prevent cos and sin of start and end from becoming equal on 360 arcs (related: #1561) innerRadius = options.innerR, open = options.open, cosStart = mathCos(start), sinStart = mathSin(start), cosEnd = mathCos(end), sinEnd = mathSin(end), longArc = options.end - start < mathPI ? 0 : 1; return [ M, x + radius * cosStart, y + radius * sinStart, 'A', // arcTo radius, // x radius radius, // y radius 0, // slanting longArc, // long or short arc 1, // clockwise x + radius * cosEnd, y + radius * sinEnd, open ? M : L, x + innerRadius * cosEnd, y + innerRadius * sinEnd, 'A', // arcTo innerRadius, // x radius innerRadius, // y radius 0, // slanting longArc, // long or short arc 0, // clockwise x + innerRadius * cosStart, y + innerRadius * sinStart, open ? '' : 'Z' // close ]; }, /** * Callout shape used for default tooltips, also used for rounded rectangles in VML */ callout: function (x, y, w, h, options) { var arrowLength = 6, halfDistance = 6, r = mathMin((options && options.r) || 0, w, h), safeDistance = r + halfDistance, anchorX = options && options.anchorX, anchorY = options && options.anchorY, path; path = [ 'M', x + r, y, 'L', x + w - r, y, // top side 'C', x + w, y, x + w, y, x + w, y + r, // top-right corner 'L', x + w, y + h - r, // right side 'C', x + w, y + h, x + w, y + h, x + w - r, y + h, // bottom-right corner 'L', x + r, y + h, // bottom side 'C', x, y + h, x, y + h, x, y + h - r, // bottom-left corner 'L', x, y + r, // left side 'C', x, y, x, y, x + r, y // top-right corner ]; if (anchorX && anchorX > w && anchorY > y + safeDistance && anchorY < y + h - safeDistance) { // replace right side path.splice(13, 3, 'L', x + w, anchorY - halfDistance, x + w + arrowLength, anchorY, x + w, anchorY + halfDistance, x + w, y + h - r ); } else if (anchorX && anchorX < 0 && anchorY > y + safeDistance && anchorY < y + h - safeDistance) { // replace left side path.splice(33, 3, 'L', x, anchorY + halfDistance, x - arrowLength, anchorY, x, anchorY - halfDistance, x, y + r ); } else if (anchorY && anchorY > h && anchorX > x + safeDistance && anchorX < x + w - safeDistance) { // replace bottom path.splice(23, 3, 'L', anchorX + halfDistance, y + h, anchorX, y + h + arrowLength, anchorX - halfDistance, y + h, x + r, y + h ); } else if (anchorY && anchorY < 0 && anchorX > x + safeDistance && anchorX < x + w - safeDistance) { // replace top path.splice(3, 3, 'L', anchorX - halfDistance, y, anchorX, y - arrowLength, anchorX + halfDistance, y, w - r, y ); } return path; } }, /** * Define a clipping rectangle * @param {String} id * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height */ clipRect: function (x, y, width, height) { var wrapper, id = PREFIX + idCounter++, clipPath = this.createElement('clipPath').attr({ id: id }).add(this.defs); wrapper = this.rect(x, y, width, height, 0).add(clipPath); wrapper.id = id; wrapper.clipPath = clipPath; wrapper.count = 0; return wrapper; }, /** * Add text to the SVG object * @param {String} str * @param {Number} x Left position * @param {Number} y Top position * @param {Boolean} useHTML Use HTML to render the text */ text: function (str, x, y, useHTML) { // declare variables var renderer = this, fakeSVG = useCanVG || (!hasSVG && renderer.forExport), wrapper, attr = {}; if (useHTML && (renderer.allowHTML || !renderer.forExport)) { return renderer.html(str, x, y); } attr.x = Math.round(x || 0); // X is always needed for line-wrap logic if (y) { attr.y = Math.round(y); } if (str || str === 0) { attr.text = str; } wrapper = renderer.createElement('text') .attr(attr); // Prevent wrapping from creating false offsetWidths in export in legacy IE (#1079, #1063) if (fakeSVG) { wrapper.css({ position: ABSOLUTE }); } if (!useHTML) { wrapper.xSetter = function (value, key, element) { var tspans = element.getElementsByTagName('tspan'), tspan, parentVal = element.getAttribute(key), i; for (i = 0; i < tspans.length; i++) { tspan = tspans[i]; // If the x values are equal, the tspan represents a linebreak if (tspan.getAttribute(key) === parentVal) { tspan.setAttribute(key, value); } } element.setAttribute(key, value); }; } return wrapper; }, /** * Utility to return the baseline offset and total line height from the font size */ fontMetrics: function (fontSize, elem) { var lineHeight, baseline, style; fontSize = fontSize || this.style.fontSize; if (!fontSize && elem && win.getComputedStyle) { elem = elem.element || elem; // SVGElement style = win.getComputedStyle(elem, ''); fontSize = style && style.fontSize; // #4309, the style doesn't exist inside a hidden iframe in Firefox } fontSize = /px/.test(fontSize) ? pInt(fontSize) : /em/.test(fontSize) ? parseFloat(fontSize) * 12 : 12; // Empirical values found by comparing font size and bounding box height. // Applies to the default font family. http://jsfiddle.net/highcharts/7xvn7/ lineHeight = fontSize < 24 ? fontSize + 3 : mathRound(fontSize * 1.2); baseline = mathRound(lineHeight * 0.8); return { h: lineHeight, b: baseline, f: fontSize }; }, /** * Correct X and Y positioning of a label for rotation (#1764) */ rotCorr: function (baseline, rotation, alterY) { var y = baseline; if (rotation && alterY) { y = mathMax(y * mathCos(rotation * deg2rad), 4); } return { x: (-baseline / 3) * mathSin(rotation * deg2rad), y: y }; }, /** * Add a label, a text item that can hold a colored or gradient background * as well as a border and shadow. * @param {string} str * @param {Number} x * @param {Number} y * @param {String} shape * @param {Number} anchorX In case the shape has a pointer, like a flag, this is the * coordinates it should be pinned to * @param {Number} anchorY * @param {Boolean} baseline Whether to position the label relative to the text baseline, * like renderer.text, or to the upper border of the rectangle. * @param {String} className Class name for the group */ label: function (str, x, y, shape, anchorX, anchorY, useHTML, baseline, className) { var renderer = this, wrapper = renderer.g(className), text = renderer.text('', 0, 0, useHTML) .attr({ zIndex: 1 }), //.add(wrapper), box, bBox, alignFactor = 0, padding = 3, paddingLeft = 0, width, height, wrapperX, wrapperY, crispAdjust = 0, deferredAttr = {}, baselineOffset, needsBox, updateBoxSize, updateTextPadding, boxAttr; /** * This function runs after the label is added to the DOM (when the bounding box is * available), and after the text of the label is updated to detect the new bounding * box and reflect it in the border box. */ updateBoxSize = function () { var boxX, boxY, style = text.element.style; bBox = (width === undefined || height === undefined || wrapper.styles.textAlign) && defined(text.textStr) && text.getBBox(); //#3295 && 3514 box failure when string equals 0 wrapper.width = (width || bBox.width || 0) + 2 * padding + paddingLeft; wrapper.height = (height || bBox.height || 0) + 2 * padding; // update the label-scoped y offset baselineOffset = padding + renderer.fontMetrics(style && style.fontSize, text).b; if (needsBox) { if (!box) { // create the border box if it is not already present boxX = crispAdjust; boxY = (baseline ? -baselineOffset : 0) + crispAdjust; wrapper.box = box = shape ? renderer.symbol(shape, boxX, boxY, wrapper.width, wrapper.height, deferredAttr) : renderer.rect(boxX, boxY, wrapper.width, wrapper.height, 0, deferredAttr[STROKE_WIDTH]); if (!box.isImg) { // #4324, fill "none" causes it to be ignored by mouse events in IE box.attr('fill', NONE); } box.add(wrapper); } // apply the box attributes if (!box.isImg) { // #1630 box.attr(extend({ width: mathRound(wrapper.width), height: mathRound(wrapper.height) }, deferredAttr)); } deferredAttr = null; } }; /** * This function runs after setting text or padding, but only if padding is changed */ updateTextPadding = function () { var styles = wrapper.styles, textAlign = styles && styles.textAlign, x = paddingLeft + padding, y; // determin y based on the baseline y = baseline ? 0 : baselineOffset; // compensate for alignment if (defined(width) && bBox && (textAlign === 'center' || textAlign === 'right')) { x += { center: 0.5, right: 1 }[textAlign] * (width - bBox.width); } // update if anything changed if (x !== text.x || y !== text.y) { text.attr('x', x); if (y !== UNDEFINED) { text.attr('y', y); } } // record current values text.x = x; text.y = y; }; /** * Set a box attribute, or defer it if the box is not yet created * @param {Object} key * @param {Object} value */ boxAttr = function (key, value) { if (box) { box.attr(key, value); } else { deferredAttr[key] = value; } }; /** * After the text element is added, get the desired size of the border box * and add it before the text in the DOM. */ wrapper.onAdd = function () { text.add(wrapper); wrapper.attr({ text: (str || str === 0) ? str : '', // alignment is available now // #3295: 0 not rendered if given as a value x: x, y: y }); if (box && defined(anchorX)) { wrapper.attr({ anchorX: anchorX, anchorY: anchorY }); } }; /* * Add specific attribute setters. */ // only change local variables wrapper.widthSetter = function (value) { width = value; }; wrapper.heightSetter = function (value) { height = value; }; wrapper.paddingSetter = function (value) { if (defined(value) && value !== padding) { padding = wrapper.padding = value; updateTextPadding(); } }; wrapper.paddingLeftSetter = function (value) { if (defined(value) && value !== paddingLeft) { paddingLeft = value; updateTextPadding(); } }; // change local variable and prevent setting attribute on the group wrapper.alignSetter = function (value) { value = { left: 0, center: 0.5, right: 1 }[value]; if (value !== alignFactor) { alignFactor = value; if (bBox) { // Bounding box exists, means we're dynamically changing wrapper.attr({ x: x }); } } }; // apply these to the box and the text alike wrapper.textSetter = function (value) { if (value !== UNDEFINED) { text.textSetter(value); } updateBoxSize(); updateTextPadding(); }; // apply these to the box but not to the text wrapper['stroke-widthSetter'] = function (value, key) { if (value) { needsBox = true; } crispAdjust = value % 2 / 2; boxAttr(key, value); }; wrapper.strokeSetter = wrapper.fillSetter = wrapper.rSetter = function (value, key) { if (key === 'fill' && value) { needsBox = true; } boxAttr(key, value); }; wrapper.anchorXSetter = function (value, key) { anchorX = value; boxAttr(key, mathRound(value) - crispAdjust - wrapperX); }; wrapper.anchorYSetter = function (value, key) { anchorY = value; boxAttr(key, value - wrapperY); }; // rename attributes wrapper.xSetter = function (value) { wrapper.x = value; // for animation getter if (alignFactor) { value -= alignFactor * ((width || bBox.width) + 2 * padding); } wrapperX = mathRound(value); wrapper.attr('translateX', wrapperX); }; wrapper.ySetter = function (value) { wrapperY = wrapper.y = mathRound(value); wrapper.attr('translateY', wrapperY); }; // Redirect certain methods to either the box or the text var baseCss = wrapper.css; return extend(wrapper, { /** * Pick up some properties and apply them to the text instead of the wrapper */ css: function (styles) { if (styles) { var textStyles = {}; styles = merge(styles); // create a copy to avoid altering the original object (#537) each(wrapper.textProps, function (prop) { if (styles[prop] !== UNDEFINED) { textStyles[prop] = styles[prop]; delete styles[prop]; } }); text.css(textStyles); } return baseCss.call(wrapper, styles); }, /** * Return the bounding box of the box, not the group */ getBBox: function () { return { width: bBox.width + 2 * padding, height: bBox.height + 2 * padding, x: bBox.x - padding, y: bBox.y - padding }; }, /** * Apply the shadow to the box */ shadow: function (b) { if (box) { box.shadow(b); } return wrapper; }, /** * Destroy and release memory. */ destroy: function () { // Added by button implementation removeEvent(wrapper.element, 'mouseenter'); removeEvent(wrapper.element, 'mouseleave'); if (text) { text = text.destroy(); } if (box) { box = box.destroy(); } // Call base implementation to destroy the rest SVGElement.prototype.destroy.call(wrapper); // Release local pointers (#1298) wrapper = renderer = updateBoxSize = updateTextPadding = boxAttr = null; } }); } }; // end SVGRenderer // general renderer Renderer = SVGRenderer; // extend SvgElement for useHTML option extend(SVGElement.prototype, { /** * Apply CSS to HTML elements. This is used in text within SVG rendering and * by the VML renderer */ htmlCss: function (styles) { var wrapper = this, element = wrapper.element, textWidth = styles && element.tagName === 'SPAN' && styles.width; if (textWidth) { delete styles.width; wrapper.textWidth = textWidth; wrapper.updateTransform(); } if (styles && styles.textOverflow === 'ellipsis') { styles.whiteSpace = 'nowrap'; styles.overflow = 'hidden'; } wrapper.styles = extend(wrapper.styles, styles); css(wrapper.element, styles); return wrapper; }, /** * VML and useHTML method for calculating the bounding box based on offsets * @param {Boolean} refresh Whether to force a fresh value from the DOM or to * use the cached value * * @return {Object} A hash containing values for x, y, width and height */ htmlGetBBox: function () { var wrapper = this, element = wrapper.element; // faking getBBox in exported SVG in legacy IE // faking getBBox in exported SVG in legacy IE (is this a duplicate of the fix for #1079?) if (element.nodeName === 'text') { element.style.position = ABSOLUTE; } return { x: element.offsetLeft, y: element.offsetTop, width: element.offsetWidth, height: element.offsetHeight }; }, /** * VML override private method to update elements based on internal * properties based on SVG transform */ htmlUpdateTransform: function () { // aligning non added elements is expensive if (!this.added) { this.alignOnAdd = true; return; } var wrapper = this, renderer = wrapper.renderer, elem = wrapper.element, translateX = wrapper.translateX || 0, translateY = wrapper.translateY || 0, x = wrapper.x || 0, y = wrapper.y || 0, align = wrapper.textAlign || 'left', alignCorrection = { left: 0, center: 0.5, right: 1 }[align], shadows = wrapper.shadows, styles = wrapper.styles; // apply translate css(elem, { marginLeft: translateX, marginTop: translateY }); if (shadows) { // used in labels/tooltip each(shadows, function (shadow) { css(shadow, { marginLeft: translateX + 1, marginTop: translateY + 1 }); }); } // apply inversion if (wrapper.inverted) { // wrapper is a group each(elem.childNodes, function (child) { renderer.invertChild(child, elem); }); } if (elem.tagName === 'SPAN') { var rotation = wrapper.rotation, baseline, textWidth = pInt(wrapper.textWidth), whiteSpace = styles && styles.whiteSpace, currentTextTransform = [rotation, align, elem.innerHTML, wrapper.textWidth, wrapper.textAlign].join(','); if (currentTextTransform !== wrapper.cTT) { // do the calculations and DOM access only if properties changed baseline = renderer.fontMetrics(elem.style.fontSize).b; // Renderer specific handling of span rotation if (defined(rotation)) { wrapper.setSpanRotation(rotation, alignCorrection, baseline); } // Update textWidth if (elem.offsetWidth > textWidth && /[ \-]/.test(elem.textContent || elem.innerText)) { // #983, #1254 css(elem, { width: textWidth + PX, display: 'block', whiteSpace: whiteSpace || 'normal' // #3331 }); wrapper.hasTextWidth = true; } else if (wrapper.hasTextWidth) { // #4928 css(elem, { width: '', display: '', whiteSpace: whiteSpace || 'nowrap' }); wrapper.hasTextWidth = false; } wrapper.getSpanCorrection(wrapper.hasTextWidth ? textWidth : elem.offsetWidth, baseline, alignCorrection, rotation, align); } // apply position with correction css(elem, { left: (x + (wrapper.xCorr || 0)) + PX, top: (y + (wrapper.yCorr || 0)) + PX }); // force reflow in webkit to apply the left and top on useHTML element (#1249) if (isWebKit) { baseline = elem.offsetHeight; // assigned to baseline for lint purpose } // record current text transform wrapper.cTT = currentTextTransform; } }, /** * Set the rotation of an individual HTML span */ setSpanRotation: function (rotation, alignCorrection, baseline) { var rotationStyle = {}, cssTransformKey = isMS ? '-ms-transform' : isWebKit ? '-webkit-transform' : isFirefox ? 'MozTransform' : isOpera ? '-o-transform' : ''; rotationStyle[cssTransformKey] = rotationStyle.transform = 'rotate(' + rotation + 'deg)'; rotationStyle[cssTransformKey + (isFirefox ? 'Origin' : '-origin')] = rotationStyle.transformOrigin = (alignCorrection * 100) + '% ' + baseline + 'px'; css(this.element, rotationStyle); }, /** * Get the correction in X and Y positioning as the element is rotated. */ getSpanCorrection: function (width, baseline, alignCorrection) { this.xCorr = -width * alignCorrection; this.yCorr = -baseline; } }); // Extend SvgRenderer for useHTML option. extend(SVGRenderer.prototype, { /** * Create HTML text node. This is used by the VML renderer as well as the SVG * renderer through the useHTML option. * * @param {String} str * @param {Number} x * @param {Number} y */ html: function (str, x, y) { var wrapper = this.createElement('span'), element = wrapper.element, renderer = wrapper.renderer, addSetters = function (element, style) { // These properties are set as attributes on the SVG group, and as // identical CSS properties on the div. (#3542) each(['opacity', 'visibility'], function (prop) { wrap(element, prop + 'Setter', function (proceed, value, key, elem) { proceed.call(this, value, key, elem); style[key] = value; }); }); }; // Text setter wrapper.textSetter = function (value) { if (value !== element.innerHTML) { delete this.bBox; } element.innerHTML = this.textStr = value; wrapper.htmlUpdateTransform(); }; addSetters(wrapper, wrapper.element.style); // Various setters which rely on update transform wrapper.xSetter = wrapper.ySetter = wrapper.alignSetter = wrapper.rotationSetter = function (value, key) { if (key === 'align') { key = 'textAlign'; // Do not overwrite the SVGElement.align method. Same as VML. } wrapper[key] = value; wrapper.htmlUpdateTransform(); }; // Set the default attributes wrapper .attr({ text: str, x: mathRound(x), y: mathRound(y) }) .css({ position: ABSOLUTE, fontFamily: this.style.fontFamily, fontSize: this.style.fontSize }); // Keep the whiteSpace style outside the wrapper.styles collection element.style.whiteSpace = 'nowrap'; // Use the HTML specific .css method wrapper.css = wrapper.htmlCss; // This is specific for HTML within SVG if (renderer.isSVG) { wrapper.add = function (svgGroupWrapper) { var htmlGroup, container = renderer.box.parentNode, parentGroup, parents = []; this.parentGroup = svgGroupWrapper; // Create a mock group to hold the HTML elements if (svgGroupWrapper) { htmlGroup = svgGroupWrapper.div; if (!htmlGroup) { // Read the parent chain into an array and read from top down parentGroup = svgGroupWrapper; while (parentGroup) { parents.push(parentGroup); // Move up to the next parent group parentGroup = parentGroup.parentGroup; } // Ensure dynamically updating position when any parent is translated each(parents.reverse(), function (parentGroup) { var htmlGroupStyle, cls = attr(parentGroup.element, 'class'); if (cls) { cls = { className: cls }; } // else null // Create a HTML div and append it to the parent div to emulate // the SVG group structure htmlGroup = parentGroup.div = parentGroup.div || createElement(DIV, cls, { position: ABSOLUTE, left: (parentGroup.translateX || 0) + PX, top: (parentGroup.translateY || 0) + PX }, htmlGroup || container); // the top group is appended to container // Shortcut htmlGroupStyle = htmlGroup.style; // Set listeners to update the HTML div's position whenever the SVG group // position is changed extend(parentGroup, { translateXSetter: function (value, key) { htmlGroupStyle.left = value + PX; parentGroup[key] = value; parentGroup.doTransform = true; }, translateYSetter: function (value, key) { htmlGroupStyle.top = value + PX; parentGroup[key] = value; parentGroup.doTransform = true; } }); addSetters(parentGroup, htmlGroupStyle); }); } } else { htmlGroup = container; } htmlGroup.appendChild(element); // Shared with VML: wrapper.added = true; if (wrapper.alignOnAdd) { wrapper.htmlUpdateTransform(); } return wrapper; }; } return wrapper; } }); /* **************************************************************************** * * * START OF INTERNET EXPLORER <= 8 SPECIFIC CODE * * * * For applications and websites that don't need IE support, like platform * * targeted mobile apps and web apps, this code can be removed. * * * *****************************************************************************/ /** * @constructor */ var VMLRenderer, VMLElement; if (!hasSVG && !useCanVG) { /** * The VML element wrapper. */ VMLElement = { /** * Initialize a new VML element wrapper. It builds the markup as a string * to minimize DOM traffic. * @param {Object} renderer * @param {Object} nodeName */ init: function (renderer, nodeName) { var wrapper = this, markup = ['<', nodeName, ' filled="f" stroked="f"'], style = ['position: ', ABSOLUTE, ';'], isDiv = nodeName === DIV; // divs and shapes need size if (nodeName === 'shape' || isDiv) { style.push('left:0;top:0;width:1px;height:1px;'); } style.push('visibility: ', isDiv ? HIDDEN : VISIBLE); markup.push(' style="', style.join(''), '"/>'); // create element with default attributes and style if (nodeName) { markup = isDiv || nodeName === 'span' || nodeName === 'img' ? markup.join('') : renderer.prepVML(markup); wrapper.element = createElement(markup); } wrapper.renderer = renderer; }, /** * Add the node to the given parent * @param {Object} parent */ add: function (parent) { var wrapper = this, renderer = wrapper.renderer, element = wrapper.element, box = renderer.box, inverted = parent && parent.inverted, // get the parent node parentNode = parent ? parent.element || parent : box; if (parent) { this.parentGroup = parent; } // if the parent group is inverted, apply inversion on all children if (inverted) { // only on groups renderer.invertChild(element, parentNode); } // append it parentNode.appendChild(element); // align text after adding to be able to read offset wrapper.added = true; if (wrapper.alignOnAdd && !wrapper.deferUpdateTransform) { wrapper.updateTransform(); } // fire an event for internal hooks if (wrapper.onAdd) { wrapper.onAdd(); } return wrapper; }, /** * VML always uses htmlUpdateTransform */ updateTransform: SVGElement.prototype.htmlUpdateTransform, /** * Set the rotation of a span with oldIE's filter */ setSpanRotation: function () { // Adjust for alignment and rotation. Rotation of useHTML content is not yet implemented // but it can probably be implemented for Firefox 3.5+ on user request. FF3.5+ // has support for CSS3 transform. The getBBox method also needs to be updated // to compensate for the rotation, like it currently does for SVG. // Test case: http://jsfiddle.net/highcharts/Ybt44/ var rotation = this.rotation, costheta = mathCos(rotation * deg2rad), sintheta = mathSin(rotation * deg2rad); css(this.element, { filter: rotation ? ['progid:DXImageTransform.Microsoft.Matrix(M11=', costheta, ', M12=', -sintheta, ', M21=', sintheta, ', M22=', costheta, ', sizingMethod=\'auto expand\')'].join('') : NONE }); }, /** * Get the positioning correction for the span after rotating. */ getSpanCorrection: function (width, baseline, alignCorrection, rotation, align) { var costheta = rotation ? mathCos(rotation * deg2rad) : 1, sintheta = rotation ? mathSin(rotation * deg2rad) : 0, height = pick(this.elemHeight, this.element.offsetHeight), quad, nonLeft = align && align !== 'left'; // correct x and y this.xCorr = costheta < 0 && -width; this.yCorr = sintheta < 0 && -height; // correct for baseline and corners spilling out after rotation quad = costheta * sintheta < 0; this.xCorr += sintheta * baseline * (quad ? 1 - alignCorrection : alignCorrection); this.yCorr -= costheta * baseline * (rotation ? (quad ? alignCorrection : 1 - alignCorrection) : 1); // correct for the length/height of the text if (nonLeft) { this.xCorr -= width * alignCorrection * (costheta < 0 ? -1 : 1); if (rotation) { this.yCorr -= height * alignCorrection * (sintheta < 0 ? -1 : 1); } css(this.element, { textAlign: align }); } }, /** * Converts a subset of an SVG path definition to its VML counterpart. Takes an array * as the parameter and returns a string. */ pathToVML: function (value) { // convert paths var i = value.length, path = []; while (i--) { // Multiply by 10 to allow subpixel precision. // Substracting half a pixel seems to make the coordinates // align with SVG, but this hasn't been tested thoroughly if (isNumber(value[i])) { path[i] = mathRound(value[i] * 10) - 5; } else if (value[i] === 'Z') { // close the path path[i] = 'x'; } else { path[i] = value[i]; // When the start X and end X coordinates of an arc are too close, // they are rounded to the same value above. In this case, substract or // add 1 from the end X and Y positions. #186, #760, #1371, #1410. if (value.isArc && (value[i] === 'wa' || value[i] === 'at')) { // Start and end X if (path[i + 5] === path[i + 7]) { path[i + 7] += value[i + 7] > value[i + 5] ? 1 : -1; } // Start and end Y if (path[i + 6] === path[i + 8]) { path[i + 8] += value[i + 8] > value[i + 6] ? 1 : -1; } } } } // Loop up again to handle path shortcuts (#2132) /*while (i++ < path.length) { if (path[i] === 'H') { // horizontal line to path[i] = 'L'; path.splice(i + 2, 0, path[i - 1]); } else if (path[i] === 'V') { // vertical line to path[i] = 'L'; path.splice(i + 1, 0, path[i - 2]); } }*/ return path.join(' ') || 'x'; }, /** * Set the element's clipping to a predefined rectangle * * @param {String} id The id of the clip rectangle */ clip: function (clipRect) { var wrapper = this, clipMembers, cssRet; if (clipRect) { clipMembers = clipRect.members; erase(clipMembers, wrapper); // Ensure unique list of elements (#1258) clipMembers.push(wrapper); wrapper.destroyClip = function () { erase(clipMembers, wrapper); }; cssRet = clipRect.getCSS(wrapper); } else { if (wrapper.destroyClip) { wrapper.destroyClip(); } cssRet = { clip: docMode8 ? 'inherit' : 'rect(auto)' }; // #1214 } return wrapper.css(cssRet); }, /** * Set styles for the element * @param {Object} styles */ css: SVGElement.prototype.htmlCss, /** * Removes a child either by removeChild or move to garbageBin. * Issue 490; in VML removeChild results in Orphaned nodes according to sIEve, discardElement does not. */ safeRemoveChild: function (element) { // discardElement will detach the node from its parent before attaching it // to the garbage bin. Therefore it is important that the node is attached and have parent. if (element.parentNode) { discardElement(element); } }, /** * Extend element.destroy by removing it from the clip members array */ destroy: function () { if (this.destroyClip) { this.destroyClip(); } return SVGElement.prototype.destroy.apply(this); }, /** * Add an event listener. VML override for normalizing event parameters. * @param {String} eventType * @param {Function} handler */ on: function (eventType, handler) { // simplest possible event model for internal use this.element['on' + eventType] = function () { var evt = win.event; evt.target = evt.srcElement; handler(evt); }; return this; }, /** * In stacked columns, cut off the shadows so that they don't overlap */ cutOffPath: function (path, length) { var len; path = path.split(/[ ,]/); len = path.length; if (len === 9 || len === 11) { path[len - 4] = path[len - 2] = pInt(path[len - 2]) - 10 * length; } return path.join(' '); }, /** * Apply a drop shadow by copying elements and giving them different strokes * @param {Boolean|Object} shadowOptions */ shadow: function (shadowOptions, group, cutOff) { var shadows = [], i, element = this.element, renderer = this.renderer, shadow, elemStyle = element.style, markup, path = element.path, strokeWidth, modifiedPath, shadowWidth, shadowElementOpacity; // some times empty paths are not strings if (path && typeof path.value !== 'string') { path = 'x'; } modifiedPath = path; if (shadowOptions) { shadowWidth = pick(shadowOptions.width, 3); shadowElementOpacity = (shadowOptions.opacity || 0.15) / shadowWidth; for (i = 1; i <= 3; i++) { strokeWidth = (shadowWidth * 2) + 1 - (2 * i); // Cut off shadows for stacked column items if (cutOff) { modifiedPath = this.cutOffPath(path.value, strokeWidth + 0.5); } markup = ['<shape isShadow="true" strokeweight="', strokeWidth, '" filled="false" path="', modifiedPath, '" coordsize="10 10" style="', element.style.cssText, '" />']; shadow = createElement(renderer.prepVML(markup), null, { left: pInt(elemStyle.left) + pick(shadowOptions.offsetX, 1), top: pInt(elemStyle.top) + pick(shadowOptions.offsetY, 1) } ); if (cutOff) { shadow.cutOff = strokeWidth + 1; } // apply the opacity markup = ['<stroke color="', shadowOptions.color || 'black', '" opacity="', shadowElementOpacity * i, '"/>']; createElement(renderer.prepVML(markup), null, null, shadow); // insert it if (group) { group.element.appendChild(shadow); } else { element.parentNode.insertBefore(shadow, element); } // record it shadows.push(shadow); } this.shadows = shadows; } return this; }, updateShadows: noop, // Used in SVG only setAttr: function (key, value) { if (docMode8) { // IE8 setAttribute bug this.element[key] = value; } else { this.element.setAttribute(key, value); } }, classSetter: function (value) { // IE8 Standards mode has problems retrieving the className unless set like this this.element.className = value; }, dashstyleSetter: function (value, key, element) { var strokeElem = element.getElementsByTagName('stroke')[0] || createElement(this.renderer.prepVML(['<stroke/>']), null, null, element); strokeElem[key] = value || 'solid'; this[key] = value; /* because changing stroke-width will change the dash length and cause an epileptic effect */ }, dSetter: function (value, key, element) { var i, shadows = this.shadows; value = value || []; this.d = value.join && value.join(' '); // used in getter for animation element.path = value = this.pathToVML(value); // update shadows if (shadows) { i = shadows.length; while (i--) { shadows[i].path = shadows[i].cutOff ? this.cutOffPath(value, shadows[i].cutOff) : value; } } this.setAttr(key, value); }, fillSetter: function (value, key, element) { var nodeName = element.nodeName; if (nodeName === 'SPAN') { // text color element.style.color = value; } else if (nodeName !== 'IMG') { // #1336 element.filled = value !== NONE; this.setAttr('fillcolor', this.renderer.color(value, element, key, this)); } }, 'fill-opacitySetter': function (value, key, element) { createElement( this.renderer.prepVML(['<', key.split('-')[0], ' opacity="', value, '"/>']), null, null, element ); }, opacitySetter: noop, // Don't bother - animation is too slow and filters introduce artifacts rotationSetter: function (value, key, element) { var style = element.style; this[key] = style[key] = value; // style is for #1873 // Correction for the 1x1 size of the shape container. Used in gauge needles. style.left = -mathRound(mathSin(value * deg2rad) + 1) + PX; style.top = mathRound(mathCos(value * deg2rad)) + PX; }, strokeSetter: function (value, key, element) { this.setAttr('strokecolor', this.renderer.color(value, element, key, this)); }, 'stroke-widthSetter': function (value, key, element) { element.stroked = !!value; // VML "stroked" attribute this[key] = value; // used in getter, issue #113 if (isNumber(value)) { value += PX; } this.setAttr('strokeweight', value); }, titleSetter: function (value, key) { this.setAttr(key, value); }, visibilitySetter: function (value, key, element) { // Handle inherited visibility if (value === 'inherit') { value = VISIBLE; } // Let the shadow follow the main element if (this.shadows) { each(this.shadows, function (shadow) { shadow.style[key] = value; }); } // Instead of toggling the visibility CSS property, move the div out of the viewport. // This works around #61 and #586 if (element.nodeName === 'DIV') { value = value === HIDDEN ? '-999em' : 0; // In order to redraw, IE7 needs the div to be visible when tucked away // outside the viewport. So the visibility is actually opposite of // the expected value. This applies to the tooltip only. if (!docMode8) { element.style[key] = value ? VISIBLE : HIDDEN; } key = 'top'; } element.style[key] = value; }, xSetter: function (value, key, element) { this[key] = value; // used in getter if (key === 'x') { key = 'left'; } else if (key === 'y') { key = 'top'; }/* else { value = mathMax(0, value); // don't set width or height below zero (#311) }*/ // clipping rectangle special if (this.updateClipping) { this[key] = value; // the key is now 'left' or 'top' for 'x' and 'y' this.updateClipping(); } else { // normal element.style[key] = value; } }, zIndexSetter: function (value, key, element) { element.style[key] = value; } }; VMLElement['stroke-opacitySetter'] = VMLElement['fill-opacitySetter']; Highcharts.VMLElement = VMLElement = extendClass(SVGElement, VMLElement); // Some shared setters VMLElement.prototype.ySetter = VMLElement.prototype.widthSetter = VMLElement.prototype.heightSetter = VMLElement.prototype.xSetter; /** * The VML renderer */ var VMLRendererExtension = { // inherit SVGRenderer Element: VMLElement, isIE8: userAgent.indexOf('MSIE 8.0') > -1, /** * Initialize the VMLRenderer * @param {Object} container * @param {Number} width * @param {Number} height */ init: function (container, width, height, style) { var renderer = this, boxWrapper, box, css; renderer.alignedObjects = []; boxWrapper = renderer.createElement(DIV) .css(extend(this.getStyle(style), { position: 'relative' })); box = boxWrapper.element; container.appendChild(boxWrapper.element); // generate the containing box renderer.isVML = true; renderer.box = box; renderer.boxWrapper = boxWrapper; renderer.gradients = {}; renderer.cache = {}; // Cache for numerical bounding boxes renderer.cacheKeys = []; renderer.imgCount = 0; renderer.setSize(width, height, false); // The only way to make IE6 and IE7 print is to use a global namespace. However, // with IE8 the only way to make the dynamic shapes visible in screen and print mode // seems to be to add the xmlns attribute and the behaviour style inline. if (!doc.namespaces.hcv) { doc.namespaces.add('hcv', 'urn:schemas-microsoft-com:vml'); // Setup default CSS (#2153, #2368, #2384) css = 'hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke' + '{ behavior:url(#default#VML); display: inline-block; } '; try { doc.createStyleSheet().cssText = css; } catch (e) { doc.styleSheets[0].cssText += css; } } }, /** * Detect whether the renderer is hidden. This happens when one of the parent elements * has display: none */ isHidden: function () { return !this.box.offsetWidth; }, /** * Define a clipping rectangle. In VML it is accomplished by storing the values * for setting the CSS style to all associated members. * * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height */ clipRect: function (x, y, width, height) { // create a dummy element var clipRect = this.createElement(), isObj = isObject(x); // mimic a rectangle with its style object for automatic updating in attr return extend(clipRect, { members: [], count: 0, left: (isObj ? x.x : x) + 1, top: (isObj ? x.y : y) + 1, width: (isObj ? x.width : width) - 1, height: (isObj ? x.height : height) - 1, getCSS: function (wrapper) { var element = wrapper.element, nodeName = element.nodeName, isShape = nodeName === 'shape', inverted = wrapper.inverted, rect = this, top = rect.top - (isShape ? element.offsetTop : 0), left = rect.left, right = left + rect.width, bottom = top + rect.height, ret = { clip: 'rect(' + mathRound(inverted ? left : top) + 'px,' + mathRound(inverted ? bottom : right) + 'px,' + mathRound(inverted ? right : bottom) + 'px,' + mathRound(inverted ? top : left) + 'px)' }; // issue 74 workaround if (!inverted && docMode8 && nodeName === 'DIV') { extend(ret, { width: right + PX, height: bottom + PX }); } return ret; }, // used in attr and animation to update the clipping of all members updateClipping: function () { each(clipRect.members, function (member) { if (member.element) { // Deleted series, like in stock/members/series-remove demo. Should be removed from members, but this will do. member.css(clipRect.getCSS(member)); } }); } }); }, /** * Take a color and return it if it's a string, make it a gradient if it's a * gradient configuration object, and apply opacity. * * @param {Object} color The color or config object */ color: function (color, elem, prop, wrapper) { var renderer = this, colorObject, regexRgba = /^rgba/, markup, fillType, ret = NONE; // Check for linear or radial gradient if (color && color.linearGradient) { fillType = 'gradient'; } else if (color && color.radialGradient) { fillType = 'pattern'; } if (fillType) { var stopColor, stopOpacity, gradient = color.linearGradient || color.radialGradient, x1, y1, x2, y2, opacity1, opacity2, color1, color2, fillAttr = '', stops = color.stops, firstStop, lastStop, colors = [], addFillNode = function () { // Add the fill subnode. When colors attribute is used, the meanings of opacity and o:opacity2 // are reversed. markup = ['<fill colors="' + colors.join(',') + '" opacity="', opacity2, '" o:opacity2="', opacity1, '" type="', fillType, '" ', fillAttr, 'focus="100%" method="any" />']; createElement(renderer.prepVML(markup), null, null, elem); }; // Extend from 0 to 1 firstStop = stops[0]; lastStop = stops[stops.length - 1]; if (firstStop[0] > 0) { stops.unshift([ 0, firstStop[1] ]); } if (lastStop[0] < 1) { stops.push([ 1, lastStop[1] ]); } // Compute the stops each(stops, function (stop, i) { if (regexRgba.test(stop[1])) { colorObject = Color(stop[1]); stopColor = colorObject.get('rgb'); stopOpacity = colorObject.get('a'); } else { stopColor = stop[1]; stopOpacity = 1; } // Build the color attribute colors.push((stop[0] * 100) + '% ' + stopColor); // Only start and end opacities are allowed, so we use the first and the last if (!i) { opacity1 = stopOpacity; color2 = stopColor; } else { opacity2 = stopOpacity; color1 = stopColor; } }); // Apply the gradient to fills only. if (prop === 'fill') { // Handle linear gradient angle if (fillType === 'gradient') { x1 = gradient.x1 || gradient[0] || 0; y1 = gradient.y1 || gradient[1] || 0; x2 = gradient.x2 || gradient[2] || 0; y2 = gradient.y2 || gradient[3] || 0; fillAttr = 'angle="' + (90 - math.atan( (y2 - y1) / // y vector (x2 - x1) // x vector ) * 180 / mathPI) + '"'; addFillNode(); // Radial (circular) gradient } else { var r = gradient.r, sizex = r * 2, sizey = r * 2, cx = gradient.cx, cy = gradient.cy, radialReference = elem.radialReference, bBox, applyRadialGradient = function () { if (radialReference) { bBox = wrapper.getBBox(); cx += (radialReference[0] - bBox.x) / bBox.width - 0.5; cy += (radialReference[1] - bBox.y) / bBox.height - 0.5; sizex *= radialReference[2] / bBox.width; sizey *= radialReference[2] / bBox.height; } fillAttr = 'src="' + defaultOptions.global.VMLRadialGradientURL + '" ' + 'size="' + sizex + ',' + sizey + '" ' + 'origin="0.5,0.5" ' + 'position="' + cx + ',' + cy + '" ' + 'color2="' + color2 + '" '; addFillNode(); }; // Apply radial gradient if (wrapper.added) { applyRadialGradient(); } else { // We need to know the bounding box to get the size and position right wrapper.onAdd = applyRadialGradient; } // The fill element's color attribute is broken in IE8 standards mode, so we // need to set the parent shape's fillcolor attribute instead. ret = color1; } // Gradients are not supported for VML stroke, return the first color. #722. } else { ret = stopColor; } // If the color is an rgba color, split it and add a fill node // to hold the opacity component } else if (regexRgba.test(color) && elem.tagName !== 'IMG') { colorObject = Color(color); wrapper[prop + '-opacitySetter'](colorObject.get('a'), prop, elem); ret = colorObject.get('rgb'); } else { var propNodes = elem.getElementsByTagName(prop); // 'stroke' or 'fill' node if (propNodes.length) { propNodes[0].opacity = 1; propNodes[0].type = 'solid'; } ret = color; } return ret; }, /** * Take a VML string and prepare it for either IE8 or IE6/IE7. * @param {Array} markup A string array of the VML markup to prepare */ prepVML: function (markup) { var vmlStyle = 'display:inline-block;behavior:url(#default#VML);', isIE8 = this.isIE8; markup = markup.join(''); if (isIE8) { // add xmlns and style inline markup = markup.replace('/>', ' xmlns="urn:schemas-microsoft-com:vml" />'); if (markup.indexOf('style="') === -1) { markup = markup.replace('/>', ' style="' + vmlStyle + '" />'); } else { markup = markup.replace('style="', 'style="' + vmlStyle); } } else { // add namespace markup = markup.replace('<', '<hcv:'); } return markup; }, /** * Create rotated and aligned text * @param {String} str * @param {Number} x * @param {Number} y */ text: SVGRenderer.prototype.html, /** * Create and return a path element * @param {Array} path */ path: function (path) { var attr = { // subpixel precision down to 0.1 (width and height = 1px) coordsize: '10 10' }; if (isArray(path)) { attr.d = path; } else if (isObject(path)) { // attributes extend(attr, path); } // create the shape return this.createElement('shape').attr(attr); }, /** * Create and return a circle element. In VML circles are implemented as * shapes, which is faster than v:oval * @param {Number} x * @param {Number} y * @param {Number} r */ circle: function (x, y, r) { var circle = this.symbol('circle'); if (isObject(x)) { r = x.r; y = x.y; x = x.x; } circle.isCircle = true; // Causes x and y to mean center (#1682) circle.r = r; return circle.attr({ x: x, y: y }); }, /** * Create a group using an outer div and an inner v:group to allow rotating * and flipping. A simple v:group would have problems with positioning * child HTML elements and CSS clip. * * @param {String} name The name of the group */ g: function (name) { var wrapper, attribs; // set the class name if (name) { attribs = { 'className': PREFIX + name, 'class': PREFIX + name }; } // the div to hold HTML and clipping wrapper = this.createElement(DIV).attr(attribs); return wrapper; }, /** * VML override to create a regular HTML image * @param {String} src * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height */ image: function (src, x, y, width, height) { var obj = this.createElement('img') .attr({ src: src }); if (arguments.length > 1) { obj.attr({ x: x, y: y, width: width, height: height }); } return obj; }, /** * For rectangles, VML uses a shape for rect to overcome bugs and rotation problems */ createElement: function (nodeName) { return nodeName === 'rect' ? this.symbol(nodeName) : SVGRenderer.prototype.createElement.call(this, nodeName); }, /** * In the VML renderer, each child of an inverted div (group) is inverted * @param {Object} element * @param {Object} parentNode */ invertChild: function (element, parentNode) { var ren = this, parentStyle = parentNode.style, imgStyle = element.tagName === 'IMG' && element.style; // #1111 css(element, { flip: 'x', left: pInt(parentStyle.width) - (imgStyle ? pInt(imgStyle.top) : 1), top: pInt(parentStyle.height) - (imgStyle ? pInt(imgStyle.left) : 1), rotation: -90 }); // Recursively invert child elements, needed for nested composite shapes like box plots and error bars. #1680, #1806. each(element.childNodes, function (child) { ren.invertChild(child, element); }); }, /** * Symbol definitions that override the parent SVG renderer's symbols * */ symbols: { // VML specific arc function arc: function (x, y, w, h, options) { var start = options.start, end = options.end, radius = options.r || w || h, innerRadius = options.innerR, cosStart = mathCos(start), sinStart = mathSin(start), cosEnd = mathCos(end), sinEnd = mathSin(end), ret; if (end - start === 0) { // no angle, don't show it. return ['x']; } ret = [ 'wa', // clockwise arc to x - radius, // left y - radius, // top x + radius, // right y + radius, // bottom x + radius * cosStart, // start x y + radius * sinStart, // start y x + radius * cosEnd, // end x y + radius * sinEnd // end y ]; if (options.open && !innerRadius) { ret.push( 'e', M, x, // - innerRadius, y// - innerRadius ); } ret.push( 'at', // anti clockwise arc to x - innerRadius, // left y - innerRadius, // top x + innerRadius, // right y + innerRadius, // bottom x + innerRadius * cosEnd, // start x y + innerRadius * sinEnd, // start y x + innerRadius * cosStart, // end x y + innerRadius * sinStart, // end y 'x', // finish path 'e' // close ); ret.isArc = true; return ret; }, // Add circle symbol path. This performs significantly faster than v:oval. circle: function (x, y, w, h, wrapper) { if (wrapper) { w = h = 2 * wrapper.r; } // Center correction, #1682 if (wrapper && wrapper.isCircle) { x -= w / 2; y -= h / 2; } // Return the path return [ 'wa', // clockwisearcto x, // left y, // top x + w, // right y + h, // bottom x + w, // start x y + h / 2, // start y x + w, // end x y + h / 2, // end y //'x', // finish path 'e' // close ]; }, /** * Add rectangle symbol path which eases rotation and omits arcsize problems * compared to the built-in VML roundrect shape. When borders are not rounded, * use the simpler square path, else use the callout path without the arrow. */ rect: function (x, y, w, h, options) { return SVGRenderer.prototype.symbols[ !defined(options) || !options.r ? 'square' : 'callout' ].call(0, x, y, w, h, options); } } }; Highcharts.VMLRenderer = VMLRenderer = function () { this.init.apply(this, arguments); }; VMLRenderer.prototype = merge(SVGRenderer.prototype, VMLRendererExtension); // general renderer Renderer = VMLRenderer; } // This method is used with exporting in old IE, when emulating SVG (see #2314) SVGRenderer.prototype.measureSpanWidth = function (text, styles) { var measuringSpan = doc.createElement('span'), offsetWidth, textNode = doc.createTextNode(text); measuringSpan.appendChild(textNode); css(measuringSpan, styles); this.box.appendChild(measuringSpan); offsetWidth = measuringSpan.offsetWidth; discardElement(measuringSpan); // #2463 return offsetWidth; }; /* **************************************************************************** * * * END OF INTERNET EXPLORER <= 8 SPECIFIC CODE * * * *****************************************************************************/ /* **************************************************************************** * * * START OF ANDROID < 3 SPECIFIC CODE. THIS CAN BE REMOVED IF YOU'RE NOT * * TARGETING THAT SYSTEM. * * * *****************************************************************************/ var CanVGRenderer, CanVGController; /** * Downloads a script and executes a callback when done. * @param {String} scriptLocation * @param {Function} callback */ function getScript(scriptLocation, callback) { var head = doc.getElementsByTagName('head')[0], script = doc.createElement('script'); script.type = 'text/javascript'; script.src = scriptLocation; script.onload = callback; head.appendChild(script); } if (useCanVG) { /** * The CanVGRenderer is empty from start to keep the source footprint small. * When requested, the CanVGController downloads the rest of the source packaged * together with the canvg library. */ Highcharts.CanVGRenderer = CanVGRenderer = function () { // Override the global SVG namespace to fake SVG/HTML that accepts CSS SVG_NS = 'http://www.w3.org/1999/xhtml'; }; /** * Start with an empty symbols object. This is needed when exporting is used (exporting.src.js will add a few symbols), but * the implementation from SvgRenderer will not be merged in until first render. */ CanVGRenderer.prototype.symbols = {}; /** * Handles on demand download of canvg rendering support. */ CanVGController = (function () { // List of renderering calls var deferredRenderCalls = []; /** * When downloaded, we are ready to draw deferred charts. */ function drawDeferred() { var callLength = deferredRenderCalls.length, callIndex; // Draw all pending render calls for (callIndex = 0; callIndex < callLength; callIndex++) { deferredRenderCalls[callIndex](); } // Clear the list deferredRenderCalls = []; } return { push: function (func, scriptLocation) { // Only get the script once if (deferredRenderCalls.length === 0) { getScript(scriptLocation, drawDeferred); } // Register render call deferredRenderCalls.push(func); } }; }()); Renderer = CanVGRenderer; } // end CanVGRenderer /* **************************************************************************** * * * END OF ANDROID < 3 SPECIFIC CODE * * * *****************************************************************************/ /** * The Tick class */ function Tick(axis, pos, type, noLabel) { this.axis = axis; this.pos = pos; this.type = type || ''; this.isNew = true; if (!type && !noLabel) { this.addLabel(); } } Tick.prototype = { /** * Write the tick label */ addLabel: function () { var tick = this, axis = tick.axis, options = axis.options, chart = axis.chart, categories = axis.categories, names = axis.names, pos = tick.pos, labelOptions = options.labels, str, tickPositions = axis.tickPositions, isFirst = pos === tickPositions[0], isLast = pos === tickPositions[tickPositions.length - 1], value = categories ? pick(categories[pos], names[pos], pos) : pos, label = tick.label, tickPositionInfo = tickPositions.info, dateTimeLabelFormat; // Set the datetime label format. If a higher rank is set for this position, use that. If not, // use the general format. if (axis.isDatetimeAxis && tickPositionInfo) { dateTimeLabelFormat = options.dateTimeLabelFormats[tickPositionInfo.higherRanks[pos] || tickPositionInfo.unitName]; } // set properties for access in render method tick.isFirst = isFirst; tick.isLast = isLast; // get the string str = axis.labelFormatter.call({ axis: axis, chart: chart, isFirst: isFirst, isLast: isLast, dateTimeLabelFormat: dateTimeLabelFormat, value: axis.isLog ? correctFloat(lin2log(value)) : value }); // prepare CSS //css = width && { width: mathMax(1, mathRound(width - 2 * (labelOptions.padding || 10))) + PX }; // first call if (!defined(label)) { tick.label = label = defined(str) && labelOptions.enabled ? chart.renderer.text( str, 0, 0, labelOptions.useHTML ) //.attr(attr) // without position absolute, IE export sometimes is wrong .css(merge(labelOptions.style)) .add(axis.labelGroup) : null; tick.labelLength = label && label.getBBox().width; // Un-rotated length tick.rotation = 0; // Base value to detect change for new calls to getBBox // update } else if (label) { label.attr({ text: str }); } }, /** * Get the offset height or width of the label */ getLabelSize: function () { return this.label ? this.label.getBBox()[this.axis.horiz ? 'height' : 'width'] : 0; }, /** * Handle the label overflow by adjusting the labels to the left and right edge, or * hide them if they collide into the neighbour label. */ handleOverflow: function (xy) { var axis = this.axis, pxPos = xy.x, chartWidth = axis.chart.chartWidth, spacing = axis.chart.spacing, leftBound = pick(axis.labelLeft, mathMin(axis.pos, spacing[3])), rightBound = pick(axis.labelRight, mathMax(axis.pos + axis.len, chartWidth - spacing[1])), label = this.label, rotation = this.rotation, factor = { left: 0, center: 0.5, right: 1 }[axis.labelAlign], labelWidth = label.getBBox().width, slotWidth = axis.slotWidth, xCorrection = factor, goRight = 1, leftPos, rightPos, textWidth, css = {}; // Check if the label overshoots the chart spacing box. If it does, move it. // If it now overshoots the slotWidth, add ellipsis. if (!rotation) { leftPos = pxPos - factor * labelWidth; rightPos = pxPos + (1 - factor) * labelWidth; if (leftPos < leftBound) { slotWidth = xy.x + slotWidth * (1 - factor) - leftBound; } else if (rightPos > rightBound) { slotWidth = rightBound - xy.x + slotWidth * factor; goRight = -1; } slotWidth = mathMin(axis.slotWidth, slotWidth); // #4177 if (slotWidth < axis.slotWidth && axis.labelAlign === 'center') { xy.x += goRight * (axis.slotWidth - slotWidth - xCorrection * (axis.slotWidth - mathMin(labelWidth, slotWidth))); } // If the label width exceeds the available space, set a text width to be // picked up below. Also, if a width has been set before, we need to set a new // one because the reported labelWidth will be limited by the box (#3938). if (labelWidth > slotWidth || (axis.autoRotation && label.styles.width)) { textWidth = slotWidth; } // Add ellipsis to prevent rotated labels to be clipped against the edge of the chart } else if (rotation < 0 && pxPos - factor * labelWidth < leftBound) { textWidth = mathRound(pxPos / mathCos(rotation * deg2rad) - leftBound); } else if (rotation > 0 && pxPos + factor * labelWidth > rightBound) { textWidth = mathRound((chartWidth - pxPos) / mathCos(rotation * deg2rad)); } if (textWidth) { css.width = textWidth; if (!axis.options.labels.style.textOverflow) { css.textOverflow = 'ellipsis'; } label.css(css); } }, /** * Get the x and y position for ticks and labels */ getPosition: function (horiz, pos, tickmarkOffset, old) { var axis = this.axis, chart = axis.chart, cHeight = (old && chart.oldChartHeight) || chart.chartHeight; return { x: horiz ? axis.translate(pos + tickmarkOffset, null, null, old) + axis.transB : axis.left + axis.offset + (axis.opposite ? ((old && chart.oldChartWidth) || chart.chartWidth) - axis.right - axis.left : 0), y: horiz ? cHeight - axis.bottom + axis.offset - (axis.opposite ? axis.height : 0) : cHeight - axis.translate(pos + tickmarkOffset, null, null, old) - axis.transB }; }, /** * Get the x, y position of the tick label */ getLabelPosition: function (x, y, label, horiz, labelOptions, tickmarkOffset, index, step) { var axis = this.axis, transA = axis.transA, reversed = axis.reversed, staggerLines = axis.staggerLines, rotCorr = axis.tickRotCorr || { x: 0, y: 0 }, yOffset = labelOptions.y, line; if (!defined(yOffset)) { yOffset = axis.side === 2 ? rotCorr.y + 8 : // #3140, #3140 yOffset = mathCos(label.rotation * deg2rad) * (rotCorr.y - label.getBBox(false, 0).height / 2); } x = x + labelOptions.x + rotCorr.x - (tickmarkOffset && horiz ? tickmarkOffset * transA * (reversed ? -1 : 1) : 0); y = y + yOffset - (tickmarkOffset && !horiz ? tickmarkOffset * transA * (reversed ? 1 : -1) : 0); // Correct for staggered labels if (staggerLines) { line = (index / (step || 1) % staggerLines); if (axis.opposite) { line = staggerLines - line - 1; } y += line * (axis.labelOffset / staggerLines); } return { x: x, y: mathRound(y) }; }, /** * Extendible method to return the path of the marker */ getMarkPath: function (x, y, tickLength, tickWidth, horiz, renderer) { return renderer.crispLine([ M, x, y, L, x + (horiz ? 0 : -tickLength), y + (horiz ? tickLength : 0) ], tickWidth); }, /** * Put everything in place * * @param index {Number} * @param old {Boolean} Use old coordinates to prepare an animation into new position */ render: function (index, old, opacity) { var tick = this, axis = tick.axis, options = axis.options, chart = axis.chart, renderer = chart.renderer, horiz = axis.horiz, type = tick.type, label = tick.label, pos = tick.pos, labelOptions = options.labels, gridLine = tick.gridLine, gridPrefix = type ? type + 'Grid' : 'grid', tickPrefix = type ? type + 'Tick' : 'tick', gridLineWidth = options[gridPrefix + 'LineWidth'], gridLineColor = options[gridPrefix + 'LineColor'], dashStyle = options[gridPrefix + 'LineDashStyle'], tickLength = options[tickPrefix + 'Length'], tickWidth = pick(options[tickPrefix + 'Width'], !type && axis.isXAxis ? 1 : 0), // X axis defaults to 1 tickColor = options[tickPrefix + 'Color'], tickPosition = options[tickPrefix + 'Position'], gridLinePath, mark = tick.mark, markPath, step = /*axis.labelStep || */labelOptions.step, attribs, show = true, tickmarkOffset = axis.tickmarkOffset, xy = tick.getPosition(horiz, pos, tickmarkOffset, old), x = xy.x, y = xy.y, reverseCrisp = ((horiz && x === axis.pos + axis.len) || (!horiz && y === axis.pos)) ? -1 : 1; // #1480, #1687 opacity = pick(opacity, 1); this.isActive = true; // create the grid line if (gridLineWidth) { gridLinePath = axis.getPlotLinePath(pos + tickmarkOffset, gridLineWidth * reverseCrisp, old, true); if (gridLine === UNDEFINED) { attribs = { stroke: gridLineColor, 'stroke-width': gridLineWidth }; if (dashStyle) { attribs.dashstyle = dashStyle; } if (!type) { attribs.zIndex = 1; } if (old) { attribs.opacity = 0; } tick.gridLine = gridLine = gridLineWidth ? renderer.path(gridLinePath) .attr(attribs).add(axis.gridGroup) : null; } // If the parameter 'old' is set, the current call will be followed // by another call, therefore do not do any animations this time if (!old && gridLine && gridLinePath) { gridLine[tick.isNew ? 'attr' : 'animate']({ d: gridLinePath, opacity: opacity }); } } // create the tick mark if (tickWidth && tickLength) { // negate the length if (tickPosition === 'inside') { tickLength = -tickLength; } if (axis.opposite) { tickLength = -tickLength; } markPath = tick.getMarkPath(x, y, tickLength, tickWidth * reverseCrisp, horiz, renderer); if (mark) { // updating mark.animate({ d: markPath, opacity: opacity }); } else { // first time tick.mark = renderer.path( markPath ).attr({ stroke: tickColor, 'stroke-width': tickWidth, opacity: opacity }).add(axis.axisGroup); } } // the label is created on init - now move it into place if (label && !isNaN(x)) { label.xy = xy = tick.getLabelPosition(x, y, label, horiz, labelOptions, tickmarkOffset, index, step); // Apply show first and show last. If the tick is both first and last, it is // a single centered tick, in which case we show the label anyway (#2100). if ((tick.isFirst && !tick.isLast && !pick(options.showFirstLabel, 1)) || (tick.isLast && !tick.isFirst && !pick(options.showLastLabel, 1))) { show = false; // Handle label overflow and show or hide accordingly } else if (horiz && !axis.isRadial && !labelOptions.step && !labelOptions.rotation && !old && opacity !== 0) { tick.handleOverflow(xy); } // apply step if (step && index % step) { // show those indices dividable by step show = false; } // Set the new position, and show or hide if (show && !isNaN(xy.y)) { xy.opacity = opacity; label[tick.isNew ? 'attr' : 'animate'](xy); tick.isNew = false; } else { label.attr('y', -9999); // #1338 } } }, /** * Destructor for the tick prototype */ destroy: function () { destroyObjectProperties(this, this.axis); } }; /** * The object wrapper for plot lines and plot bands * @param {Object} options */ Highcharts.PlotLineOrBand = function (axis, options) { this.axis = axis; if (options) { this.options = options; this.id = options.id; } }; Highcharts.PlotLineOrBand.prototype = { /** * Render the plot line or plot band. If it is already existing, * move it. */ render: function () { var plotLine = this, axis = plotLine.axis, horiz = axis.horiz, options = plotLine.options, optionsLabel = options.label, label = plotLine.label, width = options.width, to = options.to, from = options.from, isBand = defined(from) && defined(to), value = options.value, dashStyle = options.dashStyle, svgElem = plotLine.svgElem, path = [], addEvent, eventType, color = options.color, zIndex = pick(options.zIndex, 0), events = options.events, attribs = {}, renderer = axis.chart.renderer; // logarithmic conversion if (axis.isLog) { from = log2lin(from); to = log2lin(to); value = log2lin(value); } // plot line if (width) { path = axis.getPlotLinePath(value, width); attribs = { stroke: color, 'stroke-width': width }; if (dashStyle) { attribs.dashstyle = dashStyle; } } else if (isBand) { // plot band path = axis.getPlotBandPath(from, to, options); if (color) { attribs.fill = color; } if (options.borderWidth) { attribs.stroke = options.borderColor; attribs['stroke-width'] = options.borderWidth; } } else { return; } // zIndex attribs.zIndex = zIndex; // common for lines and bands if (svgElem) { if (path) { svgElem.show(); svgElem.animate({ d: path }); } else { svgElem.hide(); if (label) { plotLine.label = label = label.destroy(); } } } else if (path && path.length) { plotLine.svgElem = svgElem = renderer.path(path) .attr(attribs).add(); // events if (events) { addEvent = function (eventType) { svgElem.on(eventType, function (e) { events[eventType].apply(plotLine, [e]); }); }; for (eventType in events) { addEvent(eventType); } } } // the plot band/line label if (optionsLabel && defined(optionsLabel.text) && path && path.length && axis.width > 0 && axis.height > 0 && !path.flat) { // apply defaults optionsLabel = merge({ align: horiz && isBand && 'center', x: horiz ? !isBand && 4 : 10, verticalAlign: !horiz && isBand && 'middle', y: horiz ? isBand ? 16 : 10 : isBand ? 6 : -4, rotation: horiz && !isBand && 90 }, optionsLabel); this.renderLabel(optionsLabel, path, isBand, zIndex); } else if (label) { // move out of sight label.hide(); } // chainable return plotLine; }, /** * Render and align label for plot line or band. */ renderLabel: function (optionsLabel, path, isBand, zIndex) { var plotLine = this, label = plotLine.label, renderer = plotLine.axis.chart.renderer, attribs, xs, ys, x, y; // add the SVG element if (!label) { attribs = { align: optionsLabel.textAlign || optionsLabel.align, rotation: optionsLabel.rotation }; attribs.zIndex = zIndex; plotLine.label = label = renderer.text( optionsLabel.text, 0, 0, optionsLabel.useHTML ) .attr(attribs) .css(optionsLabel.style) .add(); } // get the bounding box and align the label // #3000 changed to better handle choice between plotband or plotline xs = [path[1], path[4], (isBand ? path[6] : path[1])]; ys = [path[2], path[5], (isBand ? path[7] : path[2])]; x = arrayMin(xs); y = arrayMin(ys); label.align(optionsLabel, false, { x: x, y: y, width: arrayMax(xs) - x, height: arrayMax(ys) - y }); label.show(); }, /** * Remove the plot line or band */ destroy: function () { // remove it from the lookup erase(this.axis.plotLinesAndBands, this); delete this.axis; destroyObjectProperties(this); } }; /** * Object with members for extending the Axis prototype */ AxisPlotLineOrBandExtension = { /** * Create the path for a plot band */ getPlotBandPath: function (from, to) { var toPath = this.getPlotLinePath(to, null, null, true), path = this.getPlotLinePath(from, null, null, true); if (path && toPath) { // Flat paths don't need labels (#3836) path.flat = path.toString() === toPath.toString(); path.push( toPath[4], toPath[5], toPath[1], toPath[2] ); } else { // outside the axis area path = null; } return path; }, addPlotBand: function (options) { return this.addPlotBandOrLine(options, 'plotBands'); }, addPlotLine: function (options) { return this.addPlotBandOrLine(options, 'plotLines'); }, /** * Add a plot band or plot line after render time * * @param options {Object} The plotBand or plotLine configuration object */ addPlotBandOrLine: function (options, coll) { var obj = new Highcharts.PlotLineOrBand(this, options).render(), userOptions = this.userOptions; if (obj) { // #2189 // Add it to the user options for exporting and Axis.update if (coll) { userOptions[coll] = userOptions[coll] || []; userOptions[coll].push(options); } this.plotLinesAndBands.push(obj); } return obj; }, /** * Remove a plot band or plot line from the chart by id * @param {Object} id */ removePlotBandOrLine: function (id) { var plotLinesAndBands = this.plotLinesAndBands, options = this.options, userOptions = this.userOptions, i = plotLinesAndBands.length; while (i--) { if (plotLinesAndBands[i].id === id) { plotLinesAndBands[i].destroy(); } } each([options.plotLines || [], userOptions.plotLines || [], options.plotBands || [], userOptions.plotBands || []], function (arr) { i = arr.length; while (i--) { if (arr[i].id === id) { erase(arr, arr[i]); } } }); } }; /** * Create a new axis object * @param {Object} chart * @param {Object} options */ var Axis = Highcharts.Axis = function () { this.init.apply(this, arguments); }; Axis.prototype = { /** * Default options for the X axis - the Y axis has extended defaults */ defaultOptions: { // allowDecimals: null, // alternateGridColor: null, // categories: [], dateTimeLabelFormats: { millisecond: '%H:%M:%S.%L', second: '%H:%M:%S', minute: '%H:%M', hour: '%H:%M', day: '%e. %b', week: '%e. %b', month: '%b \'%y', year: '%Y' }, endOnTick: false, gridLineColor: '#D8D8D8', // gridLineDashStyle: 'solid', // gridLineWidth: 0, // reversed: false, labels: { enabled: true, // rotation: 0, // align: 'center', // step: null, style: { color: '#606060', cursor: 'default', fontSize: '11px' }, x: 0, y: 15 /*formatter: function () { return this.value; },*/ }, lineColor: '#C0D0E0', lineWidth: 1, //linkedTo: null, //max: undefined, //min: undefined, minPadding: 0.01, maxPadding: 0.01, //minRange: null, minorGridLineColor: '#E0E0E0', // minorGridLineDashStyle: null, minorGridLineWidth: 1, minorTickColor: '#A0A0A0', //minorTickInterval: null, minorTickLength: 2, minorTickPosition: 'outside', // inside or outside //minorTickWidth: 0, //opposite: false, //offset: 0, //plotBands: [{ // events: {}, // zIndex: 1, // labels: { align, x, verticalAlign, y, style, rotation, textAlign } //}], //plotLines: [{ // events: {} // dashStyle: {} // zIndex: // labels: { align, x, verticalAlign, y, style, rotation, textAlign } //}], //reversed: false, // showFirstLabel: true, // showLastLabel: true, startOfWeek: 1, startOnTick: false, tickColor: '#C0D0E0', //tickInterval: null, tickLength: 10, tickmarkPlacement: 'between', // on or between tickPixelInterval: 100, tickPosition: 'outside', //tickWidth: 1, title: { //text: null, align: 'middle', // low, middle or high //margin: 0 for horizontal, 10 for vertical axes, //rotation: 0, //side: 'outside', style: { color: '#707070' } //x: 0, //y: 0 }, type: 'linear' // linear, logarithmic or datetime //visible: true }, /** * This options set extends the defaultOptions for Y axes */ defaultYAxisOptions: { endOnTick: true, gridLineWidth: 1, tickPixelInterval: 72, showLastLabel: true, labels: { x: -8, y: 3 }, lineWidth: 0, maxPadding: 0.05, minPadding: 0.05, startOnTick: true, //tickWidth: 0, title: { rotation: 270, text: 'Values' }, stackLabels: { enabled: false, //align: dynamic, //y: dynamic, //x: dynamic, //verticalAlign: dynamic, //textAlign: dynamic, //rotation: 0, formatter: function () { return Highcharts.numberFormat(this.total, -1); }, style: merge(defaultPlotOptions.line.dataLabels.style, { color: '#000000' }) } }, /** * These options extend the defaultOptions for left axes */ defaultLeftAxisOptions: { labels: { x: -15, y: null }, title: { rotation: 270 } }, /** * These options extend the defaultOptions for right axes */ defaultRightAxisOptions: { labels: { x: 15, y: null }, title: { rotation: 90 } }, /** * These options extend the defaultOptions for bottom axes */ defaultBottomAxisOptions: { labels: { autoRotation: [-45], x: 0, y: null // based on font size // overflow: undefined, // staggerLines: null }, title: { rotation: 0 } }, /** * These options extend the defaultOptions for top axes */ defaultTopAxisOptions: { labels: { autoRotation: [-45], x: 0, y: -15 // overflow: undefined // staggerLines: null }, title: { rotation: 0 } }, /** * Initialize the axis */ init: function (chart, userOptions) { var isXAxis = userOptions.isX, axis = this; axis.chart = chart; // Flag, is the axis horizontal axis.horiz = chart.inverted ? !isXAxis : isXAxis; // Flag, isXAxis axis.isXAxis = isXAxis; axis.coll = isXAxis ? 'xAxis' : 'yAxis'; axis.opposite = userOptions.opposite; // needed in setOptions axis.side = userOptions.side || (axis.horiz ? (axis.opposite ? 0 : 2) : // top : bottom (axis.opposite ? 1 : 3)); // right : left axis.setOptions(userOptions); var options = this.options, type = options.type, isDatetimeAxis = type === 'datetime'; axis.labelFormatter = options.labels.formatter || axis.defaultLabelFormatter; // can be overwritten by dynamic format // Flag, stagger lines or not axis.userOptions = userOptions; //axis.axisTitleMargin = UNDEFINED,// = options.title.margin, axis.minPixelPadding = 0; axis.reversed = options.reversed; axis.visible = options.visible !== false; axis.zoomEnabled = options.zoomEnabled !== false; // Initial categories axis.categories = options.categories || type === 'category'; axis.names = axis.names || []; // Preserve on update (#3830) // Elements //axis.axisGroup = UNDEFINED; //axis.gridGroup = UNDEFINED; //axis.axisTitle = UNDEFINED; //axis.axisLine = UNDEFINED; // Shorthand types axis.isLog = type === 'logarithmic'; axis.isDatetimeAxis = isDatetimeAxis; // Flag, if axis is linked to another axis axis.isLinked = defined(options.linkedTo); // Linked axis. //axis.linkedParent = UNDEFINED; // Tick positions //axis.tickPositions = UNDEFINED; // array containing predefined positions // Tick intervals //axis.tickInterval = UNDEFINED; //axis.minorTickInterval = UNDEFINED; // Major ticks axis.ticks = {}; axis.labelEdge = []; // Minor ticks axis.minorTicks = {}; // List of plotLines/Bands axis.plotLinesAndBands = []; // Alternate bands axis.alternateBands = {}; // Axis metrics //axis.left = UNDEFINED; //axis.top = UNDEFINED; //axis.width = UNDEFINED; //axis.height = UNDEFINED; //axis.bottom = UNDEFINED; //axis.right = UNDEFINED; //axis.transA = UNDEFINED; //axis.transB = UNDEFINED; //axis.oldTransA = UNDEFINED; axis.len = 0; //axis.oldMin = UNDEFINED; //axis.oldMax = UNDEFINED; //axis.oldUserMin = UNDEFINED; //axis.oldUserMax = UNDEFINED; //axis.oldAxisLength = UNDEFINED; axis.minRange = axis.userMinRange = options.minRange || options.maxZoom; axis.range = options.range; axis.offset = options.offset || 0; // Dictionary for stacks axis.stacks = {}; axis.oldStacks = {}; axis.stacksTouched = 0; // Min and max in the data //axis.dataMin = UNDEFINED, //axis.dataMax = UNDEFINED, // The axis range axis.max = null; axis.min = null; // User set min and max //axis.userMin = UNDEFINED, //axis.userMax = UNDEFINED, // Crosshair options axis.crosshair = pick(options.crosshair, splat(chart.options.tooltip.crosshairs)[isXAxis ? 0 : 1], false); // Run Axis var eventType, events = axis.options.events; // Register if (inArray(axis, chart.axes) === -1) { // don't add it again on Axis.update() if (isXAxis && !this.isColorAxis) { // #2713 chart.axes.splice(chart.xAxis.length, 0, axis); } else { chart.axes.push(axis); } chart[axis.coll].push(axis); } axis.series = axis.series || []; // populated by Series // inverted charts have reversed xAxes as default if (chart.inverted && isXAxis && axis.reversed === UNDEFINED) { axis.reversed = true; } axis.removePlotBand = axis.removePlotBandOrLine; axis.removePlotLine = axis.removePlotBandOrLine; // register event listeners for (eventType in events) { addEvent(axis, eventType, events[eventType]); } // extend logarithmic axis if (axis.isLog) { axis.val2lin = log2lin; axis.lin2val = lin2log; } }, /** * Merge and set options */ setOptions: function (userOptions) { this.options = merge( this.defaultOptions, this.isXAxis ? {} : this.defaultYAxisOptions, [this.defaultTopAxisOptions, this.defaultRightAxisOptions, this.defaultBottomAxisOptions, this.defaultLeftAxisOptions][this.side], merge( defaultOptions[this.coll], // if set in setOptions (#1053) userOptions ) ); }, /** * The default label formatter. The context is a special config object for the label. */ defaultLabelFormatter: function () { var axis = this.axis, value = this.value, categories = axis.categories, dateTimeLabelFormat = this.dateTimeLabelFormat, numericSymbols = defaultOptions.lang.numericSymbols, i = numericSymbols && numericSymbols.length, multi, ret, formatOption = axis.options.labels.format, // make sure the same symbol is added for all labels on a linear axis numericSymbolDetector = axis.isLog ? value : axis.tickInterval; if (formatOption) { ret = format(formatOption, this); } else if (categories) { ret = value; } else if (dateTimeLabelFormat) { // datetime axis ret = dateFormat(dateTimeLabelFormat, value); } else if (i && numericSymbolDetector >= 1000) { // Decide whether we should add a numeric symbol like k (thousands) or M (millions). // If we are to enable this in tooltip or other places as well, we can move this // logic to the numberFormatter and enable it by a parameter. while (i-- && ret === UNDEFINED) { multi = Math.pow(1000, i + 1); if (numericSymbolDetector >= multi && (value * 10) % multi === 0 && numericSymbols[i] !== null) { ret = Highcharts.numberFormat(value / multi, -1) + numericSymbols[i]; } } } if (ret === UNDEFINED) { if (mathAbs(value) >= 10000) { // add thousands separators ret = Highcharts.numberFormat(value, -1); } else { // small numbers ret = Highcharts.numberFormat(value, -1, UNDEFINED, ''); // #2466 } } return ret; }, /** * Get the minimum and maximum for the series of each axis */ getSeriesExtremes: function () { var axis = this, chart = axis.chart; axis.hasVisibleSeries = false; // Reset properties in case we're redrawing (#3353) axis.dataMin = axis.dataMax = axis.threshold = null; axis.softThreshold = !axis.isXAxis; if (axis.buildStacks) { axis.buildStacks(); } // loop through this axis' series each(axis.series, function (series) { if (series.visible || !chart.options.chart.ignoreHiddenSeries) { var seriesOptions = series.options, xData, threshold = seriesOptions.threshold, seriesDataMin, seriesDataMax; axis.hasVisibleSeries = true; // Validate threshold in logarithmic axes if (axis.isLog && threshold <= 0) { threshold = null; } // Get dataMin and dataMax for X axes if (axis.isXAxis) { xData = series.xData; if (xData.length) { axis.dataMin = mathMin(pick(axis.dataMin, xData[0]), arrayMin(xData)); axis.dataMax = mathMax(pick(axis.dataMax, xData[0]), arrayMax(xData)); } // Get dataMin and dataMax for Y axes, as well as handle stacking and processed data } else { // Get this particular series extremes series.getExtremes(); seriesDataMax = series.dataMax; seriesDataMin = series.dataMin; // Get the dataMin and dataMax so far. If percentage is used, the min and max are // always 0 and 100. If seriesDataMin and seriesDataMax is null, then series // doesn't have active y data, we continue with nulls if (defined(seriesDataMin) && defined(seriesDataMax)) { axis.dataMin = mathMin(pick(axis.dataMin, seriesDataMin), seriesDataMin); axis.dataMax = mathMax(pick(axis.dataMax, seriesDataMax), seriesDataMax); } // Adjust to threshold if (defined(threshold)) { axis.threshold = threshold; } // If any series has a hard threshold, it takes precedence if (!seriesOptions.softThreshold || axis.isLog) { axis.softThreshold = false; } } } }); }, /** * Translate from axis value to pixel position on the chart, or back * */ translate: function (val, backwards, cvsCoord, old, handleLog, pointPlacement) { var axis = this.linkedParent || this, // #1417 sign = 1, cvsOffset = 0, localA = old ? axis.oldTransA : axis.transA, localMin = old ? axis.oldMin : axis.min, returnValue, minPixelPadding = axis.minPixelPadding, doPostTranslate = (axis.isOrdinal || axis.isBroken || (axis.isLog && handleLog)) && axis.lin2val; if (!localA) { localA = axis.transA; } // In vertical axes, the canvas coordinates start from 0 at the top like in // SVG. if (cvsCoord) { sign *= -1; // canvas coordinates inverts the value cvsOffset = axis.len; } // Handle reversed axis if (axis.reversed) { sign *= -1; cvsOffset -= sign * (axis.sector || axis.len); } // From pixels to value if (backwards) { // reverse translation val = val * sign + cvsOffset; val -= minPixelPadding; returnValue = val / localA + localMin; // from chart pixel to value if (doPostTranslate) { // log and ordinal axes returnValue = axis.lin2val(returnValue); } // From value to pixels } else { if (doPostTranslate) { // log and ordinal axes val = axis.val2lin(val); } if (pointPlacement === 'between') { pointPlacement = 0.5; } returnValue = sign * (val - localMin) * localA + cvsOffset + (sign * minPixelPadding) + (isNumber(pointPlacement) ? localA * pointPlacement * axis.pointRange : 0); } return returnValue; }, /** * Utility method to translate an axis value to pixel position. * @param {Number} value A value in terms of axis units * @param {Boolean} paneCoordinates Whether to return the pixel coordinate relative to the chart * or just the axis/pane itself. */ toPixels: function (value, paneCoordinates) { return this.translate(value, false, !this.horiz, null, true) + (paneCoordinates ? 0 : this.pos); }, /* * Utility method to translate a pixel position in to an axis value * @param {Number} pixel The pixel value coordinate * @param {Boolean} paneCoordiantes Whether the input pixel is relative to the chart or just the * axis/pane itself. */ toValue: function (pixel, paneCoordinates) { return this.translate(pixel - (paneCoordinates ? 0 : this.pos), true, !this.horiz, null, true); }, /** * Create the path for a plot line that goes from the given value on * this axis, across the plot to the opposite side * @param {Number} value * @param {Number} lineWidth Used for calculation crisp line * @param {Number] old Use old coordinates (for resizing and rescaling) */ getPlotLinePath: function (value, lineWidth, old, force, translatedValue) { var axis = this, chart = axis.chart, axisLeft = axis.left, axisTop = axis.top, x1, y1, x2, y2, cHeight = (old && chart.oldChartHeight) || chart.chartHeight, cWidth = (old && chart.oldChartWidth) || chart.chartWidth, skip, transB = axis.transB, /** * Check if x is between a and b. If not, either move to a/b or skip, * depending on the force parameter. */ between = function (x, a, b) { if (x < a || x > b) { if (force) { x = mathMin(mathMax(a, x), b); } else { skip = true; } } return x; }; translatedValue = pick(translatedValue, axis.translate(value, null, null, old)); x1 = x2 = mathRound(translatedValue + transB); y1 = y2 = mathRound(cHeight - translatedValue - transB); if (isNaN(translatedValue)) { // no min or max skip = true; } else if (axis.horiz) { y1 = axisTop; y2 = cHeight - axis.bottom; x1 = x2 = between(x1, axisLeft, axisLeft + axis.width); } else { x1 = axisLeft; x2 = cWidth - axis.right; y1 = y2 = between(y1, axisTop, axisTop + axis.height); } return skip && !force ? null : chart.renderer.crispLine([M, x1, y1, L, x2, y2], lineWidth || 1); }, /** * Set the tick positions of a linear axis to round values like whole tens or every five. */ getLinearTickPositions: function (tickInterval, min, max) { var pos, lastPos, roundedMin = correctFloat(mathFloor(min / tickInterval) * tickInterval), roundedMax = correctFloat(mathCeil(max / tickInterval) * tickInterval), tickPositions = []; // For single points, add a tick regardless of the relative position (#2662) if (min === max && isNumber(min)) { return [min]; } // Populate the intermediate values pos = roundedMin; while (pos <= roundedMax) { // Place the tick on the rounded value tickPositions.push(pos); // Always add the raw tickInterval, not the corrected one. pos = correctFloat(pos + tickInterval); // If the interval is not big enough in the current min - max range to actually increase // the loop variable, we need to break out to prevent endless loop. Issue #619 if (pos === lastPos) { break; } // Record the last value lastPos = pos; } return tickPositions; }, /** * Return the minor tick positions. For logarithmic axes, reuse the same logic * as for major ticks. */ getMinorTickPositions: function () { var axis = this, options = axis.options, tickPositions = axis.tickPositions, minorTickInterval = axis.minorTickInterval, minorTickPositions = [], pos, i, pointRangePadding = axis.pointRangePadding || 0, min = axis.min - pointRangePadding, // #1498 max = axis.max + pointRangePadding, // #1498 range = max - min, len; // If minor ticks get too dense, they are hard to read, and may cause long running script. So we don't draw them. if (range && range / minorTickInterval < axis.len / 3) { // #3875 if (axis.isLog) { len = tickPositions.length; for (i = 1; i < len; i++) { minorTickPositions = minorTickPositions.concat( axis.getLogTickPositions(minorTickInterval, tickPositions[i - 1], tickPositions[i], true) ); } } else if (axis.isDatetimeAxis && options.minorTickInterval === 'auto') { // #1314 minorTickPositions = minorTickPositions.concat( axis.getTimeTicks( axis.normalizeTimeTickInterval(minorTickInterval), min, max, options.startOfWeek ) ); } else { for (pos = min + (tickPositions[0] - min) % minorTickInterval; pos <= max; pos += minorTickInterval) { minorTickPositions.push(pos); } } } if (minorTickPositions.length !== 0) { // don't change the extremes, when there is no minor ticks axis.trimTicks(minorTickPositions, options.startOnTick, options.endOnTick); // #3652 #3743 #1498 } return minorTickPositions; }, /** * Adjust the min and max for the minimum range. Keep in mind that the series data is * not yet processed, so we don't have information on data cropping and grouping, or * updated axis.pointRange or series.pointRange. The data can't be processed until * we have finally established min and max. */ adjustForMinRange: function () { var axis = this, options = axis.options, min = axis.min, max = axis.max, zoomOffset, spaceAvailable = axis.dataMax - axis.dataMin >= axis.minRange, closestDataRange, i, distance, xData, loopLength, minArgs, maxArgs, minRange; // Set the automatic minimum range based on the closest point distance if (axis.isXAxis && axis.minRange === UNDEFINED && !axis.isLog) { if (defined(options.min) || defined(options.max)) { axis.minRange = null; // don't do this again } else { // Find the closest distance between raw data points, as opposed to // closestPointRange that applies to processed points (cropped and grouped) each(axis.series, function (series) { xData = series.xData; loopLength = series.xIncrement ? 1 : xData.length - 1; for (i = loopLength; i > 0; i--) { distance = xData[i] - xData[i - 1]; if (closestDataRange === UNDEFINED || distance < closestDataRange) { closestDataRange = distance; } } }); axis.minRange = mathMin(closestDataRange * 5, axis.dataMax - axis.dataMin); } } // if minRange is exceeded, adjust if (max - min < axis.minRange) { minRange = axis.minRange; zoomOffset = (minRange - max + min) / 2; // if min and max options have been set, don't go beyond it minArgs = [min - zoomOffset, pick(options.min, min - zoomOffset)]; if (spaceAvailable) { // if space is available, stay within the data range minArgs[2] = axis.dataMin; } min = arrayMax(minArgs); maxArgs = [min + minRange, pick(options.max, min + minRange)]; if (spaceAvailable) { // if space is availabe, stay within the data range maxArgs[2] = axis.dataMax; } max = arrayMin(maxArgs); // now if the max is adjusted, adjust the min back if (max - min < minRange) { minArgs[0] = max - minRange; minArgs[1] = pick(options.min, max - minRange); min = arrayMax(minArgs); } } // Record modified extremes axis.min = min; axis.max = max; }, /** * Update translation information */ setAxisTranslation: function (saveOld) { var axis = this, range = axis.max - axis.min, pointRange = axis.axisPointRange || 0, closestPointRange, minPointOffset = 0, pointRangePadding = 0, linkedParent = axis.linkedParent, ordinalCorrection, hasCategories = !!axis.categories, transA = axis.transA, isXAxis = axis.isXAxis; // Adjust translation for padding. Y axis with categories need to go through the same (#1784). if (isXAxis || hasCategories || pointRange) { if (linkedParent) { minPointOffset = linkedParent.minPointOffset; pointRangePadding = linkedParent.pointRangePadding; } else { // Find the closestPointRange across all series each(axis.series, function (series) { var seriesClosest = series.closestPointRange; if (!series.noSharedTooltip && defined(seriesClosest)) { closestPointRange = defined(closestPointRange) ? mathMin(closestPointRange, seriesClosest) : seriesClosest; } }); each(axis.series, function (series) { var seriesPointRange = hasCategories ? 1 : (isXAxis ? pick(series.options.pointRange, closestPointRange, 0) : (axis.axisPointRange || 0)), // #2806 pointPlacement = series.options.pointPlacement; pointRange = mathMax(pointRange, seriesPointRange); if (!axis.single) { // minPointOffset is the value padding to the left of the axis in order to make // room for points with a pointRange, typically columns. When the pointPlacement option // is 'between' or 'on', this padding does not apply. minPointOffset = mathMax( minPointOffset, isString(pointPlacement) ? 0 : seriesPointRange / 2 ); // Determine the total padding needed to the length of the axis to make room for the // pointRange. If the series' pointPlacement is 'on', no padding is added. pointRangePadding = mathMax( pointRangePadding, pointPlacement === 'on' ? 0 : seriesPointRange ); } }); } // Record minPointOffset and pointRangePadding ordinalCorrection = axis.ordinalSlope && closestPointRange ? axis.ordinalSlope / closestPointRange : 1; // #988, #1853 axis.minPointOffset = minPointOffset = minPointOffset * ordinalCorrection; axis.pointRangePadding = pointRangePadding = pointRangePadding * ordinalCorrection; // pointRange means the width reserved for each point, like in a column chart axis.pointRange = mathMin(pointRange, range); // closestPointRange means the closest distance between points. In columns // it is mostly equal to pointRange, but in lines pointRange is 0 while closestPointRange // is some other value if (isXAxis) { axis.closestPointRange = closestPointRange; } } // Secondary values if (saveOld) { axis.oldTransA = transA; } axis.translationSlope = axis.transA = transA = axis.len / ((range + pointRangePadding) || 1); axis.transB = axis.horiz ? axis.left : axis.bottom; // translation addend axis.minPixelPadding = transA * minPointOffset; }, minFromRange: function () { return this.max - this.range; }, /** * Set the tick positions to round values and optionally extend the extremes * to the nearest tick */ setTickInterval: function (secondPass) { var axis = this, chart = axis.chart, options = axis.options, isLog = axis.isLog, isDatetimeAxis = axis.isDatetimeAxis, isXAxis = axis.isXAxis, isLinked = axis.isLinked, maxPadding = options.maxPadding, minPadding = options.minPadding, length, linkedParentExtremes, tickIntervalOption = options.tickInterval, minTickInterval, tickPixelIntervalOption = options.tickPixelInterval, categories = axis.categories, threshold = axis.threshold, softThreshold = axis.softThreshold, thresholdMin, thresholdMax, hardMin, hardMax; if (!isDatetimeAxis && !categories && !isLinked) { this.getTickAmount(); } // Min or max set either by zooming/setExtremes or initial options hardMin = pick(axis.userMin, options.min); hardMax = pick(axis.userMax, options.max); // Linked axis gets the extremes from the parent axis if (isLinked) { axis.linkedParent = chart[axis.coll][options.linkedTo]; linkedParentExtremes = axis.linkedParent.getExtremes(); axis.min = pick(linkedParentExtremes.min, linkedParentExtremes.dataMin); axis.max = pick(linkedParentExtremes.max, linkedParentExtremes.dataMax); if (options.type !== axis.linkedParent.options.type) { error(11, 1); // Can't link axes of different type } // Initial min and max from the extreme data values } else { // Adjust to hard threshold if (!softThreshold && defined(threshold)) { if (axis.dataMin >= threshold) { thresholdMin = threshold; minPadding = 0; } else if (axis.dataMax <= threshold) { thresholdMax = threshold; maxPadding = 0; } } axis.min = pick(hardMin, thresholdMin, axis.dataMin); axis.max = pick(hardMax, thresholdMax, axis.dataMax); } if (isLog) { if (!secondPass && mathMin(axis.min, pick(axis.dataMin, axis.min)) <= 0) { // #978 error(10, 1); // Can't plot negative values on log axis } // The correctFloat cures #934, float errors on full tens. But it // was too aggressive for #4360 because of conversion back to lin, // therefore use precision 15. axis.min = correctFloat(log2lin(axis.min), 15); axis.max = correctFloat(log2lin(axis.max), 15); } // handle zoomed range if (axis.range && defined(axis.max)) { axis.userMin = axis.min = hardMin = mathMax(axis.min, axis.minFromRange()); // #618 axis.userMax = hardMax = axis.max; axis.range = null; // don't use it when running setExtremes } // Hook for adjusting this.min and this.max. Used by bubble series. if (axis.beforePadding) { axis.beforePadding(); } // adjust min and max for the minimum range axis.adjustForMinRange(); // Pad the values to get clear of the chart's edges. To avoid tickInterval taking the padding // into account, we do this after computing tick interval (#1337). if (!categories && !axis.axisPointRange && !axis.usePercentage && !isLinked && defined(axis.min) && defined(axis.max)) { length = axis.max - axis.min; if (length) { if (!defined(hardMin) && minPadding) { axis.min -= length * minPadding; } if (!defined(hardMax) && maxPadding) { axis.max += length * maxPadding; } } } // Stay within floor and ceiling if (isNumber(options.floor)) { axis.min = mathMax(axis.min, options.floor); } if (isNumber(options.ceiling)) { axis.max = mathMin(axis.max, options.ceiling); } // When the threshold is soft, adjust the extreme value only if // the data extreme and the padded extreme land on either side of the threshold. For example, // a series of [0, 1, 2, 3] would make the yAxis add a tick for -1 because of the // default minPadding and startOnTick options. This is prevented by the softThreshold // option. if (softThreshold && defined(axis.dataMin)) { threshold = threshold || 0; if (!defined(hardMin) && axis.min < threshold && axis.dataMin >= threshold) { axis.min = threshold; } else if (!defined(hardMax) && axis.max > threshold && axis.dataMax <= threshold) { axis.max = threshold; } } // get tickInterval if (axis.min === axis.max || axis.min === undefined || axis.max === undefined) { axis.tickInterval = 1; } else if (isLinked && !tickIntervalOption && tickPixelIntervalOption === axis.linkedParent.options.tickPixelInterval) { axis.tickInterval = tickIntervalOption = axis.linkedParent.tickInterval; } else { axis.tickInterval = pick( tickIntervalOption, this.tickAmount ? ((axis.max - axis.min) / mathMax(this.tickAmount - 1, 1)) : undefined, categories ? // for categoried axis, 1 is default, for linear axis use tickPix 1 : // don't let it be more than the data range (axis.max - axis.min) * tickPixelIntervalOption / mathMax(axis.len, tickPixelIntervalOption) ); } // Now we're finished detecting min and max, crop and group series data. This // is in turn needed in order to find tick positions in ordinal axes. if (isXAxis && !secondPass) { each(axis.series, function (series) { series.processData(axis.min !== axis.oldMin || axis.max !== axis.oldMax); }); } // set the translation factor used in translate function axis.setAxisTranslation(true); // hook for ordinal axes and radial axes if (axis.beforeSetTickPositions) { axis.beforeSetTickPositions(); } // hook for extensions, used in Highstock ordinal axes if (axis.postProcessTickInterval) { axis.tickInterval = axis.postProcessTickInterval(axis.tickInterval); } // In column-like charts, don't cramp in more ticks than there are points (#1943, #4184) if (axis.pointRange && !tickIntervalOption) { axis.tickInterval = mathMax(axis.pointRange, axis.tickInterval); } // Before normalizing the tick interval, handle minimum tick interval. This applies only if tickInterval is not defined. minTickInterval = pick(options.minTickInterval, axis.isDatetimeAxis && axis.closestPointRange); if (!tickIntervalOption && axis.tickInterval < minTickInterval) { axis.tickInterval = minTickInterval; } // for linear axes, get magnitude and normalize the interval if (!isDatetimeAxis && !isLog && !tickIntervalOption) { axis.tickInterval = normalizeTickInterval( axis.tickInterval, null, getMagnitude(axis.tickInterval), // If the tick interval is between 0.5 and 5 and the axis max is in the order of // thousands, chances are we are dealing with years. Don't allow decimals. #3363. pick(options.allowDecimals, !(axis.tickInterval > 0.5 && axis.tickInterval < 5 && axis.max > 1000 && axis.max < 9999)), !!this.tickAmount ); } // Prevent ticks from getting so close that we can't draw the labels if (!this.tickAmount && this.len) { // Color axis with disabled legend has no length axis.tickInterval = axis.unsquish(); } this.setTickPositions(); }, /** * Now we have computed the normalized tickInterval, get the tick positions */ setTickPositions: function () { var options = this.options, tickPositions, tickPositionsOption = options.tickPositions, tickPositioner = options.tickPositioner, startOnTick = options.startOnTick, endOnTick = options.endOnTick, single; // Set the tickmarkOffset this.tickmarkOffset = (this.categories && options.tickmarkPlacement === 'between' && this.tickInterval === 1) ? 0.5 : 0; // #3202 // get minorTickInterval this.minorTickInterval = options.minorTickInterval === 'auto' && this.tickInterval ? this.tickInterval / 5 : options.minorTickInterval; // Find the tick positions this.tickPositions = tickPositions = tickPositionsOption && tickPositionsOption.slice(); // Work on a copy (#1565) if (!tickPositions) { if (this.isDatetimeAxis) { tickPositions = this.getTimeTicks( this.normalizeTimeTickInterval(this.tickInterval, options.units), this.min, this.max, options.startOfWeek, this.ordinalPositions, this.closestPointRange, true ); } else if (this.isLog) { tickPositions = this.getLogTickPositions(this.tickInterval, this.min, this.max); } else { tickPositions = this.getLinearTickPositions(this.tickInterval, this.min, this.max); } // Too dense ticks, keep only the first and last (#4477) if (tickPositions.length > this.len) { tickPositions = [tickPositions[0], tickPositions.pop()]; } this.tickPositions = tickPositions; // Run the tick positioner callback, that allows modifying auto tick positions. if (tickPositioner) { tickPositioner = tickPositioner.apply(this, [this.min, this.max]); if (tickPositioner) { this.tickPositions = tickPositions = tickPositioner; } } } if (!this.isLinked) { // reset min/max or remove extremes based on start/end on tick this.trimTicks(tickPositions, startOnTick, endOnTick); // When there is only one point, or all points have the same value on this axis, then min // and max are equal and tickPositions.length is 0 or 1. In this case, add some padding // in order to center the point, but leave it with one tick. #1337. if (this.min === this.max && defined(this.min) && !this.tickAmount) { // Substract half a unit (#2619, #2846, #2515, #3390) single = true; this.min -= 0.5; this.max += 0.5; } this.single = single; if (!tickPositionsOption && !tickPositioner) { this.adjustTickAmount(); } } }, /** * Handle startOnTick and endOnTick by either adapting to padding min/max or rounded min/max */ trimTicks: function (tickPositions, startOnTick, endOnTick) { var roundedMin = tickPositions[0], roundedMax = tickPositions[tickPositions.length - 1], minPointOffset = this.minPointOffset || 0; if (startOnTick) { this.min = roundedMin; } else { while (this.min - minPointOffset > tickPositions[0]) { tickPositions.shift(); } } if (endOnTick) { this.max = roundedMax; } else { while (this.max + minPointOffset < tickPositions[tickPositions.length - 1]) { tickPositions.pop(); } } // If no tick are left, set one tick in the middle (#3195) if (tickPositions.length === 0 && defined(roundedMin)) { tickPositions.push((roundedMax + roundedMin) / 2); } }, /** * Check if there are multiple axes in the same pane * @returns {Boolean} There are other axes */ alignToOthers: function () { var others = {}, // Whether there is another axis to pair with this one hasOther, options = this.options; if (this.chart.options.chart.alignTicks !== false && options.alignTicks !== false) { each(this.chart[this.coll], function (axis) { var otherOptions = axis.options, horiz = axis.horiz, key = [ horiz ? otherOptions.left : otherOptions.top, otherOptions.width, otherOptions.height, otherOptions.pane ].join(','); if (axis.series.length) { // #4442 if (others[key]) { hasOther = true; // #4201 } else { others[key] = 1; } } }); } return hasOther; }, /** * Set the max ticks of either the x and y axis collection */ getTickAmount: function () { var options = this.options, tickAmount = options.tickAmount, tickPixelInterval = options.tickPixelInterval; if (!defined(options.tickInterval) && this.len < tickPixelInterval && !this.isRadial && !this.isLog && options.startOnTick && options.endOnTick) { tickAmount = 2; } if (!tickAmount && this.alignToOthers()) { // Add 1 because 4 tick intervals require 5 ticks (including first and last) tickAmount = mathCeil(this.len / tickPixelInterval) + 1; } // For tick amounts of 2 and 3, compute five ticks and remove the intermediate ones. This // prevents the axis from adding ticks that are too far away from the data extremes. if (tickAmount < 4) { this.finalTickAmt = tickAmount; tickAmount = 5; } this.tickAmount = tickAmount; }, /** * When using multiple axes, adjust the number of ticks to match the highest * number of ticks in that group */ adjustTickAmount: function () { var tickInterval = this.tickInterval, tickPositions = this.tickPositions, tickAmount = this.tickAmount, finalTickAmt = this.finalTickAmt, currentTickAmount = tickPositions && tickPositions.length, i, len; if (currentTickAmount < tickAmount) { while (tickPositions.length < tickAmount) { tickPositions.push(correctFloat( tickPositions[tickPositions.length - 1] + tickInterval )); } this.transA *= (currentTickAmount - 1) / (tickAmount - 1); this.max = tickPositions[tickPositions.length - 1]; // We have too many ticks, run second pass to try to reduce ticks } else if (currentTickAmount > tickAmount) { this.tickInterval *= 2; this.setTickPositions(); } // The finalTickAmt property is set in getTickAmount if (defined(finalTickAmt)) { i = len = tickPositions.length; while (i--) { if ( (finalTickAmt === 3 && i % 2 === 1) || // Remove every other tick (finalTickAmt <= 2 && i > 0 && i < len - 1) // Remove all but first and last ) { tickPositions.splice(i, 1); } } this.finalTickAmt = UNDEFINED; } }, /** * Set the scale based on data min and max, user set min and max or options * */ setScale: function () { var axis = this, isDirtyData, isDirtyAxisLength; axis.oldMin = axis.min; axis.oldMax = axis.max; axis.oldAxisLength = axis.len; // set the new axisLength axis.setAxisSize(); //axisLength = horiz ? axisWidth : axisHeight; isDirtyAxisLength = axis.len !== axis.oldAxisLength; // is there new data? each(axis.series, function (series) { if (series.isDirtyData || series.isDirty || series.xAxis.isDirty) { // when x axis is dirty, we need new data extremes for y as well isDirtyData = true; } }); // do we really need to go through all this? if (isDirtyAxisLength || isDirtyData || axis.isLinked || axis.forceRedraw || axis.userMin !== axis.oldUserMin || axis.userMax !== axis.oldUserMax || axis.alignToOthers()) { if (axis.resetStacks) { axis.resetStacks(); } axis.forceRedraw = false; // get data extremes if needed axis.getSeriesExtremes(); // get fixed positions based on tickInterval axis.setTickInterval(); // record old values to decide whether a rescale is necessary later on (#540) axis.oldUserMin = axis.userMin; axis.oldUserMax = axis.userMax; // Mark as dirty if it is not already set to dirty and extremes have changed. #595. if (!axis.isDirty) { axis.isDirty = isDirtyAxisLength || axis.min !== axis.oldMin || axis.max !== axis.oldMax; } } else if (axis.cleanStacks) { axis.cleanStacks(); } }, /** * Set the extremes and optionally redraw * @param {Number} newMin * @param {Number} newMax * @param {Boolean} redraw * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration * @param {Object} eventArguments * */ setExtremes: function (newMin, newMax, redraw, animation, eventArguments) { var axis = this, chart = axis.chart; redraw = pick(redraw, true); // defaults to true each(axis.series, function (serie) { delete serie.kdTree; }); // Extend the arguments with min and max eventArguments = extend(eventArguments, { min: newMin, max: newMax }); // Fire the event fireEvent(axis, 'setExtremes', eventArguments, function () { // the default event handler axis.userMin = newMin; axis.userMax = newMax; axis.eventArgs = eventArguments; if (redraw) { chart.redraw(animation); } }); }, /** * Overridable method for zooming chart. Pulled out in a separate method to allow overriding * in stock charts. */ zoom: function (newMin, newMax) { var dataMin = this.dataMin, dataMax = this.dataMax, options = this.options, min = mathMin(dataMin, pick(options.min, dataMin)), max = mathMax(dataMax, pick(options.max, dataMax)); // Prevent pinch zooming out of range. Check for defined is for #1946. #1734. if (!this.allowZoomOutside) { if (defined(dataMin) && newMin <= min) { newMin = min; } if (defined(dataMax) && newMax >= max) { newMax = max; } } // In full view, displaying the reset zoom button is not required this.displayBtn = newMin !== UNDEFINED || newMax !== UNDEFINED; // Do it this.setExtremes( newMin, newMax, false, UNDEFINED, { trigger: 'zoom' } ); return true; }, /** * Update the axis metrics */ setAxisSize: function () { var chart = this.chart, options = this.options, offsetLeft = options.offsetLeft || 0, offsetRight = options.offsetRight || 0, horiz = this.horiz, width = pick(options.width, chart.plotWidth - offsetLeft + offsetRight), height = pick(options.height, chart.plotHeight), top = pick(options.top, chart.plotTop), left = pick(options.left, chart.plotLeft + offsetLeft), percentRegex = /%$/; // Check for percentage based input values. Rounding fixes problems with // column overflow and plot line filtering (#4898, #4899) if (percentRegex.test(height)) { height = Math.round(parseFloat(height) / 100 * chart.plotHeight); } if (percentRegex.test(top)) { top = Math.round(parseFloat(top) / 100 * chart.plotHeight + chart.plotTop); } // Expose basic values to use in Series object and navigator this.left = left; this.top = top; this.width = width; this.height = height; this.bottom = chart.chartHeight - height - top; this.right = chart.chartWidth - width - left; // Direction agnostic properties this.len = mathMax(horiz ? width : height, 0); // mathMax fixes #905 this.pos = horiz ? left : top; // distance from SVG origin }, /** * Get the actual axis extremes */ getExtremes: function () { var axis = this, isLog = axis.isLog; return { min: isLog ? correctFloat(lin2log(axis.min)) : axis.min, max: isLog ? correctFloat(lin2log(axis.max)) : axis.max, dataMin: axis.dataMin, dataMax: axis.dataMax, userMin: axis.userMin, userMax: axis.userMax }; }, /** * Get the zero plane either based on zero or on the min or max value. * Used in bar and area plots */ getThreshold: function (threshold) { var axis = this, isLog = axis.isLog, realMin = isLog ? lin2log(axis.min) : axis.min, realMax = isLog ? lin2log(axis.max) : axis.max; // With a threshold of null, make the columns/areas rise from the top or bottom // depending on the value, assuming an actual threshold of 0 (#4233). if (threshold === null) { threshold = realMax < 0 ? realMax : realMin; } else if (realMin > threshold) { threshold = realMin; } else if (realMax < threshold) { threshold = realMax; } return axis.translate(threshold, 0, 1, 0, 1); }, /** * Compute auto alignment for the axis label based on which side the axis is on * and the given rotation for the label */ autoLabelAlign: function (rotation) { var ret, angle = (pick(rotation, 0) - (this.side * 90) + 720) % 360; if (angle > 15 && angle < 165) { ret = 'right'; } else if (angle > 195 && angle < 345) { ret = 'left'; } else { ret = 'center'; } return ret; }, /** * Prevent the ticks from getting so close we can't draw the labels. On a horizontal * axis, this is handled by rotating the labels, removing ticks and adding ellipsis. * On a vertical axis remove ticks and add ellipsis. */ unsquish: function () { var chart = this.chart, ticks = this.ticks, labelOptions = this.options.labels, horiz = this.horiz, tickInterval = this.tickInterval, newTickInterval = tickInterval, slotSize = this.len / (((this.categories ? 1 : 0) + this.max - this.min) / tickInterval), rotation, rotationOption = labelOptions.rotation, labelMetrics = chart.renderer.fontMetrics(labelOptions.style.fontSize, ticks[0] && ticks[0].label), step, bestScore = Number.MAX_VALUE, autoRotation, // Return the multiple of tickInterval that is needed to avoid collision getStep = function (spaceNeeded) { var step = spaceNeeded / (slotSize || 1); step = step > 1 ? mathCeil(step) : 1; return step * tickInterval; }; if (horiz) { autoRotation = !labelOptions.staggerLines && !labelOptions.step && ( // #3971 defined(rotationOption) ? [rotationOption] : slotSize < pick(labelOptions.autoRotationLimit, 80) && labelOptions.autoRotation ); if (autoRotation) { // Loop over the given autoRotation options, and determine which gives the best score. The // best score is that with the lowest number of steps and a rotation closest to horizontal. each(autoRotation, function (rot) { var score; if (rot === rotationOption || (rot && rot >= -90 && rot <= 90)) { // #3891 step = getStep(mathAbs(labelMetrics.h / mathSin(deg2rad * rot))); score = step + mathAbs(rot / 360); if (score < bestScore) { bestScore = score; rotation = rot; newTickInterval = step; } } }); } } else if (!labelOptions.step) { // #4411 newTickInterval = getStep(labelMetrics.h); } this.autoRotation = autoRotation; this.labelRotation = pick(rotation, rotationOption); return newTickInterval; }, renderUnsquish: function () { var chart = this.chart, renderer = chart.renderer, tickPositions = this.tickPositions, ticks = this.ticks, labelOptions = this.options.labels, horiz = this.horiz, margin = chart.margin, slotCount = this.categories ? tickPositions.length : tickPositions.length - 1, slotWidth = this.slotWidth = (horiz && (labelOptions.step || 0) < 2 && !labelOptions.rotation && // #4415 ((this.staggerLines || 1) * chart.plotWidth) / slotCount) || (!horiz && ((margin[3] && (margin[3] - chart.spacing[3])) || chart.chartWidth * 0.33)), // #1580, #1931, innerWidth = mathMax(1, mathRound(slotWidth - 2 * (labelOptions.padding || 5))), attr = {}, labelMetrics = renderer.fontMetrics(labelOptions.style.fontSize, ticks[0] && ticks[0].label), textOverflowOption = labelOptions.style.textOverflow, css, labelLength = 0, label, i, pos; // Set rotation option unless it is "auto", like in gauges if (!isString(labelOptions.rotation)) { attr.rotation = labelOptions.rotation || 0; // #4443 } // Handle auto rotation on horizontal axis if (this.autoRotation) { // Get the longest label length each(tickPositions, function (tick) { tick = ticks[tick]; if (tick && tick.labelLength > labelLength) { labelLength = tick.labelLength; } }); // Apply rotation only if the label is too wide for the slot, and // the label is wider than its height. if (labelLength > innerWidth && labelLength > labelMetrics.h) { attr.rotation = this.labelRotation; } else { this.labelRotation = 0; } // Handle word-wrap or ellipsis on vertical axis } else if (slotWidth) { // For word-wrap or ellipsis css = { width: innerWidth + PX }; if (!textOverflowOption) { css.textOverflow = 'clip'; // On vertical axis, only allow word wrap if there is room for more lines. i = tickPositions.length; while (!horiz && i--) { pos = tickPositions[i]; label = ticks[pos].label; if (label) { // Reset ellipsis in order to get the correct bounding box (#4070) if (label.styles.textOverflow === 'ellipsis') { label.css({ textOverflow: 'clip' }); } if (label.getBBox().height > this.len / tickPositions.length - (labelMetrics.h - labelMetrics.f) || ticks[pos].labelLength > slotWidth) { // #4678 label.specCss = { textOverflow: 'ellipsis' }; } } } } } // Add ellipsis if the label length is significantly longer than ideal if (attr.rotation) { css = { width: (labelLength > chart.chartHeight * 0.5 ? chart.chartHeight * 0.33 : chart.chartHeight) + PX }; if (!textOverflowOption) { css.textOverflow = 'ellipsis'; } } // Set the explicit or automatic label alignment this.labelAlign = labelOptions.align || this.autoLabelAlign(this.labelRotation); if (this.labelAlign) { attr.align = this.labelAlign; } // Apply general and specific CSS each(tickPositions, function (pos) { var tick = ticks[pos], label = tick && tick.label; if (label) { label.attr(attr); // This needs to go before the CSS in old IE (#4502) if (css) { label.css(merge(css, label.specCss)); } delete label.specCss; tick.rotation = attr.rotation; } }); // Note: Why is this not part of getLabelPosition? this.tickRotCorr = renderer.rotCorr(labelMetrics.b, this.labelRotation || 0, this.side !== 0); }, /** * Return true if the axis has associated data */ hasData: function () { return this.hasVisibleSeries || (defined(this.min) && defined(this.max) && !!this.tickPositions); }, /** * Render the tick labels to a preliminary position to get their sizes */ getOffset: function () { var axis = this, chart = axis.chart, renderer = chart.renderer, options = axis.options, tickPositions = axis.tickPositions, ticks = axis.ticks, horiz = axis.horiz, side = axis.side, invertedSide = chart.inverted ? [1, 0, 3, 2][side] : side, hasData, showAxis, titleOffset = 0, titleOffsetOption, titleMargin = 0, axisTitleOptions = options.title, labelOptions = options.labels, labelOffset = 0, // reset labelOffsetPadded, opposite = axis.opposite, axisOffset = chart.axisOffset, clipOffset = chart.clipOffset, clip, directionFactor = [-1, 1, 1, -1][side], n, axisParent = axis.axisParent, // Used in color axis lineHeightCorrection; // For reuse in Axis.render hasData = axis.hasData(); axis.showAxis = showAxis = hasData || pick(options.showEmpty, true); // Set/reset staggerLines axis.staggerLines = axis.horiz && labelOptions.staggerLines; // Create the axisGroup and gridGroup elements on first iteration if (!axis.axisGroup) { axis.gridGroup = renderer.g('grid') .attr({ zIndex: options.gridZIndex || 1 }) .add(axisParent); axis.axisGroup = renderer.g('axis') .attr({ zIndex: options.zIndex || 2 }) .add(axisParent); axis.labelGroup = renderer.g('axis-labels') .attr({ zIndex: labelOptions.zIndex || 7 }) .addClass(PREFIX + axis.coll.toLowerCase() + '-labels') .add(axisParent); } if (hasData || axis.isLinked) { // Generate ticks each(tickPositions, function (pos) { if (!ticks[pos]) { ticks[pos] = new Tick(axis, pos); } else { ticks[pos].addLabel(); // update labels depending on tick interval } }); axis.renderUnsquish(); // Left side must be align: right and right side must have align: left for labels if (labelOptions.reserveSpace !== false && (side === 0 || side === 2 || { 1: 'left', 3: 'right' }[side] === axis.labelAlign || axis.labelAlign === 'center')) { each(tickPositions, function (pos) { // get the highest offset labelOffset = mathMax( ticks[pos].getLabelSize(), labelOffset ); }); } if (axis.staggerLines) { labelOffset *= axis.staggerLines; axis.labelOffset = labelOffset * (axis.opposite ? -1 : 1); } } else { // doesn't have data for (n in ticks) { ticks[n].destroy(); delete ticks[n]; } } if (axisTitleOptions && axisTitleOptions.text && axisTitleOptions.enabled !== false) { if (!axis.axisTitle) { axis.axisTitle = renderer.text( axisTitleOptions.text, 0, 0, axisTitleOptions.useHTML ) .attr({ zIndex: 7, rotation: axisTitleOptions.rotation || 0, align: axisTitleOptions.textAlign || { low: opposite ? 'right' : 'left', middle: 'center', high: opposite ? 'left' : 'right' }[axisTitleOptions.align] }) .addClass(PREFIX + this.coll.toLowerCase() + '-title') .css(axisTitleOptions.style) .add(axis.axisGroup); axis.axisTitle.isNew = true; } if (showAxis) { titleOffset = axis.axisTitle.getBBox()[horiz ? 'height' : 'width']; titleOffsetOption = axisTitleOptions.offset; titleMargin = defined(titleOffsetOption) ? 0 : pick(axisTitleOptions.margin, horiz ? 5 : 10); } // hide or show the title depending on whether showEmpty is set axis.axisTitle[showAxis ? 'show' : 'hide'](true); } // handle automatic or user set offset axis.offset = directionFactor * pick(options.offset, axisOffset[side]); axis.tickRotCorr = axis.tickRotCorr || { x: 0, y: 0 }; // polar lineHeightCorrection = side === 2 ? axis.tickRotCorr.y : 0; labelOffsetPadded = Math.abs(labelOffset) + titleMargin + (labelOffset && (directionFactor * (horiz ? pick(labelOptions.y, axis.tickRotCorr.y + 8) : labelOptions.x) - lineHeightCorrection)); axis.axisTitleMargin = pick(titleOffsetOption, labelOffsetPadded); axisOffset[side] = mathMax( axisOffset[side], axis.axisTitleMargin + titleOffset + directionFactor * axis.offset, labelOffsetPadded // #3027 ); // Decide the clipping needed to keep the graph inside the plot area and axis lines clip = options.offset ? 0 : mathFloor(options.lineWidth / 2) * 2; // #4308, #4371 clipOffset[invertedSide] = mathMax(clipOffset[invertedSide], clip); }, /** * Get the path for the axis line */ getLinePath: function (lineWidth) { var chart = this.chart, opposite = this.opposite, offset = this.offset, horiz = this.horiz, lineLeft = this.left + (opposite ? this.width : 0) + offset, lineTop = chart.chartHeight - this.bottom - (opposite ? this.height : 0) + offset; if (opposite) { lineWidth *= -1; // crispify the other way - #1480, #1687 } return chart.renderer .crispLine([ M, horiz ? this.left : lineLeft, horiz ? lineTop : this.top, L, horiz ? chart.chartWidth - this.right : lineLeft, horiz ? lineTop : chart.chartHeight - this.bottom ], lineWidth); }, /** * Position the title */ getTitlePosition: function () { // compute anchor points for each of the title align options var horiz = this.horiz, axisLeft = this.left, axisTop = this.top, axisLength = this.len, axisTitleOptions = this.options.title, margin = horiz ? axisLeft : axisTop, opposite = this.opposite, offset = this.offset, xOption = axisTitleOptions.x || 0, yOption = axisTitleOptions.y || 0, fontSize = pInt(axisTitleOptions.style.fontSize || 12), // the position in the length direction of the axis alongAxis = { low: margin + (horiz ? 0 : axisLength), middle: margin + axisLength / 2, high: margin + (horiz ? axisLength : 0) }[axisTitleOptions.align], // the position in the perpendicular direction of the axis offAxis = (horiz ? axisTop + this.height : axisLeft) + (horiz ? 1 : -1) * // horizontal axis reverses the margin (opposite ? -1 : 1) * // so does opposite axes this.axisTitleMargin + (this.side === 2 ? fontSize : 0); return { x: horiz ? alongAxis + xOption : offAxis + (opposite ? this.width : 0) + offset + xOption, y: horiz ? offAxis + yOption - (opposite ? this.height : 0) + offset : alongAxis + yOption }; }, /** * Render the axis */ render: function () { var axis = this, chart = axis.chart, renderer = chart.renderer, options = axis.options, isLog = axis.isLog, isLinked = axis.isLinked, tickPositions = axis.tickPositions, axisTitle = axis.axisTitle, ticks = axis.ticks, minorTicks = axis.minorTicks, alternateBands = axis.alternateBands, stackLabelOptions = options.stackLabels, alternateGridColor = options.alternateGridColor, tickmarkOffset = axis.tickmarkOffset, lineWidth = options.lineWidth, linePath, hasRendered = chart.hasRendered, slideInTicks = hasRendered && defined(axis.oldMin) && !isNaN(axis.oldMin), showAxis = axis.showAxis, globalAnimation = renderer.globalAnimation, from, to; // Reset axis.labelEdge.length = 0; //axis.justifyToPlot = overflow === 'justify'; axis.overlap = false; // Mark all elements inActive before we go over and mark the active ones each([ticks, minorTicks, alternateBands], function (coll) { var pos; for (pos in coll) { coll[pos].isActive = false; } }); // If the series has data draw the ticks. Else only the line and title if (axis.hasData() || isLinked) { // minor ticks if (axis.minorTickInterval && !axis.categories) { each(axis.getMinorTickPositions(), function (pos) { if (!minorTicks[pos]) { minorTicks[pos] = new Tick(axis, pos, 'minor'); } // render new ticks in old position if (slideInTicks && minorTicks[pos].isNew) { minorTicks[pos].render(null, true); } minorTicks[pos].render(null, false, 1); }); } // Major ticks. Pull out the first item and render it last so that // we can get the position of the neighbour label. #808. if (tickPositions.length) { // #1300 each(tickPositions, function (pos, i) { // linked axes need an extra check to find out if if (!isLinked || (pos >= axis.min && pos <= axis.max)) { if (!ticks[pos]) { ticks[pos] = new Tick(axis, pos); } // render new ticks in old position if (slideInTicks && ticks[pos].isNew) { ticks[pos].render(i, true, 0.1); } ticks[pos].render(i); } }); // In a categorized axis, the tick marks are displayed between labels. So // we need to add a tick mark and grid line at the left edge of the X axis. if (tickmarkOffset && (axis.min === 0 || axis.single)) { if (!ticks[-1]) { ticks[-1] = new Tick(axis, -1, null, true); } ticks[-1].render(-1); } } // alternate grid color if (alternateGridColor) { each(tickPositions, function (pos, i) { to = tickPositions[i + 1] !== UNDEFINED ? tickPositions[i + 1] + tickmarkOffset : axis.max - tickmarkOffset; if (i % 2 === 0 && pos < axis.max && to <= axis.max + (chart.polar ? -tickmarkOffset : tickmarkOffset)) { // #2248, #4660 if (!alternateBands[pos]) { alternateBands[pos] = new Highcharts.PlotLineOrBand(axis); } from = pos + tickmarkOffset; // #949 alternateBands[pos].options = { from: isLog ? lin2log(from) : from, to: isLog ? lin2log(to) : to, color: alternateGridColor }; alternateBands[pos].render(); alternateBands[pos].isActive = true; } }); } // custom plot lines and bands if (!axis._addedPlotLB) { // only first time each((options.plotLines || []).concat(options.plotBands || []), function (plotLineOptions) { axis.addPlotBandOrLine(plotLineOptions); }); axis._addedPlotLB = true; } } // end if hasData // Remove inactive ticks each([ticks, minorTicks, alternateBands], function (coll) { var pos, i, forDestruction = [], delay = globalAnimation ? globalAnimation.duration || 500 : 0, destroyInactiveItems = function () { i = forDestruction.length; while (i--) { // When resizing rapidly, the same items may be destroyed in different timeouts, // or the may be reactivated if (coll[forDestruction[i]] && !coll[forDestruction[i]].isActive) { coll[forDestruction[i]].destroy(); delete coll[forDestruction[i]]; } } }; for (pos in coll) { if (!coll[pos].isActive) { // Render to zero opacity coll[pos].render(pos, false, 0); coll[pos].isActive = false; forDestruction.push(pos); } } // When the objects are finished fading out, destroy them syncTimeout( destroyInactiveItems, coll === alternateBands || !chart.hasRendered || !delay ? 0 : delay ); }); // Static items. As the axis group is cleared on subsequent calls // to render, these items are added outside the group. // axis line if (lineWidth) { linePath = axis.getLinePath(lineWidth); if (!axis.axisLine) { axis.axisLine = renderer.path(linePath) .attr({ stroke: options.lineColor, 'stroke-width': lineWidth, zIndex: 7 }) .add(axis.axisGroup); } else { axis.axisLine.animate({ d: linePath }); } // show or hide the line depending on options.showEmpty axis.axisLine[showAxis ? 'show' : 'hide'](true); } if (axisTitle && showAxis) { axisTitle[axisTitle.isNew ? 'attr' : 'animate']( axis.getTitlePosition() ); axisTitle.isNew = false; } // Stacked totals: if (stackLabelOptions && stackLabelOptions.enabled) { axis.renderStackTotals(); } // End stacked totals axis.isDirty = false; }, /** * Redraw the axis to reflect changes in the data or axis extremes */ redraw: function () { if (this.visible) { // render the axis this.render(); // move plot lines and bands each(this.plotLinesAndBands, function (plotLine) { plotLine.render(); }); } // mark associated series as dirty and ready for redraw each(this.series, function (series) { series.isDirty = true; }); }, /** * Destroys an Axis instance. */ destroy: function (keepEvents) { var axis = this, stacks = axis.stacks, stackKey, plotLinesAndBands = axis.plotLinesAndBands, i; // Remove the events if (!keepEvents) { removeEvent(axis); } // Destroy each stack total for (stackKey in stacks) { destroyObjectProperties(stacks[stackKey]); stacks[stackKey] = null; } // Destroy collections each([axis.ticks, axis.minorTicks, axis.alternateBands], function (coll) { destroyObjectProperties(coll); }); i = plotLinesAndBands.length; while (i--) { // #1975 plotLinesAndBands[i].destroy(); } // Destroy local variables each(['stackTotalGroup', 'axisLine', 'axisTitle', 'axisGroup', 'cross', 'gridGroup', 'labelGroup'], function (prop) { if (axis[prop]) { axis[prop] = axis[prop].destroy(); } }); // Destroy crosshair if (this.cross) { this.cross.destroy(); } }, /** * Draw the crosshair * * @param {Object} e The event arguments from the modified pointer event * @param {Object} point The Point object */ drawCrosshair: function (e, point) { var path, options = this.crosshair, pos, attribs, categorized, strokeWidth; if ( // Disabled in options !this.crosshair || // Snap ((defined(point) || !pick(options.snap, true)) === false) ) { this.hideCrosshair(); } else { // Get the path if (!pick(options.snap, true)) { pos = (this.horiz ? e.chartX - this.pos : this.len - e.chartY + this.pos); } else if (defined(point)) { pos = this.isXAxis ? point.plotX : this.len - point.plotY; // #3834 } if (this.isRadial) { path = this.getPlotLinePath(this.isXAxis ? point.x : pick(point.stackY, point.y)) || null; // #3189 } else { path = this.getPlotLinePath(null, null, null, null, pos) || null; // #3189 } if (path === null) { this.hideCrosshair(); return; } categorized = this.categories && !this.isRadial; strokeWidth = pick(options.width, (categorized ? this.transA : 1)); // Draw the cross if (this.cross) { this.cross .attr({ d: path, visibility: 'visible', 'stroke-width': strokeWidth // #4737 }); } else { attribs = { 'stroke-width': strokeWidth, stroke: options.color || (categorized ? 'rgba(155,200,255,0.2)' : '#C0C0C0'), zIndex: pick(options.zIndex, 2) }; if (options.dashStyle) { attribs.dashstyle = options.dashStyle; } this.cross = this.chart.renderer.path(path).attr(attribs).add(); } } }, /** * Hide the crosshair. */ hideCrosshair: function () { if (this.cross) { this.cross.hide(); } } }; // end Axis extend(Axis.prototype, AxisPlotLineOrBandExtension); /** * Set the tick positions to a time unit that makes sense, for example * on the first of each month or on every Monday. Return an array * with the time positions. Used in datetime axes as well as for grouping * data on a datetime axis. * * @param {Object} normalizedInterval The interval in axis values (ms) and the count * @param {Number} min The minimum in axis values * @param {Number} max The maximum in axis values * @param {Number} startOfWeek */ Axis.prototype.getTimeTicks = function (normalizedInterval, min, max, startOfWeek) { var tickPositions = [], i, higherRanks = {}, useUTC = defaultOptions.global.useUTC, minYear, // used in months and years as a basis for Date.UTC() minDate = new Date(min - getTZOffset(min)), interval = normalizedInterval.unitRange, count = normalizedInterval.count; if (defined(min)) { // #1300 minDate[setMilliseconds](interval >= timeUnits.second ? 0 : // #3935 count * mathFloor(minDate.getMilliseconds() / count)); // #3652, #3654 if (interval >= timeUnits.second) { // second minDate[setSeconds](interval >= timeUnits.minute ? 0 : // #3935 count * mathFloor(minDate.getSeconds() / count)); } if (interval >= timeUnits.minute) { // minute minDate[setMinutes](interval >= timeUnits.hour ? 0 : count * mathFloor(minDate[getMinutes]() / count)); } if (interval >= timeUnits.hour) { // hour minDate[setHours](interval >= timeUnits.day ? 0 : count * mathFloor(minDate[getHours]() / count)); } if (interval >= timeUnits.day) { // day minDate[setDate](interval >= timeUnits.month ? 1 : count * mathFloor(minDate[getDate]() / count)); } if (interval >= timeUnits.month) { // month minDate[setMonth](interval >= timeUnits.year ? 0 : count * mathFloor(minDate[getMonth]() / count)); minYear = minDate[getFullYear](); } if (interval >= timeUnits.year) { // year minYear -= minYear % count; minDate[setFullYear](minYear); } // week is a special case that runs outside the hierarchy if (interval === timeUnits.week) { // get start of current week, independent of count minDate[setDate](minDate[getDate]() - minDate[getDay]() + pick(startOfWeek, 1)); } // get tick positions i = 1; if (timezoneOffset || getTimezoneOffset) { minDate = minDate.getTime(); minDate = new Date(minDate + getTZOffset(minDate)); } minYear = minDate[getFullYear](); var time = minDate.getTime(), minMonth = minDate[getMonth](), minDateDate = minDate[getDate](), variableDayLength = !useUTC || !!getTimezoneOffset, // #4951 localTimezoneOffset = (timeUnits.day + (useUTC ? getTZOffset(minDate) : minDate.getTimezoneOffset() * 60 * 1000) ) % timeUnits.day; // #950, #3359 // iterate and add tick positions at appropriate values while (time < max) { tickPositions.push(time); // if the interval is years, use Date.UTC to increase years if (interval === timeUnits.year) { time = makeTime(minYear + i * count, 0); // if the interval is months, use Date.UTC to increase months } else if (interval === timeUnits.month) { time = makeTime(minYear, minMonth + i * count); // if we're using global time, the interval is not fixed as it jumps // one hour at the DST crossover } else if (variableDayLength && (interval === timeUnits.day || interval === timeUnits.week)) { time = makeTime(minYear, minMonth, minDateDate + i * count * (interval === timeUnits.day ? 1 : 7)); // else, the interval is fixed and we use simple addition } else { time += interval * count; } i++; } // push the last time tickPositions.push(time); // mark new days if the time is dividible by day (#1649, #1760) each(grep(tickPositions, function (time) { return interval <= timeUnits.hour && time % timeUnits.day === localTimezoneOffset; }), function (time) { higherRanks[time] = 'day'; }); } // record information on the chosen unit - for dynamic label formatter tickPositions.info = extend(normalizedInterval, { higherRanks: higherRanks, totalRange: interval * count }); return tickPositions; }; /** * Get a normalized tick interval for dates. Returns a configuration object with * unit range (interval), count and name. Used to prepare data for getTimeTicks. * Previously this logic was part of getTimeTicks, but as getTimeTicks now runs * of segments in stock charts, the normalizing logic was extracted in order to * prevent it for running over again for each segment having the same interval. * #662, #697. */ Axis.prototype.normalizeTimeTickInterval = function (tickInterval, unitsOption) { var units = unitsOption || [[ 'millisecond', // unit name [1, 2, 5, 10, 20, 25, 50, 100, 200, 500] // allowed multiples ], [ 'second', [1, 2, 5, 10, 15, 30] ], [ 'minute', [1, 2, 5, 10, 15, 30] ], [ 'hour', [1, 2, 3, 4, 6, 8, 12] ], [ 'day', [1, 2] ], [ 'week', [1, 2] ], [ 'month', [1, 2, 3, 4, 6] ], [ 'year', null ]], unit = units[units.length - 1], // default unit is years interval = timeUnits[unit[0]], multiples = unit[1], count, i; // loop through the units to find the one that best fits the tickInterval for (i = 0; i < units.length; i++) { unit = units[i]; interval = timeUnits[unit[0]]; multiples = unit[1]; if (units[i + 1]) { // lessThan is in the middle between the highest multiple and the next unit. var lessThan = (interval * multiples[multiples.length - 1] + timeUnits[units[i + 1][0]]) / 2; // break and keep the current unit if (tickInterval <= lessThan) { break; } } } // prevent 2.5 years intervals, though 25, 250 etc. are allowed if (interval === timeUnits.year && tickInterval < 5 * interval) { multiples = [1, 2, 5]; } // get the count count = normalizeTickInterval( tickInterval / interval, multiples, unit[0] === 'year' ? mathMax(getMagnitude(tickInterval / interval), 1) : 1 // #1913, #2360 ); return { unitRange: interval, count: count, unitName: unit[0] }; }; /** * Methods defined on the Axis prototype */ /** * Set the tick positions of a logarithmic axis */ Axis.prototype.getLogTickPositions = function (interval, min, max, minor) { var axis = this, options = axis.options, axisLength = axis.len, // Since we use this method for both major and minor ticks, // use a local variable and return the result positions = []; // Reset if (!minor) { axis._minorAutoInterval = null; } // First case: All ticks fall on whole logarithms: 1, 10, 100 etc. if (interval >= 0.5) { interval = mathRound(interval); positions = axis.getLinearTickPositions(interval, min, max); // Second case: We need intermediary ticks. For example // 1, 2, 4, 6, 8, 10, 20, 40 etc. } else if (interval >= 0.08) { var roundedMin = mathFloor(min), intermediate, i, j, len, pos, lastPos, break2; if (interval > 0.3) { intermediate = [1, 2, 4]; } else if (interval > 0.15) { // 0.2 equals five minor ticks per 1, 10, 100 etc intermediate = [1, 2, 4, 6, 8]; } else { // 0.1 equals ten minor ticks per 1, 10, 100 etc intermediate = [1, 2, 3, 4, 5, 6, 7, 8, 9]; } for (i = roundedMin; i < max + 1 && !break2; i++) { len = intermediate.length; for (j = 0; j < len && !break2; j++) { pos = log2lin(lin2log(i) * intermediate[j]); if (pos > min && (!minor || lastPos <= max) && lastPos !== UNDEFINED) { // #1670, lastPos is #3113 positions.push(lastPos); } if (lastPos > max) { break2 = true; } lastPos = pos; } } // Third case: We are so deep in between whole logarithmic values that // we might as well handle the tick positions like a linear axis. For // example 1.01, 1.02, 1.03, 1.04. } else { var realMin = lin2log(min), realMax = lin2log(max), tickIntervalOption = options[minor ? 'minorTickInterval' : 'tickInterval'], filteredTickIntervalOption = tickIntervalOption === 'auto' ? null : tickIntervalOption, tickPixelIntervalOption = options.tickPixelInterval / (minor ? 5 : 1), totalPixelLength = minor ? axisLength / axis.tickPositions.length : axisLength; interval = pick( filteredTickIntervalOption, axis._minorAutoInterval, (realMax - realMin) * tickPixelIntervalOption / (totalPixelLength || 1) ); interval = normalizeTickInterval( interval, null, getMagnitude(interval) ); positions = map(axis.getLinearTickPositions( interval, realMin, realMax ), log2lin); if (!minor) { axis._minorAutoInterval = interval / 5; } } // Set the axis-level tickInterval variable if (!minor) { axis.tickInterval = interval; } return positions; };/** * The tooltip object * @param {Object} chart The chart instance * @param {Object} options Tooltip options */ var Tooltip = Highcharts.Tooltip = function () { this.init.apply(this, arguments); }; Tooltip.prototype = { init: function (chart, options) { var borderWidth = options.borderWidth, style = options.style, padding = pInt(style.padding); // Save the chart and options this.chart = chart; this.options = options; // Keep track of the current series //this.currentSeries = UNDEFINED; // List of crosshairs this.crosshairs = []; // Current values of x and y when animating this.now = { x: 0, y: 0 }; // The tooltip is initially hidden this.isHidden = true; // create the label this.label = chart.renderer.label('', 0, 0, options.shape || 'callout', null, null, options.useHTML, null, 'tooltip') .attr({ padding: padding, fill: options.backgroundColor, 'stroke-width': borderWidth, r: options.borderRadius, zIndex: 8 }) .css(style) .css({ padding: 0 }) // Remove it from VML, the padding is applied as an attribute instead (#1117) .add() .attr({ y: -9999 }); // #2301, #2657 // When using canVG the shadow shows up as a gray circle // even if the tooltip is hidden. if (!useCanVG) { this.label.shadow(options.shadow); } // Public property for getting the shared state. this.shared = options.shared; }, /** * Destroy the tooltip and its elements. */ destroy: function () { // Destroy and clear local variables if (this.label) { this.label = this.label.destroy(); } clearTimeout(this.hideTimer); clearTimeout(this.tooltipTimeout); }, /** * Provide a soft movement for the tooltip * * @param {Number} x * @param {Number} y * @private */ move: function (x, y, anchorX, anchorY) { var tooltip = this, now = tooltip.now, animate = tooltip.options.animation !== false && !tooltip.isHidden && // When we get close to the target position, abort animation and land on the right place (#3056) (mathAbs(x - now.x) > 1 || mathAbs(y - now.y) > 1), skipAnchor = tooltip.followPointer || tooltip.len > 1; // Get intermediate values for animation extend(now, { x: animate ? (2 * now.x + x) / 3 : x, y: animate ? (now.y + y) / 2 : y, anchorX: skipAnchor ? UNDEFINED : animate ? (2 * now.anchorX + anchorX) / 3 : anchorX, anchorY: skipAnchor ? UNDEFINED : animate ? (now.anchorY + anchorY) / 2 : anchorY }); // Move to the intermediate value tooltip.label.attr(now); // Run on next tick of the mouse tracker if (animate) { // Never allow two timeouts clearTimeout(this.tooltipTimeout); // Set the fixed interval ticking for the smooth tooltip this.tooltipTimeout = setTimeout(function () { // The interval function may still be running during destroy, so check that the chart is really there before calling. if (tooltip) { tooltip.move(x, y, anchorX, anchorY); } }, 32); } }, /** * Hide the tooltip */ hide: function (delay) { var tooltip = this; clearTimeout(this.hideTimer); // disallow duplicate timers (#1728, #1766) delay = pick(delay, this.options.hideDelay, 500); if (!this.isHidden) { this.hideTimer = syncTimeout(function () { tooltip.label[delay ? 'fadeOut' : 'hide'](); tooltip.isHidden = true; }, delay); } }, /** * Extendable method to get the anchor position of the tooltip * from a point or set of points */ getAnchor: function (points, mouseEvent) { var ret, chart = this.chart, inverted = chart.inverted, plotTop = chart.plotTop, plotLeft = chart.plotLeft, plotX = 0, plotY = 0, yAxis, xAxis; points = splat(points); // Pie uses a special tooltipPos ret = points[0].tooltipPos; // When tooltip follows mouse, relate the position to the mouse if (this.followPointer && mouseEvent) { if (mouseEvent.chartX === UNDEFINED) { mouseEvent = chart.pointer.normalize(mouseEvent); } ret = [ mouseEvent.chartX - chart.plotLeft, mouseEvent.chartY - plotTop ]; } // When shared, use the average position if (!ret) { each(points, function (point) { yAxis = point.series.yAxis; xAxis = point.series.xAxis; plotX += point.plotX + (!inverted && xAxis ? xAxis.left - plotLeft : 0); plotY += (point.plotLow ? (point.plotLow + point.plotHigh) / 2 : point.plotY) + (!inverted && yAxis ? yAxis.top - plotTop : 0); // #1151 }); plotX /= points.length; plotY /= points.length; ret = [ inverted ? chart.plotWidth - plotY : plotX, this.shared && !inverted && points.length > 1 && mouseEvent ? mouseEvent.chartY - plotTop : // place shared tooltip next to the mouse (#424) inverted ? chart.plotHeight - plotX : plotY ]; } return map(ret, mathRound); }, /** * Place the tooltip in a chart without spilling over * and not covering the point it self. */ getPosition: function (boxWidth, boxHeight, point) { var chart = this.chart, distance = this.distance, ret = {}, h = point.h || 0, // #4117 swapped, first = ['y', chart.chartHeight, boxHeight, point.plotY + chart.plotTop, chart.plotTop, chart.plotTop + chart.plotHeight], second = ['x', chart.chartWidth, boxWidth, point.plotX + chart.plotLeft, chart.plotLeft, chart.plotLeft + chart.plotWidth], // The far side is right or bottom preferFarSide = pick(point.ttBelow, (chart.inverted && !point.negative) || (!chart.inverted && point.negative)), /** * Handle the preferred dimension. When the preferred dimension is tooltip * on top or bottom of the point, it will look for space there. */ firstDimension = function (dim, outerSize, innerSize, point, min, max) { var roomLeft = innerSize < point - distance, roomRight = point + distance + innerSize < outerSize, alignedLeft = point - distance - innerSize, alignedRight = point + distance; if (preferFarSide && roomRight) { ret[dim] = alignedRight; } else if (!preferFarSide && roomLeft) { ret[dim] = alignedLeft; } else if (roomLeft) { ret[dim] = mathMin(max - innerSize, alignedLeft - h < 0 ? alignedLeft : alignedLeft - h); } else if (roomRight) { ret[dim] = mathMax(min, alignedRight + h + innerSize > outerSize ? alignedRight : alignedRight + h); } else { return false; } }, /** * Handle the secondary dimension. If the preferred dimension is tooltip * on top or bottom of the point, the second dimension is to align the tooltip * above the point, trying to align center but allowing left or right * align within the chart box. */ secondDimension = function (dim, outerSize, innerSize, point) { var retVal; // Too close to the edge, return false and swap dimensions if (point < distance || point > outerSize - distance) { retVal = false; // Align left/top } else if (point < innerSize / 2) { ret[dim] = 1; // Align right/bottom } else if (point > outerSize - innerSize / 2) { ret[dim] = outerSize - innerSize - 2; // Align center } else { ret[dim] = point - innerSize / 2; } return retVal; }, /** * Swap the dimensions */ swap = function (count) { var temp = first; first = second; second = temp; swapped = count; }, run = function () { if (firstDimension.apply(0, first) !== false) { if (secondDimension.apply(0, second) === false && !swapped) { swap(true); run(); } } else if (!swapped) { swap(true); run(); } else { ret.x = ret.y = 0; } }; // Under these conditions, prefer the tooltip on the side of the point if (chart.inverted || this.len > 1) { swap(); } run(); return ret; }, /** * In case no user defined formatter is given, this will be used. Note that the context * here is an object holding point, series, x, y etc. */ defaultFormatter: function (tooltip) { var items = this.points || splat(this), s; // build the header s = [tooltip.tooltipFooterHeaderFormatter(items[0])]; //#3397: abstraction to enable formatting of footer and header // build the values s = s.concat(tooltip.bodyFormatter(items)); // footer s.push(tooltip.tooltipFooterHeaderFormatter(items[0], true)); //#3397: abstraction to enable formatting of footer and header return s.join(''); }, /** * Refresh the tooltip's text and position. * @param {Object} point */ refresh: function (point, mouseEvent) { var tooltip = this, chart = tooltip.chart, label = tooltip.label, options = tooltip.options, x, y, anchor, textConfig = {}, text, pointConfig = [], formatter = options.formatter || tooltip.defaultFormatter, hoverPoints = chart.hoverPoints, borderColor, shared = tooltip.shared, currentSeries; clearTimeout(this.hideTimer); // get the reference point coordinates (pie charts use tooltipPos) tooltip.followPointer = splat(point)[0].series.tooltipOptions.followPointer; anchor = tooltip.getAnchor(point, mouseEvent); x = anchor[0]; y = anchor[1]; // shared tooltip, array is sent over if (shared && !(point.series && point.series.noSharedTooltip)) { // hide previous hoverPoints and set new chart.hoverPoints = point; if (hoverPoints) { each(hoverPoints, function (point) { point.setState(); }); } each(point, function (item) { item.setState(HOVER_STATE); pointConfig.push(item.getLabelConfig()); }); textConfig = { x: point[0].category, y: point[0].y }; textConfig.points = pointConfig; this.len = pointConfig.length; point = point[0]; // single point tooltip } else { textConfig = point.getLabelConfig(); } text = formatter.call(textConfig, tooltip); // register the current series currentSeries = point.series; this.distance = pick(currentSeries.tooltipOptions.distance, 16); // update the inner HTML if (text === false) { this.hide(); } else { // show it if (tooltip.isHidden) { stop(label); label.attr('opacity', 1).show(); } // update text label.attr({ text: text }); // set the stroke color of the box borderColor = options.borderColor || point.color || currentSeries.color || '#606060'; label.attr({ stroke: borderColor }); tooltip.updatePosition({ plotX: x, plotY: y, negative: point.negative, ttBelow: point.ttBelow, h: anchor[2] || 0 }); this.isHidden = false; } fireEvent(chart, 'tooltipRefresh', { text: text, x: x + chart.plotLeft, y: y + chart.plotTop, borderColor: borderColor }); }, /** * Find the new position and perform the move */ updatePosition: function (point) { var chart = this.chart, label = this.label, pos = (this.options.positioner || this.getPosition).call( this, label.width, label.height, point ); // do the move this.move( mathRound(pos.x), mathRound(pos.y || 0), // can be undefined (#3977) point.plotX + chart.plotLeft, point.plotY + chart.plotTop ); }, /** * Get the best X date format based on the closest point range on the axis. */ getXDateFormat: function (point, options, xAxis) { var xDateFormat, dateTimeLabelFormats = options.dateTimeLabelFormats, closestPointRange = xAxis && xAxis.closestPointRange, n, blank = '01-01 00:00:00.000', strpos = { millisecond: 15, second: 12, minute: 9, hour: 6, day: 3 }, date, lastN = 'millisecond'; // for sub-millisecond data, #4223 if (closestPointRange) { date = dateFormat('%m-%d %H:%M:%S.%L', point.x); for (n in timeUnits) { // If the range is exactly one week and we're looking at a Sunday/Monday, go for the week format if (closestPointRange === timeUnits.week && +dateFormat('%w', point.x) === xAxis.options.startOfWeek && date.substr(6) === blank.substr(6)) { n = 'week'; break; } // The first format that is too great for the range if (timeUnits[n] > closestPointRange) { n = lastN; break; } // If the point is placed every day at 23:59, we need to show // the minutes as well. #2637. if (strpos[n] && date.substr(strpos[n]) !== blank.substr(strpos[n])) { break; } // Weeks are outside the hierarchy, only apply them on Mondays/Sundays like in the first condition if (n !== 'week') { lastN = n; } } if (n) { xDateFormat = dateTimeLabelFormats[n]; } } else { xDateFormat = dateTimeLabelFormats.day; } return xDateFormat || dateTimeLabelFormats.year; // #2546, 2581 }, /** * Format the footer/header of the tooltip * #3397: abstraction to enable formatting of footer and header */ tooltipFooterHeaderFormatter: function (point, isFooter) { var footOrHead = isFooter ? 'footer' : 'header', series = point.series, tooltipOptions = series.tooltipOptions, xDateFormat = tooltipOptions.xDateFormat, xAxis = series.xAxis, isDateTime = xAxis && xAxis.options.type === 'datetime' && isNumber(point.key), formatString = tooltipOptions[footOrHead + 'Format']; // Guess the best date format based on the closest point distance (#568, #3418) if (isDateTime && !xDateFormat) { xDateFormat = this.getXDateFormat(point, tooltipOptions, xAxis); } // Insert the footer date format if any if (isDateTime && xDateFormat) { formatString = formatString.replace('{point.key}', '{point.key:' + xDateFormat + '}'); } return format(formatString, { point: point, series: series }); }, /** * Build the body (lines) of the tooltip by iterating over the items and returning one entry for each item, * abstracting this functionality allows to easily overwrite and extend it. */ bodyFormatter: function (items) { return map(items, function (item) { var tooltipOptions = item.series.tooltipOptions; return (tooltipOptions.pointFormatter || item.point.tooltipFormatter).call(item.point, tooltipOptions.pointFormat); }); } }; var hoverChartIndex; // Global flag for touch support hasTouch = doc && doc.documentElement.ontouchstart !== UNDEFINED; /** * The mouse tracker object. All methods starting with "on" are primary DOM event handlers. * Subsequent methods should be named differently from what they are doing. * @param {Object} chart The Chart instance * @param {Object} options The root options object */ var Pointer = Highcharts.Pointer = function (chart, options) { this.init(chart, options); }; Pointer.prototype = { /** * Initialize Pointer */ init: function (chart, options) { var chartOptions = options.chart, chartEvents = chartOptions.events, zoomType = useCanVG ? '' : chartOptions.zoomType, inverted = chart.inverted, zoomX, zoomY; // Store references this.options = options; this.chart = chart; // Zoom status this.zoomX = zoomX = /x/.test(zoomType); this.zoomY = zoomY = /y/.test(zoomType); this.zoomHor = (zoomX && !inverted) || (zoomY && inverted); this.zoomVert = (zoomY && !inverted) || (zoomX && inverted); this.hasZoom = zoomX || zoomY; // Do we need to handle click on a touch device? this.runChartClick = chartEvents && !!chartEvents.click; this.pinchDown = []; this.lastValidTouch = {}; if (Highcharts.Tooltip && options.tooltip.enabled) { chart.tooltip = new Tooltip(chart, options.tooltip); this.followTouchMove = pick(options.tooltip.followTouchMove, true); } this.setDOMEvents(); }, /** * Add crossbrowser support for chartX and chartY * @param {Object} e The event object in standard browsers */ normalize: function (e, chartPosition) { var chartX, chartY, ePos; // IE normalizing e = e || win.event; if (!e.target) { e.target = e.srcElement; } // iOS (#2757) ePos = e.touches ? (e.touches.length ? e.touches.item(0) : e.changedTouches[0]) : e; // Get mouse position if (!chartPosition) { this.chartPosition = chartPosition = offset(this.chart.container); } // chartX and chartY if (ePos.pageX === UNDEFINED) { // IE < 9. #886. chartX = mathMax(e.x, e.clientX - chartPosition.left); // #2005, #2129: the second case is // for IE10 quirks mode within framesets chartY = e.y; } else { chartX = ePos.pageX - chartPosition.left; chartY = ePos.pageY - chartPosition.top; } return extend(e, { chartX: mathRound(chartX), chartY: mathRound(chartY) }); }, /** * Get the click position in terms of axis values. * * @param {Object} e A pointer event */ getCoordinates: function (e) { var coordinates = { xAxis: [], yAxis: [] }; each(this.chart.axes, function (axis) { coordinates[axis.isXAxis ? 'xAxis' : 'yAxis'].push({ axis: axis, value: axis.toValue(e[axis.horiz ? 'chartX' : 'chartY']) }); }); return coordinates; }, /** * With line type charts with a single tracker, get the point closest to the mouse. * Run Point.onMouseOver and display tooltip for the point or points. */ runPointActions: function (e) { var pointer = this, chart = pointer.chart, series = chart.series, tooltip = chart.tooltip, shared = tooltip ? tooltip.shared : false, followPointer, hoverPoint = chart.hoverPoint, hoverSeries = chart.hoverSeries, i, distance = [Number.MAX_VALUE, Number.MAX_VALUE], // #4511 anchor, noSharedTooltip, stickToHoverSeries, directTouch, kdpoints = [], kdpoint = [], kdpointT; // For hovering over the empty parts of the plot area (hoverSeries is undefined). // If there is one series with point tracking (combo chart), don't go to nearest neighbour. if (!shared && !hoverSeries) { for (i = 0; i < series.length; i++) { if (series[i].directTouch || !series[i].options.stickyTracking) { series = []; } } } // If it has a hoverPoint and that series requires direct touch (like columns, #3899), or we're on // a noSharedTooltip series among shared tooltip series (#4546), use the hoverPoint . Otherwise, // search the k-d tree. stickToHoverSeries = hoverSeries && (shared ? hoverSeries.noSharedTooltip : hoverSeries.directTouch); if (stickToHoverSeries && hoverPoint) { kdpoint = [hoverPoint]; // Handle shared tooltip or cases where a series is not yet hovered } else { // Find nearest points on all series each(series, function (s) { // Skip hidden series noSharedTooltip = s.noSharedTooltip && shared; directTouch = !shared && s.directTouch; if (s.visible && !noSharedTooltip && !directTouch && pick(s.options.enableMouseTracking, true)) { // #3821 kdpointT = s.searchPoint(e, !noSharedTooltip && s.kdDimensions === 1); // #3828 if (kdpointT) { kdpoints.push(kdpointT); } } }); // Find absolute nearest point each(kdpoints, function (p) { if (p) { // Store both closest points, using point.dist and point.distX comparisons (#4645): each(['dist', 'distX'], function (dist, k) { if (typeof p[dist] === 'number' && p[dist] < distance[k]) { distance[k] = p[dist]; kdpoint[k] = p; } }); } }); } // Remove points with different x-positions, required for shared tooltip and crosshairs (#4645): if (shared) { i = kdpoints.length; while (i--) { if (kdpoints[i].clientX !== kdpoint[1].clientX || kdpoints[i].series.noSharedTooltip) { kdpoints.splice(i, 1); } } } // Refresh tooltip for kdpoint if new hover point or tooltip was hidden // #3926, #4200 if (kdpoint[0] && (kdpoint[0] !== this.prevKDPoint || (tooltip && tooltip.isHidden))) { // Draw tooltip if necessary if (shared && !kdpoint[0].series.noSharedTooltip) { if (kdpoints.length && tooltip) { tooltip.refresh(kdpoints, e); } // Do mouseover on all points (#3919, #3985, #4410) each(kdpoints, function (point) { point.onMouseOver(e, point !== ((hoverSeries && hoverSeries.directTouch && hoverPoint) || kdpoint[0])); }); this.prevKDPoint = kdpoint[1]; } else { if (tooltip) { tooltip.refresh(kdpoint[0], e); } if (!hoverSeries || !hoverSeries.directTouch) { // #4448 kdpoint[0].onMouseOver(e); } this.prevKDPoint = kdpoint[0]; } // Update positions (regardless of kdpoint or hoverPoint) } else { followPointer = hoverSeries && hoverSeries.tooltipOptions.followPointer; if (tooltip && followPointer && !tooltip.isHidden) { anchor = tooltip.getAnchor([{}], e); tooltip.updatePosition({ plotX: anchor[0], plotY: anchor[1] }); } } // Start the event listener to pick up the tooltip and crosshairs if (!pointer._onDocumentMouseMove) { pointer._onDocumentMouseMove = function (e) { if (charts[hoverChartIndex]) { charts[hoverChartIndex].pointer.onDocumentMouseMove(e); } }; addEvent(doc, 'mousemove', pointer._onDocumentMouseMove); } // Crosshair each(shared ? kdpoints : [pick(kdpoint[1], hoverPoint)], function (point) { var series = point && point.series; if (series) { each(['xAxis', 'yAxis', 'colorAxis'], function (coll) { if (series[coll]) { series[coll].drawCrosshair(e, point); } }); } }); }, /** * Reset the tracking by hiding the tooltip, the hover series state and the hover point * * @param allowMove {Boolean} Instead of destroying the tooltip altogether, allow moving it if possible */ reset: function (allowMove, delay) { var pointer = this, chart = pointer.chart, hoverSeries = chart.hoverSeries, hoverPoint = chart.hoverPoint, hoverPoints = chart.hoverPoints, tooltip = chart.tooltip, tooltipPoints = tooltip && tooltip.shared ? hoverPoints : hoverPoint; // Narrow in allowMove allowMove = allowMove && tooltip && tooltipPoints; // Check if the points have moved outside the plot area (#1003, #4736) if (allowMove) { each(splat(tooltipPoints), function (point) { if (point.plotX === undefined) { allowMove = false; } }); } // Just move the tooltip, #349 if (allowMove) { tooltip.refresh(tooltipPoints); if (hoverPoint) { // #2500 hoverPoint.setState(hoverPoint.state, true); each(chart.axes, function (axis) { if (pick(axis.options.crosshair && axis.options.crosshair.snap, true)) { axis.drawCrosshair(null, hoverPoint); } else { axis.hideCrosshair(); } }); } // Full reset } else { if (hoverPoint) { hoverPoint.onMouseOut(); } if (hoverPoints) { each(hoverPoints, function (point) { point.setState(); }); } if (hoverSeries) { hoverSeries.onMouseOut(); } if (tooltip) { tooltip.hide(delay); } if (pointer._onDocumentMouseMove) { removeEvent(doc, 'mousemove', pointer._onDocumentMouseMove); pointer._onDocumentMouseMove = null; } // Remove crosshairs each(chart.axes, function (axis) { axis.hideCrosshair(); }); pointer.hoverX = chart.hoverPoints = chart.hoverPoint = null; } }, /** * Scale series groups to a certain scale and translation */ scaleGroups: function (attribs, clip) { var chart = this.chart, seriesAttribs; // Scale each series each(chart.series, function (series) { seriesAttribs = attribs || series.getPlotBox(); // #1701 if (series.xAxis && series.xAxis.zoomEnabled) { series.group.attr(seriesAttribs); if (series.markerGroup) { series.markerGroup.attr(seriesAttribs); series.markerGroup.clip(clip ? chart.clipRect : null); } if (series.dataLabelsGroup) { series.dataLabelsGroup.attr(seriesAttribs); } } }); // Clip chart.clipRect.attr(clip || chart.clipBox); }, /** * Start a drag operation */ dragStart: function (e) { var chart = this.chart; // Record the start position chart.mouseIsDown = e.type; chart.cancelClick = false; chart.mouseDownX = this.mouseDownX = e.chartX; chart.mouseDownY = this.mouseDownY = e.chartY; }, /** * Perform a drag operation in response to a mousemove event while the mouse is down */ drag: function (e) { var chart = this.chart, chartOptions = chart.options.chart, chartX = e.chartX, chartY = e.chartY, zoomHor = this.zoomHor, zoomVert = this.zoomVert, plotLeft = chart.plotLeft, plotTop = chart.plotTop, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, clickedInside, size, selectionMarker = this.selectionMarker, mouseDownX = this.mouseDownX, mouseDownY = this.mouseDownY, panKey = chartOptions.panKey && e[chartOptions.panKey + 'Key']; // If the device supports both touch and mouse (like IE11), and we are touch-dragging // inside the plot area, don't handle the mouse event. #4339. if (selectionMarker && selectionMarker.touch) { return; } // If the mouse is outside the plot area, adjust to cooordinates // inside to prevent the selection marker from going outside if (chartX < plotLeft) { chartX = plotLeft; } else if (chartX > plotLeft + plotWidth) { chartX = plotLeft + plotWidth; } if (chartY < plotTop) { chartY = plotTop; } else if (chartY > plotTop + plotHeight) { chartY = plotTop + plotHeight; } // determine if the mouse has moved more than 10px this.hasDragged = Math.sqrt( Math.pow(mouseDownX - chartX, 2) + Math.pow(mouseDownY - chartY, 2) ); if (this.hasDragged > 10) { clickedInside = chart.isInsidePlot(mouseDownX - plotLeft, mouseDownY - plotTop); // make a selection if (chart.hasCartesianSeries && (this.zoomX || this.zoomY) && clickedInside && !panKey) { if (!selectionMarker) { this.selectionMarker = selectionMarker = chart.renderer.rect( plotLeft, plotTop, zoomHor ? 1 : plotWidth, zoomVert ? 1 : plotHeight, 0 ) .attr({ fill: chartOptions.selectionMarkerFill || 'rgba(69,114,167,0.25)', zIndex: 7 }) .add(); } } // adjust the width of the selection marker if (selectionMarker && zoomHor) { size = chartX - mouseDownX; selectionMarker.attr({ width: mathAbs(size), x: (size > 0 ? 0 : size) + mouseDownX }); } // adjust the height of the selection marker if (selectionMarker && zoomVert) { size = chartY - mouseDownY; selectionMarker.attr({ height: mathAbs(size), y: (size > 0 ? 0 : size) + mouseDownY }); } // panning if (clickedInside && !selectionMarker && chartOptions.panning) { chart.pan(e, chartOptions.panning); } } }, /** * On mouse up or touch end across the entire document, drop the selection. */ drop: function (e) { var pointer = this, chart = this.chart, hasPinched = this.hasPinched; if (this.selectionMarker) { var selectionData = { originalEvent: e, // #4890 xAxis: [], yAxis: [] }, selectionBox = this.selectionMarker, selectionLeft = selectionBox.attr ? selectionBox.attr('x') : selectionBox.x, selectionTop = selectionBox.attr ? selectionBox.attr('y') : selectionBox.y, selectionWidth = selectionBox.attr ? selectionBox.attr('width') : selectionBox.width, selectionHeight = selectionBox.attr ? selectionBox.attr('height') : selectionBox.height, runZoom; // a selection has been made if (this.hasDragged || hasPinched) { // record each axis' min and max each(chart.axes, function (axis) { if (axis.zoomEnabled && defined(axis.min) && (hasPinched || pointer[{ xAxis: 'zoomX', yAxis: 'zoomY' }[axis.coll]])) { // #859, #3569 var horiz = axis.horiz, minPixelPadding = e.type === 'touchend' ? axis.minPixelPadding : 0, // #1207, #3075 selectionMin = axis.toValue((horiz ? selectionLeft : selectionTop) + minPixelPadding), selectionMax = axis.toValue((horiz ? selectionLeft + selectionWidth : selectionTop + selectionHeight) - minPixelPadding); selectionData[axis.coll].push({ axis: axis, min: mathMin(selectionMin, selectionMax), // for reversed axes max: mathMax(selectionMin, selectionMax) }); runZoom = true; } }); if (runZoom) { fireEvent(chart, 'selection', selectionData, function (args) { chart.zoom(extend(args, hasPinched ? { animation: false } : null)); }); } } this.selectionMarker = this.selectionMarker.destroy(); // Reset scaling preview if (hasPinched) { this.scaleGroups(); } } // Reset all if (chart) { // it may be destroyed on mouse up - #877 css(chart.container, { cursor: chart._cursor }); chart.cancelClick = this.hasDragged > 10; // #370 chart.mouseIsDown = this.hasDragged = this.hasPinched = false; this.pinchDown = []; } }, onContainerMouseDown: function (e) { e = this.normalize(e); // issue #295, dragging not always working in Firefox if (e.preventDefault) { e.preventDefault(); } this.dragStart(e); }, onDocumentMouseUp: function (e) { if (charts[hoverChartIndex]) { charts[hoverChartIndex].pointer.drop(e); } }, /** * Special handler for mouse move that will hide the tooltip when the mouse leaves the plotarea. * Issue #149 workaround. The mouseleave event does not always fire. */ onDocumentMouseMove: function (e) { var chart = this.chart, chartPosition = this.chartPosition; e = this.normalize(e, chartPosition); // If we're outside, hide the tooltip if (chartPosition && !this.inClass(e.target, 'highcharts-tracker') && !chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) { this.reset(); } }, /** * When mouse leaves the container, hide the tooltip. */ onContainerMouseLeave: function (e) { var chart = charts[hoverChartIndex]; if (chart && (e.relatedTarget || e.toElement)) { // #4886, MS Touch end fires mouseleave but with no related target chart.pointer.reset(); chart.pointer.chartPosition = null; // also reset the chart position, used in #149 fix } }, // The mousemove, touchmove and touchstart event handler onContainerMouseMove: function (e) { var chart = this.chart; if (!defined(hoverChartIndex) || !charts[hoverChartIndex].mouseIsDown) { hoverChartIndex = chart.index; } e = this.normalize(e); e.returnValue = false; // #2251, #3224 if (chart.mouseIsDown === 'mousedown') { this.drag(e); } // Show the tooltip and run mouse over events (#977) if ((this.inClass(e.target, 'highcharts-tracker') || chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) && !chart.openMenu) { this.runPointActions(e); } }, /** * Utility to detect whether an element has, or has a parent with, a specific * class name. Used on detection of tracker objects and on deciding whether * hovering the tooltip should cause the active series to mouse out. */ inClass: function (element, className) { var elemClassName; while (element) { elemClassName = attr(element, 'class'); if (elemClassName) { if (elemClassName.indexOf(className) !== -1) { return true; } if (elemClassName.indexOf(PREFIX + 'container') !== -1) { return false; } } element = element.parentNode; } }, onTrackerMouseOut: function (e) { var series = this.chart.hoverSeries, relatedTarget = e.relatedTarget || e.toElement; if (series && relatedTarget && !series.options.stickyTracking && // #4886 !this.inClass(relatedTarget, PREFIX + 'tooltip') && !this.inClass(relatedTarget, PREFIX + 'series-' + series.index)) { // #2499, #4465 series.onMouseOut(); } }, onContainerClick: function (e) { var chart = this.chart, hoverPoint = chart.hoverPoint, plotLeft = chart.plotLeft, plotTop = chart.plotTop; e = this.normalize(e); if (!chart.cancelClick) { // On tracker click, fire the series and point events. #783, #1583 if (hoverPoint && this.inClass(e.target, PREFIX + 'tracker')) { // the series click event fireEvent(hoverPoint.series, 'click', extend(e, { point: hoverPoint })); // the point click event if (chart.hoverPoint) { // it may be destroyed (#1844) hoverPoint.firePointEvent('click', e); } // When clicking outside a tracker, fire a chart event } else { extend(e, this.getCoordinates(e)); // fire a click event in the chart if (chart.isInsidePlot(e.chartX - plotLeft, e.chartY - plotTop)) { fireEvent(chart, 'click', e); } } } }, /** * Set the JS DOM events on the container and document. This method should contain * a one-to-one assignment between methods and their handlers. Any advanced logic should * be moved to the handler reflecting the event's name. */ setDOMEvents: function () { var pointer = this, container = pointer.chart.container; container.onmousedown = function (e) { pointer.onContainerMouseDown(e); }; container.onmousemove = function (e) { pointer.onContainerMouseMove(e); }; container.onclick = function (e) { pointer.onContainerClick(e); }; addEvent(container, 'mouseleave', pointer.onContainerMouseLeave); if (chartCount === 1) { addEvent(doc, 'mouseup', pointer.onDocumentMouseUp); } if (hasTouch) { container.ontouchstart = function (e) { pointer.onContainerTouchStart(e); }; container.ontouchmove = function (e) { pointer.onContainerTouchMove(e); }; if (chartCount === 1) { addEvent(doc, 'touchend', pointer.onDocumentTouchEnd); } } }, /** * Destroys the Pointer object and disconnects DOM events. */ destroy: function () { var prop; removeEvent(this.chart.container, 'mouseleave', this.onContainerMouseLeave); if (!chartCount) { removeEvent(doc, 'mouseup', this.onDocumentMouseUp); removeEvent(doc, 'touchend', this.onDocumentTouchEnd); } // memory and CPU leak clearInterval(this.tooltipTimeout); for (prop in this) { this[prop] = null; } } }; /* Support for touch devices */ extend(Highcharts.Pointer.prototype, { /** * Run translation operations */ pinchTranslate: function (pinchDown, touches, transform, selectionMarker, clip, lastValidTouch) { if (this.zoomHor || this.pinchHor) { this.pinchTranslateDirection(true, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch); } if (this.zoomVert || this.pinchVert) { this.pinchTranslateDirection(false, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch); } }, /** * Run translation operations for each direction (horizontal and vertical) independently */ pinchTranslateDirection: function (horiz, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch, forcedScale) { var chart = this.chart, xy = horiz ? 'x' : 'y', XY = horiz ? 'X' : 'Y', sChartXY = 'chart' + XY, wh = horiz ? 'width' : 'height', plotLeftTop = chart['plot' + (horiz ? 'Left' : 'Top')], selectionWH, selectionXY, clipXY, scale = forcedScale || 1, inverted = chart.inverted, bounds = chart.bounds[horiz ? 'h' : 'v'], singleTouch = pinchDown.length === 1, touch0Start = pinchDown[0][sChartXY], touch0Now = touches[0][sChartXY], touch1Start = !singleTouch && pinchDown[1][sChartXY], touch1Now = !singleTouch && touches[1][sChartXY], outOfBounds, transformScale, scaleKey, setScale = function () { if (!singleTouch && mathAbs(touch0Start - touch1Start) > 20) { // Don't zoom if fingers are too close on this axis scale = forcedScale || mathAbs(touch0Now - touch1Now) / mathAbs(touch0Start - touch1Start); } clipXY = ((plotLeftTop - touch0Now) / scale) + touch0Start; selectionWH = chart['plot' + (horiz ? 'Width' : 'Height')] / scale; }; // Set the scale, first pass setScale(); selectionXY = clipXY; // the clip position (x or y) is altered if out of bounds, the selection position is not // Out of bounds if (selectionXY < bounds.min) { selectionXY = bounds.min; outOfBounds = true; } else if (selectionXY + selectionWH > bounds.max) { selectionXY = bounds.max - selectionWH; outOfBounds = true; } // Is the chart dragged off its bounds, determined by dataMin and dataMax? if (outOfBounds) { // Modify the touchNow position in order to create an elastic drag movement. This indicates // to the user that the chart is responsive but can't be dragged further. touch0Now -= 0.8 * (touch0Now - lastValidTouch[xy][0]); if (!singleTouch) { touch1Now -= 0.8 * (touch1Now - lastValidTouch[xy][1]); } // Set the scale, second pass to adapt to the modified touchNow positions setScale(); } else { lastValidTouch[xy] = [touch0Now, touch1Now]; } // Set geometry for clipping, selection and transformation if (!inverted) { clip[xy] = clipXY - plotLeftTop; clip[wh] = selectionWH; } scaleKey = inverted ? (horiz ? 'scaleY' : 'scaleX') : 'scale' + XY; transformScale = inverted ? 1 / scale : scale; selectionMarker[wh] = selectionWH; selectionMarker[xy] = selectionXY; transform[scaleKey] = scale; transform['translate' + XY] = (transformScale * plotLeftTop) + (touch0Now - (transformScale * touch0Start)); }, /** * Handle touch events with two touches */ pinch: function (e) { var self = this, chart = self.chart, pinchDown = self.pinchDown, touches = e.touches, touchesLength = touches.length, lastValidTouch = self.lastValidTouch, hasZoom = self.hasZoom, selectionMarker = self.selectionMarker, transform = {}, fireClickEvent = touchesLength === 1 && ((self.inClass(e.target, PREFIX + 'tracker') && chart.runTrackerClick) || self.runChartClick), clip = {}; // Don't initiate panning until the user has pinched. This prevents us from // blocking page scrolling as users scroll down a long page (#4210). if (touchesLength > 1) { self.initiated = true; } // On touch devices, only proceed to trigger click if a handler is defined if (hasZoom && self.initiated && !fireClickEvent) { e.preventDefault(); } // Normalize each touch map(touches, function (e) { return self.normalize(e); }); // Register the touch start position if (e.type === 'touchstart') { each(touches, function (e, i) { pinchDown[i] = { chartX: e.chartX, chartY: e.chartY }; }); lastValidTouch.x = [pinchDown[0].chartX, pinchDown[1] && pinchDown[1].chartX]; lastValidTouch.y = [pinchDown[0].chartY, pinchDown[1] && pinchDown[1].chartY]; // Identify the data bounds in pixels each(chart.axes, function (axis) { if (axis.zoomEnabled) { var bounds = chart.bounds[axis.horiz ? 'h' : 'v'], minPixelPadding = axis.minPixelPadding, min = axis.toPixels(pick(axis.options.min, axis.dataMin)), max = axis.toPixels(pick(axis.options.max, axis.dataMax)), absMin = mathMin(min, max), absMax = mathMax(min, max); // Store the bounds for use in the touchmove handler bounds.min = mathMin(axis.pos, absMin - minPixelPadding); bounds.max = mathMax(axis.pos + axis.len, absMax + minPixelPadding); } }); self.res = true; // reset on next move // Event type is touchmove, handle panning and pinching } else if (pinchDown.length) { // can be 0 when releasing, if touchend fires first // Set the marker if (!selectionMarker) { self.selectionMarker = selectionMarker = extend({ destroy: noop, touch: true }, chart.plotBox); } self.pinchTranslate(pinchDown, touches, transform, selectionMarker, clip, lastValidTouch); self.hasPinched = hasZoom; // Scale and translate the groups to provide visual feedback during pinching self.scaleGroups(transform, clip); // Optionally move the tooltip on touchmove if (!hasZoom && self.followTouchMove && touchesLength === 1) { this.runPointActions(self.normalize(e)); } else if (self.res) { self.res = false; this.reset(false, 0); } } }, /** * General touch handler shared by touchstart and touchmove. */ touch: function (e, start) { var chart = this.chart; hoverChartIndex = chart.index; if (e.touches.length === 1) { e = this.normalize(e); if (chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop) && !chart.openMenu) { // Run mouse events and display tooltip etc if (start) { this.runPointActions(e); } this.pinch(e); } else if (start) { // Hide the tooltip on touching outside the plot area (#1203) this.reset(); } } else if (e.touches.length === 2) { this.pinch(e); } }, onContainerTouchStart: function (e) { this.touch(e, true); }, onContainerTouchMove: function (e) { this.touch(e); }, onDocumentTouchEnd: function (e) { if (charts[hoverChartIndex]) { charts[hoverChartIndex].pointer.drop(e); } } }); if (win.PointerEvent || win.MSPointerEvent) { // The touches object keeps track of the points being touched at all times var touches = {}, hasPointerEvent = !!win.PointerEvent, getWebkitTouches = function () { var key, fake = []; fake.item = function (i) { return this[i]; }; for (key in touches) { if (touches.hasOwnProperty(key)) { fake.push({ pageX: touches[key].pageX, pageY: touches[key].pageY, target: touches[key].target }); } } return fake; }, translateMSPointer = function (e, method, wktype, func) { var p; if ((e.pointerType === 'touch' || e.pointerType === e.MSPOINTER_TYPE_TOUCH) && charts[hoverChartIndex]) { func(e); p = charts[hoverChartIndex].pointer; p[method]({ type: wktype, target: e.currentTarget, preventDefault: noop, touches: getWebkitTouches() }); } }; /** * Extend the Pointer prototype with methods for each event handler and more */ extend(Pointer.prototype, { onContainerPointerDown: function (e) { translateMSPointer(e, 'onContainerTouchStart', 'touchstart', function (e) { touches[e.pointerId] = { pageX: e.pageX, pageY: e.pageY, target: e.currentTarget }; }); }, onContainerPointerMove: function (e) { translateMSPointer(e, 'onContainerTouchMove', 'touchmove', function (e) { touches[e.pointerId] = { pageX: e.pageX, pageY: e.pageY }; if (!touches[e.pointerId].target) { touches[e.pointerId].target = e.currentTarget; } }); }, onDocumentPointerUp: function (e) { translateMSPointer(e, 'onDocumentTouchEnd', 'touchend', function (e) { delete touches[e.pointerId]; }); }, /** * Add or remove the MS Pointer specific events */ batchMSEvents: function (fn) { fn(this.chart.container, hasPointerEvent ? 'pointerdown' : 'MSPointerDown', this.onContainerPointerDown); fn(this.chart.container, hasPointerEvent ? 'pointermove' : 'MSPointerMove', this.onContainerPointerMove); fn(doc, hasPointerEvent ? 'pointerup' : 'MSPointerUp', this.onDocumentPointerUp); } }); // Disable default IE actions for pinch and such on chart element wrap(Pointer.prototype, 'init', function (proceed, chart, options) { proceed.call(this, chart, options); if (this.hasZoom) { // #4014 css(chart.container, { '-ms-touch-action': NONE, 'touch-action': NONE }); } }); // Add IE specific touch events to chart wrap(Pointer.prototype, 'setDOMEvents', function (proceed) { proceed.apply(this); if (this.hasZoom || this.followTouchMove) { this.batchMSEvents(addEvent); } }); // Destroy MS events also wrap(Pointer.prototype, 'destroy', function (proceed) { this.batchMSEvents(removeEvent); proceed.call(this); }); } /** * The overview of the chart's series */ var Legend = Highcharts.Legend = function (chart, options) { this.init(chart, options); }; Legend.prototype = { /** * Initialize the legend */ init: function (chart, options) { var legend = this, itemStyle = options.itemStyle, padding, itemMarginTop = options.itemMarginTop || 0; this.options = options; if (!options.enabled) { return; } legend.itemStyle = itemStyle; legend.itemHiddenStyle = merge(itemStyle, options.itemHiddenStyle); legend.itemMarginTop = itemMarginTop; legend.padding = padding = pick(options.padding, 8); legend.initialItemX = padding; legend.initialItemY = padding - 5; // 5 is the number of pixels above the text legend.maxItemWidth = 0; legend.chart = chart; legend.itemHeight = 0; legend.symbolWidth = pick(options.symbolWidth, 16); legend.pages = []; // Render it legend.render(); // move checkboxes addEvent(legend.chart, 'endResize', function () { legend.positionCheckboxes(); }); }, /** * Set the colors for the legend item * @param {Object} item A Series or Point instance * @param {Object} visible Dimmed or colored */ colorizeItem: function (item, visible) { var legend = this, options = legend.options, legendItem = item.legendItem, legendLine = item.legendLine, legendSymbol = item.legendSymbol, hiddenColor = legend.itemHiddenStyle.color, textColor = visible ? options.itemStyle.color : hiddenColor, symbolColor = visible ? (item.legendColor || item.color || '#CCC') : hiddenColor, markerOptions = item.options && item.options.marker, symbolAttr = { fill: symbolColor }, key, val; if (legendItem) { legendItem.css({ fill: textColor, color: textColor }); // color for #1553, oldIE } if (legendLine) { legendLine.attr({ stroke: symbolColor }); } if (legendSymbol) { // Apply marker options if (markerOptions && legendSymbol.isMarker) { // #585 symbolAttr.stroke = symbolColor; markerOptions = item.convertAttribs(markerOptions); for (key in markerOptions) { val = markerOptions[key]; if (val !== UNDEFINED) { symbolAttr[key] = val; } } } legendSymbol.attr(symbolAttr); } }, /** * Position the legend item * @param {Object} item A Series or Point instance */ positionItem: function (item) { var legend = this, options = legend.options, symbolPadding = options.symbolPadding, ltr = !options.rtl, legendItemPos = item._legendItemPos, itemX = legendItemPos[0], itemY = legendItemPos[1], checkbox = item.checkbox, legendGroup = item.legendGroup; if (legendGroup && legendGroup.element) { legendGroup.translate( ltr ? itemX : legend.legendWidth - itemX - 2 * symbolPadding - 4, itemY ); } if (checkbox) { checkbox.x = itemX; checkbox.y = itemY; } }, /** * Destroy a single legend item * @param {Object} item The series or point */ destroyItem: function (item) { var checkbox = item.checkbox; // destroy SVG elements each(['legendItem', 'legendLine', 'legendSymbol', 'legendGroup'], function (key) { if (item[key]) { item[key] = item[key].destroy(); } }); if (checkbox) { discardElement(item.checkbox); } }, /** * Destroys the legend. */ destroy: function () { var legend = this, legendGroup = legend.group, box = legend.box; if (box) { legend.box = box.destroy(); } if (legendGroup) { legend.group = legendGroup.destroy(); } }, /** * Position the checkboxes after the width is determined */ positionCheckboxes: function (scrollOffset) { var alignAttr = this.group.alignAttr, translateY, clipHeight = this.clipHeight || this.legendHeight, titleHeight = this.titleHeight; if (alignAttr) { translateY = alignAttr.translateY; each(this.allItems, function (item) { var checkbox = item.checkbox, top; if (checkbox) { top = translateY + titleHeight + checkbox.y + (scrollOffset || 0) + 3; css(checkbox, { left: (alignAttr.translateX + item.checkboxOffset + checkbox.x - 20) + PX, top: top + PX, display: top > translateY - 6 && top < translateY + clipHeight - 6 ? '' : NONE }); } }); } }, /** * Render the legend title on top of the legend */ renderTitle: function () { var options = this.options, padding = this.padding, titleOptions = options.title, titleHeight = 0, bBox; if (titleOptions.text) { if (!this.title) { this.title = this.chart.renderer.label(titleOptions.text, padding - 3, padding - 4, null, null, null, null, null, 'legend-title') .attr({ zIndex: 1 }) .css(titleOptions.style) .add(this.group); } bBox = this.title.getBBox(); titleHeight = bBox.height; this.offsetWidth = bBox.width; // #1717 this.contentGroup.attr({ translateY: titleHeight }); } this.titleHeight = titleHeight; }, /** * Set the legend item text */ setText: function (item) { var options = this.options; item.legendItem.attr({ text: options.labelFormat ? format(options.labelFormat, item) : options.labelFormatter.call(item) }); }, /** * Render a single specific legend item * @param {Object} item A series or point */ renderItem: function (item) { var legend = this, chart = legend.chart, renderer = chart.renderer, options = legend.options, horizontal = options.layout === 'horizontal', symbolWidth = legend.symbolWidth, symbolPadding = options.symbolPadding, itemStyle = legend.itemStyle, itemHiddenStyle = legend.itemHiddenStyle, padding = legend.padding, itemDistance = horizontal ? pick(options.itemDistance, 20) : 0, ltr = !options.rtl, itemHeight, widthOption = options.width, itemMarginBottom = options.itemMarginBottom || 0, itemMarginTop = legend.itemMarginTop, initialItemX = legend.initialItemX, bBox, itemWidth, li = item.legendItem, series = item.series && item.series.drawLegendSymbol ? item.series : item, seriesOptions = series.options, showCheckbox = legend.createCheckboxForItem && seriesOptions && seriesOptions.showCheckbox, useHTML = options.useHTML; if (!li) { // generate it once, later move it // Generate the group box // A group to hold the symbol and text. Text is to be appended in Legend class. item.legendGroup = renderer.g('legend-item') .attr({ zIndex: 1 }) .add(legend.scrollGroup); // Generate the list item text and add it to the group item.legendItem = li = renderer.text( '', ltr ? symbolWidth + symbolPadding : -symbolPadding, legend.baseline || 0, useHTML ) .css(merge(item.visible ? itemStyle : itemHiddenStyle)) // merge to prevent modifying original (#1021) .attr({ align: ltr ? 'left' : 'right', zIndex: 2 }) .add(item.legendGroup); // Get the baseline for the first item - the font size is equal for all if (!legend.baseline) { legend.fontMetrics = renderer.fontMetrics(itemStyle.fontSize, li); legend.baseline = legend.fontMetrics.f + 3 + itemMarginTop; li.attr('y', legend.baseline); } // Draw the legend symbol inside the group box series.drawLegendSymbol(legend, item); if (legend.setItemEvents) { legend.setItemEvents(item, li, useHTML, itemStyle, itemHiddenStyle); } // add the HTML checkbox on top if (showCheckbox) { legend.createCheckboxForItem(item); } } // Colorize the items legend.colorizeItem(item, item.visible); // Always update the text legend.setText(item); // calculate the positions for the next line bBox = li.getBBox(); itemWidth = item.checkboxOffset = options.itemWidth || item.legendItemWidth || symbolWidth + symbolPadding + bBox.width + itemDistance + (showCheckbox ? 20 : 0); legend.itemHeight = itemHeight = mathRound(item.legendItemHeight || bBox.height); // if the item exceeds the width, start a new line if (horizontal && legend.itemX - initialItemX + itemWidth > (widthOption || (chart.chartWidth - 2 * padding - initialItemX - options.x))) { legend.itemX = initialItemX; legend.itemY += itemMarginTop + legend.lastLineHeight + itemMarginBottom; legend.lastLineHeight = 0; // reset for next line (#915, #3976) } // If the item exceeds the height, start a new column /*if (!horizontal && legend.itemY + options.y + itemHeight > chart.chartHeight - spacingTop - spacingBottom) { legend.itemY = legend.initialItemY; legend.itemX += legend.maxItemWidth; legend.maxItemWidth = 0; }*/ // Set the edge positions legend.maxItemWidth = mathMax(legend.maxItemWidth, itemWidth); legend.lastItemY = itemMarginTop + legend.itemY + itemMarginBottom; legend.lastLineHeight = mathMax(itemHeight, legend.lastLineHeight); // #915 // cache the position of the newly generated or reordered items item._legendItemPos = [legend.itemX, legend.itemY]; // advance if (horizontal) { legend.itemX += itemWidth; } else { legend.itemY += itemMarginTop + itemHeight + itemMarginBottom; legend.lastLineHeight = itemHeight; } // the width of the widest item legend.offsetWidth = widthOption || mathMax( (horizontal ? legend.itemX - initialItemX - itemDistance : itemWidth) + padding, legend.offsetWidth ); }, /** * Get all items, which is one item per series for normal series and one item per point * for pie series. */ getAllItems: function () { var allItems = []; each(this.chart.series, function (series) { var seriesOptions = series.options; // Handle showInLegend. If the series is linked to another series, defaults to false. if (!pick(seriesOptions.showInLegend, !defined(seriesOptions.linkedTo) ? UNDEFINED : false, true)) { return; } // use points or series for the legend item depending on legendType allItems = allItems.concat( series.legendItems || (seriesOptions.legendType === 'point' ? series.data : series) ); }); return allItems; }, /** * Adjust the chart margins by reserving space for the legend on only one side * of the chart. If the position is set to a corner, top or bottom is reserved * for horizontal legends and left or right for vertical ones. */ adjustMargins: function (margin, spacing) { var chart = this.chart, options = this.options, // Use the first letter of each alignment option in order to detect the side alignment = options.align.charAt(0) + options.verticalAlign.charAt(0) + options.layout.charAt(0); // #4189 - use charAt(x) notation instead of [x] for IE7 if (this.display && !options.floating) { each([ /(lth|ct|rth)/, /(rtv|rm|rbv)/, /(rbh|cb|lbh)/, /(lbv|lm|ltv)/ ], function (alignments, side) { if (alignments.test(alignment) && !defined(margin[side])) { // Now we have detected on which side of the chart we should reserve space for the legend chart[marginNames[side]] = mathMax( chart[marginNames[side]], chart.legend[(side + 1) % 2 ? 'legendHeight' : 'legendWidth'] + [1, -1, -1, 1][side] * options[(side % 2) ? 'x' : 'y'] + pick(options.margin, 12) + spacing[side] ); } }); } }, /** * Render the legend. This method can be called both before and after * chart.render. If called after, it will only rearrange items instead * of creating new ones. */ render: function () { var legend = this, chart = legend.chart, renderer = chart.renderer, legendGroup = legend.group, allItems, display, legendWidth, legendHeight, box = legend.box, options = legend.options, padding = legend.padding, legendBorderWidth = options.borderWidth, legendBackgroundColor = options.backgroundColor; legend.itemX = legend.initialItemX; legend.itemY = legend.initialItemY; legend.offsetWidth = 0; legend.lastItemY = 0; if (!legendGroup) { legend.group = legendGroup = renderer.g('legend') .attr({ zIndex: 7 }) .add(); legend.contentGroup = renderer.g() .attr({ zIndex: 1 }) // above background .add(legendGroup); legend.scrollGroup = renderer.g() .add(legend.contentGroup); } legend.renderTitle(); // add each series or point allItems = legend.getAllItems(); // sort by legendIndex stableSort(allItems, function (a, b) { return ((a.options && a.options.legendIndex) || 0) - ((b.options && b.options.legendIndex) || 0); }); // reversed legend if (options.reversed) { allItems.reverse(); } legend.allItems = allItems; legend.display = display = !!allItems.length; // render the items legend.lastLineHeight = 0; each(allItems, function (item) { legend.renderItem(item); }); // Get the box legendWidth = (options.width || legend.offsetWidth) + padding; legendHeight = legend.lastItemY + legend.lastLineHeight + legend.titleHeight; legendHeight = legend.handleOverflow(legendHeight); legendHeight += padding; // Draw the border and/or background if (legendBorderWidth || legendBackgroundColor) { if (!box) { legend.box = box = renderer.rect( 0, 0, legendWidth, legendHeight, options.borderRadius, legendBorderWidth || 0 ).attr({ stroke: options.borderColor, 'stroke-width': legendBorderWidth || 0, fill: legendBackgroundColor || NONE }) .add(legendGroup) .shadow(options.shadow); box.isNew = true; } else if (legendWidth > 0 && legendHeight > 0) { box[box.isNew ? 'attr' : 'animate']( box.crisp({ width: legendWidth, height: legendHeight }) ); box.isNew = false; } // hide the border if no items box[display ? 'show' : 'hide'](); } legend.legendWidth = legendWidth; legend.legendHeight = legendHeight; // Now that the legend width and height are established, put the items in the // final position each(allItems, function (item) { legend.positionItem(item); }); // 1.x compatibility: positioning based on style /*var props = ['left', 'right', 'top', 'bottom'], prop, i = 4; while (i--) { prop = props[i]; if (options.style[prop] && options.style[prop] !== 'auto') { options[i < 2 ? 'align' : 'verticalAlign'] = prop; options[i < 2 ? 'x' : 'y'] = pInt(options.style[prop]) * (i % 2 ? -1 : 1); } }*/ if (display) { legendGroup.align(extend({ width: legendWidth, height: legendHeight }, options), true, 'spacingBox'); } if (!chart.isResizing) { this.positionCheckboxes(); } }, /** * Set up the overflow handling by adding navigation with up and down arrows below the * legend. */ handleOverflow: function (legendHeight) { var legend = this, chart = this.chart, renderer = chart.renderer, options = this.options, optionsY = options.y, alignTop = options.verticalAlign === 'top', spaceHeight = chart.spacingBox.height + (alignTop ? -optionsY : optionsY) - this.padding, maxHeight = options.maxHeight, clipHeight, clipRect = this.clipRect, navOptions = options.navigation, animation = pick(navOptions.animation, true), arrowSize = navOptions.arrowSize || 12, nav = this.nav, pages = this.pages, padding = this.padding, lastY, allItems = this.allItems, clipToHeight = function (height) { clipRect.attr({ height: height }); // useHTML if (legend.contentGroup.div) { legend.contentGroup.div.style.clip = 'rect(' + padding + 'px,9999px,' + (padding + height) + 'px,0)'; } }; // Adjust the height if (options.layout === 'horizontal') { spaceHeight /= 2; } if (maxHeight) { spaceHeight = mathMin(spaceHeight, maxHeight); } // Reset the legend height and adjust the clipping rectangle pages.length = 0; if (legendHeight > spaceHeight) { this.clipHeight = clipHeight = mathMax(spaceHeight - 20 - this.titleHeight - padding, 0); this.currentPage = pick(this.currentPage, 1); this.fullHeight = legendHeight; // Fill pages with Y positions so that the top of each a legend item defines // the scroll top for each page (#2098) each(allItems, function (item, i) { var y = item._legendItemPos[1], h = mathRound(item.legendItem.getBBox().height), len = pages.length; if (!len || (y - pages[len - 1] > clipHeight && (lastY || y) !== pages[len - 1])) { pages.push(lastY || y); len++; } if (i === allItems.length - 1 && y + h - pages[len - 1] > clipHeight) { pages.push(y); } if (y !== lastY) { lastY = y; } }); // Only apply clipping if needed. Clipping causes blurred legend in PDF export (#1787) if (!clipRect) { clipRect = legend.clipRect = renderer.clipRect(0, padding, 9999, 0); legend.contentGroup.clip(clipRect); } clipToHeight(clipHeight); // Add navigation elements if (!nav) { this.nav = nav = renderer.g().attr({ zIndex: 1 }).add(this.group); this.up = renderer.symbol('triangle', 0, 0, arrowSize, arrowSize) .on('click', function () { legend.scroll(-1, animation); }) .add(nav); this.pager = renderer.text('', 15, 10) .css(navOptions.style) .add(nav); this.down = renderer.symbol('triangle-down', 0, 0, arrowSize, arrowSize) .on('click', function () { legend.scroll(1, animation); }) .add(nav); } // Set initial position legend.scroll(0); legendHeight = spaceHeight; } else if (nav) { clipToHeight(chart.chartHeight); nav.hide(); this.scrollGroup.attr({ translateY: 1 }); this.clipHeight = 0; // #1379 } return legendHeight; }, /** * Scroll the legend by a number of pages * @param {Object} scrollBy * @param {Object} animation */ scroll: function (scrollBy, animation) { var pages = this.pages, pageCount = pages.length, currentPage = this.currentPage + scrollBy, clipHeight = this.clipHeight, navOptions = this.options.navigation, activeColor = navOptions.activeColor, inactiveColor = navOptions.inactiveColor, pager = this.pager, padding = this.padding, scrollOffset; // When resizing while looking at the last page if (currentPage > pageCount) { currentPage = pageCount; } if (currentPage > 0) { if (animation !== UNDEFINED) { setAnimation(animation, this.chart); } this.nav.attr({ translateX: padding, translateY: clipHeight + this.padding + 7 + this.titleHeight, visibility: VISIBLE }); this.up.attr({ fill: currentPage === 1 ? inactiveColor : activeColor }) .css({ cursor: currentPage === 1 ? 'default' : 'pointer' }); pager.attr({ text: currentPage + '/' + pageCount }); this.down.attr({ x: 18 + this.pager.getBBox().width, // adjust to text width fill: currentPage === pageCount ? inactiveColor : activeColor }) .css({ cursor: currentPage === pageCount ? 'default' : 'pointer' }); scrollOffset = -pages[currentPage - 1] + this.initialItemY; this.scrollGroup.animate({ translateY: scrollOffset }); this.currentPage = currentPage; this.positionCheckboxes(scrollOffset); } } }; /* * LegendSymbolMixin */ var LegendSymbolMixin = Highcharts.LegendSymbolMixin = { /** * Get the series' symbol in the legend * * @param {Object} legend The legend object * @param {Object} item The series (this) or point */ drawRectangle: function (legend, item) { var symbolHeight = legend.options.symbolHeight || legend.fontMetrics.f; item.legendSymbol = this.chart.renderer.rect( 0, legend.baseline - symbolHeight + 1, // #3988 legend.symbolWidth, symbolHeight, legend.options.symbolRadius || 0 ).attr({ zIndex: 3 }).add(item.legendGroup); }, /** * Get the series' symbol in the legend. This method should be overridable to create custom * symbols through Highcharts.seriesTypes[type].prototype.drawLegendSymbols. * * @param {Object} legend The legend object */ drawLineMarker: function (legend) { var options = this.options, markerOptions = options.marker, radius, legendSymbol, symbolWidth = legend.symbolWidth, renderer = this.chart.renderer, legendItemGroup = this.legendGroup, verticalCenter = legend.baseline - mathRound(legend.fontMetrics.b * 0.3), attr; // Draw the line if (options.lineWidth) { attr = { 'stroke-width': options.lineWidth }; if (options.dashStyle) { attr.dashstyle = options.dashStyle; } this.legendLine = renderer.path([ M, 0, verticalCenter, L, symbolWidth, verticalCenter ]) .attr(attr) .add(legendItemGroup); } // Draw the marker if (markerOptions && markerOptions.enabled !== false) { radius = markerOptions.radius; this.legendSymbol = legendSymbol = renderer.symbol( this.symbol, (symbolWidth / 2) - radius, verticalCenter - radius, 2 * radius, 2 * radius, markerOptions ) .add(legendItemGroup); legendSymbol.isMarker = true; } } }; // Workaround for #2030, horizontal legend items not displaying in IE11 Preview, // and for #2580, a similar drawing flaw in Firefox 26. // Explore if there's a general cause for this. The problem may be related // to nested group elements, as the legend item texts are within 4 group elements. if (/Trident\/7\.0/.test(userAgent) || isFirefox) { wrap(Legend.prototype, 'positionItem', function (proceed, item) { var legend = this, runPositionItem = function () { // If chart destroyed in sync, this is undefined (#2030) if (item._legendItemPos) { proceed.call(legend, item); } }; // Do it now, for export and to get checkbox placement runPositionItem(); // Do it after to work around the core issue setTimeout(runPositionItem); }); } /** * The Chart class * @param {String|Object} renderTo The DOM element to render to, or its id * @param {Object} options * @param {Function} callback Function to run when the chart has loaded */ var Chart = Highcharts.Chart = function () { this.getArgs.apply(this, arguments); }; Highcharts.chart = function (a, b, c) { return new Chart(a, b, c); }; Chart.prototype = { /** * Hook for modules */ callbacks: [], /** * Handle the arguments passed to the constructor * @returns {Array} Arguments without renderTo */ getArgs: function () { var args = [].slice.call(arguments); // Remove the optional first argument, renderTo, and // set it on this. if (isString(args[0]) || args[0].nodeName) { this.renderTo = args.shift(); } this.init(args[0], args[1]); }, /** * Initialize the chart */ init: function (userOptions, callback) { // Handle regular options var options, seriesOptions = userOptions.series; // skip merging data points to increase performance userOptions.series = null; options = merge(defaultOptions, userOptions); // do the merge options.series = userOptions.series = seriesOptions; // set back the series data this.userOptions = userOptions; var optionsChart = options.chart; // Create margin & spacing array this.margin = this.splashArray('margin', optionsChart); this.spacing = this.splashArray('spacing', optionsChart); var chartEvents = optionsChart.events; //this.runChartClick = chartEvents && !!chartEvents.click; this.bounds = { h: {}, v: {} }; // Pixel data bounds for touch zoom this.callback = callback; this.isResizing = 0; this.options = options; //chartTitleOptions = UNDEFINED; //chartSubtitleOptions = UNDEFINED; this.axes = []; this.series = []; this.hasCartesianSeries = optionsChart.showAxes; //this.axisOffset = UNDEFINED; //this.maxTicks = UNDEFINED; // handle the greatest amount of ticks on grouped axes //this.inverted = UNDEFINED; //this.loadingShown = UNDEFINED; //this.container = UNDEFINED; //this.chartWidth = UNDEFINED; //this.chartHeight = UNDEFINED; //this.marginRight = UNDEFINED; //this.marginBottom = UNDEFINED; //this.containerWidth = UNDEFINED; //this.containerHeight = UNDEFINED; //this.oldChartWidth = UNDEFINED; //this.oldChartHeight = UNDEFINED; //this.renderTo = UNDEFINED; //this.renderToClone = UNDEFINED; //this.spacingBox = UNDEFINED //this.legend = UNDEFINED; // Elements //this.chartBackground = UNDEFINED; //this.plotBackground = UNDEFINED; //this.plotBGImage = UNDEFINED; //this.plotBorder = UNDEFINED; //this.loadingDiv = UNDEFINED; //this.loadingSpan = UNDEFINED; var chart = this, eventType; // Add the chart to the global lookup chart.index = charts.length; charts.push(chart); chartCount++; // Set up auto resize if (optionsChart.reflow !== false) { addEvent(chart, 'load', function () { chart.initReflow(); }); } // Chart event handlers if (chartEvents) { for (eventType in chartEvents) { addEvent(chart, eventType, chartEvents[eventType]); } } chart.xAxis = []; chart.yAxis = []; // Expose methods and variables chart.animation = useCanVG ? false : pick(optionsChart.animation, true); chart.pointCount = chart.colorCounter = chart.symbolCounter = 0; chart.firstRender(); }, /** * Initialize an individual series, called internally before render time */ initSeries: function (options) { var chart = this, optionsChart = chart.options.chart, type = options.type || optionsChart.type || optionsChart.defaultSeriesType, series, constr = seriesTypes[type]; // No such series type if (!constr) { error(17, true); } series = new constr(); series.init(this, options); return series; }, /** * Check whether a given point is within the plot area * * @param {Number} plotX Pixel x relative to the plot area * @param {Number} plotY Pixel y relative to the plot area * @param {Boolean} inverted Whether the chart is inverted */ isInsidePlot: function (plotX, plotY, inverted) { var x = inverted ? plotY : plotX, y = inverted ? plotX : plotY; return x >= 0 && x <= this.plotWidth && y >= 0 && y <= this.plotHeight; }, /** * Redraw legend, axes or series based on updated data * * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration */ redraw: function (animation) { var chart = this, axes = chart.axes, series = chart.series, pointer = chart.pointer, legend = chart.legend, redrawLegend = chart.isDirtyLegend, hasStackedSeries, hasDirtyStacks, hasCartesianSeries = chart.hasCartesianSeries, isDirtyBox = chart.isDirtyBox, seriesLength = series.length, i = seriesLength, serie, renderer = chart.renderer, isHiddenChart = renderer.isHidden(), afterRedraw = []; setAnimation(animation, chart); if (isHiddenChart) { chart.cloneRenderTo(); } // Adjust title layout (reflow multiline text) chart.layOutTitles(); // link stacked series while (i--) { serie = series[i]; if (serie.options.stacking) { hasStackedSeries = true; if (serie.isDirty) { hasDirtyStacks = true; break; } } } if (hasDirtyStacks) { // mark others as dirty i = seriesLength; while (i--) { serie = series[i]; if (serie.options.stacking) { serie.isDirty = true; } } } // Handle updated data in the series each(series, function (serie) { if (serie.isDirty) { if (serie.options.legendType === 'point') { if (serie.updateTotals) { serie.updateTotals(); } redrawLegend = true; } } }); // handle added or removed series if (redrawLegend && legend.options.enabled) { // series or pie points are added or removed // draw legend graphics legend.render(); chart.isDirtyLegend = false; } // reset stacks if (hasStackedSeries) { chart.getStacks(); } if (hasCartesianSeries) { if (!chart.isResizing) { // reset maxTicks chart.maxTicks = null; // set axes scales each(axes, function (axis) { axis.setScale(); }); } } chart.getMargins(); // #3098 if (hasCartesianSeries) { // If one axis is dirty, all axes must be redrawn (#792, #2169) each(axes, function (axis) { if (axis.isDirty) { isDirtyBox = true; } }); // redraw axes each(axes, function (axis) { // Fire 'afterSetExtremes' only if extremes are set var key = axis.min + ',' + axis.max; if (axis.extKey !== key) { // #821, #4452 axis.extKey = key; afterRedraw.push(function () { // prevent a recursive call to chart.redraw() (#1119) fireEvent(axis, 'afterSetExtremes', extend(axis.eventArgs, axis.getExtremes())); // #747, #751 delete axis.eventArgs; }); } if (isDirtyBox || hasStackedSeries) { axis.redraw(); } }); } // the plot areas size has changed if (isDirtyBox) { chart.drawChartBox(); } // redraw affected series each(series, function (serie) { if (serie.isDirty && serie.visible && (!serie.isCartesian || serie.xAxis)) { // issue #153 serie.redraw(); } }); // move tooltip or reset if (pointer) { pointer.reset(true); } // redraw if canvas renderer.draw(); // fire the event fireEvent(chart, 'redraw'); if (isHiddenChart) { chart.cloneRenderTo(true); } // Fire callbacks that are put on hold until after the redraw each(afterRedraw, function (callback) { callback.call(); }); }, /** * Get an axis, series or point object by id. * @param id {String} The id as given in the configuration options */ get: function (id) { var chart = this, axes = chart.axes, series = chart.series; var i, j, points; // search axes for (i = 0; i < axes.length; i++) { if (axes[i].options.id === id) { return axes[i]; } } // search series for (i = 0; i < series.length; i++) { if (series[i].options.id === id) { return series[i]; } } // search points for (i = 0; i < series.length; i++) { points = series[i].points || []; for (j = 0; j < points.length; j++) { if (points[j].id === id) { return points[j]; } } } return null; }, /** * Create the Axis instances based on the config options */ getAxes: function () { var chart = this, options = this.options, xAxisOptions = options.xAxis = splat(options.xAxis || {}), yAxisOptions = options.yAxis = splat(options.yAxis || {}), optionsArray; // make sure the options are arrays and add some members each(xAxisOptions, function (axis, i) { axis.index = i; axis.isX = true; }); each(yAxisOptions, function (axis, i) { axis.index = i; }); // concatenate all axis options into one array optionsArray = xAxisOptions.concat(yAxisOptions); each(optionsArray, function (axisOptions) { new Axis(chart, axisOptions); // eslint-disable-line no-new }); }, /** * Get the currently selected points from all series */ getSelectedPoints: function () { var points = []; each(this.series, function (serie) { points = points.concat(grep(serie.points || [], function (point) { return point.selected; })); }); return points; }, /** * Get the currently selected series */ getSelectedSeries: function () { return grep(this.series, function (serie) { return serie.selected; }); }, /** * Show the title and subtitle of the chart * * @param titleOptions {Object} New title options * @param subtitleOptions {Object} New subtitle options * */ setTitle: function (titleOptions, subtitleOptions, redraw) { var chart = this, options = chart.options, chartTitleOptions, chartSubtitleOptions; chartTitleOptions = options.title = merge(options.title, titleOptions); chartSubtitleOptions = options.subtitle = merge(options.subtitle, subtitleOptions); // add title and subtitle each([ ['title', titleOptions, chartTitleOptions], ['subtitle', subtitleOptions, chartSubtitleOptions] ], function (arr) { var name = arr[0], title = chart[name], titleOptions = arr[1], chartTitleOptions = arr[2]; if (title && titleOptions) { chart[name] = title = title.destroy(); // remove old } if (chartTitleOptions && chartTitleOptions.text && !title) { chart[name] = chart.renderer.text( chartTitleOptions.text, 0, 0, chartTitleOptions.useHTML ) .attr({ align: chartTitleOptions.align, 'class': PREFIX + name, zIndex: chartTitleOptions.zIndex || 4 }) .css(chartTitleOptions.style) .add(); } }); chart.layOutTitles(redraw); }, /** * Lay out the chart titles and cache the full offset height for use in getMargins */ layOutTitles: function (redraw) { var titleOffset = 0, title = this.title, subtitle = this.subtitle, options = this.options, titleOptions = options.title, subtitleOptions = options.subtitle, requiresDirtyBox, renderer = this.renderer, autoWidth = this.spacingBox.width - 44; // 44 makes room for default context button if (title) { title .css({ width: (titleOptions.width || autoWidth) + PX }) .align(extend({ y: renderer.fontMetrics(titleOptions.style.fontSize, title).b - 3 }, titleOptions), false, 'spacingBox'); if (!titleOptions.floating && !titleOptions.verticalAlign) { titleOffset = title.getBBox().height; } } if (subtitle) { subtitle .css({ width: (subtitleOptions.width || autoWidth) + PX }) .align(extend({ y: titleOffset + (titleOptions.margin - 13) + renderer.fontMetrics(subtitleOptions.style.fontSize, title).b }, subtitleOptions), false, 'spacingBox'); if (!subtitleOptions.floating && !subtitleOptions.verticalAlign) { titleOffset = mathCeil(titleOffset + subtitle.getBBox().height); } } requiresDirtyBox = this.titleOffset !== titleOffset; this.titleOffset = titleOffset; // used in getMargins if (!this.isDirtyBox && requiresDirtyBox) { this.isDirtyBox = requiresDirtyBox; // Redraw if necessary (#2719, #2744) if (this.hasRendered && pick(redraw, true) && this.isDirtyBox) { this.redraw(); } } }, /** * Get chart width and height according to options and container size */ getChartSize: function () { var chart = this, optionsChart = chart.options.chart, widthOption = optionsChart.width, heightOption = optionsChart.height, renderTo = chart.renderToClone || chart.renderTo; // Get inner width and height if (!defined(widthOption)) { chart.containerWidth = getStyle(renderTo, 'width'); } if (!defined(heightOption)) { chart.containerHeight = getStyle(renderTo, 'height'); } chart.chartWidth = mathMax(0, widthOption || chart.containerWidth || 600); // #1393, 1460 chart.chartHeight = mathMax(0, pick(heightOption, // the offsetHeight of an empty container is 0 in standard browsers, but 19 in IE7: chart.containerHeight > 19 ? chart.containerHeight : 400)); }, /** * Create a clone of the chart's renderTo div and place it outside the viewport to allow * size computation on chart.render and chart.redraw */ cloneRenderTo: function (revert) { var clone = this.renderToClone, container = this.container; // Destroy the clone and bring the container back to the real renderTo div if (revert) { if (clone) { this.renderTo.appendChild(container); discardElement(clone); delete this.renderToClone; } // Set up the clone } else { if (container && container.parentNode === this.renderTo) { this.renderTo.removeChild(container); // do not clone this } this.renderToClone = clone = this.renderTo.cloneNode(0); css(clone, { position: ABSOLUTE, top: '-9999px', display: 'block' // #833 }); if (clone.style.setProperty) { // #2631 clone.style.setProperty('display', 'block', 'important'); } doc.body.appendChild(clone); if (container) { clone.appendChild(container); } } }, /** * Get the containing element, determine the size and create the inner container * div to hold the chart */ getContainer: function () { var chart = this, container, options = chart.options, optionsChart = options.chart, chartWidth, chartHeight, renderTo = chart.renderTo, indexAttrName = 'data-highcharts-chart', oldChartIndex, Ren, containerId = 'highcharts-' + idCounter++; if (!renderTo) { chart.renderTo = renderTo = optionsChart.renderTo; } if (isString(renderTo)) { chart.renderTo = renderTo = doc.getElementById(renderTo); } // Display an error if the renderTo is wrong if (!renderTo) { error(13, true); } // If the container already holds a chart, destroy it. The check for hasRendered is there // because web pages that are saved to disk from the browser, will preserve the data-highcharts-chart // attribute and the SVG contents, but not an interactive chart. So in this case, // charts[oldChartIndex] will point to the wrong chart if any (#2609). oldChartIndex = pInt(attr(renderTo, indexAttrName)); if (!isNaN(oldChartIndex) && charts[oldChartIndex] && charts[oldChartIndex].hasRendered) { charts[oldChartIndex].destroy(); } // Make a reference to the chart from the div attr(renderTo, indexAttrName, chart.index); // remove previous chart renderTo.innerHTML = ''; // If the container doesn't have an offsetWidth, it has or is a child of a node // that has display:none. We need to temporarily move it out to a visible // state to determine the size, else the legend and tooltips won't render // properly. The allowClone option is used in sparklines as a micro optimization, // saving about 1-2 ms each chart. if (!optionsChart.skipClone && !renderTo.offsetWidth) { chart.cloneRenderTo(); } // get the width and height chart.getChartSize(); chartWidth = chart.chartWidth; chartHeight = chart.chartHeight; // create the inner container chart.container = container = createElement(DIV, { className: PREFIX + 'container' + (optionsChart.className ? ' ' + optionsChart.className : ''), id: containerId }, extend({ position: RELATIVE, overflow: HIDDEN, // needed for context menu (avoid scrollbars) and // content overflow in IE width: chartWidth + PX, height: chartHeight + PX, textAlign: 'left', lineHeight: 'normal', // #427 zIndex: 0, // #1072 '-webkit-tap-highlight-color': 'rgba(0,0,0,0)' }, optionsChart.style), chart.renderToClone || renderTo ); // cache the cursor (#1650) chart._cursor = container.style.cursor; // Initialize the renderer Ren = Highcharts[optionsChart.renderer] || Renderer; chart.renderer = new Ren( container, chartWidth, chartHeight, optionsChart.style, optionsChart.forExport, options.exporting && options.exporting.allowHTML ); if (useCanVG) { // If we need canvg library, extend and configure the renderer // to get the tracker for translating mouse events chart.renderer.create(chart, container, chartWidth, chartHeight); } // Add a reference to the charts index chart.renderer.chartIndex = chart.index; }, /** * Calculate margins by rendering axis labels in a preliminary position. Title, * subtitle and legend have already been rendered at this stage, but will be * moved into their final positions */ getMargins: function (skipAxes) { var chart = this, spacing = chart.spacing, margin = chart.margin, titleOffset = chart.titleOffset; chart.resetMargins(); // Adjust for title and subtitle if (titleOffset && !defined(margin[0])) { chart.plotTop = mathMax(chart.plotTop, titleOffset + chart.options.title.margin + spacing[0]); } // Adjust for legend chart.legend.adjustMargins(margin, spacing); // adjust for scroller if (chart.extraBottomMargin) { chart.marginBottom += chart.extraBottomMargin; } if (chart.extraTopMargin) { chart.plotTop += chart.extraTopMargin; } if (!skipAxes) { this.getAxisMargins(); } }, getAxisMargins: function () { var chart = this, axisOffset = chart.axisOffset = [0, 0, 0, 0], // top, right, bottom, left margin = chart.margin; // pre-render axes to get labels offset width if (chart.hasCartesianSeries) { each(chart.axes, function (axis) { if (axis.visible) { axis.getOffset(); } }); } // Add the axis offsets each(marginNames, function (m, side) { if (!defined(margin[side])) { chart[m] += axisOffset[side]; } }); chart.setChartSize(); }, /** * Resize the chart to its container if size is not explicitly set */ reflow: function (e) { var chart = this, optionsChart = chart.options.chart, renderTo = chart.renderTo, width = optionsChart.width || getStyle(renderTo, 'width'), height = optionsChart.height || getStyle(renderTo, 'height'), target = e ? e.target : win; // Width and height checks for display:none. Target is doc in IE8 and Opera, // win in Firefox, Chrome and IE9. if (!chart.hasUserSize && !chart.isPrinting && width && height && (target === win || target === doc)) { // #1093 if (width !== chart.containerWidth || height !== chart.containerHeight) { clearTimeout(chart.reflowTimeout); // When called from window.resize, e is set, else it's called directly (#2224) chart.reflowTimeout = syncTimeout(function () { if (chart.container) { // It may have been destroyed in the meantime (#1257) chart.setSize(width, height, false); chart.hasUserSize = null; } }, e ? 100 : 0); } chart.containerWidth = width; chart.containerHeight = height; } }, /** * Add the event handlers necessary for auto resizing */ initReflow: function () { var chart = this, reflow = function (e) { chart.reflow(e); }; addEvent(win, 'resize', reflow); addEvent(chart, 'destroy', function () { removeEvent(win, 'resize', reflow); }); }, /** * Resize the chart to a given width and height * @param {Number} width * @param {Number} height * @param {Object|Boolean} animation */ setSize: function (width, height, animation) { var chart = this, chartWidth, chartHeight, renderer = chart.renderer, globalAnimation; // Handle the isResizing counter chart.isResizing += 1; // set the animation for the current process setAnimation(animation, chart); chart.oldChartHeight = chart.chartHeight; chart.oldChartWidth = chart.chartWidth; if (defined(width)) { chart.chartWidth = chartWidth = mathMax(0, mathRound(width)); chart.hasUserSize = !!chartWidth; } if (defined(height)) { chart.chartHeight = chartHeight = mathMax(0, mathRound(height)); } // Resize the container with the global animation applied if enabled (#2503) globalAnimation = renderer.globalAnimation; (globalAnimation ? animate : css)(chart.container, { width: chartWidth + PX, height: chartHeight + PX }, globalAnimation); chart.setChartSize(true); renderer.setSize(chartWidth, chartHeight, animation); // handle axes chart.maxTicks = null; each(chart.axes, function (axis) { axis.isDirty = true; axis.setScale(); }); // make sure non-cartesian series are also handled each(chart.series, function (serie) { serie.isDirty = true; }); chart.isDirtyLegend = true; // force legend redraw chart.isDirtyBox = true; // force redraw of plot and chart border chart.layOutTitles(); // #2857 chart.getMargins(); chart.redraw(animation); chart.oldChartHeight = null; fireEvent(chart, 'resize'); // Fire endResize and set isResizing back. If animation is disabled, fire without delay globalAnimation = renderer.globalAnimation; // Reassign it before using it, it may have changed since the top of this function. syncTimeout(function () { if (chart) { fireEvent(chart, 'endResize', null, function () { chart.isResizing -= 1; }); } }, globalAnimation === false ? 0 : ((globalAnimation && globalAnimation.duration) || 500)); }, /** * Set the public chart properties. This is done before and after the pre-render * to determine margin sizes */ setChartSize: function (skipAxes) { var chart = this, inverted = chart.inverted, renderer = chart.renderer, chartWidth = chart.chartWidth, chartHeight = chart.chartHeight, optionsChart = chart.options.chart, spacing = chart.spacing, clipOffset = chart.clipOffset, clipX, clipY, plotLeft, plotTop, plotWidth, plotHeight, plotBorderWidth; chart.plotLeft = plotLeft = mathRound(chart.plotLeft); chart.plotTop = plotTop = mathRound(chart.plotTop); chart.plotWidth = plotWidth = mathMax(0, mathRound(chartWidth - plotLeft - chart.marginRight)); chart.plotHeight = plotHeight = mathMax(0, mathRound(chartHeight - plotTop - chart.marginBottom)); chart.plotSizeX = inverted ? plotHeight : plotWidth; chart.plotSizeY = inverted ? plotWidth : plotHeight; chart.plotBorderWidth = optionsChart.plotBorderWidth || 0; // Set boxes used for alignment chart.spacingBox = renderer.spacingBox = { x: spacing[3], y: spacing[0], width: chartWidth - spacing[3] - spacing[1], height: chartHeight - spacing[0] - spacing[2] }; chart.plotBox = renderer.plotBox = { x: plotLeft, y: plotTop, width: plotWidth, height: plotHeight }; plotBorderWidth = 2 * mathFloor(chart.plotBorderWidth / 2); clipX = mathCeil(mathMax(plotBorderWidth, clipOffset[3]) / 2); clipY = mathCeil(mathMax(plotBorderWidth, clipOffset[0]) / 2); chart.clipBox = { x: clipX, y: clipY, width: mathFloor(chart.plotSizeX - mathMax(plotBorderWidth, clipOffset[1]) / 2 - clipX), height: mathMax(0, mathFloor(chart.plotSizeY - mathMax(plotBorderWidth, clipOffset[2]) / 2 - clipY)) }; if (!skipAxes) { each(chart.axes, function (axis) { axis.setAxisSize(); axis.setAxisTranslation(); }); } }, /** * Initial margins before auto size margins are applied */ resetMargins: function () { var chart = this; each(marginNames, function (m, side) { chart[m] = pick(chart.margin[side], chart.spacing[side]); }); chart.axisOffset = [0, 0, 0, 0]; // top, right, bottom, left chart.clipOffset = [0, 0, 0, 0]; }, /** * Draw the borders and backgrounds for chart and plot area */ drawChartBox: function () { var chart = this, optionsChart = chart.options.chart, renderer = chart.renderer, chartWidth = chart.chartWidth, chartHeight = chart.chartHeight, chartBackground = chart.chartBackground, plotBackground = chart.plotBackground, plotBorder = chart.plotBorder, plotBGImage = chart.plotBGImage, chartBorderWidth = optionsChart.borderWidth || 0, chartBackgroundColor = optionsChart.backgroundColor, plotBackgroundColor = optionsChart.plotBackgroundColor, plotBackgroundImage = optionsChart.plotBackgroundImage, plotBorderWidth = optionsChart.plotBorderWidth || 0, mgn, bgAttr, plotLeft = chart.plotLeft, plotTop = chart.plotTop, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, plotBox = chart.plotBox, clipRect = chart.clipRect, clipBox = chart.clipBox; // Chart area mgn = chartBorderWidth + (optionsChart.shadow ? 8 : 0); if (chartBorderWidth || chartBackgroundColor) { if (!chartBackground) { bgAttr = { fill: chartBackgroundColor || NONE }; if (chartBorderWidth) { // #980 bgAttr.stroke = optionsChart.borderColor; bgAttr['stroke-width'] = chartBorderWidth; } chart.chartBackground = renderer.rect(mgn / 2, mgn / 2, chartWidth - mgn, chartHeight - mgn, optionsChart.borderRadius, chartBorderWidth) .attr(bgAttr) .addClass(PREFIX + 'background') .add() .shadow(optionsChart.shadow); } else { // resize chartBackground.animate( chartBackground.crisp({ width: chartWidth - mgn, height: chartHeight - mgn }) ); } } // Plot background if (plotBackgroundColor) { if (!plotBackground) { chart.plotBackground = renderer.rect(plotLeft, plotTop, plotWidth, plotHeight, 0) .attr({ fill: plotBackgroundColor }) .add() .shadow(optionsChart.plotShadow); } else { plotBackground.animate(plotBox); } } if (plotBackgroundImage) { if (!plotBGImage) { chart.plotBGImage = renderer.image(plotBackgroundImage, plotLeft, plotTop, plotWidth, plotHeight) .add(); } else { plotBGImage.animate(plotBox); } } // Plot clip if (!clipRect) { chart.clipRect = renderer.clipRect(clipBox); } else { clipRect.animate({ width: clipBox.width, height: clipBox.height }); } // Plot area border if (plotBorderWidth) { if (!plotBorder) { chart.plotBorder = renderer.rect(plotLeft, plotTop, plotWidth, plotHeight, 0, -plotBorderWidth) .attr({ stroke: optionsChart.plotBorderColor, 'stroke-width': plotBorderWidth, fill: NONE, zIndex: 1 }) .add(); } else { plotBorder.animate( plotBorder.crisp({ x: plotLeft, y: plotTop, width: plotWidth, height: plotHeight, strokeWidth: -plotBorderWidth }) //#3282 plotBorder should be negative ); } } // reset chart.isDirtyBox = false; }, /** * Detect whether a certain chart property is needed based on inspecting its options * and series. This mainly applies to the chart.invert property, and in extensions to * the chart.angular and chart.polar properties. */ propFromSeries: function () { var chart = this, optionsChart = chart.options.chart, klass, seriesOptions = chart.options.series, i, value; each(['inverted', 'angular', 'polar'], function (key) { // The default series type's class klass = seriesTypes[optionsChart.type || optionsChart.defaultSeriesType]; // Get the value from available chart-wide properties value = ( chart[key] || // 1. it is set before optionsChart[key] || // 2. it is set in the options (klass && klass.prototype[key]) // 3. it's default series class requires it ); // 4. Check if any the chart's series require it i = seriesOptions && seriesOptions.length; while (!value && i--) { klass = seriesTypes[seriesOptions[i].type]; if (klass && klass.prototype[key]) { value = true; } } // Set the chart property chart[key] = value; }); }, /** * Link two or more series together. This is done initially from Chart.render, * and after Chart.addSeries and Series.remove. */ linkSeries: function () { var chart = this, chartSeries = chart.series; // Reset links each(chartSeries, function (series) { series.linkedSeries.length = 0; }); // Apply new links each(chartSeries, function (series) { var linkedTo = series.options.linkedTo; if (isString(linkedTo)) { if (linkedTo === ':previous') { linkedTo = chart.series[series.index - 1]; } else { linkedTo = chart.get(linkedTo); } if (linkedTo) { linkedTo.linkedSeries.push(series); series.linkedParent = linkedTo; series.visible = pick(series.options.visible, linkedTo.options.visible, series.visible); // #3879 } } }); }, /** * Render series for the chart */ renderSeries: function () { each(this.series, function (serie) { serie.translate(); serie.render(); }); }, /** * Render labels for the chart */ renderLabels: function () { var chart = this, labels = chart.options.labels; if (labels.items) { each(labels.items, function (label) { var style = extend(labels.style, label.style), x = pInt(style.left) + chart.plotLeft, y = pInt(style.top) + chart.plotTop + 12; // delete to prevent rewriting in IE delete style.left; delete style.top; chart.renderer.text( label.html, x, y ) .attr({ zIndex: 2 }) .css(style) .add(); }); } }, /** * Render all graphics for the chart */ render: function () { var chart = this, axes = chart.axes, renderer = chart.renderer, options = chart.options, tempWidth, tempHeight, redoHorizontal, redoVertical; // Title chart.setTitle(); // Legend chart.legend = new Legend(chart, options.legend); // Get stacks if (chart.getStacks) { chart.getStacks(); } // Get chart margins chart.getMargins(true); chart.setChartSize(); // Record preliminary dimensions for later comparison tempWidth = chart.plotWidth; tempHeight = chart.plotHeight = chart.plotHeight - 21; // 21 is the most common correction for X axis labels // Get margins by pre-rendering axes each(axes, function (axis) { axis.setScale(); }); chart.getAxisMargins(); // If the plot area size has changed significantly, calculate tick positions again redoHorizontal = tempWidth / chart.plotWidth > 1.1; redoVertical = tempHeight / chart.plotHeight > 1.05; // Height is more sensitive if (redoHorizontal || redoVertical) { chart.maxTicks = null; // reset for second pass each(axes, function (axis) { if ((axis.horiz && redoHorizontal) || (!axis.horiz && redoVertical)) { axis.setTickInterval(true); // update to reflect the new margins } }); chart.getMargins(); // second pass to check for new labels } // Draw the borders and backgrounds chart.drawChartBox(); // Axes if (chart.hasCartesianSeries) { each(axes, function (axis) { if (axis.visible) { axis.render(); } }); } // The series if (!chart.seriesGroup) { chart.seriesGroup = renderer.g('series-group') .attr({ zIndex: 3 }) .add(); } chart.renderSeries(); // Labels chart.renderLabels(); // Credits chart.showCredits(options.credits); // Set flag chart.hasRendered = true; }, /** * Show chart credits based on config options */ showCredits: function (credits) { if (credits.enabled && !this.credits) { this.credits = this.renderer.text( credits.text, 0, 0 ) .on('click', function () { if (credits.href) { win.location.href = credits.href; } }) .attr({ align: credits.position.align, zIndex: 8 }) .css(credits.style) .add() .align(credits.position); } }, /** * Clean up memory usage */ destroy: function () { var chart = this, axes = chart.axes, series = chart.series, container = chart.container, i, parentNode = container && container.parentNode; // fire the chart.destoy event fireEvent(chart, 'destroy'); // Delete the chart from charts lookup array charts[chart.index] = UNDEFINED; chartCount--; chart.renderTo.removeAttribute('data-highcharts-chart'); // remove events removeEvent(chart); // ==== Destroy collections: // Destroy axes i = axes.length; while (i--) { axes[i] = axes[i].destroy(); } // Destroy each series i = series.length; while (i--) { series[i] = series[i].destroy(); } // ==== Destroy chart properties: each(['title', 'subtitle', 'chartBackground', 'plotBackground', 'plotBGImage', 'plotBorder', 'seriesGroup', 'clipRect', 'credits', 'pointer', 'scroller', 'rangeSelector', 'legend', 'resetZoomButton', 'tooltip', 'renderer'], function (name) { var prop = chart[name]; if (prop && prop.destroy) { chart[name] = prop.destroy(); } }); // remove container and all SVG if (container) { // can break in IE when destroyed before finished loading container.innerHTML = ''; removeEvent(container); if (parentNode) { discardElement(container); } } // clean it all up for (i in chart) { delete chart[i]; } }, /** * VML namespaces can't be added until after complete. Listening * for Perini's doScroll hack is not enough. */ isReadyToRender: function () { var chart = this; // Note: win == win.top is required if ((!hasSVG && (win == win.top && doc.readyState !== 'complete')) || (useCanVG && !win.canvg)) { // eslint-disable-line eqeqeq if (useCanVG) { // Delay rendering until canvg library is downloaded and ready CanVGController.push(function () { chart.firstRender(); }, chart.options.global.canvasToolsURL); } else { doc.attachEvent('onreadystatechange', function () { doc.detachEvent('onreadystatechange', chart.firstRender); if (doc.readyState === 'complete') { chart.firstRender(); } }); } return false; } return true; }, /** * Prepare for first rendering after all data are loaded */ firstRender: function () { var chart = this, options = chart.options; // Check whether the chart is ready to render if (!chart.isReadyToRender()) { return; } // Create the container chart.getContainer(); // Run an early event after the container and renderer are established fireEvent(chart, 'init'); chart.resetMargins(); chart.setChartSize(); // Set the common chart properties (mainly invert) from the given series chart.propFromSeries(); // get axes chart.getAxes(); // Initialize the series each(options.series || [], function (serieOptions) { chart.initSeries(serieOptions); }); chart.linkSeries(); // Run an event after axes and series are initialized, but before render. At this stage, // the series data is indexed and cached in the xData and yData arrays, so we can access // those before rendering. Used in Highstock. fireEvent(chart, 'beforeRender'); // depends on inverted and on margins being set if (Highcharts.Pointer) { chart.pointer = new Pointer(chart, options); } chart.render(); // add canvas chart.renderer.draw(); // Fire the load event if there are no external images if (!chart.renderer.imgCount) { chart.onload(); } // If the chart was rendered outside the top container, put it back in (#3679) chart.cloneRenderTo(true); }, /** * On chart load */ onload: function () { var chart = this; // Run callbacks each([this.callback].concat(this.callbacks), function (fn) { if (fn && chart.index !== undefined) { // Chart destroyed in its own callback (#3600) fn.apply(chart, [chart]); } }); // Fire the load event if there are no external images if (!chart.renderer.imgCount) { fireEvent(chart, 'load'); } }, /** * Creates arrays for spacing and margin from given options. */ splashArray: function (target, options) { var oVar = options[target], tArray = isObject(oVar) ? oVar : [oVar, oVar, oVar, oVar]; return [pick(options[target + 'Top'], tArray[0]), pick(options[target + 'Right'], tArray[1]), pick(options[target + 'Bottom'], tArray[2]), pick(options[target + 'Left'], tArray[3])]; } }; // end Chart var CenteredSeriesMixin = Highcharts.CenteredSeriesMixin = { /** * Get the center of the pie based on the size and center options relative to the * plot area. Borrowed by the polar and gauge series types. */ getCenter: function () { var options = this.options, chart = this.chart, slicingRoom = 2 * (options.slicedOffset || 0), handleSlicingRoom, plotWidth = chart.plotWidth - 2 * slicingRoom, plotHeight = chart.plotHeight - 2 * slicingRoom, centerOption = options.center, positions = [pick(centerOption[0], '50%'), pick(centerOption[1], '50%'), options.size || '100%', options.innerSize || 0], smallestSize = mathMin(plotWidth, plotHeight), i, value; for (i = 0; i < 4; ++i) { value = positions[i]; handleSlicingRoom = i < 2 || (i === 2 && /%$/.test(value)); // i == 0: centerX, relative to width // i == 1: centerY, relative to height // i == 2: size, relative to smallestSize // i == 3: innerSize, relative to size positions[i] = relativeLength(value, [plotWidth, plotHeight, smallestSize, positions[2]][i]) + (handleSlicingRoom ? slicingRoom : 0); } // innerSize cannot be larger than size (#3632) if (positions[3] > positions[2]) { positions[3] = positions[2]; } return positions; } }; /** * The Point object and prototype. Inheritable and used as base for PiePoint */ var Point = function () {}; Point.prototype = { /** * Initialize the point * @param {Object} series The series object containing this point * @param {Object} options The data in either number, array or object format */ init: function (series, options, x) { var point = this, colors; point.series = series; point.color = series.color; // #3445 point.applyOptions(options, x); point.pointAttr = {}; if (series.options.colorByPoint) { colors = series.options.colors || series.chart.options.colors; point.color = point.color || colors[series.colorCounter++]; // loop back to zero if (series.colorCounter === colors.length) { series.colorCounter = 0; } } series.chart.pointCount++; return point; }, /** * Apply the options containing the x and y data and possible some extra properties. * This is called on point init or from point.update. * * @param {Object} options */ applyOptions: function (options, x) { var point = this, series = point.series, pointValKey = series.options.pointValKey || series.pointValKey; options = Point.prototype.optionsToObject.call(this, options); // copy options directly to point extend(point, options); point.options = point.options ? extend(point.options, options) : options; // For higher dimension series types. For instance, for ranges, point.y is mapped to point.low. if (pointValKey) { point.y = point[pointValKey]; } point.isNull = point.y === null; // If no x is set by now, get auto incremented value. All points must have an // x value, however the y value can be null to create a gap in the series if (point.x === UNDEFINED && series) { point.x = x === UNDEFINED ? series.autoIncrement() : x; } return point; }, /** * Transform number or array configs into objects */ optionsToObject: function (options) { var ret = {}, series = this.series, keys = series.options.keys, pointArrayMap = keys || series.pointArrayMap || ['y'], valueCount = pointArrayMap.length, firstItemType, i = 0, j = 0; if (typeof options === 'number' || options === null) { ret[pointArrayMap[0]] = options; } else if (isArray(options)) { // with leading x value if (!keys && options.length > valueCount) { firstItemType = typeof options[0]; if (firstItemType === 'string') { ret.name = options[0]; } else if (firstItemType === 'number') { ret.x = options[0]; } i++; } while (j < valueCount) { if (!keys || options[i] !== undefined) { // Skip undefined positions for keys ret[pointArrayMap[j]] = options[i]; } i++; j++; } } else if (typeof options === 'object') { ret = options; // This is the fastest way to detect if there are individual point dataLabels that need // to be considered in drawDataLabels. These can only occur in object configs. if (options.dataLabels) { series._hasPointLabels = true; } // Same approach as above for markers if (options.marker) { series._hasPointMarkers = true; } } return ret; }, /** * Destroy a point to clear memory. Its reference still stays in series.data. */ destroy: function () { var point = this, series = point.series, chart = series.chart, hoverPoints = chart.hoverPoints, prop; chart.pointCount--; if (hoverPoints) { point.setState(); erase(hoverPoints, point); if (!hoverPoints.length) { chart.hoverPoints = null; } } if (point === chart.hoverPoint) { point.onMouseOut(); } // remove all events if (point.graphic || point.dataLabel) { // removeEvent and destroyElements are performance expensive removeEvent(point); point.destroyElements(); } if (point.legendItem) { // pies have legend items chart.legend.destroyItem(point); } for (prop in point) { point[prop] = null; } }, /** * Destroy SVG elements associated with the point */ destroyElements: function () { var point = this, props = ['graphic', 'dataLabel', 'dataLabelUpper', 'connector', 'shadowGroup'], prop, i = 6; while (i--) { prop = props[i]; if (point[prop]) { point[prop] = point[prop].destroy(); } } }, /** * Return the configuration hash needed for the data label and tooltip formatters */ getLabelConfig: function () { return { x: this.category, y: this.y, color: this.color, key: this.name || this.category, series: this.series, point: this, percentage: this.percentage, total: this.total || this.stackTotal }; }, /** * Extendable method for formatting each point's tooltip line * * @return {String} A string to be concatenated in to the common tooltip text */ tooltipFormatter: function (pointFormat) { // Insert options for valueDecimals, valuePrefix, and valueSuffix var series = this.series, seriesTooltipOptions = series.tooltipOptions, valueDecimals = pick(seriesTooltipOptions.valueDecimals, ''), valuePrefix = seriesTooltipOptions.valuePrefix || '', valueSuffix = seriesTooltipOptions.valueSuffix || ''; // Loop over the point array map and replace unformatted values with sprintf formatting markup each(series.pointArrayMap || ['y'], function (key) { key = '{point.' + key; // without the closing bracket if (valuePrefix || valueSuffix) { pointFormat = pointFormat.replace(key + '}', valuePrefix + key + '}' + valueSuffix); } pointFormat = pointFormat.replace(key + '}', key + ':,.' + valueDecimals + 'f}'); }); return format(pointFormat, { point: this, series: this.series }); }, /** * Fire an event on the Point object. * @param {String} eventType * @param {Object} eventArgs Additional event arguments * @param {Function} defaultFunction Default event handler */ firePointEvent: function (eventType, eventArgs, defaultFunction) { var point = this, series = this.series, seriesOptions = series.options; // load event handlers on demand to save time on mouseover/out if (seriesOptions.point.events[eventType] || (point.options && point.options.events && point.options.events[eventType])) { this.importEvents(); } // add default handler if in selection mode if (eventType === 'click' && seriesOptions.allowPointSelect) { defaultFunction = function (event) { // Control key is for Windows, meta (= Cmd key) for Mac, Shift for Opera if (point.select) { // Could be destroyed by prior event handlers (#2911) point.select(null, event.ctrlKey || event.metaKey || event.shiftKey); } }; } fireEvent(this, eventType, eventArgs, defaultFunction); }, visible: true };/** * @classDescription The base function which all other series types inherit from. The data in the series is stored * in various arrays. * * - First, series.options.data contains all the original config options for * each point whether added by options or methods like series.addPoint. * - Next, series.data contains those values converted to points, but in case the series data length * exceeds the cropThreshold, or if the data is grouped, series.data doesn't contain all the points. It * only contains the points that have been created on demand. * - Then there's series.points that contains all currently visible point objects. In case of cropping, * the cropped-away points are not part of this array. The series.points array starts at series.cropStart * compared to series.data and series.options.data. If however the series data is grouped, these can't * be correlated one to one. * - series.xData and series.processedXData contain clean x values, equivalent to series.data and series.points. * - series.yData and series.processedYData contain clean x values, equivalent to series.data and series.points. * * @param {Object} chart * @param {Object} options */ var Series = Highcharts.Series = function () {}; Series.prototype = { isCartesian: true, type: 'line', pointClass: Point, sorted: true, // requires the data to be sorted requireSorting: true, pointAttrToOptions: { // mapping between SVG attributes and the corresponding options stroke: 'lineColor', 'stroke-width': 'lineWidth', fill: 'fillColor', r: 'radius' }, directTouch: false, axisTypes: ['xAxis', 'yAxis'], colorCounter: 0, parallelArrays: ['x', 'y'], // each point's x and y values are stored in this.xData and this.yData init: function (chart, options) { var series = this, eventType, events, chartSeries = chart.series, sortByIndex = function (a, b) { return pick(a.options.index, a._i) - pick(b.options.index, b._i); }; series.chart = chart; series.options = options = series.setOptions(options); // merge with plotOptions series.linkedSeries = []; // bind the axes series.bindAxes(); // set some variables extend(series, { name: options.name, state: NORMAL_STATE, pointAttr: {}, visible: options.visible !== false, // true by default selected: options.selected === true // false by default }); // special if (useCanVG) { options.animation = false; } // register event listeners events = options.events; for (eventType in events) { addEvent(series, eventType, events[eventType]); } if ( (events && events.click) || (options.point && options.point.events && options.point.events.click) || options.allowPointSelect ) { chart.runTrackerClick = true; } series.getColor(); series.getSymbol(); // Set the data each(series.parallelArrays, function (key) { series[key + 'Data'] = []; }); series.setData(options.data, false); // Mark cartesian if (series.isCartesian) { chart.hasCartesianSeries = true; } // Register it in the chart chartSeries.push(series); series._i = chartSeries.length - 1; // Sort series according to index option (#248, #1123, #2456) stableSort(chartSeries, sortByIndex); if (this.yAxis) { stableSort(this.yAxis.series, sortByIndex); } each(chartSeries, function (series, i) { series.index = i; series.name = series.name || 'Series ' + (i + 1); }); }, /** * Set the xAxis and yAxis properties of cartesian series, and register the series * in the axis.series array */ bindAxes: function () { var series = this, seriesOptions = series.options, chart = series.chart, axisOptions; each(series.axisTypes || [], function (AXIS) { // repeat for xAxis and yAxis each(chart[AXIS], function (axis) { // loop through the chart's axis objects axisOptions = axis.options; // apply if the series xAxis or yAxis option mathches the number of the // axis, or if undefined, use the first axis if ((seriesOptions[AXIS] === axisOptions.index) || (seriesOptions[AXIS] !== UNDEFINED && seriesOptions[AXIS] === axisOptions.id) || (seriesOptions[AXIS] === UNDEFINED && axisOptions.index === 0)) { // register this series in the axis.series lookup axis.series.push(series); // set this series.xAxis or series.yAxis reference series[AXIS] = axis; // mark dirty for redraw axis.isDirty = true; } }); // The series needs an X and an Y axis if (!series[AXIS] && series.optionalAxis !== AXIS) { error(18, true); } }); }, /** * For simple series types like line and column, the data values are held in arrays like * xData and yData for quick lookup to find extremes and more. For multidimensional series * like bubble and map, this can be extended with arrays like zData and valueData by * adding to the series.parallelArrays array. */ updateParallelArrays: function (point, i) { var series = point.series, args = arguments, fn = typeof i === 'number' ? // Insert the value in the given position function (key) { var val = key === 'y' && series.toYData ? series.toYData(point) : point[key]; series[key + 'Data'][i] = val; } : // Apply the method specified in i with the following arguments as arguments function (key) { Array.prototype[i].apply(series[key + 'Data'], Array.prototype.slice.call(args, 2)); }; each(series.parallelArrays, fn); }, /** * Return an auto incremented x value based on the pointStart and pointInterval options. * This is only used if an x value is not given for the point that calls autoIncrement. */ autoIncrement: function () { var options = this.options, xIncrement = this.xIncrement, date, pointInterval, pointIntervalUnit = options.pointIntervalUnit; xIncrement = pick(xIncrement, options.pointStart, 0); this.pointInterval = pointInterval = pick(this.pointInterval, options.pointInterval, 1); // Added code for pointInterval strings if (pointIntervalUnit === 'month' || pointIntervalUnit === 'year') { date = new Date(xIncrement); date = (pointIntervalUnit === 'month') ? +date[setMonth](date[getMonth]() + pointInterval) : +date[setFullYear](date[getFullYear]() + pointInterval); pointInterval = date - xIncrement; } this.xIncrement = xIncrement + pointInterval; return xIncrement; }, /** * Set the series options by merging from the options tree * @param {Object} itemOptions */ setOptions: function (itemOptions) { var chart = this.chart, chartOptions = chart.options, plotOptions = chartOptions.plotOptions, userOptions = chart.userOptions || {}, userPlotOptions = userOptions.plotOptions || {}, typeOptions = plotOptions[this.type], options, zones; this.userOptions = itemOptions; // General series options take precedence over type options because otherwise, default // type options like column.animation would be overwritten by the general option. // But issues have been raised here (#3881), and the solution may be to distinguish // between default option and userOptions like in the tooltip below. options = merge( typeOptions, plotOptions.series, itemOptions ); // The tooltip options are merged between global and series specific options this.tooltipOptions = merge( defaultOptions.tooltip, defaultOptions.plotOptions[this.type].tooltip, userOptions.tooltip, userPlotOptions.series && userPlotOptions.series.tooltip, userPlotOptions[this.type] && userPlotOptions[this.type].tooltip, itemOptions.tooltip ); // Delete marker object if not allowed (#1125) if (typeOptions.marker === null) { delete options.marker; } // Handle color zones this.zoneAxis = options.zoneAxis; zones = this.zones = (options.zones || []).slice(); if ((options.negativeColor || options.negativeFillColor) && !options.zones) { zones.push({ value: options[this.zoneAxis + 'Threshold'] || options.threshold || 0, color: options.negativeColor, fillColor: options.negativeFillColor }); } if (zones.length) { // Push one extra zone for the rest if (defined(zones[zones.length - 1].value)) { zones.push({ color: this.color, fillColor: this.fillColor }); } } return options; }, getCyclic: function (prop, value, defaults) { var i, userOptions = this.userOptions, indexName = '_' + prop + 'Index', counterName = prop + 'Counter'; if (!value) { if (defined(userOptions[indexName])) { // after Series.update() i = userOptions[indexName]; } else { userOptions[indexName] = i = this.chart[counterName] % defaults.length; this.chart[counterName] += 1; } value = defaults[i]; } this[prop] = value; }, /** * Get the series' color */ getColor: function () { if (this.options.colorByPoint) { this.options.color = null; // #4359, selected slice got series.color even when colorByPoint was set. } else { this.getCyclic('color', this.options.color || defaultPlotOptions[this.type].color, this.chart.options.colors); } }, /** * Get the series' symbol */ getSymbol: function () { var seriesMarkerOption = this.options.marker; this.getCyclic('symbol', seriesMarkerOption.symbol, this.chart.options.symbols); // don't substract radius in image symbols (#604) if (/^url/.test(this.symbol)) { seriesMarkerOption.radius = 0; } }, drawLegendSymbol: LegendSymbolMixin.drawLineMarker, /** * Replace the series data with a new set of data * @param {Object} data * @param {Object} redraw */ setData: function (data, redraw, animation, updatePoints) { var series = this, oldData = series.points, oldDataLength = (oldData && oldData.length) || 0, dataLength, options = series.options, chart = series.chart, firstPoint = null, xAxis = series.xAxis, hasCategories = xAxis && !!xAxis.categories, i, turboThreshold = options.turboThreshold, pt, xData = this.xData, yData = this.yData, pointArrayMap = series.pointArrayMap, valueCount = pointArrayMap && pointArrayMap.length; data = data || []; dataLength = data.length; redraw = pick(redraw, true); // If the point count is the same as is was, just run Point.update which is // cheaper, allows animation, and keeps references to points. if (updatePoints !== false && dataLength && oldDataLength === dataLength && !series.cropped && !series.hasGroupedData && series.visible) { each(data, function (point, i) { // .update doesn't exist on a linked, hidden series (#3709) if (oldData[i].update && point !== options.data[i]) { oldData[i].update(point, false, null, false); } }); } else { // Reset properties series.xIncrement = null; series.colorCounter = 0; // for series with colorByPoint (#1547) // Update parallel arrays each(this.parallelArrays, function (key) { series[key + 'Data'].length = 0; }); // In turbo mode, only one- or twodimensional arrays of numbers are allowed. The // first value is tested, and we assume that all the rest are defined the same // way. Although the 'for' loops are similar, they are repeated inside each // if-else conditional for max performance. if (turboThreshold && dataLength > turboThreshold) { // find the first non-null point i = 0; while (firstPoint === null && i < dataLength) { firstPoint = data[i]; i++; } if (isNumber(firstPoint)) { // assume all points are numbers var x = pick(options.pointStart, 0), pointInterval = pick(options.pointInterval, 1); for (i = 0; i < dataLength; i++) { xData[i] = x; yData[i] = data[i]; x += pointInterval; } series.xIncrement = x; } else if (isArray(firstPoint)) { // assume all points are arrays if (valueCount) { // [x, low, high] or [x, o, h, l, c] for (i = 0; i < dataLength; i++) { pt = data[i]; xData[i] = pt[0]; yData[i] = pt.slice(1, valueCount + 1); } } else { // [x, y] for (i = 0; i < dataLength; i++) { pt = data[i]; xData[i] = pt[0]; yData[i] = pt[1]; } } } else { error(12); // Highcharts expects configs to be numbers or arrays in turbo mode } } else { for (i = 0; i < dataLength; i++) { if (data[i] !== UNDEFINED) { // stray commas in oldIE pt = { series: series }; series.pointClass.prototype.applyOptions.apply(pt, [data[i]]); series.updateParallelArrays(pt, i); if (hasCategories && defined(pt.name)) { // #4401 xAxis.names[pt.x] = pt.name; // #2046 } } } } // Forgetting to cast strings to numbers is a common caveat when handling CSV or JSON if (isString(yData[0])) { error(14, true); } series.data = []; series.options.data = series.userOptions.data = data; // destroy old points i = oldDataLength; while (i--) { if (oldData[i] && oldData[i].destroy) { oldData[i].destroy(); } } // reset minRange (#878) if (xAxis) { xAxis.minRange = xAxis.userMinRange; } // redraw series.isDirty = series.isDirtyData = chart.isDirtyBox = true; animation = false; } // Typically for pie series, points need to be processed and generated // prior to rendering the legend if (options.legendType === 'point') { this.processData(); this.generatePoints(); } if (redraw) { chart.redraw(animation); } }, /** * Process the data by cropping away unused data points if the series is longer * than the crop threshold. This saves computing time for lage series. */ processData: function (force) { var series = this, processedXData = series.xData, // copied during slice operation below processedYData = series.yData, dataLength = processedXData.length, croppedData, cropStart = 0, cropped, distance, closestPointRange, xAxis = series.xAxis, i, // loop variable options = series.options, cropThreshold = options.cropThreshold, getExtremesFromAll = series.getExtremesFromAll || options.getExtremesFromAll, // #4599 isCartesian = series.isCartesian, xExtremes, val2lin = xAxis && xAxis.val2lin, isLog = xAxis && xAxis.isLog, min, max; // If the series data or axes haven't changed, don't go through this. Return false to pass // the message on to override methods like in data grouping. if (isCartesian && !series.isDirty && !xAxis.isDirty && !series.yAxis.isDirty && !force) { return false; } if (xAxis) { xExtremes = xAxis.getExtremes(); // corrected for log axis (#3053) min = xExtremes.min; max = xExtremes.max; } // optionally filter out points outside the plot area if (isCartesian && series.sorted && !getExtremesFromAll && (!cropThreshold || dataLength > cropThreshold || series.forceCrop)) { // it's outside current extremes if (processedXData[dataLength - 1] < min || processedXData[0] > max) { processedXData = []; processedYData = []; // only crop if it's actually spilling out } else if (processedXData[0] < min || processedXData[dataLength - 1] > max) { croppedData = this.cropData(series.xData, series.yData, min, max); processedXData = croppedData.xData; processedYData = croppedData.yData; cropStart = croppedData.start; cropped = true; } } // Find the closest distance between processed points i = processedXData.length || 1; while (--i) { distance = isLog ? val2lin(processedXData[i]) - val2lin(processedXData[i - 1]) : processedXData[i] - processedXData[i - 1]; if (distance > 0 && (closestPointRange === UNDEFINED || distance < closestPointRange)) { closestPointRange = distance; // Unsorted data is not supported by the line tooltip, as well as data grouping and // navigation in Stock charts (#725) and width calculation of columns (#1900) } else if (distance < 0 && series.requireSorting) { error(15); } } // Record the properties series.cropped = cropped; // undefined or true series.cropStart = cropStart; series.processedXData = processedXData; series.processedYData = processedYData; series.closestPointRange = closestPointRange; }, /** * Iterate over xData and crop values between min and max. Returns object containing crop start/end * cropped xData with corresponding part of yData, dataMin and dataMax within the cropped range */ cropData: function (xData, yData, min, max) { var dataLength = xData.length, cropStart = 0, cropEnd = dataLength, cropShoulder = pick(this.cropShoulder, 1), // line-type series need one point outside i, j; // iterate up to find slice start for (i = 0; i < dataLength; i++) { if (xData[i] >= min) { cropStart = mathMax(0, i - cropShoulder); break; } } // proceed to find slice end for (j = i; j < dataLength; j++) { if (xData[j] > max) { cropEnd = j + cropShoulder; break; } } return { xData: xData.slice(cropStart, cropEnd), yData: yData.slice(cropStart, cropEnd), start: cropStart, end: cropEnd }; }, /** * Generate the data point after the data has been processed by cropping away * unused points and optionally grouped in Highcharts Stock. */ generatePoints: function () { var series = this, options = series.options, dataOptions = options.data, data = series.data, dataLength, processedXData = series.processedXData, processedYData = series.processedYData, pointClass = series.pointClass, processedDataLength = processedXData.length, cropStart = series.cropStart || 0, cursor, hasGroupedData = series.hasGroupedData, point, points = [], i; if (!data && !hasGroupedData) { var arr = []; arr.length = dataOptions.length; data = series.data = arr; } for (i = 0; i < processedDataLength; i++) { cursor = cropStart + i; if (!hasGroupedData) { if (data[cursor]) { point = data[cursor]; } else if (dataOptions[cursor] !== UNDEFINED) { // #970 data[cursor] = point = (new pointClass()).init(series, dataOptions[cursor], processedXData[i]); } points[i] = point; } else { // splat the y data in case of ohlc data array points[i] = (new pointClass()).init(series, [processedXData[i]].concat(splat(processedYData[i]))); } points[i].index = cursor; // For faster access in Point.update } // Hide cropped-away points - this only runs when the number of points is above cropThreshold, or when // swithching view from non-grouped data to grouped data (#637) if (data && (processedDataLength !== (dataLength = data.length) || hasGroupedData)) { for (i = 0; i < dataLength; i++) { if (i === cropStart && !hasGroupedData) { // when has grouped data, clear all points i += processedDataLength; } if (data[i]) { data[i].destroyElements(); data[i].plotX = UNDEFINED; // #1003 } } } series.data = data; series.points = points; }, /** * Calculate Y extremes for visible data */ getExtremes: function (yData) { var xAxis = this.xAxis, yAxis = this.yAxis, xData = this.processedXData, yDataLength, activeYData = [], activeCounter = 0, xExtremes = xAxis.getExtremes(), // #2117, need to compensate for log X axis xMin = xExtremes.min, xMax = xExtremes.max, validValue, withinRange, x, y, i, j; yData = yData || this.stackedYData || this.processedYData; yDataLength = yData.length; for (i = 0; i < yDataLength; i++) { x = xData[i]; y = yData[i]; // For points within the visible range, including the first point outside the // visible range, consider y extremes validValue = y !== null && y !== UNDEFINED && (!yAxis.isLog || (y.length || y > 0)); withinRange = this.getExtremesFromAll || this.options.getExtremesFromAll || this.cropped || ((xData[i + 1] || x) >= xMin && (xData[i - 1] || x) <= xMax); if (validValue && withinRange) { j = y.length; if (j) { // array, like ohlc or range data while (j--) { if (y[j] !== null) { activeYData[activeCounter++] = y[j]; } } } else { activeYData[activeCounter++] = y; } } } this.dataMin = arrayMin(activeYData); this.dataMax = arrayMax(activeYData); }, /** * Translate data points from raw data values to chart specific positioning data * needed later in drawPoints, drawGraph and drawTracker. */ translate: function () { if (!this.processedXData) { // hidden series this.processData(); } this.generatePoints(); var series = this, options = series.options, stacking = options.stacking, xAxis = series.xAxis, categories = xAxis.categories, yAxis = series.yAxis, points = series.points, dataLength = points.length, hasModifyValue = !!series.modifyValue, i, pointPlacement = options.pointPlacement, dynamicallyPlaced = pointPlacement === 'between' || isNumber(pointPlacement), threshold = options.threshold, stackThreshold = options.startFromThreshold ? threshold : 0, plotX, plotY, lastPlotX, stackIndicator, closestPointRangePx = Number.MAX_VALUE; // Translate each point for (i = 0; i < dataLength; i++) { var point = points[i], xValue = point.x, yValue = point.y, yBottom = point.low, stack = stacking && yAxis.stacks[(series.negStacks && yValue < (stackThreshold ? 0 : threshold) ? '-' : '') + series.stackKey], pointStack, stackValues; // Discard disallowed y values for log axes (#3434) if (yAxis.isLog && yValue !== null && yValue <= 0) { point.y = yValue = null; error(10); } // Get the plotX translation point.plotX = plotX = mathMin(mathMax(-1e5, xAxis.translate(xValue, 0, 0, 0, 1, pointPlacement, this.type === 'flags')), 1e5); // #3923 // Calculate the bottom y value for stacked series if (stacking && series.visible && !point.isNull && stack && stack[xValue]) { stackIndicator = series.getStackIndicator(stackIndicator, xValue, series.index); pointStack = stack[xValue]; stackValues = pointStack.points[stackIndicator.key]; yBottom = stackValues[0]; yValue = stackValues[1]; if (yBottom === stackThreshold) { yBottom = pick(threshold, yAxis.min); } if (yAxis.isLog && yBottom <= 0) { // #1200, #1232 yBottom = null; } point.total = point.stackTotal = pointStack.total; point.percentage = pointStack.total && (point.y / pointStack.total * 100); point.stackY = yValue; // Place the stack label pointStack.setOffset(series.pointXOffset || 0, series.barW || 0); } // Set translated yBottom or remove it point.yBottom = defined(yBottom) ? yAxis.translate(yBottom, 0, 1, 0, 1) : null; // general hook, used for Highstock compare mode if (hasModifyValue) { yValue = series.modifyValue(yValue, point); } // Set the the plotY value, reset it for redraws point.plotY = plotY = (typeof yValue === 'number' && yValue !== Infinity) ? mathMin(mathMax(-1e5, yAxis.translate(yValue, 0, 1, 0, 1)), 1e5) : // #3201 UNDEFINED; point.isInside = plotY !== UNDEFINED && plotY >= 0 && plotY <= yAxis.len && // #3519 plotX >= 0 && plotX <= xAxis.len; // Set client related positions for mouse tracking point.clientX = dynamicallyPlaced ? xAxis.translate(xValue, 0, 0, 0, 1) : plotX; // #1514 point.negative = point.y < (threshold || 0); // some API data point.category = categories && categories[point.x] !== UNDEFINED ? categories[point.x] : point.x; // Determine auto enabling of markers (#3635) if (i) { closestPointRangePx = mathMin(closestPointRangePx, mathAbs(plotX - lastPlotX)); } lastPlotX = plotX; } series.closestPointRangePx = closestPointRangePx; }, /** * Return the series points with null points filtered out */ getValidPoints: function () { return grep(this.points, function (point) { return !point.isNull; }); }, /** * Set the clipping for the series. For animated series it is called twice, first to initiate * animating the clip then the second time without the animation to set the final clip. */ setClip: function (animation) { var chart = this.chart, options = this.options, renderer = chart.renderer, inverted = chart.inverted, seriesClipBox = this.clipBox, clipBox = seriesClipBox || chart.clipBox, sharedClipKey = this.sharedClipKey || ['_sharedClip', animation && animation.duration, animation && animation.easing, clipBox.height, options.xAxis, options.yAxis].join(','), // #4526 clipRect = chart[sharedClipKey], markerClipRect = chart[sharedClipKey + 'm']; // If a clipping rectangle with the same properties is currently present in the chart, use that. if (!clipRect) { // When animation is set, prepare the initial positions if (animation) { clipBox.width = 0; chart[sharedClipKey + 'm'] = markerClipRect = renderer.clipRect( -99, // include the width of the first marker inverted ? -chart.plotLeft : -chart.plotTop, 99, inverted ? chart.chartWidth : chart.chartHeight ); } chart[sharedClipKey] = clipRect = renderer.clipRect(clipBox); } if (animation) { clipRect.count += 1; } if (options.clip !== false) { this.group.clip(animation || seriesClipBox ? clipRect : chart.clipRect); this.markerGroup.clip(markerClipRect); this.sharedClipKey = sharedClipKey; } // Remove the shared clipping rectangle when all series are shown if (!animation) { clipRect.count -= 1; if (clipRect.count <= 0 && sharedClipKey && chart[sharedClipKey]) { if (!seriesClipBox) { chart[sharedClipKey] = chart[sharedClipKey].destroy(); } if (chart[sharedClipKey + 'm']) { chart[sharedClipKey + 'm'] = chart[sharedClipKey + 'm'].destroy(); } } } }, /** * Animate in the series */ animate: function (init) { var series = this, chart = series.chart, clipRect, animation = series.options.animation, sharedClipKey; // Animation option is set to true if (animation && !isObject(animation)) { animation = defaultPlotOptions[series.type].animation; } // Initialize the animation. Set up the clipping rectangle. if (init) { series.setClip(animation); // Run the animation } else { sharedClipKey = this.sharedClipKey; clipRect = chart[sharedClipKey]; if (clipRect) { clipRect.animate({ width: chart.plotSizeX }, animation); } if (chart[sharedClipKey + 'm']) { chart[sharedClipKey + 'm'].animate({ width: chart.plotSizeX + 99 }, animation); } // Delete this function to allow it only once series.animate = null; } }, /** * This runs after animation to land on the final plot clipping */ afterAnimate: function () { this.setClip(); fireEvent(this, 'afterAnimate'); }, /** * Draw the markers */ drawPoints: function () { var series = this, pointAttr, points = series.points, chart = series.chart, plotX, plotY, i, point, radius, symbol, isImage, graphic, options = series.options, seriesMarkerOptions = options.marker, seriesPointAttr = series.pointAttr[''], pointMarkerOptions, hasPointMarker, enabled, isInside, markerGroup = series.markerGroup, xAxis = series.xAxis, globallyEnabled = pick( seriesMarkerOptions.enabled, xAxis.isRadial, series.closestPointRangePx > 2 * seriesMarkerOptions.radius ); if (seriesMarkerOptions.enabled !== false || series._hasPointMarkers) { i = points.length; while (i--) { point = points[i]; plotX = mathFloor(point.plotX); // #1843 plotY = point.plotY; graphic = point.graphic; pointMarkerOptions = point.marker || {}; hasPointMarker = !!point.marker; enabled = (globallyEnabled && pointMarkerOptions.enabled === UNDEFINED) || pointMarkerOptions.enabled; isInside = point.isInside; // only draw the point if y is defined if (enabled && plotY !== UNDEFINED && !isNaN(plotY) && point.y !== null) { // shortcuts pointAttr = point.pointAttr[point.selected ? SELECT_STATE : NORMAL_STATE] || seriesPointAttr; radius = pointAttr.r; symbol = pick(pointMarkerOptions.symbol, series.symbol); isImage = symbol.indexOf('url') === 0; if (graphic) { // update graphic[isInside ? 'show' : 'hide'](true) // Since the marker group isn't clipped, each individual marker must be toggled .attr(pointAttr) // #4759 .animate(extend({ x: plotX - radius, y: plotY - radius }, graphic.symbolName ? { // don't apply to image symbols #507 width: 2 * radius, height: 2 * radius } : {})); } else if (isInside && (radius > 0 || isImage)) { point.graphic = graphic = chart.renderer.symbol( symbol, plotX - radius, plotY - radius, 2 * radius, 2 * radius, hasPointMarker ? pointMarkerOptions : seriesMarkerOptions ) .attr(pointAttr) .add(markerGroup); } } else if (graphic) { point.graphic = graphic.destroy(); // #1269 } } } }, /** * Convert state properties from API naming conventions to SVG attributes * * @param {Object} options API options object * @param {Object} base1 SVG attribute object to inherit from * @param {Object} base2 Second level SVG attribute object to inherit from */ convertAttribs: function (options, base1, base2, base3) { var conversion = this.pointAttrToOptions, attr, option, obj = {}; options = options || {}; base1 = base1 || {}; base2 = base2 || {}; base3 = base3 || {}; for (attr in conversion) { option = conversion[attr]; obj[attr] = pick(options[option], base1[attr], base2[attr], base3[attr]); } return obj; }, /** * Get the state attributes. Each series type has its own set of attributes * that are allowed to change on a point's state change. Series wide attributes are stored for * all series, and additionally point specific attributes are stored for all * points with individual marker options. If such options are not defined for the point, * a reference to the series wide attributes is stored in point.pointAttr. */ getAttribs: function () { var series = this, seriesOptions = series.options, normalOptions = defaultPlotOptions[series.type].marker ? seriesOptions.marker : seriesOptions, stateOptions = normalOptions.states, stateOptionsHover = stateOptions[HOVER_STATE], pointStateOptionsHover, seriesColor = series.color, seriesNegativeColor = series.options.negativeColor, normalDefaults = { stroke: seriesColor, fill: seriesColor }, points = series.points || [], // #927 i, j, threshold, point, seriesPointAttr = [], pointAttr, pointAttrToOptions = series.pointAttrToOptions, hasPointSpecificOptions = series.hasPointSpecificOptions, defaultLineColor = normalOptions.lineColor, defaultFillColor = normalOptions.fillColor, turboThreshold = seriesOptions.turboThreshold, zones = series.zones, zoneAxis = series.zoneAxis || 'y', attr, key; // series type specific modifications if (seriesOptions.marker) { // line, spline, area, areaspline, scatter // if no hover radius is given, default to normal radius + 2 stateOptionsHover.radius = stateOptionsHover.radius || normalOptions.radius + stateOptionsHover.radiusPlus; stateOptionsHover.lineWidth = stateOptionsHover.lineWidth || normalOptions.lineWidth + stateOptionsHover.lineWidthPlus; } else { // column, bar, pie // if no hover color is given, brighten the normal color stateOptionsHover.color = stateOptionsHover.color || Color(stateOptionsHover.color || seriesColor) .brighten(stateOptionsHover.brightness).get(); // if no hover negativeColor is given, brighten the normal negativeColor stateOptionsHover.negativeColor = stateOptionsHover.negativeColor || Color(stateOptionsHover.negativeColor || seriesNegativeColor) .brighten(stateOptionsHover.brightness).get(); } // general point attributes for the series normal state seriesPointAttr[NORMAL_STATE] = series.convertAttribs(normalOptions, normalDefaults); // HOVER_STATE and SELECT_STATE states inherit from normal state except the default radius each([HOVER_STATE, SELECT_STATE], function (state) { seriesPointAttr[state] = series.convertAttribs(stateOptions[state], seriesPointAttr[NORMAL_STATE]); }); // set it series.pointAttr = seriesPointAttr; // Generate the point-specific attribute collections if specific point // options are given. If not, create a referance to the series wide point // attributes i = points.length; if (!turboThreshold || i < turboThreshold || hasPointSpecificOptions) { while (i--) { point = points[i]; normalOptions = (point.options && point.options.marker) || point.options; if (normalOptions && normalOptions.enabled === false) { normalOptions.radius = 0; } if (zones.length) { j = 0; threshold = zones[j]; while (point[zoneAxis] >= threshold.value) { threshold = zones[++j]; } point.color = point.fillColor = pick(threshold.color, series.color); // #3636, #4267, #4430 - inherit color from series, when color is undefined } hasPointSpecificOptions = seriesOptions.colorByPoint || point.color; // #868 // check if the point has specific visual options if (point.options) { for (key in pointAttrToOptions) { if (defined(normalOptions[pointAttrToOptions[key]])) { hasPointSpecificOptions = true; } } } // a specific marker config object is defined for the individual point: // create it's own attribute collection if (hasPointSpecificOptions) { normalOptions = normalOptions || {}; pointAttr = []; stateOptions = normalOptions.states || {}; // reassign for individual point pointStateOptionsHover = stateOptions[HOVER_STATE] = stateOptions[HOVER_STATE] || {}; // Handle colors for column and pies if (!seriesOptions.marker || (point.negative && !pointStateOptionsHover.fillColor && !stateOptionsHover.fillColor)) { // column, bar, point or negative threshold for series with markers (#3636) // If no hover color is given, brighten the normal color. #1619, #2579 pointStateOptionsHover[series.pointAttrToOptions.fill] = pointStateOptionsHover.color || (!point.options.color && stateOptionsHover[(point.negative && seriesNegativeColor ? 'negativeColor' : 'color')]) || Color(point.color) .brighten(pointStateOptionsHover.brightness || stateOptionsHover.brightness) .get(); } // normal point state inherits series wide normal state attr = { color: point.color }; // #868 if (!defaultFillColor) { // Individual point color or negative color markers (#2219) attr.fillColor = point.color; } if (!defaultLineColor) { attr.lineColor = point.color; // Bubbles take point color, line markers use white } // Color is explicitly set to null or undefined (#1288, #4068) if (normalOptions.hasOwnProperty('color') && !normalOptions.color) { delete normalOptions.color; } pointAttr[NORMAL_STATE] = series.convertAttribs(extend(attr, normalOptions), seriesPointAttr[NORMAL_STATE]); // inherit from point normal and series hover pointAttr[HOVER_STATE] = series.convertAttribs( stateOptions[HOVER_STATE], seriesPointAttr[HOVER_STATE], pointAttr[NORMAL_STATE] ); // inherit from point normal and series hover pointAttr[SELECT_STATE] = series.convertAttribs( stateOptions[SELECT_STATE], seriesPointAttr[SELECT_STATE], pointAttr[NORMAL_STATE] ); // no marker config object is created: copy a reference to the series-wide // attribute collection } else { pointAttr = seriesPointAttr; } point.pointAttr = pointAttr; } } }, /** * Clear DOM objects and free up memory */ destroy: function () { var series = this, chart = series.chart, issue134 = /AppleWebKit\/533/.test(userAgent), destroy, i, data = series.data || [], point, prop, axis; // add event hook fireEvent(series, 'destroy'); // remove all events removeEvent(series); // erase from axes each(series.axisTypes || [], function (AXIS) { axis = series[AXIS]; if (axis) { erase(axis.series, series); axis.isDirty = axis.forceRedraw = true; } }); // remove legend items if (series.legendItem) { series.chart.legend.destroyItem(series); } // destroy all points with their elements i = data.length; while (i--) { point = data[i]; if (point && point.destroy) { point.destroy(); } } series.points = null; // Clear the animation timeout if we are destroying the series during initial animation clearTimeout(series.animationTimeout); // Destroy all SVGElements associated to the series for (prop in series) { if (series[prop] instanceof SVGElement && !series[prop].survive) { // Survive provides a hook for not destroying // issue 134 workaround destroy = issue134 && prop === 'group' ? 'hide' : 'destroy'; series[prop][destroy](); } } // remove from hoverSeries if (chart.hoverSeries === series) { chart.hoverSeries = null; } erase(chart.series, series); // clear all members for (prop in series) { delete series[prop]; } }, /** * Get the graph path */ getGraphPath: function (points, nullsAsZeroes, connectCliffs) { var series = this, options = series.options, step = options.step, graphPath = [], gap; points = points || series.points; // Build the line each(points, function (point, i) { var plotX = point.plotX, plotY = point.plotY, lastPoint = points[i - 1], pathToPoint; // the path to this point from the previous if ((point.leftCliff || (lastPoint && lastPoint.rightCliff)) && !connectCliffs) { gap = true; // ... and continue } // Line series, nullsAsZeroes is not handled if (point.isNull && !defined(nullsAsZeroes) && i > 0) { gap = !options.connectNulls; // Area series, nullsAsZeroes is set } else if (point.isNull && !nullsAsZeroes) { gap = true; } else { if (i === 0 || gap) { pathToPoint = [M, point.plotX, point.plotY]; } else if (series.getPointSpline) { // generate the spline as defined in the SplineSeries object pathToPoint = series.getPointSpline(points, point, i); } else if (step) { if (step === 'right') { pathToPoint = [ L, lastPoint.plotX, plotY ]; } else if (step === 'center') { pathToPoint = [ L, (lastPoint.plotX + plotX) / 2, lastPoint.plotY, L, (lastPoint.plotX + plotX) / 2, plotY ]; } else { pathToPoint = [ L, plotX, lastPoint.plotY ]; } pathToPoint.push(L, plotX, plotY); } else { // normal line to next point pathToPoint = [ L, plotX, plotY ]; } graphPath.push.apply(graphPath, pathToPoint); gap = false; } }); series.graphPath = graphPath; return graphPath; }, /** * Draw the actual graph */ drawGraph: function () { var series = this, options = this.options, props = [['graph', options.lineColor || this.color, options.dashStyle]], lineWidth = options.lineWidth, roundCap = options.linecap !== 'square', graphPath = (this.gappedPath || this.getGraphPath).call(this), fillColor = (this.fillGraph && this.color) || NONE, // polygon series use filled graph zones = this.zones; each(zones, function (threshold, i) { props.push(['zoneGraph' + i, threshold.color || series.color, threshold.dashStyle || options.dashStyle]); }); // Draw the graph each(props, function (prop, i) { var graphKey = prop[0], graph = series[graphKey], attribs; if (graph) { graph.animate({ d: graphPath }); } else if ((lineWidth || fillColor) && graphPath.length) { // #1487 attribs = { stroke: prop[1], 'stroke-width': lineWidth, fill: fillColor, zIndex: 1 // #1069 }; if (prop[2]) { attribs.dashstyle = prop[2]; } else if (roundCap) { attribs['stroke-linecap'] = attribs['stroke-linejoin'] = 'round'; } series[graphKey] = series.chart.renderer.path(graphPath) .attr(attribs) .add(series.group) .shadow((i < 2) && options.shadow); // add shadow to normal series (0) or to first zone (1) #3932 } }); }, /** * Clip the graphs into the positive and negative coloured graphs */ applyZones: function () { var series = this, chart = this.chart, renderer = chart.renderer, zones = this.zones, translatedFrom, translatedTo, clips = this.clips || [], clipAttr, graph = this.graph, area = this.area, chartSizeMax = mathMax(chart.chartWidth, chart.chartHeight), axis = this[(this.zoneAxis || 'y') + 'Axis'], extremes, reversed = axis.reversed, inverted = chart.inverted, horiz = axis.horiz, pxRange, pxPosMin, pxPosMax, ignoreZones = false; if (zones.length && (graph || area) && axis.min !== UNDEFINED) { // The use of the Color Threshold assumes there are no gaps // so it is safe to hide the original graph and area if (graph) { graph.hide(); } if (area) { area.hide(); } // Create the clips extremes = axis.getExtremes(); each(zones, function (threshold, i) { translatedFrom = reversed ? (horiz ? chart.plotWidth : 0) : (horiz ? 0 : axis.toPixels(extremes.min)); translatedFrom = mathMin(mathMax(pick(translatedTo, translatedFrom), 0), chartSizeMax); translatedTo = mathMin(mathMax(mathRound(axis.toPixels(pick(threshold.value, extremes.max), true)), 0), chartSizeMax); if (ignoreZones) { translatedFrom = translatedTo = axis.toPixels(extremes.max); } pxRange = Math.abs(translatedFrom - translatedTo); pxPosMin = mathMin(translatedFrom, translatedTo); pxPosMax = mathMax(translatedFrom, translatedTo); if (axis.isXAxis) { clipAttr = { x: inverted ? pxPosMax : pxPosMin, y: 0, width: pxRange, height: chartSizeMax }; if (!horiz) { clipAttr.x = chart.plotHeight - clipAttr.x; } } else { clipAttr = { x: 0, y: inverted ? pxPosMax : pxPosMin, width: chartSizeMax, height: pxRange }; if (horiz) { clipAttr.y = chart.plotWidth - clipAttr.y; } } /// VML SUPPPORT if (chart.inverted && renderer.isVML) { if (axis.isXAxis) { clipAttr = { x: 0, y: reversed ? pxPosMin : pxPosMax, height: clipAttr.width, width: chart.chartWidth }; } else { clipAttr = { x: clipAttr.y - chart.plotLeft - chart.spacingBox.x, y: 0, width: clipAttr.height, height: chart.chartHeight }; } } /// END OF VML SUPPORT if (clips[i]) { clips[i].animate(clipAttr); } else { clips[i] = renderer.clipRect(clipAttr); if (graph) { series['zoneGraph' + i].clip(clips[i]); } if (area) { series['zoneArea' + i].clip(clips[i]); } } // if this zone extends out of the axis, ignore the others ignoreZones = threshold.value > extremes.max; }); this.clips = clips; } }, /** * Initialize and perform group inversion on series.group and series.markerGroup */ invertGroups: function () { var series = this, chart = series.chart; // Pie, go away (#1736) if (!series.xAxis) { return; } // A fixed size is needed for inversion to work function setInvert() { var size = { width: series.yAxis.len, height: series.xAxis.len }; each(['group', 'markerGroup'], function (groupName) { if (series[groupName]) { series[groupName].attr(size).invert(); } }); } addEvent(chart, 'resize', setInvert); // do it on resize addEvent(series, 'destroy', function () { removeEvent(chart, 'resize', setInvert); }); // Do it now setInvert(); // do it now // On subsequent render and redraw, just do setInvert without setting up events again series.invertGroups = setInvert; }, /** * General abstraction for creating plot groups like series.group, series.dataLabelsGroup and * series.markerGroup. On subsequent calls, the group will only be adjusted to the updated plot size. */ plotGroup: function (prop, name, visibility, zIndex, parent) { var group = this[prop], isNew = !group; // Generate it on first call if (isNew) { this[prop] = group = this.chart.renderer.g(name) .attr({ zIndex: zIndex || 0.1 // IE8 needs this }) .add(parent); group.addClass('highcharts-series-' + this.index); } // Place it on first and subsequent (redraw) calls group.attr({ visibility: visibility })[isNew ? 'attr' : 'animate'](this.getPlotBox()); return group; }, /** * Get the translation and scale for the plot area of this series */ getPlotBox: function () { var chart = this.chart, xAxis = this.xAxis, yAxis = this.yAxis; // Swap axes for inverted (#2339) if (chart.inverted) { xAxis = yAxis; yAxis = this.xAxis; } return { translateX: xAxis ? xAxis.left : chart.plotLeft, translateY: yAxis ? yAxis.top : chart.plotTop, scaleX: 1, // #1623 scaleY: 1 }; }, /** * Render the graph and markers */ render: function () { var series = this, chart = series.chart, group, options = series.options, animation = options.animation, // Animation doesn't work in IE8 quirks when the group div is hidden, // and looks bad in other oldIE animDuration = (animation && !!series.animate && chart.renderer.isSVG && pick(animation.duration, 500)) || 0, visibility = series.visible ? 'inherit' : 'hidden', // #2597 zIndex = options.zIndex, hasRendered = series.hasRendered, chartSeriesGroup = chart.seriesGroup; // the group group = series.plotGroup( 'group', 'series', visibility, zIndex, chartSeriesGroup ); series.markerGroup = series.plotGroup( 'markerGroup', 'markers', visibility, zIndex, chartSeriesGroup ); // initiate the animation if (animDuration) { series.animate(true); } // cache attributes for shapes series.getAttribs(); // SVGRenderer needs to know this before drawing elements (#1089, #1795) group.inverted = series.isCartesian ? chart.inverted : false; // draw the graph if any if (series.drawGraph) { series.drawGraph(); series.applyZones(); } each(series.points, function (point) { if (point.redraw) { point.redraw(); } }); // draw the data labels (inn pies they go before the points) if (series.drawDataLabels) { series.drawDataLabels(); } // draw the points if (series.visible) { series.drawPoints(); } // draw the mouse tracking area if (series.drawTracker && series.options.enableMouseTracking !== false) { series.drawTracker(); } // Handle inverted series and tracker groups if (chart.inverted) { series.invertGroups(); } // Initial clipping, must be defined after inverting groups for VML. Applies to columns etc. (#3839). if (options.clip !== false && !series.sharedClipKey && !hasRendered) { group.clip(chart.clipRect); } // Run the animation if (animDuration) { series.animate(); } // Call the afterAnimate function on animation complete (but don't overwrite the animation.complete option // which should be available to the user). if (!hasRendered) { series.animationTimeout = syncTimeout(function () { series.afterAnimate(); }, animDuration); } series.isDirty = series.isDirtyData = false; // means data is in accordance with what you see // (See #322) series.isDirty = series.isDirtyData = false; // means data is in accordance with what you see series.hasRendered = true; }, /** * Redraw the series after an update in the axes. */ redraw: function () { var series = this, chart = series.chart, wasDirtyData = series.isDirtyData, // cache it here as it is set to false in render, but used after wasDirty = series.isDirty, group = series.group, xAxis = series.xAxis, yAxis = series.yAxis; // reposition on resize if (group) { if (chart.inverted) { group.attr({ width: chart.plotWidth, height: chart.plotHeight }); } group.animate({ translateX: pick(xAxis && xAxis.left, chart.plotLeft), translateY: pick(yAxis && yAxis.top, chart.plotTop) }); } series.translate(); series.render(); if (wasDirtyData) { fireEvent(series, 'updatedData'); } if (wasDirty || wasDirtyData) { // #3945 recalculate the kdtree when dirty delete this.kdTree; // #3868 recalculate the kdtree with dirty data } }, /** * KD Tree && PointSearching Implementation */ kdDimensions: 1, kdAxisArray: ['clientX', 'plotY'], searchPoint: function (e, compareX) { var series = this, xAxis = series.xAxis, yAxis = series.yAxis, inverted = series.chart.inverted; return this.searchKDTree({ clientX: inverted ? xAxis.len - e.chartY + xAxis.pos : e.chartX - xAxis.pos, plotY: inverted ? yAxis.len - e.chartX + yAxis.pos : e.chartY - yAxis.pos }, compareX); }, buildKDTree: function () { var series = this, dimensions = series.kdDimensions; // Internal function function _kdtree(points, depth, dimensions) { var axis, median, length = points && points.length; if (length) { // alternate between the axis axis = series.kdAxisArray[depth % dimensions]; // sort point array points.sort(function (a, b) { return a[axis] - b[axis]; }); median = Math.floor(length / 2); // build and return nod return { point: points[median], left: _kdtree(points.slice(0, median), depth + 1, dimensions), right: _kdtree(points.slice(median + 1), depth + 1, dimensions) }; } } // Start the recursive build process with a clone of the points array and null points filtered out (#3873) function startRecursive() { var points = grep(series.points || [], function (point) { // #4390 return point.y !== null; }); series.kdTree = _kdtree(points, dimensions, dimensions); } delete series.kdTree; // For testing tooltips, don't build async syncTimeout(startRecursive, series.options.kdNow ? 0 : 1); }, searchKDTree: function (point, compareX) { var series = this, kdX = this.kdAxisArray[0], kdY = this.kdAxisArray[1], kdComparer = compareX ? 'distX' : 'dist'; // Set the one and two dimensional distance on the point object function setDistance(p1, p2) { var x = (defined(p1[kdX]) && defined(p2[kdX])) ? Math.pow(p1[kdX] - p2[kdX], 2) : null, y = (defined(p1[kdY]) && defined(p2[kdY])) ? Math.pow(p1[kdY] - p2[kdY], 2) : null, r = (x || 0) + (y || 0); p2.dist = defined(r) ? Math.sqrt(r) : Number.MAX_VALUE; p2.distX = defined(x) ? Math.sqrt(x) : Number.MAX_VALUE; } function _search(search, tree, depth, dimensions) { var point = tree.point, axis = series.kdAxisArray[depth % dimensions], tdist, sideA, sideB, ret = point, nPoint1, nPoint2; setDistance(search, point); // Pick side based on distance to splitting point tdist = search[axis] - point[axis]; sideA = tdist < 0 ? 'left' : 'right'; sideB = tdist < 0 ? 'right' : 'left'; // End of tree if (tree[sideA]) { nPoint1 = _search(search, tree[sideA], depth + 1, dimensions); ret = (nPoint1[kdComparer] < ret[kdComparer] ? nPoint1 : point); } if (tree[sideB]) { // compare distance to current best to splitting point to decide wether to check side B or not if (Math.sqrt(tdist * tdist) < ret[kdComparer]) { nPoint2 = _search(search, tree[sideB], depth + 1, dimensions); ret = (nPoint2[kdComparer] < ret[kdComparer] ? nPoint2 : ret); } } return ret; } if (!this.kdTree) { this.buildKDTree(); } if (this.kdTree) { return _search(point, this.kdTree, this.kdDimensions, this.kdDimensions); } } }; // end Series prototype /** * The class for stack items */ function StackItem(axis, options, isNegative, x, stackOption) { var inverted = axis.chart.inverted; this.axis = axis; // Tells if the stack is negative this.isNegative = isNegative; // Save the options to be able to style the label this.options = options; // Save the x value to be able to position the label later this.x = x; // Initialize total value this.total = null; // This will keep each points' extremes stored by series.index and point index this.points = {}; // Save the stack option on the series configuration object, and whether to treat it as percent this.stack = stackOption; this.leftCliff = 0; this.rightCliff = 0; // The align options and text align varies on whether the stack is negative and // if the chart is inverted or not. // First test the user supplied value, then use the dynamic. this.alignOptions = { align: options.align || (inverted ? (isNegative ? 'left' : 'right') : 'center'), verticalAlign: options.verticalAlign || (inverted ? 'middle' : (isNegative ? 'bottom' : 'top')), y: pick(options.y, inverted ? 4 : (isNegative ? 14 : -6)), x: pick(options.x, inverted ? (isNegative ? -6 : 6) : 0) }; this.textAlign = options.textAlign || (inverted ? (isNegative ? 'right' : 'left') : 'center'); } StackItem.prototype = { destroy: function () { destroyObjectProperties(this, this.axis); }, /** * Renders the stack total label and adds it to the stack label group. */ render: function (group) { var options = this.options, formatOption = options.format, str = formatOption ? format(formatOption, this) : options.formatter.call(this); // format the text in the label // Change the text to reflect the new total and set visibility to hidden in case the serie is hidden if (this.label) { this.label.attr({ text: str, visibility: 'hidden' }); // Create new label } else { this.label = this.axis.chart.renderer.text(str, null, null, options.useHTML) // dummy positions, actual position updated with setOffset method in columnseries .css(options.style) // apply style .attr({ align: this.textAlign, // fix the text-anchor rotation: options.rotation, // rotation visibility: HIDDEN // hidden until setOffset is called }) .add(group); // add to the labels-group } }, /** * Sets the offset that the stack has from the x value and repositions the label. */ setOffset: function (xOffset, xWidth) { var stackItem = this, axis = stackItem.axis, chart = axis.chart, inverted = chart.inverted, reversed = axis.reversed, neg = (this.isNegative && !reversed) || (!this.isNegative && reversed), // #4056 y = axis.translate(axis.usePercentage ? 100 : this.total, 0, 0, 0, 1), // stack value translated mapped to chart coordinates yZero = axis.translate(0), // stack origin h = mathAbs(y - yZero), // stack height x = chart.xAxis[0].translate(this.x) + xOffset, // stack x position plotHeight = chart.plotHeight, stackBox = { // this is the box for the complete stack x: inverted ? (neg ? y : y - h) : x, y: inverted ? plotHeight - x - xWidth : (neg ? (plotHeight - y - h) : plotHeight - y), width: inverted ? h : xWidth, height: inverted ? xWidth : h }, label = this.label, alignAttr; if (label) { label.align(this.alignOptions, null, stackBox); // align the label to the box // Set visibility (#678) alignAttr = label.alignAttr; label[this.options.crop === false || chart.isInsidePlot(alignAttr.x, alignAttr.y) ? 'show' : 'hide'](true); } } }; /** * Generate stacks for each series and calculate stacks total values */ Chart.prototype.getStacks = function () { var chart = this; // reset stacks for each yAxis each(chart.yAxis, function (axis) { if (axis.stacks && axis.hasVisibleSeries) { axis.oldStacks = axis.stacks; } }); each(chart.series, function (series) { if (series.options.stacking && (series.visible === true || chart.options.chart.ignoreHiddenSeries === false)) { series.stackKey = series.type + pick(series.options.stack, ''); } }); }; // Stacking methods defined on the Axis prototype /** * Build the stacks from top down */ Axis.prototype.buildStacks = function () { var axisSeries = this.series, series, reversedStacks = pick(this.options.reversedStacks, true), len = axisSeries.length, i; if (!this.isXAxis) { this.usePercentage = false; i = len; while (i--) { axisSeries[reversedStacks ? i : len - i - 1].setStackedPoints(); } i = len; while (i--) { series = axisSeries[reversedStacks ? i : len - i - 1]; if (series.setStackCliffs) { series.setStackCliffs(); } } // Loop up again to compute percent stack if (this.usePercentage) { for (i = 0; i < len; i++) { axisSeries[i].setPercentStacks(); } } } }; Axis.prototype.renderStackTotals = function () { var axis = this, chart = axis.chart, renderer = chart.renderer, stacks = axis.stacks, stackKey, oneStack, stackCategory, stackTotalGroup = axis.stackTotalGroup; // Create a separate group for the stack total labels if (!stackTotalGroup) { axis.stackTotalGroup = stackTotalGroup = renderer.g('stack-labels') .attr({ visibility: VISIBLE, zIndex: 6 }) .add(); } // plotLeft/Top will change when y axis gets wider so we need to translate the // stackTotalGroup at every render call. See bug #506 and #516 stackTotalGroup.translate(chart.plotLeft, chart.plotTop); // Render each stack total for (stackKey in stacks) { oneStack = stacks[stackKey]; for (stackCategory in oneStack) { oneStack[stackCategory].render(stackTotalGroup); } } }; /** * Set all the stacks to initial states and destroy unused ones. */ Axis.prototype.resetStacks = function () { var stacks = this.stacks, type, i; if (!this.isXAxis) { for (type in stacks) { for (i in stacks[type]) { // Clean up memory after point deletion (#1044, #4320) if (stacks[type][i].touched < this.stacksTouched) { stacks[type][i].destroy(); delete stacks[type][i]; // Reset stacks } else { stacks[type][i].total = null; stacks[type][i].cum = 0; } } } } }; Axis.prototype.cleanStacks = function () { var stacks, type, i; if (!this.isXAxis) { if (this.oldStacks) { stacks = this.stacks = this.oldStacks; } // reset stacks for (type in stacks) { for (i in stacks[type]) { stacks[type][i].cum = stacks[type][i].total; } } } }; // Stacking methods defnied for Series prototype /** * Adds series' points value to corresponding stack */ Series.prototype.setStackedPoints = function () { if (!this.options.stacking || (this.visible !== true && this.chart.options.chart.ignoreHiddenSeries !== false)) { return; } var series = this, xData = series.processedXData, yData = series.processedYData, stackedYData = [], yDataLength = yData.length, seriesOptions = series.options, threshold = seriesOptions.threshold, stackThreshold = seriesOptions.startFromThreshold ? threshold : 0, stackOption = seriesOptions.stack, stacking = seriesOptions.stacking, stackKey = series.stackKey, negKey = '-' + stackKey, negStacks = series.negStacks, yAxis = series.yAxis, stacks = yAxis.stacks, oldStacks = yAxis.oldStacks, stackIndicator, isNegative, stack, other, key, pointKey, i, x, y; yAxis.stacksTouched += 1; // loop over the non-null y values and read them into a local array for (i = 0; i < yDataLength; i++) { x = xData[i]; y = yData[i]; stackIndicator = series.getStackIndicator(stackIndicator, x, series.index); pointKey = stackIndicator.key; // Read stacked values into a stack based on the x value, // the sign of y and the stack key. Stacking is also handled for null values (#739) isNegative = negStacks && y < (stackThreshold ? 0 : threshold); key = isNegative ? negKey : stackKey; // Create empty object for this stack if it doesn't exist yet if (!stacks[key]) { stacks[key] = {}; } // Initialize StackItem for this x if (!stacks[key][x]) { if (oldStacks[key] && oldStacks[key][x]) { stacks[key][x] = oldStacks[key][x]; stacks[key][x].total = null; } else { stacks[key][x] = new StackItem(yAxis, yAxis.options.stackLabels, isNegative, x, stackOption); } } // If the StackItem doesn't exist, create it first stack = stacks[key][x]; if (y !== null) { stack.points[pointKey] = stack.points[series.index] = [pick(stack.cum, stackThreshold)]; stack.touched = yAxis.stacksTouched; // In area charts, if there are multiple points on the same X value, let the // area fill the full span of those points if (stackIndicator.index > 0 && series.singleStacks === false) { stack.points[pointKey][0] = stack.points[series.index + ',' + x + ',0'][0]; } } // Add value to the stack total if (stacking === 'percent') { // Percent stacked column, totals are the same for the positive and negative stacks other = isNegative ? stackKey : negKey; if (negStacks && stacks[other] && stacks[other][x]) { other = stacks[other][x]; stack.total = other.total = mathMax(other.total, stack.total) + mathAbs(y) || 0; // Percent stacked areas } else { stack.total = correctFloat(stack.total + (mathAbs(y) || 0)); } } else { stack.total = correctFloat(stack.total + (y || 0)); } stack.cum = pick(stack.cum, stackThreshold) + (y || 0); if (y !== null) { stack.points[pointKey].push(stack.cum); } stackedYData[i] = stack.cum; } if (stacking === 'percent') { yAxis.usePercentage = true; } this.stackedYData = stackedYData; // To be used in getExtremes // Reset old stacks yAxis.oldStacks = {}; }; /** * Iterate over all stacks and compute the absolute values to percent */ Series.prototype.setPercentStacks = function () { var series = this, stackKey = series.stackKey, stacks = series.yAxis.stacks, processedXData = series.processedXData, stackIndicator; each([stackKey, '-' + stackKey], function (key) { var i = processedXData.length, x, stack, pointExtremes, totalFactor; while (i--) { x = processedXData[i]; stackIndicator = series.getStackIndicator(stackIndicator, x, series.index); stack = stacks[key] && stacks[key][x]; pointExtremes = stack && stack.points[stackIndicator.key]; if (pointExtremes) { totalFactor = stack.total ? 100 / stack.total : 0; pointExtremes[0] = correctFloat(pointExtremes[0] * totalFactor); // Y bottom value pointExtremes[1] = correctFloat(pointExtremes[1] * totalFactor); // Y value series.stackedYData[i] = pointExtremes[1]; } } }); }; /** * Get stack indicator, according to it's x-value, to determine points with the same x-value */ Series.prototype.getStackIndicator = function (stackIndicator, x, index) { if (!defined(stackIndicator) || stackIndicator.x !== x) { stackIndicator = { x: x, index: 0 }; } else { stackIndicator.index++; } stackIndicator.key = [index, x, stackIndicator.index].join(','); return stackIndicator; }; // Extend the Chart prototype for dynamic methods extend(Chart.prototype, { /** * Add a series dynamically after time * * @param {Object} options The config options * @param {Boolean} redraw Whether to redraw the chart after adding. Defaults to true. * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration * * @return {Object} series The newly created series object */ addSeries: function (options, redraw, animation) { var series, chart = this; if (options) { redraw = pick(redraw, true); // defaults to true fireEvent(chart, 'addSeries', { options: options }, function () { series = chart.initSeries(options); chart.isDirtyLegend = true; // the series array is out of sync with the display chart.linkSeries(); if (redraw) { chart.redraw(animation); } }); } return series; }, /** * Add an axis to the chart * @param {Object} options The axis option * @param {Boolean} isX Whether it is an X axis or a value axis */ addAxis: function (options, isX, redraw, animation) { var key = isX ? 'xAxis' : 'yAxis', chartOptions = this.options; new Axis(this, merge(options, { // eslint-disable-line no-new index: this[key].length, isX: isX })); // Push the new axis options to the chart options chartOptions[key] = splat(chartOptions[key] || {}); chartOptions[key].push(options); if (pick(redraw, true)) { this.redraw(animation); } }, /** * Dim the chart and show a loading text or symbol * @param {String} str An optional text to show in the loading label instead of the default one */ showLoading: function (str) { var chart = this, options = chart.options, loadingDiv = chart.loadingDiv, loadingOptions = options.loading, setLoadingSize = function () { if (loadingDiv) { css(loadingDiv, { left: chart.plotLeft + PX, top: chart.plotTop + PX, width: chart.plotWidth + PX, height: chart.plotHeight + PX }); } }; // create the layer at the first call if (!loadingDiv) { chart.loadingDiv = loadingDiv = createElement(DIV, { className: PREFIX + 'loading' }, extend(loadingOptions.style, { zIndex: 10, display: NONE }), chart.container); chart.loadingSpan = createElement( 'span', null, loadingOptions.labelStyle, loadingDiv ); addEvent(chart, 'redraw', setLoadingSize); // #1080 } // update text chart.loadingSpan.innerHTML = str || options.lang.loading; // show it if (!chart.loadingShown) { css(loadingDiv, { opacity: 0, display: '' }); animate(loadingDiv, { opacity: loadingOptions.style.opacity }, { duration: loadingOptions.showDuration || 0 }); chart.loadingShown = true; } setLoadingSize(); }, /** * Hide the loading layer */ hideLoading: function () { var options = this.options, loadingDiv = this.loadingDiv; if (loadingDiv) { animate(loadingDiv, { opacity: 0 }, { duration: options.loading.hideDuration || 100, complete: function () { css(loadingDiv, { display: NONE }); } }); } this.loadingShown = false; } }); // extend the Point prototype for dynamic methods extend(Point.prototype, { /** * Update the point with new options (typically x/y data) and optionally redraw the series. * * @param {Object} options Point options as defined in the series.data array * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration * */ update: function (options, redraw, animation, runEvent) { var point = this, series = point.series, graphic = point.graphic, i, chart = series.chart, seriesOptions = series.options, names = series.xAxis && series.xAxis.names; redraw = pick(redraw, true); function update() { point.applyOptions(options); // Update visuals if (point.y === null && graphic) { // #4146 point.graphic = graphic.destroy(); } if (isObject(options) && !isArray(options)) { // Defer the actual redraw until getAttribs has been called (#3260) point.redraw = function () { if (graphic && graphic.element) { if (options && options.marker && options.marker.symbol) { point.graphic = graphic.destroy(); } } if (options && options.dataLabels && point.dataLabel) { // #2468 point.dataLabel = point.dataLabel.destroy(); } point.redraw = null; }; } // record changes in the parallel arrays i = point.index; series.updateParallelArrays(point, i); if (names && point.name) { names[point.x] = point.name; } // Record the options to options.data. If there is an object from before, // use point options, otherwise use raw options. (#4701) seriesOptions.data[i] = isObject(seriesOptions.data[i]) ? point.options : options; // redraw series.isDirty = series.isDirtyData = true; if (!series.fixedBox && series.hasCartesianSeries) { // #1906, #2320 chart.isDirtyBox = true; } if (seriesOptions.legendType === 'point') { // #1831, #1885 chart.isDirtyLegend = true; } if (redraw) { chart.redraw(animation); } } // Fire the event with a default handler of doing the update if (runEvent === false) { // When called from setData update(); } else { point.firePointEvent('update', { options: options }, update); } }, /** * Remove a point and optionally redraw the series and if necessary the axes * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration */ remove: function (redraw, animation) { this.series.removePoint(inArray(this, this.series.data), redraw, animation); } }); // Extend the series prototype for dynamic methods extend(Series.prototype, { /** * Add a point dynamically after chart load time * @param {Object} options Point options as given in series.data * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call * @param {Boolean} shift If shift is true, a point is shifted off the start * of the series as one is appended to the end. * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration */ addPoint: function (options, redraw, shift, animation) { var series = this, seriesOptions = series.options, data = series.data, graph = series.graph, area = series.area, chart = series.chart, names = series.xAxis && series.xAxis.names, currentShift = (graph && graph.shift) || 0, shiftShapes = ['graph', 'area'], dataOptions = seriesOptions.data, point, isInTheMiddle, xData = series.xData, i, x; setAnimation(animation, chart); // Make graph animate sideways if (shift) { i = series.zones.length; while (i--) { shiftShapes.push('zoneGraph' + i, 'zoneArea' + i); } each(shiftShapes, function (shape) { if (series[shape]) { series[shape].shift = currentShift + (seriesOptions.step ? 2 : 1); } }); } if (area) { area.isArea = true; // needed in animation, both with and without shift } // Optional redraw, defaults to true redraw = pick(redraw, true); // Get options and push the point to xData, yData and series.options. In series.generatePoints // the Point instance will be created on demand and pushed to the series.data array. point = { series: series }; series.pointClass.prototype.applyOptions.apply(point, [options]); x = point.x; // Get the insertion point i = xData.length; if (series.requireSorting && x < xData[i - 1]) { isInTheMiddle = true; while (i && xData[i - 1] > x) { i--; } } series.updateParallelArrays(point, 'splice', i, 0, 0); // insert undefined item series.updateParallelArrays(point, i); // update it if (names && point.name) { names[x] = point.name; } dataOptions.splice(i, 0, options); if (isInTheMiddle) { series.data.splice(i, 0, null); series.processData(); } // Generate points to be added to the legend (#1329) if (seriesOptions.legendType === 'point') { series.generatePoints(); } // Shift the first point off the parallel arrays if (shift) { if (data[0] && data[0].remove) { data[0].remove(false); } else { data.shift(); series.updateParallelArrays(point, 'shift'); dataOptions.shift(); } } // redraw series.isDirty = true; series.isDirtyData = true; if (redraw) { series.getAttribs(); // #1937 chart.redraw(); } }, /** * Remove a point (rendered or not), by index */ removePoint: function (i, redraw, animation) { var series = this, data = series.data, point = data[i], points = series.points, chart = series.chart, remove = function () { if (points && points.length === data.length) { // #4935 points.splice(i, 1); } data.splice(i, 1); series.options.data.splice(i, 1); series.updateParallelArrays(point || { series: series }, 'splice', i, 1); if (point) { point.destroy(); } // redraw series.isDirty = true; series.isDirtyData = true; if (redraw) { chart.redraw(); } }; setAnimation(animation, chart); redraw = pick(redraw, true); // Fire the event with a default handler of removing the point if (point) { point.firePointEvent('remove', null, remove); } else { remove(); } }, /** * Remove a series and optionally redraw the chart * * @param {Boolean} redraw Whether to redraw the chart or wait for an explicit call * @param {Boolean|Object} animation Whether to apply animation, and optionally animation * configuration */ remove: function (redraw, animation) { var series = this, chart = series.chart; // Fire the event with a default handler of removing the point fireEvent(series, 'remove', null, function () { // Destroy elements series.destroy(); // Redraw chart.isDirtyLegend = chart.isDirtyBox = true; chart.linkSeries(); if (pick(redraw, true)) { chart.redraw(animation); } }); }, /** * Update the series with a new set of options */ update: function (newOptions, redraw) { var series = this, chart = this.chart, // must use user options when changing type because this.options is merged // in with type specific plotOptions oldOptions = this.userOptions, oldType = this.type, proto = seriesTypes[oldType].prototype, preserve = ['group', 'markerGroup', 'dataLabelsGroup'], n; // If we're changing type or zIndex, create new groups (#3380, #3404) if ((newOptions.type && newOptions.type !== oldType) || newOptions.zIndex !== undefined) { preserve.length = 0; } // Make sure groups are not destroyed (#3094) each(preserve, function (prop) { preserve[prop] = series[prop]; delete series[prop]; }); // Do the merge, with some forced options newOptions = merge(oldOptions, { animation: false, index: this.index, pointStart: this.xData[0] // when updating after addPoint }, { data: this.options.data }, newOptions); // Destroy the series and delete all properties. Reinsert all methods // and properties from the new type prototype (#2270, #3719) this.remove(false); for (n in proto) { this[n] = UNDEFINED; } extend(this, seriesTypes[newOptions.type || oldType].prototype); // Re-register groups (#3094) each(preserve, function (prop) { series[prop] = preserve[prop]; }); this.init(chart, newOptions); chart.linkSeries(); // Links are lost in this.remove (#3028) if (pick(redraw, true)) { chart.redraw(false); } } }); // Extend the Axis.prototype for dynamic methods extend(Axis.prototype, { /** * Update the axis with a new options structure */ update: function (newOptions, redraw) { var chart = this.chart; newOptions = chart.options[this.coll][this.options.index] = merge(this.userOptions, newOptions); this.destroy(true); this._addedPlotLB = this.chart._labelPanes = UNDEFINED; // #1611, #2887, #4314 this.init(chart, extend(newOptions, { events: UNDEFINED })); chart.isDirtyBox = true; if (pick(redraw, true)) { chart.redraw(); } }, /** * Remove the axis from the chart */ remove: function (redraw) { var chart = this.chart, key = this.coll, // xAxis or yAxis axisSeries = this.series, i = axisSeries.length; // Remove associated series (#2687) while (i--) { if (axisSeries[i]) { axisSeries[i].remove(false); } } // Remove the axis erase(chart.axes, this); erase(chart[key], this); chart.options[key].splice(this.options.index, 1); each(chart[key], function (axis, i) { // Re-index, #1706 axis.options.index = i; }); this.destroy(); chart.isDirtyBox = true; if (pick(redraw, true)) { chart.redraw(); } }, /** * Update the axis title by options */ setTitle: function (newTitleOptions, redraw) { this.update({ title: newTitleOptions }, redraw); }, /** * Set new axis categories and optionally redraw * @param {Array} categories * @param {Boolean} redraw */ setCategories: function (categories, redraw) { this.update({ categories: categories }, redraw); } }); /** * LineSeries object */ var LineSeries = extendClass(Series); seriesTypes.line = LineSeries; /** * Set the default options for area */ defaultPlotOptions.area = merge(defaultSeriesOptions, { softThreshold: false, threshold: 0 // trackByArea: false, // lineColor: null, // overrides color, but lets fillColor be unaltered // fillOpacity: 0.75, // fillColor: null }); /** * AreaSeries object */ var AreaSeries = extendClass(Series, { type: 'area', singleStacks: false, /** * Return an array of stacked points, where null and missing points are replaced by * dummy points in order for gaps to be drawn correctly in stacks. */ getStackPoints: function () { var series = this, segment = [], keys = [], xAxis = this.xAxis, yAxis = this.yAxis, stack = yAxis.stacks[this.stackKey], pointMap = {}, points = this.points, seriesIndex = series.index, yAxisSeries = yAxis.series, seriesLength = yAxisSeries.length, visibleSeries, upOrDown = pick(yAxis.options.reversedStacks, true) ? 1 : -1, i, x; if (this.options.stacking) { // Create a map where we can quickly look up the points by their X value. for (i = 0; i < points.length; i++) { pointMap[points[i].x] = points[i]; } // Sort the keys (#1651) for (x in stack) { if (stack[x].total !== null) { // nulled after switching between grouping and not (#1651, #2336) keys.push(+x); } } keys.sort(function (a, b) { return a - b; }); visibleSeries = map(yAxisSeries, function () { return this.visible; }); each(keys, function (x, idx) { var y = 0, stackPoint, stackedValues; if (pointMap[x] && !pointMap[x].isNull) { segment.push(pointMap[x]); // Find left and right cliff. -1 goes left, 1 goes right. each([-1, 1], function (direction) { var nullName = direction === 1 ? 'rightNull' : 'leftNull', cliffName = direction === 1 ? 'rightCliff' : 'leftCliff', cliff = 0, otherStack = stack[keys[idx + direction]]; // If there is a stack next to this one, to the left or to the right... if (otherStack) { i = seriesIndex; while (i >= 0 && i < seriesLength) { // Can go either up or down, depending on reversedStacks stackPoint = otherStack.points[i]; if (!stackPoint) { // If the next point in this series is missing, mark the point // with point.leftNull or point.rightNull = true. if (i === seriesIndex) { pointMap[x][nullName] = true; // If there are missing points in the next stack in any of the // series below this one, we need to substract the missing values // and add a hiatus to the left or right. } else if (visibleSeries[i]) { stackedValues = stack[x].points[i]; if (stackedValues) { cliff -= stackedValues[1] - stackedValues[0]; } } } // When reversedStacks is true, loop up, else loop down i += upOrDown; } } pointMap[x][cliffName] = cliff; }); // There is no point for this X value in this series, so we // insert a dummy point in order for the areas to be drawn // correctly. } else { // Loop down the stack to find the series below this one that has // a value (#1991) i = seriesIndex; while (i >= 0 && i < seriesLength) { stackPoint = stack[x].points[i]; if (stackPoint) { y = stackPoint[1]; break; } // When reversedStacks is true, loop up, else loop down i += upOrDown; } y = yAxis.toPixels(y, true); segment.push({ isNull: true, plotX: xAxis.toPixels(x, true), plotY: y, yBottom: y }); } }); } return segment; }, getGraphPath: function (points) { var getGraphPath = Series.prototype.getGraphPath, graphPath, options = this.options, stacking = options.stacking, yAxis = this.yAxis, topPath, //topPoints = [], bottomPath, bottomPoints = [], graphPoints = [], seriesIndex = this.index, i, areaPath, plotX, stacks = yAxis.stacks[this.stackKey], threshold = options.threshold, translatedThreshold = yAxis.getThreshold(options.threshold), isNull, yBottom, connectNulls = options.connectNulls || stacking === 'percent', /** * To display null points in underlying stacked series, this series graph must be * broken, and the area also fall down to fill the gap left by the null point. #2069 */ addDummyPoints = function (i, otherI, side) { var point = points[i], stackedValues = stacking && stacks[point.x].points[seriesIndex], nullVal = point[side + 'Null'] || 0, cliffVal = point[side + 'Cliff'] || 0, top, bottom, isNull = true; if (cliffVal || nullVal) { top = (nullVal ? stackedValues[0] : stackedValues[1]) + cliffVal; bottom = stackedValues[0] + cliffVal; isNull = !!nullVal; } else if (!stacking && points[otherI] && points[otherI].isNull) { top = bottom = threshold; } // Add to the top and bottom line of the area if (top !== undefined) { graphPoints.push({ plotX: plotX, plotY: top === null ? translatedThreshold : yAxis.toPixels(top, true), isNull: isNull }); bottomPoints.push({ plotX: plotX, plotY: bottom === null ? translatedThreshold : yAxis.toPixels(bottom, true) }); } }; // Find what points to use points = points || this.points; // Fill in missing points if (stacking) { points = this.getStackPoints(); } for (i = 0; i < points.length; i++) { isNull = points[i].isNull; plotX = pick(points[i].rectPlotX, points[i].plotX); yBottom = pick(points[i].yBottom, translatedThreshold); if (!isNull || connectNulls) { if (!connectNulls) { addDummyPoints(i, i - 1, 'left'); } if (!(isNull && !stacking && connectNulls)) { // Skip null point when stacking is false and connectNulls true graphPoints.push(points[i]); bottomPoints.push({ x: i, plotX: plotX, plotY: yBottom }); } if (!connectNulls) { addDummyPoints(i, i + 1, 'right'); } } } topPath = getGraphPath.call(this, graphPoints, true, true); bottomPath = getGraphPath.call(this, bottomPoints.reverse(), true, true); if (bottomPath.length) { bottomPath[0] = L; } areaPath = topPath.concat(bottomPath); graphPath = getGraphPath.call(this, graphPoints, false, connectNulls); // TODO: don't set leftCliff and rightCliff when connectNulls? this.areaPath = areaPath; return graphPath; }, /** * Draw the graph and the underlying area. This method calls the Series base * function and adds the area. The areaPath is calculated in the getSegmentPath * method called from Series.prototype.drawGraph. */ drawGraph: function () { // Define or reset areaPath this.areaPath = []; // Call the base method Series.prototype.drawGraph.apply(this); // Define local variables var series = this, areaPath = this.areaPath, options = this.options, zones = this.zones, props = [['area', this.color, options.fillColor]]; // area name, main color, fill color each(zones, function (threshold, i) { props.push(['zoneArea' + i, threshold.color || series.color, threshold.fillColor || options.fillColor]); }); each(props, function (prop) { var areaKey = prop[0], area = series[areaKey], attr; // Create or update the area if (area) { // update area.animate({ d: areaPath }); } else { // create attr = { fill: prop[2] || prop[1], zIndex: 0 // #1069 }; if (!prop[2]) { attr['fill-opacity'] = pick(options.fillOpacity, 0.75); } series[areaKey] = series.chart.renderer.path(areaPath) .attr(attr) .add(series.group); } }); }, drawLegendSymbol: LegendSymbolMixin.drawRectangle }); seriesTypes.area = AreaSeries; /** * Set the default options for spline */ defaultPlotOptions.spline = merge(defaultSeriesOptions); /** * SplineSeries object */ var SplineSeries = extendClass(Series, { type: 'spline', /** * Get the spline segment from a given point's previous neighbour to the given point */ getPointSpline: function (points, point, i) { var smoothing = 1.5, // 1 means control points midway between points, 2 means 1/3 from the point, 3 is 1/4 etc denom = smoothing + 1, plotX = point.plotX, plotY = point.plotY, lastPoint = points[i - 1], nextPoint = points[i + 1], leftContX, leftContY, rightContX, rightContY, ret; // Find control points if (lastPoint && !lastPoint.isNull && nextPoint && !nextPoint.isNull) { var lastX = lastPoint.plotX, lastY = lastPoint.plotY, nextX = nextPoint.plotX, nextY = nextPoint.plotY, correction; leftContX = (smoothing * plotX + lastX) / denom; leftContY = (smoothing * plotY + lastY) / denom; rightContX = (smoothing * plotX + nextX) / denom; rightContY = (smoothing * plotY + nextY) / denom; // have the two control points make a straight line through main point correction = ((rightContY - leftContY) * (rightContX - plotX)) / (rightContX - leftContX) + plotY - rightContY; leftContY += correction; rightContY += correction; // to prevent false extremes, check that control points are between // neighbouring points' y values if (leftContY > lastY && leftContY > plotY) { leftContY = mathMax(lastY, plotY); rightContY = 2 * plotY - leftContY; // mirror of left control point } else if (leftContY < lastY && leftContY < plotY) { leftContY = mathMin(lastY, plotY); rightContY = 2 * plotY - leftContY; } if (rightContY > nextY && rightContY > plotY) { rightContY = mathMax(nextY, plotY); leftContY = 2 * plotY - rightContY; } else if (rightContY < nextY && rightContY < plotY) { rightContY = mathMin(nextY, plotY); leftContY = 2 * plotY - rightContY; } // record for drawing in next point point.rightContX = rightContX; point.rightContY = rightContY; } // Visualize control points for debugging /* if (leftContX) { this.chart.renderer.circle(leftContX + this.chart.plotLeft, leftContY + this.chart.plotTop, 2) .attr({ stroke: 'red', 'stroke-width': 1, fill: 'none' }) .add(); this.chart.renderer.path(['M', leftContX + this.chart.plotLeft, leftContY + this.chart.plotTop, 'L', plotX + this.chart.plotLeft, plotY + this.chart.plotTop]) .attr({ stroke: 'red', 'stroke-width': 1 }) .add(); this.chart.renderer.circle(rightContX + this.chart.plotLeft, rightContY + this.chart.plotTop, 2) .attr({ stroke: 'green', 'stroke-width': 1, fill: 'none' }) .add(); this.chart.renderer.path(['M', rightContX + this.chart.plotLeft, rightContY + this.chart.plotTop, 'L', plotX + this.chart.plotLeft, plotY + this.chart.plotTop]) .attr({ stroke: 'green', 'stroke-width': 1 }) .add(); } // */ ret = [ 'C', pick(lastPoint.rightContX, lastPoint.plotX), pick(lastPoint.rightContY, lastPoint.plotY), pick(leftContX, plotX), pick(leftContY, plotY), plotX, plotY ]; lastPoint.rightContX = lastPoint.rightContY = null; // reset for updating series later return ret; } }); seriesTypes.spline = SplineSeries; /** * Set the default options for areaspline */ defaultPlotOptions.areaspline = merge(defaultPlotOptions.area); /** * AreaSplineSeries object */ var areaProto = AreaSeries.prototype, AreaSplineSeries = extendClass(SplineSeries, { type: 'areaspline', getStackPoints: areaProto.getStackPoints, getGraphPath: areaProto.getGraphPath, setStackCliffs: areaProto.setStackCliffs, drawGraph: areaProto.drawGraph, drawLegendSymbol: LegendSymbolMixin.drawRectangle }); seriesTypes.areaspline = AreaSplineSeries; /** * Set the default options for column */ defaultPlotOptions.column = merge(defaultSeriesOptions, { borderColor: '#FFFFFF', //borderWidth: 1, borderRadius: 0, //colorByPoint: undefined, groupPadding: 0.2, //grouping: true, marker: null, // point options are specified in the base options pointPadding: 0.1, //pointWidth: null, minPointLength: 0, cropThreshold: 50, // when there are more points, they will not animate out of the chart on xAxis.setExtremes pointRange: null, // null means auto, meaning 1 in a categorized axis and least distance between points if not categories states: { hover: { brightness: 0.1, shadow: false, halo: false }, select: { color: '#C0C0C0', borderColor: '#000000', shadow: false } }, dataLabels: { align: null, // auto verticalAlign: null, // auto y: null }, softThreshold: false, startFromThreshold: true, // false doesn't work well: http://jsfiddle.net/highcharts/hz8fopan/14/ stickyTracking: false, tooltip: { distance: 6 }, threshold: 0 }); /** * ColumnSeries object */ var ColumnSeries = extendClass(Series, { type: 'column', pointAttrToOptions: { // mapping between SVG attributes and the corresponding options stroke: 'borderColor', fill: 'color', r: 'borderRadius' }, cropShoulder: 0, directTouch: true, // When tooltip is not shared, this series (and derivatives) requires direct touch/hover. KD-tree does not apply. trackerGroups: ['group', 'dataLabelsGroup'], negStacks: true, // use separate negative stacks, unlike area stacks where a negative // point is substracted from previous (#1910) /** * Initialize the series */ init: function () { Series.prototype.init.apply(this, arguments); var series = this, chart = series.chart; // if the series is added dynamically, force redraw of other // series affected by a new column if (chart.hasRendered) { each(chart.series, function (otherSeries) { if (otherSeries.type === series.type) { otherSeries.isDirty = true; } }); } }, /** * Return the width and x offset of the columns adjusted for grouping, groupPadding, pointPadding, * pointWidth etc. */ getColumnMetrics: function () { var series = this, options = series.options, xAxis = series.xAxis, yAxis = series.yAxis, reversedXAxis = xAxis.reversed, stackKey, stackGroups = {}, columnCount = 0; // Get the total number of column type series. // This is called on every series. Consider moving this logic to a // chart.orderStacks() function and call it on init, addSeries and removeSeries if (options.grouping === false) { columnCount = 1; } else { each(series.chart.series, function (otherSeries) { var otherOptions = otherSeries.options, otherYAxis = otherSeries.yAxis, columnIndex; if (otherSeries.type === series.type && otherSeries.visible && yAxis.len === otherYAxis.len && yAxis.pos === otherYAxis.pos) { // #642, #2086 if (otherOptions.stacking) { stackKey = otherSeries.stackKey; if (stackGroups[stackKey] === UNDEFINED) { stackGroups[stackKey] = columnCount++; } columnIndex = stackGroups[stackKey]; } else if (otherOptions.grouping !== false) { // #1162 columnIndex = columnCount++; } otherSeries.columnIndex = columnIndex; } }); } var categoryWidth = mathMin( mathAbs(xAxis.transA) * (xAxis.ordinalSlope || options.pointRange || xAxis.closestPointRange || xAxis.tickInterval || 1), // #2610 xAxis.len // #1535 ), groupPadding = categoryWidth * options.groupPadding, groupWidth = categoryWidth - 2 * groupPadding, pointOffsetWidth = groupWidth / columnCount, pointWidth = mathMin( options.maxPointWidth || xAxis.len, pick(options.pointWidth, pointOffsetWidth * (1 - 2 * options.pointPadding)) ), pointPadding = (pointOffsetWidth - pointWidth) / 2, colIndex = (series.columnIndex || 0) + (reversedXAxis ? 1 : 0), // #1251, #3737 pointXOffset = pointPadding + (groupPadding + colIndex * pointOffsetWidth - (categoryWidth / 2)) * (reversedXAxis ? -1 : 1); // Save it for reading in linked series (Error bars particularly) series.columnMetrics = { width: pointWidth, offset: pointXOffset }; return series.columnMetrics; }, /** * Make the columns crisp. The edges are rounded to the nearest full pixel. */ crispCol: function (x, y, w, h) { var chart = this.chart, borderWidth = this.borderWidth, xCrisp = -(borderWidth % 2 ? 0.5 : 0), yCrisp = borderWidth % 2 ? 0.5 : 1, right, bottom, fromTop; if (chart.inverted && chart.renderer.isVML) { yCrisp += 1; } // Horizontal. We need to first compute the exact right edge, then round it // and compute the width from there. right = Math.round(x + w) + xCrisp; x = Math.round(x) + xCrisp; w = right - x; // Vertical bottom = Math.round(y + h) + yCrisp; fromTop = mathAbs(y) <= 0.5 && bottom > 0.5; // #4504, #4656 y = Math.round(y) + yCrisp; h = bottom - y; // Top edges are exceptions if (fromTop) { y -= 1; h += 1; } return { x: x, y: y, width: w, height: h }; }, /** * Translate each point to the plot area coordinate system and find shape positions */ translate: function () { var series = this, chart = series.chart, options = series.options, borderWidth = series.borderWidth = pick( options.borderWidth, series.closestPointRange * series.xAxis.transA < 2 ? 0 : 1 // #3635 ), yAxis = series.yAxis, threshold = options.threshold, translatedThreshold = series.translatedThreshold = yAxis.getThreshold(threshold), minPointLength = pick(options.minPointLength, 5), metrics = series.getColumnMetrics(), pointWidth = metrics.width, seriesBarW = series.barW = mathMax(pointWidth, 1 + 2 * borderWidth), // postprocessed for border width pointXOffset = series.pointXOffset = metrics.offset; if (chart.inverted) { translatedThreshold -= 0.5; // #3355 } // When the pointPadding is 0, we want the columns to be packed tightly, so we allow individual // columns to have individual sizes. When pointPadding is greater, we strive for equal-width // columns (#2694). if (options.pointPadding) { seriesBarW = mathCeil(seriesBarW); } Series.prototype.translate.apply(series); // Record the new values each(series.points, function (point) { var yBottom = mathMin(pick(point.yBottom, translatedThreshold), 9e4), // #3575 safeDistance = 999 + mathAbs(yBottom), plotY = mathMin(mathMax(-safeDistance, point.plotY), yAxis.len + safeDistance), // Don't draw too far outside plot area (#1303, #2241, #4264) barX = point.plotX + pointXOffset, barW = seriesBarW, barY = mathMin(plotY, yBottom), up, barH = mathMax(plotY, yBottom) - barY; // Handle options.minPointLength if (mathAbs(barH) < minPointLength) { if (minPointLength) { barH = minPointLength; up = (!yAxis.reversed && !point.negative) || (yAxis.reversed && point.negative); barY = mathAbs(barY - translatedThreshold) > minPointLength ? // stacked yBottom - minPointLength : // keep position translatedThreshold - (up ? minPointLength : 0); // #1485, #4051 } } // Cache for access in polar point.barX = barX; point.pointWidth = pointWidth; // Fix the tooltip on center of grouped columns (#1216, #424, #3648) point.tooltipPos = chart.inverted ? [yAxis.len + yAxis.pos - chart.plotLeft - plotY, series.xAxis.len - barX - barW / 2, barH] : [barX + barW / 2, plotY + yAxis.pos - chart.plotTop, barH]; // Register shape type and arguments to be used in drawPoints point.shapeType = 'rect'; point.shapeArgs = series.crispCol(barX, barY, barW, barH); }); }, getSymbol: noop, /** * Use a solid rectangle like the area series types */ drawLegendSymbol: LegendSymbolMixin.drawRectangle, /** * Columns have no graph */ drawGraph: noop, /** * Draw the columns. For bars, the series.group is rotated, so the same coordinates * apply for columns and bars. This method is inherited by scatter series. * */ drawPoints: function () { var series = this, chart = this.chart, options = series.options, renderer = chart.renderer, animationLimit = options.animationLimit || 250, shapeArgs, pointAttr; // draw the columns each(series.points, function (point) { var plotY = point.plotY, graphic = point.graphic, borderAttr; if (plotY !== UNDEFINED && !isNaN(plotY) && point.y !== null) { shapeArgs = point.shapeArgs; borderAttr = defined(series.borderWidth) ? { 'stroke-width': series.borderWidth } : {}; pointAttr = point.pointAttr[point.selected ? SELECT_STATE : NORMAL_STATE] || series.pointAttr[NORMAL_STATE]; if (graphic) { // update stop(graphic); graphic.attr(borderAttr).attr(pointAttr)[chart.pointCount < animationLimit ? 'animate' : 'attr'](merge(shapeArgs)); // #4267 } else { point.graphic = graphic = renderer[point.shapeType](shapeArgs) .attr(borderAttr) .attr(pointAttr) .add(point.group || series.group) .shadow(options.shadow, null, options.stacking && !options.borderRadius); } } else if (graphic) { point.graphic = graphic.destroy(); // #1269 } }); }, /** * Animate the column heights one by one from zero * @param {Boolean} init Whether to initialize the animation or run it */ animate: function (init) { var series = this, yAxis = this.yAxis, options = series.options, inverted = this.chart.inverted, attr = {}, translatedThreshold; if (hasSVG) { // VML is too slow anyway if (init) { attr.scaleY = 0.001; translatedThreshold = mathMin(yAxis.pos + yAxis.len, mathMax(yAxis.pos, yAxis.toPixels(options.threshold))); if (inverted) { attr.translateX = translatedThreshold - yAxis.len; } else { attr.translateY = translatedThreshold; } series.group.attr(attr); } else { // run the animation attr.scaleY = 1; attr[inverted ? 'translateX' : 'translateY'] = yAxis.pos; series.group.animate(attr, series.options.animation); // delete this function to allow it only once series.animate = null; } } }, /** * Remove this series from the chart */ remove: function () { var series = this, chart = series.chart; // column and bar series affects other series of the same type // as they are either stacked or grouped if (chart.hasRendered) { each(chart.series, function (otherSeries) { if (otherSeries.type === series.type) { otherSeries.isDirty = true; } }); } Series.prototype.remove.apply(series, arguments); } }); seriesTypes.column = ColumnSeries; /** * Set the default options for bar */ defaultPlotOptions.bar = merge(defaultPlotOptions.column); /** * The Bar series class */ var BarSeries = extendClass(ColumnSeries, { type: 'bar', inverted: true }); seriesTypes.bar = BarSeries; /** * Set the default options for scatter */ defaultPlotOptions.scatter = merge(defaultSeriesOptions, { lineWidth: 0, marker: { enabled: true // Overrides auto-enabling in line series (#3647) }, tooltip: { headerFormat: '<span style="color:{point.color}">\u25CF</span> <span style="font-size: 10px;"> {series.name}</span><br/>', pointFormat: 'x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>' } }); /** * The scatter series class */ var ScatterSeries = extendClass(Series, { type: 'scatter', sorted: false, requireSorting: false, noSharedTooltip: true, trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'], takeOrdinalPosition: false, // #2342 kdDimensions: 2, drawGraph: function () { if (this.options.lineWidth) { Series.prototype.drawGraph.call(this); } } }); seriesTypes.scatter = ScatterSeries; /** * Set the default options for pie */ defaultPlotOptions.pie = merge(defaultSeriesOptions, { borderColor: '#FFFFFF', borderWidth: 1, center: [null, null], clip: false, colorByPoint: true, // always true for pies dataLabels: { // align: null, // connectorWidth: 1, // connectorColor: point.color, // connectorPadding: 5, distance: 30, enabled: true, formatter: function () { // #2945 return this.y === null ? undefined : this.point.name; }, // softConnector: true, x: 0 // y: 0 }, ignoreHiddenPoint: true, //innerSize: 0, legendType: 'point', marker: null, // point options are specified in the base options size: null, showInLegend: false, slicedOffset: 10, states: { hover: { brightness: 0.1, shadow: false } }, stickyTracking: false, tooltip: { followPointer: true } }); /** * Extended point object for pies */ var PiePoint = extendClass(Point, { /** * Initiate the pie slice */ init: function () { Point.prototype.init.apply(this, arguments); var point = this, toggleSlice; point.name = pick(point.name, 'Slice'); // add event listener for select toggleSlice = function (e) { point.slice(e.type === 'select'); }; addEvent(point, 'select', toggleSlice); addEvent(point, 'unselect', toggleSlice); return point; }, /** * Toggle the visibility of the pie slice * @param {Boolean} vis Whether to show the slice or not. If undefined, the * visibility is toggled */ setVisible: function (vis, redraw) { var point = this, series = point.series, chart = series.chart, ignoreHiddenPoint = series.options.ignoreHiddenPoint; redraw = pick(redraw, ignoreHiddenPoint); if (vis !== point.visible) { // If called without an argument, toggle visibility point.visible = point.options.visible = vis = vis === UNDEFINED ? !point.visible : vis; series.options.data[inArray(point, series.data)] = point.options; // update userOptions.data // Show and hide associated elements. This is performed regardless of redraw or not, // because chart.redraw only handles full series. each(['graphic', 'dataLabel', 'connector', 'shadowGroup'], function (key) { if (point[key]) { point[key][vis ? 'show' : 'hide'](true); } }); if (point.legendItem) { chart.legend.colorizeItem(point, vis); } // #4170, hide halo after hiding point if (!vis && point.state === 'hover') { point.setState(''); } // Handle ignore hidden slices if (ignoreHiddenPoint) { series.isDirty = true; } if (redraw) { chart.redraw(); } } }, /** * Set or toggle whether the slice is cut out from the pie * @param {Boolean} sliced When undefined, the slice state is toggled * @param {Boolean} redraw Whether to redraw the chart. True by default. */ slice: function (sliced, redraw, animation) { var point = this, series = point.series, chart = series.chart, translation; setAnimation(animation, chart); // redraw is true by default redraw = pick(redraw, true); // if called without an argument, toggle point.sliced = point.options.sliced = sliced = defined(sliced) ? sliced : !point.sliced; series.options.data[inArray(point, series.data)] = point.options; // update userOptions.data translation = sliced ? point.slicedTranslation : { translateX: 0, translateY: 0 }; point.graphic.animate(translation); if (point.shadowGroup) { point.shadowGroup.animate(translation); } }, haloPath: function (size) { var shapeArgs = this.shapeArgs, chart = this.series.chart; return this.sliced || !this.visible ? [] : this.series.chart.renderer.symbols.arc(chart.plotLeft + shapeArgs.x, chart.plotTop + shapeArgs.y, shapeArgs.r + size, shapeArgs.r + size, { innerR: this.shapeArgs.r, start: shapeArgs.start, end: shapeArgs.end }); } }); /** * The Pie series class */ var PieSeries = { type: 'pie', isCartesian: false, pointClass: PiePoint, requireSorting: false, directTouch: true, noSharedTooltip: true, trackerGroups: ['group', 'dataLabelsGroup'], axisTypes: [], pointAttrToOptions: { // mapping between SVG attributes and the corresponding options stroke: 'borderColor', 'stroke-width': 'borderWidth', fill: 'color' }, /** * Animate the pies in */ animate: function (init) { var series = this, points = series.points, startAngleRad = series.startAngleRad; if (!init) { each(points, function (point) { var graphic = point.graphic, args = point.shapeArgs; if (graphic) { // start values graphic.attr({ r: point.startR || (series.center[3] / 2), // animate from inner radius (#779) start: startAngleRad, end: startAngleRad }); // animate graphic.animate({ r: args.r, start: args.start, end: args.end }, series.options.animation); } }); // delete this function to allow it only once series.animate = null; } }, /** * Recompute total chart sum and update percentages of points. */ updateTotals: function () { var i, total = 0, points = this.points, len = points.length, point, ignoreHiddenPoint = this.options.ignoreHiddenPoint; // Get the total sum for (i = 0; i < len; i++) { point = points[i]; total += (ignoreHiddenPoint && !point.visible) ? 0 : point.y; } this.total = total; // Set each point's properties for (i = 0; i < len; i++) { point = points[i]; point.percentage = (total > 0 && (point.visible || !ignoreHiddenPoint)) ? point.y / total * 100 : 0; point.total = total; } }, /** * Extend the generatePoints method by adding total and percentage properties to each point */ generatePoints: function () { Series.prototype.generatePoints.call(this); this.updateTotals(); }, /** * Do translation for pie slices */ translate: function (positions) { this.generatePoints(); var series = this, cumulative = 0, precision = 1000, // issue #172 options = series.options, slicedOffset = options.slicedOffset, connectorOffset = slicedOffset + options.borderWidth, start, end, angle, startAngle = options.startAngle || 0, startAngleRad = series.startAngleRad = mathPI / 180 * (startAngle - 90), endAngleRad = series.endAngleRad = mathPI / 180 * ((pick(options.endAngle, startAngle + 360)) - 90), circ = endAngleRad - startAngleRad, //2 * mathPI, points = series.points, radiusX, // the x component of the radius vector for a given point radiusY, labelDistance = options.dataLabels.distance, ignoreHiddenPoint = options.ignoreHiddenPoint, i, len = points.length, point; // Get positions - either an integer or a percentage string must be given. // If positions are passed as a parameter, we're in a recursive loop for adjusting // space for data labels. if (!positions) { series.center = positions = series.getCenter(); } // utility for getting the x value from a given y, used for anticollision logic in data labels series.getX = function (y, left) { angle = math.asin(mathMin((y - positions[1]) / (positions[2] / 2 + labelDistance), 1)); return positions[0] + (left ? -1 : 1) * (mathCos(angle) * (positions[2] / 2 + labelDistance)); }; // Calculate the geometry for each point for (i = 0; i < len; i++) { point = points[i]; // set start and end angle start = startAngleRad + (cumulative * circ); if (!ignoreHiddenPoint || point.visible) { cumulative += point.percentage / 100; } end = startAngleRad + (cumulative * circ); // set the shape point.shapeType = 'arc'; point.shapeArgs = { x: positions[0], y: positions[1], r: positions[2] / 2, innerR: positions[3] / 2, start: mathRound(start * precision) / precision, end: mathRound(end * precision) / precision }; // The angle must stay within -90 and 270 (#2645) angle = (end + start) / 2; if (angle > 1.5 * mathPI) { angle -= 2 * mathPI; } else if (angle < -mathPI / 2) { angle += 2 * mathPI; } // Center for the sliced out slice point.slicedTranslation = { translateX: mathRound(mathCos(angle) * slicedOffset), translateY: mathRound(mathSin(angle) * slicedOffset) }; // set the anchor point for tooltips radiusX = mathCos(angle) * positions[2] / 2; radiusY = mathSin(angle) * positions[2] / 2; point.tooltipPos = [ positions[0] + radiusX * 0.7, positions[1] + radiusY * 0.7 ]; point.half = angle < -mathPI / 2 || angle > mathPI / 2 ? 1 : 0; point.angle = angle; // set the anchor point for data labels connectorOffset = mathMin(connectorOffset, labelDistance / 2); // #1678 point.labelPos = [ positions[0] + radiusX + mathCos(angle) * labelDistance, // first break of connector positions[1] + radiusY + mathSin(angle) * labelDistance, // a/a positions[0] + radiusX + mathCos(angle) * connectorOffset, // second break, right outside pie positions[1] + radiusY + mathSin(angle) * connectorOffset, // a/a positions[0] + radiusX, // landing point for connector positions[1] + radiusY, // a/a labelDistance < 0 ? // alignment 'center' : point.half ? 'right' : 'left', // alignment angle // center angle ]; } }, drawGraph: null, /** * Draw the data points */ drawPoints: function () { var series = this, chart = series.chart, renderer = chart.renderer, groupTranslation, //center, graphic, //group, shadow = series.options.shadow, shadowGroup, pointAttr, shapeArgs, attr; if (shadow && !series.shadowGroup) { series.shadowGroup = renderer.g('shadow') .add(series.group); } // draw the slices each(series.points, function (point) { if (point.y !== null) { graphic = point.graphic; shapeArgs = point.shapeArgs; shadowGroup = point.shadowGroup; pointAttr = point.pointAttr[point.selected ? SELECT_STATE : NORMAL_STATE]; if (!pointAttr.stroke) { pointAttr.stroke = pointAttr.fill; } // put the shadow behind all points if (shadow && !shadowGroup) { shadowGroup = point.shadowGroup = renderer.g('shadow') .add(series.shadowGroup); } // if the point is sliced, use special translation, else use plot area traslation groupTranslation = point.sliced ? point.slicedTranslation : { translateX: 0, translateY: 0 }; //group.translate(groupTranslation[0], groupTranslation[1]); if (shadowGroup) { shadowGroup.attr(groupTranslation); } // draw the slice if (graphic) { graphic .setRadialReference(series.center) .attr(pointAttr) .animate(extend(shapeArgs, groupTranslation)); } else { attr = { 'stroke-linejoin': 'round' }; if (!point.visible) { attr.visibility = 'hidden'; } point.graphic = graphic = renderer[point.shapeType](shapeArgs) .setRadialReference(series.center) .attr(pointAttr) .attr(attr) .attr(groupTranslation) .add(series.group) .shadow(shadow, shadowGroup); } } }); }, searchPoint: noop, /** * Utility for sorting data labels */ sortByAngle: function (points, sign) { points.sort(function (a, b) { return a.angle !== undefined && (b.angle - a.angle) * sign; }); }, /** * Use a simple symbol from LegendSymbolMixin */ drawLegendSymbol: LegendSymbolMixin.drawRectangle, /** * Use the getCenter method from drawLegendSymbol */ getCenter: CenteredSeriesMixin.getCenter, /** * Pies don't have point marker symbols */ getSymbol: noop }; PieSeries = extendClass(Series, PieSeries); seriesTypes.pie = PieSeries; /** * Draw the data labels */ Series.prototype.drawDataLabels = function () { var series = this, seriesOptions = series.options, cursor = seriesOptions.cursor, options = seriesOptions.dataLabels, points = series.points, pointOptions, generalOptions, hasRendered = series.hasRendered || 0, str, dataLabelsGroup, renderer = series.chart.renderer; if (options.enabled || series._hasPointLabels) { // Process default alignment of data labels for columns if (series.dlProcessOptions) { series.dlProcessOptions(options); } // Create a separate group for the data labels to avoid rotation dataLabelsGroup = series.plotGroup( 'dataLabelsGroup', 'data-labels', options.defer ? HIDDEN : VISIBLE, options.zIndex || 6 ); if (pick(options.defer, true)) { dataLabelsGroup.attr({ opacity: +hasRendered }); // #3300 if (!hasRendered) { addEvent(series, 'afterAnimate', function () { if (series.visible) { // #3023, #3024 dataLabelsGroup.show(); } dataLabelsGroup[seriesOptions.animation ? 'animate' : 'attr']({ opacity: 1 }, { duration: 200 }); }); } } // Make the labels for each point generalOptions = options; each(points, function (point) { var enabled, dataLabel = point.dataLabel, labelConfig, attr, name, rotation, connector = point.connector, isNew = true, style, moreStyle = {}; // Determine if each data label is enabled pointOptions = point.dlOptions || (point.options && point.options.dataLabels); // dlOptions is used in treemaps enabled = pick(pointOptions && pointOptions.enabled, generalOptions.enabled) && point.y !== null; // #2282, #4641 // If the point is outside the plot area, destroy it. #678, #820 if (dataLabel && !enabled) { point.dataLabel = dataLabel.destroy(); // Individual labels are disabled if the are explicitly disabled // in the point options, or if they fall outside the plot area. } else if (enabled) { // Create individual options structure that can be extended without // affecting others options = merge(generalOptions, pointOptions); style = options.style; rotation = options.rotation; // Get the string labelConfig = point.getLabelConfig(); str = options.format ? format(options.format, labelConfig) : options.formatter.call(labelConfig, options); // Determine the color style.color = pick(options.color, style.color, series.color, 'black'); // update existing label if (dataLabel) { if (defined(str)) { dataLabel .attr({ text: str }); isNew = false; } else { // #1437 - the label is shown conditionally point.dataLabel = dataLabel = dataLabel.destroy(); if (connector) { point.connector = connector.destroy(); } } // create new label } else if (defined(str)) { attr = { //align: align, fill: options.backgroundColor, stroke: options.borderColor, 'stroke-width': options.borderWidth, r: options.borderRadius || 0, rotation: rotation, padding: options.padding, zIndex: 1 }; // Get automated contrast color if (style.color === 'contrast') { moreStyle.color = options.inside || options.distance < 0 || !!seriesOptions.stacking ? renderer.getContrast(point.color || series.color) : '#000000'; } if (cursor) { moreStyle.cursor = cursor; } // Remove unused attributes (#947) for (name in attr) { if (attr[name] === UNDEFINED) { delete attr[name]; } } dataLabel = point.dataLabel = renderer[rotation ? 'text' : 'label']( // labels don't support rotation str, 0, -9999, options.shape, null, null, options.useHTML ) .attr(attr) .css(extend(style, moreStyle)) .add(dataLabelsGroup) .shadow(options.shadow); } if (dataLabel) { // Now the data label is created and placed at 0,0, so we need to align it series.alignDataLabel(point, dataLabel, options, null, isNew); } } }); } }; /** * Align each individual data label */ Series.prototype.alignDataLabel = function (point, dataLabel, options, alignTo, isNew) { var chart = this.chart, inverted = chart.inverted, plotX = pick(point.plotX, -9999), plotY = pick(point.plotY, -9999), bBox = dataLabel.getBBox(), baseline = chart.renderer.fontMetrics(options.style.fontSize).b, rotation = options.rotation, normRotation, negRotation, align = options.align, rotCorr, // rotation correction // Math.round for rounding errors (#2683), alignTo to allow column labels (#2700) visible = this.visible && (point.series.forceDL || chart.isInsidePlot(plotX, mathRound(plotY), inverted) || (alignTo && chart.isInsidePlot(plotX, inverted ? alignTo.x + 1 : alignTo.y + alignTo.height - 1, inverted))), alignAttr, // the final position; justify = pick(options.overflow, 'justify') === 'justify'; if (visible) { // The alignment box is a singular point alignTo = extend({ x: inverted ? chart.plotWidth - plotY : plotX, y: mathRound(inverted ? chart.plotHeight - plotX : plotY), width: 0, height: 0 }, alignTo); // Add the text size for alignment calculation extend(options, { width: bBox.width, height: bBox.height }); // Allow a hook for changing alignment in the last moment, then do the alignment if (rotation) { justify = false; // Not supported for rotated text rotCorr = chart.renderer.rotCorr(baseline, rotation); // #3723 alignAttr = { x: alignTo.x + options.x + alignTo.width / 2 + rotCorr.x, y: alignTo.y + options.y + alignTo.height / 2 }; dataLabel [isNew ? 'attr' : 'animate'](alignAttr) .attr({ // #3003 align: options.align }); // Compensate for the rotated label sticking out on the sides normRotation = (rotation + 720) % 360; negRotation = normRotation > 180 && normRotation < 360; if (align === 'left') { alignAttr.y -= negRotation ? bBox.height : 0; } else if (align === 'center') { alignAttr.x -= bBox.width / 2; alignAttr.y -= bBox.height / 2; } else if (align === 'right') { alignAttr.x -= bBox.width; alignAttr.y -= negRotation ? 0 : bBox.height; } } else { dataLabel.align(options, null, alignTo); alignAttr = dataLabel.alignAttr; } // Handle justify or crop if (justify) { this.justifyDataLabel(dataLabel, options, alignAttr, bBox, alignTo, isNew); // Now check that the data label is within the plot area } else if (pick(options.crop, true)) { visible = chart.isInsidePlot(alignAttr.x, alignAttr.y) && chart.isInsidePlot(alignAttr.x + bBox.width, alignAttr.y + bBox.height); } // When we're using a shape, make it possible with a connector or an arrow pointing to thie point if (options.shape && !rotation) { dataLabel.attr({ anchorX: point.plotX, anchorY: point.plotY }); } } // Show or hide based on the final aligned position if (!visible) { stop(dataLabel); dataLabel.attr({ y: -9999 }); dataLabel.placed = false; // don't animate back in } }; /** * If data labels fall partly outside the plot area, align them back in, in a way that * doesn't hide the point. */ Series.prototype.justifyDataLabel = function (dataLabel, options, alignAttr, bBox, alignTo, isNew) { var chart = this.chart, align = options.align, verticalAlign = options.verticalAlign, off, justified, padding = dataLabel.box ? 0 : (dataLabel.padding || 0); // Off left off = alignAttr.x + padding; if (off < 0) { if (align === 'right') { options.align = 'left'; } else { options.x = -off; } justified = true; } // Off right off = alignAttr.x + bBox.width - padding; if (off > chart.plotWidth) { if (align === 'left') { options.align = 'right'; } else { options.x = chart.plotWidth - off; } justified = true; } // Off top off = alignAttr.y + padding; if (off < 0) { if (verticalAlign === 'bottom') { options.verticalAlign = 'top'; } else { options.y = -off; } justified = true; } // Off bottom off = alignAttr.y + bBox.height - padding; if (off > chart.plotHeight) { if (verticalAlign === 'top') { options.verticalAlign = 'bottom'; } else { options.y = chart.plotHeight - off; } justified = true; } if (justified) { dataLabel.placed = !isNew; dataLabel.align(options, null, alignTo); } }; /** * Override the base drawDataLabels method by pie specific functionality */ if (seriesTypes.pie) { seriesTypes.pie.prototype.drawDataLabels = function () { var series = this, data = series.data, point, chart = series.chart, options = series.options.dataLabels, connectorPadding = pick(options.connectorPadding, 10), connectorWidth = pick(options.connectorWidth, 1), plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, connector, connectorPath, softConnector = pick(options.softConnector, true), distanceOption = options.distance, seriesCenter = series.center, radius = seriesCenter[2] / 2, centerY = seriesCenter[1], outside = distanceOption > 0, dataLabel, dataLabelWidth, labelPos, labelHeight, halves = [// divide the points into right and left halves for anti collision [], // right [] // left ], x, y, visibility, rankArr, i, j, overflow = [0, 0, 0, 0], // top, right, bottom, left sort = function (a, b) { return b.y - a.y; }; // get out if not enabled if (!series.visible || (!options.enabled && !series._hasPointLabels)) { return; } // run parent method Series.prototype.drawDataLabels.apply(series); each(data, function (point) { if (point.dataLabel && point.visible) { // #407, #2510 // Arrange points for detection collision halves[point.half].push(point); // Reset positions (#4905) point.dataLabel._pos = null; } }); /* Loop over the points in each half, starting from the top and bottom * of the pie to detect overlapping labels. */ i = 2; while (i--) { var slots = [], slotsLength, usedSlots = [], points = halves[i], pos, bottom, length = points.length, slotIndex; if (!length) { continue; } // Sort by angle series.sortByAngle(points, i - 0.5); // Assume equal label heights on either hemisphere (#2630) j = labelHeight = 0; while (!labelHeight && points[j]) { // #1569 labelHeight = points[j] && points[j].dataLabel && (points[j].dataLabel.getBBox().height || 21); // 21 is for #968 j++; } // Only do anti-collision when we are outside the pie and have connectors (#856) if (distanceOption > 0) { // Build the slots bottom = mathMin(centerY + radius + distanceOption, chart.plotHeight); for (pos = mathMax(0, centerY - radius - distanceOption); pos <= bottom; pos += labelHeight) { slots.push(pos); } slotsLength = slots.length; /* Visualize the slots if (!series.slotElements) { series.slotElements = []; } if (i === 1) { series.slotElements.forEach(function (elem) { elem.destroy(); }); series.slotElements.length = 0; } slots.forEach(function (pos, no) { var slotX = series.getX(pos, i) + chart.plotLeft - (i ? 100 : 0), slotY = pos + chart.plotTop; if (!isNaN(slotX)) { series.slotElements.push(chart.renderer.rect(slotX, slotY - 7, 100, labelHeight, 1) .attr({ 'stroke-width': 1, stroke: 'silver', fill: 'rgba(0,0,255,0.1)' }) .add()); series.slotElements.push(chart.renderer.text('Slot '+ no, slotX, slotY + 4) .attr({ fill: 'silver' }).add()); } }); // */ // if there are more values than available slots, remove lowest values if (length > slotsLength) { // create an array for sorting and ranking the points within each quarter rankArr = [].concat(points); rankArr.sort(sort); j = length; while (j--) { rankArr[j].rank = j; } j = length; while (j--) { if (points[j].rank >= slotsLength) { points.splice(j, 1); } } length = points.length; } // The label goes to the nearest open slot, but not closer to the edge than // the label's index. for (j = 0; j < length; j++) { point = points[j]; labelPos = point.labelPos; var closest = 9999, distance, slotI; // find the closest slot index for (slotI = 0; slotI < slotsLength; slotI++) { distance = mathAbs(slots[slotI] - labelPos[1]); if (distance < closest) { closest = distance; slotIndex = slotI; } } // if that slot index is closer to the edges of the slots, move it // to the closest appropriate slot if (slotIndex < j && slots[j] !== null) { // cluster at the top slotIndex = j; } else if (slotsLength < length - j + slotIndex && slots[j] !== null) { // cluster at the bottom slotIndex = slotsLength - length + j; while (slots[slotIndex] === null) { // make sure it is not taken slotIndex++; } } else { // Slot is taken, find next free slot below. In the next run, the next slice will find the // slot above these, because it is the closest one while (slots[slotIndex] === null) { // make sure it is not taken slotIndex++; } } usedSlots.push({ i: slotIndex, y: slots[slotIndex] }); slots[slotIndex] = null; // mark as taken } // sort them in order to fill in from the top usedSlots.sort(sort); } // now the used slots are sorted, fill them up sequentially for (j = 0; j < length; j++) { var slot, naturalY; point = points[j]; labelPos = point.labelPos; dataLabel = point.dataLabel; visibility = point.visible === false ? HIDDEN : 'inherit'; naturalY = labelPos[1]; if (distanceOption > 0) { slot = usedSlots.pop(); slotIndex = slot.i; // if the slot next to currrent slot is free, the y value is allowed // to fall back to the natural position y = slot.y; if ((naturalY > y && slots[slotIndex + 1] !== null) || (naturalY < y && slots[slotIndex - 1] !== null)) { y = mathMin(mathMax(0, naturalY), chart.plotHeight); } } else { y = naturalY; } // get the x - use the natural x position for first and last slot, to prevent the top // and botton slice connectors from touching each other on either side x = options.justify ? seriesCenter[0] + (i ? -1 : 1) * (radius + distanceOption) : series.getX(y === centerY - radius - distanceOption || y === centerY + radius + distanceOption ? naturalY : y, i); // Record the placement and visibility dataLabel._attr = { visibility: visibility, align: labelPos[6] }; dataLabel._pos = { x: x + options.x + ({ left: connectorPadding, right: -connectorPadding }[labelPos[6]] || 0), y: y + options.y - 10 // 10 is for the baseline (label vs text) }; dataLabel.connX = x; dataLabel.connY = y; // Detect overflowing data labels if (this.options.size === null) { dataLabelWidth = dataLabel.width; // Overflow left if (x - dataLabelWidth < connectorPadding) { overflow[3] = mathMax(mathRound(dataLabelWidth - x + connectorPadding), overflow[3]); // Overflow right } else if (x + dataLabelWidth > plotWidth - connectorPadding) { overflow[1] = mathMax(mathRound(x + dataLabelWidth - plotWidth + connectorPadding), overflow[1]); } // Overflow top if (y - labelHeight / 2 < 0) { overflow[0] = mathMax(mathRound(-y + labelHeight / 2), overflow[0]); // Overflow left } else if (y + labelHeight / 2 > plotHeight) { overflow[2] = mathMax(mathRound(y + labelHeight / 2 - plotHeight), overflow[2]); } } } // for each point } // for each half // Do not apply the final placement and draw the connectors until we have verified // that labels are not spilling over. if (arrayMax(overflow) === 0 || this.verifyDataLabelOverflow(overflow)) { // Place the labels in the final position this.placeDataLabels(); // Draw the connectors if (outside && connectorWidth) { each(this.points, function (point) { connector = point.connector; labelPos = point.labelPos; dataLabel = point.dataLabel; if (dataLabel && dataLabel._pos && point.visible) { visibility = dataLabel._attr.visibility; x = dataLabel.connX; y = dataLabel.connY; connectorPath = softConnector ? [ M, x + (labelPos[6] === 'left' ? 5 : -5), y, // end of the string at the label 'C', x, y, // first break, next to the label 2 * labelPos[2] - labelPos[4], 2 * labelPos[3] - labelPos[5], labelPos[2], labelPos[3], // second break L, labelPos[4], labelPos[5] // base ] : [ M, x + (labelPos[6] === 'left' ? 5 : -5), y, // end of the string at the label L, labelPos[2], labelPos[3], // second break L, labelPos[4], labelPos[5] // base ]; if (connector) { connector.animate({ d: connectorPath }); connector.attr('visibility', visibility); } else { point.connector = connector = series.chart.renderer.path(connectorPath).attr({ 'stroke-width': connectorWidth, stroke: options.connectorColor || point.color || '#606060', visibility: visibility //zIndex: 0 // #2722 (reversed) }) .add(series.dataLabelsGroup); } } else if (connector) { point.connector = connector.destroy(); } }); } } }; /** * Perform the final placement of the data labels after we have verified that they * fall within the plot area. */ seriesTypes.pie.prototype.placeDataLabels = function () { each(this.points, function (point) { var dataLabel = point.dataLabel, _pos; if (dataLabel && point.visible) { _pos = dataLabel._pos; if (_pos) { dataLabel.attr(dataLabel._attr); dataLabel[dataLabel.moved ? 'animate' : 'attr'](_pos); dataLabel.moved = true; } else if (dataLabel) { dataLabel.attr({ y: -9999 }); } } }); }; seriesTypes.pie.prototype.alignDataLabel = noop; /** * Verify whether the data labels are allowed to draw, or we should run more translation and data * label positioning to keep them inside the plot area. Returns true when data labels are ready * to draw. */ seriesTypes.pie.prototype.verifyDataLabelOverflow = function (overflow) { var center = this.center, options = this.options, centerOption = options.center, minSize = options.minSize || 80, newSize = minSize, ret; // Handle horizontal size and center if (centerOption[0] !== null) { // Fixed center newSize = mathMax(center[2] - mathMax(overflow[1], overflow[3]), minSize); } else { // Auto center newSize = mathMax( center[2] - overflow[1] - overflow[3], // horizontal overflow minSize ); center[0] += (overflow[3] - overflow[1]) / 2; // horizontal center } // Handle vertical size and center if (centerOption[1] !== null) { // Fixed center newSize = mathMax(mathMin(newSize, center[2] - mathMax(overflow[0], overflow[2])), minSize); } else { // Auto center newSize = mathMax( mathMin( newSize, center[2] - overflow[0] - overflow[2] // vertical overflow ), minSize ); center[1] += (overflow[0] - overflow[2]) / 2; // vertical center } // If the size must be decreased, we need to run translate and drawDataLabels again if (newSize < center[2]) { center[2] = newSize; center[3] = Math.min(relativeLength(options.innerSize || 0, newSize), newSize); // #3632 this.translate(center); if (this.drawDataLabels) { this.drawDataLabels(); } // Else, return true to indicate that the pie and its labels is within the plot area } else { ret = true; } return ret; }; } if (seriesTypes.column) { /** * Override the basic data label alignment by adjusting for the position of the column */ seriesTypes.column.prototype.alignDataLabel = function (point, dataLabel, options, alignTo, isNew) { var inverted = this.chart.inverted, series = point.series, dlBox = point.dlBox || point.shapeArgs, // data label box for alignment below = pick(point.below, point.plotY > pick(this.translatedThreshold, series.yAxis.len)), // point.below is used in range series inside = pick(options.inside, !!this.options.stacking), // draw it inside the box? overshoot; // Align to the column itself, or the top of it if (dlBox) { // Area range uses this method but not alignTo alignTo = merge(dlBox); if (alignTo.y < 0) { alignTo.height += alignTo.y; alignTo.y = 0; } overshoot = alignTo.y + alignTo.height - series.yAxis.len; if (overshoot > 0) { alignTo.height -= overshoot; } if (inverted) { alignTo = { x: series.yAxis.len - alignTo.y - alignTo.height, y: series.xAxis.len - alignTo.x - alignTo.width, width: alignTo.height, height: alignTo.width }; } // Compute the alignment box if (!inside) { if (inverted) { alignTo.x += below ? 0 : alignTo.width; alignTo.width = 0; } else { alignTo.y += below ? alignTo.height : 0; alignTo.height = 0; } } } // When alignment is undefined (typically columns and bars), display the individual // point below or above the point depending on the threshold options.align = pick( options.align, !inverted || inside ? 'center' : below ? 'right' : 'left' ); options.verticalAlign = pick( options.verticalAlign, inverted || inside ? 'middle' : below ? 'top' : 'bottom' ); // Call the parent method Series.prototype.alignDataLabel.call(this, point, dataLabel, options, alignTo, isNew); }; } /** * Highcharts module to hide overlapping data labels. This module is included in Highcharts. */ (function (H) { var Chart = H.Chart, each = H.each, pick = H.pick, addEvent = H.addEvent; // Collect potensial overlapping data labels. Stack labels probably don't need to be // considered because they are usually accompanied by data labels that lie inside the columns. Chart.prototype.callbacks.push(function (chart) { function collectAndHide() { var labels = []; each(chart.series, function (series) { var dlOptions = series.options.dataLabels, collections = series.dataLabelCollections || ['dataLabel']; // Range series have two collections if ((dlOptions.enabled || series._hasPointLabels) && !dlOptions.allowOverlap && series.visible) { // #3866 each(collections, function (coll) { each(series.points, function (point) { if (point[coll]) { point[coll].labelrank = pick(point.labelrank, point.shapeArgs && point.shapeArgs.height); // #4118 labels.push(point[coll]); } }); }); } }); chart.hideOverlappingLabels(labels); } // Do it now ... collectAndHide(); // ... and after each chart redraw addEvent(chart, 'redraw', collectAndHide); }); /** * Hide overlapping labels. Labels are moved and faded in and out on zoom to provide a smooth * visual imression. */ Chart.prototype.hideOverlappingLabels = function (labels) { var len = labels.length, label, i, j, label1, label2, isIntersecting, pos1, pos2, parent1, parent2, padding, intersectRect = function (x1, y1, w1, h1, x2, y2, w2, h2) { return !( x2 > x1 + w1 || x2 + w2 < x1 || y2 > y1 + h1 || y2 + h2 < y1 ); }; // Mark with initial opacity for (i = 0; i < len; i++) { label = labels[i]; if (label) { label.oldOpacity = label.opacity; label.newOpacity = 1; } } // Prevent a situation in a gradually rising slope, that each label // will hide the previous one because the previous one always has // lower rank. labels.sort(function (a, b) { return (b.labelrank || 0) - (a.labelrank || 0); }); // Detect overlapping labels for (i = 0; i < len; i++) { label1 = labels[i]; for (j = i + 1; j < len; ++j) { label2 = labels[j]; if (label1 && label2 && label1.placed && label2.placed && label1.newOpacity !== 0 && label2.newOpacity !== 0) { pos1 = label1.alignAttr; pos2 = label2.alignAttr; parent1 = label1.parentGroup; // Different panes have different positions parent2 = label2.parentGroup; padding = 2 * (label1.box ? 0 : label1.padding); // Substract the padding if no background or border (#4333) isIntersecting = intersectRect( pos1.x + parent1.translateX, pos1.y + parent1.translateY, label1.width - padding, label1.height - padding, pos2.x + parent2.translateX, pos2.y + parent2.translateY, label2.width - padding, label2.height - padding ); if (isIntersecting) { (label1.labelrank < label2.labelrank ? label1 : label2).newOpacity = 0; } } } } // Hide or show each(labels, function (label) { var complete, newOpacity; if (label) { newOpacity = label.newOpacity; if (label.oldOpacity !== newOpacity && label.placed) { // Make sure the label is completely hidden to avoid catching clicks (#4362) if (newOpacity) { label.show(true); } else { complete = function () { label.hide(); }; } // Animate or set the opacity label.alignAttr.opacity = newOpacity; label[label.isOld ? 'animate' : 'attr'](label.alignAttr, null, complete); } label.isOld = true; } }); }; }(Highcharts)); /** * TrackerMixin for points and graphs */ var TrackerMixin = Highcharts.TrackerMixin = { drawTrackerPoint: function () { var series = this, chart = series.chart, pointer = chart.pointer, cursor = series.options.cursor, css = cursor && { cursor: cursor }, onMouseOver = function (e) { var target = e.target, point; while (target && !point) { point = target.point; target = target.parentNode; } if (point !== UNDEFINED && point !== chart.hoverPoint) { // undefined on graph in scatterchart point.onMouseOver(e); } }; // Add reference to the point each(series.points, function (point) { if (point.graphic) { point.graphic.element.point = point; } if (point.dataLabel) { point.dataLabel.element.point = point; } }); // Add the event listeners, we need to do this only once if (!series._hasTracking) { each(series.trackerGroups, function (key) { if (series[key]) { // we don't always have dataLabelsGroup series[key] .addClass(PREFIX + 'tracker') .on('mouseover', onMouseOver) .on('mouseout', function (e) { pointer.onTrackerMouseOut(e); }) .css(css); if (hasTouch) { series[key].on('touchstart', onMouseOver); } } }); series._hasTracking = true; } }, /** * Draw the tracker object that sits above all data labels and markers to * track mouse events on the graph or points. For the line type charts * the tracker uses the same graphPath, but with a greater stroke width * for better control. */ drawTrackerGraph: function () { var series = this, options = series.options, trackByArea = options.trackByArea, trackerPath = [].concat(trackByArea ? series.areaPath : series.graphPath), trackerPathLength = trackerPath.length, chart = series.chart, pointer = chart.pointer, renderer = chart.renderer, snap = chart.options.tooltip.snap, tracker = series.tracker, cursor = options.cursor, css = cursor && { cursor: cursor }, i, onMouseOver = function () { if (chart.hoverSeries !== series) { series.onMouseOver(); } }, /* * Empirical lowest possible opacities for TRACKER_FILL for an element to stay invisible but clickable * IE6: 0.002 * IE7: 0.002 * IE8: 0.002 * IE9: 0.00000000001 (unlimited) * IE10: 0.0001 (exporting only) * FF: 0.00000000001 (unlimited) * Chrome: 0.000001 * Safari: 0.000001 * Opera: 0.00000000001 (unlimited) */ TRACKER_FILL = 'rgba(192,192,192,' + (hasSVG ? 0.0001 : 0.002) + ')'; // Extend end points. A better way would be to use round linecaps, // but those are not clickable in VML. if (trackerPathLength && !trackByArea) { i = trackerPathLength + 1; while (i--) { if (trackerPath[i] === M) { // extend left side trackerPath.splice(i + 1, 0, trackerPath[i + 1] - snap, trackerPath[i + 2], L); } if ((i && trackerPath[i] === M) || i === trackerPathLength) { // extend right side trackerPath.splice(i, 0, L, trackerPath[i - 2] + snap, trackerPath[i - 1]); } } } // handle single points /*for (i = 0; i < singlePoints.length; i++) { singlePoint = singlePoints[i]; trackerPath.push(M, singlePoint.plotX - snap, singlePoint.plotY, L, singlePoint.plotX + snap, singlePoint.plotY); }*/ // draw the tracker if (tracker) { tracker.attr({ d: trackerPath }); } else { // create series.tracker = renderer.path(trackerPath) .attr({ 'stroke-linejoin': 'round', // #1225 visibility: series.visible ? VISIBLE : HIDDEN, stroke: TRACKER_FILL, fill: trackByArea ? TRACKER_FILL : NONE, 'stroke-width': options.lineWidth + (trackByArea ? 0 : 2 * snap), zIndex: 2 }) .add(series.group); // The tracker is added to the series group, which is clipped, but is covered // by the marker group. So the marker group also needs to capture events. each([series.tracker, series.markerGroup], function (tracker) { tracker.addClass(PREFIX + 'tracker') .on('mouseover', onMouseOver) .on('mouseout', function (e) { pointer.onTrackerMouseOut(e); }) .css(css); if (hasTouch) { tracker.on('touchstart', onMouseOver); } }); } } }; /* End TrackerMixin */ /** * Add tracking event listener to the series group, so the point graphics * themselves act as trackers */ if (seriesTypes.column) { ColumnSeries.prototype.drawTracker = TrackerMixin.drawTrackerPoint; } if (seriesTypes.pie) { seriesTypes.pie.prototype.drawTracker = TrackerMixin.drawTrackerPoint; } if (seriesTypes.scatter) { ScatterSeries.prototype.drawTracker = TrackerMixin.drawTrackerPoint; } /* * Extend Legend for item events */ extend(Legend.prototype, { setItemEvents: function (item, legendItem, useHTML, itemStyle, itemHiddenStyle) { var legend = this; // Set the events on the item group, or in case of useHTML, the item itself (#1249) (useHTML ? legendItem : item.legendGroup).on('mouseover', function () { item.setState(HOVER_STATE); legendItem.css(legend.options.itemHoverStyle); }) .on('mouseout', function () { legendItem.css(item.visible ? itemStyle : itemHiddenStyle); item.setState(); }) .on('click', function (event) { var strLegendItemClick = 'legendItemClick', fnLegendItemClick = function () { if (item.setVisible) { item.setVisible(); } }; // Pass over the click/touch event. #4. event = { browserEvent: event }; // click the name or symbol if (item.firePointEvent) { // point item.firePointEvent(strLegendItemClick, event, fnLegendItemClick); } else { fireEvent(item, strLegendItemClick, event, fnLegendItemClick); } }); }, createCheckboxForItem: function (item) { var legend = this; item.checkbox = createElement('input', { type: 'checkbox', checked: item.selected, defaultChecked: item.selected // required by IE7 }, legend.options.itemCheckboxStyle, legend.chart.container); addEvent(item.checkbox, 'click', function (event) { var target = event.target; fireEvent( item.series || item, 'checkboxClick', { // #3712 checked: target.checked, item: item }, function () { item.select(); } ); }); } }); /* * Add pointer cursor to legend itemstyle in defaultOptions */ defaultOptions.legend.itemStyle.cursor = 'pointer'; /* * Extend the Chart object with interaction */ extend(Chart.prototype, { /** * Display the zoom button */ showResetZoom: function () { var chart = this, lang = defaultOptions.lang, btnOptions = chart.options.chart.resetZoomButton, theme = btnOptions.theme, states = theme.states, alignTo = btnOptions.relativeTo === 'chart' ? null : 'plotBox'; function zoomOut() { chart.zoomOut(); } this.resetZoomButton = chart.renderer.button(lang.resetZoom, null, null, zoomOut, theme, states && states.hover) .attr({ align: btnOptions.position.align, title: lang.resetZoomTitle }) .add() .align(btnOptions.position, false, alignTo); }, /** * Zoom out to 1:1 */ zoomOut: function () { var chart = this; fireEvent(chart, 'selection', { resetSelection: true }, function () { chart.zoom(); }); }, /** * Zoom into a given portion of the chart given by axis coordinates * @param {Object} event */ zoom: function (event) { var chart = this, hasZoomed, pointer = chart.pointer, displayButton = false, resetZoomButton; // If zoom is called with no arguments, reset the axes if (!event || event.resetSelection) { each(chart.axes, function (axis) { hasZoomed = axis.zoom(); }); } else { // else, zoom in on all axes each(event.xAxis.concat(event.yAxis), function (axisData) { var axis = axisData.axis, isXAxis = axis.isXAxis; // don't zoom more than minRange if (pointer[isXAxis ? 'zoomX' : 'zoomY'] || pointer[isXAxis ? 'pinchX' : 'pinchY']) { hasZoomed = axis.zoom(axisData.min, axisData.max); if (axis.displayBtn) { displayButton = true; } } }); } // Show or hide the Reset zoom button resetZoomButton = chart.resetZoomButton; if (displayButton && !resetZoomButton) { chart.showResetZoom(); } else if (!displayButton && isObject(resetZoomButton)) { chart.resetZoomButton = resetZoomButton.destroy(); } // Redraw if (hasZoomed) { chart.redraw( pick(chart.options.chart.animation, event && event.animation, chart.pointCount < 100) // animation ); } }, /** * Pan the chart by dragging the mouse across the pane. This function is called * on mouse move, and the distance to pan is computed from chartX compared to * the first chartX position in the dragging operation. */ pan: function (e, panning) { var chart = this, hoverPoints = chart.hoverPoints, doRedraw; // remove active points for shared tooltip if (hoverPoints) { each(hoverPoints, function (point) { point.setState(); }); } each(panning === 'xy' ? [1, 0] : [1], function (isX) { // xy is used in maps var axis = chart[isX ? 'xAxis' : 'yAxis'][0], horiz = axis.horiz, mousePos = e[horiz ? 'chartX' : 'chartY'], mouseDown = horiz ? 'mouseDownX' : 'mouseDownY', startPos = chart[mouseDown], halfPointRange = (axis.pointRange || 0) / 2, extremes = axis.getExtremes(), newMin = axis.toValue(startPos - mousePos, true) + halfPointRange, newMax = axis.toValue(startPos + axis.len - mousePos, true) - halfPointRange, goingLeft = startPos > mousePos; // #3613 if (axis.series.length && (goingLeft || newMin > mathMin(extremes.dataMin, extremes.min)) && (!goingLeft || newMax < mathMax(extremes.dataMax, extremes.max))) { axis.setExtremes(newMin, newMax, false, false, { trigger: 'pan' }); doRedraw = true; } chart[mouseDown] = mousePos; // set new reference for next run }); if (doRedraw) { chart.redraw(false); } css(chart.container, { cursor: 'move' }); } }); /* * Extend the Point object with interaction */ extend(Point.prototype, { /** * Toggle the selection status of a point * @param {Boolean} selected Whether to select or unselect the point. * @param {Boolean} accumulate Whether to add to the previous selection. By default, * this happens if the control key (Cmd on Mac) was pressed during clicking. */ select: function (selected, accumulate) { var point = this, series = point.series, chart = series.chart; selected = pick(selected, !point.selected); // fire the event with the default handler point.firePointEvent(selected ? 'select' : 'unselect', { accumulate: accumulate }, function () { point.selected = point.options.selected = selected; series.options.data[inArray(point, series.data)] = point.options; point.setState(selected && SELECT_STATE); // unselect all other points unless Ctrl or Cmd + click if (!accumulate) { each(chart.getSelectedPoints(), function (loopPoint) { if (loopPoint.selected && loopPoint !== point) { loopPoint.selected = loopPoint.options.selected = false; series.options.data[inArray(loopPoint, series.data)] = loopPoint.options; loopPoint.setState(NORMAL_STATE); loopPoint.firePointEvent('unselect'); } }); } }); }, /** * Runs on mouse over the point * * @param {Object} e The event arguments * @param {Boolean} byProximity Falsy for kd points that are closest to the mouse, or to * actually hovered points. True for other points in shared tooltip. */ onMouseOver: function (e, byProximity) { var point = this, series = point.series, chart = series.chart, tooltip = chart.tooltip, hoverPoint = chart.hoverPoint; if (chart.hoverSeries !== series) { series.onMouseOver(); } // set normal state to previous series if (hoverPoint && hoverPoint !== point) { hoverPoint.onMouseOut(); } if (point.series) { // It may have been destroyed, #4130 // trigger the event point.firePointEvent('mouseOver'); // update the tooltip if (tooltip && (!tooltip.shared || series.noSharedTooltip)) { tooltip.refresh(point, e); } // hover this point.setState(HOVER_STATE); if (!byProximity) { chart.hoverPoint = point; } } }, /** * Runs on mouse out from the point */ onMouseOut: function () { var chart = this.series.chart, hoverPoints = chart.hoverPoints; this.firePointEvent('mouseOut'); if (!hoverPoints || inArray(this, hoverPoints) === -1) { // #887, #2240 this.setState(); chart.hoverPoint = null; } }, /** * Import events from the series' and point's options. Only do it on * demand, to save processing time on hovering. */ importEvents: function () { if (!this.hasImportedEvents) { var point = this, options = merge(point.series.options.point, point.options), events = options.events, eventType; point.events = events; for (eventType in events) { addEvent(point, eventType, events[eventType]); } this.hasImportedEvents = true; } }, /** * Set the point's state * @param {String} state */ setState: function (state, move) { var point = this, plotX = mathFloor(point.plotX), // #4586 plotY = point.plotY, series = point.series, stateOptions = series.options.states, markerOptions = defaultPlotOptions[series.type].marker && series.options.marker, normalDisabled = markerOptions && !markerOptions.enabled, markerStateOptions = markerOptions && markerOptions.states[state], stateDisabled = markerStateOptions && markerStateOptions.enabled === false, stateMarkerGraphic = series.stateMarkerGraphic, pointMarker = point.marker || {}, chart = series.chart, radius, halo = series.halo, haloOptions, newSymbol, pointAttr; state = state || NORMAL_STATE; // empty string pointAttr = point.pointAttr[state] || series.pointAttr[state]; if ( // already has this state (state === point.state && !move) || // selected points don't respond to hover (point.selected && state !== SELECT_STATE) || // series' state options is disabled (stateOptions[state] && stateOptions[state].enabled === false) || // general point marker's state options is disabled (state && (stateDisabled || (normalDisabled && markerStateOptions.enabled === false))) || // individual point marker's state options is disabled (state && pointMarker.states && pointMarker.states[state] && pointMarker.states[state].enabled === false) // #1610 ) { return; } // apply hover styles to the existing point if (point.graphic) { radius = markerOptions && point.graphic.symbolName && pointAttr.r; point.graphic.attr(merge( pointAttr, radius ? { // new symbol attributes (#507, #612) x: plotX - radius, y: plotY - radius, width: 2 * radius, height: 2 * radius } : {} )); // Zooming in from a range with no markers to a range with markers if (stateMarkerGraphic) { stateMarkerGraphic.hide(); } } else { // if a graphic is not applied to each point in the normal state, create a shared // graphic for the hover state if (state && markerStateOptions) { radius = markerStateOptions.radius; newSymbol = pointMarker.symbol || series.symbol; // If the point has another symbol than the previous one, throw away the // state marker graphic and force a new one (#1459) if (stateMarkerGraphic && stateMarkerGraphic.currentSymbol !== newSymbol) { stateMarkerGraphic = stateMarkerGraphic.destroy(); } // Add a new state marker graphic if (!stateMarkerGraphic) { if (newSymbol) { series.stateMarkerGraphic = stateMarkerGraphic = chart.renderer.symbol( newSymbol, plotX - radius, plotY - radius, 2 * radius, 2 * radius ) .attr(pointAttr) .add(series.markerGroup); stateMarkerGraphic.currentSymbol = newSymbol; } // Move the existing graphic } else { stateMarkerGraphic[move ? 'animate' : 'attr']({ // #1054 x: plotX - radius, y: plotY - radius }); } } if (stateMarkerGraphic) { stateMarkerGraphic[state && chart.isInsidePlot(plotX, plotY, chart.inverted) ? 'show' : 'hide'](); // #2450 stateMarkerGraphic.element.point = point; // #4310 } } // Show me your halo haloOptions = stateOptions[state] && stateOptions[state].halo; if (haloOptions && haloOptions.size) { if (!halo) { series.halo = halo = chart.renderer.path() .add(chart.seriesGroup); } halo.attr(extend({ 'fill': point.color || series.color, 'fill-opacity': haloOptions.opacity, 'zIndex': -1 // #4929, IE8 added halo above everything }, haloOptions.attributes))[move ? 'animate' : 'attr']({ d: point.haloPath(haloOptions.size) }); } else if (halo) { halo.attr({ d: [] }); } point.state = state; }, /** * Get the circular path definition for the halo * @param {Number} size The radius of the circular halo * @returns {Array} The path definition */ haloPath: function (size) { var series = this.series, chart = series.chart, plotBox = series.getPlotBox(), inverted = chart.inverted, plotX = Math.floor(this.plotX); return chart.renderer.symbols.circle( plotBox.translateX + (inverted ? series.yAxis.len - this.plotY : plotX) - size, plotBox.translateY + (inverted ? series.xAxis.len - plotX : this.plotY) - size, size * 2, size * 2 ); } }); /* * Extend the Series object with interaction */ extend(Series.prototype, { /** * Series mouse over handler */ onMouseOver: function () { var series = this, chart = series.chart, hoverSeries = chart.hoverSeries; // set normal state to previous series if (hoverSeries && hoverSeries !== series) { hoverSeries.onMouseOut(); } // trigger the event, but to save processing time, // only if defined if (series.options.events.mouseOver) { fireEvent(series, 'mouseOver'); } // hover this series.setState(HOVER_STATE); chart.hoverSeries = series; }, /** * Series mouse out handler */ onMouseOut: function () { // trigger the event only if listeners exist var series = this, options = series.options, chart = series.chart, tooltip = chart.tooltip, hoverPoint = chart.hoverPoint; chart.hoverSeries = null; // #182, set to null before the mouseOut event fires // trigger mouse out on the point, which must be in this series if (hoverPoint) { hoverPoint.onMouseOut(); } // fire the mouse out event if (series && options.events.mouseOut) { fireEvent(series, 'mouseOut'); } // hide the tooltip if (tooltip && !options.stickyTracking && (!tooltip.shared || series.noSharedTooltip)) { tooltip.hide(); } // set normal state series.setState(); }, /** * Set the state of the graph */ setState: function (state) { var series = this, options = series.options, graph = series.graph, stateOptions = options.states, lineWidth = options.lineWidth, attribs, i = 0; state = state || NORMAL_STATE; if (series.state !== state) { series.state = state; if (stateOptions[state] && stateOptions[state].enabled === false) { return; } if (state) { lineWidth = stateOptions[state].lineWidth || lineWidth + (stateOptions[state].lineWidthPlus || 0); // #4035 } if (graph && !graph.dashstyle) { // hover is turned off for dashed lines in VML attribs = { 'stroke-width': lineWidth }; // use attr because animate will cause any other animation on the graph to stop graph.attr(attribs); while (series['zoneGraph' + i]) { series['zoneGraph' + i].attr(attribs); i = i + 1; } } } }, /** * Set the visibility of the graph * * @param vis {Boolean} True to show the series, false to hide. If UNDEFINED, * the visibility is toggled. */ setVisible: function (vis, redraw) { var series = this, chart = series.chart, legendItem = series.legendItem, showOrHide, ignoreHiddenSeries = chart.options.chart.ignoreHiddenSeries, oldVisibility = series.visible; // if called without an argument, toggle visibility series.visible = vis = series.userOptions.visible = vis === UNDEFINED ? !oldVisibility : vis; showOrHide = vis ? 'show' : 'hide'; // show or hide elements each(['group', 'dataLabelsGroup', 'markerGroup', 'tracker'], function (key) { if (series[key]) { series[key][showOrHide](); } }); // hide tooltip (#1361) if (chart.hoverSeries === series || (chart.hoverPoint && chart.hoverPoint.series) === series) { series.onMouseOut(); } if (legendItem) { chart.legend.colorizeItem(series, vis); } // rescale or adapt to resized chart series.isDirty = true; // in a stack, all other series are affected if (series.options.stacking) { each(chart.series, function (otherSeries) { if (otherSeries.options.stacking && otherSeries.visible) { otherSeries.isDirty = true; } }); } // show or hide linked series each(series.linkedSeries, function (otherSeries) { otherSeries.setVisible(vis, false); }); if (ignoreHiddenSeries) { chart.isDirtyBox = true; } if (redraw !== false) { chart.redraw(); } fireEvent(series, showOrHide); }, /** * Show the graph */ show: function () { this.setVisible(true); }, /** * Hide the graph */ hide: function () { this.setVisible(false); }, /** * Set the selected state of the graph * * @param selected {Boolean} True to select the series, false to unselect. If * UNDEFINED, the selection state is toggled. */ select: function (selected) { var series = this; // if called without an argument, toggle series.selected = selected = (selected === UNDEFINED) ? !series.selected : selected; if (series.checkbox) { series.checkbox.checked = selected; } fireEvent(series, selected ? 'select' : 'unselect'); }, drawTracker: TrackerMixin.drawTrackerGraph }); // global variables extend(Highcharts, { // Constructors Color: Color, Point: Point, Tick: Tick, Renderer: Renderer, SVGElement: SVGElement, SVGRenderer: SVGRenderer, // Various arrayMin: arrayMin, arrayMax: arrayMax, charts: charts, dateFormat: dateFormat, error: error, format: format, pathAnim: pathAnim, getOptions: getOptions, hasBidiBug: hasBidiBug, isTouchDevice: isTouchDevice, setOptions: setOptions, addEvent: addEvent, removeEvent: removeEvent, createElement: createElement, discardElement: discardElement, css: css, each: each, map: map, merge: merge, splat: splat, stableSort: stableSort, extendClass: extendClass, pInt: pInt, svg: hasSVG, canvas: useCanVG, vml: !hasSVG && !useCanVG, product: PRODUCT, version: VERSION }); return Highcharts; }));
thingmenn-frontend/src/widgets/weekday-hour-matrix/index.js
baering/thingmenn
import React from 'react' import PropTypes from 'prop-types' import './styles.css' const dayNames = ['Sun', 'Mán', 'Þri', 'Mið', 'Fim', 'Fös', 'Lau'] const days = new Array(7).fill('').map((_, index) => `${index}`) const timeSlots = new Array(24).fill(0).map((_, index) => index + 1) const renderTimeSlot = (hours) => { if (hours === 24) { return '00:00' } return hours < 10 ? `0${hours}:00` : `${hours}:00` } const WeekdayHourMatrix = ({ weekdayHourMatrixSummary }) => { if ( !weekdayHourMatrixSummary || !weekdayHourMatrixSummary.statistics || !weekdayHourMatrixSummary.data ) { return null } const { data, statistics } = weekdayHourMatrixSummary const { max } = statistics return ( <div className="WeekdayHourMatrix"> <div className="WeekdayHourMatrix-Day"> <div className="WeekdayHourMatrix-DayValues"> <div className="WeekdayHourMatrix-DayValueContainer"> <p className="WeekdayHourMatrix-DayValue">&nbsp;</p> </div> {timeSlots.map((timeSlot) => ( <div key={`timeslotHeader_${timeSlot}`} className="WeekdayHourMatrix-DayValueContainer" > <p className="WeekdayHourMatrix-DayValue"> {renderTimeSlot(timeSlot)} </p> </div> ))} </div> </div> {days.map((dayIndex) => ( <div key={`dayHeader_${dayIndex}`} className="WeekdayHourMatrix-Day"> <div className="WeekdayHourMatrix-DayValues"> <div className="WeekdayHourMatrix-DayValueContainer"> <p className="WeekdayHourMatrix-DayValue">{dayNames[dayIndex]}</p> </div> {timeSlots.map((timeSlot) => { const value = data[dayIndex] ? data[dayIndex][timeSlot] || 0 : 0 const valueRatio = value / max const colorValue = valueRatio > 0 ? 0.02 + valueRatio * 0.55 : 0 const color = `rgba(255,0,0,${colorValue})` return ( <div key={`day_${dayIndex}_timeslot_${timeSlot}`} className="WeekdayHourMatrix-DayValueContainer" > <p className="WeekdayHourMatrix-DayValue" style={{ color: value === 0 ? 'rgba(0,0,0,0)' : 'inherit', backgroundColor: color, }} > {value === 0 ? '0' : value} </p> </div> ) })} </div> </div> ))} </div> ) } WeekdayHourMatrix.propTypes = { weekdayHourMatrixSummary: PropTypes.object, max: PropTypes.number, } export default WeekdayHourMatrix
packages/cockpit/ui/src/components/Block.js
iurimatias/embark-framework
import React from 'react'; import {Row, Col, Card, CardHeader, CardBody} from 'reactstrap'; import PropTypes from 'prop-types'; import Description from './Description'; import CardTitleIdenticon from './CardTitleIdenticon'; const Block = ({block}) => ( <Row> <Col> <Card> <CardHeader> <CardTitleIdenticon id={block.hash}>Block {block.number}</CardTitleIdenticon> </CardHeader> <CardBody> <dl className="row"> <Description label="Hash" value={block.hash} /> <Description label="Timestamp" value={block.timestamp} /> <Description label="Difficulty" value={block.difficulty} /> <Description label="Gas used" value={block.gasUsed} /> <Description label="Gas limit" value={block.gasLimit} /> <Description label="Miner" value={block.miner} /> <Description label="Mix hash" value={block.mixHash} /> <Description label="Nonce" value={block.nonce} /> <Description label="Parent hash" value={block.parentHash} /> <Description label="Transaction root" value={block.transactionsRoot} /> <Description label="Receipts root" value={block.receiptsRoot} /> <Description label="State root" value={block.stateRoot} /> <Description label="SHA3 uncles" value={block.sha3Uncles} /> <Description label="Size" value={block.size} /> <Description label="Total difficulty" value={block.totalDifficulty} /> <Description label="Extra data" value={block.extraData} /> <Description label="Logs bloom" value={block.logsBloom} /> </dl> </CardBody> </Card> </Col> </Row> ); Block.propTypes = { block: PropTypes.object }; export default Block;
node_modules/react-icons/fa/hand-grab-o.js
bairrada97/festival
import React from 'react' import Icon from 'react-icon-base' const FaHandGrabO = props => ( <Icon viewBox="0 0 40 40" {...props}> <g><path d="m20.1 8.6q-1.1 0-2 0.8t-0.8 2v2.9h-0.7v-2.1q0-1.1-0.7-1.8t-1.8-0.8q-1.1 0-1.8 0.8t-0.7 1.7v9.6l-0.7-0.7v-3.8q0-1.1-0.8-1.8t-1.7-0.8q-1.1 0-1.8 0.8t-0.7 1.7v5q0 1.1 0.7 1.9l7 6.6q0.8 0.8 0.8 2.3 0 0.5 0.5 1t1 0.4h14.2q0.6 0 1-0.4t0.5-1v-0.6q0-0.9 0.2-1.7l2.4-9.8q0.2-0.8 0.2-1.7v-5.5q0-1-0.7-1.8t-1.8-0.7q-1 0-1.7 0.7t-0.8 1.8v0.7h-0.7v-2.8q0-0.9-0.5-1.6t-1.5-0.9q-0.3-0.1-0.5-0.1-1 0-1.8 0.8t-0.7 1.7v2.9h-0.7v-2.7q0-1.2-0.7-2t-1.9-1q-0.1 0-0.3 0z m0-2.9q1.9 0 3.4 1.1 1.2-0.7 2.7-0.7 1.3 0 2.5 0.6t1.9 1.7q0.6-0.2 1.3-0.2 2.3 0 3.8 1.6t1.6 3.8v5.5q0 1.2-0.3 2.4l-2.4 9.8q-0.2 0.5-0.2 1.6 0 1.7-1.2 3t-3.1 1.2h-14.2q-1.9 0-3.1-1.3t-1.2-3.1l-6.9-6.7q-1.7-1.6-1.7-3.9v-5q0-2.2 1.6-3.7t3.8-1.6q0.2 0 0.3 0 0.1-2.1 1.7-3.6t3.7-1.4q1.1 0 2.2 0.5 1.6-1.6 3.8-1.6z"/></g> </Icon> ) export default FaHandGrabO
files/firebase/3.0.5/firebase.js
Asaf-S/jsdelivr
/*! @license Firebase v3.0.5 Build: 3.0.5-rc.2 Terms: https://developers.google.com/terms */ (function() { var h="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,l=function(){h.Symbol||(h.Symbol=aa);l=function(){}},ba=0,aa=function(a){return"jscomp_symbol_"+a+ba++},m=function(){l();h.Symbol.iterator||(h.Symbol.iterator=h.Symbol("iterator"));m=function(){}},ca=function(){var a=["next","error","complete"];m();if(a[h.Symbol.iterator])return a[h.Symbol.iterator]();var b=0;return{next:function(){return b==a.length?{done:!0}:{done:!1,value:a[b++]}}}},p=function(){return{done:!0, value:void 0}},q=function(a,b){a instanceof String&&(a=String(a));var c=0;l();m();var d={},e=(d.next=function(){if(c<a.length){var d=c++;return{value:b(d,a[d]),done:!1}}e.next=p;return p()},d[Symbol.iterator]=function(){return e},d);return e},r=function(a,b){!Array.prototype[a]&&Object.defineProperties&&Object.defineProperty&&Object.defineProperty(Array.prototype,a,{configurable:!0,enumerable:!1,writable:!0,value:b})},t=function(a,b){if(null==a)throw new TypeError("The 'this' value for String.prototype."+ b+" must not be null or undefined");},u=function(a,b){if(a instanceof RegExp)throw new TypeError("First argument to String.prototype."+b+" must not be a regular expression");},da=function(a){t(this,"repeat");var b=String(this);if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var c="";a;)if(a&1&&(c+=b),a>>>=1)b+=b;return c},ea=function(a){t(this,"codePointAt");var b=String(this),c=b.length;a=Number(a)||0;if(0<=a&&a<c){a|=0;var d=b.charCodeAt(a);if(55296>d||56319<d||a+1===c)return d; a=b.charCodeAt(a+1);return 56320>a||57343<a?d:1024*(d-55296)+a+9216}},fa=function(a,b){b=void 0===b?0:b;u(a,"includes");t(this,"includes");return-1!==String(this).indexOf(a,b)},ga=function(a,b){b=void 0===b?0:b;u(a,"startsWith");t(this,"startsWith");var c=String(this);a+="";var d=c.length,e=a.length;b=Math.max(0,Math.min(b|0,c.length));for(var f=0;f<e&&b<d;)if(c[b++]!=a[f++])return!1;return f>=e},ha=function(a,b){u(a,"endsWith");t(this,"endsWith");var c=String(this);a+="";void 0===b&&(b=c.length); b=Math.max(0,Math.min(b|0,c.length));for(var d=a.length;0<d&&0<b;)if(c[--b]!=a[--d])return!1;return 0>=d};String.prototype.endsWith||(String.prototype.endsWith=ha);String.prototype.startsWith||(String.prototype.startsWith=ga);String.prototype.includes||(String.prototype.includes=fa);String.prototype.codePointAt||(String.prototype.codePointAt=ea);String.prototype.repeat||(String.prototype.repeat=da);r("values",function(){return q(this,function(a,b){return b})});r("keys",function(){return q(this,function(a){return a})}); r("entries",function(){return q(this,function(a,b){return[a,b]})}); var v=this,w=function(){},x=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; else if("function"==b&&"undefined"==typeof a.call)return"object";return b},y=function(a){return"function"==x(a)},ia=function(a,b,c){return a.call.apply(a.bind,arguments)},ja=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}},z=function(a,b,c){z=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")? ia:ja;return z.apply(null,arguments)},ka=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}},la=function(a,b){function c(){}c.prototype=b.prototype;a.ba=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.aa=function(a,c,f){for(var k=Array(arguments.length-2),g=2;g<arguments.length;g++)k[g-2]=arguments[g];return b.prototype[c].apply(a,k)}};function __extends(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)} function __decorate(a,b,c,d){var e=arguments.length,f=3>e?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,k;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var g=a.length-1;0<=g;g--)if(k=a[g])f=(3>e?k(f):3<e?k(b,c,f):k(b,c))||f;return 3<e&&f&&Object.defineProperty(b,c,f),f}function __metadata(a,b){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(a,b)} var __param=function(a,b){return function(c,d){b(c,d,a)}},__awaiter=function(a,b,c,d){return new (c||(c=Promise))(function(e,f){function k(a){try{n(d.next(a))}catch(b){f(b)}}function g(a){try{n(d.throw(a))}catch(b){f(b)}}function n(a){a.done?e(a.value):(new c(function(b){b(a.value)})).then(k,g)}n((d=d.apply(a,b)).next())})};var A=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,A);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))};la(A,Error);A.prototype.name="CustomError";var ma=function(a,b){for(var c=a.split("%s"),d="",e=Array.prototype.slice.call(arguments,1);e.length&&1<c.length;)d+=c.shift()+e.shift();return d+c.join("%s")};var B=function(a,b){b.unshift(a);A.call(this,ma.apply(null,b));b.shift()};la(B,A);B.prototype.name="AssertionError";var na=function(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),f=d;else a&&(e+=": "+a,f=b);throw new B(""+e,f||[]);},C=function(a,b,c){a||na("",null,b,Array.prototype.slice.call(arguments,2))},D=function(a,b,c){y(a)||na("Expected function but got %s: %s.",[x(a),a],b,Array.prototype.slice.call(arguments,2))};var E=function(a,b,c){this.S=c;this.L=a;this.U=b;this.s=0;this.o=null};E.prototype.get=function(){var a;0<this.s?(this.s--,a=this.o,this.o=a.next,a.next=null):a=this.L();return a};E.prototype.put=function(a){this.U(a);this.s<this.S&&(this.s++,a.next=this.o,this.o=a)};var F;a:{var oa=v.navigator;if(oa){var pa=oa.userAgent;if(pa){F=pa;break a}}F=""};var qa=function(a){v.setTimeout(function(){throw a;},0)},G,ra=function(){var a=v.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&-1==F.indexOf("Presto")&&(a=function(){var a=document.createElement("IFRAME");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write("");a.close();var c="callImmediate"+Math.random(),d="file:"==b.location.protocol?"*":b.location.protocol+ "//"+b.location.host,a=z(function(a){if(("*"==d||a.origin==d)&&a.data==c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof a&&-1==F.indexOf("Trident")&&-1==F.indexOf("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(void 0!==c.next){c=c.next;var a=c.F;c.F=null;a()}};return function(a){d.next={F:a};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(a){var b=document.createElement("SCRIPT");b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){v.setTimeout(a,0)}};var H=function(){this.v=this.f=null},sa=new E(function(){return new I},function(a){a.reset()},100);H.prototype.add=function(a,b){var c=sa.get();c.set(a,b);this.v?this.v.next=c:(C(!this.f),this.f=c);this.v=c};H.prototype.remove=function(){var a=null;this.f&&(a=this.f,this.f=this.f.next,this.f||(this.v=null),a.next=null);return a};var I=function(){this.next=this.scope=this.B=null};I.prototype.set=function(a,b){this.B=a;this.scope=b;this.next=null}; I.prototype.reset=function(){this.next=this.scope=this.B=null};var L=function(a,b){J||ta();K||(J(),K=!0);ua.add(a,b)},J,ta=function(){if(v.Promise&&v.Promise.resolve){var a=v.Promise.resolve(void 0);J=function(){a.then(va)}}else J=function(){var a=va,c;!(c=!y(v.setImmediate))&&(c=v.Window&&v.Window.prototype)&&(c=-1==F.indexOf("Edge")&&v.Window.prototype.setImmediate==v.setImmediate);c?(G||(G=ra()),G(a)):v.setImmediate(a)}},K=!1,ua=new H,va=function(){for(var a;a=ua.remove();){try{a.B.call(a.scope)}catch(b){qa(b)}sa.put(a)}K=!1};var O=function(a,b){this.b=0;this.K=void 0;this.j=this.g=this.u=null;this.m=this.A=!1;if(a!=w)try{var c=this;a.call(b,function(a){M(c,2,a)},function(a){try{if(a instanceof Error)throw a;throw Error("Promise rejected.");}catch(b){}M(c,3,a)})}catch(d){M(this,3,d)}},wa=function(){this.next=this.context=this.h=this.c=this.child=null;this.w=!1};wa.prototype.reset=function(){this.context=this.h=this.c=this.child=null;this.w=!1}; var xa=new E(function(){return new wa},function(a){a.reset()},100),ya=function(a,b,c){var d=xa.get();d.c=a;d.h=b;d.context=c;return d},Aa=function(a,b,c){za(a,b,c,null)||L(ka(b,a))};O.prototype.then=function(a,b,c){null!=a&&D(a,"opt_onFulfilled should be a function.");null!=b&&D(b,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");return Ba(this,y(a)?a:null,y(b)?b:null,c)};O.prototype.then=O.prototype.then;O.prototype.$goog_Thenable=!0; O.prototype.X=function(a,b){return Ba(this,null,a,b)};var Da=function(a,b){a.g||2!=a.b&&3!=a.b||Ca(a);C(null!=b.c);a.j?a.j.next=b:a.g=b;a.j=b},Ba=function(a,b,c,d){var e=ya(null,null,null);e.child=new O(function(a,k){e.c=b?function(c){try{var e=b.call(d,c);a(e)}catch(N){k(N)}}:a;e.h=c?function(b){try{var e=c.call(d,b);a(e)}catch(N){k(N)}}:k});e.child.u=a;Da(a,e);return e.child};O.prototype.Y=function(a){C(1==this.b);this.b=0;M(this,2,a)};O.prototype.Z=function(a){C(1==this.b);this.b=0;M(this,3,a)}; var M=function(a,b,c){0==a.b&&(a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself")),a.b=1,za(c,a.Y,a.Z,a)||(a.K=c,a.b=b,a.u=null,Ca(a),3!=b||Ea(a,c)))},za=function(a,b,c,d){if(a instanceof O)return null!=b&&D(b,"opt_onFulfilled should be a function."),null!=c&&D(c,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?"),Da(a,ya(b||w,c||null,d)),!0;var e;if(a)try{e=!!a.$goog_Thenable}catch(k){e=!1}else e=!1;if(e)return a.then(b,c,d), !0;e=typeof a;if("object"==e&&null!=a||"function"==e)try{var f=a.then;if(y(f))return Fa(a,f,b,c,d),!0}catch(k){return c.call(d,k),!0}return!1},Fa=function(a,b,c,d,e){var f=!1,k=function(a){f||(f=!0,c.call(e,a))},g=function(a){f||(f=!0,d.call(e,a))};try{b.call(a,k,g)}catch(n){g(n)}},Ca=function(a){a.A||(a.A=!0,L(a.N,a))},Ga=function(a){var b=null;a.g&&(b=a.g,a.g=b.next,b.next=null);a.g||(a.j=null);null!=b&&C(null!=b.c);return b}; O.prototype.N=function(){for(var a;a=Ga(this);){var b=this.b,c=this.K;if(3==b&&a.h&&!a.w){var d;for(d=this;d&&d.m;d=d.u)d.m=!1}if(a.child)a.child.u=null,Ha(a,b,c);else try{a.w?a.c.call(a.context):Ha(a,b,c)}catch(e){Ia.call(null,e)}xa.put(a)}this.A=!1};var Ha=function(a,b,c){2==b?a.c.call(a.context,c):a.h&&a.h.call(a.context,c)},Ea=function(a,b){a.m=!0;L(function(){a.m&&Ia.call(null,b)})},Ia=qa;function P(a,b){if(!(b instanceof Object))return b;switch(b.constructor){case Date:return new Date(b.getTime());case Object:void 0===a&&(a={});break;case Array:a=[];break;default:return b}for(var c in b)b.hasOwnProperty(c)&&(a[c]=P(a[c],b[c]));return a};var Ja=Error.captureStackTrace,R=function(a,b){this.code=a;this.message=b;if(Ja)Ja(this,Q.prototype.create);else{var c=Error.apply(this,arguments);this.name="FirebaseError";Object.defineProperty(this,"stack",{get:function(){return c.stack}})}};R.prototype=Object.create(Error.prototype);R.prototype.constructor=R;R.prototype.name="FirebaseError";var Q=function(a,b,c){this.V=a;this.W=b;this.M=c;this.pattern=/\{\$([^}]+)}/g}; Q.prototype.create=function(a,b){void 0===b&&(b={});var c=this.M[a];a=this.V+"/"+a;var c=void 0===c?"Error":c.replace(this.pattern,function(a,c){return void 0!==b[c]?b[c].toString():"<"+c+"?>"}),c=this.W+": "+c+" ("+a+").",c=new R(a,c),d;for(d in b)b.hasOwnProperty(d)&&"_"!==d.slice(-1)&&(c[d]=b[d]);return c};O.all=function(a){return new O(function(b,c){var d=a.length,e=[];if(d)for(var f=function(a,c){d--;e[a]=c;0==d&&b(e)},k=function(a){c(a)},g=0,n;g<a.length;g++)n=a[g],Aa(n,ka(f,g),k);else b(e)})};O.resolve=function(a){if(a instanceof O)return a;var b=new O(w);M(b,2,a);return b};O.reject=function(a){return new O(function(b,c){c(a)})};O.prototype["catch"]=O.prototype.X;var S=O;"undefined"!==typeof Promise&&(S=Promise);var Ka=S;function La(a,b){a=new T(a,b);return a.subscribe.bind(a)}var T=function(a,b){var c=this;this.a=[];this.J=0;this.task=Ka.resolve();this.l=!1;this.D=b;this.task.then(function(){a(c)}).catch(function(a){c.error(a)})};T.prototype.next=function(a){U(this,function(b){b.next(a)})};T.prototype.error=function(a){U(this,function(b){b.error(a)});this.close(a)};T.prototype.complete=function(){U(this,function(a){a.complete()});this.close()}; T.prototype.subscribe=function(a,b,c){var d=this,e;if(void 0===a&&void 0===b&&void 0===c)throw Error("Missing Observer.");e=Ma(a)?a:{next:a,error:b,complete:c};void 0===e.next&&(e.next=V);void 0===e.error&&(e.error=V);void 0===e.complete&&(e.complete=V);a=this.$.bind(this,this.a.length);this.l&&this.task.then(function(){try{d.G?e.error(d.G):e.complete()}catch(a){}});this.a.push(e);return a}; T.prototype.$=function(a){void 0!==this.a&&void 0!==this.a[a]&&(this.a[a]=void 0,--this.J,0===this.J&&void 0!==this.D&&this.D(this))};var U=function(a,b){if(!a.l)for(var c=0;c<a.a.length;c++)Na(a,c,b)},Na=function(a,b,c){a.task.then(function(){if(void 0!==a.a&&void 0!==a.a[b])try{c(a.a[b])}catch(d){}})};T.prototype.close=function(a){var b=this;this.l||(this.l=!0,void 0!==a&&(this.G=a),this.task.then(function(){b.a=void 0;b.D=void 0}))}; function Ma(a){if("object"!==typeof a||null===a)return!1;for(var b=ca(),c=b.next();!c.done;c=b.next())if(c=c.value,c in a&&"function"===typeof a[c])return!0;return!1}function V(){};var W=S,X=function(a,b,c){var d=this;this.H=c;this.I=!1;this.i={};this.P={};this.C=b;this.T=P(void 0,a);Object.keys(c.INTERNAL.factories).forEach(function(a){d[a]=d.R.bind(d,a)})};X.prototype.delete=function(){var a=this;return(new W(function(b){Y(a);b()})).then(function(){a.H.INTERNAL.removeApp(a.C);return W.all(Object.keys(a.i).map(function(b){return a.i[b].INTERNAL.delete()}))}).then(function(){a.I=!0;a.i=null;a.P=null})}; X.prototype.R=function(a){Y(this);void 0===this.i[a]&&(this.i[a]=this.H.INTERNAL.factories[a](this,this.O.bind(this)));return this.i[a]};X.prototype.O=function(a){P(this,a)};var Y=function(a){a.I&&Z(Oa("deleted",{name:a.C}))};Object.defineProperties(X.prototype,{name:{configurable:!0,enumerable:!0,get:function(){Y(this);return this.C}},options:{configurable:!0,enumerable:!0,get:function(){Y(this);return this.T}}});X.prototype.name&&X.prototype.options||X.prototype.delete||console.log("dc"); function Pa(){function a(a){a=a||"[DEFAULT]";var c=b[a];void 0===c&&Z("noApp",{name:a});return c}var b={},c={},d=[],e={initializeApp:function(a,c){void 0===c?c="[DEFAULT]":"string"===typeof c&&""!==c||Z("bad-app-name",{name:c+""});void 0!==b[c]&&Z("dupApp",{name:c});var g=new X(a,c,e);b[c]=g;d.forEach(function(a){return a("create",g)});void 0!=g.INTERNAL&&void 0!=g.INTERNAL.getToken||P(g,{INTERNAL:{getToken:function(){return W.resolve(null)},addAuthTokenListener:function(){},removeAuthTokenListener:function(){}}}); return g},app:a,apps:null,Promise:W,SDK_VERSION:"0.0.0",INTERNAL:{registerService:function(b,d,g){c[b]&&Z("dupService",{name:b});c[b]=d;d=function(c){void 0===c&&(c=a());return c[b]()};void 0!==g&&P(d,g);return e[b]=d},createFirebaseNamespace:Pa,extendNamespace:function(a){P(e,a)},createSubscribe:La,ErrorFactory:Q,registerAppHook:function(a){d.push(a)},removeApp:function(a){d.forEach(function(c){return c("delete",b[a])});delete b[a]},factories:c,Promise:O,deepExtend:P}};Object.defineProperty(e,"apps", {get:function(){return Object.keys(b).map(function(a){return b[a]})}});a.App=X;return e}function Z(a,b){throw Error(Oa(a,b));} function Oa(a,b){b=b||{};b={noApp:"No Firebase App '"+b.name+"' has been created - call Firebase App.initializeApp().","bad-app-name":"Illegal App name: '"+b.name+"'.",dupApp:"Firebase App named '"+b.name+"' already exists.",deleted:"Firebase App named '"+b.name+"' already deleted.",dupService:"Firebase Service named '"+b.name+"' already registered."}[a];return void 0===b?"Application Error: ("+a+")":b};"undefined"!==typeof window&&(window.firebase=Pa()); })(); firebase.SDK_VERSION = "3.0.5"; (function(){var k,aa=aa||{},l=this,ba=function(){},ca=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&& !a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==b&&"undefined"==typeof a.call)return"object";return b},da=function(a){return null===a},ea=function(a){return"array"==ca(a)},fa=function(a){var b=ca(a);return"array"==b||"object"==b&&"number"==typeof a.length},m=function(a){return"string"==typeof a},ga=function(a){return"number"==typeof a},n=function(a){return"function"==ca(a)},ha=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b},ia=function(a, b,c){return a.call.apply(a.bind,arguments)},ja=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}},p=function(a,b,c){p=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ia:ja;return p.apply(null,arguments)},ka=function(a,b){var c=Array.prototype.slice.call(arguments, 1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}},la=Date.now||function(){return+new Date},q=function(a,b){function c(){}c.prototype=b.prototype;a.Bc=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Ce=function(a,c,f){for(var g=Array(arguments.length-2),h=2;h<arguments.length;h++)g[h-2]=arguments[h];return b.prototype[c].apply(a,g)}};var t=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))};q(t,Error);t.prototype.name="CustomError";var ma=function(a,b){for(var c=a.split("%s"),d="",e=Array.prototype.slice.call(arguments,1);e.length&&1<c.length;)d+=c.shift()+e.shift();return d+c.join("%s")},na=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},oa=/&/g,pa=/</g,qa=/>/g,ra=/"/g,sa=/'/g,ta=/\x00/g,ua=/[\x00&<>"']/,u=function(a,b){return-1!=a.indexOf(b)},va=function(a,b){return a<b?-1:a>b?1:0};var wa=function(a,b){b.unshift(a);t.call(this,ma.apply(null,b));b.shift()};q(wa,t);wa.prototype.name="AssertionError"; var xa=function(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),f=d;else a&&(e+=": "+a,f=b);throw new wa(""+e,f||[]);},v=function(a,b,c){a||xa("",null,b,Array.prototype.slice.call(arguments,2))},ya=function(a,b){throw new wa("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));},za=function(a,b,c){ga(a)||xa("Expected number but got %s: %s.",[ca(a),a],b,Array.prototype.slice.call(arguments,2));return a},Aa=function(a,b,c){m(a)||xa("Expected string but got %s: %s.",[ca(a),a],b,Array.prototype.slice.call(arguments, 2));return a},Ba=function(a,b,c){n(a)||xa("Expected function but got %s: %s.",[ca(a),a],b,Array.prototype.slice.call(arguments,2))};var Ca=Array.prototype.indexOf?function(a,b,c){v(null!=a.length);return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(m(a))return m(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},w=Array.prototype.forEach?function(a,b,c){v(null!=a.length);Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=m(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},Da=function(a,b){for(var c=m(a)? a.split(""):a,d=a.length-1;0<=d;--d)d in c&&b.call(void 0,c[d],d,a)},Ea=Array.prototype.map?function(a,b,c){v(null!=a.length);return Array.prototype.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=m(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},Fa=Array.prototype.some?function(a,b,c){v(null!=a.length);return Array.prototype.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=m(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return!0;return!1}, Ha=function(a){var b;a:{b=Ga;for(var c=a.length,d=m(a)?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(void 0,d[e],e,a)){b=e;break a}b=-1}return 0>b?null:m(a)?a.charAt(b):a[b]},Ia=function(a,b){return 0<=Ca(a,b)},Ka=function(a,b){var c=Ca(a,b),d;(d=0<=c)&&Ja(a,c);return d},Ja=function(a,b){v(null!=a.length);return 1==Array.prototype.splice.call(a,b,1).length},La=function(a,b){var c=0;Da(a,function(d,e){b.call(void 0,d,e,a)&&Ja(a,e)&&c++})},Ma=function(a){return Array.prototype.concat.apply(Array.prototype, arguments)},Na=function(a){return Array.prototype.concat.apply(Array.prototype,arguments)},Oa=function(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]},Pa=function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(fa(d)){var e=a.length||0,f=d.length||0;a.length=e+f;for(var g=0;g<f;g++)a[e+g]=d[g]}else a.push(d)}};var Qa=function(a,b){for(var c in a)b.call(void 0,a[c],c,a)},Ra=function(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b},Sa=function(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b},Ta=function(a){for(var b in a)return!1;return!0},Ua=function(a,b){for(var c in a)if(!(c in b)||a[c]!==b[c])return!1;for(c in b)if(!(c in a))return!1;return!0},Va=function(a){var b={},c;for(c in a)b[c]=a[c];return b},Wa="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "), Xa=function(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<Wa.length;f++)c=Wa[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var $a;a:{var ab=l.navigator;if(ab){var bb=ab.userAgent;if(bb){$a=bb;break a}}$a=""}var x=function(a){return u($a,a)};var cb=x("Opera"),y=x("Trident")||x("MSIE"),db=x("Edge"),eb=db||y,fb=x("Gecko")&&!(u($a.toLowerCase(),"webkit")&&!x("Edge"))&&!(x("Trident")||x("MSIE"))&&!x("Edge"),gb=u($a.toLowerCase(),"webkit")&&!x("Edge"),hb=function(){var a=l.document;return a?a.documentMode:void 0},ib; a:{var jb="",kb=function(){var a=$a;if(fb)return/rv\:([^\);]+)(\)|;)/.exec(a);if(db)return/Edge\/([\d\.]+)/.exec(a);if(y)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(gb)return/WebKit\/(\S+)/.exec(a);if(cb)return/(?:Version)[ \/]?(\S+)/.exec(a)}();kb&&(jb=kb?kb[1]:"");if(y){var lb=hb();if(null!=lb&&lb>parseFloat(jb)){ib=String(lb);break a}}ib=jb} var mb=ib,nb={},z=function(a){var b;if(!(b=nb[a])){b=0;for(var c=na(String(mb)).split("."),d=na(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var g=c[f]||"",h=d[f]||"",r=RegExp("(\\d*)(\\D*)","g"),Z=RegExp("(\\d*)(\\D*)","g");do{var Ya=r.exec(g)||["","",""],Za=Z.exec(h)||["","",""];if(0==Ya[0].length&&0==Za[0].length)break;b=va(0==Ya[1].length?0:parseInt(Ya[1],10),0==Za[1].length?0:parseInt(Za[1],10))||va(0==Ya[2].length,0==Za[2].length)||va(Ya[2],Za[2])}while(0==b)}b=nb[a]= 0<=b}return b},ob=l.document,pb=ob&&y?hb()||("CSS1Compat"==ob.compatMode?parseInt(mb,10):5):void 0;var qb=null,rb=null,tb=function(a){var b="";sb(a,function(a){b+=String.fromCharCode(a)});return b},sb=function(a,b){function c(b){for(;d<a.length;){var c=a.charAt(d++),e=rb[c];if(null!=e)return e;if(!/^[\s\xa0]*$/.test(c))throw Error("Unknown base64 encoding at char: "+c);}return b}ub();for(var d=0;;){var e=c(-1),f=c(0),g=c(64),h=c(64);if(64===h&&-1===e)break;b(e<<2|f>>4);64!=g&&(b(f<<4&240|g>>2),64!=h&&b(g<<6&192|h))}},ub=function(){if(!qb){qb={};rb={};for(var a=0;65>a;a++)qb[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a), rb[qb[a]]=a,62<=a&&(rb["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var wb=function(){this.Rb="";this.Ad=vb};wb.prototype.kc=!0;wb.prototype.ic=function(){return this.Rb};wb.prototype.toString=function(){return"Const{"+this.Rb+"}"};var xb=function(a){if(a instanceof wb&&a.constructor===wb&&a.Ad===vb)return a.Rb;ya("expected object of type Const, got '"+a+"'");return"type_error:Const"},vb={};var A=function(){this.ca="";this.zd=yb};A.prototype.kc=!0;A.prototype.ic=function(){return this.ca};A.prototype.toString=function(){return"SafeUrl{"+this.ca+"}"}; var zb=function(a){if(a instanceof A&&a.constructor===A&&a.zd===yb)return a.ca;ya("expected object of type SafeUrl, got '"+a+"' of type "+ca(a));return"type_error:SafeUrl"},Ab=/^(?:(?:https?|mailto|ftp):|[^&:/?#]*(?:[/?#]|$))/i,Cb=function(a){if(a instanceof A)return a;a=a.kc?a.ic():String(a);Ab.test(a)||(a="about:invalid#zClosurez");return Bb(a)},yb={},Bb=function(a){var b=new A;b.ca=a;return b};Bb("about:blank");var Eb=function(){this.ca="";this.yd=Db};Eb.prototype.kc=!0;Eb.prototype.ic=function(){return this.ca};Eb.prototype.toString=function(){return"SafeHtml{"+this.ca+"}"};var Fb=function(a){if(a instanceof Eb&&a.constructor===Eb&&a.yd===Db)return a.ca;ya("expected object of type SafeHtml, got '"+a+"' of type "+ca(a));return"type_error:SafeHtml"},Db={};Eb.prototype.ce=function(a){this.ca=a;return this};var Gb=function(a,b){var c;c=b instanceof A?b:Cb(b);a.href=zb(c)};var Hb=function(a){Hb[" "](a);return a};Hb[" "]=ba;var Ib=!y||9<=Number(pb),Jb=y&&!z("9");!gb||z("528");fb&&z("1.9b")||y&&z("8")||cb&&z("9.5")||gb&&z("528");fb&&!z("8")||y&&z("9");var Kb=function(){this.sa=this.sa;this.Ib=this.Ib};Kb.prototype.sa=!1;Kb.prototype.isDisposed=function(){return this.sa};Kb.prototype.Ha=function(){if(this.Ib)for(;this.Ib.length;)this.Ib.shift()()};var Lb=function(a,b){this.type=a;this.currentTarget=this.target=b;this.defaultPrevented=this.Pa=!1;this.jd=!0};Lb.prototype.preventDefault=function(){this.defaultPrevented=!0;this.jd=!1};var Mb=function(a,b){Lb.call(this,a?a.type:"");this.relatedTarget=this.currentTarget=this.target=null;this.charCode=this.keyCode=this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.wb=this.state=null;a&&this.init(a,b)};q(Mb,Lb); Mb.prototype.init=function(a,b){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.currentTarget=b;var e=a.relatedTarget;if(e){if(fb){var f;a:{try{Hb(e.nodeName);f=!0;break a}catch(g){}f=!1}f||(e=null)}}else"mouseover"==c?e=a.fromElement:"mouseout"==c&&(e=a.toElement);this.relatedTarget=e;null===d?(this.offsetX=gb||void 0!==a.offsetX?a.offsetX:a.layerX,this.offsetY=gb||void 0!==a.offsetY?a.offsetY:a.layerY,this.clientX=void 0!==a.clientX?a.clientX: a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0);this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;this.wb=a;a.defaultPrevented&& this.preventDefault()};Mb.prototype.preventDefault=function(){Mb.Bc.preventDefault.call(this);var a=this.wb;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Jb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var Nb="closure_listenable_"+(1E6*Math.random()|0),Ob=0;var Pb=function(a,b,c,d,e){this.listener=a;this.Kb=null;this.src=b;this.type=c;this.tb=!!d;this.Cb=e;this.key=++Ob;this.Ra=this.sb=!1},Qb=function(a){a.Ra=!0;a.listener=null;a.Kb=null;a.src=null;a.Cb=null};var Rb=function(a){this.src=a;this.v={};this.rb=0};Rb.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.v[f];a||(a=this.v[f]=[],this.rb++);var g=Sb(a,b,d,e);-1<g?(b=a[g],c||(b.sb=!1)):(b=new Pb(b,this.src,f,!!d,e),b.sb=c,a.push(b));return b};Rb.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.v))return!1;var e=this.v[a];b=Sb(e,b,c,d);return-1<b?(Qb(e[b]),Ja(e,b),0==e.length&&(delete this.v[a],this.rb--),!0):!1}; var Tb=function(a,b){var c=b.type;c in a.v&&Ka(a.v[c],b)&&(Qb(b),0==a.v[c].length&&(delete a.v[c],a.rb--))};Rb.prototype.gc=function(a,b,c,d){a=this.v[a.toString()];var e=-1;a&&(e=Sb(a,b,c,d));return-1<e?a[e]:null};var Sb=function(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.Ra&&f.listener==b&&f.tb==!!c&&f.Cb==d)return e}return-1};var Ub="closure_lm_"+(1E6*Math.random()|0),Vb={},Wb=0,Xb=function(a,b,c,d,e){if(ea(b))for(var f=0;f<b.length;f++)Xb(a,b[f],c,d,e);else c=Yb(c),a&&a[Nb]?Zb(a,b,c,d,e):$b(a,b,c,!1,d,e)},$b=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=!!e,h=ac(a);h||(a[Ub]=h=new Rb(a));c=h.add(b,c,d,e,f);if(!c.Kb){d=bc();c.Kb=d;d.src=a;d.listener=c;if(a.addEventListener)a.addEventListener(b.toString(),d,g);else if(a.attachEvent)a.attachEvent(cc(b.toString()),d);else throw Error("addEventListener and attachEvent are unavailable."); Wb++}},bc=function(){var a=dc,b=Ib?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b},ec=function(a,b,c,d,e){if(ea(b))for(var f=0;f<b.length;f++)ec(a,b[f],c,d,e);else c=Yb(c),a&&a[Nb]?fc(a,b,c,d,e):$b(a,b,c,!0,d,e)},gc=function(a,b,c,d,e){if(ea(b))for(var f=0;f<b.length;f++)gc(a,b[f],c,d,e);else c=Yb(c),a&&a[Nb]?a.T.remove(String(b),c,d,e):a&&(a=ac(a))&&(b=a.gc(b,c,!!d,e))&&hc(b)},hc=function(a){if(!ga(a)&&a&&!a.Ra){var b=a.src;if(b&& b[Nb])Tb(b.T,a);else{var c=a.type,d=a.Kb;b.removeEventListener?b.removeEventListener(c,d,a.tb):b.detachEvent&&b.detachEvent(cc(c),d);Wb--;(c=ac(b))?(Tb(c,a),0==c.rb&&(c.src=null,b[Ub]=null)):Qb(a)}}},cc=function(a){return a in Vb?Vb[a]:Vb[a]="on"+a},jc=function(a,b,c,d){var e=!0;if(a=ac(a))if(b=a.v[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.tb==c&&!f.Ra&&(f=ic(f,d),e=e&&!1!==f)}return e},ic=function(a,b){var c=a.listener,d=a.Cb||a.src;a.sb&&hc(a);return c.call(d,b)},dc=function(a, b){if(a.Ra)return!0;if(!Ib){var c;if(!(c=b))a:{c=["window","event"];for(var d=l,e;e=c.shift();)if(null!=d[e])d=d[e];else{c=null;break a}c=d}e=c;c=new Mb(e,this);d=!0;if(!(0>e.keyCode||void 0!=e.returnValue)){a:{var f=!1;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(r){f=!0}if(f||void 0==e.returnValue)e.returnValue=!0}e=[];for(f=c.currentTarget;f;f=f.parentNode)e.push(f);for(var f=a.type,g=e.length-1;!c.Pa&&0<=g;g--){c.currentTarget=e[g];var h=jc(e[g],f,!0,c),d=d&&h}for(g=0;!c.Pa&&g<e.length;g++)c.currentTarget= e[g],h=jc(e[g],f,!1,c),d=d&&h}return d}return ic(a,new Mb(b,this))},ac=function(a){a=a[Ub];return a instanceof Rb?a:null},kc="__closure_events_fn_"+(1E9*Math.random()>>>0),Yb=function(a){v(a,"Listener can not be null.");if(n(a))return a;v(a.handleEvent,"An object listener must have handleEvent method.");a[kc]||(a[kc]=function(b){return a.handleEvent(b)});return a[kc]};var lc=/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/;var mc=function(a){a=String(a);if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);},pc=function(a){var b=[];nc(new oc,a,b);return b.join("")},oc=function(){this.Nb=void 0},nc=function(a,b,c){if(null== b)c.push("null");else{if("object"==typeof b){if(ea(b)){var d=b;b=d.length;c.push("[");for(var e="",f=0;f<b;f++)c.push(e),e=d[f],nc(a,a.Nb?a.Nb.call(d,String(f),e):e,c),e=",";c.push("]");return}if(b instanceof String||b instanceof Number||b instanceof Boolean)b=b.valueOf();else{c.push("{");f="";for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(e=b[d],"function"!=typeof e&&(c.push(f),qc(d,c),c.push(":"),nc(a,a.Nb?a.Nb.call(b,d,e):e,c),f=","));c.push("}");return}}switch(typeof b){case "string":qc(b, c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?String(b):"null");break;case "boolean":c.push(String(b));break;case "function":c.push("null");break;default:throw Error("Unknown type: "+typeof b);}}},rc={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},sc=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,qc=function(a,b){b.push('"',a.replace(sc,function(a){var b=rc[a];b||(b="\\u"+(a.charCodeAt(0)|65536).toString(16).substr(1), rc[a]=b);return b}),'"')};var tc=function(){};tc.prototype.Ec=null;var uc=function(a){return a.Ec||(a.Ec=a.Wc())};var vc,wc=function(){};q(wc,tc);wc.prototype.bc=function(){var a=xc(this);return a?new ActiveXObject(a):new XMLHttpRequest};wc.prototype.Wc=function(){var a={};xc(this)&&(a[0]=!0,a[1]=!0);return a}; var xc=function(a){if(!a.Sc&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.Sc=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.Sc};vc=new wc;var yc=function(){};q(yc,tc);yc.prototype.bc=function(){var a=new XMLHttpRequest;if("withCredentials"in a)return a;if("undefined"!=typeof XDomainRequest)return new zc;throw Error("Unsupported browser");};yc.prototype.Wc=function(){return{}}; var zc=function(){this.ha=new XDomainRequest;this.readyState=0;this.responseText=this.onreadystatechange=null;this.status=-1;this.statusText=this.responseXML=null;this.ha.onload=p(this.Rd,this);this.ha.onerror=p(this.Qc,this);this.ha.onprogress=p(this.Sd,this);this.ha.ontimeout=p(this.Td,this)};k=zc.prototype;k.open=function(a,b,c){if(null!=c&&!c)throw Error("Only async requests are supported.");this.ha.open(a,b)}; k.send=function(a){if(a)if("string"==typeof a)this.ha.send(a);else throw Error("Only string data is supported");else this.ha.send()};k.abort=function(){this.ha.abort()};k.setRequestHeader=function(){};k.Rd=function(){this.status=200;this.responseText=this.ha.responseText;Ac(this,4)};k.Qc=function(){this.status=500;this.responseText=null;Ac(this,4)};k.Td=function(){this.Qc()};k.Sd=function(){this.status=200;Ac(this,1)};var Ac=function(a,b){a.readyState=b;if(a.onreadystatechange)a.onreadystatechange()};var B=function(a,b){this.h=[];this.g=b;for(var c=!0,d=a.length-1;0<=d;d--){var e=a[d]|0;c&&e==b||(this.h[d]=e,c=!1)}},Bc={},Cc=function(a){if(-128<=a&&128>a){var b=Bc[a];if(b)return b}b=new B([a|0],0>a?-1:0);-128<=a&&128>a&&(Bc[a]=b);return b},E=function(a){if(isNaN(a)||!isFinite(a))return C;if(0>a)return D(E(-a));for(var b=[],c=1,d=0;a>=c;d++)b[d]=a/c|0,c*=4294967296;return new B(b,0)},Dc=function(a,b){if(0==a.length)throw Error("number format error: empty string");var c=b||10;if(2>c||36<c)throw Error("radix out of range: "+ c);if("-"==a.charAt(0))return D(Dc(a.substring(1),c));if(0<=a.indexOf("-"))throw Error('number format error: interior "-" character');for(var d=E(Math.pow(c,8)),e=C,f=0;f<a.length;f+=8){var g=Math.min(8,a.length-f),h=parseInt(a.substring(f,f+g),c);8>g?(g=E(Math.pow(c,g)),e=e.multiply(g).add(E(h))):(e=e.multiply(d),e=e.add(E(h)))}return e},C=Cc(0),Ec=Cc(1),Fc=Cc(16777216),Gc=function(a){if(-1==a.g)return-Gc(D(a));for(var b=0,c=1,d=0;d<a.h.length;d++)b+=Hc(a,d)*c,c*=4294967296;return b}; B.prototype.toString=function(a){a=a||10;if(2>a||36<a)throw Error("radix out of range: "+a);if(Ic(this))return"0";if(-1==this.g)return"-"+D(this).toString(a);for(var b=E(Math.pow(a,6)),c=this,d="";;){var e=Jc(c,b),c=Kc(c,e.multiply(b)),f=((0<c.h.length?c.h[0]:c.g)>>>0).toString(a),c=e;if(Ic(c))return f+d;for(;6>f.length;)f="0"+f;d=""+f+d}}; var F=function(a,b){return 0>b?0:b<a.h.length?a.h[b]:a.g},Hc=function(a,b){var c=F(a,b);return 0<=c?c:4294967296+c},Ic=function(a){if(0!=a.g)return!1;for(var b=0;b<a.h.length;b++)if(0!=a.h[b])return!1;return!0};B.prototype.vb=function(a){if(this.g!=a.g)return!1;for(var b=Math.max(this.h.length,a.h.length),c=0;c<b;c++)if(F(this,c)!=F(a,c))return!1;return!0};B.prototype.compare=function(a){a=Kc(this,a);return-1==a.g?-1:Ic(a)?0:1}; var D=function(a){for(var b=a.h.length,c=[],d=0;d<b;d++)c[d]=~a.h[d];return(new B(c,~a.g)).add(Ec)};B.prototype.add=function(a){for(var b=Math.max(this.h.length,a.h.length),c=[],d=0,e=0;e<=b;e++){var f=d+(F(this,e)&65535)+(F(a,e)&65535),g=(f>>>16)+(F(this,e)>>>16)+(F(a,e)>>>16),d=g>>>16,f=f&65535,g=g&65535;c[e]=g<<16|f}return new B(c,c[c.length-1]&-2147483648?-1:0)};var Kc=function(a,b){return a.add(D(b))}; B.prototype.multiply=function(a){if(Ic(this)||Ic(a))return C;if(-1==this.g)return-1==a.g?D(this).multiply(D(a)):D(D(this).multiply(a));if(-1==a.g)return D(this.multiply(D(a)));if(0>this.compare(Fc)&&0>a.compare(Fc))return E(Gc(this)*Gc(a));for(var b=this.h.length+a.h.length,c=[],d=0;d<2*b;d++)c[d]=0;for(d=0;d<this.h.length;d++)for(var e=0;e<a.h.length;e++){var f=F(this,d)>>>16,g=F(this,d)&65535,h=F(a,e)>>>16,r=F(a,e)&65535;c[2*d+2*e]+=g*r;Lc(c,2*d+2*e);c[2*d+2*e+1]+=f*r;Lc(c,2*d+2*e+1);c[2*d+2*e+ 1]+=g*h;Lc(c,2*d+2*e+1);c[2*d+2*e+2]+=f*h;Lc(c,2*d+2*e+2)}for(d=0;d<b;d++)c[d]=c[2*d+1]<<16|c[2*d];for(d=b;d<2*b;d++)c[d]=0;return new B(c,0)}; var Lc=function(a,b){for(;(a[b]&65535)!=a[b];)a[b+1]+=a[b]>>>16,a[b]&=65535},Jc=function(a,b){if(Ic(b))throw Error("division by zero");if(Ic(a))return C;if(-1==a.g)return-1==b.g?Jc(D(a),D(b)):D(Jc(D(a),b));if(-1==b.g)return D(Jc(a,D(b)));if(30<a.h.length){if(-1==a.g||-1==b.g)throw Error("slowDivide_ only works with positive integers.");for(var c=Ec,d=b;0>=d.compare(a);)c=c.shiftLeft(1),d=d.shiftLeft(1);for(var e=Mc(c,1),f=Mc(d,1),g,d=Mc(d,2),c=Mc(c,2);!Ic(d);)g=f.add(d),0>=g.compare(a)&&(e=e.add(c), f=g),d=Mc(d,1),c=Mc(c,1);return e}c=C;for(d=a;0<=d.compare(b);){e=Math.max(1,Math.floor(Gc(d)/Gc(b)));f=Math.ceil(Math.log(e)/Math.LN2);f=48>=f?1:Math.pow(2,f-48);g=E(e);for(var h=g.multiply(b);-1==h.g||0<h.compare(d);)e-=f,g=E(e),h=g.multiply(b);Ic(g)&&(g=Ec);c=c.add(g);d=Kc(d,h)}return c},Nc=function(a,b){for(var c=Math.max(a.h.length,b.h.length),d=[],e=0;e<c;e++)d[e]=F(a,e)|F(b,e);return new B(d,a.g|b.g)}; B.prototype.shiftLeft=function(a){var b=a>>5;a%=32;for(var c=this.h.length+b+(0<a?1:0),d=[],e=0;e<c;e++)d[e]=0<a?F(this,e-b)<<a|F(this,e-b-1)>>>32-a:F(this,e-b);return new B(d,this.g)};var Mc=function(a,b){for(var c=b>>5,d=b%32,e=a.h.length-c,f=[],g=0;g<e;g++)f[g]=0<d?F(a,g+c)>>>d|F(a,g+c+1)<<32-d:F(a,g+c);return new B(f,a.g)};var Oc=function(a,b){this.fb=a;this.ga=b};Oc.prototype.vb=function(a){return this.ga==a.ga&&this.fb.vb(Va(a.fb))}; var Rc=function(a){try{var b;if(b=0==a.lastIndexOf("[",0)){var c=a.length-1;b=0<=c&&a.indexOf("]",c)==c}return b?new Pc(a.substring(1,a.length-1)):new Qc(a)}catch(d){return null}},Qc=function(a){var b=C;if(a instanceof B){if(0!=a.g||0>a.compare(C)||0<a.compare(Sc))throw Error("The address does not look like an IPv4.");b=Va(a)}else{if(!Tc.test(a))throw Error(a+" does not look like an IPv4 address.");var c=a.split(".");if(4!=c.length)throw Error(a+" does not look like an IPv4 address.");for(var d=0;d< c.length;d++){var e;e=c[d];var f=Number(e);e=0==f&&/^[\s\xa0]*$/.test(e)?NaN:f;if(isNaN(e)||0>e||255<e||1!=c[d].length&&0==c[d].lastIndexOf("0",0))throw Error("In "+a+", octet "+d+" is not valid");e=E(e);b=Nc(b.shiftLeft(8),e)}}Oc.call(this,b,4)};q(Qc,Oc);var Tc=/^[0-9.]*$/,Sc=Kc(Ec.shiftLeft(32),Ec);Qc.prototype.toString=function(){if(this.wa)return this.wa;for(var a=Hc(this.fb,0),b=[],c=3;0<=c;c--)b[c]=String(a&255),a>>>=8;return this.wa=b.join(".")}; var Pc=function(a){var b=C;if(a instanceof B){if(0!=a.g||0>a.compare(C)||0<a.compare(Uc))throw Error("The address does not look like a valid IPv6.");b=Va(a)}else{if(!Vc.test(a))throw Error(a+" is not a valid IPv6 address.");var c=a.split(":");if(-1!=c[c.length-1].indexOf(".")){a=Hc(Va((new Qc(c[c.length-1])).fb),0);var d=[];d.push((a>>>16&65535).toString(16));d.push((a&65535).toString(16));Ja(c,c.length-1);Pa(c,d);a=c.join(":")}d=a.split("::");if(2<d.length||1==d.length&&8!=c.length)throw Error(a+ " is not a valid IPv6 address.");if(1<d.length){c=d[0].split(":");d=d[1].split(":");1==c.length&&""==c[0]&&(c=[]);1==d.length&&""==d[0]&&(d=[]);var e=8-(c.length+d.length);if(1>e)c=[];else{for(var f=[],g=0;g<e;g++)f[g]="0";c=Na(c,f,d)}}if(8!=c.length)throw Error(a+" is not a valid IPv6 address");for(d=0;d<c.length;d++){e=Dc(c[d],16);if(0>e.compare(C)||0<e.compare(Wc))throw Error(c[d]+" in "+a+" is not a valid hextet.");b=Nc(b.shiftLeft(16),e)}}Oc.call(this,b,6)};q(Pc,Oc); var Vc=/^([a-fA-F0-9]*:){2}[a-fA-F0-9:.]*$/,Wc=Cc(65535),Uc=Kc(Ec.shiftLeft(128),Ec);Pc.prototype.toString=function(){if(this.wa)return this.wa;for(var a=[],b=3;0<=b;b--){var c=Hc(this.fb,b),d=c&65535;a.push((c>>>16).toString(16));a.push(d.toString(16))}for(var c=b=-1,e=d=0,f=0;f<a.length;f++)"0"==a[f]?(e++,-1==c&&(c=f),e>d&&(d=e,b=c)):(c=-1,e=0);0<d&&(b+d==a.length&&a.push(""),a.splice(b,d,""),0==b&&(a=[""].concat(a)));return this.wa=a.join(":")};!fb&&!y||y&&9<=Number(pb)||fb&&z("1.9.1");y&&z("9");var Yc=function(a,b){Qa(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:Xc.hasOwnProperty(d)?a.setAttribute(Xc[d],b):0==d.lastIndexOf("aria-",0)||0==d.lastIndexOf("data-",0)?a.setAttribute(d,b):a[d]=b})},Xc={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};var Zc=function(a,b,c){this.ee=c;this.Gd=a;this.oe=b;this.Hb=0;this.Db=null};Zc.prototype.get=function(){var a;0<this.Hb?(this.Hb--,a=this.Db,this.Db=a.next,a.next=null):a=this.Gd();return a};Zc.prototype.put=function(a){this.oe(a);this.Hb<this.ee&&(this.Hb++,a.next=this.Db,this.Db=a)};var $c=function(a){l.setTimeout(function(){throw a;},0)},ad,bd=function(){var a=l.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!x("Presto")&&(a=function(){var a=document.createElement("IFRAME");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write("");a.close();var c="callImmediate"+Math.random(),d="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host, a=p(function(a){if(("*"==d||a.origin==d)&&a.data==c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof a&&!x("Trident")&&!x("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(void 0!==c.next){c=c.next;var a=c.Ic;c.Ic=null;a()}};return function(a){d.next={Ic:a};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")? function(a){var b=document.createElement("SCRIPT");b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){l.setTimeout(a,0)}};var cd=function(){this.Vb=this.Ea=null},ed=new Zc(function(){return new dd},function(a){a.reset()},100);cd.prototype.add=function(a,b){var c=ed.get();c.set(a,b);this.Vb?this.Vb.next=c:(v(!this.Ea),this.Ea=c);this.Vb=c};cd.prototype.remove=function(){var a=null;this.Ea&&(a=this.Ea,this.Ea=this.Ea.next,this.Ea||(this.Vb=null),a.next=null);return a};var dd=function(){this.next=this.scope=this.fc=null};dd.prototype.set=function(a,b){this.fc=a;this.scope=b;this.next=null}; dd.prototype.reset=function(){this.next=this.scope=this.fc=null};var jd=function(a,b){fd||gd();hd||(fd(),hd=!0);id.add(a,b)},fd,gd=function(){if(l.Promise&&l.Promise.resolve){var a=l.Promise.resolve(void 0);fd=function(){a.then(kd)}}else fd=function(){var a=kd;!n(l.setImmediate)||l.Window&&l.Window.prototype&&!x("Edge")&&l.Window.prototype.setImmediate==l.setImmediate?(ad||(ad=bd()),ad(a)):l.setImmediate(a)}},hd=!1,id=new cd,kd=function(){for(var a;a=id.remove();){try{a.fc.call(a.scope)}catch(b){$c(b)}ed.put(a)}hd=!1};var ld=function(a){a.prototype.then=a.prototype.then;a.prototype.$goog_Thenable=!0},md=function(a){if(!a)return!1;try{return!!a.$goog_Thenable}catch(b){return!1}};var G=function(a,b){this.A=0;this.ea=void 0;this.Ga=this.$=this.m=null;this.Bb=this.ec=!1;if(a!=ba)try{var c=this;a.call(b,function(a){nd(c,2,a)},function(a){if(!(a instanceof od))try{if(a instanceof Error)throw a;throw Error("Promise rejected.");}catch(b){}nd(c,3,a)})}catch(d){nd(this,3,d)}},pd=function(){this.next=this.context=this.Ma=this.xa=this.child=null;this.Ya=!1};pd.prototype.reset=function(){this.context=this.Ma=this.xa=this.child=null;this.Ya=!1}; var qd=new Zc(function(){return new pd},function(a){a.reset()},100),rd=function(a,b,c){var d=qd.get();d.xa=a;d.Ma=b;d.context=c;return d},H=function(a){if(a instanceof G)return a;var b=new G(ba);nd(b,2,a);return b},I=function(a){return new G(function(b,c){c(a)})},td=function(a,b,c){sd(a,b,c,null)||jd(ka(b,a))},ud=function(a){return new G(function(b){var c=a.length,d=[];if(c)for(var e=function(a,e,f){c--;d[a]=e?{Pd:!0,value:f}:{Pd:!1,reason:f};0==c&&b(d)},f=0,g;f<a.length;f++)g=a[f],td(g,ka(e,f,!0), ka(e,f,!1));else b(d)})};G.prototype.then=function(a,b,c){null!=a&&Ba(a,"opt_onFulfilled should be a function.");null!=b&&Ba(b,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");return vd(this,n(a)?a:null,n(b)?b:null,c)};ld(G);var xd=function(a,b){var c=rd(b,b,void 0);c.Ya=!0;wd(a,c);return a};G.prototype.M=function(a,b){return vd(this,null,a,b)};G.prototype.cancel=function(a){0==this.A&&jd(function(){var b=new od(a);yd(this,b)},this)}; var yd=function(a,b){if(0==a.A)if(a.m){var c=a.m;if(c.$){for(var d=0,e=null,f=null,g=c.$;g&&(g.Ya||(d++,g.child==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(0==c.A&&1==d?yd(c,b):(f?(d=f,v(c.$),v(null!=d),d.next==c.Ga&&(c.Ga=d),d.next=d.next.next):zd(c),Ad(c,e,3,b)))}a.m=null}else nd(a,3,b)},wd=function(a,b){a.$||2!=a.A&&3!=a.A||Bd(a);v(null!=b.xa);a.Ga?a.Ga.next=b:a.$=b;a.Ga=b},vd=function(a,b,c,d){var e=rd(null,null,null);e.child=new G(function(a,g){e.xa=b?function(c){try{var e=b.call(d,c);a(e)}catch(Z){g(Z)}}: a;e.Ma=c?function(b){try{var e=c.call(d,b);void 0===e&&b instanceof od?g(b):a(e)}catch(Z){g(Z)}}:g});e.child.m=a;wd(a,e);return e.child};G.prototype.ye=function(a){v(1==this.A);this.A=0;nd(this,2,a)};G.prototype.ze=function(a){v(1==this.A);this.A=0;nd(this,3,a)}; var nd=function(a,b,c){0==a.A&&(a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself")),a.A=1,sd(c,a.ye,a.ze,a)||(a.ea=c,a.A=b,a.m=null,Bd(a),3!=b||c instanceof od||Cd(a,c)))},sd=function(a,b,c,d){if(a instanceof G)return null!=b&&Ba(b,"opt_onFulfilled should be a function."),null!=c&&Ba(c,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?"),wd(a,rd(b||ba,c||null,d)),!0;if(md(a))return a.then(b,c,d),!0;if(ha(a))try{var e=a.then;if(n(e))return Dd(a, e,b,c,d),!0}catch(f){return c.call(d,f),!0}return!1},Dd=function(a,b,c,d,e){var f=!1,g=function(a){f||(f=!0,c.call(e,a))},h=function(a){f||(f=!0,d.call(e,a))};try{b.call(a,g,h)}catch(r){h(r)}},Bd=function(a){a.ec||(a.ec=!0,jd(a.Kd,a))},zd=function(a){var b=null;a.$&&(b=a.$,a.$=b.next,b.next=null);a.$||(a.Ga=null);null!=b&&v(null!=b.xa);return b};G.prototype.Kd=function(){for(var a;a=zd(this);)Ad(this,a,this.A,this.ea);this.ec=!1}; var Ad=function(a,b,c,d){if(3==c&&b.Ma&&!b.Ya)for(;a&&a.Bb;a=a.m)a.Bb=!1;if(b.child)b.child.m=null,Ed(b,c,d);else try{b.Ya?b.xa.call(b.context):Ed(b,c,d)}catch(e){Fd.call(null,e)}qd.put(b)},Ed=function(a,b,c){2==b?a.xa.call(a.context,c):a.Ma&&a.Ma.call(a.context,c)},Cd=function(a,b){a.Bb=!0;jd(function(){a.Bb&&Fd.call(null,b)})},Fd=$c,od=function(a){t.call(this,a)};q(od,t);od.prototype.name="cancel";/* Portions of this code are from MochiKit, received by The Closure Authors under the MIT license. All other code is Copyright 2005-2009 The Closure Authors. All Rights Reserved. */ var Gd=function(a,b){this.Ob=[];this.bd=a;this.Kc=b||null;this.bb=this.Ja=!1;this.ea=void 0;this.zc=this.Dc=this.Zb=!1;this.Tb=0;this.m=null;this.$b=0};Gd.prototype.cancel=function(a){if(this.Ja)this.ea instanceof Gd&&this.ea.cancel();else{if(this.m){var b=this.m;delete this.m;a?b.cancel(a):(b.$b--,0>=b.$b&&b.cancel())}this.bd?this.bd.call(this.Kc,this):this.zc=!0;this.Ja||Hd(this,new Id)}};Gd.prototype.Jc=function(a,b){this.Zb=!1;Jd(this,a,b)}; var Jd=function(a,b,c){a.Ja=!0;a.ea=c;a.bb=!b;Kd(a)},Md=function(a){if(a.Ja){if(!a.zc)throw new Ld;a.zc=!1}};Gd.prototype.callback=function(a){Md(this);Nd(a);Jd(this,!0,a)};var Hd=function(a,b){Md(a);Nd(b);Jd(a,!1,b)},Nd=function(a){v(!(a instanceof Gd),"An execution sequence may not be initiated with a blocking Deferred.")},Pd=function(a,b){Od(a,null,b,void 0)},Od=function(a,b,c,d){v(!a.Dc,"Blocking Deferreds can not be re-used");a.Ob.push([b,c,d]);a.Ja&&Kd(a)}; Gd.prototype.then=function(a,b,c){var d,e,f=new G(function(a,b){d=a;e=b});Od(this,d,function(a){a instanceof Id?f.cancel():e(a)});return f.then(a,b,c)};ld(Gd); var Qd=function(a){return Fa(a.Ob,function(a){return n(a[1])})},Kd=function(a){if(a.Tb&&a.Ja&&Qd(a)){var b=a.Tb,c=Rd[b];c&&(l.clearTimeout(c.cb),delete Rd[b]);a.Tb=0}a.m&&(a.m.$b--,delete a.m);for(var b=a.ea,d=c=!1;a.Ob.length&&!a.Zb;){var e=a.Ob.shift(),f=e[0],g=e[1],e=e[2];if(f=a.bb?g:f)try{var h=f.call(e||a.Kc,b);void 0!==h&&(a.bb=a.bb&&(h==b||h instanceof Error),a.ea=b=h);if(md(b)||"function"===typeof l.Promise&&b instanceof l.Promise)d=!0,a.Zb=!0}catch(r){b=r,a.bb=!0,Qd(a)||(c=!0)}}a.ea=b;d&& (h=p(a.Jc,a,!0),d=p(a.Jc,a,!1),b instanceof Gd?(Od(b,h,d),b.Dc=!0):b.then(h,d));c&&(b=new Sd(b),Rd[b.cb]=b,a.Tb=b.cb)},Ld=function(){t.call(this)};q(Ld,t);Ld.prototype.message="Deferred has already fired";Ld.prototype.name="AlreadyCalledError";var Id=function(){t.call(this)};q(Id,t);Id.prototype.message="Deferred was canceled";Id.prototype.name="CanceledError";var Sd=function(a){this.cb=l.setTimeout(p(this.xe,this),0);this.D=a}; Sd.prototype.xe=function(){v(Rd[this.cb],"Cannot throw an error that is not scheduled.");delete Rd[this.cb];throw this.D;};var Rd={};var Xd=function(a){var b={},c=b.document||document,d=document.createElement("SCRIPT"),e={ld:d,qb:void 0},f=new Gd(Td,e),g=null,h=null!=b.timeout?b.timeout:5E3;0<h&&(g=window.setTimeout(function(){Ud(d,!0);Hd(f,new Vd(1,"Timeout reached for loading script "+a))},h),e.qb=g);d.onload=d.onreadystatechange=function(){d.readyState&&"loaded"!=d.readyState&&"complete"!=d.readyState||(Ud(d,b.De||!1,g),f.callback(null))};d.onerror=function(){Ud(d,!0,g);Hd(f,new Vd(0,"Error while loading script "+a))};e=b.attributes|| {};Xa(e,{type:"text/javascript",charset:"UTF-8",src:a});Yc(d,e);Wd(c).appendChild(d);return f},Wd=function(a){var b=a.getElementsByTagName("HEAD");return b&&0!=b.length?b[0]:a.documentElement},Td=function(){if(this&&this.ld){var a=this.ld;a&&"SCRIPT"==a.tagName&&Ud(a,!0,this.qb)}},Ud=function(a,b,c){null!=c&&l.clearTimeout(c);a.onload=ba;a.onerror=ba;a.onreadystatechange=ba;b&&window.setTimeout(function(){a&&a.parentNode&&a.parentNode.removeChild(a)},0)},Vd=function(a,b){var c="Jsloader error (code #"+ a+")";b&&(c+=": "+b);t.call(this,c);this.code=a};q(Vd,t);var J=function(){Kb.call(this);this.T=new Rb(this);this.Cd=this;this.oc=null};q(J,Kb);J.prototype[Nb]=!0;J.prototype.addEventListener=function(a,b,c,d){Xb(this,a,b,c,d)};J.prototype.removeEventListener=function(a,b,c,d){gc(this,a,b,c,d)}; J.prototype.dispatchEvent=function(a){Yd(this);var b,c=this.oc;if(c){b=[];for(var d=1;c;c=c.oc)b.push(c),v(1E3>++d,"infinite loop")}c=this.Cd;d=a.type||a;if(m(a))a=new Lb(a,c);else if(a instanceof Lb)a.target=a.target||c;else{var e=a;a=new Lb(d,c);Xa(a,e)}var e=!0,f;if(b)for(var g=b.length-1;!a.Pa&&0<=g;g--)f=a.currentTarget=b[g],e=Zd(f,d,!0,a)&&e;a.Pa||(f=a.currentTarget=c,e=Zd(f,d,!0,a)&&e,a.Pa||(e=Zd(f,d,!1,a)&&e));if(b)for(g=0;!a.Pa&&g<b.length;g++)f=a.currentTarget=b[g],e=Zd(f,d,!1,a)&&e;return e}; J.prototype.Ha=function(){J.Bc.Ha.call(this);if(this.T){var a=this.T,b=0,c;for(c in a.v){for(var d=a.v[c],e=0;e<d.length;e++)++b,Qb(d[e]);delete a.v[c];a.rb--}}this.oc=null}; var Zb=function(a,b,c,d,e){Yd(a);a.T.add(String(b),c,!1,d,e)},fc=function(a,b,c,d,e){a.T.add(String(b),c,!0,d,e)},Zd=function(a,b,c,d){b=a.T.v[String(b)];if(!b)return!0;b=b.concat();for(var e=!0,f=0;f<b.length;++f){var g=b[f];if(g&&!g.Ra&&g.tb==c){var h=g.listener,r=g.Cb||g.src;g.sb&&Tb(a.T,g);e=!1!==h.call(r,d)&&e}}return e&&0!=d.jd};J.prototype.gc=function(a,b,c,d){return this.T.gc(String(a),b,c,d)};var Yd=function(a){v(a.T,"Event target is not initialized. Did you call the superclass (goog.events.EventTarget) constructor?")};var $d="StopIteration"in l?l.StopIteration:{message:"StopIteration",stack:""},ae=function(){};ae.prototype.next=function(){throw $d;};ae.prototype.Xa=function(){return this}; var be=function(a){if(a instanceof ae)return a;if("function"==typeof a.Xa)return a.Xa(!1);if(fa(a)){var b=0,c=new ae;c.next=function(){for(;;){if(b>=a.length)throw $d;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");},ce=function(a,b){if(fa(a))try{w(a,b,void 0)}catch(c){if(c!==$d)throw c;}else{a=be(a);try{for(;;)b.call(void 0,a.next(),void 0,a)}catch(c){if(c!==$d)throw c;}}};var de=function(a,b){this.U={};this.o=[];this.ga=this.i=0;var c=arguments.length;if(1<c){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&this.addAll(a)};k=de.prototype;k.yb=function(){return this.i};k.N=function(){ee(this);for(var a=[],b=0;b<this.o.length;b++)a.push(this.U[this.o[b]]);return a};k.aa=function(){ee(this);return this.o.concat()};k.$a=function(a){return fe(this.U,a)}; k.vb=function(a,b){if(this===a)return!0;if(this.i!=a.yb())return!1;var c=b||ge;ee(this);for(var d,e=0;d=this.o[e];e++)if(!c(this.get(d),a.get(d)))return!1;return!0};var ge=function(a,b){return a===b};de.prototype.remove=function(a){return fe(this.U,a)?(delete this.U[a],this.i--,this.ga++,this.o.length>2*this.i&&ee(this),!0):!1}; var ee=function(a){if(a.i!=a.o.length){for(var b=0,c=0;b<a.o.length;){var d=a.o[b];fe(a.U,d)&&(a.o[c++]=d);b++}a.o.length=c}if(a.i!=a.o.length){for(var e={},c=b=0;b<a.o.length;)d=a.o[b],fe(e,d)||(a.o[c++]=d,e[d]=1),b++;a.o.length=c}};k=de.prototype;k.get=function(a,b){return fe(this.U,a)?this.U[a]:b};k.set=function(a,b){fe(this.U,a)||(this.i++,this.o.push(a),this.ga++);this.U[a]=b}; k.addAll=function(a){var b;a instanceof de?(b=a.aa(),a=a.N()):(b=Sa(a),a=Ra(a));for(var c=0;c<b.length;c++)this.set(b[c],a[c])};k.forEach=function(a,b){for(var c=this.aa(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};k.clone=function(){return new de(this)};k.Xa=function(a){ee(this);var b=0,c=this.ga,d=this,e=new ae;e.next=function(){if(c!=d.ga)throw Error("The map has changed since the iterator was created");if(b>=d.o.length)throw $d;var e=d.o[b++];return a?e:d.U[e]};return e}; var fe=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var he=function(a){if(a.N&&"function"==typeof a.N)return a.N();if(m(a))return a.split("");if(fa(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Ra(a)},ie=function(a){if(a.aa&&"function"==typeof a.aa)return a.aa();if(!a.N||"function"!=typeof a.N){if(fa(a)||m(a)){var b=[];a=a.length;for(var c=0;c<a;c++)b.push(c);return b}return Sa(a)}},je=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);else if(fa(a)||m(a))w(a,b,void 0);else for(var c=ie(a),d=he(a),e= d.length,f=0;f<e;f++)b.call(void 0,d[f],c&&c[f],a)};var ke=function(a,b,c,d,e){this.reset(a,b,c,d,e)};ke.prototype.Mc=null;var le=0;ke.prototype.reset=function(a,b,c,d,e){"number"==typeof e||le++;d||la();this.ib=a;this.ge=b;delete this.Mc};ke.prototype.nd=function(a){this.ib=a};var me=function(a){this.he=a;this.Rc=this.ac=this.ib=this.m=null},ne=function(a,b){this.name=a;this.value=b};ne.prototype.toString=function(){return this.name};var oe=new ne("SEVERE",1E3),pe=new ne("CONFIG",700),qe=new ne("FINE",500);me.prototype.getParent=function(){return this.m};me.prototype.nd=function(a){this.ib=a};var re=function(a){if(a.ib)return a.ib;if(a.m)return re(a.m);ya("Root logger has no level set.");return null}; me.prototype.log=function(a,b,c){if(a.value>=re(this).value)for(n(b)&&(b=b()),a=new ke(a,String(b),this.he),c&&(a.Mc=c),c="log:"+a.ge,l.console&&(l.console.timeStamp?l.console.timeStamp(c):l.console.markTimeline&&l.console.markTimeline(c)),l.msWriteProfilerMark&&l.msWriteProfilerMark(c),c=this;c;){b=c;var d=a;if(b.Rc)for(var e=0,f;f=b.Rc[e];e++)f(d);c=c.getParent()}}; var se={},te=null,ue=function(a){te||(te=new me(""),se[""]=te,te.nd(pe));var b;if(!(b=se[a])){b=new me(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=ue(a.substr(0,c));c.ac||(c.ac={});c.ac[d]=b;b.m=c;se[a]=b}return b};var K=function(a,b){a&&a.log(qe,b,void 0)};var ve=function(a,b,c){if(n(a))c&&(a=p(a,c));else if(a&&"function"==typeof a.handleEvent)a=p(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:l.setTimeout(a,b||0)},we=function(a){var b=null;return(new G(function(c,d){b=ve(function(){c(void 0)},a);-1==b&&d(Error("Failed to schedule timer."))})).M(function(a){l.clearTimeout(b);throw a;})};var xe=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/,ye=function(a,b){if(a)for(var c=a.split("&"),d=0;d<c.length;d++){var e=c[d].indexOf("="),f,g=null;0<=e?(f=c[d].substring(0,e),g=c[d].substring(e+1)):f=c[d];b(f,g?decodeURIComponent(g.replace(/\+/g," ")):"")}};var L=function(a){J.call(this);this.headers=new de;this.Xb=a||null;this.ia=!1;this.Wb=this.a=null;this.hb=this.Yc=this.Fb="";this.va=this.lc=this.Eb=this.dc=!1;this.Ua=0;this.Sb=null;this.hd="";this.Ub=this.ne=this.ud=!1};q(L,J);var ze=L.prototype,Ae=ue("goog.net.XhrIo");ze.I=Ae;var Be=/^https?$/i,Ce=["POST","PUT"]; L.prototype.send=function(a,b,c,d){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.Fb+"; newUri="+a);b=b?b.toUpperCase():"GET";this.Fb=a;this.hb="";this.Yc=b;this.dc=!1;this.ia=!0;this.a=this.Xb?this.Xb.bc():vc.bc();this.Wb=this.Xb?uc(this.Xb):uc(vc);this.a.onreadystatechange=p(this.dd,this);this.ne&&"onprogress"in this.a&&(this.a.onprogress=p(function(a){this.cd(a,!0)},this),this.a.upload&&(this.a.upload.onprogress=p(this.cd,this)));try{K(this.I,De(this,"Opening Xhr")), this.lc=!0,this.a.open(b,String(a),!0),this.lc=!1}catch(f){K(this.I,De(this,"Error opening Xhr: "+f.message));this.D(5,f);return}a=c||"";var e=this.headers.clone();d&&je(d,function(a,b){e.set(b,a)});d=Ha(e.aa());c=l.FormData&&a instanceof l.FormData;!Ia(Ce,b)||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(a,b){this.a.setRequestHeader(b,a)},this);this.hd&&(this.a.responseType=this.hd);"withCredentials"in this.a&&this.a.withCredentials!==this.ud&&(this.a.withCredentials= this.ud);try{Ee(this),0<this.Ua&&(this.Ub=Fe(this.a),K(this.I,De(this,"Will abort after "+this.Ua+"ms if incomplete, xhr2 "+this.Ub)),this.Ub?(this.a.timeout=this.Ua,this.a.ontimeout=p(this.qb,this)):this.Sb=ve(this.qb,this.Ua,this)),K(this.I,De(this,"Sending request")),this.Eb=!0,this.a.send(a),this.Eb=!1}catch(f){K(this.I,De(this,"Send error: "+f.message)),this.D(5,f)}};var Fe=function(a){return y&&z(9)&&ga(a.timeout)&&void 0!==a.ontimeout},Ga=function(a){return"content-type"==a.toLowerCase()}; L.prototype.qb=function(){"undefined"!=typeof aa&&this.a&&(this.hb="Timed out after "+this.Ua+"ms, aborting",K(this.I,De(this,this.hb)),this.dispatchEvent("timeout"),this.abort(8))};L.prototype.D=function(a,b){this.ia=!1;this.a&&(this.va=!0,this.a.abort(),this.va=!1);this.hb=b;Ge(this);He(this)};var Ge=function(a){a.dc||(a.dc=!0,a.dispatchEvent("complete"),a.dispatchEvent("error"))}; L.prototype.abort=function(){this.a&&this.ia&&(K(this.I,De(this,"Aborting")),this.ia=!1,this.va=!0,this.a.abort(),this.va=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),He(this))};L.prototype.Ha=function(){this.a&&(this.ia&&(this.ia=!1,this.va=!0,this.a.abort(),this.va=!1),He(this,!0));L.Bc.Ha.call(this)};L.prototype.dd=function(){this.isDisposed()||(this.lc||this.Eb||this.va?Ie(this):this.le())};L.prototype.le=function(){Ie(this)}; var Ie=function(a){if(a.ia&&"undefined"!=typeof aa)if(a.Wb[1]&&4==Je(a)&&2==Ke(a))K(a.I,De(a,"Local request error detected and ignored"));else if(a.Eb&&4==Je(a))ve(a.dd,0,a);else if(a.dispatchEvent("readystatechange"),4==Je(a)){K(a.I,De(a,"Request complete"));a.ia=!1;try{var b=Ke(a),c;a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:c=!0;break a;default:c=!1}var d;if(!(d=c)){var e;if(e=0===b){var f=String(a.Fb).match(xe)[1]||null;if(!f&&l.self&&l.self.location)var g=l.self.location.protocol, f=g.substr(0,g.length-1);e=!Be.test(f?f.toLowerCase():"")}d=e}if(d)a.dispatchEvent("complete"),a.dispatchEvent("success");else{var h;try{h=2<Je(a)?a.a.statusText:""}catch(r){K(a.I,"Can not get status: "+r.message),h=""}a.hb=h+" ["+Ke(a)+"]";Ge(a)}}finally{He(a)}}};L.prototype.cd=function(a,b){v("progress"===a.type,"goog.net.EventType.PROGRESS is of the same type as raw XHR progress.");this.dispatchEvent(Le(a,"progress"));this.dispatchEvent(Le(a,b?"downloadprogress":"uploadprogress"))}; var Le=function(a,b){return{type:b,lengthComputable:a.lengthComputable,loaded:a.loaded,total:a.total}},He=function(a,b){if(a.a){Ee(a);var c=a.a,d=a.Wb[0]?ba:null;a.a=null;a.Wb=null;b||a.dispatchEvent("ready");try{c.onreadystatechange=d}catch(e){(c=a.I)&&c.log(oe,"Problem encountered resetting onreadystatechange: "+e.message,void 0)}}},Ee=function(a){a.a&&a.Ub&&(a.a.ontimeout=null);ga(a.Sb)&&(l.clearTimeout(a.Sb),a.Sb=null)},Je=function(a){return a.a?a.a.readyState:0},Ke=function(a){try{return 2<Je(a)? a.a.status:-1}catch(b){return-1}},Me=function(a){try{return a.a?a.a.responseText:""}catch(b){return K(a.I,"Can not get responseText: "+b.message),""}},De=function(a,b){return b+" ["+a.Yc+" "+a.Fb+" "+Ke(a)+"]"};var Ne=function(a,b){this.ja=this.Da=this.oa="";this.Oa=null;this.ua=this.la="";this.F=this.de=!1;var c;if(a instanceof Ne)this.F=void 0!==b?b:a.F,Oe(this,a.oa),c=a.Da,M(this),this.Da=c,Pe(this,a.ja),Qe(this,a.Oa),Re(this,a.la),Se(this,a.W.clone()),c=a.ua,M(this),this.ua=c;else if(a&&(c=String(a).match(xe))){this.F=!!b;Oe(this,c[1]||"",!0);var d=c[2]||"";M(this);this.Da=Te(d);Pe(this,c[3]||"",!0);Qe(this,c[4]);Re(this,c[5]||"",!0);Se(this,c[6]||"",!0);c=c[7]||"";M(this);this.ua=Te(c)}else this.F= !!b,this.W=new N(null,0,this.F)};Ne.prototype.toString=function(){var a=[],b=this.oa;b&&a.push(Ue(b,Ve,!0),":");var c=this.ja;if(c||"file"==b)a.push("//"),(b=this.Da)&&a.push(Ue(b,Ve,!0),"@"),a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c=this.Oa,null!=c&&a.push(":",String(c));if(c=this.la)this.ja&&"/"!=c.charAt(0)&&a.push("/"),a.push(Ue(c,"/"==c.charAt(0)?We:Xe,!0));(c=this.W.toString())&&a.push("?",c);(c=this.ua)&&a.push("#",Ue(c,Ye));return a.join("")}; Ne.prototype.resolve=function(a){var b=this.clone(),c=!!a.oa;c?Oe(b,a.oa):c=!!a.Da;if(c){var d=a.Da;M(b);b.Da=d}else c=!!a.ja;c?Pe(b,a.ja):c=null!=a.Oa;d=a.la;if(c)Qe(b,a.Oa);else if(c=!!a.la){if("/"!=d.charAt(0))if(this.ja&&!this.la)d="/"+d;else{var e=b.la.lastIndexOf("/");-1!=e&&(d=b.la.substr(0,e+1)+d)}e=d;if(".."==e||"."==e)d="";else if(u(e,"./")||u(e,"/.")){for(var d=0==e.lastIndexOf("/",0),e=e.split("/"),f=[],g=0;g<e.length;){var h=e[g++];"."==h?d&&g==e.length&&f.push(""):".."==h?((1<f.length|| 1==f.length&&""!=f[0])&&f.pop(),d&&g==e.length&&f.push("")):(f.push(h),d=!0)}d=f.join("/")}else d=e}c?Re(b,d):c=""!==a.W.toString();c?Se(b,Te(a.W.toString())):c=!!a.ua;c&&(a=a.ua,M(b),b.ua=a);return b};Ne.prototype.clone=function(){return new Ne(this)}; var Oe=function(a,b,c){M(a);a.oa=c?Te(b,!0):b;a.oa&&(a.oa=a.oa.replace(/:$/,""))},Pe=function(a,b,c){M(a);a.ja=c?Te(b,!0):b},Qe=function(a,b){M(a);if(b){b=Number(b);if(isNaN(b)||0>b)throw Error("Bad port number "+b);a.Oa=b}else a.Oa=null},Re=function(a,b,c){M(a);a.la=c?Te(b,!0):b},Se=function(a,b,c){M(a);b instanceof N?(a.W=b,a.W.yc(a.F)):(c||(b=Ue(b,Ze)),a.W=new N(b,0,a.F))},O=function(a,b,c){M(a);a.W.set(b,c)},M=function(a){if(a.de)throw Error("Tried to modify a read-only Uri");}; Ne.prototype.yc=function(a){this.F=a;this.W&&this.W.yc(a);return this}; var $e=function(a,b){var c=new Ne(null,void 0);Oe(c,"https");a&&Pe(c,a);b&&Re(c,b);return c},Te=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},Ue=function(a,b,c){return m(a)?(a=encodeURI(a).replace(b,af),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null},af=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},Ve=/[#\/\?@]/g,Xe=/[\#\?:]/g,We=/[\#\?]/g,Ze=/[\#\?@]/g,Ye=/#/g,N=function(a,b,c){this.i=this.j=null;this.C=a||null; this.F=!!c},bf=function(a){a.j||(a.j=new de,a.i=0,a.C&&ye(a.C,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))},df=function(a){var b=ie(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new N(null,0,void 0);a=he(a);for(var d=0;d<b.length;d++){var e=b[d],f=a[d];ea(f)?cf(c,e,f):c.add(e,f)}return c};k=N.prototype;k.yb=function(){bf(this);return this.i}; k.add=function(a,b){bf(this);this.C=null;a=this.l(a);var c=this.j.get(a);c||this.j.set(a,c=[]);c.push(b);this.i=za(this.i)+1;return this};k.remove=function(a){bf(this);a=this.l(a);return this.j.$a(a)?(this.C=null,this.i=za(this.i)-this.j.get(a).length,this.j.remove(a)):!1};k.$a=function(a){bf(this);a=this.l(a);return this.j.$a(a)};k.aa=function(){bf(this);for(var a=this.j.N(),b=this.j.aa(),c=[],d=0;d<b.length;d++)for(var e=a[d],f=0;f<e.length;f++)c.push(b[d]);return c}; k.N=function(a){bf(this);var b=[];if(m(a))this.$a(a)&&(b=Ma(b,this.j.get(this.l(a))));else{a=this.j.N();for(var c=0;c<a.length;c++)b=Ma(b,a[c])}return b};k.set=function(a,b){bf(this);this.C=null;a=this.l(a);this.$a(a)&&(this.i=za(this.i)-this.j.get(a).length);this.j.set(a,[b]);this.i=za(this.i)+1;return this};k.get=function(a,b){var c=a?this.N(a):[];return 0<c.length?String(c[0]):b};var cf=function(a,b,c){a.remove(b);0<c.length&&(a.C=null,a.j.set(a.l(b),Oa(c)),a.i=za(a.i)+c.length)}; N.prototype.toString=function(){if(this.C)return this.C;if(!this.j)return"";for(var a=[],b=this.j.aa(),c=0;c<b.length;c++)for(var d=b[c],e=encodeURIComponent(String(d)),d=this.N(d),f=0;f<d.length;f++){var g=e;""!==d[f]&&(g+="="+encodeURIComponent(String(d[f])));a.push(g)}return this.C=a.join("&")};N.prototype.clone=function(){var a=new N;a.C=this.C;this.j&&(a.j=this.j.clone(),a.i=this.i);return a};N.prototype.l=function(a){a=String(a);this.F&&(a=a.toLowerCase());return a}; N.prototype.yc=function(a){a&&!this.F&&(bf(this),this.C=null,this.j.forEach(function(a,c){var d=c.toLowerCase();c!=d&&(this.remove(c),cf(this,d,a))},this));this.F=a};var ef=function(a,b){var c=[],d;for(d in a)d in b?typeof a[d]!=typeof b[d]?c.push(d):ea(a[d])?Ua(a[d],b[d])||c.push(d):"object"==typeof a[d]&&null!=a[d]&&null!=b[d]?0<ef(a[d],b[d]).length&&c.push(d):a[d]!==b[d]&&c.push(d):c.push(d);for(d in b)d in a||c.push(d);return c},ff=function(a,b,c){var d=Math.floor(1E9*Math.random()).toString();b=b||500;c=c||600;var e=(window.screen.availHeight-c)/2,f=(window.screen.availWidth-b)/2;b={width:b,height:c,top:0<e?e:0,left:0<f?f:0,location:!0,resizable:!0,statusbar:!0, toolbar:!1};d&&(b.target=d);navigator.userAgent&&-1!=navigator.userAgent.indexOf("Firefox/")&&(a=a||"http://localhost");var g;c=a||"about:blank";(d=b)||(d={});a=window;b=c instanceof A?c:Cb("undefined"!=typeof c.href?c.href:String(c));c=d.target||c.target;e=[];for(g in d)switch(g){case "width":case "height":case "top":case "left":e.push(g+"="+d[g]);break;case "target":case "noreferrer":break;default:e.push(g+"="+(d[g]?1:0))}g=e.join(",");(x("iPhone")&&!x("iPod")&&!x("iPad")||x("iPad")||x("iPod"))&& a.navigator&&a.navigator.standalone&&c&&"_self"!=c?(g=a.document.createElement("A"),b=b instanceof A?b:Cb(b),g.href=zb(b),g.setAttribute("target",c),d.noreferrer&&g.setAttribute("rel","noreferrer"),d=document.createEvent("MouseEvent"),d.initMouseEvent("click",!0,!0,a,1),g.dispatchEvent(d),g={}):d.noreferrer?(g=a.open("",c,g),d=zb(b),g&&(eb&&u(d,";")&&(d="'"+d.replace(/'/g,"%27")+"'"),g.opener=null,a=new wb,a.Rb="b/12014412, meta tag with sanitized URL",ua.test(d)&&(-1!=d.indexOf("&")&&(d=d.replace(oa, "&amp;")),-1!=d.indexOf("<")&&(d=d.replace(pa,"&lt;")),-1!=d.indexOf(">")&&(d=d.replace(qa,"&gt;")),-1!=d.indexOf('"')&&(d=d.replace(ra,"&quot;")),-1!=d.indexOf("'")&&(d=d.replace(sa,"&#39;")),-1!=d.indexOf("\x00")&&(d=d.replace(ta,"&#0;"))),d='<META HTTP-EQUIV="refresh" content="0; url='+d+'">',Aa(xb(a),"must provide justification"),v(!/^[\s\xa0]*$/.test(xb(a)),"must provide non-empty justification"),g.document.write(Fb((new Eb).ce(d))),g.document.close())):g=a.open(zb(b),c,g);if(g)try{g.focus()}catch(h){}return g}, gf=function(a){return new G(function(b){var c=function(){we(2E3).then(function(){if(!a||a.closed)b();else return c()})};return c()})},hf=function(){var a=null;return(new G(function(b){"complete"==l.document.readyState?b():(a=function(){b()},ec(window,"load",a))})).M(function(b){gc(window,"load",a);throw b;})},jf=function(){var a=navigator.userAgent,b=a.toLowerCase();if(u(b,"opera/")||u(b,"opr/")||u(b,"opios/"))return"Opera";if(u(b,"msie")||u(b,"trident/"))return"IE";if(u(b,"edge/"))return"Edge";if(u(b, "firefox/"))return"Firefox";if(u(b,"silk/"))return"Silk";if(u(b,"safari/")&&!u(b,"chrome/"))return"Safari";if(!u(b,"chrome/")&&!u(b,"crios/")||u(b,"edge/")){if((a=a.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==a.length)return a[1]}else return"Chrome";return"Other"},kf=function(a){return jf()+"/JsCore/"+a},lf=function(a){a=a.split(".");for(var b=l,c=0;c<a.length&&"object"==typeof b&&null!=b;c++)b=b[a[c]];c!=a.length&&(b=void 0);return b},mf=function(){return!(!l.location||!l.location.protocol||"http:"!= l.location.protocol&&"https:"!=l.location.protocol)},nf=function(){var a=navigator.userAgent,b=a.match(/(ipad)|(iphone)|(ipod)/i),a=a.match(/\sOS\s(\d+)_/i);return b&&b.length&&a&&2==a.length&&8>parseInt(a[1],10)?!1:!0};var of;try{var pf={};Object.defineProperty(pf,"abcd",{configurable:!0,enumerable:!0,value:1});Object.defineProperty(pf,"abcd",{configurable:!0,enumerable:!0,value:2});of=2==pf.abcd}catch(a){of=!1} var P=function(a,b,c){of?Object.defineProperty(a,b,{configurable:!0,enumerable:!0,value:c}):a[b]=c},qf=function(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&P(a,c,b[c])},rf=function(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},sf=function(a,b){if(!b||!b.length)return!0;if(!a)return!1;for(var c=0;c<b.length;c++){var d=a[b[c]];if(void 0===d||null===d||""===d)return!1}return!0};var tf={vd:{mb:985,lb:735,providerId:"facebook.com"},wd:{mb:1040,lb:620,providerId:"github.com"},xd:{mb:485,lb:640,providerId:"google.com"},Bd:{mb:485,lb:705,providerId:"twitter.com"}},uf=function(a){for(var b in tf)if(tf[b].providerId==a)return tf[b];return null};var Q=function(a,b){this.code="auth/"+a;this.message=b||vf[a]||""};q(Q,Error);Q.prototype.P=function(){return{name:this.code,code:this.code,message:this.message}}; var vf={"argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.", "email-already-in-use":"The email address is already in use by another account.","expired-action-code":"The action code has expired. ","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal error has occurred.","invalid-user-token":"The user's credential is no longer valid. The user must sign in again.","invalid-auth-event":"An internal error has occurred.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.", "invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-credential":"The supplied auth credential is malformed or has expired.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.", "invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","missing-iframe-start":"An internal error has occurred.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","app-deleted":"This instance of FirebaseApp has been deleted.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.", "network-request-failed":"A network error (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal error has occurred.","no-such-provider":"User was not linked to an account with the given provider.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http or https.', "popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.", "user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported."};var wf=function(a,b,c,d,e){this.qa=a;this.ta=b||null;this.Wa=c||null;this.xc=d||null;this.D=e||null;if(this.Wa||this.D){if(this.Wa&&this.D)throw new Q("invalid-auth-event");if(this.Wa&&!this.xc)throw new Q("invalid-auth-event");}else throw new Q("invalid-auth-event");};wf.prototype.hc=function(){return this.xc};wf.prototype.getError=function(){return this.D};wf.prototype.P=function(){return{type:this.qa,eventId:this.ta,urlResponse:this.Wa,sessionId:this.xc,error:this.D&&this.D.P()}};var xf=function(a){this.fe=a.sub;la();this.ub=a.email||null};var yf=function(a,b,c,d){var e={};ha(c)?e=c:b&&m(c)&&m(d)?e={oauthToken:c,oauthTokenSecret:d}:!b&&m(c)&&(e={accessToken:c});if(b||!e.idToken&&!e.accessToken)if(b&&e.oauthToken&&e.oauthTokenSecret)P(this,"accessToken",e.oauthToken),P(this,"secret",e.oauthTokenSecret);else{if(b)throw new Q("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");throw new Q("argument-error","credential failed: expected 1 argument (the OAuth access token).");}else e.idToken&&P(this, "idToken",e.idToken),e.accessToken&&P(this,"accessToken",e.accessToken);P(this,"provider",a)};yf.prototype.zb=function(a){return zf(a,Af(this))};yf.prototype.Zc=function(a,b){var c=Af(this);c.idToken=b;return R(a,Bf,c)};var Af=function(a){var b={};a.idToken&&(b.id_token=a.idToken);a.accessToken&&(b.access_token=a.accessToken);a.secret&&(b.oauth_token_secret=a.secret);b.providerId=a.provider;return{postBody:df(b).toString(),requestUri:window.location.href}}; yf.prototype.P=function(){var a={provider:this.provider};this.idToken&&(a.oauthIdToken=this.idToken);this.accessToken&&(a.oauthAccessToken=this.accessToken);this.secret&&(a.oauthTokenSecret=this.secret);return a}; var Cf=function(a,b){var c=!!b,d=function(){qf(this,{providerId:a,isOAuthProvider:!0});this.wc=[]};c||(d.prototype.addScope=function(a){Ia(this.wc,a)||this.wc.push(a)});d.prototype.Ab=function(){return Oa(this.wc)};d.credential=function(b,d){return new yf(a,c,b,d)};qf(d,{PROVIDER_ID:a});return d},Df=Cf("facebook.com");Df.prototype.addScope=Df.prototype.addScope||void 0;var Ef=Cf("github.com");Ef.prototype.addScope=Ef.prototype.addScope||void 0;var Ff=Cf("google.com"); Ff.prototype.addScope=Ff.prototype.addScope||void 0;Ff.credential=function(a,b){if(!a&&!b)throw new Q("argument-error","credential failed: must provide the ID token and/or the access token.");return new yf("google.com",!1,ha(a)?a:{idToken:a||null,accessToken:b||null})};var Gf=Cf("twitter.com",!0),Hf=function(a,b){this.ub=a;this.pc=b;P(this,"provider","password")};Hf.prototype.zb=function(a){return R(a,If,{email:this.ub,password:this.pc})}; Hf.prototype.Zc=function(a,b){return R(a,Jf,{idToken:b,email:this.ub,password:this.pc})};Hf.prototype.P=function(){return{email:this.ub,password:this.pc}};var Kf=function(){qf(this,{providerId:"password",isOAuthProvider:!1})};qf(Kf,{PROVIDER_ID:"password"}); var Lf={Be:Kf,vd:Df,xd:Ff,wd:Ef,Bd:Gf},Mf=function(a){var b=a&&a.providerId;if(!b)return null;var c=a&&a.oauthAccessToken,d=a&&a.oauthTokenSecret;a=a&&a.oauthIdToken;for(var e in Lf)if(Lf[e].PROVIDER_ID==b)try{return Lf[e].credential({accessToken:c,idToken:a,oauthToken:c,oauthTokenSecret:d})}catch(f){break}return null};var Nf=function(a,b,c){Q.call(this,"account-exists-with-different-credential",c);P(this,"email",a);P(this,"credential",b)};q(Nf,Q);Nf.prototype.P=function(){var a={code:this.code,message:this.message,email:this.email},b=this.credential&&this.credential.P();b&&(Xa(a,b),a.providerId=b.provider,delete a.provider);return a};var S=function(a,b,c){this.u=a;a=b||{};this.qe=a.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token";this.se=a.secureTokenTimeout||1E4;this.re=Va(a.secureTokenHeaders||Of);this.Nd=a.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/";this.Od=a.firebaseTimeout||1E4;this.Oc=Va(a.firebaseHeaders||Pf);c&&(this.Oc["X-Client-Version"]=c);this.Fd=new yc},Qf,Of={"Content-Type":"application/x-www-form-urlencoded"},Pf={"Content-Type":"application/json"},Sf=function(a, b,c,d,e,f,g){!y||!pb||9<pb?a=p(a.ue,a):(Qf||(Qf=new G(function(a,b){Rf(a,b)})),a=p(a.te,a));a(b,c,d,e,f,g)}; S.prototype.ue=function(a,b,c,d,e,f){var g=new L(this.Fd),h;f&&(g.Ua=Math.max(0,f),h=setTimeout(function(){g.dispatchEvent("timeout")},f));Zb(g,"complete",function(){h&&clearTimeout(h);var a=null;try{var c;c=this.a?mc(this.a.responseText):void 0;a=c||null}catch(d){try{a=JSON.parse(Me(this))||null}catch(e){a=null}}b&&b(a)});fc(g,"ready",function(){h&&clearTimeout(h);this.sa||(this.sa=!0,this.Ha())});fc(g,"timeout",function(){h&&clearTimeout(h);this.sa||(this.sa=!0,this.Ha());b&&b(null)});g.send(a, c,d,e)};var Tf="__fcb"+Math.floor(1E6*Math.random()).toString(),Rf=function(a,b){((window.gapi||{}).client||{}).request?a():(l[Tf]=function(){((window.gapi||{}).client||{}).request?a():b(Error("CORS_UNSUPPORTED"))},Pd(Xd("https://apis.google.com/js/client.js?onload="+Tf),function(){b(Error("CORS_UNSUPPORTED"))}))}; S.prototype.te=function(a,b,c,d,e){var f=this;Qf.then(function(){window.gapi.client.setApiKey(f.u);var g=window.gapi.auth.getToken();window.gapi.auth.setToken(null);window.gapi.client.request({path:a,method:c,body:d,headers:e,authType:"none",callback:function(a){window.gapi.auth.setToken(g);b&&b(a)}})}).M(function(a){b&&b({error:{message:a&&a.message||"CORS_UNSUPPORTED"}})})}; var Vf=function(a,b){return new G(function(c,d){"refresh_token"==b.grant_type&&b.refresh_token||"authorization_code"==b.grant_type&&b.code?Sf(a,a.qe+"?key="+encodeURIComponent(a.u),function(a){a?a.error?d(Uf(a)):a.access_token&&a.refresh_token?c(a):d(new Q("internal-error")):d(new Q("network-request-failed"))},"POST",df(b).toString(),a.re,a.se):d(new Q("internal-error"))})},Wf=function(a){var b={},c;for(c in a)null!==a[c]&&void 0!==a[c]&&(b[c]=a[c]);return pc(b)},Xf=function(a,b,c,d,e){var f=a.Nd+ b+"?key="+encodeURIComponent(a.u);e&&(f+="&cb="+la().toString());return new G(function(b,e){Sf(a,f,function(a){a?a.error?e(Uf(a)):b(a):e(new Q("network-request-failed"))},c,Wf(d),a.Oc,a.Od)})},Yf=function(a){if(!lc.test(a.email))throw new Q("invalid-email");},Zf=function(a){"email"in a&&Yf(a)},ag=function(a,b){return R(a,$f,{identifier:b,continueUri:mf()?window.location.href:"http://localhost"}).then(function(a){return a.allProviders||[]})},cg=function(a){return R(a,bg,{}).then(function(a){return a.authorizedDomains|| []})},dg=function(a){if(!a.idToken)throw new Q("internal-error");};S.prototype.signInAnonymously=function(){return R(this,eg,{})};S.prototype.updateEmail=function(a,b){return R(this,fg,{idToken:a,email:b})};S.prototype.updatePassword=function(a,b){return R(this,Jf,{idToken:a,password:b})};var gg={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"}; S.prototype.updateProfile=function(a,b){var c={idToken:a},d=[];Qa(gg,function(a,f){var g=b[f];null===g?d.push(a):f in b&&(c[f]=g)});d.length&&(c.deleteAttribute=d);return R(this,fg,c)};S.prototype.sendPasswordResetEmail=function(a){return R(this,hg,{requestType:"PASSWORD_RESET",email:a})};S.prototype.sendEmailVerification=function(a){return R(this,ig,{requestType:"VERIFY_EMAIL",idToken:a})}; var kg=function(a,b,c){return R(a,jg,{idToken:b,deleteProvider:c})},lg=function(a){if(!a.requestUri||!a.sessionId&&!a.postBody)throw new Q("internal-error");},mg=function(a){if(a.needConfirmation)throw(a&&a.email?new Nf(a.email,Mf(a),a.message):null)||new Q("account-exists-with-different-credential");if(!a.idToken)throw new Q("internal-error");},zf=function(a,b){return R(a,ng,b)},og=function(a){if(!a.oobCode)throw new Q("invalid-action-code");}; S.prototype.confirmPasswordReset=function(a,b){return R(this,pg,{oobCode:a,newPassword:b})};S.prototype.checkActionCode=function(a){return R(this,qg,{oobCode:a})};S.prototype.applyActionCode=function(a){return R(this,rg,{oobCode:a})}; var rg={endpoint:"setAccountInfo",w:og,Ta:"email"},qg={endpoint:"resetPassword",w:og,ma:function(a){if(!lc.test(a.email))throw new Q("internal-error");}},sg={endpoint:"signupNewUser",w:function(a){Yf(a);if(!a.password)throw new Q("weak-password");},ma:dg,na:!0},$f={endpoint:"createAuthUri"},tg={endpoint:"deleteAccount",Sa:["idToken"]},jg={endpoint:"setAccountInfo",Sa:["idToken","deleteProvider"],w:function(a){if(!ea(a.deleteProvider))throw new Q("internal-error");}},ug={endpoint:"getAccountInfo"}, ig={endpoint:"getOobConfirmationCode",Sa:["idToken","requestType"],w:function(a){if("VERIFY_EMAIL"!=a.requestType)throw new Q("internal-error");},Ta:"email"},hg={endpoint:"getOobConfirmationCode",Sa:["requestType"],w:function(a){if("PASSWORD_RESET"!=a.requestType)throw new Q("internal-error");Yf(a)},Ta:"email"},bg={Ed:!0,endpoint:"getProjectConfig",Wd:"GET"},pg={endpoint:"resetPassword",w:og,Ta:"email"},fg={endpoint:"setAccountInfo",Sa:["idToken"],w:Zf,na:!0},Jf={endpoint:"setAccountInfo",Sa:["idToken"], w:function(a){Zf(a);if(!a.password)throw new Q("weak-password");},ma:dg,na:!0},eg={endpoint:"signupNewUser",ma:dg,na:!0},ng={endpoint:"verifyAssertion",w:lg,ma:mg,na:!0},Bf={endpoint:"verifyAssertion",w:function(a){lg(a);if(!a.idToken)throw new Q("internal-error");},ma:mg,na:!0},vg={endpoint:"verifyCustomToken",w:function(a){if(!a.token)throw new Q("invalid-custom-token");},ma:dg,na:!0},If={endpoint:"verifyPassword",w:function(a){Yf(a);if(!a.password)throw new Q("wrong-password");},ma:dg,na:!0},R= function(a,b,c){if(!sf(c,b.Sa))return I(new Q("internal-error"));var d=b.Wd||"POST",e;return H(c).then(b.w).then(function(){b.na&&(c.returnSecureToken=!0);return Xf(a,b.endpoint,d,c,b.Ed||!1)}).then(function(a){return e=a}).then(b.ma).then(function(){if(!b.Ta)return e;if(!(b.Ta in e))throw new Q("internal-error");return e[b.Ta]})},Uf=function(a){var b;b=(a.error&&a.error.errors&&a.error.errors[0]||{}).reason||"";var c={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(b=c[b]? new Q(c[b]):null)return b;a=a.error&&a.error.message||"";b={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential", FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",EMAIL_NOT_FOUND:"user-not-found",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported"};if(b[a])return new Q(b[a]);b={TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password", OPERATION_NOT_ALLOWED:"operation-not-allowed"};for(var d in b)if(0===a.indexOf(d))return new Q(b[d]);return new Q("internal-error")};var wg=function(a){this.J=a};wg.prototype.value=function(){return this.J};wg.prototype.od=function(a){this.J.style=a;return this};var xg=function(a){this.J=a||{}};xg.prototype.value=function(){return this.J};xg.prototype.od=function(a){this.J.style=a;return this};var zg=function(a){this.Ae=a;this.jc=null;this.ke=yg(this)},Ag,Bg=function(a){var b=new xg;b.J.where=document.body;b.J.url=a.Ae;b.J.messageHandlersFilter=lf("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER");b.J.attributes=b.J.attributes||{};(new wg(b.J.attributes)).od({position:"absolute",top:"-100px",width:"1px",height:"1px"});b.J.dontclear=!0;return b},yg=function(a){return Cg().then(function(){return new G(function(b){lf("gapi.iframes.getContext")().open(Bg(a).value(),function(c){a.jc=c;a.jc.restyle({setHideOnLeave:!1}); b()})})})},Dg=function(a,b){a.ke.then(function(){a.jc.register("authEvent",b,lf("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})},Eg="__iframefcb"+Math.floor(1E6*Math.random()).toString(),Cg=function(){return Ag?Ag:Ag=new G(function(a,b){var c=function(){lf("gapi.load")("gapi.iframes",function(){a()})};lf("gapi.iframes.Iframe")?a():lf("gapi.load")?c():(l[Eg]=function(){lf("gapi.load")?c():b()},Pd(Xd("https://apis.google.com/js/api.js?onload="+Eg),function(){b()}))})};var Gg=function(a,b,c,d){this.S=a;this.u=b;this.R=c;d=this.ra=d||null;a=$e(a,"/__/auth/iframe");O(a,"apiKey",b);O(a,"appName",c);d&&O(a,"v",d);this.Yd=a.toString();this.Zd=new zg(this.Yd);this.Yb=[];Fg(this)},Hg=function(a,b,c,d,e,f,g,h,r){a=$e(a,"/__/auth/handler");O(a,"apiKey",b);O(a,"appName",c);O(a,"authType",d);O(a,"providerId",e);f&&f.length&&O(a,"scopes",f.join(","));g&&O(a,"redirectUrl",g);h&&O(a,"eventId",h);r&&O(a,"v",r);return a.toString()},Fg=function(a){Dg(a.Zd,function(b){var c={};if(b&& b.authEvent){var d=!1;b=b.authEvent||{};if(b.type){if(c=b.error)var e=(c=b.error)&&(c.name||c.code),c=e?new Q(e.substring(5),c.message):null;b=new wf(b.type,b.eventId,b.urlResponse,b.sessionId,c)}else b=null;for(c=0;c<a.Yb.length;c++)d=a.Yb[c](b)||d;c={};c.status=d?"ACK":"ERROR";return H(c)}c.status="ERROR";return H(c)})};Gg.prototype.Cc=function(a){this.Yb.push(a)};var Ig=function(a){this.Gb=a};Ig.prototype.set=function(a,b){void 0!==b?this.Gb.set(a,pc(b)):this.Gb.remove(a)};Ig.prototype.get=function(a){var b;try{b=this.Gb.get(a)}catch(c){return}if(null!==b)try{return mc(b)}catch(c){throw"Storage: Invalid value was encountered";}};Ig.prototype.remove=function(a){this.Gb.remove(a)};var Jg=function(){};var Kg=function(){};q(Kg,Jg);Kg.prototype.yb=function(){var a=0;ce(this.Xa(!0),function(b){Aa(b);a++});return a};var Lg=function(a){this.L=a};q(Lg,Kg);var Mg=function(a){if(!a.L)return!1;try{return a.L.setItem("__sak","1"),a.L.removeItem("__sak"),!0}catch(b){return!1}};k=Lg.prototype;k.set=function(a,b){try{this.L.setItem(a,b)}catch(c){if(0==this.L.length)throw"Storage mechanism: Storage disabled";throw"Storage mechanism: Quota exceeded";}};k.get=function(a){a=this.L.getItem(a);if(!m(a)&&null!==a)throw"Storage mechanism: Invalid value was encountered";return a};k.remove=function(a){this.L.removeItem(a)}; k.yb=function(){return this.L.length};k.Xa=function(a){var b=0,c=this.L,d=new ae;d.next=function(){if(b>=c.length)throw $d;var d=Aa(c.key(b++));if(a)return d;d=c.getItem(d);if(!m(d))throw"Storage mechanism: Invalid value was encountered";return d};return d};k.key=function(a){return this.L.key(a)};var Ng=function(){var a=null;try{a=window.localStorage||null}catch(b){}this.L=a};q(Ng,Lg);var Og=function(){var a=null;try{a=window.sessionStorage||null}catch(b){}this.L=a};q(Og,Lg);var Pg="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" "),T=function(a,b){return{name:a||"",Y:"a valid string",optional:!!b,Z:m}},Qg=function(a){return{name:a||"",Y:"a valid object",optional:!1,Z:ha}},Rg=function(a,b){return{name:a||"",Y:"a function",optional:!!b,Z:n}},Sg=function(){return{name:"",Y:"null",optional:!1,Z:da}},Tg=function(){return{name:"credential",Y:"a valid credential",optional:!1,Z:function(a){return!(!a||!a.zb)}}},Ug=function(){return{name:"authProvider",Y:"a valid Auth provider", optional:!1,Z:function(a){return!!(a&&a.providerId&&a.hasOwnProperty&&a.hasOwnProperty("isOAuthProvider"))}}},Vg=function(a,b,c,d){return{name:c||"",Y:a.Y+" or "+b.Y,optional:!!d,Z:function(c){return a.Z(c)||b.Z(c)}}};var Xg=function(a,b){for(var c in b){var d=b[c].name;a[d]=Wg(d,a[c],b[c].b)}},U=function(a,b,c,d){a[b]=Wg(b,c,d)},Wg=function(a,b,c){if(!c)return b;var d=Yg(a);a=function(){var a=Array.prototype.slice.call(arguments),e;a:{e=Array.prototype.slice.call(a);var h;h=0;for(var r=!1,Z=0;Z<c.length;Z++)if(c[Z].optional)r=!0;else{if(r)throw new Q("internal-error","Argument validator encountered a required argument after an optional argument.");h++}r=c.length;if(e.length<h||r<e.length)e="Expected "+(h==r?1== h?"1 argument":h+" arguments":h+"-"+r+" arguments")+" but got "+e.length+".";else{for(h=0;h<e.length;h++)if(r=c[h].optional&&void 0===e[h],!c[h].Z(e[h])&&!r){e=c[h];if(0>h||h>=Pg.length)throw new Q("internal-error","Argument validator received an unsupported number of arguments.");e=Pg[h]+" argument "+(e.name?'"'+e.name+'" ':"")+"must be "+e.Y+".";break a}e=null}}if(e)throw new Q("argument-error",d+" failed: "+e);return b.apply(this,a)};for(var e in b)a[e]=b[e];for(e in b.prototype)a.prototype[e]= b.prototype[e];return a},Yg=function(a){a=a.split(".");return a[a.length-1]};var ah=function(a,b,c){var d=(this.ra=firebase.SDK_VERSION||null)?kf(this.ra):null;this.c=new S(b,null,d);this.Na=null;this.S=a;this.u=b;this.R=c;this.pb=[];this.Vc=!1;this.Dd=p(this.Qd,this);this.nb=new Zg;this.fd=new $g;this.Va={};this.Va.unknown=this.nb;this.Va.signInViaRedirect=this.nb;this.Va.linkViaRedirect=this.nb;this.Va.signInViaPopup=this.fd;this.Va.linkViaPopup=this.fd},bh=function(a){var b=window.location.href;return cg(a).then(function(a){a:{for(var d=(b instanceof Ne?b.clone():new Ne(b, void 0)).ja,e=0;e<a.length;e++){var f;var g=a[e];f=d;var h=Rc(g);h?f=(f=Rc(f))?h.vb(f):!1:(h=g.split(".").join("\\."),f=(new RegExp("^(.+."+h+"|"+h+")$","i")).test(f));if(f){a=!0;break a}}a=!1}if(!a)throw new Q("unauthorized-domain");})},ch=function(a){a.Vc=!0;hf().then(function(){a.Xd=new Gg(a.S,a.u,a.R,a.ra);a.Xd.Cc(a.Dd)})};ah.prototype.subscribe=function(a){Ia(this.pb,a)||this.pb.push(a);this.Vc||ch(this)};ah.prototype.unsubscribe=function(a){La(this.pb,function(b){return b==a})}; ah.prototype.Qd=function(a){if(!a)throw new Q("invalid-auth-event");for(var b=!1,c=0;c<this.pb.length;c++){var d=this.pb[c];if(d.Hc(a.qa,a.ta)){(b=this.Va[a.qa])&&b.gd(a,d);b=!0;break}}a=this.nb;a.tc||(a.tc=!0,dh(a,!1,null,null));return b};ah.prototype.getRedirectResult=function(){return this.nb.getRedirectResult()}; var fh=function(a,b,c,d,e){if(!b)return I(new Q("popup-blocked"));a.Na||(a.Na=bh(a.c));return a.Na.then(function(){eh(d);var f=Hg(a.S,a.u,a.R,c,d.providerId,d.Ab(),null,e,a.ra);Gb((b||window).location,f);return b})},gh=function(a,b,c,d){a.Na||(a.Na=bh(a.c));return a.Na.then(function(){eh(c);var e=Hg(a.S,a.u,a.R,b,c.providerId,c.Ab(),window.location.href,d,a.ra);Gb(window.location,e)})},hh=function(a,b,c,d){var e=new Q("popup-closed-by-user");return gf(c).then(function(){return we(3E4).then(function(){a.Ca(b, null,e,d)})})},eh=function(a){if(!a.isOAuthProvider)throw new Q("invalid-oauth-provider");},ih={},jh=function(a,b,c){var d=b+":"+c;ih[d]||(ih[d]=new ah(a,b,c));return ih[d]},Zg=function(){this.uc=this.Mb=this.Qa=this.X=null;this.tc=!1};Zg.prototype.gd=function(a,b){if(!a)return I(new Q("invalid-auth-event"));this.tc=!0;var c=a.qa,d=a.ta;"unknown"==c?(this.X||dh(this,!1,null,null),c=H()):c=a.D?this.rc(a,b):b.ab(c,d)?this.sc(a,b):I(new Q("invalid-auth-event"));return c}; Zg.prototype.rc=function(a){this.X||dh(this,!0,null,a.getError());return H()};Zg.prototype.sc=function(a,b){var c=this,d=a.qa,e=b.ab(d,a.ta),f=a.Wa,g=a.hc(),h="signInViaRedirect"==d||"linkViaRedirect"==d;return e(f,g).then(function(a){c.X||dh(c,h,a,null)}).M(function(a){c.X||dh(c,h,null,a)})};var dh=function(a,b,c,d){b?d?(a.X=function(){return I(d)},a.Mb&&a.Mb(d)):(a.X=function(){return H(c)},a.Qa&&a.Qa(c)):(a.X=function(){return H({user:null})},a.Qa&&a.Qa({user:null}));a.Qa=null;a.Mb=null}; Zg.prototype.getRedirectResult=function(){var a=this;this.Fc||(this.Fc=new G(function(b,c){a.X?a.X().then(b,c):(a.Qa=b,a.Mb=c,kh(a))}));return this.Fc};var kh=function(a){var b=new Q("timeout");a.uc&&a.uc.cancel();a.uc=we(3E4).then(function(){a.X||dh(a,!0,null,b)})},$g=function(){};$g.prototype.gd=function(a,b){if(!a)return I(new Q("invalid-auth-event"));var c=a.qa,d=a.ta;return a.D?this.rc(a,b):b.ab(c,d)?this.sc(a,b):I(new Q("invalid-auth-event"))}; $g.prototype.rc=function(a,b){b.Ca(a.qa,null,a.getError(),a.ta);return H()};$g.prototype.sc=function(a,b){var c=a.ta,d=a.qa,e=b.ab(d,c),f=a.Wa,g=a.hc();return e(f,g).then(function(a){b.Ca(d,a,null,c)}).M(function(a){b.Ca(d,null,a,c)})};var lh=function(a){this.c=a;this.Fa=this.da=null;this.Ia=0};lh.prototype.P=function(){return{apiKey:this.c.u,refreshToken:this.da,accessToken:this.Fa,expirationTime:this.Ia}};var nh=function(a,b){var c=b.idToken,d=b.refreshToken,e=mh(b.expiresIn);a.Fa=c;a.Ia=e;a.da=d},mh=function(a){return la()+1E3*parseInt(a,10)},oh=function(a,b){return Vf(a.c,b).then(function(b){a.Fa=b.access_token;a.Ia=mh(b.expires_in);a.da=b.refresh_token;return{accessToken:a.Fa,expirationTime:a.Ia,refreshToken:a.da}})}; lh.prototype.getToken=function(a){return a||!this.Fa||la()>this.Ia-3E4?this.da?oh(this,{grant_type:"refresh_token",refresh_token:this.da}):H(null):H({accessToken:this.Fa,expirationTime:this.Ia,refreshToken:this.da})};var ph=function(a,b,c,d,e){qf(this,{uid:a,displayName:d||null,photoURL:e||null,email:c||null,providerId:b})},qh=function(a,b){Lb.call(this,a);for(var c in b)this[c]=b[c]};q(qh,Lb); var V=function(a,b,c){this.O=[];this.u=a.apiKey;this.R=a.appName;this.S=a.authDomain||null;a=firebase.SDK_VERSION?kf(firebase.SDK_VERSION):null;this.c=new S(this.u,null,a);this.pa=new lh(this.c);rh(this,b.idToken);nh(this.pa,b);P(this,"refreshToken",this.pa.da);sh(this,c||{});J.call(this);this.Jb=!1;this.S&&mf()&&(this.s=jh(this.S,this.u,this.R));this.Pb=[]};q(V,J); var rh=function(a,b){a.Xc=b;P(a,"_lat",b)},th=function(a,b){La(a.Pb,function(a){return a==b})},uh=function(a){for(var b=[],c=0;c<a.Pb.length;c++)b.push(a.Pb[c](a));return ud(b).then(function(){return a})},vh=function(a){a.s&&!a.Jb&&(a.Jb=!0,a.s.subscribe(a))},sh=function(a,b){qf(a,{uid:b.uid,displayName:b.displayName||null,photoURL:b.photoURL||null,email:b.email||null,emailVerified:b.emailVerified||!1,isAnonymous:b.isAnonymous||!1,providerData:[]})};P(V.prototype,"providerId","firebase"); var wh=function(){},xh=function(a){return H().then(function(){if(a.Id)throw new Q("app-deleted");})},yh=function(a){return Ea(a.providerData,function(a){return a.providerId})},Ah=function(a,b){b&&(zh(a,b.providerId),a.providerData.push(b))},zh=function(a,b){La(a.providerData,function(a){return a.providerId==b})},Bh=function(a,b,c){("uid"!=b||c)&&a.hasOwnProperty(b)&&P(a,b,c)}; V.prototype.copy=function(a){var b=this;b!=a&&(qf(this,{uid:a.uid,displayName:a.displayName,photoURL:a.photoURL,email:a.email,emailVerified:a.emailVerified,isAnonymous:a.isAnonymous,providerData:[]}),w(a.providerData,function(a){Ah(b,a)}),this.pa=a.pa,P(this,"refreshToken",this.pa.da))};V.prototype.reload=function(){var a=this;return xh(this).then(function(){return Ch(a).then(function(){return uh(a)}).then(wh)})}; var Ch=function(a){return a.getToken().then(function(b){var c=a.isAnonymous;return Dh(a,b).then(function(){c||Bh(a,"isAnonymous",!1);return b}).M(function(b){"auth/user-token-expired"==b.code&&(a.dispatchEvent(new qh("userDeleted")),Eh(a));throw b;})})};V.prototype.getToken=function(a){var b=this;return xh(this).then(function(){return b.pa.getToken(a)}).then(function(a){if(!a)throw new Q("internal-error");a.accessToken!=b.Xc&&(rh(b,a.accessToken),b.ka());Bh(b,"refreshToken",a.refreshToken);return a.accessToken})}; var Fh=function(a,b){b.idToken&&a.Xc!=b.idToken&&(nh(a.pa,b),a.ka(),rh(a,b.idToken))};V.prototype.ka=function(){this.dispatchEvent(new qh("tokenChanged"))};var Dh=function(a,b){return R(a.c,ug,{idToken:b}).then(p(a.me,a))}; V.prototype.me=function(a){a=a.users;if(!a||!a.length)throw new Q("internal-error");a=a[0];sh(this,{uid:a.localId,displayName:a.displayName,photoURL:a.photoUrl,email:a.email,emailVerified:!!a.emailVerified});for(var b=Gh(a),c=0;c<b.length;c++)Ah(this,b[c]);Bh(this,"isAnonymous",!(this.email&&a.passwordHash)&&!(this.providerData&&this.providerData.length))}; var Gh=function(a){return(a=a.providerUserInfo)&&a.length?Ea(a,function(a){return new ph(a.rawId,a.providerId,a.email,a.displayName,a.photoUrl)}):[]};V.prototype.reauthenticate=function(a){var b=this;return this.f(a.zb(this.c).then(function(a){var d;a:{var e=a.idToken.split(".");if(3==e.length){for(var e=e[1],f=(4-e.length%4)%4,g=0;g<f;g++)e+=".";try{var h=mc(tb(e));if(h.sub&&h.iss&&h.aud&&h.exp){d=new xf(h);break a}}catch(r){}}d=null}if(!d||b.uid!=d.fe)throw new Q("user-mismatch");Fh(b,a);return b.reload()}))}; var Hh=function(a,b){return Ch(a).then(function(){if(Ia(yh(a),b))return uh(a).then(function(){throw new Q("provider-already-linked");})})};k=V.prototype;k.link=function(a){var b=this;return this.f(Hh(this,a.provider).then(function(){return b.getToken()}).then(function(c){return a.Zc(b.c,c)}).then(p(this.Nc,this)))};k.Nc=function(a){Fh(this,a);var b=this;return this.reload().then(function(){return b})}; k.updateEmail=function(a){var b=this;return this.f(this.getToken().then(function(c){return b.c.updateEmail(c,a)}).then(function(a){Fh(b,a);return b.reload()}))};k.updatePassword=function(a){var b=this;return this.f(this.getToken().then(function(c){return b.c.updatePassword(c,a)}).then(function(a){Fh(b,a);return b.reload()}))}; k.updateProfile=function(a){if(void 0===a.displayName&&void 0===a.photoURL)return xh(this);var b=this;return this.f(this.getToken().then(function(c){return b.c.updateProfile(c,{displayName:a.displayName,photoUrl:a.photoURL})}).then(function(a){Fh(b,a);Bh(b,"displayName",a.displayName||null);Bh(b,"photoURL",a.photoUrl||null);return uh(b)}).then(wh))}; k.unlink=function(a){var b=this;return this.f(Ch(this).then(function(c){return Ia(yh(b),a)?kg(b.c,c,[a]).then(function(a){var c={};w(a.providerUserInfo||[],function(a){c[a.providerId]=!0});w(yh(b),function(a){c[a]||zh(b,a)});return uh(b)}):uh(b).then(function(){throw new Q("no-such-provider");})}))};k["delete"]=function(){var a=this;return this.f(this.getToken().then(function(b){return R(a.c,tg,{idToken:b})}).then(function(){a.dispatchEvent(new qh("userDeleted"))})).then(function(){Eh(a)})}; k.Hc=function(a,b){return"linkViaPopup"==a&&(this.ba||null)==b&&this.V||"linkViaRedirect"==a&&(this.Lb||null)==b?!0:!1};k.Ca=function(a,b,c,d){"linkViaPopup"==a&&d==(this.ba||null)&&(c&&this.ya?this.ya(c):b&&!c&&this.V&&this.V(b),this.za&&(this.za.cancel(),this.za=null),delete this.V,delete this.ya)};k.ab=function(a,b){return"linkViaPopup"==a&&b==(this.ba||null)||"linkViaRedirect"==a&&(this.Lb||null)==b?p(this.Ld,this):null};k.xb=function(){return this.uid+":::"+Math.floor(1E9*Math.random()).toString()}; k.linkWithPopup=function(a){if(!mf())return I(new Q("operation-not-supported-in-this-environment"));var b=this,c=uf(a.providerId),d=this.xb(),e=null;!nf()&&this.S&&a.isOAuthProvider&&(e=Hg(this.S,this.u,this.R,"linkViaPopup",a.providerId,a.Ab(),null,d,firebase.SDK_VERSION||null));var f=ff(e,c&&c.mb,c&&c.lb),c=Hh(this,a.providerId).then(function(){return uh(b)}).then(function(){b.Ka();return b.getToken()}).then(function(){return e?f:fh(b.s,f,"linkViaPopup",a,d)}).then(function(a){return new G(function(c, e){b.Ca("linkViaPopup",null,new Q("cancelled-popup-request"),b.ba||null);b.V=c;b.ya=e;b.ba=d;b.za=hh(b,"linkViaPopup",a,d)})}).then(function(a){f&&(f||window).close();return a}).M(function(a){f&&(f||window).close();throw a;});return this.f(c)}; k.linkWithRedirect=function(a){if(!mf())return I(new Q("operation-not-supported-in-this-environment"));var b=this,c=null,d=this.xb(),e=Hh(this,a.providerId).then(function(){b.Ka();return b.getToken()}).then(function(){b.Lb=d;return uh(b)}).then(function(a){b.Aa&&(a=b.u+":"+b.R,a=Ih(b.Aa,Jh,b.P(),a));return a}).then(function(){return gh(b.s,"linkViaRedirect",a,d)}).M(function(a){c=a;if(b.Aa)return Kh(b.Aa,Jh,b.u+":"+b.R);throw c;}).then(function(){if(c)throw c;});return this.f(e)}; k.Ka=function(){if(this.s&&this.Jb)return this.s;if(this.s&&!this.Jb)throw new Q("internal-error");throw new Q("auth-domain-config-required");};k.Ld=function(a,b){var c=this,d=null,e=this.getToken().then(function(d){return R(c.c,Bf,{requestUri:a,sessionId:b,idToken:d})}).then(function(a){d=Mf(a);return c.Nc(a)}).then(function(a){return{user:a,credential:d}});return this.f(e)}; k.sendEmailVerification=function(){var a=this;return this.f(this.getToken().then(function(b){return a.c.sendEmailVerification(b)}).then(function(b){if(a.email!=b)return a.reload()}).then(function(){}))};var Eh=function(a){for(var b=0;b<a.O.length;b++)a.O[b].cancel("app-deleted");a.O=[];a.Id=!0;P(a,"refreshToken",null);a.s&&a.s.unsubscribe(a)};V.prototype.f=function(a){var b=this;this.O.push(a);xd(a,function(){Ka(b.O,a)});return a}; V.prototype.P=function(){var a={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,isAnonymous:this.isAnonymous,providerData:[],apiKey:this.u,appName:this.R,authDomain:this.S,stsTokenManager:this.pa.P(),redirectEventId:this.Lb||null};w(this.providerData,function(b){a.providerData.push(rf(b))});return a}; var Lh=function(a){if(!a.apiKey)return null;var b={apiKey:a.apiKey,authDomain:a.authDomain,appName:a.appName},c={};if(a.stsTokenManager&&a.stsTokenManager.accessToken&&a.stsTokenManager.refreshToken&&a.stsTokenManager.expirationTime)c.idToken=a.stsTokenManager.accessToken,c.refreshToken=a.stsTokenManager.refreshToken,c.expiresIn=(a.stsTokenManager.expirationTime-la())/1E3;else return null;var d=new V(b,c,a);a.providerData&&w(a.providerData,function(a){if(a){var b={};qf(b,a);Ah(d,b)}});a.redirectEventId&& (d.Lb=a.redirectEventId);return d},Mh=function(a,b,c){var d=new V(a,b);c&&(d.Aa=c);return d.reload().then(function(){return d})};var Nh,Oh=function(a,b,c,d,e,f){this.Hd=a;this.nc=b;this.cc=c;this.td=d;this.ga=e;this.H={};this.ob=[];this.kb=0;this.$d=f||l.indexedDB},Ph=function(a){return new G(function(b,c){var d=a.$d.open(a.Hd,a.ga);d.onerror=function(a){c(Error(a.target.errorCode))};d.onupgradeneeded=function(b){b=b.target.result;try{b.createObjectStore(a.nc,{keyPath:a.cc})}catch(d){c(d)}};d.onsuccess=function(a){b(a.target.result)}})},Qh=function(a){a.Uc||(a.Uc=Ph(a));return a.Uc},Rh=function(a,b){return b.objectStore(a.nc)}, Sh=function(a,b,c){return b.transaction([a.nc],c?"readwrite":"readonly")},Th=function(a){return new G(function(b,c){a.onsuccess=function(a){a&&a.target?b(a.target.result):b()};a.onerror=function(a){c(Error(a.target.errorCode))}})}; Oh.prototype.set=function(a,b){var c=!1,d,e=this;return xd(Qh(this).then(function(b){d=b;b=Rh(e,Sh(e,d,!0));return Th(b.get(a))}).then(function(f){var g=Rh(e,Sh(e,d,!0));if(f)return f.value=b,Th(g.put(f));e.kb++;c=!0;f={};f[e.cc]=a;f[e.td]=b;return Th(g.add(f))}).then(function(){e.H[a]=b}),function(){c&&e.kb--})};Oh.prototype.get=function(a){var b=this;return Qh(this).then(function(c){return Th(Rh(b,Sh(b,c,!1)).get(a))})}; Oh.prototype.remove=function(a){var b=!1,c=this;return xd(Qh(this).then(function(d){b=!0;c.kb++;return Th(Rh(c,Sh(c,d,!0))["delete"](a))}).then(function(){delete c.H[a]}),function(){b&&c.kb--})}; Oh.prototype.we=function(){var a=this;return Qh(this).then(function(b){var c=Rh(a,Sh(a,b,!1));return c.getAll?Th(c.getAll()):new G(function(a,b){var f=[],g=c.openCursor();g.onsuccess=function(b){(b=b.target.result)?(f.push(b.value),b["continue"]()):a(f)};g.onerror=function(a){b(Error(a.target.errorCode))}})}).then(function(b){var c={},d=[];if(0==a.kb){for(d=0;d<b.length;d++)c[b[d][a.cc]]=b[d][a.td];d=ef(a.H,c);a.H=c}return d})}; var Uh=function(a,b){La(a.ob,function(a){return a==b});0==a.ob.length&&a.Qb()};Oh.prototype.Ac=function(){var a=this;this.Qb();var b=function(){a.qc=we(1E3).then(p(a.we,a)).then(function(b){0<b.length&&w(a.ob,function(a){a(b)})}).then(b).M(function(a){"STOP_EVENT"!=a.message&&b()});return a.qc};b()};Oh.prototype.Qb=function(){this.qc&&this.qc.cancel("STOP_EVENT")};var Jh={name:"redirectUser",K:!1},Vh={name:"sessionId",K:!1},Wh={name:"authEvent",K:!0},Xh={name:"authUser",K:!0},Yh=function(a,b,c,d,e,f){this.ie=a;this.md=b;this.jb=d;this.pe=e;this.kd=f;if(!Mg(new Ng)||!Mg(new Og))throw new Q("web-storage-unsupported");this.G={};this.eb=c;this.$c=p(this.ad,this);this.Tc=p(this.ae,this);this.H={}},Zh,$h=function(){if(!Zh){Nh||(Nh=new Oh("firebaseLocalStorageDb","firebaseLocalStorage","fbase_key","value",1));var a=navigator.userAgent.toLowerCase();Zh=new Yh("firebase", ":",Nh,y&&!!pb&&11==pb||/Edge\/\d+/.test($a),-1!=a.indexOf("safari")&&-1==a.indexOf("chrome")&&window!=window.top?!0:!1,nf())}return Zh},ai=function(a,b){var c;b?(a.ed||(c=new Ng,c=Mg(c)?c:null,a.ed=new Ig(c)),c=a.ed):(a.pd||(c=new Og,c=Mg(c)?c:null,a.pd=new Ig(c)),c=a.pd);return c};Yh.prototype.l=function(a,b){return this.ie+this.md+a.name+(b?this.md+b:"")}; var bi=function(a,b,c){if(a.jb&&b.K)return a.eb.get(a.l(b,c)).then(function(a){return a&&a.value});var d=a.l(b,c);c=null;try{c=ai(a,b.K).get(d)}catch(e){if(a=(b.K?window.localStorage:window.sessionStorage).getItem(d),null===a)c=null;else try{c=JSON.parse(a)}catch(f){return I(e)}}return H(c)},Kh=function(a,b,c){if(a.jb&&b.K)return a.eb.remove(a.l(b,c));ai(a,b.K).remove(a.l(b,c));b.K&&(a.H[a.l(b,c)]=null);return H()},Ih=function(a,b,c,d){if(a.jb&&b.K)return a.eb.set(a.l(b,d),c);ai(a,b.K).set(a.l(b, d),c);b.K&&(a.H[a.l(b,d)]=window.localStorage.getItem(a.l(b,d)));return H()};Yh.prototype.hc=function(a){return bi(this,Vh,a)};Yh.prototype.Cc=function(a,b){ci(this,this.l(Wh,a),b)}; var di=function(a,b,c){return bi(a,Xh,b).then(function(a){a&&c&&(a.authDomain=c);return Lh(a||{})})},ei=function(a,b,c){return bi(a,Jh,b).then(function(a){a&&c&&(a.authDomain=c);return Lh(a||{})})},ci=function(a,b,c){a.H[b]=window.localStorage.getItem(b);Ta(a.G)&&a.Ac();a.G[b]||(a.G[b]=[]);a.G[b].push(c)},fi=function(a,b,c){a.G[b]&&(La(a.G[b],function(a){return a==c}),0==a.G[b].length&&delete a.G[b]);Ta(a.G)&&a.Qb()}; Yh.prototype.Ac=function(){if(this.jb){var a=this.eb,b=this.Tc;0==a.ob.length&&a.Ac();a.ob.push(b)}else Xb(window,"storage",this.$c),this.kd||gi(this)};var gi=function(a){hi(a);a.mc=setInterval(function(){for(var b in a.G){var c=window.localStorage.getItem(b);c!=a.H[b]&&(a.H[b]=c,c=new Mb({type:"storage",key:b,target:window,oldValue:a.H[b],newValue:c}),a.ad(c))}},2E3)},hi=function(a){a.mc&&(clearInterval(a.mc),a.mc=null)}; Yh.prototype.Qb=function(){this.jb?Uh(this.eb,this.Tc):(gc(window,"storage",this.$c),this.kd||hi(this))};Yh.prototype.ad=function(a){var b=a.wb.key;if(this.pe){var c=window.localStorage.getItem(b);a=a.wb.newValue;a!=c&&(a?window.localStorage.setItem(b,a):a||window.localStorage.removeItem(b))}this.H[b]=window.localStorage.getItem(b);this.Gc(b)};Yh.prototype.ae=function(a){w(a,p(this.Gc,this))};Yh.prototype.Gc=function(a){this.G[a]&&w(this.G[a],function(a){a()})};var X=function(a){this.Lc=!1;P(this,"app",a);if(W(this).options&&W(this).options.apiKey)a=firebase.SDK_VERSION?kf(firebase.SDK_VERSION):null,this.c=new S(W(this).options&&W(this).options.apiKey,null,a);else throw new Q("invalid-api-key");this.O=[];this.Za=[];this.je=firebase.INTERNAL.createSubscribe(p(this.be,this));ii(this,null);this.Ba=this.fa=null;try{this.fa=$h(),this.Ba=$h(),this.B=ji(this)}catch(b){this.B=I(b)}this.gb=!1;this.Pc=p(this.ve,this);this.rd=p(this.La,this);this.sd=p(this.Vd,this); this.qd=p(this.Ud,this);ki(this);this.INTERNAL={};this.INTERNAL["delete"]=p(this["delete"],this)};X.prototype.Ka=function(){return this.Jd||I(new Q("auth-domain-config-required"))};var ki=function(a){var b=W(a).options.authDomain,c=W(a).options.apiKey;b&&mf()&&(a.Jd=a.B.then(function(){a.s=jh(b,c,W(a).name);a.s.subscribe(a);Y(a)&&vh(Y(a));a.vc&&(vh(a.vc),a.vc=null);return a.s}))};k=X.prototype; k.Hc=function(a,b){switch(a){case "unknown":case "signInViaRedirect":return!0;case "signInViaPopup":return this.ba==b&&!!this.V;default:return!1}};k.Ca=function(a,b,c,d){"signInViaPopup"==a&&this.ba==d&&(c&&this.ya?this.ya(c):b&&!c&&this.V&&this.V(b),this.za&&(this.za.cancel(),this.za=null),delete this.V,delete this.ya)};k.ab=function(a,b){return"signInViaRedirect"==a||"signInViaPopup"==a&&this.ba==b&&this.V?p(this.Md,this):null}; k.Md=function(a,b){var c=this,d=null,e=zf(c.c,{requestUri:a,sessionId:b}).then(function(a){d=Mf(a);return a}),f=c.B.then(function(){return e}).then(function(a){return li(c,a)}).then(function(){return{user:Y(c),credential:d}});return this.f(f)};k.xb=function(){return Math.floor(1E9*Math.random()).toString()}; k.signInWithPopup=function(a){if(!mf())return I(new Q("operation-not-supported-in-this-environment"));var b=this,c=uf(a.providerId),d=this.xb(),e=null;!nf()&&W(this).options.authDomain&&a.isOAuthProvider&&(e=Hg(W(this).options.authDomain,W(this).options.apiKey,W(this).name,"signInViaPopup",a.providerId,a.Ab(),null,d,firebase.SDK_VERSION||null));var f=ff(e,c&&c.mb,c&&c.lb),c=this.Ka().then(function(b){return e?f:fh(b,f,"signInViaPopup",a,d)}).then(function(a){return new G(function(c,e){b.Ca("signInViaPopup", null,new Q("cancelled-popup-request"),b.ba);b.V=c;b.ya=e;b.ba=d;b.za=hh(b,"signInViaPopup",a,d)})}).then(function(a){f&&(f||window).close();return a}).M(function(a){f&&(f||window).close();throw a;});return this.f(c)};k.signInWithRedirect=function(a){if(!mf())return I(new Q("operation-not-supported-in-this-environment"));var b=this,c=this.Ka().then(function(){return gh(b.s,"signInViaRedirect",a)});return this.f(c)}; k.getRedirectResult=function(){if(!mf())return I(new Q("operation-not-supported-in-this-environment"));var a=this,b=this.Ka().then(function(){return a.s.getRedirectResult()});return this.f(b)}; var li=function(a,b){var c={};c.apiKey=W(a).options.apiKey;c.authDomain=W(a).options.authDomain;c.appName=W(a).name;return a.B.then(function(){return Mh(c,b,a.Ba)}).then(function(b){if(Y(a)&&b.uid==Y(a).uid)return Y(a).copy(b),a.La(b);ii(a,b);vh(b);return a.La(b)}).then(function(){a.ka()})},ii=function(a,b){Y(a)&&(th(Y(a),a.rd),gc(Y(a),"tokenChanged",a.sd),gc(Y(a),"userDeleted",a.qd));b&&(b.Pb.push(a.rd),Xb(b,"tokenChanged",a.sd),Xb(b,"userDeleted",a.qd));P(a,"currentUser",b)}; X.prototype.signOut=function(){var a=this,b=this.B.then(function(){if(!Y(a))return H();ii(a,null);return Kh(a.fa,Xh,mi(a)).then(function(){a.ka()})});return this.f(b)}; var ni=function(a){var b=mi(a),c=ei(a.Ba,b,W(a).options.authDomain).then(function(c){if(a.vc=c)c.Aa=a.Ba;return Kh(a.Ba,Jh,b)});return a.f(c)},ji=function(a){var b=mi(a),c=W(a).options.authDomain,d=xd(ni(a).then(function(){return di(a.fa,b,c)}).then(function(c){return c?(c.Aa=a.Ba,c.reload().then(function(){return c}).M(function(d){return"auth/network-request-failed"==d.code?c:Kh(a.fa,Xh,b)})):null}).then(function(b){ii(a,b||null);a.gb=!0;a.ka()}),function(){if(!a.Lc){a.gb=!0;var c=a.fa;ci(c,c.l(Xh, b),a.Pc)}});return a.f(d)};X.prototype.ve=function(){var a=this;return di(this.fa,mi(this),W(this).options.authDomain).then(function(b){var c;if(c=Y(a)&&b){c=Y(a).uid;var d=b.uid;c=void 0===c||null===c||""===c||void 0===d||null===d||""===d?!1:c==d}if(c)return Y(a).copy(b),Y(a).getToken();ii(a,b);b&&(vh(b),b.Aa=a.Ba);a.s.subscribe(a);a.ka()})};X.prototype.La=function(a){var b=mi(this);return Ih(this.fa,Xh,a.P(),b)};X.prototype.Vd=function(){this.gb=!0;this.ka();this.La(Y(this))};X.prototype.Ud=function(){this.signOut()}; var oi=function(a,b){return a.f(b.then(function(b){return li(a,b)}).then(function(){return Y(a)}))};k=X.prototype;k.be=function(a){var b=this;this.addAuthTokenListener(function(){a.next(Y(b))})};k.onAuthStateChanged=function(a,b,c){var d=this;this.gb&&firebase.Promise.resolve().then(function(){n(a)?a(Y(d)):n(a.next)&&a.next(Y(d))});return this.je(a,b,c)};k.getToken=function(a){var b=this,c=this.B.then(function(){return Y(b)?Y(b).getToken(a).then(function(a){return{accessToken:a}}):null});return this.f(c)}; k.signInWithCustomToken=function(a){var b=this;return this.B.then(function(){return oi(b,R(b.c,vg,{token:a}))}).then(function(a){Bh(a,"isAnonymous",!1);return b.La(a)}).then(function(){return Y(b)})};k.signInWithEmailAndPassword=function(a,b){var c=this;return this.B.then(function(){return oi(c,R(c.c,If,{email:a,password:b}))})};k.createUserWithEmailAndPassword=function(a,b){var c=this;return this.B.then(function(){return oi(c,R(c.c,sg,{email:a,password:b}))})}; k.signInWithCredential=function(a){var b=this;return this.B.then(function(){return oi(b,a.zb(b.c))})};k.signInAnonymously=function(){var a=Y(this),b=this;return a&&a.isAnonymous?H(a):this.B.then(function(){return oi(b,b.c.signInAnonymously())}).then(function(a){Bh(a,"isAnonymous",!0);return b.La(a)}).then(function(){return Y(b)})};var mi=function(a){return W(a).options.apiKey+":"+W(a).name},W=function(a){return a.app},Y=function(a){return a.currentUser};k=X.prototype; k.ka=function(){for(var a=0;a<this.Za.length;a++)if(this.Za[a])this.Za[a](Y(this)&&Y(this)._lat||null)};k.addAuthTokenListener=function(a){this.Za.push(a);var b=this;this.gb&&this.B.then(function(){a(Y(b)&&Y(b)._lat||null)})};k.removeAuthTokenListener=function(a){La(this.Za,function(b){return b==a})};k["delete"]=function(){this.Lc=!0;for(var a=0;a<this.O.length;a++)this.O[a].cancel("app-deleted");this.O=[];this.fa&&(a=this.fa,fi(a,a.l(Xh,mi(this)),this.Pc));this.s&&this.s.unsubscribe(this)}; k.f=function(a){var b=this;this.O.push(a);xd(a,function(){Ka(b.O,a)});return a};k.fetchProvidersForEmail=function(a){return this.f(ag(this.c,a))};k.verifyPasswordResetCode=function(a){return this.checkActionCode(a).then(function(a){return a.data.email})};k.confirmPasswordReset=function(a,b){return this.f(this.c.confirmPasswordReset(a,b).then(function(){}))};k.checkActionCode=function(a){return this.f(this.c.checkActionCode(a).then(function(a){return{data:{email:a.email}}}))};k.applyActionCode=function(a){return this.f(this.c.applyActionCode(a).then(function(){}))}; k.sendPasswordResetEmail=function(a){return this.f(this.c.sendPasswordResetEmail(a).then(function(){}))};Xg(X.prototype,{applyActionCode:{name:"applyActionCode",b:[T("code")]},checkActionCode:{name:"checkActionCode",b:[T("code")]},confirmPasswordReset:{name:"confirmPasswordReset",b:[T("code"),T("newPassword")]},createUserWithEmailAndPassword:{name:"createUserWithEmailAndPassword",b:[T("email"),T("password")]},fetchProvidersForEmail:{name:"fetchProvidersForEmail",b:[T("email")]},getRedirectResult:{name:"getRedirectResult",b:[]},onAuthStateChanged:{name:"onAuthStateChanged",b:[Vg(Qg(),Rg(),"nextOrObserver"), Rg("opt_error",!0),Rg("opt_completed",!0)]},sendPasswordResetEmail:{name:"sendPasswordResetEmail",b:[T("email")]},signInAnonymously:{name:"signInAnonymously",b:[]},signInWithCredential:{name:"signInWithCredential",b:[Tg()]},signInWithCustomToken:{name:"signInWithCustomToken",b:[T("token")]},signInWithEmailAndPassword:{name:"signInWithEmailAndPassword",b:[T("email"),T("password")]},signInWithPopup:{name:"signInWithPopup",b:[Ug()]},signInWithRedirect:{name:"signInWithRedirect",b:[Ug()]},signOut:{name:"signOut", b:[]},verifyPasswordResetCode:{name:"verifyPasswordResetCode",b:[T("code")]}}); Xg(V.prototype,{"delete":{name:"delete",b:[]},getToken:{name:"getToken",b:[{name:"opt_forceRefresh",Y:"a boolean",optional:!0,Z:function(a){return"boolean"==typeof a}}]},link:{name:"link",b:[Tg()]},linkWithPopup:{name:"linkWithPopup",b:[Ug()]},linkWithRedirect:{name:"linkWithRedirect",b:[Ug()]},reauthenticate:{name:"reauthenticate",b:[Tg()]},reload:{name:"reload",b:[]},sendEmailVerification:{name:"sendEmailVerification",b:[]},unlink:{name:"unlink",b:[T("provider")]},updateEmail:{name:"updateEmail", b:[T("email")]},updatePassword:{name:"updatePassword",b:[T("password")]},updateProfile:{name:"updateProfile",b:[Qg("profile")]}});Xg(G.prototype,{M:{name:"catch"},then:{name:"then"}});U(Kf,"credential",function(a,b){return new Hf(a,b)},[T("email"),T("password")]);Xg(Df.prototype,{addScope:{name:"addScope",b:[T("scope")]}});U(Df,"credential",Df.credential,[Vg(T(),Qg(),"token")]);Xg(Ef.prototype,{addScope:{name:"addScope",b:[T("scope")]}});U(Ef,"credential",Ef.credential,[Vg(T(),Qg(),"token")]); Xg(Ff.prototype,{addScope:{name:"addScope",b:[T("scope")]}});U(Ff,"credential",Ff.credential,[Vg(T(),Vg(Qg(),Sg()),"idToken"),Vg(T(),Sg(),"accessToken",!0)]);U(Gf,"credential",Gf.credential,[Vg(T(),Qg(),"token"),T("secret",!0)]); (function(){if("undefined"!==typeof firebase&&firebase.INTERNAL&&firebase.INTERNAL.registerService){var a={Auth:X,Error:Q};U(a,"EmailAuthProvider",Kf,[]);U(a,"FacebookAuthProvider",Df,[]);U(a,"GithubAuthProvider",Ef,[]);U(a,"GoogleAuthProvider",Ff,[]);U(a,"TwitterAuthProvider",Gf,[]);firebase.INTERNAL.registerService("auth",function(a,c){var d=new X(a);c({INTERNAL:{getToken:p(d.getToken,d),addAuthTokenListener:p(d.addAuthTokenListener,d),removeAuthTokenListener:p(d.removeAuthTokenListener,d)}});return d}, a);firebase.INTERNAL.registerAppHook(function(a,c){"create"===a&&c.auth()});firebase.INTERNAL.extendNamespace({User:V})}else throw Error("Cannot find the firebase namespace; be sure to include firebase-app.js before this library.");})();})(); (function() {var g,n=this;function p(a){return void 0!==a}function aa(){}function ba(a){a.Wb=function(){return a.af?a.af:a.af=new a}} function ca(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function da(a){return"array"==ca(a)}function ea(a){var b=ca(a);return"array"==b||"object"==b&&"number"==typeof a.length}function q(a){return"string"==typeof a}function fa(a){return"number"==typeof a}function ga(a){return"function"==ca(a)}function ha(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function ia(a,b,c){return a.call.apply(a.bind,arguments)} function ja(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function r(a,b,c){r=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ia:ja;return r.apply(null,arguments)} function ka(a,b){function c(){}c.prototype=b.prototype;a.Fg=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Cg=function(a,c,f){for(var h=Array(arguments.length-2),k=2;k<arguments.length;k++)h[k-2]=arguments[k];return b.prototype[c].apply(a,h)}};function la(){this.Ya=-1};function ma(){this.Ya=-1;this.Ya=64;this.N=[];this.Wd=[];this.If=[];this.zd=[];this.zd[0]=128;for(var a=1;a<this.Ya;++a)this.zd[a]=0;this.Pd=this.ac=0;this.reset()}ka(ma,la);ma.prototype.reset=function(){this.N[0]=1732584193;this.N[1]=4023233417;this.N[2]=2562383102;this.N[3]=271733878;this.N[4]=3285377520;this.Pd=this.ac=0}; function na(a,b,c){c||(c=0);var d=a.If;if(q(b))for(var e=0;16>e;e++)d[e]=b.charCodeAt(c)<<24|b.charCodeAt(c+1)<<16|b.charCodeAt(c+2)<<8|b.charCodeAt(c+3),c+=4;else for(e=0;16>e;e++)d[e]=b[c]<<24|b[c+1]<<16|b[c+2]<<8|b[c+3],c+=4;for(e=16;80>e;e++){var f=d[e-3]^d[e-8]^d[e-14]^d[e-16];d[e]=(f<<1|f>>>31)&4294967295}b=a.N[0];c=a.N[1];for(var h=a.N[2],k=a.N[3],m=a.N[4],l,e=0;80>e;e++)40>e?20>e?(f=k^c&(h^k),l=1518500249):(f=c^h^k,l=1859775393):60>e?(f=c&h|k&(c|h),l=2400959708):(f=c^h^k,l=3395469782),f=(b<< 5|b>>>27)+f+m+l+d[e]&4294967295,m=k,k=h,h=(c<<30|c>>>2)&4294967295,c=b,b=f;a.N[0]=a.N[0]+b&4294967295;a.N[1]=a.N[1]+c&4294967295;a.N[2]=a.N[2]+h&4294967295;a.N[3]=a.N[3]+k&4294967295;a.N[4]=a.N[4]+m&4294967295} ma.prototype.update=function(a,b){if(null!=a){p(b)||(b=a.length);for(var c=b-this.Ya,d=0,e=this.Wd,f=this.ac;d<b;){if(0==f)for(;d<=c;)na(this,a,d),d+=this.Ya;if(q(a))for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,f==this.Ya){na(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,f==this.Ya){na(this,e);f=0;break}}this.ac=f;this.Pd+=b}};function t(a,b){for(var c in a)b.call(void 0,a[c],c,a)}function oa(a,b){var c={},d;for(d in a)c[d]=b.call(void 0,a[d],d,a);return c}function pa(a,b){for(var c in a)if(!b.call(void 0,a[c],c,a))return!1;return!0}function qa(a){var b=0,c;for(c in a)b++;return b}function ra(a){for(var b in a)return b}function sa(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function ta(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function ua(a,b){for(var c in a)if(a[c]==b)return!0;return!1} function va(a,b,c){for(var d in a)if(b.call(c,a[d],d,a))return d}function wa(a,b){var c=va(a,b,void 0);return c&&a[c]}function xa(a){for(var b in a)return!1;return!0}function ya(a){var b={},c;for(c in a)b[c]=a[c];return b};function za(a){a=String(a);if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);}function Aa(){this.Fd=void 0} function Ba(a,b,c){switch(typeof b){case "string":Ca(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(null==b){c.push("null");break}if(da(b)){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),e=b[f],Ba(a,a.Fd?a.Fd.call(b,String(f),e):e,c),e=",";c.push("]");break}c.push("{");d="";for(f in b)Object.prototype.hasOwnProperty.call(b,f)&&(e=b[f],"function"!=typeof e&&(c.push(d),Ca(f,c), c.push(":"),Ba(a,a.Fd?a.Fd.call(b,f,e):e,c),d=","));c.push("}");break;case "function":break;default:throw Error("Unknown type: "+typeof b);}}var Da={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Ea=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g; function Ca(a,b){b.push('"',a.replace(Ea,function(a){if(a in Da)return Da[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return Da[a]=e+b.toString(16)}),'"')};var v;a:{var Fa=n.navigator;if(Fa){var Ga=Fa.userAgent;if(Ga){v=Ga;break a}}v=""};function Ha(a){if(Error.captureStackTrace)Error.captureStackTrace(this,Ha);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}ka(Ha,Error);Ha.prototype.name="CustomError";var w=Array.prototype,Ia=w.indexOf?function(a,b,c){return w.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(q(a))return q(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Ja=w.forEach?function(a,b,c){w.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},Ka=w.filter?function(a,b,c){return w.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,h=q(a)? a.split(""):a,k=0;k<d;k++)if(k in h){var m=h[k];b.call(c,m,k,a)&&(e[f++]=m)}return e},La=w.map?function(a,b,c){return w.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=q(a)?a.split(""):a,h=0;h<d;h++)h in f&&(e[h]=b.call(c,f[h],h,a));return e},Ma=w.reduce?function(a,b,c,d){for(var e=[],f=1,h=arguments.length;f<h;f++)e.push(arguments[f]);d&&(e[0]=r(b,d));return w.reduce.apply(a,e)}:function(a,b,c,d){var e=c;Ja(a,function(c,h){e=b.call(d,e,c,h,a)});return e},Na=w.every?function(a,b, c){return w.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return!1;return!0};function Oa(a,b){var c=Pa(a,b,void 0);return 0>c?null:q(a)?a.charAt(c):a[c]}function Pa(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return f;return-1}function Qa(a,b){var c=Ia(a,b);0<=c&&w.splice.call(a,c,1)}function Ra(a,b,c){return 2>=arguments.length?w.slice.call(a,b):w.slice.call(a,b,c)} function Sa(a,b){a.sort(b||Ta)}function Ta(a,b){return a>b?1:a<b?-1:0};var Ua=-1!=v.indexOf("Opera")||-1!=v.indexOf("OPR"),Va=-1!=v.indexOf("Trident")||-1!=v.indexOf("MSIE"),Wa=-1!=v.indexOf("Gecko")&&-1==v.toLowerCase().indexOf("webkit")&&!(-1!=v.indexOf("Trident")||-1!=v.indexOf("MSIE")),Xa=-1!=v.toLowerCase().indexOf("webkit"); (function(){var a="",b;if(Ua&&n.opera)return a=n.opera.version,ga(a)?a():a;Wa?b=/rv\:([^\);]+)(\)|;)/:Va?b=/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/:Xa&&(b=/WebKit\/(\S+)/);b&&(a=(a=b.exec(v))?a[1]:"");return Va&&(b=(b=n.document)?b.documentMode:void 0,b>parseFloat(a))?String(b):a})();var Ya=null,Za=null,$a=null;function ab(a,b){if(!ea(a))throw Error("encodeByteArray takes an array as a parameter");bb();for(var c=b?Za:Ya,d=[],e=0;e<a.length;e+=3){var f=a[e],h=e+1<a.length,k=h?a[e+1]:0,m=e+2<a.length,l=m?a[e+2]:0,u=f>>2,f=(f&3)<<4|k>>4,k=(k&15)<<2|l>>6,l=l&63;m||(l=64,h||(k=64));d.push(c[u],c[f],c[k],c[l])}return d.join("")} function bb(){if(!Ya){Ya={};Za={};$a={};for(var a=0;65>a;a++)Ya[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),Za[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a),$a[Za[a]]=a,62<=a&&($a["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a)]=a)}};function cb(a){n.setTimeout(function(){throw a;},0)}var db; function eb(){var a=n.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&-1==v.indexOf("Presto")&&(a=function(){var a=document.createElement("iframe");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write("");a.close();var c="callImmediate"+Math.random(),d="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host,a=r(function(a){if(("*"==d||a.origin== d)&&a.data==c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof a&&-1==v.indexOf("Trident")&&-1==v.indexOf("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(p(c.next)){c=c.next;var a=c.Le;c.Le=null;a()}};return function(a){d.next={Le:a};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("script")?function(a){var b= document.createElement("script");b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){n.setTimeout(a,0)}};function fb(a,b){gb||hb();ib||(gb(),ib=!0);jb.push(new kb(a,b))}var gb;function hb(){if(n.Promise&&n.Promise.resolve){var a=n.Promise.resolve();gb=function(){a.then(lb)}}else gb=function(){var a=lb;!ga(n.setImmediate)||n.Window&&n.Window.prototype&&n.Window.prototype.setImmediate==n.setImmediate?(db||(db=eb()),db(a)):n.setImmediate(a)}}var ib=!1,jb=[];[].push(function(){ib=!1;jb=[]}); function lb(){for(;jb.length;){var a=jb;jb=[];for(var b=0;b<a.length;b++){var c=a[b];try{c.Vf.call(c.scope)}catch(d){cb(d)}}}ib=!1}function kb(a,b){this.Vf=a;this.scope=b};function mb(a,b){this.L=nb;this.tf=void 0;this.Ca=this.Ha=null;this.jd=this.be=!1;if(a==ob)pb(this,qb,b);else try{var c=this;a.call(b,function(a){pb(c,qb,a)},function(a){if(!(a instanceof rb))try{if(a instanceof Error)throw a;throw Error("Promise rejected.");}catch(b){}pb(c,sb,a)})}catch(d){pb(this,sb,d)}}var nb=0,qb=2,sb=3;function ob(){}mb.prototype.then=function(a,b,c){return tb(this,ga(a)?a:null,ga(b)?b:null,c)};mb.prototype.then=mb.prototype.then;mb.prototype.$goog_Thenable=!0;g=mb.prototype; g.yg=function(a,b){return tb(this,null,a,b)};g.cancel=function(a){this.L==nb&&fb(function(){var b=new rb(a);ub(this,b)},this)};function ub(a,b){if(a.L==nb)if(a.Ha){var c=a.Ha;if(c.Ca){for(var d=0,e=-1,f=0,h;h=c.Ca[f];f++)if(h=h.m)if(d++,h==a&&(e=f),0<=e&&1<d)break;0<=e&&(c.L==nb&&1==d?ub(c,b):(d=c.Ca.splice(e,1)[0],vb(c,d,sb,b)))}a.Ha=null}else pb(a,sb,b)}function wb(a,b){a.Ca&&a.Ca.length||a.L!=qb&&a.L!=sb||xb(a);a.Ca||(a.Ca=[]);a.Ca.push(b)} function tb(a,b,c,d){var e={m:null,gf:null,jf:null};e.m=new mb(function(a,h){e.gf=b?function(c){try{var e=b.call(d,c);a(e)}catch(l){h(l)}}:a;e.jf=c?function(b){try{var e=c.call(d,b);!p(e)&&b instanceof rb?h(b):a(e)}catch(l){h(l)}}:h});e.m.Ha=a;wb(a,e);return e.m}g.Bf=function(a){this.L=nb;pb(this,qb,a)};g.Cf=function(a){this.L=nb;pb(this,sb,a)}; function pb(a,b,c){if(a.L==nb){if(a==c)b=sb,c=new TypeError("Promise cannot resolve to itself");else{var d;if(c)try{d=!!c.$goog_Thenable}catch(e){d=!1}else d=!1;if(d){a.L=1;c.then(a.Bf,a.Cf,a);return}if(ha(c))try{var f=c.then;if(ga(f)){yb(a,c,f);return}}catch(h){b=sb,c=h}}a.tf=c;a.L=b;a.Ha=null;xb(a);b!=sb||c instanceof rb||zb(a,c)}}function yb(a,b,c){function d(b){f||(f=!0,a.Cf(b))}function e(b){f||(f=!0,a.Bf(b))}a.L=1;var f=!1;try{c.call(b,e,d)}catch(h){d(h)}} function xb(a){a.be||(a.be=!0,fb(a.Tf,a))}g.Tf=function(){for(;this.Ca&&this.Ca.length;){var a=this.Ca;this.Ca=null;for(var b=0;b<a.length;b++)vb(this,a[b],this.L,this.tf)}this.be=!1};function vb(a,b,c,d){if(c==qb)b.gf(d);else{if(b.m)for(;a&&a.jd;a=a.Ha)a.jd=!1;b.jf(d)}}function zb(a,b){a.jd=!0;fb(function(){a.jd&&Ab.call(null,b)})}var Ab=cb;function rb(a){Ha.call(this,a)}ka(rb,Ha);rb.prototype.name="cancel";function Bb(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function x(a,b){if(Object.prototype.hasOwnProperty.call(a,b))return a[b]}function Cb(a,b){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b(c,a[c])};function y(a,b,c,d){var e;d<b?e="at least "+b:d>c&&(e=0===c?"none":"no more than "+c);if(e)throw Error(a+" failed: Was called with "+d+(1===d?" argument.":" arguments.")+" Expects "+e+".");}function Db(a,b,c){var d="";switch(b){case 1:d=c?"first":"First";break;case 2:d=c?"second":"Second";break;case 3:d=c?"third":"Third";break;case 4:d=c?"fourth":"Fourth";break;default:throw Error("errorPrefix called with argumentNumber > 4. Need to update it?");}return a=a+" failed: "+(d+" argument ")} function A(a,b,c,d){if((!d||p(c))&&!ga(c))throw Error(Db(a,b,d)+"must be a valid function.");}function Eb(a,b,c){if(p(c)&&(!ha(c)||null===c))throw Error(Db(a,b,!0)+"must be a valid context object.");};function Fb(a){var b=[];Cb(a,function(a,d){da(d)?Ja(d,function(d){b.push(encodeURIComponent(a)+"="+encodeURIComponent(d))}):b.push(encodeURIComponent(a)+"="+encodeURIComponent(d))});return b.length?"&"+b.join("&"):""};var Gb=n.Promise||mb;mb.prototype["catch"]=mb.prototype.yg;function Hb(){var a=this;this.reject=this.resolve=null;this.ra=new Gb(function(b,c){a.resolve=b;a.reject=c})}function Ib(a,b){return function(c,d){c?a.reject(c):a.resolve(d);ga(b)&&(Jb(a.ra),1===b.length?b(c):b(c,d))}}function Jb(a){a.then(void 0,aa)};function Kb(a,b){if(!a)throw Lb(b);}function Lb(a){return Error("Firebase Database ("+firebase.SDK_VERSION+") INTERNAL ASSERT FAILED: "+a)};function Mb(a){for(var b=[],c=0,d=0;d<a.length;d++){var e=a.charCodeAt(d);55296<=e&&56319>=e&&(e-=55296,d++,Kb(d<a.length,"Surrogate pair missing trail surrogate."),e=65536+(e<<10)+(a.charCodeAt(d)-56320));128>e?b[c++]=e:(2048>e?b[c++]=e>>6|192:(65536>e?b[c++]=e>>12|224:(b[c++]=e>>18|240,b[c++]=e>>12&63|128),b[c++]=e>>6&63|128),b[c++]=e&63|128)}return b}function Nb(a){for(var b=0,c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b++:2048>d?b+=2:55296<=d&&56319>=d?(b+=4,c++):b+=3}return b};function Ob(a){return"undefined"!==typeof JSON&&p(JSON.parse)?JSON.parse(a):za(a)}function B(a){if("undefined"!==typeof JSON&&p(JSON.stringify))a=JSON.stringify(a);else{var b=[];Ba(new Aa,a,b);a=b.join("")}return a};function Pb(a,b){this.committed=a;this.snapshot=b};function Qb(a){this.te=a;this.Bd=[];this.Rb=0;this.Yd=-1;this.Gb=null}function Rb(a,b,c){a.Yd=b;a.Gb=c;a.Yd<a.Rb&&(a.Gb(),a.Gb=null)}function Sb(a,b,c){for(a.Bd[b]=c;a.Bd[a.Rb];){var d=a.Bd[a.Rb];delete a.Bd[a.Rb];for(var e=0;e<d.length;++e)if(d[e]){var f=a;Tb(function(){f.te(d[e])})}if(a.Rb===a.Yd){a.Gb&&(clearTimeout(a.Gb),a.Gb(),a.Gb=null);break}a.Rb++}};function Ub(){this.qc={}}Ub.prototype.set=function(a,b){null==b?delete this.qc[a]:this.qc[a]=b};Ub.prototype.get=function(a){return Bb(this.qc,a)?this.qc[a]:null};Ub.prototype.remove=function(a){delete this.qc[a]};Ub.prototype.bf=!0;function Vb(a){this.vc=a;this.Cd="firebase:"}g=Vb.prototype;g.set=function(a,b){null==b?this.vc.removeItem(this.Cd+a):this.vc.setItem(this.Cd+a,B(b))};g.get=function(a){a=this.vc.getItem(this.Cd+a);return null==a?null:Ob(a)};g.remove=function(a){this.vc.removeItem(this.Cd+a)};g.bf=!1;g.toString=function(){return this.vc.toString()};function Wb(a){try{if("undefined"!==typeof window&&"undefined"!==typeof window[a]){var b=window[a];b.setItem("firebase:sentinel","cache");b.removeItem("firebase:sentinel");return new Vb(b)}}catch(c){}return new Ub}var Xb=Wb("localStorage"),Yb=Wb("sessionStorage");function Zb(a,b,c){this.type=$b;this.source=a;this.path=b;this.Ja=c}Zb.prototype.Nc=function(a){return this.path.e()?new Zb(this.source,C,this.Ja.R(a)):new Zb(this.source,D(this.path),this.Ja)};Zb.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" overwrite: "+this.Ja.toString()+")"};function ac(a,b){this.type=bc;this.source=a;this.path=b}ac.prototype.Nc=function(){return this.path.e()?new ac(this.source,C):new ac(this.source,D(this.path))};ac.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" listen_complete)"};function cc(a){this.He=a}cc.prototype.getToken=function(a){return this.He.INTERNAL.getToken(a).then(null,function(a){return a&&"auth/token-not-initialized"===a.code?(E("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(a)})};function dc(a,b){a.He.INTERNAL.addAuthTokenListener(b)};function ec(){this.Jd=F}ec.prototype.j=function(a){return this.Jd.Q(a)};ec.prototype.toString=function(){return this.Jd.toString()};function fc(a,b,c,d,e){this.host=a.toLowerCase();this.domain=this.host.substr(this.host.indexOf(".")+1);this.Sc=b;this.pe=c;this.Ag=d;this.mf=e||"";this.bb=Xb.get("host:"+a)||this.host}function gc(a,b){b!==a.bb&&(a.bb=b,"s-"===a.bb.substr(0,2)&&Xb.set("host:"+a.host,a.bb))} function hc(a,b,c){H("string"===typeof b,"typeof type must == string");H("object"===typeof c,"typeof params must == object");if("websocket"===b)b=(a.Sc?"wss://":"ws://")+a.bb+"/.ws?";else if("long_polling"===b)b=(a.Sc?"https://":"http://")+a.bb+"/.lp?";else throw Error("Unknown connection type: "+b);a.host!==a.bb&&(c.ns=a.pe);var d=[];t(c,function(a,b){d.push(b+"="+a)});return b+d.join("&")} fc.prototype.toString=function(){var a=(this.Sc?"https://":"http://")+this.host;this.mf&&(a+="<"+this.mf+">");return a};function ic(a,b){this.yf={};this.Vc=new jc(a);this.va=b;var c=1E4+2E4*Math.random();setTimeout(r(this.qf,this),Math.floor(c))}ic.prototype.qf=function(){var a=this.Vc.get(),b={},c=!1,d;for(d in a)0<a[d]&&Bb(this.yf,d)&&(b[d]=a[d],c=!0);c&&this.va.ye(b);setTimeout(r(this.qf,this),Math.floor(6E5*Math.random()))};function kc(){this.uc={}}function lc(a,b,c){p(c)||(c=1);Bb(a.uc,b)||(a.uc[b]=0);a.uc[b]+=c}kc.prototype.get=function(){return ya(this.uc)};function jc(a){this.Mf=a;this.rd=null}jc.prototype.get=function(){var a=this.Mf.get(),b=ya(a);if(this.rd)for(var c in this.rd)b[c]-=this.rd[c];this.rd=a;return b};var mc={},nc={};function oc(a){a=a.toString();mc[a]||(mc[a]=new kc);return mc[a]}function pc(a,b){var c=a.toString();nc[c]||(nc[c]=b());return nc[c]};function qc(){this.wb=[]}function rc(a,b){for(var c=null,d=0;d<b.length;d++){var e=b[d],f=e.Zb();null===c||f.ca(c.Zb())||(a.wb.push(c),c=null);null===c&&(c=new sc(f));c.add(e)}c&&a.wb.push(c)}function tc(a,b,c){rc(a,c);uc(a,function(a){return a.ca(b)})}function vc(a,b,c){rc(a,c);uc(a,function(a){return a.contains(b)||b.contains(a)})} function uc(a,b){for(var c=!0,d=0;d<a.wb.length;d++){var e=a.wb[d];if(e)if(e=e.Zb(),b(e)){for(var e=a.wb[d],f=0;f<e.hd.length;f++){var h=e.hd[f];if(null!==h){e.hd[f]=null;var k=h.Ub();wc&&E("event: "+h.toString());Tb(k)}}a.wb[d]=null}else c=!1}c&&(a.wb=[])}function sc(a){this.qa=a;this.hd=[]}sc.prototype.add=function(a){this.hd.push(a)};sc.prototype.Zb=function(){return this.qa};function xc(a,b,c,d){this.ae=b;this.Md=c;this.Dd=d;this.gd=a}xc.prototype.Zb=function(){var a=this.Md.xb();return"value"===this.gd?a.path:a.getParent().path};xc.prototype.ge=function(){return this.gd};xc.prototype.Ub=function(){return this.ae.Ub(this)};xc.prototype.toString=function(){return this.Zb().toString()+":"+this.gd+":"+B(this.Md.Te())};function yc(a,b,c){this.ae=a;this.error=b;this.path=c}yc.prototype.Zb=function(){return this.path};yc.prototype.ge=function(){return"cancel"}; yc.prototype.Ub=function(){return this.ae.Ub(this)};yc.prototype.toString=function(){return this.path.toString()+":cancel"};function zc(){}zc.prototype.We=function(){return null};zc.prototype.fe=function(){return null};var Ac=new zc;function Bc(a,b,c){this.Ff=a;this.Na=b;this.yd=c}Bc.prototype.We=function(a){var b=this.Na.O;if(Cc(b,a))return b.j().R(a);b=null!=this.yd?new Dc(this.yd,!0,!1):this.Na.u();return this.Ff.rc(a,b)};Bc.prototype.fe=function(a,b,c){var d=null!=this.yd?this.yd:Ec(this.Na);a=this.Ff.Xd(d,b,1,c,a);return 0===a.length?null:a[0]};function I(a,b,c,d){this.type=a;this.Ma=b;this.Za=c;this.qe=d;this.Dd=void 0}function Fc(a){return new I(Gc,a)}var Gc="value";function Dc(a,b,c){this.A=a;this.ea=b;this.Tb=c}function Hc(a){return a.ea}function Ic(a){return a.Tb}function Jc(a,b){return b.e()?a.ea&&!a.Tb:Cc(a,J(b))}function Cc(a,b){return a.ea&&!a.Tb||a.A.Fa(b)}Dc.prototype.j=function(){return this.A};function Kc(a,b){return Lc(a.name,b.name)}function Mc(a,b){return Lc(a,b)};function K(a,b){this.name=a;this.S=b}function Nc(a,b){return new K(a,b)};function Oc(a,b){return a&&"object"===typeof a?(H(".sv"in a,"Unexpected leaf node or priority contents"),b[a[".sv"]]):a}function Pc(a,b){var c=new Qc;Rc(a,new L(""),function(a,e){Sc(c,a,Tc(e,b))});return c}function Tc(a,b){var c=a.C().H(),c=Oc(c,b),d;if(a.J()){var e=Oc(a.Ea(),b);return e!==a.Ea()||c!==a.C().H()?new Uc(e,M(c)):a}d=a;c!==a.C().H()&&(d=d.ga(new Uc(c)));a.P(N,function(a,c){var e=Tc(c,b);e!==c&&(d=d.U(a,e))});return d};var Vc=function(){var a=1;return function(){return a++}}(),H=Kb,Wc=Lb; function Xc(a){try{var b;if("undefined"!==typeof atob)b=atob(a);else{bb();for(var c=$a,d=[],e=0;e<a.length;){var f=c[a.charAt(e++)],h=e<a.length?c[a.charAt(e)]:0;++e;var k=e<a.length?c[a.charAt(e)]:64;++e;var m=e<a.length?c[a.charAt(e)]:64;++e;if(null==f||null==h||null==k||null==m)throw Error();d.push(f<<2|h>>4);64!=k&&(d.push(h<<4&240|k>>2),64!=m&&d.push(k<<6&192|m))}if(8192>d.length)b=String.fromCharCode.apply(null,d);else{a="";for(c=0;c<d.length;c+=8192)a+=String.fromCharCode.apply(null,Ra(d,c, c+8192));b=a}}return b}catch(l){E("base64Decode failed: ",l)}return null}function Yc(a){var b=Mb(a);a=new ma;a.update(b);var b=[],c=8*a.Pd;56>a.ac?a.update(a.zd,56-a.ac):a.update(a.zd,a.Ya-(a.ac-56));for(var d=a.Ya-1;56<=d;d--)a.Wd[d]=c&255,c/=256;na(a,a.Wd);for(d=c=0;5>d;d++)for(var e=24;0<=e;e-=8)b[c]=a.N[d]>>e&255,++c;return ab(b)} function Zc(a){for(var b="",c=0;c<arguments.length;c++)b=ea(arguments[c])?b+Zc.apply(null,arguments[c]):"object"===typeof arguments[c]?b+B(arguments[c]):b+arguments[c],b+=" ";return b}var wc=null,$c=!0; function ad(a,b){Kb(!b||!0===a||!1===a,"Can't turn on custom loggers persistently.");!0===a?("undefined"!==typeof console&&("function"===typeof console.log?wc=r(console.log,console):"object"===typeof console.log&&(wc=function(a){console.log(a)})),b&&Yb.set("logging_enabled",!0)):ga(a)?wc=a:(wc=null,Yb.remove("logging_enabled"))}function E(a){!0===$c&&($c=!1,null===wc&&!0===Yb.get("logging_enabled")&&ad(!0));if(wc){var b=Zc.apply(null,arguments);wc(b)}} function bd(a){return function(){E(a,arguments)}}function cd(a){if("undefined"!==typeof console){var b="FIREBASE INTERNAL ERROR: "+Zc.apply(null,arguments);"undefined"!==typeof console.error?console.error(b):console.log(b)}}function dd(a){var b=Zc.apply(null,arguments);throw Error("FIREBASE FATAL ERROR: "+b);}function O(a){if("undefined"!==typeof console){var b="FIREBASE WARNING: "+Zc.apply(null,arguments);"undefined"!==typeof console.warn?console.warn(b):console.log(b)}} function ed(a){var b,c,d,e,f,h=a;f=c=a=b="";d=!0;e="https";if(q(h)){var k=h.indexOf("//");0<=k&&(e=h.substring(0,k-1),h=h.substring(k+2));k=h.indexOf("/");-1===k&&(k=h.length);b=h.substring(0,k);f="";h=h.substring(k).split("/");for(k=0;k<h.length;k++)if(0<h[k].length){var m=h[k];try{m=decodeURIComponent(m.replace(/\+/g," "))}catch(l){}f+="/"+m}h=b.split(".");3===h.length?(a=h[1],c=h[0].toLowerCase()):2===h.length&&(a=h[0]);k=b.indexOf(":");0<=k&&(d="https"===e||"wss"===e)}"firebase"===a&&dd(b+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"); c&&"undefined"!=c||dd("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com");d||"undefined"!==typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&O("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");return{kc:new fc(b,d,c,"ws"===e||"wss"===e),path:new L(f)}}function fd(a){return fa(a)&&(a!=a||a==Number.POSITIVE_INFINITY||a==Number.NEGATIVE_INFINITY)} function gd(a){if("complete"===document.readyState)a();else{var b=!1,c=function(){document.body?b||(b=!0,a()):setTimeout(c,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",c,!1),window.addEventListener("load",c,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&c()}),window.attachEvent("onload",c))}} function Lc(a,b){if(a===b)return 0;if("[MIN_NAME]"===a||"[MAX_NAME]"===b)return-1;if("[MIN_NAME]"===b||"[MAX_NAME]"===a)return 1;var c=hd(a),d=hd(b);return null!==c?null!==d?0==c-d?a.length-b.length:c-d:-1:null!==d?1:a<b?-1:1}function id(a,b){if(b&&a in b)return b[a];throw Error("Missing required key ("+a+") in object: "+B(b));} function jd(a){if("object"!==typeof a||null===a)return B(a);var b=[],c;for(c in a)b.push(c);b.sort();c="{";for(var d=0;d<b.length;d++)0!==d&&(c+=","),c+=B(b[d]),c+=":",c+=jd(a[b[d]]);return c+"}"}function kd(a,b){if(a.length<=b)return[a];for(var c=[],d=0;d<a.length;d+=b)d+b>a?c.push(a.substring(d,a.length)):c.push(a.substring(d,d+b));return c}function ld(a,b){if(da(a))for(var c=0;c<a.length;++c)b(c,a[c]);else t(a,b)} function md(a){H(!fd(a),"Invalid JSON number");var b,c,d,e;0===a?(d=c=0,b=-Infinity===1/a?1:0):(b=0>a,a=Math.abs(a),a>=Math.pow(2,-1022)?(d=Math.min(Math.floor(Math.log(a)/Math.LN2),1023),c=d+1023,d=Math.round(a*Math.pow(2,52-d)-Math.pow(2,52))):(c=0,d=Math.round(a/Math.pow(2,-1074))));e=[];for(a=52;a;--a)e.push(d%2?1:0),d=Math.floor(d/2);for(a=11;a;--a)e.push(c%2?1:0),c=Math.floor(c/2);e.push(b?1:0);e.reverse();b=e.join("");c="";for(a=0;64>a;a+=8)d=parseInt(b.substr(a,8),2).toString(16),1===d.length&& (d="0"+d),c+=d;return c.toLowerCase()}var nd=/^-?\d{1,10}$/;function hd(a){return nd.test(a)&&(a=Number(a),-2147483648<=a&&2147483647>=a)?a:null}function Tb(a){try{a()}catch(b){setTimeout(function(){O("Exception was thrown by user callback.",b.stack||"");throw b;},Math.floor(0))}}function od(a,b,c){Object.defineProperty(a,b,{get:c})};function pd(a){var b={};try{var c=a.split(".");Ob(Xc(c[0])||"");b=Ob(Xc(c[1])||"");delete b.d}catch(d){}a=b;return"object"===typeof a&&!0===x(a,"admin")};var qd=null;"undefined"!==typeof MozWebSocket?qd=MozWebSocket:"undefined"!==typeof WebSocket&&(qd=WebSocket);function rd(a,b,c,d){this.Zd=a;this.f=bd(this.Zd);this.frames=this.Ac=null;this.qb=this.rb=this.Fe=0;this.Xa=oc(b);a={v:"5"};"undefined"!==typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(a.r="f");c&&(a.s=c);d&&(a.ls=d);this.Me=hc(b,"websocket",a)}var td; rd.prototype.open=function(a,b){this.kb=b;this.gg=a;this.f("Websocket connecting to "+this.Me);this.xc=!1;Xb.set("previous_websocket_failure",!0);try{this.La=new qd(this.Me)}catch(c){this.f("Error instantiating WebSocket.");var d=c.message||c.data;d&&this.f(d);this.fb();return}var e=this;this.La.onopen=function(){e.f("Websocket connected.");e.xc=!0};this.La.onclose=function(){e.f("Websocket connection was disconnected.");e.La=null;e.fb()};this.La.onmessage=function(a){if(null!==e.La)if(a=a.data,e.qb+= a.length,lc(e.Xa,"bytes_received",a.length),ud(e),null!==e.frames)vd(e,a);else{a:{H(null===e.frames,"We already have a frame buffer");if(6>=a.length){var b=Number(a);if(!isNaN(b)){e.Fe=b;e.frames=[];a=null;break a}}e.Fe=1;e.frames=[]}null!==a&&vd(e,a)}};this.La.onerror=function(a){e.f("WebSocket error. Closing connection.");(a=a.message||a.data)&&e.f(a);e.fb()}};rd.prototype.start=function(){}; rd.isAvailable=function(){var a=!1;if("undefined"!==typeof navigator&&navigator.userAgent){var b=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);b&&1<b.length&&4.4>parseFloat(b[1])&&(a=!0)}return!a&&null!==qd&&!td};rd.responsesRequiredToBeHealthy=2;rd.healthyTimeout=3E4;g=rd.prototype;g.sd=function(){Xb.remove("previous_websocket_failure")};function vd(a,b){a.frames.push(b);if(a.frames.length==a.Fe){var c=a.frames.join("");a.frames=null;c=Ob(c);a.gg(c)}} g.send=function(a){ud(this);a=B(a);this.rb+=a.length;lc(this.Xa,"bytes_sent",a.length);a=kd(a,16384);1<a.length&&wd(this,String(a.length));for(var b=0;b<a.length;b++)wd(this,a[b])};g.Tc=function(){this.Bb=!0;this.Ac&&(clearInterval(this.Ac),this.Ac=null);this.La&&(this.La.close(),this.La=null)};g.fb=function(){this.Bb||(this.f("WebSocket is closing itself"),this.Tc(),this.kb&&(this.kb(this.xc),this.kb=null))};g.close=function(){this.Bb||(this.f("WebSocket is being closed"),this.Tc())}; function ud(a){clearInterval(a.Ac);a.Ac=setInterval(function(){a.La&&wd(a,"0");ud(a)},Math.floor(45E3))}function wd(a,b){try{a.La.send(b)}catch(c){a.f("Exception thrown from WebSocket.send():",c.message||c.data,"Closing connection."),setTimeout(r(a.fb,a),0)}};function xd(a,b,c){this.f=bd("p:rest:");this.M=a;this.Hb=b;this.Vd=c;this.$={}}function yd(a,b){if(p(b))return"tag$"+b;H(zd(a.n),"should have a tag if it's not a default query.");return a.path.toString()}g=xd.prototype; g.cf=function(a,b,c,d){var e=a.path.toString();this.f("Listen called for "+e+" "+a.ya());var f=yd(a,c),h={};this.$[f]=h;a=Ad(a.n);var k=this;Bd(this,e+".json",a,function(a,b){var u=b;404===a&&(a=u=null);null===a&&k.Hb(e,u,!1,c);x(k.$,f)===h&&d(a?401==a?"permission_denied":"rest_error:"+a:"ok",null)})};g.Df=function(a,b){var c=yd(a,b);delete this.$[c]};g.pf=function(){};g.re=function(){};g.ff=function(){};g.xd=function(){};g.put=function(){};g.df=function(){};g.ye=function(){}; function Bd(a,b,c,d){c=c||{};c.format="export";a.Vd.getToken(!1).then(function(e){(e=e&&e.accessToken)&&(c.auth=e);var f=(a.M.Sc?"https://":"http://")+a.M.host+b+"?"+Fb(c);a.f("Sending REST request for "+f);var h=new XMLHttpRequest;h.onreadystatechange=function(){if(d&&4===h.readyState){a.f("REST Response for "+f+" received. status:",h.status,"response:",h.responseText);var b=null;if(200<=h.status&&300>h.status){try{b=Ob(h.responseText)}catch(c){O("Failed to parse JSON response for "+f+": "+h.responseText)}d(null, b)}else 401!==h.status&&404!==h.status&&O("Got unsuccessful REST response for "+f+" Status: "+h.status),d(h.status);d=null}};h.open("GET",f,!0);h.send()})};function Cd(a,b,c){this.type=Dd;this.source=a;this.path=b;this.children=c}Cd.prototype.Nc=function(a){if(this.path.e())return a=this.children.subtree(new L(a)),a.e()?null:a.value?new Zb(this.source,C,a.value):new Cd(this.source,C,a);H(J(this.path)===a,"Can't get a merge for a child not on the path of the operation");return new Cd(this.source,D(this.path),this.children)};Cd.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"};function Ed(){this.hb={}} function Fd(a,b){var c=b.type,d=b.Za;H("child_added"==c||"child_changed"==c||"child_removed"==c,"Only child changes supported for tracking");H(".priority"!==d,"Only non-priority child changes can be tracked.");var e=x(a.hb,d);if(e){var f=e.type;if("child_added"==c&&"child_removed"==f)a.hb[d]=new I("child_changed",b.Ma,d,e.Ma);else if("child_removed"==c&&"child_added"==f)delete a.hb[d];else if("child_removed"==c&&"child_changed"==f)a.hb[d]=new I("child_removed",e.qe,d);else if("child_changed"==c&& "child_added"==f)a.hb[d]=new I("child_added",b.Ma,d);else if("child_changed"==c&&"child_changed"==f)a.hb[d]=new I("child_changed",b.Ma,d,e.qe);else throw Wc("Illegal combination of changes: "+b+" occurred after "+e);}else a.hb[d]=b};function Gd(a){this.W=a;this.g=a.n.g}function Hd(a,b,c,d){var e=[],f=[];Ja(b,function(b){"child_changed"===b.type&&a.g.nd(b.qe,b.Ma)&&f.push(new I("child_moved",b.Ma,b.Za))});Id(a,e,"child_removed",b,d,c);Id(a,e,"child_added",b,d,c);Id(a,e,"child_moved",f,d,c);Id(a,e,"child_changed",b,d,c);Id(a,e,Gc,b,d,c);return e}function Id(a,b,c,d,e,f){d=Ka(d,function(a){return a.type===c});Sa(d,r(a.Nf,a));Ja(d,function(c){var d=Jd(a,c,f);Ja(e,function(e){e.sf(c.type)&&b.push(e.createEvent(d,a.W))})})} function Jd(a,b,c){"value"!==b.type&&"child_removed"!==b.type&&(b.Dd=c.Ye(b.Za,b.Ma,a.g));return b}Gd.prototype.Nf=function(a,b){if(null==a.Za||null==b.Za)throw Wc("Should only compare child_ events.");return this.g.compare(new K(a.Za,a.Ma),new K(b.Za,b.Ma))};function Kd(a,b){this.Sd=a;this.Lf=b}function Ld(a){this.V=a} Ld.prototype.gb=function(a,b,c,d){var e=new Ed,f;if(b.type===$b)b.source.ee?c=Md(this,a,b.path,b.Ja,c,d,e):(H(b.source.Ve,"Unknown source."),f=b.source.Ee||Ic(a.u())&&!b.path.e(),c=Nd(this,a,b.path,b.Ja,c,d,f,e));else if(b.type===Dd)b.source.ee?c=Od(this,a,b.path,b.children,c,d,e):(H(b.source.Ve,"Unknown source."),f=b.source.Ee||Ic(a.u()),c=Pd(this,a,b.path,b.children,c,d,f,e));else if(b.type===Qd)if(b.Id)if(b=b.path,null!=c.mc(b))c=a;else{f=new Bc(c,a,d);d=a.O.j();if(b.e()||".priority"===J(b))Hc(a.u())? b=c.Ba(Ec(a)):(b=a.u().j(),H(b instanceof P,"serverChildren would be complete if leaf node"),b=c.sc(b)),b=this.V.za(d,b,e);else{var h=J(b),k=c.rc(h,a.u());null==k&&Cc(a.u(),h)&&(k=d.R(h));b=null!=k?this.V.F(d,h,k,D(b),f,e):a.O.j().Fa(h)?this.V.F(d,h,F,D(b),f,e):d;b.e()&&Hc(a.u())&&(d=c.Ba(Ec(a)),d.J()&&(b=this.V.za(b,d,e)))}d=Hc(a.u())||null!=c.mc(C);c=Rd(a,b,d,this.V.Qa())}else c=Sd(this,a,b.path,b.Pb,c,d,e);else if(b.type===bc)d=b.path,b=a.u(),f=b.j(),h=b.ea||d.e(),c=Td(this,new Ud(a.O,new Dc(f, h,b.Tb)),d,c,Ac,e);else throw Wc("Unknown operation type: "+b.type);e=sa(e.hb);d=c;b=d.O;b.ea&&(f=b.j().J()||b.j().e(),h=Vd(a),(0<e.length||!a.O.ea||f&&!b.j().ca(h)||!b.j().C().ca(h.C()))&&e.push(Fc(Vd(d))));return new Kd(c,e)}; function Td(a,b,c,d,e,f){var h=b.O;if(null!=d.mc(c))return b;var k;if(c.e())H(Hc(b.u()),"If change path is empty, we must have complete server data"),Ic(b.u())?(e=Ec(b),d=d.sc(e instanceof P?e:F)):d=d.Ba(Ec(b)),f=a.V.za(b.O.j(),d,f);else{var m=J(c);if(".priority"==m)H(1==Wd(c),"Can't have a priority with additional path components"),f=h.j(),k=b.u().j(),d=d.$c(c,f,k),f=null!=d?a.V.ga(f,d):h.j();else{var l=D(c);Cc(h,m)?(k=b.u().j(),d=d.$c(c,h.j(),k),d=null!=d?h.j().R(m).F(l,d):h.j().R(m)):d=d.rc(m, b.u());f=null!=d?a.V.F(h.j(),m,d,l,e,f):h.j()}}return Rd(b,f,h.ea||c.e(),a.V.Qa())}function Nd(a,b,c,d,e,f,h,k){var m=b.u();h=h?a.V:a.V.Vb();if(c.e())d=h.za(m.j(),d,null);else if(h.Qa()&&!m.Tb)d=m.j().F(c,d),d=h.za(m.j(),d,null);else{var l=J(c);if(!Jc(m,c)&&1<Wd(c))return b;var u=D(c);d=m.j().R(l).F(u,d);d=".priority"==l?h.ga(m.j(),d):h.F(m.j(),l,d,u,Ac,null)}m=m.ea||c.e();b=new Ud(b.O,new Dc(d,m,h.Qa()));return Td(a,b,c,e,new Bc(e,b,f),k)} function Md(a,b,c,d,e,f,h){var k=b.O;e=new Bc(e,b,f);if(c.e())h=a.V.za(b.O.j(),d,h),a=Rd(b,h,!0,a.V.Qa());else if(f=J(c),".priority"===f)h=a.V.ga(b.O.j(),d),a=Rd(b,h,k.ea,k.Tb);else{c=D(c);var m=k.j().R(f);if(!c.e()){var l=e.We(f);d=null!=l?".priority"===Xd(c)&&l.Q(c.parent()).e()?l:l.F(c,d):F}m.ca(d)?a=b:(h=a.V.F(k.j(),f,d,c,e,h),a=Rd(b,h,k.ea,a.V.Qa()))}return a} function Od(a,b,c,d,e,f,h){var k=b;Yd(d,function(d,l){var u=c.m(d);Cc(b.O,J(u))&&(k=Md(a,k,u,l,e,f,h))});Yd(d,function(d,l){var u=c.m(d);Cc(b.O,J(u))||(k=Md(a,k,u,l,e,f,h))});return k}function Zd(a,b){Yd(b,function(b,d){a=a.F(b,d)});return a} function Pd(a,b,c,d,e,f,h,k){if(b.u().j().e()&&!Hc(b.u()))return b;var m=b;c=c.e()?d:$d(Q,c,d);var l=b.u().j();c.children.ia(function(c,d){if(l.Fa(c)){var G=b.u().j().R(c),G=Zd(G,d);m=Nd(a,m,new L(c),G,e,f,h,k)}});c.children.ia(function(c,d){var G=!Cc(b.u(),c)&&null==d.value;l.Fa(c)||G||(G=b.u().j().R(c),G=Zd(G,d),m=Nd(a,m,new L(c),G,e,f,h,k))});return m} function Sd(a,b,c,d,e,f,h){if(null!=e.mc(c))return b;var k=Ic(b.u()),m=b.u();if(null!=d.value){if(c.e()&&m.ea||Jc(m,c))return Nd(a,b,c,m.j().Q(c),e,f,k,h);if(c.e()){var l=Q;m.j().P(ae,function(a,b){l=l.set(new L(a),b)});return Pd(a,b,c,l,e,f,k,h)}return b}l=Q;Yd(d,function(a){var b=c.m(a);Jc(m,b)&&(l=l.set(a,m.j().Q(b)))});return Pd(a,b,c,l,e,f,k,h)};function be(a){this.g=a}g=be.prototype;g.F=function(a,b,c,d,e,f){H(a.zc(this.g),"A node must be indexed if only a child is updated");e=a.R(b);if(e.Q(d).ca(c.Q(d))&&e.e()==c.e())return a;null!=f&&(c.e()?a.Fa(b)?Fd(f,new I("child_removed",e,b)):H(a.J(),"A child remove without an old child only makes sense on a leaf node"):e.e()?Fd(f,new I("child_added",c,b)):Fd(f,new I("child_changed",c,b,e)));return a.J()&&c.e()?a:a.U(b,c).ob(this.g)}; g.za=function(a,b,c){null!=c&&(a.J()||a.P(N,function(a,e){b.Fa(a)||Fd(c,new I("child_removed",e,a))}),b.J()||b.P(N,function(b,e){if(a.Fa(b)){var f=a.R(b);f.ca(e)||Fd(c,new I("child_changed",e,b,f))}else Fd(c,new I("child_added",e,b))}));return b.ob(this.g)};g.ga=function(a,b){return a.e()?F:a.ga(b)};g.Qa=function(){return!1};g.Vb=function(){return this};function ce(a){this.he=new be(a.g);this.g=a.g;var b;a.ka?(b=de(a),b=a.g.Fc(ee(a),b)):b=a.g.Ic();this.Uc=b;a.na?(b=fe(a),a=a.g.Fc(ge(a),b)):a=a.g.Gc();this.wc=a}g=ce.prototype;g.matches=function(a){return 0>=this.g.compare(this.Uc,a)&&0>=this.g.compare(a,this.wc)};g.F=function(a,b,c,d,e,f){this.matches(new K(b,c))||(c=F);return this.he.F(a,b,c,d,e,f)}; g.za=function(a,b,c){b.J()&&(b=F);var d=b.ob(this.g),d=d.ga(F),e=this;b.P(N,function(a,b){e.matches(new K(a,b))||(d=d.U(a,F))});return this.he.za(a,d,c)};g.ga=function(a){return a};g.Qa=function(){return!0};g.Vb=function(){return this.he};function he(a){this.sa=new ce(a);this.g=a.g;H(a.xa,"Only valid if limit has been set");this.oa=a.oa;this.Jb=!ie(a)}g=he.prototype;g.F=function(a,b,c,d,e,f){this.sa.matches(new K(b,c))||(c=F);return a.R(b).ca(c)?a:a.Fb()<this.oa?this.sa.Vb().F(a,b,c,d,e,f):je(this,a,b,c,e,f)}; g.za=function(a,b,c){var d;if(b.J()||b.e())d=F.ob(this.g);else if(2*this.oa<b.Fb()&&b.zc(this.g)){d=F.ob(this.g);b=this.Jb?b.$b(this.sa.wc,this.g):b.Yb(this.sa.Uc,this.g);for(var e=0;0<b.Sa.length&&e<this.oa;){var f=R(b),h;if(h=this.Jb?0>=this.g.compare(this.sa.Uc,f):0>=this.g.compare(f,this.sa.wc))d=d.U(f.name,f.S),e++;else break}}else{d=b.ob(this.g);d=d.ga(F);var k,m,l;if(this.Jb){b=d.Ze(this.g);k=this.sa.wc;m=this.sa.Uc;var u=ke(this.g);l=function(a,b){return u(b,a)}}else b=d.Xb(this.g),k=this.sa.Uc, m=this.sa.wc,l=ke(this.g);for(var e=0,z=!1;0<b.Sa.length;)f=R(b),!z&&0>=l(k,f)&&(z=!0),(h=z&&e<this.oa&&0>=l(f,m))?e++:d=d.U(f.name,F)}return this.sa.Vb().za(a,d,c)};g.ga=function(a){return a};g.Qa=function(){return!0};g.Vb=function(){return this.sa.Vb()}; function je(a,b,c,d,e,f){var h;if(a.Jb){var k=ke(a.g);h=function(a,b){return k(b,a)}}else h=ke(a.g);H(b.Fb()==a.oa,"");var m=new K(c,d),l=a.Jb?le(b,a.g):me(b,a.g),u=a.sa.matches(m);if(b.Fa(c)){for(var z=b.R(c),l=e.fe(a.g,l,a.Jb);null!=l&&(l.name==c||b.Fa(l.name));)l=e.fe(a.g,l,a.Jb);e=null==l?1:h(l,m);if(u&&!d.e()&&0<=e)return null!=f&&Fd(f,new I("child_changed",d,c,z)),b.U(c,d);null!=f&&Fd(f,new I("child_removed",z,c));b=b.U(c,F);return null!=l&&a.sa.matches(l)?(null!=f&&Fd(f,new I("child_added", l.S,l.name)),b.U(l.name,l.S)):b}return d.e()?b:u&&0<=h(l,m)?(null!=f&&(Fd(f,new I("child_removed",l.S,l.name)),Fd(f,new I("child_added",d,c))),b.U(c,d).U(l.name,F)):b};function Uc(a,b){this.B=a;H(p(this.B)&&null!==this.B,"LeafNode shouldn't be created with null/undefined value.");this.aa=b||F;ne(this.aa);this.Eb=null}var oe=["object","boolean","number","string"];g=Uc.prototype;g.J=function(){return!0};g.C=function(){return this.aa};g.ga=function(a){return new Uc(this.B,a)};g.R=function(a){return".priority"===a?this.aa:F};g.Q=function(a){return a.e()?this:".priority"===J(a)?this.aa:F};g.Fa=function(){return!1};g.Ye=function(){return null}; g.U=function(a,b){return".priority"===a?this.ga(b):b.e()&&".priority"!==a?this:F.U(a,b).ga(this.aa)};g.F=function(a,b){var c=J(a);if(null===c)return b;if(b.e()&&".priority"!==c)return this;H(".priority"!==c||1===Wd(a),".priority must be the last token in a path");return this.U(c,F.F(D(a),b))};g.e=function(){return!1};g.Fb=function(){return 0};g.P=function(){return!1};g.H=function(a){return a&&!this.C().e()?{".value":this.Ea(),".priority":this.C().H()}:this.Ea()}; g.hash=function(){if(null===this.Eb){var a="";this.aa.e()||(a+="priority:"+pe(this.aa.H())+":");var b=typeof this.B,a=a+(b+":"),a="number"===b?a+md(this.B):a+this.B;this.Eb=Yc(a)}return this.Eb};g.Ea=function(){return this.B};g.tc=function(a){if(a===F)return 1;if(a instanceof P)return-1;H(a.J(),"Unknown node type");var b=typeof a.B,c=typeof this.B,d=Ia(oe,b),e=Ia(oe,c);H(0<=d,"Unknown leaf type: "+b);H(0<=e,"Unknown leaf type: "+c);return d===e?"object"===c?0:this.B<a.B?-1:this.B===a.B?0:1:e-d}; g.ob=function(){return this};g.zc=function(){return!0};g.ca=function(a){return a===this?!0:a.J()?this.B===a.B&&this.aa.ca(a.aa):!1};g.toString=function(){return B(this.H(!0))};function qe(){}var re={};function ke(a){return r(a.compare,a)}qe.prototype.nd=function(a,b){return 0!==this.compare(new K("[MIN_NAME]",a),new K("[MIN_NAME]",b))};qe.prototype.Ic=function(){return se};function te(a){H(!a.e()&&".priority"!==J(a),"Can't create PathIndex with empty path or .priority key");this.cc=a}ka(te,qe);g=te.prototype;g.yc=function(a){return!a.Q(this.cc).e()};g.compare=function(a,b){var c=a.S.Q(this.cc),d=b.S.Q(this.cc),c=c.tc(d);return 0===c?Lc(a.name,b.name):c}; g.Fc=function(a,b){var c=M(a),c=F.F(this.cc,c);return new K(b,c)};g.Gc=function(){var a=F.F(this.cc,ue);return new K("[MAX_NAME]",a)};g.toString=function(){return this.cc.slice().join("/")};function ve(){}ka(ve,qe);g=ve.prototype;g.compare=function(a,b){var c=a.S.C(),d=b.S.C(),c=c.tc(d);return 0===c?Lc(a.name,b.name):c};g.yc=function(a){return!a.C().e()};g.nd=function(a,b){return!a.C().ca(b.C())};g.Ic=function(){return se};g.Gc=function(){return new K("[MAX_NAME]",new Uc("[PRIORITY-POST]",ue))}; g.Fc=function(a,b){var c=M(a);return new K(b,new Uc("[PRIORITY-POST]",c))};g.toString=function(){return".priority"};var N=new ve;function we(){}ka(we,qe);g=we.prototype;g.compare=function(a,b){return Lc(a.name,b.name)};g.yc=function(){throw Wc("KeyIndex.isDefinedOn not expected to be called.");};g.nd=function(){return!1};g.Ic=function(){return se};g.Gc=function(){return new K("[MAX_NAME]",F)};g.Fc=function(a){H(q(a),"KeyIndex indexValue must always be a string.");return new K(a,F)};g.toString=function(){return".key"}; var ae=new we;function xe(){}ka(xe,qe);g=xe.prototype;g.compare=function(a,b){var c=a.S.tc(b.S);return 0===c?Lc(a.name,b.name):c};g.yc=function(){return!0};g.nd=function(a,b){return!a.ca(b)};g.Ic=function(){return se};g.Gc=function(){return ye};g.Fc=function(a,b){var c=M(a);return new K(b,c)};g.toString=function(){return".value"};var ze=new xe;function Ae(){this.Sb=this.na=this.Lb=this.ka=this.xa=!1;this.oa=0;this.oc="";this.ec=null;this.Ab="";this.bc=null;this.yb="";this.g=N}var Be=new Ae;function ie(a){return""===a.oc?a.ka:"l"===a.oc}function ee(a){H(a.ka,"Only valid if start has been set");return a.ec}function de(a){H(a.ka,"Only valid if start has been set");return a.Lb?a.Ab:"[MIN_NAME]"}function ge(a){H(a.na,"Only valid if end has been set");return a.bc} function fe(a){H(a.na,"Only valid if end has been set");return a.Sb?a.yb:"[MAX_NAME]"}function Ce(a){var b=new Ae;b.xa=a.xa;b.oa=a.oa;b.ka=a.ka;b.ec=a.ec;b.Lb=a.Lb;b.Ab=a.Ab;b.na=a.na;b.bc=a.bc;b.Sb=a.Sb;b.yb=a.yb;b.g=a.g;return b}g=Ae.prototype;g.ne=function(a){var b=Ce(this);b.xa=!0;b.oa=a;b.oc="l";return b};g.oe=function(a){var b=Ce(this);b.xa=!0;b.oa=a;b.oc="r";return b};g.Nd=function(a,b){var c=Ce(this);c.ka=!0;p(a)||(a=null);c.ec=a;null!=b?(c.Lb=!0,c.Ab=b):(c.Lb=!1,c.Ab="");return c}; g.fd=function(a,b){var c=Ce(this);c.na=!0;p(a)||(a=null);c.bc=a;p(b)?(c.Sb=!0,c.yb=b):(c.Eg=!1,c.yb="");return c};function De(a,b){var c=Ce(a);c.g=b;return c}function Ee(a){var b={};a.ka&&(b.sp=a.ec,a.Lb&&(b.sn=a.Ab));a.na&&(b.ep=a.bc,a.Sb&&(b.en=a.yb));if(a.xa){b.l=a.oa;var c=a.oc;""===c&&(c=ie(a)?"l":"r");b.vf=c}a.g!==N&&(b.i=a.g.toString());return b}function S(a){return!(a.ka||a.na||a.xa)}function zd(a){return S(a)&&a.g==N} function Ad(a){var b={};if(zd(a))return b;var c;a.g===N?c="$priority":a.g===ze?c="$value":a.g===ae?c="$key":(H(a.g instanceof te,"Unrecognized index type!"),c=a.g.toString());b.orderBy=B(c);a.ka&&(b.startAt=B(a.ec),a.Lb&&(b.startAt+=","+B(a.Ab)));a.na&&(b.endAt=B(a.bc),a.Sb&&(b.endAt+=","+B(a.yb)));a.xa&&(ie(a)?b.limitToFirst=a.oa:b.limitToLast=a.oa);return b}g.toString=function(){return B(Ee(this))};function Fe(a,b){this.od=a;this.dc=b}Fe.prototype.get=function(a){var b=x(this.od,a);if(!b)throw Error("No index defined for "+a);return b===re?null:b};function Ge(a,b,c){var d=oa(a.od,function(d,f){var h=x(a.dc,f);H(h,"Missing index implementation for "+f);if(d===re){if(h.yc(b.S)){for(var k=[],m=c.Xb(Nc),l=R(m);l;)l.name!=b.name&&k.push(l),l=R(m);k.push(b);return He(k,ke(h))}return re}h=c.get(b.name);k=d;h&&(k=k.remove(new K(b.name,h)));return k.Ra(b,b.S)});return new Fe(d,a.dc)} function Ie(a,b,c){var d=oa(a.od,function(a){if(a===re)return a;var d=c.get(b.name);return d?a.remove(new K(b.name,d)):a});return new Fe(d,a.dc)}var Je=new Fe({".priority":re},{".priority":N});function Ke(){this.set={}}g=Ke.prototype;g.add=function(a,b){this.set[a]=null!==b?b:!0};g.contains=function(a){return Bb(this.set,a)};g.get=function(a){return this.contains(a)?this.set[a]:void 0};g.remove=function(a){delete this.set[a]};g.clear=function(){this.set={}};g.e=function(){return xa(this.set)};g.count=function(){return qa(this.set)};function Le(a,b){t(a.set,function(a,d){b(d,a)})}g.keys=function(){var a=[];t(this.set,function(b,c){a.push(c)});return a};function Me(a,b,c,d){this.Zd=a;this.f=bd(a);this.kc=b;this.qb=this.rb=0;this.Xa=oc(b);this.Af=c;this.xc=!1;this.Db=d;this.Yc=function(a){return hc(b,"long_polling",a)}}var Ne,Oe; Me.prototype.open=function(a,b){this.Pe=0;this.ja=b;this.ef=new Qb(a);this.Bb=!1;var c=this;this.tb=setTimeout(function(){c.f("Timed out trying to connect.");c.fb();c.tb=null},Math.floor(3E4));gd(function(){if(!c.Bb){c.Wa=new Pe(function(a,b,d,k,m){Qe(c,arguments);if(c.Wa)if(c.tb&&(clearTimeout(c.tb),c.tb=null),c.xc=!0,"start"==a)c.id=b,c.lf=d;else if("close"===a)b?(c.Wa.Kd=!1,Rb(c.ef,b,function(){c.fb()})):c.fb();else throw Error("Unrecognized command received: "+a);},function(a,b){Qe(c,arguments); Sb(c.ef,a,b)},function(){c.fb()},c.Yc);var a={start:"t"};a.ser=Math.floor(1E8*Math.random());c.Wa.Qd&&(a.cb=c.Wa.Qd);a.v="5";c.Af&&(a.s=c.Af);c.Db&&(a.ls=c.Db);"undefined"!==typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(a.r="f");a=c.Yc(a);c.f("Connecting via long-poll to "+a);Re(c.Wa,a,function(){})}})}; Me.prototype.start=function(){var a=this.Wa,b=this.lf;a.eg=this.id;a.fg=b;for(a.Ud=!0;Se(a););a=this.id;b=this.lf;this.gc=document.createElement("iframe");var c={dframe:"t"};c.id=a;c.pw=b;this.gc.src=this.Yc(c);this.gc.style.display="none";document.body.appendChild(this.gc)}; Me.isAvailable=function(){return Ne||!Oe&&"undefined"!==typeof document&&null!=document.createElement&&!("object"===typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))&&!("object"===typeof Windows&&"object"===typeof Windows.Bg)&&!0};g=Me.prototype;g.sd=function(){};g.Tc=function(){this.Bb=!0;this.Wa&&(this.Wa.close(),this.Wa=null);this.gc&&(document.body.removeChild(this.gc),this.gc=null);this.tb&&(clearTimeout(this.tb),this.tb=null)}; g.fb=function(){this.Bb||(this.f("Longpoll is closing itself"),this.Tc(),this.ja&&(this.ja(this.xc),this.ja=null))};g.close=function(){this.Bb||(this.f("Longpoll is being closed."),this.Tc())};g.send=function(a){a=B(a);this.rb+=a.length;lc(this.Xa,"bytes_sent",a.length);a=Mb(a);a=ab(a,!0);a=kd(a,1840);for(var b=0;b<a.length;b++){var c=this.Wa;c.Qc.push({tg:this.Pe,zg:a.length,Re:a[b]});c.Ud&&Se(c);this.Pe++}};function Qe(a,b){var c=B(b).length;a.qb+=c;lc(a.Xa,"bytes_received",c)} function Pe(a,b,c,d){this.Yc=d;this.kb=c;this.ve=new Ke;this.Qc=[];this.$d=Math.floor(1E8*Math.random());this.Kd=!0;this.Qd=Vc();window["pLPCommand"+this.Qd]=a;window["pRTLPCB"+this.Qd]=b;a=document.createElement("iframe");a.style.display="none";if(document.body){document.body.appendChild(a);try{a.contentWindow.document||E("No IE domain setting required")}catch(e){a.src="javascript:void((function(){document.open();document.domain='"+document.domain+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready."; a.contentDocument?a.ib=a.contentDocument:a.contentWindow?a.ib=a.contentWindow.document:a.document&&(a.ib=a.document);this.Ga=a;a="";this.Ga.src&&"javascript:"===this.Ga.src.substr(0,11)&&(a='<script>document.domain="'+document.domain+'";\x3c/script>');a="<html><body>"+a+"</body></html>";try{this.Ga.ib.open(),this.Ga.ib.write(a),this.Ga.ib.close()}catch(f){E("frame writing exception"),f.stack&&E(f.stack),E(f)}} Pe.prototype.close=function(){this.Ud=!1;if(this.Ga){this.Ga.ib.body.innerHTML="";var a=this;setTimeout(function(){null!==a.Ga&&(document.body.removeChild(a.Ga),a.Ga=null)},Math.floor(0))}var b=this.kb;b&&(this.kb=null,b())}; function Se(a){if(a.Ud&&a.Kd&&a.ve.count()<(0<a.Qc.length?2:1)){a.$d++;var b={};b.id=a.eg;b.pw=a.fg;b.ser=a.$d;for(var b=a.Yc(b),c="",d=0;0<a.Qc.length;)if(1870>=a.Qc[0].Re.length+30+c.length){var e=a.Qc.shift(),c=c+"&seg"+d+"="+e.tg+"&ts"+d+"="+e.zg+"&d"+d+"="+e.Re;d++}else break;Te(a,b+c,a.$d);return!0}return!1}function Te(a,b,c){function d(){a.ve.remove(c);Se(a)}a.ve.add(c,1);var e=setTimeout(d,Math.floor(25E3));Re(a,b,function(){clearTimeout(e);d()})} function Re(a,b,c){setTimeout(function(){try{if(a.Kd){var d=a.Ga.ib.createElement("script");d.type="text/javascript";d.async=!0;d.src=b;d.onload=d.onreadystatechange=function(){var a=d.readyState;a&&"loaded"!==a&&"complete"!==a||(d.onload=d.onreadystatechange=null,d.parentNode&&d.parentNode.removeChild(d),c())};d.onerror=function(){E("Long-poll script failed to load: "+b);a.Kd=!1;a.close()};a.Ga.ib.body.appendChild(d)}}catch(e){}},Math.floor(1))};function Ue(a){Ve(this,a)}var We=[Me,rd];function Ve(a,b){var c=rd&&rd.isAvailable(),d=c&&!(Xb.bf||!0===Xb.get("previous_websocket_failure"));b.Ag&&(c||O("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),d=!0);if(d)a.Wc=[rd];else{var e=a.Wc=[];ld(We,function(a,b){b&&b.isAvailable()&&e.push(b)})}}function Xe(a){if(0<a.Wc.length)return a.Wc[0];throw Error("No transports available");};function Ye(a,b,c,d,e,f,h){this.id=a;this.f=bd("c:"+this.id+":");this.te=c;this.Mc=d;this.ja=e;this.se=f;this.M=b;this.Ad=[];this.Ne=0;this.zf=new Ue(b);this.L=0;this.Db=h;this.f("Connection created");Ze(this)} function Ze(a){var b=Xe(a.zf);a.I=new b("c:"+a.id+":"+a.Ne++,a.M,void 0,a.Db);a.xe=b.responsesRequiredToBeHealthy||0;var c=$e(a,a.I),d=af(a,a.I);a.Xc=a.I;a.Rc=a.I;a.D=null;a.Cb=!1;setTimeout(function(){a.I&&a.I.open(c,d)},Math.floor(0));b=b.healthyTimeout||0;0<b&&(a.md=setTimeout(function(){a.md=null;a.Cb||(a.I&&102400<a.I.qb?(a.f("Connection exceeded healthy timeout but has received "+a.I.qb+" bytes. Marking connection healthy."),a.Cb=!0,a.I.sd()):a.I&&10240<a.I.rb?a.f("Connection exceeded healthy timeout but has sent "+ a.I.rb+" bytes. Leaving connection alive."):(a.f("Closing unhealthy connection after timeout."),a.close()))},Math.floor(b)))}function af(a,b){return function(c){b===a.I?(a.I=null,c||0!==a.L?1===a.L&&a.f("Realtime connection lost."):(a.f("Realtime connection failed."),"s-"===a.M.bb.substr(0,2)&&(Xb.remove("host:"+a.M.host),a.M.bb=a.M.host)),a.close()):b===a.D?(a.f("Secondary connection lost."),c=a.D,a.D=null,a.Xc!==c&&a.Rc!==c||a.close()):a.f("closing an old connection")}} function $e(a,b){return function(c){if(2!=a.L)if(b===a.Rc){var d=id("t",c);c=id("d",c);if("c"==d){if(d=id("t",c),"d"in c)if(c=c.d,"h"===d){var d=c.ts,e=c.v,f=c.h;a.xf=c.s;gc(a.M,f);0==a.L&&(a.I.start(),bf(a,a.I,d),"5"!==e&&O("Protocol version mismatch detected"),c=a.zf,(c=1<c.Wc.length?c.Wc[1]:null)&&cf(a,c))}else if("n"===d){a.f("recvd end transmission on primary");a.Rc=a.D;for(c=0;c<a.Ad.length;++c)a.wd(a.Ad[c]);a.Ad=[];df(a)}else"s"===d?(a.f("Connection shutdown command received. Shutting down..."), a.se&&(a.se(c),a.se=null),a.ja=null,a.close()):"r"===d?(a.f("Reset packet received. New host: "+c),gc(a.M,c),1===a.L?a.close():(ef(a),Ze(a))):"e"===d?cd("Server Error: "+c):"o"===d?(a.f("got pong on primary."),ff(a),gf(a)):cd("Unknown control packet command: "+d)}else"d"==d&&a.wd(c)}else if(b===a.D)if(d=id("t",c),c=id("d",c),"c"==d)"t"in c&&(c=c.t,"a"===c?hf(a):"r"===c?(a.f("Got a reset on secondary, closing it"),a.D.close(),a.Xc!==a.D&&a.Rc!==a.D||a.close()):"o"===c&&(a.f("got pong on secondary."), a.wf--,hf(a)));else if("d"==d)a.Ad.push(c);else throw Error("Unknown protocol layer: "+d);else a.f("message on old connection")}}Ye.prototype.ua=function(a){jf(this,{t:"d",d:a})};function df(a){a.Xc===a.D&&a.Rc===a.D&&(a.f("cleaning up and promoting a connection: "+a.D.Zd),a.I=a.D,a.D=null)} function hf(a){0>=a.wf?(a.f("Secondary connection is healthy."),a.Cb=!0,a.D.sd(),a.D.start(),a.f("sending client ack on secondary"),a.D.send({t:"c",d:{t:"a",d:{}}}),a.f("Ending transmission on primary"),a.I.send({t:"c",d:{t:"n",d:{}}}),a.Xc=a.D,df(a)):(a.f("sending ping on secondary."),a.D.send({t:"c",d:{t:"p",d:{}}}))}Ye.prototype.wd=function(a){ff(this);this.te(a)};function ff(a){a.Cb||(a.xe--,0>=a.xe&&(a.f("Primary connection is healthy."),a.Cb=!0,a.I.sd()))} function cf(a,b){a.D=new b("c:"+a.id+":"+a.Ne++,a.M,a.xf);a.wf=b.responsesRequiredToBeHealthy||0;a.D.open($e(a,a.D),af(a,a.D));setTimeout(function(){a.D&&(a.f("Timed out trying to upgrade."),a.D.close())},Math.floor(6E4))}function bf(a,b,c){a.f("Realtime connection established.");a.I=b;a.L=1;a.Mc&&(a.Mc(c,a.xf),a.Mc=null);0===a.xe?(a.f("Primary connection is healthy."),a.Cb=!0):setTimeout(function(){gf(a)},Math.floor(5E3))} function gf(a){a.Cb||1!==a.L||(a.f("sending ping on primary."),jf(a,{t:"c",d:{t:"p",d:{}}}))}function jf(a,b){if(1!==a.L)throw"Connection is not connected";a.Xc.send(b)}Ye.prototype.close=function(){2!==this.L&&(this.f("Closing realtime connection."),this.L=2,ef(this),this.ja&&(this.ja(),this.ja=null))};function ef(a){a.f("Shutting down all connections");a.I&&(a.I.close(),a.I=null);a.D&&(a.D.close(),a.D=null);a.md&&(clearTimeout(a.md),a.md=null)};function L(a,b){if(1==arguments.length){this.o=a.split("/");for(var c=0,d=0;d<this.o.length;d++)0<this.o[d].length&&(this.o[c]=this.o[d],c++);this.o.length=c;this.Z=0}else this.o=a,this.Z=b}function T(a,b){var c=J(a);if(null===c)return b;if(c===J(b))return T(D(a),D(b));throw Error("INTERNAL ERROR: innerPath ("+b+") is not within outerPath ("+a+")");} function kf(a,b){for(var c=a.slice(),d=b.slice(),e=0;e<c.length&&e<d.length;e++){var f=Lc(c[e],d[e]);if(0!==f)return f}return c.length===d.length?0:c.length<d.length?-1:1}function J(a){return a.Z>=a.o.length?null:a.o[a.Z]}function Wd(a){return a.o.length-a.Z}function D(a){var b=a.Z;b<a.o.length&&b++;return new L(a.o,b)}function Xd(a){return a.Z<a.o.length?a.o[a.o.length-1]:null}g=L.prototype; g.toString=function(){for(var a="",b=this.Z;b<this.o.length;b++)""!==this.o[b]&&(a+="/"+this.o[b]);return a||"/"};g.slice=function(a){return this.o.slice(this.Z+(a||0))};g.parent=function(){if(this.Z>=this.o.length)return null;for(var a=[],b=this.Z;b<this.o.length-1;b++)a.push(this.o[b]);return new L(a,0)}; g.m=function(a){for(var b=[],c=this.Z;c<this.o.length;c++)b.push(this.o[c]);if(a instanceof L)for(c=a.Z;c<a.o.length;c++)b.push(a.o[c]);else for(a=a.split("/"),c=0;c<a.length;c++)0<a[c].length&&b.push(a[c]);return new L(b,0)};g.e=function(){return this.Z>=this.o.length};g.ca=function(a){if(Wd(this)!==Wd(a))return!1;for(var b=this.Z,c=a.Z;b<=this.o.length;b++,c++)if(this.o[b]!==a.o[c])return!1;return!0}; g.contains=function(a){var b=this.Z,c=a.Z;if(Wd(this)>Wd(a))return!1;for(;b<this.o.length;){if(this.o[b]!==a.o[c])return!1;++b;++c}return!0};var C=new L("");function lf(a,b){this.Ta=a.slice();this.Ka=Math.max(1,this.Ta.length);this.Se=b;for(var c=0;c<this.Ta.length;c++)this.Ka+=Nb(this.Ta[c]);mf(this)}lf.prototype.push=function(a){0<this.Ta.length&&(this.Ka+=1);this.Ta.push(a);this.Ka+=Nb(a);mf(this)};lf.prototype.pop=function(){var a=this.Ta.pop();this.Ka-=Nb(a);0<this.Ta.length&&--this.Ka}; function mf(a){if(768<a.Ka)throw Error(a.Se+"has a key path longer than 768 bytes ("+a.Ka+").");if(32<a.Ta.length)throw Error(a.Se+"path specified exceeds the maximum depth that can be written (32) or object contains a cycle "+nf(a));}function nf(a){return 0==a.Ta.length?"":"in property '"+a.Ta.join(".")+"'"};function of(a){a instanceof pf||dd("Don't call new Database() directly - please use firebase.database().");this.ta=a;this.ba=new U(a,C);this.INTERNAL=new qf(this)}var rf={TIMESTAMP:{".sv":"timestamp"}};g=of.prototype;g.app=null;g.of=function(a){sf(this,"ref");y("database.ref",0,1,arguments.length);return p(a)?this.ba.m(a):this.ba}; g.qg=function(a){sf(this,"database.refFromURL");y("database.refFromURL",1,1,arguments.length);var b=ed(a);tf("database.refFromURL",b);var c=b.kc;c.host!==this.ta.M.host&&dd("database.refFromURL: Host name does not match the current database: (found "+c.host+" but expected "+this.ta.M.host+")");return this.of(b.path.toString())};function sf(a,b){null===a.ta&&dd("Cannot call "+b+" on a deleted database.")}g.Zf=function(){y("database.goOffline",0,0,arguments.length);sf(this,"goOffline");this.ta.eb()}; g.$f=function(){y("database.goOnline",0,0,arguments.length);sf(this,"goOnline");this.ta.lc()};Object.defineProperty(of.prototype,"app",{get:function(){return this.ta.app}});function qf(a){this.$a=a}qf.prototype.delete=function(){sf(this.$a,"delete");var a=uf.Wb(),b=this.$a.ta;x(a.nb,b.app.name)!==b&&dd("Database "+b.app.name+" has already been deleted.");b.eb();delete a.nb[b.app.name];this.$a.ta=null;this.$a.ba=null;this.$a=this.$a.INTERNAL=null;return Promise.resolve()};of.prototype.ref=of.prototype.of; of.prototype.refFromURL=of.prototype.qg;of.prototype.goOnline=of.prototype.$f;of.prototype.goOffline=of.prototype.Zf;qf.prototype["delete"]=qf.prototype.delete;function Qc(){this.k=this.B=null}Qc.prototype.find=function(a){if(null!=this.B)return this.B.Q(a);if(a.e()||null==this.k)return null;var b=J(a);a=D(a);return this.k.contains(b)?this.k.get(b).find(a):null};function Sc(a,b,c){if(b.e())a.B=c,a.k=null;else if(null!==a.B)a.B=a.B.F(b,c);else{null==a.k&&(a.k=new Ke);var d=J(b);a.k.contains(d)||a.k.add(d,new Qc);a=a.k.get(d);b=D(b);Sc(a,b,c)}} function vf(a,b){if(b.e())return a.B=null,a.k=null,!0;if(null!==a.B){if(a.B.J())return!1;var c=a.B;a.B=null;c.P(N,function(b,c){Sc(a,new L(b),c)});return vf(a,b)}return null!==a.k?(c=J(b),b=D(b),a.k.contains(c)&&vf(a.k.get(c),b)&&a.k.remove(c),a.k.e()?(a.k=null,!0):!1):!0}function Rc(a,b,c){null!==a.B?c(b,a.B):a.P(function(a,e){var f=new L(b.toString()+"/"+a);Rc(e,f,c)})}Qc.prototype.P=function(a){null!==this.k&&Le(this.k,function(b,c){a(b,c)})};var wf=/[\[\].#$\/\u0000-\u001F\u007F]/,xf=/[\[\].#$\u0000-\u001F\u007F]/;function yf(a){return q(a)&&0!==a.length&&!wf.test(a)}function zf(a){return null===a||q(a)||fa(a)&&!fd(a)||ha(a)&&Bb(a,".sv")}function Af(a,b,c,d){d&&!p(b)||Bf(Db(a,1,d),b,c)} function Bf(a,b,c){c instanceof L&&(c=new lf(c,a));if(!p(b))throw Error(a+"contains undefined "+nf(c));if(ga(b))throw Error(a+"contains a function "+nf(c)+" with contents: "+b.toString());if(fd(b))throw Error(a+"contains "+b.toString()+" "+nf(c));if(q(b)&&b.length>10485760/3&&10485760<Nb(b))throw Error(a+"contains a string greater than 10485760 utf8 bytes "+nf(c)+" ('"+b.substring(0,50)+"...')");if(ha(b)){var d=!1,e=!1;Cb(b,function(b,h){if(".value"===b)d=!0;else if(".priority"!==b&&".sv"!==b&&(e= !0,!yf(b)))throw Error(a+" contains an invalid key ("+b+") "+nf(c)+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');c.push(b);Bf(a,h,c);c.pop()});if(d&&e)throw Error(a+' contains ".value" child '+nf(c)+" in addition to actual children.");}} function Cf(a,b){var c,d;for(c=0;c<b.length;c++){d=b[c];for(var e=d.slice(),f=0;f<e.length;f++)if((".priority"!==e[f]||f!==e.length-1)&&!yf(e[f]))throw Error(a+"contains an invalid key ("+e[f]+") in path "+d.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');}b.sort(kf);e=null;for(c=0;c<b.length;c++){d=b[c];if(null!==e&&e.contains(d))throw Error(a+"contains a path "+e.toString()+" that is ancestor of another path "+d.toString());e=d}} function Df(a,b,c){var d=Db(a,1,!1);if(!ha(b)||da(b))throw Error(d+" must be an object containing the children to replace.");var e=[];Cb(b,function(a,b){var k=new L(a);Bf(d,b,c.m(k));if(".priority"===Xd(k)&&!zf(b))throw Error(d+"contains an invalid value for '"+k.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");e.push(k)});Cf(d,e)} function Ef(a,b,c){if(fd(c))throw Error(Db(a,b,!1)+"is "+c.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!zf(c))throw Error(Db(a,b,!1)+"must be a valid Firebase priority (a string, finite number, server value, or null).");} function Ff(a,b,c){if(!c||p(b))switch(b){case "value":case "child_added":case "child_removed":case "child_changed":case "child_moved":break;default:throw Error(Db(a,1,c)+'must be a valid event type: "value", "child_added", "child_removed", "child_changed", or "child_moved".');}}function Gf(a,b){if(p(b)&&!yf(b))throw Error(Db(a,2,!0)+'was an invalid key: "'+b+'". Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").');} function Hf(a,b){if(!q(b)||0===b.length||xf.test(b))throw Error(Db(a,1,!1)+'was an invalid path: "'+b+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"');}function If(a,b){if(".info"===J(b))throw Error(a+" failed: Can't modify data under /.info/");} function tf(a,b){var c=b.path.toString(),d;!(d=!q(b.kc.host)||0===b.kc.host.length||!yf(b.kc.pe))&&(d=0!==c.length)&&(c&&(c=c.replace(/^\/*\.info(\/|$)/,"/")),d=!(q(c)&&0!==c.length&&!xf.test(c)));if(d)throw Error(Db(a,1,!1)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".');};function V(a,b){this.ta=a;this.qa=b}V.prototype.cancel=function(a){y("Firebase.onDisconnect().cancel",0,1,arguments.length);A("Firebase.onDisconnect().cancel",1,a,!0);var b=new Hb;this.ta.xd(this.qa,Ib(b,a));return b.ra};V.prototype.cancel=V.prototype.cancel;V.prototype.remove=function(a){y("Firebase.onDisconnect().remove",0,1,arguments.length);If("Firebase.onDisconnect().remove",this.qa);A("Firebase.onDisconnect().remove",1,a,!0);var b=new Hb;Jf(this.ta,this.qa,null,Ib(b,a));return b.ra}; V.prototype.remove=V.prototype.remove;V.prototype.set=function(a,b){y("Firebase.onDisconnect().set",1,2,arguments.length);If("Firebase.onDisconnect().set",this.qa);Af("Firebase.onDisconnect().set",a,this.qa,!1);A("Firebase.onDisconnect().set",2,b,!0);var c=new Hb;Jf(this.ta,this.qa,a,Ib(c,b));return c.ra};V.prototype.set=V.prototype.set; V.prototype.Kb=function(a,b,c){y("Firebase.onDisconnect().setWithPriority",2,3,arguments.length);If("Firebase.onDisconnect().setWithPriority",this.qa);Af("Firebase.onDisconnect().setWithPriority",a,this.qa,!1);Ef("Firebase.onDisconnect().setWithPriority",2,b);A("Firebase.onDisconnect().setWithPriority",3,c,!0);var d=new Hb;Kf(this.ta,this.qa,a,b,Ib(d,c));return d.ra};V.prototype.setWithPriority=V.prototype.Kb; V.prototype.update=function(a,b){y("Firebase.onDisconnect().update",1,2,arguments.length);If("Firebase.onDisconnect().update",this.qa);if(da(a)){for(var c={},d=0;d<a.length;++d)c[""+d]=a[d];a=c;O("Passing an Array to Firebase.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}Df("Firebase.onDisconnect().update",a,this.qa);A("Firebase.onDisconnect().update",2,b,!0); c=new Hb;Lf(this.ta,this.qa,a,Ib(c,b));return c.ra};V.prototype.update=V.prototype.update;function Mf(a){H(da(a)&&0<a.length,"Requires a non-empty array");this.Jf=a;this.Ec={}}Mf.prototype.Ge=function(a,b){var c;c=this.Ec[a]||[];var d=c.length;if(0<d){for(var e=Array(d),f=0;f<d;f++)e[f]=c[f];c=e}else c=[];for(d=0;d<c.length;d++)c[d].Ke.apply(c[d].Pa,Array.prototype.slice.call(arguments,1))};Mf.prototype.hc=function(a,b,c){Nf(this,a);this.Ec[a]=this.Ec[a]||[];this.Ec[a].push({Ke:b,Pa:c});(a=this.Xe(a))&&b.apply(c,a)}; Mf.prototype.Jc=function(a,b,c){Nf(this,a);a=this.Ec[a]||[];for(var d=0;d<a.length;d++)if(a[d].Ke===b&&(!c||c===a[d].Pa)){a.splice(d,1);break}};function Nf(a,b){H(Oa(a.Jf,function(a){return a===b}),"Unknown event: "+b)};function Of(){Mf.call(this,["online"]);this.ic=!0;if("undefined"!==typeof window&&"undefined"!==typeof window.addEventListener){var a=this;window.addEventListener("online",function(){a.ic||(a.ic=!0,a.Ge("online",!0))},!1);window.addEventListener("offline",function(){a.ic&&(a.ic=!1,a.Ge("online",!1))},!1)}}ka(Of,Mf);Of.prototype.Xe=function(a){H("online"===a,"Unknown event type: "+a);return[this.ic]};ba(Of);function Pf(){Mf.call(this,["visible"]);var a,b;"undefined"!==typeof document&&"undefined"!==typeof document.addEventListener&&("undefined"!==typeof document.hidden?(b="visibilitychange",a="hidden"):"undefined"!==typeof document.mozHidden?(b="mozvisibilitychange",a="mozHidden"):"undefined"!==typeof document.msHidden?(b="msvisibilitychange",a="msHidden"):"undefined"!==typeof document.webkitHidden&&(b="webkitvisibilitychange",a="webkitHidden"));this.Nb=!0;if(b){var c=this;document.addEventListener(b, function(){var b=!document[a];b!==c.Nb&&(c.Nb=b,c.Ge("visible",b))},!1)}}ka(Pf,Mf);Pf.prototype.Xe=function(a){H("visible"===a,"Unknown event type: "+a);return[this.Nb]};ba(Pf);var Qf=function(){var a=0,b=[];return function(c){var d=c===a;a=c;for(var e=Array(8),f=7;0<=f;f--)e[f]="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(c%64),c=Math.floor(c/64);H(0===c,"Cannot push at time == 0");c=e.join("");if(d){for(f=11;0<=f&&63===b[f];f--)b[f]=0;b[f]++}else for(f=0;12>f;f++)b[f]=Math.floor(64*Math.random());for(f=0;12>f;f++)c+="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(b[f]);H(20===c.length,"nextPushId: Length should be 20."); return c}}();function Rf(a,b){this.Oa=a;this.ba=b?b:Sf}g=Rf.prototype;g.Ra=function(a,b){return new Rf(this.Oa,this.ba.Ra(a,b,this.Oa).Y(null,null,!1,null,null))};g.remove=function(a){return new Rf(this.Oa,this.ba.remove(a,this.Oa).Y(null,null,!1,null,null))};g.get=function(a){for(var b,c=this.ba;!c.e();){b=this.Oa(a,c.key);if(0===b)return c.value;0>b?c=c.left:0<b&&(c=c.right)}return null}; function Tf(a,b){for(var c,d=a.ba,e=null;!d.e();){c=a.Oa(b,d.key);if(0===c){if(d.left.e())return e?e.key:null;for(d=d.left;!d.right.e();)d=d.right;return d.key}0>c?d=d.left:0<c&&(e=d,d=d.right)}throw Error("Attempted to find predecessor key for a nonexistent key. What gives?");}g.e=function(){return this.ba.e()};g.count=function(){return this.ba.count()};g.Hc=function(){return this.ba.Hc()};g.fc=function(){return this.ba.fc()};g.ia=function(a){return this.ba.ia(a)}; g.Xb=function(a){return new Uf(this.ba,null,this.Oa,!1,a)};g.Yb=function(a,b){return new Uf(this.ba,a,this.Oa,!1,b)};g.$b=function(a,b){return new Uf(this.ba,a,this.Oa,!0,b)};g.Ze=function(a){return new Uf(this.ba,null,this.Oa,!0,a)};function Uf(a,b,c,d,e){this.Hd=e||null;this.le=d;this.Sa=[];for(e=1;!a.e();)if(e=b?c(a.key,b):1,d&&(e*=-1),0>e)a=this.le?a.left:a.right;else if(0===e){this.Sa.push(a);break}else this.Sa.push(a),a=this.le?a.right:a.left} function R(a){if(0===a.Sa.length)return null;var b=a.Sa.pop(),c;c=a.Hd?a.Hd(b.key,b.value):{key:b.key,value:b.value};if(a.le)for(b=b.left;!b.e();)a.Sa.push(b),b=b.right;else for(b=b.right;!b.e();)a.Sa.push(b),b=b.left;return c}function Vf(a){if(0===a.Sa.length)return null;var b;b=a.Sa;b=b[b.length-1];return a.Hd?a.Hd(b.key,b.value):{key:b.key,value:b.value}}function Wf(a,b,c,d,e){this.key=a;this.value=b;this.color=null!=c?c:!0;this.left=null!=d?d:Sf;this.right=null!=e?e:Sf}g=Wf.prototype; g.Y=function(a,b,c,d,e){return new Wf(null!=a?a:this.key,null!=b?b:this.value,null!=c?c:this.color,null!=d?d:this.left,null!=e?e:this.right)};g.count=function(){return this.left.count()+1+this.right.count()};g.e=function(){return!1};g.ia=function(a){return this.left.ia(a)||a(this.key,this.value)||this.right.ia(a)};function Xf(a){return a.left.e()?a:Xf(a.left)}g.Hc=function(){return Xf(this).key};g.fc=function(){return this.right.e()?this.key:this.right.fc()}; g.Ra=function(a,b,c){var d,e;e=this;d=c(a,e.key);e=0>d?e.Y(null,null,null,e.left.Ra(a,b,c),null):0===d?e.Y(null,b,null,null,null):e.Y(null,null,null,null,e.right.Ra(a,b,c));return Yf(e)};function Zf(a){if(a.left.e())return Sf;a.left.fa()||a.left.left.fa()||(a=$f(a));a=a.Y(null,null,null,Zf(a.left),null);return Yf(a)} g.remove=function(a,b){var c,d;c=this;if(0>b(a,c.key))c.left.e()||c.left.fa()||c.left.left.fa()||(c=$f(c)),c=c.Y(null,null,null,c.left.remove(a,b),null);else{c.left.fa()&&(c=ag(c));c.right.e()||c.right.fa()||c.right.left.fa()||(c=bg(c),c.left.left.fa()&&(c=ag(c),c=bg(c)));if(0===b(a,c.key)){if(c.right.e())return Sf;d=Xf(c.right);c=c.Y(d.key,d.value,null,null,Zf(c.right))}c=c.Y(null,null,null,null,c.right.remove(a,b))}return Yf(c)};g.fa=function(){return this.color}; function Yf(a){a.right.fa()&&!a.left.fa()&&(a=cg(a));a.left.fa()&&a.left.left.fa()&&(a=ag(a));a.left.fa()&&a.right.fa()&&(a=bg(a));return a}function $f(a){a=bg(a);a.right.left.fa()&&(a=a.Y(null,null,null,null,ag(a.right)),a=cg(a),a=bg(a));return a}function cg(a){return a.right.Y(null,null,a.color,a.Y(null,null,!0,null,a.right.left),null)}function ag(a){return a.left.Y(null,null,a.color,null,a.Y(null,null,!0,a.left.right,null))} function bg(a){return a.Y(null,null,!a.color,a.left.Y(null,null,!a.left.color,null,null),a.right.Y(null,null,!a.right.color,null,null))}function dg(){}g=dg.prototype;g.Y=function(){return this};g.Ra=function(a,b){return new Wf(a,b,null)};g.remove=function(){return this};g.count=function(){return 0};g.e=function(){return!0};g.ia=function(){return!1};g.Hc=function(){return null};g.fc=function(){return null};g.fa=function(){return!1};var Sf=new dg;function P(a,b,c){this.k=a;(this.aa=b)&&ne(this.aa);a.e()&&H(!this.aa||this.aa.e(),"An empty node cannot have a priority");this.zb=c;this.Eb=null}g=P.prototype;g.J=function(){return!1};g.C=function(){return this.aa||F};g.ga=function(a){return this.k.e()?this:new P(this.k,a,this.zb)};g.R=function(a){if(".priority"===a)return this.C();a=this.k.get(a);return null===a?F:a};g.Q=function(a){var b=J(a);return null===b?this:this.R(b).Q(D(a))};g.Fa=function(a){return null!==this.k.get(a)}; g.U=function(a,b){H(b,"We should always be passing snapshot nodes");if(".priority"===a)return this.ga(b);var c=new K(a,b),d,e;b.e()?(d=this.k.remove(a),c=Ie(this.zb,c,this.k)):(d=this.k.Ra(a,b),c=Ge(this.zb,c,this.k));e=d.e()?F:this.aa;return new P(d,e,c)};g.F=function(a,b){var c=J(a);if(null===c)return b;H(".priority"!==J(a)||1===Wd(a),".priority must be the last token in a path");var d=this.R(c).F(D(a),b);return this.U(c,d)};g.e=function(){return this.k.e()};g.Fb=function(){return this.k.count()}; var eg=/^(0|[1-9]\d*)$/;g=P.prototype;g.H=function(a){if(this.e())return null;var b={},c=0,d=0,e=!0;this.P(N,function(f,h){b[f]=h.H(a);c++;e&&eg.test(f)?d=Math.max(d,Number(f)):e=!1});if(!a&&e&&d<2*c){var f=[],h;for(h in b)f[h]=b[h];return f}a&&!this.C().e()&&(b[".priority"]=this.C().H());return b};g.hash=function(){if(null===this.Eb){var a="";this.C().e()||(a+="priority:"+pe(this.C().H())+":");this.P(N,function(b,c){var d=c.hash();""!==d&&(a+=":"+b+":"+d)});this.Eb=""===a?"":Yc(a)}return this.Eb}; g.Ye=function(a,b,c){return(c=fg(this,c))?(a=Tf(c,new K(a,b)))?a.name:null:Tf(this.k,a)};function le(a,b){var c;c=(c=fg(a,b))?(c=c.Hc())&&c.name:a.k.Hc();return c?new K(c,a.k.get(c)):null}function me(a,b){var c;c=(c=fg(a,b))?(c=c.fc())&&c.name:a.k.fc();return c?new K(c,a.k.get(c)):null}g.P=function(a,b){var c=fg(this,a);return c?c.ia(function(a){return b(a.name,a.S)}):this.k.ia(b)};g.Xb=function(a){return this.Yb(a.Ic(),a)}; g.Yb=function(a,b){var c=fg(this,b);if(c)return c.Yb(a,function(a){return a});for(var c=this.k.Yb(a.name,Nc),d=Vf(c);null!=d&&0>b.compare(d,a);)R(c),d=Vf(c);return c};g.Ze=function(a){return this.$b(a.Gc(),a)};g.$b=function(a,b){var c=fg(this,b);if(c)return c.$b(a,function(a){return a});for(var c=this.k.$b(a.name,Nc),d=Vf(c);null!=d&&0<b.compare(d,a);)R(c),d=Vf(c);return c};g.tc=function(a){return this.e()?a.e()?0:-1:a.J()||a.e()?1:a===ue?-1:0}; g.ob=function(a){if(a===ae||ua(this.zb.dc,a.toString()))return this;var b=this.zb,c=this.k;H(a!==ae,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var d=[],e=!1,c=c.Xb(Nc),f=R(c);f;)e=e||a.yc(f.S),d.push(f),f=R(c);d=e?He(d,ke(a)):re;e=a.toString();c=ya(b.dc);c[e]=a;a=ya(b.od);a[e]=d;return new P(this.k,this.aa,new Fe(a,c))};g.zc=function(a){return a===ae||ua(this.zb.dc,a.toString())}; g.ca=function(a){if(a===this)return!0;if(a.J())return!1;if(this.C().ca(a.C())&&this.k.count()===a.k.count()){var b=this.Xb(N);a=a.Xb(N);for(var c=R(b),d=R(a);c&&d;){if(c.name!==d.name||!c.S.ca(d.S))return!1;c=R(b);d=R(a)}return null===c&&null===d}return!1};function fg(a,b){return b===ae?null:a.zb.get(b.toString())}g.toString=function(){return B(this.H(!0))};function M(a,b){if(null===a)return F;var c=null;"object"===typeof a&&".priority"in a?c=a[".priority"]:"undefined"!==typeof b&&(c=b);H(null===c||"string"===typeof c||"number"===typeof c||"object"===typeof c&&".sv"in c,"Invalid priority type found: "+typeof c);"object"===typeof a&&".value"in a&&null!==a[".value"]&&(a=a[".value"]);if("object"!==typeof a||".sv"in a)return new Uc(a,M(c));if(a instanceof Array){var d=F,e=a;t(e,function(a,b){if(Bb(e,b)&&"."!==b.substring(0,1)){var c=M(a);if(c.J()||!c.e())d= d.U(b,c)}});return d.ga(M(c))}var f=[],h=!1,k=a;Cb(k,function(a){if("string"!==typeof a||"."!==a.substring(0,1)){var b=M(k[a]);b.e()||(h=h||!b.C().e(),f.push(new K(a,b)))}});if(0==f.length)return F;var m=He(f,Kc,function(a){return a.name},Mc);if(h){var l=He(f,ke(N));return new P(m,M(c),new Fe({".priority":l},{".priority":N}))}return new P(m,M(c),Je)}var gg=Math.log(2); function hg(a){this.count=parseInt(Math.log(a+1)/gg,10);this.Qe=this.count-1;this.Kf=a+1&parseInt(Array(this.count+1).join("1"),2)}function ig(a){var b=!(a.Kf&1<<a.Qe);a.Qe--;return b} function He(a,b,c,d){function e(b,d){var f=d-b;if(0==f)return null;if(1==f){var l=a[b],u=c?c(l):l;return new Wf(u,l.S,!1,null,null)}var l=parseInt(f/2,10)+b,f=e(b,l),z=e(l+1,d),l=a[l],u=c?c(l):l;return new Wf(u,l.S,!1,f,z)}a.sort(b);var f=function(b){function d(b,h){var k=u-b,z=u;u-=b;var z=e(k+1,z),k=a[k],G=c?c(k):k,z=new Wf(G,k.S,h,null,z);f?f.left=z:l=z;f=z}for(var f=null,l=null,u=a.length,z=0;z<b.count;++z){var G=ig(b),sd=Math.pow(2,b.count-(z+1));G?d(sd,!1):(d(sd,!1),d(sd,!0))}return l}(new hg(a.length)); return null!==f?new Rf(d||b,f):new Rf(d||b)}function pe(a){return"number"===typeof a?"number:"+md(a):"string:"+a}function ne(a){if(a.J()){var b=a.H();H("string"===typeof b||"number"===typeof b||"object"===typeof b&&Bb(b,".sv"),"Priority must be a string or number.")}else H(a===ue||a.e(),"priority of unexpected type.");H(a===ue||a.C().e(),"Priority nodes can't have a priority of their own.")}var F=new P(new Rf(Mc),null,Je);function jg(){P.call(this,new Rf(Mc),F,Je)}ka(jg,P);g=jg.prototype; g.tc=function(a){return a===this?0:1};g.ca=function(a){return a===this};g.C=function(){return this};g.R=function(){return F};g.e=function(){return!1};var ue=new jg,se=new K("[MIN_NAME]",F),ye=new K("[MAX_NAME]",ue);function W(a,b,c){this.A=a;this.W=b;this.g=c}W.prototype.H=function(){y("Firebase.DataSnapshot.val",0,0,arguments.length);return this.A.H()};W.prototype.val=W.prototype.H;W.prototype.Te=function(){y("Firebase.DataSnapshot.exportVal",0,0,arguments.length);return this.A.H(!0)};W.prototype.exportVal=W.prototype.Te;W.prototype.Uf=function(){y("Firebase.DataSnapshot.exists",0,0,arguments.length);return!this.A.e()};W.prototype.exists=W.prototype.Uf; W.prototype.m=function(a){y("Firebase.DataSnapshot.child",0,1,arguments.length);fa(a)&&(a=String(a));Hf("Firebase.DataSnapshot.child",a);var b=new L(a),c=this.W.m(b);return new W(this.A.Q(b),c,N)};W.prototype.child=W.prototype.m;W.prototype.Fa=function(a){y("Firebase.DataSnapshot.hasChild",1,1,arguments.length);Hf("Firebase.DataSnapshot.hasChild",a);var b=new L(a);return!this.A.Q(b).e()};W.prototype.hasChild=W.prototype.Fa; W.prototype.C=function(){y("Firebase.DataSnapshot.getPriority",0,0,arguments.length);return this.A.C().H()};W.prototype.getPriority=W.prototype.C;W.prototype.forEach=function(a){y("Firebase.DataSnapshot.forEach",1,1,arguments.length);A("Firebase.DataSnapshot.forEach",1,a,!1);if(this.A.J())return!1;var b=this;return!!this.A.P(this.g,function(c,d){return a(new W(d,b.W.m(c),N))})};W.prototype.forEach=W.prototype.forEach; W.prototype.kd=function(){y("Firebase.DataSnapshot.hasChildren",0,0,arguments.length);return this.A.J()?!1:!this.A.e()};W.prototype.hasChildren=W.prototype.kd;W.prototype.getKey=function(){y("Firebase.DataSnapshot.key",0,0,arguments.length);return this.W.getKey()};od(W.prototype,"key",W.prototype.getKey);W.prototype.Fb=function(){y("Firebase.DataSnapshot.numChildren",0,0,arguments.length);return this.A.Fb()};W.prototype.numChildren=W.prototype.Fb; W.prototype.xb=function(){y("Firebase.DataSnapshot.ref",0,0,arguments.length);return this.W};od(W.prototype,"ref",W.prototype.xb);function Ud(a,b){this.O=a;this.Ld=b}function Rd(a,b,c,d){return new Ud(new Dc(b,c,d),a.Ld)}function Vd(a){return a.O.ea?a.O.j():null}Ud.prototype.u=function(){return this.Ld};function Ec(a){return a.Ld.ea?a.Ld.j():null};function kg(a,b){this.W=a;var c=a.n,d=new be(c.g),c=S(c)?new be(c.g):c.xa?new he(c):new ce(c);this.nf=new Ld(c);var e=b.u(),f=b.O,h=d.za(F,e.j(),null),k=c.za(F,f.j(),null);this.Na=new Ud(new Dc(k,f.ea,c.Qa()),new Dc(h,e.ea,d.Qa()));this.ab=[];this.Rf=new Gd(a)}function lg(a){return a.W}g=kg.prototype;g.u=function(){return this.Na.u().j()};g.jb=function(a){var b=Ec(this.Na);return b&&(S(this.W.n)||!a.e()&&!b.R(J(a)).e())?b.Q(a):null};g.e=function(){return 0===this.ab.length};g.Ob=function(a){this.ab.push(a)}; g.mb=function(a,b){var c=[];if(b){H(null==a,"A cancel should cancel all event registrations.");var d=this.W.path;Ja(this.ab,function(a){(a=a.Oe(b,d))&&c.push(a)})}if(a){for(var e=[],f=0;f<this.ab.length;++f){var h=this.ab[f];if(!h.matches(a))e.push(h);else if(a.$e()){e=e.concat(this.ab.slice(f+1));break}}this.ab=e}else this.ab=[];return c}; g.gb=function(a,b,c){a.type===Dd&&null!==a.source.Ib&&(H(Ec(this.Na),"We should always have a full cache before handling merges"),H(Vd(this.Na),"Missing event cache, even though we have a server cache"));var d=this.Na;a=this.nf.gb(d,a,b,c);b=this.nf;c=a.Sd;H(c.O.j().zc(b.V.g),"Event snap not indexed");H(c.u().j().zc(b.V.g),"Server snap not indexed");H(Hc(a.Sd.u())||!Hc(d.u()),"Once a server snap is complete, it should never go back");this.Na=a.Sd;return mg(this,a.Lf,a.Sd.O.j(),null)}; function ng(a,b){var c=a.Na.O,d=[];c.j().J()||c.j().P(N,function(a,b){d.push(new I("child_added",b,a))});c.ea&&d.push(Fc(c.j()));return mg(a,d,c.j(),b)}function mg(a,b,c,d){return Hd(a.Rf,b,c,d?[d]:a.ab)};function og(a,b,c){this.Qb=a;this.sb=b;this.ub=c||null}g=og.prototype;g.sf=function(a){return"value"===a};g.createEvent=function(a,b){var c=b.n.g;return new xc("value",this,new W(a.Ma,b.xb(),c))};g.Ub=function(a){var b=this.ub;if("cancel"===a.ge()){H(this.sb,"Raising a cancel event on a listener with no cancel callback");var c=this.sb;return function(){c.call(b,a.error)}}var d=this.Qb;return function(){d.call(b,a.Md)}};g.Oe=function(a,b){return this.sb?new yc(this,a,b):null}; g.matches=function(a){return a instanceof og?a.Qb&&this.Qb?a.Qb===this.Qb&&a.ub===this.ub:!0:!1};g.$e=function(){return null!==this.Qb};function pg(a,b,c){this.ha=a;this.sb=b;this.ub=c}g=pg.prototype;g.sf=function(a){a="children_added"===a?"child_added":a;return("children_removed"===a?"child_removed":a)in this.ha};g.Oe=function(a,b){return this.sb?new yc(this,a,b):null}; g.createEvent=function(a,b){H(null!=a.Za,"Child events should have a childName.");var c=b.xb().m(a.Za);return new xc(a.type,this,new W(a.Ma,c,b.n.g),a.Dd)};g.Ub=function(a){var b=this.ub;if("cancel"===a.ge()){H(this.sb,"Raising a cancel event on a listener with no cancel callback");var c=this.sb;return function(){c.call(b,a.error)}}var d=this.ha[a.gd];return function(){d.call(b,a.Md,a.Dd)}}; g.matches=function(a){if(a instanceof pg){if(!this.ha||!a.ha)return!0;if(this.ub===a.ub){var b=qa(a.ha);if(b===qa(this.ha)){if(1===b){var b=ra(a.ha),c=ra(this.ha);return c===b&&(!a.ha[b]||!this.ha[c]||a.ha[b]===this.ha[c])}return pa(this.ha,function(b,c){return a.ha[c]===b})}}}return!1};g.$e=function(){return null!==this.ha};function X(a,b,c,d){this.w=a;this.path=b;this.n=c;this.Oc=d} function qg(a){var b=null,c=null;a.ka&&(b=ee(a));a.na&&(c=ge(a));if(a.g===ae){if(a.ka){if("[MIN_NAME]"!=de(a))throw Error("Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().");if("string"!==typeof b)throw Error("Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.");}if(a.na){if("[MAX_NAME]"!=fe(a))throw Error("Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().");if("string"!== typeof c)throw Error("Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.");}}else if(a.g===N){if(null!=b&&!zf(b)||null!=c&&!zf(c))throw Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).");}else if(H(a.g instanceof te||a.g===ze,"unknown index type."),null!=b&&"object"===typeof b||null!=c&&"object"===typeof c)throw Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object."); }function rg(a){if(a.ka&&a.na&&a.xa&&(!a.xa||""===a.oc))throw Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.");}function sg(a,b){if(!0===a.Oc)throw Error(b+": You can't combine multiple orderBy calls.");}g=X.prototype;g.xb=function(){y("Query.ref",0,0,arguments.length);return new U(this.w,this.path)}; g.hc=function(a,b,c,d){y("Query.on",2,4,arguments.length);Ff("Query.on",a,!1);A("Query.on",2,b,!1);var e=tg("Query.on",c,d);if("value"===a)ug(this.w,this,new og(b,e.cancel||null,e.Pa||null));else{var f={};f[a]=b;ug(this.w,this,new pg(f,e.cancel,e.Pa))}return b}; g.Jc=function(a,b,c){y("Query.off",0,3,arguments.length);Ff("Query.off",a,!0);A("Query.off",2,b,!0);Eb("Query.off",3,c);var d=null,e=null;"value"===a?d=new og(b||null,null,c||null):a&&(b&&(e={},e[a]=b),d=new pg(e,null,c||null));e=this.w;d=".info"===J(this.path)?e.pd.mb(this,d):e.K.mb(this,d);tc(e.da,this.path,d)}; g.jg=function(a,b){function c(k){f&&(f=!1,e.Jc(a,c),b&&b.call(d.Pa,k),h.resolve(k))}y("Query.once",1,4,arguments.length);Ff("Query.once",a,!1);A("Query.once",2,b,!0);var d=tg("Query.once",arguments[2],arguments[3]),e=this,f=!0,h=new Hb;Jb(h.ra);this.hc(a,c,function(b){e.Jc(a,c);d.cancel&&d.cancel.call(d.Pa,b);h.reject(b)});return h.ra}; g.ne=function(a){y("Query.limitToFirst",1,1,arguments.length);if(!fa(a)||Math.floor(a)!==a||0>=a)throw Error("Query.limitToFirst: First argument must be a positive integer.");if(this.n.xa)throw Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new X(this.w,this.path,this.n.ne(a),this.Oc)}; g.oe=function(a){y("Query.limitToLast",1,1,arguments.length);if(!fa(a)||Math.floor(a)!==a||0>=a)throw Error("Query.limitToLast: First argument must be a positive integer.");if(this.n.xa)throw Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new X(this.w,this.path,this.n.oe(a),this.Oc)}; g.kg=function(a){y("Query.orderByChild",1,1,arguments.length);if("$key"===a)throw Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===a)throw Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===a)throw Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');Hf("Query.orderByChild",a);sg(this,"Query.orderByChild");var b=new L(a);if(b.e())throw Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead."); b=new te(b);b=De(this.n,b);qg(b);return new X(this.w,this.path,b,!0)};g.lg=function(){y("Query.orderByKey",0,0,arguments.length);sg(this,"Query.orderByKey");var a=De(this.n,ae);qg(a);return new X(this.w,this.path,a,!0)};g.mg=function(){y("Query.orderByPriority",0,0,arguments.length);sg(this,"Query.orderByPriority");var a=De(this.n,N);qg(a);return new X(this.w,this.path,a,!0)}; g.ng=function(){y("Query.orderByValue",0,0,arguments.length);sg(this,"Query.orderByValue");var a=De(this.n,ze);qg(a);return new X(this.w,this.path,a,!0)};g.Nd=function(a,b){y("Query.startAt",0,2,arguments.length);Af("Query.startAt",a,this.path,!0);Gf("Query.startAt",b);var c=this.n.Nd(a,b);rg(c);qg(c);if(this.n.ka)throw Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");p(a)||(b=a=null);return new X(this.w,this.path,c,this.Oc)}; g.fd=function(a,b){y("Query.endAt",0,2,arguments.length);Af("Query.endAt",a,this.path,!0);Gf("Query.endAt",b);var c=this.n.fd(a,b);rg(c);qg(c);if(this.n.na)throw Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new X(this.w,this.path,c,this.Oc)}; g.Qf=function(a,b){y("Query.equalTo",1,2,arguments.length);Af("Query.equalTo",a,this.path,!1);Gf("Query.equalTo",b);if(this.n.ka)throw Error("Query.equalTo: Starting point was already set (by another call to endAt or equalTo).");if(this.n.na)throw Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.Nd(a,b).fd(a,b)}; g.toString=function(){y("Query.toString",0,0,arguments.length);for(var a=this.path,b="",c=a.Z;c<a.o.length;c++)""!==a.o[c]&&(b+="/"+encodeURIComponent(String(a.o[c])));return this.w.toString()+(b||"/")};g.ya=function(){var a=jd(Ee(this.n));return"{}"===a?"default":a}; function tg(a,b,c){var d={cancel:null,Pa:null};if(b&&c)d.cancel=b,A(a,3,d.cancel,!0),d.Pa=c,Eb(a,4,d.Pa);else if(b)if("object"===typeof b&&null!==b)d.Pa=b;else if("function"===typeof b)d.cancel=b;else throw Error(Db(a,3,!0)+" must either be a cancel callback or a context object.");return d}X.prototype.on=X.prototype.hc;X.prototype.off=X.prototype.Jc;X.prototype.once=X.prototype.jg;X.prototype.limitToFirst=X.prototype.ne;X.prototype.limitToLast=X.prototype.oe;X.prototype.orderByChild=X.prototype.kg; X.prototype.orderByKey=X.prototype.lg;X.prototype.orderByPriority=X.prototype.mg;X.prototype.orderByValue=X.prototype.ng;X.prototype.startAt=X.prototype.Nd;X.prototype.endAt=X.prototype.fd;X.prototype.equalTo=X.prototype.Qf;X.prototype.toString=X.prototype.toString;od(X.prototype,"ref",X.prototype.xb);function vg(a,b){this.value=a;this.children=b||wg}var wg=new Rf(function(a,b){return a===b?0:a<b?-1:1});function xg(a){var b=Q;t(a,function(a,d){b=b.set(new L(d),a)});return b}g=vg.prototype;g.e=function(){return null===this.value&&this.children.e()};function yg(a,b,c){if(null!=a.value&&c(a.value))return{path:C,value:a.value};if(b.e())return null;var d=J(b);a=a.children.get(d);return null!==a?(b=yg(a,D(b),c),null!=b?{path:(new L(d)).m(b.path),value:b.value}:null):null} function zg(a,b){return yg(a,b,function(){return!0})}g.subtree=function(a){if(a.e())return this;var b=this.children.get(J(a));return null!==b?b.subtree(D(a)):Q};g.set=function(a,b){if(a.e())return new vg(b,this.children);var c=J(a),d=(this.children.get(c)||Q).set(D(a),b),c=this.children.Ra(c,d);return new vg(this.value,c)}; g.remove=function(a){if(a.e())return this.children.e()?Q:new vg(null,this.children);var b=J(a),c=this.children.get(b);return c?(a=c.remove(D(a)),b=a.e()?this.children.remove(b):this.children.Ra(b,a),null===this.value&&b.e()?Q:new vg(this.value,b)):this};g.get=function(a){if(a.e())return this.value;var b=this.children.get(J(a));return b?b.get(D(a)):null}; function $d(a,b,c){if(b.e())return c;var d=J(b);b=$d(a.children.get(d)||Q,D(b),c);d=b.e()?a.children.remove(d):a.children.Ra(d,b);return new vg(a.value,d)}function Ag(a,b){return Bg(a,C,b)}function Bg(a,b,c){var d={};a.children.ia(function(a,f){d[a]=Bg(f,b.m(a),c)});return c(b,a.value,d)}function Cg(a,b,c){return Dg(a,b,C,c)}function Dg(a,b,c,d){var e=a.value?d(c,a.value):!1;if(e)return e;if(b.e())return null;e=J(b);return(a=a.children.get(e))?Dg(a,D(b),c.m(e),d):null} function Eg(a,b,c){Fg(a,b,C,c)}function Fg(a,b,c,d){if(b.e())return a;a.value&&d(c,a.value);var e=J(b);return(a=a.children.get(e))?Fg(a,D(b),c.m(e),d):Q}function Yd(a,b){Gg(a,C,b)}function Gg(a,b,c){a.children.ia(function(a,e){Gg(e,b.m(a),c)});a.value&&c(b,a.value)}function Hg(a,b){a.children.ia(function(a,d){d.value&&b(a,d.value)})}var Q=new vg(null);vg.prototype.toString=function(){var a={};Yd(this,function(b,c){a[b.toString()]=c.toString()});return B(a)};function Ig(a,b,c){this.type=Qd;this.source=Jg;this.path=a;this.Pb=b;this.Id=c}Ig.prototype.Nc=function(a){if(this.path.e()){if(null!=this.Pb.value)return H(this.Pb.children.e(),"affectedTree should not have overlapping affected paths."),this;a=this.Pb.subtree(new L(a));return new Ig(C,a,this.Id)}H(J(this.path)===a,"operationForChild called for unrelated child.");return new Ig(D(this.path),this.Pb,this.Id)}; Ig.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" ack write revert="+this.Id+" affectedTree="+this.Pb+")"};var $b=0,Dd=1,Qd=2,bc=3;function Kg(a,b,c,d){this.ee=a;this.Ve=b;this.Ib=c;this.Ee=d;H(!d||b,"Tagged queries must be from server.")}var Jg=new Kg(!0,!1,null,!1),Lg=new Kg(!1,!0,null,!1);Kg.prototype.toString=function(){return this.ee?"user":this.Ee?"server(queryID="+this.Ib+")":"server"};function Mg(a){this.X=a}var Ng=new Mg(new vg(null));function Og(a,b,c){if(b.e())return new Mg(new vg(c));var d=zg(a.X,b);if(null!=d){var e=d.path,d=d.value;b=T(e,b);d=d.F(b,c);return new Mg(a.X.set(e,d))}a=$d(a.X,b,new vg(c));return new Mg(a)}function Pg(a,b,c){var d=a;Cb(c,function(a,c){d=Og(d,b.m(a),c)});return d}Mg.prototype.Ed=function(a){if(a.e())return Ng;a=$d(this.X,a,Q);return new Mg(a)};function Qg(a,b){var c=zg(a.X,b);return null!=c?a.X.get(c.path).Q(T(c.path,b)):null} function Rg(a){var b=[],c=a.X.value;null!=c?c.J()||c.P(N,function(a,c){b.push(new K(a,c))}):a.X.children.ia(function(a,c){null!=c.value&&b.push(new K(a,c.value))});return b}function Sg(a,b){if(b.e())return a;var c=Qg(a,b);return null!=c?new Mg(new vg(c)):new Mg(a.X.subtree(b))}Mg.prototype.e=function(){return this.X.e()};Mg.prototype.apply=function(a){return Tg(C,this.X,a)}; function Tg(a,b,c){if(null!=b.value)return c.F(a,b.value);var d=null;b.children.ia(function(b,f){".priority"===b?(H(null!==f.value,"Priority writes must always be leaf nodes"),d=f.value):c=Tg(a.m(b),f,c)});c.Q(a).e()||null===d||(c=c.F(a.m(".priority"),d));return c};function Ug(){this.Aa={}}g=Ug.prototype;g.e=function(){return xa(this.Aa)};g.gb=function(a,b,c){var d=a.source.Ib;if(null!==d)return d=x(this.Aa,d),H(null!=d,"SyncTree gave us an op for an invalid query."),d.gb(a,b,c);var e=[];t(this.Aa,function(d){e=e.concat(d.gb(a,b,c))});return e};g.Ob=function(a,b,c,d,e){var f=a.ya(),h=x(this.Aa,f);if(!h){var h=c.Ba(e?d:null),k=!1;h?k=!0:(h=d instanceof P?c.sc(d):F,k=!1);h=new kg(a,new Ud(new Dc(h,k,!1),new Dc(d,e,!1)));this.Aa[f]=h}h.Ob(b);return ng(h,b)}; g.mb=function(a,b,c){var d=a.ya(),e=[],f=[],h=null!=Vg(this);if("default"===d){var k=this;t(this.Aa,function(a,d){f=f.concat(a.mb(b,c));a.e()&&(delete k.Aa[d],S(a.W.n)||e.push(a.W))})}else{var m=x(this.Aa,d);m&&(f=f.concat(m.mb(b,c)),m.e()&&(delete this.Aa[d],S(m.W.n)||e.push(m.W)))}h&&null==Vg(this)&&e.push(new U(a.w,a.path));return{rg:e,Sf:f}};function Wg(a){return Ka(sa(a.Aa),function(a){return!S(a.W.n)})}g.jb=function(a){var b=null;t(this.Aa,function(c){b=b||c.jb(a)});return b}; function Xg(a,b){if(S(b.n))return Vg(a);var c=b.ya();return x(a.Aa,c)}function Vg(a){return wa(a.Aa,function(a){return S(a.W.n)})||null};function Yg(){this.T=Ng;this.la=[];this.Cc=-1}function Zg(a,b){for(var c=0;c<a.la.length;c++){var d=a.la[c];if(d.Zc===b)return d}return null}g=Yg.prototype; g.Ed=function(a){var b=Pa(this.la,function(b){return b.Zc===a});H(0<=b,"removeWrite called with nonexistent writeId.");var c=this.la[b];this.la.splice(b,1);for(var d=c.visible,e=!1,f=this.la.length-1;d&&0<=f;){var h=this.la[f];h.visible&&(f>=b&&$g(h,c.path)?d=!1:c.path.contains(h.path)&&(e=!0));f--}if(d){if(e)this.T=ah(this.la,bh,C),this.Cc=0<this.la.length?this.la[this.la.length-1].Zc:-1;else if(c.Ja)this.T=this.T.Ed(c.path);else{var k=this;t(c.children,function(a,b){k.T=k.T.Ed(c.path.m(b))})}return!0}return!1}; g.Ba=function(a,b,c,d){if(c||d){var e=Sg(this.T,a);return!d&&e.e()?b:d||null!=b||null!=Qg(e,C)?(e=ah(this.la,function(b){return(b.visible||d)&&(!c||!(0<=Ia(c,b.Zc)))&&(b.path.contains(a)||a.contains(b.path))},a),b=b||F,e.apply(b)):null}e=Qg(this.T,a);if(null!=e)return e;e=Sg(this.T,a);return e.e()?b:null!=b||null!=Qg(e,C)?(b=b||F,e.apply(b)):null}; g.sc=function(a,b){var c=F,d=Qg(this.T,a);if(d)d.J()||d.P(N,function(a,b){c=c.U(a,b)});else if(b){var e=Sg(this.T,a);b.P(N,function(a,b){var d=Sg(e,new L(a)).apply(b);c=c.U(a,d)});Ja(Rg(e),function(a){c=c.U(a.name,a.S)})}else e=Sg(this.T,a),Ja(Rg(e),function(a){c=c.U(a.name,a.S)});return c};g.$c=function(a,b,c,d){H(c||d,"Either existingEventSnap or existingServerSnap must exist");a=a.m(b);if(null!=Qg(this.T,a))return null;a=Sg(this.T,a);return a.e()?d.Q(b):a.apply(d.Q(b))}; g.rc=function(a,b,c){a=a.m(b);var d=Qg(this.T,a);return null!=d?d:Cc(c,b)?Sg(this.T,a).apply(c.j().R(b)):null};g.mc=function(a){return Qg(this.T,a)};g.Xd=function(a,b,c,d,e,f){var h;a=Sg(this.T,a);h=Qg(a,C);if(null==h)if(null!=b)h=a.apply(b);else return[];h=h.ob(f);if(h.e()||h.J())return[];b=[];a=ke(f);e=e?h.$b(c,f):h.Yb(c,f);for(f=R(e);f&&b.length<d;)0!==a(f,c)&&b.push(f),f=R(e);return b}; function $g(a,b){return a.Ja?a.path.contains(b):!!va(a.children,function(c,d){return a.path.m(d).contains(b)})}function bh(a){return a.visible} function ah(a,b,c){for(var d=Ng,e=0;e<a.length;++e){var f=a[e];if(b(f)){var h=f.path;if(f.Ja)c.contains(h)?(h=T(c,h),d=Og(d,h,f.Ja)):h.contains(c)&&(h=T(h,c),d=Og(d,C,f.Ja.Q(h)));else if(f.children)if(c.contains(h))h=T(c,h),d=Pg(d,h,f.children);else{if(h.contains(c))if(h=T(h,c),h.e())d=Pg(d,C,f.children);else if(f=x(f.children,J(h)))f=f.Q(D(h)),d=Og(d,C,f)}else throw Wc("WriteRecord should have .snap or .children");}}return d}function ch(a,b){this.Mb=a;this.X=b}g=ch.prototype; g.Ba=function(a,b,c){return this.X.Ba(this.Mb,a,b,c)};g.sc=function(a){return this.X.sc(this.Mb,a)};g.$c=function(a,b,c){return this.X.$c(this.Mb,a,b,c)};g.mc=function(a){return this.X.mc(this.Mb.m(a))};g.Xd=function(a,b,c,d,e){return this.X.Xd(this.Mb,a,b,c,d,e)};g.rc=function(a,b){return this.X.rc(this.Mb,a,b)};g.m=function(a){return new ch(this.Mb.m(a),this.X)};function dh(){this.children={};this.ad=0;this.value=null}function eh(a,b,c){this.ud=a?a:"";this.Ha=b?b:null;this.A=c?c:new dh}function fh(a,b){for(var c=b instanceof L?b:new L(b),d=a,e;null!==(e=J(c));)d=new eh(e,d,x(d.A.children,e)||new dh),c=D(c);return d}g=eh.prototype;g.Ea=function(){return this.A.value};function gh(a,b){H("undefined"!==typeof b,"Cannot set value to undefined");a.A.value=b;hh(a)}g.clear=function(){this.A.value=null;this.A.children={};this.A.ad=0;hh(this)}; g.kd=function(){return 0<this.A.ad};g.e=function(){return null===this.Ea()&&!this.kd()};g.P=function(a){var b=this;t(this.A.children,function(c,d){a(new eh(d,b,c))})};function ih(a,b,c,d){c&&!d&&b(a);a.P(function(a){ih(a,b,!0,d)});c&&d&&b(a)}function jh(a,b){for(var c=a.parent();null!==c&&!b(c);)c=c.parent()}g.path=function(){return new L(null===this.Ha?this.ud:this.Ha.path()+"/"+this.ud)};g.name=function(){return this.ud};g.parent=function(){return this.Ha}; function hh(a){if(null!==a.Ha){var b=a.Ha,c=a.ud,d=a.e(),e=Bb(b.A.children,c);d&&e?(delete b.A.children[c],b.A.ad--,hh(b)):d||e||(b.A.children[c]=a.A,b.A.ad++,hh(b))}};function kh(a,b,c,d,e,f){this.id=lh++;this.f=bd("p:"+this.id+":");this.qd={};this.$={};this.pa=[];this.Pc=0;this.Lc=[];this.ma=!1;this.Va=1E3;this.td=3E5;this.Hb=b;this.Kc=c;this.ue=d;this.M=a;this.pb=this.Ia=this.Db=this.ze=null;this.Vd=e;this.de=!1;this.ke=0;if(f)throw Error("Auth override specified in options, but not supported on non Node.js platforms");this.Je=f||null;this.vb=null;this.Nb=!1;this.Gd={};this.sg=0;this.Ue=!0;this.Bc=this.me=null;mh(this,0);Pf.Wb().hc("visible",this.ig,this);-1=== a.host.indexOf("fblocal")&&Of.Wb().hc("online",this.hg,this)}var lh=0,nh=0;g=kh.prototype;g.ua=function(a,b,c){var d=++this.sg;a={r:d,a:a,b:b};this.f(B(a));H(this.ma,"sendRequest call when we're not connected not allowed.");this.Ia.ua(a);c&&(this.Gd[d]=c)}; g.cf=function(a,b,c,d){var e=a.ya(),f=a.path.toString();this.f("Listen called for "+f+" "+e);this.$[f]=this.$[f]||{};H(zd(a.n)||!S(a.n),"listen() called for non-default but complete query");H(!this.$[f][e],"listen() called twice for same path/queryId.");a={G:d,ld:b,og:a,tag:c};this.$[f][e]=a;this.ma&&oh(this,a)}; function oh(a,b){var c=b.og,d=c.path.toString(),e=c.ya();a.f("Listen on "+d+" for "+e);var f={p:d};b.tag&&(f.q=Ee(c.n),f.t=b.tag);f.h=b.ld();a.ua("q",f,function(f){var k=f.d,m=f.s;if(k&&"object"===typeof k&&Bb(k,"w")){var l=x(k,"w");da(l)&&0<=Ia(l,"no_index")&&O("Using an unspecified index. Consider adding "+('".indexOn": "'+c.n.g.toString()+'"')+" at "+c.path.toString()+" to your security rules for better performance")}(a.$[d]&&a.$[d][e])===b&&(a.f("listen response",f),"ok"!==m&&ph(a,d,e),b.G&&b.G(m, k))})}g.pf=function(a){this.pb=a;this.f("Auth token refreshed");this.pb?qh(this):this.ma&&this.ua("unauth",{},function(){});if(a&&40===a.length||pd(a))this.f("Admin auth credential detected. Reducing max reconnect time."),this.td=3E4};function qh(a){if(a.ma&&a.pb){var b=a.pb,c={cred:b};a.Je&&(c.authvar=a.Je);a.ua("auth",c,function(c){var e=c.s;c=c.d||"error";a.pb===b&&("ok"===e?this.ke=0:rh(a,e,c))})}} g.Df=function(a,b){var c=a.path.toString(),d=a.ya();this.f("Unlisten called for "+c+" "+d);H(zd(a.n)||!S(a.n),"unlisten() called for non-default but complete query");if(ph(this,c,d)&&this.ma){var e=Ee(a.n);this.f("Unlisten on "+c+" for "+d);c={p:c};b&&(c.q=e,c.t=b);this.ua("n",c)}};g.re=function(a,b,c){this.ma?sh(this,"o",a,b,c):this.Lc.push({we:a,action:"o",data:b,G:c})};g.ff=function(a,b,c){this.ma?sh(this,"om",a,b,c):this.Lc.push({we:a,action:"om",data:b,G:c})}; g.xd=function(a,b){this.ma?sh(this,"oc",a,null,b):this.Lc.push({we:a,action:"oc",data:null,G:b})};function sh(a,b,c,d,e){c={p:c,d:d};a.f("onDisconnect "+b,c);a.ua(b,c,function(a){e&&setTimeout(function(){e(a.s,a.d)},Math.floor(0))})}g.put=function(a,b,c,d){th(this,"p",a,b,c,d)};g.df=function(a,b,c,d){th(this,"m",a,b,c,d)};function th(a,b,c,d,e,f){d={p:c,d:d};p(f)&&(d.h=f);a.pa.push({action:b,rf:d,G:e});a.Pc++;b=a.pa.length-1;a.ma?uh(a,b):a.f("Buffering put: "+c)} function uh(a,b){var c=a.pa[b].action,d=a.pa[b].rf,e=a.pa[b].G;a.pa[b].pg=a.ma;a.ua(c,d,function(d){a.f(c+" response",d);delete a.pa[b];a.Pc--;0===a.Pc&&(a.pa=[]);e&&e(d.s,d.d)})}g.ye=function(a){this.ma&&(a={c:a},this.f("reportStats",a),this.ua("s",a,function(a){"ok"!==a.s&&this.f("reportStats","Error sending stats: "+a.d)}))}; g.wd=function(a){if("r"in a){this.f("from server: "+B(a));var b=a.r,c=this.Gd[b];c&&(delete this.Gd[b],c(a.b))}else{if("error"in a)throw"A server-side error has occurred: "+a.error;"a"in a&&(b=a.a,a=a.b,this.f("handleServerMessage",b,a),"d"===b?this.Hb(a.p,a.d,!1,a.t):"m"===b?this.Hb(a.p,a.d,!0,a.t):"c"===b?vh(this,a.p,a.q):"ac"===b?rh(this,a.s,a.d):"sd"===b?this.ze?this.ze(a):"msg"in a&&"undefined"!==typeof console&&console.log("FIREBASE: "+a.msg.replace("\n","\nFIREBASE: ")):cd("Unrecognized action received from server: "+ B(b)+"\nAre you using the latest client?"))}}; g.Mc=function(a,b){this.f("connection ready");this.ma=!0;this.Bc=(new Date).getTime();this.ue({serverTimeOffset:a-(new Date).getTime()});this.Db=b;if(this.Ue){var c={};c["sdk.js."+firebase.SDK_VERSION.replace(/\./g,"-")]=1;"undefined"!==typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test("undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:"")?c["framework.cordova"]=1:"object"===typeof navigator&& "ReactNative"===navigator.product&&(c["framework.reactnative"]=1);this.ye(c)}wh(this);this.Ue=!1;this.Kc(!0)};function mh(a,b){H(!a.Ia,"Scheduling a connect when we're already connected/ing?");a.vb&&clearTimeout(a.vb);a.vb=setTimeout(function(){a.vb=null;xh(a)},Math.floor(b))}g.ig=function(a){a&&!this.Nb&&this.Va===this.td&&(this.f("Window became visible. Reducing delay."),this.Va=1E3,this.Ia||mh(this,0));this.Nb=a}; g.hg=function(a){a?(this.f("Browser went online."),this.Va=1E3,this.Ia||mh(this,0)):(this.f("Browser went offline. Killing connection."),this.Ia&&this.Ia.close())}; g.hf=function(){this.f("data client disconnected");this.ma=!1;this.Ia=null;for(var a=0;a<this.pa.length;a++){var b=this.pa[a];b&&"h"in b.rf&&b.pg&&(b.G&&b.G("disconnect"),delete this.pa[a],this.Pc--)}0===this.Pc&&(this.pa=[]);this.Gd={};yh(this)&&(this.Nb?this.Bc&&(3E4<(new Date).getTime()-this.Bc&&(this.Va=1E3),this.Bc=null):(this.f("Window isn't visible. Delaying reconnect."),this.Va=this.td,this.me=(new Date).getTime()),a=Math.max(0,this.Va-((new Date).getTime()-this.me)),a*=Math.random(),this.f("Trying to reconnect in "+ a+"ms"),mh(this,a),this.Va=Math.min(this.td,1.3*this.Va));this.Kc(!1)}; function xh(a){if(yh(a)){a.f("Making a connection attempt");a.me=(new Date).getTime();a.Bc=null;var b=r(a.wd,a),c=r(a.Mc,a),d=r(a.hf,a),e=a.id+":"+nh++,f=a.Db,h=!1,k=null,m=function(){k?k.close():(h=!0,d())};a.Ia={close:m,ua:function(a){H(k,"sendRequest call when we're not connected not allowed.");k.ua(a)}};var l=a.de;a.de=!1;a.Vd.getToken(l).then(function(l){h?E("getToken() completed but was canceled"):(E("getToken() completed. Creating connection."),a.pb=l&&l.accessToken,k=new Ye(e,a.M,b,c,d,function(b){O(b+ " ("+a.M.toString()+")");a.eb("server_kill")},f))}).then(null,function(b){a.f("Failed to get token: "+b);h||m()})}}g.eb=function(a){E("Interrupting connection for reason: "+a);this.qd[a]=!0;this.Ia?this.Ia.close():(this.vb&&(clearTimeout(this.vb),this.vb=null),this.ma&&this.hf())};g.lc=function(a){E("Resuming connection for reason: "+a);delete this.qd[a];xa(this.qd)&&(this.Va=1E3,this.Ia||mh(this,0))}; function vh(a,b,c){c=c?La(c,function(a){return jd(a)}).join("$"):"default";(a=ph(a,b,c))&&a.G&&a.G("permission_denied")}function ph(a,b,c){b=(new L(b)).toString();var d;p(a.$[b])?(d=a.$[b][c],delete a.$[b][c],0===qa(a.$[b])&&delete a.$[b]):d=void 0;return d} function rh(a,b,c){E("Auth token revoked: "+b+"/"+c);a.pb=null;a.de=!0;a.Ia.close();"invalid_token"===b&&(a.ke++,3<=a.ke&&(a.Va=3E4,O("Provided authentication credentials are invalid. This usually indicates your FirebaseApp instance was not initialized correctly. Make sure your apiKey and databaseURL match the values provided for your app at https://console.firebase.google.com/, or if you're using a service account, make sure it's authorized to access the specified databaseURL and is from the correct project.")))} function wh(a){qh(a);t(a.$,function(b){t(b,function(b){oh(a,b)})});for(var b=0;b<a.pa.length;b++)a.pa[b]&&uh(a,b);for(;a.Lc.length;)b=a.Lc.shift(),sh(a,b.action,b.we,b.data,b.G)}function yh(a){var b;b=Of.Wb().ic;return xa(a.qd)&&b};var Y={Wf:function(){Ne=td=!0}};Y.forceLongPolling=Y.Wf;Y.Xf=function(){Oe=!0};Y.forceWebSockets=Y.Xf;Y.cg=function(){return rd.isAvailable()};Y.isWebSocketsAvailable=Y.cg;Y.vg=function(a,b){a.w.Ua.ze=b};Y.setSecurityDebugCallback=Y.vg;Y.Be=function(a,b){a.w.Be(b)};Y.stats=Y.Be;Y.Ce=function(a,b){a.w.Ce(b)};Y.statsIncrementCounter=Y.Ce;Y.ed=function(a){return a.w.ed};Y.dataUpdateCount=Y.ed;Y.bg=function(a,b){a.w.je=b};Y.interceptServerData=Y.bg;function zh(a){this.wa=Q;this.lb=new Yg;this.De={};this.jc={};this.Dc=a}function Ah(a,b,c,d,e){var f=a.lb,h=e;H(d>f.Cc,"Stacking an older write on top of newer ones");p(h)||(h=!0);f.la.push({path:b,Ja:c,Zc:d,visible:h});h&&(f.T=Og(f.T,b,c));f.Cc=d;return e?Bh(a,new Zb(Jg,b,c)):[]}function Ch(a,b,c,d){var e=a.lb;H(d>e.Cc,"Stacking an older merge on top of newer ones");e.la.push({path:b,children:c,Zc:d,visible:!0});e.T=Pg(e.T,b,c);e.Cc=d;c=xg(c);return Bh(a,new Cd(Jg,b,c))} function Dh(a,b,c){c=c||!1;var d=Zg(a.lb,b);if(a.lb.Ed(b)){var e=Q;null!=d.Ja?e=e.set(C,!0):Cb(d.children,function(a,b){e=e.set(new L(a),b)});return Bh(a,new Ig(d.path,e,c))}return[]}function Eh(a,b,c){c=xg(c);return Bh(a,new Cd(Lg,b,c))}function Fh(a,b,c,d){d=Gh(a,d);if(null!=d){var e=Hh(d);d=e.path;e=e.Ib;b=T(d,b);c=new Zb(new Kg(!1,!0,e,!0),b,c);return Ih(a,d,c)}return[]} function Jh(a,b,c,d){if(d=Gh(a,d)){var e=Hh(d);d=e.path;e=e.Ib;b=T(d,b);c=xg(c);c=new Cd(new Kg(!1,!0,e,!0),b,c);return Ih(a,d,c)}return[]} zh.prototype.Ob=function(a,b){var c=a.path,d=null,e=!1;Eg(this.wa,c,function(a,b){var f=T(a,c);d=d||b.jb(f);e=e||null!=Vg(b)});var f=this.wa.get(c);f?(e=e||null!=Vg(f),d=d||f.jb(C)):(f=new Ug,this.wa=this.wa.set(c,f));var h;null!=d?h=!0:(h=!1,d=F,Hg(this.wa.subtree(c),function(a,b){var c=b.jb(C);c&&(d=d.U(a,c))}));var k=null!=Xg(f,a);if(!k&&!S(a.n)){var m=Kh(a);H(!(m in this.jc),"View does not exist, but we have a tag");var l=Lh++;this.jc[m]=l;this.De["_"+l]=m}h=f.Ob(a,b,new ch(c,this.lb),d,h);k|| e||(f=Xg(f,a),h=h.concat(Mh(this,a,f)));return h}; zh.prototype.mb=function(a,b,c){var d=a.path,e=this.wa.get(d),f=[];if(e&&("default"===a.ya()||null!=Xg(e,a))){f=e.mb(a,b,c);e.e()&&(this.wa=this.wa.remove(d));e=f.rg;f=f.Sf;b=-1!==Pa(e,function(a){return S(a.n)});var h=Cg(this.wa,d,function(a,b){return null!=Vg(b)});if(b&&!h&&(d=this.wa.subtree(d),!d.e()))for(var d=Nh(d),k=0;k<d.length;++k){var m=d[k],l=m.W,m=Oh(this,m);this.Dc.Ae(Ph(l),Qh(this,l),m.ld,m.G)}if(!h&&0<e.length&&!c)if(b)this.Dc.Od(Ph(a),null);else{var u=this;Ja(e,function(a){a.ya(); var b=u.jc[Kh(a)];u.Dc.Od(Ph(a),b)})}Rh(this,e)}return f};zh.prototype.Ba=function(a,b){var c=this.lb,d=Cg(this.wa,a,function(b,c){var d=T(b,a);if(d=c.jb(d))return d});return c.Ba(a,d,b,!0)};function Nh(a){return Ag(a,function(a,c,d){if(c&&null!=Vg(c))return[Vg(c)];var e=[];c&&(e=Wg(c));t(d,function(a){e=e.concat(a)});return e})}function Rh(a,b){for(var c=0;c<b.length;++c){var d=b[c];if(!S(d.n)){var d=Kh(d),e=a.jc[d];delete a.jc[d];delete a.De["_"+e]}}} function Ph(a){return S(a.n)&&!zd(a.n)?a.xb():a}function Mh(a,b,c){var d=b.path,e=Qh(a,b);c=Oh(a,c);b=a.Dc.Ae(Ph(b),e,c.ld,c.G);d=a.wa.subtree(d);if(e)H(null==Vg(d.value),"If we're adding a query, it shouldn't be shadowed");else for(e=Ag(d,function(a,b,c){if(!a.e()&&b&&null!=Vg(b))return[lg(Vg(b))];var d=[];b&&(d=d.concat(La(Wg(b),function(a){return a.W})));t(c,function(a){d=d.concat(a)});return d}),d=0;d<e.length;++d)c=e[d],a.Dc.Od(Ph(c),Qh(a,c));return b} function Oh(a,b){var c=b.W,d=Qh(a,c);return{ld:function(){return(b.u()||F).hash()},G:function(b){if("ok"===b){if(d){var f=c.path;if(b=Gh(a,d)){var h=Hh(b);b=h.path;h=h.Ib;f=T(b,f);f=new ac(new Kg(!1,!0,h,!0),f);b=Ih(a,b,f)}else b=[]}else b=Bh(a,new ac(Lg,c.path));return b}f="Unknown Error";"too_big"===b?f="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"==b?f="Client doesn't have permission to access the desired data.":"unavailable"==b&& (f="The service is unavailable");f=Error(b+" at "+c.path.toString()+": "+f);f.code=b.toUpperCase();return a.mb(c,null,f)}}}function Kh(a){return a.path.toString()+"$"+a.ya()}function Hh(a){var b=a.indexOf("$");H(-1!==b&&b<a.length-1,"Bad queryKey.");return{Ib:a.substr(b+1),path:new L(a.substr(0,b))}}function Gh(a,b){var c=a.De,d="_"+b;return d in c?c[d]:void 0}function Qh(a,b){var c=Kh(b);return x(a.jc,c)}var Lh=1; function Ih(a,b,c){var d=a.wa.get(b);H(d,"Missing sync point for query tag that we're tracking");return d.gb(c,new ch(b,a.lb),null)}function Bh(a,b){return Sh(a,b,a.wa,null,new ch(C,a.lb))}function Sh(a,b,c,d,e){if(b.path.e())return Th(a,b,c,d,e);var f=c.get(C);null==d&&null!=f&&(d=f.jb(C));var h=[],k=J(b.path),m=b.Nc(k);if((c=c.children.get(k))&&m)var l=d?d.R(k):null,k=e.m(k),h=h.concat(Sh(a,m,c,l,k));f&&(h=h.concat(f.gb(b,e,d)));return h} function Th(a,b,c,d,e){var f=c.get(C);null==d&&null!=f&&(d=f.jb(C));var h=[];c.children.ia(function(c,f){var l=d?d.R(c):null,u=e.m(c),z=b.Nc(c);z&&(h=h.concat(Th(a,z,f,l,u)))});f&&(h=h.concat(f.gb(b,e,d)));return h};function pf(a,b,c){this.app=c;var d=new cc(c);this.M=a;this.Xa=oc(a);this.Vc=null;this.da=new qc;this.vd=1;this.Ua=null;if(b||0<=("object"===typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i))this.va=new xd(this.M,r(this.Hb,this),d),setTimeout(r(this.Kc,this,!0),0);else{b=c.options.databaseAuthVariableOverride||null;if(null!==b){if("object"!==ca(b))throw Error("Only objects are supported for option databaseAuthVariableOverride"); try{B(b)}catch(e){throw Error("Invalid authOverride provided: "+e);}}this.va=this.Ua=new kh(this.M,r(this.Hb,this),r(this.Kc,this),r(this.ue,this),d,b)}var f=this;dc(d,function(a){f.va.pf(a)});this.xg=pc(a,r(function(){return new ic(this.Xa,this.va)},this));this.nc=new eh;this.ie=new ec;this.pd=new zh({Ae:function(a,b,c,d){b=[];c=f.ie.j(a.path);c.e()||(b=Bh(f.pd,new Zb(Lg,a.path,c)),setTimeout(function(){d("ok")},0));return b},Od:aa});Uh(this,"connected",!1);this.ja=new Qc;this.$a=new of(this);this.ed= 0;this.je=null;this.K=new zh({Ae:function(a,b,c,d){f.va.cf(a,c,b,function(b,c){var e=d(b,c);vc(f.da,a.path,e)});return[]},Od:function(a,b){f.va.Df(a,b)}})}g=pf.prototype;g.toString=function(){return(this.M.Sc?"https://":"http://")+this.M.host};g.name=function(){return this.M.pe};function Vh(a){a=a.ie.j(new L(".info/serverTimeOffset")).H()||0;return(new Date).getTime()+a}function Wh(a){a=a={timestamp:Vh(a)};a.timestamp=a.timestamp||(new Date).getTime();return a} g.Hb=function(a,b,c,d){this.ed++;var e=new L(a);b=this.je?this.je(a,b):b;a=[];d?c?(b=oa(b,function(a){return M(a)}),a=Jh(this.K,e,b,d)):(b=M(b),a=Fh(this.K,e,b,d)):c?(d=oa(b,function(a){return M(a)}),a=Eh(this.K,e,d)):(d=M(b),a=Bh(this.K,new Zb(Lg,e,d)));d=e;0<a.length&&(d=Xh(this,e));vc(this.da,d,a)};g.Kc=function(a){Uh(this,"connected",a);!1===a&&Yh(this)};g.ue=function(a){var b=this;ld(a,function(a,d){Uh(b,d,a)})}; function Uh(a,b,c){b=new L("/.info/"+b);c=M(c);var d=a.ie;d.Jd=d.Jd.F(b,c);c=Bh(a.pd,new Zb(Lg,b,c));vc(a.da,b,c)}g.Kb=function(a,b,c,d){this.f("set",{path:a.toString(),value:b,Dg:c});var e=Wh(this);b=M(b,c);var e=Tc(b,e),f=this.vd++,e=Ah(this.K,a,e,f,!0);rc(this.da,e);var h=this;this.va.put(a.toString(),b.H(!0),function(b,c){var e="ok"===b;e||O("set at "+a+" failed: "+b);e=Dh(h.K,f,!e);vc(h.da,a,e);Zh(d,b,c)});e=$h(this,a);Xh(this,e);vc(this.da,e,[])}; g.update=function(a,b,c){this.f("update",{path:a.toString(),value:b});var d=!0,e=Wh(this),f={};t(b,function(a,b){d=!1;var c=M(a);f[b]=Tc(c,e)});if(d)E("update() called with empty data. Don't do anything."),Zh(c,"ok");else{var h=this.vd++,k=Ch(this.K,a,f,h);rc(this.da,k);var m=this;this.va.df(a.toString(),b,function(b,d){var e="ok"===b;e||O("update at "+a+" failed: "+b);var e=Dh(m.K,h,!e),f=a;0<e.length&&(f=Xh(m,a));vc(m.da,f,e);Zh(c,b,d)});b=$h(this,a);Xh(this,b);vc(this.da,a,[])}}; function Yh(a){a.f("onDisconnectEvents");var b=Wh(a),c=[];Rc(Pc(a.ja,b),C,function(b,e){c=c.concat(Bh(a.K,new Zb(Lg,b,e)));var f=$h(a,b);Xh(a,f)});a.ja=new Qc;vc(a.da,C,c)}g.xd=function(a,b){var c=this;this.va.xd(a.toString(),function(d,e){"ok"===d&&vf(c.ja,a);Zh(b,d,e)})};function Jf(a,b,c,d){var e=M(c);a.va.re(b.toString(),e.H(!0),function(c,h){"ok"===c&&Sc(a.ja,b,e);Zh(d,c,h)})}function Kf(a,b,c,d,e){var f=M(c,d);a.va.re(b.toString(),f.H(!0),function(c,d){"ok"===c&&Sc(a.ja,b,f);Zh(e,c,d)})} function Lf(a,b,c,d){var e=!0,f;for(f in c)e=!1;e?(E("onDisconnect().update() called with empty data. Don't do anything."),Zh(d,"ok")):a.va.ff(b.toString(),c,function(e,f){if("ok"===e)for(var m in c){var l=M(c[m]);Sc(a.ja,b.m(m),l)}Zh(d,e,f)})}function ug(a,b,c){c=".info"===J(b.path)?a.pd.Ob(b,c):a.K.Ob(b,c);tc(a.da,b.path,c)}g.eb=function(){this.Ua&&this.Ua.eb("repo_interrupt")};g.lc=function(){this.Ua&&this.Ua.lc("repo_interrupt")}; g.Be=function(a){if("undefined"!==typeof console){a?(this.Vc||(this.Vc=new jc(this.Xa)),a=this.Vc.get()):a=this.Xa.get();var b=Ma(ta(a),function(a,b){return Math.max(b.length,a)},0),c;for(c in a){for(var d=a[c],e=c.length;e<b+2;e++)c+=" ";console.log(c+d)}}};g.Ce=function(a){lc(this.Xa,a);this.xg.yf[a]=!0};g.f=function(a){var b="";this.Ua&&(b=this.Ua.id+":");E(b,arguments)}; function Zh(a,b,c){a&&Tb(function(){if("ok"==b)a(null);else{var d=(b||"error").toUpperCase(),e=d;c&&(e+=": "+c);e=Error(e);e.code=d;a(e)}})};function ai(a,b,c,d,e){function f(){}a.f("transaction on "+b);var h=new U(a,b);h.hc("value",f);c={path:b,update:c,G:d,status:null,kf:Vc(),Ie:e,uf:0,Rd:function(){h.Jc("value",f)},Td:null,Da:null,bd:null,cd:null,dd:null};d=a.K.Ba(b,void 0)||F;c.bd=d;d=c.update(d.H());if(p(d)){Bf("transaction failed: Data returned ",d,c.path);c.status=1;e=fh(a.nc,b);var k=e.Ea()||[];k.push(c);gh(e,k);"object"===typeof d&&null!==d&&Bb(d,".priority")?(k=x(d,".priority"),H(zf(k),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")): k=(a.K.Ba(b)||F).C().H();e=Wh(a);d=M(d,k);e=Tc(d,e);c.cd=d;c.dd=e;c.Da=a.vd++;c=Ah(a.K,b,e,c.Da,c.Ie);vc(a.da,b,c);bi(a)}else c.Rd(),c.cd=null,c.dd=null,c.G&&(a=new W(c.bd,new U(a,c.path),N),c.G(null,!1,a))}function bi(a,b){var c=b||a.nc;b||ci(a,c);if(null!==c.Ea()){var d=di(a,c);H(0<d.length,"Sending zero length transaction queue");Na(d,function(a){return 1===a.status})&&ei(a,c.path(),d)}else c.kd()&&c.P(function(b){bi(a,b)})} function ei(a,b,c){for(var d=La(c,function(a){return a.Da}),e=a.K.Ba(b,d)||F,d=e,e=e.hash(),f=0;f<c.length;f++){var h=c[f];H(1===h.status,"tryToSendTransactionQueue_: items in queue should all be run.");h.status=2;h.uf++;var k=T(b,h.path),d=d.F(k,h.cd)}d=d.H(!0);a.va.put(b.toString(),d,function(d){a.f("transaction put response",{path:b.toString(),status:d});var e=[];if("ok"===d){d=[];for(f=0;f<c.length;f++){c[f].status=3;e=e.concat(Dh(a.K,c[f].Da));if(c[f].G){var h=c[f].dd,k=new U(a,c[f].path);d.push(r(c[f].G, null,null,!0,new W(h,k,N)))}c[f].Rd()}ci(a,fh(a.nc,b));bi(a);vc(a.da,b,e);for(f=0;f<d.length;f++)Tb(d[f])}else{if("datastale"===d)for(f=0;f<c.length;f++)c[f].status=4===c[f].status?5:1;else for(O("transaction at "+b.toString()+" failed: "+d),f=0;f<c.length;f++)c[f].status=5,c[f].Td=d;Xh(a,b)}},e)}function Xh(a,b){var c=fi(a,b),d=c.path(),c=di(a,c);gi(a,c,d);return d} function gi(a,b,c){if(0!==b.length){for(var d=[],e=[],f=La(b,function(a){return a.Da}),h=0;h<b.length;h++){var k=b[h],m=T(c,k.path),l=!1,u;H(null!==m,"rerunTransactionsUnderNode_: relativePath should not be null.");if(5===k.status)l=!0,u=k.Td,e=e.concat(Dh(a.K,k.Da,!0));else if(1===k.status)if(25<=k.uf)l=!0,u="maxretry",e=e.concat(Dh(a.K,k.Da,!0));else{var z=a.K.Ba(k.path,f)||F;k.bd=z;var G=b[h].update(z.H());p(G)?(Bf("transaction failed: Data returned ",G,k.path),m=M(G),"object"===typeof G&&null!= G&&Bb(G,".priority")||(m=m.ga(z.C())),z=k.Da,G=Wh(a),G=Tc(m,G),k.cd=m,k.dd=G,k.Da=a.vd++,Qa(f,z),e=e.concat(Ah(a.K,k.path,G,k.Da,k.Ie)),e=e.concat(Dh(a.K,z,!0))):(l=!0,u="nodata",e=e.concat(Dh(a.K,k.Da,!0)))}vc(a.da,c,e);e=[];l&&(b[h].status=3,setTimeout(b[h].Rd,Math.floor(0)),b[h].G&&("nodata"===u?(k=new U(a,b[h].path),d.push(r(b[h].G,null,null,!1,new W(b[h].bd,k,N)))):d.push(r(b[h].G,null,Error(u),!1,null))))}ci(a,a.nc);for(h=0;h<d.length;h++)Tb(d[h]);bi(a)}} function fi(a,b){for(var c,d=a.nc;null!==(c=J(b))&&null===d.Ea();)d=fh(d,c),b=D(b);return d}function di(a,b){var c=[];hi(a,b,c);c.sort(function(a,b){return a.kf-b.kf});return c}function hi(a,b,c){var d=b.Ea();if(null!==d)for(var e=0;e<d.length;e++)c.push(d[e]);b.P(function(b){hi(a,b,c)})}function ci(a,b){var c=b.Ea();if(c){for(var d=0,e=0;e<c.length;e++)3!==c[e].status&&(c[d]=c[e],d++);c.length=d;gh(b,0<c.length?c:null)}b.P(function(b){ci(a,b)})} function $h(a,b){var c=fi(a,b).path(),d=fh(a.nc,b);jh(d,function(b){ii(a,b)});ii(a,d);ih(d,function(b){ii(a,b)});return c} function ii(a,b){var c=b.Ea();if(null!==c){for(var d=[],e=[],f=-1,h=0;h<c.length;h++)4!==c[h].status&&(2===c[h].status?(H(f===h-1,"All SENT items should be at beginning of queue."),f=h,c[h].status=4,c[h].Td="set"):(H(1===c[h].status,"Unexpected transaction status in abort"),c[h].Rd(),e=e.concat(Dh(a.K,c[h].Da,!0)),c[h].G&&d.push(r(c[h].G,null,Error("set"),!1,null))));-1===f?gh(b,null):c.length=f+1;vc(a.da,b.path(),e);for(h=0;h<d.length;h++)Tb(d[h])}};function uf(){this.nb={};this.Ef=!1}uf.prototype.eb=function(){for(var a in this.nb)this.nb[a].eb()};uf.prototype.lc=function(){for(var a in this.nb)this.nb[a].lc()};uf.prototype.ce=function(a){this.Ef=a};ba(uf);uf.prototype.interrupt=uf.prototype.eb;uf.prototype.resume=uf.prototype.lc;var Z={};Z.pc=kh;Z.DataConnection=Z.pc;kh.prototype.wg=function(a,b){this.ua("q",{p:a},b)};Z.pc.prototype.simpleListen=Z.pc.prototype.wg;kh.prototype.Pf=function(a,b){this.ua("echo",{d:a},b)};Z.pc.prototype.echo=Z.pc.prototype.Pf;kh.prototype.interrupt=kh.prototype.eb;Z.Hf=Ye;Z.RealTimeConnection=Z.Hf;Ye.prototype.sendRequest=Ye.prototype.ua;Ye.prototype.close=Ye.prototype.close; Z.ag=function(a){var b=kh.prototype.put;kh.prototype.put=function(c,d,e,f){p(f)&&(f=a());b.call(this,c,d,e,f)};return function(){kh.prototype.put=b}};Z.hijackHash=Z.ag;Z.Gf=fc;Z.ConnectionTarget=Z.Gf;Z.ya=function(a){return a.ya()};Z.queryIdentifier=Z.ya;Z.dg=function(a){return a.w.Ua.$};Z.listens=Z.dg;Z.ce=function(a){uf.Wb().ce(a)};Z.forceRestClient=Z.ce;Z.Context=uf;function U(a,b){if(!(a instanceof pf))throw Error("new Firebase() no longer supported - use app.database().");X.call(this,a,b,Be,!1);this.then=void 0;this["catch"]=void 0}ka(U,X);g=U.prototype;g.getKey=function(){y("Firebase.key",0,0,arguments.length);return this.path.e()?null:Xd(this.path)}; g.m=function(a){y("Firebase.child",1,1,arguments.length);if(fa(a))a=String(a);else if(!(a instanceof L))if(null===J(this.path)){var b=a;b&&(b=b.replace(/^\/*\.info(\/|$)/,"/"));Hf("Firebase.child",b)}else Hf("Firebase.child",a);return new U(this.w,this.path.m(a))};g.getParent=function(){y("Firebase.parent",0,0,arguments.length);var a=this.path.parent();return null===a?null:new U(this.w,a)}; g.Yf=function(){y("Firebase.ref",0,0,arguments.length);for(var a=this;null!==a.getParent();)a=a.getParent();return a};g.Of=function(){return this.w.$a};g.set=function(a,b){y("Firebase.set",1,2,arguments.length);If("Firebase.set",this.path);Af("Firebase.set",a,this.path,!1);A("Firebase.set",2,b,!0);var c=new Hb;this.w.Kb(this.path,a,null,Ib(c,b));return c.ra}; g.update=function(a,b){y("Firebase.update",1,2,arguments.length);If("Firebase.update",this.path);if(da(a)){for(var c={},d=0;d<a.length;++d)c[""+d]=a[d];a=c;O("Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}Df("Firebase.update",a,this.path);A("Firebase.update",2,b,!0);c=new Hb;this.w.update(this.path,a,Ib(c,b));return c.ra}; g.Kb=function(a,b,c){y("Firebase.setWithPriority",2,3,arguments.length);If("Firebase.setWithPriority",this.path);Af("Firebase.setWithPriority",a,this.path,!1);Ef("Firebase.setWithPriority",2,b);A("Firebase.setWithPriority",3,c,!0);if(".length"===this.getKey()||".keys"===this.getKey())throw"Firebase.setWithPriority failed: "+this.getKey()+" is a read-only object.";var d=new Hb;this.w.Kb(this.path,a,b,Ib(d,c));return d.ra}; g.remove=function(a){y("Firebase.remove",0,1,arguments.length);If("Firebase.remove",this.path);A("Firebase.remove",1,a,!0);return this.set(null,a)}; g.transaction=function(a,b,c){y("Firebase.transaction",1,3,arguments.length);If("Firebase.transaction",this.path);A("Firebase.transaction",1,a,!1);A("Firebase.transaction",2,b,!0);if(p(c)&&"boolean"!=typeof c)throw Error(Db("Firebase.transaction",3,!0)+"must be a boolean.");if(".length"===this.getKey()||".keys"===this.getKey())throw"Firebase.transaction failed: "+this.getKey()+" is a read-only object.";"undefined"===typeof c&&(c=!0);var d=new Hb;ga(b)&&Jb(d.ra);ai(this.w,this.path,a,function(a,c, h){a?d.reject(a):d.resolve(new Pb(c,h));ga(b)&&b(a,c,h)},c);return d.ra};g.ug=function(a,b){y("Firebase.setPriority",1,2,arguments.length);If("Firebase.setPriority",this.path);Ef("Firebase.setPriority",1,a);A("Firebase.setPriority",2,b,!0);var c=new Hb;this.w.Kb(this.path.m(".priority"),a,null,Ib(c,b));return c.ra}; g.push=function(a,b){y("Firebase.push",0,2,arguments.length);If("Firebase.push",this.path);Af("Firebase.push",a,this.path,!0);A("Firebase.push",2,b,!0);var c=Vh(this.w),d=Qf(c),c=this.m(d);if(null!=a){var e=this,f=c.set(a,b).then(function(){return e.m(d)});c.then=r(f.then,f);c["catch"]=r(f.then,f,void 0);ga(b)&&Jb(f)}return c};g.kb=function(){If("Firebase.onDisconnect",this.path);return new V(this.w,this.path)};U.prototype.child=U.prototype.m;U.prototype.set=U.prototype.set;U.prototype.update=U.prototype.update; U.prototype.setWithPriority=U.prototype.Kb;U.prototype.remove=U.prototype.remove;U.prototype.transaction=U.prototype.transaction;U.prototype.setPriority=U.prototype.ug;U.prototype.push=U.prototype.push;U.prototype.onDisconnect=U.prototype.kb;od(U.prototype,"database",U.prototype.Of);od(U.prototype,"key",U.prototype.getKey);od(U.prototype,"parent",U.prototype.getParent);od(U.prototype,"root",U.prototype.Yf);if("undefined"===typeof firebase)throw Error("Cannot install Firebase Database - be sure to load firebase-app.js first."); try{firebase.INTERNAL.registerService("database",function(a){var b=uf.Wb(),c=a.options.databaseURL;p(c)||dd("Can't determine Firebase Database URL. Be sure to include databaseURL option when calling firebase.intializeApp().");var d=ed(c),c=d.kc;tf("Invalid Firebase Database URL",d);d.path.e()||dd("Database URL must point to the root of a Firebase Database (not including a child path).");(d=x(b.nb,a.name))&&dd("FIREBASE INTERNAL ERROR: Database initialized multiple times.");d=new pf(c,b.Ef,a);b.nb[a.name]= d;return d.$a},{Reference:U,Query:X,Database:of,enableLogging:ad,INTERNAL:Y,TEST_ACCESS:Z,ServerValue:rf})}catch(ji){dd("Failed to register the Firebase Database Service ("+ji+")")};})(); (function() {var k,aa=aa||{},m=this,n=function(a){return void 0!==a},ba=function(){},p=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!= typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==b&&"undefined"==typeof a.call)return"object";return b},ca=function(a){var b=p(a);return"array"==b||"object"==b&&"number"==typeof a.length},q=function(a){return"string"==typeof a},r=function(a){return"function"==p(a)},da=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b},ea="closure_uid_"+(1E9*Math.random()>>>0),fa=0,ga=function(a,b,c){return a.call.apply(a.bind, arguments)},ha=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}},t=function(a,b,c){t=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ga:ha;return t.apply(null,arguments)},ia=Date.now||function(){return+new Date},u=function(a,b){function c(){} c.prototype=b.prototype;a.G=b.prototype;a.prototype=new c;a.Ma=function(a,c,f){for(var g=Array(arguments.length-2),h=2;h<arguments.length;h++)g[h-2]=arguments[h];return b.prototype[c].apply(a,g)}};var ja=function(a,b,c){function d(){N||(N=!0,b.apply(null,arguments))}function e(b){l=setTimeout(function(){l=null;a(f,2===w)},b)}function f(a,b){if(!N)if(a)d.apply(null,arguments);else if(2===w||B)d.apply(null,arguments);else{64>h&&(h*=2);var c;1===w?(w=2,c=0):c=1E3*(h+Math.random());e(c)}}function g(a){Tb||(Tb=!0,N||(null!==l?(a||(w=2),clearTimeout(l),e(0)):a||(w=1)))}var h=1,l=null,B=!1,w=0,N=!1,Tb=!1;e(0);setTimeout(function(){B=!0;g(!0)},c);return g};var ka="https://firebasestorage.googleapis.com";var v=function(a,b){this.code="storage/"+a;this.message="Firebase Storage: "+b;this.serverResponse=null;this.name="FirebaseError"};u(v,Error);var la=function(){return new v("unknown","An unknown error occurred, please check the error payload for server response.")},ma=function(){return new v("canceled","User canceled the upload/download.")},na=function(a,b,c){return new v("invalid-argument","Invalid argument in `"+b+"` at index "+a+": "+c)},oa=function(){return new v("app-deleted","The Firebase app was deleted.")};var pa=function(a,b){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b(c,a[c])},qa=function(a){var b={};pa(a,function(a,d){b[a]=d});return b};var x=function(a,b,c,d){this.l=a;this.f={};this.i=b;this.b={};this.c="";this.N=c;this.g=this.a=null;this.h=[200];this.j=d};var ra={STATE_CHANGED:"state_changed"},sa={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"},ta=function(a){switch(a){case "running":case "pausing":case "canceling":return"running";case "paused":return"paused";case "success":return"success";case "canceled":return"canceled";case "error":return"error";default:return"error"}};var y=function(a){return n(a)&&null!==a},ua=function(a){return"string"===typeof a||a instanceof String};var va=function(a,b,c){this.f=c;this.c=a;this.g=b;this.b=0;this.a=null};va.prototype.get=function(){var a;0<this.b?(this.b--,a=this.a,this.a=a.next,a.next=null):a=this.c();return a};var wa=function(a,b){a.g(b);a.b<a.f&&(a.b++,b.next=a.a,a.a=b)};var xa=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,xa);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))};u(xa,Error);xa.prototype.name="CustomError";var ya=function(a,b,c,d,e){this.reset(a,b,c,d,e)};ya.prototype.a=null;var za=0;ya.prototype.reset=function(a,b,c,d,e){"number"==typeof e||za++;d||ia();this.b=b;delete this.a};var Aa=function(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b},Ba=function(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b},Ca="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),Da=function(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<Ca.length;f++)c=Ca[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var Ea=function(a){a.prototype.then=a.prototype.then;a.prototype.$goog_Thenable=!0},Fa=function(a){if(!a)return!1;try{return!!a.$goog_Thenable}catch(b){return!1}};var Ga=function(a){Ga[" "](a);return a};Ga[" "]=ba;var Ha=function(a,b){for(var c=a.split("%s"),d="",e=Array.prototype.slice.call(arguments,1);e.length&&1<c.length;)d+=c.shift()+e.shift();return d+c.join("%s")},Ia=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ja=function(a,b){return a<b?-1:a>b?1:0};var Ka=function(a,b){this.a=a;this.b=b};Ka.prototype.clone=function(){return new Ka(this.a,this.b)};var z=function(a,b){this.bucket=a;this.path=b},La=function(a){var b=encodeURIComponent;return"/b/"+b(a.bucket)+"/o/"+b(a.path)},Ma=function(a){for(var b=null,c=[{ja:/^gs:\/\/([A-Za-z0-9.\-]+)(\/(.*))?$/i,aa:{bucket:1,path:3},ia:function(a){"/"===a.path.charAt(a.path.length-1)&&(a.path=a.path.slice(0,-1))}},{ja:/^https?:\/\/firebasestorage\.googleapis\.com\/v[A-Za-z0-9_]+\/b\/([A-Za-z0-9.\-]+)\/o(\/([^?#]*).*)?$/i,aa:{bucket:1,path:3},ia:function(a){a.path=decodeURIComponent(a.path)}}],d=0;d<c.length;d++){var e= c[d],f=e.ja.exec(a);if(f){b=f[e.aa.bucket];(f=f[e.aa.path])||(f="");b=new z(b,f);e.ia(b);break}}if(null==b)throw new v("invalid-url","Invalid URL '"+a+"'.");return b};var Na=function(a,b,c){r(a)||y(b)||y(c)?(this.next=a,this.error=b||null,this.a=c||null):(this.next=a.next||null,this.error=a.error||null,this.a=a.complete||null)};var Oa=function(a){var b=encodeURIComponent,c="?";pa(a,function(a,e){a=b(a)+"="+b(e);c=c+a+"&"});return c=c.slice(0,-1)};var A=function(a,b,c,d,e,f){this.b=a;this.h=b;this.f=c;this.a=d;this.g=e;this.c=f};k=A.prototype;k.qa=function(){return this.b};k.La=function(){return this.h};k.Ia=function(){return this.f};k.Da=function(){return this.a};k.sa=function(){if(y(this.a)){var a=this.a.downloadURLs;return y(a)&&y(a[0])?a[0]:null}return null};k.Ka=function(){return this.g};k.Ga=function(){return this.c};var Pa=function(a,b){b.unshift(a);xa.call(this,Ha.apply(null,b));b.shift()};u(Pa,xa);Pa.prototype.name="AssertionError"; var Qa=function(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),f=d;else a&&(e+=": "+a,f=b);throw new Pa(""+e,f||[]);},C=function(a,b,c){a||Qa("",null,b,Array.prototype.slice.call(arguments,2))},Ra=function(a,b){throw new Pa("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));},Sa=function(a,b,c){r(a)||Qa("Expected function but got %s: %s.",[p(a),a],b,Array.prototype.slice.call(arguments,2))};var D=function(){this.g=this.g;this.s=this.s};D.prototype.g=!1;D.prototype.fa=function(){this.g||(this.g=!0,this.A())};D.prototype.A=function(){if(this.s)for(;this.s.length;)this.s.shift()()};var Ta="closure_listenable_"+(1E6*Math.random()|0),Ua=0;var Wa;a:{var Xa=m.navigator;if(Xa){var Ya=Xa.userAgent;if(Ya){Wa=Ya;break a}}Wa=""}var E=function(a){return-1!=Wa.indexOf(a)};var Za=function(){};Za.prototype.a=null;var ab=function(a){var b;(b=a.a)||(b={},$a(a)&&(b[0]=!0,b[1]=!0),b=a.a=b);return b};var bb=Array.prototype.indexOf?function(a,b,c){C(null!=a.length);return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(q(a))return q(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},cb=Array.prototype.forEach?function(a,b,c){C(null!=a.length);Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},db=Array.prototype.filter?function(a, b,c){C(null!=a.length);return Array.prototype.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,g=q(a)?a.split(""):a,h=0;h<d;h++)if(h in g){var l=g[h];b.call(c,l,h,a)&&(e[f++]=l)}return e},eb=Array.prototype.map?function(a,b,c){C(null!=a.length);return Array.prototype.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=q(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},fb=Array.prototype.some?function(a,b,c){C(null!=a.length);return Array.prototype.some.call(a, b,c)}:function(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return!0;return!1},hb=function(a){var b;a:{b=gb;for(var c=a.length,d=q(a)?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(void 0,d[e],e,a)){b=e;break a}b=-1}return 0>b?null:q(a)?a.charAt(b):a[b]},ib=function(a){if("array"!=p(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0},jb=function(a,b){b=bb(a,b);var c;if(c=0<=b)C(null!=a.length),Array.prototype.splice.call(a,b,1);return c},kb=function(a){var b= a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]};var mb=new va(function(){return new lb},function(a){a.reset()},100),ob=function(){var a=nb,b=null;a.a&&(b=a.a,a.a=a.a.next,a.a||(a.b=null),b.next=null);return b},lb=function(){this.next=this.b=this.a=null};lb.prototype.set=function(a,b){this.a=a;this.b=b;this.next=null};lb.prototype.reset=function(){this.next=this.b=this.a=null};var pb=function(a,b){this.type=a;this.a=this.target=b;this.ka=!0};pb.prototype.b=function(){this.ka=!1};var qb=function(a,b,c,d,e){this.listener=a;this.a=null;this.src=b;this.type=c;this.U=!!d;this.N=e;++Ua;this.O=this.T=!1},rb=function(a){a.O=!0;a.listener=null;a.a=null;a.src=null;a.N=null};var sb=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;var tb=function(a,b){b=db(b.split("/"),function(a){return 0<a.length}).join("/");return 0===a.length?b:a+"/"+b},ub=function(a){var b=a.lastIndexOf("/",a.length-2);return-1===b?a:a.slice(b+1)};var vb=function(a){this.src=a;this.a={};this.b=0},xb=function(a,b,c,d,e,f){var g=b.toString();b=a.a[g];b||(b=a.a[g]=[],a.b++);var h=wb(b,c,e,f);-1<h?(a=b[h],d||(a.T=!1)):(a=new qb(c,a.src,g,!!e,f),a.T=d,b.push(a));return a},yb=function(a,b){var c=b.type;c in a.a&&jb(a.a[c],b)&&(rb(b),0==a.a[c].length&&(delete a.a[c],a.b--))},wb=function(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.O&&f.listener==b&&f.U==!!c&&f.N==d)return e}return-1};var zb,Ab=function(){};u(Ab,Za);var Bb=function(a){return(a=$a(a))?new ActiveXObject(a):new XMLHttpRequest},$a=function(a){if(!a.b&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.b=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.b};zb=new Ab;var Cb=function(a){this.a=[];if(a)a:{var b;if(a instanceof Cb){if(b=a.D(),a=a.w(),0>=this.o()){for(var c=this.a,d=0;d<b.length;d++)c.push(new Ka(b[d],a[d]));break a}}else b=Ba(a),a=Aa(a);for(d=0;d<b.length;d++)Db(this,b[d],a[d])}},Db=function(a,b,c){var d=a.a;d.push(new Ka(b,c));b=d.length-1;a=a.a;for(c=a[b];0<b;)if(d=b-1>>1,a[d].a>c.a)a[b]=a[d],b=d;else break;a[b]=c};k=Cb.prototype;k.w=function(){for(var a=this.a,b=[],c=a.length,d=0;d<c;d++)b.push(a[d].b);return b}; k.D=function(){for(var a=this.a,b=[],c=a.length,d=0;d<c;d++)b.push(a[d].a);return b};k.clone=function(){return new Cb(this)};k.o=function(){return this.a.length};k.F=function(){return 0==this.a.length};k.clear=function(){ib(this.a)};var Eb=function(){this.b=[];this.a=[]},Fb=function(a){0==a.b.length&&(a.b=a.a,a.b.reverse(),a.a=[]);return a.b.pop()};Eb.prototype.o=function(){return this.b.length+this.a.length};Eb.prototype.F=function(){return 0==this.b.length&&0==this.a.length};Eb.prototype.clear=function(){this.b=[];this.a=[]};Eb.prototype.w=function(){for(var a=[],b=this.b.length-1;0<=b;--b)a.push(this.b[b]);for(var c=this.a.length,b=0;b<c;++b)a.push(this.a[b]);return a};var Gb=function(a){if(a.w&&"function"==typeof a.w)return a.w();if(q(a))return a.split("");if(ca(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Aa(a)},Hb=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);else if(ca(a)||q(a))cb(a,b,void 0);else{var c;if(a.D&&"function"==typeof a.D)c=a.D();else if(a.w&&"function"==typeof a.w)c=void 0;else if(ca(a)||q(a)){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=Ba(a);for(var d=Gb(a),e=d.length,f=0;f<e;f++)b.call(void 0, d[f],c&&c[f],a)}};var Ib=function(a){m.setTimeout(function(){throw a;},0)},Jb,Kb=function(){var a=m.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!E("Presto")&&(a=function(){var a=document.createElement("IFRAME");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write("");a.close();var c="callImmediate"+Math.random(),d="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host, a=t(function(a){if(("*"==d||a.origin==d)&&a.data==c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof a&&!E("Trident")&&!E("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(n(c.next)){c=c.next;var a=c.ea;c.ea=null;a()}};return function(a){d.next={ea:a};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")? function(a){var b=document.createElement("SCRIPT");b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){m.setTimeout(a,0)}};var Lb="StopIteration"in m?m.StopIteration:{message:"StopIteration",stack:""},Mb=function(){};Mb.prototype.next=function(){throw Lb;};Mb.prototype.Y=function(){return this};var Nb=function(){Cb.call(this)};u(Nb,Cb);var Ob=E("Opera"),F=E("Trident")||E("MSIE"),Pb=E("Edge"),Qb=E("Gecko")&&!(-1!=Wa.toLowerCase().indexOf("webkit")&&!E("Edge"))&&!(E("Trident")||E("MSIE"))&&!E("Edge"),Rb=-1!=Wa.toLowerCase().indexOf("webkit")&&!E("Edge"),Sb=function(){var a=m.document;return a?a.documentMode:void 0},Ub; a:{var Vb="",Wb=function(){var a=Wa;if(Qb)return/rv\:([^\);]+)(\)|;)/.exec(a);if(Pb)return/Edge\/([\d\.]+)/.exec(a);if(F)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(Rb)return/WebKit\/(\S+)/.exec(a);if(Ob)return/(?:Version)[ \/]?(\S+)/.exec(a)}();Wb&&(Vb=Wb?Wb[1]:"");if(F){var Xb=Sb();if(null!=Xb&&Xb>parseFloat(Vb)){Ub=String(Xb);break a}}Ub=Vb} var Yb=Ub,Zb={},G=function(a){var b;if(!(b=Zb[a])){b=0;for(var c=Ia(String(Yb)).split("."),d=Ia(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var g=c[f]||"",h=d[f]||"",l=/(\d*)(\D*)/g,B=/(\d*)(\D*)/g;do{var w=l.exec(g)||["","",""],N=B.exec(h)||["","",""];if(0==w[0].length&&0==N[0].length)break;b=Ja(0==w[1].length?0:parseInt(w[1],10),0==N[1].length?0:parseInt(N[1],10))||Ja(0==w[2].length,0==N[2].length)||Ja(w[2],N[2])}while(0==b)}b=Zb[a]=0<=b}return b},$b=m.document,ac=$b&& F?Sb()||("CSS1Compat"==$b.compatMode?parseInt(Yb,10):5):void 0;var ec=function(a,b){bc||cc();dc||(bc(),dc=!0);var c=nb,d=mb.get();d.set(a,b);c.b?c.b.next=d:(C(!c.a),c.a=d);c.b=d},bc,cc=function(){if(m.Promise&&m.Promise.resolve){var a=m.Promise.resolve(void 0);bc=function(){a.then(fc)}}else bc=function(){var a=fc;!r(m.setImmediate)||m.Window&&m.Window.prototype&&!E("Edge")&&m.Window.prototype.setImmediate==m.setImmediate?(Jb||(Jb=Kb()),Jb(a)):m.setImmediate(a)}},dc=!1,nb=new function(){this.b=this.a=null},fc=function(){for(var a;a=ob();){try{a.a.call(a.b)}catch(b){Ib(b)}wa(mb, a)}dc=!1};var gc;(gc=!F)||(gc=9<=Number(ac));var hc=gc,ic=F&&!G("9");!Rb||G("528");Qb&&G("1.9b")||F&&G("8")||Ob&&G("9.5")||Rb&&G("528");Qb&&!G("8")||F&&G("9");var jc=function(a,b){this.b={};this.a=[];this.f=this.c=0;var c=arguments.length;if(1<c){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else if(a){a instanceof jc?(c=a.D(),d=a.w()):(c=Ba(a),d=Aa(a));for(var e=0;e<c.length;e++)this.set(c[e],d[e])}};k=jc.prototype;k.o=function(){return this.c};k.w=function(){kc(this);for(var a=[],b=0;b<this.a.length;b++)a.push(this.b[this.a[b]]);return a};k.D=function(){kc(this);return this.a.concat()}; k.F=function(){return 0==this.c};k.clear=function(){this.b={};this.f=this.c=this.a.length=0}; var lc=function(a,b){return Object.prototype.hasOwnProperty.call(a.b,b)?(delete a.b[b],a.c--,a.f++,a.a.length>2*a.c&&kc(a),!0):!1},kc=function(a){if(a.c!=a.a.length){for(var b=0,c=0;b<a.a.length;){var d=a.a[b];Object.prototype.hasOwnProperty.call(a.b,d)&&(a.a[c++]=d);b++}a.a.length=c}if(a.c!=a.a.length){for(var e={},c=b=0;b<a.a.length;)d=a.a[b],Object.prototype.hasOwnProperty.call(e,d)||(a.a[c++]=d,e[d]=1),b++;a.a.length=c}};k=jc.prototype; k.get=function(a,b){return Object.prototype.hasOwnProperty.call(this.b,a)?this.b[a]:b};k.set=function(a,b){Object.prototype.hasOwnProperty.call(this.b,a)||(this.c++,this.a.push(a),this.f++);this.b[a]=b};k.forEach=function(a,b){for(var c=this.D(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};k.clone=function(){return new jc(this)}; k.Y=function(a){kc(this);var b=0,c=this.f,d=this,e=new Mb;e.next=function(){if(c!=d.f)throw Error("The map has changed since the iterator was created");if(b>=d.a.length)throw Lb;var e=d.a[b++];return a?e:d.b[e]};return e};var mc=function(a,b){pb.call(this,a?a.type:"");this.c=this.a=this.target=null;if(a){this.type=a.type;this.target=a.target||a.srcElement;this.a=b;if((b=a.relatedTarget)&&Qb)try{Ga(b.nodeName)}catch(c){}this.c=a;a.defaultPrevented&&this.b()}};u(mc,pb);mc.prototype.b=function(){mc.G.b.call(this);var a=this.c;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,ic)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var H=function(a,b){this.a=0;this.i=void 0;this.c=this.b=this.f=null;this.g=this.h=!1;if(a!=ba)try{var c=this;a.call(b,function(a){nc(c,2,a)},function(a){try{if(a instanceof Error)throw a;throw Error("Promise rejected.");}catch(b){}nc(c,3,a)})}catch(d){nc(this,3,d)}},oc=function(){this.next=this.f=this.c=this.a=this.b=null;this.g=!1};oc.prototype.reset=function(){this.f=this.c=this.a=this.b=null;this.g=!1}; var pc=new va(function(){return new oc},function(a){a.reset()},100),qc=function(a,b,c){var d=pc.get();d.a=a;d.c=b;d.f=c;return d},rc=function(a){if(a instanceof H)return a;var b=new H(ba);nc(b,2,a);return b},sc=function(a){return new H(function(b,c){c(a)})}; H.prototype.then=function(a,b,c){null!=a&&Sa(a,"opt_onFulfilled should be a function.");null!=b&&Sa(b,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");return tc(this,r(a)?a:null,r(b)?b:null,c)};Ea(H);H.prototype.l=function(a,b){return tc(this,null,a,b)}; var vc=function(a,b){a.b||2!=a.a&&3!=a.a||uc(a);C(null!=b.a);a.c?a.c.next=b:a.b=b;a.c=b},tc=function(a,b,c,d){var e=qc(null,null,null);e.b=new H(function(a,g){e.a=b?function(c){try{var e=b.call(d,c);a(e)}catch(B){g(B)}}:a;e.c=c?function(b){try{var e=c.call(d,b);a(e)}catch(B){g(B)}}:g});e.b.f=a;vc(a,e);return e.b};H.prototype.s=function(a){C(1==this.a);this.a=0;nc(this,2,a)};H.prototype.m=function(a){C(1==this.a);this.a=0;nc(this,3,a)}; var nc=function(a,b,c){if(0==a.a){a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself"));a.a=1;var d;a:{var e=c,f=a.s,g=a.m;if(e instanceof H)null!=f&&Sa(f,"opt_onFulfilled should be a function."),null!=g&&Sa(g,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?"),vc(e,qc(f||ba,g||null,a)),d=!0;else if(Fa(e))e.then(f,g,a),d=!0;else{if(da(e))try{var h=e.then;if(r(h)){wc(e,h,f,g,a);d=!0;break a}}catch(l){g.call(a,l);d=!0;break a}d=!1}}d|| (a.i=c,a.a=b,a.f=null,uc(a),3!=b||xc(a,c))}},wc=function(a,b,c,d,e){var f=!1,g=function(a){f||(f=!0,c.call(e,a))},h=function(a){f||(f=!0,d.call(e,a))};try{b.call(a,g,h)}catch(l){h(l)}},uc=function(a){a.h||(a.h=!0,ec(a.j,a))},yc=function(a){var b=null;a.b&&(b=a.b,a.b=b.next,b.next=null);a.b||(a.c=null);null!=b&&C(null!=b.a);return b}; H.prototype.j=function(){for(var a;a=yc(this);){var b=this.a,c=this.i;if(3==b&&a.c&&!a.g){var d;for(d=this;d&&d.g;d=d.f)d.g=!1}if(a.b)a.b.f=null,zc(a,b,c);else try{a.g?a.a.call(a.f):zc(a,b,c)}catch(e){Ac.call(null,e)}wa(pc,a)}this.h=!1};var zc=function(a,b,c){2==b?a.a.call(a.f,c):a.c&&a.c.call(a.f,c)},xc=function(a,b){a.g=!0;ec(function(){a.g&&Ac.call(null,b)})},Ac=Ib;var Cc=function(a){this.a=new jc;if(a){a=Gb(a);for(var b=a.length,c=0;c<b;c++){var d=a[c];this.a.set(Bc(d),d)}}},Bc=function(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+(a[ea]||(a[ea]=++fa)):b.substr(0,1)+a};k=Cc.prototype;k.o=function(){return this.a.o()};k.clear=function(){this.a.clear()};k.F=function(){return this.a.F()};k.w=function(){return this.a.w()};k.clone=function(){return new Cc(this)};k.Y=function(){return this.a.Y(!1)};var Dc=function(a){return function(){var b=[];Array.prototype.push.apply(b,arguments);rc(!0).then(function(){a.apply(null,b)})}};var Ec="closure_lm_"+(1E6*Math.random()|0),Fc={},Gc=0,Hc=function(a,b,c,d,e){if("array"==p(b)){for(var f=0;f<b.length;f++)Hc(a,b[f],c,d,e);return null}c=Ic(c);a&&a[Ta]?(Jc(a),a=xb(a.b,String(b),c,!1,d,e)):a=Kc(a,b,c,!1,d,e);return a},Kc=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=!!e,h=Lc(a);h||(a[Ec]=h=new vb(a));c=xb(h,b,c,d,e,f);if(c.a)return c;d=Mc();c.a=d;d.src=a;d.listener=c;if(a.addEventListener)a.addEventListener(b.toString(),d,g);else if(a.attachEvent)a.attachEvent(Nc(b.toString()), d);else throw Error("addEventListener and attachEvent are unavailable.");Gc++;return c},Mc=function(){var a=Oc,b=hc?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b},Pc=function(a,b,c,d,e){if("array"==p(b))for(var f=0;f<b.length;f++)Pc(a,b[f],c,d,e);else c=Ic(c),a&&a[Ta]?xb(a.b,String(b),c,!0,d,e):Kc(a,b,c,!0,d,e)},Qc=function(a,b,c,d,e){if("array"==p(b))for(var f=0;f<b.length;f++)Qc(a,b[f],c,d,e);else(c=Ic(c),a&&a[Ta])?(a=a.b,b=String(b).toString(), b in a.a&&(f=a.a[b],c=wb(f,c,d,e),-1<c&&(rb(f[c]),C(null!=f.length),Array.prototype.splice.call(f,c,1),0==f.length&&(delete a.a[b],a.b--)))):a&&(a=Lc(a))&&(b=a.a[b.toString()],a=-1,b&&(a=wb(b,c,!!d,e)),(c=-1<a?b[a]:null)&&Rc(c))},Rc=function(a){if("number"!=typeof a&&a&&!a.O){var b=a.src;if(b&&b[Ta])yb(b.b,a);else{var c=a.type,d=a.a;b.removeEventListener?b.removeEventListener(c,d,a.U):b.detachEvent&&b.detachEvent(Nc(c),d);Gc--;(c=Lc(b))?(yb(c,a),0==c.b&&(c.src=null,b[Ec]=null)):rb(a)}}},Nc=function(a){return a in Fc?Fc[a]:Fc[a]="on"+a},Tc=function(a,b,c,d){var e=!0;if(a=Lc(a))if(b=a.a[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.U==c&&!f.O&&(f=Sc(f,d),e=e&&!1!==f)}return e},Sc=function(a,b){var c=a.listener,d=a.N||a.src;a.T&&Rc(a);return c.call(d,b)},Oc=function(a,b){if(a.O)return!0;if(!hc){if(!b)a:{b=["window","event"];for(var c=m,d;d=b.shift();)if(null!=c[d])c=c[d];else{b=null;break a}b=c}d=b;b=new mc(d,this);c=!0;if(!(0>d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode= -1;break a}catch(g){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.a;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;0<=e;e--){b.a=d[e];var f=Tc(d[e],a,!0,b),c=c&&f}for(e=0;e<d.length;e++)b.a=d[e],f=Tc(d[e],a,!1,b),c=c&&f}return c}return Sc(a,new mc(b,this))},Lc=function(a){a=a[Ec];return a instanceof vb?a:null},Uc="__closure_events_fn_"+(1E9*Math.random()>>>0),Ic=function(a){C(a,"Listener can not be null.");if(r(a))return a;C(a.handleEvent,"An object listener must have handleEvent method."); a[Uc]||(a[Uc]=function(b){return a.handleEvent(b)});return a[Uc]};var I=function(a,b){D.call(this);this.l=a||0;this.c=b||10;if(this.l>this.c)throw Error("[goog.structs.Pool] Min can not be greater than max");this.a=new Eb;this.b=new Cc;this.i=null;this.S()};u(I,D);I.prototype.W=function(){var a=ia();if(!(null!=this.i&&0>a-this.i)){for(var b;0<this.a.o()&&(b=Fb(this.a),!this.j(b));)this.S();!b&&this.o()<this.c&&(b=this.h());b&&(this.i=a,this.b.a.set(Bc(b),b));return b}};var Wc=function(a){var b=Vc;lc(b.b.a,Bc(a))&&b.Z(a)}; I.prototype.Z=function(a){lc(this.b.a,Bc(a));this.j(a)&&this.o()<this.c?this.a.a.push(a):Xc(a)};I.prototype.S=function(){for(var a=this.a;this.o()<this.l;){var b=this.h();a.a.push(b)}for(;this.o()>this.c&&0<this.a.o();)Xc(Fb(a))};I.prototype.h=function(){return{}};var Xc=function(a){if("function"==typeof a.fa)a.fa();else for(var b in a)a[b]=null};I.prototype.j=function(a){return"function"==typeof a.ra?a.ra():!0};I.prototype.o=function(){return this.a.o()+this.b.o()}; I.prototype.F=function(){return this.a.F()&&this.b.F()};I.prototype.A=function(){I.G.A.call(this);if(0<this.b.o())throw Error("[goog.structs.Pool] Objects not released");delete this.b;for(var a=this.a;!a.F();)Xc(Fb(a));delete this.a};/* Portions of this code are from MochiKit, received by The Closure Authors under the MIT license. All other code is Copyright 2005-2009 The Closure Authors. All Rights Reserved. */ var Yc=function(a,b){this.c=[];this.m=b||null;this.a=this.h=!1;this.b=void 0;this.j=this.g=!1;this.f=0;this.i=null;this.s=0};Yc.prototype.l=function(a,b){this.g=!1;this.h=!0;this.b=b;this.a=!a;Zc(this)};var $c=function(a,b,c){C(!a.j,"Blocking Deferreds can not be re-used");a.c.push([b,c,void 0]);a.h&&Zc(a)};Yc.prototype.then=function(a,b,c){var d,e,f=new H(function(a,b){d=a;e=b});$c(this,d,function(a){e(a)});return f.then(a,b,c)};Ea(Yc); var ad=function(a){return fb(a.c,function(a){return r(a[1])})},Zc=function(a){if(a.f&&a.h&&ad(a)){var b=a.f,c=bd[b];c&&(m.clearTimeout(c.a),delete bd[b]);a.f=0}a.i&&(a.i.s--,delete a.i);for(var b=a.b,d=c=!1;a.c.length&&!a.g;){var e=a.c.shift(),f=e[0],g=e[1],e=e[2];if(f=a.a?g:f)try{var h=f.call(e||a.m,b);n(h)&&(a.a=a.a&&(h==b||h instanceof Error),a.b=b=h);if(Fa(b)||"function"===typeof m.Promise&&b instanceof m.Promise)d=!0,a.g=!0}catch(l){b=l,a.a=!0,ad(a)||(c=!0)}}a.b=b;d&&(h=t(a.l,a,!0),d=t(a.l,a, !1),b instanceof Yc?($c(b,h,d),b.j=!0):b.then(h,d));c&&(b=new cd(b),bd[b.a]=b,a.f=b.a)},cd=function(a){this.a=m.setTimeout(t(this.c,this),0);this.b=a};cd.prototype.c=function(){C(bd[this.a],"Cannot throw an error that is not scheduled.");delete bd[this.a];throw this.b;};var bd={};var dd=function(a){this.f=a;this.b=this.c=this.a=null},ed=function(a,b){this.name=a;this.value=b};ed.prototype.toString=function(){return this.name};var fd=new ed("SEVERE",1E3),gd=new ed("CONFIG",700),hd=new ed("FINE",500),id=function(a){if(a.c)return a.c;if(a.a)return id(a.a);Ra("Root logger has no level set.");return null}; dd.prototype.log=function(a,b,c){if(a.value>=id(this).value)for(r(b)&&(b=b()),a=new ya(a,String(b),this.f),c&&(a.a=c),c="log:"+a.b,m.console&&(m.console.timeStamp?m.console.timeStamp(c):m.console.markTimeline&&m.console.markTimeline(c)),m.msWriteProfilerMark&&m.msWriteProfilerMark(c),c=this;c;)c=c.a}; var jd={},kd=null,ld=function(a){kd||(kd=new dd(""),jd[""]=kd,kd.c=gd);var b;if(!(b=jd[a])){b=new dd(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=ld(a.substr(0,c));c.b||(c.b={});c.b[d]=b;b.a=c;jd[a]=b}return b};var J=function(){D.call(this);this.b=new vb(this);this.ma=this;this.I=null};u(J,D);J.prototype[Ta]=!0;J.prototype.removeEventListener=function(a,b,c,d){Qc(this,a,b,c,d)}; var K=function(a,b){Jc(a);var c,d=a.I;if(d){c=[];for(var e=1;d;d=d.I)c.push(d),C(1E3>++e,"infinite loop")}a=a.ma;d=b.type||b;q(b)?b=new pb(b,a):b instanceof pb?b.target=b.target||a:(e=b,b=new pb(d,a),Da(b,e));var e=!0,f;if(c)for(var g=c.length-1;0<=g;g--)f=b.a=c[g],e=md(f,d,!0,b)&&e;f=b.a=a;e=md(f,d,!0,b)&&e;e=md(f,d,!1,b)&&e;if(c)for(g=0;g<c.length;g++)f=b.a=c[g],e=md(f,d,!1,b)&&e}; J.prototype.A=function(){J.G.A.call(this);if(this.b){var a=this.b,b=0,c;for(c in a.a){for(var d=a.a[c],e=0;e<d.length;e++)++b,rb(d[e]);delete a.a[c];a.b--}}this.I=null};var md=function(a,b,c,d){b=a.b.a[String(b)];if(!b)return!0;b=b.concat();for(var e=!0,f=0;f<b.length;++f){var g=b[f];if(g&&!g.O&&g.U==c){var h=g.listener,l=g.N||g.src;g.T&&yb(a.b,g);e=!1!==h.call(l,d)&&e}}return e&&0!=d.ka},Jc=function(a){C(a.b,"Event target is not initialized. Did you call the superclass (goog.events.EventTarget) constructor?")};var L=function(a,b){this.f=new Nb;I.call(this,a,b)};u(L,I);k=L.prototype;k.W=function(a,b){if(!a)return L.G.W.call(this);Db(this.f,n(b)?b:100,a);this.$()};k.$=function(){for(var a=this.f;0<a.o();){var b=this.W();if(b){var c;var d=a,e=d.a,f=e.length;c=e[0];if(0>=f)c=void 0;else{if(1==f)ib(e);else{e[0]=e.pop();for(var e=0,d=d.a,f=d.length,g=d[e];e<f>>1;){var h=2*e+1,l=2*e+2,h=l<f&&d[l].a<d[h].a?l:h;if(d[h].a>g.a)break;d[e]=d[h];e=h}d[e]=g}c=c.b}c.apply(this,[b])}else break}}; k.Z=function(a){L.G.Z.call(this,a);this.$()};k.S=function(){L.G.S.call(this);this.$()};k.A=function(){L.G.A.call(this);m.clearTimeout(void 0);this.f.clear();this.f=null};var M=function(a,b){a&&a.log(hd,b,void 0)};var nd=function(a,b,c){if(r(a))c&&(a=t(a,c));else if(a&&"function"==typeof a.handleEvent)a=t(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:m.setTimeout(a,b||0)};var O=function(a){J.call(this);this.L=new jc;this.C=a||null;this.c=!1;this.B=this.a=null;this.P=this.l="";this.J=0;this.h="";this.f=this.H=this.j=this.K=!1;this.i=0;this.m=null;this.da="";this.v=this.ba=this.X=!1};u(O,J);var od=O.prototype,pd=ld("goog.net.XhrIo");od.u=pd;var qd=/^https?$/i,rd=["POST","PUT"]; O.prototype.send=function(a,b,c,d){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.l+"; newUri="+a);b=b?b.toUpperCase():"GET";this.l=a;this.h="";this.J=0;this.P=b;this.K=!1;this.c=!0;this.a=this.C?Bb(this.C):Bb(zb);this.B=this.C?ab(this.C):ab(zb);this.a.onreadystatechange=t(this.ca,this);this.ba&&"onprogress"in this.a&&(this.a.onprogress=t(function(a){this.R(a,!0)},this),this.a.upload&&(this.a.upload.onprogress=t(this.R,this)));try{M(this.u,P(this,"Opening Xhr")), this.H=!0,this.a.open(b,String(a),!0),this.H=!1}catch(f){M(this.u,P(this,"Error opening Xhr: "+f.message));sd(this,f);return}a=c||"";var e=this.L.clone();d&&Hb(d,function(a,b){e.set(b,a)});d=hb(e.D());c=m.FormData&&a instanceof m.FormData;!(0<=bb(rd,b))||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(a,b){this.a.setRequestHeader(b,a)},this);this.da&&(this.a.responseType=this.da);"withCredentials"in this.a&&this.a.withCredentials!==this.X&&(this.a.withCredentials= this.X);try{td(this),0<this.i&&(this.v=ud(this.a),M(this.u,P(this,"Will abort after "+this.i+"ms if incomplete, xhr2 "+this.v)),this.v?(this.a.timeout=this.i,this.a.ontimeout=t(this.M,this)):this.m=nd(this.M,this.i,this)),M(this.u,P(this,"Sending request")),this.j=!0,this.a.send(a),this.j=!1}catch(f){M(this.u,P(this,"Send error: "+f.message)),sd(this,f)}};var ud=function(a){return F&&G(9)&&"number"==typeof a.timeout&&n(a.ontimeout)},gb=function(a){return"content-type"==a.toLowerCase()}; O.prototype.M=function(){"undefined"!=typeof aa&&this.a&&(this.h="Timed out after "+this.i+"ms, aborting",this.J=8,M(this.u,P(this,this.h)),K(this,"timeout"),vd(this,8))};var sd=function(a,b){a.c=!1;a.a&&(a.f=!0,a.a.abort(),a.f=!1);a.h=b;a.J=5;wd(a);xd(a)},wd=function(a){a.K||(a.K=!0,K(a,"complete"),K(a,"error"))},vd=function(a,b){a.a&&a.c&&(M(a.u,P(a,"Aborting")),a.c=!1,a.f=!0,a.a.abort(),a.f=!1,a.J=b||7,K(a,"complete"),K(a,"abort"),xd(a))}; O.prototype.A=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),xd(this,!0));O.G.A.call(this)};O.prototype.ca=function(){this.g||(this.H||this.j||this.f?yd(this):this.na())};O.prototype.na=function(){yd(this)}; var yd=function(a){if(a.c&&"undefined"!=typeof aa)if(a.B[1]&&4==zd(a)&&2==Q(a))M(a.u,P(a,"Local request error detected and ignored"));else if(a.j&&4==zd(a))nd(a.ca,0,a);else if(K(a,"readystatechange"),4==zd(a)){M(a.u,P(a,"Request complete"));a.c=!1;try{if(Bd(a))K(a,"complete"),K(a,"success");else{a.J=6;var b;try{b=2<zd(a)?a.a.statusText:""}catch(c){M(a.u,"Can not get status: "+c.message),b=""}a.h=b+" ["+Q(a)+"]";wd(a)}}finally{xd(a)}}}; O.prototype.R=function(a,b){C("progress"===a.type,"goog.net.EventType.PROGRESS is of the same type as raw XHR progress.");K(this,Cd(a,"progress"));K(this,Cd(a,b?"downloadprogress":"uploadprogress"))}; var Cd=function(a,b){return{type:b,lengthComputable:a.lengthComputable,loaded:a.loaded,total:a.total}},xd=function(a,b){if(a.a){td(a);var c=a.a,d=a.B[0]?ba:null;a.a=null;a.B=null;b||K(a,"ready");try{c.onreadystatechange=d}catch(e){(a=a.u)&&a.log(fd,"Problem encountered resetting onreadystatechange: "+e.message,void 0)}}},td=function(a){a.a&&a.v&&(a.a.ontimeout=null);"number"==typeof a.m&&(m.clearTimeout(a.m),a.m=null)},Bd=function(a){var b=Q(a),c;a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:c= !0;break a;default:c=!1}if(!c){if(b=0===b)a=String(a.l).match(sb)[1]||null,!a&&m.self&&m.self.location&&(a=m.self.location.protocol,a=a.substr(0,a.length-1)),b=!qd.test(a?a.toLowerCase():"");c=b}return c},zd=function(a){return a.a?a.a.readyState:0},Q=function(a){try{return 2<zd(a)?a.a.status:-1}catch(b){return-1}},Dd=function(a){try{return a.a?a.a.responseText:""}catch(b){return M(a.u,"Can not get responseText: "+b.message),""}},Ed=function(a,b){return a.a&&4==zd(a)?a.a.getResponseHeader(b):void 0}, P=function(a,b){return b+" ["+a.P+" "+a.l+" "+Q(a)+"]"};var Fd=function(a,b,c,d){this.m=a;this.v=!!d;L.call(this,b,c)};u(Fd,L);Fd.prototype.h=function(){var a=new O,b=this.m;b&&b.forEach(function(b,d){a.L.set(d,b)});this.v&&(a.X=!0);return a};Fd.prototype.j=function(a){return!a.g&&!a.a};var Vc=new Fd;var Hd=function(a,b,c,d,e,f,g,h,l,B){this.L=a;this.H=b;this.B=c;this.m=d;this.I=e.slice();this.s=this.l=this.f=this.c=null;this.h=this.i=!1;this.v=f;this.j=g;this.g=l;this.M=B;this.K=h;var w=this;this.C=new H(function(a,b){w.l=a;w.s=b;Gd(w)})},Id=function(a,b,c){this.b=a;this.c=b;this.a=!!c},Gd=function(a){function b(a,b){b?a(!1,new Id(!1,null,!0)):Vc.W(function(b){b.X=d.M;d.c=b;var c=null;null!==d.g&&(b.ba=!0,c=Hc(b,"uploadprogress",function(a){d.g(a.loaded,a.lengthComputable?a.total:-1)}),b.ba= null!==d.g);b.send(d.L,d.H,d.m,d.B);Pc(b,"complete",function(b){null!==c&&Rc(c);d.c=null;b=b.target;var f=6===b.J&&100<=Q(b),f=Bd(b)||f,g=Q(b);!f||500<=g&&600>g||429===g?(f=7===b.J,Wc(b),a(!1,new Id(!1,null,f))):(f=0<=bb(d.I,g),a(!0,new Id(f,b)))})})}function c(a,b){var c=d.l;a=d.s;var h=b.c;if(b.b)try{var l=d.v(h,Dd(h));n(l)?c(l):c()}catch(B){a(B)}else null!==h?(b=la(),l=Dd(h),b.serverResponse=l,d.j?a(d.j(h,b)):a(b)):(b=b.a?d.h?oa():ma():new v("retry-limit-exceeded","Max retry time for operation exceeded, please try again."), a(b));Wc(h)}var d=a;a.i?c(0,new Id(!1,null,!0)):a.f=ja(b,c,a.K)};Hd.prototype.a=function(){return this.C};Hd.prototype.b=function(a){this.i=!0;this.h=a||!1;null!==this.f&&(0,this.f)(!1);null!==this.c&&vd(this.c)};var Jd=function(a,b,c){var d=Oa(a.f),d=a.l+d,e=a.b?qa(a.b):{};null!==b&&0<b.length&&(e.Authorization="Firebase "+b);e["X-Firebase-Storage-Version"]="webjs/1.0.0";return new Hd(d,a.i,e,a.c,a.h,a.N,a.a,a.j,a.g,c)};var Kd=function(a){var b=m.BlobBuilder||m.WebKitBlobBuilder;if(n(b)){for(var b=new b,c=0;c<arguments.length;c++)b.append(arguments[c]);return b.getBlob()}b=kb(arguments);c=m.BlobBuilder||m.WebKitBlobBuilder;if(n(c)){for(var c=new c,d=0;d<b.length;d++)c.append(b[d],void 0);b=c.getBlob(void 0)}else if(n(m.Blob))b=new Blob(b,{});else throw Error("This browser doesn't seem to support creating Blobs");return b},Ld=function(a,b,c){n(c)||(c=a.size);return a.webkitSlice?a.webkitSlice(b,c):a.mozSlice?a.mozSlice(b, c):a.slice?Qb&&!G("13.0")||Rb&&!G("537.1")?(0>b&&(b+=a.size),0>b&&(b=0),0>c&&(c+=a.size),c<b&&(c=b),a.slice(b,c-b)):a.slice(b,c):null};var Md=function(a){this.c=sc(a)};Md.prototype.a=function(){return this.c};Md.prototype.b=function(){};var Nd=function(){this.a={};this.b=Number.MIN_SAFE_INTEGER},Od=function(a,b){function c(){delete e.a[d]}var d=a.b;a.b++;a.a[d]=b;var e=a;b.a().then(c,c)};Nd.prototype.clear=function(){pa(this.a,function(a,b){b&&b.b(!0)});this.a={}};var Pd=function(a,b,c,d){this.a=a;this.g=null;if(null!==this.a&&(a=this.a.options,y(a))){a=a.storageBucket||null;if(null==a)a=null;else{var e=null;try{e=Ma(a)}catch(f){}if(null!==e){if(""!==e.path)throw new v("invalid-default-bucket","Invalid default bucket '"+a+"'.");a=e.bucket}}this.g=a}this.l=b;this.j=c;this.i=d;this.c=12E4;this.b=6E4;this.h=new Nd;this.f=!1},Qd=function(a){return null!==a.a&&y(a.a.INTERNAL)&&y(a.a.INTERNAL.getToken)?a.a.INTERNAL.getToken().then(function(a){return y(a)?a.accessToken: null},function(){return null}):rc(null)};Pd.prototype.bucket=function(){if(this.f)throw oa();return this.g};var R=function(a,b,c){if(a.f)return new Md(oa());b=a.j(b,c,null===a.a);Od(a.h,b);return b};var Rd=function(a,b){return b},S=function(a,b,c,d){this.c=a;this.b=b||a;this.f=!!c;this.a=d||Rd},Sd=null,Td=function(){if(Sd)return Sd;var a=[];a.push(new S("bucket"));a.push(new S("generation"));a.push(new S("metageneration"));a.push(new S("name","fullPath",!0));var b=new S("name");b.a=function(a,b){return!ua(b)||2>b.length?b:ub(b)};a.push(b);b=new S("size");b.a=function(a,b){return y(b)?+b:b};a.push(b);a.push(new S("timeCreated"));a.push(new S("updated"));a.push(new S("md5Hash",null,!0));a.push(new S("cacheControl", null,!0));a.push(new S("contentDisposition",null,!0));a.push(new S("contentEncoding",null,!0));a.push(new S("contentLanguage",null,!0));a.push(new S("contentType",null,!0));a.push(new S("metadata","customMetadata",!0));a.push(new S("downloadTokens","downloadURLs",!1,function(a,b){if(!(ua(b)&&0<b.length))return[];var e=encodeURIComponent;return eb(b.split(","),function(b){var d=a.fullPath,d="https://firebasestorage.googleapis.com/v0"+("/b/"+e(a.bucket)+"/o/"+e(d));b=Oa({alt:"media",token:b});return d+ b})}));return Sd=a},Ud=function(a,b){Object.defineProperty(a,"ref",{get:function(){return b.l(b,new z(a.bucket,a.fullPath))}})},Vd=function(a,b){for(var c={},d=b.length,e=0;e<d;e++){var f=b[e];f.f&&(c[f.c]=a[f.b])}return JSON.stringify(c)},Wd=function(a){if(!a||"object"!==typeof a)throw"Expected Metadata object.";for(var b in a){var c=a[b];if("customMetadata"===b&&"object"!==typeof c)throw"Expected object for 'customMetadata' mapping.";}};var T=function(a,b,c){for(var d=b.length,e=b.length,f=0;f<b.length;f++)if(b[f].b){d=f;break}if(!(d<=c.length&&c.length<=e))throw d===e?(b=d,d=1===d?"argument":"arguments"):(b="between "+d+" and "+e,d="arguments"),new v("invalid-argument-count","Invalid argument count in `"+a+"`: Expected "+b+" "+d+", received "+c.length+".");for(f=0;f<c.length;f++)try{b[f].a(c[f])}catch(g){if(g instanceof Error)throw na(f,a,g.message);throw na(f,a,g);}},U=function(a,b){var c=this;this.a=function(b){c.b&&!n(b)||a(b)}; this.b=!!b},Xd=function(a,b){return function(c){a(c);b(c)}},Yd=function(a,b){function c(a){if(!("string"===typeof a||a instanceof String))throw"Expected string.";}var d;a?d=Xd(c,a):d=c;return new U(d,b)},Zd=function(){return new U(function(a){if(!(a instanceof Blob))throw"Expected Blob or File.";})},$d=function(){return new U(function(a){if(!(("number"===typeof a||a instanceof Number)&&0<=a))throw"Expected a number 0 or greater.";})},ae=function(a,b){return new U(function(b){if(!(null===b||y(b)&& b instanceof Object))throw"Expected an Object.";y(a)&&a(b)},b)},be=function(){return new U(function(a){if(null!==a&&!r(a))throw"Expected a Function.";},!0)};var ce=function(a){if(!a)throw la();},de=function(a,b){return function(c,d){a:{var e;try{e=JSON.parse(d)}catch(h){c=null;break a}c=da(e)?e:null}if(null===c)c=null;else{d={type:"file"};e=b.length;for(var f=0;f<e;f++){var g=b[f];d[g.b]=g.a(d,c[g.c])}Ud(d,a);c=d}ce(null!==c);return c}},ee=function(a){return function(b,c){b=401===Q(b)?new v("unauthenticated","User is not authenticated, please authenticate using Firebase Authentication and try again."):402===Q(b)?new v("quota-exceeded","Quota for bucket '"+ a.bucket+"' exceeded, please view quota on https://firebase.google.com/pricing/."):403===Q(b)?new v("unauthorized","User does not have permission to access '"+a.path+"'."):c;b.serverResponse=c.serverResponse;return b}},fe=function(a){var b=ee(a);return function(c,d){var e=b(c,d);404===Q(c)&&(e=new v("object-not-found","Object '"+a.path+"' does not exist."));e.serverResponse=d.serverResponse;return e}},ge=function(a,b,c){var d=La(b);a=new x(ka+"/v0"+d,"GET",de(a,c),a.c);a.a=fe(b);return a},he=function(a, b){var c=La(b);a=new x(ka+"/v0"+c,"DELETE",function(){},a.c);a.h=[200,204];a.a=fe(b);return a},ie=function(a,b,c){c=c?qa(c):{};c.fullPath=a.path;c.size=b.size;c.contentType||(c.contentType=b&&b.type||"application/octet-stream");return c},je=function(a,b,c,d,e){var f="/b/"+encodeURIComponent(b.bucket)+"/o",g={"X-Goog-Upload-Protocol":"multipart"},h;h="";for(var l=0;2>l;l++)h+=Math.random().toString().slice(2);g["Content-Type"]="multipart/related; boundary="+h;e=ie(b,d,e);l=Vd(e,c);d=Kd("--"+h+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+ l+"\r\n--"+h+"\r\nContent-Type: "+e.contentType+"\r\n\r\n",d,"\r\n--"+h+"--");a=new x(ka+"/v0"+f,"POST",de(a,c),a.b);a.f={name:e.fullPath};a.b=g;a.c=d;a.a=ee(b);return a},ke=function(a,b,c,d){this.a=a;this.total=b;this.b=!!c;this.c=d||null},le=function(a,b){var c;try{c=Ed(a,"X-Goog-Upload-Status")}catch(d){ce(!1)}a=0<=bb(b||["active"],c);ce(a);return c},me=function(a,b,c,d,e){var f="/b/"+encodeURIComponent(b.bucket)+"/o",g=ie(b,d,e);e={name:g.fullPath};f=ka+"/v0"+f;d={"X-Goog-Upload-Protocol":"resumable", "X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":d.size,"X-Goog-Upload-Header-Content-Type":g.contentType,"Content-Type":"application/json; charset=utf-8"};c=Vd(g,c);a=new x(f,"POST",function(a){le(a);var b;try{b=Ed(a,"X-Goog-Upload-URL")}catch(c){ce(!1)}ce(ua(b));return b},a.b);a.f=e;a.b=d;a.c=c;a.a=ee(b);return a},ne=function(a,b,c,d){a=new x(c,"POST",function(a){var b=le(a,["active","final"]),c;try{c=Ed(a,"X-Goog-Upload-Size-Received")}catch(h){ce(!1)}a=c;isFinite(a)&&(a=String(a)); a=q(a)?/^\s*-?0x/i.test(a)?parseInt(a,16):parseInt(a,10):NaN;ce(!isNaN(a));return new ke(a,d.size,"final"===b)},a.b);a.b={"X-Goog-Upload-Command":"query"};a.a=ee(b);return a},oe=function(a,b,c,d,e,f){var g=new ke(0,0);f?(g.a=f.a,g.total=f.total):(g.a=0,g.total=d.size);if(d.size!==g.total)throw new v("server-file-wrong-size","Server recorded incorrect upload file size, please retry the upload.");var h=f=g.total-g.a,h=Math.min(h,262144),l=g.a;f={"X-Goog-Upload-Command":h===f?"upload, finalize":"upload", "X-Goog-Upload-Offset":g.a};l=Ld(d,l,l+h);if(null===l)throw new v("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.");c=new x(c,"POST",function(a,c){var f=le(a,["active","final"]),l=g.a+h,Ad=d.size,Va;"final"===f?Va=de(b,e)(a,c):Va=null;return new ke(l,Ad,"final"===f,Va)},b.b);c.b=f;c.c=l;c.g=null;c.a=ee(a);return c};var W=function(a,b,c,d,e,f){this.K=a;this.c=b;this.i=c;this.f=e;this.h=f||null;this.l=d;this.j=0;this.B=this.s=!1;this.v=[];this.R=262144<this.f.size;this.b="running";this.a=this.m=this.g=null;var g=this;this.V=function(a){g.a=null;"storage/canceled"===a.code?(g.s=!0,pe(g)):(g.g=a,V(g,"error"))};this.P=function(a){g.a=null;"storage/canceled"===a.code?pe(g):(g.g=a,V(g,"error"))};qe(this)},qe=function(a){"running"===a.b&&null===a.a&&(a.R?null===a.m?re(a):a.s?se(a):a.B?te(a):ue(a):ve(a))},we=function(a, b){Qd(a.c).then(function(c){switch(a.b){case "running":b(c);break;case "canceling":V(a,"canceled");break;case "pausing":V(a,"paused")}})},re=function(a){we(a,function(b){var c=me(a.c,a.i,a.l,a.f,a.h);a.a=R(a.c,c,b);a.a.a().then(function(b){a.a=null;a.m=b;a.s=!1;pe(a)},this.V)})},se=function(a){var b=a.m;we(a,function(c){var d=ne(a.c,a.i,b,a.f);a.a=R(a.c,d,c);a.a.a().then(function(b){a.a=null;xe(a,b.a);a.s=!1;b.b&&(a.B=!0);pe(a)},a.V)})},ue=function(a){var b=new ke(a.j,a.f.size),c=a.m;we(a,function(d){var e; try{e=oe(a.i,a.c,c,a.f,a.l,b)}catch(f){a.g=f;V(a,"error");return}a.a=R(a.c,e,d);a.a.a().then(function(b){a.a=null;xe(a,b.a);b.b?(a.h=b.c,V(a,"success")):pe(a)},a.V)})},te=function(a){we(a,function(b){var c=ge(a.c,a.i,a.l);a.a=R(a.c,c,b);a.a.a().then(function(b){a.a=null;a.h=b;V(a,"success")},a.P)})},ve=function(a){we(a,function(b){var c=je(a.c,a.i,a.l,a.f,a.h);a.a=R(a.c,c,b);a.a.a().then(function(b){a.a=null;a.h=b;xe(a,a.f.size);V(a,"success")},a.V)})},xe=function(a,b){var c=a.j;a.j=b;a.j>c&&ye(a)}, V=function(a,b){if(a.b!==b)switch(b){case "canceling":a.b=b;null!==a.a&&a.a.b();break;case "pausing":a.b=b;null!==a.a&&a.a.b();break;case "running":var c="paused"===a.b;a.b=b;c&&(ye(a),qe(a));break;case "paused":a.b=b;ye(a);break;case "canceled":a.g=ma();a.b=b;ye(a);break;case "error":a.b=b;ye(a);break;case "success":a.b=b,ye(a)}},pe=function(a){switch(a.b){case "pausing":V(a,"paused");break;case "canceling":V(a,"canceled");break;case "running":qe(a)}}; W.prototype.C=function(){return new A(this.j,this.f.size,ta(this.b),this.h,this,this.K)}; W.prototype.I=function(a,b,c,d){function e(a){try{g(a);return}catch(b){}try{if(h(a),!(n(a.next)||n(a.error)||n(a.complete)))throw"";}catch(b){throw"Expected a function or an Object with one of `next`, `error`, `complete` properties.";}}function f(a){return function(b,c,d){null!==a&&T("on",a,arguments);var e=new Na(b,c,d);ze(l,e);return function(){jb(l.v,e)}}}var g=be().a,h=ae(null,!0).a;T("on",[Yd(function(){if("state_changed"!==a)throw"Expected one of the event types: [state_changed].";}),ae(e,!0), be(),be()],arguments);var l=this,B=[ae(function(a){if(null===a)throw"Expected a function or an Object with one of `next`, `error`, `complete` properties.";e(a)}),be(),be()];return n(b)||n(c)||n(d)?f(null)(b,c,d):f(B)}; var ze=function(a,b){a.v.push(b);Ae(a,b)},ye=function(a){var b=kb(a.v);cb(b,function(b){Ae(a,b)})},Ae=function(a,b){switch(ta(a.b)){case "running":case "paused":null!==b.next&&Dc(b.next.bind(b,a.C()))();break;case "success":null!==b.a&&Dc(b.a.bind(b))();break;case "canceled":case "error":null!==b.error&&Dc(b.error.bind(b,a.g))();break;default:null!==b.error&&Dc(b.error.bind(b,a.g))()}}; W.prototype.M=function(){T("resume",[],arguments);var a="paused"===this.b||"pausing"===this.b;a&&V(this,"running");return a};W.prototype.L=function(){T("pause",[],arguments);var a="running"===this.b;a&&V(this,"pausing");return a};W.prototype.H=function(){T("cancel",[],arguments);var a="running"===this.b||"pausing"===this.b;a&&V(this,"canceling");return a};var X=function(a,b){this.b=a;if(b)this.a=b instanceof z?b:Ma(b);else if(a=a.bucket(),null!==a)this.a=new z(a,"");else throw new v("no-default-bucket","No default bucket found. Did you set the 'storageBucket' property when initializing the app?");};X.prototype.toString=function(){T("toString",[],arguments);return"gs://"+this.a.bucket+"/"+this.a.path};var Be=function(a,b){return new X(a,b)};k=X.prototype; k.ga=function(a){T("child",[Yd()],arguments);var b=tb(this.a.path,a);return Be(this.b,new z(this.a.bucket,b))};k.Fa=function(){var a;a=this.a.path;if(0==a.length)a=null;else{var b=a.lastIndexOf("/");a=-1===b?"":a.slice(0,b)}return null===a?null:Be(this.b,new z(this.a.bucket,a))};k.Ha=function(){return Be(this.b,new z(this.a.bucket,""))};k.pa=function(){return this.a.bucket};k.Aa=function(){return this.a.path};k.Ea=function(){return ub(this.a.path)};k.Ja=function(){return this.b.i}; k.ua=function(a,b){T("put",[Zd(),new U(Wd,!0)],arguments);Ce(this,"put");return new W(this,this.b,this.a,Td(),a,b)};k.delete=function(){T("delete",[],arguments);Ce(this,"delete");var a=this;return Qd(this.b).then(function(b){var c=he(a.b,a.a);return R(a.b,c,b).a()})};k.ha=function(){T("getMetadata",[],arguments);Ce(this,"getMetadata");var a=this;return Qd(this.b).then(function(b){var c=ge(a.b,a.a,Td());return R(a.b,c,b).a()})}; k.va=function(a){T("updateMetadata",[new U(Wd,void 0)],arguments);Ce(this,"updateMetadata");var b=this;return Qd(this.b).then(function(c){var d=b.b,e=b.a,f=a,g=Td(),h=La(e),h=ka+"/v0"+h,f=Vd(f,g),d=new x(h,"PATCH",de(d,g),d.c);d.b={"Content-Type":"application/json; charset=utf-8"};d.c=f;d.a=fe(e);return R(b.b,d,c).a()})}; k.ta=function(){T("getDownloadURL",[],arguments);Ce(this,"getDownloadURL");return this.ha().then(function(a){a=a.downloadURLs[0];if(y(a))return a;throw new v("no-download-url","The given file does not have any download URLs.");})};var Ce=function(a,b){if(""===a.a.path)throw new v("invalid-root-operation","The operation '"+b+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').");};var Y=function(a){this.a=new Pd(a,function(a,c){return new X(a,c)},Jd,this);this.b=a;this.c=new De(this)};k=Y.prototype;k.wa=function(a){T("ref",[Yd(function(a){if(/^[A-Za-z]+:\/\//.test(a))throw"Expected child path but got a URL, use refFromURL instead.";},!0)],arguments);var b=new X(this.a);return n(a)?b.ga(a):b}; k.xa=function(a){T("refFromURL",[Yd(function(a){if(!/^[A-Za-z]+:\/\//.test(a))throw"Expected full URL but got a child path, use ref instead.";try{Ma(a)}catch(c){throw"Expected valid full URL but got an invalid one.";}},!1)],arguments);return new X(this.a,a)};k.Ca=function(){return this.a.b};k.za=function(a){T("setMaxUploadRetryTime",[$d()],arguments);this.a.b=a};k.Ba=function(){return this.a.c};k.ya=function(a){T("setMaxOperationRetryTime",[$d()],arguments);this.a.c=a};k.oa=function(){return this.b}; k.la=function(){return this.c};var De=function(a){this.a=a};De.prototype.delete=function(){var a=this.a.a;a.f=!0;a.a=null;a.h.clear()};var Z=function(a,b,c){Object.defineProperty(a,b,{get:c})};X.prototype.toString=X.prototype.toString;X.prototype.child=X.prototype.ga;X.prototype.put=X.prototype.ua;X.prototype["delete"]=X.prototype.delete;X.prototype.getMetadata=X.prototype.ha;X.prototype.updateMetadata=X.prototype.va;X.prototype.getDownloadURL=X.prototype.ta;Z(X.prototype,"parent",X.prototype.Fa);Z(X.prototype,"root",X.prototype.Ha);Z(X.prototype,"bucket",X.prototype.pa);Z(X.prototype,"fullPath",X.prototype.Aa); Z(X.prototype,"name",X.prototype.Ea);Z(X.prototype,"storage",X.prototype.Ja);Y.prototype.ref=Y.prototype.wa;Y.prototype.refFromURL=Y.prototype.xa;Z(Y.prototype,"maxOperationRetryTime",Y.prototype.Ba);Y.prototype.setMaxOperationRetryTime=Y.prototype.ya;Z(Y.prototype,"maxUploadRetryTime",Y.prototype.Ca);Y.prototype.setMaxUploadRetryTime=Y.prototype.za;Z(Y.prototype,"app",Y.prototype.oa);Z(Y.prototype,"INTERNAL",Y.prototype.la);De.prototype["delete"]=De.prototype.delete; Y.prototype.capi_=function(a){ka=a};W.prototype.on=W.prototype.I;W.prototype.resume=W.prototype.M;W.prototype.pause=W.prototype.L;W.prototype.cancel=W.prototype.H;Z(W.prototype,"snapshot",W.prototype.C);Z(A.prototype,"bytesTransferred",A.prototype.qa);Z(A.prototype,"totalBytes",A.prototype.La);Z(A.prototype,"state",A.prototype.Ia);Z(A.prototype,"metadata",A.prototype.Da);Z(A.prototype,"downloadURL",A.prototype.sa);Z(A.prototype,"task",A.prototype.Ka);Z(A.prototype,"ref",A.prototype.Ga); ra.STATE_CHANGED="state_changed";sa.RUNNING="running";sa.PAUSED="paused";sa.SUCCESS="success";sa.CANCELED="canceled";sa.ERROR="error";H.prototype["catch"]=H.prototype.l;H.prototype.then=H.prototype.then; (function(){function a(a){return new Y(a)}var b={TaskState:sa,TaskEvent:ra,Storage:Y,Reference:X};if(window.firebase&&firebase.INTERNAL&&firebase.INTERNAL.registerService)firebase.INTERNAL.registerService("storage",a,b);else throw Error("Cannot install Firebase Storage - be sure to load firebase-app.js first.");})();})();
src/components/App.js
VinodJayasinghe/CircleCI
import React from 'react' import { browserHistory, Router } from 'react-router' import { Provider } from 'react-redux' import PropTypes from 'prop-types' class App extends React.Component { static propTypes = { store: PropTypes.object.isRequired, routes: PropTypes.object.isRequired, } shouldComponentUpdate () { return false } render () { return ( <Provider store={this.props.store}> <div style={{ height: '100%' }}> <Router history={browserHistory} children={this.props.routes} /> </div> </Provider> ) } } export default App
src/scripts/base/Hr.js
ButuzGOL/constructor
import React from 'react'; import variables from '../styles/variables'; export default class Hr extends React.Component { getStyles() { return { boxSizing: 'content-box', height: 0, margin: `${variables.baseHrMarginVertical}px 0`, border: 0, borderTop: `${variables.baseHrBorderWidth}px solid ${variables.baseHrBorder}` }; } render() { return ( <hr style={this.getStyles()} /> ); } }
ajax/libs/forerunnerdb/1.3.40/fdb-core.min.js
hare1039/cdnjs
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){{var d=a("../lib/Core");a("../lib/Shim.IE8")}"undefined"!=typeof window&&(window.ForerunnerDB=d),b.exports=d},{"../lib/Core":3,"../lib/Shim.IE8":24}],2:[function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m;d=a("./Shared");var n=function(a){this.init.apply(this,arguments)};n.prototype.init=function(a){this._primaryKey="_id",this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this._name=a,this._data=[],this._metrics=new f,this._deferQueue={insert:[],update:[],remove:[],upsert:[]},this._deferThreshold={insert:100,update:100,remove:100,upsert:100},this._deferTime={insert:1,update:1,remove:1,upsert:1},this._subsetOf(this)},d.addModule("Collection",n),d.mixin(n.prototype,"Mixin.Common"),d.mixin(n.prototype,"Mixin.Events"),d.mixin(n.prototype,"Mixin.ChainReactor"),d.mixin(n.prototype,"Mixin.CRUD"),d.mixin(n.prototype,"Mixin.Constants"),d.mixin(n.prototype,"Mixin.Triggers"),d.mixin(n.prototype,"Mixin.Sorting"),d.mixin(n.prototype,"Mixin.Matching"),d.mixin(n.prototype,"Mixin.Updating"),f=a("./Metrics"),g=a("./KeyValueStore"),h=a("./Path"),i=a("./IndexHashMap"),j=a("./IndexBinaryTree"),k=a("./Crc"),e=d.modules.Db,l=a("./Overload"),m=a("./ReactorIO"),n.prototype.crc=k,d.synthesize(n.prototype,"state"),d.synthesize(n.prototype,"name"),n.prototype.data=function(){return this._data},n.prototype.drop=function(a){var b;if("dropped"===this._state)return a&&a(!1,!0),!0;if(this._db&&this._db._collection&&this._name){if(this.debug()&&console.log("Dropping collection "+this._name),this._state="dropped",this.emit("drop",this),delete this._db._collection[this._name],this._collate)for(b in this._collate)this._collate.hasOwnProperty(b)&&this.collateRemove(b);return delete this._primaryKey,delete this._primaryIndex,delete this._primaryCrc,delete this._crcLookup,delete this._name,delete this._data,delete this._metrics,a&&a(!1,!0),!0}return a&&a(!1,!0),!1},n.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey!==a&&(this._primaryKey=a,this._primaryIndex.primaryKey(a),this.rebuildPrimaryKeyIndex()),this):this._primaryKey},n.prototype._onInsert=function(a,b){this.emit("insert",a,b)},n.prototype._onUpdate=function(a){this.emit("update",a)},n.prototype._onRemove=function(a){this.emit("remove",a)},d.synthesize(n.prototype,"db",function(a){return a&&"_id"===this.primaryKey()&&this.primaryKey(a.primaryKey()),this.$super.apply(this,arguments)}),n.prototype.setData=function(a,b,c){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';if(a){var d=this._metrics.create("setData");d.start(),b=this.options(b),this.preSetData(a,b,c),b.$decouple&&(a=this.decouple(a)),a instanceof Array||(a=[a]),d.time("transformIn"),a=this.transformIn(a),d.time("transformIn");var e=[].concat(this._data);this._dataReplace(a),d.time("Rebuild Primary Key Index"),this.rebuildPrimaryKeyIndex(b),d.time("Rebuild Primary Key Index"),d.time("Rebuild All Other Indexes"),this._rebuildIndexes(),d.time("Rebuild All Other Indexes"),d.time("Resolve chains"),this.chainSend("setData",a,{oldData:e}),d.time("Resolve chains"),d.stop(),this.emit("setData",this._data,e)}return c&&c(!1),this},n.prototype.rebuildPrimaryKeyIndex=function(a){a=a||{$ensureKeys:void 0,$violationCheck:void 0};var b,c,d,e,f=a&&void 0!==a.$ensureKeys?a.$ensureKeys:!0,g=a&&void 0!==a.$violationCheck?a.$violationCheck:!0,h=this._primaryIndex,i=this._primaryCrc,j=this._crcLookup,k=this._primaryKey;for(h.truncate(),i.truncate(),j.truncate(),b=this._data,c=b.length;c--;){if(d=b[c],f&&this.ensurePrimaryKey(d),g){if(!h.uniqueSet(d[k],d))throw'ForerunnerDB.Collection "'+this.name()+'": Call to setData on collection failed because your data violates the primary key unique constraint. One or more documents are using the same primary key: '+d[this._primaryKey]}else h.set(d[k],d);e=JSON.stringify(d),i.set(d[k],e),j.set(e,d)}},n.prototype.ensurePrimaryKey=function(a){void 0===a[this._primaryKey]&&(a[this._primaryKey]=this.objectId())},n.prototype.truncate=function(){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';return this.emit("truncate",this._data),this._data.length=0,this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this.deferEmit("change",{type:"truncate"}),this},n.prototype.upsert=function(a,b){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';if(a){var c,d,e=this._deferQueue.upsert,f=this._deferThreshold.upsert,g={};if(a instanceof Array){if(a.length>f)return this._deferQueue.upsert=e.concat(a),this.processQueue("upsert",b),{};for(g=[],d=0;d<a.length;d++)g.push(this.upsert(a[d]));return b&&b(),g}switch(a[this._primaryKey]?(c={},c[this._primaryKey]=a[this._primaryKey],this._primaryIndex.lookup(c)[0]?g.op="update":g.op="insert"):g.op="insert",g.op){case"insert":g.result=this.insert(a);break;case"update":g.result=this.update(c,a)}return g}return b&&b(),{}},n.prototype.update=function(a,b,c){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';b=this.decouple(b),b=this.transformIn(b),this.debug()&&console.log('Updating some collection data for collection "'+this.name()+'"');var d,e,f=this,g=this._metrics.create("update"),h=function(d){var e,h,i=f.decouple(d);return f.willTrigger(f.TYPE_UPDATE,f.PHASE_BEFORE)||f.willTrigger(f.TYPE_UPDATE,f.PHASE_AFTER)?(e={type:"update",query:f.decouple(a),update:f.decouple(b),options:f.decouple(c),op:g},h=f.updateObject(i,e.update,e.query,e.options,""),f.processTrigger(e,f.TYPE_UPDATE,f.PHASE_BEFORE,d,i)!==!1?(h=f.updateObject(d,i,e.query,e.options,""),f.processTrigger(e,f.TYPE_UPDATE,f.PHASE_AFTER,d,i)):h=!1):h=f.updateObject(d,b,a,c,""),h};return g.start(),g.time("Retrieve documents to update"),d=this.find(a,{$decouple:!1}),g.time("Retrieve documents to update"),d.length&&(g.time("Update documents"),e=d.filter(h),g.time("Update documents"),e.length&&(g.time("Resolve chains"),this.chainSend("update",{query:a,update:b,dataSet:d},c),g.time("Resolve chains"),this._onUpdate(e),this.deferEmit("change",{type:"update",data:e}))),g.stop(),e||[]},n.prototype._replaceObj=function(a,b){var c;this._removeFromIndexes(a);for(c in a)a.hasOwnProperty(c)&&delete a[c];for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);if(!this._insertIntoIndexes(a))throw'ForerunnerDB.Collection "'+this.name()+'": Primary key violation in update! Key violated: '+a[this._primaryKey];return!0},n.prototype.updateById=function(a,b){var c={};return c[this._primaryKey]=a,this.update(c,b)},n.prototype.updateObject=function(a,b,c,d,e,f){b=this.decouple(b),e=e||"","."===e.substr(0,1)&&(e=e.substr(1,e.length-1));var g,i,j,k,l,m,n,o,p,q=!1,r=!1;for(p in b)if(b.hasOwnProperty(p)){if(g=!1,"$"===p.substr(0,1))switch(p){case"$key":case"$index":case"$data":g=!0;break;case"$each":for(g=!0,k=b.$each.length,j=0;k>j;j++)r=this.updateObject(a,b.$each[j],c,d,e),r&&(q=!0);q=q||r;break;default:g=!0,r=this.updateObject(a,b[p],c,d,e,p),q=q||r}if(this._isPositionalKey(p)&&(g=!0,p=p.substr(0,p.length-2),m=new h(e+"."+p),a[p]&&a[p]instanceof Array&&a[p].length)){for(i=[],j=0;j<a[p].length;j++)this._match(a[p][j],m.value(c)[0],"",{})&&i.push(j);for(j=0;j<i.length;j++)r=this.updateObject(a[p][i[j]],b[p+".$"],c,d,e+"."+p,f),q=q||r}if(!g)if(f||"object"!=typeof b[p])switch(f){case"$inc":this._updateIncrement(a,p,b[p]),q=!0;break;case"$cast":switch(b[p]){case"array":a[p]instanceof Array||(this._updateProperty(a,p,b.$data||[]),q=!0);break;case"object":(!(a[p]instanceof Object)||a[p]instanceof Array)&&(this._updateProperty(a,p,b.$data||{}),q=!0);break;case"number":"number"!=typeof a[p]&&(this._updateProperty(a,p,Number(a[p])),q=!0);break;case"string":"string"!=typeof a[p]&&(this._updateProperty(a,p,String(a[p])),q=!0);break;default:throw'ForerunnerDB.Collection "'+this.name()+'": Cannot update cast to unknown type: '+b[p]}break;case"$push":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot push to a key that is not an array! ('+p+")";if(void 0!==b[p].$position&&b[p].$each instanceof Array)for(l=b[p].$position,k=b[p].$each.length,j=0;k>j;j++)this._updateSplicePush(a[p],l+j,b[p].$each[j]);else if(b[p].$each instanceof Array)for(k=b[p].$each.length,j=0;k>j;j++)this._updatePush(a[p],b[p].$each[j]);else this._updatePush(a[p],b[p]);q=!0;break;case"$pull":if(a[p]instanceof Array){for(i=[],j=0;j<a[p].length;j++)this._match(a[p][j],b[p],"",{})&&i.push(j);for(k=i.length;k--;)this._updatePull(a[p],i[k]),q=!0}break;case"$pullAll":if(a[p]instanceof Array){if(!(b[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot pullAll without being given an array of values to pull! ('+p+")";if(i=a[p],k=i.length,k>0)for(;k--;){for(l=0;l<b[p].length;l++)i[k]===b[p][l]&&(this._updatePull(a[p],k),k--,q=!0);if(0>k)break}}break;case"$addToSet":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot addToSet on a key that is not an array! ('+p+")";var s,t,u,v,w=a[p],x=w.length,y=!0,z=d&&d.$addToSet;for(b[p].$key?(u=!1,v=new h(b[p].$key),t=v.value(b[p])[0],delete b[p].$key):z&&z.key?(u=!1,v=new h(z.key),t=v.value(b[p])[0]):(t=JSON.stringify(b[p]),u=!0),s=0;x>s;s++)if(u){if(JSON.stringify(w[s])===t){y=!1;break}}else if(t===v.value(w[s])[0]){y=!1;break}y&&(this._updatePush(a[p],b[p]),q=!0);break;case"$splicePush":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot splicePush with a key that is not an array! ('+p+")";if(l=b.$index,void 0===l)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot splicePush without a $index integer value!';delete b.$index,l>a[p].length&&(l=a[p].length),this._updateSplicePush(a[p],l,b[p]),q=!0;break;case"$move":if(!(a[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot move on a key that is not an array! ('+p+")";for(j=0;j<a[p].length;j++)if(this._match(a[p][j],b[p],"",{})){var A=b.$index;if(void 0===A)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot move without a $index integer value!';delete b.$index,this._updateSpliceMove(a[p],j,A),q=!0;break}break;case"$mul":this._updateMultiply(a,p,b[p]),q=!0;break;case"$rename":this._updateRename(a,p,b[p]),q=!0;break;case"$overwrite":this._updateOverwrite(a,p,b[p]),q=!0;break;case"$unset":this._updateUnset(a,p),q=!0;break;case"$clear":this._updateClear(a,p),q=!0;break;case"$pop":if(!(a[p]instanceof Array))throw'ForerunnerDB.Collection "'+this.name()+'": Cannot pop from a key that is not an array! ('+p+")";this._updatePop(a[p],b[p])&&(q=!0);break;default:a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0)}else if(null!==a[p]&&"object"==typeof a[p])if(n=a[p]instanceof Array,o=b[p]instanceof Array,n||o)if(!o&&n)for(j=0;j<a[p].length;j++)r=this.updateObject(a[p][j],b[p],c,d,e+"."+p,f),q=q||r;else a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0);else r=this.updateObject(a[p],b[p],c,d,e+"."+p,f),q=q||r;else a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0)}return q},n.prototype._isPositionalKey=function(a){return".$"===a.substr(a.length-2,2)},n.prototype.remove=function(a,b,c){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';var d,e,f,g,h,i,j,k,l=this;if(a instanceof Array){for(g=[],f=0;f<a.length;f++)g.push(this.remove(a[f],{noEmit:!0}));return(!b||b&&!b.noEmit)&&this._onRemove(g),c&&c(!1,g),g}if(d=this.find(a,{$decouple:!1}),d.length){h=function(a){l._removeFromIndexes(a),e=l._data.indexOf(a),l._dataRemoveAtIndex(e)};for(var m=0;m<d.length;m++)j=d[m],l.willTrigger(l.TYPE_REMOVE,l.PHASE_BEFORE)||l.willTrigger(l.TYPE_REMOVE,l.PHASE_AFTER)?(i={type:"remove"},k=l.decouple(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_BEFORE,k,k)!==!1&&(h(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_AFTER,k,k))):h(j);this.chainSend("remove",{query:a,dataSet:d},b),(!b||b&&!b.noEmit)&&this._onRemove(d),this.deferEmit("change",{type:"remove",data:d})}return c&&c(!1,d),d},n.prototype.removeById=function(a){var b={};return b[this._primaryKey]=a,this.remove(b)},n.prototype.deferEmit=function(){var a,b=this;this._noEmitDefer||this._db&&(!this._db||this._db._noEmitDefer)?this.emit.apply(this,arguments):(a=arguments,this._changeTimeout&&clearTimeout(this._changeTimeout),this._changeTimeout=setTimeout(function(){b.debug()&&console.log("ForerunnerDB.Collection: Emitting "+a[0]),b.emit.apply(b,a)},100))},n.prototype.processQueue=function(a,b){var c=this._deferQueue[a],d=this._deferThreshold[a],e=this._deferTime[a];if(c.length){var f,g=this;c.length&&(f=c.length>d?c.splice(0,d):c.splice(0,c.length),this[a](f)),setTimeout(function(){g.processQueue(a,b)},e)}else b&&b()},n.prototype.insert=function(a,b,c){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';return"function"==typeof b?(c=b,b=this._data.length):void 0===b&&(b=this._data.length),a=this.transformIn(a),this._insertHandle(a,b,c)},n.prototype._insertHandle=function(a,b,c){var d,e,f=this._deferQueue.insert,g=this._deferThreshold.insert,h=[],i=[];if(a instanceof Array){if(a.length>g)return this._deferQueue.insert=f.concat(a),void this.processQueue("insert",c);for(e=0;e<a.length;e++)d=this._insert(a[e],b+e),d===!0?h.push(a[e]):i.push({doc:a[e],reason:d})}else d=this._insert(a,b),d===!0?h.push(a):i.push({doc:a,reason:d});return this.chainSend("insert",a,{index:b}),this._onInsert(h,i),c&&c(),this.deferEmit("change",{type:"insert",data:h}),{inserted:h,failed:i}},n.prototype._insert=function(a,b){if(a){var c,d,e,f,g=this;if(this.ensurePrimaryKey(a),c=this.insertIndexViolation(a),e=function(a){g._insertIntoIndexes(a),b>g._data.length&&(b=g._data.length),g._dataInsertAtIndex(b,a)},c)return"Index violation in index: "+c;if(g.willTrigger(g.TYPE_INSERT,g.PHASE_BEFORE)||g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)){if(d={type:"insert"},g.processTrigger(d,g.TYPE_INSERT,g.PHASE_BEFORE,{},a)===!1)return!1;e(a),g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)&&(f=g.decouple(a),g.processTrigger(d,g.TYPE_INSERT,g.PHASE_AFTER,{},f))}else e(a);return!0}return"No document passed to insert"},n.prototype._dataInsertAtIndex=function(a,b){this._data.splice(a,0,b)},n.prototype._dataRemoveAtIndex=function(a){this._data.splice(a,1)},n.prototype._dataReplace=function(a){for(;this._data.length;)this._data.pop();this._data=this._data.concat(a)},n.prototype._insertIntoIndexes=function(a){var b,c,d=this._indexByName,e=JSON.stringify(a);c=this._primaryIndex.uniqueSet(a[this._primaryKey],a),this._primaryCrc.uniqueSet(a[this._primaryKey],e),this._crcLookup.uniqueSet(e,a);for(b in d)d.hasOwnProperty(b)&&d[b].insert(a);return c},n.prototype._removeFromIndexes=function(a){var b,c=this._indexByName,d=JSON.stringify(a);this._primaryIndex.unSet(a[this._primaryKey]),this._primaryCrc.unSet(a[this._primaryKey]),this._crcLookup.unSet(d);for(b in c)c.hasOwnProperty(b)&&c[b].remove(a)},n.prototype._rebuildIndexes=function(){var a,b=this._indexByName;for(a in b)b.hasOwnProperty(a)&&b[a].rebuild()},n.prototype.indexOfDocById=function(a){return this._data.indexOf(this._primaryIndex.get(a[this._primaryKey]))},n.prototype.subset=function(a,b){var c=this.find(a,b);return(new n)._subsetOf(this).primaryKey(this._primaryKey).setData(c)},n.prototype.subsetOf=function(){return this.__subsetOf},n.prototype._subsetOf=function(a){return this.__subsetOf=a,this},n.prototype.distinct=function(a,b,c){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';var d,e,f=this.find(b,c),g=new h(a),i={},j=[];for(e=0;e<f.length;e++)d=g.value(f[e])[0],d&&!i[d]&&(i[d]=!0,j.push(d));return j},n.prototype.findById=function(a,b){var c={};return c[this._primaryKey]=a,this.find(c,b)[0]},n.prototype.peek=function(a,b){var c,d,e=this._data,f=e.length,g=new n,h=typeof a;if("string"===h){for(c=0;f>c;c++)d=JSON.stringify(e[c]),d.indexOf(a)>-1&&g.insert(e[c]);return g.find({},b)}return this.find(a,b)},n.prototype.explain=function(a,b){var c=this.find(a,b);return c.__fdbOp._data},n.prototype.options=function(a){return a=a||{},a.$decouple=void 0!==a.$decouple?a.$decouple:!0,a.$explain=void 0!==a.$explain?a.$explain:!1,a},n.prototype.find=function(a,b){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';a=a||{},b=this.options(b);var c,d,e,f,g,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C=this._metrics.create("find"),D=this.primaryKey(),E=this,F=!0,G={},H=[],I=[],J=[],K={},L=function(b){return E._match(b,a,"and",K)};if(C.start(),a){if(C.time("analyseQuery"),c=this._analyseQuery(a,b,C),C.time("analyseQuery"),C.data("analysis",c),c.hasJoin&&c.queriesJoin){for(C.time("joinReferences"),g=0;g<c.joinsOn.length;g++)k=c.joinsOn[g],j=new h(c.joinQueries[k]),i=j.value(a)[0],G[c.joinsOn[g]]=this._db.collection(c.joinsOn[g]).subset(i);C.time("joinReferences")}if(c.indexMatch.length&&(!b||b&&!b.$skipIndex)?(C.data("index.potential",c.indexMatch),C.data("index.used",c.indexMatch[0].index),C.time("indexLookup"),e=c.indexMatch[0].lookup,C.time("indexLookup"),c.indexMatch[0].keyData.totalKeyCount===c.indexMatch[0].keyData.score&&(F=!1)):C.flag("usedIndex",!1),F&&(e&&e.length?(d=e.length,C.time("tableScan: "+d),e=e.filter(L)):(d=this._data.length,C.time("tableScan: "+d),e=this._data.filter(L)),b.$orderBy&&(C.time("sort"),e=this.sort(b.$orderBy,e),C.time("sort")),C.time("tableScan: "+d)),b.$limit&&e&&e.length>b.$limit&&(e.length=b.$limit,C.data("limit",b.$limit)),b.$decouple&&(C.time("decouple"),e=this.decouple(e),C.time("decouple"),C.data("flag.decouple",!0)),b.$join){for(f=0;f<b.$join.length;f++)for(k in b.$join[f])if(b.$join[f].hasOwnProperty(k))for(s=k,l=this._db.collection(k),m=b.$join[f][k],t=0;t<e.length;t++){o={},p=!1,q=!1;for(n in m)if(m.hasOwnProperty(n))if("$"===n.substr(0,1))switch(n){case"$as":s=m[n];break;case"$multi":p=m[n];break;case"$require":q=m[n]}else o[n]=new h(m[n]).value(e[t])[0];r=l.find(o),!q||q&&r[0]?e[t][s]=p===!1?r[0]:r:H.push(e[t])}C.data("flag.join",!0)}if(H.length){for(C.time("removalQueue"),v=0;v<H.length;v++)u=e.indexOf(H[v]),u>-1&&e.splice(u,1);C.time("removalQueue")}if(b.$transform){for(C.time("transform"),v=0;v<e.length;v++)e.splice(v,1,b.$transform(e[v]));C.time("transform"),C.data("flag.transform",!0)}this._transformEnabled&&this._transformOut&&(C.time("transformOut"),e=this.transformOut(e),C.time("transformOut")),C.data("results",e.length)}else e=[];C.time("scanFields");for(v in b)b.hasOwnProperty(v)&&0!==v.indexOf("$")&&(1===b[v]?I.push(v):0===b[v]&&J.push(v));if(C.time("scanFields"),I.length||J.length){for(C.data("flag.limitFields",!0),C.data("limitFields.on",I),C.data("limitFields.off",J),C.time("limitFields"),v=0;v<e.length;v++){B=e[v];for(w in B)B.hasOwnProperty(w)&&(I.length&&w!==D&&-1===I.indexOf(w)&&delete B[w],J.length&&J.indexOf(w)>-1&&delete B[w])}C.time("limitFields")}if(b.$elemMatch){C.data("flag.elemMatch",!0),C.time("projection-elemMatch");for(v in b.$elemMatch)if(b.$elemMatch.hasOwnProperty(v))for(y=new h(v),w=0;w<e.length;w++)if(z=y.value(e[w])[0],z&&z.length)for(x=0;x<z.length;x++)if(E._match(z[x],b.$elemMatch[v],"",{})){y.set(e[w],v,[z[x]]);break}C.time("projection-elemMatch")}if(b.$elemsMatch){C.data("flag.elemsMatch",!0),C.time("projection-elemsMatch");for(v in b.$elemsMatch)if(b.$elemsMatch.hasOwnProperty(v))for(y=new h(v),w=0;w<e.length;w++)if(z=y.value(e[w])[0],z&&z.length){for(A=[],x=0;x<z.length;x++)E._match(z[x],b.$elemsMatch[v],"",{})&&A.push(z[x]);y.set(e[w],v,A)}C.time("projection-elemsMatch")}return C.stop(),e.__fdbOp=C,e},n.prototype.findOne=function(){return this.find.apply(this,arguments)[0]},n.prototype.indexOf=function(a){var b=this.find(a,{$decouple:!1})[0];return b?this._data.indexOf(b):void 0},n.prototype.transform=function(a){return void 0!==a?("object"==typeof a?(void 0!==a.enabled&&(this._transformEnabled=a.enabled),void 0!==a.dataIn&&(this._transformIn=a.dataIn),void 0!==a.dataOut&&(this._transformOut=a.dataOut)):this._transformEnabled=a!==!1,this):{enabled:this._transformEnabled,dataIn:this._transformIn,dataOut:this._transformOut}},n.prototype.transformIn=function(a){if(this._transformEnabled&&this._transformIn){if(a instanceof Array){var b,c=[];for(b=0;b<a.length;b++)c[b]=this._transformIn(a[b]);return c}return this._transformIn(a)}return a},n.prototype.transformOut=function(a){if(this._transformEnabled&&this._transformOut){if(a instanceof Array){var b,c=[];for(b=0;b<a.length;b++)c[b]=this._transformOut(a[b]);return c}return this._transformOut(a)}return a},n.prototype.sort=function(a,b){b=b||[];var c,d,e=[];for(c in a)a.hasOwnProperty(c)&&(d={},d[c]=a[c],d.___fdbKey=c,e.push(d));return e.length<2?this._sort(a,b):this._bucketSort(e,b)},n.prototype._bucketSort=function(a,b){var c,d,e,f=a.shift(),g=[];if(a.length>0){b=this._sort(f,b),d=this.bucket(f.___fdbKey,b);for(e in d)d.hasOwnProperty(e)&&(c=[].concat(a),g=g.concat(this._bucketSort(c,d[e])));return g}return this._sort(f,b)},n.prototype._sort=function(a,b){var c,d=this,e=new h,f=e.parse(a,!0)[0];if(e.path(f.path),1===f.value)c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortAsc(c,f)};else{if(-1!==f.value)throw'ForerunnerDB.Collection "'+this.name()+'": $orderBy clause has invalid direction: '+f.value+", accepted values are 1 or -1 for ascending or descending!";c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortDesc(c,f)}}return b.sort(c)},n.prototype.bucket=function(a,b){var c,d={};for(c=0;c<b.length;c++)d[b[c][a]]=d[b[c][a]]||[],d[b[c][a]].push(b[c]);return d},n.prototype._analyseQuery=function(a,b,c){var d,e,f,g,i,j,k,l,m,n,o,p={queriesOn:[this._name],indexMatch:[],hasJoin:!1,queriesJoin:!1,joinQueries:{},query:a,options:b},q=[],r=[];if(c.time("checkIndexes"),m=new h,n=m.countKeys(a)){void 0!==a[this._primaryKey]&&(c.time("checkIndexMatch: Primary Key"),p.indexMatch.push({lookup:this._primaryIndex.lookup(a,b),keyData:{matchedKeys:[this._primaryKey],totalKeyCount:n,score:1},index:this._primaryIndex}),c.time("checkIndexMatch: Primary Key"));for(o in this._indexById)if(this._indexById.hasOwnProperty(o)&&(j=this._indexById[o],k=j.name(),c.time("checkIndexMatch: "+k),i=j.match(a,b),i.score>0&&(l=j.lookup(a,b),p.indexMatch.push({lookup:l,keyData:i,index:j})),c.time("checkIndexMatch: "+k),i.score===n))break;c.time("checkIndexes"),p.indexMatch.length>1&&(c.time("findOptimalIndex"),p.indexMatch.sort(function(a,b){return a.keyData.score>b.keyData.score?-1:a.keyData.score<b.keyData.score?1:a.keyData.score===b.keyData.score?a.lookup.length-b.lookup.length:void 0}),c.time("findOptimalIndex"))}if(b.$join){for(p.hasJoin=!0,d=0;d<b.$join.length;d++)for(e in b.$join[d])b.$join[d].hasOwnProperty(e)&&(q.push(e),r.push("$as"in b.$join[d][e]?b.$join[d][e].$as:e));for(g=0;g<r.length;g++)f=this._queryReferencesCollection(a,r[g],""),f&&(p.joinQueries[q[g]]=f,p.queriesJoin=!0);p.joinsOn=q,p.queriesOn=p.queriesOn.concat(q)}return p},n.prototype._queryReferencesCollection=function(a,b,c){var d;for(d in a)if(a.hasOwnProperty(d)){if(d===b)return c&&(c+="."),c+d;if("object"==typeof a[d])return c&&(c+="."),c+=d,this._queryReferencesCollection(a[d],b,c)}return!1},n.prototype.count=function(a,b){return a?this.find(a,b).length:this._data.length},n.prototype.findSub=function(a,b,c,d){var e,f,g,i=new h(b),j=this.find(a),k=j.length,l=this._db.collection("__FDB_temp_"+this.objectId()),m={parents:k,subDocTotal:0,subDocs:[],pathFound:!1,err:""};for(e=0;k>e;e++)if(f=i.value(j[e])[0]){if(l.setData(f),g=l.find(c,d),d.returnFirst&&g.length)return g[0];m.subDocs.push(g),m.subDocTotal+=g.length,m.pathFound=!0}return l.drop(),d.noStats?m.subDocs:(m.pathFound||(m.err="No objects found in the parent documents with a matching path of: "+b),m)},n.prototype.insertIndexViolation=function(a){var b,c,d,e=this._indexByName;if(this._primaryIndex.get(a[this._primaryKey]))b=this._primaryIndex;else for(c in e)if(e.hasOwnProperty(c)&&(d=e[c],d.unique()&&d.violation(a))){b=d;break}return b?b.name():!1},n.prototype.ensureIndex=function(a,b){if("dropped"===this._state)throw'ForerunnerDB.Collection "'+this.name()+'": Cannot operate in a dropped state!';this._indexByName=this._indexByName||{},this._indexById=this._indexById||{};var c,d={start:(new Date).getTime()};if(b)switch(b.type){case"hashed":c=new i(a,b,this);break;case"btree":c=new j(a,b,this);break;default:c=new i(a,b,this)}else c=new i(a,b,this);return this._indexByName[c.name()]?{err:"Index with that name already exists"}:this._indexById[c.id()]?{err:"Index with those keys already exists"}:(c.rebuild(),this._indexByName[c.name()]=c,this._indexById[c.id()]=c,d.end=(new Date).getTime(),d.total=d.end-d.start,this._lastOp={type:"ensureIndex",stats:{time:d}},{index:c,id:c.id(),name:c.name(),state:c.state()})},n.prototype.index=function(a){return this._indexByName?this._indexByName[a]:void 0},n.prototype.lastOp=function(){return this._metrics.list()},n.prototype.diff=function(a){var b,c,d,e,f={insert:[],update:[],remove:[]},g=this.primaryKey();if(g!==a.primaryKey())throw'ForerunnerDB.Collection "'+this.name()+'": Collection diffing requires that both collections have the same primary key!';for(b=a._data;b&&!(b instanceof Array);)a=b,b=a._data;for(e=b.length,c=0;e>c;c++)d=b[c],this._primaryIndex.get(d[g])?this._primaryCrc.get(d[g])!==a._primaryCrc.get(d[g])&&f.update.push(d):f.insert.push(d);for(b=this._data,e=b.length,c=0;e>c;c++)d=b[c],a._primaryIndex.get(d[g])||f.remove.push(d);return f},n.prototype.collateAdd=new l({"object, string":function(a,b){var c=this;c.collateAdd(a,function(d){var e,f;switch(d.type){case"insert":e={$push:{}},e.$push[b]=c.decouple(d.data),c.update({},e);break;case"update":e={},f={},e[b]=d.data.query,f[b+".$"]=d.data.update,c.update(e,f);break;case"remove":e={$pull:{}},e.$pull[b]={},e.$pull[b][c.primaryKey()]=d.data.dataSet[0][a.primaryKey()],c.update({},e)}})},"object, function":function(a,b){if("string"==typeof a&&(a=this._db.collection(a,{autoCreate:!1,throwError:!1})),a)return this._collate=this._collate||{},this._collate[a.name()]=new m(a,this,b),this;throw"Cannot collate from a non-existent collection!"}}),n.prototype.collateRemove=function(a){if("object"==typeof a&&(a=a.name()),a)return this._collate[a].drop(),delete this._collate[a],this;throw"No collection name passed to collateRemove() or collection not found!"},e.prototype.collection=new l({object:function(a){return this.$main.call(this,a)},string:function(a){return this.$main.call(this,{name:a})},"string, string":function(a,b){return this.$main.call(this,{name:a,primaryKey:b})},"string, object":function(a,b){return b.name=a,this.$main.call(this,b)},"string, string, object":function(a,b,c){return c.name=a,c.primaryKey=b,this.$main.call(this,c)},$main:function(a){var b=a.name;if(b){if(!this._collection[b]){if(a&&a.autoCreate===!1&&a&&a.throwError!==!1)throw'ForerunnerDB.Db "'+this.name()+'": Cannot get collection '+b+" because it does not exist and auto-create has been disabled!";this.debug()&&console.log("Creating collection "+b)}return this._collection[b]=this._collection[b]||new n(b).db(this),void 0!==a.primaryKey&&this._collection[b].primaryKey(a.primaryKey),this._collection[b]}if(!a||a&&a.throwError!==!1)throw'ForerunnerDB.Db "'+this.name()+'": Cannot get collection with undefined name!'}}),e.prototype.collectionExists=function(a){return Boolean(this._collection[a])},e.prototype.collections=function(a){var b,c=[];a&&(a instanceof RegExp||(a=new RegExp(a)));for(b in this._collection)this._collection.hasOwnProperty(b)&&(a?a.exec(b)&&c.push({name:b,count:this._collection[b].count()}):c.push({name:b,count:this._collection[b].count()}));return c.sort(function(a,b){return a.name.localeCompare(b.name)}),c},d.finishModule("Collection"),b.exports=n},{"./Crc":4,"./IndexBinaryTree":6,"./IndexHashMap":7,"./KeyValueStore":8,"./Metrics":9,"./Overload":20,"./Path":21,"./ReactorIO":22,"./Shared":23}],3:[function(a,b,c){"use strict";var d,e,f,g;d=a("./Shared"),g=a("./Overload");var h=function(a){this.init.apply(this,arguments)};h.prototype.init=function(){this._db={},this._debug={}},h.prototype.moduleLoaded=new g({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");var b,c=a.split(",");for(b=0;b<c.length;b++)if(!d.modules[c[b]])return!1;return!0}return!1},"string, function":function(a,b){if(void 0!==a){a=a.replace(/ /g,"");var c,e=a.split(",");for(c=0;c<e.length;c++)if(!d.modules[e[c]])return!1;b()}},"string, function, function":function(a,b,c){if(void 0!==a){a=a.replace(/ /g,"");var e,f=a.split(",");for(e=0;e<f.length;e++)if(!d.modules[f[e]])return c(),!1;b()}}}),h.prototype.version=function(a,b){return void 0!==a?0===d.version.indexOf(a)?(b&&b(),!0):!1:d.version},h.moduleLoaded=h.prototype.moduleLoaded,h.version=h.prototype.version,h.shared=d,h.prototype.shared=d,d.addModule("Core",h),d.mixin(h.prototype,"Mixin.Common"),d.mixin(h.prototype,"Mixin.Constants"),e=a("./Db.js"),f=a("./Metrics.js"),h.prototype._isServer=!1,h.prototype.isClient=function(){return!this._isServer},h.prototype.isServer=function(){return this._isServer},h.prototype.isClient=function(){return!this._isServer},h.prototype.isServer=function(){return this._isServer},h.prototype.collection=function(){throw"ForerunnerDB's instantiation has changed since version 1.3.36 to support multiple database instances. Please see the readme.md file for the minor change you have to make to get your project back up and running, or see the issue related to this change at https://github.com/Irrelon/ForerunnerDB/issues/44"},b.exports=h},{"./Db.js":5,"./Metrics.js":9,"./Overload":20,"./Shared":23}],4:[function(a,b,c){"use strict";var d=function(){var a,b,c,d=[];for(b=0;256>b;b++){for(a=b,c=0;8>c;c++)a=1&a?3988292384^a>>>1:a>>>1;d[b]=a}return d}();b.exports=function(a){var b,c=-1;for(b=0;b<a.length;b++)c=c>>>8^d[255&(c^a.charCodeAt(b))];return(-1^c)>>>0}},{}],5:[function(a,b,c){"use strict";var d,e,f,g,h,i;d=a("./Shared"),i=a("./Overload");var j=function(a){this.init.apply(this,arguments)};j.prototype.init=function(a){this._primaryKey="_id",this._name=a,this._collection={},this._debug={}},j.prototype.moduleLoaded=new i({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");var b,c=a.split(",");for(b=0;b<c.length;b++)if(!d.modules[c[b]])return!1;return!0}return!1},"string, function":function(a,b){if(void 0!==a){a=a.replace(/ /g,"");var c,e=a.split(",");for(c=0;c<e.length;c++)if(!d.modules[e[c]])return!1;b()}},"string, function, function":function(a,b,c){if(void 0!==a){a=a.replace(/ /g,"");var e,f=a.split(",");for(e=0;e<f.length;e++)if(!d.modules[f[e]])return c(),!1;b()}}}),j.prototype.version=function(a,b){return void 0!==a?0===d.version.indexOf(a)?(b&&b(),!0):!1:d.version},j.moduleLoaded=j.prototype.moduleLoaded,j.version=j.prototype.version,j.shared=d,j.prototype.shared=d,d.addModule("Db",j),d.mixin(j.prototype,"Mixin.Common"),d.mixin(j.prototype,"Mixin.ChainReactor"),d.mixin(j.prototype,"Mixin.Constants"),e=d.modules.Core,f=a("./Collection.js"),g=a("./Metrics.js"),h=a("./Crc.js"),j.prototype._isServer=!1,d.synthesize(j.prototype,"core"),d.synthesize(j.prototype,"primaryKey"),d.synthesize(j.prototype,"state"),d.synthesize(j.prototype,"name"),j.prototype.isClient=function(){return!this._isServer},j.prototype.isServer=function(){return this._isServer},j.prototype.crc=h,j.prototype.isClient=function(){return!this._isServer},j.prototype.isServer=function(){return this._isServer},j.prototype.arrayToCollection=function(a){ return(new f).setData(a)},j.prototype.on=function(a,b){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||[],this._listeners[a].push(b),this},j.prototype.off=function(a,b){if(a in this._listeners){var c=this._listeners[a],d=c.indexOf(b);d>-1&&c.splice(d,1)}return this},j.prototype.emit=function(a,b){if(this._listeners=this._listeners||{},a in this._listeners){var c,d=this._listeners[a],e=d.length;for(c=0;e>c;c++)d[c].apply(this,Array.prototype.slice.call(arguments,1))}return this},j.prototype.peek=function(a){var b,c,d=[],e=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],d=d.concat("string"===e?c.peek(a):c.find(a)));return d},j.prototype.peekCat=function(a){var b,c,d,e={},f=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],"string"===f?(d=c.peek(a),d&&d.length&&(e[c.name()]=d)):(d=c.find(a),d&&d.length&&(e[c.name()]=d)));return e},j.prototype.drop=new i({"":function(){if("dropped"!==this._state){var a,b=this.collections(),c=b.length;for(this._state="dropped",a=0;c>a;a++)this.collection(b[a].name).drop(),delete this._collection[b[a].name];this.emit("drop",this),delete this._core._db[this._name]}return!0},"function":function(a){if("dropped"!==this._state){var b,c=this.collections(),d=c.length,e=0,f=function(){e++,e===d&&a&&a()};for(this._state="dropped",b=0;d>b;b++)this.collection(c[b].name).drop(f),delete this._collection[c[b].name];this.emit("drop",this),delete this._core._db[this._name]}return!0},"boolean":function(a){if("dropped"!==this._state){var b,c=this.collections(),d=c.length;for(this._state="dropped",b=0;d>b;b++)this.collection(c[b].name).drop(a),delete this._collection[c[b].name];this.emit("drop",this),delete this._core._db[this._name]}return!0},"boolean, function":function(a,b){if("dropped"!==this._state){var c,d=this.collections(),e=d.length,f=0,g=function(){f++,f===e&&b&&b()};for(this._state="dropped",c=0;e>c;c++)this.collection(d[c].name).drop(a,g),delete this._collection[d[c].name];this.emit("drop",this),delete this._core._db[this._name]}return!0}}),e.prototype.db=function(a){return a||(a=this.objectId()),this._db[a]=this._db[a]||new j(a).core(this),this._db[a]},e.prototype.databases=function(a){var b,c=[];a&&(a instanceof RegExp||(a=new RegExp(a)));for(b in this._db)this._db.hasOwnProperty(b)&&(a?a.exec(b)&&c.push({name:b,collectionCount:this._db[b].collections().length}):c.push({name:b,collectionCount:this._db[b].collections().length}));return c.sort(function(a,b){return a.name.localeCompare(b.name)}),c},b.exports=j},{"./Collection.js":2,"./Crc.js":4,"./Metrics.js":9,"./Overload":20,"./Shared":23}],6:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(){},g=function(){this.init.apply(this,arguments)};g.prototype.init=function(a,b,c){this._btree=new(f.create(2,this.sortAsc)),this._size=0,this._id=this._itemKeyHash(a,a),this.unique(b&&b.unique?b.unique:!1),void 0!==a&&this.keys(a),void 0!==c&&this.collection(c),this.name(b&&b.name?b.name:this._id)},d.addModule("IndexBinaryTree",g),d.mixin(g.prototype,"Mixin.ChainReactor"),d.mixin(g.prototype,"Mixin.Sorting"),g.prototype.id=function(){return this._id},g.prototype.state=function(){return this._state},g.prototype.size=function(){return this._size},d.synthesize(g.prototype,"data"),d.synthesize(g.prototype,"name"),d.synthesize(g.prototype,"collection"),d.synthesize(g.prototype,"type"),d.synthesize(g.prototype,"unique"),g.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},g.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._btree=new(f.create(2,this.sortAsc)),this._unique&&(this._uniqueLookup={}),a=0;d>a;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},g.prototype.insert=function(a,b){var c,d,e=this._unique,f=this._itemKeyHash(a,this._keys);e&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),d=this._btree.get(f),void 0===d&&(d=[],this._btree.put(f,d)),d.push(a),this._size++},g.prototype.remove=function(a,b){var c,d,e,f=this._unique,g=this._itemKeyHash(a,this._keys);f&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),d=this._btree.get(g),void 0!==d&&(e=d.indexOf(a),e>-1&&(1===d.length?this._btree.del(g):d.splice(e,1),this._size--))},g.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},g.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},g.prototype.lookup=function(a){return this._data[this._itemHash(a,this._keys)]||[]},g.prototype.match=function(a,b){var c,d=new e,f=d.parseArr(this._keys),g=d.parseArr(a),h=[],i=0;for(c=0;c<f.length;c++){if(g[c]!==f[c])return{matchedKeys:[],totalKeyCount:g.length,score:0};i++,h.push(g[c])}return{matchedKeys:h,totalKeyCount:g.length,score:i}},g.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},g.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},g.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.finishModule("IndexBinaryTree"),b.exports=g},{"./Path":21,"./Shared":23}],7:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(a,b,c){this._crossRef={},this._size=0,this._id=this._itemKeyHash(a,a),this.data({}),this.unique(b&&b.unique?b.unique:!1),void 0!==a&&this.keys(a),void 0!==c&&this.collection(c),this.name(b&&b.name?b.name:this._id)},d.addModule("IndexHashMap",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.id=function(){return this._id},f.prototype.state=function(){return this._state},f.prototype.size=function(){return this._size},d.synthesize(f.prototype,"data"),d.synthesize(f.prototype,"name"),d.synthesize(f.prototype,"collection"),d.synthesize(f.prototype,"type"),d.synthesize(f.prototype,"unique"),f.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},f.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._data={},this._unique&&(this._uniqueLookup={}),a=0;d>a;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},f.prototype.insert=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pushToPathValue(d[e],a)},f.prototype.remove=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pullFromPathValue(d[e],a)},f.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},f.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},f.prototype.pushToPathValue=function(a,b){var c=this._data[a]=this._data[a]||[];-1===c.indexOf(b)&&(c.push(b),this._size++,this.pushToCrossRef(b,c))},f.prototype.pullFromPathValue=function(a,b){var c,d=this._data[a];c=d.indexOf(b),c>-1&&(d.splice(c,1),this._size--,this.pullFromCrossRef(b,d)),d.length||delete this._data[a]},f.prototype.pull=function(a){var b,c,d=a[this._collection.primaryKey()],e=this._crossRef[d],f=e.length;for(b=0;f>b;b++)c=e[b],this._pullFromArray(c,a);this._size--,delete this._crossRef[d]},f.prototype._pullFromArray=function(a,b){for(var c=a.length;c--;)a[c]===b&&a.splice(c,1)},f.prototype.pushToCrossRef=function(a,b){var c,d=a[this._collection.primaryKey()];this._crossRef[d]=this._crossRef[d]||[],c=this._crossRef[d],-1===c.indexOf(b)&&c.push(b)},f.prototype.pullFromCrossRef=function(a,b){var c=a[this._collection.primaryKey()];delete this._crossRef[c]},f.prototype.lookup=function(a){return this._data[this._itemHash(a,this._keys)]||[]},f.prototype.match=function(a,b){var c,d=new e,f=d.parseArr(this._keys),g=d.parseArr(a),h=[],i=0;for(c=0;c<f.length;c++){if(g[c]!==f[c])return{matchedKeys:[],totalKeyCount:g.length,score:0};i++,h.push(g[c])}return{matchedKeys:h,totalKeyCount:g.length,score:i}},f.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},f.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},f.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.finishModule("IndexHashMap"),b.exports=f},{"./Path":21,"./Shared":23}],8:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){this._name=a,this._data={},this._primaryKey="_id"},d.addModule("KeyValueStore",e),d.mixin(e.prototype,"Mixin.ChainReactor"),d.synthesize(e.prototype,"name"),e.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey},e.prototype.truncate=function(){return this._data={},this},e.prototype.set=function(a,b){return this._data[a]=b?b:!0,this},e.prototype.get=function(a){return this._data[a]},e.prototype.lookup=function(a){var b,c,d,e,f=a[this._primaryKey];if(f instanceof Array){for(c=f.length,e=[],b=0;c>b;b++)d=this._data[f[b]],d&&e.push(d);return e}if(f instanceof RegExp){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&f.test(b)&&e.push(this._data[b]);return e}if("object"!=typeof f)return d=this._data[f],void 0!==d?[d]:[];if(f.$ne){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&b!==f.$ne&&e.push(this._data[b]);return e}if(f.$in&&f.$in instanceof Array){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&f.$in.indexOf(b)>-1&&e.push(this._data[b]);return e}if(f.$nin&&f.$nin instanceof Array){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&-1===f.$nin.indexOf(b)&&e.push(this._data[b]);return e}if(f.$or&&f.$or instanceof Array){for(e=[],b=0;b<f.$or.length;b++)e=e.concat(this.lookup(f.$or[b]));return e}},e.prototype.unSet=function(a){return delete this._data[a],this},e.prototype.uniqueSet=function(a,b){return void 0===this._data[a]?(this._data[a]=b,!0):!1},d.finishModule("KeyValueStore"),b.exports=e},{"./Shared":23}],9:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Operation"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(){this._data=[]},d.addModule("Metrics",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.create=function(a){var b=new e(a);return this._enabled&&this._data.push(b),b},f.prototype.start=function(){return this._enabled=!0,this},f.prototype.stop=function(){return this._enabled=!1,this},f.prototype.clear=function(){return this._data=[],this},f.prototype.list=function(){return this._data},d.finishModule("Metrics"),b.exports=f},{"./Operation":19,"./Shared":23}],10:[function(a,b,c){"use strict";var d={preSetData:function(){},postSetData:function(){}};b.exports=d},{}],11:[function(a,b,c){"use strict";var d={chain:function(a){this._chain=this._chain||[];var b=this._chain.indexOf(a);-1===b&&this._chain.push(a)},unChain:function(a){if(this._chain){var b=this._chain.indexOf(a);b>-1&&this._chain.splice(b,1)}},chainSend:function(a,b,c){if(this._chain){var d,e=this._chain,f=e.length;for(d=0;f>d;d++)e[d].chainReceive(this,a,b,c)}},chainReceive:function(a,b,c,d){var e={sender:a,type:b,data:c,options:d};(!this._chainHandler||this._chainHandler&&!this._chainHandler(e))&&this.chainSend(e.type,e.data,e.options)}};b.exports=d},{}],12:[function(a,b,c){"use strict";var d,e=0,f=a("./Overload");d={store:function(a,b){if(void 0!==a){if(void 0!==b)return this._store=this._store||{},this._store[a]=b,this;if(this._store)return this._store[a]}return void 0},unStore:function(a){return void 0!==a&&delete this._store[a],this},decouple:function(a,b){if(void 0!==a){if(b){var c,d=JSON.stringify(a),e=[];for(c=0;b>c;c++)e.push(JSON.parse(d));return e}return JSON.parse(JSON.stringify(a))}return void 0},objectId:function(a){var b,c=Math.pow(10,17);if(a){var d,f=0,g=a.length;for(d=0;g>d;d++)f+=a.charCodeAt(d)*c;b=f.toString(16)}else e++,b=(e+(Math.random()*c+Math.random()*c+Math.random()*c+Math.random()*c)).toString(16);return b},debug:new f([function(){return this._debug&&this._debug.all},function(a){return void 0!==a?"boolean"==typeof a?(this._debug=this._debug||{},this._debug.all=a,this.chainSend("debug",this._debug),this):this._debug&&this._debug[a]||this._db&&this._db._debug&&this._db._debug[a]||this._debug&&this._debug.all:this._debug&&this._debug.all},function(a,b){return void 0!==a?void 0!==b?(this._debug=this._debug||{},this._debug[a]=b,this.chainSend("debug",this._debug),this):this._debug&&this._debug[b]||this._db&&this._db._debug&&this._db._debug[a]:this._debug&&this._debug.all}])},b.exports=d},{"./Overload":20}],13:[function(a,b,c){"use strict";var d={TYPE_INSERT:0,TYPE_UPDATE:1,TYPE_REMOVE:2,PHASE_BEFORE:0,PHASE_AFTER:1};b.exports=d},{}],14:[function(a,b,c){"use strict";var d=a("./Overload"),e={on:new d({"string, function":function(a,b){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a]["*"]=this._listeners[a]["*"]||[],this._listeners[a]["*"].push(b),this},"string, *, function":function(a,b,c){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a][b]=this._listeners[a][b]||[],this._listeners[a][b].push(c),this}}),off:new d({string:function(a){return this._listeners&&this._listeners[a]&&a in this._listeners&&delete this._listeners[a],this},"string, function":function(a,b){var c,d;return"string"==typeof b?this._listeners&&this._listeners[a]&&this._listeners[a][b]&&delete this._listeners[a][b]:a in this._listeners&&(c=this._listeners[a]["*"],d=c.indexOf(b),d>-1&&c.splice(d,1)),this},"string, *, function":function(a,b,c){if(this._listeners&&a in this._listeners&&b in this.listeners[a]){var d=this._listeners[a][b],e=d.indexOf(c);e>-1&&d.splice(e,1)}},"string, *":function(a,b){this._listeners&&a in this._listeners&&b in this._listeners[a]&&delete this._listeners[a][b]}}),emit:function(a,b){if(this._listeners=this._listeners||{},a in this._listeners){var c,d;if(this._listeners[a]["*"]){var e=this._listeners[a]["*"];for(d=e.length,c=0;d>c;c++)e[c].apply(this,Array.prototype.slice.call(arguments,1))}if(b instanceof Array&&b[0]&&b[0][this._primaryKey]){var f,g,h=this._listeners[a];for(d=b.length,c=0;d>c;c++)if(h[b[c][this._primaryKey]])for(f=h[b[c][this._primaryKey]].length,g=0;f>g;g++)h[b[c][this._primaryKey]][g].apply(this,Array.prototype.slice.call(arguments,1))}}return this}};b.exports=e},{"./Overload":20}],15:[function(a,b,c){"use strict";var d={_match:function(a,b,c,d){var e,f,g,h,i,j,k,l=typeof a,m=typeof b,n=!0;if(d=d||{},d.$rootQuery||(d.$rootQuery=b),"string"!==l&&"number"!==l||"string"!==m&&"number"!==m){for(k in b)if(b.hasOwnProperty(k)){if(e=!1,j=k.substr(0,2),"//"===j)continue;if(0===j.indexOf("$")&&(i=this._matchOp(k,a,b[k],d),i>-1)){if(i){if("or"===c)return!0}else n=i;e=!0}if(!e&&b[k]instanceof RegExp)if(e=!0,"object"==typeof a&&void 0!==a[k]&&b[k].test(a[k])){if("or"===c)return!0}else n=!1;if(!e)if("object"==typeof b[k])if(void 0!==a[k])if(a[k]instanceof Array&&!(b[k]instanceof Array)){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],f,d));h++);if(g){if("or"===c)return!0}else n=!1}else if(!(a[k]instanceof Array)&&b[k]instanceof Array){for(g=!1,h=0;h<b[k].length&&!(g=this._match(a[k],b[k][h],f,d));h++);if(g){if("or"===c)return!0}else n=!1}else if("object"==typeof a)if(g=this._match(a[k],b[k],f,d)){if("or"===c)return!0}else n=!1;else if(g=this._match(void 0,b[k],f,d)){if("or"===c)return!0}else n=!1;else if(b[k]&&void 0!==b[k].$exists)if(g=this._match(void 0,b[k],f,d)){if("or"===c)return!0}else n=!1;else n=!1;else if(a&&a[k]===b[k]){if("or"===c)return!0}else if(a&&a[k]&&a[k]instanceof Array&&b[k]&&"object"!=typeof b[k]){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],f,d));h++);if(g){if("or"===c)return!0}else n=!1}else n=!1;if("and"===c&&!n)return!1}}else"number"===l?a!==b&&(n=!1):a.localeCompare(b)&&(n=!1);return n},_matchOp:function(a,b,c,d){switch(a){case"$gt":return b>c;case"$gte":return b>=c;case"$lt":return c>b;case"$lte":return c>=b;case"$exists":return void 0===b!==c;case"$ne":return b!=c;case"$or":for(var e=0;e<c.length;e++)if(this._match(b,c[e],"and",d))return!0;return!1;case"$and":for(var f=0;f<c.length;f++)if(!this._match(b,c[f],"and",d))return!1;return!0;case"$in":if(c instanceof Array){var g,h=c,i=h.length;for(g=0;i>g;g++)if(h[g]===b)return!0;return!1}throw'ForerunnerDB.Mixin.Matching "'+this.name()+'": Cannot use an $in operator on a non-array key: '+a;case"$nin":if(c instanceof Array){var j,k=c,l=k.length;for(j=0;l>j;j++)if(k[j]===b)return!1;return!0}throw'ForerunnerDB.Mixin.Matching "'+this.name()+'": Cannot use a $nin operator on a non-array key: '+a;case"$distinct":d.$rootQuery["//distinctLookup"]=d.$rootQuery["//distinctLookup"]||{};for(var m in c)if(c.hasOwnProperty(m))return d.$rootQuery["//distinctLookup"][m]=d.$rootQuery["//distinctLookup"][m]||{},d.$rootQuery["//distinctLookup"][m][b[m]]?!1:(d.$rootQuery["//distinctLookup"][m][b[m]]=!0,!0)}return-1}};b.exports=d},{}],16:[function(a,b,c){"use strict";var d={sortAsc:function(a,b){return"string"==typeof a&&"string"==typeof b?a.localeCompare(b):a>b?1:b>a?-1:0},sortDesc:function(a,b){return"string"==typeof a&&"string"==typeof b?b.localeCompare(a):a>b?-1:b>a?1:0}};b.exports=d},{}],17:[function(a,b,c){"use strict";var d=a("./Overload"),e={addTrigger:function(a,b,c,d){var e,f=this;return e=f._triggerIndexOf(a,b,c),-1===e?(f._trigger=f._trigger||{},f._trigger[b]=f._trigger[b]||{},f._trigger[b][c]=f._trigger[b][c]||[],f._trigger[b][c].push({id:a,method:d,enabled:!0}),!0):!1},removeTrigger:function(a,b,c){var d,e=this;return d=e._triggerIndexOf(a,b,c),d>-1&&e._trigger[b][c].splice(d,1),!1},enableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!0,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!0,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!0,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1?(d._trigger[b][c][e].enabled=!0,!0):!1}}),disableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!1,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!1,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!1,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1?(d._trigger[b][c][e].enabled=!1,!0):!1}}),willTrigger:function(a,b){if(this._trigger&&this._trigger[a]&&this._trigger[a][b]&&this._trigger[a][b].length){var c,d=this._trigger[a][b];for(c=0;c<d.length;c++)if(d[c].enabled)return!0}return!1},processTrigger:function(a,b,c,d,e){var f,g,h,i,j,k=this;if(k._trigger&&k._trigger[b]&&k._trigger[b][c]){for(f=k._trigger[b][c],h=f.length,g=0;h>g;g++)if(i=f[g],i.enabled){if(this.debug()){var l,m;switch(b){case this.TYPE_INSERT:l="insert";break;case this.TYPE_UPDATE:l="update";break;case this.TYPE_REMOVE:l="remove";break;default:l=""}switch(c){case this.PHASE_BEFORE:m="before";break;case this.PHASE_AFTER:m="after";break;default:m=""}}if(j=i.method.call(k,a,d,e),j===!1)return!1;if(void 0!==j&&j!==!0&&j!==!1)throw"ForerunnerDB.Mixin.Triggers: Trigger error: "+j}return!0}},_triggerIndexOf:function(a,b,c){var d,e,f,g=this;if(g._trigger&&g._trigger[b]&&g._trigger[b][c])for(d=g._trigger[b][c],e=d.length,f=0;e>f;f++)if(d[f].id===a)return f;return-1}};b.exports=e},{"./Overload":20}],18:[function(a,b,c){"use strict";var d={_updateProperty:function(a,b,c){a[b]=c,this.debug()&&console.log('ForerunnerDB.Mixin.Updating: Setting non-data-bound document property "'+b+'" for "'+this.name()+'"')},_updateIncrement:function(a,b,c){a[b]+=c},_updateSpliceMove:function(a,b,c){a.splice(c,0,a.splice(b,1)[0]),this.debug()&&console.log('ForerunnerDB.Mixin.Updating: Moving non-data-bound document array index from "'+b+'" to "'+c+'" for "'+this.name()+'"')},_updateSplicePush:function(a,b,c){a.length>b?a.splice(b,0,c):a.push(c)},_updatePush:function(a,b){a.push(b)},_updatePull:function(a,b){a.splice(b,1)},_updateMultiply:function(a,b,c){a[b]*=c},_updateRename:function(a,b,c){a[c]=a[b],delete a[b]},_updateOverwrite:function(a,b,c){a[b]=c},_updateUnset:function(a,b){delete a[b]},_updateClear:function(a,b){var c,d=a[b];if(d&&"object"==typeof d)for(c in d)d.hasOwnProperty(c)&&this._updateUnset(d,c)},_updatePop:function(a,b){var c=!1;return a.length>0&&(1===b?(a.pop(),c=!0):-1===b&&(a.shift(),c=!0)),c}};b.exports=d},{}],19:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(a){this.pathSolver=new e,this.counter=0,this.init.apply(this,arguments)};f.prototype.init=function(a){this._data={operation:a,index:{potential:[],used:!1},steps:[],time:{startMs:0,stopMs:0,totalMs:0,process:{}},flag:{},log:[]}},d.addModule("Operation",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.start=function(){this._data.time.startMs=(new Date).getTime()},f.prototype.log=function(a){if(a){var b=this._log.length>0?this._data.log[this._data.log.length-1].time:0,c={event:a,time:(new Date).getTime(),delta:0};return this._data.log.push(c),b&&(c.delta=c.time-b),this}return this._data.log},f.prototype.time=function(a){if(void 0!==a){var b=this._data.time.process,c=b[a]=b[a]||{};return c.startMs?(c.stopMs=(new Date).getTime(),c.totalMs=c.stopMs-c.startMs,c.stepObj.totalMs=c.totalMs,delete c.stepObj):(c.startMs=(new Date).getTime(),c.stepObj={name:a},this._data.steps.push(c.stepObj)),this}return this._data.time},f.prototype.flag=function(a,b){return void 0===a||void 0===b?void 0!==a?this._data.flag[a]:this._data.flag:void(this._data.flag[a]=b)},f.prototype.data=function(a,b,c){return void 0!==b?(this.pathSolver.set(this._data,a,b),this):this.pathSolver.get(this._data,a)},f.prototype.pushData=function(a,b,c){this.pathSolver.push(this._data,a,b)},f.prototype.stop=function(){this._data.time.stopMs=(new Date).getTime(),this._data.time.totalMs=this._data.time.stopMs-this._data.time.startMs},d.finishModule("Operation"),b.exports=f},{"./Path":21,"./Shared":23}],20:[function(a,b,c){"use strict";var d=function(a){if(a){var b,c,d,e,f,g,h=this;if(!(a instanceof Array)){d={};for(b in a)if(a.hasOwnProperty(b))if(e=b.replace(/ /g,""),-1===e.indexOf("*"))d[e]=a[b];else for(g=this.generateSignaturePermutations(e),f=0;f<g.length;f++)d[g[f]]||(d[g[f]]=a[b]);a=d}return function(){var d,e,f=[];if(a instanceof Array){for(c=a.length,b=0;c>b;b++)if(a[b].length===arguments.length)return h.callExtend(this,"$main",a,a[b],arguments)}else{for(b=0;b<arguments.length&&(e=typeof arguments[b],"object"===e&&arguments[b]instanceof Array&&(e="array"),1!==arguments.length||"undefined"!==e);b++)f.push(e);if(d=f.join(","),a[d])return h.callExtend(this,"$main",a,a[d],arguments);for(b=f.length;b>=0;b--)if(d=f.slice(0,b).join(","),a[d+",..."])return h.callExtend(this,"$main",a,a[d+",..."],arguments)}throw'ForerunnerDB.Overload "'+this.name()+'": Overloaded method does not have a matching signature for the passed arguments: '+JSON.stringify(f)}}return function(){}};d.prototype.generateSignaturePermutations=function(a){var b,c,d=[],e=["string","object","number","function","undefined"];if(a.indexOf("*")>-1)for(c=0;c<e.length;c++)b=a.replace("*",e[c]),d=d.concat(this.generateSignaturePermutations(b));else d.push(a);return d},d.prototype.callExtend=function(a,b,c,d,e){var f,g;return a&&c[b]?(f=a[b],a[b]=c[b],g=d.apply(a,e),a[b]=f,g):d.apply(a,e)},b.exports=d},{}],21:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){a&&this.path(a)},d.addModule("Path",e),d.mixin(e.prototype,"Mixin.ChainReactor"),e.prototype.path=function(a){return void 0!==a?(this._path=this.clean(a),this._pathParts=this._path.split("."),this):this._path},e.prototype.hasObjectPaths=function(a,b){var c,d=!0;for(c in a)if(a.hasOwnProperty(c)){if(void 0===b[c])return!1;if("object"==typeof a[c]&&(d=this.hasObjectPaths(a[c],b[c]),!d))return!1}return d},e.prototype.countKeys=function(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&void 0!==a[b]&&("object"!=typeof a[b]?c++:c+=this.countKeys(a[b]));return c},e.prototype.countObjectPaths=function(a,b){var c,d,e={},f=0,g=0;for(d in b)b.hasOwnProperty(d)&&("object"==typeof b[d]?(c=this.countObjectPaths(a[d],b[d]),e[d]=c.matchedKeys,g+=c.totalKeyCount,f+=c.matchedKeyCount):(g++,a&&a[d]&&"object"!=typeof a[d]?(e[d]=!0,f++):e[d]=!1));return{matchedKeys:e,matchedKeyCount:f,totalKeyCount:g}},e.prototype.parse=function(a,b){var c,d,e,f=[],g="";for(d in a)if(a.hasOwnProperty(d))if(g=d,"object"==typeof a[d])if(b)for(c=this.parse(a[d],b),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path,value:c[e].value});else for(c=this.parse(a[d]),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path});else f.push(b?{path:g,value:a[d]}:{path:g});return f},e.prototype.parseArr=function(a,b){return b=b||{},this._parseArr(a,"",[],b)},e.prototype._parseArr=function(a,b,c,d){var e,f="";b=b||"",c=c||[];for(e in a)a.hasOwnProperty(e)&&(!d.ignore||d.ignore&&!d.ignore.test(e))&&(f=b?b+"."+e:e,"object"==typeof a[e]?this._parseArr(a[e],f,c,d):c.push(f));return c},e.prototype.value=function(a,b){if(void 0!==a&&"object"==typeof a){var c,d,e,f,g,h,i,j=[];for(void 0!==b&&(b=this.clean(b),c=b.split(".")),d=c||this._pathParts,e=d.length,f=a,h=0;e>h;h++){if(f=f[d[h]],g instanceof Array){for(i=0;i<g.length;i++)j=j.concat(this.value(g,i+"."+d[h]));return j}if(!f||"object"!=typeof f)break;g=f}return[f]}return[]},e.prototype.set=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;b=this.clean(b),d=b.split("."),e=d.shift(),d.length?(a[e]=a[e]||{},this.set(a[e],d.join("."),c)):a[e]=c}return a},e.prototype.get=function(a,b){return this.value(a,b)[0]},e.prototype.push=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;if(b=this.clean(b),d=b.split("."),e=d.shift(),d.length)a[e]=a[e]||{},this.set(a[e],d.join("."),c);else{if(a[e]=a[e]||[],!(a[e]instanceof Array))throw"ForerunnerDB.Path: Cannot push to a path whose endpoint is not an array!";a[e].push(c)}}return a},e.prototype.keyValue=function(a,b){var c,d,e,f,g,h,i;for(void 0!==b&&(b=this.clean(b),c=b.split(".")),d=c||this._pathParts,e=d.length,f=a,i=0;e>i;i++){if(f=f[d[i]],!f||"object"!=typeof f){h=d[i]+":"+f;break}g=f}return h},e.prototype.clean=function(a){return"."===a.substr(0,1)&&(a=a.substr(1,a.length-1)),a},d.finishModule("Path"),b.exports=e},{"./Shared":23}],22:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a,b,c){if(!(a&&b&&c))throw"ForerunnerDB.ReactorIO: ReactorIO requires in, out and process arguments to instantiate!";if(this._reactorIn=a,this._reactorOut=b,this._chainHandler=c,!a.chain||!b.chainReceive)throw"ForerunnerDB.ReactorIO: ReactorIO requires passed in and out objects to implement the ChainReactor mixin!";a.chain(this),this.chain(b)};d.addModule("ReactorIO",e),e.prototype.drop=function(){return"dropped"!==this._state&&(this._state="dropped",this._reactorIn&&this._reactorIn.unChain(this),this._reactorOut&&this.unChain(this._reactorOut),delete this._reactorIn,delete this._reactorOut,delete this._chainHandler,this.emit("drop",this)),!0},d.synthesize(e.prototype,"state"),d.mixin(e.prototype,"Mixin.ChainReactor"),d.mixin(e.prototype,"Mixin.Events"),d.finishModule("ReactorIO"),b.exports=e},{"./Shared":23}],23:[function(a,b,c){"use strict";var d={version:"1.3.40",modules:{},_synth:{},addModule:function(a,b){this.modules[a]=b,this.emit("moduleLoad",[a,b])},finishModule:function(a){if(!this.modules[a])throw"ForerunnerDB.Shared: finishModule called on a module that has not been registered with addModule(): "+a;this.modules[a]._fdbFinished=!0,this.emit("moduleFinished",[a,this.modules[a]])},moduleFinished:function(a,b){this.modules[a]&&this.modules[a]._fdbFinished?b&&b(a,this.modules[a]):this.on("moduleFinished",b)},moduleExists:function(a){return Boolean(this.modules[a])},mixin:function(a,b){var c=this.mixins[b];if(!c)throw"ForerunnerDB.Shared: Cannot find mixin named: "+b;for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])},synthesize:function(a,b,c){if(this._synth[b]=this._synth[b]||function(a){return void 0!==a?(this["_"+b]=a,this):this["_"+b]},c){var d=this;a[b]=function(){var a,e=this.$super;return this.$super=d._synth[b],a=c.apply(this,arguments),this.$super=e,a}}else a[b]=this._synth[b]},overload:a("./Overload"),mixins:{"Mixin.Common":a("./Mixin.Common"),"Mixin.Events":a("./Mixin.Events"),"Mixin.ChainReactor":a("./Mixin.ChainReactor"),"Mixin.CRUD":a("./Mixin.CRUD"),"Mixin.Constants":a("./Mixin.Constants"),"Mixin.Triggers":a("./Mixin.Triggers"),"Mixin.Sorting":a("./Mixin.Sorting"),"Mixin.Matching":a("./Mixin.Matching"),"Mixin.Updating":a("./Mixin.Updating")}};d.mixin(d,"Mixin.Events"),b.exports=d},{"./Mixin.CRUD":10,"./Mixin.ChainReactor":11,"./Mixin.Common":12,"./Mixin.Constants":13,"./Mixin.Events":14,"./Mixin.Matching":15,"./Mixin.Sorting":16,"./Mixin.Triggers":17,"./Mixin.Updating":18,"./Overload":20}],24:[function(a,b,c){Array.prototype.filter||(Array.prototype.filter=function(a){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments.length>=2?arguments[1]:void 0,f=0;c>f;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g)}return d}),"function"!=typeof Object.create&&(Object.create=function(){var a=function(){};return function(b){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof b)throw TypeError("Argument must be an object");a.prototype=b;var c=new a;return a.prototype=null,c}}()),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var c;if(null===this)throw new TypeError('"this" is null or not defined');var d=Object(this),e=d.length>>>0;if(0===e)return-1;var f=+b||0;if(Math.abs(f)===1/0&&(f=0),f>=e)return-1;for(c=Math.max(f>=0?f:e-Math.abs(f),0);e>c;){if(c in d&&d[c]===a)return c;c++}return-1}),b.exports={}},{}]},{},[1]);
examples/counter/test/containers/App.spec.js
ellbee/redux
import expect from 'expect' import React from 'react' import TestUtils from 'react-addons-test-utils' import { Provider } from 'react-redux' import App from '../../containers/App' import configureStore from '../../store/configureStore' function setup(initialState) { const store = configureStore(initialState) const app = TestUtils.renderIntoDocument( <Provider store={store}> <App /> </Provider> ) return { app: app, buttons: TestUtils.scryRenderedDOMComponentsWithTag(app, 'button'), p: TestUtils.findRenderedDOMComponentWithTag(app, 'p') } } describe('containers', () => { describe('App', () => { it('should display initial count', () => { const { p } = setup() expect(p.textContent).toMatch(/^Clicked: 0 times/) }) it('should display updated count after increment button click', () => { const { buttons, p } = setup() TestUtils.Simulate.click(buttons[0]) expect(p.textContent).toMatch(/^Clicked: 1 times/) }) it('should display updated count after decrement button click', () => { const { buttons, p } = setup() TestUtils.Simulate.click(buttons[1]) expect(p.textContent).toMatch(/^Clicked: -1 times/) }) it('shouldnt change if even and if odd button clicked', () => { const { buttons, p } = setup() TestUtils.Simulate.click(buttons[2]) expect(p.textContent).toMatch(/^Clicked: 0 times/) }) it('should change if odd and if odd button clicked', () => { const { buttons, p } = setup({ counter: 1 }) TestUtils.Simulate.click(buttons[2]) expect(p.textContent).toMatch(/^Clicked: 2 times/) }) }) })
src/svg-icons/hardware/memory.js
mtsandeep/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let HardwareMemory = (props) => ( <SvgIcon {...props}> <path d="M15 9H9v6h6V9zm-2 4h-2v-2h2v2zm8-2V9h-2V7c0-1.1-.9-2-2-2h-2V3h-2v2h-2V3H9v2H7c-1.1 0-2 .9-2 2v2H3v2h2v2H3v2h2v2c0 1.1.9 2 2 2h2v2h2v-2h2v2h2v-2h2c1.1 0 2-.9 2-2v-2h2v-2h-2v-2h2zm-4 6H7V7h10v10z"/> </SvgIcon> ); HardwareMemory = pure(HardwareMemory); HardwareMemory.displayName = 'HardwareMemory'; HardwareMemory.muiName = 'SvgIcon'; export default HardwareMemory;
actor-apps/app-web/src/app/utils/require-auth.js
guiquanz/actor-platform
import React from 'react'; import LoginStore from 'stores/LoginStore'; export default (Component) => { return class Authenticated extends React.Component { static willTransitionTo(transition) { if (!LoginStore.isLoggedIn()) { transition.redirect('/auth', {}, {'nextPath': transition.path}); } } render() { return <Component {...this.props}/>; } }; };
src/pages/lefix.js
vitorbarbosa19/ziro-online
import React from 'react' import BrandGallery from '../components/BrandGallery' export default () => ( <BrandGallery brand='Lefix' /> )
resources/src/js/components/Finder/components/Album.js
aberon10/thermomusic.com
'use strict'; // Dependencies import React from 'react'; import { Link } from 'react-router-dom'; import {substr} from '../../utils'; import Finder from '../index'; import ResultBox from '../ResultBox'; export default class Album extends React.Component { constructor(props) { super(props); this.state = { element: null }; Album.updateState = Album.updateState.bind(this); Album.resetState = Album.resetState.bind(this); Album.createContent = Album.createContent.bind(this); } static resetState() { this.setState({ element: null }); } static updateState(albums) { this.setState({ element: Album.createContent(albums) }); } static createContent(albums) { let albumsElements = []; let element = null; let LinkSeeAll = null; let onClickEventHandler = this.state.element ? ResultBox.resetState : Finder.resetState; if (albums && albums.length) { albums.forEach((album) => { albumsElements.push( <div className="card-item" key={album.id_album}> <div className="card-picture"> <figure className="thumbnail"> <Link to={'/album/index/' + album.id_album} onClick={onClickEventHandler}> <img src={'http://thermobackend.com/storage/' + album.src_img} alt={album.nombre} /> </Link> </figure> </div> <div className="card-info"> <Link to={'/album/index/' + album.id_album} onClick={onClickEventHandler}> <h2 className="card-info__heading-2">{substr(album.nombre)}</h2> </Link> <Link to={'/artist/index/' + album.id_artista} onClick={onClickEventHandler}> <h3 className="card-info__heading-3">por {substr(album.nombre_artista)}</h3> </Link> </div> </div> ); }); } if (sessionStorage.getItem('seeAll')) { LinkSeeAll = <span to='#' className="see-all" onClick={ResultBox.findContent} style={{ cursor: 'pointer' }} data-entitie='album' data-search={document.getElementById('search').value} >ver todos</span>; } if (albumsElements.length) { element = <div className="card-group"> <h3 className="card-group-title">Albums</h3> <div className="card-list"> {albumsElements} </div> {LinkSeeAll} </div>; } return element; } render() { let element = this.props.albums ? Album.createContent(this.props.albums) : this.state.element; return ( <div> {element} </div> ); } } Album.defaultProps = { albums: null };
server/server.js
lordknight1904/bigvnadmin
import Express from 'express'; import compression from 'compression'; import mongoose from 'mongoose'; import bodyParser from 'body-parser'; import path from 'path'; // Webpack Requirements import webpack from 'webpack'; import config from '../webpack.config.dev'; import webpackDevMiddleware from 'webpack-dev-middleware'; import webpackHotMiddleware from 'webpack-hot-middleware'; // Initialize the Express App const app = new Express(); // Run Webpack dev server in development mode if (process.env.NODE_ENV === 'development') { const compiler = webpack(config); app.use(webpackDevMiddleware(compiler, { noInfo: true, publicPath: config.output.publicPath })); app.use(webpackHotMiddleware(compiler)); } app.use('/photo', Express.static('../bigvn/public')); app.use('/images', Express.static('../bigvn/client/images')); app.use('/banner', Express.static('./banner')); app.use('/blog', Express.static('../bigvn/blog')); app.use('/css', Express.static('./css')); app.use('/js', Express.static('./js')); app.use('/font-awesome', Express.static('./font-awesome')); app.use('/img', Express.static('./img')); // React And Redux Setup import { configureStore } from '../client/store'; import { Provider } from 'react-redux'; import React from 'react'; import { renderToString } from 'react-dom/server'; import { match, RouterContext } from 'react-router'; import Helmet from 'react-helmet'; import helmet from 'helmet'; // Import required modules import routes from '../client/routes'; import { fetchComponentData } from './util/fetchData'; import users from './routes/user.routes'; import admins from './routes/admin.routes'; import cities from './routes/city.routes'; import districts from './routes/district.routes'; import wards from './routes/ward.routes'; import news from './routes/news.routes'; import banners from './routes/banner.routes'; import categories from './routes/category.routes'; import topics from './routes/topic.routes'; import settings from './routes/setting.routes'; import keywords from './routes/keyword.routes'; import serverConfig from './config'; import dummyData from './dummyData'; // Set native promises as mongoose promise mongoose.Promise = global.Promise; // MongoDB Connection mongoose.connect(serverConfig.mongoURL, (error) => { if (error) { console.error('Please make sure Mongodb is installed and running!'); // eslint-disable-line no-console throw error; } dummyData(); }); app.use(helmet.xssFilter()); app.use(helmet.frameguard({ action: 'deny' })); app.use(helmet.noSniff()); // Apply body Parser and server public assets and routes app.use(compression()); app.use(bodyParser.json({ limit: '20mb' })); app.use(bodyParser.urlencoded({ limit: '20mb', extended: false })); app.use(Express.static(path.resolve(__dirname, '../dist/client'))); app.use('/api', [topics, settings, news, banners, cities, districts, categories, wards, keywords, admins, users]); // Render Initial HTML const renderFullPage = (html, initialState) => { const head = Helmet.rewind(); // Import Manifests const assetsManifest = process.env.webpackAssets && JSON.parse(process.env.webpackAssets); const chunkManifest = process.env.webpackChunkAssets && JSON.parse(process.env.webpackChunkAssets); return ` <!doctype html> <html> <head> ${head.base.toString()} ${head.title.toString()} ${head.meta.toString()} ${head.link.toString()} ${head.script.toString()} ${process.env.NODE_ENV === 'production' ? `<link rel='stylesheet' href='${assetsManifest['/app.css']}' />` : ''} <link rel="stylesheet" href="css/bootstrap-responsive.min.css" /> <link rel="stylesheet" href="css/fullcalendar.css" /> <link rel="stylesheet" href="css/matrix-style.css" /> <link rel="stylesheet" href="css/matrix-media.css" /> <link href="font-awesome/css/font-awesome.css" rel="stylesheet" /> <link rel="stylesheet" href="css/jquery.gritter.css" /> <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,800' rel='stylesheet' type='text/css'> <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css"> <link rel="shortcut icon" href="http://res.cloudinary.com/hashnode/image/upload/v1455629445/static_imgs/mern/mern-favicon-circle-fill.png" type="image/png" /> </head> <body> <div id="root"><div>${html}</div></div> <script> window.__INITIAL_STATE__ = ${JSON.stringify(initialState)}; ${process.env.NODE_ENV === 'production' ? `//<![CDATA[ window.webpackManifest = ${JSON.stringify(chunkManifest)}; //]]>` : ''} </script> <script src='${process.env.NODE_ENV === 'production' ? assetsManifest['/vendor.js'] : '/vendor.js'}'></script> <script src='${process.env.NODE_ENV === 'production' ? assetsManifest['/app.js'] : '/app.js'}'></script> </body> </html> `; }; const renderError = err => { const softTab = '&#32;&#32;&#32;&#32;'; const errTrace = process.env.NODE_ENV !== 'production' ? `:<br><br><pre style="color:red">${softTab}${err.stack.replace(/\n/g, `<br>${softTab}`)}</pre>` : ''; return renderFullPage(`Server Error${errTrace}`, {}); }; // Server Side Rendering based on routes matched by React-router. app.use((req, res, next) => { match({ routes, location: req.url }, (err, redirectLocation, renderProps) => { if (err) { return res.status(500).end(renderError(err)); } if (redirectLocation) { return res.redirect(302, redirectLocation.pathname + redirectLocation.search); } if (!renderProps) { return next(); } const store = configureStore(); return fetchComponentData(store, renderProps.components, renderProps.params) .then(() => { const initialView = renderToString( <Provider store={store}> <RouterContext {...renderProps} /> </Provider> ); const finalState = store.getState(); res .set('Content-Type', 'text/html') .status(200) .end(renderFullPage(initialView, finalState)); }) .catch((error) => next(error)); }); }); // start app const server = app.listen(serverConfig.port, (error) => { if (!error) { console.log(`MERN is running on port: ${serverConfig.port}! Build something amazing!`); // eslint-disable-line } }); // import ServerSocketIO from './routes/socket_routes/chat_socket'; // const serverSocketIOObj = new ServerSocketIO(server); // serverSocketIOObj.beginListen(); export default app;
frontend/src/components/common/Routes/UnauthorizedOnlyRoute.js
VladimirAnaniev/LoggIt
import React from 'react' import { Route, Redirect } from 'react-router-dom' import { connect } from 'react-redux' function UnauthorizedOnlyRoute ({component: Component, isLoggedIn, ...rest}) { return ( <Route {...rest} render={props => ( !isLoggedIn ? ( <Component {...props} /> ) : ( <Redirect to={{ pathname: '/', state: {from: props.location} }} /> ) ) } /> ) } const mapStateToProps = (state) => { return { isLoggedIn: state.auth.isLoggedIn } } export default connect(mapStateToProps)(UnauthorizedOnlyRoute)
actor-sdk/sdk-web/src/components/common/ContactItem.react.js
ljshj/actor-platform
/* * Copyright (C) 2016 Actor LLC. <https://actor.im> */ import React, { Component, PropTypes } from 'react'; import { shouldComponentUpdate } from 'react-addons-pure-render-mixin'; import classnames from 'classnames'; import AvatarItem from './AvatarItem.react'; import { escapeWithEmoji } from '../../utils/EmojiUtils'; class ContactItem extends Component { static propTypes = { uid: PropTypes.number.isRequired, name: PropTypes.string.isRequired, placeholder: PropTypes.string.isRequired, avatar: PropTypes.string, className: PropTypes.string, onClick: PropTypes.func, children: PropTypes.node }; constructor(props) { super(props); this.shouldComponentUpdate = shouldComponentUpdate.bind(this); this.handleClick = this.handleClick.bind(this); } handleClick() { const { onClick } = this.props; onClick && onClick(); } render() { const { name, placeholder, avatar, children, className } = this.props; const contactClassName = classnames('contact row middle-xs', className); return ( <div className={contactClassName} onClick={this.handleClick}> <div className="contact__avatar"> <AvatarItem image={avatar} placeholder={placeholder} size="small" title={name} /> </div> <div className="contact__body col-xs"> <span className="title" dangerouslySetInnerHTML={{ __html: escapeWithEmoji(name) }}/> </div> <div className="contact__controls"> {children} </div> </div> ); } } export default ContactItem;
src/static/js/jquery.js
livingbio/weather-parser
/*! * jQuery JavaScript Library v1.11.3 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2015-04-28T16:19Z */ (function( global, factory ) { if ( typeof module === "object" && typeof module.exports === "object" ) { // For CommonJS and CommonJS-like environments where a proper window is present, // execute the factory and get jQuery // For environments that do not inherently posses a window with a document // (such as Node.js), expose a jQuery-making factory as module.exports // This accentuates the need for the creation of a real window // e.g. var jQuery = require("jquery")(window); // See ticket #14549 for more info module.exports = global.document ? factory( global, true ) : function( w ) { if ( !w.document ) { throw new Error( "jQuery requires a window with a document" ); } return factory( w ); }; } else { factory( global ); } // Pass this if window is not defined yet }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { // Can't do this because several apps including ASP.NET trace // the stack via arguments.caller.callee and Firefox dies if // you try to trace through "use strict" call chains. (#13335) // Support: Firefox 18+ // var deletedIds = []; var slice = deletedIds.slice; var concat = deletedIds.concat; var push = deletedIds.push; var indexOf = deletedIds.indexOf; var class2type = {}; var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; var support = {}; var version = "1.11.3", // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' // Need init if jQuery is called (just allow error to be thrown if not included) return new jQuery.fn.init( selector, context ); }, // Support: Android<4.1, IE<9 // Make sure we trim BOM and NBSP rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used jquery: version, constructor: jQuery, // Start with an empty selector selector: "", // The default length of a jQuery object is 0 length: 0, toArray: function() { return slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num != null ? // Return just the one element from the set ( num < 0 ? this[ num + this.length ] : this[ num ] ) : // Return all the elements in a clean array slice.call( this ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, slice: function() { return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: deletedIds.sort, splice: deletedIds.splice }; jQuery.extend = jQuery.fn.extend = function() { var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; // skip the boolean and the target target = arguments[ i ] || {}; i++; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( i === length ) { target = this; i--; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ // Unique for each copy of jQuery on the page expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), // Assume jQuery is ready without the ready module isReady: true, error: function( msg ) { throw new Error( msg ); }, noop: function() {}, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type(obj) === "array"; }, isWindow: function( obj ) { /* jshint eqeqeq: false */ return obj != null && obj == obj.window; }, isNumeric: function( obj ) { // parseFloat NaNs numeric-cast false positives (null|true|false|"") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN // adding 1 corrects loss of precision from parseFloat (#15100) return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, isPlainObject: function( obj ) { var key; // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } try { // Not own constructor property must be Object if ( obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } } catch ( e ) { // IE8,9 Will throw exceptions on certain host objects #9897 return false; } // Support: IE<9 // Handle iteration over inherited properties before own properties. if ( support.ownLast ) { for ( key in obj ) { return hasOwn.call( obj, key ); } } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. for ( key in obj ) {} return key === undefined || hasOwn.call( obj, key ); }, type: function( obj ) { if ( obj == null ) { return obj + ""; } return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call(obj) ] || "object" : typeof obj; }, // Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { if ( data && jQuery.trim( data ) ) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox ( window.execScript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, // Convert dashed to camelCase; used by the css and data modules // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, // args is for internal usage only each: function( obj, callback, args ) { var value, i = 0, length = obj.length, isArray = isArraylike( obj ); if ( args ) { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } } return obj; }, // Support: Android<4.1, IE<9 trim: function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var ret = results || []; if ( arr != null ) { if ( isArraylike( Object(arr) ) ) { jQuery.merge( ret, typeof arr === "string" ? [ arr ] : arr ); } else { push.call( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { var len; if ( arr ) { if ( indexOf ) { return indexOf.call( arr, elem, i ); } len = arr.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // Skip accessing in sparse arrays if ( i in arr && arr[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var len = +second.length, j = 0, i = first.length; while ( j < len ) { first[ i++ ] = second[ j++ ]; } // Support: IE<9 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) if ( len !== len ) { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, invert ) { var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { callbackInverse = !callback( elems[ i ], i ); if ( callbackInverse !== callbackExpect ) { matches.push( elems[ i ] ); } } return matches; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, i = 0, length = elems.length, isArray = isArraylike( elems ), ret = []; // Go through the array, translating each of the items to their new values if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } // Go through every key on the object, } else { for ( i in elems ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } } // Flatten any nested arrays return concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var args, proxy, tmp; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = slice.call( arguments, 2 ); proxy = function() { return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, now: function() { return +( new Date() ); }, // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support }); // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); function isArraylike( obj ) { // Support: iOS 8.2 (not reproducible in simulator) // `in` check used to prevent JIT error (gh-2145) // hasOwn isn't used here due to false negatives // regarding Nodelist length in IE var length = "length" in obj && obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } if ( obj.nodeType === 1 && length ) { return true; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } var Sizzle = /*! * Sizzle CSS Selector Engine v2.2.0-pre * http://sizzlejs.com/ * * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2014-12-16 */ (function( window ) { var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, // Local document vars setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, // Instance-specific data expando = "sizzle" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; } return 0; }, // General-purpose constants MAX_NEGATIVE = 1 << 31, // Instance methods hasOwn = ({}).hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf as it's faster than native // http://jsperf.com/thor-indexof-vs-for/5 indexOf = function( list, elem ) { var i = 0, len = list.length; for ( ; i < len; i++ ) { if ( list[i] === elem ) { return i; } } return -1; }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", // Regular expressions // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/css3-syntax/#characters characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // Loosely modeled on CSS identifier characters // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + // Operator (capture 2) "*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + characterEncoding + ")(?:\\((" + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: // 1. quoted (capture 3; capture 4 or capture 5) "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + // 2. simple (capture 6) "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + // 3. anything else (capture 2) ".*" + ")\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rwhitespace = new RegExp( whitespace + "+", "g" ), rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { "ID": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint // Support: Firefox<24 // Workaround erroneous numeric interpretation of +"0x" return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }, // Used for iframes // See setDocument() // Removing the function wrapper causes a "Permission Denied" // error in IE unloadHandler = function() { setDocument(); }; // Optimize for push.apply( _, NodeList ) try { push.apply( (arr = slice.call( preferredDoc.childNodes )), preferredDoc.childNodes ); // Support: Android<4.0 // Detect silently failing push.apply arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { push = { apply: arr.length ? // Leverage slice if possible function( target, els ) { push_native.apply( target, slice.call(els) ); } : // Support: IE<9 // Otherwise append directly function( target, els ) { var j = target.length, i = 0; // Can't trust NodeList.length while ( (target[j++] = els[i++]) ) {} target.length = j - 1; } }; } function Sizzle( selector, context, results, seed ) { var match, elem, m, nodeType, // QSA vars i, groups, old, nid, newContext, newSelector; if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { setDocument( context ); } context = context || document; results = results || []; nodeType = context.nodeType; if ( typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { return results; } if ( !seed && documentIsHTML ) { // Try to shortcut find operations when possible (e.g., not under DocumentFragment) if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document (jQuery #6963) if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { // Context is not a document if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Speed-up: Sizzle("TAG") } else if ( match[2] ) { push.apply( results, context.getElementsByTagName( selector ) ); return results; // Speed-up: Sizzle(".CLASS") } else if ( (m = match[3]) && support.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } // QSA path if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { nid = old = expando; newContext = context; newSelector = nodeType !== 1 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getAttribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + toSelector( groups[i] ); } newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; newSelector = groups.join(","); } if ( newSelector ) { try { push.apply( results, newContext.querySelectorAll( newSelector ) ); return results; } catch(qsaError) { } finally { if ( !old ) { context.removeAttribute("id"); } } } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed ); } /** * Create key-value caches of limited size * @returns {Function(string, Object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ function createCache() { var keys = []; function cache( key, value ) { // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) if ( keys.push( key + " " ) > Expr.cacheLength ) { // Only keep the most recent entries delete cache[ keys.shift() ]; } return (cache[ key + " " ] = value); } return cache; } /** * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ function markFunction( fn ) { fn[ expando ] = true; return fn; } /** * Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result */ function assert( fn ) { var div = document.createElement("div"); try { return !!fn( div ); } catch (e) { return false; } finally { // Remove from its parent by default if ( div.parentNode ) { div.parentNode.removeChild( div ); } // release memory in IE div = null; } } /** * Adds the same handler for all of the specified attrs * @param {String} attrs Pipe-separated list of attributes * @param {Function} handler The method that will be applied */ function addHandle( attrs, handler ) { var arr = attrs.split("|"), i = attrs.length; while ( i-- ) { Expr.attrHandle[ arr[i] ] = handler; } } /** * Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b */ function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; } /** * Returns a function to use in pseudos for input types * @param {String} type */ function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } /** * Returns a function to use in pseudos for buttons * @param {String} type */ function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } /** * Returns a function to use in pseudos for positionals * @param {Function} fn */ function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Checks a node for validity as a Sizzle context * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ function testContext( context ) { return context && typeof context.getElementsByTagName !== "undefined" && context; } // Expose support vars for convenience support = Sizzle.support = {}; /** * Detects XML nodes * @param {Element|Object} elem An element or a document * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc; // If no document and documentElement is available, return if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { return document; } // Set our document document = doc; docElem = doc.documentElement; parent = doc.defaultView; // Support: IE>8 // If iframe document is assigned to "document" variable and if iframe has been reloaded, // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 // IE6-8 do not support the defaultView property so parent will be undefined if ( parent && parent !== parent.top ) { // IE11 does not have attachEvent, so all must suffer if ( parent.addEventListener ) { parent.addEventListener( "unload", unloadHandler, false ); } else if ( parent.attachEvent ) { parent.attachEvent( "onunload", unloadHandler ); } } /* Support tests ---------------------------------------------------------------------- */ documentIsHTML = !isXML( doc ); /* Attributes ---------------------------------------------------------------------- */ // Support: IE<8 // Verify that getAttribute really returns attributes and not properties // (excepting IE8 booleans) support.attributes = assert(function( div ) { div.className = "i"; return !div.getAttribute("className"); }); /* getElement(s)By* ---------------------------------------------------------------------- */ // Check if getElementsByTagName("*") returns only elements support.getElementsByTagName = assert(function( div ) { div.appendChild( doc.createComment("") ); return !div.getElementsByTagName("*").length; }); // Support: IE<9 support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); // Support: IE<10 // Check if getElementById returns elements by name // The broken getElementById methods don't pick up programatically-set names, // so use a roundabout getElementsByName test support.getById = assert(function( div ) { docElem.appendChild( div ).id = expando; return !doc.getElementsByName || !doc.getElementsByName( expando ).length; }); // ID find and filter if ( support.getById ) { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [ m ] : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; } else { // Support: IE6/7 // getElementById is not reliable as a find shortcut delete Expr.find["ID"]; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; } // Tag Expr.find["TAG"] = support.getElementsByTagName ? function( tag, context ) { if ( typeof context.getElementsByTagName !== "undefined" ) { return context.getElementsByTagName( tag ); // DocumentFragment nodes don't have gEBTN } else if ( support.qsa ) { return context.querySelectorAll( tag ); } } : function( tag, context ) { var elem, tmp = [], i = 0, // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { while ( (elem = results[i++]) ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }; // Class Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { if ( documentIsHTML ) { return context.getElementsByClassName( className ); } }; /* QSA/matchesSelector ---------------------------------------------------------------------- */ // QSA and matchesSelector support // matchesSelector(:active) reports false when true (IE9/Opera 11.5) rbuggyMatches = []; // qSa(:focus) reports false when true (Chrome 21) // We allow this because of a bug in IE8/9 that throws an error // whenever `document.activeElement` is accessed on an iframe // So, we allow :focus to pass through QSA all the time to avoid the IE error // See http://bugs.jquery.com/ticket/13378 rbuggyQSA = []; if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explicitly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\f]' msallowcapture=''>" + "<option selected=''></option></select>"; // Support: IE8, Opera 11-12.16 // Nothing should be selected when empty strings follow ^= or $= or *= // The test attribute must be unknown in Opera but "safe" for WinRT // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section if ( div.querySelectorAll("[msallowcapture^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } // Support: IE8 // Boolean attributes and "value" are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { rbuggyQSA.push("~="); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } // Support: Safari 8+, iOS 8+ // https://bugs.webkit.org/show_bug.cgi?id=136851 // In-page `selector#id sibing-combinator selector` fails if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { rbuggyQSA.push(".#.+[+~]"); } }); assert(function( div ) { // Support: Windows 8 Native Apps // The type and name attributes are restricted during .innerHTML assignment var input = doc.createElement("input"); input.setAttribute( "type", "hidden" ); div.appendChild( input ).setAttribute( "name", "D" ); // Support: IE8 // Enforce case-sensitivity of name attribute if ( div.querySelectorAll("[name=d]").length ) { rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) support.disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead matches.call( div, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); /* Contains ---------------------------------------------------------------------- */ hasCompare = rnative.test( docElem.compareDocumentPosition ); // Element contains another // Purposefully does not implement inclusive descendent // As in, an element does not contain itself contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; /* Sorting ---------------------------------------------------------------------- */ // Document order sorting sortOrder = hasCompare ? function( a, b ) { // Flag for duplicate removal if ( a === b ) { hasDuplicate = true; return 0; } // Sort on method existence if only one input has compareDocumentPosition var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; if ( compare ) { return compare; } // Calculate position if both inputs belong to the same document compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? a.compareDocumentPosition( b ) : // Otherwise we know they are disconnected 1; // Disconnected nodes if ( compare & 1 || (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { // Choose the first element that is related to our preferred document if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { return -1; } if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { return 1; } // Maintain original order return sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; } : function( a, b ) { // Exit early if the nodes are identical if ( a === b ) { hasDuplicate = true; return 0; } var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ]; // Parentless nodes are either documents or disconnected if ( !aup || !bup ) { return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; // If the nodes are siblings, we can do a quick check } else if ( aup === bup ) { return siblingCheck( a, b ); } // Otherwise we need full lists of their ancestors for comparison cur = a; while ( (cur = cur.parentNode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentNode) ) { bp.unshift( cur ); } // Walk down the tree looking for a discrepancy while ( ap[i] === bp[i] ) { i++; } return i ? // Do a sibling check if the nodes have a common ancestor siblingCheck( ap[i], bp[i] ) : // Otherwise nodes in our document sort first ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; return doc; }; Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); if ( support.matchesSelector && documentIsHTML && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch (e) {} } return Sizzle( expr, document, null, [ elem ] ).length > 0; }; Sizzle.contains = function( context, elem ) { // Set document vars if needed if ( ( context.ownerDocument || context ) !== document ) { setDocument( context ); } return contains( context, elem ); }; Sizzle.attr = function( elem, name ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } var fn = Expr.attrHandle[ name.toLowerCase() ], // Don't get fooled by Object.prototype properties (jQuery #13807) val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? fn( elem, name, !documentIsHTML ) : undefined; return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute( name ) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; /** * Document sorting and removing duplicates * @param {ArrayLike} results */ Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; // Unless we *know* we can detect duplicates, assume their presence hasDuplicate = !support.detectDuplicates; sortInput = !support.sortStable && results.slice( 0 ); results.sort( sortOrder ); if ( hasDuplicate ) { while ( (elem = results[i++]) ) { if ( elem === results[ i ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } // Clear input after sorting to release objects // See https://github.com/jquery/sizzle/pull/225 sortInput = null; return results; }; /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { // If no nodeType, this is expected to be an array while ( (node = elem[i++]) ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (jQuery #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes return ret; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1].slice( 0, 3 ) === "nth" ) { // nth-* requires argument if ( !match[3] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); // other types prohibit arguments } else if ( match[3] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var excess, unquoted = !match[6] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is if ( match[3] ) { match[2] = match[4] || match[5] || ""; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index match[0] = match[0].slice( 0, excess ); match[2] = unquoted.slice( 0, excess ); } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "TAG": function( nodeNameSelector ) { var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, what, argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; return first === 1 && last === 0 ? // Shortcut for :nth-*(n) function( elem ) { return !!elem.parentNode; } : function( elem, context, xml ) { var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType; if ( parent ) { // :(first|last|only)-(child|of-type) if ( simple ) { while ( dir ) { node = elem; while ( (node = node[ dir ]) ) { if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { return false; } } // Reverse direction for :only-* (if we haven't yet done so) start = dir = type === "only" && !start && "nextSibling"; } return true; } start = [ forward ? parent.firstChild : parent.lastChild ]; // non-xml :nth-child(...) stores cache data on `parent` if ( forward && useCache ) { // Seek `elem` from a previously-cached index outerCache = parent[ expando ] || (parent[ expando ] = {}); cache = outerCache[ type ] || []; nodeIndex = cache[0] === dirruns && cache[1]; diff = cache[0] === dirruns && cache[2]; node = nodeIndex && parent.childNodes[ nodeIndex ]; while ( (node = ++nodeIndex && node && node[ dir ] || // Fallback to seeking `elem` from the start (diff = nodeIndex = 0) || start.pop()) ) { // When found, cache indexes on `parent` and break if ( node.nodeType === 1 && ++diff && node === elem ) { outerCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } // Use previously-cached element index if available } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { diff = cache[1]; // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) } else { // Use the same loop as above to seek `elem` from the start while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { // Cache the index of each encountered element if ( useCache ) { (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; } if ( node === elem ) { break; } } } } // Incorporate the offset, then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { // Potentially complex pseudos "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); // Don't keep the element (issue #299) input[0] = null; return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { text = text.replace( runescape, funescape ); return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), // "Whether an element is represented by a :lang() selector // is based solely on the element's language value // being equal to the identifier C, // or beginning with the identifier C immediately followed by "-". // The matching of C against the element's language value is performed case-insensitively. // The identifier C does not have to be a valid language name." // http://www.w3.org/TR/selectors/#lang-pseudo "lang": markFunction( function( lang ) { // lang value must be a valid identifier if ( !ridentifier.test(lang || "") ) { Sizzle.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { var elemLang; do { if ( (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { elemLang = elemLang.toLowerCase(); return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; } } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); return false; }; }), // Miscellaneous "target": function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docElem; }, "focus": function( elem ) { return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, // Boolean properties "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, // Contents "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), // but not by others (comment: 8; processing instruction: 7; etc.) // nodeType < 6 works because attributes (2) do not appear as children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { if ( elem.nodeType < 6 ) { return false; } } return true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, // Element/input types "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && // Support: IE<8 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); }, // Position-in-collection "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); } for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } // Easy API for creating new setFilters function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); tokenize = Sizzle.tokenize = function( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( (tokens = []) ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); tokens.push({ value: matched, // Cast descendant combinators to space type: match[0].replace( rtrim, " " ) }); soFar = soFar.slice( matched.length ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); tokens.push({ value: matched, type: type, matches: match }); soFar = soFar.slice( matched.length ); } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); }; function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var oldCache, outerCache, newCache = [ dirruns, doneName ]; // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); if ( (oldCache = outerCache[ dir ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements return (newCache[ 2 ] = oldCache[ 2 ]); } else { // Reuse newcache so results back-propagate to previous elements outerCache[ dir ] = newCache; // A match means we're done; a fail means we have to keep checking if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { return true; } } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); // Avoid hanging onto element (issue #299) checkContext = null; return ret; } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && toSelector( // If the preceding token was a descendant combinator, insert an implicit any-element `*` tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, // We must always have either seed elements or outermost context elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length; if ( outermost ) { outermostContext = context !== document && context; } // Add elements passing elementMatchers directly to results // Keep `i` a string if there are no elements so `matchedCount` will be "00" below // Support: IE<9, Safari // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // Apply set filters to unmatched elements matchedCount += i; if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !match ) { match = tokenize( selector ); } i = match.length; while ( i-- ) { cached = matcherFromTokens( match[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); // Save selector and tokenization cached.selector = selector; } return cached; }; /** * A low-level selection function that works with Sizzle's compiled * selector functions * @param {String|Function} selector A selector or a pre-compiled * selector function built with Sizzle.compile * @param {Element} context * @param {Array} [results] * @param {Array} [seed] A set of elements to match against */ select = Sizzle.select = function( selector, context, results, seed ) { var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize( (selector = compiled.selector || selector) ); results = results || []; // Try to minimize operations if there is no seed and only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { return results; // Precompiled matchers will still verify ancestry, so step up a level } else if ( compiled ) { context = context.parentNode; } selector = selector.slice( tokens.shift().value.length ); } // Fetch a seed set for right-to-left matching i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, seed ); return results; } break; } } } } // Compile and execute a filtering function if one is not provided // Provide `match` to avoid retokenization if we modified the selector above ( compiled || compile( selector, match ) )( seed, context, !documentIsHTML, results, rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; }; // One-time assignments // Sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; // Support: Chrome 14-35+ // Always assume duplicates if they aren't passed to the comparison function support.detectDuplicates = !!hasDuplicate; // Initialize against the default document setDocument(); // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) // Detached nodes confoundingly follow *each other* support.sortDetached = assert(function( div1 ) { // Should return 1, but returns 4 (following) return div1.compareDocumentPosition( document.createElement("div") ) & 1; }); // Support: IE<8 // Prevent attribute/property "interpolation" // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !assert(function( div ) { div.innerHTML = "<a href='#'></a>"; return div.firstChild.getAttribute("href") === "#" ; }) ) { addHandle( "type|href|height|width", function( elem, name, isXML ) { if ( !isXML ) { return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); } }); } // Support: IE<9 // Use defaultValue in place of getAttribute("value") if ( !support.attributes || !assert(function( div ) { div.innerHTML = "<input/>"; div.firstChild.setAttribute( "value", "" ); return div.firstChild.getAttribute( "value" ) === ""; }) ) { addHandle( "value", function( elem, name, isXML ) { if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { return elem.defaultValue; } }); } // Support: IE<9 // Use getAttributeNode to fetch booleans when getAttribute lies if ( !assert(function( div ) { return div.getAttribute("disabled") == null; }) ) { addHandle( booleans, function( elem, name, isXML ) { var val; if ( !isXML ) { return elem[ name ] === true ? name.toLowerCase() : (val = elem.getAttributeNode( name )) && val.specified ? val.value : null; } }); } return Sizzle; })( window ); jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; var rneedsContext = jQuery.expr.match.needsContext; var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); var risSimple = /^.[^:#\[\.,]*$/; // Implement the identical functionality for filter and not function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; }); } if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; }); } if ( typeof qualifier === "string" ) { if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not ); } qualifier = jQuery.filter( qualifier, elements ); } return jQuery.grep( elements, function( elem ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; }); } jQuery.filter = function( expr, elems, not ) { var elem = elems[ 0 ]; if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { return elem.nodeType === 1; })); }; jQuery.fn.extend({ find: function( selector ) { var i, ret = [], self = this, len = self.length; if ( typeof selector !== "string" ) { return this.pushStack( jQuery( selector ).filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } }) ); } for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } // Needed because $( selector, context ) becomes $( context ).find( selector ) ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); ret.selector = this.selector ? this.selector + " " + selector : selector; return ret; }, filter: function( selector ) { return this.pushStack( winnow(this, selector || [], false) ); }, not: function( selector ) { return this.pushStack( winnow(this, selector || [], true) ); }, is: function( selector ) { return !!winnow( this, // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". typeof selector === "string" && rneedsContext.test( selector ) ? jQuery( selector ) : selector || [], false ).length; } }); // Initialize a jQuery object // A central reference to the root jQuery(document) var rootjQuery, // Use the correct document accordingly with window argument (sandbox) document = window.document, // A simple way to check for HTML strings // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) // Strict HTML recognition (#11290: must start with <) rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, init = jQuery.fn.init = function( selector, context ) { var match, elem; // HANDLE: $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // Handle HTML strings if ( typeof selector === "string" ) { if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; // scripts is true for back-compat // Intentionally let the error be thrown if parseHTML is not present jQuery.merge( this, jQuery.parseHTML( match[1], context && context.nodeType ? context.ownerDocument || context : document, true ) ); // HANDLE: $(html, props) if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { for ( match in context ) { // Properties of context are called as methods if possible if ( jQuery.isFunction( this[ match ] ) ) { this[ match ]( context[ match ] ); // ...and otherwise set as attributes } else { this.attr( match, context[ match ] ); } } } return this; // HANDLE: $(#id) } else { elem = document.getElementById( match[2] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjQuery ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(DOMElement) } else if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return typeof rootjQuery.ready !== "undefined" ? rootjQuery.ready( selector ) : // Execute immediately if ready is not present selector( jQuery ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }; // Give the init function the jQuery prototype for later instantiation init.prototype = jQuery.fn; // Initialize central reference rootjQuery = jQuery( document ); var rparentsprev = /^(?:parents|prev(?:Until|All))/, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.extend({ dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); jQuery.fn.extend({ has: function( target ) { var i, targets = jQuery( target, this ), len = targets.length; return this.filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, matched = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { // Always skip document fragments if ( cur.nodeType < 11 && (pos ? pos.index(cur) > -1 : // Don't pass non-elements to Sizzle cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors)) ) { matched.push( cur ); break; } } } return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; } // index in selector if ( typeof elem === "string" ) { return jQuery.inArray( this[0], jQuery( elem ) ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { return this.pushStack( jQuery.unique( jQuery.merge( this.get(), jQuery( selector, context ) ) ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter(selector) ); } }); function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodeType !== 1 ); return cur; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); if ( name.slice( -5 ) !== "Until" ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } if ( this.length > 1 ) { // Remove duplicates if ( !guaranteedUnique[ name ] ) { ret = jQuery.unique( ret ); } // Reverse order for parents* and prev-derivatives if ( rparentsprev.test( name ) ) { ret = ret.reverse(); } } return this.pushStack( ret ); }; }); var rnotwhite = (/\S+/g); // String to Object options format cache var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; }); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? ( optionsCache[ options ] || createOptions( options ) ) : jQuery.extend( {}, options ); var // Flag to know if list is currently firing firing, // Last fire value (for non-forgettable lists) memory, // Flag to know if list was already fired fired, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // First callback to fire (used internally by add and fireWith) firingStart, // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = !options.once && [], // Fire callbacks fire = function( data ) { memory = options.memory && data; fired = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; firing = true; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { memory = false; // To prevent further calls using add break; } } firing = false; if ( list ) { if ( stack ) { if ( stack.length ) { fire( stack.shift() ); } } else if ( memory ) { list = []; } else { self.disable(); } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // First, we save the current length var start = list.length; (function add( args ) { jQuery.each( args, function( _, arg ) { var type = jQuery.type( arg ); if ( type === "function" ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && type !== "string" ) { // Inspect recursively add( arg ); } }); })( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away } else if ( memory ) { firingStart = start; fire( memory ); } } return this; }, // Remove a callback from the list remove: function() { if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( firing ) { if ( index <= firingLength ) { firingLength--; } if ( index <= firingIndex ) { firingIndex--; } } } }); } return this; }, // Check if a given callback is in the list. // If no argument is given, return whether or not list has callbacks attached. has: function( fn ) { return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); }, // Remove all callbacks from the list empty: function() { list = []; firingLength = 0; return this; }, // Have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function() { return !list; }, // Lock the list in its current state lock: function() { stack = undefined; if ( !memory ) { self.disable(); } return this; }, // Is it locked? locked: function() { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { if ( list && ( !fired || stack ) ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; if ( firing ) { stack.push( args ); } else { fire( args ); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], [ "notify", "progress", jQuery.Callbacks("memory") ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[1] ](function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .done( newDefer.resolve ) .fail( newDefer.reject ) .progress( newDefer.notify ); } else { newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); } }); }); fns = null; }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[1] ] = list.add; // Handle state if ( stateString ) { list.add(function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] deferred[ tuple[0] ] = function() { deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); return this; }; deferred[ tuple[0] + "With" ] = list.fireWith; }); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !(--remaining) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ) .progress( updateFunc( i, progressContexts, progressValues ) ); } else { --remaining; } } } // if we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } }); // The deferred used on DOM ready var readyList; jQuery.fn.ready = function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); return this; }; jQuery.extend({ // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready ); } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.triggerHandler ) { jQuery( document ).triggerHandler( "ready" ); jQuery( document ).off( "ready" ); } } }); /** * Clean-up method for dom ready events */ function detach() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", completed, false ); window.removeEventListener( "load", completed, false ); } else { document.detachEvent( "onreadystatechange", completed ); window.detachEvent( "onload", completed ); } } /** * The ready event handler and self cleanup method */ function completed() { // readyState === "complete" is good enough for us to call the dom ready in oldIE if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { detach(); jQuery.ready(); } } jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called after the browser event has already occurred. // we once tried to use readyState "interactive" here, but it caused issues like the one // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready ); // Standards-based browsers support DOMContentLoaded } else if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", completed, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", completed, false ); // If IE event model is used } else { // Ensure firing before onload, maybe late but safe also for iframes document.attachEvent( "onreadystatechange", completed ); // A fallback to window.onload, that will always work window.attachEvent( "onload", completed ); // If IE and not a frame // continually check to see if the document is ready var top = false; try { top = window.frameElement == null && document.documentElement; } catch(e) {} if ( top && top.doScroll ) { (function doScrollCheck() { if ( !jQuery.isReady ) { try { // Use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ top.doScroll("left"); } catch(e) { return setTimeout( doScrollCheck, 50 ); } // detach all dom ready events detach(); // and execute any waiting functions jQuery.ready(); } })(); } } } return readyList.promise( obj ); }; var strundefined = typeof undefined; // Support: IE<9 // Iteration over object's inherited properties before its own var i; for ( i in jQuery( support ) ) { break; } support.ownLast = i !== "0"; // Note: most support tests are defined in their respective modules. // false until the test is run support.inlineBlockNeedsLayout = false; // Execute ASAP in case we need to set body.style.zoom jQuery(function() { // Minified: var a,b,c,d var val, div, body, container; body = document.getElementsByTagName( "body" )[ 0 ]; if ( !body || !body.style ) { // Return for frameset docs that don't have a body return; } // Setup div = document.createElement( "div" ); container = document.createElement( "div" ); container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; body.appendChild( container ).appendChild( div ); if ( typeof div.style.zoom !== strundefined ) { // Support: IE<8 // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; if ( val ) { // Prevent IE 6 from affecting layout for positioned elements #11048 // Prevent IE from shrinking the body in IE 7 mode #12869 // Support: IE<8 body.style.zoom = 1; } } body.removeChild( container ); }); (function() { var div = document.createElement( "div" ); // Execute the test only if not already executed in another module. if (support.deleteExpando == null) { // Support: IE<9 support.deleteExpando = true; try { delete div.test; } catch( e ) { support.deleteExpando = false; } } // Null elements to avoid leaks in IE. div = null; })(); /** * Determines whether an object can have data */ jQuery.acceptData = function( elem ) { var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ], nodeType = +elem.nodeType || 1; // Do not set data on non-element DOM nodes because it will not be cleared (#8335). return nodeType !== 1 && nodeType !== 9 ? false : // Nodes accept data unless otherwise specified; rejection can be conditional !noData || noData !== true && elem.getAttribute("classid") === noData; }; var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /([A-Z])/g; function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isEmptyDataObject( obj ) { var name; for ( name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; } function internalData( elem, name, data, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var ret, thisCache, internalKey = jQuery.expando, // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { return; } if ( !id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; } else { id = internalKey; } } if ( !cache[ id ] ) { // Avoid exposing jQuery metadata on plain JS objects when the object // is serialized using JSON.stringify cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } thisCache = cache[ id ]; // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thisCache.data ) { thisCache.data = {}; } thisCache = thisCache.data; } if ( data !== undefined ) { thisCache[ jQuery.camelCase( name ) ] = data; } // Check for both converted-to-camel and non-converted data property names // If a data property was specified if ( typeof name === "string" ) { // First Try to find as-is property data ret = thisCache[ name ]; // Test for null|undefined property data if ( ret == null ) { // Try to find the camelCased property ret = thisCache[ jQuery.camelCase( name ) ]; } } else { ret = thisCache; } return ret; } function internalRemoveData( elem, name, pvt ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, i, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, id = isNode ? elem[ jQuery.expando ] : jQuery.expando; // If there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { // Support array or space separated string names for data keys if ( !jQuery.isArray( name ) ) { // try the string as a key before any manipulation if ( name in thisCache ) { name = [ name ]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jQuery.camelCase( name ); if ( name in thisCache ) { name = [ name ]; } else { name = name.split(" "); } } } else { // If "name" is an array of keys... // When data is initially created, via ("key", "val") signature, // keys will be converted to camelCase. // Since there is no way to tell _how_ a key was added, remove // both plain key and camelCase key. #12786 // This will only penalize the array argument path. name = name.concat( jQuery.map( name, jQuery.camelCase ) ); } i = name.length; while ( i-- ) { delete thisCache[ name[i] ]; } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { return; } } } // See jQuery.data for more information if ( !pvt ) { delete cache[ id ].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isEmptyDataObject( cache[ id ] ) ) { return; } } // Destroy the cache if ( isNode ) { jQuery.cleanData( [ elem ], true ); // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) /* jshint eqeqeq: false */ } else if ( support.deleteExpando || cache != cache.window ) { /* jshint eqeqeq: true */ delete cache[ id ]; // When all else fails, null } else { cache[ id ] = null; } } jQuery.extend({ cache: {}, // The following elements (space-suffixed to avoid Object.prototype collisions) // throw uncatchable exceptions if you attempt to set expando properties noData: { "applet ": true, "embed ": true, // ...but Flash objects (which have this classid) *can* handle expandos "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); }, data: function( elem, name, data ) { return internalData( elem, name, data ); }, removeData: function( elem, name ) { return internalRemoveData( elem, name ); }, // For internal use only. _data: function( elem, name, data ) { return internalData( elem, name, data, true ); }, _removeData: function( elem, name ) { return internalRemoveData( elem, name, true ); } }); jQuery.fn.extend({ data: function( key, value ) { var i, name, data, elem = this[0], attrs = elem && elem.attributes; // Special expections of .data basically thwart jQuery.access, // so implement the relevant behavior ourselves // Gets all values if ( key === undefined ) { if ( this.length ) { data = jQuery.data( elem ); if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { i = attrs.length; while ( i-- ) { // Support: IE11+ // The attrs elements can be null (#14894) if ( attrs[ i ] ) { name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { name = jQuery.camelCase( name.slice(5) ); dataAttr( elem, name, data[ name ] ); } } } jQuery._data( elem, "parsedAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } return arguments.length > 1 ? // Sets one value this.each(function() { jQuery.data( this, key, value ); }) : // Gets one value // Try to fetch any internally stored data first elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); jQuery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = jQuery._data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray(data) ) { queue = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // not intended for public consumption - generates a queueHooks object, or returns the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return jQuery._data( elem, key ) || jQuery._data( elem, key, { empty: jQuery.Callbacks("once memory").add(function() { jQuery._removeData( elem, type + "queue" ); jQuery._removeData( elem, key ); }) }); } }); jQuery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jQuery.queue( this, type, data ); // ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while ( i-- ) { tmp = jQuery._data( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } }); var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; var isHidden = function( elem, el ) { // isHidden might be called from jQuery#filter function; // in that case, element will be second argument elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); }; // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, length = elems.length, bulk = key == null; // Sets many values if ( jQuery.type( key ) === "object" ) { chainable = true; for ( i in key ) { jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); } // Sets one value } else if ( value !== undefined ) { chainable = true; if ( !jQuery.isFunction( value ) ) { raw = true; } if ( bulk ) { // Bulk operations run against the entire set if ( raw ) { fn.call( elems, value ); fn = null; // ...except when executing function values } else { bulk = fn; fn = function( elem, key, value ) { return bulk.call( jQuery( elem ), value ); }; } } if ( fn ) { for ( ; i < length; i++ ) { fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); } } } return chainable ? elems : // Gets bulk ? fn.call( elems ) : length ? fn( elems[0], key ) : emptyGet; }; var rcheckableType = (/^(?:checkbox|radio)$/i); (function() { // Minified: var a,b,c var input = document.createElement( "input" ), div = document.createElement( "div" ), fragment = document.createDocumentFragment(); // Setup div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; // IE strips leading whitespace when .innerHTML is used support.leadingWhitespace = div.firstChild.nodeType === 3; // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables support.tbody = !div.getElementsByTagName( "tbody" ).length; // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; // Makes sure cloning an html5 element does not cause problems // Where outerHTML is undefined, this still works support.html5Clone = document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; // Check if a disconnected checkbox will retain its checked // value of true after appended to the DOM (IE6/7) input.type = "checkbox"; input.checked = true; fragment.appendChild( input ); support.appendChecked = input.checked; // Make sure textarea (and checkbox) defaultValue is properly cloned // Support: IE6-IE11+ div.innerHTML = "<textarea>x</textarea>"; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; // #11217 - WebKit loses check when the name is after the checked attribute fragment.appendChild( div ); div.innerHTML = "<input type='radio' checked='checked' name='t'/>"; // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 // old WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE<9 // Opera does not clone events (and typeof div.attachEvent === undefined). // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() support.noCloneEvent = true; if ( div.attachEvent ) { div.attachEvent( "onclick", function() { support.noCloneEvent = false; }); div.cloneNode( true ).click(); } // Execute the test only if not already executed in another module. if (support.deleteExpando == null) { // Support: IE<9 support.deleteExpando = true; try { delete div.test; } catch( e ) { support.deleteExpando = false; } } })(); (function() { var i, eventName, div = document.createElement( "div" ); // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) for ( i in { submit: true, change: true, focusin: true }) { eventName = "on" + i; if ( !(support[ i + "Bubbles" ] = eventName in window) ) { // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) div.setAttribute( eventName, "t" ); support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; } } // Null elements to avoid leaks in IE. div = null; })(); var rformElems = /^(?:input|select|textarea)$/i, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; function returnTrue() { return true; } function returnFalse() { return false; } function safeActiveElement() { try { return document.activeElement; } catch ( err ) { } } /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { global: {}, add: function( elem, types, handler, data, selector ) { var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data( elem ); // Don't attach events to noData or text/comment nodes (but allow plain objects) if ( !elemData ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first if ( !(events = elemData.events) ) { events = elemData.events = {}; } if ( !(eventHandle = elemData.handle) ) { eventHandle = elemData.handle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // There *must* be a type, no attaching namespace-only handlers if ( !type ) { continue; } // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: origType, data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join(".") }, handleObjIn ); // Init the event handler queue if we're the first if ( !(handlers = events[ type ]) ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData( elem ) && jQuery._data( elem ); if ( !elemData || !(events = elemData.events) ) { return; } // Once for each type.namespace in types; type may be omitted types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector ? special.delegateType : special.bindType ) || type; handlers = events[ type ] || []; tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); // Remove matching events origCount = j = handlers.length; while ( j-- ) { handleObj = handlers[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !tmp || tmp.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { handlers.splice( j, 1 ); if ( handleObj.selector ) { handlers.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( origCount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery._removeData( elem, "events" ); } }, trigger: function( event, data, elem, onlyHandlers ) { var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [ elem || document ], type = hasOwn.call( event, "type" ) ? event.type : event, namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; cur = tmp = elem = elem || document; // Don't do events on text and comment nodes if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf(".") >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } ontype = type.indexOf(":") < 0 && "on" + type; // Caller can pass in a jQuery.Event object, Object, or just an event type string event = event[ jQuery.expando ] ? event : new jQuery.Event( type, typeof event === "object" && event ); // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) event.isTrigger = onlyHandlers ? 2 : 3; event.namespace = namespaces.join("."); event.namespace_re = event.namespace ? new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : null; // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data == null ? [ event ] : jQuery.makeArray( data, [ event ] ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; if ( !rfocusMorph.test( bubbleType + type ) ) { cur = cur.parentNode; } for ( ; cur; cur = cur.parentNode ) { eventPath.push( cur ); tmp = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( tmp === (elem.ownerDocument || document) ) { eventPath.push( tmp.defaultView || tmp.parentWindow || window ); } } // Fire handlers on the event path i = 0; while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { event.type = i > 1 ? bubbleType : special.bindType || type; // jQuery handler handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Native handler handle = ontype && cur[ ontype ]; if ( handle && handle.apply && jQuery.acceptData( cur ) ) { event.result = handle.apply( cur, data ); if ( event.result === false ) { event.preventDefault(); } } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method tmp = elem[ ontype ]; if ( tmp ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; try { elem[ type ](); } catch ( e ) { // IE<9 dies on focus/blur to hidden element (#1486,#12518) // only reproducible on winXP IE8 native, not IE9 in IE8 mode } jQuery.event.triggered = undefined; if ( tmp ) { elem[ ontype ] = tmp; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event ); var i, ret, handleObj, matched, j, handlerQueue = [], args = slice.call( arguments ), handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers handlerQueue = jQuery.event.handlers.call( this, event, handlers ); // Run delegates first; they may want to stop propagation beneath us i = 0; while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { event.currentTarget = matched.elem; j = 0; while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { // Triggered event must either 1) have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { event.handleObj = handleObj; event.data = handleObj.data; ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { if ( (event.result = ret) === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, handlers: function( event, handlers ) { var sel, handleObj, matches, i, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; // Find delegate handlers // Black-hole SVG <use> instance trees (#13180) // Avoid non-left-click bubbling in Firefox (#3861) if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { /* jshint eqeqeq: false */ for ( ; cur != this; cur = cur.parentNode || this ) { /* jshint eqeqeq: true */ // Don't check non-elements (#13208) // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; if ( matches[ sel ] === undefined ) { matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( matches[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, handlers: matches }); } } } } // Add the remaining (directly-bound) handlers if ( delegateCount < handlers.length ) { handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); } return handlerQueue; }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, copy, type = event.type, originalEvent = event, fixHook = this.fixHooks[ type ]; if ( !fixHook ) { this.fixHooks[ type ] = fixHook = rmouseEvent.test( type ) ? this.mouseHooks : rkeyEvent.test( type ) ? this.keyHooks : {}; } copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = new jQuery.Event( originalEvent ); i = copy.length; while ( i-- ) { prop = copy[ i ]; event[ prop ] = originalEvent[ prop ]; } // Support: IE<9 // Fix target property (#1925) if ( !event.target ) { event.target = originalEvent.srcElement || document; } // Support: Chrome 23+, Safari? // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // Support: IE<9 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) event.metaKey = !!event.metaKey; return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, // Includes some event props shared by KeyEvent and MouseEvent props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var body, eventDoc, doc, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add relatedTarget, if necessary if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { // Fire native event if possible so blur/focus sequence is correct trigger: function() { if ( this !== safeActiveElement() && this.focus ) { try { this.focus(); return false; } catch ( e ) { // Support: IE<9 // If we error on focus to hidden element (#1486, #12518), // let .trigger() run the handlers } } }, delegateType: "focusin" }, blur: { trigger: function() { if ( this === safeActiveElement() && this.blur ) { this.blur(); return false; } }, delegateType: "focusout" }, click: { // For checkbox, fire native event so checked state will be right trigger: function() { if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { this.click(); return false; } }, // For cross-browser consistency, don't fire native .click() on links _default: function( event ) { return jQuery.nodeName( event.target, "a" ); } }, beforeunload: { postDispatch: function( event ) { // Support: Firefox 20+ // Firefox doesn't alert if the returnValue field is not set. if ( event.result !== undefined && event.originalEvent ) { event.originalEvent.returnValue = event.result; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { var name = "on" + type; if ( elem.detachEvent ) { // #8545, #7054, preventing memory leaks for custom events in IE6-8 // detachEvent needed property on element, by name of that event, to properly expose it to GC if ( typeof elem[ name ] === strundefined ) { elem[ name ] = null; } elem.detachEvent( name, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && // Support: IE < 9, Android < 4.0 src.returnValue === false ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; if ( !e ) { return; } // If preventDefault exists, run it on the original event if ( e.preventDefault ) { e.preventDefault(); // Support: IE // Otherwise set the returnValue property of the original event to false } else { e.returnValue = false; } }, stopPropagation: function() { var e = this.originalEvent; this.isPropagationStopped = returnTrue; if ( !e ) { return; } // If stopPropagation exists, run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // Support: IE // Set the cancelBubble property of the original event to true e.cancelBubble = true; }, stopImmediatePropagation: function() { var e = this.originalEvent; this.isImmediatePropagationStopped = returnTrue; if ( e && e.stopImmediatePropagation ) { e.stopImmediatePropagation(); } this.stopPropagation(); } }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || (related !== target && !jQuery.contains( target, related )) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // IE submit delegation if ( !support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add( this, "click._submit keypress._submit", function( e ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; if ( form && !jQuery._data( form, "submitBubbles" ) ) { jQuery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); jQuery._data( form, "submitBubbles", true ); } }); // return undefined since we don't need an event listener }, postDispatch: function( event ) { // If form was submitted by the user, bubble the event up the tree if ( event._submit_bubble ) { delete event._submit_bubble; if ( this.parentNode && !event.isTrigger ) { jQuery.event.simulate( "submit", this.parentNode, event, true ); } } }, teardown: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove( this, "._submit" ); } }; } // IE change delegation and checkbox/radio fix if ( !support.changeBubbles ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._just_changed = true; } }); jQuery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.isTrigger ) { this._just_changed = false; } // Allow triggered, simulated change events (#11500) jQuery.event.simulate( "change", this, event, true ); }); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); jQuery._data( elem, "changeBubbles", true ); } }); }, handle: function( event ) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return !rformElems.test( this.nodeName ); } }; } // Create "bubbling" focus and blur events if ( !support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler on the document while someone wants focusin/focusout var handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { var doc = this.ownerDocument || this, attaches = jQuery._data( doc, fix ); if ( !attaches ) { doc.addEventListener( orig, handler, true ); } jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); }, teardown: function() { var doc = this.ownerDocument || this, attaches = jQuery._data( doc, fix ) - 1; if ( !attaches ) { doc.removeEventListener( orig, handler, true ); jQuery._removeData( doc, fix ); } else { jQuery._data( doc, fix, attaches ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var type, origFn; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { var elem = this[0]; if ( elem ) { return jQuery.event.trigger( type, data, elem, true ); } } }); function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; } var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /<tbody/i, rhtml = /<|&#?\w+;/, rnoInnerhtml = /<(?:script|style|link)/i, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /^$|\/(?:java|ecma)script/i, rscriptTypeMasked = /^true\/(.*)/, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, // We have to close these tags to support XHTML (#13200) wrapMap = { option: [ 1, "<select multiple='multiple'>", "</select>" ], legend: [ 1, "<fieldset>", "</fieldset>" ], area: [ 1, "<map>", "</map>" ], param: [ 1, "<object>", "</object>" ], thead: [ 1, "<table>", "</table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ], col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] }, safeFragment = createSafeFragment( document ), fragmentDiv = safeFragment.appendChild( document.createElement("div") ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; function getAll( context, tag ) { var elems, elem, i = 0, found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : undefined; if ( !found ) { for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { if ( !tag || jQuery.nodeName( elem, tag ) ) { found.push( elem ); } else { jQuery.merge( found, getAll( elem, tag ) ); } } } return tag === undefined || tag && jQuery.nodeName( context, tag ) ? jQuery.merge( [ context ], found ) : found; } // Used in buildFragment, fixes the defaultChecked property function fixDefaultChecked( elem ) { if ( rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } } // Support: IE<8 // Manipulating tables requires a tbody function manipulationTarget( elem, content ) { return jQuery.nodeName( elem, "table" ) && jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? elem.getElementsByTagName("tbody")[0] || elem.appendChild( elem.ownerDocument.createElement("tbody") ) : elem; } // Replace/restore the type attribute of script elements for safe DOM manipulation function disableScript( elem ) { elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; return elem; } function restoreScript( elem ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[1]; } else { elem.removeAttribute("type"); } return elem; } // Mark scripts as having already been evaluated function setGlobalEval( elems, refElements ) { var elem, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); } } function cloneCopyEvent( src, dest ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { return; } var type, i, l, oldData = jQuery._data( src ), curData = jQuery._data( dest, oldData ), events = oldData.events; if ( events ) { delete curData.handle; curData.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } // make the cloned public data object a copy from the original if ( curData.data ) { curData.data = jQuery.extend( {}, curData.data ); } } function fixCloneNodeIssues( src, dest ) { var nodeName, e, data; // We do not need to do anything for non-Elements if ( dest.nodeType !== 1 ) { return; } nodeName = dest.nodeName.toLowerCase(); // IE6-8 copies events bound via attachEvent when using cloneNode. if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { data = jQuery._data( dest ); for ( e in data.events ) { jQuery.removeEvent( dest, e, data.handle ); } // Event data gets referenced instead of copied if the expando gets copied too dest.removeAttribute( jQuery.expando ); } // IE blanks contents when cloning scripts, and tries to evaluate newly-set text if ( nodeName === "script" && dest.text !== src.text ) { disableScript( dest ).text = src.text; restoreScript( dest ); // IE6-10 improperly clones children of object elements using classid. // IE10 throws NoModificationAllowedError if parent is null, #12132. } else if ( nodeName === "object" ) { if ( dest.parentNode ) { dest.outerHTML = src.outerHTML; } // This path appears unavoidable for IE9. When cloning an object // element in IE9, the outerHTML strategy above is not sufficient. // If the src has innerHTML and the destination does not, // copy the src.innerHTML into the dest.innerHTML. #10324 if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { dest.innerHTML = src.innerHTML; } } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if ( dest.value !== src.value ) { dest.value = src.value; } // IE6-8 fails to return the selected option to the default selected // state when cloning options } else if ( nodeName === "option" ) { dest.defaultSelected = dest.selected = src.defaultSelected; // IE6-8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } } jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { var destElements, node, clone, i, srcElements, inPage = jQuery.contains( elem.ownerDocument, elem ); if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { clone = elem.cloneNode( true ); // IE<=8 does not properly clone detached, unknown element nodes } else { fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); } if ( (!support.noCloneEvent || !support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); // Fix all IE cloning issues for ( i = 0; (node = srcElements[i]) != null; ++i ) { // Ensure that the destination node is not null; Fixes #9587 if ( destElements[i] ) { fixCloneNodeIssues( node, destElements[i] ); } } } // Copy the events from the original to the clone if ( dataAndEvents ) { if ( deepDataAndEvents ) { srcElements = srcElements || getAll( elem ); destElements = destElements || getAll( clone ); for ( i = 0; (node = srcElements[i]) != null; i++ ) { cloneCopyEvent( node, destElements[i] ); } } else { cloneCopyEvent( elem, clone ); } } // Preserve script evaluation history destElements = getAll( clone, "script" ); if ( destElements.length > 0 ) { setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); } destElements = srcElements = node = null; // Return the cloned set return clone; }, buildFragment: function( elems, context, scripts, selection ) { var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length, // Ensure a safe fragment safe = createSafeFragment( context ), nodes = [], i = 0; for ( ; i < l; i++ ) { elem = elems[ i ]; if ( elem || elem === 0 ) { // Add nodes directly if ( jQuery.type( elem ) === "object" ) { jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); // Convert non-html into a text node } else if ( !rhtml.test( elem ) ) { nodes.push( context.createTextNode( elem ) ); // Convert html into DOM nodes } else { tmp = tmp || safe.appendChild( context.createElement("div") ); // Deserialize a standard representation tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; // Descend through wrappers to the right content j = wrap[0]; while ( j-- ) { tmp = tmp.lastChild; } // Manually add leading whitespace removed by IE if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); } // Remove IE's autoinserted <tbody> from table fragments if ( !support.tbody ) { // String was a <table>, *may* have spurious <tbody> elem = tag === "table" && !rtbody.test( elem ) ? tmp.firstChild : // String was a bare <thead> or <tfoot> wrap[1] === "<table>" && !rtbody.test( elem ) ? tmp : 0; j = elem && elem.childNodes.length; while ( j-- ) { if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { elem.removeChild( tbody ); } } } jQuery.merge( nodes, tmp.childNodes ); // Fix #12392 for WebKit and IE > 9 tmp.textContent = ""; // Fix #12392 for oldIE while ( tmp.firstChild ) { tmp.removeChild( tmp.firstChild ); } // Remember the top-level container for proper cleanup tmp = safe.lastChild; } } } // Fix #11356: Clear elements from fragment if ( tmp ) { safe.removeChild( tmp ); } // Reset defaultChecked for any radios and checkboxes // about to be appended to the DOM in IE 6/7 (#8060) if ( !support.appendChecked ) { jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); } i = 0; while ( (elem = nodes[ i++ ]) ) { // #4087 - If origin and destination elements are the same, and this is // that element, do not do anything if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { continue; } contains = jQuery.contains( elem.ownerDocument, elem ); // Append to fragment tmp = getAll( safe.appendChild( elem ), "script" ); // Preserve script evaluation history if ( contains ) { setGlobalEval( tmp ); } // Capture executables if ( scripts ) { j = 0; while ( (elem = tmp[ j++ ]) ) { if ( rscriptType.test( elem.type || "" ) ) { scripts.push( elem ); } } } } tmp = null; return safe; }, cleanData: function( elems, /* internal */ acceptData ) { var elem, type, id, data, i = 0, internalKey = jQuery.expando, cache = jQuery.cache, deleteExpando = support.deleteExpando, special = jQuery.event.special; for ( ; (elem = elems[i]) != null; i++ ) { if ( acceptData || jQuery.acceptData( elem ) ) { id = elem[ internalKey ]; data = id && cache[ id ]; if ( data ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Remove cache only if it was not already removed by jQuery.event.remove if ( cache[ id ] ) { delete cache[ id ]; // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( deleteExpando ) { delete elem[ internalKey ]; } else if ( typeof elem.removeAttribute !== strundefined ) { elem.removeAttribute( internalKey ); } else { elem[ internalKey ] = null; } deletedIds.push( id ); } } } } } }); jQuery.fn.extend({ text: function( value ) { return access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); }, null, value, arguments.length ); }, append: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.appendChild( elem ); } }); }, prepend: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.insertBefore( elem, target.firstChild ); } }); }, before: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } }); }, after: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this.nextSibling ); } }); }, remove: function( selector, keepData /* Internal Use Only */ ) { var elem, elems = selector ? jQuery.filter( selector, this ) : this, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem ) ); } if ( elem.parentNode ) { if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { setGlobalEval( getAll( elem, "script" ) ); } elem.parentNode.removeChild( elem ); } } return this; }, empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); } // Remove any remaining nodes while ( elem.firstChild ) { elem.removeChild( elem.firstChild ); } // If this is a select, ensure that it displays empty (#12336) // Support: IE<9 if ( elem.options && jQuery.nodeName( elem, "select" ) ) { elem.options.length = 0; } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map(function() { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( value ) { return access( this, function( value ) { var elem = this[ 0 ] || {}, i = 0, l = this.length; if ( value === undefined ) { return elem.nodeType === 1 ? elem.innerHTML.replace( rinlinejQuery, "" ) : undefined; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && ( support.htmlSerialize || !rnoshimcache.test( value ) ) && ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { value = value.replace( rxhtmlTag, "<$1></$2>" ); try { for (; i < l; i++ ) { // Remove element nodes and prevent memory leaks elem = this[i] || {}; if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch(e) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function() { var arg = arguments[ 0 ]; // Make the changes, replacing each context element with the new content this.domManip( arguments, function( elem ) { arg = this.parentNode; jQuery.cleanData( getAll( this ) ); if ( arg ) { arg.replaceChild( elem, this ); } }); // Force removal if there was no new content (e.g., from empty arguments) return arg && (arg.length || arg.nodeType) ? this : this.remove(); }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, callback ) { // Flatten any nested arrays args = concat.apply( [], args ); var first, node, hasScripts, scripts, doc, fragment, i = 0, l = this.length, set = this, iNoClone = l - 1, value = args[0], isFunction = jQuery.isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit if ( isFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return this.each(function( index ) { var self = set.eq( index ); if ( isFunction ) { args[0] = value.call( this, index, self.html() ); } self.domManip( args, callback ); }); } if ( l ) { fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } if ( first ) { scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); hasScripts = scripts.length; // Use the original fragment for the last item instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). for ( ; i < l; i++ ) { node = fragment; if ( i !== iNoClone ) { node = jQuery.clone( node, true, true ); // Keep references to cloned scripts for later restoration if ( hasScripts ) { jQuery.merge( scripts, getAll( node, "script" ) ); } } callback.call( this[i], node, i ); } if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; // Reenable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion for ( i = 0; i < hasScripts; i++ ) { node = scripts[ i ]; if ( rscriptType.test( node.type || "" ) && !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { if ( node.src ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl ) { jQuery._evalUrl( node.src ); } } else { jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); } } } } // Fix #11809: Avoid leaking memory fragment = first = null; } } return this; } }); jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, i = 0, ret = [], insert = jQuery( selector ), last = insert.length - 1; for ( ; i <= last; i++ ) { elems = i === last ? this : this.clone(true); jQuery( insert[i] )[ original ]( elems ); // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; }); var iframe, elemdisplay = {}; /** * Retrieve the actual display of a element * @param {String} name nodeName of the element * @param {Object} doc Document object */ // Called only from within defaultDisplay function actualDisplay( name, doc ) { var style, elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), // getDefaultComputedStyle might be reliably used only on attached element display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? // Use of this method is a temporary fix (more like optmization) until something better comes along, // since it was removed from specification and supported only in FF style.display : jQuery.css( elem[ 0 ], "display" ); // We don't have any data stored on the element, // so use "detach" method as fast way to get rid of the element elem.detach(); return display; } /** * Try to determine the default display value of an element * @param {String} nodeName */ function defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // Use the already-created iframe if possible iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement ); // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document; // Support: IE doc.write(); doc.close(); display = actualDisplay( nodeName, doc ); iframe.detach(); } // Store the correct default display elemdisplay[ nodeName ] = display; } return display; } (function() { var shrinkWrapBlocksVal; support.shrinkWrapBlocks = function() { if ( shrinkWrapBlocksVal != null ) { return shrinkWrapBlocksVal; } // Will be changed later if needed. shrinkWrapBlocksVal = false; // Minified: var b,c,d var div, body, container; body = document.getElementsByTagName( "body" )[ 0 ]; if ( !body || !body.style ) { // Test fired too early or in an unsupported environment, exit. return; } // Setup div = document.createElement( "div" ); container = document.createElement( "div" ); container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; body.appendChild( container ).appendChild( div ); // Support: IE6 // Check if elements with layout shrink-wrap their children if ( typeof div.style.zoom !== strundefined ) { // Reset CSS: box-sizing; display; margin; border div.style.cssText = // Support: Firefox<29, Android 2.3 // Vendor-prefix box-sizing "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + "box-sizing:content-box;display:block;margin:0;border:0;" + "padding:1px;width:1px;zoom:1"; div.appendChild( document.createElement( "div" ) ).style.width = "5px"; shrinkWrapBlocksVal = div.offsetWidth !== 3; } body.removeChild( container ); return shrinkWrapBlocksVal; }; })(); var rmargin = (/^margin/); var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); var getStyles, curCSS, rposition = /^(top|right|bottom|left)$/; if ( window.getComputedStyle ) { getStyles = function( elem ) { // Support: IE<=11+, Firefox<=30+ (#15098, #14150) // IE throws on elements created in popups // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" if ( elem.ownerDocument.defaultView.opener ) { return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); } return window.getComputedStyle( elem, null ); }; curCSS = function( elem, name, computed ) { var width, minWidth, maxWidth, ret, style = elem.style; computed = computed || getStyles( elem ); // getPropertyValue is only needed for .css('filter') in IE9, see #12537 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined; if ( computed ) { if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { ret = jQuery.style( elem, name ); } // A tribute to the "awesome hack by Dean Edwards" // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { // Remember the original values width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; // Put in the new values to get a computed value out style.minWidth = style.maxWidth = style.width = ret; ret = computed.width; // Revert the changed values style.width = width; style.minWidth = minWidth; style.maxWidth = maxWidth; } } // Support: IE // IE returns zIndex value as an integer. return ret === undefined ? ret : ret + ""; }; } else if ( document.documentElement.currentStyle ) { getStyles = function( elem ) { return elem.currentStyle; }; curCSS = function( elem, name, computed ) { var left, rs, rsLeft, ret, style = elem.style; computed = computed || getStyles( elem ); ret = computed ? computed[ name ] : undefined; // Avoid setting ret to empty string here // so we don't default to auto if ( ret == null && style && style[ name ] ) { ret = style[ name ]; } // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels // but not position css attributes, as those are proportional to the parent element instead // and we can't measure the parent instead because it might trigger a "stacking dolls" problem if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { // Remember the original values left = style.left; rs = elem.runtimeStyle; rsLeft = rs && rs.left; // Put in the new values to get a computed value out if ( rsLeft ) { rs.left = elem.currentStyle.left; } style.left = name === "fontSize" ? "1em" : ret; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; if ( rsLeft ) { rs.left = rsLeft; } } // Support: IE // IE returns zIndex value as an integer. return ret === undefined ? ret : ret + "" || "auto"; }; } function addGetHookIf( conditionFn, hookFn ) { // Define the hook, we'll check on the first run if it's really needed. return { get: function() { var condition = conditionFn(); if ( condition == null ) { // The test was not ready at this point; screw the hook this time // but check again when needed next time. return; } if ( condition ) { // Hook not needed (or it's not possible to use it due to missing dependency), // remove it. // Since there are no other hooks for marginRight, remove the whole object. delete this.get; return; } // Hook needed; redefine it so that the support test is not executed again. return (this.get = hookFn).apply( this, arguments ); } }; } (function() { // Minified: var b,c,d,e,f,g, h,i var div, style, a, pixelPositionVal, boxSizingReliableVal, reliableHiddenOffsetsVal, reliableMarginRightVal; // Setup div = document.createElement( "div" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; a = div.getElementsByTagName( "a" )[ 0 ]; style = a && a.style; // Finish early in limited (non-browser) environments if ( !style ) { return; } style.cssText = "float:left;opacity:.5"; // Support: IE<9 // Make sure that element opacity exists (as opposed to filter) support.opacity = style.opacity === "0.5"; // Verify style float existence // (IE uses styleFloat instead of cssFloat) support.cssFloat = !!style.cssFloat; div.style.backgroundClip = "content-box"; div.cloneNode( true ).style.backgroundClip = ""; support.clearCloneStyle = div.style.backgroundClip === "content-box"; // Support: Firefox<29, Android 2.3 // Vendor-prefix box-sizing support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" || style.WebkitBoxSizing === ""; jQuery.extend(support, { reliableHiddenOffsets: function() { if ( reliableHiddenOffsetsVal == null ) { computeStyleTests(); } return reliableHiddenOffsetsVal; }, boxSizingReliable: function() { if ( boxSizingReliableVal == null ) { computeStyleTests(); } return boxSizingReliableVal; }, pixelPosition: function() { if ( pixelPositionVal == null ) { computeStyleTests(); } return pixelPositionVal; }, // Support: Android 2.3 reliableMarginRight: function() { if ( reliableMarginRightVal == null ) { computeStyleTests(); } return reliableMarginRightVal; } }); function computeStyleTests() { // Minified: var b,c,d,j var div, body, container, contents; body = document.getElementsByTagName( "body" )[ 0 ]; if ( !body || !body.style ) { // Test fired too early or in an unsupported environment, exit. return; } // Setup div = document.createElement( "div" ); container = document.createElement( "div" ); container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; body.appendChild( container ).appendChild( div ); div.style.cssText = // Support: Firefox<29, Android 2.3 // Vendor-prefix box-sizing "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + "border:1px;padding:1px;width:4px;position:absolute"; // Support: IE<9 // Assume reasonable values in the absence of getComputedStyle pixelPositionVal = boxSizingReliableVal = false; reliableMarginRightVal = true; // Check for getComputedStyle so that this code is not run in IE<9. if ( window.getComputedStyle ) { pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; boxSizingReliableVal = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; // Support: Android 2.3 // Div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container (#3333) // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right contents = div.appendChild( document.createElement( "div" ) ); // Reset CSS: box-sizing; display; margin; border; padding contents.style.cssText = div.style.cssText = // Support: Firefox<29, Android 2.3 // Vendor-prefix box-sizing "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; contents.style.marginRight = contents.style.width = "0"; div.style.width = "1px"; reliableMarginRightVal = !parseFloat( ( window.getComputedStyle( contents, null ) || {} ).marginRight ); div.removeChild( contents ); } // Support: IE8 // Check if table cells still have offsetWidth/Height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetWidth/Height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; contents = div.getElementsByTagName( "td" ); contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none"; reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; if ( reliableHiddenOffsetsVal ) { contents[ 0 ].style.display = ""; contents[ 1 ].style.display = "none"; reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; } body.removeChild( container ); } })(); // A method for quickly swapping in/out CSS properties to get correct calculations. jQuery.swap = function( elem, options, callback, args ) { var ret, name, old = {}; // Remember the old values, and insert the new ones for ( name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } ret = callback.apply( elem, args || [] ); // Revert the old values for ( name in options ) { elem.style[ name ] = old[ name ]; } return ret; }; var ralpha = /alpha\([^)]*\)/i, ropacity = /opacity\s*=\s*([^)]*)/, // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display rdisplayswap = /^(none|table(?!-c[ea]).+)/, rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ), cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { letterSpacing: "0", fontWeight: "400" }, cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; // return a css property mapped to a potentially vendor prefixed property function vendorPropName( style, name ) { // shortcut for names that are not vendor prefixed if ( name in style ) { return name; } // check for vendor prefixed names var capName = name.charAt(0).toUpperCase() + name.slice(1), origName = name, i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in style ) { return name; } } return origName; } function showHide( elements, show ) { var display, elem, hidden, values = [], index = 0, length = elements.length; for ( ; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } values[ index ] = jQuery._data( elem, "olddisplay" ); display = elem.style.display; if ( show ) { // Reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if ( !values[ index ] && display === "none" ) { elem.style.display = ""; } // Set elements which have been overridden with display: none // in a stylesheet to whatever the default browser style is // for such an element if ( elem.style.display === "" && isHidden( elem ) ) { values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); } } else { hidden = isHidden( elem ); if ( display && display !== "none" || !hidden ) { jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); } } } // Set the display of most of the elements in a second loop // to avoid the constant reflow for ( index = 0; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } if ( !show || elem.style.display === "none" || elem.style.display === "" ) { elem.style.display = show ? values[ index ] || "" : "none"; } } return elements; } function setPositiveNumber( elem, value, subtract ) { var matches = rnumsplit.exec( value ); return matches ? // Guard against undefined "subtract", e.g., when used as in cssHooks Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : value; } function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { var i = extra === ( isBorderBox ? "border" : "content" ) ? // If we already have the right measurement, avoid augmentation 4 : // Otherwise initialize for horizontal or vertical properties name === "width" ? 1 : 0, val = 0; for ( ; i < 4; i += 2 ) { // both box models exclude margin, so add it if we want it if ( extra === "margin" ) { val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); } if ( isBorderBox ) { // border-box includes padding, so remove it if we want content if ( extra === "content" ) { val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); } // at this point, extra isn't border nor margin, so remove border if ( extra !== "margin" ) { val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } else { // at this point, extra isn't content, so add padding val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); // at this point, extra isn't content nor padding, so add border if ( extra !== "padding" ) { val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } } return val; } function getWidthOrHeight( elem, name, extra ) { // Start with offset property, which is equivalent to the border-box value var valueIsBorderBox = true, val = name === "width" ? elem.offsetWidth : elem.offsetHeight, styles = getStyles( elem ), isBorderBox = support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; // some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 if ( val <= 0 || val == null ) { // Fall back to computed then uncomputed css if necessary val = curCSS( elem, name, styles ); if ( val < 0 || val == null ) { val = elem.style[ name ]; } // Computed unit is not pixels. Stop here and return. if ( rnumnonpx.test(val) ) { return val; } // we need the check for style in case a browser which returns unreliable values // for getComputedStyle silently falls back to the reliable elem.style valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] ); // Normalize "", auto, and prepare for extra val = parseFloat( val ) || 0; } // use the active box-sizing model to add/subtract irrelevant styles return ( val + augmentWidthOrHeight( elem, name, extra || ( isBorderBox ? "border" : "content" ), valueIsBorderBox, styles ) ) + "px"; } jQuery.extend({ // Add in style property hooks for overriding the default // behavior of getting and setting a style property cssHooks: { opacity: { get: function( elem, computed ) { if ( computed ) { // We should always get a number back from opacity var ret = curCSS( elem, "opacity" ); return ret === "" ? "1" : ret; } } } }, // Don't automatically add "px" to these possibly-unitless properties cssNumber: { "columnCount": true, "fillOpacity": true, "flexGrow": true, "flexShrink": true, "fontWeight": true, "lineHeight": true, "opacity": true, "order": true, "orphans": true, "widows": true, "zIndex": true, "zoom": true }, // Add in properties whose names you wish to fix before // setting or getting the value cssProps: { // normalize float css property "float": support.cssFloat ? "cssFloat" : "styleFloat" }, // Get and set the style property on a DOM Node style: function( elem, name, value, extra ) { // Don't set styles on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { return; } // Make sure that we're working with the right name var ret, type, hooks, origName = jQuery.camelCase( name ), style = elem.style; name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // Check if we're setting a value if ( value !== undefined ) { type = typeof value; // convert relative number strings (+= or -=) to relative numbers. #7345 if ( type === "string" && (ret = rrelNum.exec( value )) ) { value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); // Fixes bug #9237 type = "number"; } // Make sure that null and NaN values aren't set. See: #7116 if ( value == null || value !== value ) { return; } // If a number was passed in, add 'px' to the (except for certain CSS properties) if ( type === "number" && !jQuery.cssNumber[ origName ] ) { value += "px"; } // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, // but it would mean to define eight (for every problematic property) identical functions if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { style[ name ] = "inherit"; } // If a hook was provided, use that value, otherwise just set the specified value if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { // Support: IE // Swallow errors from 'invalid' CSS values (#5509) try { style[ name ] = value; } catch(e) {} } } else { // If a hook was provided get the non-computed value from there if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { return ret; } // Otherwise just get the value from the style object return style[ name ]; } }, css: function( elem, name, extra, styles ) { var num, val, hooks, origName = jQuery.camelCase( name ); // Make sure that we're working with the right name name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // If a hook was provided get the computed value from there if ( hooks && "get" in hooks ) { val = hooks.get( elem, true, extra ); } // Otherwise, if a way to get the computed value exists, use that if ( val === undefined ) { val = curCSS( elem, name, styles ); } //convert "normal" to computed value if ( val === "normal" && name in cssNormalTransform ) { val = cssNormalTransform[ name ]; } // Return, converting to number if forced or a qualifier was provided and val looks numeric if ( extra === "" || extra ) { num = parseFloat( val ); return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; } return val; } }); jQuery.each([ "height", "width" ], function( i, name ) { jQuery.cssHooks[ name ] = { get: function( elem, computed, extra ) { if ( computed ) { // certain elements can have dimension info if we invisibly show them // however, it must have a current display style that would benefit from this return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ? jQuery.swap( elem, cssShow, function() { return getWidthOrHeight( elem, name, extra ); }) : getWidthOrHeight( elem, name, extra ); } }, set: function( elem, value, extra ) { var styles = extra && getStyles( elem ); return setPositiveNumber( elem, value, extra ? augmentWidthOrHeight( elem, name, extra, support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", styles ) : 0 ); } }; }); if ( !support.opacity ) { jQuery.cssHooks.opacity = { get: function( elem, computed ) { // IE uses filters for opacity return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : computed ? "1" : ""; }, set: function( elem, value ) { var style = elem.style, currentStyle = elem.currentStyle, opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", filter = currentStyle && currentStyle.filter || style.filter || ""; // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level style.zoom = 1; // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 // if value === "", then remove inline opacity #12685 if ( ( value >= 1 || value === "" ) && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && style.removeAttribute ) { // Setting style.filter to null, "" & " " still leave "filter:" in the cssText // if "filter:" is present at all, clearType is disabled, we want to avoid this // style.removeAttribute is IE Only, but so apparently is this code path... style.removeAttribute( "filter" ); // if there is no filter style applied in a css rule or unset inline opacity, we are done if ( value === "" || currentStyle && !currentStyle.filter ) { return; } } // otherwise, set new filter values style.filter = ralpha.test( filter ) ? filter.replace( ralpha, opacity ) : filter + " " + opacity; } }; } jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, function( elem, computed ) { if ( computed ) { // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // Work around by temporarily setting element display to inline-block return jQuery.swap( elem, { "display": "inline-block" }, curCSS, [ elem, "marginRight" ] ); } } ); // These hooks are used by animate to expand properties jQuery.each({ margin: "", padding: "", border: "Width" }, function( prefix, suffix ) { jQuery.cssHooks[ prefix + suffix ] = { expand: function( value ) { var i = 0, expanded = {}, // assumes a single number if not a string parts = typeof value === "string" ? value.split(" ") : [ value ]; for ( ; i < 4; i++ ) { expanded[ prefix + cssExpand[ i ] + suffix ] = parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; } return expanded; } }; if ( !rmargin.test( prefix ) ) { jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; } }); jQuery.fn.extend({ css: function( name, value ) { return access( this, function( elem, name, value ) { var styles, len, map = {}, i = 0; if ( jQuery.isArray( name ) ) { styles = getStyles( elem ); len = name.length; for ( ; i < len; i++ ) { map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); } return map; } return value !== undefined ? jQuery.style( elem, name, value ) : jQuery.css( elem, name ); }, name, value, arguments.length > 1 ); }, show: function() { return showHide( this, true ); }, hide: function() { return showHide( this ); }, toggle: function( state ) { if ( typeof state === "boolean" ) { return state ? this.show() : this.hide(); } return this.each(function() { if ( isHidden( this ) ) { jQuery( this ).show(); } else { jQuery( this ).hide(); } }); } }); function Tween( elem, options, prop, end, easing ) { return new Tween.prototype.init( elem, options, prop, end, easing ); } jQuery.Tween = Tween; Tween.prototype = { constructor: Tween, init: function( elem, options, prop, end, easing, unit ) { this.elem = elem; this.prop = prop; this.easing = easing || "swing"; this.options = options; this.start = this.now = this.cur(); this.end = end; this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); }, cur: function() { var hooks = Tween.propHooks[ this.prop ]; return hooks && hooks.get ? hooks.get( this ) : Tween.propHooks._default.get( this ); }, run: function( percent ) { var eased, hooks = Tween.propHooks[ this.prop ]; if ( this.options.duration ) { this.pos = eased = jQuery.easing[ this.easing ]( percent, this.options.duration * percent, 0, 1, this.options.duration ); } else { this.pos = eased = percent; } this.now = ( this.end - this.start ) * eased + this.start; if ( this.options.step ) { this.options.step.call( this.elem, this.now, this ); } if ( hooks && hooks.set ) { hooks.set( this ); } else { Tween.propHooks._default.set( this ); } return this; } }; Tween.prototype.init.prototype = Tween.prototype; Tween.propHooks = { _default: { get: function( tween ) { var result; if ( tween.elem[ tween.prop ] != null && (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { return tween.elem[ tween.prop ]; } // passing an empty string as a 3rd parameter to .css will automatically // attempt a parseFloat and fallback to a string if the parse fails // so, simple values such as "10px" are parsed to Float. // complex values such as "rotate(1rad)" are returned as is. result = jQuery.css( tween.elem, tween.prop, "" ); // Empty strings, null, undefined and "auto" are converted to 0. return !result || result === "auto" ? 0 : result; }, set: function( tween ) { // use step hook for back compat - use cssHook if its there - use .style if its // available and use plain properties where available if ( jQuery.fx.step[ tween.prop ] ) { jQuery.fx.step[ tween.prop ]( tween ); } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); } else { tween.elem[ tween.prop ] = tween.now; } } } }; // Support: IE <=9 // Panic based approach to setting things on disconnected nodes Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { set: function( tween ) { if ( tween.elem.nodeType && tween.elem.parentNode ) { tween.elem[ tween.prop ] = tween.now; } } }; jQuery.easing = { linear: function( p ) { return p; }, swing: function( p ) { return 0.5 - Math.cos( p * Math.PI ) / 2; } }; jQuery.fx = Tween.prototype.init; // Back Compat <1.8 extension point jQuery.fx.step = {}; var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ), rrun = /queueHooks$/, animationPrefilters = [ defaultPrefilter ], tweeners = { "*": [ function( prop, value ) { var tween = this.createTween( prop, value ), target = tween.cur(), parts = rfxnum.exec( value ), unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), // Starting value computation is required for potential unit mismatches start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && rfxnum.exec( jQuery.css( tween.elem, prop ) ), scale = 1, maxIterations = 20; if ( start && start[ 3 ] !== unit ) { // Trust units reported by jQuery.css unit = unit || start[ 3 ]; // Make sure we update the tween properties later on parts = parts || []; // Iteratively approximate from a nonzero starting point start = +target || 1; do { // If previous iteration zeroed out, double until we get *something* // Use a string for doubling factor so we don't accidentally see scale as unchanged below scale = scale || ".5"; // Adjust and apply start = start / scale; jQuery.style( tween.elem, prop, start + unit ); // Update scale, tolerating zero or NaN from tween.cur() // And breaking the loop if scale is unchanged or perfect, or if we've just had enough } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); } // Update tween properties if ( parts ) { start = tween.start = +start || +target || 0; tween.unit = unit; // If a +=/-= token was provided, we're doing a relative animation tween.end = parts[ 1 ] ? start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : +parts[ 2 ]; } return tween; } ] }; // Animations created synchronously will run synchronously function createFxNow() { setTimeout(function() { fxNow = undefined; }); return ( fxNow = jQuery.now() ); } // Generate parameters to create a standard animation function genFx( type, includeWidth ) { var which, attrs = { height: type }, i = 0; // if we include width, step value is 1 to do all cssExpand values, // if we don't include width, step value is 2 to skip over Left and Right includeWidth = includeWidth ? 1 : 0; for ( ; i < 4 ; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; } function createTween( value, prop, animation ) { var tween, collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), index = 0, length = collection.length; for ( ; index < length; index++ ) { if ( (tween = collection[ index ].call( animation, prop, value )) ) { // we're done with this property return tween; } } } function defaultPrefilter( elem, props, opts ) { /* jshint validthis: true */ var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHidden( elem ), dataShow = jQuery._data( elem, "fxshow" ); // handle queue: false promises if ( !opts.queue ) { hooks = jQuery._queueHooks( elem, "fx" ); if ( hooks.unqueued == null ) { hooks.unqueued = 0; oldfire = hooks.empty.fire; hooks.empty.fire = function() { if ( !hooks.unqueued ) { oldfire(); } }; } hooks.unqueued++; anim.always(function() { // doing this makes sure that the complete handler will be called // before this completes anim.always(function() { hooks.unqueued--; if ( !jQuery.queue( elem, "fx" ).length ) { hooks.empty.fire(); } }); }); } // height/width overflow pass if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { // Make sure that nothing sneaks out // Record all 3 overflow attributes because IE does not // change the overflow attribute when overflowX and // overflowY are set to the same value opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; // Set display property to inline-block for height/width // animations on inline elements that are having width/height animated display = jQuery.css( elem, "display" ); // Test default display if display is currently "none" checkDisplay = display === "none" ? jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { // inline-level elements accept inline-block; // block-level elements need to be inline with layout if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) { style.display = "inline-block"; } else { style.zoom = 1; } } } if ( opts.overflow ) { style.overflow = "hidden"; if ( !support.shrinkWrapBlocks() ) { anim.always(function() { style.overflow = opts.overflow[ 0 ]; style.overflowX = opts.overflow[ 1 ]; style.overflowY = opts.overflow[ 2 ]; }); } } // show/hide pass for ( prop in props ) { value = props[ prop ]; if ( rfxtypes.exec( value ) ) { delete props[ prop ]; toggle = toggle || value === "toggle"; if ( value === ( hidden ? "hide" : "show" ) ) { // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { hidden = true; } else { continue; } } orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); // Any non-fx value stops us from restoring the original display value } else { display = undefined; } } if ( !jQuery.isEmptyObject( orig ) ) { if ( dataShow ) { if ( "hidden" in dataShow ) { hidden = dataShow.hidden; } } else { dataShow = jQuery._data( elem, "fxshow", {} ); } // store state if its toggle - enables .stop().toggle() to "reverse" if ( toggle ) { dataShow.hidden = !hidden; } if ( hidden ) { jQuery( elem ).show(); } else { anim.done(function() { jQuery( elem ).hide(); }); } anim.done(function() { var prop; jQuery._removeData( elem, "fxshow" ); for ( prop in orig ) { jQuery.style( elem, prop, orig[ prop ] ); } }); for ( prop in orig ) { tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); if ( !( prop in dataShow ) ) { dataShow[ prop ] = tween.start; if ( hidden ) { tween.end = tween.start; tween.start = prop === "width" || prop === "height" ? 1 : 0; } } } // If this is a noop like .hide().hide(), restore an overwritten display value } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) { style.display = display; } } function propFilter( props, specialEasing ) { var index, name, easing, value, hooks; // camelCase, specialEasing and expand cssHook pass for ( index in props ) { name = jQuery.camelCase( index ); easing = specialEasing[ name ]; value = props[ index ]; if ( jQuery.isArray( value ) ) { easing = value[ 1 ]; value = props[ index ] = value[ 0 ]; } if ( index !== name ) { props[ name ] = value; delete props[ index ]; } hooks = jQuery.cssHooks[ name ]; if ( hooks && "expand" in hooks ) { value = hooks.expand( value ); delete props[ name ]; // not quite $.extend, this wont overwrite keys already present. // also - reusing 'index' from above because we have the correct "name" for ( index in value ) { if ( !( index in props ) ) { props[ index ] = value[ index ]; specialEasing[ index ] = easing; } } } else { specialEasing[ name ] = easing; } } } function Animation( elem, properties, options ) { var result, stopped, index = 0, length = animationPrefilters.length, deferred = jQuery.Deferred().always( function() { // don't match elem in the :animated selector delete tick.elem; }), tick = function() { if ( stopped ) { return false; } var currentTime = fxNow || createFxNow(), remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( percent ); } deferred.notifyWith( elem, [ animation, percent, remaining ]); if ( percent < 1 && length ) { return remaining; } else { deferred.resolveWith( elem, [ animation ] ); return false; } }, animation = deferred.promise({ elem: elem, props: jQuery.extend( {}, properties ), opts: jQuery.extend( true, { specialEasing: {} }, options ), originalProperties: properties, originalOptions: options, startTime: fxNow || createFxNow(), duration: options.duration, tweens: [], createTween: function( prop, end ) { var tween = jQuery.Tween( elem, animation.opts, prop, end, animation.opts.specialEasing[ prop ] || animation.opts.easing ); animation.tweens.push( tween ); return tween; }, stop: function( gotoEnd ) { var index = 0, // if we are going to the end, we want to run all the tweens // otherwise we skip this part length = gotoEnd ? animation.tweens.length : 0; if ( stopped ) { return this; } stopped = true; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( 1 ); } // resolve when we played the last frame // otherwise, reject if ( gotoEnd ) { deferred.resolveWith( elem, [ animation, gotoEnd ] ); } else { deferred.rejectWith( elem, [ animation, gotoEnd ] ); } return this; } }), props = animation.props; propFilter( props, animation.opts.specialEasing ); for ( ; index < length ; index++ ) { result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); if ( result ) { return result; } } jQuery.map( props, createTween, animation ); if ( jQuery.isFunction( animation.opts.start ) ) { animation.opts.start.call( elem, animation ); } jQuery.fx.timer( jQuery.extend( tick, { elem: elem, anim: animation, queue: animation.opts.queue }) ); // attach callbacks from options return animation.progress( animation.opts.progress ) .done( animation.opts.done, animation.opts.complete ) .fail( animation.opts.fail ) .always( animation.opts.always ); } jQuery.Animation = jQuery.extend( Animation, { tweener: function( props, callback ) { if ( jQuery.isFunction( props ) ) { callback = props; props = [ "*" ]; } else { props = props.split(" "); } var prop, index = 0, length = props.length; for ( ; index < length ; index++ ) { prop = props[ index ]; tweeners[ prop ] = tweeners[ prop ] || []; tweeners[ prop ].unshift( callback ); } }, prefilter: function( callback, prepend ) { if ( prepend ) { animationPrefilters.unshift( callback ); } else { animationPrefilters.push( callback ); } } }); jQuery.speed = function( speed, easing, fn ) { var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; // normalize opt.queue - true/undefined/null -> "fx" if ( opt.queue == null || opt.queue === true ) { opt.queue = "fx"; } // Queueing opt.old = opt.complete; opt.complete = function() { if ( jQuery.isFunction( opt.old ) ) { opt.old.call( this ); } if ( opt.queue ) { jQuery.dequeue( this, opt.queue ); } }; return opt; }; jQuery.fn.extend({ fadeTo: function( speed, to, easing, callback ) { // show any hidden elements after setting opacity to 0 return this.filter( isHidden ).css( "opacity", 0 ).show() // animate to the value specified .end().animate({ opacity: to }, speed, easing, callback ); }, animate: function( prop, speed, easing, callback ) { var empty = jQuery.isEmptyObject( prop ), optall = jQuery.speed( speed, easing, callback ), doAnimation = function() { // Operate on a copy of prop so per-property easing won't be lost var anim = Animation( this, jQuery.extend( {}, prop ), optall ); // Empty animations, or finishing resolves immediately if ( empty || jQuery._data( this, "finish" ) ) { anim.stop( true ); } }; doAnimation.finish = doAnimation; return empty || optall.queue === false ? this.each( doAnimation ) : this.queue( optall.queue, doAnimation ); }, stop: function( type, clearQueue, gotoEnd ) { var stopQueue = function( hooks ) { var stop = hooks.stop; delete hooks.stop; stop( gotoEnd ); }; if ( typeof type !== "string" ) { gotoEnd = clearQueue; clearQueue = type; type = undefined; } if ( clearQueue && type !== false ) { this.queue( type || "fx", [] ); } return this.each(function() { var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery.timers, data = jQuery._data( this ); if ( index ) { if ( data[ index ] && data[ index ].stop ) { stopQueue( data[ index ] ); } } else { for ( index in data ) { if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { stopQueue( data[ index ] ); } } } for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { timers[ index ].anim.stop( gotoEnd ); dequeue = false; timers.splice( index, 1 ); } } // start the next in the queue if the last step wasn't forced // timers currently will call their complete callbacks, which will dequeue // but only if they were gotoEnd if ( dequeue || !gotoEnd ) { jQuery.dequeue( this, type ); } }); }, finish: function( type ) { if ( type !== false ) { type = type || "fx"; } return this.each(function() { var index, data = jQuery._data( this ), queue = data[ type + "queue" ], hooks = data[ type + "queueHooks" ], timers = jQuery.timers, length = queue ? queue.length : 0; // enable finishing flag on private data data.finish = true; // empty the queue first jQuery.queue( this, type, [] ); if ( hooks && hooks.stop ) { hooks.stop.call( this, true ); } // look for any active animations, and finish them for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && timers[ index ].queue === type ) { timers[ index ].anim.stop( true ); timers.splice( index, 1 ); } } // look for any animations in the old queue and finish them for ( index = 0; index < length; index++ ) { if ( queue[ index ] && queue[ index ].finish ) { queue[ index ].finish.call( this ); } } // turn off finishing flag delete data.finish; }); } }); jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { var cssFn = jQuery.fn[ name ]; jQuery.fn[ name ] = function( speed, easing, callback ) { return speed == null || typeof speed === "boolean" ? cssFn.apply( this, arguments ) : this.animate( genFx( name, true ), speed, easing, callback ); }; }); // Generate shortcuts for custom animations jQuery.each({ slideDown: genFx("show"), slideUp: genFx("hide"), slideToggle: genFx("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function( name, props ) { jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback ); }; }); jQuery.timers = []; jQuery.fx.tick = function() { var timer, timers = jQuery.timers, i = 0; fxNow = jQuery.now(); for ( ; i < timers.length; i++ ) { timer = timers[ i ]; // Checks the timer has not already been removed if ( !timer() && timers[ i ] === timer ) { timers.splice( i--, 1 ); } } if ( !timers.length ) { jQuery.fx.stop(); } fxNow = undefined; }; jQuery.fx.timer = function( timer ) { jQuery.timers.push( timer ); if ( timer() ) { jQuery.fx.start(); } else { jQuery.timers.pop(); } }; jQuery.fx.interval = 13; jQuery.fx.start = function() { if ( !timerId ) { timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); } }; jQuery.fx.stop = function() { clearInterval( timerId ); timerId = null; }; jQuery.fx.speeds = { slow: 600, fast: 200, // Default speed _default: 400 }; // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ jQuery.fn.delay = function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = setTimeout( next, time ); hooks.stop = function() { clearTimeout( timeout ); }; }); }; (function() { // Minified: var a,b,c,d,e var input, div, select, a, opt; // Setup div = document.createElement( "div" ); div.setAttribute( "className", "t" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; a = div.getElementsByTagName("a")[ 0 ]; // First batch of tests. select = document.createElement("select"); opt = select.appendChild( document.createElement("option") ); input = div.getElementsByTagName("input")[ 0 ]; a.style.cssText = "top:1px"; // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) support.getSetAttribute = div.className !== "t"; // Get the style information from getAttribute // (IE uses .cssText instead) support.style = /top/.test( a.getAttribute("style") ); // Make sure that URLs aren't manipulated // (IE normalizes it by default) support.hrefNormalized = a.getAttribute("href") === "/a"; // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) support.checkOn = !!input.value; // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) support.optSelected = opt.selected; // Tests for enctype support on a form (#6743) support.enctype = !!document.createElement("form").enctype; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) select.disabled = true; support.optDisabled = !opt.disabled; // Support: IE8 only // Check if we can trust getAttribute("value") input = document.createElement( "input" ); input.setAttribute( "value", "" ); support.input = input.getAttribute( "value" ) === ""; // Check if an input maintains its value after becoming a radio input.value = "t"; input.setAttribute( "type", "radio" ); support.radioValue = input.value === "t"; })(); var rreturn = /\r/g; jQuery.fn.extend({ val: function( value ) { var hooks, ret, isFunction, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction( value ); return this.each(function( i ) { var val; if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, jQuery( this ).val() ); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray( val ) ) { val = jQuery.map( val, function( value ) { return value == null ? "" : value + ""; }); } hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; // If set returns undefined, fall back to normal setting if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: { get: function( elem ) { var val = jQuery.find.attr( elem, "value" ); return val != null ? val : // Support: IE10-11+ // option.text throws exceptions (#14686, #14858) jQuery.trim( jQuery.text( elem ) ); } }, select: { get: function( elem ) { var value, option, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one" || index < 0, values = one ? null : [], max = one ? index + 1 : options.length, i = index < 0 ? max : one ? index : 0; // Loop through all the selected options for ( ; i < max; i++ ) { option = options[ i ]; // oldIE doesn't update selected after form reset (#2551) if ( ( option.selected || i === index ) && // Don't return options that are disabled or in a disabled optgroup ( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { // Get the specific value for the option value = jQuery( option ).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } return values; }, set: function( elem, value ) { var optionSet, option, options = elem.options, values = jQuery.makeArray( value ), i = options.length; while ( i-- ) { option = options[ i ]; if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) { // Support: IE6 // When new option element is added to select box we need to // force reflow of newly added node in order to workaround delay // of initialization properties try { option.selected = optionSet = true; } catch ( _ ) { // Will be executed only in IE6 option.scrollHeight; } } else { option.selected = false; } } // Force browsers to behave consistently when non-matching value is set if ( !optionSet ) { elem.selectedIndex = -1; } return options; } } } }); // Radios and checkboxes getter/setter jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); } } }; if ( !support.checkOn ) { jQuery.valHooks[ this ].get = function( elem ) { // Support: Webkit // "" is returned instead of "on" if a value isn't specified return elem.getAttribute("value") === null ? "on" : elem.value; }; } }); var nodeHook, boolHook, attrHandle = jQuery.expr.attrHandle, ruseDefault = /^(?:checked|selected)$/i, getSetAttribute = support.getSetAttribute, getSetInput = support.input; jQuery.fn.extend({ attr: function( name, value ) { return access( this, jQuery.attr, name, value, arguments.length > 1 ); }, removeAttr: function( name ) { return this.each(function() { jQuery.removeAttr( this, name ); }); } }); jQuery.extend({ attr: function( elem, name, value ) { var hooks, ret, nType = elem.nodeType; // don't get/set attributes on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } // Fallback to prop when attributes are not supported if ( typeof elem.getAttribute === strundefined ) { return jQuery.prop( elem, name, value ); } // All attributes are lowercase // Grab necessary hook if one is defined if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setAttribute( name, value + "" ); return value; } } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { ret = jQuery.find.attr( elem, name ); // Non-existent attributes return null, we normalize to undefined return ret == null ? undefined : ret; } }, removeAttr: function( elem, value ) { var name, propName, i = 0, attrNames = value && value.match( rnotwhite ); if ( attrNames && elem.nodeType === 1 ) { while ( (name = attrNames[i++]) ) { propName = jQuery.propFix[ name ] || name; // Boolean attributes get special treatment (#10870) if ( jQuery.expr.match.bool.test( name ) ) { // Set corresponding property to false if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { elem[ propName ] = false; // Support: IE<9 // Also clear defaultChecked/defaultSelected (if appropriate) } else { elem[ jQuery.camelCase( "default-" + name ) ] = elem[ propName ] = false; } // See #9699 for explanation of this approach (setting first, then removal) } else { jQuery.attr( elem, name, "" ); } elem.removeAttribute( getSetAttribute ? name : propName ); } } }, attrHooks: { type: { set: function( elem, value ) { if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { // Setting the type on a radio button after the value resets the value in IE6-9 // Reset value to default in case type is set after value during creation var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } } } }); // Hook for boolean attributes boolHook = { set: function( elem, value, name ) { if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { // IE<8 needs the *property* name elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); // Use defaultChecked and defaultSelected for oldIE } else { elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; } return name; } }; // Retrieve booleans specially jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { var getter = attrHandle[ name ] || jQuery.find.attr; attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? function( elem, name, isXML ) { var ret, handle; if ( !isXML ) { // Avoid an infinite loop by temporarily removing this function from the getter handle = attrHandle[ name ]; attrHandle[ name ] = ret; ret = getter( elem, name, isXML ) != null ? name.toLowerCase() : null; attrHandle[ name ] = handle; } return ret; } : function( elem, name, isXML ) { if ( !isXML ) { return elem[ jQuery.camelCase( "default-" + name ) ] ? name.toLowerCase() : null; } }; }); // fix oldIE attroperties if ( !getSetInput || !getSetAttribute ) { jQuery.attrHooks.value = { set: function( elem, value, name ) { if ( jQuery.nodeName( elem, "input" ) ) { // Does not return so that setAttribute is also used elem.defaultValue = value; } else { // Use nodeHook if defined (#1954); otherwise setAttribute is fine return nodeHook && nodeHook.set( elem, value, name ); } } }; } // IE6/7 do not support getting/setting some attributes with get/setAttribute if ( !getSetAttribute ) { // Use this for any attribute in IE6/7 // This fixes almost every IE6/7 issue nodeHook = { set: function( elem, value, name ) { // Set the existing or create a new attribute node var ret = elem.getAttributeNode( name ); if ( !ret ) { elem.setAttributeNode( (ret = elem.ownerDocument.createAttribute( name )) ); } ret.value = value += ""; // Break association with cloned elements by also using setAttribute (#9646) if ( name === "value" || value === elem.getAttribute( name ) ) { return value; } } }; // Some attributes are constructed with empty-string values when not defined attrHandle.id = attrHandle.name = attrHandle.coords = function( elem, name, isXML ) { var ret; if ( !isXML ) { return (ret = elem.getAttributeNode( name )) && ret.value !== "" ? ret.value : null; } }; // Fixing value retrieval on a button requires this module jQuery.valHooks.button = { get: function( elem, name ) { var ret = elem.getAttributeNode( name ); if ( ret && ret.specified ) { return ret.value; } }, set: nodeHook.set }; // Set contenteditable to false on removals(#10429) // Setting to empty string throws an error as an invalid value jQuery.attrHooks.contenteditable = { set: function( elem, value, name ) { nodeHook.set( elem, value === "" ? false : value, name ); } }; // Set width and height to auto instead of 0 on empty string( Bug #8150 ) // This is for removals jQuery.each([ "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = { set: function( elem, value ) { if ( value === "" ) { elem.setAttribute( name, "auto" ); return value; } } }; }); } if ( !support.style ) { jQuery.attrHooks.style = { get: function( elem ) { // Return undefined in the case of empty string // Note: IE uppercases css property names, but if we were to .toLowerCase() // .cssText, that would destroy case senstitivity in URL's, like in "background" return elem.style.cssText || undefined; }, set: function( elem, value ) { return ( elem.style.cssText = value + "" ); } }; } var rfocusable = /^(?:input|select|textarea|button|object)$/i, rclickable = /^(?:a|area)$/i; jQuery.fn.extend({ prop: function( name, value ) { return access( this, jQuery.prop, name, value, arguments.length > 1 ); }, removeProp: function( name ) { name = jQuery.propFix[ name ] || name; return this.each(function() { // try/catch handles cases where IE balks (such as removing a property on window) try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); } }); jQuery.extend({ propFix: { "for": "htmlFor", "class": "className" }, prop: function( elem, name, value ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set properties on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); if ( notxml ) { // Fix name and attach hooks name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? ret : ( elem[ name ] = value ); } else { return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? ret : elem[ name ]; } }, propHooks: { tabIndex: { get: function( elem ) { // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ // Use proper attribute retrieval(#12072) var tabindex = jQuery.find.attr( elem, "tabindex" ); return tabindex ? parseInt( tabindex, 10 ) : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : -1; } } } }); // Some attributes require a special call on IE // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !support.hrefNormalized ) { // href/src property should get the full normalized URL (#10299/#12915) jQuery.each([ "href", "src" ], function( i, name ) { jQuery.propHooks[ name ] = { get: function( elem ) { return elem.getAttribute( name, 4 ); } }; }); } // Support: Safari, IE9+ // mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( !support.optSelected ) { jQuery.propHooks.selected = { get: function( elem ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } return null; } }; } jQuery.each([ "tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable" ], function() { jQuery.propFix[ this.toLowerCase() ] = this; }); // IE6/7 call enctype encoding if ( !support.enctype ) { jQuery.propFix.enctype = "encoding"; } var rclass = /[\t\r\n\f]/g; jQuery.fn.extend({ addClass: function( value ) { var classes, elem, cur, clazz, j, finalValue, i = 0, len = this.length, proceed = typeof value === "string" && value; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).addClass( value.call( this, j, this.className ) ); }); } if ( proceed ) { // The disjunction here is for better compressibility (see removeClass) classes = ( value || "" ).match( rnotwhite ) || []; for ( ; i < len; i++ ) { elem = this[ i ]; cur = elem.nodeType === 1 && ( elem.className ? ( " " + elem.className + " " ).replace( rclass, " " ) : " " ); if ( cur ) { j = 0; while ( (clazz = classes[j++]) ) { if ( cur.indexOf( " " + clazz + " " ) < 0 ) { cur += clazz + " "; } } // only assign if different to avoid unneeded rendering. finalValue = jQuery.trim( cur ); if ( elem.className !== finalValue ) { elem.className = finalValue; } } } } return this; }, removeClass: function( value ) { var classes, elem, cur, clazz, j, finalValue, i = 0, len = this.length, proceed = arguments.length === 0 || typeof value === "string" && value; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).removeClass( value.call( this, j, this.className ) ); }); } if ( proceed ) { classes = ( value || "" ).match( rnotwhite ) || []; for ( ; i < len; i++ ) { elem = this[ i ]; // This expression is here for better compressibility (see addClass) cur = elem.nodeType === 1 && ( elem.className ? ( " " + elem.className + " " ).replace( rclass, " " ) : "" ); if ( cur ) { j = 0; while ( (clazz = classes[j++]) ) { // Remove *all* instances while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { cur = cur.replace( " " + clazz + " ", " " ); } } // only assign if different to avoid unneeded rendering. finalValue = value ? jQuery.trim( cur ) : ""; if ( elem.className !== finalValue ) { elem.className = finalValue; } } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value; if ( typeof stateVal === "boolean" && type === "string" ) { return stateVal ? this.addClass( value ) : this.removeClass( value ); } if ( jQuery.isFunction( value ) ) { return this.each(function( i ) { jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var className, i = 0, self = jQuery( this ), classNames = value.match( rnotwhite ) || []; while ( (className = classNames[ i++ ]) ) { // check each className given, space separated list if ( self.hasClass( className ) ) { self.removeClass( className ); } else { self.addClass( className ); } } // Toggle whole class name } else if ( type === strundefined || type === "boolean" ) { if ( this.className ) { // store className if set jQuery._data( this, "__className__", this.className ); } // If the element has a class name or if we're passed "false", // then remove the whole classname (if there was one, the above saved it). // Otherwise bring back whatever was previously saved (if anything), // falling back to the empty string if nothing was stored. this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " ", i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { return true; } } return false; } }); // Return jQuery for attributes-only inclusion jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; }); jQuery.fn.extend({ hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); } }); var nonce = jQuery.now(); var rquery = (/\?/); var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; jQuery.parseJSON = function( data ) { // Attempt to parse using the native JSON parser first if ( window.JSON && window.JSON.parse ) { // Support: Android 2.3 // Workaround failure to string-cast null input return window.JSON.parse( data + "" ); } var requireNonComma, depth = null, str = jQuery.trim( data + "" ); // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains // after removing valid tokens return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) { // Force termination if we see a misplaced comma if ( requireNonComma && comma ) { depth = 0; } // Perform no more replacements after returning to outermost depth if ( depth === 0 ) { return token; } // Commas must not follow "[", "{", or "," requireNonComma = open || comma; // Determine new depth // array/object open ("[" or "{"): depth += true - false (increment) // array/object close ("]" or "}"): depth += false - true (decrement) // other cases ("," or primitive): depth += true - true (numeric cast) depth += !close - !open; // Remove this token return ""; }) ) ? ( Function( "return " + str ) )() : jQuery.error( "Invalid JSON: " + data ); }; // Cross-browser xml parsing jQuery.parseXML = function( data ) { var xml, tmp; if ( !data || typeof data !== "string" ) { return null; } try { if ( window.DOMParser ) { // Standard tmp = new DOMParser(); xml = tmp.parseFromString( data, "text/xml" ); } else { // IE xml = new ActiveXObject( "Microsoft.XMLDOM" ); xml.async = "false"; xml.loadXML( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }; var // Document location ajaxLocParts, ajaxLocation, rhash = /#.*$/, rts = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL // #7653, #8125, #8152: local protocol detection rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression allTypes = "*/".concat("*"); // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set try { ajaxLocation = location.href; } catch( e ) { // Use the href attribute of an A element // since IE will modify it given document.location ajaxLocation = document.createElement( "a" ); ajaxLocation.href = ""; ajaxLocation = ajaxLocation.href; } // Segment location into parts ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression while ( (dataType = dataTypes[i++]) ) { // Prepend if requested if ( dataType.charAt( 0 ) === "+" ) { dataType = dataType.slice( 1 ) || "*"; (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); // Otherwise append } else { (structure[ dataType ] = structure[ dataType ] || []).push( func ); } } } }; } // Base inspection function for prefilters and transports function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { var inspected = {}, seekingTransport = ( structure === transports ); function inspect( dataType ) { var selected; inspected[ dataType ] = true; jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { options.dataTypes.unshift( dataTypeOrTransport ); inspect( dataTypeOrTransport ); return false; } else if ( seekingTransport ) { return !( selected = dataTypeOrTransport ); } }); return selected; } return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); } // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend( target, src ) { var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } return target; } /* Handles responses to an ajax request: * - finds the right dataType (mediates between content-type and expected dataType) * - returns the corresponding response */ function ajaxHandleResponses( s, jqXHR, responses ) { var firstDataType, ct, finalDataType, type, contents = s.contents, dataTypes = s.dataTypes; // Remove auto dataType and get content-type in the process while ( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } } /* Chain conversions given the request and the original response * Also sets the responseXXX fields on the jqXHR instance */ function ajaxConvert( s, response, jqXHR, isSuccess ) { var conv2, current, conv, tmp, prev, converters = {}, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(); // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } current = dataTypes.shift(); // Convert to each sequential dataType while ( current ) { if ( s.responseFields[ current ] ) { jqXHR[ s.responseFields[ current ] ] = response; } // Apply the dataFilter if provided if ( !prev && isSuccess && s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } prev = current; current = dataTypes.shift(); if ( current ) { // There's only work to do if current dataType is non-auto if ( current === "*" ) { current = prev; // Convert response if prev dataType is non-auto and differs from current } else if ( prev !== "*" && prev !== current ) { // Seek a direct converter conv = converters[ prev + " " + current ] || converters[ "* " + current ]; // If none found, seek a pair if ( !conv ) { for ( conv2 in converters ) { // If conv2 outputs current tmp = conv2.split( " " ); if ( tmp[ 1 ] === current ) { // If prev can be converted to accepted input conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { // Condense equivalence converters if ( conv === true ) { conv = converters[ conv2 ]; // Otherwise, insert the intermediate dataType } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.unshift( tmp[ 1 ] ); } break; } } } } // Apply converter (if not an equivalence) if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them if ( conv && s[ "throws" ] ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } } } return { state: "success", data: response }; } jQuery.extend({ // Counter for holding the number of active queries active: 0, // Last-Modified header cache for next request lastModified: {}, etag: {}, ajaxSettings: { url: ajaxLocation, type: "GET", isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), global: true, processData: true, async: true, contentType: "application/x-www-form-urlencoded; charset=UTF-8", /* timeout: 0, data: null, dataType: null, username: null, password: null, cache: null, throws: false, traditional: false, headers: {}, */ accepts: { "*": allTypes, text: "text/plain", html: "text/html", xml: "application/xml, text/xml", json: "application/json, text/javascript" }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText", json: "responseJSON" }, // Data converters // Keys separate source (or catchall "*") and destination types with a single space converters: { // Convert anything to text "* text": String, // Text to html (true = no transformation) "text html": true, // Evaluate text as a json expression "text json": jQuery.parseJSON, // Parse text as xml "text xml": jQuery.parseXML }, // For options that shouldn't be deep extended: // you can add your own custom options here if // and when you create one that shouldn't be // deep extended (see ajaxExtend) flatOptions: { url: true, context: true } }, // Creates a full fledged settings object into target // with both ajaxSettings and settings fields. // If target is omitted, writes into ajaxSettings. ajaxSetup: function( target, settings ) { return settings ? // Building a settings object ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : // Extending ajaxSettings ajaxExtend( jQuery.ajaxSettings, target ); }, ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), ajaxTransport: addToPrefiltersOrTransports( transports ), // Main method ajax: function( url, options ) { // If url is an object, simulate pre-1.5 signature if ( typeof url === "object" ) { options = url; url = undefined; } // Force options to be an object options = options || {}; var // Cross-domain detection vars parts, // Loop variable i, // URL without anti-cache param cacheURL, // Response headers as string responseHeadersString, // timeout handle timeoutTimer, // To know if global events are to be dispatched fireGlobals, transport, // Response headers responseHeaders, // Create the final options object s = jQuery.ajaxSetup( {}, options ), // Callbacks context callbackContext = s.context || s, // Context for global events is callbackContext if it is a DOM node or jQuery collection globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? jQuery( callbackContext ) : jQuery.event, // Deferreds deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks("once memory"), // Status-dependent callbacks statusCode = s.statusCode || {}, // Headers (they are sent all at once) requestHeaders = {}, requestHeadersNames = {}, // The jqXHR state state = 0, // Default abort message strAbort = "canceled", // Fake xhr jqXHR = { readyState: 0, // Builds headers hashtable if needed getResponseHeader: function( key ) { var match; if ( state === 2 ) { if ( !responseHeaders ) { responseHeaders = {}; while ( (match = rheaders.exec( responseHeadersString )) ) { responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; } return match == null ? null : match; }, // Raw string getAllResponseHeaders: function() { return state === 2 ? responseHeadersString : null; }, // Caches the header setRequestHeader: function( name, value ) { var lname = name.toLowerCase(); if ( !state ) { name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; requestHeaders[ name ] = value; } return this; }, // Overrides response content-type header overrideMimeType: function( type ) { if ( !state ) { s.mimeType = type; } return this; }, // Status-dependent callbacks statusCode: function( map ) { var code; if ( map ) { if ( state < 2 ) { for ( code in map ) { // Lazy-add the new callback in a way that preserves old ones statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; } } else { // Execute the appropriate callbacks jqXHR.always( map[ jqXHR.status ] ); } } return this; }, // Cancel the request abort: function( statusText ) { var finalText = statusText || strAbort; if ( transport ) { transport.abort( finalText ); } done( 0, finalText ); return this; } }; // Attach deferreds deferred.promise( jqXHR ).complete = completeDeferred.add; jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; // Remove hash character (#7531: and string promotion) // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) // Handle falsy url in the settings object (#10093: consistency with old signature) // We also use the url parameter if available s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); // Alias method option to type as per ticket #12004 s.type = options.method || options.type || s.method || s.type; // Extract dataTypes list s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; // A cross-domain request is in order when we have a protocol:host:port mismatch if ( s.crossDomain == null ) { parts = rurl.exec( s.url.toLowerCase() ); s.crossDomain = !!( parts && ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) ); } // Convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data, s.traditional ); } // Apply prefilters inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); // If request was aborted inside a prefilter, stop there if ( state === 2 ) { return jqXHR; } // We can fire global events as of now if asked to // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) fireGlobals = jQuery.event && s.global; // Watch for a new set of requests if ( fireGlobals && jQuery.active++ === 0 ) { jQuery.event.trigger("ajaxStart"); } // Uppercase the type s.type = s.type.toUpperCase(); // Determine if request has content s.hasContent = !rnoContent.test( s.type ); // Save the URL in case we're toying with the If-Modified-Since // and/or If-None-Match header later on cacheURL = s.url; // More options handling for requests with no content if ( !s.hasContent ) { // If data is available, append data to url if ( s.data ) { cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); // #9682: remove data so that it's not used in an eventual retry delete s.data; } // Add anti-cache in url if needed if ( s.cache === false ) { s.url = rts.test( cacheURL ) ? // If there is already a '_' parameter, set its value cacheURL.replace( rts, "$1_=" + nonce++ ) : // Otherwise add one to the end cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; } } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { if ( jQuery.lastModified[ cacheURL ] ) { jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); } if ( jQuery.etag[ cacheURL ] ) { jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); } } // Set the correct header, if data is being sent if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { jqXHR.setRequestHeader( "Content-Type", s.contentType ); } // Set the Accepts header for the server, depending on the dataType jqXHR.setRequestHeader( "Accept", s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : s.accepts[ "*" ] ); // Check for headers option for ( i in s.headers ) { jqXHR.setRequestHeader( i, s.headers[ i ] ); } // Allow custom headers/mimetypes and early abort if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { // Abort if not done already and return return jqXHR.abort(); } // aborting is no longer a cancellation strAbort = "abort"; // Install callbacks on deferreds for ( i in { success: 1, error: 1, complete: 1 } ) { jqXHR[ i ]( s[ i ] ); } // Get transport transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); // If no transport, we auto-abort if ( !transport ) { done( -1, "No Transport" ); } else { jqXHR.readyState = 1; // Send global event if ( fireGlobals ) { globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); } // Timeout if ( s.async && s.timeout > 0 ) { timeoutTimer = setTimeout(function() { jqXHR.abort("timeout"); }, s.timeout ); } try { state = 1; transport.send( requestHeaders, done ); } catch ( e ) { // Propagate exception as error if not done if ( state < 2 ) { done( -1, e ); // Simply rethrow otherwise } else { throw e; } } } // Callback for when everything is done function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Called once if ( state === 2 ) { return; } // State is "done" now state = 2; // Clear timeout if it exists if ( timeoutTimer ) { clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Determine if successful isSuccess = status >= 200 && status < 300 || status === 304; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // Convert no matter what (that way responseXXX fields are always set) response = ajaxConvert( s, response, jqXHR, isSuccess ); // If successful, handle type chaining if ( isSuccess ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { modified = jqXHR.getResponseHeader("Last-Modified"); if ( modified ) { jQuery.lastModified[ cacheURL ] = modified; } modified = jqXHR.getResponseHeader("etag"); if ( modified ) { jQuery.etag[ cacheURL ] = modified; } } // if no content if ( status === 204 || s.type === "HEAD" ) { statusText = "nocontent"; // if not modified } else if ( status === 304 ) { statusText = "notmodified"; // If we have data, let's convert it } else { statusText = response.state; success = response.data; error = response.error; isSuccess = !error; } } else { // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; if ( status || !statusText ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger("ajaxStop"); } } } return jqXHR; }, getJSON: function( url, data, callback ) { return jQuery.get( url, data, callback, "json" ); }, getScript: function( url, callback ) { return jQuery.get( url, undefined, callback, "script" ); } }); jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { // shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; data = undefined; } return jQuery.ajax({ url: url, type: method, dataType: type, data: data, success: callback }); }; }); jQuery._evalUrl = function( url ) { return jQuery.ajax({ url: url, type: "GET", dataType: "script", async: false, global: false, "throws": true }); }; jQuery.fn.extend({ wrapAll: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapAll( html.call(this, i) ); }); } if ( this[0] ) { // The elements to wrap the target around var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); if ( this[0].parentNode ) { wrap.insertBefore( this[0] ); } wrap.map(function() { var elem = this; while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { elem = elem.firstChild; } return elem; }).append( this ); } return this; }, wrapInner: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapInner( html.call(this, i) ); }); } return this.each(function() { var self = jQuery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); } else { self.append( html ); } }); }, wrap: function( html ) { var isFunction = jQuery.isFunction( html ); return this.each(function(i) { jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); }); }, unwrap: function() { return this.parent().each(function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } }).end(); } }); jQuery.expr.filters.hidden = function( elem ) { // Support: Opera <= 12.12 // Opera reports offsetWidths and offsetHeights less than zero on some elements return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || (!support.reliableHiddenOffsets() && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); }; jQuery.expr.filters.visible = function( elem ) { return !jQuery.expr.filters.hidden( elem ); }; var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i; function buildParams( prefix, obj, traditional, add ) { var name; if ( jQuery.isArray( obj ) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { // Treat each array item as a scalar. add( prefix, v ); } else { // Item is non-scalar (array or object), encode its numeric index. buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); } }); } else if ( !traditional && jQuery.type( obj ) === "object" ) { // Serialize object item. for ( name in obj ) { buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); } } else { // Serialize scalar item. add( prefix, obj ); } } // Serialize an array of form elements or a set of // key/values into a query string jQuery.param = function( a, traditional ) { var prefix, s = [], add = function( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }; // Set traditional to true for jQuery <= 1.3.2 behavior. if ( traditional === undefined ) { traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; } // If an array was passed in, assume that it is an array of form elements. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); }); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( prefix in a ) { buildParams( prefix, a[ prefix ], traditional, add ); } } // Return the resulting serialization return s.join( "&" ).replace( r20, "+" ); }; jQuery.fn.extend({ serialize: function() { return jQuery.param( this.serializeArray() ); }, serializeArray: function() { return this.map(function() { // Can add propHook for "elements" to filter or add form elements var elements = jQuery.prop( this, "elements" ); return elements ? jQuery.makeArray( elements ) : this; }) .filter(function() { var type = this.type; // Use .is(":disabled") so that fieldset[disabled] works return this.name && !jQuery( this ).is( ":disabled" ) && rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && ( this.checked || !rcheckableType.test( type ) ); }) .map(function( i, elem ) { var val = jQuery( this ).val(); return val == null ? null : jQuery.isArray( val ) ? jQuery.map( val, function( val ) { return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }) : { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }).get(); } }); // Create the request object // (This is still attached to ajaxSettings for backward compatibility) jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? // Support: IE6+ function() { // XHR cannot access local files, always use ActiveX for that case return !this.isLocal && // Support: IE7-8 // oldIE XHR does not support non-RFC2616 methods (#13240) // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 // Although this check for six methods instead of eight // since IE also does not support "trace" and "connect" /^(get|post|head|put|delete|options)$/i.test( this.type ) && createStandardXHR() || createActiveXHR(); } : // For all other browsers, use the standard XMLHttpRequest object createStandardXHR; var xhrId = 0, xhrCallbacks = {}, xhrSupported = jQuery.ajaxSettings.xhr(); // Support: IE<10 // Open requests must be manually aborted on unload (#5280) // See https://support.microsoft.com/kb/2856746 for more info if ( window.attachEvent ) { window.attachEvent( "onunload", function() { for ( var key in xhrCallbacks ) { xhrCallbacks[ key ]( undefined, true ); } }); } // Determine support properties support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); xhrSupported = support.ajax = !!xhrSupported; // Create transport if the browser can provide an xhr if ( xhrSupported ) { jQuery.ajaxTransport(function( options ) { // Cross domain only allowed if supported through XMLHttpRequest if ( !options.crossDomain || support.cors ) { var callback; return { send: function( headers, complete ) { var i, xhr = options.xhr(), id = ++xhrId; // Open the socket xhr.open( options.type, options.url, options.async, options.username, options.password ); // Apply custom fields if provided if ( options.xhrFields ) { for ( i in options.xhrFields ) { xhr[ i ] = options.xhrFields[ i ]; } } // Override mime type if needed if ( options.mimeType && xhr.overrideMimeType ) { xhr.overrideMimeType( options.mimeType ); } // X-Requested-With header // For cross-domain requests, seeing as conditions for a preflight are // akin to a jigsaw puzzle, we simply never set it to be sure. // (it can always be set on a per-request basis or even using ajaxSetup) // For same-domain requests, won't change header if already provided. if ( !options.crossDomain && !headers["X-Requested-With"] ) { headers["X-Requested-With"] = "XMLHttpRequest"; } // Set headers for ( i in headers ) { // Support: IE<9 // IE's ActiveXObject throws a 'Type Mismatch' exception when setting // request header to a null-value. // // To keep consistent with other XHR implementations, cast the value // to string and ignore `undefined`. if ( headers[ i ] !== undefined ) { xhr.setRequestHeader( i, headers[ i ] + "" ); } } // Do send the request // This may raise an exception which is actually // handled in jQuery.ajax (so no try/catch here) xhr.send( ( options.hasContent && options.data ) || null ); // Listener callback = function( _, isAbort ) { var status, statusText, responses; // Was never called and is aborted or complete if ( callback && ( isAbort || xhr.readyState === 4 ) ) { // Clean up delete xhrCallbacks[ id ]; callback = undefined; xhr.onreadystatechange = jQuery.noop; // Abort manually if needed if ( isAbort ) { if ( xhr.readyState !== 4 ) { xhr.abort(); } } else { responses = {}; status = xhr.status; // Support: IE<10 // Accessing binary-data responseText throws an exception // (#11426) if ( typeof xhr.responseText === "string" ) { responses.text = xhr.responseText; } // Firefox throws an exception when accessing // statusText for faulty cross-domain requests try { statusText = xhr.statusText; } catch( e ) { // We normalize with Webkit giving an empty statusText statusText = ""; } // Filter status for non standard behaviors // If the request is local and we have data: assume a success // (success with no data won't get notified, that's the best we // can do given current implementations) if ( !status && options.isLocal && !options.crossDomain ) { status = responses.text ? 200 : 404; // IE - #1450: sometimes returns 1223 when it should be 204 } else if ( status === 1223 ) { status = 204; } } } // Call complete if needed if ( responses ) { complete( status, statusText, responses, xhr.getAllResponseHeaders() ); } }; if ( !options.async ) { // if we're in sync mode we fire the callback callback(); } else if ( xhr.readyState === 4 ) { // (IE6 & IE7) if it's in cache and has been // retrieved directly we need to fire the callback setTimeout( callback ); } else { // Add to the list of active xhr callbacks xhr.onreadystatechange = xhrCallbacks[ id ] = callback; } }, abort: function() { if ( callback ) { callback( undefined, true ); } } }; } }); } // Functions to create xhrs function createStandardXHR() { try { return new window.XMLHttpRequest(); } catch( e ) {} } function createActiveXHR() { try { return new window.ActiveXObject( "Microsoft.XMLHTTP" ); } catch( e ) {} } // Install script dataType jQuery.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /(?:java|ecma)script/ }, converters: { "text script": function( text ) { jQuery.globalEval( text ); return text; } } }); // Handle cache's special case and global jQuery.ajaxPrefilter( "script", function( s ) { if ( s.cache === undefined ) { s.cache = false; } if ( s.crossDomain ) { s.type = "GET"; s.global = false; } }); // Bind script tag hack transport jQuery.ajaxTransport( "script", function(s) { // This transport only deals with cross domain requests if ( s.crossDomain ) { var script, head = document.head || jQuery("head")[0] || document.documentElement; return { send: function( _, callback ) { script = document.createElement("script"); script.async = true; if ( s.scriptCharset ) { script.charset = s.scriptCharset; } script.src = s.url; // Attach handlers for all browsers script.onload = script.onreadystatechange = function( _, isAbort ) { if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { // Handle memory leak in IE script.onload = script.onreadystatechange = null; // Remove the script if ( script.parentNode ) { script.parentNode.removeChild( script ); } // Dereference the script script = null; // Callback if not abort if ( !isAbort ) { callback( 200, "success" ); } } }; // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending // Use native DOM manipulation to avoid our domManip AJAX trickery head.insertBefore( script, head.firstChild ); }, abort: function() { if ( script ) { script.onload( undefined, true ); } } }; } }); var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/; // Default jsonp settings jQuery.ajaxSetup({ jsonp: "callback", jsonpCallback: function() { var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); this[ callback ] = true; return callback; } }); // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? "url" : typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" ); // Handle iff the expected data type is "jsonp" or we have a parameter to set if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { // Get callback name, remembering preexisting value associated with it callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback; // Insert callback into url or form data if ( jsonProp ) { s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); } else if ( s.jsonp !== false ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; } // Use data converter to retrieve json after script execution s.converters["script json"] = function() { if ( !responseContainer ) { jQuery.error( callbackName + " was not called" ); } return responseContainer[ 0 ]; }; // force json dataType s.dataTypes[ 0 ] = "json"; // Install callback overwritten = window[ callbackName ]; window[ callbackName ] = function() { responseContainer = arguments; }; // Clean-up function (fires after converters) jqXHR.always(function() { // Restore preexisting value window[ callbackName ] = overwritten; // Save back as free if ( s[ callbackName ] ) { // make sure that re-using the options doesn't screw things around s.jsonpCallback = originalSettings.jsonpCallback; // save the callback name for future use oldCallbacks.push( callbackName ); } // Call if it was a function and we have a response if ( responseContainer && jQuery.isFunction( overwritten ) ) { overwritten( responseContainer[ 0 ] ); } responseContainer = overwritten = undefined; }); // Delegate to script return "script"; } }); // data: string of html // context (optional): If specified, the fragment will be created in this context, defaults to document // keepScripts (optional): If true, will include scripts passed in the html string jQuery.parseHTML = function( data, context, keepScripts ) { if ( !data || typeof data !== "string" ) { return null; } if ( typeof context === "boolean" ) { keepScripts = context; context = false; } context = context || document; var parsed = rsingleTag.exec( data ), scripts = !keepScripts && []; // Single tag if ( parsed ) { return [ context.createElement( parsed[1] ) ]; } parsed = jQuery.buildFragment( [ data ], context, scripts ); if ( scripts && scripts.length ) { jQuery( scripts ).remove(); } return jQuery.merge( [], parsed.childNodes ); }; // Keep a copy of the old load method var _load = jQuery.fn.load; /** * Load a url into a page */ jQuery.fn.load = function( url, params, callback ) { if ( typeof url !== "string" && _load ) { return _load.apply( this, arguments ); } var selector, response, type, self = this, off = url.indexOf(" "); if ( off >= 0 ) { selector = jQuery.trim( url.slice( off, url.length ) ); url = url.slice( 0, off ); } // If it's a function if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = undefined; // Otherwise, build a param string } else if ( params && typeof params === "object" ) { type = "POST"; } // If we have elements to modify, make the request if ( self.length > 0 ) { jQuery.ajax({ url: url, // if "type" variable is undefined, then "GET" method will be used type: type, dataType: "html", data: params }).done(function( responseText ) { // Save response for use in complete callback response = arguments; self.html( selector ? // If a selector was specified, locate the right elements in a dummy div // Exclude scripts to avoid IE 'Permission Denied' errors jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : // Otherwise use the full result responseText ); }).complete( callback && function( jqXHR, status ) { self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); }); } return this; }; // Attach a bunch of functions for handling common AJAX events jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { jQuery.fn[ type ] = function( fn ) { return this.on( type, fn ); }; }); jQuery.expr.filters.animated = function( elem ) { return jQuery.grep(jQuery.timers, function( fn ) { return elem === fn.elem; }).length; }; var docElem = window.document.documentElement; /** * Gets a window from an element */ function getWindow( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; } jQuery.offset = { setOffset: function( elem, options, i ) { var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css( elem, "position" ), curElem = jQuery( elem ), props = {}; // set position first, in-case top/left are set even on static elem if ( position === "static" ) { elem.style.position = "relative"; } curOffset = curElem.offset(); curCSSTop = jQuery.css( elem, "top" ); curCSSLeft = jQuery.css( elem, "left" ); calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1; // need to be able to calculate position if either top or left is auto and position is either absolute or fixed if ( calculatePosition ) { curPosition = curElem.position(); curTop = curPosition.top; curLeft = curPosition.left; } else { curTop = parseFloat( curCSSTop ) || 0; curLeft = parseFloat( curCSSLeft ) || 0; } if ( jQuery.isFunction( options ) ) { options = options.call( elem, i, curOffset ); } if ( options.top != null ) { props.top = ( options.top - curOffset.top ) + curTop; } if ( options.left != null ) { props.left = ( options.left - curOffset.left ) + curLeft; } if ( "using" in options ) { options.using.call( elem, props ); } else { curElem.css( props ); } } }; jQuery.fn.extend({ offset: function( options ) { if ( arguments.length ) { return options === undefined ? this : this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } var docElem, win, box = { top: 0, left: 0 }, elem = this[ 0 ], doc = elem && elem.ownerDocument; if ( !doc ) { return; } docElem = doc.documentElement; // Make sure it's not a disconnected DOM node if ( !jQuery.contains( docElem, elem ) ) { return box; } // If we don't have gBCR, just use 0,0 rather than error // BlackBerry 5, iOS 3 (original iPhone) if ( typeof elem.getBoundingClientRect !== strundefined ) { box = elem.getBoundingClientRect(); } win = getWindow( doc ); return { top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) }; }, position: function() { if ( !this[ 0 ] ) { return; } var offsetParent, offset, parentOffset = { top: 0, left: 0 }, elem = this[ 0 ]; // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent if ( jQuery.css( elem, "position" ) === "fixed" ) { // we assume that getBoundingClientRect is available when computed position is fixed offset = elem.getBoundingClientRect(); } else { // Get *real* offsetParent offsetParent = this.offsetParent(); // Get correct offsets offset = this.offset(); if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { parentOffset = offsetParent.offset(); } // Add offsetParent borders parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); } // Subtract parent offsets and element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 return { top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) }; }, offsetParent: function() { return this.map(function() { var offsetParent = this.offsetParent || docElem; while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) { offsetParent = offsetParent.offsetParent; } return offsetParent || docElem; }); } }); // Create scrollLeft and scrollTop methods jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { var top = /Y/.test( prop ); jQuery.fn[ method ] = function( val ) { return access( this, function( elem, method, val ) { var win = getWindow( elem ); if ( val === undefined ) { return win ? (prop in win) ? win[ prop ] : win.document.documentElement[ method ] : elem[ method ]; } if ( win ) { win.scrollTo( !top ? val : jQuery( win ).scrollLeft(), top ? val : jQuery( win ).scrollTop() ); } else { elem[ method ] = val; } }, method, val, arguments.length, null ); }; }); // Add the top/left cssHooks using jQuery.fn.position // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 // getComputedStyle returns percent when specified for top/left/bottom/right // rather than make the css module depend on the offset module, we just check for it here jQuery.each( [ "top", "left" ], function( i, prop ) { jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, function( elem, computed ) { if ( computed ) { computed = curCSS( elem, prop ); // if curCSS returns percentage, fallback to offset return rnumnonpx.test( computed ) ? jQuery( elem ).position()[ prop ] + "px" : computed; } } ); }); // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { // margin is only for outerHeight, outerWidth jQuery.fn[ funcName ] = function( margin, value ) { var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); return access( this, function( elem, type, value ) { var doc; if ( jQuery.isWindow( elem ) ) { // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there // isn't a whole lot we can do. See pull request at this URL for discussion: // https://github.com/jquery/jquery/pull/764 return elem.document.documentElement[ "client" + name ]; } // Get document width or height if ( elem.nodeType === 9 ) { doc = elem.documentElement; // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. return Math.max( elem.body[ "scroll" + name ], doc[ "scroll" + name ], elem.body[ "offset" + name ], doc[ "offset" + name ], doc[ "client" + name ] ); } return value === undefined ? // Get width or height on the element, requesting but not forcing parseFloat jQuery.css( elem, type, extra ) : // Set width or height on the element jQuery.style( elem, type, value, extra ); }, type, chainable ? margin : undefined, chainable, null ); }; }); }); // The number of elements contained in the matched element set jQuery.fn.size = function() { return this.length; }; jQuery.fn.andSelf = jQuery.fn.addBack; // Register as a named AMD module, since jQuery can be concatenated with other // files that may use define, but not via a proper concatenation script that // understands anonymous AMD modules. A named AMD is safest and most robust // way to register. Lowercase jquery is used because AMD module names are // derived from file names, and jQuery is normally delivered in a lowercase // file name. Do this after creating the global so that if an AMD module wants // to call noConflict to hide this version of jQuery, it will work. // Note that for maximum portability, libraries that are not jQuery should // declare themselves as anonymous modules, and avoid setting a global if an // AMD loader is present. jQuery is a special case. For more information, see // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon if ( typeof define === "function" && define.amd ) { define( "jquery", [], function() { return jQuery; }); } var // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$; jQuery.noConflict = function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }; // Expose jQuery and $ identifiers, even in // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) // and CommonJS for browser emulators (#13566) if ( typeof noGlobal === strundefined ) { window.jQuery = window.$ = jQuery; } return jQuery; }));
src/App.js
NihonGo-team/nihongo-cms
import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; class App extends Component { render() { return ( <div className="App"> <header className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <h1 className="App-title">Welcome to React</h1> </header> <p className="App-intro"> To get started, edit <code>src/App.js</code> and save to reload. </p> </div> ); } } export default App;
_site/js/jquery-1.11.1.js
maominghui/CleanMagicMedium-Jekyll
/*! * jQuery JavaScript Library v1.11.1 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2014-05-01T17:42Z */ (function( global, factory ) { if ( typeof module === "object" && typeof module.exports === "object" ) { module.exports = global.document ? factory( global, true ) : function( w ) { if ( !w.document ) { throw new Error( "jQuery requires a window with a document" ); } return factory( w ); }; } else { factory( global ); } }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { var deletedIds = []; var slice = deletedIds.slice; var concat = deletedIds.concat; var push = deletedIds.push; var indexOf = deletedIds.indexOf; var class2type = {}; var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; var support = {}; var version = "1.11.1", jQuery = function( selector, context ) { return new jQuery.fn.init( selector, context ); }, rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { jquery: version, constructor: jQuery, selector: "", length: 0, toArray: function() { return slice.call( this ); }, get: function( num ) { return num != null ? ( num < 0 ? this[ num + this.length ] : this[ num ] ) : slice.call( this ); }, pushStack: function( elems ) { var ret = jQuery.merge( this.constructor(), elems ); ret.prevObject = this; ret.context = this.context; return ret; }, each: function( callback, args ) { return jQuery.each( this, callback, args ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, slice: function() { return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); }, end: function() { return this.prevObject || this.constructor(null); }, push: push, sort: deletedIds.sort, splice: deletedIds.splice }; jQuery.extend = jQuery.fn.extend = function() { var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; if ( typeof target === "boolean" ) { deep = target; target = arguments[ i ] || {}; i++; } if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } if ( i === length ) { target = this; i--; } for ( ; i < length; i++ ) { if ( (options = arguments[ i ]) != null ) { for ( name in options ) { src = target[ name ]; copy = options[ name ]; if ( target === copy ) { continue; } if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } target[ name ] = jQuery.extend( deep, clone, copy ); } else if ( copy !== undefined ) { target[ name ] = copy; } } } } return target; }; jQuery.extend({ expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), isReady: true, error: function( msg ) { throw new Error( msg ); }, noop: function() {}, isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type(obj) === "array"; }, isWindow: function( obj ) { /* jshint eqeqeq: false */ return obj != null && obj == obj.window; }, isNumeric: function( obj ) { return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0; }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, isPlainObject: function( obj ) { var key; if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } try { if ( obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } } catch ( e ) { return false; } if ( support.ownLast ) { for ( key in obj ) { return hasOwn.call( obj, key ); } } for ( key in obj ) {} return key === undefined || hasOwn.call( obj, key ); }, type: function( obj ) { if ( obj == null ) { return obj + ""; } return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call(obj) ] || "object" : typeof obj; }, globalEval: function( data ) { if ( data && jQuery.trim( data ) ) { ( window.execScript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, each: function( obj, callback, args ) { var value, i = 0, length = obj.length, isArray = isArraylike( obj ); if ( args ) { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } } else { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } } return obj; }, trim: function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, makeArray: function( arr, results ) { var ret = results || []; if ( arr != null ) { if ( isArraylike( Object(arr) ) ) { jQuery.merge( ret, typeof arr === "string" ? [ arr ] : arr ); } else { push.call( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { var len; if ( arr ) { if ( indexOf ) { return indexOf.call( arr, elem, i ); } len = arr.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { if ( i in arr && arr[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var len = +second.length, j = 0, i = first.length; while ( j < len ) { first[ i++ ] = second[ j++ ]; } if ( len !== len ) { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, invert ) { var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; for ( ; i < length; i++ ) { callbackInverse = !callback( elems[ i ], i ); if ( callbackInverse !== callbackExpect ) { matches.push( elems[ i ] ); } } return matches; }, map: function( elems, callback, arg ) { var value, i = 0, length = elems.length, isArray = isArraylike( elems ), ret = []; if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } } else { for ( i in elems ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } } return concat.apply( [], ret ); }, guid: 1, proxy: function( fn, context ) { var args, proxy, tmp; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } if ( !jQuery.isFunction( fn ) ) { return undefined; } args = slice.call( arguments, 2 ); proxy = function() { return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); }; proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, now: function() { return +( new Date() ); }, support: support }); jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); function isArraylike( obj ) { var length = obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } if ( obj.nodeType === 1 && length ) { return true; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } var Sizzle = /*! * Sizzle CSS Selector Engine v1.10.19 * http://sizzlejs.com/ * * Copyright 2013 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2014-04-18 */ (function( window ) { var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, expando = "sizzle" + -(new Date()), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; } return 0; }, strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, hasOwn = ({}).hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, indexOf = arr.indexOf || function( elem ) { var i = 0, len = this.length; for ( ; i < len; i++ ) { if ( this[i] === elem ) { return i; } } return -1; }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", whitespace = "[\\x20\\t\\r\\n\\f]", characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", identifier = characterEncoding.replace( "w", "w#" ), attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + characterEncoding + ")(?:\\((" + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + ".*" + ")\\)|)", rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { "ID": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode( high + 0x10000 ) : String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }; try { push.apply( (arr = slice.call( preferredDoc.childNodes )), preferredDoc.childNodes ); arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { push = { apply: arr.length ? function( target, els ) { push_native.apply( target, slice.call(els) ); } : function( target, els ) { var j = target.length, i = 0; while ( (target[j++] = els[i++]) ) {} target.length = j - 1; } }; } function Sizzle( selector, context, results, seed ) { var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector; if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { setDocument( context ); } context = context || document; results = results || []; if ( !selector || typeof selector !== "string" ) { return results; } if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { return []; } if ( documentIsHTML && !seed ) { if ( (match = rquickExpr.exec( selector )) ) { if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); if ( elem && elem.parentNode ) { if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } } else if ( match[2] ) { push.apply( results, context.getElementsByTagName( selector ) ); return results; } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { nid = old = expando; newContext = context; newSelector = nodeType === 9 && selector; if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getAttribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + toSelector( groups[i] ); } newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; newSelector = groups.join(","); } if ( newSelector ) { try { push.apply( results, newContext.querySelectorAll( newSelector ) ); return results; } catch(qsaError) { } finally { if ( !old ) { context.removeAttribute("id"); } } } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed ); } /** * Create key-value caches of limited size * @returns {Function(string, Object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ function createCache() { var keys = []; function cache( key, value ) { if ( keys.push( key + " " ) > Expr.cacheLength ) { delete cache[ keys.shift() ]; } return (cache[ key + " " ] = value); } return cache; } /** * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ function markFunction( fn ) { fn[ expando ] = true; return fn; } /** * Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result */ function assert( fn ) { var div = document.createElement("div"); try { return !!fn( div ); } catch (e) { return false; } finally { if ( div.parentNode ) { div.parentNode.removeChild( div ); } div = null; } } /** * Adds the same handler for all of the specified attrs * @param {String} attrs Pipe-separated list of attributes * @param {Function} handler The method that will be applied */ function addHandle( attrs, handler ) { var arr = attrs.split("|"), i = attrs.length; while ( i-- ) { Expr.attrHandle[ arr[i] ] = handler; } } /** * Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b */ function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); if ( diff ) { return diff; } if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; } /** * Returns a function to use in pseudos for input types * @param {String} type */ function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } /** * Returns a function to use in pseudos for buttons * @param {String} type */ function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } /** * Returns a function to use in pseudos for positionals * @param {Function} fn */ function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Checks a node for validity as a Sizzle context * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ function testContext( context ) { return context && typeof context.getElementsByTagName !== strundefined && context; } support = Sizzle.support = {}; /** * Detects XML nodes * @param {Element|Object} elem An element or a document * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { var hasCompare, doc = node ? node.ownerDocument || node : preferredDoc, parent = doc.defaultView; if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { return document; } document = doc; docElem = doc.documentElement; documentIsHTML = !isXML( doc ); if ( parent && parent !== parent.top ) { if ( parent.addEventListener ) { parent.addEventListener( "unload", function() { setDocument(); }, false ); } else if ( parent.attachEvent ) { parent.attachEvent( "onunload", function() { setDocument(); }); } } /* Attributes ---------------------------------------------------------------------- */ support.attributes = assert(function( div ) { div.className = "i"; return !div.getAttribute("className"); }); /* getElement(s)By* ---------------------------------------------------------------------- */ support.getElementsByTagName = assert(function( div ) { div.appendChild( doc.createComment("") ); return !div.getElementsByTagName("*").length; }); support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { div.innerHTML = "<div class='a'></div><div class='a i'></div>"; div.firstChild.className = "i"; return div.getElementsByClassName("i").length === 2; }); support.getById = assert(function( div ) { docElem.appendChild( div ).id = expando; return !doc.getElementsByName || !doc.getElementsByName( expando ).length; }); if ( support.getById ) { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== strundefined && documentIsHTML ) { var m = context.getElementById( id ); return m && m.parentNode ? [ m ] : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; } else { delete Expr.find["ID"]; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; } Expr.find["TAG"] = support.getElementsByTagName ? function( tag, context ) { if ( typeof context.getElementsByTagName !== strundefined ) { return context.getElementsByTagName( tag ); } } : function( tag, context ) { var elem, tmp = [], i = 0, results = context.getElementsByTagName( tag ); if ( tag === "*" ) { while ( (elem = results[i++]) ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }; Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { return context.getElementsByClassName( className ); } }; /* QSA/matchesSelector ---------------------------------------------------------------------- */ rbuggyMatches = []; rbuggyQSA = []; if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { assert(function( div ) { div.innerHTML = "<select msallowclip=''><option selected=''></option></select>"; if ( div.querySelectorAll("[msallowclip^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } }); assert(function( div ) { var input = doc.createElement("input"); input.setAttribute( "type", "hidden" ); div.appendChild( input ).setAttribute( "name", "D" ); if ( div.querySelectorAll("[name=d]").length ) { rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); } if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( div ) { support.disconnectedMatch = matches.call( div, "div" ); matches.call( div, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); /* Contains ---------------------------------------------------------------------- */ hasCompare = rnative.test( docElem.compareDocumentPosition ); contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; /* Sorting ---------------------------------------------------------------------- */ sortOrder = hasCompare ? function( a, b ) { if ( a === b ) { hasDuplicate = true; return 0; } var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; if ( compare ) { return compare; } compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? a.compareDocumentPosition( b ) : 1; if ( compare & 1 || (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { return -1; } if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { return 1; } return sortInput ? ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; } : function( a, b ) { if ( a === b ) { hasDuplicate = true; return 0; } var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ]; if ( !aup || !bup ) { return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 0; } else if ( aup === bup ) { return siblingCheck( a, b ); } cur = a; while ( (cur = cur.parentNode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentNode) ) { bp.unshift( cur ); } while ( ap[i] === bp[i] ) { i++; } return i ? siblingCheck( ap[i], bp[i] ) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; return doc; }; Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } expr = expr.replace( rattributeQuotes, "='$1']" ); if ( support.matchesSelector && documentIsHTML && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { try { var ret = matches.call( elem, expr ); if ( ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch(e) {} } return Sizzle( expr, document, null, [ elem ] ).length > 0; }; Sizzle.contains = function( context, elem ) { if ( ( context.ownerDocument || context ) !== document ) { setDocument( context ); } return contains( context, elem ); }; Sizzle.attr = function( elem, name ) { if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } var fn = Expr.attrHandle[ name.toLowerCase() ], val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? fn( elem, name, !documentIsHTML ) : undefined; return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute( name ) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; /** * Document sorting and removing duplicates * @param {ArrayLike} results */ Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; hasDuplicate = !support.detectDuplicates; sortInput = !support.sortStable && results.slice( 0 ); results.sort( sortOrder ); if ( hasDuplicate ) { while ( (elem = results[i++]) ) { if ( elem === results[ i ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } sortInput = null; return results; }; /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { while ( (node = elem[i++]) ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } return ret; }; Expr = Sizzle.selectors = { cacheLength: 50, createPseudo: markFunction, match: matchExpr, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( runescape, funescape ); match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1].slice( 0, 3 ) === "nth" ) { if ( !match[3] ) { Sizzle.error( match[0] ); } match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); } else if ( match[3] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var excess, unquoted = !match[6] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } if ( match[3] ) { match[2] = match[4] || match[5] || ""; } else if ( unquoted && rpseudo.test( unquoted ) && (excess = tokenize( unquoted, true )) && (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { match[0] = match[0].slice( 0, excess ); match[2] = unquoted.slice( 0, excess ); } return match.slice( 0, 3 ); } }, filter: { "TAG": function( nodeNameSelector ) { var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, what, argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; return first === 1 && last === 0 ? function( elem ) { return !!elem.parentNode; } : function( elem, context, xml ) { var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType; if ( parent ) { if ( simple ) { while ( dir ) { node = elem; while ( (node = node[ dir ]) ) { if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { return false; } } start = dir = type === "only" && !start && "nextSibling"; } return true; } start = [ forward ? parent.firstChild : parent.lastChild ]; if ( forward && useCache ) { outerCache = parent[ expando ] || (parent[ expando ] = {}); cache = outerCache[ type ] || []; nodeIndex = cache[0] === dirruns && cache[1]; diff = cache[0] === dirruns && cache[2]; node = nodeIndex && parent.childNodes[ nodeIndex ]; while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { if ( node.nodeType === 1 && ++diff && node === elem ) { outerCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { diff = cache[1]; } else { while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { if ( useCache ) { (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; } if ( node === elem ) { break; } } } } diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); } }; }, "PSEUDO": function( pseudo, argument ) { var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); if ( fn[ expando ] ) { return fn( argument ); } if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf.call( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { "not": markFunction(function( selector ) { var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), "lang": markFunction( function( lang ) { if ( !ridentifier.test(lang || "") ) { Sizzle.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { var elemLang; do { if ( (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { elemLang = elemLang.toLowerCase(); return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; } } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); return false; }; }), "target": function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docElem; }, "focus": function( elem ) { return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, "empty": function( elem ) { for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { if ( elem.nodeType < 6 ) { return false; } } return true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); }, "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; Expr.pseudos["nth"] = Expr.pseudos["eq"]; for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); } for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); tokenize = Sizzle.tokenize = function( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { soFar = soFar.slice( match[0].length ) || soFar; } groups.push( (tokens = []) ); } matched = false; if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); tokens.push({ value: matched, type: match[0].replace( rtrim, " " ) }); soFar = soFar.slice( matched.length ); } for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); tokens.push({ value: matched, type: type, matches: match }); soFar = soFar.slice( matched.length ); } } if ( !matched ) { break; } } return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : tokenCache( selector, groups ).slice( 0 ); }; function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && dir === "parentNode", doneName = done++; return combinator.first ? function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } } : function( elem, context, xml ) { var oldCache, outerCache, newCache = [ dirruns, doneName ]; if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); if ( (oldCache = outerCache[ dir ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { return (newCache[ 2 ] = oldCache[ 2 ]); } else { outerCache[ dir ] = newCache; if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { return true; } } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? postFinder || ( seed ? preFilter : preexisting || postFilter ) ? [] : results : matcherIn; if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf.call( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); if ( matcher[ expando ] ) { j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && toSelector( tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length; if ( outermost ) { outermostContext = context !== document && context; } for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; } } if ( bySet ) { if ( (elem = !matcher && elem) ) { matchedCount--; } if ( seed ) { unmatched.push( elem ); } } } matchedCount += i; if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } setMatched = condense( setMatched ); } push.apply( results, setMatched ); if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ selector + " " ]; if ( !cached ) { if ( !match ) { match = tokenize( selector ); } i = match.length; while ( i-- ) { cached = matcherFromTokens( match[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); cached.selector = selector; } return cached; }; /** * A low-level selection function that works with Sizzle's compiled * selector functions * @param {String|Function} selector A selector or a pre-compiled * selector function built with Sizzle.compile * @param {Element} context * @param {Array} [results] * @param {Array} [seed] A set of elements to match against */ select = Sizzle.select = function( selector, context, results, seed ) { var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize( (selector = compiled.selector || selector) ); results = results || []; if ( match.length === 1 ) { tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { return results; } else if ( compiled ) { context = context.parentNode; } selector = selector.slice( tokens.shift().value.length ); } i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[i]; if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context )) ) { tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, seed ); return results; } break; } } } } ( compiled || compile( selector, match ) )( seed, context, !documentIsHTML, results, rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; }; support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; support.detectDuplicates = !!hasDuplicate; setDocument(); support.sortDetached = assert(function( div1 ) { return div1.compareDocumentPosition( document.createElement("div") ) & 1; }); if ( !assert(function( div ) { div.innerHTML = "<a href='#'></a>"; return div.firstChild.getAttribute("href") === "#" ; }) ) { addHandle( "type|href|height|width", function( elem, name, isXML ) { if ( !isXML ) { return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); } }); } if ( !support.attributes || !assert(function( div ) { div.innerHTML = "<input/>"; div.firstChild.setAttribute( "value", "" ); return div.firstChild.getAttribute( "value" ) === ""; }) ) { addHandle( "value", function( elem, name, isXML ) { if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { return elem.defaultValue; } }); } if ( !assert(function( div ) { return div.getAttribute("disabled") == null; }) ) { addHandle( booleans, function( elem, name, isXML ) { var val; if ( !isXML ) { return elem[ name ] === true ? name.toLowerCase() : (val = elem.getAttributeNode( name )) && val.specified ? val.value : null; } }); } return Sizzle; })( window ); jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; var rneedsContext = jQuery.expr.match.needsContext; var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); var risSimple = /^.[^:#\[\.,]*$/; function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; }); } if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; }); } if ( typeof qualifier === "string" ) { if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not ); } qualifier = jQuery.filter( qualifier, elements ); } return jQuery.grep( elements, function( elem ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; }); } jQuery.filter = function( expr, elems, not ) { var elem = elems[ 0 ]; if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { return elem.nodeType === 1; })); }; jQuery.fn.extend({ find: function( selector ) { var i, ret = [], self = this, len = self.length; if ( typeof selector !== "string" ) { return this.pushStack( jQuery( selector ).filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } }) ); } for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); ret.selector = this.selector ? this.selector + " " + selector : selector; return ret; }, filter: function( selector ) { return this.pushStack( winnow(this, selector || [], false) ); }, not: function( selector ) { return this.pushStack( winnow(this, selector || [], true) ); }, is: function( selector ) { return !!winnow( this, typeof selector === "string" && rneedsContext.test( selector ) ? jQuery( selector ) : selector || [], false ).length; } }); var rootjQuery, document = window.document, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, init = jQuery.fn.init = function( selector, context ) { var match, elem; if ( !selector ) { return this; } if ( typeof selector === "string" ) { if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } if ( match && (match[1] || !context) ) { if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; jQuery.merge( this, jQuery.parseHTML( match[1], context && context.nodeType ? context.ownerDocument || context : document, true ) ); if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { for ( match in context ) { if ( jQuery.isFunction( this[ match ] ) ) { this[ match ]( context[ match ] ); } else { this.attr( match, context[ match ] ); } } } return this; } else { elem = document.getElementById( match[2] ); if ( elem && elem.parentNode ) { if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } } else if ( !context || context.jquery ) { return ( context || rootjQuery ).find( selector ); } else { return this.constructor( context ).find( selector ); } } else if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; } else if ( jQuery.isFunction( selector ) ) { return typeof rootjQuery.ready !== "undefined" ? rootjQuery.ready( selector ) : selector( jQuery ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }; init.prototype = jQuery.fn; rootjQuery = jQuery( document ); var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.extend({ dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); jQuery.fn.extend({ has: function( target ) { var i, targets = jQuery( target, this ), len = targets.length; return this.filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, matched = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { if ( cur.nodeType < 11 && (pos ? pos.index(cur) > -1 : cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors)) ) { matched.push( cur ); break; } } } return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); }, index: function( elem ) { if ( !elem ) { return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; } if ( typeof elem === "string" ) { return jQuery.inArray( this[0], jQuery( elem ) ); } return jQuery.inArray( elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { return this.pushStack( jQuery.unique( jQuery.merge( this.get(), jQuery( selector, context ) ) ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter(selector) ); } }); function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodeType !== 1 ); return cur; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); if ( name.slice( -5 ) !== "Until" ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } if ( this.length > 1 ) { if ( !guaranteedUnique[ name ] ) { ret = jQuery.unique( ret ); } if ( rparentsprev.test( name ) ) { ret = ret.reverse(); } } return this.pushStack( ret ); }; }); var rnotwhite = (/\S+/g); var optionsCache = {}; function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; }); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { options = typeof options === "string" ? ( optionsCache[ options ] || createOptions( options ) ) : jQuery.extend( {}, options ); var firing, memory, fired, firingLength, firingIndex, firingStart, list = [], stack = !options.once && [], fire = function( data ) { memory = options.memory && data; fired = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; firing = true; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { memory = false; break; } } firing = false; if ( list ) { if ( stack ) { if ( stack.length ) { fire( stack.shift() ); } } else if ( memory ) { list = []; } else { self.disable(); } } }, self = { add: function() { if ( list ) { var start = list.length; (function add( args ) { jQuery.each( args, function( _, arg ) { var type = jQuery.type( arg ); if ( type === "function" ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && type !== "string" ) { add( arg ); } }); })( arguments ); if ( firing ) { firingLength = list.length; } else if ( memory ) { firingStart = start; fire( memory ); } } return this; }, remove: function() { if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); if ( firing ) { if ( index <= firingLength ) { firingLength--; } if ( index <= firingIndex ) { firingIndex--; } } } }); } return this; }, has: function( fn ) { return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); }, empty: function() { list = []; firingLength = 0; return this; }, disable: function() { list = stack = memory = undefined; return this; }, disabled: function() { return !list; }, lock: function() { stack = undefined; if ( !memory ) { self.disable(); } return this; }, locked: function() { return !stack; }, fireWith: function( context, args ) { if ( list && ( !fired || stack ) ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; if ( firing ) { stack.push( args ); } else { fire( args ); } } return this; }, fire: function() { self.fireWith( this, arguments ); return this; }, fired: function() { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function( func ) { var tuples = [ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], [ "notify", "progress", jQuery.Callbacks("memory") ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; deferred[ tuple[1] ](function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .done( newDefer.resolve ) .fail( newDefer.reject ) .progress( newDefer.notify ); } else { newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); } }); }); fns = null; }).promise(); }, promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; promise.pipe = promise.then; jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; promise[ tuple[1] ] = list.add; if ( stateString ) { list.add(function() { state = stateString; }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } deferred[ tuple[0] ] = function() { deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); return this; }; deferred[ tuple[0] + "With" ] = list.fireWith; }); promise.promise( deferred ); if ( func ) { func.call( deferred, deferred ); } return deferred; }, when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = slice.call( arguments ), length = resolveValues.length, remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, deferred = remaining === 1 ? subordinate : jQuery.Deferred(), updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !(--remaining) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ) .progress( updateFunc( i, progressContexts, progressValues ) ); } else { --remaining; } } } if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } }); var readyList; jQuery.fn.ready = function( fn ) { jQuery.ready.promise().done( fn ); return this; }; jQuery.extend({ isReady: false, readyWait: 1, holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, ready: function( wait ) { if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } if ( !document.body ) { return setTimeout( jQuery.ready ); } jQuery.isReady = true; if ( wait !== true && --jQuery.readyWait > 0 ) { return; } readyList.resolveWith( document, [ jQuery ] ); if ( jQuery.fn.triggerHandler ) { jQuery( document ).triggerHandler( "ready" ); jQuery( document ).off( "ready" ); } } }); /** * Clean-up method for dom ready events */ function detach() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", completed, false ); window.removeEventListener( "load", completed, false ); } else { document.detachEvent( "onreadystatechange", completed ); window.detachEvent( "onload", completed ); } } /** * The ready event handler and self cleanup method */ function completed() { // readyState === "complete" is good enough for us to call the dom ready in oldIE if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { detach(); jQuery.ready(); } } jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); if ( document.readyState === "complete" ) { setTimeout( jQuery.ready ); } else if ( document.addEventListener ) { document.addEventListener( "DOMContentLoaded", completed, false ); window.addEventListener( "load", completed, false ); } else { document.attachEvent( "onreadystatechange", completed ); window.attachEvent( "onload", completed ); var top = false; try { top = window.frameElement == null && document.documentElement; } catch(e) {} if ( top && top.doScroll ) { (function doScrollCheck() { if ( !jQuery.isReady ) { try { top.doScroll("left"); } catch(e) { return setTimeout( doScrollCheck, 50 ); } detach(); jQuery.ready(); } })(); } } } return readyList.promise( obj ); }; var strundefined = typeof undefined; var i; for ( i in jQuery( support ) ) { break; } support.ownLast = i !== "0"; support.inlineBlockNeedsLayout = false; jQuery(function() { var val, div, body, container; body = document.getElementsByTagName( "body" )[ 0 ]; if ( !body || !body.style ) { return; } div = document.createElement( "div" ); container = document.createElement( "div" ); container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; body.appendChild( container ).appendChild( div ); if ( typeof div.style.zoom !== strundefined ) { div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; if ( val ) { body.style.zoom = 1; } } body.removeChild( container ); }); (function() { var div = document.createElement( "div" ); if (support.deleteExpando == null) { support.deleteExpando = true; try { delete div.test; } catch( e ) { support.deleteExpando = false; } } div = null; })(); /** * Determines whether an object can have data */ jQuery.acceptData = function( elem ) { var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ], nodeType = +elem.nodeType || 1; return nodeType !== 1 && nodeType !== 9 ? false : !noData || noData !== true && elem.getAttribute("classid") === noData; }; var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /([A-Z])/g; function dataAttr( elem, key, data ) { if ( data === undefined && elem.nodeType === 1 ) { var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } function isEmptyDataObject( obj ) { var name; for ( name in obj ) { if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; } function internalData( elem, name, data, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var ret, thisCache, internalKey = jQuery.expando, isNode = elem.nodeType, cache = isNode ? jQuery.cache : elem, id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { return; } if ( !id ) { if ( isNode ) { id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; } else { id = internalKey; } } if ( !cache[ id ] ) { cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; } if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } thisCache = cache[ id ]; if ( !pvt ) { if ( !thisCache.data ) { thisCache.data = {}; } thisCache = thisCache.data; } if ( data !== undefined ) { thisCache[ jQuery.camelCase( name ) ] = data; } if ( typeof name === "string" ) { ret = thisCache[ name ]; if ( ret == null ) { ret = thisCache[ jQuery.camelCase( name ) ]; } } else { ret = thisCache; } return ret; } function internalRemoveData( elem, name, pvt ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, i, isNode = elem.nodeType, cache = isNode ? jQuery.cache : elem, id = isNode ? elem[ jQuery.expando ] : jQuery.expando; if ( !cache[ id ] ) { return; } if ( name ) { thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { if ( !jQuery.isArray( name ) ) { if ( name in thisCache ) { name = [ name ]; } else { name = jQuery.camelCase( name ); if ( name in thisCache ) { name = [ name ]; } else { name = name.split(" "); } } } else { name = name.concat( jQuery.map( name, jQuery.camelCase ) ); } i = name.length; while ( i-- ) { delete thisCache[ name[i] ]; } if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { return; } } } if ( !pvt ) { delete cache[ id ].data; if ( !isEmptyDataObject( cache[ id ] ) ) { return; } } if ( isNode ) { jQuery.cleanData( [ elem ], true ); } else if ( support.deleteExpando || cache != cache.window ) { delete cache[ id ]; } else { cache[ id ] = null; } } jQuery.extend({ cache: {}, noData: { "applet ": true, "embed ": true, "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); }, data: function( elem, name, data ) { return internalData( elem, name, data ); }, removeData: function( elem, name ) { return internalRemoveData( elem, name ); }, _data: function( elem, name, data ) { return internalData( elem, name, data, true ); }, _removeData: function( elem, name ) { return internalRemoveData( elem, name, true ); } }); jQuery.fn.extend({ data: function( key, value ) { var i, name, data, elem = this[0], attrs = elem && elem.attributes; if ( key === undefined ) { if ( this.length ) { data = jQuery.data( elem ); if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { i = attrs.length; while ( i-- ) { if ( attrs[ i ] ) { name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { name = jQuery.camelCase( name.slice(5) ); dataAttr( elem, name, data[ name ] ); } } } jQuery._data( elem, "parsedAttrs", true ); } } return data; } if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } return arguments.length > 1 ? this.each(function() { jQuery.data( this, key, value ); }) : elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); jQuery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = jQuery._data( elem, type ); if ( data ) { if ( !queue || jQuery.isArray(data) ) { queue = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { if ( type === "fx" ) { queue.unshift( "inprogress" ); } delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return jQuery._data( elem, key ) || jQuery._data( elem, key, { empty: jQuery.Callbacks("once memory").add(function() { jQuery._removeData( elem, type + "queue" ); jQuery._removeData( elem, key ); }) }); } }); jQuery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jQuery.queue( this, type, data ); jQuery._queueHooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while ( i-- ) { tmp = jQuery._data( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } }); var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; var isHidden = function( elem, el ) { elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); }; var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, length = elems.length, bulk = key == null; if ( jQuery.type( key ) === "object" ) { chainable = true; for ( i in key ) { jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); } } else if ( value !== undefined ) { chainable = true; if ( !jQuery.isFunction( value ) ) { raw = true; } if ( bulk ) { if ( raw ) { fn.call( elems, value ); fn = null; } else { bulk = fn; fn = function( elem, key, value ) { return bulk.call( jQuery( elem ), value ); }; } } if ( fn ) { for ( ; i < length; i++ ) { fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); } } } return chainable ? elems : bulk ? fn.call( elems ) : length ? fn( elems[0], key ) : emptyGet; }; var rcheckableType = (/^(?:checkbox|radio)$/i); (function() { var input = document.createElement( "input" ), div = document.createElement( "div" ), fragment = document.createDocumentFragment(); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; support.leadingWhitespace = div.firstChild.nodeType === 3; support.tbody = !div.getElementsByTagName( "tbody" ).length; support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; support.html5Clone = document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; input.type = "checkbox"; input.checked = true; fragment.appendChild( input ); support.appendChecked = input.checked; div.innerHTML = "<textarea>x</textarea>"; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; fragment.appendChild( div ); div.innerHTML = "<input type='radio' checked='checked' name='t'/>"; support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; support.noCloneEvent = true; if ( div.attachEvent ) { div.attachEvent( "onclick", function() { support.noCloneEvent = false; }); div.cloneNode( true ).click(); } if (support.deleteExpando == null) { support.deleteExpando = true; try { delete div.test; } catch( e ) { support.deleteExpando = false; } } })(); (function() { var i, eventName, div = document.createElement( "div" ); for ( i in { submit: true, change: true, focusin: true }) { eventName = "on" + i; if ( !(support[ i + "Bubbles" ] = eventName in window) ) { div.setAttribute( eventName, "t" ); support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; } } div = null; })(); var rformElems = /^(?:input|select|textarea)$/i, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; function returnTrue() { return true; } function returnFalse() { return false; } function safeActiveElement() { try { return document.activeElement; } catch ( err ) { } } /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { global: {}, add: function( elem, types, handler, data, selector ) { var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data( elem ); if ( !elemData ) { return; } if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } if ( !handler.guid ) { handler.guid = jQuery.guid++; } if ( !(events = elemData.events) ) { events = elemData.events = {}; } if ( !(eventHandle = elemData.handle) ) { eventHandle = elemData.handle = function( e ) { return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; eventHandle.elem = elem; } types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); if ( !type ) { continue; } special = jQuery.event.special[ type ] || {}; type = ( selector ? special.delegateType : special.bindType ) || type; special = jQuery.event.special[ type ] || {}; handleObj = jQuery.extend({ type: type, origType: origType, data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join(".") }, handleObjIn ); if ( !(handlers = events[ type ]) ) { handlers = events[ type ] = []; handlers.delegateCount = 0; if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } jQuery.event.global[ type ] = true; } elem = null; }, remove: function( elem, types, handler, selector, mappedTypes ) { var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData( elem ) && jQuery._data( elem ); if ( !elemData || !(events = elemData.events) ) { return; } types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector ? special.delegateType : special.bindType ) || type; handlers = events[ type ] || []; tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); origCount = j = handlers.length; while ( j-- ) { handleObj = handlers[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !tmp || tmp.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { handlers.splice( j, 1 ); if ( handleObj.selector ) { handlers.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } if ( origCount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; jQuery._removeData( elem, "events" ); } }, trigger: function( event, data, elem, onlyHandlers ) { var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [ elem || document ], type = hasOwn.call( event, "type" ) ? event.type : event, namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; cur = tmp = elem = elem || document; if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf(".") >= 0 ) { namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } ontype = type.indexOf(":") < 0 && "on" + type; event = event[ jQuery.expando ] ? event : new jQuery.Event( type, typeof event === "object" && event ); event.isTrigger = onlyHandlers ? 2 : 3; event.namespace = namespaces.join("."); event.namespace_re = event.namespace ? new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : null; event.result = undefined; if ( !event.target ) { event.target = elem; } data = data == null ? [ event ] : jQuery.makeArray( data, [ event ] ); special = jQuery.event.special[ type ] || {}; if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { return; } if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; if ( !rfocusMorph.test( bubbleType + type ) ) { cur = cur.parentNode; } for ( ; cur; cur = cur.parentNode ) { eventPath.push( cur ); tmp = cur; } if ( tmp === (elem.ownerDocument || document) ) { eventPath.push( tmp.defaultView || tmp.parentWindow || window ); } } i = 0; while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { event.type = i > 1 ? bubbleType : special.bindType || type; handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } handle = ontype && cur[ ontype ]; if ( handle && handle.apply && jQuery.acceptData( cur ) ) { event.result = handle.apply( cur, data ); if ( event.result === false ) { event.preventDefault(); } } } event.type = type; if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && jQuery.acceptData( elem ) ) { if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { tmp = elem[ ontype ]; if ( tmp ) { elem[ ontype ] = null; } jQuery.event.triggered = type; try { elem[ type ](); } catch ( e ) { } jQuery.event.triggered = undefined; if ( tmp ) { elem[ ontype ] = tmp; } } } } return event.result; }, dispatch: function( event ) { event = jQuery.event.fix( event ); var i, ret, handleObj, matched, j, handlerQueue = [], args = slice.call( arguments ), handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; args[0] = event; event.delegateTarget = this; if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } handlerQueue = jQuery.event.handlers.call( this, event, handlers ); i = 0; while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { event.currentTarget = matched.elem; j = 0; while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { event.handleObj = handleObj; event.data = handleObj.data; ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { if ( (event.result = ret) === false ) { event.preventDefault(); event.stopPropagation(); } } } } } if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, handlers: function( event, handlers ) { var sel, handleObj, matches, i, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { for ( ; cur != this; cur = cur.parentNode || this ) { if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; sel = handleObj.selector + " "; if ( matches[ sel ] === undefined ) { matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( matches[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, handlers: matches }); } } } } if ( delegateCount < handlers.length ) { handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); } return handlerQueue; }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } var i, prop, copy, type = event.type, originalEvent = event, fixHook = this.fixHooks[ type ]; if ( !fixHook ) { this.fixHooks[ type ] = fixHook = rmouseEvent.test( type ) ? this.mouseHooks : rkeyEvent.test( type ) ? this.keyHooks : {}; } copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = new jQuery.Event( originalEvent ); i = copy.length; while ( i-- ) { prop = copy[ i ]; event[ prop ] = originalEvent[ prop ]; } if ( !event.target ) { event.target = originalEvent.srcElement || document; } if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } event.metaKey = !!event.metaKey; return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var body, eventDoc, doc, button = original.button, fromElement = original.fromElement; if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, special: { load: { noBubble: true }, focus: { trigger: function() { if ( this !== safeActiveElement() && this.focus ) { try { this.focus(); return false; } catch ( e ) { } } }, delegateType: "focusin" }, blur: { trigger: function() { if ( this === safeActiveElement() && this.blur ) { this.blur(); return false; } }, delegateType: "focusout" }, click: { trigger: function() { if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { this.click(); return false; } }, _default: function( event ) { return jQuery.nodeName( event.target, "a" ); } }, beforeunload: { postDispatch: function( event ) { if ( event.result !== undefined && event.originalEvent ) { event.originalEvent.returnValue = event.result; } } } }, simulate: function( type, elem, event, bubble ) { var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { var name = "on" + type; if ( elem.detachEvent ) { if ( typeof elem[ name ] === strundefined ) { elem[ name ] = null; } elem.detachEvent( name, handle ); } }; jQuery.Event = function( src, props ) { if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } if ( src && src.type ) { this.originalEvent = src; this.type = src.type; this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && src.returnValue === false ? returnTrue : returnFalse; } else { this.type = src; } if ( props ) { jQuery.extend( this, props ); } this.timeStamp = src && src.timeStamp || jQuery.now(); this[ jQuery.expando ] = true; }; jQuery.Event.prototype = { isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; if ( !e ) { return; } if ( e.preventDefault ) { e.preventDefault(); } else { e.returnValue = false; } }, stopPropagation: function() { var e = this.originalEvent; this.isPropagationStopped = returnTrue; if ( !e ) { return; } if ( e.stopPropagation ) { e.stopPropagation(); } e.cancelBubble = true; }, stopImmediatePropagation: function() { var e = this.originalEvent; this.isImmediatePropagationStopped = returnTrue; if ( e && e.stopImmediatePropagation ) { e.stopImmediatePropagation(); } this.stopPropagation(); } }; jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; if ( !related || (related !== target && !jQuery.contains( target, related )) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); if ( !support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { if ( jQuery.nodeName( this, "form" ) ) { return false; } jQuery.event.add( this, "click._submit keypress._submit", function( e ) { var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; if ( form && !jQuery._data( form, "submitBubbles" ) ) { jQuery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); jQuery._data( form, "submitBubbles", true ); } }); }, postDispatch: function( event ) { if ( event._submit_bubble ) { delete event._submit_bubble; if ( this.parentNode && !event.isTrigger ) { jQuery.event.simulate( "submit", this.parentNode, event, true ); } } }, teardown: function() { if ( jQuery.nodeName( this, "form" ) ) { return false; } jQuery.event.remove( this, "._submit" ); } }; } if ( !support.changeBubbles ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._just_changed = true; } }); jQuery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.isTrigger ) { this._just_changed = false; } jQuery.event.simulate( "change", this, event, true ); }); } return false; } jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); jQuery._data( elem, "changeBubbles", true ); } }); }, handle: function( event ) { var elem = event.target; if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return !rformElems.test( this.nodeName ); } }; } if ( !support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { var handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { var doc = this.ownerDocument || this, attaches = jQuery._data( doc, fix ); if ( !attaches ) { doc.addEventListener( orig, handler, true ); } jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); }, teardown: function() { var doc = this.ownerDocument || this, attaches = jQuery._data( doc, fix ) - 1; if ( !attaches ) { doc.removeEventListener( orig, handler, true ); jQuery._removeData( doc, fix ); } else { jQuery._data( doc, fix, attaches ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var type, origFn; if ( typeof types === "object" ) { if ( typeof selector !== "string" ) { data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { fn = data; data = undefined; } else { fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { jQuery().off( event ); return origFn.apply( this, arguments ); }; fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { var elem = this[0]; if ( elem ) { return jQuery.event.trigger( type, data, elem, true ); } } }); function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; } var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /<tbody/i, rhtml = /<|&#?\w+;/, rnoInnerhtml = /<(?:script|style|link)/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /^$|\/(?:java|ecma)script/i, rscriptTypeMasked = /^true\/(.*)/, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, wrapMap = { option: [ 1, "<select multiple='multiple'>", "</select>" ], legend: [ 1, "<fieldset>", "</fieldset>" ], area: [ 1, "<map>", "</map>" ], param: [ 1, "<object>", "</object>" ], thead: [ 1, "<table>", "</table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ], col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] }, safeFragment = createSafeFragment( document ), fragmentDiv = safeFragment.appendChild( document.createElement("div") ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; function getAll( context, tag ) { var elems, elem, i = 0, found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : undefined; if ( !found ) { for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { if ( !tag || jQuery.nodeName( elem, tag ) ) { found.push( elem ); } else { jQuery.merge( found, getAll( elem, tag ) ); } } } return tag === undefined || tag && jQuery.nodeName( context, tag ) ? jQuery.merge( [ context ], found ) : found; } function fixDefaultChecked( elem ) { if ( rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } } function manipulationTarget( elem, content ) { return jQuery.nodeName( elem, "table" ) && jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? elem.getElementsByTagName("tbody")[0] || elem.appendChild( elem.ownerDocument.createElement("tbody") ) : elem; } function disableScript( elem ) { elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; return elem; } function restoreScript( elem ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[1]; } else { elem.removeAttribute("type"); } return elem; } function setGlobalEval( elems, refElements ) { var elem, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); } } function cloneCopyEvent( src, dest ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { return; } var type, i, l, oldData = jQuery._data( src ), curData = jQuery._data( dest, oldData ), events = oldData.events; if ( events ) { delete curData.handle; curData.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } if ( curData.data ) { curData.data = jQuery.extend( {}, curData.data ); } } function fixCloneNodeIssues( src, dest ) { var nodeName, e, data; if ( dest.nodeType !== 1 ) { return; } nodeName = dest.nodeName.toLowerCase(); if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { data = jQuery._data( dest ); for ( e in data.events ) { jQuery.removeEvent( dest, e, data.handle ); } dest.removeAttribute( jQuery.expando ); } if ( nodeName === "script" && dest.text !== src.text ) { disableScript( dest ).text = src.text; restoreScript( dest ); } else if ( nodeName === "object" ) { if ( dest.parentNode ) { dest.outerHTML = src.outerHTML; } if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { dest.innerHTML = src.innerHTML; } } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { dest.defaultChecked = dest.checked = src.checked; if ( dest.value !== src.value ) { dest.value = src.value; } } else if ( nodeName === "option" ) { dest.defaultSelected = dest.selected = src.defaultSelected; } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } } jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { var destElements, node, clone, i, srcElements, inPage = jQuery.contains( elem.ownerDocument, elem ); if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { clone = elem.cloneNode( true ); } else { fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); } if ( (!support.noCloneEvent || !support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { destElements = getAll( clone ); srcElements = getAll( elem ); for ( i = 0; (node = srcElements[i]) != null; ++i ) { if ( destElements[i] ) { fixCloneNodeIssues( node, destElements[i] ); } } } if ( dataAndEvents ) { if ( deepDataAndEvents ) { srcElements = srcElements || getAll( elem ); destElements = destElements || getAll( clone ); for ( i = 0; (node = srcElements[i]) != null; i++ ) { cloneCopyEvent( node, destElements[i] ); } } else { cloneCopyEvent( elem, clone ); } } destElements = getAll( clone, "script" ); if ( destElements.length > 0 ) { setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); } destElements = srcElements = node = null; return clone; }, buildFragment: function( elems, context, scripts, selection ) { var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length, safe = createSafeFragment( context ), nodes = [], i = 0; for ( ; i < l; i++ ) { elem = elems[ i ]; if ( elem || elem === 0 ) { if ( jQuery.type( elem ) === "object" ) { jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); } else if ( !rhtml.test( elem ) ) { nodes.push( context.createTextNode( elem ) ); } else { tmp = tmp || safe.appendChild( context.createElement("div") ); tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; j = wrap[0]; while ( j-- ) { tmp = tmp.lastChild; } if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); } if ( !support.tbody ) { elem = tag === "table" && !rtbody.test( elem ) ? tmp.firstChild : wrap[1] === "<table>" && !rtbody.test( elem ) ? tmp : 0; j = elem && elem.childNodes.length; while ( j-- ) { if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { elem.removeChild( tbody ); } } } jQuery.merge( nodes, tmp.childNodes ); tmp.textContent = ""; while ( tmp.firstChild ) { tmp.removeChild( tmp.firstChild ); } tmp = safe.lastChild; } } } if ( tmp ) { safe.removeChild( tmp ); } if ( !support.appendChecked ) { jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); } i = 0; while ( (elem = nodes[ i++ ]) ) { if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { continue; } contains = jQuery.contains( elem.ownerDocument, elem ); tmp = getAll( safe.appendChild( elem ), "script" ); if ( contains ) { setGlobalEval( tmp ); } if ( scripts ) { j = 0; while ( (elem = tmp[ j++ ]) ) { if ( rscriptType.test( elem.type || "" ) ) { scripts.push( elem ); } } } } tmp = null; return safe; }, cleanData: function( elems, /* internal */ acceptData ) { var elem, type, id, data, i = 0, internalKey = jQuery.expando, cache = jQuery.cache, deleteExpando = support.deleteExpando, special = jQuery.event.special; for ( ; (elem = elems[i]) != null; i++ ) { if ( acceptData || jQuery.acceptData( elem ) ) { id = elem[ internalKey ]; data = id && cache[ id ]; if ( data ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); } else { jQuery.removeEvent( elem, type, data.handle ); } } } if ( cache[ id ] ) { delete cache[ id ]; if ( deleteExpando ) { delete elem[ internalKey ]; } else if ( typeof elem.removeAttribute !== strundefined ) { elem.removeAttribute( internalKey ); } else { elem[ internalKey ] = null; } deletedIds.push( id ); } } } } } }); jQuery.fn.extend({ text: function( value ) { return access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); }, null, value, arguments.length ); }, append: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.appendChild( elem ); } }); }, prepend: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.insertBefore( elem, target.firstChild ); } }); }, before: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } }); }, after: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this.nextSibling ); } }); }, remove: function( selector, keepData /* Internal Use Only */ ) { var elem, elems = selector ? jQuery.filter( selector, this ) : this, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem ) ); } if ( elem.parentNode ) { if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { setGlobalEval( getAll( elem, "script" ) ); } elem.parentNode.removeChild( elem ); } } return this; }, empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); } while ( elem.firstChild ) { elem.removeChild( elem.firstChild ); } if ( elem.options && jQuery.nodeName( elem, "select" ) ) { elem.options.length = 0; } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map(function() { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( value ) { return access( this, function( value ) { var elem = this[ 0 ] || {}, i = 0, l = this.length; if ( value === undefined ) { return elem.nodeType === 1 ? elem.innerHTML.replace( rinlinejQuery, "" ) : undefined; } if ( typeof value === "string" && !rnoInnerhtml.test( value ) && ( support.htmlSerialize || !rnoshimcache.test( value ) ) && ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { value = value.replace( rxhtmlTag, "<$1></$2>" ); try { for (; i < l; i++ ) { elem = this[i] || {}; if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); elem.innerHTML = value; } } elem = 0; } catch(e) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function() { var arg = arguments[ 0 ]; this.domManip( arguments, function( elem ) { arg = this.parentNode; jQuery.cleanData( getAll( this ) ); if ( arg ) { arg.replaceChild( elem, this ); } }); return arg && (arg.length || arg.nodeType) ? this : this.remove(); }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, callback ) { args = concat.apply( [], args ); var first, node, hasScripts, scripts, doc, fragment, i = 0, l = this.length, set = this, iNoClone = l - 1, value = args[0], isFunction = jQuery.isFunction( value ); if ( isFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return this.each(function( index ) { var self = set.eq( index ); if ( isFunction ) { args[0] = value.call( this, index, self.html() ); } self.domManip( args, callback ); }); } if ( l ) { fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } if ( first ) { scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); hasScripts = scripts.length; for ( ; i < l; i++ ) { node = fragment; if ( i !== iNoClone ) { node = jQuery.clone( node, true, true ); if ( hasScripts ) { jQuery.merge( scripts, getAll( node, "script" ) ); } } callback.call( this[i], node, i ); } if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; jQuery.map( scripts, restoreScript ); for ( i = 0; i < hasScripts; i++ ) { node = scripts[ i ]; if ( rscriptType.test( node.type || "" ) && !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { if ( node.src ) { if ( jQuery._evalUrl ) { jQuery._evalUrl( node.src ); } } else { jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); } } } } fragment = first = null; } } return this; } }); jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, i = 0, ret = [], insert = jQuery( selector ), last = insert.length - 1; for ( ; i <= last; i++ ) { elems = i === last ? this : this.clone(true); jQuery( insert[i] )[ original ]( elems ); push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; }); var iframe, elemdisplay = {}; function actualDisplay( name, doc ) { var style, elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? style.display : jQuery.css( elem[ 0 ], "display" ); elem.detach(); return display; } /** * Try to determine the default display value of an element * @param {String} nodeName */ function defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); if ( display === "none" || !display ) { iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement ); doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document; doc.write(); doc.close(); display = actualDisplay( nodeName, doc ); iframe.detach(); } elemdisplay[ nodeName ] = display; } return display; } (function() { var shrinkWrapBlocksVal; support.shrinkWrapBlocks = function() { if ( shrinkWrapBlocksVal != null ) { return shrinkWrapBlocksVal; } shrinkWrapBlocksVal = false; var div, body, container; body = document.getElementsByTagName( "body" )[ 0 ]; if ( !body || !body.style ) { return; } div = document.createElement( "div" ); container = document.createElement( "div" ); container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; body.appendChild( container ).appendChild( div ); if ( typeof div.style.zoom !== strundefined ) { div.style.cssText = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + "box-sizing:content-box;display:block;margin:0;border:0;" + "padding:1px;width:1px;zoom:1"; div.appendChild( document.createElement( "div" ) ).style.width = "5px"; shrinkWrapBlocksVal = div.offsetWidth !== 3; } body.removeChild( container ); return shrinkWrapBlocksVal; }; })(); var rmargin = (/^margin/); var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); var getStyles, curCSS, rposition = /^(top|right|bottom|left)$/; if ( window.getComputedStyle ) { getStyles = function( elem ) { return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); }; curCSS = function( elem, name, computed ) { var width, minWidth, maxWidth, ret, style = elem.style; computed = computed || getStyles( elem ); ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined; if ( computed ) { if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { ret = jQuery.style( elem, name ); } if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; style.minWidth = style.maxWidth = style.width = ret; ret = computed.width; style.width = width; style.minWidth = minWidth; style.maxWidth = maxWidth; } } return ret === undefined ? ret : ret + ""; }; } else if ( document.documentElement.currentStyle ) { getStyles = function( elem ) { return elem.currentStyle; }; curCSS = function( elem, name, computed ) { var left, rs, rsLeft, ret, style = elem.style; computed = computed || getStyles( elem ); ret = computed ? computed[ name ] : undefined; if ( ret == null && style && style[ name ] ) { ret = style[ name ]; } if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { left = style.left; rs = elem.runtimeStyle; rsLeft = rs && rs.left; if ( rsLeft ) { rs.left = elem.currentStyle.left; } style.left = name === "fontSize" ? "1em" : ret; ret = style.pixelLeft + "px"; style.left = left; if ( rsLeft ) { rs.left = rsLeft; } } return ret === undefined ? ret : ret + "" || "auto"; }; } function addGetHookIf( conditionFn, hookFn ) { return { get: function() { var condition = conditionFn(); if ( condition == null ) { return; } if ( condition ) { delete this.get; return; } return (this.get = hookFn).apply( this, arguments ); } }; } (function() { var div, style, a, pixelPositionVal, boxSizingReliableVal, reliableHiddenOffsetsVal, reliableMarginRightVal; div = document.createElement( "div" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; a = div.getElementsByTagName( "a" )[ 0 ]; style = a && a.style; if ( !style ) { return; } style.cssText = "float:left;opacity:.5"; support.opacity = style.opacity === "0.5"; support.cssFloat = !!style.cssFloat; div.style.backgroundClip = "content-box"; div.cloneNode( true ).style.backgroundClip = ""; support.clearCloneStyle = div.style.backgroundClip === "content-box"; support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" || style.WebkitBoxSizing === ""; jQuery.extend(support, { reliableHiddenOffsets: function() { if ( reliableHiddenOffsetsVal == null ) { computeStyleTests(); } return reliableHiddenOffsetsVal; }, boxSizingReliable: function() { if ( boxSizingReliableVal == null ) { computeStyleTests(); } return boxSizingReliableVal; }, pixelPosition: function() { if ( pixelPositionVal == null ) { computeStyleTests(); } return pixelPositionVal; }, reliableMarginRight: function() { if ( reliableMarginRightVal == null ) { computeStyleTests(); } return reliableMarginRightVal; } }); function computeStyleTests() { var div, body, container, contents; body = document.getElementsByTagName( "body" )[ 0 ]; if ( !body || !body.style ) { return; } div = document.createElement( "div" ); container = document.createElement( "div" ); container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; body.appendChild( container ).appendChild( div ); div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + "border:1px;padding:1px;width:4px;position:absolute"; pixelPositionVal = boxSizingReliableVal = false; reliableMarginRightVal = true; if ( window.getComputedStyle ) { pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; boxSizingReliableVal = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; contents = div.appendChild( document.createElement( "div" ) ); contents.style.cssText = div.style.cssText = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; contents.style.marginRight = contents.style.width = "0"; div.style.width = "1px"; reliableMarginRightVal = !parseFloat( ( window.getComputedStyle( contents, null ) || {} ).marginRight ); } div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; contents = div.getElementsByTagName( "td" ); contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none"; reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; if ( reliableHiddenOffsetsVal ) { contents[ 0 ].style.display = ""; contents[ 1 ].style.display = "none"; reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; } body.removeChild( container ); } })(); jQuery.swap = function( elem, options, callback, args ) { var ret, name, old = {}; for ( name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } ret = callback.apply( elem, args || [] ); for ( name in options ) { elem.style[ name ] = old[ name ]; } return ret; }; var ralpha = /alpha\([^)]*\)/i, ropacity = /opacity\s*=\s*([^)]*)/, rdisplayswap = /^(none|table(?!-c[ea]).+)/, rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ), cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { letterSpacing: "0", fontWeight: "400" }, cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; function vendorPropName( style, name ) { if ( name in style ) { return name; } var capName = name.charAt(0).toUpperCase() + name.slice(1), origName = name, i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in style ) { return name; } } return origName; } function showHide( elements, show ) { var display, elem, hidden, values = [], index = 0, length = elements.length; for ( ; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } values[ index ] = jQuery._data( elem, "olddisplay" ); display = elem.style.display; if ( show ) { if ( !values[ index ] && display === "none" ) { elem.style.display = ""; } if ( elem.style.display === "" && isHidden( elem ) ) { values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); } } else { hidden = isHidden( elem ); if ( display && display !== "none" || !hidden ) { jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); } } } for ( index = 0; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } if ( !show || elem.style.display === "none" || elem.style.display === "" ) { elem.style.display = show ? values[ index ] || "" : "none"; } } return elements; } function setPositiveNumber( elem, value, subtract ) { var matches = rnumsplit.exec( value ); return matches ? Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : value; } function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { var i = extra === ( isBorderBox ? "border" : "content" ) ? 4 : name === "width" ? 1 : 0, val = 0; for ( ; i < 4; i += 2 ) { if ( extra === "margin" ) { val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); } if ( isBorderBox ) { if ( extra === "content" ) { val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); } if ( extra !== "margin" ) { val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } else { val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); if ( extra !== "padding" ) { val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } } return val; } function getWidthOrHeight( elem, name, extra ) { var valueIsBorderBox = true, val = name === "width" ? elem.offsetWidth : elem.offsetHeight, styles = getStyles( elem ), isBorderBox = support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; if ( val <= 0 || val == null ) { val = curCSS( elem, name, styles ); if ( val < 0 || val == null ) { val = elem.style[ name ]; } if ( rnumnonpx.test(val) ) { return val; } valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] ); val = parseFloat( val ) || 0; } return ( val + augmentWidthOrHeight( elem, name, extra || ( isBorderBox ? "border" : "content" ), valueIsBorderBox, styles ) ) + "px"; } jQuery.extend({ cssHooks: { opacity: { get: function( elem, computed ) { if ( computed ) { var ret = curCSS( elem, "opacity" ); return ret === "" ? "1" : ret; } } } }, cssNumber: { "columnCount": true, "fillOpacity": true, "flexGrow": true, "flexShrink": true, "fontWeight": true, "lineHeight": true, "opacity": true, "order": true, "orphans": true, "widows": true, "zIndex": true, "zoom": true }, cssProps: { "float": support.cssFloat ? "cssFloat" : "styleFloat" }, style: function( elem, name, value, extra ) { if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { return; } var ret, type, hooks, origName = jQuery.camelCase( name ), style = elem.style; name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; if ( value !== undefined ) { type = typeof value; if ( type === "string" && (ret = rrelNum.exec( value )) ) { value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); type = "number"; } if ( value == null || value !== value ) { return; } if ( type === "number" && !jQuery.cssNumber[ origName ] ) { value += "px"; } if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { style[ name ] = "inherit"; } if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { try { style[ name ] = value; } catch(e) {} } } else { if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { return ret; } return style[ name ]; } }, css: function( elem, name, extra, styles ) { var num, val, hooks, origName = jQuery.camelCase( name ); name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; if ( hooks && "get" in hooks ) { val = hooks.get( elem, true, extra ); } if ( val === undefined ) { val = curCSS( elem, name, styles ); } if ( val === "normal" && name in cssNormalTransform ) { val = cssNormalTransform[ name ]; } if ( extra === "" || extra ) { num = parseFloat( val ); return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; } return val; } }); jQuery.each([ "height", "width" ], function( i, name ) { jQuery.cssHooks[ name ] = { get: function( elem, computed, extra ) { if ( computed ) { return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ? jQuery.swap( elem, cssShow, function() { return getWidthOrHeight( elem, name, extra ); }) : getWidthOrHeight( elem, name, extra ); } }, set: function( elem, value, extra ) { var styles = extra && getStyles( elem ); return setPositiveNumber( elem, value, extra ? augmentWidthOrHeight( elem, name, extra, support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", styles ) : 0 ); } }; }); if ( !support.opacity ) { jQuery.cssHooks.opacity = { get: function( elem, computed ) { return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : computed ? "1" : ""; }, set: function( elem, value ) { var style = elem.style, currentStyle = elem.currentStyle, opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", filter = currentStyle && currentStyle.filter || style.filter || ""; style.zoom = 1; if ( ( value >= 1 || value === "" ) && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && style.removeAttribute ) { style.removeAttribute( "filter" ); if ( value === "" || currentStyle && !currentStyle.filter ) { return; } } style.filter = ralpha.test( filter ) ? filter.replace( ralpha, opacity ) : filter + " " + opacity; } }; } jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, function( elem, computed ) { if ( computed ) { return jQuery.swap( elem, { "display": "inline-block" }, curCSS, [ elem, "marginRight" ] ); } } ); jQuery.each({ margin: "", padding: "", border: "Width" }, function( prefix, suffix ) { jQuery.cssHooks[ prefix + suffix ] = { expand: function( value ) { var i = 0, expanded = {}, parts = typeof value === "string" ? value.split(" ") : [ value ]; for ( ; i < 4; i++ ) { expanded[ prefix + cssExpand[ i ] + suffix ] = parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; } return expanded; } }; if ( !rmargin.test( prefix ) ) { jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; } }); jQuery.fn.extend({ css: function( name, value ) { return access( this, function( elem, name, value ) { var styles, len, map = {}, i = 0; if ( jQuery.isArray( name ) ) { styles = getStyles( elem ); len = name.length; for ( ; i < len; i++ ) { map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); } return map; } return value !== undefined ? jQuery.style( elem, name, value ) : jQuery.css( elem, name ); }, name, value, arguments.length > 1 ); }, show: function() { return showHide( this, true ); }, hide: function() { return showHide( this ); }, toggle: function( state ) { if ( typeof state === "boolean" ) { return state ? this.show() : this.hide(); } return this.each(function() { if ( isHidden( this ) ) { jQuery( this ).show(); } else { jQuery( this ).hide(); } }); } }); function Tween( elem, options, prop, end, easing ) { return new Tween.prototype.init( elem, options, prop, end, easing ); } jQuery.Tween = Tween; Tween.prototype = { constructor: Tween, init: function( elem, options, prop, end, easing, unit ) { this.elem = elem; this.prop = prop; this.easing = easing || "swing"; this.options = options; this.start = this.now = this.cur(); this.end = end; this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); }, cur: function() { var hooks = Tween.propHooks[ this.prop ]; return hooks && hooks.get ? hooks.get( this ) : Tween.propHooks._default.get( this ); }, run: function( percent ) { var eased, hooks = Tween.propHooks[ this.prop ]; if ( this.options.duration ) { this.pos = eased = jQuery.easing[ this.easing ]( percent, this.options.duration * percent, 0, 1, this.options.duration ); } else { this.pos = eased = percent; } this.now = ( this.end - this.start ) * eased + this.start; if ( this.options.step ) { this.options.step.call( this.elem, this.now, this ); } if ( hooks && hooks.set ) { hooks.set( this ); } else { Tween.propHooks._default.set( this ); } return this; } }; Tween.prototype.init.prototype = Tween.prototype; Tween.propHooks = { _default: { get: function( tween ) { var result; if ( tween.elem[ tween.prop ] != null && (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { return tween.elem[ tween.prop ]; } result = jQuery.css( tween.elem, tween.prop, "" ); return !result || result === "auto" ? 0 : result; }, set: function( tween ) { if ( jQuery.fx.step[ tween.prop ] ) { jQuery.fx.step[ tween.prop ]( tween ); } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); } else { tween.elem[ tween.prop ] = tween.now; } } } }; Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { set: function( tween ) { if ( tween.elem.nodeType && tween.elem.parentNode ) { tween.elem[ tween.prop ] = tween.now; } } }; jQuery.easing = { linear: function( p ) { return p; }, swing: function( p ) { return 0.5 - Math.cos( p * Math.PI ) / 2; } }; jQuery.fx = Tween.prototype.init; jQuery.fx.step = {}; var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ), rrun = /queueHooks$/, animationPrefilters = [ defaultPrefilter ], tweeners = { "*": [ function( prop, value ) { var tween = this.createTween( prop, value ), target = tween.cur(), parts = rfxnum.exec( value ), unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && rfxnum.exec( jQuery.css( tween.elem, prop ) ), scale = 1, maxIterations = 20; if ( start && start[ 3 ] !== unit ) { unit = unit || start[ 3 ]; parts = parts || []; start = +target || 1; do { scale = scale || ".5"; start = start / scale; jQuery.style( tween.elem, prop, start + unit ); } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); } if ( parts ) { start = tween.start = +start || +target || 0; tween.unit = unit; tween.end = parts[ 1 ] ? start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : +parts[ 2 ]; } return tween; } ] }; function createFxNow() { setTimeout(function() { fxNow = undefined; }); return ( fxNow = jQuery.now() ); } function genFx( type, includeWidth ) { var which, attrs = { height: type }, i = 0; includeWidth = includeWidth ? 1 : 0; for ( ; i < 4 ; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; } function createTween( value, prop, animation ) { var tween, collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), index = 0, length = collection.length; for ( ; index < length; index++ ) { if ( (tween = collection[ index ].call( animation, prop, value )) ) { return tween; } } } function defaultPrefilter( elem, props, opts ) { var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHidden( elem ), dataShow = jQuery._data( elem, "fxshow" ); if ( !opts.queue ) { hooks = jQuery._queueHooks( elem, "fx" ); if ( hooks.unqueued == null ) { hooks.unqueued = 0; oldfire = hooks.empty.fire; hooks.empty.fire = function() { if ( !hooks.unqueued ) { oldfire(); } }; } hooks.unqueued++; anim.always(function() { anim.always(function() { hooks.unqueued--; if ( !jQuery.queue( elem, "fx" ).length ) { hooks.empty.fire(); } }); }); } if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; display = jQuery.css( elem, "display" ); checkDisplay = display === "none" ? jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) { style.display = "inline-block"; } else { style.zoom = 1; } } } if ( opts.overflow ) { style.overflow = "hidden"; if ( !support.shrinkWrapBlocks() ) { anim.always(function() { style.overflow = opts.overflow[ 0 ]; style.overflowX = opts.overflow[ 1 ]; style.overflowY = opts.overflow[ 2 ]; }); } } for ( prop in props ) { value = props[ prop ]; if ( rfxtypes.exec( value ) ) { delete props[ prop ]; toggle = toggle || value === "toggle"; if ( value === ( hidden ? "hide" : "show" ) ) { if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { hidden = true; } else { continue; } } orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); } else { display = undefined; } } if ( !jQuery.isEmptyObject( orig ) ) { if ( dataShow ) { if ( "hidden" in dataShow ) { hidden = dataShow.hidden; } } else { dataShow = jQuery._data( elem, "fxshow", {} ); } if ( toggle ) { dataShow.hidden = !hidden; } if ( hidden ) { jQuery( elem ).show(); } else { anim.done(function() { jQuery( elem ).hide(); }); } anim.done(function() { var prop; jQuery._removeData( elem, "fxshow" ); for ( prop in orig ) { jQuery.style( elem, prop, orig[ prop ] ); } }); for ( prop in orig ) { tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); if ( !( prop in dataShow ) ) { dataShow[ prop ] = tween.start; if ( hidden ) { tween.end = tween.start; tween.start = prop === "width" || prop === "height" ? 1 : 0; } } } } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) { style.display = display; } } function propFilter( props, specialEasing ) { var index, name, easing, value, hooks; for ( index in props ) { name = jQuery.camelCase( index ); easing = specialEasing[ name ]; value = props[ index ]; if ( jQuery.isArray( value ) ) { easing = value[ 1 ]; value = props[ index ] = value[ 0 ]; } if ( index !== name ) { props[ name ] = value; delete props[ index ]; } hooks = jQuery.cssHooks[ name ]; if ( hooks && "expand" in hooks ) { value = hooks.expand( value ); delete props[ name ]; for ( index in value ) { if ( !( index in props ) ) { props[ index ] = value[ index ]; specialEasing[ index ] = easing; } } } else { specialEasing[ name ] = easing; } } } function Animation( elem, properties, options ) { var result, stopped, index = 0, length = animationPrefilters.length, deferred = jQuery.Deferred().always( function() { delete tick.elem; }), tick = function() { if ( stopped ) { return false; } var currentTime = fxNow || createFxNow(), remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( percent ); } deferred.notifyWith( elem, [ animation, percent, remaining ]); if ( percent < 1 && length ) { return remaining; } else { deferred.resolveWith( elem, [ animation ] ); return false; } }, animation = deferred.promise({ elem: elem, props: jQuery.extend( {}, properties ), opts: jQuery.extend( true, { specialEasing: {} }, options ), originalProperties: properties, originalOptions: options, startTime: fxNow || createFxNow(), duration: options.duration, tweens: [], createTween: function( prop, end ) { var tween = jQuery.Tween( elem, animation.opts, prop, end, animation.opts.specialEasing[ prop ] || animation.opts.easing ); animation.tweens.push( tween ); return tween; }, stop: function( gotoEnd ) { var index = 0, length = gotoEnd ? animation.tweens.length : 0; if ( stopped ) { return this; } stopped = true; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( 1 ); } if ( gotoEnd ) { deferred.resolveWith( elem, [ animation, gotoEnd ] ); } else { deferred.rejectWith( elem, [ animation, gotoEnd ] ); } return this; } }), props = animation.props; propFilter( props, animation.opts.specialEasing ); for ( ; index < length ; index++ ) { result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); if ( result ) { return result; } } jQuery.map( props, createTween, animation ); if ( jQuery.isFunction( animation.opts.start ) ) { animation.opts.start.call( elem, animation ); } jQuery.fx.timer( jQuery.extend( tick, { elem: elem, anim: animation, queue: animation.opts.queue }) ); return animation.progress( animation.opts.progress ) .done( animation.opts.done, animation.opts.complete ) .fail( animation.opts.fail ) .always( animation.opts.always ); } jQuery.Animation = jQuery.extend( Animation, { tweener: function( props, callback ) { if ( jQuery.isFunction( props ) ) { callback = props; props = [ "*" ]; } else { props = props.split(" "); } var prop, index = 0, length = props.length; for ( ; index < length ; index++ ) { prop = props[ index ]; tweeners[ prop ] = tweeners[ prop ] || []; tweeners[ prop ].unshift( callback ); } }, prefilter: function( callback, prepend ) { if ( prepend ) { animationPrefilters.unshift( callback ); } else { animationPrefilters.push( callback ); } } }); jQuery.speed = function( speed, easing, fn ) { var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; if ( opt.queue == null || opt.queue === true ) { opt.queue = "fx"; } opt.old = opt.complete; opt.complete = function() { if ( jQuery.isFunction( opt.old ) ) { opt.old.call( this ); } if ( opt.queue ) { jQuery.dequeue( this, opt.queue ); } }; return opt; }; jQuery.fn.extend({ fadeTo: function( speed, to, easing, callback ) { return this.filter( isHidden ).css( "opacity", 0 ).show() .end().animate({ opacity: to }, speed, easing, callback ); }, animate: function( prop, speed, easing, callback ) { var empty = jQuery.isEmptyObject( prop ), optall = jQuery.speed( speed, easing, callback ), doAnimation = function() { var anim = Animation( this, jQuery.extend( {}, prop ), optall ); if ( empty || jQuery._data( this, "finish" ) ) { anim.stop( true ); } }; doAnimation.finish = doAnimation; return empty || optall.queue === false ? this.each( doAnimation ) : this.queue( optall.queue, doAnimation ); }, stop: function( type, clearQueue, gotoEnd ) { var stopQueue = function( hooks ) { var stop = hooks.stop; delete hooks.stop; stop( gotoEnd ); }; if ( typeof type !== "string" ) { gotoEnd = clearQueue; clearQueue = type; type = undefined; } if ( clearQueue && type !== false ) { this.queue( type || "fx", [] ); } return this.each(function() { var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery.timers, data = jQuery._data( this ); if ( index ) { if ( data[ index ] && data[ index ].stop ) { stopQueue( data[ index ] ); } } else { for ( index in data ) { if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { stopQueue( data[ index ] ); } } } for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { timers[ index ].anim.stop( gotoEnd ); dequeue = false; timers.splice( index, 1 ); } } if ( dequeue || !gotoEnd ) { jQuery.dequeue( this, type ); } }); }, finish: function( type ) { if ( type !== false ) { type = type || "fx"; } return this.each(function() { var index, data = jQuery._data( this ), queue = data[ type + "queue" ], hooks = data[ type + "queueHooks" ], timers = jQuery.timers, length = queue ? queue.length : 0; data.finish = true; jQuery.queue( this, type, [] ); if ( hooks && hooks.stop ) { hooks.stop.call( this, true ); } for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && timers[ index ].queue === type ) { timers[ index ].anim.stop( true ); timers.splice( index, 1 ); } } for ( index = 0; index < length; index++ ) { if ( queue[ index ] && queue[ index ].finish ) { queue[ index ].finish.call( this ); } } delete data.finish; }); } }); jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { var cssFn = jQuery.fn[ name ]; jQuery.fn[ name ] = function( speed, easing, callback ) { return speed == null || typeof speed === "boolean" ? cssFn.apply( this, arguments ) : this.animate( genFx( name, true ), speed, easing, callback ); }; }); jQuery.each({ slideDown: genFx("show"), slideUp: genFx("hide"), slideToggle: genFx("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function( name, props ) { jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback ); }; }); jQuery.timers = []; jQuery.fx.tick = function() { var timer, timers = jQuery.timers, i = 0; fxNow = jQuery.now(); for ( ; i < timers.length; i++ ) { timer = timers[ i ]; if ( !timer() && timers[ i ] === timer ) { timers.splice( i--, 1 ); } } if ( !timers.length ) { jQuery.fx.stop(); } fxNow = undefined; }; jQuery.fx.timer = function( timer ) { jQuery.timers.push( timer ); if ( timer() ) { jQuery.fx.start(); } else { jQuery.timers.pop(); } }; jQuery.fx.interval = 13; jQuery.fx.start = function() { if ( !timerId ) { timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); } }; jQuery.fx.stop = function() { clearInterval( timerId ); timerId = null; }; jQuery.fx.speeds = { slow: 600, fast: 200, _default: 400 }; jQuery.fn.delay = function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = setTimeout( next, time ); hooks.stop = function() { clearTimeout( timeout ); }; }); }; (function() { var input, div, select, a, opt; div = document.createElement( "div" ); div.setAttribute( "className", "t" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; a = div.getElementsByTagName("a")[ 0 ]; select = document.createElement("select"); opt = select.appendChild( document.createElement("option") ); input = div.getElementsByTagName("input")[ 0 ]; a.style.cssText = "top:1px"; support.getSetAttribute = div.className !== "t"; support.style = /top/.test( a.getAttribute("style") ); support.hrefNormalized = a.getAttribute("href") === "/a"; support.checkOn = !!input.value; support.optSelected = opt.selected; support.enctype = !!document.createElement("form").enctype; select.disabled = true; support.optDisabled = !opt.disabled; input = document.createElement( "input" ); input.setAttribute( "value", "" ); support.input = input.getAttribute( "value" ) === ""; input.value = "t"; input.setAttribute( "type", "radio" ); support.radioValue = input.value === "t"; })(); var rreturn = /\r/g; jQuery.fn.extend({ val: function( value ) { var hooks, ret, isFunction, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? ret.replace(rreturn, "") : ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction( value ); return this.each(function( i ) { var val; if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, jQuery( this ).val() ); } else { val = value; } if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray( val ) ) { val = jQuery.map( val, function( value ) { return value == null ? "" : value + ""; }); } hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: { get: function( elem ) { var val = jQuery.find.attr( elem, "value" ); return val != null ? val : jQuery.trim( jQuery.text( elem ) ); } }, select: { get: function( elem ) { var value, option, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one" || index < 0, values = one ? null : [], max = one ? index + 1 : options.length, i = index < 0 ? max : one ? index : 0; for ( ; i < max; i++ ) { option = options[ i ]; if ( ( option.selected || i === index ) && ( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { value = jQuery( option ).val(); if ( one ) { return value; } values.push( value ); } } return values; }, set: function( elem, value ) { var optionSet, option, options = elem.options, values = jQuery.makeArray( value ), i = options.length; while ( i-- ) { option = options[ i ]; if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) { try { option.selected = optionSet = true; } catch ( _ ) { option.scrollHeight; } } else { option.selected = false; } } if ( !optionSet ) { elem.selectedIndex = -1; } return options; } } } }); jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); } } }; if ( !support.checkOn ) { jQuery.valHooks[ this ].get = function( elem ) { return elem.getAttribute("value") === null ? "on" : elem.value; }; } }); var nodeHook, boolHook, attrHandle = jQuery.expr.attrHandle, ruseDefault = /^(?:checked|selected)$/i, getSetAttribute = support.getSetAttribute, getSetInput = support.input; jQuery.fn.extend({ attr: function( name, value ) { return access( this, jQuery.attr, name, value, arguments.length > 1 ); }, removeAttr: function( name ) { return this.each(function() { jQuery.removeAttr( this, name ); }); } }); jQuery.extend({ attr: function( elem, name, value ) { var hooks, ret, nType = elem.nodeType; if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } if ( typeof elem.getAttribute === strundefined ) { return jQuery.prop( elem, name, value ); } if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setAttribute( name, value + "" ); return value; } } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { ret = jQuery.find.attr( elem, name ); return ret == null ? undefined : ret; } }, removeAttr: function( elem, value ) { var name, propName, i = 0, attrNames = value && value.match( rnotwhite ); if ( attrNames && elem.nodeType === 1 ) { while ( (name = attrNames[i++]) ) { propName = jQuery.propFix[ name ] || name; if ( jQuery.expr.match.bool.test( name ) ) { if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { elem[ propName ] = false; } else { elem[ jQuery.camelCase( "default-" + name ) ] = elem[ propName ] = false; } } else { jQuery.attr( elem, name, "" ); } elem.removeAttribute( getSetAttribute ? name : propName ); } } }, attrHooks: { type: { set: function( elem, value ) { if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } } } }); boolHook = { set: function( elem, value, name ) { if ( value === false ) { jQuery.removeAttr( elem, name ); } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); } else { elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; } return name; } }; jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { var getter = attrHandle[ name ] || jQuery.find.attr; attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? function( elem, name, isXML ) { var ret, handle; if ( !isXML ) { handle = attrHandle[ name ]; attrHandle[ name ] = ret; ret = getter( elem, name, isXML ) != null ? name.toLowerCase() : null; attrHandle[ name ] = handle; } return ret; } : function( elem, name, isXML ) { if ( !isXML ) { return elem[ jQuery.camelCase( "default-" + name ) ] ? name.toLowerCase() : null; } }; }); if ( !getSetInput || !getSetAttribute ) { jQuery.attrHooks.value = { set: function( elem, value, name ) { if ( jQuery.nodeName( elem, "input" ) ) { elem.defaultValue = value; } else { return nodeHook && nodeHook.set( elem, value, name ); } } }; } if ( !getSetAttribute ) { nodeHook = { set: function( elem, value, name ) { var ret = elem.getAttributeNode( name ); if ( !ret ) { elem.setAttributeNode( (ret = elem.ownerDocument.createAttribute( name )) ); } ret.value = value += ""; if ( name === "value" || value === elem.getAttribute( name ) ) { return value; } } }; attrHandle.id = attrHandle.name = attrHandle.coords = function( elem, name, isXML ) { var ret; if ( !isXML ) { return (ret = elem.getAttributeNode( name )) && ret.value !== "" ? ret.value : null; } }; jQuery.valHooks.button = { get: function( elem, name ) { var ret = elem.getAttributeNode( name ); if ( ret && ret.specified ) { return ret.value; } }, set: nodeHook.set }; jQuery.attrHooks.contenteditable = { set: function( elem, value, name ) { nodeHook.set( elem, value === "" ? false : value, name ); } }; jQuery.each([ "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = { set: function( elem, value ) { if ( value === "" ) { elem.setAttribute( name, "auto" ); return value; } } }; }); } if ( !support.style ) { jQuery.attrHooks.style = { get: function( elem ) { return elem.style.cssText || undefined; }, set: function( elem, value ) { return ( elem.style.cssText = value + "" ); } }; } var rfocusable = /^(?:input|select|textarea|button|object)$/i, rclickable = /^(?:a|area)$/i; jQuery.fn.extend({ prop: function( name, value ) { return access( this, jQuery.prop, name, value, arguments.length > 1 ); }, removeProp: function( name ) { name = jQuery.propFix[ name ] || name; return this.each(function() { try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); } }); jQuery.extend({ propFix: { "for": "htmlFor", "class": "className" }, prop: function( elem, name, value ) { var ret, hooks, notxml, nType = elem.nodeType; if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); if ( notxml ) { name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? ret : ( elem[ name ] = value ); } else { return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? ret : elem[ name ]; } }, propHooks: { tabIndex: { get: function( elem ) { var tabindex = jQuery.find.attr( elem, "tabindex" ); return tabindex ? parseInt( tabindex, 10 ) : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : -1; } } } }); if ( !support.hrefNormalized ) { jQuery.each([ "href", "src" ], function( i, name ) { jQuery.propHooks[ name ] = { get: function( elem ) { return elem.getAttribute( name, 4 ); } }; }); } if ( !support.optSelected ) { jQuery.propHooks.selected = { get: function( elem ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } return null; } }; } jQuery.each([ "tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable" ], function() { jQuery.propFix[ this.toLowerCase() ] = this; }); if ( !support.enctype ) { jQuery.propFix.enctype = "encoding"; } var rclass = /[\t\r\n\f]/g; jQuery.fn.extend({ addClass: function( value ) { var classes, elem, cur, clazz, j, finalValue, i = 0, len = this.length, proceed = typeof value === "string" && value; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).addClass( value.call( this, j, this.className ) ); }); } if ( proceed ) { classes = ( value || "" ).match( rnotwhite ) || []; for ( ; i < len; i++ ) { elem = this[ i ]; cur = elem.nodeType === 1 && ( elem.className ? ( " " + elem.className + " " ).replace( rclass, " " ) : " " ); if ( cur ) { j = 0; while ( (clazz = classes[j++]) ) { if ( cur.indexOf( " " + clazz + " " ) < 0 ) { cur += clazz + " "; } } finalValue = jQuery.trim( cur ); if ( elem.className !== finalValue ) { elem.className = finalValue; } } } } return this; }, removeClass: function( value ) { var classes, elem, cur, clazz, j, finalValue, i = 0, len = this.length, proceed = arguments.length === 0 || typeof value === "string" && value; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).removeClass( value.call( this, j, this.className ) ); }); } if ( proceed ) { classes = ( value || "" ).match( rnotwhite ) || []; for ( ; i < len; i++ ) { elem = this[ i ]; cur = elem.nodeType === 1 && ( elem.className ? ( " " + elem.className + " " ).replace( rclass, " " ) : "" ); if ( cur ) { j = 0; while ( (clazz = classes[j++]) ) { while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { cur = cur.replace( " " + clazz + " ", " " ); } } finalValue = value ? jQuery.trim( cur ) : ""; if ( elem.className !== finalValue ) { elem.className = finalValue; } } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value; if ( typeof stateVal === "boolean" && type === "string" ) { return stateVal ? this.addClass( value ) : this.removeClass( value ); } if ( jQuery.isFunction( value ) ) { return this.each(function( i ) { jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { var className, i = 0, self = jQuery( this ), classNames = value.match( rnotwhite ) || []; while ( (className = classNames[ i++ ]) ) { if ( self.hasClass( className ) ) { self.removeClass( className ); } else { self.addClass( className ); } } } else if ( type === strundefined || type === "boolean" ) { if ( this.className ) { jQuery._data( this, "__className__", this.className ); } this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " ", i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { return true; } } return false; } }); jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { jQuery.fn[ name ] = function( data, fn ) { return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; }); jQuery.fn.extend({ hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); } }); var nonce = jQuery.now(); var rquery = (/\?/); var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; jQuery.parseJSON = function( data ) { if ( window.JSON && window.JSON.parse ) { return window.JSON.parse( data + "" ); } var requireNonComma, depth = null, str = jQuery.trim( data + "" ); return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) { if ( requireNonComma && comma ) { depth = 0; } if ( depth === 0 ) { return token; } requireNonComma = open || comma; depth += !close - !open; return ""; }) ) ? ( Function( "return " + str ) )() : jQuery.error( "Invalid JSON: " + data ); }; jQuery.parseXML = function( data ) { var xml, tmp; if ( !data || typeof data !== "string" ) { return null; } try { if ( window.DOMParser ) { tmp = new DOMParser(); xml = tmp.parseFromString( data, "text/xml" ); } else { xml = new ActiveXObject( "Microsoft.XMLDOM" ); xml.async = "false"; xml.loadXML( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }; var ajaxLocParts, ajaxLocation, rhash = /#.*$/, rts = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}, allTypes = "*/".concat("*"); try { ajaxLocation = location.href; } catch( e ) { ajaxLocation = document.createElement( "a" ); ajaxLocation.href = ""; ajaxLocation = ajaxLocation.href; } ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; function addToPrefiltersOrTransports( structure ) { return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; if ( jQuery.isFunction( func ) ) { while ( (dataType = dataTypes[i++]) ) { if ( dataType.charAt( 0 ) === "+" ) { dataType = dataType.slice( 1 ) || "*"; (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); } else { (structure[ dataType ] = structure[ dataType ] || []).push( func ); } } } }; } function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { var inspected = {}, seekingTransport = ( structure === transports ); function inspect( dataType ) { var selected; inspected[ dataType ] = true; jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { options.dataTypes.unshift( dataTypeOrTransport ); inspect( dataTypeOrTransport ); return false; } else if ( seekingTransport ) { return !( selected = dataTypeOrTransport ); } }); return selected; } return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); } function ajaxExtend( target, src ) { var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } return target; } /* Handles responses to an ajax request: * - finds the right dataType (mediates between content-type and expected dataType) * - returns the corresponding response */ function ajaxHandleResponses( s, jqXHR, responses ) { var firstDataType, ct, finalDataType, type, contents = s.contents, dataTypes = s.dataTypes; while ( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); } } if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } finalDataType = finalDataType || firstDataType; } if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } } /* Chain conversions given the request and the original response * Also sets the responseXXX fields on the jqXHR instance */ function ajaxConvert( s, response, jqXHR, isSuccess ) { var conv2, current, conv, tmp, prev, converters = {}, dataTypes = s.dataTypes.slice(); if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } current = dataTypes.shift(); while ( current ) { if ( s.responseFields[ current ] ) { jqXHR[ s.responseFields[ current ] ] = response; } if ( !prev && isSuccess && s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } prev = current; current = dataTypes.shift(); if ( current ) { if ( current === "*" ) { current = prev; } else if ( prev !== "*" && prev !== current ) { conv = converters[ prev + " " + current ] || converters[ "* " + current ]; if ( !conv ) { for ( conv2 in converters ) { tmp = conv2.split( " " ); if ( tmp[ 1 ] === current ) { conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { if ( conv === true ) { conv = converters[ conv2 ]; } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.unshift( tmp[ 1 ] ); } break; } } } } if ( conv !== true ) { if ( conv && s[ "throws" ] ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } } } return { state: "success", data: response }; } jQuery.extend({ active: 0, lastModified: {}, etag: {}, ajaxSettings: { url: ajaxLocation, type: "GET", isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), global: true, processData: true, async: true, contentType: "application/x-www-form-urlencoded; charset=UTF-8", /* timeout: 0, data: null, dataType: null, username: null, password: null, cache: null, throws: false, traditional: false, headers: {}, */ accepts: { "*": allTypes, text: "text/plain", html: "text/html", xml: "application/xml, text/xml", json: "application/json, text/javascript" }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText", json: "responseJSON" }, converters: { "* text": String, "text html": true, "text json": jQuery.parseJSON, "text xml": jQuery.parseXML }, flatOptions: { url: true, context: true } }, ajaxSetup: function( target, settings ) { return settings ? ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : ajaxExtend( jQuery.ajaxSettings, target ); }, ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), ajaxTransport: addToPrefiltersOrTransports( transports ), ajax: function( url, options ) { if ( typeof url === "object" ) { options = url; url = undefined; } options = options || {}; var parts, i, cacheURL, responseHeadersString, timeoutTimer, fireGlobals, transport, responseHeaders, s = jQuery.ajaxSetup( {}, options ), callbackContext = s.context || s, globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? jQuery( callbackContext ) : jQuery.event, deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks("once memory"), statusCode = s.statusCode || {}, requestHeaders = {}, requestHeadersNames = {}, state = 0, strAbort = "canceled", jqXHR = { readyState: 0, getResponseHeader: function( key ) { var match; if ( state === 2 ) { if ( !responseHeaders ) { responseHeaders = {}; while ( (match = rheaders.exec( responseHeadersString )) ) { responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; } return match == null ? null : match; }, getAllResponseHeaders: function() { return state === 2 ? responseHeadersString : null; }, setRequestHeader: function( name, value ) { var lname = name.toLowerCase(); if ( !state ) { name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; requestHeaders[ name ] = value; } return this; }, overrideMimeType: function( type ) { if ( !state ) { s.mimeType = type; } return this; }, statusCode: function( map ) { var code; if ( map ) { if ( state < 2 ) { for ( code in map ) { statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; } } else { jqXHR.always( map[ jqXHR.status ] ); } } return this; }, abort: function( statusText ) { var finalText = statusText || strAbort; if ( transport ) { transport.abort( finalText ); } done( 0, finalText ); return this; } }; deferred.promise( jqXHR ).complete = completeDeferred.add; jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); s.type = options.method || options.type || s.method || s.type; s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; if ( s.crossDomain == null ) { parts = rurl.exec( s.url.toLowerCase() ); s.crossDomain = !!( parts && ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) ); } if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data, s.traditional ); } inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); if ( state === 2 ) { return jqXHR; } fireGlobals = s.global; if ( fireGlobals && jQuery.active++ === 0 ) { jQuery.event.trigger("ajaxStart"); } s.type = s.type.toUpperCase(); s.hasContent = !rnoContent.test( s.type ); cacheURL = s.url; if ( !s.hasContent ) { if ( s.data ) { cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); delete s.data; } if ( s.cache === false ) { s.url = rts.test( cacheURL ) ? cacheURL.replace( rts, "$1_=" + nonce++ ) : cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; } } if ( s.ifModified ) { if ( jQuery.lastModified[ cacheURL ] ) { jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); } if ( jQuery.etag[ cacheURL ] ) { jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); } } if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { jqXHR.setRequestHeader( "Content-Type", s.contentType ); } jqXHR.setRequestHeader( "Accept", s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : s.accepts[ "*" ] ); for ( i in s.headers ) { jqXHR.setRequestHeader( i, s.headers[ i ] ); } if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { return jqXHR.abort(); } strAbort = "abort"; for ( i in { success: 1, error: 1, complete: 1 } ) { jqXHR[ i ]( s[ i ] ); } transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); if ( !transport ) { done( -1, "No Transport" ); } else { jqXHR.readyState = 1; if ( fireGlobals ) { globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); } if ( s.async && s.timeout > 0 ) { timeoutTimer = setTimeout(function() { jqXHR.abort("timeout"); }, s.timeout ); } try { state = 1; transport.send( requestHeaders, done ); } catch ( e ) { if ( state < 2 ) { done( -1, e ); } else { throw e; } } } function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; if ( state === 2 ) { return; } state = 2; if ( timeoutTimer ) { clearTimeout( timeoutTimer ); } transport = undefined; responseHeadersString = headers || ""; jqXHR.readyState = status > 0 ? 4 : 0; isSuccess = status >= 200 && status < 300 || status === 304; if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } response = ajaxConvert( s, response, jqXHR, isSuccess ); if ( isSuccess ) { if ( s.ifModified ) { modified = jqXHR.getResponseHeader("Last-Modified"); if ( modified ) { jQuery.lastModified[ cacheURL ] = modified; } modified = jqXHR.getResponseHeader("etag"); if ( modified ) { jQuery.etag[ cacheURL ] = modified; } } if ( status === 204 || s.type === "HEAD" ) { statusText = "nocontent"; } else if ( status === 304 ) { statusText = "notmodified"; } else { statusText = response.state; success = response.data; error = response.error; isSuccess = !error; } } else { error = statusText; if ( status || !statusText ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", [ jqXHR, s, isSuccess ? success : error ] ); } completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); if ( !( --jQuery.active ) ) { jQuery.event.trigger("ajaxStop"); } } } return jqXHR; }, getJSON: function( url, data, callback ) { return jQuery.get( url, data, callback, "json" ); }, getScript: function( url, callback ) { return jQuery.get( url, undefined, callback, "script" ); } }); jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; data = undefined; } return jQuery.ajax({ url: url, type: method, dataType: type, data: data, success: callback }); }; }); jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { jQuery.fn[ type ] = function( fn ) { return this.on( type, fn ); }; }); jQuery._evalUrl = function( url ) { return jQuery.ajax({ url: url, type: "GET", dataType: "script", async: false, global: false, "throws": true }); }; jQuery.fn.extend({ wrapAll: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapAll( html.call(this, i) ); }); } if ( this[0] ) { var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); if ( this[0].parentNode ) { wrap.insertBefore( this[0] ); } wrap.map(function() { var elem = this; while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { elem = elem.firstChild; } return elem; }).append( this ); } return this; }, wrapInner: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapInner( html.call(this, i) ); }); } return this.each(function() { var self = jQuery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); } else { self.append( html ); } }); }, wrap: function( html ) { var isFunction = jQuery.isFunction( html ); return this.each(function(i) { jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); }); }, unwrap: function() { return this.parent().each(function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } }).end(); } }); jQuery.expr.filters.hidden = function( elem ) { return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || (!support.reliableHiddenOffsets() && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); }; jQuery.expr.filters.visible = function( elem ) { return !jQuery.expr.filters.hidden( elem ); }; var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i; function buildParams( prefix, obj, traditional, add ) { var name; if ( jQuery.isArray( obj ) ) { jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { add( prefix, v ); } else { buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); } }); } else if ( !traditional && jQuery.type( obj ) === "object" ) { for ( name in obj ) { buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); } } else { add( prefix, obj ); } } jQuery.param = function( a, traditional ) { var prefix, s = [], add = function( key, value ) { value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }; if ( traditional === undefined ) { traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; } if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { jQuery.each( a, function() { add( this.name, this.value ); }); } else { for ( prefix in a ) { buildParams( prefix, a[ prefix ], traditional, add ); } } return s.join( "&" ).replace( r20, "+" ); }; jQuery.fn.extend({ serialize: function() { return jQuery.param( this.serializeArray() ); }, serializeArray: function() { return this.map(function() { var elements = jQuery.prop( this, "elements" ); return elements ? jQuery.makeArray( elements ) : this; }) .filter(function() { var type = this.type; return this.name && !jQuery( this ).is( ":disabled" ) && rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && ( this.checked || !rcheckableType.test( type ) ); }) .map(function( i, elem ) { var val = jQuery( this ).val(); return val == null ? null : jQuery.isArray( val ) ? jQuery.map( val, function( val ) { return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }) : { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }).get(); } }); jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? function() { return !this.isLocal && /^(get|post|head|put|delete|options)$/i.test( this.type ) && createStandardXHR() || createActiveXHR(); } : createStandardXHR; var xhrId = 0, xhrCallbacks = {}, xhrSupported = jQuery.ajaxSettings.xhr(); if ( window.ActiveXObject ) { jQuery( window ).on( "unload", function() { for ( var key in xhrCallbacks ) { xhrCallbacks[ key ]( undefined, true ); } }); } support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); xhrSupported = support.ajax = !!xhrSupported; if ( xhrSupported ) { jQuery.ajaxTransport(function( options ) { if ( !options.crossDomain || support.cors ) { var callback; return { send: function( headers, complete ) { var i, xhr = options.xhr(), id = ++xhrId; xhr.open( options.type, options.url, options.async, options.username, options.password ); if ( options.xhrFields ) { for ( i in options.xhrFields ) { xhr[ i ] = options.xhrFields[ i ]; } } if ( options.mimeType && xhr.overrideMimeType ) { xhr.overrideMimeType( options.mimeType ); } if ( !options.crossDomain && !headers["X-Requested-With"] ) { headers["X-Requested-With"] = "XMLHttpRequest"; } for ( i in headers ) { if ( headers[ i ] !== undefined ) { xhr.setRequestHeader( i, headers[ i ] + "" ); } } xhr.send( ( options.hasContent && options.data ) || null ); callback = function( _, isAbort ) { var status, statusText, responses; if ( callback && ( isAbort || xhr.readyState === 4 ) ) { delete xhrCallbacks[ id ]; callback = undefined; xhr.onreadystatechange = jQuery.noop; if ( isAbort ) { if ( xhr.readyState !== 4 ) { xhr.abort(); } } else { responses = {}; status = xhr.status; if ( typeof xhr.responseText === "string" ) { responses.text = xhr.responseText; } try { statusText = xhr.statusText; } catch( e ) { statusText = ""; } if ( !status && options.isLocal && !options.crossDomain ) { status = responses.text ? 200 : 404; } else if ( status === 1223 ) { status = 204; } } } if ( responses ) { complete( status, statusText, responses, xhr.getAllResponseHeaders() ); } }; if ( !options.async ) { callback(); } else if ( xhr.readyState === 4 ) { setTimeout( callback ); } else { xhr.onreadystatechange = xhrCallbacks[ id ] = callback; } }, abort: function() { if ( callback ) { callback( undefined, true ); } } }; } }); } function createStandardXHR() { try { return new window.XMLHttpRequest(); } catch( e ) {} } function createActiveXHR() { try { return new window.ActiveXObject( "Microsoft.XMLHTTP" ); } catch( e ) {} } jQuery.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /(?:java|ecma)script/ }, converters: { "text script": function( text ) { jQuery.globalEval( text ); return text; } } }); jQuery.ajaxPrefilter( "script", function( s ) { if ( s.cache === undefined ) { s.cache = false; } if ( s.crossDomain ) { s.type = "GET"; s.global = false; } }); jQuery.ajaxTransport( "script", function(s) { if ( s.crossDomain ) { var script, head = document.head || jQuery("head")[0] || document.documentElement; return { send: function( _, callback ) { script = document.createElement("script"); script.async = true; if ( s.scriptCharset ) { script.charset = s.scriptCharset; } script.src = s.url; script.onload = script.onreadystatechange = function( _, isAbort ) { if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { script.onload = script.onreadystatechange = null; if ( script.parentNode ) { script.parentNode.removeChild( script ); } script = null; if ( !isAbort ) { callback( 200, "success" ); } } }; head.insertBefore( script, head.firstChild ); }, abort: function() { if ( script ) { script.onload( undefined, true ); } } }; } }); var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/; jQuery.ajaxSetup({ jsonp: "callback", jsonpCallback: function() { var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); this[ callback ] = true; return callback; } }); jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? "url" : typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" ); if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback; if ( jsonProp ) { s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); } else if ( s.jsonp !== false ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; } s.converters["script json"] = function() { if ( !responseContainer ) { jQuery.error( callbackName + " was not called" ); } return responseContainer[ 0 ]; }; s.dataTypes[ 0 ] = "json"; overwritten = window[ callbackName ]; window[ callbackName ] = function() { responseContainer = arguments; }; jqXHR.always(function() { window[ callbackName ] = overwritten; if ( s[ callbackName ] ) { s.jsonpCallback = originalSettings.jsonpCallback; oldCallbacks.push( callbackName ); } if ( responseContainer && jQuery.isFunction( overwritten ) ) { overwritten( responseContainer[ 0 ] ); } responseContainer = overwritten = undefined; }); return "script"; } }); jQuery.parseHTML = function( data, context, keepScripts ) { if ( !data || typeof data !== "string" ) { return null; } if ( typeof context === "boolean" ) { keepScripts = context; context = false; } context = context || document; var parsed = rsingleTag.exec( data ), scripts = !keepScripts && []; if ( parsed ) { return [ context.createElement( parsed[1] ) ]; } parsed = jQuery.buildFragment( [ data ], context, scripts ); if ( scripts && scripts.length ) { jQuery( scripts ).remove(); } return jQuery.merge( [], parsed.childNodes ); }; var _load = jQuery.fn.load; jQuery.fn.load = function( url, params, callback ) { if ( typeof url !== "string" && _load ) { return _load.apply( this, arguments ); } var selector, response, type, self = this, off = url.indexOf(" "); if ( off >= 0 ) { selector = jQuery.trim( url.slice( off, url.length ) ); url = url.slice( 0, off ); } if ( jQuery.isFunction( params ) ) { callback = params; params = undefined; } else if ( params && typeof params === "object" ) { type = "POST"; } if ( self.length > 0 ) { jQuery.ajax({ url: url, type: type, dataType: "html", data: params }).done(function( responseText ) { response = arguments; self.html( selector ? jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : responseText ); }).complete( callback && function( jqXHR, status ) { self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); }); } return this; }; jQuery.expr.filters.animated = function( elem ) { return jQuery.grep(jQuery.timers, function( fn ) { return elem === fn.elem; }).length; }; var docElem = window.document.documentElement; function getWindow( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; } jQuery.offset = { setOffset: function( elem, options, i ) { var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css( elem, "position" ), curElem = jQuery( elem ), props = {}; if ( position === "static" ) { elem.style.position = "relative"; } curOffset = curElem.offset(); curCSSTop = jQuery.css( elem, "top" ); curCSSLeft = jQuery.css( elem, "left" ); calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1; if ( calculatePosition ) { curPosition = curElem.position(); curTop = curPosition.top; curLeft = curPosition.left; } else { curTop = parseFloat( curCSSTop ) || 0; curLeft = parseFloat( curCSSLeft ) || 0; } if ( jQuery.isFunction( options ) ) { options = options.call( elem, i, curOffset ); } if ( options.top != null ) { props.top = ( options.top - curOffset.top ) + curTop; } if ( options.left != null ) { props.left = ( options.left - curOffset.left ) + curLeft; } if ( "using" in options ) { options.using.call( elem, props ); } else { curElem.css( props ); } } }; jQuery.fn.extend({ offset: function( options ) { if ( arguments.length ) { return options === undefined ? this : this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } var docElem, win, box = { top: 0, left: 0 }, elem = this[ 0 ], doc = elem && elem.ownerDocument; if ( !doc ) { return; } docElem = doc.documentElement; if ( !jQuery.contains( docElem, elem ) ) { return box; } if ( typeof elem.getBoundingClientRect !== strundefined ) { box = elem.getBoundingClientRect(); } win = getWindow( doc ); return { top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) }; }, position: function() { if ( !this[ 0 ] ) { return; } var offsetParent, offset, parentOffset = { top: 0, left: 0 }, elem = this[ 0 ]; if ( jQuery.css( elem, "position" ) === "fixed" ) { offset = elem.getBoundingClientRect(); } else { offsetParent = this.offsetParent(); offset = this.offset(); if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { parentOffset = offsetParent.offset(); } parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); } return { top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) }; }, offsetParent: function() { return this.map(function() { var offsetParent = this.offsetParent || docElem; while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) { offsetParent = offsetParent.offsetParent; } return offsetParent || docElem; }); } }); jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { var top = /Y/.test( prop ); jQuery.fn[ method ] = function( val ) { return access( this, function( elem, method, val ) { var win = getWindow( elem ); if ( val === undefined ) { return win ? (prop in win) ? win[ prop ] : win.document.documentElement[ method ] : elem[ method ]; } if ( win ) { win.scrollTo( !top ? val : jQuery( win ).scrollLeft(), top ? val : jQuery( win ).scrollTop() ); } else { elem[ method ] = val; } }, method, val, arguments.length, null ); }; }); jQuery.each( [ "top", "left" ], function( i, prop ) { jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, function( elem, computed ) { if ( computed ) { computed = curCSS( elem, prop ); return rnumnonpx.test( computed ) ? jQuery( elem ).position()[ prop ] + "px" : computed; } } ); }); jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { jQuery.fn[ funcName ] = function( margin, value ) { var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); return access( this, function( elem, type, value ) { var doc; if ( jQuery.isWindow( elem ) ) { return elem.document.documentElement[ "client" + name ]; } if ( elem.nodeType === 9 ) { doc = elem.documentElement; return Math.max( elem.body[ "scroll" + name ], doc[ "scroll" + name ], elem.body[ "offset" + name ], doc[ "offset" + name ], doc[ "client" + name ] ); } return value === undefined ? jQuery.css( elem, type, extra ) : jQuery.style( elem, type, value, extra ); }, type, chainable ? margin : undefined, chainable, null ); }; }); }); jQuery.fn.size = function() { return this.length; }; jQuery.fn.andSelf = jQuery.fn.addBack; if ( typeof define === "function" && define.amd ) { define( "jquery", [], function() { return jQuery; }); } var _jQuery = window.jQuery, _$ = window.$; jQuery.noConflict = function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }; if ( typeof noGlobal === strundefined ) { window.jQuery = window.$ = jQuery; } return jQuery; }));
blueocean-material-icons/src/js/components/svg-icons/social/share.js
jenkinsci/blueocean-plugin
import React from 'react'; import SvgIcon from '../../SvgIcon'; const SocialShare = (props) => ( <SvgIcon {...props}> <path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"/> </SvgIcon> ); SocialShare.displayName = 'SocialShare'; SocialShare.muiName = 'SvgIcon'; export default SocialShare;
src/svg-icons/action/input.js
jacklam718/react-svg-iconx
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionInput = (props) => ( <SvgIcon {...props}> <path d="M21 3.01H3c-1.1 0-2 .9-2 2V9h2V4.99h18v14.03H3V15H1v4.01c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.11-.9-2-2-2zM11 16l4-4-4-4v3H1v2h10v3z"/> </SvgIcon> ); ActionInput = pure(ActionInput); ActionInput.displayName = 'ActionInput'; ActionInput.muiName = 'SvgIcon'; export default ActionInput;
src/Card/CardBody.js
reactivers/react-material-design
/** * Created by Utku on 24/03/2017. */ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import '@material/card/dist/mdc.card.css'; export default class CardBody extends React.PureComponent{ static propTypes={ className : PropTypes.string, style : PropTypes.object, }; render(){ const {className,...rest} = this.props; const classes = classNames("mdc-card__supporting-text",className) return( <section className={classes} {...rest}> {this.props.children} </section> ) } }
src/server.js
mywentu/react-blog
import React from 'react' import { match } from 'react-router' import { renderToString, renderToStaticMarkup } from 'react-dom/server' import { syncHistoryWithStore } from 'react-router-redux' import createMemoryHistory from 'react-router/lib/createMemoryHistory' import { getStyles } from 'simple-universal-style-loader' import Helmet from 'react-helmet' import createStore from './store/createStore' import AppContainer from './containers/AppContainer' import _debug from 'debug' import * as Assetic from './modules/Assetic' import defaultLayout from '../config/layout' import { renderHtmlLayout } from 'helmet-webpack-plugin' import PrettyError from 'pretty-error' import config from '../config' import router from '../server/router' const debug = _debug('app:server:universal:render') export default getClientInfo => { return async function (ctx, next) { const initialState = await router(ctx) const memoryHistory = createMemoryHistory(ctx.req.url) const store = createStore(initialState, memoryHistory) const routes = require('./routes/index').default(store) const history = syncHistoryWithStore(memoryHistory, store, { selectLocationState: (state) => state.router }) match({history, routes, location: ctx.req.url}, async (err, redirect, props) => { debug('Handle route', ctx.req.url) let head, content let {app, vendor} = getClientInfo().assetsByChunkName let links = Assetic .getStyles(([vendor, app])) .map(asset => ({ rel: 'stylesheet', href: `${asset}` })) const handleError = ({status, message, error = null, children = null}) => { if (error) { let pe = new PrettyError() debug(pe.render(error)) } let title = `${status} - ${message}` content = renderToStaticMarkup( <div> <Helmet {...{...layout, title}} /> <h3>{title}</h3> {children} </div> ) head = Helmet.rewind() ctx.status = 500 ctx.body = renderHtmlLayout(head, <div dangerouslySetInnerHTML={{__html: content}} />) } // This will be transferred to the client side in __LAYOUT__ variable // when universal is enabled we need to make sure the client to know about the chunk styles let layoutWithLinks = { ...defaultLayout, link: links } // React-helmet will overwrite the layout once the client start running so that // we don't have to remove our unused styles generated on server side let layout = { ...layoutWithLinks, style: getStyles().map(style => ({ cssText: style.parts.map(part => `${part.css}\n`).join('\n') })), script: [ ...defaultLayout.script, {type: 'text/javascript', innerHTML: `___INITIAL_STATE__ = ${JSON.stringify(store.getState())}`}, {type: 'text/javascript', innerHTML: `___LAYOUT__ = ${JSON.stringify(layoutWithLinks)}`} ] } // ---------------------------------- // Internal server error // ---------------------------------- if (err) { handleError({status: 500, message: 'Internal server error', error: err}) return } // ---------------------------------- // No route matched // This should never happen if the router has a '*' route defined // ---------------------------------- if (typeof err === 'undefined' && typeof redirect === 'undefined' && typeof props === 'undefined') { debug('No route found.') // We could call our next middleware maybe // await next() // return // Or display a 404 page handleError({status: 404, message: 'Page not found'}) return } // ---------------------------------- // Everything went fine so far // ---------------------------------- let scripts = Assetic .getScripts(([vendor, app])) .map((asset, i) => <script key={i} type='text/javascript' src={`${asset}`} />) try { content = renderToString( <AppContainer history={history} routerKey={Math.random()} routes={routes} store={store} layout={layout} /> ) } catch (err) { handleError({status: 500, message: 'Internal Server Error', error: err}) return } head = Helmet.rewind() let body = <div key='body' {...config.app_mount_point} dangerouslySetInnerHTML={{__html: content}} /> ctx.status = 200 ctx.body = renderHtmlLayout(head, [body, scripts]) }) } }
src/components/Biggo.js
swashcap/LookieHere
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Animated, Image, Platform, StatusBar, StyleSheet, Text, TouchableWithoutFeedback, View, WebView, } from 'react-native'; import loadingAnimation3 from '../images/loading-animation-3.gif'; import Panonav from './Panonav'; const styles = StyleSheet.create({ backButton: { alignItems: 'center', height: '100%', justifyContent: 'center', width: 60, zIndex: 2, }, backButtonText: { color: 'white', fontFamily: 'Copperplate', }, bottom: { backgroundColor: 'indigo', }, container: { backgroundColor: 'indigo', flex: 1, flexDirection: 'column', position: 'relative', }, content: { flex: 1, position: 'relative', zIndex: 2, }, image: { height: 100, width: 100, }, loading: { alignItems: 'center', flex: 1, height: '100%', justifyContent: 'center', left: 0, position: 'absolute', top: 0, width: '100%', zIndex: -1, }, loadingImage: { height: 100, width: 100, }, name: { color: 'white', flexShrink: 2, fontFamily: 'Times New Roman', fontSize: 18, fontWeight: '700', height: 18, lineHeight: 18, marginTop: 6, paddingLeft: 10, paddingRight: 60, }, nameOutOfStock: { color: 'darksalmon', textDecorationLine: 'line-through', textDecorationStyle: 'solid', }, price: { backgroundColor: 'hotpink', /** * @todo Debug view stacking in Android so WebView doesn't layer on top of * price. */ bottom: Platform.OS === 'ios' ? -10 : 5, color: 'lemonchiffon', fontFamily: 'Chalkboard SE', fontSize: 24, fontWeight: '700', letterSpacing: -1, lineHeight: 24, paddingLeft: 6, paddingRight: 6, paddingTop: 6, position: 'absolute', right: 5, transform: [{ rotate: '5deg' }], }, stock: { backgroundColor: 'transparent', bottom: 10, color: 'red', fontFamily: 'Times New Roman', fontSize: 22, fontStyle: 'italic', fontWeight: '700', left: 0, lineHeight: 22, position: 'absolute', textAlign: 'center', width: '100%', }, top: { flexDirection: 'row', paddingTop: 22, position: 'relative', width: '100%', zIndex: 2, }, }); /** * Biggo. * @module * * Displays a single product. */ export default class Biggo extends Component { /** * Get HTML for the WebView. * * @todo Better way to do this? Place in stylesheet? * * @param {Object} product * @param {string} [product.longDescription] * @param {string} product.productImage * @param {string} product.productName * @param {number} product.reviewCount * @param {number} product.reviewRating * @param {number} product.shortDescription * @returns {string} */ static getWebViewHTML({ longDescription, productImage, productName, reviewCount, reviewRating, shortDescription, }) { return `<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> html { background: linear-gradient(hotpink, indigo); color: white; font-family: 'Chalkboard SE'; line-height: 1.25; } * { box-sizing: border-box; } body { margin: 0 } img { height: auto; width: 100%; } .name { background: indigo; font-family: 'Times New Roman'; line-height: 1; margin: 0; padding: 1rem; text-align: center; } .description { font-size: 125%; font-weight: 400; line-height: 1.1; margin: 0 0 1rem; } .rating { background: indigo; color: pink; display: flex; justify-content: center; padding: .25rem 1rem 1rem; text-align: center; } .rating-stars { font-size: 120%; letter-spacing: .1em; position: relative; overflow: hidden; } .rating-stars:after { background: indigo; content: '☆☆☆☆☆'; direction: rtl; display: block; height: 100%; position: absolute; right: 0; top: 0; width: ${reviewRating * 20}%; } .rating-count { padding-left: .5rem; } .content { padding: 1rem; } </style> </head> <body> <h1 class="name">${productName}</h1> <div class="rating"> <div class="rating-stars">★★★★★</div> <div class="rating-count"> ${reviewCount + (reviewCount === 1 ? ' review' : ' reviews')} </div> </div> <img src="${productImage}" /> <div class="content"> <h2 class="description">${shortDescription}</h2> ${longDescription} </div> <script> (function () { var headerHeight = document.querySelector('h1').offsetHeight; var lastScroll = 0; var ticking = false; window.addEventListener('scroll', function onScroll(event) { lastScroll = window.scrollY; if (!ticking) { window.requestAnimationFrame(function () { postMessage( lastScroll > 0.95 * headerHeight ? 'scrolled' : 'not-scrolled' ); ticking = false; }); } ticking = true; }); })(); </script> </body> </html>`; } constructor(props) { super(props); this.state = { isTopAnimating: false, topCollapse: new Animated.Value(0), }; this.animateTop = this.animateTop.bind(this); this.handleWebViewMessage = this.handleWebViewMessage.bind(this); this.renderBottom = this.renderBottom.bind(this); this.renderTop = this.renderTop.bind(this); } /** * Handle `postMessage` from WebView. * * {@link https://facebook.github.io/react-native/docs/webview.html#onmessage} * * @param {Object} event */ handleWebViewMessage(event) { const { nativeEvent: { data } } = event; const { isTopAnimating, topCollapse } = this.state; if (!isTopAnimating) { if (data === 'scrolled' && topCollapse !== 1) { this.animateTop(1); } else if (data === 'not-scrolled' && topCollapse !== 0) { this.animateTop(0); } } } /** * Animate 'top' section to expand or collapse. * * @param {number} toValue Value to animate to: either `1` or `0` */ animateTop(toValue) { this.setState({ isTopAnimated: true, topCollapse: this.state.topCollapse, }); Animated.timing(this.state.topCollapse, { duration: 400, toValue, }).start(() => this.setState({ isTopAnimated: false, topCollapse: this.state.topCollapse, })); } /** * Render bottom WebView. * * @todo Use WKWebView? {@link https://github.com/facebook/react-native/issues/321} * * @returns {ReactNative.WebView} */ renderBottom() { const { longDescription, productImage, productName, reviewCount, reviewRating, shortDescription, } = this.props; const html = Biggo.getWebViewHTML({ longDescription, productImage, productName, reviewCount, reviewRating, shortDescription, }); return ( <WebView bounces decelerationRate={'normal'} javaScriptEnabled={false} onMessage={this.handleWebViewMessage} scalesPageToFit={false} scrollEnabled source={{ html }} style={styles.bottom} /> ); } /** * Render top elements. * * @returns {ReactNative.Animated.View} */ renderTop() { const { inStock, onNavigateBack, productName, price } = this.props; const { topCollapse } = this.state; const stock = !inStock ? <Text style={styles.stock}>Out of Stock</Text> : undefined; const topStyle = StyleSheet.flatten([styles.top, { height: topCollapse.interpolate({ inputRange: [0, 1], outputRange: [75, 55], }), }]); const nameStyle = StyleSheet.flatten([ styles.name, (!inStock ? styles.nameOutOfStock : undefined), { opacity: topCollapse, }, ]); return ( <Animated.View style={topStyle}> <TouchableWithoutFeedback onPress={onNavigateBack}> <View style={styles.backButton}> <Text style={styles.backButtonText}>&lt; Back</Text> </View> </TouchableWithoutFeedback> <Animated.Text style={nameStyle}> {productName} </Animated.Text> <Text style={styles.price}>{price}</Text> {stock} </Animated.View> ); } render() { const { onNavigateNext, onNavigatePrevious } = this.props; return ( <View style={styles.container}> <View style={styles.loading}> <Image source={loadingAnimation3} style={styles.loadingImage} /> </View> <View style={styles.content}> <StatusBar backgroundColor="indigo" barStyle="light-content" /> {this.renderTop()} <Panonav onPanLeft={onNavigateNext} onPanRight={onNavigatePrevious} > {this.renderBottom()} </Panonav> </View> </View> ); } } Biggo.defaultProps = { longDescription: '', onNavigateNext: undefined, onNavigatePrevious: undefined, }; Biggo.propTypes = { inStock: PropTypes.bool.isRequired, longDescription: PropTypes.string, onNavigateBack: PropTypes.func.isRequired, onNavigateNext: PropTypes.func, onNavigatePrevious: PropTypes.func, price: PropTypes.string.isRequired, productImage: PropTypes.string.isRequired, productName: PropTypes.string.isRequired, reviewCount: PropTypes.number.isRequired, reviewRating: PropTypes.number.isRequired, shortDescription: PropTypes.string.isRequired, };
soon/react-boilerplate/app/components/LoadingIndicator/Circle.js
rmevans9/reactotron
import React, { PropTypes } from 'react'; import styled, { keyframes } from 'styled-components'; const circleFadeDelay = keyframes` 0%, 39%, 100% { opacity: 0; } 40% { opacity: 1; } `; const Circle = (props) => { const CirclePrimitive = styled.div` width: 100%; height: 100%; position: absolute; left: 0; top: 0; ${props.rotate && ` -webkit-transform: rotate(${props.rotate}deg); -ms-transform: rotate(${props.rotate}deg); transform: rotate(${props.rotate}deg); `} &:before { content: ''; display: block; margin: 0 auto; width: 15%; height: 15%; background-color: #999; border-radius: 100%; animation: ${circleFadeDelay} 1.2s infinite ease-in-out both; ${props.delay && ` -webkit-animation-delay: ${props.delay}s; animation-delay: ${props.delay}s; `} } `; return <CirclePrimitive />; }; Circle.propTypes = { delay: PropTypes.number, rotate: PropTypes.number, }; export default Circle;
src/icons/RemoveCircleIcon.js
kiloe/ui
import React from 'react'; import Icon from '../Icon'; export default class RemoveCircleIcon extends Icon { getSVG(){return <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 22H14v-4h20v4z"/></svg>;} };
src/client/index.js
busyorg/busy
import 'babel-polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { message } from 'antd'; import Cookie from 'js-cookie'; import steemConnectAPI from './steemConnectAPI'; import history from './history'; import getStore from './store'; import AppHost from './AppHost'; import { getBrowserLocale, loadLanguage } from './translations'; import { setUsedLocale } from './app/appActions'; import { getLocale } from './reducers'; if ('serviceWorker' in navigator && process.env.NODE_ENV === 'production') { navigator.serviceWorker.register('/service-worker.js'); } const accessToken = Cookie.get('access_token'); if (accessToken) { steemConnectAPI.setAccessToken(accessToken); } const store = getStore(steemConnectAPI); message.config({ top: 62, duration: 3, }); const render = async Component => { const state = store.getState(); const userLocale = getLocale(state); let activeLocale = userLocale; if (activeLocale === 'auto') { activeLocale = Cookie.get('language') || getBrowserLocale() || 'en-US'; } const lang = await loadLanguage(activeLocale); store.dispatch(setUsedLocale(lang)); ReactDOM.hydrate( <Provider store={store}> <Component history={history} /> </Provider>, document.getElementById('app'), ); }; render(AppHost);
works/react-native/redux/reddit-js/async/src/index.js
JoelPub/wordpress-amazon
import React from 'react' import { render } from 'react-dom' import { createStore, applyMiddleware } from 'redux' import { Provider } from 'react-redux' import thunk from 'redux-thunk' import createLogger from 'redux-logger' import reducer from './reducers' import App from './containers/App' const middleware = [ thunk ] if (process.env.NODE_ENV !== 'production') { middleware.push(createLogger()) } const store = createStore( reducer, applyMiddleware(...middleware) ) render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') )
src/views/SignUp.js
bshyong/trailerzoo-redux
import React from 'react'; export default class SignUp { render() { return ( <div> <h1>Sign Up</h1> </div> ); } }
docs/website/src/templates/action.js
adaltas/node-nikita
// React import React from 'react' // Gatsby import { graphql } from 'gatsby' // MDX import { MDXProvider } from "@mdx-js/react" import { MDXRenderer } from "gatsby-plugin-mdx" // Local import Layout from '../components/Layout' const Template = ({ data }) => { const { page } = data return ( <Layout page={{ keywords: page.package.keywords, description: page.parent.excerpt, title: `Action "${page.name}"`, slug: page.slug, version: page.version.alias, edit_url: page.edit_url, tableOfContents: page.parent.tableOfContents}}> <MDXProvider> <MDXRenderer>{page.parent.body}</MDXRenderer> </MDXProvider> </Layout> ) } export default Template export const pageQuery = graphql` query($path: String!) { page: nikitaAction(slug: { eq: $path }) { slug edit_url package { id keywords } name version { alias } parent { ... on Mdx { body tableOfContents(maxDepth: 2) excerpt(truncate: true, pruneLength: 200) } } } } `
client/modules/Post/__tests__/components/PostCreateWidget.spec.js
BingeTrackr/BingeTrackr
import React from 'react'; import test from 'ava'; import sinon from 'sinon'; import { FormattedMessage } from 'react-intl'; import { PostCreateWidget } from '../../components/PostCreateWidget/PostCreateWidget'; import { mountWithIntl, shallowWithIntl } from '../../../../util/react-intl-test-helper'; const props = { addPost: () => {}, showAddPost: true, }; test('renders properly', t => { const wrapper = shallowWithIntl( <PostCreateWidget {...props} /> ); t.truthy(wrapper.hasClass('form')); t.truthy(wrapper.hasClass('appear')); t.truthy(wrapper.find('h2').first().containsMatchingElement(<FormattedMessage id="createNewPost" />)); t.is(wrapper.find('input').length, 2); t.is(wrapper.find('textarea').length, 1); }); test('hide when showAddPost is false', t => { const wrapper = mountWithIntl( <PostCreateWidget {...props} /> ); wrapper.setProps({ showAddPost: false }); t.falsy(wrapper.hasClass('appear')); }); test('has correct props', t => { const wrapper = mountWithIntl( <PostCreateWidget {...props} /> ); t.is(wrapper.prop('addPost'), props.addPost); t.is(wrapper.prop('showAddPost'), props.showAddPost); }); test('calls addPost', t => { const addPost = sinon.spy(); const wrapper = mountWithIntl( <PostCreateWidget addPost={addPost} showAddPost /> ); wrapper.ref('name').get(0).value = 'David'; wrapper.ref('title').get(0).value = 'Some Title'; wrapper.ref('content').get(0).value = 'Bla Bla Bla'; wrapper.find('a').first().simulate('click'); t.truthy(addPost.calledOnce); t.truthy(addPost.calledWith('David', 'Some Title', 'Bla Bla Bla')); }); test('empty form doesn\'t call addPost', t => { const addPost = sinon.spy(); const wrapper = mountWithIntl( <PostCreateWidget addPost={addPost} showAddPost /> ); wrapper.find('a').first().simulate('click'); t.falsy(addPost.called); });
HomeRange/app/components/NullPage.js
Onlyjson/yanShu_Project
/** * @author: zhangyh-k@glondon.com * @description: * @Date: 2017/10/9 上午11:08 */ import React from 'react'; import { Image, View } from 'react-native'; //无数据 export const NullPage = () => { return ( <View style={{alignItems:'center',paddingTop:160,flex:1}}> <Image source={require('../image/buchong/nodata.png')} style={{width:140,height:140}} /> </View> ); } //无网 export const NoNetPage = () => { return ( <View style={{alignItems:'center',paddingTop:160,flex:1}}> <Image source={require('../image/buchong/nodata.png')} style={{width:140,height:140}} /> </View> ); }
src/main.js
janakuma/newLobby
import React from 'react'; import ReactDOM from 'react-dom'; import {createStore} from 'redux'; import {Provider} from 'react-redux'; import App from './apps/components/app/app'; import allReducers from './apps/components/reducers'; import './apps/styles/styles.scss'; const store = createStore( allReducers, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() ); ReactDOM.render( <Provider store={store}> <App/> </Provider>, document.getElementById('app') );
src/client/app/index.js
mapkiwiz/sectorisation
import React from 'react'; import ReactDOM from 'react-dom'; import {App} from './app'; import {Provider} from 'react-redux'; import {reducer} from './reducers/index'; import {loadProject, saveProject} from './shared/project'; import URLSearchParams from 'url-search-params'; const Redux = require('redux'); class Messenger { message; getMessage() { return this.message; } setMessage(text, type) { this.message = { text: text, type: type }; } clearMessages() { this.message = undefined; } } (function() { let store; let messenger = new Messenger(); if (window.location.search) { let params = new URLSearchParams(window.location.search.slice(1)); let projectId = params.get('p'); if (projectId) { let state = loadProject(projectId); store = Redux.createStore(reducer, state); messenger.setMessage('Projet ouvert : ' + (state.project.title || 'Sans titre'), 'success'); } else { store = Redux.createStore(reducer); messenger.setMessage('Nouveau projet', 'success'); } } else { store = Redux.createStore(reducer); messenger.setMessage('Nouveau projet', 'success'); } ReactDOM.render( <Provider store={ store }> <App messenger={ messenger }></App> </Provider>, document.getElementById('main') ); window.onbeforeunload = function (e) { // TODO saveProject(store.getState()); console.log(e); let message = "Voulez-vous vraiment quitter l'application ?"; e = e || window.event; // For IE and Firefox if (e) { console.log(e); e.returnValue = message; } // For Safari return message; }; store.dispatch({ type: 'WORKER_RESET_FILTER' }); store.dispatch({ type: 'GROUP_RESET_FILTER' }); })();
src/components/AppRoutes.js
clayhan/reactserver
// src/components/AppRoutes.js // Import the Router component and add it inside our render function. // The router receives our routes mapping in the router prop. // We also configure the history prop to specify that we want to use the HTML5 browser history for the routing import React from 'react'; import { Router, browserHistory } from 'react-router'; import routes from './../routes'; export default class AppRoutes extends React.Component { render() { return ( <Router history={browserHistory} routes={routes} /> ); } }
packages/material-ui-icons/src/ArrowDropDownSharp.js
kybarg/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <path d="M7 10l5 5 5-5H7z" /> , 'ArrowDropDownSharp');
lens-ui/app/components/CubeTreeComponent.js
archanah24/lens
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import React from 'react'; import TreeView from 'react-treeview'; import assign from 'object-assign'; import { Link } from 'react-router'; import 'react-treeview/react-treeview.css'; import ClassNames from 'classnames'; import DatabaseStore from '../stores/DatabaseStore'; import CubeStore from '../stores/CubeStore'; import AdhocQueryActions from '../actions/AdhocQueryActions'; import UserStore from '../stores/UserStore'; import Loader from '../components/LoaderComponent'; import '../styles/css/tree.css'; function getCubeData () { return { cubes: CubeStore.getCubes(UserStore.currentDatabase()) }; } class CubeTree extends React.Component { constructor (props) { super(props); // setting the initial state, as getInitialState only // comes with React.createClass, using constructor is the new // idiomatic way // https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html this.state = {cubes: CubeStore.getCubes(UserStore.currentDatabase()), loading: false, isCollapsed: false }; // no autobinding with ES6 so doing it manually, see link below // https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#autobinding this._onChange = this._onChange.bind(this); this.toggle = this.toggle.bind(this); if (!this.state.cubes) { this.state.cubes = this.state.cubes || []; this.state.loading = true; AdhocQueryActions.getCubes(UserStore.getUserDetails().secretToken, UserStore.currentDatabase()); } } componentDidMount () { CubeStore.addChangeListener(this._onChange); } componentWillUnmount () { CubeStore.removeChangeListener(this._onChange); } render () { // cube tree structure sample // [{ // name: 'Cube-1', // measures: [{name: 'Measure-1'}, {name: 'Measure-1'}], // optional // dimensions: [{name: 'Dimension-1'}, {name: 'Dimension-1'}] //optional // }, ...] var cubeHash = assign({}, this.state.cubes); var cubeTree = Object.keys(this.state.cubes).map((cubeName, i) => { let cube = cubeHash[cubeName]; let label = <Link to='cubeschema' params={{databaseName: this.state.database, cubeName: cubeName}}> <span className='node'>{cube.name}</span> </Link>; let measureLabel = <Link to='cubeschema' params={{databaseName: this.state.database, cubeName: cubeName}} query={{type: 'measures'}}> <span className='quiet'>Measures</span> </Link>; let dimensionLabel = <Link to='cubeschema' params={{databaseName: this.state.database, cubeName: cubeName}} query={{type: 'dimensions'}}> <span className='quiet'>Dim-Attributes</span> </Link>; return ( <TreeView key={cube.name + '|' + i} nodeLabel={label} defaultCollapsed={!cube.isLoaded} onClick={this.getDetails.bind(this, cube.name)}> <TreeView key={cube.name + '|measures'} nodeLabel={measureLabel} defaultCollapsed={!cube.isLoaded}> { cube.measures ? cube.measures.map(measure => { return ( <div key={measure.name} className='treeNode measureNode'> {measure.name} ({measure.default_aggr}) </div> ); }) : null } </TreeView > <TreeView key={cube.name + '|dim attributes'} nodeLabel={dimensionLabel} defaultCollapsed={!cube.isLoaded}> { cube.dimensions ? cube.dimensions.map(dimension => { return ( <div className='treeNode dimensionNode' key={dimension.name}> {dimension.name} </div> ); }) : null } </TreeView > </TreeView > ); }); if (this.state.loading) { cubeTree = <Loader size='4px' margin='2px'/>; } else if (!Object.keys(this.state.cubes).length) { cubeTree = (<div className='alert-danger' style={{padding: '8px 5px'}}> <strong>Sorry, we couldn&#39;t find any cubes.</strong> </div>); } let collapseClass = ClassNames({ 'pull-right': true, 'glyphicon': true, 'glyphicon-chevron-up': !this.state.isCollapsed, 'glyphicon-chevron-down': this.state.isCollapsed }); let panelBodyClassName = ClassNames({ 'panel-body': true, 'hide': this.state.isCollapsed }); return ( <div className='panel panel-default'> <div className='panel-heading'> <h3 className='panel-title'> Cubes <span className={collapseClass} onClick={this.toggle}></span> </h3> </div> <div className={panelBodyClassName} style={{maxHeight: '350px', overflowY: 'auto'}}> {cubeTree} </div> </div> ); } _onChange () { let state = getCubeData(); state.loading = false; this.setState(state); } // TODO: check its binding in the onClick method // needs to be investigated // https://facebook.github.io/react/tips/communicate-between-components.html getDetails (cubeName) { if (this.state.cubes[cubeName].isLoaded) return; AdhocQueryActions .getCubeDetails(UserStore.getUserDetails().secretToken, cubeName); } toggle () { this.setState({isCollapsed: !this.state.isCollapsed}); } } export default CubeTree;
frontend/src/components/head/Head.js
sweetca/logger
import React, { Component } from 'react'; import './Head.css'; import logo from './logo.png'; class Header extends Component { render() { return ( <div className="Head"> <img src={logo} alt="logo"/> </div> ); } } export default Header;
Libraries/Animated/src/AnimatedImplementation.js
Swaagie/react-native
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule AnimatedImplementation * @flow * @preventMunge */ 'use strict'; var InteractionManager = require('InteractionManager'); var Interpolation = require('Interpolation'); var NativeAnimatedHelper = require('NativeAnimatedHelper'); var React = require('React'); var ReactNative = require('ReactNative'); var Set = require('Set'); var SpringConfig = require('SpringConfig'); var ViewStylePropTypes = require('ViewStylePropTypes'); var flattenStyle = require('flattenStyle'); var invariant = require('fbjs/lib/invariant'); var requestAnimationFrame = require('fbjs/lib/requestAnimationFrame'); import type { InterpolationConfigType } from 'Interpolation'; type EndResult = {finished: bool}; type EndCallback = (result: EndResult) => void; var NativeAnimatedAPI = NativeAnimatedHelper.API; var warnedMissingNativeAnimated = false; function shouldUseNativeDriver(config: AnimationConfig | EventConfig): boolean { if (config.useNativeDriver && !NativeAnimatedHelper.isNativeAnimatedAvailable()) { if (!warnedMissingNativeAnimated) { console.warn( 'Animated: `useNativeDriver` is not supported because the native ' + 'animated module is missing. Falling back to JS-based animation. To ' + 'resolve this, add `RCTAnimation` module to this app, or remove ' + '`useNativeDriver`. ' + 'More info: https://github.com/facebook/react-native/issues/11094#issuecomment-263240420' ); warnedMissingNativeAnimated = true; } return false; } return config.useNativeDriver || false; } // Note(vjeux): this would be better as an interface but flow doesn't // support them yet class Animated { __attach(): void {} __detach(): void { if (this.__isNative && this.__nativeTag != null) { NativeAnimatedAPI.dropAnimatedNode(this.__nativeTag); this.__nativeTag = undefined; } } __getValue(): any {} __getAnimatedValue(): any { return this.__getValue(); } __addChild(child: Animated) {} __removeChild(child: Animated) {} __getChildren(): Array<Animated> { return []; } /* Methods and props used by native Animated impl */ __isNative: bool; __nativeTag: ?number; __makeNative() { if (!this.__isNative) { throw new Error('This node cannot be made a "native" animated node'); } } __getNativeTag(): ?number { NativeAnimatedHelper.assertNativeAnimatedModule(); invariant(this.__isNative, 'Attempt to get native tag from node not marked as "native"'); if (this.__nativeTag == null) { var nativeTag: ?number = NativeAnimatedHelper.generateNewNodeTag(); NativeAnimatedAPI.createAnimatedNode(nativeTag, this.__getNativeConfig()); this.__nativeTag = nativeTag; } return this.__nativeTag; } __getNativeConfig(): Object { throw new Error('This JS animated node type cannot be used as native animated node'); } toJSON(): any { return this.__getValue(); } } type AnimationConfig = { isInteraction?: bool, useNativeDriver?: bool, onComplete?: ?EndCallback, iterations?: number, }; // Important note: start() and stop() will only be called at most once. // Once an animation has been stopped or finished its course, it will // not be reused. class Animation { __active: bool; __isInteraction: bool; __nativeId: number; __onEnd: ?EndCallback; __iterations: number; start( fromValue: number, onUpdate: (value: number) => void, onEnd: ?EndCallback, previousAnimation: ?Animation, animatedValue: AnimatedValue ): void {} stop(): void { if (this.__nativeId) { NativeAnimatedAPI.stopAnimation(this.__nativeId); } } __getNativeAnimationConfig(): any { // Subclasses that have corresponding animation implementation done in native // should override this method throw new Error('This animation type cannot be offloaded to native'); } // Helper function for subclasses to make sure onEnd is only called once. __debouncedOnEnd(result: EndResult): void { var onEnd = this.__onEnd; this.__onEnd = null; onEnd && onEnd(result); } __startNativeAnimation(animatedValue: AnimatedValue): void { animatedValue.__makeNative(); this.__nativeId = NativeAnimatedHelper.generateNewAnimationId(); NativeAnimatedAPI.startAnimatingNode( this.__nativeId, animatedValue.__getNativeTag(), this.__getNativeAnimationConfig(), this.__debouncedOnEnd.bind(this) ); } } class AnimatedWithChildren extends Animated { _children: Array<Animated>; constructor() { super(); this._children = []; } __makeNative() { if (!this.__isNative) { this.__isNative = true; for (var child of this._children) { child.__makeNative(); NativeAnimatedAPI.connectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag()); } } } __addChild(child: Animated): void { if (this._children.length === 0) { this.__attach(); } this._children.push(child); if (this.__isNative) { // Only accept "native" animated nodes as children child.__makeNative(); NativeAnimatedAPI.connectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag()); } } __removeChild(child: Animated): void { var index = this._children.indexOf(child); if (index === -1) { console.warn('Trying to remove a child that doesn\'t exist'); return; } if (this.__isNative && child.__isNative) { NativeAnimatedAPI.disconnectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag()); } this._children.splice(index, 1); if (this._children.length === 0) { this.__detach(); } } __getChildren(): Array<Animated> { return this._children; } } /** * Animated works by building a directed acyclic graph of dependencies * transparently when you render your Animated components. * * new Animated.Value(0) * .interpolate() .interpolate() new Animated.Value(1) * opacity translateY scale * style transform * View#234 style * View#123 * * A) Top Down phase * When an Animated.Value is updated, we recursively go down through this * graph in order to find leaf nodes: the views that we flag as needing * an update. * * B) Bottom Up phase * When a view is flagged as needing an update, we recursively go back up * in order to build the new value that it needs. The reason why we need * this two-phases process is to deal with composite props such as * transform which can receive values from multiple parents. */ function _flush(rootNode: AnimatedValue): void { var animatedStyles = new Set(); function findAnimatedStyles(node) { if (typeof node.update === 'function') { animatedStyles.add(node); } else { node.__getChildren().forEach(findAnimatedStyles); } } findAnimatedStyles(rootNode); /* $FlowFixMe */ animatedStyles.forEach(animatedStyle => animatedStyle.update()); } type TimingAnimationConfig = AnimationConfig & { toValue: number | AnimatedValue | {x: number, y: number} | AnimatedValueXY, easing?: (value: number) => number, duration?: number, delay?: number, }; type TimingAnimationConfigSingle = AnimationConfig & { toValue: number | AnimatedValue, easing?: (value: number) => number, duration?: number, delay?: number, }; let _easeInOut; function easeInOut() { if (!_easeInOut) { const Easing = require('Easing'); _easeInOut = Easing.inOut(Easing.ease); } return _easeInOut; } class TimingAnimation extends Animation { _startTime: number; _fromValue: number; _toValue: any; _duration: number; _delay: number; _easing: (value: number) => number; _onUpdate: (value: number) => void; _animationFrame: any; _timeout: any; _useNativeDriver: bool; constructor( config: TimingAnimationConfigSingle, ) { super(); this._toValue = config.toValue; this._easing = config.easing !== undefined ? config.easing : easeInOut(); this._duration = config.duration !== undefined ? config.duration : 500; this._delay = config.delay !== undefined ? config.delay : 0; this.__iterations = config.iterations !== undefined ? config.iterations : 1; this.__isInteraction = config.isInteraction !== undefined ? config.isInteraction : true; this._useNativeDriver = shouldUseNativeDriver(config); } __getNativeAnimationConfig(): any { var frameDuration = 1000.0 / 60.0; var frames = []; for (var dt = 0.0; dt < this._duration; dt += frameDuration) { frames.push(this._easing(dt / this._duration)); } frames.push(this._easing(1)); return { type: 'frames', frames, toValue: this._toValue, iterations: this.__iterations, }; } start( fromValue: number, onUpdate: (value: number) => void, onEnd: ?EndCallback, previousAnimation: ?Animation, animatedValue: AnimatedValue ): void { this.__active = true; this._fromValue = fromValue; this._onUpdate = onUpdate; this.__onEnd = onEnd; var start = () => { // Animations that sometimes have 0 duration and sometimes do not // still need to use the native driver when duration is 0 so as to // not cause intermixed JS and native animations. if (this._duration === 0 && !this._useNativeDriver) { this._onUpdate(this._toValue); this.__debouncedOnEnd({finished: true}); } else { this._startTime = Date.now(); if (this._useNativeDriver) { this.__startNativeAnimation(animatedValue); } else { this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this)); } } }; if (this._delay) { this._timeout = setTimeout(start, this._delay); } else { start(); } } onUpdate(): void { var now = Date.now(); if (now >= this._startTime + this._duration) { if (this._duration === 0) { this._onUpdate(this._toValue); } else { this._onUpdate( this._fromValue + this._easing(1) * (this._toValue - this._fromValue) ); } this.__debouncedOnEnd({finished: true}); return; } this._onUpdate( this._fromValue + this._easing((now - this._startTime) / this._duration) * (this._toValue - this._fromValue) ); if (this.__active) { this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this)); } } stop(): void { super.stop(); this.__active = false; clearTimeout(this._timeout); global.cancelAnimationFrame(this._animationFrame); this.__debouncedOnEnd({finished: false}); } } type DecayAnimationConfig = AnimationConfig & { velocity: number | {x: number, y: number}, deceleration?: number, }; type DecayAnimationConfigSingle = AnimationConfig & { velocity: number, deceleration?: number, }; class DecayAnimation extends Animation { _startTime: number; _lastValue: number; _fromValue: number; _deceleration: number; _velocity: number; _onUpdate: (value: number) => void; _animationFrame: any; _useNativeDriver: bool; constructor( config: DecayAnimationConfigSingle, ) { super(); this._deceleration = config.deceleration !== undefined ? config.deceleration : 0.998; this._velocity = config.velocity; this._useNativeDriver = shouldUseNativeDriver(config); this.__isInteraction = config.isInteraction !== undefined ? config.isInteraction : true; this.__iterations = config.iterations !== undefined ? config.iterations : 1; } __getNativeAnimationConfig() { return { type: 'decay', deceleration: this._deceleration, velocity: this._velocity, iterations: this.__iterations, }; } start( fromValue: number, onUpdate: (value: number) => void, onEnd: ?EndCallback, previousAnimation: ?Animation, animatedValue: AnimatedValue, ): void { this.__active = true; this._lastValue = fromValue; this._fromValue = fromValue; this._onUpdate = onUpdate; this.__onEnd = onEnd; this._startTime = Date.now(); if (this._useNativeDriver) { this.__startNativeAnimation(animatedValue); } else { this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this)); } } onUpdate(): void { var now = Date.now(); var value = this._fromValue + (this._velocity / (1 - this._deceleration)) * (1 - Math.exp(-(1 - this._deceleration) * (now - this._startTime))); this._onUpdate(value); if (Math.abs(this._lastValue - value) < 0.1) { this.__debouncedOnEnd({finished: true}); return; } this._lastValue = value; if (this.__active) { this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this)); } } stop(): void { super.stop(); this.__active = false; global.cancelAnimationFrame(this._animationFrame); this.__debouncedOnEnd({finished: false}); } } type SpringAnimationConfig = AnimationConfig & { toValue: number | AnimatedValue | {x: number, y: number} | AnimatedValueXY, overshootClamping?: bool, restDisplacementThreshold?: number, restSpeedThreshold?: number, velocity?: number | {x: number, y: number}, bounciness?: number, speed?: number, tension?: number, friction?: number, }; type SpringAnimationConfigSingle = AnimationConfig & { toValue: number | AnimatedValue, overshootClamping?: bool, restDisplacementThreshold?: number, restSpeedThreshold?: number, velocity?: number, bounciness?: number, speed?: number, tension?: number, friction?: number, }; function withDefault<T>(value: ?T, defaultValue: T): T { if (value === undefined || value === null) { return defaultValue; } return value; } class SpringAnimation extends Animation { _overshootClamping: bool; _restDisplacementThreshold: number; _restSpeedThreshold: number; _initialVelocity: ?number; _lastVelocity: number; _startPosition: number; _lastPosition: number; _fromValue: number; _toValue: any; _tension: number; _friction: number; _lastTime: number; _onUpdate: (value: number) => void; _animationFrame: any; _useNativeDriver: bool; constructor( config: SpringAnimationConfigSingle, ) { super(); this._overshootClamping = withDefault(config.overshootClamping, false); this._restDisplacementThreshold = withDefault(config.restDisplacementThreshold, 0.001); this._restSpeedThreshold = withDefault(config.restSpeedThreshold, 0.001); this._initialVelocity = config.velocity; this._lastVelocity = withDefault(config.velocity, 0); this._toValue = config.toValue; this._useNativeDriver = shouldUseNativeDriver(config); this.__isInteraction = config.isInteraction !== undefined ? config.isInteraction : true; this.__iterations = config.iterations !== undefined ? config.iterations : 1; var springConfig; if (config.bounciness !== undefined || config.speed !== undefined) { invariant( config.tension === undefined && config.friction === undefined, 'You can only define bounciness/speed or tension/friction but not both', ); springConfig = SpringConfig.fromBouncinessAndSpeed( withDefault(config.bounciness, 8), withDefault(config.speed, 12), ); } else { springConfig = SpringConfig.fromOrigamiTensionAndFriction( withDefault(config.tension, 40), withDefault(config.friction, 7), ); } this._tension = springConfig.tension; this._friction = springConfig.friction; } __getNativeAnimationConfig() { return { type: 'spring', overshootClamping: this._overshootClamping, restDisplacementThreshold: this._restDisplacementThreshold, restSpeedThreshold: this._restSpeedThreshold, tension: this._tension, friction: this._friction, initialVelocity: withDefault(this._initialVelocity, this._lastVelocity), toValue: this._toValue, iterations: this.__iterations, }; } start( fromValue: number, onUpdate: (value: number) => void, onEnd: ?EndCallback, previousAnimation: ?Animation, animatedValue: AnimatedValue ): void { this.__active = true; this._startPosition = fromValue; this._lastPosition = this._startPosition; this._onUpdate = onUpdate; this.__onEnd = onEnd; this._lastTime = Date.now(); if (previousAnimation instanceof SpringAnimation) { var internalState = previousAnimation.getInternalState(); this._lastPosition = internalState.lastPosition; this._lastVelocity = internalState.lastVelocity; this._lastTime = internalState.lastTime; } if (this._initialVelocity !== undefined && this._initialVelocity !== null) { this._lastVelocity = this._initialVelocity; } if (this._useNativeDriver) { this.__startNativeAnimation(animatedValue); } else { this.onUpdate(); } } getInternalState(): Object { return { lastPosition: this._lastPosition, lastVelocity: this._lastVelocity, lastTime: this._lastTime, }; } onUpdate(): void { var position = this._lastPosition; var velocity = this._lastVelocity; var tempPosition = this._lastPosition; var tempVelocity = this._lastVelocity; // If for some reason we lost a lot of frames (e.g. process large payload or // stopped in the debugger), we only advance by 4 frames worth of // computation and will continue on the next frame. It's better to have it // running at faster speed than jumping to the end. var MAX_STEPS = 64; var now = Date.now(); if (now > this._lastTime + MAX_STEPS) { now = this._lastTime + MAX_STEPS; } // We are using a fixed time step and a maximum number of iterations. // The following post provides a lot of thoughts into how to build this // loop: http://gafferongames.com/game-physics/fix-your-timestep/ var TIMESTEP_MSEC = 1; var numSteps = Math.floor((now - this._lastTime) / TIMESTEP_MSEC); for (var i = 0; i < numSteps; ++i) { // Velocity is based on seconds instead of milliseconds var step = TIMESTEP_MSEC / 1000; // This is using RK4. A good blog post to understand how it works: // http://gafferongames.com/game-physics/integration-basics/ var aVelocity = velocity; var aAcceleration = this._tension * (this._toValue - tempPosition) - this._friction * tempVelocity; var tempPosition = position + aVelocity * step / 2; var tempVelocity = velocity + aAcceleration * step / 2; var bVelocity = tempVelocity; var bAcceleration = this._tension * (this._toValue - tempPosition) - this._friction * tempVelocity; tempPosition = position + bVelocity * step / 2; tempVelocity = velocity + bAcceleration * step / 2; var cVelocity = tempVelocity; var cAcceleration = this._tension * (this._toValue - tempPosition) - this._friction * tempVelocity; tempPosition = position + cVelocity * step / 2; tempVelocity = velocity + cAcceleration * step / 2; var dVelocity = tempVelocity; var dAcceleration = this._tension * (this._toValue - tempPosition) - this._friction * tempVelocity; tempPosition = position + cVelocity * step / 2; tempVelocity = velocity + cAcceleration * step / 2; var dxdt = (aVelocity + 2 * (bVelocity + cVelocity) + dVelocity) / 6; var dvdt = (aAcceleration + 2 * (bAcceleration + cAcceleration) + dAcceleration) / 6; position += dxdt * step; velocity += dvdt * step; } this._lastTime = now; this._lastPosition = position; this._lastVelocity = velocity; this._onUpdate(position); if (!this.__active) { // a listener might have stopped us in _onUpdate return; } // Conditions for stopping the spring animation var isOvershooting = false; if (this._overshootClamping && this._tension !== 0) { if (this._startPosition < this._toValue) { isOvershooting = position > this._toValue; } else { isOvershooting = position < this._toValue; } } var isVelocity = Math.abs(velocity) <= this._restSpeedThreshold; var isDisplacement = true; if (this._tension !== 0) { isDisplacement = Math.abs(this._toValue - position) <= this._restDisplacementThreshold; } if (isOvershooting || (isVelocity && isDisplacement)) { if (this._tension !== 0) { // Ensure that we end up with a round value this._onUpdate(this._toValue); } this.__debouncedOnEnd({finished: true}); return; } this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this)); } stop(): void { super.stop(); this.__active = false; global.cancelAnimationFrame(this._animationFrame); this.__debouncedOnEnd({finished: false}); } } type ValueListenerCallback = (state: {value: number}) => void; var _uniqueId = 1; /** * Standard value for driving animations. One `Animated.Value` can drive * multiple properties in a synchronized fashion, but can only be driven by one * mechanism at a time. Using a new mechanism (e.g. starting a new animation, * or calling `setValue`) will stop any previous ones. */ class AnimatedValue extends AnimatedWithChildren { _value: number; _startingValue: number; _offset: number; _animation: ?Animation; _tracking: ?Animated; _listeners: {[key: string]: ValueListenerCallback}; __nativeAnimatedValueListener: ?any; constructor(value: number) { super(); this._startingValue = this._value = value; this._offset = 0; this._animation = null; this._listeners = {}; } __detach() { this.stopAnimation(); super.__detach(); } __getValue(): number { return this._value + this._offset; } __makeNative() { super.__makeNative(); if (Object.keys(this._listeners).length) { this._startListeningToNativeValueUpdates(); } } /** * Directly set the value. This will stop any animations running on the value * and update all the bound properties. */ setValue(value: number): void { if (this._animation) { this._animation.stop(); this._animation = null; } this._updateValue( value, !this.__isNative /* don't perform a flush for natively driven values */); if (this.__isNative) { NativeAnimatedAPI.setAnimatedNodeValue(this.__getNativeTag(), value); } } /** * Sets an offset that is applied on top of whatever value is set, whether via * `setValue`, an animation, or `Animated.event`. Useful for compensating * things like the start of a pan gesture. */ setOffset(offset: number): void { this._offset = offset; if (this.__isNative) { NativeAnimatedAPI.setAnimatedNodeOffset(this.__getNativeTag(), offset); } } /** * Merges the offset value into the base value and resets the offset to zero. * The final output of the value is unchanged. */ flattenOffset(): void { this._value += this._offset; this._offset = 0; if (this.__isNative) { NativeAnimatedAPI.flattenAnimatedNodeOffset(this.__getNativeTag()); } } /** * Sets the offset value to the base value, and resets the base value to zero. * The final output of the value is unchanged. */ extractOffset(): void { this._offset += this._value; this._value = 0; if (this.__isNative) { NativeAnimatedAPI.extractAnimatedNodeOffset(this.__getNativeTag()); } } /** * Adds an asynchronous listener to the value so you can observe updates from * animations. This is useful because there is no way to * synchronously read the value because it might be driven natively. */ addListener(callback: ValueListenerCallback): string { var id = String(_uniqueId++); this._listeners[id] = callback; if (this.__isNative) { this._startListeningToNativeValueUpdates(); } return id; } removeListener(id: string): void { delete this._listeners[id]; if (this.__isNative && Object.keys(this._listeners).length === 0) { this._stopListeningForNativeValueUpdates(); } } removeAllListeners(): void { this._listeners = {}; if (this.__isNative) { this._stopListeningForNativeValueUpdates(); } } _startListeningToNativeValueUpdates() { if (this.__nativeAnimatedValueListener) { return; } NativeAnimatedAPI.startListeningToAnimatedNodeValue(this.__getNativeTag()); this.__nativeAnimatedValueListener = NativeAnimatedHelper.nativeEventEmitter.addListener( 'onAnimatedValueUpdate', (data) => { if (data.tag !== this.__getNativeTag()) { return; } this._updateValue(data.value, false /* flush */); } ); } _stopListeningForNativeValueUpdates() { if (!this.__nativeAnimatedValueListener) { return; } this.__nativeAnimatedValueListener.remove(); this.__nativeAnimatedValueListener = null; NativeAnimatedAPI.stopListeningToAnimatedNodeValue(this.__getNativeTag()); } /** * Stops any running animation or tracking. `callback` is invoked with the * final value after stopping the animation, which is useful for updating * state to match the animation position with layout. */ stopAnimation(callback?: ?(value: number) => void): void { this.stopTracking(); this._animation && this._animation.stop(); this._animation = null; callback && callback(this.__getValue()); } /** * Stops any animation and resets the value to its original */ resetAnimation(callback?: ?(value: number) => void): void { this.stopAnimation(callback); this._value = this._startingValue; } /** * Interpolates the value before updating the property, e.g. mapping 0-1 to * 0-10. */ interpolate(config: InterpolationConfigType): AnimatedInterpolation { return new AnimatedInterpolation(this, config); } /** * Typically only used internally, but could be used by a custom Animation * class. */ animate(animation: Animation, callback: ?EndCallback): void { var handle = null; if (animation.__isInteraction) { handle = InteractionManager.createInteractionHandle(); } var previousAnimation = this._animation; this._animation && this._animation.stop(); this._animation = animation; animation.start( this._value, (value) => { // Natively driven animations will never call into that callback, therefore we can always // pass flush = true to allow the updated value to propagate to native with setNativeProps this._updateValue(value, true /* flush */); }, (result) => { this._animation = null; if (handle !== null) { InteractionManager.clearInteractionHandle(handle); } callback && callback(result); }, previousAnimation, this ); } /** * Typically only used internally. */ stopTracking(): void { this._tracking && this._tracking.__detach(); this._tracking = null; } /** * Typically only used internally. */ track(tracking: Animated): void { this.stopTracking(); this._tracking = tracking; } _updateValue(value: number, flush: bool): void { this._value = value; if (flush) { _flush(this); } for (var key in this._listeners) { this._listeners[key]({value: this.__getValue()}); } } __getNativeConfig(): Object { return { type: 'value', value: this._value, offset: this._offset, }; } } type ValueXYListenerCallback = (value: {x: number, y: number}) => void; /** * 2D Value for driving 2D animations, such as pan gestures. Almost identical * API to normal `Animated.Value`, but multiplexed. Contains two regular * `Animated.Value`s under the hood. * * #### Example * *```javascript * class DraggableView extends React.Component { * constructor(props) { * super(props); * this.state = { * pan: new Animated.ValueXY(), // inits to zero * }; * this.state.panResponder = PanResponder.create({ * onStartShouldSetPanResponder: () => true, * onPanResponderMove: Animated.event([null, { * dx: this.state.pan.x, // x,y are Animated.Value * dy: this.state.pan.y, * }]), * onPanResponderRelease: () => { * Animated.spring( * this.state.pan, // Auto-multiplexed * {toValue: {x: 0, y: 0}} // Back to zero * ).start(); * }, * }); * } * render() { * return ( * <Animated.View * {...this.state.panResponder.panHandlers} * style={this.state.pan.getLayout()}> * {this.props.children} * </Animated.View> * ); * } * } *``` */ class AnimatedValueXY extends AnimatedWithChildren { x: AnimatedValue; y: AnimatedValue; _listeners: {[key: string]: {x: string, y: string}}; constructor(valueIn?: ?{x: number | AnimatedValue, y: number | AnimatedValue}) { super(); var value: any = valueIn || {x: 0, y: 0}; // @flowfixme: shouldn't need `: any` if (typeof value.x === 'number' && typeof value.y === 'number') { this.x = new AnimatedValue(value.x); this.y = new AnimatedValue(value.y); } else { invariant( value.x instanceof AnimatedValue && value.y instanceof AnimatedValue, 'AnimatedValueXY must be initalized with an object of numbers or ' + 'AnimatedValues.' ); this.x = value.x; this.y = value.y; } this._listeners = {}; } setValue(value: {x: number, y: number}) { this.x.setValue(value.x); this.y.setValue(value.y); } setOffset(offset: {x: number, y: number}) { this.x.setOffset(offset.x); this.y.setOffset(offset.y); } flattenOffset(): void { this.x.flattenOffset(); this.y.flattenOffset(); } extractOffset(): void { this.x.extractOffset(); this.y.extractOffset(); } __getValue(): {x: number, y: number} { return { x: this.x.__getValue(), y: this.y.__getValue(), }; } resetAnimation(callback?: (value: {x: number, y: number}) => void): void { this.x.resetAnimation(); this.y.resetAnimation(); callback && callback(this.__getValue()); } stopAnimation(callback?: (value: {x: number, y: number}) => void): void { this.x.stopAnimation(); this.y.stopAnimation(); callback && callback(this.__getValue()); } addListener(callback: ValueXYListenerCallback): string { var id = String(_uniqueId++); var jointCallback = ({value: number}) => { callback(this.__getValue()); }; this._listeners[id] = { x: this.x.addListener(jointCallback), y: this.y.addListener(jointCallback), }; return id; } removeListener(id: string): void { this.x.removeListener(this._listeners[id].x); this.y.removeListener(this._listeners[id].y); delete this._listeners[id]; } removeAllListeners(): void { this.x.removeAllListeners(); this.y.removeAllListeners(); this._listeners = {}; } /** * Converts `{x, y}` into `{left, top}` for use in style, e.g. * *```javascript * style={this.state.anim.getLayout()} *``` */ getLayout(): {[key: string]: AnimatedValue} { return { left: this.x, top: this.y, }; } /** * Converts `{x, y}` into a useable translation transform, e.g. * *```javascript * style={{ * transform: this.state.anim.getTranslateTransform() * }} *``` */ getTranslateTransform(): Array<{[key: string]: AnimatedValue}> { return [ {translateX: this.x}, {translateY: this.y} ]; } } class AnimatedInterpolation extends AnimatedWithChildren { _parent: Animated; _config: InterpolationConfigType; _interpolation: (input: number) => number | string; constructor(parent: Animated, config: InterpolationConfigType) { super(); this._parent = parent; this._config = config; this._interpolation = Interpolation.create(config); } __getValue(): number | string { var parentValue: number = this._parent.__getValue(); invariant( typeof parentValue === 'number', 'Cannot interpolate an input which is not a number.' ); return this._interpolation(parentValue); } interpolate(config: InterpolationConfigType): AnimatedInterpolation { return new AnimatedInterpolation(this, config); } __attach(): void { this._parent.__addChild(this); } __detach(): void { this._parent.__removeChild(this); super.__detach(); } __transformDataType(range: Array<any>) { // Change the string array type to number array // So we can reuse the same logic in iOS and Android platform return range.map(function (value) { if (typeof value !== 'string') { return value; } if (/deg$/.test(value)) { const degrees = parseFloat(value, 10) || 0; const radians = degrees * Math.PI / 180.0; return radians; } else { // Assume radians return parseFloat(value, 10) || 0; } }); } __getNativeConfig(): any { if (__DEV__) { NativeAnimatedHelper.validateInterpolation(this._config); } return { inputRange: this._config.inputRange, // Only the `outputRange` can contain strings so we don't need to tranform `inputRange` here outputRange: this.__transformDataType(this._config.outputRange), extrapolateLeft: this._config.extrapolateLeft || this._config.extrapolate || 'extend', extrapolateRight: this._config.extrapolateRight || this._config.extrapolate || 'extend', type: 'interpolation', }; } } class AnimatedAddition extends AnimatedWithChildren { _a: Animated; _b: Animated; constructor(a: Animated | number, b: Animated | number) { super(); this._a = typeof a === 'number' ? new AnimatedValue(a) : a; this._b = typeof b === 'number' ? new AnimatedValue(b) : b; } __makeNative() { this._a.__makeNative(); this._b.__makeNative(); super.__makeNative(); } __getValue(): number { return this._a.__getValue() + this._b.__getValue(); } interpolate(config: InterpolationConfigType): AnimatedInterpolation { return new AnimatedInterpolation(this, config); } __attach(): void { this._a.__addChild(this); this._b.__addChild(this); } __detach(): void { this._a.__removeChild(this); this._b.__removeChild(this); super.__detach(); } __getNativeConfig(): any { return { type: 'addition', input: [this._a.__getNativeTag(), this._b.__getNativeTag()], }; } } class AnimatedDivision extends AnimatedWithChildren { _a: Animated; _b: Animated; constructor(a: Animated | number, b: Animated | number) { super(); this._a = typeof a === 'number' ? new AnimatedValue(a) : a; this._b = typeof b === 'number' ? new AnimatedValue(b) : b; } __makeNative() { super.__makeNative(); this._a.__makeNative(); this._b.__makeNative(); } __getValue(): number { const a = this._a.__getValue(); const b = this._b.__getValue(); if (b === 0) { console.error('Detected division by zero in AnimatedDivision'); } return a / b; } interpolate(config: InterpolationConfigType): AnimatedInterpolation { return new AnimatedInterpolation(this, config); } __attach(): void { this._a.__addChild(this); this._b.__addChild(this); } __detach(): void { this._a.__removeChild(this); this._b.__removeChild(this); super.__detach(); } __getNativeConfig(): any { return { type: 'division', input: [this._a.__getNativeTag(), this._b.__getNativeTag()], }; } } class AnimatedMultiplication extends AnimatedWithChildren { _a: Animated; _b: Animated; constructor(a: Animated | number, b: Animated | number) { super(); this._a = typeof a === 'number' ? new AnimatedValue(a) : a; this._b = typeof b === 'number' ? new AnimatedValue(b) : b; } __makeNative() { super.__makeNative(); this._a.__makeNative(); this._b.__makeNative(); } __getValue(): number { return this._a.__getValue() * this._b.__getValue(); } interpolate(config: InterpolationConfigType): AnimatedInterpolation { return new AnimatedInterpolation(this, config); } __attach(): void { this._a.__addChild(this); this._b.__addChild(this); } __detach(): void { this._a.__removeChild(this); this._b.__removeChild(this); super.__detach(); } __getNativeConfig(): any { return { type: 'multiplication', input: [this._a.__getNativeTag(), this._b.__getNativeTag()], }; } } class AnimatedModulo extends AnimatedWithChildren { _a: Animated; _modulus: number; constructor(a: Animated, modulus: number) { super(); this._a = a; this._modulus = modulus; } __makeNative() { super.__makeNative(); this._a.__makeNative(); } __getValue(): number { return (this._a.__getValue() % this._modulus + this._modulus) % this._modulus; } interpolate(config: InterpolationConfigType): AnimatedInterpolation { return new AnimatedInterpolation(this, config); } __attach(): void { this._a.__addChild(this); } __detach(): void { this._a.__removeChild(this); super.__detach(); } __getNativeConfig(): any { return { type: 'modulus', input: this._a.__getNativeTag(), modulus: this._modulus, }; } } class AnimatedDiffClamp extends AnimatedWithChildren { _a: Animated; _min: number; _max: number; _value: number; _lastValue: number; constructor(a: Animated, min: number, max: number) { super(); this._a = a; this._min = min; this._max = max; this._value = this._lastValue = this._a.__getValue(); } __makeNative() { super.__makeNative(); this._a.__makeNative(); } interpolate(config: InterpolationConfigType): AnimatedInterpolation { return new AnimatedInterpolation(this, config); } __getValue(): number { const value = this._a.__getValue(); const diff = value - this._lastValue; this._lastValue = value; this._value = Math.min(Math.max(this._value + diff, this._min), this._max); return this._value; } __attach(): void { this._a.__addChild(this); } __detach(): void { this._a.__removeChild(this); super.__detach(); } __getNativeConfig(): any { return { type: 'diffclamp', input: this._a.__getNativeTag(), min: this._min, max: this._max, }; } } class AnimatedTransform extends AnimatedWithChildren { _transforms: Array<Object>; constructor(transforms: Array<Object>) { super(); this._transforms = transforms; } __makeNative() { super.__makeNative(); this._transforms.forEach(transform => { for (var key in transform) { var value = transform[key]; if (value instanceof Animated) { value.__makeNative(); } } }); } __getValue(): Array<Object> { return this._transforms.map(transform => { var result = {}; for (var key in transform) { var value = transform[key]; if (value instanceof Animated) { result[key] = value.__getValue(); } else { result[key] = value; } } return result; }); } __getAnimatedValue(): Array<Object> { return this._transforms.map(transform => { var result = {}; for (var key in transform) { var value = transform[key]; if (value instanceof Animated) { result[key] = value.__getAnimatedValue(); } else { // All transform components needed to recompose matrix result[key] = value; } } return result; }); } __attach(): void { this._transforms.forEach(transform => { for (var key in transform) { var value = transform[key]; if (value instanceof Animated) { value.__addChild(this); } } }); } __detach(): void { this._transforms.forEach(transform => { for (var key in transform) { var value = transform[key]; if (value instanceof Animated) { value.__removeChild(this); } } }); super.__detach(); } __getNativeConfig(): any { var transConfigs = []; this._transforms.forEach(transform => { for (var key in transform) { var value = transform[key]; if (value instanceof Animated) { transConfigs.push({ type: 'animated', property: key, nodeTag: value.__getNativeTag(), }); } else { transConfigs.push({ type: 'static', property: key, value, }); } } }); NativeAnimatedHelper.validateTransform(transConfigs); return { type: 'transform', transforms: transConfigs, }; } } class AnimatedStyle extends AnimatedWithChildren { _style: Object; constructor(style: any) { super(); style = flattenStyle(style) || {}; if (style.transform) { style = { ...style, transform: new AnimatedTransform(style.transform), }; } this._style = style; } // Recursively get values for nested styles (like iOS's shadowOffset) __walkStyleAndGetValues(style) { const updatedStyle = {}; for (const key in style) { const value = style[key]; if (value instanceof Animated) { if (!value.__isNative) { // We cannot use value of natively driven nodes this way as the value we have access from // JS may not be up to date. updatedStyle[key] = value.__getValue(); } } else if (value && !Array.isArray(value) && typeof value === 'object') { // Support animating nested values (for example: shadowOffset.height) updatedStyle[key] = this.__walkStyleAndGetValues(value); } else { updatedStyle[key] = value; } } return updatedStyle; } __getValue(): Object { return this.__walkStyleAndGetValues(this._style); } // Recursively get animated values for nested styles (like iOS's shadowOffset) __walkStyleAndGetAnimatedValues(style) { const updatedStyle = {}; for (const key in style) { const value = style[key]; if (value instanceof Animated) { updatedStyle[key] = value.__getAnimatedValue(); } else if (value && !Array.isArray(value) && typeof value === 'object') { // Support animating nested values (for example: shadowOffset.height) updatedStyle[key] = this.__walkStyleAndGetAnimatedValues(value); } } return updatedStyle; } __getAnimatedValue(): Object { return this.__walkStyleAndGetAnimatedValues(this._style); } __attach(): void { for (var key in this._style) { var value = this._style[key]; if (value instanceof Animated) { value.__addChild(this); } } } __detach(): void { for (var key in this._style) { var value = this._style[key]; if (value instanceof Animated) { value.__removeChild(this); } } super.__detach(); } __makeNative() { super.__makeNative(); for (var key in this._style) { var value = this._style[key]; if (value instanceof Animated) { value.__makeNative(); } } } __getNativeConfig(): Object { var styleConfig = {}; for (const styleKey in this._style) { if (this._style[styleKey] instanceof Animated) { styleConfig[styleKey] = this._style[styleKey].__getNativeTag(); } // Non-animated styles are set using `setNativeProps`, no need // to pass those as a part of the node config } NativeAnimatedHelper.validateStyles(styleConfig); return { type: 'style', style: styleConfig, }; } } class AnimatedProps extends Animated { _props: Object; _animatedView: any; _callback: () => void; constructor( props: Object, callback: () => void, ) { super(); if (props.style) { props = { ...props, style: new AnimatedStyle(props.style), }; } this._props = props; this._callback = callback; this.__attach(); } __getValue(): Object { var props = {}; for (var key in this._props) { var value = this._props[key]; if (value instanceof Animated) { if (!value.__isNative || value instanceof AnimatedStyle) { // We cannot use value of natively driven nodes this way as the value we have access from // JS may not be up to date. props[key] = value.__getValue(); } } else if (value instanceof AnimatedEvent) { props[key] = value.__getHandler(); } else { props[key] = value; } } return props; } __getAnimatedValue(): Object { var props = {}; for (var key in this._props) { var value = this._props[key]; if (value instanceof Animated) { props[key] = value.__getAnimatedValue(); } } return props; } __attach(): void { for (var key in this._props) { var value = this._props[key]; if (value instanceof Animated) { value.__addChild(this); } } } __detach(): void { if (this.__isNative && this._animatedView) { this.__disconnectAnimatedView(); } for (var key in this._props) { var value = this._props[key]; if (value instanceof Animated) { value.__removeChild(this); } } super.__detach(); } update(): void { this._callback(); } __makeNative(): void { if (!this.__isNative) { this.__isNative = true; for (var key in this._props) { var value = this._props[key]; if (value instanceof Animated) { value.__makeNative(); } } if (this._animatedView) { this.__connectAnimatedView(); } } } setNativeView(animatedView: any): void { if (this._animatedView === animatedView) { return; } this._animatedView = animatedView; if (this.__isNative) { this.__connectAnimatedView(); } } __connectAnimatedView(): void { invariant(this.__isNative, 'Expected node to be marked as "native"'); var nativeViewTag: ?number = ReactNative.findNodeHandle(this._animatedView); invariant(nativeViewTag != null, 'Unable to locate attached view in the native tree'); NativeAnimatedAPI.connectAnimatedNodeToView(this.__getNativeTag(), nativeViewTag); } __disconnectAnimatedView(): void { invariant(this.__isNative, 'Expected node to be marked as "native"'); var nativeViewTag: ?number = ReactNative.findNodeHandle(this._animatedView); invariant(nativeViewTag != null, 'Unable to locate attached view in the native tree'); NativeAnimatedAPI.disconnectAnimatedNodeFromView(this.__getNativeTag(), nativeViewTag); } __getNativeConfig(): Object { var propsConfig = {}; for (const propKey in this._props) { var value = this._props[propKey]; if (value instanceof Animated) { propsConfig[propKey] = value.__getNativeTag(); } } return { type: 'props', props: propsConfig, }; } } function createAnimatedComponent(Component: any): any { class AnimatedComponent extends React.Component { _component: any; _prevComponent: any; _propsAnimated: AnimatedProps; _eventDetachers: Array<Function> = []; _setComponentRef: Function; constructor(props: Object) { super(props); this._setComponentRef = this._setComponentRef.bind(this); } componentWillUnmount() { this._propsAnimated && this._propsAnimated.__detach(); this._detachNativeEvents(); } setNativeProps(props) { this._component.setNativeProps(props); } componentWillMount() { this._attachProps(this.props); } componentDidMount() { this._propsAnimated.setNativeView(this._component); this._attachNativeEvents(); } _attachNativeEvents() { // Make sure to get the scrollable node for components that implement // `ScrollResponder.Mixin`. const scrollableNode = this._component.getScrollableNode ? this._component.getScrollableNode() : this._component; for (const key in this.props) { const prop = this.props[key]; if (prop instanceof AnimatedEvent && prop.__isNative) { prop.__attach(scrollableNode, key); this._eventDetachers.push(() => prop.__detach(scrollableNode, key)); } } } _detachNativeEvents() { this._eventDetachers.forEach(remove => remove()); this._eventDetachers = []; } _attachProps(nextProps) { var oldPropsAnimated = this._propsAnimated; // The system is best designed when setNativeProps is implemented. It is // able to avoid re-rendering and directly set the attributes that // changed. However, setNativeProps can only be implemented on leaf // native components. If you want to animate a composite component, you // need to re-render it. In this case, we have a fallback that uses // forceUpdate. var callback = () => { if (this._component.setNativeProps) { if (!this._propsAnimated.__isNative) { this._component.setNativeProps( this._propsAnimated.__getAnimatedValue() ); } else { throw new Error('Attempting to run JS driven animation on animated ' + 'node that has been moved to "native" earlier by starting an ' + 'animation with `useNativeDriver: true`'); } } else { this.forceUpdate(); } }; this._propsAnimated = new AnimatedProps( nextProps, callback, ); // When you call detach, it removes the element from the parent list // of children. If it goes to 0, then the parent also detaches itself // and so on. // An optimization is to attach the new elements and THEN detach the old // ones instead of detaching and THEN attaching. // This way the intermediate state isn't to go to 0 and trigger // this expensive recursive detaching to then re-attach everything on // the very next operation. oldPropsAnimated && oldPropsAnimated.__detach(); } componentWillReceiveProps(newProps) { this._attachProps(newProps); } componentDidUpdate(prevProps) { if (this._component !== this._prevComponent) { this._propsAnimated.setNativeView(this._component); } if (this._component !== this._prevComponent || prevProps !== this.props) { this._detachNativeEvents(); this._attachNativeEvents(); } } render() { return ( <Component {...this._propsAnimated.__getValue()} ref={this._setComponentRef} /> ); } _setComponentRef(c) { this._prevComponent = this._component; this._component = c; } // A third party library can use getNode() // to get the node reference of the decorated component getNode () { return this._component; } } // ReactNative `View.propTypes` have been deprecated in favor of // `ViewPropTypes`. In their place a temporary getter has been added with a // deprecated warning message. Avoid triggering that warning here by using // temporary workaround, __propTypesSecretDontUseThesePlease. // TODO (bvaughn) Revert this particular change any time after April 1 var propTypes = Component.__propTypesSecretDontUseThesePlease || Component.propTypes; AnimatedComponent.propTypes = { style: function(props, propName, componentName) { if (!propTypes) { return; } for (var key in ViewStylePropTypes) { if (!propTypes[key] && props[key] !== undefined) { console.warn( 'You are setting the style `{ ' + key + ': ... }` as a prop. You ' + 'should nest it in a style object. ' + 'E.g. `{ style: { ' + key + ': ... } }`' ); } } }, }; return AnimatedComponent; } class AnimatedTracking extends Animated { _value: AnimatedValue; _parent: Animated; _callback: ?EndCallback; _animationConfig: Object; _animationClass: any; constructor( value: AnimatedValue, parent: Animated, animationClass: any, animationConfig: Object, callback?: ?EndCallback, ) { super(); this._value = value; this._parent = parent; this._animationClass = animationClass; this._animationConfig = animationConfig; this._callback = callback; this.__attach(); } __getValue(): Object { return this._parent.__getValue(); } __attach(): void { this._parent.__addChild(this); } __detach(): void { this._parent.__removeChild(this); super.__detach(); } update(): void { this._value.animate(new this._animationClass({ ...this._animationConfig, toValue: (this._animationConfig.toValue: any).__getValue(), }), this._callback); } } type CompositeAnimation = { start: (callback?: ?EndCallback) => void, stop: () => void, reset: () => void, _startNativeLoop: (iterations?: number) => void, _isUsingNativeDriver: () => boolean, }; var add = function( a: Animated | number, b: Animated | number, ): AnimatedAddition { return new AnimatedAddition(a, b); }; var divide = function( a: Animated | number, b: Animated | number, ): AnimatedDivision { return new AnimatedDivision(a, b); }; var multiply = function( a: Animated | number, b: Animated | number, ): AnimatedMultiplication { return new AnimatedMultiplication(a, b); }; var modulo = function( a: Animated, modulus: number ): AnimatedModulo { return new AnimatedModulo(a, modulus); }; var diffClamp = function( a: Animated, min: number, max: number, ): AnimatedDiffClamp { return new AnimatedDiffClamp(a, min, max); }; const _combineCallbacks = function(callback: ?EndCallback, config : AnimationConfig) { if (callback && config.onComplete) { return (...args) => { config.onComplete && config.onComplete(...args); callback && callback(...args); }; } else { return callback || config.onComplete; } }; var maybeVectorAnim = function( value: AnimatedValue | AnimatedValueXY, config: Object, anim: (value: AnimatedValue, config: Object) => CompositeAnimation ): ?CompositeAnimation { if (value instanceof AnimatedValueXY) { var configX = {...config}; var configY = {...config}; for (var key in config) { var {x, y} = config[key]; if (x !== undefined && y !== undefined) { configX[key] = x; configY[key] = y; } } var aX = anim((value: AnimatedValueXY).x, configX); var aY = anim((value: AnimatedValueXY).y, configY); // We use `stopTogether: false` here because otherwise tracking will break // because the second animation will get stopped before it can update. return parallel([aX, aY], {stopTogether: false}); } return null; }; var spring = function( value: AnimatedValue | AnimatedValueXY, config: SpringAnimationConfig, ): CompositeAnimation { var start = function( animatedValue: AnimatedValue | AnimatedValueXY, configuration: SpringAnimationConfig, callback?: ?EndCallback): void { callback = _combineCallbacks(callback, configuration); var singleValue: any = animatedValue; var singleConfig: any = configuration; singleValue.stopTracking(); if (configuration.toValue instanceof Animated) { singleValue.track(new AnimatedTracking( singleValue, configuration.toValue, SpringAnimation, singleConfig, callback )); } else { singleValue.animate(new SpringAnimation(singleConfig), callback); } }; return maybeVectorAnim(value, config, spring) || { start: function(callback?: ?EndCallback): void { start(value, config, callback); }, stop: function(): void { value.stopAnimation(); }, reset: function(): void { value.resetAnimation(); }, _startNativeLoop: function(iterations?: number): void { var singleConfig = { ...config, iterations }; start(value, singleConfig); }, _isUsingNativeDriver: function(): boolean { return config.useNativeDriver || false; } }; }; var timing = function( value: AnimatedValue | AnimatedValueXY, config: TimingAnimationConfig, ): CompositeAnimation { var start = function( animatedValue: AnimatedValue | AnimatedValueXY, configuration: TimingAnimationConfig, callback?: ?EndCallback): void { callback = _combineCallbacks(callback, configuration); var singleValue: any = animatedValue; var singleConfig: any = configuration; singleValue.stopTracking(); if (configuration.toValue instanceof Animated) { singleValue.track(new AnimatedTracking( singleValue, configuration.toValue, TimingAnimation, singleConfig, callback )); } else { singleValue.animate(new TimingAnimation(singleConfig), callback); } }; return maybeVectorAnim(value, config, timing) || { start: function(callback?: ?EndCallback): void { start(value, config, callback); }, stop: function(): void { value.stopAnimation(); }, reset: function(): void { value.resetAnimation(); }, _startNativeLoop: function(iterations?: number): void { var singleConfig = { ...config, iterations }; start(value, singleConfig); }, _isUsingNativeDriver: function(): boolean { return config.useNativeDriver || false; } }; }; var decay = function( value: AnimatedValue | AnimatedValueXY, config: DecayAnimationConfig, ): CompositeAnimation { var start = function( animatedValue: AnimatedValue | AnimatedValueXY, configuration: DecayAnimationConfig, callback?: ?EndCallback): void { callback = _combineCallbacks(callback, configuration); var singleValue: any = animatedValue; var singleConfig: any = configuration; singleValue.stopTracking(); singleValue.animate(new DecayAnimation(singleConfig), callback); }; return maybeVectorAnim(value, config, decay) || { start: function(callback?: ?EndCallback): void { start(value, config, callback); }, stop: function(): void { value.stopAnimation(); }, reset: function(): void { value.resetAnimation(); }, _startNativeLoop: function(iterations?: number): void { var singleConfig = { ...config, iterations }; start(value, singleConfig); }, _isUsingNativeDriver: function(): boolean { return config.useNativeDriver || false; } }; }; var sequence = function( animations: Array<CompositeAnimation>, ): CompositeAnimation { var current = 0; return { start: function(callback?: ?EndCallback) { var onComplete = function(result) { if (!result.finished) { callback && callback(result); return; } current++; if (current === animations.length) { callback && callback(result); return; } animations[current].start(onComplete); }; if (animations.length === 0) { callback && callback({finished: true}); } else { animations[current].start(onComplete); } }, stop: function() { if (current < animations.length) { animations[current].stop(); } }, reset: function() { animations.forEach((animation, idx) => { if (idx <= current) { animation.reset(); } }); current = 0; }, _startNativeLoop: function() { throw new Error('Loops run using the native driver cannot contain Animated.sequence animations'); }, _isUsingNativeDriver: function(): boolean { return false; } }; }; type ParallelConfig = { stopTogether?: bool, // If one is stopped, stop all. default: true } var parallel = function( animations: Array<CompositeAnimation>, config?: ?ParallelConfig, ): CompositeAnimation { var doneCount = 0; // Make sure we only call stop() at most once for each animation var hasEnded = {}; var stopTogether = !(config && config.stopTogether === false); var result = { start: function(callback?: ?EndCallback) { if (doneCount === animations.length) { callback && callback({finished: true}); return; } animations.forEach((animation, idx) => { var cb = function(endResult) { hasEnded[idx] = true; doneCount++; if (doneCount === animations.length) { doneCount = 0; callback && callback(endResult); return; } if (!endResult.finished && stopTogether) { result.stop(); } }; if (!animation) { cb({finished: true}); } else { animation.start(cb); } }); }, stop: function(): void { animations.forEach((animation, idx) => { !hasEnded[idx] && animation.stop(); hasEnded[idx] = true; }); }, reset: function(): void { animations.forEach((animation, idx) => { animation.reset(); hasEnded[idx] = false; doneCount = 0; }); }, _startNativeLoop: function() { throw new Error('Loops run using the native driver cannot contain Animated.parallel animations'); }, _isUsingNativeDriver: function(): boolean { return false; } }; return result; }; var delay = function(time: number): CompositeAnimation { // Would be nice to make a specialized implementation return timing(new AnimatedValue(0), {toValue: 0, delay: time, duration: 0}); }; var stagger = function( time: number, animations: Array<CompositeAnimation>, ): CompositeAnimation { return parallel(animations.map((animation, i) => { return sequence([ delay(time * i), animation, ]); })); }; type LoopAnimationConfig = { iterations: number }; var loop = function( animation: CompositeAnimation, { iterations = -1 }: LoopAnimationConfig = {}, ): CompositeAnimation { var isFinished = false; var iterationsSoFar = 0; return { start: function(callback?: ?EndCallback) { var restart = function(result: EndResult = {finished: true}): void { if (isFinished || (iterationsSoFar === iterations) || (result.finished === false)) { callback && callback(result); } else { iterationsSoFar++; animation.reset(); animation.start(restart); } }; if (!animation || iterations === 0) { callback && callback({finished: true}); } else { if (animation._isUsingNativeDriver()) { animation._startNativeLoop(iterations); } else { restart(); // Start looping recursively on the js thread } } }, stop: function(): void { isFinished = true; animation.stop(); }, reset: function(): void { iterationsSoFar = 0; isFinished = false; animation.reset(); }, _startNativeLoop: function() { throw new Error('Loops run using the native driver cannot contain Animated.loop animations'); }, _isUsingNativeDriver: function(): boolean { return animation._isUsingNativeDriver(); } }; }; type Mapping = {[key: string]: Mapping} | AnimatedValue; type EventConfig = { listener?: ?Function, useNativeDriver?: bool, }; function attachNativeEvent(viewRef: any, eventName: string, argMapping: Array<?Mapping>) { // Find animated values in `argMapping` and create an array representing their // key path inside the `nativeEvent` object. Ex.: ['contentOffset', 'x']. const eventMappings = []; const traverse = (value, path) => { if (value instanceof AnimatedValue) { value.__makeNative(); eventMappings.push({ nativeEventPath: path, animatedValueTag: value.__getNativeTag(), }); } else if (typeof value === 'object') { for (const key in value) { traverse(value[key], path.concat(key)); } } }; invariant( argMapping[0] && argMapping[0].nativeEvent, 'Native driven events only support animated values contained inside `nativeEvent`.' ); // Assume that the event containing `nativeEvent` is always the first argument. traverse(argMapping[0].nativeEvent, []); const viewTag = ReactNative.findNodeHandle(viewRef); eventMappings.forEach((mapping) => { NativeAnimatedAPI.addAnimatedEventToView(viewTag, eventName, mapping); }); return { detach() { eventMappings.forEach((mapping) => { NativeAnimatedAPI.removeAnimatedEventFromView( viewTag, eventName, mapping.animatedValueTag, ); }); }, }; } function forkEvent(event: ?AnimatedEvent | ?Function, listener: Function): AnimatedEvent | Function { if (!event) { return listener; } else if (event instanceof AnimatedEvent) { event.__addListener(listener); return event; } else { return (...args) => { typeof event === 'function' && event(...args); listener(...args); }; } } function unforkEvent(event: ?AnimatedEvent | ?Function, listener: Function): void { if (event && event instanceof AnimatedEvent) { event.__removeListener(listener); } } class AnimatedEvent { _argMapping: Array<?Mapping>; _listeners: Array<Function> = []; _callListeners: Function; _attachedEvent: ?{ detach: () => void, }; __isNative: bool; constructor( argMapping: Array<?Mapping>, config?: EventConfig = {} ) { this._argMapping = argMapping; if (config.listener) { this.__addListener(config.listener); } this._callListeners = this._callListeners.bind(this); this._attachedEvent = null; this.__isNative = shouldUseNativeDriver(config); if (__DEV__) { this._validateMapping(); } } __addListener(callback: Function): void { this._listeners.push(callback); } __removeListener(callback: Function): void { this._listeners = this._listeners.filter((listener) => listener !== callback); } __attach(viewRef, eventName) { invariant(this.__isNative, 'Only native driven events need to be attached.'); this._attachedEvent = attachNativeEvent(viewRef, eventName, this._argMapping); } __detach(viewTag, eventName) { invariant(this.__isNative, 'Only native driven events need to be detached.'); this._attachedEvent && this._attachedEvent.detach(); } __getHandler() { if (this.__isNative) { return this._callListeners; } return (...args) => { const traverse = (recMapping, recEvt, key) => { if (typeof recEvt === 'number' && recMapping instanceof AnimatedValue) { recMapping.setValue(recEvt); } else if (typeof recMapping === 'object') { for (const mappingKey in recMapping) { traverse(recMapping[mappingKey], recEvt[mappingKey], mappingKey); } } }; if (!this.__isNative) { this._argMapping.forEach((mapping, idx) => { traverse(mapping, args[idx], 'arg' + idx); }); } this._callListeners(...args); }; } _callListeners(...args) { this._listeners.forEach(listener => listener(...args)); } _validateMapping() { const traverse = (recMapping, recEvt, key) => { if (typeof recEvt === 'number') { invariant( recMapping instanceof AnimatedValue, 'Bad mapping of type ' + typeof recMapping + ' for key ' + key + ', event value must map to AnimatedValue' ); return; } invariant( typeof recMapping === 'object', 'Bad mapping of type ' + typeof recMapping + ' for key ' + key ); invariant( typeof recEvt === 'object', 'Bad event of type ' + typeof recEvt + ' for key ' + key ); for (const mappingKey in recMapping) { traverse(recMapping[mappingKey], recEvt[mappingKey], mappingKey); } }; } } var event = function( argMapping: Array<?Mapping>, config?: EventConfig, ): any { const animatedEvent = new AnimatedEvent(argMapping, config); if (animatedEvent.__isNative) { return animatedEvent; } else { return animatedEvent.__getHandler(); } }; /** * The `Animated` library is designed to make animations fluid, powerful, and * easy to build and maintain. `Animated` focuses on declarative relationships * between inputs and outputs, with configurable transforms in between, and * simple `start`/`stop` methods to control time-based animation execution. * * The simplest workflow for creating an animation is to to create an * `Animated.Value`, hook it up to one or more style attributes of an animated * component, and then drive updates via animations using `Animated.timing()`: * * ```javascript * Animated.timing( // Animate value over time * this.state.fadeAnim, // The value to drive * { * toValue: 1, // Animate to final value of 1 * } * ).start(); // Start the animation * ``` * * Refer to the [Animations](docs/animations.html#animated-api) guide to see * additional examples of `Animated` in action. * * ## Overview * * There are two value types you can use with `Animated`: * * - [`Animated.Value()`](docs/animated.html#value) for single values * - [`Animated.ValueXY()`](docs/animated.html#valuexy) for vectors * * `Animated.Value` can bind to style properties or other props, and can be * interpolated as well. A single `Animated.Value` can drive any number of * properties. * * ### Configuring animations * * `Animated` provides three types of animation types. Each animation type * provides a particular animation curve that controls how your values animate * from their initial value to the final value: * * - [`Animated.decay()`](docs/animated.html#decay) starts with an initial * velocity and gradually slows to a stop. * - [`Animated.spring()`](docs/animated.html#spring) provides a simple * spring physics model. * - [`Animated.timing()`](docs/animated.html#timing) animates a value over time * using [easing functions](docs/easing.html). * * In most cases, you will be using `timing()`. By default, it uses a symmetric * easeInOut curve that conveys the gradual acceleration of an object to full * speed and concludes by gradually decelerating to a stop. * * ### Working with animations * * Animations are started by calling `start()` on your animation. `start()` * takes a completion callback that will be called when the animation is done. * If the animation finished running normally, the completion callback will be * invoked with `{finished: true}`. If the animation is done because `stop()` * was called on it before it could finish (e.g. because it was interrupted by a * gesture or another animation), then it will receive `{finished: false}`. * * ### Using the native driver * * By using the native driver, we send everything about the animation to native * before starting the animation, allowing native code to perform the animation * on the UI thread without having to go through the bridge on every frame. * Once the animation has started, the JS thread can be blocked without * affecting the animation. * * You can use the native driver by specifying `useNativeDriver: true` in your * animation configuration. See the * [Animations](docs/animations.html#using-the-native-driver) guide to learn * more. * * ### Animatable components * * Only animatable components can be animated. These special components do the * magic of binding the animated values to the properties, and do targeted * native updates to avoid the cost of the react render and reconciliation * process on every frame. They also handle cleanup on unmount so they are safe * by default. * * - [`createAnimatedComponent()`](docs/animated.html#createanimatedcomponent) * can be used to make a component animatable. * * `Animated` exports the following animatable components using the above * wrapper: * * - `Animated.Image` * - `Animated.ScrollView` * - `Animated.Text` * - `Animated.View` * * ### Composing animations * * Animations can also be combined in complex ways using composition functions: * * - [`Animated.delay()`](docs/animated.html#delay) starts an animation after * a given delay. * - [`Animated.parallel()`](docs/animated.html#parallel) starts a number of * animations at the same time. * - [`Animated.sequence()`](docs/animated.html#sequence) starts the animations * in order, waiting for each to complete before starting the next. * - [`Animated.stagger()`](docs/animated.html#stagger) starts animations in * order and in parallel, but with successive delays. * * Animations can also be chained together simply by setting the `toValue` of * one animation to be another `Animated.Value`. See * [Tracking dynamic values](docs/animations.html#tracking-dynamic-values) in * the Animations guide. * * By default, if one animation is stopped or interrupted, then all other * animations in the group are also stopped. * * ### Combining animated values * * You can combine two animated values via addition, multiplication, division, * or modulo to make a new animated value: * * - [`Animated.add()`](docs/animated.html#add) * - [`Animated.divide()`](docs/animated.html#divide) * - [`Animated.modulo()`](docs/animated.html#modulo) * - [`Animated.multiply()`](docs/animated.html#multiply) * * ### Interpolation * * The `interpolate()` function allows input ranges to map to different output * ranges. By default, it will extrapolate the curve beyond the ranges given, * but you can also have it clamp the output value. It uses lineal interpolation * by default but also supports easing functions. * * - [`interpolate()`](docs/animated.html#interpolate) * * Read more about interpolation in the * [Animation](docs/animations.html#interpolation) guide. * * ### Handling gestures and other events * * Gestures, like panning or scrolling, and other events can map directly to * animated values using `Animated.event()`. This is done with a structured map * syntax so that values can be extracted from complex event objects. The first * level is an array to allow mapping across multiple args, and that array * contains nested objects. * * - [`Animated.event()`](docs/animated.html#event) * * For example, when working with horizontal scrolling gestures, you would do * the following in order to map `event.nativeEvent.contentOffset.x` to * `scrollX` (an `Animated.Value`): * * ```javascript * onScroll={Animated.event( * // scrollX = e.nativeEvent.contentOffset.x * [{ nativeEvent: { * contentOffset: { * x: scrollX * } * } * }] * )} * ``` * */ module.exports = { /** * Standard value class for driving animations. Typically initialized with * `new Animated.Value(0);` * * See also [`AnimatedValue`](docs/animated.html#animatedvalue). */ Value: AnimatedValue, /** * 2D value class for driving 2D animations, such as pan gestures. * * See also [`AnimatedValueXY`](docs/animated.html#animatedvaluexy). */ ValueXY: AnimatedValueXY, /** * exported to use the Interpolation type in flow * * See also [`AnimatedInterpolation`](docs/animated.html#animatedinterpolation). */ Interpolation: AnimatedInterpolation, /** * Animates a value from an initial velocity to zero based on a decay * coefficient. * * Config is an object that may have the following options: * * - `velocity`: Initial velocity. Required. * - `deceleration`: Rate of decay. Default 0.997. * - `useNativeDriver`: Uses the native driver when true. Default false. */ decay, /** * Animates a value along a timed easing curve. The * [`Easing`](docs/easing.html) module has tons of predefined curves, or you * can use your own function. * * Config is an object that may have the following options: * * - `duration`: Length of animation (milliseconds). Default 500. * - `easing`: Easing function to define curve. * Default is `Easing.inOut(Easing.ease)`. * - `delay`: Start the animation after delay (milliseconds). Default 0. * - `useNativeDriver`: Uses the native driver when true. Default false. */ timing, /** * Spring animation based on Rebound and * [Origami](https://facebook.github.io/origami/). Tracks velocity state to * create fluid motions as the `toValue` updates, and can be chained together. * * Config is an object that may have the following options: * * - `friction`: Controls "bounciness"/overshoot. Default 7. * - `tension`: Controls speed. Default 40. * - `useNativeDriver`: Uses the native driver when true. Default false. */ spring, /** * Creates a new Animated value composed from two Animated values added * together. */ add, /** * Creates a new Animated value composed by dividing the first Animated value * by the second Animated value. */ divide, /** * Creates a new Animated value composed from two Animated values multiplied * together. */ multiply, /** * Creates a new Animated value that is the (non-negative) modulo of the * provided Animated value */ modulo, /** * Create a new Animated value that is limited between 2 values. It uses the * difference between the last value so even if the value is far from the bounds * it will start changing when the value starts getting closer again. * (`value = clamp(value + diff, min, max)`). * * This is useful with scroll events, for example, to show the navbar when * scrolling up and to hide it when scrolling down. */ diffClamp, /** * Starts an animation after the given delay. */ delay, /** * Starts an array of animations in order, waiting for each to complete * before starting the next. If the current running animation is stopped, no * following animations will be started. */ sequence, /** * Starts an array of animations all at the same time. By default, if one * of the animations is stopped, they will all be stopped. You can override * this with the `stopTogether` flag. */ parallel, /** * Array of animations may run in parallel (overlap), but are started in * sequence with successive delays. Nice for doing trailing effects. */ stagger, /** * Loops a given animation continuously, so that each time it reaches the * end, it resets and begins again from the start. Can specify number of * times to loop using the key 'iterations' in the config. Will loop without * blocking the UI thread if the child animation is set to 'useNativeDriver'. */ loop, /** * Takes an array of mappings and extracts values from each arg accordingly, * then calls `setValue` on the mapped outputs. e.g. * *```javascript * onScroll={Animated.event( * [{nativeEvent: {contentOffset: {x: this._scrollX}}}] * {listener}, // Optional async listener * ) * ... * onPanResponderMove: Animated.event([ * null, // raw event arg ignored * {dx: this._panX}, // gestureState arg * ]), *``` * * Config is an object that may have the following options: * * - `listener`: Optional async listener. * - `useNativeDriver`: Uses the native driver when true. Default false. */ event, /** * Make any React component Animatable. Used to create `Animated.View`, etc. */ createAnimatedComponent, /** * Imperative API to attach an animated value to an event on a view. Prefer using * `Animated.event` with `useNativeDrive: true` if possible. */ attachNativeEvent, /** * Advanced imperative API for snooping on animated events that are passed in through props. Use * values directly where possible. */ forkEvent, unforkEvent, __PropsOnlyForTests: AnimatedProps, };
assets/js/libs/jquery.min.js
benja2729/ember-calendar-app
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license //@ sourceMappingURL=jquery.min.map */ (function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t }({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle); u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
src/homepage/welcome_calendar.js
MichalKononenko/OmicronClient
/** * Created by Michal on 2016-04-04. */ import React from 'react'; import {Glyphicon, Panel} from 'react-bootstrap'; import {connect} from 'react-redux'; import BigCalendar from 'react-big-calendar'; import moment from 'moment'; import Reducer, {reducer_factory} from '../reducer'; import 'react-big-calendar/lib/css/react-big-calendar.css'; import 'react-big-calendar/lib/less/styles.less'; import '../../static/css/home_page/home_page.css'; BigCalendar.momentLocalizer(moment); export const CalendarTemplate = ({date, view, events, on_select_event}) => ( <Panel className="homepage_calendar"> <BigCalendar defaultDate={date} defaultView={view} onSelectEvent={on_select_event} events={events} /> </Panel> ); CalendarTemplate.propTypes = { date: React.PropTypes.instanceOf(Date).isRequired, view: React.PropTypes.oneOf(['day', 'month', 'week', 'agenda']), events: React.PropTypes.arrayOf( React.PropTypes.shape({ title: React.PropTypes.string.isRequired, allDay: React.PropTypes.bool.isRequired, start: React.PropTypes.instanceOf(Date).isRequired, end: React.PropTypes.instanceOf(Date).isRequired }) ).isRequired, on_select_event: React.PropTypes.func.isRequired }; export const map_calendar_state_to_props = (state) => { let events_from_state = state.home_page.events; for(let i = 0; i < events_from_state.length; i++){ events_from_state[i].start = new Date(events_from_state[i].start); events_from_state[i].end = new Date(events_from_state[i].end); } return( { date: new Date(state.home_page.selected_date), view: state.home_page.calendar_mode, events: events_from_state } )}; export const map_dispatch_to_props = (dispatch) => ({ on_select_event: (event) => {dispatch(event_selected(event))} }); export const EVENT_SELECTED = "EVENT_SELECTED"; export const event_selected = (event) => ({ type: EVENT_SELECTED, event: event }); export const event_selected_reducer = (state, action) => { state.home_page.selected_event = action.event; }; Reducer.register(reducer_factory(EVENT_SELECTED)(event_selected_reducer)); const Calendar = connect(map_calendar_state_to_props, map_dispatch_to_props)( CalendarTemplate); export default Calendar;
app/articleView.js
Goodly/TextThresher
import React from 'react'; import { render } from 'react-dom'; import { bindActionCreators } from 'redux'; let debug = require('debug')('thresher:articleView'); import App, { store } from 'containers/App'; import { ArticleView } from 'containers/ArticleView'; import * as articleViewActions from 'actions/articleView'; import fetchArticleView from 'django/articleView'; let reduxActions = bindActionCreators(articleViewActions, store.dispatch); try { render( <App> <ArticleView> <div>Loading...</div> </ArticleView> </App>, document.getElementById('react-root') ); } catch (error) { reduxActions.errorArticleView(error); }; // This function is called with the URL of the API endpoint // by the Django page hosting this script. export function loadArticle(articleFetchURL) { debug(`Fetching: ${articleFetchURL}`); fetchArticleView(reduxActions, articleFetchURL); };
ressources/components/Gtag.js
mscodemonkey/Sketch-Find-And-Replace
import React from 'react' import styled from 'styled-components' const GtagContainer = styled.div` position: absolute; bottom: 0; right: 0; ` const Gtag = () => { return <GtagContainer> <img style={{ opacity: 0.1 }} src="https://www.google-analytics.com/collect?v=1&tid=UA-37385154-1&cid=555&aip=1&t=event&ec=plugin&ea=help&dp=%2FFindAndReplace&dt=FindAndReplace" /> </GtagContainer> } export default Gtag
ajax/libs/jquery-mobile/1.4.0/jquery.mobile.js
magoni/cdnjs
/*! * jQuery Mobile 1.4.0 * Git HEAD hash: f09aae0e035d6805e461a7be246d04a0dbc98f69 <> Date: Thu Dec 19 2013 17:34:22 UTC * http://jquerymobile.com * * Copyright 2010, 2013 jQuery Foundation, Inc. and other contributors * Released under the MIT license. * http://jquery.org/license * */ (function ( root, doc, factory ) { if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. define( [ "jquery" ], function ( $ ) { factory( $, root, doc ); return $.mobile; }); } else { // Browser globals factory( root.jQuery, root, doc ); } }( this, document, function ( jQuery, window, document, undefined ) { (function( $ ) { $.mobile = {}; }( jQuery )); (function( $, window, undefined ) { $.extend( $.mobile, { // Version of the jQuery Mobile Framework version: "1.4.0", // Deprecated and no longer used in 1.4 remove in 1.5 // Define the url parameter used for referencing widget-generated sub-pages. // Translates to example.html&ui-page=subpageIdentifier // hash segment before &ui-page= is used to make Ajax request subPageUrlKey: "ui-page", hideUrlBar: true, // Keepnative Selector keepNative: ":jqmData(role='none'), :jqmData(role='nojs')", // Deprecated in 1.4 remove in 1.5 // Class assigned to page currently in view, and during transitions activePageClass: "ui-page-active", // Deprecated in 1.4 remove in 1.5 // Class used for "active" button state, from CSS framework activeBtnClass: "ui-btn-active", // Deprecated in 1.4 remove in 1.5 // Class used for "focus" form element state, from CSS framework focusClass: "ui-focus", // Automatically handle clicks and form submissions through Ajax, when same-domain ajaxEnabled: true, // Automatically load and show pages based on location.hash hashListeningEnabled: true, // disable to prevent jquery from bothering with links linkBindingEnabled: true, // Set default page transition - 'none' for no transitions defaultPageTransition: "fade", // Set maximum window width for transitions to apply - 'false' for no limit maxTransitionWidth: false, // Minimum scroll distance that will be remembered when returning to a page // Deprecated remove in 1.5 minScrollBack: 0, // Set default dialog transition - 'none' for no transitions defaultDialogTransition: "pop", // Error response message - appears when an Ajax page request fails pageLoadErrorMessage: "Error Loading Page", // For error messages, which theme does the box uses? pageLoadErrorMessageTheme: "a", // replace calls to window.history.back with phonegaps navigation helper // where it is provided on the window object phonegapNavigationEnabled: false, //automatically initialize the DOM when it's ready autoInitializePage: true, pushStateEnabled: true, // allows users to opt in to ignoring content by marking a parent element as // data-ignored ignoreContentEnabled: false, buttonMarkup: { hoverDelay: 200 }, // disable the alteration of the dynamic base tag or links in the case // that a dynamic base tag isn't supported dynamicBaseEnabled: true, // default the property to remove dependency on assignment in init module pageContainer: $(), //enable cross-domain page support allowCrossDomainPages: false, dialogHashKey: "&ui-state=dialog" }); })( jQuery, this ); (function( $, window, undefined ) { var nsNormalizeDict = {}, oldFind = $.find, rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, jqmDataRE = /:jqmData\(([^)]*)\)/g; $.extend( $.mobile, { // Namespace used framework-wide for data-attrs. Default is no namespace ns: "", // Retrieve an attribute from an element and perform some massaging of the value getAttribute: function( element, key ) { var data; element = element.jquery ? element[0] : element; if ( element && element.getAttribute ) { data = element.getAttribute( "data-" + $.mobile.ns + key ); } // Copied from core's src/data.js:dataAttr() // Convert from a string to a proper data type try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? JSON.parse( data ) : data; } catch( err ) {} return data; }, // Expose our cache for testing purposes. nsNormalizeDict: nsNormalizeDict, // Take a data attribute property, prepend the namespace // and then camel case the attribute string. Add the result // to our nsNormalizeDict so we don't have to do this again. nsNormalize: function( prop ) { return nsNormalizeDict[ prop ] || ( nsNormalizeDict[ prop ] = $.camelCase( $.mobile.ns + prop ) ); }, // Find the closest javascript page element to gather settings data jsperf test // http://jsperf.com/single-complex-selector-vs-many-complex-selectors/edit // possibly naive, but it shows that the parsing overhead for *just* the page selector vs // the page and dialog selector is negligable. This could probably be speed up by // doing a similar parent node traversal to the one found in the inherited theme code above closestPageData: function( $target ) { return $target .closest( ":jqmData(role='page'), :jqmData(role='dialog')" ) .data( "mobile-page" ); } }); // Mobile version of data and removeData and hasData methods // ensures all data is set and retrieved using jQuery Mobile's data namespace $.fn.jqmData = function( prop, value ) { var result; if ( typeof prop !== "undefined" ) { if ( prop ) { prop = $.mobile.nsNormalize( prop ); } // undefined is permitted as an explicit input for the second param // in this case it returns the value and does not set it to undefined if ( arguments.length < 2 || value === undefined ) { result = this.data( prop ); } else { result = this.data( prop, value ); } } return result; }; $.jqmData = function( elem, prop, value ) { var result; if ( typeof prop !== "undefined" ) { result = $.data( elem, prop ? $.mobile.nsNormalize( prop ) : prop, value ); } return result; }; $.fn.jqmRemoveData = function( prop ) { return this.removeData( $.mobile.nsNormalize( prop ) ); }; $.jqmRemoveData = function( elem, prop ) { return $.removeData( elem, $.mobile.nsNormalize( prop ) ); }; $.find = function( selector, context, ret, extra ) { if ( selector.indexOf( ":jqmData" ) > -1 ) { selector = selector.replace( jqmDataRE, "[data-" + ( $.mobile.ns || "" ) + "$1]" ); } return oldFind.call( this, selector, context, ret, extra ); }; $.extend( $.find, oldFind ); })( jQuery, this ); /*! * jQuery UI Core c0ab71056b936627e8a7821f03c044aec6280a40 * http://jqueryui.com * * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/category/ui-core/ */ (function( $, undefined ) { var uuid = 0, runiqueId = /^ui-id-\d+$/; // $.ui might exist from components with no dependencies, e.g., $.ui.position $.ui = $.ui || {}; $.extend( $.ui, { version: "c0ab71056b936627e8a7821f03c044aec6280a40", keyCode: { BACKSPACE: 8, COMMA: 188, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, LEFT: 37, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SPACE: 32, TAB: 9, UP: 38 } }); // plugins $.fn.extend({ focus: (function( orig ) { return function( delay, fn ) { return typeof delay === "number" ? this.each(function() { var elem = this; setTimeout(function() { $( elem ).focus(); if ( fn ) { fn.call( elem ); } }, delay ); }) : orig.apply( this, arguments ); }; })( $.fn.focus ), scrollParent: function() { var scrollParent; if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { scrollParent = this.parents().filter(function() { return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); }).eq(0); } else { scrollParent = this.parents().filter(function() { return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); }).eq(0); } return ( /fixed/ ).test( this.css( "position") ) || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent; }, uniqueId: function() { return this.each(function() { if ( !this.id ) { this.id = "ui-id-" + (++uuid); } }); }, removeUniqueId: function() { return this.each(function() { if ( runiqueId.test( this.id ) ) { $( this ).removeAttr( "id" ); } }); } }); // selectors function focusable( element, isTabIndexNotNaN ) { var map, mapName, img, nodeName = element.nodeName.toLowerCase(); if ( "area" === nodeName ) { map = element.parentNode; mapName = map.name; if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { return false; } img = $( "img[usemap=#" + mapName + "]" )[0]; return !!img && visible( img ); } return ( /input|select|textarea|button|object/.test( nodeName ) ? !element.disabled : "a" === nodeName ? element.href || isTabIndexNotNaN : isTabIndexNotNaN) && // the element and all of its ancestors must be visible visible( element ); } function visible( element ) { return $.expr.filters.visible( element ) && !$( element ).parents().addBack().filter(function() { return $.css( this, "visibility" ) === "hidden"; }).length; } $.extend( $.expr[ ":" ], { data: $.expr.createPseudo ? $.expr.createPseudo(function( dataName ) { return function( elem ) { return !!$.data( elem, dataName ); }; }) : // support: jQuery <1.8 function( elem, i, match ) { return !!$.data( elem, match[ 3 ] ); }, focusable: function( element ) { return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); }, tabbable: function( element ) { var tabIndex = $.attr( element, "tabindex" ), isTabIndexNaN = isNaN( tabIndex ); return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); } }); // support: jQuery <1.8 if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { $.each( [ "Width", "Height" ], function( i, name ) { var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], type = name.toLowerCase(), orig = { innerWidth: $.fn.innerWidth, innerHeight: $.fn.innerHeight, outerWidth: $.fn.outerWidth, outerHeight: $.fn.outerHeight }; function reduce( elem, size, border, margin ) { $.each( side, function() { size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; if ( border ) { size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; } if ( margin ) { size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; } }); return size; } $.fn[ "inner" + name ] = function( size ) { if ( size === undefined ) { return orig[ "inner" + name ].call( this ); } return this.each(function() { $( this ).css( type, reduce( this, size ) + "px" ); }); }; $.fn[ "outer" + name] = function( size, margin ) { if ( typeof size !== "number" ) { return orig[ "outer" + name ].call( this, size ); } return this.each(function() { $( this).css( type, reduce( this, size, true, margin ) + "px" ); }); }; }); } // support: jQuery <1.8 if ( !$.fn.addBack ) { $.fn.addBack = function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter( selector ) ); }; } // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { $.fn.removeData = (function( removeData ) { return function( key ) { if ( arguments.length ) { return removeData.call( this, $.camelCase( key ) ); } else { return removeData.call( this ); } }; })( $.fn.removeData ); } // deprecated $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); $.support.selectstart = "onselectstart" in document.createElement( "div" ); $.fn.extend({ disableSelection: function() { return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + ".ui-disableSelection", function( event ) { event.preventDefault(); }); }, enableSelection: function() { return this.unbind( ".ui-disableSelection" ); }, zIndex: function( zIndex ) { if ( zIndex !== undefined ) { return this.css( "zIndex", zIndex ); } if ( this.length ) { var elem = $( this[ 0 ] ), position, value; while ( elem.length && elem[ 0 ] !== document ) { // Ignore z-index if position is set to a value where z-index is ignored by the browser // This makes behavior of this function consistent across browsers // WebKit always returns auto if the element is positioned position = elem.css( "position" ); if ( position === "absolute" || position === "relative" || position === "fixed" ) { // IE returns 0 when zIndex is not specified // other browsers return a string // we ignore the case of nested elements with an explicit value of 0 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> value = parseInt( elem.css( "zIndex" ), 10 ); if ( !isNaN( value ) && value !== 0 ) { return value; } } elem = elem.parent(); } } return 0; } }); // $.ui.plugin is deprecated. Use $.widget() extensions instead. $.ui.plugin = { add: function( module, option, set ) { var i, proto = $.ui[ module ].prototype; for ( i in set ) { proto.plugins[ i ] = proto.plugins[ i ] || []; proto.plugins[ i ].push( [ option, set[ i ] ] ); } }, call: function( instance, name, args, allowDisconnected ) { var i, set = instance.plugins[ name ]; if ( !set ) { return; } if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { return; } for ( i = 0; i < set.length; i++ ) { if ( instance.options[ set[ i ][ 0 ] ] ) { set[ i ][ 1 ].apply( instance.element, args ); } } } }; })( jQuery ); (function( $, window, undefined ) { $.extend( $.mobile, { // define the window and the document objects window: $( window ), document: $( document ), // TODO: Remove and use $.ui.keyCode directly keyCode: $.ui.keyCode, // Place to store various widget extensions behaviors: {}, // Scroll page vertically: scroll to 0 to hide iOS address bar, or pass a Y value silentScroll: function( ypos ) { if ( $.type( ypos ) !== "number" ) { ypos = $.mobile.defaultHomeScroll; } // prevent scrollstart and scrollstop events $.event.special.scrollstart.enabled = false; setTimeout(function() { window.scrollTo( 0, ypos ); $.mobile.document.trigger( "silentscroll", { x: 0, y: ypos }); }, 20 ); setTimeout(function() { $.event.special.scrollstart.enabled = true; }, 150 ); }, getClosestBaseUrl: function( ele ) { // Find the closest page and extract out its url. var url = $( ele ).closest( ".ui-page" ).jqmData( "url" ), base = $.mobile.path.documentBase.hrefNoHash; if ( !$.mobile.dynamicBaseEnabled || !url || !$.mobile.path.isPath( url ) ) { url = base; } return $.mobile.path.makeUrlAbsolute( url, base ); }, removeActiveLinkClass: function( forceRemoval ) { if ( !!$.mobile.activeClickedLink && ( !$.mobile.activeClickedLink.closest( "." + $.mobile.activePageClass ).length || forceRemoval ) ) { $.mobile.activeClickedLink.removeClass( $.mobile.activeBtnClass ); } $.mobile.activeClickedLink = null; }, // DEPRECATED in 1.4 // Find the closest parent with a theme class on it. Note that // we are not using $.fn.closest() on purpose here because this // method gets called quite a bit and we need it to be as fast // as possible. getInheritedTheme: function( el, defaultTheme ) { var e = el[ 0 ], ltr = "", re = /ui-(bar|body|overlay)-([a-z])\b/, c, m; while ( e ) { c = e.className || ""; if ( c && ( m = re.exec( c ) ) && ( ltr = m[ 2 ] ) ) { // We found a parent with a theme class // on it so bail from this loop. break; } e = e.parentNode; } // Return the theme letter we found, if none, return the // specified default. return ltr || defaultTheme || "a"; }, enhanceable: function( elements ) { return this.haveParents( elements, "enhance" ); }, hijackable: function( elements ) { return this.haveParents( elements, "ajax" ); }, haveParents: function( elements, attr ) { if ( !$.mobile.ignoreContentEnabled ) { return elements; } var count = elements.length, $newSet = $(), e, $element, excluded, i, c; for ( i = 0; i < count; i++ ) { $element = elements.eq( i ); excluded = false; e = elements[ i ]; while ( e ) { c = e.getAttribute ? e.getAttribute( "data-" + $.mobile.ns + attr ) : ""; if ( c === "false" ) { excluded = true; break; } e = e.parentNode; } if ( !excluded ) { $newSet = $newSet.add( $element ); } } return $newSet; }, getScreenHeight: function() { // Native innerHeight returns more accurate value for this across platforms, // jQuery version is here as a normalized fallback for platforms like Symbian return window.innerHeight || $.mobile.window.height(); }, //simply set the active page's minimum height to screen height, depending on orientation resetActivePageHeight: function( height ) { var page = $( "." + $.mobile.activePageClass ), pageHeight = page.height(), pageOuterHeight = page.outerHeight( true ); height = ( typeof height === "number" ) ? height : $.mobile.getScreenHeight(); page.css( "min-height", height - ( pageOuterHeight - pageHeight ) ); }, loading: function() { // If this is the first call to this function, instantiate a loader widget var loader = this.loading._widget || $( $.mobile.loader.prototype.defaultHtml ).loader(), // Call the appropriate method on the loader returnValue = loader.loader.apply( loader, arguments ); // Make sure the loader is retained for future calls to this function. this.loading._widget = loader; return returnValue; } }); $.addDependents = function( elem, newDependents ) { var $elem = $( elem ), dependents = $elem.jqmData( "dependents" ) || $(); $elem.jqmData( "dependents", $( dependents ).add( newDependents ) ); }; // plugins $.fn.extend({ removeWithDependents: function() { $.removeWithDependents( this ); }, // Enhance child elements enhanceWithin: function() { var index, widgetElements = {}, keepNative = $.mobile.page.prototype.keepNativeSelector(), that = this; // Add no js class to elements if ( $.mobile.nojs ) { $.mobile.nojs( this ); } // Bind links for ajax nav if ( $.mobile.links ) { $.mobile.links( this ); } // Degrade inputs for styleing if ( $.mobile.degradeInputsWithin ) { $.mobile.degradeInputsWithin( this ); } // Run buttonmarkup if ( $.fn.buttonMarkup ) { this.find( $.fn.buttonMarkup.initSelector ).not( keepNative ) .jqmEnhanceable().buttonMarkup(); } // Add classes for fieldContain if ( $.fn.fieldcontain ) { this.find( ":jqmData(role='fieldcontain')" ).not( keepNative ) .jqmEnhanceable().fieldcontain(); } // Enhance widgets $.each( $.mobile.widgets, function( name, constructor ) { // If initSelector not false find elements if ( constructor.initSelector ) { // Filter elements that should not be enhanced based on parents var elements = $.mobile.enhanceable( that.find( constructor.initSelector ) ); // If any matching elements remain filter ones with keepNativeSelector if ( elements.length > 0 ) { // $.mobile.page.prototype.keepNativeSelector is deprecated this is just for backcompat // Switch to $.mobile.keepNative in 1.5 which is just a value not a function elements = elements.not( keepNative ); } // Enhance whatever is left if ( elements.length > 0 ) { widgetElements[ constructor.prototype.widgetName ] = elements; } } }); for ( index in widgetElements ) { widgetElements[ index ][ index ](); } return this; }, addDependents: function( newDependents ) { $.addDependents( this, newDependents ); }, // note that this helper doesn't attempt to handle the callback // or setting of an html element's text, its only purpose is // to return the html encoded version of the text in all cases. (thus the name) getEncodedText: function() { return $( "<a>" ).text( this.text() ).html(); }, // fluent helper function for the mobile namespaced equivalent jqmEnhanceable: function() { return $.mobile.enhanceable( this ); }, jqmHijackable: function() { return $.mobile.hijackable( this ); } }); $.removeWithDependents = function( nativeElement ) { var element = $( nativeElement ); ( element.jqmData( "dependents" ) || $() ).remove(); element.remove(); }; $.addDependents = function( nativeElement, newDependents ) { var element = $( nativeElement ), dependents = element.jqmData( "dependents" ) || $(); element.jqmData( "dependents", $( dependents ).add( newDependents ) ); }; $.find.matches = function( expr, set ) { return $.find( expr, null, null, set ); }; $.find.matchesSelector = function( node, expr ) { return $.find( expr, null, null, [ node ] ).length > 0; }; })( jQuery, this ); /*! * jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40N * http://jqueryui.com * * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/jQuery.widget/ */ (function( $, undefined ) { var uuid = 0, slice = Array.prototype.slice, _cleanData = $.cleanData; $.cleanData = function( elems ) { for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { try { $( elem ).triggerHandler( "remove" ); // http://bugs.jquery.com/ticket/8235 } catch( e ) {} } _cleanData( elems ); }; $.widget = function( name, base, prototype ) { var fullName, existingConstructor, constructor, basePrototype, // proxiedPrototype allows the provided prototype to remain unmodified // so that it can be used as a mixin for multiple widgets (#8876) proxiedPrototype = {}, namespace = name.split( "." )[ 0 ]; name = name.split( "." )[ 1 ]; fullName = namespace + "-" + name; if ( !prototype ) { prototype = base; base = $.Widget; } // create selector for plugin $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { return !!$.data( elem, fullName ); }; $[ namespace ] = $[ namespace ] || {}; existingConstructor = $[ namespace ][ name ]; constructor = $[ namespace ][ name ] = function( options, element ) { // allow instantiation without "new" keyword if ( !this._createWidget ) { return new constructor( options, element ); } // allow instantiation without initializing for simple inheritance // must use "new" keyword (the code above always passes args) if ( arguments.length ) { this._createWidget( options, element ); } }; // extend with the existing constructor to carry over any static properties $.extend( constructor, existingConstructor, { version: prototype.version, // copy the object used to create the prototype in case we need to // redefine the widget later _proto: $.extend( {}, prototype ), // track widgets that inherit from this widget in case this widget is // redefined after a widget inherits from it _childConstructors: [] }); basePrototype = new base(); // we need to make the options hash a property directly on the new instance // otherwise we'll modify the options hash on the prototype that we're // inheriting from basePrototype.options = $.widget.extend( {}, basePrototype.options ); $.each( prototype, function( prop, value ) { if ( !$.isFunction( value ) ) { proxiedPrototype[ prop ] = value; return; } proxiedPrototype[ prop ] = (function() { var _super = function() { return base.prototype[ prop ].apply( this, arguments ); }, _superApply = function( args ) { return base.prototype[ prop ].apply( this, args ); }; return function() { var __super = this._super, __superApply = this._superApply, returnValue; this._super = _super; this._superApply = _superApply; returnValue = value.apply( this, arguments ); this._super = __super; this._superApply = __superApply; return returnValue; }; })(); }); constructor.prototype = $.widget.extend( basePrototype, { // TODO: remove support for widgetEventPrefix // always use the name + a colon as the prefix, e.g., draggable:start // don't prefix for widgets that aren't DOM-based widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name }, proxiedPrototype, { constructor: constructor, namespace: namespace, widgetName: name, widgetFullName: fullName }); // If this widget is being redefined then we need to find all widgets that // are inheriting from it and redefine all of them so that they inherit from // the new version of this widget. We're essentially trying to replace one // level in the prototype chain. if ( existingConstructor ) { $.each( existingConstructor._childConstructors, function( i, child ) { var childPrototype = child.prototype; // redefine the child widget using the same prototype that was // originally used, but inherit from the new version of the base $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); }); // remove the list of existing child constructors from the old constructor // so the old child constructors can be garbage collected delete existingConstructor._childConstructors; } else { base._childConstructors.push( constructor ); } $.widget.bridge( name, constructor ); return constructor; }; $.widget.extend = function( target ) { var input = slice.call( arguments, 1 ), inputIndex = 0, inputLength = input.length, key, value; for ( ; inputIndex < inputLength; inputIndex++ ) { for ( key in input[ inputIndex ] ) { value = input[ inputIndex ][ key ]; if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { // Clone objects if ( $.isPlainObject( value ) ) { target[ key ] = $.isPlainObject( target[ key ] ) ? $.widget.extend( {}, target[ key ], value ) : // Don't extend strings, arrays, etc. with objects $.widget.extend( {}, value ); // Copy everything else by reference } else { target[ key ] = value; } } } } return target; }; $.widget.bridge = function( name, object ) { var fullName = object.prototype.widgetFullName || name; $.fn[ name ] = function( options ) { var isMethodCall = typeof options === "string", args = slice.call( arguments, 1 ), returnValue = this; // allow multiple hashes to be passed on init options = !isMethodCall && args.length ? $.widget.extend.apply( null, [ options ].concat(args) ) : options; if ( isMethodCall ) { this.each(function() { var methodValue, instance = $.data( this, fullName ); if ( options === "instance" ) { returnValue = instance; return false; } if ( !instance ) { return $.error( "cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'" ); } if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { return $.error( "no such method '" + options + "' for " + name + " widget instance" ); } methodValue = instance[ options ].apply( instance, args ); if ( methodValue !== instance && methodValue !== undefined ) { returnValue = methodValue && methodValue.jquery ? returnValue.pushStack( methodValue.get() ) : methodValue; return false; } }); } else { this.each(function() { var instance = $.data( this, fullName ); if ( instance ) { instance.option( options || {} )._init(); } else { $.data( this, fullName, new object( options, this ) ); } }); } return returnValue; }; }; $.Widget = function( /* options, element */ ) {}; $.Widget._childConstructors = []; $.Widget.prototype = { widgetName: "widget", widgetEventPrefix: "", defaultElement: "<div>", options: { disabled: false, // callbacks create: null }, _createWidget: function( options, element ) { element = $( element || this.defaultElement || this )[ 0 ]; this.element = $( element ); this.uuid = uuid++; this.eventNamespace = "." + this.widgetName + this.uuid; this.options = $.widget.extend( {}, this.options, this._getCreateOptions(), options ); this.bindings = $(); this.hoverable = $(); this.focusable = $(); if ( element !== this ) { $.data( element, this.widgetFullName, this ); this._on( true, this.element, { remove: function( event ) { if ( event.target === element ) { this.destroy(); } } }); this.document = $( element.style ? // element within the document element.ownerDocument : // element is window or document element.document || element ); this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); } this._create(); this._trigger( "create", null, this._getCreateEventData() ); this._init(); }, _getCreateOptions: $.noop, _getCreateEventData: $.noop, _create: $.noop, _init: $.noop, destroy: function() { this._destroy(); // we can probably remove the unbind calls in 2.0 // all event bindings should go through this._on() this.element .unbind( this.eventNamespace ) .removeData( this.widgetFullName ) // support: jquery <1.6.3 // http://bugs.jquery.com/ticket/9413 .removeData( $.camelCase( this.widgetFullName ) ); this.widget() .unbind( this.eventNamespace ) .removeAttr( "aria-disabled" ) .removeClass( this.widgetFullName + "-disabled " + "ui-state-disabled" ); // clean up events and states this.bindings.unbind( this.eventNamespace ); this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); }, _destroy: $.noop, widget: function() { return this.element; }, option: function( key, value ) { var options = key, parts, curOption, i; if ( arguments.length === 0 ) { // don't return a reference to the internal hash return $.widget.extend( {}, this.options ); } if ( typeof key === "string" ) { // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } options = {}; parts = key.split( "." ); key = parts.shift(); if ( parts.length ) { curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); for ( i = 0; i < parts.length - 1; i++ ) { curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; curOption = curOption[ parts[ i ] ]; } key = parts.pop(); if ( value === undefined ) { return curOption[ key ] === undefined ? null : curOption[ key ]; } curOption[ key ] = value; } else { if ( value === undefined ) { return this.options[ key ] === undefined ? null : this.options[ key ]; } options[ key ] = value; } } this._setOptions( options ); return this; }, _setOptions: function( options ) { var key; for ( key in options ) { this._setOption( key, options[ key ] ); } return this; }, _setOption: function( key, value ) { this.options[ key ] = value; if ( key === "disabled" ) { this.widget() .toggleClass( this.widgetFullName + "-disabled", !!value ); this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); } return this; }, enable: function() { return this._setOptions({ disabled: false }); }, disable: function() { return this._setOptions({ disabled: true }); }, _on: function( suppressDisabledCheck, element, handlers ) { var delegateElement, instance = this; // no suppressDisabledCheck flag, shuffle arguments if ( typeof suppressDisabledCheck !== "boolean" ) { handlers = element; element = suppressDisabledCheck; suppressDisabledCheck = false; } // no element argument, shuffle and use this.element if ( !handlers ) { handlers = element; element = this.element; delegateElement = this.widget(); } else { // accept selectors, DOM elements element = delegateElement = $( element ); this.bindings = this.bindings.add( element ); } $.each( handlers, function( event, handler ) { function handlerProxy() { // allow widgets to customize the disabled handling // - disabled as an array instead of boolean // - disabled class as method for disabling individual parts if ( !suppressDisabledCheck && ( instance.options.disabled === true || $( this ).hasClass( "ui-state-disabled" ) ) ) { return; } return ( typeof handler === "string" ? instance[ handler ] : handler ) .apply( instance, arguments ); } // copy the guid so direct unbinding works if ( typeof handler !== "string" ) { handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++; } var match = event.match( /^(\w+)\s*(.*)$/ ), eventName = match[1] + instance.eventNamespace, selector = match[2]; if ( selector ) { delegateElement.delegate( selector, eventName, handlerProxy ); } else { element.bind( eventName, handlerProxy ); } }); }, _off: function( element, eventName ) { eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; element.unbind( eventName ).undelegate( eventName ); }, _delay: function( handler, delay ) { function handlerProxy() { return ( typeof handler === "string" ? instance[ handler ] : handler ) .apply( instance, arguments ); } var instance = this; return setTimeout( handlerProxy, delay || 0 ); }, _hoverable: function( element ) { this.hoverable = this.hoverable.add( element ); this._on( element, { mouseenter: function( event ) { $( event.currentTarget ).addClass( "ui-state-hover" ); }, mouseleave: function( event ) { $( event.currentTarget ).removeClass( "ui-state-hover" ); } }); }, _focusable: function( element ) { this.focusable = this.focusable.add( element ); this._on( element, { focusin: function( event ) { $( event.currentTarget ).addClass( "ui-state-focus" ); }, focusout: function( event ) { $( event.currentTarget ).removeClass( "ui-state-focus" ); } }); }, _trigger: function( type, event, data ) { var prop, orig, callback = this.options[ type ]; data = data || {}; event = $.Event( event ); event.type = ( type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type ).toLowerCase(); // the original event may come from any element // so we need to reset the target on the new event event.target = this.element[ 0 ]; // copy original event properties over to the new event orig = event.originalEvent; if ( orig ) { for ( prop in orig ) { if ( !( prop in event ) ) { event[ prop ] = orig[ prop ]; } } } this.element.trigger( event, data ); return !( $.isFunction( callback ) && callback.apply( this.element[0], [ event ].concat( data ) ) === false || event.isDefaultPrevented() ); } }; $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { if ( typeof options === "string" ) { options = { effect: options }; } var hasOptions, effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect; options = options || {}; if ( typeof options === "number" ) { options = { duration: options }; } hasOptions = !$.isEmptyObject( options ); options.complete = callback; if ( options.delay ) { element.delay( options.delay ); } if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { element[ method ]( options ); } else if ( effectName !== method && element[ effectName ] ) { element[ effectName ]( options.duration, options.easing, callback ); } else { element.queue(function( next ) { $( this )[ method ](); if ( callback ) { callback.call( element[ 0 ] ); } next(); }); } }; }); })( jQuery ); (function( $, undefined ) { var rcapitals = /[A-Z]/g, replaceFunction = function( c ) { return "-" + c.toLowerCase(); }; $.extend( $.Widget.prototype, { _getCreateOptions: function() { var option, value, elem = this.element[ 0 ], options = {}; // if ( !$.mobile.getAttribute( elem, "defaults" ) ) { for ( option in this.options ) { value = $.mobile.getAttribute( elem, option.replace( rcapitals, replaceFunction ) ); if ( value != null ) { options[ option ] = value; } } } return options; } }); //TODO: Remove in 1.5 for backcompat only $.mobile.widget = $.Widget; })( jQuery ); (function( $ ) { // TODO move loader class down into the widget settings var loaderClass = "ui-loader", $html = $( "html" ); $.widget( "mobile.loader", { // NOTE if the global config settings are defined they will override these // options options: { // the theme for the loading message theme: "a", // whether the text in the loading message is shown textVisible: false, // custom html for the inner content of the loading message html: "", // the text to be displayed when the popup is shown text: "loading" }, defaultHtml: "<div class='" + loaderClass + "'>" + "<span class='ui-icon-loading'></span>" + "<h1></h1>" + "</div>", // For non-fixed supportin browsers. Position at y center (if scrollTop supported), above the activeBtn (if defined), or just 100px from top fakeFixLoader: function() { var activeBtn = $( "." + $.mobile.activeBtnClass ).first(); this.element .css({ top: $.support.scrollTop && this.window.scrollTop() + this.window.height() / 2 || activeBtn.length && activeBtn.offset().top || 100 }); }, // check position of loader to see if it appears to be "fixed" to center // if not, use abs positioning checkLoaderPosition: function() { var offset = this.element.offset(), scrollTop = this.window.scrollTop(), screenHeight = $.mobile.getScreenHeight(); if ( offset.top < scrollTop || ( offset.top - scrollTop ) > screenHeight ) { this.element.addClass( "ui-loader-fakefix" ); this.fakeFixLoader(); this.window .unbind( "scroll", this.checkLoaderPosition ) .bind( "scroll", $.proxy( this.fakeFixLoader, this ) ); } }, resetHtml: function() { this.element.html( $( this.defaultHtml ).html() ); }, // Turn on/off page loading message. Theme doubles as an object argument // with the following shape: { theme: '', text: '', html: '', textVisible: '' } // NOTE that the $.mobile.loading* settings and params past the first are deprecated // TODO sweet jesus we need to break some of this out show: function( theme, msgText, textonly ) { var textVisible, message, loadSettings; this.resetHtml(); // use the prototype options so that people can set them globally at // mobile init. Consistency, it's what's for dinner if ( $.type( theme ) === "object" ) { loadSettings = $.extend( {}, this.options, theme ); theme = loadSettings.theme; } else { loadSettings = this.options; // here we prefer the theme value passed as a string argument, then // we prefer the global option because we can't use undefined default // prototype options, then the prototype option theme = theme || loadSettings.theme; } // set the message text, prefer the param, then the settings object // then loading message message = msgText || ( loadSettings.text === false ? "" : loadSettings.text ); // prepare the dom $html.addClass( "ui-loading" ); textVisible = loadSettings.textVisible; // add the proper css given the options (theme, text, etc) // Force text visibility if the second argument was supplied, or // if the text was explicitly set in the object args this.element.attr("class", loaderClass + " ui-corner-all ui-body-" + theme + " ui-loader-" + ( textVisible || msgText || theme.text ? "verbose" : "default" ) + ( loadSettings.textonly || textonly ? " ui-loader-textonly" : "" ) ); // TODO verify that jquery.fn.html is ok to use in both cases here // this might be overly defensive in preventing unknowing xss // if the html attribute is defined on the loading settings, use that // otherwise use the fallbacks from above if ( loadSettings.html ) { this.element.html( loadSettings.html ); } else { this.element.find( "h1" ).text( message ); } // attach the loader to the DOM this.element.appendTo( $.mobile.pageContainer ); // check that the loader is visible this.checkLoaderPosition(); // on scroll check the loader position this.window.bind( "scroll", $.proxy( this.checkLoaderPosition, this ) ); }, hide: function() { $html.removeClass( "ui-loading" ); if ( this.options.text ) { this.element.removeClass( "ui-loader-fakefix" ); } $.mobile.window.unbind( "scroll", this.fakeFixLoader ); $.mobile.window.unbind( "scroll", this.checkLoaderPosition ); } }); })(jQuery, this); // Script: jQuery hashchange event // // *Version: 1.3, Last updated: 7/21/2010* // // Project Home - http://benalman.com/projects/jquery-hashchange-plugin/ // GitHub - http://github.com/cowboy/jquery-hashchange/ // Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js // (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (0.8kb gzipped) // // About: License // // Copyright (c) 2010 "Cowboy" Ben Alman, // Dual licensed under the MIT and GPL licenses. // http://benalman.com/about/license/ // // About: Examples // // These working examples, complete with fully commented code, illustrate a few // ways in which this plugin can be used. // // hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/ // document.domain - http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/ // // About: Support and Testing // // Information about what version or versions of jQuery this plugin has been // tested with, what browsers it has been tested in, and where the unit tests // reside (so you can test it yourself). // // jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2 // Browsers Tested - Internet Explorer 6-8, Firefox 2-4, Chrome 5-6, Safari 3.2-5, // Opera 9.6-10.60, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5. // Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/ // // About: Known issues // // While this jQuery hashchange event implementation is quite stable and // robust, there are a few unfortunate browser bugs surrounding expected // hashchange event-based behaviors, independent of any JavaScript // window.onhashchange abstraction. See the following examples for more // information: // // Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/ // Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/ // WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/ // Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/ // // Also note that should a browser natively support the window.onhashchange // event, but not report that it does, the fallback polling loop will be used. // // About: Release History // // 1.3 - (7/21/2010) Reorganized IE6/7 Iframe code to make it more // "removable" for mobile-only development. Added IE6/7 document.title // support. Attempted to make Iframe as hidden as possible by using // techniques from http://www.paciellogroup.com/blog/?p=604. Added // support for the "shortcut" format $(window).hashchange( fn ) and // $(window).hashchange() like jQuery provides for built-in events. // Renamed jQuery.hashchangeDelay to <jQuery.fn.hashchange.delay> and // lowered its default value to 50. Added <jQuery.fn.hashchange.domain> // and <jQuery.fn.hashchange.src> properties plus document-domain.html // file to address access denied issues when setting document.domain in // IE6/7. // 1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin // from a page on another domain would cause an error in Safari 4. Also, // IE6/7 Iframe is now inserted after the body (this actually works), // which prevents the page from scrolling when the event is first bound. // Event can also now be bound before DOM ready, but it won't be usable // before then in IE6/7. // 1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug // where browser version is incorrectly reported as 8.0, despite // inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag. // 1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special // window.onhashchange functionality into a separate plugin for users // who want just the basic event & back button support, without all the // extra awesomeness that BBQ provides. This plugin will be included as // part of jQuery BBQ, but also be available separately. (function( $, window, undefined ) { // Reused string. var str_hashchange = 'hashchange', // Method / object references. doc = document, fake_onhashchange, special = $.event.special, // Does the browser support window.onhashchange? Note that IE8 running in // IE7 compatibility mode reports true for 'onhashchange' in window, even // though the event isn't supported, so also test document.documentMode. doc_mode = doc.documentMode, supports_onhashchange = 'on' + str_hashchange in window && ( doc_mode === undefined || doc_mode > 7 ); // Get location.hash (or what you'd expect location.hash to be) sans any // leading #. Thanks for making this necessary, Firefox! function get_fragment( url ) { url = url || location.href; return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' ); }; // Method: jQuery.fn.hashchange // // Bind a handler to the window.onhashchange event or trigger all bound // window.onhashchange event handlers. This behavior is consistent with // jQuery's built-in event handlers. // // Usage: // // > jQuery(window).hashchange( [ handler ] ); // // Arguments: // // handler - (Function) Optional handler to be bound to the hashchange // event. This is a "shortcut" for the more verbose form: // jQuery(window).bind( 'hashchange', handler ). If handler is omitted, // all bound window.onhashchange event handlers will be triggered. This // is a shortcut for the more verbose // jQuery(window).trigger( 'hashchange' ). These forms are described in // the <hashchange event> section. // // Returns: // // (jQuery) The initial jQuery collection of elements. // Allow the "shortcut" format $(elem).hashchange( fn ) for binding and // $(elem).hashchange() for triggering, like jQuery does for built-in events. $.fn[ str_hashchange ] = function( fn ) { return fn ? this.bind( str_hashchange, fn ) : this.trigger( str_hashchange ); }; // Property: jQuery.fn.hashchange.delay // // The numeric interval (in milliseconds) at which the <hashchange event> // polling loop executes. Defaults to 50. // Property: jQuery.fn.hashchange.domain // // If you're setting document.domain in your JavaScript, and you want hash // history to work in IE6/7, not only must this property be set, but you must // also set document.domain BEFORE jQuery is loaded into the page. This // property is only applicable if you are supporting IE6/7 (or IE8 operating // in "IE7 compatibility" mode). // // In addition, the <jQuery.fn.hashchange.src> property must be set to the // path of the included "document-domain.html" file, which can be renamed or // modified if necessary (note that the document.domain specified must be the // same in both your main JavaScript as well as in this file). // // Usage: // // jQuery.fn.hashchange.domain = document.domain; // Property: jQuery.fn.hashchange.src // // If, for some reason, you need to specify an Iframe src file (for example, // when setting document.domain as in <jQuery.fn.hashchange.domain>), you can // do so using this property. Note that when using this property, history // won't be recorded in IE6/7 until the Iframe src file loads. This property // is only applicable if you are supporting IE6/7 (or IE8 operating in "IE7 // compatibility" mode). // // Usage: // // jQuery.fn.hashchange.src = 'path/to/file.html'; $.fn[ str_hashchange ].delay = 50; /* $.fn[ str_hashchange ].domain = null; $.fn[ str_hashchange ].src = null; */ // Event: hashchange event // // Fired when location.hash changes. In browsers that support it, the native // HTML5 window.onhashchange event is used, otherwise a polling loop is // initialized, running every <jQuery.fn.hashchange.delay> milliseconds to // see if the hash has changed. In IE6/7 (and IE8 operating in "IE7 // compatibility" mode), a hidden Iframe is created to allow the back button // and hash-based history to work. // // Usage as described in <jQuery.fn.hashchange>: // // > // Bind an event handler. // > jQuery(window).hashchange( function(e) { // > var hash = location.hash; // > ... // > }); // > // > // Manually trigger the event handler. // > jQuery(window).hashchange(); // // A more verbose usage that allows for event namespacing: // // > // Bind an event handler. // > jQuery(window).bind( 'hashchange', function(e) { // > var hash = location.hash; // > ... // > }); // > // > // Manually trigger the event handler. // > jQuery(window).trigger( 'hashchange' ); // // Additional Notes: // // * The polling loop and Iframe are not created until at least one handler // is actually bound to the 'hashchange' event. // * If you need the bound handler(s) to execute immediately, in cases where // a location.hash exists on page load, via bookmark or page refresh for // example, use jQuery(window).hashchange() or the more verbose // jQuery(window).trigger( 'hashchange' ). // * The event can be bound before DOM ready, but since it won't be usable // before then in IE6/7 (due to the necessary Iframe), recommended usage is // to bind it inside a DOM ready handler. // Override existing $.event.special.hashchange methods (allowing this plugin // to be defined after jQuery BBQ in BBQ's source code). special[ str_hashchange ] = $.extend( special[ str_hashchange ], { // Called only when the first 'hashchange' event is bound to window. setup: function() { // If window.onhashchange is supported natively, there's nothing to do.. if ( supports_onhashchange ) { return false; } // Otherwise, we need to create our own. And we don't want to call this // until the user binds to the event, just in case they never do, since it // will create a polling loop and possibly even a hidden Iframe. $( fake_onhashchange.start ); }, // Called only when the last 'hashchange' event is unbound from window. teardown: function() { // If window.onhashchange is supported natively, there's nothing to do.. if ( supports_onhashchange ) { return false; } // Otherwise, we need to stop ours (if possible). $( fake_onhashchange.stop ); } }); // fake_onhashchange does all the work of triggering the window.onhashchange // event for browsers that don't natively support it, including creating a // polling loop to watch for hash changes and in IE 6/7 creating a hidden // Iframe to enable back and forward. fake_onhashchange = (function() { var self = {}, timeout_id, // Remember the initial hash so it doesn't get triggered immediately. last_hash = get_fragment(), fn_retval = function( val ) { return val; }, history_set = fn_retval, history_get = fn_retval; // Start the polling loop. self.start = function() { timeout_id || poll(); }; // Stop the polling loop. self.stop = function() { timeout_id && clearTimeout( timeout_id ); timeout_id = undefined; }; // This polling loop checks every $.fn.hashchange.delay milliseconds to see // if location.hash has changed, and triggers the 'hashchange' event on // window when necessary. function poll() { var hash = get_fragment(), history_hash = history_get( last_hash ); if ( hash !== last_hash ) { history_set( last_hash = hash, history_hash ); $(window).trigger( str_hashchange ); } else if ( history_hash !== last_hash ) { location.href = location.href.replace( /#.*/, '' ) + history_hash; } timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay ); }; // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv window.attachEvent && !window.addEventListener && !supports_onhashchange && (function() { // Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8 // when running in "IE7 compatibility" mode. var iframe, iframe_src; // When the event is bound and polling starts in IE 6/7, create a hidden // Iframe for history handling. self.start = function() { if ( !iframe ) { iframe_src = $.fn[ str_hashchange ].src; iframe_src = iframe_src && iframe_src + get_fragment(); // Create hidden Iframe. Attempt to make Iframe as hidden as possible // by using techniques from http://www.paciellogroup.com/blog/?p=604. iframe = $('<iframe tabindex="-1" title="empty"/>').hide() // When Iframe has completely loaded, initialize the history and // start polling. .one( 'load', function() { iframe_src || history_set( get_fragment() ); poll(); }) // Load Iframe src if specified, otherwise nothing. .attr( 'src', iframe_src || 'javascript:0' ) // Append Iframe after the end of the body to prevent unnecessary // initial page scrolling (yes, this works). .insertAfter( 'body' )[0].contentWindow; // Whenever `document.title` changes, update the Iframe's title to // prettify the back/next history menu entries. Since IE sometimes // errors with "Unspecified error" the very first time this is set // (yes, very useful) wrap this with a try/catch block. doc.onpropertychange = function() { try { if ( event.propertyName === 'title' ) { iframe.document.title = doc.title; } } catch(e) {} }; } }; // Override the "stop" method since an IE6/7 Iframe was created. Even // if there are no longer any bound event handlers, the polling loop // is still necessary for back/next to work at all! self.stop = fn_retval; // Get history by looking at the hidden Iframe's location.hash. history_get = function() { return get_fragment( iframe.location.href ); }; // Set a new history item by opening and then closing the Iframe // document, *then* setting its location.hash. If document.domain has // been set, update that as well. history_set = function( hash, history_hash ) { var iframe_doc = iframe.document, domain = $.fn[ str_hashchange ].domain; if ( hash !== history_hash ) { // Update Iframe with any initial `document.title` that might be set. iframe_doc.title = doc.title; // Opening the Iframe's document after it has been closed is what // actually adds a history entry. iframe_doc.open(); // Set document.domain for the Iframe document as well, if necessary. domain && iframe_doc.write( '<script>document.domain="' + domain + '"<\/script>' ); iframe_doc.close(); // Update the Iframe's hash, for great justice. iframe.location.hash = hash; } }; })(); // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // ^^^^^^^^^^^^^^^^^^^ REMOVE IF NOT SUPPORTING IE6/7/8 ^^^^^^^^^^^^^^^^^^^ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ return self; })(); })(jQuery,this); (function( $, undefined ) { /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ window.matchMedia = window.matchMedia || (function( doc, undefined ) { var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, // fakeBody required for <FF4 when executed in <head> fakeBody = doc.createElement( "body" ), div = doc.createElement( "div" ); div.id = "mq-test-1"; div.style.cssText = "position:absolute;top:-100em"; fakeBody.style.background = "none"; fakeBody.appendChild(div); return function(q){ div.innerHTML = "&shy;<style media=\"" + q + "\"> #mq-test-1 { width: 42px; }</style>"; docElem.insertBefore( fakeBody, refNode ); bool = div.offsetWidth === 42; docElem.removeChild( fakeBody ); return { matches: bool, media: q }; }; }( document )); // $.mobile.media uses matchMedia to return a boolean. $.mobile.media = function( q ) { return window.matchMedia( q ).matches; }; })(jQuery); (function( $, undefined ) { var support = { touch: "ontouchend" in document }; $.mobile.support = $.mobile.support || {}; $.extend( $.support, support ); $.extend( $.mobile.support, support ); }( jQuery )); (function( $, undefined ) { $.extend( $.support, { orientation: "orientation" in window && "onorientationchange" in window }); }( jQuery )); (function( $, undefined ) { // thx Modernizr function propExists( prop ) { var uc_prop = prop.charAt( 0 ).toUpperCase() + prop.substr( 1 ), props = ( prop + " " + vendors.join( uc_prop + " " ) + uc_prop ).split( " " ), v; for ( v in props ) { if ( fbCSS[ props[ v ] ] !== undefined ) { return true; } } } var fakeBody = $( "<body>" ).prependTo( "html" ), fbCSS = fakeBody[ 0 ].style, vendors = [ "Webkit", "Moz", "O" ], webos = "palmGetResource" in window, //only used to rule out scrollTop opera = window.opera, operamini = window.operamini && ({}).toString.call( window.operamini ) === "[object OperaMini]", bb = window.blackberry && !propExists( "-webkit-transform" ), //only used to rule out box shadow, as it's filled opaque on BB 5 and lower nokiaLTE7_3; function validStyle( prop, value, check_vend ) { var div = document.createElement( "div" ), uc = function( txt ) { return txt.charAt( 0 ).toUpperCase() + txt.substr( 1 ); }, vend_pref = function( vend ) { if ( vend === "" ) { return ""; } else { return "-" + vend.charAt( 0 ).toLowerCase() + vend.substr( 1 ) + "-"; } }, check_style = function( vend ) { var vend_prop = vend_pref( vend ) + prop + ": " + value + ";", uc_vend = uc( vend ), propStyle = uc_vend + ( uc_vend === "" ? prop : uc( prop ) ); div.setAttribute( "style", vend_prop ); if ( !!div.style[ propStyle ] ) { ret = true; } }, check_vends = check_vend ? check_vend : vendors, i, ret; for( i = 0; i < check_vends.length; i++ ) { check_style( check_vends[i] ); } return !!ret; } // inline SVG support test function inlineSVG() { // Thanks Modernizr & Erik Dahlstrom var w = window, svg = !!w.document.createElementNS && !!w.document.createElementNS( "http://www.w3.org/2000/svg", "svg" ).createSVGRect && !( w.opera && navigator.userAgent.indexOf( "Chrome" ) === -1 ), support = function( data ) { if ( !( data && svg ) ) { $( "html" ).addClass( "ui-nosvg" ); } }, img = new w.Image(); img.onerror = function() { support( false ); }; img.onload = function() { support( img.width === 1 && img.height === 1 ); }; img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; } function transform3dTest() { var mqProp = "transform-3d", // Because the `translate3d` test below throws false positives in Android: ret = $.mobile.media( "(-" + vendors.join( "-" + mqProp + "),(-" ) + "-" + mqProp + "),(" + mqProp + ")" ), el, transforms, t; if ( ret ) { return !!ret; } el = document.createElement( "div" ); transforms = { // We’re omitting Opera for the time being; MS uses unprefixed. "MozTransform": "-moz-transform", "transform": "transform" }; fakeBody.append( el ); for ( t in transforms ) { if ( el.style[ t ] !== undefined ) { el.style[ t ] = "translate3d( 100px, 1px, 1px )"; ret = window.getComputedStyle( el ).getPropertyValue( transforms[ t ] ); } } return ( !!ret && ret !== "none" ); } // Test for dynamic-updating base tag support ( allows us to avoid href,src attr rewriting ) function baseTagTest() { var fauxBase = location.protocol + "//" + location.host + location.pathname + "ui-dir/", base = $( "head base" ), fauxEle = null, href = "", link, rebase; if ( !base.length ) { base = fauxEle = $( "<base>", { "href": fauxBase }).appendTo( "head" ); } else { href = base.attr( "href" ); } link = $( "<a href='testurl' />" ).prependTo( fakeBody ); rebase = link[ 0 ].href; base[ 0 ].href = href || location.pathname; if ( fauxEle ) { fauxEle.remove(); } return rebase.indexOf( fauxBase ) === 0; } // Thanks Modernizr function cssPointerEventsTest() { var element = document.createElement( "x" ), documentElement = document.documentElement, getComputedStyle = window.getComputedStyle, supports; if ( !( "pointerEvents" in element.style ) ) { return false; } element.style.pointerEvents = "auto"; element.style.pointerEvents = "x"; documentElement.appendChild( element ); supports = getComputedStyle && getComputedStyle( element, "" ).pointerEvents === "auto"; documentElement.removeChild( element ); return !!supports; } function boundingRect() { var div = document.createElement( "div" ); return typeof div.getBoundingClientRect !== "undefined"; } // non-UA-based IE version check by James Padolsey, modified by jdalton - from http://gist.github.com/527683 // allows for inclusion of IE 6+, including Windows Mobile 7 $.extend( $.mobile, { browser: {} } ); $.mobile.browser.oldIE = (function() { var v = 3, div = document.createElement( "div" ), a = div.all || []; do { div.innerHTML = "<!--[if gt IE " + ( ++v ) + "]><br><![endif]-->"; } while( a[0] ); return v > 4 ? v : !v; })(); function fixedPosition() { var w = window, ua = navigator.userAgent, platform = navigator.platform, // Rendering engine is Webkit, and capture major version wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ), wkversion = !!wkmatch && wkmatch[ 1 ], ffmatch = ua.match( /Fennec\/([0-9]+)/ ), ffversion = !!ffmatch && ffmatch[ 1 ], operammobilematch = ua.match( /Opera Mobi\/([0-9]+)/ ), omversion = !!operammobilematch && operammobilematch[ 1 ]; if ( // iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5) ( ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534 ) || // Opera Mini ( w.operamini && ({}).toString.call( w.operamini ) === "[object OperaMini]" ) || ( operammobilematch && omversion < 7458 ) || //Android lte 2.1: Platform is Android and Webkit version is less than 533 (Android 2.2) ( ua.indexOf( "Android" ) > -1 && wkversion && wkversion < 533 ) || // Firefox Mobile before 6.0 - ( ffversion && ffversion < 6 ) || // WebOS less than 3 ( "palmGetResource" in window && wkversion && wkversion < 534 ) || // MeeGo ( ua.indexOf( "MeeGo" ) > -1 && ua.indexOf( "NokiaBrowser/8.5.0" ) > -1 ) ) { return false; } return true; } $.extend( $.support, { cssTransitions: "WebKitTransitionEvent" in window || validStyle( "transition", "height 100ms linear", [ "Webkit", "Moz", "" ] ) && !$.mobile.browser.oldIE && !opera, // Note, Chrome for iOS has an extremely quirky implementation of popstate. // We've chosen to take the shortest path to a bug fix here for issue #5426 // See the following link for information about the regex chosen // https://developers.google.com/chrome/mobile/docs/user-agent#chrome_for_ios_user-agent pushState: "pushState" in history && "replaceState" in history && // When running inside a FF iframe, calling replaceState causes an error !( window.navigator.userAgent.indexOf( "Firefox" ) >= 0 && window.top !== window ) && ( window.navigator.userAgent.search(/CriOS/) === -1 ), mediaquery: $.mobile.media( "only all" ), cssPseudoElement: !!propExists( "content" ), touchOverflow: !!propExists( "overflowScrolling" ), cssTransform3d: transform3dTest(), cssAnimations: !!propExists( "animationName" ), boxShadow: !!propExists( "boxShadow" ) && !bb, fixedPosition: fixedPosition(), scrollTop: ("pageXOffset" in window || "scrollTop" in document.documentElement || "scrollTop" in fakeBody[ 0 ]) && !webos && !operamini, dynamicBaseTag: baseTagTest(), cssPointerEvents: cssPointerEventsTest(), boundingRect: boundingRect(), inlineSVG: inlineSVG }); fakeBody.remove(); // $.mobile.ajaxBlacklist is used to override ajaxEnabled on platforms that have known conflicts with hash history updates (BB5, Symbian) // or that generally work better browsing in regular http for full page refreshes (Opera Mini) // Note: This detection below is used as a last resort. // We recommend only using these detection methods when all other more reliable/forward-looking approaches are not possible nokiaLTE7_3 = (function() { var ua = window.navigator.userAgent; //The following is an attempt to match Nokia browsers that are running Symbian/s60, with webkit, version 7.3 or older return ua.indexOf( "Nokia" ) > -1 && ( ua.indexOf( "Symbian/3" ) > -1 || ua.indexOf( "Series60/5" ) > -1 ) && ua.indexOf( "AppleWebKit" ) > -1 && ua.match( /(BrowserNG|NokiaBrowser)\/7\.[0-3]/ ); })(); // Support conditions that must be met in order to proceed // default enhanced qualifications are media query support OR IE 7+ $.mobile.gradeA = function() { return ( ( $.support.mediaquery && $.support.cssPseudoElement ) || $.mobile.browser.oldIE && $.mobile.browser.oldIE >= 8 ) && ( $.support.boundingRect || $.fn.jquery.match(/1\.[0-7+]\.[0-9+]?/) !== null ); }; $.mobile.ajaxBlacklist = // BlackBerry browsers, pre-webkit window.blackberry && !window.WebKitPoint || // Opera Mini operamini || // Symbian webkits pre 7.3 nokiaLTE7_3; // Lastly, this workaround is the only way we've found so far to get pre 7.3 Symbian webkit devices // to render the stylesheets when they're referenced before this script, as we'd recommend doing. // This simply reappends the CSS in place, which for some reason makes it apply if ( nokiaLTE7_3 ) { $(function() { $( "head link[rel='stylesheet']" ).attr( "rel", "alternate stylesheet" ).attr( "rel", "stylesheet" ); }); } // For ruling out shadows via css if ( !$.support.boxShadow ) { $( "html" ).addClass( "ui-noboxshadow" ); } })( jQuery ); (function( $, undefined ) { var $win = $.mobile.window, self, dummyFnToInitNavigate = function() { }; $.event.special.beforenavigate = { setup: function() { $win.on( "navigate", dummyFnToInitNavigate ); }, teardown: function() { $win.off( "navigate", dummyFnToInitNavigate ); } }; $.event.special.navigate = self = { bound: false, pushStateEnabled: true, originalEventName: undefined, // If pushstate support is present and push state support is defined to // be true on the mobile namespace. isPushStateEnabled: function() { return $.support.pushState && $.mobile.pushStateEnabled === true && this.isHashChangeEnabled(); }, // !! assumes mobile namespace is present isHashChangeEnabled: function() { return $.mobile.hashListeningEnabled === true; }, // TODO a lot of duplication between popstate and hashchange popstate: function( event ) { var newEvent = new $.Event( "navigate" ), beforeNavigate = new $.Event( "beforenavigate" ), state = event.originalEvent.state || {}; beforeNavigate.originalEvent = event; $win.trigger( beforeNavigate ); if ( beforeNavigate.isDefaultPrevented() ) { return; } if ( event.historyState ) { $.extend(state, event.historyState); } // Make sure the original event is tracked for the end // user to inspect incase they want to do something special newEvent.originalEvent = event; // NOTE we let the current stack unwind because any assignment to // location.hash will stop the world and run this event handler. By // doing this we create a similar behavior to hashchange on hash // assignment setTimeout(function() { $win.trigger( newEvent, { state: state }); }, 0); }, hashchange: function( event /*, data */ ) { var newEvent = new $.Event( "navigate" ), beforeNavigate = new $.Event( "beforenavigate" ); beforeNavigate.originalEvent = event; $win.trigger( beforeNavigate ); if ( beforeNavigate.isDefaultPrevented() ) { return; } // Make sure the original event is tracked for the end // user to inspect incase they want to do something special newEvent.originalEvent = event; // Trigger the hashchange with state provided by the user // that altered the hash $win.trigger( newEvent, { // Users that want to fully normalize the two events // will need to do history management down the stack and // add the state to the event before this binding is fired // TODO consider allowing for the explicit addition of callbacks // to be fired before this value is set to avoid event timing issues state: event.hashchangeState || {} }); }, // TODO We really only want to set this up once // but I'm not clear if there's a beter way to achieve // this with the jQuery special event structure setup: function( /* data, namespaces */ ) { if ( self.bound ) { return; } self.bound = true; if ( self.isPushStateEnabled() ) { self.originalEventName = "popstate"; $win.bind( "popstate.navigate", self.popstate ); } else if ( self.isHashChangeEnabled() ) { self.originalEventName = "hashchange"; $win.bind( "hashchange.navigate", self.hashchange ); } } }; })( jQuery ); (function( $, undefined ) { var path, $base, dialogHashKey = "&ui-state=dialog"; $.mobile.path = path = { uiStateKey: "&ui-state", // This scary looking regular expression parses an absolute URL or its relative // variants (protocol, site, document, query, and hash), into the various // components (protocol, host, path, query, fragment, etc that make up the // URL as well as some other commonly used sub-parts. When used with RegExp.exec() // or String.match, it parses the URL into a results array that looks like this: // // [0]: http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread#msg-content // [1]: http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread // [2]: http://jblas:password@mycompany.com:8080/mail/inbox // [3]: http://jblas:password@mycompany.com:8080 // [4]: http: // [5]: // // [6]: jblas:password@mycompany.com:8080 // [7]: jblas:password // [8]: jblas // [9]: password // [10]: mycompany.com:8080 // [11]: mycompany.com // [12]: 8080 // [13]: /mail/inbox // [14]: /mail/ // [15]: inbox // [16]: ?msg=1234&type=unread // [17]: #msg-content // urlParseRE: /^\s*(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/, // Abstraction to address xss (Issue #4787) by removing the authority in // browsers that auto decode it. All references to location.href should be // replaced with a call to this method so that it can be dealt with properly here getLocation: function( url ) { var uri = url ? this.parseUrl( url ) : location, hash = this.parseUrl( url || location.href ).hash; // mimic the browser with an empty string when the hash is empty hash = hash === "#" ? "" : hash; // Make sure to parse the url or the location object for the hash because using location.hash // is autodecoded in firefox, the rest of the url should be from the object (location unless // we're testing) to avoid the inclusion of the authority return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash; }, //return the original document url getDocumentUrl: function( asParsedObject ) { return asParsedObject ? $.extend( {}, path.documentUrl ) : path.documentUrl.href; }, parseLocation: function() { return this.parseUrl( this.getLocation() ); }, //Parse a URL into a structure that allows easy access to //all of the URL components by name. parseUrl: function( url ) { // If we're passed an object, we'll assume that it is // a parsed url object and just return it back to the caller. if ( $.type( url ) === "object" ) { return url; } var matches = path.urlParseRE.exec( url || "" ) || []; // Create an object that allows the caller to access the sub-matches // by name. Note that IE returns an empty string instead of undefined, // like all other browsers do, so we normalize everything so its consistent // no matter what browser we're running on. return { href: matches[ 0 ] || "", hrefNoHash: matches[ 1 ] || "", hrefNoSearch: matches[ 2 ] || "", domain: matches[ 3 ] || "", protocol: matches[ 4 ] || "", doubleSlash: matches[ 5 ] || "", authority: matches[ 6 ] || "", username: matches[ 8 ] || "", password: matches[ 9 ] || "", host: matches[ 10 ] || "", hostname: matches[ 11 ] || "", port: matches[ 12 ] || "", pathname: matches[ 13 ] || "", directory: matches[ 14 ] || "", filename: matches[ 15 ] || "", search: matches[ 16 ] || "", hash: matches[ 17 ] || "" }; }, //Turn relPath into an asbolute path. absPath is //an optional absolute path which describes what //relPath is relative to. makePathAbsolute: function( relPath, absPath ) { var absStack, relStack, i, d; if ( relPath && relPath.charAt( 0 ) === "/" ) { return relPath; } relPath = relPath || ""; absPath = absPath ? absPath.replace( /^\/|(\/[^\/]*|[^\/]+)$/g, "" ) : ""; absStack = absPath ? absPath.split( "/" ) : []; relStack = relPath.split( "/" ); for ( i = 0; i < relStack.length; i++ ) { d = relStack[ i ]; switch ( d ) { case ".": break; case "..": if ( absStack.length ) { absStack.pop(); } break; default: absStack.push( d ); break; } } return "/" + absStack.join( "/" ); }, //Returns true if both urls have the same domain. isSameDomain: function( absUrl1, absUrl2 ) { return path.parseUrl( absUrl1 ).domain === path.parseUrl( absUrl2 ).domain; }, //Returns true for any relative variant. isRelativeUrl: function( url ) { // All relative Url variants have one thing in common, no protocol. return path.parseUrl( url ).protocol === ""; }, //Returns true for an absolute url. isAbsoluteUrl: function( url ) { return path.parseUrl( url ).protocol !== ""; }, //Turn the specified realtive URL into an absolute one. This function //can handle all relative variants (protocol, site, document, query, fragment). makeUrlAbsolute: function( relUrl, absUrl ) { if ( !path.isRelativeUrl( relUrl ) ) { return relUrl; } if ( absUrl === undefined ) { absUrl = this.documentBase; } var relObj = path.parseUrl( relUrl ), absObj = path.parseUrl( absUrl ), protocol = relObj.protocol || absObj.protocol, doubleSlash = relObj.protocol ? relObj.doubleSlash : ( relObj.doubleSlash || absObj.doubleSlash ), authority = relObj.authority || absObj.authority, hasPath = relObj.pathname !== "", pathname = path.makePathAbsolute( relObj.pathname || absObj.filename, absObj.pathname ), search = relObj.search || ( !hasPath && absObj.search ) || "", hash = relObj.hash; return protocol + doubleSlash + authority + pathname + search + hash; }, //Add search (aka query) params to the specified url. addSearchParams: function( url, params ) { var u = path.parseUrl( url ), p = ( typeof params === "object" ) ? $.param( params ) : params, s = u.search || "?"; return u.hrefNoSearch + s + ( s.charAt( s.length - 1 ) !== "?" ? "&" : "" ) + p + ( u.hash || "" ); }, convertUrlToDataUrl: function( absUrl ) { var u = path.parseUrl( absUrl ); if ( path.isEmbeddedPage( u ) ) { // For embedded pages, remove the dialog hash key as in getFilePath(), // and remove otherwise the Data Url won't match the id of the embedded Page. return u.hash .split( dialogHashKey )[0] .replace( /^#/, "" ) .replace( /\?.*$/, "" ); } else if ( path.isSameDomain( u, this.documentBase ) ) { return u.hrefNoHash.replace( this.documentBase.domain, "" ).split( dialogHashKey )[0]; } return window.decodeURIComponent(absUrl); }, //get path from current hash, or from a file path get: function( newPath ) { if ( newPath === undefined ) { newPath = path.parseLocation().hash; } return path.stripHash( newPath ).replace( /[^\/]*\.[^\/*]+$/, "" ); }, //set location hash to path set: function( path ) { location.hash = path; }, //test if a given url (string) is a path //NOTE might be exceptionally naive isPath: function( url ) { return ( /\// ).test( url ); }, //return a url path with the window's location protocol/hostname/pathname removed clean: function( url ) { return url.replace( this.documentBase.domain, "" ); }, //just return the url without an initial # stripHash: function( url ) { return url.replace( /^#/, "" ); }, stripQueryParams: function( url ) { return url.replace( /\?.*$/, "" ); }, //remove the preceding hash, any query params, and dialog notations cleanHash: function( hash ) { return path.stripHash( hash.replace( /\?.*$/, "" ).replace( dialogHashKey, "" ) ); }, isHashValid: function( hash ) { return ( /^#[^#]+$/ ).test( hash ); }, //check whether a url is referencing the same domain, or an external domain or different protocol //could be mailto, etc isExternal: function( url ) { var u = path.parseUrl( url ); return u.protocol && u.domain !== this.documentUrl.domain ? true : false; }, hasProtocol: function( url ) { return ( /^(:?\w+:)/ ).test( url ); }, isEmbeddedPage: function( url ) { var u = path.parseUrl( url ); //if the path is absolute, then we need to compare the url against //both the this.documentUrl and the documentBase. The main reason for this //is that links embedded within external documents will refer to the //application document, whereas links embedded within the application //document will be resolved against the document base. if ( u.protocol !== "" ) { return ( !this.isPath(u.hash) && u.hash && ( u.hrefNoHash === this.documentUrl.hrefNoHash || ( this.documentBaseDiffers && u.hrefNoHash === this.documentBase.hrefNoHash ) ) ); } return ( /^#/ ).test( u.href ); }, squash: function( url, resolutionUrl ) { var href, cleanedUrl, search, stateIndex, isPath = this.isPath( url ), uri = this.parseUrl( url ), preservedHash = uri.hash, uiState = ""; // produce a url against which we can resole the provided path resolutionUrl = resolutionUrl || (path.isPath(url) ? path.getLocation() : path.getDocumentUrl()); // If the url is anything but a simple string, remove any preceding hash // eg #foo/bar -> foo/bar // #foo -> #foo cleanedUrl = isPath ? path.stripHash( url ) : url; // If the url is a full url with a hash check if the parsed hash is a path // if it is, strip the #, and use it otherwise continue without change cleanedUrl = path.isPath( uri.hash ) ? path.stripHash( uri.hash ) : cleanedUrl; // Split the UI State keys off the href stateIndex = cleanedUrl.indexOf( this.uiStateKey ); // store the ui state keys for use if ( stateIndex > -1 ) { uiState = cleanedUrl.slice( stateIndex ); cleanedUrl = cleanedUrl.slice( 0, stateIndex ); } // make the cleanedUrl absolute relative to the resolution url href = path.makeUrlAbsolute( cleanedUrl, resolutionUrl ); // grab the search from the resolved url since parsing from // the passed url may not yield the correct result search = this.parseUrl( href ).search; // TODO all this crap is terrible, clean it up if ( isPath ) { // reject the hash if it's a path or it's just a dialog key if ( path.isPath( preservedHash ) || preservedHash.replace("#", "").indexOf( this.uiStateKey ) === 0) { preservedHash = ""; } // Append the UI State keys where it exists and it's been removed // from the url if ( uiState && preservedHash.indexOf( this.uiStateKey ) === -1) { preservedHash += uiState; } // make sure that pound is on the front of the hash if ( preservedHash.indexOf( "#" ) === -1 && preservedHash !== "" ) { preservedHash = "#" + preservedHash; } // reconstruct each of the pieces with the new search string and hash href = path.parseUrl( href ); href = href.protocol + "//" + href.host + href.pathname + search + preservedHash; } else { href += href.indexOf( "#" ) > -1 ? uiState : "#" + uiState; } return href; }, isPreservableHash: function( hash ) { return hash.replace( "#", "" ).indexOf( this.uiStateKey ) === 0; }, // Escape weird characters in the hash if it is to be used as a selector hashToSelector: function( hash ) { var hasHash = ( hash.substring( 0, 1 ) === "#" ); if ( hasHash ) { hash = hash.substring( 1 ); } return ( hasHash ? "#" : "" ) + hash.replace( /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g, "\\$1" ); }, // return the substring of a filepath before the sub-page key, for making // a server request getFilePath: function( path ) { var splitkey = "&" + $.mobile.subPageUrlKey; return path && path.split( splitkey )[0].split( dialogHashKey )[0]; }, // check if the specified url refers to the first page in the main // application document. isFirstPageUrl: function( url ) { // We only deal with absolute paths. var u = path.parseUrl( path.makeUrlAbsolute( url, this.documentBase ) ), // Does the url have the same path as the document? samePath = u.hrefNoHash === this.documentUrl.hrefNoHash || ( this.documentBaseDiffers && u.hrefNoHash === this.documentBase.hrefNoHash ), // Get the first page element. fp = $.mobile.firstPage, // Get the id of the first page element if it has one. fpId = fp && fp[0] ? fp[0].id : undefined; // The url refers to the first page if the path matches the document and // it either has no hash value, or the hash is exactly equal to the id // of the first page element. return samePath && ( !u.hash || u.hash === "#" || ( fpId && u.hash.replace( /^#/, "" ) === fpId ) ); }, // Some embedded browsers, like the web view in Phone Gap, allow // cross-domain XHR requests if the document doing the request was loaded // via the file:// protocol. This is usually to allow the application to // "phone home" and fetch app specific data. We normally let the browser // handle external/cross-domain urls, but if the allowCrossDomainPages // option is true, we will allow cross-domain http/https requests to go // through our page loading logic. isPermittedCrossDomainRequest: function( docUrl, reqUrl ) { return $.mobile.allowCrossDomainPages && (docUrl.protocol === "file:" || docUrl.protocol === "content:") && reqUrl.search( /^https?:/ ) !== -1; } }; path.documentUrl = path.parseLocation(); $base = $( "head" ).find( "base" ); path.documentBase = $base.length ? path.parseUrl( path.makeUrlAbsolute( $base.attr( "href" ), path.documentUrl.href ) ) : path.documentUrl; path.documentBaseDiffers = (path.documentUrl.hrefNoHash !== path.documentBase.hrefNoHash); //return the original document base url path.getDocumentBase = function( asParsedObject ) { return asParsedObject ? $.extend( {}, path.documentBase ) : path.documentBase.href; }; // DEPRECATED as of 1.4.0 - remove in 1.5.0 $.extend( $.mobile, { //return the original document url getDocumentUrl: path.getDocumentUrl, //return the original document base url getDocumentBase: path.getDocumentBase }); })( jQuery ); (function( $, undefined ) { $.mobile.History = function( stack, index ) { this.stack = stack || []; this.activeIndex = index || 0; }; $.extend($.mobile.History.prototype, { getActive: function() { return this.stack[ this.activeIndex ]; }, getLast: function() { return this.stack[ this.previousIndex ]; }, getNext: function() { return this.stack[ this.activeIndex + 1 ]; }, getPrev: function() { return this.stack[ this.activeIndex - 1 ]; }, // addNew is used whenever a new page is added add: function( url, data ) { data = data || {}; //if there's forward history, wipe it if ( this.getNext() ) { this.clearForward(); } // if the hash is included in the data make sure the shape // is consistent for comparison if ( data.hash && data.hash.indexOf( "#" ) === -1) { data.hash = "#" + data.hash; } data.url = url; this.stack.push( data ); this.activeIndex = this.stack.length - 1; }, //wipe urls ahead of active index clearForward: function() { this.stack = this.stack.slice( 0, this.activeIndex + 1 ); }, find: function( url, stack, earlyReturn ) { stack = stack || this.stack; var entry, i, length = stack.length, index; for ( i = 0; i < length; i++ ) { entry = stack[i]; if ( decodeURIComponent(url) === decodeURIComponent(entry.url) || decodeURIComponent(url) === decodeURIComponent(entry.hash) ) { index = i; if ( earlyReturn ) { return index; } } } return index; }, closest: function( url ) { var closest, a = this.activeIndex; // First, take the slice of the history stack before the current index and search // for a url match. If one is found, we'll avoid avoid looking through forward history // NOTE the preference for backward history movement is driven by the fact that // most mobile browsers only have a dedicated back button, and users rarely use // the forward button in desktop browser anyhow closest = this.find( url, this.stack.slice(0, a) ); // If nothing was found in backward history check forward. The `true` // value passed as the third parameter causes the find method to break // on the first match in the forward history slice. The starting index // of the slice must then be added to the result to get the element index // in the original history stack :( :( // // TODO this is hyper confusing and should be cleaned up (ugh so bad) if ( closest === undefined ) { closest = this.find( url, this.stack.slice(a), true ); closest = closest === undefined ? closest : closest + a; } return closest; }, direct: function( opts ) { var newActiveIndex = this.closest( opts.url ), a = this.activeIndex; // save new page index, null check to prevent falsey 0 result // record the previous index for reference if ( newActiveIndex !== undefined ) { this.activeIndex = newActiveIndex; this.previousIndex = a; } // invoke callbacks where appropriate // // TODO this is also convoluted and confusing if ( newActiveIndex < a ) { ( opts.present || opts.back || $.noop )( this.getActive(), "back" ); } else if ( newActiveIndex > a ) { ( opts.present || opts.forward || $.noop )( this.getActive(), "forward" ); } else if ( newActiveIndex === undefined && opts.missing ) { opts.missing( this.getActive() ); } } }); })( jQuery ); (function( $, undefined ) { var path = $.mobile.path, initialHref = location.href; $.mobile.Navigator = function( history ) { this.history = history; this.ignoreInitialHashChange = true; $.mobile.window.bind({ "popstate.history": $.proxy( this.popstate, this ), "hashchange.history": $.proxy( this.hashchange, this ) }); }; $.extend($.mobile.Navigator.prototype, { squash: function( url, data ) { var state, href, hash = path.isPath(url) ? path.stripHash(url) : url; href = path.squash( url ); // make sure to provide this information when it isn't explicitly set in the // data object that was passed to the squash method state = $.extend({ hash: hash, url: href }, data); // replace the current url with the new href and store the state // Note that in some cases we might be replacing an url with the // same url. We do this anyways because we need to make sure that // all of our history entries have a state object associated with // them. This allows us to work around the case where $.mobile.back() // is called to transition from an external page to an embedded page. // In that particular case, a hashchange event is *NOT* generated by the browser. // Ensuring each history entry has a state object means that onPopState() // will always trigger our hashchange callback even when a hashchange event // is not fired. window.history.replaceState( state, state.title || document.title, href ); return state; }, hash: function( url, href ) { var parsed, loc, hash, resolved; // Grab the hash for recording. If the passed url is a path // we used the parsed version of the squashed url to reconstruct, // otherwise we assume it's a hash and store it directly parsed = path.parseUrl( url ); loc = path.parseLocation(); if ( loc.pathname + loc.search === parsed.pathname + parsed.search ) { // If the pathname and search of the passed url is identical to the current loc // then we must use the hash. Otherwise there will be no event // eg, url = "/foo/bar?baz#bang", location.href = "http://example.com/foo/bar?baz" hash = parsed.hash ? parsed.hash : parsed.pathname + parsed.search; } else if ( path.isPath(url) ) { resolved = path.parseUrl( href ); // If the passed url is a path, make it domain relative and remove any trailing hash hash = resolved.pathname + resolved.search + (path.isPreservableHash( resolved.hash )? resolved.hash.replace( "#", "" ) : ""); } else { hash = url; } return hash; }, // TODO reconsider name go: function( url, data, noEvents ) { var state, href, hash, popstateEvent, isPopStateEvent = $.event.special.navigate.isPushStateEnabled(); // Get the url as it would look squashed on to the current resolution url href = path.squash( url ); // sort out what the hash sould be from the url hash = this.hash( url, href ); // Here we prevent the next hash change or popstate event from doing any // history management. In the case of hashchange we don't swallow it // if there will be no hashchange fired (since that won't reset the value) // and will swallow the following hashchange if ( noEvents && hash !== path.stripHash(path.parseLocation().hash) ) { this.preventNextHashChange = noEvents; } // IMPORTANT in the case where popstate is supported the event will be triggered // directly, stopping further execution - ie, interupting the flow of this // method call to fire bindings at this expression. Below the navigate method // there is a binding to catch this event and stop its propagation. // // We then trigger a new popstate event on the window with a null state // so that the navigate events can conclude their work properly // // if the url is a path we want to preserve the query params that are available on // the current url. this.preventHashAssignPopState = true; window.location.hash = hash; // If popstate is enabled and the browser triggers `popstate` events when the hash // is set (this often happens immediately in browsers like Chrome), then the // this flag will be set to false already. If it's a browser that does not trigger // a `popstate` on hash assignement or `replaceState` then we need avoid the branch // that swallows the event created by the popstate generated by the hash assignment // At the time of this writing this happens with Opera 12 and some version of IE this.preventHashAssignPopState = false; state = $.extend({ url: href, hash: hash, title: document.title }, data); if ( isPopStateEvent ) { popstateEvent = new $.Event( "popstate" ); popstateEvent.originalEvent = { type: "popstate", state: null }; this.squash( url, state ); // Trigger a new faux popstate event to replace the one that we // caught that was triggered by the hash setting above. if ( !noEvents ) { this.ignorePopState = true; $.mobile.window.trigger( popstateEvent ); } } // record the history entry so that the information can be included // in hashchange event driven navigate events in a similar fashion to // the state that's provided by popstate this.history.add( state.url, state ); }, // This binding is intended to catch the popstate events that are fired // when execution of the `$.navigate` method stops at window.location.hash = url; // and completely prevent them from propagating. The popstate event will then be // retriggered after execution resumes // // TODO grab the original event here and use it for the synthetic event in the // second half of the navigate execution that will follow this binding popstate: function( event ) { var hash, state; // Partly to support our test suite which manually alters the support // value to test hashchange. Partly to prevent all around weirdness if ( !$.event.special.navigate.isPushStateEnabled() ) { return; } // If this is the popstate triggered by the actual alteration of the hash // prevent it completely. History is tracked manually if ( this.preventHashAssignPopState ) { this.preventHashAssignPopState = false; event.stopImmediatePropagation(); return; } // if this is the popstate triggered after the `replaceState` call in the go // method, then simply ignore it. The history entry has already been captured if ( this.ignorePopState ) { this.ignorePopState = false; return; } // If there is no state, and the history stack length is one were // probably getting the page load popstate fired by browsers like chrome // avoid it and set the one time flag to false. // TODO: Do we really need all these conditions? Comparing location hrefs // should be sufficient. if ( !event.originalEvent.state && this.history.stack.length === 1 && this.ignoreInitialHashChange ) { this.ignoreInitialHashChange = false; if ( location.href === initialHref ) { event.preventDefault(); return; } } // account for direct manipulation of the hash. That is, we will receive a popstate // when the hash is changed by assignment, and it won't have a state associated. We // then need to squash the hash. See below for handling of hash assignment that // matches an existing history entry // TODO it might be better to only add to the history stack // when the hash is adjacent to the active history entry hash = path.parseLocation().hash; if ( !event.originalEvent.state && hash ) { // squash the hash that's been assigned on the URL with replaceState // also grab the resulting state object for storage state = this.squash( hash ); // record the new hash as an additional history entry // to match the browser's treatment of hash assignment this.history.add( state.url, state ); // pass the newly created state information // along with the event event.historyState = state; // do not alter history, we've added a new history entry // so we know where we are return; } // If all else fails this is a popstate that comes from the back or forward buttons // make sure to set the state of our history stack properly, and record the directionality this.history.direct({ url: (event.originalEvent.state || {}).url || hash, // When the url is either forward or backward in history include the entry // as data on the event object for merging as data in the navigate event present: function( historyEntry, direction ) { // make sure to create a new object to pass down as the navigate event data event.historyState = $.extend({}, historyEntry); event.historyState.direction = direction; } }); }, // NOTE must bind before `navigate` special event hashchange binding otherwise the // navigation data won't be attached to the hashchange event in time for those // bindings to attach it to the `navigate` special event // TODO add a check here that `hashchange.navigate` is bound already otherwise it's // broken (exception?) hashchange: function( event ) { var history, hash; // If hashchange listening is explicitly disabled or pushstate is supported // avoid making use of the hashchange handler. if (!$.event.special.navigate.isHashChangeEnabled() || $.event.special.navigate.isPushStateEnabled() ) { return; } // On occasion explicitly want to prevent the next hash from propogating because we only // with to alter the url to represent the new state do so here if ( this.preventNextHashChange ) { this.preventNextHashChange = false; event.stopImmediatePropagation(); return; } history = this.history; hash = path.parseLocation().hash; // If this is a hashchange caused by the back or forward button // make sure to set the state of our history stack properly this.history.direct({ url: hash, // When the url is either forward or backward in history include the entry // as data on the event object for merging as data in the navigate event present: function( historyEntry, direction ) { // make sure to create a new object to pass down as the navigate event data event.hashchangeState = $.extend({}, historyEntry); event.hashchangeState.direction = direction; }, // When we don't find a hash in our history clearly we're aiming to go there // record the entry as new for future traversal // // NOTE it's not entirely clear that this is the right thing to do given that we // can't know the users intention. It might be better to explicitly _not_ // support location.hash assignment in preference to $.navigate calls // TODO first arg to add should be the href, but it causes issues in identifying // embeded pages missing: function() { history.add( hash, { hash: hash, title: document.title }); } }); } }); })( jQuery ); (function( $, undefined ) { // TODO consider queueing navigation activity until previous activities have completed // so that end users don't have to think about it. Punting for now // TODO !! move the event bindings into callbacks on the navigate event $.mobile.navigate = function( url, data, noEvents ) { $.mobile.navigate.navigator.go( url, data, noEvents ); }; // expose the history on the navigate method in anticipation of full integration with // existing navigation functionalty that is tightly coupled to the history information $.mobile.navigate.history = new $.mobile.History(); // instantiate an instance of the navigator for use within the $.navigate method $.mobile.navigate.navigator = new $.mobile.Navigator( $.mobile.navigate.history ); var loc = $.mobile.path.parseLocation(); $.mobile.navigate.history.add( loc.href, {hash: loc.hash} ); })( jQuery ); // This plugin is an experiment for abstracting away the touch and mouse // events so that developers don't have to worry about which method of input // the device their document is loaded on supports. // // The idea here is to allow the developer to register listeners for the // basic mouse events, such as mousedown, mousemove, mouseup, and click, // and the plugin will take care of registering the correct listeners // behind the scenes to invoke the listener at the fastest possible time // for that device, while still retaining the order of event firing in // the traditional mouse environment, should multiple handlers be registered // on the same element for different events. // // The current version exposes the following virtual events to jQuery bind methods: // "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel" (function( $, window, document, undefined ) { var dataPropertyName = "virtualMouseBindings", touchTargetPropertyName = "virtualTouchID", virtualEventNames = "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split( " " ), touchEventProps = "clientX clientY pageX pageY screenX screenY".split( " " ), mouseHookProps = $.event.mouseHooks ? $.event.mouseHooks.props : [], mouseEventProps = $.event.props.concat( mouseHookProps ), activeDocHandlers = {}, resetTimerID = 0, startX = 0, startY = 0, didScroll = false, clickBlockList = [], blockMouseTriggers = false, blockTouchTriggers = false, eventCaptureSupported = "addEventListener" in document, $document = $( document ), nextTouchID = 1, lastTouchID = 0, threshold, i; $.vmouse = { moveDistanceThreshold: 10, clickDistanceThreshold: 10, resetTimerDuration: 1500 }; function getNativeEvent( event ) { while ( event && typeof event.originalEvent !== "undefined" ) { event = event.originalEvent; } return event; } function createVirtualEvent( event, eventType ) { var t = event.type, oe, props, ne, prop, ct, touch, i, j, len; event = $.Event( event ); event.type = eventType; oe = event.originalEvent; props = $.event.props; // addresses separation of $.event.props in to $.event.mouseHook.props and Issue 3280 // https://github.com/jquery/jquery-mobile/issues/3280 if ( t.search( /^(mouse|click)/ ) > -1 ) { props = mouseEventProps; } // copy original event properties over to the new event // this would happen if we could call $.event.fix instead of $.Event // but we don't have a way to force an event to be fixed multiple times if ( oe ) { for ( i = props.length, prop; i; ) { prop = props[ --i ]; event[ prop ] = oe[ prop ]; } } // make sure that if the mouse and click virtual events are generated // without a .which one is defined if ( t.search(/mouse(down|up)|click/) > -1 && !event.which ) { event.which = 1; } if ( t.search(/^touch/) !== -1 ) { ne = getNativeEvent( oe ); t = ne.touches; ct = ne.changedTouches; touch = ( t && t.length ) ? t[0] : ( ( ct && ct.length ) ? ct[ 0 ] : undefined ); if ( touch ) { for ( j = 0, len = touchEventProps.length; j < len; j++) { prop = touchEventProps[ j ]; event[ prop ] = touch[ prop ]; } } } return event; } function getVirtualBindingFlags( element ) { var flags = {}, b, k; while ( element ) { b = $.data( element, dataPropertyName ); for ( k in b ) { if ( b[ k ] ) { flags[ k ] = flags.hasVirtualBinding = true; } } element = element.parentNode; } return flags; } function getClosestElementWithVirtualBinding( element, eventType ) { var b; while ( element ) { b = $.data( element, dataPropertyName ); if ( b && ( !eventType || b[ eventType ] ) ) { return element; } element = element.parentNode; } return null; } function enableTouchBindings() { blockTouchTriggers = false; } function disableTouchBindings() { blockTouchTriggers = true; } function enableMouseBindings() { lastTouchID = 0; clickBlockList.length = 0; blockMouseTriggers = false; // When mouse bindings are enabled, our // touch bindings are disabled. disableTouchBindings(); } function disableMouseBindings() { // When mouse bindings are disabled, our // touch bindings are enabled. enableTouchBindings(); } function startResetTimer() { clearResetTimer(); resetTimerID = setTimeout( function() { resetTimerID = 0; enableMouseBindings(); }, $.vmouse.resetTimerDuration ); } function clearResetTimer() { if ( resetTimerID ) { clearTimeout( resetTimerID ); resetTimerID = 0; } } function triggerVirtualEvent( eventType, event, flags ) { var ve; if ( ( flags && flags[ eventType ] ) || ( !flags && getClosestElementWithVirtualBinding( event.target, eventType ) ) ) { ve = createVirtualEvent( event, eventType ); $( event.target).trigger( ve ); } return ve; } function mouseEventCallback( event ) { var touchID = $.data( event.target, touchTargetPropertyName ), ve; if ( !blockMouseTriggers && ( !lastTouchID || lastTouchID !== touchID ) ) { ve = triggerVirtualEvent( "v" + event.type, event ); if ( ve ) { if ( ve.isDefaultPrevented() ) { event.preventDefault(); } if ( ve.isPropagationStopped() ) { event.stopPropagation(); } if ( ve.isImmediatePropagationStopped() ) { event.stopImmediatePropagation(); } } } } function handleTouchStart( event ) { var touches = getNativeEvent( event ).touches, target, flags, t; if ( touches && touches.length === 1 ) { target = event.target; flags = getVirtualBindingFlags( target ); if ( flags.hasVirtualBinding ) { lastTouchID = nextTouchID++; $.data( target, touchTargetPropertyName, lastTouchID ); clearResetTimer(); disableMouseBindings(); didScroll = false; t = getNativeEvent( event ).touches[ 0 ]; startX = t.pageX; startY = t.pageY; triggerVirtualEvent( "vmouseover", event, flags ); triggerVirtualEvent( "vmousedown", event, flags ); } } } function handleScroll( event ) { if ( blockTouchTriggers ) { return; } if ( !didScroll ) { triggerVirtualEvent( "vmousecancel", event, getVirtualBindingFlags( event.target ) ); } didScroll = true; startResetTimer(); } function handleTouchMove( event ) { if ( blockTouchTriggers ) { return; } var t = getNativeEvent( event ).touches[ 0 ], didCancel = didScroll, moveThreshold = $.vmouse.moveDistanceThreshold, flags = getVirtualBindingFlags( event.target ); didScroll = didScroll || ( Math.abs( t.pageX - startX ) > moveThreshold || Math.abs( t.pageY - startY ) > moveThreshold ); if ( didScroll && !didCancel ) { triggerVirtualEvent( "vmousecancel", event, flags ); } triggerVirtualEvent( "vmousemove", event, flags ); startResetTimer(); } function handleTouchEnd( event ) { if ( blockTouchTriggers ) { return; } disableTouchBindings(); var flags = getVirtualBindingFlags( event.target ), ve, t; triggerVirtualEvent( "vmouseup", event, flags ); if ( !didScroll ) { ve = triggerVirtualEvent( "vclick", event, flags ); if ( ve && ve.isDefaultPrevented() ) { // The target of the mouse events that follow the touchend // event don't necessarily match the target used during the // touch. This means we need to rely on coordinates for blocking // any click that is generated. t = getNativeEvent( event ).changedTouches[ 0 ]; clickBlockList.push({ touchID: lastTouchID, x: t.clientX, y: t.clientY }); // Prevent any mouse events that follow from triggering // virtual event notifications. blockMouseTriggers = true; } } triggerVirtualEvent( "vmouseout", event, flags); didScroll = false; startResetTimer(); } function hasVirtualBindings( ele ) { var bindings = $.data( ele, dataPropertyName ), k; if ( bindings ) { for ( k in bindings ) { if ( bindings[ k ] ) { return true; } } } return false; } function dummyMouseHandler() {} function getSpecialEventObject( eventType ) { var realType = eventType.substr( 1 ); return { setup: function(/* data, namespace */) { // If this is the first virtual mouse binding for this element, // add a bindings object to its data. if ( !hasVirtualBindings( this ) ) { $.data( this, dataPropertyName, {} ); } // If setup is called, we know it is the first binding for this // eventType, so initialize the count for the eventType to zero. var bindings = $.data( this, dataPropertyName ); bindings[ eventType ] = true; // If this is the first virtual mouse event for this type, // register a global handler on the document. activeDocHandlers[ eventType ] = ( activeDocHandlers[ eventType ] || 0 ) + 1; if ( activeDocHandlers[ eventType ] === 1 ) { $document.bind( realType, mouseEventCallback ); } // Some browsers, like Opera Mini, won't dispatch mouse/click events // for elements unless they actually have handlers registered on them. // To get around this, we register dummy handlers on the elements. $( this ).bind( realType, dummyMouseHandler ); // For now, if event capture is not supported, we rely on mouse handlers. if ( eventCaptureSupported ) { // If this is the first virtual mouse binding for the document, // register our touchstart handler on the document. activeDocHandlers[ "touchstart" ] = ( activeDocHandlers[ "touchstart" ] || 0) + 1; if ( activeDocHandlers[ "touchstart" ] === 1 ) { $document.bind( "touchstart", handleTouchStart ) .bind( "touchend", handleTouchEnd ) // On touch platforms, touching the screen and then dragging your finger // causes the window content to scroll after some distance threshold is // exceeded. On these platforms, a scroll prevents a click event from being // dispatched, and on some platforms, even the touchend is suppressed. To // mimic the suppression of the click event, we need to watch for a scroll // event. Unfortunately, some platforms like iOS don't dispatch scroll // events until *AFTER* the user lifts their finger (touchend). This means // we need to watch both scroll and touchmove events to figure out whether // or not a scroll happenens before the touchend event is fired. .bind( "touchmove", handleTouchMove ) .bind( "scroll", handleScroll ); } } }, teardown: function(/* data, namespace */) { // If this is the last virtual binding for this eventType, // remove its global handler from the document. --activeDocHandlers[ eventType ]; if ( !activeDocHandlers[ eventType ] ) { $document.unbind( realType, mouseEventCallback ); } if ( eventCaptureSupported ) { // If this is the last virtual mouse binding in existence, // remove our document touchstart listener. --activeDocHandlers[ "touchstart" ]; if ( !activeDocHandlers[ "touchstart" ] ) { $document.unbind( "touchstart", handleTouchStart ) .unbind( "touchmove", handleTouchMove ) .unbind( "touchend", handleTouchEnd ) .unbind( "scroll", handleScroll ); } } var $this = $( this ), bindings = $.data( this, dataPropertyName ); // teardown may be called when an element was // removed from the DOM. If this is the case, // jQuery core may have already stripped the element // of any data bindings so we need to check it before // using it. if ( bindings ) { bindings[ eventType ] = false; } // Unregister the dummy event handler. $this.unbind( realType, dummyMouseHandler ); // If this is the last virtual mouse binding on the // element, remove the binding data from the element. if ( !hasVirtualBindings( this ) ) { $this.removeData( dataPropertyName ); } } }; } // Expose our custom events to the jQuery bind/unbind mechanism. for ( i = 0; i < virtualEventNames.length; i++ ) { $.event.special[ virtualEventNames[ i ] ] = getSpecialEventObject( virtualEventNames[ i ] ); } // Add a capture click handler to block clicks. // Note that we require event capture support for this so if the device // doesn't support it, we punt for now and rely solely on mouse events. if ( eventCaptureSupported ) { document.addEventListener( "click", function( e ) { var cnt = clickBlockList.length, target = e.target, x, y, ele, i, o, touchID; if ( cnt ) { x = e.clientX; y = e.clientY; threshold = $.vmouse.clickDistanceThreshold; // The idea here is to run through the clickBlockList to see if // the current click event is in the proximity of one of our // vclick events that had preventDefault() called on it. If we find // one, then we block the click. // // Why do we have to rely on proximity? // // Because the target of the touch event that triggered the vclick // can be different from the target of the click event synthesized // by the browser. The target of a mouse/click event that is synthesized // from a touch event seems to be implementation specific. For example, // some browsers will fire mouse/click events for a link that is near // a touch event, even though the target of the touchstart/touchend event // says the user touched outside the link. Also, it seems that with most // browsers, the target of the mouse/click event is not calculated until the // time it is dispatched, so if you replace an element that you touched // with another element, the target of the mouse/click will be the new // element underneath that point. // // Aside from proximity, we also check to see if the target and any // of its ancestors were the ones that blocked a click. This is necessary // because of the strange mouse/click target calculation done in the // Android 2.1 browser, where if you click on an element, and there is a // mouse/click handler on one of its ancestors, the target will be the // innermost child of the touched element, even if that child is no where // near the point of touch. ele = target; while ( ele ) { for ( i = 0; i < cnt; i++ ) { o = clickBlockList[ i ]; touchID = 0; if ( ( ele === target && Math.abs( o.x - x ) < threshold && Math.abs( o.y - y ) < threshold ) || $.data( ele, touchTargetPropertyName ) === o.touchID ) { // XXX: We may want to consider removing matches from the block list // instead of waiting for the reset timer to fire. e.preventDefault(); e.stopPropagation(); return; } } ele = ele.parentNode; } } }, true); } })( jQuery, window, document ); (function( $, window, undefined ) { var $document = $( document ), supportTouch = $.mobile.support.touch, scrollEvent = "touchmove scroll", touchStartEvent = supportTouch ? "touchstart" : "mousedown", touchStopEvent = supportTouch ? "touchend" : "mouseup", touchMoveEvent = supportTouch ? "touchmove" : "mousemove"; // setup new event shortcuts $.each( ( "touchstart touchmove touchend " + "tap taphold " + "swipe swipeleft swiperight " + "scrollstart scrollstop" ).split( " " ), function( i, name ) { $.fn[ name ] = function( fn ) { return fn ? this.bind( name, fn ) : this.trigger( name ); }; // jQuery < 1.8 if ( $.attrFn ) { $.attrFn[ name ] = true; } }); function triggerCustomEvent( obj, eventType, event ) { var originalType = event.type; event.type = eventType; $.event.dispatch.call( obj, event ); event.type = originalType; } // also handles scrollstop $.event.special.scrollstart = { enabled: true, setup: function() { var thisObject = this, $this = $( thisObject ), scrolling, timer; function trigger( event, state ) { scrolling = state; triggerCustomEvent( thisObject, scrolling ? "scrollstart" : "scrollstop", event ); } // iPhone triggers scroll after a small delay; use touchmove instead $this.bind( scrollEvent, function( event ) { if ( !$.event.special.scrollstart.enabled ) { return; } if ( !scrolling ) { trigger( event, true ); } clearTimeout( timer ); timer = setTimeout( function() { trigger( event, false ); }, 50 ); }); }, teardown: function() { $( this ).unbind( scrollEvent ); } }; // also handles taphold $.event.special.tap = { tapholdThreshold: 750, emitTapOnTaphold: true, setup: function() { var thisObject = this, $this = $( thisObject ), isTaphold = false; $this.bind( "vmousedown", function( event ) { isTaphold = false; if ( event.which && event.which !== 1 ) { return false; } var origTarget = event.target, timer; function clearTapTimer() { clearTimeout( timer ); } function clearTapHandlers() { clearTapTimer(); $this.unbind( "vclick", clickHandler ) .unbind( "vmouseup", clearTapTimer ); $document.unbind( "vmousecancel", clearTapHandlers ); } function clickHandler( event ) { clearTapHandlers(); // ONLY trigger a 'tap' event if the start target is // the same as the stop target. if ( !isTaphold && origTarget === event.target ) { triggerCustomEvent( thisObject, "tap", event ); } else if ( isTaphold ) { event.stopPropagation(); } } $this.bind( "vmouseup", clearTapTimer ) .bind( "vclick", clickHandler ); $document.bind( "vmousecancel", clearTapHandlers ); timer = setTimeout( function() { if ( !$.event.special.tap.emitTapOnTaphold ) { isTaphold = true; } triggerCustomEvent( thisObject, "taphold", $.Event( "taphold", { target: origTarget } ) ); }, $.event.special.tap.tapholdThreshold ); }); }, teardown: function() { $( this ).unbind( "vmousedown" ).unbind( "vclick" ).unbind( "vmouseup" ); $document.unbind( "vmousecancel" ); } }; // also handles swipeleft, swiperight $.event.special.swipe = { scrollSupressionThreshold: 30, // More than this horizontal displacement, and we will suppress scrolling. durationThreshold: 1000, // More time than this, and it isn't a swipe. horizontalDistanceThreshold: 30, // Swipe horizontal displacement must be more than this. verticalDistanceThreshold: 75, // Swipe vertical displacement must be less than this. start: function( event ) { var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event; return { time: ( new Date() ).getTime(), coords: [ data.pageX, data.pageY ], origin: $( event.target ) }; }, stop: function( event ) { var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event; return { time: ( new Date() ).getTime(), coords: [ data.pageX, data.pageY ] }; }, handleSwipe: function( start, stop, thisObject, origTarget ) { if ( stop.time - start.time < $.event.special.swipe.durationThreshold && Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold && Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) { var direction = start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight"; triggerCustomEvent( thisObject, "swipe", $.Event( "swipe", { target: origTarget, swipestart: start, swipestop: stop }) ); triggerCustomEvent( thisObject, direction,$.Event( direction, { target: origTarget, swipestart: start, swipestop: stop } ) ); return true; } return false; }, setup: function() { var thisObject = this, $this = $( thisObject ); $this.bind( touchStartEvent, function( event ) { var stop, start = $.event.special.swipe.start( event ), origTarget = event.target, emitted = false; function moveHandler( event ) { if ( !start ) { return; } stop = $.event.special.swipe.stop( event ); if ( !emitted ) { emitted = $.event.special.swipe.handleSwipe( start, stop, thisObject, origTarget ); } // prevent scrolling if ( Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.scrollSupressionThreshold ) { event.preventDefault(); } } $this.bind( touchMoveEvent, moveHandler ) .one( touchStopEvent, function() { emitted = true; $this.unbind( touchMoveEvent, moveHandler ); }); }); }, teardown: function() { $( this ).unbind( touchStartEvent ).unbind( touchMoveEvent ).unbind( touchStopEvent ); } }; $.each({ scrollstop: "scrollstart", taphold: "tap", swipeleft: "swipe", swiperight: "swipe" }, function( event, sourceEvent ) { $.event.special[ event ] = { setup: function() { $( this ).bind( sourceEvent, $.noop ); }, teardown: function() { $( this ).unbind( sourceEvent ); } }; }); })( jQuery, this ); // throttled resize event (function( $ ) { $.event.special.throttledresize = { setup: function() { $( this ).bind( "resize", handler ); }, teardown: function() { $( this ).unbind( "resize", handler ); } }; var throttle = 250, handler = function() { curr = ( new Date() ).getTime(); diff = curr - lastCall; if ( diff >= throttle ) { lastCall = curr; $( this ).trigger( "throttledresize" ); } else { if ( heldCall ) { clearTimeout( heldCall ); } // Promise a held call will still execute heldCall = setTimeout( handler, throttle - diff ); } }, lastCall = 0, heldCall, curr, diff; })( jQuery ); (function( $, window ) { var win = $( window ), event_name = "orientationchange", get_orientation, last_orientation, initial_orientation_is_landscape, initial_orientation_is_default, portrait_map = { "0": true, "180": true }, ww, wh, landscape_threshold; // It seems that some device/browser vendors use window.orientation values 0 and 180 to // denote the "default" orientation. For iOS devices, and most other smart-phones tested, // the default orientation is always "portrait", but in some Android and RIM based tablets, // the default orientation is "landscape". The following code attempts to use the window // dimensions to figure out what the current orientation is, and then makes adjustments // to the to the portrait_map if necessary, so that we can properly decode the // window.orientation value whenever get_orientation() is called. // // Note that we used to use a media query to figure out what the orientation the browser // thinks it is in: // // initial_orientation_is_landscape = $.mobile.media("all and (orientation: landscape)"); // // but there was an iPhone/iPod Touch bug beginning with iOS 4.2, up through iOS 5.1, // where the browser *ALWAYS* applied the landscape media query. This bug does not // happen on iPad. if ( $.support.orientation ) { // Check the window width and height to figure out what the current orientation // of the device is at this moment. Note that we've initialized the portrait map // values to 0 and 180, *AND* we purposely check for landscape so that if we guess // wrong, , we default to the assumption that portrait is the default orientation. // We use a threshold check below because on some platforms like iOS, the iPhone // form-factor can report a larger width than height if the user turns on the // developer console. The actual threshold value is somewhat arbitrary, we just // need to make sure it is large enough to exclude the developer console case. ww = window.innerWidth || win.width(); wh = window.innerHeight || win.height(); landscape_threshold = 50; initial_orientation_is_landscape = ww > wh && ( ww - wh ) > landscape_threshold; // Now check to see if the current window.orientation is 0 or 180. initial_orientation_is_default = portrait_map[ window.orientation ]; // If the initial orientation is landscape, but window.orientation reports 0 or 180, *OR* // if the initial orientation is portrait, but window.orientation reports 90 or -90, we // need to flip our portrait_map values because landscape is the default orientation for // this device/browser. if ( ( initial_orientation_is_landscape && initial_orientation_is_default ) || ( !initial_orientation_is_landscape && !initial_orientation_is_default ) ) { portrait_map = { "-90": true, "90": true }; } } $.event.special.orientationchange = $.extend( {}, $.event.special.orientationchange, { setup: function() { // If the event is supported natively, return false so that jQuery // will bind to the event using DOM methods. if ( $.support.orientation && !$.event.special.orientationchange.disabled ) { return false; } // Get the current orientation to avoid initial double-triggering. last_orientation = get_orientation(); // Because the orientationchange event doesn't exist, simulate the // event by testing window dimensions on resize. win.bind( "throttledresize", handler ); }, teardown: function() { // If the event is not supported natively, return false so that // jQuery will unbind the event using DOM methods. if ( $.support.orientation && !$.event.special.orientationchange.disabled ) { return false; } // Because the orientationchange event doesn't exist, unbind the // resize event handler. win.unbind( "throttledresize", handler ); }, add: function( handleObj ) { // Save a reference to the bound event handler. var old_handler = handleObj.handler; handleObj.handler = function( event ) { // Modify event object, adding the .orientation property. event.orientation = get_orientation(); // Call the originally-bound event handler and return its result. return old_handler.apply( this, arguments ); }; } }); // If the event is not supported natively, this handler will be bound to // the window resize event to simulate the orientationchange event. function handler() { // Get the current orientation. var orientation = get_orientation(); if ( orientation !== last_orientation ) { // The orientation has changed, so trigger the orientationchange event. last_orientation = orientation; win.trigger( event_name ); } } // Get the current page orientation. This method is exposed publicly, should it // be needed, as jQuery.event.special.orientationchange.orientation() $.event.special.orientationchange.orientation = get_orientation = function() { var isPortrait = true, elem = document.documentElement; // prefer window orientation to the calculation based on screensize as // the actual screen resize takes place before or after the orientation change event // has been fired depending on implementation (eg android 2.3 is before, iphone after). // More testing is required to determine if a more reliable method of determining the new screensize // is possible when orientationchange is fired. (eg, use media queries + element + opacity) if ( $.support.orientation ) { // if the window orientation registers as 0 or 180 degrees report // portrait, otherwise landscape isPortrait = portrait_map[ window.orientation ]; } else { isPortrait = elem && elem.clientWidth / elem.clientHeight < 1.1; } return isPortrait ? "portrait" : "landscape"; }; $.fn[ event_name ] = function( fn ) { return fn ? this.bind( event_name, fn ) : this.trigger( event_name ); }; // jQuery < 1.8 if ( $.attrFn ) { $.attrFn[ event_name ] = true; } }( jQuery, this )); (function( $, undefined ) { // existing base tag? var baseElement = $( "head" ).children( "base" ), // base element management, defined depending on dynamic base tag support // TODO move to external widget base = { // define base element, for use in routing asset urls that are referenced // in Ajax-requested markup element: ( baseElement.length ? baseElement : $( "<base>", { href: $.mobile.path.documentBase.hrefNoHash } ).prependTo( $( "head" ) ) ), linkSelector: "[src], link[href], a[rel='external'], :jqmData(ajax='false'), a[target]", // set the generated BASE element's href to a new page's base path set: function( href ) { // we should do nothing if the user wants to manage their url base // manually if ( !$.mobile.dynamicBaseEnabled ) { return; } // we should use the base tag if we can manipulate it dynamically if ( $.support.dynamicBaseTag ) { base.element.attr( "href", $.mobile.path.makeUrlAbsolute( href, $.mobile.path.documentBase ) ); } }, rewrite: function( href, page ) { var newPath = $.mobile.path.get( href ); page.find( base.linkSelector ).each(function( i, link ) { var thisAttr = $( link ).is( "[href]" ) ? "href" : $( link ).is( "[src]" ) ? "src" : "action", thisUrl = $( link ).attr( thisAttr ); // XXX_jblas: We need to fix this so that it removes the document // base URL, and then prepends with the new page URL. // if full path exists and is same, chop it - helps IE out thisUrl = thisUrl.replace( location.protocol + "//" + location.host + location.pathname, "" ); if ( !/^(\w+:|#|\/)/.test( thisUrl ) ) { $( link ).attr( thisAttr, newPath + thisUrl ); } }); }, // set the generated BASE element's href to a new page's base path reset: function(/* href */) { base.element.attr( "href", $.mobile.path.documentBase.hrefNoSearch ); } }; $.mobile.base = base; })( jQuery ); (function( $, undefined ) { $.mobile.widgets = {}; var originalWidget = $.widget, // Record the original, non-mobileinit-modified version of $.mobile.keepNative // so we can later determine whether someone has modified $.mobile.keepNative keepNativeFactoryDefault = $.mobile.keepNative; $.widget = (function( orig ) { return function() { var constructor = orig.apply( this, arguments ), name = constructor.prototype.widgetName; constructor.initSelector = ( ( constructor.prototype.initSelector !== undefined ) ? constructor.prototype.initSelector : ":jqmData(role='" + name + "')" ); $.mobile.widgets[ name ] = constructor; return constructor; }; })( $.widget ); // Make sure $.widget still has bridge and extend methods $.extend( $.widget, originalWidget ); // For backcompat remove in 1.5 $.mobile.document.on( "create", function( event ) { $( event.target ).enhanceWithin(); }); $.widget( "mobile.page", { options: { theme: "a", domCache: false, // Deprecated in 1.4 remove in 1.5 keepNativeDefault: $.mobile.keepNative, // Deprecated in 1.4 remove in 1.5 contentTheme: null, enhanced: false }, // DEPRECATED for > 1.4 // TODO remove at 1.5 _createWidget: function() { $.Widget.prototype._createWidget.apply( this, arguments ); this._trigger( "init" ); }, _create: function() { // If false is returned by the callbacks do not create the page if ( this._trigger( "beforecreate" ) === false ) { return false; } if ( !this.options.enhanced ) { this._enhance(); } this._on( this.element, { pagebeforehide: "removeContainerBackground", pagebeforeshow: "_handlePageBeforeShow" }); this.element.enhanceWithin(); // Dialog widget is deprecated in 1.4 remove this in 1.5 if ( $.mobile.getAttribute( this.element[0], "role" ) === "dialog" && $.mobile.dialog ) { this.element.dialog(); } }, _enhance: function () { var attrPrefix = "data-" + $.mobile.ns, self = this; if ( this.options.role ) { this.element.attr( "data-" + $.mobile.ns + "role", this.options.role ); } this.element .attr( "tabindex", "0" ) .addClass( "ui-page ui-page-theme-" + this.options.theme ); // Manipulation of content os Deprecated as of 1.4 remove in 1.5 this.element.find( "[" + attrPrefix + "role='content']" ).each( function() { var $this = $( this ), theme = this.getAttribute( attrPrefix + "theme" ) || undefined; self.options.contentTheme = theme || self.options.contentTheme || ( self.options.dialog && self.options.theme ) || ( self.element.jqmData("role") === "dialog" && self.options.theme ); $this.addClass( "ui-content" ); if ( self.options.contentTheme ) { $this.addClass( "ui-body-" + ( self.options.contentTheme ) ); } // Add ARIA role $this.attr( "role", "main" ).addClass( "ui-content" ); }); }, bindRemove: function( callback ) { var page = this.element; // when dom caching is not enabled or the page is embedded bind to remove the page on hide if ( !page.data( "mobile-page" ).options.domCache && page.is( ":jqmData(external-page='true')" ) ) { // TODO use _on - that is, sort out why it doesn't work in this case page.bind( "pagehide.remove", callback || function( e, data ) { //check if this is a same page transition and if so don't remove the page if( !data.samePage ){ var $this = $( this ), prEvent = new $.Event( "pageremove" ); $this.trigger( prEvent ); if ( !prEvent.isDefaultPrevented() ) { $this.removeWithDependents(); } } }); } }, _setOptions: function( o ) { if ( o.theme !== undefined ) { this.element.removeClass( "ui-body-" + this.options.theme ).addClass( "ui-body-" + o.theme ); } if ( o.contentTheme !== undefined ) { this.element.find( "[data-" + $.mobile.ns + "='content']" ).removeClass( "ui-body-" + this.options.contentTheme ) .addClass( "ui-body-" + o.contentTheme ); } }, _handlePageBeforeShow: function(/* e */) { this.setContainerBackground(); }, // Deprecated in 1.4 remove in 1.5 removeContainerBackground: function() { this.element.closest( ":mobile-pagecontainer" ).pagecontainer({ "theme": "none" }); }, // Deprecated in 1.4 remove in 1.5 // set the page container background to the page theme setContainerBackground: function( theme ) { this.element.parent().pagecontainer( { "theme": theme || this.options.theme } ); }, // Deprecated in 1.4 remove in 1.5 keepNativeSelector: function() { var options = this.options, keepNative = $.trim( options.keepNative || "" ), globalValue = $.trim( $.mobile.keepNative ), optionValue = $.trim( options.keepNativeDefault ), // Check if $.mobile.keepNative has changed from the factory default newDefault = ( keepNativeFactoryDefault === globalValue ? "" : globalValue ), // If $.mobile.keepNative has not changed, use options.keepNativeDefault oldDefault = ( newDefault === "" ? optionValue : "" ); // Concatenate keepNative selectors from all sources where the value has // changed or, if nothing has changed, return the default return ( ( keepNative ? [ keepNative ] : [] ) .concat( newDefault ? [ newDefault ] : [] ) .concat( oldDefault ? [ oldDefault ] : [] ) .join( ", " ) ); } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.pagecontainer", { options: { theme: "a" }, initSelector: false, _create: function() { this.setLastScrollEnabled = true; // TODO consider moving the navigation handler OUT of widget into // some other object as glue between the navigate event and the // content widget load and change methods this._on( this.window, { navigate: "_filterNavigateEvents" }); this._on( this.window, { // disable an scroll setting when a hashchange has been fired, // this only works because the recording of the scroll position // is delayed for 100ms after the browser might have changed the // position because of the hashchange navigate: "_disableRecordScroll", // bind to scrollstop for the first page, "pagechange" won't be // fired in that case scrollstop: "_delayedRecordScroll" }); // TODO move from page* events to content* events this._on({ pagechange: "_afterContentChange" }); // handle initial hashchange from chrome :( this.window.one( "navigate", $.proxy(function() { this.setLastScrollEnabled = true; }, this)); }, _setOptions: function( options ) { if ( options.theme !== undefined && options.theme !== "none" ) { this.element.removeClass( "ui-overlay-" + this.options.theme ) .addClass( "ui-overlay-" + options.theme ); } else if ( options.theme !== undefined ) { this.element.removeClass( "ui-overlay-" + this.options.theme ); } this._super( options ); }, _disableRecordScroll: function() { this.setLastScrollEnabled = false; }, _enableRecordScroll: function() { this.setLastScrollEnabled = true; }, // TODO consider the name here, since it's purpose specific _afterContentChange: function() { // once the page has changed, re-enable the scroll recording this.setLastScrollEnabled = true; // remove any binding that previously existed on the get scroll // which may or may not be different than the scroll element // determined for this page previously this._off( this.window, "scrollstop" ); // determine and bind to the current scoll element which may be the // window or in the case of touch overflow the element touch overflow this._on( this.window, { scrollstop: "_delayedRecordScroll" }); }, _recordScroll: function() { // this barrier prevents setting the scroll value based on // the browser scrolling the window based on a hashchange if ( !this.setLastScrollEnabled ) { return; } var active = this._getActiveHistory(), currentScroll, minScroll, defaultScroll; if ( active ) { currentScroll = this._getScroll(); minScroll = this._getMinScroll(); defaultScroll = this._getDefaultScroll(); // Set active page's lastScroll prop. If the location we're // scrolling to is less than minScrollBack, let it go. active.lastScroll = currentScroll < minScroll ? defaultScroll : currentScroll; } }, _delayedRecordScroll: function() { setTimeout( $.proxy(this, "_recordScroll"), 100 ); }, _getScroll: function() { return this.window.scrollTop(); }, _getMinScroll: function() { return $.mobile.minScrollBack; }, _getDefaultScroll: function() { return $.mobile.defaultHomeScroll; }, _filterNavigateEvents: function( e, data ) { var url; if ( e.originalEvent && e.originalEvent.isDefaultPrevented() ) { return; } url = e.originalEvent.type.indexOf( "hashchange" ) > -1 ? data.state.hash : data.state.url; if ( !url ) { url = this._getHash(); } if ( !url || url === "#" || url.indexOf( "#" + $.mobile.path.uiStateKey ) === 0 ) { url = location.href; } this._handleNavigate( url, data.state ); }, _getHash: function() { return $.mobile.path.parseLocation().hash; }, // TODO active page should be managed by the container (ie, it should be a property) getActivePage: function() { return this.activePage; }, // TODO the first page should be a property set during _create using the logic // that currently resides in init _getInitialContent: function() { return $.mobile.firstPage; }, // TODO each content container should have a history object _getHistory: function() { return $.mobile.navigate.history; }, // TODO use _getHistory _getActiveHistory: function() { return $.mobile.navigate.history.getActive(); }, // TODO the document base should be determined at creation _getDocumentBase: function() { return $.mobile.path.documentBase; }, back: function() { this.go( -1 ); }, forward: function() { this.go( 1 ); }, go: function( steps ) { //if hashlistening is enabled use native history method if ( $.mobile.hashListeningEnabled ) { window.history.go( steps ); } else { //we are not listening to the hash so handle history internally var activeIndex = $.mobile.navigate.history.activeIndex, index = activeIndex + parseInt( steps, 10 ), url = $.mobile.navigate.history.stack[ index ].url, direction = ( steps >= 1 )? "forward" : "back"; //update the history object $.mobile.navigate.history.activeIndex = index; $.mobile.navigate.history.previousIndex = activeIndex; //change to the new page this.change( url, { direction: direction, changeHash: false, fromHashChange: true } ); } }, // TODO rename _handleDestination _handleDestination: function( to ) { var history; // clean the hash for comparison if it's a url if ( $.type(to) === "string" ) { to = $.mobile.path.stripHash( to ); } if ( to ) { history = this._getHistory(); // At this point, 'to' can be one of 3 things, a cached page // element from a history stack entry, an id, or site-relative / // absolute URL. If 'to' is an id, we need to resolve it against // the documentBase, not the location.href, since the hashchange // could've been the result of a forward/backward navigation // that crosses from an external page/dialog to an internal // page/dialog. // // TODO move check to history object or path object? to = !$.mobile.path.isPath( to ) ? ( $.mobile.path.makeUrlAbsolute( "#" + to, this._getDocumentBase() ) ) : to; // If we're about to go to an initial URL that contains a // reference to a non-existent internal page, go to the first // page instead. We know that the initial hash refers to a // non-existent page, because the initial hash did not end // up in the initial history entry // TODO move check to history object? if ( to === $.mobile.path.makeUrlAbsolute( "#" + history.initialDst, this._getDocumentBase() ) && history.stack.length && history.stack[0].url !== history.initialDst.replace( $.mobile.dialogHashKey, "" ) ) { to = this._getInitialContent(); } } return to || this._getInitialContent(); }, _handleDialog: function( changePageOptions, data ) { var to, active, activeContent = this.getActivePage(); // If current active page is not a dialog skip the dialog and continue // in the same direction if ( activeContent && !activeContent.hasClass( "ui-dialog" ) ) { // determine if we're heading forward or backward and continue // accordingly past the current dialog if ( data.direction === "back" ) { this.back(); } else { this.forward(); } // prevent changePage call return false; } else { // if the current active page is a dialog and we're navigating // to a dialog use the dialog objected saved in the stack to = data.pageUrl; active = this._getActiveHistory(); // make sure to set the role, transition and reversal // as most of this is lost by the domCache cleaning $.extend( changePageOptions, { role: active.role, transition: active.transition, reverse: data.direction === "back" }); } return to; }, _handleNavigate: function( url, data ) { //find first page via hash // TODO stripping the hash twice with handleUrl var to = $.mobile.path.stripHash( url ), history = this._getHistory(), // transition is false if it's the first page, undefined // otherwise (and may be overridden by default) transition = history.stack.length === 0 ? "none" : undefined, // default options for the changPage calls made after examining // the current state of the page and the hash, NOTE that the // transition is derived from the previous history entry changePageOptions = { changeHash: false, fromHashChange: true, reverse: data.direction === "back" }; $.extend( changePageOptions, data, { transition: ( history.getLast() || {} ).transition || transition }); // TODO move to _handleDestination ? // If this isn't the first page, if the current url is a dialog hash // key, and the initial destination isn't equal to the current target // page, use the special dialog handling if ( history.activeIndex > 0 && to.indexOf( $.mobile.dialogHashKey ) > -1 && history.initialDst !== to ) { to = this._handleDialog( changePageOptions, data ); if ( to === false ) { return; } } this._changeContent( this._handleDestination( to ), changePageOptions ); }, _changeContent: function( to, opts ) { $.mobile.changePage( to, opts ); }, _getBase: function() { return $.mobile.base; }, _getNs: function() { return $.mobile.ns; }, _enhance: function( content, role ) { // TODO consider supporting a custom callback, and passing in // the settings which includes the role return content.page({ role: role }); }, _include: function( page, settings ) { // append to page and enhance page.appendTo( this.element ); // use the page widget to enhance this._enhance( page, settings.role ); // remove page on hide page.page( "bindRemove" ); }, _find: function( absUrl ) { // TODO consider supporting a custom callback var fileUrl = this._createFileUrl( absUrl ), dataUrl = this._createDataUrl( absUrl ), page, initialContent = this._getInitialContent(); // Check to see if the page already exists in the DOM. // NOTE do _not_ use the :jqmData pseudo selector because parenthesis // are a valid url char and it breaks on the first occurence page = this.element .children( "[data-" + this._getNs() +"url='" + dataUrl + "']" ); // If we failed to find the page, check to see if the url is a // reference to an embedded page. If so, it may have been dynamically // injected by a developer, in which case it would be lacking a // data-url attribute and in need of enhancement. if ( page.length === 0 && dataUrl && !$.mobile.path.isPath( dataUrl ) ) { page = this.element.children( $.mobile.path.hashToSelector("#" + dataUrl) ) .attr( "data-" + this._getNs() + "url", dataUrl ) .jqmData( "url", dataUrl ); } // If we failed to find a page in the DOM, check the URL to see if it // refers to the first page in the application. Also check to make sure // our cached-first-page is actually in the DOM. Some user deployed // apps are pruning the first page from the DOM for various reasons. // We check for this case here because we don't want a first-page with // an id falling through to the non-existent embedded page error case. if ( page.length === 0 && $.mobile.path.isFirstPageUrl( fileUrl ) && initialContent && initialContent.parent().length ) { page = $( initialContent ); } return page; }, _getLoader: function() { return $.mobile.loading(); }, _showLoading: function( delay, theme, msg, textonly ) { // This configurable timeout allows cached pages a brief // delay to load without showing a message if ( this._loadMsg ) { return; } this._loadMsg = setTimeout($.proxy(function() { this._getLoader().loader( "show", theme, msg, textonly ); this._loadMsg = 0; }, this), delay ); }, _hideLoading: function() { // Stop message show timer clearTimeout( this._loadMsg ); this._loadMsg = 0; // Hide loading message this._getLoader().loader( "hide" ); }, _showError: function() { // make sure to remove the current loading message this._hideLoading(); // show the error message this._showLoading( 0, $.mobile.pageLoadErrorMessageTheme, $.mobile.pageLoadErrorMessage, true ); // hide the error message after a delay // TODO configuration setTimeout( $.proxy(this, "_hideLoading"), 1500 ); }, _parse: function( html, fileUrl ) { // TODO consider allowing customization of this method. It's very JQM specific var page, all = $( "<div></div>" ); //workaround to allow scripts to execute when included in page divs all.get( 0 ).innerHTML = html; page = all.find( ":jqmData(role='page'), :jqmData(role='dialog')" ).first(); //if page elem couldn't be found, create one and insert the body element's contents if ( !page.length ) { page = $( "<div data-" + this._getNs() + "role='page'>" + ( html.split( /<\/?body[^>]*>/gmi )[1] || "" ) + "</div>" ); } // TODO tagging a page with external to make sure that embedded pages aren't // removed by the various page handling code is bad. Having page handling code // in many places is bad. Solutions post 1.0 page.attr( "data-" + this._getNs() + "url", $.mobile.path.convertUrlToDataUrl(fileUrl) ) .attr( "data-" + this._getNs() + "external-page", true ); return page; }, _setLoadedTitle: function( page, html ) { //page title regexp var newPageTitle = html.match( /<title[^>]*>([^<]*)/ ) && RegExp.$1; if ( newPageTitle && !page.jqmData("title") ) { newPageTitle = $( "<div>" + newPageTitle + "</div>" ).text(); page.jqmData( "title", newPageTitle ); } }, _isRewritableBaseTag: function() { return $.mobile.dynamicBaseEnabled && !$.support.dynamicBaseTag; }, _createDataUrl: function( absoluteUrl ) { return $.mobile.path.convertUrlToDataUrl( absoluteUrl ); }, _createFileUrl: function( absoluteUrl ) { return $.mobile.path.getFilePath( absoluteUrl ); }, _triggerWithDeprecated: function( name, data, page ) { var deprecatedEvent = $.Event( "page" + name ), newEvent = $.Event( this.widgetName + name ); // DEPRECATED // trigger the old deprecated event on the page if it's provided ( page || this.element ).trigger( deprecatedEvent, data ); // use the widget trigger method for the new content* event this.element.trigger( newEvent, data ); return { deprecatedEvent: deprecatedEvent, event: newEvent }; }, // TODO it would be nice to split this up more but everything appears to be "one off" // or require ordering such that other bits are sprinkled in between parts that // could be abstracted out as a group _loadSuccess: function( absUrl, triggerData, settings, deferred ) { var fileUrl = this._createFileUrl( absUrl ), dataUrl = this._createDataUrl( absUrl ); return $.proxy(function( html, textStatus, xhr ) { //pre-parse html to check for a data-url, //use it as the new fileUrl, base path, etc var content, // TODO handle dialogs again pageElemRegex = new RegExp( "(<[^>]+\\bdata-" + this._getNs() + "role=[\"']?page[\"']?[^>]*>)" ), dataUrlRegex = new RegExp( "\\bdata-" + this._getNs() + "url=[\"']?([^\"'>]*)[\"']?" ); // data-url must be provided for the base tag so resource requests // can be directed to the correct url. loading into a temprorary // element makes these requests immediately if ( pageElemRegex.test( html ) && RegExp.$1 && dataUrlRegex.test( RegExp.$1 ) && RegExp.$1 ) { fileUrl = $.mobile.path.getFilePath( $("<div>" + RegExp.$1 + "</div>").text() ); } //dont update the base tag if we are prefetching if ( settings.prefetch === undefined ) { this._getBase().set( fileUrl ); } content = this._parse( html, fileUrl ); this._setLoadedTitle( content, html ); // Add the content reference and xhr to our triggerData. triggerData.xhr = xhr; triggerData.textStatus = textStatus; // DEPRECATED triggerData.page = content; triggerData.content = content; // If the default behavior is prevented, stop here! // Note that it is the responsibility of the listener/handler // that called preventDefault(), to resolve/reject the // deferred object within the triggerData. if ( !this._trigger( "load", undefined, triggerData ) ) { return; } // rewrite src and href attrs to use a base url if the base tag won't work if ( this._isRewritableBaseTag() && content ) { this._getBase().rewrite( fileUrl, content ); } this._include( content, settings ); // Enhancing the content may result in new dialogs/sub content being inserted // into the DOM. If the original absUrl refers to a sub-content, that is the // real content we are interested in. if ( absUrl.indexOf( "&" + $.mobile.subPageUrlKey ) > -1 ) { content = this.element.children( "[data-" + this._getNs() +"url='" + dataUrl + "']" ); } // Remove loading message. if ( settings.showLoadMsg ) { this._hideLoading(); } // BEGIN DEPRECATED --------------------------------------------------- // Let listeners know the content loaded successfully. this.element.trigger( "pageload" ); // END DEPRECATED ----------------------------------------------------- deferred.resolve( absUrl, settings, content ); }, this); }, _loadDefaults: { type: "get", data: undefined, // DEPRECATED reloadPage: false, reload: false, // By default we rely on the role defined by the @data-role attribute. role: undefined, showLoadMsg: false, // This delay allows loads that pull from browser cache to // occur without showing the loading message. loadMsgDelay: 50 }, load: function( url, options ) { // This function uses deferred notifications to let callers // know when the content is done loading, or if an error has occurred. var deferred = ( options && options.deferred ) || $.Deferred(), // The default load options with overrides specified by the caller. settings = $.extend( {}, this._loadDefaults, options ), // The DOM element for the content after it has been loaded. content = null, // The absolute version of the URL passed into the function. This // version of the URL may contain dialog/subcontent params in it. absUrl = $.mobile.path.makeUrlAbsolute( url, this._findBaseWithDefault() ), fileUrl, dataUrl, pblEvent, triggerData; // DEPRECATED reloadPage settings.reload = settings.reloadPage; // If the caller provided data, and we're using "get" request, // append the data to the URL. if ( settings.data && settings.type === "get" ) { absUrl = $.mobile.path.addSearchParams( absUrl, settings.data ); settings.data = undefined; } // If the caller is using a "post" request, reload must be true if ( settings.data && settings.type === "post" ) { settings.reload = true; } // The absolute version of the URL minus any dialog/subcontent params. // In otherwords the real URL of the content to be loaded. fileUrl = this._createFileUrl( absUrl ); // The version of the Url actually stored in the data-url attribute of // the content. For embedded content, it is just the id of the page. For // content within the same domain as the document base, it is the site // relative path. For cross-domain content (Phone Gap only) the entire // absolute Url is used to load the content. dataUrl = this._createDataUrl( absUrl ); content = this._find( absUrl ); // If it isn't a reference to the first content and refers to missing // embedded content reject the deferred and return if ( content.length === 0 && $.mobile.path.isEmbeddedPage(fileUrl) && !$.mobile.path.isFirstPageUrl(fileUrl) ) { deferred.reject( absUrl, settings ); return; } // Reset base to the default document base // TODO figure out why we doe this this._getBase().reset(); // If the content we are interested in is already in the DOM, // and the caller did not indicate that we should force a // reload of the file, we are done. Resolve the deferrred so that // users can bind to .done on the promise if ( content.length && !settings.reload ) { this._enhance( content, settings.role ); deferred.resolve( absUrl, settings, content ); //if we are reloading the content make sure we update // the base if its not a prefetch if ( !settings.prefetch ) { this._getBase().set(url); } return; } triggerData = { url: url, absUrl: absUrl, dataUrl: dataUrl, deferred: deferred, options: settings }; // Let listeners know we're about to load content. pblEvent = this._triggerWithDeprecated( "beforeload", triggerData ); // If the default behavior is prevented, stop here! if ( pblEvent.deprecatedEvent.isDefaultPrevented() || pblEvent.event.isDefaultPrevented() ) { return; } if ( settings.showLoadMsg ) { this._showLoading( settings.loadMsgDelay ); } // Reset base to the default document base. // only reset if we are not prefetching if ( settings.prefetch === undefined ) { this._getBase().reset(); } if ( !( $.mobile.allowCrossDomainPages || $.mobile.path.isSameDomain($.mobile.path.documentUrl, absUrl ) ) ) { deferred.reject( absUrl, settings ); return; } // Load the new content. $.ajax({ url: fileUrl, type: settings.type, data: settings.data, contentType: settings.contentType, dataType: "html", success: this._loadSuccess( absUrl, triggerData, settings, deferred ), error: this._loadError( absUrl, triggerData, settings, deferred ) }); }, _loadError: function( absUrl, triggerData, settings, deferred ) { return $.proxy(function( xhr, textStatus, errorThrown ) { //set base back to current path this._getBase().set( $.mobile.path.get() ); // Add error info to our triggerData. triggerData.xhr = xhr; triggerData.textStatus = textStatus; triggerData.errorThrown = errorThrown; // Let listeners know the page load failed. var plfEvent = this._triggerWithDeprecated( "loadfailed", triggerData ); // If the default behavior is prevented, stop here! // Note that it is the responsibility of the listener/handler // that called preventDefault(), to resolve/reject the // deferred object within the triggerData. if ( plfEvent.deprecatedEvent.isDefaultPrevented() || plfEvent.event.isDefaultPrevented() ) { return; } // Remove loading message. if ( settings.showLoadMsg ) { this._showError(); } deferred.reject( absUrl, settings ); }, this); }, _getTransitionHandler: function( transition ) { transition = $.mobile._maybeDegradeTransition( transition ); //find the transition handler for the specified transition. If there //isn't one in our transitionHandlers dictionary, use the default one. //call the handler immediately to kick-off the transition. return $.mobile.transitionHandlers[ transition ] || $.mobile.defaultTransitionHandler; }, // TODO move into transition handlers? _triggerCssTransitionEvents: function( to, from, prefix ) { var samePage = false; prefix = prefix || ""; // TODO decide if these events should in fact be triggered on the container if ( from ) { //Check if this is a same page transition and tell the handler in page if( to[0] === from[0] ){ samePage = true; } //trigger before show/hide events // TODO deprecate nextPage in favor of next this._triggerWithDeprecated( prefix + "hide", { nextPage: to, samePage: samePage }, from ); } // TODO deprecate prevPage in favor of previous this._triggerWithDeprecated( prefix + "show", { prevPage: from || $( "" ) }, to ); }, // TODO make private once change has been defined in the widget _cssTransition: function( to, from, options ) { var transition = options.transition, reverse = options.reverse, deferred = options.deferred, TransitionHandler, promise; this._triggerCssTransitionEvents( to, from, "before" ); // TODO put this in a binding to events *outside* the widget this._hideLoading(); TransitionHandler = this._getTransitionHandler( transition ); promise = ( new TransitionHandler( transition, reverse, to, from ) ).transition(); // TODO temporary accomodation of argument deferred promise.done(function() { deferred.resolve.apply( deferred, arguments ); }); promise.done($.proxy(function() { this._triggerCssTransitionEvents( to, from ); }, this)); }, _releaseTransitionLock: function() { //release transition lock so navigation is free again isPageTransitioning = false; if ( pageTransitionQueue.length > 0 ) { $.mobile.changePage.apply( null, pageTransitionQueue.pop() ); } }, _removeActiveLinkClass: function( force ) { //clear out the active button state $.mobile.removeActiveLinkClass( force ); }, _loadUrl: function( to, triggerData, settings ) { // preserve the original target as the dataUrl value will be // simplified eg, removing ui-state, and removing query params // from the hash this is so that users who want to use query // params have access to them in the event bindings for the page // life cycle See issue #5085 settings.target = to; settings.deferred = $.Deferred(); this.load( to, settings ); settings.deferred.done($.proxy(function( url, options, content ) { isPageTransitioning = false; // store the original absolute url so that it can be provided // to events in the triggerData of the subsequent changePage call options.absUrl = triggerData.absUrl; this.transition( content, triggerData, options ); }, this)); settings.deferred.fail($.proxy(function(/* url, options */) { this._removeActiveLinkClass( true ); this._releaseTransitionLock(); this._triggerWithDeprecated( "changefailed", triggerData ); }, this)); }, _triggerPageBeforeChange: function( to, triggerData, settings ) { var pbcEvent = new $.Event( "pagebeforechange" ); $.extend(triggerData, { toPage: to, options: settings }); // NOTE: preserve the original target as the dataUrl value will be // simplified eg, removing ui-state, and removing query params from // the hash this is so that users who want to use query params have // access to them in the event bindings for the page life cycle // See issue #5085 if ( $.type(to) === "string" ) { // if the toPage is a string simply convert it triggerData.absUrl = $.mobile.path.makeUrlAbsolute( to, this._findBaseWithDefault() ); } else { // if the toPage is a jQuery object grab the absolute url stored // in the loadPage callback where it exists triggerData.absUrl = settings.absUrl; } // Let listeners know we're about to change the current page. this.element.trigger( pbcEvent, triggerData ); // If the default behavior is prevented, stop here! if ( pbcEvent.isDefaultPrevented() ) { return false; } return true; }, change: function( to, options ) { // If we are in the midst of a transition, queue the current request. // We'll call changePage() once we're done with the current transition // to service the request. if ( isPageTransitioning ) { pageTransitionQueue.unshift( arguments ); return; } var settings = $.extend( {}, $.mobile.changePage.defaults, options ), triggerData = {}; // Make sure we have a fromPage. settings.fromPage = settings.fromPage || this.activePage; // if the page beforechange default is prevented return early if ( !this._triggerPageBeforeChange(to, triggerData, settings) ) { return; } // We allow "pagebeforechange" observers to modify the to in // the trigger data to allow for redirects. Make sure our to is // updated. We also need to re-evaluate whether it is a string, // because an object can also be replaced by a string to = triggerData.toPage; // If the caller passed us a url, call loadPage() // to make sure it is loaded into the DOM. We'll listen // to the promise object it returns so we know when // it is done loading or if an error ocurred. if ( $.type(to) === "string" ) { // Set the isPageTransitioning flag to prevent any requests from // entering this method while we are in the midst of loading a page // or transitioning. isPageTransitioning = true; this._loadUrl( to, triggerData, settings ); } else { this.transition( to, triggerData, settings ); } }, transition: function( toPage, triggerData, settings ) { var fromPage, url, pageUrl, fileUrl, active, activeIsInitialPage, historyDir, pageTitle, isDialog, alreadyThere, newPageTitle, params, cssTransitionDeferred, beforeTransition; // If we are in the midst of a transition, queue the current request. // We'll call changePage() once we're done with the current transition // to service the request. if ( isPageTransitioning ) { // make sure to only queue the to and settings values so the arguments // work with a call to the change method pageTransitionQueue.unshift( [toPage, settings] ); return; } // DEPRECATED - this call only, in favor of the before transition // if the page beforechange default is prevented return early if ( !this._triggerPageBeforeChange(toPage, triggerData, settings) ) { return; } // if the (content|page)beforetransition default is prevented return early // Note, we have to check for both the deprecated and new events beforeTransition = this._triggerWithDeprecated( "beforetransition", triggerData ); if (beforeTransition.deprecatedEvent.isDefaultPrevented() || beforeTransition.event.isDefaultPrevented() ) { return; } // Set the isPageTransitioning flag to prevent any requests from // entering this method while we are in the midst of loading a page // or transitioning. isPageTransitioning = true; // If we are going to the first-page of the application, we need to make // sure settings.dataUrl is set to the application document url. This allows // us to avoid generating a document url with an id hash in the case where the // first-page of the document has an id attribute specified. if ( toPage[ 0 ] === $.mobile.firstPage[ 0 ] && !settings.dataUrl ) { settings.dataUrl = $.mobile.path.documentUrl.hrefNoHash; } // The caller passed us a real page DOM element. Update our // internal state and then trigger a transition to the page. fromPage = settings.fromPage; url = ( settings.dataUrl && $.mobile.path.convertUrlToDataUrl(settings.dataUrl) ) || toPage.jqmData( "url" ); // The pageUrl var is usually the same as url, except when url is obscured // as a dialog url. pageUrl always contains the file path pageUrl = url; fileUrl = $.mobile.path.getFilePath( url ); active = $.mobile.navigate.history.getActive(); activeIsInitialPage = $.mobile.navigate.history.activeIndex === 0; historyDir = 0; pageTitle = document.title; isDialog = ( settings.role === "dialog" || toPage.jqmData( "role" ) === "dialog" ) && toPage.jqmData( "dialog" ) !== true; // By default, we prevent changePage requests when the fromPage and toPage // are the same element, but folks that generate content // manually/dynamically and reuse pages want to be able to transition to // the same page. To allow this, they will need to change the default // value of allowSamePageTransition to true, *OR*, pass it in as an // option when they manually call changePage(). It should be noted that // our default transition animations assume that the formPage and toPage // are different elements, so they may behave unexpectedly. It is up to // the developer that turns on the allowSamePageTransitiona option to // either turn off transition animations, or make sure that an appropriate // animation transition is used. if ( fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition ) { isPageTransitioning = false; this._triggerWithDeprecated( "transition", triggerData ); this.element.trigger( "pagechange", triggerData ); // Even if there is no page change to be done, we should keep the // urlHistory in sync with the hash changes if ( settings.fromHashChange ) { $.mobile.navigate.history.direct({ url: url }); } return; } // We need to make sure the page we are given has already been enhanced. toPage.page({ role: settings.role }); // If the changePage request was sent from a hashChange event, check to // see if the page is already within the urlHistory stack. If so, we'll // assume the user hit the forward/back button and will try to match the // transition accordingly. if ( settings.fromHashChange ) { historyDir = settings.direction === "back" ? -1 : 1; } // Kill the keyboard. // XXX_jblas: We need to stop crawling the entire document to kill focus. // Instead, we should be tracking focus with a delegate() // handler so we already have the element in hand at this // point. // Wrap this in a try/catch block since IE9 throw "Unspecified error" if // document.activeElement is undefined when we are in an IFrame. try { if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) { $( document.activeElement ).blur(); } else { $( "input:focus, textarea:focus, select:focus" ).blur(); } } catch( e ) {} // Record whether we are at a place in history where a dialog used to be - // if so, do not add a new history entry and do not change the hash either alreadyThere = false; // If we're displaying the page as a dialog, we don't want the url // for the dialog content to be used in the hash. Instead, we want // to append the dialogHashKey to the url of the current page. if ( isDialog && active ) { // on the initial page load active.url is undefined and in that case // should be an empty string. Moving the undefined -> empty string back // into urlHistory.addNew seemed imprudent given undefined better // represents the url state // If we are at a place in history that once belonged to a dialog, reuse // this state without adding to urlHistory and without modifying the // hash. However, if a dialog is already displayed at this point, and // we're about to display another dialog, then we must add another hash // and history entry on top so that one may navigate back to the // original dialog if ( active.url && active.url.indexOf( $.mobile.dialogHashKey ) > -1 && this.activePage && !this.activePage.hasClass( "ui-dialog" ) && $.mobile.navigate.history.activeIndex > 0 ) { settings.changeHash = false; alreadyThere = true; } // Normally, we tack on a dialog hash key, but if this is the location // of a stale dialog, we reuse the URL from the entry url = ( active.url || "" ); // account for absolute urls instead of just relative urls use as hashes if ( !alreadyThere && url.indexOf("#") > -1 ) { url += $.mobile.dialogHashKey; } else { url += "#" + $.mobile.dialogHashKey; } // tack on another dialogHashKey if this is the same as the initial hash // this makes sure that a history entry is created for this dialog if ( $.mobile.navigate.history.activeIndex === 0 && url === $.mobile.navigate.history.initialDst ) { url += $.mobile.dialogHashKey; } } // if title element wasn't found, try the page div data attr too // If this is a deep-link or a reload ( active === undefined ) then just // use pageTitle newPageTitle = ( !active ) ? pageTitle : toPage.jqmData( "title" ) || toPage.children( ":jqmData(role='header')" ).find( ".ui-title" ).text(); if ( !!newPageTitle && pageTitle === document.title ) { pageTitle = newPageTitle; } if ( !toPage.jqmData( "title" ) ) { toPage.jqmData( "title", pageTitle ); } // Make sure we have a transition defined. settings.transition = settings.transition || ( ( historyDir && !activeIsInitialPage ) ? active.transition : undefined ) || ( isDialog ? $.mobile.defaultDialogTransition : $.mobile.defaultPageTransition ); //add page to history stack if it's not back or forward if ( !historyDir && alreadyThere ) { $.mobile.navigate.history.getActive().pageUrl = pageUrl; } // Set the location hash. if ( url && !settings.fromHashChange ) { // rebuilding the hash here since we loose it earlier on // TODO preserve the originally passed in path if ( !$.mobile.path.isPath( url ) && url.indexOf( "#" ) < 0 ) { url = "#" + url; } // TODO the property names here are just silly params = { transition: settings.transition, title: pageTitle, pageUrl: pageUrl, role: settings.role }; if ( settings.changeHash !== false && $.mobile.hashListeningEnabled ) { $.mobile.navigate( url, params, true); } else if ( toPage[ 0 ] !== $.mobile.firstPage[ 0 ] ) { $.mobile.navigate.history.add( url, params ); } } //set page title document.title = pageTitle; //set "toPage" as activePage deprecated in 1.4 remove in 1.5 $.mobile.activePage = toPage; //new way to handle activePage this.activePage = toPage; // If we're navigating back in the URL history, set reverse accordingly. settings.reverse = settings.reverse || historyDir < 0; cssTransitionDeferred = $.Deferred(); this._cssTransition(toPage, fromPage, { transition: settings.transition, reverse: settings.reverse, deferred: cssTransitionDeferred }); cssTransitionDeferred.done($.proxy(function( name, reverse, $to, $from, alreadyFocused ) { $.mobile.removeActiveLinkClass(); //if there's a duplicateCachedPage, remove it from the DOM now that it's hidden if ( settings.duplicateCachedPage ) { settings.duplicateCachedPage.remove(); } // despite visibility: hidden addresses issue #2965 // https://github.com/jquery/jquery-mobile/issues/2965 if ( !alreadyFocused ) { $.mobile.focusPage( toPage ); } this._releaseTransitionLock(); this.element.trigger( "pagechange", triggerData ); this._triggerWithDeprecated( "transition", triggerData ); }, this)); }, // determine the current base url _findBaseWithDefault: function() { var closestBase = ( this.activePage && $.mobile.getClosestBaseUrl( this.activePage ) ); return closestBase || $.mobile.path.documentBase.hrefNoHash; } }); // The following handlers should be bound after mobileinit has been triggered // the following deferred is resolved in the init file $.mobile.navreadyDeferred = $.Deferred(); //these variables make all page containers use the same queue and only navigate one at a time // queue to hold simultanious page transitions var pageTransitionQueue = [], // indicates whether or not page is in process of transitioning isPageTransitioning = false; })( jQuery ); (function( $, undefined ) { // resolved on domready var domreadyDeferred = $.Deferred(), documentUrl = $.mobile.path.documentUrl, // used to track last vclicked element to make sure its value is added to form data $lastVClicked = null; /* Event Bindings - hashchange, submit, and click */ function findClosestLink( ele ) { while ( ele ) { // Look for the closest element with a nodeName of "a". // Note that we are checking if we have a valid nodeName // before attempting to access it. This is because the // node we get called with could have originated from within // an embedded SVG document where some symbol instance elements // don't have nodeName defined on them, or strings are of type // SVGAnimatedString. if ( ( typeof ele.nodeName === "string" ) && ele.nodeName.toLowerCase() === "a" ) { break; } ele = ele.parentNode; } return ele; } $.mobile.loadPage = function( url, opts ) { var container; opts = opts || {}; container = ( opts.pageContainer || $.mobile.pageContainer ); // create the deferred that will be supplied to loadPage callers // and resolved by the content widget's load method opts.deferred = $.Deferred(); // Preferring to allow exceptions for uninitialized opts.pageContainer // widgets so we know if we need to force init here for users container.pagecontainer( "load", url, opts ); // provide the deferred return opts.deferred.promise(); }; //define vars for interal use /* internal utility functions */ // NOTE Issue #4950 Android phonegap doesn't navigate back properly // when a full page refresh has taken place. It appears that hashchange // and replacestate history alterations work fine but we need to support // both forms of history traversal in our code that uses backward history // movement $.mobile.back = function() { var nav = window.navigator; // if the setting is on and the navigator object is // available use the phonegap navigation capability if ( this.phonegapNavigationEnabled && nav && nav.app && nav.app.backHistory ) { nav.app.backHistory(); } else { $.mobile.pageContainer.pagecontainer( "back" ); } }; //direct focus to the page title, or otherwise first focusable element $.mobile.focusPage = function ( page ) { var autofocus = page.find( "[autofocus]" ), pageTitle = page.find( ".ui-title:eq(0)" ); if ( autofocus.length ) { autofocus.focus(); return; } if ( pageTitle.length ) { pageTitle.focus(); } else{ page.focus(); } }; // No-op implementation of transition degradation $.mobile._maybeDegradeTransition = $.mobile._maybeDegradeTransition || function( transition ) { return transition; }; /* exposed $.mobile methods */ //animation complete callback $.fn.animationComplete = function( callback ) { if ( $.support.cssTransitions ) { return $( this ).one( "webkitAnimationEnd animationend", callback ); } else{ // defer execution for consistency between webkit/non webkit setTimeout( callback, 0 ); return $( this ); } }; $.mobile.changePage = function( to, options ) { $.mobile.pageContainer.pagecontainer( "change", to, options ); }; $.mobile.changePage.defaults = { transition: undefined, reverse: false, changeHash: true, fromHashChange: false, role: undefined, // By default we rely on the role defined by the @data-role attribute. duplicateCachedPage: undefined, pageContainer: undefined, showLoadMsg: true, //loading message shows by default when pages are being fetched during changePage dataUrl: undefined, fromPage: undefined, allowSamePageTransition: false }; $.mobile._registerInternalEvents = function() { var getAjaxFormData = function( $form, calculateOnly ) { var url, ret = true, formData, vclickedName, method; if ( !$.mobile.ajaxEnabled || // test that the form is, itself, ajax false $form.is( ":jqmData(ajax='false')" ) || // test that $.mobile.ignoreContentEnabled is set and // the form or one of it's parents is ajax=false !$form.jqmHijackable().length || $form.attr( "target" ) ) { return false; } url = ( $lastVClicked && $lastVClicked.attr( "formaction" ) ) || $form.attr( "action" ); method = ( $form.attr( "method" ) || "get" ).toLowerCase(); // If no action is specified, browsers default to using the // URL of the document containing the form. Since we dynamically // pull in pages from external documents, the form should submit // to the URL for the source document of the page containing // the form. if ( !url ) { // Get the @data-url for the page containing the form. url = $.mobile.getClosestBaseUrl( $form ); // NOTE: If the method is "get", we need to strip off the query string // because it will get replaced with the new form data. See issue #5710. if ( method === "get" ) { url = $.mobile.path.parseUrl( url ).hrefNoSearch; } if ( url === $.mobile.path.documentBase.hrefNoHash ) { // The url we got back matches the document base, // which means the page must be an internal/embedded page, // so default to using the actual document url as a browser // would. url = documentUrl.hrefNoSearch; } } url = $.mobile.path.makeUrlAbsolute( url, $.mobile.getClosestBaseUrl( $form ) ); if ( ( $.mobile.path.isExternal( url ) && !$.mobile.path.isPermittedCrossDomainRequest( documentUrl, url ) ) ) { return false; } if ( !calculateOnly ) { formData = $form.serializeArray(); if ( $lastVClicked && $lastVClicked[ 0 ].form === $form[ 0 ] ) { vclickedName = $lastVClicked.attr( "name" ); if ( vclickedName ) { // Make sure the last clicked element is included in the form $.each( formData, function( key, value ) { if ( value.name === vclickedName ) { // Unset vclickedName - we've found it in the serialized data already vclickedName = ""; return false; } }); if ( vclickedName ) { formData.push( { name: vclickedName, value: $lastVClicked.attr( "value" ) } ); } } } ret = { url: url, options: { type: method, data: $.param( formData ), transition: $form.jqmData( "transition" ), reverse: $form.jqmData( "direction" ) === "reverse", reloadPage: true } }; } return ret; }; //bind to form submit events, handle with Ajax $.mobile.document.delegate( "form", "submit", function( event ) { var formData; if ( !event.isDefaultPrevented() ) { formData = getAjaxFormData( $( this ) ); if ( formData ) { $.mobile.changePage( formData.url, formData.options ); event.preventDefault(); } } }); //add active state on vclick $.mobile.document.bind( "vclick", function( event ) { var $btn, btnEls, target = event.target, needClosest = false; // if this isn't a left click we don't care. Its important to note // that when the virtual event is generated it will create the which attr if ( event.which > 1 || !$.mobile.linkBindingEnabled ) { return; } // Record that this element was clicked, in case we need it for correct // form submission during the "submit" handler above $lastVClicked = $( target ); // Try to find a target element to which the active class will be applied if ( $.data( target, "mobile-button" ) ) { // If the form will not be submitted via AJAX, do not add active class if ( !getAjaxFormData( $( target ).closest( "form" ), true ) ) { return; } // We will apply the active state to this button widget - the parent // of the input that was clicked will have the associated data if ( target.parentNode ) { target = target.parentNode; } } else { target = findClosestLink( target ); if ( !( target && $.mobile.path.parseUrl( target.getAttribute( "href" ) || "#" ).hash !== "#" ) ) { return; } // TODO teach $.mobile.hijackable to operate on raw dom elements so the // link wrapping can be avoided if ( !$( target ).jqmHijackable().length ) { return; } } // Avoid calling .closest by using the data set during .buttonMarkup() // List items have the button data in the parent of the element clicked if ( !!~target.className.indexOf( "ui-link-inherit" ) ) { if ( target.parentNode ) { btnEls = $.data( target.parentNode, "buttonElements" ); } // Otherwise, look for the data on the target itself } else { btnEls = $.data( target, "buttonElements" ); } // If found, grab the button's outer element if ( btnEls ) { target = btnEls.outer; } else { needClosest = true; } $btn = $( target ); // If the outer element wasn't found by the our heuristics, use .closest() if ( needClosest ) { $btn = $btn.closest( ".ui-btn" ); } if ( $btn.length > 0 && !( $btn.hasClass( "ui-state-disabled" || // DEPRECATED as of 1.4.0 - remove after 1.4.0 release // only ui-state-disabled should be present thereafter $btn.hasClass( "ui-disabled" ) ) ) ) { $.mobile.removeActiveLinkClass( true ); $.mobile.activeClickedLink = $btn; $.mobile.activeClickedLink.addClass( $.mobile.activeBtnClass ); } }); // click routing - direct to HTTP or Ajax, accordingly $.mobile.document.bind( "click", function( event ) { if ( !$.mobile.linkBindingEnabled || event.isDefaultPrevented() ) { return; } var link = findClosestLink( event.target ), $link = $( link ), //remove active link class if external (then it won't be there if you come back) httpCleanup = function() { window.setTimeout(function() { $.mobile.removeActiveLinkClass( true ); }, 200 ); }, baseUrl, href, useDefaultUrlHandling, isExternal, transition, reverse, role; // If a button was clicked, clean up the active class added by vclick above if ( $.mobile.activeClickedLink && $.mobile.activeClickedLink[ 0 ] === event.target.parentNode ) { httpCleanup(); } // If there is no link associated with the click or its not a left // click we want to ignore the click // TODO teach $.mobile.hijackable to operate on raw dom elements so the link wrapping // can be avoided if ( !link || event.which > 1 || !$link.jqmHijackable().length ) { return; } //if there's a data-rel=back attr, go back in history if ( $link.is( ":jqmData(rel='back')" ) ) { $.mobile.back(); return false; } baseUrl = $.mobile.getClosestBaseUrl( $link ); //get href, if defined, otherwise default to empty hash href = $.mobile.path.makeUrlAbsolute( $link.attr( "href" ) || "#", baseUrl ); //if ajax is disabled, exit early if ( !$.mobile.ajaxEnabled && !$.mobile.path.isEmbeddedPage( href ) ) { httpCleanup(); //use default click handling return; } // XXX_jblas: Ideally links to application pages should be specified as // an url to the application document with a hash that is either // the site relative path or id to the page. But some of the // internal code that dynamically generates sub-pages for nested // lists and select dialogs, just write a hash in the link they // create. This means the actual URL path is based on whatever // the current value of the base tag is at the time this code // is called. For now we are just assuming that any url with a // hash in it is an application page reference. if ( href.search( "#" ) !== -1 ) { href = href.replace( /[^#]*#/, "" ); if ( !href ) { //link was an empty hash meant purely //for interaction, so we ignore it. event.preventDefault(); return; } else if ( $.mobile.path.isPath( href ) ) { //we have apath so make it the href we want to load. href = $.mobile.path.makeUrlAbsolute( href, baseUrl ); } else { //we have a simple id so use the documentUrl as its base. href = $.mobile.path.makeUrlAbsolute( "#" + href, documentUrl.hrefNoHash ); } } // Should we handle this link, or let the browser deal with it? useDefaultUrlHandling = $link.is( "[rel='external']" ) || $link.is( ":jqmData(ajax='false')" ) || $link.is( "[target]" ); // Some embedded browsers, like the web view in Phone Gap, allow cross-domain XHR // requests if the document doing the request was loaded via the file:// protocol. // This is usually to allow the application to "phone home" and fetch app specific // data. We normally let the browser handle external/cross-domain urls, but if the // allowCrossDomainPages option is true, we will allow cross-domain http/https // requests to go through our page loading logic. //check for protocol or rel and its not an embedded page //TODO overlap in logic from isExternal, rel=external check should be // moved into more comprehensive isExternalLink isExternal = useDefaultUrlHandling || ( $.mobile.path.isExternal( href ) && !$.mobile.path.isPermittedCrossDomainRequest( documentUrl, href ) ); if ( isExternal ) { httpCleanup(); //use default click handling return; } //use ajax transition = $link.jqmData( "transition" ); reverse = $link.jqmData( "direction" ) === "reverse" || // deprecated - remove by 1.0 $link.jqmData( "back" ); //this may need to be more specific as we use data-rel more role = $link.attr( "data-" + $.mobile.ns + "rel" ) || undefined; $.mobile.changePage( href, { transition: transition, reverse: reverse, role: role, link: $link } ); event.preventDefault(); }); //prefetch pages when anchors with data-prefetch are encountered $.mobile.document.delegate( ".ui-page", "pageshow.prefetch", function() { var urls = []; $( this ).find( "a:jqmData(prefetch)" ).each(function() { var $link = $( this ), url = $link.attr( "href" ); if ( url && $.inArray( url, urls ) === -1 ) { urls.push( url ); $.mobile.loadPage( url, { role: $link.attr( "data-" + $.mobile.ns + "rel" ),prefetch: true } ); } }); }); // TODO ensure that the navigate binding in the content widget happens at the right time $.mobile.pageContainer.pagecontainer(); //set page min-heights to be device specific $.mobile.document.bind( "pageshow", $.mobile.resetActivePageHeight ); $.mobile.window.bind( "throttledresize", $.mobile.resetActivePageHeight ); };//navreadyDeferred done callback $( function() { domreadyDeferred.resolve(); } ); $.when( domreadyDeferred, $.mobile.navreadyDeferred ).done( function() { $.mobile._registerInternalEvents(); } ); })( jQuery ); (function( $, window, undefined ) { // TODO remove direct references to $.mobile and properties, we should // favor injection with params to the constructor $.mobile.Transition = function() { this.init.apply( this, arguments ); }; $.extend($.mobile.Transition.prototype, { toPreClass: " ui-page-pre-in", init: function( name, reverse, $to, $from ) { $.extend(this, { name: name, reverse: reverse, $to: $to, $from: $from, deferred: new $.Deferred() }); }, cleanFrom: function() { this.$from .removeClass( $.mobile.activePageClass + " out in reverse " + this.name ) .height( "" ); }, // NOTE overridden by child object prototypes, noop'd here as defaults beforeDoneIn: function() {}, beforeDoneOut: function() {}, beforeStartOut: function() {}, doneIn: function() { this.beforeDoneIn(); this.$to.removeClass( "out in reverse " + this.name ).height( "" ); this.toggleViewportClass(); // In some browsers (iOS5), 3D transitions block the ability to scroll to the desired location during transition // This ensures we jump to that spot after the fact, if we aren't there already. if ( $.mobile.window.scrollTop() !== this.toScroll ) { this.scrollPage(); } if ( !this.sequential ) { this.$to.addClass( $.mobile.activePageClass ); } this.deferred.resolve( this.name, this.reverse, this.$to, this.$from, true ); }, doneOut: function( screenHeight, reverseClass, none, preventFocus ) { this.beforeDoneOut(); this.startIn( screenHeight, reverseClass, none, preventFocus ); }, hideIn: function( callback ) { // Prevent flickering in phonegap container: see comments at #4024 regarding iOS this.$to.css( "z-index", -10 ); callback.call( this ); this.$to.css( "z-index", "" ); }, scrollPage: function() { // By using scrollTo instead of silentScroll, we can keep things better in order // Just to be precautios, disable scrollstart listening like silentScroll would $.event.special.scrollstart.enabled = false; //if we are hiding the url bar or the page was previously scrolled scroll to hide or return to position if ( $.mobile.hideUrlBar || this.toScroll !== $.mobile.defaultHomeScroll ) { window.scrollTo( 0, this.toScroll ); } // reenable scrollstart listening like silentScroll would setTimeout( function() { $.event.special.scrollstart.enabled = true; }, 150 ); }, startIn: function( screenHeight, reverseClass, none, preventFocus ) { this.hideIn(function() { this.$to.addClass( $.mobile.activePageClass + this.toPreClass ); // Send focus to page as it is now display: block if ( !preventFocus ) { $.mobile.focusPage( this.$to ); } // Set to page height this.$to.height( screenHeight + this.toScroll ); if ( !none ) { this.scrollPage(); } }); if ( !none ) { this.$to.animationComplete( $.proxy(function() { this.doneIn(); }, this )); } this.$to .removeClass( this.toPreClass ) .addClass( this.name + " in " + reverseClass ); if ( none ) { this.doneIn(); } }, startOut: function( screenHeight, reverseClass, none ) { this.beforeStartOut( screenHeight, reverseClass, none ); // Set the from page's height and start it transitioning out // Note: setting an explicit height helps eliminate tiling in the transitions this.$from .height( screenHeight + $.mobile.window.scrollTop() ) .addClass( this.name + " out" + reverseClass ); }, toggleViewportClass: function() { $.mobile.pageContainer.toggleClass( "ui-mobile-viewport-transitioning viewport-" + this.name ); }, transition: function() { // NOTE many of these could be calculated/recorded in the constructor, it's my // opinion that binding them as late as possible has value with regards to // better transitions with fewer bugs. Ie, it's not guaranteed that the // object will be created and transition will be run immediately after as // it is today. So we wait until transition is invoked to gather the following var reverseClass = this.reverse ? " reverse" : "", screenHeight = $.mobile.getScreenHeight(), maxTransitionOverride = $.mobile.maxTransitionWidth !== false && $.mobile.window.width() > $.mobile.maxTransitionWidth, none = !$.support.cssTransitions || !$.support.cssAnimations || maxTransitionOverride || !this.name || this.name === "none" || Math.max( $.mobile.window.scrollTop(), this.toScroll ) > $.mobile.getMaxScrollForTransition(); this.toScroll = $.mobile.navigate.history.getActive().lastScroll || $.mobile.defaultHomeScroll; this.toggleViewportClass(); if ( this.$from && !none ) { this.startOut( screenHeight, reverseClass, none ); } else { this.doneOut( screenHeight, reverseClass, none, true ); } return this.deferred.promise(); } }); })( jQuery, this ); (function( $ ) { $.mobile.SerialTransition = function() { this.init.apply(this, arguments); }; $.extend($.mobile.SerialTransition.prototype, $.mobile.Transition.prototype, { sequential: true, beforeDoneOut: function() { if ( this.$from ) { this.cleanFrom(); } }, beforeStartOut: function( screenHeight, reverseClass, none ) { this.$from.animationComplete($.proxy(function() { this.doneOut( screenHeight, reverseClass, none ); }, this )); } }); })( jQuery ); (function( $ ) { $.mobile.ConcurrentTransition = function() { this.init.apply(this, arguments); }; $.extend($.mobile.ConcurrentTransition.prototype, $.mobile.Transition.prototype, { sequential: false, beforeDoneIn: function() { if ( this.$from ) { this.cleanFrom(); } }, beforeStartOut: function( screenHeight, reverseClass, none ) { this.doneOut( screenHeight, reverseClass, none ); } }); })( jQuery ); (function( $ ) { // generate the handlers from the above var defaultGetMaxScrollForTransition = function() { return $.mobile.getScreenHeight() * 3; }; //transition handler dictionary for 3rd party transitions $.mobile.transitionHandlers = { "sequential": $.mobile.SerialTransition, "simultaneous": $.mobile.ConcurrentTransition }; // Make our transition handler the public default. $.mobile.defaultTransitionHandler = $.mobile.transitionHandlers.sequential; $.mobile.transitionFallbacks = {}; // If transition is defined, check if css 3D transforms are supported, and if not, if a fallback is specified $.mobile._maybeDegradeTransition = function( transition ) { if ( transition && !$.support.cssTransform3d && $.mobile.transitionFallbacks[ transition ] ) { transition = $.mobile.transitionFallbacks[ transition ]; } return transition; }; // Set the getMaxScrollForTransition to default if no implementation was set by user $.mobile.getMaxScrollForTransition = $.mobile.getMaxScrollForTransition || defaultGetMaxScrollForTransition; })( jQuery ); /* * fallback transition for flip in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.flip = "fade"; })( jQuery, this ); /* * fallback transition for flow in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.flow = "fade"; })( jQuery, this ); /* * fallback transition for pop in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.pop = "fade"; })( jQuery, this ); /* * fallback transition for slide in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { // Use the simultaneous transitions handler for slide transitions $.mobile.transitionHandlers.slide = $.mobile.transitionHandlers.simultaneous; // Set the slide transitions's fallback to "fade" $.mobile.transitionFallbacks.slide = "fade"; })( jQuery, this ); /* * fallback transition for slidedown in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.slidedown = "fade"; })( jQuery, this ); /* * fallback transition for slidefade in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { // Set the slide transitions's fallback to "fade" $.mobile.transitionFallbacks.slidefade = "fade"; })( jQuery, this ); /* * fallback transition for slideup in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.slideup = "fade"; })( jQuery, this ); /* * fallback transition for turn in non-3D supporting browsers (which tend to handle complex transitions poorly in general */ (function( $, window, undefined ) { $.mobile.transitionFallbacks.turn = "fade"; })( jQuery, this ); (function( $, undefined ) { $.mobile.degradeInputs = { color: false, date: false, datetime: false, "datetime-local": false, email: false, month: false, number: false, range: "number", search: "text", tel: false, time: false, url: false, week: false }; // Backcompat remove in 1.5 $.mobile.page.prototype.options.degradeInputs = $.mobile.degradeInputs; // Auto self-init widgets $.mobile.degradeInputsWithin = function( target ) { target = $( target ); // Degrade inputs to avoid poorly implemented native functionality target.find( "input" ).not( $.mobile.page.prototype.keepNativeSelector() ).each(function() { var element = $( this ), type = this.getAttribute( "type" ), optType = $.mobile.degradeInputs[ type ] || "text", html, hasType, findstr, repstr; if ( $.mobile.degradeInputs[ type ] ) { html = $( "<div>" ).html( element.clone() ).html(); // In IE browsers, the type sometimes doesn't exist in the cloned markup, so we replace the closing tag instead hasType = html.indexOf( " type=" ) > -1; findstr = hasType ? /\s+type=["']?\w+['"]?/ : /\/?>/; repstr = " type=\"" + optType + "\" data-" + $.mobile.ns + "type=\"" + type + "\"" + ( hasType ? "" : ">" ); element.replaceWith( html.replace( findstr, repstr ) ); } }); }; })( jQuery ); (function( $, window, undefined ) { $.widget( "mobile.page", $.mobile.page, { options: { // Accepts left, right and none closeBtn: "left", closeBtnText: "Close", overlayTheme: "a", corners: true, dialog: false }, _create: function() { this._super(); if ( this.options.dialog ) { $.extend( this, { _inner: this.element.children(), _headerCloseButton: null }); if ( !this.options.enhanced ) { this._setCloseBtn( this.options.closeBtn ); } } }, _enhance: function() { this._super(); // Class the markup for dialog styling and wrap interior if ( this.options.dialog ) { this.element.addClass( "ui-dialog" ) .wrapInner( $( "<div/>", { // ARIA role "role" : "dialog", "class" : "ui-dialog-contain ui-overlay-shadow" + ( this.options.corners ? " ui-corner-all" : "" ) })); } }, _setOptions: function( options ) { var closeButtonLocation, closeButtonText, currentOpts = this.options; if ( options.corners !== undefined ) { this._inner.toggleClass( "ui-corner-all", !!options.corners ); } if ( options.overlayTheme !== undefined ) { if ( $.mobile.activePage[ 0 ] === this.element[ 0 ] ) { currentOpts.overlayTheme = options.overlayTheme; this._handlePageBeforeShow(); } } if ( options.closeBtnText !== undefined ) { closeButtonLocation = currentOpts.closeBtn; closeButtonText = options.closeBtnText; } if ( options.closeBtn !== undefined ) { closeButtonLocation = options.closeBtn; } if ( closeButtonLocation ) { this._setCloseBtn( closeButtonLocation, closeButtonText ); } this._super( options ); }, _handlePageBeforeShow: function () { if ( this.options.overlayTheme && this.options.dialog ) { this.removeContainerBackground(); this.setContainerBackground( this.options.overlayTheme ); } else { this._super(); } }, _setCloseBtn: function( location, text ) { var dst, btn = this._headerCloseButton; // Sanitize value location = "left" === location ? "left" : "right" === location ? "right" : "none"; if ( "none" === location ) { if ( btn ) { btn.remove(); btn = null; } } else if ( btn ) { btn.removeClass( "ui-btn-left ui-btn-right" ).addClass( "ui-btn-" + location ); if ( text ) { btn.text( text ); } } else { dst = this._inner.find( ":jqmData(role='header')" ).first(); btn = $( "<a></a>", { "href": "#", "class": "ui-btn ui-corner-all ui-icon-delete ui-btn-icon-notext ui-btn-" + location }) .attr( "data-" + $.mobile.ns + "rel", "back" ) .text( text || this.options.closeBtnText || "" ) .prependTo( dst ); this._on( btn, { click: "close" } ); } this._headerCloseButton = btn; } }); })( jQuery, this ); (function( $, window, undefined ) { $.widget( "mobile.dialog", { options: { // Accepts left, right and none closeBtn: "left", closeBtnText: "Close", overlayTheme: "a", corners: true }, // Override the theme set by the page plugin on pageshow _handlePageBeforeShow: function() { this._isCloseable = true; if ( this.options.overlayTheme ) { this.element .page( "removeContainerBackground" ) .page( "setContainerBackground", this.options.overlayTheme ); } }, _handlePageBeforeHide: function() { this._isCloseable = false; }, // click and submit events: // - clicks and submits should use the closing transition that the dialog // opened with unless a data-transition is specified on the link/form // - if the click was on the close button, or the link has a data-rel="back" // it'll go back in history naturally _handleVClickSubmit: function( event ) { var attrs, $target = $( event.target ).closest( event.type === "vclick" ? "a" : "form" ); if ( $target.length && !$target.jqmData( "transition" ) ) { attrs = {}; attrs[ "data-" + $.mobile.ns + "transition" ] = ( $.mobile.navigate.history.getActive() || {} )[ "transition" ] || $.mobile.defaultDialogTransition; attrs[ "data-" + $.mobile.ns + "direction" ] = "reverse"; $target.attr( attrs ); } }, _create: function() { var elem = this.element, opts = this.options; // Class the markup for dialog styling and wrap interior elem.addClass( "ui-dialog" ) .wrapInner( $( "<div/>", { // ARIA role "role" : "dialog", "class" : "ui-dialog-contain ui-overlay-shadow" + ( !!opts.corners ? " ui-corner-all" : "" ) })); $.extend( this, { _isCloseable: false, _inner: elem.children(), _headerCloseButton: null }); this._on( elem, { vclick: "_handleVClickSubmit", submit: "_handleVClickSubmit", pagebeforeshow: "_handlePageBeforeShow", pagebeforehide: "_handlePageBeforeHide" }); this._setCloseBtn( opts.closeBtn ); }, _setOptions: function( options ) { var closeButtonLocation, closeButtonText, currentOpts = this.options; if ( options.corners !== undefined ) { this._inner.toggleClass( "ui-corner-all", !!options.corners ); } if ( options.overlayTheme !== undefined ) { if ( $.mobile.activePage[ 0 ] === this.element[ 0 ] ) { currentOpts.overlayTheme = options.overlayTheme; this._handlePageBeforeShow(); } } if ( options.closeBtnText !== undefined ) { closeButtonLocation = currentOpts.closeBtn; closeButtonText = options.closeBtnText; } if ( options.closeBtn !== undefined ) { closeButtonLocation = options.closeBtn; } if ( closeButtonLocation ) { this._setCloseBtn( closeButtonLocation, closeButtonText ); } this._super( options ); }, _setCloseBtn: function( location, text ) { var dst, btn = this._headerCloseButton; // Sanitize value location = "left" === location ? "left" : "right" === location ? "right" : "none"; if ( "none" === location ) { if ( btn ) { btn.remove(); btn = null; } } else if ( btn ) { btn.removeClass( "ui-btn-left ui-btn-right" ).addClass( "ui-btn-" + location ); if ( text ) { btn.text( text ); } } else { dst = this._inner.find( ":jqmData(role='header')" ).first(); btn = $( "<a></a>", { "role": "button", "href": "#", "class": "ui-btn ui-corner-all ui-icon-delete ui-btn-icon-notext ui-btn-" + location }) .text( text || this.options.closeBtnText || "" ) .prependTo( dst ); this._on( btn, { click: "close" } ); } this._headerCloseButton = btn; }, // Close method goes back in history close: function() { var hist = $.mobile.navigate.history; if ( this._isCloseable ) { this._isCloseable = false; // If the hash listening is enabled and there is at least one preceding history // entry it's ok to go back. Initial pages with the dialog hash state are an example // where the stack check is necessary if ( $.mobile.hashListeningEnabled && hist.activeIndex > 0 ) { $.mobile.back(); } else { $.mobile.pageContainer.pagecontainer( "back" ); } } } }); })( jQuery, this ); (function( $, undefined ) { var rInitialLetter = /([A-Z])/g; $.widget( "mobile.collapsible", { options: { enhanced: false, expandCueText: null, collapseCueText: null, collapsed: true, heading: "h1,h2,h3,h4,h5,h6,legend", collapsedIcon: null, expandedIcon: null, iconpos: null, theme: null, contentTheme: null, inset: null, corners: null, mini: null }, _create: function() { var elem = this.element, ui = { accordion: elem .closest( ":jqmData(role='collapsible-set')" + ( $.mobile.collapsibleset ? ", :mobile-collapsibleset" : "" ) ) .addClass( "ui-collapsible-set" ) }; $.extend( this, { _ui: ui }); if ( this.options.enhanced ) { ui.heading = $( ".ui-collapsible-heading", this.element[ 0 ] ); ui.content = ui.heading.next(); ui.anchor = $( "a", ui.heading[ 0 ] ).first(); ui.status = ui.anchor.children( ".ui-collapsible-heading-status" ); } else { this._enhance( elem, ui ); } this._on( ui.heading, { "tap": function() { ui.heading.find( "a" ).first().addClass( $.mobile.activeBtnClass ); }, "click": function( event ) { this._handleExpandCollapse( !ui.heading.hasClass( "ui-collapsible-heading-collapsed" ) ); event.preventDefault(); event.stopPropagation(); } }); }, // Adjust the keys inside options for inherited values _getOptions: function( options ) { var key, accordion = this._ui.accordion, accordionWidget = this._ui.accordionWidget; // Copy options options = $.extend( {}, options ); if ( accordion.length && !accordionWidget ) { this._ui.accordionWidget = accordionWidget = accordion.data( "mobile-collapsibleset" ); } for ( key in options ) { // Retrieve the option value first from the options object passed in and, if // null, from the parent accordion or, if that's null too, or if there's no // parent accordion, then from the defaults. options[ key ] = ( options[ key ] != null ) ? options[ key ] : ( accordionWidget ) ? accordionWidget.options[ key ] : accordion.length ? $.mobile.getAttribute( accordion[ 0 ], key.replace( rInitialLetter, "-$1" ).toLowerCase() ): null; if ( null == options[ key ] ) { options[ key ] = $.mobile.collapsible.defaults[ key ]; } } return options; }, _themeClassFromOption: function( prefix, value ) { return ( value ? ( value === "none" ? "" : prefix + value ) : "" ); }, _enhance: function( elem, ui ) { var iconclass, opts = this._getOptions( this.options ), contentThemeClass = this._themeClassFromOption( "ui-body-", opts.contentTheme ); elem.addClass( "ui-collapsible " + ( opts.inset ? "ui-collapsible-inset " : "" ) + ( opts.inset && opts.corners ? "ui-corner-all " : "" ) + ( contentThemeClass ? "ui-collapsible-themed-content " : "" ) ); ui.originalHeading = elem.children( this.options.heading ).first(), ui.content = elem .wrapInner( "<div " + "class='ui-collapsible-content " + contentThemeClass + "'></div>" ) .children( ".ui-collapsible-content" ), ui.heading = ui.originalHeading; // Replace collapsibleHeading if it's a legend if ( ui.heading.is( "legend" ) ) { ui.heading = $( "<div role='heading'>"+ ui.heading.html() +"</div>" ); ui.placeholder = $( "<div><!-- placeholder for legend --></div>" ).insertBefore( ui.originalHeading ); ui.originalHeading.remove(); } iconclass = ( opts.collapsed ? ( opts.collapsedIcon ? "ui-icon-" + opts.collapsedIcon : "" ): ( opts.expandedIcon ? "ui-icon-" + opts.expandedIcon : "" ) ); ui.status = $( "<span class='ui-collapsible-heading-status'></span>" ); ui.anchor = ui.heading .detach() //modify markup & attributes .addClass( "ui-collapsible-heading" ) .append( ui.status ) .wrapInner( "<a href='#' class='ui-collapsible-heading-toggle'></a>" ) .find( "a" ) .first() .addClass( "ui-btn " + ( iconclass ? iconclass + " " : "" ) + ( iconclass ? ( "ui-btn-icon-" + ( opts.iconpos === "right" ? "right" : "left" ) ) + " " : "" ) + this._themeClassFromOption( "ui-btn-", opts.theme ) + " " + ( opts.mini ? "ui-mini " : "" ) ); //drop heading in before content ui.heading.insertBefore( ui.content ); this._handleExpandCollapse( this.options.collapsed ); return ui; }, refresh: function() { var key, options = {}; for ( key in $.mobile.collapsible.defaults ) { options[ key ] = this.options[ key ]; } this._setOptions( options ); }, _setOptions: function( options ) { var isCollapsed, newTheme, oldTheme, hasCorners, elem = this.element, currentOpts = this._getOptions( this.options ), ui = this._ui, anchor = ui.anchor, status = ui.status, opts = this._getOptions( options ); // First and foremost we need to make sure the collapsible is in the proper // state, in case somebody decided to change the collapsed option at the // same time as another option if ( options.collapsed !== undefined ) { this._handleExpandCollapse( options.collapsed ); } isCollapsed = elem.hasClass( "ui-collapsible-collapsed" ); // Only options referring to the current state need to be applied right away // It is enough to store options covering the alternate in this.options. if ( isCollapsed ) { if ( opts.expandCueText !== undefined ) { status.text( opts.expandCueText ); } if ( opts.collapsedIcon !== undefined ) { if ( currentOpts.collapsedIcon ) { anchor.removeClass( "ui-icon-" + currentOpts.collapsedIcon ); } if ( opts.collapsedIcon ) { anchor.addClass( "ui-icon-" + opts.collapsedIcon ); } } } else { if ( opts.collapseCueText !== undefined ) { status.text( opts.collapseCueText ); } if ( opts.expandedIcon !== undefined ) { if ( currentOpts.expandedIcon ) { anchor.removeClass( "ui-icon-" + currentOpts.expandedIcon ); } if ( opts.expandedIcon ) { anchor.addClass( "ui-icon-" + opts.expandedIcon ); } } } if ( opts.iconpos !== undefined ) { anchor.removeClass( "ui-btn-icon-" + ( currentOpts.iconPos === "right" ? "right" : "left" ) ); anchor.addClass( "ui-btn-icon-" + ( opts.iconPos === "right" ? "right" : "left" ) ); } if ( opts.theme !== undefined ) { oldTheme = this._themeClassFromOption( "ui-btn-", currentOpts.theme ); newTheme = this._themeClassFromOption( "ui-btn-", opts.theme ); anchor.removeClass( oldTheme ).addClass( newTheme ); } if ( opts.contentTheme !== undefined ) { oldTheme = this._themeClassFromOption( "ui-body-", currentOpts.theme ); newTheme = this._themeClassFromOption( "ui-body-", opts.theme ); ui.content.removeClass( oldTheme ).addClass( newTheme ); } if ( opts.inset !== undefined ) { elem.toggleClass( "ui-collapsible-inset", opts.inset ); hasCorners = !!( opts.inset && ( opts.corners || currentOpts.corners ) ); } if ( opts.corners !== undefined ) { hasCorners = !!( opts.corners && ( opts.inset || currentOpts.inset ) ); } if ( hasCorners !== undefined ) { elem.toggleClass( "ui-corner-all", hasCorners ); } if ( opts.mini !== undefined ) { anchor.toggleClass( "ui-mini", opts.mini ); } this._super( options ); }, _handleExpandCollapse: function( isCollapse ) { var opts = this._getOptions( this.options ), ui = this._ui; ui.status.text( isCollapse ? opts.expandCueText : opts.collapseCueText ); ui.heading .toggleClass( "ui-collapsible-heading-collapsed", isCollapse ) .find( "a" ).first() .toggleClass( "ui-icon-" + opts.expandedIcon, !isCollapse ) // logic or cause same icon for expanded/collapsed state would remove the ui-icon-class .toggleClass( "ui-icon-" + opts.collapsedIcon, ( isCollapse || opts.expandedIcon === opts.collapsedIcon ) ) .removeClass( $.mobile.activeBtnClass ); this.element.toggleClass( "ui-collapsible-collapsed", isCollapse ); ui.content .toggleClass( "ui-collapsible-content-collapsed", isCollapse ) .attr( "aria-hidden", isCollapse ) .trigger( "updatelayout" ); this.options.collapsed = isCollapse; this._trigger( isCollapse ? "collapse" : "expand" ); }, expand: function() { this._handleExpandCollapse( false ); }, collapse: function() { this._handleExpandCollapse( true ); }, _destroy: function() { var ui = this._ui, opts = this.options; if ( opts.enhanced ) { return; } if ( ui.placeholder ) { ui.originalHeading.insertBefore( ui.placeholder ); ui.placeholder.remove(); ui.heading.remove(); } else { ui.status.remove(); ui.heading .removeClass( "ui-collapsible-heading ui-collapsible-heading-collapsed" ) .children() .contents() .unwrap(); } ui.anchor.contents().unwrap(); ui.content.contents().unwrap(); this.element .removeClass( "ui-collapsible ui-collapsible-collapsed " + "ui-collapsible-themed-content ui-collapsible-inset ui-corner-all" ); } }); // Defaults to be used by all instances of collapsible if per-instance values // are unset or if nothing is specified by way of inheritance from an accordion. // Note that this hash does not contain options "collapsed" or "heading", // because those are not inheritable. $.mobile.collapsible.defaults = { expandCueText: " click to expand contents", collapseCueText: " click to collapse contents", collapsedIcon: "plus", contentTheme: "inherit", expandedIcon: "minus", iconpos: "left", inset: true, corners: true, theme: "inherit", mini: false }; })( jQuery ); (function( $, undefined ) { $.mobile.behaviors.addFirstLastClasses = { _getVisibles: function( $els, create ) { var visibles; if ( create ) { visibles = $els.not( ".ui-screen-hidden" ); } else { visibles = $els.filter( ":visible" ); if ( visibles.length === 0 ) { visibles = $els.not( ".ui-screen-hidden" ); } } return visibles; }, _addFirstLastClasses: function( $els, $visibles, create ) { $els.removeClass( "ui-first-child ui-last-child" ); $visibles.eq( 0 ).addClass( "ui-first-child" ).end().last().addClass( "ui-last-child" ); if ( !create ) { this.element.trigger( "updatelayout" ); } }, _removeFirstLastClasses: function( $els ) { $els.removeClass( "ui-first-child ui-last-child" ); } }; })( jQuery ); (function( $, undefined ) { var childCollapsiblesSelector = ":mobile-collapsible, " + $.mobile.collapsible.initSelector; $.widget( "mobile.collapsibleset", $.extend( { // The initSelector is deprecated as of 1.4.0. In 1.5.0 we will use // :jqmData(role='collapsibleset') which will allow us to get rid of the line // below altogether, because the autoinit will generate such an initSelector initSelector: ":jqmData(role='collapsible-set'),:jqmData(role='collapsibleset')", options: $.extend( { enhanced: false }, $.mobile.collapsible.defaults ), _handleCollapsibleExpand: function( event ) { var closestCollapsible = $( event.target ).closest( ".ui-collapsible" ); if ( closestCollapsible.parent().is( ":mobile-collapsibleset, :jqmData(role='collapsible-set')" ) ) { closestCollapsible .siblings( ".ui-collapsible:not(.ui-collapsible-collapsed)" ) .collapsible( "collapse" ); } }, _create: function() { var elem = this.element, opts = this.options; $.extend( this, { _classes: "" }); if ( !opts.enhanced ) { elem.addClass( "ui-collapsible-set " + this._themeClassFromOption( "ui-group-theme-", opts.theme ) + " " + ( opts.corners && opts.inset ? "ui-corner-all " : "" ) ); this.element.find( $.mobile.collapsible.initSelector ).collapsible(); } this._on( elem, { collapsibleexpand: "_handleCollapsibleExpand" } ); }, _themeClassFromOption: function( prefix, value ) { return ( value ? ( value === "none" ? "" : prefix + value ) : "" ); }, _init: function() { this._refresh( true ); // Because the corners are handled by the collapsible itself and the default state is collapsed // That was causing https://github.com/jquery/jquery-mobile/issues/4116 this.element .children( childCollapsiblesSelector ) .filter( ":jqmData(collapsed='false')" ) .collapsible( "expand" ); }, _setOptions: function( options ) { var ret, hasCorners, elem = this.element, themeClass = this._themeClassFromOption( "ui-group-theme-", options.theme ); if ( themeClass ) { elem .removeClass( this._themeClassFromOption( "ui-group-theme-", this.options.theme ) ) .addClass( themeClass ); } if ( options.inset !== undefined ) { hasCorners = !!( options.inset && ( options.corners || this.options.corners ) ); } if ( options.corners !== undefined ) { hasCorners = !!( options.corners && ( options.inset || this.options.inset ) ); } if ( hasCorners !== undefined ) { elem.toggleClass( "ui-corner-all", hasCorners ); } ret = this._super( options ); this.element.children( ":mobile-collapsible" ).collapsible( "refresh" ); return ret; }, _destroy: function() { var el = this.element; this._removeFirstLastClasses( el.children( childCollapsiblesSelector ) ); el .removeClass( "ui-collapsible-set ui-corner-all " + this._themeClassFromOption( "ui-group-theme-", this.options.theme ) ) .children( ":mobile-collapsible" ) .collapsible( "destroy" ); }, _refresh: function( create ) { var collapsiblesInSet = this.element.children( childCollapsiblesSelector ); this.element.find( $.mobile.collapsible.initSelector ).not( ".ui-collapsible" ).collapsible(); this._addFirstLastClasses( collapsiblesInSet, this._getVisibles( collapsiblesInSet, create ), create ); }, refresh: function() { this._refresh( false ); } }, $.mobile.behaviors.addFirstLastClasses ) ); })( jQuery ); (function( $, undefined ) { // Deprecated in 1.4 $.fn.fieldcontain = function(/* options */) { return this.addClass( "ui-field-contain" ); }; })( jQuery ); (function( $, undefined ) { $.fn.grid = function( options ) { return this.each(function() { var $this = $( this ), o = $.extend({ grid: null }, options ), $kids = $this.children(), gridCols = { solo:1, a:2, b:3, c:4, d:5 }, grid = o.grid, iterator, letter; if ( !grid ) { if ( $kids.length <= 5 ) { for ( letter in gridCols ) { if ( gridCols[ letter ] === $kids.length ) { grid = letter; } } } else { grid = "a"; $this.addClass( "ui-grid-duo" ); } } iterator = gridCols[grid]; $this.addClass( "ui-grid-" + grid ); $kids.filter( ":nth-child(" + iterator + "n+1)" ).addClass( "ui-block-a" ); if ( iterator > 1 ) { $kids.filter( ":nth-child(" + iterator + "n+2)" ).addClass( "ui-block-b" ); } if ( iterator > 2 ) { $kids.filter( ":nth-child(" + iterator + "n+3)" ).addClass( "ui-block-c" ); } if ( iterator > 3 ) { $kids.filter( ":nth-child(" + iterator + "n+4)" ).addClass( "ui-block-d" ); } if ( iterator > 4 ) { $kids.filter( ":nth-child(" + iterator + "n+5)" ).addClass( "ui-block-e" ); } }); }; })( jQuery ); (function( $, undefined ) { $.widget( "mobile.navbar", { options: { iconpos: "top", grid: null }, _create: function() { var $navbar = this.element, $navbtns = $navbar.find( "a" ), iconpos = $navbtns.filter( ":jqmData(icon)" ).length ? this.options.iconpos : undefined; $navbar.addClass( "ui-navbar" ) .attr( "role", "navigation" ) .find( "ul" ) .jqmEnhanceable() .grid({ grid: this.options.grid }); $navbtns .each( function() { var icon = $.mobile.getAttribute( this, "icon" ), theme = $.mobile.getAttribute( this, "theme" ), classes = "ui-btn"; if ( theme ) { classes += " ui-btn-" + theme; } if ( icon ) { classes += " ui-icon-" + icon + " ui-btn-icon-" + iconpos; } $( this ).addClass( classes ); }); $navbar.delegate( "a", "vclick", function( /* event */ ) { var activeBtn = $( this ); if ( !( activeBtn.hasClass( "ui-state-disabled" ) || // DEPRECATED as of 1.4.0 - remove after 1.4.0 release // only ui-state-disabled should be present thereafter activeBtn.hasClass( "ui-disabled" ) || activeBtn.hasClass( $.mobile.activeBtnClass ) ) ) { $navbtns.removeClass( $.mobile.activeBtnClass ); activeBtn.addClass( $.mobile.activeBtnClass ); // The code below is a workaround to fix #1181 $( document ).one( "pagehide", function() { activeBtn.removeClass( $.mobile.activeBtnClass ); }); } }); // Buttons in the navbar with ui-state-persist class should regain their active state before page show $navbar.closest( ".ui-page" ).bind( "pagebeforeshow", function() { $navbtns.filter( ".ui-state-persist" ).addClass( $.mobile.activeBtnClass ); }); } }); })( jQuery ); (function( $, undefined ) { var getAttr = $.mobile.getAttribute; $.widget( "mobile.listview", $.extend( { options: { theme: null, countTheme: null, /* Deprecated in 1.4 */ dividerTheme: null, icon: "carat-r", splitIcon: "carat-r", splitTheme: null, corners: true, shadow: true, inset: false }, _create: function() { var t = this, listviewClasses = ""; listviewClasses += t.options.inset ? " ui-listview-inset" : ""; if ( !!t.options.inset ) { listviewClasses += t.options.corners ? " ui-corner-all" : ""; listviewClasses += t.options.shadow ? " ui-shadow" : ""; } // create listview markup t.element.addClass( " ui-listview" + listviewClasses ); t.refresh( true ); }, // TODO: Remove in 1.5 _findFirstElementByTagName: function( ele, nextProp, lcName, ucName ) { var dict = {}; dict[ lcName ] = dict[ ucName ] = true; while ( ele ) { if ( dict[ ele.nodeName ] ) { return ele; } ele = ele[ nextProp ]; } return null; }, // TODO: Remove in 1.5 _addThumbClasses: function( containers ) { var i, img, len = containers.length; for ( i = 0; i < len; i++ ) { img = $( this._findFirstElementByTagName( containers[ i ].firstChild, "nextSibling", "img", "IMG" ) ); if ( img.length ) { $( this._findFirstElementByTagName( img[ 0 ].parentNode, "parentNode", "li", "LI" ) ).addClass( img.hasClass( "ui-li-icon" ) ? "ui-li-has-icon" : "ui-li-has-thumb" ); } } }, _getChildrenByTagName: function( ele, lcName, ucName ) { var results = [], dict = {}; dict[ lcName ] = dict[ ucName ] = true; ele = ele.firstChild; while ( ele ) { if ( dict[ ele.nodeName ] ) { results.push( ele ); } ele = ele.nextSibling; } return $( results ); }, _beforeListviewRefresh: $.noop, _afterListviewRefresh: $.noop, refresh: function( create ) { var buttonClass, pos, numli, item, itemClass, itemTheme, itemIcon, icon, a, isDivider, startCount, newStartCount, value, last, splittheme, splitThemeClass, spliticon, altButtonClass, dividerTheme, li, o = this.options, $list = this.element, ol = !!$.nodeName( $list[ 0 ], "ol" ), start = $list.attr( "start" ), itemClassDict = {}, countBubbles = $list.find( ".ui-li-count" ), countTheme = getAttr( $list[ 0 ], "counttheme" ) || this.options.countTheme, countThemeClass = countTheme ? "ui-body-" + countTheme : "ui-body-inherit"; if ( o.theme ) { $list.addClass( "ui-group-theme-" + o.theme ); } // Check if a start attribute has been set while taking a value of 0 into account if ( ol && ( start || start === 0 ) ) { startCount = parseInt( start, 10 ) - 1; $list.css( "counter-reset", "listnumbering " + startCount ); } this._beforeListviewRefresh(); li = this._getChildrenByTagName( $list[ 0 ], "li", "LI" ); for ( pos = 0, numli = li.length; pos < numli; pos++ ) { item = li.eq( pos ); itemClass = ""; if ( create || item[ 0 ].className.search( /\bui-li-static\b|\bui-li-divider\b/ ) < 0 ) { a = this._getChildrenByTagName( item[ 0 ], "a", "A" ); isDivider = ( getAttr( item[ 0 ], "role" ) === "list-divider" ); value = item.attr( "value" ); itemTheme = getAttr( item[ 0 ], "theme" ); if ( a.length && a[ 0 ].className.search( /\bui-btn\b/ ) < 0 && !isDivider ) { itemIcon = getAttr( item[ 0 ], "icon" ); icon = ( itemIcon === false ) ? false : ( itemIcon || o.icon ); // TODO: Remove in 1.5 together with links.js (links.js / .ui-link deprecated in 1.4) a.removeClass( "ui-link" ); buttonClass = "ui-btn"; if ( itemTheme ) { buttonClass += " ui-btn-" + itemTheme; } if ( a.length > 1 ) { itemClass = "ui-li-has-alt"; last = a.last(); splittheme = getAttr( last[ 0 ], "theme" ) || o.splitTheme || getAttr( item[ 0 ], "theme", true ); splitThemeClass = splittheme ? " ui-btn-" + splittheme : ""; spliticon = getAttr( last[ 0 ], "icon" ) || getAttr( item[ 0 ], "icon" ) || o.splitIcon; altButtonClass = "ui-btn ui-btn-icon-notext ui-icon-" + spliticon + splitThemeClass; last .attr( "title", $.trim( last.getEncodedText() ) ) .addClass( altButtonClass ) .empty(); } else if ( icon ) { buttonClass += " ui-btn-icon-right ui-icon-" + icon; } a.first().addClass( buttonClass ); } else if ( isDivider ) { dividerTheme = ( getAttr( item[ 0 ], "theme" ) || o.dividerTheme || o.theme ); itemClass = "ui-li-divider ui-bar-" + ( dividerTheme ? dividerTheme : "inherit" ); item.attr( "role", "heading" ); } else if ( a.length <= 0 ) { itemClass = "ui-li-static ui-body-" + ( itemTheme ? itemTheme : "inherit" ); } if ( ol && value ) { newStartCount = parseInt( value , 10 ) - 1; item.css( "counter-reset", "listnumbering " + newStartCount ); } } // Instead of setting item class directly on the list item // at this point in time, push the item into a dictionary // that tells us what class to set on it so we can do this after this // processing loop is finished. if ( !itemClassDict[ itemClass ] ) { itemClassDict[ itemClass ] = []; } itemClassDict[ itemClass ].push( item[ 0 ] ); } // Set the appropriate listview item classes on each list item. // The main reason we didn't do this // in the for-loop above is because we can eliminate per-item function overhead // by calling addClass() and children() once or twice afterwards. This // can give us a significant boost on platforms like WP7.5. for ( itemClass in itemClassDict ) { $( itemClassDict[ itemClass ] ).addClass( itemClass ); } countBubbles.each( function() { $( this ).closest( "li" ).addClass( "ui-li-has-count" ); }); if ( countThemeClass ) { countBubbles.addClass( countThemeClass ); } // Deprecated in 1.4. From 1.5 you have to add class ui-li-has-thumb or ui-li-has-icon to the LI. this._addThumbClasses( li ); this._addThumbClasses( li.find( ".ui-btn" ) ); this._afterListviewRefresh(); this._addFirstLastClasses( li, this._getVisibles( li, create ), create ); } }, $.mobile.behaviors.addFirstLastClasses ) ); })( jQuery ); (function( $, undefined ) { function defaultAutodividersSelector( elt ) { // look for the text in the given element var text = $.trim( elt.text() ) || null; if ( !text ) { return null; } // create the text for the divider (first uppercased letter) text = text.slice( 0, 1 ).toUpperCase(); return text; } $.widget( "mobile.listview", $.mobile.listview, { options: { autodividers: false, autodividersSelector: defaultAutodividersSelector }, _beforeListviewRefresh: function() { if ( this.options.autodividers ) { this._replaceDividers(); this._superApply( arguments ); } }, _replaceDividers: function() { var i, lis, li, dividerText, lastDividerText = null, list = this.element, divider; list.children( "li:jqmData(role='list-divider')" ).remove(); lis = list.children( "li" ); for ( i = 0; i < lis.length ; i++ ) { li = lis[ i ]; dividerText = this.options.autodividersSelector( $( li ) ); if ( dividerText && lastDividerText !== dividerText ) { divider = document.createElement( "li" ); divider.appendChild( document.createTextNode( dividerText ) ); divider.setAttribute( "data-" + $.mobile.ns + "role", "list-divider" ); li.parentNode.insertBefore( divider, li ); } lastDividerText = dividerText; } } }); })( jQuery ); (function( $, undefined ) { var rdivider = /(^|\s)ui-li-divider($|\s)/, rhidden = /(^|\s)ui-screen-hidden($|\s)/; $.widget( "mobile.listview", $.mobile.listview, { options: { hideDividers: false }, _afterListviewRefresh: function() { var items, idx, item, hideDivider = true; this._superApply( arguments ); if ( this.options.hideDividers ) { items = this._getChildrenByTagName( this.element[ 0 ], "li", "LI" ); for ( idx = items.length - 1 ; idx > -1 ; idx-- ) { item = items[ idx ]; if ( item.className.match( rdivider ) ) { if ( hideDivider ) { item.className = item.className + " ui-screen-hidden"; } hideDivider = true; } else { if ( !item.className.match( rhidden ) ) { hideDivider = false; } } } } } }); })( jQuery ); (function( $, undefined ) { $.mobile.nojs = function( target ) { $( ":jqmData(role='nojs')", target ).addClass( "ui-nojs" ); }; })( jQuery ); (function( $, undefined ) { $.mobile.behaviors.formReset = { _handleFormReset: function() { this._on( this.element.closest( "form" ), { reset: function() { this._delay( "_reset" ); } }); } }; })( jQuery ); /* * "checkboxradio" plugin */ (function( $, undefined ) { $.widget( "mobile.checkboxradio", $.extend( { initSelector: "input:not( :jqmData(role='flipswitch' ) )[type='checkbox'],input[type='radio']:not( :jqmData(role='flipswitch' ))", options: { theme: "inherit", mini: false, wrapperClass: null, enhanced: false, iconpos: "left" }, _create: function() { var input = this.element, o = this.options, inheritAttr = function( input, dataAttr ) { return input.jqmData( dataAttr ) || input.closest( "form, fieldset" ).jqmData( dataAttr ); }, // NOTE: Windows Phone could not find the label through a selector // filter works though. parentLabel = input.closest( "label" ), label = parentLabel.length ? parentLabel : input .closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" ) .find( "label" ) .filter( "[for='" + $.mobile.path.hashToSelector( input[0].id ) + "']" ) .first(), inputtype = input[0].type, checkedClass = "ui-" + inputtype + "-on", uncheckedClass = "ui-" + inputtype + "-off"; if ( inputtype !== "checkbox" && inputtype !== "radio" ) { return; } if ( this.element[0].disabled ) { this.options.disabled = true; } o.iconpos = inheritAttr( input, "iconpos" ) || label.attr( "data-" + $.mobile.ns + "iconpos" ) || o.iconpos, // Establish options o.mini = inheritAttr( input, "mini" ) || o.mini; // Expose for other methods $.extend( this, { input: input, label: label, parentLabel: parentLabel, inputtype: inputtype, checkedClass: checkedClass, uncheckedClass: uncheckedClass }); if ( !this.options.enhanced ) { this._enhance(); } this._on( label, { vmouseover: "_handleLabelVMouseOver", vclick: "_handleLabelVClick" }); this._on( input, { vmousedown: "_cacheVals", vclick: "_handleInputVClick", focus: "_handleInputFocus", blur: "_handleInputBlur" }); this._handleFormReset(); this.refresh(); }, _enhance: function() { this.label.addClass( "ui-btn ui-corner-all"); if ( this.parentLabel.length > 0 ) { this.input.add( this.label ).wrapAll( this._wrapper() ); } else { //this.element.replaceWith( this.input.add( this.label ).wrapAll( this._wrapper() ) ); this.element.wrap( this._wrapper() ); this.element.parent().prepend( this.label ); } // Wrap the input + label in a div this._setOptions({ "theme": this.options.theme, "iconpos": this.options.iconpos, "mini": this.options.mini }); }, _wrapper: function() { return $( "<div class='" + ( this.options.wrapperClass ? this.options.wrapperClass : "" ) + " ui-" + this.inputtype + ( this.options.disabled ? " ui-state-disabled" : "" ) + "' >" ); }, _handleInputFocus: function() { this.label.addClass( $.mobile.focusClass ); }, _handleInputBlur: function() { this.label.removeClass( $.mobile.focusClass ); }, _handleInputVClick: function() { var $this = this.element; // Adds checked attribute to checked input when keyboard is used if ( $this.is( ":checked" ) ) { $this.prop( "checked", true); this._getInputSet().not( $this ).prop( "checked", false ); } else { $this.prop( "checked", false ); } this._updateAll(); }, _handleLabelVMouseOver: function( event ) { if ( this.label.parent().hasClass( "ui-state-disabled" ) ) { event.stopPropagation(); } }, _handleLabelVClick: function( event ) { var input = this.element; if ( input.is( ":disabled" ) ) { event.preventDefault(); return; } this._cacheVals(); input.prop( "checked", this.inputtype === "radio" && true || !input.prop( "checked" ) ); // trigger click handler's bound directly to the input as a substitute for // how label clicks behave normally in the browsers // TODO: it would be nice to let the browser's handle the clicks and pass them // through to the associate input. we can swallow that click at the parent // wrapper element level input.triggerHandler( "click" ); // Input set for common radio buttons will contain all the radio // buttons, but will not for checkboxes. clearing the checked status // of other radios ensures the active button state is applied properly this._getInputSet().not( input ).prop( "checked", false ); this._updateAll(); return false; }, _cacheVals: function() { this._getInputSet().each( function() { $( this ).attr("data-" + $.mobile.ns + "cacheVal", this.checked ); }); }, //returns either a set of radios with the same name attribute, or a single checkbox _getInputSet: function() { if ( this.inputtype === "checkbox" ) { return this.element; } return this.element.closest( "form, :jqmData(role='page'), :jqmData(role='dialog')" ) .find( "input[name='" + this.element[ 0 ].name + "'][type='" + this.inputtype + "']" ); }, _updateAll: function() { var self = this; this._getInputSet().each( function() { var $this = $( this ); if ( this.checked || self.inputtype === "checkbox" ) { $this.trigger( "change" ); } }) .checkboxradio( "refresh" ); }, _reset: function() { this.refresh(); }, // Is the widget supposed to display an icon? _hasIcon: function() { var controlgroup, controlgroupWidget, controlgroupConstructor = $.mobile.controlgroup; // If the controlgroup widget is defined ... if ( controlgroupConstructor ) { controlgroup = this.element.closest( ":mobile-controlgroup," + controlgroupConstructor.prototype.initSelector ); // ... and the checkbox is in a controlgroup ... if ( controlgroup.length > 0 ) { // ... look for a controlgroup widget instance, and ... controlgroupWidget = $.data( controlgroup[ 0 ], "mobile-controlgroup" ); // ... if found, decide based on the option value, ... return ( ( controlgroupWidget ? controlgroupWidget.options.type : // ... otherwise decide based on the "type" data attribute. controlgroup.attr( "data-" + $.mobile.ns + "type" ) ) !== "horizontal" ); } } // Normally, the widget displays an icon. return true; }, refresh: function() { var hasIcon = this._hasIcon(), isChecked = this.element[ 0 ].checked, active = $.mobile.activeBtnClass, iconposClass = "ui-btn-icon-" + this.options.iconpos, addClasses = [], removeClasses = []; if ( hasIcon ) { removeClasses.push( active ); addClasses.push( iconposClass ); } else { removeClasses.push( iconposClass ); ( isChecked ? addClasses : removeClasses ).push( active ); } if ( isChecked ) { addClasses.push( this.checkedClass ); removeClasses.push( this.uncheckedClass ); } else { addClasses.push( this.uncheckedClass ); removeClasses.push( this.checkedClass ); } this.label .addClass( addClasses.join( " " ) ) .removeClass( removeClasses.join( " " ) ); }, widget: function() { return this.label.parent(); }, _setOptions: function( options ) { var label = this.label, currentOptions = this.options, outer = this.widget(), hasIcon = this._hasIcon(); if ( options.disabled !== undefined ) { this.input.prop( "disabled", !!options.disabled ); outer.toggleClass( "ui-state-disabled", !!options.disabled ); } if ( options.mini !== undefined ) { outer.toggleClass( "ui-mini", !!options.mini ); } if ( options.theme !== undefined ) { label .removeClass( "ui-btn-" + currentOptions.theme ) .addClass( "ui-btn-" + options.theme ); } if ( options.wrapperClass !== undefined ) { outer .removeClass( currentOptions.wrapperClass ) .addClass( options.wrapperClass ); } if ( options.iconpos !== undefined && hasIcon ) { label.removeClass( "ui-btn-icon-" + currentOptions.iconpos ).addClass( "ui-btn-icon-" + options.iconpos ); } else if ( !hasIcon ) { label.removeClass( "ui-btn-icon-" + currentOptions.iconpos ); } this._super( options ); } }, $.mobile.behaviors.formReset ) ); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.button", { initSelector: "input[type='button'], input[type='submit'], input[type='reset']", options: { theme: null, icon: null, iconpos: "left", iconshadow: false, /* TODO: Deprecated in 1.4, remove in 1.5. */ corners: true, shadow: true, inline: null, mini: null, wrapperClass: null, enhanced: false }, _create: function() { if ( this.element.is( ":disabled" ) ) { this.options.disabled = true; } if ( !this.options.enhanced ) { this._enhance(); } $.extend( this, { wrapper: this.element.parent() }); this._on( { focus: function() { this.widget().addClass( $.mobile.focusClass ); }, blur: function() { this.widget().removeClass( $.mobile.focusClass ); } }); this.refresh( true ); }, _enhance: function() { this.element.wrap( this._button() ); }, _button: function() { var options = this.options, iconClasses = this._getIconClasses( this.options ); return $("<div class='ui-btn ui-input-btn" + ( options.wrapperClass ? " " + options.wrapperClass : "" ) + ( options.theme ? " ui-btn-" + options.theme : "" ) + ( options.corners ? " ui-corner-all" : "" ) + ( options.shadow ? " ui-shadow" : "" ) + ( options.inline ? " ui-btn-inline" : "" ) + ( options.mini ? " ui-mini" : "" ) + ( options.disabled ? " ui-state-disabled" : "" ) + ( iconClasses ? ( " " + iconClasses ) : "" ) + "' >" + this.element.val() + "</div>" ); }, widget: function() { return this.wrapper; }, _destroy: function() { this.element.insertBefore( this.button ); this.button.remove(); }, _getIconClasses: function( options ) { return ( options.icon ? ( "ui-icon-" + options.icon + ( options.iconshadow ? " ui-shadow-icon" : "" ) + /* TODO: Deprecated in 1.4, remove in 1.5. */ " ui-btn-icon-" + options.iconpos ) : "" ); }, _setOptions: function( options ) { var outer = this.widget(); if ( options.theme !== undefined ) { outer .removeClass( this.options.theme ) .addClass( "ui-btn-" + options.theme ); } if ( options.corners !== undefined ) { outer.toggleClass( "ui-corner-all", options.corners ); } if ( options.shadow !== undefined ) { outer.toggleClass( "ui-shadow", options.shadow ); } if ( options.inline !== undefined ) { outer.toggleClass( "ui-btn-inline", options.inline ); } if ( options.mini !== undefined ) { outer.toggleClass( "ui-mini", options.mini ); } if ( options.disabled !== undefined ) { this.element.prop( "disabled", options.disabled ); outer.toggleClass( "ui-state-disabled", options.disabled ); } if ( options.icon !== undefined || options.iconshadow !== undefined || /* TODO: Deprecated in 1.4, remove in 1.5. */ options.iconpos !== undefined ) { outer .removeClass( this._getIconClasses( this.options ) ) .addClass( this._getIconClasses( $.extend( {}, this.options, options ) ) ); } this._super( options ); }, refresh: function( create ) { if ( this.options.icon && this.options.iconpos === "notext" && this.element.attr( "title" ) ) { this.element.attr( "title", this.element.val() ); } if ( !create ) { var originalElement = this.element.detach(); $( this.wrapper ).text( this.element.val() ).append( originalElement ); } } }); })( jQuery ); (function( $ ) { var meta = $( "meta[name=viewport]" ), initialContent = meta.attr( "content" ), disabledZoom = initialContent + ",maximum-scale=1, user-scalable=no", enabledZoom = initialContent + ",maximum-scale=10, user-scalable=yes", disabledInitially = /(user-scalable[\s]*=[\s]*no)|(maximum-scale[\s]*=[\s]*1)[$,\s]/.test( initialContent ); $.mobile.zoom = $.extend( {}, { enabled: !disabledInitially, locked: false, disable: function( lock ) { if ( !disabledInitially && !$.mobile.zoom.locked ) { meta.attr( "content", disabledZoom ); $.mobile.zoom.enabled = false; $.mobile.zoom.locked = lock || false; } }, enable: function( unlock ) { if ( !disabledInitially && ( !$.mobile.zoom.locked || unlock === true ) ) { meta.attr( "content", enabledZoom ); $.mobile.zoom.enabled = true; $.mobile.zoom.locked = false; } }, restore: function() { if ( !disabledInitially ) { meta.attr( "content", initialContent ); $.mobile.zoom.enabled = true; } } }); }( jQuery )); (function( $, undefined ) { $.widget( "mobile.textinput", { initSelector: "input[type='text']," + "input[type='search']," + ":jqmData(type='search')," + "input[type='number']," + ":jqmData(type='number')," + "input[type='password']," + "input[type='email']," + "input[type='url']," + "input[type='tel']," + "textarea," + "input[type='time']," + "input[type='date']," + "input[type='month']," + "input[type='week']," + "input[type='datetime']," + "input[type='datetime-local']," + "input[type='color']," + "input:not([type])," + "input[type='file']", options: { theme: null, corners: true, mini: false, // This option defaults to true on iOS devices. preventFocusZoom: /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1, wrapperClass: "", enhanced: false }, _create: function() { var options = this.options, isSearch = this.element.is( "[type='search'], :jqmData(type='search')" ), isTextarea = this.element[ 0 ].tagName === "TEXTAREA", isRange = this.element.is( "[data-" + ( $.mobile.ns || "" ) + "type='range']" ), inputNeedsWrap = ( (this.element.is( "input" ) || this.element.is( "[data-" + ( $.mobile.ns || "" ) + "type='search']" ) ) && !isRange ); if ( this.element.prop( "disabled" ) ) { options.disabled = true; } $.extend( this, { classes: this._classesFromOptions(), isSearch: isSearch, isTextarea: isTextarea, isRange: isRange, inputNeedsWrap: inputNeedsWrap }); this._autoCorrect(); if ( !options.enhanced ) { this._enhance(); } this._on( { "focus": "_handleFocus", "blur": "_handleBlur" }); }, refresh: function() { this.setOptions({ "disabled" : this.element.is( ":disabled" ) }); }, _enhance: function() { var elementClasses = []; if ( this.isTextarea ) { elementClasses.push( "ui-input-text" ); } if ( this.isTextarea || this.isRange ) { elementClasses.push( "ui-shadow-inset" ); } //"search" and "text" input widgets if ( this.inputNeedsWrap ) { this.element.wrap( this._wrap() ); } else { elementClasses = elementClasses.concat( this.classes ); } this.element.addClass( elementClasses.join( " " ) ); }, widget: function() { return ( this.inputNeedsWrap ) ? this.element.parent() : this.element; }, _classesFromOptions: function() { var options = this.options, classes = []; classes.push( "ui-body-" + ( ( options.theme === null ) ? "inherit" : options.theme ) ); if ( options.corners ) { classes.push( "ui-corner-all" ); } if ( options.mini ) { classes.push( "ui-mini" ); } if ( options.disabled ) { classes.push( "ui-state-disabled" ); } if ( options.wrapperClass ) { classes.push( options.wrapperClass ); } return classes; }, _wrap: function() { return $( "<div class='" + ( this.isSearch ? "ui-input-search " : "ui-input-text " ) + this.classes.join( " " ) + " " + "ui-shadow-inset'></div>" ); }, _autoCorrect: function() { // XXX: Temporary workaround for issue 785 (Apple bug 8910589). // Turn off autocorrect and autocomplete on non-iOS 5 devices // since the popup they use can't be dismissed by the user. Note // that we test for the presence of the feature by looking for // the autocorrect property on the input element. We currently // have no test for iOS 5 or newer so we're temporarily using // the touchOverflow support flag for jQM 1.0. Yes, I feel dirty. // - jblas if ( typeof this.element[0].autocorrect !== "undefined" && !$.support.touchOverflow ) { // Set the attribute instead of the property just in case there // is code that attempts to make modifications via HTML. this.element[0].setAttribute( "autocorrect", "off" ); this.element[0].setAttribute( "autocomplete", "off" ); } }, _handleBlur: function() { this.widget().removeClass( $.mobile.focusClass ); if ( this.options.preventFocusZoom ) { $.mobile.zoom.enable( true ); } }, _handleFocus: function() { // In many situations, iOS will zoom into the input upon tap, this // prevents that from happening if ( this.options.preventFocusZoom ) { $.mobile.zoom.disable( true ); } this.widget().addClass( $.mobile.focusClass ); }, _setOptions: function ( options ) { var outer = this.widget(); this._super( options ); if ( !( options.disabled === undefined && options.mini === undefined && options.corners === undefined && options.theme === undefined && options.wrapperClass === undefined ) ) { outer.removeClass( this.classes.join( " " ) ); this.classes = this._classesFromOptions(); outer.addClass( this.classes.join( " " ) ); } if ( options.disabled !== undefined ) { this.element.prop( "disabled", !!options.disabled ); } }, _destroy: function() { if ( this.options.enhanced ) { return; } if ( this.inputNeedsWrap ) { this.element.unwrap(); } this.element.removeClass( "ui-input-text " + this.classes.join( " " ) ); } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.slider", $.extend( { initSelector: "input[type='range'], :jqmData(type='range'), :jqmData(role='slider')", widgetEventPrefix: "slide", options: { theme: null, trackTheme: null, corners: true, mini: false, highlight: false }, _create: function() { // TODO: Each of these should have comments explain what they're for var self = this, control = this.element, trackTheme = this.options.trackTheme || $.mobile.getAttribute( control[ 0 ], "theme" ), trackThemeClass = trackTheme ? " ui-bar-" + trackTheme : " ui-bar-inherit", cornerClass = ( this.options.corners || control.jqmData( "corners" ) ) ? " ui-corner-all" : "", miniClass = ( this.options.mini || control.jqmData( "mini" ) ) ? " ui-mini" : "", cType = control[ 0 ].nodeName.toLowerCase(), isToggleSwitch = ( cType === "select" ), isRangeslider = control.parent().is( ":jqmData(role='rangeslider')" ), selectClass = ( isToggleSwitch ) ? "ui-slider-switch" : "", controlID = control.attr( "id" ), $label = $( "[for='" + controlID + "']" ), labelID = $label.attr( "id" ) || controlID + "-label", min = !isToggleSwitch ? parseFloat( control.attr( "min" ) ) : 0, max = !isToggleSwitch ? parseFloat( control.attr( "max" ) ) : control.find( "option" ).length-1, step = window.parseFloat( control.attr( "step" ) || 1 ), domHandle = document.createElement( "a" ), handle = $( domHandle ), domSlider = document.createElement( "div" ), slider = $( domSlider ), valuebg = this.options.highlight && !isToggleSwitch ? (function() { var bg = document.createElement( "div" ); bg.className = "ui-slider-bg " + $.mobile.activeBtnClass; return $( bg ).prependTo( slider ); })() : false, options, wrapper, j, length, i, optionsCount, origTabIndex, side, activeClass, sliderImg; $label.attr( "id", labelID ); this.isToggleSwitch = isToggleSwitch; domHandle.setAttribute( "href", "#" ); domSlider.setAttribute( "role", "application" ); domSlider.className = [ this.isToggleSwitch ? "ui-slider ui-slider-track ui-shadow-inset " : "ui-slider-track ui-shadow-inset ", selectClass, trackThemeClass, cornerClass, miniClass ].join( "" ); domHandle.className = "ui-slider-handle"; domSlider.appendChild( domHandle ); handle.attr({ "role": "slider", "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": this._value(), "aria-valuetext": this._value(), "title": this._value(), "aria-labelledby": labelID }); $.extend( this, { slider: slider, handle: handle, control: control, type: cType, step: step, max: max, min: min, valuebg: valuebg, isRangeslider: isRangeslider, dragging: false, beforeStart: null, userModified: false, mouseMoved: false }); if ( isToggleSwitch ) { // TODO: restore original tabindex (if any) in a destroy method origTabIndex = control.attr( "tabindex" ); if ( origTabIndex ) { handle.attr( "tabindex", origTabIndex ); } control.attr( "tabindex", "-1" ).focus(function() { $( this ).blur(); handle.focus(); }); wrapper = document.createElement( "div" ); wrapper.className = "ui-slider-inneroffset"; for ( j = 0, length = domSlider.childNodes.length; j < length; j++ ) { wrapper.appendChild( domSlider.childNodes[j] ); } domSlider.appendChild( wrapper ); // slider.wrapInner( "<div class='ui-slider-inneroffset'></div>" ); // make the handle move with a smooth transition handle.addClass( "ui-slider-handle-snapping" ); options = control.find( "option" ); for ( i = 0, optionsCount = options.length; i < optionsCount; i++ ) { side = !i ? "b" : "a"; activeClass = !i ? "" : " " + $.mobile.activeBtnClass; sliderImg = document.createElement( "span" ); sliderImg.className = [ "ui-slider-label ui-slider-label-", side, activeClass ].join( "" ); sliderImg.setAttribute( "role", "img" ); sliderImg.appendChild( document.createTextNode( options[i].innerHTML ) ); $( sliderImg ).prependTo( slider ); } self._labels = $( ".ui-slider-label", slider ); } // monitor the input for updated values control.addClass( isToggleSwitch ? "ui-slider-switch" : "ui-slider-input" ); this._on( control, { "change": "_controlChange", "keyup": "_controlKeyup", "blur": "_controlBlur", "vmouseup": "_controlVMouseUp" }); slider.bind( "vmousedown", $.proxy( this._sliderVMouseDown, this ) ) .bind( "vclick", false ); // We have to instantiate a new function object for the unbind to work properly // since the method itself is defined in the prototype (causing it to unbind everything) this._on( document, { "vmousemove": "_preventDocumentDrag" }); this._on( slider.add( document ), { "vmouseup": "_sliderVMouseUp" }); slider.insertAfter( control ); // wrap in a div for styling purposes if ( !isToggleSwitch && !isRangeslider ) { wrapper = this.options.mini ? "<div class='ui-slider ui-mini'>" : "<div class='ui-slider'>"; control.add( slider ).wrapAll( wrapper ); } // bind the handle event callbacks and set the context to the widget instance this._on( this.handle, { "vmousedown": "_handleVMouseDown", "keydown": "_handleKeydown", "keyup": "_handleKeyup" }); this.handle.bind( "vclick", false ); this._handleFormReset(); this.refresh( undefined, undefined, true ); }, _setOptions: function( options ) { if ( options.theme !== undefined ) { this._setTheme( options.theme ); } if ( options.trackTheme !== undefined ) { this._setTrackTheme( options.trackTheme ); } if ( options.corners !== undefined ) { this._setCorners( options.corners ); } if ( options.mini !== undefined ) { this._setMini( options.mini ); } if ( options.highlight !== undefined ) { this._setHighlight( options.highlight ); } if ( options.disabled !== undefined ) { this._setDisabled( options.disabled ); } this._super( options ); }, _controlChange: function( event ) { // if the user dragged the handle, the "change" event was triggered from inside refresh(); don't call refresh() again if ( this._trigger( "controlchange", event ) === false ) { return false; } if ( !this.mouseMoved ) { this.refresh( this._value(), true ); } }, _controlKeyup: function(/* event */) { // necessary? this.refresh( this._value(), true, true ); }, _controlBlur: function(/* event */) { this.refresh( this._value(), true ); }, // it appears the clicking the up and down buttons in chrome on // range/number inputs doesn't trigger a change until the field is // blurred. Here we check thif the value has changed and refresh _controlVMouseUp: function(/* event */) { this._checkedRefresh(); }, // NOTE force focus on handle _handleVMouseDown: function(/* event */) { this.handle.focus(); }, _handleKeydown: function( event ) { var index = this._value(); if ( this.options.disabled ) { return; } // In all cases prevent the default and mark the handle as active switch ( event.keyCode ) { case $.mobile.keyCode.HOME: case $.mobile.keyCode.END: case $.mobile.keyCode.PAGE_UP: case $.mobile.keyCode.PAGE_DOWN: case $.mobile.keyCode.UP: case $.mobile.keyCode.RIGHT: case $.mobile.keyCode.DOWN: case $.mobile.keyCode.LEFT: event.preventDefault(); if ( !this._keySliding ) { this._keySliding = true; this.handle.addClass( "ui-state-active" ); /* TODO: We don't use this class for styling. Do we need to add it? */ } break; } // move the slider according to the keypress switch ( event.keyCode ) { case $.mobile.keyCode.HOME: this.refresh( this.min ); break; case $.mobile.keyCode.END: this.refresh( this.max ); break; case $.mobile.keyCode.PAGE_UP: case $.mobile.keyCode.UP: case $.mobile.keyCode.RIGHT: this.refresh( index + this.step ); break; case $.mobile.keyCode.PAGE_DOWN: case $.mobile.keyCode.DOWN: case $.mobile.keyCode.LEFT: this.refresh( index - this.step ); break; } }, // remove active mark _handleKeyup: function(/* event */) { if ( this._keySliding ) { this._keySliding = false; this.handle.removeClass( "ui-state-active" ); /* See comment above. */ } }, _sliderVMouseDown: function( event ) { // NOTE: we don't do this in refresh because we still want to // support programmatic alteration of disabled inputs if ( this.options.disabled || !( event.which === 1 || event.which === 0 || event.which === undefined ) ) { return false; } if ( this._trigger( "beforestart", event ) === false ) { return false; } this.dragging = true; this.userModified = false; this.mouseMoved = false; if ( this.isToggleSwitch ) { this.beforeStart = this.element[0].selectedIndex; } this.refresh( event ); this._trigger( "start" ); return false; }, _sliderVMouseUp: function() { if ( this.dragging ) { this.dragging = false; if ( this.isToggleSwitch ) { // make the handle move with a smooth transition this.handle.addClass( "ui-slider-handle-snapping" ); if ( this.mouseMoved ) { // this is a drag, change the value only if user dragged enough if ( this.userModified ) { this.refresh( this.beforeStart === 0 ? 1 : 0 ); } else { this.refresh( this.beforeStart ); } } else { // this is just a click, change the value this.refresh( this.beforeStart === 0 ? 1 : 0 ); } } this.mouseMoved = false; this._trigger( "stop" ); return false; } }, _preventDocumentDrag: function( event ) { // NOTE: we don't do this in refresh because we still want to // support programmatic alteration of disabled inputs if ( this._trigger( "drag", event ) === false) { return false; } if ( this.dragging && !this.options.disabled ) { // this.mouseMoved must be updated before refresh() because it will be used in the control "change" event this.mouseMoved = true; if ( this.isToggleSwitch ) { // make the handle move in sync with the mouse this.handle.removeClass( "ui-slider-handle-snapping" ); } this.refresh( event ); // only after refresh() you can calculate this.userModified this.userModified = this.beforeStart !== this.element[0].selectedIndex; return false; } }, _checkedRefresh: function() { if ( this.value !== this._value() ) { this.refresh( this._value() ); } }, _value: function() { return this.isToggleSwitch ? this.element[0].selectedIndex : parseFloat( this.element.val() ) ; }, _reset: function() { this.refresh( undefined, false, true ); }, refresh: function( val, isfromControl, preventInputUpdate ) { // NOTE: we don't return here because we want to support programmatic // alteration of the input value, which should still update the slider var self = this, parentTheme = $.mobile.getAttribute( this.element[ 0 ], "theme" ), theme = this.options.theme || parentTheme, themeClass = theme ? " ui-btn-" + theme : "", trackTheme = this.options.trackTheme || parentTheme, trackThemeClass = trackTheme ? " ui-bar-" + trackTheme : " ui-bar-inherit", cornerClass = this.options.corners ? " ui-corner-all" : "", miniClass = this.options.mini ? " ui-mini" : "", left, width, data, tol, pxStep, percent, control, isInput, optionElements, min, max, step, newval, valModStep, alignValue, percentPerStep, handlePercent, aPercent, bPercent, valueChanged; self.slider[0].className = [ this.isToggleSwitch ? "ui-slider ui-slider-switch ui-slider-track ui-shadow-inset" : "ui-slider-track ui-shadow-inset", trackThemeClass, cornerClass, miniClass ].join( "" ); if ( this.options.disabled || this.element.prop( "disabled" ) ) { this.disable(); } // set the stored value for comparison later this.value = this._value(); if ( this.options.highlight && !this.isToggleSwitch && this.slider.find( ".ui-slider-bg" ).length === 0 ) { this.valuebg = (function() { var bg = document.createElement( "div" ); bg.className = "ui-slider-bg " + $.mobile.activeBtnClass; return $( bg ).prependTo( self.slider ); })(); } this.handle.addClass( "ui-btn" + themeClass + " ui-shadow" ); control = this.element; isInput = !this.isToggleSwitch; optionElements = isInput ? [] : control.find( "option" ); min = isInput ? parseFloat( control.attr( "min" ) ) : 0; max = isInput ? parseFloat( control.attr( "max" ) ) : optionElements.length - 1; step = ( isInput && parseFloat( control.attr( "step" ) ) > 0 ) ? parseFloat( control.attr( "step" ) ) : 1; if ( typeof val === "object" ) { data = val; // a slight tolerance helped get to the ends of the slider tol = 8; left = this.slider.offset().left; width = this.slider.width(); pxStep = width/((max-min)/step); if ( !this.dragging || data.pageX < left - tol || data.pageX > left + width + tol ) { return; } if ( pxStep > 1 ) { percent = ( ( data.pageX - left ) / width ) * 100; } else { percent = Math.round( ( ( data.pageX - left ) / width ) * 100 ); } } else { if ( val == null ) { val = isInput ? parseFloat( control.val() || 0 ) : control[0].selectedIndex; } percent = ( parseFloat( val ) - min ) / ( max - min ) * 100; } if ( isNaN( percent ) ) { return; } newval = ( percent / 100 ) * ( max - min ) + min; //from jQuery UI slider, the following source will round to the nearest step valModStep = ( newval - min ) % step; alignValue = newval - valModStep; if ( Math.abs( valModStep ) * 2 >= step ) { alignValue += ( valModStep > 0 ) ? step : ( -step ); } percentPerStep = 100/((max-min)/step); // Since JavaScript has problems with large floats, round // the final value to 5 digits after the decimal point (see jQueryUI: #4124) newval = parseFloat( alignValue.toFixed(5) ); if ( typeof pxStep === "undefined" ) { pxStep = width / ( (max-min) / step ); } if ( pxStep > 1 && isInput ) { percent = ( newval - min ) * percentPerStep * ( 1 / step ); } if ( percent < 0 ) { percent = 0; } if ( percent > 100 ) { percent = 100; } if ( newval < min ) { newval = min; } if ( newval > max ) { newval = max; } this.handle.css( "left", percent + "%" ); this.handle[0].setAttribute( "aria-valuenow", isInput ? newval : optionElements.eq( newval ).attr( "value" ) ); this.handle[0].setAttribute( "aria-valuetext", isInput ? newval : optionElements.eq( newval ).getEncodedText() ); this.handle[0].setAttribute( "title", isInput ? newval : optionElements.eq( newval ).getEncodedText() ); if ( this.valuebg ) { this.valuebg.css( "width", percent + "%" ); } // drag the label widths if ( this._labels ) { handlePercent = this.handle.width() / this.slider.width() * 100; aPercent = percent && handlePercent + ( 100 - handlePercent ) * percent / 100; bPercent = percent === 100 ? 0 : Math.min( handlePercent + 100 - aPercent, 100 ); this._labels.each(function() { var ab = $( this ).hasClass( "ui-slider-label-a" ); $( this ).width( ( ab ? aPercent : bPercent ) + "%" ); }); } if ( !preventInputUpdate ) { valueChanged = false; // update control"s value if ( isInput ) { valueChanged = control.val() !== newval; control.val( newval ); } else { valueChanged = control[ 0 ].selectedIndex !== newval; control[ 0 ].selectedIndex = newval; } if ( this._trigger( "beforechange", val ) === false) { return false; } if ( !isfromControl && valueChanged ) { control.trigger( "change" ); } } }, _setHighlight: function( value ) { value = !!value; if ( value ) { this.options.highlight = !!value; this.refresh(); } else if ( this.valuebg ) { this.valuebg.remove(); this.valuebg = false; } }, _setTheme: function( value ) { this.handle .removeClass( "ui-btn-" + this.options.theme ) .addClass( "ui-btn-" + value ); var currentTheme = this.options.theme ? this.options.theme : "inherit", newTheme = value ? value : "inherit"; this.control .removeClass( "ui-body-" + currentTheme ) .addClass( "ui-body-" + newTheme ); }, _setTrackTheme: function( value ) { var currentTrackTheme = this.options.trackTheme ? this.options.trackTheme : "inherit", newTrackTheme = value ? value : "inherit"; this.slider .removeClass( "ui-body-" + currentTrackTheme ) .addClass( "ui-body-" + newTrackTheme ); }, _setMini: function( value ) { value = !!value; if ( !this.isToggleSwitch && !this.isRangeslider ) { this.slider.parent().toggleClass( "ui-mini", value ); this.element.toggleClass( "ui-mini", value ); } this.slider.toggleClass( "ui-mini", value ); }, _setCorners: function( value ) { this.slider.toggleClass( "ui-corner-all", value ); if ( !this.isToggleSwitch ) { this.control.toggleClass( "ui-corner-all", value ); } }, _setDisabled: function( value ) { value = !!value; this.element.prop( "disabled", value ); this.slider.toggleClass( "ui-state-disabled" ).attr( "aria-disabled", value ); } }, $.mobile.behaviors.formReset ) ); })( jQuery ); (function( $, undefined ) { var popup; function getPopup() { if ( !popup ) { popup = $( "<div></div>", { "class": "ui-slider-popup ui-shadow ui-corner-all" }); } return popup.clone(); } $.widget( "mobile.slider", $.mobile.slider, { options: { popupEnabled: false, showValue: false }, _create: function() { this._super(); $.extend( this, { _currentValue: null, _popup: null, _popupVisible: false }); this._setOption( "popupEnabled", this.options.popupEnabled ); this._on( this.handle, { "vmousedown" : "_showPopup" } ); this._on( this.slider.add( this.document ), { "vmouseup" : "_hidePopup" } ); this._refresh(); }, // position the popup centered 5px above the handle _positionPopup: function() { var dstOffset = this.handle.offset(); this._popup.offset( { left: dstOffset.left + ( this.handle.width() - this._popup.width() ) / 2, top: dstOffset.top - this._popup.outerHeight() - 5 }); }, _setOption: function( key, value ) { this._super( key, value ); if ( key === "showValue" ) { this.handle.html( value && !this.options.mini ? this._value() : "" ); } else if ( key === "popupEnabled" ) { if ( value && !this._popup ) { this._popup = getPopup() .addClass( "ui-body-" + ( this.options.theme || "a" ) ) .insertBefore( this.element ); } } }, // show value on the handle and in popup refresh: function() { this._super.apply( this, arguments ); this._refresh(); }, _refresh: function() { var o = this.options, newValue; if ( o.popupEnabled ) { // remove the title attribute from the handle (which is // responsible for the annoying tooltip); NB we have // to do it here as the jqm slider sets it every time // the slider's value changes :( this.handle.removeAttr( "title" ); } newValue = this._value(); if ( newValue === this._currentValue ) { return; } this._currentValue = newValue; if ( o.popupEnabled && this._popup ) { this._positionPopup(); this._popup.html( newValue ); } else if ( o.showValue && !this.options.mini ) { this.handle.html( newValue ); } }, _showPopup: function() { if ( this.options.popupEnabled && !this._popupVisible ) { this.handle.html( "" ); this._popup.show(); this._positionPopup(); this._popupVisible = true; } }, _hidePopup: function() { var o = this.options; if ( o.popupEnabled && this._popupVisible ) { if ( o.showValue && !o.mini ) { this.handle.html( this._value() ); } this._popup.hide(); this._popupVisible = false; } } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.flipswitch", $.extend({ options: { onText: "On", offText: "Off", theme: null, enhanced: false, wrapperClass: null, corners: true, mini: false }, _create: function() { if ( !this.options.enhanced ) { this._enhance(); } else { $.extend( this, { flipswitch: this.element.parent(), on: this.element.find( ".ui-flipswitch-on" ).eq( 0 ), off: this.element.find( ".ui-flipswitch-off" ).eq(0), type: this.element.get( 0 ).tagName }); } this._handleFormReset(); if ( this.element.is( ":disabled" ) ) { this._setOptions({ "disabled": true }); } this._on( this.flipswitch, { "click": "_toggle", "swipeleft": "_left", "swiperight": "_right" }); this._on( this.on, { "keydown": "_keydown" }); this._on( { "change": "refresh" }); }, widget: function() { return this.flipswitch; }, _left: function() { this.flipswitch.removeClass( "ui-flipswitch-active" ); if ( this.type === "SELECT" ) { this.element.get( 0 ).selectedIndex = 0; } else { this.element.prop( "checked", false ); } this.element.trigger( "change" ); }, _right: function() { this.flipswitch.addClass( "ui-flipswitch-active" ); if ( this.type === "SELECT" ) { this.element.get( 0 ).selectedIndex = 1; } else { this.element.prop( "checked", true ); } this.element.trigger( "change" ); }, _enhance: function() { var flipswitch = $( "<div>" ), options = this.options, element = this.element, theme = options.theme ? options.theme : "inherit", on = $( "<span></span>", { tabindex: 1 } ), off = $( "<span></span>" ), type = element.get( 0 ).tagName, onText = ( type === "INPUT" ) ? options.onText : element.find( "option" ).eq( 1 ).text(), offText = ( type === "INPUT" ) ? options.offText : element.find( "option" ).eq( 0 ).text(); on .addClass( "ui-flipswitch-on ui-btn ui-shadow ui-btn-inherit" ) .text( onText ); off .addClass( "ui-flipswitch-off" ) .text( offText ); flipswitch .addClass( "ui-flipswitch ui-shadow-inset " + "ui-bar-" + theme + " " + ( options.wrapperClass ? options.wrapperClass : "" ) + " " + ( ( element.is( ":checked" ) || element .find( "option" ) .eq( 1 ) .is( ":selected" ) ) ? "ui-flipswitch-active" : "" ) + ( element.is(":disabled") ? " ui-state-disabled": "") + ( options.corners ? " ui-corner-all": "" ) + ( options.mini ? " ui-mini": "" ) ) .append( on, off ); element .addClass( "ui-flipswitch-input" ) .after( flipswitch ) .appendTo( flipswitch ); $.extend( this, { flipswitch: flipswitch, on: on, off: off, type: type }); }, _reset: function() { this.refresh(); }, refresh: function() { var direction, existingDirection = this.flipswitch.hasClass( "ui-flipswitch-active" ) ? "_right" : "_left"; if ( this.type === "SELECT" ) { direction = ( this.element.get( 0 ).selectedIndex > 0 ) ? "_right": "_left"; } else { direction = this.element.prop( "checked" ) ? "_right": "_left"; } if ( direction !== existingDirection ) { this[ direction ](); } }, _toggle: function() { var direction = this.flipswitch.hasClass( "ui-flipswitch-active" ) ? "_left" : "_right"; this[ direction ](); }, _keydown: function( e ) { if ( e.which === $.mobile.keyCode.LEFT ) { this._left(); } else if ( e.which === $.mobile.keyCode.RIGHT ) { this._right(); } else if ( e.which === $.mobile.keyCode.SPACE ) { this._toggle(); e.preventDefault(); } }, _setOptions: function( options ) { if ( options.theme !== undefined ) { var currentTheme = options.theme ? options.theme : "inherit", newTheme = options.theme ? options.theme : "inherit"; this.widget() .removeClass( "ui-bar-" + currentTheme ) .addClass( "ui-bar-" + newTheme ); } if ( options.onText !== undefined ) { this.on.text( options.onText ); } if ( options.offText !== undefined ) { this.off.text( options.offText ); } if ( options.disabled !== undefined ) { this.widget().toggleClass( "ui-state-disabled", options.disabled ); } if ( options.mini !== undefined ) { this.widget().toggleClass( "ui-mini", options.mini ); } if ( options.corners !== undefined ) { this.widget().toggleClass( "ui-corner-all", options.corners ); } this._super( options ); }, _destroy: function() { if ( this.options.enhanced ) { return; } this.on.remove(); this.off.remove(); this.element.unwrap(); this.flipswitch.remove(); this.removeClass( "ui-flipswitch-input" ); } }, $.mobile.behaviors.formReset ) ); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.rangeslider", $.extend( { options: { theme: null, trackTheme: null, corners: true, mini: false, highlight: true }, _create: function() { var $el = this.element, elClass = this.options.mini ? "ui-rangeslider ui-mini" : "ui-rangeslider", _inputFirst = $el.find( "input" ).first(), _inputLast = $el.find( "input" ).last(), _label = $el.find( "label" ).first(), _sliderWidgetFirst = $.data( _inputFirst.get( 0 ), "mobile-slider" ) || $.data( _inputFirst.slider().get( 0 ), "mobile-slider" ), _sliderWidgetLast = $.data( _inputLast.get(0), "mobile-slider" ) || $.data( _inputLast.slider().get( 0 ), "mobile-slider" ), _sliderFirst = _sliderWidgetFirst.slider, _sliderLast = _sliderWidgetLast.slider, firstHandle = _sliderWidgetFirst.handle, _sliders = $( "<div class='ui-rangeslider-sliders' />" ).appendTo( $el ); _inputFirst.addClass( "ui-rangeslider-first" ); _inputLast.addClass( "ui-rangeslider-last" ); $el.addClass( elClass ); _sliderFirst.appendTo( _sliders ); _sliderLast.appendTo( _sliders ); _label.insertBefore( $el ); firstHandle.prependTo( _sliderLast ); $.extend( this, { _inputFirst: _inputFirst, _inputLast: _inputLast, _sliderFirst: _sliderFirst, _sliderLast: _sliderLast, _label: _label, _targetVal: null, _sliderTarget: false, _sliders: _sliders, _proxy: false }); this.refresh(); this._on( this.element.find( "input.ui-slider-input" ), { "slidebeforestart": "_slidebeforestart", "slidestop": "_slidestop", "slidedrag": "_slidedrag", "slidebeforechange": "_change", "blur": "_change", "keyup": "_change" }); this._on({ "mousedown":"_change" }); this._on( this.element.closest( "form" ), { "reset":"_handleReset" }); this._on( firstHandle, { "vmousedown": "_dragFirstHandle" }); }, _handleReset: function() { var self = this; //we must wait for the stack to unwind before updateing other wise sliders will not have updated yet setTimeout( function() { self._updateHighlight(); },0); }, _dragFirstHandle: function( event ) { //if the first handle is dragged send the event to the first slider $.data( this._inputFirst.get(0), "mobile-slider" ).dragging = true; $.data( this._inputFirst.get(0), "mobile-slider" ).refresh( event ); return false; }, _slidedrag: function( event ) { var first = $( event.target ).is( this._inputFirst ), otherSlider = ( first ) ? this._inputLast : this._inputFirst; this._sliderTarget = false; //if the drag was initiated on an extreme and the other handle is focused send the events to //the closest handle if ( ( this._proxy === "first" && first ) || ( this._proxy === "last" && !first ) ) { $.data( otherSlider.get(0), "mobile-slider" ).dragging = true; $.data( otherSlider.get(0), "mobile-slider" ).refresh( event ); return false; } }, _slidestop: function( event ) { var first = $( event.target ).is( this._inputFirst ); this._proxy = false; //this stops dragging of the handle and brings the active track to the front //this makes clicks on the track go the the last handle used this.element.find( "input" ).trigger( "vmouseup" ); this._sliderFirst.css( "z-index", first ? 1 : "" ); }, _slidebeforestart: function( event ) { this._sliderTarget = false; //if the track is the target remember this and the original value if ( $( event.originalEvent.target ).hasClass( "ui-slider-track" ) ) { this._sliderTarget = true; this._targetVal = $( event.target ).val(); } }, _setOptions: function( options ) { if ( options.theme !== undefined ) { this._setTheme( options.theme ); } if ( options.trackTheme !== undefined ) { this._setTrackTheme( options.trackTheme ); } if ( options.mini !== undefined ) { this._setMini( options.mini ); } if ( options.highlight !== undefined ) { this._setHighlight( options.highlight ); } this._super( options ); this.refresh(); }, refresh: function() { var $el = this.element, o = this.options; if ( this._inputFirst.is( ":disabled" ) || this._inputLast.is( ":disabled" ) ) { this.options.disabled = true; } $el.find( "input" ).slider({ theme: o.theme, trackTheme: o.trackTheme, disabled: o.disabled, corners: o.corners, mini: o.mini, highlight: o.highlight }).slider( "refresh" ); this._updateHighlight(); }, _change: function( event ) { if ( event.type === "keyup" ) { this._updateHighlight(); return false; } var self = this, min = parseFloat( this._inputFirst.val(), 10 ), max = parseFloat( this._inputLast.val(), 10 ), first = $( event.target ).hasClass( "ui-rangeslider-first" ), thisSlider = first ? this._inputFirst : this._inputLast, otherSlider = first ? this._inputLast : this._inputFirst; if ( ( this._inputFirst.val() > this._inputLast.val() && event.type === "mousedown" && !$(event.target).hasClass("ui-slider-handle")) ) { thisSlider.blur(); } else if ( event.type === "mousedown" ) { return; } if ( min > max && !this._sliderTarget ) { //this prevents min from being greater then max thisSlider.val( first ? max: min ).slider( "refresh" ); this._trigger( "normalize" ); } else if ( min > max ) { //this makes it so clicks on the target on either extreme go to the closest handle thisSlider.val( this._targetVal ).slider( "refresh" ); //You must wait for the stack to unwind so first slider is updated before updating second setTimeout( function() { otherSlider.val( first ? min: max ).slider( "refresh" ); $.data( otherSlider.get(0), "mobile-slider" ).handle.focus(); self._sliderFirst.css( "z-index", first ? "" : 1 ); self._trigger( "normalize" ); }, 0 ); this._proxy = ( first ) ? "first" : "last"; } //fixes issue where when both _sliders are at min they cannot be adjusted if ( min === max ) { $.data( thisSlider.get(0), "mobile-slider" ).handle.css( "z-index", 1 ); $.data( otherSlider.get(0), "mobile-slider" ).handle.css( "z-index", 0 ); } else { $.data( otherSlider.get(0), "mobile-slider" ).handle.css( "z-index", "" ); $.data( thisSlider.get(0), "mobile-slider" ).handle.css( "z-index", "" ); } this._updateHighlight(); if ( min >= max ) { return false; } }, _updateHighlight: function() { var min = parseInt( $.data( this._inputFirst.get(0), "mobile-slider" ).handle.get(0).style.left, 10 ), max = parseInt( $.data( this._inputLast.get(0), "mobile-slider" ).handle.get(0).style.left, 10 ), width = (max - min); this.element.find( ".ui-slider-bg" ).css({ "margin-left": min + "%", "width": width + "%" }); }, _setTheme: function( value ) { this._inputFirst.slider( "option", "theme", value ); this._inputLast.slider( "option", "theme", value ); }, _setTrackTheme: function( value ) { this._inputFirst.slider( "option", "trackTheme", value ); this._inputLast.slider( "option", "trackTheme", value ); }, _setMini: function( value ) { this._inputFirst.slider( "option", "mini", value ); this._inputLast.slider( "option", "mini", value ); this.element.toggleClass( "ui-mini", !!value ); }, _setHighlight: function( value ) { this._inputFirst.slider( "option", "highlight", value ); this._inputLast.slider( "option", "highlight", value ); }, _destroy: function() { this._label.prependTo( this.element ); this.element.removeClass( "ui-rangeslider ui-mini" ); this._inputFirst.after( this._sliderFirst ); this._inputLast.after( this._sliderLast ); this._sliders.remove(); this.element.find( "input" ).removeClass( "ui-rangeslider-first ui-rangeslider-last" ).slider( "destroy" ); } }, $.mobile.behaviors.formReset ) ); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.textinput", $.mobile.textinput, { options: { clearBtn: false, clearBtnText: "Clear text" }, _create: function() { this._super(); if ( !!this.options.clearBtn || this.isSearch ) { this._addClearBtn(); } }, clearButton: function() { return $( "<a href='#' class='ui-input-clear ui-btn ui-icon-delete ui-btn-icon-notext ui-corner-all" + "' title='" + this.options.clearBtnText + "'>" + this.options.clearBtnText + "</a>" ); }, _clearBtnClick: function( event ) { this.element.val( "" ) .focus() .trigger( "change" ); this._clearBtn.addClass( "ui-input-clear-hidden" ); event.preventDefault(); }, _addClearBtn: function() { if ( !this.options.enhanced ) { this._enhanceClear(); } $.extend( this, { _clearBtn: this.widget().find("a.ui-input-clear") }); this._bindClearEvents(); this._toggleClear(); }, _enhanceClear: function() { this.clearButton().appendTo( this.widget() ); this.widget().addClass( "ui-input-has-clear" ); }, _bindClearEvents: function() { this._on( this._clearBtn, { "click": "_clearBtnClick" }); this._on({ "keyup": "_toggleClear", "change": "_toggleClear", "input": "_toggleClear", "focus": "_toggleClear", "blur": "_toggleClear", "cut": "_toggleClear", "paste": "_toggleClear" }); }, _unbindClear: function() { this._off( this._clearBtn, "click"); this._off( this.element, "keyup change input focus blur cut paste" ); }, _setOptions: function( options ) { this._super( options ); if ( options.clearbtn !== undefined && !this.element.is( "textarea, :jqmData(type='range')" ) ) { if ( options.clearBtn ) { this._addClearBtn(); } else { this._destroyClear(); } } if ( options.clearBtnText !== undefined && this._clearBtn !== undefined ) { this._clearBtn.text( options.clearBtnText ); } }, _toggleClear: function() { this._delay( "_toggleClearClass", 0 ); }, _toggleClearClass: function() { this._clearBtn.toggleClass( "ui-input-clear-hidden", !this.element.val() ); }, _destroyClear: function() { this.element.removeClass( "ui-input-has-clear" ); this._unbindClear()._clearBtn.remove(); }, _destroy: function() { this._super(); this._destroyClear(); } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.textinput", $.mobile.textinput, { options: { autogrow:true, keyupTimeoutBuffer: 100 }, _create: function() { this._super(); if ( this.options.autogrow && this.isTextarea ) { this._autogrow(); } }, _autogrow: function() { this._on({ "keyup": "_timeout", "change": "_timeout", "input": "_timeout", "paste": "_timeout", }); // Attach to the various you-have-become-visible notifications that the // various framework elements emit. // TODO: Remove all but the updatelayout handler once #6426 is fixed. this._on( true, this.document, { // TODO: Move to non-deprecated event "pageshow": "_handleShow", "popupbeforeposition": "_handleShow", "updatelayout": "_handleShow", "panelopen": "_handleShow" }); }, // Synchronously fix the widget height if this widget's parents are such // that they show/hide content at runtime. We still need to check whether // the widget is actually visible in case it is contained inside multiple // such containers. For example: panel contains collapsible contains // autogrow textinput. The panel may emit "panelopen" indicating that its // content has become visible, but the collapsible is still collapsed, so // the autogrow textarea is still not visible. _handleShow: function( event ) { if ( $.contains( event.target, this.element[ 0 ] ) && this.element.is( ":visible" ) ) { if ( event.type !== "popupbeforeposition" ) { this.element .addClass( "ui-textinput-autogrow-resize" ) .one( "transitionend webkitTransitionEnd oTransitionEnd", $.proxy( function() { this.element.removeClass( "ui-textinput-autogrow-resize" ); }, this ) ); } this._prepareHeightUpdate(); } }, _unbindAutogrow: function() { this._off( this.element, "keyup change input paste" ); this._off( this.document, "pageshow popupbeforeposition updatelayout panelopen" ); }, keyupTimeout: null, _prepareHeightUpdate: function( delay ) { if ( this.keyupTimeout ) { clearTimeout( this.keyupTimeout ); } if ( delay === undefined ) { this._updateHeight(); } else { this.keyupTimeout = this._delay( "_updateHeight", delay ); } }, _timeout: function() { this._prepareHeightUpdate( this.options.keyupTimeoutBuffer ); }, _updateHeight: function() { this.keyupTimeout = 0; this.element.css({ "height": 0, "min-height": 0, "max-height": 0 }); var paddingTop, paddingBottom, paddingHeight, scrollHeight = this.element[ 0 ].scrollHeight, clientHeight = this.element[ 0 ].clientHeight, borderTop = parseFloat( this.element.css( "border-top-width" ) ), borderBottom = parseFloat( this.element.css( "border-bottom-width" ) ), borderHeight = borderTop + borderBottom, height = scrollHeight + borderHeight + 15; // Issue 6179: Padding is not included in scrollHeight and // clientHeight by Firefox if no scrollbar is visible. Because // textareas use the border-box box-sizing model, padding should be // included in the new (assigned) height. Because the height is set // to 0, clientHeight == 0 in Firefox. Therefore, we can use this to // check if padding must be added. if ( clientHeight === 0 ) { paddingTop = parseFloat( this.element.css( "padding-top" ) ); paddingBottom = parseFloat( this.element.css( "padding-bottom" ) ); paddingHeight = paddingTop + paddingBottom; height += paddingHeight; } this.element.css({ "height": height, "min-height": "", "max-height": "" }); }, refresh: function() { if ( this.options.autogrow && this.isTextarea ) { this._updateHeight(); } }, _setOptions: function( options ) { this._super( options ); if ( options.autogrow !== undefined && this.isTextarea ) { if ( options.autogrow ) { this._autogrow(); } else { this._unbindAutogrow(); } } } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.selectmenu", $.extend( { initSelector: "select:not( :jqmData(role='slider')):not( :jqmData(role='flipswitch') )", options: { theme: null, icon: "carat-d", iconpos: "right", inline: false, corners: true, shadow: true, iconshadow: false, /* TODO: Deprecated in 1.4, remove in 1.5. */ overlayTheme: null, dividerTheme: null, hidePlaceholderMenuItems: true, closeText: "Close", nativeMenu: true, // This option defaults to true on iOS devices. preventFocusZoom: /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1, mini: false }, _button: function() { return $( "<div/>" ); }, _setDisabled: function( value ) { this.element.attr( "disabled", value ); this.button.attr( "aria-disabled", value ); return this._setOption( "disabled", value ); }, _focusButton : function() { var self = this; setTimeout( function() { self.button.focus(); }, 40); }, _selectOptions: function() { return this.select.find( "option" ); }, // setup items that are generally necessary for select menu extension _preExtension: function() { var inline = this.options.inline || this.element.jqmData( "inline" ), mini = this.options.mini || this.element.jqmData( "mini" ), classes = ""; // TODO: Post 1.1--once we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577 /* if ( $el[0].className.length ) { classes = $el[0].className; } */ if ( !!~this.element[0].className.indexOf( "ui-btn-left" ) ) { classes = " ui-btn-left"; } if ( !!~this.element[0].className.indexOf( "ui-btn-right" ) ) { classes = " ui-btn-right"; } if ( inline ) { classes += " ui-btn-inline"; } if ( mini ) { classes += " ui-mini"; } this.select = this.element.removeClass( "ui-btn-left ui-btn-right" ).wrap( "<div class='ui-select" + classes + "'>" ); this.selectId = this.select.attr( "id" ) || ( "select-" + this.uuid ); this.buttonId = this.selectId + "-button"; this.label = $( "label[for='"+ this.selectId +"']" ); this.isMultiple = this.select[ 0 ].multiple; }, _destroy: function() { var wrapper = this.element.parents( ".ui-select" ); if ( wrapper.length > 0 ) { if ( wrapper.is( ".ui-btn-left, .ui-btn-right" ) ) { this.element.addClass( wrapper.hasClass( "ui-btn-left" ) ? "ui-btn-left" : "ui-btn-right" ); } this.element.insertAfter( wrapper ); wrapper.remove(); } }, _create: function() { this._preExtension(); this.button = this._button(); var self = this, options = this.options, iconpos = options.icon ? ( options.iconpos || this.select.jqmData( "iconpos" ) ) : false, button = this.button .insertBefore( this.select ) .attr( "id", this.buttonId ) .addClass( "ui-btn" + ( options.icon ? ( " ui-icon-" + options.icon + " ui-btn-icon-" + iconpos + ( options.iconshadow ? " ui-shadow-icon" : "" ) ) : "" ) + /* TODO: Remove in 1.5. */ ( options.theme ? " ui-btn-" + options.theme : "" ) + ( options.corners ? " ui-corner-all" : "" ) + ( options.shadow ? " ui-shadow" : "" ) ); this.setButtonText(); // Opera does not properly support opacity on select elements // In Mini, it hides the element, but not its text // On the desktop,it seems to do the opposite // for these reasons, using the nativeMenu option results in a full native select in Opera if ( options.nativeMenu && window.opera && window.opera.version ) { button.addClass( "ui-select-nativeonly" ); } // Add counter for multi selects if ( this.isMultiple ) { this.buttonCount = $( "<span>" ) .addClass( "ui-li-count ui-body-inherit" ) .hide() .appendTo( button.addClass( "ui-li-has-count" ) ); } // Disable if specified if ( options.disabled || this.element.attr( "disabled" )) { this.disable(); } // Events on native select this.select.change(function() { self.refresh(); if ( !!options.nativeMenu ) { this.blur(); } }); this._handleFormReset(); this._on( this.button, { keydown: "_handleKeydown" }); this.build(); }, build: function() { var self = this; this.select .appendTo( self.button ) .bind( "vmousedown", function() { // Add active class to button self.button.addClass( $.mobile.activeBtnClass ); }) .bind( "focus", function() { self.button.addClass( $.mobile.focusClass ); }) .bind( "blur", function() { self.button.removeClass( $.mobile.focusClass ); }) .bind( "focus vmouseover", function() { self.button.trigger( "vmouseover" ); }) .bind( "vmousemove", function() { // Remove active class on scroll/touchmove self.button.removeClass( $.mobile.activeBtnClass ); }) .bind( "change blur vmouseout", function() { self.button.trigger( "vmouseout" ) .removeClass( $.mobile.activeBtnClass ); }); // In many situations, iOS will zoom into the select upon tap, this prevents that from happening self.button.bind( "vmousedown", function() { if ( self.options.preventFocusZoom ) { $.mobile.zoom.disable( true ); } }); self.label.bind( "click focus", function() { if ( self.options.preventFocusZoom ) { $.mobile.zoom.disable( true ); } }); self.select.bind( "focus", function() { if ( self.options.preventFocusZoom ) { $.mobile.zoom.disable( true ); } }); self.button.bind( "mouseup", function() { if ( self.options.preventFocusZoom ) { setTimeout(function() { $.mobile.zoom.enable( true ); }, 0 ); } }); self.select.bind( "blur", function() { if ( self.options.preventFocusZoom ) { $.mobile.zoom.enable( true ); } }); }, selected: function() { return this._selectOptions().filter( ":selected" ); }, selectedIndices: function() { var self = this; return this.selected().map(function() { return self._selectOptions().index( this ); }).get(); }, setButtonText: function() { var self = this, selected = this.selected(), text = this.placeholder, span = $( document.createElement( "span" ) ); this.button.children( "span" ).not( ".ui-li-count" ).remove().end().end().prepend( (function() { if ( selected.length ) { text = selected.map(function() { return $( this ).text(); }).get().join( ", " ); } else { text = self.placeholder; } if ( text ) { span.text( text ); } else { span.html( "&nbsp;" ); } // TODO possibly aggregate multiple select option classes return span .addClass( self.select.attr( "class" ) ) .addClass( selected.attr( "class" ) ) .removeClass( "ui-screen-hidden" ); })()); }, setButtonCount: function() { var selected = this.selected(); // multiple count inside button if ( this.isMultiple ) { this.buttonCount[ selected.length > 1 ? "show" : "hide" ]().text( selected.length ); } }, _handleKeydown: function( /* event */ ) { this._delay( "_refreshButton" ); }, _reset: function() { this.refresh(); }, _refreshButton: function() { this.setButtonText(); this.setButtonCount(); }, refresh: function() { this._refreshButton(); }, // open and close preserved in native selects // to simplify users code when looping over selects open: $.noop, close: $.noop, disable: function() { this._setDisabled( true ); this.button.addClass( "ui-state-disabled" ); }, enable: function() { this._setDisabled( false ); this.button.removeClass( "ui-state-disabled" ); } }, $.mobile.behaviors.formReset ) ); })( jQuery ); (function( $, undefined ) { $.mobile.links = function( target ) { //links within content areas, tests included with page $( target ) .find( "a" ) .jqmEnhanceable() .filter( ":jqmData(rel='popup')[href][href!='']" ) .each( function() { // Accessibility info for popups var element = this, idref = element.getAttribute( "href" ).substring( 1 ); if ( idref ) { element.setAttribute( "aria-haspopup", true ); element.setAttribute( "aria-owns", idref ); element.setAttribute( "aria-expanded", false ); } }) .end() .not( ".ui-btn, :jqmData(role='none'), :jqmData(role='nojs')" ) .addClass( "ui-link" ); }; })( jQuery ); (function( $, undefined ) { function fitSegmentInsideSegment( windowSize, segmentSize, offset, desired ) { var returnValue = desired; if ( windowSize < segmentSize ) { // Center segment if it's bigger than the window returnValue = offset + ( windowSize - segmentSize ) / 2; } else { // Otherwise center it at the desired coordinate while keeping it completely inside the window returnValue = Math.min( Math.max( offset, desired - segmentSize / 2 ), offset + windowSize - segmentSize ); } return returnValue; } function getWindowCoordinates( theWindow ) { return { x: theWindow.scrollLeft(), y: theWindow.scrollTop(), cx: ( theWindow[ 0 ].innerWidth || theWindow.width() ), cy: ( theWindow[ 0 ].innerHeight || theWindow.height() ) }; } $.widget( "mobile.popup", { options: { wrapperClass: null, theme: null, overlayTheme: null, shadow: true, corners: true, transition: "none", positionTo: "origin", tolerance: null, closeLinkSelector: "a:jqmData(rel='back')", closeLinkEvents: "click.popup", navigateEvents: "navigate.popup", closeEvents: "navigate.popup pagebeforechange.popup", dismissible: true, enhanced: false, // NOTE Windows Phone 7 has a scroll position caching issue that // requires us to disable popup history management by default // https://github.com/jquery/jquery-mobile/issues/4784 // // NOTE this option is modified in _create! history: !$.mobile.browser.oldIE }, _create: function() { var theElement = this.element, myId = theElement.attr( "id" ), currentOptions = this.options; // We need to adjust the history option to be false if there's no AJAX nav. // We can't do it in the option declarations because those are run before // it is determined whether there shall be AJAX nav. currentOptions.history = currentOptions.history && $.mobile.ajaxEnabled && $.mobile.hashListeningEnabled; // Define instance variables $.extend( this, { _scrollTop: 0, _page: theElement.closest( ".ui-page" ), _ui: null, _fallbackTransition: "", _currentTransition: false, _prerequisites: null, _isOpen: false, _tolerance: null, _resizeData: null, _ignoreResizeTo: 0, _orientationchangeInProgress: false }); if ( this._page.length === 0 ) { this._page = $( "body" ); } if ( currentOptions.enhanced ) { this._ui = { container: theElement.parent(), screen: theElement.parent().prev(), placeholder: $( this.document[ 0 ].getElementById( myId + "-placeholder" ) ) }; } else { this._ui = this._enhance( theElement, myId ); this._applyTransition( currentOptions.transition ); } this ._setTolerance( currentOptions.tolerance ) ._ui.focusElement = this._ui.container; // Event handlers this._on( this._ui.screen, { "vclick": "_eatEventAndClose" } ); this._on( this.window, { orientationchange: $.proxy( this, "_handleWindowOrientationchange" ), resize: $.proxy( this, "_handleWindowResize" ), keyup: $.proxy( this, "_handleWindowKeyUp" ) }); this._on( this.document, { "focusin": "_handleDocumentFocusIn" } ); }, _enhance: function( theElement, myId ) { var currentOptions = this.options, wrapperClass = currentOptions.wrapperClass, ui = { screen: $( "<div class='ui-screen-hidden ui-popup-screen " + this._themeClassFromOption( "ui-overlay-", currentOptions.overlayTheme ) + "'></div>" ), placeholder: $( "<div style='display: none;'><!-- placeholder --></div>" ), container: $( "<div class='ui-popup-container ui-popup-hidden ui-popup-truncate" + ( wrapperClass ? ( " " + wrapperClass ) : "" ) + "'></div>" ) }, fragment = this.document[ 0 ].createDocumentFragment(); fragment.appendChild( ui.screen[ 0 ] ); fragment.appendChild( ui.container[ 0 ] ); if ( myId ) { ui.screen.attr( "id", myId + "-screen" ); ui.container.attr( "id", myId + "-popup" ); ui.placeholder .attr( "id", myId + "-placeholder" ) .html( "<!-- placeholder for " + myId + " -->" ); } // Apply the proto this._page[ 0 ].appendChild( fragment ); // Leave a placeholder where the element used to be ui.placeholder.insertAfter( theElement ); theElement .detach() .addClass( "ui-popup " + this._themeClassFromOption( "ui-body-", currentOptions.theme ) + " " + ( currentOptions.shadow ? "ui-overlay-shadow " : "" ) + ( currentOptions.corners ? "ui-corner-all " : "" ) ) .appendTo( ui.container ); return ui; }, _eatEventAndClose: function( theEvent ) { theEvent.preventDefault(); theEvent.stopImmediatePropagation(); if ( this.options.dismissible ) { this.close(); } return false; }, // Make sure the screen covers the entire document - CSS is sometimes not // enough to accomplish this. _resizeScreen: function() { var screen = this._ui.screen, popupHeight = this._ui.container.outerHeight( true ), screenHeight = screen.removeAttr( "style" ).height(), // Subtracting 1 here is necessary for an obscure Andrdoid 4.0 bug where // the browser hangs if the screen covers the entire document :/ documentHeight = this.document.height() - 1; if ( screenHeight < documentHeight ) { screen.height( documentHeight ); } else if ( popupHeight > screenHeight ) { screen.height( popupHeight ); } }, _handleWindowKeyUp: function( theEvent ) { if ( this._isOpen && theEvent.keyCode === $.mobile.keyCode.ESCAPE ) { return this._eatEventAndClose( theEvent ); } }, _expectResizeEvent: function() { var windowCoordinates = getWindowCoordinates( this.window ); if ( this._resizeData ) { if ( windowCoordinates.x === this._resizeData.windowCoordinates.x && windowCoordinates.y === this._resizeData.windowCoordinates.y && windowCoordinates.cx === this._resizeData.windowCoordinates.cx && windowCoordinates.cy === this._resizeData.windowCoordinates.cy ) { // timeout not refreshed return false; } else { // clear existing timeout - it will be refreshed below clearTimeout( this._resizeData.timeoutId ); } } this._resizeData = { timeoutId: this._delay( "_resizeTimeout", 200 ), windowCoordinates: windowCoordinates }; return true; }, _resizeTimeout: function() { if ( this._isOpen ) { if ( !this._expectResizeEvent() ) { if ( this._ui.container.hasClass( "ui-popup-hidden" ) ) { // effectively rapid-open the popup while leaving the screen intact this._ui.container.removeClass( "ui-popup-hidden ui-popup-truncate" ); this.reposition( { positionTo: "window" } ); this._ignoreResizeEvents(); } this._resizeScreen(); this._resizeData = null; this._orientationchangeInProgress = false; } } else { this._resizeData = null; this._orientationchangeInProgress = false; } }, _stopIgnoringResizeEvents: function() { this._ignoreResizeTo = 0; }, _ignoreResizeEvents: function() { if ( this._ignoreResizeTo ) { clearTimeout( this._ignoreResizeTo ); } this._ignoreResizeTo = this._delay( "_stopIgnoringResizeEvents", 1000 ); }, _handleWindowResize: function(/* theEvent */) { if ( this._isOpen && this._ignoreResizeTo === 0 ) { if ( ( this._expectResizeEvent() || this._orientationchangeInProgress ) && !this._ui.container.hasClass( "ui-popup-hidden" ) ) { // effectively rapid-close the popup while leaving the screen intact this._ui.container .addClass( "ui-popup-hidden ui-popup-truncate" ) .removeAttr( "style" ); } } }, _handleWindowOrientationchange: function(/* theEvent */) { if ( !this._orientationchangeInProgress && this._isOpen && this._ignoreResizeTo === 0 ) { this._expectResizeEvent(); this._orientationchangeInProgress = true; } }, // When the popup is open, attempting to focus on an element that is not a // child of the popup will redirect focus to the popup _handleDocumentFocusIn: function( theEvent ) { var target, targetElement = theEvent.target, ui = this._ui; if ( !this._isOpen ) { return; } if ( targetElement !== ui.container[ 0 ] ) { target = $( targetElement ); if ( 0 === target.parents().filter( ui.container[ 0 ] ).length ) { $( this.document[ 0 ].activeElement ).one( "focus", function(/* theEvent */) { target.blur(); }); ui.focusElement.focus(); theEvent.preventDefault(); theEvent.stopImmediatePropagation(); return false; } else if ( ui.focusElement[ 0 ] === ui.container[ 0 ] ) { ui.focusElement = target; } } this._ignoreResizeEvents(); }, _themeClassFromOption: function( prefix, value ) { return ( value ? ( value === "none" ? "" : ( prefix + value ) ) : ( prefix + "inherit" ) ); }, _applyTransition: function( value ) { if ( value ) { this._ui.container.removeClass( this._fallbackTransition ); if ( value !== "none" ) { this._fallbackTransition = $.mobile._maybeDegradeTransition( value ); if ( this._fallbackTransition === "none" ) { this._fallbackTransition = ""; } this._ui.container.addClass( this._fallbackTransition ); } } return this; }, _setOptions: function( newOptions ) { var currentOptions = this.options, theElement = this.element, screen = this._ui.screen; if ( newOptions.wrapperClass !== undefined ) { this._ui.container .removeClass( currentOptions.wrapperClass ) .addClass( newOptions.wrapperClass ); } if ( newOptions.theme !== undefined ) { theElement .removeClass( this._themeClassFromOption( "ui-body-", currentOptions.theme ) ) .addClass( this._themeClassFromOption( "ui-body-", newOptions.theme ) ); } if ( newOptions.overlayTheme !== undefined ) { screen .removeClass( this._themeClassFromOption( "ui-overlay-", currentOptions.overlayTheme ) ) .addClass( this._themeClassFromOption( "ui-overlay-", newOptions.overlayTheme ) ); if ( this._isOpen ) { screen.addClass( "in" ); } } if ( newOptions.shadow !== undefined ) { theElement.toggleClass( "ui-overlay-shadow", newOptions.shadow ); } if ( newOptions.corners !== undefined ) { theElement.toggleClass( "ui-corner-all", newOptions.corners ); } if ( newOptions.transition !== undefined ) { if ( !this._currentTransition ) { this._applyTransition( newOptions.transition ); } } if ( newOptions.tolerance !== undefined ) { this._setTolerance( newOptions.tolerance ); } if ( newOptions.disabled !== undefined ) { if ( newOptions.disabled ) { this.close(); } } return this._super( newOptions ); }, _setTolerance: function( value ) { var tol = { t: 30, r: 15, b: 30, l: 15 }, ar; if ( value !== undefined ) { ar = String( value ).split( "," ); $.each( ar, function( idx, val ) { ar[ idx ] = parseInt( val, 10 ); } ); switch( ar.length ) { // All values are to be the same case 1: if ( !isNaN( ar[ 0 ] ) ) { tol.t = tol.r = tol.b = tol.l = ar[ 0 ]; } break; // The first value denotes top/bottom tolerance, and the second value denotes left/right tolerance case 2: if ( !isNaN( ar[ 0 ] ) ) { tol.t = tol.b = ar[ 0 ]; } if ( !isNaN( ar[ 1 ] ) ) { tol.l = tol.r = ar[ 1 ]; } break; // The array contains values in the order top, right, bottom, left case 4: if ( !isNaN( ar[ 0 ] ) ) { tol.t = ar[ 0 ]; } if ( !isNaN( ar[ 1 ] ) ) { tol.r = ar[ 1 ]; } if ( !isNaN( ar[ 2 ] ) ) { tol.b = ar[ 2 ]; } if ( !isNaN( ar[ 3 ] ) ) { tol.l = ar[ 3 ]; } break; default: break; } } this._tolerance = tol; return this; }, _clampPopupWidth: function( infoOnly ) { var menuSize, windowCoordinates = getWindowCoordinates( this.window ), // rectangle within which the popup must fit rectangle = { x: this._tolerance.l, y: windowCoordinates.y + this._tolerance.t, cx: windowCoordinates.cx - this._tolerance.l - this._tolerance.r, cy: windowCoordinates.cy - this._tolerance.t - this._tolerance.b }; if ( !infoOnly ) { // Clamp the width of the menu before grabbing its size this._ui.container.css( "max-width", rectangle.cx ); } menuSize = { cx: this._ui.container.outerWidth( true ), cy: this._ui.container.outerHeight( true ) }; return { rc: rectangle, menuSize: menuSize }; }, _calculateFinalLocation: function( desired, clampInfo ) { var returnValue, rectangle = clampInfo.rc, menuSize = clampInfo.menuSize; // Center the menu over the desired coordinates, while not going outside // the window tolerances. This will center wrt. the window if the popup is // too large. returnValue = { left: fitSegmentInsideSegment( rectangle.cx, menuSize.cx, rectangle.x, desired.x ), top: fitSegmentInsideSegment( rectangle.cy, menuSize.cy, rectangle.y, desired.y ) }; // Make sure the top of the menu is visible returnValue.top = Math.max( 0, returnValue.top ); // If the height of the menu is smaller than the height of the document // align the bottom with the bottom of the document returnValue.top -= Math.min( returnValue.top, Math.max( 0, returnValue.top + menuSize.cy - this.document.height() ) ); return returnValue; }, // Try and center the overlay over the given coordinates _placementCoords: function( desired ) { return this._calculateFinalLocation( desired, this._clampPopupWidth() ); }, _createPrerequisites: function( screenPrerequisite, containerPrerequisite, whenDone ) { var prerequisites, self = this; // It is important to maintain both the local variable prerequisites and // self._prerequisites. The local variable remains in the closure of the // functions which call the callbacks passed in. The comparison between the // local variable and self._prerequisites is necessary, because once a // function has been passed to .animationComplete() it will be called next // time an animation completes, even if that's not the animation whose end // the function was supposed to catch (for example, if an abort happens // during the opening animation, the .animationComplete handler is not // called for that animation anymore, but the handler remains attached, so // it is called the next time the popup is opened - making it stale. // Comparing the local variable prerequisites to the widget-level variable // self._prerequisites ensures that callbacks triggered by a stale // .animationComplete will be ignored. prerequisites = { screen: $.Deferred(), container: $.Deferred() }; prerequisites.screen.then( function() { if ( prerequisites === self._prerequisites ) { screenPrerequisite(); } }); prerequisites.container.then( function() { if ( prerequisites === self._prerequisites ) { containerPrerequisite(); } }); $.when( prerequisites.screen, prerequisites.container ).done( function() { if ( prerequisites === self._prerequisites ) { self._prerequisites = null; whenDone(); } }); self._prerequisites = prerequisites; }, _animate: function( args ) { // NOTE before removing the default animation of the screen // this had an animate callback that would resolve the deferred // now the deferred is resolved immediately // TODO remove the dependency on the screen deferred this._ui.screen .removeClass( args.classToRemove ) .addClass( args.screenClassToAdd ); args.prerequisites.screen.resolve(); if ( args.transition && args.transition !== "none" ) { if ( args.applyTransition ) { this._applyTransition( args.transition ); } if ( this._fallbackTransition ) { this._ui.container .animationComplete( $.proxy( args.prerequisites.container, "resolve" ) ) .addClass( args.containerClassToAdd ) .removeClass( args.classToRemove ); return; } } this._ui.container.removeClass( args.classToRemove ); args.prerequisites.container.resolve(); }, // The desired coordinates passed in will be returned untouched if no reference element can be identified via // desiredPosition.positionTo. Nevertheless, this function ensures that its return value always contains valid // x and y coordinates by specifying the center middle of the window if the coordinates are absent. // options: { x: coordinate, y: coordinate, positionTo: string: "origin", "window", or jQuery selector _desiredCoords: function( openOptions ) { var offset, dst = null, windowCoordinates = getWindowCoordinates( this.window ), x = openOptions.x, y = openOptions.y, pTo = openOptions.positionTo; // Establish which element will serve as the reference if ( pTo && pTo !== "origin" ) { if ( pTo === "window" ) { x = windowCoordinates.cx / 2 + windowCoordinates.x; y = windowCoordinates.cy / 2 + windowCoordinates.y; } else { try { dst = $( pTo ); } catch( err ) { dst = null; } if ( dst ) { dst.filter( ":visible" ); if ( dst.length === 0 ) { dst = null; } } } } // If an element was found, center over it if ( dst ) { offset = dst.offset(); x = offset.left + dst.outerWidth() / 2; y = offset.top + dst.outerHeight() / 2; } // Make sure x and y are valid numbers - center over the window if ( $.type( x ) !== "number" || isNaN( x ) ) { x = windowCoordinates.cx / 2 + windowCoordinates.x; } if ( $.type( y ) !== "number" || isNaN( y ) ) { y = windowCoordinates.cy / 2 + windowCoordinates.y; } return { x: x, y: y }; }, _reposition: function( openOptions ) { // We only care about position-related parameters for repositioning openOptions = { x: openOptions.x, y: openOptions.y, positionTo: openOptions.positionTo }; this._trigger( "beforeposition", undefined, openOptions ); this._ui.container.offset( this._placementCoords( this._desiredCoords( openOptions ) ) ); }, reposition: function( openOptions ) { if ( this._isOpen ) { this._reposition( openOptions ); } }, _openPrerequisitesComplete: function() { var id = this.element.attr( "id" ); this._ui.container.addClass( "ui-popup-active" ); this._isOpen = true; this._resizeScreen(); this._ui.container.attr( "tabindex", "0" ).focus(); this._ignoreResizeEvents(); if ( id ) { this.document.find( "[aria-haspopup='true'][aria-owns='" + id + "']" ).attr( "aria-expanded", true ); } this._trigger( "afteropen" ); }, _open: function( options ) { var openOptions = $.extend( {}, this.options, options ), // TODO move blacklist to private method androidBlacklist = ( function() { var ua = navigator.userAgent, // Rendering engine is Webkit, and capture major version wkmatch = ua.match( /AppleWebKit\/([0-9\.]+)/ ), wkversion = !!wkmatch && wkmatch[ 1 ], androidmatch = ua.match( /Android (\d+(?:\.\d+))/ ), andversion = !!androidmatch && androidmatch[ 1 ], chromematch = ua.indexOf( "Chrome" ) > -1; // Platform is Android, WebKit version is greater than 534.13 ( Android 3.2.1 ) and not Chrome. if ( androidmatch !== null && andversion === "4.0" && wkversion && wkversion > 534.13 && !chromematch ) { return true; } return false; }()); // Count down to triggering "popupafteropen" - we have two prerequisites: // 1. The popup window animation completes (container()) // 2. The screen opacity animation completes (screen()) this._createPrerequisites( $.noop, $.noop, $.proxy( this, "_openPrerequisitesComplete" ) ); this._currentTransition = openOptions.transition; this._applyTransition( openOptions.transition ); this._ui.screen.removeClass( "ui-screen-hidden" ); this._ui.container.removeClass( "ui-popup-truncate" ); // Give applications a chance to modify the contents of the container before it appears this._reposition( openOptions ); this._ui.container.removeClass( "ui-popup-hidden" ); if ( this.options.overlayTheme && androidBlacklist ) { /* TODO: The native browser on Android 4.0.X ("Ice Cream Sandwich") suffers from an issue where the popup overlay appears to be z-indexed above the popup itself when certain other styles exist on the same page -- namely, any element set to `position: fixed` and certain types of input. These issues are reminiscent of previously uncovered bugs in older versions of Android's native browser: https://github.com/scottjehl/Device-Bugs/issues/3 This fix closes the following bugs ( I use "closes" with reluctance, and stress that this issue should be revisited as soon as possible ): https://github.com/jquery/jquery-mobile/issues/4816 https://github.com/jquery/jquery-mobile/issues/4844 https://github.com/jquery/jquery-mobile/issues/4874 */ // TODO sort out why this._page isn't working this.element.closest( ".ui-page" ).addClass( "ui-popup-open" ); } this._animate({ additionalCondition: true, transition: openOptions.transition, classToRemove: "", screenClassToAdd: "in", containerClassToAdd: "in", applyTransition: false, prerequisites: this._prerequisites }); }, _closePrerequisiteScreen: function() { this._ui.screen .removeClass( "out" ) .addClass( "ui-screen-hidden" ); }, _closePrerequisiteContainer: function() { this._ui.container .removeClass( "reverse out" ) .addClass( "ui-popup-hidden ui-popup-truncate" ) .removeAttr( "style" ); }, _closePrerequisitesDone: function() { var container = this._ui.container, id = this.element.attr( "id" ); container.removeAttr( "tabindex" ); // remove the global mutex for popups $.mobile.popup.active = undefined; // Blur elements inside the container, including the container $( ":focus", container[ 0 ] ).add( container[ 0 ] ).blur(); if ( id ) { this.document.find( "[aria-haspopup='true'][aria-owns='" + id + "']" ).attr( "aria-expanded", false ); } // alert users that the popup is closed this._trigger( "afterclose" ); }, _close: function( immediate ) { this._ui.container.removeClass( "ui-popup-active" ); this._page.removeClass( "ui-popup-open" ); this._isOpen = false; // Count down to triggering "popupafterclose" - we have two prerequisites: // 1. The popup window reverse animation completes (container()) // 2. The screen opacity animation completes (screen()) this._createPrerequisites( $.proxy( this, "_closePrerequisiteScreen" ), $.proxy( this, "_closePrerequisiteContainer" ), $.proxy( this, "_closePrerequisitesDone" ) ); this._animate( { additionalCondition: this._ui.screen.hasClass( "in" ), transition: ( immediate ? "none" : ( this._currentTransition ) ), classToRemove: "in", screenClassToAdd: "out", containerClassToAdd: "reverse out", applyTransition: true, prerequisites: this._prerequisites }); }, _unenhance: function() { if ( this.options.enhanced ) { return; } // Put the element back to where the placeholder was and remove the "ui-popup" class this._setOptions( { theme: $.mobile.popup.prototype.options.theme } ); this.element // Cannot directly insertAfter() - we need to detach() first, because // insertAfter() will do nothing if the payload div was not attached // to the DOM at the time the widget was created, and so the payload // will remain inside the container even after we call insertAfter(). // If that happens and we remove the container a few lines below, we // will cause an infinite recursion - #5244 .detach() .insertAfter( this._ui.placeholder ) .removeClass( "ui-popup ui-overlay-shadow ui-corner-all ui-body-inherit" ); this._ui.screen.remove(); this._ui.container.remove(); this._ui.placeholder.remove(); }, _destroy: function() { if ( $.mobile.popup.active === this ) { this.element.one( "popupafterclose", $.proxy( this, "_unenhance" ) ); this.close(); } else { this._unenhance(); } return this; }, _closePopup: function( theEvent, data ) { var parsedDst, toUrl, currentOptions = this.options, immediate = false; if ( ( theEvent && theEvent.isDefaultPrevented() ) || $.mobile.popup.active !== this ) { return; } // restore location on screen window.scrollTo( 0, this._scrollTop ); if ( theEvent && theEvent.type === "pagebeforechange" && data ) { // Determine whether we need to rapid-close the popup, or whether we can // take the time to run the closing transition if ( typeof data.toPage === "string" ) { parsedDst = data.toPage; } else { parsedDst = data.toPage.jqmData( "url" ); } parsedDst = $.mobile.path.parseUrl( parsedDst ); toUrl = parsedDst.pathname + parsedDst.search + parsedDst.hash; if ( this._myUrl !== $.mobile.path.makeUrlAbsolute( toUrl ) ) { // Going to a different page - close immediately immediate = true; } else { theEvent.preventDefault(); } } // remove nav bindings this.window.off( currentOptions.closeEvents ); // unbind click handlers added when history is disabled this.element.undelegate( currentOptions.closeLinkSelector, currentOptions.closeLinkEvents ); this._close( immediate ); }, // any navigation event after a popup is opened should close the popup // NOTE the pagebeforechange is bound to catch navigation events that don't // alter the url (eg, dialogs from popups) _bindContainerClose: function() { this.window .on( this.options.closeEvents, $.proxy( this, "_closePopup" ) ); }, widget: function() { return this._ui.container; }, // TODO no clear deliniation of what should be here and // what should be in _open. Seems to be "visual" vs "history" for now open: function( options ) { var url, hashkey, activePage, currentIsDialog, hasHash, urlHistory, self = this, currentOptions = this.options; // make sure open is idempotent if ( $.mobile.popup.active || currentOptions.disabled ) { return this; } // set the global popup mutex $.mobile.popup.active = this; this._scrollTop = this.window.scrollTop(); // if history alteration is disabled close on navigate events // and leave the url as is if ( !( currentOptions.history ) ) { self._open( options ); self._bindContainerClose(); // When histoy is disabled we have to grab the data-rel // back link clicks so we can close the popup instead of // relying on history to do it for us self.element .delegate( currentOptions.closeLinkSelector, currentOptions.closeLinkEvents, function( theEvent ) { self.close(); theEvent.preventDefault(); }); return this; } // cache some values for min/readability urlHistory = $.mobile.navigate.history; hashkey = $.mobile.dialogHashKey; activePage = $.mobile.activePage; currentIsDialog = ( activePage ? activePage.hasClass( "ui-dialog" ) : false ); this._myUrl = url = urlHistory.getActive().url; hasHash = ( url.indexOf( hashkey ) > -1 ) && !currentIsDialog && ( urlHistory.activeIndex > 0 ); if ( hasHash ) { self._open( options ); self._bindContainerClose(); return this; } // if the current url has no dialog hash key proceed as normal // otherwise, if the page is a dialog simply tack on the hash key if ( url.indexOf( hashkey ) === -1 && !currentIsDialog ) { url = url + (url.indexOf( "#" ) > -1 ? hashkey : "#" + hashkey); } else { url = $.mobile.path.parseLocation().hash + hashkey; } // Tack on an extra hashkey if this is the first page and we've just reconstructed the initial hash if ( urlHistory.activeIndex === 0 && url === urlHistory.initialDst ) { url += hashkey; } // swallow the the initial navigation event, and bind for the next this.window.one( "beforenavigate", function( theEvent ) { theEvent.preventDefault(); self._open( options ); self._bindContainerClose(); }); this.urlAltered = true; $.mobile.navigate( url, { role: "dialog" } ); return this; }, close: function() { // make sure close is idempotent if ( $.mobile.popup.active !== this ) { return this; } this._scrollTop = this.window.scrollTop(); if ( this.options.history && this.urlAltered ) { $.mobile.back(); this.urlAltered = false; } else { // simulate the nav bindings having fired this._closePopup(); } return this; } }); // TODO this can be moved inside the widget $.mobile.popup.handleLink = function( $link ) { var offset, path = $.mobile.path, // NOTE make sure to get only the hash from the href because ie7 (wp7) // returns the absolute href in this case ruining the element selection popup = $( path.hashToSelector( path.parseUrl( $link.attr( "href" ) ).hash ) ).first(); if ( popup.length > 0 && popup.data( "mobile-popup" ) ) { offset = $link.offset(); popup.popup( "open", { x: offset.left + $link.outerWidth() / 2, y: offset.top + $link.outerHeight() / 2, transition: $link.jqmData( "transition" ), positionTo: $link.jqmData( "position-to" ) }); } //remove after delay setTimeout( function() { $link.removeClass( $.mobile.activeBtnClass ); }, 300 ); }; // TODO move inside _create $.mobile.document.on( "pagebeforechange", function( theEvent, data ) { if ( data.options.role === "popup" ) { $.mobile.popup.handleLink( data.options.link ); theEvent.preventDefault(); } }); })( jQuery ); /* * custom "selectmenu" plugin */ (function( $, undefined ) { var unfocusableItemSelector = ".ui-disabled,.ui-state-disabled,.ui-li-divider,.ui-screen-hidden,:jqmData(role='placeholder')", goToAdjacentItem = function( item, target, direction ) { var adjacent = item[ direction + "All" ]() .not( unfocusableItemSelector ) .first(); // if there's a previous option, focus it if ( adjacent.length ) { target .blur() .attr( "tabindex", "-1" ); adjacent.find( "a" ).first().focus(); } }; $.widget( "mobile.selectmenu", $.mobile.selectmenu, { _create: function() { var o = this.options; // Custom selects cannot exist inside popups, so revert the "nativeMenu" // option to true if a parent is a popup o.nativeMenu = o.nativeMenu || ( this.element.parents( ":jqmData(role='popup'),:mobile-popup" ).length > 0 ); return this._super(); }, _handleSelectFocus: function() { this.element.blur(); this.button.focus(); }, _handleKeydown: function( event ) { this._super( event ); this._handleButtonVclickKeydown( event ); }, _handleButtonVclickKeydown: function( event ) { if ( this.options.disabled || this.isOpen ) { return; } if (event.type === "vclick" || event.keyCode && (event.keyCode === $.mobile.keyCode.ENTER || event.keyCode === $.mobile.keyCode.SPACE)) { this._decideFormat(); if ( this.menuType === "overlay" ) { this.button.attr( "href", "#" + this.popupId ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "popup" ); } else { this.button.attr( "href", "#" + this.dialogId ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "dialog" ); } this.isOpen = true; // Do not prevent default, so the navigation may have a chance to actually open the chosen format } }, _handleListFocus: function( e ) { var params = ( e.type === "focusin" ) ? { tabindex: "0", event: "vmouseover" }: { tabindex: "-1", event: "vmouseout" }; $( e.target ) .attr( "tabindex", params.tabindex ) .trigger( params.event ); }, _handleListKeydown: function( event ) { var target = $( event.target ), li = target.closest( "li" ); // switch logic based on which key was pressed switch ( event.keyCode ) { // up or left arrow keys case 38: goToAdjacentItem( li, target, "prev" ); return false; // down or right arrow keys case 40: goToAdjacentItem( li, target, "next" ); return false; // If enter or space is pressed, trigger click case 13: case 32: target.trigger( "click" ); return false; } }, _handleMenuPageHide: function() { // TODO centralize page removal binding / handling in the page plugin. // Suggestion from @jblas to do refcounting // // TODO extremely confusing dependency on the open method where the pagehide.remove // bindings are stripped to prevent the parent page from disappearing. The way // we're keeping pages in the DOM right now sucks // // rebind the page remove that was unbound in the open function // to allow for the parent page removal from actions other than the use // of a dialog sized custom select // // doing this here provides for the back button on the custom select dialog this.thisPage.page( "bindRemove" ); }, _handleHeaderCloseClick: function() { if ( this.menuType === "overlay" ) { this.close(); return false; } }, build: function() { var selectId, popupId, dialogId, label, thisPage, isMultiple, menuId, themeAttr, overlayThemeAttr, dividerThemeAttr, menuPage, listbox, list, header, headerTitle, menuPageContent, menuPageClose, headerClose, self, o = this.options; if ( o.nativeMenu ) { return this._super(); } self = this; selectId = this.selectId; popupId = selectId + "-listbox"; dialogId = selectId + "-dialog"; label = this.label; thisPage = this.element.closest( ".ui-page" ); isMultiple = this.element[ 0 ].multiple; menuId = selectId + "-menu"; themeAttr = o.theme ? ( " data-" + $.mobile.ns + "theme='" + o.theme + "'" ) : ""; overlayThemeAttr = o.overlayTheme ? ( " data-" + $.mobile.ns + "theme='" + o.overlayTheme + "'" ) : ""; dividerThemeAttr = ( o.dividerTheme && isMultiple ) ? ( " data-" + $.mobile.ns + "divider-theme='" + o.dividerTheme + "'" ) : ""; menuPage = $( "<div data-" + $.mobile.ns + "role='dialog' class='ui-selectmenu' id='" + dialogId + "'" + themeAttr + overlayThemeAttr + ">" + "<div data-" + $.mobile.ns + "role='header'>" + "<div class='ui-title'>" + label.getEncodedText() + "</div>"+ "</div>"+ "<div data-" + $.mobile.ns + "role='content'></div>"+ "</div>" ); listbox = $( "<div id='" + popupId + "' class='ui-selectmenu'>" ).insertAfter( this.select ).popup({ theme: o.overlayTheme }); list = $( "<ul class='ui-selectmenu-list' id='" + menuId + "' role='listbox' aria-labelledby='" + this.buttonId + "'" + themeAttr + dividerThemeAttr + ">" ).appendTo( listbox ); header = $( "<div class='ui-header ui-bar-" + ( o.theme ? o.theme : "inherit" ) + "'>" ).prependTo( listbox ); headerTitle = $( "<h1 class='ui-title'>" ).appendTo( header ); if ( this.isMultiple ) { headerClose = $( "<a>", { "role": "button", "text": o.closeText, "href": "#", "class": "ui-btn ui-corner-all ui-btn-left ui-btn-icon-notext ui-icon-delete" }).appendTo( header ); } $.extend( this, { selectId: selectId, menuId: menuId, popupId: popupId, dialogId: dialogId, thisPage: thisPage, menuPage: menuPage, label: label, isMultiple: isMultiple, theme: o.theme, listbox: listbox, list: list, header: header, headerTitle: headerTitle, headerClose: headerClose, menuPageContent: menuPageContent, menuPageClose: menuPageClose, placeholder: "" }); // Create list from select, update state this.refresh(); if ( this._origTabIndex === undefined ) { // Map undefined to false, because this._origTabIndex === undefined // indicates that we have not yet checked whether the select has // originally had a tabindex attribute, whereas false indicates that // we have checked the select for such an attribute, and have found // none present. this._origTabIndex = ( this.select[ 0 ].getAttribute( "tabindex" ) === null ) ? false : this.select.attr( "tabindex" ); } this.select.attr( "tabindex", "-1" ); this._on( this.select, { focus : "_handleSelectFocus" } ); // Button events this._on( this.button, { vclick: "_handleButtonVclickKeydown" }); // Events for list items this.list.attr( "role", "listbox" ); this._on( this.list, { focusin : "_handleListFocus", focusout : "_handleListFocus", keydown: "_handleListKeydown" }); this.list .delegate( "li:not(.ui-disabled,.ui-state-disabled,.ui-li-divider)", "click", function( event ) { // index of option tag to be selected var oldIndex = self.select[ 0 ].selectedIndex, newIndex = $.mobile.getAttribute( this, "option-index" ), option = self._selectOptions().eq( newIndex )[ 0 ]; // toggle selected status on the tag for multi selects option.selected = self.isMultiple ? !option.selected : true; // toggle checkbox class for multiple selects if ( self.isMultiple ) { $( this ).find( "a" ) .toggleClass( "ui-checkbox-on", option.selected ) .toggleClass( "ui-checkbox-off", !option.selected ); } // trigger change if value changed if ( self.isMultiple || oldIndex !== newIndex ) { self.select.trigger( "change" ); } // hide custom select for single selects only - otherwise focus clicked item // We need to grab the clicked item the hard way, because the list may have been rebuilt if ( self.isMultiple ) { self.list.find( "li:not(.ui-li-divider)" ).eq( newIndex ) .find( "a" ).first().focus(); } else { self.close(); } event.preventDefault(); }); // button refocus ensures proper height calculation // by removing the inline style and ensuring page inclusion this._on( this.menuPage, { pagehide: "_handleMenuPageHide" } ); // Events on the popup this._on( this.listbox, { popupafterclose: "close" } ); // Close button on small overlays if ( this.isMultiple ) { this._on( this.headerClose, { click: "_handleHeaderCloseClick" } ); } return this; }, _isRebuildRequired: function() { var list = this.list.find( "li" ), options = this._selectOptions().not( ".ui-screen-hidden" ); // TODO exceedingly naive method to determine difference // ignores value changes etc in favor of a forcedRebuild // from the user in the refresh method return options.text() !== list.text(); }, selected: function() { return this._selectOptions().filter( ":selected:not( :jqmData(placeholder='true') )" ); }, refresh: function( force ) { var self, indices; if ( this.options.nativeMenu ) { return this._super( force ); } self = this; if ( force || this._isRebuildRequired() ) { self._buildList(); } indices = this.selectedIndices(); self.setButtonText(); self.setButtonCount(); self.list.find( "li:not(.ui-li-divider)" ) .find( "a" ).removeClass( $.mobile.activeBtnClass ).end() .attr( "aria-selected", false ) .each(function( i ) { if ( $.inArray( i, indices ) > -1 ) { var item = $( this ); // Aria selected attr item.attr( "aria-selected", true ); // Multiple selects: add the "on" checkbox state to the icon if ( self.isMultiple ) { item.find( "a" ).removeClass( "ui-checkbox-off" ).addClass( "ui-checkbox-on" ); } else { if ( item.hasClass( "ui-screen-hidden" ) ) { item.next().find( "a" ).addClass( $.mobile.activeBtnClass ); } else { item.find( "a" ).addClass( $.mobile.activeBtnClass ); } } } }); }, close: function() { if ( this.options.disabled || !this.isOpen ) { return; } var self = this; if ( self.menuType === "page" ) { self.menuPage.dialog( "close" ); self.list.appendTo( self.listbox ); } else { self.listbox.popup( "close" ); } self._focusButton(); // allow the dialog to be closed again self.isOpen = false; }, open: function() { this.button.click(); }, _focusMenuItem: function() { var selector = this.list.find( "a." + $.mobile.activeBtnClass ); if ( selector.length === 0 ) { selector = this.list.find( "li:not(" + unfocusableItemSelector + ") a.ui-btn" ); } selector.first().focus(); }, _decideFormat: function() { var self = this, $window = this.window, selfListParent = self.list.parent(), menuHeight = selfListParent.outerHeight(), scrollTop = $window.scrollTop(), btnOffset = self.button.offset().top, screenHeight = $window.height(); if ( menuHeight > screenHeight - 80 || !$.support.scrollTop ) { self.menuPage.appendTo( $.mobile.pageContainer ).page(); self.menuPageContent = self.menuPage.find( ".ui-content" ); self.menuPageClose = self.menuPage.find( ".ui-header a" ); // prevent the parent page from being removed from the DOM, // otherwise the results of selecting a list item in the dialog // fall into a black hole self.thisPage.unbind( "pagehide.remove" ); //for WebOS/Opera Mini (set lastscroll using button offset) if ( scrollTop === 0 && btnOffset > screenHeight ) { self.thisPage.one( "pagehide", function() { $( this ).jqmData( "lastScroll", btnOffset ); }); } self.menuPage.one( { pageshow: $.proxy( this, "_focusMenuItem" ), pagehide: $.proxy( this, "close" ) }); self.menuType = "page"; self.menuPageContent.append( self.list ); self.menuPage.find( "div .ui-title" ).text( self.label.text() ); } else { self.menuType = "overlay"; self.listbox.one( { popupafteropen: $.proxy( this, "_focusMenuItem" ) } ); } }, _buildList: function() { var self = this, o = this.options, placeholder = this.placeholder, needPlaceholder = true, dataIcon = "false", $options, numOptions, select, dataPrefix = "data-" + $.mobile.ns, dataIndexAttr = dataPrefix + "option-index", dataIconAttr = dataPrefix + "icon", dataRoleAttr = dataPrefix + "role", dataPlaceholderAttr = dataPrefix + "placeholder", fragment = document.createDocumentFragment(), isPlaceholderItem = false, optGroup, i, option, $option, parent, text, anchor, classes, optLabel, divider, item; self.list.empty().filter( ".ui-listview" ).listview( "destroy" ); $options = this._selectOptions(); numOptions = $options.length; select = this.select[ 0 ]; for ( i = 0; i < numOptions;i++, isPlaceholderItem = false) { option = $options[i]; $option = $( option ); // Do not create options based on ui-screen-hidden select options if ( $option.hasClass( "ui-screen-hidden" ) ) { continue; } parent = option.parentNode; text = $option.text(); anchor = document.createElement( "a" ); classes = []; anchor.setAttribute( "href", "#" ); anchor.appendChild( document.createTextNode( text ) ); // Are we inside an optgroup? if ( parent !== select && parent.nodeName.toLowerCase() === "optgroup" ) { optLabel = parent.getAttribute( "label" ); if ( optLabel !== optGroup ) { divider = document.createElement( "li" ); divider.setAttribute( dataRoleAttr, "list-divider" ); divider.setAttribute( "role", "option" ); divider.setAttribute( "tabindex", "-1" ); divider.appendChild( document.createTextNode( optLabel ) ); fragment.appendChild( divider ); optGroup = optLabel; } } if ( needPlaceholder && ( !option.getAttribute( "value" ) || text.length === 0 || $option.jqmData( "placeholder" ) ) ) { needPlaceholder = false; isPlaceholderItem = true; // If we have identified a placeholder, record the fact that it was // us who have added the placeholder to the option and mark it // retroactively in the select as well if ( null === option.getAttribute( dataPlaceholderAttr ) ) { this._removePlaceholderAttr = true; } option.setAttribute( dataPlaceholderAttr, true ); if ( o.hidePlaceholderMenuItems ) { classes.push( "ui-screen-hidden" ); } if ( placeholder !== text ) { placeholder = self.placeholder = text; } } item = document.createElement( "li" ); if ( option.disabled ) { classes.push( "ui-state-disabled" ); item.setAttribute( "aria-disabled", true ); } item.setAttribute( dataIndexAttr, i ); item.setAttribute( dataIconAttr, dataIcon ); if ( isPlaceholderItem ) { item.setAttribute( dataPlaceholderAttr, true ); } item.className = classes.join( " " ); item.setAttribute( "role", "option" ); anchor.setAttribute( "tabindex", "-1" ); if ( this.isMultiple ) { $( anchor ).addClass( "ui-btn ui-checkbox-off ui-btn-icon-right" ); } item.appendChild( anchor ); fragment.appendChild( item ); } self.list[0].appendChild( fragment ); // Hide header if it's not a multiselect and there's no placeholder if ( !this.isMultiple && !placeholder.length ) { this.header.addClass( "ui-screen-hidden" ); } else { this.headerTitle.text( this.placeholder ); } // Now populated, create listview self.list.listview(); }, _button: function() { return this.options.nativeMenu ? this._super() : $( "<a>", { "href": "#", "role": "button", // TODO value is undefined at creation "id": this.buttonId, "aria-haspopup": "true", // TODO value is undefined at creation "aria-owns": this.menuId }); }, _destroy: function() { if ( !this.options.nativeMenu ) { this.close(); // Restore the tabindex attribute to its original value if ( this._origTabIndex !== undefined ) { if ( this._origTabIndex !== false ) { this.select.attr( "tabindex", this._origTabIndex ); } else { this.select.removeAttr( "tabindex" ); } } // Remove the placeholder attribute if we were the ones to add it if ( this._removePlaceholderAttr ) { this._selectOptions().removeAttr( "data-" + $.mobile.ns + "placeholder" ); } // Remove the popup this.listbox.remove(); // Remove the dialog this.menuPage.remove(); } // Chain up this._super(); } }); })( jQuery ); // buttonMarkup is deprecated as of 1.4.0 and will be removed in 1.5.0. (function( $, undefined ) { // General policy: Do not access data-* attributes except during enhancement. // In all other cases we determine the state of the button exclusively from its // className. That's why optionsToClasses expects a full complement of options, // and the jQuery plugin completes the set of options from the default values. // Map classes to buttonMarkup boolean options - used in classNameToOptions() var reverseBoolOptionMap = { "ui-shadow" : "shadow", "ui-corner-all" : "corners", "ui-btn-inline" : "inline", "ui-shadow-icon" : "iconshadow", /* TODO: Remove in 1.5 */ "ui-mini" : "mini" }, getAttrFixed = function() { var ret = $.mobile.getAttribute.apply( this, arguments ); return ( ret == null ? undefined : ret ); }, capitalLettersRE = /[A-Z]/g; // optionsToClasses: // @options: A complete set of options to convert to class names. // @existingClasses: extra classes to add to the result // // Converts @options to buttonMarkup classes and returns the result as an array // that can be converted to an element's className with .join( " " ). All // possible options must be set inside @options. Use $.fn.buttonMarkup.defaults // to get a complete set and use $.extend to override your choice of options // from that set. function optionsToClasses( options, existingClasses ) { var classes = existingClasses ? existingClasses : []; // Add classes to the array - first ui-btn classes.push( "ui-btn" ); // If there is a theme if ( options.theme ) { classes.push( "ui-btn-" + options.theme ); } // If there's an icon, add the icon-related classes if ( options.icon ) { classes = classes.concat([ "ui-icon-" + options.icon, "ui-btn-icon-" + options.iconpos ]); if ( options.iconshadow ) { classes.push( "ui-shadow-icon" ); /* TODO: Remove in 1.5 */ } } // Add the appropriate class for each boolean option if ( options.inline ) { classes.push( "ui-btn-inline" ); } if ( options.shadow ) { classes.push( "ui-shadow" ); } if ( options.corners ) { classes.push( "ui-corner-all" ); } if ( options.mini ) { classes.push( "ui-mini" ); } // Create a string from the array and return it return classes; } // classNameToOptions: // @classes: A string containing a .className-style space-separated class list // // Loops over @classes and calculates an options object based on the // buttonMarkup-related classes it finds. It records unrecognized classes in an // array. // // Returns: An object containing the following items: // // "options": buttonMarkup options found to be present because of the // presence/absence of corresponding classes // // "unknownClasses": a string containing all the non-buttonMarkup-related // classes found in @classes // // "alreadyEnhanced": A boolean indicating whether the ui-btn class was among // those found to be present function classNameToOptions( classes ) { var idx, map, unknownClass, alreadyEnhanced = false, noIcon = true, o = { icon: "", inline: false, shadow: false, corners: false, iconshadow: false, mini: false }, unknownClasses = []; classes = classes.split( " " ); // Loop over the classes for ( idx = 0 ; idx < classes.length ; idx++ ) { // Assume it's an unrecognized class unknownClass = true; // Recognize boolean options from the presence of classes map = reverseBoolOptionMap[ classes[ idx ] ]; if ( map !== undefined ) { unknownClass = false; o[ map ] = true; // Recognize the presence of an icon and establish the icon position } else if ( classes[ idx ].indexOf( "ui-btn-icon-" ) === 0 ) { unknownClass = false; noIcon = false; o.iconpos = classes[ idx ].substring( 12 ); // Establish which icon is present } else if ( classes[ idx ].indexOf( "ui-icon-" ) === 0 ) { unknownClass = false; o.icon = classes[ idx ].substring( 8 ); // Establish the theme - this recognizes one-letter theme swatch names } else if ( classes[ idx ].indexOf( "ui-btn-" ) === 0 && classes[ idx ].length === 8 ) { unknownClass = false; o.theme = classes[ idx ].substring( 7 ); // Recognize that this element has already been buttonMarkup-enhanced } else if ( classes[ idx ] === "ui-btn" ) { unknownClass = false; alreadyEnhanced = true; } // If this class has not been recognized, add it to the list if ( unknownClass ) { unknownClasses.push( classes[ idx ] ); } } // If a "ui-btn-icon-*" icon position class is absent there cannot be an icon if ( noIcon ) { o.icon = ""; } return { options: o, unknownClasses: unknownClasses, alreadyEnhanced: alreadyEnhanced }; } function camelCase2Hyphenated( c ) { return "-" + c.toLowerCase(); } // $.fn.buttonMarkup: // DOM: gets/sets .className // // @options: options to apply to the elements in the jQuery object // @overwriteClasses: boolean indicating whether to honour existing classes // // Calculates the classes to apply to the elements in the jQuery object based on // the options passed in. If @overwriteClasses is true, it sets the className // property of each element in the jQuery object to the buttonMarkup classes // it calculates based on the options passed in. // // If you wish to preserve any classes that are already present on the elements // inside the jQuery object, including buttonMarkup-related classes that were // added by a previous call to $.fn.buttonMarkup() or during page enhancement // then you should omit @overwriteClasses or set it to false. $.fn.buttonMarkup = function( options, overwriteClasses ) { var idx, data, el, retrievedOptions, optionKey, defaults = $.fn.buttonMarkup.defaults; for ( idx = 0 ; idx < this.length ; idx++ ) { el = this[ idx ]; data = overwriteClasses ? // Assume this element is not enhanced and ignore its classes { alreadyEnhanced: false, unknownClasses: [] } : // Otherwise analyze existing classes to establish existing options and // classes classNameToOptions( el.className ); retrievedOptions = $.extend( {}, // If the element already has the class ui-btn, then we assume that // it has passed through buttonMarkup before - otherwise, the options // returned by classNameToOptions do not correctly reflect the state of // the element ( data.alreadyEnhanced ? data.options : {} ), // Finally, apply the options passed in options ); // If this is the first call on this element, retrieve remaining options // from the data-attributes if ( !data.alreadyEnhanced ) { for ( optionKey in defaults ) { if ( retrievedOptions[ optionKey ] === undefined ) { retrievedOptions[ optionKey ] = getAttrFixed( el, optionKey.replace( capitalLettersRE, camelCase2Hyphenated ) ); } } } el.className = optionsToClasses( // Merge all the options and apply them as classes $.extend( {}, // The defaults form the basis defaults, // Add the computed options retrievedOptions ), // ... and re-apply any unrecognized classes that were found data.unknownClasses ).join( " " ); if ( el.tagName.toLowerCase() !== "button" ) { el.setAttribute( "role", "button" ); } } return this; }; // buttonMarkup defaults. This must be a complete set, i.e., a value must be // given here for all recognized options $.fn.buttonMarkup.defaults = { icon: "", iconpos: "left", theme: null, inline: false, shadow: true, corners: true, iconshadow: false, /* TODO: Remove in 1.5. Option deprecated in 1.4. */ mini: false }; $.extend( $.fn.buttonMarkup, { initSelector: "a:jqmData(role='button'), .ui-bar > a, .ui-bar > :jqmData(role='controlgroup') > a, button" }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.controlgroup", $.extend( { options: { enhanced: false, theme: null, shadow: false, corners: true, excludeInvisible: true, type: "vertical", mini: false }, _create: function() { var elem = this.element, opts = this.options; // Run buttonmarkup if ( $.fn.buttonMarkup ) { this.element.find( $.fn.buttonMarkup.initSelector ).buttonMarkup(); } // Enhance child widgets $.each( this._childWidgets, $.proxy( function( number, widgetName ) { if ( $.mobile[ widgetName ] ) { this.element.find( $.mobile[ widgetName ].initSelector ).not( $.mobile.page.prototype.keepNativeSelector() )[ widgetName ](); } }, this )); $.extend( this, { _ui: null, _initialRefresh: true }); if ( opts.enhanced ) { this._ui = { groupLegend: elem.children( ".ui-controlgroup-label" ).children(), childWrapper: elem.children( ".ui-controlgroup-controls" ) }; } else { this._ui = this._enhance(); } }, _childWidgets: [ "checkboxradio", "selectmenu", "button" ], _themeClassFromOption: function( value ) { return ( value ? ( value === "none" ? "" : "ui-group-theme-" + value ) : "" ); }, _enhance: function() { var elem = this.element, opts = this.options, ui = { groupLegend: elem.children( "legend" ), childWrapper: elem .addClass( "ui-controlgroup " + "ui-controlgroup-" + ( opts.type === "horizontal" ? "horizontal" : "vertical" ) + " " + this._themeClassFromOption( opts.theme ) + " " + ( opts.corners ? "ui-corner-all " : "" ) + ( opts.mini ? "ui-mini " : "" ) ) .wrapInner( "<div " + "class='ui-controlgroup-controls " + ( opts.shadow === true ? "ui-shadow" : "" ) + "'></div>" ) .children() }; if ( ui.groupLegend.length > 0 ) { $( "<div role='heading' class='ui-controlgroup-label'></div>" ) .append( ui.groupLegend ) .prependTo( elem ); } return ui; }, _init: function() { this.refresh(); }, _setOptions: function( options ) { var callRefresh, returnValue, elem = this.element; // Must have one of horizontal or vertical if ( options.type !== undefined ) { elem .removeClass( "ui-controlgroup-horizontal ui-controlgroup-vertical" ) .addClass( "ui-controlgroup-" + ( options.type === "horizontal" ? "horizontal" : "vertical" ) ); callRefresh = true; } if ( options.theme !== undefined ) { elem .removeClass( this._themeClassFromOption( this.options.theme ) ) .addClass( this._themeClassFromOption( options.theme ) ); } if ( options.corners !== undefined ) { elem.toggleClass( "ui-corner-all", options.corners ); } if ( options.mini !== undefined ) { elem.toggleClass( "ui-mini", options.mini ); } if ( options.shadow !== undefined ) { this._ui.childWrapper.toggleClass( "ui-shadow", options.shadow ); } if ( options.excludeInvisible !== undefined ) { this.options.excludeInvisible = options.excludeInvisible; callRefresh = true; } returnValue = this._super( options ); if ( callRefresh ) { this.refresh(); } return returnValue; }, container: function() { return this._ui.childWrapper; }, refresh: function() { var $el = this.container(), els = $el.find( ".ui-btn" ).not( ".ui-slider-handle" ), create = this._initialRefresh; if ( $.mobile.checkboxradio ) { $el.find( ":mobile-checkboxradio" ).checkboxradio( "refresh" ); } this._addFirstLastClasses( els, this.options.excludeInvisible ? this._getVisibles( els, create ) : els, create ); this._initialRefresh = false; }, // Caveat: If the legend is not the first child of the controlgroup at enhance // time, it will be after _destroy(). _destroy: function() { var ui, buttons, opts = this.options; if ( opts.enhanced ) { return this; } ui = this._ui; buttons = this.element .removeClass( "ui-controlgroup " + "ui-controlgroup-horizontal ui-controlgroup-vertical ui-corner-all ui-mini " + this._themeClassFromOption( opts.theme ) ) .find( ".ui-btn" ) .not( ".ui-slider-handle" ); this._removeFirstLastClasses( buttons ); ui.groupLegend.unwrap(); ui.childWrapper.children().unwrap(); } }, $.mobile.behaviors.addFirstLastClasses ) ); })(jQuery); (function( $, undefined ) { $.widget( "mobile.toolbar", { initSelector: ":jqmData(role='footer'), :jqmData(role='header')", options: { theme: null, addBackBtn: false, backBtnTheme: null, backBtnText: "Back" }, _create: function() { var leftbtn, rightbtn, role = this.element.is( ":jqmData(role='header')" ) ? "header" : "footer", page = this.element.closest( ".ui-page" ); if ( page.length === 0 ) { page = false; this._on( this.document, { "pageshow": "refresh" }); } $.extend( this, { role: role, page: page, leftbtn: leftbtn, rightbtn: rightbtn, backBtn: null }); this.element.attr( "role", role === "header" ? "banner" : "contentinfo" ).addClass( "ui-" + role ); this.refresh(); this._setOptions( this.options ); }, _setOptions: function( o ) { if ( o.addBackBtn !== undefined ) { if ( this.options.addBackBtn && this.role === "header" && $( ".ui-page" ).length > 1 && this.page[ 0 ].getAttribute( "data-" + $.mobile.ns + "url" ) !== $.mobile.path.stripHash( location.hash ) && !this.leftbtn ) { this._addBackButton(); } else { this.element.find( ".ui-toolbar-back-btn" ).remove(); } } if ( o.backBtnTheme != null ) { this.element .find( ".ui-toolbar-back-btn" ) .addClass( "ui-btn ui-btn-" + o.backBtnTheme ); } if ( o.backBtnText !== undefined ) { this.element.find( ".ui-toolbar-back-btn .ui-btn-text" ).text( o.backBtnText ); } if ( o.theme !== undefined ) { var currentTheme = this.options.theme ? this.options.theme : "inherit", newTheme = o.theme ? o.theme : "inherit"; this.element.removeClass( "ui-bar-" + currentTheme ).addClass( "ui-bar-" + newTheme ); } this._super( o ); }, refresh: function() { if ( this.role === "header" ) { this._addHeaderButtonClasses(); } if ( !this.page ) { this._setRelative(); if ( this.role === "footer" ) { this.element.appendTo( "body" ); } } this._addHeadingClasses(); this._btnMarkup(); }, //we only want this to run on non fixed toolbars so make it easy to override _setRelative: function() { $( "[data-"+ $.mobile.ns + "role='page']" ).css({ "position": "relative" }); }, // Deprecated in 1.4. As from 1.5 button classes have to be present in the markup. _btnMarkup: function() { this.element.children( "a" ).attr( "data-" + $.mobile.ns + "role", "button" ); this.element.trigger( "create" ); }, // Deprecated in 1.4. As from 1.5 ui-btn-left/right classes have to be present in the markup. _addHeaderButtonClasses: function() { var $headeranchors = this.element.children( "a, button" ); this.leftbtn = $headeranchors.hasClass( "ui-btn-left" ); this.rightbtn = $headeranchors.hasClass( "ui-btn-right" ); this.leftbtn = this.leftbtn || $headeranchors.eq( 0 ).not( ".ui-btn-right" ).addClass( "ui-btn-left" ).length; this.rightbtn = this.rightbtn || $headeranchors.eq( 1 ).addClass( "ui-btn-right" ).length; }, _addBackButton: function() { var theme, options = this.options; if ( !this.backBtn ) { theme = options.backBtnTheme || options.theme; this.backBtn = $( "<a role='button' href='javascript:void(0);' " + "class='ui-btn ui-corner-all ui-shadow ui-btn-left " + ( theme ? "ui-btn-" + theme + " " : "" ) + "ui-toolbar-back-btn ui-icon-carat-l ui-btn-icon-left' " + "data-" + $.mobile.ns + "rel='back'>" + options.backBtnText + "</a>" ) .prependTo( this.element ); } }, _addHeadingClasses: function() { this.element.children( "h1, h2, h3, h4, h5, h6" ) .addClass( "ui-title" ) // Regardless of h element number in src, it becomes h1 for the enhanced page .attr({ "role": "heading", "aria-level": "1" }); } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.toolbar", $.mobile.toolbar, { options: { position:null, visibleOnPageShow: true, disablePageZoom: true, transition: "slide", //can be none, fade, slide (slide maps to slideup or slidedown) fullscreen: false, tapToggle: true, tapToggleBlacklist: "a, button, input, select, textarea, .ui-header-fixed, .ui-footer-fixed, .ui-flipswitch, .ui-popup, .ui-panel, .ui-panel-dismiss-open", hideDuringFocus: "input, textarea, select", updatePagePadding: true, trackPersistentToolbars: true, // Browser detection! Weeee, here we go... // Unfortunately, position:fixed is costly, not to mention probably impossible, to feature-detect accurately. // Some tests exist, but they currently return false results in critical devices and browsers, which could lead to a broken experience. // Testing fixed positioning is also pretty obtrusive to page load, requiring injected elements and scrolling the window // The following function serves to rule out some popular browsers with known fixed-positioning issues // This is a plugin option like any other, so feel free to improve or overwrite it supportBlacklist: function() { return !$.support.fixedPosition; } }, _create: function() { this._super(); if ( this.options.position === "fixed" && !this.options.supportBlacklist() ) { this._makeFixed(); } }, _makeFixed: function() { this.element.addClass( "ui-"+ this.role +"-fixed" ); this.updatePagePadding(); this._addTransitionClass(); this._bindPageEvents(); this._bindToggleHandlers(); this._setOptions( this.options ); }, _setOptions: function( o ) { if ( o.position === "fixed" && this.options.position !== "fixed" ) { this._makeFixed(); } if ( this.options.position === "fixed" && !this.options.supportBlacklist() ) { var $page = ( !!this.page )? this.page: ( $(".ui-page-active").length > 0 )? $(".ui-page-active"): $(".ui-page").eq(0); if ( o.fullscreen !== undefined) { if ( o.fullscreen ) { this.element.addClass( "ui-"+ this.role +"-fullscreen" ); $page.addClass( "ui-page-" + this.role + "-fullscreen" ); } // If not fullscreen, add class to page to set top or bottom padding else { this.element.removeClass( "ui-"+ this.role +"-fullscreen" ); $page.removeClass( "ui-page-" + this.role + "-fullscreen" ).addClass( "ui-page-" + this.role+ "-fixed" ); } } } this._super(o); }, _addTransitionClass: function() { var tclass = this.options.transition; if ( tclass && tclass !== "none" ) { // use appropriate slide for header or footer if ( tclass === "slide" ) { tclass = this.element.hasClass( "ui-header" ) ? "slidedown" : "slideup"; } this.element.addClass( tclass ); } }, _bindPageEvents: function() { var page = ( !!this.page )? this.element.closest( ".ui-page" ): this.document; //page event bindings // Fixed toolbars require page zoom to be disabled, otherwise usability issues crop up // This method is meant to disable zoom while a fixed-positioned toolbar page is visible this._on( page , { "pagebeforeshow": "_handlePageBeforeShow", "webkitAnimationStart":"_handleAnimationStart", "animationstart":"_handleAnimationStart", "updatelayout": "_handleAnimationStart", "pageshow": "_handlePageShow", "pagebeforehide": "_handlePageBeforeHide" }); }, _handlePageBeforeShow: function( ) { var o = this.options; if ( o.disablePageZoom ) { $.mobile.zoom.disable( true ); } if ( !o.visibleOnPageShow ) { this.hide( true ); } }, _handleAnimationStart: function() { if ( this.options.updatePagePadding ) { this.updatePagePadding( ( !!this.page )? this.page: ".ui-page-active" ); } }, _handlePageShow: function() { this.updatePagePadding( ( !!this.page )? this.page: ".ui-page-active" ); if ( this.options.updatePagePadding ) { this._on( this.window, { "throttledresize": "updatePagePadding" } ); } }, _handlePageBeforeHide: function( e, ui ) { var o = this.options, thisFooter, thisHeader, nextFooter, nextHeader; if ( o.disablePageZoom ) { $.mobile.zoom.enable( true ); } if ( o.updatePagePadding ) { this._off( this.window, "throttledresize" ); } if ( o.trackPersistentToolbars ) { thisFooter = $( ".ui-footer-fixed:jqmData(id)", this.page ); thisHeader = $( ".ui-header-fixed:jqmData(id)", this.page ); nextFooter = thisFooter.length && ui.nextPage && $( ".ui-footer-fixed:jqmData(id='" + thisFooter.jqmData( "id" ) + "')", ui.nextPage ) || $(); nextHeader = thisHeader.length && ui.nextPage && $( ".ui-header-fixed:jqmData(id='" + thisHeader.jqmData( "id" ) + "')", ui.nextPage ) || $(); if ( nextFooter.length || nextHeader.length ) { nextFooter.add( nextHeader ).appendTo( $.mobile.pageContainer ); ui.nextPage.one( "pageshow", function() { nextHeader.prependTo( this ); nextFooter.appendTo( this ); }); } } }, _visible: true, // This will set the content element's top or bottom padding equal to the toolbar's height updatePagePadding: function( tbPage ) { var $el = this.element, header = ( this.role ==="header" ), pos = parseFloat( $el.css( header ? "top" : "bottom" ) ); // This behavior only applies to "fixed", not "fullscreen" if ( this.options.fullscreen ) { return; } // tbPage argument can be a Page object or an event, if coming from throttled resize. tbPage = ( tbPage && tbPage.type === undefined && tbPage ) || this.page || $el.closest( ".ui-page" ); tbPage = ( !!this.page )? this.page: ".ui-page-active"; $( tbPage ).css( "padding-" + ( header ? "top" : "bottom" ), $el.outerHeight() + pos ); }, _useTransition: function( notransition ) { var $win = this.window, $el = this.element, scroll = $win.scrollTop(), elHeight = $el.height(), pHeight = ( !!this.page )? $el.closest( ".ui-page" ).height():$(".ui-page-active").height(), viewportHeight = $.mobile.getScreenHeight(); return !notransition && ( this.options.transition && this.options.transition !== "none" && ( ( this.role === "header" && !this.options.fullscreen && scroll > elHeight ) || ( this.role === "footer" && !this.options.fullscreen && scroll + viewportHeight < pHeight - elHeight ) ) || this.options.fullscreen ); }, show: function( notransition ) { var hideClass = "ui-fixed-hidden", $el = this.element; if ( this._useTransition( notransition ) ) { $el .removeClass( "out " + hideClass ) .addClass( "in" ) .animationComplete(function () { $el.removeClass( "in" ); }); } else { $el.removeClass( hideClass ); } this._visible = true; }, hide: function( notransition ) { var hideClass = "ui-fixed-hidden", $el = this.element, // if it's a slide transition, our new transitions need the reverse class as well to slide outward outclass = "out" + ( this.options.transition === "slide" ? " reverse" : "" ); if ( this._useTransition( notransition ) ) { $el .addClass( outclass ) .removeClass( "in" ) .animationComplete(function() { $el.addClass( hideClass ).removeClass( outclass ); }); } else { $el.addClass( hideClass ).removeClass( outclass ); } this._visible = false; }, toggle: function() { this[ this._visible ? "hide" : "show" ](); }, _bindToggleHandlers: function() { var self = this, o = self.options, delayShow, delayHide, isVisible = true, page = ( !!this.page )? this.page: $(".ui-page"); // tap toggle page .bind( "vclick", function( e ) { if ( o.tapToggle && !$( e.target ).closest( o.tapToggleBlacklist ).length ) { self.toggle(); } }) .bind( "focusin focusout", function( e ) { //this hides the toolbars on a keyboard pop to give more screen room and prevent ios bug which //positions fixed toolbars in the middle of the screen on pop if the input is near the top or //bottom of the screen addresses issues #4410 Footer navbar moves up when clicking on a textbox in an Android environment //and issue #4113 Header and footer change their position after keyboard popup - iOS //and issue #4410 Footer navbar moves up when clicking on a textbox in an Android environment if ( screen.width < 1025 && $( e.target ).is( o.hideDuringFocus ) && !$( e.target ).closest( ".ui-header-fixed, .ui-footer-fixed" ).length ) { //Fix for issue #4724 Moving through form in Mobile Safari with "Next" and "Previous" system //controls causes fixed position, tap-toggle false Header to reveal itself // isVisible instead of self._visible because the focusin and focusout events fire twice at the same time // Also use a delay for hiding the toolbars because on Android native browser focusin is direclty followed // by a focusout when a native selects opens and the other way around when it closes. if ( e.type === "focusout" && !isVisible ) { isVisible = true; //wait for the stack to unwind and see if we have jumped to another input clearTimeout( delayHide ); delayShow = setTimeout( function() { self.show(); }, 0 ); } else if ( e.type === "focusin" && !!isVisible ) { //if we have jumped to another input clear the time out to cancel the show. clearTimeout( delayShow ); isVisible = false; delayHide = setTimeout( function() { self.hide(); }, 0 ); } } }); }, _setRelative: function() { if( this.options.position !== "fixed" ){ $( "[data-"+ $.mobile.ns + "role='page']" ).css({ "position": "relative" }); } }, _destroy: function() { var $el = this.element, header = $el.hasClass( "ui-header" ); $el.closest( ".ui-page" ).css( "padding-" + ( header ? "top" : "bottom" ), "" ); $el.removeClass( "ui-header-fixed ui-footer-fixed ui-header-fullscreen ui-footer-fullscreen in out fade slidedown slideup ui-fixed-hidden" ); $el.closest( ".ui-page" ).removeClass( "ui-page-header-fixed ui-page-footer-fixed ui-page-header-fullscreen ui-page-footer-fullscreen" ); } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.toolbar", $.mobile.toolbar, { _makeFixed: function() { this._super(); this._workarounds(); }, //check the browser and version and run needed workarounds _workarounds: function() { var ua = navigator.userAgent, platform = navigator.platform, // Rendering engine is Webkit, and capture major version wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ), wkversion = !!wkmatch && wkmatch[ 1 ], os = null, self = this; //set the os we are working in if it dosent match one with workarounds return if ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) { os = "ios"; } else if ( ua.indexOf( "Android" ) > -1 ) { os = "android"; } else { return; } //check os version if it dosent match one with workarounds return if ( os === "ios" ) { //iOS workarounds self._bindScrollWorkaround(); } else if ( os === "android" && wkversion && wkversion < 534 ) { //Android 2.3 run all Android 2.3 workaround self._bindScrollWorkaround(); self._bindListThumbWorkaround(); } else { return; } }, //Utility class for checking header and footer positions relative to viewport _viewportOffset: function() { var $el = this.element, header = $el.hasClass( "ui-header" ), offset = Math.abs( $el.offset().top - this.window.scrollTop() ); if ( !header ) { offset = Math.round( offset - this.window.height() + $el.outerHeight() ) - 60; } return offset; }, //bind events for _triggerRedraw() function _bindScrollWorkaround: function() { var self = this; //bind to scrollstop and check if the toolbars are correctly positioned this._on( this.window, { scrollstop: function() { var viewportOffset = self._viewportOffset(); //check if the header is visible and if its in the right place if ( viewportOffset > 2 && self._visible ) { self._triggerRedraw(); } }}); }, //this addresses issue #4250 Persistent footer instability in v1.1 with long select lists in Android 2.3.3 //and issue #3748 Android 2.x: Page transitions broken when fixed toolbars used //the absolutely positioned thumbnail in a list view causes problems with fixed position buttons above in a nav bar //setting the li's to -webkit-transform:translate3d(0,0,0); solves this problem to avoide potential issues in other //platforms we scope this with the class ui-android-2x-fix _bindListThumbWorkaround: function() { this.element.closest( ".ui-page" ).addClass( "ui-android-2x-fixed" ); }, //this addresses issues #4337 Fixed header problem after scrolling content on iOS and Android //and device bugs project issue #1 Form elements can lose click hit area in position: fixed containers. //this also addresses not on fixed toolbars page in docs //adding 1px of padding to the bottom then removing it causes a "redraw" //which positions the toolbars correctly (they will always be visually correct) _triggerRedraw: function() { var paddingBottom = parseFloat( $( ".ui-page-active" ).css( "padding-bottom" ) ); //trigger page redraw to fix incorrectly positioned fixed elements $( ".ui-page-active" ).css( "padding-bottom", ( paddingBottom + 1 ) + "px" ); //if the padding is reset with out a timeout the reposition will not occure. //this is independant of JQM the browser seems to need the time to react. setTimeout( function() { $( ".ui-page-active" ).css( "padding-bottom", paddingBottom + "px" ); }, 0 ); }, destroy: function() { this._super(); //Remove the class we added to the page previously in android 2.x this.element.closest( ".ui-page-active" ).removeClass( "ui-android-2x-fix" ); } }); })( jQuery ); ( function( $, undefined ) { var ieHack = ( $.mobile.browser.oldIE && $.mobile.browser.oldIE <= 8 ), uiTemplate = $( "<div class='ui-popup-arrow-guide'></div>" + "<div class='ui-popup-arrow-container" + ( ieHack ? " ie" : "" ) + "'>" + "<div class='ui-popup-arrow'>" + "<div class='ui-popup-arrow-background'></div>" + "</div>" + "</div>" ), // Needed for transforming coordinates from screen to arrow background txFactor = Math.sqrt( 2 ) / 2; function getArrow() { var clone = uiTemplate.clone(), gd = clone.eq( 0 ), ct = clone.eq( 1 ), ar = ct.children(), bg = ar.children(); return { arEls: ct.add( gd ), gd: gd, ct: ct, ar: ar, bg: bg }; } $.widget( "mobile.popup", $.mobile.popup, { options: { arrow: "" }, _create: function() { var ar, ret = this._super(); if ( this.options.arrow ) { this._ui.arrow = ar = this._addArrow(); } return ret; }, _addArrow: function() { var theme, opts = this.options, ar = getArrow(); theme = this._themeClassFromOption( "ui-body-", opts.theme ); ar.ar.addClass( theme + ( opts.shadow ? " ui-overlay-shadow" : "" ) ); ar.bg.addClass( theme ); ar.arEls.hide().appendTo( this.element ); return ar; }, _unenhance: function() { var ar = this._ui.arrow; if ( ar ) { ar.arEls.remove(); } return this._super(); }, // Pretend to show an arrow described by @p and @dir and calculate the // distance from the desired point. If a best-distance is passed in, return // the minimum of the one passed in and the one calculated. _tryAnArrow: function( p, dir, desired, s, best ) { var result, r, diff, desiredForArrow = {}, tip = {}; // If the arrow has no wiggle room along the edge of the popup, it cannot // be displayed along the requested edge without it sticking out. if ( s.arFull[ p.dimKey ] > s.guideDims[ p.dimKey ] ) { return best; } desiredForArrow[ p.fst ] = desired[ p.fst ] + ( s.arHalf[ p.oDimKey ] + s.menuHalf[ p.oDimKey ] ) * p.offsetFactor - s.contentBox[ p.fst ] + ( s.clampInfo.menuSize[ p.oDimKey ] - s.contentBox[ p.oDimKey ] ) * p.arrowOffsetFactor; desiredForArrow[ p.snd ] = desired[ p.snd ]; result = s.result || this._calculateFinalLocation( desiredForArrow, s.clampInfo ); r = { x: result.left, y: result.top }; tip[ p.fst ] = r[ p.fst ] + s.contentBox[ p.fst ] + p.tipOffset; tip[ p.snd ] = Math.max( result[ p.prop ] + s.guideOffset[ p.prop ] + s.arHalf[ p.dimKey ], Math.min( result[ p.prop ] + s.guideOffset[ p.prop ] + s.guideDims[ p.dimKey ] - s.arHalf[ p.dimKey ], desired[ p.snd ] ) ); diff = Math.abs( desired.x - tip.x ) + Math.abs( desired.y - tip.y ); if ( !best || diff < best.diff ) { // Convert tip offset to coordinates inside the popup tip[ p.snd ] -= s.arHalf[ p.dimKey ] + result[ p.prop ] + s.contentBox[ p.snd ]; best = { dir: dir, diff: diff, result: result, posProp: p.prop, posVal: tip[ p.snd ] }; } return best; }, _getPlacementState: function( clamp ) { var offset, gdOffset, ar = this._ui.arrow, state = { clampInfo: this._clampPopupWidth( !clamp ), arFull: { cx: ar.ct.width(), cy: ar.ct.height() }, guideDims: { cx: ar.gd.width(), cy: ar.gd.height() }, guideOffset: ar.gd.offset() }; offset = this.element.offset(); ar.gd.css( { left: 0, top: 0, right: 0, bottom: 0 } ); gdOffset = ar.gd.offset(); state.contentBox = { x: gdOffset.left - offset.left, y: gdOffset.top - offset.top, cx: ar.gd.width(), cy: ar.gd.height() }; ar.gd.removeAttr( "style" ); // The arrow box moves between guideOffset and guideOffset + guideDims - arFull state.guideOffset = { left: state.guideOffset.left - offset.left, top: state.guideOffset.top - offset.top }; state.arHalf = { cx: state.arFull.cx / 2, cy: state.arFull.cy / 2 }; state.menuHalf = { cx: state.clampInfo.menuSize.cx / 2, cy: state.clampInfo.menuSize.cy / 2 }; return state; }, _placementCoords: function( desired ) { var state, best, params, bgOffset, elOffset, diff, bgRef, optionValue = this.options.arrow, ar = this._ui.arrow; if ( !ar ) { return this._super( desired ); } ar.arEls.show(); bgRef = {}; state = this._getPlacementState( true ); params = { "l": { fst: "x", snd: "y", prop: "top", dimKey: "cy", oDimKey: "cx", offsetFactor: 1, tipOffset: -state.arHalf.cx, arrowOffsetFactor: 0 }, "r": { fst: "x", snd: "y", prop: "top", dimKey: "cy", oDimKey: "cx", offsetFactor: -1, tipOffset: state.arHalf.cx + state.contentBox.cx, arrowOffsetFactor: 1 }, "b": { fst: "y", snd: "x", prop: "left", dimKey: "cx", oDimKey: "cy", offsetFactor: -1, tipOffset: state.arHalf.cy + state.contentBox.cy, arrowOffsetFactor: 1 }, "t": { fst: "y", snd: "x", prop: "left", dimKey: "cx", oDimKey: "cy", offsetFactor: 1, tipOffset: -state.arHalf.cy, arrowOffsetFactor: 0 } }; // Try each side specified in the options to see on which one the arrow // should be placed such that the distance between the tip of the arrow and // the desired coordinates is the shortest. $.each( ( optionValue === true ? "l,t,r,b" : optionValue ).split( "," ), $.proxy( function( key, value ) { best = this._tryAnArrow( params[ value ], value, desired, state, best ); }, this ) ); // Could not place the arrow along any of the edges - behave as if showing // the arrow was turned off. if ( !best ) { ar.arEls.hide(); return this._super( desired ); } // Move the arrow into place ar.ct .removeClass( "ui-popup-arrow-l ui-popup-arrow-t ui-popup-arrow-r ui-popup-arrow-b" ) .addClass( "ui-popup-arrow-" + best.dir ) .removeAttr( "style" ).css( best.posProp, best.posVal ) .show(); // Do not move/size the background div on IE, because we use the arrow div for background as well. if ( !ieHack ) { elOffset = this.element.offset(); bgRef[ params[ best.dir ].fst ] = ar.ct.offset(); bgRef[ params[ best.dir ].snd ] = { left: elOffset.left + state.contentBox.x, top: elOffset.top + state.contentBox.y }; bgOffset = ar.bg .removeAttr( "style" ) .css( ( "cx" === params[ best.dir ].dimKey ? "width" : "height" ), state.contentBox[ params[ best.dir ].dimKey ] ) .offset(); diff = { dx: bgRef.x.left - bgOffset.left, dy: bgRef.y.top - bgOffset.top }; ar.bg.css( { left: txFactor * diff.dy + txFactor * diff.dx, top: txFactor * diff.dy - txFactor * diff.dx } ); } return best.result; }, _setOptions: function( opts ) { var newTheme, oldTheme = this.options.theme, ar = this._ui.arrow, ret = this._super( opts ); if ( opts.arrow !== undefined ) { if ( !ar && opts.arrow ) { this._ui.arrow = this._addArrow(); // Important to return here so we don't set the same options all over // again below. return; } else if ( ar && !opts.arrow ) { ar.arEls.remove(); this._ui.arrow = null; } } // Reassign with potentially new arrow ar = this._ui.arrow; if ( ar ) { if ( opts.theme !== undefined ) { oldTheme = this._themeClassFromOption( "ui-body-", oldTheme ); newTheme = this._themeClassFromOption( "ui-body-", opts.theme ); ar.ar.removeClass( oldTheme ).addClass( newTheme ); ar.bg.removeClass( oldTheme ).addClass( newTheme ); } if ( opts.shadow !== undefined ) { ar.ar.toggleClass( "ui-overlay-shadow", opts.shadow ); } } return ret; }, _destroy: function() { var ar = this._ui.arrow; if ( ar ) { ar.arEls.remove(); } return this._super(); } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.panel", { options: { classes: { panel: "ui-panel", panelOpen: "ui-panel-open", panelClosed: "ui-panel-closed", panelFixed: "ui-panel-fixed", panelInner: "ui-panel-inner", modal: "ui-panel-dismiss", modalOpen: "ui-panel-dismiss-open", pageContainer: "ui-panel-page-container", pageWrapper: "ui-panel-wrapper", pageFixedToolbar: "ui-panel-fixed-toolbar", pageContentPrefix: "ui-panel-page-content", /* Used for wrapper and fixed toolbars position, display and open classes. */ animate: "ui-panel-animate" }, animate: true, theme: null, position: "left", dismissible: true, display: "reveal", //accepts reveal, push, overlay swipeClose: true, positionFixed: false }, _panelID: null, _closeLink: null, _parentPage: null, _page: null, _modal: null, _panelInner: null, _wrapper: null, _fixedToolbars: null, _create: function() { var el = this.element, parentPage = el.closest( ":jqmData(role='page')" ); // expose some private props to other methods $.extend( this, { _panelID: el.attr( "id" ), _closeLink: el.find( ":jqmData(rel='close')" ), _parentPage: ( parentPage.length > 0 ) ? parentPage : false, _page: this._getPage, _panelInner: this._getPanelInner(), _wrapper: this._getWrapper, _fixedToolbars: this._getFixedToolbars }); this._addPanelClasses(); // if animating, add the class to do so if ( $.support.cssTransform3d && !!this.options.animate ) { this.element.addClass( this.options.classes.animate ); } this._bindUpdateLayout(); this._bindCloseEvents(); this._bindLinkListeners(); this._bindPageEvents(); if ( !!this.options.dismissible ) { this._createModal(); } this._bindSwipeEvents(); }, _getPanelInner: function() { var panelInner = this.element.find( "." + this.options.classes.panelInner ); if ( panelInner.length === 0 ) { panelInner = this.element.children().wrapAll( "<div class='" + this.options.classes.panelInner + "' />" ).parent(); } return panelInner; }, _createModal: function() { var self = this, target = self._parentPage ? self._parentPage.parent() : self.element.parent(); self._modal = $( "<div class='" + self.options.classes.modal + "' data-panelid='" + self._panelID + "'></div>" ) .on( "mousedown", function() { self.close(); }) .appendTo( target ); }, _getPage: function() { var page = this._parentPage ? this._parentPage : $( "." + $.mobile.activePageClass ); return page; }, _getWrapper: function() { var wrapper = this._page().find( "." + this.options.classes.pageWrapper ); if ( wrapper.length === 0 ) { wrapper = this._page().children( ".ui-header:not(.ui-header-fixed), .ui-content:not(.ui-popup), .ui-footer:not(.ui-footer-fixed)" ) .wrapAll( "<div class='" + this.options.classes.pageWrapper + "'></div>" ) .parent(); } return wrapper; }, _getFixedToolbars: function() { var extFixedToolbars = $( "body" ).children( ".ui-header-fixed, .ui-footer-fixed" ), intFixedToolbars = this._page().find( ".ui-header-fixed, .ui-footer-fixed" ), fixedToolbars = extFixedToolbars.add( intFixedToolbars ).addClass( this.options.classes.pageFixedToolbar ); return fixedToolbars; }, _getPosDisplayClasses: function( prefix ) { return prefix + "-position-" + this.options.position + " " + prefix + "-display-" + this.options.display; }, _getPanelClasses: function() { var panelClasses = this.options.classes.panel + " " + this._getPosDisplayClasses( this.options.classes.panel ) + " " + this.options.classes.panelClosed + " " + "ui-body-" + ( this.options.theme ? this.options.theme : "inherit" ); if ( !!this.options.positionFixed ) { panelClasses += " " + this.options.classes.panelFixed; } return panelClasses; }, _addPanelClasses: function() { this.element.addClass( this._getPanelClasses() ); }, _bindCloseEvents: function() { var self = this; self._closeLink.on( "click.panel" , function( e ) { e.preventDefault(); self.close(); return false; }); self.element.on( "click.panel" , "a:jqmData(ajax='false')", function(/* e */) { self.close(); }); }, _positionPanel: function() { var self = this, panelInnerHeight = self._panelInner.outerHeight(), expand = panelInnerHeight > $.mobile.getScreenHeight(); if ( expand || !self.options.positionFixed ) { if ( expand ) { self._unfixPanel(); $.mobile.resetActivePageHeight( panelInnerHeight ); } window.scrollTo( 0, $.mobile.defaultHomeScroll ); } else { self._fixPanel(); } }, _bindFixListener: function() { this._on( $( window ), { "throttledresize": "_positionPanel" }); }, _unbindFixListener: function() { this._off( $( window ), "throttledresize" ); }, _unfixPanel: function() { if ( !!this.options.positionFixed && $.support.fixedPosition ) { this.element.removeClass( this.options.classes.panelFixed ); } }, _fixPanel: function() { if ( !!this.options.positionFixed && $.support.fixedPosition ) { this.element.addClass( this.options.classes.panelFixed ); } }, _bindUpdateLayout: function() { var self = this; self.element.on( "updatelayout", function(/* e */) { if ( self._open ) { self._positionPanel(); } }); }, _bindLinkListeners: function() { this._on( "body", { "click a": "_handleClick" }); }, _handleClick: function( e ) { if ( e.currentTarget.href.split( "#" )[ 1 ] === this._panelID && this._panelID !== undefined ) { e.preventDefault(); var link = $( e.target ); if ( link.hasClass( "ui-btn" ) ) { link.addClass( $.mobile.activeBtnClass ); this.element.one( "panelopen panelclose", function() { link.removeClass( $.mobile.activeBtnClass ); }); } this.toggle(); return false; } }, _bindSwipeEvents: function() { var self = this, area = self._modal ? self.element.add( self._modal ) : self.element; // on swipe, close the panel if ( !!self.options.swipeClose ) { if ( self.options.position === "left" ) { area.on( "swipeleft.panel", function(/* e */) { self.close(); }); } else { area.on( "swiperight.panel", function(/* e */) { self.close(); }); } } }, _bindPageEvents: function() { var self = this; this.document // Close the panel if another panel on the page opens .on( "panelbeforeopen", function( e ) { if ( self._open && e.target !== self.element[ 0 ] ) { self.close(); } }) // On escape, close? might need to have a target check too... .on( "keyup.panel", function( e ) { if ( e.keyCode === 27 && self._open ) { self.close(); } }); // Clean up open panels after page hide if ( self._parentPage ) { this.document.on( "pagehide", ":jqmData(role='page')", function() { if ( self._open ) { self.close( true ); } }); } else { this.document.on( "pagebeforehide", function() { if ( self._open ) { self.close( true ); } }); } }, // state storage of open or closed _open: false, _pageContentOpenClasses: null, _modalOpenClasses: null, open: function( immediate ) { if ( !this._open ) { var self = this, o = self.options, _openPanel = function() { self.document.off( "panelclose" ); self._page().jqmData( "panel", "open" ); if ( $.support.cssTransform3d && !!o.animate && o.display !== "overlay" ) { self._wrapper().addClass( o.classes.animate ); self._fixedToolbars().addClass( o.classes.animate ); } if ( !immediate && $.support.cssTransform3d && !!o.animate ) { self.document.on( self._transitionEndEvents, complete ); } else { setTimeout( complete, 0 ); } if ( o.theme && o.display !== "overlay" ) { self._page().parent() .addClass( o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme ); } self.element .removeClass( o.classes.panelClosed ) .addClass( o.classes.panelOpen ); self._positionPanel(); self._pageContentOpenClasses = self._getPosDisplayClasses( o.classes.pageContentPrefix ); if ( o.display !== "overlay" ) { self._page().parent().addClass( o.classes.pageContainer ); self._wrapper().addClass( self._pageContentOpenClasses ); self._fixedToolbars().addClass( self._pageContentOpenClasses ); } self._modalOpenClasses = self._getPosDisplayClasses( o.classes.modal ) + " " + o.classes.modalOpen; if ( self._modal ) { self._modal .addClass( self._modalOpenClasses ) .height( Math.max( self._modal.height(), self.document.height() ) ); } }, complete = function() { self.document.off( self._transitionEndEvents, complete ); if ( o.display !== "overlay" ) { self._wrapper().addClass( o.classes.pageContentPrefix + "-open" ); self._fixedToolbars().addClass( o.classes.pageContentPrefix + "-open" ); } self._bindFixListener(); self._trigger( "open" ); }; self._trigger( "beforeopen" ); if ( self._page().jqmData( "panel" ) === "open" ) { self.document.on( "panelclose", function() { _openPanel(); }); } else { _openPanel(); } self._open = true; } }, close: function( immediate ) { if ( this._open ) { var self = this, o = this.options, _closePanel = function() { if ( !immediate && $.support.cssTransform3d && !!o.animate ) { self.document.on( self._transitionEndEvents, complete ); } else { setTimeout( complete, 0 ); } self.element.removeClass( o.classes.panelOpen ); if ( o.display !== "overlay" ) { self._wrapper().removeClass( self._pageContentOpenClasses ); self._fixedToolbars().removeClass( self._pageContentOpenClasses ); } if ( self._modal ) { self._modal.removeClass( self._modalOpenClasses ); } }, complete = function() { self.document.off( self._transitionEndEvents, complete ); if ( o.theme && o.display !== "overlay" ) { self._page().parent().removeClass( o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme ); } self.element.addClass( o.classes.panelClosed ); if ( o.display !== "overlay" ) { self._page().parent().removeClass( o.classes.pageContainer ); self._wrapper().removeClass( o.classes.pageContentPrefix + "-open" ); self._fixedToolbars().removeClass( o.classes.pageContentPrefix + "-open" ); } if ( $.support.cssTransform3d && !!o.animate && o.display !== "overlay" ) { self._wrapper().removeClass( o.classes.animate ); self._fixedToolbars().removeClass( o.classes.animate ); } self._fixPanel(); self._unbindFixListener(); $.mobile.resetActivePageHeight(); self._page().jqmRemoveData( "panel" ); self._trigger( "close" ); }; self._trigger( "beforeclose" ); _closePanel(); self._open = false; } }, toggle: function() { this[ this._open ? "close" : "open" ](); }, _transitionEndEvents: "webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd", _destroy: function() { var otherPanels, o = this.options, multiplePanels = ( $( "body > :mobile-panel" ).length + $.mobile.activePage.find( ":mobile-panel" ).length ) > 1; if ( o.display !== "overlay" ) { // remove the wrapper if not in use by another panel otherPanels = $( "body > :mobile-panel" ).add( $.mobile.activePage.find( ":mobile-panel" ) ); if ( otherPanels.not( ".ui-panel-display-overlay" ).not( this.element ).length === 0 ) { this._wrapper().children().unwrap(); } if ( this._open ) { this._fixedToolbars().removeClass( o.classes.pageContentPrefix + "-open" ); if ( $.support.cssTransform3d && !!o.animate ) { this._fixedToolbars().removeClass( o.classes.animate ); } this._page().parent().removeClass( o.classes.pageContainer ); if ( o.theme ) { this._page().parent().removeClass( o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme ); } } } if ( !multiplePanels ) { this.document.off( "panelopen panelclose" ); if ( this._open ) { this.document.off( this._transitionEndEvents ); $.mobile.resetActivePageHeight(); } } if ( this._open ) { this._page().jqmRemoveData( "panel" ); } this._panelInner.children().unwrap(); this.element .removeClass( [ this._getPanelClasses(), o.classes.panelOpen, o.classes.animate ].join( " " ) ) .off( "swipeleft.panel swiperight.panel" ) .off( "panelbeforeopen" ) .off( "panelhide" ) .off( "keyup.panel" ) .off( "updatelayout" ) .off( this._transitionEndEvents ); this._closeLink.off( "click.panel" ); if ( this._modal ) { this._modal.remove(); } } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.table", { options: { classes: { table: "ui-table" }, enhanced: false }, _create: function() { if ( !this.options.enhanced ) { this.element.addClass( this.options.classes.table ); } // extend here, assign on refresh > _setHeaders $.extend( this, { // Expose headers and allHeaders properties on the widget // headers references the THs within the first TR in the table headers: undefined, // allHeaders references headers, plus all THs in the thead, which may // include several rows, or not allHeaders: undefined }); this._refresh( true ); }, _setHeaders: function() { var trs = this.element.find( "thead tr" ); this.headers = this.element.find( "tr:eq(0)" ).children(); this.allHeaders = this.headers.add( trs.children() ); }, refresh: function() { this._refresh(); }, rebuild: $.noop, _refresh: function( /* create */ ) { var table = this.element, trs = table.find( "thead tr" ); // updating headers on refresh (fixes #5880) this._setHeaders(); // Iterate over the trs trs.each( function() { var columnCount = 0; // Iterate over the children of the tr $( this ).children().each( function() { var span = parseInt( this.getAttribute( "colspan" ), 10 ), selector = ":nth-child(" + ( columnCount + 1 ) + ")", j; this.setAttribute( "data-" + $.mobile.ns + "colstart", columnCount + 1 ); if ( span ) { for( j = 0; j < span - 1; j++ ) { columnCount++; selector += ", :nth-child(" + ( columnCount + 1 ) + ")"; } } // Store "cells" data on header as a reference to all cells in the // same column as this TH $( this ).jqmData( "cells", table.find( "tr" ).not( trs.eq( 0 ) ).not( this ).children( selector ) ); columnCount++; }); }); } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.table", $.mobile.table, { options: { mode: "columntoggle", columnBtnTheme: null, columnPopupTheme: null, columnBtnText: "Columns...", classes: $.extend( $.mobile.table.prototype.options.classes, { popup: "ui-table-columntoggle-popup", columnBtn: "ui-table-columntoggle-btn", priorityPrefix: "ui-table-priority-", columnToggleTable: "ui-table-columntoggle" }) }, _create: function() { this._super(); if ( this.options.mode !== "columntoggle" ) { return; } $.extend( this, { _menu: null }); if ( this.options.enhanced ) { this._menu = $( this.document[ 0 ].getElementById( this._id() + "-popup" ) ).children().first(); this._addToggles( this._menu, true ); this._bindToggles( this._menu ); } else { this._menu = this._enhanceColToggle(); this.element.addClass( this.options.classes.columnToggleTable ); } this._setupEvents(); this._setToggleState(); }, _id: function() { return ( this.element.attr( "id" ) || ( this.widgetName + this.uuid ) ); }, _setupEvents: function() { //NOTE: inputs are bound in bindToggles, // so it can be called on refresh, too // update column toggles on resize this._on( this.window, { throttledresize: "_setToggleState" }); }, _bindToggles: function( menu ) { var inputs = menu.find( "input" ); this._on( inputs, { change: "_menuInputChange" }); }, _addToggles: function( menu, keep ) { var inputs, checkboxIndex = 0, opts = this.options, container = menu.controlgroup( "container" ); // allow update of menu on refresh (fixes #5880) if ( keep ) { inputs = menu.find( "input" ); } else { container.empty(); } // create the hide/show toggles this.headers.not( "td" ).each( function() { var header = $( this ), priority = $.mobile.getAttribute( this, "priority" ), cells = header.add( header.jqmData( "cells" ) ); if ( priority ) { cells.addClass( opts.classes.priorityPrefix + priority ); ( keep ? inputs.eq( checkboxIndex++ ) : $("<label><input type='checkbox' checked />" + ( header.children( "abbr" ).first().attr( "title" ) || header.text() ) + "</label>" ) .appendTo( container ) .children( 0 ) .checkboxradio( { theme: opts.columnPopupTheme }) ) .jqmData( "cells", cells ); } }); // set bindings here if ( !keep ) { menu.controlgroup( "refresh" ); this._bindToggles( menu ); } }, _menuInputChange: function( evt ) { var input = $( evt.target ), checked = input[ 0 ].checked; input.jqmData( "cells" ) .toggleClass( "ui-table-cell-hidden", !checked ) .toggleClass( "ui-table-cell-visible", checked ); if ( input[ 0 ].getAttribute( "locked" ) ) { input.removeAttr( "locked" ); this._unlockCells( input.jqmData( "cells" ) ); } else { input.attr( "locked", true ); } }, _unlockCells: function( cells ) { // allow hide/show via CSS only = remove all toggle-locks cells.removeClass( "ui-table-cell-hidden ui-table-cell-visible"); }, _enhanceColToggle: function() { var id , menuButton, popup, menu, table = this.element, opts = this.options, ns = $.mobile.ns, fragment = this.document[ 0 ].createDocumentFragment(); id = this._id() + "-popup"; menuButton = $( "<a href='#" + id + "' " + "class='" + opts.classes.columnBtn + " ui-btn " + "ui-btn-" + ( opts.columnBtnTheme || "a" ) + " ui-corner-all ui-shadow ui-mini' " + "data-" + ns + "rel='popup'>" + opts.columnBtnText + "</a>" ); popup = $( "<div class='" + opts.classes.popup + "' id='" + id + "'></div>" ); menu = $( "<fieldset></fieldset>" ).controlgroup(); // set extension here, send "false" to trigger build/rebuild this._addToggles( menu, false ); menu.appendTo( popup ); fragment.appendChild( popup[ 0 ] ); fragment.appendChild( menuButton[ 0 ] ); table.before( fragment ); popup.popup(); return menu; }, rebuild: function() { this._super(); if ( this.options.mode === "columntoggle" ) { // NOTE: rebuild passes "false", while refresh passes "undefined" // both refresh the table, but inside addToggles, !false will be true, // so a rebuild call can be indentified this._refresh( false ); } }, _refresh: function( create ) { this._super( create ); if ( !create && this.options.mode === "columntoggle" ) { // columns not being replaced must be cleared from input toggle-locks this._unlockCells( this.allHeaders ); // update columntoggles and cells this._addToggles( this._menu, create ); // check/uncheck this._setToggleState(); } }, _setToggleState: function() { this._menu.find( "input" ).each( function() { var checkbox = $( this ); this.checked = checkbox.jqmData( "cells" ).eq( 0 ).css( "display" ) === "table-cell"; checkbox.checkboxradio( "refresh" ); }); }, _destroy: function() { this._super(); } }); })( jQuery ); (function( $, undefined ) { $.widget( "mobile.table", $.mobile.table, { options: { mode: "reflow", classes: $.extend( $.mobile.table.prototype.options.classes, { reflowTable: "ui-table-reflow", cellLabels: "ui-table-cell-label" }) }, _create: function() { this._super(); // If it's not reflow mode, return here. if ( this.options.mode !== "reflow" ) { return; } if ( !this.options.enhanced ) { this.element.addClass( this.options.classes.reflowTable ); this._updateReflow(); } }, rebuild: function() { this._super(); if ( this.options.mode === "reflow" ) { this._refresh( false ); } }, _refresh: function( create ) { this._super( create ); if ( !create && this.options.mode === "reflow" ) { this._updateReflow( ); } }, _updateReflow: function() { var table = this, opts = this.options; // get headers in reverse order so that top-level headers are appended last $( table.allHeaders.get().reverse() ).each( function() { var cells = $( this ).jqmData( "cells" ), colstart = $.mobile.getAttribute( this, "colstart" ), hierarchyClass = cells.not( this ).filter( "thead th" ).length && " ui-table-cell-label-top", text = $( this ).text(), iteration, filter; if ( text !== "" ) { if ( hierarchyClass ) { iteration = parseInt( this.getAttribute( "colspan" ), 10 ); filter = ""; if ( iteration ) { filter = "td:nth-child("+ iteration +"n + " + ( colstart ) +")"; } table._addLabels( cells.filter( filter ), opts.classes.cellLabels + hierarchyClass, text ); } else { table._addLabels( cells, opts.classes.cellLabels, text ); } } }); }, _addLabels: function( cells, label, text ) { // .not fixes #6006 cells.not( ":has(b." + label + ")" ).prepend( "<b class='" + label + "'>" + text + "</b>" ); } }); })( jQuery ); (function( $, undefined ) { // TODO rename filterCallback/deprecate and default to the item itself as the first argument var defaultFilterCallback = function( index, searchValue ) { return ( ( "" + ( $.mobile.getAttribute( this, "filtertext" ) || $( this ).text() ) ) .toLowerCase().indexOf( searchValue ) === -1 ); }; $.widget( "mobile.filterable", { initSelector: ":jqmData(filter='true')", options: { filterReveal: false, filterCallback: defaultFilterCallback, enhanced: false, input: null, children: "> li, > option, > optgroup option, > tbody tr, > .ui-controlgroup-controls > .ui-btn, > .ui-controlgroup-controls > .ui-checkbox, > .ui-controlgroup-controls > .ui-radio" }, _create: function() { var opts = this.options; $.extend( this, { _search: null, _timer: 0 }); this._setInput( opts.input ); if ( !opts.enhanced ) { this._filterItems( ( ( this._search && this._search.val() ) || "" ).toLowerCase() ); } }, _onKeyUp: function() { var val, lastval, search = this._search; if ( search ) { val = search.val().toLowerCase(), lastval = $.mobile.getAttribute( search[ 0 ], "lastval" ) + ""; if ( lastval && lastval === val ) { // Execute the handler only once per value change return; } if ( this._timer ) { window.clearTimeout( this._timer ); this._timer = 0; } this._timer = this._delay( function() { this._trigger( "beforefilter", "beforefilter", { input: search } ); // Change val as lastval for next execution search[ 0 ].setAttribute( "data-" + $.mobile.ns + "lastval", val ); this._filterItems( val ); this._timer = 0; }, 250 ); } }, _getFilterableItems: function() { var elem = this.element, children = this.options.children, items = !children ? { length: 0 }: $.isFunction( children ) ? children(): children.nodeName ? $( children ): children.jquery ? children: this.element.find( children ); if ( items.length === 0 ) { items = elem.children(); } return items; }, _filterItems: function( val ) { var idx, callback, length, dst, show = [], hide = [], opts = this.options, filterItems = this._getFilterableItems(); if ( val != null ) { callback = opts.filterCallback || defaultFilterCallback; length = filterItems.length; // Partition the items into those to be hidden and those to be shown for ( idx = 0 ; idx < length ; idx++ ) { dst = ( callback.call( filterItems[ idx ], idx, val ) ) ? hide : show; dst.push( filterItems[ idx ] ); } } // If nothing is hidden, then the decision whether to hide or show the items // is based on the "filterReveal" option. if ( hide.length === 0 ) { filterItems[ opts.filterReveal ? "addClass" : "removeClass" ]( "ui-screen-hidden" ); } else { $( hide ).addClass( "ui-screen-hidden" ); $( show ).removeClass( "ui-screen-hidden" ); } this._refreshChildWidget(); }, // The Default implementation of _refreshChildWidget attempts to call // refresh on collapsibleset, controlgroup, selectmenu, or listview _refreshChildWidget: function() { var widget, idx, recognizedWidgets = [ "collapsibleset", "selectmenu", "controlgroup", "listview" ]; for ( idx = recognizedWidgets.length - 1 ; idx > -1 ; idx-- ) { widget = recognizedWidgets[ idx ]; if ( $.mobile[ widget ] ) { widget = this.element.data( "mobile-" + widget ); if ( widget && $.isFunction( widget.refresh ) ) { widget.refresh(); } } } }, // TODO: When the input is not internal, do not even store it in this._search _setInput: function ( selector ) { var search = this._search; // Stop a pending filter operation if ( this._timer ) { window.clearTimeout( this._timer ); this._timer = 0; } if ( search ) { this._off( search, "keyup change input" ); search = null; } if ( selector ) { search = selector.jquery ? selector: selector.nodeName ? $( selector ): this.document.find( selector ); this._on( search, { keyup: "_onKeyUp", change: "_onKeyUp", input: "_onKeyUp" }); } this._search = search; }, _setOptions: function( options ) { var refilter = !( ( options.filterReveal === undefined ) && ( options.filterCallback === undefined ) && ( options.children === undefined ) ); this._super( options ); if ( options.input !== undefined ) { this._setInput( options.input ); refilter = true; } if ( refilter ) { this.refresh(); } }, _destroy: function() { var opts = this.options, items = this._getFilterableItems(); if ( opts.enhanced ) { items.toggleClass( "ui-screen-hidden", opts.filterReveal ); } else { items.removeClass( "ui-screen-hidden" ); } }, refresh: function() { if ( this._timer ) { window.clearTimeout( this._timer ); this._timer = 0; } this._filterItems( ( ( this._search && this._search.val() ) || "" ).toLowerCase() ); } }); })( jQuery ); (function( $, undefined ) { // Create a function that will replace the _setOptions function of a widget, // and will pass the options on to the input of the filterable. var replaceSetOptions = function( self, orig ) { return function( options ) { orig.call( this, options ); self._syncTextInputOptions( options ); }; }, rDividerListItem = /(^|\s)ui-li-divider(\s|$)/, origDefaultFilterCallback = $.mobile.filterable.prototype.options.filterCallback; // Override the default filter callback with one that does not hide list dividers $.mobile.filterable.prototype.options.filterCallback = function( index, searchValue ) { return !this.className.match( rDividerListItem ) && origDefaultFilterCallback.call( this, index, searchValue ); }; $.widget( "mobile.filterable", $.mobile.filterable, { options: { filterPlaceholder: "Filter items...", filterTheme: null }, _create: function() { var idx, widgetName, elem = this.element, recognizedWidgets = [ "collapsibleset", "selectmenu", "controlgroup", "listview" ], createHandlers = {}; this._super(); $.extend( this, { _widget: null }); for ( idx = recognizedWidgets.length - 1 ; idx > -1 ; idx-- ) { widgetName = recognizedWidgets[ idx ]; if ( $.mobile[ widgetName ] ) { if ( this._setWidget( elem.data( "mobile-" + widgetName ) ) ) { break; } else { createHandlers[ widgetName + "create" ] = "_handleCreate"; } } } if ( !this._widget ) { this._on( elem, createHandlers ); } }, _handleCreate: function( evt ) { this._setWidget( this.element.data( "mobile-" + evt.type.substring( 0, evt.type.length - 6 ) ) ); }, _setWidget: function( widget ) { if ( !this._widget && widget ) { this._widget = widget; this._widget._setOptions = replaceSetOptions( this, this._widget._setOptions ); } if ( !!this._widget ) { this._syncTextInputOptions( this._widget.options ); if ( this._widget.widgetName === "listview" ) { this._widget.options.hidedividers = true; this._widget.element.listview( "refresh" ); } } return !!this._widget; }, _isSearchInternal: function() { return ( this._search && this._search.jqmData( "ui-filterable-" + this.uuid + "-internal" ) ); }, _setInput: function( selector ) { var opts = this.options, updatePlaceholder = true, textinputOpts = {}; if ( !selector ) { if ( this._isSearchInternal() ) { // Ignore the call to set a new input if the selector goes to falsy and // the current textinput is already of the internally generated variety. return; } else { // Generating a new textinput widget. No need to set the placeholder // further down the function. updatePlaceholder = false; selector = $( "<input " + "data-" + $.mobile.ns + "type='search' " + "placeholder='" + opts.filterPlaceholder + "'></input>" ) .jqmData( "ui-filterable-" + this.uuid + "-internal", true ); $( "<form class='ui-filterable'></form>" ) .append( selector ) .submit( function( evt ) { evt.preventDefault(); selector.blur(); }) .insertBefore( this.element ); if ( $.mobile.textinput ) { if ( this.options.filterTheme != null ) { textinputOpts[ "theme" ] = opts.filterTheme; } selector.textinput( textinputOpts ); } } } this._super( selector ); if ( this._isSearchInternal() && updatePlaceholder ) { this._search.attr( "placeholder", this.options.filterPlaceholder ); } }, _setOptions: function( options ) { var ret = this._super( options ); // Need to set the filterPlaceholder after having established the search input if ( options.filterPlaceholder !== undefined ) { if ( this._isSearchInternal() ) { this._search.attr( "placeholder", options.filterPlaceholder ); } } if ( options.filterTheme !== undefined && this._search && $.mobile.textinput ) { this._search.textinput( "option", "theme", options.filterTheme ); } return ret; }, _destroy: function() { if ( this._isSearchInternal() ) { this._search.remove(); } this._super(); }, _syncTextInputOptions: function( options ) { var idx, textinputOptions = {}; // We only sync options if the filterable's textinput is of the internally // generated variety, rather than one specified by the user. if ( this._isSearchInternal() && $.mobile.textinput ) { // Apply only the options understood by textinput for ( idx in $.mobile.textinput.prototype.options ) { if ( options[ idx ] !== undefined ) { if ( idx === "theme" && this.options.filterTheme != null ) { textinputOptions[ idx ] = this.options.filterTheme; } else { textinputOptions[ idx ] = options[ idx ]; } } } this._search.textinput( "option", textinputOptions ); } } }); })( jQuery ); /*! * jQuery UI Tabs fadf2b312a05040436451c64bbfaf4814bc62c56 * http://jqueryui.com * * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/tabs/ * * Depends: * jquery.ui.core.js * jquery.ui.widget.js */ (function( $, undefined ) { var tabId = 0, rhash = /#.*$/; function getNextTabId() { return ++tabId; } function isLocal( anchor ) { return anchor.hash.length > 1 && decodeURIComponent( anchor.href.replace( rhash, "" ) ) === decodeURIComponent( location.href.replace( rhash, "" ) ); } $.widget( "ui.tabs", { version: "fadf2b312a05040436451c64bbfaf4814bc62c56", delay: 300, options: { active: null, collapsible: false, event: "click", heightStyle: "content", hide: null, show: null, // callbacks activate: null, beforeActivate: null, beforeLoad: null, load: null }, _create: function() { var that = this, options = this.options; this.running = false; this.element .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ) .toggleClass( "ui-tabs-collapsible", options.collapsible ) // Prevent users from focusing disabled tabs via click .delegate( ".ui-tabs-nav > li", "mousedown" + this.eventNamespace, function( event ) { if ( $( this ).is( ".ui-state-disabled" ) ) { event.preventDefault(); } }) // support: IE <9 // Preventing the default action in mousedown doesn't prevent IE // from focusing the element, so if the anchor gets focused, blur. // We don't have to worry about focusing the previously focused // element since clicking on a non-focusable element should focus // the body anyway. .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() { if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { this.blur(); } }); this._processTabs(); options.active = this._initialActive(); // Take disabling tabs via class attribute from HTML // into account and update option properly. if ( $.isArray( options.disabled ) ) { options.disabled = $.unique( options.disabled.concat( $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { return that.tabs.index( li ); }) ) ).sort(); } // check for length avoids error when initializing empty list if ( this.options.active !== false && this.anchors.length ) { this.active = this._findActive( options.active ); } else { this.active = $(); } this._refresh(); if ( this.active.length ) { this.load( options.active ); } }, _initialActive: function() { var active = this.options.active, collapsible = this.options.collapsible, locationHash = location.hash.substring( 1 ); if ( active === null ) { // check the fragment identifier in the URL if ( locationHash ) { this.tabs.each(function( i, tab ) { if ( $( tab ).attr( "aria-controls" ) === locationHash ) { active = i; return false; } }); } // check for a tab marked active via a class if ( active === null ) { active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); } // no active tab, set to false if ( active === null || active === -1 ) { active = this.tabs.length ? 0 : false; } } // handle numbers: negative, out of range if ( active !== false ) { active = this.tabs.index( this.tabs.eq( active ) ); if ( active === -1 ) { active = collapsible ? false : 0; } } // don't allow collapsible: false and active: false if ( !collapsible && active === false && this.anchors.length ) { active = 0; } return active; }, _getCreateEventData: function() { return { tab: this.active, panel: !this.active.length ? $() : this._getPanelForTab( this.active ) }; }, _tabKeydown: function( event ) { var focusedTab = $( this.document[0].activeElement ).closest( "li" ), selectedIndex = this.tabs.index( focusedTab ), goingForward = true; if ( this._handlePageNav( event ) ) { return; } switch ( event.keyCode ) { case $.ui.keyCode.RIGHT: case $.ui.keyCode.DOWN: selectedIndex++; break; case $.ui.keyCode.UP: case $.ui.keyCode.LEFT: goingForward = false; selectedIndex--; break; case $.ui.keyCode.END: selectedIndex = this.anchors.length - 1; break; case $.ui.keyCode.HOME: selectedIndex = 0; break; case $.ui.keyCode.SPACE: // Activate only, no collapsing event.preventDefault(); clearTimeout( this.activating ); this._activate( selectedIndex ); return; case $.ui.keyCode.ENTER: // Toggle (cancel delayed activation, allow collapsing) event.preventDefault(); clearTimeout( this.activating ); // Determine if we should collapse or activate this._activate( selectedIndex === this.options.active ? false : selectedIndex ); return; default: return; } // Focus the appropriate tab, based on which key was pressed event.preventDefault(); clearTimeout( this.activating ); selectedIndex = this._focusNextTab( selectedIndex, goingForward ); // Navigating with control key will prevent automatic activation if ( !event.ctrlKey ) { // Update aria-selected immediately so that AT think the tab is already selected. // Otherwise AT may confuse the user by stating that they need to activate the tab, // but the tab will already be activated by the time the announcement finishes. focusedTab.attr( "aria-selected", "false" ); this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); this.activating = this._delay(function() { this.option( "active", selectedIndex ); }, this.delay ); } }, _panelKeydown: function( event ) { if ( this._handlePageNav( event ) ) { return; } // Ctrl+up moves focus to the current tab if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { event.preventDefault(); this.active.focus(); } }, // Alt+page up/down moves focus to the previous/next tab (and activates) _handlePageNav: function( event ) { if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { this._activate( this._focusNextTab( this.options.active - 1, false ) ); return true; } if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { this._activate( this._focusNextTab( this.options.active + 1, true ) ); return true; } }, _findNextTab: function( index, goingForward ) { var lastTabIndex = this.tabs.length - 1; function constrain() { if ( index > lastTabIndex ) { index = 0; } if ( index < 0 ) { index = lastTabIndex; } return index; } while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { index = goingForward ? index + 1 : index - 1; } return index; }, _focusNextTab: function( index, goingForward ) { index = this._findNextTab( index, goingForward ); this.tabs.eq( index ).focus(); return index; }, _setOption: function( key, value ) { if ( key === "active" ) { // _activate() will handle invalid values and update this.options this._activate( value ); return; } if ( key === "disabled" ) { // don't use the widget factory's disabled handling this._setupDisabled( value ); return; } this._super( key, value); if ( key === "collapsible" ) { this.element.toggleClass( "ui-tabs-collapsible", value ); // Setting collapsible: false while collapsed; open first panel if ( !value && this.options.active === false ) { this._activate( 0 ); } } if ( key === "event" ) { this._setupEvents( value ); } if ( key === "heightStyle" ) { this._setupHeightStyle( value ); } }, _tabId: function( tab ) { return tab.attr( "aria-controls" ) || "ui-tabs-" + getNextTabId(); }, _sanitizeSelector: function( hash ) { return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; }, refresh: function() { var options = this.options, lis = this.tablist.children( ":has(a[href])" ); // get disabled tabs from class attribute from HTML // this will get converted to a boolean if needed in _refresh() options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { return lis.index( tab ); }); this._processTabs(); // was collapsed or no tabs if ( options.active === false || !this.anchors.length ) { options.active = false; this.active = $(); // was active, but active tab is gone } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { // all remaining tabs are disabled if ( this.tabs.length === options.disabled.length ) { options.active = false; this.active = $(); // activate previous tab } else { this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); } // was active, active tab still exists } else { // make sure active index is correct options.active = this.tabs.index( this.active ); } 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" }); // Make sure one tab is in the tab order if ( !this.active.length ) { this.tabs.eq( 0 ).attr( "tabIndex", 0 ); } else { 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" }); } }, _processTabs: function() { var that = 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 $( "a", this )[ 0 ]; }) .addClass( "ui-tabs-anchor" ) .attr({ role: "presentation", tabIndex: -1 }); this.panels = $(); this.anchors.each(function( i, anchor ) { var selector, panel, panelId, anchorId = $( anchor ).uniqueId().attr( "id" ), tab = $( anchor ).closest( "li" ), originalAriaControls = tab.attr( "aria-controls" ); // inline tab if ( isLocal( anchor ) ) { selector = anchor.hash; panel = that.element.find( that._sanitizeSelector( selector ) ); // remote tab } else { panelId = that._tabId( tab ); selector = "#" + panelId; panel = that.element.find( selector ); if ( !panel.length ) { panel = that._createPanel( panelId ); panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); } panel.attr( "aria-live", "polite" ); } if ( panel.length) { that.panels = that.panels.add( panel ); } if ( originalAriaControls ) { tab.data( "ui-tabs-aria-controls", originalAriaControls ); } tab.attr({ "aria-controls": selector.substring( 1 ), "aria-labelledby": anchorId }); panel.attr( "aria-labelledby", anchorId ); }); this.panels .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) .attr( "role", "tabpanel" ); }, // allow overriding how to find the list for rare usage scenarios (#7715) _getList: function() { return this.element.find( "ol,ul" ).eq( 0 ); }, _createPanel: function( id ) { return $( "<div>" ) .attr( "id", id ) .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) .data( "ui-tabs-destroy", true ); }, _setupDisabled: function( disabled ) { if ( $.isArray( disabled ) ) { if ( !disabled.length ) { disabled = false; } else if ( disabled.length === this.anchors.length ) { disabled = true; } } // disable tabs for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) { if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { $( li ) .addClass( "ui-state-disabled" ) .attr( "aria-disabled", "true" ); } else { $( li ) .removeClass( "ui-state-disabled" ) .removeAttr( "aria-disabled" ); } } this.options.disabled = disabled; }, _setupEvents: function( event ) { var events = { click: function( event ) { event.preventDefault(); } }; if ( event ) { $.each( event.split(" "), function( index, eventName ) { events[ eventName ] = "_eventHandler"; }); } this._off( this.anchors.add( this.tabs ).add( this.panels ) ); this._on( this.anchors, events ); this._on( this.tabs, { keydown: "_tabKeydown" } ); this._on( this.panels, { keydown: "_panelKeydown" } ); this._focusable( this.tabs ); this._hoverable( this.tabs ); }, _setupHeightStyle: function( heightStyle ) { var maxHeight, parent = this.element.parent(); if ( heightStyle === "fill" ) { maxHeight = parent.height(); maxHeight -= this.element.outerHeight() - this.element.height(); this.element.siblings( ":visible" ).each(function() { var elem = $( this ), position = elem.css( "position" ); if ( position === "absolute" || position === "fixed" ) { return; } maxHeight -= elem.outerHeight( true ); }); this.element.children().not( this.panels ).each(function() { maxHeight -= $( this ).outerHeight( true ); }); this.panels.each(function() { $( this ).height( Math.max( 0, maxHeight - $( this ).innerHeight() + $( this ).height() ) ); }) .css( "overflow", "auto" ); } else if ( heightStyle === "auto" ) { maxHeight = 0; this.panels.each(function() { maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); }).height( maxHeight ); } }, _eventHandler: function( event ) { var options = this.options, active = this.active, anchor = $( event.currentTarget ), tab = anchor.closest( "li" ), clickedIsActive = tab[ 0 ] === active[ 0 ], collapsing = clickedIsActive && options.collapsible, toShow = collapsing ? $() : this._getPanelForTab( tab ), toHide = !active.length ? $() : this._getPanelForTab( active ), eventData = { oldTab: active, oldPanel: toHide, newTab: collapsing ? $() : tab, newPanel: toShow }; event.preventDefault(); if ( tab.hasClass( "ui-state-disabled" ) || // tab is already loading tab.hasClass( "ui-tabs-loading" ) || // can't switch durning an animation this.running || // click on active header, but not collapsible ( clickedIsActive && !options.collapsible ) || // allow canceling activation ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { return; } options.active = collapsing ? false : this.tabs.index( tab ); this.active = clickedIsActive ? $() : tab; if ( this.xhr ) { this.xhr.abort(); } if ( !toHide.length && !toShow.length ) { $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); } if ( toShow.length ) { this.load( this.tabs.index( tab ), event ); } this._toggle( event, eventData ); }, // handles show/hide for selecting tabs _toggle: function( event, eventData ) { var that = this, toShow = eventData.newPanel, toHide = eventData.oldPanel; this.running = true; function complete() { that.running = false; that._trigger( "activate", event, eventData ); } function show() { eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); if ( toShow.length && that.options.show ) { that._show( toShow, that.options.show, complete ); } else { toShow.show(); complete(); } } // start out by hiding, then showing, then completing if ( toHide.length && this.options.hide ) { this._hide( toHide, this.options.hide, function() { eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); show(); }); } else { eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); toHide.hide(); show(); } toHide.attr({ "aria-expanded": "false", "aria-hidden": "true" }); eventData.oldTab.attr( "aria-selected", "false" ); // If we're switching tabs, remove the old tab from the tab order. // If we're opening from collapsed state, remove the previous tab from the tab order. // If we're collapsing, then keep the collapsing tab in the tab order. if ( toShow.length && toHide.length ) { eventData.oldTab.attr( "tabIndex", -1 ); } else if ( toShow.length ) { this.tabs.filter(function() { return $( this ).attr( "tabIndex" ) === 0; }) .attr( "tabIndex", -1 ); } toShow.attr({ "aria-expanded": "true", "aria-hidden": "false" }); eventData.newTab.attr({ "aria-selected": "true", tabIndex: 0 }); }, _activate: function( index ) { var anchor, active = this._findActive( index ); // trying to activate the already active panel if ( active[ 0 ] === this.active[ 0 ] ) { return; } // trying to collapse, simulate a click on the current active header if ( !active.length ) { active = this.active; } anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; this._eventHandler({ target: anchor, currentTarget: anchor, preventDefault: $.noop }); }, _findActive: function( index ) { return index === false ? $() : this.tabs.eq( index ); }, _getIndex: function( index ) { // meta-function to give users option to provide a href string instead of a numerical index. if ( typeof index === "string" ) { index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); } return index; }, _destroy: function() { if ( 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() { if ( $.data( this, "ui-tabs-destroy" ) ) { $( this ).remove(); } else { $( 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 li = $( this ), prev = li.data( "ui-tabs-aria-controls" ); if ( prev ) { li .attr( "aria-controls", prev ) .removeData( "ui-tabs-aria-controls" ); } else { li.removeAttr( "aria-controls" ); } }); this.panels.show(); if ( this.options.heightStyle !== "content" ) { this.panels.css( "height", "" ); } }, enable: function( index ) { var disabled = this.options.disabled; if ( disabled === false ) { return; } if ( index === undefined ) { disabled = false; } else { index = this._getIndex( index ); if ( $.isArray( disabled ) ) { disabled = $.map( disabled, function( num ) { return num !== index ? num : null; }); } else { disabled = $.map( this.tabs, function( li, num ) { return num !== index ? num : null; }); } } this._setupDisabled( disabled ); }, disable: function( index ) { var disabled = this.options.disabled; if ( disabled === true ) { return; } if ( index === undefined ) { disabled = true; } else { index = this._getIndex( index ); if ( $.inArray( index, disabled ) !== -1 ) { return; } if ( $.isArray( disabled ) ) { disabled = $.merge( [ index ], disabled ).sort(); } else { disabled = [ index ]; } } this._setupDisabled( disabled ); }, load: function( index, event ) { index = this._getIndex( index ); var that = this, tab = this.tabs.eq( index ), anchor = tab.find( ".ui-tabs-anchor" ), panel = this._getPanelForTab( tab ), eventData = { tab: tab, panel: panel }; // not remote if ( isLocal( anchor[ 0 ] ) ) { return; } this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); // support: jQuery <1.8 // jQuery <1.8 returns false if the request is canceled in beforeSend, // but as of 1.8, $.ajax() always returns a jqXHR object. if ( this.xhr && this.xhr.statusText !== "canceled" ) { tab.addClass( "ui-tabs-loading" ); panel.attr( "aria-busy", "true" ); this.xhr .success(function( response ) { // support: jQuery <1.8 // http://bugs.jquery.com/ticket/11778 setTimeout(function() { panel.html( response ); that._trigger( "load", event, eventData ); }, 1 ); }) .complete(function( jqXHR, status ) { // support: jQuery <1.8 // http://bugs.jquery.com/ticket/11778 setTimeout(function() { if ( status === "abort" ) { that.panels.stop( false, true ); } tab.removeClass( "ui-tabs-loading" ); panel.removeAttr( "aria-busy" ); if ( jqXHR === that.xhr ) { delete that.xhr; } }, 1 ); }); } }, _ajaxSettings: function( anchor, event, eventData ) { var that = this; return { url: anchor.attr( "href" ), beforeSend: function( jqXHR, settings ) { return that._trigger( "beforeLoad", event, $.extend( { jqXHR : jqXHR, ajaxSettings: settings }, eventData ) ); } }; }, _getPanelForTab: function( tab ) { var id = $( tab ).attr( "aria-controls" ); return this.element.find( this._sanitizeSelector( "#" + id ) ); } }); })( jQuery ); (function( $, undefined ) { })( jQuery ); (function( $, window ) { $.mobile.iosorientationfixEnabled = true; // This fix addresses an iOS bug, so return early if the UA claims it's something else. var ua = navigator.userAgent, zoom, evt, x, y, z, aig; if ( !( /iPhone|iPad|iPod/.test( navigator.platform ) && /OS [1-5]_[0-9_]* like Mac OS X/i.test( ua ) && ua.indexOf( "AppleWebKit" ) > -1 ) ) { $.mobile.iosorientationfixEnabled = false; return; } zoom = $.mobile.zoom; function checkTilt( e ) { evt = e.originalEvent; aig = evt.accelerationIncludingGravity; x = Math.abs( aig.x ); y = Math.abs( aig.y ); z = Math.abs( aig.z ); // If portrait orientation and in one of the danger zones if ( !window.orientation && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ) { if ( zoom.enabled ) { zoom.disable(); } } else if ( !zoom.enabled ) { zoom.enable(); } } $.mobile.document.on( "mobileinit", function() { if ( $.mobile.iosorientationfixEnabled ) { $.mobile.window .bind( "orientationchange.iosorientationfix", zoom.enable ) .bind( "devicemotion.iosorientationfix", checkTilt ); } }); }( jQuery, this )); (function( $, window, undefined ) { var $html = $( "html" ), $window = $.mobile.window; //remove initial build class (only present on first pageshow) function hideRenderingClass() { $html.removeClass( "ui-mobile-rendering" ); } // trigger mobileinit event - useful hook for configuring $.mobile settings before they're used $( window.document ).trigger( "mobileinit" ); // support conditions // if device support condition(s) aren't met, leave things as they are -> a basic, usable experience, // otherwise, proceed with the enhancements if ( !$.mobile.gradeA() ) { return; } // override ajaxEnabled on platforms that have known conflicts with hash history updates // or generally work better browsing in regular http for full page refreshes (BB5, Opera Mini) if ( $.mobile.ajaxBlacklist ) { $.mobile.ajaxEnabled = false; } // Add mobile, initial load "rendering" classes to docEl $html.addClass( "ui-mobile ui-mobile-rendering" ); // This is a fallback. If anything goes wrong (JS errors, etc), or events don't fire, // this ensures the rendering class is removed after 5 seconds, so content is visible and accessible setTimeout( hideRenderingClass, 5000 ); $.extend( $.mobile, { // find and enhance the pages in the dom and transition to the first page. initializePage: function() { // find present pages var path = $.mobile.path, $pages = $( ":jqmData(role='page'), :jqmData(role='dialog')" ), hash = path.stripHash( path.stripQueryParams(path.parseLocation().hash) ), hashPage = document.getElementById( hash ); // if no pages are found, create one with body's inner html if ( !$pages.length ) { $pages = $( "body" ).wrapInner( "<div data-" + $.mobile.ns + "role='page'></div>" ).children( 0 ); } // add dialogs, set data-url attrs $pages.each(function() { var $this = $( this ); // unless the data url is already set set it to the pathname if ( !$this[ 0 ].getAttribute( "data-" + $.mobile.ns + "url" ) ) { $this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) || location.pathname + location.search ); } }); // define first page in dom case one backs out to the directory root (not always the first page visited, but defined as fallback) $.mobile.firstPage = $pages.first(); // define page container $.mobile.pageContainer = $.mobile.firstPage .parent() .addClass( "ui-mobile-viewport" ) .pagecontainer(); // initialize navigation events now, after mobileinit has occurred and the page container // has been created but before the rest of the library is alerted to that fact $.mobile.navreadyDeferred.resolve(); // alert listeners that the pagecontainer has been determined for binding // to events triggered on it $window.trigger( "pagecontainercreate" ); // cue page loading message $.mobile.loading( "show" ); //remove initial build class (only present on first pageshow) hideRenderingClass(); // if hashchange listening is disabled, there's no hash deeplink, // the hash is not valid (contains more than one # or does not start with #) // or there is no page with that hash, change to the first page in the DOM // Remember, however, that the hash can also be a path! if ( ! ( $.mobile.hashListeningEnabled && $.mobile.path.isHashValid( location.hash ) && ( $( hashPage ).is( ":jqmData(role='page')" ) || $.mobile.path.isPath( hash ) || hash === $.mobile.dialogHashKey ) ) ) { // Store the initial destination if ( $.mobile.path.isHashValid( location.hash ) ) { $.mobile.navigate.history.initialDst = hash.replace( "#", "" ); } // make sure to set initial popstate state if it exists // so that navigation back to the initial page works properly if ( $.event.special.navigate.isPushStateEnabled() ) { $.mobile.navigate.navigator.squash( path.parseLocation().href ); } $.mobile.changePage( $.mobile.firstPage, { transition: "none", reverse: true, changeHash: false, fromHashChange: true }); } else { // trigger hashchange or navigate to squash and record the correct // history entry for an initial hash path if ( !$.event.special.navigate.isPushStateEnabled() ) { $window.trigger( "hashchange", [true] ); } else { // TODO figure out how to simplify this interaction with the initial history entry // at the bottom js/navigate/navigate.js $.mobile.navigate.history.stack = []; $.mobile.navigate( $.mobile.path.isPath( location.hash ) ? location.hash : location.href ); } } } }); $(function() { //Run inlineSVG support test $.support.inlineSVG(); // check which scrollTop value should be used by scrolling to 1 immediately at domready // then check what the scroll top is. Android will report 0... others 1 // note that this initial scroll won't hide the address bar. It's just for the check. // hide iOS browser chrome on load if hideUrlBar is true this is to try and do it as soon as possible if ( $.mobile.hideUrlBar ) { window.scrollTo( 0, 1 ); } // if defaultHomeScroll hasn't been set yet, see if scrollTop is 1 // it should be 1 in most browsers, but android treats 1 as 0 (for hiding addr bar) // so if it's 1, use 0 from now on $.mobile.defaultHomeScroll = ( !$.support.scrollTop || $.mobile.window.scrollTop() === 1 ) ? 0 : 1; //dom-ready inits if ( $.mobile.autoInitializePage ) { $.mobile.initializePage(); } // window load event // hide iOS browser chrome on load if hideUrlBar is true this is as fall back incase we were too early before if ( $.mobile.hideUrlBar ) { $window.load( $.mobile.silentScroll ); } if ( !$.support.cssPointerEvents ) { // IE and Opera don't support CSS pointer-events: none that we use to disable link-based buttons // by adding the 'ui-disabled' class to them. Using a JavaScript workaround for those browser. // https://github.com/jquery/jquery-mobile/issues/3558 // DEPRECATED as of 1.4.0 - remove ui-disabled after 1.4.0 release // only ui-state-disabled should be present thereafter $.mobile.document.delegate( ".ui-state-disabled,.ui-disabled", "vclick", function( e ) { e.preventDefault(); e.stopImmediatePropagation(); } ); } }); }( jQuery, this )); }));
app/javascript/mastodon/features/getting_started/components/trends.js
gol-cha/mastodon
import React from 'react'; import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { ImmutableHashtag as Hashtag } from 'mastodon/components/hashtag'; import { FormattedMessage } from 'react-intl'; export default class Trends extends ImmutablePureComponent { static defaultProps = { loading: false, }; static propTypes = { trends: ImmutablePropTypes.list, fetchTrends: PropTypes.func.isRequired, }; componentDidMount () { this.props.fetchTrends(); this.refreshInterval = setInterval(() => this.props.fetchTrends(), 900 * 1000); } componentWillUnmount () { if (this.refreshInterval) { clearInterval(this.refreshInterval); } } render () { const { trends } = this.props; if (!trends || trends.isEmpty()) { return null; } return ( <div className='getting-started__trends'> <h4><FormattedMessage id='trends.trending_now' defaultMessage='Trending now' /></h4> {trends.take(3).map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)} </div> ); } }
Libraries/Components/WebView/WebView.ios.js
mrspeaker/react-native
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule WebView * @noflow */ 'use strict'; var ActivityIndicator = require('ActivityIndicator'); var EdgeInsetsPropType = require('EdgeInsetsPropType'); var React = require('React'); var ReactNative = require('react/lib/ReactNative'); var StyleSheet = require('StyleSheet'); var Text = require('Text'); var UIManager = require('UIManager'); var View = require('View'); var ScrollView = require('ScrollView'); var deprecatedPropType = require('deprecatedPropType'); var invariant = require('fbjs/lib/invariant'); var keyMirror = require('fbjs/lib/keyMirror'); var processDecelerationRate = require('processDecelerationRate'); var requireNativeComponent = require('requireNativeComponent'); var resolveAssetSource = require('resolveAssetSource'); var PropTypes = React.PropTypes; var RCTWebViewManager = require('NativeModules').WebViewManager; var BGWASH = 'rgba(255,255,255,0.8)'; var RCT_WEBVIEW_REF = 'webview'; var WebViewState = keyMirror({ IDLE: null, LOADING: null, ERROR: null, }); const NavigationType = keyMirror({ click: true, formsubmit: true, backforward: true, reload: true, formresubmit: true, other: true, }); const JSNavigationScheme = 'react-js-navigation'; type ErrorEvent = { domain: any; code: any; description: any; } type Event = Object; const DataDetectorTypes = [ 'phoneNumber', 'link', 'address', 'calendarEvent', 'none', 'all', ]; var defaultRenderLoading = () => ( <View style={styles.loadingView}> <ActivityIndicator /> </View> ); var defaultRenderError = (errorDomain, errorCode, errorDesc) => ( <View style={styles.errorContainer}> <Text style={styles.errorTextTitle}> Error loading page </Text> <Text style={styles.errorText}> {'Domain: ' + errorDomain} </Text> <Text style={styles.errorText}> {'Error Code: ' + errorCode} </Text> <Text style={styles.errorText}> {'Description: ' + errorDesc} </Text> </View> ); /** * `WebView` renders web content in a native view. * *``` * import React, { Component } from 'react'; * import { WebView } from 'react-native'; * * class MyWeb extends Component { * render() { * return ( * <WebView * source={{uri: 'https://github.com/facebook/react-native'}} * style={{marginTop: 20}} * /> * ); * } * } *``` * * You can use this component to navigate back and forth in the web view's * history and configure various properties for the web content. */ var WebView = React.createClass({ statics: { JSNavigationScheme: JSNavigationScheme, NavigationType: NavigationType, }, propTypes: { ...View.propTypes, html: deprecatedPropType( PropTypes.string, 'Use the `source` prop instead.' ), url: deprecatedPropType( PropTypes.string, 'Use the `source` prop instead.' ), /** * Loads static html or a uri (with optional headers) in the WebView. */ source: PropTypes.oneOfType([ PropTypes.shape({ /* * The URI to load in the `WebView`. Can be a local or remote file. */ uri: PropTypes.string, /* * The HTTP Method to use. Defaults to GET if not specified. * NOTE: On Android, only GET and POST are supported. */ method: PropTypes.string, /* * Additional HTTP headers to send with the request. * NOTE: On Android, this can only be used with GET requests. */ headers: PropTypes.object, /* * The HTTP body to send with the request. This must be a valid * UTF-8 string, and will be sent exactly as specified, with no * additional encoding (e.g. URL-escaping or base64) applied. * NOTE: On Android, this can only be used with POST requests. */ body: PropTypes.string, }), PropTypes.shape({ /* * A static HTML page to display in the WebView. */ html: PropTypes.string, /* * The base URL to be used for any relative links in the HTML. */ baseUrl: PropTypes.string, }), /* * Used internally by packager. */ PropTypes.number, ]), /** * Function that returns a view to show if there's an error. */ renderError: PropTypes.func, // view to show if there's an error /** * Function that returns a loading indicator. */ renderLoading: PropTypes.func, /** * Function that is invoked when the `WebView` has finished loading. */ onLoad: PropTypes.func, /** * Function that is invoked when the `WebView` load succeeds or fails. */ onLoadEnd: PropTypes.func, /** * Function that is invoked when the `WebView` starts loading. */ onLoadStart: PropTypes.func, /** * Function that is invoked when the `WebView` load fails. */ onError: PropTypes.func, /** * Boolean value that determines whether the web view bounces * when it reaches the edge of the content. The default value is `true`. * @platform ios */ bounces: PropTypes.bool, /** * A floating-point number that determines how quickly the scroll view * decelerates after the user lifts their finger. You may also use the * string shortcuts `"normal"` and `"fast"` which match the underlying iOS * settings for `UIScrollViewDecelerationRateNormal` and * `UIScrollViewDecelerationRateFast` respectively: * * - normal: 0.998 * - fast: 0.99 (the default for iOS web view) * @platform ios */ decelerationRate: ScrollView.propTypes.decelerationRate, /** * Boolean value that determines whether scrolling is enabled in the * `WebView`. The default value is `true`. * @platform ios */ scrollEnabled: PropTypes.bool, /** * Controls whether to adjust the content inset for web views that are * placed behind a navigation bar, tab bar, or toolbar. The default value * is `true`. */ automaticallyAdjustContentInsets: PropTypes.bool, /** * The amount by which the web view content is inset from the edges of * the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}. */ contentInset: EdgeInsetsPropType, /** * Function that is invoked when the `WebView` loading starts or ends. */ onNavigationStateChange: PropTypes.func, /** * Boolean value that forces the `WebView` to show the loading view * on the first load. */ startInLoadingState: PropTypes.bool, /** * The style to apply to the `WebView`. */ style: View.propTypes.style, /** * Determines the types of data converted to clickable URLs in the web view’s content. * By default only phone numbers are detected. * * You can provide one type or an array of many types. * * Possible values for `dataDetectorTypes` are: * * - `'phoneNumber'` * - `'link'` * - `'address'` * - `'calendarEvent'` * - `'none'` * - `'all'` * * @platform ios */ dataDetectorTypes: PropTypes.oneOfType([ PropTypes.oneOf(DataDetectorTypes), PropTypes.arrayOf(PropTypes.oneOf(DataDetectorTypes)), ]), /** * Boolean value to enable JavaScript in the `WebView`. Used on Android only * as JavaScript is enabled by default on iOS. The default value is `true`. * @platform android */ javaScriptEnabled: PropTypes.bool, /** * Boolean value to control whether DOM Storage is enabled. Used only in * Android. * @platform android */ domStorageEnabled: PropTypes.bool, /** * Set this to provide JavaScript that will be injected into the web page * when the view loads. */ injectedJavaScript: PropTypes.string, /** * Sets the user-agent for the `WebView`. * @platform android */ userAgent: PropTypes.string, /** * Boolean that controls whether the web content is scaled to fit * the view and enables the user to change the scale. The default value * is `true`. */ scalesPageToFit: PropTypes.bool, /** * Function that allows custom handling of any web view requests. Return * `true` from the function to continue loading the request and `false` * to stop loading. * @platform ios */ onShouldStartLoadWithRequest: PropTypes.func, /** * Boolean that determines whether HTML5 videos play inline or use the * native full-screen controller. The default value is `false`. * * **NOTE** : In order for video to play inline, not only does this * property need to be set to `true`, but the video element in the HTML * document must also include the `webkit-playsinline` attribute. * @platform ios */ allowsInlineMediaPlayback: PropTypes.bool, /** * Boolean that determines whether HTML5 audio and video requires the user * to tap them before they start playing. The default value is `false`. */ mediaPlaybackRequiresUserAction: PropTypes.bool, }, getInitialState: function() { return { viewState: WebViewState.IDLE, lastErrorEvent: (null: ?ErrorEvent), startInLoadingState: true, }; }, componentWillMount: function() { if (this.props.startInLoadingState) { this.setState({viewState: WebViewState.LOADING}); } }, render: function() { var otherView = null; if (this.state.viewState === WebViewState.LOADING) { otherView = (this.props.renderLoading || defaultRenderLoading)(); } else if (this.state.viewState === WebViewState.ERROR) { var errorEvent = this.state.lastErrorEvent; invariant( errorEvent != null, 'lastErrorEvent expected to be non-null' ); otherView = (this.props.renderError || defaultRenderError)( errorEvent.domain, errorEvent.code, errorEvent.description ); } else if (this.state.viewState !== WebViewState.IDLE) { console.error( 'RCTWebView invalid state encountered: ' + this.state.loading ); } var webViewStyles = [styles.container, styles.webView, this.props.style]; if (this.state.viewState === WebViewState.LOADING || this.state.viewState === WebViewState.ERROR) { // if we're in either LOADING or ERROR states, don't show the webView webViewStyles.push(styles.hidden); } var onShouldStartLoadWithRequest = this.props.onShouldStartLoadWithRequest && ((event: Event) => { var shouldStart = this.props.onShouldStartLoadWithRequest && this.props.onShouldStartLoadWithRequest(event.nativeEvent); RCTWebViewManager.startLoadWithResult(!!shouldStart, event.nativeEvent.lockIdentifier); }); var decelerationRate = processDecelerationRate(this.props.decelerationRate); var source = this.props.source || {}; if (this.props.html) { source.html = this.props.html; } else if (this.props.url) { source.uri = this.props.url; } var webView = <RCTWebView ref={RCT_WEBVIEW_REF} key="webViewKey" style={webViewStyles} source={resolveAssetSource(source)} injectedJavaScript={this.props.injectedJavaScript} bounces={this.props.bounces} scrollEnabled={this.props.scrollEnabled} decelerationRate={decelerationRate} contentInset={this.props.contentInset} automaticallyAdjustContentInsets={this.props.automaticallyAdjustContentInsets} onLoadingStart={this._onLoadingStart} onLoadingFinish={this._onLoadingFinish} onLoadingError={this._onLoadingError} onShouldStartLoadWithRequest={onShouldStartLoadWithRequest} scalesPageToFit={this.props.scalesPageToFit} allowsInlineMediaPlayback={this.props.allowsInlineMediaPlayback} mediaPlaybackRequiresUserAction={this.props.mediaPlaybackRequiresUserAction} dataDetectorTypes={this.props.dataDetectorTypes} />; return ( <View style={styles.container}> {webView} {otherView} </View> ); }, /** * Go forward one page in the web view's history. */ goForward: function() { UIManager.dispatchViewManagerCommand( this.getWebViewHandle(), UIManager.RCTWebView.Commands.goForward, null ); }, /** * Go back one page in the web view's history. */ goBack: function() { UIManager.dispatchViewManagerCommand( this.getWebViewHandle(), UIManager.RCTWebView.Commands.goBack, null ); }, /** * Reloads the current page. */ reload: function() { this.setState({viewState: WebViewState.LOADING}); UIManager.dispatchViewManagerCommand( this.getWebViewHandle(), UIManager.RCTWebView.Commands.reload, null ); }, /** * Stop loading the current page. */ stopLoading: function() { UIManager.dispatchViewManagerCommand( this.getWebViewHandle(), UIManager.RCTWebView.Commands.stopLoading, null ); }, /** * We return an event with a bunch of fields including: * url, title, loading, canGoBack, canGoForward */ _updateNavigationState: function(event: Event) { if (this.props.onNavigationStateChange) { this.props.onNavigationStateChange(event.nativeEvent); } }, /** * Returns the native `WebView` node. */ getWebViewHandle: function(): any { return ReactNative.findNodeHandle(this.refs[RCT_WEBVIEW_REF]); }, _onLoadingStart: function(event: Event) { var onLoadStart = this.props.onLoadStart; onLoadStart && onLoadStart(event); this._updateNavigationState(event); }, _onLoadingError: function(event: Event) { event.persist(); // persist this event because we need to store it var {onError, onLoadEnd} = this.props; onError && onError(event); onLoadEnd && onLoadEnd(event); console.warn('Encountered an error loading page', event.nativeEvent); this.setState({ lastErrorEvent: event.nativeEvent, viewState: WebViewState.ERROR }); }, _onLoadingFinish: function(event: Event) { var {onLoad, onLoadEnd} = this.props; onLoad && onLoad(event); onLoadEnd && onLoadEnd(event); this.setState({ viewState: WebViewState.IDLE, }); this._updateNavigationState(event); }, }); var RCTWebView = requireNativeComponent('RCTWebView', WebView, { nativeOnly: { onLoadingStart: true, onLoadingError: true, onLoadingFinish: true, }, }); var styles = StyleSheet.create({ container: { flex: 1, }, errorContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: BGWASH, }, errorText: { fontSize: 14, textAlign: 'center', marginBottom: 2, }, errorTextTitle: { fontSize: 15, fontWeight: '500', marginBottom: 10, }, hidden: { height: 0, flex: 0, // disable 'flex:1' when hiding a View }, loadingView: { backgroundColor: BGWASH, flex: 1, justifyContent: 'center', alignItems: 'center', height: 100, }, webView: { backgroundColor: '#ffffff', } }); module.exports = WebView;
reactor/snmp.js
corenova/kos
// SNMP transaction flow 'use strict' const { kos = require('..') } = global module.exports = kos.create('snmp') .desc("reactions to SNMP GET/SET commands") .init({ protocols: ['snmp:'] }) .pre('module/net-snmp') .in('snmp/connect') .out('snmp/session','snmp/connect/url') .bind(connect) .pre('module/net-snmp') .in('snmp/request','snmp/session') .out('snmp/response') .bind(request) .in('snmp/get') .out('snmp/request') .bind(snmpget) .in('snmp/set') .out('snmp/request') .bind(snmpset) .pre('module/url') .in('snmp/connect/url') .out('snmp/connect') .bind(connectByUrl) function connect(opts) { if (typeof opts === 'string') return this.send('snmp/connect/url', opts) const snmp = this.get('module/net-snmp') const protocols = this.get('protocols') const sessions = this.use('sessions', new Map) const { protocol, hostname, port, community, retries, timeout, transport, version } = opts = normalizeOptions(opts) if (!protocols.includes(protocol)) this.throw("unsupported protocol", protocol) const addr = `${protocol}//${hostname}:${port}` if (!sessions.has(addr)) { let session = snmp.createSession(hostname, community, { port, retries, timeout, transport, version }) session.on('error', this.error.bind(this)) sessions.set(addr, session) } this.send('snmp/session', sessions.get(addr)) } function request(req, session) { const snmp = this.get('module/net-snmp') const [ method, ...args ] = req session[method](args, (err, varbinds) => { if (err) return this.error(err) varbinds = varbinds.filter(data => { let error = snmp.isVarbindError(data) if (error) this.error(snmp.varbindError(data)) return !error }) this.send('snmp/response', varbinds); }); } function snmpget(oids) { this.send('snmp/request', [ 'get', ...oids ]) } function snmpset(varbinds) { //var varbinds = [{oid: "1.3.6.1.4.1.1206.4.2.1.1.2.1.3.15", type: 2, value: 15}]; this.send('snmp/request', [ 'set', ...varbinds ]) } function connectByUrl(dest) { let url = this.get('module/url') let opts = url.parse(dest, true) if (!opts.slashes) opts = url.parse('snmp://'+dest, true) this.send('snmp/connect', Object.assign(opts, opts.query)) } function normalizeOptions(opts) { return { protocol: opts.protocol || 'snmp:', hostname: opts.hostname || '0.0.0.0', port: parseInt(opts.port, 10) || 161, retries: parseInt(opts.retries, 10) || 1, timeout: parseInt(opts.timeout, 10) || 5000, version: 0, community: opts.community || 'public' } }